meta_workflows 0.9.42 → 0.9.44

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: 17087d9bb5946f3d426537a21fb156086ad445b4d432769e14b98bce48a9d181
4
- data.tar.gz: 105d398ab5baaa0bede2ab9adb322a18a99cb628d1faf54070302191d61ef534
3
+ metadata.gz: 2a85e56497d67aea442295a210ad6b1726d5a7284b69a669b1cee2d1400fb161
4
+ data.tar.gz: c768c0e150f532e4007948f696c92c3907b956c266b8f95aa1284ab489912a03
5
5
  SHA512:
6
- metadata.gz: ebfb5b1173398b8b6f76cfec4f84ec08c75fd24f95dd494dab55e1fe98243d939f443d3aea546215dd06dc12be141679c89ed3bbdee070fb91362e50c34974fb
7
- data.tar.gz: '0986c1b0d0577f2b28a22861234bd59c3f8e0a60651a7c5042e3349eadd3652fbc2afa410b448dbbff9791d1228076dd8d56c0943d386b1af4bd308d98030374'
6
+ metadata.gz: df65f1be94b903d501bc91c7f07fed43fce3a23912b608d6df80218a17fee3d83c4b644ce1c6e220763976fb99f5a200807ae02754df5638bdc18bda9f327712
7
+ data.tar.gz: 2dc5082e320a0732dda26b26fb09a24b3948d6e2cd7afc7faae67f9c98c4b87e488881bbbf41ef15093a1bd83d7467f143aa5221787f02112c498d0ffd55cf02
@@ -1,67 +1,71 @@
1
- import { Controller } from "@hotwired/stimulus"
1
+ import { Controller } from '@hotwired/stimulus';
2
2
 
3
3
  export default class extends Controller {
4
4
  connect() {
5
- this.setupObserver()
6
- this.setupTurboListener()
7
- this.scrollToBottom()
5
+ this.setupObserver();
6
+ this.setupTurboListener();
7
+ this.scrollToBottom();
8
8
  }
9
9
 
10
10
  disconnect() {
11
11
  if (this.observer) {
12
- this.observer.disconnect()
12
+ this.observer.disconnect();
13
13
  }
14
- document.removeEventListener("turbo:frame-render", this.handleTurboRender)
14
+ document.removeEventListener('turbo:frame-render', this.handleTurboRender);
15
15
  }
16
16
 
17
17
  setupObserver() {
18
18
  this.observer = new MutationObserver((mutations) => {
19
- if (mutations.some(mutation =>
20
- mutation.type === 'childList' ||
21
- mutation.type === 'characterData'
22
- )) {
23
- setTimeout(() => this.scrollToBottom(), 10)
19
+ if (
20
+ mutations.some(
21
+ (mutation) =>
22
+ mutation.type === 'childList' || mutation.type === 'characterData'
23
+ )
24
+ ) {
25
+ setTimeout(() => this.scrollToBottom(), 10);
24
26
  }
25
- })
27
+ });
26
28
 
27
- const contentContainer = this.element.closest('#response-content-container')
29
+ const contentContainer = this.element.closest(
30
+ '#response-content-container'
31
+ );
28
32
  if (contentContainer) {
29
33
  this.observer.observe(contentContainer, {
30
34
  childList: true,
31
35
  subtree: true,
32
36
  characterData: true,
33
- attributes: true
34
- })
37
+ attributes: true,
38
+ });
35
39
  } else {
36
40
  this.observer.observe(this.element, {
37
41
  childList: true,
38
42
  subtree: true,
39
43
  characterData: true,
40
- attributes: true
41
- })
44
+ attributes: true,
45
+ });
42
46
  }
43
47
  }
44
48
 
45
49
  setupTurboListener() {
46
50
  this.handleTurboRender = () => {
47
- setTimeout(() => this.scrollToBottom(), 10)
48
- }
49
- document.addEventListener("turbo:frame-render", this.handleTurboRender)
51
+ setTimeout(() => this.scrollToBottom(), 10);
52
+ };
53
+ document.addEventListener('turbo:frame-render', this.handleTurboRender);
50
54
  }
