@nyaruka/temba-components 0.129.8 → 0.129.9

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.
Files changed (203) hide show
  1. package/CHANGELOG.md +27 -3
  2. package/demo/data/flows/sample-flow.json +186 -96
  3. package/dist/temba-components.js +414 -351
  4. package/dist/temba-components.js.map +1 -1
  5. package/out-tsc/src/events.js.map +1 -1
  6. package/out-tsc/src/excellent/helpers.js +2 -2
  7. package/out-tsc/src/excellent/helpers.js.map +1 -1
  8. package/out-tsc/src/flow/CanvasNode.js +25 -7
  9. package/out-tsc/src/flow/CanvasNode.js.map +1 -1
  10. package/out-tsc/src/flow/Editor.js +11 -1
  11. package/out-tsc/src/flow/Editor.js.map +1 -1
  12. package/out-tsc/src/flow/NodeEditor.js +133 -290
  13. package/out-tsc/src/flow/NodeEditor.js.map +1 -1
  14. package/out-tsc/src/flow/actions/add_input_labels.js +40 -0
  15. package/out-tsc/src/flow/actions/add_input_labels.js.map +1 -1
  16. package/out-tsc/src/flow/actions/call_llm.js +56 -3
  17. package/out-tsc/src/flow/actions/call_llm.js.map +1 -1
  18. package/out-tsc/src/flow/actions/call_webhook.js +1 -1
  19. package/out-tsc/src/flow/actions/call_webhook.js.map +1 -1
  20. package/out-tsc/src/flow/actions/open_ticket.js +65 -3
  21. package/out-tsc/src/flow/actions/open_ticket.js.map +1 -1
  22. package/out-tsc/src/flow/actions/set_run_result.js +75 -0
  23. package/out-tsc/src/flow/actions/set_run_result.js.map +1 -1
  24. package/out-tsc/src/flow/config.js +4 -0
  25. package/out-tsc/src/flow/config.js.map +1 -1
  26. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js +227 -0
  27. package/out-tsc/src/flow/nodes/split_by_llm_categorize.js.map +1 -0
  28. package/out-tsc/src/flow/nodes/split_by_ticket.js +18 -0
  29. package/out-tsc/src/flow/nodes/split_by_ticket.js.map +1 -0
  30. package/out-tsc/src/flow/nodes/wait_for_response.js +27 -1
  31. package/out-tsc/src/flow/nodes/wait_for_response.js.map +1 -1
  32. package/out-tsc/src/flow/types.js +0 -65
  33. package/out-tsc/src/flow/types.js.map +1 -1
  34. package/out-tsc/src/form/ArrayEditor.js +18 -61
  35. package/out-tsc/src/form/ArrayEditor.js.map +1 -1
  36. package/out-tsc/src/form/FieldRenderer.js +305 -0
  37. package/out-tsc/src/form/FieldRenderer.js.map +1 -0
  38. package/out-tsc/src/form/FormField.js +3 -3
  39. package/out-tsc/src/form/FormField.js.map +1 -1
  40. package/out-tsc/src/form/TextInput.js +1 -1
  41. package/out-tsc/src/form/TextInput.js.map +1 -1
  42. package/out-tsc/src/form/select/Select.js +48 -20
  43. package/out-tsc/src/form/select/Select.js.map +1 -1
  44. package/out-tsc/src/live/ContactChat.js +39 -13
  45. package/out-tsc/src/live/ContactChat.js.map +1 -1
  46. package/out-tsc/src/markdown.js +13 -11
  47. package/out-tsc/src/markdown.js.map +1 -1
  48. package/out-tsc/test/ActionHelper.js +2 -0
  49. package/out-tsc/test/ActionHelper.js.map +1 -1
  50. package/out-tsc/test/NodeHelper.js +148 -0
  51. package/out-tsc/test/NodeHelper.js.map +1 -0
  52. package/out-tsc/test/actions/call_llm.test.js +103 -0
  53. package/out-tsc/test/actions/call_llm.test.js.map +1 -0
  54. package/out-tsc/test/nodes/split_by_llm_categorize.test.js +532 -0
  55. package/out-tsc/test/nodes/split_by_llm_categorize.test.js.map +1 -0
  56. package/out-tsc/test/nodes/split_by_random.test.js +150 -0
  57. package/out-tsc/test/nodes/split_by_random.test.js.map +1 -0
  58. package/out-tsc/test/nodes/wait_for_digits.test.js +150 -0
  59. package/out-tsc/test/nodes/wait_for_digits.test.js.map +1 -0
  60. package/out-tsc/test/nodes/wait_for_response.test.js +171 -0
  61. package/out-tsc/test/nodes/wait_for_response.test.js.map +1 -0
  62. package/out-tsc/test/temba-add-input-labels.test.js +70 -0
  63. package/out-tsc/test/temba-add-input-labels.test.js.map +1 -0
  64. package/out-tsc/test/temba-field-renderer.test.js +296 -0
  65. package/out-tsc/test/temba-field-renderer.test.js.map +1 -0
  66. package/out-tsc/test/temba-markdown.test.js +1 -1
  67. package/out-tsc/test/temba-markdown.test.js.map +1 -1
  68. package/out-tsc/test/temba-node-editor.test.js +400 -0
  69. package/out-tsc/test/temba-node-editor.test.js.map +1 -1
  70. package/out-tsc/test/temba-select.test.js +6 -3
  71. package/out-tsc/test/temba-select.test.js.map +1 -1
  72. package/out-tsc/test/temba-webchat.test.js +1 -1
  73. package/out-tsc/test/temba-webchat.test.js.map +1 -1
  74. package/package.json +1 -1
  75. package/screenshots/truth/actions/add_contact_groups/editor/descriptive-group-names.png +0 -0
  76. package/screenshots/truth/actions/add_contact_groups/editor/long-group-names.png +0 -0
  77. package/screenshots/truth/actions/add_contact_groups/editor/many-groups.png +0 -0
  78. package/screenshots/truth/actions/call_llm/editor/information-extraction.png +0 -0
  79. package/screenshots/truth/actions/call_llm/editor/sentiment-analysis.png +0 -0
  80. package/screenshots/truth/actions/call_llm/editor/summarization.png +0 -0
  81. package/screenshots/truth/actions/call_llm/editor/translation-task.png +0 -0
  82. package/screenshots/truth/actions/call_llm/render/information-extraction.png +0 -0
  83. package/screenshots/truth/actions/call_llm/render/sentiment-analysis.png +0 -0
  84. package/screenshots/truth/actions/call_llm/render/summarization.png +0 -0
  85. package/screenshots/truth/actions/call_llm/render/translation-task.png +0 -0
  86. package/screenshots/truth/actions/remove_contact_groups/editor/long-descriptive-group-names.png +0 -0
  87. package/screenshots/truth/actions/remove_contact_groups/editor/many-groups.png +0 -0
  88. package/screenshots/truth/actions/remove_contact_groups/editor/remove-from-all-groups.png +0 -0
  89. package/screenshots/truth/actions/send_email/editor/complex-business-email.png +0 -0
  90. package/screenshots/truth/actions/send_email/editor/multiple-recipients.png +0 -0
  91. package/screenshots/truth/actions/send_msg/editor/long-quick-replies.png +0 -0
  92. package/screenshots/truth/actions/send_msg/editor/multiline-text-with-replies.png +0 -0
  93. package/screenshots/truth/actions/send_msg/editor/simple-text.png +0 -0
  94. package/screenshots/truth/actions/send_msg/editor/text-with-linebreaks.png +0 -0
  95. package/screenshots/truth/actions/send_msg/editor/text-with-many-quick-replies.png +0 -0
  96. package/screenshots/truth/actions/send_msg/editor/text-with-quick-replies.png +0 -0
  97. package/screenshots/truth/actions/send_msg/editor/text-without-quick-replies.png +0 -0
  98. package/screenshots/truth/editor/router.png +0 -0
  99. package/screenshots/truth/editor/send_msg.png +0 -0
  100. package/screenshots/truth/editor/set_contact_language.png +0 -0
  101. package/screenshots/truth/editor/set_contact_name.png +0 -0
  102. package/screenshots/truth/editor/set_run_result.png +0 -0
  103. package/screenshots/truth/editor/wait.png +0 -0
  104. package/screenshots/truth/field-renderer/checkbox-checked.png +0 -0
  105. package/screenshots/truth/field-renderer/checkbox-unchecked.png +0 -0
  106. package/screenshots/truth/field-renderer/checkbox-with-errors.png +0 -0
  107. package/screenshots/truth/field-renderer/context-comparison.png +0 -0
  108. package/screenshots/truth/field-renderer/key-value-with-label.png +0 -0
  109. package/screenshots/truth/field-renderer/message-editor-with-label.png +0 -0
  110. package/screenshots/truth/field-renderer/select-multi.png +0 -0
  111. package/screenshots/truth/field-renderer/select-no-label.png +0 -0
  112. package/screenshots/truth/field-renderer/select-with-label.png +0 -0
  113. package/screenshots/truth/field-renderer/text-evaluated.png +0 -0
  114. package/screenshots/truth/field-renderer/text-no-label.png +0 -0
  115. package/screenshots/truth/field-renderer/text-with-errors.png +0 -0
  116. package/screenshots/truth/field-renderer/text-with-label.png +0 -0
  117. package/screenshots/truth/field-renderer/textarea-evaluated.png +0 -0
  118. package/screenshots/truth/field-renderer/textarea-with-label.png +0 -0
  119. package/screenshots/truth/nodes/split_by_llm_categorize/editor/basic-categorization.png +0 -0
  120. package/screenshots/truth/nodes/split_by_llm_categorize/editor/custom-input-and-result-name.png +0 -0
  121. package/screenshots/truth/nodes/split_by_llm_categorize/editor/feedback-categorization.png +0 -0
  122. package/screenshots/truth/nodes/split_by_llm_categorize/editor/many-categories.png +0 -0
  123. package/screenshots/truth/nodes/split_by_llm_categorize/editor/minimal-categories.png +0 -0
  124. package/screenshots/truth/nodes/split_by_llm_categorize/render/basic-categorization.png +0 -0
  125. package/screenshots/truth/nodes/split_by_llm_categorize/render/custom-input-and-result-name.png +0 -0
  126. package/screenshots/truth/nodes/split_by_llm_categorize/render/feedback-categorization.png +0 -0
  127. package/screenshots/truth/nodes/split_by_llm_categorize/render/many-categories.png +0 -0
  128. package/screenshots/truth/nodes/split_by_llm_categorize/render/minimal-categories.png +0 -0
  129. package/screenshots/truth/nodes/split_by_random/editor/ab-test-multiple-variants.png +0 -0
  130. package/screenshots/truth/nodes/split_by_random/editor/sampling-split.png +0 -0
  131. package/screenshots/truth/nodes/split_by_random/editor/three-way-split.png +0 -0
  132. package/screenshots/truth/nodes/split_by_random/editor/two-bucket-split.png +0 -0
  133. package/screenshots/truth/nodes/split_by_random/render/ab-test-multiple-variants.png +0 -0
  134. package/screenshots/truth/nodes/split_by_random/render/sampling-split.png +0 -0
  135. package/screenshots/truth/nodes/split_by_random/render/three-way-split.png +0 -0
  136. package/screenshots/truth/nodes/split_by_random/render/two-bucket-split.png +0 -0
  137. package/screenshots/truth/nodes/wait_for_digits/editor/basic-digits-wait.png +0 -0
  138. package/screenshots/truth/nodes/wait_for_digits/editor/phone-number-collection.png +0 -0
  139. package/screenshots/truth/nodes/wait_for_digits/editor/single-digit-with-timeout.png +0 -0
  140. package/screenshots/truth/nodes/wait_for_digits/editor/verification-code.png +0 -0
  141. package/screenshots/truth/nodes/wait_for_digits/render/basic-digits-wait.png +0 -0
  142. package/screenshots/truth/nodes/wait_for_digits/render/phone-number-collection.png +0 -0
  143. package/screenshots/truth/nodes/wait_for_digits/render/single-digit-with-timeout.png +0 -0
  144. package/screenshots/truth/nodes/wait_for_digits/render/verification-code.png +0 -0
  145. package/screenshots/truth/nodes/wait_for_response/editor/basic-wait.png +0 -0
  146. package/screenshots/truth/nodes/wait_for_response/editor/custom-result-name.png +0 -0
  147. package/screenshots/truth/nodes/wait_for_response/editor/no-timeout.png +0 -0
  148. package/screenshots/truth/nodes/wait_for_response/editor/short-timeout.png +0 -0
  149. package/screenshots/truth/nodes/wait_for_response/render/basic-wait.png +0 -0
  150. package/screenshots/truth/nodes/wait_for_response/render/custom-result-name.png +0 -0
  151. package/screenshots/truth/nodes/wait_for_response/render/no-timeout.png +0 -0
  152. package/screenshots/truth/nodes/wait_for_response/render/short-timeout.png +0 -0
  153. package/screenshots/truth/omnibox/selected.png +0 -0
  154. package/screenshots/truth/select/functions.png +0 -0
  155. package/screenshots/truth/select/multi-with-endpoint.png +0 -0
  156. package/screenshots/truth/select/search-enabled.png +0 -0
  157. package/src/events.ts +8 -1
  158. package/src/excellent/helpers.ts +2 -2
  159. package/src/flow/CanvasNode.ts +22 -1
  160. package/src/flow/Editor.ts +12 -1
  161. package/src/flow/NodeEditor.ts +186 -374
  162. package/src/flow/actions/add_input_labels.ts +45 -0
  163. package/src/flow/actions/call_llm.ts +57 -3
  164. package/src/flow/actions/call_webhook.ts +1 -1
  165. package/src/flow/actions/open_ticket.ts +74 -3
  166. package/src/flow/actions/set_run_result.ts +83 -0
  167. package/src/flow/config.ts +4 -0
  168. package/src/flow/nodes/split_by_llm_categorize.ts +277 -0
  169. package/src/flow/nodes/split_by_ticket.ts +19 -0
  170. package/src/flow/nodes/wait_for_response.ts +28 -1
  171. package/src/flow/types.ts +26 -127
  172. package/src/form/ArrayEditor.ts +34 -82
  173. package/src/form/FieldRenderer.ts +465 -0
  174. package/src/form/FormField.ts +3 -3
  175. package/src/form/TextInput.ts +1 -1
  176. package/src/form/select/Select.ts +51 -20
  177. package/src/live/ContactChat.ts +39 -15
  178. package/src/markdown.ts +19 -11
  179. package/src/store/flow-definition.d.ts +5 -2
  180. package/static/api/labels.json +31 -0
  181. package/static/api/topics.json +24 -9
  182. package/static/api/users.json +35 -16
  183. package/static/css/temba-components.css +3 -3
  184. package/stress-test.js +18 -13
  185. package/test/ActionHelper.ts +2 -0
  186. package/test/NodeHelper.ts +184 -0
  187. package/test/actions/call_llm.test.ts +137 -0
  188. package/test/nodes/README.md +78 -0
  189. package/test/nodes/split_by_llm_categorize.test.ts +698 -0
  190. package/test/nodes/split_by_random.test.ts +177 -0
  191. package/test/nodes/wait_for_digits.test.ts +176 -0
  192. package/test/nodes/wait_for_response.test.ts +206 -0
  193. package/test/temba-add-input-labels.test.ts +87 -0
  194. package/test/temba-field-renderer.test.ts +482 -0
  195. package/test/temba-markdown.test.ts +1 -1
  196. package/test/temba-node-editor.test.ts +496 -0
  197. package/test/temba-select.test.ts +6 -6
  198. package/test/temba-webchat.test.ts +1 -1
  199. package/test-assets/select/llms.json +18 -0
  200. package/web-dev-mock.mjs +96 -6
  201. package/web-dev-server.config.mjs +29 -7
  202. package/test/temba-flow-editor.test.ts.backup +0 -563
  203. package/test/temba-utils-index.test.ts.backup +0 -1737
