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
|
@@ -8,23 +8,37 @@ module ContextDrop
|
|
|
8
8
|
|
|
9
9
|
belongs_to :submitter, polymorphic: true, optional: true
|
|
10
10
|
|
|
11
|
-
has_many :
|
|
12
|
-
class_name: "ContextDrop::
|
|
11
|
+
has_many :element_references,
|
|
12
|
+
class_name: "ContextDrop::ElementReference",
|
|
13
13
|
foreign_key: :feedback_id,
|
|
14
14
|
inverse_of: :feedback,
|
|
15
15
|
dependent: :destroy
|
|
16
16
|
|
|
17
|
-
has_many :
|
|
18
|
-
class_name: "ContextDrop::
|
|
17
|
+
has_many :attachments,
|
|
18
|
+
class_name: "ContextDrop::Attachment",
|
|
19
19
|
foreign_key: :feedback_id,
|
|
20
20
|
inverse_of: :feedback,
|
|
21
21
|
dependent: :destroy
|
|
22
22
|
|
|
23
|
-
scope :
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
scope :
|
|
23
|
+
scope :active, lambda {
|
|
24
|
+
column_names.include?("deleted_at") ? where(deleted_at: nil) : all
|
|
25
|
+
}
|
|
26
|
+
scope :deleted, lambda {
|
|
27
|
+
column_names.include?("deleted_at") ? where.not(deleted_at: nil) : none
|
|
28
|
+
}
|
|
29
|
+
scope :new_records, -> { active.where(status: "new") }
|
|
30
|
+
scope :reviewed, -> { active.where(status: "reviewed") }
|
|
31
|
+
scope :resolved, -> { active.where(status: "resolved") }
|
|
32
|
+
scope :dismissed, -> { active.where(status: "dismissed") }
|
|
27
33
|
scope :recent, -> { order(created_at: :desc, id: :desc) }
|
|
34
|
+
scope :for_environment, lambda { |env|
|
|
35
|
+
normalized = env.to_s.strip.downcase
|
|
36
|
+
if normalized.present? && column_names.include?("environment")
|
|
37
|
+
where(environment: normalized)
|
|
38
|
+
else
|
|
39
|
+
all
|
|
40
|
+
end
|
|
41
|
+
}
|
|
28
42
|
|
|
29
43
|
validates :page_url, presence: true
|
|
30
44
|
validates :status, presence: true, inclusion: { in: STATUSES }
|
|
@@ -45,6 +59,67 @@ module ContextDrop
|
|
|
45
59
|
update!(status: "dismissed")
|
|
46
60
|
end
|
|
47
61
|
|
|
62
|
+
def deleted?
|
|
63
|
+
if has_attribute?(:deleted_at)
|
|
64
|
+
!self[:deleted_at].nil?
|
|
65
|
+
elsif metadata.is_a?(Hash)
|
|
66
|
+
metadata["deleted_at"].present?
|
|
67
|
+
else
|
|
68
|
+
false
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def deleted_at_value
|
|
73
|
+
if has_attribute?(:deleted_at)
|
|
74
|
+
self[:deleted_at]
|
|
75
|
+
elsif metadata.is_a?(Hash) && metadata["deleted_at"].present?
|
|
76
|
+
begin
|
|
77
|
+
Time.iso8601(metadata["deleted_at"].to_s)
|
|
78
|
+
rescue ArgumentError
|
|
79
|
+
nil
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def soft_delete!(timestamp = Time.current)
|
|
85
|
+
if has_attribute?(:deleted_at)
|
|
86
|
+
update_columns(deleted_at: timestamp, updated_at: timestamp)
|
|
87
|
+
self[:deleted_at] = timestamp
|
|
88
|
+
self[:updated_at] = timestamp
|
|
89
|
+
else
|
|
90
|
+
next_meta = (metadata.is_a?(Hash) ? metadata.dup : {}).merge("deleted_at" => timestamp.utc.iso8601)
|
|
91
|
+
update_columns(metadata: next_meta, updated_at: timestamp)
|
|
92
|
+
self[:metadata] = next_meta
|
|
93
|
+
self[:updated_at] = timestamp
|
|
94
|
+
end
|
|
95
|
+
true
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def restore!
|
|
99
|
+
now = Time.current
|
|
100
|
+
if has_attribute?(:deleted_at)
|
|
101
|
+
update_columns(deleted_at: nil, updated_at: now)
|
|
102
|
+
self[:deleted_at] = nil
|
|
103
|
+
self[:updated_at] = now
|
|
104
|
+
elsif metadata.is_a?(Hash)
|
|
105
|
+
next_meta = metadata.except("deleted_at")
|
|
106
|
+
update_columns(metadata: next_meta, updated_at: now)
|
|
107
|
+
self[:metadata] = next_meta
|
|
108
|
+
self[:updated_at] = now
|
|
109
|
+
end
|
|
110
|
+
true
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def environment_name
|
|
114
|
+
if has_attribute?(:environment) && self[:environment].present?
|
|
115
|
+
self[:environment].to_s
|
|
116
|
+
elsif metadata.is_a?(Hash) && metadata["environment"].present?
|
|
117
|
+
metadata["environment"].to_s
|
|
118
|
+
else
|
|
119
|
+
ContextDrop.config.resolved_environment
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
48
123
|
def submitter_label
|
|
49
124
|
return "Anonymous" if submitter_type.blank? && submitter_id.blank?
|
|
50
125
|
|
|
@@ -72,6 +147,11 @@ module ContextDrop
|
|
|
72
147
|
def normalize_defaults
|
|
73
148
|
self.status = "new" if status.blank?
|
|
74
149
|
self.metadata = {} unless metadata.is_a?(Hash)
|
|
150
|
+
resolved_env = ContextDrop.config.resolved_environment
|
|
151
|
+
if has_attribute?(:environment) && self[:environment].blank?
|
|
152
|
+
self[:environment] = resolved_env
|
|
153
|
+
end
|
|
154
|
+
self.metadata["environment"] ||= resolved_env
|
|
75
155
|
end
|
|
76
156
|
|
|
77
157
|
def ensure_content_or_context_present
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "openssl"
|
|
4
|
+
require "securerandom"
|
|
5
|
+
|
|
6
|
+
module ContextDrop
|
|
7
|
+
module OwnershipToken
|
|
8
|
+
MAX_TOKENS_HEADER_COUNT = 50
|
|
9
|
+
TOKEN_DOMAIN = "cd_own:v1"
|
|
10
|
+
|
|
11
|
+
class << self
|
|
12
|
+
def generate(feedback_id, secret: nil)
|
|
13
|
+
id_str = feedback_id.to_s.strip
|
|
14
|
+
raise ArgumentError, "feedback_id cannot be blank" if id_str.empty?
|
|
15
|
+
|
|
16
|
+
nonce = SecureRandom.hex(8)
|
|
17
|
+
sig = compute_hmac(id_str, nonce, secret || resolved_secret)
|
|
18
|
+
"#{id_str}.#{nonce}.#{sig}"
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def valid?(token, feedback_id, secret: nil)
|
|
22
|
+
return false if token.nil? || feedback_id.nil?
|
|
23
|
+
|
|
24
|
+
raw_token = token.to_s.strip
|
|
25
|
+
target_id = feedback_id.to_s.strip
|
|
26
|
+
return false if raw_token.empty? || target_id.empty?
|
|
27
|
+
|
|
28
|
+
id_part, nonce_part, sig_part = raw_token.split(".", 3)
|
|
29
|
+
return false if id_part.nil? || nonce_part.nil? || sig_part.nil?
|
|
30
|
+
return false unless id_part == target_id
|
|
31
|
+
return false if nonce_part.empty? || sig_part.empty?
|
|
32
|
+
|
|
33
|
+
expected = compute_hmac(target_id, nonce_part, secret || resolved_secret)
|
|
34
|
+
ActiveSupport::SecurityUtils.secure_compare(sig_part, expected)
|
|
35
|
+
rescue StandardError
|
|
36
|
+
false
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def extract_verified_ids(raw_tokens, secret: nil)
|
|
40
|
+
tokens = case raw_tokens
|
|
41
|
+
when Array
|
|
42
|
+
raw_tokens
|
|
43
|
+
when String
|
|
44
|
+
raw_tokens.split(",")
|
|
45
|
+
else
|
|
46
|
+
[]
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
key = secret || resolved_secret
|
|
50
|
+
verified = []
|
|
51
|
+
|
|
52
|
+
tokens.first(MAX_TOKENS_HEADER_COUNT).each do |raw|
|
|
53
|
+
tok = raw.to_s.strip
|
|
54
|
+
next if tok.empty?
|
|
55
|
+
|
|
56
|
+
id_part, nonce_part, sig_part = tok.split(".", 3)
|
|
57
|
+
next if id_part.nil? || nonce_part.nil? || sig_part.nil?
|
|
58
|
+
next if id_part.empty? || nonce_part.empty? || sig_part.empty?
|
|
59
|
+
|
|
60
|
+
expected = compute_hmac(id_part, nonce_part, key)
|
|
61
|
+
verified << id_part if ActiveSupport::SecurityUtils.secure_compare(sig_part, expected)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
verified.uniq
|
|
65
|
+
rescue StandardError
|
|
66
|
+
[]
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
def find_token_for(raw_tokens, feedback_id, secret: nil)
|
|
70
|
+
tokens = case raw_tokens
|
|
71
|
+
when Array
|
|
72
|
+
raw_tokens
|
|
73
|
+
when String
|
|
74
|
+
raw_tokens.split(",")
|
|
75
|
+
else
|
|
76
|
+
[]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
key = secret || resolved_secret
|
|
80
|
+
tokens.first(MAX_TOKENS_HEADER_COUNT).each do |raw|
|
|
81
|
+
tok = raw.to_s.strip
|
|
82
|
+
return tok if valid?(tok, feedback_id, secret: key)
|
|
83
|
+
end
|
|
84
|
+
nil
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def resolved_secret
|
|
88
|
+
configured = ContextDrop.config.respond_to?(:ownership_secret) ? ContextDrop.config.ownership_secret.to_s.strip : ""
|
|
89
|
+
return configured unless configured.empty?
|
|
90
|
+
|
|
91
|
+
env_secret = ENV["CONTEXT_DROP_SECRET_KEY"].to_s.strip
|
|
92
|
+
return env_secret unless env_secret.empty?
|
|
93
|
+
|
|
94
|
+
if defined?(Rails) && Rails.respond_to?(:application) && Rails.application
|
|
95
|
+
rails_secret = Rails.application.secret_key_base.to_s.strip rescue ""
|
|
96
|
+
return rails_secret unless rails_secret.empty?
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
fallback_secret
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
private
|
|
103
|
+
|
|
104
|
+
def compute_hmac(id_str, nonce, secret)
|
|
105
|
+
OpenSSL::HMAC.hexdigest("SHA256", secret.to_s, "#{TOKEN_DOMAIN}:#{id_str}:#{nonce}")
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def fallback_secret
|
|
109
|
+
@fallback_secret ||= SecureRandom.hex(32)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
<span class="cd-tab-count"><%= @status_counts[status_name] || 0 %></span>
|
|
12
12
|
</a>
|
|
13
13
|
<% end %>
|
|
14
|
+
<a href="<%= dashboard_feedbacks_path(status: 'deleted', q: @search_query.presence, page_url: @page_url_filter.presence) %>"
|
|
15
|
+
class="cd-tab <%= 'active' if @current_status == 'deleted' %>">
|
|
16
|
+
<span>Deleted</span>
|
|
17
|
+
<span class="cd-tab-count"><%= @status_counts["deleted"] || 0 %></span>
|
|
18
|
+
</a>
|
|
14
19
|
</div>
|
|
15
20
|
|
|
16
21
|
<div class="cd-card cd-card-tight">
|
|
@@ -80,12 +85,20 @@
|
|
|
80
85
|
</td>
|
|
81
86
|
<td>
|
|
82
87
|
<span class="cd-badge cd-badge-<%= fb.status %>"><%= fb.status %></span>
|
|
88
|
+
<% if fb.respond_to?(:deleted?) && fb.deleted? %>
|
|
89
|
+
<span class="cd-badge cd-badge-deleted" style="margin-top: 0.2rem;">deleted</span>
|
|
90
|
+
<% end %>
|
|
83
91
|
</td>
|
|
84
92
|
<td>
|
|
85
93
|
<div style="font-weight: 500; color: var(--cd-text); margin-bottom: 0.25rem; line-height: 1.4;">
|
|
86
94
|
<%= fb.message.present? ? truncate(fb.message, length: 120) : content_tag(:span, "(No text message)", style: "color: var(--cd-muted); font-style: italic;") %>
|
|
87
95
|
</div>
|
|
88
96
|
<div class="cd-context-chips">
|
|
97
|
+
<% if fb.respond_to?(:environment) && fb.environment.present? %>
|
|
98
|
+
<span class="cd-context-chip" style="font-family: var(--cd-font-mono);" title="Environment: <%= fb.environment %>">
|
|
99
|
+
<%= fb.environment %>
|
|
100
|
+
</span>
|
|
101
|
+
<% end %>
|
|
89
102
|
<% if fb.attachments.size > 0 %>
|
|
90
103
|
<span class="cd-context-chip" title="<%= fb.attachments.size %> attachment(s)">
|
|
91
104
|
<%= cd_icon_attachment(size: 11) %>
|
|
@@ -53,6 +53,9 @@
|
|
|
53
53
|
Feedback #<%= @feedback.id %>
|
|
54
54
|
</h1>
|
|
55
55
|
<span class="cd-badge cd-badge-<%= @feedback.status %>"><%= @feedback.status %></span>
|
|
56
|
+
<% if @feedback.respond_to?(:deleted?) && @feedback.deleted? %>
|
|
57
|
+
<span class="cd-badge cd-badge-deleted">deleted</span>
|
|
58
|
+
<% end %>
|
|
56
59
|
</div>
|
|
57
60
|
</div>
|
|
58
61
|
|
|
@@ -83,6 +86,8 @@
|
|
|
83
86
|
</div>
|
|
84
87
|
|
|
85
88
|
<dl class="cd-meta-list">
|
|
89
|
+
<dt>Environment</dt>
|
|
90
|
+
<dd><code class="cd-mono"><%= @feedback.respond_to?(:environment) && @feedback.environment.present? ? @feedback.environment : ContextDrop.configuration.resolved_environment %></code></dd>
|
|
86
91
|
<dt>Page URL</dt>
|
|
87
92
|
<dd>
|
|
88
93
|
<div style="display: inline-flex; align-items: center; gap: 0.35rem; max-width: 100%;">
|
|
@@ -107,6 +112,12 @@
|
|
|
107
112
|
<dd style="font-family: var(--cd-font-mono); font-variant-numeric: tabular-nums;">
|
|
108
113
|
<%= @feedback.created_at&.strftime("%Y-%m-%d %H:%M:%S UTC") %>
|
|
109
114
|
</dd>
|
|
115
|
+
<% if @feedback.respond_to?(:deleted?) && @feedback.deleted? %>
|
|
116
|
+
<dt>Deleted At</dt>
|
|
117
|
+
<dd style="font-family: var(--cd-font-mono); font-variant-numeric: tabular-nums; color: #b91c1c;">
|
|
118
|
+
<%= @feedback.deleted_at_value&.strftime("%Y-%m-%d %H:%M:%S UTC") %>
|
|
119
|
+
</dd>
|
|
120
|
+
<% end %>
|
|
110
121
|
<dt>User Agent</dt>
|
|
111
122
|
<dd style="font-size: 0.75rem; color: var(--cd-text-secondary);"><%= @feedback.user_agent.presence || "N/A" %></dd>
|
|
112
123
|
<dt>Metadata</dt>
|
|
@@ -141,8 +152,16 @@
|
|
|
141
152
|
<% end %>
|
|
142
153
|
</div>
|
|
143
154
|
<dl class="cd-meta-list" style="grid-template-columns: 110px 1fr; font-size: 0.75rem;">
|
|
155
|
+
<% if el.metadata.is_a?(Hash) && el.metadata["friendly_label"].present? %>
|
|
156
|
+
<dt>Component</dt>
|
|
157
|
+
<dd style="font-weight: 600; color: var(--cd-text);"><%= el.metadata["friendly_label"] %></dd>
|
|
158
|
+
<% end %>
|
|
144
159
|
<dt>Selector</dt>
|
|
145
160
|
<dd><code class="cd-mono" style="word-break: break-all;"><%= el.selector %></code></dd>
|
|
161
|
+
<% if el.metadata.is_a?(Hash) && el.metadata["original_target_selector"].present? %>
|
|
162
|
+
<dt>Inner Target</dt>
|
|
163
|
+
<dd><code class="cd-mono" style="word-break: break-all;"><%= el.metadata["original_target_selector"] %></code></dd>
|
|
164
|
+
<% end %>
|
|
146
165
|
<dt>DOM Path</dt>
|
|
147
166
|
<dd><code class="cd-mono" style="word-break: break-all;"><%= el.dom_path.presence || "N/A" %></code></dd>
|
|
148
167
|
<dt>Text Content</dt>
|
|
@@ -37,6 +37,10 @@
|
|
|
37
37
|
--cd-dismissed-bg: #f8fafc;
|
|
38
38
|
--cd-dismissed-border: #e2e8f0;
|
|
39
39
|
--cd-dismissed-text: #64748b;
|
|
40
|
+
|
|
41
|
+
--cd-deleted-bg: #fef2f2;
|
|
42
|
+
--cd-deleted-border: #fecaca;
|
|
43
|
+
--cd-deleted-text: #b91c1c;
|
|
40
44
|
}
|
|
41
45
|
* { box-sizing: border-box; }
|
|
42
46
|
body {
|
|
@@ -372,6 +376,7 @@
|
|
|
372
376
|
.cd-badge-reviewed { background: var(--cd-reviewed-bg); border-color: var(--cd-reviewed-border); color: var(--cd-reviewed-text); }
|
|
373
377
|
.cd-badge-resolved { background: var(--cd-resolved-bg); border-color: var(--cd-resolved-border); color: var(--cd-resolved-text); }
|
|
374
378
|
.cd-badge-dismissed { background: var(--cd-dismissed-bg); border-color: var(--cd-dismissed-border); color: var(--cd-dismissed-text); }
|
|
379
|
+
.cd-badge-deleted { background: var(--cd-deleted-bg); border-color: var(--cd-deleted-border); color: var(--cd-deleted-text); }
|
|
375
380
|
|
|
376
381
|
.cd-mono {
|
|
377
382
|
font-family: var(--cd-font-mono);
|
|
@@ -527,6 +532,7 @@
|
|
|
527
532
|
<a href="<%= dashboard_feedbacks_path %>" class="cd-brand-tag">
|
|
528
533
|
<span>ContextDrop</span>
|
|
529
534
|
<span class="cd-brand-pill">Triage</span>
|
|
535
|
+
<span class="cd-context-chip" style="font-family: var(--cd-font-mono); font-size: 0.6875rem;"><%= ContextDrop.configuration.resolved_environment %></span>
|
|
530
536
|
</a>
|
|
531
537
|
|
|
532
538
|
<% if content_for?(:cd_breadcrumbs) %>
|
data/config/routes.rb
CHANGED
|
@@ -1,13 +1,35 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
ContextDrop::Engine.routes.draw do
|
|
4
|
+
match "config", to: "configs#cors_preflight", via: :options
|
|
5
|
+
match "attachments", to: "configs#cors_preflight", via: :options
|
|
6
|
+
match "feedback", to: "configs#cors_preflight", via: :options
|
|
7
|
+
match "feedback/:id", to: "configs#cors_preflight", via: :options
|
|
8
|
+
match "feedback/:feedback_id/attachments/:id", to: "configs#cors_preflight", via: :options
|
|
9
|
+
match "health", to: "configs#cors_preflight", via: :options
|
|
10
|
+
|
|
4
11
|
get "config", to: "configs#show"
|
|
5
12
|
get "assets/context_drop.js", to: "configs#widget_bundle"
|
|
6
13
|
post "attachments", to: "attachments#create"
|
|
14
|
+
get "feedback", to: "feedbacks#index"
|
|
7
15
|
post "feedback", to: "feedbacks#create"
|
|
16
|
+
match "feedback/:id", to: "feedbacks#update", via: %i[patch put]
|
|
17
|
+
delete "feedback/:id", to: "feedbacks#destroy"
|
|
18
|
+
get "feedback/:feedback_id/attachments/:id", to: "feedbacks#attachment"
|
|
8
19
|
get "health", to: "health#show"
|
|
9
20
|
post "mcp", to: "mcp#create"
|
|
10
21
|
|
|
22
|
+
scope "agent" do
|
|
23
|
+
get "status", to: "agent#status"
|
|
24
|
+
get "feedbacks", to: "agent#feedbacks"
|
|
25
|
+
post "keys", to: "agent#save_keys"
|
|
26
|
+
delete "keys", to: "agent#destroy_keys"
|
|
27
|
+
post "chat", to: "agent#chat"
|
|
28
|
+
post "edits/:id/apply", to: "agent#apply_edit"
|
|
29
|
+
post "edits/:id/reject", to: "agent#reject_edit"
|
|
30
|
+
post "edits/:id/revert", to: "agent#revert_edit"
|
|
31
|
+
end
|
|
32
|
+
|
|
11
33
|
namespace :dashboard do
|
|
12
34
|
root to: "feedbacks#index"
|
|
13
35
|
resources :feedbacks, only: %i[index show update]
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddEnvironmentToContextDropFeedbacks < ActiveRecord::Migration[7.1]
|
|
4
|
+
def change
|
|
5
|
+
return if column_exists?(:context_drop_feedbacks, :environment)
|
|
6
|
+
|
|
7
|
+
add_column :context_drop_feedbacks, :environment, :string, null: false, default: "development"
|
|
8
|
+
add_index :context_drop_feedbacks, :environment
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
class AddDeletedAtToContextDropFeedbacks < ActiveRecord::Migration[7.1]
|
|
4
|
+
def change
|
|
5
|
+
return if column_exists?(:context_drop_feedbacks, :deleted_at)
|
|
6
|
+
|
|
7
|
+
add_column :context_drop_feedbacks, :deleted_at, :datetime, null: true
|
|
8
|
+
add_index :context_drop_feedbacks, :deleted_at
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|