meta_workflows 0.9.40 → 0.9.42

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1229d2b932428c27988056a8309809fff4001883352a8b9a2009a2b354c52c73
4
- data.tar.gz: 507ea88f809236dcdcf4a9802fe107e3c934c369e3886f3dc97dc04d7bf311dd
3
+ metadata.gz: 17087d9bb5946f3d426537a21fb156086ad445b4d432769e14b98bce48a9d181
4
+ data.tar.gz: 105d398ab5baaa0bede2ab9adb322a18a99cb628d1faf54070302191d61ef534
5
5
  SHA512:
6
- metadata.gz: 94dc8852fe26a758701eadb4427c4dc1f5370199ce92cda67d40bc6f5ab5f2db621336bc53cda74fdbca8bae62e8b61bae4d0baef4458db27b6f6dd1bae18a9f
7
- data.tar.gz: 3f6baa1ed29f0931f20bcaedfd3d2db2e9751b9cb9444a085d97aac5b0247a2b5a31e05cc86679c6b196001ae74c3449d98eb9fd893c3815d7a336252b7bb5ce
6
+ metadata.gz: ebfb5b1173398b8b6f76cfec4f84ec08c75fd24f95dd494dab55e1fe98243d939f443d3aea546215dd06dc12be141679c89ed3bbdee070fb91362e50c34974fb
7
+ data.tar.gz: '0986c1b0d0577f2b28a22861234bd59c3f8e0a60651a7c5042e3349eadd3652fbc2afa410b448dbbff9791d1228076dd8d56c0943d386b1af4bd308d98030374'
@@ -1,3 +1,4 @@
1
+ // TODO: This shoudl be removable, because it is not shared betwen applications (it is currentl used in the dummy app only)
1
2
  import { Controller } from "@hotwired/stimulus"
2
3
 