@@ -3,9 +3,71 @@ import { COLORS } from '../types';
3
3
  export const open_ticket = {
4
4
  name: 'Open Ticket',
5
5
  color: COLORS.create,
6
- render: (_node, _action) => {
7
- // This will need to be implemented based on the actual render logic
8
- return html `<div>Open Ticket</div>`;
6
+ render: (_node, action) => {
7
+ return html `<div>${action.topic.name}</div>`;
8
+ },
9
+ form: {
10
+ topic: {
11
+ type: 'select',
12
+ required: true,
13
+ placeholder: 'Select a topic',
14
+ options: [],
15
+ endpoint: '/api/v2/topics.json',
16
+ valueKey: 'uuid',
17
+ nameKey: 'name',
18
+ maxWidth: '200px'
19
+ },
20
+ assignee: {
21
+ type: 'select',
22
+ required: false,
23
+ placeholder: 'Select an agent (optional)',
24
+ options: [],
25
+ endpoint: '/api/v2/users.json',
26
+ valueKey: 'uuid',
27
+ getName: (item) => {
28
+ return item.name || [item.first_name, item.last_name].join(' ');
29
+ },
30
+ clearable: true
31
+ },
32
+ note: {
33
+ type: 'textarea',
34
+ required: false,
35
+ placeholder: 'Enter a note for the ticket (optional)',
36
+ minHeight: 100
37
+ }
38
+ },
39
+ layout: [{ type: 'row', items: ['topic', 'assignee'] }, 'note'],
40
+ toFormData: (action) => {
41
+ return {
42
+ uuid: action.uuid,
43
+ topic: action.topic
44
+ ? [{ uuid: action.topic.uuid, name: action.topic.name }]
45
+ : [],
46
+ assignee: action.assignee
47
+ ? [{ uuid: action.assignee.uuid, name: action.assignee.name }]
48
+ : [],
49
+ note: action.note || ''
50
+ };
51
+ },
52
+ fromFormData: (data) => {
53
+ return {
54
+ uuid: data.uuid,
55
+ type: 'open_ticket',
56
+ topic: data.topic && data.topic.length > 0
57
+ ? {
58
+ uuid: data.topic[0].uuid,
59
+ name: data.topic[0].name
60
+ }
61
+ : undefined,
62
+ assignee: data.assignee && data.assignee.length > 0
63
+ ? {
64
+ uuid: data.assignee[0].uuid,
65
+ name: data.assignee[0].name ||
66
+ [data.assignee[0].first_name, data.assignee[0].last_name].join(' ')
67
+ }
68
+ : undefined,
69
+ note: data.note || ''
70
+ };
9
71
  }
10
72
  };
11
73
  //# sourceMappingURL=open_ticket.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"open_ticket.js","sourceRoot":"","sources":["../../../../src/flow/actions/open_ticket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,WAAW,GAAiB;IACvC,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM;IACpB,MAAM,EAAE,CAAC,KAAW,EAAE,OAAmB,EAAE,EAAE;QAC3C,oEAAoE;QACpE,OAAO,IAAI,CAAA,wBAAwB,CAAC;IACtC,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, OpenTicket } from '../../store/flow-definition';\n\nexport const open_ticket: ActionConfig = {\n name: 'Open Ticket',\n color: COLORS.create,\n render: (_node: Node, _action: OpenTicket) => {\n // This will need to be implemented based on the actual render logic\n return html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,CAAC,CAAC,CAAC,CAAC,IAAI;wBACrB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,CAC5D,GAAG,CACJ;iBACJ;gBACH,CAAC,CAAC,SAAS;YACf,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,EAAE;SACR,CAAC;IAClB,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, OpenTicket } from '../../store/flow-definition';\n\nexport const open_ticket: ActionConfig = {\n name: 'Open Ticket',\n color: COLORS.create,\n render: (_node: Node, action: OpenTicket) => {\n return html`<div>${action.topic.name}</div>`;\n },\n form: {\n topic: {\n type: 'select',\n required: true,\n placeholder: 'Select a topic',\n options: [],\n endpoint: '/api/v2/topics.json',\n valueKey: 'uuid',\n nameKey: 'name',\n maxWidth: '200px'\n },\n assignee: {\n type: 'select',\n required: false,\n placeholder: 'Select an agent (optional)',\n options: [],\n endpoint: '/api/v2/users.json',\n valueKey: 'uuid',\n getName: (item: {\n first_name?: string;\n last_name?: string;\n name?: string;\n }) => {\n return item.name || [item.first_name, item.last_name].join(' ');\n },\n clearable: true\n },\n note: {\n type: 'textarea',\n required: false,\n placeholder: 'Enter a note for the ticket (optional)',\n minHeight: 100\n }\n },\n layout: [{ type: 'row', items: ['topic', 'assignee'] }, 'note'],\n toFormData: (action: OpenTicket) => {\n return {\n uuid: action.uuid,\n topic: action.topic\n ? [{ uuid: action.topic.uuid, name: action.topic.name }]\n : [],\n assignee: action.assignee\n ? [{ uuid: action.assignee.uuid, name: action.assignee.name }]\n : [],\n note: action.note || ''\n };\n },\n fromFormData: (data: Record<string, any>) => {\n return {\n uuid: data.uuid,\n type: 'open_ticket',\n topic:\n data.topic && data.topic.length > 0\n ? {\n uuid: data.topic[0].uuid,\n name: data.topic[0].name\n }\n : undefined,\n assignee:\n data.assignee && data.assignee.length > 0\n ? {\n uuid: data.assignee[0].uuid,\n name:\n data.assignee[0].name ||\n [data.assignee[0].first_name, data.assignee[0].last_name].join(\n ' '\n )\n }\n : undefined,\n note: data.note || ''\n } as OpenTicket;\n }\n};\n"]}
@@ -1,10 +1,85 @@
1
1
  import { html } from 'lit-html';
2
2
  import { COLORS } from '../types';
3
+ import { getStore } from '../../store/Store';
3
4
  export const set_run_result = {
4
5
  name: 'Save Flow Result',
5
6
  color: COLORS.save,
6
7
  render: (_node, action) => {
7
8
  return html `<div>Save ${action.value} as <b>${action.name}</b></div>`;
9
+ },
10
+ form: {
11
+ name: {
12
+ type: 'select',
13
+ label: 'Result Name',
14
+ helpText: 'Select an existing result name or type a new one',
15
+ required: true,
16
+ placeholder: 'Select or enter result name...',
17
+ createArbitraryOption: (input, options) => {
18
+ const exists = options.some((option) => option.value.toLowerCase() === input.toLowerCase() ||
19
+ option.name.toLowerCase() === input.toLowerCase());
20
+ return !exists && input.trim().length > 0
21
+ ? { value: input, name: input }
22
+ : null;
23
+ },
24
+ searchable: true,
25
+ clearable: false,
26
+ options: []
27
+ },
28
+ value: {
29
+ type: 'text',
30
+ label: 'Value',
31
+ helpText: 'The value to save for this result (can use expressions)',
32
+ required: false,
33
+ evaluated: true,
34
+ placeholder: 'Enter value...'
35
+ },
36
+ category: {
37
+ type: 'text',
38
+ label: 'Category',
39
+ helpText: 'Optional category for this result',
40
+ required: false,
41
+ placeholder: 'Enter category...'
42
+ }
43
+ },
44
+ layout: ['name', 'value', 'category'],
45
+ toFormData: (action) => {
46
+ // Get existing flow results to populate the select options
47
+ const store = getStore();
48
+ const flowResults = store ? store.getState().getFlowResults() : [];
49
+ // Update the form configuration with dynamic options
50
+ const config = set_run_result;
51
+ if (config.form && config.form.name && config.form.name.type === 'select') {
52
+ config.form.name.options = flowResults.map((result) => result.name);
53
+ }
54
+ return {
55
+ uuid: action.uuid,
56
+ name: action.name || '',
57
+ value: action.value || '',
58
+ category: action.category || ''
59
+ };
60
+ },
61
+ fromFormData: (formData) => {
62
+ // Ensure name is a simple string, handling both direct values and select option objects
63
+ let name = formData.name || '';
64
+ if (Array.isArray(name) && name.length > 0) {
65
+ // If it's an array (from multi-select), take the first item
66
+ name = name[0];
67
+ }
68
+ if (typeof name === 'object' && name.value) {
69
+ // If it's an option object, extract the value
70
+ name = name.value;
71
+ }
72
+ if (typeof name === 'object' && name.name) {
73
+ // If it's an option object with name property, extract it
74
+ name = name.name;
75
+ }
76
+ return {
77
+ uuid: formData.uuid,
78
+ type: 'set_run_result',
79
+ name: String(name), // Ensure it's always a string
80
+ value: formData.value || '',
81
+ category: formData.category || ''
82
+ };
8
83
  }
9
84
  };
10
85
  //# sourceMappingURL=set_run_result.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"set_run_result.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_run_result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAChC,OAAO,EAAgB,MAAM,EAAE,MAAM,UAAU,CAAC;AAGhD,MAAM,CAAC,MAAM,cAAc,GAAiB;IAC1C,IAAI,EAAE,kBAAkB;IACxB,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,MAAM,EAAE,CAAC,KAAW,EAAE,MAAoB,EAAE,EAAE;QAC5C,OAAO,IAAI,CAAA,aAAa,MAAM,CAAC,KAAK,UAAU,MAAM,CAAC,IAAI,YAAY,CAAC;IACxE,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetRunResult } from '../../store/flow-definition';\n\nexport const set_run_result: ActionConfig = {\n name: 'Save Flow Result',\n color: COLORS.save,\n render: (_node: Node, action: SetRunResult) => {\n return html`<div>Save ${action.value} as <b>${action.name}</b></div>`;\n }\n};\n"]}
1
+ {"version":3,"file":"set_run_result.js","sourceRoot":"","sources":["../../../../src/flow/actions/set_run_result.ts"],"names":[],"mappings":"AAAA,OAA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I,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,4DAA4D;YAC5D,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3C,8CAA8C;YAC9C,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QACD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1C,0DAA0D;YAC1D,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACnB,CAAC;QAED,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,8BAA8B;YAClD,KAAK,EAAE,QAAQ,CAAC,KAAK,IAAI,EAAE;YAC3B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,EAAE;SAClC,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { html } from 'lit-html';\nimport { ActionConfig, COLORS } from '../types';\nimport { Node, SetRunResult } from '../../store/flow-definition';\nimport { getStore } from '../../store/Store';\n\nexport const set_run_result: ActionConfig = {\n name: 'Save Flow Result',\n color: COLORS.save,\n render: (_node: Node, action: SetRunResult) => {\n return html`<div>Save ${action.value} as <b>${action.name}</b></div>`;\n },\n form: {\n name: {\n type: 'select',\n label: 'Result Name',\n helpText: 'Select an existing result name or type a new one',\n required: true,\n placeholder: 'Select or enter result name...',\n createArbitraryOption: (input, options) => {\n const exists = options.some(\n (option: any) =>\n option.value.toLowerCase() === input.toLowerCase() ||\n option.name.toLowerCase() === input.toLowerCase()\n );\n return !exists && input.trim().length > 0\n ? { value: input, name: input }\n : null;\n },\n searchable: true,\n clearable: false,\n options: []\n },\n value: {\n type: 'text',\n label: 'Value',\n helpText: 'The value to save for this result (can use expressions)',\n required: false,\n evaluated: true,\n placeholder: 'Enter value...'\n },\n category: {\n type: 'text',\n label: 'Category',\n helpText: 'Optional category for this result',\n required: false,\n placeholder: 'Enter category...'\n }\n },\n layout: ['name', 'value', 'category'],\n toFormData: (action: SetRunResult) => {\n // Get existing flow results to populate the select options\n const store = getStore();\n const flowResults = store ? store.getState().getFlowResults() : [];\n\n // Update the form configuration with dynamic options\n const config = set_run_result;\n if (config.form && config.form.name && config.form.name.type === 'select') {\n (config.form.name as any).options = flowResults.map(\n (result) => result.name\n );\n }\n\n return {\n uuid: action.uuid,\n name: action.name || '',\n value: action.value || '',\n category: action.category || ''\n };\n },\n fromFormData: (formData: any): SetRunResult => {\n // Ensure name is a simple string, handling both direct values and select option objects\n let name = formData.name || '';\n if (Array.isArray(name) && name.length > 0) {\n // If it's an array (from multi-select), take the first item\n name = name[0];\n }\n if (typeof name === 'object' && name.value) {\n // If it's an option object, extract the value\n name = name.value;\n }\n if (typeof name === 'object' && name.name) {\n // If it's an option object with name property, extract it\n name = name.name;\n }\n\n return {\n uuid: formData.uuid,\n type: 'set_run_result',\n name: String(name), // Ensure it's always a string\n value: formData.value || '',\n category: formData.category || ''\n };\n }\n};\n"]}
@@ -35,7 +35,9 @@ import { split_by_random } from './nodes/split_by_random';
35
35
  import { split_by_run_result } from './nodes/split_by_run_result';