51
55
 
52
56
  scrollToBottom() {
53
- const mainContainer = document.querySelector('#main-scroll-container')
54
- if (!mainContainer) return
57
+ const mainContainer = document.querySelector('#main-scroll-container');
58
+ if (!mainContainer) return;
55
59
 
56
- const scrollHeight = mainContainer.scrollHeight
57
- const clientHeight = mainContainer.clientHeight
58
- const maxScroll = scrollHeight - clientHeight
60
+ const scrollHeight = mainContainer.scrollHeight;
61
+ const clientHeight = mainContainer.clientHeight;
62
+ const maxScroll = scrollHeight - clientHeight;
59
63
 
60
64
  if (maxScroll > 0) {
61
65
  mainContainer.scrollTo({
62
66
  top: maxScroll,
63
- behavior: 'smooth'
64
- })
67
+ behavior: 'smooth',
68
+ });
65
69
  }
66
70
  }
67
- }
71
+ }
@@ -342,8 +342,7 @@
342
342
 
343
343
  .lexi-input-container {
344
344
  display: flex;
345
- flex-direction: row;
346
- gap: 0.5rem;
345
+ flex-direction: column;
347
346
  border: 1px solid var(--gray-300);
348
347
  border-radius: 0.5rem;
349
348
  background-color: rgba(255, 255, 255, 0.8);
@@ -374,7 +373,7 @@
374
373
 
375
374
  .lexi-input-controls {
376
375
  display: flex;
377
- justify-content: space-between;
376
+ justify-content: flex-end;
378
377
  align-items: flex-end;
379
378
  }
380
379
 
@@ -576,7 +575,13 @@
576
575
  transition: all 500ms ease-in-out;
577
576
  }
578
577
 
579
- /* Beta Tray (Left) */
578
+ /* Common content transitions */
579
+ .tray-content {
580
+ transition: opacity 300ms ease-in-out, transform 500ms ease-in-out;
581
+ opacity: 1;
582
+ transform: translate(0);
583
+ }
584
+
580
585
  .beta-tray {
581
586
  transition: width 500ms ease-in-out;
582
587
  }
@@ -606,28 +611,6 @@
606
611
  pointer-events: none;
607
612
  }
608
613
 
609
- /* Delta Tray (Bottom) */
610
- .delta-tray {
611
- transition: height 500ms ease-in-out;
612
- }
613
-
614
- .delta-tray.collapsed {
615
- height: 50px;
616
- }
617
-
618
- .delta-tray.collapsed .tray-content {
619
- opacity: 0;
620
- transform: translateY(1rem);
621
- pointer-events: none;
622
- }
623
-
624
- /* Common content transitions */
625
- .tray-content {
626
- transition: opacity 300ms ease-in-out, transform 500ms ease-in-out;
627
- opacity: 1;
628
- transform: translate(0);
629
- }
630
-
631
614
  /* Lexi Tray Overrides */
632
615
  .gamma-tray.lexi-tray.collapsed {
633
616
  width: 0px; /* Completely hide the tray */
@@ -683,6 +666,21 @@
683
666
  display: none;
684
667
  }
685
668
 
669
+ /* Delta Tray (Bottom) */
670
+ .delta-tray {
671
+ transition: height 500ms ease-in-out;
672
+ }
673
+
674
+ .delta-tray.collapsed {
675
+ height: 50px;
676
+ }
677
+
678
+ .delta-tray.collapsed .tray-content {
679
+ opacity: 0;
680
+ transform: translateY(1rem);
681
+ pointer-events: none;
682
+ }
683
+
686
684
  /* Onboarding Screen Grid Stacking Animations */
