@spenceriam/impulse 0.15.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 (240) hide show
  1. package/README.md +194 -0
  2. package/dist/api/client.d.ts +53 -0
  3. package/dist/api/client.d.ts.map +1 -0
  4. package/dist/api/client.js +271 -0
  5. package/dist/api/client.js.map +1 -0
  6. package/dist/api/index.d.ts +6 -0
  7. package/dist/api/index.d.ts.map +1 -0
  8. package/dist/api/index.js +7 -0
  9. package/dist/api/index.js.map +1 -0
  10. package/dist/api/stream.d.ts +98 -0
  11. package/dist/api/stream.d.ts.map +1 -0
  12. package/dist/api/stream.js +202 -0
  13. package/dist/api/stream.js.map +1 -0
  14. package/dist/api/types.d.ts +1353 -0
  15. package/dist/api/types.d.ts.map +1 -0
  16. package/dist/api/types.js +143 -0
  17. package/dist/api/types.js.map +1 -0
  18. package/dist/bash.txt +28 -0
  19. package/dist/bus/bus.d.ts +21 -0
  20. package/dist/bus/bus.d.ts.map +1 -0
  21. package/dist/bus/bus.js +22 -0
  22. package/dist/bus/bus.js.map +1 -0
  23. package/dist/bus/events.d.ts +100 -0
  24. package/dist/bus/events.d.ts.map +1 -0
  25. package/dist/bus/events.js +45 -0
  26. package/dist/bus/events.js.map +1 -0
  27. package/dist/bus/index.d.ts +3 -0
  28. package/dist/bus/index.d.ts.map +1 -0
  29. package/dist/bus/index.js +3 -0
  30. package/dist/bus/index.js.map +1 -0
  31. package/dist/file-edit.txt +21 -0
  32. package/dist/file-read.txt +18 -0
  33. package/dist/file-write.txt +16 -0
  34. package/dist/glob.txt +19 -0
  35. package/dist/global.d.ts +8 -0
  36. package/dist/global.d.ts.map +1 -0
  37. package/dist/global.js +14 -0
  38. package/dist/global.js.map +1 -0
  39. package/dist/grep.txt +20 -0
  40. package/dist/highlights-eq9cgrbb.scm +604 -0
  41. package/dist/highlights-ghv9g403.scm +205 -0
  42. package/dist/highlights-hk7bwhj4.scm +284 -0
  43. package/dist/highlights-r812a2qc.scm +150 -0
  44. package/dist/highlights-x6tmsnaa.scm +115 -0
  45. package/dist/index.d.ts +2 -0
  46. package/dist/index.d.ts.map +1 -0
  47. package/dist/index.js +62122 -0
  48. package/dist/index.js.map +1 -0
  49. package/dist/index.jsx +5 -0
  50. package/dist/index.jsx.map +1 -0
  51. package/dist/injections-73j83es3.scm +27 -0
  52. package/dist/input/at-refs.d.ts +42 -0
  53. package/dist/input/at-refs.d.ts.map +1 -0
  54. package/dist/input/at-refs.js +154 -0
  55. package/dist/input/at-refs.js.map +1 -0
  56. package/dist/input/history.d.ts +26 -0
  57. package/dist/input/history.d.ts.map +1 -0
  58. package/dist/input/history.js +109 -0
  59. package/dist/input/history.js.map +1 -0
  60. package/dist/input/index.d.ts +5 -0
  61. package/dist/input/index.d.ts.map +1 -0
  62. package/dist/input/index.js +5 -0
  63. package/dist/input/index.js.map +1 -0
  64. package/dist/input/paste.d.ts +19 -0
  65. package/dist/input/paste.d.ts.map +1 -0
  66. package/dist/input/paste.js +75 -0
  67. package/dist/input/paste.js.map +1 -0
  68. package/dist/input/shortcuts.d.ts +6 -0
  69. package/dist/input/shortcuts.d.ts.map +1 -0
  70. package/dist/input/shortcuts.js +84 -0
  71. package/dist/input/shortcuts.js.map +1 -0
  72. package/dist/mcp/index.d.ts +3 -0
  73. package/dist/mcp/index.d.ts.map +1 -0
  74. package/dist/mcp/index.js +3 -0
  75. package/dist/mcp/index.js.map +1 -0
  76. package/dist/mcp/manager.d.ts +51 -0
  77. package/dist/mcp/manager.d.ts.map +1 -0
  78. package/dist/mcp/manager.js +158 -0
  79. package/dist/mcp/manager.js.map +1 -0
  80. package/dist/mcp/types.d.ts +18 -0
  81. package/dist/mcp/types.d.ts.map +1 -0
  82. package/dist/mcp/types.js +5 -0
  83. package/dist/mcp/types.js.map +1 -0
  84. package/dist/session/todo.d.ts +24 -0
  85. package/dist/session/todo.d.ts.map +1 -0
  86. package/dist/session/todo.js +39 -0
  87. package/dist/session/todo.js.map +1 -0
  88. package/dist/storage/index.d.ts +2 -0
  89. package/dist/storage/index.d.ts.map +1 -0
  90. package/dist/storage/index.js +2 -0
  91. package/dist/storage/index.js.map +1 -0
  92. package/dist/storage/storage.d.ts +13 -0
  93. package/dist/storage/storage.d.ts.map +1 -0
  94. package/dist/storage/storage.js +84 -0
  95. package/dist/storage/storage.js.map +1 -0
  96. package/dist/task.txt +26 -0
  97. package/dist/todo-read.txt +14 -0
  98. package/dist/todo-write.txt +166 -0
  99. package/dist/tools/bash.d.ts +22 -0
  100. package/dist/tools/bash.d.ts.map +1 -0
  101. package/dist/tools/bash.js +70 -0
  102. package/dist/tools/bash.js.map +1 -0
  103. package/dist/tools/file-edit.d.ts +22 -0
  104. package/dist/tools/file-edit.d.ts.map +1 -0
  105. package/dist/tools/file-edit.js +67 -0
  106. package/dist/tools/file-edit.js.map +1 -0
  107. package/dist/tools/file-read.d.ts +19 -0
  108. package/dist/tools/file-read.d.ts.map +1 -0
  109. package/dist/tools/file-read.js +70 -0
  110. package/dist/tools/file-read.js.map +1 -0
  111. package/dist/tools/file-write.d.ts +16 -0
  112. package/dist/tools/file-write.d.ts.map +1 -0
  113. package/dist/tools/file-write.js +45 -0
  114. package/dist/tools/file-write.js.map +1 -0
  115. package/dist/tools/glob.d.ts +16 -0
  116. package/dist/tools/glob.d.ts.map +1 -0
  117. package/dist/tools/glob.js +45 -0
  118. package/dist/tools/glob.js.map +1 -0
  119. package/dist/tools/grep.d.ts +19 -0
  120. package/dist/tools/grep.d.ts.map +1 -0
  121. package/dist/tools/grep.js +65 -0
  122. package/dist/tools/grep.js.map +1 -0
  123. package/dist/tools/index.d.ts +11 -0
  124. package/dist/tools/index.d.ts.map +1 -0
  125. package/dist/tools/index.js +11 -0
  126. package/dist/tools/index.js.map +1 -0
  127. package/dist/tools/registry.d.ts +22 -0
  128. package/dist/tools/registry.d.ts.map +1 -0
  129. package/dist/tools/registry.js +75 -0
  130. package/dist/tools/registry.js.map +1 -0
  131. package/dist/tools/task.d.ts +19 -0
  132. package/dist/tools/task.d.ts.map +1 -0
  133. package/dist/tools/task.js +51 -0
  134. package/dist/tools/task.js.map +1 -0
  135. package/dist/tools/todo-read.d.ts +7 -0
  136. package/dist/tools/todo-read.d.ts.map +1 -0
  137. package/dist/tools/todo-read.js +56 -0
  138. package/dist/tools/todo-read.js.map +1 -0
  139. package/dist/tools/todo-write.d.ts +38 -0
  140. package/dist/tools/todo-write.d.ts.map +1 -0
  141. package/dist/tools/todo-write.js +40 -0
  142. package/dist/tools/todo-write.js.map +1 -0
  143. package/dist/tree-sitter-javascript-nd0q4pe9.wasm +0 -0
  144. package/dist/tree-sitter-markdown-411r6y9b.wasm +0 -0
  145. package/dist/tree-sitter-markdown_inline-j5349f42.wasm +0 -0
  146. package/dist/tree-sitter-typescript-zxjzwt75.wasm +0 -0
  147. package/dist/tree-sitter-zig-e78zbjpm.wasm +0 -0
  148. package/dist/ui/App.d.ts +6 -0
  149. package/dist/ui/App.d.ts.map +1 -0
  150. package/dist/ui/App.jsx +37 -0
  151. package/dist/ui/App.jsx.map +1 -0
  152. package/dist/ui/components/Autocomplete.d.ts +24 -0
  153. package/dist/ui/components/Autocomplete.d.ts.map +1 -0
  154. package/dist/ui/components/Autocomplete.jsx +67 -0
  155. package/dist/ui/components/Autocomplete.jsx.map +1 -0
  156. package/dist/ui/components/ChatView.d.ts +14 -0
  157. package/dist/ui/components/ChatView.d.ts.map +1 -0
  158. package/dist/ui/components/ChatView.jsx +11 -0
  159. package/dist/ui/components/ChatView.jsx.map +1 -0
  160. package/dist/ui/components/InputArea.d.ts +18 -0
  161. package/dist/ui/components/InputArea.d.ts.map +1 -0
  162. package/dist/ui/components/InputArea.jsx +35 -0
  163. package/dist/ui/components/InputArea.jsx.map +1 -0
  164. package/dist/ui/components/MessageBlock.d.ts +21 -0
  165. package/dist/ui/components/MessageBlock.d.ts.map +1 -0
  166. package/dist/ui/components/MessageBlock.jsx +94 -0
  167. package/dist/ui/components/MessageBlock.jsx.map +1 -0
  168. package/dist/ui/components/Overlay.d.ts +28 -0
  169. package/dist/ui/components/Overlay.d.ts.map +1 -0
  170. package/dist/ui/components/Overlay.jsx +102 -0
  171. package/dist/ui/components/Overlay.jsx.map +1 -0
  172. package/dist/ui/components/ProgressBar.d.ts +9 -0
  173. package/dist/ui/components/ProgressBar.d.ts.map +1 -0
  174. package/dist/ui/components/ProgressBar.jsx +17 -0
  175. package/dist/ui/components/ProgressBar.jsx.map +1 -0
  176. package/dist/ui/components/Sidebar.d.ts +22 -0
  177. package/dist/ui/components/Sidebar.d.ts.map +1 -0
  178. package/dist/ui/components/Sidebar.jsx +96 -0
  179. package/dist/ui/components/Sidebar.jsx.map +1 -0
  180. package/dist/ui/components/StatusLine.d.ts +6 -0
  181. package/dist/ui/components/StatusLine.d.ts.map +1 -0
  182. package/dist/ui/components/StatusLine.jsx +32 -0
  183. package/dist/ui/components/StatusLine.jsx.map +1 -0
  184. package/dist/ui/components/ThinkingBlock.d.ts +15 -0
  185. package/dist/ui/components/ThinkingBlock.d.ts.map +1 -0
  186. package/dist/ui/components/ThinkingBlock.jsx +33 -0
  187. package/dist/ui/components/ThinkingBlock.jsx.map +1 -0
  188. package/dist/ui/components/TodoItem.d.ts +22 -0
  189. package/dist/ui/components/TodoItem.d.ts.map +1 -0
  190. package/dist/ui/components/TodoItem.jsx +11 -0
  191. package/dist/ui/components/TodoItem.jsx.map +1 -0
  192. package/dist/ui/components/ToolBlock.d.ts +27 -0
  193. package/dist/ui/components/ToolBlock.d.ts.map +1 -0
  194. package/dist/ui/components/ToolBlock.jsx +76 -0
  195. package/dist/ui/components/ToolBlock.jsx.map +1 -0
  196. package/dist/ui/components/index.d.ts +12 -0
  197. package/dist/ui/components/index.d.ts.map +1 -0
  198. package/dist/ui/components/index.js +12 -0
  199. package/dist/ui/components/index.js.map +1 -0
  200. package/dist/ui/context/index.d.ts +4 -0
  201. package/dist/ui/context/index.d.ts.map +1 -0
  202. package/dist/ui/context/index.js +4 -0
  203. package/dist/ui/context/index.js.map +1 -0
  204. package/dist/ui/context/mode.d.ts +24 -0
  205. package/dist/ui/context/mode.d.ts.map +1 -0
  206. package/dist/ui/context/mode.jsx +53 -0
  207. package/dist/ui/context/mode.jsx.map +1 -0
  208. package/dist/ui/context/session.d.ts +43 -0
  209. package/dist/ui/context/session.d.ts.map +1 -0
  210. package/dist/ui/context/session.jsx +63 -0
  211. package/dist/ui/context/session.jsx.map +1 -0
  212. package/dist/ui/context/todo.d.ts +32 -0
  213. package/dist/ui/context/todo.d.ts.map +1 -0
  214. package/dist/ui/context/todo.jsx +75 -0
  215. package/dist/ui/context/todo.jsx.map +1 -0
  216. package/dist/ui/design.d.ts +182 -0
  217. package/dist/ui/design.d.ts.map +1 -0
  218. package/dist/ui/design.js +189 -0
  219. package/dist/ui/design.js.map +1 -0
  220. package/dist/ui/index.d.ts +4 -0
  221. package/dist/ui/index.d.ts.map +1 -0
  222. package/dist/ui/index.js +3 -0
  223. package/dist/ui/index.js.map +1 -0
  224. package/dist/util/config.d.ts +22 -0
  225. package/dist/util/config.d.ts.map +1 -0
  226. package/dist/util/config.js +55 -0
  227. package/dist/util/config.js.map +1 -0
  228. package/dist/util/instructions.d.ts +39 -0
  229. package/dist/util/instructions.d.ts.map +1 -0
  230. package/dist/util/instructions.js +96 -0
  231. package/dist/util/instructions.js.map +1 -0
  232. package/dist/util/lock.d.ts +18 -0
  233. package/dist/util/lock.d.ts.map +1 -0
  234. package/dist/util/lock.js +65 -0
  235. package/dist/util/lock.js.map +1 -0
  236. package/dist/util/logger.d.ts +8 -0
  237. package/dist/util/logger.d.ts.map +1 -0
  238. package/dist/util/logger.js +81 -0
  239. package/dist/util/logger.js.map +1 -0
  240. package/package.json +64 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Design Constants
