@commentkit/comment-kit 0.0.0-stage → 0.6.2

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 (207) hide show
  1. package/CHANGELOG.md +276 -0
  2. package/LICENSE +18 -0
  3. package/README.md +766 -2
  4. package/dist/angular/ShadowRootContext-2BrAO1qU.js +7 -0
  5. package/dist/angular/chunk-Cyg4N8Ue.js +11 -0
  6. package/dist/angular/comment-kit-ui-wEJfMh4T.js +9483 -0
  7. package/dist/angular/dom-ON-u4y6t.js +97 -0
  8. package/dist/angular/error-boundary-CxhCm8iF.js +21 -0
  9. package/dist/angular/limits-AEqOBweE.js +71 -0
  10. package/dist/angular/mount-ui-CxChSb8B.js +55 -0
  11. package/dist/angular/pusher-Vs-W-c8I.js +2504 -0
  12. package/dist/angular/realtime-CfJZMEAi.js +558 -0
  13. package/dist/angular/shadow-root-C7wgghDv.js +86 -0
  14. package/dist/angular/styles-CvndAWRF.js +2 -0
  15. package/dist/angular.es.js +3656 -0
  16. package/dist/comment-kit.es.js +3361 -0
  17. package/dist/core/ShadowRootContext--ArKkwbH.js +7 -0
  18. package/dist/core/chunk-t7YoJN_i.js +11 -0
  19. package/dist/core/comment-kit-ui-DjWARy4X.js +9483 -0
  20. package/dist/core/dom-x9svfpMk.js +223 -0
  21. package/dist/core/error-boundary-CN_BGsYl.js +21 -0
  22. package/dist/core/mount-ui-DrFjMJJu.js +55 -0
  23. package/dist/core/pusher-CizoY5NA.js +2504 -0
  24. package/dist/core/realtime-DYf6E_sN.js +278 -0
  25. package/dist/core/shadow-root-09zwHxly.js +86 -0
  26. package/dist/core/styles-D19zARBi.js +2 -0
  27. package/dist/core/websocket-manager-DorGPjR4.js +351 -0
  28. package/dist/preact/ShadowRootContext-CJWLIRy4.js +7 -0
  29. package/dist/preact/chunk-CZ0PdaaN.js +11 -0
  30. package/dist/preact/comment-kit-ui-BKi15Z4Q.js +9483 -0
  31. package/dist/preact/dom-BAV8grk_.js +97 -0
  32. package/dist/preact/error-boundary-B4-Bfy3g.js +21 -0
  33. package/dist/preact/limits-C3ZEKcL_.js +71 -0
  34. package/dist/preact/mount-ui-b9JcJQYE.js +55 -0
  35. package/dist/preact/pusher-BP4kCufH.js +2504 -0
  36. package/dist/preact/realtime-BFgP4BlB.js +558 -0
  37. package/dist/preact/shadow-root-DAhpHo_W.js +86 -0
  38. package/dist/preact/styles-Dwd4AJR8.js +2 -0
  39. package/dist/preact.es.js +3465 -0
  40. package/dist/qwik/ShadowRootContext-CTbULRKq.js +7 -0
  41. package/dist/qwik/chunk-CKKKzG2Q.js +11 -0
  42. package/dist/qwik/comment-kit-ui-CRmJhZlX.js +9483 -0
  43. package/dist/qwik/dom-BjJ-QroQ.js +97 -0
  44. package/dist/qwik/error-boundary-C4hlYQwS.js +21 -0
  45. package/dist/qwik/limits-DK35yjGY.js +71 -0
  46. package/dist/qwik/mount-ui-CaRrLb9u.js +55 -0
  47. package/dist/qwik/pusher-B1KgC4iB.js +2504 -0
  48. package/dist/qwik/realtime-DUhkZAVc.js +558 -0
  49. package/dist/qwik/shadow-root-tLjXys-_.js +86 -0
  50. package/dist/qwik/styles-BB1B91hh.js +2 -0
  51. package/dist/qwik.es.js +3458 -0
  52. package/dist/react/chunk--MHYZ-zp.js +12 -0
  53. package/dist/react/limits-Dflmuf1P.js +168 -0
  54. package/dist/react/pusher-3dki8s2l.js +2505 -0
  55. package/dist/react/realtime-C7h-Agwo.js +558 -0
  56. package/dist/react.es.js +13010 -0
  57. package/dist/solid/ShadowRootContext-BS6MCclL.js +7 -0
  58. package/dist/solid/chunk-B2NCWFvW.js +11 -0
  59. package/dist/solid/comment-kit-ui-Dw_67h_e.js +9483 -0
  60. package/dist/solid/dom-Bpw1A0oz.js +97 -0
  61. package/dist/solid/error-boundary-9mimpbZA.js +21 -0
  62. package/dist/solid/limits-B_69IbLl.js +71 -0
  63. package/dist/solid/mount-ui-bPWYgjmm.js +55 -0
  64. package/dist/solid/pusher-_RVNpj1f.js +2504 -0
  65. package/dist/solid/realtime-DK86zDCJ.js +558 -0
  66. package/dist/solid/shadow-root-D5nErAFI.js +86 -0
  67. package/dist/solid/styles-CtYBghRP.js +2 -0
  68. package/dist/solid.es.js +3446 -0
  69. package/dist/svelte/ShadowRootContext-DhByMr-q.js +7 -0
  70. package/dist/svelte/chunk-Pi70BKld.js +11 -0
  71. package/dist/svelte/comment-kit-ui-DhCWlEd8.js +9483 -0
  72. package/dist/svelte/dom-mfioQqLy.js +97 -0
  73. package/dist/svelte/error-boundary-C3GWI_IX.js +21 -0
  74. package/dist/svelte/limits-CURF22v3.js +71 -0
  75. package/dist/svelte/mount-ui-DtXWMEYn.js +55 -0
  76. package/dist/svelte/pusher-DN1BiUDw.js +2504 -0
  77. package/dist/svelte/realtime-zYOctwRk.js +558 -0
  78. package/dist/svelte/shadow-root-Cz-v-rYe.js +86 -0
  79. package/dist/svelte/styles-DKCGeARl.js +2 -0
  80. package/dist/svelte.es.js +3478 -0
  81. package/dist/types/adapters/bridge.d.ts +125 -0
  82. package/dist/types/adapters/errors.d.ts +3 -0
  83. package/dist/types/angular/index.d.ts +135 -0
  84. package/dist/types/core/agent-context.d.ts +17 -0
  85. package/dist/types/core/api-client.d.ts +137 -0
  86. package/dist/types/core/auth.d.ts +18 -0
  87. package/dist/types/core/comment-kit-core.d.ts +215 -0
  88. package/dist/types/core/comments.d.ts +43 -0
  89. package/dist/types/core/dev-grab.d.ts +14 -0
  90. package/dist/types/core/keyboard.d.ts +12 -0
  91. package/dist/types/core/limits.d.ts +52 -0
  92. package/dist/types/core/offline-queue.d.ts +23 -0
  93. package/dist/types/core/realtime.d.ts +9 -0
  94. package/dist/types/core/screenshot.d.ts +12 -0
  95. package/dist/types/core/session.d.ts +9 -0
  96. package/dist/types/core/source-resolver.d.ts +19 -0
  97. package/dist/types/core/state.d.ts +24 -0
  98. package/dist/types/core/types.d.ts +610 -0
  99. package/dist/types/core/websocket-manager.d.ts +107 -0
  100. package/dist/types/index.d.ts +85 -0
  101. package/dist/types/preact/index.d.ts +25 -0
  102. package/dist/types/qwik/index.d.ts +70 -0
  103. package/dist/types/react/client.d.ts +31 -0
  104. package/dist/types/react/comment-kit-ui.d.ts +9 -0
  105. package/dist/types/react/components/comment-fab.d.ts +34 -0
  106. package/dist/types/react/components/dev-export-panel.d.ts +10 -0
  107. package/dist/types/react/components/element-selector.d.ts +11 -0
  108. package/dist/types/react/components/live-region.d.ts +16 -0
  109. package/dist/types/react/components/screenshot-capture.d.ts +17 -0
  110. package/dist/types/react/components/status-indicator.d.ts +43 -0
  111. package/dist/types/react/error-boundary.d.ts +25 -0
  112. package/dist/types/react/index.d.ts +4 -0
  113. package/dist/types/react/is-local-host.d.ts +2 -0
  114. package/dist/types/react/mount-ui.d.ts +19 -0
  115. package/dist/types/react/shadow-root.d.ts +23 -0
  116. package/dist/types/react/shims/use-sync-external-store-with-selector.d.ts +4 -0
  117. package/dist/types/react/shims/use-sync-external-store.d.ts +1 -0
  118. package/dist/types/react/ui/lib/ShadowRootContext.d.ts +10 -0
  119. package/dist/types/react/ui/lib/cn.d.ts +12 -0
  120. package/dist/types/react/ui/primitives/alert-dialog/alert-dialog.d.ts +23 -0
  121. package/dist/types/react/ui/primitives/alert-dialog/index.d.ts +1 -0
  122. package/dist/types/react/ui/primitives/avatar/avatar.d.ts +10 -0
  123. package/dist/types/react/ui/primitives/avatar/index.d.ts +1 -0
  124. package/dist/types/react/ui/primitives/badge/badge.d.ts +5 -0
  125. package/dist/types/react/ui/primitives/badge/index.d.ts +1 -0
  126. package/dist/types/react/ui/primitives/button/button.d.ts +6 -0
  127. package/dist/types/react/ui/primitives/button/index.d.ts +1 -0
  128. package/dist/types/react/ui/primitives/card/card.d.ts +11 -0
  129. package/dist/types/react/ui/primitives/card/index.d.ts +1 -0
  130. package/dist/types/react/ui/primitives/checkbox/checkbox.d.ts +3 -0
  131. package/dist/types/react/ui/primitives/checkbox/index.d.ts +1 -0
  132. package/dist/types/react/ui/primitives/dialog/dialog.d.ts +17 -0
  133. package/dist/types/react/ui/primitives/dialog/index.d.ts +1 -0
  134. package/dist/types/react/ui/primitives/dropdown-menu/dropdown-menu.d.ts +29 -0
  135. package/dist/types/react/ui/primitives/dropdown-menu/index.d.ts +1 -0
  136. package/dist/types/react/ui/primitives/empty/empty.d.ts +10 -0
  137. package/dist/types/react/ui/primitives/empty/index.d.ts +1 -0
  138. package/dist/types/react/ui/primitives/field/field.d.ts +22 -0
  139. package/dist/types/react/ui/primitives/field/index.d.ts +1 -0
  140. package/dist/types/react/ui/primitives/hover-card/hover-card.d.ts +6 -0
  141. package/dist/types/react/ui/primitives/hover-card/index.d.ts +1 -0
  142. package/dist/types/react/ui/primitives/input/index.d.ts +1 -0
  143. package/dist/types/react/ui/primitives/input/input.d.ts +3 -0
  144. package/dist/types/react/ui/primitives/input-group/index.d.ts +1 -0
  145. package/dist/types/react/ui/primitives/input-group/input-group.d.ts +16 -0
  146. package/dist/types/react/ui/primitives/kbd/index.d.ts +1 -0
  147. package/dist/types/react/ui/primitives/kbd/kbd.d.ts +4 -0
  148. package/dist/types/react/ui/primitives/label/index.d.ts +1 -0
  149. package/dist/types/react/ui/primitives/label/label.d.ts +3 -0
  150. package/dist/types/react/ui/primitives/native-select/index.d.ts +1 -0
  151. package/dist/types/react/ui/primitives/native-select/native-select.d.ts +7 -0
  152. package/dist/types/react/ui/primitives/popover/index.d.ts +1 -0
  153. package/dist/types/react/ui/primitives/popover/popover.d.ts +9 -0
  154. package/dist/types/react/ui/primitives/preview/component-preview.d.ts +8 -0
  155. package/dist/types/react/ui/primitives/progress/index.d.ts +1 -0
  156. package/dist/types/react/ui/primitives/progress/progress.d.ts +7 -0
  157. package/dist/types/react/ui/primitives/radio-group/index.d.ts +1 -0
  158. package/dist/types/react/ui/primitives/radio-group/radio-group.d.ts +6 -0
  159. package/dist/types/react/ui/primitives/scroll-area/index.d.ts +1 -0
  160. package/dist/types/react/ui/primitives/scroll-area/scroll-area.d.ts +6 -0
  161. package/dist/types/react/ui/primitives/select/index.d.ts +1 -0
  162. package/dist/types/react/ui/primitives/select/select.d.ts +15 -0
  163. package/dist/types/react/ui/primitives/separator/index.d.ts +1 -0
  164. package/dist/types/react/ui/primitives/separator/separator.d.ts +3 -0
  165. package/dist/types/react/ui/primitives/sheet/index.d.ts +1 -0
  166. package/dist/types/react/ui/primitives/sheet/sheet.d.ts +14 -0
  167. package/dist/types/react/ui/primitives/skeleton/index.d.ts +1 -0
  168. package/dist/types/react/ui/primitives/skeleton/skeleton.d.ts +3 -0
  169. package/dist/types/react/ui/primitives/slider/index.d.ts +1 -0
  170. package/dist/types/react/ui/primitives/slider/slider.d.ts +7 -0
  171. package/dist/types/react/ui/primitives/sonner/index.d.ts +1 -0
  172. package/dist/types/react/ui/primitives/sonner/sonner.d.ts +4 -0
  173. package/dist/types/react/ui/primitives/spinner/index.d.ts +1 -0
  174. package/dist/types/react/ui/primitives/spinner/spinner.d.ts +3 -0
  175. package/dist/types/react/ui/primitives/switch/index.d.ts +1 -0
  176. package/dist/types/react/ui/primitives/switch/switch.d.ts +5 -0
  177. package/dist/types/react/ui/primitives/tabs/index.d.ts +1 -0
  178. package/dist/types/react/ui/primitives/tabs/tabs.d.ts +8 -0
  179. package/dist/types/react/ui/primitives/textarea/index.d.ts +1 -0
  180. package/dist/types/react/ui/primitives/textarea/textarea.d.ts +3 -0
  181. package/dist/types/react/ui/primitives/toggle/index.d.ts +1 -0
  182. package/dist/types/react/ui/primitives/toggle/toggle.d.ts +7 -0
  183. package/dist/types/react/ui/primitives/toggle-group/index.d.ts +1 -0
  184. package/dist/types/react/ui/primitives/toggle-group/toggle-group.d.ts +14 -0
  185. package/dist/types/react/ui/primitives/tooltip/index.d.ts +1 -0
  186. package/dist/types/react/ui/primitives/tooltip/tooltip.d.ts +7 -0
  187. package/dist/types/solid/index.d.ts +37 -0
  188. package/dist/types/svelte/index.d.ts +55 -0
  189. package/dist/types/utils/dom.d.ts +59 -0
  190. package/dist/types/utils/event-emitter.d.ts +11 -0
  191. package/dist/types/utils/freeze-animations.d.ts +8 -0
  192. package/dist/types/utils/text.d.ts +9 -0
  193. package/dist/types/utils/validation.d.ts +10 -0
  194. package/dist/types/vue/index.d.ts +87 -0
  195. package/dist/vue/ShadowRootContext-BQTcHNil.js +7 -0
  196. package/dist/vue/chunk-DHrubWSL.js +11 -0
  197. package/dist/vue/comment-kit-ui-BX1wDZ2c.js +9483 -0
  198. package/dist/vue/dom-eo0P9Z6Z.js +97 -0
  199. package/dist/vue/error-boundary-DW6uGR8U.js +21 -0
  200. package/dist/vue/limits-B6csdQeI.js +71 -0
  201. package/dist/vue/mount-ui-DdTYzv6J.js +55 -0
  202. package/dist/vue/pusher-cmjNbW6a.js +2504 -0
  203. package/dist/vue/realtime-YJKvS2eB.js +558 -0
  204. package/dist/vue/shadow-root-SLTVf5yk.js +86 -0
  205. package/dist/vue/styles-BrHt1-ia.js +2 -0
  206. package/dist/vue.es.js +3495 -0
  207. package/package.json +205 -4
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Shared adapter bridge for framework integrations.
3
+ *
4
+ * Generates the full public API method surface from a core getter function.
5
+ * Every framework adapter (React, Vue, Svelte, Angular, Solid, Qwik, Preact)
6
+ * uses this bridge to avoid duplicating ~50 method delegations.
7
+ * Framework-specific code only handles reactivity wiring (ref/computed,
8
+ * writable/derived, BehaviorSubject, signals, etc.).
9
+ */
10
+ import type { CommentKitCore } from "../core/comment-kit-core";
11
+ import type { ApiError, AgentContextExport, AgentContextOptions, Comment, DevGrabBundle, DevGrabOptions, DevGrabResult, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User } from "../core/types";
12
+ export interface AdapterMethods {
13
+ validateInvite: (email: string) => Promise<void>;
14
+ login: (email: string) => Promise<void>;
15
+ verifyOtp: (otp: string) => Promise<void>;
16
+ cancelOtp: () => void;
17
+ resendOtp: () => Promise<void>;
18
+ logout: () => void;
19
+ toggleLoginModal: () => void;
20
+ toggleOverlay: () => void;
21
+ toggleSidebar: () => void;
22
+ setTool: (tool: CommentKitState["activeTool"]) => void;
23
+ toggleShortcutsOverlay: () => void;
24
+ setPanelView: (view: PanelView) => void;
25
+ loadMoreComments: () => Promise<void>;
26
+ getProjectMembers: () => Promise<User[]>;
27
+ createComment: (type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: {
28
+ description?: string;
29
+ assignees?: User[];
30
+ checklist?: TaskChecklistItem[];
31
+ files?: File[];
32
+ attachmentIds?: Array<string | number>;
33
+ }) => Promise<void>;
34
+ updateComment: (commentId: string, updates: Partial<Comment>) => Promise<void>;
35
+ deleteComment: (id: string) => Promise<void>;
36
+ resolveComment: (id: string) => Promise<void>;
37
+ unresolveComment: (id: string) => Promise<void>;
38
+ completeComment: (id: string) => Promise<void>;
39
+ selectComment: (comment: Comment | null) => void;
40
+ addReply: (commentId: string, content: string) => Promise<void>;
41
+ updateReply: (commentId: string, replyId: string, content: string) => Promise<void>;
42
+ deleteReply: (commentId: string, replyId: string) => Promise<void>;
43
+ reactToComment: (commentId: string, emoji: string) => Promise<void>;
44
+ updateCommentPosition: (commentId: string, x: number, y: number) => Promise<void>;
45
+ createHighlight: (textSelection: TextSelection, content: string) => Promise<void>;
46
+ createDrawing: (drawingData: DrawingData, position: Position, content: string) => Promise<void>;
47
+ setActiveDrawing: (drawing: DrawingData | null) => void;
48
+ sendDrawingStroke: (path: DrawingPath) => void;
49
+ captureScreenshot: (element?: HTMLElement) => Promise<ScreenshotResult | null>;
50
+ uploadScreenshot: (screenshot: ScreenshotResult, content: string, position: Position) => Promise<Comment | null>;
51
+ setActiveScreenshot: (screenshot: ScreenshotResult | null) => void;
52
+ uploadFiles: (files: File[], options?: {
53
+ commentId?: string;
54
+ replyId?: string;
55
+ }) => Promise<string[]>;
56
+ markThreadSeen: (threadId: string) => void;
57
+ isThreadNew: (threadId: string) => boolean;
58
+ markAllActivitiesRead: () => void;
59
+ getUnreadActivityCount: () => number;
60
+ getPendingMutationCount: () => number;
61
+ getOnlineUsers: () => User[];
62
+ getAgentContext: (options?: AgentContextOptions) => AgentContextExport;
63
+ getAgentContextAsync: (options?: AgentContextOptions) => Promise<AgentContextExport>;
64
+ formatAgentContext: (options?: AgentContextOptions) => string;
65
+ formatAgentContextAsync: (options?: AgentContextOptions) => Promise<string>;
66
+ copyAgentContext: (options?: AgentContextOptions) => Promise<string>;
67
+ /** Single-element grab — screenshot + source + clipboard. Returns null if no core. */
68
+ grabElement: (element: Element, options?: DevGrabOptions) => Promise<DevGrabResult | null>;
69
+ /** Multi-element grab — bundles N elements into one clipboard payload. */
70
+ grabElements: (elements: Element[], options?: DevGrabOptions) => Promise<DevGrabBundle | null>;
71
+ onSlice: (slice: StateSlice, callback: (state: CommentKitState) => void) => Unsubscribe;
72
+ select: <T>(selector: (state: CommentKitState) => T, callback: (value: T) => void) => Unsubscribe;
73
+ on: <K extends keyof CommentKitEvents>(event: K, listener: EventListener<CommentKitEvents[K]>) => Unsubscribe;
74
+ off: <K extends keyof CommentKitEvents>(event: K, listener: EventListener<CommentKitEvents[K]>) => void;
75
+ }
76
+ /**
77
+ * Tell a bridge that its core now exists so buffered pre-init event
78
+ * subscriptions (`on`/`onSlice`/`select`) get attached. Safe to call multiple
79
+ * times; a no-op for bridges with nothing buffered.
80
+ */
81
+ export declare function notifyBridgeCoreReady(bridge: AdapterMethods): void;
82
+ /**
83
+ * Create all adapter method delegations from a core getter.
84
+ *
85
+ * Error contract: a delegated mutation that fails is BOTH reported via `onError`
86
+ * (so the adapter's reactive error state updates) AND re-thrown, so the returned
87
+ * promise also rejects. Callers that `await` a bridge mutation must still wrap it
88
+ * in try/catch (or attach `.catch`) — the reactive `onError` channel does not
89
+ * suppress the rejection.
90
+ *
91
+ * Pre-init contract: mutations called before the adapter's mount lifecycle has
92
+ * created the core REJECT with a "not initialized" error (previously they
93
+ * silently resolved while doing nothing — silent data loss). Read helpers
94
+ * return a safe fallback, and subscriptions (`on`/`onSlice`/`select`) are
95
+ * buffered and attached once the core appears.
96
+ *
97
+ * @param getCore - Function that returns the current CommentKitCore instance or null.
98
+ * Each framework provides its own getter (e.g. get(core), core.value, this.core).
99
+ * @param onError - Optional error handler for delegated operation failures. Frameworks can use this
100
+ * to update their error state (e.g. error.set(), errorSubject.next()).
101
+ */
102
+ export declare function createAdapterBridge(getCore: () => CommentKitCore | null, onError?: (error: unknown) => void): AdapterMethods;
103
+ /**
104
+ * Derived state selectors common to all framework adapters.
105
+ * Each framework maps these to its own reactivity primitive.
106
+ */
107
+ export declare const STATE_SELECTORS: {
108
+ readonly isAuthenticated: (s: CommentKitState | null) => boolean;
109
+ readonly isOverlayVisible: (s: CommentKitState | null) => boolean;
110
+ readonly isSidebarVisible: (s: CommentKitState | null) => boolean;
111
+ readonly currentUser: (s: CommentKitState | null) => User | null;
112
+ readonly comments: (s: CommentKitState | null) => Comment[];
113
+ readonly activeTool: (s: CommentKitState | null) => "highlight" | "screenshot" | "comment" | "draw" | "select" | null;
114
+ readonly otpStep: (s: CommentKitState | null) => import("..").OtpStep;
115
+ readonly otpEmail: (s: CommentKitState | null) => string | null;
116
+ readonly pendingMutationCount: (s: CommentKitState | null) => number;
117
+ readonly isOnline: (s: CommentKitState | null) => boolean;
118
+ readonly selectedComment: (s: CommentKitState | null) => Comment | null;
119
+ readonly connectionStatus: (s: CommentKitState | null) => ConnectionStatus;
120
+ readonly panelView: (s: CommentKitState | null) => PanelView;
121
+ readonly isShortcutsOverlayVisible: (s: CommentKitState | null) => boolean;
122
+ readonly activeDrawing: (s: CommentKitState | null) => DrawingData | null;
123
+ readonly activeScreenshot: (s: CommentKitState | null) => ScreenshotResult | null;
124
+ };
125
+ export type { ApiError, Comment, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User, };
@@ -0,0 +1,3 @@
1
+ import type { ApiError } from "../core/types";
2
+ export declare function toApiError(error: unknown): ApiError;
3
+ export declare function toMountError(cause: unknown): ApiError;
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Angular integration for CommentKit
3
+ * Provides services, components, and dependency injection support.
4
+ *
5
+ * All action methods are delegated through the shared adapter bridge,
6
+ * while RxJS observables use STATE_SELECTORS for derived state.
7
+ */
8
+ import type { OnDestroy } from "@angular/core";
9
+ import { InjectionToken } from "@angular/core";
10
+ import { type AdapterMethods } from "../adapters/bridge";
11
+ import { CommentKitCore } from "../core/comment-kit-core";
12
+ import type { ApiError, CommentKitConfig, CommentKitState, Unsubscribe } from "../core/types";
13
+ export declare const COMMENT_KIT_CONFIG: InjectionToken<CommentKitConfig>;
14
+ export interface AngularCommentKitConfig extends CommentKitConfig {
15
+ onReady?: () => void;
16
+ onError?: (error: ApiError) => void;
17
+ }
18
+ export declare class CommentKitService implements OnDestroy {
19
+ private config?;
20
+ private core;
21
+ private unsubscribers;
22
+ private mountedUI;
23
+ private lifecycleId;
24
+ private coreSubject;
25
+ private stateSubject;
26
+ private isReadySubject;
27
+ private isLoadingSubject;
28
+ private errorSubject;
29
+ private bridge;
30
+ readonly core$: import("rxjs").Observable<CommentKitCore | null>;
31
+ readonly state$: import("rxjs").Observable<CommentKitState | null>;
32
+ readonly isReady$: import("rxjs").Observable<boolean>;
33
+ readonly isLoading$: import("rxjs").Observable<boolean>;
34
+ readonly error$: import("rxjs").Observable<ApiError | null>;
35
+ readonly isAuthenticated$: import("rxjs").Observable<boolean>;
36
+ readonly isOverlayVisible$: import("rxjs").Observable<boolean>;
37
+ readonly isSidebarVisible$: import("rxjs").Observable<boolean>;
38
+ readonly currentUser$: import("rxjs").Observable<import("./index.ts").User | null>;
39
+ readonly comments$: import("rxjs").Observable<import("./index.ts").Comment[]>;
40
+ readonly activeTool$: import("rxjs").Observable<"highlight" | "screenshot" | "comment" | "draw" | "select" | null>;
41
+ readonly otpStep$: import("rxjs").Observable<import("../index.ts").OtpStep>;
42
+ readonly otpEmail$: import("rxjs").Observable<string | null>;
43
+ readonly pendingMutationCount$: import("rxjs").Observable<number>;
44
+ readonly isOnline$: import("rxjs").Observable<boolean>;
45
+ readonly selectedComment$: import("rxjs").Observable<import("./index.ts").Comment | null>;
46
+ readonly connectionStatus$: import("rxjs").Observable<import("./index.ts").ConnectionStatus>;
47
+ readonly panelView$: import("rxjs").Observable<import("./index.ts").PanelView>;
48
+ readonly isShortcutsOverlayVisible$: import("rxjs").Observable<boolean>;
49
+ readonly activeDrawing$: import("rxjs").Observable<import("./index.ts").DrawingData | null>;
50
+ readonly activeScreenshot$: import("rxjs").Observable<import("./index.ts").ScreenshotResult | null>;
51
+ constructor(config?: AngularCommentKitConfig | undefined);
52
+ initialize(config: AngularCommentKitConfig): Promise<void>;
53
+ /** Throws synchronously if core is not initialized. Used for sync methods. */
54
+ private assertReady;
55
+ /** Returns a rejected promise if core is not initialized. Used for async methods. */
56
+ private assertReadyAsync;
57
+ validateInvite(email: string): Promise<void>;
58
+ login(email: string): Promise<void>;
59
+ verifyOtp(otp: string): Promise<void>;
60
+ cancelOtp(): void;
61
+ resendOtp(): Promise<void>;
62
+ logout(): void;
63
+ toggleLoginModal(): void;
64
+ toggleOverlay(): void;
65
+ toggleSidebar(): void;
66
+ setTool(tool: CommentKitState["activeTool"]): void;
67
+ toggleShortcutsOverlay(): void;
68
+ setPanelView(view: CommentKitState["panelView"]): void;
69
+ loadMoreComments(): Promise<void>;
70
+ getProjectMembers(): Promise<import("./index.ts").User[]>;
71
+ createComment(...args: Parameters<AdapterMethods["createComment"]>): Promise<void>;
72
+ updateComment(...args: Parameters<AdapterMethods["updateComment"]>): Promise<void>;
73
+ deleteComment(id: string): Promise<void>;
74
+ resolveComment(id: string): Promise<void>;
75
+ unresolveComment(id: string): Promise<void>;
76
+ completeComment(id: string): Promise<void>;
77
+ selectComment(...args: Parameters<AdapterMethods["selectComment"]>): void;
78
+ addReply(commentId: string, content: string): Promise<void>;
79
+ updateReply(commentId: string, replyId: string, content: string): Promise<void>;
80
+ deleteReply(commentId: string, replyId: string): Promise<void>;
81
+ reactToComment(commentId: string, emoji: string): Promise<void>;
82
+ updateCommentPosition(commentId: string, x: number, y: number): Promise<void>;
83
+ createHighlight(...args: Parameters<AdapterMethods["createHighlight"]>): Promise<void>;
84
+ createDrawing(...args: Parameters<AdapterMethods["createDrawing"]>): Promise<void>;
85
+ setActiveDrawing(...args: Parameters<AdapterMethods["setActiveDrawing"]>): void;
86
+ sendDrawingStroke(...args: Parameters<AdapterMethods["sendDrawingStroke"]>): void;
87
+ captureScreenshot(...args: Parameters<AdapterMethods["captureScreenshot"]>): Promise<import("./index.ts").ScreenshotResult | null>;
88
+ uploadScreenshot(...args: Parameters<AdapterMethods["uploadScreenshot"]>): Promise<import("./index.ts").Comment | null>;
89
+ setActiveScreenshot(...args: Parameters<AdapterMethods["setActiveScreenshot"]>): void;
90
+ uploadFiles(files: File[]): Promise<string[]>;
91
+ markThreadSeen(threadId: string): void;
92
+ isThreadNew(threadId: string): boolean;
93
+ markAllActivitiesRead(): void;
94
+ getUnreadActivityCount(): number;
95
+ getPendingMutationCount(): number;
96
+ getOnlineUsers(): import("./index.ts").User[];
97
+ getAgentContext(...args: Parameters<AdapterMethods["getAgentContext"]>): import("./index.ts").AgentContextExport;
98
+ getAgentContextAsync(...args: Parameters<AdapterMethods["getAgentContextAsync"]>): Promise<import("./index.ts").AgentContextExport>;
99
+ formatAgentContext(...args: Parameters<AdapterMethods["formatAgentContext"]>): string;
100
+ formatAgentContextAsync(...args: Parameters<AdapterMethods["formatAgentContextAsync"]>): Promise<string>;
101
+ copyAgentContext(...args: Parameters<AdapterMethods["copyAgentContext"]>): Promise<string>;
102
+ grabElement(...args: Parameters<AdapterMethods["grabElement"]>): Promise<import("../core/types").DevGrabResult | null>;
103
+ grabElements(...args: Parameters<AdapterMethods["grabElements"]>): Promise<import("../core/types").DevGrabBundle | null>;
104
+ onSlice(...args: Parameters<AdapterMethods["onSlice"]>): Unsubscribe;
105
+ select(...args: Parameters<AdapterMethods["select"]>): Unsubscribe;
106
+ on(...args: Parameters<AdapterMethods["on"]>): Unsubscribe;
107
+ off(...args: Parameters<AdapterMethods["off"]>): void;
108
+ getCurrentState(): CommentKitState | null;
109
+ private setupEventListeners;
110
+ private clearSubscriptions;
111
+ private readyNotified;
112
+ private notifyAuthenticated;
113
+ private reportError;
114
+ private mountSharedUI;
115
+ ngOnDestroy(): void;
116
+ destroy(): void;
117
+ }
118
+ export declare function createCommentKitService(): CommentKitService;
119
+ export declare function provideCommentKit(config: AngularCommentKitConfig): (typeof CommentKitService | {
120
+ provide: InjectionToken<CommentKitConfig>;
121
+ useValue: AngularCommentKitConfig;
122
+ })[];
123
+ export declare function commentKitDirective(_element: HTMLElement, config: AngularCommentKitConfig): {
124
+ destroy(): void;
125
+ update(newConfig: AngularCommentKitConfig): void;
126
+ };
127
+ export type { AgentCommentContext, AgentContextExport, AgentContextOptions, AgentElementContext, ApiError, Comment, CommentKitConfig, CommentKitEvents, CommentKitState, ConnectionStatus, DevGrabAttachment, DevGrabAttachmentPathSource, DevGrabOptions, DrawingData, DrawingPath, EventListener, PanelView, Position, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, Unsubscribe, User, } from "../core/types";
128
+ declare const _default: {
129
+ CommentKitService: typeof CommentKitService;
130
+ commentKitDirective: typeof commentKitDirective;
131
+ createCommentKitService: typeof createCommentKitService;
132
+ provideCommentKit: typeof provideCommentKit;
133
+ COMMENT_KIT_CONFIG: InjectionToken<CommentKitConfig>;
134
+ };
135
+ export default _default;
@@ -0,0 +1,17 @@
1
+ import type { AgentContextExport, AgentContextOptions, CommentKitState } from "./types";
2
+ export declare function createAgentContext(state: CommentKitState, options?: AgentContextOptions): AgentContextExport;
3
+ /**
4
+ * Resolve and attach source-file locations to each comment's element context
5
+ * when the optional source-resolver peer dep is installed. Returns a new export with
6
+ * `sourceResolved` flipped to true if at least one comment was resolved.
7
+ */
8
+ export declare function enrichAgentContextWithSource(context: AgentContextExport): Promise<AgentContextExport>;
9
+ export declare function formatAgentContext(context: AgentContextExport): string;
10
+ /**
11
+ * Copy markdown + an optional element screenshot to the clipboard. Used by
12
+ * the dev-grab flow so the agent paste also carries the image, not just text.
13
+ * Returns true if the image actually made it onto the clipboard, false if we
14
+ * had to fall back to text-only.
15
+ */
16
+ export declare function copyTextAndImageToClipboard(text: string, imageBlob: Blob | null): Promise<boolean>;
17
+ export declare function copyTextToClipboard(text: string, context?: AgentContextExport | null): Promise<void>;
@@ -0,0 +1,137 @@
1
+ import type { AuthResponse, Comment, CommentEnvironment, DrawingData, InviteValidationResponse, Mention, OtpResponse, OtpVerifyResponse, Position, ResolvedConfig, TaskChecklistItem, TextSelection, User } from "./types";
2
+ export declare class ApiClient {
3
+ private baseUrl;
4
+ private apiKey;
5
+ private projectId;
6
+ private userEmail;
7
+ private authToken;
8
+ private environment;
9
+ private onAuthExpired;
10
+ constructor(config: ResolvedConfig);
11
+ setProject(projectId: string): void;
12
+ setUserEmail(email: string | null): void;
13
+ setAuthToken(token: string | null): void;
14
+ setEnvironment(environment: CommentEnvironment | null): void;
15
+ setOnAuthExpired(callback: (() => void) | null): void;
16
+ private buildHeaders;
17
+ private executeRequest;
18
+ private parseResponseBody;
19
+ private request;
20
+ private requestFormData;
21
+ private requireProjectId;
22
+ validateApiKey(): Promise<AuthResponse>;
23
+ requestOtp(email: string): Promise<OtpResponse>;
24
+ verifyOtp(email: string, otp: string): Promise<OtpVerifyResponse>;
25
+ validateInvite(token: string, email: string): Promise<InviteValidationResponse>;
26
+ getComments(pagePath?: string, status?: "open" | "resolved" | "all", page?: number, limit?: number, environment?: CommentEnvironment): Promise<{
27
+ comments: Comment[];
28
+ pagination: {
29
+ total: number;
30
+ hasMore: boolean;
31
+ page: number;
32
+ limit: number;
33
+ };
34
+ }>;
35
+ /**
36
+ * Build an Idempotency-Key header from a client-supplied key. The backend
37
+ * dedups retried creates/replies on this key, so an offline-queue replay (or
38
+ * a lost-response retry) can't produce a duplicate row. Keys are bounded and
39
+ * control-char-free; an unsafe key is simply omitted.
40
+ */
41
+ private idempotencyHeaders;
42
+ createComment(type: "pin" | "highlight" | "drawing", content: string, position: Position, page: {
43
+ url: string;
44
+ path: string;
45
+ title: string;
46
+ }, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: {
47
+ description?: string;
48
+ assignees?: User[];
49
+ checklist?: TaskChecklistItem[];
50
+ mentions?: Mention[];
51
+ /** Link previously uploaded orphan attachment ids. */
52
+ attachmentIds?: Array<string | number>;
53
+ }, idempotencyKey?: string): Promise<Comment>;
54
+ updateComment(commentId: string, updates: Partial<Pick<Comment, "content" | "status" | "priority" | "description" | "assignees" | "checklist" | "textSelection" | "drawingData"> & {
55
+ attachmentIds?: Array<string | number>;
56
+ }>): Promise<Comment>;
57
+ deleteComment(commentId: string): Promise<void>;
58
+ addReply(commentId: string, content: string, idempotencyKey?: string): Promise<Comment["replies"][0]>;
59
+ updateReply(commentId: string, replyId: string, content: string): Promise<Comment["replies"][0]>;
60
+ deleteReply(commentId: string, replyId: string): Promise<void>;
61
+ resolveComment(commentId: string): Promise<Comment>;
62
+ unresolveComment(commentId: string): Promise<Comment>;
63
+ markComplete(commentId: string): Promise<Comment>;
64
+ addReaction(commentId: string, emoji: string): Promise<void>;
65
+ removeReaction(commentId: string, emoji: string): Promise<void>;
66
+ updatePosition(commentId: string, position: Position): Promise<Comment>;
67
+ createHighlight(content: string, textSelection: TextSelection, page: {
68
+ url: string;
69
+ path: string;
70
+ title: string;
71
+ }, priority?: "low" | "medium" | "high" | "urgent", idempotencyKey?: string): Promise<Comment>;
72
+ createDrawing(content: string, drawingData: DrawingData, position: Position, page: {
73
+ url: string;
74
+ path: string;
75
+ title: string;
76
+ }, idempotencyKey?: string): Promise<Comment>;
77
+ private validateFile;
78
+ /**
79
+ * Upload a file. Pass `commentId` (and optionally `replyId`) so the backend
80
+ * links the attachment; uploads without a comment/reply FK are orphaned.
81
+ * `type` is sent on the wire for forward-compat (backend currently stores
82
+ * attachments as `file` regardless).
83
+ */
84
+ uploadFile(file: File, type: "screenshot" | "drawing" | "attachment", options?: {
85
+ commentId?: string;
86
+ replyId?: string;
87
+ }): Promise<{
88
+ id: string;
89
+ type: string;
90
+ url: string;
91
+ thumbnail?: string;
92
+ filename?: string;
93
+ size: number;
94
+ }>;
95
+ uploadScreenshot(file: File, metadata: {
96
+ content: string;
97
+ position: Position;
98
+ page: {
99
+ url: string;
100
+ path: string;
101
+ title: string;
102
+ };
103
+ }): Promise<Comment>;
104
+ uploadFiles(files: File[], options?: {
105
+ commentId?: string;
106
+ replyId?: string;
107
+ }): Promise<string[]>;
108
+ getProjectMembers(): Promise<User[]>;
109
+ }
110
+ /**
111
+ * Parse @mentions from content string.
112
+ * Format: @[Display Name](userId)
113
+ * Example: "Hey @[John Doe](user-123), check this out"
114
+ */
115
+ export declare function parseMentions(content: string): Mention[];
116
+ /**
117
+ * Format a mention for insertion into content.
118
+ * Strips `]` from name and `)` from id to keep the mention format parseable
119
+ * by {@link parseMentions}. User IDs are validated as `[\w-]+` on parse,
120
+ * so `)` in an ID would already be rejected.
121
+ */
122
+ export declare function formatMention(user: User): string;
123
+ /**
124
+ * Strip mention markup from content for display.
125
+ * Converts @[Display Name](userId) to @Display Name
126
+ */
127
+ export declare function stripMentionMarkup(content: string): string;
128
+ export declare class ApiClientError extends Error {
129
+ readonly code: number;
130
+ readonly error: string;
131
+ readonly details?: Record<string, unknown>;
132
+ constructor(error: string, message: string, code: number, details?: Record<string, unknown>);
133
+ isAuthError(): boolean;
134
+ isNetworkError(): boolean;
135
+ isRateLimitError(): boolean;
136
+ isPremiumFeatureError(): boolean;
137
+ }
@@ -0,0 +1,18 @@
1
+ import type { CoreContext } from "./state";
2
+ export declare function login(ctx: CoreContext, email: string): Promise<void>;
3
+ export interface VerifyOtpHooks {
4
+ onAuthenticated: () => Promise<void>;
5
+ /** Called when the server rejects the code (wrong/expired) — used for a
6
+ * client-side brute-force cooldown. Not called for malformed input or
7
+ * network errors. */
8
+ onWrongOtp?: () => void;
9
+ /** Called on success to reset any cooldown counters. */
10
+ onSuccess?: () => void;
11
+ }
12
+ export declare function verifyOtp(ctx: CoreContext, otp: string, hooks: VerifyOtpHooks | (() => Promise<void>)): Promise<void>;
13
+ export declare function cancelOtp(ctx: CoreContext): void;
14
+ export declare function resendOtp(ctx: CoreContext): Promise<void>;
15
+ export declare function logout(ctx: CoreContext, teardownRealtime: () => void): void;
16
+ export declare function handleAuthExpired(ctx: CoreContext): void;
17
+ export declare function toggleLoginModal(ctx: CoreContext): void;
18
+ export declare function validateInvite(ctx: CoreContext, email: string, loginFn: (email: string) => Promise<void>): Promise<void>;
@@ -0,0 +1,215 @@
1
+ import { EventEmitter } from "../utils/event-emitter";
2
+ import type { AgentContextExport, AgentContextOptions, Comment, CommentKitConfig, CommentKitState, DevGrabBundle, DevGrabOptions, DevGrabResult, DrawingData, DrawingPath, Position, ResolvedConfig, ScreenshotResult, StateSlice, TaskChecklistItem, TextSelection, ToolType, Unsubscribe, User } from "./types";
3
+ /**
4
+ * Current SDK version — compared against the backend's sdkLatestVersion on
5
+ * init. Injected from package.json at build time (vite `define`) so it can't
6
+ * drift; the literal fallback keeps tsc/test runs (which don't apply the
7
+ * define) working.
8
+ */
9
+ export declare const SDK_VERSION: string;
10
+ export declare class CommentKitCore extends EventEmitter {
11
+ private state;
12
+ private apiClient;
13
+ private wsManager;
14
+ private wsUnsubscribers;
15
+ private config;
16
+ private keyboardHandler;
17
+ private holdActivationHandler;
18
+ private holdBlurHandler;
19
+ private toggleHandler;
20
+ private mouseMoveHandler;
21
+ private hashChangeHandler;
22
+ private onlineHandler;
23
+ private offlineHandler;
24
+ private initialized;
25
+ private destroyed;
26
+ private screenshotProvider;
27
+ private bootRetryTimer;
28
+ private bootAttempts;
29
+ private pendingStateUpdates;
30
+ private flushScheduled;
31
+ private isFlushing;
32
+ private readonly queueGuard;
33
+ private get isProcessingQueue();
34
+ private set isProcessingQueue(value);
35
+ private activeMutations;
36
+ private get isLoadingMore();
37
+ private set isLoadingMore(value);
38
+ private sliceSubscribers;
39
+ private readonly retryTimerRef;
40
+ private get retryTimer();
41
+ private set retryTimer(value);
42
+ private ctx;
43
+ private kbdCallbacks;
44
+ private commentCb;
45
+ private realtimeRefs;
46
+ constructor(config: CommentKitConfig | ResolvedConfig);
47
+ private detectEnvironment;
48
+ private boot;
49
+ /**
50
+ * Auto-detect member invite token from URL query params.
51
+ * Param: ?ck_invite=<token>
52
+ *
53
+ * The token is validated at capture time (64 chars of [A-Za-z0-9_-]) and
54
+ * stripped from the address bar immediately so the credential doesn't
55
+ * persist in browser history, Referer headers, or analytics URL logs.
56
+ */
57
+ private autoDetectInviteToken;
58
+ private initialize;
59
+ private setState;
60
+ private getInternalState;
61
+ private cloneStateSnapshot;
62
+ private flushState;
63
+ private notifySubscribers;
64
+ /**
65
+ * Force-flush any batched state updates synchronously.
66
+ * Useful in tests or when you need immediate state propagation.
67
+ */
68
+ flushStateSync(): void;
69
+ getState(): CommentKitState;
70
+ /**
71
+ * Get the resolved feature flags for this instance.
72
+ * Use this instead of accessing config directly.
73
+ */
74
+ getFeatures(): NonNullable<ResolvedConfig["features"]>;
75
+ /**
76
+ * Get the public configuration (excludes internal auto-detected fields
77
+ * such as projectId and reverb connection details).
78
+ */
79
+ getConfig(): Readonly<CommentKitConfig>;
80
+ /**
81
+ * Validate a member invite token + email against the backend.
82
+ * If valid, the user is created/added to the org, and the normal OTP flow
83
+ * (triggered automatically on success) can proceed.
84
+ */
85
+ validateInvite(email: string): Promise<void>;
86
+ /**
87
+ * Subscribe to changes in a specific state slice.
88
+ * The callback only fires when keys in that slice actually change.
89
+ */
90
+ onSlice(slice: StateSlice, callback: (state: CommentKitState) => void): Unsubscribe;
91
+ /**
92
+ * Subscribe with a selector. Callback only fires when the selected value changes.
93
+ * The selector receives the live state object — by convention, do not mutate it.
94
+ */
95
+ select<T>(selector: (state: CommentKitState) => T, callback: (value: T) => void): Unsubscribe;
96
+ private handleError;
97
+ /**
98
+ * After validate-key, rehydrate a sessionStorage OTP session so in-tab
99
+ * refresh keeps auth + offline-queue replay working. Tab close clears
100
+ * sessionStorage (by design); user must OTP again in a new tab.
101
+ */
102
+ private restorePersistedSession;
103
+ /** Shared post-auth path used by OTP verify and session restore. */
104
+ private afterAuthenticated;
105
+ login(email: string): Promise<void>;
106
+ private otpFailedAttempts;
107
+ private otpCooldownUntil;
108
+ verifyOtp(otp: string): Promise<void>;
109
+ cancelOtp(): void;
110
+ resendOtp(): Promise<void>;
111
+ logout(): void;
112
+ private handleAuthExpired;
113
+ toggleLoginModal(): void;
114
+ toggleOverlay(): void;
115
+ toggleSidebar(): void;
116
+ private overlayBeforeTool;
117
+ setTool(tool: ToolType): void;
118
+ private loadMoreGuard;
119
+ private loadComments;
120
+ loadMoreComments(): Promise<void>;
121
+ /**
122
+ * Re-fetch the current page's comments from the server (page 1). Unlike
123
+ * `loadMoreComments`, which paginates forward and no-ops once everything is
124
+ * loaded, this refreshes existing data — e.g. to pick up remote edits.
125
+ */
126
+ reloadComments(): Promise<void>;
127
+ createComment(type: "pin" | "highlight" | "drawing", content: string, position: Position, priority?: "low" | "medium" | "high" | "urgent", textSelection?: TextSelection, drawingData?: DrawingData, options?: {
128
+ description?: string;
129
+ assignees?: User[];
130
+ checklist?: TaskChecklistItem[];
131
+ files?: File[];
132
+ attachmentIds?: Array<string | number>;
133
+ }): Promise<void>;
134
+ updateComment(commentId: string, updates: Partial<Comment>): Promise<void>;
135
+ deleteComment(commentId: string): Promise<void>;
136
+ addReply(commentId: string, content: string): Promise<void>;
137
+ updateReply(commentId: string, replyId: string, content: string): Promise<void>;
138
+ deleteReply(commentId: string, replyId: string): Promise<void>;
139
+ resolveComment(commentId: string): Promise<void>;
140
+ unresolveComment(commentId: string): Promise<void>;
141
+ selectComment(comment: Comment | null): void;
142
+ completeComment(commentId: string): Promise<void>;
143
+ reactToComment(commentId: string, emoji: string): Promise<void>;
144
+ updateCommentPosition(commentId: string, x: number, y: number): Promise<void>;
145
+ private offlinePersistUnsub;
146
+ /**
147
+ * Restore any offline mutations persisted from a previous session (keyed by
148
+ * project) and wire up auto-persistence so the queue survives reloads. Called
149
+ * once, after the projectId is known.
150
+ */
151
+ private hydrateOfflineQueue;
152
+ private shouldQueueMutation;
153
+ private queueMutation;
154
+ private scheduleRetry;
155
+ private processOfflineQueue;
156
+ private executeMutation;
157
+ getPendingMutationCount(): number;
158
+ markThreadSeen(threadId: string): void;
159
+ isThreadNew(threadId: string): boolean;
160
+ setPanelView(view: CommentKitState["panelView"]): void;
161
+ toggleShortcutsOverlay(): void;
162
+ private addActivity;
163
+ markAllActivitiesRead(): void;
164
+ getUnreadActivityCount(): number;
165
+ private handleDeepLink;
166
+ createHighlight(textSelection: TextSelection, content: string): Promise<void>;
167
+ createDrawing(drawingData: DrawingData, position: Position, content: string): Promise<void>;
168
+ setActiveDrawing(drawing: DrawingData | null): void;
169
+ sendDrawingStroke(path: DrawingPath): void;
170
+ captureScreenshot(element?: HTMLElement): Promise<ScreenshotResult | null>;
171
+ uploadScreenshot(screenshot: ScreenshotResult, content: string, position: Position): Promise<Comment | null>;
172
+ setActiveScreenshot(screenshot: ScreenshotResult | null): void;
173
+ uploadFiles(files: File[], options?: {
174
+ commentId?: string;
175
+ replyId?: string;
176
+ }): Promise<string[]>;
177
+ /**
178
+ * Build a comments-only export. Synchronous — uses selector + XPath only.
179
+ * For source-resolved output (file:line:col + component stack), use
180
+ * `getAgentContextAsync` instead, which awaits source resolution when available.
181
+ */
182
+ getAgentContext(options?: AgentContextOptions): AgentContextExport;
183
+ /**
184
+ * Same as `getAgentContext` but also resolves each comment's element to a
185
+ * source-file location when the optional source-resolver peer is installed. Resolves to the
186
+ * sync export when the peer dep is absent or no element can be resolved.
187
+ */
188
+ getAgentContextAsync(options?: AgentContextOptions): Promise<AgentContextExport>;
189
+ formatAgentContext(options?: AgentContextOptions): string;
190
+ formatAgentContextAsync(options?: AgentContextOptions): Promise<string>;
191
+ copyAgentContext(options?: AgentContextOptions): Promise<string>;
192
+ /** Single-element grab — see core/dev-grab.ts. Dev-mode element-tool entry. */
193
+ grabElement(element: Element, options?: DevGrabOptions): Promise<DevGrabResult | null>;
194
+ /** Multi-element grab — bundles N elements into one clipboard payload. */
195
+ grabElements(elements: Element[], options?: DevGrabOptions): Promise<DevGrabBundle | null>;
196
+ getProjectMembers(): Promise<User[]>;
197
+ private handleToggleRequest;
198
+ private handleKeyboardShortcuts;
199
+ private readonly escapeBlockers;
200
+ private matchesHoldKey;
201
+ /**
202
+ * Block the core's Escape chain. Used by overlay UIs (context menus,
203
+ * dropdowns) that want Escape to dismiss their own surface first instead of
204
+ * walking the core's chain (which would otherwise also clear the tool).
205
+ * Returns a release function — call it to unregister the blocker.
206
+ */
207
+ blockEscape(): () => void;
208
+ private initializeWebSocket;
209
+ getOnlineUsers(): User[];
210
+ private syncRealtimeRefs;
211
+ private syncFromRealtimeRefs;
212
+ private removeMouseMoveListener;
213
+ private disconnectRealtime;
214
+ destroy(): void;
215
+ }