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,631 @@
1
+ export { and, desc, eq, inArray, like, or, sql } from 'drizzle-orm';
2
+ import bcryptjs from 'bcryptjs';
3
+ import { b as Database, B as BaseRepository } from '../worktrees-BzIxB1U6.cjs';
4
+ export { A as AmbiguousIdError, Q as BoardCommentInsert, P as BoardCommentRow, y as BoardInsert, O as BoardObjectInsert, N as BoardObjectRow, x as BoardRow, d as DEFAULT_DB_PATH, a as DatabaseConnectionError, D as DbConfig, E as EntityNotFoundError, J as MCPServerInsert, M as MCPServerRepository, I as MCPServerRow, v as MessageInsert, q as MessageRow, f as MessagesRepository, C as RepoInsert, z as RepoRow, R as RepositoryError, o as SessionInsert, L as SessionMCPServerInsert, S as SessionMCPServerRepository, K as SessionMCPServerRow, g as SessionRepository, n as SessionRow, p as TaskInsert, T as TaskRow, H as UserInsert, U as UserRow, G as WorktreeInsert, W as WorktreeRepository, F as WorktreeRow, l as boardComments, j as boardObjects, h as boards, c as createDatabase, e as createLocalDatabase, i as mcpServers, m as messages, r as repos, k as sessionMcpServers, s as sessions, t as tasks, u as users, w as worktrees } from '../worktrees-BzIxB1U6.cjs';
5
+ import { B as BoardComment } from '../board-comment-BUm0fpmD.cjs';
6
+ import { B as BoardID, W as WorktreeID } from '../id-DMqyogFB.cjs';
7
+ import { b as BoardEntityObject, f as Board, e as BoardObject } from '../session-BPjJlVdZ.cjs';
8
+ import { a as Repo } from '../repo-3CUrCRbq.cjs';
9
+ import { e as Task } from '../task-BIEgT1DK.cjs';
10
+ import { a as User } from '../user-eUuKj7yM.cjs';
11
+ import '../message-BoxZISHg.cjs';
12
+ import 'drizzle-orm/libsql';
13
+ import 'drizzle-orm/sqlite-core';
14
+ import '../agentic-tool-DsyX8diw.cjs';
15
+
16
+ /**
17
+ * ID Management Utilities
18
+ *
19
+ * Agor uses UUIDv7 for all entity identifiers.
20
+ * This module provides generation, validation, and resolution utilities.
21
+ *
22
+ * Key concepts:
23
+ * - Full UUIDs stored in database (36 chars)
24
+ * - Short IDs displayed to users (8-16 chars)
25
+ * - Git-style collision resolution (expand prefix when ambiguous)
26
+ *
27
+ * @see context/concepts/id-management.md
28
+ */
29
+ /**
30
+ * UUIDv7 identifier (36 characters including hyphens)
31
+ *
32
+ * Format: 01933e4a-7b89-7c35-a8f3-9d2e1c4b5a6f
33
+ * - First 48 bits: Unix timestamp (ms)
34
+ * - Next 12 bits: Random sequence
35
+ * - Last 62 bits: Random data
36
+ */
37
+ type UUID = string & {
38
+ readonly __brand: 'UUID';
39
+ };
40
+ /**
41
+ * Short ID prefix (8-16 characters, no hyphens)
42
+ *
43
+ * Used for display and user input.
44
+ * Example: "01933e4a" (8 chars) or "01933e4a7b89" (12 chars)
45
+ */
46
+ type ShortID = string;
47
+ /**
48
+ * Any length ID prefix for matching
49
+ */
50
+ type IDPrefix = string;
51
+ /**
52
+ * Generate a new UUIDv7 identifier.
53
+ *
54
+ * UUIDv7 provides:
55
+ * - Global uniqueness (2^122 possible values)
56
+ * - Time-ordered (sortable by creation time)
57
+ * - Excellent database index performance
58
+ *
59
+ * @returns A new UUIDv7 string
60
+ *
61
+ * @example
62
+ * const sessionId = generateId();
63
+ * // => "01933e4a-7b89-7c35-a8f3-9d2e1c4b5a6f"
64
+ */
65
+ declare function generateId(): UUID;
66
+ /**
67
+ * Format short ID for display (alias for shortId for backward compatibility)
68
+ *
69
+ * @deprecated Use shortId() instead
70
+ */
71
+ declare function formatShortId(uuid: UUID, length?: number): ShortID;
72
+ /**
73
+ * Error thrown when short ID resolution fails
74
+ */
75
+ declare class IdResolutionError extends Error {
76
+ readonly type: 'not_found' | 'ambiguous';
77
+ readonly prefix?: string | undefined;
78
+ readonly candidates?: Array<{
79
+ id: string;
80
+ label?: string;
81
+ }> | undefined;
82
+ constructor(message: string, type: 'not_found' | 'ambiguous', prefix?: string | undefined, candidates?: Array<{
83
+ id: string;
84
+ label?: string;
85
+ }> | undefined);
86
+ }
87
+ /**
88
+ * Resolve a short ID prefix to a full entity.
89
+ *
90
+ * This implements git-style ID resolution:
91
+ * - If exactly one match: return it
92
+ * - If no matches: throw error
93
+ * - If multiple matches: throw error with suggestions
94
+ *
95
+ * @param prefix - Short ID or partial UUID
96
+ * @param entities - Array of entities to search
97
+ * @returns Matching entity
98
+ * @throws IdResolutionError if not found or ambiguous
99
+ *
100
+ * @example
101
+ * const sessions = [
102
+ * { id: "01933e4a-7b89-7c35-a8f3-9d2e1c4b5a6f", description: "Auth" },
103
+ * { id: "01934c2d-1234-7c35-a8f3-9d2e1c4b5a6f", description: "CORS" },
104
+ * ];
105
+ *
106
+ * resolveShortId("01933e4a", sessions)
107
+ * // => { id: "01933e4a-...", description: "Auth" }
108
+ *
109
+ * resolveShortId("0193", sessions)
110
+ * // => Error: Ambiguous ID prefix
111
+ */
112
+ declare function resolveShortId<T extends {
113
+ id: UUID;
114
+ }>(prefix: IDPrefix, entities: T[]): T;
115
+
116
+ /**
117
+ * Database Migration Runner
118
+ *
119
+ * DEPRECATED: This file contains manual SQL schema creation and is kept for backwards compatibility.
120
+ *
121
+ * **New Approach (Recommended):**
122
+ * Use `drizzle-kit push` to automatically sync schema.ts to database:
123
+ * - Run: `pnpm db:push` from packages/core
124
+ * - Drizzle Kit reads schema.ts and generates SQL automatically
125
+ * - No need to maintain manual CREATE TABLE statements
126
+ * - Single source of truth: packages/core/src/db/schema.ts
127
+ *
128
+ * **This file is still used by:**
129
+ * - setup-db.ts for programmatic database initialization
130
+ * - Legacy code that calls initializeDatabase() directly
131
+ *
132
+ * **Migration Path:**
133
+ * For fresh databases: Use `pnpm db:push`
134
+ * For existing databases: Use `pnpm db:push` (will detect and apply schema changes)
135
+ * For seed data: Still use seedInitialData() from this file
136
+ */
137
+
138
+ /**
139
+ * Error thrown when migration fails
140
+ */
141
+ declare class MigrationError extends Error {
142
+ readonly cause?: unknown | undefined;
143
+ constructor(message: string, cause?: unknown | undefined);
144
+ }
145
+ /**
146
+ * Run database migrations
147
+ *
148
+ * @param db Drizzle database instance
149
+ * @param migrationsFolder Path to migrations folder (default: './migrations')
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * import { createDatabase } from './client';
154
+ * import { runMigrations } from './migrate';
155
+ *
156
+ * const db = createDatabase({ url: 'file:~/.agor/sessions.db' });
157
+ * await runMigrations(db);
158
+ * ```
159
+ */
160
+ declare function runMigrations(db: Database, migrationsFolder?: string): Promise<void>;
161
+ /**
162
+ * Initialize database (create schema if needed)
163
+ *
164
+ * Simpler alternative to runMigrations when you don't have migration files.
165
+ * Always safe to call - creates tables only if they don't exist.
166
+ *
167
+ * INCREMENTAL MIGRATION SUPPORT:
168
+ * This function now checks for each table individually and adds missing ones.
169
+ * Safe to call on existing databases - only adds what's missing.
170
+ */
171
+ declare function initializeDatabase(db: Database): Promise<void>;
172
+ /**
173
+ * Seed initial data (default board)
174
+ */
175
+ declare function seedInitialData(db: Database): Promise<void>;
176
+
177
+ /**
178
+ * Board Comments Repository
179
+ *
180
+ * Type-safe CRUD operations for board comments with short ID support.
181
+ * Supports flexible attachments (board, session, task, message, worktree, spatial).
182
+ */
183
+
184
+ /**
185
+ * Board comments repository implementation
186
+ */
187
+ declare class BoardCommentsRepository implements BaseRepository<BoardComment, Partial<BoardComment>> {
188
+ private db;
189
+ constructor(db: Database);
190
+ /**
191
+ * Convert database row to BoardComment type
192
+ */
193
+ private rowToComment;
194
+ /**
195
+ * Convert BoardComment to database insert format
196
+ */
197
+ private commentToInsert;
198
+ /**
199
+ * Resolve short ID to full ID
200
+ */
201
+ private resolveId;
202
+ /**
203
+ * Create a new comment
204
+ */
205
+ create(data: Partial<BoardComment>): Promise<BoardComment>;
206
+ /**
207
+ * Find comment by ID (supports short ID)
208
+ */
209
+ findById(id: string): Promise<BoardComment | null>;
210
+ /**
211
+ * Find all comments (optionally filtered by board, session, task, etc.)
212
+ */
213
+ findAll(filters?: {
214
+ board_id?: string;
215
+ session_id?: string;
216
+ task_id?: string;
217
+ message_id?: string;
218
+ worktree_id?: string;
219
+ resolved?: boolean;
220
+ created_by?: string;
221
+ }): Promise<BoardComment[]>;
222
+ /**
223
+ * Update comment by ID
224
+ */
225
+ update(id: string, updates: Partial<BoardComment>): Promise<BoardComment>;
226
+ /**
227
+ * Delete comment by ID
228
+ * If deleting a thread root, also deletes all replies (cascade)
229
+ */
230
+ delete(id: string): Promise<void>;
231
+ /**
232
+ * Resolve comment (mark as resolved)
233
+ */
234
+ resolve(id: string): Promise<BoardComment>;
235
+ /**
236
+ * Unresolve comment (mark as unresolved)
237
+ */
238
+ unresolve(id: string): Promise<BoardComment>;
239
+ /**
240
+ * Find comments by board ID with optional filters
241
+ */
242
+ findByBoard(boardId: string, filters?: {
243
+ resolved?: boolean;
244
+ created_by?: string;
245
+ session_id?: string;
246
+ }): Promise<BoardComment[]>;
247
+ /**
248
+ * Find comments for a specific session
249
+ */
250
+ findBySession(sessionId: string): Promise<BoardComment[]>;
251
+ /**
252
+ * Find comments for a specific task
253
+ */
254
+ findByTask(taskId: string): Promise<BoardComment[]>;
255
+ /**
256
+ * Find comments mentioning a specific user
257
+ */
258
+ findMentions(userId: string, boardId?: string): Promise<BoardComment[]>;
259
+ /**
260
+ * Batch create comments (for bulk operations)
261
+ */
262
+ bulkCreate(comments: Partial<BoardComment>[]): Promise<BoardComment[]>;
263
+ /**
264
+ * Toggle a reaction on a comment
265
+ * If user has already reacted with this emoji, remove it. Otherwise, add it.
266
+ */
267
+ toggleReaction(commentId: string, userId: string, emoji: string): Promise<BoardComment>;
268
+ /**
269
+ * Create a reply to a comment (thread root)
270
+ * Validates that parent exists and is a thread root
271
+ */
272
+ createReply(parentId: string, data: Partial<BoardComment>): Promise<BoardComment>;
273
+ }
274
+
275
+ /**
276
+ * Board Objects Repository
277
+ *
278
+ * Manages positioned entities (sessions and worktrees) on boards.
279
+ * Phase 1: Hybrid support for both session cards and worktree cards.
280
+ */
281
+
282
+ /**
283
+ * Board object repository implementation
284
+ */
285
+ declare class BoardObjectRepository {
286
+ private db;
287
+ constructor(db: Database);
288
+ /**
289
+ * Find all board objects
290
+ */
291
+ findAll(): Promise<BoardEntityObject[]>;
292
+ /**
293
+ * Find all board objects for a board
294
+ */
295
+ findByBoardId(boardId: BoardID): Promise<BoardEntityObject[]>;
296
+ /**
297
+ * Find board object by object ID
298
+ */
299
+ findByObjectId(objectId: string): Promise<BoardEntityObject | null>;
300
+ /**
301
+ * Find board object by worktree ID
302
+ */
303
+ findByWorktreeId(worktreeId: WorktreeID): Promise<BoardEntityObject | null>;
304
+ /**
305
+ * Create a board object (add worktree to board)
306
+ */
307
+ create(data: {
308
+ board_id: BoardID;
309
+ worktree_id: WorktreeID;
310
+ position: {
311
+ x: number;
312
+ y: number;
313
+ };
314
+ zone_id?: string;
315
+ }): Promise<BoardEntityObject>;
316
+ /**
317
+ * Update position of board object (preserves zone_id)
318
+ */
319
+ updatePosition(objectId: string, position: {
320
+ x: number;
321
+ y: number;
322
+ }): Promise<BoardEntityObject>;
323
+ /**
324
+ * Update zone pinning for board object
325
+ */
326
+ updateZone(objectId: string, zoneId: string | undefined | null): Promise<BoardEntityObject>;
327
+ /**
328
+ * Remove board object (remove entity from board)
329
+ */
330
+ remove(objectId: string): Promise<void>;
331
+ /**
332
+ * Remove all board objects for a worktree
333
+ */
334
+ removeByWorktreeId(worktreeId: WorktreeID): Promise<void>;
335
+ /**
336
+ * Convert database row to entity
337
+ */
338
+ private rowToEntity;
339
+ }
340
+
341
+ /**
342
+ * Board Repository
343
+ *
344
+ * Type-safe CRUD operations for boards with short ID support.
345
+ */
346
+
347
+ /**
348
+ * Board repository implementation
349
+ */
350
+ declare class BoardRepository implements BaseRepository<Board, Partial<Board>> {
351
+ private db;
352
+ constructor(db: Database);
353
+ /**
354
+ * Convert database row to Board type
355
+ */
356
+ private rowToBoard;
357
+ /**
358
+ * Convert Board to database insert format
359
+ */
360
+ private boardToInsert;
361
+ /**
362
+ * Resolve short ID to full ID
363
+ */
364
+ private resolveId;
365
+ /**
366
+ * Create a new board
367
+ */
368
+ create(data: Partial<Board>): Promise<Board>;
369
+ /**
370
+ * Find board by ID (supports short ID)
371
+ */
372
+ findById(id: string): Promise<Board | null>;
373
+ /**
374
+ * Find board by slug
375
+ */
376
+ findBySlug(slug: string): Promise<Board | null>;
377
+ /**
378
+ * Find all boards
379
+ */
380
+ findAll(): Promise<Board[]>;
381
+ /**
382
+ * Update board by ID
383
+ */
384
+ update(id: string, updates: Partial<Board>): Promise<Board>;
385
+ /**
386
+ * Delete board by ID
387
+ */
388
+ delete(id: string): Promise<void>;
389
+ /**
390
+ * DEPRECATED: Add session to board
391
+ * Use board-objects service instead
392
+ */
393
+ /**
394
+ * DEPRECATED: Remove session from board
395
+ * Use board-objects service instead
396
+ */
397
+ /**
398
+ * Get default board (or create if doesn't exist)
399
+ */
400
+ getDefault(): Promise<Board>;
401
+ /**
402
+ * Atomically add or update a board object (text label or zone)
403
+ *
404
+ * Uses read-modify-write approach with proper serialization via update() method.
405
+ */
406
+ upsertBoardObject(boardId: string, objectId: string, objectData: BoardObject): Promise<Board>;
407
+ /**
408
+ * Atomically remove a board object
409
+ */
410
+ removeBoardObject(boardId: string, objectId: string): Promise<Board>;
411
+ /**
412
+ * Batch upsert multiple objects (sequential atomic updates)
413
+ *
414
+ * Note: Not a single transaction - each object is updated atomically.
415
+ * This is safe for independent objects but may have partial failures.
416
+ */
417
+ batchUpsertBoardObjects(boardId: string, objects: Record<string, BoardObject>): Promise<Board>;
418
+ /**
419
+ * DEPRECATED: Delete a zone and handle associated sessions
420
+ * TODO: Reimplement using board-objects table
421
+ */
422
+ deleteZone(boardId: string, objectId: string, _deleteAssociatedSessions: boolean): Promise<{
423
+ board: Board;
424
+ affectedSessions: string[];
425
+ }>;
426
+ }
427
+
428
+ /**
429
+ * Repo Repository
430
+ *
431
+ * Type-safe CRUD operations for git repositories with short ID support.
432
+ */
433
+
434
+ /**
435
+ * Repo repository implementation
436
+ */
437
+ declare class RepoRepository implements BaseRepository<Repo, Partial<Repo>> {
438
+ private db;
439
+ constructor(db: Database);
440
+ /**
441
+ * Convert database row to Repo type
442
+ */
443
+ private rowToRepo;
444
+ /**
445
+ * Convert Repo to database insert format
446
+ */
447
+ private repoToInsert;
448
+ /**
449
+ * Resolve short ID to full ID
450
+ */
451
+ private resolveId;
452
+ /**
453
+ * Create a new repo
454
+ */
455
+ create(data: Partial<Repo>): Promise<Repo>;
456
+ /**
457
+ * Find repo by ID (supports short ID)
458
+ */
459
+ findById(id: string): Promise<Repo | null>;
460
+ /**
461
+ * Find repo by slug (exact match)
462
+ */
463
+ findBySlug(slug: string): Promise<Repo | null>;
464
+ /**
465
+ * Find all repos
466
+ */
467
+ findAll(): Promise<Repo[]>;
468
+ /**
469
+ * Find managed repos only (DEPRECATED: all repos are managed now)
470
+ *
471
+ * Kept for backwards compatibility - returns all repos.
472
+ */
473
+ findManaged(): Promise<Repo[]>;
474
+ /**
475
+ * Update repo by ID
476
+ */
477
+ update(id: string, updates: Partial<Repo>): Promise<Repo>;
478
+ /**
479
+ * Delete repo by ID
480
+ */
481
+ delete(id: string): Promise<void>;
482
+ /**
483
+ * @deprecated Worktrees are now first-class entities in their own table.
484
+ * Use WorktreeRepository instead.
485
+ */
486
+ addWorktree(): Promise<never>;
487
+ /**
488
+ * @deprecated Worktrees are now first-class entities in their own table.
489
+ * Use WorktreeRepository instead.
490
+ */
491
+ removeWorktree(): Promise<never>;
492
+ /**
493
+ * Count total repos
494
+ */
495
+ count(): Promise<number>;
496
+ }
497
+
498
+ /**
499
+ * Task Repository
500
+ *
501
+ * Type-safe CRUD operations for tasks with short ID support.
502
+ */
503
+
504
+ /**
505
+ * Task repository implementation
506
+ */
507
+ declare class TaskRepository implements BaseRepository<Task, Partial<Task>> {
508
+ private db;
509
+ constructor(db: Database);
510
+ /**
511
+ * Convert database row to Task type
512
+ */
513
+ private rowToTask;
514
+ /**
515
+ * Convert Task to database insert format
516
+ */
517
+ private taskToInsert;
518
+ /**
519
+ * Resolve short ID to full ID
520
+ */
521
+ private resolveId;
522
+ /**
523
+ * Create a new task
524
+ */
525
+ create(data: Partial<Task>): Promise<Task>;
526
+ /**
527
+ * Bulk create multiple tasks (for imports)
528
+ */
529
+ createMany(taskList: Partial<Task>[]): Promise<Task[]>;
530
+ /**
531
+ * Find task by ID (supports short ID)
532
+ */
533
+ findById(id: string): Promise<Task | null>;
534
+ /**
535
+ * Find all tasks
536
+ */
537
+ findAll(): Promise<Task[]>;
538
+ /**
539
+ * Find all tasks for a session
540
+ */
541
+ findBySession(sessionId: string): Promise<Task[]>;
542
+ /**
543
+ * Find running tasks across all sessions
544
+ */
545
+ findRunning(): Promise<Task[]>;
546
+ /**
547
+ * Find tasks by status
548
+ */
549
+ findByStatus(status: Task['status']): Promise<Task[]>;
550
+ /**
551
+ * Update task by ID
552
+ */
553
+ update(id: string, updates: Partial<Task>): Promise<Task>;
554
+ /**
555
+ * Delete task by ID
556
+ */
557
+ delete(id: string): Promise<void>;
558
+ /**
559
+ * Count tasks for a session
560
+ */
561
+ countBySession(sessionId: string): Promise<number>;
562
+ }
563
+
564
+ /**
565
+ * User utility functions
566
+ *
567
+ * Shared logic for creating and managing users without requiring daemon.
568
+ */
569
+
570
+ /**
571
+ * Create user input
572
+ */
573
+ interface CreateUserData {
574
+ email: string;
575
+ password: string;
576
+ name?: string;
577
+ role?: 'owner' | 'admin' | 'member' | 'viewer';
578
+ }
579
+ /**
580
+ * Create a new user directly in the database
581
+ *
582
+ * This is a standalone utility that can be used by both CLI and daemon.
583
+ * It doesn't require the daemon to be running.
584
+ *
585
+ * @param db - Database instance
586
+ * @param data - User data
587
+ * @returns Created user
588
+ */
589
+ declare function createUser(db: Database, data: CreateUserData): Promise<User>;
590
+ /**
591
+ * Check if a user with the given email exists
592
+ *
593
+ * @param db - Database instance
594
+ * @param email - Email to check
595
+ * @returns True if user exists
596
+ */
597
+ declare function userExists(db: Database, email: string): Promise<boolean>;
598
+ /**
599
+ * Get user by email
600
+ *
601
+ * @param db - Database instance
602
+ * @param email - Email to look up
603
+ * @returns User or null if not found
604
+ */
605
+ declare function getUserByEmail(db: Database, email: string): Promise<User | null>;
606
+ /**
607
+ * Default admin user credentials
608
+ * Used by both init and user create-admin commands
609
+ */
610
+ declare const DEFAULT_ADMIN_USER: {
611
+ email: string;
612
+ password: string;
613
+ name: string;
614
+ role: "admin";
615
+ };
616
+ /**
617
+ * Create default admin user (admin@agor.live / admin)
618
+ *
619
+ * This is a convenience function for creating the default admin user
620
+ * with hardcoded credentials. Use createUser() if you need custom credentials.
621
+ *
622
+ * @param db - Database instance
623
+ * @returns Created user
624
+ * @throws Error if admin user already exists
625
+ */
626
+ declare function createDefaultAdminUser(db: Database): Promise<User>;
627
+
628
+ declare const compare: typeof bcryptjs.compare;
629
+ declare const hash: typeof bcryptjs.hash;
630
+
631
+ export { BaseRepository, BoardCommentsRepository, BoardObjectRepository, BoardRepository, type CreateUserData, DEFAULT_ADMIN_USER, Database, IdResolutionError, MigrationError, RepoRepository, TaskRepository, compare, createDefaultAdminUser, createUser, formatShortId, generateId, getUserByEmail, hash, initializeDatabase, resolveShortId, runMigrations, seedInitialData, userExists };