3
4
  export default class extends Controller {
@@ -135,15 +135,12 @@ export default class extends Controller {
135
135
  }
136
136
 
137
137
  updateGammaTray(hasChevron, trayElement) {
138
- console.log(`Updating gamma tray - expanded: ${this.expanded}`);
139
138
  // Gamma: open=right, collapsed=left
140
139
  if (this.expanded) {
141
- console.log('Expanding gamma tray');
142
140
  trayElement.classList.remove("collapsed");
143
141
  trayElement.classList.add("w-[300px]");
144
142
  this.updateChevronClasses(hasChevron, "fa-chevron-left", "fa-chevron-right");
145
143
  } else {
146
- console.log('Collapsing gamma tray');
147
144
  trayElement.classList.remove("w-[300px]");
148
145
  trayElement.classList.add("collapsed");
149
146
  this.updateChevronClasses(hasChevron, "fa-chevron-right", "fa-chevron-left");
@@ -12,7 +12,7 @@ module MetaWorkflows
12
12
 
13
13
  # Broadcasts loader message with step progress
14
14
  def broadcast_loader_stream(workflow_execution)
15
- step_progress = workflow_execution.step_progress(workflow_execution.current_step) || default_step_progress
15
+ step_progress = workflow_execution.current_step_progress
16
16
  record = workflow_execution.record
17
17
 
18
18
  Turbo::StreamsChannel.broadcast_replace_to(
@@ -86,7 +86,7 @@ module MetaWorkflows
86
86
  locals: {
87
87
  record: record,
88
88
  show_loader: show_loader,
89
- step_progress: step_progress || default_step_progress,
89
+ step_progress: step_progress || RecipeAccessible::DEFAULT_STEP_PROGRESS,
90
90
  full_response: nil
91
91
  }
92
92
  )
@@ -9,19 +9,18 @@ module MetaWorkflows
9
9
  @workflow_execution = MetaWorkflows::WorkflowExecution.includes(:record, :workflow,
10
10
  :workflow_steps).find(params[:id])
11
11
  @record = @workflow_execution.record
12
- @workflow_step = @workflow_execution.workflow_steps.find_by(step: @workflow_execution.current_step)
13
- @prompt_id = @workflow_execution.prompt_id(@workflow_execution.current_step)
12
+ @workflow_step = @workflow_execution.current_workflow_step
13
+ @prompt_id = @workflow_execution.current_prompt_id
14
14
  end
15
15
 
16
16
  protected
17
17
 
18
18
  def fetch_step_progress
19
- @workflow_execution.step_progress(@workflow_execution.current_step) || default_step_progress
19
+ @workflow_execution.current_step_progress
20
20
  end
21
21
 
22
22
  def current_step_repetitions
23
- # TODO: we should be albe to refactor this into a model method that does this internally
24
- @workflow_execution.step_repetitions(@workflow_execution.current_step)
23
+ @workflow_execution.current_step_repetitions
25
24
  end
26
25
 
27
26
  def append_user_message_to_history(user_message)
@@ -6,12 +6,12 @@ module MetaWorkflows
6
6
  include ExecutionHelper
7
7
  include FormattingHelper
8
8
 
9
- # Helper for truncating long text with tooltip
10
- def truncate_with_tooltip(text, length: 50)
9
+ # Helper for truncating long text
10
+ def truncate_text(text, length: 50)
11
11
  return '' if text.blank?
12
12
 
13
13
  if text.length > length
14
- content_tag :span, truncate(text, length: length), title: text, class: 'cursor-help'
14
+ "#{text[0...length]}..."
15
15
  else
16
16
  text
17
17
  end
@@ -31,10 +31,6 @@ module MetaWorkflows
31
31
  end
32
32
  end
33
33
 
34
- def default_step_progress
35
- ['Thinking']
36
- end
37
-
38
34
  def show_next_button?(workflow_execution)
39
35
  return false if current_step_has_repetitions?(workflow_execution)
40
36
 
@@ -57,7 +53,7 @@ module MetaWorkflows
57
53
  private
58
54
 
59
55
  def current_step_has_repetitions?(workflow_execution)
60
- workflow_execution.step_repetitions(workflow_execution.current_step).present?
56
+ workflow_execution.current_step_repetitions.present?
61
57
  end
62
58
  end
63
59
  end
@@ -93,7 +93,7 @@ module MetaWorkflows
93
93
  def current_workflow_step(workflow_execution)
94
94
  return nil unless workflow_execution
95
95
 
96
- workflow_execution.workflow_steps.find_by(step: workflow_execution.current_step)
96
+ workflow_execution.current_workflow_step
97
97
  end
98
98
 
99
99
  def broadcast_form(chat)
@@ -3,6 +3,8 @@
3
3
  module RecipeAccessible
4
4
  extend ActiveSupport::Concern
5
5
 
6
+ DEFAULT_STEP_PROGRESS = ['Thinking'].freeze
7
+
6
8
  def step_progress(step)
7
9
  recipe&.dig('steps', step, 'step_progress')
8
10
  end
@@ -23,6 +25,18 @@ module RecipeAccessible
23
25
  recipe&.dig('steps', step, 'repetitions')
24
26
  end
25
27
 
28
+ def current_step_repetitions
29
+ step_repetitions(current_step)
30
+ end
31
+
32
+ def current_step_progress
33
+ step_progress(current_step) || DEFAULT_STEP_PROGRESS
34
+ end
35
+
36
+ def current_prompt_id
37
+ prompt_id(current_step)
38
+ end
39
+
26
40
  def step_advanceable?(step)
27
41
  recipe&.dig('steps', step, 'advanceable') || false
28
42
  end
@@ -34,4 +48,8 @@ module RecipeAccessible
34
48
  def total_steps
35
49
  recipe&.dig('steps')&.size || 0
36
50
  end
51
+
52
+ def description
53
+ recipe&.dig('description')
54
+ end
37
55
  end
@@ -22,14 +22,16 @@ module MetaWorkflows
22
22
  update(current_step: current_step + 1)
23
23
  end
24
24
 
25
- # Get the latest workflow step with its chat (optimized for preloaded data)
26
25
  def latest_workflow_step
27
26
  workflow_steps.max_by(&:step)
28
27
  end
29
28
 
30
- # Get the chat from the latest step (optimized for preloaded data)
31
29
  def latest_chat
32
30
  latest_workflow_step&.chat
33
31
  end
32
+
33
+ def current_workflow_step
34
+ workflow_steps.find_by(step: current_step)
35
+ end
34
36
  end
35
37
  end
@@ -3,9 +3,9 @@
3
3
  <div class="lexi-loader-bubble">
4
4
  <div class="lexi-message-content-assistant"
5
5
  data-controller="loading-phrases"
6
- data-loading-phrases-phrases-value="<%= (local_assigns[:step_progress] || default_step_progress).to_json %>">
6
+ data-loading-phrases-phrases-value="<%= (local_assigns[:step_progress]).to_json %>">
7
7
  <span data-loading-phrases-target="message" class="lexi-loader-text">
8
- <%= default_step_progress.first %>
8
+ <%= local_assigns[:step_progress].first %>
9
9
  </span>
10
10
  <span class="lexi-loader-ellipses">
11
11
  <span class="lexi-dot lexi-dot-1">.</span>
@@ -145,8 +145,8 @@
145
145
  Step <%= execution.total_steps %>
146
146
  <% else %>
147
147
  Step <%= execution.current_step + 1 %>
148
- <% current_step_obj = execution.workflow_steps.find_by(step: execution.current_step) %>
149
- <% max_repetitions = execution.step_repetitions(execution.current_step) if current_step_obj %>
148
+ <% current_step_obj = execution.current_workflow_step %>
149
+ <% max_repetitions = execution.current_step_repetitions if current_step_obj %>
150
150
  <% step_data = safe_step_data(execution, execution.current_step) %>
151
151
 
152
152
  <% if current_step_obj&.repetition.present? && max_repetitions.present? %>
@@ -7,6 +7,11 @@
7
7
  <p class="mt-1 text-sm text-gray-500">
8
8
  Workflow Details
9
9
  </p>
10
+ <% if @workflow.description.present? %>
11
+ <p class="mt-2 text-sm text-gray-700">
12
+ <%= @workflow.description %>
13
+ </p>
14
+ <% end %>
10
15
  </div>
11
16
 
12
17
  <div class="flex space-x-3">
@@ -69,7 +69,7 @@
69
69
  </div>
70
70
  <% if workflow.recipe&.dig('description') %>
71
71
  <div class="text-sm text-gray-500">
72
- <%= truncate_with_tooltip(workflow.recipe['description'], length: 80) %>
72
+ <%= truncate_text(workflow.description, length: 80) %>
73
73
  </div>
74
74
  <% end %>
75
75
  </div>
@@ -3,7 +3,7 @@
3
3
  module MetaWorkflows
4
4
  MAJOR = 0
5
5
  MINOR = 9
6
- PATCH = 40 # this is automatically incremented by the build process
6
+ PATCH = 42 # this is automatically incremented by the build process
7
7
 
8
8
  VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
9
9
  end
@@ -11,9 +11,7 @@ module Services
11
11
 
12
12
  attr_reader :record, :workflow_name, :user, :inputs, :workflow_params
13
13
 
14
- # TODO: inputs should be a an empty hash by default
15
- # Once everything is working we can change the default value from nil to {}
16
- def initialize(record:, workflow_name: nil, user: nil, inputs: nil, workflow_params: nil)
14
+ def initialize(record:, workflow_name: nil, user: nil, inputs: {}, workflow_params: nil)
17
15
  @record = record
18
16
  @workflow_name = workflow_name
19
17
  @user = user
@@ -73,7 +71,7 @@ module Services
73
71
  end
74
72
 
75
73
  def find_workflow_step(workflow_execution)
76
- workflow_execution.workflow_steps.find_by(step: workflow_execution.current_step)
74
+ workflow_execution.current_workflow_step
77
75
  end
78
76
 
79
77
  def clear_previous_errors(workflow_step)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meta_workflows
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.40
4
+ version: 0.9.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonid Medovyy
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-07-28 00:00:00.000000000 Z
12
+ date: 2025-07-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails