context_drop 0.1.4 → 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.
- checksums.yaml +4 -4
- data/README.md +330 -116
- data/Rakefile +110 -1
- data/SPEC.md +74 -26
- data/app/assets/javascripts/context_drop/context_drop.js +6329 -682
- data/app/controllers/context_drop/agent_controller.rb +170 -0
- data/app/controllers/context_drop/application_controller.rb +52 -3
- data/app/controllers/context_drop/configs_controller.rb +12 -2
- data/app/controllers/context_drop/dashboard/feedbacks_controller.rb +15 -11
- data/app/controllers/context_drop/feedbacks_controller.rb +396 -20
- data/app/controllers/context_drop/mcp_controller.rb +2 -1
- data/app/helpers/context_drop/widget_helper.rb +11 -1
- data/app/javascript/context_drop/__tests__/api-client.test.ts +255 -0
- data/app/javascript/context_drop/__tests__/widget.test.ts +1015 -89
- data/app/javascript/context_drop/api-client.ts +422 -19
- data/app/javascript/context_drop/element-picker.ts +186 -34
- data/app/javascript/context_drop/icons.ts +28 -0
- data/app/javascript/context_drop/markdown.ts +146 -0
- data/app/javascript/context_drop/sanitizer.ts +413 -2
- data/app/javascript/context_drop/screenshot.ts +103 -9
- data/app/javascript/context_drop/styles.ts +1705 -248
- data/app/javascript/context_drop/types.ts +243 -6
- data/app/javascript/context_drop/widget.ts +3318 -294
- data/app/models/context_drop/feedback.rb +88 -8
- data/app/services/context_drop/ownership_token.rb +114 -0
- data/app/views/context_drop/dashboard/feedbacks/index.html.erb +13 -0
- data/app/views/context_drop/dashboard/feedbacks/show.html.erb +19 -0
- data/app/views/layouts/context_drop/application.html.erb +6 -0
- data/config/routes.rb +22 -0
- data/db/migrate/20261112000004_add_environment_to_context_drop_feedbacks.rb +10 -0
- data/db/migrate/20261113000005_add_deleted_at_to_context_drop_feedbacks.rb +11 -0
- data/lib/context_drop/agent/key_store.rb +290 -0
- data/lib/context_drop/agent/llm_client.rb +413 -0
- data/lib/context_drop/agent/orchestrator.rb +314 -0
- data/lib/context_drop/agent/workspace_sandbox.rb +499 -0
- data/lib/context_drop/configuration.rb +242 -3
- data/lib/context_drop/mcp/dispatcher.rb +71 -29
- data/lib/context_drop/mcp/environment_router.rb +115 -0
- data/lib/context_drop/mcp/prompts/investigate_feedback.rb +90 -9
- data/lib/context_drop/mcp/remote_client.rb +120 -0
- data/lib/context_drop/mcp/server.rb +9 -2
- data/lib/context_drop/mcp/tools/get_feedback.rb +62 -5
- data/lib/context_drop/mcp/tools/get_feedback_attachment.rb +29 -4
- data/lib/context_drop/mcp/tools/list_environments.rb +60 -0
- data/lib/context_drop/mcp/tools/list_feedbacks.rb +195 -23
- data/lib/context_drop/mcp/tools/update_feedback_status.rb +48 -5
- data/lib/context_drop/version.rb +1 -1
- data/lib/context_drop.rb +8 -2
- data/lib/generators/context_drop/install/templates/initializer.rb.tt +29 -2
- metadata +14 -2
|
@@ -9,10 +9,14 @@ module ContextDrop
|
|
|
9
9
|
|
|
10
10
|
DEFINITION = {
|
|
11
11
|
name: "list_feedbacks",
|
|
12
|
-
description: "List and search ContextDrop feedback submissions filtered
|
|
12
|
+
description: "List and search ContextDrop feedback submissions across all connected environments (or filtered to a specific environment, status, page_url, or query).",
|
|
13
13
|
inputSchema: {
|
|
14
14
|
type: "object",
|
|
15
15
|
properties: {
|
|
16
|
+
environment: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Target environment ('all', 'local', 'development', 'staging', 'production', etc.). Defaults to 'all' across local and configured remote environments."
|
|
19
|
+
},
|
|
16
20
|
status: {
|
|
17
21
|
type: "string",
|
|
18
22
|
enum: %w[new reviewed resolved dismissed],
|
|
@@ -33,6 +37,10 @@ module ContextDrop
|
|
|
33
37
|
offset: {
|
|
34
38
|
type: "integer",
|
|
35
39
|
description: "Pagination offset (default 0)."
|
|
40
|
+
},
|
|
41
|
+
include_deleted: {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
description: "When true, includes soft-deleted feedback records. Defaults to false."
|
|
36
44
|
}
|
|
37
45
|
}
|
|
38
46
|
}
|
|
@@ -40,17 +48,143 @@ module ContextDrop
|
|
|
40
48
|
|
|
41
49
|
def self.call(args = {})
|
|
42
50
|
params = stringify_keys(args)
|
|
43
|
-
scope = ContextDrop::Feedback.includes(:submitter, :element_references, :attachments).recent
|
|
44
51
|
|
|
45
52
|
status = params["status"].to_s.strip
|
|
46
|
-
if status.present?
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
if status.present? && !ContextDrop::Feedback::STATUSES.include?(status)
|
|
54
|
+
return error_result("Invalid status '#{status}'. Must be one of: #{ContextDrop::Feedback::STATUSES.join(', ')}")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
raw_limit = params["limit"] ? params["limit"].to_i : DEFAULT_LIMIT
|
|
58
|
+
limit = raw_limit.clamp(1, MAX_LIMIT)
|
|
59
|
+
offset = [params["offset"].to_i, 0].max
|
|
60
|
+
|
|
61
|
+
requested_env = params["environment"].to_s.strip.downcase
|
|
62
|
+
requested_env = "all" if requested_env.empty?
|
|
63
|
+
|
|
64
|
+
remotes = ContextDrop::MCP::EnvironmentRouter.remote_environments
|
|
65
|
+
host_env = ContextDrop::MCP::EnvironmentRouter.host_environment
|
|
66
|
+
|
|
67
|
+
if requested_env == "all"
|
|
68
|
+
return query_all_environments(params, status: status, limit: limit, offset: offset, remotes: remotes)
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
if requested_env == "local" || requested_env == host_env
|
|
72
|
+
filter_env = requested_env == "local" ? nil : host_env
|
|
73
|
+
local_res = query_local(params, status: status, limit: limit, offset: offset, env_filter: filter_env)
|
|
74
|
+
return success_json(
|
|
75
|
+
environment: host_env,
|
|
76
|
+
total: local_res[:total],
|
|
77
|
+
limit: limit,
|
|
78
|
+
offset: offset,
|
|
79
|
+
feedbacks: local_res[:records]
|
|
80
|
+
)
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
if remotes.key?(requested_env)
|
|
84
|
+
begin
|
|
85
|
+
remote_res = fetch_remote_list(requested_env, remotes[requested_env], params.merge("limit" => limit, "offset" => offset))
|
|
86
|
+
return success_json(
|
|
87
|
+
environment: requested_env,
|
|
88
|
+
total: remote_res[:total],
|
|
89
|
+
limit: limit,
|
|
90
|
+
offset: offset,
|
|
91
|
+
feedbacks: remote_res[:records]
|
|
92
|
+
)
|
|
93
|
+
rescue ContextDrop::MCP::RemoteClient::RemoteError => e
|
|
94
|
+
return error_result(e.message)
|
|
49
95
|
end
|
|
96
|
+
end
|
|
50
97
|
|
|
51
|
-
|
|
98
|
+
# Fallback: shared database containing records tagged with `requested_env`
|
|
99
|
+
if local_supports_environment_column?
|
|
100
|
+
local_res = query_local(params, status: status, limit: limit, offset: offset, env_filter: requested_env)
|
|
101
|
+
return success_json(
|
|
102
|
+
environment: requested_env,
|
|
103
|
+
total: local_res[:total],
|
|
104
|
+
limit: limit,
|
|
105
|
+
offset: offset,
|
|
106
|
+
feedbacks: local_res[:records]
|
|
107
|
+
)
|
|
52
108
|
end
|
|
53
109
|
|
|
110
|
+
known = ([host_env, "local", "all"] + remotes.keys).uniq
|
|
111
|
+
error_result("Unknown environment '#{requested_env}'. Available environments: #{known.join(', ')}")
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def self.query_all_environments(params, status:, limit:, offset:, remotes:)
|
|
115
|
+
fetch_window = (offset + limit).clamp(1, MAX_LIMIT)
|
|
116
|
+
local_res = query_local(params, status: status, limit: fetch_window, offset: 0, env_filter: nil)
|
|
117
|
+
|
|
118
|
+
if remotes.empty?
|
|
119
|
+
paged = local_res[:records].drop(offset).first(limit)
|
|
120
|
+
return success_json(
|
|
121
|
+
environment: ContextDrop::MCP::EnvironmentRouter.host_environment,
|
|
122
|
+
total: local_res[:total],
|
|
123
|
+
limit: limit,
|
|
124
|
+
offset: offset,
|
|
125
|
+
feedbacks: paged
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
remote_results = {}
|
|
130
|
+
warnings = []
|
|
131
|
+
mutex = Mutex.new
|
|
132
|
+
|
|
133
|
+
threads = remotes.map do |env_name, cfg|
|
|
134
|
+
Thread.new do
|
|
135
|
+
res = fetch_remote_list(env_name, cfg, params.merge("limit" => fetch_window, "offset" => 0))
|
|
136
|
+
mutex.synchronize { remote_results[env_name] = res }
|
|
137
|
+
rescue StandardError => e
|
|
138
|
+
mutex.synchronize { warnings << { environment: env_name, error: e.message } }
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
threads.each(&:join)
|
|
142
|
+
|
|
143
|
+
combined = local_res[:records].dup
|
|
144
|
+
total_count = local_res[:total].to_i
|
|
145
|
+
|
|
146
|
+
remote_results.each_value do |res|
|
|
147
|
+
combined.concat(res[:records])
|
|
148
|
+
total_count += res[:total].to_i
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
combined.sort_by! do |item|
|
|
152
|
+
ts = begin
|
|
153
|
+
Time.iso8601(item[:created_at].to_s).to_f
|
|
154
|
+
rescue StandardError
|
|
155
|
+
0.0
|
|
156
|
+
end
|
|
157
|
+
[-ts, -item[:id].to_i]
|
|
158
|
+
end
|
|
159
|
+
|
|
160
|
+
payload = {
|
|
161
|
+
environment: "all",
|
|
162
|
+
connected_environments: [ContextDrop::MCP::EnvironmentRouter.host_environment] + remotes.keys,
|
|
163
|
+
total: total_count,
|
|
164
|
+
limit: limit,
|
|
165
|
+
offset: offset,
|
|
166
|
+
feedbacks: combined.drop(offset).first(limit)
|
|
167
|
+
}
|
|
168
|
+
payload[:warnings] = warnings unless warnings.empty?
|
|
169
|
+
|
|
170
|
+
success_json(payload)
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def self.query_local(params, status:, limit:, offset:, env_filter: nil)
|
|
174
|
+
include_deleted = truthy?(params["include_deleted"])
|
|
175
|
+
base = if !include_deleted && ContextDrop::Feedback.respond_to?(:active)
|
|
176
|
+
ContextDrop::Feedback.active
|
|
177
|
+
else
|
|
178
|
+
ContextDrop::Feedback
|
|
179
|
+
end
|
|
180
|
+
scope = base.includes(:submitter, :element_references, :attachments).recent
|
|
181
|
+
|
|
182
|
+
if env_filter.present? && local_supports_environment_column?
|
|
183
|
+
scope = scope.where(environment: env_filter)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
scope = scope.where(status: status) if status.present?
|
|
187
|
+
|
|
54
188
|
page_url = params["page_url"].to_s.strip
|
|
55
189
|
if page_url.present?
|
|
56
190
|
scope = scope.where("context_drop_feedbacks.page_url LIKE ?", "%#{escape_like(page_url)}%")
|
|
@@ -68,32 +202,47 @@ module ContextDrop
|
|
|
68
202
|
).distinct
|
|
69
203
|
end
|
|
70
204
|
|
|
71
|
-
raw_limit = params["limit"] ? params["limit"].to_i : DEFAULT_LIMIT
|
|
72
|
-
limit = raw_limit.clamp(1, MAX_LIMIT)
|
|
73
|
-
offset = [params["offset"].to_i, 0].max
|
|
74
|
-
|
|
75
205
|
total_count = scope.count
|
|
76
206
|
records = scope.limit(limit).offset(offset).map { |fb| serialize_summary(fb) }
|
|
207
|
+
{ total: total_count, records: records }
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
def self.fetch_remote_list(env_name, env_config, params)
|
|
211
|
+
remote_args = {}
|
|
212
|
+
%w[status page_url query limit offset].each do |key|
|
|
213
|
+
remote_args[key] = params[key] if params.key?(key) && !params[key].nil? && params[key].to_s != ""
|
|
214
|
+
end
|
|
215
|
+
remote_args["include_deleted"] = true if truthy?(params["include_deleted"])
|
|
216
|
+
|
|
217
|
+
tool_res = ContextDrop::MCP::RemoteClient.call_tool(env_name, env_config, "list_feedbacks", remote_args)
|
|
218
|
+
text_block = Array(tool_res[:content]).find { |b| b.is_a?(Hash) && b[:type].to_s == "text" }
|
|
219
|
+
parsed = text_block ? JSON.parse(text_block[:text].to_s) : {}
|
|
220
|
+
|
|
221
|
+
if tool_res[:isError]
|
|
222
|
+
raise ContextDrop::MCP::RemoteClient::RemoteError, parsed["error"] || "Remote list_feedbacks failed on '#{env_name}'"
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
items = Array(parsed["feedbacks"]).map do |item|
|
|
226
|
+
sym_item = item.is_a?(Hash) ? item.transform_keys(&:to_sym) : {}
|
|
227
|
+
rec_id = sym_item[:id]
|
|
228
|
+
sym_item.merge(
|
|
229
|
+
environment: env_name,
|
|
230
|
+
qualified_id: ContextDrop::MCP::EnvironmentRouter.qualify_id(env_name, rec_id)
|
|
231
|
+
)
|
|
232
|
+
end
|
|
77
233
|
|
|
78
234
|
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
type: "text",
|
|
82
|
-
text: JSON.pretty_generate(
|
|
83
|
-
total: total_count,
|
|
84
|
-
limit: limit,
|
|
85
|
-
offset: offset,
|
|
86
|
-
feedbacks: records
|
|
87
|
-
)
|
|
88
|
-
}
|
|
89
|
-
],
|
|
90
|
-
isError: false
|
|
235
|
+
total: parsed["total"].to_i,
|
|
236
|
+
records: items
|
|
91
237
|
}
|
|
92
238
|
end
|
|
93
239
|
|
|
94
240
|
def self.serialize_summary(feedback)
|
|
95
|
-
|
|
241
|
+
env_name = ContextDrop::MCP::EnvironmentRouter.record_environment(feedback)
|
|
242
|
+
summary = {
|
|
96
243
|
id: feedback.id,
|
|
244
|
+
qualified_id: ContextDrop::MCP::EnvironmentRouter.qualify_id(env_name, feedback.id),
|
|
245
|
+
environment: env_name,
|
|
97
246
|
status: feedback.status,
|
|
98
247
|
message: feedback.message,
|
|
99
248
|
page_url: feedback.page_url,
|
|
@@ -103,6 +252,29 @@ module ContextDrop
|
|
|
103
252
|
element_selectors: feedback.element_references.map(&:selector),
|
|
104
253
|
created_at: feedback.created_at&.iso8601
|
|
105
254
|
}
|
|
255
|
+
if feedback.respond_to?(:deleted?) && feedback.deleted?
|
|
256
|
+
summary[:deleted] = true
|
|
257
|
+
summary[:deleted_at] = feedback.respond_to?(:deleted_at_value) ? feedback.deleted_at_value&.iso8601 : nil
|
|
258
|
+
end
|
|
259
|
+
summary
|
|
260
|
+
end
|
|
261
|
+
|
|
262
|
+
def self.truthy?(val)
|
|
263
|
+
val == true || %w[true 1 yes].include?(val.to_s.strip.downcase)
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def self.local_supports_environment_column?
|
|
267
|
+
ContextDrop::Feedback.respond_to?(:column_names) &&
|
|
268
|
+
Array(ContextDrop::Feedback.column_names).map(&:to_s).include?("environment")
|
|
269
|
+
rescue StandardError
|
|
270
|
+
false
|
|
271
|
+
end
|
|
272
|
+
|
|
273
|
+
def self.success_json(payload)
|
|
274
|
+
{
|
|
275
|
+
content: [{ type: "text", text: JSON.pretty_generate(payload) }],
|
|
276
|
+
isError: false
|
|
277
|
+
}
|
|
106
278
|
end
|
|
107
279
|
|
|
108
280
|
def self.error_result(msg)
|
|
@@ -6,14 +6,18 @@ module ContextDrop
|
|
|
6
6
|
class UpdateFeedbackStatus
|
|
7
7
|
DEFINITION = {
|
|
8
8
|
name: "update_feedback_status",
|
|
9
|
-
description: "Transition a ContextDrop feedback record's status ('new', 'reviewed', 'resolved', 'dismissed').",
|
|
9
|
+
description: "Transition a ContextDrop feedback record's status ('new', 'reviewed', 'resolved', 'dismissed') in local or remote environments.",
|
|
10
10
|
inputSchema: {
|
|
11
11
|
type: "object",
|
|
12
12
|
required: %w[id status],
|
|
13
13
|
properties: {
|
|
14
14
|
id: {
|
|
15
15
|
type: %w[integer string],
|
|
16
|
-
description: "The ID of the ContextDrop::Feedback record."
|
|
16
|
+
description: "The ID of the ContextDrop::Feedback record, or a qualified '<environment>:<id>' string (e.g. 'staging:42')."
|
|
17
|
+
},
|
|
18
|
+
environment: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Optional environment name ('local', 'staging', 'production', etc.)."
|
|
17
21
|
},
|
|
18
22
|
status: {
|
|
19
23
|
type: "string",
|
|
@@ -26,10 +30,10 @@ module ContextDrop
|
|
|
26
30
|
|
|
27
31
|
def self.call(args = {})
|
|
28
32
|
params = args.is_a?(Hash) ? args.transform_keys(&:to_s) : {}
|
|
29
|
-
|
|
33
|
+
raw_id = params["id"] || params["feedback_id"]
|
|
30
34
|
next_status = params["status"].to_s.strip
|
|
31
35
|
|
|
32
|
-
return error_result("Missing required parameter: id") if
|
|
36
|
+
return error_result("Missing required parameter: id") if raw_id.nil? || raw_id.to_s.strip.empty?
|
|
33
37
|
|
|
34
38
|
unless ContextDrop::Feedback::STATUSES.include?(next_status)
|
|
35
39
|
return error_result(
|
|
@@ -37,11 +41,48 @@ module ContextDrop
|
|
|
37
41
|
)
|
|
38
42
|
end
|
|
39
43
|
|
|
44
|
+
target_env, feedback_id = ContextDrop::MCP::EnvironmentRouter.parse_target(raw_id, params["environment"])
|
|
45
|
+
|
|
46
|
+
unless ContextDrop::MCP::EnvironmentRouter.local_target?(target_env)
|
|
47
|
+
remote_cfg = ContextDrop::MCP::EnvironmentRouter.remote_config_for(target_env)
|
|
48
|
+
return error_result("Unknown remote environment '#{target_env}'") unless remote_cfg
|
|
49
|
+
|
|
50
|
+
begin
|
|
51
|
+
res = ContextDrop::MCP::RemoteClient.call_tool(target_env, remote_cfg, "update_feedback_status", {
|
|
52
|
+
"id" => feedback_id,
|
|
53
|
+
"status" => next_status
|
|
54
|
+
})
|
|
55
|
+
return res if res[:isError]
|
|
56
|
+
|
|
57
|
+
updated_blocks = Array(res[:content]).map do |block|
|
|
58
|
+
if block.is_a?(Hash) && block[:type].to_s == "text"
|
|
59
|
+
begin
|
|
60
|
+
parsed = JSON.parse(block[:text].to_s)
|
|
61
|
+
if parsed.is_a?(Hash)
|
|
62
|
+
parsed["environment"] = target_env
|
|
63
|
+
parsed["qualified_id"] = ContextDrop::MCP::EnvironmentRouter.qualify_id(target_env, parsed["id"] || feedback_id)
|
|
64
|
+
next block.merge(text: JSON.pretty_generate(parsed))
|
|
65
|
+
end
|
|
66
|
+
rescue JSON::ParserError
|
|
67
|
+
# Keep original block
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
block
|
|
71
|
+
end
|
|
72
|
+
return { content: updated_blocks, isError: false }
|
|
73
|
+
rescue ContextDrop::MCP::RemoteClient::RemoteError => e
|
|
74
|
+
return error_result(e.message)
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
|
|
40
78
|
feedback = ContextDrop::Feedback.find_by(id: feedback_id)
|
|
41
|
-
|
|
79
|
+
if !feedback || (feedback.respond_to?(:deleted?) && feedback.deleted?)
|
|
80
|
+
return error_result("Feedback ##{feedback_id} not found")
|
|
81
|
+
end
|
|
42
82
|
|
|
43
83
|
previous_status = feedback.status
|
|
44
84
|
feedback.update!(status: next_status)
|
|
85
|
+
env_name = ContextDrop::MCP::EnvironmentRouter.record_environment(feedback)
|
|
45
86
|
|
|
46
87
|
{
|
|
47
88
|
content: [
|
|
@@ -49,6 +90,8 @@ module ContextDrop
|
|
|
49
90
|
type: "text",
|
|
50
91
|
text: JSON.pretty_generate(
|
|
51
92
|
id: feedback.id,
|
|
93
|
+
qualified_id: ContextDrop::MCP::EnvironmentRouter.qualify_id(env_name, feedback.id),
|
|
94
|
+
environment: env_name,
|
|
52
95
|
previous_status: previous_status,
|
|
53
96
|
status: feedback.status,
|
|
54
97
|
page_url: feedback.page_url,
|
data/lib/context_drop/version.rb
CHANGED
data/lib/context_drop.rb
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
module ContextDrop
|
|
4
|
+
class Error < StandardError; end
|
|
5
|
+
end
|
|
6
|
+
|
|
3
7
|
require_relative "context_drop/version"
|
|
4
8
|
require_relative "context_drop/base64_util"
|
|
5
9
|
require_relative "context_drop/configuration"
|
|
6
10
|
require_relative "context_drop/mcp/server"
|
|
11
|
+
require_relative "context_drop/agent/key_store"
|
|
12
|
+
require_relative "context_drop/agent/workspace_sandbox"
|
|
13
|
+
require_relative "context_drop/agent/llm_client"
|
|
14
|
+
require_relative "context_drop/agent/orchestrator"
|
|
7
15
|
require_relative "context_drop/engine" if defined?(Rails::Engine)
|
|
8
16
|
|
|
9
17
|
module ContextDrop
|
|
10
|
-
class Error < StandardError; end
|
|
11
|
-
|
|
12
18
|
class << self
|
|
13
19
|
def config
|
|
14
20
|
@config ||= Configuration.new
|
|
@@ -4,7 +4,10 @@ ContextDrop.configure do |config|
|
|
|
4
4
|
# Environment-based master switch (disables widget, dashboard, and ingestion endpoints when false)
|
|
5
5
|
config.enabled = ENV.fetch("CONTEXT_DROP_ENABLED", "false") == "true"
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Host environment attribution (defaults automatically to Rails.env)
|
|
8
|
+
# config.environment = Rails.env
|
|
9
|
+
|
|
10
|
+
# Initial book-corner launcher position: :bottom_right, :bottom_left, :top_right, :top_left
|
|
8
11
|
config.position = :bottom_right
|
|
9
12
|
|
|
10
13
|
# Attachment storage backend
|
|
@@ -22,9 +25,19 @@ ContextDrop.configure do |config|
|
|
|
22
25
|
config.max_image_dimensions = [4096, 4096]
|
|
23
26
|
|
|
24
27
|
# Widget feature flags
|
|
28
|
+
# selection_mode: :auto uses zero-jargon Smart Component Selection + surrounding-context auto-screenshot
|
|
29
|
+
# in `production`, and Verbose CSS Selector & Layer Scrubbing (`v0.1.x` style) in `development` / `staging`.
|
|
25
30
|
config.element_selection = true
|
|
31
|
+
config.selection_mode = :auto # :auto | :smart | :verbose
|
|
26
32
|
config.screenshot_capture = true
|
|
27
33
|
config.element_capture_padding = 16
|
|
34
|
+
config.smart_capture_padding = 84
|
|
35
|
+
|
|
36
|
+
# Local development BYOK Agentic Sidebar (strictly active only in `development` on 127.0.0.1 / ::1)
|
|
37
|
+
# In v0.2.0, local development defaults to staging/verbose mode so developers can test bug pinning
|
|
38
|
+
# and use their preferred IDE coding agents (Antigravity, Cursor, Claude Code, etc.) via MCP.
|
|
39
|
+
# Set to true to opt into the experimental embedded in-browser agent sidebar:
|
|
40
|
+
config.enable_local_agent = ENV.fetch("CONTEXT_DROP_LOCAL_AGENT_ENABLED", "false") == "true"
|
|
28
41
|
|
|
29
42
|
# DOM selectors excluded from selection and redacted in screenshots
|
|
30
43
|
config.excluded_selectors = [
|
|
@@ -48,8 +61,22 @@ ContextDrop.configure do |config|
|
|
|
48
61
|
# Optional lifecycle callback invoked after feedback creation
|
|
49
62
|
config.on_feedback_created = ->(feedback) {}
|
|
50
63
|
|
|
51
|
-
# Model Context Protocol (MCP) server settings
|
|
64
|
+
# Unified Model Context Protocol (MCP) server settings
|
|
65
|
+
# Remote HTTP `/mcp` endpoint switch & Bearer key (for staging/production instances):
|
|
52
66
|
config.mcp_enabled = ENV.fetch("CONTEXT_DROP_MCP_ENABLED", "false") == "true"
|
|
53
67
|
config.mcp_api_key = ENV["CONTEXT_DROP_MCP_API_KEY"]
|
|
54
68
|
config.authorize_mcp = nil
|
|
69
|
+
|
|
70
|
+
# Federated remote environments queried by your single local `bin/rails context_drop:mcp` server
|
|
71
|
+
# (also auto-discovers CONTEXT_DROP_<ENV>_MCP_URL + CONTEXT_DROP_<ENV>_MCP_API_KEY env variables):
|
|
72
|
+
config.mcp_environments = {
|
|
73
|
+
staging: {
|
|
74
|
+
url: ENV["CONTEXT_DROP_STAGING_MCP_URL"],
|
|
75
|
+
api_key: ENV["CONTEXT_DROP_STAGING_MCP_API_KEY"]
|
|
76
|
+
},
|
|
77
|
+
production: {
|
|
78
|
+
url: ENV["CONTEXT_DROP_PRODUCTION_MCP_URL"],
|
|
79
|
+
api_key: ENV["CONTEXT_DROP_PRODUCTION_MCP_API_KEY"]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
55
82
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: context_drop
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kemal Elmizan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: actionpack
|
|
@@ -168,6 +168,7 @@ files:
|
|
|
168
168
|
- SPEC.md
|
|
169
169
|
- app/assets/javascripts/context_drop/context_drop.js
|
|
170
170
|
- app/assets/stylesheets/context_drop/application.css
|
|
171
|
+
- app/controllers/context_drop/agent_controller.rb
|
|
171
172
|
- app/controllers/context_drop/application_controller.rb
|
|
172
173
|
- app/controllers/context_drop/attachments_controller.rb
|
|
173
174
|
- app/controllers/context_drop/configs_controller.rb
|
|
@@ -183,6 +184,7 @@ files:
|
|
|
183
184
|
- app/javascript/context_drop/element-picker.ts
|
|
184
185
|
- app/javascript/context_drop/icons.ts
|
|
185
186
|
- app/javascript/context_drop/index.ts
|
|
187
|
+
- app/javascript/context_drop/markdown.ts
|
|
186
188
|
- app/javascript/context_drop/sanitizer.ts
|
|
187
189
|
- app/javascript/context_drop/screenshot.ts
|
|
188
190
|
- app/javascript/context_drop/styles.ts
|
|
@@ -193,6 +195,7 @@ files:
|
|
|
193
195
|
- app/models/context_drop/element_reference.rb
|
|
194
196
|
- app/models/context_drop/feedback.rb
|
|
195
197
|
- app/services/context_drop/metadata_sanitizer.rb
|
|
198
|
+
- app/services/context_drop/ownership_token.rb
|
|
196
199
|
- app/services/context_drop/upload_validator.rb
|
|
197
200
|
- app/views/context_drop/dashboard/feedbacks/index.html.erb
|
|
198
201
|
- app/views/context_drop/dashboard/feedbacks/show.html.erb
|
|
@@ -201,16 +204,25 @@ files:
|
|
|
201
204
|
- db/migrate/20261109000001_create_context_drop_feedbacks.rb
|
|
202
205
|
- db/migrate/20261109000002_create_context_drop_element_references.rb
|
|
203
206
|
- db/migrate/20261109000003_create_context_drop_attachments.rb
|
|
207
|
+
- db/migrate/20261112000004_add_environment_to_context_drop_feedbacks.rb
|
|
208
|
+
- db/migrate/20261113000005_add_deleted_at_to_context_drop_feedbacks.rb
|
|
204
209
|
- lib/context_drop.rb
|
|
210
|
+
- lib/context_drop/agent/key_store.rb
|
|
211
|
+
- lib/context_drop/agent/llm_client.rb
|
|
212
|
+
- lib/context_drop/agent/orchestrator.rb
|
|
213
|
+
- lib/context_drop/agent/workspace_sandbox.rb
|
|
205
214
|
- lib/context_drop/base64_util.rb
|
|
206
215
|
- lib/context_drop/configuration.rb
|
|
207
216
|
- lib/context_drop/engine.rb
|
|
208
217
|
- lib/context_drop/mcp/dispatcher.rb
|
|
218
|
+
- lib/context_drop/mcp/environment_router.rb
|
|
209
219
|
- lib/context_drop/mcp/prompts/investigate_feedback.rb
|
|
220
|
+
- lib/context_drop/mcp/remote_client.rb
|
|
210
221
|
- lib/context_drop/mcp/server.rb
|
|
211
222
|
- lib/context_drop/mcp/stdio_runner.rb
|
|
212
223
|
- lib/context_drop/mcp/tools/get_feedback.rb
|
|
213
224
|
- lib/context_drop/mcp/tools/get_feedback_attachment.rb
|
|
225
|
+
- lib/context_drop/mcp/tools/list_environments.rb
|
|
214
226
|
- lib/context_drop/mcp/tools/list_feedbacks.rb
|
|
215
227
|
- lib/context_drop/mcp/tools/update_feedback_status.rb
|
|
216
228
|
- lib/context_drop/version.rb
|