meta_workflows 0.7.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 +7 -0
- data/CHANGELOG.md +36 -0
- data/README.md +498 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/meta_workflows/controllers/loading_phrases_controller.js +31 -0
- data/app/assets/javascripts/meta_workflows/controllers/redirect_controller.js +15 -0
- data/app/assets/javascripts/meta_workflows/controllers/response_scroll_controller.js +67 -0
- data/app/assets/javascripts/meta_workflows_manifest.js +13 -0
- data/app/assets/stylesheets/meta_workflows/application.css +161 -0
- data/app/controllers/meta_workflows/application_controller.rb +10 -0
- data/app/controllers/meta_workflows/debug_controller.rb +101 -0
- data/app/controllers/meta_workflows/humans_controller.rb +96 -0
- data/app/controllers/meta_workflows/meta_controller.rb +21 -0
- data/app/helpers/meta_workflows/application_helper.rb +7 -0
- data/app/helpers/meta_workflows/debug_helper.rb +54 -0
- data/app/helpers/meta_workflows/execution_helper.rb +77 -0
- data/app/helpers/meta_workflows/formatting_helper.rb +30 -0
- data/app/helpers/meta_workflows/meta_workflows_helper.rb +41 -0
- data/app/helpers/meta_workflows/status_badge_helper.rb +66 -0
- data/app/jobs/meta_workflows/application_job.rb +14 -0
- data/app/jobs/meta_workflows/human_input_job.rb +35 -0
- data/app/jobs/meta_workflows/meta_job.rb +121 -0
- data/app/jobs/meta_workflows/meta_workflow_job.rb +20 -0
- data/app/jobs/meta_workflows/record_redirect_job.rb +36 -0
- data/app/mailers/meta_workflows/application_mailer.rb +8 -0
- data/app/models/meta_workflows/application_record.rb +7 -0
- data/app/models/meta_workflows/chat.rb +20 -0
- data/app/models/meta_workflows/message.rb +11 -0
- data/app/models/meta_workflows/tool_call.rb +7 -0
- data/app/models/meta_workflows/workflow.rb +32 -0
- data/app/models/meta_workflows/workflow_execution.rb +23 -0
- data/app/models/meta_workflows/workflow_step.rb +49 -0
- data/app/models/meta_workflows.rb +7 -0
- data/app/services/meta_workflows/execution_filter_service.rb +80 -0
- data/app/sidekiq/meta_workflows/tools/meta_workflow_tool.rb +86 -0
- data/app/views/layouts/meta_workflows/application.html.erb +17 -0
- data/app/views/layouts/meta_workflows/debug.html.erb +47 -0
- data/app/views/meta_workflows/_loader.html.erb +22 -0
- data/app/views/meta_workflows/_redirect.html.erb +1 -0
- data/app/views/meta_workflows/_response.html.erb +5 -0
- data/app/views/meta_workflows/_response_form.html.erb +36 -0
- data/app/views/meta_workflows/debug/executions.html.erb +187 -0
- data/app/views/meta_workflows/debug/show_execution.html.erb +283 -0
- data/app/views/meta_workflows/debug/show_workflow.html.erb +148 -0
- data/app/views/meta_workflows/debug/workflows.html.erb +110 -0
- data/config/routes.rb +13 -0
- data/db/migrate/20250530220618_create_meta_workflows_workflows.rb +16 -0
- data/db/migrate/20250530220634_create_meta_workflows_workflow_executions.rb +18 -0
- data/db/migrate/20250530220704_create_meta_workflows_chats.rb +16 -0
- data/db/migrate/20250530220722_create_meta_workflows_messages.rb +19 -0
- data/db/migrate/20250530220737_create_meta_workflows_tool_calls.rb +18 -0
- data/db/migrate/20250530220750_create_meta_workflows_workflow_steps.rb +17 -0
- data/db/migrate/20250613213159_add_error_fields_to_workflow_steps.rb +8 -0
- data/lib/meta_workflows/asset_installer.rb +509 -0
- data/lib/meta_workflows/configuration.rb +39 -0
- data/lib/meta_workflows/engine.rb +47 -0
- data/lib/meta_workflows/export_execution_service.rb +56 -0
- data/lib/meta_workflows/version.rb +5 -0
- data/lib/meta_workflows.rb +9 -0
- data/lib/services/meta_workflows/application_service.rb +11 -0
- data/lib/services/meta_workflows/meta_workflow_service.rb +277 -0
- data/lib/services/meta_workflows/updaters/meta_service.rb +39 -0
- data/lib/tasks/meta_workflows_tasks.rake +153 -0
- metadata +219 -0
@@ -0,0 +1,110 @@
|
|
1
|
+
<div class="bg-white shadow rounded-lg">
|
2
|
+
<!-- Header -->
|
3
|
+
<div class="px-6 py-4 border-b border-gray-200">
|
4
|
+
<div class="flex items-center justify-between">
|
5
|
+
<div>
|
6
|
+
<h2 class="text-lg font-medium text-gray-900">Workflows</h2>
|
7
|
+
<p class="mt-1 text-sm text-gray-500">
|
8
|
+
Browse and manage workflow definitions
|
9
|
+
</p>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<!-- Search -->
|
13
|
+
<div class="w-64">
|
14
|
+
<%= form_with url: workflows_path, method: :get, local: true, class: "flex" do |form| %>
|
15
|
+
<%= form.text_field :search,
|
16
|
+
placeholder: "Search workflows...",
|
17
|
+
value: params[:search],
|
18
|
+
class: "block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500 sm:text-sm" %>
|
19
|
+
<%= form.submit "Search",
|
20
|
+
class: "ml-2 inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500" %>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<!-- Workflows Table -->
|
27
|
+
<div class="overflow-hidden">
|
28
|
+
<table class="min-w-full divide-y divide-gray-200">
|
29
|
+
<thead class="bg-gray-50">
|
30
|
+
<tr>
|
31
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
32
|
+
Name
|
33
|
+
</th>
|
34
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
35
|
+
Steps
|
36
|
+
</th>
|
37
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
38
|
+
Executions
|
39
|
+
</th>
|
40
|
+
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
41
|
+
Created
|
42
|
+
</th>
|
43
|
+
<th class="relative px-6 py-3">
|
44
|
+
<span class="sr-only">Actions</span>
|
45
|
+
</th>
|
46
|
+
</tr>
|
47
|
+
</thead>
|
48
|
+
<tbody class="bg-white divide-y divide-gray-200">
|
49
|
+
<% @workflows.each do |workflow| %>
|
50
|
+
<tr class="hover:bg-gray-50">
|
51
|
+
<td class="px-6 py-4 whitespace-nowrap">
|
52
|
+
<div class="flex items-center">
|
53
|
+
<div>
|
54
|
+
<div class="text-sm font-medium text-gray-900">
|
55
|
+
<%= workflow.name %>
|
56
|
+
</div>
|
57
|
+
<% if workflow.recipe&.dig('description') %>
|
58
|
+
<div class="text-sm text-gray-500">
|
59
|
+
<%= truncate_with_tooltip(workflow.recipe['description'], length: 80) %>
|
60
|
+
</div>
|
61
|
+
<% end %>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</td>
|
65
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
66
|
+
<% begin %>
|
67
|
+
<%= workflow.total_steps %> steps
|
68
|
+
<% rescue => e %>
|
69
|
+
N/A
|
70
|
+
<% end %>
|
71
|
+
</td>
|
72
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
73
|
+
<%= workflow.workflow_executions.count %> executions
|
74
|
+
</td>
|
75
|
+
<td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">
|
76
|
+
<%= time_with_tooltip(workflow.created_at) %>
|
77
|
+
</td>
|
78
|
+
<td class="px-6 py-4 whitespace-nowrap text-right text-sm font-medium">
|
79
|
+
<%= link_to "View", workflow_path(workflow),
|
80
|
+
class: "text-blue-600 hover:text-blue-900" %>
|
81
|
+
<%= link_to "Executions", executions_path(workflow_id: workflow.id),
|
82
|
+
class: "ml-2 text-blue-600 hover:text-blue-900" %>
|
83
|
+
</td>
|
84
|
+
</tr>
|
85
|
+
<% end %>
|
86
|
+
|
87
|
+
<% if @workflows.empty? %>
|
88
|
+
<tr>
|
89
|
+
<td colspan="5" class="px-6 py-12 text-center">
|
90
|
+
<div class="text-gray-500">
|
91
|
+
<% if params[:search].present? %>
|
92
|
+
No workflows found matching "<%= params[:search] %>"
|
93
|
+
<% else %>
|
94
|
+
No workflows found
|
95
|
+
<% end %>
|
96
|
+
</div>
|
97
|
+
</td>
|
98
|
+
</tr>
|
99
|
+
<% end %>
|
100
|
+
</tbody>
|
101
|
+
</table>
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<!-- Pagination -->
|
105
|
+
<% if respond_to?(:paginate) && @workflows.respond_to?(:current_page) %>
|
106
|
+
<div class="px-6 py-3 border-t border-gray-200">
|
107
|
+
<%= paginate @workflows, theme: 'twitter_bootstrap_4' %>
|
108
|
+
</div>
|
109
|
+
<% end %>
|
110
|
+
</div>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
MetaWorkflows::Engine.routes.draw do
|
4
|
+
resources :humans, only: [:update]
|
5
|
+
|
6
|
+
# Debug interface routes
|
7
|
+
root 'debug#index'
|
8
|
+
get 'workflows', to: 'debug#workflows'
|
9
|
+
get 'workflows/:id', to: 'debug#show_workflow', as: 'workflow'
|
10
|
+
get 'executions', to: 'debug#executions'
|
11
|
+
get 'executions/:id', to: 'debug#show_execution', as: 'execution'
|
12
|
+
get 'executions/:id/export', to: 'debug#export_execution', as: 'export_execution'
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateMetaWorkflowsWorkflows < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
return if table_exists?(:meta_workflows_workflows)
|
6
|
+
|
7
|
+
create_table :meta_workflows_workflows do |t|
|
8
|
+
t.string :name
|
9
|
+
t.jsonb :recipe
|
10
|
+
|
11
|
+
t.timestamps
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :meta_workflows_workflows, :name, unique: true
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateMetaWorkflowsWorkflowExecutions < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
return if table_exists?(:meta_workflows_workflow_executions)
|
6
|
+
|
7
|
+
create_table :meta_workflows_workflow_executions do |t|
|
8
|
+
t.references :workflow, null: true, foreign_key: { to_table: :meta_workflows_workflows }, index: true
|
9
|
+
t.references :record, null: true, polymorphic: true, index: true
|
10
|
+
t.integer :current_step, default: 0, null: false
|
11
|
+
t.integer :repetition, default: 0, null: false
|
12
|
+
t.boolean :completed, default: false, null: false
|
13
|
+
t.json :workflow_params
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateMetaWorkflowsChats < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
return if table_exists?(:meta_workflows_chats)
|
6
|
+
|
7
|
+
create_table :meta_workflows_chats do |t|
|
8
|
+
t.string :model_id
|
9
|
+
t.references :user
|
10
|
+
t.string :provider
|
11
|
+
t.string :conversation_id
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateMetaWorkflowsMessages < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
return if table_exists?(:meta_workflows_messages)
|
6
|
+
|
7
|
+
create_table :meta_workflows_messages do |t|
|
8
|
+
t.references :chat, null: false, foreign_key: { to_table: :meta_workflows_chats }
|
9
|
+
t.string :role
|
10
|
+
t.text :content
|
11
|
+
t.string :model_id
|
12
|
+
t.integer :input_tokens
|
13
|
+
t.integer :output_tokens
|
14
|
+
t.references :tool_call
|
15
|
+
|
16
|
+
t.timestamps
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateMetaWorkflowsToolCalls < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
return if table_exists?(:meta_workflows_tool_calls)
|
6
|
+
|
7
|
+
create_table :meta_workflows_tool_calls do |t|
|
8
|
+
t.references :message, null: false, foreign_key: { to_table: :meta_workflows_messages }
|
9
|
+
t.string :tool_call_id, null: false
|
10
|
+
t.string :name, null: false
|
11
|
+
t.jsonb :arguments, default: {}
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
|
16
|
+
add_index :meta_workflows_tool_calls, :tool_call_id
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateMetaWorkflowsWorkflowSteps < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
return if table_exists?(:meta_workflows_workflow_steps)
|
6
|
+
|
7
|
+
create_table :meta_workflows_workflow_steps do |t|
|
8
|
+
t.references :workflow_execution, null: false, foreign_key: { to_table: :meta_workflows_workflow_executions }
|
9
|
+
t.integer :step, null: false
|
10
|
+
t.references :chat, null: true, foreign_key: { to_table: :meta_workflows_chats }
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
add_index :meta_workflows_workflow_steps, %i[workflow_execution_id step], unique: true
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class AddErrorFieldsToWorkflowSteps < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
add_column :meta_workflows_workflow_steps, :error_message, :text
|
4
|
+
add_column :meta_workflows_workflow_steps, :error_type, :string
|
5
|
+
add_column :meta_workflows_workflow_steps, :error_details, :json
|
6
|
+
add_column :meta_workflows_workflow_steps, :error_occurred_at, :datetime
|
7
|
+
end
|
8
|
+
end
|