@kenkaiiii/ggcoder 0.0.1

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 (263) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +220 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/config.d.ts +13 -0
  6. package/dist/config.d.ts.map +1 -0
  7. package/dist/config.js +25 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/core/agent-session.d.ts +63 -0
  10. package/dist/core/agent-session.d.ts.map +1 -0
  11. package/dist/core/agent-session.js +269 -0
  12. package/dist/core/agent-session.js.map +1 -0
  13. package/dist/core/auth-storage.d.ts +29 -0
  14. package/dist/core/auth-storage.d.ts.map +1 -0
  15. package/dist/core/auth-storage.js +89 -0
  16. package/dist/core/auth-storage.js.map +1 -0
  17. package/dist/core/compaction/compactor.d.ts +26 -0
  18. package/dist/core/compaction/compactor.d.ts.map +1 -0
  19. package/dist/core/compaction/compactor.js +87 -0
  20. package/dist/core/compaction/compactor.js.map +1 -0
  21. package/dist/core/compaction/token-estimator.d.ts +5 -0
  22. package/dist/core/compaction/token-estimator.d.ts.map +1 -0
  23. package/dist/core/compaction/token-estimator.js +36 -0
  24. package/dist/core/compaction/token-estimator.js.map +1 -0
  25. package/dist/core/event-bus.d.ts +71 -0
  26. package/dist/core/event-bus.d.ts.map +1 -0
  27. package/dist/core/event-bus.js +72 -0
  28. package/dist/core/event-bus.js.map +1 -0
  29. package/dist/core/extensions/loader.d.ts +8 -0
  30. package/dist/core/extensions/loader.d.ts.map +1 -0
  31. package/dist/core/extensions/loader.js +48 -0
  32. package/dist/core/extensions/loader.js.map +1 -0
  33. package/dist/core/extensions/types.d.ts +19 -0
  34. package/dist/core/extensions/types.d.ts.map +1 -0
  35. package/dist/core/extensions/types.js +2 -0
  36. package/dist/core/extensions/types.js.map +1 -0
  37. package/dist/core/index.d.ts +13 -0
  38. package/dist/core/index.d.ts.map +1 -0
  39. package/dist/core/index.js +12 -0
  40. package/dist/core/index.js.map +1 -0
  41. package/dist/core/model-registry.d.ts +17 -0
  42. package/dist/core/model-registry.d.ts.map +1 -0
  43. package/dist/core/model-registry.js +86 -0
  44. package/dist/core/model-registry.js.map +1 -0
  45. package/dist/core/oauth/anthropic.d.ts +4 -0
  46. package/dist/core/oauth/anthropic.d.ts.map +1 -0
  47. package/dist/core/oauth/anthropic.js +73 -0
  48. package/dist/core/oauth/anthropic.js.map +1 -0
  49. package/dist/core/oauth/openai.d.ts +4 -0
  50. package/dist/core/oauth/openai.d.ts.map +1 -0
  51. package/dist/core/oauth/openai.js +186 -0
  52. package/dist/core/oauth/openai.js.map +1 -0
  53. package/dist/core/oauth/pkce.d.ts +5 -0
  54. package/dist/core/oauth/pkce.d.ts.map +1 -0
  55. package/dist/core/oauth/pkce.js +17 -0
  56. package/dist/core/oauth/pkce.js.map +1 -0
  57. package/dist/core/oauth/types.d.ts +12 -0
  58. package/dist/core/oauth/types.d.ts.map +1 -0
  59. package/dist/core/oauth/types.js +2 -0
  60. package/dist/core/oauth/types.js.map +1 -0
  61. package/dist/core/session-manager.d.ts +74 -0
  62. package/dist/core/session-manager.d.ts.map +1 -0
  63. package/dist/core/session-manager.js +166 -0
  64. package/dist/core/session-manager.js.map +1 -0
  65. package/dist/core/settings-manager.d.ts +38 -0
  66. package/dist/core/settings-manager.d.ts.map +1 -0
  67. package/dist/core/settings-manager.js +62 -0
  68. package/dist/core/settings-manager.js.map +1 -0
  69. package/dist/core/skills.d.ts +23 -0
  70. package/dist/core/skills.d.ts.map +1 -0
  71. package/dist/core/skills.js +89 -0
  72. package/dist/core/skills.js.map +1 -0
  73. package/dist/core/slash-commands.d.ts +31 -0
  74. package/dist/core/slash-commands.d.ts.map +1 -0
  75. package/dist/core/slash-commands.js +161 -0
  76. package/dist/core/slash-commands.js.map +1 -0
  77. package/dist/index.d.ts +11 -0
  78. package/dist/index.d.ts.map +1 -0
  79. package/dist/index.js +17 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/interactive.d.ts +3 -0
  82. package/dist/interactive.d.ts.map +1 -0
  83. package/dist/interactive.js +153 -0
  84. package/dist/interactive.js.map +1 -0
  85. package/dist/modes/index.d.ts +2 -0
  86. package/dist/modes/index.d.ts.map +1 -0
  87. package/dist/modes/index.js +2 -0
  88. package/dist/modes/index.js.map +1 -0
  89. package/dist/modes/print-mode.d.ts +12 -0
  90. package/dist/modes/print-mode.d.ts.map +1 -0
  91. package/dist/modes/print-mode.js +42 -0
  92. package/dist/modes/print-mode.js.map +1 -0
  93. package/dist/session.d.ts +16 -0
  94. package/dist/session.d.ts.map +1 -0
  95. package/dist/session.js +122 -0
  96. package/dist/session.js.map +1 -0
  97. package/dist/system-prompt.d.ts +6 -0
  98. package/dist/system-prompt.d.ts.map +1 -0
  99. package/dist/system-prompt.js +70 -0
  100. package/dist/system-prompt.js.map +1 -0
  101. package/dist/tools/bash.d.ts +9 -0
  102. package/dist/tools/bash.d.ts.map +1 -0
  103. package/dist/tools/bash.js +81 -0
  104. package/dist/tools/bash.js.map +1 -0
  105. package/dist/tools/edit-diff.d.ts +18 -0
  106. package/dist/tools/edit-diff.d.ts.map +1 -0
  107. package/dist/tools/edit-diff.js +92 -0
  108. package/dist/tools/edit-diff.js.map +1 -0
  109. package/dist/tools/edit.d.ts +10 -0
  110. package/dist/tools/edit.d.ts.map +1 -0
  111. package/dist/tools/edit.js +53 -0
  112. package/dist/tools/edit.js.map +1 -0
  113. package/dist/tools/find.d.ts +9 -0
  114. package/dist/tools/find.d.ts.map +1 -0
  115. package/dist/tools/find.js +59 -0
  116. package/dist/tools/find.js.map +1 -0
  117. package/dist/tools/grep.d.ts +12 -0
  118. package/dist/tools/grep.d.ts.map +1 -0
  119. package/dist/tools/grep.js +107 -0
  120. package/dist/tools/grep.js.map +1 -0
  121. package/dist/tools/index.d.ts +10 -0
  122. package/dist/tools/index.d.ts.map +1 -0
  123. package/dist/tools/index.js +26 -0
  124. package/dist/tools/index.js.map +1 -0
  125. package/dist/tools/ls.d.ts +9 -0
  126. package/dist/tools/ls.d.ts.map +1 -0
  127. package/dist/tools/ls.js +56 -0
  128. package/dist/tools/ls.js.map +1 -0
  129. package/dist/tools/path-utils.d.ts +2 -0
  130. package/dist/tools/path-utils.d.ts.map +1 -0
  131. package/dist/tools/path-utils.js +9 -0
  132. package/dist/tools/path-utils.js.map +1 -0
  133. package/dist/tools/read.d.ts +11 -0
  134. package/dist/tools/read.d.ts.map +1 -0
  135. package/dist/tools/read.js +98 -0
  136. package/dist/tools/read.js.map +1 -0
  137. package/dist/tools/truncate.d.ts +19 -0
  138. package/dist/tools/truncate.d.ts.map +1 -0
  139. package/dist/tools/truncate.js +59 -0
  140. package/dist/tools/truncate.js.map +1 -0
  141. package/dist/tools/write.d.ts +9 -0
  142. package/dist/tools/write.d.ts.map +1 -0
  143. package/dist/tools/write.js +23 -0
  144. package/dist/tools/write.js.map +1 -0
  145. package/dist/types.d.ts +36 -0
  146. package/dist/types.d.ts.map +1 -0
  147. package/dist/types.js +2 -0
  148. package/dist/types.js.map +1 -0
  149. package/dist/ui/App.d.ts +19 -0
  150. package/dist/ui/App.d.ts.map +1 -0
  151. package/dist/ui/App.js +209 -0
  152. package/dist/ui/App.js.map +1 -0
  153. package/dist/ui/components/AssistantMessage.d.ts +8 -0
  154. package/dist/ui/components/AssistantMessage.d.ts.map +1 -0
  155. package/dist/ui/components/AssistantMessage.js +10 -0
  156. package/dist/ui/components/AssistantMessage.js.map +1 -0
  157. package/dist/ui/components/DiffView.d.ts +4 -0
  158. package/dist/ui/components/DiffView.d.ts.map +1 -0
  159. package/dist/ui/components/DiffView.js +20 -0
  160. package/dist/ui/components/DiffView.js.map +1 -0
  161. package/dist/ui/components/Footer.d.ts +9 -0
  162. package/dist/ui/components/Footer.d.ts.map +1 -0
  163. package/dist/ui/components/Footer.js +79 -0
  164. package/dist/ui/components/Footer.js.map +1 -0
  165. package/dist/ui/components/InputArea.d.ts +8 -0
  166. package/dist/ui/components/InputArea.d.ts.map +1 -0
  167. package/dist/ui/components/InputArea.js +143 -0
  168. package/dist/ui/components/InputArea.js.map +1 -0
  169. package/dist/ui/components/Markdown.d.ts +7 -0
  170. package/dist/ui/components/Markdown.d.ts.map +1 -0
  171. package/dist/ui/components/Markdown.js +215 -0
  172. package/dist/ui/components/Markdown.js.map +1 -0
  173. package/dist/ui/components/ModelSelector.d.ts +7 -0
  174. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  175. package/dist/ui/components/ModelSelector.js +14 -0
  176. package/dist/ui/components/ModelSelector.js.map +1 -0
  177. package/dist/ui/components/Overlay.d.ts +8 -0
  178. package/dist/ui/components/Overlay.d.ts.map +1 -0
  179. package/dist/ui/components/Overlay.js +9 -0
  180. package/dist/ui/components/Overlay.js.map +1 -0
  181. package/dist/ui/components/SelectList.d.ts +13 -0
  182. package/dist/ui/components/SelectList.d.ts.map +1 -0
  183. package/dist/ui/components/SelectList.js +46 -0
  184. package/dist/ui/components/SelectList.js.map +1 -0
  185. package/dist/ui/components/SessionSelector.d.ts +9 -0
  186. package/dist/ui/components/SessionSelector.d.ts.map +1 -0
  187. package/dist/ui/components/SessionSelector.js +13 -0
  188. package/dist/ui/components/SessionSelector.js.map +1 -0
  189. package/dist/ui/components/SettingsSelector.d.ts +9 -0
  190. package/dist/ui/components/SettingsSelector.d.ts.map +1 -0
  191. package/dist/ui/components/SettingsSelector.js +13 -0
  192. package/dist/ui/components/SettingsSelector.js.map +1 -0
  193. package/dist/ui/components/Spinner.d.ts +4 -0
  194. package/dist/ui/components/Spinner.d.ts.map +1 -0
  195. package/dist/ui/components/Spinner.js +17 -0
  196. package/dist/ui/components/Spinner.js.map +1 -0
  197. package/dist/ui/components/StreamingArea.d.ts +12 -0
  198. package/dist/ui/components/StreamingArea.d.ts.map +1 -0
  199. package/dist/ui/components/StreamingArea.js +47 -0
  200. package/dist/ui/components/StreamingArea.js.map +1 -0
  201. package/dist/ui/components/ThinkingIndicator.d.ts +6 -0
  202. package/dist/ui/components/ThinkingIndicator.d.ts.map +1 -0
  203. package/dist/ui/components/ThinkingIndicator.js +171 -0
  204. package/dist/ui/components/ThinkingIndicator.js.map +1 -0
  205. package/dist/ui/components/ToolExecution.d.ts +16 -0
  206. package/dist/ui/components/ToolExecution.d.ts.map +1 -0
  207. package/dist/ui/components/ToolExecution.js +262 -0
  208. package/dist/ui/components/ToolExecution.js.map +1 -0
  209. package/dist/ui/components/UserMessage.d.ts +4 -0
  210. package/dist/ui/components/UserMessage.d.ts.map +1 -0
  211. package/dist/ui/components/UserMessage.js +9 -0
  212. package/dist/ui/components/UserMessage.js.map +1 -0
  213. package/dist/ui/components/index.d.ts +14 -0
  214. package/dist/ui/components/index.d.ts.map +1 -0
  215. package/dist/ui/components/index.js +14 -0
  216. package/dist/ui/components/index.js.map +1 -0
  217. package/dist/ui/hooks/useAgentLoop.d.ts +40 -0
  218. package/dist/ui/hooks/useAgentLoop.d.ts.map +1 -0
  219. package/dist/ui/hooks/useAgentLoop.js +195 -0
  220. package/dist/ui/hooks/useAgentLoop.js.map +1 -0
  221. package/dist/ui/hooks/useSessionManager.d.ts +13 -0
  222. package/dist/ui/hooks/useSessionManager.d.ts.map +1 -0
  223. package/dist/ui/hooks/useSessionManager.js +43 -0
  224. package/dist/ui/hooks/useSessionManager.js.map +1 -0
  225. package/dist/ui/hooks/useSlashCommands.d.ts +7 -0
  226. package/dist/ui/hooks/useSlashCommands.d.ts.map +1 -0
  227. package/dist/ui/hooks/useSlashCommands.js +11 -0
  228. package/dist/ui/hooks/useSlashCommands.js.map +1 -0
  229. package/dist/ui/render.d.ts +20 -0
  230. package/dist/ui/render.d.ts.map +1 -0
  231. package/dist/ui/render.js +24 -0
  232. package/dist/ui/render.js.map +1 -0
  233. package/dist/ui/theme/dark.json +23 -0
  234. package/dist/ui/theme/light.json +23 -0
  235. package/dist/ui/theme/theme.d.ts +28 -0
  236. package/dist/ui/theme/theme.d.ts.map +1 -0
  237. package/dist/ui/theme/theme.js +11 -0
  238. package/dist/ui/theme/theme.js.map +1 -0
  239. package/dist/utils/error-handler.d.ts +5 -0
  240. package/dist/utils/error-handler.d.ts.map +1 -0
  241. package/dist/utils/error-handler.js +97 -0
  242. package/dist/utils/error-handler.js.map +1 -0
  243. package/dist/utils/format.d.ts +21 -0
  244. package/dist/utils/format.d.ts.map +1 -0
  245. package/dist/utils/format.js +120 -0
  246. package/dist/utils/format.js.map +1 -0
  247. package/dist/utils/git.d.ts +2 -0
  248. package/dist/utils/git.d.ts.map +1 -0
  249. package/dist/utils/git.js +13 -0
  250. package/dist/utils/git.js.map +1 -0
  251. package/dist/utils/markdown.d.ts +6 -0
  252. package/dist/utils/markdown.d.ts.map +1 -0
  253. package/dist/utils/markdown.js +25 -0
  254. package/dist/utils/markdown.js.map +1 -0
  255. package/dist/utils/process.d.ts +6 -0
  256. package/dist/utils/process.d.ts.map +1 -0
  257. package/dist/utils/process.js +19 -0
  258. package/dist/utils/process.js.map +1 -0
  259. package/dist/utils/shell.d.ts +3 -0
  260. package/dist/utils/shell.d.ts.map +1 -0
  261. package/dist/utils/shell.js +8 -0
  262. package/dist/utils/shell.js.map +1 -0
  263. package/package.json +51 -0
@@ -0,0 +1,98 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { z } from "zod";
4
+ import { resolvePath } from "./path-utils.js";
5
+ import { truncateHead } from "./truncate.js";
6
+ export const BINARY_EXTENSIONS = new Set([
7
+ ".png",
8
+ ".jpg",
9
+ ".jpeg",
10
+ ".gif",
11
+ ".bmp",
12
+ ".ico",
13
+ ".webp",
14
+ ".svg",
15
+ ".mp3",
16
+ ".mp4",
17
+ ".wav",
18
+ ".avi",
19
+ ".mov",
20
+ ".mkv",
21
+ ".flac",
22
+ ".zip",
23
+ ".tar",
24
+ ".gz",
25
+ ".bz2",
26
+ ".7z",
27
+ ".rar",
28
+ ".pdf",
29
+ ".doc",
30
+ ".docx",
31
+ ".xls",
32
+ ".xlsx",
33
+ ".ppt",
34
+ ".pptx",
35
+ ".exe",
36
+ ".dll",
37
+ ".so",
38
+ ".dylib",
39
+ ".bin",
40
+ ".dat",
41
+ ".woff",
42
+ ".woff2",
43
+ ".ttf",
44
+ ".eot",
45
+ ".otf",
46
+ ".pyc",
47
+ ".class",
48
+ ".o",
49
+ ".obj",
50
+ ]);
51
+ const ReadParams = z.object({
52
+ file_path: z.string().describe("The file path to read"),
53
+ offset: z
54
+ .number()
55
+ .int()
56
+ .min(1)
57
+ .optional()
58
+ .describe("Line number to start reading from (1-based)"),
59
+ limit: z.number().int().min(1).optional().describe("Maximum number of lines to read"),
60
+ });
61
+ export function createReadTool(cwd) {
62
+ return {
63
+ name: "read",
64
+ description: "Read a file's contents. Returns numbered lines (cat -n style). " +
65
+ "Use offset/limit for large files. Binary files return a notice instead of content.",
66
+ parameters: ReadParams,
67
+ async execute({ file_path, offset, limit }) {
68
+ const resolved = resolvePath(cwd, file_path);
69
+ const ext = path.extname(resolved).toLowerCase();
70
+ if (BINARY_EXTENSIONS.has(ext)) {
71
+ const stat = await fs.stat(resolved);
72
+ return `Binary file: ${resolved} (${ext}, ${stat.size} bytes)`;
73
+ }
74
+ const raw = await fs.readFile(resolved, "utf-8");
75
+ let lines = raw.split("\n");
76
+ // Apply offset/limit
77
+ const startLine = offset ? offset - 1 : 0;
78
+ const endLine = limit ? startLine + limit : lines.length;
79
+ lines = lines.slice(startLine, endLine);
80
+ const content = lines.join("\n");
81
+ const result = truncateHead(content);
82
+ // Prepend line numbers (cat -n style)
83
+ const actualStart = startLine + 1;
84
+ const numbered = result.content
85
+ .split("\n")
86
+ .map((line, i) => {
87
+ const lineNum = String(actualStart + i).padStart(6, " ");
88
+ return `${lineNum}\t${line}`;
89
+ })
90
+ .join("\n");
91
+ if (result.truncated) {
92
+ return `${numbered}\n[Truncated: showing ${result.keptLines} of ${result.totalLines} lines]`;
93
+ }
94
+ return numbered;
95
+ },
96
+ };
97
+ }
98
+ //# sourceMappingURL=read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IACvC,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,IAAI;IACJ,MAAM;CACP,CAAC,CAAC;AAEH,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACvD,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAA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AM,WAAW,GAAG,SAAS,GAAG,CAAC,CAAC;YAClC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO;iBAC5B,KAAK,CAAC,IAAI,CAAC;iBACX,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBACf,MAAM,OAAO,GAAG,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;gBACzD,OAAO,GAAG,OAAO,KAAK,IAAI,EAAE,CAAC;YAC/B,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,IAAI,MAAM,CAAC,SAAS,EAAE,CAAC;gBACrB,OAAO,GAAG,QAAQ,yBAAyB,MAAM,CAAC,SAAS,OAAO,MAAM,CAAC,UAAU,SAAS,CAAC;YAC/F,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare const MAX_LINES = 2000;
2
+ export declare const MAX_BYTES: number;
3
+ export interface TruncateResult {
4
+ content: string;
5
+ truncated: boolean;
6
+ totalLines: number;
7
+ keptLines: number;
8
+ }
9
+ /**
10
+ * Truncate from the end — keep the first N lines.
11
+ * Used by the read tool.
12
+ */
13
+ export declare function truncateHead(content: string, maxLines?: number, maxBytes?: number): TruncateResult;
14
+ /**
15
+ * Truncate from the beginning — keep the last N lines.
16
+ * Used by the bash tool.
17
+ */
18
+ export declare function truncateTail(content: string, maxLines?: number, maxBytes?: number): TruncateResult;
19
+ //# sourceMappingURL=truncate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../src/tools/truncate.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,OAAO,CAAC;AAC9B,eAAO,MAAM,SAAS,QAAY,CAAC;AAEnC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,QAAQ,SAAY,EACpB,QAAQ,SAAY,GACnB,cAAc,CA0BhB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,EACf,QAAQ,SAAY,EACpB,QAAQ,SAAY,GACnB,cAAc,CA0BhB"}
@@ -0,0 +1,59 @@
1
+ export const MAX_LINES = 2000;
2
+ export const MAX_BYTES = 50 * 1024; // 50KB
3
+ /**
4
+ * Truncate from the end — keep the first N lines.
5
+ * Used by the read tool.
6
+ */
7
+ export function truncateHead(content, maxLines = MAX_LINES, maxBytes = MAX_BYTES) {
8
+ const lines = content.split("\n");
9
+ const totalLines = lines.length;
10
+ // Limit by line count
11
+ let kept = lines.slice(0, maxLines);
12
+ // Limit by byte size
13
+ let size = 0;
14
+ let cutIndex = kept.length;
15
+ for (let i = 0; i < kept.length; i++) {
16
+ size += Buffer.byteLength(kept[i], "utf-8") + 1; // +1 for newline
17
+ if (size > maxBytes) {
18
+ cutIndex = i;
19
+ break;
20
+ }
21
+ }
22
+ kept = kept.slice(0, cutIndex);
23
+ const truncated = kept.length < totalLines;
24
+ return {
25
+ content: kept.join("\n"),
26
+ truncated,
27
+ totalLines,
28
+ keptLines: kept.length,
29
+ };
30
+ }
31
+ /**
32
+ * Truncate from the beginning — keep the last N lines.
33
+ * Used by the bash tool.
34
+ */
35
+ export function truncateTail(content, maxLines = MAX_LINES, maxBytes = MAX_BYTES) {
36
+ const lines = content.split("\n");
37
+ const totalLines = lines.length;
38
+ // Limit by line count — keep last N
39
+ let kept = lines.slice(-maxLines);
40
+ // Limit by byte size — keep last N bytes
41
+ let size = 0;
42
+ let cutIndex = 0;
43
+ for (let i = kept.length - 1; i >= 0; i--) {
44
+ size += Buffer.byteLength(kept[i], "utf-8") + 1;
45
+ if (size > maxBytes) {
46
+ cutIndex = i + 1;
47
+ break;
48
+ }
49
+ }
50
+ kept = kept.slice(cutIndex);
51
+ const truncated = kept.length < totalLines;
52
+ return {
53
+ content: kept.join("\n"),
54
+ truncated,
55
+ totalLines,
56
+ keptLines: kept.length,
57
+ };
58
+ }
59
+ //# sourceMappingURL=truncate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../src/tools/truncate.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC;AAC9B,MAAM,CAAC,MAAM,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO;AAS3C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAe,EACf,QAAQ,GAAG,SAAS,EACpB,QAAQ,GAAG,SAAS;IAEpB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC;IAEhC,sBAAsB;IACtB,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;IAEpC,qBAAqB;IACrB,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,QAAQ,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,iBAAiB;QAClE,IAAI,IAAI,GAAG,QAAQ,EAAE,CAAC;YACpB,QAAQ,GAAG,CAAC,CAAC;YACb,MAAM;QACR,CAAC;IACH,CAAC;IACD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CA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1
+ import { z } from "zod";
2
+ import type { AgentTool } from "@kenkaiiii/gg-agent";
3
+ declare const WriteParams: z.ZodObject<{
4
+ file_path: z.ZodString;
5
+ content: z.ZodString;
6
+ }, z.core.$strip>;
7
+ export declare function createWriteTool(cwd: string): AgentTool<typeof WriteParams>;
8
+ export {};
9
+ //# sourceMappingURL=write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAGrD,QAAA,MAAM,WAAW;;;iBAGf,CAAC;AAEH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,OAAO,WAAW,CAAC,CAc1E"}
@@ -0,0 +1,23 @@
1
+ import fs from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { z } from "zod";
4
+ import { resolvePath } from "./path-utils.js";
5
+ const WriteParams = z.object({
6
+ file_path: z.string().describe("The file path to write to"),
7
+ content: z.string().describe("The content to write"),
8
+ });
9
+ export function createWriteTool(cwd) {
10
+ return {
11
+ name: "write",
12
+ description: "Write content to a file. Creates parent directories if needed. Use for new files or complete rewrites.",
13
+ parameters: WriteParams,
14
+ async execute({ file_path, content }) {
15
+ const resolved = resolvePath(cwd, file_path);
16
+ await fs.mkdir(path.dirname(resolved), { recursive: true });
17
+ await fs.writeFile(resolved, content, "utf-8");
18
+ const bytes = Buffer.byteLength(content, "utf-8");
19
+ return `Wrote ${bytes} bytes to ${resolved}`;
20
+ },
21
+ };
22
+ }
23
+ //# sourceMappingURL=write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"write.js","sourceRoot":"","sources":["../../src/tools/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IAC3D,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;CACrD,CAAC,CAAC;AAEH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO;QACL,IAAI,EAAE,OAAO;QACb,WAAW,EACT,wGAAwG;QAC1G,UAAU,EAAE,WAAW;QACvB,KAAK,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE;YAClC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC7C,MAAM,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;YAC5D,MAAM,EAAE,CAAC,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;YAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAClD,OAAO,SAAS,KAAK,aAAa,QAAQ,EAAE,CAAC;QAC/C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type { Message, Provider, ThinkingLevel } from "@kenkaiiii/gg-ai";
2
+ export interface CliConfig {
3
+ provider: Provider;
4
+ model: string;
5
+ baseUrl?: string;
6
+ cwd: string;
7
+ sessionId?: string;
8
+ continueRecent?: boolean;
9
+ systemPrompt?: string;
10
+ thinkingLevel?: ThinkingLevel;
11
+ printMessage?: string;
12
+ outputFormat?: "text" | "json";
13
+ }
14
+ export interface SessionHeader {
15
+ type: "session";
16
+ version: 1;
17
+ id: string;
18
+ timestamp: string;
19
+ cwd: string;
20
+ provider: Provider;
21
+ model: string;
22
+ }
23
+ export interface SessionMessageEntry {
24
+ type: "message";
25
+ timestamp: string;
26
+ message: Message;
27
+ }
28
+ export type SessionEntry = SessionHeader | SessionMessageEntry;
29
+ export interface SessionInfo {
30
+ id: string;
31
+ path: string;
32
+ timestamp: string;
33
+ cwd: string;
34
+ messageCount: number;
35
+ }
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIzE,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChC;AAID,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,CAAC,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,aAAa,GAAG,mBAAmB,CAAC;AAE/D,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import type { Message, Provider, ThinkingLevel } from "@kenkaiiii/gg-ai";
2
+ import type { AgentTool } from "@kenkaiiii/gg-agent";
3
+ export interface AppProps {
4
+ provider: Provider;
5
+ model: string;
6
+ tools: AgentTool[];
7
+ messages: Message[];
8
+ maxTokens: number;
9
+ thinking?: ThinkingLevel;
10
+ apiKey?: string;
11
+ baseUrl?: string;
12
+ accountId?: string;
13
+ cwd: string;
14
+ showThinking?: boolean;
15
+ showTokenUsage?: boolean;
16
+ onSlashCommand?: (input: string) => Promise<string | null>;
17
+ }
18
+ export declare function App(props: AppProps): import("react/jsx-runtime").JSX.Element;
19
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../src/ui/App.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AA6GrD,MAAM,WAAW,QAAQ;IACvB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAC5D;AAID,wBAAgB,GAAG,CAAC,KAAK,EAAE,QAAQ,2CAiPlC"}
package/dist/ui/App.js ADDED
@@ -0,0 +1,209 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState, useRef, useCallback, useEffect } from "react";
3
+ import { Box, Text, Static, useStdout } from "ink";
4
+ import { useAgentLoop } from "./hooks/useAgentLoop.js";
5
+ import { UserMessage } from "./components/UserMessage.js";
6
+ import { AssistantMessage } from "./components/AssistantMessage.js";
7
+ import { ToolExecution } from "./components/ToolExecution.js";
8
+ import { StreamingArea } from "./components/StreamingArea.js";
9
+ import { InputArea } from "./components/InputArea.js";
10
+ import { Footer } from "./components/Footer.js";
11
+ import { ModelSelector } from "./components/ModelSelector.js";
12
+ import { useTheme } from "./theme/theme.js";
13
+ import { getGitBranch } from "../utils/git.js";
14
+ // ── Duration summary ─────────────────────────────────────
15
+ function formatDuration(ms) {
16
+ const totalSec = Math.round(ms / 1000);
17
+ if (totalSec < 60)
18
+ return `${totalSec}s`;
19
+ const min = Math.floor(totalSec / 60);
20
+ const sec = totalSec % 60;
21
+ return sec > 0 ? `${min}m ${sec}s` : `${min}m`;
22
+ }
23
+ function pickDurationVerb(toolsUsed) {
24
+ const has = (name) => toolsUsed.includes(name);
25
+ // Tool-specific phrases (most specific first)
26
+ if (has("edit") && has("write"))
27
+ return "Crafted code for";
28
+ if (has("edit"))
29
+ return "Refactored for";
30
+ if (has("write"))
31
+ return "Wrote code for";
32
+ if (has("bash") && has("grep"))
33
+ return "Hacked away for";
34
+ if (has("bash"))
35
+ return "Executed commands for";
36
+ if (has("grep") && has("read"))
37
+ return "Investigated for";
38
+ if (has("grep"))
39
+ return "Searched for";
40
+ if (has("read") && has("find"))
41
+ return "Explored for";
42
+ if (has("read"))
43
+ return "Studied the code for";
44
+ if (has("find") || has("ls"))
45
+ return "Browsed files for";
46
+ // No tools used — pure text response
47
+ const phrases = [
48
+ "Pondered for",
49
+ "Thought for",
50
+ "Reasoned for",
51
+ "Mulled it over for",
52
+ "Noodled on it for",
53
+ "Brewed up a response in",
54
+ "Cooked up an answer in",
55
+ "Worked out a reply in",
56
+ "Channeled wisdom for",
57
+ "Conjured a response in",
58
+ ];
59
+ return phrases[Math.floor(Math.random() * phrases.length)];
60
+ }
61
+ // ── App Component ──────────────────────────────────────────
62
+ export function App(props) {
63
+ const theme = useTheme();
64
+ // Items scrolled into Static (history)
65
+ const [history, setHistory] = useState([]);
66
+ // Items from the current/last turn — rendered in the live area so they stay visible
67
+ const [liveItems, setLiveItems] = useState([]);
68
+ const [overlay, setOverlay] = useState(null);
69
+ const [lastUserMessage, setLastUserMessage] = useState("");
70
+ const [gitBranch, setGitBranch] = useState(null);
71
+ const messagesRef = useRef(props.messages);
72
+ const nextIdRef = useRef(0);
73
+ const getId = () => String(nextIdRef.current++);
74
+ // Load git branch
75
+ useEffect(() => {
76
+ getGitBranch(props.cwd).then(setGitBranch);
77
+ }, [props.cwd]);
78
+ const agentLoop = useAgentLoop(messagesRef, {
79
+ provider: props.provider,
80
+ model: props.model,
81
+ tools: props.tools,
82
+ maxTokens: props.maxTokens,
83
+ thinking: props.thinking,
84
+ apiKey: props.apiKey,
85
+ baseUrl: props.baseUrl,
86
+ accountId: props.accountId,
87
+ }, {
88
+ onTurnText: useCallback((text, thinking) => {
89
+ setLiveItems((prev) => [...prev, { kind: "assistant", text, thinking, id: getId() }]);
90
+ }, []),
91
+ onToolStart: useCallback((toolCallId, name, args) => {
92
+ setLiveItems((prev) => [...prev, { kind: "tool_start", toolCallId, name, args, id: getId() }]);
93
+ }, []),
94
+ onToolEnd: useCallback((toolCallId, name, result, isError, durationMs) => {
95
+ setLiveItems((prev) => {
96
+ // Find the matching tool_start and replace it with tool_done
97
+ const startIdx = prev.findIndex((item) => item.kind === "tool_start" && item.toolCallId === toolCallId);
98
+ if (startIdx !== -1) {
99
+ const startItem = prev[startIdx];
100
+ const doneItem = {
101
+ kind: "tool_done",
102
+ name,
103
+ args: startItem.args,
104
+ result,
105
+ isError,
106
+ durationMs,
107
+ id: startItem.id,
108
+ };
109
+ const next = [...prev];
110
+ next[startIdx] = doneItem;
111
+ return next;
112
+ }
113
+ // Fallback: just append
114
+ return [
115
+ ...prev,
116
+ { kind: "tool_done", name, args: {}, result, isError, durationMs, id: getId() },
117
+ ];
118
+ });
119
+ }, []),
120
+ onDone: useCallback((durationMs, toolsUsed) => {
121
+ setLiveItems((prev) => [
122
+ ...prev,
123
+ { kind: "duration", durationMs, toolsUsed, id: getId() },
124
+ ]);
125
+ }, []),
126
+ onAborted: useCallback(() => {
127
+ setLiveItems((prev) => [
128
+ ...prev,
129
+ { kind: "info", text: "Request was stopped.", id: getId() },
130
+ ]);
131
+ }, []),
132
+ });
133
+ const handleSubmit = useCallback(async (input) => {
134
+ // Check slash commands
135
+ if (props.onSlashCommand && input.startsWith("/")) {
136
+ const result = await props.onSlashCommand(input);
137
+ if (result !== null) {
138
+ setLiveItems((prev) => [...prev, { kind: "info", text: result, id: getId() }]);
139
+ if (input.trim() === "/model" || input.trim() === "/m") {
140
+ setOverlay("model");
141
+ }
142
+ return;
143
+ }
144
+ }
145
+ // Move current live items into history (Static) before starting new turn
146
+ setLiveItems((prev) => {
147
+ if (prev.length > 0) {
148
+ setHistory((h) => [...h, ...prev]);
149
+ }
150
+ return [];
151
+ });
152
+ // Add user message to live area
153
+ const userItem = { kind: "user", text: input, id: getId() };
154
+ setLastUserMessage(input);
155
+ setLiveItems([userItem]);
156
+ // Run agent
157
+ try {
158
+ await agentLoop.run(input);
159
+ }
160
+ catch (err) {
161
+ const msg = err instanceof Error ? err.message : String(err);
162
+ const isAbort = msg.includes("aborted") || msg.includes("abort");
163
+ setLiveItems((prev) => [
164
+ ...prev,
165
+ isAbort
166
+ ? { kind: "info", text: "Request was stopped.", id: getId() }
167
+ : { kind: "error", message: msg, id: getId() },
168
+ ]);
169
+ }
170
+ }, [agentLoop, props.onSlashCommand]);
171
+ const handleAbort = useCallback(() => {
172
+ if (agentLoop.isRunning) {
173
+ agentLoop.abort();
174
+ }
175
+ else {
176
+ process.exit(0);
177
+ }
178
+ }, [agentLoop]);
179
+ const handleModelSelect = useCallback((value) => {
180
+ setOverlay(null);
181
+ const [_provider, _model] = value.split(":");
182
+ setLiveItems((prev) => [
183
+ ...prev,
184
+ { kind: "info", text: `Switched to ${value}`, id: getId() },
185
+ ]);
186
+ }, []);
187
+ const { stdout } = useStdout();
188
+ const terminalHeight = stdout?.rows ?? 24;
189
+ const renderItem = (item) => {
190
+ switch (item.kind) {
191
+ case "user":
192
+ return _jsx(UserMessage, { text: item.text }, item.id);
193
+ case "assistant":
194
+ return (_jsx(AssistantMessage, { text: item.text, thinking: item.thinking, showThinking: props.showThinking }, item.id));
195
+ case "tool_start":
196
+ return (_jsx(ToolExecution, { status: "running", name: item.name, args: item.args }, item.id));
197
+ case "tool_done":
198
+ return (_jsx(ToolExecution, { status: "done", name: item.name, args: item.args, result: item.result, isError: item.isError }, item.id));
199
+ case "error":
200
+ return (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: theme.error, children: "✗ " }), _jsx(Text, { color: theme.error, children: item.message })] }, item.id));
201
+ case "info":
202
+ return (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.textDim, children: item.text }) }, item.id));
203
+ case "duration":
204
+ return (_jsx(Box, { marginTop: 1, children: _jsxs(Text, { color: theme.textDim, children: ["✻ ", pickDurationVerb(item.toolsUsed), " ", formatDuration(item.durationMs)] }) }, item.id));
205
+ }
206
+ };
207
+ return (_jsxs(Box, { flexDirection: "column", minHeight: terminalHeight, children: [_jsx(Static, { items: history, children: (item) => renderItem(item) }), _jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [liveItems.map((item) => renderItem(item)), _jsx(StreamingArea, { isRunning: agentLoop.isRunning, streamingText: agentLoop.streamingText, streamingThinking: agentLoop.streamingThinking, activeToolCalls: agentLoop.activeToolCalls, showThinking: props.showThinking, userMessage: lastUserMessage }), overlay === "model" && (_jsx(ModelSelector, { onSelect: handleModelSelect, onCancel: () => setOverlay(null) }))] }), _jsx(InputArea, { onSubmit: handleSubmit, onAbort: handleAbort, disabled: agentLoop.isRunning }), _jsx(Footer, { model: props.model, tokensIn: agentLoop.totalTokens.input, cwd: props.cwd, gitBranch: gitBranch })] }));
208
+ }
209
+ //# sourceMappingURL=App.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.js","sourceRoot":"","sources":["../../src/ui/App.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CA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,KAAC,aAAa,IACZ,SAAS,EAAE,SAAS,CAAC,SAAS,EAC9B,aAAa,EAAE,SAAS,CAAC,aAAa,EACtC,iBAAiB,EAAE,SAAS,CAAC,iBAAiB,EAC9C,eAAe,EAAE,SAAS,CAAC,eAAe,EAC1C,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,WAAW,EAAE,eAAe,GAC5B,EAGD,OAAO,KAAK,OAAO,IAAI,CACtB,KAAC,aAAa,IAAC,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAAI,CACjF,IACG,EAGN,KAAC,SAAS,IAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,CAAC,SAAS,GAAI,EAC1F,KAAC,MAAM,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,SAAS,EAAE,SAAS,GAAI,IACvG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ interface AssistantMessageProps {
2
+ text: string;
3
+ thinking?: string;
4
+ showThinking?: boolean;
5
+ }
6
+ export declare function AssistantMessage({ text, thinking, showThinking }: AssistantMessageProps): import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=AssistantMessage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssistantMessage.d.ts","sourceRoot":"","sources":["../../../src/ui/components/AssistantMessage.tsx"],"names":[],"mappings":"AAKA,UAAU,qBAAqB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAmB,EAAE,EAAE,qBAAqB,2CAsB9F"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Text, Box } from "ink";
4
+ import { useTheme } from "../theme/theme.js";
5
+ import { Markdown } from "./Markdown.js";
6
+ export function AssistantMessage({ text, thinking, showThinking = true }) {
7
+ const theme = useTheme();
8
+ return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [showThinking && thinking && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: theme.textDim, italic: true, children: thinking.length > 500 ? thinking.slice(0, 497) + "..." : thinking }) })), text && (_jsxs(Box, { children: [_jsx(Text, { color: theme.primary, children: "⏺ " }), _jsx(Box, { flexDirection: "column", flexShrink: 1, children: _jsx(Markdown, { children: text }) })] }))] }));
9
+ }
10
+ //# sourceMappingURL=AssistantMessage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AssistantMessage.js","sourceRoot":"","sources":["../../../src/ui/components/AssistantMessage.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,YAAY,GAAG,IAAI,EAAyB;IAC7F,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IAEzB,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,aACrC,YAAY,IAAI,QAAQ,IAAI,CAC3B,KAAC,GAAG,IAAC,YAAY,EAAE,CAAC,YAClB,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,MAAM,kBAC/B,QAAQ,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,QAAQ,GAC7D,GACH,CACP,EACA,IAAI,IAAI,CACP,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAAG,IAAI,GAAQ,EACzC,KAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,UAAU,EAAE,CAAC,YACvC,KAAC,QAAQ,cAAE,IAAI,GAAY,GACvB,IACF,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function DiffView({ diff }: {
2
+ diff: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
4
+ //# sourceMappingURL=DiffView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffView.d.ts","sourceRoot":"","sources":["../../../src/ui/components/DiffView.tsx"],"names":[],"mappings":"AAMA,wBAAgB,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAwBlD"}
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from "react";
3
+ import { Text, Box } from "ink";
4
+ import { useTheme } from "../theme/theme.js";
5
+ const MAX_DISPLAY_LINES = 20;
6
+ export function DiffView({ diff }) {
7
+ const theme = useTheme();
8
+ const lines = diff.split("\n");
9
+ const truncated = lines.length > MAX_DISPLAY_LINES;
10
+ const displayLines = truncated ? lines.slice(0, MAX_DISPLAY_LINES) : lines;
11
+ return (_jsxs(Box, { flexDirection: "column", marginLeft: 2, children: [displayLines.map((line, i) => {
12
+ let color = theme.diffContext;
13
+ if (line.startsWith("+"))
14
+ color = theme.diffAdded;
15
+ else if (line.startsWith("-"))
16
+ color = theme.diffRemoved;
17
+ return (_jsx(Text, { color: color, children: line }, i));
18
+ }), truncated && (_jsxs(Text, { color: theme.textDim, children: ["... (", lines.length - MAX_DISPLAY_LINES, " more lines)"] }))] }));
19
+ }
20
+ //# sourceMappingURL=DiffView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DiffView.js","sourceRoot":"","sources":["../../../src/ui/components/DiffView.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,UAAU,QAAQ,CAAC,EAAE,IAAI,EAAoB;IACjD,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,iBAAiB,CAAC;IACnD,MAAM,YAAY,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAE3E,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,UAAU,EAAE,CAAC,aACtC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;gBAC5B,IAAI,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;gBAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;oBAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC;qBAC7C,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;oBAAE,KAAK,GAAG,KAAK,CAAC,WAAW,CAAC;gBAEzD,OAAO,CACL,KAAC,IAAI,IAAS,KAAK,EAAE,KAAK,YACvB,IAAI,IADI,CAAC,CAEL,CACR,CAAC;YACJ,CAAC,CAAC,EACD,SAAS,IAAI,CACZ,MAAC,IAAI,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,sBAAQ,KAAK,CAAC,MAAM,GAAG,iBAAiB,oBAAoB,CACvF,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ interface FooterProps {
2
+ model: string;
3
+ tokensIn: number;
4
+ cwd: string;
5
+ gitBranch?: string | null;
6
+ }
7
+ export declare function Footer({ model, tokensIn, cwd, gitBranch }: FooterProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=Footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Footer.d.ts","sourceRoot":"","sources":["../../../src/ui/components/Footer.tsx"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAmDD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,WAAW,2CAkDtE"}