@ai-setting/roy-agent-core 1.3.10 → 1.3.14

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 (379) hide show
  1. package/dist/config/index.js +1647 -0
  2. package/dist/index.js +12579 -89691
  3. package/package.json +19 -56
  4. package/src/config/config-component.test.ts +0 -627
  5. package/src/config/config-component.ts +0 -906
  6. package/src/config/config-parser.test.ts +0 -319
  7. package/src/config/config-parser.ts +0 -203
  8. package/src/config/decentralized-config.test.ts +0 -740
  9. package/src/config/env-key.ts +0 -210
  10. package/src/config/env-source.test.ts +0 -252
  11. package/src/config/env-source.ts +0 -301
  12. package/src/config/file-source.test.ts +0 -357
  13. package/src/config/file-source.ts +0 -421
  14. package/src/config/index.ts +0 -24
  15. package/src/config/protocol-resolver.test.ts +0 -217
  16. package/src/config/protocol-resolver.ts +0 -228
  17. package/src/env/agent/agent-component.abort.test.ts +0 -511
  18. package/src/env/agent/agent-component.record-session.test.ts +0 -349
  19. package/src/env/agent/agent-component.test.ts +0 -1389
  20. package/src/env/agent/agent-component.tool-error.test.ts +0 -327
  21. package/src/env/agent/agent-component.ts +0 -1711
  22. package/src/env/agent/agent-config-registration.test.ts +0 -226
  23. package/src/env/agent/agent-config-registration.ts +0 -46
  24. package/src/env/agent/agent-reminder-plugin.integration.test.ts +0 -243
  25. package/src/env/agent/index.ts +0 -10
  26. package/src/env/agent/summary-agent.parse-hint.test.ts +0 -360
  27. package/src/env/agent/summary-agent.ts +0 -508
  28. package/src/env/agent/types.ts +0 -536
  29. package/src/env/commands/commands-component.test.ts +0 -364
  30. package/src/env/commands/commands-component.ts +0 -604
  31. package/src/env/commands/commands-config-registration.test.ts +0 -198
  32. package/src/env/commands/commands-config-registration.ts +0 -38
  33. package/src/env/commands/index.ts +0 -21
  34. package/src/env/commands/parser.test.ts +0 -203
  35. package/src/env/commands/parser.ts +0 -115
  36. package/src/env/commands/types.ts +0 -184
  37. package/src/env/commands-prompt-integration.test.ts +0 -243
  38. package/src/env/component-env.test.ts +0 -119
  39. package/src/env/component.ts +0 -335
  40. package/src/env/constants.test.ts +0 -72
  41. package/src/env/constants.ts +0 -123
  42. package/src/env/debug/debug-component.test.ts +0 -114
  43. package/src/env/debug/debug-component.ts +0 -547
  44. package/src/env/debug/formatters/index.ts +0 -9
  45. package/src/env/debug/formatters/repl-formatter.test.ts +0 -139
  46. package/src/env/debug/formatters/repl-formatter.ts +0 -358
  47. package/src/env/debug/formatters/trace-formatter.test.ts +0 -119
  48. package/src/env/debug/formatters/trace-formatter.ts +0 -191
  49. package/src/env/debug/formatters/tree-formatter.test.ts +0 -107
  50. package/src/env/debug/formatters/tree-formatter.ts +0 -325
  51. package/src/env/debug/index.ts +0 -38
  52. package/src/env/debug/parser/regex-parser.test.ts +0 -201
  53. package/src/env/debug/parser/regex-parser.ts +0 -196
  54. package/src/env/debug/parser/span-builder.test.ts +0 -241
  55. package/src/env/debug/parser/span-builder.ts +0 -386
  56. package/src/env/debug/reader/log-reader.test.ts +0 -170
  57. package/src/env/debug/reader/log-reader.ts +0 -186
  58. package/src/env/debug/reader/span-db-reader.test.ts +0 -118
  59. package/src/env/debug/reader/span-db-reader.ts +0 -201
  60. package/src/env/debug/types.test.ts +0 -187
  61. package/src/env/debug/types.ts +0 -171
  62. package/src/env/environment-init.test.ts +0 -183
  63. package/src/env/environment-lifecycle.test.ts +0 -516
  64. package/src/env/environment-service.test.ts +0 -332
  65. package/src/env/environment.handle-query.test.ts +0 -96
  66. package/src/env/environment.test.ts +0 -232
  67. package/src/env/environment.ts +0 -708
  68. package/src/env/errors.test.ts +0 -165
  69. package/src/env/errors.ts +0 -157
  70. package/src/env/event-source/event-source-agent-handler.test.ts +0 -193
  71. package/src/env/event-source/event-source-agent-handler.ts +0 -111
  72. package/src/env/event-source/event-source-component.process-cleanup.test.ts +0 -236
  73. package/src/env/event-source/event-source-component.stop.test.ts +0 -346
  74. package/src/env/event-source/event-source-component.test.ts +0 -1207
  75. package/src/env/event-source/event-source-component.ts +0 -1379
  76. package/src/env/event-source/event-source-config-registration.test.ts +0 -242
  77. package/src/env/event-source/event-source-config-registration.ts +0 -37
  78. package/src/env/event-source/event-source-integration.test.ts +0 -320
  79. package/src/env/event-source/event-source-platform.test.ts +0 -630
  80. package/src/env/event-source/types.ts +0 -298
  81. package/src/env/hook/global-hook-manager.ts +0 -162
  82. package/src/env/hook/hook-manager.test.ts +0 -374
  83. package/src/env/hook/hook-manager.ts +0 -309
  84. package/src/env/hook/index.ts +0 -38
  85. package/src/env/hook/types.ts +0 -138
  86. package/src/env/index.ts +0 -144
  87. package/src/env/interface.ts +0 -203
  88. package/src/env/llm/hooks.test.ts +0 -293
  89. package/src/env/llm/hooks.ts +0 -316
  90. package/src/env/llm/index.ts +0 -61
  91. package/src/env/llm/invoke-threshold-check.test.ts +0 -88
  92. package/src/env/llm/invoke-timeout.test.ts +0 -54
  93. package/src/env/llm/invoke.test.ts +0 -71
  94. package/src/env/llm/invoke.ts +0 -1039
  95. package/src/env/llm/llm-config.test.ts +0 -523
  96. package/src/env/llm/llm.test.ts +0 -233
  97. package/src/env/llm/llm.ts +0 -568
  98. package/src/env/llm/provider.test.ts +0 -182
  99. package/src/env/llm/provider.ts +0 -108
  100. package/src/env/llm/transform.test.ts +0 -251
  101. package/src/env/llm/transform.ts +0 -286
  102. package/src/env/llm/types.test.ts +0 -580
  103. package/src/env/llm/types.ts +0 -424
  104. package/src/env/log-trace/decorator-otel.test.ts +0 -182
  105. package/src/env/log-trace/decorator.ts +0 -230
  106. package/src/env/log-trace/index.ts +0 -79
  107. package/src/env/log-trace/log-trace-component.test.ts +0 -242
  108. package/src/env/log-trace/log-trace-component.ts +0 -497
  109. package/src/env/log-trace/log-trace-config-registration.test.ts +0 -348
  110. package/src/env/log-trace/log-trace-config-registration.ts +0 -45
  111. package/src/env/log-trace/logger.test.ts +0 -149
  112. package/src/env/log-trace/logger.ts +0 -522
  113. package/src/env/log-trace/opentelemetry/cli-propagation.test.ts +0 -147
  114. package/src/env/log-trace/opentelemetry/cli-propagation.ts +0 -194
  115. package/src/env/log-trace/opentelemetry/integration.test.ts +0 -668
  116. package/src/env/log-trace/opentelemetry/mod.ts +0 -25
  117. package/src/env/log-trace/opentelemetry/propagation-env.test.ts +0 -181
  118. package/src/env/log-trace/opentelemetry/propagation-env.ts +0 -136
  119. package/src/env/log-trace/opentelemetry/propagation.test.ts +0 -259
  120. package/src/env/log-trace/opentelemetry/propagation.ts +0 -215
  121. package/src/env/log-trace/opentelemetry/tracer-provider-context.test.ts +0 -166
  122. package/src/env/log-trace/opentelemetry/tracer-provider.test.ts +0 -379
  123. package/src/env/log-trace/opentelemetry/tracer-provider.ts +0 -612
  124. package/src/env/log-trace/span-storage.test.ts +0 -145
  125. package/src/env/log-trace/span-storage.ts +0 -230
  126. package/src/env/log-trace/trace-context.test.ts +0 -187
  127. package/src/env/log-trace/trace-context.ts +0 -162
  128. package/src/env/log-trace/types.test.ts +0 -63
  129. package/src/env/log-trace/types.ts +0 -172
  130. package/src/env/mcp/README.md +0 -244
  131. package/src/env/mcp/__integration__/mcp-component.integration.test.ts +0 -373
  132. package/src/env/mcp/config.test.ts +0 -74
  133. package/src/env/mcp/config.ts +0 -116
  134. package/src/env/mcp/index.ts +0 -41
  135. package/src/env/mcp/loader.test.ts +0 -161
  136. package/src/env/mcp/loader.ts +0 -209
  137. package/src/env/mcp/mcp-component.test.ts +0 -111
  138. package/src/env/mcp/mcp-component.ts +0 -358
  139. package/src/env/mcp/mcp-config-registration.test.ts +0 -304
  140. package/src/env/mcp/mcp-config-registration.ts +0 -50
  141. package/src/env/mcp/scanner.test.ts +0 -170
  142. package/src/env/mcp/scanner.ts +0 -246
  143. package/src/env/mcp/tool/adapter.test.ts +0 -520
  144. package/src/env/mcp/tool/adapter.ts +0 -521
  145. package/src/env/mcp/tool/index.ts +0 -5
  146. package/src/env/mcp/types.test.ts +0 -171
  147. package/src/env/mcp/types.ts +0 -79
  148. package/src/env/memory/README.md +0 -177
  149. package/src/env/memory/built-in/index.ts +0 -59
  150. package/src/env/memory/built-in/recall-memory.ts +0 -103
  151. package/src/env/memory/built-in/record-memory.ts +0 -148
  152. package/src/env/memory/index.ts +0 -20
  153. package/src/env/memory/memory-component.test.ts +0 -239
  154. package/src/env/memory/memory-component.ts +0 -503
  155. package/src/env/memory/memory-config-registration.test.ts +0 -67
  156. package/src/env/memory/memory-config-registration.ts +0 -48
  157. package/src/env/memory/memory-config.ts +0 -45
  158. package/src/env/memory/memory-file.test.ts +0 -268
  159. package/src/env/memory/plugin/index.ts +0 -48
  160. package/src/env/memory/plugin/memory-agent.test.ts +0 -249
  161. package/src/env/memory/plugin/memory-agent.ts +0 -365
  162. package/src/env/memory/plugin/memory-manager.ts +0 -198
  163. package/src/env/memory/plugin/memory-plugin-agent.test.ts +0 -145
  164. package/src/env/memory/plugin/memory-plugin.ts +0 -210
  165. package/src/env/memory/plugin/plugin-simplified.test.ts +0 -51
  166. package/src/env/memory/plugin/recall-memory.test.ts +0 -106
  167. package/src/env/memory/plugin/recall-memory.ts +0 -53
  168. package/src/env/memory/plugin/types.ts +0 -101
  169. package/src/env/memory/tools/memory-agent-tools.ts +0 -228
  170. package/src/env/memory/types.ts +0 -85
  171. package/src/env/paths.ts +0 -118
  172. package/src/env/prompt/index.ts +0 -18
  173. package/src/env/prompt/memory-prompts.test.ts +0 -91
  174. package/src/env/prompt/prompt-component.test.ts +0 -491
  175. package/src/env/prompt/prompt-component.ts +0 -619
  176. package/src/env/prompt/prompt-config-registration.test.ts +0 -213
  177. package/src/env/prompt/prompt-config-registration.ts +0 -39
  178. package/src/env/prompt/prompts-index.ts +0 -504
  179. package/src/env/prompt/renderer.ts +0 -67
  180. package/src/env/prompt/types.ts +0 -136
  181. package/src/env/session/hooks.ts +0 -18
  182. package/src/env/session/index.ts +0 -37
  183. package/src/env/session/search-query-parser.test.ts +0 -425
  184. package/src/env/session/search-query-parser.ts +0 -171
  185. package/src/env/session/session-checkpoint.test.ts +0 -523
  186. package/src/env/session/session-component.extract-recent-messages.test.ts +0 -209
  187. package/src/env/session/session-component.test.ts +0 -132
  188. package/src/env/session/session-component.ts +0 -1249
  189. package/src/env/session/session-config-registration.test.ts +0 -138
  190. package/src/env/session/session-config-registration.ts +0 -52
  191. package/src/env/session/session-message-converter.test.ts +0 -763
  192. package/src/env/session/session-message-converter.ts +0 -415
  193. package/src/env/session/session-message-e2e.test.ts +0 -448
  194. package/src/env/session/session-search.test.ts +0 -391
  195. package/src/env/session/session-store.test.ts +0 -362
  196. package/src/env/session/session-store.ts +0 -141
  197. package/src/env/session/storage/index.ts +0 -6
  198. package/src/env/session/storage/memory.ts +0 -502
  199. package/src/env/session/storage/sqlite.ts +0 -794
  200. package/src/env/session/types.ts +0 -742
  201. package/src/env/skill/config.ts +0 -39
  202. package/src/env/skill/index.ts +0 -6
  203. package/src/env/skill/parser.test.ts +0 -116
  204. package/src/env/skill/parser.ts +0 -77
  205. package/src/env/skill/scanner.test.ts +0 -211
  206. package/src/env/skill/scanner.ts +0 -119
  207. package/src/env/skill/skill-component.test.ts +0 -234
  208. package/src/env/skill/skill-component.ts +0 -352
  209. package/src/env/skill/skill-config-registration.test.ts +0 -60
  210. package/src/env/skill/skill-config-registration.ts +0 -43
  211. package/src/env/skill/tool/index.ts +0 -1
  212. package/src/env/skill/tool/skill-tool.test.ts +0 -100
  213. package/src/env/skill/tool/skill-tool.ts +0 -72
  214. package/src/env/skill/types.ts +0 -64
  215. package/src/env/task/delegate/delegate-tool.test.ts +0 -498
  216. package/src/env/task/delegate/delegate-tool.ts +0 -1014
  217. package/src/env/task/delegate/index.ts +0 -18
  218. package/src/env/task/delegate/stop-tool.test.ts +0 -140
  219. package/src/env/task/delegate/stop-tool.ts +0 -119
  220. package/src/env/task/delegate/task-events.test.ts +0 -178
  221. package/src/env/task/delegate/task-events.ts +0 -143
  222. package/src/env/task/hooks/contexts.test.ts +0 -92
  223. package/src/env/task/hooks/contexts.ts +0 -192
  224. package/src/env/task/hooks/index.ts +0 -23
  225. package/src/env/task/hooks/task-hook-points.test.ts +0 -32
  226. package/src/env/task/hooks/task-hook-points.ts +0 -54
  227. package/src/env/task/index.ts +0 -7
  228. package/src/env/task/plugins/index.ts +0 -13
  229. package/src/env/task/plugins/task-plugin.test.ts +0 -74
  230. package/src/env/task/plugins/task-plugin.ts +0 -89
  231. package/src/env/task/plugins/task-tag-plugin.test.ts +0 -377
  232. package/src/env/task/plugins/task-tag-plugin.ts +0 -319
  233. package/src/env/task/plugins/task-workflow-extractor.integration.test.ts +0 -226
  234. package/src/env/task/plugins/workflow-extractor-agent.test.ts +0 -107
  235. package/src/env/task/plugins/workflow-extractor-agent.ts +0 -225
  236. package/src/env/task/storage/index.ts +0 -6
  237. package/src/env/task/storage/sqlite-task-store.test.ts +0 -283
  238. package/src/env/task/storage/sqlite-task-store.ts +0 -903
  239. package/src/env/task/storage/task-search.test.ts +0 -291
  240. package/src/env/task/tag-service.test.ts +0 -198
  241. package/src/env/task/tag-service.ts +0 -264
  242. package/src/env/task/task-component.test.ts +0 -193
  243. package/src/env/task/task-component.ts +0 -658
  244. package/src/env/task/task-config-registration.test.ts +0 -57
  245. package/src/env/task/task-config-registration.ts +0 -37
  246. package/src/env/task/task-types.test.ts +0 -137
  247. package/src/env/task/tools/complete-tool.ts +0 -44
  248. package/src/env/task/tools/create-tool.ts +0 -49
  249. package/src/env/task/tools/delete-tool.ts +0 -43
  250. package/src/env/task/tools/get-tool.ts +0 -59
  251. package/src/env/task/tools/index.ts +0 -10
  252. package/src/env/task/tools/list-tool.ts +0 -40
  253. package/src/env/task/tools/operation/create-tool.ts +0 -48
  254. package/src/env/task/tools/operation/delete-tool.ts +0 -43
  255. package/src/env/task/tools/operation/get-tool.ts +0 -43
  256. package/src/env/task/tools/operation/index.ts +0 -9
  257. package/src/env/task/tools/operation/list-tool.ts +0 -40
  258. package/src/env/task/tools/operation/operation-tools.test.ts +0 -274
  259. package/src/env/task/tools/operation/operation-types.ts +0 -75
  260. package/src/env/task/tools/operation/update-tool.ts +0 -47
  261. package/src/env/task/tools/task-tools.test.ts +0 -203
  262. package/src/env/task/tools/task-types.test.ts +0 -75
  263. package/src/env/task/tools/task-types.ts +0 -68
  264. package/src/env/task/tools/update-tool.ts +0 -70
  265. package/src/env/task/types.ts +0 -160
  266. package/src/env/tool/built-in/bash.ts +0 -201
  267. package/src/env/tool/built-in/echo.ts +0 -29
  268. package/src/env/tool/built-in/edit-file.test.ts +0 -136
  269. package/src/env/tool/built-in/edit-file.ts +0 -92
  270. package/src/env/tool/built-in/glob.test.ts +0 -94
  271. package/src/env/tool/built-in/glob.ts +0 -65
  272. package/src/env/tool/built-in/grep.test.ts +0 -122
  273. package/src/env/tool/built-in/grep.ts +0 -108
  274. package/src/env/tool/built-in/index.ts +0 -44
  275. package/src/env/tool/built-in/read-file.test.ts +0 -84
  276. package/src/env/tool/built-in/read-file.ts +0 -75
  277. package/src/env/tool/built-in/write-file.test.ts +0 -119
  278. package/src/env/tool/built-in/write-file.ts +0 -68
  279. package/src/env/tool/index.ts +0 -24
  280. package/src/env/tool/registry.test.ts +0 -257
  281. package/src/env/tool/registry.ts +0 -167
  282. package/src/env/tool/tool-component.test.ts +0 -559
  283. package/src/env/tool/tool-component.ts +0 -563
  284. package/src/env/tool/tool-config-registration.test.ts +0 -249
  285. package/src/env/tool/tool-config-registration.ts +0 -46
  286. package/src/env/tool/types.ts +0 -267
  287. package/src/env/tool/validator.test.ts +0 -143
  288. package/src/env/tool/validator.ts +0 -44
  289. package/src/env/types.ts +0 -180
  290. package/src/env/workflow/ask-user-tool-registration.test.ts +0 -216
  291. package/src/env/workflow/complex-workflow.integration.test.ts +0 -1900
  292. package/src/env/workflow/decorators/decorator-node.ts +0 -229
  293. package/src/env/workflow/decorators/decorator.test.ts +0 -196
  294. package/src/env/workflow/decorators/edge.ts +0 -82
  295. package/src/env/workflow/decorators/index.ts +0 -31
  296. package/src/env/workflow/decorators/node-as.ts +0 -98
  297. package/src/env/workflow/decorators/workflow.ts +0 -54
  298. package/src/env/workflow/engine/dag-manager.test.ts +0 -570
  299. package/src/env/workflow/engine/dag-manager.ts +0 -594
  300. package/src/env/workflow/engine/engine.ts +0 -1422
  301. package/src/env/workflow/engine/event-bus.test.ts +0 -359
  302. package/src/env/workflow/engine/event-bus.ts +0 -156
  303. package/src/env/workflow/engine/executor-agent-session.test.ts +0 -84
  304. package/src/env/workflow/engine/executor.test.ts +0 -619
  305. package/src/env/workflow/engine/executor.ts +0 -593
  306. package/src/env/workflow/engine/index.ts +0 -24
  307. package/src/env/workflow/engine/node-registry.test.ts +0 -560
  308. package/src/env/workflow/engine/node-registry.ts +0 -289
  309. package/src/env/workflow/engine/resume-removed.test.ts +0 -22
  310. package/src/env/workflow/engine/scheduler.test.ts +0 -715
  311. package/src/env/workflow/engine/scheduler.ts +0 -318
  312. package/src/env/workflow/engine/workflow-engine.test.ts +0 -815
  313. package/src/env/workflow/extractor/workflow-converter.ts +0 -306
  314. package/src/env/workflow/fixtures.ts +0 -380
  315. package/src/env/workflow/index.ts +0 -38
  316. package/src/env/workflow/integration/run-resume-unified.test.ts +0 -186
  317. package/src/env/workflow/integration/service-integration.test.ts +0 -267
  318. package/src/env/workflow/metadata/keys.ts +0 -12
  319. package/src/env/workflow/nodes/agent-component-adapter.test.ts +0 -318
  320. package/src/env/workflow/nodes/agent-component-adapter.ts +0 -448
  321. package/src/env/workflow/nodes/agent-node.test.ts +0 -371
  322. package/src/env/workflow/nodes/agent-node.ts +0 -598
  323. package/src/env/workflow/nodes/ask-user-node.ts +0 -113
  324. package/src/env/workflow/nodes/condition-node.ts +0 -200
  325. package/src/env/workflow/nodes/index.ts +0 -9
  326. package/src/env/workflow/nodes/merge-node.ts +0 -141
  327. package/src/env/workflow/nodes/skill-node.test.ts +0 -253
  328. package/src/env/workflow/nodes/skill-node.ts +0 -393
  329. package/src/env/workflow/nodes/tool-node.test.ts +0 -251
  330. package/src/env/workflow/nodes/tool-node.ts +0 -493
  331. package/src/env/workflow/nodes/workflow-llm-history.test.ts +0 -455
  332. package/src/env/workflow/nodes/workflow-node.test.ts +0 -315
  333. package/src/env/workflow/nodes/workflow-node.ts +0 -311
  334. package/src/env/workflow/service/index.ts +0 -27
  335. package/src/env/workflow/service/registry.test.ts +0 -133
  336. package/src/env/workflow/service/registry.ts +0 -71
  337. package/src/env/workflow/service/workflow-service.test.ts +0 -310
  338. package/src/env/workflow/service/workflow-service.ts +0 -393
  339. package/src/env/workflow/storage/index.ts +0 -28
  340. package/src/env/workflow/storage/mock-repositories.ts +0 -385
  341. package/src/env/workflow/storage/sqlite.test.ts +0 -179
  342. package/src/env/workflow/storage/sqlite.ts +0 -163
  343. package/src/env/workflow/storage/workflow-repo.test.ts +0 -780
  344. package/src/env/workflow/storage/workflow-repo.ts +0 -342
  345. package/src/env/workflow/tools/ask-user-tool.ts +0 -82
  346. package/src/env/workflow/tools/index.ts +0 -26
  347. package/src/env/workflow/tools/run-workflow.test.ts +0 -352
  348. package/src/env/workflow/tools/run-workflow.ts +0 -214
  349. package/src/env/workflow/types/context.ts +0 -18
  350. package/src/env/workflow/types/decorators-types.ts +0 -198
  351. package/src/env/workflow/types/event.test.ts +0 -515
  352. package/src/env/workflow/types/event.ts +0 -193
  353. package/src/env/workflow/types/index.ts +0 -49
  354. package/src/env/workflow/types/run.test.ts +0 -437
  355. package/src/env/workflow/types/run.ts +0 -173
  356. package/src/env/workflow/types/workflow-hil.ts +0 -114
  357. package/src/env/workflow/types/workflow-message.test.ts +0 -138
  358. package/src/env/workflow/types/workflow-message.ts +0 -196
  359. package/src/env/workflow/types/workflow-session.test.ts +0 -95
  360. package/src/env/workflow/types/workflow-session.ts +0 -59
  361. package/src/env/workflow/types/workflow.test.ts +0 -495
  362. package/src/env/workflow/types/workflow.ts +0 -195
  363. package/src/env/workflow/types_compat.ts +0 -51
  364. package/src/env/workflow/utils/create-workflow.ts +0 -47
  365. package/src/env/workflow/utils/execution-state.ts +0 -245
  366. package/src/env/workflow/utils/index.ts +0 -18
  367. package/src/env/workflow/utils/node-registry-helper.ts +0 -58
  368. package/src/env/workflow/utils/recovery-validator.test.ts +0 -460
  369. package/src/env/workflow/utils/recovery-validator.ts +0 -377
  370. package/src/env/workflow/utils/session-parser.test.ts +0 -111
  371. package/src/env/workflow/utils/session-parser.ts +0 -94
  372. package/src/env/workflow/utils/session-recovery.test.ts +0 -334
  373. package/src/env/workflow/utils/session-recovery.ts +0 -188
  374. package/src/env/workflow/utils/template-resolver.test.ts +0 -258
  375. package/src/env/workflow/utils/template-resolver.ts +0 -436
  376. package/src/env/workflow/utils/validation-rules.ts +0 -149
  377. package/src/env/workflow/workflow-component.ts +0 -544
  378. package/src/index.ts +0 -422
  379. package/src/utils/id.ts +0 -21
