@ai-setting/roy-agent-core 1.7.52 → 1.7.55

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 (367) hide show
  1. package/dist/config/config-component.d.ts +346 -0
  2. package/dist/config/config-parser.d.ts +45 -0
  3. package/dist/config/env-key.d.ts +97 -0
  4. package/dist/config/env-source.d.ts +113 -0
  5. package/dist/config/file-source.d.ts +90 -0
  6. package/dist/config/index.d.ts +4 -0
  7. package/dist/config/protocol-resolver.d.ts +94 -0
  8. package/dist/env/agent/agent-component.d.ts +646 -0
  9. package/dist/env/agent/agent-config-registration.d.ts +18 -0
  10. package/dist/env/agent/agent-registry.d.ts +500 -0
  11. package/dist/env/agent/index.d.ts +9 -0
  12. package/dist/env/agent/index.js +3 -3
  13. package/dist/env/agent/summary-agent.d.ts +44 -0
  14. package/dist/env/agent/types.d.ts +503 -0
  15. package/dist/env/commands/commands-component.d.ts +97 -0
  16. package/dist/env/commands/commands-config-registration.d.ts +19 -0
  17. package/dist/env/commands/index.d.ts +7 -0
  18. package/dist/env/commands/parser.d.ts +18 -0
  19. package/dist/env/commands/types.d.ts +133 -0
  20. package/dist/env/component.d.ts +186 -0
  21. package/dist/env/constants.d.ts +112 -0
  22. package/dist/env/context/env-context.d.ts +420 -0
  23. package/dist/env/context/env-event.d.ts +144 -0
  24. package/dist/env/context/index.d.ts +13 -0
  25. package/dist/env/debug/debug-component.d.ts +160 -0
  26. package/dist/env/debug/formatters/index.d.ts +8 -0
  27. package/dist/env/debug/formatters/repl-formatter.d.ts +80 -0
  28. package/dist/env/debug/formatters/trace-formatter.d.ts +43 -0
  29. package/dist/env/debug/formatters/tree-formatter.d.ts +72 -0
  30. package/dist/env/debug/index.d.ts +15 -0
  31. package/dist/env/debug/index.js +1 -1
  32. package/dist/env/debug/parser/regex-parser.d.ts +49 -0
  33. package/dist/env/debug/parser/span-builder.d.ts +79 -0
  34. package/dist/env/debug/reader/log-reader.d.ts +55 -0
  35. package/dist/env/debug/reader/span-db-reader.d.ts +70 -0
  36. package/dist/env/debug/types.d.ts +145 -0
  37. package/dist/env/environment.d.ts +185 -0
  38. package/dist/env/error-reply.d.ts +184 -0
  39. package/dist/env/errors.d.ts +120 -0
  40. package/dist/env/event-source/bounty-cli-handler.d.ts +42 -0
  41. package/dist/env/event-source/bounty-im-handler.d.ts +232 -0
  42. package/dist/env/event-source/event-source-component.d.ts +177 -0
  43. package/dist/env/event-source/event-source-config-registration.d.ts +18 -0
  44. package/dist/env/event-source/event-source-handlers.d.ts +472 -0
  45. package/dist/env/event-source/event-store.d.ts +110 -0
  46. package/dist/env/event-source/idempotency-key.d.ts +19 -0
  47. package/dist/env/event-source/index.d.ts +15 -0
  48. package/dist/env/event-source/index.js +6 -6
  49. package/dist/env/event-source/timer-handler.d.ts +74 -0
  50. package/dist/env/event-source/types.d.ts +803 -0
  51. package/dist/env/hook/global-hook-manager.d.ts +73 -0
  52. package/dist/env/hook/hook-manager.d.ts +139 -0
  53. package/dist/env/hook/index.d.ts +9 -0
  54. package/dist/env/hook/types.d.ts +107 -0
  55. package/dist/env/index.d.ts +24 -0
  56. package/dist/env/index.js +18 -18
  57. package/dist/env/interface.d.ts +156 -0
  58. package/dist/env/lark-mention-utils.d.ts +59 -0
  59. package/dist/env/llm/adapter-ai-sdk.d.ts +10 -0
  60. package/dist/env/llm/adapter-pi-ai.d.ts +184 -0
  61. package/dist/env/llm/adapter.d.ts +100 -0
  62. package/dist/env/llm/factory.d.ts +13 -0
  63. package/dist/env/llm/hooks.d.ts +150 -0
  64. package/dist/env/llm/index.d.ts +16 -0
  65. package/dist/env/llm/index.js +2 -2
  66. package/dist/env/llm/invoke.d.ts +304 -0
  67. package/dist/env/llm/llm-cache.d.ts +38 -0
  68. package/dist/env/llm/llm.d.ts +263 -0
  69. package/dist/env/llm/opencode-session.d.ts +79 -0
  70. package/dist/env/llm/provider.d.ts +40 -0
  71. package/dist/env/llm/reasoning-defense.d.ts +104 -0
  72. package/dist/env/llm/tool-args-parser.d.ts +77 -0
  73. package/dist/env/llm/tool-schema.d.ts +54 -0
  74. package/dist/env/llm/transform.d.ts +57 -0
  75. package/dist/env/llm/types.d.ts +844 -0
  76. package/dist/env/log-trace/decorator.d.ts +88 -0
  77. package/dist/env/log-trace/index.d.ts +14 -0
  78. package/dist/env/log-trace/log-trace-component.d.ts +268 -0
  79. package/dist/env/log-trace/log-trace-config-registration.d.ts +25 -0
  80. package/dist/env/log-trace/logger.d.ts +83 -0
  81. package/dist/env/log-trace/opentelemetry/cli-propagation.d.ts +105 -0
  82. package/dist/env/log-trace/opentelemetry/mod.d.ts +24 -0
  83. package/dist/env/log-trace/opentelemetry/propagation-env.d.ts +81 -0
  84. package/dist/env/log-trace/opentelemetry/propagation.d.ts +79 -0
  85. package/dist/env/log-trace/opentelemetry/tracer-provider.d.ts +157 -0
  86. package/dist/env/log-trace/span-storage.d.ts +37 -0
  87. package/dist/env/log-trace/trace-context.d.ts +28 -0
  88. package/dist/env/log-trace/types.d.ts +127 -0
  89. package/dist/env/mcp/command-resolver.d.ts +12 -0
  90. package/dist/env/mcp/config.d.ts +103 -0
  91. package/dist/env/mcp/index.d.ts +13 -0
  92. package/dist/env/mcp/loader.d.ts +78 -0
  93. package/dist/env/mcp/mcp-component.d.ts +54 -0
  94. package/dist/env/mcp/mcp-config-registration.d.ts +19 -0
  95. package/dist/env/mcp/npm-prefix/index.d.ts +17 -0
  96. package/dist/env/mcp/scanner.d.ts +38 -0
  97. package/dist/env/mcp/tool/adapter.d.ts +32 -0
  98. package/dist/env/mcp/tool/index.d.ts +4 -0
  99. package/dist/env/mcp/types.d.ts +131 -0
  100. package/dist/env/memory/built-in/index.d.ts +41 -0
  101. package/dist/env/memory/built-in/recall-memory.d.ts +29 -0
  102. package/dist/env/memory/built-in/record-memory.d.ts +44 -0
  103. package/dist/env/memory/index.d.ts +10 -0
  104. package/dist/env/memory/memory-component.d.ts +114 -0
  105. package/dist/env/memory/memory-config-registration.d.ts +18 -0
  106. package/dist/env/memory/memory-config.d.ts +18 -0
  107. package/dist/env/memory/plugin/index.d.ts +16 -0
  108. package/dist/env/memory/plugin/memory-agent.d.ts +126 -0
  109. package/dist/env/memory/plugin/memory-manager.d.ts +71 -0
  110. package/dist/env/memory/plugin/memory-plugin.d.ts +103 -0
  111. package/dist/env/memory/plugin/recall-memory.d.ts +16 -0
  112. package/dist/env/memory/plugin/types.d.ts +75 -0
  113. package/dist/env/memory/tools/memory-agent-tools.d.ts +109 -0
  114. package/dist/env/memory/types.d.ts +80 -0
  115. package/dist/env/paths.d.ts +46 -0
  116. package/dist/env/plugin/bounty-cli-notification-channel.d.ts +60 -0
  117. package/dist/env/plugin/event-bus-notification-channel.d.ts +50 -0
  118. package/dist/env/plugin/index.d.ts +13 -0
  119. package/dist/env/plugin/lark-cli-notification-channel.d.ts +61 -0
  120. package/dist/env/plugin/notification-channel.d.ts +143 -0
  121. package/dist/env/plugin/plugin-component.d.ts +232 -0
  122. package/dist/env/plugin/types.d.ts +146 -0
  123. package/dist/env/prompt/index.d.ts +7 -0
  124. package/dist/env/prompt/index.js +2 -2
  125. package/dist/env/prompt/prompt-component.d.ts +194 -0
  126. package/dist/env/prompt/prompt-config-registration.d.ts +18 -0
  127. package/dist/env/prompt/prompt-store.d.ts +26 -0
  128. package/dist/env/prompt/prompts-index.d.ts +146 -0
  129. package/dist/env/prompt/renderer.d.ts +21 -0
  130. package/dist/env/prompt/types.d.ts +176 -0
  131. package/dist/env/session/hooks.d.ts +14 -0
  132. package/dist/env/session/index.d.ts +19 -0
  133. package/dist/env/session/index.js +4 -4
  134. package/dist/env/session/search-query-parser.d.ts +41 -0
  135. package/dist/env/session/session-component.d.ts +464 -0
  136. package/dist/env/session/session-config-registration.d.ts +18 -0
  137. package/dist/env/session/session-id.d.ts +26 -0
  138. package/dist/env/session/session-message-converter.d.ts +142 -0
  139. package/dist/env/session/session-store.d.ts +188 -0
  140. package/dist/env/session/storage/index.d.ts +5 -0
  141. package/dist/env/session/storage/index.js +3 -3
  142. package/dist/env/session/storage/memory.d.ts +119 -0
  143. package/dist/env/session/storage/sqlite.d.ts +108 -0
  144. package/dist/env/session/types.d.ts +705 -0
  145. package/dist/env/session-tree-stopper.d.ts +79 -0
  146. package/dist/env/skill/config.d.ts +13 -0
  147. package/dist/env/skill/index.d.ts +6 -0
  148. package/dist/env/skill/parser.d.ts +9 -0
  149. package/dist/env/skill/scanner.d.ts +25 -0
  150. package/dist/env/skill/skill-component.d.ts +89 -0
  151. package/dist/env/skill/skill-config-registration.d.ts +18 -0
  152. package/dist/env/skill/tool/index.d.ts +1 -0
  153. package/dist/env/skill/tool/skill-tool.d.ts +15 -0
  154. package/dist/env/skill/types.d.ts +61 -0
  155. package/dist/env/task/backend/index.d.ts +24 -0
  156. package/dist/env/task/backend/index.js +702 -0
  157. package/dist/env/task/backend/roy-sidecar-task-port.d.ts +148 -0
  158. package/dist/env/task/backend/sqlite-task-port.d.ts +28 -0
  159. package/dist/env/task/backend/task-store-backend.d.ts +107 -0
  160. package/dist/env/task/backend/types.d.ts +282 -0
  161. package/dist/env/task/delegate/bg-task-id-storage.d.ts +9 -0
  162. package/dist/env/task/delegate/delegate-tool.d.ts +681 -0
  163. package/dist/env/task/delegate/index.d.ts +8 -0
  164. package/dist/env/task/delegate/index.js +2 -2
  165. package/dist/env/task/delegate/process-registry.d.ts +58 -0
  166. package/dist/env/task/delegate/stop-tool.d.ts +12 -0
  167. package/dist/env/task/delegate/subagent-resolver.d.ts +25 -0
  168. package/dist/env/task/events/index.d.ts +7 -0
  169. package/dist/env/task/events/task-event-payloads.d.ts +101 -0
  170. package/dist/env/task/events/task-event-types.d.ts +23 -0
  171. package/dist/env/task/hooks/contexts.d.ts +191 -0
  172. package/dist/env/task/hooks/index.d.ts +7 -0
  173. package/dist/env/task/hooks/task-hook-points.d.ts +42 -0
  174. package/dist/env/task/index.d.ts +7 -0
  175. package/dist/env/task/index.js +3 -3
  176. package/dist/env/task/plugins/auto-task-plugin.d.ts +38 -0
  177. package/dist/env/task/plugins/card-chat-routing.d.ts +88 -0
  178. package/dist/env/task/plugins/fake-user-message-helper.d.ts +90 -0
  179. package/dist/env/task/plugins/index.d.ts +8 -0
  180. package/dist/env/task/plugins/index.js +4 -4
  181. package/dist/env/task/plugins/lark-card-action-handler.d.ts +166 -0
  182. package/dist/env/task/plugins/lark-card-patch-notifier.d.ts +600 -0
  183. package/dist/env/task/plugins/lark-cli-task-notify-plugin.d.ts +231 -0
  184. package/dist/env/task/plugins/max-iteration-reminder-plugin.d.ts +112 -0
  185. package/dist/env/task/plugins/per-task-group-chat-plugin.d.ts +561 -0
  186. package/dist/env/task/plugins/task-tag-plugin.d.ts +70 -0
  187. package/dist/env/task/plugins/workflow-extractor-agent.d.ts +43 -0
  188. package/dist/env/task/registry-hook-installer.d.ts +43 -0
  189. package/dist/env/task/storage/index.d.ts +5 -0
  190. package/dist/env/task/storage/migrations/001_add_project_path_context.d.ts +14 -0
  191. package/dist/env/task/storage/migrations/002_add_task_type.d.ts +14 -0
  192. package/dist/env/task/storage/migrations/003_add_process_description.d.ts +20 -0
  193. package/dist/env/task/storage/migrations/004_rename_action_to_milestone.d.ts +37 -0
  194. package/dist/env/task/storage/migrations/005_convert_blob_description_to_text.d.ts +51 -0
  195. package/dist/env/task/storage/sqlite-task-store.d.ts +241 -0
  196. package/dist/env/task/tag-service.d.ts +138 -0
  197. package/dist/env/task/task-child-context.d.ts +70 -0
  198. package/dist/env/task/task-component.d.ts +270 -0
  199. package/dist/env/task/task-config-registration.d.ts +19 -0
  200. package/dist/env/task/task-creation-registry.d.ts +181 -0
  201. package/dist/env/task/task-reuse-context.d.ts +52 -0
  202. package/dist/env/task/task-reuse-registry.d.ts +31 -0
  203. package/dist/env/task/tools/batch-archive-tool.d.ts +9 -0
  204. package/dist/env/task/tools/batch-delete-tool.d.ts +9 -0
  205. package/dist/env/task/tools/complete-tool.d.ts +12 -0
  206. package/dist/env/task/tools/create-tool.d.ts +6 -0
  207. package/dist/env/task/tools/delete-tool.d.ts +6 -0
  208. package/dist/env/task/tools/get-tool.d.ts +6 -0
  209. package/dist/env/task/tools/index.d.ts +13 -0
  210. package/dist/env/task/tools/list-tool.d.ts +6 -0
  211. package/dist/env/task/tools/operation/create-tool.d.ts +12 -0
  212. package/dist/env/task/tools/operation/delete-tool.d.ts +6 -0
  213. package/dist/env/task/tools/operation/get-tool.d.ts +6 -0
  214. package/dist/env/task/tools/operation/index.d.ts +8 -0
  215. package/dist/env/task/tools/operation/list-tool.d.ts +6 -0
  216. package/dist/env/task/tools/operation/operation-types.d.ts +225 -0
  217. package/dist/env/task/tools/operation/update-tool.d.ts +6 -0
  218. package/dist/env/task/tools/search-tool.d.ts +9 -0
  219. package/dist/env/task/tools/task-tree-tool.d.ts +65 -0
  220. package/dist/env/task/tools/task-types.d.ts +255 -0
  221. package/dist/env/task/tools/update-tool.d.ts +6 -0
  222. package/dist/env/task/types.d.ts +290 -0
  223. package/dist/env/tool/built-in/bash-effect.d.ts +36 -0
  224. package/dist/env/tool/built-in/bash.d.ts +16 -0
  225. package/dist/env/tool/built-in/echo.d.ts +7 -0
  226. package/dist/env/tool/built-in/edit-file.d.ts +6 -0
  227. package/dist/env/tool/built-in/glob.d.ts +6 -0
  228. package/dist/env/tool/built-in/grep.d.ts +6 -0
  229. package/dist/env/tool/built-in/index.d.ts +39 -0
  230. package/dist/env/tool/built-in/query-background-process-tool.d.ts +113 -0
  231. package/dist/env/tool/built-in/read-file.d.ts +5 -0
  232. package/dist/env/tool/built-in/understand-image.d.ts +59 -0
  233. package/dist/env/tool/built-in/write-file.d.ts +5 -0
  234. package/dist/env/tool/index.d.ts +16 -0
  235. package/dist/env/tool/registry.d.ts +61 -0
  236. package/dist/env/tool/tool-component.d.ts +242 -0
  237. package/dist/env/tool/tool-config-registration.d.ts +18 -0
  238. package/dist/env/tool/types.d.ts +274 -0
  239. package/dist/env/tool/validator.d.ts +14 -0
  240. package/dist/env/types.d.ts +184 -0
  241. package/dist/env/workflow/decorators/decorator-node.d.ts +76 -0
  242. package/dist/env/workflow/decorators/edge.d.ts +42 -0
  243. package/dist/env/workflow/decorators/index.d.ts +13 -0
  244. package/dist/env/workflow/decorators/node-as.d.ts +40 -0
  245. package/dist/env/workflow/decorators/workflow.d.ts +30 -0
  246. package/dist/env/workflow/engine/dag-manager.d.ts +176 -0
  247. package/dist/env/workflow/engine/engine.d.ts +440 -0
  248. package/dist/env/workflow/engine/event-bus.d.ts +54 -0
  249. package/dist/env/workflow/engine/executor.d.ts +122 -0
  250. package/dist/env/workflow/engine/index.d.ts +15 -0
  251. package/dist/env/workflow/engine/index.js +2 -2
  252. package/dist/env/workflow/engine/node-registry.d.ts +159 -0
  253. package/dist/env/workflow/engine/scheduler.d.ts +164 -0
  254. package/dist/env/workflow/extractor/workflow-converter.d.ts +55 -0
  255. package/dist/env/workflow/fixtures.d.ts +401 -0
  256. package/dist/env/workflow/hooks/index.d.ts +4 -0
  257. package/dist/env/workflow/hooks/workflow-hook-points.d.ts +161 -0
  258. package/dist/env/workflow/index.d.ts +30 -0
  259. package/dist/env/workflow/index.js +9 -9
  260. package/dist/env/workflow/metadata/keys.d.ts +6 -0
  261. package/dist/env/workflow/nodes/agent-component-adapter.d.ts +175 -0
  262. package/dist/env/workflow/nodes/agent-node.d.ts +206 -0
  263. package/dist/env/workflow/nodes/ask-user-node.d.ts +66 -0
  264. package/dist/env/workflow/nodes/condition-node.d.ts +39 -0
  265. package/dist/env/workflow/nodes/index.d.ts +8 -0
  266. package/dist/env/workflow/nodes/index.js +1 -1
  267. package/dist/env/workflow/nodes/merge-node.d.ts +40 -0
  268. package/dist/env/workflow/nodes/python-call-node.d.ts +95 -0
  269. package/dist/env/workflow/nodes/skill-node.d.ts +29 -0
  270. package/dist/env/workflow/nodes/tool-node.d.ts +64 -0
  271. package/dist/env/workflow/nodes/workflow-node.d.ts +118 -0
  272. package/dist/env/workflow/plugins/index.d.ts +6 -0
  273. package/dist/env/workflow/plugins/index.js +2 -2
  274. package/dist/env/workflow/plugins/lark-cli-workflow-notify-plugin.d.ts +107 -0
  275. package/dist/env/workflow/plugins/workflow-json-output-plugin.d.ts +166 -0
  276. package/dist/env/workflow/runtime/runtime-cancellation-scope.d.ts +121 -0
  277. package/dist/env/workflow/service/index.d.ts +9 -0
  278. package/dist/env/workflow/service/registry.d.ts +37 -0
  279. package/dist/env/workflow/service/workflow-service.d.ts +422 -0
  280. package/dist/env/workflow/storage/index.d.ts +11 -0
  281. package/dist/env/workflow/storage/mock-repositories.d.ts +106 -0
  282. package/dist/env/workflow/storage/safe-json.d.ts +62 -0
  283. package/dist/env/workflow/storage/sqlite.d.ts +57 -0
  284. package/dist/env/workflow/storage/tag-repo.d.ts +65 -0
  285. package/dist/env/workflow/storage/workflow-repo.d.ts +161 -0
  286. package/dist/env/workflow/tools/ask-user-tool.d.ts +35 -0
  287. package/dist/env/workflow/tools/index.d.ts +16 -0
  288. package/dist/env/workflow/tools/index.js +6 -6
  289. package/dist/env/workflow/tools/run-workflow.d.ts +130 -0
  290. package/dist/env/workflow/tools/submit-json-output-tool.d.ts +38 -0
  291. package/dist/env/workflow/tools/workflow-add-tool.d.ts +47 -0
  292. package/dist/env/workflow/tools/workflow-get-tool.d.ts +29 -0
  293. package/dist/env/workflow/tools/workflow-list-tool.d.ts +55 -0
  294. package/dist/env/workflow/tools/workflow-run-status-tool.d.ts +26 -0
  295. package/dist/env/workflow/tools/workflow-run-stop-tool.d.ts +29 -0
  296. package/dist/env/workflow/tools/workflow-search-tool.d.ts +33 -0
  297. package/dist/env/workflow/tools/workflow-tag-list-tool.d.ts +59 -0
  298. package/dist/env/workflow/tools/workflow-validate-tool.d.ts +69 -0
  299. package/dist/env/workflow/types/context.d.ts +17 -0
  300. package/dist/env/workflow/types/decorators-types.d.ts +182 -0
  301. package/dist/env/workflow/types/edge.d.ts +33 -0
  302. package/dist/env/workflow/types/event.d.ts +869 -0
  303. package/dist/env/workflow/types/index.d.ts +16 -0
  304. package/dist/env/workflow/types/run.d.ts +254 -0
  305. package/dist/env/workflow/types/workflow-error.d.ts +79 -0
  306. package/dist/env/workflow/types/workflow-hil.d.ts +57 -0
  307. package/dist/env/workflow/types/workflow-message.d.ts +193 -0
  308. package/dist/env/workflow/types/workflow-session.d.ts +17 -0
  309. package/dist/env/workflow/types/workflow.d.ts +654 -0
  310. package/dist/env/workflow/types_compat.d.ts +10 -0
  311. package/dist/env/workflow/utils/agent-session-metadata.d.ts +48 -0
  312. package/dist/env/workflow/utils/build-agent-node-output.d.ts +11 -0
  313. package/dist/env/workflow/utils/create-workflow.d.ts +35 -0
  314. package/dist/env/workflow/utils/dependency-prescan.d.ts +67 -0
  315. package/dist/env/workflow/utils/execution-state.d.ts +46 -0
  316. package/dist/env/workflow/utils/extract-agent-json-output.d.ts +6 -0
  317. package/dist/env/workflow/utils/index.d.ts +14 -0
  318. package/dist/env/workflow/utils/index.js +1 -1
  319. package/dist/env/workflow/utils/json-schema-to-zod.d.ts +23 -0
  320. package/dist/env/workflow/utils/node-id-utils.d.ts +20 -0
  321. package/dist/env/workflow/utils/node-output-contracts.d.ts +137 -0
  322. package/dist/env/workflow/utils/node-registry-helper.d.ts +36 -0
  323. package/dist/env/workflow/utils/output-schema-hint.d.ts +7 -0
  324. package/dist/env/workflow/utils/parse-agent-output-config.d.ts +9 -0
  325. package/dist/env/workflow/utils/recovery-validator.d.ts +30 -0
  326. package/dist/env/workflow/utils/redact-command-secrets.d.ts +70 -0
  327. package/dist/env/workflow/utils/sensitive-redact.d.ts +37 -0
  328. package/dist/env/workflow/utils/session-parser.d.ts +23 -0
  329. package/dist/env/workflow/utils/session-recovery.d.ts +122 -0
  330. package/dist/env/workflow/utils/shell-dialect-lint.d.ts +75 -0
  331. package/dist/env/workflow/utils/template-contract-validator.d.ts +87 -0
  332. package/dist/env/workflow/utils/template-resolver.d.ts +285 -0
  333. package/dist/env/workflow/utils/validate-workflow-definition.d.ts +79 -0
  334. package/dist/env/workflow/utils/validation-rules.d.ts +103 -0
  335. package/dist/env/workflow/utils/workflow-message-metadata.d.ts +20 -0
  336. package/dist/env/workflow/utils/workflow-sanitize.d.ts +51 -0
  337. package/dist/env/workflow/workflow-component.d.ts +138 -0
  338. package/dist/index.d.ts +59 -0
  339. package/dist/index.js +21 -21
  340. package/dist/shared/@ai-setting/{roy-agent-core-stnddvx9.js → roy-agent-core-12d2xap8.js} +1 -1
  341. package/dist/shared/@ai-setting/{roy-agent-core-pk1b3kvf.js → roy-agent-core-2b8jtv7m.js} +1 -1
  342. package/dist/shared/@ai-setting/{roy-agent-core-x8n1r7h4.js → roy-agent-core-2bscfrr1.js} +188 -7
  343. package/dist/shared/@ai-setting/{roy-agent-core-gdsqp6j8.js → roy-agent-core-6masakz4.js} +45 -0
  344. package/dist/shared/@ai-setting/{roy-agent-core-vvxb9522.js → roy-agent-core-6qxh4xrm.js} +67 -6
  345. package/dist/shared/@ai-setting/{roy-agent-core-h93v6p6y.js → roy-agent-core-7qy3nffr.js} +2 -2
  346. package/dist/shared/@ai-setting/{roy-agent-core-s214vmmd.js → roy-agent-core-8eqngasy.js} +2 -2
  347. package/dist/shared/@ai-setting/{roy-agent-core-brwzs8wf.js → roy-agent-core-9h72sk1n.js} +1 -1
  348. package/dist/shared/@ai-setting/{roy-agent-core-na73mym1.js → roy-agent-core-a4vzsn0g.js} +212 -1
  349. package/dist/shared/@ai-setting/{roy-agent-core-35s1w7tc.js → roy-agent-core-aer5kw1j.js} +142 -70
  350. package/dist/shared/@ai-setting/{roy-agent-core-j8e92gj8.js → roy-agent-core-b5ew8t0k.js} +0 -59
  351. package/dist/shared/@ai-setting/{roy-agent-core-rcfewbzr.js → roy-agent-core-cd62e9p1.js} +1 -1
  352. package/dist/shared/@ai-setting/{roy-agent-core-39xejr39.js → roy-agent-core-e2z1etk4.js} +1 -1
  353. package/dist/shared/@ai-setting/{roy-agent-core-pkpkctvf.js → roy-agent-core-g36jevrk.js} +14 -183
  354. package/dist/shared/@ai-setting/{roy-agent-core-ezgsem94.js → roy-agent-core-j2nvedt6.js} +465 -128
  355. package/dist/shared/@ai-setting/{roy-agent-core-p2r27era.js → roy-agent-core-mxdc756a.js} +1 -1
  356. package/dist/shared/@ai-setting/{roy-agent-core-p8ak03s0.js → roy-agent-core-w527pcpe.js} +293 -42
  357. package/dist/shared/@ai-setting/{roy-agent-core-3tv1q6f2.js → roy-agent-core-ytr2w0vb.js} +2 -2
  358. package/dist/shared/@ai-setting/{roy-agent-core-yd21n6c7.js → roy-agent-core-zvemdfx5.js} +1 -1
  359. package/dist/test-utils/child-process-mock.d.ts +73 -0
  360. package/dist/util/process/process-tree-killer.d.ts +67 -0
  361. package/dist/utils/id.d.ts +11 -0
  362. package/dist/utils/loose-json.d.ts +30 -0
  363. package/dist/utils/media.d.ts +70 -0
  364. package/dist/utils/temp-file-manager/index.d.ts +99 -0
  365. package/package.json +5 -3
  366. /package/dist/shared/@ai-setting/{roy-agent-core-zy3hqfwg.js → roy-agent-core-0hq21px2.js} +0 -0
  367. /package/dist/shared/@ai-setting/{roy-agent-core-0cfaqnz9.js → roy-agent-core-k25gv86p.js} +0 -0
