@codemieai/code 0.0.45 → 0.0.47

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 (398) hide show
  1. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  2. package/dist/agents/core/BaseAgentAdapter.js +20 -3
  3. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  4. package/dist/agents/core/metrics/types.d.ts +0 -6
  5. package/dist/agents/core/metrics/types.d.ts.map +1 -1
  6. package/dist/agents/core/session/BaseSessionAdapter.d.ts +0 -6
  7. package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
  8. package/dist/agents/plugins/claude/claude.plugin-installer.d.ts +0 -11
  9. package/dist/agents/plugins/claude/claude.plugin-installer.d.ts.map +1 -1
  10. package/dist/agents/plugins/claude/claude.plugin-installer.js +0 -32
  11. package/dist/agents/plugins/claude/claude.plugin-installer.js.map +1 -1
  12. package/dist/agents/plugins/claude/claude.plugin.js +1 -1
  13. package/dist/agents/plugins/claude/claude.session.d.ts.map +1 -1
  14. package/dist/agents/plugins/claude/claude.session.js +1 -28
  15. package/dist/agents/plugins/claude/claude.session.js.map +1 -1
  16. package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
  17. package/dist/agents/plugins/claude/plugin/README.md +1 -14
  18. package/dist/agents/plugins/claude/plugin/hooks/hooks.json +4 -4
  19. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/SKILL.md +206 -0
  20. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/bad-agent.md +45 -0
  21. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/bad-claude-md-snippet.md +40 -0
  22. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/bad-command.md +30 -0
  23. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/bad-hooks.json +23 -0
  24. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/bad-skill.md +48 -0
  25. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/good-agent.md +145 -0
  26. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/good-claude-md-snippet.md +126 -0
  27. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/good-command.md +170 -0
  28. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/good-hooks.json +46 -0
  29. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/good-skill.md +144 -0
  30. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/examples/sample-report.md +223 -0
  31. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/references/best-practices.md +510 -0
  32. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/references/component-checklists.md +413 -0
  33. package/dist/agents/plugins/claude/plugin/skills/claude-setup-audit/scripts/scan-repo.sh +162 -0
  34. package/dist/agents/plugins/claude/plugin/skills/msgraph/README.md +183 -0
  35. package/dist/agents/plugins/claude/plugin/skills/msgraph/SKILL.md +233 -0
  36. package/dist/agents/plugins/claude/plugin/skills/msgraph/scripts/msgraph.py +785 -0
  37. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts.map +1 -1
  38. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js +3 -78
  39. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js.map +1 -1
  40. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.d.ts.map +1 -1
  41. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js +7 -16
  42. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js.map +1 -1
  43. package/dist/agents/plugins/claude/sounds-installer.d.ts +1 -1
  44. package/dist/agents/plugins/claude/sounds-installer.d.ts.map +1 -1
  45. package/dist/agents/plugins/claude/sounds-installer.js +1 -4
  46. package/dist/agents/plugins/claude/sounds-installer.js.map +1 -1
  47. package/dist/agents/plugins/codemie-code.plugin.d.ts +1 -4
  48. package/dist/agents/plugins/codemie-code.plugin.d.ts.map +1 -1
  49. package/dist/agents/plugins/codemie-code.plugin.js +26 -81
  50. package/dist/agents/plugins/codemie-code.plugin.js.map +1 -1
  51. package/dist/agents/plugins/gemini/gemini.session-adapter.d.ts +1 -8
  52. package/dist/agents/plugins/gemini/gemini.session-adapter.d.ts.map +1 -1
  53. package/dist/agents/plugins/gemini/gemini.session-adapter.js +2 -30
  54. package/dist/agents/plugins/gemini/gemini.session-adapter.js.map +1 -1
  55. package/dist/agents/plugins/gemini/session/processors/gemini.conversations-processor.d.ts.map +1 -1
  56. package/dist/agents/plugins/gemini/session/processors/gemini.conversations-processor.js +2 -8
  57. package/dist/agents/plugins/gemini/session/processors/gemini.conversations-processor.js.map +1 -1
  58. package/dist/agents/plugins/gemini/session/processors/gemini.metrics-processor.d.ts.map +1 -1
  59. package/dist/agents/plugins/gemini/session/processors/gemini.metrics-processor.js +0 -7
  60. package/dist/agents/plugins/gemini/session/processors/gemini.metrics-processor.js.map +1 -1
  61. package/dist/agents/plugins/opencode/index.d.ts +1 -1
  62. package/dist/agents/plugins/opencode/index.d.ts.map +1 -1
  63. package/dist/agents/plugins/opencode/index.js.map +1 -1
  64. package/dist/agents/plugins/opencode/opencode-message-types.d.ts +2 -22
  65. package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -1
  66. package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -1
  67. package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -1
  68. package/dist/agents/plugins/opencode/opencode.session.js +5 -30
  69. package/dist/agents/plugins/opencode/opencode.session.js.map +1 -1
  70. package/dist/agents/plugins/opencode/opencode.sqlite-reader.d.ts.map +1 -1
  71. package/dist/agents/plugins/opencode/opencode.sqlite-reader.js +0 -2
  72. package/dist/agents/plugins/opencode/opencode.sqlite-reader.js.map +1 -1
  73. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +0 -8
  74. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -1
  75. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +8 -97
  76. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -1
  77. package/dist/cli/commands/analytics/aggregator.d.ts +0 -8
  78. package/dist/cli/commands/analytics/aggregator.d.ts.map +1 -1
  79. package/dist/cli/commands/analytics/aggregator.js +5 -100
  80. package/dist/cli/commands/analytics/aggregator.js.map +1 -1
  81. package/dist/cli/commands/analytics/data-loader.d.ts +0 -7
  82. package/dist/cli/commands/analytics/data-loader.d.ts.map +1 -1
  83. package/dist/cli/commands/analytics/data-loader.js +3 -10
  84. package/dist/cli/commands/analytics/data-loader.js.map +1 -1
  85. package/dist/cli/commands/analytics/exporter.d.ts.map +1 -1
  86. package/dist/cli/commands/analytics/exporter.js +0 -12
  87. package/dist/cli/commands/analytics/exporter.js.map +1 -1
  88. package/dist/cli/commands/analytics/formatter.d.ts.map +1 -1
  89. package/dist/cli/commands/analytics/formatter.js +0 -9
  90. package/dist/cli/commands/analytics/formatter.js.map +1 -1
  91. package/dist/cli/commands/analytics/types.d.ts +0 -17
  92. package/dist/cli/commands/analytics/types.d.ts.map +1 -1
  93. package/dist/cli/commands/assistants/chat/historyLoader.d.ts +22 -0
  94. package/dist/cli/commands/assistants/chat/historyLoader.d.ts.map +1 -0
  95. package/dist/cli/commands/assistants/chat/historyLoader.js +80 -0
  96. package/dist/cli/commands/assistants/chat/historyLoader.js.map +1 -0
  97. package/dist/cli/commands/assistants/{chat.d.ts → chat/index.d.ts} +1 -1
  98. package/dist/cli/commands/assistants/chat/index.d.ts.map +1 -0
  99. package/dist/cli/commands/assistants/{chat.js → chat/index.js} +54 -45
  100. package/dist/cli/commands/assistants/chat/index.js.map +1 -0
  101. package/dist/cli/commands/assistants/chat/types.d.ts +27 -0
  102. package/dist/cli/commands/assistants/chat/types.d.ts.map +1 -0
  103. package/dist/cli/commands/assistants/chat/types.js +5 -0
  104. package/dist/cli/commands/assistants/chat/types.js.map +1 -0
  105. package/dist/cli/commands/assistants/chat/utils.d.ts +12 -0
  106. package/dist/cli/commands/assistants/chat/utils.d.ts.map +1 -0
  107. package/dist/cli/commands/assistants/chat/utils.js +24 -0
  108. package/dist/cli/commands/assistants/chat/utils.js.map +1 -0
  109. package/dist/cli/commands/assistants/constants.d.ts +1 -0
  110. package/dist/cli/commands/assistants/constants.d.ts.map +1 -1
  111. package/dist/cli/commands/assistants/constants.js.map +1 -1
  112. package/dist/cli/commands/assistants/index.js +2 -2
  113. package/dist/cli/commands/assistants/index.js.map +1 -1
  114. package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.js +1 -1
  115. package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js +1 -1
  116. package/dist/cli/commands/assistants/setup/index.js +4 -4
  117. package/dist/cli/commands/assistants/setup/index.js.map +1 -1
  118. package/dist/cli/commands/assistants/setup/selection/index.d.ts +1 -1
  119. package/dist/cli/commands/assistants/setup/selection/index.d.ts.map +1 -1
  120. package/dist/cli/commands/assistants/setup/selection/index.js +5 -3
  121. package/dist/cli/commands/assistants/setup/selection/index.js.map +1 -1
  122. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts.map +1 -1
  123. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js +7 -1
  124. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js.map +1 -1
  125. package/dist/cli/commands/assistants/setup/selection/types.d.ts +2 -0
  126. package/dist/cli/commands/assistants/setup/selection/types.d.ts.map +1 -1
  127. package/dist/cli/commands/assistants/setup/selection/ui.d.ts.map +1 -1
  128. package/dist/cli/commands/assistants/setup/selection/ui.js +15 -4
  129. package/dist/cli/commands/assistants/setup/selection/ui.js.map +1 -1
  130. package/dist/cli/commands/hook.js +1 -1
  131. package/dist/cli/commands/hook.js.map +1 -1
  132. package/dist/cli/commands/plugin.d.ts +16 -0
  133. package/dist/cli/commands/plugin.d.ts.map +1 -0
  134. package/dist/cli/commands/plugin.js +210 -0
  135. package/dist/cli/commands/plugin.js.map +1 -0
  136. package/dist/cli/commands/setup.js +1 -1
  137. package/dist/cli/commands/skill.d.ts.map +1 -1
  138. package/dist/cli/commands/skill.js +3 -1
  139. package/dist/cli/commands/skill.js.map +1 -1
  140. package/dist/cli/commands/sound.d.ts +3 -0
  141. package/dist/cli/commands/sound.d.ts.map +1 -0
  142. package/dist/cli/commands/sound.js +87 -0
  143. package/dist/cli/commands/sound.js.map +1 -0
  144. package/dist/cli/commands/test-metrics.js +3 -5
  145. package/dist/cli/commands/test-metrics.js.map +1 -1
  146. package/dist/cli/index.js +4 -0
  147. package/dist/cli/index.js.map +1 -1
  148. package/dist/env/types.d.ts +8 -0
  149. package/dist/env/types.d.ts.map +1 -1
  150. package/dist/env/types.js.map +1 -1
  151. package/dist/plugins/core/index.d.ts +13 -0
  152. package/dist/plugins/core/index.d.ts.map +1 -0
  153. package/dist/plugins/core/index.js +15 -0
  154. package/dist/plugins/core/index.js.map +1 -0
  155. package/dist/plugins/core/manifest-parser.d.ts +28 -0
  156. package/dist/plugins/core/manifest-parser.d.ts.map +1 -0
  157. package/dist/plugins/core/manifest-parser.js +137 -0
  158. package/dist/plugins/core/manifest-parser.js.map +1 -0
  159. package/dist/plugins/core/plugin-cache.d.ts +65 -0
  160. package/dist/plugins/core/plugin-cache.d.ts.map +1 -0
  161. package/dist/plugins/core/plugin-cache.js +170 -0
  162. package/dist/plugins/core/plugin-cache.js.map +1 -0
  163. package/dist/plugins/core/plugin-loader.d.ts +21 -0
  164. package/dist/plugins/core/plugin-loader.d.ts.map +1 -0
  165. package/dist/plugins/core/plugin-loader.js +55 -0
  166. package/dist/plugins/core/plugin-loader.js.map +1 -0
  167. package/dist/plugins/core/plugin-resolver.d.ts +33 -0
  168. package/dist/plugins/core/plugin-resolver.d.ts.map +1 -0
  169. package/dist/plugins/core/plugin-resolver.js +118 -0
  170. package/dist/plugins/core/plugin-resolver.js.map +1 -0
  171. package/dist/plugins/core/types.d.ts +183 -0
  172. package/dist/plugins/core/types.d.ts.map +1 -0
  173. package/dist/plugins/core/types.js +22 -0
  174. package/dist/plugins/core/types.js.map +1 -0
  175. package/dist/plugins/loaders/agents-loader.d.ts +19 -0
  176. package/dist/plugins/loaders/agents-loader.d.ts.map +1 -0
  177. package/dist/plugins/loaders/agents-loader.js +92 -0
  178. package/dist/plugins/loaders/agents-loader.js.map +1 -0
  179. package/dist/plugins/loaders/hooks-loader.d.ts +27 -0
  180. package/dist/plugins/loaders/hooks-loader.d.ts.map +1 -0
  181. package/dist/plugins/loaders/hooks-loader.js +94 -0
  182. package/dist/plugins/loaders/hooks-loader.js.map +1 -0
  183. package/dist/plugins/loaders/mcp-loader.d.ts +24 -0
  184. package/dist/plugins/loaders/mcp-loader.d.ts.map +1 -0
  185. package/dist/plugins/loaders/mcp-loader.js +86 -0
  186. package/dist/plugins/loaders/mcp-loader.js.map +1 -0
  187. package/dist/plugins/loaders/skills-loader.d.ts +30 -0
  188. package/dist/plugins/loaders/skills-loader.d.ts.map +1 -0
  189. package/dist/plugins/loaders/skills-loader.js +167 -0
  190. package/dist/plugins/loaders/skills-loader.js.map +1 -0
  191. package/dist/providers/plugins/bedrock/bedrock.template.js +1 -1
  192. package/dist/providers/plugins/jwt/jwt.setup-steps.js +1 -1
  193. package/dist/providers/plugins/jwt/jwt.template.js +1 -1
  194. package/dist/providers/plugins/litellm/litellm.template.js +1 -1
  195. package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js +10 -0
  196. package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js.map +1 -1
  197. package/dist/providers/plugins/sso/proxy/proxy-types.d.ts +3 -0
  198. package/dist/providers/plugins/sso/proxy/proxy-types.d.ts.map +1 -1
  199. package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
  200. package/dist/providers/plugins/sso/session/SessionSyncer.js +2 -3
  201. package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
  202. package/dist/providers/plugins/sso/session/processors/conversations/apiClient.d.ts +21 -0
  203. package/dist/providers/plugins/sso/session/processors/conversations/apiClient.d.ts.map +1 -0
  204. package/dist/providers/plugins/sso/session/processors/conversations/apiClient.js +159 -0
  205. package/dist/providers/plugins/sso/session/processors/conversations/apiClient.js.map +1 -0
  206. package/dist/providers/plugins/sso/session/processors/conversations/constants.d.ts +24 -0
  207. package/dist/providers/plugins/sso/session/processors/conversations/constants.d.ts.map +1 -0
  208. package/dist/providers/plugins/sso/session/processors/conversations/constants.js +36 -0
  209. package/dist/providers/plugins/sso/session/processors/conversations/constants.js.map +1 -0
  210. package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.d.ts +19 -0
  211. package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.d.ts.map +1 -0
  212. package/dist/providers/plugins/sso/session/processors/conversations/{conversation-sync-processor.js → syncProcessor.js} +48 -33
  213. package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js.map +1 -0
  214. package/dist/providers/plugins/sso/session/processors/conversations/{conversation-types.d.ts → types.d.ts} +14 -2
  215. package/dist/providers/plugins/sso/session/processors/conversations/types.d.ts.map +1 -0
  216. package/dist/providers/plugins/sso/session/processors/conversations/types.js +14 -0
  217. package/dist/providers/plugins/sso/session/processors/conversations/types.js.map +1 -0
  218. package/dist/providers/plugins/sso/session/processors/metrics/metrics-aggregator.d.ts.map +1 -1
  219. package/dist/providers/plugins/sso/session/processors/metrics/metrics-aggregator.js +16 -17
  220. package/dist/providers/plugins/sso/session/processors/metrics/metrics-aggregator.js.map +1 -1
  221. package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.d.ts +3 -3
  222. package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.d.ts.map +1 -1
  223. package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.js +8 -38
  224. package/dist/providers/plugins/sso/session/processors/metrics/metrics-api-client.js.map +1 -1
  225. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.d.ts.map +1 -1
  226. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js +2 -6
  227. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js.map +1 -1
  228. package/dist/providers/plugins/sso/session/processors/metrics/metrics-types.d.ts +49 -31
  229. package/dist/providers/plugins/sso/session/processors/metrics/metrics-types.d.ts.map +1 -1
  230. package/dist/providers/plugins/sso/sso.template.js +1 -1
  231. package/dist/{agents/codemie-code/skills → skills}/core/SkillDiscovery.d.ts +10 -0
  232. package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
  233. package/dist/{agents/codemie-code/skills → skills}/core/SkillDiscovery.js +64 -7
  234. package/dist/skills/core/SkillDiscovery.js.map +1 -0
  235. package/dist/skills/core/SkillManager.d.ts.map +1 -0
  236. package/dist/{agents/codemie-code/skills → skills}/core/SkillManager.js +15 -10
  237. package/dist/skills/core/SkillManager.js.map +1 -0
  238. package/dist/{agents/codemie-code/skills → skills}/core/types.d.ts +3 -25
  239. package/dist/skills/core/types.d.ts.map +1 -0
  240. package/dist/skills/core/types.js.map +1 -0
  241. package/dist/{agents/codemie-code/skills → skills}/index.d.ts +3 -3
  242. package/dist/skills/index.d.ts.map +1 -0
  243. package/dist/{agents/codemie-code/skills → skills}/index.js +2 -2
  244. package/dist/skills/index.js.map +1 -0
  245. package/dist/skills/sync/SkillSync.d.ts.map +1 -0
  246. package/dist/{agents/codemie-code/skills → skills}/sync/SkillSync.js +5 -3
  247. package/dist/skills/sync/SkillSync.js.map +1 -0
  248. package/dist/{agents/codemie-code/skills → skills}/utils/content-loader.d.ts +2 -12
  249. package/dist/skills/utils/content-loader.d.ts.map +1 -0
  250. package/dist/{agents/codemie-code/skills → skills}/utils/content-loader.js +3 -8
  251. package/dist/skills/utils/content-loader.js.map +1 -0
  252. package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
  253. package/dist/skills/utils/pattern-matcher.js.map +1 -0
  254. package/dist/utils/frontmatter.d.ts.map +1 -0
  255. package/dist/utils/frontmatter.js.map +1 -0
  256. package/package.json +1 -1
  257. package/dist/agents/codemie-code/agent.d.ts +0 -129
  258. package/dist/agents/codemie-code/agent.d.ts.map +0 -1
  259. package/dist/agents/codemie-code/agent.js +0 -1106
  260. package/dist/agents/codemie-code/agent.js.map +0 -1
  261. package/dist/agents/codemie-code/config.d.ts +0 -40
  262. package/dist/agents/codemie-code/config.d.ts.map +0 -1
  263. package/dist/agents/codemie-code/config.js +0 -293
  264. package/dist/agents/codemie-code/config.js.map +0 -1
  265. package/dist/agents/codemie-code/filters.d.ts +0 -91
  266. package/dist/agents/codemie-code/filters.d.ts.map +0 -1
  267. package/dist/agents/codemie-code/filters.js +0 -328
  268. package/dist/agents/codemie-code/filters.js.map +0 -1
  269. package/dist/agents/codemie-code/index.d.ts +0 -93
  270. package/dist/agents/codemie-code/index.d.ts.map +0 -1
  271. package/dist/agents/codemie-code/index.js +0 -359
  272. package/dist/agents/codemie-code/index.js.map +0 -1
  273. package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts +0 -87
  274. package/dist/agents/codemie-code/modes/contextAwarePlanning.d.ts.map +0 -1
  275. package/dist/agents/codemie-code/modes/contextAwarePlanning.js +0 -957
  276. package/dist/agents/codemie-code/modes/contextAwarePlanning.js.map +0 -1
  277. package/dist/agents/codemie-code/modes/planMode.d.ts +0 -116
  278. package/dist/agents/codemie-code/modes/planMode.d.ts.map +0 -1
  279. package/dist/agents/codemie-code/modes/planMode.js +0 -537
  280. package/dist/agents/codemie-code/modes/planMode.js.map +0 -1
  281. package/dist/agents/codemie-code/prompts.d.ts +0 -47
  282. package/dist/agents/codemie-code/prompts.d.ts.map +0 -1
  283. package/dist/agents/codemie-code/prompts.js +0 -207
  284. package/dist/agents/codemie-code/prompts.js.map +0 -1
  285. package/dist/agents/codemie-code/skills/core/SkillDiscovery.d.ts.map +0 -1
  286. package/dist/agents/codemie-code/skills/core/SkillDiscovery.js.map +0 -1
  287. package/dist/agents/codemie-code/skills/core/SkillManager.d.ts.map +0 -1
  288. package/dist/agents/codemie-code/skills/core/SkillManager.js.map +0 -1
  289. package/dist/agents/codemie-code/skills/core/types.d.ts.map +0 -1
  290. package/dist/agents/codemie-code/skills/core/types.js.map +0 -1
  291. package/dist/agents/codemie-code/skills/index.d.ts.map +0 -1
  292. package/dist/agents/codemie-code/skills/index.js.map +0 -1
  293. package/dist/agents/codemie-code/skills/sync/SkillSync.d.ts.map +0 -1
  294. package/dist/agents/codemie-code/skills/sync/SkillSync.js.map +0 -1
  295. package/dist/agents/codemie-code/skills/utils/content-loader.d.ts.map +0 -1
  296. package/dist/agents/codemie-code/skills/utils/content-loader.js.map +0 -1
  297. package/dist/agents/codemie-code/skills/utils/frontmatter.d.ts.map +0 -1
  298. package/dist/agents/codemie-code/skills/utils/frontmatter.js.map +0 -1
  299. package/dist/agents/codemie-code/skills/utils/pattern-matcher.d.ts.map +0 -1
  300. package/dist/agents/codemie-code/skills/utils/pattern-matcher.js.map +0 -1
  301. package/dist/agents/codemie-code/storage/todoStorage.d.ts +0 -78
  302. package/dist/agents/codemie-code/storage/todoStorage.d.ts.map +0 -1
  303. package/dist/agents/codemie-code/storage/todoStorage.js +0 -225
  304. package/dist/agents/codemie-code/storage/todoStorage.js.map +0 -1
  305. package/dist/agents/codemie-code/tokenUtils.d.ts +0 -108
  306. package/dist/agents/codemie-code/tokenUtils.d.ts.map +0 -1
  307. package/dist/agents/codemie-code/tokenUtils.js +0 -220
  308. package/dist/agents/codemie-code/tokenUtils.js.map +0 -1
  309. package/dist/agents/codemie-code/toolMetadata.d.ts +0 -15
  310. package/dist/agents/codemie-code/toolMetadata.d.ts.map +0 -1
  311. package/dist/agents/codemie-code/toolMetadata.js +0 -316
  312. package/dist/agents/codemie-code/toolMetadata.js.map +0 -1
  313. package/dist/agents/codemie-code/tools/assistant-invocation.d.ts +0 -47
  314. package/dist/agents/codemie-code/tools/assistant-invocation.d.ts.map +0 -1
  315. package/dist/agents/codemie-code/tools/assistant-invocation.js +0 -129
  316. package/dist/agents/codemie-code/tools/assistant-invocation.js.map +0 -1
  317. package/dist/agents/codemie-code/tools/index.d.ts +0 -111
  318. package/dist/agents/codemie-code/tools/index.d.ts.map +0 -1
  319. package/dist/agents/codemie-code/tools/index.js +0 -424
  320. package/dist/agents/codemie-code/tools/index.js.map +0 -1
  321. package/dist/agents/codemie-code/tools/planning.d.ts +0 -54
  322. package/dist/agents/codemie-code/tools/planning.d.ts.map +0 -1
  323. package/dist/agents/codemie-code/tools/planning.js +0 -226
  324. package/dist/agents/codemie-code/tools/planning.js.map +0 -1
  325. package/dist/agents/codemie-code/types.d.ts +0 -459
  326. package/dist/agents/codemie-code/types.d.ts.map +0 -1
  327. package/dist/agents/codemie-code/types.js +0 -59
  328. package/dist/agents/codemie-code/types.js.map +0 -1
  329. package/dist/agents/codemie-code/ui/autocomplete.d.ts +0 -98
  330. package/dist/agents/codemie-code/ui/autocomplete.d.ts.map +0 -1
  331. package/dist/agents/codemie-code/ui/autocomplete.js +0 -145
  332. package/dist/agents/codemie-code/ui/autocomplete.js.map +0 -1
  333. package/dist/agents/codemie-code/ui/keyHandlers.d.ts +0 -112
  334. package/dist/agents/codemie-code/ui/keyHandlers.d.ts.map +0 -1
  335. package/dist/agents/codemie-code/ui/keyHandlers.js +0 -415
  336. package/dist/agents/codemie-code/ui/keyHandlers.js.map +0 -1
  337. package/dist/agents/codemie-code/ui/mentions.d.ts +0 -86
  338. package/dist/agents/codemie-code/ui/mentions.d.ts.map +0 -1
  339. package/dist/agents/codemie-code/ui/mentions.js +0 -122
  340. package/dist/agents/codemie-code/ui/mentions.js.map +0 -1
  341. package/dist/agents/codemie-code/ui/progressTracker.d.ts +0 -125
  342. package/dist/agents/codemie-code/ui/progressTracker.d.ts.map +0 -1
  343. package/dist/agents/codemie-code/ui/progressTracker.js +0 -343
  344. package/dist/agents/codemie-code/ui/progressTracker.js.map +0 -1
  345. package/dist/agents/codemie-code/ui/terminalCodes.d.ts +0 -38
  346. package/dist/agents/codemie-code/ui/terminalCodes.d.ts.map +0 -1
  347. package/dist/agents/codemie-code/ui/terminalCodes.js +0 -42
  348. package/dist/agents/codemie-code/ui/terminalCodes.js.map +0 -1
  349. package/dist/agents/codemie-code/ui/todoPanel.d.ts +0 -112
  350. package/dist/agents/codemie-code/ui/todoPanel.d.ts.map +0 -1
  351. package/dist/agents/codemie-code/ui/todoPanel.js +0 -321
  352. package/dist/agents/codemie-code/ui/todoPanel.js.map +0 -1
  353. package/dist/agents/codemie-code/ui.d.ts +0 -180
  354. package/dist/agents/codemie-code/ui.d.ts.map +0 -1
  355. package/dist/agents/codemie-code/ui.js +0 -1345
  356. package/dist/agents/codemie-code/ui.js.map +0 -1
  357. package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts +0 -87
  358. package/dist/agents/codemie-code/utils/progressionEnforcer.d.ts.map +0 -1
  359. package/dist/agents/codemie-code/utils/progressionEnforcer.js +0 -293
  360. package/dist/agents/codemie-code/utils/progressionEnforcer.js.map +0 -1
  361. package/dist/agents/codemie-code/utils/todoParser.d.ts +0 -41
  362. package/dist/agents/codemie-code/utils/todoParser.d.ts.map +0 -1
  363. package/dist/agents/codemie-code/utils/todoParser.js +0 -305
  364. package/dist/agents/codemie-code/utils/todoParser.js.map +0 -1
  365. package/dist/agents/codemie-code/utils/todoValidator.d.ts +0 -65
  366. package/dist/agents/codemie-code/utils/todoValidator.d.ts.map +0 -1
  367. package/dist/agents/codemie-code/utils/todoValidator.js +0 -249
  368. package/dist/agents/codemie-code/utils/todoValidator.js.map +0 -1
  369. package/dist/agents/codemie-code/validators/planValidator.d.ts +0 -94
  370. package/dist/agents/codemie-code/validators/planValidator.d.ts.map +0 -1
  371. package/dist/agents/codemie-code/validators/planValidator.js +0 -281
  372. package/dist/agents/codemie-code/validators/planValidator.js.map +0 -1
  373. package/dist/agents/plugins/claude/plugin/hooks/hooks.windows.json +0 -98
  374. package/dist/agents/plugins/claude/plugin/sounds/play-random-sound.ps1 +0 -112
  375. package/dist/agents/plugins/claude/plugin/sounds/play-random-sound.sh +0 -58
  376. package/dist/agents/plugins/gemini/session/utils/token-aggregator.d.ts +0 -26
  377. package/dist/agents/plugins/gemini/session/utils/token-aggregator.d.ts.map +0 -1
  378. package/dist/agents/plugins/gemini/session/utils/token-aggregator.js +0 -38
  379. package/dist/agents/plugins/gemini/session/utils/token-aggregator.js.map +0 -1
  380. package/dist/cli/commands/assistants/chat.d.ts.map +0 -1
  381. package/dist/cli/commands/assistants/chat.js.map +0 -1
  382. package/dist/providers/plugins/sso/session/processors/conversations/conversation-api-client.d.ts +0 -26
  383. package/dist/providers/plugins/sso/session/processors/conversations/conversation-api-client.d.ts.map +0 -1
  384. package/dist/providers/plugins/sso/session/processors/conversations/conversation-api-client.js +0 -146
  385. package/dist/providers/plugins/sso/session/processors/conversations/conversation-api-client.js.map +0 -1
  386. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts +0 -22
  387. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts.map +0 -1
  388. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js.map +0 -1
  389. package/dist/providers/plugins/sso/session/processors/conversations/conversation-types.d.ts.map +0 -1
  390. package/dist/providers/plugins/sso/session/processors/conversations/conversation-types.js +0 -7
  391. package/dist/providers/plugins/sso/session/processors/conversations/conversation-types.js.map +0 -1
  392. /package/dist/{agents/codemie-code/skills → skills}/core/SkillManager.d.ts +0 -0
  393. /package/dist/{agents/codemie-code/skills → skills}/core/types.js +0 -0
  394. /package/dist/{agents/codemie-code/skills → skills}/sync/SkillSync.d.ts +0 -0
  395. /package/dist/{agents/codemie-code/skills → skills}/utils/pattern-matcher.d.ts +0 -0
  396. /package/dist/{agents/codemie-code/skills → skills}/utils/pattern-matcher.js +0 -0
  397. /package/dist/{agents/codemie-code/skills/utils → utils}/frontmatter.d.ts +0 -0
  398. /package/dist/{agents/codemie-code/skills/utils → utils}/frontmatter.js +0 -0
@@ -1,1345 +0,0 @@
1
- import { intro, outro, text, spinner, note, isCancel } from '@clack/prompts';
2
- import chalk from 'chalk';
3
- import { formatToolMetadata } from './toolMetadata.js';
4
- import { formatCost, formatTokens, formatTokenUsageSummary } from './tokenUtils.js';
5
- import { TodoPanel } from './ui/todoPanel.js';
6
- import { getProgressTracker } from './ui/progressTracker.js';
7
- import { TodoStateManager } from './tools/planning.js';
8
- import { logger } from '../../utils/logger.js';
9
- import { loadRegisteredAssistants } from '../../utils/config.js';
10
- import { highlightMentionsInText } from './ui/mentions.js';
11
- import { startsWithEscape } from './ui/terminalCodes.js';
12
- import { processKeyInput } from './ui/keyHandlers.js';
13
- import { ReadFileTool, ListDirectoryTool, ExecuteCommandTool } from './tools/index.js';
14
- /**
15
- * Terminal UI interface for CodeMie Agent using Clack
16
- */
17
- export class CodeMieTerminalUI {
18
- agent;
19
- currentSpinner;
20
- todoPanel;
21
- progressTracker;
22
- planMode = false;
23
- activePlanningPhase = null;
24
- assistantSuggestions = [];
25
- constructor(agent) {
26
- this.agent = agent;
27
- this.todoPanel = new TodoPanel({
28
- showProgress: true,
29
- compact: false
30
- });
31
- this.progressTracker = getProgressTracker({
32
- realTimeUpdates: true,
33
- showCelebrations: true,
34
- compact: true
35
- });
36
- // Register for to_do update events
37
- TodoStateManager.addEventCallback(this.handleTodoUpdate.bind(this));
38
- }
39
- /**
40
- * Start interactive terminal session
41
- */
42
- async startInteractive() {
43
- // Welcome message
44
- intro(chalk.cyan('šŸ¤– CodeMie Native Agent'));
45
- const config = this.agent.getConfig();
46
- if (config) {
47
- // Use displayProvider for user-facing output, or fall back to normalized provider
48
- const displayProvider = config.displayProvider || config.provider;
49
- console.log(chalk.cyan('ā—‡ Configuration'));
50
- console.log(` Provider: ${chalk.yellow(displayProvider)}`);
51
- console.log(` Model: ${chalk.cyan(config.model)}`);
52
- console.log(` Working Directory: ${chalk.white(config.workingDirectory)}`);
53
- console.log(` Mode: ${this.planMode ? chalk.green('Plan Mode') : chalk.yellow('Direct Mode')}`);
54
- console.log('');
55
- }
56
- console.log(chalk.white('Type /help for commands, /exit to quit'));
57
- console.log(chalk.white('Enter = send, Shift+Enter = new line, Cmd+V = paste text'));
58
- console.log(chalk.white('šŸ“ø Tab = insert clipboard image • Multiple images supported'));
59
- console.log(chalk.white('šŸ’” Press Ctrl+H for hotkeys, Ctrl+P to toggle plan mode\n'));
60
- // Main interaction loop
61
- while (true) {
62
- const input = await this.getMultilineInput();
63
- if (input === null) {
64
- outro(chalk.white('Goodbye! šŸ‘‹'));
65
- break;
66
- }
67
- const trimmed = input.text.trim();
68
- // Handle special commands
69
- if (trimmed.startsWith('/')) {
70
- const handled = await this.handleCommand(trimmed);
71
- if (handled === 'exit')
72
- break;
73
- continue;
74
- }
75
- if (trimmed === '')
76
- continue;
77
- // Execute the task with streaming UI (respecting current mode)
78
- await this.executeTaskWithCurrentMode(trimmed, input.images);
79
- }
80
- }
81
- /**
82
- * Get input from user with Shift+Enter multiline support and image pasting
83
- */
84
- async getMultilineInput() {
85
- // Load assistants for autocomplete
86
- if (this.assistantSuggestions.length === 0) {
87
- const assistants = await loadRegisteredAssistants();
88
- this.assistantSuggestions = assistants.map(a => ({ slug: a.slug, name: a.name }));
89
- }
90
- return new Promise((resolve) => {
91
- if (!process.stdin.setRawMode) {
92
- // Fallback for environments without raw mode
93
- this.getFallbackInput().then(resolve).catch(() => resolve(null));
94
- return;
95
- }
96
- let cleanupDone = false;
97
- const performCleanup = () => {
98
- if (cleanupDone)
99
- return;
100
- cleanupDone = true;
101
- try {
102
- if (process.stdin.setRawMode) {
103
- process.stdin.setRawMode(false);
104
- }
105
- process.stdin.pause();
106
- process.stdin.removeAllListeners('data');
107
- process.stdin.removeAllListeners('error');
108
- }
109
- catch {
110
- // Ignore cleanup errors
111
- }
112
- };
113
- // Set up error handling first
114
- process.stdin.once('error', (error) => {
115
- performCleanup();
116
- const config = this.agent.getConfig();
117
- if (config?.debug) {
118
- logger.debug('Stdin error:', error);
119
- }
120
- resolve(null);
121
- });
122
- try {
123
- process.stdin.setRawMode(true);
124
- process.stdin.resume();
125
- process.stdin.setEncoding('utf8');
126
- let lines = [];
127
- let currentLine = '';
128
- let isFirstLine = true;
129
- let escapeSequence = '';
130
- let images = [];
131
- // Autocomplete state
132
- let autocompleteActive = false;
133
- let autocompleteList = [];
134
- let autocompleteIndex = 0;
135
- let autocompleteStartPos = -1; // Position where @ was typed
136
- const writePrompt = () => {
137
- try {
138
- const prompt = isFirstLine ? '> ' : '... ';
139
- process.stdout.write(prompt);
140
- }
141
- catch {
142
- // Ignore prompt write errors
143
- }
144
- };
145
- writePrompt();
146
- process.stdin.on('data', async (key) => {
147
- if (cleanupDone)
148
- return; // Prevent processing after cleanup
149
- try {
150
- const data = key.toString('utf8');
151
- const config = this.agent.getConfig();
152
- if (config?.debug && autocompleteActive) {
153
- logger.debug('Key pressed during autocomplete', {
154
- data: data.split('').map(c => c.codePointAt(0) ?? 0).join(','),
155
- escapeSeq: escapeSequence.split('').map(c => c.codePointAt(0) ?? 0).join(','),
156
- listLength: autocompleteList.length
157
- });
158
- }
159
- // Accumulate escape sequences
160
- if (startsWithEscape(data) || escapeSequence.length > 0) {
161
- if (!startsWithEscape(data) && escapeSequence.length > 0) {
162
- escapeSequence += data;
163
- }
164
- else if (startsWithEscape(data)) {
165
- escapeSequence = data;
166
- }
167
- }
168
- // Build state object for key handler
169
- const state = {
170
- currentLine,
171
- lines,
172
- isFirstLine,
173
- autocompleteActive,
174
- autocompleteList,
175
- autocompleteIndex,
176
- autocompleteStartPos,
177
- escapeSequence,
178
- images,
179
- ui: this,
180
- };
181
- // Process key through handler registry
182
- const result = await processKeyInput(data, state);
183
- // Update local variables from state
184
- currentLine = state.currentLine;
185
- lines = state.lines;
186
- isFirstLine = state.isFirstLine;
187
- autocompleteActive = state.autocompleteActive;
188
- autocompleteList = state.autocompleteList;
189
- autocompleteIndex = state.autocompleteIndex;
190
- autocompleteStartPos = state.autocompleteStartPos;
191
- escapeSequence = state.escapeSequence;
192
- // images array is modified by reference
193
- // Handle result
194
- if (result.handled) {
195
- if (result.shouldRewritePrompt) {
196
- writePrompt();
197
- process.stdout.write(currentLine);
198
- }
199
- if (result.shouldReturn) {
200
- performCleanup();
201
- resolve(result.value ?? null);
202
- return;
203
- }
204
- return; // Handler processed the key
205
- }
206
- // Clear escape sequence if no handler matched (shouldn't happen)
207
- escapeSequence = '';
208
- }
209
- catch (error) {
210
- // Handle data processing errors gracefully
211
- const config = this.agent.getConfig();
212
- if (config?.debug) {
213
- logger.debug('Input processing error:', error);
214
- }
215
- // Continue processing - don't crash on single key errors
216
- }
217
- });
218
- }
219
- catch (error) {
220
- performCleanup();
221
- const config = this.agent.getConfig();
222
- if (config?.debug) {
223
- logger.debug('Input setup error:', error);
224
- }
225
- resolve(null);
226
- }
227
- });
228
- }
229
- /**
230
- * Fallback input method for environments without raw mode
231
- */
232
- async getFallbackInput() {
233
- const input = await text({
234
- message: '>',
235
- placeholder: 'Type your message... (Tab to insert clipboard image)'
236
- });
237
- if (isCancel(input)) {
238
- return null;
239
- }
240
- const textInput = input === undefined || input === null ? '' : String(input);
241
- // In fallback mode, we can't handle interactive image insertion
242
- // So just return text with empty images array
243
- return {
244
- text: textInput,
245
- images: []
246
- };
247
- }
248
- /**
249
- * Handle special commands
250
- */
251
- async handleCommand(command) {
252
- const [cmd] = command.slice(1).split(' ');
253
- switch (cmd) {
254
- case 'help':
255
- note(`${chalk.cyan('/help')} - Show this help message\n` +
256
- `${chalk.cyan('/clear')} - Clear conversation history\n` +
257
- `${chalk.cyan('/stats')} - Show agent statistics\n` +
258
- `${chalk.cyan('/todos')} - Show current todo list and progress\n` +
259
- `${chalk.cyan('/config')} - Show configuration\n` +
260
- `${chalk.cyan('/health')} - Run health check\n` +
261
- `${chalk.cyan('/exit')} - Exit the agent\n\n` +
262
- `${chalk.yellow('Hotkeys:')}\n` +
263
- `- ${chalk.cyan('Ctrl+P')} - Toggle plan mode on/off\n` +
264
- `- ${chalk.cyan('Ctrl+H')} - Show detailed hotkey help\n` +
265
- `- ${chalk.cyan('Ctrl+T')} - Show current todo list\n` +
266
- `- ${chalk.cyan('Ctrl+S')} - Show current mode status\n\n` +
267
- `${chalk.yellow('Input Controls:')}\n` +
268
- `- ${chalk.cyan('Enter')} - Send message\n` +
269
- `- ${chalk.cyan('Shift+Enter')} - New line (multiline input)\n` +
270
- `- ${chalk.cyan('Cmd+V / Ctrl+V')} - Paste text from clipboard\n` +
271
- `- ${chalk.cyan('Tab')} - Insert image from clipboard\n` +
272
- `- ${chalk.cyan('Ctrl+C')} - Cancel current input\n\n` +
273
- `${chalk.yellow('Image Support:')}\n` +
274
- `- Copy image/screenshot to clipboard\n` +
275
- `- Press ${chalk.cyan('Tab')} to insert as ${chalk.blueBright('[Image #N]')}\n` +
276
- `- Multiple images supported per message\n` +
277
- `- AI analyzes both text and all images`, 'Available Commands');
278
- break;
279
- case 'clear':
280
- this.agent.clearHistory();
281
- note('Conversation history cleared', 'History');
282
- break;
283
- case 'stats':
284
- await this.showStats();
285
- break;
286
- case 'todos':
287
- await this.showTodos();
288
- break;
289
- case 'config':
290
- await this.showConfig();
291
- break;
292
- case 'health':
293
- await this.runHealthCheck();
294
- break;
295
- case 'exit':
296
- outro(chalk.white('Goodbye! šŸ‘‹'));
297
- return 'exit';
298
- default:
299
- note(chalk.rgb(255, 120, 120)(`Unknown command: ${command}\nType /help for available commands`), 'Error');
300
- break;
301
- }
302
- }
303
- /**
304
- * Execute task with modern UI feedback
305
- */
306
- async executeTaskWithUI(task, images = []) {
307
- let hasStarted = false;
308
- let toolCallCount = 0;
309
- try {
310
- // Show image summary if any images were provided
311
- if (images.length > 0) {
312
- const imageTypes = images.map(img => img.mimeType).join(', ');
313
- note(chalk.green(`šŸ“ø ${images.length} image${images.length > 1 ? 's' : ''} included: ${imageTypes}`), 'Image Input');
314
- }
315
- // Start streaming with visual feedback
316
- await this.agent.chatStream(task, (event) => {
317
- switch (event.type) {
318
- case 'thinking_start':
319
- // Show "Thinking..." spinner when the agent starts processing
320
- if (!this.currentSpinner) {
321
- this.currentSpinner = spinner();
322
- }
323
- this.currentSpinner.start(chalk.white('Thinking...'));
324
- break;
325
- case 'content_chunk': {
326
- if (!hasStarted) {
327
- // Stop any existing spinner and start response
328
- if (this.currentSpinner) {
329
- this.currentSpinner.stop();
330
- this.currentSpinner = undefined;
331
- }
332
- console.log(chalk.cyan('\nCodeMie Thoughts:'));
333
- hasStarted = true;
334
- }
335
- // Highlight [Assistant @slug] prefix in responses
336
- const highlightedContent = highlightMentionsInText(event.content || '');
337
- process.stdout.write(highlightedContent);
338
- break;
339
- }
340
- case 'tool_call_start':
341
- toolCallCount++;
342
- if (!this.currentSpinner) {
343
- this.currentSpinner = spinner();
344
- }
345
- this.currentSpinner.start(chalk.yellow(`Using ${event.toolName}`));
346
- break;
347
- case 'tool_call_progress':
348
- if (this.currentSpinner && event.toolProgress) {
349
- const { percentage, operation, details } = event.toolProgress;
350
- const progressBar = this.createToolProgressBar(percentage);
351
- let message = `${operation} ${Math.round(percentage)}% ${progressBar}`;
352
- if (details) {
353
- message += ` (${details})`;
354
- }
355
- this.currentSpinner.message(chalk.cyan(message));
356
- }
357
- break;
358
- case 'tool_call_result':
359
- if (this.currentSpinner) {
360
- // Use enhanced metadata if available, otherwise fall back to basic message
361
- const message = event.toolMetadata
362
- ? formatToolMetadata(event.toolName || 'tool', event.toolMetadata)
363
- : `āœ“ ${event.toolName} completed`;
364
- this.currentSpinner.stop();
365
- this.currentSpinner = undefined;
366
- console.log(chalk.green(`ā—‡ ${message}`));
367
- // Show additional details if available and not an error (but avoid duplication)
368
- if (event.toolMetadata && event.toolMetadata.success && this.shouldShowDetails(event.toolName || '')) {
369
- this.showToolDetails(event.toolName || '', event.toolMetadata);
370
- }
371
- }
372
- break;
373
- case 'complete':
374
- if (this.currentSpinner) {
375
- this.currentSpinner.stop();
376
- this.currentSpinner = undefined;
377
- }
378
- if (hasStarted) {
379
- console.log('\n'); // Add spacing after response
380
- }
381
- // Show detailed task summary
382
- this.showTaskSummary(toolCallCount);
383
- break;
384
- case 'error':
385
- if (this.currentSpinner) {
386
- this.currentSpinner.stop();
387
- this.currentSpinner = undefined;
388
- }
389
- note(chalk.red(`Error: ${event.error}`), 'Error');
390
- break;
391
- }
392
- }, images);
393
- }
394
- catch (error) {
395
- if (this.currentSpinner) {
396
- this.currentSpinner.stop();
397
- this.currentSpinner = undefined;
398
- }
399
- const errorMessage = error instanceof Error ? error.message : String(error);
400
- note(chalk.red(`Execution failed: ${errorMessage}`), 'Error');
401
- }
402
- finally {
403
- // Cleanup complete
404
- }
405
- }
406
- /**
407
- * Show agent statistics
408
- */
409
- async showStats() {
410
- const stats = this.agent.getStats();
411
- if (!stats) {
412
- note('No statistics available', 'Stats');
413
- return;
414
- }
415
- const statsText = [
416
- `${chalk.yellow('Token Usage:')}`,
417
- ` Input: ${chalk.cyan(formatTokens(stats.inputTokens))}`,
418
- ` Output: ${chalk.cyan(formatTokens(stats.outputTokens))}${stats.cachedTokens > 0 ? ` + ${chalk.green(formatTokens(stats.cachedTokens))} cached` : ''}`,
419
- ` Total: ${chalk.cyan(formatTokens(stats.totalTokens))}`,
420
- ` Cost: ${chalk.green(formatCost(stats.estimatedTotalCost))}`,
421
- '',
422
- `${chalk.yellow('Execution Stats:')}`,
423
- ` LLM Calls: ${chalk.cyan(stats.llmCalls)}`,
424
- ` Tool Calls: ${chalk.cyan(stats.toolCalls)} (${chalk.green(stats.successfulTools)} success, ${chalk.red(stats.failedTools)} failed)`,
425
- ` Total Steps: ${chalk.cyan(stats.executionSteps.length)}`,
426
- ` Duration: ${chalk.white(stats.executionTime + 'ms')}`
427
- ].join('\n');
428
- note(statsText, 'Agent Statistics');
429
- // Show detailed step breakdown if available
430
- if (stats.executionSteps.length > 0) {
431
- this.showExecutionSteps(stats.executionSteps);
432
- }
433
- }
434
- /**
435
- * Show current configuration
436
- */
437
- async showConfig() {
438
- const config = this.agent.getConfig();
439
- if (!config) {
440
- note('No configuration available', 'Config');
441
- return;
442
- }
443
- // Use displayProvider for user-facing output, or fall back to normalized provider
444
- const displayProvider = config.displayProvider || config.provider;
445
- const configText = [
446
- `Provider: ${chalk.yellow(displayProvider)}`,
447
- `Model: ${chalk.cyan(config.model)}`,
448
- `Base URL: ${chalk.white(config.baseUrl)}`,
449
- `Working Directory: ${chalk.white(config.workingDirectory)}`,
450
- `Debug Mode: ${config.debug ? chalk.green('enabled') : chalk.white('disabled')}`,
451
- `Timeout: ${chalk.white(config.timeout + 'ms')}`
452
- ].join('\n');
453
- note(configText, 'Configuration');
454
- }
455
- /**
456
- * Run health check with UI feedback
457
- */
458
- async runHealthCheck() {
459
- const healthSpinner = spinner();
460
- healthSpinner.start('Running health check...');
461
- try {
462
- const health = await this.agent.healthCheck();
463
- if (health.status === 'healthy') {
464
- healthSpinner.stop(chalk.green('āœ“ System is healthy'));
465
- const healthText = [
466
- `Status: ${chalk.green('Healthy')}`,
467
- `Provider: ${chalk.yellow(health.provider)}`,
468
- `Model: ${chalk.cyan(health.model)}`,
469
- `Tools: ${chalk.cyan(health.toolCount)}`
470
- ].join('\n');
471
- note(healthText, 'Health Check');
472
- }
473
- else {
474
- healthSpinner.stop(chalk.red('āœ— System is unhealthy'));
475
- note(chalk.red(health.error || 'Unknown error'), 'Health Check Failed');
476
- }
477
- }
478
- catch (error) {
479
- healthSpinner.stop(chalk.red('āœ— Health check failed'));
480
- note(chalk.red(error instanceof Error ? error.message : String(error)), 'Error');
481
- }
482
- }
483
- /**
484
- * Format uptime duration
485
- */
486
- formatUptime(uptimeMs) {
487
- const seconds = Math.floor(uptimeMs / 1000);
488
- const minutes = Math.floor(seconds / 60);
489
- const hours = Math.floor(minutes / 60);
490
- if (hours > 0) {
491
- return `${hours}h ${minutes % 60}m ${seconds % 60}s`;
492
- }
493
- else if (minutes > 0) {
494
- return `${minutes}m ${seconds % 60}s`;
495
- }
496
- else {
497
- return `${seconds}s`;
498
- }
499
- }
500
- /**
501
- * Execute a single task with minimal UI (for non-interactive mode)
502
- */
503
- async executeSingleTask(task, images = []) {
504
- const taskSpinner = spinner();
505
- let response = '';
506
- let toolCallCount = 0;
507
- let hasStarted = false;
508
- try {
509
- await this.agent.chatStream(task, (event) => {
510
- switch (event.type) {
511
- case 'thinking_start':
512
- // Show "Thinking..." when the agent starts processing
513
- taskSpinner.start(chalk.white('Thinking...'));
514
- break;
515
- case 'content_chunk':
516
- if (!hasStarted) {
517
- // Switch from "Thinking..." to "Processing task..." when content starts
518
- taskSpinner.message(chalk.white('Processing task...'));
519
- hasStarted = true;
520
- }
521
- response += event.content || '';
522
- break;
523
- case 'tool_call_start':
524
- toolCallCount++;
525
- taskSpinner.message(chalk.yellow(`Using ${event.toolName}...`));
526
- break;
527
- case 'tool_call_progress':
528
- if (event.toolProgress) {
529
- const { percentage, operation, details } = event.toolProgress;
530
- const progressBar = this.createToolProgressBar(percentage);
531
- let message = `${operation} ${Math.round(percentage)}% ${progressBar}`;
532
- if (details) {
533
- message += ` (${details})`;
534
- }
535
- taskSpinner.message(chalk.cyan(message));
536
- }
537
- break;
538
- case 'tool_call_result':
539
- // Show enhanced tool info in single task mode too
540
- if (event.toolMetadata) {
541
- const message = formatToolMetadata(event.toolName || 'tool', event.toolMetadata);
542
- taskSpinner.message(chalk.green(message));
543
- }
544
- else {
545
- taskSpinner.message(chalk.white('Processing task...'));
546
- }
547
- break;
548
- case 'complete':
549
- taskSpinner.stop();
550
- break;
551
- case 'error':
552
- taskSpinner.stop(chalk.red(`Error: ${event.error}`));
553
- break;
554
- }
555
- }, images);
556
- // Show success message with token usage
557
- const stats = this.agent.getStats();
558
- const summaryParts = [];
559
- if (toolCallCount > 0) {
560
- summaryParts.push(`Used ${toolCallCount} tool${toolCallCount > 1 ? 's' : ''}`);
561
- }
562
- if (stats.totalTokens > 0) {
563
- summaryParts.push(`${formatTokens(stats.totalTokens)} tokens`);
564
- }
565
- if (stats.estimatedTotalCost > 0) {
566
- summaryParts.push(`${formatCost(stats.estimatedTotalCost)}`);
567
- }
568
- if (summaryParts.length > 0) {
569
- console.log(chalk.white(`${summaryParts.join(' • ')}\n`));
570
- }
571
- return response;
572
- }
573
- catch (error) {
574
- taskSpinner.stop(chalk.red('Task failed'));
575
- throw error;
576
- }
577
- }
578
- /**
579
- * Execute a task with planning mode and UI streaming (for plan mode)
580
- */
581
- async executePlanningTask(task, _images = [], planOnly = false) {
582
- const planSpinner = spinner();
583
- this.currentSpinner = planSpinner; // Store reference to stop when progress starts
584
- planSpinner.start(chalk.blueBright('šŸ“‹ Starting planning phase...'));
585
- try {
586
- // Import PlanMode
587
- const { PlanMode } = await import('./modes/planMode.js');
588
- const planMode = new PlanMode(this.agent, {
589
- requirePlanning: true,
590
- enforceSequential: true,
591
- showPlanningFeedback: true
592
- });
593
- // Create a UI-connected event callback that handles both planning and streaming events
594
- const uiEventCallback = (event) => {
595
- // Handle planning-specific events
596
- this.handleStreamingEvent(event);
597
- // Handle regular streaming events too
598
- switch (event.type) {
599
- case 'thinking_start':
600
- planSpinner.message(chalk.white('Thinking...'));
601
- break;
602
- case 'content_chunk':
603
- // For planning phase, we might not want to show content chunks immediately
604
- break;
605
- case 'tool_call_start':
606
- planSpinner.message(chalk.yellow(`Using ${event.toolName}...`));
607
- break;
608
- case 'tool_call_progress':
609
- if (event.toolProgress) {
610
- const { percentage, operation, details } = event.toolProgress;
611
- const progressBar = this.createToolProgressBar(percentage);
612
- let message = `${operation} ${Math.round(percentage)}% ${progressBar}`;
613
- if (details) {
614
- message += ` (${details})`;
615
- }
616
- planSpinner.message(chalk.cyan(message));
617
- }
618
- break;
619
- case 'tool_call_result':
620
- if (event.toolMetadata) {
621
- const message = formatToolMetadata(event.toolName || 'tool', event.toolMetadata);
622
- planSpinner.message(chalk.green(message));
623
- }
624
- else {
625
- planSpinner.message(chalk.white('Processing...'));
626
- }
627
- break;
628
- case 'complete':
629
- planSpinner.stop();
630
- break;
631
- case 'error':
632
- planSpinner.stop(chalk.red(`Error: ${event.error}`));
633
- break;
634
- }
635
- };
636
- if (planOnly) {
637
- // Only generate plan, don't execute
638
- const planningResult = await planMode.planningPhase(task, uiEventCallback);
639
- planSpinner.stop();
640
- if (!planningResult.success) {
641
- throw new Error(`Planning failed: ${planningResult.error}`);
642
- }
643
- return `šŸ“‹ Plan generated successfully with ${planningResult.todos.length} steps:\n\n` +
644
- planningResult.todos.map((todo, i) => `${i + 1}. ${todo.content}`).join('\n') +
645
- `\n\nQuality Score: ${planningResult.qualityScore}/100\n` +
646
- (planningResult.suggestions.length > 0 ?
647
- `\nSuggestions:\n${planningResult.suggestions.map((s) => `• ${s}`).join('\n')}` : '') +
648
- `\n\nšŸŽÆ **Plan-only mode**: Plan created. Use --plan flag (without --plan-only) to execute this plan.`;
649
- }
650
- // Full planning + execution
651
- const result = await planMode.executePlannedTask(task, uiEventCallback);
652
- planSpinner.stop();
653
- // Show success message with token usage
654
- const stats = this.agent.getStats();
655
- const summaryParts = [];
656
- if (stats.totalTokens > 0) {
657
- summaryParts.push(`${formatTokens(stats.totalTokens)} tokens`);
658
- }
659
- if (stats.estimatedTotalCost > 0) {
660
- summaryParts.push(`${formatCost(stats.estimatedTotalCost)}`);
661
- }
662
- if (summaryParts.length > 0) {
663
- console.log(chalk.white(`${summaryParts.join(' • ')}\n`));
664
- }
665
- return result;
666
- }
667
- catch (error) {
668
- planSpinner.stop(chalk.red('Planning failed'));
669
- throw error;
670
- }
671
- }
672
- /**
673
- * Check if we should show detailed information for a tool
674
- */
675
- shouldShowDetails(toolName) {
676
- // Show details for these tools when they have interesting information
677
- return [ReadFileTool.name, ListDirectoryTool.name, ExecuteCommandTool.name].includes(toolName);
678
- }
679
- /**
680
- * Show additional tool details
681
- */
682
- showToolDetails(toolName, metadata) {
683
- if (!metadata?.success)
684
- return;
685
- let details = '';
686
- switch (toolName) {
687
- case ReadFileTool.name:
688
- if (metadata.contentPreview) {
689
- details = chalk.white(`Preview:\n${metadata.contentPreview}`);
690
- }
691
- break;
692
- case ListDirectoryTool.name:
693
- if (metadata.contentPreview && metadata.contentPreview !== 'Empty directory') {
694
- // Parse the content preview and format each item on a new line
695
- const preview = metadata.contentPreview;
696
- if (preview.includes(' +') && preview.includes(' more')) {
697
- // Extract items and remaining count: "item1, item2, item3 +15 more"
698
- const [itemsStr, remainingStr] = preview.split(' +');
699
- const items = itemsStr.split(', ');
700
- // Format with each item on a new line
701
- const formattedItems = items.map(item => ` ${item}`).join('\n');
702
- details = chalk.white(`${formattedItems}\n +${remainingStr}`);
703
- }
704
- else {
705
- // Fallback for simple lists without truncation
706
- const items = preview.split(', ');
707
- details = chalk.white(items.map(item => ` ${item}`).join('\n'));
708
- }
709
- }
710
- break;
711
- case ExecuteCommandTool.name:
712
- if (metadata.outputPreview && metadata.outputPreview !== 'No output') {
713
- details = chalk.white(`Output:\n${metadata.outputPreview}`);
714
- }
715
- break;
716
- }
717
- if (details) {
718
- console.log(chalk.white(' ' + details.replaceAll('\n', '\n ')));
719
- }
720
- }
721
- /**
722
- * Show task completion summary with token usage
723
- */
724
- showTaskSummary(toolCallCount) {
725
- const stats = this.agent.getStats();
726
- const summaryParts = [];
727
- if (toolCallCount > 0) {
728
- summaryParts.push(`Used ${toolCallCount} tool${toolCallCount > 1 ? 's' : ''}`);
729
- }
730
- if (stats.totalTokens > 0) {
731
- summaryParts.push(`${formatTokens(stats.totalTokens)} tokens (${formatTokens(stats.inputTokens)} in, ${formatTokens(stats.outputTokens)} out)`);
732
- }
733
- if (stats.estimatedTotalCost > 0) {
734
- summaryParts.push(`${formatCost(stats.estimatedTotalCost)} estimated cost`);
735
- }
736
- if (summaryParts.length > 0) {
737
- note(summaryParts.join(' • '), 'Task Summary');
738
- }
739
- }
740
- /**
741
- * Show detailed execution steps breakdown
742
- */
743
- showExecutionSteps(steps) {
744
- const stepLines = [];
745
- stepLines.push(chalk.yellow('Execution Steps:'));
746
- for (const step of steps) {
747
- const duration = step.duration ? `${step.duration}ms` : 'ongoing';
748
- if (step.type === 'llm_call') {
749
- const tokenInfo = step.tokenUsage
750
- ? ` (${formatTokenUsageSummary(step.tokenUsage)})`
751
- : '';
752
- // Create descriptive label based on LLM context
753
- let llmLabel = 'LLM Call';
754
- if (step.llmContext === 'initial_input') {
755
- llmLabel = 'Processing Input';
756
- }
757
- else if (step.llmContext === 'processing_tool_result') {
758
- llmLabel = 'Processing Tool Output';
759
- }
760
- else if (step.llmContext === 'final_response') {
761
- llmLabel = 'Final Reasoning';
762
- }
763
- stepLines.push(` ${chalk.cyan(`${step.stepNumber}.`)} ${llmLabel} - ${chalk.white(duration)}${tokenInfo}`);
764
- }
765
- else {
766
- const success = step.toolSuccess !== undefined
767
- ? (step.toolSuccess ? chalk.green('āœ“') : chalk.red('āœ—'))
768
- : chalk.yellow('?');
769
- stepLines.push(` ${chalk.cyan(`${step.stepNumber}.`)} ${success} ${step.toolName} - ${chalk.white(duration)}`);
770
- }
771
- }
772
- note(stepLines.join('\n'), 'Step Details');
773
- }
774
- /**
775
- * Handle todo update events
776
- */
777
- handleTodoUpdate(event) {
778
- // Update internal state
779
- this.todoPanel.update(event.todos);
780
- // Only show progress tracker updates when NOT in active planning phase
781
- // This prevents duplicate progress displays during context-aware planning
782
- if (!this.activePlanningPhase) {
783
- this.progressTracker.updateTodos(event.todos, event);
784
- // Show visual feedback based on change type
785
- if (event.changeType === 'create' && event.todos.length > 0) {
786
- this.progressTracker.showPlanningComplete(event.todos.length);
787
- }
788
- }
789
- else {
790
- // During planning phase, update internal state but suppress visual feedback
791
- this.progressTracker.updateTodos(event.todos, event, true);
792
- }
793
- }
794
- /**
795
- * Enable plan mode for structured planning
796
- */
797
- enablePlanMode() {
798
- this.planMode = true;
799
- // Remove redundant messages - UI will show plan mode status in the configuration display
800
- }
801
- /**
802
- * Disable plan mode
803
- */
804
- disablePlanMode() {
805
- this.planMode = false;
806
- this.progressTracker.stop();
807
- }
808
- /**
809
- * Show current todo status
810
- */
811
- async showTodos() {
812
- const _todos = this.todoPanel.getTodos();
813
- if (_todos.length === 0) {
814
- note('No todos found. Use a planning task to create todos automatically.', 'šŸ“‹ Todo Status');
815
- return;
816
- }
817
- const todoDisplay = this.todoPanel.render();
818
- note(todoDisplay, 'šŸ“‹ Current Todo List');
819
- }
820
- /**
821
- * Show planning phase welcome
822
- */
823
- showPlanningWelcome() {
824
- if (this.planMode) {
825
- console.log(chalk.cyan('šŸ’” Plan mode features: structured planning, progress tracking, sequential execution'));
826
- console.log('');
827
- }
828
- }
829
- /**
830
- * Show task welcome with planning context
831
- */
832
- showTaskWelcome(task) {
833
- intro(chalk.cyan('šŸ¤– CodeMie Native Agent'));
834
- // Highlight @ mentions in the task
835
- const highlightedTask = highlightMentionsInText(task);
836
- if (this.planMode) {
837
- console.log(chalk.cyan('ā—‡ Task Execution'));
838
- console.log(` Task: ${highlightedTask}`);
839
- console.log(` Mode: ${chalk.cyan('Plan Mode')} - Structured planning enabled`);
840
- console.log('');
841
- this.showPlanningWelcome();
842
- }
843
- else {
844
- console.log(chalk.cyan('ā—‡ Task Execution'));
845
- console.log(` Task: ${highlightedTask}`);
846
- console.log('');
847
- }
848
- }
849
- /**
850
- * Show task completion with todo summary
851
- */
852
- showTaskComplete() {
853
- const _todos = this.todoPanel.getTodos();
854
- const progressInfo = this.todoPanel.getProgressInfo();
855
- if (progressInfo && progressInfo.total > 0) {
856
- const stats = {
857
- tasksCompleted: progressInfo.completed,
858
- totalTime: undefined // Could track this if needed
859
- };
860
- this.progressTracker.showOverallCompletion(stats);
861
- // Show final todo status if relevant
862
- if (progressInfo.completed === progressInfo.total) {
863
- note('All planned tasks completed successfully! šŸŽ‰', 'āœ… Task Complete');
864
- }
865
- else if (progressInfo.completed > 0) {
866
- note(`Completed ${progressInfo.completed}/${progressInfo.total} planned tasks`, 'šŸ“Š Progress Summary');
867
- }
868
- }
869
- else {
870
- outro(chalk.green('āœ… Task completed!'));
871
- }
872
- }
873
- /**
874
- * Show error with todo context
875
- */
876
- showError(error) {
877
- const _todos = this.todoPanel.getTodos();
878
- const progressInfo = this.todoPanel.getProgressInfo();
879
- let contextInfo = '';
880
- if (progressInfo?.currentTodo) {
881
- contextInfo = `\nšŸ“ Error occurred while working on: ${progressInfo.currentTodo.content}`;
882
- }
883
- note(chalk.rgb(255, 120, 120)(`āŒ ${error}${contextInfo}`), 'Error');
884
- }
885
- /**
886
- * Execute task respecting current mode settings
887
- */
888
- async executeTaskWithCurrentMode(task, images = []) {
889
- if (this.planMode) {
890
- // Use plan mode execution with confirmation
891
- try {
892
- const { PlanMode } = await import('./modes/planMode.js');
893
- const planMode = new PlanMode(this.agent, {
894
- requirePlanning: true,
895
- enforceSequential: true,
896
- showPlanningFeedback: true
897
- });
898
- // First, create the plan only - using UI-integrated planning
899
- const planningResult = await planMode.planningPhase(task, (event) => {
900
- // Handle planning-specific events with UI integration
901
- this.handleStreamingEvent(event);
902
- // Handle regular streaming events for spinner updates
903
- switch (event.type) {
904
- case 'thinking_start':
905
- // Already handled in handleStreamingEvent
906
- break;
907
- case 'tool_call_start':
908
- // Already handled in handleStreamingEvent
909
- break;
910
- case 'tool_call_result':
911
- // Already handled in handleStreamingEvent
912
- break;
913
- }
914
- });
915
- if (!planningResult.success) {
916
- this.showError(`Planning failed: ${planningResult.error}`);
917
- return;
918
- }
919
- // Show the plan to the user with proper formatting
920
- const formattedPlan = this.formatPlanForDisplay(planningResult.todos, planningResult.qualityScore);
921
- note(formattedPlan, 'Planning Complete');
922
- // Ask for confirmation
923
- const shouldExecute = await text({
924
- message: 'Execute this plan?',
925
- placeholder: 'Type "yes" to execute, or "no" to cancel',
926
- validate: (value) => {
927
- const normalized = value.toLowerCase().trim();
928
- if (!['yes', 'y', 'no', 'n'].includes(normalized)) {
929
- return 'Please type "yes" or "no"';
930
- }
931
- }
932
- });
933
- if (isCancel(shouldExecute)) {
934
- note('Plan execution cancelled by user', 'Cancelled');
935
- return;
936
- }
937
- const response = shouldExecute.toLowerCase().trim();
938
- if (['yes', 'y'].includes(response)) {
939
- // Execute the plan
940
- await planMode.executePlannedTask(task, (event) => {
941
- this.handleStreamingEvent(event);
942
- });
943
- }
944
- else {
945
- note('Plan execution cancelled by user', 'Cancelled');
946
- }
947
- }
948
- catch (error) {
949
- this.showError(error instanceof Error ? error.message : String(error));
950
- }
951
- }
952
- else {
953
- // Use direct execution
954
- await this.executeTaskWithUI(task, images);
955
- }
956
- }
957
- /**
958
- * Handle streaming events from plan mode execution
959
- */
960
- handleStreamingEvent(event) {
961
- switch (event.type) {
962
- case 'planning_start':
963
- this.activePlanningPhase = event.planningInfo?.phase || 'planning';
964
- // Don't duplicate the planning start message - handled by spinner
965
- break;
966
- case 'planning_complete':
967
- this.activePlanningPhase = null;
968
- console.log(chalk.green(`šŸ“‹ Plan created with ${event.planningInfo?.totalSteps || 0} steps`));
969
- break;
970
- case 'planning_progress':
971
- this.handlePlanningProgress(event.planningProgress);
972
- break;
973
- case 'planning_tool_call':
974
- this.handlePlanningToolCall(event.planningToolCall);
975
- break;
976
- case 'content_chunk':
977
- if (event.content) {
978
- process.stdout.write(event.content);
979
- }
980
- break;
981
- case 'todo_update':
982
- // Todo updates are handled automatically by the TodoStateManager
983
- // During planning phase, we suppress duplicate visual feedback
984
- break;
985
- case 'error':
986
- this.activePlanningPhase = null;
987
- this.showError(event.error || 'Unknown error');
988
- break;
989
- default:
990
- // Handle other event types silently
991
- break;
992
- }
993
- }
994
- /**
995
- * Handle planning progress streaming events
996
- */
997
- currentPhase = '';
998
- currentTool = '';
999
- currentToolCall = '';
1000
- handlePlanningProgress(progressInfo) {
1001
- if (!progressInfo)
1002
- return;
1003
- // Keep the spinner running and use it to display progress updates
1004
- const phaseNames = {
1005
- 'context_gathering': 'Discovery',
1006
- 'task_analysis': 'Analysis',
1007
- 'plan_generation': 'Planning',
1008
- 'plan_validation': 'Validation'
1009
- };
1010
- this.currentPhase = phaseNames[progressInfo.phase] || 'Planning';
1011
- this.updateGlobalProgress(progressInfo.overallProgress || 0);
1012
- }
1013
- /**
1014
- * Handle planning tool call events
1015
- */
1016
- handlePlanningToolCall(toolInfo) {
1017
- if (!toolInfo)
1018
- return;
1019
- const toolNames = {
1020
- [ListDirectoryTool.name]: 'Exploring',
1021
- [ReadFileTool.name]: 'Reading',
1022
- [ExecuteCommandTool.name]: 'Executing',
1023
- 'llm_analysis': 'Analyzing',
1024
- 'llm_plan_generation': 'Generating Plan',
1025
- 'plan_validation': 'Validating',
1026
- 'analyze_dependencies': 'Dependencies'
1027
- };
1028
- this.currentTool = toolNames[toolInfo.toolName] || 'Tool';
1029
- // Format tool call details with arguments
1030
- this.currentToolCall = this.formatToolCall(toolInfo.toolName, toolInfo.args);
1031
- // Update progress with current tool info
1032
- this.updateGlobalProgress();
1033
- }
1034
- /**
1035
- * Format tool call with arguments for display
1036
- */
1037
- formatToolCall(toolName, args) {
1038
- if (!args || Object.keys(args).length === 0) {
1039
- return toolName;
1040
- }
1041
- // Extract key arguments for concise display
1042
- const formatArg = (key, value) => {
1043
- if (typeof value === 'string') {
1044
- // Truncate long strings and show just the relevant part
1045
- if (key === 'path' || key === 'directory') {
1046
- // Show just the last part of paths
1047
- const parts = value.split('/');
1048
- return parts[parts.length - 1] || value;
1049
- }
1050
- if (key === 'command') {
1051
- // Show first word of commands
1052
- return value.split(' ')[0];
1053
- }
1054
- if (value.length > 20) {
1055
- return value.substring(0, 17) + '...';
1056
- }
1057
- return value;
1058
- }
1059
- if (Array.isArray(value)) {
1060
- return `[${value.length} items]`;
1061
- }
1062
- if (typeof value === 'object') {
1063
- return '{...}';
1064
- }
1065
- return String(value);
1066
- };
1067
- // Pick the most relevant arguments to show
1068
- const relevantKeys = ['path', 'directory', 'file', 'command', 'query', 'pattern'];
1069
- const argsToShow = [];
1070
- for (const key of relevantKeys) {
1071
- if (key in args) {
1072
- argsToShow.push(formatArg(key, args[key]));
1073
- if (argsToShow.length >= 2)
1074
- break; // Show max 2 args
1075
- }
1076
- }
1077
- // If no relevant keys found, show first few keys
1078
- if (argsToShow.length === 0) {
1079
- const keys = Object.keys(args).slice(0, 2);
1080
- for (const key of keys) {
1081
- argsToShow.push(formatArg(key, args[key]));
1082
- }
1083
- }
1084
- return argsToShow.length > 0 ? `${toolName} (${argsToShow.join(', ')})` : toolName;
1085
- }
1086
- /**
1087
- * Update global progress display
1088
- */
1089
- currentProgress = 0;
1090
- updateGlobalProgress(progress) {
1091
- if (progress !== undefined) {
1092
- this.currentProgress = progress;
1093
- }
1094
- const progressBar = this.createProgressBar(this.currentProgress);
1095
- let displayText = `Progress ${Math.round(this.currentProgress)}% ${progressBar}`;
1096
- // Show tool call details if available, otherwise fall back to tool name or phase
1097
- // This provides detailed info like "(Discovery, calling list_dir (src))"
1098
- if (this.currentToolCall) {
1099
- displayText += ` (${this.currentPhase}, calling ${this.currentToolCall})`;
1100
- }
1101
- else if (this.currentTool) {
1102
- displayText += ` (${this.currentTool})`;
1103
- }
1104
- else if (this.currentPhase) {
1105
- displayText += ` (${this.currentPhase})`;
1106
- }
1107
- // Use clack-style spinner update for reliable real-time display
1108
- if (this.currentSpinner) {
1109
- this.currentSpinner.message(displayText);
1110
- }
1111
- else {
1112
- // Fallback to direct output if no spinner
1113
- process.stdout.write('\r' + displayText);
1114
- }
1115
- // Only add newline when planning is completely finished (100%)
1116
- if (this.currentProgress >= 100) {
1117
- if (this.currentSpinner) {
1118
- this.currentSpinner.stop(displayText);
1119
- this.currentSpinner = undefined;
1120
- }
1121
- else {
1122
- process.stdout.write('\n');
1123
- }
1124
- this.currentPhase = '';
1125
- this.currentTool = '';
1126
- this.currentToolCall = '';
1127
- }
1128
- }
1129
- /**
1130
- * Create a simple progress bar
1131
- */
1132
- createProgressBar(percentage, width = 20) {
1133
- const filled = Math.round((percentage / 100) * width);
1134
- const empty = width - filled;
1135
- const filledBar = chalk.cyan('ā–ˆ'.repeat(filled));
1136
- const emptyBar = chalk.white('ā–‘'.repeat(empty));
1137
- return `[${filledBar}${emptyBar}]`;
1138
- }
1139
- /**
1140
- * Create a tool progress bar (smaller for inline use)
1141
- */
1142
- createToolProgressBar(percentage, width = 12) {
1143
- const filled = Math.round((percentage / 100) * width);
1144
- const empty = width - filled;
1145
- const filledBar = chalk.green('ā–ˆ'.repeat(filled));
1146
- const emptyBar = chalk.white('ā–‘'.repeat(empty));
1147
- return `[${filledBar}${emptyBar}]`;
1148
- }
1149
- /**
1150
- * Handle hotkey actions
1151
- */
1152
- handleHotkey(action) {
1153
- switch (action) {
1154
- case 'toggle-plan-mode':
1155
- this.togglePlanMode();
1156
- break;
1157
- case 'show-todos':
1158
- this.showTodosHotkey();
1159
- break;
1160
- case 'show-help':
1161
- this.showHotkeyHelp();
1162
- break;
1163
- case 'show-status':
1164
- this.showModeStatus();
1165
- break;
1166
- default:
1167
- console.log(chalk.red(`\nāŒ Unknown hotkey action: ${action}`));
1168
- break;
1169
- }
1170
- }
1171
- /**
1172
- * Toggle plan mode on/off
1173
- */
1174
- togglePlanMode() {
1175
- const wasEnabled = this.planMode;
1176
- if (this.planMode) {
1177
- this.disablePlanMode();
1178
- }
1179
- else {
1180
- this.enablePlanMode();
1181
- }
1182
- // Show enhanced visual feedback
1183
- this.showModeChangeNotification(wasEnabled, this.planMode);
1184
- }
1185
- /**
1186
- * Show enhanced visual feedback for mode changes
1187
- */
1188
- showModeChangeNotification(wasEnabled, nowEnabled) {
1189
- const modeIcon = nowEnabled ? 'šŸ“‹' : '⚔';
1190
- const statusText = nowEnabled ? 'enabled' : 'disabled';
1191
- // Simple, concise mode change message
1192
- console.log(chalk.blueBright(`\n${modeIcon} Plan mode ${statusText}`));
1193
- // Start progress tracking when plan mode is enabled (but don't show 0/0 progress yet)
1194
- if (nowEnabled) {
1195
- this.progressTracker.start();
1196
- }
1197
- }
1198
- /**
1199
- * Show todos via hotkey (non-blocking)
1200
- */
1201
- showTodosHotkey() {
1202
- const _todos = this.todoPanel.getTodos();
1203
- if (_todos.length === 0) {
1204
- console.log(chalk.white('\nšŸ“‹ No todos found'));
1205
- }
1206
- else {
1207
- const todoDisplay = this.todoPanel.render();
1208
- console.log(`\n${todoDisplay}`);
1209
- }
1210
- }
1211
- /**
1212
- * Show hotkey help
1213
- */
1214
- showHotkeyHelp() {
1215
- const helpText = `
1216
- ${chalk.bold.cyan('šŸ”„ Interactive Mode Hotkeys')}
1217
-
1218
- Mode Control:
1219
- ${chalk.yellow('Ctrl+P')} Toggle plan mode on/off
1220
- ${chalk.yellow('Ctrl+S')} Show current mode status
1221
-
1222
- Todo Management:
1223
- ${chalk.yellow('Ctrl+T')} Show current todo list and progress
1224
-
1225
- General:
1226
- ${chalk.yellow('Ctrl+H')} Show this help
1227
- ${chalk.yellow('Tab')} Insert image from clipboard
1228
- ${chalk.yellow('Ctrl+C')} Cancel input / Exit
1229
-
1230
- Input Controls:
1231
- ${chalk.yellow('Enter')} Send message
1232
- ${chalk.yellow('Shift+Enter')} New line (multiline input)
1233
-
1234
- Chat Commands:
1235
- ${chalk.yellow('/help')} Show chat commands
1236
- ${chalk.yellow('/todos')} Show detailed todo information
1237
- ${chalk.yellow('/stats')} Show agent statistics
1238
- ${chalk.yellow('/exit')} Exit the session
1239
- `;
1240
- console.log(helpText);
1241
- }
1242
- /**
1243
- * Show current mode status
1244
- */
1245
- showModeStatus() {
1246
- const _todos = this.todoPanel.getTodos();
1247
- const progressInfo = this.todoPanel.getProgressInfo();
1248
- let statusText = chalk.bold.blueBright('\nšŸ“Š Current Status\n');
1249
- // Mode information
1250
- statusText += `Mode: ${this.planMode ?
1251
- chalk.green('Plan Mode (structured todos)') :
1252
- chalk.yellow('Direct Mode (immediate execution)')}\n`;
1253
- // Todo information
1254
- if (progressInfo && progressInfo.total > 0) {
1255
- statusText += `Todos: ${progressInfo.completed}/${progressInfo.total} completed (${progressInfo.percentage}%)\n`;
1256
- if (progressInfo.currentTodo) {
1257
- statusText += `Current: ${chalk.cyan(progressInfo.currentTodo.content)}\n`;
1258
- }
1259
- }
1260
- else {
1261
- statusText += 'Todos: None active\n';
1262
- }
1263
- // Agent status
1264
- const agentStats = this.agent.getStats();
1265
- if (agentStats) {
1266
- statusText += `Session: ${agentStats.toolCalls} tool calls, ${agentStats.llmCalls} LLM calls\n`;
1267
- }
1268
- console.log(statusText);
1269
- }
1270
- /**
1271
- * Format plan for display with proper text wrapping
1272
- */
1273
- formatPlanForDisplay(todos, qualityScore) {
1274
- const maxWidth = Math.min(process.stdout.columns - 10, 100); // Leave some margin
1275
- let formatted = `šŸ“‹ **Plan Created** (${todos.length} steps):\n\n`;
1276
- todos.forEach((todo, index) => {
1277
- const stepNumber = `${index + 1}. `;
1278
- const content = todo.content;
1279
- // Wrap long lines properly
1280
- const wrappedContent = this.wrapText(content, maxWidth - stepNumber.length);
1281
- const lines = wrappedContent.split('\n');
1282
- // First line with step number
1283
- formatted += stepNumber + lines[0] + '\n';
1284
- // Subsequent lines indented to align with content
1285
- for (let i = 1; i < lines.length; i++) {
1286
- formatted += ' '.repeat(stepNumber.length) + lines[i] + '\n';
1287
- }
1288
- // Add spacing between steps
1289
- if (index < todos.length - 1) {
1290
- formatted += '\n';
1291
- }
1292
- });
1293
- formatted += `\n\nQuality Score: ${qualityScore}/100`;
1294
- return formatted;
1295
- }
1296
- /**
1297
- * Wrap text to specified width
1298
- */
1299
- wrapText(text, maxWidth) {
1300
- if (text.length <= maxWidth) {
1301
- return text;
1302
- }
1303
- const words = text.split(' ');
1304
- const lines = [];
1305
- let currentLine = '';
1306
- for (const word of words) {
1307
- // If adding this word would exceed the width
1308
- if (currentLine.length + word.length + 1 > maxWidth) {
1309
- if (currentLine) {
1310
- lines.push(currentLine.trim());
1311
- currentLine = word;
1312
- }
1313
- else {
1314
- // Single word is longer than maxWidth, force break
1315
- lines.push(word);
1316
- }
1317
- }
1318
- else {
1319
- if (currentLine) {
1320
- currentLine += ' ' + word;
1321
- }
1322
- else {
1323
- currentLine = word;
1324
- }
1325
- }
1326
- }
1327
- if (currentLine) {
1328
- lines.push(currentLine.trim());
1329
- }
1330
- return lines.join('\n');
1331
- }
1332
- /**
1333
- * Cleanup resources
1334
- */
1335
- dispose() {
1336
- if (this.currentSpinner) {
1337
- this.currentSpinner.stop();
1338
- this.currentSpinner = undefined;
1339
- }
1340
- // Clean up todo tracking
1341
- this.progressTracker.stop();
1342
- TodoStateManager.removeEventCallback(this.handleTodoUpdate.bind(this));
1343
- }
1344
- }
1345
- //# sourceMappingURL=ui.js.map