onbuzz 3.4.0 → 3.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (562) hide show
  1. package/package.json +1 -1
  2. package/scripts/bump-version.js +116 -0
  3. package/src/__test-utils__/fixtures/malformedJson.js +31 -0
  4. package/src/__test-utils__/globalSetup.js +9 -0
  5. package/src/__test-utils__/globalTeardown.js +12 -0
  6. package/src/__test-utils__/mockFactories.js +101 -0
  7. package/src/analyzers/__tests__/CSSAnalyzer.test.js +41 -0
  8. package/src/analyzers/__tests__/ConfigValidator.test.js +362 -0
  9. package/src/analyzers/__tests__/ESLintAnalyzer.test.js +271 -0
  10. package/src/analyzers/__tests__/JavaScriptAnalyzer.test.js +40 -0
  11. package/src/analyzers/__tests__/PrettierFormatter.test.js +197 -0
  12. package/src/analyzers/__tests__/PythonAnalyzer.test.js +208 -0
  13. package/src/analyzers/__tests__/SecurityAnalyzer.test.js +303 -0
  14. package/src/analyzers/__tests__/SparrowAnalyzer.test.js +270 -0
  15. package/src/analyzers/__tests__/TypeScriptAnalyzer.test.js +187 -0
  16. package/src/core/__tests__/agentPool.test.js +601 -0
  17. package/src/core/__tests__/agentScheduler.test.js +576 -0
  18. package/src/core/__tests__/contextManager.test.js +252 -0
  19. package/src/core/__tests__/flowExecutor.test.js +262 -0
  20. package/src/core/__tests__/messageProcessor.test.js +627 -0
  21. package/src/core/__tests__/orchestrator.test.js +257 -0
  22. package/src/core/__tests__/stateManager.test.js +375 -0
  23. package/src/core/agentPool.js +26 -4
  24. package/src/core/agentScheduler.js +79 -21
  25. package/src/core/messageProcessor.js +110 -2
  26. package/src/index.js +27 -11
  27. package/src/interfaces/__tests__/imageServing.test.js +228 -0
  28. package/src/interfaces/terminal/__tests__/smoke/imports.test.js +3 -5
  29. package/src/interfaces/webServer.js +97 -13
  30. package/src/services/__tests__/agentActivityService.test.js +319 -0
  31. package/src/services/__tests__/apiKeyManager.test.js +206 -0
  32. package/src/services/__tests__/benchmarkService.test.js +184 -0
  33. package/src/services/__tests__/budgetService.test.js +211 -0
  34. package/src/services/__tests__/contextInjectionService.test.js +205 -0
  35. package/src/services/__tests__/conversationCompactionService.test.js +280 -0
  36. package/src/services/__tests__/credentialVault.test.js +469 -0
  37. package/src/services/__tests__/errorHandler.test.js +314 -0
  38. package/src/services/__tests__/fileAttachmentService.test.js +278 -0
  39. package/src/services/__tests__/flowContextService.test.js +199 -0
  40. package/src/services/__tests__/memoryService.test.js +450 -0
  41. package/src/services/__tests__/modelRouterService.test.js +388 -0
  42. package/src/services/__tests__/modelsService.test.js +261 -0
  43. package/src/services/__tests__/portRegistry.test.js +123 -0
  44. package/src/services/__tests__/projectDetector.test.js +34 -0
  45. package/src/services/__tests__/promptService.test.js +242 -0
  46. package/src/services/__tests__/qualityInspector.test.js +97 -0
  47. package/src/services/__tests__/scheduleService.test.js +308 -0
  48. package/src/services/__tests__/serviceRegistry.test.js +74 -0
  49. package/src/services/__tests__/skillsService.test.js +402 -0
  50. package/src/services/__tests__/tokenCountingService.test.js +48 -0
  51. package/src/services/conversationCompactionService.js +2 -2
  52. package/src/services/visualEditorServer.js +26 -7
  53. package/src/tools/__tests__/agentCommunicationTool.test.js +500 -0
  54. package/src/tools/__tests__/agentDelayTool.test.js +342 -0
  55. package/src/tools/__tests__/asyncToolManager.test.js +344 -0
  56. package/src/tools/__tests__/baseTool.test.js +420 -0
  57. package/src/tools/__tests__/codeMapTool.test.js +348 -0
  58. package/src/tools/__tests__/fileContentReplaceTool.test.js +309 -0
  59. package/src/tools/__tests__/fileTreeTool.test.js +274 -0
  60. package/src/tools/__tests__/filesystemTool.test.js +717 -0
  61. package/src/tools/__tests__/helpTool.test.js +204 -0
  62. package/src/tools/__tests__/jobDoneTool.test.js +296 -0
  63. package/src/tools/__tests__/memoryTool.test.js +297 -0
  64. package/src/tools/__tests__/seekTool.test.js +282 -0
  65. package/src/tools/__tests__/skillsTool.test.js +226 -0
  66. package/src/tools/__tests__/staticAnalysisTool.test.js +509 -0
  67. package/src/tools/__tests__/taskManagerTool.test.js +725 -0
  68. package/src/tools/__tests__/terminalTool.test.js +384 -0
  69. package/src/tools/__tests__/userPromptTool.test.js +297 -0
  70. package/src/tools/__tests__/webTool.e2e.test.js +25 -11
  71. package/src/tools/imageTool.js +41 -5
  72. package/src/tools/webTool.js +161 -48
  73. package/src/types/__tests__/agent.test.js +499 -0
  74. package/src/types/__tests__/contextReference.test.js +606 -0
  75. package/src/types/__tests__/conversation.test.js +555 -0
  76. package/src/types/__tests__/toolCommand.test.js +584 -0
  77. package/src/types/contextReference.js +1 -1
  78. package/src/utilities/__tests__/attachmentValidator.test.js +80 -0
  79. package/src/utilities/__tests__/configManager.test.js +397 -0
  80. package/src/utilities/__tests__/constants.test.js +49 -0
  81. package/src/utilities/__tests__/directoryAccessManager.test.js +388 -0
  82. package/src/utilities/__tests__/fileProcessor.test.js +104 -0
  83. package/src/utilities/__tests__/jsonRepair.test.js +104 -0
  84. package/src/utilities/__tests__/logger.test.js +129 -0
  85. package/src/utilities/__tests__/platformUtils.test.js +87 -0
  86. package/src/utilities/__tests__/structuredFileValidator.test.js +263 -0
  87. package/src/utilities/__tests__/tagParser.test.js +887 -0
  88. package/src/utilities/__tests__/toolConstants.test.js +94 -0
  89. package/src/utilities/tagParser.js +2 -2
  90. package/web-ui/build/index.html +2 -2
  91. package/web-ui/build/static/1c-8PZzOTzp.js +1 -0
  92. package/web-ui/build/static/abap-Bcx_Au1F.js +1 -0
  93. package/web-ui/build/static/abnf-BKTLqpWA.js +1 -0
  94. package/web-ui/build/static/abnf-J05BAvJt.js +1 -0
  95. package/web-ui/build/static/accesslog-Cp8_lqVY.js +1 -0
  96. package/web-ui/build/static/actionscript-BK0UaMrm.js +1 -0
  97. package/web-ui/build/static/actionscript-CyqZUddh.js +1 -0
  98. package/web-ui/build/static/ada-BNirS6Nr.js +1 -0
  99. package/web-ui/build/static/ada-BSFWcT1O.js +1 -0
  100. package/web-ui/build/static/agda-D0NJDJg7.js +1 -0
  101. package/web-ui/build/static/al-rWARKtwb.js +1 -0
  102. package/web-ui/build/static/angelscript-fCehtOYk.js +1 -0
  103. package/web-ui/build/static/antlr4-Dn9jrnZN.js +1 -0
  104. package/web-ui/build/static/apache-DaQCsvNW.js +1 -0
  105. package/web-ui/build/static/apacheconf-dY4i0Xvz.js +1 -0
  106. package/web-ui/build/static/apex-vhS4SI46.js +1 -0
  107. package/web-ui/build/static/apl-CKRkxH90.js +1 -0
  108. package/web-ui/build/static/applescript-CWmpQIEB.js +1 -0
  109. package/web-ui/build/static/applescript-DBaX7Uqo.js +1 -0
  110. package/web-ui/build/static/aql-8s41lrIa.js +1 -0
  111. package/web-ui/build/static/arcade-w2_RhAcq.js +1 -0
  112. package/web-ui/build/static/arduino-I7BtZTu6.js +1 -0
  113. package/web-ui/build/static/arduino-h2LZErKQ.js +1 -0
  114. package/web-ui/build/static/arff-C543-5a1.js +1 -0
  115. package/web-ui/build/static/armasm-DyZdFOzz.js +1 -0
  116. package/web-ui/build/static/asciidoc-ZzENlACu.js +1 -0
  117. package/web-ui/build/static/asciidoc-_j9x9bUz.js +1 -0
  118. package/web-ui/build/static/asm6502-CsNsmBfq.js +1 -0
  119. package/web-ui/build/static/asmatmel-CkIVf_tD.js +1 -0
  120. package/web-ui/build/static/aspectj-C6AQLme_.js +1 -0
  121. package/web-ui/build/static/aspnet-5AkdiVyL.js +1 -0
  122. package/web-ui/build/static/autohotkey-BRZVABiS.js +1 -0
  123. package/web-ui/build/static/autohotkey-DVTmfk_f.js +1 -0
  124. package/web-ui/build/static/autoit-3UEcWu5a.js +1 -0
  125. package/web-ui/build/static/autoit-BDByIKSH.js +1 -0
  126. package/web-ui/build/static/avisynth-BHc4uUkP.js +1 -0
  127. package/web-ui/build/static/avrasm-BAPq8_aI.js +1 -0
  128. package/web-ui/build/static/avro-idl-BKEBYUtv.js +1 -0
  129. package/web-ui/build/static/awk-CBCkArRT.js +1 -0
  130. package/web-ui/build/static/axapta-DlOgnXSZ.js +1 -0
  131. package/web-ui/build/static/bash-C6Brp5OE.js +1 -0
  132. package/web-ui/build/static/bash-DkEO7JRq.js +1 -0
  133. package/web-ui/build/static/basic-DG6TYB0R.js +1 -0
  134. package/web-ui/build/static/basic-DRPcNfAn.js +1 -0
  135. package/web-ui/build/static/batch-DdjZ5KC1.js +1 -0
  136. package/web-ui/build/static/bbcode-DCXEEs2w.js +1 -0
  137. package/web-ui/build/static/bicep-CpLhfOwt.js +1 -0
  138. package/web-ui/build/static/birb-DNWkqgQm.js +1 -0
  139. package/web-ui/build/static/bison-DwxbQHJ9.js +1 -0
  140. package/web-ui/build/static/bnf-Cgnt7npj.js +1 -0
  141. package/web-ui/build/static/bnf-DSTq_eu9.js +1 -0
  142. package/web-ui/build/static/brainfuck-Bi8mGutW.js +1 -0
  143. package/web-ui/build/static/brainfuck-DOWfqVtR.js +1 -0
  144. package/web-ui/build/static/brightscript-D95pbP-v.js +1 -0
  145. package/web-ui/build/static/bro-BrDVwXeg.js +1 -0
  146. package/web-ui/build/static/bsl-BMoXI84g.js +1 -0
  147. package/web-ui/build/static/c-CKH4C7-Z.js +1 -0
  148. package/web-ui/build/static/c-Z0txyaeJ.js +1 -0
  149. package/web-ui/build/static/c-like-Dzm9dMmR.js +1 -0
  150. package/web-ui/build/static/cal-DoyAwiUt.js +1 -0
  151. package/web-ui/build/static/capnproto-DeIi9LOH.js +1 -0
  152. package/web-ui/build/static/ceylon-Coim6DIe.js +1 -0
  153. package/web-ui/build/static/cfscript-CwsndC-j.js +1 -0
  154. package/web-ui/build/static/chaiscript-D6Aq-PSv.js +1 -0
  155. package/web-ui/build/static/cil-vi56VRk_.js +1 -0
  156. package/web-ui/build/static/clean-BfpKrTdp.js +1 -0
  157. package/web-ui/build/static/clojure-DUtl6BaB.js +1 -0
  158. package/web-ui/build/static/clojure-DXJHtDlY.js +1 -0
  159. package/web-ui/build/static/clojure-repl-BxwP5C3g.js +1 -0
  160. package/web-ui/build/static/cmake-C9_VZ1vH.js +1 -0
  161. package/web-ui/build/static/cmake-dplO-PGD.js +1 -0
  162. package/web-ui/build/static/cobol-DsZhu02V.js +1 -0
  163. package/web-ui/build/static/coffeescript-Cw9jtGNP.js +1 -0
  164. package/web-ui/build/static/coffeescript-DvDt4T2l.js +1 -0
  165. package/web-ui/build/static/concurnas-Bzc_Dcdd.js +1 -0
  166. package/web-ui/build/static/coq-Cv-5BqGo.js +1 -0
  167. package/web-ui/build/static/coq-DWFe2ssK.js +1 -0
  168. package/web-ui/build/static/cos-D6Lc6Cah.js +1 -0
  169. package/web-ui/build/static/cpp-BFmLjd76.js +1 -0
  170. package/web-ui/build/static/cpp-DVQgbHji.js +1 -0
  171. package/web-ui/build/static/crmsh-Cqveth9p.js +1 -0
  172. package/web-ui/build/static/crystal-0syYaH4Y.js +1 -0
  173. package/web-ui/build/static/crystal-Noptp-kr.js +1 -0
  174. package/web-ui/build/static/csharp-B799cFMH.js +1 -0
  175. package/web-ui/build/static/csharp-_HlvMZzJ.js +1 -0
  176. package/web-ui/build/static/cshtml-CnwOXlhP.js +1 -0
  177. package/web-ui/build/static/csp-1ffxIG_-.js +1 -0
  178. package/web-ui/build/static/csp-Bws60bPu.js +1 -0
  179. package/web-ui/build/static/css-BGdwXzpm.js +1 -0
  180. package/web-ui/build/static/css-extras-DZCECiOa.js +1 -0
  181. package/web-ui/build/static/csv-FMFGT0T4.js +1 -0
  182. package/web-ui/build/static/cypher-DnXoEwRp.js +1 -0
  183. package/web-ui/build/static/d-CBrts1xB.js +1 -0
  184. package/web-ui/build/static/d-qrJLxk2L.js +1 -0
  185. package/web-ui/build/static/dart-3vBSXJVV.js +1 -0
  186. package/web-ui/build/static/dart-Cj5b7BV9.js +1 -0
  187. package/web-ui/build/static/dataweave-BuFf63rk.js +1 -0
  188. package/web-ui/build/static/dax-Cl-se1JI.js +1 -0
  189. package/web-ui/build/static/delphi-CLkRb26y.js +1 -0
  190. package/web-ui/build/static/dhall--TIL2Z--.js +1 -0
  191. package/web-ui/build/static/diff-Bn-XL2om.js +1 -0
  192. package/web-ui/build/static/diff-BsTwly4w.js +1 -0
  193. package/web-ui/build/static/django-BfRtHnTS.js +1 -0
  194. package/web-ui/build/static/django-Dm9O4e3A.js +1 -0
  195. package/web-ui/build/static/dns-BIVEp3uD.js +1 -0
  196. package/web-ui/build/static/dns-zone-file-CO7LnOdh.js +1 -0
  197. package/web-ui/build/static/docker-BhwMip1R.js +1 -0
  198. package/web-ui/build/static/dockerfile-8Tjw9_jF.js +1 -0
  199. package/web-ui/build/static/dos-CRMiAo46.js +1 -0
  200. package/web-ui/build/static/dot-DPpW7LrJ.js +1 -0
  201. package/web-ui/build/static/dsconfig-D0zbYilI.js +1 -0
  202. package/web-ui/build/static/dts-C_-yqWEL.js +1 -0
  203. package/web-ui/build/static/dust-CucJgqnE.js +1 -0
  204. package/web-ui/build/static/ebnf-CCHK0H6j.js +1 -0
  205. package/web-ui/build/static/ebnf-CDdAcveH.js +1 -0
  206. package/web-ui/build/static/editorconfig-f-5b95UM.js +1 -0
  207. package/web-ui/build/static/eiffel-MmghFce7.js +1 -0
  208. package/web-ui/build/static/ejs-CPMN4-jk.js +1 -0
  209. package/web-ui/build/static/elixir-57Ldyw8h.js +1 -0
  210. package/web-ui/build/static/elixir-DTxnmhIt.js +1 -0
  211. package/web-ui/build/static/elm-ClV9zQoT.js +1 -0
  212. package/web-ui/build/static/elm-pX-i6o7U.js +1 -0
  213. package/web-ui/build/static/erb-BPeO9smT.js +1 -0
  214. package/web-ui/build/static/erb-BnZQ4STz.js +1 -0
  215. package/web-ui/build/static/erlang-DPtI7VK_.js +1 -0
  216. package/web-ui/build/static/erlang-KG5mg5wN.js +1 -0
  217. package/web-ui/build/static/erlang-repl-BqPVXZ3Y.js +1 -0
  218. package/web-ui/build/static/etlua-BRc0Qbbs.js +1 -0
  219. package/web-ui/build/static/excel-BAlZ9Hkj.js +1 -0
  220. package/web-ui/build/static/excel-formula-BOW-bnHh.js +1 -0
  221. package/web-ui/build/static/factor-DCCsCpGM.js +1 -0
  222. package/web-ui/build/static/false-CnqnCzBU.js +1 -0
  223. package/web-ui/build/static/firestore-security-rules-DtkQ3uEq.js +1 -0
  224. package/web-ui/build/static/fix-CfPjl4Xr.js +1 -0
  225. package/web-ui/build/static/flix-BCA3BceS.js +1 -0
  226. package/web-ui/build/static/flow-C-5ewqYW.js +1 -0
  227. package/web-ui/build/static/fortran-CfDtl8An.js +1 -0
  228. package/web-ui/build/static/fortran-DQ_knNPt.js +1 -0
  229. package/web-ui/build/static/fsharp-CcVQ3IqX.js +1 -0
  230. package/web-ui/build/static/fsharp-olQ6ojCa.js +1 -0
  231. package/web-ui/build/static/ftl-DIWHDyWt.js +1 -0
  232. package/web-ui/build/static/gams-_NVFTSj5.js +1 -0
  233. package/web-ui/build/static/gap-DIG5TV2b.js +1 -0
  234. package/web-ui/build/static/gauss-C8rjPjTG.js +1 -0
  235. package/web-ui/build/static/gcode-8wJu4gcL.js +1 -0
  236. package/web-ui/build/static/gcode-DjHf417I.js +1 -0
  237. package/web-ui/build/static/gdscript-BZdmRCYu.js +1 -0
  238. package/web-ui/build/static/gedcom-BVFJ8C_Q.js +1 -0
  239. package/web-ui/build/static/gherkin-7NQkoaub.js +1 -0
  240. package/web-ui/build/static/gherkin-bSpNbJ48.js +1 -0
  241. package/web-ui/build/static/git-BRY_UXsc.js +1 -0
  242. package/web-ui/build/static/glsl-Ck6ShGRC.js +1 -0
  243. package/web-ui/build/static/glsl-jwCJ0Pmg.js +1 -0
  244. package/web-ui/build/static/gml-BAjG4Kr2.js +1 -0
  245. package/web-ui/build/static/gml-BnhKb5Da.js +1 -0
  246. package/web-ui/build/static/gn-Dux09iX8.js +1 -0
  247. package/web-ui/build/static/go-BOG-9Cqk.js +1 -0
  248. package/web-ui/build/static/go-BWZB_3b5.js +1 -0
  249. package/web-ui/build/static/go-module-BVLW7KBE.js +1 -0
  250. package/web-ui/build/static/golo-BD_SOfwL.js +1 -0
  251. package/web-ui/build/static/gradle-zSadWOD2.js +1 -0
  252. package/web-ui/build/static/graphql-BQlyj78B.js +1 -0
  253. package/web-ui/build/static/groovy-BurRMqQS.js +1 -0
  254. package/web-ui/build/static/groovy-SP58zwlE.js +1 -0
  255. package/web-ui/build/static/haml-eZ5ah5KY.js +1 -0
  256. package/web-ui/build/static/haml-lFC47IZb.js +1 -0
  257. package/web-ui/build/static/handlebars-B4UXrB-Q.js +1 -0
  258. package/web-ui/build/static/handlebars-CQ-Q5HnC.js +1 -0
  259. package/web-ui/build/static/haskell-AQrRyTSy.js +1 -0
  260. package/web-ui/build/static/haskell-BZTSbaB_.js +1 -0
  261. package/web-ui/build/static/haxe-5l1X6ESp.js +1 -0
  262. package/web-ui/build/static/haxe-DBn90muG.js +1 -0
  263. package/web-ui/build/static/hcl-CnMewPLM.js +1 -0
  264. package/web-ui/build/static/hlsl-RAtuBzr5.js +1 -0
  265. package/web-ui/build/static/hoon-CSqRU_4M.js +1 -0
  266. package/web-ui/build/static/hpkp-_gNbXcHt.js +1 -0
  267. package/web-ui/build/static/hsp-DY1V4au3.js +1 -0
  268. package/web-ui/build/static/hsts-j5z2jJo8.js +1 -0
  269. package/web-ui/build/static/htmlbars-C5EHvatr.js +1 -0
  270. package/web-ui/build/static/http-DgWgQrZh.js +1 -0
  271. package/web-ui/build/static/http-DphJL0q2.js +1 -0
  272. package/web-ui/build/static/hy-DnBqjPsB.js +1 -0
  273. package/web-ui/build/static/ichigojam-DeiCOKyF.js +1 -0
  274. package/web-ui/build/static/icon-CWANFWY5.js +1 -0
  275. package/web-ui/build/static/icu-message-format-C7w3vpgC.js +1 -0
  276. package/web-ui/build/static/idris-BeD8eULz.js +1 -0
  277. package/web-ui/build/static/iecst-BIznHXqY.js +1 -0
  278. package/web-ui/build/static/ignore-BcFgcNaS.js +1 -0
  279. package/web-ui/build/static/index-D8uVofpo.js +13 -0
  280. package/web-ui/build/static/index-DPFadqM6.css +1 -0
  281. package/web-ui/build/static/index-SkOgWEAU.js +1 -0
  282. package/web-ui/build/static/index-Vd3WlhtC.js +747 -0
  283. package/web-ui/build/static/inform7-CkQD_jz-.js +1 -0
  284. package/web-ui/build/static/inform7-phQiuDty.js +1 -0
  285. package/web-ui/build/static/ini-Bw_QAbzV.js +1 -0
  286. package/web-ui/build/static/ini-CB8ZxX7y.js +1 -0
  287. package/web-ui/build/static/io-D6IgpCmL.js +1 -0
  288. package/web-ui/build/static/irpf90-Ctj0koST.js +1 -0
  289. package/web-ui/build/static/isbl-D2mGcH87.js +1 -0
  290. package/web-ui/build/static/j-KvHmDBWH.js +1 -0
  291. package/web-ui/build/static/java-BeBIdo5i.js +1 -0
  292. package/web-ui/build/static/java-llFZkHLe.js +1 -0
  293. package/web-ui/build/static/javadoc-DXvQGu0s.js +1 -0
  294. package/web-ui/build/static/javadoclike-B5qdA9KZ.js +1 -0
  295. package/web-ui/build/static/javascript-De6HzHvc.js +1 -0
  296. package/web-ui/build/static/javastacktrace-C5MolKiP.js +1 -0
  297. package/web-ui/build/static/jboss-cli-2TXd54zo.js +1 -0
  298. package/web-ui/build/static/jexl-W4AVA9fi.js +1 -0
  299. package/web-ui/build/static/jolie-DTJKRMZN.js +1 -0
  300. package/web-ui/build/static/jq-BYg-QQKh.js +1 -0
  301. package/web-ui/build/static/js-extras-BrYWd2VE.js +1 -0
  302. package/web-ui/build/static/js-templates-DorYpbHq.js +1 -0
  303. package/web-ui/build/static/jsdoc-CRF8n9pZ.js +1 -0
  304. package/web-ui/build/static/json-Dlcd7rla.js +1 -0
  305. package/web-ui/build/static/json-rhOJZzzZ.js +1 -0
  306. package/web-ui/build/static/json5-hTq1nNIW.js +1 -0
  307. package/web-ui/build/static/jsonp-CMg9Xvol.js +1 -0
  308. package/web-ui/build/static/jsstacktrace-hEeYxHtB.js +1 -0
  309. package/web-ui/build/static/jsx-B7PtA8WD.js +1 -0
  310. package/web-ui/build/static/julia-CNiEEY-n.js +1 -0
  311. package/web-ui/build/static/julia-eE0_SJlc.js +1 -0
  312. package/web-ui/build/static/julia-repl-CUJTTT4C.js +1 -0
  313. package/web-ui/build/static/keepalived-GUWJBqyD.js +1 -0
  314. package/web-ui/build/static/keyman-Bdf9MJyu.js +1 -0
  315. package/web-ui/build/static/kotlin-Ch6Bej5W.js +1 -0
  316. package/web-ui/build/static/kotlin-DFJ7D7Lw.js +1 -0
  317. package/web-ui/build/static/kumir-DJLIjcCs.js +1 -0
  318. package/web-ui/build/static/kusto-BM0YTwU4.js +1 -0
  319. package/web-ui/build/static/lasso-Z1DVS84K.js +1 -0
  320. package/web-ui/build/static/latex-BWbw71RK.js +1 -0
  321. package/web-ui/build/static/latex-CMzqmbhw.js +1 -0
  322. package/web-ui/build/static/latte-C1g8_grc.js +1 -0
  323. package/web-ui/build/static/ldif-C6QH3OIL.js +1 -0
  324. package/web-ui/build/static/leaf-CbR--ZsH.js +1 -0
  325. package/web-ui/build/static/less-ClVrKh2Z.js +1 -0
  326. package/web-ui/build/static/less-DNSxm8UA.js +1 -0
  327. package/web-ui/build/static/lilypond-lTzf_sWt.js +1 -0
  328. package/web-ui/build/static/liquid-Bn91mVfC.js +1 -0
  329. package/web-ui/build/static/lisp-CU3bHohQ.js +1 -0
  330. package/web-ui/build/static/lisp-DbgzE9W8.js +1 -0
  331. package/web-ui/build/static/livecodeserver-Cse1Uz3H.js +1 -0
  332. package/web-ui/build/static/livescript-BaxbgzWP.js +1 -0
  333. package/web-ui/build/static/livescript-nJt61DBy.js +1 -0
  334. package/web-ui/build/static/llvm-DBboo6UI.js +1 -0
  335. package/web-ui/build/static/llvm-vIy7XYVy.js +1 -0
  336. package/web-ui/build/static/log-CT7nfoDW.js +1 -0
  337. package/web-ui/build/static/lolcode-CUKVytZh.js +1 -0
  338. package/web-ui/build/static/lsl-CsAOlGF2.js +1 -0
  339. package/web-ui/build/static/lua-BuU2FFxP.js +1 -0
  340. package/web-ui/build/static/lua-CiDuKQaa.js +1 -0
  341. package/web-ui/build/static/magma-7vR0zcmS.js +1 -0
  342. package/web-ui/build/static/makefile-Buiz-Msh.js +1 -0
  343. package/web-ui/build/static/makefile-DXW_-6OY.js +1 -0
  344. package/web-ui/build/static/markdown-Bk5DUoGY.js +1 -0
  345. package/web-ui/build/static/markdown-CRS5W_Ai.js +1 -0
  346. package/web-ui/build/static/markup-templating-24odpmF3.js +1 -0
  347. package/web-ui/build/static/mathematica-BxcwhJUp.js +1 -0
  348. package/web-ui/build/static/matlab-3pJYx_Fb.js +1 -0
  349. package/web-ui/build/static/matlab-BqlRrzMf.js +1 -0
  350. package/web-ui/build/static/maxima-DlCfUpcj.js +1 -0
  351. package/web-ui/build/static/maxscript-Cu_gCaFU.js +1 -0
  352. package/web-ui/build/static/mel-D7iQ-5Up.js +1 -0
  353. package/web-ui/build/static/mel-DzBKNpoN.js +1 -0
  354. package/web-ui/build/static/mercury-Dfrb-i8A.js +1 -0
  355. package/web-ui/build/static/mermaid-WN7V2_Eq.js +1 -0
  356. package/web-ui/build/static/mipsasm-CcijzL0q.js +1 -0
  357. package/web-ui/build/static/mizar-Bk68zACP.js +1 -0
  358. package/web-ui/build/static/mizar-Twc2-iZ4.js +1 -0
  359. package/web-ui/build/static/mojolicious-DBbo2S7X.js +1 -0
  360. package/web-ui/build/static/mongodb-2RsFIjgg.js +1 -0
  361. package/web-ui/build/static/monkey-CPXtQ0Bf.js +1 -0
  362. package/web-ui/build/static/monkey-DjV7Wcek.js +1 -0
  363. package/web-ui/build/static/moonscript-B5M5as70.js +1 -0
  364. package/web-ui/build/static/moonscript-D1BHW4Il.js +1 -0
  365. package/web-ui/build/static/n1ql-D0heNDBD.js +1 -0
  366. package/web-ui/build/static/n1ql-DfHqXQD7.js +1 -0
  367. package/web-ui/build/static/n4js-CaPf44Dz.js +1 -0
  368. package/web-ui/build/static/nand2tetris-hdl-D1nf9mn4.js +1 -0
  369. package/web-ui/build/static/naniscript-DnCnu5ZX.js +1 -0
  370. package/web-ui/build/static/nasm-BZrSaMsK.js +1 -0
  371. package/web-ui/build/static/neon-D29Grm2v.js +1 -0
  372. package/web-ui/build/static/nevod-DgSNbQkE.js +1 -0
  373. package/web-ui/build/static/nginx-BAaDGDfT.js +1 -0
  374. package/web-ui/build/static/nginx-BvJ1lrHX.js +1 -0
  375. package/web-ui/build/static/nim--9zzVe5F.js +1 -0
  376. package/web-ui/build/static/nim-Br1relpU.js +1 -0
  377. package/web-ui/build/static/nix--0ftErCy.js +1 -0
  378. package/web-ui/build/static/nix-104ztQqr.js +1 -0
  379. package/web-ui/build/static/node-repl-BUMAf7_p.js +1 -0
  380. package/web-ui/build/static/nsis-BaeKybNA.js +1 -0
  381. package/web-ui/build/static/nsis-CdZEv2iA.js +1 -0
  382. package/web-ui/build/static/objectivec-DBB4ymdg.js +1 -0
  383. package/web-ui/build/static/objectivec-kFYXC6g4.js +1 -0
  384. package/web-ui/build/static/ocaml-D1GXvN7c.js +1 -0
  385. package/web-ui/build/static/ocaml-D80jRMPE.js +1 -0
  386. package/web-ui/build/static/opencl-fb7BfRdO.js +1 -0
  387. package/web-ui/build/static/openqasm-CWUBrR2w.js +1 -0
  388. package/web-ui/build/static/openscad-Dim7ILSL.js +1 -0
  389. package/web-ui/build/static/oxygene-BSwApkwz.js +1 -0
  390. package/web-ui/build/static/oz-CMtRoi5F.js +1 -0
  391. package/web-ui/build/static/parigp-AH8cZ38D.js +1 -0
  392. package/web-ui/build/static/parser-bBNjuhG3.js +1 -0
  393. package/web-ui/build/static/parser3-DUtoWEAd.js +1 -0
  394. package/web-ui/build/static/pascal-Cr3DPIYT.js +1 -0
  395. package/web-ui/build/static/pascaligo-pWW12jfs.js +1 -0
  396. package/web-ui/build/static/pcaxis-DBw9rxmr.js +1 -0
  397. package/web-ui/build/static/peoplecode-aCpMPm_s.js +1 -0
  398. package/web-ui/build/static/perl-BpZ7GmJ3.js +1 -0
  399. package/web-ui/build/static/perl-fnHTrqJL.js +1 -0
  400. package/web-ui/build/static/pf-Dz352ty7.js +1 -0
  401. package/web-ui/build/static/pgsql-CHPUdlI_.js +1 -0
  402. package/web-ui/build/static/php-BRwItjmS.js +1 -0
  403. package/web-ui/build/static/php-CrX_kswO.js +1 -0
  404. package/web-ui/build/static/php-extras-BmeRXDSO.js +1 -0
  405. package/web-ui/build/static/php-template-B0MFJ9RR.js +1 -0
  406. package/web-ui/build/static/phpdoc-wAPkJj9X.js +1 -0
  407. package/web-ui/build/static/plaintext-CmPk1gvP.js +1 -0
  408. package/web-ui/build/static/plsql-pWVw0sCJ.js +1 -0
  409. package/web-ui/build/static/pony-B4SXhyDS.js +1 -0
  410. package/web-ui/build/static/powerquery-ZJ28bdRR.js +1 -0
  411. package/web-ui/build/static/powershell-CWg1ca6z.js +1 -0
  412. package/web-ui/build/static/powershell-Dnl0aBXc.js +1 -0
  413. package/web-ui/build/static/processing-CbYVU7hZ.js +1 -0
  414. package/web-ui/build/static/processing-DnroirEw.js +1 -0
  415. package/web-ui/build/static/profile-DLNc-MTA.js +1 -0
  416. package/web-ui/build/static/prolog-4KlPFQus.js +1 -0
  417. package/web-ui/build/static/prolog-CtUicY87.js +1 -0
  418. package/web-ui/build/static/promql-C_i6OJVg.js +1 -0
  419. package/web-ui/build/static/properties-Cj0lBOSP.js +1 -0
  420. package/web-ui/build/static/properties-vGFibcz9.js +1 -0
  421. package/web-ui/build/static/protobuf-BOIGxbSP.js +1 -0
  422. package/web-ui/build/static/protobuf-CQ3su-J7.js +1 -0
  423. package/web-ui/build/static/psl-DeG5_YUF.js +1 -0
  424. package/web-ui/build/static/pug-BieVVXYz.js +1 -0
  425. package/web-ui/build/static/puppet-Ba40SVKU.js +1 -0
  426. package/web-ui/build/static/puppet-D7BzrcGt.js +1 -0
  427. package/web-ui/build/static/pure-DZnkz1iT.js +1 -0
  428. package/web-ui/build/static/purebasic-CLLZW_6G.js +1 -0
  429. package/web-ui/build/static/purebasic-CYPZo_H6.js +1 -0
  430. package/web-ui/build/static/purescript-Dyjfu5Id.js +1 -0
  431. package/web-ui/build/static/python-BdIWKxdN.js +1 -0
  432. package/web-ui/build/static/python-ofKsqxv7.js +1 -0
  433. package/web-ui/build/static/python-repl-DiTYb1xK.js +1 -0
  434. package/web-ui/build/static/q-B4P0If_I.js +1 -0
  435. package/web-ui/build/static/q-t_17xfY8.js +1 -0
  436. package/web-ui/build/static/qml-B5WhiN48.js +1 -0
  437. package/web-ui/build/static/qml-Dq0cESXJ.js +1 -0
  438. package/web-ui/build/static/qore-DCx30XRf.js +1 -0
  439. package/web-ui/build/static/qsharp-UrBScekp.js +1 -0
  440. package/web-ui/build/static/r-B0Ty1RKQ.js +1 -0
  441. package/web-ui/build/static/r-B0za8QKS.js +1 -0
  442. package/web-ui/build/static/racket-Dj6WEyhS.js +1 -0
  443. package/web-ui/build/static/reason-dj9hJSfr.js +1 -0
  444. package/web-ui/build/static/reasonml-B-q5_wag.js +1 -0
  445. package/web-ui/build/static/regex-4HEc5C1m.js +1 -0
  446. package/web-ui/build/static/rego-BdQe18RK.js +1 -0
  447. package/web-ui/build/static/renpy-CVMA2llL.js +1 -0
  448. package/web-ui/build/static/rest-9B4JWVGr.js +1 -0
  449. package/web-ui/build/static/rib-DR-U8OaT.js +1 -0
  450. package/web-ui/build/static/rip-Bu2t_rFZ.js +1 -0
  451. package/web-ui/build/static/roboconf-CJeXD5-I.js +1 -0
  452. package/web-ui/build/static/roboconf-DzDTVrdM.js +1 -0
  453. package/web-ui/build/static/robotframework-CR7KyPpN.js +1 -0
  454. package/web-ui/build/static/routeros-B2741z2k.js +1 -0
  455. package/web-ui/build/static/rsl-B9F_ZCgv.js +1 -0
  456. package/web-ui/build/static/ruby-I2JTNgyY.js +1 -0
  457. package/web-ui/build/static/ruby-QGDPOmJX.js +1 -0
  458. package/web-ui/build/static/ruleslanguage-CGzXEUCO.js +1 -0
  459. package/web-ui/build/static/rust-BxW5-WOm.js +1 -0
  460. package/web-ui/build/static/rust-CSOA43di.js +1 -0
  461. package/web-ui/build/static/sas-Bclfx4g3.js +1 -0
  462. package/web-ui/build/static/sas-xbQaiYjT.js +1 -0
  463. package/web-ui/build/static/sass-DJPbdNwd.js +1 -0
  464. package/web-ui/build/static/scala-Bo18NtHQ.js +1 -0
  465. package/web-ui/build/static/scala-Cy0JH-SG.js +1 -0
  466. package/web-ui/build/static/scheme-BjcWWjIx.js +1 -0
  467. package/web-ui/build/static/scheme-DQdj8PzN.js +1 -0
  468. package/web-ui/build/static/scilab-Bn1KHdK-.js +1 -0
  469. package/web-ui/build/static/scss-B1twkZBz.js +1 -0
  470. package/web-ui/build/static/scss-DmOuMI4v.js +1 -0
  471. package/web-ui/build/static/shell-BUlkJG0S.js +1 -0
  472. package/web-ui/build/static/shell-session-Bke-svxA.js +1 -0
  473. package/web-ui/build/static/smali-Ch9S16HV.js +1 -0
  474. package/web-ui/build/static/smali-D_yDr_Aj.js +1 -0
  475. package/web-ui/build/static/smalltalk-B9TfQ5Md.js +1 -0
  476. package/web-ui/build/static/smalltalk-EwbZxZsR.js +1 -0
  477. package/web-ui/build/static/smarty-9kDPpeSm.js +1 -0
  478. package/web-ui/build/static/sml-2fEfT7rd.js +1 -0
  479. package/web-ui/build/static/sml-BiwoLNk7.js +1 -0
  480. package/web-ui/build/static/solidity-n_x8Oe0h.js +1 -0
  481. package/web-ui/build/static/solution-file-B2mvjI3e.js +1 -0
  482. package/web-ui/build/static/soy-DPkgKBIS.js +1 -0
  483. package/web-ui/build/static/sparql-Cy95tds0.js +1 -0
  484. package/web-ui/build/static/splunk-spl-Ym3z9ouN.js +1 -0
  485. package/web-ui/build/static/sqf-CXZTG8WE.js +1 -0
  486. package/web-ui/build/static/sqf-Cwi3yg7f.js +1 -0
  487. package/web-ui/build/static/sql-DPxSQY4S.js +1 -0
  488. package/web-ui/build/static/sql-peh7ijGj.js +1 -0
  489. package/web-ui/build/static/sql_more-0YAbAuPw.js +1 -0
  490. package/web-ui/build/static/squirrel-CphzjV0e.js +1 -0
  491. package/web-ui/build/static/stan-0-xZ95-O.js +1 -0
  492. package/web-ui/build/static/stan-CaI4__2g.js +1 -0
  493. package/web-ui/build/static/stata-BrbzrGSs.js +1 -0
  494. package/web-ui/build/static/step21-C_qeyVLw.js +1 -0
  495. package/web-ui/build/static/stylus-Btycb2sZ.js +1 -0
  496. package/web-ui/build/static/stylus-FoBJ7jki.js +1 -0
  497. package/web-ui/build/static/subunit-Dpg-m04-.js +1 -0
  498. package/web-ui/build/static/swift-Cr9uZmgb.js +1 -0
  499. package/web-ui/build/static/swift-hGLFtD7e.js +1 -0
  500. package/web-ui/build/static/systemd-Bls2D9Vj.js +1 -0
  501. package/web-ui/build/static/t4-cs-C4qDO-jJ.js +1 -0
  502. package/web-ui/build/static/t4-templating-BbCFPMPO.js +1 -0
  503. package/web-ui/build/static/t4-vb-D1zoEccT.js +1 -0
  504. package/web-ui/build/static/taggerscript-CWHk9Gih.js +1 -0
  505. package/web-ui/build/static/tap-Bjt0UnzV.js +1 -0
  506. package/web-ui/build/static/tap-BnHKwLQs.js +1 -0
  507. package/web-ui/build/static/tcl-Zo9kx4y-.js +1 -0
  508. package/web-ui/build/static/tcl-fzLmefkt.js +1 -0
  509. package/web-ui/build/static/textile-9lIlUPH5.js +1 -0
  510. package/web-ui/build/static/thrift-M3K6r5Cy.js +1 -0
  511. package/web-ui/build/static/toml-HpaKqckc.js +1 -0
  512. package/web-ui/build/static/tp-DFKuxrKj.js +1 -0
  513. package/web-ui/build/static/tremor-D4_bUtMB.js +1 -0
  514. package/web-ui/build/static/tsx-o1RT-T90.js +1 -0
  515. package/web-ui/build/static/tt2-1xDqcN_2.js +1 -0
  516. package/web-ui/build/static/turtle-Dlt-aGky.js +1 -0
  517. package/web-ui/build/static/twig-CJ_BnGSR.js +1 -0
  518. package/web-ui/build/static/twig-CjsiSQb6.js +1 -0
  519. package/web-ui/build/static/typescript-B8B9zUn-.js +1 -0
  520. package/web-ui/build/static/typescript-D0Jgo8O7.js +1 -0
  521. package/web-ui/build/static/typoscript-C8Qke4ZB.js +1 -0
  522. package/web-ui/build/static/unrealscript-YxJdDNZ3.js +1 -0
  523. package/web-ui/build/static/uorazor-CtEVnqBv.js +1 -0
  524. package/web-ui/build/static/uri-YdaiQl4c.js +1 -0
  525. package/web-ui/build/static/v-CIyttMDD.js +1 -0
  526. package/web-ui/build/static/vala-DGslcym_.js +1 -0
  527. package/web-ui/build/static/vala-GFPx3uEJ.js +1 -0
  528. package/web-ui/build/static/vbnet-B20itab-.js +1 -0
  529. package/web-ui/build/static/vbnet-BdoN6egk.js +1 -0
  530. package/web-ui/build/static/vbscript-PHVh6Fp_.js +1 -0
  531. package/web-ui/build/static/vbscript-html-woH1VZ7U.js +1 -0
  532. package/web-ui/build/static/velocity-DtVfCZeg.js +1 -0
  533. package/web-ui/build/static/verilog-Bt6edXvM.js +1 -0
  534. package/web-ui/build/static/verilog-k_7lr9Zq.js +1 -0
  535. package/web-ui/build/static/vhdl-BMzOgOeK.js +1 -0
  536. package/web-ui/build/static/vhdl-BcAbtPG6.js +1 -0
  537. package/web-ui/build/static/vim-DrinG9a4.js +1 -0
  538. package/web-ui/build/static/vim-WihLATJL.js +1 -0
  539. package/web-ui/build/static/visual-basic-CJnvgPjM.js +1 -0
  540. package/web-ui/build/static/warpscript-zMlbUoZs.js +1 -0
  541. package/web-ui/build/static/wasm-GUnfTBUL.js +1 -0
  542. package/web-ui/build/static/web-idl-CfaLTG_r.js +1 -0
  543. package/web-ui/build/static/wiki-13AlLoOc.js +1 -0
  544. package/web-ui/build/static/wolfram-zHocYNXW.js +1 -0
  545. package/web-ui/build/static/wren-Byq862Iu.js +1 -0
  546. package/web-ui/build/static/x86asm-CLcOnePY.js +1 -0
  547. package/web-ui/build/static/xeora-BVHqWOFS.js +1 -0
  548. package/web-ui/build/static/xl-lXi8OYfr.js +1 -0
  549. package/web-ui/build/static/xml-KZjGBKxi.js +1 -0
  550. package/web-ui/build/static/xml-doc-DrQSDcEW.js +1 -0
  551. package/web-ui/build/static/xojo-DosHeFXU.js +1 -0
  552. package/web-ui/build/static/xquery-BZN1F14Q.js +1 -0
  553. package/web-ui/build/static/xquery-Cnz7ZLFr.js +1 -0
  554. package/web-ui/build/static/yaml-BzXOcy9u.js +1 -0
  555. package/web-ui/build/static/yaml-C207y5bt.js +1 -0
  556. package/web-ui/build/static/yang-ByrBdDIg.js +1 -0
  557. package/web-ui/build/static/zephir-bahTa7of.js +1 -0
  558. package/web-ui/build/static/zig-BlFYhdtC.js +1 -0
  559. package/src/tools/browserTool.js +0 -897
  560. package/src/utilities/platformUtils.test.js +0 -98
  561. package/web-ui/build/static/index-SmQFfvBs.js +0 -746
  562. package/web-ui/build/static/index-V2ySwjHp.css +0 -1
