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,214 @@
|
|
|
1
|
+
export { PermissionDecision, PermissionRequest } from '../permissions/index.js';
|
|
2
|
+
export { a as AgenticTool, A as AgenticToolName } from '../agentic-tool-B_gFNpk5.js';
|
|
3
|
+
export { f as Board, b as BoardEntityObject, e as BoardObject, B as BoardObjectType, C as ClaudeCodePermissionMode, a as CodexPermissionMode, r as CreateMCPServerInput, J as JSONSchema, o as MCPCapabilities, t as MCPConfigFile, m as MCPPrompt, l as MCPResource, i as MCPScope, p as MCPServer, q as MCPServerFilters, M as MCPServerID, u as MCPServersConfig, j as MCPSource, s as MCPTestResult, k as MCPTool, h as MCPTransport, P as PermissionMode, n as PromptArgument, x as Session, S as SessionMCPServer, v as SessionStatus, g as TeamID, T as TextBoardObject, U as UpdateMCPServerInput, d as ZoneBoardObject, c as ZoneTrigger, Z as ZoneTriggerBehavior, w as getDefaultPermissionMode } from '../session-wAzjHatv.js';
|
|
4
|
+
export { B as BoardComment, b as BoardCommentCreate, c as BoardCommentPatch, a as CommentAttachmentType, C as CommentReaction, R as ReactionSummary, g as getCommentAttachmentType, f as groupReactions, d as isReply, e as isResolvable, i as isThreadRoot } from '../board-comment-gC_-twPx.js';
|
|
5
|
+
export { b as ContextFileDetail, a as ContextFileListItem, C as ContextFilePath, d as Report, R as ReportPath, c as ReportTemplate, e as Task, T as TaskStatus } from '../task-DuIfiUbW.js';
|
|
6
|
+
export { a as AuthenticatedParams, A as AuthenticatedUser, b as AuthenticationResult, B as BaseService, C as CreateHookContext, H as HookContext, Q as QueryParams, S as ServiceWithEvents } from '../feathers-BzHEPnpl.js';
|
|
7
|
+
import { B as BoardID } from '../id-DMqyogFB.js';
|
|
8
|
+
export { A as AgenticToolID, C as CommentID, I as IDPrefix, M as MessageID, a as SessionID, S as ShortID, T as TaskID, U as UUID, b as UserID, W as WorktreeID } from '../id-DMqyogFB.js';
|
|
9
|
+
export { C as ContentBlock, d as Message, e as MessageCreate, M as MessageRole, a as MessageType, c as PermissionRequestContent, P as PermissionScope, b as PermissionStatus, T as ToolUse } from '../message-DvBzHu7V.js';
|
|
10
|
+
import { a as User } from '../user-BmL3kFol.js';
|
|
11
|
+
export { C as CreateUserInput, b as UpdateUserInput, U as UserRole } from '../user-BmL3kFol.js';
|
|
12
|
+
export { a as Repo, e as RepoEnvironmentConfig, R as RepoSlug, c as Worktree, b as WorktreeConfig, d as WorktreeEnvironmentInstance, W as WorktreeName } from '../repo-CnvJ0B6-.js';
|
|
13
|
+
export { Id, NullableId, Paginated, Params, Service, ServiceMethods } from '@feathersjs/feathers';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Cursor position event (client → server)
|
|
17
|
+
*/
|
|
18
|
+
interface CursorMoveEvent {
|
|
19
|
+
boardId: BoardID;
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Cursor position broadcast (server → clients)
|
|
26
|
+
*/
|
|
27
|
+
interface CursorMovedEvent {
|
|
28
|
+
userId: string;
|
|
29
|
+
boardId: BoardID;
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
timestamp: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Cursor leave event (user navigates away from board)
|
|
36
|
+
*/
|
|
37
|
+
interface CursorLeaveEvent {
|
|
38
|
+
boardId: BoardID;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Remote cursor state for rendering
|
|
42
|
+
*/
|
|
43
|
+
interface RemoteCursor {
|
|
44
|
+
userId: string;
|
|
45
|
+
user: User;
|
|
46
|
+
x: number;
|
|
47
|
+
y: number;
|
|
48
|
+
timestamp: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Active user for facepile display
|
|
52
|
+
*/
|
|
53
|
+
interface ActiveUser {
|
|
54
|
+
user: User;
|
|
55
|
+
lastSeen: number;
|
|
56
|
+
cursor?: {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
type SessionViewMode = 'collapsed' | 'expanded' | 'drawer';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Generic Utility Types
|
|
66
|
+
*
|
|
67
|
+
* Reusable type utilities for common patterns across Agor.
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Input type for creating an entity
|
|
71
|
+
*
|
|
72
|
+
* Omits auto-generated fields (timestamps) and optionally allows ID for bulk operations.
|
|
73
|
+
*
|
|
74
|
+
* @template T - Entity type
|
|
75
|
+
* @template OmitKeys - Additional keys to omit (e.g., 'user_id' if auto-assigned)
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* type CreateSessionInput = CreateInput<Session, 'session_id'>;
|
|
80
|
+
* // Omits: session_id, created_at, last_updated
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
type CreateInput<T, OmitKeys extends keyof T = never> = Omit<T, 'created_at' | 'last_updated' | 'updated_at' | OmitKeys> & {
|
|
84
|
+
[K in Extract<keyof T, `${string}_id`>]?: T[K];
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Input type for updating an entity
|
|
88
|
+
*
|
|
89
|
+
* All fields optional except auto-generated ones.
|
|
90
|
+
*
|
|
91
|
+
* @template T - Entity type
|
|
92
|
+
* @template OmitKeys - Additional keys to omit (e.g., immutable fields)
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* type UpdateSessionInput = UpdateInput<Session, 'session_id' | 'created_at'>;
|
|
97
|
+
* // All fields optional except session_id and created_at
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
type UpdateInput<T, OmitKeys extends keyof T = never> = Partial<Omit<T, 'created_at' | 'last_updated' | 'updated_at' | OmitKeys>>;
|
|
101
|
+
/**
|
|
102
|
+
* Paginated result wrapper
|
|
103
|
+
*
|
|
104
|
+
* Standard pagination format used by FeathersJS.
|
|
105
|
+
*
|
|
106
|
+
* @template T - Entity type
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* const result: PaginatedResult<Session> = {
|
|
111
|
+
* total: 100,
|
|
112
|
+
* limit: 10,
|
|
113
|
+
* skip: 0,
|
|
114
|
+
* data: sessions
|
|
115
|
+
* };
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
interface PaginatedResult<T> {
|
|
119
|
+
/** Total number of matching entities */
|
|
120
|
+
total: number;
|
|
121
|
+
/** Maximum results per page */
|
|
122
|
+
limit: number;
|
|
123
|
+
/** Number of results skipped */
|
|
124
|
+
skip: number;
|
|
125
|
+
/** Array of entities for this page */
|
|
126
|
+
data: T[];
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Flatten nested object for database storage
|
|
130
|
+
*
|
|
131
|
+
* Converts nested objects to dot notation for indexed columns.
|
|
132
|
+
*
|
|
133
|
+
* @template T - Object type
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```ts
|
|
137
|
+
* type GitState = { ref: string; base_sha: string; };
|
|
138
|
+
* type Flat = FlattenObject<GitState>;
|
|
139
|
+
* // Result: { 'git_state.ref': string; 'git_state.base_sha': string; }
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
type FlattenObject<T extends Record<string, unknown>> = {
|
|
143
|
+
[K in keyof T as T[K] extends Record<string, unknown> ? `${string & K}.${string & keyof T[K]}` : K]: T[K] extends Record<string, unknown> ? T[K][keyof T[K]] : T[K];
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Check if value is non-null and non-undefined
|
|
147
|
+
*
|
|
148
|
+
* Useful for filtering arrays and narrowing types.
|
|
149
|
+
*
|
|
150
|
+
* @param value - Value to check
|
|
151
|
+
* @returns True if value is defined (not null or undefined)
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```ts
|
|
155
|
+
* const ids = [id1, undefined, id2, null].filter(isDefined);
|
|
156
|
+
* // Result: [id1, id2] with type string[]
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare function isDefined<T>(value: T | null | undefined): value is T;
|
|
160
|
+
/**
|
|
161
|
+
* Check if value is a non-empty string
|
|
162
|
+
*
|
|
163
|
+
* @param value - Value to check
|
|
164
|
+
* @returns True if value is a non-empty string
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```ts
|
|
168
|
+
* const names = ['', 'Alice', ' ', 'Bob'].filter(isNonEmptyString);
|
|
169
|
+
* // Result: ['Alice', 'Bob']
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
declare function isNonEmptyString(value: unknown): value is string;
|
|
173
|
+
/**
|
|
174
|
+
* Make specific keys required
|
|
175
|
+
*
|
|
176
|
+
* @template T - Object type
|
|
177
|
+
* @template K - Keys to make required
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* type SessionWithTitle = RequireKeys<Session, 'title'>;
|
|
182
|
+
* // Session with title required instead of optional
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
type RequireKeys<T, K extends keyof T> = T & Required<Pick<T, K>>;
|
|
186
|
+
/**
|
|
187
|
+
* Make specific keys optional
|
|
188
|
+
*
|
|
189
|
+
* @template T - Object type
|
|
190
|
+
* @template K - Keys to make optional
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```ts
|
|
194
|
+
* type PartialSession = PartialKeys<Session, 'description' | 'title'>;
|
|
195
|
+
* // Session with description and title optional
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
type PartialKeys<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
199
|
+
/**
|
|
200
|
+
* Make all properties and nested properties readonly
|
|
201
|
+
*
|
|
202
|
+
* @template T - Object type
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* type ImmutableSession = DeepReadonly<Session>;
|
|
207
|
+
* // All fields and nested fields are readonly
|
|
208
|
+
* ```
|
|
209
|
+
*/
|
|
210
|
+
type DeepReadonly<T> = {
|
|
211
|
+
readonly [K in keyof T]: T[K] extends Record<string, unknown> ? DeepReadonly<T[K]> : T[K];
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export { type ActiveUser, BoardID, type CreateInput, type CursorLeaveEvent, type CursorMoveEvent, type CursorMovedEvent, type DeepReadonly, type FlattenObject, type PaginatedResult, type PartialKeys, type RemoteCursor, type RequireKeys, type SessionViewMode, type UpdateInput, User, isDefined, isNonEmptyString };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/types/board-comment.ts
|
|
2
|
+
var CommentAttachmentType = {
|
|
3
|
+
MESSAGE: "message",
|
|
4
|
+
TASK: "task",
|
|
5
|
+
SESSION_SPATIAL: "session-spatial",
|
|
6
|
+
SESSION: "session",
|
|
7
|
+
WORKTREE: "worktree",
|
|
8
|
+
BOARD_SPATIAL: "board-spatial",
|
|
9
|
+
BOARD: "board"
|
|
10
|
+
};
|
|
11
|
+
function getCommentAttachmentType(comment) {
|
|
12
|
+
if (comment.message_id) return CommentAttachmentType.MESSAGE;
|
|
13
|
+
if (comment.task_id) return CommentAttachmentType.TASK;
|
|
14
|
+
if (comment.session_id && comment.position?.relative)
|
|
15
|
+
return CommentAttachmentType.SESSION_SPATIAL;
|
|
16
|
+
if (comment.session_id) return CommentAttachmentType.SESSION;
|
|
17
|
+
if (comment.worktree_id) return CommentAttachmentType.WORKTREE;
|
|
18
|
+
if (comment.position?.absolute) return CommentAttachmentType.BOARD_SPATIAL;
|
|
19
|
+
return CommentAttachmentType.BOARD;
|
|
20
|
+
}
|
|
21
|
+
function isThreadRoot(comment) {
|
|
22
|
+
return !comment.parent_comment_id;
|
|
23
|
+
}
|
|
24
|
+
function isReply(comment) {
|
|
25
|
+
return !!comment.parent_comment_id;
|
|
26
|
+
}
|
|
27
|
+
function isResolvable(comment) {
|
|
28
|
+
return isThreadRoot(comment);
|
|
29
|
+
}
|
|
30
|
+
function groupReactions(reactions) {
|
|
31
|
+
const grouped = {};
|
|
32
|
+
for (const { emoji, user_id } of reactions) {
|
|
33
|
+
if (!grouped[emoji]) {
|
|
34
|
+
grouped[emoji] = [];
|
|
35
|
+
}
|
|
36
|
+
grouped[emoji].push(user_id);
|
|
37
|
+
}
|
|
38
|
+
return grouped;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/types/message.ts
|
|
42
|
+
var MessageRole = /* @__PURE__ */ ((MessageRole2) => {
|
|
43
|
+
MessageRole2["USER"] = "user";
|
|
44
|
+
MessageRole2["ASSISTANT"] = "assistant";
|
|
45
|
+
MessageRole2["SYSTEM"] = "system";
|
|
46
|
+
return MessageRole2;
|
|
47
|
+
})(MessageRole || {});
|
|
48
|
+
var PermissionScope = /* @__PURE__ */ ((PermissionScope2) => {
|
|
49
|
+
PermissionScope2["ONCE"] = "once";
|
|
50
|
+
PermissionScope2["SESSION"] = "session";
|
|
51
|
+
PermissionScope2["PROJECT"] = "project";
|
|
52
|
+
return PermissionScope2;
|
|
53
|
+
})(PermissionScope || {});
|
|
54
|
+
var PermissionStatus = /* @__PURE__ */ ((PermissionStatus2) => {
|
|
55
|
+
PermissionStatus2["PENDING"] = "pending";
|
|
56
|
+
PermissionStatus2["APPROVED"] = "approved";
|
|
57
|
+
PermissionStatus2["DENIED"] = "denied";
|
|
58
|
+
return PermissionStatus2;
|
|
59
|
+
})(PermissionStatus || {});
|
|
60
|
+
|
|
61
|
+
// src/types/session.ts
|
|
62
|
+
var SessionStatus = {
|
|
63
|
+
IDLE: "idle",
|
|
64
|
+
RUNNING: "running",
|
|
65
|
+
COMPLETED: "completed",
|
|
66
|
+
FAILED: "failed"
|
|
67
|
+
};
|
|
68
|
+
function getDefaultPermissionMode(agenticTool) {
|
|
69
|
+
switch (agenticTool) {
|
|
70
|
+
case "codex":
|
|
71
|
+
return "auto";
|
|
72
|
+
default:
|
|
73
|
+
return "acceptEdits";
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/types/task.ts
|
|
78
|
+
var TaskStatus = {
|
|
79
|
+
CREATED: "created",
|
|
80
|
+
RUNNING: "running",
|
|
81
|
+
STOPPING: "stopping",
|
|
82
|
+
// Stop requested, waiting for SDK to halt
|
|
83
|
+
AWAITING_PERMISSION: "awaiting_permission",
|
|
84
|
+
COMPLETED: "completed",
|
|
85
|
+
FAILED: "failed",
|
|
86
|
+
STOPPED: "stopped"
|
|
87
|
+
// User-requested stop (distinct from failed)
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// src/types/utils.ts
|
|
91
|
+
function isDefined(value) {
|
|
92
|
+
return value !== null && value !== void 0;
|
|
93
|
+
}
|
|
94
|
+
function isNonEmptyString(value) {
|
|
95
|
+
return typeof value === "string" && value.trim().length > 0;
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
CommentAttachmentType,
|
|
99
|
+
MessageRole,
|
|
100
|
+
PermissionScope,
|
|
101
|
+
PermissionStatus,
|
|
102
|
+
SessionStatus,
|
|
103
|
+
TaskStatus,
|
|
104
|
+
getCommentAttachmentType,
|
|
105
|
+
getDefaultPermissionMode,
|
|
106
|
+
groupReactions,
|
|
107
|
+
isDefined,
|
|
108
|
+
isNonEmptyString,
|
|
109
|
+
isReply,
|
|
110
|
+
isResolvable,
|
|
111
|
+
isThreadRoot
|
|
112
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { b as UserID } from './id-DMqyogFB.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User role types
|
|
5
|
+
* - owner: Full system access, can manage all users and settings
|
|
6
|
+
* - admin: Can manage most resources, cannot modify owner
|
|
7
|
+
* - member: Standard user access, can create and manage own sessions
|
|
8
|
+
* - viewer: Read-only access
|
|
9
|
+
*/
|
|
10
|
+
type UserRole = 'owner' | 'admin' | 'member' | 'viewer';
|
|
11
|
+
/**
|
|
12
|
+
* User type - Authentication and authorization
|
|
13
|
+
*/
|
|
14
|
+
interface User {
|
|
15
|
+
user_id: UserID;
|
|
16
|
+
email: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
emoji?: string;
|
|
19
|
+
role: UserRole;
|
|
20
|
+
avatar?: string;
|
|
21
|
+
preferences?: Record<string, unknown>;
|
|
22
|
+
onboarding_completed: boolean;
|
|
23
|
+
created_at: Date;
|
|
24
|
+
updated_at?: Date;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create user input (password required, not stored in User type)
|
|
28
|
+
*/
|
|
29
|
+
interface CreateUserInput {
|
|
30
|
+
email: string;
|
|
31
|
+
password: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
emoji?: string;
|
|
34
|
+
role?: UserRole;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Update user input
|
|
38
|
+
*/
|
|
39
|
+
interface UpdateUserInput {
|
|
40
|
+
email?: string;
|
|
41
|
+
password?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
emoji?: string;
|
|
44
|
+
role?: UserRole;
|
|
45
|
+
avatar?: string;
|
|
46
|
+
preferences?: Record<string, unknown>;
|
|
47
|
+
onboarding_completed?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type { CreateUserInput as C, UserRole as U, User as a, UpdateUserInput as b };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { b as UserID } from './id-DMqyogFB.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* User role types
|
|
5
|
+
* - owner: Full system access, can manage all users and settings
|
|
6
|
+
* - admin: Can manage most resources, cannot modify owner
|
|
7
|
+
* - member: Standard user access, can create and manage own sessions
|
|
8
|
+
* - viewer: Read-only access
|
|
9
|
+
*/
|
|
10
|
+
type UserRole = 'owner' | 'admin' | 'member' | 'viewer';
|
|
11
|
+
/**
|
|
12
|
+
* User type - Authentication and authorization
|
|
13
|
+
*/
|
|
14
|
+
interface User {
|
|
15
|
+
user_id: UserID;
|
|
16
|
+
email: string;
|
|
17
|
+
name?: string;
|
|
18
|
+
emoji?: string;
|
|
19
|
+
role: UserRole;
|
|
20
|
+
avatar?: string;
|
|
21
|
+
preferences?: Record<string, unknown>;
|
|
22
|
+
onboarding_completed: boolean;
|
|
23
|
+
created_at: Date;
|
|
24
|
+
updated_at?: Date;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Create user input (password required, not stored in User type)
|
|
28
|
+
*/
|
|
29
|
+
interface CreateUserInput {
|
|
30
|
+
email: string;
|
|
31
|
+
password: string;
|
|
32
|
+
name?: string;
|
|
33
|
+
emoji?: string;
|
|
34
|
+
role?: UserRole;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Update user input
|
|
38
|
+
*/
|
|
39
|
+
interface UpdateUserInput {
|
|
40
|
+
email?: string;
|
|
41
|
+
password?: string;
|
|
42
|
+
name?: string;
|
|
43
|
+
emoji?: string;
|
|
44
|
+
role?: UserRole;
|
|
45
|
+
avatar?: string;
|
|
46
|
+
preferences?: Record<string, unknown>;
|
|
47
|
+
onboarding_completed?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type { CreateUserInput as C, UserRole as U, User as a, UpdateUserInput as b };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/pricing.ts
|
|
21
|
+
var pricing_exports = {};
|
|
22
|
+
__export(pricing_exports, {
|
|
23
|
+
calculateTokenCost: () => calculateTokenCost,
|
|
24
|
+
formatCost: () => formatCost,
|
|
25
|
+
formatTokenCount: () => formatTokenCount
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(pricing_exports);
|
|
28
|
+
var PRICING = {
|
|
29
|
+
"claude-code": {
|
|
30
|
+
// Claude Sonnet 4.5 pricing
|
|
31
|
+
input: 3,
|
|
32
|
+
// $3 per 1M input tokens
|
|
33
|
+
output: 15,
|
|
34
|
+
// $15 per 1M output tokens
|
|
35
|
+
cache_read: 0.3,
|
|
36
|
+
// $0.30 per 1M cache read tokens
|
|
37
|
+
cache_creation: 3.75
|
|
38
|
+
// $3.75 per 1M cache creation tokens
|
|
39
|
+
},
|
|
40
|
+
cursor: {
|
|
41
|
+
// Cursor uses Claude Sonnet 4.5 (same pricing as claude-code)
|
|
42
|
+
input: 3,
|
|
43
|
+
// $3 per 1M input tokens
|
|
44
|
+
output: 15,
|
|
45
|
+
// $15 per 1M output tokens
|
|
46
|
+
cache_read: 0.3,
|
|
47
|
+
// $0.30 per 1M cache read tokens
|
|
48
|
+
cache_creation: 3.75
|
|
49
|
+
// $3.75 per 1M cache creation tokens
|
|
50
|
+
},
|
|
51
|
+
codex: {
|
|
52
|
+
// OpenAI GPT-4 Turbo pricing (estimate for Codex)
|
|
53
|
+
input: 10,
|
|
54
|
+
// $10 per 1M input tokens
|
|
55
|
+
output: 30
|
|
56
|
+
// $30 per 1M output tokens
|
|
57
|
+
},
|
|
58
|
+
gemini: {
|
|
59
|
+
// Gemini 2.0 Flash pricing
|
|
60
|
+
input: 0.075,
|
|
61
|
+
// $0.075 per 1M input tokens (much cheaper!)
|
|
62
|
+
output: 0.3
|
|
63
|
+
// $0.30 per 1M output tokens
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
function calculateTokenCost(usage, agent) {
|
|
67
|
+
const pricing = PRICING[agent];
|
|
68
|
+
if (!pricing) {
|
|
69
|
+
console.warn(`No pricing data for agent: ${agent}`);
|
|
70
|
+
return 0;
|
|
71
|
+
}
|
|
72
|
+
let cost = 0;
|
|
73
|
+
if (usage.input_tokens) {
|
|
74
|
+
cost += usage.input_tokens / 1e6 * pricing.input;
|
|
75
|
+
}
|
|
76
|
+
if (usage.output_tokens) {
|
|
77
|
+
cost += usage.output_tokens / 1e6 * pricing.output;
|
|
78
|
+
}
|
|
79
|
+
if (usage.cache_read_tokens && pricing.cache_read) {
|
|
80
|
+
cost += usage.cache_read_tokens / 1e6 * pricing.cache_read;
|
|
81
|
+
}
|
|
82
|
+
if (usage.cache_creation_tokens && pricing.cache_creation) {
|
|
83
|
+
cost += usage.cache_creation_tokens / 1e6 * pricing.cache_creation;
|
|
84
|
+
}
|
|
85
|
+
return cost;
|
|
86
|
+
}
|
|
87
|
+
function formatCost(costUsd) {
|
|
88
|
+
if (costUsd === 0) return "$0.00";
|
|
89
|
+
if (costUsd < 0.01) {
|
|
90
|
+
return `$${costUsd.toFixed(4)}`;
|
|
91
|
+
}
|
|
92
|
+
return `$${costUsd.toFixed(2)}`;
|
|
93
|
+
}
|
|
94
|
+
function formatTokenCount(tokens) {
|
|
95
|
+
return tokens.toLocaleString();
|
|
96
|
+
}
|
|
97
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
98
|
+
0 && (module.exports = {
|
|
99
|
+
calculateTokenCost,
|
|
100
|
+
formatCost,
|
|
101
|
+
formatTokenCount
|
|
102
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { A as AgenticToolName } from '../agentic-tool-DsyX8diw.cjs';
|
|
2
|
+
import '../id-DMqyogFB.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Token pricing and cost calculation utilities
|
|
6
|
+
*
|
|
7
|
+
* Pricing as of January 2025 (subject to change)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Token usage data from LLM API responses
|
|
12
|
+
*/
|
|
13
|
+
interface TokenUsage {
|
|
14
|
+
input_tokens?: number;
|
|
15
|
+
output_tokens?: number;
|
|
16
|
+
total_tokens?: number;
|
|
17
|
+
cache_read_tokens?: number;
|
|
18
|
+
cache_creation_tokens?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Calculate estimated cost in USD for a given token usage
|
|
22
|
+
*
|
|
23
|
+
* @param usage - Token usage data from LLM API response
|
|
24
|
+
* @param agent - Agentic tool name (determines pricing)
|
|
25
|
+
* @returns Estimated cost in USD (e.g., 0.0234)
|
|
26
|
+
*/
|
|
27
|
+
declare function calculateTokenCost(usage: TokenUsage, agent: AgenticToolName): number;
|
|
28
|
+
/**
|
|
29
|
+
* Format cost as USD string with appropriate precision
|
|
30
|
+
*
|
|
31
|
+
* @param costUsd - Cost in USD (e.g., 0.0234)
|
|
32
|
+
* @returns Formatted string (e.g., "$0.023")
|
|
33
|
+
*/
|
|
34
|
+
declare function formatCost(costUsd: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Format token count with thousands separators
|
|
37
|
+
*
|
|
38
|
+
* @param tokens - Token count (e.g., 12345)
|
|
39
|
+
* @returns Formatted string (e.g., "12,345")
|
|
40
|
+
*/
|
|
41
|
+
declare function formatTokenCount(tokens: number): string;
|
|
42
|
+
|
|
43
|
+
export { type TokenUsage, calculateTokenCost, formatCost, formatTokenCount };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { A as AgenticToolName } from '../agentic-tool-B_gFNpk5.js';
|
|
2
|
+
import '../id-DMqyogFB.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Token pricing and cost calculation utilities
|
|
6
|
+
*
|
|
7
|
+
* Pricing as of January 2025 (subject to change)
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Token usage data from LLM API responses
|
|
12
|
+
*/
|
|
13
|
+
interface TokenUsage {
|
|
14
|
+
input_tokens?: number;
|
|
15
|
+
output_tokens?: number;
|
|
16
|
+
total_tokens?: number;
|
|
17
|
+
cache_read_tokens?: number;
|
|
18
|
+
cache_creation_tokens?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Calculate estimated cost in USD for a given token usage
|
|
22
|
+
*
|
|
23
|
+
* @param usage - Token usage data from LLM API response
|
|
24
|
+
* @param agent - Agentic tool name (determines pricing)
|
|
25
|
+
* @returns Estimated cost in USD (e.g., 0.0234)
|
|
26
|
+
*/
|
|
27
|
+
declare function calculateTokenCost(usage: TokenUsage, agent: AgenticToolName): number;
|
|
28
|
+
/**
|
|
29
|
+
* Format cost as USD string with appropriate precision
|
|
30
|
+
*
|
|
31
|
+
* @param costUsd - Cost in USD (e.g., 0.0234)
|
|
32
|
+
* @returns Formatted string (e.g., "$0.023")
|
|
33
|
+
*/
|
|
34
|
+
declare function formatCost(costUsd: number): string;
|
|
35
|
+
/**
|
|
36
|
+
* Format token count with thousands separators
|
|
37
|
+
*
|
|
38
|
+
* @param tokens - Token count (e.g., 12345)
|
|
39
|
+
* @returns Formatted string (e.g., "12,345")
|
|
40
|
+
*/
|
|
41
|
+
declare function formatTokenCount(tokens: number): string;
|
|
42
|
+
|
|
43
|
+
export { type TokenUsage, calculateTokenCost, formatCost, formatTokenCount };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// src/utils/pricing.ts
|
|
2
|
+
var PRICING = {
|
|
3
|
+
"claude-code": {
|
|
4
|
+
// Claude Sonnet 4.5 pricing
|
|
5
|
+
input: 3,
|
|
6
|
+
// $3 per 1M input tokens
|
|
7
|
+
output: 15,
|
|
8
|
+
// $15 per 1M output tokens
|
|
9
|
+
cache_read: 0.3,
|
|
10
|
+
// $0.30 per 1M cache read tokens
|
|
11
|
+
cache_creation: 3.75
|
|
12
|
+
// $3.75 per 1M cache creation tokens
|
|
13
|
+
},
|
|
14
|
+
cursor: {
|
|
15
|
+
// Cursor uses Claude Sonnet 4.5 (same pricing as claude-code)
|
|
16
|
+
input: 3,
|
|
17
|
+
// $3 per 1M input tokens
|
|
18
|
+
output: 15,
|
|
19
|
+
// $15 per 1M output tokens
|
|
20
|
+
cache_read: 0.3,
|
|
21
|
+
// $0.30 per 1M cache read tokens
|
|
22
|
+
cache_creation: 3.75
|
|
23
|
+
// $3.75 per 1M cache creation tokens
|
|
24
|
+
},
|
|
25
|
+
codex: {
|
|
26
|
+
// OpenAI GPT-4 Turbo pricing (estimate for Codex)
|
|
27
|
+
input: 10,
|
|
28
|
+
// $10 per 1M input tokens
|
|
29
|
+
output: 30
|
|
30
|
+
// $30 per 1M output tokens
|
|
31
|
+
},
|
|
32
|
+
gemini: {
|
|
33
|
+
// Gemini 2.0 Flash pricing
|
|
34
|
+
input: 0.075,
|
|
35
|
+
// $0.075 per 1M input tokens (much cheaper!)
|
|
36
|
+
output: 0.3
|
|
37
|
+
// $0.30 per 1M output tokens
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function calculateTokenCost(usage, agent) {
|
|
41
|
+
const pricing = PRICING[agent];
|
|
42
|
+
if (!pricing) {
|
|
43
|
+
console.warn(`No pricing data for agent: ${agent}`);
|
|
44
|
+
return 0;
|
|
45
|
+
}
|
|
46
|
+
let cost = 0;
|
|
47
|
+
if (usage.input_tokens) {
|
|
48
|
+
cost += usage.input_tokens / 1e6 * pricing.input;
|
|
49
|
+
}
|
|
50
|
+
if (usage.output_tokens) {
|
|
51
|
+
cost += usage.output_tokens / 1e6 * pricing.output;
|
|
52
|
+
}
|
|
53
|
+
if (usage.cache_read_tokens && pricing.cache_read) {
|
|
54
|
+
cost += usage.cache_read_tokens / 1e6 * pricing.cache_read;
|
|
55
|
+
}
|
|
56
|
+
if (usage.cache_creation_tokens && pricing.cache_creation) {
|
|
57
|
+
cost += usage.cache_creation_tokens / 1e6 * pricing.cache_creation;
|
|
58
|
+
}
|
|
59
|
+
return cost;
|
|
60
|
+
}
|
|
61
|
+
function formatCost(costUsd) {
|
|
62
|
+
if (costUsd === 0) return "$0.00";
|
|
63
|
+
if (costUsd < 0.01) {
|
|
64
|
+
return `$${costUsd.toFixed(4)}`;
|
|
65
|
+
}
|
|
66
|
+
return `$${costUsd.toFixed(2)}`;
|
|
67
|
+
}
|
|
68
|
+
function formatTokenCount(tokens) {
|
|
69
|
+
return tokens.toLocaleString();
|
|
70
|
+
}
|
|
71
|
+
export {
|
|
72
|
+
calculateTokenCost,
|
|
73
|
+
formatCost,
|
|
74
|
+
formatTokenCount
|
|
75
|
+
};
|