36
36
  import { split_by_scheme } from './nodes/split_by_scheme';
37
37
  import { split_by_subflow } from './nodes/split_by_subflow';
38
+ import { split_by_ticket } from './nodes/split_by_ticket';
38
39
  import { split_by_webhook } from './nodes/split_by_webhook';
40
+ import { split_by_llm_categorize } from './nodes/split_by_llm_categorize';
39
41
  import { wait_for_audio } from './nodes/wait_for_audio';
40
42
  import { wait_for_digits } from './nodes/wait_for_digits';
41
43
  import { wait_for_image } from './nodes/wait_for_image';
@@ -75,10 +77,12 @@ export const NODE_CONFIG = {
75
77
  split_by_contact_field,
76
78
  split_by_expression,
77
79
  split_by_groups,
80
+ split_by_llm_categorize,
78
81
  split_by_random,
79
82
  split_by_run_result,
80
83
  split_by_scheme,
81
84
  split_by_subflow,
85
+ split_by_ticket,
82
86
  split_by_webhook,
83
87
  wait_for_audio,
84
88
  wait_for_digits,
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/flow/config.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,cAAc,SAAS,CAAC;AAGxB,mCAAmC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAA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BAAiB;IACjB,mBAAmB;IACnB,oBAAoB;IACpB,kBAAkB;IAClB,cAAc;IACd,cAAc;IACd,QAAQ;IACR,UAAU;IACV,aAAa;IACb,WAAW;IACX,YAAY;IACZ,eAAe;IACf,aAAa;IACb,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,OAAO;IACP,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,cAAc;CACf,CAAC","sourcesContent":["// Re-export all types and utilities\nexport * from './types';\nimport type { ActionConfig, NodeConfig } from './types';\n\n// Import all action configurations\nimport { add_input_labels } from './actions/add_input_labels';\nimport { add_contact_urn } from './actions/add_contact_urn';\nimport { set_contact_field } from './actions/set_contact_field';\nimport { set_contact_channel } from './actions/set_contact_channel';\nimport { set_contact_language } from './actions/set_contact_language';\nimport { set_contact_status } from './actions/set_contact_status';\nimport { send_broadcast } from './actions/send_broadcast';\nimport { set_run_result } from './actions/set_run_result';\nimport { send_msg } from './actions/send_msg';\nimport { send_email } from './actions/send_email';\nimport { start_session } from './actions/start_session';\nimport { open_ticket } from './actions/open_ticket';\nimport { call_webhook } from './actions/call_webhook';\nimport { call_classifier } from './actions/call_classifier';\nimport { call_resthook } from './actions/call_resthook';\nimport { call_llm } from './actions/call_llm';\nimport { transfer_airtime } from './actions/transfer_airtime';\nimport { set_contact_name } from './actions/set_contact_name';\nimport { add_contact_groups } from './actions/add_contact_groups';\nimport { remove_contact_groups } from './actions/remove_contact_groups';\nimport { request_optin } from './actions/request_optin';\nimport { say_msg } from './actions/say_msg';\nimport { play_audio } from './actions/play_audio';\nimport { enter_flow } from './actions/enter_flow';\n\n// Import all node configurations\nimport { execute_actions } from './nodes/execute_actions';\nimport { split_by_airtime } from './nodes/split_by_airtime';\nimport { split_by_contact_field } from './nodes/split_by_contact_field';\nimport { split_by_expression } from './nodes/split_by_expression';\nimport { split_by_groups } from './nodes/split_by_groups';\nimport { split_by_random } from './nodes/split_by_random';\nimport { split_by_run_result } from './nodes/split_by_run_result';\nimport { split_by_scheme } from './nodes/split_by_scheme';\nimport { split_by_subflow } from './nodes/split_by_subflow';\nimport { split_by_webhook } from './nodes/split_by_webhook';\nimport { wait_for_audio } from './nodes/wait_for_audio';\nimport { wait_for_digits } from './nodes/wait_for_digits';\nimport { wait_for_image } from './nodes/wait_for_image';\nimport { wait_for_location } from './nodes/wait_for_location';\nimport { wait_for_menu } from './nodes/wait_for_menu';\nimport { wait_for_response } from './nodes/wait_for_response';\nimport { wait_for_video } from './nodes/wait_for_video';\n\nexport const ACTION_CONFIG: {\n [key: string]: ActionConfig;\n} = {\n add_input_labels,\n add_contact_urn,\n set_contact_field,\n set_contact_channel,\n set_contact_language,\n set_contact_status,\n send_broadcast,\n set_run_result,\n send_msg,\n send_email,\n start_session,\n open_ticket,\n call_webhook,\n call_classifier,\n call_resthook,\n call_llm,\n enter_flow,\n transfer_airtime,\n set_contact_name,\n add_contact_groups,\n remove_contact_groups,\n request_optin,\n say_msg,\n play_audio\n};\n\nexport const NODE_CONFIG: {\n [key: string]: NodeConfig;\n} = {\n execute_actions,\n split_by_airtime,\n split_by_contact_field,\n split_by_expression,\n split_by_groups,\n split_by_random,\n split_by_run_result,\n split_by_scheme,\n split_by_subflow,\n split_by_webhook,\n wait_for_audio,\n wait_for_digits,\n wait_for_image,\n wait_for_location,\n wait_for_menu,\n wait_for_response,\n wait_for_video\n};\n"]}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/flow/config.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,cAAc,SAAS,CAAC;AAGxB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Y;IACZ,eAAe;IACf,aAAa;IACb,QAAQ;IACR,UAAU;IACV,gBAAgB;IAChB,gBAAgB;IAChB,kBAAkB;IAClB,qBAAqB;IACrB,aAAa;IACb,OAAO;IACP,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,eAAe;IACf,gBAAgB;IAChB,sBAAsB;IACtB,mBAAmB;IACnB,eAAe;IACf,uBAAuB;IACvB,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,gBAAgB;IAChB,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,eAAe;IACf,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,iBAAiB;IACjB,cAAc;CACf,CAAC","sourcesContent":["// Re-export all types and utilities\nexport * from './types';\nimport type { ActionConfig, NodeConfig } from './types';\n\n// Import all action configurations\nimport { add_input_labels } from './actions/add_input_labels';\nimport { add_contact_urn } from './actions/add_contact_urn';\nimport { set_contact_field } from './actions/set_contact_field';\nimport { set_contact_channel } from './actions/set_contact_channel';\nimport { set_contact_language } from './actions/set_contact_language';\nimport { set_contact_status } from './actions/set_contact_status';\nimport { send_broadcast } from './actions/send_broadcast';\nimport { set_run_result } from './actions/set_run_result';\nimport { send_msg } from './actions/send_msg';\nimport { send_email } from './actions/send_email';\nimport { start_session } from './actions/start_session';\nimport { open_ticket } from './actions/open_ticket';\nimport { call_webhook } from './actions/call_webhook';\nimport { call_classifier } from './actions/call_classifier';\nimport { call_resthook } from './actions/call_resthook';\nimport { call_llm } from './actions/call_llm';\nimport { transfer_airtime } from './actions/transfer_airtime';\nimport { set_contact_name } from './actions/set_contact_name';\nimport { add_contact_groups } from './actions/add_contact_groups';\nimport { remove_contact_groups } from './actions/remove_contact_groups';\nimport { request_optin } from './actions/request_optin';\nimport { say_msg } from './actions/say_msg';\nimport { play_audio } from './actions/play_audio';\nimport { enter_flow } from './actions/enter_flow';\n\n// Import all node configurations\nimport { execute_actions } from './nodes/execute_actions';\nimport { split_by_airtime } from './nodes/split_by_airtime';\nimport { split_by_contact_field } from './nodes/split_by_contact_field';\nimport { split_by_expression } from './nodes/split_by_expression';\nimport { split_by_groups } from './nodes/split_by_groups';\nimport { split_by_random } from './nodes/split_by_random';\nimport { split_by_run_result } from './nodes/split_by_run_result';\nimport { split_by_scheme } from './nodes/split_by_scheme';\nimport { split_by_subflow } from './nodes/split_by_subflow';\nimport { split_by_ticket } from './nodes/split_by_ticket';\nimport { split_by_webhook } from './nodes/split_by_webhook';\nimport { split_by_llm_categorize } from './nodes/split_by_llm_categorize';\nimport { wait_for_audio } from './nodes/wait_for_audio';\nimport { wait_for_digits } from './nodes/wait_for_digits';\nimport { wait_for_image } from './nodes/wait_for_image';\nimport { wait_for_location } from './nodes/wait_for_location';\nimport { wait_for_menu } from './nodes/wait_for_menu';\nimport { wait_for_response } from './nodes/wait_for_response';\nimport { wait_for_video } from './nodes/wait_for_video';\n\nexport const ACTION_CONFIG: {\n [key: string]: ActionConfig;\n} = {\n add_input_labels,\n add_contact_urn,\n set_contact_field,\n set_contact_channel,\n set_contact_language,\n set_contact_status,\n send_broadcast,\n set_run_result,\n send_msg,\n send_email,\n start_session,\n open_ticket,\n call_webhook,\n call_classifier,\n call_resthook,\n call_llm,\n enter_flow,\n transfer_airtime,\n set_contact_name,\n add_contact_groups,\n remove_contact_groups,\n request_optin,\n say_msg,\n play_audio\n};\n\nexport const NODE_CONFIG: {\n [key: string]: NodeConfig;\n} = {\n execute_actions,\n split_by_airtime,\n split_by_contact_field,\n split_by_expression,\n split_by_groups,\n split_by_llm_categorize,\n split_by_random,\n split_by_run_result,\n split_by_scheme,\n split_by_subflow,\n split_by_ticket,\n split_by_webhook,\n wait_for_audio,\n wait_for_digits,\n wait_for_image,\n wait_for_location,\n wait_for_menu,\n wait_for_response,\n wait_for_video\n};\n"]}
@@ -0,0 +1,227 @@
1
+ import { COLORS } from '../types';
2
+ import { generateUUID } from '../../utils';
3
+ import { html } from 'lit';
4
+ export const split_by_llm_categorize = {
5
+ type: 'split_by_llm_categorize',
6
+ name: 'Split by AI',
7
+ color: COLORS.call,
8
+ form: {
9
+ llm: {
10
+ type: 'select',
11
+ label: 'LLM',
12
+ helpText: 'Select the LLM to use for categorization',
13
+ required: true,
14
+ endpoint: '/test-assets/select/llms.json',
15
+ valueKey: 'uuid',
16
+ nameKey: 'name',
17
+ placeholder: 'Select an LLM...'
18
+ },
19
+ input: {
20
+ type: 'text',
21
+ label: 'Input',
22
+ helpText: 'The input to categorize (usually @input)',
23
+ required: true,
24
+ evaluated: true,
25
+ placeholder: '@input'
26
+ },
27
+ categories: {
28
+ type: 'array',
29
+ label: 'Categories',
30
+ helpText: 'Define the categories for classification',
31
+ required: true,
32
+ itemLabel: 'Category',
33
+ minItems: 1,
34
+ maxItems: 10,
35
+ isEmptyItem: (item) => {
36
+ return !item.name || item.name.trim() === '';
37
+ },
38
+ itemConfig: {
39
+ name: {
40
+ type: 'text',
41
+ placeholder: 'Category name',
42
+ required: true
43
+ }
44
+ }
45
+ }
46
+ },
47
+ layout: ['llm', 'input', 'categories'],
48
+ validate: (formData) => {
49
+ const errors = {};
50
+ // Check for duplicate category names
51
+ if (formData.categories && Array.isArray(formData.categories)) {
52
+ const categories = formData.categories.filter((item) => (item === null || item === void 0 ? void 0 : item.name) && item.name.trim() !== '');
53
+ // Find all categories that have duplicates (case-insensitive)
54
+ const duplicateCategories = [];
55
+ const lowerCaseMap = new Map();
56
+ // First pass: map lowercase names to all original cases
57
+ categories.forEach((category) => {
58
+ const lowerName = category.name.trim().toLowerCase();
59
+ if (!lowerCaseMap.has(lowerName)) {
60
+ lowerCaseMap.set(lowerName, []);
61
+ }
62
+ lowerCaseMap.get(lowerName).push(category.name.trim());
63
+ });
64
+ // Second pass: collect all names that appear more than once
65
+ lowerCaseMap.forEach((originalNames) => {
66
+ if (originalNames.length > 1) {
67
+ duplicateCategories.push(...originalNames);
68
+ }
69
+ });
70
+ if (duplicateCategories.length > 0) {
71
+ const uniqueDuplicates = [...new Set(duplicateCategories)];
72
+ errors.categories = `Duplicate category names found: ${uniqueDuplicates.join(', ')}`;
73
+ }
74
+ }
75
+ return {
76
+ valid: Object.keys(errors).length === 0,
77
+ errors
78
+ };
79
+ },
80
+ render: (node) => {
81
+ var _a;
82
+ const callLlmAction = (_a = node.actions) === null || _a === void 0 ? void 0 : _a.find((action) => action.type === 'call_llm');
83
+ return html `
84
+ <div class="body">Categorize with ${callLlmAction.llm.name}</div>
85
+ `;
86
+ },
87
+ toFormData: (node) => {
88
+ var _a, _b, _c;
89
+ // Extract data from the existing node structure
90
+ const callLlmAction = (_a = node.actions) === null || _a === void 0 ? void 0 : _a.find((action) => action.type === 'call_llm');
91
+ const categories = ((_c = (_b = node.router) === null || _b === void 0 ? void 0 : _b.categories) === null || _c === void 0 ? void 0 : _c.filter((cat) => cat.name !== 'Other' && cat.name !== 'Failure').map((cat) => ({ name: cat.name }))) || [];
92
+ return {
93
+ uuid: node.uuid,
94
+ llm: (callLlmAction === null || callLlmAction === void 0 ? void 0 : callLlmAction.llm)
95
+ ? [{ value: callLlmAction.llm.uuid, name: callLlmAction.llm.name }]
96
+ : [],
97
+ input: (callLlmAction === null || callLlmAction === void 0 ? void 0 : callLlmAction.input) || '@input',
98
+ categories: categories
99
+ };
100
+ },
101
+ fromFormData: (formData, originalNode) => {
102
+ var _a, _b, _c;
103
+ // Get LLM selection
104
+ const llmSelection = Array.isArray(formData.llm) && formData.llm.length > 0
105
+ ? formData.llm[0]
106
+ : null;
107
+ // Get user categories
108
+ const userCategories = (formData.categories || [])
109
+ .filter((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.name) === null || _a === void 0 ? void 0 : _a.trim(); })
110
+ .map((item) => item.name.trim());
111
+ // Find existing call_llm action to preserve its UUID
112
+ const existingCallLlmAction = (_a = originalNode.actions) === null || _a === void 0 ? void 0 : _a.find((action) => action.type === 'call_llm');
113
+ const callLlmUuid = (existingCallLlmAction === null || existingCallLlmAction === void 0 ? void 0 : existingCallLlmAction.uuid) || generateUUID();
114
+ // Create call_llm action (using any type to match the example format)
115
+ const callLlmAction = {
116
+ type: 'call_llm',
117
+ uuid: callLlmUuid,
118
+ llm: llmSelection
119
+ ? { uuid: llmSelection.value, name: llmSelection.name }
120
+ : { uuid: '', name: '' },
121
+ instructions: `@(prompt("categorize", slice(node.categories, 0, -2)))`,
122
+ input: formData.input || '@input',
123
+ output_local: '_llm_output'
124
+ };
125
+ // Create categories and exits
126
+ const categories = [];
127
+ const exits = [];
128
+ const cases = [];
129
+ // Get existing categories from original node for UUID preservation
130
+ const existingCategories = ((_b = originalNode.router) === null || _b === void 0 ? void 0 : _b.categories) || [];
131
+ const existingExits = originalNode.exits || [];
132
+ const existingCases = ((_c = originalNode.router) === null || _c === void 0 ? void 0 : _c.cases) || [];
133
+ // Add user categories
134
+ userCategories.forEach((categoryName) => {
135
+ // Check if this category already exists
136
+ const existingCategory = existingCategories.find((cat) => cat.name === categoryName);
137
+ const existingExit = existingCategory
138
+ ? existingExits.find((exit) => exit.uuid === existingCategory.exit_uuid)
139
+ : null;
140
+ const existingCase = existingCategory
141
+ ? existingCases.find((case_) => case_.category_uuid === existingCategory.uuid)
142
+ : null;
143
+ // Use existing UUIDs if category name hasn't changed, otherwise generate new ones
144
+ const categoryUuid = (existingCategory === null || existingCategory === void 0 ? void 0 : existingCategory.uuid) || generateUUID();
145
+ const exitUuid = (existingExit === null || existingExit === void 0 ? void 0 : existingExit.uuid) || generateUUID();
146
+ const caseUuid = (existingCase === null || existingCase === void 0 ? void 0 : existingCase.uuid) || generateUUID();
147
+ categories.push({
148
+ uuid: categoryUuid,
149
+ name: categoryName,
150
+ exit_uuid: exitUuid
151
+ });
152
+ exits.push({
153
+ uuid: exitUuid,
154
+ destination_uuid: (existingExit === null || existingExit === void 0 ? void 0 : existingExit.destination_uuid) || null
155
+ });
156
+ cases.push({
157
+ uuid: caseUuid,
158
+ type: 'has_only_text',
159
+ arguments: [categoryName],
160
+ category_uuid: categoryUuid
161
+ });
162
+ });
163
+ // Add "Other" category (default)
164
+ const existingOtherCategory = existingCategories.find((cat) => cat.name === 'Other');
165
+ const existingOtherExit = existingOtherCategory
166
+ ? existingExits.find((exit) => exit.uuid === existingOtherCategory.exit_uuid)
167
+ : null;
168
+ const otherCategoryUuid = (existingOtherCategory === null || existingOtherCategory === void 0 ? void 0 : existingOtherCategory.uuid) || generateUUID();
169
+ const otherExitUuid = (existingOtherExit === null || existingOtherExit === void 0 ? void 0 : existingOtherExit.uuid) || generateUUID();
170
+ categories.push({
171
+ uuid: otherCategoryUuid,
172
+ name: 'Other',
173
+ exit_uuid: otherExitUuid
174
+ });
175
+ exits.push({
176
+ uuid: otherExitUuid,
177
+ destination_uuid: (existingOtherExit === null || existingOtherExit === void 0 ? void 0 : existingOtherExit.destination_uuid) || null
178
+ });
179
+ // Add "Failure" category
180
+ const existingFailureCategory = existingCategories.find((cat) => cat.name === 'Failure');
181
+ const existingFailureExit = existingFailureCategory
182
+ ? existingExits.find((exit) => exit.uuid === existingFailureCategory.exit_uuid)
183
+ : null;
184
+ const existingFailureCase = existingFailureCategory
185
+ ? existingCases.find((case_) => {
186
+ var _a;
187
+ return case_.category_uuid === existingFailureCategory.uuid &&
188
+ ((_a = case_.arguments) === null || _a === void 0 ? void 0 : _a[0]) === '<ERROR>';
189
+ })
190
+ : null;
191
+ const failureCategoryUuid = (existingFailureCategory === null || existingFailureCategory === void 0 ? void 0 : existingFailureCategory.uuid) || generateUUID();
192
+ const failureExitUuid = (existingFailureExit === null || existingFailureExit === void 0 ? void 0 : existingFailureExit.uuid) || generateUUID();
193
+ const failureCaseUuid = (existingFailureCase === null || existingFailureCase === void 0 ? void 0 : existingFailureCase.uuid) || generateUUID();
194
+ categories.push({
195
+ uuid: failureCategoryUuid,
196
+ name: 'Failure',
197
+ exit_uuid: failureExitUuid
198
+ });
199
+ exits.push({
200
+ uuid: failureExitUuid,
201
+ destination_uuid: (existingFailureExit === null || existingFailureExit === void 0 ? void 0 : existingFailureExit.destination_uuid) || null
202
+ });
203
+ // Add failure case for <ERROR>
204
+ cases.push({
205
+ uuid: failureCaseUuid,
206
+ type: 'has_only_text',
207
+ arguments: ['<ERROR>'],
208
+ category_uuid: failureCategoryUuid
209
+ });
210
+ // Create the router
211
+ const router = {
212
+ type: 'switch',
213
+ categories: categories,
214
+ default_category_uuid: otherCategoryUuid,
215
+ operand: '@locals._llm_output',
216
+ cases: cases
217
+ };
218
+ // Return the complete node
219
+ return {
220
+ uuid: originalNode.uuid,
221
+ actions: [callLlmAction],
222
+ router: router,
223
+ exits: exits
224
+ };
225
+ }
226
+ };
227
+ //# sourceMappingURL=split_by_llm_categorize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split_by_llm_categorize.js","sourceRoot":"","sources":["../../../../src/flow/nodes/split_by_llm_categorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAE3B,MAAM,CAAC,MAAM,uBAAuB,GAAe;IACjD,IAAI,EAAE,yBAAyB;IAC/B,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,KAAK;YACZ,QAAQ,EAAE,0CAA0C;YACpD,QAAQ,EAAE,IAAI;YACd,QAAQ,EAAE,+BAA+B;YACzC,QAAQ,EAAE,MAAM;YAChB,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,kBAAkB;SAChC;QACD,KAAK,EAAE;YACL,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,OAAO;YACd,QAAQ,EAAE,0CAA0C;YACpD,QAAQ,EAAE,IAAI;YACd,SAAS,EAAE,IAAI;YACf,WAAW,EAAE,QAAQ;SACtB;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO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A2B;QAC3B,OAAO;YACL,IAAI,EAAE,YAAY,CAAC,IAAI;YACvB,OAAO,EAAE,CAAC,aAAa,CAAC;YACxB,MAAM,EAAE,MAAM;YACd,KAAK,EAAE,KAAK;SACb,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { COLORS, NodeConfig } from '../types';\nimport { Node } from '../../store/flow-definition';\nimport { generateUUID } from '../../utils';\nimport { html } from 'lit';\n\nexport const split_by_llm_categorize: NodeConfig = {\n type: 'split_by_llm_categorize',\n name: 'Split by AI',\n color: COLORS.call,\n form: {\n llm: {\n type: 'select',\n label: 'LLM',\n helpText: 'Select the LLM to use for categorization',\n required: true,\n endpoint: '/test-assets/select/llms.json',\n valueKey: 'uuid',\n nameKey: 'name',\n placeholder: 'Select an LLM...'\n },\n input: {\n type: 'text',\n label: 'Input',\n helpText: 'The input to categorize (usually @input)',\n required: true,\n evaluated: true,\n placeholder: '@input'\n },\n categories: {\n type: 'array',\n label: 'Categories',\n helpText: 'Define the categories for classification',\n required: true,\n itemLabel: 'Category',\n minItems: 1,\n maxItems: 10,\n isEmptyItem: (item: any) => {\n return !item.name || item.name.trim() === '';\n },\n itemConfig: {\n name: {\n type: 'text',\n placeholder: 'Category name',\n required: true\n }\n }\n }\n },\n layout: ['llm', 'input', 'categories'],\n validate: (formData: any) => {\n const errors: { [key: string]: string } = {};\n\n // Check for duplicate category names\n if (formData.categories && Array.isArray(formData.categories)) {\n const categories = formData.categories.filter(\n (item: any) => item?.name && item.name.trim() !== ''\n );\n\n // Find all categories that have duplicates (case-insensitive)\n const duplicateCategories = [];\n const lowerCaseMap = new Map();\n\n // First pass: map lowercase names to all original cases\n categories.forEach((category) => {\n const lowerName = category.name.trim().toLowerCase();\n if (!lowerCaseMap.has(lowerName)) {\n lowerCaseMap.set(lowerName, []);\n }\n lowerCaseMap.get(lowerName).push(category.name.trim());\n });\n\n // Second pass: collect all names that appear more than once\n lowerCaseMap.forEach((originalNames) => {\n if (originalNames.length > 1) {\n duplicateCategories.push(...originalNames);\n }\n });\n\n if (duplicateCategories.length > 0) {\n const uniqueDuplicates = [...new Set(duplicateCategories)];\n errors.categories = `Duplicate category names found: ${uniqueDuplicates.join(\n ', '\n )}`;\n }\n }\n\n return {\n valid: Object.keys(errors).length === 0,\n errors\n };\n },\n render: (node: Node) => {\n const callLlmAction = node.actions?.find(\n (action) => action.type === 'call_llm'\n ) as any;\n return html`\n <div class=\"body\">Categorize with ${callLlmAction.llm.name}</div>\n `;\n },\n toFormData: (node: Node) => {\n // Extract data from the existing node structure\n const callLlmAction = node.actions?.find(\n (action) => action.type === 'call_llm'\n ) as any;\n const categories =\n node.router?.categories\n ?.filter((cat) => cat.name !== 'Other' && cat.name !== 'Failure')\n .map((cat) => ({ name: cat.name })) || [];\n\n return {\n uuid: node.uuid,\n llm: callLlmAction?.llm\n ? [{ value: callLlmAction.llm.uuid, name: callLlmAction.llm.name }]\n : [],\n input: callLlmAction?.input || '@input',\n categories: categories\n };\n },\n fromFormData: (formData: any, originalNode: Node): Node => {\n // Get LLM selection\n const llmSelection =\n Array.isArray(formData.llm) && formData.llm.length > 0\n ? formData.llm[0]\n : null;\n\n // Get user categories\n const userCategories = (formData.categories || [])\n .filter((item: any) => item?.name?.trim())\n .map((item: any) => item.name.trim());\n\n // Find existing call_llm action to preserve its UUID\n const existingCallLlmAction = originalNode.actions?.find(\n (action) => action.type === 'call_llm'\n );\n const callLlmUuid = existingCallLlmAction?.uuid || generateUUID();\n\n // Create call_llm action (using any type to match the example format)\n const callLlmAction: any = {\n type: 'call_llm',\n uuid: callLlmUuid,\n llm: llmSelection\n ? { uuid: llmSelection.value, name: llmSelection.name }\n : { uuid: '', name: '' },\n instructions: `@(prompt(\"categorize\", slice(node.categories, 0, -2)))`,\n input: formData.input || '@input',\n output_local: '_llm_output'\n };\n\n // Create categories and exits\n const categories = [];\n const exits = [];\n const cases = [];\n\n // Get existing categories from original node for UUID preservation\n const existingCategories = originalNode.router?.categories || [];\n const existingExits = originalNode.exits || [];\n const existingCases = originalNode.router?.cases || [];\n\n // Add user categories\n userCategories.forEach((categoryName: string) => {\n // Check if this category already exists\n const existingCategory = existingCategories.find(\n (cat) => cat.name === categoryName\n );\n const existingExit = existingCategory\n ? existingExits.find((exit) => exit.uuid === existingCategory.exit_uuid)\n : null;\n const existingCase = existingCategory\n ? existingCases.find(\n (case_) => case_.category_uuid === existingCategory.uuid\n )\n : null;\n\n // Use existing UUIDs if category name hasn't changed, otherwise generate new ones\n const categoryUuid = existingCategory?.uuid || generateUUID();\n const exitUuid = existingExit?.uuid || generateUUID();\n const caseUuid = existingCase?.uuid || generateUUID();\n\n categories.push({\n uuid: categoryUuid,\n name: categoryName,\n exit_uuid: exitUuid\n });\n\n exits.push({\n uuid: exitUuid,\n destination_uuid: existingExit?.destination_uuid || null\n });\n\n cases.push({\n uuid: caseUuid,\n type: 'has_only_text',\n arguments: [categoryName],\n category_uuid: categoryUuid\n });\n });\n\n // Add \"Other\" category (default)\n const existingOtherCategory = existingCategories.find(\n (cat) => cat.name === 'Other'\n );\n const existingOtherExit = existingOtherCategory\n ? existingExits.find(\n (exit) => exit.uuid === existingOtherCategory.exit_uuid\n )\n : null;\n\n const otherCategoryUuid = existingOtherCategory?.uuid || generateUUID();\n const otherExitUuid = existingOtherExit?.uuid || generateUUID();\n\n categories.push({\n uuid: otherCategoryUuid,\n name: 'Other',\n exit_uuid: otherExitUuid\n });\n exits.push({\n uuid: otherExitUuid,\n destination_uuid: existingOtherExit?.destination_uuid || null\n });\n\n // Add \"Failure\" category\n const existingFailureCategory = existingCategories.find(\n (cat) => cat.name === 'Failure'\n );\n const existingFailureExit = existingFailureCategory\n ? existingExits.find(\n (exit) => exit.uuid === existingFailureCategory.exit_uuid\n )\n : null;\n const existingFailureCase = existingFailureCategory\n ? existingCases.find(\n (case_) =>\n case_.category_uuid === existingFailureCategory.uuid &&\n case_.arguments?.[0] === '<ERROR>'\n )\n : null;\n\n const failureCategoryUuid = existingFailureCategory?.uuid || generateUUID();\n const failureExitUuid = existingFailureExit?.uuid || generateUUID();\n const failureCaseUuid = existingFailureCase?.uuid || generateUUID();\n\n categories.push({\n uuid: failureCategoryUuid,\n name: 'Failure',\n exit_uuid: failureExitUuid\n });\n exits.push({\n uuid: failureExitUuid,\n destination_uuid: existingFailureExit?.destination_uuid || null\n });\n\n // Add failure case for <ERROR>\n cases.push({\n uuid: failureCaseUuid,\n type: 'has_only_text',\n arguments: ['<ERROR>'],\n category_uuid: failureCategoryUuid\n });\n\n // Create the router\n const router = {\n type: 'switch' as const,\n categories: categories,\n default_category_uuid: otherCategoryUuid,\n operand: '@locals._llm_output',\n cases: cases\n };\n\n // Return the complete node\n return {\n uuid: originalNode.uuid,\n actions: [callLlmAction],\n router: router,\n exits: exits\n };\n }\n};\n"]}
@@ -0,0 +1,18 @@
1
+ import { open_ticket } from '../actions/open_ticket';
2
+ export const split_by_ticket = {
3
+ type: 'split_by_ticket',
4
+ action: open_ticket,
5
+ router: {
6
+ type: 'switch',
7
+ defaultCategory: 'Failure',
8
+ operand: '@locals._new_ticket',
9
+ rules: [
10
+ {
11
+ type: 'has_text',
12
+ arguments: [],
13
+ categoryName: 'Success'
14
+ }
15
+ ]
16
+ }
17
+ };
18
+ //# sourceMappingURL=split_by_ticket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"split_by_ticket.js","sourceRoot":"","sources":["../../../../src/flow/nodes/split_by_ticket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,MAAM,CAAC,MAAM,eAAe,GAAe;IACzC,IAAI,EAAE,iBAAiB;IACvB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,qBAAqB;QAC9B,KAAK,EAAE;YACL;gBACE,IAAI,EAAE,UAAU;gBAChB,SAAS,EAAE,EAAE;gBACb,YAAY,EAAE,SAAS;aACxB;SACF;KACF;CACF,CAAC","sourcesContent":["import { open_ticket } from '../actions/open_ticket';\nimport { NodeConfig } from '../types';\n\nexport const split_by_ticket: NodeConfig = {\n type: 'split_by_ticket',\n action: open_ticket,\n router: {\n type: 'switch',\n defaultCategory: 'Failure',\n operand: '@locals._new_ticket',\n rules: [\n {\n type: 'has_text',\n arguments: [],\n categoryName: 'Success'\n }\n ]\n }\n};\n"]}
@@ -2,6 +2,32 @@ import { COLORS } from '../types';
2
2
  export const wait_for_response = {
3
3
  type: 'wait_for_response',
4
4
  name: 'Wait for Response',
5
- color: COLORS.wait
5
+ color: COLORS.wait,
6
+ form: {
7
+ result_name: {
8
+ type: 'text',
9
+ label: 'Result Name',
10
+ helpText: 'The name to save the response as',
11
+ placeholder: 'response'
12
+ }
13
+ },
14
+ layout: ['timeout', 'result_name'],
15
+ toFormData: (node) => {
16
+ var _a;
17
+ return {
18
+ uuid: node.uuid,
19
+ result_name: ((_a = node.router) === null || _a === void 0 ? void 0 : _a.result_name) || 'response'
20
+ };
21
+ },
22
+ fromFormData: (formData, originalNode) => {
23
+ const router = {
24
+ ...originalNode.router,
25
+ result_name: formData.result_name || 'response'
26
+ };
27
+ return {
28
+ ...originalNode,
29
+ router
30
+ };
31
+ }
6
32
  };
