context_drop 0.3.0 → 0.3.1

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/context_drop/context_drop.js +488 -11
  3. data/app/controllers/context_drop/dashboard/feedbacks_controller.rb +87 -6
  4. data/app/controllers/context_drop/feedbacks_controller.rb +172 -19
  5. data/app/helpers/context_drop/dashboard_helper.rb +4 -0
  6. data/app/javascript/context_drop/api-client.ts +37 -0
  7. data/app/javascript/context_drop/icons.ts +2 -0
  8. data/app/javascript/context_drop/styles.ts +130 -0
  9. data/app/javascript/context_drop/types.ts +48 -3
  10. data/app/javascript/context_drop/widget.ts +325 -11
  11. data/app/models/context_drop/attachment.rb +5 -0
  12. data/app/models/context_drop/comment.rb +50 -0
  13. data/app/models/context_drop/feedback.rb +19 -6
  14. data/app/views/context_drop/dashboard/feedbacks/index.html.erb +6 -0
  15. data/app/views/context_drop/dashboard/feedbacks/show.html.erb +160 -2
  16. data/app/views/layouts/context_drop/application.html.erb +126 -7
  17. data/config/routes.rb +5 -1
  18. data/db/migrate/20261116000001_create_context_drop_comments_and_update_statuses.rb +44 -0
  19. data/lib/context_drop/agent/orchestrator.rb +1 -1
  20. data/lib/context_drop/mcp/dispatcher.rb +2 -1
  21. data/lib/context_drop/mcp/prompts/investigate_feedback.rb +2 -2
  22. data/lib/context_drop/mcp/server.rb +1 -0
  23. data/lib/context_drop/mcp/tools/add_feedback_comment.rb +139 -0
  24. data/lib/context_drop/mcp/tools/get_feedback.rb +29 -1
  25. data/lib/context_drop/mcp/tools/list_feedbacks.rb +1 -1
  26. data/lib/context_drop/mcp/tools/update_feedback_status.rb +2 -2
  27. data/lib/context_drop/version.rb +1 -1
  28. metadata +5 -2
@@ -15,20 +15,21 @@ module ContextDrop
15
15
  @status_counts = {
16
16
  "all" => ContextDrop::Feedback.active.count,
17
17
  "new" => ContextDrop::Feedback.new_records.count,
18
+ "updated" => ContextDrop::Feedback.updated_records.count,
19
+ "fixed" => ContextDrop::Feedback.fixed.count,
18
20
  "reviewed" => ContextDrop::Feedback.reviewed.count,
19
- "resolved" => ContextDrop::Feedback.resolved.count,
20
21
  "dismissed" => ContextDrop::Feedback.dismissed.count,
21
22
  "deleted" => ContextDrop::Feedback.deleted.count
22
23
  }
23
24
 
24
25
  @current_status = params[:status].to_s.strip
25
26
  scope = if @current_status == "deleted"
26
- ContextDrop::Feedback.deleted.includes(:element_references, :attachments).recent
27
+ ContextDrop::Feedback.deleted.includes(:element_references, :attachments, :comments).recent
27
28
  elsif ContextDrop::Feedback::STATUSES.include?(@current_status)
28
- ContextDrop::Feedback.active.where(status: @current_status).includes(:element_references, :attachments).recent
29
+ ContextDrop::Feedback.active.where(status: @current_status).includes(:element_references, :attachments, :comments).recent
29
30
  else
30
31
  @current_status = ""
31
- ContextDrop::Feedback.active.includes(:element_references, :attachments).recent
32
+ ContextDrop::Feedback.active.includes(:element_references, :attachments, :comments).recent
32
33
  end
33
34
 
34
35
  @page_url_filter = params[:page_url].to_s.strip
@@ -39,8 +40,9 @@ module ContextDrop
39
40
  @search_query = (params[:q] || params[:query]).to_s.strip
40
41
  if @search_query.present?
41
42
  pattern = "%#{sanitize_sql_like(@search_query)}%"