687
685
  .onboarding-container {
688
686
  display: grid;
@@ -735,7 +733,7 @@
735
733
 
736
734
  /* Alpha Tray Lexi Avatar Size */
737
735
  .lexi-avatar-large {
738
- height: 35rem;
736
+ height: 30rem;
739
737
  width: auto;
740
738
  }
741
739
 
@@ -746,7 +744,7 @@
746
744
  flex-direction: column;
747
745
  background-color: white;
748
746
  padding: 1rem 1rem 0 1rem;
749
- height: 95vh;
747
+ height: 100%;
750
748
  }
751
749
 
752
750
  .lexi-chat-alpha-header {
@@ -840,7 +838,6 @@
840
838
  padding: 1rem;
841
839
  background-color: rgba(255, 255, 255, 0.9);
842
840
  border-radius: 0.75rem;
843
- margin-bottom: .5rem;
844
841
  }
845
842
 
846
843
  .structured-input-options {
@@ -860,13 +857,15 @@
860
857
  background-color: white;
861
858
  cursor: pointer;
862
859
  transition: all 0.2s ease;
863
- background-image: linear-gradient(white, white), linear-gradient(var(--gray-300), var(--gray-300));
860
+ background-image: linear-gradient(white, white),
861
+ linear-gradient(var(--gray-300), var(--gray-300));
864
862
  background-origin: border-box;
865
863
  background-clip: padding-box, border-box;
866
864
  }
867
865
 