@@ -0,0 +1,725 @@
1
+ import { jest, describe, test, expect, beforeEach } from '@jest/globals';
2
+ import { createMockLogger, createMockConfig } from '../../__test-utils__/mockFactories.js';
3
+
4
+ // Mock uuid
5
+ let uuidCounter = 0;
6
+ jest.unstable_mockModule('uuid', () => ({
7
+ v4: jest.fn(() => `mock-uuid-${++uuidCounter}`)
8
+ }));
9
+
10
+ const { default: TaskManagerTool } = await import('../taskManagerTool.js');
11
+
12
+ /**
13
+ * Helper: create a tool instance, a fake agent, and context.
14
+ */
15
+ function createTestSetup() {
16
+ const logger = createMockLogger();
17
+ const tool = new TaskManagerTool({ description: 'test task manager' });
18
+ tool.logger = logger;
19
+
20
+ const agent = {
21
+ id: 'agent-1',
22
+ name: 'Test Agent',
23
+ lastActivity: null,
24
+ taskList: {
25
+ tasks: [],
26
+ lastUpdated: new Date().toISOString()
27
+ }
28
+ };
29
+
30
+ const agentPool = {
31
+ getAgent: jest.fn().mockResolvedValue(agent),
32
+ persistAgentState: jest.fn().mockResolvedValue(undefined)
33
+ };
34
+
35
+ const context = {
36
+ agentId: 'agent-1',
37
+ agentName: 'Test Agent',
38
+ agentPool,
39
+ projectDir: '/tmp/test'
40
+ };
41
+
42
+ return { tool, agent, agentPool, context, logger };
43
+ }
44
+
45
+ beforeEach(() => {
46
+ uuidCounter = 0;
47
+ });
48
+
49
+ describe('TaskManagerTool', () => {
50
+ // ── constructor ─────────────────────────────────────────────────
51
+ describe('constructor', () => {
52
+ test('initializes with supported actions, priorities, and statuses', () => {
53
+ const tool = new TaskManagerTool();
54
+ expect(tool.supportedActions).toContain('create');
55
+ expect(tool.supportedActions).toContain('sync');
56
+ expect(tool.supportedActions).toContain('analytics');
57
+ expect(tool.taskPriorities).toEqual(['urgent', 'high', 'medium', 'low']);
58
+ expect(tool.taskStatuses).toContain('pending');
59
+ expect(tool.taskStatuses).toContain('completed');
60
+ expect(tool.taskTemplates).toHaveProperty('bug-fix');
61
+ });
62
+ });
63
+
64
+ // ── getDescription ──────────────────────────────────────────────
65
+ describe('getDescription', () => {
66
+ test('returns a non-empty description string', () => {
67
+ const tool = new TaskManagerTool();
68
+ const desc = tool.getDescription();
69
+ expect(typeof desc).toBe('string');
70
+ expect(desc.length).toBeGreaterThan(50);
71
+ });
72
+ });
73
+
74
+ // ── parseParameters ─────────────────────────────────────────────
75
+ describe('parseParameters', () => {
76
+ test('returns rawContent for string input', () => {
77
+ const tool = new TaskManagerTool();
78
+ expect(tool.parseParameters('hello')).toEqual({ rawContent: 'hello' });
79
+ });
80
+
81
+ test('unwraps tag-parser format objects', () => {
82
+ const tool = new TaskManagerTool();
83
+ const result = tool.parseParameters({
84
+ action: { value: 'create', attributes: {} },
85
+ title: { value: 'My Task', attributes: {} }
86
+ });
87
+ expect(result.action).toBe('create');
88
+ expect(result.title).toBe('My Task');
89
+ });
90
+
91
+ test('passes through plain objects', () => {
92
+ const tool = new TaskManagerTool();
93
+ expect(tool.parseParameters({ action: 'list' })).toEqual({ action: 'list' });
94
+ });
95
+
96
+ test('returns non-object values as-is', () => {
97
+ const tool = new TaskManagerTool();
98
+ expect(tool.parseParameters(null)).toBeNull();
99
+ });
100
+ });
101
+
102
+ // ── create action ───────────────────────────────────────────────
103
+ describe('execute - create', () => {
104
+ test('creates a task with title, description, and priority', async () => {
105
+ const { tool, agent, context } = createTestSetup();
106
+ const result = await tool.execute(
107
+ { action: 'create', title: 'Build API', description: 'REST endpoints', priority: 'high' },
108
+ context
109
+ );
110
+ expect(result.success).toBe(true);
111
+ expect(result.action).toBe('create');
112
+ expect(result.result.task.title).toBe('Build API');
113
+ expect(result.result.task.priority).toBe('high');
114
+ expect(result.result.task.status).toBe('pending');
115
+ expect(agent.taskList.tasks).toHaveLength(1);
116
+ });
117
+
118
+ test('uses medium as default priority', async () => {
119
+ const { tool, context } = createTestSetup();
120
+ const result = await tool.execute({ action: 'create', title: 'Default' }, context);
121
+ expect(result.result.task.priority).toBe('medium');
122
+ });
123
+
124
+ test('errors when title is missing', async () => {
125
+ const { tool, context } = createTestSetup();
126
+ const result = await tool.execute({ action: 'create', priority: 'low' }, context);
127
+ expect(result.success).toBe(false);
128
+ expect(result.error).toContain('title is required');
129
+ });
130
+
131
+ test('errors for invalid priority', async () => {
132
+ const { tool, context } = createTestSetup();
133
+ const result = await tool.execute(
134
+ { action: 'create', title: 'Test', priority: 'superurgent' }, context
135
+ );
136
+ expect(result.success).toBe(false);
137
+ expect(result.error).toContain('Invalid priority');
138
+ });
139
+ });
140
+
141
+ // ── actions array format ────────────────────────────────────────
142
+ describe('execute - actions array format', () => {
143
+ test('unwraps first element of actions array', async () => {
144
+ const { tool, context } = createTestSetup();
145
+ const result = await tool.execute(
146
+ { actions: [{ type: 'create', title: 'From array', priority: 'medium' }] },
147
+ context
148
+ );
149
+ expect(result.success).toBe(true);
150
+ expect(result.result.task.title).toBe('From array');
151
+ });
152
+
153
+ test('deep-unwraps tag-parser wrapped values in actions array', async () => {
154
+ const { tool, context } = createTestSetup();
155
+ const result = await tool.execute({
156
+ actions: [{
157
+ type: { value: 'create', attributes: {} },
158
+ title: { value: 'Wrapped', attributes: {} },
159
+ priority: 'medium'
160
+ }]
161
+ }, context);
162
+ expect(result.success).toBe(true);
163
+ expect(result.result.task.title).toBe('Wrapped');
164
+ });
165
+ });
166
+
167
+ // ── update action ───────────────────────────────────────────────
168
+ describe('execute - update', () => {
169
+ test('updates task status and priority', async () => {
170
+ const { tool, agent, context } = createTestSetup();
171
+ await tool.execute({ action: 'create', title: 'Task A', priority: 'low' }, context);
172
+ const taskId = agent.taskList.tasks[0].id;
173
+ const result = await tool.execute(
174
+ { action: 'update', taskId, status: 'in_progress', priority: 'high' }, context
175
+ );
176
+ expect(result.success).toBe(true);
177
+ expect(result.result.task.status).toBe('in_progress');
178
+ expect(result.result.task.priority).toBe('high');
179
+ });
180
+
181
+ test('updates title and description', async () => {
182
+ const { tool, agent, context } = createTestSetup();
183
+ await tool.execute({ action: 'create', title: 'Old', priority: 'medium' }, context);
184
+ const taskId = agent.taskList.tasks[0].id;
185
+ const result = await tool.execute(
186
+ { action: 'update', taskId, title: 'New Title', description: 'Desc' }, context
187
+ );
188
+ expect(result.result.task.title).toBe('New Title');
189
+ expect(result.result.task.description).toBe('Desc');
190
+ });
191
+
192
+ test('errors when taskId is missing', async () => {
193
+ const { tool, context } = createTestSetup();
194
+ const result = await tool.execute({ action: 'update', status: 'completed' }, context);
195
+ expect(result.success).toBe(false);
196
+ expect(result.error).toContain('Task ID is required');
197
+ });
198
+
199
+ test('errors for non-existent task', async () => {
200
+ const { tool, context } = createTestSetup();
201
+ const result = await tool.execute({ action: 'update', taskId: 'no-such', status: 'completed' }, context);
202
+ expect(result.success).toBe(false);
203
+ expect(result.error).toContain('Task not found');
204
+ });
205
+
206
+ test('errors for invalid status', async () => {
207
+ const { tool, agent, context } = createTestSetup();
208
+ await tool.execute({ action: 'create', title: 'T', priority: 'medium' }, context);
209
+ const taskId = agent.taskList.tasks[0].id;
210
+ const result = await tool.execute({ action: 'update', taskId, status: 'badstatus' }, context);
211
+ expect(result.success).toBe(false);
212
+ expect(result.error).toContain('Invalid status');
213
+ });
214
+ });
215
+
216
+ // ── list action ─────────────────────────────────────────────────
217
+ describe('execute - list', () => {
218
+ test('lists all tasks with summary counts', async () => {
219
+ const { tool, context } = createTestSetup();
220
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
221
+ await tool.execute({ action: 'create', title: 'T2', priority: 'low' }, context);
222
+ const result = await tool.execute({ action: 'list' }, context);
223
+ expect(result.success).toBe(true);
224
+ expect(result.result.totalTasks).toBe(2);
225
+ expect(result.result.summary.pending).toBe(2);
226
+ });
227
+
228
+ test('filters by status', async () => {
229
+ const { tool, agent, context } = createTestSetup();
230
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
231
+ await tool.execute({ action: 'create', title: 'T2', priority: 'low' }, context);
232
+ await tool.execute({ action: 'complete', taskId: agent.taskList.tasks[0].id }, context);
233
+ const result = await tool.execute({ action: 'list', status: 'pending' }, context);
234
+ expect(result.result.totalTasks).toBe(1);
235
+ });
236
+
237
+ test('filters by priority', async () => {
238
+ const { tool, context } = createTestSetup();
239
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
240
+ await tool.execute({ action: 'create', title: 'T2', priority: 'low' }, context);
241
+ const result = await tool.execute({ action: 'list', priority: 'high' }, context);
242
+ expect(result.result.totalTasks).toBe(1);
243
+ });
244
+
245
+ test('sorts by priority then creation date', async () => {
246
+ const { tool, context } = createTestSetup();
247
+ await tool.execute({ action: 'create', title: 'Low', priority: 'low' }, context);
248
+ await tool.execute({ action: 'create', title: 'High', priority: 'high' }, context);
249
+ const result = await tool.execute({ action: 'list' }, context);
250
+ expect(result.result.tasks[0].title).toBe('High');
251
+ });
252
+ });
253
+
254
+ // ── complete action ─────────────────────────────────────────────
255
+ describe('execute - complete', () => {
256
+ test('marks task as completed with timestamp', async () => {
257
+ const { tool, agent, context } = createTestSetup();
258
+ await tool.execute({ action: 'create', title: 'Finish', priority: 'medium' }, context);
259
+ const taskId = agent.taskList.tasks[0].id;
260
+ const result = await tool.execute({ action: 'complete', taskId }, context);
261
+ expect(result.success).toBe(true);
262
+ expect(result.result.task.status).toBe('completed');
263
+ expect(result.result.task.completedAt).toBeDefined();
264
+ });
265
+
266
+ test('auto-completes first in-progress task when no taskId', async () => {
267
+ const { tool, agent, context } = createTestSetup();
268
+ await tool.execute({ action: 'create', title: 'Auto', priority: 'medium' }, context);
269
+ agent.taskList.tasks[0].status = 'in_progress';
270
+ const result = await tool.execute({ action: 'complete' }, context);
271
+ expect(result.result.task.status).toBe('completed');
272
+ });
273
+
274
+ test('returns message for already-completed task', async () => {
275
+ const { tool, agent, context } = createTestSetup();
276
+ await tool.execute({ action: 'create', title: 'Done', priority: 'medium' }, context);
277
+ const taskId = agent.taskList.tasks[0].id;
278
+ await tool.execute({ action: 'complete', taskId }, context);
279
+ const result = await tool.execute({ action: 'complete', taskId }, context);
280
+ expect(result.result.message).toContain('already completed');
281
+ });
282
+
283
+ test('sets TTL to 1 when no pending tasks remain', async () => {
284
+ const { tool, agent, context } = createTestSetup();
285
+ await tool.execute({ action: 'create', title: 'Only', priority: 'medium' }, context);
286
+ await tool.execute({ action: 'complete', taskId: agent.taskList.tasks[0].id }, context);
287
+ expect(agent.ttl).toBe(1);
288
+ });
289
+
290
+ test('includes no-tasks hint in summary', async () => {
291
+ const { tool, agent, context } = createTestSetup();
292
+ await tool.execute({ action: 'create', title: 'Only', priority: 'medium' }, context);
293
+ const result = await tool.execute({ action: 'complete', taskId: agent.taskList.tasks[0].id }, context);
294
+ expect(result.summary).toContain('No remaining tasks');
295
+ });
296
+
297
+ test('errors when no taskId and no in-progress tasks', async () => {
298
+ const { tool, context } = createTestSetup();
299
+ const result = await tool.execute({ action: 'complete' }, context);
300
+ expect(result.success).toBe(false);
301
+ expect(result.error).toContain('No task ID provided');
302
+ });
303
+ });
304
+
305
+ // ── cancel action ───────────────────────────────────────────────
306
+ describe('execute - cancel', () => {
307
+ test('cancels a task with reason', async () => {
308
+ const { tool, agent, context } = createTestSetup();
309
+ await tool.execute({ action: 'create', title: 'Cancel me', priority: 'medium' }, context);
310
+ const taskId = agent.taskList.tasks[0].id;
311
+ const result = await tool.execute({ action: 'cancel', taskId, reason: 'Not needed' }, context);
312
+ expect(result.success).toBe(true);
313
+ expect(result.result.task.status).toBe('cancelled');
314
+ expect(result.result.task.cancellationReason).toBe('Not needed');
315
+ });
316
+
317
+ test('errors when taskId is missing', async () => {
318
+ const { tool, context } = createTestSetup();
319
+ const result = await tool.execute({ action: 'cancel' }, context);
320
+ expect(result.success).toBe(false);
321
+ expect(result.error).toContain('Task ID is required');
322
+ });
323
+ });
324
+
325
+ // ── clear action ────────────────────────────────────────────────
326
+ describe('execute - clear', () => {
327
+ test('removes completed and cancelled tasks', async () => {
328
+ const { tool, agent, context } = createTestSetup();
329
+ await tool.execute({ action: 'create', title: 'T1', priority: 'medium' }, context);
330
+ await tool.execute({ action: 'create', title: 'T2', priority: 'medium' }, context);
331
+ await tool.execute({ action: 'create', title: 'T3', priority: 'medium' }, context);
332
+ await tool.execute({ action: 'complete', taskId: agent.taskList.tasks[0].id }, context);
333
+ await tool.execute({ action: 'cancel', taskId: agent.taskList.tasks[1].id }, context);
334
+ const result = await tool.execute({ action: 'clear' }, context);
335
+ expect(result.result.removed).toBe(2);
336
+ expect(agent.taskList.tasks).toHaveLength(1);
337
+ });
338
+ });
339
+
340
+ // ── depend action ───────────────────────────────────────────────
341
+ describe('execute - depend', () => {
342
+ test('creates blocking dependency and sets blocked status', async () => {
343
+ const { tool, agent, context } = createTestSetup();
344
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
345
+ await tool.execute({ action: 'create', title: 'T2', priority: 'medium' }, context);
346
+ const [tA, tB] = agent.taskList.tasks;
347
+ const result = await tool.execute(
348
+ { action: 'depend', taskId: tB.id, dependsOn: tA.id, dependencyType: 'blocks' }, context
349
+ );
350
+ expect(result.success).toBe(true);
351
+ expect(result.result.dependency.taskId).toBe(tA.id);
352
+ expect(agent.taskList.tasks[1].status).toBe('blocked');
353
+ });
354
+
355
+ test('returns already-exists for duplicate dependency', async () => {
356
+ const { tool, agent, context } = createTestSetup();
357
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
358
+ await tool.execute({ action: 'create', title: 'T2', priority: 'medium' }, context);
359
+ const [tA, tB] = agent.taskList.tasks;
360
+ await tool.execute({ action: 'depend', taskId: tB.id, dependsOn: tA.id }, context);
361
+ const result = await tool.execute({ action: 'depend', taskId: tB.id, dependsOn: tA.id }, context);
362
+ expect(result.result.message).toContain('already exists');
363
+ });
364
+
365
+ test('errors when both params are missing', async () => {
366
+ const { tool, context } = createTestSetup();
367
+ const result = await tool.execute({ action: 'depend', taskId: 'x' }, context);
368
+ expect(result.success).toBe(false);
369
+ });
370
+
371
+ test('errors for invalid dependency type', async () => {
372
+ const { tool, agent, context } = createTestSetup();
373
+ await tool.execute({ action: 'create', title: 'A', priority: 'high' }, context);
374
+ await tool.execute({ action: 'create', title: 'B', priority: 'high' }, context);
375
+ const [a, b] = agent.taskList.tasks;
376
+ const result = await tool.execute(
377
+ { action: 'depend', taskId: b.id, dependsOn: a.id, dependencyType: 'invalid' }, context
378
+ );
379
+ expect(result.success).toBe(false);
380
+ expect(result.error).toContain('Invalid dependency type');
381
+ });
382
+ });
383
+
384
+ // ── relate action ───────────────────────────────────────────────
385
+ describe('execute - relate', () => {
386
+ test('creates a relates-type dependency', async () => {
387
+ const { tool, agent, context } = createTestSetup();
388
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
389
+ await tool.execute({ action: 'create', title: 'T2', priority: 'medium' }, context);
390
+ const [tA, tB] = agent.taskList.tasks;
391
+ const result = await tool.execute(
392
+ { action: 'relate', taskId: tB.id, dependsOn: tA.id }, context
393
+ );
394
+ expect(result.result.dependency.type).toBe('relates');
395
+ });
396
+ });
397
+
398
+ // ── subtask action ──────────────────────────────────────────────
399
+ describe('execute - subtask', () => {
400
+ test('creates subtask under parent', async () => {
401
+ const { tool, agent, context } = createTestSetup();
402
+ await tool.execute({ action: 'create', title: 'Parent', priority: 'high' }, context);
403
+ const parentId = agent.taskList.tasks[0].id;
404
+ const result = await tool.execute(
405
+ { action: 'subtask', parentTaskId: parentId, title: 'Sub 1', priority: 'medium' }, context
406
+ );
407
+ expect(result.success).toBe(true);
408
+ expect(result.result.subtask.isSubtask).toBe(true);
409
+ expect(result.result.subtask.parentTaskId).toBe(parentId);
410
+ expect(agent.taskList.tasks[0].subtasks).toContain(result.result.subtask.id);
411
+ });
412
+
413
+ test('errors when parent not found', async () => {
414
+ const { tool, context } = createTestSetup();
415
+ const result = await tool.execute(
416
+ { action: 'subtask', parentTaskId: 'no-such', title: 'Sub' }, context
417
+ );
418
+ expect(result.success).toBe(false);
419
+ expect(result.error).toContain('Parent task not found');
420
+ });
421
+
422
+ test('errors when parentTaskId or title missing', async () => {
423
+ const { tool, context } = createTestSetup();
424
+ const result = await tool.execute({ action: 'subtask', title: 'Sub' }, context);
425
+ expect(result.success).toBe(false);
426
+ expect(result.error).toContain('required');
427
+ });
428
+ });
429
+
430
+ // ── sync action ─────────────────────────────────────────────────
431
+ describe('execute - sync', () => {
432
+ test('syncs task list creating new tasks', async () => {
433
+ const { tool, context } = createTestSetup();
434
+ const result = await tool.execute({
435
+ action: 'sync',
436
+ tasks: [
437
+ { title: 'A', status: 'completed', priority: 'high' },
438
+ { title: 'B', status: 'in_progress', priority: 'medium' },
439
+ { title: 'C', status: 'pending', priority: 'low' }
440
+ ]
441
+ }, context);
442
+ expect(result.success).toBe(true);
443
+ expect(result.result.summary.total).toBe(3);
444
+ expect(result.result.summary.created).toBe(3);
445
+ });
446
+
447
+ test('updates existing tasks by matching title', async () => {
448
+ const { tool, context } = createTestSetup();
449
+ await tool.execute({ action: 'create', title: 'Existing', priority: 'low' }, context);
450
+ const result = await tool.execute({
451
+ action: 'sync',
452
+ tasks: [{ title: 'Existing', status: 'completed', priority: 'high' }]
453
+ }, context);
454
+ expect(result.result.summary.updated).toBe(1);
455
+ expect(result.result.summary.created).toBe(0);
456
+ });
457
+
458
+ test('parses JSON string tasks', async () => {
459
+ const { tool, context } = createTestSetup();
460
+ const result = await tool.execute({
461
+ action: 'sync',
462
+ tasks: JSON.stringify([{ title: 'JSON', status: 'pending', priority: 'medium' }])
463
+ }, context);
464
+ expect(result.success).toBe(true);
465
+ });
466
+
467
+ test('errors for empty tasks array', async () => {
468
+ const { tool, context } = createTestSetup();
469
+ const result = await tool.execute({ action: 'sync', tasks: [] }, context);
470
+ expect(result.success).toBe(false);
471
+ expect(result.error).toContain('empty');
472
+ });
473
+
474
+ test('errors for invalid status', async () => {
475
+ const { tool, context } = createTestSetup();
476
+ const result = await tool.execute({
477
+ action: 'sync',
478
+ tasks: [{ title: 'Bad', status: 'oops', priority: 'medium' }]
479
+ }, context);
480
+ expect(result.success).toBe(false);
481
+ expect(result.error).toContain('Invalid status');
482
+ });
483
+
484
+ test('enforces only one in_progress task', async () => {
485
+ const { tool, agent, context } = createTestSetup();
486
+ await tool.execute({
487
+ action: 'sync',
488
+ tasks: [
489
+ { title: 'A', status: 'in_progress', priority: 'high' },
490
+ { title: 'B', status: 'in_progress', priority: 'medium' }
491
+ ]
492
+ }, context);
493
+ const ipCount = agent.taskList.tasks.filter(t => t.status === 'in_progress').length;
494
+ expect(ipCount).toBe(1);
495
+ });
496
+
497
+ test('auto-sets first pending to in_progress when none active', async () => {
498
+ const { tool, agent, context } = createTestSetup();
499
+ await tool.execute({
500
+ action: 'sync',
501
+ tasks: [
502
+ { title: 'A', status: 'pending', priority: 'high' },
503
+ { title: 'B', status: 'pending', priority: 'medium' }
504
+ ]
505
+ }, context);
506
+ const ipTasks = agent.taskList.tasks.filter(t => t.status === 'in_progress');
507
+ expect(ipTasks).toHaveLength(1);
508
+ });
509
+ });
510
+
511
+ // ── template action ─────────────────────────────────────────────
512
+ describe('execute - template', () => {
513
+ test('lists available templates', async () => {
514
+ const { tool, context } = createTestSetup();
515
+ const result = await tool.execute({ action: 'template', mode: 'list' }, context);
516
+ expect(result.success).toBe(true);
517
+ expect(result.result.builtInTemplates.length).toBeGreaterThan(0);
518
+ });
519
+
520
+ test('applies a built-in template', async () => {
521
+ const { tool, agent, context } = createTestSetup();
522
+ const result = await tool.execute(
523
+ { action: 'template', mode: 'apply', templateId: 'bug-fix' }, context
524
+ );
525
+ expect(result.success).toBe(true);
526
+ expect(result.result.tasksCreated).toBeGreaterThan(0);
527
+ expect(agent.taskList.tasks.length).toBeGreaterThan(0);
528
+ });
529
+
530
+ test('errors for non-existent template', async () => {
531
+ const { tool, context } = createTestSetup();
532
+ const result = await tool.execute(
533
+ { action: 'template', mode: 'apply', templateId: 'nope' }, context
534
+ );
535
+ expect(result.success).toBe(false);
536
+ expect(result.error).toContain('Template not found');
537
+ });
538
+
539
+ test('creates a custom template', async () => {
540
+ const { tool, agent, context } = createTestSetup();
541
+ const result = await tool.execute({
542
+ action: 'template',
543
+ mode: 'create',
544
+ customTemplate: {
545
+ name: 'My Workflow',
546
+ description: 'Custom',
547
+ tasks: [{ title: 'Step 1' }, { title: 'Step 2' }]
548
+ }
549
+ }, context);
550
+ expect(result.success).toBe(true);
551
+ expect(agent.customTemplates).toHaveLength(1);
552
+ });
553
+
554
+ test('errors when custom template has no tasks', async () => {
555
+ const { tool, context } = createTestSetup();
556
+ const result = await tool.execute({
557
+ action: 'template',
558
+ mode: 'create',
559
+ customTemplate: { name: 'Empty', tasks: [] }
560
+ }, context);
561
+ expect(result.success).toBe(false);
562
+ expect(result.error).toContain('requires name and at least one task');
563
+ });
564
+
565
+ test('suggests templates based on patterns', async () => {
566
+ const { tool, agent, context } = createTestSetup();
567
+ agent.taskList.tasks.push({
568
+ id: 'bug-task', title: 'Fix login bug', status: 'pending',
569
+ priority: 'high', createdAt: new Date().toISOString()
570
+ });
571
+ const result = await tool.execute({ action: 'template', mode: 'suggest' }, context);
572
+ expect(result.success).toBe(true);
573
+ expect(result.result.suggestions.length).toBeGreaterThan(0);
574
+ });
575
+
576
+ test('errors for invalid template mode', async () => {
577
+ const { tool, context } = createTestSetup();
578
+ const result = await tool.execute({ action: 'template', mode: 'invalid' }, context);
579
+ expect(result.success).toBe(false);
580
+ expect(result.error).toContain('Invalid template mode');
581
+ });
582
+ });
583
+
584
+ // ── progress action ─────────────────────────────────────────────
585
+ describe('execute - progress', () => {
586
+ test('updates task progress with stage and note', async () => {
587
+ const { tool, agent, context } = createTestSetup();
588
+ await tool.execute({ action: 'create', title: 'Dev', priority: 'high' }, context);
589
+ const taskId = agent.taskList.tasks[0].id;
590
+ const result = await tool.execute({
591
+ action: 'progress', mode: 'update', taskId,
592
+ stage: 'in_development', note: 'Started coding'
593
+ }, context);
594
+ expect(result.success).toBe(true);
595
+ expect(result.result.task.progress.stage).toBe('in_development');
596
+ expect(result.result.task.progress.notes).toHaveLength(1);
597
+ });
598
+
599
+ test('setting percentage to 100 completes task', async () => {
600
+ const { tool, agent, context } = createTestSetup();
601
+ await tool.execute({ action: 'create', title: 'Pct', priority: 'high' }, context);
602
+ const taskId = agent.taskList.tasks[0].id;
603
+ await tool.execute({ action: 'progress', mode: 'update', taskId, percentage: 100 }, context);
604
+ expect(agent.taskList.tasks[0].status).toBe('completed');
605
+ expect(agent.taskList.tasks[0].progress.stage).toBe('completed');
606
+ });
607
+
608
+ test('gets progress overview', async () => {
609
+ const { tool, context } = createTestSetup();
610
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
611
+ const result = await tool.execute({ action: 'progress', mode: 'overview' }, context);
612
+ expect(result.success).toBe(true);
613
+ expect(result.result.overview).toBeDefined();
614
+ });
615
+
616
+ test('calculates progress from subtasks', async () => {
617
+ const { tool, agent, context } = createTestSetup();
618
+ await tool.execute({ action: 'create', title: 'Parent', priority: 'high' }, context);
619
+ const parentId = agent.taskList.tasks[0].id;
620
+ await tool.execute({ action: 'subtask', parentTaskId: parentId, title: 'Sub1' }, context);
621
+ const result = await tool.execute({ action: 'progress', mode: 'calculate', taskId: parentId }, context);
622
+ expect(result.result.calculationMethod).toBe('subtasks');
623
+ });
624
+
625
+ test('errors for invalid stage', async () => {
626
+ const { tool, agent, context } = createTestSetup();
627
+ await tool.execute({ action: 'create', title: 'T', priority: 'high' }, context);
628
+ const taskId = agent.taskList.tasks[0].id;
629
+ const result = await tool.execute({ action: 'progress', mode: 'update', taskId, stage: 'nope' }, context);
630
+ expect(result.success).toBe(false);
631
+ expect(result.error).toContain('Invalid progress stage');
632
+ });
633
+
634
+ test('errors for invalid progress mode', async () => {
635
+ const { tool, context } = createTestSetup();
636
+ const result = await tool.execute({ action: 'progress', mode: 'invalid' }, context);
637
+ expect(result.success).toBe(false);
638
+ });
639
+ });
640
+
641
+ // ── prioritize action ───────────────────────────────────────────
642
+ describe('execute - prioritize', () => {
643
+ test('auto-prioritizes tasks', async () => {
644
+ const { tool, context } = createTestSetup();
645
+ await tool.execute({ action: 'create', title: 'T1', priority: 'low' }, context);
646
+ await tool.execute({ action: 'create', title: 'T2', priority: 'medium' }, context);
647
+ const result = await tool.execute({ action: 'prioritize', mode: 'auto' }, context);
648
+ expect(result.success).toBe(true);
649
+ });
650
+
651
+ test('analyzes specific task priority', async () => {
652
+ const { tool, agent, context } = createTestSetup();
653
+ await tool.execute({ action: 'create', title: 'Analyze', priority: 'medium' }, context);
654
+ const taskId = agent.taskList.tasks[0].id;
655
+ const result = await tool.execute({ action: 'prioritize', mode: 'analyze', taskId }, context);
656
+ expect(result.success).toBe(true);
657
+ expect(result.result.task.priorityScore).toBeDefined();
658
+ });
659
+
660
+ test('balance mode without scheduler returns message', async () => {
661
+ const { tool, context } = createTestSetup();
662
+ const result = await tool.execute({ action: 'prioritize', mode: 'balance' }, context);
663
+ expect(result.success).toBe(true);
664
+ expect(result.result.message).toContain('scheduler');
665
+ });
666
+
667
+ test('errors for invalid mode', async () => {
668
+ const { tool, context } = createTestSetup();
669
+ const result = await tool.execute({ action: 'prioritize', mode: 'xyz' }, context);
670
+ expect(result.success).toBe(false);
671
+ });
672
+ });
673
+
674
+ // ── analytics action ────────────────────────────────────────────
675
+ describe('execute - analytics', () => {
676
+ test('generates summary analytics', async () => {
677
+ const { tool, context } = createTestSetup();
678
+ await tool.execute({ action: 'create', title: 'T1', priority: 'high' }, context);
679
+ const result = await tool.execute({ action: 'analytics', mode: 'summary' }, context);
680
+ expect(result.success).toBe(true);
681
+ expect(result.result.generatedAt).toBeDefined();
682
+ });
683
+
684
+ test('errors for invalid analytics mode', async () => {
685
+ const { tool, context } = createTestSetup();
686
+ const result = await tool.execute({ action: 'analytics', mode: 'invalid' }, context);
687
+ expect(result.success).toBe(false);
688
+ expect(result.error).toContain('Invalid analytics mode');
689
+ });
690
+ });
691
+
692
+ // ── error handling ──────────────────────────────────────────────
693
+ describe('execute - error handling', () => {
694
+ test('fails when agentId is missing', async () => {
695
+ const { tool } = createTestSetup();
696
+ const result = await tool.execute({ action: 'list' }, { agentPool: {} });
697
+ expect(result.success).toBe(false);
698
+ expect(result.error).toContain('Agent ID is required');
699
+ });
700
+
701
+ test('fails when agent is not found', async () => {
702
+ const { tool } = createTestSetup();
703
+ const pool = { getAgent: jest.fn().mockResolvedValue(null) };
704
+ const result = await tool.execute({ action: 'list' }, { agentId: 'x', agentPool: pool });
705
+ expect(result.success).toBe(false);
706
+ expect(result.error).toContain('Agent not found');
707
+ });
708
+
709
+ test('fails for unsupported action', async () => {
710
+ const { tool, context } = createTestSetup();
711
+ const result = await tool.execute({ action: 'fly' }, context);
712
+ expect(result.success).toBe(false);
713
+ expect(result.error).toContain('Unsupported action');
714
+ });
715
+
716
+ test('initializes taskList on agent if missing', async () => {
717
+ const { tool, context, agentPool } = createTestSetup();
718
+ const bare = { id: 'agent-1', name: 'Bare' };
719
+ agentPool.getAgent.mockResolvedValue(bare);
720
+ const result = await tool.execute({ action: 'list' }, context);
721
+ expect(result.success).toBe(true);
722
+ expect(bare.taskList).toBeDefined();
723
+ });
724
+ });
725
+ });