@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,175 @@
1
+ /**
2
+ * @fileoverview AgentComponentAdapter - Bridge between Workflow AgentNode and AgentComponent
3
+ *
4
+ * This adapter implements the AgentRunner interface required by AgentNode,
5
+ * delegating actual execution to the AgentComponent.
6
+ *
7
+ * Usage:
8
+ * ```typescript
9
+ * const agentComponent = env.getComponent<AgentComponent>('agent');
10
+ * const adapter = new AgentComponentAdapter(agentComponent);
11
+ *
12
+ * // Register agents that can be used in workflows
13
+ * adapter.registerAgent('researcher', {
14
+ * systemPrompt: 'You are a research assistant...',
15
+ * type: 'general',
16
+ * model: 'gpt-4'
17
+ * });
18
+ *
19
+ * // Now AgentNode can use 'researcher' agent type
20
+ * const workflow = {
21
+ * nodes: [{
22
+ * type: 'agent',
23
+ * config: { agent_type: 'researcher', prompt: '...' }
24
+ * }]
25
+ * };
26
+ * ```
27
+ */
28
+ import type { AgentComponent } from '../../agent/agent-component';
29
+ import type { AgentRunner, AgentConfig, AgentResult } from './agent-node';
30
+ import type { SessionComponent } from '../../session/session-component';
31
+ /**
32
+ * Pending Agent Session - Stores info needed to resume an agent after user input
33
+ */
34
+ export interface PendingAgentSession {
35
+ agentSessionId: string;
36
+ nodeId: string;
37
+ runId: string;
38
+ createdAt: number;
39
+ }
40
+ /**
41
+ * AgentComponentAdapter
42
+ *
43
+ * Adapts AgentComponent to the AgentRunner interface expected by Workflow's AgentNode.
44
+ * Provides session isolation for agent execution within workflow context.
45
+ *
46
+ * Features:
47
+ * - Creates dedicated agent sessions for each workflow agent node execution
48
+ * - Tracks pending sessions for resume after user input
49
+ * - Supports mapping agent sessions to workflow run session messages
50
+ */
51
+ export declare class AgentComponentAdapter implements AgentRunner {
52
+ private agentComponent;
53
+ private options;
54
+ private _sessionComponent?;
55
+ /** Session prefix for agent sessions */
56
+ private agentSessionPrefix;
57
+ /** Current agent session ID */
58
+ private _currentAgentSessionId?;
59
+ /** Pending agent sessions (waiting for user input) */
60
+ private pendingSessions;
61
+ /** Map from workflow run session to agent sessions */
62
+ private runSessionToAgentSessions;
63
+ /** Ensure workflow JSON output plugin is registered once */
64
+ private jsonOutputPluginRegistered;
65
+ constructor(agentComponent: AgentComponent, options?: AgentComponentAdapterOptions, _sessionComponent?: SessionComponent | undefined);
66
+ private ensureJsonOutputPluginRegistered;
67
+ /**
68
+ * Set the SessionComponent for agent session management
69
+ */
70
+ setSessionComponent(sessionComponent: SessionComponent): void;
71
+ /**
72
+ * Get the current agent session ID
73
+ */
74
+ getCurrentAgentSessionId(): string | undefined;
75
+ /**
76
+ * Register an agent that can be used in workflows
77
+ *
78
+ * @param name - Agent name (used as agent_type in workflow definition)
79
+ * @param config - Agent configuration
80
+ */
81
+ registerAgent(name: string, config: AgentRegistrationConfig): void;
82
+ /**
83
+ * Run an agent
84
+ *
85
+ * Implements AgentRunner interface.
86
+ * Creates a dedicated agent session for each execution within workflow context.
87
+ *
88
+ * @param config - Agent configuration
89
+ * @param resumeOptions - Optional options for resuming a paused agent
90
+ * @returns Agent execution result
91
+ */
92
+ run(config: AgentConfig, resumeOptions?: {
93
+ userQuery?: string;
94
+ agentSessionId?: string;
95
+ }, signal?: AbortSignal): Promise<AgentResult>;
96
+ /**
97
+ * Resume a paused agent with user response
98
+ *
99
+ * This method is called when workflow resumes after user input.
100
+ * It retrieves the pending agent session and continues execution.
101
+ *
102
+ * @param agentSessionId - The agent session ID to resume
103
+ * @param userQuery - User's response to the ask_user query
104
+ * @param config - Original agent config
105
+ * @returns Agent execution result
106
+ */
107
+ resumeAgent(agentSessionId: string, userQuery: string, config: AgentConfig): Promise<AgentResult>;
108
+ /**
109
+ * Get pending agent session by agent session ID
110
+ */
111
+ getPendingSession(agentSessionId: string): PendingAgentSession | undefined;
112
+ /**
113
+ * Get pending agent sessions for a workflow run
114
+ */
115
+ getPendingSessionsForRun(runId: string): PendingAgentSession[];
116
+ /**
117
+ * Get all agent session IDs associated with a workflow session
118
+ */
119
+ getAgentSessionsForWorkflowSession(workflowSessionId: string): string[];
120
+ /**
121
+ * Check if an agent is registered
122
+ */
123
+ hasAgent(name: string): boolean;
124
+ /**
125
+ * Get registered agent configuration
126
+ *
127
+ * Returns the config of a registered agent, useful for workflow
128
+ * agent_name lookups to inherit model, allowedTools, etc.
129
+ *
130
+ * @param name - Agent name
131
+ * @returns Agent registration config or undefined if not found
132
+ */
133
+ getAgentConfig(name: string): AgentRegistrationConfig | undefined;
134
+ /**
135
+ * List all registered agents
136
+ */
137
+ listAgents(): string[];
138
+ /**
139
+ * Get the underlying AgentComponent
140
+ */
141
+ getAgentComponent(): AgentComponent;
142
+ private agentSessionPrefixes;
143
+ }
144
+ /**
145
+ * Options for AgentComponentAdapter
146
+ */
147
+ export interface AgentComponentAdapterOptions {
148
+ /** Default timeout for agent execution (ms) */
149
+ defaultTimeout?: number;
150
+ /** Default session ID prefix */
151
+ defaultSessionPrefix?: string;
152
+ }
153
+ /**
154
+ * Configuration for registering an agent
155
+ */
156
+ export interface AgentRegistrationConfig {
157
+ /** Agent type */
158
+ type?: 'general' | 'research' | 'coder' | 'critic';
159
+ /** Model to use */
160
+ model?: string;
161
+ /** System prompt */
162
+ systemPrompt?: string;
163
+ /** Max iterations */
164
+ maxIterations?: number;
165
+ /** Allowed tools */
166
+ allowedTools?: string[];
167
+ /** Denied tools */
168
+ deniedTools?: string[];
169
+ /** Timeout (ms) */
170
+ timeout?: number;
171
+ /** Max error retries */
172
+ maxErrorRetries?: number;
173
+ /** Session ID prefix for workflow isolation */
174
+ sessionIdPrefix?: string;
175
+ }
@@ -0,0 +1,206 @@
1
+ /**
2
+ * @fileoverview AgentNode - Delegate work to an AI agent
3
+ *
4
+ * AgentNode delegates work to an AI agent with task description and context.
5
+ */
6
+ import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
7
+ import type { SessionComponent } from '../../session/session-component';
8
+ /**
9
+ * Agent 注册配置
10
+ */
11
+ export interface AgentRegistrationConfig {
12
+ /** Agent 类型 */
13
+ type?: string;
14
+ /** 系统提示词 */
15
+ systemPrompt?: string;
16
+ /** 模型名称 */
17
+ model?: string;
18
+ /** 最大迭代次数 */
19
+ maxIterations?: number;
20
+ /** 允许的工具列表 */
21
+ allowedTools?: string[];
22
+ /** 禁止的工具列表 */
23
+ deniedTools?: string[];
24
+ }
25
+ /**
26
+ * AgentRunner 接口
27
+ *
28
+ * 用于运行 AI Agent 的接口
29
+ */
30
+ export interface AgentRunner {
31
+ /**
32
+ * 运行 Agent
33
+ * @param config Agent 配置
34
+ * @param resumeOptions 可选的恢复选项(用于恢复暂停的 agent)
35
+ * @param signal AbortSignal — Task #1976: 当 workflow 节点超时或被 stop 时
36
+ * 通过此 signal 通知 runner 取消。Runner 应当监听 signal.aborted 并
37
+ * 尽快 resolve/reject(不要 hang)。Optional — 老 runner 不实现也 OK。
38
+ * @returns Agent 执行结果
39
+ */
40
+ run(config: AgentConfig, resumeOptions?: {
41
+ userQuery?: string;
42
+ agentSessionId?: string;
43
+ }, signal?: AbortSignal): Promise<AgentResult>;
44
+ /**
45
+ * 恢复暂停的 Agent
46
+ *
47
+ * @param agentSessionId Agent session ID
48
+ * @param userQuery 用户的响应
49
+ * @param config 原始的 agent 配置
50
+ * @returns Agent 执行结果
51
+ */
52
+ resumeAgent?(agentSessionId: string, userQuery: string, config: AgentConfig): Promise<AgentResult>;
53
+ /**
54
+ * 获取当前 agent session ID
55
+ */
56
+ getCurrentAgentSessionId?(): string | undefined;
57
+ /**
58
+ * 设置 SessionComponent
59
+ */
60
+ setSessionComponent?(sessionComponent: SessionComponent): void;
61
+ /**
62
+ * 获取待恢复的 session 信息
63
+ */
64
+ getPendingSession?(agentSessionId: string): {
65
+ agentSessionId: string;
66
+ nodeId: string;
67
+ runId: string;
68
+ createdAt: number;
69
+ } | undefined;
70
+ /**
71
+ * 注册 Agent(如果不存在)
72
+ */
73
+ registerAgent?(name: string, config: AgentRegistrationConfig): void;
74
+ /**
75
+ * 检查 Agent 是否已注册
76
+ */
77
+ hasAgent?(name: string): boolean;
78
+ /**
79
+ * 获取已注册 Agent 的配置
80
+ * @param name Agent 名称
81
+ * @returns Agent 注册配置,如果不存在则返回 undefined
82
+ */
83
+ getAgentConfig?(name: string): AgentRegistrationConfig | undefined;
84
+ }
85
+ /**
86
+ * Agent 配置
87
+ */
88
+ export interface AgentConfig {
89
+ /** Agent 类型 */
90
+ type: string;
91
+ /** Prompt(任务描述) */
92
+ prompt: string;
93
+ /** 可选配置 */
94
+ options?: {
95
+ /** 超时时间(毫秒) */
96
+ timeout?: number;
97
+ /** 模型名称 */
98
+ model?: string;
99
+ /** 允许的工具列表(用于限制 agent 可用的工具) */
100
+ allowedTools?: string[];
101
+ /** 拒绝的工具列表 */
102
+ deniedTools?: string[];
103
+ /** JSON output schema (when output.mode=json) */
104
+ outputSchema?: Record<string, unknown>;
105
+ };
106
+ /** Workflow 历史消息(来自前置 agent 节点) */
107
+ workflowHistory?: Array<{
108
+ role: 'user' | 'assistant' | 'tool';
109
+ content: string;
110
+ toolCallId?: string;
111
+ toolName?: string;
112
+ nodeId?: string;
113
+ }>;
114
+ /** 节点 ID(用于 history 标记) */
115
+ nodeId?: string;
116
+ /** Agent sub-session ID(用于 HiL resume) */
117
+ agentSessionId?: string;
118
+ }
119
+ /**
120
+ * Agent 执行结果
121
+ */
122
+ export interface AgentResult {
123
+ /** Agent 输出 */
124
+ output: unknown;
125
+ /** Structured JSON output (when output.mode=json) */
126
+ structuredOutput?: Record<string, unknown>;
127
+ /** 执行元数据 */
128
+ metadata?: {
129
+ /** 消耗的 token 数量 */
130
+ tokens?: number;
131
+ /** 执行耗时(毫秒) */
132
+ duration?: number;
133
+ /** 其他元数据 */
134
+ [key: string]: unknown;
135
+ };
136
+ /** 生成的消息列表(用于 workflow history 累积) */
137
+ messages?: Array<{
138
+ role: 'user' | 'assistant' | 'tool';
139
+ content: string;
140
+ toolCallId?: string;
141
+ toolName?: string;
142
+ nodeId?: string;
143
+ }>;
144
+ }
145
+ /**
146
+ * AgentNode 类
147
+ *
148
+ * 委托 AI Agent 执行任务的节点类型
149
+ */
150
+ export declare class AgentNode implements Node {
151
+ private definition;
152
+ private agentRunner;
153
+ /** 节点类型 */
154
+ readonly type = "agent";
155
+ /** 节点 ID */
156
+ readonly id: string;
157
+ /**
158
+ * 创建 AgentNode
159
+ * @param definition 节点定义
160
+ * @param agentRunner Agent 运行器
161
+ */
162
+ constructor(definition: NodeDefinition, agentRunner: AgentRunner);
163
+ /**
164
+ * 执行 AgentNode
165
+ *
166
+ * 流程:
167
+ * 1. 从 definition.config 获取 agent 配置
168
+ * 2. 解析 prompt 模板(可能引用前置节点输出)
169
+ * 3. 通过 agentRunner 运行 agent
170
+ * 4. 返回 agent 结果
171
+ *
172
+ * @param context 执行上下文
173
+ * @returns 执行结果
174
+ */
175
+ execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
176
+ /**
177
+ * Apply caller-provided prompt injection to a resolved base prompt.
178
+ *
179
+ * Task #2135 — Workflow input may carry an optional `prompt_injection`
180
+ * string (via `workflow run --input '{"prompt_injection": "..."}'`). When
181
+ * present and non-empty, we append it to the resolved base prompt with a
182
+ * unified separator so the caller can supply runtime hints / context /
183
+ * constraints without re-running template resolution.
184
+ *
185
+ * Behavior:
186
+ * - `promptInjection` undefined / null / empty string → return basePrompt unchanged
187
+ * - otherwise → append with `\n\n---\n[Caller Injection]\n<injection>`
188
+ *
189
+ * Trace: span name `workflow.agent.applyPromptInjection`,
190
+ * `recordParams: true` (record `basePrompt` and `promptInjection` for
191
+ * debugging "injection didn't take effect" bugs), `recordResult: false`
192
+ * (basePrompt may contain sensitive info → never leak it back).
193
+ */
194
+ private applyPromptInjection;
195
+ /**
196
+ * Resolve agent sub-session ID from workflow session metadata.agentSessions
197
+ */
198
+ private resolveAgentSessionIdFromWorkflow;
199
+ /**
200
+ * 创建 agent sub-session
201
+ *
202
+ * Sub-session 用于存储 agent 的对话历史,支持 human-in-loop resume
203
+ */
204
+ private createAgentSubSession;
205
+ }
206
+ export { AgentNode as default };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview AskUserNode - Node for requesting user input
3
+ *
4
+ * This node is used for simple pause/resume scenarios where a workflow
5
+ * needs user input without going through an Agent.
6
+ */
7
+ import type { Node, NodeExecutionResult } from '../types';
8
+ import type { NodeDefinition } from '../types';
9
+ import type { NodeInterruptEvent } from '../types/workflow-hil';
10
+ /**
11
+ * AskUserNode Configuration
12
+ */
13
+ export interface AskUserNodeConfig {
14
+ /** Question to ask the user */
15
+ query?: string;
16
+ /** Optional choices for the user */
17
+ options?: string[];
18
+ /** If true, user must explicitly confirm */
19
+ required_confirm?: boolean;
20
+ }
21
+ /**
22
+ * AskUserNode - Standalone node for user input requests
23
+ *
24
+ * This node pauses the workflow and waits for user response.
25
+ * Used for simple human-in-loop scenarios without an Agent.
26
+ *
27
+ * @example
28
+ * ```yaml
29
+ * nodes:
30
+ * - id: confirm_step
31
+ * type: ask_user
32
+ * config:
33
+ * query: "Do you want to proceed?"
34
+ * options:
35
+ * - "Yes"
36
+ * - "No"
37
+ * - "Cancel"
38
+ * ```
39
+ */
40
+ export declare class AskUserNode implements Node {
41
+ private definition;
42
+ readonly type = "ask_user";
43
+ readonly id: string;
44
+ constructor(definition: NodeDefinition);
45
+ /**
46
+ * Execute the AskUserNode
47
+ *
48
+ * Publishes a node.interrupt event and throws AskUserError to pause workflow.
49
+ *
50
+ * @param context - Node execution context with optional resolvedConfig
51
+ * @throws AskUserError - Always throws to pause workflow
52
+ */
53
+ execute(context: {
54
+ runId: string;
55
+ sessionId: string;
56
+ eventBus: {
57
+ publish(event: NodeInterruptEvent): Promise<void>;
58
+ };
59
+ nodeOutputs: Map<string, unknown>;
60
+ resolvedConfig?: Record<string, unknown>;
61
+ }): Promise<NodeExecutionResult>;
62
+ /**
63
+ * Validate node configuration
64
+ */
65
+ validateConfig(_config: Record<string, unknown>): boolean;
66
+ }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @fileoverview ConditionNode - Workflow condition node
3
+ *
4
+ * Evaluates a condition and decides whether to proceed or skip.
5
+ *
6
+ * Input can contain template strings like {{nodeId.output.path}} that will be
7
+ * resolved from previousOutputs via TemplateResolver.
8
+ */
9
+ import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
10
+ /**
11
+ * ConditionNode evaluates a condition and returns the result.
12
+ *
13
+ * The condition can be:
14
+ * - A boolean value
15
+ * - A template expression that evaluates to a boolean
16
+ * - A template reference to a previous node's output
17
+ *
18
+ * Usage in workflow:
19
+ * ```yaml
20
+ * nodes:
21
+ * - id: check-tests-pass
22
+ * type: condition
23
+ * config:
24
+ * condition: "{{run-unit-tests.success}}"
25
+ * depends_on:
26
+ * - run-unit-tests
27
+ * ```
28
+ */
29
+ export declare class ConditionNode implements Node {
30
+ private definition;
31
+ readonly type = "condition";
32
+ readonly id: string;
33
+ constructor(definition: NodeDefinition);
34
+ execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
35
+ /**
36
+ * Evaluate a resolved condition value.
37
+ */
38
+ private evaluateCondition;
39
+ }
@@ -0,0 +1,8 @@
1
+ export { ToolNode } from './tool-node';
2
+ export type { ToolRegistry, Tool } from './tool-node';
3
+ export { SkillNode } from './skill-node';
4
+ export type { SkillRegistry, Skill } from './skill-node';
5
+ export { WorkflowNode } from './workflow-node';
6
+ export type { WorkflowRunner, WorkflowRunResult } from './workflow-node';
7
+ export { PythonCallNode } from './python-call-node';
8
+ export type { PythonCallAllowList, PythonCallNodeOptions, PythonCallNodeConfig, } from './python-call-node';
@@ -7,7 +7,7 @@ import {
7
7
  init_skill_node,
8
8
  init_tool_node,
9
9
  init_workflow_node
10
- } from "../../../shared/@ai-setting/roy-agent-core-x8n1r7h4.js";
10
+ } from "../../../shared/@ai-setting/roy-agent-core-2bscfrr1.js";
11
11
  import"../../../shared/@ai-setting/roy-agent-core-dsevjbck.js";