868
866
  .structured-radio-option:hover {
869
- background-image: linear-gradient(white, white), linear-gradient(45deg, #F3B51C, #E87C66, #F3B51C, #E87C66);
867
+ background-image: linear-gradient(white, white),
868
+ linear-gradient(45deg, #f3b51c, #e87c66, #f3b51c, #e87c66);
870
869
  background-size: auto, 300% 300%;
871
870
  animation: animatedgradient 3s ease alternate infinite;
872
871
  }
@@ -898,23 +897,24 @@
898
897
  background-color: white;
899
898
  cursor: pointer;
900
899
  transition: all 0.2s ease;
901
- background-image: linear-gradient(white, white), linear-gradient(var(--gray-300), var(--gray-300));
900
+ background-image: linear-gradient(white, white),
901
+ linear-gradient(var(--gray-300), var(--gray-300));
902
902
  background-origin: border-box;
903
903
  background-clip: padding-box, border-box;
904
904
  }
905
905
 
906
906
  .structured-checkbox-option:hover {
907
- background-image: linear-gradient(white, white), linear-gradient(45deg, #F3B51C, #E87C66, #F3B51C, #E87C66);
907
+ background-image: linear-gradient(white, white),
908
+ linear-gradient(45deg, #f3b51c, #e87c66, #f3b51c, #e87c66);
908
909
  background-size: auto, 300% 300%;
909
910
  animation: animatedgradient 3s ease alternate infinite;
910
911
  }
911
912
 
912
913
  .structured-checkbox-option:has(.structured-checkbox-input:checked) {
913
- background-image: linear-gradient(white, white), linear-gradient(45deg, #F3B51C, #E87C66);
914
+ background-image: linear-gradient(white, white),
915
+ linear-gradient(45deg, #f3b51c, #e87c66);
914
916
  }
915
917
 
916
-
917
-
918
918
  .structured-checkbox-input {
919
919
  width: 1.25rem;
920
920
  height: 1.25rem;
@@ -969,10 +969,11 @@
969
969
  width: 100%;
970
970
  height: 1rem;
971
971
  border-radius: 0.25rem;
972
- background: linear-gradient(90deg,
973
- #F3B51C 0%,
974
- #E87C66 var(--slider-fill),
975
- #e5e7eb var(--slider-fill),
972
+ background: linear-gradient(
973
+ 90deg,
974
+ #f3b51c 0%,
975
+ #e87c66 var(--slider-fill),
976
+ #e5e7eb var(--slider-fill),
976
977
  #e5e7eb 100%
977
978
  );
978
979
  background-size: 100% 100%;
@@ -985,10 +986,11 @@
985
986
  width: 100%;
986
987
  height: 1rem;
987
988
  border-radius: 0.25rem;
988
- background: linear-gradient(90deg,
989
- #F3B51C 0%,
990
- #E87C66 var(--slider-fill),
991
- #e5e7eb var(--slider-fill),
989
+ background: linear-gradient(
990
+ 90deg,
991
+ #f3b51c 0%,
992
+ #e87c66 var(--slider-fill),
993
+ #e5e7eb var(--slider-fill),
992
994
  #e5e7eb 100%
993
995
  );
994
996
  background-size: 100% 100%;
@@ -17,12 +17,10 @@ module MetaWorkflows
17
17
  local_assigns[:chat_id] || local_assigns[:current_step]&.chat&.id
18
18
  end
19
19
 
20
- # Consolidates all data fetching for the Lexi chat tray using service object
21
- def lexi_chat_data(record)
22
- LexiChatDataService.new(record).call
20
+ def lexi_chat_data(record, workflow_id:)
21
+ LexiChatDataService.new(record, workflow_id:).call
23
22
  end
24
23
 
25
- # Common locals for lexi chat input area
26
24
  def lexi_chat_input_locals(record, chat_data, wrapper_class)
27
25
  {
28
26
  record: record,
@@ -20,7 +20,7 @@ module MetaWorkflows
20
20
 
21
21
  # Initial execution methods
22
22
  def initial_execution?
23
- initial_execution
23
+ initial_execution != false || chat&.messages&.blank?
24
24
  end
25
25
 
26
26
  # Error handling methods
@@ -2,13 +2,18 @@
2
2
 
3
3
  module MetaWorkflows
4
4
  class LexiChatDataService < ApplicationService
5
- def initialize(record)
5
+ attr_reader :record, :workflow_id
6
+
7
+ def initialize(record, workflow_id:)
6
8
  super()
7
9
  @record = record
10
+ @workflow_id = workflow_id
8
11
  end
9
12
 
10
13
  def call
11
- executions = @record&.workflow_executions
14
+ return build_empty_data if @workflow_id.nil?
15
+
16
+ executions = @record.workflow_executions&.where(workflow_id: @workflow_id)
12
17
  active_execution = executions&.order(created_at: :desc)&.first
13
18
 
14
19
  if active_execution
@@ -20,8 +25,6 @@ module MetaWorkflows
20
25
 
21
26
  private
22
27
 
23
- attr_reader :record
24
-
25
28
  def build_active_execution_data(active_execution)
26
29
  current_step = active_execution.latest_workflow_step
27
30
  active_chat = active_execution.latest_chat
@@ -1,6 +1,5 @@
1
1
  <%# Lexi Chat Alpha Tray (Center Display) %>
2
- <% chat_data = lexi_chat_data(local_assigns[:record]) %>
3
-
2
+ <% chat_data = lexi_chat_data(local_assigns[:record], workflow_id: local_assigns[:workflow_id]) %>
4
3
 
5
4
  <div class="lexi-chat-alpha-tray">
6
5
  <%# Header with Lexi logo left and close button right %>
@@ -21,7 +20,7 @@
21
20
  <div class="lexi-chat-alpha-left-column">
22
21
  <%= image_tag("lexi-expanded2.png", alt: "Lexi Avatar", class: "lexi-avatar-large") %>
23
22
  </div>
24
-
23
+
25
24
  <!-- Main content area (chat + input) -->
26
25
  <%# Right column - Chat and Input %>
27
26
  <div class="lexi-chat-alpha-right-column">
@@ -29,7 +28,11 @@
29
28
  <%= render partial: meta_lexi_chat_messages, locals: {
30
29
  record: local_assigns[:record],
31
30
  chat_history: chat_data[:chat_history],
32
- container_class: 'lexi-chat-alpha-messages'
31
+ container_class: 'lexi-chat-alpha-messages',
32
+ workflow_execution: chat_data[:active_execution],
33
+ current_step: chat_data[:current_step],
34
+ structured_input_config: chat_data[:structured_input_config],
35
+ initial_load: true
33
36
  } %>
34
37
 
35
38
  <%# Input area (fixed at bottom) %>
@@ -38,4 +41,4 @@
38
41
  </div>
39
42
  </div>
40
43
  </div>
41
- </div>
44
+ </div>
@@ -1,20 +1,13 @@
1
1
  <%# Shared input area %>
2
2
  <div class="<%= local_assigns[:wrapper_class] || 'lexi-input-wrapper' %>" data-controller="meta-workflows--lexi-form-submit">
3
- <%= render meta_structured_input,
4
- record: local_assigns[:record],
5
- workflow_execution: local_assigns[:workflow_execution],
6
- current_step: local_assigns[:current_step],
7
- structured_input_config: local_assigns[:structured_input_config],
8
- initial_load: true %>
9
-
10
3
  <%= render partial: meta_response_form, locals: {
11
- record: local_assigns[:record],
12
- response_enabled: true,
4
+ record: local_assigns[:record],
5
+ response_enabled: true,
13
6
  workflow_execution_id: local_assigns[:workflow_execution]&.id,
14
7
  chat_id: local_assigns[:chat_id],
15
8
  step_has_repetitions: true,
16
9
  is_structured_input: local_assigns[:is_structured_input],
17
- show_skip_button: false,
18
- show_next_button: false
10
+ show_skip_button: false,
11
+ show_next_button: false
19
12
  } %>
20
- </div>
13
+ </div>
@@ -1,5 +1,5 @@
1
1
  <%# Shared chat messages area %>
2
- <div id="main-scroll-container" class="<%= local_assigns[:container_class] || 'lexi-chat-messages' %>">
2
+ <div id="main-scroll-container" class="<%= local_assigns[:container_class] || 'lexi-chat-messages' %>" data-controller="response-scroll">
3
3
  <%= render partial: meta_response, locals: {
4
4
  record: local_assigns[:record],
5
5
  chat_history: local_assigns[:chat_history],
@@ -10,4 +10,14 @@
10
10
  full_response: nil,
11
11
  error_message: nil
12
12
  } %>
13
- </div>
13
+
14
+ <%# Structured input area (inside scrollable chat container) %>
15
+ <div class="lexi-chat-structured-input-area">
16
+ <%= render meta_structured_input,
17
+ record: local_assigns[:record],
18
+ workflow_execution: local_assigns[:workflow_execution],
19
+ current_step: local_assigns[:current_step],
20
+ structured_input_config: local_assigns[:structured_input_config],
21
+ initial_load: local_assigns[:initial_load] %>
22
+ </div>
23
+ </div>
@@ -1,5 +1,5 @@
1
1
  <%# Lexi Chat Tray (Right Side) %>
2
- <% chat_data = lexi_chat_data(local_assigns[:record]) %>
2
+ <% chat_data = lexi_chat_data(local_assigns[:record], workflow_id: local_assigns[:workflow_id]) %>
3
3
 
4
4
 
5
5
  <div class="lexi-chat-tray lexi-chat-container-full">
@@ -22,17 +22,16 @@
22
22
  <%= render partial: meta_lexi_chat_messages, locals: {
23
23
  record: local_assigns[:record],
24
24
  chat_history: chat_data[:chat_history],
25
- container_class: 'lexi-chat-messages'
25
+ container_class: 'lexi-chat-messages',
26
+ workflow_execution: chat_data[:active_execution],
27
+ current_step: chat_data[:current_step],
28
+ structured_input_config: chat_data[:structured_input_config],
29
+ initial_load: true
26
30
  } %>
27
31
 
28
- <!-- Structured inputs area (above avatar) -->
29
- <div class="structured-input-area" data-controller="meta-workflows--lexi-form-submit">
30
- <%= render meta_structured_input, record: local_assigns[:record], structured_input_config: false, is_structured_input: false %>
31
- </div>
32
-
33
32
  <!-- Avatar and input area pinned to bottom -->
34
33
  <div class="lexi-chat-bottom">
35
34
  <%= image_tag("lexi-expanded.png", alt: "Lexi Avatar", class: "lexi-avatar") %>
36
35
  <%= render partial: meta_lexi_chat_input_area, locals: lexi_chat_input_locals(local_assigns[:record], chat_data, 'lexi-input-wrapper') %>
37
36
  </div>
38
- </div>
37
+ </div>
@@ -1,16 +1,16 @@
1
- <div class="structured-input-container"
2
- role="radiogroup"
1
+ <div class="structured-input-container"
2
+ role="radiogroup"
3
3
  aria-labelledby="structured-radio-legend"
4
4
  aria-required="true">
5
5
  <legend id="structured-radio-legend" class="sr-only">Select one option</legend>
6
6
  <div class="structured-input-options">
7
7
  <% options.each_with_index do |option, index| %>
8
8
  <div class="structured-radio-option">
9
- <input
10
- type="radio"
11
- id="single_choice_<%= index %>"
12
- name="single_choice_selection"
13
- value="<%= option['value'] %>"
9
+ <input
10
+ type="radio"
11
+ id="single_choice_<%= index %>"
12
+ name="single_choice_selection"
13
+ value="<%= option['value'] %>"
14
14
  class="structured-radio-input"
15
15
  data-meta-workflows--lexi-form-submit-target="structuredInput"
16
16
  data-action="change->meta-workflows--structured-form-submit#handleSubmit"
@@ -24,4 +24,4 @@
24
24
  <% end %>
25
25
  </div>
26
26
  <div id="structured-radio-help" class="sr-only">Use arrow keys to navigate between options</div>
27
- </div>
27
+ </div>
@@ -1,6 +1,6 @@
1
1
  <%= turbo_frame_tag target_frame_id(record) do %>
2
- <div id="response-content-container" class="lexi-response-container" data-controller="response-scroll">
3
-
2
+ <div id="response-content-container" class="lexi-response-container">
3
+
4
4
  <!-- Persistent Chat History Frame -->
5
5
  <%= render partial: meta_chat_history, locals: {
6
6
  record: record,
@@ -19,4 +19,4 @@
19
19
  } %>
20
20
 
21
21
  </div>
22
- <% end %>
22
+ <% end %>
@@ -1,17 +1,15 @@
1
1
  <%= turbo_frame_tag target_frame_id(record, structured_input: true) do %>
2
-
3
2
  <% if show_structured_input?(local_assigns, structured_input_config) %>
4
-
5
3
  <%= form_with url: structured_form_url(local_assigns[:workflow_execution]),
6
4
  method: :patch,
7
5
  id: "#{target_frame_id(record, structured_input: true)}_form",
8
- data: {
9
- controller: "meta-workflows--structured-form-submit",
6
+ data: {
7
+ controller: "meta-workflows--structured-form-submit",
10
8
  "meta-workflows--structured-form-submit-target": "form",
11
9
  "meta-workflows--lexi-form-submit-target": "structuredInputForm"
12
10
  } do |form| %>
13
11
  <%= form.hidden_field :chat_id, value: structured_chat_id(local_assigns) %>
14
-
12
+
15
13
  <div class="structured-input-wrapper">
16
14
  <% case structured_input_config['type'] %>
17
15
  <% when 'single_choice' %>
@@ -24,4 +22,4 @@
24
22
  </div>
25
23
  <% end %>
26
24
  <% end %>
27
- <% end %>
25
+ <% end %>
@@ -3,7 +3,7 @@
3
3
  module MetaWorkflows
4
4
  MAJOR = 0
5
5
  MINOR = 9
6
- PATCH = 42 # this is automatically incremented by the build process
6
+ PATCH = 44 # this is automatically incremented by the build process
7
7
 
8
8
  VERSION = "#{MetaWorkflows::MAJOR}.#{MetaWorkflows::MINOR}.#{MetaWorkflows::PATCH}".freeze
9
9
  end
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.42
4
+ version: 0.9.44
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-30 00:00:00.000000000 Z
12
+ date: 2025-07-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails