orquesta-cli 0.1.12

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 (851) hide show
  1. package/.eslintrc.json +26 -0
  2. package/.prettierrc.json +10 -0
  3. package/CLAUDE.md +199 -0
  4. package/LICENSE +21 -0
  5. package/README.md +280 -0
  6. package/SECURITY.md +290 -0
  7. package/TEST_LOCAL.md +245 -0
  8. package/dist/agents/base/base-agent.d.ts +38 -0
  9. package/dist/agents/base/base-agent.d.ts.map +1 -0
  10. package/dist/agents/base/base-agent.js +69 -0
  11. package/dist/agents/base/base-agent.js.map +1 -0
  12. package/dist/agents/docs-search/index.d.ts +33 -0
  13. package/dist/agents/docs-search/index.d.ts.map +1 -0
  14. package/dist/agents/docs-search/index.js +244 -0
  15. package/dist/agents/docs-search/index.js.map +1 -0
  16. package/dist/agents/index.d.ts +4 -0
  17. package/dist/agents/index.d.ts.map +1 -0
  18. package/dist/agents/index.js +4 -0
  19. package/dist/agents/index.js.map +1 -0
  20. package/dist/agents/planner/index.d.ts +17 -0
  21. package/dist/agents/planner/index.d.ts.map +1 -0
  22. package/dist/agents/planner/index.js +250 -0
  23. package/dist/agents/planner/index.js.map +1 -0
  24. package/dist/cli.d.ts +3 -0
  25. package/dist/cli.d.ts.map +1 -0
  26. package/dist/cli.js +144 -0
  27. package/dist/cli.js.map +1 -0
  28. package/dist/constants.d.ts +8 -0
  29. package/dist/constants.d.ts.map +1 -0
  30. package/dist/constants.js +10 -0
  31. package/dist/constants.js.map +1 -0
  32. package/dist/core/compact/compact-manager.d.ts +22 -0
  33. package/dist/core/compact/compact-manager.d.ts.map +1 -0
  34. package/dist/core/compact/compact-manager.js +75 -0
  35. package/dist/core/compact/compact-manager.js.map +1 -0
  36. package/dist/core/compact/compact-prompts.d.ts +11 -0
  37. package/dist/core/compact/compact-prompts.d.ts.map +1 -0
  38. package/dist/core/compact/compact-prompts.js +90 -0
  39. package/dist/core/compact/compact-prompts.js.map +1 -0
  40. package/dist/core/compact/context-tracker.d.ts +28 -0
  41. package/dist/core/compact/context-tracker.d.ts.map +1 -0
  42. package/dist/core/compact/context-tracker.js +71 -0
  43. package/dist/core/compact/context-tracker.js.map +1 -0
  44. package/dist/core/compact/index.d.ts +4 -0
  45. package/dist/core/compact/index.d.ts.map +1 -0
  46. package/dist/core/compact/index.js +4 -0
  47. package/dist/core/compact/index.js.map +1 -0
  48. package/dist/core/config/config-manager.d.ts +44 -0
  49. package/dist/core/config/config-manager.d.ts.map +1 -0
  50. package/dist/core/config/config-manager.js +259 -0
  51. package/dist/core/config/config-manager.js.map +1 -0
  52. package/dist/core/config/index.d.ts +2 -0
  53. package/dist/core/config/index.d.ts.map +1 -0
  54. package/dist/core/config/index.js +2 -0
  55. package/dist/core/config/index.js.map +1 -0
  56. package/dist/core/docs-manager.d.ts +46 -0
  57. package/dist/core/docs-manager.d.ts.map +1 -0
  58. package/dist/core/docs-manager.js +475 -0
  59. package/dist/core/docs-manager.js.map +1 -0
  60. package/dist/core/git-auto-updater.d.ts +58 -0
  61. package/dist/core/git-auto-updater.d.ts.map +1 -0
  62. package/dist/core/git-auto-updater.js +374 -0
  63. package/dist/core/git-auto-updater.js.map +1 -0
  64. package/dist/core/llm/index.d.ts +2 -0
  65. package/dist/core/llm/index.d.ts.map +1 -0
  66. package/dist/core/llm/index.js +2 -0
  67. package/dist/core/llm/index.js.map +1 -0
  68. package/dist/core/llm/llm-client.d.ts +97 -0
  69. package/dist/core/llm/llm-client.d.ts.map +1 -0
  70. package/dist/core/llm/llm-client.js +1000 -0
  71. package/dist/core/llm/llm-client.js.map +1 -0
  72. package/dist/core/session/index.d.ts +2 -0
  73. package/dist/core/session/index.d.ts.map +1 -0
  74. package/dist/core/session/index.js +2 -0
  75. package/dist/core/session/index.js.map +1 -0
  76. package/dist/core/session/session-manager.d.ts +71 -0
  77. package/dist/core/session/session-manager.d.ts.map +1 -0
  78. package/dist/core/session/session-manager.js +250 -0
  79. package/dist/core/session/session-manager.js.map +1 -0
  80. package/dist/core/slash-command-handler.d.ts +31 -0
  81. package/dist/core/slash-command-handler.d.ts.map +1 -0
  82. package/dist/core/slash-command-handler.js +302 -0
  83. package/dist/core/slash-command-handler.js.map +1 -0
  84. package/dist/core/usage-tracker.d.ts +70 -0
  85. package/dist/core/usage-tracker.d.ts.map +1 -0
  86. package/dist/core/usage-tracker.js +251 -0
  87. package/dist/core/usage-tracker.js.map +1 -0
  88. package/dist/errors/base.d.ts +22 -0
  89. package/dist/errors/base.d.ts.map +1 -0
  90. package/dist/errors/base.js +43 -0
  91. package/dist/errors/base.js.map +1 -0
  92. package/dist/errors/file.d.ts +31 -0
  93. package/dist/errors/file.d.ts.map +1 -0
  94. package/dist/errors/file.js +110 -0
  95. package/dist/errors/file.js.map +1 -0
  96. package/dist/errors/index.d.ts +10 -0
  97. package/dist/errors/index.d.ts.map +1 -0
  98. package/dist/errors/index.js +41 -0
  99. package/dist/errors/index.js.map +1 -0
  100. package/dist/errors/llm.d.ts +26 -0
  101. package/dist/errors/llm.d.ts.map +1 -0
  102. package/dist/errors/llm.js +86 -0
  103. package/dist/errors/llm.js.map +1 -0
  104. package/dist/errors/network.d.ts +19 -0
  105. package/dist/errors/network.d.ts.map +1 -0
  106. package/dist/errors/network.js +82 -0
  107. package/dist/errors/network.js.map +1 -0
  108. package/dist/errors/validation.d.ts +19 -0
  109. package/dist/errors/validation.d.ts.map +1 -0
  110. package/dist/errors/validation.js +62 -0
  111. package/dist/errors/validation.js.map +1 -0
  112. package/dist/eval/eval-runner.d.ts +24 -0
  113. package/dist/eval/eval-runner.d.ts.map +1 -0
  114. package/dist/eval/eval-runner.js +309 -0
  115. package/dist/eval/eval-runner.js.map +1 -0
  116. package/dist/eval/index.d.ts +3 -0
  117. package/dist/eval/index.d.ts.map +1 -0
  118. package/dist/eval/index.js +3 -0
  119. package/dist/eval/index.js.map +1 -0
  120. package/dist/eval/types.d.ts +77 -0
  121. package/dist/eval/types.d.ts.map +1 -0
  122. package/dist/eval/types.js +2 -0
  123. package/dist/eval/types.js.map +1 -0
  124. package/dist/index.d.ts +4 -0
  125. package/dist/index.d.ts.map +1 -0
  126. package/dist/index.js +6 -0
  127. package/dist/index.js.map +1 -0
  128. package/dist/orchestration/index.d.ts +4 -0
  129. package/dist/orchestration/index.d.ts.map +1 -0
  130. package/dist/orchestration/index.js +3 -0
  131. package/dist/orchestration/index.js.map +1 -0
  132. package/dist/orchestration/plan-executor.d.ts +28 -0
  133. package/dist/orchestration/plan-executor.d.ts.map +1 -0
  134. package/dist/orchestration/plan-executor.js +382 -0
  135. package/dist/orchestration/plan-executor.js.map +1 -0
  136. package/dist/orchestration/types.d.ts +66 -0
  137. package/dist/orchestration/types.d.ts.map +1 -0
  138. package/dist/orchestration/types.js +2 -0
  139. package/dist/orchestration/types.js.map +1 -0
  140. package/dist/orchestration/utils.d.ts +13 -0
  141. package/dist/orchestration/utils.d.ts.map +1 -0
  142. package/dist/orchestration/utils.js +78 -0
  143. package/dist/orchestration/utils.js.map +1 -0
  144. package/dist/orquesta/connection.d.ts +35 -0
  145. package/dist/orquesta/connection.d.ts.map +1 -0
  146. package/dist/orquesta/connection.js +189 -0
  147. package/dist/orquesta/connection.js.map +1 -0
  148. package/dist/prompts/agents/docs-search-decision.d.ts +6 -0
  149. package/dist/prompts/agents/docs-search-decision.d.ts.map +1 -0
  150. package/dist/prompts/agents/docs-search-decision.js +46 -0
  151. package/dist/prompts/agents/docs-search-decision.js.map +1 -0
  152. package/dist/prompts/agents/docs-search.d.ts +4 -0
  153. package/dist/prompts/agents/docs-search.d.ts.map +1 -0
  154. package/dist/prompts/agents/docs-search.js +70 -0
  155. package/dist/prompts/agents/docs-search.js.map +1 -0
  156. package/dist/prompts/agents/planning.d.ts +4 -0
  157. package/dist/prompts/agents/planning.d.ts.map +1 -0
  158. package/dist/prompts/agents/planning.js +119 -0
  159. package/dist/prompts/agents/planning.js.map +1 -0
  160. package/dist/prompts/index.d.ts +10 -0
  161. package/dist/prompts/index.d.ts.map +1 -0
  162. package/dist/prompts/index.js +10 -0
  163. package/dist/prompts/index.js.map +1 -0
  164. package/dist/prompts/shared/codebase-rules.d.ts +4 -0
  165. package/dist/prompts/shared/codebase-rules.d.ts.map +1 -0
  166. package/dist/prompts/shared/codebase-rules.js +16 -0
  167. package/dist/prompts/shared/codebase-rules.js.map +1 -0
  168. package/dist/prompts/shared/git-rules.d.ts +2 -0
  169. package/dist/prompts/shared/git-rules.d.ts.map +1 -0
  170. package/dist/prompts/shared/git-rules.js +87 -0
  171. package/dist/prompts/shared/git-rules.js.map +1 -0
  172. package/dist/prompts/shared/language-rules.d.ts +4 -0
  173. package/dist/prompts/shared/language-rules.d.ts.map +1 -0
  174. package/dist/prompts/shared/language-rules.js +22 -0
  175. package/dist/prompts/shared/language-rules.js.map +1 -0
  176. package/dist/prompts/shared/tool-usage.d.ts +12 -0
  177. package/dist/prompts/shared/tool-usage.d.ts.map +1 -0
  178. package/dist/prompts/shared/tool-usage.js +51 -0
  179. package/dist/prompts/shared/tool-usage.js.map +1 -0
  180. package/dist/prompts/system/compact.d.ts +3 -0
  181. package/dist/prompts/system/compact.d.ts.map +1 -0
  182. package/dist/prompts/system/compact.js +73 -0
  183. package/dist/prompts/system/compact.js.map +1 -0
  184. package/dist/prompts/system/plan-execute.d.ts +3 -0
  185. package/dist/prompts/system/plan-execute.d.ts.map +1 -0
  186. package/dist/prompts/system/plan-execute.js +83 -0
  187. package/dist/prompts/system/plan-execute.js.map +1 -0
  188. package/dist/tools/browser/browser-client.d.ts +107 -0
  189. package/dist/tools/browser/browser-client.d.ts.map +1 -0
  190. package/dist/tools/browser/browser-client.js +958 -0
  191. package/dist/tools/browser/browser-client.js.map +1 -0
  192. package/dist/tools/browser/browser-tools.d.ts +17 -0
  193. package/dist/tools/browser/browser-tools.d.ts.map +1 -0
  194. package/dist/tools/browser/browser-tools.js +972 -0
  195. package/dist/tools/browser/browser-tools.js.map +1 -0
  196. package/dist/tools/browser/index.d.ts +7 -0
  197. package/dist/tools/browser/index.d.ts.map +1 -0
  198. package/dist/tools/browser/index.js +17 -0
  199. package/dist/tools/browser/index.js.map +1 -0
  200. package/dist/tools/index.d.ts +4 -0
  201. package/dist/tools/index.d.ts.map +1 -0
  202. package/dist/tools/index.js +4 -0
  203. package/dist/tools/index.js.map +1 -0
  204. package/dist/tools/llm/agents/docs-search-tools.d.ts +17 -0
  205. package/dist/tools/llm/agents/docs-search-tools.d.ts.map +1 -0
  206. package/dist/tools/llm/agents/docs-search-tools.js +265 -0
  207. package/dist/tools/llm/agents/docs-search-tools.js.map +1 -0
  208. package/dist/tools/llm/agents/index.d.ts +4 -0
  209. package/dist/tools/llm/agents/index.d.ts.map +1 -0
  210. package/dist/tools/llm/agents/index.js +3 -0
  211. package/dist/tools/llm/agents/index.js.map +1 -0
  212. package/dist/tools/llm/index.d.ts +3 -0
  213. package/dist/tools/llm/index.d.ts.map +1 -0
  214. package/dist/tools/llm/index.js +3 -0
  215. package/dist/tools/llm/index.js.map +1 -0
  216. package/dist/tools/llm/simple/ask-user-tool.d.ts +5 -0
  217. package/dist/tools/llm/simple/ask-user-tool.d.ts.map +1 -0
  218. package/dist/tools/llm/simple/ask-user-tool.js +7 -0
  219. package/dist/tools/llm/simple/ask-user-tool.js.map +1 -0
  220. package/dist/tools/llm/simple/background-bash-tool.d.ts +30 -0
  221. package/dist/tools/llm/simple/background-bash-tool.d.ts.map +1 -0
  222. package/dist/tools/llm/simple/background-bash-tool.js +323 -0
  223. package/dist/tools/llm/simple/background-bash-tool.js.map +1 -0
  224. package/dist/tools/llm/simple/background-powershell-tool.d.ts +30 -0
  225. package/dist/tools/llm/simple/background-powershell-tool.d.ts.map +1 -0
  226. package/dist/tools/llm/simple/background-powershell-tool.js +305 -0
  227. package/dist/tools/llm/simple/background-powershell-tool.js.map +1 -0
  228. package/dist/tools/llm/simple/bash-tool.d.ts +4 -0
  229. package/dist/tools/llm/simple/bash-tool.d.ts.map +1 -0
  230. package/dist/tools/llm/simple/bash-tool.js +178 -0
  231. package/dist/tools/llm/simple/bash-tool.js.map +1 -0
  232. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts +6 -0
  233. package/dist/tools/llm/simple/docs-search-agent-tool.d.ts.map +1 -0
  234. package/dist/tools/llm/simple/docs-search-agent-tool.js +104 -0
  235. package/dist/tools/llm/simple/docs-search-agent-tool.js.map +1 -0
  236. package/dist/tools/llm/simple/file-tools.d.ts +13 -0
  237. package/dist/tools/llm/simple/file-tools.d.ts.map +1 -0
  238. package/dist/tools/llm/simple/file-tools.js +785 -0
  239. package/dist/tools/llm/simple/file-tools.js.map +1 -0
  240. package/dist/tools/llm/simple/final-response-tool.d.ts +12 -0
  241. package/dist/tools/llm/simple/final-response-tool.d.ts.map +1 -0
  242. package/dist/tools/llm/simple/final-response-tool.js +107 -0
  243. package/dist/tools/llm/simple/final-response-tool.js.map +1 -0
  244. package/dist/tools/llm/simple/index.d.ts +11 -0
  245. package/dist/tools/llm/simple/index.d.ts.map +1 -0
  246. package/dist/tools/llm/simple/index.js +20 -0
  247. package/dist/tools/llm/simple/index.js.map +1 -0
  248. package/dist/tools/llm/simple/planning-tools.d.ts +5 -0
  249. package/dist/tools/llm/simple/planning-tools.d.ts.map +1 -0
  250. package/dist/tools/llm/simple/planning-tools.js +117 -0
  251. package/dist/tools/llm/simple/planning-tools.js.map +1 -0
  252. package/dist/tools/llm/simple/powershell-tool.d.ts +4 -0
  253. package/dist/tools/llm/simple/powershell-tool.d.ts.map +1 -0
  254. package/dist/tools/llm/simple/powershell-tool.js +178 -0
  255. package/dist/tools/llm/simple/powershell-tool.js.map +1 -0
  256. package/dist/tools/llm/simple/simple-tool-executor.d.ts +38 -0
  257. package/dist/tools/llm/simple/simple-tool-executor.d.ts.map +1 -0
  258. package/dist/tools/llm/simple/simple-tool-executor.js +134 -0
  259. package/dist/tools/llm/simple/simple-tool-executor.js.map +1 -0
  260. package/dist/tools/llm/simple/todo-tools.d.ts +15 -0
  261. package/dist/tools/llm/simple/todo-tools.d.ts.map +1 -0
  262. package/dist/tools/llm/simple/todo-tools.js +145 -0
  263. package/dist/tools/llm/simple/todo-tools.js.map +1 -0
  264. package/dist/tools/llm/simple/user-interaction-tools.d.ts +22 -0
  265. package/dist/tools/llm/simple/user-interaction-tools.d.ts.map +1 -0
  266. package/dist/tools/llm/simple/user-interaction-tools.js +168 -0
  267. package/dist/tools/llm/simple/user-interaction-tools.js.map +1 -0
  268. package/dist/tools/office/common/constants.d.ts +194 -0
  269. package/dist/tools/office/common/constants.d.ts.map +1 -0
  270. package/dist/tools/office/common/constants.js +169 -0
  271. package/dist/tools/office/common/constants.js.map +1 -0
  272. package/dist/tools/office/common/index.d.ts +4 -0
  273. package/dist/tools/office/common/index.d.ts.map +1 -0
  274. package/dist/tools/office/common/index.js +3 -0
  275. package/dist/tools/office/common/index.js.map +1 -0
  276. package/dist/tools/office/common/types.d.ts +82 -0
  277. package/dist/tools/office/common/types.d.ts.map +1 -0
  278. package/dist/tools/office/common/types.js +2 -0
  279. package/dist/tools/office/common/types.js.map +1 -0
  280. package/dist/tools/office/common/utils.d.ts +14 -0
  281. package/dist/tools/office/common/utils.d.ts.map +1 -0
  282. package/dist/tools/office/common/utils.js +58 -0
  283. package/dist/tools/office/common/utils.js.map +1 -0
  284. package/dist/tools/office/excel-client.d.ts +123 -0
  285. package/dist/tools/office/excel-client.d.ts.map +1 -0
  286. package/dist/tools/office/excel-client.js +1037 -0
  287. package/dist/tools/office/excel-client.js.map +1 -0
  288. package/dist/tools/office/excel-tools/cells.d.ts +10 -0
  289. package/dist/tools/office/excel-tools/cells.d.ts.map +1 -0
  290. package/dist/tools/office/excel-tools/cells.js +279 -0
  291. package/dist/tools/office/excel-tools/cells.js.map +1 -0
  292. package/dist/tools/office/excel-tools/charts.d.ts +6 -0
  293. package/dist/tools/office/excel-tools/charts.d.ts.map +1 -0
  294. package/dist/tools/office/excel-tools/charts.js +124 -0
  295. package/dist/tools/office/excel-tools/charts.js.map +1 -0
  296. package/dist/tools/office/excel-tools/comments.d.ts +6 -0
  297. package/dist/tools/office/excel-tools/comments.d.ts.map +1 -0
  298. package/dist/tools/office/excel-tools/comments.js +114 -0
  299. package/dist/tools/office/excel-tools/comments.js.map +1 -0
  300. package/dist/tools/office/excel-tools/data-ops.d.ts +10 -0
  301. package/dist/tools/office/excel-tools/data-ops.d.ts.map +1 -0
  302. package/dist/tools/office/excel-tools/data-ops.js +266 -0
  303. package/dist/tools/office/excel-tools/data-ops.js.map +1 -0
  304. package/dist/tools/office/excel-tools/export.d.ts +5 -0
  305. package/dist/tools/office/excel-tools/export.d.ts.map +1 -0
  306. package/dist/tools/office/excel-tools/export.js +75 -0
  307. package/dist/tools/office/excel-tools/export.js.map +1 -0
  308. package/dist/tools/office/excel-tools/formatting.d.ts +10 -0
  309. package/dist/tools/office/excel-tools/formatting.d.ts.map +1 -0
  310. package/dist/tools/office/excel-tools/formatting.js +276 -0
  311. package/dist/tools/office/excel-tools/formatting.js.map +1 -0
  312. package/dist/tools/office/excel-tools/index.d.ts +16 -0
  313. package/dist/tools/office/excel-tools/index.d.ts.map +1 -0
  314. package/dist/tools/office/excel-tools/index.js +42 -0
  315. package/dist/tools/office/excel-tools/index.js.map +1 -0
  316. package/dist/tools/office/excel-tools/launch.d.ts +10 -0
  317. package/dist/tools/office/excel-tools/launch.d.ts.map +1 -0
  318. package/dist/tools/office/excel-tools/launch.js +248 -0
  319. package/dist/tools/office/excel-tools/launch.js.map +1 -0
  320. package/dist/tools/office/excel-tools/media.d.ts +5 -0
  321. package/dist/tools/office/excel-tools/media.d.ts.map +1 -0
  322. package/dist/tools/office/excel-tools/media.js +84 -0
  323. package/dist/tools/office/excel-tools/media.js.map +1 -0
  324. package/dist/tools/office/excel-tools/named-ranges.d.ts +6 -0
  325. package/dist/tools/office/excel-tools/named-ranges.d.ts.map +1 -0
  326. package/dist/tools/office/excel-tools/named-ranges.js +113 -0
  327. package/dist/tools/office/excel-tools/named-ranges.js.map +1 -0
  328. package/dist/tools/office/excel-tools/protection.d.ts +5 -0
  329. package/dist/tools/office/excel-tools/protection.d.ts.map +1 -0
  330. package/dist/tools/office/excel-tools/protection.js +75 -0
  331. package/dist/tools/office/excel-tools/protection.js.map +1 -0
  332. package/dist/tools/office/excel-tools/rows-columns.d.ts +11 -0
  333. package/dist/tools/office/excel-tools/rows-columns.d.ts.map +1 -0
  334. package/dist/tools/office/excel-tools/rows-columns.js +293 -0
  335. package/dist/tools/office/excel-tools/rows-columns.js.map +1 -0
  336. package/dist/tools/office/excel-tools/sheets.d.ts +8 -0
  337. package/dist/tools/office/excel-tools/sheets.d.ts.map +1 -0
  338. package/dist/tools/office/excel-tools/sheets.js +177 -0
  339. package/dist/tools/office/excel-tools/sheets.js.map +1 -0
  340. package/dist/tools/office/excel-tools/validation.d.ts +7 -0
  341. package/dist/tools/office/excel-tools/validation.d.ts.map +1 -0
  342. package/dist/tools/office/excel-tools/validation.js +175 -0
  343. package/dist/tools/office/excel-tools/validation.js.map +1 -0
  344. package/dist/tools/office/excel-tools.d.ts +3 -0
  345. package/dist/tools/office/excel-tools.d.ts.map +1 -0
  346. package/dist/tools/office/excel-tools.js +3 -0
  347. package/dist/tools/office/excel-tools.js.map +1 -0
  348. package/dist/tools/office/index.d.ts +6 -0
  349. package/dist/tools/office/index.d.ts.map +1 -0
  350. package/dist/tools/office/index.js +9 -0
  351. package/dist/tools/office/index.js.map +1 -0
  352. package/dist/tools/office/office-client-base.d.ts +31 -0
  353. package/dist/tools/office/office-client-base.d.ts.map +1 -0
  354. package/dist/tools/office/office-client-base.js +154 -0
  355. package/dist/tools/office/office-client-base.js.map +1 -0
  356. package/dist/tools/office/office-client.d.ts +196 -0
  357. package/dist/tools/office/office-client.d.ts.map +1 -0
  358. package/dist/tools/office/office-client.js +200 -0
  359. package/dist/tools/office/office-client.js.map +1 -0
  360. package/dist/tools/office/powerpoint-client.d.ts +135 -0
  361. package/dist/tools/office/powerpoint-client.d.ts.map +1 -0
  362. package/dist/tools/office/powerpoint-client.js +1136 -0
  363. package/dist/tools/office/powerpoint-client.js.map +1 -0
  364. package/dist/tools/office/powerpoint-tools/effects.d.ts +9 -0
  365. package/dist/tools/office/powerpoint-tools/effects.d.ts.map +1 -0
  366. package/dist/tools/office/powerpoint-tools/effects.js +246 -0
  367. package/dist/tools/office/powerpoint-tools/effects.js.map +1 -0
  368. package/dist/tools/office/powerpoint-tools/export.d.ts +6 -0
  369. package/dist/tools/office/powerpoint-tools/export.d.ts.map +1 -0
  370. package/dist/tools/office/powerpoint-tools/export.js +108 -0
  371. package/dist/tools/office/powerpoint-tools/export.js.map +1 -0
  372. package/dist/tools/office/powerpoint-tools/index.d.ts +13 -0
  373. package/dist/tools/office/powerpoint-tools/index.d.ts.map +1 -0
  374. package/dist/tools/office/powerpoint-tools/index.js +33 -0
  375. package/dist/tools/office/powerpoint-tools/index.js.map +1 -0
  376. package/dist/tools/office/powerpoint-tools/launch.d.ts +9 -0
  377. package/dist/tools/office/powerpoint-tools/launch.d.ts.map +1 -0
  378. package/dist/tools/office/powerpoint-tools/launch.js +214 -0
  379. package/dist/tools/office/powerpoint-tools/launch.js.map +1 -0
  380. package/dist/tools/office/powerpoint-tools/media.d.ts +8 -0
  381. package/dist/tools/office/powerpoint-tools/media.d.ts.map +1 -0
  382. package/dist/tools/office/powerpoint-tools/media.js +211 -0
  383. package/dist/tools/office/powerpoint-tools/media.js.map +1 -0
  384. package/dist/tools/office/powerpoint-tools/notes.d.ts +8 -0
  385. package/dist/tools/office/powerpoint-tools/notes.d.ts.map +1 -0
  386. package/dist/tools/office/powerpoint-tools/notes.js +171 -0
  387. package/dist/tools/office/powerpoint-tools/notes.js.map +1 -0
  388. package/dist/tools/office/powerpoint-tools/sections.d.ts +6 -0
  389. package/dist/tools/office/powerpoint-tools/sections.d.ts.map +1 -0
  390. package/dist/tools/office/powerpoint-tools/sections.js +104 -0
  391. package/dist/tools/office/powerpoint-tools/sections.js.map +1 -0
  392. package/dist/tools/office/powerpoint-tools/shapes.d.ts +22 -0
  393. package/dist/tools/office/powerpoint-tools/shapes.d.ts.map +1 -0
  394. package/dist/tools/office/powerpoint-tools/shapes.js +681 -0
  395. package/dist/tools/office/powerpoint-tools/shapes.js.map +1 -0
  396. package/dist/tools/office/powerpoint-tools/slides.d.ts +11 -0
  397. package/dist/tools/office/powerpoint-tools/slides.d.ts.map +1 -0
  398. package/dist/tools/office/powerpoint-tools/slides.js +283 -0
  399. package/dist/tools/office/powerpoint-tools/slides.js.map +1 -0
  400. package/dist/tools/office/powerpoint-tools/tables.d.ts +6 -0
  401. package/dist/tools/office/powerpoint-tools/tables.d.ts.map +1 -0
  402. package/dist/tools/office/powerpoint-tools/tables.js +132 -0
  403. package/dist/tools/office/powerpoint-tools/tables.js.map +1 -0
  404. package/dist/tools/office/powerpoint-tools/text.d.ts +12 -0
  405. package/dist/tools/office/powerpoint-tools/text.d.ts.map +1 -0
  406. package/dist/tools/office/powerpoint-tools/text.js +366 -0
  407. package/dist/tools/office/powerpoint-tools/text.js.map +1 -0
  408. package/dist/tools/office/powerpoint-tools.d.ts +3 -0
  409. package/dist/tools/office/powerpoint-tools.d.ts.map +1 -0
  410. package/dist/tools/office/powerpoint-tools.js +3 -0
  411. package/dist/tools/office/powerpoint-tools.js.map +1 -0
  412. package/dist/tools/office/word-client.d.ts +147 -0
  413. package/dist/tools/office/word-client.d.ts.map +1 -0
  414. package/dist/tools/office/word-client.js +1341 -0
  415. package/dist/tools/office/word-client.js.map +1 -0
  416. package/dist/tools/office/word-tools/bookmarks.d.ts +7 -0
  417. package/dist/tools/office/word-tools/bookmarks.d.ts.map +1 -0
  418. package/dist/tools/office/word-tools/bookmarks.js +146 -0
  419. package/dist/tools/office/word-tools/bookmarks.js.map +1 -0
  420. package/dist/tools/office/word-tools/comments.d.ts +7 -0
  421. package/dist/tools/office/word-tools/comments.d.ts.map +1 -0
  422. package/dist/tools/office/word-tools/comments.js +146 -0
  423. package/dist/tools/office/word-tools/comments.js.map +1 -0
  424. package/dist/tools/office/word-tools/content.d.ts +7 -0
  425. package/dist/tools/office/word-tools/content.d.ts.map +1 -0
  426. package/dist/tools/office/word-tools/content.js +168 -0
  427. package/dist/tools/office/word-tools/content.js.map +1 -0
  428. package/dist/tools/office/word-tools/export.d.ts +5 -0
  429. package/dist/tools/office/word-tools/export.d.ts.map +1 -0
  430. package/dist/tools/office/word-tools/export.js +73 -0
  431. package/dist/tools/office/word-tools/export.js.map +1 -0
  432. package/dist/tools/office/word-tools/formatting.d.ts +6 -0
  433. package/dist/tools/office/word-tools/formatting.d.ts.map +1 -0
  434. package/dist/tools/office/word-tools/formatting.js +129 -0
  435. package/dist/tools/office/word-tools/formatting.js.map +1 -0
  436. package/dist/tools/office/word-tools/headers-footers.d.ts +6 -0
  437. package/dist/tools/office/word-tools/headers-footers.d.ts.map +1 -0
  438. package/dist/tools/office/word-tools/headers-footers.js +117 -0
  439. package/dist/tools/office/word-tools/headers-footers.js.map +1 -0
  440. package/dist/tools/office/word-tools/index.d.ts +16 -0
  441. package/dist/tools/office/word-tools/index.d.ts.map +1 -0
  442. package/dist/tools/office/word-tools/index.js +45 -0
  443. package/dist/tools/office/word-tools/index.js.map +1 -0
  444. package/dist/tools/office/word-tools/launch.d.ts +10 -0
  445. package/dist/tools/office/word-tools/launch.d.ts.map +1 -0
  446. package/dist/tools/office/word-tools/launch.js +255 -0
  447. package/dist/tools/office/word-tools/launch.js.map +1 -0
  448. package/dist/tools/office/word-tools/lists.d.ts +5 -0
  449. package/dist/tools/office/word-tools/lists.d.ts.map +1 -0
  450. package/dist/tools/office/word-tools/lists.js +73 -0
  451. package/dist/tools/office/word-tools/lists.js.map +1 -0
  452. package/dist/tools/office/word-tools/navigation.d.ts +5 -0
  453. package/dist/tools/office/word-tools/navigation.d.ts.map +1 -0
  454. package/dist/tools/office/word-tools/navigation.js +85 -0
  455. package/dist/tools/office/word-tools/navigation.js.map +1 -0
  456. package/dist/tools/office/word-tools/page-setup.d.ts +7 -0
  457. package/dist/tools/office/word-tools/page-setup.d.ts.map +1 -0
  458. package/dist/tools/office/word-tools/page-setup.js +152 -0
  459. package/dist/tools/office/word-tools/page-setup.js.map +1 -0
  460. package/dist/tools/office/word-tools/tables.d.ts +8 -0
  461. package/dist/tools/office/word-tools/tables.d.ts.map +1 -0
  462. package/dist/tools/office/word-tools/tables.js +197 -0
  463. package/dist/tools/office/word-tools/tables.js.map +1 -0
  464. package/dist/tools/office/word-tools/text.d.ts +9 -0
  465. package/dist/tools/office/word-tools/text.d.ts.map +1 -0
  466. package/dist/tools/office/word-tools/text.js +235 -0
  467. package/dist/tools/office/word-tools/text.js.map +1 -0
  468. package/dist/tools/office/word-tools/undo-redo.d.ts +5 -0
  469. package/dist/tools/office/word-tools/undo-redo.d.ts.map +1 -0
  470. package/dist/tools/office/word-tools/undo-redo.js +73 -0
  471. package/dist/tools/office/word-tools/undo-redo.js.map +1 -0
  472. package/dist/tools/office/word-tools/watermarks.d.ts +5 -0
  473. package/dist/tools/office/word-tools/watermarks.d.ts.map +1 -0
  474. package/dist/tools/office/word-tools/watermarks.js +81 -0
  475. package/dist/tools/office/word-tools/watermarks.js.map +1 -0
  476. package/dist/tools/office/word-tools.d.ts +3 -0
  477. package/dist/tools/office/word-tools.d.ts.map +1 -0
  478. package/dist/tools/office/word-tools.js +3 -0
  479. package/dist/tools/office/word-tools.js.map +1 -0
  480. package/dist/tools/registry.d.ts +53 -0
  481. package/dist/tools/registry.d.ts.map +1 -0
  482. package/dist/tools/registry.js +278 -0
  483. package/dist/tools/registry.js.map +1 -0
  484. package/dist/tools/types.d.ts +88 -0
  485. package/dist/tools/types.d.ts.map +1 -0
  486. package/dist/tools/types.js +19 -0
  487. package/dist/tools/types.js.map +1 -0
  488. package/dist/types/index.d.ts +126 -0
  489. package/dist/types/index.d.ts.map +1 -0
  490. package/dist/types/index.js +2 -0
  491. package/dist/types/index.js.map +1 -0
  492. package/dist/ui/PlanExecuteView.d.ts +11 -0
  493. package/dist/ui/PlanExecuteView.d.ts.map +1 -0
  494. package/dist/ui/PlanExecuteView.js +29 -0
  495. package/dist/ui/PlanExecuteView.js.map +1 -0
  496. package/dist/ui/TodoPanel.d.ts +13 -0
  497. package/dist/ui/TodoPanel.d.ts.map +1 -0
  498. package/dist/ui/TodoPanel.js +135 -0
  499. package/dist/ui/TodoPanel.js.map +1 -0
  500. package/dist/ui/UpdateNotification.d.ts +13 -0
  501. package/dist/ui/UpdateNotification.d.ts.map +1 -0
  502. package/dist/ui/UpdateNotification.js +42 -0
  503. package/dist/ui/UpdateNotification.js.map +1 -0
  504. package/dist/ui/components/ActivityIndicator.d.ts +25 -0
  505. package/dist/ui/components/ActivityIndicator.d.ts.map +1 -0
  506. package/dist/ui/components/ActivityIndicator.js +115 -0
  507. package/dist/ui/components/ActivityIndicator.js.map +1 -0
  508. package/dist/ui/components/CommandBrowser.d.ts +10 -0
  509. package/dist/ui/components/CommandBrowser.d.ts.map +1 -0
  510. package/dist/ui/components/CommandBrowser.js +53 -0
  511. package/dist/ui/components/CommandBrowser.js.map +1 -0
  512. package/dist/ui/components/CustomTextInput.d.ts +13 -0
  513. package/dist/ui/components/CustomTextInput.d.ts.map +1 -0
  514. package/dist/ui/components/CustomTextInput.js +245 -0
  515. package/dist/ui/components/CustomTextInput.js.map +1 -0
  516. package/dist/ui/components/DocsSearchProgress.d.ts +13 -0
  517. package/dist/ui/components/DocsSearchProgress.d.ts.map +1 -0
  518. package/dist/ui/components/DocsSearchProgress.js +37 -0
  519. package/dist/ui/components/DocsSearchProgress.js.map +1 -0
  520. package/dist/ui/components/FileBrowser.d.ts +11 -0
  521. package/dist/ui/components/FileBrowser.d.ts.map +1 -0
  522. package/dist/ui/components/FileBrowser.js +45 -0
  523. package/dist/ui/components/FileBrowser.js.map +1 -0
  524. package/dist/ui/components/LLMSetupWizard.d.ts +8 -0
  525. package/dist/ui/components/LLMSetupWizard.d.ts.map +1 -0
  526. package/dist/ui/components/LLMSetupWizard.js +192 -0
  527. package/dist/ui/components/LLMSetupWizard.js.map +1 -0
  528. package/dist/ui/components/Logo.d.ts +19 -0
  529. package/dist/ui/components/Logo.d.ts.map +1 -0
  530. package/dist/ui/components/Logo.js +55 -0
  531. package/dist/ui/components/Logo.js.map +1 -0
  532. package/dist/ui/components/MarkdownRenderer.d.ts +9 -0
  533. package/dist/ui/components/MarkdownRenderer.d.ts.map +1 -0
  534. package/dist/ui/components/MarkdownRenderer.js +198 -0
  535. package/dist/ui/components/MarkdownRenderer.js.map +1 -0
  536. package/dist/ui/components/ModelSelector.d.ts +8 -0
  537. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  538. package/dist/ui/components/ModelSelector.js +111 -0
  539. package/dist/ui/components/ModelSelector.js.map +1 -0
  540. package/dist/ui/components/PlanExecuteApp.d.ts +23 -0
  541. package/dist/ui/components/PlanExecuteApp.d.ts.map +1 -0
  542. package/dist/ui/components/PlanExecuteApp.js +1324 -0
  543. package/dist/ui/components/PlanExecuteApp.js.map +1 -0
  544. package/dist/ui/components/ProgressBar.d.ts +10 -0
  545. package/dist/ui/components/ProgressBar.d.ts.map +1 -0
  546. package/dist/ui/components/ProgressBar.js +26 -0
  547. package/dist/ui/components/ProgressBar.js.map +1 -0
  548. package/dist/ui/components/StatusBar.d.ts +23 -0
  549. package/dist/ui/components/StatusBar.d.ts.map +1 -0
  550. package/dist/ui/components/StatusBar.js +162 -0
  551. package/dist/ui/components/StatusBar.js.map +1 -0
  552. package/dist/ui/components/ThinkingIndicator.d.ts +14 -0
  553. package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
  554. package/dist/ui/components/ThinkingIndicator.js +63 -0
  555. package/dist/ui/components/ThinkingIndicator.js.map +1 -0
  556. package/dist/ui/components/TodoListView.d.ts +11 -0
  557. package/dist/ui/components/TodoListView.d.ts.map +1 -0
  558. package/dist/ui/components/TodoListView.js +69 -0
  559. package/dist/ui/components/TodoListView.js.map +1 -0
  560. package/dist/ui/components/ToolSelector.d.ts +7 -0
  561. package/dist/ui/components/ToolSelector.d.ts.map +1 -0
  562. package/dist/ui/components/ToolSelector.js +111 -0
  563. package/dist/ui/components/ToolSelector.js.map +1 -0
  564. package/dist/ui/components/dialogs/ApprovalDialog.d.ts +13 -0
  565. package/dist/ui/components/dialogs/ApprovalDialog.d.ts.map +1 -0
  566. package/dist/ui/components/dialogs/ApprovalDialog.js +173 -0
  567. package/dist/ui/components/dialogs/ApprovalDialog.js.map +1 -0
  568. package/dist/ui/components/dialogs/AskUserDialog.d.ts +9 -0
  569. package/dist/ui/components/dialogs/AskUserDialog.d.ts.map +1 -0
  570. package/dist/ui/components/dialogs/AskUserDialog.js +111 -0
  571. package/dist/ui/components/dialogs/AskUserDialog.js.map +1 -0
  572. package/dist/ui/components/dialogs/DocsBrowser.d.ts +8 -0
  573. package/dist/ui/components/dialogs/DocsBrowser.d.ts.map +1 -0
  574. package/dist/ui/components/dialogs/DocsBrowser.js +127 -0
  575. package/dist/ui/components/dialogs/DocsBrowser.js.map +1 -0
  576. package/dist/ui/components/dialogs/SettingsDialog.d.ts +10 -0
  577. package/dist/ui/components/dialogs/SettingsDialog.d.ts.map +1 -0
  578. package/dist/ui/components/dialogs/SettingsDialog.js +563 -0
  579. package/dist/ui/components/dialogs/SettingsDialog.js.map +1 -0
  580. package/dist/ui/components/dialogs/index.d.ts +4 -0
  581. package/dist/ui/components/dialogs/index.d.ts.map +1 -0
  582. package/dist/ui/components/dialogs/index.js +4 -0
  583. package/dist/ui/components/dialogs/index.js.map +1 -0
  584. package/dist/ui/components/index.d.ts +12 -0
  585. package/dist/ui/components/index.d.ts.map +1 -0
  586. package/dist/ui/components/index.js +9 -0
  587. package/dist/ui/components/index.js.map +1 -0
  588. package/dist/ui/components/panels/LogPanel.d.ts +7 -0
  589. package/dist/ui/components/panels/LogPanel.d.ts.map +1 -0
  590. package/dist/ui/components/panels/LogPanel.js +280 -0
  591. package/dist/ui/components/panels/LogPanel.js.map +1 -0
  592. package/dist/ui/components/panels/SessionPanel.d.ts +8 -0
  593. package/dist/ui/components/panels/SessionPanel.d.ts.map +1 -0
  594. package/dist/ui/components/panels/SessionPanel.js +81 -0
  595. package/dist/ui/components/panels/SessionPanel.js.map +1 -0
  596. package/dist/ui/components/panels/index.d.ts +4 -0
  597. package/dist/ui/components/panels/index.d.ts.map +1 -0
  598. package/dist/ui/components/panels/index.js +4 -0
  599. package/dist/ui/components/panels/index.js.map +1 -0
  600. package/dist/ui/components/views/ChatView.d.ts +12 -0
  601. package/dist/ui/components/views/ChatView.d.ts.map +1 -0
  602. package/dist/ui/components/views/ChatView.js +289 -0
  603. package/dist/ui/components/views/ChatView.js.map +1 -0
  604. package/dist/ui/components/views/index.d.ts +2 -0
  605. package/dist/ui/components/views/index.d.ts.map +1 -0
  606. package/dist/ui/components/views/index.js +2 -0
  607. package/dist/ui/components/views/index.js.map +1 -0
  608. package/dist/ui/contexts/TokenContext.d.ts +29 -0
  609. package/dist/ui/contexts/TokenContext.d.ts.map +1 -0
  610. package/dist/ui/contexts/TokenContext.js +79 -0
  611. package/dist/ui/contexts/TokenContext.js.map +1 -0
  612. package/dist/ui/hooks/atFileProcessor.d.ts +15 -0
  613. package/dist/ui/hooks/atFileProcessor.d.ts.map +1 -0
  614. package/dist/ui/hooks/atFileProcessor.js +88 -0
  615. package/dist/ui/hooks/atFileProcessor.js.map +1 -0
  616. package/dist/ui/hooks/index.d.ts +8 -0
  617. package/dist/ui/hooks/index.d.ts.map +1 -0
  618. package/dist/ui/hooks/index.js +8 -0
  619. package/dist/ui/hooks/index.js.map +1 -0
  620. package/dist/ui/hooks/slashCommandProcessor.d.ts +21 -0
  621. package/dist/ui/hooks/slashCommandProcessor.d.ts.map +1 -0
  622. package/dist/ui/hooks/slashCommandProcessor.js +100 -0
  623. package/dist/ui/hooks/slashCommandProcessor.js.map +1 -0
  624. package/dist/ui/hooks/useCommandBrowserState.d.ts +12 -0
  625. package/dist/ui/hooks/useCommandBrowserState.d.ts.map +1 -0
  626. package/dist/ui/hooks/useCommandBrowserState.js +66 -0
  627. package/dist/ui/hooks/useCommandBrowserState.js.map +1 -0
  628. package/dist/ui/hooks/useFileBrowserState.d.ts +15 -0
  629. package/dist/ui/hooks/useFileBrowserState.d.ts.map +1 -0
  630. package/dist/ui/hooks/useFileBrowserState.js +80 -0
  631. package/dist/ui/hooks/useFileBrowserState.js.map +1 -0
  632. package/dist/ui/hooks/useFileList.d.ts +20 -0
  633. package/dist/ui/hooks/useFileList.d.ts.map +1 -0
  634. package/dist/ui/hooks/useFileList.js +57 -0
  635. package/dist/ui/hooks/useFileList.js.map +1 -0
  636. package/dist/ui/hooks/useInputHistory.d.ts +9 -0
  637. package/dist/ui/hooks/useInputHistory.d.ts.map +1 -0
  638. package/dist/ui/hooks/useInputHistory.js +68 -0
  639. package/dist/ui/hooks/useInputHistory.js.map +1 -0
  640. package/dist/ui/hooks/usePlanExecution.d.ts +8 -0
  641. package/dist/ui/hooks/usePlanExecution.d.ts.map +1 -0
  642. package/dist/ui/hooks/usePlanExecution.js +214 -0
  643. package/dist/ui/hooks/usePlanExecution.js.map +1 -0
  644. package/dist/ui/index.d.ts +7 -0
  645. package/dist/ui/index.d.ts.map +1 -0
  646. package/dist/ui/index.js +7 -0
  647. package/dist/ui/index.js.map +1 -0
  648. package/dist/ui/ink-entry.d.ts +3 -0
  649. package/dist/ui/ink-entry.d.ts.map +1 -0
  650. package/dist/ui/ink-entry.js +22 -0
  651. package/dist/ui/ink-entry.js.map +1 -0
  652. package/dist/utils/env-filter.d.ts +4 -0
  653. package/dist/utils/env-filter.d.ts.map +1 -0
  654. package/dist/utils/env-filter.js +101 -0
  655. package/dist/utils/env-filter.js.map +1 -0
  656. package/dist/utils/file-system.d.ts +9 -0
  657. package/dist/utils/file-system.d.ts.map +1 -0
  658. package/dist/utils/file-system.js +99 -0
  659. package/dist/utils/file-system.js.map +1 -0
  660. package/dist/utils/git-utils.d.ts +2 -0
  661. package/dist/utils/git-utils.d.ts.map +1 -0
  662. package/dist/utils/git-utils.js +16 -0
  663. package/dist/utils/git-utils.js.map +1 -0
  664. package/dist/utils/json-stream-logger.d.ts +74 -0
  665. package/dist/utils/json-stream-logger.d.ts.map +1 -0
  666. package/dist/utils/json-stream-logger.js +808 -0
  667. package/dist/utils/json-stream-logger.js.map +1 -0
  668. package/dist/utils/logger.d.ts +152 -0
  669. package/dist/utils/logger.d.ts.map +1 -0
  670. package/dist/utils/logger.js +1672 -0
  671. package/dist/utils/logger.js.map +1 -0
  672. package/dist/utils/platform-utils.d.ts +19 -0
  673. package/dist/utils/platform-utils.d.ts.map +1 -0
  674. package/dist/utils/platform-utils.js +134 -0
  675. package/dist/utils/platform-utils.js.map +1 -0
  676. package/dist/utils/wsl-utils.d.ts +4 -0
  677. package/dist/utils/wsl-utils.d.ts.map +1 -0
  678. package/dist/utils/wsl-utils.js +72 -0
  679. package/dist/utils/wsl-utils.js.map +1 -0
  680. package/electron.vite.config.ts +63 -0
  681. package/google374b9eba0c52b043.html +1 -0
  682. package/package.json +122 -0
  683. package/src/agents/base/base-agent.ts +159 -0
  684. package/src/agents/docs-search/index.ts +365 -0
  685. package/src/agents/index.ts +34 -0
  686. package/src/agents/planner/index.ts +544 -0
  687. package/src/cli.ts +201 -0
  688. package/src/constants.ts +47 -0
  689. package/src/core/compact/compact-manager.ts +160 -0
  690. package/src/core/compact/compact-prompts.ts +150 -0
  691. package/src/core/compact/context-tracker.ts +164 -0
  692. package/src/core/compact/index.ts +25 -0
  693. package/src/core/config/config-manager.ts +460 -0
  694. package/src/core/config/index.ts +5 -0
  695. package/src/core/docs-manager.ts +678 -0
  696. package/src/core/llm/index.ts +7 -0
  697. package/src/core/llm/llm-client.ts +1550 -0
  698. package/src/core/session/index.ts +5 -0
  699. package/src/core/session/session-manager.ts +464 -0
  700. package/src/core/slash-command-handler.ts +410 -0
  701. package/src/core/usage-tracker.ts +438 -0
  702. package/src/errors/base.ts +81 -0
  703. package/src/errors/file.ts +183 -0
  704. package/src/errors/index.ts +95 -0
  705. package/src/errors/llm.ts +151 -0
  706. package/src/errors/network.ts +124 -0
  707. package/src/errors/validation.ts +111 -0
  708. package/src/eval/eval-runner.ts +456 -0
  709. package/src/eval/index.ts +8 -0
  710. package/src/eval/types.ts +139 -0
  711. package/src/index.ts +22 -0
  712. package/src/orchestration/index.ts +30 -0
  713. package/src/orchestration/plan-executor.ts +652 -0
  714. package/src/orchestration/types.ts +127 -0
  715. package/src/orchestration/utils.ts +119 -0
  716. package/src/orquesta/connection.ts +291 -0
  717. package/src/prompts/agents/docs-search-decision.ts +74 -0
  718. package/src/prompts/agents/docs-search.ts +84 -0
  719. package/src/prompts/agents/planning.ts +143 -0
  720. package/src/prompts/index.ts +31 -0
  721. package/src/prompts/shared/codebase-rules.ts +29 -0
  722. package/src/prompts/shared/git-rules.ts +94 -0
  723. package/src/prompts/shared/language-rules.ts +36 -0
  724. package/src/prompts/shared/tool-usage.ts +72 -0
  725. package/src/prompts/system/compact.ts +80 -0
  726. package/src/prompts/system/plan-execute.ts +89 -0
  727. package/src/tools/browser/browser-client.ts +1363 -0
  728. package/src/tools/browser/browser-tools.ts +1139 -0
  729. package/src/tools/browser/index.ts +65 -0
  730. package/src/tools/index.ts +23 -0
  731. package/src/tools/llm/agents/docs-search-tools.ts +368 -0
  732. package/src/tools/llm/agents/index.ts +22 -0
  733. package/src/tools/llm/index.ts +11 -0
  734. package/src/tools/llm/simple/ask-user-tool.ts +25 -0
  735. package/src/tools/llm/simple/background-bash-tool.ts +443 -0
  736. package/src/tools/llm/simple/background-powershell-tool.ts +421 -0
  737. package/src/tools/llm/simple/bash-tool.ts +238 -0
  738. package/src/tools/llm/simple/docs-search-agent-tool.ts +146 -0
  739. package/src/tools/llm/simple/file-tools.ts +1051 -0
  740. package/src/tools/llm/simple/final-response-tool.ts +180 -0
  741. package/src/tools/llm/simple/index.ts +42 -0
  742. package/src/tools/llm/simple/planning-tools.ts +143 -0
  743. package/src/tools/llm/simple/powershell-tool.ts +241 -0
  744. package/src/tools/llm/simple/simple-tool-executor.ts +279 -0
  745. package/src/tools/llm/simple/todo-tools.ts +207 -0
  746. package/src/tools/llm/simple/user-interaction-tools.ts +277 -0
  747. package/src/tools/office/common/constants.ts +335 -0
  748. package/src/tools/office/common/index.ts +133 -0
  749. package/src/tools/office/common/types.ts +286 -0
  750. package/src/tools/office/common/utils.ts +116 -0
  751. package/src/tools/office/excel-client.ts +1336 -0
  752. package/src/tools/office/excel-tools/cells.ts +359 -0
  753. package/src/tools/office/excel-tools/charts.ts +166 -0
  754. package/src/tools/office/excel-tools/comments.ts +155 -0
  755. package/src/tools/office/excel-tools/data-ops.ts +349 -0
  756. package/src/tools/office/excel-tools/export.ts +105 -0
  757. package/src/tools/office/excel-tools/formatting.ts +357 -0
  758. package/src/tools/office/excel-tools/index.ts +55 -0
  759. package/src/tools/office/excel-tools/launch.ts +303 -0
  760. package/src/tools/office/excel-tools/media.ts +117 -0
  761. package/src/tools/office/excel-tools/named-ranges.ts +148 -0
  762. package/src/tools/office/excel-tools/protection.ts +105 -0
  763. package/src/tools/office/excel-tools/rows-columns.ts +386 -0
  764. package/src/tools/office/excel-tools/sheets.ts +228 -0
  765. package/src/tools/office/excel-tools/validation.ts +226 -0
  766. package/src/tools/office/excel-tools.ts +9 -0
  767. package/src/tools/office/index.ts +259 -0
  768. package/src/tools/office/office-client-base.ts +242 -0
  769. package/src/tools/office/office-client.ts +377 -0
  770. package/src/tools/office/powerpoint-client.ts +1498 -0
  771. package/src/tools/office/powerpoint-tools/effects.ts +315 -0
  772. package/src/tools/office/powerpoint-tools/export.ts +138 -0
  773. package/src/tools/office/powerpoint-tools/index.ts +45 -0
  774. package/src/tools/office/powerpoint-tools/launch.ts +263 -0
  775. package/src/tools/office/powerpoint-tools/media.ts +291 -0
  776. package/src/tools/office/powerpoint-tools/notes.ts +220 -0
  777. package/src/tools/office/powerpoint-tools/sections.ts +140 -0
  778. package/src/tools/office/powerpoint-tools/shapes.ts +870 -0
  779. package/src/tools/office/powerpoint-tools/slides.ts +350 -0
  780. package/src/tools/office/powerpoint-tools/tables.ts +182 -0
  781. package/src/tools/office/powerpoint-tools/text.ts +473 -0
  782. package/src/tools/office/powerpoint-tools.ts +9 -0
  783. package/src/tools/office/word-client.ts +1697 -0
  784. package/src/tools/office/word-tools/bookmarks.ts +186 -0
  785. package/src/tools/office/word-tools/comments.ts +185 -0
  786. package/src/tools/office/word-tools/content.ts +229 -0
  787. package/src/tools/office/word-tools/export.ts +97 -0
  788. package/src/tools/office/word-tools/formatting.ts +161 -0
  789. package/src/tools/office/word-tools/headers-footers.ts +155 -0
  790. package/src/tools/office/word-tools/index.ts +57 -0
  791. package/src/tools/office/word-tools/launch.ts +312 -0
  792. package/src/tools/office/word-tools/lists.ts +97 -0
  793. package/src/tools/office/word-tools/navigation.ts +114 -0
  794. package/src/tools/office/word-tools/page-setup.ts +195 -0
  795. package/src/tools/office/word-tools/tables.ts +262 -0
  796. package/src/tools/office/word-tools/text.ts +294 -0
  797. package/src/tools/office/word-tools/undo-redo.ts +97 -0
  798. package/src/tools/office/word-tools/watermarks.ts +105 -0
  799. package/src/tools/office/word-tools.ts +9 -0
  800. package/src/tools/registry.ts +527 -0
  801. package/src/tools/types.ts +231 -0
  802. package/src/types/index.ts +181 -0
  803. package/src/ui/PlanExecuteView.tsx +119 -0
  804. package/src/ui/TodoPanel.tsx +240 -0
  805. package/src/ui/UpdateNotification.tsx +105 -0
  806. package/src/ui/components/ActivityIndicator.tsx +234 -0
  807. package/src/ui/components/CommandBrowser.tsx +114 -0
  808. package/src/ui/components/CustomTextInput.tsx +389 -0
  809. package/src/ui/components/DocsSearchProgress.tsx +85 -0
  810. package/src/ui/components/FileBrowser.tsx +93 -0
  811. package/src/ui/components/LLMSetupWizard.tsx +333 -0
  812. package/src/ui/components/Logo.tsx +125 -0
  813. package/src/ui/components/MarkdownRenderer.tsx +358 -0
  814. package/src/ui/components/ModelSelector.tsx +203 -0
  815. package/src/ui/components/PlanExecuteApp.tsx +2007 -0
  816. package/src/ui/components/ProgressBar.tsx +51 -0
  817. package/src/ui/components/StatusBar.tsx +302 -0
  818. package/src/ui/components/ThinkingIndicator.tsx +120 -0
  819. package/src/ui/components/TodoListView.tsx +140 -0
  820. package/src/ui/components/ToolSelector.tsx +215 -0
  821. package/src/ui/components/dialogs/ApprovalDialog.tsx +259 -0
  822. package/src/ui/components/dialogs/AskUserDialog.tsx +159 -0
  823. package/src/ui/components/dialogs/DocsBrowser.tsx +222 -0
  824. package/src/ui/components/dialogs/SettingsDialog.tsx +939 -0
  825. package/src/ui/components/dialogs/index.ts +13 -0
  826. package/src/ui/components/index.ts +27 -0
  827. package/src/ui/components/panels/LogPanel.tsx +385 -0
  828. package/src/ui/components/panels/SessionPanel.tsx +146 -0
  829. package/src/ui/components/panels/index.ts +13 -0
  830. package/src/ui/components/views/ChatView.tsx +447 -0
  831. package/src/ui/components/views/index.ts +5 -0
  832. package/src/ui/contexts/TokenContext.tsx +139 -0
  833. package/src/ui/hooks/atFileProcessor.ts +167 -0
  834. package/src/ui/hooks/index.ts +11 -0
  835. package/src/ui/hooks/slashCommandProcessor.ts +174 -0
  836. package/src/ui/hooks/useCommandBrowserState.ts +97 -0
  837. package/src/ui/hooks/useFileBrowserState.ts +116 -0
  838. package/src/ui/hooks/useFileList.ts +132 -0
  839. package/src/ui/hooks/useInputHistory.ts +89 -0
  840. package/src/ui/hooks/usePlanExecution.ts +339 -0
  841. package/src/ui/index.ts +10 -0
  842. package/src/ui/ink-entry.tsx +36 -0
  843. package/src/utils/env-filter.ts +164 -0
  844. package/src/utils/file-system.ts +133 -0
  845. package/src/utils/git-utils.ts +30 -0
  846. package/src/utils/json-stream-logger.ts +1259 -0
  847. package/src/utils/logger.ts +2767 -0
  848. package/src/utils/platform-utils.ts +256 -0
  849. package/src/utils/wsl-utils.ts +113 -0
  850. package/tsconfig.electron.json +39 -0
  851. package/tsconfig.json +64 -0
