@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,43 @@
1
+ import { useState, useCallback, useRef } from "react";
2
+ import { SessionManager } from "../../core/session-manager.js";
3
+ import crypto from "node:crypto";
4
+ export function useSessionManager(sessionsDir) {
5
+ const managerRef = useRef(new SessionManager(sessionsDir));
6
+ const [sessionId, setSessionId] = useState("");
7
+ const [sessionPath, setSessionPath] = useState("");
8
+ const create = useCallback(async (cwd, provider, model) => {
9
+ const session = await managerRef.current.create(cwd, provider, model);
10
+ setSessionId(session.id);
11
+ setSessionPath(session.path);
12
+ }, []);
13
+ const load = useCallback(async (path) => {
14
+ const loaded = await managerRef.current.load(path);
15
+ return managerRef.current.getMessages(loaded.entries);
16
+ }, []);
17
+ const persistMessages = useCallback(async (messages, fromIndex) => {
18
+ if (!sessionPath)
19
+ return;
20
+ for (let i = fromIndex; i < messages.length; i++) {
21
+ const entry = {
22
+ type: "message",
23
+ id: crypto.randomUUID(),
24
+ parentId: null,
25
+ timestamp: new Date().toISOString(),
26
+ message: messages[i],
27
+ };
28
+ await managerRef.current.appendEntry(sessionPath, entry);
29
+ }
30
+ }, [sessionPath]);
31
+ const listSessions = useCallback(async (cwd) => {
32
+ return managerRef.current.list(cwd);
33
+ }, []);
34
+ return {
35
+ sessionId,
36
+ sessionPath,
37
+ create,
38
+ load,
39
+ persistMessages,
40
+ listSessions,
41
+ };
42
+ }
43
+ //# sourceMappingURL=useSessionManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSessionManager.js","sourceRoot":"","sources":["../../../src/ui/hooks/useSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAuC,MAAM,+BAA+B,CAAC;AACpG,OAAO,MAAM,MAAM,aAAa,CAAC;AAYjC,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAC3D,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEnD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,EAAE,GAAW,EAAE,QAAkB,EAAE,KAAa,EAAE,EAAE;QAClF,MAAM,OAAO,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;QACtE,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QACzB,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/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export interface UseSlashCommandsReturn {
3
+ isSlashCommand: (input: string) => boolean;
4
+ execute: (input: string) => Promise<string | null>;
5
+ }
6
+ export declare function useSlashCommands(registry: SlashCommandRegistry, context: SlashCommandContext): UseSlashCommandsReturn;
7
+ //# sourceMappingURL=useSlashCommands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSlashCommands.d.ts","sourceRoot":"","sources":["../../../src/ui/hooks/useSlashCommands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAE9F,MAAM,WAAW,sBAAsB;IACrC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3C,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CACpD;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE,mBAAmB,GAC3B,sBAAsB,CAgBxB"}
@@ -0,0 +1,11 @@
1
+ import { useCallback } from "react";
2
+ export function useSlashCommands(registry, context) {
3
+ const isSlashCommand = useCallback((input) => {
4
+ return registry.parse(input.trim()) !== null;
5
+ }, [registry]);
6
+ const execute = useCallback(async (input) => {
7
+ return registry.execute(input.trim(), context);
8
+ }, [registry, context]);
9
+ return { isSlashCommand, execute };
10
+ }
11
+ //# sourceMappingURL=useSlashCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useSlashCommands.js","sourceRoot":"","sources":["../../../src/ui/hooks/useSlashCommands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAQpC,MAAM,UAAU,gBAAgB,CAC9B,QAA8B,EAC9B,OAA4B;IAE5B,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,KAAa,EAAE,EAAE;QAChB,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC/C,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,MAAM,OAAO,GAAG,WAAW,CACzB,KAAK,EAAE,KAAa,EAAE,EAAE;QACtB,OAAO,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC,EACD,CAAC,QAAQ,EAAE,OAAO,CAAC,CACpB,CAAC;IAEF,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,CAAC;AACrC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Message, Provider, ThinkingLevel } from "@kenkaiiii/gg-ai";
2
+ import type { AgentTool } from "@kenkaiiii/gg-agent";
3
+ export interface RenderAppConfig {
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
+ theme?: "dark" | "light";
15
+ showThinking?: boolean;
16
+ showTokenUsage?: boolean;
17
+ onSlashCommand?: (input: string) => Promise<string | null>;
18
+ }
19
+ export declare function renderApp(config: RenderAppConfig): Promise<void>;
20
+ //# sourceMappingURL=render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/ui/render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIrD,MAAM,WAAW,eAAe;IAC9B,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,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACzB,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;AAED,wBAAsB,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BtE"}
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import { render } from "ink";
3
+ import { App } from "./App.js";
4
+ import { ThemeContext, loadTheme } from "./theme/theme.js";
5
+ export async function renderApp(config) {
6
+ const theme = loadTheme(config.theme ?? "dark");
7
+ const { waitUntilExit } = render(React.createElement(ThemeContext.Provider, { value: theme }, React.createElement(App, {
8
+ provider: config.provider,
9
+ model: config.model,
10
+ tools: config.tools,
11
+ messages: config.messages,
12
+ maxTokens: config.maxTokens,
13
+ thinking: config.thinking,
14
+ apiKey: config.apiKey,
15
+ baseUrl: config.baseUrl,
16
+ accountId: config.accountId,
17
+ cwd: config.cwd,
18
+ showThinking: config.showThinking,
19
+ showTokenUsage: config.showTokenUsage,
20
+ onSlashCommand: config.onSlashCommand,
21
+ })));
22
+ await waitUntilExit();
23
+ }
24
+ //# sourceMappingURL=render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/ui/render.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAmB3D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAuB;IACrD,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC;IAEhD,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAC9B,KAAK,CAAC,aAAa,CACjB,YAAY,CAAC,QAAQ,EACrB,EAAE,KAAK,EAAE,KAAK,EAAE,EAChB,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE;QACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,GAAG,EAAE,MAAM,CAAC,GAAG;QACf,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC,CACH,CACF,CAAC;IAEF,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC"}
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "dark",
3
+ "primary": "#60a5fa",
4
+ "secondary": "#a78bfa",
5
+ "success": "#4ade80",
6
+ "error": "#f87171",
7
+ "warning": "#fbbf24",
8
+ "text": "#e5e7eb",
9
+ "textDim": "#6b7280",
10
+ "textMuted": "#9ca3af",
11
+ "border": "#374151",
12
+ "background": "",
13
+ "accent": "#818cf8",
14
+ "toolName": "#60a5fa",
15
+ "toolSuccess": "#4ade80",
16
+ "toolError": "#f87171",
17
+ "diffAdded": "#4ade80",
18
+ "diffRemoved": "#f87171",
19
+ "diffContext": "#6b7280",
20
+ "spinnerColor": "#60a5fa",
21
+ "inputPrompt": "#60a5fa",
22
+ "footerText": "#6b7280"
23
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "light",
3
+ "primary": "#2563eb",
4
+ "secondary": "#7c3aed",
5
+ "success": "#16a34a",
6
+ "error": "#dc2626",
7
+ "warning": "#d97706",
8
+ "text": "#1f2937",
9
+ "textDim": "#9ca3af",
10
+ "textMuted": "#6b7280",
11
+ "border": "#d1d5db",
12
+ "background": "",
13
+ "accent": "#4f46e5",
14
+ "toolName": "#2563eb",
15
+ "toolSuccess": "#16a34a",
16
+ "toolError": "#dc2626",
17
+ "diffAdded": "#16a34a",
18
+ "diffRemoved": "#dc2626",
19
+ "diffContext": "#9ca3af",
20
+ "spinnerColor": "#2563eb",
21
+ "inputPrompt": "#2563eb",
22
+ "footerText": "#9ca3af"
23
+ }
@@ -0,0 +1,28 @@
1
+ import darkTheme from "./dark.json";
2
+ export type Theme = typeof darkTheme;
3
+ export declare function loadTheme(name: "dark" | "light"): Theme;
4
+ export declare const ThemeContext: import("react").Context<{
5
+ name: string;
6
+ primary: string;
7
+ secondary: string;
8
+ success: string;
9
+ error: string;
10
+ warning: string;
11
+ text: string;
12
+ textDim: string;
13
+ textMuted: string;
14
+ border: string;
15
+ background: string;
16
+ accent: string;
17
+ toolName: string;
18
+ toolSuccess: string;
19
+ toolError: string;
20
+ diffAdded: string;
21
+ diffRemoved: string;
22
+ diffContext: string;
23
+ spinnerColor: string;
24
+ inputPrompt: string;
25
+ footerText: string;
26
+ }>;
27
+ export declare function useTheme(): Theme;
28
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../src/ui/theme/theme.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,aAAa,CAAuB;AAG1D,MAAM,MAAM,KAAK,GAAG,OAAO,SAAS,CAAC;AAErC,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,CAEvD;AAED,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;EAAkC,CAAC;AAE5D,wBAAgB,QAAQ,IAAI,KAAK,CAEhC"}
@@ -0,0 +1,11 @@
1
+ import { createContext, useContext } from "react";
2
+ import darkTheme from "./dark.json" with { type: "json" };
3
+ import lightTheme from "./light.json" with { type: "json" };
4
+ export function loadTheme(name) {
5
+ return name === "light" ? lightTheme : darkTheme;
6
+ }
7
+ export const ThemeContext = createContext(darkTheme);
8
+ export function useTheme() {
9
+ return useContext(ThemeContext);
10
+ }
11
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/ui/theme/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,SAAS,MAAM,aAAa,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAC1D,OAAO,UAAU,MAAM,cAAc,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAI5D,MAAM,UAAU,SAAS,CAAC,IAAsB;IAC9C,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAQ,SAAS,CAAC,CAAC;AAE5D,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Convert raw errors into clean, user-friendly one-liners.
3
+ */
4
+ export declare function formatUserError(err: unknown): string;
5
+ //# sourceMappingURL=error-handler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.d.ts","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CA+EpD"}
@@ -0,0 +1,97 @@
1
+ import chalk from "chalk";
2
+ /**
3
+ * Convert raw errors into clean, user-friendly one-liners.
4
+ */
5
+ export function formatUserError(err) {
6
+ if (err instanceof Error && err.name === "AbortError") {
7
+ return chalk.red("Interrupted.");
8
+ }
9
+ const { message, provider, statusCode } = extractErrorInfo(err);
10
+ const lowerMsg = message.toLowerCase();
11
+ // Auth: not logged in
12
+ if (lowerMsg.includes("not logged in") ||
13
+ lowerMsg.includes("resolve authentication") ||
14
+ lowerMsg.includes("api key") ||
15
+ lowerMsg.includes("apikey") ||
16
+ lowerMsg.includes("no auth")) {
17
+ return chalk.red('Not logged in. Run "ggcoder login" to authenticate.');
18
+ }
19
+ // Auth: invalid/expired token
20
+ if (statusCode === 401 ||
21
+ lowerMsg.includes("unauthorized") ||
22
+ /invalid.*key/.test(lowerMsg) ||
23
+ /invalid.*token/.test(lowerMsg)) {
24
+ return chalk.red('Session expired or invalid. Run "ggcoder login" to re-authenticate.');
25
+ }
26
+ // Rate limiting
27
+ if (statusCode === 429 || lowerMsg.includes("rate limit")) {
28
+ const name = displayProvider(provider);
29
+ return chalk.red(`Rate limited by ${name}. Wait a moment and try again.`);
30
+ }
31
+ // Server errors (5xx)
32
+ if (statusCode && statusCode >= 500 && statusCode < 600) {
33
+ const name = displayProvider(provider);
34
+ return chalk.red(`${name} server error (${statusCode}). Try again shortly.`);
35
+ }
36
+ // Network errors
37
+ if (lowerMsg.includes("econnrefused") ||
38
+ lowerMsg.includes("fetch failed") ||
39
+ lowerMsg.includes("enotfound") ||
40
+ lowerMsg.includes("etimedout") ||
41
+ lowerMsg.includes("network")) {
42
+ const name = displayProvider(provider);
43
+ return chalk.red(`Cannot reach ${name} API. Check your internet connection.`);
44
+ }
45
+ // Bad request (400)
46
+ if (statusCode === 400) {
47
+ const name = displayProvider(provider);
48
+ const firstLine = message.split("\n")[0];
49
+ return chalk.red(`Request error (${name}): ${firstLine}`);
50
+ }
51
+ // File not found
52
+ if (lowerMsg.includes("enoent")) {
53
+ const path = extractPath(message);
54
+ return chalk.red(path ? `File not found: ${path}` : "File not found.");
55
+ }
56
+ // Permission denied
57
+ if (lowerMsg.includes("eacces")) {
58
+ const path = extractPath(message);
59
+ return chalk.red(path ? `Permission denied: ${path}` : "Permission denied.");
60
+ }
61
+ // Generic Error — show first line only, no stack
62
+ if (message) {
63
+ const firstLine = message.split("\n")[0];
64
+ return chalk.red(`Error: ${firstLine}`);
65
+ }
66
+ return chalk.red("An unexpected error occurred.");
67
+ }
68
+ function extractErrorInfo(err) {
69
+ if (typeof err !== "object" || err === null) {
70
+ return { message: String(err), provider: undefined, statusCode: undefined };
71
+ }
72
+ const e = err;
73
+ const message = typeof e.message === "string" ? e.message : String(err);
74
+ const provider = typeof e.provider === "string" ? e.provider : undefined;
75
+ const statusCode = typeof e.statusCode === "number"
76
+ ? e.statusCode
77
+ : typeof e.status === "number"
78
+ ? e.status
79
+ : undefined;
80
+ return { message, provider, statusCode };
81
+ }
82
+ function displayProvider(provider) {
83
+ switch (provider) {
84
+ case "anthropic":
85
+ return "Anthropic";
86
+ case "openai":
87
+ return "OpenAI";
88
+ default:
89
+ return "the provider";
90
+ }
91
+ }
92
+ function extractPath(message) {
93
+ // Match common ENOENT/EACCES patterns: "... 'path'" or "... \"path\""
94
+ const match = message.match(/['"]([^'"]+)['"]/);
95
+ return match?.[1];
96
+ }
97
+ //# sourceMappingURL=error-handler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-handler.js","sourceRoot":"","sources":["../../src/utils/error-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,E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K,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,cAAc,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,sEAAsE;IACtE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAChD,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Format tool call start for display.
3
+ */
4
+ export declare function formatToolCallStart(name: string, args: Record<string, unknown>): string;
5
+ /**
6
+ * Format tool call end for display.
7
+ */
8
+ export declare function formatToolCallEnd(name: string, result: string, isError: boolean, durationMs: number): string;
9
+ /**
10
+ * Format token usage for display.
11
+ */
12
+ export declare function formatUsage(inputTokens: number, outputTokens: number): string;
13
+ /**
14
+ * Format an error for display.
15
+ */
16
+ export declare function formatError(error: Error): string;
17
+ /**
18
+ * Format the welcome banner.
19
+ */
20
+ export declare function formatWelcome(model: string, provider: string, cwd: string): string;
21
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAGvF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAE7E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAEhD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAWlF"}
@@ -0,0 +1,120 @@
1
+ import chalk from "chalk";
2
+ import { formatUserError } from "./error-handler.js";
3
+ /**
4
+ * Format tool call start for display.
5
+ */
6
+ export function formatToolCallStart(name, args) {
7
+ const argsStr = formatArgs(name, args);
8
+ return chalk.dim(` ● ${name}${argsStr}`);
9
+ }
10
+ /**
11
+ * Format tool call end for display.
12
+ */
13
+ export function formatToolCallEnd(name, result, isError, durationMs) {
14
+ const duration = chalk.dim(`(${formatDuration(durationMs)})`);
15
+ const summary = summarizeResult(name, result, isError);
16
+ if (isError) {
17
+ return chalk.red(` ✗ ${name} ${duration} — ${summary}`);
18
+ }
19
+ return chalk.dim(` ✓ ${name} ${duration} — ${summary}`);
20
+ }
21
+ /**
22
+ * Format token usage for display.
23
+ */
24
+ export function formatUsage(inputTokens, outputTokens) {
25
+ return chalk.dim(` tokens: ${formatNumber(inputTokens)} in / ${formatNumber(outputTokens)} out`);
26
+ }
27
+ /**
28
+ * Format an error for display.
29
+ */
30
+ export function formatError(error) {
31
+ return formatUserError(error);
32
+ }
33
+ /**
34
+ * Format the welcome banner.
35
+ */
36
+ export function formatWelcome(model, provider, cwd) {
37
+ const lines = [
38
+ chalk.bold("gg-coding-agent"),
39
+ chalk.dim(` model: ${model}`),
40
+ chalk.dim(` provider: ${provider}`),
41
+ chalk.dim(` cwd: ${cwd}`),
42
+ "",
43
+ chalk.dim(" Type your message and press Enter. Ctrl+D to exit."),
44
+ "",
45
+ ];
46
+ return lines.join("\n");
47
+ }
48
+ // ── Helpers ──────────────────────────────────────────────────
49
+ function formatArgs(name, args) {
50
+ switch (name) {
51
+ case "bash": {
52
+ const cmd = String(args.command ?? "");
53
+ const short = cmd.length > 80 ? cmd.slice(0, 77) + "..." : cmd;
54
+ return ` ${chalk.dim(short)}`;
55
+ }
56
+ case "read":
57
+ case "write":
58
+ case "edit":
59
+ return args.file_path ? ` ${chalk.dim(String(args.file_path))}` : "";
60
+ case "find":
61
+ return ` ${chalk.dim(String(args.pattern ?? ""))}`;
62
+ case "grep":
63
+ return ` ${chalk.dim(String(args.pattern ?? ""))}`;
64
+ case "ls":
65
+ return args.path ? ` ${chalk.dim(String(args.path))}` : "";
66
+ default:
67
+ return "";
68
+ }
69
+ }
70
+ function summarizeResult(name, result, isError) {
71
+ if (isError) {
72
+ const firstLine = result.split("\n")[0];
73
+ return firstLine.length > 100 ? firstLine.slice(0, 97) + "..." : firstLine;
74
+ }
75
+ switch (name) {
76
+ case "bash": {
77
+ const match = result.match(/^Exit code: (.+)/);
78
+ return match ? `exit ${match[1]}` : "done";
79
+ }
80
+ case "read": {
81
+ const lines = result.split("\n").length;
82
+ return `${lines} lines`;
83
+ }
84
+ case "write": {
85
+ return result.split("\n")[0];
86
+ }
87
+ case "edit": {
88
+ const added = (result.match(/^\+[^+]/gm) ?? []).length;
89
+ const removed = (result.match(/^-[^-]/gm) ?? []).length;
90
+ return `+${added} -${removed} lines`;
91
+ }
92
+ case "find": {
93
+ const match = result.match(/(\d+) file\(s\) found/);
94
+ return match ? `${match[1]} files` : "done";
95
+ }
96
+ case "grep": {
97
+ const match = result.match(/(\d+) match\(es\) found/);
98
+ return match ? `${match[1]} matches` : "done";
99
+ }
100
+ case "ls": {
101
+ const lineCount = result.split("\n").length;
102
+ return `${lineCount} entries`;
103
+ }
104
+ default:
105
+ return "done";
106
+ }
107
+ }
108
+ function formatDuration(ms) {
109
+ if (ms < 1000)
110
+ return `${ms}ms`;
111
+ return `${(ms / 1000).toFixed(1)}s`;
112
+ }
113
+ function formatNumber(n) {
114
+ if (n >= 1_000_000)
115
+ return `${(n / 1_000_000).toFixed(1)}M`;
116
+ if (n >= 1_000)
117
+ return `${(n / 1_000).toFixed(1)}K`;
118
+ return String(n);
119
+ }
120
+ //# sourceMappingURL=format.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CAAC,GAAG,CAAC;IAC5D,IAAI,CAAC,IAAI,KAAK;QAAE,OAAO,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACpD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getGitBranch(cwd: string): Promise<string | null>;
2
+ //# sourceMappingURL=git.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAehE"}
@@ -0,0 +1,13 @@
1
+ import { execFile } from "node:child_process";
2
+ export function getGitBranch(cwd) {
3
+ return new Promise((resolve) => {
4
+ execFile("git", ["rev-parse", "--abbrev-ref", "HEAD"], { cwd, timeout: 2000 }, (error, stdout) => {
5
+ if (error) {
6
+ resolve(null);
7
+ return;
8
+ }
9
+ resolve(stdout.trim() || null);
10
+ });
11
+ });
12
+ }
13
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CACN,KAAK,EACL,CAAC,WAAW,EAAE,cAAc,EAAE,MAAM,CAAC,EACrC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,EACtB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;YAChB,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,IAAI,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC;QACjC,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Render markdown string to ANSI-formatted terminal text.
3
+ * Trims trailing whitespace/newlines.
4
+ */
5
+ export declare function renderMarkdown(text: string): string;
6
+ //# sourceMappingURL=markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../../src/utils/markdown.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD"}
@@ -0,0 +1,25 @@
1
+ import { marked } from "marked";
2
+ import { markedTerminal } from "marked-terminal";
3
+ import chalk from "chalk";
4
+ // Force chalk to output ANSI codes — Ink manages the TTY so
5
+ // chalk's auto-detection may incorrectly disable colors.
6
+ chalk.level = 3;
7
+ marked.use(markedTerminal({
8
+ code: chalk.yellow,
9
+ codespan: chalk.yellow,
10
+ strong: chalk.bold,
11
+ em: chalk.italic,
12
+ heading: chalk.bold.cyan,
13
+ link: chalk.underline.blueBright,
14
+ href: chalk.dim,
15
+ tab: 2,
16
+ }));
17
+ /**
18
+ * Render markdown string to ANSI-formatted terminal text.
19
+ * Trims trailing whitespace/newlines.
20
+ */
21
+ export function renderMarkdown(text) {
22
+ const rendered = marked.parse(text, { async: false });
23
+ return rendered.trimEnd();
24
+ }
25
+ //# sourceMappingURL=markdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown.js","sourceRoot":"","sources":["../../src/utils/markdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,4DAA4D;AAC5D,yDAAyD;AACzD,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC;AAEhB,MAAM,CAAC,GAAG,CACR,cAAc,CAAC;IACb,IAAI,EAAE,KAAK,CAAC,MAAM;IAClB,QAAQ,EAAE,KAAK,CAAC,MAAM;IACtB,MAAM,EAAE,KAAK,CAAC,IAAI;IAClB,EAAE,EAAE,KAAK,CAAC,MAAM;IAChB,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;IACxB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU;IAChC,IAAI,EAAE,KAAK,CAAC,GAAG;IACf,GAAG,EAAE,CAAC;CACP,CAAQ,CACV,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAW,CAAC;IAChE,OAAO,QAAQ,CAAC,OAAO,EAAE,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Kill a process and all its children by sending SIGKILL to the process group.
3
+ * Falls back to killing just the process if process group kill fails.
4
+ */
5
+ export declare function killProcessTree(pid: number): void;
6
+ //# sourceMappingURL=process.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAWjD"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Kill a process and all its children by sending SIGKILL to the process group.
3
+ * Falls back to killing just the process if process group kill fails.
4
+ */
5
+ export function killProcessTree(pid) {
6
+ try {
7
+ // Kill the entire process group (negative pid)
8
+ process.kill(-pid, "SIGKILL");
9
+ }
10
+ catch {
11
+ try {
12
+ process.kill(pid, "SIGKILL");
13
+ }
14
+ catch {
15
+ // Process already exited
16
+ }
17
+ }
18
+ }
19
+ //# sourceMappingURL=process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,IAAI,CAAC;QACH,+CAA+C;QAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,yBAAyB;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function resolveShell(): string;
2
+ export declare function getShellName(shellPath?: string): string;
3
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAEA,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvD"}
@@ -0,0 +1,8 @@
1
+ import path from "node:path";
2
+ export function resolveShell() {
3
+ return process.env.SHELL ?? "/bin/bash";
4
+ }
5
+ export function getShellName(shellPath) {
6
+ return path.basename(shellPath ?? resolveShell());
7
+ }
8
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,WAAW,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,SAAkB;IAC7C,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,YAAY,EAAE,CAAC,CAAC;AACpD,CAAC"}