byterover-cli 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (345) hide show
  1. package/README.md +119 -63
  2. package/bin/dev.js +8 -1
  3. package/bin/run.js +7 -0
  4. package/dist/commands/cipher-agent/run.d.ts +30 -0
  5. package/dist/commands/cipher-agent/run.js +123 -61
  6. package/dist/commands/cipher-agent/set-prompt.d.ts +2 -0
  7. package/dist/commands/cipher-agent/set-prompt.js +13 -8
  8. package/dist/commands/cipher-agent/show-prompt.d.ts +2 -0
  9. package/dist/commands/cipher-agent/show-prompt.js +17 -12
  10. package/dist/commands/curate.d.ts +3 -60
  11. package/dist/commands/curate.js +45 -341
  12. package/dist/commands/foo.d.ts +4 -2
  13. package/dist/commands/foo.js +21 -16
  14. package/dist/commands/main.d.ts +9 -0
  15. package/dist/commands/main.js +34 -0
  16. package/dist/commands/query.d.ts +2 -48
  17. package/dist/commands/query.js +19 -287
  18. package/dist/commands/status.d.ts +2 -13
  19. package/dist/commands/status.js +12 -91
  20. package/dist/commands/watch.d.ts +2 -0
  21. package/dist/commands/watch.js +23 -19
  22. package/dist/config/environment.d.ts +1 -1
  23. package/dist/config/environment.js +2 -2
  24. package/dist/constants.d.ts +4 -5
  25. package/dist/constants.js +5 -5
  26. package/dist/core/domain/cipher/errors/storage-error.d.ts +89 -0
  27. package/dist/core/domain/cipher/errors/storage-error.js +130 -0
  28. package/dist/core/domain/cipher/queue/types.d.ts +71 -0
  29. package/dist/core/domain/cipher/queue/types.js +9 -0
  30. package/dist/core/domain/cipher/storage/message-storage-types.d.ts +218 -0
  31. package/dist/core/domain/cipher/storage/message-storage-types.js +18 -0
  32. package/dist/core/domain/cipher/tools/constants.d.ts +1 -0
  33. package/dist/core/domain/cipher/tools/constants.js +1 -0
  34. package/dist/core/domain/entities/event.d.ts +1 -1
  35. package/dist/core/domain/entities/event.js +5 -0
  36. package/dist/core/domain/entities/global-config.d.ts +36 -0
  37. package/dist/core/domain/entities/global-config.js +66 -0
  38. package/dist/core/domain/knowledge/directory-manager.d.ts +10 -0
  39. package/dist/core/domain/knowledge/directory-manager.js +18 -0
  40. package/dist/core/domain/knowledge/markdown-writer.d.ts +9 -0
  41. package/dist/core/domain/knowledge/markdown-writer.js +51 -1
  42. package/dist/core/interfaces/cipher/i-agent-storage.d.ts +152 -0
  43. package/dist/core/interfaces/cipher/i-agent-storage.js +1 -0
  44. package/dist/core/interfaces/cipher/i-cipher-agent.d.ts +2 -0
  45. package/dist/core/interfaces/cipher/i-key-storage.d.ts +91 -0
  46. package/dist/core/interfaces/cipher/i-key-storage.js +1 -0
  47. package/dist/core/interfaces/i-global-config-store.d.ts +34 -0
  48. package/dist/core/interfaces/i-global-config-store.js +1 -0
  49. package/dist/core/interfaces/i-onboarding-preference-store.d.ts +20 -0
  50. package/dist/core/interfaces/i-onboarding-preference-store.js +1 -0
  51. package/dist/core/interfaces/i-terminal.d.ts +146 -0
  52. package/dist/core/interfaces/i-terminal.js +1 -0
  53. package/dist/core/interfaces/i-workspace-detector-service.d.ts +8 -0
  54. package/dist/core/interfaces/i-workspace-detector-service.js +1 -0
  55. package/dist/core/interfaces/usecase/i-clear-use-case.d.ts +6 -0
  56. package/dist/core/interfaces/usecase/i-clear-use-case.js +1 -0
  57. package/dist/core/interfaces/usecase/i-curate-use-case.d.ts +10 -0
  58. package/dist/core/interfaces/usecase/i-curate-use-case.js +1 -0
  59. package/dist/core/interfaces/usecase/i-generate-rules-use-case.d.ts +3 -0
  60. package/dist/core/interfaces/usecase/i-generate-rules-use-case.js +1 -0
  61. package/dist/core/interfaces/usecase/i-init-use-case.d.ts +5 -0
  62. package/dist/core/interfaces/usecase/i-init-use-case.js +1 -0
  63. package/dist/core/interfaces/usecase/i-login-use-case.d.ts +3 -0
  64. package/dist/core/interfaces/usecase/i-login-use-case.js +1 -0
  65. package/dist/core/interfaces/usecase/i-logout-use-case.d.ts +5 -0
  66. package/dist/core/interfaces/usecase/i-logout-use-case.js +1 -0
  67. package/dist/core/interfaces/usecase/i-pull-use-case.d.ts +5 -0
  68. package/dist/core/interfaces/usecase/i-pull-use-case.js +1 -0
  69. package/dist/core/interfaces/usecase/i-push-use-case.d.ts +6 -0
  70. package/dist/core/interfaces/usecase/i-push-use-case.js +1 -0
  71. package/dist/core/interfaces/usecase/i-query-use-case.d.ts +9 -0
  72. package/dist/core/interfaces/usecase/i-query-use-case.js +1 -0
  73. package/dist/core/interfaces/usecase/i-space-list-use-case.d.ts +3 -0
  74. package/dist/core/interfaces/usecase/i-space-list-use-case.js +1 -0
  75. package/dist/core/interfaces/usecase/i-space-switch-use-case.d.ts +3 -0
  76. package/dist/core/interfaces/usecase/i-space-switch-use-case.js +1 -0
  77. package/dist/core/interfaces/usecase/i-status-use-case.d.ts +5 -0
  78. package/dist/core/interfaces/usecase/i-status-use-case.js +1 -0
  79. package/dist/hooks/init/welcome.js +1 -2
  80. package/dist/infra/cipher/agent-service-factory.d.ts +13 -6
  81. package/dist/infra/cipher/agent-service-factory.js +40 -16
  82. package/dist/infra/cipher/cipher-agent.js +4 -4
  83. package/dist/infra/cipher/consumer/consumer-lock.d.ts +20 -0
  84. package/dist/infra/cipher/consumer/consumer-lock.js +40 -0
  85. package/dist/infra/cipher/consumer/consumer-service.d.ts +99 -0
  86. package/dist/infra/cipher/consumer/consumer-service.js +165 -0
  87. package/dist/infra/cipher/consumer/execution-consumer.d.ts +121 -0
  88. package/dist/infra/cipher/consumer/execution-consumer.js +523 -0
  89. package/dist/infra/cipher/consumer/index.d.ts +33 -0
  90. package/dist/infra/cipher/consumer/index.js +33 -0
  91. package/dist/infra/cipher/consumer/queue-polling-service.d.ts +120 -0
  92. package/dist/infra/cipher/consumer/queue-polling-service.js +248 -0
  93. package/dist/infra/cipher/http/internal-llm-http-service.d.ts +94 -0
  94. package/dist/infra/cipher/http/internal-llm-http-service.js +118 -0
  95. package/dist/infra/cipher/llm/context/compaction/compaction-service.d.ts +106 -0
  96. package/dist/infra/cipher/llm/context/compaction/compaction-service.js +132 -0
  97. package/dist/infra/cipher/llm/context/compaction/index.d.ts +9 -0
  98. package/dist/infra/cipher/llm/context/compaction/index.js +9 -0
  99. package/dist/infra/cipher/llm/context/context-manager.d.ts +46 -2
  100. package/dist/infra/cipher/llm/context/context-manager.js +68 -4
  101. package/dist/infra/cipher/llm/context/rw-lock.d.ts +72 -0
  102. package/dist/infra/cipher/llm/context/rw-lock.js +145 -0
  103. package/dist/infra/cipher/llm/generators/byterover-content-generator.d.ts +7 -7
  104. package/dist/infra/cipher/llm/generators/byterover-content-generator.js +8 -8
  105. package/dist/infra/cipher/llm/internal-llm-service.js +2 -0
  106. package/dist/infra/cipher/session/session-manager.d.ts +4 -4
  107. package/dist/infra/cipher/session/session-manager.js +5 -5
  108. package/dist/infra/cipher/storage/agent-storage.d.ts +246 -0
  109. package/dist/infra/cipher/storage/agent-storage.js +956 -0
  110. package/dist/infra/cipher/storage/dual-format-history-storage.d.ts +77 -0
  111. package/dist/infra/cipher/storage/dual-format-history-storage.js +149 -0
  112. package/dist/infra/cipher/storage/granular-history-storage.d.ts +65 -0
  113. package/dist/infra/cipher/storage/granular-history-storage.js +118 -0
  114. package/dist/infra/cipher/storage/message-storage-service.d.ts +108 -0
  115. package/dist/infra/cipher/storage/message-storage-service.js +529 -0
  116. package/dist/infra/cipher/storage/process-utils.d.ts +16 -0
  117. package/dist/infra/cipher/storage/process-utils.js +43 -0
  118. package/dist/infra/cipher/storage/sqlite-key-storage.d.ts +105 -0
  119. package/dist/infra/cipher/storage/sqlite-key-storage.js +404 -0
  120. package/dist/infra/cipher/system-prompt/simple-prompt-factory.d.ts +1 -0
  121. package/dist/infra/cipher/system-prompt/simple-prompt-factory.js +7 -0
  122. package/dist/infra/cipher/tools/default-policy-rules.js +1 -1
  123. package/dist/infra/cipher/tools/implementations/curate-tool.d.ts +10 -0
  124. package/dist/infra/cipher/tools/implementations/curate-tool.js +371 -0
  125. package/dist/infra/cipher/tools/implementations/find-knowledge-topics-tool.js +11 -8
  126. package/dist/infra/cipher/tools/tool-manager.d.ts +8 -2
  127. package/dist/infra/cipher/tools/tool-manager.js +29 -2
  128. package/dist/infra/cipher/tools/tool-registry.js +7 -0
  129. package/dist/infra/http/authenticated-http-client.d.ts +21 -0
  130. package/dist/infra/http/authenticated-http-client.js +38 -0
  131. package/dist/infra/repl/commands/arg-parser.d.ts +97 -0
  132. package/dist/infra/repl/commands/arg-parser.js +129 -0
  133. package/dist/infra/repl/commands/clear-command.d.ts +5 -0
  134. package/dist/infra/repl/commands/clear-command.js +61 -0
  135. package/dist/infra/repl/commands/curate-command.d.ts +9 -0
  136. package/dist/infra/repl/commands/curate-command.js +88 -0
  137. package/dist/infra/repl/commands/gen-rules-command.d.ts +7 -0
  138. package/dist/infra/repl/commands/gen-rules-command.js +38 -0
  139. package/dist/infra/repl/commands/index.d.ts +8 -0
  140. package/dist/infra/repl/commands/index.js +36 -0
  141. package/dist/infra/repl/commands/init-command.d.ts +7 -0
  142. package/dist/infra/repl/commands/init-command.js +83 -0
  143. package/dist/infra/repl/commands/login-command.d.ts +7 -0
  144. package/dist/infra/repl/commands/login-command.js +50 -0
  145. package/dist/infra/repl/commands/logout-command.d.ts +5 -0
  146. package/dist/infra/repl/commands/logout-command.js +48 -0
  147. package/dist/infra/repl/commands/pull-command.d.ts +5 -0
  148. package/dist/infra/repl/commands/pull-command.js +61 -0
  149. package/dist/infra/repl/commands/push-command.d.ts +5 -0
  150. package/dist/infra/repl/commands/push-command.js +66 -0
  151. package/dist/infra/repl/commands/query-command.d.ts +5 -0
  152. package/dist/infra/repl/commands/query-command.js +66 -0
  153. package/dist/infra/repl/commands/space/index.d.ts +5 -0
  154. package/dist/infra/repl/commands/space/index.js +14 -0
  155. package/dist/infra/repl/commands/space/list-command.d.ts +5 -0
  156. package/dist/infra/repl/commands/space/list-command.js +70 -0
  157. package/dist/infra/repl/commands/space/switch-command.d.ts +5 -0
  158. package/dist/infra/repl/commands/space/switch-command.js +37 -0
  159. package/dist/infra/repl/commands/status-command.d.ts +5 -0
  160. package/dist/infra/repl/commands/status-command.js +39 -0
  161. package/dist/infra/repl/repl-startup.d.ts +18 -0
  162. package/dist/infra/repl/repl-startup.js +26 -0
  163. package/dist/infra/storage/file-global-config-store.d.ts +22 -0
  164. package/dist/infra/storage/file-global-config-store.js +65 -0
  165. package/dist/infra/storage/file-onboarding-preference-store.d.ts +10 -0
  166. package/dist/infra/storage/file-onboarding-preference-store.js +46 -0
  167. package/dist/infra/terminal/oclif-terminal.d.ts +19 -0
  168. package/dist/infra/terminal/oclif-terminal.js +60 -0
  169. package/dist/infra/terminal/repl-terminal.d.ts +31 -0
  170. package/dist/infra/terminal/repl-terminal.js +116 -0
  171. package/dist/infra/tracking/mixpanel-tracking-service.d.ts +11 -1
  172. package/dist/infra/tracking/mixpanel-tracking-service.js +18 -13
  173. package/dist/infra/usecase/clear-use-case.d.ts +20 -0
  174. package/dist/infra/usecase/clear-use-case.js +58 -0
  175. package/dist/infra/usecase/curate-use-case.d.ts +66 -0
  176. package/dist/infra/usecase/curate-use-case.js +283 -0
  177. package/dist/{commands/gen-rules.d.ts → infra/usecase/generate-rules-use-case.d.ts} +14 -20
  178. package/dist/{commands/gen-rules.js → infra/usecase/generate-rules-use-case.js} +59 -78
  179. package/dist/infra/usecase/init-use-case.d.ts +139 -0
  180. package/dist/{commands/init.js → infra/usecase/init-use-case.js} +184 -230
  181. package/dist/infra/usecase/login-use-case.d.ts +28 -0
  182. package/dist/infra/usecase/login-use-case.js +88 -0
  183. package/dist/infra/usecase/logout-use-case.d.ts +22 -0
  184. package/dist/infra/usecase/logout-use-case.js +51 -0
  185. package/dist/infra/usecase/pull-use-case.d.ts +35 -0
  186. package/dist/infra/usecase/pull-use-case.js +89 -0
  187. package/dist/infra/usecase/push-use-case.d.ts +37 -0
  188. package/dist/infra/usecase/push-use-case.js +124 -0
  189. package/dist/infra/usecase/query-use-case.d.ts +78 -0
  190. package/dist/infra/usecase/query-use-case.js +401 -0
  191. package/dist/infra/usecase/space-list-use-case.d.ts +27 -0
  192. package/dist/infra/usecase/space-list-use-case.js +64 -0
  193. package/dist/infra/usecase/space-switch-use-case.d.ts +36 -0
  194. package/dist/infra/usecase/space-switch-use-case.js +140 -0
  195. package/dist/infra/usecase/status-use-case.d.ts +27 -0
  196. package/dist/infra/usecase/status-use-case.js +97 -0
  197. package/dist/infra/workspace/workspace-detector-service.d.ts +3 -6
  198. package/dist/resources/prompts/curate-context-tree-curation.yml +23 -11
  199. package/dist/resources/prompts/query-context-tree-retrieval.yml +3 -4
  200. package/dist/resources/prompts/system-prompt.yml +1 -1
  201. package/dist/resources/prompts/tool-outputs.yml +4 -3
  202. package/dist/templates/sections/command-reference.md +12 -0
  203. package/dist/templates/sections/workflow.md +10 -1
  204. package/dist/tui/app.d.ts +9 -0
  205. package/dist/tui/app.js +26 -0
  206. package/dist/tui/components/enter-prompt.d.ts +13 -0
  207. package/dist/tui/components/enter-prompt.js +15 -0
  208. package/dist/tui/components/execution/execution-changes.d.ts +14 -0
  209. package/dist/tui/components/execution/execution-changes.js +15 -0
  210. package/dist/tui/components/execution/execution-content.d.ts +25 -0
  211. package/dist/tui/components/execution/execution-content.js +67 -0
  212. package/dist/tui/components/execution/execution-input.d.ts +12 -0
  213. package/dist/tui/components/execution/execution-input.js +16 -0
  214. package/dist/tui/components/execution/execution-progress.d.ts +21 -0
  215. package/dist/tui/components/execution/execution-progress.js +21 -0
  216. package/dist/tui/components/execution/execution-status.d.ts +13 -0
  217. package/dist/tui/components/execution/execution-status.js +19 -0
  218. package/dist/tui/components/execution/index.d.ts +11 -0
  219. package/dist/tui/components/execution/index.js +11 -0
  220. package/dist/tui/components/execution/log-item.d.ts +17 -0
  221. package/dist/tui/components/execution/log-item.js +25 -0
  222. package/dist/tui/components/footer.d.ts +5 -0
  223. package/dist/tui/components/footer.js +12 -0
  224. package/dist/tui/components/header.d.ts +18 -0
  225. package/dist/tui/components/header.js +18 -0
  226. package/dist/tui/components/index.d.ts +17 -0
  227. package/dist/tui/components/index.js +14 -0
  228. package/dist/tui/components/inline-prompts/index.d.ts +15 -0
  229. package/dist/tui/components/inline-prompts/index.js +10 -0
  230. package/dist/tui/components/inline-prompts/inline-confirm.d.ts +17 -0
  231. package/dist/tui/components/inline-prompts/inline-confirm.js +32 -0
  232. package/dist/tui/components/inline-prompts/inline-file-selector.d.ts +43 -0
  233. package/dist/tui/components/inline-prompts/inline-file-selector.js +185 -0
  234. package/dist/tui/components/inline-prompts/inline-input.d.ts +19 -0
  235. package/dist/tui/components/inline-prompts/inline-input.js +32 -0
  236. package/dist/tui/components/inline-prompts/inline-search.d.ts +20 -0
  237. package/dist/tui/components/inline-prompts/inline-search.js +50 -0
  238. package/dist/tui/components/inline-prompts/inline-select.d.ts +20 -0
  239. package/dist/tui/components/inline-prompts/inline-select.js +34 -0
  240. package/dist/tui/components/logo.d.ts +43 -0
  241. package/dist/tui/components/logo.js +103 -0
  242. package/dist/tui/components/message-item.d.ts +12 -0
  243. package/dist/tui/components/message-item.js +12 -0
  244. package/dist/tui/components/onboarding/copyable-prompt.d.ts +15 -0
  245. package/dist/tui/components/onboarding/copyable-prompt.js +65 -0
  246. package/dist/tui/components/onboarding/index.d.ts +7 -0
  247. package/dist/tui/components/onboarding/index.js +6 -0
  248. package/dist/tui/components/onboarding/onboarding-flow.d.ts +13 -0
  249. package/dist/tui/components/onboarding/onboarding-flow.js +304 -0
  250. package/dist/tui/components/onboarding/onboarding-step.d.ts +23 -0
  251. package/dist/tui/components/onboarding/onboarding-step.js +12 -0
  252. package/dist/tui/components/output-log.d.ts +14 -0
  253. package/dist/tui/components/output-log.js +13 -0
  254. package/dist/tui/components/scrollable-list.d.ts +30 -0
  255. package/dist/tui/components/scrollable-list.js +121 -0
  256. package/dist/tui/components/suggestions.d.ts +16 -0
  257. package/dist/tui/components/suggestions.js +162 -0
  258. package/dist/tui/components/tab-bar.d.ts +10 -0
  259. package/dist/tui/components/tab-bar.js +12 -0
  260. package/dist/tui/constants.d.ts +11 -0
  261. package/dist/tui/constants.js +13 -0
  262. package/dist/tui/contexts/auth-context.d.ts +30 -0
  263. package/dist/tui/contexts/auth-context.js +153 -0
  264. package/dist/tui/contexts/consumer.d.ts +31 -0
  265. package/dist/tui/contexts/consumer.js +56 -0
  266. package/dist/tui/contexts/index.d.ts +6 -0
  267. package/dist/tui/contexts/index.js +6 -0
  268. package/dist/tui/contexts/onboarding-context.d.ts +43 -0
  269. package/dist/tui/contexts/onboarding-context.js +181 -0
  270. package/dist/tui/contexts/services-context.d.ts +29 -0
  271. package/dist/tui/contexts/services-context.js +20 -0
  272. package/dist/tui/contexts/use-commands.d.ts +29 -0
  273. package/dist/tui/contexts/use-commands.js +53 -0
  274. package/dist/tui/contexts/use-mode.d.ts +43 -0
  275. package/dist/tui/contexts/use-mode.js +76 -0
  276. package/dist/tui/contexts/use-theme.d.ts +53 -0
  277. package/dist/tui/contexts/use-theme.js +60 -0
  278. package/dist/tui/hooks/index.d.ts +17 -0
  279. package/dist/tui/hooks/index.js +14 -0
  280. package/dist/tui/hooks/use-activity-logs.d.ts +26 -0
  281. package/dist/tui/hooks/use-activity-logs.js +90 -0
  282. package/dist/tui/hooks/use-consumer.d.ts +12 -0
  283. package/dist/tui/hooks/use-consumer.js +50 -0
  284. package/dist/tui/hooks/use-onboarding.d.ts +7 -0
  285. package/dist/tui/hooks/use-onboarding.js +6 -0
  286. package/dist/tui/hooks/use-queue-polling.d.ts +31 -0
  287. package/dist/tui/hooks/use-queue-polling.js +90 -0
  288. package/dist/tui/hooks/use-slash-command-processor.d.ts +16 -0
  289. package/dist/tui/hooks/use-slash-command-processor.js +132 -0
  290. package/dist/tui/hooks/use-slash-completion.d.ts +30 -0
  291. package/dist/tui/hooks/use-slash-completion.js +230 -0
  292. package/dist/tui/hooks/use-tab-navigation.d.ts +10 -0
  293. package/dist/tui/hooks/use-tab-navigation.js +35 -0
  294. package/dist/tui/hooks/use-visible-window.d.ts +22 -0
  295. package/dist/tui/hooks/use-visible-window.js +37 -0
  296. package/dist/tui/index.d.ts +1 -0
  297. package/dist/tui/index.js +1 -0
  298. package/dist/tui/providers/app-providers.d.ts +25 -0
  299. package/dist/tui/providers/app-providers.js +9 -0
  300. package/dist/tui/types/commands.d.ts +252 -0
  301. package/dist/tui/types/commands.js +16 -0
  302. package/dist/tui/types/dialogs.d.ts +37 -0
  303. package/dist/tui/types/dialogs.js +4 -0
  304. package/dist/tui/types/index.d.ts +11 -0
  305. package/dist/tui/types/index.js +7 -0
  306. package/dist/tui/types/messages.d.ts +55 -0
  307. package/dist/tui/types/messages.js +4 -0
  308. package/dist/tui/types/prompts.d.ts +100 -0
  309. package/dist/tui/types/prompts.js +4 -0
  310. package/dist/tui/types/ui.d.ts +14 -0
  311. package/dist/tui/types/ui.js +4 -0
  312. package/dist/tui/types.d.ts +1 -0
  313. package/dist/tui/types.js +1 -0
  314. package/dist/tui/views/command-view.d.ts +12 -0
  315. package/dist/tui/views/command-view.js +451 -0
  316. package/dist/tui/views/index.d.ts +6 -0
  317. package/dist/tui/views/index.js +6 -0
  318. package/dist/tui/views/login-view.d.ts +10 -0
  319. package/dist/tui/views/login-view.js +30 -0
  320. package/dist/tui/views/logs-view.d.ts +11 -0
  321. package/dist/tui/views/logs-view.js +73 -0
  322. package/dist/utils/file-validator.d.ts +16 -0
  323. package/dist/utils/file-validator.js +81 -0
  324. package/dist/utils/global-config-path.d.ts +15 -0
  325. package/dist/utils/global-config-path.js +38 -0
  326. package/oclif.manifest.json +29 -315
  327. package/package.json +11 -4
  328. package/dist/commands/clear.d.ts +0 -19
  329. package/dist/commands/clear.js +0 -78
  330. package/dist/commands/init.d.ts +0 -130
  331. package/dist/commands/login.d.ts +0 -22
  332. package/dist/commands/login.js +0 -108
  333. package/dist/commands/logout.d.ts +0 -16
  334. package/dist/commands/logout.js +0 -61
  335. package/dist/commands/pull.d.ts +0 -33
  336. package/dist/commands/pull.js +0 -115
  337. package/dist/commands/push.d.ts +0 -35
  338. package/dist/commands/push.js +0 -160
  339. package/dist/commands/space/list.d.ts +0 -25
  340. package/dist/commands/space/list.js +0 -114
  341. package/dist/commands/space/switch.d.ts +0 -36
  342. package/dist/commands/space/switch.js +0 -160
  343. package/dist/infra/cipher/grpc/internal-llm-grpc-service.d.ts +0 -149
  344. package/dist/infra/cipher/grpc/internal-llm-grpc-service.js +0 -364
  345. package/dist/infra/cipher/grpc/internal-llm-grpc.proto +0 -94