12
12
  import"../../../shared/@ai-setting/roy-agent-core-8seq65bp.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-jnszp0jq.js";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @fileoverview MergeNode - Workflow merge/join node
3
+ *
4
+ * A merge node waits for all dependencies to complete and collects their outputs.
5
+ *
6
+ * Input can contain template strings like {{nodeId.output.path}} that will be
7
+ * resolved from previousOutputs.
8
+ */
9
+ import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
10
+ /**
11
+ * MergeNode collects outputs from all dependent nodes and optionally merges them.
12
+ *
13
+ * The merge strategy can be:
14
+ * - "collect": Collect all outputs into an array
15
+ * - "first": Return the first completed output
16
+ * - "last": Return the last completed output
17
+ * - "merge": Deep merge all outputs into a single object
18
+ *
19
+ * Usage in workflow:
20
+ * ```yaml
21
+ * nodes:
22
+ * - id: final
23
+ * type: merge
24
+ * config:
25
+ * strategy: collect
26
+ * depends_on:
27
+ * - log-workflow-complete
28
+ * ```
29
+ */
30
+ export declare class MergeNode implements Node {
31
+ private definition;
32
+ readonly type = "merge";
33
+ readonly id: string;
34
+ constructor(definition: NodeDefinition);
35
+ execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
36
+ /**
37
+ * Deep merge multiple objects into a single object.
38
+ */
39
+ private deepMerge;
40
+ }
@@ -0,0 +1,95 @@
1
+ /**
2
+ * PythonCallNode - workflow node type that invokes a Python function via subprocess.
3
+ *
4
+ * Task #1998: 投资选股 workflow 解耦 CLI/bash 依赖
5
+ *
6
+ * Decouples workflows from hardcoded paths like:
7
+ * `/home/dzk/work/.../.venv/bin/python scripts/foo.py --arg1`
8
+ *
9
+ * Instead, a workflow declares:
10
+ * ```yaml
11
+ * - id: market-timing
12
+ * type: python_call
13
+ * config:
14
+ * module: investment_strategy.scripts.market_timing
15
+ * function: run
16
+ * args:
17
+ * base_top_n: "{{input.base_top_n}}"
18
+ * cwd: /path/to/repo # optional
19
+ * python: /usr/bin/python3 # optional, default: python3
20
+ * timeout: 60000 # optional, ms, default: 60000
21
+ * ```
22
+ *
23
+ * Execution model:
24
+ * - Spawn: `<python> -c "<source>"`
25
+ * where `<source>` imports the module, calls the function with the args,
26
+ * and prints the return value as JSON to stdout.
27
+ * - stdout is parsed as JSON if possible; otherwise returned as a string.
28
+ * - Non-zero exit → result.error is populated.
29
+ * - Timeout → kills subprocess and returns timeout error.
30
+ *
31
+ * Security (MVP):
32
+ * - Module must match the allow-list (default: `investment_strategy.*`).
33
+ * - Function name must be a bare identifier (regex /^[A-Za-z_]\w*$/).
34
+ * - This is a guard rail against arbitrary code execution — not a full sandbox.
35
+ * Workflow authors are trusted operators; the allow-list prevents accidental
36
+ * `module: os` / `module: subprocess` misuse.
37
+ */
38
+ import { spawn } from 'node:child_process';
39
+ import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
40
+ /**
41
+ * Allow-list configuration for Python module names.
42
+ *
43
+ * - `prefix`: each entry matches modules that start with `<entry>.` or equal `<entry>`.
44
+ * - Default: `{ prefix: ['investment_strategy'] }`.
45
+ *
46
+ * Pass an empty `{ prefix: [] }` to disable (NOT recommended in production).
47
+ */
48
+ export interface PythonCallAllowList {
49
+ prefix: string[];
50
+ }
51
+ /**
52
+ * Per-node constructor options.
53
+ */
54
+ export interface PythonCallNodeOptions {
55
+ allowList?: PythonCallAllowList;
56
+ /**
57
+ * Override spawn factory (for tests / Effect-based executors).
58
+ * Signature mirrors `child_process.spawn`.
59
+ */
60
+ spawnFn?: typeof spawn;
61
+ }
62
+ /**
63
+ * Static type for the `config` field of a python_call node.
64
+ */
65
+ export interface PythonCallNodeConfig {
66
+ module: string;
67
+ function: string;
68
+ args?: Record<string, unknown>;
69
+ cwd?: string;
70
+ python?: string;
71
+ timeout?: number;
72
+ }
73
+ /**
74
+ * PythonCallNode — see file header for design.
75
+ */
76
+ export declare class PythonCallNode implements Node {
77
+ private definition;
78
+ readonly type = "python_call";
79
+ readonly id: string;
80
+ private readonly allowList;
81
+ private readonly spawnFn;
82
+ constructor(definition: NodeDefinition, options?: PythonCallNodeOptions);
83
+ /**
84
+ * Validate that `module` is in the allow-list.
85
+ * Returns null when OK, or an error message string.
86
+ */
87
+ private checkAllowList;
88
+ /**
89
+ * Parse JSON emitted by the Python wrapper, including JSON-encoded strings.
90
+ * If stdout is not valid JSON, preserve the raw output while removing only
91
+ * trailing newlines.
92
+ */
93
+ private parseOutput;
94
+ execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
95
+ }
@@ -0,0 +1,29 @@
1
+ import type { Node, NodeDefinition, NodeExecutionContext, NodeExecutionResult } from '../types';
2
+ /**
3
+ * Skill Registry interface for looking up skills
4
+ */
5
+ export interface SkillRegistry {
6
+ getSkill(name: string): Skill | undefined;
7
+ hasSkill(name: string): boolean;
8
+ }
9
+ /**
10
+ * Skill interface for invocation
11
+ */
12
+ export interface Skill {
13
+ name: string;
14
+ invoke(input: any, context: any): Promise<any>;
15
+ }
16
+ /**
17
+ * SkillNode invokes a registered Skill with the provided input.
18
+ *
19
+ * Input can contain template strings like {{nodeId.output.path}} that will be
20
+ * resolved via context.templateResolver.
21
+ */
22
+ export declare class SkillNode implements Node {
23
+ private definition;
24
+ private skillRegistry;
25
+ readonly type = "skill";
26
+ readonly id: string;
27
+ constructor(definition: NodeDefinition, skillRegistry: SkillRegistry);
28
+ execute(context: NodeExecutionContext): Promise<NodeExecutionResult>;
29
+ }