@bikdotai/bik-component-library 0.0.840-beta.0 → 0.0.840-tools-beta.1

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 (225) hide show
  1. package/dist/cjs/assets/icons/BigCommerce.svg.js +2 -0
  2. package/dist/cjs/assets/icons/BigCommerce.svg.js.map +1 -0
  3. package/dist/cjs/assets/icons/ShipStation.svg.js +2 -0
  4. package/dist/cjs/assets/icons/ShipStation.svg.js.map +1 -0
  5. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js +1 -1
  6. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
  7. package/dist/cjs/components/SearchFilter/index.js +1 -1
  8. package/dist/cjs/components/SearchFilter/index.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  10. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +39 -51
  12. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
  18. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
  20. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
  22. package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  24. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  26. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/components/MentionPicker.js +22 -22
  28. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
  30. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
  32. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
  34. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  36. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  38. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  39. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +1 -3
  40. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  41. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  42. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  43. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  44. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  45. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -5
  46. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  47. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  48. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  49. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  50. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  51. package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
  52. package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
  53. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  54. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  55. package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
  56. package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
  57. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  58. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
  59. package/dist/cjs/components/button/Button.styled.js +0 -1
  60. package/dist/cjs/components/button/Button.styled.js.map +1 -1
  61. package/dist/cjs/components/button/themes.js +11 -11
  62. package/dist/cjs/components/button/themes.js.map +1 -1
  63. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js +1 -1
  64. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
  65. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  66. package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
  67. package/dist/cjs/components/dropdown-button/DropdownButton.js +1 -1
  68. package/dist/cjs/components/dropdown-button/DropdownButton.js.map +1 -1
  69. package/dist/cjs/components/input/Input.js +1 -1
  70. package/dist/cjs/components/input/Input.js.map +1 -1
  71. package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
  72. package/dist/cjs/components/multi-level-dropdown/MenuItem.js.map +1 -1
  73. package/dist/cjs/components/radioButton/RadioButton.js +1 -1
  74. package/dist/cjs/components/radioButton/RadioButton.js.map +1 -1
  75. package/dist/cjs/components/radioList/RadioList.js +1 -1
  76. package/dist/cjs/components/radioList/RadioList.js.map +1 -1
  77. package/dist/cjs/components/searchBar/searchBar.js +1 -1
  78. package/dist/cjs/components/searchBar/searchBar.js.map +1 -1
  79. package/dist/cjs/components/side-modal/SideModal.js +1 -1
  80. package/dist/cjs/components/side-modal/SideModal.js.map +1 -1
  81. package/dist/cjs/components/star-rating/Star.js +1 -1
  82. package/dist/cjs/components/star-rating/Star.js.map +1 -1
  83. package/dist/cjs/components/star-rating/StarRating.js +2 -2
  84. package/dist/cjs/components/star-rating/StarRating.js.map +1 -1
  85. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  86. package/dist/cjs/components/template-preview/TemplatePreview.js.map +1 -1
  87. package/dist/cjs/components/thumbnail/Thumbnail.js +1 -1
  88. package/dist/cjs/components/thumbnail/Thumbnail.js.map +1 -1
  89. package/dist/cjs/components/zeroState/ZeroState.js +3 -3
  90. package/dist/cjs/components/zeroState/ZeroState.js.map +1 -1
  91. package/dist/cjs/editor/BikEditor.js +1 -1
  92. package/dist/cjs/editor/BikEditor.js.map +1 -1
  93. package/dist/cjs/editor/BikEditor.styles.js +54 -97
  94. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  95. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
  96. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  97. package/dist/cjs/icons/index.js +1 -1
  98. package/dist/esm/assets/icons/BigCommerce.svg.js +6 -0
  99. package/dist/esm/assets/icons/BigCommerce.svg.js.map +1 -0
  100. package/dist/esm/assets/icons/ShipStation.svg.js +6 -0
  101. package/dist/esm/assets/icons/ShipStation.svg.js.map +1 -0
  102. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js +61 -66
  103. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.js.map +1 -1
  104. package/dist/esm/components/SearchFilter/index.js +10 -11
  105. package/dist/esm/components/SearchFilter/index.js.map +1 -1
  106. package/dist/esm/components/agent-builder/AgentBuilder.js +102 -106
  107. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  108. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +7 -0
  109. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +6 -3
  110. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +106 -118
  111. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  112. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +21 -29
  113. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  114. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +26 -27
  115. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  116. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
  117. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  118. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +23 -24
  119. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  120. package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +1 -3
  121. package/dist/esm/components/agent-builder/components/DiscardModal.js +24 -33
  122. package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
  123. package/dist/esm/components/agent-builder/components/GoLiveModal.js +21 -23
  124. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  125. package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
  126. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  127. package/dist/esm/components/agent-builder/components/MentionPicker.js +147 -177
  128. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  129. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +0 -2
  130. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +105 -111
  131. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  132. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +12 -13
  133. package/dist/esm/components/agent-builder/components/SelectableListSection.js +151 -172
  134. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  135. package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
  136. package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  137. package/dist/esm/components/agent-builder/constants/tools.d.ts +2 -0
  138. package/dist/esm/components/agent-builder/constants/tools.js +22 -17
  139. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  140. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +103 -104
  141. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  142. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +102 -101
  143. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  144. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +162 -156
  145. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  146. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +79 -23
  147. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  148. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +23 -35
  149. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  150. package/dist/esm/components/agent-builder/utils/sourceIcons.js +20 -16
  151. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  152. package/dist/esm/components/agent-listing/AgentListing.js +65 -70
  153. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  154. package/dist/esm/components/agent-listing/AgentTable.d.ts +0 -2
  155. package/dist/esm/components/agent-listing/AgentTable.js +15 -16
  156. package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
  157. package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
  158. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  159. package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
  160. package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
  161. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js +10 -11
  162. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
  163. package/dist/esm/components/button/Button.styled.js +19 -25
  164. package/dist/esm/components/button/Button.styled.js.map +1 -1
  165. package/dist/esm/components/button/themes.d.ts +0 -1
  166. package/dist/esm/components/button/themes.js +51 -61
  167. package/dist/esm/components/button/themes.js.map +1 -1
  168. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js +21 -28
  169. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
  170. package/dist/esm/components/dropdown/Dropdown.js +13 -18
  171. package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
  172. package/dist/esm/components/dropdown-button/DropdownButton.js +13 -13
  173. package/dist/esm/components/dropdown-button/DropdownButton.js.map +1 -1
  174. package/dist/esm/components/input/Input.js +34 -35
  175. package/dist/esm/components/input/Input.js.map +1 -1
  176. package/dist/esm/components/input/Input.model.d.ts +0 -1
  177. package/dist/esm/components/multi-level-dropdown/MenuItem.js +27 -28
  178. package/dist/esm/components/multi-level-dropdown/MenuItem.js.map +1 -1
  179. package/dist/esm/components/radioButton/RadioButton.js +9 -10
  180. package/dist/esm/components/radioButton/RadioButton.js.map +1 -1
  181. package/dist/esm/components/radioList/RadioList.js +19 -28
  182. package/dist/esm/components/radioList/RadioList.js.map +1 -1
  183. package/dist/esm/components/searchBar/searchBar.js +10 -11
  184. package/dist/esm/components/searchBar/searchBar.js.map +1 -1
  185. package/dist/esm/components/side-modal/SideModal.js +5 -13
  186. package/dist/esm/components/side-modal/SideModal.js.map +1 -1
  187. package/dist/esm/components/star-rating/Star.d.ts +0 -1
  188. package/dist/esm/components/star-rating/Star.js +27 -32
  189. package/dist/esm/components/star-rating/Star.js.map +1 -1
  190. package/dist/esm/components/star-rating/StarRating.js +16 -17
  191. package/dist/esm/components/star-rating/StarRating.js.map +1 -1
  192. package/dist/esm/components/template-preview/TemplatePreview.js +40 -41
  193. package/dist/esm/components/template-preview/TemplatePreview.js.map +1 -1
  194. package/dist/esm/components/thumbnail/Thumbnail.js +3 -3
  195. package/dist/esm/components/thumbnail/Thumbnail.js.map +1 -1
  196. package/dist/esm/components/zeroState/ZeroState.js +13 -20
  197. package/dist/esm/components/zeroState/ZeroState.js.map +1 -1
  198. package/dist/esm/editor/BikEditor.js +160 -173
  199. package/dist/esm/editor/BikEditor.js.map +1 -1
  200. package/dist/esm/editor/BikEditor.styles.d.ts +3 -20
  201. package/dist/esm/editor/BikEditor.styles.js +57 -102
  202. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  203. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +8 -5
  204. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +68 -87
  205. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  206. package/dist/esm/icons/Media/Visual/index.d.ts +0 -2
  207. package/dist/esm/icons/index.d.ts +25 -25
  208. package/dist/esm/icons/index.js +416 -420
  209. package/dist/esm/icons/index.js.map +1 -1
  210. package/package.json +1 -1
  211. package/dist/cjs/components/agent-listing/AgentTableShimmer.js +0 -2
  212. package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +0 -1
  213. package/dist/cjs/icons/Media/Visual/FormkitNeutral.js +0 -2
  214. package/dist/cjs/icons/Media/Visual/FormkitNeutral.js.map +0 -1
  215. package/dist/cjs/icons/Media/Visual/FormkitSad.js +0 -2
  216. package/dist/cjs/icons/Media/Visual/FormkitSad.js.map +0 -1
  217. package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +0 -11
  218. package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +0 -12
  219. package/dist/esm/components/agent-listing/AgentTableShimmer.js +0 -20
  220. package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +0 -1
  221. package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +0 -3
  222. package/dist/esm/icons/Media/Visual/FormkitNeutral.js +0 -58
  223. package/dist/esm/icons/Media/Visual/FormkitNeutral.js.map +0 -1
  224. package/dist/esm/icons/Media/Visual/FormkitSad.js +0 -61
  225. package/dist/esm/icons/Media/Visual/FormkitSad.js.map +0 -1
