@pheem49/mint 1.16.0 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (984) hide show
  1. package/Cargo.lock +6 -6
  2. package/Cargo.toml +2 -2
  3. package/README.md +8 -2
  4. package/Release_Note.md +222 -72
  5. package/apps/mint-companion/src-tauri/src/compact.rs +69 -0
  6. package/apps/mint-companion/src-tauri/src/main.rs +218 -11
  7. package/apps/mint-companion/vite.config.ts +2 -1
  8. package/crates/mint-cli/src/agent/diff_render.rs +66 -44
  9. package/crates/mint-cli/src/agent/live_status.rs +64 -6
  10. package/crates/mint-cli/src/agent/markdown_render.rs +342 -5
  11. package/crates/mint-cli/src/agent.rs +202 -47
  12. package/crates/mint-cli/src/commands/agent.rs +223 -117
  13. package/crates/mint-cli/src/commands/browser.rs +114 -0
  14. package/crates/mint-cli/src/commands/config.rs +14 -1
  15. package/crates/mint-cli/src/commands/integrations.rs +3 -3
  16. package/crates/mint-cli/src/commands/knowledge.rs +16 -2
  17. package/crates/mint-cli/src/commands/mod.rs +15 -4
  18. package/crates/mint-cli/src/commands/tailnet_web.rs +3 -7
  19. package/crates/mint-cli/src/companion_navigation.rs +268 -0
  20. package/crates/mint-cli/src/interactive/chat_tui/dialog.rs +572 -0
  21. package/crates/mint-cli/src/interactive/chat_tui/mod.rs +1427 -0
  22. package/crates/mint-cli/src/interactive/chat_tui/render.rs +1524 -0
  23. package/crates/mint-cli/src/interactive/chat_tui/selection.rs +401 -0
  24. package/crates/mint-cli/src/interactive/chat_tui/state.rs +1833 -0
  25. package/crates/mint-cli/src/interactive/chat_tui/tests.rs +3414 -0
  26. package/crates/mint-cli/src/interactive/chat_tui/thought.rs +202 -0
  27. package/crates/mint-cli/src/interactive/chat_tui/transcript.rs +728 -0
  28. package/crates/mint-cli/src/interactive/chat_tui/watermark.rs +148 -0
  29. package/crates/mint-cli/src/interactive/command_ui.rs +92 -5
  30. package/crates/mint-cli/src/interactive/composer.rs +186 -0
  31. package/crates/mint-cli/src/interactive/format.rs +78 -3
  32. package/crates/mint-cli/src/interactive/input_box.rs +61 -1
  33. package/crates/mint-cli/src/interactive/resume_picker.rs +367 -25
  34. package/crates/mint-cli/src/interactive/slash_commands.rs +758 -373
  35. package/crates/mint-cli/src/interactive/tool_activity.rs +468 -56
  36. package/crates/mint-cli/src/interactive.rs +74 -5
  37. package/crates/mint-cli/src/main.rs +26 -2
  38. package/crates/mint-cli/src/markdown.rs +2 -37
  39. package/crates/mint-cli/src/onboard.rs +3897 -1321
  40. package/crates/mint-cli/src/setup.rs +1342 -624
  41. package/crates/mint-cli/src/terminal_theme.rs +159 -35
  42. package/crates/mint-cli/tests/library_intake.rs +1 -0
  43. package/crates/mint-cli/tests/mods_testing.rs +5 -1
  44. package/crates/mint-companion-protocol/src/lib.rs +113 -0
  45. package/crates/mint-core/src/agent/chat/anthropic.rs +318 -0
  46. package/crates/mint-core/src/agent/chat/custom.rs +149 -0
  47. package/crates/mint-core/src/agent/chat/gemini.rs +518 -0
  48. package/crates/mint-core/src/agent/chat/mod.rs +857 -0
  49. package/crates/mint-core/src/agent/chat/ollama.rs +321 -0
  50. package/crates/mint-core/src/agent/chat/openai.rs +582 -0
  51. package/crates/mint-core/src/agent/chat/streaming.rs +469 -0
  52. package/crates/mint-core/src/agent/chat/tests.rs +1479 -0
  53. package/crates/mint-core/src/agent/memory.rs +129 -8
  54. package/crates/mint-core/src/agent/safety.rs +56 -4
  55. package/crates/mint-core/src/agent/skill_inventory.rs +3 -1
  56. package/crates/mint-core/src/agent/skills.rs +1 -0
  57. package/crates/mint-core/src/agent/tasks.rs +2 -2
  58. package/crates/mint-core/src/api_server/routes/auth.rs +1 -4
  59. package/crates/mint-core/src/api_server/routes/chat.rs +53 -17
  60. package/crates/mint-core/src/api_server/routes/gemini_live.rs +14 -1
  61. package/crates/mint-core/src/api_server/routes/html_preview.rs +1 -8
  62. package/crates/mint-core/src/api_server/routes/misc.rs +116 -0
  63. package/crates/mint-core/src/api_server/routes/profile_oauth.rs +43 -26
  64. package/crates/mint-core/src/api_server/routes/sessions.rs +114 -76
  65. package/crates/mint-core/src/api_server/routes/skills_subagents.rs +11 -7
  66. package/crates/mint-core/src/api_server/routes/status_health.rs +18 -8
  67. package/crates/mint-core/src/api_server.rs +211 -65
  68. package/crates/mint-core/src/avatar_bridge.rs +5 -24
  69. package/crates/mint-core/src/browser/cdp.rs +92 -30
  70. package/crates/mint-core/src/browser/headless.rs +582 -0
  71. package/crates/mint-core/src/browser/input.rs +7 -62
  72. package/crates/mint-core/src/browser/interact.rs +0 -14
  73. package/crates/mint-core/src/browser/mod.rs +10 -30
  74. package/crates/mint-core/src/browser/navigate.rs +83 -44
  75. package/crates/mint-core/src/browser/runtime.rs +282 -0
  76. package/crates/mint-core/src/browser/session.rs +240 -400
  77. package/crates/mint-core/src/browser/workflow.rs +496 -0
  78. package/crates/mint-core/src/companion/navigation.rs +115 -0
  79. package/crates/mint-core/src/companion.rs +109 -1
  80. package/crates/mint-core/src/cron/store.rs +2 -2
  81. package/crates/mint-core/src/integrations/mcp.rs +6 -8
  82. package/crates/mint-core/src/integrations/mcp_result.rs +45 -0
  83. package/crates/mint-core/src/lib.rs +10 -11
  84. package/crates/mint-core/src/media/gemini_live.rs +636 -86
  85. package/crates/mint-core/src/media/image_proxy.rs +563 -0
  86. package/crates/mint-core/src/media/library/migration.rs +26 -0
  87. package/crates/mint-core/src/media/library/tests.rs +1 -1
  88. package/crates/mint-core/src/media/library/thumbnails.rs +8 -2
  89. package/crates/mint-core/src/media/pictures.rs +1 -1
  90. package/crates/mint-core/src/media/tool_images.rs +287 -0
  91. package/crates/mint-core/src/media/tts/playback.rs +609 -0
  92. package/crates/mint-core/src/media/tts.rs +1 -0
  93. package/crates/mint-core/src/media.rs +2 -0
  94. package/crates/mint-core/src/mods/manager.rs +101 -35
  95. package/crates/mint-core/src/orchestration/context_render.rs +878 -44
  96. package/crates/mint-core/src/orchestration/decision_parsing.rs +536 -39
  97. package/crates/mint-core/src/orchestration/diagnostics.rs +307 -0
  98. package/crates/mint-core/src/orchestration/full_skill_result_tests.rs +12 -0
  99. package/crates/mint-core/src/orchestration/image_regressions.rs +379 -0
  100. package/crates/mint-core/src/orchestration/loop_guard.rs +479 -0
  101. package/crates/mint-core/src/orchestration/mcp_outcome_tests.rs +864 -0
  102. package/crates/mint-core/src/orchestration/memory_skill.rs +88 -28
  103. package/crates/mint-core/src/orchestration/mod.rs +859 -4244
  104. package/crates/mint-core/src/orchestration/reliability.rs +581 -0
  105. package/crates/mint-core/src/orchestration/repeated_failures.rs +8 -0
  106. package/crates/mint-core/src/orchestration/review_regressions.rs +179 -28
  107. package/crates/mint-core/src/orchestration/tests.rs +1665 -0
  108. package/crates/mint-core/src/orchestration/tools/dispatch.rs +967 -0
  109. package/crates/mint-core/src/orchestration/tools/files.rs +32 -3
  110. package/crates/mint-core/src/orchestration/tools/mod.rs +5 -1
  111. package/crates/mint-core/src/orchestration/tools/planning.rs +102 -42
  112. package/crates/mint-core/src/orchestration/tools/plugins_mcp.rs +19 -4
  113. package/crates/mint-core/src/orchestration/tools/project.rs +1 -1
  114. package/crates/mint-core/src/orchestration/tools/shell.rs +157 -62
  115. package/crates/mint-core/src/orchestration/tools/web.rs +5 -1
  116. package/crates/mint-core/src/orchestration/trajectory_schema.rs +353 -0
  117. package/crates/mint-core/src/orchestration/truncation.rs +368 -0
  118. package/crates/mint-core/src/orchestration/types.rs +648 -0
  119. package/crates/mint-core/src/orchestration/verification.rs +36 -9
  120. package/crates/mint-core/src/orchestration/workspace_helpers.rs +76 -27
  121. package/crates/mint-core/src/prompts/agent.rs +69 -102
  122. package/crates/mint-core/src/prompts/tool_catalog.rs +104 -153
  123. package/crates/mint-core/src/search/files.rs +20 -0
  124. package/crates/mint-core/src/search/web_search.rs +44 -3
  125. package/crates/mint-core/src/slash/mod.rs +481 -55
  126. package/crates/mint-core/src/slash/models.rs +6 -1
  127. package/crates/mint-core/src/swarm/batch.rs +643 -0
  128. package/crates/mint-core/src/swarm/dossier.rs +152 -0
  129. package/crates/mint-core/src/swarm/labels.rs +100 -0
  130. package/crates/mint-core/src/swarm/mod.rs +158 -0
  131. package/crates/mint-core/src/swarm/permissions.rs +167 -0
  132. package/crates/mint-core/src/system/auth.rs +156 -7
  133. package/crates/mint-core/src/system/bg_shell.rs +78 -9
  134. package/crates/mint-core/src/system/config.rs +266 -35
  135. package/crates/mint-core/src/system/mint_web.rs +33 -12
  136. package/crates/mint-core/src/system/shell.rs +179 -10
  137. package/crates/mint-core/src/system/workspace.rs +204 -0
  138. package/crates/mint-core/tests/background_retention.rs +1 -1
  139. package/crates/mint-core/tests/memory_persistence.rs +27 -0
  140. package/crates/mint-mod-runtime/src/lib.rs +37 -23
  141. package/out/web/assets/ArtifactPreviewPanel-Cx6BVOOF.js +2 -0
  142. package/out/web/assets/ArtifactPreviewPanel-DAT_Y7i0.css +1 -0
  143. package/out/web/assets/CalculationCard-D2E74u5q.js +1 -0
  144. package/out/web/assets/CliSessionsView-ZbdtSjvK.css +1 -0
  145. package/out/web/assets/CliSessionsView-z5i6qGyb.js +1 -0
  146. package/out/web/assets/CodeReviewPage-BK2bOScd.css +1 -0
  147. package/out/web/assets/CodeReviewPage-Dp6zHuHu.js +2 -0
  148. package/out/web/assets/CommandPalette-DaKlzbKs.js +1 -0
  149. package/out/web/assets/ImageGenCard-BMCJHP9O.js +1 -0
  150. package/out/web/assets/ImageSearchCard-Cld_SOUg.js +1 -0
  151. package/out/web/assets/ImageStudioPanel-B5N7TjeB.js +1 -0
  152. package/out/web/assets/LibraryPage-CMB89rJ0.css +1 -0
  153. package/out/web/assets/LibraryPage-DbZEi4W_.js +2 -0
  154. package/out/web/assets/LinkedFoldersView-9B9DIPoZ.js +1 -0
  155. package/out/web/assets/McpRegistryPicker-DnXPlzI7.js +1 -0
  156. package/out/web/assets/McpServersView-CiNBNUl4.js +1 -0
  157. package/out/web/assets/MermaidCard-BBDNEXbY.js +2 -0
  158. package/out/web/assets/MintDashboard-C_UYPoNV.js +119 -0
  159. package/out/web/assets/MintDashboard-DTd8C_c8.css +1 -0
  160. package/out/web/assets/PlanCard-C2x5pajq.js +1 -0
  161. package/out/web/assets/PluginsView-DoTg9MVa.js +1 -0
  162. package/out/web/assets/RewindModal-B5oowrR0.js +1 -0
  163. package/out/web/assets/ScheduledTasksView-BD5DVPkZ.js +1 -0
  164. package/out/web/assets/SelectField-Cy6CghrU.js +1 -0
  165. package/out/web/assets/SelectField-lFEkkWCU.css +1 -0
  166. package/out/web/assets/SettingsWindow-BYl_oCFh.js +4 -0
  167. package/out/web/assets/SettingsWindow-Ckcgnjt8.css +1 -0
  168. package/out/web/assets/SkillsView-CIeWwq5z.js +2 -0
  169. package/out/web/assets/StockCard-DxUciKyp.js +1 -0
  170. package/out/web/assets/ToolSurfacePage-qBgs_VHq.css +1 -0
  171. package/out/web/assets/ToolSurfacePage-saVbVrkE.js +38 -0
  172. package/out/web/assets/UiFeatureCard-CdY0hGWy.js +1 -0
  173. package/out/web/assets/UiGridCard-BBK3I5hC.js +1 -0
  174. package/out/web/assets/UiMockupWidget-CpR9EDuc.js +1 -0
  175. package/out/web/assets/{VeoStudioPanel-DOj7_WR3.css → VeoStudioPanel-9kU9YLEN.css} +1 -1
  176. package/out/web/assets/VeoStudioPanel-Co6-wEWM.js +4 -0
  177. package/out/web/assets/WeatherCard-Buzi7Vfu.js +1 -0
  178. package/out/web/assets/WorkspacePanel-BfHKkulU.js +1 -0
  179. package/out/web/assets/WorkspacePdfPreview-Bi8Zzyir.js +2 -0
  180. package/out/web/assets/abnfDiagram-VCTEODGH-CMfR95N2.js +1 -0
  181. package/out/web/assets/architecture-7GRP2DOG-DhAM4HyO.js +1 -0
  182. package/out/web/assets/architectureDiagram-5GKGNRK7-Yk3TUJ_F.js +36 -0
  183. package/out/web/assets/{blockDiagram-NRAW4CY4-BrrqzHW5.js → blockDiagram-I7D4REHJ-X9fBgJik.js} +4 -4
  184. package/out/web/assets/c4Diagram-7LVT6UL2-Bk9x7N-8.js +38 -0
  185. package/out/web/assets/chunk-2Q5K7J3B-D2JLPQzF.js +1 -0
  186. package/out/web/assets/{chunk-TEH6E4GO-G4Cdlyrt.js → chunk-4HAMMTFA-Dx5fk1_0.js} +3 -3
  187. package/out/web/assets/{chunk-5VM5RSS4-BiPuE0io.js → chunk-5VM5RSS4-BZ2oBPYQ.js} +1 -1
  188. package/out/web/assets/chunk-75Z2AOVW-BszTQoM4.js +2 -0
  189. package/out/web/assets/chunk-DU6HZSFF-DK-As3rk.js +128 -0
  190. package/out/web/assets/chunk-F27PBJKO-LmncZZIS.js +1 -0
  191. package/out/web/assets/chunk-FOHPRMQF-JXEeeJ9r.js +161 -0
  192. package/out/web/assets/{chunk-GMAD6QVW-BuhEcgHq.js → chunk-GMAD6QVW-DSQ_sDRJ.js} +12 -12
  193. package/out/web/assets/chunk-GVQU2GXP-Cno3ulje.js +1 -0
  194. package/out/web/assets/chunk-IMKFNOWR-bIzfY9Jc.js +231 -0
  195. package/out/web/assets/chunk-JWPE2WC7-BeEMUFDw.js +1 -0
  196. package/out/web/assets/chunk-L3NEJ4N5-Dl6eOa0D.js +1 -0
  197. package/out/web/assets/chunk-OSK3NFVY-BaUGJ-cM.js +10 -0
  198. package/out/web/assets/chunk-P2QGCYS3-_066ndhH.js +1 -0
  199. package/out/web/assets/chunk-POPQ4Y6H-YT1AKhTv.js +1 -0
  200. package/out/web/assets/chunk-PWAF6VOD-CrEgDsxh.js +1 -0
  201. package/out/web/assets/chunk-SHT3W25Y-_KwaRLOl.js +168 -0
  202. package/out/web/assets/{chunk-SVP7TREG-Bu_yYb-V.js → chunk-SVP7TREG-BQ1qb32L.js} +1 -1
  203. package/out/web/assets/{chunk-LCL6LL3I-BhXV9zyH.js → chunk-TICWLB2K-BDyehCtg.js} +4 -4
  204. package/out/web/assets/chunk-XXDRQBXY-B9YlhOkE.js +1 -0
  205. package/out/web/assets/chunk-Y2CYZVJY-BxCWjNVG.js +1 -0
  206. package/out/web/assets/classDiagram-ZZMXUADV-BoSpzRCJ.js +1 -0
  207. package/out/web/assets/classDiagram-v2-VYDZK3BY-BoSpzRCJ.js +1 -0
  208. package/out/web/assets/config-2suVFPZg.css +1 -0
  209. package/out/web/assets/config-CkRCdkxn.js +2 -0
  210. package/out/web/assets/core-Mi3s5D4_.js +1 -0
  211. package/out/web/assets/cose-bilkent-JH36ORCC-qlna31ty.js +1 -0
  212. package/out/web/assets/cynefin-OW5HDTMX-Dl_31aaN.js +1 -0
  213. package/out/web/assets/cynefinDiagram-5FMLGOSQ-Bpir8jha.js +62 -0
  214. package/out/web/assets/cytoscape.esm-DWtAUG0r.js +321 -0
  215. package/out/web/assets/dagre-CnWJJM5f.js +1 -0
  216. package/out/web/assets/dagre-GXQ25YYZ-D9xu3nsq.js +4 -0
  217. package/out/web/assets/diagram-S7CK7UJ4-DeveoEeB.js +30 -0
  218. package/out/web/assets/diagram-UQ7AKVKN-p4xWRESV.js +41 -0
  219. package/out/web/assets/{diagram-VSXAHHWV-BJ86Ov2Y.js → diagram-VSXAHHWV-C7qz9NDF.js} +1 -1
  220. package/out/web/assets/diagram-VX7I27RA-DRiCa3Vd.js +24 -0
  221. package/out/web/assets/diagram-Z3DM3KII-Bt7zduQX.js +24 -0
  222. package/out/web/assets/dist-9ISJ7r-g.js +1 -0
  223. package/out/web/assets/dist-js-BV3mI7uw.js +1 -0
  224. package/out/web/assets/ebnfDiagram-PWID7BFC-DV9WpwdR.js +1 -0
  225. package/out/web/assets/{erDiagram-SSCWMZ5O-CzzmnZWT.js → erDiagram-RLTQ6QDP-BJ_nwG2m.js} +3 -3
  226. package/out/web/assets/event-D7D-EBy9.js +1 -0
  227. package/out/web/assets/eventmodeling-NTZA5JFV-BTBMrfVa.js +1 -0
  228. package/out/web/assets/flowDiagram-HODETNUW-Cdlq3cJL.js +1 -0
  229. package/out/web/assets/ganttDiagram-EL5Y4UJY-DQLdsXrC.js +292 -0
  230. package/out/web/assets/gitGraph-4MIJSDKK-CL1OEOQ_.js +1 -0
  231. package/out/web/assets/gitGraphDiagram-WWUBYQGX-8cSi42H7.js +106 -0
  232. package/out/web/assets/graphlib-Bh9gHply.js +1 -0
  233. package/out/web/assets/index-BocxnrDG.js +168 -0
  234. package/out/web/assets/index-yeh_r55a.css +1 -0
  235. package/out/web/assets/info-A6RAGUB7-C1zsX5sc.js +1 -0
  236. package/out/web/assets/infoDiagram-27XIBGKW-DsRYtIyI.js +2 -0
  237. package/out/web/assets/{ishikawaDiagram-5VMMS53U-s38yo28y.js → ishikawaDiagram-5VMMS53U-B2crwIXj.js} +4 -4
  238. package/out/web/assets/journeyDiagram-3NMN7TZE-BTH-GyVR.js +139 -0
  239. package/out/web/assets/jsx-runtime-DmUwWVTj.js +1 -0
  240. package/out/web/assets/{kanban-definition-3QL26DDD-DodjgySL.js → kanban-definition-UXKFOSKX-BeRfCnuA.js} +6 -6
  241. package/out/web/assets/katex-MCdQaEAD.js +257 -0
  242. package/out/web/assets/mermaid-parser.core-BJwgCBBc.js +7 -0
  243. package/out/web/assets/mermaid.core-CsDDodN8.js +44 -0
  244. package/out/web/assets/{mindmap-definition-FBJOCRG2-260WBDxZ.js → mindmap-definition-YA3MSWOX-B42efOQ1.js} +4 -4
  245. package/out/web/assets/modelManager-B3ZFMh8v.js +2 -0
  246. package/out/web/assets/oauthManager-Ch5Du2fF.js +1 -0
  247. package/out/web/assets/packet-AYTQ26CC-B6xUyE6r.js +1 -0
  248. package/out/web/assets/pdf-Bcahc2yC.js +56 -0
  249. package/out/web/assets/pdf.worker.min-Dkey6ZUl.mjs +27 -0
  250. package/out/web/assets/pegDiagram-XKGWAZYB-1LabVycL.js +1 -0
  251. package/out/web/assets/pie-WAS4IAKB-DJwo-nf_.js +1 -0
  252. package/out/web/assets/pieDiagram-E7YTZNPT-icmAqzy4.js +39 -0
  253. package/out/web/assets/{quadrantDiagram-AXDQQJYC-B8D3gU5d.js → quadrantDiagram-AXDQQJYC-CZ-wEx41.js} +4 -4
  254. package/out/web/assets/radar-RG4KPBEZ-D7d-Xriw.js +1 -0
  255. package/out/web/assets/railroad-74A4TZTK-viuhdYbs.js +1 -0
  256. package/out/web/assets/railroad-abnf-HS5TGJTU-DNXiCNea.js +1 -0
  257. package/out/web/assets/railroad-ebnf-LZEXJU2U-nkSu1-0C.js +1 -0
  258. package/out/web/assets/railroad-peg-WCYAUIDC-BhbMeQzz.js +1 -0
  259. package/out/web/assets/railroadDiagram-O6MQD6OU-CLpG1jUX.js +1 -0
  260. package/out/web/assets/{requirementDiagram-EFPCY7ZU-D2X-Ewik.js → requirementDiagram-BXWQKSXE-kRDrvWrc.js} +3 -3
  261. package/out/web/assets/rolldown-runtime-CNOWq4Kh.js +1 -0
  262. package/out/web/assets/rough.esm-CNnFptCR.js +1 -0
  263. package/out/web/assets/sankeyDiagram-P5KCCOFB-DxAwmq4x.js +40 -0
  264. package/out/web/assets/sequenceDiagram-WJ2MYXX4-aLgY-6Wz.js +162 -0
  265. package/out/web/assets/sizeCapture-INFHLROL-C8Q8DbV5.js +1 -0
  266. package/out/web/assets/src-CRDfRlHM.js +1 -0
  267. package/out/web/assets/stateDiagram-D77RDMKH-D5QWfOhp.js +1 -0
  268. package/out/web/assets/stateDiagram-v2-MP3YSRHH-D6OiZoAP.js +1 -0
  269. package/out/web/assets/studio-BBZQ_-QK.js +1 -0
  270. package/out/web/assets/swimlanes-42K2YHIH-CRs5UyA-.js +1 -0
  271. package/out/web/assets/swimlanesDiagram-VR7AAH4N-UgEXIsV0.js +8 -0
  272. package/out/web/assets/syntaxHighlight-C-wAGT84.js +3 -0
  273. package/out/web/assets/timeline-definition-24CTP7MA-Denqd9qb.js +120 -0
  274. package/out/web/assets/treeView-Q6P3EWNA-0my3Z3s4.js +1 -0
  275. package/out/web/assets/treemap-WGGIJYW6-B_EjkLYq.js +1 -0
  276. package/out/web/assets/vennDiagram-4TSXK5OY-DxVg3Ewr.js +34 -0
  277. package/out/web/assets/wardley-WFR3VGLG-CGD-Tj4p.js +1 -0
  278. package/out/web/assets/{wardleyDiagram-VM6X3IG4-DAdXELbQ.js → wardleyDiagram-VM6X3IG4-CmfS39Xm.js} +35 -35
  279. package/out/web/assets/window-CkUOP7t0.js +1 -0
  280. package/out/web/assets/workspaces-SYPrmbgC.js +1 -0
  281. package/out/web/assets/{xychartDiagram-S5SC5T6Z-IZIXf3Vo.js → xychartDiagram-S5SC5T6Z-BVM9bKis.js} +4 -4
  282. package/out/web/index-web.html +4 -4
  283. package/out/web/index.html +4 -4
  284. package/out/web/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  285. package/out/web/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  286. package/out/web/pdfjs/cmaps/78-H.bcmap +0 -0
  287. package/out/web/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  288. package/out/web/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  289. package/out/web/pdfjs/cmaps/78-V.bcmap +0 -0
  290. package/out/web/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  291. package/out/web/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  292. package/out/web/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  293. package/out/web/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  294. package/out/web/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  295. package/out/web/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  296. package/out/web/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  297. package/out/web/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  298. package/out/web/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  299. package/out/web/pdfjs/cmaps/Add-H.bcmap +0 -0
  300. package/out/web/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  301. package/out/web/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  302. package/out/web/pdfjs/cmaps/Add-V.bcmap +0 -0
  303. package/out/web/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  304. package/out/web/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  305. package/out/web/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  306. package/out/web/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  307. package/out/web/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  308. package/out/web/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  309. package/out/web/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  310. package/out/web/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  311. package/out/web/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  312. package/out/web/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  313. package/out/web/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  314. package/out/web/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  315. package/out/web/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  316. package/out/web/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  317. package/out/web/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  318. package/out/web/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  319. package/out/web/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  320. package/out/web/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  321. package/out/web/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  322. package/out/web/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  323. package/out/web/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  324. package/out/web/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  325. package/out/web/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  326. package/out/web/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  327. package/out/web/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  328. package/out/web/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  329. package/out/web/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  330. package/out/web/pdfjs/cmaps/B5-H.bcmap +0 -0
  331. package/out/web/pdfjs/cmaps/B5-V.bcmap +0 -0
  332. package/out/web/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  333. package/out/web/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  334. package/out/web/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  335. package/out/web/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  336. package/out/web/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  337. package/out/web/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  338. package/out/web/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  339. package/out/web/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  340. package/out/web/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  341. package/out/web/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  342. package/out/web/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  343. package/out/web/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  344. package/out/web/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  345. package/out/web/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  346. package/out/web/pdfjs/cmaps/EUC-H.bcmap +0 -0
  347. package/out/web/pdfjs/cmaps/EUC-V.bcmap +0 -0
  348. package/out/web/pdfjs/cmaps/Ext-H.bcmap +0 -0
  349. package/out/web/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  350. package/out/web/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  351. package/out/web/pdfjs/cmaps/Ext-V.bcmap +0 -0
  352. package/out/web/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  353. package/out/web/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  354. package/out/web/pdfjs/cmaps/GB-H.bcmap +4 -0
  355. package/out/web/pdfjs/cmaps/GB-V.bcmap +0 -0
  356. package/out/web/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  357. package/out/web/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  358. package/out/web/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  359. package/out/web/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  360. package/out/web/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  361. package/out/web/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  362. package/out/web/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  363. package/out/web/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  364. package/out/web/pdfjs/cmaps/GBT-H.bcmap +0 -0
  365. package/out/web/pdfjs/cmaps/GBT-V.bcmap +0 -0
  366. package/out/web/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  367. package/out/web/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  368. package/out/web/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  369. package/out/web/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  370. package/out/web/pdfjs/cmaps/H.bcmap +0 -0
  371. package/out/web/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  372. package/out/web/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  373. package/out/web/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  374. package/out/web/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  375. package/out/web/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  376. package/out/web/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  377. package/out/web/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  378. package/out/web/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  379. package/out/web/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  380. package/out/web/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  381. package/out/web/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  382. package/out/web/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  383. package/out/web/pdfjs/cmaps/Hankaku.bcmap +0 -0
  384. package/out/web/pdfjs/cmaps/Hiragana.bcmap +0 -0
  385. package/out/web/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  386. package/out/web/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  387. package/out/web/pdfjs/cmaps/KSC-H.bcmap +0 -0
  388. package/out/web/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  389. package/out/web/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  390. package/out/web/pdfjs/cmaps/KSC-V.bcmap +0 -0
  391. package/out/web/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  392. package/out/web/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  393. package/out/web/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  394. package/out/web/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  395. package/out/web/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  396. package/out/web/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  397. package/out/web/pdfjs/cmaps/Katakana.bcmap +0 -0
  398. package/out/web/pdfjs/cmaps/LICENSE +36 -0
  399. package/out/web/pdfjs/cmaps/NWP-H.bcmap +0 -0
  400. package/out/web/pdfjs/cmaps/NWP-V.bcmap +0 -0
  401. package/out/web/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  402. package/out/web/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  403. package/out/web/pdfjs/cmaps/Roman.bcmap +0 -0
  404. package/out/web/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  405. package/out/web/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  406. package/out/web/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  407. package/out/web/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  408. package/out/web/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  409. package/out/web/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  410. package/out/web/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  411. package/out/web/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  412. package/out/web/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  413. package/out/web/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  414. package/out/web/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  415. package/out/web/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  416. package/out/web/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  417. package/out/web/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  418. package/out/web/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  419. package/out/web/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  420. package/out/web/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  421. package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  422. package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  423. package/out/web/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  424. package/out/web/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  425. package/out/web/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  426. package/out/web/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  427. package/out/web/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  428. package/out/web/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  429. package/out/web/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  430. package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  431. package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  432. package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  433. package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  434. package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  435. package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  436. package/out/web/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  437. package/out/web/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  438. package/out/web/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  439. package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  440. package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  441. package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  442. package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  443. package/out/web/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  444. package/out/web/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  445. package/out/web/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  446. package/out/web/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  447. package/out/web/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  448. package/out/web/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  449. package/out/web/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  450. package/out/web/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  451. package/out/web/pdfjs/cmaps/V.bcmap +0 -0
  452. package/out/web/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  453. package/out/web/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  454. package/out/web/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  455. package/out/web/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  456. package/out/web/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  457. package/out/web/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  458. package/out/web/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  459. package/out/web/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  460. package/out/web/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  461. package/out/web/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  462. package/out/web/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  463. package/out/web/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  464. package/out/web/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  465. package/out/web/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  466. package/out/web/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  467. package/out/web/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  468. package/out/web/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  469. package/out/web/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  470. package/out/web/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  471. package/out/web/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  472. package/out/web/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  473. package/out/web/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  474. package/out/web/pdfjs/wasm/LICENSE_QCMS +21 -0
  475. package/out/web/pdfjs/wasm/jbig2.wasm +0 -0
  476. package/out/web/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  477. package/out/web/pdfjs/wasm/openjpeg.wasm +0 -0
  478. package/out/web/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  479. package/out/web/pdfjs/wasm/qcms_bg.wasm +0 -0
  480. package/out/web/pdfjs/wasm/quickjs-eval.js +16 -0
  481. package/out/web/pdfjs/wasm/quickjs-eval.wasm +0 -0
  482. package/package.json +6 -4
  483. package/shared-modules/CODEOWNERS +3 -3
  484. package/shared-modules/SDL2/SDL2_mixer.json +27 -0
  485. package/shared-modules/appstream/README.md +13 -0
  486. package/shared-modules/appstream/appstream-compose.json +111 -0
  487. package/shared-modules/dbus-glib/dbus-glib.json +2 -2
  488. package/shared-modules/libportal/libportal.json +23 -0
  489. package/shared-modules/linux-audio/fluidsynth2-static.json +2 -2
  490. package/shared-modules/linux-audio/fluidsynth2.json +2 -2
  491. package/shared-modules/linux-audio/libinstpatch.json +2 -2
  492. package/shared-modules/linux-audio/liblo-static.json +3 -0
  493. package/shared-modules/luajit/luajit.json +2 -2
  494. package/shared-modules/squashfs-tools/squashfs-tools.json +0 -3
  495. package/slash-commands.json +14 -3
  496. package/src/bin/index.js +4 -1
  497. package/src/bin/pdfjs-assets.mjs +31 -0
  498. package/src/renderer/node_modules/.vite/vitest/CACHEDIR.TAG +3 -0
  499. package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  500. package/src/renderer/shared/agentProgress.ts +62 -5
  501. package/src/renderer/shared/components/Settings/AgentsTab.tsx +70 -6
  502. package/src/renderer/shared/components/Settings/AudioTab.tsx +1 -1
  503. package/src/renderer/shared/components/Settings/AutomationTab.tsx +32 -29
  504. package/src/renderer/shared/components/Settings/AvatarCropModal.tsx +32 -12
  505. package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.test.tsx +65 -0
  506. package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.tsx +456 -0
  507. package/src/renderer/shared/components/Settings/GeneralTab.tsx +65 -94
  508. package/src/renderer/shared/components/Settings/PluginsTab.tsx +101 -24
  509. package/src/renderer/shared/components/Settings/ProfileTab.tsx +1 -1
  510. package/src/renderer/shared/components/Settings/SettingsWindow.tsx +796 -0
  511. package/src/renderer/shared/components/Settings/ThemeTab.test.tsx +45 -0
  512. package/src/renderer/shared/components/Settings/ThemeTab.tsx +119 -4
  513. package/src/renderer/shared/components/activity/AgentActivityDrawer.tsx +270 -0
  514. package/src/renderer/shared/components/activity/AgentActivityTable.tsx +582 -0
  515. package/src/renderer/shared/components/activity/AskUserActivityCard.test.tsx +122 -0
  516. package/src/renderer/shared/components/activity/AskUserActivityCard.tsx +70 -0
  517. package/src/renderer/shared/components/{McpToolResults.tsx → activity/McpToolResults.tsx} +69 -13
  518. package/src/renderer/shared/components/{PlanChecklistWidget.tsx → activity/PlanChecklistWidget.tsx} +2 -2
  519. package/src/renderer/shared/components/activity/RunSummaryDashboard.test.tsx +127 -0
  520. package/src/renderer/shared/components/activity/RunSummaryDashboard.tsx +222 -0
  521. package/src/renderer/shared/components/activity/SubagentDagView.test.ts +123 -0
  522. package/src/renderer/shared/components/{SubagentDagView.tsx → activity/SubagentDagView.tsx} +104 -50
  523. package/src/renderer/shared/components/activity/SubagentStatusStrip.test.tsx +82 -0
  524. package/src/renderer/shared/components/activity/SubagentStatusStrip.tsx +107 -0
  525. package/src/renderer/shared/components/activity/ViewedImages.tsx +179 -0
  526. package/src/renderer/shared/components/{AuthGate.tsx → app/AuthGate.tsx} +3 -3
  527. package/src/renderer/shared/components/{ChunkErrorBoundary.tsx → app/ChunkErrorBoundary.tsx} +13 -13
  528. package/src/renderer/shared/components/{CommandPalette.tsx → app/CommandPalette.tsx} +30 -30
  529. package/src/renderer/shared/components/{DashboardSidebar.tsx → app/DashboardSidebar.tsx} +7 -5
  530. package/src/renderer/shared/components/{DesktopTitlebar.tsx → app/DesktopTitlebar.tsx} +9 -26
  531. package/src/renderer/shared/components/{ErrorNotice.tsx → app/ErrorNotice.tsx} +1 -1
  532. package/src/renderer/shared/components/{MintDashboard.tsx → app/MintDashboard.tsx} +217 -228
  533. package/src/renderer/shared/components/{ModalErrorBoundary.tsx → app/ModalErrorBoundary.tsx} +8 -8
  534. package/src/renderer/shared/components/{CalculationCard.tsx → cards/CalculationCard.tsx} +16 -30
  535. package/src/renderer/shared/components/{ImageGenCard.tsx → cards/ImageGenCard.tsx} +11 -24
  536. package/src/renderer/shared/components/{ImageSearchCard.tsx → cards/ImageSearchCard.tsx} +11 -24
  537. package/src/renderer/shared/components/{MermaidCard.tsx → cards/MermaidCard.tsx} +38 -22
  538. package/src/renderer/shared/components/cards/PlanCard.test.tsx +41 -0
  539. package/src/renderer/shared/components/cards/PlanCard.tsx +32 -0
  540. package/src/renderer/shared/components/cards/ReleaseNotesCard.test.tsx +29 -0
  541. package/src/renderer/shared/components/cards/ReleaseNotesCard.tsx +137 -0
  542. package/src/renderer/shared/components/{StockCard.tsx → cards/StockCard.tsx} +22 -38
  543. package/src/renderer/shared/components/cards/ToolResultCards.tsx +94 -0
  544. package/src/renderer/shared/components/{UiFeatureCard.tsx → cards/UiFeatureCard.tsx} +6 -6
  545. package/src/renderer/shared/components/{UiGridCard.tsx → cards/UiGridCard.tsx} +3 -3
  546. package/src/renderer/shared/components/{UiMockupWidget.tsx → cards/UiMockupWidget.tsx} +4 -4
  547. package/src/renderer/shared/components/{WeatherCard.tsx → cards/WeatherCard.tsx} +6 -6
  548. package/src/renderer/shared/components/{ApprovalCard.test.tsx → chat/ApprovalCard.test.tsx} +12 -1
  549. package/src/renderer/shared/components/{ApprovalCard.tsx → chat/ApprovalCard.tsx} +26 -7
  550. package/src/renderer/shared/components/chat/ArtifactCards.test.tsx +69 -0
  551. package/src/renderer/shared/components/chat/ArtifactCards.tsx +238 -0
  552. package/src/renderer/shared/components/chat/AttachedDocumentCard.test.tsx +39 -0
  553. package/src/renderer/shared/components/chat/AttachedDocumentCard.tsx +220 -0
  554. package/src/renderer/shared/components/chat/ChatCodeBlock.test.tsx +33 -0
  555. package/src/renderer/shared/components/{ChatCodeBlock.tsx → chat/ChatCodeBlock.tsx} +16 -2
  556. package/src/renderer/shared/components/chat/ChatMessageItem.test.tsx +183 -0
  557. package/src/renderer/shared/components/chat/ChatMessageItem.tsx +388 -0
  558. package/src/renderer/shared/components/chat/ChatModeSelector.css +227 -0
  559. package/src/renderer/shared/components/chat/ChatModeSelector.test.tsx +45 -0
  560. package/src/renderer/shared/components/chat/ChatModeSelector.tsx +198 -0
  561. package/src/renderer/shared/components/chat/ChatPanel.test.tsx +53 -0
  562. package/src/renderer/shared/components/{ChatPanel.tsx → chat/ChatPanel.tsx} +462 -537
  563. package/src/renderer/shared/components/{CollapsiblePasteInput.tsx → chat/CollapsiblePasteInput.tsx} +2 -2
  564. package/src/renderer/shared/components/{DiffReviewModal.tsx → chat/DiffReviewModal.tsx} +44 -44
  565. package/src/renderer/shared/components/chat/GeminiLiveOverlay.test.tsx +165 -0
  566. package/src/renderer/shared/components/{GeminiLiveOverlay.tsx → chat/GeminiLiveOverlay.tsx} +47 -5
  567. package/src/renderer/shared/components/{ModelSelectorPopover.tsx → chat/ModelSelectorPopover.tsx} +44 -16
  568. package/src/renderer/shared/components/chat/QueuedMessagesBanner.test.tsx +89 -0
  569. package/src/renderer/shared/components/chat/QueuedMessagesBanner.tsx +201 -0
  570. package/src/renderer/shared/components/{RewindModal.tsx → chat/RewindModal.tsx} +14 -14
  571. package/src/renderer/shared/components/{SlashChoicePanel.tsx → chat/SlashChoicePanel.tsx} +2 -2
  572. package/src/renderer/shared/components/{SlashSuggestions.test.tsx → chat/SlashSuggestions.test.tsx} +14 -0
  573. package/src/renderer/shared/components/{SlashSuggestions.tsx → chat/SlashSuggestions.tsx} +4 -4
  574. package/src/renderer/shared/components/chat/SourcesBlock.test.tsx +53 -0
  575. package/src/renderer/shared/components/{SourcesBlock.tsx → chat/SourcesBlock.tsx} +262 -123
  576. package/src/renderer/shared/components/{ThinkingBlock.tsx → chat/ThinkingBlock.tsx} +1 -1
  577. package/src/renderer/shared/components/chat/TurnFileChanges.test.tsx +130 -0
  578. package/src/renderer/shared/components/chat/TurnFileChanges.tsx +463 -0
  579. package/src/renderer/shared/components/{VoicePill.css → chat/VoicePill.css} +1 -1
  580. package/src/renderer/shared/components/{VoicePill.jsx → chat/VoicePill.jsx} +3 -2
  581. package/src/renderer/shared/components/{CliSessionsView.test.tsx → extensions/CliSessionsView.test.tsx} +2 -2
  582. package/src/renderer/shared/components/{CliSessionsView.tsx → extensions/CliSessionsView.tsx} +19 -16
  583. package/src/renderer/shared/components/{LinkedFoldersView.tsx → extensions/LinkedFoldersView.tsx} +3 -3
  584. package/src/renderer/shared/components/{McpRegistryPicker.tsx → extensions/McpRegistryPicker.tsx} +6 -6
  585. package/src/renderer/shared/components/{McpServersView.tsx → extensions/McpServersView.tsx} +105 -36
  586. package/src/renderer/shared/components/{McpToolAllowlist.tsx → extensions/McpToolAllowlist.tsx} +2 -2
  587. package/src/renderer/shared/components/{ModUi.test.tsx → extensions/ModUi.test.tsx} +9 -4
  588. package/src/renderer/shared/components/{ModsPanel.tsx → extensions/ModsPanel.tsx} +59 -7
  589. package/src/renderer/shared/components/{PluginsView.tsx → extensions/PluginsView.tsx} +6 -6
  590. package/src/renderer/shared/components/{ScheduledTasksView.tsx → extensions/ScheduledTasksView.tsx} +5 -5
  591. package/src/renderer/shared/components/extensions/SkillsView.test.tsx +31 -0
  592. package/src/renderer/shared/components/{SkillsView.tsx → extensions/SkillsView.tsx} +20 -4
  593. package/src/renderer/shared/components/{ImageStudioPanel.tsx → studio/ImageStudioPanel.tsx} +6 -6
  594. package/src/renderer/shared/components/{LibraryItemCard.tsx → studio/LibraryItemCard.tsx} +2 -2
  595. package/src/renderer/shared/components/{LibraryPage.tsx → studio/LibraryPage.tsx} +53 -10
  596. package/src/renderer/shared/components/{LibraryPreview.tsx → studio/LibraryPreview.tsx} +2 -2
  597. package/src/renderer/shared/components/{VeoStudioPanel.tsx → studio/VeoStudioPanel.tsx} +7 -7
  598. package/src/renderer/shared/components/{GlideSelect.css → ui/GlideSelect.css} +7 -6
  599. package/src/renderer/shared/components/ui/ProviderBrandIcon.test.tsx +67 -0
  600. package/src/renderer/shared/components/ui/ProviderBrandIcon.tsx +167 -0
  601. package/src/renderer/shared/components/ui/SelectField.tsx +506 -0
  602. package/src/renderer/shared/components/ui/error-recovery.css +10 -10
  603. package/src/renderer/shared/components/ui/error-recovery.tsx +1 -1
  604. package/src/renderer/shared/components/{ArtifactPreviewPanel.tsx → workspace/ArtifactPreviewPanel.tsx} +374 -118
  605. package/src/renderer/shared/components/workspace/BackgroundTerminals.test.tsx +63 -0
  606. package/src/renderer/shared/components/{BackgroundTerminals.tsx → workspace/BackgroundTerminals.tsx} +40 -9
  607. package/src/renderer/shared/components/workspace/CodeReviewPage.test.tsx +50 -0
  608. package/src/renderer/shared/components/{CodeReviewPage.tsx → workspace/CodeReviewPage.tsx} +124 -24
  609. package/src/renderer/shared/components/{GitBranchSelector.tsx → workspace/GitBranchSelector.tsx} +80 -24
  610. package/src/renderer/shared/components/workspace/SessionSources.tsx +113 -0
  611. package/src/renderer/shared/components/{TerminalDock.tsx → workspace/TerminalDock.tsx} +5 -2
  612. package/src/renderer/shared/components/workspace/ToolSurfacePage.test.tsx +81 -0
  613. package/src/renderer/shared/components/{ToolSurfacePage.tsx → workspace/ToolSurfacePage.tsx} +361 -90
  614. package/src/renderer/shared/components/{ToolsPanelToggle.tsx → workspace/ToolsPanelToggle.tsx} +1 -1
  615. package/src/renderer/shared/components/workspace/WorkspaceFileInfo.tsx +28 -0
  616. package/src/renderer/shared/components/workspace/WorkspaceMediaPreview.tsx +17 -0
  617. package/src/renderer/shared/components/{WorkspacePaneResizer.tsx → workspace/WorkspacePaneResizer.tsx} +1 -1
  618. package/src/renderer/shared/components/workspace/WorkspacePdfPreview.tsx +308 -0
  619. package/src/renderer/shared/components/workspace/WorkspacePreviewActions.test.tsx +101 -0
  620. package/src/renderer/shared/components/{WorkspacePreviewActions.tsx → workspace/WorkspacePreviewActions.tsx} +3 -3
  621. package/src/renderer/shared/components/{WorkspaceSelector.tsx → workspace/WorkspaceSelector.tsx} +99 -7
  622. package/src/renderer/shared/components/{background-terminals.css → workspace/background-terminals.css} +11 -11
  623. package/src/renderer/shared/components/{workspace-selector.css → workspace/workspace-selector.css} +84 -2
  624. package/src/renderer/shared/constants/config.ts +6 -3
  625. package/src/renderer/shared/constants/models.test.ts +51 -0
  626. package/src/renderer/shared/constants/models.ts +139 -32
  627. package/src/renderer/shared/conversation/coordinator.test.ts +46 -0
  628. package/src/renderer/shared/conversation/coordinator.ts +50 -2
  629. package/src/renderer/shared/conversation/lifecycle.test.ts +254 -4
  630. package/src/renderer/shared/conversation/lifecycle.ts +268 -12
  631. package/src/renderer/shared/conversation/progressiveStream.test.ts +83 -0
  632. package/src/renderer/shared/conversation/progressiveStream.ts +219 -0
  633. package/src/renderer/shared/conversation/projectNavigation.test.ts +18 -0
  634. package/src/renderer/shared/conversation/projectNavigation.ts +11 -0
  635. package/src/renderer/shared/conversation/transport.test.ts +20 -0
  636. package/src/renderer/shared/conversation/transport.ts +51 -9
  637. package/src/renderer/shared/conversation/useConversationCoordinator.ts +42 -12
  638. package/src/renderer/shared/css/agent-observability.css +205 -11
  639. package/src/renderer/shared/css/chat-ui-cards.css +48 -48
  640. package/src/renderer/shared/css/code-review.css +139 -110
  641. package/src/renderer/shared/css/code-sessions.css +56 -27
  642. package/src/renderer/shared/css/collapsed-paste.css +1 -1
  643. package/src/renderer/shared/css/error-notice.css +1 -1
  644. package/src/renderer/shared/css/file-changes.css +298 -51
  645. package/src/renderer/shared/css/library.css +105 -10
  646. package/src/renderer/shared/css/management-views.css +79 -38
  647. package/src/renderer/shared/css/mcp-results.css +48 -5
  648. package/src/renderer/shared/css/model-selector.css +18 -18
  649. package/src/renderer/shared/css/mods.css +7 -7
  650. package/src/renderer/shared/css/notification-notice.css +2 -2
  651. package/src/renderer/shared/css/queued-messages.css +221 -0
  652. package/src/renderer/shared/css/session-sources.css +12 -7
  653. package/src/renderer/shared/css/settings/agents.css +2 -2
  654. package/src/renderer/{src → shared}/css/settings/base.css +101 -107
  655. package/src/renderer/shared/css/settings/general.css +397 -100
  656. package/src/renderer/shared/css/settings/plugins.css +8 -8
  657. package/src/renderer/shared/css/settings/profile.css +5 -5
  658. package/src/renderer/shared/css/settings/theme.css +49 -37
  659. package/src/renderer/shared/css/slash-choice.css +2 -2
  660. package/src/renderer/shared/css/slash-suggestions.css +3 -3
  661. package/src/renderer/shared/css/sources-block.css +41 -2
  662. package/src/renderer/shared/css/tools-panel.css +2 -2
  663. package/src/renderer/shared/css/ui-tailwind.css +10 -2
  664. package/src/renderer/shared/css/veo-studio.css +2 -2
  665. package/src/renderer/shared/css/viewed-images.css +93 -4
  666. package/src/renderer/shared/css/workspace-file-info.css +12 -0
  667. package/src/renderer/shared/css/workspace-media-preview.css +13 -0
  668. package/src/renderer/shared/env.d.ts +9 -0
  669. package/src/renderer/shared/platform.test.ts +143 -0
  670. package/src/renderer/shared/platform.ts +12 -5
  671. package/src/renderer/shared/speech/player.ts +160 -0
  672. package/src/renderer/shared/speech/types.ts +11 -0
  673. package/src/renderer/shared/theme/themeManager.test.ts +37 -0
  674. package/src/renderer/shared/theme/themeManager.ts +24 -5
  675. package/src/renderer/shared/theme/themes.ts +71 -4
  676. package/src/renderer/shared/theme/tokens.css +452 -53
  677. package/src/renderer/shared/types.ts +57 -2
  678. package/src/renderer/shared/utils/agentActivity.test.ts +633 -8
  679. package/src/renderer/shared/utils/agentActivity.ts +776 -59
  680. package/src/renderer/shared/utils/artifactBrowser.test.ts +37 -32
  681. package/src/renderer/shared/utils/artifactBrowser.ts +18 -20
  682. package/src/renderer/shared/utils/artifacts.ts +55 -0
  683. package/src/renderer/shared/utils/attachedDocument.test.ts +73 -0
  684. package/src/renderer/shared/utils/attachedDocument.ts +49 -0
  685. package/src/renderer/shared/utils/contextCompaction.test.tsx +1 -1
  686. package/src/renderer/shared/utils/externalLinks.ts +91 -0
  687. package/src/renderer/shared/utils/fileIcons.test.ts +59 -0
  688. package/src/renderer/shared/utils/fileIcons.ts +149 -16
  689. package/src/renderer/shared/utils/lazyWithRetry.ts +13 -0
  690. package/src/renderer/shared/utils/markdown.tsx +238 -51
  691. package/src/renderer/shared/utils/markdown.webImages.test.tsx +140 -2
  692. package/src/renderer/shared/utils/mcpResults.test.tsx +53 -1
  693. package/src/renderer/shared/utils/pdfRange.ts +16 -0
  694. package/src/renderer/shared/utils/previewObjectUrls.ts +20 -0
  695. package/src/renderer/shared/utils/sessionSources.test.ts +41 -1
  696. package/src/renderer/shared/utils/sessionSources.ts +2 -0
  697. package/src/renderer/shared/utils/slashCommandProcessor.ts +7 -1
  698. package/src/renderer/shared/utils/speech.ts +18 -4
  699. package/src/renderer/shared/utils/syntaxHighlight.test.tsx +11 -1
  700. package/src/renderer/shared/utils/syntaxHighlight.tsx +51 -3
  701. package/src/renderer/shared/utils/useGeminiLiveVoice.ts +324 -51
  702. package/src/renderer/shared/utils/useNativeVoiceInput.ts +19 -5
  703. package/src/renderer/shared/utils/useSessionSources.ts +4 -0
  704. package/src/renderer/shared/utils/viewedImages.test.ts +129 -0
  705. package/src/renderer/shared/utils/viewedImages.ts +81 -10
  706. package/src/renderer/shared/utils/workspaceDrag.test.ts +153 -0
  707. package/src/renderer/shared/utils/workspaceDrag.ts +172 -0
  708. package/src/renderer/shared/utils/workspaceImage.ts +17 -0
  709. package/src/renderer/shared/utils/workspaceListPreferences.test.ts +64 -0
  710. package/src/renderer/shared/utils/workspaceListPreferences.ts +54 -0
  711. package/src/renderer/shared/utils/workspaceMedia.ts +49 -0
  712. package/src/renderer/shared/utils/workspacePreview.test.ts +147 -2
  713. package/src/renderer/shared/utils/workspacePreview.ts +34 -3
  714. package/src/renderer/shared/utils/workspaces.ts +3 -2
  715. package/src/renderer/src/App.tsx +20 -16
  716. package/src/renderer/src/agentProgress.ts +1 -0
  717. package/src/renderer/src/components/ChatPanel.tsx +1 -1
  718. package/src/renderer/src/components/DashboardSidebar.tsx +2 -2
  719. package/src/renderer/src/components/ImageStudioPanel.tsx +1 -1
  720. package/src/renderer/src/components/LiveTranslateControls.tsx +1 -1
  721. package/src/renderer/src/components/MintDashboard.tsx +1 -1
  722. package/src/renderer/src/components/ProactiveGlow.tsx +1 -1
  723. package/src/renderer/src/components/ScreenPicker.css +1 -1
  724. package/src/renderer/src/components/ScreenPicker.tsx +1 -1
  725. package/src/renderer/src/components/SettingsWindow.tsx +6 -830
  726. package/src/renderer/src/components/SpotlightWindow.tsx +4 -32
  727. package/src/renderer/src/components/VeoStudioPanel.tsx +1 -1
  728. package/src/renderer/src/components/WorkspacePanel.tsx +49 -15
  729. package/src/renderer/src/components/browser-suggestions-popup.css +8 -8
  730. package/src/renderer/src/css/app-shell.css +26 -106
  731. package/src/renderer/src/css/chat.css +1499 -292
  732. package/src/renderer/src/css/desktop-tools.css +17 -348
  733. package/src/renderer/src/css/sidebar-workspace.css +22 -2
  734. package/src/renderer/src/css/spotlight.css +2 -2
  735. package/src/renderer/src/css/tool-surfaces.css +335 -65
  736. package/src/renderer/src/css/widget.css +6 -5
  737. package/src/renderer/src/env.d.ts +13 -0
  738. package/src/renderer/src/index.css +53 -83
  739. package/src/renderer/src/tauri.ts +99 -13
  740. package/src/renderer/src/voiceInput.ts +3 -1
  741. package/src/renderer/src-web/App.tsx +20 -8
  742. package/src/renderer/src-web/agentProgress.ts +1 -0
  743. package/src/renderer/src-web/components/ChatPanel.tsx +1 -1
  744. package/src/renderer/src-web/components/DashboardSidebar.tsx +2 -2
  745. package/src/renderer/src-web/components/ImageStudioPanel.tsx +1 -1
  746. package/src/renderer/src-web/components/MintDashboard.tsx +1 -1
  747. package/src/renderer/src-web/components/SettingsWindow.tsx +6 -851
  748. package/src/renderer/src-web/components/VeoStudioPanel.tsx +1 -1
  749. package/src/renderer/src-web/css/app-shell.css +20 -104
  750. package/src/renderer/src-web/css/chat.css +1536 -261
  751. package/src/renderer/src-web/css/mobile.css +29 -13
  752. package/src/renderer/src-web/css/settings/mobile.css +2 -2
  753. package/src/renderer/src-web/css/sidebar-workspace.css +21 -1
  754. package/src/renderer/src-web/env.d.ts +14 -0
  755. package/src/renderer/src-web/index.css +53 -83
  756. package/src/renderer/src-web/tauri.ts +93 -15
  757. package/src/renderer/tests/browserArtifacts.browser.html +1 -0
  758. package/src/renderer/tests/browserArtifacts.browser.tsx +68 -0
  759. package/src/renderer/tests/chatEscape.browser.html +1 -0
  760. package/src/renderer/tests/chatEscape.browser.tsx +25 -0
  761. package/src/renderer/tests/chatPerformance.browser.html +1 -1
  762. package/src/renderer/tests/collapsedPaste.browser.html +1 -1
  763. package/src/renderer/tests/composerMenus.browser.html +3 -3
  764. package/src/renderer/tests/contextCompaction.browser.html +1 -1
  765. package/src/renderer/tests/errorRecovery.browser.html +1 -1
  766. package/src/renderer/tests/fixtures/preview.webm +0 -0
  767. package/src/renderer/tests/glideSelect.browser.html +1 -2
  768. package/src/renderer/tests/glideSelect.preview.html +1 -1
  769. package/src/renderer/tests/library.browser.tsx +4 -1
  770. package/src/renderer/tests/liveOrb.browser.html +1 -1
  771. package/src/renderer/tests/liveVoice.browser.html +1 -0
  772. package/src/renderer/tests/mediaFixtures.ts +32 -0
  773. package/src/renderer/tests/modInput.browser.html +1 -1
  774. package/src/renderer/tests/sessionSources.browser.tsx +76 -15
  775. package/src/renderer/tests/toolsPanel.browser.tsx +5 -5
  776. package/src/renderer/tests/viewedImages.browser.tsx +3 -3
  777. package/src/renderer/tests/voiceDictation.browser.html +101 -0
  778. package/src/renderer/tests/voicePill.browser.html +3 -3
  779. package/src/renderer/tests/voicePill.preview.html +1 -1
  780. package/src/renderer/tests/webSources.browser.tsx +2 -98
  781. package/src/renderer/tests/workspaceDrop.browser.html +1 -0
  782. package/src/renderer/tests/workspaceDrop.browser.tsx +183 -0
  783. package/src/renderer/tests/workspaceExpansion.browser.html +1 -0
  784. package/src/renderer/tests/workspaceExpansion.browser.tsx +66 -0
  785. package/src/renderer/tests/workspaceRemoval.browser.html +66 -0
  786. package/src/renderer/tests/workspaceUndo.browser.html +10 -2
  787. package/src-tauri/src/app/lifecycle.rs +45 -15
  788. package/src-tauri/src/background/headless.rs +14 -8
  789. package/src-tauri/src/commands/conversation.rs +137 -73
  790. package/src-tauri/src/commands/integrations.rs +7 -1
  791. package/src-tauri/src/commands/media.rs +7 -0
  792. package/src-tauri/src/commands/workspace.rs +38 -0
  793. package/src-tauri/src/native/mod.rs +0 -1
  794. package/src-tauri/src/native/system.rs +4 -47
  795. package/tsconfig.json +15 -1
  796. package/vite.config.ts +2 -1
  797. package/vite.config.web.ts +2 -0
  798. package/crates/mint-cli/src/interactive/chat_tui.rs +0 -7853
  799. package/crates/mint-core/src/agent/chat.rs +0 -4155
  800. package/crates/mint-core/src/browser/lifecycle.rs +0 -191
  801. package/crates/mint-core/src/browser/logging.rs +0 -20
  802. package/crates/mint-core/src/orchestration/tools/browser.rs +0 -31
  803. package/out/web/assets/CliSessionsView-CtzUJpK_.css +0 -1
  804. package/out/web/assets/CliSessionsView-D7hw0Mgj.js +0 -1
  805. package/out/web/assets/CodeReviewPage-C7bEOJfd.js +0 -4
  806. package/out/web/assets/CodeReviewPage-Dte9uLiL.css +0 -1
  807. package/out/web/assets/CommandPalette-0RrF-AOT.js +0 -1
  808. package/out/web/assets/ImageStudioPanel-CdxkAf_r.js +0 -1
  809. package/out/web/assets/LibraryPage--Qfisp6D.js +0 -2
  810. package/out/web/assets/LibraryPage-DAxUTAg7.css +0 -1
  811. package/out/web/assets/LinkedFoldersView-2nfZbDgN.js +0 -1
  812. package/out/web/assets/McpRegistryPicker-h9uS8_wT.js +0 -1
  813. package/out/web/assets/McpServersView-slfQJzNB.js +0 -1
  814. package/out/web/assets/MintDashboard-BSR5XpXh.js +0 -25
  815. package/out/web/assets/MintDashboard-CWUcCGhd.css +0 -1
  816. package/out/web/assets/PluginsView-l7LSm503.js +0 -1
  817. package/out/web/assets/ScheduledTasksView-CttmLbq1.js +0 -1
  818. package/out/web/assets/SettingsWindow-BCMLYvEV.js +0 -4
  819. package/out/web/assets/SettingsWindow-DcMVmU9u.css +0 -1
  820. package/out/web/assets/SkillsView-rNs1qr_U.js +0 -2
  821. package/out/web/assets/ToolSurfacePage-B9DzEPWN.js +0 -37
  822. package/out/web/assets/ToolSurfacePage-CTfgggF2.css +0 -1
  823. package/out/web/assets/VeoStudioPanel-DiJs_Cg2.js +0 -4
  824. package/out/web/assets/WorkspacePanel-CbJ1PFoZ.js +0 -1
  825. package/out/web/assets/WorkspaceSelector-B2xIp04D.js +0 -1
  826. package/out/web/assets/WorkspaceSelector-Ca8uJOsS.css +0 -1
  827. package/out/web/assets/abnfDiagram-VCTEODGH-CD0CjoGl.js +0 -1
  828. package/out/web/assets/architecture-7GRP2DOG-RKV83OeZ.js +0 -1
  829. package/out/web/assets/architectureDiagram-5GKGNRK7-nN_HAFct.js +0 -36
  830. package/out/web/assets/c4Diagram-UCG6FXSJ-DTdV8_zE.js +0 -38
  831. package/out/web/assets/chunk-2Q5K7J3B-Dmqrq8Tp.js +0 -1
  832. package/out/web/assets/chunk-75Z2AOVW-_M0z5olV.js +0 -2
  833. package/out/web/assets/chunk-CKBBP62Z-BpQEgeHF.js +0 -2
  834. package/out/web/assets/chunk-CLGD4ZFX-D54yGvGS.js +0 -1
  835. package/out/web/assets/chunk-CacB07dV.js +0 -1
  836. package/out/web/assets/chunk-DSNCTWBM-C-gvT2ru.js +0 -2
  837. package/out/web/assets/chunk-DU6HZSFF-CnFngIhW.js +0 -128
  838. package/out/web/assets/chunk-F27PBJKO-BqtWrnEO.js +0 -1
  839. package/out/web/assets/chunk-FOHPRMQF-BaVC1uA7.js +0 -161
  840. package/out/web/assets/chunk-G27WJ6UU-Ckoq5mi2.js +0 -231
  841. package/out/web/assets/chunk-JQ64N6SF-CF8T7GiZ.js +0 -1
  842. package/out/web/assets/chunk-JWPE2WC7-BwtYOHqU.js +0 -1
  843. package/out/web/assets/chunk-LNGE3PJU-AdBoOWw2.js +0 -34
  844. package/out/web/assets/chunk-OBVCFTLP-CRIkunUB.js +0 -1
  845. package/out/web/assets/chunk-P2QGCYS3-UFEU6BxZ.js +0 -1
  846. package/out/web/assets/chunk-POPQ4Y6H-CQcrNbjr.js +0 -1
  847. package/out/web/assets/chunk-PWAF6VOD-Cc2uVDsG.js +0 -1
  848. package/out/web/assets/chunk-R7TYR2AO-DiCxzdAY.js +0 -10
  849. package/out/web/assets/chunk-RHFEMEQ7-b7hnPmrR.js +0 -168
  850. package/out/web/assets/chunk-XXDRQBXY-DnJkbUaw.js +0 -1
  851. package/out/web/assets/chunk-Y2CYZVJY-C9o-s6OY.js +0 -1
  852. package/out/web/assets/classDiagram-DTDB5LWJ-RnC2mYO4.js +0 -1
  853. package/out/web/assets/classDiagram-v2-JRS7N3AN-RnC2mYO4.js +0 -1
  854. package/out/web/assets/config-CnvCChUM.js +0 -2
  855. package/out/web/assets/config-DM6oIVO3.css +0 -1
  856. package/out/web/assets/core-DsKkQ7ig.js +0 -1
  857. package/out/web/assets/cose-bilkent-JH36ORCC--UN4aw5-.js +0 -1
  858. package/out/web/assets/cynefin-OW5HDTMX-CnzQfOGp.js +0 -1
  859. package/out/web/assets/cynefinDiagram-5FMLGOSQ-DVtQnfpm.js +0 -62
  860. package/out/web/assets/cytoscape.esm-Df1UN4Y1.js +0 -321
  861. package/out/web/assets/dagre-3AP2YEHR-DG76_k5_.js +0 -4
  862. package/out/web/assets/dagre-BWadQu2F.js +0 -1
  863. package/out/web/assets/diagram-S7CK7UJ4-CaouUoze.js +0 -30
  864. package/out/web/assets/diagram-UQ7AKVKN-B4bEc26B.js +0 -41
  865. package/out/web/assets/diagram-VX7I27RA-7hH5IPYf.js +0 -24
  866. package/out/web/assets/diagram-Z3DM3KII-CCM4clo8.js +0 -24
  867. package/out/web/assets/dist-BoTOASLF.js +0 -1
  868. package/out/web/assets/dist-js-BkYNznHX.js +0 -1
  869. package/out/web/assets/ebnfDiagram-PWID7BFC-Da7WAM3k.js +0 -1
  870. package/out/web/assets/event-Cdt7Byyj.js +0 -1
  871. package/out/web/assets/eventmodeling-NTZA5JFV-xcfsA0XD.js +0 -1
  872. package/out/web/assets/flowDiagram-A5DVABFB-JdtH1673.js +0 -1
  873. package/out/web/assets/ganttDiagram-EL5Y4UJY-B3ClFGmL.js +0 -292
  874. package/out/web/assets/gitGraph-4MIJSDKK-BZ_y_cDU.js +0 -1
  875. package/out/web/assets/gitGraphDiagram-WWUBYQGX-drhRSYm3.js +0 -106
  876. package/out/web/assets/graphlib-CTR5ZhLf.js +0 -1
  877. package/out/web/assets/index-BZ9xgmMP.css +0 -1
  878. package/out/web/assets/index-Ca8cCS4h.js +0 -168
  879. package/out/web/assets/info-A6RAGUB7-B7I3K0F1.js +0 -1
  880. package/out/web/assets/infoDiagram-RXCK75RN-deX_1MPh.js +0 -2
  881. package/out/web/assets/journeyDiagram-EYS64GPL-CZn2kB8b.js +0 -139
  882. package/out/web/assets/jsx-runtime-DN4NhQUK.js +0 -1
  883. package/out/web/assets/katex-O3jvqgnU.js +0 -257
  884. package/out/web/assets/markdown-CMhYIcWB.js +0 -39
  885. package/out/web/assets/mermaid-parser.core-Whu2rlJC.js +0 -7
  886. package/out/web/assets/mermaid.core-CKyPo8VH.js +0 -11
  887. package/out/web/assets/modelManager-CUaGWMWu.js +0 -2
  888. package/out/web/assets/oauthManager-DlNhXJr6.js +0 -1
  889. package/out/web/assets/packet-AYTQ26CC-CEeIRKRG.js +0 -1
  890. package/out/web/assets/pegDiagram-XKGWAZYB-BYadI-KO.js +0 -1
  891. package/out/web/assets/pie-WAS4IAKB-D8uf4dh5.js +0 -1
  892. package/out/web/assets/pieDiagram-E7YTZNPT-CjSDy4hO.js +0 -39
  893. package/out/web/assets/radar-RG4KPBEZ-DZJxnokY.js +0 -1
  894. package/out/web/assets/railroad-74A4TZTK-DBysUiUi.js +0 -1
  895. package/out/web/assets/railroad-abnf-HS5TGJTU-CHWxoJYg.js +0 -1
  896. package/out/web/assets/railroad-ebnf-LZEXJU2U-DDv7X6bY.js +0 -1
  897. package/out/web/assets/railroad-peg-WCYAUIDC-DpfcYYNJ.js +0 -1
  898. package/out/web/assets/railroadDiagram-O6MQD6OU-CYtyv0t3.js +0 -1
  899. package/out/web/assets/rough.esm-DFbTUy8a.js +0 -1
  900. package/out/web/assets/sankeyDiagram-P5KCCOFB-Bn2x6C4Y.js +0 -40
  901. package/out/web/assets/sequenceDiagram-WJ2MYXX4-BvFLKtPd.js +0 -162
  902. package/out/web/assets/sizeCapture-X5ZJPWSS-DKeOCaN2.js +0 -1
  903. package/out/web/assets/src-DnfeXQPr.js +0 -1
  904. package/out/web/assets/stateDiagram-HBIQ2CUA-Bx0GWeaY.js +0 -1
  905. package/out/web/assets/stateDiagram-v2-4QOOHH4V--hol1yg_.js +0 -1
  906. package/out/web/assets/studio-B1mk40wD.js +0 -1
  907. package/out/web/assets/swimlanes-XN3QIQJK-CCma0T7L.js +0 -1
  908. package/out/web/assets/swimlanesDiagram-VK2B7HYN-BkohoVsU.js +0 -8
  909. package/out/web/assets/timeline-definition-24CTP7MA-iCRhhJ7C.js +0 -120
  910. package/out/web/assets/treeView-Q6P3EWNA-DZ-y08qp.js +0 -1
  911. package/out/web/assets/treemap-WGGIJYW6-De0CxzMx.js +0 -1
  912. package/out/web/assets/vennDiagram-4TSXK5OY-w_7aZ6xe.js +0 -34
  913. package/out/web/assets/wardley-WFR3VGLG-DT0y0xJ4.js +0 -1
  914. package/out/web/assets/window-BJCVtyET.js +0 -1
  915. package/shared-modules/libsecret/libsecret.json +0 -23
  916. package/shared-modules/libusb/libusb.json +0 -27
  917. package/shared-modules/lzo/lzo.json +0 -27
  918. package/src/renderer/shared/components/AgentActivityDrawer.tsx +0 -204
  919. package/src/renderer/shared/components/AgentActivityTable.tsx +0 -301
  920. package/src/renderer/shared/components/ChatMessageItem.test.tsx +0 -68
  921. package/src/renderer/shared/components/ChatMessageItem.tsx +0 -326
  922. package/src/renderer/shared/components/ChatPanel.test.tsx +0 -21
  923. package/src/renderer/shared/components/FormattedMessage.tsx +0 -11
  924. package/src/renderer/shared/components/GeminiLiveOverlay.test.tsx +0 -24
  925. package/src/renderer/shared/components/GlideSelect.d.ts +0 -31
  926. package/src/renderer/shared/components/GlideSelect.jsx +0 -266
  927. package/src/renderer/shared/components/InlineThoughtNote.tsx +0 -27
  928. package/src/renderer/shared/components/ModSessionControls.tsx +0 -8
  929. package/src/renderer/shared/components/ModUi.tsx +0 -26
  930. package/src/renderer/shared/components/ProgressActivity.tsx +0 -17
  931. package/src/renderer/shared/components/ReviewHistory.tsx +0 -42
  932. package/src/renderer/shared/components/RunSummaryDashboard.tsx +0 -143
  933. package/src/renderer/shared/components/SelectField.tsx +0 -38
  934. package/src/renderer/shared/components/SessionSources.tsx +0 -48
  935. package/src/renderer/shared/components/SessionSourcesPopover.tsx +0 -61
  936. package/src/renderer/shared/components/ToolSurfacePage.test.tsx +0 -32
  937. package/src/renderer/shared/components/ViewedImages.tsx +0 -36
  938. package/src/renderer/shared/components/WorkspaceContextPopover.tsx +0 -138
  939. package/src/renderer/shared/components/WorkspacePreviewActions.test.tsx +0 -44
  940. package/src/renderer/shared/components/ui/demo.tsx +0 -26
  941. package/src/renderer/shared/css/session-sources-popover.css +0 -9
  942. package/src/renderer/src/components/BrowserShell.tsx +0 -108
  943. package/src/renderer/src/components/BrowserSuggestionsPopup.tsx +0 -91
  944. package/src/renderer/src/components/CalculationCard.tsx +0 -3
  945. package/src/renderer/src/components/ImageGenCard.tsx +0 -2
  946. package/src/renderer/src/components/ImageSearchCard.tsx +0 -2
  947. package/src/renderer/src/components/MermaidCard.tsx +0 -1
  948. package/src/renderer/src/components/PicturesLibrary.tsx +0 -2
  949. package/src/renderer/src/components/Settings/AgentsTab.tsx +0 -4
  950. package/src/renderer/src/components/Settings/AudioTab.tsx +0 -3
  951. package/src/renderer/src/components/Settings/AutomationTab.tsx +0 -3
  952. package/src/renderer/src/components/Settings/GeneralTab.tsx +0 -3
  953. package/src/renderer/src/components/Settings/MemoryTab.tsx +0 -3
  954. package/src/renderer/src/components/Settings/PluginsTab.tsx +0 -3
  955. package/src/renderer/src/components/Settings/ProfileTab.tsx +0 -3
  956. package/src/renderer/src/components/Settings/ShortcutsTab.tsx +0 -3
  957. package/src/renderer/src/components/Settings/ThemeTab.tsx +0 -3
  958. package/src/renderer/src/components/StockCard.tsx +0 -3
  959. package/src/renderer/src/components/WeatherCard.tsx +0 -3
  960. package/src/renderer/src/components/browser-shell.css +0 -185
  961. package/src/renderer/src/css/pictures.css +0 -2
  962. package/src/renderer/src-web/components/PicturesLibrary.tsx +0 -2
  963. package/src/renderer/src-web/components/Settings/AgentsTab.tsx +0 -4
  964. package/src/renderer/src-web/components/Settings/AudioTab.tsx +0 -3
  965. package/src/renderer/src-web/components/Settings/AutomationTab.tsx +0 -3
  966. package/src/renderer/src-web/components/Settings/GeneralTab.tsx +0 -3
  967. package/src/renderer/src-web/components/Settings/MemoryTab.tsx +0 -3
  968. package/src/renderer/src-web/components/Settings/PluginsTab.tsx +0 -3
  969. package/src/renderer/src-web/components/Settings/ProfileTab.tsx +0 -3
  970. package/src/renderer/src-web/components/Settings/ShortcutsTab.tsx +0 -3
  971. package/src/renderer/src-web/components/Settings/ThemeTab.tsx +0 -3
  972. package/src/renderer/src-web/css/pictures.css +0 -2
  973. package/src/renderer/src-web/css/settings/base.css +0 -1266
  974. package/src/renderer/src-web/css/spotlight.css +0 -102
  975. package/src/renderer/src-web/css/widget.css +0 -213
  976. package/src-tauri/src/native/browser.rs +0 -252
  977. /package/src/renderer/shared/components/{ContextCompactionStatus.tsx → chat/ContextCompactionStatus.tsx} +0 -0
  978. /package/src/renderer/shared/components/{GeminiLiveOverlay.css → chat/GeminiLiveOverlay.css} +0 -0
  979. /package/src/renderer/shared/components/{VirtualChatHistory.tsx → chat/VirtualChatHistory.tsx} +0 -0
  980. /package/src/renderer/shared/components/{VoicePill.d.ts → chat/VoicePill.d.ts} +0 -0
  981. /package/src/renderer/shared/components/{VoicePill.test.tsx → chat/VoicePill.test.tsx} +0 -0
  982. /package/src/renderer/shared/components/{ScreenCaptureDialog.css → studio/ScreenCaptureDialog.css} +0 -0
  983. /package/src/renderer/shared/components/{ScreenCaptureDialog.tsx → studio/ScreenCaptureDialog.tsx} +0 -0
  984. /package/src/renderer/shared/components/{SelectField.test.tsx → ui/SelectField.test.tsx} +0 -0
