agor-live 0.3.7

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 (297) hide show
  1. package/LICENSE +94 -0
  2. package/README.md +163 -0
  3. package/bin/agor-daemon.js +20 -0
  4. package/bin/agor.js +14 -0
  5. package/dist/cli/base-command.d.ts +29 -0
  6. package/dist/cli/base-command.js +41 -0
  7. package/dist/cli/commands/board/add-session.d.ts +15 -0
  8. package/dist/cli/commands/board/add-session.js +102 -0
  9. package/dist/cli/commands/board/list.d.ts +14 -0
  10. package/dist/cli/commands/board/list.js +74 -0
  11. package/dist/cli/commands/config/clear.d.ts +13 -0
  12. package/dist/cli/commands/config/clear.js +21 -0
  13. package/dist/cli/commands/config/get.d.ts +13 -0
  14. package/dist/cli/commands/config/get.js +41 -0
  15. package/dist/cli/commands/config/index.d.ts +13 -0
  16. package/dist/cli/commands/config/index.js +118 -0
  17. package/dist/cli/commands/config/set.d.ts +14 -0
  18. package/dist/cli/commands/config/set.js +50 -0
  19. package/dist/cli/commands/config/unset.d.ts +13 -0
  20. package/dist/cli/commands/config/unset.js +35 -0
  21. package/dist/cli/commands/daemon/index.d.ts +13 -0
  22. package/dist/cli/commands/daemon/index.js +65 -0
  23. package/dist/cli/commands/daemon/logs.d.ts +13 -0
  24. package/dist/cli/commands/daemon/logs.js +78 -0
  25. package/dist/cli/commands/daemon/restart.d.ts +13 -0
  26. package/dist/cli/commands/daemon/restart.js +177 -0
  27. package/dist/cli/commands/daemon/start.d.ts +13 -0
  28. package/dist/cli/commands/daemon/start.js +193 -0
  29. package/dist/cli/commands/daemon/status.d.ts +13 -0
  30. package/dist/cli/commands/daemon/status.js +93 -0
  31. package/dist/cli/commands/daemon/stop.d.ts +13 -0
  32. package/dist/cli/commands/daemon/stop.js +108 -0
  33. package/dist/cli/commands/init.d.ts +44 -0
  34. package/dist/cli/commands/init.js +459 -0
  35. package/dist/cli/commands/mcp/add.d.ts +26 -0
  36. package/dist/cli/commands/mcp/add.js +162 -0
  37. package/dist/cli/commands/mcp/list.d.ts +16 -0
  38. package/dist/cli/commands/mcp/list.js +89 -0
  39. package/dist/cli/commands/mcp/remove.d.ts +17 -0
  40. package/dist/cli/commands/mcp/remove.js +86 -0
  41. package/dist/cli/commands/mcp/show.d.ts +14 -0
  42. package/dist/cli/commands/mcp/show.js +131 -0
  43. package/dist/cli/commands/repo/add.d.ts +16 -0
  44. package/dist/cli/commands/repo/add.js +105 -0
  45. package/dist/cli/commands/repo/list.d.ts +17 -0
  46. package/dist/cli/commands/repo/list.js +99 -0
  47. package/dist/cli/commands/repo/rm.d.ts +17 -0
  48. package/dist/cli/commands/repo/rm.js +126 -0
  49. package/dist/cli/commands/repo/worktree/add.d.ts +21 -0
  50. package/dist/cli/commands/repo/worktree/add.js +145 -0
  51. package/dist/cli/commands/repo/worktree/list.d.ts +21 -0
  52. package/dist/cli/commands/repo/worktree/list.js +136 -0
  53. package/dist/cli/commands/session/list.d.ts +30 -0
  54. package/dist/cli/commands/session/list.js +204 -0
  55. package/dist/cli/commands/session/load-claude.d.ts +16 -0
  56. package/dist/cli/commands/session/load-claude.js +211 -0
  57. package/dist/cli/commands/user/create-admin.d.ts +13 -0
  58. package/dist/cli/commands/user/create-admin.js +65 -0
  59. package/dist/cli/commands/user/create.d.ts +16 -0
  60. package/dist/cli/commands/user/create.js +126 -0
  61. package/dist/cli/commands/user/delete.d.ts +16 -0
  62. package/dist/cli/commands/user/delete.js +77 -0
  63. package/dist/cli/commands/user/list.d.ts +13 -0
  64. package/dist/cli/commands/user/list.js +78 -0
  65. package/dist/cli/commands/user/update.d.ts +19 -0
  66. package/dist/cli/commands/user/update.js +149 -0
  67. package/dist/cli/hooks/command-not-found.d.ts +9 -0
  68. package/dist/cli/hooks/command-not-found.js +14 -0
  69. package/dist/cli/lib/banner.d.ts +25 -0
  70. package/dist/cli/lib/banner.js +25 -0
  71. package/dist/cli/lib/context.d.ts +27 -0
  72. package/dist/cli/lib/context.js +32 -0
  73. package/dist/cli/lib/daemon-manager.d.ts +48 -0
  74. package/dist/cli/lib/daemon-manager.js +109 -0
  75. package/dist/cli/lib/help.d.ts +13 -0
  76. package/dist/cli/lib/help.js +46 -0
  77. package/dist/core/agentic-tool-B_gFNpk5.d.ts +33 -0
  78. package/dist/core/agentic-tool-DsyX8diw.d.cts +33 -0
  79. package/dist/core/api/index.cjs +98 -0
  80. package/dist/core/api/index.d.cts +174 -0
  81. package/dist/core/api/index.d.ts +174 -0
  82. package/dist/core/api/index.js +62 -0
  83. package/dist/core/board-comment-BUm0fpmD.d.cts +134 -0
  84. package/dist/core/board-comment-gC_-twPx.d.ts +134 -0
  85. package/dist/core/claude/index.cjs +673 -0
  86. package/dist/core/claude/index.d.cts +124 -0
  87. package/dist/core/claude/index.d.ts +124 -0
  88. package/dist/core/claude/index.js +629 -0
  89. package/dist/core/config/browser.cjs +165 -0
  90. package/dist/core/config/browser.d.cts +289 -0
  91. package/dist/core/config/browser.d.ts +289 -0
  92. package/dist/core/config/browser.js +131 -0
  93. package/dist/core/config/index.cjs +518 -0
  94. package/dist/core/config/index.d.cts +246 -0
  95. package/dist/core/config/index.d.ts +246 -0
  96. package/dist/core/config/index.js +451 -0
  97. package/dist/core/db/index.cjs +3726 -0
  98. package/dist/core/db/index.d.cts +631 -0
  99. package/dist/core/db/index.d.ts +631 -0
  100. package/dist/core/db/index.js +3649 -0
  101. package/dist/core/dist/agentic-tool-B_gFNpk5.d.ts +33 -0
  102. package/dist/core/dist/agentic-tool-DsyX8diw.d.cts +33 -0
  103. package/dist/core/dist/api/index.cjs +98 -0
  104. package/dist/core/dist/api/index.d.cts +174 -0
  105. package/dist/core/dist/api/index.d.ts +174 -0
  106. package/dist/core/dist/api/index.js +62 -0
  107. package/dist/core/dist/board-comment-BUm0fpmD.d.cts +134 -0
  108. package/dist/core/dist/board-comment-gC_-twPx.d.ts +134 -0
  109. package/dist/core/dist/claude/index.cjs +673 -0
  110. package/dist/core/dist/claude/index.d.cts +124 -0
  111. package/dist/core/dist/claude/index.d.ts +124 -0
  112. package/dist/core/dist/claude/index.js +629 -0
  113. package/dist/core/dist/config/browser.cjs +165 -0
  114. package/dist/core/dist/config/browser.d.cts +289 -0
  115. package/dist/core/dist/config/browser.d.ts +289 -0
  116. package/dist/core/dist/config/browser.js +131 -0
  117. package/dist/core/dist/config/index.cjs +518 -0
  118. package/dist/core/dist/config/index.d.cts +246 -0
  119. package/dist/core/dist/config/index.d.ts +246 -0
  120. package/dist/core/dist/config/index.js +451 -0
  121. package/dist/core/dist/db/index.cjs +3726 -0
  122. package/dist/core/dist/db/index.d.cts +631 -0
  123. package/dist/core/dist/db/index.d.ts +631 -0
  124. package/dist/core/dist/db/index.js +3649 -0
  125. package/dist/core/dist/environment/variable-resolver.cjs +92 -0
  126. package/dist/core/dist/environment/variable-resolver.d.cts +52 -0
  127. package/dist/core/dist/environment/variable-resolver.d.ts +52 -0
  128. package/dist/core/dist/environment/variable-resolver.js +53 -0
  129. package/dist/core/dist/feathers/index.cjs +66 -0
  130. package/dist/core/dist/feathers/index.d.cts +7 -0
  131. package/dist/core/dist/feathers/index.d.ts +7 -0
  132. package/dist/core/dist/feathers/index.js +25 -0
  133. package/dist/core/dist/feathers-BzHEPnpl.d.cts +228 -0
  134. package/dist/core/dist/feathers-BzHEPnpl.d.ts +228 -0
  135. package/dist/core/dist/git/index.cjs +302 -0
  136. package/dist/core/dist/git/index.d.cts +137 -0
  137. package/dist/core/dist/git/index.d.ts +137 -0
  138. package/dist/core/dist/git/index.js +260 -0
  139. package/dist/core/dist/id-DMqyogFB.d.cts +131 -0
  140. package/dist/core/dist/id-DMqyogFB.d.ts +131 -0
  141. package/dist/core/dist/index.cjs +4653 -0
  142. package/dist/core/dist/index.d.cts +23 -0
  143. package/dist/core/dist/index.d.ts +23 -0
  144. package/dist/core/dist/index.js +4509 -0
  145. package/dist/core/dist/message-BoxZISHg.d.cts +120 -0
  146. package/dist/core/dist/message-DvBzHu7V.d.ts +120 -0
  147. package/dist/core/dist/permissions/index.cjs +112 -0
  148. package/dist/core/dist/permissions/index.d.cts +81 -0
  149. package/dist/core/dist/permissions/index.d.ts +81 -0
  150. package/dist/core/dist/permissions/index.js +85 -0
  151. package/dist/core/dist/repo-3CUrCRbq.d.cts +405 -0
  152. package/dist/core/dist/repo-CnvJ0B6-.d.ts +405 -0
  153. package/dist/core/dist/session-BPjJlVdZ.d.cts +429 -0
  154. package/dist/core/dist/session-wAzjHatv.d.ts +429 -0
  155. package/dist/core/dist/task-BIEgT1DK.d.cts +163 -0
  156. package/dist/core/dist/task-DuIfiUbW.d.ts +163 -0
  157. package/dist/core/dist/templates/handlebars-helpers.cjs +156 -0
  158. package/dist/core/dist/templates/handlebars-helpers.d.cts +45 -0
  159. package/dist/core/dist/templates/handlebars-helpers.d.ts +45 -0
  160. package/dist/core/dist/templates/handlebars-helpers.js +119 -0
  161. package/dist/core/dist/tools/claude/models.cjs +70 -0
  162. package/dist/core/dist/tools/claude/models.d.cts +27 -0
  163. package/dist/core/dist/tools/claude/models.d.ts +27 -0
  164. package/dist/core/dist/tools/claude/models.js +44 -0
  165. package/dist/core/dist/tools/index.cjs +3367 -0
  166. package/dist/core/dist/tools/index.d.cts +967 -0
  167. package/dist/core/dist/tools/index.d.ts +967 -0
  168. package/dist/core/dist/tools/index.js +3314 -0
  169. package/dist/core/dist/tools/models.cjs +119 -0
  170. package/dist/core/dist/tools/models.d.cts +47 -0
  171. package/dist/core/dist/tools/models.d.ts +47 -0
  172. package/dist/core/dist/tools/models.js +86 -0
  173. package/dist/core/dist/types/index.cjs +152 -0
  174. package/dist/core/dist/types/index.d.cts +214 -0
  175. package/dist/core/dist/types/index.d.ts +214 -0
  176. package/dist/core/dist/types/index.js +112 -0
  177. package/dist/core/dist/user-BmL3kFol.d.ts +50 -0
  178. package/dist/core/dist/user-eUuKj7yM.d.cts +50 -0
  179. package/dist/core/dist/utils/pricing.cjs +102 -0
  180. package/dist/core/dist/utils/pricing.d.cts +43 -0
  181. package/dist/core/dist/utils/pricing.d.ts +43 -0
  182. package/dist/core/dist/utils/pricing.js +75 -0
  183. package/dist/core/dist/worktrees-BzIxB1U6.d.cts +2745 -0
  184. package/dist/core/dist/worktrees-CYem1ya2.d.ts +2745 -0
  185. package/dist/core/environment/variable-resolver.cjs +92 -0
  186. package/dist/core/environment/variable-resolver.d.cts +52 -0
  187. package/dist/core/environment/variable-resolver.d.ts +52 -0
  188. package/dist/core/environment/variable-resolver.js +53 -0
  189. package/dist/core/feathers/index.cjs +66 -0
  190. package/dist/core/feathers/index.d.cts +7 -0
  191. package/dist/core/feathers/index.d.ts +7 -0
  192. package/dist/core/feathers/index.js +25 -0
  193. package/dist/core/feathers-BzHEPnpl.d.cts +228 -0
  194. package/dist/core/feathers-BzHEPnpl.d.ts +228 -0
  195. package/dist/core/git/index.cjs +302 -0
  196. package/dist/core/git/index.d.cts +137 -0
  197. package/dist/core/git/index.d.ts +137 -0
  198. package/dist/core/git/index.js +260 -0
  199. package/dist/core/id-DMqyogFB.d.cts +131 -0
  200. package/dist/core/id-DMqyogFB.d.ts +131 -0
  201. package/dist/core/index.cjs +4653 -0
  202. package/dist/core/index.d.cts +23 -0
  203. package/dist/core/index.d.ts +23 -0
  204. package/dist/core/index.js +4509 -0
  205. package/dist/core/message-BoxZISHg.d.cts +120 -0
  206. package/dist/core/message-DvBzHu7V.d.ts +120 -0
  207. package/dist/core/package.json +133 -0
  208. package/dist/core/permissions/index.cjs +112 -0
  209. package/dist/core/permissions/index.d.cts +81 -0
  210. package/dist/core/permissions/index.d.ts +81 -0
  211. package/dist/core/permissions/index.js +85 -0
  212. package/dist/core/repo-3CUrCRbq.d.cts +405 -0
  213. package/dist/core/repo-CnvJ0B6-.d.ts +405 -0
  214. package/dist/core/session-BPjJlVdZ.d.cts +429 -0
  215. package/dist/core/session-wAzjHatv.d.ts +429 -0
  216. package/dist/core/task-BIEgT1DK.d.cts +163 -0
  217. package/dist/core/task-DuIfiUbW.d.ts +163 -0
  218. package/dist/core/templates/handlebars-helpers.cjs +156 -0
  219. package/dist/core/templates/handlebars-helpers.d.cts +45 -0
  220. package/dist/core/templates/handlebars-helpers.d.ts +45 -0
  221. package/dist/core/templates/handlebars-helpers.js +119 -0
  222. package/dist/core/tools/claude/models.cjs +70 -0
  223. package/dist/core/tools/claude/models.d.cts +27 -0
  224. package/dist/core/tools/claude/models.d.ts +27 -0
  225. package/dist/core/tools/claude/models.js +44 -0
  226. package/dist/core/tools/index.cjs +3367 -0
  227. package/dist/core/tools/index.d.cts +967 -0
  228. package/dist/core/tools/index.d.ts +967 -0
  229. package/dist/core/tools/index.js +3314 -0
  230. package/dist/core/tools/models.cjs +119 -0
  231. package/dist/core/tools/models.d.cts +47 -0
  232. package/dist/core/tools/models.d.ts +47 -0
  233. package/dist/core/tools/models.js +86 -0
  234. package/dist/core/types/index.cjs +152 -0
  235. package/dist/core/types/index.d.cts +214 -0
  236. package/dist/core/types/index.d.ts +214 -0
  237. package/dist/core/types/index.js +112 -0
  238. package/dist/core/user-BmL3kFol.d.ts +50 -0
  239. package/dist/core/user-eUuKj7yM.d.cts +50 -0
  240. package/dist/core/utils/pricing.cjs +102 -0
  241. package/dist/core/utils/pricing.d.cts +43 -0
  242. package/dist/core/utils/pricing.d.ts +43 -0
  243. package/dist/core/utils/pricing.js +75 -0
  244. package/dist/core/worktrees-BzIxB1U6.d.cts +2745 -0
  245. package/dist/core/worktrees-CYem1ya2.d.ts +2745 -0
  246. package/dist/daemon/adapters/drizzle.d.ts +114 -0
  247. package/dist/daemon/adapters/drizzle.js +219 -0
  248. package/dist/daemon/declarations.d.ts +101 -0
  249. package/dist/daemon/declarations.js +0 -0
  250. package/dist/daemon/index.d.ts +2 -0
  251. package/dist/daemon/index.js +4093 -0
  252. package/dist/daemon/mcp/routes.d.ts +15 -0
  253. package/dist/daemon/mcp/routes.js +641 -0
  254. package/dist/daemon/mcp/tokens.d.ts +50 -0
  255. package/dist/daemon/mcp/tokens.js +85 -0
  256. package/dist/daemon/services/board-comments.d.ts +97 -0
  257. package/dist/daemon/services/board-comments.js +326 -0
  258. package/dist/daemon/services/board-objects.d.ts +71 -0
  259. package/dist/daemon/services/board-objects.js +117 -0
  260. package/dist/daemon/services/boards.d.ts +64 -0
  261. package/dist/daemon/services/boards.js +286 -0
  262. package/dist/daemon/services/config.d.ts +35 -0
  263. package/dist/daemon/services/config.js +68 -0
  264. package/dist/daemon/services/context.d.ts +55 -0
  265. package/dist/daemon/services/context.js +113 -0
  266. package/dist/daemon/services/health-monitor.d.ts +58 -0
  267. package/dist/daemon/services/health-monitor.js +158 -0
  268. package/dist/daemon/services/mcp-servers.d.ts +42 -0
  269. package/dist/daemon/services/mcp-servers.js +275 -0
  270. package/dist/daemon/services/messages.d.ts +49 -0
  271. package/dist/daemon/services/messages.js +269 -0
  272. package/dist/daemon/services/repos.d.ts +61 -0
  273. package/dist/daemon/services/repos.js +350 -0
  274. package/dist/daemon/services/session-mcp-servers.d.ts +56 -0
  275. package/dist/daemon/services/session-mcp-servers.js +51 -0
  276. package/dist/daemon/services/sessions.d.ts +64 -0
  277. package/dist/daemon/services/sessions.js +398 -0
  278. package/dist/daemon/services/tasks.d.ts +55 -0
  279. package/dist/daemon/services/tasks.js +318 -0
  280. package/dist/daemon/services/terminals.d.ts +75 -0
  281. package/dist/daemon/services/terminals.js +110 -0
  282. package/dist/daemon/services/users.d.ts +98 -0
  283. package/dist/daemon/services/users.js +177 -0
  284. package/dist/daemon/services/worktrees.d.ts +98 -0
  285. package/dist/daemon/services/worktrees.js +719 -0
  286. package/dist/daemon/strategies/anonymous.d.ts +20 -0
  287. package/dist/daemon/strategies/anonymous.js +32 -0
  288. package/dist/ui/assets/cc-CYmbalCD.png +0 -0
  289. package/dist/ui/assets/codex-4sLD1mVS.png +0 -0
  290. package/dist/ui/assets/cursor-BUy5pFVL.png +0 -0
  291. package/dist/ui/assets/gemini-ajOb7iAl.png +0 -0
  292. package/dist/ui/assets/index-Dc4ELxry.css +32 -0
  293. package/dist/ui/assets/index-KfIu8v4V.js +578 -0
  294. package/dist/ui/favicon.png +0 -0
  295. package/dist/ui/index.html +26 -0
  296. package/dist/ui/vite.svg +1 -0
  297. package/package.json +90 -0