@@ -1,275 +1,282 @@
1
- import { jsxs as h, jsx as l } from "react/jsx-runtime";
2
- import { useState as K, useRef as U, useCallback as r, useEffect as W } from "react";
3
- import { TitleSmall as ye, BodySecondary as Ae } from "../../TypographyStyle.js";
4
- import { COLORS as j } from "../../../constants/Theme.js";
5
- import { Step3Root as ve, Step3Grid as Ie, SectionBodyWrap as $, Step3Divider as Ce, SideSection as we } from "../AgentBuilder.styled.js";
6
- import { ConfigToolPanel as ke } from "../components/ConfigToolPanel.js";
1
+ import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
+ import { useState as N, useRef as W, useCallback as r, useEffect as $ } from "react";
3
+ import { TitleSmall as z } from "../../TypographyStyle.js";
4
+ import { COLORS as V } from "../../../constants/Theme.js";
5
+ import { Step3Root as Ie, Step3Grid as Ce, SectionBodyWrap as q, Step3Divider as we, SideSection as ke } from "../AgentBuilder.styled.js";
6
+ import { ConfigToolPanel as Oe } from "../components/ConfigToolPanel.js";
7
7
  import { CreateSubAgentPanel as Re } from "../components/CreateSubAgentPanel.js";
8
- import { MentionField as z } from "../components/MentionField.js";
9
- import { RestApiToolPanel as Oe } from "../components/RestApiToolPanel.js";
10
- import { SelectableListSection as V } from "../components/SelectableListSection.js";
11
- import { StepSectionHeader as Me } from "../components/StepSectionHeader.js";
12
- import { STEP_DEFINITIONS as xe } from "../constants/steps.js";
13
- import { CONFIG_TOOL_SOURCES as Ee, ToolSource as g } from "../constants/tools.js";
14
- import { useAgentBuilderContext as Ne } from "../context/AgentBuilderContext.js";
15
- import { restApiMentionItem as _e, configToolMentionItem as De, restApiToolName as Ke, configToolName as Le, toolSourceLabel as Pe, buildAgentMentionItems as q, buildCustomToolMentionItems as He, appTypeLabel as J } from "../utils/mentionSerialization.js";
16
- import { sourceIcon as ee, SOURCE_ICONS as Q, renderSourceIcon as Be } from "../utils/sourceIcons.js";
17
- import { buildToolActions as Fe } from "../utils/toolActions.js";
18
- import { Dropdown as Ge } from "../../dropdown/Dropdown.js";
19
- import { unwrapDropdownValue as Ue } from "../../dropdown/utils.js";
20
- const We = (t) => Be(ee(t)) ?? void 0, X = (t) => ({
8
+ import { MentionField as J } from "../components/MentionField.js";
9
+ import { RestApiToolPanel as Me } from "../components/RestApiToolPanel.js";
10
+ import { SelectableListSection as Q } from "../components/SelectableListSection.js";
11
+ import { StepSectionHeader as Ee } from "../components/StepSectionHeader.js";
12
+ import { STEP_DEFINITIONS as _e } from "../constants/steps.js";
13
+ import { CONFIG_TOOL_SOURCES as xe, ToolSource as g } from "../constants/tools.js";
14
+ import { useAgentBuilderContext as Ke } from "../context/AgentBuilderContext.js";
15
+ import { restApiMentionItem as Le, configToolMentionItem as Ne, restApiToolName as De, configToolName as Pe, toolSourceLabel as He, buildAgentMentionItems as X, buildCustomToolMentionItems as Fe, appTypeLabel as Y } from "../utils/mentionSerialization.js";
16
+ import { sourceIcon as ne, SOURCE_ICONS as Z, renderSourceIcon as Ge } from "../utils/sourceIcons.js";
17
+ import { buildToolActions as Be } from "../utils/toolActions.js";
18
+ import { Dropdown as Ue } from "../../dropdown/Dropdown.js";
19
+ import { unwrapDropdownValue as je } from "../../dropdown/utils.js";
20
+ const We = (t) => Ge(ne(t)) ?? void 0, ee = (t) => ({
21
21
  label: t.display_name,
22
22
  value: t.tool_id,
23
23
  leadingIcon: We(t.source ?? g.Manifest)
24
- }), Y = xe[2], Z = (t, s) => {
24
+ }), oe = _e[2], te = (t, i) => {
25
25
  const f = t ?? [];
26
- return f.some((c) => c.id === s.id) ? f.map((c) => c.id === s.id ? s : c) : [...f, s];
27
- }, co = () => {
26
+ return f.some((c) => c.id === i.id) ? f.map((c) => c.id === i.id ? i : c) : [...f, i];
27
+ }, uo = () => {
28
28
  const {
29
29
  value: t,
30
- patch: s,
30
+ patch: i,
31
31
  updateField: f,
32
32
  addReference: c,
33
- removeReference: L,
33
+ removeReference: D,
34
34
  availableTools: b,
35
- availableSubAgents: oe,
35
+ availableSubAgents: le,
36
36
  availableModels: C,
37
37
  configToolTemplates: w,
38
38
  applicationType: P,
39
39
  charLimits: S,
40
40
  insertMention: a,
41
- onCreateSubAgent: p,
42
- onFetchSubAgent: T,
41
+ onCreateSubAgent: u,
42
+ onFetchSubAgent: h,
43
43
  onUpdateSubAgent: k,
44
- onImproveSubAgent: te,
45
- onImproveToolInstructions: R,
46
- registerSubAgentCreator: O,
47
- registerToolActionHandler: M
48
- } = Ne(), [d, y] = K(null), A = U(0), [i, u] = K(null), v = U(0), x = r((e) => {
49
- v.current += 1, u({
50
- key: v.current,
44
+ onImproveSubAgent: ie,
45
+ onImproveToolInstructions: O,
46
+ registerSubAgentCreator: R,
47
+ registerToolActionHandler: M,
48
+ integrationStatus: H,
49
+ onConnectIntegration: F
50
+ } = Ke(), [d, A] = N(null), v = W(0), [s, p] = N(null), y = W(0), E = r((e) => {
51
+ y.current += 1, p({
52
+ key: y.current,
51
53
  kind: "restapi",
52
54
  initialRest: e
53
55
  });
54
- }, []), E = r(
56
+ }, []), _ = r(
55
57
  (e, o) => {
56
- v.current += 1, u({
57
- key: v.current,
58
+ y.current += 1, p({
59
+ key: y.current,
58
60
  kind: "config",
59
61
  toolKey: e,
60
62
  initialConfig: o
61
63
  });
62
64
  },
63
65
  []
64
- ), ne = r(
66
+ ), se = r(
65
67
  (e) => {
66
68
  const o = !(t.restApiTools ?? []).some((n) => n.id === e.id);
67
- s({ restApiTools: Z(t.restApiTools, e) }), o && a("tool", e.id, _e(e).label), u(null);
69
+ i({ restApiTools: te(t.restApiTools, e) }), o && a("tool", e.id, Le(e).label), p(null);
68
70
  },
69
- [s, t.restApiTools, a]
70
- ), ie = r(
71
+ [i, t.restApiTools, a]
72
+ ), ae = r(
71
73
  (e) => {
72
74
  const o = !(t.configTools ?? []).some((n) => n.id === e.id);
73
- s({ configTools: Z(t.configTools, e) }), o && a("tool", e.id, De(e).label), u(null);
75
+ i({ configTools: te(t.configTools, e) }), o && a("tool", e.id, Ne(e).label), p(null);
74
76
  },
75
- [s, t.configTools, a]
76
- ), N = r(
77
+ [i, t.configTools, a]
78
+ ), x = r(
77
79
  (e) => {
78
- const o = Ee[e];
79
- o ? E(o) : x();
80
+ const o = xe[e];
81
+ o ? _(o) : E();
80
82
  },
81
- [E, x]
83
+ [_, E]
82
84
  );
83
- W(() => (M(N), () => M(null)), [M, N]);
84
- const [le, H] = K([]), I = /* @__PURE__ */ new Map();
85
- oe.forEach((e) => I.set(e.id, e)), le.forEach((e) => I.set(e.id, e));
86
- const B = Array.from(I.values()), _ = r(() => {
87
- A.current += 1, y({ key: A.current, title: "Create sub-agent" });
85
+ $(() => (M(x), () => M(null)), [M, x]);
86
+ const [re, G] = N([]), I = /* @__PURE__ */ new Map();
87
+ le.forEach((e) => I.set(e.id, e)), re.forEach((e) => I.set(e.id, e));
88
+ const B = Array.from(I.values()), K = r(() => {
89
+ v.current += 1, A({ key: v.current, title: "Create sub-agent" });
88
90
  }, []);
89
- W(() => {
90
- if (p)
91
- return O(_), () => O(null);
92
- }, [O, _, p]);
93
- const se = r(
91
+ $(() => {
92
+ if (u)
93
+ return R(K), () => R(null);
94
+ }, [R, K, u]);
95
+ const ce = r(
94
96
  async (e) => {
95
- if (!T)
97
+ if (!h)
96
98
  return;
97
- const o = await T(e);
98
- A.current += 1, y({
99
- key: A.current,
99
+ const o = await h(e);
100
+ v.current += 1, A({
101
+ key: v.current,
100
102
  title: "Edit sub-agent",
101
103
  editingId: e,
102
104
  initial: o
103
105
  });
104
106
  },
105
- [T]
106
- ), ae = r(
107
+ [h]
108
+ ), de = r(
107
109
  async (e) => {
108
110
  if (d?.editingId) {
109
111
  if (k) {
110
112
  const o = await k(d.editingId, e);
111
- H((n) => [
113
+ G((n) => [
112
114
  ...n.filter((m) => m.id !== o.id),
113
115
  o
114
116
  ]);
115
117
  }
116
- } else if (p) {
117
- const o = await p(e);
118
- H((n) => [...n, o]), s({ subagents: [...t.subagents, o.id] }), a("subagent", o.id, `sub-agent: ${o.name}`);
118
+ } else if (u) {
119
+ const o = await u(e);
120
+ G((n) => [...n, o]), i({ subagents: [...t.subagents, o.id] }), a("subagent", o.id, `sub-agent: ${o.name}`);
119
121
  }
120
- y(null);
122
+ A(null);
121
123
  },
122
124
  [
123
125
  d,
124
126
  k,
125
- p,
126
- s,
127
+ u,
128
+ i,
127
129
  t.subagents,
128
130
  a
129
131
  ]
130
- ), re = t.tools.map((e) => {
132
+ ), ue = t.tools.map((e) => {
131
133
  const o = b.find((n) => n.tool_id === e);
132
134
  return o ? {
133
135
  id: e,
134
136
  label: o.display_name,
135
- icon: ee(o.source ?? g.Manifest)
137
+ icon: ne(o.source ?? g.Manifest)
136
138
  } : null;
137
- }).filter((e) => e !== null), ce = (t.restApiTools ?? []).map(
139
+ }).filter((e) => e !== null), pe = (t.restApiTools ?? []).map(
138
140
  (e) => ({
139
141
  id: e.id,
140
- label: Ke(e),
141
- icon: Q[g.RestApi],
142
- onConfigure: () => x(e)
142
+ label: De(e),
143
+ icon: Z[g.RestApi],
144
+ onConfigure: () => E(e)
143
145
  })
144
- ), de = (t.configTools ?? []).map(
146
+ ), me = (t.configTools ?? []).map(
145
147
  (e) => ({
146
148
  id: e.id,
147
- label: Le(e),
148
- icon: Q[e.tool_key === "send_slack_message" ? g.Slack : g.EmailHandover],
149
- onConfigure: () => E(e.tool_key, e)
149
+ label: Pe(e),
150
+ icon: Z[e.tool_key === "send_slack_message" ? g.Slack : g.EmailHandover],
151
+ onConfigure: () => _(e.tool_key, e)
150
152
  })
151
- ), pe = [
152
- ...re,
153
- ...ce,
154
- ...de
155
- ], ue = Fe(
153
+ ), ge = [
154
+ ...ue,
155
+ ...pe,
156
+ ...me
157
+ ], fe = Be(
156
158
  w,
157
- N
158
- ), me = b.map(X), ge = (() => {
159
+ x,
160
+ H,
161
+ F
162
+ ), be = b.map(ee), Se = (() => {
159
163
  const e = [], o = /* @__PURE__ */ new Map();
160
164
  return b.forEach((n) => {
161
165
  const m = n.source ?? g.Manifest;
162
- o.has(m) || (o.set(m, []), e.push(m)), o.get(m)?.push(X(n));
166
+ o.has(m) || (o.set(m, []), e.push(m)), o.get(m)?.push(ee(n));
163
167
  }), e.map((n) => ({
164
168
  source: n,
165
- label: Pe(n),
166
- options: o.get(n) ?? []
169
+ label: He(n),
170
+ options: o.get(n) ?? [],
171
+ // Not connected → the source button opens the connect flow instead of
172
+ // its tool list (see SelectableListSection / onConnectIntegration).
173
+ connected: H?.[n],
174
+ onConnect: () => F?.(n)
167
175
  }));
168
- })(), fe = t.subagents.map((e) => {
176
+ })(), Te = t.subagents.map((e) => {
169
177
  const o = I.get(e);
170
178
  return o ? { id: e, label: o.name } : null;
171
- }).filter((e) => e !== null), be = B.map((e) => ({
179
+ }).filter((e) => e !== null), he = B.map((e) => ({
172
180
  label: e.name,
173
181
  value: e.id
174
- })), F = J(P), Se = [
175
- ...q(b, [], F),
176
- ...He(t.configTools, t.restApiTools)
177
- ], he = q(
182
+ })), U = Y(P), Ae = [
183
+ ...X(b, [], U),
184
+ ...Fe(t.configTools, t.restApiTools)
185
+ ], ve = X(
178
186
  [],
179
187
  B,
180
- F
181
- ), Te = C.map((e) => ({
188
+ U
189
+ ), ye = C.map((e) => ({
182
190
  label: e.label,
183
191
  value: e.value,
184
192
  selected: e.value === t.model
185
- })), D = C.find((e) => e.value === t.model), G = i?.kind === "config" && i.toolKey ? w?.[i.toolKey] : void 0;
186
- return /* @__PURE__ */ h(ve, { children: [
187
- /* @__PURE__ */ l(Me, { title: Y.title, helper: Y.helper }),
188
- /* @__PURE__ */ h(Ie, { $grow: !0, children: [
189
- /* @__PURE__ */ h($, { children: [
193
+ })), L = C.find((e) => e.value === t.model), j = s?.kind === "config" && s.toolKey ? w?.[s.toolKey] : void 0;
194
+ return /* @__PURE__ */ T(Ie, { children: [
195
+ /* @__PURE__ */ l(Ee, { title: oe.title, helper: oe.helper }),
196
+ /* @__PURE__ */ T(Ce, { $grow: !0, children: [
197
+ /* @__PURE__ */ T(q, { children: [
190
198
  /* @__PURE__ */ l(
191
- z,
199
+ J,
192
200
  {
193
201
  fieldKey: "instructions",
194
202
  "data-test": "agent-instructions",
195
203
  label: "Instructions",
196
204
  maxLength: S.instructions,
197
- placeholder: "Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.",
205
+ placeholder: "Write what this agent should do. Type @ to reference a tool or sub-agent.",
198
206
  minHeight: "200px"
199
207
  }
200
208
  ),
201
209
  /* @__PURE__ */ l(
202
- z,
210
+ J,
203
211
  {
204
212
  fieldKey: "guardrail",
205
213
  "data-test": "agent-guardrail",
206
214
  label: "Guardrails",
207
215
  maxLength: S.guardrail,
208
- placeholder: "e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.",
216
+ placeholder: "Things this agent must never do. Type @ to reference a tool or sub-agent.",
209
217
  minHeight: "140px"
210
218
  }
211
219
  )
212
220
  ] }),
213
- /* @__PURE__ */ l(Ce, {}),
214
- /* @__PURE__ */ h($, { children: [
221
+ /* @__PURE__ */ l(we, {}),
222
+ /* @__PURE__ */ T(q, { children: [
215
223
  /* @__PURE__ */ l(
216
- V,
224
+ Q,
217
225
  {
218
226
  title: "Tools",
219
227
  helper: "Actions this agent can take while responding.",
220
228
  dataTestPrefix: "agent-tools",
221
- items: pe,
222
- addableOptions: me,
223
- sourceGroups: ge,
224
- mentionItems: Se,
225
- actionSources: ue,
229
+ items: ge,
230
+ addableOptions: be,
231
+ sourceGroups: Se,
232
+ mentionItems: Ae,
233
+ actionSources: fe,
226
234
  emptyText: "No tools added yet.",
227
235
  onAdd: (e) => {
228
236
  a("tool", e), c("tool", e);
229
237
  },
230
- onRemove: (e) => L("tool", e),
238
+ onRemove: (e) => D("tool", e),
231
239
  confirmDelete: { noun: "tool" }
232
240
  }
233
241
  ),
234
242
  /* @__PURE__ */ l(
235
- V,
243
+ Q,
236
244
  {
237
245
  title: "Sub-agents",
238
246
  helper: "Other agents this agent can hand off the conversation to.",
239
247
  dataTestPrefix: "agent-subagents",
240
- items: fe,
241
- addableOptions: be,
242
- mentionItems: he,
248
+ items: Te,
249
+ addableOptions: he,
250
+ mentionItems: ve,
243
251
  emptyText: "No sub-agents added yet.",
244
252
  onAdd: (e) => {
245
253
  a("subagent", e), c("subagent", e);
246
254
  },
247
- onRemove: (e) => L("subagent", e),
255
+ onRemove: (e) => D("subagent", e),
248
256
  confirmDelete: { noun: "sub-agent" },
249
- onConfigure: T ? se : void 0,
250
- createOption: p ? { label: "Create new", onSelect: _ } : void 0
257
+ onConfigure: h ? ce : void 0,
258
+ createOption: u ? { label: "Create new", onSelect: K } : void 0
251
259
  }
252
260
  ),
253
- C.length > 0 && /* @__PURE__ */ h(we, { children: [
254
- /* @__PURE__ */ l(ye, { color: j.content.primary, children: "Advanced settings" }),
255
- /* @__PURE__ */ l(Ae, { color: j.content.primary, children: "Select AI model" }),
261
+ C.length > 0 && /* @__PURE__ */ T(ke, { children: [
262
+ /* @__PURE__ */ l(z, { color: V.content.primary, children: "Advanced settings" }),
263
+ /* @__PURE__ */ l(z, { color: V.content.secondary, children: "Select AI model" }),
256
264
  /* @__PURE__ */ l(
257
- Ge,
265
+ Ue,
258
266
  {
259
267
  "data-test": "agent-model",
260
268
  size: "small",
261
269
  width: "100%",
262
- dropdownWidth: "328px",
263
270
  placeHolder: "Select model",
264
- options: Te,
265
- defaultOptions: D ? [
271
+ options: ye,
272
+ defaultOptions: L ? [
266
273
  {
267
- label: D.label,
268
- value: D.value
274
+ label: L.label,
275
+ value: L.value
269
276
  }
270
277
  ] : void 0,
271
278
  onSelect: (e) => {
272
- const o = Ue(e);
279
+ const o = je(e);
273
280
  o && f("model", o);
274
281
  }
275
282
  }
@@ -284,43 +291,42 @@ const We = (t) => Be(ee(t)) ?? void 0, X = (t) => ({
284
291
  initial: d.initial,
285
292
  availableTools: b,
286
293
  configToolTemplates: w,
287
- appLabel: J(P),
294
+ appLabel: Y(P),
288
295
  charLimits: S,
289
- onImprove: te,
290
- onImproveToolInstructions: R,
291
- onClose: () => y(null),
292
- onSave: ae
296
+ onImprove: ie,
297
+ onImproveToolInstructions: O,
298
+ onClose: () => A(null),
299
+ onSave: de
293
300
  },
294
301
  d.key
295
302
  ),
296
- i?.kind === "restapi" && /* @__PURE__ */ l(
297
- Oe,
303
+ s?.kind === "restapi" && /* @__PURE__ */ l(
304
+ Me,
298
305
  {
299
- initial: i.initialRest,
306
+ initial: s.initialRest,
300
307
  charLimits: S,
301
- existingNames: (t.restApiTools ?? []).filter((e) => e.id !== i.initialRest?.id).map((e) => e.name),
302
- onImprove: R,
303
- onClose: () => u(null),
304
- onSave: ne
308
+ onImprove: O,
309
+ onClose: () => p(null),
310
+ onSave: se
305
311
  },
306
- i.key
312
+ s.key
307
313
  ),
308
- i?.kind === "config" && i.toolKey && G && /* @__PURE__ */ l(
309
- ke,
314
+ s?.kind === "config" && s.toolKey && j && /* @__PURE__ */ l(
315
+ Oe,
310
316
  {
311
- toolKey: i.toolKey,
312
- template: G,
313
- initial: i.initialConfig,
317
+ toolKey: s.toolKey,
318
+ template: j,
319
+ initial: s.initialConfig,
314
320
  charLimits: S,
315
- onImprove: R,
316
- onClose: () => u(null),
317
- onSave: ie
321
+ onImprove: O,
322
+ onClose: () => p(null),
323
+ onSave: ae
318
324
  },
319
- i.key
325
+ s.key
320
326
  )
321
327
  ] });
322
328
  };
323
329
  export {
324
- co as Step3HowItResponds
330
+ uo as Step3HowItResponds
325
331
  };
326
332
  //# sourceMappingURL=Step3HowItResponds.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step3HowItResponds.js","sources":["../../../../../src/components/agent-builder/steps/Step3HowItResponds.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { BodySecondary, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentTool,\n\tConfigToolConfig,\n\tConfigToolKey,\n\tRestApiToolConfig,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport {\n\tSectionBodyWrap,\n\tSideSection,\n\tStep3Divider,\n\tStep3Grid,\n\tStep3Root,\n} from '../AgentBuilder.styled';\nimport { ConfigToolPanel } from '../components/ConfigToolPanel';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport { RestApiToolPanel } from '../components/RestApiToolPanel';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { CONFIG_TOOL_SOURCES, ToolSource } from '../constants/tools';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n\tconfigToolMentionItem,\n\tconfigToolName,\n\trestApiMentionItem,\n\trestApiToolName,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tsourceIcon,\n} from '../utils/sourceIcons';\nimport { buildToolActions } from '../utils/toolActions';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(sourceIcon(source)) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? ToolSource.Manifest),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\n/**\n * Config-tool drawer state; `key` remounts fresh. `restapi` is the bespoke Rest\n * API panel; `config` is the shared dynamic panel (email / Slack), tagged with\n * its `toolKey`.\n */\ninterface ToolDrawerState {\n\tkey: number;\n\tkind: 'restapi' | 'config';\n\ttoolKey?: ConfigToolKey;\n\tinitialRest?: RestApiToolConfig;\n\tinitialConfig?: ConfigToolConfig;\n}\n\n/** Upsert an item by id (replace when present, append otherwise). */\nconst upsertById = <T extends { id: string }>(\n\tlist: T[] | undefined,\n\titem: T,\n): T[] => {\n\tconst arr = list ?? [];\n\treturn arr.some((x) => x.id === item.id)\n\t\t? arr.map((x) => (x.id === item.id ? item : x))\n\t\t: [...arr, item];\n};\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\taddReference,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tconfigToolTemplates,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tregisterSubAgentCreator,\n\t\tregisterToolActionHandler,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\n\t// Rest API (bespoke) + shared config-tool drawers (separate from the sub-agent one).\n\tconst [toolDrawer, setToolDrawer] = useState<ToolDrawerState | null>(null);\n\tconst toolDrawerKeyRef = useRef(0);\n\tconst openRestApi = useCallback((initial?: RestApiToolConfig) => {\n\t\ttoolDrawerKeyRef.current += 1;\n\t\tsetToolDrawer({\n\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\tkind: 'restapi',\n\t\t\tinitialRest: initial,\n\t\t});\n\t}, []);\n\tconst openConfigTool = useCallback(\n\t\t(toolKey: ConfigToolKey, initial?: ConfigToolConfig) => {\n\t\t\ttoolDrawerKeyRef.current += 1;\n\t\t\tsetToolDrawer({\n\t\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\t\tkind: 'config',\n\t\t\t\ttoolKey,\n\t\t\t\tinitialConfig: initial,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\tconst handleSaveRestApi = useCallback(\n\t\t(config: RestApiToolConfig) => {\n\t\t\tconst isNew = !(value.restApiTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ restApiTools: upsertById(value.restApiTools, config) });\n\t\t\t// Drop a reference chip at the cursor on creation (edits keep the chip).\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention('tool', config.id, restApiMentionItem(config).label);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.restApiTools, insertMention],\n\t);\n\tconst handleSaveConfigTool = useCallback(\n\t\t(config: ConfigToolConfig) => {\n\t\t\tconst isNew = !(value.configTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ configTools: upsertById(value.configTools, config) });\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention('tool', config.id, configToolMentionItem(config).label);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.configTools, insertMention],\n\t);\n\n\t// Open a tool action's drawer by picker source (restapi / email / slack).\n\tconst openToolAction = useCallback(\n\t\t(source: ToolSource) => {\n\t\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\t\tif (toolKey) {\n\t\t\t\topenConfigTool(toolKey);\n\t\t\t} else {\n\t\t\t\topenRestApi();\n\t\t\t}\n\t\t},\n\t\t[openConfigTool, openRestApi],\n\t);\n\t// Let the `@` reference picker (Instructions / Guardrails) open these drawers.\n\tuseEffect(() => {\n\t\tregisterToolActionHandler(openToolAction);\n\t\treturn () => registerToolActionHandler(null);\n\t}, [registerToolActionHandler, openToolAction]);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: sourceIcon(tool.source ?? ToolSource.Manifest),\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Inline-configured tools (Rest API + the shared email / Slack tools) live on\n\t// the value, not in `tools`. They render as rows in the same Tools list, each\n\t// with its own Configure (edit) action that reopens its drawer.\n\tconst restApiItems: SelectableItem[] = (value.restApiTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: restApiToolName(t),\n\t\t\ticon: SOURCE_ICONS[ToolSource.RestApi],\n\t\t\tonConfigure: () => openRestApi(t),\n\t\t}),\n\t);\n\tconst configToolItems: SelectableItem[] = (value.configTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: configToolName(t),\n\t\t\ticon: SOURCE_ICONS[\n\t\t\t\tt.tool_key === 'send_slack_message'\n\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t: ToolSource.EmailHandover\n\t\t\t],\n\t\t\tonConfigure: () => openConfigTool(t.tool_key, t),\n\t\t}),\n\t);\n\tconst allToolItems: SelectableItem[] = [\n\t\t...toolItems,\n\t\t...restApiItems,\n\t\t...configToolItems,\n\t];\n\n\t// Built-in tools that open a config drawer instead of inserting a mention.\n\t// Shown as empty-state buttons AND in the `@` picker's Tools view. The shared\n\t// email / Slack forms are backend-driven, so each is offered only when its\n\t// template was provided.\n\tconst toolActionSources = buildToolActions(\n\t\tconfigToolTemplates,\n\t\topenToolAction,\n\t);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? ToolSource.Manifest;\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst appLabel = appTypeLabel(applicationType);\n\tconst toolMentionItems = [\n\t\t...buildAgentMentionItems(availableTools, [], appLabel),\n\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t];\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\t// The template for the open shared-drawer tool (undefined unless a config\n\t// drawer is open and its template was provided).\n\tconst openConfigTemplate =\n\t\ttoolDrawer?.kind === 'config' && toolDrawer.toolKey\n\t\t\t? configToolTemplates?.[toolDrawer.toolKey]\n\t\t\t: undefined;\n\n\treturn (\n\t\t<Step3Root>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid $grow>\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</SectionBodyWrap>\n\n\t\t\t\t<Step3Divider />\n\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={allToolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\tactionSources={toolActionSources}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\t// Always drop a chip at the cursor; addReference dedupes and reads\n\t\t\t\t\t\t\t// the latest value.\n\t\t\t\t\t\t\tinsertMention('tool', id);\n\t\t\t\t\t\t\taddReference('tool', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t// Strips the tool's tokens AND drops it from whichever list holds it\n\t\t\t\t\t\t// (catalog `tools` or an inline custom-tool list).\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'tool' }}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\taddReference('subagent', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'sub-agent' }}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<BodySecondary color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\t// Popover is portalled, so \"100%\" collapses to content width —\n\t\t\t\t\t\t\t\t// match the input: 360px side column − 2×16px SectionBodyWrap\n\t\t\t\t\t\t\t\t// padding.\n\t\t\t\t\t\t\t\tdropdownWidth=\"328px\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tappLabel={appTypeLabel(applicationType)}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'restapi' && (\n\t\t\t\t<RestApiToolPanel\n\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\tinitial={toolDrawer.initialRest}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t// Block reusing another tool's name (exclude the one being edited).\n\t\t\t\t\texistingNames={(value.restApiTools ?? [])\n\t\t\t\t\t\t.filter((t) => t.id !== toolDrawer.initialRest?.id)\n\t\t\t\t\t\t.map((t) => t.name)}\n\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\tonSave={handleSaveRestApi}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'config' &&\n\t\t\t\ttoolDrawer.toolKey &&\n\t\t\t\topenConfigTemplate && (\n\t\t\t\t\t<ConfigToolPanel\n\t\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\t\ttoolKey={toolDrawer.toolKey}\n\t\t\t\t\t\ttemplate={openConfigTemplate}\n\t\t\t\t\t\tinitial={toolDrawer.initialConfig}\n\t\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\t\tonSave={handleSaveConfigTool}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","sourceIcon","toolOption","ToolSource","STEP","STEP_DEFINITIONS","upsertById","list","item","arr","x","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","configToolTemplates","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","registerSubAgentCreator","registerToolActionHandler","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","toolDrawer","setToolDrawer","toolDrawerKeyRef","openRestApi","useCallback","initial","openConfigTool","toolKey","handleSaveRestApi","config","isNew","t","restApiMentionItem","handleSaveConfigTool","configToolMentionItem","openToolAction","CONFIG_TOOL_SOURCES","useEffect","createdSubAgents","setCreatedSubAgents","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","handlePanelSave","draft","ref","prev","toolItems","tool","restApiItems","restApiToolName","SOURCE_ICONS","configToolItems","configToolName","allToolItems","toolActionSources","buildToolActions","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","appLabel","appTypeLabel","toolMentionItems","buildAgentMentionItems","buildCustomToolMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","openConfigTemplate","Step3Root","jsx","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","TitleSmall","COLORS","BodySecondary","Dropdown","opt","v","unwrapDropdownValue","CreateSubAgentPanel","RestApiToolPanel","ConfigToolPanel"],"mappings":";;;;;;;;;;;;;;;;;;;AAmDA,MAAMA,KAAa,CAACC,MACnBC,GAAiBC,GAAWF,CAAM,CAAC,KAAK,QAGnCG,IAAa,CAAC,OAAgC;AAAA,EACnD,OAAO,EAAE;AAAA,EACT,OAAO,EAAE;AAAA,EACT,aAAaJ,GAAW,EAAE,UAAUK,EAAW,QAAQ;AACxD,IAEMC,IAAOC,GAAiB,CAAC,GAwBzBC,IAAa,CAClBC,GACAC,MACS;AACT,QAAMC,IAAMF,KAAQ,CAAA;AACpB,SAAOE,EAAI,KAAK,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I;AAAA,QAC5B,QAAQ+B;AAAA,MAAA;AAAA,MAVHhC,EAAM;AAAA,IAAA;AAAA,IAcZK,GAAY,SAAS,aACrB,gBAAA6D;AAAA,MAACiB;AAAA,MAAA;AAAA,QAEA,SAAS9E,EAAW;AAAA,QACpB,YAAAf;AAAA,QAEA,gBAAgBV,EAAM,gBAAgB,CAAA,GACpC,OAAO,CAACoC,MAAMA,EAAE,OAAOX,EAAW,aAAa,EAAE,EACjD,IAAI,CAACW,MAAMA,EAAE,IAAI;AAAA,QACnB,WAAWpB;AAAA,QACX,SAAS,MAAMU,EAAc,IAAI;AAAA,QACjC,QAAQO;AAAA,MAAA;AAAA,MATHR,EAAW;AAAA,IAAA;AAAA,IAajBA,GAAY,SAAS,YACrBA,EAAW,WACX2D,KACC,gBAAAE;AAAA,MAACkB;AAAA,MAAA;AAAA,QAEA,SAAS/E,EAAW;AAAA,QACpB,UAAU2D;AAAA,QACV,SAAS3D,EAAW;AAAA,QACpB,YAAAf;AAAA,QACA,WAAWM;AAAA,QACX,SAAS,MAAMU,EAAc,IAAI;AAAA,QACjC,QAAQY;AAAA,MAAA;AAAA,MAPHb,EAAW;AAAA,IAAA;AAAA,EAQjB,GAEH;AAEF;"}
1
+ {"version":3,"file":"Step3HowItResponds.js","sources":["../../../../../src/components/agent-builder/steps/Step3HowItResponds.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentTool,\n\tConfigToolConfig,\n\tConfigToolKey,\n\tRestApiToolConfig,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport {\n\tSectionBodyWrap,\n\tSideSection,\n\tStep3Divider,\n\tStep3Grid,\n\tStep3Root,\n} from '../AgentBuilder.styled';\nimport { ConfigToolPanel } from '../components/ConfigToolPanel';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport { RestApiToolPanel } from '../components/RestApiToolPanel';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { CONFIG_TOOL_SOURCES, ToolSource } from '../constants/tools';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\tbuildCustomToolMentionItems,\n\tconfigToolMentionItem,\n\tconfigToolName,\n\trestApiMentionItem,\n\trestApiToolName,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport {\n\trenderSourceIcon,\n\tSOURCE_ICONS,\n\tsourceIcon,\n} from '../utils/sourceIcons';\nimport { buildToolActions } from '../utils/toolActions';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(sourceIcon(source)) ?? undefined;\n\n/** Dropdown option for a tool: icon left of the name, no description. */\nconst toolOption = (t: AgentTool): SingleOption => ({\n\tlabel: t.display_name,\n\tvalue: t.tool_id,\n\tleadingIcon: toolIconEl(t.source ?? ToolSource.Manifest),\n});\n\nconst STEP = STEP_DEFINITIONS[2];\n\n/** Drawer state — null when closed; `key` remounts it fresh per open. */\ninterface SubAgentPanelState {\n\tkey: number;\n\ttitle: string;\n\teditingId?: string;\n\tinitial?: SubAgentDraft;\n}\n\n/**\n * Config-tool drawer state; `key` remounts fresh. `restapi` is the bespoke Rest\n * API panel; `config` is the shared dynamic panel (email / Slack), tagged with\n * its `toolKey`.\n */\ninterface ToolDrawerState {\n\tkey: number;\n\tkind: 'restapi' | 'config';\n\ttoolKey?: ConfigToolKey;\n\tinitialRest?: RestApiToolConfig;\n\tinitialConfig?: ConfigToolConfig;\n}\n\n/** Upsert an item by id (replace when present, append otherwise). */\nconst upsertById = <T extends { id: string }>(\n\tlist: T[] | undefined,\n\titem: T,\n): T[] => {\n\tconst arr = list ?? [];\n\treturn arr.some((x) => x.id === item.id)\n\t\t? arr.map((x) => (x.id === item.id ? item : x))\n\t\t: [...arr, item];\n};\n\nexport const Step3HowItResponds: React.FC = () => {\n\tconst {\n\t\tvalue,\n\t\tpatch,\n\t\tupdateField,\n\t\taddReference,\n\t\tremoveReference,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableModels,\n\t\tconfigToolTemplates,\n\t\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tonImproveToolInstructions,\n\t\tregisterSubAgentCreator,\n\t\tregisterToolActionHandler,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\n\n\t// Rest API (bespoke) + shared config-tool drawers (separate from the sub-agent one).\n\tconst [toolDrawer, setToolDrawer] = useState<ToolDrawerState | null>(null);\n\tconst toolDrawerKeyRef = useRef(0);\n\tconst openRestApi = useCallback((initial?: RestApiToolConfig) => {\n\t\ttoolDrawerKeyRef.current += 1;\n\t\tsetToolDrawer({\n\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\tkind: 'restapi',\n\t\t\tinitialRest: initial,\n\t\t});\n\t}, []);\n\tconst openConfigTool = useCallback(\n\t\t(toolKey: ConfigToolKey, initial?: ConfigToolConfig) => {\n\t\t\ttoolDrawerKeyRef.current += 1;\n\t\t\tsetToolDrawer({\n\t\t\t\tkey: toolDrawerKeyRef.current,\n\t\t\t\tkind: 'config',\n\t\t\t\ttoolKey,\n\t\t\t\tinitialConfig: initial,\n\t\t\t});\n\t\t},\n\t\t[],\n\t);\n\tconst handleSaveRestApi = useCallback(\n\t\t(config: RestApiToolConfig) => {\n\t\t\tconst isNew = !(value.restApiTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ restApiTools: upsertById(value.restApiTools, config) });\n\t\t\t// Drop a reference chip at the cursor on creation (edits keep the chip).\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention('tool', config.id, restApiMentionItem(config).label);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.restApiTools, insertMention],\n\t);\n\tconst handleSaveConfigTool = useCallback(\n\t\t(config: ConfigToolConfig) => {\n\t\t\tconst isNew = !(value.configTools ?? []).some((t) => t.id === config.id);\n\t\t\tpatch({ configTools: upsertById(value.configTools, config) });\n\t\t\tif (isNew) {\n\t\t\t\tinsertMention('tool', config.id, configToolMentionItem(config).label);\n\t\t\t}\n\t\t\tsetToolDrawer(null);\n\t\t},\n\t\t[patch, value.configTools, insertMention],\n\t);\n\n\t// Open a tool action's drawer by picker source (restapi / email / slack).\n\tconst openToolAction = useCallback(\n\t\t(source: ToolSource) => {\n\t\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\t\tif (toolKey) {\n\t\t\t\topenConfigTool(toolKey);\n\t\t\t} else {\n\t\t\t\topenRestApi();\n\t\t\t}\n\t\t},\n\t\t[openConfigTool, openRestApi],\n\t);\n\t// Let the `@` reference picker (Instructions / Guardrails) open these drawers.\n\tuseEffect(() => {\n\t\tregisterToolActionHandler(openToolAction);\n\t\treturn () => registerToolActionHandler(null);\n\t}, [registerToolActionHandler, openToolAction]);\n\t// Sub-agents created / edited in this session, so a chip resolves (and reflects\n\t// a renamed sub-agent) before the consumer refreshes `availableSubAgents`.\n\tconst [createdSubAgents, setCreatedSubAgents] = useState<SubAgentRef[]>([]);\n\t// Created/edited refs take precedence over the consumer-supplied list.\n\tconst subAgentById = new Map<string, SubAgentRef>();\n\tavailableSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tcreatedSubAgents.forEach((s) => subAgentById.set(s.id, s));\n\tconst knownSubAgents = Array.from(subAgentById.values());\n\n\tconst openCreate = useCallback(() => {\n\t\tpanelKeyRef.current += 1;\n\t\tsetPanel({ key: panelKeyRef.current, title: 'Create sub-agent' });\n\t}, []);\n\n\t// Let the `@` picker's \"Create new\" row open this step's drawer.\n\tuseEffect(() => {\n\t\tif (!onCreateSubAgent) {\n\t\t\treturn;\n\t\t}\n\t\tregisterSubAgentCreator(openCreate);\n\t\treturn () => registerSubAgentCreator(null);\n\t}, [registerSubAgentCreator, openCreate, onCreateSubAgent]);\n\n\tconst openConfigure = useCallback(\n\t\tasync (id: string) => {\n\t\t\tif (!onFetchSubAgent) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst data = await onFetchSubAgent(id);\n\t\t\tpanelKeyRef.current += 1;\n\t\t\tsetPanel({\n\t\t\t\tkey: panelKeyRef.current,\n\t\t\t\ttitle: 'Edit sub-agent',\n\t\t\t\teditingId: id,\n\t\t\t\tinitial: data,\n\t\t\t});\n\t\t},\n\t\t[onFetchSubAgent],\n\t);\n\n\tconst handlePanelSave = useCallback(\n\t\tasync (draft: SubAgentDraft) => {\n\t\t\tif (panel?.editingId) {\n\t\t\t\tif (onUpdateSubAgent) {\n\t\t\t\t\tconst ref = await onUpdateSubAgent(panel.editingId, draft);\n\t\t\t\t\tsetCreatedSubAgents((prev) => [\n\t\t\t\t\t\t...prev.filter((s) => s.id !== ref.id),\n\t\t\t\t\t\tref,\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t} else if (onCreateSubAgent) {\n\t\t\t\tconst ref = await onCreateSubAgent(draft);\n\t\t\t\tsetCreatedSubAgents((prev) => [...prev, ref]);\n\t\t\t\tpatch({ subagents: [...value.subagents, ref.id] });\n\t\t\t\tinsertMention('subagent', ref.id, `sub-agent: ${ref.name}`);\n\t\t\t}\n\t\t\tsetPanel(null);\n\t\t},\n\t\t[\n\t\t\tpanel,\n\t\t\tonUpdateSubAgent,\n\t\t\tonCreateSubAgent,\n\t\t\tpatch,\n\t\t\tvalue.subagents,\n\t\t\tinsertMention,\n\t\t],\n\t);\n\n\tconst toolItems: SelectableItem[] = value.tools\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst tool = availableTools.find((t) => t.tool_id === id);\n\t\t\treturn tool\n\t\t\t\t? {\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tlabel: tool.display_name,\n\t\t\t\t\t\ticon: sourceIcon(tool.source ?? ToolSource.Manifest),\n\t\t\t\t }\n\t\t\t\t: null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\t// Inline-configured tools (Rest API + the shared email / Slack tools) live on\n\t// the value, not in `tools`. They render as rows in the same Tools list, each\n\t// with its own Configure (edit) action that reopens its drawer.\n\tconst restApiItems: SelectableItem[] = (value.restApiTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: restApiToolName(t),\n\t\t\ticon: SOURCE_ICONS[ToolSource.RestApi],\n\t\t\tonConfigure: () => openRestApi(t),\n\t\t}),\n\t);\n\tconst configToolItems: SelectableItem[] = (value.configTools ?? []).map(\n\t\t(t) => ({\n\t\t\tid: t.id,\n\t\t\tlabel: configToolName(t),\n\t\t\ticon: SOURCE_ICONS[\n\t\t\t\tt.tool_key === 'send_slack_message'\n\t\t\t\t\t? ToolSource.Slack\n\t\t\t\t\t: ToolSource.EmailHandover\n\t\t\t],\n\t\t\tonConfigure: () => openConfigTool(t.tool_key, t),\n\t\t}),\n\t);\n\tconst allToolItems: SelectableItem[] = [\n\t\t...toolItems,\n\t\t...restApiItems,\n\t\t...configToolItems,\n\t];\n\n\t// Built-in tools that open a config drawer instead of inserting a mention.\n\t// Shown as empty-state buttons AND in the `@` picker's Tools view. The shared\n\t// email / Slack forms are backend-driven, so each is offered only when its\n\t// template was provided.\n\tconst toolActionSources = buildToolActions(\n\t\tconfigToolTemplates,\n\t\topenToolAction,\n\t\tintegrationStatus,\n\t\tonConnectIntegration,\n\t);\n\n\t// All tools are offered (even already-added ones) so a tool can be referenced\n\t// again in the text; the chip list below still shows each only once.\n\tconst toolOptions: SingleOption[] = availableTools.map(toolOption);\n\n\t// Group tools by source (Manifest / Shopify / …) for the empty-state buttons.\n\tconst toolSourceGroups: SourceGroup[] = (() => {\n\t\tconst order: string[] = [];\n\t\tconst bySource = new Map<string, SingleOption[]>();\n\t\tavailableTools.forEach((t) => {\n\t\t\tconst src = t.source ?? ToolSource.Manifest;\n\t\t\tif (!bySource.has(src)) {\n\t\t\t\tbySource.set(src, []);\n\t\t\t\torder.push(src);\n\t\t\t}\n\t\t\tbySource.get(src)?.push(toolOption(t));\n\t\t});\n\t\treturn order.map((src) => ({\n\t\t\tsource: src,\n\t\t\tlabel: toolSourceLabel(src),\n\t\t\toptions: bySource.get(src) ?? [],\n\t\t\t// Not connected → the source button opens the connect flow instead of\n\t\t\t// its tool list (see SelectableListSection / onConnectIntegration).\n\t\t\tconnected: integrationStatus?.[src as ToolSource],\n\t\t\tonConnect: () => onConnectIntegration?.(src as ToolSource),\n\t\t}));\n\t})();\n\n\tconst subAgentItems: SelectableItem[] = value.subagents\n\t\t.map((id): SelectableItem | null => {\n\t\t\tconst sub = subAgentById.get(id);\n\t\t\treturn sub ? { id, label: sub.name } : null;\n\t\t})\n\t\t.filter((x): x is SelectableItem => x !== null);\n\n\tconst subAgentOptions: SingleOption[] = knownSubAgents.map((s) => ({\n\t\tlabel: s.name,\n\t\tvalue: s.id,\n\t}));\n\n\t// Per-section `@`-picker items so the header \"+\" opens the same reference\n\t// picker as the Instructions editor, drilled straight into this section's\n\t// category (tools OR sub-agents).\n\tconst appLabel = appTypeLabel(applicationType);\n\tconst toolMentionItems = [\n\t\t...buildAgentMentionItems(availableTools, [], appLabel),\n\t\t...buildCustomToolMentionItems(value.configTools, value.restApiTools),\n\t];\n\tconst subAgentMentionItems = buildAgentMentionItems(\n\t\t[],\n\t\tknownSubAgents,\n\t\tappLabel,\n\t);\n\n\tconst modelOptions: SingleOption[] = availableModels.map((m) => ({\n\t\tlabel: m.label,\n\t\tvalue: m.value,\n\t\tselected: m.value === value.model,\n\t}));\n\tconst selectedModel = availableModels.find((m) => m.value === value.model);\n\n\t// The template for the open shared-drawer tool (undefined unless a config\n\t// drawer is open and its template was provided).\n\tconst openConfigTemplate =\n\t\ttoolDrawer?.kind === 'config' && toolDrawer.toolKey\n\t\t\t? configToolTemplates?.[toolDrawer.toolKey]\n\t\t\t: undefined;\n\n\treturn (\n\t\t<Step3Root>\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<Step3Grid $grow>\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"instructions\"\n\t\t\t\t\t\tdata-test=\"agent-instructions\"\n\t\t\t\t\t\tlabel=\"Instructions\"\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder=\"Write what this agent should do. Type @ to reference a tool or sub-agent.\"\n\t\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t\t/>\n\n\t\t\t\t\t<MentionField\n\t\t\t\t\t\tfieldKey=\"guardrail\"\n\t\t\t\t\t\tdata-test=\"agent-guardrail\"\n\t\t\t\t\t\tlabel=\"Guardrails\"\n\t\t\t\t\t\tmaxLength={charLimits.guardrail}\n\t\t\t\t\t\tplaceholder=\"Things this agent must never do. Type @ to reference a tool or sub-agent.\"\n\t\t\t\t\t\tminHeight=\"140px\"\n\t\t\t\t\t/>\n\t\t\t\t</SectionBodyWrap>\n\n\t\t\t\t<Step3Divider />\n\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Tools\"\n\t\t\t\t\t\thelper=\"Actions this agent can take while responding.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-tools\"\n\t\t\t\t\t\titems={allToolItems}\n\t\t\t\t\t\taddableOptions={toolOptions}\n\t\t\t\t\t\tsourceGroups={toolSourceGroups}\n\t\t\t\t\t\tmentionItems={toolMentionItems}\n\t\t\t\t\t\tactionSources={toolActionSources}\n\t\t\t\t\t\temptyText=\"No tools added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\t// Always drop a chip at the cursor; addReference dedupes and reads\n\t\t\t\t\t\t\t// the latest value.\n\t\t\t\t\t\t\tinsertMention('tool', id);\n\t\t\t\t\t\t\taddReference('tool', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\t// Strips the tool's tokens AND drops it from whichever list holds it\n\t\t\t\t\t\t// (catalog `tools` or an inline custom-tool list).\n\t\t\t\t\t\tonRemove={(id) => removeReference('tool', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'tool' }}\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectableListSection\n\t\t\t\t\t\ttitle=\"Sub-agents\"\n\t\t\t\t\t\thelper=\"Other agents this agent can hand off the conversation to.\"\n\t\t\t\t\t\tdataTestPrefix=\"agent-subagents\"\n\t\t\t\t\t\titems={subAgentItems}\n\t\t\t\t\t\taddableOptions={subAgentOptions}\n\t\t\t\t\t\tmentionItems={subAgentMentionItems}\n\t\t\t\t\t\temptyText=\"No sub-agents added yet.\"\n\t\t\t\t\t\tonAdd={(id) => {\n\t\t\t\t\t\t\tinsertMention('subagent', id);\n\t\t\t\t\t\t\taddReference('subagent', id);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\tonRemove={(id) => removeReference('subagent', id)}\n\t\t\t\t\t\tconfirmDelete={{ noun: 'sub-agent' }}\n\t\t\t\t\t\tonConfigure={onFetchSubAgent ? openConfigure : undefined}\n\t\t\t\t\t\tcreateOption={\n\t\t\t\t\t\t\tonCreateSubAgent\n\t\t\t\t\t\t\t\t? { label: 'Create new', onSelect: openCreate }\n\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\n\t\t\t\t\t{availableModels.length > 0 && (\n\t\t\t\t\t\t<SideSection>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\tAdvanced settings\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\tSelect AI model\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t<Dropdown\n\t\t\t\t\t\t\t\tdata-test=\"agent-model\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\t\t\t\tplaceHolder=\"Select model\"\n\t\t\t\t\t\t\t\toptions={modelOptions}\n\t\t\t\t\t\t\t\tdefaultOptions={\n\t\t\t\t\t\t\t\t\tselectedModel\n\t\t\t\t\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\tlabel: selectedModel.label,\n\t\t\t\t\t\t\t\t\t\t\t\t\tvalue: selectedModel.value,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\t\t\t\tupdateField('model', v);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</SideSection>\n\t\t\t\t\t)}\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</Step3Grid>\n\n\t\t\t{panel && (\n\t\t\t\t<CreateSubAgentPanel\n\t\t\t\t\tkey={panel.key}\n\t\t\t\t\ttitle={panel.title}\n\t\t\t\t\tinitial={panel.initial}\n\t\t\t\t\tavailableTools={availableTools}\n\t\t\t\t\tconfigToolTemplates={configToolTemplates}\n\t\t\t\t\tappLabel={appTypeLabel(applicationType)}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\n\t\t\t\t\tonImproveToolInstructions={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setPanel(null)}\n\t\t\t\t\tonSave={handlePanelSave}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'restapi' && (\n\t\t\t\t<RestApiToolPanel\n\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\tinitial={toolDrawer.initialRest}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\tonSave={handleSaveRestApi}\n\t\t\t\t/>\n\t\t\t)}\n\n\t\t\t{toolDrawer?.kind === 'config' &&\n\t\t\t\ttoolDrawer.toolKey &&\n\t\t\t\topenConfigTemplate && (\n\t\t\t\t\t<ConfigToolPanel\n\t\t\t\t\t\tkey={toolDrawer.key}\n\t\t\t\t\t\ttoolKey={toolDrawer.toolKey}\n\t\t\t\t\t\ttemplate={openConfigTemplate}\n\t\t\t\t\t\tinitial={toolDrawer.initialConfig}\n\t\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\t\tonImprove={onImproveToolInstructions}\n\t\t\t\t\t\tonClose={() => setToolDrawer(null)}\n\t\t\t\t\t\tonSave={handleSaveConfigTool}\n\t\t\t\t\t/>\n\t\t\t\t)}\n\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","sourceIcon","toolOption","ToolSource","STEP","STEP_DEFINITIONS","upsertById","list","item","arr","x","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","configToolTemplates","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","registerSubAgentCreator","registerToolActionHandler","integrationStatus","onConnectIntegration","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","toolDrawer","setToolDrawer","toolDrawerKeyRef","openRestApi","useCallback","initial","openConfigTool","toolKey","handleSaveRestApi","config","isNew","t","restApiMentionItem","handleSaveConfigTool","configToolMentionItem","openToolAction","CONFIG_TOOL_SOURCES","useEffect","createdSubAgents","setCreatedSubAgents","subAgentById","s","knownSubAgents","openCreate","openConfigure","id","data","handlePanelSave","draft","ref","prev","toolItems","tool","restApiItems","restApiToolName","SOURCE_ICONS","configToolItems","configToolName","allToolItems","toolActionSources","buildToolActions","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","appLabel","appTypeLabel","toolMentionItems","buildAgentMentionItems","buildCustomToolMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","openConfigTemplate","Step3Root","jsx","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","TitleSmall","COLORS","Dropdown","opt","v","unwrapDropdownValue","CreateSubAgentPanel","RestApiToolPanel","ConfigToolPanel"],"mappings":";;;;;;;;;;;;;;;;;;;AAmDA,MAAMA,KAAa,CAACC,MACnBC,GAAiBC,GAAWF,CAAM,CAAC,KAAK,QAGnCG,KAAa,CAAC,OAAgC;AAAA,EACnD,OAAO,EAAE;AAAA,EACT,OAAO,EAAE;AAAA,EACT,aAAaJ,GAAW,EAAE,UAAUK,EAAW,QAAQ;AACxD,IAEMC,KAAOC,GAAiB,CAAC,GAwBzBC,KAAa,CAClBC,GACAC,MACS;AACT,QAAMC,IAAMF,KAAQ,CAAA;AACpB,SAAOE,EAAI,KAAK,CAACC,MAAMA,EAAE,OAAOF,EAAK,EAAE,IACpCC,EAAI,IAAI,CAACC,MAAOA,EAAE,OAAOF,EAAK,KAAKA,IAAOE,CAAE,IAC5C,CAAC,GAAGD,GAAKD,CAAI;AACjB,GAEaG,KAA+B,MAAM;AACjD,QAAM;AAAA,IACL,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAA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