context-drop 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/app/assets/javascripts/context_drop/context_drop.js +1039 -26
- package/dist/app/javascript/context_drop/api-client.d.ts +13 -1
- package/dist/app/javascript/context_drop/api-client.js +192 -1
- package/dist/app/javascript/context_drop/icons.d.ts +2 -0
- package/dist/app/javascript/context_drop/icons.js +2 -0
- package/dist/app/javascript/context_drop/styles.d.ts +1 -1
- package/dist/app/javascript/context_drop/styles.js +181 -0
- package/dist/app/javascript/context_drop/types.d.ts +83 -6
- package/dist/app/javascript/context_drop/widget.d.ts +18 -0
- package/dist/app/javascript/context_drop/widget.js +550 -25
- package/dist/src/cli.js +1 -1
- package/dist/src/mcp/dispatcher.js +36 -10
- package/dist/src/next/index.d.ts +1 -1
- package/dist/src/react/index.d.ts +16 -2
- package/dist/src/react/index.js +21 -1
- package/dist/src/server/handler.d.ts +7 -1
- package/dist/src/server/handler.js +584 -81
- package/dist/src/server/storage/local.d.ts +1 -1
- package/dist/src/server/storage/local.js +261 -8
- package/dist/src/server/storage/memory.d.ts +4 -1
- package/dist/src/server/storage/memory.js +169 -3
- package/dist/src/server/storage/postgres.d.ts +1 -1
- package/dist/src/server/storage/postgres.js +189 -6
- package/dist/src/server/types.d.ts +38 -1
- package/dist/src/server/types.js +1 -1
- package/package.json +1 -1
|
@@ -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;
|
|
@@ -1899,6 +2024,42 @@ select:focus-visible {
|
|
|
1899
2024
|
border-top: 1px solid var(--cd-border);
|
|
1900
2025
|
}
|
|
1901
2026
|
|
|
2027
|
+
.cd-edit-banner {
|
|
2028
|
+
display: flex;
|
|
2029
|
+
align-items: center;
|
|
2030
|
+
justify-content: space-between;
|
|
2031
|
+
gap: 8px;
|
|
2032
|
+
padding: 6px 12px;
|
|
2033
|
+
background: var(--cd-accent-soft);
|
|
2034
|
+
border-bottom: 1px solid var(--cd-border-subtle);
|
|
2035
|
+
font-size: 12px;
|
|
2036
|
+
color: var(--cd-ink);
|
|
2037
|
+
}
|
|
2038
|
+
|
|
2039
|
+
.cd-edit-banner[hidden] {
|
|
2040
|
+
display: none !important;
|
|
2041
|
+
}
|
|
2042
|
+
|
|
2043
|
+
.cd-edit-banner-info {
|
|
2044
|
+
display: inline-flex;
|
|
2045
|
+
align-items: center;
|
|
2046
|
+
gap: 6px;
|
|
2047
|
+
min-width: 0;
|
|
2048
|
+
font-weight: 600;
|
|
2049
|
+
color: var(--cd-accent-hover);
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
.cd-edit-banner-info svg {
|
|
2053
|
+
color: var(--cd-accent-hover);
|
|
2054
|
+
flex-shrink: 0;
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
.cd-edit-banner-id {
|
|
2058
|
+
font-family: var(--cd-mono);
|
|
2059
|
+
font-size: 11px;
|
|
2060
|
+
font-variant-numeric: tabular-nums;
|
|
2061
|
+
}
|
|
2062
|
+
|
|
1902
2063
|
.cd-textarea {
|
|
1903
2064
|
width: 100%;
|
|
1904
2065
|
min-height: 68px;
|
|
@@ -1979,6 +2140,24 @@ select:focus-visible {
|
|
|
1979
2140
|
border-color: #252a34;
|
|
1980
2141
|
}
|
|
1981
2142
|
|
|
2143
|
+
.cd-btn-xs {
|
|
2144
|
+
padding: 3px 8px;
|
|
2145
|
+
font-size: 11.5px;
|
|
2146
|
+
border-radius: 6px;
|
|
2147
|
+
}
|
|
2148
|
+
|
|
2149
|
+
.cd-btn-danger {
|
|
2150
|
+
background: var(--cd-danger);
|
|
2151
|
+
border-color: var(--cd-danger);
|
|
2152
|
+
color: #ffffff;
|
|
2153
|
+
font-weight: 600;
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
.cd-btn-danger:hover:not(:disabled) {
|
|
2157
|
+
background: #991b1b;
|
|
2158
|
+
border-color: #991b1b;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
1982
2161
|
@media (max-width: 560px) {
|
|
1983
2162
|
.cd-composer,
|
|
1984
2163
|
.cd-compact-bar {
|
|
@@ -2006,6 +2185,8 @@ select:focus-visible {
|
|
|
2006
2185
|
.cd-corner-flap,
|
|
2007
2186
|
.cd-drag-pin-head,
|
|
2008
2187
|
.cd-composer,
|
|
2188
|
+
.cd-chat-msg,
|
|
2189
|
+
.cd-msg-action-btn,
|
|
2009
2190
|
.cd-agent-sidebar,
|
|
2010
2191
|
.cd-skeleton-bar {
|
|
2011
2192
|
animation: none !important;
|
|
@@ -45,6 +45,7 @@ export interface SmartComponentDescription {
|
|
|
45
45
|
}
|
|
46
46
|
export interface PendingAttachmentItem {
|
|
47
47
|
id: string;
|
|
48
|
+
existing_attachment_id?: number | string;
|
|
48
49
|
attachment_type: "image" | "screenshot";
|
|
49
50
|
label: string;
|
|
50
51
|
preview_url: string;
|
|
@@ -55,17 +56,30 @@ export interface PendingAttachmentItem {
|
|
|
55
56
|
element_reference_ref?: string;
|
|
56
57
|
metadata: Record<string, unknown>;
|
|
57
58
|
}
|
|
59
|
+
export interface SessionFeedbackAttachmentItem {
|
|
60
|
+
id: string;
|
|
61
|
+
server_id?: number | string;
|
|
62
|
+
label: string;
|
|
63
|
+
preview_url: string;
|
|
64
|
+
attachment_type: "image" | "screenshot";
|
|
65
|
+
filename?: string | null;
|
|
66
|
+
signed_blob_id?: string;
|
|
67
|
+
data_url?: string;
|
|
68
|
+
element_reference_ref?: string | null;
|
|
69
|
+
metadata?: Record<string, unknown>;
|
|
70
|
+
}
|
|
58
71
|
export interface SessionFeedbackEntry {
|
|
59
72
|
id: number | string;
|
|
60
73
|
message: string;
|
|
74
|
+
rawMessage?: string;
|
|
61
75
|
createdAt: string;
|
|
76
|
+
rawCreatedAt?: string;
|
|
77
|
+
rawUpdatedAt?: string;
|
|
78
|
+
isEdited?: boolean;
|
|
79
|
+
status?: string;
|
|
80
|
+
ownershipToken?: string;
|
|
62
81
|
elements: ElementReferenceSnapshot[];
|
|
63
|
-
attachments:
|
|
64
|
-
id: string;
|
|
65
|
-
label: string;
|
|
66
|
-
preview_url: string;
|
|
67
|
-
attachment_type: "image" | "screenshot";
|
|
68
|
-
}>;
|
|
82
|
+
attachments: SessionFeedbackAttachmentItem[];
|
|
69
83
|
}
|
|
70
84
|
export interface ContextDropApiClientOptions {
|
|
71
85
|
credentials?: RequestCredentials;
|
|
@@ -113,6 +127,66 @@ export interface FeedbackSubmissionPayload {
|
|
|
113
127
|
metadata: Record<string, unknown>;
|
|
114
128
|
}>;
|
|
115
129
|
}
|
|
130
|
+
export interface OwnFeedbackAttachment {
|
|
131
|
+
id: number | string;
|
|
132
|
+
attachment_type: "image" | "screenshot";
|
|
133
|
+
filename: string | null;
|
|
134
|
+
content_type?: string | null;
|
|
135
|
+
byte_size?: number | null;
|
|
136
|
+
element_reference_ref?: string | null;
|
|
137
|
+
metadata?: Record<string, unknown>;
|
|
138
|
+
created_at?: string;
|
|
139
|
+
}
|
|
140
|
+
export interface OwnFeedbackRecord {
|
|
141
|
+
id: number;
|
|
142
|
+
environment?: string;
|
|
143
|
+
message: string;
|
|
144
|
+
page_url?: string;
|
|
145
|
+
status: string;
|
|
146
|
+
metadata?: Record<string, unknown>;
|
|
147
|
+
attachments_count: number;
|
|
148
|
+
element_references_count: number;
|
|
149
|
+
element_references: ElementReferenceSnapshot[];
|
|
150
|
+
attachments: OwnFeedbackAttachment[];
|
|
151
|
+
created_at: string;
|
|
152
|
+
updated_at: string;
|
|
153
|
+
ownership_token?: string;
|
|
154
|
+
}
|
|
155
|
+
export interface OwnFeedbackListResponse {
|
|
156
|
+
total_count: number;
|
|
157
|
+
feedbacks: OwnFeedbackRecord[];
|
|
158
|
+
}
|
|
159
|
+
export interface FeedbackAttachmentUpdateInput {
|
|
160
|
+
existing_id?: number | string;
|
|
161
|
+
attachment_type?: "image" | "screenshot";
|
|
162
|
+
filename?: string;
|
|
163
|
+
signed_blob_id?: string;
|
|
164
|
+
data_url?: string;
|
|
165
|
+
element_reference_ref?: string;
|
|
166
|
+
metadata?: Record<string, unknown>;
|
|
167
|
+
}
|
|
168
|
+
export interface FeedbackUpdatePayload {
|
|
169
|
+
message: string;
|
|
170
|
+
metadata?: Record<string, unknown>;
|
|
171
|
+
element_references: ElementReferenceSnapshot[];
|
|
172
|
+
attachments: FeedbackAttachmentUpdateInput[];
|
|
173
|
+
}
|
|
174
|
+
export interface FeedbackUpdateResponse {
|
|
175
|
+
id: number;
|
|
176
|
+
environment?: string;
|
|
177
|
+
status: string;
|
|
178
|
+
attachments_count: number;
|
|
179
|
+
element_references_count: number;
|
|
180
|
+
created_at: string;
|
|
181
|
+
updated_at: string;
|
|
182
|
+
ownership_token?: string;
|
|
183
|
+
feedback?: OwnFeedbackRecord;
|
|
184
|
+
}
|
|
185
|
+
export interface FeedbackDeleteResponse {
|
|
186
|
+
id: number;
|
|
187
|
+
deleted: boolean;
|
|
188
|
+
deleted_at: string;
|
|
189
|
+
}
|
|
116
190
|
export interface FeedbackSubmissionResponse {
|
|
117
191
|
id: number;
|
|
118
192
|
environment?: string;
|
|
@@ -120,6 +194,9 @@ export interface FeedbackSubmissionResponse {
|
|
|
120
194
|
attachments_count: number;
|
|
121
195
|
element_references_count: number;
|
|
122
196
|
created_at: string;
|
|
197
|
+
updated_at?: string;
|
|
198
|
+
ownership_token?: string;
|
|
199
|
+
feedback?: OwnFeedbackRecord;
|
|
123
200
|
}
|
|
124
201
|
export interface AgentProviderInfo {
|
|
125
202
|
id: string;
|
|
@@ -28,6 +28,12 @@ export declare class ContextDropWidgetElement extends BaseHTMLElement {
|
|
|
28
28
|
private elementDomNodes;
|
|
29
29
|
private attachments;
|
|
30
30
|
private sessionHistory;
|
|
31
|
+
private ownFeedbacksLoaded;
|
|
32
|
+
private inFlightOwnFeedbacksPromise;
|
|
33
|
+
private editingFeedbackId;
|
|
34
|
+
private confirmingDeleteId;
|
|
35
|
+
private deletingFeedbackId;
|
|
36
|
+
private stashedDraftBeforeEdit;
|
|
31
37
|
private agentStatusLoaded;
|
|
32
38
|
private agentWorkspaceName;
|
|
33
39
|
private agentMcpEnvironments;
|
|
@@ -63,6 +69,8 @@ export declare class ContextDropWidgetElement extends BaseHTMLElement {
|
|
|
63
69
|
private composerToolbarScreenshotBtn;
|
|
64
70
|
private composerToolbarUploadBtn;
|
|
65
71
|
private chatThreadEl;
|
|
72
|
+
private editBannerEl;
|
|
73
|
+
private editBannerInfoEl;
|
|
66
74
|
private textareaEl;
|
|
67
75
|
private trayEl;
|
|
68
76
|
private statusEl;
|
|
@@ -112,6 +120,16 @@ export declare class ContextDropWidgetElement extends BaseHTMLElement {
|
|
|
112
120
|
getElementReferences(): ElementReferenceSnapshot[];
|
|
113
121
|
getAttachments(): PendingAttachmentItem[];
|
|
114
122
|
getSessionHistory(): SessionFeedbackEntry[];
|
|
123
|
+
getEditingFeedbackId(): string | null;
|
|
124
|
+
private formatTimestampLabel;
|
|
125
|
+
private mapOwnRecordToSessionEntry;
|
|
126
|
+
refreshOwnFeedbacks(): Promise<SessionFeedbackEntry[]>;
|
|
127
|
+
private ensureOwnFeedbacksLoaded;
|
|
128
|
+
startEditingFeedback(feedbackId: number | string): boolean;
|
|
129
|
+
cancelEditingFeedback(): void;
|
|
130
|
+
requestDeleteFeedback(feedbackId: number | string): void;
|
|
131
|
+
cancelDeleteFeedback(): void;
|
|
132
|
+
confirmDeleteFeedback(feedbackId: number | string): Promise<void>;
|
|
115
133
|
getAgentMessages(): AgentChatMessage[];
|
|
116
134
|
isAgentModeActive(): boolean;
|
|
117
135
|
isSmartSelectionMode(): boolean;
|