@@ -0,0 +1,27 @@
1
+ import type { IContextTreeService } from '../../core/interfaces/i-context-tree-service.js';
2
+ import type { IContextTreeSnapshotService } from '../../core/interfaces/i-context-tree-snapshot-service.js';
3
+ import type { IProjectConfigStore } from '../../core/interfaces/i-project-config-store.js';
4
+ import type { ITerminal } from '../../core/interfaces/i-terminal.js';
5
+ import type { ITokenStore } from '../../core/interfaces/i-token-store.js';
6
+ import type { ITrackingService } from '../../core/interfaces/i-tracking-service.js';
7
+ import type { IStatusUseCase } from '../../core/interfaces/usecase/i-status-use-case.js';
8
+ export interface StatusUseCaseOptions {
9
+ contextTreeService: IContextTreeService;
10
+ contextTreeSnapshotService: IContextTreeSnapshotService;
11
+ projectConfigStore: IProjectConfigStore;
12
+ terminal: ITerminal;
13
+ tokenStore: ITokenStore;
14
+ trackingService: ITrackingService;
15
+ }
16
+ export declare class StatusUseCase implements IStatusUseCase {
17
+ private readonly contextTreeService;
18
+ private readonly contextTreeSnapshotService;
19
+ private readonly projectConfigStore;
20
+ private readonly terminal;
21
+ private readonly tokenStore;
22
+ private readonly trackingService;
23
+ constructor(options: StatusUseCaseOptions);
24
+ run(options: {
25
+ cliVersion: string;
26
+ }): Promise<void>;
27
+ }
@@ -0,0 +1,97 @@
1
+ import chalk from 'chalk';
2
+ import { join } from 'node:path';
3
+ import { BRV_DIR, CONTEXT_TREE_DIR } from '../../constants.js';
4
+ import { getErrorMessage } from '../../utils/error-helpers.js';
5
+ export class StatusUseCase {
6
+ contextTreeService;
7
+ contextTreeSnapshotService;
8
+ projectConfigStore;
9
+ terminal;
10
+ tokenStore;
11
+ trackingService;
12
+ constructor(options) {
13
+ this.contextTreeService = options.contextTreeService;
14
+ this.contextTreeSnapshotService = options.contextTreeSnapshotService;
15
+ this.projectConfigStore = options.projectConfigStore;
16
+ this.terminal = options.terminal;
17
+ this.tokenStore = options.tokenStore;
18
+ this.trackingService = options.trackingService;
19
+ }
20
+ async run(options) {
21
+ this.terminal.log(`CLI Version: ${options.cliVersion}`);
22
+ try {
23
+ const token = await this.tokenStore.load();
24
+ if (token !== undefined && token.isValid()) {
25
+ this.terminal.log(`Status: Logged in as ${token.userEmail}`);
26
+ }
27
+ else if (token === undefined) {
28
+ this.terminal.log('Status: Not logged in');
29
+ }
30
+ else {
31
+ this.terminal.log('Status: Session expired (login required)');
32
+ }
33
+ }
34
+ catch (error) {
35
+ this.terminal.log('Status: Unable to check authentication status');
36
+ this.terminal.warn(`Warning: ${getErrorMessage(error)}`);
37
+ }
38
+ const cwd = process.cwd();
39
+ this.terminal.log(`Current Directory: ${cwd}`);
40
+ try {
41
+ const isInitialized = await this.projectConfigStore.exists();
42
+ if (isInitialized) {
43
+ const config = await this.projectConfigStore.read();
44
+ if (config) {
45
+ this.terminal.log(`Project Status: Connected to ${config.teamName}/${config.spaceName}`);
46
+ }
47
+ else {
48
+ this.terminal.log('Project Status: Configuration file exists but is invalid');
49
+ }
50
+ }
51
+ else {
52
+ this.terminal.log('Project Status: Not initialized');
53
+ }
54
+ }
55
+ catch (error) {
56
+ this.terminal.log('Project Status: Unable to read project configuration');
57
+ this.terminal.warn(`Warning: ${getErrorMessage(error)}`);
58
+ }
59
+ // Context tree status
60
+ try {
61
+ const contextTreeExists = await this.contextTreeService.exists();
62
+ if (!contextTreeExists) {
63
+ this.terminal.log('Context Tree: Not initialized');
64
+ return;
65
+ }
66
+ const hasSnapshot = await this.contextTreeSnapshotService.hasSnapshot();
67
+ // Auto-create empty snapshot if none exists (all files will show as "added")
68
+ if (!hasSnapshot) {
69
+ await this.contextTreeSnapshotService.initEmptySnapshot();
70
+ }
71
+ const changes = await this.contextTreeSnapshotService.getChanges();
72
+ const hasChanges = changes.added.length > 0 || changes.modified.length > 0 || changes.deleted.length > 0;
73
+ if (!hasChanges) {
74
+ this.terminal.log('Context Tree: No changes');
75
+ return;
76
+ }
77
+ const contextTreeRelPath = join(BRV_DIR, CONTEXT_TREE_DIR);
78
+ const formatPath = (file) => join(contextTreeRelPath, file);
79
+ // Build unified list with status, sort by path ascending
80
+ const allChanges = [
81
+ ...changes.modified.map((f) => ({ color: chalk.red, path: f, status: 'modified:' })),
82
+ ...changes.added.map((f) => ({ color: chalk.red, path: f, status: 'new file:' })),
83
+ ...changes.deleted.map((f) => ({ color: chalk.red, path: f, status: 'deleted:' })),
84
+ ].sort((a, b) => a.path.localeCompare(b.path));
85
+ this.terminal.log('Context Tree Changes:');
86
+ for (const change of allChanges) {
87
+ this.terminal.log(`\t${change.color(`${change.status.padEnd(10)} ${formatPath(change.path)}`)}`);
88
+ }
89
+ // Track status
90
+ await this.trackingService.track('mem:status');
91
+ }
92
+ catch (error) {
93
+ this.terminal.log('Context Tree: Unable to check status');
94
+ this.terminal.warn(`Warning: ${error instanceof Error ? error.message : 'Context Tree unable to check status'}`);
95
+ }
96
+ }
97
+ }
@@ -1,13 +1,10 @@
1
- import { Agent } from '../../core/domain/entities/agent.js';
2
- export type WorkspaceInfo = {
3
- chatLogPath: string;
4
- cwd: string;
5
- };
1
+ import type { Agent } from '../../core/domain/entities/agent.js';
2
+ import type { IWorkspaceDetectorService, WorkspaceInfo } from '../../core/interfaces/i-workspace-detector-service.js';
6
3
  /**
7
4
  * Service to detect IDE workspaces that contain the current working directory
8
5
  * Supports: VS Code (Github Copilot), Cursor, Claude, and Codex
9
6
  */