3
+ * Single source of truth for colors, indicators, and visual elements
4
+ *
5
+ * Design Philosophy: Brutally Minimal
6
+ * - Function over decoration
7
+ * - Raw and honest
8
+ * - Dense and information-forward
9
+ * - High contrast
10
+ * - Monospace precision
11
+ * - No emojis
12
+ */
13
+ /**
14
+ * Color Palette
15
+ */
16
+ export declare const Colors: {
17
+ /**
18
+ * Mode-specific colors (used in mode indicators, input borders)
19
+ */
20
+ readonly mode: {
21
+ readonly AUTO: "#ffffff";
22
+ readonly AGENT: "#5cffff";
23
+ readonly PLANNER: "#b48eff";
24
+ readonly "PLAN-PRD": "#5c8fff";
25
+ readonly DEBUG: "#ffaa5c";
26
+ };
27
+ /**
28
+ * Status colors (used in tool results, messages)
29
+ */
30
+ readonly status: {
31
+ readonly success: "#6fca6f";
32
+ readonly warning: "#e6c655";
33
+ readonly error: "#ff6b6b";
34
+ readonly info: "#5c8fff";
35
+ };
36
+ /**
37
+ * UI element colors
38
+ */
39
+ readonly ui: {
40
+ readonly primary: "#5cffff";
41
+ readonly secondary: "#666666";
42
+ readonly text: "#ffffff";
43
+ readonly dim: "#666666";
44
+ readonly background: "#000000";
45
+ };
46
+ /**
47
+ * Diff colors (used in file changes)
48
+ */
49
+ readonly diff: {
50
+ readonly addition: "#6fca6f";
51
+ readonly deletion: "#ff6b6b";
52
+ };
53
+ };
54
+ /**
55
+ * ASCII Indicators (no emojis)
56
+ */
57
+ export declare const Indicators: {
58
+ /**
59
+ * Expand/collapse indicators
60
+ */
61
+ readonly collapsed: "▶";
62
+ readonly expanded: "▼";
63
+ /**
64
+ * Status dot
65
+ */
66
+ readonly dot: "●";
67
+ /**
68
+ * Todo status indicators
69
+ */
70
+ readonly todo: {
71
+ readonly pending: "[ ]";
72
+ readonly in_progress: "[>]";
73
+ readonly completed: "[x]";
74
+ readonly cancelled: "[-]";
75
+ };
76
+ /**
77
+ * Tool result indicators
78
+ */
79
+ readonly tool: {
80
+ readonly success: "[OK]";
81
+ readonly error: "[FAIL]";
82
+ };
83
+ /**
84
+ * Progress bar characters
85
+ */
86
+ readonly progress: {
87
+ readonly filled: "█";
88
+ readonly empty: "░";
89
+ };
90
+ /**
91
+ * Separators
92
+ */
93
+ readonly separator: {
94
+ readonly vertical: "│";
95
+ readonly horizontal: "─";
96
+ readonly cross: "┼";
97
+ readonly topLeft: "┌";
98
+ readonly topRight: "┐";
99
+ readonly bottomLeft: "└";
100
+ readonly bottomRight: "┘";
101
+ readonly teeLeft: "├";
102
+ readonly teeRight: "┤";
103
+ readonly teeTop: "┬";
104
+ readonly teeBottom: "┴";
105
+ };
106
+ };
107
+ /**
108
+ * Layout Constants
109
+ */
110
+ export declare const Layout: {
111
+ /**
112
+ * Padding values
113
+ */
114
+ readonly padding: {
115
+ readonly none: 0;
116
+ readonly xs: 1;
117
+ readonly sm: 2;
118
+ readonly md: 4;
119
+ readonly lg: 8;
120
+ };
121
+ /**
122
+ * Sidebar width
123
+ */
124
+ readonly sidebar: {
125
+ readonly width: 40;
126
+ readonly minWidth: 30;
127
+ readonly maxWidth: 60;
128
+ };
129
+ /**
130
+ * Input height
131
+ */
132
+ readonly input: {
133
+ readonly minHeight: 3;
134
+ readonly maxHeight: 10;
135
+ };
136
+ /**
137
+ * Progress bar width
138
+ */
139
+ readonly progressBar: {
140
+ readonly width: 10;
141
+ };
142
+ };
143
+ /**
144
+ * Animation Timing (milliseconds)
145
+ */
146
+ export declare const Timing: {
147
+ /**
148
+ * Event batching interval for streaming
149
+ */
150
+ readonly batchInterval: 16;
151
+ /**
152
+ * Debounce delay for input
153
+ */
154
+ readonly debounce: 100;
155
+ /**
156
+ * Animation duration
157
+ */
158
+ readonly animation: 150;
159
+ };
160
+ export type Mode = keyof typeof Colors.mode;
161
+ export type Status = keyof typeof Colors.status;
162
+ export type TodoStatus = keyof typeof Indicators.todo;
163
+ export type ToolStatus = keyof typeof Indicators.tool;
164
+ /**
165
+ * Get mode color by mode name
166
+ */
167
+ export declare function getModeColor(mode: Mode): string;
168
+ /**
169
+ * Get status color by status name
170
+ */
171
+ export declare function getStatusColor(status: Status): string;
172
+ /**
173
+ * Get todo indicator by status
174
+ */
175
+ export declare function getTodoIndicator(status: TodoStatus): string;
176
+ /**
177
+ * Create a progress bar string
178
+ * @param percent - Progress percentage (0-100)
179
+ * @param width - Width in characters (default 10)
180
+ */
181
+ export declare function createProgressBar(percent: number, width?: number): string;
182
+ //# sourceMappingURL=design.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/ui/design.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;;;;;;;;IASH;;OAEG;;;;;;;IAQH;;OAEG;;;;;;;;IASH;;OAEG;;;;;CAKK,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,UAAU;IACrB;;OAEG;;;IAIH;;OAEG;;IAGH;;OAEG;;;;;;;IAQH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;;;;;;;;;;CAcK,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;;;;;;;;IASH;;OAEG;;;;;;IAOH;;OAEG;;;;;IAMH;;OAEG;;;;CAIK,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAC;AAGX,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,MAAM,CAAC,IAAI,CAAC;AAC5C,MAAM,MAAM,MAAM,GAAG,MAAM,OAAO,MAAM,CAAC,MAAM,CAAC;AAChD,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,UAAU,CAAC,IAAI,CAAC;AACtD,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,UAAU,CAAC,IAAI,CAAC;AAEtD;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAiC,GAAG,MAAM,CAMnG"}
@@ -0,0 +1,189 @@
1
+ /**
2
+ * Design Constants
3
+ * Single source of truth for colors, indicators, and visual elements
4
+ *
5
+ * Design Philosophy: Brutally Minimal
6
+ * - Function over decoration
7
+ * - Raw and honest
8
+ * - Dense and information-forward
9
+ * - High contrast
10
+ * - Monospace precision
11
+ * - No emojis
12
+ */
13
+ /**
14
+ * Color Palette
15
+ */
16
+ export const Colors = {
17
+ /**
18
+ * Mode-specific colors (used in mode indicators, input borders)
19
+ */
20
+ mode: {
21
+ AUTO: "#ffffff", // White - AI decides
22
+ AGENT: "#5cffff", // Cyan - Full execution
23
+ PLANNER: "#b48eff", // Purple - Research + docs
24
+ "PLAN-PRD": "#5c8fff", // Blue - Quick PRD
25
+ DEBUG: "#ffaa5c", // Orange - Systematic debugging
26
+ },
27
+ /**
28
+ * Status colors (used in tool results, messages)
29
+ */
30
+ status: {
31
+ success: "#6fca6f", // Green - Operation succeeded
32
+ warning: "#e6c655", // Yellow - Caution/attention
33
+ error: "#ff6b6b", // Red - Operation failed
34
+ info: "#5c8fff", // Blue - Informational
35
+ },
36
+ /**
37
+ * UI element colors
38
+ */
39
+ ui: {
40
+ primary: "#5cffff", // Cyan - Primary accent
41
+ secondary: "#666666", // Gray - Secondary/muted
42
+ text: "#ffffff", // White - Primary text
43
+ dim: "#666666", // Gray - Dimmed text
44
+ background: "#000000", // Black - Background
45
+ },
46
+ /**
47
+ * Diff colors (used in file changes)
48
+ */
49
+ diff: {
50
+ addition: "#6fca6f", // Green - Added lines
51
+ deletion: "#ff6b6b", // Red - Removed lines
52
+ },
53
+ };
54
+ /**
55
+ * ASCII Indicators (no emojis)
56
+ */
57
+ export const Indicators = {
58
+ /**
59
+ * Expand/collapse indicators
60
+ */
61
+ collapsed: "▶",
62
+ expanded: "▼",
63
+ /**
64
+ * Status dot
65
+ */
66
+ dot: "●",
67
+ /**
68
+ * Todo status indicators
69
+ */
70
+ todo: {
71
+ pending: "[ ]", // Not started
72
+ in_progress: "[>]", // Currently working
73
+ completed: "[x]", // Done
74
+ cancelled: "[-]", // No longer needed
75
+ },
76
+ /**
77
+ * Tool result indicators
78
+ */
79
+ tool: {
80
+ success: "[OK]", // Tool succeeded
81
+ error: "[FAIL]", // Tool failed
82
+ },
83
+ /**
84
+ * Progress bar characters
85
+ */
86
+ progress: {
87
+ filled: "█", // Completed portion
88
+ empty: "░", // Remaining portion
89
+ },
90
+ /**
91
+ * Separators
92
+ */
93
+ separator: {
94
+ vertical: "│",
95
+ horizontal: "─",
96
+ cross: "┼",
97
+ topLeft: "┌",
98
+ topRight: "┐",
99
+ bottomLeft: "└",
100
+ bottomRight: "┘",
101
+ teeLeft: "├",
102
+ teeRight: "┤",
103
+ teeTop: "┬",
104
+ teeBottom: "┴",
105
+ },
106
+ };
107
+ /**
108
+ * Layout Constants
109
+ */
110
+ export const Layout = {
111
+ /**
112
+ * Padding values
113
+ */
114
+ padding: {
115
+ none: 0,
116
+ xs: 1,
117
+ sm: 2,
118
+ md: 4,
119
+ lg: 8,
120
+ },
121
+ /**
122
+ * Sidebar width
123
+ */
124
+ sidebar: {
125
+ width: 40,
126
+ minWidth: 30,
127
+ maxWidth: 60,
128
+ },
129
+ /**
130
+ * Input height
131
+ */
132
+ input: {
133
+ minHeight: 3,
134
+ maxHeight: 10,
135
+ },
136
+ /**
137
+ * Progress bar width
138
+ */
139
+ progressBar: {
140
+ width: 10,
141
+ },
142
+ };
143
+ /**
144
+ * Animation Timing (milliseconds)
145
+ */
146
+ export const Timing = {
147
+ /**
148
+ * Event batching interval for streaming
149
+ */
150
+ batchInterval: 16, // ~60fps
151
+ /**
152
+ * Debounce delay for input
153
+ */
154
+ debounce: 100,
155
+ /**
156
+ * Animation duration
157
+ */
158
+ animation: 150,
159
+ };
160
+ /**
161
+ * Get mode color by mode name
162
+ */
163
+ export function getModeColor(mode) {
164
+ return Colors.mode[mode];
165
+ }
166
+ /**
167
+ * Get status color by status name
168
+ */
169
+ export function getStatusColor(status) {
170
+ return Colors.status[status];
171
+ }
172
+ /**
173
+ * Get todo indicator by status
174
+ */
175
+ export function getTodoIndicator(status) {
176
+ return Indicators.todo[status];
177
+ }
178
+ /**
179
+ * Create a progress bar string
180
+ * @param percent - Progress percentage (0-100)
181
+ * @param width - Width in characters (default 10)
182
+ */
183
+ export function createProgressBar(percent, width = Layout.progressBar.width) {
184
+ const clamped = Math.max(0, Math.min(100, percent));
185
+ const filled = Math.round((clamped / 100) * width);
186
+ const empty = width - filled;
187
+ return `[${Indicators.progress.filled.repeat(filled)}${Indicators.progress.empty.repeat(empty)}]`;
188
+ }
189
+ //# sourceMappingURL=design.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"design.js","sourceRoot":"","sources":["../../src/ui/design.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB;;OAEG;IACH,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS,EAAO,qBAAqB;QAC3C,KAAK,EAAE,SAAS,EAAM,wBAAwB;QAC9C,OAAO,EAAE,SAAS,EAAI,2BAA2B;QACjD,UAAU,EAAE,SAAS,EAAE,mBAAmB;QAC1C,KAAK,EAAE,SAAS,EAAM,gCAAgC;KACvD;IAED;;OAEG;IACH,MAAM,EAAE;QACN,OAAO,EAAE,SAAS,EAAI,8BAA8B;QACpD,OAAO,EAAE,SAAS,EAAI,6BAA6B;QACnD,KAAK,EAAE,SAAS,EAAM,yBAAyB;QAC/C,IAAI,EAAE,SAAS,EAAO,uBAAuB;KAC9C;IAED;;OAEG;IACH,EAAE,EAAE;QACF,OAAO,EAAE,SAAS,EAAI,wBAAwB;QAC9C,SAAS,EAAE,SAAS,EAAE,yBAAyB;QAC/C,IAAI,EAAE,SAAS,EAAO,uBAAuB;QAC7C,GAAG,EAAE,SAA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AAC,MAAM,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;AACpG,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { App } from "./App";
2
+ export { Colors, Indicators, Layout, Timing } from "./design";
3
+ export type { Mode, Status, TodoStatus, ToolStatus } from "./design";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAE9D,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { App } from "./App";
2
+ export { Colors, Indicators, Layout, Timing } from "./design";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ import z from "zod";
2
+ declare const ConfigSchema: z.ZodObject<{
3
+ apiKey: z.ZodString;
4
+ defaultModel: z.ZodDefault<z.ZodString>;
5
+ defaultMode: z.ZodDefault<z.ZodString>;
6
+ thinking: z.ZodDefault<z.ZodBoolean>;
7
+ }, "strip", z.ZodTypeAny, {
8
+ apiKey: string;
9
+ defaultModel: string;
10
+ defaultMode: string;
11
+ thinking: boolean;
12
+ }, {
13
+ apiKey: string;
14
+ defaultModel?: string | undefined;
15
+ defaultMode?: string | undefined;
16
+ thinking?: boolean | undefined;
17
+ }>;
18
+ type Config = z.infer<typeof ConfigSchema>;
19
+ export declare function load(): Promise<Config>;
20
+ export declare function save(config: Config): Promise<void>;
21
+ export type { Config };
22
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/util/config.ts"],"names":[],"mappings":"AAGA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;EAKhB,CAAC;AAEH,KAAK,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAqC3C,wBAAsB,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAU5C;AAED,wBAAsB,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIxD;AAED,YAAY,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { Global } from "../global";
2
+ import fs from "fs/promises";
3
+ import path from "path";
4
+ import z from "zod";
5
+ const ConfigSchema = z.object({
6
+ apiKey: z.string().describe("Z.AI API key for authentication"),
7
+ defaultModel: z.string().default("glm-4.7").describe("Default GLM model to use"),
8
+ defaultMode: z.string().default("AUTO").describe("Default mode: AUTO, AGENT, PLANNER, PLAN-PRD, DEBUG"),
9
+ thinking: z.boolean().default(true).describe("Enable thinking mode"),
10
+ });
11
+ const configPath = path.join(Global.Path.config, "config.json");
12
+ async function loadConfigFile() {
13
+ try {
14
+ const content = await fs.readFile(configPath, "utf-8");
15
+ return JSON.parse(content);
16
+ }
17
+ catch (e) {
18
+ if (e.code !== "ENOENT") {
19
+ throw e;
20
+ }
21
+ return {};
22
+ }
23
+ }
24
+ async function loadEnvVars() {
25
+ const env = {};
26
+ if (process.env["GLM_API_KEY"]) {
27
+ env.apiKey = process.env["GLM_API_KEY"];
28
+ }
29
+ return env;
30
+ }
31
+ function applyDefaults(config) {
32
+ return ConfigSchema.parse({
33
+ apiKey: config.apiKey,
34
+ defaultModel: config.defaultModel,
35
+ defaultMode: config.defaultMode,
36
+ thinking: config.thinking,
37
+ });
38
+ }
39
+ let cachedConfig = null;
40
+ export async function load() {
41
+ if (cachedConfig !== null) {
42
+ return cachedConfig;
43
+ }
44
+ const fileConfig = await loadConfigFile();
45
+ const envConfig = await loadEnvVars();
46
+ const merged = { ...fileConfig, ...envConfig };
47
+ cachedConfig = applyDefaults(merged);
48
+ return cachedConfig;
49
+ }
50
+ export async function save(config) {
51
+ await fs.mkdir(Global.Path.config, { recursive: true });
52
+ await fs.writeFile(configPath, JSON.stringify(config, null, 2), "utf-8");
53
+ cachedConfig = config;
54
+ }
55
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/util/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,MAAM,aAAa,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC9D,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAChF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,qDAAqD,CAAC;IACvG,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;CACrE,CAAC,CAAC;AAIH,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAA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C,CAAC;IACrC,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,MAAc;IACvC,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,MAAM,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IACzE,YAAY,GAAG,MAAM,CAAC;AACxB,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Instruction File Discovery
3
+ * Finds and loads project instruction files in priority order
4
+ */
5
+ declare const INSTRUCTION_FILES: readonly [".glm-cli/instructions.md", "AGENTS.md", "CLAUDE.md", "GEMINI.md", "QWEN.md", "KIMI.md", "COPILOT.md", ".cursorrules", ".windsurfrules"];
6
+ export type InstructionFileName = typeof INSTRUCTION_FILES[number];
7
+ export interface InstructionFile {
8
+ path: string;
9
+ name: InstructionFileName;
10
+ content: string;
11
+ }
12
+ /**
13
+ * Find the first instruction file in priority order
14
+ * @param dir - Directory to search in (defaults to cwd)
15
+ * @returns Path to found file, or null if none found
16
+ */
17
+ export declare function findInstructions(dir?: string): Promise<string | null>;
18
+ /**
19
+ * Load instruction file from a directory
20
+ * Results are cached per directory for the session
21
+ * @param dir - Directory to search in (defaults to cwd)
22
+ * @returns InstructionFile or null if none found
23
+ */
24
+ export declare function loadInstructions(dir?: string): Promise<InstructionFile | null>;
25
+ /**
26
+ * Clear the instruction cache
27
+ * Useful for testing or when files may have changed
28
+ */
29
+ export declare function clearInstructionCache(): void;
30
+ /**
31
+ * Clear cache for a specific directory
32
+ */
33
+ export declare function clearInstructionCacheFor(dir: string): void;
34
+ /**
35
+ * Get all supported instruction file names
36
+ */
37
+ export declare function getInstructionFileNames(): readonly string[];
38
+ export {};
39
+ //# sourceMappingURL=instructions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../../src/util/instructions.ts"],"names":[],"mappings":"AAGA;;;GAGG;AAGH,QAAA,MAAM,iBAAiB,oJAUb,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAEnE,MAAM,WAAW,eAAe;IAE9B,IAAI,EAAE,MAAM,CAAC;IAEb,IAAI,EAAE,mBAAmB,CAAC;IAE1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAiBD;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWxB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,GAAG,GAAE,MAAsB,GAC1B,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA2BjC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAG1D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAE3D"}
@@ -0,0 +1,96 @@
1
+ import fs from "fs/promises";
2
+ import path from "path";
3
+ /**
4
+ * Instruction File Discovery
5
+ * Finds and loads project instruction files in priority order
6
+ */
7
+ // Priority order for instruction files (first found wins)
8
+ const INSTRUCTION_FILES = [
9
+ ".glm-cli/instructions.md",
10
+ "AGENTS.md",
11
+ "CLAUDE.md",
12
+ "GEMINI.md",
13
+ "QWEN.md",
14
+ "KIMI.md",
15
+ "COPILOT.md",
16
+ ".cursorrules",
17
+ ".windsurfrules",
18
+ ];
19
+ // Cache for loaded instructions (per directory)
20
+ const cache = new Map();
21
+ /**
22
+ * Check if a file exists
23
+ */
24
+ async function fileExists(filePath) {
25
+ try {
26
+ await fs.access(filePath);
27
+ return true;
28
+ }
29
+ catch {
30
+ return false;
31
+ }
32
+ }
33
+ /**
34
+ * Find the first instruction file in priority order
35
+ * @param dir - Directory to search in (defaults to cwd)
36
+ * @returns Path to found file, or null if none found
37
+ */
38
+ export async function findInstructions(dir = process.cwd()) {
39
+ const absoluteDir = path.resolve(dir);
40
+ for (const filename of INSTRUCTION_FILES) {
41
+ const filePath = path.join(absoluteDir, filename);
42
+ if (await fileExists(filePath)) {
43
+ return filePath;
44
+ }
45
+ }
46
+ return null;
47
+ }
48
+ /**
49
+ * Load instruction file from a directory
50
+ * Results are cached per directory for the session
51
+ * @param dir - Directory to search in (defaults to cwd)
52
+ * @returns InstructionFile or null if none found
53
+ */
54
+ export async function loadInstructions(dir = process.cwd()) {
55
+ const absoluteDir = path.resolve(dir);
56
+ // Check cache first
57
+ if (cache.has(absoluteDir)) {
58
+ return cache.get(absoluteDir) ?? null;
59
+ }
60
+ // Find and load
61
+ const filePath = await findInstructions(absoluteDir);
62
+ if (!filePath) {
63
+ cache.set(absoluteDir, null);
64
+ return null;
65
+ }
66
+ const content = await fs.readFile(filePath, "utf-8");
67
+ const name = path.relative(absoluteDir, filePath);
68
+ const result = {
69
+ path: filePath,
70
+ name,
71
+ content,
72
+ };
73
+ cache.set(absoluteDir, result);
74
+ return result;
75
+ }
76
+ /**
77
+ * Clear the instruction cache
78
+ * Useful for testing or when files may have changed
79
+ */
80
+ export function clearInstructionCache() {
81
+ cache.clear();
82
+ }
83
+ /**
84
+ * Clear cache for a specific directory
85
+ */
86
+ export function clearInstructionCacheFor(dir) {
87
+ const absoluteDir = path.resolve(dir);
88
+ cache.delete(absoluteDir);
89
+ }
90
+ /**
91
+ * Get all supported instruction file names
92
+ */
93
+ export function getInstructionFileNames() {
94
+ return INSTRUCTION_FILES;
95
+ }
96
+ //# sourceMappingURL=instructions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../../src/util/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,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I,CAAC;IACxC,CAAC;IAED,gBAAgB;IAChB,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAErD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;QAC7B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAwB,CAAC;IAEzE,MAAM,MAAM,GAAoB;QAC9B,IAAI,EAAE,QAAQ;QACd,IAAI;QACJ,OAAO;KACR,CAAC;IAEF,KAAK,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB;IACnC,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,iBAAiB,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,18 @@
1
+ interface Disposable {
2
+ [Symbol.dispose](): void;
3
+ }
4
+ interface AsyncDisposable extends Disposable {
5
+ [Symbol.asyncDispose](): Promise<void>;
6
+ }
7
+ declare class LockImpl implements AsyncDisposable {
8
+ private readonly lockFile;
9
+ constructor(lockFile: string);
10
+ [Symbol.dispose](): void;
11
+ [Symbol.asyncDispose](): Promise<void>;
12
+ }
13
+ export declare namespace Lock {
14
+ const read: (target: string) => Promise<LockImpl>;
15
+ const write: (target: string) => Promise<LockImpl>;
16
+ }
17
+ export {};
18
+ //# sourceMappingURL=lock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../src/util/lock.ts"],"names":[],"mappings":"AAKA,UAAU,UAAU;IAClB,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B;AAED,UAAU,eAAgB,SAAQ,UAAU;IAC1C,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAOD,cAAM,QAAS,YAAW,eAAe;IACvC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,QAAQ,EAAE,MAAM;IAI5B,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;IAQlB,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;CAS7C;AAED,yBAAiB,IAAI,CAAC;IAuBb,MAAM,IAAI,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,QAAQ,CAI3D,CAAC;IAEK,MAAM,KAAK,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC,QAAQ,CAI5D,CAAC;CACH"}