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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/dist/cjs/components/SearchFilter/index.js +1 -1
  2. package/dist/cjs/components/SearchFilter/index.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  4. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +51 -39
  6. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js +1 -1
  8. package/dist/cjs/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js +1 -1
  10. package/dist/cjs/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  11. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +2 -2
  12. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/DiscardModal.js +1 -1
  16. package/dist/cjs/components/agent-builder/components/DiscardModal.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/GoLiveModal.js +1 -1
  18. package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  20. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/components/MentionPicker.js +22 -22
  22. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  23. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +4 -4
  24. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  25. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +6 -6
  26. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js +1 -1
  28. package/dist/cjs/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
  30. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  32. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  33. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +3 -1
  34. package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  35. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  36. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  37. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  38. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  39. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +5 -3
  40. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  41. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  42. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  43. package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
  44. package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
  45. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  46. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  47. package/dist/cjs/components/agent-listing/AgentTableShimmer.js +2 -0
  48. package/dist/cjs/components/agent-listing/AgentTableShimmer.js.map +1 -0
  49. package/dist/cjs/components/agent-listing/DeleteAgentModal.js +1 -1
  50. package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -1
  51. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js +1 -1
  52. package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
  53. package/dist/cjs/components/button/Button.styled.js +1 -0
  54. package/dist/cjs/components/button/Button.styled.js.map +1 -1
  55. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js +1 -1
  56. package/dist/cjs/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
  57. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  58. package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
  59. package/dist/cjs/components/input/Input.js +1 -1
  60. package/dist/cjs/components/input/Input.js.map +1 -1
  61. package/dist/cjs/components/multi-level-dropdown/MenuItem.js +1 -1
  62. package/dist/cjs/components/multi-level-dropdown/MenuItem.js.map +1 -1
  63. package/dist/cjs/components/radioButton/RadioButton.js +1 -1
  64. package/dist/cjs/components/radioButton/RadioButton.js.map +1 -1
  65. package/dist/cjs/components/radioList/RadioList.js +1 -1
  66. package/dist/cjs/components/radioList/RadioList.js.map +1 -1
  67. package/dist/cjs/components/searchBar/searchBar.js +1 -1
  68. package/dist/cjs/components/searchBar/searchBar.js.map +1 -1
  69. package/dist/cjs/components/side-modal/SideModal.js +1 -1
  70. package/dist/cjs/components/side-modal/SideModal.js.map +1 -1
  71. package/dist/cjs/components/star-rating/Star.js +1 -1
  72. package/dist/cjs/components/star-rating/Star.js.map +1 -1
  73. package/dist/cjs/components/star-rating/StarRating.js +2 -2
  74. package/dist/cjs/components/star-rating/StarRating.js.map +1 -1
  75. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  76. package/dist/cjs/components/template-preview/TemplatePreview.js.map +1 -1
  77. package/dist/cjs/components/thumbnail/Thumbnail.js +1 -1
  78. package/dist/cjs/components/thumbnail/Thumbnail.js.map +1 -1
  79. package/dist/cjs/components/zeroState/ZeroState.js +3 -3
  80. package/dist/cjs/components/zeroState/ZeroState.js.map +1 -1
  81. package/dist/cjs/editor/BikEditor.js +1 -1
  82. package/dist/cjs/editor/BikEditor.js.map +1 -1
  83. package/dist/cjs/editor/BikEditor.styles.js +97 -54
  84. package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
  85. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js +3 -3
  86. package/dist/cjs/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  87. package/dist/esm/components/SearchFilter/index.js +11 -10
  88. package/dist/esm/components/SearchFilter/index.js.map +1 -1
  89. package/dist/esm/components/agent-builder/AgentBuilder.js +106 -102
  90. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  91. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +3 -6
  92. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +118 -106
  93. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  94. package/dist/esm/components/agent-builder/__fixtures__/agentValue.d.ts +11 -0
  95. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js +29 -21
  96. package/dist/esm/components/agent-builder/components/AgentBuilderFooter.js.map +1 -1
  97. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js +27 -26
  98. package/dist/esm/components/agent-builder/components/AgentBuilderTopBar.js.map +1 -1
  99. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +25 -25
  100. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  101. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +24 -23
  102. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  103. package/dist/esm/components/agent-builder/components/DiscardModal.d.ts +3 -1
  104. package/dist/esm/components/agent-builder/components/DiscardModal.js +33 -24
  105. package/dist/esm/components/agent-builder/components/DiscardModal.js.map +1 -1
  106. package/dist/esm/components/agent-builder/components/GoLiveModal.js +23 -21
  107. package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
  108. package/dist/esm/components/agent-builder/components/MentionEditor.js +19 -19
  109. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  110. package/dist/esm/components/agent-builder/components/MentionPicker.js +177 -147
  111. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  112. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +2 -0
  113. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +111 -105
  114. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  115. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +13 -4
  116. package/dist/esm/components/agent-builder/components/SelectableListSection.js +173 -148
  117. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  118. package/dist/esm/components/agent-builder/components/StepSectionHeader.js +7 -7
  119. package/dist/esm/components/agent-builder/components/StepSectionHeader.js.map +1 -1
  120. package/dist/esm/components/agent-builder/constants/tools.js +1 -1
  121. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
  122. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +104 -103
  123. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  124. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +101 -102
  125. package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
  126. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +144 -142
  127. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  128. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +23 -79
  129. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  130. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +35 -23
  131. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  132. package/dist/esm/components/agent-listing/AgentListing.js +70 -65
  133. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  134. package/dist/esm/components/agent-listing/AgentTable.d.ts +2 -0
  135. package/dist/esm/components/agent-listing/AgentTable.js +16 -15
  136. package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
  137. package/dist/esm/components/agent-listing/AgentTableRow.js +11 -11
  138. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  139. package/dist/esm/components/agent-listing/AgentTableShimmer.d.ts +12 -0
  140. package/dist/esm/components/agent-listing/AgentTableShimmer.js +20 -0
  141. package/dist/esm/components/agent-listing/AgentTableShimmer.js.map +1 -0
  142. package/dist/esm/components/agent-listing/DeleteAgentModal.js +8 -8
  143. package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -1
  144. package/dist/esm/components/agent-listing/__fixtures__/agents.d.ts +3 -0
  145. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js +11 -10
  146. package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsChip.js.map +1 -1
  147. package/dist/esm/components/button/Button.styled.js +25 -19
  148. package/dist/esm/components/button/Button.styled.js.map +1 -1
  149. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js +28 -21
  150. package/dist/esm/components/dashboard-review-popup/DashboardReviewPopUp.js.map +1 -1
  151. package/dist/esm/components/dropdown/Dropdown.js +18 -13
  152. package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
  153. package/dist/esm/components/input/Input.js +35 -34
  154. package/dist/esm/components/input/Input.js.map +1 -1
  155. package/dist/esm/components/input/Input.model.d.ts +1 -0
  156. package/dist/esm/components/multi-level-dropdown/MenuItem.js +28 -27
  157. package/dist/esm/components/multi-level-dropdown/MenuItem.js.map +1 -1
  158. package/dist/esm/components/radioButton/RadioButton.js +10 -9
  159. package/dist/esm/components/radioButton/RadioButton.js.map +1 -1
  160. package/dist/esm/components/radioList/RadioList.js +28 -19
  161. package/dist/esm/components/radioList/RadioList.js.map +1 -1
  162. package/dist/esm/components/searchBar/searchBar.js +11 -10
  163. package/dist/esm/components/searchBar/searchBar.js.map +1 -1
  164. package/dist/esm/components/side-modal/SideModal.js +13 -5
  165. package/dist/esm/components/side-modal/SideModal.js.map +1 -1
  166. package/dist/esm/components/star-rating/Star.d.ts +1 -0
  167. package/dist/esm/components/star-rating/Star.js +32 -27
  168. package/dist/esm/components/star-rating/Star.js.map +1 -1
  169. package/dist/esm/components/star-rating/StarRating.js +17 -16
  170. package/dist/esm/components/star-rating/StarRating.js.map +1 -1
  171. package/dist/esm/components/template-preview/TemplatePreview.js +41 -40
  172. package/dist/esm/components/template-preview/TemplatePreview.js.map +1 -1
  173. package/dist/esm/components/thumbnail/Thumbnail.js +3 -3
  174. package/dist/esm/components/thumbnail/Thumbnail.js.map +1 -1
  175. package/dist/esm/components/zeroState/ZeroState.js +20 -13
  176. package/dist/esm/components/zeroState/ZeroState.js.map +1 -1
  177. package/dist/esm/editor/BikEditor.js +173 -160
  178. package/dist/esm/editor/BikEditor.js.map +1 -1
  179. package/dist/esm/editor/BikEditor.styles.d.ts +20 -3
  180. package/dist/esm/editor/BikEditor.styles.js +102 -57
  181. package/dist/esm/editor/BikEditor.styles.js.map +1 -1
  182. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.d.ts +5 -8
  183. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js +87 -68
  184. package/dist/esm/editor/extensions/jsonHighlight/JsonHighlightExtension.js.map +1 -1
  185. package/package.json +1 -1