@@ -0,0 +1,48 @@
1
+ import type { AgentSessionRef } from '../types/workflow-message';
2
+ /**
3
+ * Update a single agent session's status by nodeId.
4
+ * Returns a new array; does not mutate input. Returns empty array if input is undefined/empty.
5
+ */
6
+ export declare function updateAgentSessionStatus(agentSessions: AgentSessionRef[] | undefined, nodeId: string, status: AgentSessionRef['status']): AgentSessionRef[];
7
+ /**
8
+ * Mark a single node's agent session as 'completed'.
9
+ * Convenience wrapper over updateAgentSessionStatus for symmetry with Failed/Stopped.
10
+ */
11
+ export declare function markAgentSessionCompleted(agentSessions: AgentSessionRef[] | undefined, nodeId: string): AgentSessionRef[];
12
+ /**
13
+ * Register (or refresh) a node's agent sub-session reference.
14
+ *
15
+ * Replaces an existing entry for the same `nodeId` (refresh + reset to
16
+ * 'active') or appends a new one. Returns a new array; does not mutate input.
17
+ *
18
+ * Task #4412 C1: this used to be inline in `AgentNode.createAgentSubSession()`
19
+ * operating directly on the metadata it had just read, which loses entries when
20
+ * sibling agent nodes register concurrently. Extracted here so the engine can
21
+ * run it *inside* its serialized metadata queue (where the array it receives is
22
+ * guaranteed to be the current one).
23
+ */
24
+ export declare function upsertAgentSession(agentSessions: AgentSessionRef[] | undefined, nodeId: string, agentSessionId: string): AgentSessionRef[];
25
+ /**
26
+ * Mark a single node's agent session as 'failed'.
27
+ */
28
+ export declare function markAgentSessionFailed(agentSessions: AgentSessionRef[] | undefined, nodeId: string): AgentSessionRef[];
29
+ /**
30
+ * Mark a single node's agent session as 'stopped'.
31
+ */
32
+ export declare function markAgentSessionStopped(agentSessions: AgentSessionRef[] | undefined, nodeId: string): AgentSessionRef[];
33
+ /**
34
+ * Mark ALL non-terminal (active/paused) agent sessions as 'completed'.
35
+ * Already-terminal sessions (completed/failed/stopped) are preserved.
36
+ * Used by WorkflowEngine.completeWorkflow().
37
+ */
38
+ export declare function markAllAgentSessionsCompleted(agentSessions: AgentSessionRef[] | undefined): AgentSessionRef[];
39
+ /**
40
+ * Mark ALL non-terminal (active/paused) agent sessions as 'stopped'.
41
+ * Used by WorkflowEngine.stop() — distinguishes a graceful stop from a failure.
42
+ */
43
+ export declare function markAllAgentSessionsStopped(agentSessions: AgentSessionRef[] | undefined): AgentSessionRef[];
44
+ /**
45
+ * Mark ALL non-terminal (active/paused) agent sessions as 'failed'.
46
+ * Used by WorkflowEngine.failWorkflow().
47
+ */
48
+ export declare function markAllAgentSessionsFailed(agentSessions: AgentSessionRef[] | undefined): AgentSessionRef[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Build AgentNode execution output, flattening JSON fields for template access.
3
+ *
4
+ * When output.mode=json, the structured JSON is extracted from agentResult.structuredOutput
5
+ * (populated by workflow-json-output-plugin via json-extract sub-agent tool call).
6
+ * Individual JSON fields are spread so downstream nodes can reference them directly:
7
+ * {{nodes.foo.output.field}} rather than {{nodes.foo.output.result.field}}
8
+ */
9
+ import type { AgentResult } from '../nodes/agent-node';
10
+ import type { AgentOutputConfig } from './parse-agent-output-config';
11
+ export declare function buildAgentNodeOutput(agentResult: AgentResult, outputConfig: AgentOutputConfig): Record<string, unknown>;
@@ -0,0 +1,35 @@
1
+ /**
2
+ * 便捷函数:createWorkflowFromClass
3
+ */
4
+ import type { ConvertedWorkflowDefinition } from '../types/decorators-types';
5
+ /**
6
+ * 从装饰器类创建 WorkflowDefinition
7
+ *
8
+ * 这是最常用的便捷函数,自动处理实例创建和转换
9
+ *
10
+ * @param targetClass - 使用 @Workflow 装饰的类
11
+ * @param options - 可选配置
12
+ * @returns WorkflowDefinition
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * @Workflow({ name: 'my-workflow', entry: 'start' })
17
+ * class MyWorkflow {
18
+ * @NodeAs({ nodeId: 'start' })
19
+ * async start() { return { done: true }; }
20
+ * }
21
+ *
22
+ * // 方式一:自动创建实例
23
+ * const workflow = createWorkflowFromClass(MyWorkflow);
24
+ *
25
+ * // 方式二:传入自定义实例
26
+ * const myInstance = new MyWorkflow(customDep);
27
+ * const workflow = createWorkflowFromClass(MyWorkflow, { instance: myInstance });
28
+ * ```
29
+ */
30
+ export declare function createWorkflowFromClass(targetClass: new (...args: any[]) => any, options?: {
31
+ /** 自定义实例,不传则自动创建 */
32
+ instance?: any;
33
+ /** 构造函数参数 */
34
+ constructorArgs?: any[];
35
+ }): ConvertedWorkflowDefinition;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * @fileoverview Workflow 依赖前置检查 (Step 6.0.5 of roy-rd-with-trace v1.3.0)
3
+ *
4
+ * 在 cli-e2e-test 节点的 build/test/cli_smoke/trace_check 之前,对任务涉及的
5
+ * workflow YAML 文件做 4 类静态依赖一致性检查:
6
+ *
7
+ * 1. checkDependsOnNodesExist — depends_on 节点 ID 是否都存在
8
+ * 2. checkEdgesNodesExist — edges from/to 节点 ID 是否都存在
9
+ * 3. checkEdgesDependsOnConsistency — edges 目标节点的 depends_on 是否包含 from (fan-out/fan-in 反模式)
10
+ * 4. checkEntryNodeExists — entry 节点是否存在
11
+ *
12
+ * 任何一个 FAIL → cli_e2e_status = "FAIL",fail-fast。
13
+ *
14
+ * Task #2241 — v1.3.0 新增(Plan: docs/superpowers/plans/2026-07-21-fix-workflow-parallel-deps-reverify-plan.md)
15
+ */
16
+ import type { WorkflowDefinition } from '../types/workflow';
17
+ /**
18
+ * A single finding from prescan.
19
+ */
20
+ export interface PrescanFinding {
21
+ checkName: 'checkDependsOnNodesExist' | 'checkEdgesNodesExist' | 'checkEdgesDependsOnConsistency' | 'checkEntryNodeExists';
22
+ severity: 'FAIL' | 'WARN';
23
+ message: string;
24
+ nodeIds?: string[];
25
+ }
26
+ /**
27
+ * Aggregate result of prescan.
28
+ */
29
+ export interface PrescanResult {
30
+ ok: boolean;
31
+ findings: PrescanFinding[];
32
+ }
33
+ declare function _prescanWorkflowImpl(workflow: WorkflowDefinition): PrescanResult;
34
+ declare function _checkDependsOnNodesExistImpl(workflow: WorkflowDefinition, nodeIds: Set<string>): PrescanFinding[];
35
+ declare function _checkEdgesNodesExistImpl(workflow: WorkflowDefinition, nodeIds: Set<string>): PrescanFinding[];
36
+ declare function _checkEdgesDependsOnConsistencyImpl(workflow: WorkflowDefinition, _nodeIds: Set<string>): PrescanFinding[];
37
+ declare function _checkEntryNodeExistsImpl(workflow: WorkflowDefinition, nodeIds: Set<string>): PrescanFinding[];
38
+ /**
39
+ * Main entry: prescan a workflow definition object.
40
+ */
41
+ export declare const prescanWorkflow: typeof _prescanWorkflowImpl;
42
+ /**
43
+ * Check 1: every depends_on reference resolves to an existing node ID.
44
+ */
45
+ export declare const checkDependsOnNodesExist: typeof _checkDependsOnNodesExistImpl;
46
+ /**
47
+ * Check 2: every edge from/to resolves to an existing node ID.
48
+ */
49
+ export declare const checkEdgesNodesExist: typeof _checkEdgesNodesExistImpl;
50
+ /**
51
+ * Check 3: for every edge from → to, target node declares from in depends_on.
52
+ * This catches the fan-out/fan-in anti-pattern where edges trigger downstream
53
+ * but the downstream's depends_on declaration doesn't include the source.
54
+ */
55
+ export declare const checkEdgesDependsOnConsistency: typeof _checkEdgesDependsOnConsistencyImpl;
56
+ /**
57
+ * Check 4: the entry node must exist in the nodes list.
58
+ * (Only checked when entry is a string; arrays are skipped — array entry is
59
+ * considered advanced and not covered by this fail-fast rule.)
60
+ */
61
+ export declare const checkEntryNodeExists: typeof _checkEntryNodeExistsImpl;
62
+ /**
63
+ * Load a workflow YAML file from disk and run prescan.
64
+ * Convenience wrapper for Step 6.0.5 CLI invocation.
65
+ */
66
+ export declare function prescanWorkflowFile(path: string): PrescanResult;
67
+ export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Execution State Builder
3
+ *
4
+ * Builds execution state from session messages and workflow definition.
5
+ */
6
+ import type { WorkflowDefinition } from '../types';
7
+ import type { SessionMessage } from '../../session/types';
8
+ import type { ExecutionState } from './validation-rules';
9
+ /**
10
+ * Builder for constructing ExecutionState from session data
11
+ */
12
+ export declare class ExecutionStateBuilder {
13
+ build(messages: SessionMessage[], definition: WorkflowDefinition): ExecutionState;
14
+ /**
15
+ * Parse session messages to extract node states and outputs
16
+ */
17
+ private parseMessages;
18
+ /**
19
+ * Build pending nodes from workflow definition
20
+ */
21
+ private buildPendingNodes;
22
+ /**
23
+ * Get entry nodes from workflow definition
24
+ */
25
+ private getEntryNodes;
26
+ /**
27
+ * Mark all nodes as pending starting from a given node
28
+ */
29
+ private markPendingFromNode;
30
+ /**
31
+ * Get direct children of a node
32
+ */
33
+ private getDirectChildren;
34
+ /**
35
+ * Extract input from a workflow.node.call message
36
+ */
37
+ private extractInput;
38
+ /**
39
+ * Extract output from a workflow.node.result message
40
+ */
41
+ private extractOutput;
42
+ /**
43
+ * Extract variables from node output and add to state
44
+ */
45
+ private extractVariables;
46
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extract structured JSON output from agent result (tool submission only).
3
+ */
4
+ import type { AgentResult } from '../nodes/agent-node';
5
+ import type { JsonSchemaObject } from './json-schema-to-zod';
6
+ export declare function extractAgentJsonOutput(agentResult: AgentResult, schema?: JsonSchemaObject): Record<string, unknown> | undefined;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Workflow Utilities
3
+ */
4
+ export { TemplateResolver, resolveTemplates, resolveTemplateString } from './template-resolver';
5
+ export type { TemplateResolverOptions, ResolvedValue } from './template-resolver';
6
+ export { getFromMapWithNormalization } from './node-id-utils';
7
+ export { validateWorkflowDefinition, type ValidateWorkflowResult, type ValidateWorkflowOptions, } from './validate-workflow-definition';
8
+ export { validateTemplateContracts, getTemplateContractErrors, getTemplateContractWarnings, formatTemplateContractFindings, type TemplateContractFinding, type TemplateContractRule, type TemplateContractSeverity, } from './template-contract-validator';
9
+ export { NODE_OUTPUT_CONTRACTS, VIRTUAL_OUTPUT_FIELD, RESULT_INVALID_NODE_TYPES, getNodeOutputContract, hasClosedOutputContract, getAgentDeclaredJsonFields, type NodeOutputContract, } from './node-output-contracts';
10
+ export { RecoveryValidator } from './recovery-validator';
11
+ export { ExecutionStateBuilder } from './execution-state';
12
+ export { ValidationErrorType, SuggestedAction, } from './validation-rules';
13
+ export type { ValidationError, ValidationResult, RecoveryPlan, ExecutionState, } from './validation-rules';
14
+ export { sanitizeWorkflowDefinition, sanitizeShellScript, } from './workflow-sanitize';
@@ -14,7 +14,7 @@ import {
14
14
  hasClosedOutputContract,
15
15
  validateTemplateContracts,
16
16
  validateWorkflowDefinition
17
- } from "../../../shared/@ai-setting/roy-agent-core-na73mym1.js";
17
+ } from "../../../shared/@ai-setting/roy-agent-core-a4vzsn0g.js";
18
18
  import {
19
19
  TemplateResolver,
20
20
  init_template_resolver,
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Minimal JSON Schema → Zod converter for workflow agent output schemas.
3
+ * Supports object types with boolean, string, number, and integer properties.
4
+ */
5
+ import { z } from 'zod';
6
+ export interface JsonSchemaObject {
7
+ type?: string;
8
+ properties?: Record<string, JsonSchemaProperty>;
9
+ required?: string[];
10
+ }
11
+ export interface JsonSchemaProperty {
12
+ type?: string;
13
+ description?: string;
14
+ items?: JsonSchemaProperty;
15
+ properties?: Record<string, JsonSchemaProperty>;
16
+ required?: string[];
17
+ }
18
+ /**
19
+ * Validate workflow AgentNode output.schema at config parse time (YAML load path).
20
+ * Only supports the minimal JSON Schema subset used by jsonSchemaToZod.
21
+ */
22
+ export declare function validateJsonOutputSchema(schema: unknown): JsonSchemaObject;
23
+ export declare function jsonSchemaToZod(schema: JsonSchemaObject): z.ZodObject<z.ZodRawShape>;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @fileoverview Node ID utility functions
3
+ *
4
+ * Provides shared utilities for node ID handling, including
5
+ * hyphen/underscore normalization for flexible node ID matching.
6
+ */
7
+ /**
8
+ * Get a value from a Map with hyphen/underscore normalization.
9
+ *
10
+ * First tries exact match, then tries replacing hyphens with underscores,
11
+ * then tries replacing underscores with hyphens.
12
+ *
13
+ * This handles cases where workflow defines a node with underscore but
14
+ * a template uses hyphen, or vice versa.
15
+ *
16
+ * @param map - The Map to search in
17
+ * @param key - The key to look up
18
+ * @returns The value if found, undefined otherwise
19
+ */
20
+ export declare function getFromMapWithNormalization<V>(map: Map<string, V>, key: string): V | undefined;
@@ -0,0 +1,137 @@
1
+ /**
2
+ * @fileoverview Node output contracts — what a node's stored output looks like
3
+ * at runtime, expressed as the set of first-level fields that a downstream
4
+ * template (`{{nodes.<id>.<field>}}`) can legally navigate into.
5
+ *
6
+ * ## Why this exists (Task #4296 / #4298)
7
+ *
8
+ * A real incident: `wheels-validate-v1` v1.3.0 shipped a workflow whose final
9
+ * `report-results` (agent) node built its prompt from
10
+ * `{{nodes.run-validation-tests.result}}`. But `run-validation-tests` is a
11
+ * **tool** node, and the workflow engine stores `result.output` into
12
+ * `sessionState.nodeOutputs` (engine.ts `nodeOutputs.set(nodeId, result.output)`),
13
+ * i.e. the stored value is the tool's *output*, **never** a `{ result, ... }`
14
+ * envelope.
15
+ *
16
+ * Consequences of the mismatch (all silent):
17
+ * - `template-resolver.navigateTokens()` does property access on a string → `undefined`
18
+ * - `stringify(undefined)` → `''` (Task #2912 behavior)
19
+ * - the engine's non-strict pre-execute validation only `warn`s
20
+ * (`Node "report-results" has unresolved templates: [...]`)
21
+ *
22
+ * Net effect: the agent received an empty string, mis-judged the run and wrote
23
+ * 0/0/0 while the workflow reported `completed`. Nothing failed, nothing was
24
+ * blocked — the definition was semantically wrong but structurally fine.
25
+ *
26
+ * This module supplies the missing *semantic* contract so `workflow_validate`
27
+ * can reject such definitions up-front with an actionable message.
28
+ *
29
+ * ## The contract table (derived from source, not guessed)
30
+ *
31
+ * Every node's `execute()` returns a `NodeExecutionResult`
32
+ * (`{ success?, output, error?, durationMs?/duration? }`) — see
33
+ * `types/run.ts` `NodeExecutionResult`. The engine then stores **only
34
+ * `result.output`** into the shared outputs map. Therefore the fields a
35
+ * downstream template can reach are the fields of that *inner* `output` value
36
+ * (plus the virtual `.output` prefix, which `template-resolver` treats as
37
+ * "unwrap the stored value").
38
+ *
39
+ * | node type | node returns (`output`) | reachable first-level fields |
40
+ * |----------------|-----------------------------------------------|-------------------------------------|
41
+ * | `tool` | tool result (`output`, usually a string) | `output` |
42
+ * | `python_call` | JSON-parsed stdout (object / scalar / string) | `output` |
43
+ * | `skill` | `skill.invoke()` return value | `output` |
44
+ * | `condition` | `{ success, condition }` | `output`, `success`, `condition` |
45
+ * | `merge` | `{ strategy, results, count }` | `output`, `strategy`, `results`, `count` |
46
+ * | `agent` | `{ result, metadata, workflowHistory, ...json }` | `result`, `output`, `metadata`, `workflowHistory`, + declared JSON schema fields |
47
+ * | `workflow` | child workflow's top-level output (unknown) | `output`, `result` (both tolerated) |
48
+ * | `ask_user` | never returns (always throws to pause) | (none) |
49
+ *
50
+ * Source anchors:
51
+ * - `tool-node.ts` (returns `{ output: extractedOutput, error, durationMs }`)
52
+ * - `python-call-node.ts` (`{ output, error: undefined, durationMs }`)
53
+ * - `skill-node.ts` (`{ output, error: undefined, durationMs }`)
54
+ * - `condition-node.ts` (`output: { success, condition }`)
55
+ * - `merge-node.ts` (`output: { strategy, results, count }`)
56
+ * - `agent-node.ts` + `build-agent-node-output.ts` (`{ result, ...json }`)
57
+ * - `workflow-node.ts` (`output: result.output` of the child run)
58
+ */
59
+ /** Fields that are always reachable because `.output` is a virtual prefix
60
+ * (template-resolver treats `{{nodes.X.output}}` as "unwrap the stored value"). */
61
+ export declare const VIRTUAL_OUTPUT_FIELD = "output";
62
+ export interface NodeOutputContract {
63
+ /**
64
+ * First-level fields reachable via `{{nodes.<id>.<field>}}` **in addition to**
65
+ * the virtual `output` prefix (`VIRTUAL_OUTPUT_FIELD` is always allowed).
66
+ */
67
+ fields: string[];
68
+ /**
69
+ * `true` when the field set is *closed* — i.e. any other first-level field is
70
+ * provably unresolvable at runtime and should be flagged.
71
+ * `false` when the shape is open/unknown (agent free-text, child workflow),
72
+ * in which case only a best-effort hint is produced.
73
+ */
74
+ closed: boolean;
75
+ /** Human-readable description of the stored value, used in error messages. */
76
+ description: string;
77
+ /**
78
+ * Suggested replacement field when an unresolvable one is referenced. Used to
79
+ * mint the "Did you mean ...?" hint.
80
+ *
81
+ * Note: for `.result` misuse on a *structured* node (condition / merge) the
82
+ * validator prefers `canonicalField` over this generic fallback — see
83
+ * `getSuggestionFieldForResultMisuse()`.
84
+ */
85
+ suggestedField?: string;
86
+ /**
87
+ * The field that actually carries the node's *answer* (CV-4298 P2#2). Used to
88
+ * make the "Did you mean ...?" hint point at the useful field rather than the
89
+ * generic `.output` wrapper.
90
+ *
91
+ * e.g. a `condition` node's answer is `.condition`; a `merge` node's is
92
+ * `.results`. Leaving it undefined means "no better answer than `.output`".
93
+ */
94
+ canonicalField?: string;
95
+ }
96
+ /**
97
+ * Canonical contracts keyed by node `type`.
98
+ *
99
+ * NOTE on `python_call`: the YAML type token is `pythonCall` in some docs but
100
+ * the registered node type is `python_call` (`python-call-node.ts`:
101
+ * `readonly type = 'python_call'`). Both spellings are registered here so the
102
+ * validator is robust to either.
103
+ */
104
+ export declare const NODE_OUTPUT_CONTRACTS: Record<string, NodeOutputContract>;
105
+ /**
106
+ * Resolve the contract for a node type. Unknown/custom node types get an
107
+ * open-ended contract (`closed: false`) so the validator never false-positives
108
+ * on node types it does not know about.
109
+ */
110
+ export declare function getNodeOutputContract(nodeType: string): NodeOutputContract;
111
+ /**
112
+ * Pick the field to recommend when a `.result` reference is invalid on this node
113
+ * type (CV-4298 P2#2).
114
+ *
115
+ * Order of preference:
116
+ * 1. `canonicalField` — the field that carries the node's answer
117
+ * (condition → `condition`, merge → `results`).
118
+ * 2. `suggestedField` — generic fallback (usually `.output`).
119
+ * 3. `.output` — always resolvable (the virtual unwrap prefix).
120
+ */
121
+ export declare function getSuggestionFieldForResultMisuse(nodeType: string): string;
122
+ /** Whether a contracted node type has a *closed* (fully enumerable) field set. */
123
+ export declare function hasClosedOutputContract(nodeType: string): boolean;
124
+ /**
125
+ * Node types whose stored value is *definitely not* an `{ result, ... }`
126
+ * envelope. Referencing `.result` on these is the canonical "agent idiom
127
+ * misapplied to a data node" bug — treated as an **error**.
128
+ */
129
+ export declare const RESULT_INVALID_NODE_TYPES: Set<string>;
130
+ /**
131
+ * Extract the declared JSON output field names from an agent node's config
132
+ * (`config.output.schema.properties`), when `output.mode === "json"`.
133
+ *
134
+ * Returns `undefined` when the node does not declare a structured schema — in
135
+ * which case the agent's field set is unknowable and the validator stays lenient.
136
+ */
137
+ export declare function getAgentDeclaredJsonFields(config: Record<string, unknown> | undefined): string[] | undefined;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * NodeRegistry 集成辅助
3
+ *
4
+ * 提供函数来帮助将 decorator 节点类型注册到 NodeRegistry
5
+ */
6
+ import type { NodeRegistry } from '../engine/node-registry';
7
+ /**
8
+ * 将所有内置节点类型注册到 NodeRegistry
9
+ *
10
+ * @param registry - NodeRegistry 实例
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { registerDecoratorNodeType } from '@roy-agent/workflow-decorators';
15
+ *
16
+ * // 在 WorkflowComponent 初始化时调用
17
+ * registerDecoratorNodeType(registry);
18
+ * ```
19
+ */
20
+ export declare function registerDecoratorNodeType(registry: NodeRegistry): void;
21
+ /**
22
+ * 检查 WorkflowDefinition 是否包含 decorator 类型的节点
23
+ */
24
+ export declare function hasDecoratorNodes(nodes: Array<{
25
+ type: string;
26
+ }>): boolean;
27
+ /**
28
+ * 从 WorkflowDefinition 中提取所有 decorator 类型的节点
29
+ */
30
+ export declare function getDecoratorNodes(nodes: Array<{
31
+ type: string;
32
+ id: string;
33
+ }>): Array<{
34
+ type: string;
35
+ id: string;
36
+ }>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Human-readable hints derived from AgentNode output JSON schema.
3
+ */
4
+ import type { JsonSchemaObject } from './json-schema-to-zod';
5
+ export declare function describeOutputSchema(schema: JsonSchemaObject | Record<string, unknown> | undefined): string;
6
+ export declare function buildJsonOutputNudgeMessage(schema?: JsonSchemaObject | Record<string, unknown>): string;
7
+ export declare function buildJsonOutputRerunHint(schema?: JsonSchemaObject | Record<string, unknown>): string;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Parse AgentNode output configuration from workflow node config.
3
+ */
4
+ export type AgentOutputMode = 'string' | 'json';
5
+ export interface AgentOutputConfig {
6
+ mode: AgentOutputMode;
7
+ schema?: Record<string, unknown>;
8
+ }
9
+ export declare function parseAgentOutputConfig(config: Record<string, unknown>): AgentOutputConfig;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * RecoveryValidator - 分层恢复验证框架
3
+ *
4
+ * 遵循保守策略,严格验证状态完整性
5
+ */
6
+ import type { WorkflowDefinition } from '../types';
7
+ import type { SessionMessage } from '../../session/types';
8
+ import type { ValidationResult, RecoveryPlan } from './validation-rules';
9
+ /**
10
+ * RecoveryValidator - 分层恢复验证框架
11
+ *
12
+ * 遵循保守策略,严格验证状态完整性
13
+ */
14
+ export declare class RecoveryValidator {
15
+ private stateBuilder;
16
+ constructor();
17
+ validate(messages: SessionMessage[], definition: WorkflowDefinition): Promise<ValidationResult>;
18
+ generatePlan(messages: SessionMessage[], definition: WorkflowDefinition): Promise<RecoveryPlan>;
19
+ private validateStateIntegrity;
20
+ private validateParallelBranches;
21
+ private validateConditionBranches;
22
+ private validateLoopState;
23
+ private validateNestedWorkflows;
24
+ private extractVariableRefs;
25
+ private identifyParallelGroups;
26
+ private findMergeNodeForParallel;
27
+ private identifyLoops;
28
+ private determineResumePoint;
29
+ private generateSummary;
30
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @fileoverview redact-command-secrets.ts — Mask inline secrets in shell commands
3
+ * before they are embedded in a user/agent-visible error message (Task #4392 P0-2).
4
+ *
5
+ * Background: #4385 §5.5 diff-1 asks for `Tool exited with code N` to be enriched
6
+ * with the command that was run. That command may legitimately contain inline
7
+ * credentials (`twine upload --password=...`, `curl -H "Authorization: Bearer ..."`,
8
+ * `PIP_INDEX_TOKEN=... npm publish`), which must NOT leak into:
9
+ * - `workflow.node.end` session messages,
10
+ * - trace span attributes,
11
+ * - the LLM context of the next turn.
12
+ *
13
+ * This helper is a *best-effort* shell-string masker (complementary to
14
+ * `sensitive-redact.ts`, which only redacts object **field names**). It never
15
+ * tries to parse shell; it matches the common credential shapes:
16
+ *
17
+ * 1. `KEY=value` / `KEY: value` / `--flag value` / `--flag=value`
18
+ * where KEY looks sensitive (`ASSIGNMENT_RE`, `FLAG_RE`).
19
+ * 2. `<Scheme> <credential>` auth headers — `Authorization: Bearer <token>`,
20
+ * `Basic <base64>`, `Token <value>`, `Digest <value>` (`AUTH_SCHEME_RE`).
21
+ * The value is a *separate* word from the scheme, hence its own rule.
22
+ * 3. URL query credentials — `?token=`, `&api_key=`, `&secret=`, `&sig=`
23
+ * (`URL_QUERY_RE`).
24
+ * 4. URL userinfo credentials — `https://user:pass@host` (`URL_USERINFO_RE`).
25
+ * 5. Short-option credentials — `curl -u user:pass`, `docker login -p <pw>`,
26
+ * `mysql -pVALUE` (`SHORT_CRED_RE`).
27
+ *
28
+ * ## Why rules 2–5 exist (Task #4419, from #4417 §B-1)
29
+ *
30
+ * The original implementation only had rules 1, and its bare-value branch stops
31
+ * at the first whitespace. `Authorization: Bearer <token>` is *two* words, so it
32
+ * masked `Bearer` and left the token intact. #4417 measured 9 of 14 real command
33
+ * shapes still leaking. Rules 2–5 close those holes.
34
+ *
35
+ * ## Ordering / idempotency
36
+ *
37
+ * The rules are applied in a fixed order and each rule already skips values that
38
+ * equal the `[REDACTED]` sentinel, so `redact(redact(x)) === redact(x)` holds.
39
+ * Rule 2 is applied **before** rule 1: rule 1 would otherwise see
40
+ * `Authorization: Bearer` and mask only the scheme word, leaving an
41
+ * `Authorization: [REDACTED] <token>` remainder that rule 2 can no longer anchor.
42
+ *
43
+ * ## Non-goals
44
+ *
45
+ * - No shell parsing / word-splitting (quoting, `$VAR` expansion, heredocs).
46
+ * - Environment-variable *references* (`$TOKEN`, `${TOKEN}`) are left alone —
47
+ * the variable name is not itself a secret, and masking it destroys the
48
+ * diagnostic value of the message.
49
+ */
50
+ /**
51
+ * Mask inline secrets inside a single shell command string.
52
+ *
53
+ * Idempotent: masked values (`[REDACTED]`) are left as-is.
54
+ *
55
+ * @param command - The raw command string (may be multi-line).
56
+ * @returns The command with sensitive values replaced by `[REDACTED]`.
57
+ */
58
+ export declare function redactCommandSecrets(command: string): string;
59
+ /**
60
+ * Collapse a multi-line command into a single readable line and truncate it.
61
+ *
62
+ * Rationale: error messages are rendered as one line in `workflow.node.end`
63
+ * messages and in most logs; embedding raw newlines makes them unreadable and
64
+ * breaks naive `grep`-based diagnosis.
65
+ *
66
+ * @param command - Raw command (possibly multi-line, possibly huge).
67
+ * @param maxLen - Maximum length of the returned string (default 120).
68
+ * @returns Single-line, whitespace-normalized, truncated command.
69
+ */
70
+ export declare function summarizeCommand(command: string, maxLen?: number): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * @fileoverview sensitive-redact.ts — Redact sensitive fields from input before persisting (Task #2900 P1)
3
+ *
4
+ * Background: engine.ts was persisting the raw workflow `input` object into
5
+ * session metadata.input, leaking sensitive fields (password / LDAP_PASSWORD /
6
+ * apiKey / token / secret) to the session DB. This util produces a deep-copy
7
+ * with sensitive keys replaced by the `"[REDACTED]"` sentinel.
8
+ *
9
+ * Design choices:
10
+ * - Case-insensitive matching (PASSWORD / Password / password all redacted).
11
+ * - Recurses into nested objects AND arrays (so {config:{auth:{password}}}
12
+ * and [{user, password}] are both safe).
13
+ * - Does NOT mutate the input — callers can safely pass the original object
14
+ * elsewhere.
15
+ * - Returns undefined for undefined/null input so engine.ts:447 etc. behave
16
+ * identically when no input was supplied.
17
+ * - Returns non-object scalars (strings, numbers, booleans) unchanged —
18
+ * they can't contain field names.
19
+ *
20
+ * Sensitive key list (lowercase, prefix-matched):
21
+ * password, ldap_password, apikey, api_key, token, secret, auth,
22
+ * access_token, refresh_token, authorization, cookie, private_key,
23
+ * session_token, sid
24
+ *
25
+ * Note: 'sid' is included to redact the ONES ones-ids-sid cookie value if
26
+ * accidentally passed as a top-level field (the workflow uses sidCookie,
27
+ * not sid, so this is defensive).
28
+ */
29
+ /** Sentinel value used to replace redacted fields. */
30
+ export declare const REDACTED_SENTINEL = "[REDACTED]";
31
+ /**
32
+ * Redact sensitive fields from `input`. Returns a new object/array with
33
+ * sensitive values replaced by "[REDACTED]". Non-sensitive scalars and
34
+ * non-object values pass through unchanged. Returns undefined for
35
+ * undefined/null input.
36
+ */
37
+ export declare function redactSensitiveFields<T = unknown>(input: T): T | undefined;
@@ -0,0 +1,23 @@
1
+ import type { SessionMessage } from '../../session/types';
2
+ /**
3
+ * 查找最后一个 workflow.node.interrupt 消息
4
+ */
5
+ export declare function findLastInterruptMessage(messages: SessionMessage[]): SessionMessage | null;
6
+ /**
7
+ * 解析节点输出
8
+ *
9
+ * 通过匹配 workflow.node.start 和 workflow.node.end 消息对来提取节点输出
10
+ */
11
+ export declare function parseNodeOutputs(messages: SessionMessage[]): Map<string, unknown>;
12
+ /**
13
+ * 获取下一个待执行的节点
14
+ */
15
+ export declare function getNextPendingNode(messages: SessionMessage[]): string | null;
16
+ /**
17
+ * 从 interrupt 消息获取 agentSessionId
18
+ */
19
+ export declare function getAgentSessionIdFromInterrupt(interruptMessage: SessionMessage): string | undefined;
20
+ /**
21
+ * 检查 session 是否在等待用户
22
+ */
23
+ export declare function isWaitingForUser(messages: SessionMessage[]): boolean;