42
- scope = scope.left_outer_joins(:element_references).where(
43
+ scope = scope.left_outer_joins(:element_references, :comments).where(
43
44
  "context_drop_feedbacks.message LIKE :q OR " \
45
+ "context_drop_comments.body LIKE :q OR " \
44
46
  "context_drop_element_references.selector LIKE :q OR " \
45
47
  "context_drop_element_references.dom_path LIKE :q OR " \
46
48
  "context_drop_element_references.text_content LIKE :q",
@@ -58,7 +60,7 @@ module ContextDrop
58
60
 
59
61
  def show
60
62
  @feedback = ContextDrop::Feedback
61
- .includes(:element_references, :attachments)
63
+ .includes(:element_references, :attachments, comments: :attachments)
62
64
  .find(params[:id])
63
65
 
64
66
  nav_scope = @feedback.deleted? ? ContextDrop::Feedback.deleted : ContextDrop::Feedback.active
@@ -115,6 +117,85 @@ module ContextDrop
115
117
  end
116
118
  end
117
119
 
120
+ def create_comment
121
+ @feedback = ContextDrop::Feedback.find(params[:id])
122
+ body = (params[:body] || params.dig(:comment, :body)).to_s.strip.presence
123
+ raw_files = Array(params[:images] || params.dig(:comment, :images)).reject(&:blank?)
124
+
125
+ if raw_files.size > ContextDrop.config.max_attachments.to_i
126
+ redirect_to dashboard_feedback_path(@feedback),
127
+ alert: "Too many images attached (maximum #{ContextDrop.config.max_attachments})."
128
+ return
129
+ end
130
+
131
+ comment = nil
132
+ ContextDrop::Feedback.transaction do
133
+ comment = @feedback.comments.build(
134
+ author_type: "Dashboard",
135
+ author_label: "Team",
136
+ body: body,
137
+ metadata: {}
138
+ )
139
+
140
+ pending_attachments = raw_files.map do |file|
141
+ validated = ContextDrop::UploadValidator.validate!(file)
142
+ att_meta = {}
143
+ if validated[:dimensions]
144
+ att_meta["image_dimensions"] = {
145
+ "width" => validated[:dimensions][0],
146
+ "height" => validated[:dimensions][1]
147
+ }
148
+ end
149
+ att = comment.attachments.build(
150
+ feedback: @feedback,
151
+ attachment_type: "image",
152
+ metadata: att_meta
153
+ )
154
+ [att, validated]
155
+ end
156
+
157
+ unless comment.valid?
158
+ redirect_to dashboard_feedback_path(@feedback), alert: comment.errors.full_messages.join(", ")
159
+ raise ActiveRecord::Rollback
160
+ end
161
+
162
+ comment.save!
163
+
164
+ pending_attachments.each do |att, validated|
165
+ next unless att.respond_to?(:file)
166
+
167
+ att.file.attach(
168
+ io: validated[:io],
169
+ filename: validated[:filename],
170
+ content_type: validated[:content_type]
171
+ )
172
+ end
173
+
174
+ @feedback.update!(status: "updated")
175
+ end
176
+
177
+ return if performed?
178
+
179
+ respond_to do |format|
180
+ format.json do
181
+ render json: {
182
+ id: comment.id,
183
+ feedback_id: @feedback.id,
184
+ status: @feedback.status,
185
+ created_at: comment.created_at&.iso8601
186
+ }, status: :created
187
+ end
188
+ format.html do
189
+ redirect_to dashboard_feedback_path(@feedback), notice: "Comment added to Feedback ##{@feedback.id}."
190
+ end
191
+ end
192
+ rescue ContextDrop::UploadValidator::ValidationError => e
193
+ respond_to do |format|
194
+ format.json { render json: { error: e.message }, status: :unprocessable_entity }
195
+ format.html { redirect_to dashboard_feedback_path(@feedback), alert: e.message }
196
+ end
197
+ end
198
+
118
199
  private
119
200
 
120
201
  def enforce_dashboard_authorization!
@@ -3,8 +3,9 @@
3
3
  module ContextDrop
4
4
  class FeedbacksController < ApplicationController
5
5
  before_action :enforce_submission_authorization!
6
- before_action :enforce_rate_limit!, only: %i[create update destroy]
6
+ before_action :enforce_rate_limit!, only: %i[create update destroy create_comment]
7
7
 
8
+ OWNER_ALLOWED_STATUSES = %w[reviewed dismissed].freeze
8
9
  MAX_OWN_FEEDBACKS_LIMIT = 50
9
10
  DEFAULT_OWN_FEEDBACKS_LIMIT = 20
10
11
 
@@ -17,7 +18,7 @@ module ContextDrop
17
18
  raw_tokens = combined_raw_ownership_tokens
18
19
 
19
20
  records = scope
20
- .includes(:element_references, :attachments)
21
+ .includes(:element_references, :attachments, comments: :attachments)
21
22
  .recent
22
23
  .limit(limit)
23
24
  .map do |fb|
@@ -142,7 +143,7 @@ module ContextDrop
142
143
  end
143
144
 
144
145
  def update
145
- feedback = ContextDrop::Feedback.includes(:element_references, :attachments).find_by(id: params[:id])
146
+ feedback = ContextDrop::Feedback.includes(:element_references, :attachments, comments: :attachments).find_by(id: params[:id])
146
147
  if feedback.nil? || feedback.deleted?
147
148
  render json: { error: "Feedback not found" }, status: :not_found
148
149
  return
@@ -156,6 +157,13 @@ module ContextDrop
156
157
 
157
158
  has_elements_key = payload.key?("element_references")
158
159
  has_attachments_key = payload.key?("attachments")
160
+ has_status_key = payload.key?("status")
161
+ requested_status = has_status_key ? payload["status"].to_s.strip : nil
162
+
163
+ if has_status_key && !OWNER_ALLOWED_STATUSES.include?(requested_status)
164
+ render json: { error: "Invalid status '#{requested_status}'" }, status: :unprocessable_entity
165
+ return
166
+ end
159
167
  raw_elements = has_elements_key ? Array(payload["element_references"]) : nil
160
168
  raw_attachments = has_attachments_key ? Array(payload["attachments"]) : nil
161
169
 
@@ -174,14 +182,26 @@ module ContextDrop
174
182
  end
175
183
 
176
184
  ContextDrop::Feedback.transaction do
185
+ content_edited = false
186
+
177
187
  if payload.key?("message")
178
188
  feedback.message = payload["message"].to_s.strip.presence
189
+ content_edited = true
179
190
  end
180
191
 
181
192
  if payload.key?("metadata")
182
193
  sanitized_meta = ContextDrop::MetadataSanitizer.sanitize_feedback_metadata(payload["metadata"])
183
194
  sanitized_meta["environment"] = feedback.environment_name
184
195
  feedback.metadata = sanitized_meta
196
+ content_edited = true
197
+ end
198
+
199
+ content_edited = true if has_elements_key || has_attachments_key
200
+
201
+ if has_status_key
202
+ feedback.status = requested_status
203
+ elsif content_edited
204
+ feedback.status = "updated"
185
205
  end
186
206
 
187
207
  element_refs_by_client_ref = {}
@@ -346,6 +366,107 @@ module ContextDrop
346
366
  }, status: :ok
347
367
  end
348
368
 
369
+ def create_comment
370
+ feedback = ContextDrop::Feedback.includes(:element_references, :attachments, comments: :attachments).find_by(id: params[:id])
371
+ if feedback.nil? || feedback.deleted?
372
+ render json: { error: "Feedback not found" }, status: :not_found
373
+ return
374
+ end
375
+
376
+ payload = extract_comment_payload
377
+ unless owns_feedback?(feedback, payload_token: payload["ownership_token"])
378
+ render json: { error: "Forbidden" }, status: :forbidden
379
+ return
380
+ end
381
+
382
+ raw_attachments = Array(payload["attachments"])
383
+ if raw_attachments.size > ContextDrop.config.max_attachments.to_i
384
+ render json: {
385
+ error: "Attachments count (#{raw_attachments.size}) exceeds maximum allowed (#{ContextDrop.config.max_attachments})"
386
+ }, status: :unprocessable_entity
387
+ return
388
+ end
389
+
390
+ submitter = current_context_drop_submitter
391
+ author_label = if submitter
392
+ if submitter.respond_to?(:name) && submitter.name.present?
393
+ submitter.name.to_s
394
+ elsif submitter.respond_to?(:email) && submitter.email.present?
395
+ submitter.email.to_s
396
+ else
397
+ "#{submitter.class.name}##{submitter.id}"
398
+ end
399
+ else
400
+ "You"
401
+ end
402
+
403
+ comment = nil
404
+ ContextDrop::Feedback.transaction do
405
+ comment = feedback.comments.build(
406
+ author_type: submitter&.class&.name,
407
+ author_id: submitter&.respond_to?(:id) ? submitter.id&.to_s : nil,
408
+ author_label: author_label,
409
+ body: payload["body"].to_s.strip.presence,
410
+ metadata: {}
411
+ )
412
+
413
+ pending_file_attachments = []
414
+ raw_attachments.each do |raw_att|
415
+ att_hash = stringify_hash(raw_att)
416
+ att_type = (att_hash["attachment_type"] || att_hash["type"] || "image").to_s.strip.downcase
417
+ att_type = "image" unless ContextDrop::Attachment::ATTACHMENT_TYPES.include?(att_type)
418
+ att_meta = ContextDrop::MetadataSanitizer.sanitize_attachment_metadata(att_hash["metadata"])
419
+ file_source = resolve_attachment_file_source(att_hash)
420
+
421
+ if file_source[:dimensions] && att_meta["image_dimensions"].nil?
422
+ att_meta["image_dimensions"] = {
423
+ "width" => file_source[:dimensions][0],
424
+ "height" => file_source[:dimensions][1]
425
+ }
426
+ end
427
+
428
+ att_record = comment.attachments.build(
429
+ feedback: feedback,
430
+ attachment_type: att_type,
431
+ metadata: att_meta
432
+ )
433
+ pending_file_attachments << [att_record, file_source]
434
+ end
435
+
436
+ unless comment.valid?
437
+ render json: { error: comment.errors.full_messages.join(", "), errors: comment.errors.full_messages },
438
+ status: :unprocessable_entity
439
+ raise ActiveRecord::Rollback
440
+ end
441
+
442
+ comment.save!
443
+
444
+ pending_file_attachments.each do |att_record, file_source|
445
+ attach_binary_to_record!(att_record, file_source)
446
+ end
447
+
448
+ feedback.update!(status: "updated")
449
+ end
450
+
451
+ return if performed?
452
+
453
+ feedback.reload
454
+ invoke_lifecycle_callback(:on_feedback_updated, feedback)
455
+
456
+ raw_tokens = combined_raw_ownership_tokens(payload["ownership_token"])
457
+ ownership_token = ContextDrop::OwnershipToken.find_token_for(raw_tokens, feedback.id) ||
458
+ ContextDrop::OwnershipToken.generate(feedback.id)
459
+
460
+ render json: {
461
+ id: comment.id,
462
+ feedback_id: feedback.id,
463
+ status: feedback.status,
464
+ comment: serialize_comment(comment),
465
+ feedback: serialize_own_feedback(feedback, ownership_token: ownership_token),
466
+ created_at: comment.created_at&.iso8601
467
+ }, status: :created
468
+ end
469
+
349
470
  def attachment
350
471
  feedback = ContextDrop::Feedback.find_by(id: params[:feedback_id])
351
472
  if feedback.nil? || feedback.deleted?
@@ -358,7 +479,7 @@ module ContextDrop
358
479
  return
359
480
  end
360
481
 
361
- att = feedback.attachments.find_by(id: params[:id])
482
+ att = ContextDrop::Attachment.where(feedback_id: feedback.id).find_by(id: params[:id])
362
483
  if att.nil? || !att.respond_to?(:file) || !att.file.attached?
363
484
  head :not_found
364
485
  return
@@ -454,24 +575,56 @@ module ContextDrop
454
575
  captured_at: el.captured_at&.iso8601
455
576
  }
456
577
  end,
457
- attachments: feedback.attachments.map do |att|
458
- attached = att.respond_to?(:file) && att.file.attached?
459
- linked_el = att.element_reference_id ? elements_by_id[att.element_reference_id] : att.element_reference
460
- {
461
- id: att.id,
462
- attachment_type: att.attachment_type,
463
- element_reference_id: att.element_reference_id,
464
- element_reference_ref: linked_el&.client_ref,
465
- filename: attached ? att.file.filename.to_s : nil,
466
- content_type: attached ? att.file.content_type : nil,
467
- byte_size: attached ? att.file.byte_size : nil,
468
- metadata: att.metadata || {},
469
- created_at: att.created_at&.iso8601
470
- }
471
- end
578
+ attachments: feedback.attachments.map { |att| serialize_attachment(att, elements_by_id) },
579
+ comments_count: feedback.comments.size,
580
+ comments: feedback.comments.map { |comment| serialize_comment(comment) }
581
+ }
582
+ end
583
+
584
+ def serialize_attachment(att, elements_by_id = {})
585
+ attached = att.respond_to?(:file) && att.file.attached?
586
+ linked_el = att.element_reference_id ? elements_by_id[att.element_reference_id] : att.element_reference
587
+ {
588
+ id: att.id,
589
+ attachment_type: att.attachment_type,
590
+ element_reference_id: att.element_reference_id,
591
+ element_reference_ref: linked_el&.client_ref,
592
+ filename: attached ? att.file.filename.to_s : nil,
593
+ content_type: attached ? att.file.content_type : nil,
594
+ byte_size: attached ? att.file.byte_size : nil,
595
+ metadata: att.metadata || {},
596
+ created_at: att.created_at&.iso8601
597
+ }
598
+ end
599
+
600
+ def serialize_comment(comment)
601
+ {
602
+ id: comment.id,
603
+ feedback_id: comment.feedback_id,
604
+ author_label: comment.display_author_label,
605
+ author_type: comment.author_type,
606
+ body: comment.body,
607
+ attachments: comment.attachments.map { |att| serialize_attachment(att) },
608
+ created_at: comment.created_at&.iso8601,
609
+ updated_at: comment.updated_at&.iso8601
472
610
  }
473
611
  end
474
612
 
613
+ def extract_comment_payload
614
+ raw = params[:comment].is_a?(ActionController::Parameters) || params[:comment].is_a?(Hash) ? params[:comment] : params
615
+ hash = stringify_hash(raw)
616
+
617
+ if hash["attachments"].is_a?(String)
618
+ begin
619
+ hash["attachments"] = JSON.parse(hash["attachments"])
620
+ rescue JSON::ParserError
621
+ # Leave as-is if not valid JSON string
622
+ end
623
+ end
624
+
625
+ hash
626
+ end
627
+
475
628
  def extract_linked_element_ref_key(att_hash, att_meta)
476
629
  (
477
630
  att_hash["element_reference_ref"] ||
@@ -47,6 +47,10 @@ module ContextDrop
47
47
  def cd_icon_user(size: 13)
48
48
  %(<svg width="#{size}" height="#{size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>).html_safe
49
49
  end
50
+
51
+ def cd_icon_comment(size: 13)
52
+ %(<svg width="#{size}" height="#{size}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>).html_safe
53
+ end
50
54
  end
51
55
  end
52
56
 
@@ -6,6 +6,8 @@ import type {
6
6
  AgentStatusResponse,
7
7
  ContextDropApiClientOptions,
8
8
  CrossEnvFeedbackListResponse,
9
+ CreateCommentPayload,
10
+ CreateCommentResponse,
9
11
  FeedbackDeleteResponse,
10
12
  FeedbackSubmissionPayload,
11
13
  FeedbackSubmissionResponse,
@@ -457,6 +459,41 @@ export class ContextDropApiClient {
457
459
  return response;
458
460
  }
459
461
 
462
+ public async createComment(
463
+ id: number | string,
464
+ payload: CreateCommentPayload,
465
+ ownershipToken?: string | null
466
+ ): Promise<CreateCommentResponse> {
467
+ const resolvedToken = ownershipToken || this.getOwnershipToken(id);
468
+ const makeRequest = async (csrfToken: string | null) => {
469
+ const headers = this.buildJsonHeaders(csrfToken);
470
+ if (resolvedToken) {
471
+ headers["X-Context-Drop-Ownership-Token"] = resolvedToken;
472
+ }
473
+ const bodyPayload: Record<string, unknown> = { comment: payload };
474
+ if (resolvedToken) {
475
+ bodyPayload.ownership_token = resolvedToken;
476
+ }
477
+ return fetch(`${this.baseUrl}/feedback/${encodeURIComponent(String(id))}/comments`, {
478
+ method: "POST",
479
+ credentials: this.credentials,
480
+ headers,
481
+ body: JSON.stringify(bodyPayload)
482
+ });
483
+ };
484
+
485
+ const response = await this.executeWithCsrfRetry<CreateCommentResponse>(
486
+ makeRequest,
487
+ "Comment failed"
488
+ );
489
+
490
+ const nextToken = response?.feedback?.ownership_token;
491
+ if (response?.feedback?.id !== undefined && nextToken) {
492
+ this.setOwnershipToken(response.feedback.id, nextToken);
493
+ }
494
+ return response;
495
+ }
496
+
460
497
  public async deleteFeedback(
461
498
  id: number | string,
462
499
  ownershipToken?: string | null
@@ -63,3 +63,5 @@ export const ICON_EDIT = `<svg viewBox="0 0 16 16" width="13" height="13" fill="
63
63
 
64
64
  export const ICON_TRASH = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.8 4.5h10.4"/><path d="M6.2 4.5V3.2a.9.9 0 0 1 .9-.9h1.8a.9.9 0 0 1 .9.9v1.3"/><path d="M4.2 4.5l.6 8.3a1.2 1.2 0 0 0 1.2 1.1h4a1.2 1.2 0 0 0 1.2-1.1l.6-8.3"/></svg>`;
65
65
 
66
+ export const ICON_COMMENT = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M13.5 10.2a1.3 1.3 0 0 1-1.3 1.3H5.4L2.5 14V3.8A1.3 1.3 0 0 1 3.8 2.5h8.4a1.3 1.3 0 0 1 1.3 1.3v6.4z"/></svg>`;
67
+
@@ -1162,6 +1162,136 @@ select:focus-visible {
1162
1162
  font-weight: 500;
1163
1163
  }
1164
1164
 
1165
+ .cd-chat-msg.is-commenting {
1166
+ border-color: var(--cd-accent);
1167
+ box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.12);
1168
+ }
1169
+
1170
+ .cd-msg-status-badge {
1171
+ display: inline-flex;
1172
+ align-items: center;
1173
+ padding: 1px 6px;
1174
+ border-radius: 999px;
1175
+ font-size: 10px;
1176
+ font-weight: 600;
1177
+ text-transform: capitalize;
1178
+ letter-spacing: 0.01em;
1179
+ border: 1px solid transparent;
1180
+ line-height: 1.4;
1181
+ }
1182
+
1183
+ .cd-msg-status-badge.is-new {
1184
+ background: #eff6ff;
1185
+ border-color: #bfdbfe;
1186
+ color: #1d4ed8;
1187
+ }
1188
+
1189
+ .cd-msg-status-badge.is-updated {
1190
+ background: #fffbeb;
1191
+ border-color: #fde68a;
1192
+ color: #b45309;
1193
+ }
1194
+
1195
+ .cd-msg-status-badge.is-fixed {
1196
+ background: #eef2ff;
1197
+ border-color: #c7d2fe;
1198
+ color: #4338ca;
1199
+ }
1200
+
1201
+ .cd-msg-status-badge.is-reviewed {
1202
+ background: #f0fdf4;
1203
+ border-color: #bbf7d0;
1204
+ color: #15803d;
1205
+ }
1206
+
1207
+ .cd-msg-status-badge.is-dismissed {
1208
+ background: #f8fafc;
1209
+ border-color: #e2e8f0;
1210
+ color: #64748b;
1211
+ }
1212
+
1213
+ .cd-review-btn {
1214
+ display: inline-flex;
1215
+ align-items: center;
1216
+ gap: 4px;
1217
+ padding: 2px 7px;
1218
+ border-radius: 5px;
1219
+ border: 1px solid #bbf7d0;
1220
+ background: #f0fdf4;
1221
+ color: #15803d;
1222
+ font-family: inherit;
1223
+ font-size: 10.5px;
1224
+ font-weight: 600;
1225
+ cursor: pointer;
1226
+ transition: background 0.12s ease, border-color 0.12s ease;
1227
+ }
1228
+
1229
+ .cd-review-btn:hover:not(:disabled) {
1230
+ background: #dcfce7;
1231
+ border-color: #86efac;
1232
+ }
1233
+
1234
+ .cd-review-btn:disabled {
1235
+ opacity: 0.5;
1236
+ cursor: default;
1237
+ }
1238
+
1239
+ .cd-comments-list {
1240
+ display: flex;
1241
+ flex-direction: column;
1242
+ gap: 6px;
1243
+ margin-top: 6px;
1244
+ padding-top: 6px;
1245
+ border-top: 1px dashed var(--cd-border-subtle);
1246
+ }
1247
+
1248
+ .cd-comment-item {
1249
+ background: var(--cd-surface-recessed);
1250
+ border: 1px solid var(--cd-border-subtle);
1251
+ border-radius: 6px;
1252
+ padding: 6px 8px;
1253
+ }
1254
+
1255
+ .cd-comment-header {
1256
+ display: flex;
1257
+ align-items: center;
1258
+ justify-content: space-between;
1259
+ gap: 6px;
1260
+ font-size: 10.5px;
1261
+ color: var(--cd-muted);
1262
+ margin-bottom: 2px;
1263
+ }
1264
+
1265
+ .cd-comment-author {
1266
+ font-weight: 600;
1267
+ color: var(--cd-ink);
1268
+ }
1269
+
1270
+ .cd-comment-body {
1271
+ margin: 0;
1272
+ font-size: 11.5px;
1273
+ line-height: 1.42;
1274
+ color: var(--cd-ink);
1275
+ white-space: pre-wrap;
1276
+ word-break: break-word;
1277
+ }
1278
+
1279
+ .cd-comment-images {
1280
+ display: flex;
1281
+ flex-wrap: wrap;
1282
+ gap: 5px;
1283
+ margin-top: 5px;
1284
+ }
1285
+
1286
+ .cd-comment-thumb {
1287
+ width: 48px;
1288
+ height: 48px;
1289
+ object-fit: cover;
1290
+ border-radius: 4px;
1291
+ border: 1px solid var(--cd-border);
1292
+ display: block;
1293
+ }
1294
+
1165
1295
  /* ==========================================================================
1166
1296
  4. LOCAL BYOK AGENTIC CODING SIDEBAR (.cd-agent-sidebar)
1167
1297
  ========================================================================== */
@@ -79,6 +79,16 @@ export interface SessionFeedbackAttachmentItem {
79
79
  metadata?: Record<string, unknown>;
80
80
  }
81
81
 
82
+ export interface SessionFeedbackCommentItem {
83
+ id: number | string;
84
+ author_label: string;
85
+ author_type?: string | null;
86
+ body: string | null;
87
+ createdAt: string;
88
+ rawCreatedAt?: string;
89
+ attachments: SessionFeedbackAttachmentItem[];
90
+ }
91
+
82
92
  export interface SessionFeedbackEntry {
83
93
  id: number | string;
84
94
  message: string;
@@ -91,6 +101,7 @@ export interface SessionFeedbackEntry {
91
101
  ownershipToken?: string;
92
102
  elements: ElementReferenceSnapshot[];
93
103
  attachments: SessionFeedbackAttachmentItem[];
104
+ comments?: SessionFeedbackCommentItem[];
94
105
  }
95
106
 
96
107
  export interface ContextDropApiClientOptions {
@@ -153,6 +164,17 @@ export interface OwnFeedbackAttachment {
153
164
  created_at?: string;
154
165
  }
155
166
 
167
+ export interface FeedbackCommentRecord {
168
+ id: number | string;
169
+ feedback_id?: number | string;
170
+ author_label: string;
171
+ author_type?: string | null;
172
+ body: string | null;
173
+ attachments: OwnFeedbackAttachment[];
174
+ created_at: string;
175
+ updated_at?: string;
176
+ }
177
+
156
178
  export interface OwnFeedbackRecord {
157
179
  id: number;
158
180
  environment?: string;
@@ -164,6 +186,8 @@ export interface OwnFeedbackRecord {
164
186
  element_references_count: number;
165
187
  element_references: ElementReferenceSnapshot[];
166
188
  attachments: OwnFeedbackAttachment[];
189
+ comments_count?: number;
190
+ comments?: FeedbackCommentRecord[];
167
191
  created_at: string;
168
192
  updated_at: string;
169
193
  ownership_token?: string;
@@ -185,10 +209,31 @@ export interface FeedbackAttachmentUpdateInput {
185
209
  }
186
210
 
187
211
  export interface FeedbackUpdatePayload {
188
- message: string;
212
+ message?: string;
213
+ status?: string;
189
214
  metadata?: Record<string, unknown>;
190
- element_references: ElementReferenceSnapshot[];
191
- attachments: FeedbackAttachmentUpdateInput[];
215
+ element_references?: ElementReferenceSnapshot[];
216
+ attachments?: FeedbackAttachmentUpdateInput[];
217
+ }
218
+
219
+ export interface CreateCommentPayload {
220
+ body: string;
221
+ attachments: Array<{
222
+ attachment_type: "image" | "screenshot";
223
+ filename: string;
224
+ signed_blob_id?: string;
225
+ data_url?: string;
226
+ metadata: Record<string, unknown>;
227
+ }>;
228
+ }
229
+
230
+ export interface CreateCommentResponse {
231
+ id: number | string;
232
+ feedback_id: number | string;
233
+ status: string;
234
+ comment: FeedbackCommentRecord;
235
+ feedback?: OwnFeedbackRecord;
236
+ created_at: string;
192
237
  }
193
238
 
194
239
  export interface FeedbackUpdateResponse {