7
33
  //# sourceMappingURL=wait_for_response.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wait_for_response.js","sourceRoot":"","sources":["../../../../src/flow/nodes/wait_for_response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,MAAM,CAAC,IAAI;CACnB,CAAC","sourcesContent":["import { COLORS, NodeConfig } from '../types';\n\nexport const wait_for_response: NodeConfig = {\n type: 'wait_for_response',\n name: 'Wait for Response',\n color: COLORS.wait\n};\n"]}
1
+ {"version":3,"file":"wait_for_response.js","sourceRoot":"","sources":["../../../../src/flow/nodes/wait_for_response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AAG9C,MAAM,CAAC,MAAM,iBAAiB,GAAe;IAC3C,IAAI,EAAE,mBAAmB;IACzB,IAAI,EAAE,mBAAmB;IACzB,KAAK,EAAE,MAAM,CAAC,IAAI;IAClB,IAAI,EAAE;QACJ,WAAW,EAAE;YACX,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,aAAa;YACpB,QAAQ,EAAE,kCAAkC;YAC5C,WAAW,EAAE,UAAU;SACxB;KACF;IACD,MAAM,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,UAAU,EAAE,CAAC,IAAU,EAAE,EAAE;;QACzB,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,CAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,WAAW,KAAI,UAAU;SACpD,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,CAAC,QAAa,EAAE,YAAkB,EAAQ,EAAE;QACxD,MAAM,MAAM,GAAQ;YAClB,GAAG,YAAY,CAAC,MAAM;YACtB,WAAW,EAAE,QAAQ,CAAC,WAAW,IAAI,UAAU;SAChD,CAAC;QAEF,OAAO;YACL,GAAG,YAAY;YACf,MAAM;SACP,CAAC;IACJ,CAAC;CACF,CAAC","sourcesContent":["import { COLORS, NodeConfig } from '../types';\nimport { Node } from '../../store/flow-definition';\n\nexport const wait_for_response: NodeConfig = {\n type: 'wait_for_response',\n name: 'Wait for Response',\n color: COLORS.wait,\n form: {\n result_name: {\n type: 'text',\n label: 'Result Name',\n helpText: 'The name to save the response as',\n placeholder: 'response'\n }\n },\n layout: ['timeout', 'result_name'],\n toFormData: (node: Node) => {\n return {\n uuid: node.uuid,\n result_name: node.router?.result_name || 'response'\n };\n },\n fromFormData: (formData: any, originalNode: Node): Node => {\n const router: any = {\n ...originalNode.router,\n result_name: formData.result_name || 'response'\n };\n\n return {\n ...originalNode,\n router\n };\n }\n};\n"]}