context_drop 0.2.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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +149 -12
  3. data/Rakefile +110 -1
  4. data/app/assets/javascripts/context_drop/context_drop.js +1759 -105
  5. data/app/controllers/context_drop/application_controller.rb +52 -3
  6. data/app/controllers/context_drop/configs_controller.rb +10 -1
  7. data/app/controllers/context_drop/dashboard/feedbacks_controller.rb +99 -14
  8. data/app/controllers/context_drop/feedbacks_controller.rb +536 -17
  9. data/app/helpers/context_drop/dashboard_helper.rb +4 -0
  10. data/app/javascript/context_drop/__tests__/api-client.test.ts +255 -0
  11. data/app/javascript/context_drop/__tests__/widget.test.ts +355 -1
  12. data/app/javascript/context_drop/api-client.ts +343 -22
  13. data/app/javascript/context_drop/element-picker.ts +1 -1
  14. data/app/javascript/context_drop/icons.ts +6 -0
  15. data/app/javascript/context_drop/screenshot.ts +1 -1
  16. data/app/javascript/context_drop/styles.ts +311 -0
  17. data/app/javascript/context_drop/types.ts +141 -6
  18. data/app/javascript/context_drop/widget.ts +1072 -35
  19. data/app/models/context_drop/attachment.rb +5 -0
  20. data/app/models/context_drop/comment.rb +50 -0
  21. data/app/models/context_drop/feedback.rb +81 -11
  22. data/app/services/context_drop/ownership_token.rb +114 -0
  23. data/app/views/context_drop/dashboard/feedbacks/index.html.erb +14 -0
  24. data/app/views/context_drop/dashboard/feedbacks/show.html.erb +169 -2
  25. data/app/views/layouts/context_drop/application.html.erb +131 -7
  26. data/config/routes.rb +16 -1
  27. data/db/migrate/20261113000005_add_deleted_at_to_context_drop_feedbacks.rb +11 -0
  28. data/db/migrate/20261116000001_create_context_drop_comments_and_update_statuses.rb +44 -0
  29. data/lib/context_drop/agent/orchestrator.rb +1 -1
  30. data/lib/context_drop/configuration.rb +26 -0
  31. data/lib/context_drop/mcp/dispatcher.rb +2 -1
  32. data/lib/context_drop/mcp/prompts/investigate_feedback.rb +5 -3
  33. data/lib/context_drop/mcp/server.rb +1 -0
  34. data/lib/context_drop/mcp/tools/add_feedback_comment.rb +139 -0
  35. data/lib/context_drop/mcp/tools/get_feedback.rb +45 -6
  36. data/lib/context_drop/mcp/tools/get_feedback_attachment.rb +3 -0
  37. data/lib/context_drop/mcp/tools/list_feedbacks.rb +23 -3
  38. data/lib/context_drop/mcp/tools/update_feedback_status.rb +5 -3
  39. data/lib/context_drop/version.rb +1 -1
  40. metadata +7 -2
