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.
- package/LICENSE +94 -0
- package/README.md +163 -0
- package/bin/agor-daemon.js +20 -0
- package/bin/agor.js +14 -0
- package/dist/cli/base-command.d.ts +29 -0
- package/dist/cli/base-command.js +41 -0
- package/dist/cli/commands/board/add-session.d.ts +15 -0
- package/dist/cli/commands/board/add-session.js +102 -0
- package/dist/cli/commands/board/list.d.ts +14 -0
- package/dist/cli/commands/board/list.js +74 -0
- package/dist/cli/commands/config/clear.d.ts +13 -0
- package/dist/cli/commands/config/clear.js +21 -0
- package/dist/cli/commands/config/get.d.ts +13 -0
- package/dist/cli/commands/config/get.js +41 -0
- package/dist/cli/commands/config/index.d.ts +13 -0
- package/dist/cli/commands/config/index.js +118 -0
- package/dist/cli/commands/config/set.d.ts +14 -0
- package/dist/cli/commands/config/set.js +50 -0
- package/dist/cli/commands/config/unset.d.ts +13 -0
- package/dist/cli/commands/config/unset.js +35 -0
- package/dist/cli/commands/daemon/index.d.ts +13 -0
- package/dist/cli/commands/daemon/index.js +65 -0
- package/dist/cli/commands/daemon/logs.d.ts +13 -0
- package/dist/cli/commands/daemon/logs.js +78 -0
- package/dist/cli/commands/daemon/restart.d.ts +13 -0
- package/dist/cli/commands/daemon/restart.js +177 -0
- package/dist/cli/commands/daemon/start.d.ts +13 -0
- package/dist/cli/commands/daemon/start.js +193 -0
- package/dist/cli/commands/daemon/status.d.ts +13 -0
- package/dist/cli/commands/daemon/status.js +93 -0
- package/dist/cli/commands/daemon/stop.d.ts +13 -0
- package/dist/cli/commands/daemon/stop.js +108 -0
- package/dist/cli/commands/init.d.ts +44 -0
- package/dist/cli/commands/init.js +459 -0
- package/dist/cli/commands/mcp/add.d.ts +26 -0
- package/dist/cli/commands/mcp/add.js +162 -0
- package/dist/cli/commands/mcp/list.d.ts +16 -0
- package/dist/cli/commands/mcp/list.js +89 -0
- package/dist/cli/commands/mcp/remove.d.ts +17 -0
- package/dist/cli/commands/mcp/remove.js +86 -0
- package/dist/cli/commands/mcp/show.d.ts +14 -0
- package/dist/cli/commands/mcp/show.js +131 -0
- package/dist/cli/commands/repo/add.d.ts +16 -0
- package/dist/cli/commands/repo/add.js +105 -0
- package/dist/cli/commands/repo/list.d.ts +17 -0
- package/dist/cli/commands/repo/list.js +99 -0
- package/dist/cli/commands/repo/rm.d.ts +17 -0
- package/dist/cli/commands/repo/rm.js +126 -0
- package/dist/cli/commands/repo/worktree/add.d.ts +21 -0
- package/dist/cli/commands/repo/worktree/add.js +145 -0
- package/dist/cli/commands/repo/worktree/list.d.ts +21 -0
- package/dist/cli/commands/repo/worktree/list.js +136 -0
- package/dist/cli/commands/session/list.d.ts +30 -0
- package/dist/cli/commands/session/list.js +204 -0
- package/dist/cli/commands/session/load-claude.d.ts +16 -0
- package/dist/cli/commands/session/load-claude.js +211 -0
- package/dist/cli/commands/user/create-admin.d.ts +13 -0
- package/dist/cli/commands/user/create-admin.js +65 -0
- package/dist/cli/commands/user/create.d.ts +16 -0
- package/dist/cli/commands/user/create.js +126 -0
- package/dist/cli/commands/user/delete.d.ts +16 -0
- package/dist/cli/commands/user/delete.js +77 -0
- package/dist/cli/commands/user/list.d.ts +13 -0
- package/dist/cli/commands/user/list.js +78 -0
- package/dist/cli/commands/user/update.d.ts +19 -0
- package/dist/cli/commands/user/update.js +149 -0
- package/dist/cli/hooks/command-not-found.d.ts +9 -0
- package/dist/cli/hooks/command-not-found.js +14 -0
- package/dist/cli/lib/banner.d.ts +25 -0
- package/dist/cli/lib/banner.js +25 -0
- package/dist/cli/lib/context.d.ts +27 -0
- package/dist/cli/lib/context.js +32 -0
- package/dist/cli/lib/daemon-manager.d.ts +48 -0
- package/dist/cli/lib/daemon-manager.js +109 -0
- package/dist/cli/lib/help.d.ts +13 -0
- package/dist/cli/lib/help.js +46 -0
- package/dist/core/agentic-tool-B_gFNpk5.d.ts +33 -0
- package/dist/core/agentic-tool-DsyX8diw.d.cts +33 -0
- package/dist/core/api/index.cjs +98 -0
- package/dist/core/api/index.d.cts +174 -0
- package/dist/core/api/index.d.ts +174 -0
- package/dist/core/api/index.js +62 -0
- package/dist/core/board-comment-BUm0fpmD.d.cts +134 -0
- package/dist/core/board-comment-gC_-twPx.d.ts +134 -0
- package/dist/core/claude/index.cjs +673 -0
- package/dist/core/claude/index.d.cts +124 -0
- package/dist/core/claude/index.d.ts +124 -0
- package/dist/core/claude/index.js +629 -0
- package/dist/core/config/browser.cjs +165 -0
- package/dist/core/config/browser.d.cts +289 -0
- package/dist/core/config/browser.d.ts +289 -0
- package/dist/core/config/browser.js +131 -0
- package/dist/core/config/index.cjs +518 -0
- package/dist/core/config/index.d.cts +246 -0
- package/dist/core/config/index.d.ts +246 -0
- package/dist/core/config/index.js +451 -0
- package/dist/core/db/index.cjs +3726 -0
- package/dist/core/db/index.d.cts +631 -0
- package/dist/core/db/index.d.ts +631 -0
- package/dist/core/db/index.js +3649 -0
- package/dist/core/dist/agentic-tool-B_gFNpk5.d.ts +33 -0
- package/dist/core/dist/agentic-tool-DsyX8diw.d.cts +33 -0
- package/dist/core/dist/api/index.cjs +98 -0
- package/dist/core/dist/api/index.d.cts +174 -0
- package/dist/core/dist/api/index.d.ts +174 -0
- package/dist/core/dist/api/index.js +62 -0
- package/dist/core/dist/board-comment-BUm0fpmD.d.cts +134 -0
- package/dist/core/dist/board-comment-gC_-twPx.d.ts +134 -0
- package/dist/core/dist/claude/index.cjs +673 -0
- package/dist/core/dist/claude/index.d.cts +124 -0
- package/dist/core/dist/claude/index.d.ts +124 -0
- package/dist/core/dist/claude/index.js +629 -0
- package/dist/core/dist/config/browser.cjs +165 -0
- package/dist/core/dist/config/browser.d.cts +289 -0
- package/dist/core/dist/config/browser.d.ts +289 -0
- package/dist/core/dist/config/browser.js +131 -0
- package/dist/core/dist/config/index.cjs +518 -0
- package/dist/core/dist/config/index.d.cts +246 -0
- package/dist/core/dist/config/index.d.ts +246 -0
- package/dist/core/dist/config/index.js +451 -0
- package/dist/core/dist/db/index.cjs +3726 -0
- package/dist/core/dist/db/index.d.cts +631 -0
- package/dist/core/dist/db/index.d.ts +631 -0
- package/dist/core/dist/db/index.js +3649 -0
- package/dist/core/dist/environment/variable-resolver.cjs +92 -0
- package/dist/core/dist/environment/variable-resolver.d.cts +52 -0
- package/dist/core/dist/environment/variable-resolver.d.ts +52 -0
- package/dist/core/dist/environment/variable-resolver.js +53 -0
- package/dist/core/dist/feathers/index.cjs +66 -0
- package/dist/core/dist/feathers/index.d.cts +7 -0
- package/dist/core/dist/feathers/index.d.ts +7 -0
- package/dist/core/dist/feathers/index.js +25 -0
- package/dist/core/dist/feathers-BzHEPnpl.d.cts +228 -0
- package/dist/core/dist/feathers-BzHEPnpl.d.ts +228 -0
- package/dist/core/dist/git/index.cjs +302 -0
- package/dist/core/dist/git/index.d.cts +137 -0
- package/dist/core/dist/git/index.d.ts +137 -0
- package/dist/core/dist/git/index.js +260 -0
- package/dist/core/dist/id-DMqyogFB.d.cts +131 -0
- package/dist/core/dist/id-DMqyogFB.d.ts +131 -0
- package/dist/core/dist/index.cjs +4653 -0
- package/dist/core/dist/index.d.cts +23 -0
- package/dist/core/dist/index.d.ts +23 -0
- package/dist/core/dist/index.js +4509 -0
- package/dist/core/dist/message-BoxZISHg.d.cts +120 -0
- package/dist/core/dist/message-DvBzHu7V.d.ts +120 -0
- package/dist/core/dist/permissions/index.cjs +112 -0
- package/dist/core/dist/permissions/index.d.cts +81 -0
- package/dist/core/dist/permissions/index.d.ts +81 -0
- package/dist/core/dist/permissions/index.js +85 -0
- package/dist/core/dist/repo-3CUrCRbq.d.cts +405 -0
- package/dist/core/dist/repo-CnvJ0B6-.d.ts +405 -0
- package/dist/core/dist/session-BPjJlVdZ.d.cts +429 -0
- package/dist/core/dist/session-wAzjHatv.d.ts +429 -0
- package/dist/core/dist/task-BIEgT1DK.d.cts +163 -0
- package/dist/core/dist/task-DuIfiUbW.d.ts +163 -0
- package/dist/core/dist/templates/handlebars-helpers.cjs +156 -0
- package/dist/core/dist/templates/handlebars-helpers.d.cts +45 -0
- package/dist/core/dist/templates/handlebars-helpers.d.ts +45 -0
- package/dist/core/dist/templates/handlebars-helpers.js +119 -0
- package/dist/core/dist/tools/claude/models.cjs +70 -0
- package/dist/core/dist/tools/claude/models.d.cts +27 -0
- package/dist/core/dist/tools/claude/models.d.ts +27 -0
- package/dist/core/dist/tools/claude/models.js +44 -0
- package/dist/core/dist/tools/index.cjs +3367 -0
- package/dist/core/dist/tools/index.d.cts +967 -0
- package/dist/core/dist/tools/index.d.ts +967 -0
- package/dist/core/dist/tools/index.js +3314 -0
- package/dist/core/dist/tools/models.cjs +119 -0
- package/dist/core/dist/tools/models.d.cts +47 -0
- package/dist/core/dist/tools/models.d.ts +47 -0
- package/dist/core/dist/tools/models.js +86 -0
- package/dist/core/dist/types/index.cjs +152 -0
- package/dist/core/dist/types/index.d.cts +214 -0
- package/dist/core/dist/types/index.d.ts +214 -0
- package/dist/core/dist/types/index.js +112 -0
- package/dist/core/dist/user-BmL3kFol.d.ts +50 -0
- package/dist/core/dist/user-eUuKj7yM.d.cts +50 -0
- package/dist/core/dist/utils/pricing.cjs +102 -0
- package/dist/core/dist/utils/pricing.d.cts +43 -0
- package/dist/core/dist/utils/pricing.d.ts +43 -0
- package/dist/core/dist/utils/pricing.js +75 -0
- package/dist/core/dist/worktrees-BzIxB1U6.d.cts +2745 -0
- package/dist/core/dist/worktrees-CYem1ya2.d.ts +2745 -0
- package/dist/core/environment/variable-resolver.cjs +92 -0
- package/dist/core/environment/variable-resolver.d.cts +52 -0
- package/dist/core/environment/variable-resolver.d.ts +52 -0
- package/dist/core/environment/variable-resolver.js +53 -0
- package/dist/core/feathers/index.cjs +66 -0
- package/dist/core/feathers/index.d.cts +7 -0
- package/dist/core/feathers/index.d.ts +7 -0
- package/dist/core/feathers/index.js +25 -0
- package/dist/core/feathers-BzHEPnpl.d.cts +228 -0
- package/dist/core/feathers-BzHEPnpl.d.ts +228 -0
- package/dist/core/git/index.cjs +302 -0
- package/dist/core/git/index.d.cts +137 -0
- package/dist/core/git/index.d.ts +137 -0
- package/dist/core/git/index.js +260 -0
- package/dist/core/id-DMqyogFB.d.cts +131 -0
- package/dist/core/id-DMqyogFB.d.ts +131 -0
- package/dist/core/index.cjs +4653 -0
- package/dist/core/index.d.cts +23 -0
- package/dist/core/index.d.ts +23 -0
- package/dist/core/index.js +4509 -0
- package/dist/core/message-BoxZISHg.d.cts +120 -0
- package/dist/core/message-DvBzHu7V.d.ts +120 -0
- package/dist/core/package.json +133 -0
- package/dist/core/permissions/index.cjs +112 -0
- package/dist/core/permissions/index.d.cts +81 -0
- package/dist/core/permissions/index.d.ts +81 -0
- package/dist/core/permissions/index.js +85 -0
- package/dist/core/repo-3CUrCRbq.d.cts +405 -0
- package/dist/core/repo-CnvJ0B6-.d.ts +405 -0
- package/dist/core/session-BPjJlVdZ.d.cts +429 -0
- package/dist/core/session-wAzjHatv.d.ts +429 -0
- package/dist/core/task-BIEgT1DK.d.cts +163 -0
- package/dist/core/task-DuIfiUbW.d.ts +163 -0
- package/dist/core/templates/handlebars-helpers.cjs +156 -0
- package/dist/core/templates/handlebars-helpers.d.cts +45 -0
- package/dist/core/templates/handlebars-helpers.d.ts +45 -0
- package/dist/core/templates/handlebars-helpers.js +119 -0
- package/dist/core/tools/claude/models.cjs +70 -0
- package/dist/core/tools/claude/models.d.cts +27 -0
- package/dist/core/tools/claude/models.d.ts +27 -0
- package/dist/core/tools/claude/models.js +44 -0
- package/dist/core/tools/index.cjs +3367 -0
- package/dist/core/tools/index.d.cts +967 -0
- package/dist/core/tools/index.d.ts +967 -0
- package/dist/core/tools/index.js +3314 -0
- package/dist/core/tools/models.cjs +119 -0
- package/dist/core/tools/models.d.cts +47 -0
- package/dist/core/tools/models.d.ts +47 -0
- package/dist/core/tools/models.js +86 -0
- package/dist/core/types/index.cjs +152 -0
- package/dist/core/types/index.d.cts +214 -0
- package/dist/core/types/index.d.ts +214 -0
- package/dist/core/types/index.js +112 -0
- package/dist/core/user-BmL3kFol.d.ts +50 -0
- package/dist/core/user-eUuKj7yM.d.cts +50 -0
- package/dist/core/utils/pricing.cjs +102 -0
- package/dist/core/utils/pricing.d.cts +43 -0
- package/dist/core/utils/pricing.d.ts +43 -0
- package/dist/core/utils/pricing.js +75 -0
- package/dist/core/worktrees-BzIxB1U6.d.cts +2745 -0
- package/dist/core/worktrees-CYem1ya2.d.ts +2745 -0
- package/dist/daemon/adapters/drizzle.d.ts +114 -0
- package/dist/daemon/adapters/drizzle.js +219 -0
- package/dist/daemon/declarations.d.ts +101 -0
- package/dist/daemon/declarations.js +0 -0
- package/dist/daemon/index.d.ts +2 -0
- package/dist/daemon/index.js +4093 -0
- package/dist/daemon/mcp/routes.d.ts +15 -0
- package/dist/daemon/mcp/routes.js +641 -0
- package/dist/daemon/mcp/tokens.d.ts +50 -0
- package/dist/daemon/mcp/tokens.js +85 -0
- package/dist/daemon/services/board-comments.d.ts +97 -0
- package/dist/daemon/services/board-comments.js +326 -0
- package/dist/daemon/services/board-objects.d.ts +71 -0
- package/dist/daemon/services/board-objects.js +117 -0
- package/dist/daemon/services/boards.d.ts +64 -0
- package/dist/daemon/services/boards.js +286 -0
- package/dist/daemon/services/config.d.ts +35 -0
- package/dist/daemon/services/config.js +68 -0
- package/dist/daemon/services/context.d.ts +55 -0
- package/dist/daemon/services/context.js +113 -0
- package/dist/daemon/services/health-monitor.d.ts +58 -0
- package/dist/daemon/services/health-monitor.js +158 -0
- package/dist/daemon/services/mcp-servers.d.ts +42 -0
- package/dist/daemon/services/mcp-servers.js +275 -0
- package/dist/daemon/services/messages.d.ts +49 -0
- package/dist/daemon/services/messages.js +269 -0
- package/dist/daemon/services/repos.d.ts +61 -0
- package/dist/daemon/services/repos.js +350 -0
- package/dist/daemon/services/session-mcp-servers.d.ts +56 -0
- package/dist/daemon/services/session-mcp-servers.js +51 -0
- package/dist/daemon/services/sessions.d.ts +64 -0
- package/dist/daemon/services/sessions.js +398 -0
- package/dist/daemon/services/tasks.d.ts +55 -0
- package/dist/daemon/services/tasks.js +318 -0
- package/dist/daemon/services/terminals.d.ts +75 -0
- package/dist/daemon/services/terminals.js +110 -0
- package/dist/daemon/services/users.d.ts +98 -0
- package/dist/daemon/services/users.js +177 -0
- package/dist/daemon/services/worktrees.d.ts +98 -0
- package/dist/daemon/services/worktrees.js +719 -0
- package/dist/daemon/strategies/anonymous.d.ts +20 -0
- package/dist/daemon/strategies/anonymous.js +32 -0
- package/dist/ui/assets/cc-CYmbalCD.png +0 -0
- package/dist/ui/assets/codex-4sLD1mVS.png +0 -0
- package/dist/ui/assets/cursor-BUy5pFVL.png +0 -0
- package/dist/ui/assets/gemini-ajOb7iAl.png +0 -0
- package/dist/ui/assets/index-Dc4ELxry.css +32 -0
- package/dist/ui/assets/index-KfIu8v4V.js +578 -0
- package/dist/ui/favicon.png +0 -0
- package/dist/ui/index.html +26 -0
- package/dist/ui/vite.svg +1 -0
- package/package.json +90 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { d as Message } from '../message-BoxZISHg.cjs';
|
|
2
|
+
import { x as Session, f as Board, p as MCPServer } from '../session-BPjJlVdZ.cjs';
|
|
3
|
+
import { e as Task, a as ContextFileListItem, b as ContextFileDetail } from '../task-BIEgT1DK.cjs';
|
|
4
|
+
import { b as AuthenticationResult } from '../feathers-BzHEPnpl.cjs';
|
|
5
|
+
import { a as User } from '../user-eUuKj7yM.cjs';
|
|
6
|
+
import { a as Repo } from '../repo-3CUrCRbq.cjs';
|
|
7
|
+
import { Params, Paginated, Application } from '@feathersjs/feathers';
|
|
8
|
+
import { Socket } from 'socket.io-client';
|
|
9
|
+
import '../id-DMqyogFB.cjs';
|
|
10
|
+
import '../agentic-tool-DsyX8diw.cjs';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Feathers Client for Agor
|
|
14
|
+
*
|
|
15
|
+
* Shared client library for connecting to agor-daemon from CLI and UI
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Service interfaces for type safety
|
|
20
|
+
*/
|
|
21
|
+
interface ServiceTypes {
|
|
22
|
+
sessions: Session;
|
|
23
|
+
tasks: Task;
|
|
24
|
+
boards: Board;
|
|
25
|
+
repos: Repo;
|
|
26
|
+
users: User;
|
|
27
|
+
'mcp-servers': MCPServer;
|
|
28
|
+
context: ContextFileListItem | ContextFileDetail;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Feathers service with find method properly typed and event emitter methods
|
|
32
|
+
*/
|
|
33
|
+
interface AgorService<T> {
|
|
34
|
+
find(params?: Params): Promise<Paginated<T> | T[]>;
|
|
35
|
+
get(id: string, params?: Params): Promise<T>;
|
|
36
|
+
create(data: Partial<T>, params?: Params): Promise<T>;
|
|
37
|
+
update(id: string, data: T, params?: Params): Promise<T>;
|
|
38
|
+
patch(id: string | null, data: Partial<T> | null, params?: Params): Promise<T>;
|
|
39
|
+
remove(id: string, params?: Params): Promise<T>;
|
|
40
|
+
on(event: string, handler: (data: T) => void): void;
|
|
41
|
+
removeListener(event: string, handler: (data: T) => void): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sessions service with custom methods for forking, spawning, and genealogy
|
|
45
|
+
*/
|
|
46
|
+
interface SessionsService extends AgorService<Session> {
|
|
47
|
+
/**
|
|
48
|
+
* Fork a session at a decision point
|
|
49
|
+
* Creates a new session branching from the parent at a specific task
|
|
50
|
+
*/
|
|
51
|
+
fork(id: string, data: {
|
|
52
|
+
prompt: string;
|
|
53
|
+
task_id?: string;
|
|
54
|
+
}, params?: Params): Promise<Session>;
|
|
55
|
+
/**
|
|
56
|
+
* Spawn a child session from a parent
|
|
57
|
+
* Creates a new session with the parent's context
|
|
58
|
+
*/
|
|
59
|
+
spawn(id: string, data: {
|
|
60
|
+
prompt: string;
|
|
61
|
+
agent?: string;
|
|
62
|
+
task_id?: string;
|
|
63
|
+
}, params?: Params): Promise<Session>;
|
|
64
|
+
/**
|
|
65
|
+
* Get genealogy tree for a session
|
|
66
|
+
* Returns the full ancestor/descendant tree
|
|
67
|
+
*/
|
|
68
|
+
getGenealogy(id: string, params?: Params): Promise<unknown>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Tasks service with bulk creation support
|
|
72
|
+
*/
|
|
73
|
+
interface TasksService extends AgorService<Task> {
|
|
74
|
+
/**
|
|
75
|
+
* Create multiple tasks in a single request
|
|
76
|
+
* Returns array of created tasks with IDs
|
|
77
|
+
*/
|
|
78
|
+
createMany(data: Partial<Task>[]): Promise<Task[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Mark a task as completed
|
|
81
|
+
*/
|
|
82
|
+
complete(id: string, data: {
|
|
83
|
+
report?: unknown;
|
|
84
|
+
}, params?: Params): Promise<Task>;
|
|
85
|
+
/**
|
|
86
|
+
* Mark a task as failed
|
|
87
|
+
*/
|
|
88
|
+
fail(id: string, data: {
|
|
89
|
+
error: string;
|
|
90
|
+
}, params?: Params): Promise<Task>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Messages service with bulk creation support
|
|
94
|
+
*/
|
|
95
|
+
interface MessagesService extends AgorService<Message> {
|
|
96
|
+
/**
|
|
97
|
+
* Create multiple messages in a single request
|
|
98
|
+
* Returns array of created messages with IDs
|
|
99
|
+
*/
|
|
100
|
+
createMany(data: Partial<Message>[]): Promise<Message[]>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Repos service with worktree management
|
|
104
|
+
*/
|
|
105
|
+
interface ReposService extends AgorService<Repo> {
|
|
106
|
+
/**
|
|
107
|
+
* Clone a repository and register it
|
|
108
|
+
*/
|
|
109
|
+
clone(data: {
|
|
110
|
+
url: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
}, params?: Params): Promise<Repo>;
|
|
113
|
+
/**
|
|
114
|
+
* Create a git worktree for a repository
|
|
115
|
+
*/
|
|
116
|
+
createWorktree(id: string, data: {
|
|
117
|
+
name: string;
|
|
118
|
+
ref: string;
|
|
119
|
+
createBranch?: boolean;
|
|
120
|
+
pullLatest?: boolean;
|
|
121
|
+
sourceBranch?: string;
|
|
122
|
+
}, params?: Params): Promise<Repo>;
|
|
123
|
+
/**
|
|
124
|
+
* Remove a git worktree
|
|
125
|
+
*/
|
|
126
|
+
removeWorktree(id: string, name: string, params?: Params): Promise<Repo>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Agor client with socket.io connection exposed for lifecycle management
|
|
130
|
+
*/
|
|
131
|
+
interface AgorClient extends Omit<Application<ServiceTypes>, 'service'> {
|
|
132
|
+
io: Socket;
|
|
133
|
+
service(path: 'sessions'): SessionsService;
|
|
134
|
+
service(path: 'tasks'): TasksService;
|
|
135
|
+
service(path: 'messages'): MessagesService;
|
|
136
|
+
service(path: 'repos'): ReposService;
|
|
137
|
+
service(path: 'messages/bulk'): MessagesService;
|
|
138
|
+
service(path: 'tasks/bulk'): TasksService;
|
|
139
|
+
service(path: 'boards'): AgorService<Board>;
|
|
140
|
+
service(path: 'users'): AgorService<User>;
|
|
141
|
+
service(path: 'mcp-servers'): AgorService<MCPServer>;
|
|
142
|
+
service(path: 'context'): AgorService<ContextFileListItem | ContextFileDetail>;
|
|
143
|
+
service<K extends keyof ServiceTypes>(path: K): AgorService<ServiceTypes[K]>;
|
|
144
|
+
service(path: string): AgorService<unknown>;
|
|
145
|
+
authenticate(credentials?: {
|
|
146
|
+
strategy?: string;
|
|
147
|
+
email?: string;
|
|
148
|
+
password?: string;
|
|
149
|
+
accessToken?: string;
|
|
150
|
+
}): Promise<AuthenticationResult>;
|
|
151
|
+
logout(): Promise<AuthenticationResult | null>;
|
|
152
|
+
reAuthenticate(force?: boolean): Promise<AuthenticationResult>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create Feathers client connected to agor-daemon
|
|
156
|
+
*
|
|
157
|
+
* @param url - Daemon URL (default: http://localhost:3030)
|
|
158
|
+
* @param autoConnect - Auto-connect socket (default: true for CLI, false for React)
|
|
159
|
+
* @param options - Additional options
|
|
160
|
+
* @returns Feathers client instance with socket exposed
|
|
161
|
+
*/
|
|
162
|
+
declare function createClient(url?: string, autoConnect?: boolean, options?: {
|
|
163
|
+
/** Show connection status logs (useful for CLI) */
|
|
164
|
+
verbose?: boolean;
|
|
165
|
+
}): AgorClient;
|
|
166
|
+
/**
|
|
167
|
+
* Check if daemon is running
|
|
168
|
+
*
|
|
169
|
+
* @param url - Daemon URL
|
|
170
|
+
* @returns true if daemon is reachable
|
|
171
|
+
*/
|
|
172
|
+
declare function isDaemonRunning(url?: string): Promise<boolean>;
|
|
173
|
+
|
|
174
|
+
export { type AgorClient, type AgorService, type MessagesService, type ReposService, type ServiceTypes, type SessionsService, type TasksService, createClient, isDaemonRunning };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { d as Message } from '../message-DvBzHu7V.js';
|
|
2
|
+
import { x as Session, f as Board, p as MCPServer } from '../session-wAzjHatv.js';
|
|
3
|
+
import { e as Task, a as ContextFileListItem, b as ContextFileDetail } from '../task-DuIfiUbW.js';
|
|
4
|
+
import { b as AuthenticationResult } from '../feathers-BzHEPnpl.js';
|
|
5
|
+
import { a as User } from '../user-BmL3kFol.js';
|
|
6
|
+
import { a as Repo } from '../repo-CnvJ0B6-.js';
|
|
7
|
+
import { Params, Paginated, Application } from '@feathersjs/feathers';
|
|
8
|
+
import { Socket } from 'socket.io-client';
|
|
9
|
+
import '../id-DMqyogFB.js';
|
|
10
|
+
import '../agentic-tool-B_gFNpk5.js';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Feathers Client for Agor
|
|
14
|
+
*
|
|
15
|
+
* Shared client library for connecting to agor-daemon from CLI and UI
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Service interfaces for type safety
|
|
20
|
+
*/
|
|
21
|
+
interface ServiceTypes {
|
|
22
|
+
sessions: Session;
|
|
23
|
+
tasks: Task;
|
|
24
|
+
boards: Board;
|
|
25
|
+
repos: Repo;
|
|
26
|
+
users: User;
|
|
27
|
+
'mcp-servers': MCPServer;
|
|
28
|
+
context: ContextFileListItem | ContextFileDetail;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Feathers service with find method properly typed and event emitter methods
|
|
32
|
+
*/
|
|
33
|
+
interface AgorService<T> {
|
|
34
|
+
find(params?: Params): Promise<Paginated<T> | T[]>;
|
|
35
|
+
get(id: string, params?: Params): Promise<T>;
|
|
36
|
+
create(data: Partial<T>, params?: Params): Promise<T>;
|
|
37
|
+
update(id: string, data: T, params?: Params): Promise<T>;
|
|
38
|
+
patch(id: string | null, data: Partial<T> | null, params?: Params): Promise<T>;
|
|
39
|
+
remove(id: string, params?: Params): Promise<T>;
|
|
40
|
+
on(event: string, handler: (data: T) => void): void;
|
|
41
|
+
removeListener(event: string, handler: (data: T) => void): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sessions service with custom methods for forking, spawning, and genealogy
|
|
45
|
+
*/
|
|
46
|
+
interface SessionsService extends AgorService<Session> {
|
|
47
|
+
/**
|
|
48
|
+
* Fork a session at a decision point
|
|
49
|
+
* Creates a new session branching from the parent at a specific task
|
|
50
|
+
*/
|
|
51
|
+
fork(id: string, data: {
|
|
52
|
+
prompt: string;
|
|
53
|
+
task_id?: string;
|
|
54
|
+
}, params?: Params): Promise<Session>;
|
|
55
|
+
/**
|
|
56
|
+
* Spawn a child session from a parent
|
|
57
|
+
* Creates a new session with the parent's context
|
|
58
|
+
*/
|
|
59
|
+
spawn(id: string, data: {
|
|
60
|
+
prompt: string;
|
|
61
|
+
agent?: string;
|
|
62
|
+
task_id?: string;
|
|
63
|
+
}, params?: Params): Promise<Session>;
|
|
64
|
+
/**
|
|
65
|
+
* Get genealogy tree for a session
|
|
66
|
+
* Returns the full ancestor/descendant tree
|
|
67
|
+
*/
|
|
68
|
+
getGenealogy(id: string, params?: Params): Promise<unknown>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Tasks service with bulk creation support
|
|
72
|
+
*/
|
|
73
|
+
interface TasksService extends AgorService<Task> {
|
|
74
|
+
/**
|
|
75
|
+
* Create multiple tasks in a single request
|
|
76
|
+
* Returns array of created tasks with IDs
|
|
77
|
+
*/
|
|
78
|
+
createMany(data: Partial<Task>[]): Promise<Task[]>;
|
|
79
|
+
/**
|
|
80
|
+
* Mark a task as completed
|
|
81
|
+
*/
|
|
82
|
+
complete(id: string, data: {
|
|
83
|
+
report?: unknown;
|
|
84
|
+
}, params?: Params): Promise<Task>;
|
|
85
|
+
/**
|
|
86
|
+
* Mark a task as failed
|
|
87
|
+
*/
|
|
88
|
+
fail(id: string, data: {
|
|
89
|
+
error: string;
|
|
90
|
+
}, params?: Params): Promise<Task>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Messages service with bulk creation support
|
|
94
|
+
*/
|
|
95
|
+
interface MessagesService extends AgorService<Message> {
|
|
96
|
+
/**
|
|
97
|
+
* Create multiple messages in a single request
|
|
98
|
+
* Returns array of created messages with IDs
|
|
99
|
+
*/
|
|
100
|
+
createMany(data: Partial<Message>[]): Promise<Message[]>;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Repos service with worktree management
|
|
104
|
+
*/
|
|
105
|
+
interface ReposService extends AgorService<Repo> {
|
|
106
|
+
/**
|
|
107
|
+
* Clone a repository and register it
|
|
108
|
+
*/
|
|
109
|
+
clone(data: {
|
|
110
|
+
url: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
}, params?: Params): Promise<Repo>;
|
|
113
|
+
/**
|
|
114
|
+
* Create a git worktree for a repository
|
|
115
|
+
*/
|
|
116
|
+
createWorktree(id: string, data: {
|
|
117
|
+
name: string;
|
|
118
|
+
ref: string;
|
|
119
|
+
createBranch?: boolean;
|
|
120
|
+
pullLatest?: boolean;
|
|
121
|
+
sourceBranch?: string;
|
|
122
|
+
}, params?: Params): Promise<Repo>;
|
|
123
|
+
/**
|
|
124
|
+
* Remove a git worktree
|
|
125
|
+
*/
|
|
126
|
+
removeWorktree(id: string, name: string, params?: Params): Promise<Repo>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Agor client with socket.io connection exposed for lifecycle management
|
|
130
|
+
*/
|
|
131
|
+
interface AgorClient extends Omit<Application<ServiceTypes>, 'service'> {
|
|
132
|
+
io: Socket;
|
|
133
|
+
service(path: 'sessions'): SessionsService;
|
|
134
|
+
service(path: 'tasks'): TasksService;
|
|
135
|
+
service(path: 'messages'): MessagesService;
|
|
136
|
+
service(path: 'repos'): ReposService;
|
|
137
|
+
service(path: 'messages/bulk'): MessagesService;
|
|
138
|
+
service(path: 'tasks/bulk'): TasksService;
|
|
139
|
+
service(path: 'boards'): AgorService<Board>;
|
|
140
|
+
service(path: 'users'): AgorService<User>;
|
|
141
|
+
service(path: 'mcp-servers'): AgorService<MCPServer>;
|
|
142
|
+
service(path: 'context'): AgorService<ContextFileListItem | ContextFileDetail>;
|
|
143
|
+
service<K extends keyof ServiceTypes>(path: K): AgorService<ServiceTypes[K]>;
|
|
144
|
+
service(path: string): AgorService<unknown>;
|
|
145
|
+
authenticate(credentials?: {
|
|
146
|
+
strategy?: string;
|
|
147
|
+
email?: string;
|
|
148
|
+
password?: string;
|
|
149
|
+
accessToken?: string;
|
|
150
|
+
}): Promise<AuthenticationResult>;
|
|
151
|
+
logout(): Promise<AuthenticationResult | null>;
|
|
152
|
+
reAuthenticate(force?: boolean): Promise<AuthenticationResult>;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Create Feathers client connected to agor-daemon
|
|
156
|
+
*
|
|
157
|
+
* @param url - Daemon URL (default: http://localhost:3030)
|
|
158
|
+
* @param autoConnect - Auto-connect socket (default: true for CLI, false for React)
|
|
159
|
+
* @param options - Additional options
|
|
160
|
+
* @returns Feathers client instance with socket exposed
|
|
161
|
+
*/
|
|
162
|
+
declare function createClient(url?: string, autoConnect?: boolean, options?: {
|
|
163
|
+
/** Show connection status logs (useful for CLI) */
|
|
164
|
+
verbose?: boolean;
|
|
165
|
+
}): AgorClient;
|
|
166
|
+
/**
|
|
167
|
+
* Check if daemon is running
|
|
168
|
+
*
|
|
169
|
+
* @param url - Daemon URL
|
|
170
|
+
* @returns true if daemon is reachable
|
|
171
|
+
*/
|
|
172
|
+
declare function isDaemonRunning(url?: string): Promise<boolean>;
|
|
173
|
+
|
|
174
|
+
export { type AgorClient, type AgorService, type MessagesService, type ReposService, type ServiceTypes, type SessionsService, type TasksService, createClient, isDaemonRunning };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// src/api/index.ts
|
|
2
|
+
import authentication from "@feathersjs/authentication-client";
|
|
3
|
+
import { feathers } from "@feathersjs/feathers";
|
|
4
|
+
import socketio from "@feathersjs/socketio-client";
|
|
5
|
+
import io from "socket.io-client";
|
|
6
|
+
function createClient(url = "http://localhost:3030", autoConnect = true, options) {
|
|
7
|
+
const socket = io(url, {
|
|
8
|
+
// Auto-connect by default for CLI, manual control for React hooks
|
|
9
|
+
autoConnect,
|
|
10
|
+
// Reconnection settings (less aggressive to prevent socket exhaustion)
|
|
11
|
+
reconnection: true,
|
|
12
|
+
reconnectionDelay: 1e3,
|
|
13
|
+
// Wait 1s before first reconnect attempt
|
|
14
|
+
reconnectionDelayMax: 2e3,
|
|
15
|
+
// Max 2s between attempts
|
|
16
|
+
reconnectionAttempts: 2,
|
|
17
|
+
// Only try 2 times before giving up (fast fail for CLI)
|
|
18
|
+
// Timeout settings
|
|
19
|
+
timeout: 2e3,
|
|
20
|
+
// 2s timeout for initial connection
|
|
21
|
+
// Transports (WebSocket preferred, fallback to polling)
|
|
22
|
+
transports: ["websocket", "polling"],
|
|
23
|
+
// Connection lifecycle settings
|
|
24
|
+
closeOnBeforeunload: true
|
|
25
|
+
// Close socket when page unloads
|
|
26
|
+
});
|
|
27
|
+
if (options?.verbose) {
|
|
28
|
+
let attemptCount = 0;
|
|
29
|
+
socket.on("connect_error", (error) => {
|
|
30
|
+
attemptCount++;
|
|
31
|
+
if (attemptCount === 1) {
|
|
32
|
+
console.error(`\u2717 Daemon not running at ${url}`);
|
|
33
|
+
console.error(` Retrying connection (${attemptCount}/2)...`);
|
|
34
|
+
} else {
|
|
35
|
+
console.error(` Retry ${attemptCount}/2 failed`);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
socket.on("connect", () => {
|
|
39
|
+
if (attemptCount > 0) {
|
|
40
|
+
console.log("\u2713 Connected to daemon");
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
const client = feathers();
|
|
45
|
+
client.configure(socketio(socket));
|
|
46
|
+
const storage = typeof globalThis !== "undefined" && "localStorage" in globalThis ? globalThis.localStorage : void 0;
|
|
47
|
+
client.configure(authentication({ storage }));
|
|
48
|
+
client.io = socket;
|
|
49
|
+
return client;
|
|
50
|
+
}
|
|
51
|
+
async function isDaemonRunning(url = "http://localhost:3030") {
|
|
52
|
+
try {
|
|
53
|
+
const response = await fetch(`${url}/health`, { signal: AbortSignal.timeout(1e3) });
|
|
54
|
+
return response.ok;
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
createClient,
|
|
61
|
+
isDaemonRunning
|
|
62
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { C as CommentID, B as BoardID, b as UserID, a as SessionID, T as TaskID, M as MessageID, W as WorktreeID } from './id-DMqyogFB.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Individual reaction on a comment
|
|
5
|
+
* Stored as JSON array: [{ user_id: "abc", emoji: "👍" }, ...]
|
|
6
|
+
*/
|
|
7
|
+
interface CommentReaction {
|
|
8
|
+
user_id: string;
|
|
9
|
+
emoji: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reactions grouped by emoji for display
|
|
13
|
+
* Example: { "👍": ["alice", "bob"], "🎉": ["charlie"] }
|
|
14
|
+
*/
|
|
15
|
+
type ReactionSummary = Record<string, string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Board Comment - Human-to-human conversations and collaboration
|
|
18
|
+
*
|
|
19
|
+
* Flexible attachment strategy supporting:
|
|
20
|
+
* - Board-level: General conversations (no attachments)
|
|
21
|
+
* - Object-level: Attached to sessions, tasks, messages, or worktrees
|
|
22
|
+
* - Spatial: Positioned on canvas (absolute or relative to objects)
|
|
23
|
+
*
|
|
24
|
+
* Threading model: Figma-style 2-layer (thread roots + replies)
|
|
25
|
+
* - Thread roots: parent_comment_id IS NULL, can be resolved, must have attachments
|
|
26
|
+
* - Replies: parent_comment_id IS NOT NULL, cannot be resolved, inherit parent context
|
|
27
|
+
*
|
|
28
|
+
* @see context/explorations/user-comments-and-conversation.md
|
|
29
|
+
*/
|
|
30
|
+
interface BoardComment {
|
|
31
|
+
/** Unique comment identifier (UUIDv7) */
|
|
32
|
+
comment_id: CommentID;
|
|
33
|
+
/** Board this comment belongs to */
|
|
34
|
+
board_id: BoardID;
|
|
35
|
+
/** User who created the comment */
|
|
36
|
+
created_by: UserID;
|
|
37
|
+
/** Comment content (Markdown-supported) */
|
|
38
|
+
content: string;
|
|
39
|
+
/** First 200 chars for list views */
|
|
40
|
+
content_preview: string;
|
|
41
|
+
/** Optional: Attached to session */
|
|
42
|
+
session_id?: SessionID;
|
|
43
|
+
/** Optional: Attached to task */
|
|
44
|
+
task_id?: TaskID;
|
|
45
|
+
/** Optional: Attached to message */
|
|
46
|
+
message_id?: MessageID;
|
|
47
|
+
/** Optional: Attached to worktree */
|
|
48
|
+
worktree_id?: WorktreeID;
|
|
49
|
+
/** Optional: Parent comment for threaded replies */
|
|
50
|
+
parent_comment_id?: CommentID;
|
|
51
|
+
/** Whether comment is resolved (GitHub PR-style) */
|
|
52
|
+
resolved: boolean;
|
|
53
|
+
/** Whether comment was edited after creation */
|
|
54
|
+
edited: boolean;
|
|
55
|
+
/** Emoji reactions (for both thread roots and replies) */
|
|
56
|
+
reactions: CommentReaction[];
|
|
57
|
+
/** Optional: Spatial positioning on canvas */
|
|
58
|
+
position?: {
|
|
59
|
+
/** Absolute board coordinates (React Flow coordinates) */
|
|
60
|
+
absolute?: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
/** OR relative to session (follows session when it moves) */
|
|
65
|
+
relative?: {
|
|
66
|
+
session_id: string;
|
|
67
|
+
offset_x: number;
|
|
68
|
+
offset_y: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** Optional: @mentioned user IDs */
|
|
72
|
+
mentions?: UserID[];
|
|
73
|
+
created_at: Date;
|
|
74
|
+
updated_at?: Date;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Comment attachment type determination
|
|
78
|
+
*
|
|
79
|
+
* Hierarchy (most specific → least specific):
|
|
80
|
+
* 1. MESSAGE - Attached to specific message
|
|
81
|
+
* 2. TASK - Attached to task
|
|
82
|
+
* 3. SESSION_SPATIAL - Spatial pin on session
|
|
83
|
+
* 4. SESSION - Attached to session
|
|
84
|
+
* 5. WORKTREE - Attached to worktree
|
|
85
|
+
* 6. BOARD_SPATIAL - Spatial pin on board
|
|
86
|
+
* 7. BOARD - General board conversation
|
|
87
|
+
*/
|
|
88
|
+
declare const CommentAttachmentType: {
|
|
89
|
+
readonly MESSAGE: "message";
|
|
90
|
+
readonly TASK: "task";
|
|
91
|
+
readonly SESSION_SPATIAL: "session-spatial";
|
|
92
|
+
readonly SESSION: "session";
|
|
93
|
+
readonly WORKTREE: "worktree";
|
|
94
|
+
readonly BOARD_SPATIAL: "board-spatial";
|
|
95
|
+
readonly BOARD: "board";
|
|
96
|
+
};
|
|
97
|
+
type CommentAttachmentType = (typeof CommentAttachmentType)[keyof typeof CommentAttachmentType];
|
|
98
|
+
/**
|
|
99
|
+
* Helper function to determine comment attachment type
|
|
100
|
+
*/
|
|
101
|
+
declare function getCommentAttachmentType(comment: BoardComment): CommentAttachmentType;
|
|
102
|
+
/**
|
|
103
|
+
* Create input for new comment (omits auto-generated fields)
|
|
104
|
+
*/
|
|
105
|
+
type BoardCommentCreate = Omit<BoardComment, 'comment_id' | 'created_at' | 'updated_at' | 'content_preview'> & {
|
|
106
|
+
content: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Patch input for updating comment (partial)
|
|
110
|
+
*/
|
|
111
|
+
type BoardCommentPatch = Partial<Pick<BoardComment, 'content' | 'resolved'>> & {
|
|
112
|
+
edited?: boolean;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Check if comment is a thread root (top-level comment)
|
|
116
|
+
*/
|
|
117
|
+
declare function isThreadRoot(comment: BoardComment): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Check if comment is a reply (nested comment)
|
|
120
|
+
*/
|
|
121
|
+
declare function isReply(comment: BoardComment): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Check if comment can be resolved
|
|
124
|
+
* Only thread roots can be resolved, replies cannot
|
|
125
|
+
*/
|
|
126
|
+
declare function isResolvable(comment: BoardComment): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Group reactions by emoji for display
|
|
129
|
+
* Input: [{ user_id: "alice", emoji: "👍" }, { user_id: "bob", emoji: "👍" }, { user_id: "charlie", emoji: "🎉" }]
|
|
130
|
+
* Output: { "👍": ["alice", "bob"], "🎉": ["charlie"] }
|
|
131
|
+
*/
|
|
132
|
+
declare function groupReactions(reactions: CommentReaction[]): ReactionSummary;
|
|
133
|
+
|
|
134
|
+
export { type BoardComment as B, type CommentReaction as C, type ReactionSummary as R, CommentAttachmentType as a, type BoardCommentCreate as b, type BoardCommentPatch as c, isReply as d, isResolvable as e, groupReactions as f, getCommentAttachmentType as g, isThreadRoot as i };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { C as CommentID, B as BoardID, b as UserID, a as SessionID, T as TaskID, M as MessageID, W as WorktreeID } from './id-DMqyogFB.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Individual reaction on a comment
|
|
5
|
+
* Stored as JSON array: [{ user_id: "abc", emoji: "👍" }, ...]
|
|
6
|
+
*/
|
|
7
|
+
interface CommentReaction {
|
|
8
|
+
user_id: string;
|
|
9
|
+
emoji: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Reactions grouped by emoji for display
|
|
13
|
+
* Example: { "👍": ["alice", "bob"], "🎉": ["charlie"] }
|
|
14
|
+
*/
|
|
15
|
+
type ReactionSummary = Record<string, string[]>;
|
|
16
|
+
/**
|
|
17
|
+
* Board Comment - Human-to-human conversations and collaboration
|
|
18
|
+
*
|
|
19
|
+
* Flexible attachment strategy supporting:
|
|
20
|
+
* - Board-level: General conversations (no attachments)
|
|
21
|
+
* - Object-level: Attached to sessions, tasks, messages, or worktrees
|
|
22
|
+
* - Spatial: Positioned on canvas (absolute or relative to objects)
|
|
23
|
+
*
|
|
24
|
+
* Threading model: Figma-style 2-layer (thread roots + replies)
|
|
25
|
+
* - Thread roots: parent_comment_id IS NULL, can be resolved, must have attachments
|
|
26
|
+
* - Replies: parent_comment_id IS NOT NULL, cannot be resolved, inherit parent context
|
|
27
|
+
*
|
|
28
|
+
* @see context/explorations/user-comments-and-conversation.md
|
|
29
|
+
*/
|
|
30
|
+
interface BoardComment {
|
|
31
|
+
/** Unique comment identifier (UUIDv7) */
|
|
32
|
+
comment_id: CommentID;
|
|
33
|
+
/** Board this comment belongs to */
|
|
34
|
+
board_id: BoardID;
|
|
35
|
+
/** User who created the comment */
|
|
36
|
+
created_by: UserID;
|
|
37
|
+
/** Comment content (Markdown-supported) */
|
|
38
|
+
content: string;
|
|
39
|
+
/** First 200 chars for list views */
|
|
40
|
+
content_preview: string;
|
|
41
|
+
/** Optional: Attached to session */
|
|
42
|
+
session_id?: SessionID;
|
|
43
|
+
/** Optional: Attached to task */
|
|
44
|
+
task_id?: TaskID;
|
|
45
|
+
/** Optional: Attached to message */
|
|
46
|
+
message_id?: MessageID;
|
|
47
|
+
/** Optional: Attached to worktree */
|
|
48
|
+
worktree_id?: WorktreeID;
|
|
49
|
+
/** Optional: Parent comment for threaded replies */
|
|
50
|
+
parent_comment_id?: CommentID;
|
|
51
|
+
/** Whether comment is resolved (GitHub PR-style) */
|
|
52
|
+
resolved: boolean;
|
|
53
|
+
/** Whether comment was edited after creation */
|
|
54
|
+
edited: boolean;
|
|
55
|
+
/** Emoji reactions (for both thread roots and replies) */
|
|
56
|
+
reactions: CommentReaction[];
|
|
57
|
+
/** Optional: Spatial positioning on canvas */
|
|
58
|
+
position?: {
|
|
59
|
+
/** Absolute board coordinates (React Flow coordinates) */
|
|
60
|
+
absolute?: {
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
};
|
|
64
|
+
/** OR relative to session (follows session when it moves) */
|
|
65
|
+
relative?: {
|
|
66
|
+
session_id: string;
|
|
67
|
+
offset_x: number;
|
|
68
|
+
offset_y: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
/** Optional: @mentioned user IDs */
|
|
72
|
+
mentions?: UserID[];
|
|
73
|
+
created_at: Date;
|
|
74
|
+
updated_at?: Date;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Comment attachment type determination
|
|
78
|
+
*
|
|
79
|
+
* Hierarchy (most specific → least specific):
|
|
80
|
+
* 1. MESSAGE - Attached to specific message
|
|
81
|
+
* 2. TASK - Attached to task
|
|
82
|
+
* 3. SESSION_SPATIAL - Spatial pin on session
|
|
83
|
+
* 4. SESSION - Attached to session
|
|
84
|
+
* 5. WORKTREE - Attached to worktree
|
|
85
|
+
* 6. BOARD_SPATIAL - Spatial pin on board
|
|
86
|
+
* 7. BOARD - General board conversation
|
|
87
|
+
*/
|
|
88
|
+
declare const CommentAttachmentType: {
|
|
89
|
+
readonly MESSAGE: "message";
|
|
90
|
+
readonly TASK: "task";
|
|
91
|
+
readonly SESSION_SPATIAL: "session-spatial";
|
|
92
|
+
readonly SESSION: "session";
|
|
93
|
+
readonly WORKTREE: "worktree";
|
|
94
|
+
readonly BOARD_SPATIAL: "board-spatial";
|
|
95
|
+
readonly BOARD: "board";
|
|
96
|
+
};
|
|
97
|
+
type CommentAttachmentType = (typeof CommentAttachmentType)[keyof typeof CommentAttachmentType];
|
|
98
|
+
/**
|
|
99
|
+
* Helper function to determine comment attachment type
|
|
100
|
+
*/
|
|
101
|
+
declare function getCommentAttachmentType(comment: BoardComment): CommentAttachmentType;
|
|
102
|
+
/**
|
|
103
|
+
* Create input for new comment (omits auto-generated fields)
|
|
104
|
+
*/
|
|
105
|
+
type BoardCommentCreate = Omit<BoardComment, 'comment_id' | 'created_at' | 'updated_at' | 'content_preview'> & {
|
|
106
|
+
content: string;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Patch input for updating comment (partial)
|
|
110
|
+
*/
|
|
111
|
+
type BoardCommentPatch = Partial<Pick<BoardComment, 'content' | 'resolved'>> & {
|
|
112
|
+
edited?: boolean;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Check if comment is a thread root (top-level comment)
|
|
116
|
+
*/
|
|
117
|
+
declare function isThreadRoot(comment: BoardComment): boolean;
|
|
118
|
+
/**
|
|
119
|
+
* Check if comment is a reply (nested comment)
|
|
120
|
+
*/
|
|
121
|
+
declare function isReply(comment: BoardComment): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Check if comment can be resolved
|
|
124
|
+
* Only thread roots can be resolved, replies cannot
|
|
125
|
+
*/
|
|
126
|
+
declare function isResolvable(comment: BoardComment): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Group reactions by emoji for display
|
|
129
|
+
* Input: [{ user_id: "alice", emoji: "👍" }, { user_id: "bob", emoji: "👍" }, { user_id: "charlie", emoji: "🎉" }]
|
|
130
|
+
* Output: { "👍": ["alice", "bob"], "🎉": ["charlie"] }
|
|
131
|
+
*/
|
|
132
|
+
declare function groupReactions(reactions: CommentReaction[]): ReactionSummary;
|
|
133
|
+
|
|
134
|
+
export { type BoardComment as B, type CommentReaction as C, type ReactionSummary as R, CommentAttachmentType as a, type BoardCommentCreate as b, type BoardCommentPatch as c, isReply as d, isResolvable as e, groupReactions as f, getCommentAttachmentType as g, isThreadRoot as i };
|