@@ -0,0 +1,2767 @@
1
+ /**
2
+ * Logger Utility
3
+ *
4
+ * Verbose logging for debugging with full flow tracking
5
+ */
6
+
7
+ import chalk from 'chalk';
8
+ import { getJsonStreamLogger } from './json-stream-logger.js';
9
+ import * as path from 'path';
10
+
11
+ export enum LogLevel {
12
+ ERROR = 0,
13
+ WARN = 1,
14
+ INFO = 2,
15
+ DEBUG = 3,
16
+ VERBOSE = 4,
17
+ }
18
+
19
+ // LLM logging dedicated flag (--llm-log mode)
20
+ let llmLogEnabled = false;
21
+
22
+ export function enableLLMLog(): void {
23
+ llmLogEnabled = true;
24
+ }
25
+
26
+ export function disableLLMLog(): void {
27
+ llmLogEnabled = false;
28
+ }
29
+
30
+ export function isLLMLogEnabled(): boolean {
31
+ return llmLogEnabled;
32
+ }
33
+
34
+ export interface LoggerOptions {
35
+ level?: LogLevel;
36
+ prefix?: string;
37
+ timestamp?: boolean;
38
+ showLocation?: boolean; // Show filename, function name, line number
39
+ showPid?: boolean; // Show process ID
40
+ }
41
+
42
+ export interface CallLocation {
43
+ file: string;
44
+ line: number;
45
+ column: number;
46
+ function: string;
47
+ }
48
+
49
+ export interface VariableLog {
50
+ name: string;
51
+ value: unknown;
52
+ type?: string;
53
+ }
54
+
55
+ /**
56
+ * Logger class for structured logging with flow tracking
57
+ */
58
+ export class Logger {
59
+ private level: LogLevel;
60
+ private prefix: string;
61
+ private showTimestamp: boolean;
62
+ private showLocation: boolean;
63
+ private showPid: boolean;
64
+ private traceId: string | null = null;
65
+ private timers: Map<string, number> = new Map();
66
+
67
+ constructor(options: LoggerOptions = {}) {
68
+ this.level = options.level ?? LogLevel.INFO;
69
+ this.prefix = options.prefix ?? '';
70
+ this.showTimestamp = options.timestamp ?? true;
71
+ this.showLocation = options.showLocation ?? true;
72
+ this.showPid = options.showPid ?? false;
73
+ }
74
+
75
+ /**
76
+ * Set log level
77
+ */
78
+ setLevel(level: LogLevel): void {
79
+ this.level = level;
80
+ }
81
+
82
+ /**
83
+ * Set trace ID for flow tracking
84
+ */
85
+ setTraceId(traceId: string): void {
86
+ this.traceId = traceId;
87
+ }
88
+
89
+ /**
90
+ * Clear trace ID
91
+ */
92
+ clearTraceId(): void {
93
+ this.traceId = null;
94
+ }
95
+
96
+ /**
97
+ * Get current trace ID
98
+ */
99
+ getTraceId(): string | null {
100
+ return this.traceId;
101
+ }
102
+
103
+ /**
104
+ * Get call location from stack trace
105
+ */
106
+ private getCallLocation(depth: number = 3): CallLocation | null {
107
+ try {
108
+ const stack = new Error().stack;
109
+ if (!stack) return null;
110
+
111
+ const lines = stack.split('\n');
112
+ if (lines.length <= depth) return null;
113
+
114
+ // Extract file, line, column from stack trace
115
+ // Format: " at functionName (file:line:column)" or " at file:line:column"
116
+ const line = lines[depth];
117
+ if (!line) return null;
118
+
119
+ const match = line.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?/);
120
+
121
+ if (!match) return null;
122
+
123
+ const [, functionName, file, lineNum, column] = match;
124
+
125
+ if (!file || !lineNum || !column) return null;
126
+
127
+ return {
128
+ file: path.basename(file),
129
+ line: parseInt(lineNum),
130
+ column: parseInt(column),
131
+ function: functionName?.trim() || '<anonymous>',
132
+ };
133
+ } catch {
134
+ return null;
135
+ }
136
+ }
137
+
138
+ /**
139
+ * Get formatted timestamp
140
+ */
141
+ private getTimestamp(): string {
142
+ if (!this.showTimestamp) return '';
143
+ const now = new Date();
144
+ return chalk.gray(`[${now.toISOString()}]`);
145
+ }
146
+
147
+ /**
148
+ * Get formatted prefix
149
+ */
150
+ private getPrefix(): string {
151
+ if (!this.prefix) return '';
152
+ return chalk.cyan(`[${this.prefix}]`);
153
+ }
154
+
155
+ /**
156
+ * Get formatted process ID
157
+ */
158
+ private getPid(): string {
159
+ if (!this.showPid) return '';
160
+ return chalk.dim(`[PID:${process.pid}]`);
161
+ }
162
+
163
+ /**
164
+ * Get formatted trace ID
165
+ */
166
+ private getTraceIdStr(): string {
167
+ if (!this.traceId) return '';
168
+ return chalk.magenta(`[Trace:${this.traceId.slice(0, 8)}]`);
169
+ }
170
+
171
+ /**
172
+ * Get formatted location
173
+ */
174
+ private getLocation(location: CallLocation | null): string {
175
+ if (!this.showLocation || !location) return '';
176
+ return chalk.dim(`[${location.file}:${location.line}:${location.function}]`);
177
+ }
178
+
179
+ /**
180
+ * Format variable for logging
181
+ */
182
+ private formatVariable(variable: VariableLog): string {
183
+ const type = variable.type || typeof variable.value;
184
+ const valueStr = this.formatValue(variable.value);
185
+ return chalk.yellow(variable.name) + chalk.gray('=') + chalk.white(valueStr) + chalk.dim(` (${type})`);
186
+ }
187
+
188
+ /**
189
+ * Format value for display
190
+ */
191
+ private formatValue(value: unknown): string {
192
+ if (value === null) return 'null';
193
+ if (value === undefined) return 'undefined';
194
+ if (typeof value === 'string') return `"${value}"`;
195
+ if (typeof value === 'number' || typeof value === 'boolean') return String(value);
196
+ if (typeof value === 'function') return '[Function]';
197
+ if (Array.isArray(value)) return `Array(${value.length})`;
198
+ if (value instanceof Error) return `Error: ${value.message}`;
199
+ try {
200
+ const json = JSON.stringify(value);
201
+ return json.length > 100 ? json.slice(0, 100) + '...' : json;
202
+ } catch {
203
+ return '[Object]';
204
+ }
205
+ }
206
+
207
+ /**
208
+ * Log error
209
+ */
210
+ error(message: string, error?: Error | unknown): void {
211
+ // Always log to file first (for Ctrl+O LogBrowser)
212
+ const jsonLogger = getJsonStreamLogger();
213
+ if (jsonLogger?.isActive()) {
214
+ jsonLogger.logError(error || new Error(message), this.prefix || 'logger');
215
+ }
216
+
217
+ // Console output controlled by log level
218
+ if (this.level < LogLevel.ERROR) return;
219
+
220
+ const location = this.getCallLocation();
221
+ const timestamp = this.getTimestamp();
222
+ const prefix = this.getPrefix();
223
+ const pid = this.getPid();
224
+ const traceId = this.getTraceIdStr();
225
+ const loc = this.getLocation(location);
226
+
227
+ console.error(
228
+ timestamp,
229
+ prefix,
230
+ pid,
231
+ traceId,
232
+ loc,
233
+ chalk.red('❌ ERROR:'),
234
+ message
235
+ );
236
+
237
+ if (error) {
238
+ if (error instanceof Error) {
239
+ console.error(chalk.red(' Message:'), error.message);
240
+ if (error.stack) {
241
+ console.error(chalk.gray(' Stack:'));
242
+ console.error(chalk.gray(error.stack));
243
+ }
244
+ // Show cause if available
245
+ if ((error as any).cause) {
246
+ console.error(chalk.red(' Cause:'), (error as any).cause);
247
+ }
248
+ // Show details if available (custom errors)
249
+ if ((error as any).details) {
250
+ console.error(chalk.yellow(' Details:'), JSON.stringify((error as any).details, null, 2));
251
+ }
252
+ } else {
253
+ console.error(chalk.red(' Error:'), error);
254
+ }
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Log warning
260
+ */
261
+ warn(message: string, data?: unknown): void {
262
+ // Always log to file first (for Ctrl+O LogBrowser)
263
+ const jsonLogger = getJsonStreamLogger();
264
+ if (jsonLogger?.isActive()) {
265
+ jsonLogger.logInfo(`[WARN] ${message}`, data);
266
+ }
267
+
268
+ // Console output controlled by log level
269
+ if (this.level < LogLevel.WARN) return;
270
+
271
+ const location = this.getCallLocation();
272
+ const timestamp = this.getTimestamp();
273
+ const prefix = this.getPrefix();
274
+ const pid = this.getPid();
275
+ const traceId = this.getTraceIdStr();
276
+ const loc = this.getLocation(location);
277
+
278
+ console.warn(
279
+ timestamp,
280
+ prefix,
281
+ pid,
282
+ traceId,
283
+ loc,
284
+ chalk.yellow('⚠️ WARN:'),
285
+ message
286
+ );
287
+
288
+ if (data) {
289
+ console.warn(chalk.yellow(' Data:'), JSON.stringify(data, null, 2));
290
+ }
291
+ }
292
+
293
+ /**
294
+ * Log info
295
+ */
296
+ info(message: string, data?: unknown): void {
297
+ // Always log to file first (for Ctrl+O LogBrowser)
298
+ const jsonLogger = getJsonStreamLogger();
299
+ if (jsonLogger?.isActive()) {
300
+ jsonLogger.logInfo(message, data);
301
+ }
302
+
303
+ // Console output controlled by log level
304
+ if (this.level < LogLevel.INFO) return;
305
+
306
+ const location = this.getCallLocation();
307
+ const timestamp = this.getTimestamp();
308
+ const prefix = this.getPrefix();
309
+ const pid = this.getPid();
310
+ const traceId = this.getTraceIdStr();
311
+ const loc = this.getLocation(location);
312
+
313
+ console.log(
314
+ timestamp,
315
+ prefix,
316
+ pid,
317
+ traceId,
318
+ loc,
319
+ chalk.blue('ℹ️ INFO:'),
320
+ message
321
+ );
322
+
323
+ if (data) {
324
+ console.log(chalk.blue(' Data:'), JSON.stringify(data, null, 2));
325
+ }
326
+ }
327
+
328
+ /**
329
+ * Log debug
330
+ */
331
+ debug(message: string, data?: unknown): void {
332
+ // Always log to file first (for Ctrl+O LogBrowser)
333
+ const jsonLogger = getJsonStreamLogger();
334
+ if (jsonLogger?.isActive()) {
335
+ jsonLogger.logDebug(message, data);
336
+ }
337
+
338
+ // Console output controlled by log level
339
+ if (this.level < LogLevel.DEBUG) return;
340
+
341
+ const location = this.getCallLocation();
342
+ const timestamp = this.getTimestamp();
343
+ const prefix = this.getPrefix();
344
+ const pid = this.getPid();
345
+ const traceId = this.getTraceIdStr();
346
+ const loc = this.getLocation(location);
347
+
348
+ console.log(
349
+ timestamp,
350
+ prefix,
351
+ pid,
352
+ traceId,
353
+ loc,
354
+ chalk.magenta('🐛 DEBUG:'),
355
+ message
356
+ );
357
+
358
+ if (data) {
359
+ console.log(chalk.magenta(' Data:'), JSON.stringify(data, null, 2));
360
+ }
361
+ }
362
+
363
+ /**
364
+ * Log verbose (most detailed)
365
+ */
366
+ verbose(message: string, data?: unknown): void {
367
+ // Always log to file first (for Ctrl+O LogBrowser)
368
+ const jsonLogger = getJsonStreamLogger();
369
+ if (jsonLogger?.isActive()) {
370
+ jsonLogger.logDebug(`[VERBOSE] ${message}`, data);
371
+ }
372
+
373
+ // Console output controlled by log level
374
+ if (this.level < LogLevel.VERBOSE) return;
375
+
376
+ const location = this.getCallLocation();
377
+ const timestamp = this.getTimestamp();
378
+ const prefix = this.getPrefix();
379
+ const pid = this.getPid();
380
+ const traceId = this.getTraceIdStr();
381
+ const loc = this.getLocation(location);
382
+
383
+ console.log(
384
+ timestamp,
385
+ prefix,
386
+ pid,
387
+ traceId,
388
+ loc,
389
+ chalk.gray('🔍 VERBOSE:'),
390
+ message
391
+ );
392
+
393
+ if (data) {
394
+ console.log(chalk.gray(' Data:'), JSON.stringify(data, null, 2));
395
+ }
396
+ }
397
+
398
+ /**
399
+ * Log flow - Track execution flow (function calls, branches, etc.)
400
+ */
401
+ flow(message: string, context?: Record<string, unknown>): void {
402
+ // Always log to file first (for Ctrl+O LogBrowser)
403
+ const jsonLogger = getJsonStreamLogger();
404
+ if (jsonLogger?.isActive()) {
405
+ jsonLogger.logDebug(`[FLOW] ${message}`, context);
406
+ }
407
+
408
+ // Console output controlled by log level
409
+ if (this.level < LogLevel.DEBUG) return;
410
+
411
+ const location = this.getCallLocation();
412
+ const timestamp = this.getTimestamp();
413
+ const prefix = this.getPrefix();
414
+ const pid = this.getPid();
415
+ const traceId = this.getTraceIdStr();
416
+ const loc = this.getLocation(location);
417
+
418
+ console.log(
419
+ timestamp,
420
+ prefix,
421
+ pid,
422
+ traceId,
423
+ loc,
424
+ chalk.green('➜ FLOW:'),
425
+ message
426
+ );
427
+
428
+ if (context) {
429
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
430
+ }
431
+ }
432
+
433
+ /**
434
+ * Log variables - Track variable values
435
+ */
436
+ vars(...variables: VariableLog[]): void {
437
+ // Always log to file first (for Ctrl+O LogBrowser)
438
+ const jsonLogger = getJsonStreamLogger();
439
+ if (jsonLogger?.isActive()) {
440
+ const varsData = variables.reduce((acc, v) => {
441
+ acc[v.name] = v.value;
442
+ return acc;
443
+ }, {} as Record<string, unknown>);
444
+ jsonLogger.logDebug('[VARS]', varsData);
445
+ }
446
+
447
+ // Console output controlled by log level
448
+ if (this.level < LogLevel.DEBUG) return;
449
+
450
+ const location = this.getCallLocation();
451
+ const timestamp = this.getTimestamp();
452
+ const prefix = this.getPrefix();
453
+ const pid = this.getPid();
454
+ const traceId = this.getTraceIdStr();
455
+ const loc = this.getLocation(location);
456
+
457
+ console.log(
458
+ timestamp,
459
+ prefix,
460
+ pid,
461
+ traceId,
462
+ loc,
463
+ chalk.cyan('📦 VARS:')
464
+ );
465
+
466
+ variables.forEach(variable => {
467
+ console.log(' ', this.formatVariable(variable));
468
+ });
469
+ }
470
+
471
+ /**
472
+ * Log function enter
473
+ */
474
+ enter(functionName: string, args?: Record<string, unknown>): void {
475
+ // Always log to file first (for Ctrl+O LogBrowser)
476
+ const jsonLogger = getJsonStreamLogger();
477
+ if (jsonLogger?.isActive()) {
478
+ jsonLogger.logDebug(`[ENTER] ${functionName}`, args);
479
+ }
480
+
481
+ // Console output controlled by log level
482
+ if (this.level < LogLevel.DEBUG) return;
483
+
484
+ const location = this.getCallLocation();
485
+ const timestamp = this.getTimestamp();
486
+ const prefix = this.getPrefix();
487
+ const pid = this.getPid();
488
+ const traceId = this.getTraceIdStr();
489
+ const loc = this.getLocation(location);
490
+
491
+ console.log(
492
+ timestamp,
493
+ prefix,
494
+ pid,
495
+ traceId,
496
+ loc,
497
+ chalk.green('↓ ENTER:'),
498
+ chalk.bold(functionName)
499
+ );
500
+
501
+ if (args) {
502
+ console.log(chalk.green(' Args:'), JSON.stringify(args, null, 2));
503
+ }
504
+ }
505
+
506
+ /**
507
+ * Log function exit
508
+ */
509
+ exit(functionName: string, result?: unknown): void {
510
+ // Always log to file first (for Ctrl+O LogBrowser)
511
+ const jsonLogger = getJsonStreamLogger();
512
+ if (jsonLogger?.isActive()) {
513
+ jsonLogger.logDebug(`[EXIT] ${functionName}`, { result });
514
+ }
515
+
516
+ // Console output controlled by log level
517
+ if (this.level < LogLevel.DEBUG) return;
518
+
519
+ const location = this.getCallLocation();
520
+ const timestamp = this.getTimestamp();
521
+ const prefix = this.getPrefix();
522
+ const pid = this.getPid();
523
+ const traceId = this.getTraceIdStr();
524
+ const loc = this.getLocation(location);
525
+
526
+ console.log(
527
+ timestamp,
528
+ prefix,
529
+ pid,
530
+ traceId,
531
+ loc,
532
+ chalk.green('↑ EXIT:'),
533
+ chalk.bold(functionName)
534
+ );
535
+
536
+ if (result !== undefined) {
537
+ console.log(chalk.green(' Result:'), this.formatValue(result));
538
+ }
539
+ }
540
+
541
+ /**
542
+ * Log state change
543
+ */
544
+ state(description: string, before: unknown, after: unknown): void {
545
+ // Always log to file first (for Ctrl+O LogBrowser)
546
+ const jsonLogger = getJsonStreamLogger();
547
+ if (jsonLogger?.isActive()) {
548
+ jsonLogger.logDebug(`[STATE] ${description}`, { before, after });
549
+ }
550
+
551
+ // Console output controlled by log level
552
+ if (this.level < LogLevel.DEBUG) return;
553
+
554
+ const location = this.getCallLocation();
555
+ const timestamp = this.getTimestamp();
556
+ const prefix = this.getPrefix();
557
+ const pid = this.getPid();
558
+ const traceId = this.getTraceIdStr();
559
+ const loc = this.getLocation(location);
560
+
561
+ console.log(
562
+ timestamp,
563
+ prefix,
564
+ pid,
565
+ traceId,
566
+ loc,
567
+ chalk.yellow('🔄 STATE:'),
568
+ description
569
+ );
570
+
571
+ console.log(chalk.red(' Before:'), this.formatValue(before));
572
+ console.log(chalk.green(' After:'), this.formatValue(after));
573
+ }
574
+
575
+ /**
576
+ * Start performance timer
577
+ */
578
+ startTimer(label: string): void {
579
+ // Always log to file first (for Ctrl+O LogBrowser)
580
+ const jsonLogger = getJsonStreamLogger();
581
+ if (jsonLogger?.isActive()) {
582
+ jsonLogger.logDebug(`[TIMER] Start: ${label}`);
583
+ }
584
+
585
+ this.timers.set(label, Date.now());
586
+
587
+ // Console output controlled by log level
588
+ if (this.level >= LogLevel.DEBUG) {
589
+ const location = this.getCallLocation();
590
+ const timestamp = this.getTimestamp();
591
+ const prefix = this.getPrefix();
592
+ const pid = this.getPid();
593
+ const traceId = this.getTraceIdStr();
594
+ const loc = this.getLocation(location);
595
+
596
+ console.log(
597
+ timestamp,
598
+ prefix,
599
+ pid,
600
+ traceId,
601
+ loc,
602
+ chalk.blue('⏱️ TIMER START:'),
603
+ label
604
+ );
605
+ }
606
+ }
607
+
608
+ /**
609
+ * End performance timer
610
+ */
611
+ endTimer(label: string): number {
612
+ const startTime = this.timers.get(label);
613
+ if (!startTime) {
614
+ this.warn(`Timer "${label}" was not started`);
615
+ return 0;
616
+ }
617
+
618
+ const elapsed = Date.now() - startTime;
619
+ this.timers.delete(label);
620
+
621
+ // Always log to file first (for Ctrl+O LogBrowser)
622
+ const jsonLogger = getJsonStreamLogger();
623
+ if (jsonLogger?.isActive()) {
624
+ jsonLogger.logDebug(`[TIMER] End: ${label}`, { elapsed });
625
+ }
626
+
627
+ // Console output controlled by log level
628
+ if (this.level >= LogLevel.DEBUG) {
629
+ const location = this.getCallLocation();
630
+ const timestamp = this.getTimestamp();
631
+ const prefix = this.getPrefix();
632
+ const pid = this.getPid();
633
+ const traceId = this.getTraceIdStr();
634
+ const loc = this.getLocation(location);
635
+
636
+ console.log(
637
+ timestamp,
638
+ prefix,
639
+ pid,
640
+ traceId,
641
+ loc,
642
+ chalk.blue('⏱️ TIMER END:'),
643
+ label,
644
+ chalk.bold(`${elapsed}ms`)
645
+ );
646
+ }
647
+
648
+ return elapsed;
649
+ }
650
+
651
+ /**
652
+ * Log HTTP request
653
+ */
654
+ httpRequest(method: string, url: string, body?: unknown): void {
655
+ // Always log to file first (for Ctrl+O LogBrowser)
656
+ const jsonLogger = getJsonStreamLogger();
657
+ if (jsonLogger?.isActive()) {
658
+ jsonLogger.logDebug(`HTTP ${method} ${url}`, { body });
659
+ }
660
+
661
+ // Console output controlled by log level
662
+ if (this.level < LogLevel.DEBUG) return;
663
+
664
+ const location = this.getCallLocation();
665
+ const timestamp = this.getTimestamp();
666
+ const prefix = this.getPrefix();
667
+ const pid = this.getPid();
668
+ const traceId = this.getTraceIdStr();
669
+ const loc = this.getLocation(location);
670
+
671
+ console.log(
672
+ timestamp,
673
+ prefix,
674
+ pid,
675
+ traceId,
676
+ loc,
677
+ chalk.cyan('→ HTTP REQUEST:'),
678
+ chalk.bold(method),
679
+ url
680
+ );
681
+
682
+ if (body) {
683
+ console.log(chalk.cyan(' Body:'), JSON.stringify(body, null, 2));
684
+ }
685
+ }
686
+
687
+ /**
688
+ * Log HTTP response
689
+ */
690
+ httpResponse(status: number, statusText: string, data?: unknown): void {
691
+ // Always log to file first (for Ctrl+O LogBrowser)
692
+ const jsonLogger = getJsonStreamLogger();
693
+ if (jsonLogger?.isActive()) {
694
+ jsonLogger.logDebug(`HTTP Response ${status} ${statusText}`, { status, statusText, data });
695
+ }
696
+
697
+ // Console output controlled by log level
698
+ if (this.level < LogLevel.DEBUG) return;
699
+
700
+ const location = this.getCallLocation();
701
+ const timestamp = this.getTimestamp();
702
+ const prefix = this.getPrefix();
703
+ const pid = this.getPid();
704
+ const traceId = this.getTraceIdStr();
705
+ const loc = this.getLocation(location);
706
+ const statusColor = status >= 400 ? chalk.red : status >= 300 ? chalk.yellow : chalk.green;
707
+
708
+ console.log(
709
+ timestamp,
710
+ prefix,
711
+ pid,
712
+ traceId,
713
+ loc,
714
+ chalk.cyan('← HTTP RESPONSE:'),
715
+ statusColor(`${status} ${statusText}`)
716
+ );
717
+
718
+ if (data && this.level >= LogLevel.VERBOSE) {
719
+ console.log(chalk.cyan(' Data:'), JSON.stringify(data, null, 2));
720
+ }
721
+ }
722
+
723
+ /**
724
+ * Log tool execution
725
+ */
726
+ toolExecution(toolName: string, args: unknown, result?: unknown, error?: Error): void {
727
+ // Always log to file first (for Ctrl+O LogBrowser)
728
+ const jsonLogger = getJsonStreamLogger();
729
+ if (jsonLogger?.isActive()) {
730
+ jsonLogger.logToolCall(toolName, args, result, error);
731
+ }
732
+
733
+ // Console output controlled by log level
734
+ if (this.level < LogLevel.DEBUG) return;
735
+
736
+ const location = this.getCallLocation();
737
+ const timestamp = this.getTimestamp();
738
+ const prefix = this.getPrefix();
739
+ const pid = this.getPid();
740
+ const traceId = this.getTraceIdStr();
741
+ const loc = this.getLocation(location);
742
+
743
+ if (error) {
744
+ console.log(
745
+ timestamp,
746
+ prefix,
747
+ pid,
748
+ traceId,
749
+ loc,
750
+ chalk.red('🔧 TOOL FAILED:'),
751
+ chalk.bold(toolName)
752
+ );
753
+ console.log(chalk.red(' Args:'), JSON.stringify(args, null, 2));
754
+ console.log(chalk.red(' Error:'), error.message);
755
+ } else {
756
+ console.log(
757
+ timestamp,
758
+ prefix,
759
+ pid,
760
+ traceId,
761
+ loc,
762
+ chalk.green('🔧 TOOL SUCCESS:'),
763
+ chalk.bold(toolName)
764
+ );
765
+ console.log(chalk.green(' Args:'), JSON.stringify(args, null, 2));
766
+ if (result && this.level >= LogLevel.VERBOSE) {
767
+ console.log(chalk.green(' Result:'), JSON.stringify(result, null, 2));
768
+ }
769
+ }
770
+ }
771
+
772
+ /**
773
+ * Log bash command execution with formatted display
774
+ */
775
+ bashExecution(formattedDisplay: string): void {
776
+ // Always log to file first (for Ctrl+O LogBrowser)
777
+ const jsonLogger = getJsonStreamLogger();
778
+ if (jsonLogger?.isActive()) {
779
+ jsonLogger.logDebug('[BASH] Execution', { output: formattedDisplay });
780
+ }
781
+
782
+ // Console output controlled by log level
783
+ if (this.level < LogLevel.INFO) return;
784
+
785
+ // Split formatted display into lines and colorize
786
+ const lines = formattedDisplay.split('\n');
787
+ lines.forEach((line) => {
788
+ if (line.startsWith('●')) {
789
+ // Command header in cyan
790
+ console.log(chalk.cyan(line));
791
+ } else if (line.includes('Error:')) {
792
+ // Error lines in red
793
+ console.log(chalk.red(line));
794
+ } else {
795
+ // Output lines in default color
796
+ console.log(line);
797
+ }
798
+ });
799
+
800
+ // Add blank line after output for better readability
801
+ console.log();
802
+ }
803
+
804
+ /**
805
+ * Log LLM request (--llm-log mode only)
806
+ */
807
+ llmRequest(messages: unknown[], model: string, tools?: unknown[]): void {
808
+ // Always log to file first (for Ctrl+O LogBrowser)
809
+ const jsonLogger = getJsonStreamLogger();
810
+ if (jsonLogger?.isActive()) {
811
+ jsonLogger.logDebug('[LLM] Request', { model, messageCount: messages?.length, toolCount: tools?.length });
812
+ }
813
+
814
+ // Console output only in --llm-log mode
815
+ if (!llmLogEnabled) return;
816
+
817
+ const timestamp = this.getTimestamp();
818
+ console.log();
819
+ console.log(chalk.cyan('─'.repeat(80)));
820
+ console.log(chalk.cyan.bold(`[${timestamp}] 📤 LLM REQUEST`));
821
+ console.log(chalk.gray(`Model: ${model}`));
822
+ if (tools && Array.isArray(tools) && tools.length > 0) {
823
+ console.log(chalk.gray(`Tools: ${tools.length} available`));
824
+ }
825
+ console.log(chalk.cyan('─'.repeat(40)));
826
+
827
+ // Show messages
828
+ if (Array.isArray(messages)) {
829
+ messages.forEach((msg: any, idx) => {
830
+ const role = msg.role || 'unknown';
831
+ const content = msg.content || '';
832
+ const roleColor = role === 'user' ? chalk.green : role === 'assistant' ? chalk.blue : chalk.yellow;
833
+
834
+ console.log(roleColor.bold(`[${role.toUpperCase()}]`));
835
+ if (content) {
836
+ // Truncate very long content
837
+ const displayContent = content.length > 2000
838
+ ? content.substring(0, 2000) + chalk.gray(`\n... (${content.length - 2000} more chars)`)
839
+ : content;
840
+ console.log(displayContent);
841
+ }
842
+ if (msg.tool_calls && msg.tool_calls.length > 0) {
843
+ console.log(chalk.yellow(` Tool calls: ${msg.tool_calls.map((tc: any) => tc.function?.name).join(', ')}`));
844
+ }
845
+ if (idx < messages.length - 1) console.log();
846
+ });
847
+ }
848
+ console.log(chalk.cyan('─'.repeat(80)));
849
+ }
850
+
851
+ /**
852
+ * Log LLM response (--llm-log mode only)
853
+ */
854
+ llmResponse(response: string, toolCalls?: unknown[]): void {
855
+ // Always log to file first (for Ctrl+O LogBrowser)
856
+ const jsonLogger = getJsonStreamLogger();
857
+ if (jsonLogger?.isActive()) {
858
+ jsonLogger.logDebug('[LLM] Response', { responseLength: response?.length, toolCallCount: toolCalls?.length });
859
+ }
860
+
861
+ // Console output only in --llm-log mode
862
+ if (!llmLogEnabled) return;
863
+
864
+ const timestamp = this.getTimestamp();
865
+ console.log();
866
+ console.log(chalk.green('─'.repeat(80)));
867
+ console.log(chalk.green.bold(`[${timestamp}] 📥 LLM RESPONSE`));
868
+ console.log(chalk.green('─'.repeat(40)));
869
+
870
+ // Truncate very long response
871
+ const displayResponse = response.length > 3000
872
+ ? response.substring(0, 3000) + chalk.gray(`\n... (${response.length - 3000} more chars)`)
873
+ : response;
874
+ console.log(displayResponse);
875
+
876
+ if (toolCalls && Array.isArray(toolCalls) && toolCalls.length > 0) {
877
+ console.log();
878
+ console.log(chalk.yellow.bold('Tool Calls:'));
879
+ toolCalls.forEach((tc: any) => {
880
+ console.log(chalk.yellow(` - ${tc.function?.name}:`));
881
+ // Pretty print full arguments JSON
882
+ try {
883
+ const args = JSON.parse(tc.function?.arguments || '{}');
884
+ console.log(chalk.gray(JSON.stringify(args, null, 2)));
885
+ } catch {
886
+ console.log(chalk.gray(tc.function?.arguments || '(no arguments)'));
887
+ }
888
+ });
889
+ }
890
+ console.log(chalk.green('─'.repeat(80)));
891
+ }
892
+
893
+ /**
894
+ * Log tool execution result (--llm-log mode only)
895
+ */
896
+ llmToolResult(toolName: string, result: string, success: boolean): void {
897
+ // Always log to file first (for Ctrl+O LogBrowser)
898
+ const jsonLogger = getJsonStreamLogger();
899
+ if (jsonLogger?.isActive()) {
900
+ jsonLogger.logDebug(`[LLM] Tool Result: ${toolName}`, { success, resultLength: result?.length });
901
+ }
902
+
903
+ // Console output only in --llm-log mode
904
+ if (!llmLogEnabled) return;
905
+
906
+ const timestamp = this.getTimestamp();
907
+ const color = success ? chalk.cyan : chalk.red;
908
+ console.log();
909
+ console.log(color('─'.repeat(80)));
910
+ console.log(color.bold(`[${timestamp}] 🔧 TOOL: ${toolName} ${success ? '✓' : '✗'}`));
911
+ console.log(color('─'.repeat(40)));
912
+
913
+ // Truncate very long result
914
+ const displayResult = result.length > 1000
915
+ ? result.substring(0, 1000) + chalk.gray(`\n... (${result.length - 1000} more chars)`)
916
+ : result;
917
+ console.log(displayResult);
918
+ console.log(color('─'.repeat(80)));
919
+ }
920
+
921
+ // ============================================================================
922
+ // HTTP Extended Methods
923
+ // ============================================================================
924
+
925
+ /**
926
+ * Log HTTP error
927
+ */
928
+ httpError(url: string, error: Error | unknown): void {
929
+ // Always log to file first (for Ctrl+O LogBrowser)
930
+ const jsonLogger = getJsonStreamLogger();
931
+ if (jsonLogger?.isActive()) {
932
+ jsonLogger.logError(error instanceof Error ? error : new Error(String(error)), `HTTP ${url}`);
933
+ }
934
+
935
+ // Console output controlled by log level
936
+ if (this.level < LogLevel.DEBUG) return;
937
+
938
+ const location = this.getCallLocation();
939
+ const timestamp = this.getTimestamp();
940
+ const prefix = this.getPrefix();
941
+ const pid = this.getPid();
942
+ const traceId = this.getTraceIdStr();
943
+ const loc = this.getLocation(location);
944
+
945
+ console.log(
946
+ timestamp,
947
+ prefix,
948
+ pid,
949
+ traceId,
950
+ loc,
951
+ chalk.red('✗ HTTP ERROR:'),
952
+ url
953
+ );
954
+
955
+ if (error instanceof Error) {
956
+ console.log(chalk.red(' Message:'), error.message);
957
+ } else {
958
+ console.log(chalk.red(' Error:'), error);
959
+ }
960
+ }
961
+
962
+ /**
963
+ * Log HTTP stream start
964
+ */
965
+ httpStreamStart(method: string, url: string): void {
966
+ // Always log to file first (for Ctrl+O LogBrowser)
967
+ const jsonLogger = getJsonStreamLogger();
968
+ if (jsonLogger?.isActive()) {
969
+ jsonLogger.logDebug(`HTTP Stream Start: ${method} ${url}`);
970
+ }
971
+
972
+ // Console output controlled by log level
973
+ if (this.level < LogLevel.DEBUG) return;
974
+
975
+ const location = this.getCallLocation();
976
+ const timestamp = this.getTimestamp();
977
+ const prefix = this.getPrefix();
978
+ const pid = this.getPid();
979
+ const traceId = this.getTraceIdStr();
980
+ const loc = this.getLocation(location);
981
+
982
+ console.log(
983
+ timestamp,
984
+ prefix,
985
+ pid,
986
+ traceId,
987
+ loc,
988
+ chalk.cyan('⇢ HTTP STREAM START:'),
989
+ chalk.bold(method),
990
+ url
991
+ );
992
+ }
993
+
994
+ /**
995
+ * Log HTTP stream chunk
996
+ */
997
+ httpStreamChunk(data: unknown): void {
998
+ // Always log to file first (for Ctrl+O LogBrowser)
999
+ const chunkSize = typeof data === 'string' ? data.length : JSON.stringify(data).length;
1000
+ const jsonLogger = getJsonStreamLogger();
1001
+ if (jsonLogger?.isActive()) {
1002
+ jsonLogger.logDebug('[HTTP] Stream Chunk', { bytes: chunkSize });
1003
+ }
1004
+
1005
+ // Console output controlled by log level
1006
+ if (this.level < LogLevel.VERBOSE) return;
1007
+
1008
+ const location = this.getCallLocation();
1009
+ const timestamp = this.getTimestamp();
1010
+ const prefix = this.getPrefix();
1011
+ const pid = this.getPid();
1012
+ const traceId = this.getTraceIdStr();
1013
+ const loc = this.getLocation(location);
1014
+
1015
+ console.log(
1016
+ timestamp,
1017
+ prefix,
1018
+ pid,
1019
+ traceId,
1020
+ loc,
1021
+ chalk.gray('⇨ HTTP STREAM CHUNK:'),
1022
+ `${chunkSize} bytes`
1023
+ );
1024
+ }
1025
+
1026
+ /**
1027
+ * Log HTTP stream end
1028
+ */
1029
+ httpStreamEnd(totalBytes: number, duration: number): void {
1030
+ // Always log to file first (for Ctrl+O LogBrowser)
1031
+ const jsonLogger = getJsonStreamLogger();
1032
+ if (jsonLogger?.isActive()) {
1033
+ jsonLogger.logDebug(`HTTP Stream End`, { totalBytes, duration });
1034
+ }
1035
+
1036
+ // Console output controlled by log level
1037
+ if (this.level < LogLevel.DEBUG) return;
1038
+
1039
+ const location = this.getCallLocation();
1040
+ const timestamp = this.getTimestamp();
1041
+ const prefix = this.getPrefix();
1042
+ const pid = this.getPid();
1043
+ const traceId = this.getTraceIdStr();
1044
+ const loc = this.getLocation(location);
1045
+
1046
+ console.log(
1047
+ timestamp,
1048
+ prefix,
1049
+ pid,
1050
+ traceId,
1051
+ loc,
1052
+ chalk.cyan('⇠ HTTP STREAM END:'),
1053
+ `${totalBytes} bytes in ${duration}ms`
1054
+ );
1055
+ }
1056
+
1057
+ // ============================================================================
1058
+ // Tool Individual Methods
1059
+ // ============================================================================
1060
+
1061
+ /**
1062
+ * Log tool start
1063
+ */
1064
+ toolStart(name: string, args: unknown, reason?: string): void {
1065
+ // Always log to file first (for Ctrl+O LogBrowser)
1066
+ const jsonLogger = getJsonStreamLogger();
1067
+ if (jsonLogger?.isActive()) {
1068
+ jsonLogger.logToolStart(name, args, reason);
1069
+ }
1070
+
1071
+ // Console output controlled by log level
1072
+ if (this.level < LogLevel.DEBUG) return;
1073
+
1074
+ const location = this.getCallLocation();
1075
+ const timestamp = this.getTimestamp();
1076
+ const prefix = this.getPrefix();
1077
+ const pid = this.getPid();
1078
+ const traceId = this.getTraceIdStr();
1079
+ const loc = this.getLocation(location);
1080
+
1081
+ console.log(
1082
+ timestamp,
1083
+ prefix,
1084
+ pid,
1085
+ traceId,
1086
+ loc,
1087
+ chalk.blue('🔧 TOOL START:'),
1088
+ chalk.bold(name)
1089
+ );
1090
+ if (reason) {
1091
+ console.log(chalk.blue(' Reason:'), reason);
1092
+ }
1093
+ if (args && this.level >= LogLevel.VERBOSE) {
1094
+ console.log(chalk.blue(' Args:'), JSON.stringify(args, null, 2));
1095
+ }
1096
+ }
1097
+
1098
+ /**
1099
+ * Log tool success
1100
+ */
1101
+ toolSuccess(name: string, _args: unknown, result: unknown, duration: number): void {
1102
+ // Always log to file first (for Ctrl+O LogBrowser)
1103
+ const jsonLogger = getJsonStreamLogger();
1104
+ if (jsonLogger?.isActive()) {
1105
+ jsonLogger.logToolEnd(name, true, result, undefined, duration);
1106
+ }
1107
+
1108
+ // Console output controlled by log level
1109
+ if (this.level < LogLevel.DEBUG) return;
1110
+
1111
+ const location = this.getCallLocation();
1112
+ const timestamp = this.getTimestamp();
1113
+ const prefix = this.getPrefix();
1114
+ const pid = this.getPid();
1115
+ const traceId = this.getTraceIdStr();
1116
+ const loc = this.getLocation(location);
1117
+
1118
+ console.log(
1119
+ timestamp,
1120
+ prefix,
1121
+ pid,
1122
+ traceId,
1123
+ loc,
1124
+ chalk.green('✓ TOOL SUCCESS:'),
1125
+ chalk.bold(name),
1126
+ chalk.dim(`(${duration}ms)`)
1127
+ );
1128
+ if (result && this.level >= LogLevel.VERBOSE) {
1129
+ console.log(chalk.green(' Result:'), this.formatValue(result));
1130
+ }
1131
+ }
1132
+
1133
+ /**
1134
+ * Log tool error
1135
+ */
1136
+ toolError(name: string, args: unknown, error: Error, duration: number): void {
1137
+ // Always log to file first (for Ctrl+O LogBrowser)
1138
+ const jsonLogger = getJsonStreamLogger();
1139
+ if (jsonLogger?.isActive()) {
1140
+ jsonLogger.logToolEnd(name, false, undefined, error.message, duration);
1141
+ }
1142
+
1143
+ // Console output controlled by log level
1144
+ if (this.level < LogLevel.ERROR) return;
1145
+
1146
+ const location = this.getCallLocation();
1147
+ const timestamp = this.getTimestamp();
1148
+ const prefix = this.getPrefix();
1149
+ const pid = this.getPid();
1150
+ const traceId = this.getTraceIdStr();
1151
+ const loc = this.getLocation(location);
1152
+
1153
+ console.log(
1154
+ timestamp,
1155
+ prefix,
1156
+ pid,
1157
+ traceId,
1158
+ loc,
1159
+ chalk.red('✗ TOOL ERROR:'),
1160
+ chalk.bold(name),
1161
+ chalk.dim(`(${duration}ms)`)
1162
+ );
1163
+ console.log(chalk.red(' Error:'), error.message);
1164
+ if (args) {
1165
+ console.log(chalk.red(' Args:'), JSON.stringify(args, null, 2));
1166
+ }
1167
+ }
1168
+
1169
+ // ============================================================================
1170
+ // UI/UX Interaction Methods
1171
+ // ============================================================================
1172
+
1173
+ /**
1174
+ * Log user click event
1175
+ */
1176
+ userClick(element: string, context: Record<string, unknown>): void {
1177
+ // Always log to file first (for Ctrl+O LogBrowser)
1178
+ const jsonLogger = getJsonStreamLogger();
1179
+ if (jsonLogger?.isActive()) {
1180
+ jsonLogger.logDebug(`[UI] User Click: ${element}`, context);
1181
+ }
1182
+
1183
+ // Console output controlled by log level
1184
+ if (this.level < LogLevel.DEBUG) return;
1185
+
1186
+ const location = this.getCallLocation();
1187
+ const timestamp = this.getTimestamp();
1188
+ const prefix = this.getPrefix();
1189
+ const loc = this.getLocation(location);
1190
+
1191
+ console.log(timestamp, prefix, loc, chalk.yellow('👆 USER CLICK:'), element);
1192
+ if (Object.keys(context).length > 0) {
1193
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1194
+ }
1195
+ }
1196
+
1197
+ /**
1198
+ * Log user keyboard event
1199
+ */
1200
+ userKeyboard(type: string, context: Record<string, unknown>): void {
1201
+ // Always log to file first (for Ctrl+O LogBrowser)
1202
+ const jsonLogger = getJsonStreamLogger();
1203
+ if (jsonLogger?.isActive()) {
1204
+ jsonLogger.logDebug(`[UI] User Keyboard: ${type}`, context);
1205
+ }
1206
+
1207
+ // Console output controlled by log level
1208
+ if (this.level < LogLevel.DEBUG) return;
1209
+
1210
+ const location = this.getCallLocation();
1211
+ const timestamp = this.getTimestamp();
1212
+ const prefix = this.getPrefix();
1213
+ const loc = this.getLocation(location);
1214
+
1215
+ console.log(timestamp, prefix, loc, chalk.yellow('⌨️ USER KEYBOARD:'), type);
1216
+ if (Object.keys(context).length > 0) {
1217
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1218
+ }
1219
+ }
1220
+
1221
+ /**
1222
+ * Log user scroll event
1223
+ */
1224
+ userScroll(context: Record<string, unknown>): void {
1225
+ // Always log to file first (for Ctrl+O LogBrowser)
1226
+ const jsonLogger = getJsonStreamLogger();
1227
+ if (jsonLogger?.isActive()) {
1228
+ jsonLogger.logDebug('[UI] User Scroll', context);
1229
+ }
1230
+
1231
+ // Console output controlled by log level
1232
+ if (this.level < LogLevel.VERBOSE) return;
1233
+
1234
+ const location = this.getCallLocation();
1235
+ const timestamp = this.getTimestamp();
1236
+ const prefix = this.getPrefix();
1237
+ const loc = this.getLocation(location);
1238
+
1239
+ console.log(timestamp, prefix, loc, chalk.gray('📜 USER SCROLL'));
1240
+ if (Object.keys(context).length > 0) {
1241
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
1242
+ }
1243
+ }
1244
+
1245
+ /**
1246
+ * Log user drag start
1247
+ */
1248
+ userDragStart(element: string, context: Record<string, unknown>): void {
1249
+ // Always log to file first (for Ctrl+O LogBrowser)
1250
+ const jsonLogger = getJsonStreamLogger();
1251
+ if (jsonLogger?.isActive()) {
1252
+ jsonLogger.logDebug(`[UI] User Drag Start: ${element}`, context);
1253
+ }
1254
+
1255
+ // Console output controlled by log level
1256
+ if (this.level < LogLevel.DEBUG) return;
1257
+
1258
+ const location = this.getCallLocation();
1259
+ const timestamp = this.getTimestamp();
1260
+ const prefix = this.getPrefix();
1261
+ const loc = this.getLocation(location);
1262
+
1263
+ console.log(timestamp, prefix, loc, chalk.yellow('🖱️ USER DRAG START:'), element);
1264
+ if (Object.keys(context).length > 0) {
1265
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1266
+ }
1267
+ }
1268
+
1269
+ /**
1270
+ * Log user drag end
1271
+ */
1272
+ userDragEnd(element: string, context: Record<string, unknown>): void {
1273
+ // Always log to file first (for Ctrl+O LogBrowser)
1274
+ const jsonLogger = getJsonStreamLogger();
1275
+ if (jsonLogger?.isActive()) {
1276
+ jsonLogger.logDebug(`[UI] User Drag End: ${element}`, context);
1277
+ }
1278
+
1279
+ // Console output controlled by log level
1280
+ if (this.level < LogLevel.DEBUG) return;
1281
+
1282
+ const location = this.getCallLocation();
1283
+ const timestamp = this.getTimestamp();
1284
+ const prefix = this.getPrefix();
1285
+ const loc = this.getLocation(location);
1286
+
1287
+ console.log(timestamp, prefix, loc, chalk.yellow('🖱️ USER DRAG END:'), element);
1288
+ if (Object.keys(context).length > 0) {
1289
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1290
+ }
1291
+ }
1292
+
1293
+ // ============================================================================
1294
+ // Component Lifecycle Methods
1295
+ // ============================================================================
1296
+
1297
+ /**
1298
+ * Log component mount
1299
+ */
1300
+ componentMount(name: string, context: Record<string, unknown>): void {
1301
+ // Always log to file first (for Ctrl+O LogBrowser)
1302
+ const jsonLogger = getJsonStreamLogger();
1303
+ if (jsonLogger?.isActive()) {
1304
+ jsonLogger.logDebug(`[COMPONENT] Mount: ${name}`, context);
1305
+ }
1306
+
1307
+ // Console output controlled by log level
1308
+ if (this.level < LogLevel.DEBUG) return;
1309
+
1310
+ const location = this.getCallLocation();
1311
+ const timestamp = this.getTimestamp();
1312
+ const prefix = this.getPrefix();
1313
+ const loc = this.getLocation(location);
1314
+
1315
+ console.log(timestamp, prefix, loc, chalk.green('📦 COMPONENT MOUNT:'), name);
1316
+ if (Object.keys(context).length > 0) {
1317
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
1318
+ }
1319
+ }
1320
+
1321
+ /**
1322
+ * Log component unmount
1323
+ */
1324
+ componentUnmount(name: string, context: Record<string, unknown>): void {
1325
+ // Always log to file first (for Ctrl+O LogBrowser)
1326
+ const jsonLogger = getJsonStreamLogger();
1327
+ if (jsonLogger?.isActive()) {
1328
+ jsonLogger.logDebug(`[COMPONENT] Unmount: ${name}`, context);
1329
+ }
1330
+
1331
+ // Console output controlled by log level
1332
+ if (this.level < LogLevel.DEBUG) return;
1333
+
1334
+ const location = this.getCallLocation();
1335
+ const timestamp = this.getTimestamp();
1336
+ const prefix = this.getPrefix();
1337
+ const loc = this.getLocation(location);
1338
+
1339
+ console.log(timestamp, prefix, loc, chalk.red('📦 COMPONENT UNMOUNT:'), name);
1340
+ if (Object.keys(context).length > 0) {
1341
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
1342
+ }
1343
+ }
1344
+
1345
+ /**
1346
+ * Log component render
1347
+ */
1348
+ componentRender(name: string, context: Record<string, unknown>): void {
1349
+ // Always log to file first (for Ctrl+O LogBrowser)
1350
+ const jsonLogger = getJsonStreamLogger();
1351
+ if (jsonLogger?.isActive()) {
1352
+ jsonLogger.logDebug(`[COMPONENT] Render: ${name}`, context);
1353
+ }
1354
+
1355
+ // Console output controlled by log level
1356
+ if (this.level < LogLevel.VERBOSE) return;
1357
+
1358
+ const location = this.getCallLocation();
1359
+ const timestamp = this.getTimestamp();
1360
+ const prefix = this.getPrefix();
1361
+ const loc = this.getLocation(location);
1362
+
1363
+ console.log(timestamp, prefix, loc, chalk.blue('📦 COMPONENT RENDER:'), name);
1364
+ if (Object.keys(context).length > 0) {
1365
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
1366
+ }
1367
+ }
1368
+
1369
+ /**
1370
+ * Log component render complete
1371
+ */
1372
+ componentRenderComplete(name: string, context: Record<string, unknown>): void {
1373
+ // Always log to file first (for Ctrl+O LogBrowser)
1374
+ const jsonLogger = getJsonStreamLogger();
1375
+ if (jsonLogger?.isActive()) {
1376
+ jsonLogger.logDebug(`[COMPONENT] Render Complete: ${name}`, context);
1377
+ }
1378
+
1379
+ // Console output controlled by log level
1380
+ if (this.level < LogLevel.VERBOSE) return;
1381
+
1382
+ const location = this.getCallLocation();
1383
+ const timestamp = this.getTimestamp();
1384
+ const prefix = this.getPrefix();
1385
+ const loc = this.getLocation(location);
1386
+
1387
+ console.log(timestamp, prefix, loc, chalk.green('✓ COMPONENT RENDER COMPLETE:'), name);
1388
+ if (Object.keys(context).length > 0) {
1389
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
1390
+ }
1391
+ }
1392
+
1393
+ /**
1394
+ * Log component state change
1395
+ */
1396
+ componentStateChange(name: string, field: string, context: Record<string, unknown>): void {
1397
+ // Always log to file first (for Ctrl+O LogBrowser)
1398
+ const jsonLogger = getJsonStreamLogger();
1399
+ if (jsonLogger?.isActive()) {
1400
+ jsonLogger.logDebug(`[COMPONENT] State Change: ${name}.${field}`, context);
1401
+ }
1402
+
1403
+ // Console output controlled by log level
1404
+ if (this.level < LogLevel.DEBUG) return;
1405
+
1406
+ const location = this.getCallLocation();
1407
+ const timestamp = this.getTimestamp();
1408
+ const prefix = this.getPrefix();
1409
+ const loc = this.getLocation(location);
1410
+
1411
+ console.log(timestamp, prefix, loc, chalk.yellow('🔄 COMPONENT STATE:'), `${name}.${field}`);
1412
+ if (Object.keys(context).length > 0) {
1413
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1414
+ }
1415
+ }
1416
+
1417
+ // ============================================================================
1418
+ // Screen/Navigation Methods
1419
+ // ============================================================================
1420
+
1421
+ /**
1422
+ * Log screen change
1423
+ */
1424
+ screenChange(to: string, context: Record<string, unknown>): void {
1425
+ // Always log to file first (for Ctrl+O LogBrowser)
1426
+ const jsonLogger = getJsonStreamLogger();
1427
+ if (jsonLogger?.isActive()) {
1428
+ jsonLogger.logDebug(`[SCREEN] Change: ${to}`, context);
1429
+ }
1430
+
1431
+ // Console output controlled by log level
1432
+ if (this.level < LogLevel.DEBUG) return;
1433
+
1434
+ const location = this.getCallLocation();
1435
+ const timestamp = this.getTimestamp();
1436
+ const prefix = this.getPrefix();
1437
+ const loc = this.getLocation(location);
1438
+
1439
+ console.log(timestamp, prefix, loc, chalk.magenta('📱 SCREEN CHANGE:'), to);
1440
+ if (Object.keys(context).length > 0) {
1441
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
1442
+ }
1443
+ }
1444
+
1445
+ /**
1446
+ * Log tab change
1447
+ */
1448
+ tabChange(container: string, context: Record<string, unknown>): void {
1449
+ // Always log to file first (for Ctrl+O LogBrowser)
1450
+ const jsonLogger = getJsonStreamLogger();
1451
+ if (jsonLogger?.isActive()) {
1452
+ jsonLogger.logDebug(`[TAB] Change: ${container}`, context);
1453
+ }
1454
+
1455
+ // Console output controlled by log level
1456
+ if (this.level < LogLevel.DEBUG) return;
1457
+
1458
+ const location = this.getCallLocation();
1459
+ const timestamp = this.getTimestamp();
1460
+ const prefix = this.getPrefix();
1461
+ const loc = this.getLocation(location);
1462
+
1463
+ console.log(timestamp, prefix, loc, chalk.magenta('🗂️ TAB CHANGE:'), container);
1464
+ if (Object.keys(context).length > 0) {
1465
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
1466
+ }
1467
+ }
1468
+
1469
+ /**
1470
+ * Log route change
1471
+ */
1472
+ routeChange(context: Record<string, unknown>): void {
1473
+ // Always log to file first (for Ctrl+O LogBrowser)
1474
+ const jsonLogger = getJsonStreamLogger();
1475
+ if (jsonLogger?.isActive()) {
1476
+ jsonLogger.logDebug(`[ROUTE] Change`, context);
1477
+ }
1478
+
1479
+ // Console output controlled by log level
1480
+ if (this.level < LogLevel.DEBUG) return;
1481
+
1482
+ const location = this.getCallLocation();
1483
+ const timestamp = this.getTimestamp();
1484
+ const prefix = this.getPrefix();
1485
+ const loc = this.getLocation(location);
1486
+
1487
+ console.log(timestamp, prefix, loc, chalk.magenta('🛤️ ROUTE CHANGE'));
1488
+ if (Object.keys(context).length > 0) {
1489
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
1490
+ }
1491
+ }
1492
+
1493
+ // ============================================================================
1494
+ // Form Methods
1495
+ // ============================================================================
1496
+
1497
+ /**
1498
+ * Log form start
1499
+ */
1500
+ formStart(formId: string, context: Record<string, unknown>): void {
1501
+ // Always log to file first (for Ctrl+O LogBrowser)
1502
+ const jsonLogger = getJsonStreamLogger();
1503
+ if (jsonLogger?.isActive()) {
1504
+ jsonLogger.logDebug(`[FORM] Start: ${formId}`, context);
1505
+ }
1506
+
1507
+ // Console output controlled by log level
1508
+ if (this.level < LogLevel.DEBUG) return;
1509
+
1510
+ const location = this.getCallLocation();
1511
+ const timestamp = this.getTimestamp();
1512
+ const prefix = this.getPrefix();
1513
+ const loc = this.getLocation(location);
1514
+
1515
+ console.log(timestamp, prefix, loc, chalk.blue('📝 FORM START:'), formId);
1516
+ if (Object.keys(context).length > 0) {
1517
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
1518
+ }
1519
+ }
1520
+
1521
+ /**
1522
+ * Log form submit
1523
+ */
1524
+ formSubmit(formId: string, context: Record<string, unknown>): void {
1525
+ // Always log to file first (for Ctrl+O LogBrowser)
1526
+ const jsonLogger = getJsonStreamLogger();
1527
+ if (jsonLogger?.isActive()) {
1528
+ jsonLogger.logDebug(`[FORM] Submit: ${formId}`, context);
1529
+ }
1530
+
1531
+ // Console output controlled by log level
1532
+ if (this.level < LogLevel.DEBUG) return;
1533
+
1534
+ const location = this.getCallLocation();
1535
+ const timestamp = this.getTimestamp();
1536
+ const prefix = this.getPrefix();
1537
+ const loc = this.getLocation(location);
1538
+
1539
+ console.log(timestamp, prefix, loc, chalk.blue('📤 FORM SUBMIT:'), formId);
1540
+ if (Object.keys(context).length > 0) {
1541
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
1542
+ }
1543
+ }
1544
+
1545
+ /**
1546
+ * Log form result
1547
+ */
1548
+ formResult(formId: string, context: Record<string, unknown>): void {
1549
+ // Always log to file first (for Ctrl+O LogBrowser)
1550
+ const jsonLogger = getJsonStreamLogger();
1551
+ if (jsonLogger?.isActive()) {
1552
+ jsonLogger.logDebug(`[FORM] Result: ${formId}`, context);
1553
+ }
1554
+
1555
+ // Console output controlled by log level
1556
+ if (this.level < LogLevel.DEBUG) return;
1557
+
1558
+ const location = this.getCallLocation();
1559
+ const timestamp = this.getTimestamp();
1560
+ const prefix = this.getPrefix();
1561
+ const loc = this.getLocation(location);
1562
+
1563
+ console.log(timestamp, prefix, loc, chalk.green('✓ FORM RESULT:'), formId);
1564
+ if (Object.keys(context).length > 0) {
1565
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
1566
+ }
1567
+ }
1568
+
1569
+ /**
1570
+ * Log form error
1571
+ */
1572
+ formError(formId: string, context: Record<string, unknown>): void {
1573
+ // Always log to file first (for Ctrl+O LogBrowser)
1574
+ const jsonLogger = getJsonStreamLogger();
1575
+ if (jsonLogger?.isActive()) {
1576
+ jsonLogger.logDebug(`[FORM] Error: ${formId}`, context);
1577
+ }
1578
+
1579
+ // Console output controlled by log level
1580
+ if (this.level < LogLevel.DEBUG) return;
1581
+
1582
+ const location = this.getCallLocation();
1583
+ const timestamp = this.getTimestamp();
1584
+ const prefix = this.getPrefix();
1585
+ const loc = this.getLocation(location);
1586
+
1587
+ console.log(timestamp, prefix, loc, chalk.red('✗ FORM ERROR:'), formId);
1588
+ if (Object.keys(context).length > 0) {
1589
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
1590
+ }
1591
+ }
1592
+
1593
+ /**
1594
+ * Log field change
1595
+ */
1596
+ fieldChange(formId: string, field: string, context: Record<string, unknown>): void {
1597
+ // Always log to file first (for Ctrl+O LogBrowser)
1598
+ const jsonLogger = getJsonStreamLogger();
1599
+ if (jsonLogger?.isActive()) {
1600
+ jsonLogger.logDebug(`[FORM] Field Change: ${formId}.${field}`, context);
1601
+ }
1602
+
1603
+ // Console output controlled by log level
1604
+ if (this.level < LogLevel.VERBOSE) return;
1605
+
1606
+ const location = this.getCallLocation();
1607
+ const timestamp = this.getTimestamp();
1608
+ const prefix = this.getPrefix();
1609
+ const loc = this.getLocation(location);
1610
+
1611
+ console.log(timestamp, prefix, loc, chalk.gray('📝 FIELD CHANGE:'), `${formId}.${field}`);
1612
+ if (Object.keys(context).length > 0) {
1613
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
1614
+ }
1615
+ }
1616
+
1617
+ /**
1618
+ * Log field validation
1619
+ */
1620
+ fieldValidation(formId: string, field: string, context: Record<string, unknown>): void {
1621
+ // Always log to file first (for Ctrl+O LogBrowser)
1622
+ const jsonLogger = getJsonStreamLogger();
1623
+ if (jsonLogger?.isActive()) {
1624
+ jsonLogger.logDebug(`[FORM] Field Validation: ${formId}.${field}`, context);
1625
+ }
1626
+
1627
+ // Console output controlled by log level
1628
+ if (this.level < LogLevel.DEBUG) return;
1629
+
1630
+ const location = this.getCallLocation();
1631
+ const timestamp = this.getTimestamp();
1632
+ const prefix = this.getPrefix();
1633
+ const loc = this.getLocation(location);
1634
+
1635
+ console.log(timestamp, prefix, loc, chalk.yellow('✓ FIELD VALIDATION:'), `${formId}.${field}`);
1636
+ if (Object.keys(context).length > 0) {
1637
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1638
+ }
1639
+ }
1640
+
1641
+ // ============================================================================
1642
+ // Modal/Dialog Methods
1643
+ // ============================================================================
1644
+
1645
+ /**
1646
+ * Log modal open
1647
+ */
1648
+ modalOpen(id: string, context: Record<string, unknown>): void {
1649
+ // Always log to file first (for Ctrl+O LogBrowser)
1650
+ const jsonLogger = getJsonStreamLogger();
1651
+ if (jsonLogger?.isActive()) {
1652
+ jsonLogger.logDebug(`[MODAL] Open: ${id}`, context);
1653
+ }
1654
+
1655
+ // Console output controlled by log level
1656
+ if (this.level < LogLevel.DEBUG) return;
1657
+
1658
+ const location = this.getCallLocation();
1659
+ const timestamp = this.getTimestamp();
1660
+ const prefix = this.getPrefix();
1661
+ const loc = this.getLocation(location);
1662
+
1663
+ console.log(timestamp, prefix, loc, chalk.cyan('📭 MODAL OPEN:'), id);
1664
+ if (Object.keys(context).length > 0) {
1665
+ console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
1666
+ }
1667
+ }
1668
+
1669
+ /**
1670
+ * Log modal close
1671
+ */
1672
+ modalClose(id: string, context: Record<string, unknown>): void {
1673
+ // Always log to file first (for Ctrl+O LogBrowser)
1674
+ const jsonLogger = getJsonStreamLogger();
1675
+ if (jsonLogger?.isActive()) {
1676
+ jsonLogger.logDebug(`[MODAL] Close: ${id}`, context);
1677
+ }
1678
+
1679
+ // Console output controlled by log level
1680
+ if (this.level < LogLevel.DEBUG) return;
1681
+
1682
+ const location = this.getCallLocation();
1683
+ const timestamp = this.getTimestamp();
1684
+ const prefix = this.getPrefix();
1685
+ const loc = this.getLocation(location);
1686
+
1687
+ console.log(timestamp, prefix, loc, chalk.cyan('📪 MODAL CLOSE:'), id);
1688
+ if (Object.keys(context).length > 0) {
1689
+ console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
1690
+ }
1691
+ }
1692
+
1693
+ /**
1694
+ * Log dialog show
1695
+ */
1696
+ dialogShow(type: string, context: Record<string, unknown>): void {
1697
+ // Always log to file first (for Ctrl+O LogBrowser)
1698
+ const jsonLogger = getJsonStreamLogger();
1699
+ if (jsonLogger?.isActive()) {
1700
+ jsonLogger.logDebug(`[DIALOG] Show: ${type}`, context);
1701
+ }
1702
+
1703
+ // Console output controlled by log level
1704
+ if (this.level < LogLevel.DEBUG) return;
1705
+
1706
+ const location = this.getCallLocation();
1707
+ const timestamp = this.getTimestamp();
1708
+ const prefix = this.getPrefix();
1709
+ const loc = this.getLocation(location);
1710
+
1711
+ console.log(timestamp, prefix, loc, chalk.cyan('💬 DIALOG SHOW:'), type);
1712
+ if (Object.keys(context).length > 0) {
1713
+ console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
1714
+ }
1715
+ }
1716
+
1717
+ /**
1718
+ * Log dialog result
1719
+ */
1720
+ dialogResult(type: string, context: Record<string, unknown>): void {
1721
+ // Always log to file first (for Ctrl+O LogBrowser)
1722
+ const jsonLogger = getJsonStreamLogger();
1723
+ if (jsonLogger?.isActive()) {
1724
+ jsonLogger.logDebug(`[DIALOG] Result: ${type}`, context);
1725
+ }
1726
+
1727
+ // Console output controlled by log level
1728
+ if (this.level < LogLevel.DEBUG) return;
1729
+
1730
+ const location = this.getCallLocation();
1731
+ const timestamp = this.getTimestamp();
1732
+ const prefix = this.getPrefix();
1733
+ const loc = this.getLocation(location);
1734
+
1735
+ console.log(timestamp, prefix, loc, chalk.cyan('💬 DIALOG RESULT:'), type);
1736
+ if (Object.keys(context).length > 0) {
1737
+ console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
1738
+ }
1739
+ }
1740
+
1741
+ /**
1742
+ * Log toast show
1743
+ */
1744
+ toastShow(context: Record<string, unknown>): void {
1745
+ // Always log to file first (for Ctrl+O LogBrowser)
1746
+ const jsonLogger = getJsonStreamLogger();
1747
+ if (jsonLogger?.isActive()) {
1748
+ jsonLogger.logDebug(`[TOAST] Show`, context);
1749
+ }
1750
+
1751
+ // Console output controlled by log level
1752
+ if (this.level < LogLevel.DEBUG) return;
1753
+
1754
+ const location = this.getCallLocation();
1755
+ const timestamp = this.getTimestamp();
1756
+ const prefix = this.getPrefix();
1757
+ const loc = this.getLocation(location);
1758
+
1759
+ console.log(timestamp, prefix, loc, chalk.yellow('🔔 TOAST SHOW'));
1760
+ if (Object.keys(context).length > 0) {
1761
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
1762
+ }
1763
+ }
1764
+
1765
+ /**
1766
+ * Log toast dismiss
1767
+ */
1768
+ toastDismiss(context: Record<string, unknown>): void {
1769
+ // Always log to file first (for Ctrl+O LogBrowser)
1770
+ const jsonLogger = getJsonStreamLogger();
1771
+ if (jsonLogger?.isActive()) {
1772
+ jsonLogger.logDebug(`[TOAST] Dismiss`, context);
1773
+ }
1774
+
1775
+ // Console output controlled by log level
1776
+ if (this.level < LogLevel.DEBUG) return;
1777
+
1778
+ const location = this.getCallLocation();
1779
+ const timestamp = this.getTimestamp();
1780
+ const prefix = this.getPrefix();
1781
+ const loc = this.getLocation(location);
1782
+
1783
+ console.log(timestamp, prefix, loc, chalk.gray('🔕 TOAST DISMISS'));
1784
+ if (Object.keys(context).length > 0) {
1785
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
1786
+ }
1787
+ }
1788
+
1789
+ // ============================================================================
1790
+ // Loading Methods
1791
+ // ============================================================================
1792
+
1793
+ /**
1794
+ * Log loading start
1795
+ */
1796
+ loadingStart(id: string, context: Record<string, unknown>): void {
1797
+ // Always log to file first (for Ctrl+O LogBrowser)
1798
+ const jsonLogger = getJsonStreamLogger();
1799
+ if (jsonLogger?.isActive()) {
1800
+ jsonLogger.logDebug(`[LOADING] Start: ${id}`, context);
1801
+ }
1802
+
1803
+ // Console output controlled by log level
1804
+ if (this.level < LogLevel.DEBUG) return;
1805
+
1806
+ const location = this.getCallLocation();
1807
+ const timestamp = this.getTimestamp();
1808
+ const prefix = this.getPrefix();
1809
+ const loc = this.getLocation(location);
1810
+
1811
+ console.log(timestamp, prefix, loc, chalk.blue('⏳ LOADING START:'), id);
1812
+ if (Object.keys(context).length > 0) {
1813
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
1814
+ }
1815
+ }
1816
+
1817
+ /**
1818
+ * Log loading end
1819
+ */
1820
+ loadingEnd(id: string, context: Record<string, unknown>): void {
1821
+ // Always log to file first (for Ctrl+O LogBrowser)
1822
+ const jsonLogger = getJsonStreamLogger();
1823
+ if (jsonLogger?.isActive()) {
1824
+ jsonLogger.logDebug(`[LOADING] End: ${id}`, context);
1825
+ }
1826
+
1827
+ // Console output controlled by log level
1828
+ if (this.level < LogLevel.DEBUG) return;
1829
+
1830
+ const location = this.getCallLocation();
1831
+ const timestamp = this.getTimestamp();
1832
+ const prefix = this.getPrefix();
1833
+ const loc = this.getLocation(location);
1834
+
1835
+ console.log(timestamp, prefix, loc, chalk.green('✓ LOADING END:'), id);
1836
+ if (Object.keys(context).length > 0) {
1837
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
1838
+ }
1839
+ }
1840
+
1841
+ /**
1842
+ * Log loading error
1843
+ */
1844
+ loadingError(id: string, context: Record<string, unknown>): void {
1845
+ // Always log to file first (for Ctrl+O LogBrowser)
1846
+ const jsonLogger = getJsonStreamLogger();
1847
+ if (jsonLogger?.isActive()) {
1848
+ jsonLogger.logDebug(`[LOADING] Error: ${id}`, context);
1849
+ }
1850
+
1851
+ // Console output controlled by log level
1852
+ if (this.level < LogLevel.DEBUG) return;
1853
+
1854
+ const location = this.getCallLocation();
1855
+ const timestamp = this.getTimestamp();
1856
+ const prefix = this.getPrefix();
1857
+ const loc = this.getLocation(location);
1858
+
1859
+ console.log(timestamp, prefix, loc, chalk.red('✗ LOADING ERROR:'), id);
1860
+ if (Object.keys(context).length > 0) {
1861
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
1862
+ }
1863
+ }
1864
+
1865
+ /**
1866
+ * Log skeleton show
1867
+ */
1868
+ skeletonShow(id: string, context: Record<string, unknown>): void {
1869
+ // Always log to file first (for Ctrl+O LogBrowser)
1870
+ const jsonLogger = getJsonStreamLogger();
1871
+ if (jsonLogger?.isActive()) {
1872
+ jsonLogger.logDebug(`[UI] Skeleton Show: ${id}`, context);
1873
+ }
1874
+
1875
+ // Console output controlled by log level
1876
+ if (this.level < LogLevel.VERBOSE) return;
1877
+
1878
+ const location = this.getCallLocation();
1879
+ const timestamp = this.getTimestamp();
1880
+ const prefix = this.getPrefix();
1881
+ const loc = this.getLocation(location);
1882
+
1883
+ console.log(timestamp, prefix, loc, chalk.gray('💀 SKELETON SHOW:'), id);
1884
+ if (Object.keys(context).length > 0) {
1885
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
1886
+ }
1887
+ }
1888
+
1889
+ /**
1890
+ * Log skeleton hide
1891
+ */
1892
+ skeletonHide(id: string, context: Record<string, unknown>): void {
1893
+ // Always log to file first (for Ctrl+O LogBrowser)
1894
+ const jsonLogger = getJsonStreamLogger();
1895
+ if (jsonLogger?.isActive()) {
1896
+ jsonLogger.logDebug(`[UI] Skeleton Hide: ${id}`, context);
1897
+ }
1898
+
1899
+ // Console output controlled by log level
1900
+ if (this.level < LogLevel.VERBOSE) return;
1901
+
1902
+ const location = this.getCallLocation();
1903
+ const timestamp = this.getTimestamp();
1904
+ const prefix = this.getPrefix();
1905
+ const loc = this.getLocation(location);
1906
+
1907
+ console.log(timestamp, prefix, loc, chalk.gray('💀 SKELETON HIDE:'), id);
1908
+ if (Object.keys(context).length > 0) {
1909
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
1910
+ }
1911
+ }
1912
+
1913
+ /**
1914
+ * Log progress start
1915
+ */
1916
+ progressStart(id: string, context: Record<string, unknown>): void {
1917
+ // Always log to file first (for Ctrl+O LogBrowser)
1918
+ const jsonLogger = getJsonStreamLogger();
1919
+ if (jsonLogger?.isActive()) {
1920
+ jsonLogger.logDebug(`[PROGRESS] Start: ${id}`, context);
1921
+ }
1922
+
1923
+ // Console output controlled by log level
1924
+ if (this.level < LogLevel.DEBUG) return;
1925
+
1926
+ const location = this.getCallLocation();
1927
+ const timestamp = this.getTimestamp();
1928
+ const prefix = this.getPrefix();
1929
+ const loc = this.getLocation(location);
1930
+
1931
+ console.log(timestamp, prefix, loc, chalk.blue('📊 PROGRESS START:'), id);
1932
+ if (Object.keys(context).length > 0) {
1933
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
1934
+ }
1935
+ }
1936
+
1937
+ /**
1938
+ * Log progress update
1939
+ */
1940
+ progressUpdate(id: string, context: Record<string, unknown>): void {
1941
+ // Always log to file first (for Ctrl+O LogBrowser)
1942
+ const jsonLogger = getJsonStreamLogger();
1943
+ if (jsonLogger?.isActive()) {
1944
+ jsonLogger.logDebug(`[PROGRESS] Update: ${id}`, context);
1945
+ }
1946
+
1947
+ // Console output controlled by log level
1948
+ if (this.level < LogLevel.VERBOSE) return;
1949
+
1950
+ const location = this.getCallLocation();
1951
+ const timestamp = this.getTimestamp();
1952
+ const prefix = this.getPrefix();
1953
+ const loc = this.getLocation(location);
1954
+
1955
+ console.log(timestamp, prefix, loc, chalk.blue('📊 PROGRESS UPDATE:'), id);
1956
+ if (Object.keys(context).length > 0) {
1957
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
1958
+ }
1959
+ }
1960
+
1961
+ /**
1962
+ * Log progress complete
1963
+ */
1964
+ progressComplete(id: string, context: Record<string, unknown>): void {
1965
+ // Always log to file first (for Ctrl+O LogBrowser)
1966
+ const jsonLogger = getJsonStreamLogger();
1967
+ if (jsonLogger?.isActive()) {
1968
+ jsonLogger.logDebug(`[PROGRESS] Complete: ${id}`, context);
1969
+ }
1970
+
1971
+ // Console output controlled by log level
1972
+ if (this.level < LogLevel.DEBUG) return;
1973
+
1974
+ const location = this.getCallLocation();
1975
+ const timestamp = this.getTimestamp();
1976
+ const prefix = this.getPrefix();
1977
+ const loc = this.getLocation(location);
1978
+
1979
+ console.log(timestamp, prefix, loc, chalk.green('✓ PROGRESS COMPLETE:'), id);
1980
+ if (Object.keys(context).length > 0) {
1981
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
1982
+ }
1983
+ }
1984
+
1985
+ /**
1986
+ * Log progress error
1987
+ */
1988
+ progressError(id: string, context: Record<string, unknown>): void {
1989
+ // Always log to file first (for Ctrl+O LogBrowser)
1990
+ const jsonLogger = getJsonStreamLogger();
1991
+ if (jsonLogger?.isActive()) {
1992
+ jsonLogger.logDebug(`[PROGRESS] Error: ${id}`, context);
1993
+ }
1994
+
1995
+ // Console output controlled by log level
1996
+ if (this.level < LogLevel.DEBUG) return;
1997
+
1998
+ const location = this.getCallLocation();
1999
+ const timestamp = this.getTimestamp();
2000
+ const prefix = this.getPrefix();
2001
+ const loc = this.getLocation(location);
2002
+
2003
+ console.log(timestamp, prefix, loc, chalk.red('✗ PROGRESS ERROR:'), id);
2004
+ if (Object.keys(context).length > 0) {
2005
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
2006
+ }
2007
+ }
2008
+
2009
+ // ============================================================================
2010
+ // Animation Methods
2011
+ // ============================================================================
2012
+
2013
+ /**
2014
+ * Log animation start
2015
+ */
2016
+ animationStart(name: string, context: Record<string, unknown>): void {
2017
+ // Always log to file first (for Ctrl+O LogBrowser)
2018
+ const jsonLogger = getJsonStreamLogger();
2019
+ if (jsonLogger?.isActive()) {
2020
+ jsonLogger.logDebug(`[UI] Animation Start: ${name}`, context);
2021
+ }
2022
+
2023
+ // Console output controlled by log level
2024
+ if (this.level < LogLevel.VERBOSE) return;
2025
+
2026
+ const location = this.getCallLocation();
2027
+ const timestamp = this.getTimestamp();
2028
+ const prefix = this.getPrefix();
2029
+ const loc = this.getLocation(location);
2030
+
2031
+ console.log(timestamp, prefix, loc, chalk.magenta('🎬 ANIMATION START:'), name);
2032
+ if (Object.keys(context).length > 0) {
2033
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
2034
+ }
2035
+ }
2036
+
2037
+ /**
2038
+ * Log animation end
2039
+ */
2040
+ animationEnd(name: string, context: Record<string, unknown>): void {
2041
+ // Always log to file first (for Ctrl+O LogBrowser)
2042
+ const jsonLogger = getJsonStreamLogger();
2043
+ if (jsonLogger?.isActive()) {
2044
+ jsonLogger.logDebug(`[UI] Animation End: ${name}`, context);
2045
+ }
2046
+
2047
+ // Console output controlled by log level
2048
+ if (this.level < LogLevel.VERBOSE) return;
2049
+
2050
+ const location = this.getCallLocation();
2051
+ const timestamp = this.getTimestamp();
2052
+ const prefix = this.getPrefix();
2053
+ const loc = this.getLocation(location);
2054
+
2055
+ console.log(timestamp, prefix, loc, chalk.magenta('🎬 ANIMATION END:'), name);
2056
+ if (Object.keys(context).length > 0) {
2057
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
2058
+ }
2059
+ }
2060
+
2061
+ /**
2062
+ * Log transition start
2063
+ */
2064
+ transitionStart(name: string, context: Record<string, unknown>): void {
2065
+ // Always log to file first (for Ctrl+O LogBrowser)
2066
+ const jsonLogger = getJsonStreamLogger();
2067
+ if (jsonLogger?.isActive()) {
2068
+ jsonLogger.logDebug(`[UI] Transition Start: ${name}`, context);
2069
+ }
2070
+
2071
+ // Console output controlled by log level
2072
+ if (this.level < LogLevel.VERBOSE) return;
2073
+
2074
+ const location = this.getCallLocation();
2075
+ const timestamp = this.getTimestamp();
2076
+ const prefix = this.getPrefix();
2077
+ const loc = this.getLocation(location);
2078
+
2079
+ console.log(timestamp, prefix, loc, chalk.magenta('🔀 TRANSITION START:'), name);
2080
+ if (Object.keys(context).length > 0) {
2081
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
2082
+ }
2083
+ }
2084
+
2085
+ /**
2086
+ * Log transition end
2087
+ */
2088
+ transitionEnd(name: string, context: Record<string, unknown>): void {
2089
+ // Always log to file first (for Ctrl+O LogBrowser)
2090
+ const jsonLogger = getJsonStreamLogger();
2091
+ if (jsonLogger?.isActive()) {
2092
+ jsonLogger.logDebug(`[UI] Transition End: ${name}`, context);
2093
+ }
2094
+
2095
+ // Console output controlled by log level
2096
+ if (this.level < LogLevel.VERBOSE) return;
2097
+
2098
+ const location = this.getCallLocation();
2099
+ const timestamp = this.getTimestamp();
2100
+ const prefix = this.getPrefix();
2101
+ const loc = this.getLocation(location);
2102
+
2103
+ console.log(timestamp, prefix, loc, chalk.magenta('🔀 TRANSITION END:'), name);
2104
+ if (Object.keys(context).length > 0) {
2105
+ console.log(chalk.magenta(' Context:'), JSON.stringify(context, null, 2));
2106
+ }
2107
+ }
2108
+
2109
+ /**
2110
+ * Log hover enter
2111
+ */
2112
+ hoverEnter(element: string, context: Record<string, unknown>): void {
2113
+ // Always log to file first (for Ctrl+O LogBrowser)
2114
+ const jsonLogger = getJsonStreamLogger();
2115
+ if (jsonLogger?.isActive()) {
2116
+ jsonLogger.logDebug(`[UI] Hover Enter: ${element}`, context);
2117
+ }
2118
+
2119
+ // Console output controlled by log level
2120
+ if (this.level < LogLevel.VERBOSE) return;
2121
+
2122
+ const location = this.getCallLocation();
2123
+ const timestamp = this.getTimestamp();
2124
+ const prefix = this.getPrefix();
2125
+ const loc = this.getLocation(location);
2126
+
2127
+ console.log(timestamp, prefix, loc, chalk.gray('🖱️ HOVER ENTER:'), element);
2128
+ if (Object.keys(context).length > 0) {
2129
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
2130
+ }
2131
+ }
2132
+
2133
+ /**
2134
+ * Log hover leave
2135
+ */
2136
+ hoverLeave(element: string, context: Record<string, unknown>): void {
2137
+ // Always log to file first (for Ctrl+O LogBrowser)
2138
+ const jsonLogger = getJsonStreamLogger();
2139
+ if (jsonLogger?.isActive()) {
2140
+ jsonLogger.logDebug(`[UI] Hover Leave: ${element}`, context);
2141
+ }
2142
+
2143
+ // Console output controlled by log level
2144
+ if (this.level < LogLevel.VERBOSE) return;
2145
+
2146
+ const location = this.getCallLocation();
2147
+ const timestamp = this.getTimestamp();
2148
+ const prefix = this.getPrefix();
2149
+ const loc = this.getLocation(location);
2150
+
2151
+ console.log(timestamp, prefix, loc, chalk.gray('🖱️ HOVER LEAVE:'), element);
2152
+ if (Object.keys(context).length > 0) {
2153
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
2154
+ }
2155
+ }
2156
+
2157
+ // ============================================================================
2158
+ // Layout Methods
2159
+ // ============================================================================
2160
+
2161
+ /**
2162
+ * Log viewport resize
2163
+ */
2164
+ viewportResize(context: Record<string, unknown>): void {
2165
+ // Always log to file first (for Ctrl+O LogBrowser)
2166
+ const jsonLogger = getJsonStreamLogger();
2167
+ if (jsonLogger?.isActive()) {
2168
+ jsonLogger.logDebug(`[LAYOUT] Viewport Resize`, context);
2169
+ }
2170
+
2171
+ // Console output controlled by log level
2172
+ if (this.level < LogLevel.DEBUG) return;
2173
+
2174
+ const location = this.getCallLocation();
2175
+ const timestamp = this.getTimestamp();
2176
+ const prefix = this.getPrefix();
2177
+ const loc = this.getLocation(location);
2178
+
2179
+ console.log(timestamp, prefix, loc, chalk.blue('📐 VIEWPORT RESIZE'));
2180
+ if (Object.keys(context).length > 0) {
2181
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
2182
+ }
2183
+ }
2184
+
2185
+ /**
2186
+ * Log breakpoint change
2187
+ */
2188
+ breakpointChange(context: Record<string, unknown>): void {
2189
+ // Always log to file first (for Ctrl+O LogBrowser)
2190
+ const jsonLogger = getJsonStreamLogger();
2191
+ if (jsonLogger?.isActive()) {
2192
+ jsonLogger.logDebug(`[LAYOUT] Breakpoint Change`, context);
2193
+ }
2194
+
2195
+ // Console output controlled by log level
2196
+ if (this.level < LogLevel.DEBUG) return;
2197
+
2198
+ const location = this.getCallLocation();
2199
+ const timestamp = this.getTimestamp();
2200
+ const prefix = this.getPrefix();
2201
+ const loc = this.getLocation(location);
2202
+
2203
+ console.log(timestamp, prefix, loc, chalk.blue('📐 BREAKPOINT CHANGE'));
2204
+ if (Object.keys(context).length > 0) {
2205
+ console.log(chalk.blue(' Context:'), JSON.stringify(context, null, 2));
2206
+ }
2207
+ }
2208
+
2209
+ /**
2210
+ * Log layout shift
2211
+ */
2212
+ layoutShift(context: Record<string, unknown>): void {
2213
+ // Always log to file first (for Ctrl+O LogBrowser)
2214
+ const jsonLogger = getJsonStreamLogger();
2215
+ if (jsonLogger?.isActive()) {
2216
+ jsonLogger.logDebug(`[LAYOUT] Shift`, context);
2217
+ }
2218
+
2219
+ // Console output controlled by log level
2220
+ if (this.level < LogLevel.DEBUG) return;
2221
+
2222
+ const location = this.getCallLocation();
2223
+ const timestamp = this.getTimestamp();
2224
+ const prefix = this.getPrefix();
2225
+ const loc = this.getLocation(location);
2226
+
2227
+ console.log(timestamp, prefix, loc, chalk.yellow('📐 LAYOUT SHIFT'));
2228
+ if (Object.keys(context).length > 0) {
2229
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
2230
+ }
2231
+ }
2232
+
2233
+ /**
2234
+ * Log scroll position
2235
+ */
2236
+ scrollPosition(context: Record<string, unknown>): void {
2237
+ // Always log to file first (for Ctrl+O LogBrowser)
2238
+ const jsonLogger = getJsonStreamLogger();
2239
+ if (jsonLogger?.isActive()) {
2240
+ jsonLogger.logDebug('[UI] Scroll Position', context);
2241
+ }
2242
+
2243
+ // Console output controlled by log level
2244
+ if (this.level < LogLevel.VERBOSE) return;
2245
+
2246
+ const location = this.getCallLocation();
2247
+ const timestamp = this.getTimestamp();
2248
+ const prefix = this.getPrefix();
2249
+ const loc = this.getLocation(location);
2250
+
2251
+ console.log(timestamp, prefix, loc, chalk.gray('📜 SCROLL POSITION'));
2252
+ if (Object.keys(context).length > 0) {
2253
+ console.log(chalk.gray(' Context:'), JSON.stringify(context, null, 2));
2254
+ }
2255
+ }
2256
+
2257
+ // ============================================================================
2258
+ // Error Boundary Methods
2259
+ // ============================================================================
2260
+
2261
+ /**
2262
+ * Log error boundary catch
2263
+ */
2264
+ errorBoundary(context: Record<string, unknown>): void {
2265
+ // Always log to file first (for Ctrl+O LogBrowser)
2266
+ const jsonLogger = getJsonStreamLogger();
2267
+ if (jsonLogger?.isActive()) {
2268
+ jsonLogger.logError(new Error('Error Boundary'), 'errorBoundary');
2269
+ }
2270
+
2271
+ // Console output controlled by log level
2272
+ if (this.level < LogLevel.ERROR) return;
2273
+
2274
+ const location = this.getCallLocation();
2275
+ const timestamp = this.getTimestamp();
2276
+ const prefix = this.getPrefix();
2277
+ const loc = this.getLocation(location);
2278
+
2279
+ console.log(timestamp, prefix, loc, chalk.red('🛡️ ERROR BOUNDARY'));
2280
+ if (Object.keys(context).length > 0) {
2281
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
2282
+ }
2283
+ }
2284
+
2285
+ /**
2286
+ * Log unhandled rejection
2287
+ */
2288
+ unhandledRejection(context: Record<string, unknown>): void {
2289
+ // Always log to file first (for Ctrl+O LogBrowser)
2290
+ const jsonLogger = getJsonStreamLogger();
2291
+ if (jsonLogger?.isActive()) {
2292
+ jsonLogger.logError(new Error('Unhandled Rejection'), 'unhandledRejection');
2293
+ }
2294
+
2295
+ // Console output controlled by log level
2296
+ if (this.level < LogLevel.ERROR) return;
2297
+
2298
+ const location = this.getCallLocation();
2299
+ const timestamp = this.getTimestamp();
2300
+ const prefix = this.getPrefix();
2301
+ const loc = this.getLocation(location);
2302
+
2303
+ console.log(timestamp, prefix, loc, chalk.red('⚠️ UNHANDLED REJECTION'));
2304
+ if (Object.keys(context).length > 0) {
2305
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
2306
+ }
2307
+ }
2308
+
2309
+ /**
2310
+ * Log global error
2311
+ */
2312
+ globalError(context: Record<string, unknown>): void {
2313
+ // Always log to file first (for Ctrl+O LogBrowser)
2314
+ const jsonLogger = getJsonStreamLogger();
2315
+ if (jsonLogger?.isActive()) {
2316
+ jsonLogger.logError(new Error('Global Error'), 'globalError');
2317
+ }
2318
+
2319
+ // Console output controlled by log level
2320
+ if (this.level < LogLevel.ERROR) return;
2321
+
2322
+ const location = this.getCallLocation();
2323
+ const timestamp = this.getTimestamp();
2324
+ const prefix = this.getPrefix();
2325
+ const loc = this.getLocation(location);
2326
+
2327
+ console.log(timestamp, prefix, loc, chalk.red('💥 GLOBAL ERROR'));
2328
+ if (Object.keys(context).length > 0) {
2329
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
2330
+ }
2331
+ }
2332
+
2333
+ // ============================================================================
2334
+ // Session Methods
2335
+ // ============================================================================
2336
+
2337
+ /**
2338
+ * Log session start
2339
+ */
2340
+ sessionStart(context: Record<string, unknown>): void {
2341
+ // Always log to file first (for Ctrl+O LogBrowser)
2342
+ const jsonLogger = getJsonStreamLogger();
2343
+ if (jsonLogger?.isActive()) {
2344
+ jsonLogger.logInfo(`Session Start`, context);
2345
+ }
2346
+
2347
+ // Console output controlled by log level
2348
+ if (this.level < LogLevel.INFO) return;
2349
+
2350
+ const location = this.getCallLocation();
2351
+ const timestamp = this.getTimestamp();
2352
+ const prefix = this.getPrefix();
2353
+ const loc = this.getLocation(location);
2354
+
2355
+ console.log(timestamp, prefix, loc, chalk.green('🚀 SESSION START'));
2356
+ if (Object.keys(context).length > 0) {
2357
+ console.log(chalk.green(' Context:'), JSON.stringify(context, null, 2));
2358
+ }
2359
+ }
2360
+
2361
+ /**
2362
+ * Log session end
2363
+ */
2364
+ sessionEnd(context: Record<string, unknown>): void {
2365
+ // Always log to file first (for Ctrl+O LogBrowser)
2366
+ const jsonLogger = getJsonStreamLogger();
2367
+ if (jsonLogger?.isActive()) {
2368
+ jsonLogger.logInfo(`Session End`, context);
2369
+ }
2370
+
2371
+ // Console output controlled by log level
2372
+ if (this.level < LogLevel.INFO) return;
2373
+
2374
+ const location = this.getCallLocation();
2375
+ const timestamp = this.getTimestamp();
2376
+ const prefix = this.getPrefix();
2377
+ const loc = this.getLocation(location);
2378
+
2379
+ console.log(timestamp, prefix, loc, chalk.red('🏁 SESSION END'));
2380
+ if (Object.keys(context).length > 0) {
2381
+ console.log(chalk.red(' Context:'), JSON.stringify(context, null, 2));
2382
+ }
2383
+ }
2384
+
2385
+ /**
2386
+ * Log user milestone
2387
+ */
2388
+ userMilestone(name: string, context: Record<string, unknown>): void {
2389
+ // Always log to file first (for Ctrl+O LogBrowser)
2390
+ const jsonLogger = getJsonStreamLogger();
2391
+ if (jsonLogger?.isActive()) {
2392
+ jsonLogger.logInfo(`User Milestone: ${name}`, context);
2393
+ }
2394
+
2395
+ // Console output controlled by log level
2396
+ if (this.level < LogLevel.INFO) return;
2397
+
2398
+ const location = this.getCallLocation();
2399
+ const timestamp = this.getTimestamp();
2400
+ const prefix = this.getPrefix();
2401
+ const loc = this.getLocation(location);
2402
+
2403
+ console.log(timestamp, prefix, loc, chalk.yellow('🏆 USER MILESTONE:'), name);
2404
+ if (Object.keys(context).length > 0) {
2405
+ console.log(chalk.yellow(' Context:'), JSON.stringify(context, null, 2));
2406
+ }
2407
+ }
2408
+
2409
+ /**
2410
+ * Log feature usage
2411
+ */
2412
+ featureUsage(name: string, context: Record<string, unknown>): void {
2413
+ // Always log to file first (for Ctrl+O LogBrowser)
2414
+ const jsonLogger = getJsonStreamLogger();
2415
+ if (jsonLogger?.isActive()) {
2416
+ jsonLogger.logDebug(`Feature Usage: ${name}`, context);
2417
+ }
2418
+
2419
+ // Console output controlled by log level
2420
+ if (this.level < LogLevel.DEBUG) return;
2421
+
2422
+ const location = this.getCallLocation();
2423
+ const timestamp = this.getTimestamp();
2424
+ const prefix = this.getPrefix();
2425
+ const loc = this.getLocation(location);
2426
+
2427
+ console.log(timestamp, prefix, loc, chalk.cyan('📊 FEATURE USAGE:'), name);
2428
+ if (Object.keys(context).length > 0) {
2429
+ console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
2430
+ }
2431
+ }
2432
+
2433
+ // ============================================================================
2434
+ // Update Methods (for S3AutoUpdater)
2435
+ // ============================================================================
2436
+
2437
+ /**
2438
+ * Log update check start
2439
+ */
2440
+ updateCheckStart(): void {
2441
+ // Always log to file first (for Ctrl+O LogBrowser)
2442
+ const jsonLogger = getJsonStreamLogger();
2443
+ if (jsonLogger?.isActive()) {
2444
+ jsonLogger.logInfo('Update Check Start', {});
2445
+ }
2446
+
2447
+ // Console output controlled by log level
2448
+ if (this.level < LogLevel.INFO) return;
2449
+
2450
+ const location = this.getCallLocation();
2451
+ const timestamp = this.getTimestamp();
2452
+ const prefix = this.getPrefix();
2453
+ const loc = this.getLocation(location);
2454
+
2455
+ console.log(timestamp, prefix, loc, chalk.cyan('🔄 UPDATE CHECK START'));
2456
+ }
2457
+
2458
+ /**
2459
+ * Log update available
2460
+ */
2461
+ updateAvailable(context: Record<string, unknown>): void {
2462
+ // Always log to file first (for Ctrl+O LogBrowser)
2463
+ const jsonLogger = getJsonStreamLogger();
2464
+ if (jsonLogger?.isActive()) {
2465
+ jsonLogger.logInfo('Update Available', context);
2466
+ }
2467
+
2468
+ // Console output controlled by log level
2469
+ if (this.level < LogLevel.INFO) return;
2470
+
2471
+ const location = this.getCallLocation();
2472
+ const timestamp = this.getTimestamp();
2473
+ const prefix = this.getPrefix();
2474
+ const loc = this.getLocation(location);
2475
+
2476
+ console.log(timestamp, prefix, loc, chalk.green('✨ UPDATE AVAILABLE'));
2477
+ if (Object.keys(context).length > 0) {
2478
+ console.log(chalk.green(' Version:'), context['version']);
2479
+ }
2480
+ }
2481
+
2482
+ /**
2483
+ * Log update download start
2484
+ */
2485
+ updateDownloadStart(context: Record<string, unknown>): void {
2486
+ // Always log to file first (for Ctrl+O LogBrowser)
2487
+ const jsonLogger = getJsonStreamLogger();
2488
+ if (jsonLogger?.isActive()) {
2489
+ jsonLogger.logInfo('Update Download Start', context);
2490
+ }
2491
+
2492
+ // Console output controlled by log level
2493
+ if (this.level < LogLevel.INFO) return;
2494
+
2495
+ const location = this.getCallLocation();
2496
+ const timestamp = this.getTimestamp();
2497
+ const prefix = this.getPrefix();
2498
+ const loc = this.getLocation(location);
2499
+
2500
+ console.log(timestamp, prefix, loc, chalk.cyan('⬇️ UPDATE DOWNLOAD START'));
2501
+ if (Object.keys(context).length > 0) {
2502
+ console.log(chalk.cyan(' Context:'), JSON.stringify(context, null, 2));
2503
+ }
2504
+ }
2505
+
2506
+ /**
2507
+ * Log update download progress
2508
+ */
2509
+ updateDownloadProgress(context: Record<string, unknown>): void {
2510
+ // Always log to file first (for Ctrl+O LogBrowser)
2511
+ const jsonLogger = getJsonStreamLogger();
2512
+ if (jsonLogger?.isActive()) {
2513
+ jsonLogger.logDebug('Update Download Progress', context);
2514
+ }
2515
+
2516
+ // Console output controlled by log level
2517
+ if (this.level < LogLevel.DEBUG) return;
2518
+
2519
+ const location = this.getCallLocation();
2520
+ const timestamp = this.getTimestamp();
2521
+ const prefix = this.getPrefix();
2522
+ const loc = this.getLocation(location);
2523
+
2524
+ console.log(timestamp, prefix, loc, chalk.cyan('⬇️ DOWNLOAD PROGRESS:'), `${context['percent']}%`);
2525
+ }
2526
+
2527
+ /**
2528
+ * Log update download complete
2529
+ */
2530
+ updateDownloadComplete(context: Record<string, unknown>): void {
2531
+ // Always log to file first (for Ctrl+O LogBrowser)
2532
+ const jsonLogger = getJsonStreamLogger();
2533
+ if (jsonLogger?.isActive()) {
2534
+ jsonLogger.logInfo('Update Download Complete', context);
2535
+ }
2536
+
2537
+ // Console output controlled by log level
2538
+ if (this.level < LogLevel.INFO) return;
2539
+
2540
+ const location = this.getCallLocation();
2541
+ const timestamp = this.getTimestamp();
2542
+ const prefix = this.getPrefix();
2543
+ const loc = this.getLocation(location);
2544
+
2545
+ console.log(timestamp, prefix, loc, chalk.green('✅ UPDATE DOWNLOAD COMPLETE'));
2546
+ if (Object.keys(context).length > 0) {
2547
+ console.log(chalk.green(' Version:'), context['version']);
2548
+ }
2549
+ }
2550
+
2551
+ /**
2552
+ * Log update installing
2553
+ */
2554
+ updateInstalling(): void {
2555
+ // Always log to file first (for Ctrl+O LogBrowser)
2556
+ const jsonLogger = getJsonStreamLogger();
2557
+ if (jsonLogger?.isActive()) {
2558
+ jsonLogger.logInfo('Update Installing', {});
2559
+ }
2560
+
2561
+ // Console output controlled by log level
2562
+ if (this.level < LogLevel.INFO) return;
2563
+
2564
+ const location = this.getCallLocation();
2565
+ const timestamp = this.getTimestamp();
2566
+ const prefix = this.getPrefix();
2567
+ const loc = this.getLocation(location);
2568
+
2569
+ console.log(timestamp, prefix, loc, chalk.yellow('🔧 UPDATE INSTALLING'));
2570
+ }
2571
+
2572
+ /**
2573
+ * Log update installed
2574
+ */
2575
+ updateInstalled(context: Record<string, unknown>): void {
2576
+ // Always log to file first (for Ctrl+O LogBrowser)
2577
+ const jsonLogger = getJsonStreamLogger();
2578
+ if (jsonLogger?.isActive()) {
2579
+ jsonLogger.logInfo('Update Installed', context);
2580
+ }
2581
+
2582
+ // Console output controlled by log level
2583
+ if (this.level < LogLevel.INFO) return;
2584
+
2585
+ const location = this.getCallLocation();
2586
+ const timestamp = this.getTimestamp();
2587
+ const prefix = this.getPrefix();
2588
+ const loc = this.getLocation(location);
2589
+
2590
+ console.log(timestamp, prefix, loc, chalk.green('🎉 UPDATE INSTALLED'));
2591
+ if (Object.keys(context).length > 0) {
2592
+ console.log(chalk.green(' Version:'), context['version']);
2593
+ }
2594
+ }
2595
+
2596
+ /**
2597
+ * Log update error
2598
+ */
2599
+ updateError(context: Record<string, unknown>): void {
2600
+ // Always log to file first (for Ctrl+O LogBrowser)
2601
+ const jsonLogger = getJsonStreamLogger();
2602
+ if (jsonLogger?.isActive()) {
2603
+ jsonLogger.logError(new Error(String(context['error'] || 'Unknown error')), 'updateError');
2604
+ }
2605
+
2606
+ // Console output controlled by log level
2607
+ if (this.level < LogLevel.ERROR) return;
2608
+
2609
+ const location = this.getCallLocation();
2610
+ const timestamp = this.getTimestamp();
2611
+ const prefix = this.getPrefix();
2612
+ const loc = this.getLocation(location);
2613
+
2614
+ console.log(timestamp, prefix, loc, chalk.red('❌ UPDATE ERROR'));
2615
+ if (Object.keys(context).length > 0) {
2616
+ console.log(chalk.red(' Error:'), context['error']);
2617
+ }
2618
+ }
2619
+ }
2620
+
2621
+ /**
2622
+ * Global logger instance
2623
+ *
2624
+ * Default is ERROR level (No log output in Normal mode)
2625
+ * Adjust level with CLI argument:
2626
+ * - Normal mode (open): ERROR (No log output, feedback via UI only)
2627
+ * - Verbose mode (open --verbose): WARN
2628
+ * - Debug mode (open --debug): VERBOSE
2629
+ */
2630
+ export const logger = new Logger({
2631
+ level: LogLevel.ERROR, // Normal mode: No log output (show ERROR only)
2632
+ prefix: 'LOCAL-CLI',
2633
+ timestamp: true,
2634
+ showLocation: false, // Dynamically changed in setLogLevel()
2635
+ showPid: false, // Enable via environment variable if needed
2636
+ });
2637
+
2638
+ /**
2639
+ * Set global log level from CLI or config
2640
+ * Automatically show location info when DEBUG or higher
2641
+ */
2642
+ export function setLogLevel(level: LogLevel): void {
2643
+ logger.setLevel(level);
2644
+
2645
+ // Automatically show location info for DEBUG or higher
2646
+ if (level >= LogLevel.DEBUG) {
2647
+ logger['showLocation'] = true;
2648
+ }
2649
+ }
2650
+
2651
+ /**
2652
+ * Enable verbose logging
2653
+ */
2654
+ export function enableVerbose(): void {
2655
+ logger.setLevel(LogLevel.VERBOSE);
2656
+ }
2657
+
2658
+ /**
2659
+ * Disable verbose logging
2660
+ */
2661
+ export function disableVerbose(): void {
2662
+ logger.setLevel(LogLevel.INFO);
2663
+ }
2664
+
2665
+ /**
2666
+ * Enable debug logging
2667
+ */
2668
+ export function enableDebug(): void {
2669
+ logger.setLevel(LogLevel.DEBUG);
2670
+ }
2671
+
2672
+ /**
2673
+ * Create a child logger with a specific prefix
2674
+ */
2675
+ export function createLogger(prefix: string, options?: Partial<LoggerOptions>): Logger {
2676
+ return new Logger({
2677
+ level: logger['level'],
2678
+ prefix,
2679
+ timestamp: true,
2680
+ showLocation: logger['showLocation'],
2681
+ showPid: logger['showPid'],
2682
+ ...options,
2683
+ });
2684
+ }
2685
+
2686
+ /**
2687
+ * Generate a unique trace ID
2688
+ */
2689
+ export function generateTraceId(): string {
2690
+ return `${Date.now()}-${Math.random().toString(36).slice(2, 11)}`;
2691
+ }
2692
+
2693
+ /**
2694
+ * Setup logging configuration based on CLI options
2695
+ * - Configures log level (verbose/debug)
2696
+ * - Initializes JSON stream logger
2697
+ * - Sets up process exit handlers for cleanup
2698
+ *
2699
+ * @param options - CLI options containing verbose and debug flags
2700
+ * @returns Object containing cleanup function and JSON logger instance
2701
+ */
2702
+ export async function setupLogging(options: {
2703
+ verbose?: boolean;
2704
+ debug?: boolean;
2705
+ llmLog?: boolean;
2706
+ sessionId?: string;
2707
+ }): Promise<{
2708
+ cleanup: () => Promise<void>;
2709
+ jsonLogger: Awaited<ReturnType<typeof import('./json-stream-logger.js').initializeJsonStreamLogger>>;
2710
+ }> {
2711
+ const { initializeJsonStreamLogger, closeJsonStreamLogger } = await import('./json-stream-logger.js');
2712
+ const { sessionManager } = await import('../core/session/session-manager.js');
2713
+
2714
+ // Determine if verbose/debug mode is enabled
2715
+ const isVerboseMode = options.verbose || options.debug;
2716
+
2717
+ // Initialize JSON stream logger (always enabled, but only show messages in verbose/debug mode)
2718
+ const sessionId = options.sessionId || (sessionManager.getCurrentSessionId() as string);
2719
+ const jsonLogger = await initializeJsonStreamLogger(sessionId, false, isVerboseMode);
2720
+
2721
+ // Enable LLM logging if --llm-log flag is set
2722
+ if (options.llmLog) {
2723
+ enableLLMLog();
2724
+ }
2725
+
2726
+ // Set log level based on CLI options
2727
+ // Normal mode (no flags): ERROR
2728
+ // --verbose: DEBUG (detailed logging)
2729
+ // --debug: VERBOSE (maximum debug logging + location info)
2730
+ // --llm-log: ERROR (show LLM requests/responses only)
2731
+ if (options.debug) {
2732
+ setLogLevel(LogLevel.VERBOSE);
2733
+ logger.debug('🔍 Debug mode enabled - maximum logging with location tracking');
2734
+ } else if (options.verbose) {
2735
+ setLogLevel(LogLevel.DEBUG);
2736
+ logger.debug('📝 Verbose mode enabled - detailed logging');
2737
+ } else if (options.llmLog) {
2738
+ // llm-log mode: keep ERROR level, just enable LLM logging
2739
+ console.log(chalk.cyan('📡 LLM Log mode enabled - showing LLM requests/responses only'));
2740
+ }
2741
+ // Normal mode: no startup message
2742
+
2743
+ // Track cleanup state to prevent duplicate calls
2744
+ let cleanupCalled = false;
2745
+
2746
+ // Cleanup function to close logger (idempotent - safe to call multiple times)
2747
+ const cleanup = async () => {
2748
+ if (cleanupCalled) {
2749
+ return; // Already cleaned up, skip
2750
+ }
2751
+ cleanupCalled = true;
2752
+ await closeJsonStreamLogger();
2753
+ };
2754
+
2755
+ // Ensure cleanup on exit (prevent duplicate handlers with once flag)
2756
+ // Note: SIGINT is handled by ink/PlanExecuteApp for smart Ctrl+C behavior
2757
+ // Only SIGTERM triggers automatic exit (for system shutdown signals)
2758
+ const exitHandler = async (signal: string) => {
2759
+ logger.debug(`Received ${signal}, cleaning up...`);
2760
+ await cleanup();
2761
+ process.exit(0);
2762
+ };
2763
+
2764
+ process.once('SIGTERM', () => exitHandler('SIGTERM'));
2765
+
2766
+ return { cleanup, jsonLogger };
2767
+ }