@@ -128,6 +128,47 @@ export const WIDGET_SHADOW_STYLES = `
128
128
  border-color: #3b4252;
129
129
  }
130
130
 
131
+ :host([data-cd-theme="dark"]) .cd-msg-action-btn:hover:not(:disabled),
132
+ :host([data-theme="dark"]) .cd-msg-action-btn:hover:not(:disabled),
133
+ .cd-composer[data-theme="dark"] .cd-msg-action-btn:hover:not(:disabled) {
134
+ background: rgba(255, 255, 255, 0.09);
135
+ color: var(--cd-ink);
136
+ }
137
+
138
+ :host([data-cd-theme="dark"]) .cd-msg-action-btn.is-danger:hover:not(:disabled),
139
+ :host([data-theme="dark"]) .cd-msg-action-btn.is-danger:hover:not(:disabled),
140
+ .cd-composer[data-theme="dark"] .cd-msg-action-btn.is-danger:hover:not(:disabled) {
141
+ background: var(--cd-danger-soft);
142
+ color: #fca5a5;
143
+ }
144
+
145
+ :host([data-cd-theme="dark"]) .cd-edit-banner-info,
146
+ :host([data-theme="dark"]) .cd-edit-banner-info,
147
+ .cd-composer[data-theme="dark"] .cd-edit-banner-info {
148
+ color: var(--cd-ink);
149
+ }
150
+
151
+ :host([data-cd-theme="dark"]) .cd-msg-delete-label,
152
+ :host([data-theme="dark"]) .cd-msg-delete-label,
153
+ .cd-composer[data-theme="dark"] .cd-msg-delete-label {
154
+ color: #fca5a5;
155
+ }
156
+
157
+ :host([data-cd-theme="dark"]) .cd-btn-danger,
158
+ :host([data-theme="dark"]) .cd-btn-danger,
159
+ .cd-composer[data-theme="dark"] .cd-btn-danger {
160
+ background: #dc2626;
161
+ border-color: #dc2626;
162
+ color: #ffffff;
163
+ }
164
+
165
+ :host([data-cd-theme="dark"]) .cd-btn-danger:hover:not(:disabled),
166
+ :host([data-theme="dark"]) .cd-btn-danger:hover:not(:disabled),
167
+ .cd-composer[data-theme="dark"] .cd-btn-danger:hover:not(:disabled) {
168
+ background: #ef4444;
169
+ border-color: #ef4444;
170
+ }
171
+
131
172
  *, *::before, *::after {
132
173
  box-sizing: border-box;
133
174
  }
@@ -990,11 +1031,18 @@ select:focus-visible {
990
1031
  flex-direction: column;
991
1032
  gap: 5px;
992
1033
  align-self: flex-end;
1034
+ width: 92%;
993
1035
  max-width: 92%;
994
1036
  padding: 9px 11px;
995
1037
  background: var(--cd-surface-elevated);
996
1038
  border: 1px solid var(--cd-border);
997
1039
  border-radius: 12px 12px 3px 12px;
1040
+ transition: border-color 0.14s var(--cd-ease), box-shadow 0.14s var(--cd-ease);
1041
+ }
1042
+
1043
+ .cd-chat-msg.is-editing {
1044
+ border-color: var(--cd-accent);
1045
+ box-shadow: 0 0 0 2px var(--cd-accent-soft);
998
1046
  }
999
1047
 
1000
1048
  .cd-chat-msg-text {
@@ -1015,6 +1063,83 @@ select:focus-visible {
1015
1063
  font-variant-numeric: tabular-nums;
1016
1064
  }
1017
1065
 
1066
+ .cd-chat-msg-meta-info {
1067
+ display: inline-flex;
1068
+ align-items: center;
1069
+ gap: 6px;
1070
+ min-width: 0;
1071
+ flex-wrap: wrap;
1072
+ }
1073
+
1074
+ .cd-chat-msg-actions {
1075
+ display: inline-flex;
1076
+ align-items: center;
1077
+ gap: 2px;
1078
+ flex-shrink: 0;
1079
+ }
1080
+
1081
+ .cd-msg-action-btn {
1082
+ appearance: none;
1083
+ display: inline-flex;
1084
+ align-items: center;
1085
+ justify-content: center;
1086
+ width: 24px;
1087
+ height: 24px;
1088
+ padding: 0;
1089
+ border: 1px solid transparent;
1090
+ border-radius: 6px;
1091
+ background: transparent;
1092
+ color: var(--cd-ink-secondary);
1093
+ cursor: pointer;
1094
+ transition: background-color 0.12s ease, color 0.12s ease, border-color 0.12s ease;
1095
+ }
1096
+
1097
+ .cd-msg-action-btn:hover:not(:disabled) {
1098
+ background: rgba(17, 19, 24, 0.06);
1099
+ color: var(--cd-ink);
1100
+ }
1101
+
1102
+ .cd-msg-action-btn.is-active {
1103
+ background: var(--cd-accent-soft);
1104
+ color: var(--cd-accent-hover);
1105
+ border-color: rgba(29, 78, 216, 0.25);
1106
+ }
1107
+
1108
+ .cd-msg-action-btn.is-danger:hover:not(:disabled) {
1109
+ background: var(--cd-danger-soft);
1110
+ color: var(--cd-danger);
1111
+ }
1112
+
1113
+ .cd-msg-action-btn:disabled {
1114
+ opacity: 0.4;
1115
+ cursor: not-allowed;
1116
+ }
1117
+
1118
+ .cd-msg-delete-confirm {
1119
+ display: flex;
1120
+ align-items: center;
1121
+ justify-content: space-between;
1122
+ gap: 8px;
1123
+ margin-top: 2px;
1124
+ padding: 6px 8px;
1125
+ border-radius: 8px;
1126
+ background: var(--cd-danger-soft);
1127
+ border: 1px solid rgba(185, 28, 28, 0.24);
1128
+ }
1129
+
1130
+ .cd-msg-delete-label {
1131
+ font-size: 11.5px;
1132
+ font-weight: 600;
1133
+ color: var(--cd-danger);
1134
+ }
1135
+
1136
+ .cd-msg-delete-btns {
1137
+ display: inline-flex;
1138
+ align-items: center;
1139
+ gap: 5px;
1140
+ flex-shrink: 0;
1141
+ }
1142
+
1018
1143
  .cd-chat-msg-pills {
1019
1144
  display: flex;
1020
1145
  flex-wrap: wrap;
@@ -1037,6 +1162,136 @@ select:focus-visible {
1037
1162
  font-weight: 500;
1038
1163
  }
1039
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
+
1040
1295
  /* ==========================================================================
1041
1296
  4. LOCAL BYOK AGENTIC CODING SIDEBAR (.cd-agent-sidebar)
1042
1297
  ========================================================================== */
@@ -1899,6 +2154,42 @@ select:focus-visible {
1899
2154
  border-top: 1px solid var(--cd-border);
1900
2155
  }
1901
2156
 
2157
+ .cd-edit-banner {
2158
+ display: flex;
2159
+ align-items: center;
2160
+ justify-content: space-between;
2161
+ gap: 8px;
2162
+ padding: 6px 12px;
2163
+ background: var(--cd-accent-soft);
2164
+ border-bottom: 1px solid var(--cd-border-subtle);
2165
+ font-size: 12px;
2166
+ color: var(--cd-ink);
2167
+ }
2168
+
2169
+ .cd-edit-banner[hidden] {
2170
+ display: none !important;
2171
+ }
2172
+
2173
+ .cd-edit-banner-info {
2174
+ display: inline-flex;
2175
+ align-items: center;
2176
+ gap: 6px;
2177
+ min-width: 0;
2178
+ font-weight: 600;
2179
+ color: var(--cd-accent-hover);
2180
+ }
2181
+
2182
+ .cd-edit-banner-info svg {
2183
+ color: var(--cd-accent-hover);
2184
+ flex-shrink: 0;
2185
+ }
2186
+
2187
+ .cd-edit-banner-id {
2188
+ font-family: var(--cd-mono);
2189
+ font-size: 11px;
2190
+ font-variant-numeric: tabular-nums;
2191
+ }
2192
+
1902
2193
  .cd-textarea {
1903
2194
  width: 100%;
1904
2195
  min-height: 68px;
@@ -1979,6 +2270,24 @@ select:focus-visible {
1979
2270
  border-color: #252a34;
1980
2271
  }
1981
2272
 
2273
+ .cd-btn-xs {
2274
+ padding: 3px 8px;
2275
+ font-size: 11.5px;
2276
+ border-radius: 6px;
2277
+ }
2278
+
2279
+ .cd-btn-danger {
2280
+ background: var(--cd-danger);
2281
+ border-color: var(--cd-danger);
2282
+ color: #ffffff;
2283
+ font-weight: 600;
2284
+ }
2285
+
2286
+ .cd-btn-danger:hover:not(:disabled) {
2287
+ background: #991b1b;
2288
+ border-color: #991b1b;
2289
+ }
2290
+
1982
2291
  @media (max-width: 560px) {
1983
2292
  .cd-composer,
1984
2293
  .cd-compact-bar {
@@ -2006,6 +2315,8 @@ select:focus-visible {
2006
2315
  .cd-corner-flap,
2007
2316
  .cd-drag-pin-head,
2008
2317
  .cd-composer,
2318
+ .cd-chat-msg,
2319
+ .cd-msg-action-btn,
2009
2320
  .cd-agent-sidebar,
2010
2321
  .cd-skeleton-bar {
2011
2322
  animation: none !important;
@@ -54,6 +54,7 @@ export interface SmartComponentDescription {
54
54
 
55
55
  export interface PendingAttachmentItem {
56
56
  id: string;
57
+ existing_attachment_id?: number | string;
57
58
  attachment_type: "image" | "screenshot";
58
59
  label: string;
59
60
  preview_url: string;
@@ -65,17 +66,47 @@ export interface PendingAttachmentItem {
65
66
  metadata: Record<string, unknown>;
66
67
  }
67
68
 
69
+ export interface SessionFeedbackAttachmentItem {
70
+ id: string;
71
+ server_id?: number | string;
72
+ label: string;
73
+ preview_url: string;
74
+ attachment_type: "image" | "screenshot";
75
+ filename?: string | null;
76
+ signed_blob_id?: string;
77
+ data_url?: string;
78
+ element_reference_ref?: string | null;
79
+ metadata?: Record<string, unknown>;
80
+ }
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
+
68
92
  export interface SessionFeedbackEntry {
69
93
  id: number | string;
70
94
  message: string;
95
+ rawMessage?: string;
71
96
  createdAt: string;
97
+ rawCreatedAt?: string;
98
+ rawUpdatedAt?: string;
99
+ isEdited?: boolean;
100
+ status?: string;
101
+ ownershipToken?: string;
72
102
  elements: ElementReferenceSnapshot[];
73
- attachments: Array<{
74
- id: string;
75
- label: string;
76
- preview_url: string;
77
- attachment_type: "image" | "screenshot";
78
- }>;
103
+ attachments: SessionFeedbackAttachmentItem[];
104
+ comments?: SessionFeedbackCommentItem[];
105
+ }
106
+
107
+ export interface ContextDropApiClientOptions {
108
+ credentials?: RequestCredentials;
109
+ headers?: Record<string, string>;
79
110
  }
80
111
 
81
112
  export interface WidgetConfig {
@@ -122,6 +153,107 @@ export interface FeedbackSubmissionPayload {
122
153
  }>;
123
154
  }
124
155
 
156
+ export interface OwnFeedbackAttachment {
157
+ id: number | string;
158
+ attachment_type: "image" | "screenshot";
159
+ filename: string | null;
160
+ content_type?: string | null;
161
+ byte_size?: number | null;
162
+ element_reference_ref?: string | null;
163
+ metadata?: Record<string, unknown>;
164
+ created_at?: string;
165
+ }
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
+
178
+ export interface OwnFeedbackRecord {
179
+ id: number;
180
+ environment?: string;
181
+ message: string;
182
+ page_url?: string;
183
+ status: string;
184
+ metadata?: Record<string, unknown>;
185
+ attachments_count: number;
186
+ element_references_count: number;
187
+ element_references: ElementReferenceSnapshot[];
188
+ attachments: OwnFeedbackAttachment[];
189
+ comments_count?: number;
190
+ comments?: FeedbackCommentRecord[];
191
+ created_at: string;
192
+ updated_at: string;
193
+ ownership_token?: string;
194
+ }
195
+
196
+ export interface OwnFeedbackListResponse {
197
+ total_count: number;
198
+ feedbacks: OwnFeedbackRecord[];
199
+ }
200
+
201
+ export interface FeedbackAttachmentUpdateInput {
202
+ existing_id?: number | string;
203
+ attachment_type?: "image" | "screenshot";
204
+ filename?: string;
205
+ signed_blob_id?: string;
206
+ data_url?: string;
207
+ element_reference_ref?: string;
208
+ metadata?: Record<string, unknown>;
209
+ }
210
+
211
+ export interface FeedbackUpdatePayload {
212
+ message?: string;
213
+ status?: string;
214
+ metadata?: Record<string, unknown>;
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;
237
+ }
238
+
239
+ export interface FeedbackUpdateResponse {
240
+ id: number;
241
+ environment?: string;
242
+ status: string;
243
+ attachments_count: number;
244
+ element_references_count: number;
245
+ created_at: string;
246
+ updated_at: string;
247
+ ownership_token?: string;
248
+ feedback?: OwnFeedbackRecord;
249
+ }
250
+
251
+ export interface FeedbackDeleteResponse {
252
+ id: number;
253
+ deleted: boolean;
254
+ deleted_at: string;
255
+ }
256
+
125
257
  export interface FeedbackSubmissionResponse {
126
258
  id: number;
127
259
  environment?: string;
@@ -129,6 +261,9 @@ export interface FeedbackSubmissionResponse {
129
261
  attachments_count: number;
130
262
  element_references_count: number;
131
263
  created_at: string;
264
+ updated_at?: string;
265
+ ownership_token?: string;
266
+ feedback?: OwnFeedbackRecord;
132
267
  }
133
268
 
134
269
  export interface AgentProviderInfo {