10
- export declare class WorkspaceDetectorService {
7
+ export declare class WorkspaceDetectorService implements IWorkspaceDetectorService {
11
8
  private readonly claudeUserPath;
12
9
  private readonly codexUserPath;
13
10
  private readonly cursorUserPath;
@@ -2,6 +2,7 @@ description: "context tree curation instructions"
2
2
  prompt: |
3
3
 
4
4
  Your task is to assemble relevant high-level information (context) from the input data which will be saved to the context tree in the following steps.
5
+ Prioritize tool call efficiency - run independent tools in parallel whenever possible (in a single iteration).
5
6
 
6
7
  The information should be sufficient to understand what the user has provided to the coding assistant as the important context so that the coding assistant can use it to complete the task at hand. When organizing the context, keep in mind the hierarchical structure with a maximum of 2 levels: domain → topic → subtopic. If subtopics contain complex information, break them into separate topics rather than creating deeper nesting.
7
8
 
@@ -16,28 +17,39 @@ prompt: |
16
17
 
17
18
  After collecting all the information, follow these steps to understand and update the context tree:
18
19
 
19
- 1. **Explore existing context**: Use `glob_files` and `grep_content` to understand the current related context in the context tree. You may use bash commands (e.g., `ls`, `find`) to list directories if necessary to navigate the context tree structure.
20
+ 1. **Detect and read referenced files**:
21
+ - IMPORTANT: Before proceeding, analyze the user's input content for any file path references (e.g., "implemented in auth.ts", "see config.json", "refer to src/utils/helper.ts")
22
+ - If there are file references that you must read, use the `read_file` tool to read these files IN PARALLEL (in a single iteration) to gather comprehensive context
23
+ - Multiple file reads can be done simultaneously - they don't depend on each other
24
+ - This ensures you have complete information before creating knowledge topics
20
25
 
21
- 2. **Find existing knowledge**: Use `find_knowledge_topics` to retrieve concise information about existing knowledge topics in the context tree that relate to the current domain and text segments.
26
+ 2. **Explore existing context**: Use `glob_files` and `grep_content` to understand the current related context in the context tree. You may use bash commands (e.g., `ls`, `find`) to list directories if necessary to navigate the context tree structure.
22
27
 
23
- 3. **Create or update knowledge**: Once you have gathered all information about:
28
+ 3. **Find existing knowledge**: Use `find_knowledge_topics` to retrieve concise information about existing knowledge topics in the context tree that relate to the current domain and text segments.
29
+
30
+ 4. **Create or update knowledge**: Once you have gathered all information about:
24
31
  - The current domain and text segments from the user's input data
25
32
  - The existing context in the context tree
26
- Use the `create_knowledge_topic` tool to create new knowledge topics or update existing ones. Ensure that:
33
+ Use the `curate` tool to create new knowledge topics or update existing ones. Ensure that:
27
34
  - The context is well-structured and MUST meet **Context quality requirements**
28
35
  - There is no duplication with existing context
29
36
  - The information is clear and easy to understand
30
-
31
- 4. **Context quality requirements**: Each context in the `contexts` array must:
32
- - Important: Minimum 2-4 sentences per context. Otherwise, DO NOT add that context.
33
- - A developer should understand the concept without reading source code
34
- - Include names of functions, classes, patterns, or key concepts
35
37
 
36
- AVOID vague contexts like:
38
+ 5. **Tool Execution Efficiency:**
39
+ - When multiple tools don't depend on each other's results, execute them in parallel (same iteration)
40
+ - Example: Reading multiple files can be done in parallel
41
+ - Example: `detect_domains` and `read_file` operations for different files can run together
42
+
43
+ 6. **Context quality requirements**: Each context in the `contexts` array must:
44
+ - Important: Minimum 2-4 sentences per context. Otherwise, DO NOT add that context.
45
+ - A developer should understand the concept without reading source code
46
+ - Include names of functions, classes, patterns, or key concepts
47
+
48
+ AVOID vague contexts like:
37
49
  - "Hook system"
38
50
  - "Error handling"
39
51
 
40
- WRITE detailed contexts like:
52
+ WRITE detailed contexts like:
41
53
  - "The hook system allows registering callbacks for lifecycle events. Register hooks using
42
54
  `HookRegistry.register(hookName, callback)` and trigger them with `HookRegistry.trigger(hookName, context)`. Hooks are used to:
43
55
  support async callbacks and are commonly used for: pre/post tool execution, agent lifecycle events, and custom
@@ -10,15 +10,14 @@ prompt: |
10
10
  1. **Understand the query**: Analyze what the user is asking for - which domains, topics, or specific information they need.
11
11
 
12
12
  2. **Search strategically**:
13
- - Use `find_knowledge_topics` to locate relevant topics across domains with pattern matching
13
+ - Use `find_knowledge_topics` to locate relevant topics across domains with pattern matching. Use the 'path' field for `read_file` tool if you need full content.
14
14
  - Use `read_file` to read the full content of relevant context.md files
15
15
  - Use `grep_content` to search for specific terms, code snippets, or patterns within context files
16
16
  - Use `glob_files` to find files by path patterns if needed
17
17
  - For multi-part queries (queries that include words like "and"), use tools in parallel:
18
18
  - Use `find_knowledge_topics` and `read_file` multiple times to get all relevant topics and their full content.
19
19
  - If ANY of these tools don't depend on each other, try to run them in the same iteration.
20
-
21
- - Consider the context tree structure: `.brv/context-tree/{domain}/{topic}/context.md`
20
+ - Consider the context tree structure: `.brv/context-tree/{domain}/{topic}/context.md` or `.brv/context-tree/{domain}/{topic}/{subtopic}/context.md`
22
21
 
23
22
  3. **Read relevant content**:
24
23
  - Use `read_file` to read the full content of relevant context.md files
@@ -37,7 +36,7 @@ prompt: |
37
36
  - If initial search returns too many results, refine with more specific patterns
38
37
  - If search returns no results, try broader patterns or alternative terms
39
38
 
40
- Available domains in the context tree:
39
+ Default domains in the context tree (search in .brv/context-tree if users add new domains):
41
40
  - `code_style` - Coding standards, style guidelines, quality standards
42
41
  - `design` - UI/UX design, component libraries, themes, design systems
43
42
  - `structure` - Project structure, architecture, component organization
@@ -19,7 +19,7 @@ prompt: |
19
19
  **Context Curation (organizing knowledge):**
20
20
  - `detect_domains` - Identify knowledge domains in user input (required first step)
21
21
  - `find_knowledge_topics` - Check existing context before creating duplicates
22
- - `create_knowledge_topic` - Organize new context into the context tree
22
+ - `curate` - Organize new context into the context tree
23
23
  - Use `grep_content`, `glob_files`, `read_file` to gather information from codebase
24
24
 
25
25
  **File Modification:**
@@ -18,13 +18,14 @@ prompts:
18
18
  Memory deleted successfully.
19
19
 
20
20
  detect_domains_output: |
21
- Domains detected. Now use create_knowledge_topic to organize them into the context tree.
21
+ Domains detected. Now use curate to organize them into the context tree.
22
22
 
23
- create_knowledge_topic_output: |
24
- Knowledge topic created successfully.
23
+ curate_output: |
24
+ Context tree curated successfully.
25
25
  If you detected multiple domains, create topics for the remaining ones.
26
26
  Once all domains are organized, your curation task is complete.
27
27
 
28
28
  find_knowledge_topics_output: |
29
29
  Search complete. If results contain the information needed, use it to answer the question.
30
30
  Use includeContent or followRelations if the current results are insufficient.
31
+ If you need the entire content of any detected topic or subtopic, use the exact 'path' field for read_file tool.
@@ -10,6 +10,10 @@
10
10
 
11
11
  - `CONTEXT`: Knowledge context: patterns, decisions, errors, or insights (triggers autonomous mode, optional)
12
12
 
13
+ **Flags:**
14
+
15
+ - `--files`, `-f`: Include file paths for critical context (max 5 files). Only text/code files from the current project directory are allowed. **CONTEXT argument must come BEFORE this flag.**
16
+
13
17
  **Good examples of context:**
14
18
 
15
19
  - "Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts"
@@ -28,12 +32,20 @@ brv curate
28
32
 
29
33
  # Autonomous mode - LLM auto-categorizes your context
30
34
  brv curate "Auth uses JWT with 24h expiry. Tokens stored in httpOnly cookies via authMiddleware.ts"
35
+
36
+ # Include files (CONTEXT must come before --files)
37
+ # Single file
38
+ brv curate "Authentication middleware validates JWT tokens" -f src/middleware/auth.ts
39
+
40
+ # Multiple files - repeat --files flag for each file
41
+ brv curate "JWT authentication implementation with refresh token rotation" --files src/auth/jwt.ts --files docs/auth.md
31
42
  ```
32
43
 
33
44
  **Behavior:**
34
45
 
35
46
  - Interactive mode: Navigate context tree, create topic folder, edit context.md
36
47
  - Autonomous mode: LLM automatically categorizes and places context in appropriate location
48
+ - When `--files` is provided, agent reads files in parallel before creating knowledge topics
37
49
 
38
50
  **Requirements:** Project must be initialized (`brv init`) and authenticated (`brv login`)
39
51
 
@@ -8,11 +8,20 @@ Core Rules:
8
8
 
9
9
  ## Context Tree Guideline
10
10
 
11
- - Be specific (Use React Query for data fetching in web modules).
11
+ - Be specific ("Use React Query for data fetching in web modules").
12
12
  - Be actionable (clear instruction a future agent/dev can apply).
13
13
  - Be contextual (mention module/service, constraints, links to source).
14
14
  - Include source (file + lines or commit) when possible.
15
15
 
16
+ ## Using `brv curate` with Files
17
+
18
+ When adding complex implementations, use `--files` to include relevant source files (max 5). Only text/code files from the current project directory are allowed. **CONTEXT argument must come BEFORE --files flag.** For multiple files, repeat the `--files` (or `-f`) flag for each file.
19
+
20
+ Examples:
21
+
22
+ - Single file: `brv curate "JWT authentication with refresh token rotation" -f src/auth.ts`
23
+ - Multiple files: `brv curate "Authentication system" --files src/auth/jwt.ts --files src/auth/middleware.ts --files docs/auth.md`
24
+
16
25
  ## CLI Usage Notes
17
26
 
18
27
  - Use --help on any command to discover flags. Provide exact arguments for the scenario.
@@ -0,0 +1,9 @@
1
+ /**
2
+ * TUI App - Main Layout
3
+ *
4
+ * Two main states:
5
+ * - Unauthorized: Show login prompt
6
+ * - Authorized: Show main app with tabs
7
+ */
8
+ import React from 'react';
9
+ export declare const App: React.FC;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * TUI App - Main Layout
4
+ *
5
+ * Two main states:
6
+ * - Unauthorized: Show login prompt
7
+ * - Authorized: Show main app with tabs
8
+ */
9
+ import { Box, useStdout } from 'ink';
10
+ import { Footer, Header, TabBar } from './components/index.js';
11
+ import { LAYOUT } from './constants.js';
12
+ import { useAuth, useConsumer } from './contexts/index.js';
13
+ import { useTabNavigation } from './hooks/index.js';
14
+ import { CommandView, LoginView, LogsView } from './views/index.js';
15
+ export const App = () => {
16
+ const { stdout } = useStdout();
17
+ const terminalHeight = stdout?.rows ?? 24;
18
+ const terminalWidth = stdout?.columns ?? 80;
19
+ // Get auth state from context
20
+ const { isAuthorized } = useAuth();
21
+ // Tab navigation and queue hooks
22
+ const { activeTab } = useTabNavigation();
23
+ const { stats } = useConsumer();
24
+ const contentHeight = Math.max(1, terminalHeight - LAYOUT.headerHeight - LAYOUT.tabBarHeight - LAYOUT.footerHeight);
25
+ return (_jsxs(Box, { flexDirection: "column", height: terminalHeight, paddingBottom: 1, width: terminalWidth, children: [_jsx(Box, { flexShrink: 0, children: _jsx(Header, { compact: isAuthorized, queueStats: stats ? { pending: stats.queued, processing: stats.running } : undefined, showQueueStats: isAuthorized }) }), isAuthorized ? (_jsxs(_Fragment, { children: [_jsx(Box, { flexShrink: 0, children: _jsx(TabBar, { activeTab: activeTab }) }), _jsxs(Box, { flexGrow: 1, height: contentHeight, paddingX: 1, children: [_jsx(Box, { display: activeTab === 'activity' ? 'flex' : 'none', height: "100%", width: "100%", children: _jsx(LogsView, { availableHeight: contentHeight }) }), _jsx(Box, { display: activeTab === 'console' ? 'flex' : 'none', height: "100%", width: "100%", children: _jsx(CommandView, { availableHeight: contentHeight }) })] }), _jsx(Box, { flexShrink: 0, children: _jsx(Footer, {}) })] })) : (_jsx(Box, { flexGrow: 1, paddingX: 1, children: _jsx(LoginView, {}) }))] }));
26
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Enter Prompt Component
3
+ *
4
+ * Displays "Press Enter to {action}" prompt
5
+ */
6
+ import React from 'react';
7
+ interface EnterPromptProps {
8
+ action: string;
9
+ active?: boolean;
10
+ onEnter?: () => void;
11
+ }
12
+ export declare const EnterPrompt: React.FC<EnterPromptProps>;
13
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Enter Prompt Component
4
+ *
5
+ * Displays "Press Enter to {action}" prompt
6
+ */
7
+ import { Text, useInput } from 'ink';
8
+ export const EnterPrompt = ({ action, active = true, onEnter }) => {
9
+ useInput((_input, key) => {
10
+ if (key.return && active) {
11
+ onEnter?.();
12
+ }
13
+ }, { isActive: active });
14
+ return (_jsxs(Text, { color: "gray", children: ["Press", ' ', _jsx(Text, { backgroundColor: "cyan", color: "black", children: ' Enter ' }), ' ', "to ", action] }));
15
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Execution Changes Component
3
+ *
4
+ * Displays created and updated file paths from an execution.
5
+ */
6
+ import React from 'react';
7
+ interface ExecutionChangesProps {
8
+ /** List of created file paths */
9
+ created: string[];
10
+ /** List of updated file paths */
11
+ updated: string[];
12
+ }
13
+ export declare const ExecutionChanges: React.FC<ExecutionChangesProps>;
14
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ /**
3
+ * Execution Changes Component
4
+ *
5
+ * Displays created and updated file paths from an execution.
6
+ */
7
+ import { Box, Text } from 'ink';
8
+ import { useTheme } from '../../hooks/index.js';
9
+ export const ExecutionChanges = ({ created, updated }) => {
10
+ const { theme: { colors }, } = useTheme();
11
+ if (created.length === 0 && updated.length === 0) {
12
+ return null;
13
+ }
14
+ return (_jsxs(_Fragment, { children: [created.length > 0 && (_jsxs(Box, { columnGap: 1, children: [_jsx(Text, { color: colors.secondary, children: "created at:" }), _jsx(Box, { flexDirection: "column", children: created.map((path) => (_jsx(Text, { children: path }, path))) })] })), updated.length > 0 && (_jsxs(Box, { columnGap: 1, children: [_jsx(Text, { color: colors.secondary, children: "updated at:" }), _jsx(Box, { flexDirection: "column", children: updated.map((path) => (_jsx(Text, { children: path }, path))) })] }))] }));
15
+ };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Execution Content Component
3
+ *
4
+ * Displays execution content (result or error) with truncation support.
5
+ */
6
+ import React from 'react';
7
+ /**
8
+ * Truncate content string to maxLines, returning truncated content and remaining line count.
9
+ * Accounts for line wrapping when maxCharsPerLine is provided.
10
+ */
11
+ export declare function truncateContent(content: string, maxLines: number, maxCharsPerLine?: number): {
12
+ remainingLines: number;
13
+ totalLines: number;
14
+ truncatedContent: string;
15
+ };
16
+ interface ExecutionContentProps {
17
+ /** The content to display */
18
+ content: string;
19
+ /** Whether this is error content */
20
+ isError?: boolean;
21
+ /** Maximum number of lines before truncation */
22
+ maxLines: number;
23
+ }
24
+ export declare const ExecutionContent: React.FC<ExecutionContentProps>;
25
+ export {};
@@ -0,0 +1,67 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Execution Content Component
4
+ *
5
+ * Displays execution content (result or error) with truncation support.
6
+ */
7
+ import { Box, Text, useStdout } from 'ink';
8
+ import { useTheme } from '../../hooks/index.js';
9
+ /**
10
+ * Calculate visual line count for a single line, accounting for wrapping
11
+ */
12
+ function getVisualLineCount(line, maxCharsPerLine) {
13
+ if (maxCharsPerLine <= 0 || line.length === 0) {
14
+ return 1;
15
+ }
16
+ return Math.ceil(line.length / maxCharsPerLine) || 1;
17
+ }
18
+ /**
19
+ * Truncate content string to maxLines, returning truncated content and remaining line count.
20
+ * Accounts for line wrapping when maxCharsPerLine is provided.
21
+ */
22
+ export function truncateContent(content, maxLines, maxCharsPerLine) {
23
+ const lines = content.split('\n');
24
+ // Calculate total visual lines (accounting for wrapping)
25
+ let totalVisualLines = 0;
26
+ for (const line of lines) {
27
+ totalVisualLines += maxCharsPerLine ? getVisualLineCount(line, maxCharsPerLine) : 1;
28
+ }
29
+ if (totalVisualLines <= maxLines) {
30
+ return { remainingLines: 0, totalLines: totalVisualLines, truncatedContent: content };
31
+ }
32
+ // Build truncated content respecting visual line limit
33
+ const truncatedLines = [];
34
+ let visualLineCount = 0;
35
+ for (const line of lines) {
36
+ const lineVisualCount = maxCharsPerLine ? getVisualLineCount(line, maxCharsPerLine) : 1;
37
+ if (visualLineCount + lineVisualCount <= maxLines) {
38
+ truncatedLines.push(line);
39
+ visualLineCount += lineVisualCount;
40
+ }
41
+ else {
42
+ // Partial line truncation if needed
43
+ if (maxCharsPerLine && visualLineCount < maxLines) {
44
+ const remainingVisualLines = maxLines - visualLineCount;
45
+ const maxChars = remainingVisualLines * maxCharsPerLine;
46
+ truncatedLines.push(line.slice(0, maxChars));
47
+ visualLineCount = maxLines;
48
+ }
49
+ break;
50
+ }
51
+ }
52
+ return {
53
+ remainingLines: totalVisualLines - visualLineCount,
54
+ totalLines: totalVisualLines,
55
+ truncatedContent: truncatedLines.join('\n'),
56
+ };
57
+ }
58
+ export const ExecutionContent = ({ content, isError = false, maxLines }) => {
59
+ const { theme: { colors }, } = useTheme();
60
+ const { stdout } = useStdout();
61
+ const contentWidth = (stdout?.columns ?? 80) - 4; // 4 is for padding
62
+ if (!content) {
63
+ return null;
64
+ }
65
+ const { remainingLines, truncatedContent } = truncateContent(content, maxLines, contentWidth);
66
+ return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { color: isError ? colors.errorText : colors.text, children: truncatedContent }), remainingLines > 0 && _jsxs(Text, { color: colors.dimText, children: ["\u2195 ", remainingLines, " more lines"] })] }));
67
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Execution Input Component
3
+ *
4
+ * Displays the input text in a bordered box.
5
+ */
6
+ import React from 'react';
7
+ interface ExecutionInputProps {
8
+ /** The input text to display */
9
+ input: string;
10
+ }
11
+ export declare const ExecutionInput: React.FC<ExecutionInputProps>;
12
+ export {};
@@ -0,0 +1,16 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Execution Input Component
4
+ *
5
+ * Displays the input text in a bordered box.
6
+ */
7
+ import { Box, Text, useStdout } from 'ink';
8
+ import { useTheme } from '../../hooks/index.js';
9
+ import { truncateContent } from './execution-content.js';
10
+ export const ExecutionInput = ({ input }) => {
11
+ const { theme: { colors }, } = useTheme();
12
+ const { stdout } = useStdout();
13
+ const contentWidth = (stdout?.columns ?? 80) - 8; // 8 is for padding
14
+ const { remainingLines, truncatedContent } = truncateContent(input, 1, contentWidth);
15
+ return (_jsx(Box, { borderColor: colors.border, borderStyle: "single", flexDirection: "column", children: _jsxs(Text, { children: [truncatedContent, remainingLines > 1 ? '...' : ''] }) }));
16
+ };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Execution Progress Component
3
+ *
4
+ * Displays tool calls progress with status indicators.
5
+ * Shows a limited number of items with "... and X more" indicator.
6
+ */
7
+ import React from 'react';
8
+ import type { ToolCallStatus } from '../../../core/domain/cipher/queue/types.js';
9
+ interface ProgressItem {
10
+ id: string;
11
+ status: ToolCallStatus;
12
+ toolCallName: string;
13
+ }
14
+ interface ExecutionProgressProps {
15
+ /** Maximum number of items to show (default: 3) */
16
+ maxItems?: number;
17
+ /** Array of progress items */
18
+ progress: ProgressItem[];
19
+ }
20
+ export declare const ExecutionProgress: React.FC<ExecutionProgressProps>;
21
+ export {};
@@ -0,0 +1,21 @@
1
+ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
2
+ /**
3
+ * Execution Progress Component
4
+ *
5
+ * Displays tool calls progress with status indicators.
6
+ * Shows a limited number of items with "... and X more" indicator.
7
+ */
8
+ import { Box, Text } from 'ink';
9
+ import Spinner from 'ink-spinner';
10
+ import { useTheme } from '../../hooks/index.js';
11
+ /** Default maximum number of visible progress items */
12
+ const DEFAULT_MAX_ITEMS = 3;
13
+ export const ExecutionProgress = ({ maxItems = DEFAULT_MAX_ITEMS, progress }) => {
14
+ const { theme: { colors }, } = useTheme();
15
+ if (!progress || progress.length === 0) {
16
+ return null;
17
+ }
18
+ const hasMore = progress.length > maxItems;
19
+ const visibleItems = progress.slice(-maxItems).reverse();
20
+ return (_jsxs(Box, { flexDirection: "column", children: [hasMore && _jsxs(Text, { color: colors.dimText, children: ["... and ", progress.length - maxItems, " more"] }), visibleItems.map((item) => (_jsxs(Box, { children: [item.status === 'completed' && _jsx(Text, { color: colors.primary, children: "\u2713 " }), item.status === 'running' && (_jsxs(Text, { color: colors.dimText, children: [_jsx(Spinner, { type: "dots" }), ' '] })), item.status === 'failed' && _jsx(Text, { color: colors.errorText, children: "\u2717 " }), _jsx(Text, { color: colors.dimText, children: item.toolCallName })] }, item.id)))] }));
21
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Execution Status Component
3
+ *
4
+ * Displays the execution status with appropriate spinner and message.
5
+ */
6
+ import React from 'react';
7
+ import type { ExecutionStatus as ExecutionStatusType } from '../../../core/domain/cipher/queue/types.js';
8
+ interface ExecutionStatusProps {
9
+ /** The execution status */
10
+ status: ExecutionStatusType;
11
+ }
12
+ export declare const ExecutionStatus: React.FC<ExecutionStatusProps>;
13
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Execution Status Component
4
+ *
5
+ * Displays the execution status with appropriate spinner and message.
6
+ */
7
+ import { Text } from 'ink';
8
+ import Spinner from 'ink-spinner';
9
+ import { useTheme } from '../../hooks/index.js';
10
+ export const ExecutionStatus = ({ status }) => {
11
+ const { theme: { colors }, } = useTheme();
12
+ if (status === 'running') {
13
+ return (_jsxs(Text, { color: colors.dimText, children: [_jsx(Spinner, { type: "line" }), " Processing..."] }));
14
+ }
15
+ if (status === 'queued') {
16
+ return (_jsxs(Text, { color: colors.dimText, children: [_jsx(Spinner, { type: "dots" }), " Queued..."] }));
17
+ }
18
+ return null;
19
+ };
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Execution Components
3
+ *
4
+ * Reusable components for displaying execution state (tool calls, progress, content).
5
+ */
6
+ export { ExecutionChanges } from './execution-changes.js';
7
+ export { ExecutionContent, truncateContent } from './execution-content.js';
8
+ export { ExecutionInput } from './execution-input.js';
9
+ export { ExecutionProgress } from './execution-progress.js';
10
+ export { ExecutionStatus } from './execution-status.js';
11
+ export { LogItem } from './log-item.js';