@@ -1,109 +1,109 @@
1
- import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
- import { useState as N, useRef as U, useCallback as r, useEffect as j } from "react";
3
- import { TitleSmall as W } from "../../TypographyStyle.js";
4
- import { COLORS as $ } from "../../../constants/Theme.js";
5
- import { Step3Root as ve, Step3Grid as ye, SectionBodyWrap as z, Step3Divider as Ie, SideSection as Ce } from "../AgentBuilder.styled.js";
6
- import { ConfigToolPanel as we } from "../components/ConfigToolPanel.js";
7
- import { CreateSubAgentPanel as ke } from "../components/CreateSubAgentPanel.js";
8
- import { MentionField as V } from "../components/MentionField.js";
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";
7
+ import { CreateSubAgentPanel as Re } from "../components/CreateSubAgentPanel.js";
8
+ import { MentionField as z } from "../components/MentionField.js";
9
9
  import { RestApiToolPanel as Oe } from "../components/RestApiToolPanel.js";
10
- import { SelectableListSection as q } from "../components/SelectableListSection.js";
11
- import { StepSectionHeader as Re } from "../components/StepSectionHeader.js";
12
- import { STEP_DEFINITIONS as Me } from "../constants/steps.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
13
  import { CONFIG_TOOL_SOURCES as Ee, ToolSource as g } from "../constants/tools.js";
14
- import { useAgentBuilderContext as _e } from "../context/AgentBuilderContext.js";
15
- import { restApiMentionItem as xe, configToolMentionItem as Ke, restApiToolName as Le, configToolName as Ne, toolSourceLabel as De, buildAgentMentionItems as J, buildCustomToolMentionItems as Pe, appTypeLabel as Q } from "../utils/mentionSerialization.js";
16
- import { sourceIcon as oe, SOURCE_ICONS as X, renderSourceIcon as He } from "../utils/sourceIcons.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
17
  import { buildToolActions as Fe } from "../utils/toolActions.js";
18
18
  import { Dropdown as Ge } from "../../dropdown/Dropdown.js";
19
- import { unwrapDropdownValue as Be } from "../../dropdown/utils.js";
20
- const Ue = (t) => He(oe(t)) ?? void 0, Y = (t) => ({
19
+ import { unwrapDropdownValue as Ue } from "../../dropdown/utils.js";
20
+ const We = (t) => Be(ee(t)) ?? void 0, X = (t) => ({
21
21
  label: t.display_name,
22
22
  value: t.tool_id,
23
- leadingIcon: Ue(t.source ?? g.Manifest)
24
- }), Z = Me[2], ee = (t, i) => {
23
+ leadingIcon: We(t.source ?? g.Manifest)
24
+ }), Y = xe[2], Z = (t, s) => {
25
25
  const f = t ?? [];
26
- return f.some((c) => c.id === i.id) ? f.map((c) => c.id === i.id ? i : c) : [...f, i];
27
- }, ro = () => {
26
+ return f.some((c) => c.id === s.id) ? f.map((c) => c.id === s.id ? s : c) : [...f, s];
27
+ }, co = () => {
28
28
  const {
29
29
  value: t,
30
- patch: i,
30
+ patch: s,
31
31
  updateField: f,
32
32
  addReference: c,
33
- removeReference: D,
33
+ removeReference: L,
34
34
  availableTools: b,
35
- availableSubAgents: te,
35
+ availableSubAgents: oe,
36
36
  availableModels: C,
37
37
  configToolTemplates: w,
38
38
  applicationType: P,
39
39
  charLimits: S,
40
40
  insertMention: a,
41
- onCreateSubAgent: u,
42
- onFetchSubAgent: h,
41
+ onCreateSubAgent: p,
42
+ onFetchSubAgent: T,
43
43
  onUpdateSubAgent: k,
44
- onImproveSubAgent: ne,
45
- onImproveToolInstructions: O,
46
- registerSubAgentCreator: R,
44
+ onImproveSubAgent: te,
45
+ onImproveToolInstructions: R,
46
+ registerSubAgentCreator: O,
47
47
  registerToolActionHandler: M
48
- } = _e(), [d, A] = N(null), v = U(0), [s, p] = N(null), y = U(0), E = r((e) => {
49
- y.current += 1, p({
50
- key: y.current,
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,
51
51
  kind: "restapi",
52
52
  initialRest: e
53
53
  });
54
- }, []), _ = r(
54
+ }, []), E = r(
55
55
  (e, o) => {
56
- y.current += 1, p({
57
- key: y.current,
56
+ v.current += 1, u({
57
+ key: v.current,
58
58
  kind: "config",
59
59
  toolKey: e,
60
60
  initialConfig: o
61
61
  });
62
62
  },
63
63
  []
64
- ), le = r(
64
+ ), ne = r(
65
65
  (e) => {
66
66
  const o = !(t.restApiTools ?? []).some((n) => n.id === e.id);
67
- i({ restApiTools: ee(t.restApiTools, e) }), o && a("tool", e.id, xe(e).label), p(null);
67
+ s({ restApiTools: Z(t.restApiTools, e) }), o && a("tool", e.id, _e(e).label), u(null);
68
68
  },
69
- [i, t.restApiTools, a]
69
+ [s, t.restApiTools, a]
70
70
  ), ie = r(
71
71
  (e) => {
72
72
  const o = !(t.configTools ?? []).some((n) => n.id === e.id);
73
- i({ configTools: ee(t.configTools, e) }), o && a("tool", e.id, Ke(e).label), p(null);
73
+ s({ configTools: Z(t.configTools, e) }), o && a("tool", e.id, De(e).label), u(null);
74
74
  },
75
- [i, t.configTools, a]
76
- ), x = r(
75
+ [s, t.configTools, a]
76
+ ), N = r(
77
77
  (e) => {
78
78
  const o = Ee[e];
79
- o ? _(o) : E();
79
+ o ? E(o) : x();
80
80
  },
81
- [_, E]
81
+ [E, x]
82
82
  );
83
- j(() => (M(x), () => M(null)), [M, x]);
84
- const [se, H] = N([]), I = /* @__PURE__ */ new Map();
85
- te.forEach((e) => I.set(e.id, e)), se.forEach((e) => I.set(e.id, e));
86
- const F = Array.from(I.values()), K = r(() => {
87
- v.current += 1, A({ key: v.current, title: "Create sub-agent" });
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" });
88
88
  }, []);
89
- j(() => {
90
- if (u)
91
- return R(K), () => R(null);
92
- }, [R, K, u]);
93
- const ae = r(
89
+ W(() => {
90
+ if (p)
91
+ return O(_), () => O(null);
92
+ }, [O, _, p]);
93
+ const se = r(
94
94
  async (e) => {
95
- if (!h)
95
+ if (!T)
96
96
  return;
97
- const o = await h(e);
98
- v.current += 1, A({
99
- key: v.current,
97
+ const o = await T(e);
98
+ A.current += 1, y({
99
+ key: A.current,
100
100
  title: "Edit sub-agent",
101
101
  editingId: e,
102
102
  initial: o
103
103
  });
104
104
  },
105
- [h]
106
- ), re = r(
105
+ [T]
106
+ ), ae = r(
107
107
  async (e) => {
108
108
  if (d?.editingId) {
109
109
  if (k) {
@@ -113,162 +113,163 @@ const Ue = (t) => He(oe(t)) ?? void 0, Y = (t) => ({
113
113
  o
114
114
  ]);
115
115
  }
116
- } else if (u) {
117
- const o = await u(e);
118
- H((n) => [...n, o]), i({ subagents: [...t.subagents, o.id] }), a("subagent", o.id, `sub-agent: ${o.name}`);
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}`);
119
119
  }
120
- A(null);
120
+ y(null);
121
121
  },
122
122
  [
123
123
  d,
124
124
  k,
125
- u,
126
- i,
125
+ p,
126
+ s,
127
127
  t.subagents,
128
128
  a
129
129
  ]
130
- ), ce = t.tools.map((e) => {
130
+ ), re = t.tools.map((e) => {
131
131
  const o = b.find((n) => n.tool_id === e);
132
132
  return o ? {
133
133
  id: e,
134
134
  label: o.display_name,
135
- icon: oe(o.source ?? g.Manifest)
135
+ icon: ee(o.source ?? g.Manifest)
136
136
  } : null;
137
- }).filter((e) => e !== null), de = (t.restApiTools ?? []).map(
137
+ }).filter((e) => e !== null), ce = (t.restApiTools ?? []).map(
138
138
  (e) => ({
139
139
  id: e.id,
140
- label: Le(e),
141
- icon: X[g.RestApi],
142
- onConfigure: () => E(e)
140
+ label: Ke(e),
141
+ icon: Q[g.RestApi],
142
+ onConfigure: () => x(e)
143
143
  })
144
- ), ue = (t.configTools ?? []).map(
144
+ ), de = (t.configTools ?? []).map(
145
145
  (e) => ({
146
146
  id: e.id,
147
- label: Ne(e),
148
- icon: X[e.tool_key === "send_slack_message" ? g.Slack : g.EmailHandover],
149
- onConfigure: () => _(e.tool_key, e)
147
+ label: Le(e),
148
+ icon: Q[e.tool_key === "send_slack_message" ? g.Slack : g.EmailHandover],
149
+ onConfigure: () => E(e.tool_key, e)
150
150
  })
151
151
  ), pe = [
152
+ ...re,
152
153
  ...ce,
153
- ...de,
154
- ...ue
155
- ], me = Fe(
154
+ ...de
155
+ ], ue = Fe(
156
156
  w,
157
- x
158
- ), ge = b.map(Y), fe = (() => {
157
+ N
158
+ ), me = b.map(X), ge = (() => {
159
159
  const e = [], o = /* @__PURE__ */ new Map();
160
160
  return b.forEach((n) => {
161
161
  const m = n.source ?? g.Manifest;
162
- o.has(m) || (o.set(m, []), e.push(m)), o.get(m)?.push(Y(n));
162
+ o.has(m) || (o.set(m, []), e.push(m)), o.get(m)?.push(X(n));
163
163
  }), e.map((n) => ({
164
164
  source: n,
165
- label: De(n),
165
+ label: Pe(n),
166
166
  options: o.get(n) ?? []
167
167
  }));
168
- })(), be = t.subagents.map((e) => {
168
+ })(), fe = t.subagents.map((e) => {
169
169
  const o = I.get(e);
170
170
  return o ? { id: e, label: o.name } : null;
171
- }).filter((e) => e !== null), Se = F.map((e) => ({
171
+ }).filter((e) => e !== null), be = B.map((e) => ({
172
172
  label: e.name,
173
173
  value: e.id
174
- })), G = Q(P), Te = [
175
- ...J(b, [], G),
176
- ...Pe(t.configTools, t.restApiTools)
177
- ], he = J(
174
+ })), F = J(P), Se = [
175
+ ...q(b, [], F),
176
+ ...He(t.configTools, t.restApiTools)
177
+ ], he = q(
178
178
  [],
179
- F,
180
- G
181
- ), Ae = C.map((e) => ({
179
+ B,
180
+ F
181
+ ), Te = C.map((e) => ({
182
182
  label: e.label,
183
183
  value: e.value,
184
184
  selected: e.value === t.model
185
- })), L = C.find((e) => e.value === t.model), B = s?.kind === "config" && s.toolKey ? w?.[s.toolKey] : void 0;
186
- return /* @__PURE__ */ T(ve, { children: [
187
- /* @__PURE__ */ l(Re, { title: Z.title, helper: Z.helper }),
188
- /* @__PURE__ */ T(ye, { $grow: !0, children: [
189
- /* @__PURE__ */ T(z, { children: [
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: [
190
190
  /* @__PURE__ */ l(
191
- V,
191
+ z,
192
192
  {
193
193
  fieldKey: "instructions",
194
194
  "data-test": "agent-instructions",
195
195
  label: "Instructions",
196
196
  maxLength: S.instructions,
197
- placeholder: "Write what this agent should do. Type @ to reference a tool or sub-agent.",
197
+ placeholder: "Write the steps in plain English. The agent will follow them exactly. The more specific you are, the better it performs.",
198
198
  minHeight: "200px"
199
199
  }
200
200
  ),
201
201
  /* @__PURE__ */ l(
202
- V,
202
+ z,
203
203
  {
204
204
  fieldKey: "guardrail",
205
205
  "data-test": "agent-guardrail",
206
206
  label: "Guardrails",
207
207
  maxLength: S.guardrail,
208
- placeholder: "Things this agent must never do. Type @ to reference a tool or sub-agent.",
208
+ placeholder: "e.g. Never discuss competitor pricing. Always stay within the cancellation policy. Do not process refunds above ₹10,000 without human approval.",
209
209
  minHeight: "140px"
210
210
  }
211
211
  )
212
212
  ] }),
213
- /* @__PURE__ */ l(Ie, {}),
214
- /* @__PURE__ */ T(z, { children: [
213
+ /* @__PURE__ */ l(Ce, {}),
214
+ /* @__PURE__ */ h($, { children: [
215
215
  /* @__PURE__ */ l(
216
- q,
216
+ V,
217
217
  {
218
218
  title: "Tools",
219
219
  helper: "Actions this agent can take while responding.",
220
220
  dataTestPrefix: "agent-tools",
221
221
  items: pe,
222
- addableOptions: ge,
223
- sourceGroups: fe,
224
- mentionItems: Te,
225
- actionSources: me,
222
+ addableOptions: me,
223
+ sourceGroups: ge,
224
+ mentionItems: Se,
225
+ actionSources: ue,
226
226
  emptyText: "No tools added yet.",
227
227
  onAdd: (e) => {
228
228
  a("tool", e), c("tool", e);
229
229
  },
230
- onRemove: (e) => D("tool", e),
230
+ onRemove: (e) => L("tool", e),
231
231
  confirmDelete: { noun: "tool" }
232
232
  }
233
233
  ),
234
234
  /* @__PURE__ */ l(
235
- q,
235
+ V,
236
236
  {
237
237
  title: "Sub-agents",
238
238
  helper: "Other agents this agent can hand off the conversation to.",
239
239
  dataTestPrefix: "agent-subagents",
240
- items: be,
241
- addableOptions: Se,
240
+ items: fe,
241
+ addableOptions: be,
242
242
  mentionItems: he,
243
243
  emptyText: "No sub-agents added yet.",
244
244
  onAdd: (e) => {
245
245
  a("subagent", e), c("subagent", e);
246
246
  },
247
- onRemove: (e) => D("subagent", e),
247
+ onRemove: (e) => L("subagent", e),
248
248
  confirmDelete: { noun: "sub-agent" },
249
- onConfigure: h ? ae : void 0,
250
- createOption: u ? { label: "Create new", onSelect: K } : void 0
249
+ onConfigure: T ? se : void 0,
250
+ createOption: p ? { label: "Create new", onSelect: _ } : void 0
251
251
  }
252
252
  ),
253
- C.length > 0 && /* @__PURE__ */ T(Ce, { children: [
254
- /* @__PURE__ */ l(W, { color: $.content.primary, children: "Advanced settings" }),
255
- /* @__PURE__ */ l(W, { color: $.content.secondary, children: "Select AI model" }),
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" }),
256
256
  /* @__PURE__ */ l(
257
257
  Ge,
258
258
  {
259
259
  "data-test": "agent-model",
260
260
  size: "small",
261
261
  width: "100%",
262
+ dropdownWidth: "328px",
262
263
  placeHolder: "Select model",
263
- options: Ae,
264
- defaultOptions: L ? [
264
+ options: Te,
265
+ defaultOptions: D ? [
265
266
  {
266
- label: L.label,
267
- value: L.value
267
+ label: D.label,
268
+ value: D.value
268
269
  }
269
270
  ] : void 0,
270
271
  onSelect: (e) => {
271
- const o = Be(e);
272
+ const o = Ue(e);
272
273
  o && f("model", o);
273
274
  }
274
275
  }
@@ -277,48 +278,49 @@ const Ue = (t) => He(oe(t)) ?? void 0, Y = (t) => ({
277
278
  ] })
278
279
  ] }),
279
280
  d && /* @__PURE__ */ l(
280
- ke,
281
+ Re,
281
282
  {
282
283
  title: d.title,
283
284
  initial: d.initial,
284
285
  availableTools: b,
285
286
  configToolTemplates: w,
286
- appLabel: Q(P),
287
+ appLabel: J(P),
287
288
  charLimits: S,
288
- onImprove: ne,
289
- onImproveToolInstructions: O,
290
- onClose: () => A(null),
291
- onSave: re
289
+ onImprove: te,
290
+ onImproveToolInstructions: R,
291
+ onClose: () => y(null),
292
+ onSave: ae
292
293
  },
293
294
  d.key
294
295
  ),
295
- s?.kind === "restapi" && /* @__PURE__ */ l(
296
+ i?.kind === "restapi" && /* @__PURE__ */ l(
296
297
  Oe,
297
298
  {
298
- initial: s.initialRest,
299
+ initial: i.initialRest,
299
300
  charLimits: S,
300
- onImprove: O,
301
- onClose: () => p(null),
302
- onSave: le
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
303
305
  },
304
- s.key
306
+ i.key
305
307
  ),
306
- s?.kind === "config" && s.toolKey && B && /* @__PURE__ */ l(
307
- we,
308
+ i?.kind === "config" && i.toolKey && G && /* @__PURE__ */ l(
309
+ ke,
308
310
  {
309
- toolKey: s.toolKey,
310
- template: B,
311
- initial: s.initialConfig,
311
+ toolKey: i.toolKey,
312
+ template: G,
313
+ initial: i.initialConfig,
312
314
  charLimits: S,
313
- onImprove: O,
314
- onClose: () => p(null),
315
+ onImprove: R,
316
+ onClose: () => u(null),
315
317
  onSave: ie
316
318
  },
317
- s.key
319
+ i.key
318
320
  )
319
321
  ] });
320
322
  };
321
323
  export {
322
- ro as Step3HowItResponds
324
+ co as Step3HowItResponds
323
325
  };
324
326
  //# 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 { 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 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","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,IAAa,CAAC,OAAgC;AAAA,EACnD,OAAO,EAAE;AAAA,EACT,OAAO,EAAE;AAAA,EACT,aAAaJ,GAAW,EAAE,UAAUK,EAAW,QAAQ;AACxD,IAEMC,IAAOC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A,QACtC,YAAAC;AAAA,QACA,WAAWK;AAAA,QACX,2BAAAC;AAAA,QACA,SAAS,MAAMK,EAAS,IAAI;AAAA,QAC5B,QAAQ+B;AAAA,MAAA;AAAA,MAVHhC,EAAM;AAAA,IAAA;AAAA,IAcZK,GAAY,SAAS,aACrB,gBAAA6D;AAAA,MAACgB;AAAA,MAAA;AAAA,QAEA,SAAS7E,EAAW;AAAA,QACpB,YAAAf;AAAA,QACA,WAAWM;AAAA,QACX,SAAS,MAAMU,EAAc,IAAI;AAAA,QACjC,QAAQO;AAAA,MAAA;AAAA,MALHR,EAAW;AAAA,IAAA;AAAA,IASjBA,GAAY,SAAS,YACrBA,EAAW,WACX2D,KACC,gBAAAE;AAAA,MAACiB;AAAA,MAAA;AAAA,QAEA,SAAS9E,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 { 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,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;AAC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