@compilr-dev/cli 0.4.0 → 0.5.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 (315) hide show
  1. package/README.md +30 -12
  2. package/dist/agent.d.ts +74 -1
  3. package/dist/agent.js +259 -76
  4. package/dist/anchors/index.d.ts +9 -0
  5. package/dist/anchors/index.js +9 -0
  6. package/dist/anchors/project-anchors.d.ts +79 -0
  7. package/dist/anchors/project-anchors.js +202 -0
  8. package/dist/commands/handler-types.d.ts +68 -0
  9. package/dist/commands/handler-types.js +8 -0
  10. package/dist/commands/handlers/agent-commands.d.ts +13 -0
  11. package/dist/commands/handlers/agent-commands.js +305 -0
  12. package/dist/commands/handlers/design-commands.d.ts +15 -0
  13. package/dist/commands/handlers/design-commands.js +334 -0
  14. package/dist/commands/handlers/index.d.ts +20 -0
  15. package/dist/commands/handlers/index.js +43 -0
  16. package/dist/commands/handlers/overlay-commands.d.ts +21 -0
  17. package/dist/commands/handlers/overlay-commands.js +287 -0
  18. package/dist/commands/handlers/project-commands.d.ts +11 -0
  19. package/dist/commands/handlers/project-commands.js +167 -0
  20. package/dist/commands/handlers/simple-commands.d.ts +19 -0
  21. package/dist/commands/handlers/simple-commands.js +144 -0
  22. package/dist/commands/index.d.ts +2 -1
  23. package/dist/commands/registry.d.ts +50 -0
  24. package/dist/commands/registry.js +75 -0
  25. package/dist/commands-v2/handlers/context.d.ts +13 -0
  26. package/dist/commands-v2/handlers/context.js +348 -0
  27. package/dist/commands-v2/handlers/core.d.ts +13 -0
  28. package/dist/commands-v2/handlers/core.js +165 -0
  29. package/dist/commands-v2/handlers/debug.d.ts +11 -0
  30. package/dist/commands-v2/handlers/debug.js +159 -0
  31. package/dist/commands-v2/handlers/index.d.ts +12 -0
  32. package/dist/commands-v2/handlers/index.js +24 -0
  33. package/dist/commands-v2/handlers/project.d.ts +22 -0
  34. package/dist/commands-v2/handlers/project.js +814 -0
  35. package/dist/commands-v2/handlers/settings.d.ts +15 -0
  36. package/dist/commands-v2/handlers/settings.js +235 -0
  37. package/dist/commands-v2/index.d.ts +13 -0
  38. package/dist/commands-v2/index.js +15 -0
  39. package/dist/commands-v2/registry.d.ts +37 -0
  40. package/dist/commands-v2/registry.js +80 -0
  41. package/dist/commands-v2/types.d.ts +75 -0
  42. package/dist/commands-v2/types.js +7 -0
  43. package/dist/commands.js +110 -7
  44. package/dist/index.js +288 -29
  45. package/dist/input-handlers/index.d.ts +7 -0
  46. package/dist/input-handlers/index.js +7 -0
  47. package/dist/input-handlers/memory-handler.d.ts +26 -0
  48. package/dist/input-handlers/memory-handler.js +68 -0
  49. package/dist/repl-helpers.d.ts +63 -0
  50. package/dist/repl-helpers.js +318 -0
  51. package/dist/repl-v2.d.ts +155 -0
  52. package/dist/repl-v2.js +774 -0
  53. package/dist/repl.d.ts +32 -4
  54. package/dist/repl.js +250 -977
  55. package/dist/settings/index.d.ts +23 -0
  56. package/dist/settings/index.js +48 -0
  57. package/dist/settings/paths.d.ts +110 -0
  58. package/dist/settings/paths.js +264 -0
  59. package/dist/templates/compilr-md.js +7 -4
  60. package/dist/templates/index.js +3 -4
  61. package/dist/themes/colors.js +3 -1
  62. package/dist/themes/registry.d.ts +5 -36
  63. package/dist/themes/registry.js +11 -95
  64. package/dist/themes/types.d.ts +3 -38
  65. package/dist/themes/types.js +2 -2
  66. package/dist/tools/anchor-tools.d.ts +31 -0
  67. package/dist/tools/anchor-tools.js +255 -0
  68. package/dist/tools/backlog-wrappers.d.ts +54 -0
  69. package/dist/tools/backlog-wrappers.js +338 -0
  70. package/dist/tools/backlog.js +1 -1
  71. package/dist/tools/db-tools.d.ts +65 -0
  72. package/dist/tools/db-tools.js +19 -0
  73. package/dist/tools/document-db.d.ts +43 -0
  74. package/dist/tools/document-db.js +220 -0
  75. package/dist/tools/project-db.d.ts +102 -0
  76. package/dist/tools/project-db.js +370 -0
  77. package/dist/tools/workitem-db.d.ts +103 -0
  78. package/dist/tools/workitem-db.js +549 -0
  79. package/dist/tools.js +13 -3
  80. package/dist/ui/agents-overlay-v2.d.ts +43 -0
  81. package/dist/ui/agents-overlay-v2.js +809 -0
  82. package/dist/ui/agents-overlay.d.ts +5 -5
  83. package/dist/ui/agents-overlay.js +782 -420
  84. package/dist/ui/anchors-overlay.d.ts +12 -0
  85. package/dist/ui/anchors-overlay.js +775 -0
  86. package/dist/ui/arch-type-overlay.d.ts +1 -6
  87. package/dist/ui/arch-type-overlay.js +175 -203
  88. package/dist/ui/ask-user-overlay-v2.d.ts +26 -0
  89. package/dist/ui/ask-user-overlay-v2.js +555 -0
  90. package/dist/ui/ask-user-overlay.d.ts +2 -2
  91. package/dist/ui/ask-user-overlay.js +443 -535
  92. package/dist/ui/ask-user-simple-overlay-v2.d.ts +25 -0
  93. package/dist/ui/ask-user-simple-overlay-v2.js +215 -0
  94. package/dist/ui/ask-user-simple-overlay.d.ts +2 -2
  95. package/dist/ui/ask-user-simple-overlay.js +182 -209
  96. package/dist/ui/backlog-overlay.d.ts +16 -1
  97. package/dist/ui/backlog-overlay.js +525 -659
  98. package/dist/ui/base/index.d.ts +26 -0
  99. package/dist/ui/base/index.js +33 -0
  100. package/dist/ui/base/inline-overlay-utils.d.ts +217 -0
  101. package/dist/ui/base/inline-overlay-utils.js +320 -0
  102. package/dist/ui/base/inline-overlay.d.ts +159 -0
  103. package/dist/ui/base/inline-overlay.js +257 -0
  104. package/dist/ui/base/key-utils.d.ts +15 -0
  105. package/dist/ui/base/key-utils.js +30 -0
  106. package/dist/ui/base/overlay-base-v2.d.ts +193 -0
  107. package/dist/ui/base/overlay-base-v2.js +246 -0
  108. package/dist/ui/base/overlay-base.d.ts +156 -0
  109. package/dist/ui/base/overlay-base.js +238 -0
  110. package/dist/ui/base/overlay-lifecycle.d.ts +65 -0
  111. package/dist/ui/base/overlay-lifecycle.js +159 -0
  112. package/dist/ui/base/overlay-types.d.ts +185 -0
  113. package/dist/ui/base/overlay-types.js +7 -0
  114. package/dist/ui/base/render-utils.d.ts +8 -0
  115. package/dist/ui/base/render-utils.js +11 -0
  116. package/dist/ui/base/screen-stack.d.ts +148 -0
  117. package/dist/ui/base/screen-stack.js +184 -0
  118. package/dist/ui/base/tabbed-list-overlay-v2.d.ts +103 -0
  119. package/dist/ui/base/tabbed-list-overlay-v2.js +317 -0
  120. package/dist/ui/base/tabbed-list-overlay.d.ts +153 -0
  121. package/dist/ui/base/tabbed-list-overlay.js +369 -0
  122. package/dist/ui/commands-overlay-v2.d.ts +33 -0
  123. package/dist/ui/commands-overlay-v2.js +441 -0
  124. package/dist/ui/commands-overlay.d.ts +7 -2
  125. package/dist/ui/commands-overlay.js +384 -355
  126. package/dist/ui/config-overlay.d.ts +5 -4
  127. package/dist/ui/config-overlay.js +243 -513
  128. package/dist/ui/conversation.d.ts +75 -4
  129. package/dist/ui/conversation.js +374 -161
  130. package/dist/ui/docs-overlay.d.ts +17 -0
  131. package/dist/ui/docs-overlay.js +303 -0
  132. package/dist/ui/ephemeral.d.ts +1 -1
  133. package/dist/ui/ephemeral.js +1 -1
  134. package/dist/ui/features/index.d.ts +34 -0
  135. package/dist/ui/features/index.js +34 -0
  136. package/dist/ui/features/input-feature.d.ts +85 -0
  137. package/dist/ui/features/input-feature.js +238 -0
  138. package/dist/ui/features/list-feature.d.ts +155 -0
  139. package/dist/ui/features/list-feature.js +244 -0
  140. package/dist/ui/features/pagination-feature.d.ts +154 -0
  141. package/dist/ui/features/pagination-feature.js +238 -0
  142. package/dist/ui/features/search-feature.d.ts +148 -0
  143. package/dist/ui/features/search-feature.js +185 -0
  144. package/dist/ui/features/tab-feature.d.ts +194 -0
  145. package/dist/ui/features/tab-feature.js +307 -0
  146. package/dist/ui/footer-v2.d.ts +222 -0
  147. package/dist/ui/footer-v2.js +1349 -0
  148. package/dist/ui/footer.d.ts +107 -0
  149. package/dist/ui/footer.js +359 -67
  150. package/dist/ui/guardrail-overlay.d.ts +29 -0
  151. package/dist/ui/guardrail-overlay.js +145 -0
  152. package/dist/ui/help-overlay-v2.d.ts +34 -0
  153. package/dist/ui/help-overlay-v2.js +309 -0
  154. package/dist/ui/help-overlay.d.ts +16 -0
  155. package/dist/ui/help-overlay.js +316 -0
  156. package/dist/ui/index.d.ts +1 -1
  157. package/dist/ui/index.js +1 -3
  158. package/dist/ui/init-overlay-v2.d.ts +34 -0
  159. package/dist/ui/init-overlay-v2.js +600 -0
  160. package/dist/ui/init-overlay.d.ts +12 -2
  161. package/dist/ui/init-overlay.js +349 -270
  162. package/dist/ui/input-prompt-v2.d.ts +1 -0
  163. package/dist/ui/input-prompt-v2.js +14 -6
  164. package/dist/ui/input-prompt.d.ts +116 -33
  165. package/dist/ui/input-prompt.js +536 -337
  166. package/dist/ui/iteration-limit-overlay-v2.d.ts +21 -0
  167. package/dist/ui/iteration-limit-overlay-v2.js +114 -0
  168. package/dist/ui/iteration-limit-overlay.d.ts +2 -2
  169. package/dist/ui/iteration-limit-overlay.js +92 -128
  170. package/dist/ui/keys-overlay-v2.d.ts +41 -0
  171. package/dist/ui/keys-overlay-v2.js +248 -0
  172. package/dist/ui/keys-overlay.d.ts +1 -0
  173. package/dist/ui/keys-overlay.js +203 -141
  174. package/dist/ui/line-utils.d.ts +88 -0
  175. package/dist/ui/line-utils.js +150 -0
  176. package/dist/ui/live-region.d.ts +161 -0
  177. package/dist/ui/live-region.js +387 -0
  178. package/dist/ui/mascot/expressions.d.ts +32 -0
  179. package/dist/ui/mascot/expressions.js +213 -0
  180. package/dist/ui/mascot/index.d.ts +8 -0
  181. package/dist/ui/mascot/index.js +8 -0
  182. package/dist/ui/mascot/renderer.d.ts +19 -0
  183. package/dist/ui/mascot/renderer.js +97 -0
  184. package/dist/ui/mascot-overlay-v2.d.ts +41 -0
  185. package/dist/ui/mascot-overlay-v2.js +138 -0
  186. package/dist/ui/mascot-overlay.d.ts +21 -0
  187. package/dist/ui/mascot-overlay.js +146 -0
  188. package/dist/ui/model-overlay-v2.d.ts +49 -0
  189. package/dist/ui/model-overlay-v2.js +118 -0
  190. package/dist/ui/model-overlay.d.ts +27 -0
  191. package/dist/ui/model-overlay.js +221 -0
  192. package/dist/ui/model-warning-overlay.js +3 -5
  193. package/dist/ui/new-overlay.d.ts +34 -0
  194. package/dist/ui/new-overlay.js +604 -0
  195. package/dist/ui/overlay/impl/agents-overlay-v2.d.ts +45 -0
  196. package/dist/ui/overlay/impl/agents-overlay-v2.js +825 -0
  197. package/dist/ui/overlay/impl/anchors-overlay-v2.d.ts +47 -0
  198. package/dist/ui/overlay/impl/anchors-overlay-v2.js +783 -0
  199. package/dist/ui/overlay/impl/arch-type-overlay-v2.d.ts +37 -0
  200. package/dist/ui/overlay/impl/arch-type-overlay-v2.js +240 -0
  201. package/dist/ui/overlay/impl/ask-user-overlay-v2.d.ts +72 -0
  202. package/dist/ui/overlay/impl/ask-user-overlay-v2.js +584 -0
  203. package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.d.ts +46 -0
  204. package/dist/ui/overlay/impl/ask-user-simple-overlay-v2.js +204 -0
  205. package/dist/ui/overlay/impl/backlog-overlay-v2.d.ts +49 -0
  206. package/dist/ui/overlay/impl/backlog-overlay-v2.js +642 -0
  207. package/dist/ui/overlay/impl/commands-overlay-v2.d.ts +33 -0
  208. package/dist/ui/overlay/impl/commands-overlay-v2.js +441 -0
  209. package/dist/ui/overlay/impl/config-overlay-v2.d.ts +100 -0
  210. package/dist/ui/overlay/impl/config-overlay-v2.js +654 -0
  211. package/dist/ui/overlay/impl/dashboard-overlay-v2.d.ts +55 -0
  212. package/dist/ui/overlay/impl/dashboard-overlay-v2.js +359 -0
  213. package/dist/ui/overlay/impl/docs-overlay-v2.d.ts +45 -0
  214. package/dist/ui/overlay/impl/docs-overlay-v2.js +114 -0
  215. package/dist/ui/overlay/impl/document-detail-overlay-v2.d.ts +77 -0
  216. package/dist/ui/overlay/impl/document-detail-overlay-v2.js +1071 -0
  217. package/dist/ui/overlay/impl/guardrail-overlay-v2.d.ts +43 -0
  218. package/dist/ui/overlay/impl/guardrail-overlay-v2.js +114 -0
  219. package/dist/ui/overlay/impl/help-overlay-v2.d.ts +34 -0
  220. package/dist/ui/overlay/impl/help-overlay-v2.js +309 -0
  221. package/dist/ui/overlay/impl/init-overlay-v2.d.ts +77 -0
  222. package/dist/ui/overlay/impl/init-overlay-v2.js +593 -0
  223. package/dist/ui/overlay/impl/init-setup-overlay-v2.d.ts +25 -0
  224. package/dist/ui/overlay/impl/init-setup-overlay-v2.js +97 -0
  225. package/dist/ui/overlay/impl/iteration-limit-overlay-v2.d.ts +35 -0
  226. package/dist/ui/overlay/impl/iteration-limit-overlay-v2.js +105 -0
  227. package/dist/ui/overlay/impl/keys-overlay-v2.d.ts +41 -0
  228. package/dist/ui/overlay/impl/keys-overlay-v2.js +248 -0
  229. package/dist/ui/overlay/impl/mascot-overlay-v2.d.ts +41 -0
  230. package/dist/ui/overlay/impl/mascot-overlay-v2.js +138 -0
  231. package/dist/ui/overlay/impl/model-overlay-v2.d.ts +49 -0
  232. package/dist/ui/overlay/impl/model-overlay-v2.js +118 -0
  233. package/dist/ui/overlay/impl/model-warning-overlay-v2.d.ts +46 -0
  234. package/dist/ui/overlay/impl/model-warning-overlay-v2.js +132 -0
  235. package/dist/ui/overlay/impl/new-overlay-v2.d.ts +77 -0
  236. package/dist/ui/overlay/impl/new-overlay-v2.js +593 -0
  237. package/dist/ui/overlay/impl/permission-overlay-v2.d.ts +36 -0
  238. package/dist/ui/overlay/impl/permission-overlay-v2.js +380 -0
  239. package/dist/ui/overlay/impl/projects-overlay-v2.d.ts +36 -0
  240. package/dist/ui/overlay/impl/projects-overlay-v2.js +499 -0
  241. package/dist/ui/overlay/impl/theme-overlay-v2.d.ts +42 -0
  242. package/dist/ui/overlay/impl/theme-overlay-v2.js +135 -0
  243. package/dist/ui/overlay/impl/tools-overlay-v2.d.ts +47 -0
  244. package/dist/ui/overlay/impl/tools-overlay-v2.js +218 -0
  245. package/dist/ui/overlay/impl/tutorial-overlay-v2.d.ts +31 -0
  246. package/dist/ui/overlay/impl/tutorial-overlay-v2.js +1035 -0
  247. package/dist/ui/overlay/impl/workflow-overlay-v2.d.ts +80 -0
  248. package/dist/ui/overlay/impl/workflow-overlay-v2.js +637 -0
  249. package/dist/ui/overlay/index.d.ts +33 -0
  250. package/dist/ui/overlay/index.js +35 -0
  251. package/dist/ui/overlay/key-utils.d.ts +6 -0
  252. package/dist/ui/overlay/key-utils.js +6 -0
  253. package/dist/ui/overlay/overlay-types.d.ts +128 -0
  254. package/dist/ui/overlay/overlay-types.js +22 -0
  255. package/dist/ui/overlay/types.d.ts +135 -0
  256. package/dist/ui/overlay/types.js +22 -0
  257. package/dist/ui/overlays/help-overlay-v2.d.ts +28 -0
  258. package/dist/ui/overlays/help-overlay-v2.js +198 -0
  259. package/dist/ui/overlays/index.d.ts +11 -0
  260. package/dist/ui/overlays/index.js +11 -0
  261. package/dist/ui/overlays.d.ts +0 -4
  262. package/dist/ui/overlays.js +0 -444
  263. package/dist/ui/permission-overlay-v2.d.ts +36 -0
  264. package/dist/ui/permission-overlay-v2.js +380 -0
  265. package/dist/ui/permission-overlay.d.ts +1 -1
  266. package/dist/ui/permission-overlay.js +186 -298
  267. package/dist/ui/projects-overlay.d.ts +19 -0
  268. package/dist/ui/projects-overlay.js +484 -0
  269. package/dist/ui/providers/types.d.ts +178 -0
  270. package/dist/ui/providers/types.js +9 -0
  271. package/dist/ui/render-modes.d.ts +36 -0
  272. package/dist/ui/render-modes.js +44 -0
  273. package/dist/ui/startup-menu.d.ts +36 -0
  274. package/dist/ui/startup-menu.js +236 -0
  275. package/dist/ui/subagent-renderer.d.ts +117 -0
  276. package/dist/ui/subagent-renderer.js +334 -0
  277. package/dist/ui/terminal-codes.d.ts +94 -0
  278. package/dist/ui/terminal-codes.js +124 -0
  279. package/dist/ui/terminal-renderer.d.ts +221 -0
  280. package/dist/ui/terminal-renderer.js +751 -0
  281. package/dist/ui/terminal-ui.d.ts +463 -0
  282. package/dist/ui/terminal-ui.js +2296 -0
  283. package/dist/ui/terminal.d.ts +20 -0
  284. package/dist/ui/terminal.js +72 -0
  285. package/dist/ui/theme-overlay-v2.d.ts +42 -0
  286. package/dist/ui/theme-overlay-v2.js +135 -0
  287. package/dist/ui/theme-overlay.d.ts +24 -0
  288. package/dist/ui/theme-overlay.js +127 -0
  289. package/dist/ui/todo-zone.js +53 -25
  290. package/dist/ui/tool-formatters.d.ts +16 -0
  291. package/dist/ui/tool-formatters.js +516 -0
  292. package/dist/ui/tools-overlay-v2.d.ts +47 -0
  293. package/dist/ui/tools-overlay-v2.js +218 -0
  294. package/dist/ui/tools-overlay.d.ts +10 -2
  295. package/dist/ui/tools-overlay.js +172 -220
  296. package/dist/ui/tutorial-overlay-v2.d.ts +31 -0
  297. package/dist/ui/tutorial-overlay-v2.js +1035 -0
  298. package/dist/ui/tutorial-overlay.d.ts +1 -0
  299. package/dist/ui/tutorial-overlay.js +400 -302
  300. package/dist/ui/workflow-overlay.d.ts +22 -0
  301. package/dist/ui/workflow-overlay.js +636 -0
  302. package/dist/utils/debug-log.d.ts +28 -0
  303. package/dist/utils/debug-log.js +57 -0
  304. package/dist/utils/model-tiers.js +1 -1
  305. package/dist/utils/path-safety.d.ts +56 -0
  306. package/dist/utils/path-safety.js +239 -0
  307. package/dist/workflow/guided-mode-injector.d.ts +42 -0
  308. package/dist/workflow/guided-mode-injector.js +191 -0
  309. package/dist/workflow/index.d.ts +8 -0
  310. package/dist/workflow/index.js +8 -0
  311. package/dist/workflow/step-criteria.d.ts +62 -0
  312. package/dist/workflow/step-criteria.js +150 -0
  313. package/dist/workflow/step-tracker.d.ts +92 -0
  314. package/dist/workflow/step-tracker.js +141 -0
  315. package/package.json +12 -5