@@ -1,274 +0,0 @@
1
- /**
2
- * @fileoverview Operation Tools Tests
3
- */
4
-
5
- import { describe, it, expect, beforeEach, afterEach } from "bun:test";
6
- import { TaskComponent } from "../../task-component";
7
- import { ConfigComponent } from "../../../../config/config-component";
8
- import { tmpdir } from "os";
9
- import { join } from "path";
10
- import { createTaskTool } from "../create-tool";
11
- import {
12
- createOperationTool,
13
- getOperationTool,
14
- listOperationsTool,
15
- updateOperationTool,
16
- deleteOperationTool
17
- } from "./index";
18
-
19
- describe("Operation Tools", () => {
20
- let taskComponent: TaskComponent;
21
- let taskId: number;
22
-
23
- beforeEach(async () => {
24
- const configComponent = new ConfigComponent();
25
- taskComponent = new TaskComponent();
26
- await taskComponent.init({
27
- options: {
28
- configComponent,
29
- config: {
30
- storage: {
31
- type: "sqlite",
32
- dbPath: join(tmpdir(), `operation-tools-test-${Date.now()}.db`),
33
- },
34
- },
35
- },
36
- });
37
-
38
- // Create a task for testing operations
39
- const createTool = createTaskTool(taskComponent);
40
- const result = await createTool.execute(
41
- { title: "Test Task" },
42
- { session_id: "sess_123" }
43
- );
44
- taskId = result.metadata?.task_id as number;
45
- });
46
-
47
- afterEach(async () => {
48
- await taskComponent.stop();
49
- });
50
-
51
- describe("task_operation_create", () => {
52
- it("should create an operation record", async () => {
53
- const tool = createOperationTool(taskComponent);
54
- const result = await tool.execute(
55
- {
56
- task_id: taskId,
57
- action_type: "progress",
58
- action_title: "Made progress",
59
- action_description: "Completed feature X",
60
- },
61
- { session_id: "sess_456" }
62
- );
63
-
64
- expect(result.success).toBe(true);
65
- expect(result.output).toContain("Operation created");
66
- expect(result.metadata?.operation_id).toBeGreaterThan(0);
67
- expect(result.metadata?.session_id).toBe("sess_456");
68
- });
69
-
70
- it("should track sessionId from context", async () => {
71
- const tool = createOperationTool(taskComponent);
72
- const result = await tool.execute(
73
- {
74
- task_id: taskId,
75
- action_type: "milestone",
76
- action_title: "Reached milestone",
77
- },
78
- { session_id: "sess_789" }
79
- );
80
-
81
- expect(result.success).toBe(true);
82
- expect(result.metadata?.session_id).toBe("sess_789");
83
- });
84
- });
85
-
86
- describe("task_operation_get", () => {
87
- it("should get operation by id", async () => {
88
- // Create an operation first
89
- const createTool = createOperationTool(taskComponent);
90
- const createResult = await createTool.execute(
91
- { task_id: taskId, action_type: "progress", action_title: "Test" },
92
- { session_id: "sess_123" }
93
- );
94
-
95
- const opId = createResult.metadata?.operation_id as number;
96
-
97
- // Get it
98
- const tool = getOperationTool(taskComponent);
99
- const result = await tool.execute(
100
- { operation_id: opId },
101
- { session_id: "sess_123" }
102
- );
103
-
104
- expect(result.success).toBe(true);
105
- const op = JSON.parse(result.output as string);
106
- expect(op.actionType).toBe("progress");
107
- expect(op.sessionId).toBe("sess_123");
108
- });
109
-
110
- it("should return error for non-existent operation", async () => {
111
- const tool = getOperationTool(taskComponent);
112
- const result = await tool.execute(
113
- { operation_id: 99999 },
114
- { session_id: "sess_123" }
115
- );
116
-
117
- expect(result.success).toBe(false);
118
- expect(result.error).toContain("not found");
119
- });
120
- });
121
-
122
- describe("task_operation_list", () => {
123
- it("should list operations for a task", async () => {
124
- // Create multiple operations
125
- const createTool = createOperationTool(taskComponent);
126
- await createTool.execute(
127
- { task_id: taskId, action_type: "create", action_title: "Created" },
128
- { session_id: "sess_1" }
129
- );
130
- await createTool.execute(
131
- { task_id: taskId, action_type: "progress", action_title: "Progress 1" },
132
- { session_id: "sess_2" }
133
- );
134
- await createTool.execute(
135
- { task_id: taskId, action_type: "progress", action_title: "Progress 2" },
136
- { session_id: "sess_3" }
137
- );
138
-
139
- // List them
140
- const tool = listOperationsTool(taskComponent);
141
- const result = await tool.execute(
142
- { task_id: taskId },
143
- { session_id: "sess_123" }
144
- );
145
-
146
- expect(result.success).toBe(true);
147
- const data = JSON.parse(result.output as string);
148
- expect(data.count).toBeGreaterThanOrEqual(3);
149
- });
150
-
151
- it("should filter by action_type", async () => {
152
- const createTool = createOperationTool(taskComponent);
153
- await createTool.execute(
154
- { task_id: taskId, action_type: "progress", action_title: "P1" },
155
- { session_id: "sess_1" }
156
- );
157
- await createTool.execute(
158
- { task_id: taskId, action_type: "milestone", action_title: "M1" },
159
- { session_id: "sess_2" }
160
- );
161
- await createTool.execute(
162
- { task_id: taskId, action_type: "progress", action_title: "P2" },
163
- { session_id: "sess_3" }
164
- );
165
-
166
- const tool = listOperationsTool(taskComponent);
167
- const result = await tool.execute(
168
- { task_id: taskId, action_type: "progress" },
169
- { session_id: "sess_123" }
170
- );
171
-
172
- expect(result.success).toBe(true);
173
- const data = JSON.parse(result.output as string);
174
- expect(data.operations.every((op: any) => op.actionType === "progress")).toBe(true);
175
- });
176
- });
177
-
178
- describe("task_operation_update", () => {
179
- it("should update operation", async () => {
180
- // Create an operation
181
- const createTool = createOperationTool(taskComponent);
182
- const createResult = await createTool.execute(
183
- { task_id: taskId, action_type: "progress", action_title: "Original" },
184
- { session_id: "sess_123" }
185
- );
186
-
187
- const opId = createResult.metadata?.operation_id as number;
188
-
189
- // Update it
190
- const tool = updateOperationTool(taskComponent);
191
- const result = await tool.execute(
192
- { operation_id: opId, action_title: "Updated", action_description: "New description" },
193
- { session_id: "sess_123" }
194
- );
195
-
196
- expect(result.success).toBe(true);
197
-
198
- // Verify
199
- const getTool = getOperationTool(taskComponent);
200
- const getResult = await getTool.execute(
201
- { operation_id: opId },
202
- { session_id: "sess_123" }
203
- );
204
- const op = JSON.parse(getResult.output as string);
205
- expect(op.actionTitle).toBe("Updated");
206
- expect(op.actionDescription).toBe("New description");
207
- });
208
- });
209
-
210
- describe("task_operation_delete", () => {
211
- it("should delete operation", async () => {
212
- // Create an operation
213
- const createTool = createOperationTool(taskComponent);
214
- const createResult = await createTool.execute(
215
- { task_id: taskId, action_type: "progress", action_title: "Delete me" },
216
- { session_id: "sess_123" }
217
- );
218
-
219
- const opId = createResult.metadata?.operation_id as number;
220
-
221
- // Delete it
222
- const tool = deleteOperationTool(taskComponent);
223
- const result = await tool.execute(
224
- { operation_id: opId },
225
- { session_id: "sess_123" }
226
- );
227
-
228
- expect(result.success).toBe(true);
229
-
230
- // Verify it's gone
231
- const getTool = getOperationTool(taskComponent);
232
- const getResult = await getTool.execute(
233
- { operation_id: opId },
234
- { session_id: "sess_123" }
235
- );
236
- expect(getResult.success).toBe(false);
237
- });
238
- });
239
-
240
- describe("cross-session tracking", () => {
241
- it("should track operations from multiple sessions", async () => {
242
- const createTool = createOperationTool(taskComponent);
243
-
244
- await createTool.execute(
245
- { task_id: taskId, action_type: "create", action_title: "Session 1" },
246
- { session_id: "sess_alpha" }
247
- );
248
-
249
- await createTool.execute(
250
- { task_id: taskId, action_type: "progress", action_title: "Session 2" },
251
- { session_id: "sess_beta" }
252
- );
253
-
254
- await createTool.execute(
255
- { task_id: taskId, action_type: "milestone", action_title: "Session 3" },
256
- { session_id: "sess_gamma" }
257
- );
258
-
259
- // List and check sessions
260
- const tool = listOperationsTool(taskComponent);
261
- const result = await tool.execute(
262
- { task_id: taskId },
263
- { session_id: "sess_123" }
264
- );
265
-
266
- const data = JSON.parse(result.output as string);
267
- const sessions = new Set(data.operations.map((op: any) => op.sessionId));
268
-
269
- expect(sessions.has("sess_alpha")).toBe(true);
270
- expect(sessions.has("sess_beta")).toBe(true);
271
- expect(sessions.has("sess_gamma")).toBe(true);
272
- });
273
- });
274
- });
@@ -1,75 +0,0 @@
1
- /**
2
- * @fileoverview Operation Tool Parameter Schemas
3
- */
4
-
5
- import { z } from "zod";
6
-
7
- /**
8
- * Action type enum
9
- */
10
- const ActionTypeEnum = z.enum([
11
- "create",
12
- "progress",
13
- "milestone",
14
- "problem",
15
- "solution",
16
- "decision",
17
- "review",
18
- "completed",
19
- ]);
20
-
21
- export { ActionTypeEnum };
22
-
23
- /**
24
- * task_operation_create tool parameters
25
- */
26
- export const CreateOperationToolSchema = z.object({
27
- task_id: z.number().describe("Task ID"),
28
- action_type: ActionTypeEnum.describe("Type of action"),
29
- action_title: z.string().describe("Title of the action"),
30
- action_description: z.string().optional().describe("Detailed description"),
31
- md_path: z.string().optional().describe("Path to detailed markdown documentation"),
32
- });
33
-
34
- export type CreateOperationToolParams = z.infer<typeof CreateOperationToolSchema>;
35
-
36
- /**
37
- * task_operation_get tool parameters
38
- */
39
- export const GetOperationToolSchema = z.object({
40
- operation_id: z.number().describe("Operation ID"),
41
- });
42
-
43
- export type GetOperationToolParams = z.infer<typeof GetOperationToolSchema>;
44
-
45
- /**
46
- * task_operation_list tool parameters
47
- */
48
- export const ListOperationsToolSchema = z.object({
49
- task_id: z.number().describe("Task ID"),
50
- action_type: ActionTypeEnum.optional(),
51
- limit: z.number().optional().default(20),
52
- offset: z.number().optional().default(0),
53
- });
54
-
55
- export type ListOperationsToolParams = z.infer<typeof ListOperationsToolSchema>;
56
-
57
- /**
58
- * task_operation_update tool parameters
59
- */
60
- export const UpdateOperationToolSchema = z.object({
61
- operation_id: z.number().describe("Operation ID"),
62
- action_title: z.string().optional(),
63
- action_description: z.string().optional(),
64
- });
65
-
66
- export type UpdateOperationToolParams = z.infer<typeof UpdateOperationToolSchema>;
67
-
68
- /**
69
- * task_operation_delete tool parameters
70
- */
71
- export const DeleteOperationToolSchema = z.object({
72
- operation_id: z.number().describe("Operation ID"),
73
- });
74
-
75
- export type DeleteOperationToolParams = z.infer<typeof DeleteOperationToolSchema>;
@@ -1,47 +0,0 @@
1
- /**
2
- * @fileoverview Operation Update Tool
3
- */
4
-
5
- import type { Tool, ToolContext, ToolResult } from "../../../tool/types";
6
- import { UpdateOperationToolSchema, type UpdateOperationToolParams } from "./operation-types";
7
- import type { TaskComponent } from "../../task-component";
8
-
9
- export function updateOperationTool(taskComponent: TaskComponent): Tool {
10
- return {
11
- name: "task_operation_update",
12
- description: "Update an operation record's title or description.",
13
- parameters: UpdateOperationToolSchema,
14
- execute: async (args: unknown, ctx: ToolContext): Promise<ToolResult> => {
15
- const params = UpdateOperationToolSchema.parse(args) as UpdateOperationToolParams;
16
-
17
- try {
18
- const operation = await taskComponent.updateOperation(params.operation_id, {
19
- actionTitle: params.action_title,
20
- actionDescription: params.action_description,
21
- });
22
-
23
- if (!operation) {
24
- return {
25
- success: false,
26
- output: "",
27
- error: `Operation not found: ${params.operation_id}`,
28
- metadata: { execution_time_ms: 0 },
29
- };
30
- }
31
-
32
- return {
33
- success: true,
34
- output: `Operation updated: #${operation.id}`,
35
- metadata: { execution_time_ms: 0, operation },
36
- };
37
- } catch (error) {
38
- return {
39
- success: false,
40
- output: "",
41
- error: error instanceof Error ? error.message : String(error),
42
- metadata: { execution_time_ms: 0 },
43
- };
44
- }
45
- },
46
- };
47
- }
@@ -1,203 +0,0 @@
1
- /**
2
- * @fileoverview Task Tools Tests
3
- */
4
-
5
- import { describe, it, expect, beforeEach, afterEach } from "bun:test";
6
- import { TaskComponent } from "../task-component";
7
- import { ConfigComponent } from "../../../config/config-component";
8
- import { tmpdir } from "os";
9
- import { join } from "path";
10
- import { createTaskTool, getTaskTool, listTasksTool, updateTaskTool, deleteTaskTool, completeTaskTool } from "./index";
11
-
12
- describe("Task Tools", () => {
13
- let taskComponent: TaskComponent;
14
-
15
- beforeEach(async () => {
16
- const configComponent = new ConfigComponent();
17
- taskComponent = new TaskComponent();
18
- await taskComponent.init({
19
- options: {
20
- configComponent,
21
- config: {
22
- storage: {
23
- type: "sqlite",
24
- dbPath: join(tmpdir(), `task-tools-test-${Date.now()}.db`),
25
- },
26
- },
27
- },
28
- });
29
- });
30
-
31
- afterEach(async () => {
32
- await taskComponent.stop();
33
- });
34
-
35
- describe("task_create", () => {
36
- it("should create a task", async () => {
37
- const tool = createTaskTool(taskComponent);
38
- const result = await tool.execute(
39
- { title: "Test Task", description: "Test description" },
40
- { session_id: "sess_123" }
41
- );
42
-
43
- expect(result.success).toBe(true);
44
- expect(result.output).toContain("Test Task");
45
- expect(result.metadata?.task_id).toBeGreaterThan(0);
46
- });
47
-
48
- it("should create task with priority", async () => {
49
- const tool = createTaskTool(taskComponent);
50
- const result = await tool.execute(
51
- { title: "High Priority Task", priority: "high" },
52
- { session_id: "sess_123" }
53
- );
54
-
55
- expect(result.success).toBe(true);
56
- });
57
- });
58
-
59
- describe("task_get", () => {
60
- it("should get task by id", async () => {
61
- // First create a task
62
- const createTool = createTaskTool(taskComponent);
63
- const createResult = await createTool.execute(
64
- { title: "Get Test Task" },
65
- { session_id: "sess_123" }
66
- );
67
-
68
- const taskId = createResult.metadata?.task_id as number;
69
-
70
- // Then get it
71
- const getTool = getTaskTool(taskComponent);
72
- const result = await getTool.execute(
73
- { task_id: taskId },
74
- { session_id: "sess_123" }
75
- );
76
-
77
- expect(result.success).toBe(true);
78
- const task = JSON.parse(result.output as string);
79
- expect(task.title).toBe("Get Test Task");
80
- });
81
-
82
- it("should return error for non-existent task", async () => {
83
- const tool = getTaskTool(taskComponent);
84
- const result = await tool.execute(
85
- { task_id: 99999 },
86
- { session_id: "sess_123" }
87
- );
88
-
89
- expect(result.success).toBe(false);
90
- expect(result.error).toContain("not found");
91
- });
92
- });
93
-
94
- describe("task_list", () => {
95
- it("should list tasks", async () => {
96
- // Create some tasks
97
- const createTool = createTaskTool(taskComponent);
98
- await createTool.execute({ title: "Task 1" }, { session_id: "sess_123" });
99
- await createTool.execute({ title: "Task 2" }, { session_id: "sess_123" });
100
-
101
- // List them
102
- const tool = listTasksTool(taskComponent);
103
- const result = await tool.execute({}, { session_id: "sess_123" });
104
-
105
- expect(result.success).toBe(true);
106
- const data = JSON.parse(result.output as string);
107
- expect(data.count).toBeGreaterThanOrEqual(2);
108
- });
109
-
110
- it("should filter by status", async () => {
111
- const createTool = createTaskTool(taskComponent);
112
- const createResult = await createTool.execute({ title: "Active Task" }, { session_id: "sess_123" });
113
-
114
- // Update to active
115
- const updateTool = updateTaskTool(taskComponent);
116
- await updateTool.execute(
117
- { task_id: createResult.metadata?.task_id, status: "active" },
118
- { session_id: "sess_123" }
119
- );
120
-
121
- // List only active
122
- const listTool = listTasksTool(taskComponent);
123
- const result = await listTool.execute({ status: "active" }, { session_id: "sess_123" });
124
-
125
- expect(result.success).toBe(true);
126
- const data = JSON.parse(result.output as string);
127
- expect(data.tasks.every((t: any) => t.status === "active")).toBe(true);
128
- });
129
- });
130
-
131
- describe("task_update", () => {
132
- it("should update task", async () => {
133
- // Create a task
134
- const createTool = createTaskTool(taskComponent);
135
- const createResult = await createTool.execute({ title: "Original Title" }, { session_id: "sess_123" });
136
-
137
- // Update it
138
- const tool = updateTaskTool(taskComponent);
139
- const result = await tool.execute(
140
- {
141
- task_id: createResult.metadata?.task_id,
142
- title: "Updated Title",
143
- status: "active",
144
- progress: 50,
145
- current_status: "正在实现功能"
146
- },
147
- { session_id: "sess_123" }
148
- );
149
-
150
- expect(result.success).toBe(true);
151
- expect(result.output).toContain("Updated Title");
152
- });
153
- });
154
-
155
- describe("task_delete", () => {
156
- it("should delete task", async () => {
157
- // Create a task
158
- const createTool = createTaskTool(taskComponent);
159
- const createResult = await createTool.execute({ title: "Delete Me" }, { session_id: "sess_123" });
160
-
161
- // Delete it
162
- const tool = deleteTaskTool(taskComponent);
163
- const result = await tool.execute(
164
- { task_id: createResult.metadata?.task_id },
165
- { session_id: "sess_123" }
166
- );
167
-
168
- expect(result.success).toBe(true);
169
- expect(result.output).toContain("deleted");
170
-
171
- // Verify it's gone
172
- const getTool = getTaskTool(taskComponent);
173
- const getResult = await getTool.execute(
174
- { task_id: createResult.metadata?.task_id },
175
- { session_id: "sess_123" }
176
- );
177
- expect(getResult.success).toBe(false);
178
- });
179
- });
180
-
181
- describe("task_complete", () => {
182
- it("should complete task", async () => {
183
- // Create a task
184
- const createTool = createTaskTool(taskComponent);
185
- const createResult = await createTool.execute({ title: "Complete Me" }, { session_id: "sess_123" });
186
-
187
- // Complete it
188
- const tool = completeTaskTool(taskComponent);
189
- const result = await tool.execute(
190
- { task_id: createResult.metadata?.task_id },
191
- { session_id: "sess_123" }
192
- );
193
-
194
- expect(result.success).toBe(true);
195
- expect(result.output).toContain("completed");
196
-
197
- // Verify status
198
- const task = result.metadata?.task as any;
199
- expect(task.status).toBe("completed");
200
- expect(task.progress).toBe(100);
201
- });
202
- });
203
- });
@@ -1,75 +0,0 @@
1
- /**
2
- * @fileoverview Test for task tool schemas
3
- */
4
-
5
- import { describe, expect, test } from "bun:test";
6
- import { CreateTaskToolSchema, UpdateTaskToolSchema } from "./task-types";
7
-
8
- describe("CreateTaskToolSchema", () => {
9
- test("should accept task without tags (tags is optional)", () => {
10
- // tags is now optional (for search, stored in task.tags JSON field)
11
- const validParams = {
12
- title: "Test task",
13
- };
14
-
15
- const result = CreateTaskToolSchema.safeParse(validParams);
16
- expect(result.success).toBe(true);
17
- });
18
-
19
- test("should accept task with tags", () => {
20
- const validParams = {
21
- title: "Test task",
22
- tags: ["test", "feature"],
23
- };
24
-
25
- const result = CreateTaskToolSchema.safeParse(validParams);
26
- expect(result.success).toBe(true);
27
- });
28
-
29
- test("should accept empty tags array", () => {
30
- // tags can be empty array
31
- const params = {
32
- title: "Test task",
33
- tags: [],
34
- };
35
-
36
- const result = CreateTaskToolSchema.safeParse(params);
37
- expect(result.success).toBe(true);
38
- });
39
-
40
- test("should accept all optional fields", () => {
41
- const params = {
42
- title: "Test task",
43
- description: "Test description",
44
- priority: "high" as const,
45
- goals_and_expected_deliverables: "Test goals",
46
- due_date: "2025-12-31",
47
- tags: ["test"],
48
- };
49
-
50
- const result = CreateTaskToolSchema.safeParse(params);
51
- expect(result.success).toBe(true);
52
- });
53
- });
54
-
55
- describe("UpdateTaskToolSchema", () => {
56
- test("tags can be optional in update", () => {
57
- const params = {
58
- task_id: 1,
59
- title: "Updated title",
60
- };
61
-
62
- const result = UpdateTaskToolSchema.safeParse(params);
63
- expect(result.success).toBe(true);
64
- });
65
-
66
- test("should require task_id", () => {
67
- const params = {
68
- title: "Updated title",
69
- tags: ["updated"],
70
- };
71
-
72
- const result = UpdateTaskToolSchema.safeParse(params);
73
- expect(result.success).toBe(false);
74
- });
75
- });