@@ -0,0 +1,1665 @@
1
+ use super::*;
2
+ use crate::config::AgentConfig;
3
+
4
+ #[test]
5
+ fn stringified_patch_uses_explicit_outer_target() {
6
+ let patch = serde_json::json!({"hunks": [{"oldText": "old", "newText": "new"}]}).to_string();
7
+ let input = parse_tool_input(
8
+ "apply_patch",
9
+ serde_json::json!({"path": "style.css", "patch": patch}),
10
+ )
11
+ .unwrap();
12
+ let patch = input.patch.unwrap();
13
+ assert_eq!(patch.path, PathBuf::from("style.css"));
14
+ assert_eq!(patch.hunks.len(), 1);
15
+ }
16
+
17
+ #[tokio::test]
18
+ async fn stringified_patch_executes_only_after_approval_and_can_be_undone() {
19
+ let root = std::env::temp_dir().join(format!("mint-patch-repro-{}", uuid::Uuid::new_v4()));
20
+ std::fs::create_dir_all(&root).unwrap();
21
+ std::fs::write(root.join("style.css"), "body { color: black; }").unwrap();
22
+ let config = MintConfig {
23
+ allowed_read_paths: vec![root.clone()],
24
+ allowed_write_paths: vec![root.clone()],
25
+ blocked_paths: vec![],
26
+ blocked_file_names: vec![],
27
+ ..MintConfig::default()
28
+ };
29
+ let input = serde_json::json!({"path": "style.css", "patch": serde_json::json!({"hunks": [{"oldText": "black", "newText": "orange"}]}).to_string()});
30
+ execute_tool_from_json(
31
+ &root,
32
+ &config,
33
+ "apply_patch",
34
+ input.clone(),
35
+ "patch-repro",
36
+ &mut |_| Ok(ApprovalOutcome::Denied),
37
+ )
38
+ .await
39
+ .unwrap();
40
+ assert_eq!(
41
+ std::fs::read_to_string(root.join("style.css")).unwrap(),
42
+ "body { color: black; }"
43
+ );
44
+ execute_tool_from_json(
45
+ &root,
46
+ &config,
47
+ "apply_patch",
48
+ input,
49
+ "patch-repro",
50
+ &mut |_| Ok(ApprovalOutcome::Approved),
51
+ )
52
+ .await
53
+ .unwrap();
54
+ assert_eq!(
55
+ std::fs::read_to_string(root.join("style.css")).unwrap(),
56
+ "body { color: orange; }"
57
+ );
58
+ crate::system::workspace_history::undo(&root, None).unwrap();
59
+ assert_eq!(
60
+ std::fs::read_to_string(root.join("style.css")).unwrap(),
61
+ "body { color: black; }"
62
+ );
63
+ std::fs::remove_dir_all(root).unwrap();
64
+ }
65
+
66
+ #[test]
67
+ fn patch_decoding_preserves_strict_types_and_rejects_ambiguous_targets() {
68
+ let patch =
69
+ serde_json::json!({"path": "style.css", "hunks": [{"oldText": "old", "newText": "new"}]});
70
+ assert!(parse_tool_input("apply_patch", serde_json::json!({"patch": patch})).is_ok());
71
+ assert!(
72
+ parse_tool_input(
73
+ "apply_patch",
74
+ serde_json::json!({"path": "other.css", "patch": patch.to_string()})
75
+ )
76
+ .is_err()
77
+ );
78
+ assert!(
79
+ parse_tool_input(
80
+ "apply_patch",
81
+ serde_json::json!({"patch": "{\"hunks\": []}"})
82
+ )
83
+ .is_err()
84
+ );
85
+ assert!(parse_tool_input("apply_patch", serde_json::json!({"patch": "not JSON"})).is_err());
86
+ assert!(parse_tool_input("list_files", serde_json::json!({"limit": "100"})).is_err());
87
+ let huge = "private-code-marker".repeat(1000);
88
+ let error = parse_tool_input(
89
+ "apply_patch",
90
+ serde_json::json!({"patch": {"path": "style.css", "hunks": huge}}),
91
+ )
92
+ .unwrap_err()
93
+ .to_string();
94
+ assert!(error.len() < 600);
95
+ assert!(!error.contains("private-code-marker"));
96
+ let decision: AgentDecision = serde_json::from_value(serde_json::json!({"action": "apply_patch", "input": {"path": "style.css", "patch": serde_json::json!({"hunks": [{"oldText": "old", "newText": "new"}]}).to_string()}})).unwrap();
97
+ assert_eq!(
98
+ decision.input.patch.unwrap().path,
99
+ PathBuf::from("style.css")
100
+ );
101
+ }
102
+
103
+ fn test_list_call(id: &str, input: Value) -> crate::chat::ToolCall {
104
+ crate::chat::ToolCall {
105
+ id: id.into(),
106
+ name: "list_files".into(),
107
+ input,
108
+ thought_signature: Some("signature".into()),
109
+ }
110
+ }
111
+
112
+ #[tokio::test]
113
+ async fn native_argument_error_is_returned_and_corrected_call_can_execute() {
114
+ let raw = serde_json::json!({"path": "Downloads/YOUTUBE_DL/playlist", "limit": "100"});
115
+ let mut count = ToolArgumentRetries::default();
116
+ let (decisions, errors) =
117
+ prepare_native_tool_calls(vec![test_list_call("bad", raw.clone())], "", &mut count)
118
+ .unwrap();
119
+ assert!(decisions.is_empty());
120
+ assert_eq!(errors.len(), 1);
121
+ let mut messages = Vec::new();
122
+ let signatures = std::collections::HashMap::from([("bad".into(), "signature".into())]);
123
+ append_native_tool_results(&mut messages, "", &errors, &signatures, &Default::default());
124
+ assert!(
125
+ matches!(&messages[0].content[0], ContentBlock::ToolUse { id, input, thought_signature, .. }
126
+ if id == "bad" && input == &raw && thought_signature.as_deref() == Some("signature"))
127
+ );
128
+ assert!(
129
+ matches!(&messages[1].content[0], ContentBlock::ToolResult { tool_use_id, content, is_error }
130
+ if tool_use_id == "bad" && *is_error && content.contains("Correct the arguments"))
131
+ );
132
+
133
+ let root = std::env::temp_dir().join(format!("mint-tool-recovery-{}", uuid::Uuid::new_v4()));
134
+ let nested = root.join("Downloads/YOUTUBE_DL/playlist");
135
+ std::fs::create_dir_all(&nested).unwrap();
136
+ std::fs::write(nested.join("song.txt"), "song").unwrap();
137
+ let config = MintConfig {
138
+ allowed_read_paths: vec![root.clone()],
139
+ blocked_paths: vec![],
140
+ blocked_file_names: vec![],
141
+ ..MintConfig::default()
142
+ };
143
+ let (decisions, errors) = prepare_native_tool_calls(
144
+ vec![test_list_call(
145
+ "fixed",
146
+ serde_json::json!({"path": "Downloads/YOUTUBE_DL/playlist", "limit": 100}),
147
+ )],
148
+ "",
149
+ &mut count,
150
+ )
151
+ .unwrap();
152
+ assert!(errors.is_empty());
153
+ let output = execute_tool(
154
+ &root,
155
+ &config,
156
+ &decisions[0].1,
157
+ "regression",
158
+ &mut |_| panic!("listing must not request approval"),
159
+ &mut |_| {},
160
+ )
161
+ .await
162
+ .unwrap();
163
+ let entries: Vec<Value> = serde_json::from_str(&output).unwrap();
164
+ assert_eq!(entries.len(), 1);
165
+ assert_eq!(
166
+ entries[0]["path"],
167
+ serde_json::json!(nested.join("song.txt"))
168
+ );
169
+ // Parsing the repaired call alone must not renew its budget.
170
+ assert_eq!(count.failures["list_files"], 1);
171
+ count.observe_completed(&[("fixed".into(), "list_files".into(), Value::Null, output).into()]);
172
+ assert!(!count.failures.contains_key("list_files"));
173
+ std::fs::remove_dir_all(root).unwrap();
174
+ }
175
+
176
+ #[test]
177
+ fn native_invalid_calls_are_bounded_without_blocking_valid_alternatives() {
178
+ let mut count = ToolArgumentRetries::default();
179
+ for _ in 0..MAX_TOOL_ARGUMENT_RETRIES {
180
+ let (decisions, errors) = prepare_native_tool_calls(
181
+ vec![test_list_call(
182
+ "bad",
183
+ serde_json::json!({"path": "~/Downloads/YOUTUBE_DL", "limit": "100"}),
184
+ )],
185
+ "",
186
+ &mut count,
187
+ )
188
+ .unwrap();
189
+ assert!(decisions.is_empty());
190
+ assert_eq!(errors.len(), 1);
191
+ }
192
+ let alternative = crate::chat::ToolCall {
193
+ id: "alternative".into(),
194
+ name: "run_shell".into(),
195
+ input: serde_json::json!({"command": "ls ~/Downloads/YOUTUBE_DL"}),
196
+ thought_signature: None,
197
+ };
198
+ let (decisions, errors) = prepare_native_tool_calls(vec![alternative], "", &mut count).unwrap();
199
+ assert_eq!(decisions[0].1.action, "run_shell");
200
+ assert!(errors.is_empty());
201
+ assert_eq!(count.failures["list_files"], MAX_TOOL_ARGUMENT_RETRIES);
202
+ let error = prepare_native_tool_calls(vec![test_list_call("bad", Value::Null)], "", &mut count)
203
+ .unwrap_err();
204
+ assert!(
205
+ error
206
+ .to_string()
207
+ .contains("exhausted its 5 argument-correction retries")
208
+ );
209
+ // One exhausted tool must not consume another tool's corrections.
210
+ let other = crate::chat::ToolCall {
211
+ id: "other-bad".into(),
212
+ name: "read_file".into(),
213
+ input: serde_json::json!({"path": 123}),
214
+ thought_signature: None,
215
+ };
216
+ let (_, errors) = prepare_native_tool_calls(vec![other], "", &mut count).unwrap();
217
+ assert_eq!(errors.len(), 1);
218
+ assert_eq!(count.failures["read_file"], 1);
219
+ for result in [
220
+ "Error: execution failed",
221
+ "Blocked by hook",
222
+ "Skipped duplicate",
223
+ ] {
224
+ count.observe_completed(&[
225
+ ("x".into(), "list_files".into(), Value::Null, result.into()).into(),
226
+ ]);
227
+ assert_eq!(count.failures["list_files"], MAX_TOOL_ARGUMENT_RETRIES);
228
+ }
229
+ count.succeeded("list_files");
230
+ assert_eq!(count.failures["read_file"], 1);
231
+ assert!(!count.failures.contains_key("list_files"));
232
+ assert!(
233
+ prepare_native_tool_calls(vec![test_list_call("fresh", Value::Null)], "", &mut count)
234
+ .is_ok()
235
+ );
236
+ }
237
+
238
+ #[test]
239
+ fn native_mixed_batch_keeps_valid_calls_and_matches_each_error_to_its_id() {
240
+ let mut count = ToolArgumentRetries::default();
241
+ let (decisions, errors) = prepare_native_tool_calls(
242
+ vec![
243
+ test_list_call("bad", Value::Null),
244
+ test_list_call("valid-1", serde_json::json!({"path": "."})),
245
+ test_list_call("valid-2", serde_json::json!({"path": "src"})),
246
+ ],
247
+ "",
248
+ &mut count,
249
+ )
250
+ .unwrap();
251
+ assert_eq!(decisions.len(), 2);
252
+ assert!(decisions_are_parallel_read_only_batch(&decisions));
253
+ assert_eq!(errors[0].call_id, "bad");
254
+ let mut results = errors;
255
+ results.extend(decisions.iter().map(|(id, d)| {
256
+ (
257
+ id.clone(),
258
+ d.action.clone(),
259
+ serde_json::to_value(&d.input).unwrap(),
260
+ "[]".into(),
261
+ )
262
+ .into()
263
+ }));
264
+ let mut messages = Vec::new();
265
+ append_native_tool_results(
266
+ &mut messages,
267
+ "",
268
+ &results,
269
+ &Default::default(),
270
+ &Default::default(),
271
+ );
272
+ assert_eq!(messages[0].content.len(), 3);
273
+ assert_eq!(messages[1].content.len(), 3);
274
+ assert!(
275
+ matches!(&messages[1].content[0], ContentBlock::ToolResult { tool_use_id, is_error: true, .. } if tool_use_id == "bad")
276
+ );
277
+ assert!(
278
+ matches!(&messages[1].content[1], ContentBlock::ToolResult { tool_use_id, is_error: false, .. } if tool_use_id == "valid-1")
279
+ );
280
+ }
281
+
282
+ #[tokio::test]
283
+ async fn list_files_rejects_invalid_arguments_instead_of_listing_workspace() {
284
+ let config = MintConfig::default();
285
+ // A nonexistent root ensures no filesystem lookup occurs for bad input.
286
+ let root = Path::new("/nonexistent-mint-list-files-regression");
287
+ for input in [
288
+ serde_json::json!({"path": "~/Downloads/YOUTUBE_DL", "limit": "100"}),
289
+ serde_json::json!({"path": "~/Downloads/YOUTUBE_DL", "limit": -1}),
290
+ serde_json::json!({"path": null}),
291
+ Value::String(r#"{"path":"~/Downloads/YOUTUBE_DL""#.into()),
292
+ Value::Null,
293
+ ] {
294
+ let error = execute_tool_from_json(
295
+ root,
296
+ &config,
297
+ "list_files",
298
+ input,
299
+ "regression",
300
+ &mut |_| panic!("invalid arguments must not request approval"),
301
+ )
302
+ .await
303
+ .unwrap_err();
304
+ assert!(
305
+ error
306
+ .to_string()
307
+ .contains("invalid arguments for tool 'list_files'")
308
+ );
309
+ }
310
+ }
311
+
312
+ #[tokio::test]
313
+ async fn list_files_preserves_nested_paths_and_default_directory() {
314
+ let root = std::env::temp_dir().join(format!("mint-list-files-paths-{}", std::process::id()));
315
+ let nested = root.join("Downloads/YOUTUBE_DL/playlist");
316
+ std::fs::create_dir_all(&nested).unwrap();
317
+ std::fs::write(nested.join("song.txt"), "song").unwrap();
318
+ let config = MintConfig {
319
+ allowed_read_paths: vec![root.clone()],
320
+ blocked_paths: vec![],
321
+ blocked_file_names: vec![],
322
+ ..MintConfig::default()
323
+ };
324
+ for input in [
325
+ serde_json::json!({"path": "Downloads/YOUTUBE_DL/playlist", "limit": 100}),
326
+ serde_json::json!({"path": nested}),
327
+ serde_json::json!({}),
328
+ ] {
329
+ let expected = if input.get("path").is_some() {
330
+ &nested
331
+ } else {
332
+ &root
333
+ };
334
+ let output = execute_tool_from_json(
335
+ &root,
336
+ &config,
337
+ "list_files",
338
+ input,
339
+ "regression",
340
+ &mut |_| panic!("listing must not request approval"),
341
+ )
342
+ .await
343
+ .unwrap();
344
+ let entries: Vec<Value> = serde_json::from_str(&output).unwrap();
345
+ assert_eq!(entries.len(), 1);
346
+ assert_eq!(
347
+ Path::new(entries[0]["path"].as_str().unwrap()).parent(),
348
+ Some(expected.as_path())
349
+ );
350
+ }
351
+ std::fs::remove_dir_all(root).unwrap();
352
+ }
353
+
354
+ #[tokio::test]
355
+ async fn turn_start_listener_reports_only_the_matching_chat() {
356
+ let memory = MemoryStore::open(std::env::temp_dir().join(format!(
357
+ "mint-turn-start-listener-{}.sqlite",
358
+ uuid::Uuid::new_v4()
359
+ )));
360
+ let reported = Arc::new(std::sync::Mutex::new(Vec::new()));
361
+ let callback_reported = reported.clone();
362
+ with_turn_start_listener(
363
+ "cli::one".to_string(),
364
+ move |id| callback_reported.lock().unwrap().push(id),
365
+ async {
366
+ let first = TurnLease::start(&memory, "cli::one", "hello")
367
+ .await
368
+ .unwrap();
369
+ let other = TurnLease::start(&memory, "cli::two", "other")
370
+ .await
371
+ .unwrap();
372
+ assert_eq!(*reported.lock().unwrap(), vec![first.id]);
373
+ drop(first);
374
+ drop(other);
375
+ },
376
+ )
377
+ .await;
378
+ }
379
+
380
+ #[test]
381
+ fn test_compact_agent_progress_cleans_deltas_and_preserves_tools() {
382
+ let events = vec![
383
+ AgentProgress::ToolStart {
384
+ call_id: None,
385
+ action: "read_file".into(),
386
+ input: serde_json::json!({ "path": "src/main.rs" }),
387
+ subagent: None,
388
+ },
389
+ AgentProgress::ThinkingDelta {
390
+ id: "cot-1".into(),
391
+ delta: "Reading ".into(),
392
+ elapsed_ms: 100,
393
+ },
394
+ AgentProgress::ThinkingDelta {
395
+ id: "cot-1".into(),
396
+ delta: "the file...".into(),
397
+ elapsed_ms: 200,
398
+ },
399
+ AgentProgress::ExtendedThinking {
400
+ id: Some("cot-1".into()),
401
+ thought: "Reading the file...".into(),
402
+ elapsed_ms: Some(200),
403
+ },
404
+ AgentProgress::ToolEnd {
405
+ elapsed_ms: None,
406
+ call_id: None,
407
+ status: None,
408
+ action: "read_file".into(),
409
+ input: serde_json::json!({ "path": "src/main.rs" }),
410
+ result: "fn main() {}".into(),
411
+ subagent: None,
412
+ },
413
+ AgentProgress::ThinkingDelta {
414
+ id: "cot-interrupted".into(),
415
+ delta: "Let's check ".into(),
416
+ elapsed_ms: 300,
417
+ },
418
+ AgentProgress::ThinkingDelta {
419
+ id: "cot-interrupted".into(),
420
+ delta: "more lines".into(),
421
+ elapsed_ms: 350,
422
+ },
423
+ ];
424
+
425
+ let compacted = compact_agent_progress(&events);
426
+ assert!(
427
+ !compacted
428
+ .iter()
429
+ .any(|e| matches!(e, AgentProgress::ThinkingDelta { id, .. } if id == "cot-1"))
430
+ );
431
+ assert!(
432
+ compacted
433
+ .iter()
434
+ .any(|e| matches!(e, AgentProgress::ToolStart { action, .. } if action == "read_file"))
435
+ );
436
+ assert!(
437
+ compacted
438
+ .iter()
439
+ .any(|e| matches!(e, AgentProgress::ToolEnd { action, .. } if action == "read_file"))
440
+ );
441
+ assert!(compacted.iter().any(|e| matches!(e, AgentProgress::ExtendedThinking { id: Some(id), thought, .. } if id == "cot-1" && thought == "Reading the file...")));
442
+ assert!(compacted.iter().any(|e| matches!(e, AgentProgress::ExtendedThinking { id: Some(id), thought, .. } if id == "cot-interrupted" && thought == "Let's check more lines")));
443
+ }
444
+
445
+ #[tokio::test]
446
+ async fn test_turn_lease_persists_agent_activity_on_complete() {
447
+ let memory = MemoryStore::open(std::env::temp_dir().join(format!(
448
+ "mint-turn-lease-complete-{}.sqlite",
449
+ uuid::Uuid::new_v4()
450
+ )));
451
+ let mut turn = TurnLease::start(&memory, "cli::test_complete", "hello")
452
+ .await
453
+ .unwrap();
454
+ let turn_id = turn.id;
455
+ turn.activity
456
+ .lock()
457
+ .unwrap()
458
+ .push(AgentProgress::ToolStart {
459
+ call_id: None,
460
+ action: "run_shell".into(),
461
+ input: serde_json::json!({ "command": "ls -la" }),
462
+ subagent: None,
463
+ });
464
+ turn.activity.lock().unwrap().push(AgentProgress::ToolEnd {
465
+ elapsed_ms: None,
466
+ call_id: None,
467
+ status: None,
468
+ action: "run_shell".into(),
469
+ input: serde_json::json!({ "command": "ls -la" }),
470
+ result: "file.txt".into(),
471
+ subagent: None,
472
+ });
473
+
474
+ turn.complete_with_summary("Done listing files", "test_provider", "test_model", None)
475
+ .unwrap();
476
+
477
+ let rows = memory.interactions_for_chat("cli::test_complete").unwrap();
478
+ assert_eq!(rows.len(), 1);
479
+ let row = &rows[0];
480
+ assert_eq!(row.id, turn_id);
481
+ assert_eq!(row.status, "completed");
482
+ assert_eq!(row.ai_text, "Done listing files");
483
+ assert!(row.agent_activity.is_some());
484
+ let activity_val = row.agent_activity.as_ref().unwrap();
485
+ let activity_arr = activity_val.as_array().unwrap();
486
+ assert_eq!(activity_arr.len(), 2);
487
+ assert_eq!(activity_arr[0]["type"], "ToolStart");
488
+ assert_eq!(activity_arr[1]["type"], "ToolEnd");
489
+ }
490
+
491
+ #[tokio::test]
492
+ async fn test_turn_lease_persists_partial_activity_on_interrupt() {
493
+ let memory = MemoryStore::open(std::env::temp_dir().join(format!(
494
+ "mint-turn-lease-interrupt-{}.sqlite",
495
+ uuid::Uuid::new_v4()
496
+ )));
497
+ let turn = TurnLease::start(&memory, "cli::test_interrupt", "run something")
498
+ .await
499
+ .unwrap();
500
+ let turn_id = turn.id;
501
+ turn.activity
502
+ .lock()
503
+ .unwrap()
504
+ .push(AgentProgress::ToolStart {
505
+ call_id: None,
506
+ action: "read_file".into(),
507
+ input: serde_json::json!({ "path": "test.txt" }),
508
+ subagent: None,
509
+ });
510
+ drop(turn);
511
+
512
+ let rows = memory.interactions_for_chat("cli::test_interrupt").unwrap();
513
+ assert_eq!(rows.len(), 1);
514
+ let row = &rows[0];
515
+ assert_eq!(row.id, turn_id);
516
+ assert_eq!(row.status, "interrupted");
517
+ assert!(row.agent_activity.is_some());
518
+ let activity_val = row.agent_activity.as_ref().unwrap();
519
+ let activity_arr = activity_val.as_array().unwrap();
520
+ assert_eq!(activity_arr.len(), 1);
521
+ assert_eq!(activity_arr[0]["type"], "ToolStart");
522
+ }
523
+
524
+ #[test]
525
+ fn extracts_a_summary_incrementally_without_matching_text_inside_other_strings() {
526
+ let mut stream = FinishSummaryStream::default();
527
+ let mut output = String::new();
528
+ let mut emit = |delta: String| output.push_str(&delta);
529
+
530
+ stream.push_tool_call(0, Some("read_file"), None, None, &mut emit);
531
+ stream.push_tool_call(
532
+ 0,
533
+ None,
534
+ Some(r#"{"thought":"the \"summary\" key is data","path":"x"}"#),
535
+ None,
536
+ &mut emit,
537
+ );
538
+ assert!(stream.emitted.is_empty());
539
+
540
+ stream.push_tool_call(1, Some("fin"), None, None, &mut emit);
541
+ stream.push_tool_call(1, Some("finish"), None, None, &mut emit);
542
+ stream.push_tool_call(1, None, Some(r#"{"summary":"สวัส"#), None, &mut emit);
543
+ stream.push_tool_call(
544
+ 1,
545
+ None,
546
+ Some(r#"ดี\nโลก","verification":""}"#),
547
+ None,
548
+ &mut emit,
549
+ );
550
+
551
+ assert_eq!(output, "สวัสดี\nโลก");
552
+ }
553
+
554
+ #[test]
555
+ fn extracts_json_prompt_summary_as_chunks_arrive() {
556
+ let mut stream = FinishSummaryStream::default();
557
+ let mut output = String::new();
558
+ let mut emit = |delta: String| output.push_str(&delta);
559
+ stream.push_json_prompt(
560
+ r#"{"thought":"done","action":"finish","input":{"summary":"Hello"#,
561
+ &mut emit,
562
+ );
563
+ assert_eq!(stream.emitted, "Hello");
564
+ stream.push_json_prompt(r#" world"}}"#, &mut emit);
565
+ assert_eq!(output, "Hello world");
566
+ }
567
+
568
+ #[test]
569
+ fn direct_native_text_is_not_sent_again_as_a_completed_summary() {
570
+ assert_eq!(
571
+ unstreamed_summary_remainder("A streamed answer.", "", "A streamed answer."),
572
+ ""
573
+ );
574
+ }
575
+
576
+ #[test]
577
+ fn direct_native_text_appends_only_the_unstreamed_suffix() {
578
+ assert_eq!(
579
+ unstreamed_summary_remainder("A streamed answer, continued.", "", "A streamed answer"),
580
+ ", continued."
581
+ );
582
+ }
583
+
584
+ #[test]
585
+ fn streamed_finish_summary_takes_precedence_over_direct_text() {
586
+ assert_eq!(
587
+ unstreamed_summary_remainder("Final answer.", "Final", "unrelated preamble"),
588
+ " answer."
589
+ );
590
+ }
591
+
592
+ #[test]
593
+ fn streams_native_direct_text_incrementally_once_past_single_line_preamble() {
594
+ let mut stream = FinishSummaryStream::default();
595
+ let mut chunks = Vec::new();
596
+
597
+ // First short line is held briefly in case a tool call follows.
598
+ stream.push_native_text("Here is the breakdown:\n", true, &mut |delta| {
599
+ chunks.push(delta)
600
+ });
601
+ assert!(chunks.is_empty());
602
+
603
+ // As soon as the second line begins with no tool call, the buffered prefix
604
+ // and subsequent deltas stream live in real time.
605
+ stream.push_native_text("- Point 1\n", true, &mut |delta| chunks.push(delta));
606
+ assert_eq!(chunks.concat(), "Here is the breakdown:\n- Point 1\n");
607
+
608
+ stream.push_native_text("- Point 2", true, &mut |delta| chunks.push(delta));
609
+ assert_eq!(
610
+ chunks.concat(),
611
+ "Here is the breakdown:\n- Point 1\n- Point 2"
612
+ );
613
+
614
+ // Completing the turn must not duplicate already-streamed direct text.
615
+ stream.finish_native_text(
616
+ "Here is the breakdown:\n- Point 1\n- Point 2",
617
+ &mut |delta| chunks.push(delta),
618
+ );
619
+ assert_eq!(
620
+ chunks.concat(),
621
+ "Here is the breakdown:\n- Point 1\n- Point 2"
622
+ );
623
+ }
624
+
625
+ #[test]
626
+ fn suppresses_native_single_line_preamble_when_tool_call_follows() {
627
+ let mut stream = FinishSummaryStream::default();
628
+ let mut direct_output = String::new();
629
+ let mut summary_output = String::new();
630
+
631
+ stream.push_native_text(
632
+ "ขออ่านไฟล์ config ก่อนนะครับ",
633
+ true,
634
+ &mut |delta| direct_output.push_str(&delta),
635
+ );
636
+ stream.push_tool_call(
637
+ 0,
638
+ Some("read_file"),
639
+ Some(r#"{"path":"Cargo.toml"}"#),
640
+ None,
641
+ &mut |delta| summary_output.push_str(&delta),
642
+ );
643
+ stream.push_native_text("\nAdditional trailing text", true, &mut |delta| {
644
+ direct_output.push_str(&delta)
645
+ });
646
+
647
+ assert!(direct_output.is_empty());
648
+ assert!(summary_output.is_empty());
649
+ }
650
+
651
+ #[test]
652
+ fn flushes_short_native_direct_reply_on_completion_when_no_tools_called() {
653
+ let mut stream = FinishSummaryStream::default();
654
+ let mut output = String::new();
655
+
656
+ stream.push_native_text(
657
+ "สวัสดีครับ! มีอะไรให้ช่วยไหมครับ",
658
+ true,
659
+ &mut |delta| output.push_str(&delta),
660
+ );
661
+ assert!(output.is_empty());
662
+
663
+ stream.finish_native_text(
664
+ "สวัสดีครับ! มีอะไรให้ช่วยไหมครับ",
665
+ &mut |delta| output.push_str(&delta),
666
+ );
667
+ assert_eq!(output, "สวัสดีครับ! มีอะไรให้ช่วยไหมครับ");
668
+ }
669
+
670
+ #[test]
671
+ fn streams_native_text_immediately_when_tools_are_disabled() {
672
+ let mut stream = FinishSummaryStream::default();
673
+ let mut chunks = Vec::new();
674
+
675
+ stream.push_native_text("สวัสดี", false, &mut |delta| chunks.push(delta));
676
+ stream.push_native_text("ครับ", false, &mut |delta| chunks.push(delta));
677
+ assert_eq!(chunks, vec!["สวัสดี", "ครับ"]);
678
+
679
+ stream.finish_native_text("สวัสดีครับ", &mut |delta| {
680
+ chunks.push(delta)
681
+ });
682
+ assert_eq!(chunks.concat(), "สวัสดีครับ");
683
+ }
684
+
685
+ #[test]
686
+ fn native_text_with_leading_newlines_after_think_tag_aligns_with_trimmed_response_text() {
687
+ let mut stream = FinishSummaryStream::default();
688
+ let mut chunks = Vec::new();
689
+
690
+ // After </think>, StreamReplyAccumulator often emits "\n\nLine 1\nLine 2" while
691
+ // extract_think_tag trims response.text to "Line 1\nLine 2\nLine 3".
692
+ stream.push_native_text("\n\nLine 1\nLine 2", true, &mut |delta| chunks.push(delta));
693
+ assert_eq!(chunks, vec!["Line 1\nLine 2"]);
694
+
695
+ stream.finish_native_text("Line 1\nLine 2\nLine 3", &mut |delta| chunks.push(delta));
696
+ assert_eq!(chunks.concat(), "Line 1\nLine 2\nLine 3");
697
+ }
698
+
699
+ #[test]
700
+ fn compact_agent_progress_keeps_only_the_latest_plan_updated_event() {
701
+ let events = vec![
702
+ AgentProgress::PlanUpdated {
703
+ plan: ActivePlan {
704
+ objective: "Ship feature".into(),
705
+ tasks: vec![PlanTaskItem {
706
+ id: "step-1".into(),
707
+ title: "Write failing test".into(),
708
+ status: "in_progress".into(),
709
+ }],
710
+ },
711
+ },
712
+ AgentProgress::ToolStart {
713
+ call_id: Some("call_1".into()),
714
+ action: "read_file".into(),
715
+ input: serde_json::json!({"path": "src/lib.rs"}),
716
+ subagent: None,
717
+ },
718
+ AgentProgress::PlanUpdated {
719
+ plan: ActivePlan {
720
+ objective: "Ship feature".into(),
721
+ tasks: vec![PlanTaskItem {
722
+ id: "step-1".into(),
723
+ title: "Write failing test".into(),
724
+ status: "completed".into(),
725
+ }],
726
+ },
727
+ },
728
+ ];
729
+
730
+ let compacted = compact_agent_progress(&events);
731
+ let plans: Vec<_> = compacted
732
+ .iter()
733
+ .filter_map(|e| match e {
734
+ AgentProgress::PlanUpdated { plan } => Some(plan),
735
+ _ => None,
736
+ })
737
+ .collect();
738
+ assert_eq!(plans.len(), 1);
739
+ assert_eq!(plans[0].tasks[0].status, "completed");
740
+ }
741
+
742
+ #[test]
743
+ fn truncate_for_context_leaves_short_text_untouched() {
744
+ assert_eq!(truncate_for_context("hello", 400), "hello");
745
+ }
746
+
747
+ #[test]
748
+ fn truncate_for_context_truncates_long_text_with_a_marker() {
749
+ let long = "a".repeat(500);
750
+ let result = truncate_for_context(&long, 400);
751
+ assert_eq!(
752
+ result.chars().count(),
753
+ 400 + "... [truncated]".chars().count()
754
+ );
755
+ assert!(result.starts_with(&"a".repeat(400)));
756
+ assert!(result.ends_with("... [truncated]"));
757
+ }
758
+
759
+ #[test]
760
+ fn truncate_for_context_never_splits_a_multibyte_char() {
761
+ // Thai text is multi-byte UTF-8; a byte-index slice here would panic
762
+ // or produce invalid UTF-8 if it landed mid-character.
763
+ let thai = "สวัสดี".repeat(200);
764
+ let result = truncate_for_context(&thai, 5);
765
+ assert_eq!(
766
+ result.chars().count(),
767
+ 5 + "... [truncated]".chars().count()
768
+ );
769
+ }
770
+
771
+ #[test]
772
+ fn slugify_lowercases_and_collapses_separators() {
773
+ assert_eq!(
774
+ slugify("Retry Flaky Playwright Tests!!"),
775
+ "retry-flaky-playwright-tests"
776
+ );
777
+ assert_eq!(
778
+ slugify(" leading/trailing --dashes-- "),
779
+ "leading-trailing-dashes"
780
+ );
781
+ assert_eq!(slugify("already-a-slug"), "already-a-slug");
782
+ assert_eq!(slugify("***"), "");
783
+ }
784
+
785
+ #[test]
786
+ fn skill_revision_defaults_to_zero_without_a_revisions_line() {
787
+ assert_eq!(skill_revision("no frontmatter at all"), 0);
788
+ assert_eq!(skill_revision("---\ndescription: a skill\n---\nbody"), 0);
789
+ }
790
+
791
+ #[test]
792
+ fn skill_revision_reads_back_what_set_skill_revision_wrote() {
793
+ let original = "---\ndescription: a skill\n---\nstep-by-step body";
794
+ let bumped = set_skill_revision(original, 1);
795
+ assert_eq!(skill_revision(&bumped), 1);
796
+ assert!(
797
+ bumped.contains("description: a skill"),
798
+ "must preserve existing frontmatter fields: {bumped}"
799
+ );
800
+ assert!(
801
+ bumped.contains("step-by-step body"),
802
+ "must preserve the body: {bumped}"
803
+ );
804
+
805
+ // Refining again must replace the old count, not accumulate a
806
+ // second `revisions:` line alongside it.
807
+ let bumped_again = set_skill_revision(&bumped, 2);
808
+ assert_eq!(skill_revision(&bumped_again), 2);
809
+ assert_eq!(
810
+ bumped_again.matches("revisions:").count(),
811
+ 1,
812
+ "expected exactly one revisions line, got: {bumped_again}"
813
+ );
814
+ }
815
+
816
+ #[test]
817
+ fn set_skill_revision_adds_a_frontmatter_block_when_content_has_none() {
818
+ let result = set_skill_revision("just a body, no frontmatter", 1);
819
+ assert_eq!(skill_revision(&result), 1);
820
+ assert!(result.contains("just a body, no frontmatter"));
821
+ }
822
+
823
+ #[test]
824
+ fn existing_workspace_skill_bodies_reports_none_yet_for_a_fresh_workspace() {
825
+ let root = std::env::temp_dir().join("mint-memory-skill-test-no-skills-yet");
826
+ let _ = std::fs::remove_dir_all(&root);
827
+ assert_eq!(existing_workspace_skill_bodies(&root), "(none yet)");
828
+ }
829
+
830
+ #[test]
831
+ fn existing_workspace_skill_bodies_includes_full_content_by_slug() {
832
+ let root = std::env::temp_dir().join("mint-memory-skill-test-existing-bodies");
833
+ let _ = std::fs::remove_dir_all(&root);
834
+ let skill_dir = root
835
+ .join(".agents")
836
+ .join("skills")
837
+ .join("retry-flaky-tests");
838
+ std::fs::create_dir_all(&skill_dir).unwrap();
839
+ std::fs::write(
840
+ skill_dir.join("SKILL.md"),
841
+ "---\ndescription: retry flaky tests\n---\nrun with --retries=3",
842
+ )
843
+ .unwrap();
844
+
845
+ let bodies = existing_workspace_skill_bodies(&root);
846
+ assert!(bodies.contains("--- retry-flaky-tests ---"));
847
+ assert!(bodies.contains("run with --retries=3"));
848
+
849
+ let _ = std::fs::remove_dir_all(&root);
850
+ }
851
+
852
+ #[test]
853
+ fn skill_worthy_requires_enough_steps_and_substantive_work() {
854
+ let mut counts = BTreeMap::new();
855
+ counts.insert("read_file:foo.rs".to_string(), 1);
856
+ counts.insert("apply_patch:foo.rs".to_string(), 1);
857
+
858
+ // Too few steps, even with a substantive action.
859
+ assert!(!looks_skill_worthy(2, &counts));
860
+ // Enough steps, has a substantive action.
861
+ assert!(looks_skill_worthy(3, &counts));
862
+
863
+ let mut read_only = BTreeMap::new();
864
+ read_only.insert("read_file:foo.rs".to_string(), 5);
865
+ read_only.insert("web_search::rust patterns".to_string(), 2);
866
+ // Enough steps, but nothing substantive happened.
867
+ assert!(!looks_skill_worthy(5, &read_only));
868
+ }
869
+
870
+ #[test]
871
+ fn shell_result_failed_reads_the_exit_line() {
872
+ assert!(!shell_result_failed(
873
+ "exit: 0\nmode: normal\nsandboxed: true\nstdout:\nok\nstderr:\n"
874
+ ));
875
+ assert!(shell_result_failed(
876
+ "exit: 1\nmode: normal\nsandboxed: true\nstdout:\nfail\nstderr:\n"
877
+ ));
878
+ // A killed/unknown-status process isn't treated as a confirmed failure.
879
+ assert!(shell_result_failed(
880
+ "exit: unknown\nmode: normal\nsandboxed: true\nstdout:\nstderr:\n"
881
+ ));
882
+ }
883
+
884
+ #[test]
885
+ fn shell_result_failed_catches_a_later_command_failing_in_a_multi_command_verify() {
886
+ // A multi-command `verify` joins each command's own `run_shell` block with
887
+ // "\n\n" — the first command here passes, the second fails, and the scan
888
+ // must not stop after the first "exit: " line it finds.
889
+ let joined = "exit: 0\nmode: normal\nsandboxed: true\nstdout:\ncargo check ok\nstderr:\n\n\
890
+ exit: 1\nmode: normal\nsandboxed: true\nstdout:\n\nstderr:\n2 tests failed";
891
+ assert!(shell_result_failed(joined));
892
+ }
893
+
894
+ #[test]
895
+ fn unverified_modification_requires_a_verify_call_after_the_last_edit() {
896
+ // No edit at all this run — nothing to verify.
897
+ assert!(!unverified_modification(None, None, ""));
898
+ // Edited, never verified, no explanation given.
899
+ assert!(unverified_modification(Some(2), None, ""));
900
+ // Edited, verified *before* the edit (stale) — still unverified.
901
+ assert!(unverified_modification(Some(2), Some(1), ""));
902
+ // Edited, verified after — satisfied regardless of what verify found.
903
+ assert!(!unverified_modification(Some(2), Some(3), ""));
904
+ // An explanation cannot promote an unchecked edit to verified.
905
+ assert!(unverified_modification(
906
+ Some(2),
907
+ None,
908
+ "Docs-only change, no test suite."
909
+ ));
910
+ }
911
+
912
+ #[test]
913
+ fn unacknowledged_verify_failure_requires_the_agent_to_address_a_real_failure() {
914
+ // No verify ran yet, or it passed — nothing to block on.
915
+ assert!(!unacknowledged_verify_failure(None, ""));
916
+ assert!(!unacknowledged_verify_failure(Some(false), ""));
917
+ // Verify failed and the agent said nothing about it — this is the
918
+ // "claims success while a check is actually failing" case.
919
+ assert!(unacknowledged_verify_failure(Some(true), ""));
920
+ assert!(unacknowledged_verify_failure(Some(true), "n/a"));
921
+ // Even an explanation of pre-existing failures does not make them pass.
922
+ assert!(unacknowledged_verify_failure(
923
+ Some(true),
924
+ "2 pre-existing test failures unrelated to this change; see notes."
925
+ ));
926
+ }
927
+
928
+ #[test]
929
+ fn preserves_request_without_history() {
930
+ let store = MemoryStore::open(
931
+ std::env::temp_dir().join(format!("mint-orchestrator-{}.sqlite", std::process::id())),
932
+ );
933
+ let request = ChatRequest {
934
+ message: "hello".into(),
935
+ system_instruction: "system".into(),
936
+ chat_id: None,
937
+ image_data_uri: None,
938
+ audio_data_uri: None,
939
+ video_data_uri: None,
940
+ document_attachment: None,
941
+ workspace_path: None,
942
+ agent_id: None,
943
+ plan_mode: false,
944
+ pinned_mcp_server: None,
945
+ messages: None,
946
+ tools: None,
947
+ temperature: None,
948
+ ..Default::default()
949
+ };
950
+ let config = MintConfig::default();
951
+ assert!(
952
+ enrich_request(&config, &store, &request)
953
+ .unwrap()
954
+ .system_instruction
955
+ .starts_with("system")
956
+ );
957
+ }
958
+
959
+ fn insert_completed_turn(
960
+ store: &MemoryStore,
961
+ chat_id: &str,
962
+ user_text: &str,
963
+ ai_text: &str,
964
+ ) -> i64 {
965
+ let turn = store.start_turn(chat_id, user_text).unwrap();
966
+ store.claim_turn(chat_id, turn).unwrap();
967
+ store
968
+ .finish_turn(turn, ai_text, "test-provider", "test-model", None)
969
+ .unwrap();
970
+ turn
971
+ }
972
+
973
+ #[test]
974
+ fn build_conversation_history_messages_empty_on_fresh_session() {
975
+ let db_path =
976
+ std::env::temp_dir().join(format!("mint-test-fresh-{}.sqlite", uuid::Uuid::new_v4()));
977
+ let store = MemoryStore::open(&db_path);
978
+ let messages = build_conversation_history_messages(&store, "fresh-session-123", 15, 4000);
979
+ assert!(messages.is_empty());
980
+ let _ = std::fs::remove_file(db_path);
981
+ }
982
+
983
+ #[test]
984
+ fn build_conversation_history_messages_preserves_order_and_roles() {
985
+ let db_path =
986
+ std::env::temp_dir().join(format!("mint-test-order-{}.sqlite", uuid::Uuid::new_v4()));
987
+ let store = MemoryStore::open(&db_path);
988
+ let chat_id = "test-chat-multi-turn";
989
+
990
+ // Insert Turn 1
991
+ insert_completed_turn(
992
+ &store,
993
+ chat_id,
994
+ "ถามชื่อหน่อยดิ แล้วก็ถามผลไม้ที่ชอบหน่อย",
995
+ "ได้เลยครับ! คุณชื่ออะไร และชอบทานผลไม้อะไรเป็นพิเศษครับ?",
996
+ );
997
+
998
+ // Insert Turn 2
999
+ insert_completed_turn(
1000
+ &store,
1001
+ chat_id,
1002
+ "ฉันชื่อภีม ชอบกินมะม่วง",
1003
+ "สวัสดีครับคุณภีม ยินดีที่ได้รู้จักครับ! มะม่วงหวานอร่อยมากครับ",
1004
+ );
1005
+
1006
+ let messages = build_conversation_history_messages(&store, chat_id, 15, 4000);
1007
+ assert_eq!(messages.len(), 4);
1008
+
1009
+ // Verify chronological order and role alternation
1010
+ assert_eq!(messages[0].role, ChatRole::User);
1011
+ assert_eq!(
1012
+ messages[0].content,
1013
+ vec![ContentBlock::Text {
1014
+ text: "ถามชื่อหน่อยดิ แล้วก็ถามผลไม้ที่ชอบหน่อย".to_string()
1015
+ }]
1016
+ );
1017
+
1018
+ assert_eq!(messages[1].role, ChatRole::Assistant);
1019
+ assert_eq!(
1020
+ messages[1].content,
1021
+ vec![ContentBlock::Text {
1022
+ text: "ได้เลยครับ! คุณชื่ออะไร และชอบทานผลไม้อะไรเป็นพิเศษครับ?".to_string()
1023
+ }]
1024
+ );
1025
+
1026
+ assert_eq!(messages[2].role, ChatRole::User);
1027
+ assert_eq!(
1028
+ messages[2].content,
1029
+ vec![ContentBlock::Text {
1030
+ text: "ฉันชื่อภีม ชอบกินมะม่วง".to_string()
1031
+ }]
1032
+ );
1033
+
1034
+ assert_eq!(messages[3].role, ChatRole::Assistant);
1035
+ assert_eq!(
1036
+ messages[3].content,
1037
+ vec![ContentBlock::Text {
1038
+ text: "สวัสดีครับคุณภีม ยินดีที่ได้รู้จักครับ! มะม่วงหวานอร่อยมากครับ".to_string()
1039
+ }]
1040
+ );
1041
+
1042
+ let _ = std::fs::remove_file(db_path);
1043
+ }
1044
+
1045
+ #[test]
1046
+ fn build_conversation_history_messages_handles_empty_ai_text_fallback() {
1047
+ let db_path = std::env::temp_dir().join(format!(
1048
+ "mint-test-fallback-{}.sqlite",
1049
+ uuid::Uuid::new_v4()
1050
+ ));
1051
+ let store = MemoryStore::open(&db_path);
1052
+ let chat_id = "test-chat-empty-ai";
1053
+
1054
+ insert_completed_turn(&store, chat_id, "run silent task", " ");
1055
+
1056
+ let messages = build_conversation_history_messages(&store, chat_id, 15, 4000);
1057
+ assert_eq!(messages.len(), 2);
1058
+ assert_eq!(messages[0].role, ChatRole::User);
1059
+ assert_eq!(messages[1].role, ChatRole::Assistant);
1060
+ assert_eq!(
1061
+ messages[1].content,
1062
+ vec![ContentBlock::Text {
1063
+ text: "(completed)".to_string()
1064
+ }]
1065
+ );
1066
+
1067
+ let _ = std::fs::remove_file(db_path);
1068
+ }
1069
+
1070
+ #[test]
1071
+ fn build_conversation_history_messages_truncation_preserves_multibyte() {
1072
+ let db_path =
1073
+ std::env::temp_dir().join(format!("mint-test-trunc-{}.sqlite", uuid::Uuid::new_v4()));
1074
+ let store = MemoryStore::open(&db_path);
1075
+ let chat_id = "test-chat-trunc";
1076
+
1077
+ let long_thai = "สวัสดีชาวโลก ".repeat(400); // > 4,000 characters
1078
+ insert_completed_turn(&store, chat_id, &long_thai, "รับทราบครับ");
1079
+
1080
+ let messages = build_conversation_history_messages(&store, chat_id, 15, 4000);
1081
+ assert_eq!(messages.len(), 2);
1082
+ if let ContentBlock::Text { text } = &messages[0].content[0] {
1083
+ assert!(text.ends_with("... [truncated]"));
1084
+ assert_eq!(
1085
+ text.chars().count(),
1086
+ 4000 + "... [truncated]".chars().count()
1087
+ );
1088
+ } else {
1089
+ panic!("expected ContentBlock::Text");
1090
+ }
1091
+
1092
+ let _ = std::fs::remove_file(db_path);
1093
+ }
1094
+
1095
+ #[test]
1096
+ fn render_conversation_transcript_formats_cleanly() {
1097
+ let db_path = std::env::temp_dir().join(format!(
1098
+ "mint-test-transcript-{}.sqlite",
1099
+ uuid::Uuid::new_v4()
1100
+ ));
1101
+ let store = MemoryStore::open(&db_path);
1102
+ let chat_id = "test-chat-transcript";
1103
+
1104
+ insert_completed_turn(&store, chat_id, "คำถามข้อ 1", "คำตอบข้อ 1");
1105
+
1106
+ let transcript = render_conversation_transcript(&store, chat_id, 15, 4000).unwrap();
1107
+ assert!(transcript.contains("User: คำถามข้อ 1"));
1108
+ assert!(transcript.contains("Assistant: คำตอบข้อ 1"));
1109
+
1110
+ let _ = std::fs::remove_file(db_path);
1111
+ }
1112
+
1113
+ #[test]
1114
+ fn enrich_request_populates_messages_and_omits_duplicate_transcript() {
1115
+ let db_path =
1116
+ std::env::temp_dir().join(format!("mint-test-enrich-{}.sqlite", uuid::Uuid::new_v4()));
1117
+ let store = MemoryStore::open(&db_path);
1118
+ let chat_id = "test-chat-enrich";
1119
+
1120
+ insert_completed_turn(&store, chat_id, "คุยรอบแรก", "ตอบรอบแรก");
1121
+
1122
+ let request = ChatRequest {
1123
+ message: "คุยรอบสอง".into(),
1124
+ system_instruction: "You are a helpful assistant.".into(),
1125
+ chat_id: Some(chat_id.to_string()),
1126
+ image_data_uri: None,
1127
+ audio_data_uri: None,
1128
+ video_data_uri: None,
1129
+ document_attachment: None,
1130
+ workspace_path: None,
1131
+ agent_id: None,
1132
+ plan_mode: false,
1133
+ pinned_mcp_server: None,
1134
+ messages: None,
1135
+ tools: None,
1136
+ temperature: None,
1137
+ ..Default::default()
1138
+ };
1139
+ let config = MintConfig::default();
1140
+ let enriched = enrich_request(&config, &store, &request).unwrap();
1141
+
1142
+ // Verify structured messages populated: 2 historical + 1 current = 3 messages
1143
+ assert!(enriched.messages.is_some());
1144
+ let msgs = enriched.messages.unwrap();
1145
+ assert_eq!(msgs.len(), 3);
1146
+ assert_eq!(msgs[0].role, ChatRole::User);
1147
+ assert_eq!(
1148
+ msgs[0].content,
1149
+ vec![ContentBlock::Text {
1150
+ text: "คุยรอบแรก".into()
1151
+ }]
1152
+ );
1153
+ assert_eq!(msgs[1].role, ChatRole::Assistant);
1154
+ assert_eq!(
1155
+ msgs[1].content,
1156
+ vec![ContentBlock::Text {
1157
+ text: "ตอบรอบแรก".into()
1158
+ }]
1159
+ );
1160
+ assert_eq!(msgs[2].role, ChatRole::User);
1161
+ assert_eq!(
1162
+ msgs[2].content,
1163
+ vec![ContentBlock::Text {
1164
+ text: "คุยรอบสอง".into()
1165
+ }]
1166
+ );
1167
+
1168
+ // Verify system instruction does NOT duplicate "Recent conversation context:"
1169
+ assert!(
1170
+ !enriched
1171
+ .system_instruction
1172
+ .contains("Recent conversation context:")
1173
+ );
1174
+
1175
+ let _ = std::fs::remove_file(db_path);
1176
+ }
1177
+
1178
+ #[test]
1179
+ fn enrich_request_injects_transcript_for_non_native_tool_calling() {
1180
+ let db_path = std::env::temp_dir().join(format!(
1181
+ "mint-test-enrich-nonnative-{}.sqlite",
1182
+ uuid::Uuid::new_v4()
1183
+ ));
1184
+ let store = MemoryStore::open(&db_path);
1185
+ let chat_id = "test-chat-enrich-nonnative";
1186
+
1187
+ insert_completed_turn(&store, chat_id, "คุยรอบแรก", "ตอบรอบแรก");
1188
+
1189
+ let request = ChatRequest {
1190
+ message: "คุยรอบสอง".into(),
1191
+ system_instruction: "You are a helpful assistant.".into(),
1192
+ chat_id: Some(chat_id.to_string()),
1193
+ ..Default::default()
1194
+ };
1195
+ // Provider with ToolCallingMode::JsonPrompt (e.g. huggingface)
1196
+ let config = MintConfig {
1197
+ ai_provider: "huggingface".into(),
1198
+ ..Default::default()
1199
+ };
1200
+ assert_eq!(config.tool_calling_mode(), ToolCallingMode::JsonPrompt);
1201
+
1202
+ let enriched = enrich_request(&config, &store, &request).unwrap();
1203
+
1204
+ // In non-native mode, messages should remain None (since non-native providers
1205
+ // ignore request.messages in plain chat)
1206
+ assert!(enriched.messages.is_none());
1207
+
1208
+ // Instead, recent conversation context transcript must be injected into system instruction
1209
+ assert!(
1210
+ enriched
1211
+ .system_instruction
1212
+ .contains("Recent conversation context:")
1213
+ );
1214
+ assert!(enriched.system_instruction.contains("User: คุยรอบแรก"));
1215
+ assert!(enriched.system_instruction.contains("Assistant: ตอบรอบแรก"));
1216
+
1217
+ let _ = std::fs::remove_file(db_path);
1218
+ }
1219
+
1220
+ #[tokio::test]
1221
+ async fn multi_turn_conversation_continuity_propagates_into_native_messages_and_preserves_context()
1222
+ {
1223
+ let db_path = std::env::temp_dir().join(format!(
1224
+ "mint-test-multiturn-{}.sqlite",
1225
+ uuid::Uuid::new_v4()
1226
+ ));
1227
+ let store = MemoryStore::open(&db_path);
1228
+ let chat_id = "test-multiturn-continuity";
1229
+
1230
+ // Turn 1
1231
+ insert_completed_turn(
1232
+ &store,
1233
+ chat_id,
1234
+ "ฉันชอบสีส้มและผลไม้แอปเปิ้ล",
1235
+ "รับทราบครับ คุณชอบสีส้มและผลไม้แอปเปิ้ล",
1236
+ );
1237
+ // Turn 2
1238
+ insert_completed_turn(&store, chat_id, "ช่วยจำเรื่องนี้ไว้ด้วยนะ", "ได้เลยครับ บันทึกไว้แล้ว");
1239
+
1240
+ // Verify history builder recovers all 4 messages in strict chronological order
1241
+ let history = build_conversation_history_messages(
1242
+ &store,
1243
+ chat_id,
1244
+ CONTEXT_LIMIT,
1245
+ MAX_CONTEXT_MESSAGE_CHARS,
1246
+ );
1247
+ assert_eq!(history.len(), 4);
1248
+ assert_eq!(history[0].role, ChatRole::User);
1249
+ assert_eq!(
1250
+ history[0].content,
1251
+ vec![ContentBlock::Text {
1252
+ text: "ฉันชอบสีส้มและผลไม้แอปเปิ้ล".into()
1253
+ }]
1254
+ );
1255
+ assert_eq!(history[1].role, ChatRole::Assistant);
1256
+ assert_eq!(
1257
+ history[1].content,
1258
+ vec![ContentBlock::Text {
1259
+ text: "รับทราบครับ คุณชอบสีส้มและผลไม้แอปเปิ้ล".into()
1260
+ }]
1261
+ );
1262
+ assert_eq!(history[2].role, ChatRole::User);
1263
+ assert_eq!(
1264
+ history[2].content,
1265
+ vec![ContentBlock::Text {
1266
+ text: "ช่วยจำเรื่องนี้ไว้ด้วยนะ".into()
1267
+ }]
1268
+ );
1269
+ assert_eq!(history[3].role, ChatRole::Assistant);
1270
+ assert_eq!(
1271
+ history[3].content,
1272
+ vec![ContentBlock::Text {
1273
+ text: "ได้เลยครับ บันทึกไว้แล้ว".into()
1274
+ }]
1275
+ );
1276
+
1277
+ // Simulate turn 3 initialization in orchestrate_agent_loop
1278
+ let mut native_messages = history;
1279
+ let history_prefix_len = native_messages.len();
1280
+ assert_eq!(history_prefix_len, 4);
1281
+
1282
+ let current_task = "ใช้ฟีเจอร์ ask_user ถามผลไม้ที่ฉันชอบหน่อย";
1283
+ let content = build_user_content_blocks(current_task.to_string(), None, None, None);
1284
+ native_messages.push(ChatMessage {
1285
+ role: ChatRole::User,
1286
+ content,
1287
+ });
1288
+ assert_eq!(native_messages.len(), 5);
1289
+
1290
+ // System prompt in native mode must NOT contain duplicate text transcript
1291
+ let config = MintConfig::default();
1292
+ let root = std::path::PathBuf::from("/tmp");
1293
+ let system_prompt = construct_system_prompt(
1294
+ &config,
1295
+ &store,
1296
+ chat_id,
1297
+ &root,
1298
+ current_task,
1299
+ false,
1300
+ true,
1301
+ None,
1302
+ None,
1303
+ );
1304
+ assert!(!system_prompt.contains("Recent conversation context:"));
1305
+
1306
+ // Verify compaction boundary preserves all 4 historical turns + initial task
1307
+ for i in 0..5 {
1308
+ native_messages.extend(step_pair(i));
1309
+ }
1310
+ let config_fail = MintConfig {
1311
+ ai_provider: "non_existent_provider_fail".into(),
1312
+ ..Default::default()
1313
+ };
1314
+ let (compacted, _) =
1315
+ compact_native_messages(&config_fail, &native_messages, history_prefix_len)
1316
+ .await
1317
+ .unwrap()
1318
+ .unwrap();
1319
+
1320
+ // 4 historical + 1 initial user + 2 summary/continuation + 6 recent steps = 13 messages
1321
+ assert_eq!(compacted.len(), 4 + 1 + 2 + 6);
1322
+ assert_eq!(
1323
+ compacted[0].content,
1324
+ vec![ContentBlock::Text {
1325
+ text: "ฉันชอบสีส้มและผลไม้แอปเปิ้ล".into()
1326
+ }]
1327
+ );
1328
+ assert_eq!(
1329
+ compacted[4].content,
1330
+ vec![ContentBlock::Text {
1331
+ text: current_task.into()
1332
+ }]
1333
+ );
1334
+
1335
+ let _ = std::fs::remove_file(db_path);
1336
+ }
1337
+
1338
+ #[test]
1339
+ fn agent_decision_allows_null_input() {
1340
+ let decision = parse_decision(r#"{"thought":"done","action":"finish","input":null}"#)
1341
+ .expect("null input should parse as default input");
1342
+
1343
+ assert_eq!(decision.action, "finish");
1344
+ assert!(decision.input.summary.is_empty());
1345
+ }
1346
+
1347
+ #[test]
1348
+ fn agent_decision_allows_missing_input() {
1349
+ let decision = parse_decision(r#"{"thought":"done","action":"finish"}"#)
1350
+ .expect("missing input should parse as default input");
1351
+
1352
+ assert_eq!(decision.action, "finish");
1353
+ assert!(decision.input.summary.is_empty());
1354
+ }
1355
+
1356
+ #[test]
1357
+ fn shorthand_finish_allows_null_or_missing_finish() {
1358
+ let decision =
1359
+ parse_decision(r#"{"thought":"done","finish":null}"#).expect("null finish should parse");
1360
+ assert_eq!(decision.action, "finish");
1361
+ assert!(decision.input.summary.is_empty());
1362
+
1363
+ let decision = parse_decision(r#"{"thought":"done"}"#).expect("missing finish should parse");
1364
+ assert_eq!(decision.action, "finish");
1365
+ assert!(decision.input.summary.is_empty());
1366
+ }
1367
+
1368
+ #[test]
1369
+ fn shorthand_finish_allows_string_finish_as_summary() {
1370
+ let decision = parse_decision(r#"{"thought":"done","finish":"all done!"}"#)
1371
+ .expect("string finish should parse as summary");
1372
+ assert_eq!(decision.action, "finish");
1373
+ assert_eq!(decision.input.summary, "all done!");
1374
+ }
1375
+
1376
+ #[test]
1377
+ fn write_file_policy_rejects_existing_workspace_file() {
1378
+ let root = std::env::temp_dir().join(format!("mint-write-file-policy-{}", std::process::id()));
1379
+ std::fs::create_dir_all(&root).unwrap();
1380
+ let target = root.join("existing.txt");
1381
+ std::fs::write(&target, "already here").unwrap();
1382
+ let config = MintConfig {
1383
+ allowed_read_paths: vec![root.clone()],
1384
+ allowed_write_paths: vec![root.clone()],
1385
+ blocked_paths: vec![],
1386
+ blocked_file_names: vec![],
1387
+ ..MintConfig::default()
1388
+ };
1389
+
1390
+ let result = validate_new_workspace_file(&root, &config, Path::new("existing.txt"));
1391
+
1392
+ assert!(
1393
+ matches!(result, Err(OrchestrationError::Agent(message)) if message.contains("Use apply_patch"))
1394
+ );
1395
+ let _ = std::fs::remove_file(target);
1396
+ let _ = std::fs::remove_dir(root);
1397
+ }
1398
+
1399
+ #[test]
1400
+ fn agent_list_files_includes_directories() {
1401
+ let root = std::env::temp_dir().join(format!(
1402
+ "mint-agent-list-directories-{}",
1403
+ std::process::id()
1404
+ ));
1405
+ std::fs::create_dir_all(root.join("Bunny Girl")).unwrap();
1406
+ std::fs::write(root.join("note.txt"), "hello").unwrap();
1407
+ let config = MintConfig {
1408
+ allowed_read_paths: vec![root.clone()],
1409
+ allowed_write_paths: vec![root.clone()],
1410
+ blocked_paths: vec![],
1411
+ blocked_file_names: vec![],
1412
+ ..MintConfig::default()
1413
+ };
1414
+
1415
+ let entries = list_directory_entries(&root, 100, &config).unwrap();
1416
+
1417
+ assert!(entries.iter().any(|entry| {
1418
+ entry.name == "Bunny Girl" && entry.kind == "directory" && entry.size.is_none()
1419
+ }));
1420
+ assert!(entries.iter().any(|entry| {
1421
+ entry.name == "note.txt" && entry.kind == "file" && entry.size == Some(5)
1422
+ }));
1423
+ let _ = std::fs::remove_file(root.join("note.txt"));
1424
+ let _ = std::fs::remove_dir(root.join("Bunny Girl"));
1425
+ let _ = std::fs::remove_dir(root);
1426
+ }
1427
+
1428
+ #[test]
1429
+ fn grep_is_classified_as_read_only() {
1430
+ let classification = classify_shell_command("ls ~/Downloads | grep -F \"Bunny Girl\"");
1431
+
1432
+ assert_eq!(classification.mode.as_str(), "readOnly");
1433
+ }
1434
+
1435
+ #[test]
1436
+ fn test_resolve_agent_config() {
1437
+ let mut config = MintConfig::default();
1438
+ config.enable_agent_collaboration = true;
1439
+ config.agents = vec![
1440
+ AgentConfig {
1441
+ id: "planner".into(),
1442
+ name: "Planner".into(),
1443
+ provider: "openai".into(),
1444
+ model: "gpt-4o".into(),
1445
+ api_key: Some("test-key".into()),
1446
+ system_instruction: "Planner instruction".into(),
1447
+ enabled: true,
1448
+ },
1449
+ AgentConfig {
1450
+ id: "coder".into(),
1451
+ name: "Coder".into(),
1452
+ provider: "gemini".into(),
1453
+ model: "gemini-2.5-flash".into(),
1454
+ api_key: None,
1455
+ system_instruction: "Coder instruction".into(),
1456
+ enabled: true,
1457
+ },
1458
+ ];
1459
+
1460
+ let (cfg, instr, name, model) = resolve_agent_config(&config, Some("planner"), &[]);
1461
+ assert_eq!(cfg.ai_provider, "openai");
1462
+ assert_eq!(cfg.openai_model, "gpt-4o");
1463
+ assert_eq!(cfg.openai_api_key, "test-key");
1464
+ assert_eq!(instr, "Planner instruction");
1465
+ assert_eq!(name, Some("Planner".to_string()));
1466
+ assert_eq!(model, Some("gpt-4o".to_string()));
1467
+
1468
+ let (cfg, instr, name, _model) = resolve_agent_config(&config, None, &[]);
1469
+ assert_eq!(cfg.ai_provider, "openai");
1470
+ assert_eq!(instr, "Planner instruction");
1471
+ assert_eq!(name, Some("Planner".to_string()));
1472
+
1473
+ let trajectory = vec!["Step 1:\n- Action: create_plan\n- Observation: all planned".to_string()];
1474
+ let (cfg, instr, name, model) = resolve_agent_config(&config, None, &trajectory);
1475
+ assert_eq!(cfg.ai_provider, "gemini");
1476
+ assert_eq!(instr, "Coder instruction");
1477
+ assert_eq!(name, Some("Coder".to_string()));
1478
+ assert_eq!(model, Some("gemini-2.5-flash".to_string()));
1479
+ }
1480
+
1481
+ fn step_pair(index: usize) -> [ChatMessage; 2] {
1482
+ [
1483
+ ChatMessage {
1484
+ role: ChatRole::Assistant,
1485
+ content: vec![ContentBlock::ToolUse {
1486
+ id: format!("call_{index}"),
1487
+ name: "read_file".into(),
1488
+ input: serde_json::json!({ "path": format!("file{index}.rs") }),
1489
+ thought_signature: None,
1490
+ }],
1491
+ },
1492
+ ChatMessage {
1493
+ role: ChatRole::Tool,
1494
+ content: vec![ContentBlock::ToolResult {
1495
+ tool_use_id: format!("call_{index}"),
1496
+ content: format!("contents of file{index}.rs"),
1497
+ is_error: false,
1498
+ }],
1499
+ },
1500
+ ]
1501
+ }
1502
+
1503
+ fn native_messages_with_steps(step_count: usize) -> Vec<ChatMessage> {
1504
+ let mut messages = vec![ChatMessage::text(ChatRole::User, "do the task")];
1505
+ for i in 0..step_count {
1506
+ messages.extend(step_pair(i));
1507
+ }
1508
+ messages
1509
+ }
1510
+
1511
+ #[tokio::test]
1512
+ async fn compact_native_messages_is_a_noop_when_history_is_short() {
1513
+ // COMPACTION_KEEP_RECENT_STEPS = 3, so exactly 3 step-pairs is nothing to compact yet.
1514
+ let messages = native_messages_with_steps(3);
1515
+ let config = MintConfig::default();
1516
+ let result = compact_native_messages(&config, &messages, 0)
1517
+ .await
1518
+ .unwrap();
1519
+ assert!(result.is_none());
1520
+ }
1521
+
1522
+ #[tokio::test]
1523
+ async fn compact_native_messages_is_a_noop_for_empty_history() {
1524
+ let config = MintConfig::default();
1525
+ let result = compact_native_messages(&config, &[], 0).await.unwrap();
1526
+ assert!(result.is_none());
1527
+ }
1528
+
1529
+ #[test]
1530
+ fn render_messages_as_text_includes_tool_calls_and_results() {
1531
+ let messages = native_messages_with_steps(1);
1532
+ let rendered = render_messages_as_text(&messages);
1533
+ assert!(rendered.contains("Called read_file with"));
1534
+ assert!(rendered.contains("Result: contents of file0.rs"));
1535
+ assert!(rendered.contains("do the task"));
1536
+ }
1537
+
1538
+ #[test]
1539
+ fn no_modification_means_finish_never_needs_verification() {
1540
+ // A pure Q&A run that never touched apply_patch/write_file can finish
1541
+ // immediately, regardless of what (if anything) is in `verification`.
1542
+ assert!(!unverified_modification(None, None, ""));
1543
+ assert!(!unverified_modification(None, Some(1), ""));
1544
+ }
1545
+
1546
+ #[test]
1547
+ fn modification_without_any_verify_call_blocks_finish() {
1548
+ assert!(unverified_modification(Some(2), None, ""));
1549
+ }
1550
+
1551
+ #[test]
1552
+ fn verify_called_before_the_modification_does_not_count() {
1553
+ // Editing again after the last verify invalidates that earlier check.
1554
+ assert!(unverified_modification(Some(3), Some(1), ""));
1555
+ }
1556
+
1557
+ #[test]
1558
+ fn verify_called_after_the_modification_satisfies_the_gate() {
1559
+ assert!(!unverified_modification(Some(2), Some(3), ""));
1560
+ }
1561
+
1562
+ #[test]
1563
+ fn verify_on_the_same_step_as_the_modification_satisfies_the_gate() {
1564
+ // Both markers can land on the same step if a single turn issues
1565
+ // multiple tool calls (apply_patch then verify back to back).
1566
+ assert!(!unverified_modification(Some(2), Some(2), ""));
1567
+ }
1568
+
1569
+ #[test]
1570
+ fn explicit_written_justification_does_not_verify_an_unchecked_edit() {
1571
+ assert!(unverified_modification(
1572
+ Some(2),
1573
+ None,
1574
+ "Documentation-only change; no test suite in this repo."
1575
+ ));
1576
+ }
1577
+
1578
+ #[test]
1579
+ fn placeholder_verification_text_does_not_satisfy_the_gate() {
1580
+ // Mirrors `meaningful_verification`'s own placeholder filter — "n/a" etc.
1581
+ // must not be treated as a real justification.
1582
+ assert!(unverified_modification(Some(2), None, "n/a"));
1583
+ assert!(unverified_modification(Some(2), None, "not run"));
1584
+ }
1585
+
1586
+ fn decision_with_action(action: &str) -> (String, AgentDecision) {
1587
+ (
1588
+ "call_0".to_string(),
1589
+ AgentDecision {
1590
+ thought: String::new(),
1591
+ action: action.to_string(),
1592
+ input: AgentInput::default(),
1593
+ },
1594
+ )
1595
+ }
1596
+
1597
+ #[test]
1598
+ fn empty_decisions_never_qualify_for_the_parallel_batch() {
1599
+ assert!(!decisions_are_parallel_read_only_batch(&[]));
1600
+ }
1601
+
1602
+ #[test]
1603
+ fn two_or_more_read_only_decisions_qualify_for_the_parallel_batch() {
1604
+ let decisions = vec![
1605
+ decision_with_action("read_file"),
1606
+ decision_with_action("search_code"),
1607
+ ];
1608
+ assert!(decisions_are_parallel_read_only_batch(&decisions));
1609
+
1610
+ let decisions = vec![
1611
+ decision_with_action("read_file"),
1612
+ decision_with_action("web_search"),
1613
+ decision_with_action("git_diff"),
1614
+ ];
1615
+ assert!(decisions_are_parallel_read_only_batch(&decisions));
1616
+ }
1617
+
1618
+ #[test]
1619
+ fn a_lone_read_only_decision_stays_sequential() {
1620
+ let decisions = vec![decision_with_action("read_file")];
1621
+ assert!(!decisions_are_parallel_read_only_batch(&decisions));
1622
+ }
1623
+
1624
+ #[test]
1625
+ fn read_only_mixed_with_mutating_action_stays_sequential() {
1626
+ let decisions = vec![
1627
+ decision_with_action("read_file"),
1628
+ decision_with_action("write_file"),
1629
+ ];
1630
+ assert!(!decisions_are_parallel_read_only_batch(&decisions));
1631
+
1632
+ let decisions = vec![
1633
+ decision_with_action("read_file"),
1634
+ decision_with_action("run_shell"),
1635
+ ];
1636
+ assert!(!decisions_are_parallel_read_only_batch(&decisions));
1637
+ }
1638
+
1639
+ #[test]
1640
+ fn rebuild_observation_reuses_buffer_and_formats_history() {
1641
+ let root = Path::new("/workspace/test-project");
1642
+ let task = "Fix the login bug";
1643
+ let step1 = format_trajectory_step(1, "Inspecting files", "list_files", "src/main.rs");
1644
+ let step2 = format_trajectory_step(2, "Reading code", "read_file", "fn main() {}");
1645
+ let trajectory = vec![step1, step2];
1646
+
1647
+ let mut buffer = String::new();
1648
+ rebuild_observation(task, root, &trajectory, &mut buffer);
1649
+
1650
+ assert!(buffer.contains("Task: Fix the login bug"));
1651
+ assert!(buffer.contains("Workspace: /workspace/test-project"));
1652
+ assert!(buffer.contains("Step 1:\n- Thought: Inspecting files"));
1653
+ assert!(buffer.contains("Step 2:\n- Thought: Reading code"));
1654
+ assert!(buffer.ends_with(
1655
+ "Proceed to the next step. If you have completed the task, use the 'finish' action."
1656
+ ));
1657
+
1658
+ // Ensure buffer can be reused cleanly for subsequent steps
1659
+ let step3 = format_trajectory_step(3, "All done", "finish", "Fixed");
1660
+ let mut extended_trajectory = trajectory;
1661
+ extended_trajectory.push(step3);
1662
+ rebuild_observation(task, root, &extended_trajectory, &mut buffer);
1663
+
1664
+ assert!(buffer.contains("Step 3:\n- Thought: All done"));
1665
+ }