ruby_llm-agents 0.3.3 → 0.3.5
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 +132 -1263
- data/app/controllers/concerns/ruby_llm/agents/filterable.rb +5 -1
- data/app/controllers/concerns/ruby_llm/agents/paginatable.rb +2 -1
- data/app/controllers/ruby_llm/agents/agents_controller.rb +21 -2
- data/app/controllers/ruby_llm/agents/dashboard_controller.rb +137 -9
- data/app/controllers/ruby_llm/agents/executions_controller.rb +83 -5
- data/app/models/ruby_llm/agents/execution/analytics.rb +103 -12
- data/app/models/ruby_llm/agents/execution/scopes.rb +25 -0
- data/app/models/ruby_llm/agents/execution/workflow.rb +299 -0
- data/app/models/ruby_llm/agents/execution.rb +28 -59
- data/app/models/ruby_llm/agents/tenant_budget.rb +165 -0
- data/app/services/ruby_llm/agents/agent_registry.rb +118 -7
- data/app/views/layouts/ruby_llm/agents/application.html.erb +430 -0
- data/app/views/ruby_llm/agents/agents/_empty_state.html.erb +23 -0
- data/app/views/ruby_llm/agents/agents/_workflow.html.erb +125 -0
- data/app/views/ruby_llm/agents/agents/index.html.erb +93 -0
- data/app/views/ruby_llm/agents/agents/show.html.erb +775 -0
- data/app/views/ruby_llm/agents/dashboard/_agent_comparison.html.erb +112 -0
- data/app/views/ruby_llm/agents/dashboard/_budgets_bar.html.erb +75 -0
- data/app/views/{rubyllm → ruby_llm}/agents/dashboard/_execution_item.html.erb +7 -4
- data/app/views/ruby_llm/agents/dashboard/_now_strip.html.erb +84 -0
- data/app/views/ruby_llm/agents/dashboard/_tenant_budget.html.erb +115 -0
- data/app/views/ruby_llm/agents/dashboard/_top_errors.html.erb +49 -0
- data/app/views/ruby_llm/agents/dashboard/index.html.erb +155 -0
- data/app/views/{rubyllm → ruby_llm}/agents/executions/_execution.html.erb +1 -1
- data/app/views/{rubyllm → ruby_llm}/agents/executions/_filters.html.erb +39 -11
- data/app/views/{rubyllm → ruby_llm}/agents/executions/_list.html.erb +19 -9
- data/app/views/ruby_llm/agents/executions/_workflow_summary.html.erb +101 -0
- data/app/views/ruby_llm/agents/executions/index.html.erb +88 -0
- data/app/views/{rubyllm → ruby_llm}/agents/executions/show.html.erb +260 -200
- data/app/views/{rubyllm → ruby_llm}/agents/settings/show.html.erb +1 -1
- data/app/views/ruby_llm/agents/shared/_breadcrumbs.html.erb +48 -0
- data/app/views/ruby_llm/agents/shared/_executions_table.html.erb +251 -0
- data/app/views/{rubyllm → ruby_llm}/agents/shared/_filter_dropdown.html.erb +1 -1
- data/app/views/ruby_llm/agents/shared/_nav_link.html.erb +27 -0
- data/app/views/{rubyllm → ruby_llm}/agents/shared/_select_dropdown.html.erb +1 -1
- data/app/views/{rubyllm → ruby_llm}/agents/shared/_status_badge.html.erb +1 -1
- data/app/views/{rubyllm → ruby_llm}/agents/shared/_status_dot.html.erb +1 -1
- data/app/views/ruby_llm/agents/shared/_tenant_filter.html.erb +26 -0
- data/app/views/ruby_llm/agents/shared/_workflow_type_badge.html.erb +61 -0
- data/config/routes.rb +2 -0
- data/lib/generators/ruby_llm_agents/multi_tenancy_generator.rb +97 -0
- data/lib/generators/ruby_llm_agents/templates/add_attempts_migration.rb.tt +3 -3
- data/lib/generators/ruby_llm_agents/templates/add_tenant_to_executions_migration.rb.tt +23 -0
- data/lib/generators/ruby_llm_agents/templates/add_tool_calls_migration.rb.tt +2 -2
- data/lib/generators/ruby_llm_agents/templates/add_workflow_migration.rb.tt +38 -0
- data/lib/generators/ruby_llm_agents/templates/create_tenant_budgets_migration.rb.tt +45 -0
- data/lib/generators/ruby_llm_agents/templates/migration.rb.tt +17 -5
- data/lib/generators/ruby_llm_agents/upgrade_generator.rb +13 -0
- data/lib/ruby_llm/agents/alert_manager.rb +20 -16
- data/lib/ruby_llm/agents/base/caching.rb +40 -0
- data/lib/ruby_llm/agents/base/cost_calculation.rb +105 -0
- data/lib/ruby_llm/agents/base/dsl.rb +261 -0
- data/lib/ruby_llm/agents/base/execution.rb +258 -0
- data/lib/ruby_llm/agents/base/reliability_execution.rb +136 -0
- data/lib/ruby_llm/agents/base/response_building.rb +86 -0
- data/lib/ruby_llm/agents/base/tool_tracking.rb +57 -0
- data/lib/ruby_llm/agents/base.rb +37 -801
- data/lib/ruby_llm/agents/budget_tracker.rb +250 -139
- data/lib/ruby_llm/agents/cache_helper.rb +98 -0
- data/lib/ruby_llm/agents/circuit_breaker.rb +48 -30
- data/lib/ruby_llm/agents/configuration.rb +40 -1
- data/lib/ruby_llm/agents/engine.rb +65 -1
- data/lib/ruby_llm/agents/inflections.rb +14 -0
- data/lib/ruby_llm/agents/instrumentation.rb +66 -0
- data/lib/ruby_llm/agents/reliability.rb +8 -2
- data/lib/ruby_llm/agents/version.rb +1 -1
- data/lib/ruby_llm/agents/workflow/instrumentation.rb +254 -0
- data/lib/ruby_llm/agents/workflow/parallel.rb +282 -0
- data/lib/ruby_llm/agents/workflow/pipeline.rb +306 -0
- data/lib/ruby_llm/agents/workflow/result.rb +390 -0
- data/lib/ruby_llm/agents/workflow/router.rb +429 -0
- data/lib/ruby_llm/agents/workflow.rb +232 -0
- data/lib/ruby_llm/agents.rb +1 -0
- metadata +57 -75
- data/app/channels/ruby_llm/agents/executions_channel.rb +0 -46
- data/app/javascript/ruby_llm/agents/controllers/filter_controller.js +0 -56
- data/app/javascript/ruby_llm/agents/controllers/index.js +0 -12
- data/app/javascript/ruby_llm/agents/controllers/refresh_controller.js +0 -83
- data/app/views/layouts/rubyllm/agents/application.html.erb +0 -626
- data/app/views/rubyllm/agents/agents/index.html.erb +0 -20
- data/app/views/rubyllm/agents/agents/show.html.erb +0 -772
- data/app/views/rubyllm/agents/dashboard/_budgets_bar.html.erb +0 -165
- data/app/views/rubyllm/agents/dashboard/_now_strip.html.erb +0 -10
- data/app/views/rubyllm/agents/dashboard/_now_strip_values.html.erb +0 -71
- data/app/views/rubyllm/agents/dashboard/index.html.erb +0 -197
- data/app/views/rubyllm/agents/executions/index.html.erb +0 -28
- data/app/views/rubyllm/agents/executions/index.turbo_stream.erb +0 -18
- data/app/views/rubyllm/agents/shared/_executions_table.html.erb +0 -193
- /data/app/views/{rubyllm → ruby_llm}/agents/agents/_agent.html.erb +0 -0
- /data/app/views/{rubyllm → ruby_llm}/agents/agents/_version_comparison.html.erb +0 -0
- /data/app/views/{rubyllm → ruby_llm}/agents/dashboard/_action_center.html.erb +0 -0
- /data/app/views/{rubyllm → ruby_llm}/agents/dashboard/_alerts_feed.html.erb +0 -0
- /data/app/views/{rubyllm → ruby_llm}/agents/dashboard/_breaker_strip.html.erb +0 -0
- /data/app/views/{rubyllm → ruby_llm}/agents/executions/dry_run.html.erb +0 -0
- /data/app/views/{rubyllm → ruby_llm}/agents/shared/_stat_card.html.erb +0 -0
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ruby_llm-agents
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- adham90
|
|
@@ -37,48 +37,6 @@ dependencies:
|
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
39
|
version: '1.0'
|
|
40
|
-
- !ruby/object:Gem::Dependency
|
|
41
|
-
name: turbo-rails
|
|
42
|
-
requirement: !ruby/object:Gem::Requirement
|
|
43
|
-
requirements:
|
|
44
|
-
- - ">="
|
|
45
|
-
- !ruby/object:Gem::Version
|
|
46
|
-
version: '1.0'
|
|
47
|
-
type: :runtime
|
|
48
|
-
prerelease: false
|
|
49
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
-
requirements:
|
|
51
|
-
- - ">="
|
|
52
|
-
- !ruby/object:Gem::Version
|
|
53
|
-
version: '1.0'
|
|
54
|
-
- !ruby/object:Gem::Dependency
|
|
55
|
-
name: stimulus-rails
|
|
56
|
-
requirement: !ruby/object:Gem::Requirement
|
|
57
|
-
requirements:
|
|
58
|
-
- - ">="
|
|
59
|
-
- !ruby/object:Gem::Version
|
|
60
|
-
version: '1.0'
|
|
61
|
-
type: :runtime
|
|
62
|
-
prerelease: false
|
|
63
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
-
requirements:
|
|
65
|
-
- - ">="
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '1.0'
|
|
68
|
-
- !ruby/object:Gem::Dependency
|
|
69
|
-
name: chartkick
|
|
70
|
-
requirement: !ruby/object:Gem::Requirement
|
|
71
|
-
requirements:
|
|
72
|
-
- - ">="
|
|
73
|
-
- !ruby/object:Gem::Version
|
|
74
|
-
version: '5.0'
|
|
75
|
-
type: :runtime
|
|
76
|
-
prerelease: false
|
|
77
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
78
|
-
requirements:
|
|
79
|
-
- - ">="
|
|
80
|
-
- !ruby/object:Gem::Version
|
|
81
|
-
version: '5.0'
|
|
82
40
|
- !ruby/object:Gem::Dependency
|
|
83
41
|
name: csv
|
|
84
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -104,7 +62,6 @@ extra_rdoc_files: []
|
|
|
104
62
|
files:
|
|
105
63
|
- LICENSE.txt
|
|
106
64
|
- README.md
|
|
107
|
-
- app/channels/ruby_llm/agents/executions_channel.rb
|
|
108
65
|
- app/controllers/concerns/ruby_llm/agents/filterable.rb
|
|
109
66
|
- app/controllers/concerns/ruby_llm/agents/paginatable.rb
|
|
110
67
|
- app/controllers/ruby_llm/agents/agents_controller.rb
|
|
@@ -112,54 +69,65 @@ files:
|
|
|
112
69
|
- app/controllers/ruby_llm/agents/executions_controller.rb
|
|
113
70
|
- app/controllers/ruby_llm/agents/settings_controller.rb
|
|
114
71
|
- app/helpers/ruby_llm/agents/application_helper.rb
|
|
115
|
-
- app/javascript/ruby_llm/agents/controllers/filter_controller.js
|
|
116
|
-
- app/javascript/ruby_llm/agents/controllers/index.js
|
|
117
|
-
- app/javascript/ruby_llm/agents/controllers/refresh_controller.js
|
|
118
72
|
- app/models/ruby_llm/agents/execution.rb
|
|
119
73
|
- app/models/ruby_llm/agents/execution/analytics.rb
|
|
120
74
|
- app/models/ruby_llm/agents/execution/metrics.rb
|
|
121
75
|
- app/models/ruby_llm/agents/execution/scopes.rb
|
|
76
|
+
- app/models/ruby_llm/agents/execution/workflow.rb
|
|
77
|
+
- app/models/ruby_llm/agents/tenant_budget.rb
|
|
122
78
|
- app/services/ruby_llm/agents/agent_registry.rb
|
|
123
|
-
- app/views/layouts/
|
|
124
|
-
- app/views/
|
|
125
|
-
- app/views/
|
|
126
|
-
- app/views/
|
|
127
|
-
- app/views/
|
|
128
|
-
- app/views/
|
|
129
|
-
- app/views/
|
|
130
|
-
- app/views/
|
|
131
|
-
- app/views/
|
|
132
|
-
- app/views/
|
|
133
|
-
- app/views/
|
|
134
|
-
- app/views/
|
|
135
|
-
- app/views/
|
|
136
|
-
- app/views/
|
|
137
|
-
- app/views/
|
|
138
|
-
- app/views/
|
|
139
|
-
- app/views/
|
|
140
|
-
- app/views/
|
|
141
|
-
- app/views/
|
|
142
|
-
- app/views/
|
|
143
|
-
- app/views/
|
|
144
|
-
- app/views/
|
|
145
|
-
- app/views/
|
|
146
|
-
- app/views/
|
|
147
|
-
- app/views/
|
|
148
|
-
- app/views/
|
|
149
|
-
- app/views/
|
|
79
|
+
- app/views/layouts/ruby_llm/agents/application.html.erb
|
|
80
|
+
- app/views/ruby_llm/agents/agents/_agent.html.erb
|
|
81
|
+
- app/views/ruby_llm/agents/agents/_empty_state.html.erb
|
|
82
|
+
- app/views/ruby_llm/agents/agents/_version_comparison.html.erb
|
|
83
|
+
- app/views/ruby_llm/agents/agents/_workflow.html.erb
|
|
84
|
+
- app/views/ruby_llm/agents/agents/index.html.erb
|
|
85
|
+
- app/views/ruby_llm/agents/agents/show.html.erb
|
|
86
|
+
- app/views/ruby_llm/agents/dashboard/_action_center.html.erb
|
|
87
|
+
- app/views/ruby_llm/agents/dashboard/_agent_comparison.html.erb
|
|
88
|
+
- app/views/ruby_llm/agents/dashboard/_alerts_feed.html.erb
|
|
89
|
+
- app/views/ruby_llm/agents/dashboard/_breaker_strip.html.erb
|
|
90
|
+
- app/views/ruby_llm/agents/dashboard/_budgets_bar.html.erb
|
|
91
|
+
- app/views/ruby_llm/agents/dashboard/_execution_item.html.erb
|
|
92
|
+
- app/views/ruby_llm/agents/dashboard/_now_strip.html.erb
|
|
93
|
+
- app/views/ruby_llm/agents/dashboard/_tenant_budget.html.erb
|
|
94
|
+
- app/views/ruby_llm/agents/dashboard/_top_errors.html.erb
|
|
95
|
+
- app/views/ruby_llm/agents/dashboard/index.html.erb
|
|
96
|
+
- app/views/ruby_llm/agents/executions/_execution.html.erb
|
|
97
|
+
- app/views/ruby_llm/agents/executions/_filters.html.erb
|
|
98
|
+
- app/views/ruby_llm/agents/executions/_list.html.erb
|
|
99
|
+
- app/views/ruby_llm/agents/executions/_workflow_summary.html.erb
|
|
100
|
+
- app/views/ruby_llm/agents/executions/dry_run.html.erb
|
|
101
|
+
- app/views/ruby_llm/agents/executions/index.html.erb
|
|
102
|
+
- app/views/ruby_llm/agents/executions/show.html.erb
|
|
103
|
+
- app/views/ruby_llm/agents/settings/show.html.erb
|
|
104
|
+
- app/views/ruby_llm/agents/shared/_breadcrumbs.html.erb
|
|
105
|
+
- app/views/ruby_llm/agents/shared/_executions_table.html.erb
|
|
106
|
+
- app/views/ruby_llm/agents/shared/_filter_dropdown.html.erb
|
|
107
|
+
- app/views/ruby_llm/agents/shared/_nav_link.html.erb
|
|
108
|
+
- app/views/ruby_llm/agents/shared/_select_dropdown.html.erb
|
|
109
|
+
- app/views/ruby_llm/agents/shared/_stat_card.html.erb
|
|
110
|
+
- app/views/ruby_llm/agents/shared/_status_badge.html.erb
|
|
111
|
+
- app/views/ruby_llm/agents/shared/_status_dot.html.erb
|
|
112
|
+
- app/views/ruby_llm/agents/shared/_tenant_filter.html.erb
|
|
113
|
+
- app/views/ruby_llm/agents/shared/_workflow_type_badge.html.erb
|
|
150
114
|
- config/routes.rb
|
|
151
115
|
- lib/generators/ruby_llm_agents/agent_generator.rb
|
|
152
116
|
- lib/generators/ruby_llm_agents/install_generator.rb
|
|
117
|
+
- lib/generators/ruby_llm_agents/multi_tenancy_generator.rb
|
|
153
118
|
- lib/generators/ruby_llm_agents/templates/add_attempts_migration.rb.tt
|
|
154
119
|
- lib/generators/ruby_llm_agents/templates/add_caching_migration.rb.tt
|
|
155
120
|
- lib/generators/ruby_llm_agents/templates/add_finish_reason_migration.rb.tt
|
|
156
121
|
- lib/generators/ruby_llm_agents/templates/add_prompts_migration.rb.tt
|
|
157
122
|
- lib/generators/ruby_llm_agents/templates/add_routing_migration.rb.tt
|
|
158
123
|
- lib/generators/ruby_llm_agents/templates/add_streaming_migration.rb.tt
|
|
124
|
+
- lib/generators/ruby_llm_agents/templates/add_tenant_to_executions_migration.rb.tt
|
|
159
125
|
- lib/generators/ruby_llm_agents/templates/add_tool_calls_migration.rb.tt
|
|
160
126
|
- lib/generators/ruby_llm_agents/templates/add_tracing_migration.rb.tt
|
|
127
|
+
- lib/generators/ruby_llm_agents/templates/add_workflow_migration.rb.tt
|
|
161
128
|
- lib/generators/ruby_llm_agents/templates/agent.rb.tt
|
|
162
129
|
- lib/generators/ruby_llm_agents/templates/application_agent.rb.tt
|
|
130
|
+
- lib/generators/ruby_llm_agents/templates/create_tenant_budgets_migration.rb.tt
|
|
163
131
|
- lib/generators/ruby_llm_agents/templates/initializer.rb.tt
|
|
164
132
|
- lib/generators/ruby_llm_agents/templates/migration.rb.tt
|
|
165
133
|
- lib/generators/ruby_llm_agents/upgrade_generator.rb
|
|
@@ -168,7 +136,15 @@ files:
|
|
|
168
136
|
- lib/ruby_llm/agents/alert_manager.rb
|
|
169
137
|
- lib/ruby_llm/agents/attempt_tracker.rb
|
|
170
138
|
- lib/ruby_llm/agents/base.rb
|
|
139
|
+
- lib/ruby_llm/agents/base/caching.rb
|
|
140
|
+
- lib/ruby_llm/agents/base/cost_calculation.rb
|
|
141
|
+
- lib/ruby_llm/agents/base/dsl.rb
|
|
142
|
+
- lib/ruby_llm/agents/base/execution.rb
|
|
143
|
+
- lib/ruby_llm/agents/base/reliability_execution.rb
|
|
144
|
+
- lib/ruby_llm/agents/base/response_building.rb
|
|
145
|
+
- lib/ruby_llm/agents/base/tool_tracking.rb
|
|
171
146
|
- lib/ruby_llm/agents/budget_tracker.rb
|
|
147
|
+
- lib/ruby_llm/agents/cache_helper.rb
|
|
172
148
|
- lib/ruby_llm/agents/circuit_breaker.rb
|
|
173
149
|
- lib/ruby_llm/agents/configuration.rb
|
|
174
150
|
- lib/ruby_llm/agents/engine.rb
|
|
@@ -179,6 +155,12 @@ files:
|
|
|
179
155
|
- lib/ruby_llm/agents/reliability.rb
|
|
180
156
|
- lib/ruby_llm/agents/result.rb
|
|
181
157
|
- lib/ruby_llm/agents/version.rb
|
|
158
|
+
- lib/ruby_llm/agents/workflow.rb
|
|
159
|
+
- lib/ruby_llm/agents/workflow/instrumentation.rb
|
|
160
|
+
- lib/ruby_llm/agents/workflow/parallel.rb
|
|
161
|
+
- lib/ruby_llm/agents/workflow/pipeline.rb
|
|
162
|
+
- lib/ruby_llm/agents/workflow/result.rb
|
|
163
|
+
- lib/ruby_llm/agents/workflow/router.rb
|
|
182
164
|
homepage: https://github.com/adham90/ruby_llm-agents
|
|
183
165
|
licenses:
|
|
184
166
|
- MIT
|
|
@@ -200,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
200
182
|
- !ruby/object:Gem::Version
|
|
201
183
|
version: '0'
|
|
202
184
|
requirements: []
|
|
203
|
-
rubygems_version:
|
|
185
|
+
rubygems_version: 4.0.3
|
|
204
186
|
specification_version: 4
|
|
205
187
|
summary: Agent framework for building LLM-powered agents with RubyLLM
|
|
206
188
|
test_files: []
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module RubyLLM
|
|
4
|
-
module Agents
|
|
5
|
-
# ActionCable channel for real-time execution updates
|
|
6
|
-
#
|
|
7
|
-
# Broadcasts execution create/update events to subscribed clients.
|
|
8
|
-
# Used by the dashboard to show live execution status changes.
|
|
9
|
-
#
|
|
10
|
-
# Inherits from the host app's ApplicationCable::Channel (note the :: prefix
|
|
11
|
-
# to reference the root namespace, not the engine's namespace).
|
|
12
|
-
#
|
|
13
|
-
# @example JavaScript subscription
|
|
14
|
-
# import { createConsumer } from "@rails/actioncable"
|
|
15
|
-
# const consumer = createConsumer()
|
|
16
|
-
# consumer.subscriptions.create("RubyLLM::Agents::ExecutionsChannel", {
|
|
17
|
-
# received(data) {
|
|
18
|
-
# console.log("Execution update:", data)
|
|
19
|
-
# }
|
|
20
|
-
# })
|
|
21
|
-
#
|
|
22
|
-
# @see Execution#broadcast_execution Broadcast trigger
|
|
23
|
-
# @api private
|
|
24
|
-
class ExecutionsChannel < ::ApplicationCable::Channel
|
|
25
|
-
# Subscribes the client to the executions broadcast stream
|
|
26
|
-
#
|
|
27
|
-
# Called automatically when a client connects to this channel.
|
|
28
|
-
# Streams from the "ruby_llm_agents:executions" channel name.
|
|
29
|
-
#
|
|
30
|
-
# @return [void]
|
|
31
|
-
def subscribed
|
|
32
|
-
stream_from "ruby_llm_agents:executions"
|
|
33
|
-
logger.info "[RubyLLM::Agents] Client subscribed to executions channel"
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
# Cleans up when a client disconnects
|
|
37
|
-
#
|
|
38
|
-
# Called automatically when the WebSocket connection is closed.
|
|
39
|
-
#
|
|
40
|
-
# @return [void]
|
|
41
|
-
def unsubscribed
|
|
42
|
-
logger.info "[RubyLLM::Agents] Client unsubscribed from executions channel"
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
end
|
|
46
|
-
end
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Controller } from "@hotwired/stimulus"
|
|
2
|
-
|
|
3
|
-
// Filter controller for live filtering of executions
|
|
4
|
-
//
|
|
5
|
-
// Usage:
|
|
6
|
-
// <form data-controller="filter">
|
|
7
|
-
// <select data-action="change->filter#submit">...</select>
|
|
8
|
-
// </form>
|
|
9
|
-
//
|
|
10
|
-
export default class extends Controller {
|
|
11
|
-
static targets = ["form"]
|
|
12
|
-
static values = {
|
|
13
|
-
debounce: { type: Number, default: 300 }
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
connect() {
|
|
17
|
-
this.timeout = null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
disconnect() {
|
|
21
|
-
if (this.timeout) {
|
|
22
|
-
clearTimeout(this.timeout)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Submit the form with debouncing
|
|
27
|
-
submit(event) {
|
|
28
|
-
if (this.timeout) {
|
|
29
|
-
clearTimeout(this.timeout)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
this.timeout = setTimeout(() => {
|
|
33
|
-
this.element.requestSubmit()
|
|
34
|
-
}, this.debounceValue)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// Submit immediately without debounce
|
|
38
|
-
submitNow(event) {
|
|
39
|
-
this.element.requestSubmit()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Update URL with current filter state
|
|
43
|
-
updateUrl() {
|
|
44
|
-
const formData = new FormData(this.element)
|
|
45
|
-
const params = new URLSearchParams()
|
|
46
|
-
|
|
47
|
-
for (const [key, value] of formData) {
|
|
48
|
-
if (value) {
|
|
49
|
-
params.set(key, value)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const newUrl = `${window.location.pathname}?${params.toString()}`
|
|
54
|
-
window.history.pushState({}, "", newUrl)
|
|
55
|
-
}
|
|
56
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// Entry point for RubyLLM::Agents Stimulus controllers
|
|
2
|
-
// Import and register controllers with your Stimulus application
|
|
3
|
-
|
|
4
|
-
import FilterController from "./filter_controller"
|
|
5
|
-
import RefreshController from "./refresh_controller"
|
|
6
|
-
|
|
7
|
-
export { FilterController, RefreshController }
|
|
8
|
-
|
|
9
|
-
export function registerControllers(application) {
|
|
10
|
-
application.register("filter", FilterController)
|
|
11
|
-
application.register("refresh", RefreshController)
|
|
12
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Controller } from "@hotwired/stimulus"
|
|
2
|
-
|
|
3
|
-
// Auto-refresh controller for dashboard with toggle support
|
|
4
|
-
//
|
|
5
|
-
// Usage:
|
|
6
|
-
// <div data-controller="refresh"
|
|
7
|
-
// data-refresh-interval-value="30000"
|
|
8
|
-
// data-refresh-enabled-value="false">
|
|
9
|
-
// <button data-action="refresh#toggle" data-refresh-target="button">
|
|
10
|
-
// Live Poll: Off
|
|
11
|
-
// </button>
|
|
12
|
-
// </div>
|
|
13
|
-
//
|
|
14
|
-
export default class extends Controller {
|
|
15
|
-
static values = {
|
|
16
|
-
interval: { type: Number, default: 30000 },
|
|
17
|
-
enabled: { type: Boolean, default: false }
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static targets = ["button", "indicator"]
|
|
21
|
-
|
|
22
|
-
connect() {
|
|
23
|
-
this.updateUI()
|
|
24
|
-
if (this.enabledValue) {
|
|
25
|
-
this.startRefresh()
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
disconnect() {
|
|
30
|
-
this.stopRefresh()
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
toggle() {
|
|
34
|
-
this.enabledValue = !this.enabledValue
|
|
35
|
-
|
|
36
|
-
if (this.enabledValue) {
|
|
37
|
-
this.startRefresh()
|
|
38
|
-
this.refresh() // Immediate refresh when enabled
|
|
39
|
-
} else {
|
|
40
|
-
this.stopRefresh()
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
this.updateUI()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
startRefresh() {
|
|
47
|
-
if (this.intervalValue > 0 && !this.timer) {
|
|
48
|
-
this.timer = setInterval(() => this.refresh(), this.intervalValue)
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
stopRefresh() {
|
|
53
|
-
if (this.timer) {
|
|
54
|
-
clearInterval(this.timer)
|
|
55
|
-
this.timer = null
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
refresh() {
|
|
60
|
-
const frame = this.element.closest("turbo-frame") ||
|
|
61
|
-
this.element.querySelector("turbo-frame")
|
|
62
|
-
|
|
63
|
-
if (frame && typeof frame.reload === "function") {
|
|
64
|
-
frame.reload()
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
updateUI() {
|
|
69
|
-
if (this.hasButtonTarget) {
|
|
70
|
-
if (this.enabledValue) {
|
|
71
|
-
this.buttonTarget.classList.remove("bg-gray-100", "text-gray-600")
|
|
72
|
-
this.buttonTarget.classList.add("bg-green-100", "text-green-700")
|
|
73
|
-
} else {
|
|
74
|
-
this.buttonTarget.classList.remove("bg-green-100", "text-green-700")
|
|
75
|
-
this.buttonTarget.classList.add("bg-gray-100", "text-gray-600")
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (this.hasIndicatorTarget) {
|
|
80
|
-
this.indicatorTarget.textContent = this.enabledValue ? "On" : "Off"
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|