@veltdev/sdk 5.0.2-beta.31 → 5.0.2-beta.32

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.
@@ -23,6 +23,8 @@ export declare const CommentActivityActionTypes: {
23
23
  readonly APPROVE: "comment_annotation.approve";
24
24
  readonly ACCEPT: "comment.accept";
25
25
  readonly REJECT: "comment.reject";
26
+ readonly SUGGESTION_ACCEPT: "comment_annotation.suggestion_accept";
27
+ readonly SUGGESTION_REJECT: "comment_annotation.suggestion_reject";
26
28
  readonly REACTION_ADD: "comment.reaction_add";
27
29
  readonly REACTION_DELETE: "comment.reaction_delete";
28
30
  readonly SUBSCRIBE: "comment_annotation.subscribe";
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Public configuration surface for AI agent suggestion comment actions.
3
+ *
4
+ * Hosts can override or augment the built-in accept (convert suggestion ->
5
+ * comment) and reject (delete) actions rendered on an agent suggestion card.
6
+ * When no config is provided, the built-in defaults are used (INV-004).
7
+ *
8
+ * Part of the SDK public API (exported via velt-types). Backward-compatible /
9
+ * additive — see specs/agent-suggestion-comment-ui/spec.md `## Outbound contract changes`.
10
+ */
11
+ import { CommentAnnotation } from './comment-annotation.data.model';
12
+ /**
13
+ * A single host-defined action button on an agent suggestion card.
14
+ */
15
+ export interface AgentSuggestionAction {
16
+ /** Stable identifier for the action. */
17
+ id: string;
18
+ /** Display label (button text / aria-label). */
19
+ label?: string;
20
+ /** Optional icon identifier or URL. */
21
+ icon?: string;
22
+ /**
23
+ * Invoked when the action button is clicked. Receives the raw
24
+ * CommentAnnotation (review decision 2026-06-03 — accepted public-contract
25
+ * surface). Handler throws are caught by the SDK (EC-006).
26
+ */
27
+ onClick: (annotation: CommentAnnotation) => void | Promise<void>;
28
+ }
29
+ /**
30
+ * Host configuration for agent suggestion card actions.
31
+ * When `actions` is provided it replaces the default accept/reject pair.
32
+ */
33
+ export interface AgentSuggestionActionsConfig {
34
+ actions?: AgentSuggestionAction[];
35
+ }
36
+ /**
37
+ * Discriminator for the bespoke agent-suggestion overflow-menu rows.
38
+ * Drives the icon, label and click action of the generic menu-item primitive.
39
+ */
40
+ export type AgentSuggestionMenuItemType = 'copy-link' | 'delete';
41
+ /**
42
+ * Canonical agent-suggestion overflow-menu item types.
43
+ * Avoids repeating the discriminator string literals across primitives.
44
+ */
45
+ export declare const AGENT_SUGGESTION_MENU_ITEM_TYPE: {
46
+ readonly COPY_LINK: "copy-link";
47
+ readonly DELETE: "delete";
48
+ };
49
+ /**
50
+ * Translation keys / labels used by the agent-suggestion overflow menu.
51
+ * Centralised so the menu-item, label and trigger primitives stay in sync.
52
+ */
53
+ export declare const AGENT_SUGGESTION_MENU_LABEL: {
54
+ readonly COPY_LINK: "Copy link";
55
+ readonly LINK_COPIED: "Link copied!";
56
+ readonly DELETE_THREAD: "Delete thread";
57
+ };
@@ -85,6 +85,16 @@ export interface RejectCommentAnnotationRequest {
85
85
  annotationId: string;
86
86
  options?: RequestOptions;
87
87
  }
88
+ export interface AcceptSuggestionRequest {
89
+ annotationId: string;
90
+ options?: RequestOptions;
91
+ }
92
+ export interface RejectSuggestionRequest {
93
+ annotationId: string;
94
+ /** Optional human-readable reason persisted on the suggestion. */
95
+ reason?: string;
96
+ options?: RequestOptions;
97
+ }
88
98
  export interface DeleteCommentAnnotationRequest {
89
99
  annotationId: string;
90
100
  options?: RequestOptions;
@@ -17,6 +17,34 @@ export interface CommentAnnotationVisibilityConfig {
17
17
  organizationId?: string;
18
18
  userIds?: string[];
19
19
  }
20
+ /**
21
+ * Structured result produced by an AI agent for a comment annotation.
22
+ * Read-only from the SDK's perspective — written upstream by the agent.
23
+ */
24
+ export interface AgentResult {
25
+ /** Short, bold headline rendered at the top of the agent suggestion card. */
26
+ title?: string;
27
+ }
28
+ /**
29
+ * Identity + output of the AI agent that authored a comment annotation.
30
+ * Present on annotations created by an agent. The agent-suggestion UI renders
31
+ * iff `agent` is present AND `type === 'suggestion'` (and the viewer is admin).
32
+ *
33
+ * `agentFields` mirrors the Firestore query field used by
34
+ * `CommentRequestQuery.agentFields` (see comment-actions.data.model.ts).
35
+ */
36
+ export interface AgentData {
37
+ /** Canonical display name of the agent (card header). */
38
+ agentName?: string;
39
+ /** Legacy display name of the agent (card header); superseded by `agentName`. */
40
+ name?: string;
41
+ /** Avatar URL for the agent (card header); falls back to a default icon. */
42
+ avatar?: string;
43
+ /** Structured agent output (title, …). */
44
+ result?: AgentResult;
45
+ /** Queryable agent attributes. */
46
+ agentFields?: string[];
47
+ }
20
48
  export declare class CommentAnnotation {
21
49
  /**
22
50
  * Unique identifier for the comment pin annotation.
@@ -151,6 +179,12 @@ export declare class CommentAnnotation {
151
179
  location?: Location | null;
152
180
  type?: string;
153
181
  commentType?: string;
182
+ /**
183
+ * Origin of the annotation. `'agent'` indicates the annotation was authored by
184
+ * an AI agent (drives the blue pin marker, agent identity header and blue text
185
+ * highlight). Absent / any other value indicates a regular user comment.
186
+ */
187
+ sourceType?: string;
154
188
  metadata?: CommentMetadata;
155
189
  /**
156
190
  * Selected text range of comment annotation
@@ -162,6 +196,10 @@ export declare class CommentAnnotation {
162
196
  selectAllContent?: boolean;
163
197
  approved?: boolean;
164
198
  status: CustomStatus;
199
+ /**
200
+ * User id of the user who updated the status of the comment annotation
201
+ */
202
+ statusUpdatedByUserId?: string | null;
165
203
  /**
166
204
  * To maintain index of current annotation in available list of annotations
167
205
  * It will start from 1, so no need to add 1 in that.
@@ -207,6 +245,12 @@ export declare class CommentAnnotation {
207
245
  * See docs/suggestions-api-contract.md for the full storage model.
208
246
  */
209
247
  suggestion?: SuggestionData;
248
+ /**
249
+ * AI agent identity + output. Present on agent-authored annotations.
250
+ * Read-only from the SDK; written upstream by the agent.
251
+ * See specs/agent-suggestion-comment-ui/spec.md (INV-001).
252
+ */
253
+ agent?: AgentData;
210
254
  }
211
255
  export declare class GhostComment {
212
256
  targetElement?: TargetElement | null;
@@ -93,6 +93,8 @@ export type CommentEventTypesMap = {
93
93
  [CommentEventTypes.COMMENT_SAVED]: CommentSavedEvent;
94
94
  [CommentEventTypes.COMMENT_SAVE_TRIGGERED]: CommentSaveTriggeredEvent;
95
95
  [CommentEventTypes.VISIBILITY_OPTION_CLICKED]: VisibilityOptionClickedEvent;
96
+ [CommentEventTypes.SUGGESTION_ACCEPTED]: SuggestionAcceptEvent;
97
+ [CommentEventTypes.SUGGESTION_REJECTED]: SuggestionRejectEvent;
96
98
  };
97
99
  export interface AddAttachmentEvent {
98
100
  annotationId: string;
@@ -146,6 +148,20 @@ export interface DeleteCommentAnnotationEvent {
146
148
  commentAnnotation: CommentAnnotation;
147
149
  metadata: VeltEventMetadata;
148
150
  }
151
+ export interface SuggestionAcceptEvent {
152
+ annotationId: string;
153
+ commentAnnotation: CommentAnnotation;
154
+ metadata: VeltEventMetadata;
155
+ actionUser: User;
156
+ }
157
+ export interface SuggestionRejectEvent {
158
+ annotationId: string;
159
+ commentAnnotation: CommentAnnotation;
160
+ metadata: VeltEventMetadata;
161
+ actionUser: User;
162
+ /** Optional human-readable reason supplied at reject time. */
163
+ rejectReason?: string | null;
164
+ }
149
165
  export interface GetCommentAnnotationsResponse {
150
166
  data: Record<string, CommentAnnotation[]> | null;
151
167
  }
@@ -19,7 +19,7 @@ import { User } from './user.data.model';
19
19
  * - apply_failed: Customer apply handler threw during a suggestionApproved event.
20
20
  * Status set by the SDK after the throw was caught.
21
21
  */
22
- export type SuggestionStatus = 'pending' | 'approved' | 'rejected' | 'stale' | 'apply_failed';
22
+ export type SuggestionStatus = 'pending' | 'accepted' | 'rejected' | 'stale' | 'apply_failed';
23
23
  /**
24
24
  * Global per-user-per-session suggestion mode. Not persisted; reload returns to 'editing'.
25
25
  */
@@ -207,7 +207,7 @@ export interface PendingSuggestion<T = unknown> extends SuggestionBase<T> {
207
207
  }
208
208
  /** A suggestion that has been approved (apply handler success or pending invocation). */
209
209
  export interface ApprovedSuggestion<T = unknown> extends SuggestionBase<T> {
210
- status: 'approved' | 'apply_failed';
210
+ status: 'accepted' | 'apply_failed';
211
211
  rejectReason: null;
212
212
  resolvedBy: User;
213
213
  resolvedAt: number;
@@ -14,7 +14,9 @@ export declare enum CommentStatus {
14
14
  REACTION_ADDED = "reactionAdded",
15
15
  REACTION_DELETED = "reactionDeleted",
16
16
  SUBSCRIBED = "subscribed",
17
- UNSUBSCRIBED = "unsubscribed"
17
+ UNSUBSCRIBED = "unsubscribed",
18
+ SUGGESTION_ACCEPTED = "suggestionAccepted",
19
+ SUGGESTION_REJECTED = "suggestionRejected"
18
20
  }
19
21
  export declare enum ResolverActions {
20
22
  COMMENT_ANNOTATION_ADD = "comment_annotation.add",
@@ -72,6 +74,8 @@ export declare const CommentEventTypes: {
72
74
  readonly COMMENT_SAVED: "commentSaved";
73
75
  readonly COMMENT_SAVE_TRIGGERED: "commentSaveTriggered";
74
76
  readonly VISIBILITY_OPTION_CLICKED: "visibilityOptionClicked";
77
+ readonly SUGGESTION_ACCEPTED: "suggestionAccepted";
78
+ readonly SUGGESTION_REJECTED: "suggestionRejected";
75
79
  };
76
80
  export declare const RecorderEventTypes: {
77
81
  readonly TRANSCRIPTION_DONE: "transcriptionDone";
package/models.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './app/models/data/attachment.model';
4
4
  export * from './app/models/data/activity.data.model';
5
5
  export * from './app/models/data/area-annotation.data.model';
6
6
  export * from './app/models/data/arrow-annotation.data.model';
7
+ export * from './app/models/data/agent-suggestion.data.model';
7
8
  export * from './app/models/data/base-metadata.data.model';
8
9
  export * from './app/models/data/button.data.model';
9
10
  export * from './app/models/data/chatgpt.data.model';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veltdev/sdk",
3
- "version": "5.0.2-beta.31",
3
+ "version": "5.0.2-beta.32",
4
4
  "description": "Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.",
5
5
  "homepage": "https://velt.dev",
6
6
  "keywords": [