@@ -0,0 +1,967 @@
1
+ import { d as Message, M as MessageRole } from '../message-BoxZISHg.cjs';
2
+ import { M as MessageID, a as SessionID, T as TaskID } from '../id-DMqyogFB.cjs';
3
+ import { PermissionMode } from '@anthropic-ai/claude-agent-sdk';
4
+ import { f as MessagesRepository, g as SessionRepository, S as SessionMCPServerRepository, M as MCPServerRepository, W as WorktreeRepository } from '../worktrees-BzIxB1U6.cjs';
5
+ import { PermissionService } from '../permissions/index.cjs';
6
+ import { TokenUsage } from '../utils/pricing.cjs';
7
+ import { T as TaskStatus, e as Task } from '../task-BIEgT1DK.cjs';
8
+ export { AVAILABLE_CLAUDE_MODEL_ALIASES, ClaudeModel, DEFAULT_CLAUDE_MODEL } from './claude/models.cjs';
9
+ import { P as PermissionMode$1 } from '../session-BPjJlVdZ.cjs';
10
+ export { CODEX_MINI_MODEL, CODEX_MODELS, DEFAULT_CODEX_MODEL, DEFAULT_GEMINI_MODEL, GEMINI_MODELS, GeminiModel } from './models.cjs';
11
+ import '../repo-3CUrCRbq.cjs';
12
+ import 'drizzle-orm/libsql';
13
+ import 'drizzle-orm/sqlite-core';
14
+ import '../agentic-tool-DsyX8diw.cjs';
15
+
16
+ /**
17
+ * Tool Types - Base types for agentic coding tools
18
+ *
19
+ * Tools: External agentic coding products (Claude Code, Cursor, Codex, Gemini)
20
+ * Not to be confused with AI agents (internal personas)
21
+ */
22
+
23
+ /**
24
+ * Supported tool types
25
+ */
26
+ type ToolType = 'claude-code' | 'cursor' | 'codex' | 'gemini';
27
+ /**
28
+ * Streaming callback interface for agents that support real-time streaming
29
+ *
30
+ * Agents call these callbacks during message generation to provide progressive updates.
31
+ * If agent doesn't support streaming, it simply calls messagesService.create() at end.
32
+ *
33
+ * Example usage:
34
+ * ```typescript
35
+ * streamingCallbacks.onStreamStart(messageId, { session_id, task_id, role, timestamp });
36
+ * // ... stream chunks ...
37
+ * streamingCallbacks.onStreamChunk(messageId, "Hello world");
38
+ * streamingCallbacks.onStreamEnd(messageId);
39
+ * // Then MANDATORY: messagesService.create() with full message
40
+ * ```
41
+ */
42
+ interface StreamingCallbacks {
43
+ /**
44
+ * Called when message streaming starts
45
+ *
46
+ * @param messageId - Unique ID for this message (agent generates via uuidv7)
47
+ * @param metadata - Initial metadata (role, timestamp, etc.)
48
+ */
49
+ onStreamStart(messageId: MessageID, metadata: {
50
+ session_id: SessionID;
51
+ task_id?: TaskID;
52
+ role: MessageRole.ASSISTANT;
53
+ timestamp: string;
54
+ }): void;
55
+ /**
56
+ * Called for each chunk of streamed content
57
+ *
58
+ * Recommended chunk size: 3-10 words for optimal UX/performance balance.
59
+ * Buffer tokens and flush at sentence boundaries (., !, ?, \n\n) or word count threshold.
60
+ *
61
+ * @param messageId - Message being streamed
62
+ * @param chunk - Text chunk (3-10 words recommended)
63
+ */
64
+ onStreamChunk(messageId: MessageID, chunk: string): void;
65
+ /**
66
+ * Called when streaming completes successfully
67
+ *
68
+ * IMPORTANT: Agent must still call messagesService.create() with full message after this!
69
+ * This is just a signal to clean up streaming UI state.
70
+ *
71
+ * @param messageId - Message that finished streaming
72
+ */
73
+ onStreamEnd(messageId: MessageID): void;
74
+ /**
75
+ * Called if streaming encounters an error
76
+ *
77
+ * @param messageId - Message that failed
78
+ * @param error - Error that occurred
79
+ */
80
+ onStreamError(messageId: MessageID, error: Error): void;
81
+ }
82
+ /**
83
+ * Tool capabilities - feature flags for what each tool supports
84
+ */
85
+ interface ToolCapabilities {
86
+ /** Can import historical sessions from tool's storage */
87
+ supportsSessionImport: boolean;
88
+ /** Can create new sessions via SDK/API */
89
+ supportsSessionCreate: boolean;
90
+ /** Can send prompts and receive responses */
91
+ supportsLiveExecution: boolean;
92
+ /** Can fork sessions at specific points */
93
+ supportsSessionFork: boolean;
94
+ /** Can spawn child sessions for subsessions */
95
+ supportsChildSpawn: boolean;
96
+ /** Tracks git state natively */
97
+ supportsGitState: boolean;
98
+ /**
99
+ * Streams responses in real-time (optional UX enhancement)
100
+ *
101
+ * If true, tool will use StreamingCallbacks during executeTask() to provide
102
+ * progressive updates. If false, tool will execute synchronously and return
103
+ * complete message.
104
+ *
105
+ * All tools MUST call messagesService.create() with complete message regardless
106
+ * of streaming support - streaming is purely optional progressive UX.
107
+ */
108
+ supportsStreaming: boolean;
109
+ }
110
+ /**
111
+ * Options for importing sessions
112
+ */
113
+ interface ImportOptions {
114
+ /** Project directory (for tools that organize by project) */
115
+ projectDir?: string;
116
+ /** Additional tool-specific options */
117
+ [key: string]: unknown;
118
+ }
119
+ /**
120
+ * Configuration for creating new sessions
121
+ */
122
+ interface CreateSessionConfig {
123
+ /** Initial prompt to send */
124
+ initialPrompt?: string;
125
+ /** Working directory for the session */
126
+ workingDirectory?: string;
127
+ /** Git reference (branch/commit) to start from */
128
+ gitRef?: string;
129
+ /** Concepts to inject as context */
130
+ concepts?: string[];
131
+ /** Additional tool-specific config */
132
+ [key: string]: unknown;
133
+ }
134
+ /**
135
+ * Session handle - minimal identifier returned after creation/import
136
+ */
137
+ interface SessionHandle {
138
+ sessionId: string;
139
+ toolType: ToolType;
140
+ }
141
+ /**
142
+ * Session data - rich data from import
143
+ */
144
+ interface SessionData extends SessionHandle {
145
+ messages: Message[];
146
+ metadata: SessionMetadata;
147
+ workingDirectory?: string;
148
+ }
149
+ /**
150
+ * Session metadata
151
+ */
152
+ interface SessionMetadata {
153
+ sessionId: string;
154
+ toolType: ToolType;
155
+ status: 'active' | 'idle' | 'completed' | 'failed';
156
+ createdAt: Date;
157
+ lastUpdatedAt: Date;
158
+ workingDirectory?: string;
159
+ gitState?: {
160
+ ref: string;
161
+ baseSha: string;
162
+ currentSha: string;
163
+ };
164
+ messageCount?: number;
165
+ taskCount?: number;
166
+ }
167
+ /**
168
+ * Task execution result
169
+ */
170
+ interface TaskResult {
171
+ taskId: string;
172
+ status: 'completed' | 'failed' | 'cancelled';
173
+ messages: Message[];
174
+ error?: Error;
175
+ completedAt: Date;
176
+ }
177
+ /**
178
+ * Message range for querying messages
179
+ */
180
+ interface MessageRange {
181
+ startIndex?: number;
182
+ endIndex?: number;
183
+ limit?: number;
184
+ }
185
+
186
+ /**
187
+ * ITool - Base interface for agentic coding tool integrations
188
+ *
189
+ * Single unified interface for all tool interactions.
190
+ * Methods are optional based on tool capabilities.
191
+ *
192
+ * Design philosophy:
193
+ * - Functionality-oriented (what you can DO)
194
+ * - Optional methods based on capabilities
195
+ * - Start simple, expand as we learn from multiple tools
196
+ * - Don't split into Client/Session unless runtime separation is clear
197
+ */
198
+
199
+ interface ITool {
200
+ /** Tool type identifier */
201
+ readonly toolType: ToolType;
202
+ /** Human-readable tool name */
203
+ readonly name: string;
204
+ /**
205
+ * Get tool capabilities (feature flags)
206
+ */
207
+ getCapabilities(): ToolCapabilities;
208
+ /**
209
+ * Check if tool is installed and accessible
210
+ */
211
+ checkInstalled(): Promise<boolean>;
212
+ /**
213
+ * Import existing session from tool's storage
214
+ *
215
+ * Example: Load Claude Code session from ~/.claude/projects/
216
+ *
217
+ * @param sessionId - Tool's session identifier
218
+ * @param options - Import options (e.g., project directory)
219
+ * @returns Rich session data with messages and metadata
220
+ */
221
+ importSession?(sessionId: string, options?: ImportOptions): Promise<SessionData>;
222
+ /**
223
+ * Create new session via SDK/API
224
+ *
225
+ * @param config - Session configuration
226
+ * @returns Session handle (minimal identifier)
227
+ */
228
+ createSession?(config: CreateSessionConfig): Promise<SessionHandle>;
229
+ /**
230
+ * Execute task (send prompt) in existing session
231
+ *
232
+ * CONTRACT:
233
+ * - MANDATORY: Must call messagesService.create() with complete message when done
234
+ * - MANDATORY: Complete message automatically broadcasts via FeathersJS
235
+ * - OPTIONAL: If supportsStreaming=true, may call streamingCallbacks during execution
236
+ *
237
+ * STREAMING:
238
+ * - If streamingCallbacks provided AND supportsStreaming=true:
239
+ * - Call onStreamStart() before generating
240
+ * - Call onStreamChunk() for each 3-10 word chunk
241
+ * - Call onStreamEnd() after generating
242
+ * - Then create complete message in DB
243
+ * - If streamingCallbacks not provided OR supportsStreaming=false:
244
+ * - Execute synchronously
245
+ * - Create complete message in DB
246
+ * - User sees loading spinner, then full message
247
+ *
248
+ * @param sessionId - Session identifier
249
+ * @param prompt - User prompt
250
+ * @param taskId - Task identifier (for linking messages)
251
+ * @param streamingCallbacks - Optional callbacks for real-time streaming (ignored if !supportsStreaming)
252
+ * @returns Task result with message IDs
253
+ */
254
+ executeTask?(sessionId: string, prompt: string, taskId?: string, streamingCallbacks?: StreamingCallbacks): Promise<TaskResult>;
255
+ /**
256
+ * Get session metadata
257
+ */
258
+ getSessionMetadata?(sessionId: string): Promise<SessionMetadata>;
259
+ /**
260
+ * Get messages from session
261
+ */
262
+ getSessionMessages?(sessionId: string, range?: MessageRange): Promise<Message[]>;
263
+ /**
264
+ * List all available sessions
265
+ */
266
+ listSessions?(): Promise<SessionMetadata[]>;
267
+ /**
268
+ * Fork session at specific message index
269
+ *
270
+ * Creates divergent exploration path
271
+ */
272
+ forkSession?(sessionId: string, atMessageIndex?: number): Promise<SessionHandle>;
273
+ /**
274
+ * Spawn child session for subsession
275
+ *
276
+ * Creates focused subsession session with minimal context
277
+ */
278
+ spawnChildSession?(parentSessionId: string, prompt: string): Promise<SessionHandle>;
279
+ /**
280
+ * Stop currently executing task in session
281
+ *
282
+ * Gracefully terminates the agent's current execution.
283
+ * Implementation varies by SDK:
284
+ * - Claude Agent SDK: Call interrupt() on Query object
285
+ * - Gemini SDK: Call abort() on AbortController
286
+ * - Codex SDK: Set stop flag and break event loop
287
+ *
288
+ * @param sessionId - Session identifier
289
+ * @param taskId - Optional task ID to stop (if multiple tasks running)
290
+ * @returns Success status and partial results if available
291
+ */
292
+ stopTask?(sessionId: string, taskId?: string): Promise<{
293
+ success: boolean;
294
+ partialResult?: Partial<TaskResult>;
295
+ reason?: string;
296
+ }>;
297
+ }
298
+
299
+ /**
300
+ * Service interface for creating messages via FeathersJS
301
+ * This ensures WebSocket events are emitted when messages are created
302
+ */
303
+ interface MessagesService {
304
+ create(data: Partial<Message>): Promise<Message>;
305
+ }
306
+ /**
307
+ * Service interface for updating tasks via FeathersJS
308
+ * This ensures WebSocket events are emitted when tasks are updated
309
+ */
310
+ interface TasksService {
311
+ get(id: string): Promise<any>;
312
+ patch(id: string, data: Partial<any>): Promise<any>;
313
+ emit(event: string, data: any): void;
314
+ }
315
+ /**
316
+ * Service interface for updating sessions via FeathersJS
317
+ * This ensures WebSocket events are emitted when sessions are updated (e.g., permission config)
318
+ */
319
+ interface SessionsService {
320
+ patch(id: string, data: Partial<any>): Promise<any>;
321
+ }
322
+ declare class ClaudeTool implements ITool {
323
+ private messagesRepo?;
324
+ private sessionsRepo?;
325
+ private messagesService?;
326
+ private tasksService?;
327
+ readonly toolType: "claude-code";
328
+ readonly name = "Claude Code";
329
+ private promptService?;
330
+ constructor(messagesRepo?: MessagesRepository | undefined, sessionsRepo?: SessionRepository | undefined, apiKey?: string, messagesService?: MessagesService | undefined, sessionMCPRepo?: SessionMCPServerRepository, mcpServerRepo?: MCPServerRepository, permissionService?: PermissionService, tasksService?: TasksService | undefined, sessionsService?: SessionsService, worktreesRepo?: WorktreeRepository);
331
+ getCapabilities(): ToolCapabilities;
332
+ checkInstalled(): Promise<boolean>;
333
+ importSession(sessionId: string, options?: ImportOptions): Promise<SessionData>;
334
+ /**
335
+ * Execute a prompt against a session WITH real-time streaming
336
+ *
337
+ * Creates user message, streams response chunks from Claude, then creates complete assistant messages.
338
+ * Calls streamingCallbacks during message generation for real-time UI updates.
339
+ * Agent SDK may return multiple assistant messages (e.g., tool invocation, then response).
340
+ *
341
+ * @param sessionId - Session to execute prompt in
342
+ * @param prompt - User prompt text
343
+ * @param taskId - Optional task ID for linking messages
344
+ * @param permissionMode - Optional permission mode for SDK
345
+ * @param streamingCallbacks - Optional callbacks for real-time streaming (enables typewriter effect)
346
+ * @returns User message ID and array of assistant message IDs
347
+ */
348
+ executePromptWithStreaming(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode, streamingCallbacks?: StreamingCallbacks): Promise<{
349
+ userMessageId: MessageID;
350
+ assistantMessageIds: MessageID[];
351
+ tokenUsage?: TokenUsage;
352
+ durationMs?: number;
353
+ agentSessionId?: string;
354
+ contextWindow?: number;
355
+ contextWindowLimit?: number;
356
+ }>;
357
+ /**
358
+ * Create user message in database (from text prompt)
359
+ * @private
360
+ */
361
+ private createUserMessage;
362
+ /**
363
+ * Create user message from SDK content (tool results, etc.)
364
+ * @private
365
+ */
366
+ private createUserMessageFromContent;
367
+ /**
368
+ * Capture and store Agent SDK session_id for conversation continuity
369
+ * @private
370
+ */
371
+ private captureAgentSessionId;
372
+ /**
373
+ * Create complete assistant message in database
374
+ * @private
375
+ */
376
+ private createAssistantMessage;
377
+ /**
378
+ * Execute a prompt against a session (non-streaming version)
379
+ *
380
+ * Creates user message, streams response from Claude, creates assistant messages.
381
+ * Agent SDK may return multiple assistant messages (e.g., tool invocation, then response).
382
+ * Returns user message ID and array of assistant message IDs.
383
+ *
384
+ * Also captures and stores the Agent SDK session_id for conversation continuity.
385
+ */
386
+ executePrompt(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode): Promise<{
387
+ userMessageId: MessageID;
388
+ assistantMessageIds: MessageID[];
389
+ tokenUsage?: TokenUsage;
390
+ durationMs?: number;
391
+ agentSessionId?: string;
392
+ contextWindow?: number;
393
+ contextWindowLimit?: number;
394
+ }>;
395
+ /**
396
+ * Stop currently executing task in session
397
+ *
398
+ * Uses Claude Agent SDK's native interrupt() method to gracefully stop execution.
399
+ *
400
+ * @param sessionId - Session identifier
401
+ * @param taskId - Optional task ID (not used for Claude, session-level stop)
402
+ * @returns Success status and reason if failed
403
+ */
404
+ stopTask(sessionId: string, taskId?: string): Promise<{
405
+ success: boolean;
406
+ partialResult?: Partial<{
407
+ taskId: string;
408
+ status: 'completed' | 'failed' | 'cancelled';
409
+ }>;
410
+ reason?: string;
411
+ }>;
412
+ }
413
+
414
+ /**
415
+ * Claude Code transcript parser
416
+ *
417
+ * Parses JSONL transcript files from ~/.claude/projects/
418
+ */
419
+ interface TranscriptMessage {
420
+ type: 'user' | 'assistant' | 'system' | 'file-history-snapshot';
421
+ uuid?: string;
422
+ sessionId?: string;
423
+ timestamp?: string;
424
+ parentUuid?: string | null;
425
+ cwd?: string;
426
+ gitBranch?: string;
427
+ version?: string;
428
+ message?: {
429
+ role: string;
430
+ content: string | Array<{
431
+ type: string;
432
+ [key: string]: unknown;
433
+ }>;
434
+ };
435
+ isMeta?: boolean;
436
+ isSidechain?: boolean;
437
+ messageId?: string;
438
+ snapshot?: unknown;
439
+ isSnapshotUpdate?: boolean;
440
+ }
441
+ /**
442
+ * Get transcript file path for a session ID
443
+ */
444
+ declare function getTranscriptPath(sessionId: string, projectDir?: string): string;
445
+ /**
446
+ * Parse JSONL transcript file
447
+ */
448
+ declare function parseTranscript(transcriptPath: string): Promise<TranscriptMessage[]>;
449
+ /**
450
+ * Load transcript for a session ID
451
+ */
452
+ declare function loadSessionTranscript(sessionId: string, projectDir?: string): Promise<TranscriptMessage[]>;
453
+ /**
454
+ * Filter transcript messages (exclude meta messages, snapshots, etc.)
455
+ */
456
+ declare function filterConversationMessages(messages: TranscriptMessage[]): TranscriptMessage[];
457
+ /**
458
+ * Build conversation tree from transcript messages
459
+ */
460
+ interface ConversationNode {
461
+ message: TranscriptMessage;
462
+ children: ConversationNode[];
463
+ }
464
+ declare function buildConversationTree(messages: TranscriptMessage[]): ConversationNode[];
465
+
466
+ /**
467
+ * Load Claude Code session by parsing transcript file
468
+ *
469
+ * Strategy:
470
+ * 1. Locate transcript file in ~/.claude/projects/{project-slug}/{session-id}.jsonl
471
+ * 2. Parse the JSONL file to get full message history
472
+ */
473
+
474
+ interface ClaudeSession {
475
+ sessionId: string;
476
+ transcriptPath: string;
477
+ cwd: string | null;
478
+ messages: TranscriptMessage[];
479
+ }
480
+ /**
481
+ * Load a Claude Code session by ID
482
+ *
483
+ * Parses the JSONL transcript file from ~/.claude/projects/
484
+ */
485
+ declare function loadClaudeSession(sessionId: string, projectDir?: string): Promise<ClaudeSession>;
486
+
487
+ /**
488
+ * Convert Claude transcript messages to Agor Message format
489
+ */
490
+
491
+ /**
492
+ * Convert a transcript message to an Agor Message
493
+ */
494
+ declare function transcriptToMessage(transcript: TranscriptMessage, sessionId: SessionID, index: number): Message;
495
+ /**
496
+ * Convert array of transcript messages to Agor Messages
497
+ */
498
+ declare function transcriptsToMessages(transcripts: TranscriptMessage[], sessionId: SessionID): Message[];
499
+
500
+ /**
501
+ * Extract Tasks from Claude Code conversation messages
502
+ *
503
+ * Converts user messages into Task records with message ranges.
504
+ */
505
+
506
+ interface ExtractedTask {
507
+ task_id: string;
508
+ session_id: SessionID;
509
+ full_prompt: string;
510
+ description: string;
511
+ status: typeof TaskStatus.COMPLETED;
512
+ message_range: {
513
+ start_index: number;
514
+ end_index: number;
515
+ start_timestamp: string;
516
+ end_timestamp?: string;
517
+ };
518
+ git_state: {
519
+ sha_at_start: string;
520
+ };
521
+ model: string;
522
+ tool_use_count: number;
523
+ created_at: string;
524
+ completed_at?: string;
525
+ }
526
+ /**
527
+ * Extract tasks from conversation messages
528
+ * Each user message becomes a task with its associated assistant responses
529
+ */
530
+ declare function extractTasksFromMessages(messages: Message[], sessionId: SessionID): Partial<Task>[];
531
+
532
+ /**
533
+ * Session Context Injection
534
+ *
535
+ * Appends Agor-specific context to CLAUDE.md for session awareness.
536
+ * IMPORTANT: Appends to existing CLAUDE.md, does not replace it.
537
+ */
538
+
539
+ /**
540
+ * Generate Agor session context block to append to CLAUDE.md
541
+ */
542
+ declare function generateSessionContext(sessionId: SessionID): string;
543
+ /**
544
+ * Append session context to CLAUDE.md in a worktree
545
+ *
546
+ * CRITICAL: This APPENDS to existing CLAUDE.md, never replaces it!
547
+ * This ensures we don't overwrite the Claude Code system prompt.
548
+ */
549
+ declare function appendSessionContextToCLAUDEmd(worktreePath: string, sessionId: SessionID): Promise<void>;
550
+ /**
551
+ * Remove session context from CLAUDE.md (cleanup)
552
+ */
553
+ declare function removeSessionContextFromCLAUDEmd(worktreePath: string): Promise<void>;
554
+
555
+ /**
556
+ * Codex Tool Implementation
557
+ *
558
+ * Current capabilities:
559
+ * - ✅ Live execution via OpenAI Codex SDK
560
+ * - ❌ Import sessions (deferred - need real session JSONL format)
561
+ * - ❌ Session creation (handled via live execution)
562
+ */
563
+
564
+ declare class CodexTool implements ITool {
565
+ private messagesRepo?;
566
+ private sessionsRepo?;
567
+ private messagesService?;
568
+ private tasksService?;
569
+ readonly toolType: "codex";
570
+ readonly name = "OpenAI Codex";
571
+ private promptService?;
572
+ constructor(messagesRepo?: MessagesRepository | undefined, sessionsRepo?: SessionRepository | undefined, apiKey?: string, messagesService?: MessagesService | undefined, tasksService?: TasksService | undefined);
573
+ getCapabilities(): ToolCapabilities;
574
+ checkInstalled(): Promise<boolean>;
575
+ /**
576
+ * Execute a prompt against a session WITH real-time streaming
577
+ *
578
+ * Creates user message, streams response chunks from Codex, then creates complete assistant messages.
579
+ * Calls streamingCallbacks during message generation for real-time UI updates.
580
+ *
581
+ * @param sessionId - Session to execute prompt in
582
+ * @param prompt - User prompt text
583
+ * @param taskId - Optional task ID for linking messages
584
+ * @param permissionMode - Permission mode for tool execution ('ask' | 'auto' | 'allow-all')
585
+ * @param streamingCallbacks - Optional callbacks for real-time streaming (enables typewriter effect)
586
+ * @returns User message ID and array of assistant message IDs
587
+ */
588
+ executePromptWithStreaming(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode$1, streamingCallbacks?: StreamingCallbacks): Promise<{
589
+ userMessageId: MessageID;
590
+ assistantMessageIds: MessageID[];
591
+ }>;
592
+ /**
593
+ * Create user message in database
594
+ * @private
595
+ */
596
+ private createUserMessage;
597
+ /**
598
+ * Capture and store Codex thread ID for conversation continuity
599
+ * @private
600
+ */
601
+ private captureThreadId;
602
+ /**
603
+ * Create complete assistant message in database
604
+ * @private
605
+ */
606
+ private createAssistantMessage;
607
+ /**
608
+ * Execute a prompt against a session (non-streaming version)
609
+ *
610
+ * Creates user message, collects response from Codex, creates assistant messages.
611
+ * Returns user message ID and array of assistant message IDs.
612
+ *
613
+ * @param sessionId - Session to execute prompt in
614
+ * @param prompt - User prompt text
615
+ * @param taskId - Optional task ID for linking messages
616
+ * @param permissionMode - Permission mode for tool execution ('ask' | 'auto' | 'allow-all')
617
+ */
618
+ executePrompt(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode$1): Promise<{
619
+ userMessageId: MessageID;
620
+ assistantMessageIds: MessageID[];
621
+ }>;
622
+ /**
623
+ * Stop currently executing task in session
624
+ *
625
+ * Uses a flag-based approach to break the event loop on the next iteration.
626
+ *
627
+ * @param sessionId - Session identifier
628
+ * @param taskId - Optional task ID (not used for Codex, session-level stop)
629
+ * @returns Success status and reason if failed
630
+ */
631
+ stopTask(sessionId: string, taskId?: string): Promise<{
632
+ success: boolean;
633
+ partialResult?: Partial<{
634
+ taskId: string;
635
+ status: 'completed' | 'failed' | 'cancelled';
636
+ }>;
637
+ reason?: string;
638
+ }>;
639
+ }
640
+
641
+ /**
642
+ * Codex Prompt Service
643
+ *
644
+ * Handles live execution of prompts against Codex sessions using OpenAI Codex SDK.
645
+ * Wraps the @openai/codex-sdk for thread management and execution.
646
+ */
647
+
648
+ interface CodexPromptResult {
649
+ /** Complete assistant response from Codex */
650
+ messages: Array<{
651
+ content: Array<{
652
+ type: string;
653
+ text?: string;
654
+ id?: string;
655
+ name?: string;
656
+ input?: Record<string, unknown>;
657
+ }>;
658
+ toolUses?: Array<{
659
+ id: string;
660
+ name: string;
661
+ input: Record<string, unknown>;
662
+ }>;
663
+ }>;
664
+ /** Number of input tokens */
665
+ inputTokens: number;
666
+ /** Number of output tokens */
667
+ outputTokens: number;
668
+ /** Agent SDK thread ID for conversation continuity */
669
+ threadId: string;
670
+ }
671
+ /**
672
+ * Streaming event types for Codex execution
673
+ */
674
+ type CodexStreamEvent = {
675
+ type: 'partial';
676
+ textChunk: string;
677
+ threadId?: string;
678
+ resolvedModel?: string;
679
+ } | {
680
+ type: 'tool_start';
681
+ toolUse: {
682
+ id: string;
683
+ name: string;
684
+ input: Record<string, unknown>;
685
+ };
686
+ threadId?: string;
687
+ } | {
688
+ type: 'tool_complete';
689
+ toolUse: {
690
+ id: string;
691
+ name: string;
692
+ input: Record<string, unknown>;
693
+ output?: string;
694
+ status?: string;
695
+ };
696
+ threadId?: string;
697
+ } | {
698
+ type: 'complete';
699
+ content: Array<{
700
+ type: string;
701
+ text?: string;
702
+ id?: string;
703
+ name?: string;
704
+ input?: Record<string, unknown>;
705
+ }>;
706
+ toolUses?: Array<{
707
+ id: string;
708
+ name: string;
709
+ input: Record<string, unknown>;
710
+ }>;
711
+ threadId: string;
712
+ resolvedModel?: string;
713
+ };
714
+ declare class CodexPromptService {
715
+ private sessionsRepo;
716
+ private codex;
717
+ private lastApprovalPolicy;
718
+ private stopRequested;
719
+ constructor(_messagesRepo: MessagesRepository, sessionsRepo: SessionRepository, apiKey?: string);
720
+ /**
721
+ * Generate ~/.codex/config.toml for approval_policy setting
722
+ *
723
+ * NOTE: approval_policy cannot be passed via ThreadOptions, so we must use config.toml.
724
+ * We minimize file writes by tracking the last set value and only updating when it changes.
725
+ */
726
+ private ensureApprovalPolicy;
727
+ /**
728
+ * Convert Codex item to ToolUse format
729
+ * Maps different Codex item types to Agor tool use schema
730
+ */
731
+ private itemToToolUse;
732
+ /**
733
+ * Execute prompt with streaming support
734
+ *
735
+ * Uses Codex SDK's runStreamed() method for real-time event streaming.
736
+ * Yields partial text chunks and complete messages.
737
+ *
738
+ * @param sessionId - Agor session ID
739
+ * @param prompt - User prompt
740
+ * @param taskId - Optional task ID
741
+ * @param permissionMode - Permission mode for tool execution ('ask' | 'auto' | 'allow-all')
742
+ * @returns Async generator of streaming events
743
+ */
744
+ promptSessionStreaming(sessionId: SessionID, prompt: string, _taskId?: TaskID, permissionMode?: PermissionMode$1): AsyncGenerator<CodexStreamEvent>;
745
+ /**
746
+ * Execute prompt (non-streaming version)
747
+ *
748
+ * Collects all streaming events and returns complete result.
749
+ *
750
+ * @param sessionId - Agor session ID
751
+ * @param prompt - User prompt
752
+ * @param taskId - Optional task ID
753
+ * @param permissionMode - Permission mode for tool execution ('ask' | 'auto' | 'allow-all')
754
+ * @returns Complete prompt result
755
+ */
756
+ promptSession(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode$1): Promise<CodexPromptResult>;
757
+ /**
758
+ * Stop currently executing task
759
+ *
760
+ * Sets a stop flag that is checked in the event loop.
761
+ * The loop will break on the next iteration, stopping execution gracefully.
762
+ *
763
+ * @param sessionId - Session identifier
764
+ * @returns Success status
765
+ */
766
+ stopTask(sessionId: SessionID): {
767
+ success: boolean;
768
+ reason?: string;
769
+ };
770
+ }
771
+
772
+ /**
773
+ * Gemini Tool Implementation
774
+ *
775
+ * Current capabilities:
776
+ * - ✅ Live execution via @google/gemini-cli-core SDK
777
+ * - ✅ Token-level streaming with AsyncGenerator
778
+ * - ✅ Permission modes (ask, auto, allow-all)
779
+ * - ✅ Session continuity via setHistory()
780
+ * - ❌ Import sessions (deferred - need checkpoint format)
781
+ * - ❌ Session creation (handled via live execution)
782
+ */
783
+
784
+ declare class GeminiTool implements ITool {
785
+ private messagesRepo?;
786
+ private messagesService?;
787
+ private tasksService?;
788
+ readonly toolType: "gemini";
789
+ readonly name = "Google Gemini";
790
+ private promptService?;
791
+ constructor(messagesRepo?: MessagesRepository | undefined, sessionsRepo?: SessionRepository, apiKey?: string, messagesService?: MessagesService | undefined, tasksService?: TasksService | undefined);
792
+ getCapabilities(): ToolCapabilities;
793
+ checkInstalled(): Promise<boolean>;
794
+ /**
795
+ * Execute a prompt against a session WITH real-time streaming
796
+ *
797
+ * Creates user message, streams response chunks from Gemini, then creates complete assistant messages.
798
+ * Calls streamingCallbacks during message generation for real-time UI updates.
799
+ *
800
+ * @param sessionId - Session to execute prompt in
801
+ * @param prompt - User prompt text
802
+ * @param taskId - Optional task ID for linking messages
803
+ * @param permissionMode - Permission mode for tool execution ('ask' | 'auto' | 'allow-all')
804
+ * @param streamingCallbacks - Optional callbacks for real-time streaming (enables typewriter effect)
805
+ * @returns User message ID and array of assistant message IDs
806
+ */
807
+ executePromptWithStreaming(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode$1, streamingCallbacks?: StreamingCallbacks): Promise<{
808
+ userMessageId: MessageID;
809
+ assistantMessageIds: MessageID[];
810
+ }>;
811
+ /**
812
+ * Create user message in database
813
+ * @private
814
+ */
815
+ private createUserMessage;
816
+ /**
817
+ * Create complete assistant message in database
818
+ * @private
819
+ */
820
+ private createAssistantMessage;
821
+ /**
822
+ * Execute a prompt against a session (non-streaming version)
823
+ *
824
+ * Creates user message, collects response from Gemini, creates assistant messages.
825
+ * Returns user message ID and array of assistant message IDs.
826
+ *
827
+ * @param sessionId - Session to execute prompt in
828
+ * @param prompt - User prompt text
829
+ * @param taskId - Optional task ID for linking messages
830
+ * @param permissionMode - Permission mode for tool execution ('ask' | 'auto' | 'allow-all')
831
+ */
832
+ executePrompt(sessionId: SessionID, prompt: string, taskId?: TaskID, permissionMode?: PermissionMode$1): Promise<{
833
+ userMessageId: MessageID;
834
+ assistantMessageIds: MessageID[];
835
+ }>;
836
+ /**
837
+ * Stop currently executing task in session
838
+ *
839
+ * Uses AbortController to gracefully cancel the streaming request.
840
+ *
841
+ * @param sessionId - Session identifier
842
+ * @param taskId - Optional task ID (not used for Gemini, session-level stop)
843
+ * @returns Success status and reason if failed
844
+ */
845
+ stopTask(sessionId: string, taskId?: string): Promise<{
846
+ success: boolean;
847
+ partialResult?: Partial<{
848
+ taskId: string;
849
+ status: 'completed' | 'failed' | 'cancelled';
850
+ }>;
851
+ reason?: string;
852
+ }>;
853
+ }
854
+
855
+ /**
856
+ * Gemini Prompt Service - Handles live execution via @google/gemini-cli-core SDK
857
+ *
858
+ * Features:
859
+ * - Token-level streaming via AsyncGenerator
860
+ * - Session continuity via setHistory()
861
+ * - Permission modes (DEFAULT, AUTO_EDIT, YOLO)
862
+ * - Event-driven architecture (13 event types)
863
+ * - CLAUDE.md auto-loading
864
+ */
865
+
866
+ /**
867
+ * Streaming event types for prompt service consumers
868
+ */
869
+ type GeminiStreamEvent = {
870
+ type: 'partial';
871
+ textChunk: string;
872
+ resolvedModel?: string;
873
+ sessionId?: string;
874
+ } | {
875
+ type: 'complete';
876
+ content: Array<{
877
+ type: string;
878
+ text?: string;
879
+ id?: string;
880
+ name?: string;
881
+ input?: Record<string, unknown>;
882
+ }>;
883
+ toolUses?: Array<{
884
+ id: string;
885
+ name: string;
886
+ input: Record<string, unknown>;
887
+ }>;
888
+ resolvedModel?: string;
889
+ sessionId?: string;
890
+ } | {
891
+ type: 'tool_start';
892
+ toolName: string;
893
+ toolInput: Record<string, unknown>;
894
+ } | {
895
+ type: 'tool_complete';
896
+ toolName: string;
897
+ result: unknown;
898
+ };
899
+ declare class GeminiPromptService {
900
+ private sessionsRepo;
901
+ private sessionClients;
902
+ private activeControllers;
903
+ constructor(_messagesRepo: MessagesRepository, sessionsRepo: SessionRepository, _apiKey?: string);
904
+ /**
905
+ * Execute prompt with streaming via @google/gemini-cli-core SDK
906
+ *
907
+ * @param sessionId - Agor session ID
908
+ * @param prompt - User prompt text
909
+ * @param taskId - Optional task ID for message linking
910
+ * @param permissionMode - Agor permission mode ('ask' | 'auto' | 'allow-all')
911
+ * @yields Streaming events (partial chunks and complete messages)
912
+ */
913
+ promptSessionStreaming(sessionId: SessionID, prompt: string, _taskId?: TaskID, permissionMode?: PermissionMode$1): AsyncGenerator<GeminiStreamEvent>;
914
+ /**
915
+ * Load session file from SDK's filesystem storage
916
+ *
917
+ * Searches for session file in ~/.gemini/tmp/{projectHash}/chats/
918
+ * matching pattern: session-*-{sessionId-first8}.json
919
+ */
920
+ private loadSessionFile;
921
+ /**
922
+ * Get or create GeminiClient for a session
923
+ *
924
+ * Manages client lifecycle and session continuity via history restoration.
925
+ */
926
+ private getOrCreateClient;
927
+ /**
928
+ * Map Agor permission mode to Gemini ApprovalMode
929
+ *
930
+ * Gemini SDK supports 3 modes:
931
+ * - DEFAULT: Prompt for each tool use
932
+ * - AUTO_EDIT: Auto-approve file edits, prompt for shell/web commands
933
+ * - YOLO: Auto-approve all operations
934
+ */
935
+ private mapPermissionMode;
936
+ /**
937
+ * Convert SDK's ConversationRecord to Gemini Content[] format
938
+ *
939
+ * This converts the SDK's session file format into the API format needed for setHistory()
940
+ */
941
+ private convertConversationToHistory;
942
+ /**
943
+ * Update session history after turn completion
944
+ *
945
+ * The SDK's ChatRecordingService automatically persists to filesystem,
946
+ * so we just log for debugging purposes.
947
+ */
948
+ private updateSessionHistory;
949
+ /**
950
+ * Stop currently executing task
951
+ *
952
+ * Calls abort() on the AbortController to gracefully stop streaming.
953
+ *
954
+ * @param sessionId - Session identifier
955
+ * @returns Success status
956
+ */
957
+ stopTask(sessionId: SessionID): {
958
+ success: boolean;
959
+ reason?: string;
960
+ };
961
+ /**
962
+ * Clean up client for a session (e.g., on session close)
963
+ */
964
+ closeSession(sessionId: SessionID): Promise<void>;
965
+ }
966
+
967
+ export { type ClaudeSession, ClaudeTool, type CodexPromptResult, CodexPromptService, type CodexStreamEvent, CodexTool, type ConversationNode, type CreateSessionConfig, type ExtractedTask, GeminiPromptService, type GeminiStreamEvent, GeminiTool, type ITool, type ImportOptions, type MessageRange, type MessagesService, type SessionData, type SessionHandle, type SessionMetadata, type SessionsService, type StreamingCallbacks, type TaskResult, type TasksService, type ToolCapabilities, type ToolType, type TranscriptMessage, appendSessionContextToCLAUDEmd, buildConversationTree, extractTasksFromMessages, filterConversationMessages, generateSessionContext, getTranscriptPath, loadClaudeSession, loadSessionTranscript, parseTranscript, removeSessionContextFromCLAUDEmd, transcriptToMessage, transcriptsToMessages };