@@ -0,0 +1,161 @@
1
+ /**
2
+ * LiveRegion - Unified Live-Updating Zone for Running Tools
3
+ *
4
+ * Manages the display of running tools (bash, subagents) that need live updates.
5
+ * Sits at the top of the footer, commits to scrolling zone on completion.
6
+ *
7
+ * Key features:
8
+ * - Single subagent: Full detail with tool history
9
+ * - Multiple subagents: Tree structure with summary header
10
+ * - Bash commands: Rolling output lines
11
+ * - Ephemeral notifications on completion
12
+ */
13
+ /**
14
+ * Types of live items that can be displayed
15
+ */
16
+ export type LiveItemType = 'bash' | 'subagent' | 'tool';
17
+ /**
18
+ * Status of a live item
19
+ */
20
+ export type LiveItemStatus = 'running' | 'done' | 'error' | 'cancelled';
21
+ /**
22
+ * Base interface for all live items
23
+ */
24
+ export interface LiveItemBase {
25
+ id: string;
26
+ type: LiveItemType;
27
+ status: LiveItemStatus;
28
+ startTime: number;
29
+ endTime?: number;
30
+ background?: boolean;
31
+ }
32
+ /**
33
+ * Bash command live item
34
+ */
35
+ export interface BashLiveItem extends LiveItemBase {
36
+ type: 'bash';
37
+ command: string;
38
+ output: string[];
39
+ exitCode?: number;
40
+ }
41
+ /**
42
+ * Subagent live item
43
+ */
44
+ export interface SubagentLiveItem extends LiveItemBase {
45
+ type: 'subagent';
46
+ agentType: string;
47
+ description: string;
48
+ toolCount: number;
49
+ tokenCount: number;
50
+ lastAction: string;
51
+ lastActionDetails: string[];
52
+ }
53
+ /**
54
+ * Generic tool live item
55
+ */
56
+ export interface ToolLiveItem extends LiveItemBase {
57
+ type: 'tool';
58
+ name: string;
59
+ params: string;
60
+ progress?: string;
61
+ }
62
+ /**
63
+ * Union type for all live items
64
+ */
65
+ export type LiveItem = BashLiveItem | SubagentLiveItem | ToolLiveItem;
66
+ /**
67
+ * Render options for LiveRegion
68
+ */
69
+ export interface LiveRegionRenderOptions {
70
+ width: number;
71
+ verbose: boolean;
72
+ showTokens: boolean;
73
+ }
74
+ export declare class LiveRegion {
75
+ private readonly items;
76
+ private ephemeralNotifications;
77
+ private maxOutputLines;
78
+ private verbose;
79
+ private expanded;
80
+ /**
81
+ * Add a new live item to the region.
82
+ */
83
+ addItem(item: LiveItem): void;
84
+ /**
85
+ * Update an existing live item.
86
+ */
87
+ updateItem(id: string, update: Partial<LiveItem>): void;
88
+ /**
89
+ * Mark an item as completed. Returns the final item for committing to scrolling zone.
90
+ */
91
+ completeItem(id: string, status?: LiveItemStatus): LiveItem | undefined;
92
+ /**
93
+ * Remove an item and return it (for committing to scrolling zone).
94
+ */
95
+ removeItem(id: string): LiveItem | undefined;
96
+ /**
97
+ * Get an item by ID.
98
+ */
99
+ getItem(id: string): LiveItem | undefined;
100
+ /**
101
+ * Get all current items.
102
+ */
103
+ getItems(): LiveItem[];
104
+ /**
105
+ * Check if there are any items.
106
+ */
107
+ hasItems(): boolean;
108
+ /**
109
+ * Get count of items.
110
+ */
111
+ getItemCount(): number;
112
+ /**
113
+ * Clear all items.
114
+ */
115
+ clear(): void;
116
+ /**
117
+ * Add an ephemeral notification that disappears after timeout.
118
+ */
119
+ addEphemeralNotification(message: string): void;
120
+ /**
121
+ * Clean up expired ephemeral notifications.
122
+ */
123
+ private cleanupEphemeralNotifications;
124
+ /**
125
+ * Set maximum output lines per item.
126
+ */
127
+ setMaxOutputLines(maxLines: number): void;
128
+ /**
129
+ * Set verbose mode.
130
+ */
131
+ setVerbose(verbose: boolean): void;
132
+ /**
133
+ * Toggle expanded view (Ctrl+O).
134
+ */
135
+ toggleExpanded(): void;
136
+ /**
137
+ * Get expanded state.
138
+ */
139
+ isExpanded(): boolean;
140
+ /**
141
+ * Render the live region content.
142
+ */
143
+ render(options: LiveRegionRenderOptions): string[];
144
+ private renderSingleSubagent;
145
+ private renderMultipleSubagents;
146
+ private renderBashItem;
147
+ private renderToolItem;
148
+ private renderEphemeralNotification;
149
+ /**
150
+ * Format token count for display (e.g., 18.1k)
151
+ */
152
+ private formatTokens;
153
+ /**
154
+ * Truncate a line to fit within width.
155
+ */
156
+ private truncateLine;
157
+ /**
158
+ * Format duration for display.
159
+ */
160
+ formatDuration(ms: number): string;
161
+ }
@@ -0,0 +1,387 @@
1
+ /**
2
+ * LiveRegion - Unified Live-Updating Zone for Running Tools
3
+ *
4
+ * Manages the display of running tools (bash, subagents) that need live updates.
5
+ * Sits at the top of the footer, commits to scrolling zone on completion.
6
+ *
7
+ * Key features:
8
+ * - Single subagent: Full detail with tool history
9
+ * - Multiple subagents: Tree structure with summary header
10
+ * - Bash commands: Rolling output lines
11
+ * - Ephemeral notifications on completion
12
+ */
13
+ import { getStyles } from '../themes/index.js';
14
+ import { getVisibleLength } from './line-utils.js';
15
+ // =============================================================================
16
+ // Constants
17
+ // =============================================================================
18
+ const EPHEMERAL_TIMEOUT_MS = 3000; // 3 seconds
19
+ const DEFAULT_MAX_OUTPUT_LINES = 3;
20
+ // Tree drawing characters
21
+ const TREE_BRANCH = '├─';
22
+ const TREE_END = '└─';
23
+ const TREE_CONTINUE = '│';
24
+ const RESULT_MARKER = '⎿';
25
+ // =============================================================================
26
+ // LiveRegion Class
27
+ // =============================================================================
28
+ export class LiveRegion {
29
+ items = new Map();
30
+ ephemeralNotifications = [];
31
+ maxOutputLines = DEFAULT_MAX_OUTPUT_LINES;
32
+ verbose = false;
33
+ expanded = false;
34
+ // =========================================================================
35
+ // Item Management
36
+ // =========================================================================
37
+ /**
38
+ * Add a new live item to the region.
39
+ */
40
+ addItem(item) {
41
+ this.items.set(item.id, item);
42
+ }
43
+ /**
44
+ * Update an existing live item.
45
+ */
46
+ updateItem(id, update) {
47
+ const existing = this.items.get(id);
48
+ if (existing) {
49
+ // Merge update into existing item (type assertion needed due to union type)
50
+ this.items.set(id, { ...existing, ...update });
51
+ }
52
+ }
53
+ /**
54
+ * Mark an item as completed. Returns the final item for committing to scrolling zone.
55
+ */
56
+ completeItem(id, status = 'done') {
57
+ const item = this.items.get(id);
58
+ if (item) {
59
+ item.status = status;
60
+ item.endTime = Date.now();
61
+ // Add ephemeral notification only for background items
62
+ if (item.background && item.type === 'subagent') {
63
+ this.addEphemeralNotification(`Agent "${item.description}" completed.`);
64
+ }
65
+ }
66
+ return item;
67
+ }
68
+ /**
69
+ * Remove an item and return it (for committing to scrolling zone).
70
+ */
71
+ removeItem(id) {
72
+ const item = this.items.get(id);
73
+ this.items.delete(id);
74
+ return item;
75
+ }
76
+ /**
77
+ * Get an item by ID.
78
+ */
79
+ getItem(id) {
80
+ return this.items.get(id);
81
+ }
82
+ /**
83
+ * Get all current items.
84
+ */
85
+ getItems() {
86
+ return Array.from(this.items.values());
87
+ }
88
+ /**
89
+ * Check if there are any items.
90
+ */
91
+ hasItems() {
92
+ return this.items.size > 0;
93
+ }
94
+ /**
95
+ * Get count of items.
96
+ */
97
+ getItemCount() {
98
+ return this.items.size;
99
+ }
100
+ /**
101
+ * Clear all items.
102
+ */
103
+ clear() {
104
+ this.items.clear();
105
+ this.ephemeralNotifications = [];
106
+ }
107
+ // =========================================================================
108
+ // Ephemeral Notifications
109
+ // =========================================================================
110
+ /**
111
+ * Add an ephemeral notification that disappears after timeout.
112
+ */
113
+ addEphemeralNotification(message) {
114
+ this.ephemeralNotifications.push({
115
+ message,
116
+ timestamp: Date.now(),
117
+ });
118
+ }
119
+ /**
120
+ * Clean up expired ephemeral notifications.
121
+ */
122
+ cleanupEphemeralNotifications() {
123
+ const now = Date.now();
124
+ this.ephemeralNotifications = this.ephemeralNotifications.filter((n) => now - n.timestamp < EPHEMERAL_TIMEOUT_MS);
125
+ }
126
+ // =========================================================================
127
+ // Configuration
128
+ // =========================================================================
129
+ /**
130
+ * Set maximum output lines per item.
131
+ */
132
+ setMaxOutputLines(maxLines) {
133
+ this.maxOutputLines = maxLines;
134
+ }
135
+ /**
136
+ * Set verbose mode.
137
+ */
138
+ setVerbose(verbose) {
139
+ this.verbose = verbose;
140
+ }
141
+ /**
142
+ * Toggle expanded view (Ctrl+O).
143
+ */
144
+ toggleExpanded() {
145
+ this.expanded = !this.expanded;
146
+ }
147
+ /**
148
+ * Get expanded state.
149
+ */
150
+ isExpanded() {
151
+ return this.expanded;
152
+ }
153
+ // =========================================================================
154
+ // Rendering
155
+ // =========================================================================
156
+ /**
157
+ * Render the live region content.
158
+ */
159
+ render(options) {
160
+ const lines = [];
161
+ const items = this.getItems();
162
+ if (items.length === 0) {
163
+ // Only show ephemeral notifications if no items
164
+ this.cleanupEphemeralNotifications();
165
+ for (const notification of this.ephemeralNotifications) {
166
+ lines.push(this.renderEphemeralNotification(notification.message));
167
+ }
168
+ return lines;
169
+ }
170
+ // Separate items by type
171
+ const subagents = items.filter((i) => i.type === 'subagent');
172
+ const bashItems = items.filter((i) => i.type === 'bash');
173
+ const toolItems = items.filter((i) => i.type === 'tool');
174
+ // Render subagents (single vs multiple has different rendering)
175
+ if (subagents.length === 1) {
176
+ lines.push(...this.renderSingleSubagent(subagents[0], options));
177
+ }
178
+ else if (subagents.length > 1) {
179
+ lines.push(...this.renderMultipleSubagents(subagents, options));
180
+ }
181
+ // Render bash commands
182
+ for (const bash of bashItems) {
183
+ lines.push(...this.renderBashItem(bash, options));
184
+ }
185
+ // Render generic tools
186
+ for (const tool of toolItems) {
187
+ lines.push(...this.renderToolItem(tool, options));
188
+ }
189
+ // Add ephemeral notifications at the end
190
+ this.cleanupEphemeralNotifications();
191
+ for (const notification of this.ephemeralNotifications) {
192
+ lines.push(this.renderEphemeralNotification(notification.message));
193
+ }
194
+ return lines;
195
+ }
196
+ // =========================================================================
197
+ // Single Subagent Rendering
198
+ // =========================================================================
199
+ renderSingleSubagent(item, options) {
200
+ const s = getStyles();
201
+ const lines = [];
202
+ // Header: ● AgentType(description)
203
+ const statusIcon = item.status === 'done' ? ' ✓' : '';
204
+ const header = `${s.info('●')} ${s.primary(item.agentType)}(${item.description})${statusIcon}`;
205
+ lines.push(header);
206
+ if (item.status === 'done') {
207
+ // Completed: show summary
208
+ const duration = item.endTime ? Math.round((item.endTime - item.startTime) / 1000) : 0;
209
+ const tokenStr = options.showTokens ? ` · ${this.formatTokens(item.tokenCount)} tokens` : '';
210
+ const summary = ` ${RESULT_MARKER} Done (${String(item.toolCount)} tool uses${tokenStr} · ${String(duration)}s)`;
211
+ lines.push(s.muted(summary));
212
+ }
213
+ else {
214
+ // Running: show last action
215
+ if (item.lastAction) {
216
+ lines.push(` ${RESULT_MARKER} ${s.muted(item.lastAction)}`);
217
+ }
218
+ else {
219
+ lines.push(` ${RESULT_MARKER} ${s.muted('Initializing…')}`);
220
+ }
221
+ // Show detail lines if expanded or verbose
222
+ if ((this.expanded || this.verbose) && item.lastActionDetails.length > 0) {
223
+ for (const detail of item.lastActionDetails.slice(0, this.maxOutputLines)) {
224
+ lines.push(` ${s.muted(detail)}`);
225
+ }
226
+ if (item.lastActionDetails.length > this.maxOutputLines) {
227
+ const hidden = item.lastActionDetails.length - this.maxOutputLines;
228
+ lines.push(` ${s.muted(`+${String(hidden)} more tool uses`)} ${s.muted('(ctrl+o to expand)')}`);
229
+ }
230
+ }
231
+ // Hints
232
+ lines.push(` ${s.muted('ctrl+b to run in background')}`);
233
+ }
234
+ return lines;
235
+ }
236
+ // =========================================================================
237
+ // Multiple Subagents Rendering (Tree Structure)
238
+ // =========================================================================
239
+ renderMultipleSubagents(items, options) {
240
+ const s = getStyles();
241
+ const lines = [];
242
+ // Count running vs done
243
+ const runningCount = items.filter((i) => i.status === 'running').length;
244
+ const allDone = runningCount === 0;
245
+ // Determine agent type label
246
+ const types = new Set(items.map((i) => i.agentType));
247
+ const typeLabel = types.size === 1 ? `${items[0].agentType} agents` : 'agents';
248
+ // Header: ● Running N agents… or ● N agents finished
249
+ if (allDone) {
250
+ lines.push(`${s.info('●')} ${String(items.length)} ${typeLabel} finished ${s.muted('(ctrl+o to expand)')}`);
251
+ }
252
+ else {
253
+ lines.push(`${s.info('●')} Running ${String(items.length)} ${typeLabel}… ${s.muted('(ctrl+o to expand)')}`);
254
+ }
255
+ // Render each agent in tree structure
256
+ for (let i = 0; i < items.length; i++) {
257
+ const item = items[i];
258
+ const isLast = i === items.length - 1;
259
+ const branch = isLast ? TREE_END : TREE_BRANCH;
260
+ const continuation = isLast ? ' ' : `${TREE_CONTINUE} `;
261
+ // Agent line: description · tool count · tokens
262
+ const tokenStr = options.showTokens ? ` · ${this.formatTokens(item.tokenCount)} tokens` : '';
263
+ const toolWord = item.toolCount === 1 ? 'tool use' : 'tool uses';
264
+ const agentLine = ` ${branch} ${item.description} · ${String(item.toolCount)} ${toolWord}${tokenStr}`;
265
+ lines.push(agentLine);
266
+ // Last action line
267
+ if (item.status === 'done') {
268
+ lines.push(` ${continuation}${RESULT_MARKER} ${s.muted('Done')}`);
269
+ }
270
+ else if (item.lastAction) {
271
+ lines.push(` ${continuation}${RESULT_MARKER} ${s.muted(item.lastAction)}`);
272
+ }
273
+ else {
274
+ lines.push(` ${continuation}${RESULT_MARKER} ${s.muted('Initializing…')}`);
275
+ }
276
+ }
277
+ // Hint at the end
278
+ if (!allDone) {
279
+ lines.push(` ${s.muted('ctrl+b to run in background')}`);
280
+ }
281
+ return lines;
282
+ }
283
+ // =========================================================================
284
+ // Bash Item Rendering
285
+ // =========================================================================
286
+ renderBashItem(item, options) {
287
+ const s = getStyles();
288
+ const lines = [];
289
+ // Header: ● Bash(command)
290
+ // Handle multi-line commands - only show first line
291
+ // Truncate long commands - show more context than before (60 chars)
292
+ const maxCmdLen = Math.min(60, options.width - 15);
293
+ const statusIcon = item.status === 'done' ? ' ✓' : '';
294
+ // For multi-line commands, show only first line or a summary
295
+ let cmdForDisplay = item.command;
296
+ const newlineIndex = cmdForDisplay.indexOf('\n');
297
+ if (newlineIndex !== -1) {
298
+ // Multi-line command - show first line with indicator
299
+ const firstLine = cmdForDisplay.slice(0, newlineIndex).trim();
300
+ const lineCount = cmdForDisplay.split('\n').length;
301
+ cmdForDisplay = firstLine.length > 0
302
+ ? `${firstLine}… (${String(lineCount)} lines)`
303
+ : `(${String(lineCount)} line script)`;
304
+ }
305
+ const cmdDisplay = cmdForDisplay.length > maxCmdLen
306
+ ? cmdForDisplay.slice(0, maxCmdLen) + '…'
307
+ : cmdForDisplay;
308
+ lines.push(`${s.info('●')} ${s.primary('Bash')}(${cmdDisplay})${statusIcon}`);
309
+ // Output lines - show first N lines (more useful than last N for live streaming)
310
+ const displayLines = this.expanded
311
+ ? item.output
312
+ : item.output.slice(0, this.maxOutputLines);
313
+ if (displayLines.length > 0) {
314
+ for (const line of displayLines) {
315
+ const truncated = this.truncateLine(line, options.width - 5);
316
+ lines.push(` ${RESULT_MARKER} ${s.muted(truncated)}`);
317
+ }
318
+ // Show collapsed indicator if there are hidden lines
319
+ if (!this.expanded && item.output.length > this.maxOutputLines) {
320
+ const hidden = item.output.length - this.maxOutputLines;
321
+ lines.push(` ${s.muted(`… +${String(hidden)} lines`)} ${s.muted('(ctrl+o to expand)')}`);
322
+ }
323
+ }
324
+ // Hint for running bash
325
+ if (item.status === 'running') {
326
+ lines.push(` ${s.muted('ctrl+b to run in background')}`);
327
+ }
328
+ return lines;
329
+ }
330
+ // =========================================================================
331
+ // Tool Item Rendering
332
+ // =========================================================================
333
+ renderToolItem(item, _options) {
334
+ const s = getStyles();
335
+ const lines = [];
336
+ // Header: ● ToolName(params)
337
+ const statusIcon = item.status === 'done' ? ' ✓' : '';
338
+ lines.push(`${s.info('●')} ${s.primary(item.name)}(${item.params})${statusIcon}`);
339
+ // Progress or status
340
+ if (item.progress) {
341
+ lines.push(` ${RESULT_MARKER} ${s.muted(item.progress)}`);
342
+ }
343
+ return lines;
344
+ }
345
+ // =========================================================================
346
+ // Ephemeral Notification Rendering
347
+ // =========================================================================
348
+ renderEphemeralNotification(message) {
349
+ const s = getStyles();
350
+ return `${s.info('●')} ${message}`;
351
+ }
352
+ // =========================================================================
353
+ // Helpers
354
+ // =========================================================================
355
+ /**
356
+ * Format token count for display (e.g., 18.1k)
357
+ */
358
+ formatTokens(tokens) {
359
+ if (tokens >= 1000) {
360
+ return `${(tokens / 1000).toFixed(1)}k`;
361
+ }
362
+ return String(tokens);
363
+ }
364
+ /**
365
+ * Truncate a line to fit within width.
366
+ */
367
+ truncateLine(line, maxWidth) {
368
+ const visibleLen = getVisibleLength(line);
369
+ if (visibleLen <= maxWidth) {
370
+ return line;
371
+ }
372
+ // Simple truncation (doesn't handle ANSI codes perfectly)
373
+ return line.slice(0, maxWidth - 1) + '…';
374
+ }
375
+ /**
376
+ * Format duration for display.
377
+ */
378
+ formatDuration(ms) {
379
+ const seconds = Math.floor(ms / 1000);
380
+ if (seconds < 60) {
381
+ return `${String(seconds)}s`;
382
+ }
383
+ const minutes = Math.floor(seconds / 60);
384
+ const remainingSeconds = seconds % 60;
385
+ return `${String(minutes)}m ${String(remainingSeconds)}s`;
386
+ }
387
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Mascot Expression Library
3
+ *
4
+ * ASCII art expressions for the compilr mascot - a retro CRT monitor
5
+ * with rabbit-ear antennas and a 3D keyboard.
6
+ *
7
+ * Each expression is 6 lines tall and designed to sit alongside the logo.
8
+ */
9
+ export type ExpressionCode = 'neutral' | 'thinking' | 'looking_left' | 'looking_right' | 'sleeping' | 'alert' | 'error' | 'success' | 'success_minimal' | 'searching' | 'skeptical';
10
+ export type MascotSetting = 'none' | 'random' | ExpressionCode;
11
+ export declare const EXPRESSIONS: Record<ExpressionCode, string[]>;
12
+ export declare const EXPRESSIONS_INLINE: Record<ExpressionCode, string>;
13
+ export declare const EXPRESSION_CODES: ExpressionCode[];
14
+ export declare const MASCOT_OPTIONS: MascotSetting[];
15
+ export declare const MASCOT_LABELS: Record<MascotSetting, string>;
16
+ /**
17
+ * Get a random expression code
18
+ */
19
+ export declare function getRandomExpression(): ExpressionCode;
20
+ /**
21
+ * Reset the session expression (for next startup or when settings change)
22
+ */
23
+ export declare function resetSessionExpression(): void;
24
+ /**
25
+ * Get expression lines for a mascot setting
26
+ * Returns null for 'none', picks random for 'random', otherwise returns the expression
27
+ */
28
+ export declare function getExpressionForSetting(setting: MascotSetting): string[] | null;
29
+ /**
30
+ * Get the width of the mascot (for layout calculations)
31
+ */
32
+ export declare function getMascotWidth(): number;