@bikdotai/bik-component-library 0.0.829 → 0.0.830-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 (87) hide show
  1. package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
  2. package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +17 -65
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +41 -0
  6. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
  7. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
  8. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js +9 -0
  10. package/dist/cjs/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
  11. package/dist/cjs/components/agent-builder/components/MentionEditor.js +1 -1
  12. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/MentionPicker.js +20 -20
  16. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  17. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +23 -0
  18. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
  19. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +5 -5
  20. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +5 -0
  22. package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
  23. package/dist/cjs/components/agent-builder/constants/tools.js +2 -0
  24. package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -0
  25. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  26. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  27. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  28. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  29. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -3
  30. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  31. package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
  32. package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
  33. package/dist/cjs/components/side-modal/SideModal.style.js +11 -10
  34. package/dist/cjs/components/side-modal/SideModal.style.js.map +1 -1
  35. package/dist/cjs/index.js +1 -1
  36. package/dist/esm/components/agent-builder/AgentBuilder.js +100 -96
  37. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  38. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +144 -1
  39. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +0 -21
  40. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +42 -111
  41. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  42. package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +33 -0
  43. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +242 -0
  44. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -0
  45. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +9 -1
  46. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +318 -219
  47. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  48. package/dist/esm/components/agent-builder/components/DrawerHeaderText.d.ts +25 -0
  49. package/dist/esm/components/agent-builder/components/DrawerHeaderText.js +32 -0
  50. package/dist/esm/components/agent-builder/components/DrawerHeaderText.js.map +1 -0
  51. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +6 -0
  52. package/dist/esm/components/agent-builder/components/MentionEditor.js +38 -30
  53. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
  54. package/dist/esm/components/agent-builder/components/MentionField.js +77 -52
  55. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
  56. package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +7 -0
  57. package/dist/esm/components/agent-builder/components/MentionPicker.js +139 -129
  58. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  59. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +27 -0
  60. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +267 -0
  61. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -0
  62. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +14 -0
  63. package/dist/esm/components/agent-builder/components/SelectableListSection.js +166 -140
  64. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  65. package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +19 -0
  66. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +66 -0
  67. package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -0
  68. package/dist/esm/components/agent-builder/constants/tools.d.ts +65 -0
  69. package/dist/esm/components/agent-builder/constants/tools.js +29 -0
  70. package/dist/esm/components/agent-builder/constants/tools.js.map +1 -0
  71. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +19 -1
  72. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +169 -140
  73. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  74. package/dist/esm/components/agent-builder/index.d.ts +2 -1
  75. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +241 -141
  76. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  77. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +18 -3
  78. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +81 -62
  79. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  80. package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +15 -9
  81. package/dist/esm/components/agent-builder/utils/sourceIcons.js +16 -8
  82. package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
  83. package/dist/esm/components/side-modal/SideModal.style.js +1 -0
  84. package/dist/esm/components/side-modal/SideModal.style.js.map +1 -1
  85. package/dist/esm/index.js +97 -95
  86. package/dist/esm/index.js.map +1 -1
  87. package/package.json +2 -1
@@ -4,5 +4,6 @@ export type { AgentDraft } from './hooks/useAgentDraft';
4
4
  export { AGENT_CHAR_LIMITS } from './constants/charLimits';
5
5
  export type { AgentCharLimits } from './constants/charLimits';
6
6
  export { STEP_DEFINITIONS } from './constants/steps';
7
+ export { ToolSource } from './constants/tools';
7
8
  export { buildAgentMentionItems, editorDocToInstructions, instructionsToEditorHtml, } from './utils/mentionSerialization';
8
- export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, } from './AgentBuilder.model';
9
+ export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, RestApiToolConfig, RestApiMethod, RestApiHeader, ConfigToolConfig, ConfigToolKey, ParamField, ParamsBlob, ToolRef, CatalogTool, CustomTool, } from './AgentBuilder.model';
@@ -1,225 +1,325 @@
1
- import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
- import { useState as R, useRef as ee, useCallback as I, useEffect as te } from "react";
3
- import { TitleSmall as L } from "../../TypographyStyle.js";
4
- import { COLORS as M } from "../../../constants/Theme.js";
5
- import { Step3Root as oe, Step3Grid as ne, SectionBodyWrap as P, Step3Divider as ae, SideSection as le } from "../AgentBuilder.styled.js";
6
- import { CreateSubAgentPanel as ie } from "../components/CreateSubAgentPanel.js";
7
- import { MentionField as k } from "../components/MentionField.js";
8
- import { SelectableListSection as _ } from "../components/SelectableListSection.js";
9
- import { StepSectionHeader as se } from "../components/StepSectionHeader.js";
10
- import { STEP_DEFINITIONS as re } from "../constants/steps.js";
11
- import { useAgentBuilderContext as ce } from "../context/AgentBuilderContext.js";
12
- import { toolSourceLabel as de, buildAgentMentionItems as H, appTypeLabel as N } from "../utils/mentionSerialization.js";
13
- import { SOURCE_ICONS as G, renderSourceIcon as ue } from "../utils/sourceIcons.js";
14
- import { Dropdown as pe } from "../../dropdown/Dropdown.js";
15
- import { unwrapDropdownValue as me } from "../../dropdown/utils.js";
16
- const ge = (o) => ue(G[o]) ?? void 0, D = (o) => ({
17
- label: o.display_name,
18
- value: o.tool_id,
19
- leadingIcon: ge(o.source ?? "manifest")
20
- }), F = re[2], Le = () => {
1
+ import { jsxs as T, jsx as l } from "react/jsx-runtime";
2
+ import { useState as N, useRef as j, useCallback as r, useEffect as W } from "react";
3
+ import { TitleSmall as $ } from "../../TypographyStyle.js";
4
+ import { COLORS as z } from "../../../constants/Theme.js";
5
+ import { Step3Root as ve, Step3Grid as Ie, SectionBodyWrap as V, Step3Divider as Ce, SideSection as Oe } from "../AgentBuilder.styled.js";
6
+ import { ConfigToolPanel as we } from "../components/ConfigToolPanel.js";
7
+ import { CreateSubAgentPanel as Re } from "../components/CreateSubAgentPanel.js";
8
+ import { MentionField as q } from "../components/MentionField.js";
9
+ import { RestApiToolPanel as ke } from "../components/RestApiToolPanel.js";
10
+ import { SelectableListSection as J } from "../components/SelectableListSection.js";
11
+ import { StepSectionHeader as _e } from "../components/StepSectionHeader.js";
12
+ import { STEP_DEFINITIONS as Ee } from "../constants/steps.js";
13
+ import { CONFIG_TOOL_SOURCES as Q, ToolSource as g, TOOL_ACTION_SOURCES as Le, TOOL_SOURCE_LABELS as Me } from "../constants/tools.js";
14
+ import { useAgentBuilderContext as xe } from "../context/AgentBuilderContext.js";
15
+ import { restApiMentionItem as Ke, configToolMentionItem as Ne, restApiToolName as Pe, configToolName as De, toolSourceLabel as He, buildAgentMentionItems as X, appTypeLabel as Y } from "../utils/mentionSerialization.js";
16
+ import { sourceIcon as te, SOURCE_ICONS as P, renderSourceIcon as Be } from "../utils/sourceIcons.js";
17
+ import { Dropdown as Fe } from "../../dropdown/Dropdown.js";
18
+ import { unwrapDropdownValue as Ge } from "../../dropdown/utils.js";
19
+ const Ue = (t) => Be(te(t)) ?? void 0, Z = (t) => ({
20
+ label: t.display_name,
21
+ value: t.tool_id,
22
+ leadingIcon: Ue(t.source ?? g.Manifest)
23
+ }), ee = Ee[2], oe = (t, i) => {
24
+ const f = t ?? [];
25
+ return f.some((c) => c.id === i.id) ? f.map((c) => c.id === i.id ? i : c) : [...f, i];
26
+ }, so = () => {
21
27
  const {
22
- value: o,
23
- patch: A,
24
- updateField: B,
25
- addReference: w,
26
- removeReference: C,
27
- availableTools: r,
28
- availableSubAgents: K,
29
- availableModels: b,
30
- applicationType: T,
31
- charLimits: f,
32
- insertMention: d,
33
- onCreateSubAgent: i,
34
- onFetchSubAgent: u,
35
- onUpdateSubAgent: h,
36
- onImproveSubAgent: j,
37
- registerSubAgentCreator: S
38
- } = ce(), [l, p] = R(null), m = ee(0), [U, O] = R([]), g = /* @__PURE__ */ new Map();
39
- K.forEach((e) => g.set(e.id, e)), U.forEach((e) => g.set(e.id, e));
40
- const x = Array.from(g.values()), v = I(() => {
41
- m.current += 1, p({ key: m.current, title: "Create sub-agent" });
28
+ value: t,
29
+ patch: i,
30
+ updateField: f,
31
+ addReference: c,
32
+ removeReference: D,
33
+ availableTools: b,
34
+ availableSubAgents: ne,
35
+ availableModels: C,
36
+ configToolTemplates: O,
37
+ applicationType: H,
38
+ charLimits: S,
39
+ insertMention: s,
40
+ onCreateSubAgent: p,
41
+ onFetchSubAgent: h,
42
+ onUpdateSubAgent: w,
43
+ onImproveSubAgent: le,
44
+ onImproveToolInstructions: R,
45
+ registerSubAgentCreator: k,
46
+ registerToolActionHandler: _
47
+ } = xe(), [d, y] = N(null), A = j(0), [a, u] = N(null), v = j(0), E = r((e) => {
48
+ v.current += 1, u({
49
+ key: v.current,
50
+ kind: "restapi",
51
+ initialRest: e
52
+ });
53
+ }, []), L = r(
54
+ (e, o) => {
55
+ v.current += 1, u({
56
+ key: v.current,
57
+ kind: "config",
58
+ toolKey: e,
59
+ initialConfig: o
60
+ });
61
+ },
62
+ []
63
+ ), ie = r(
64
+ (e) => {
65
+ const o = !(t.restApiTools ?? []).some((n) => n.id === e.id);
66
+ i({ restApiTools: oe(t.restApiTools, e) }), o && s("tool", e.id, Ke(e).label), u(null);
67
+ },
68
+ [i, t.restApiTools, s]
69
+ ), ae = r(
70
+ (e) => {
71
+ const o = !(t.configTools ?? []).some((n) => n.id === e.id);
72
+ i({ configTools: oe(t.configTools, e) }), o && s("tool", e.id, Ne(e).label), u(null);
73
+ },
74
+ [i, t.configTools, s]
75
+ ), M = r(
76
+ (e) => {
77
+ const o = Q[e];
78
+ o ? L(o) : E();
79
+ },
80
+ [L, E]
81
+ );
82
+ W(() => (_(M), () => _(null)), [_, M]);
83
+ const [se, B] = N([]), I = /* @__PURE__ */ new Map();
84
+ ne.forEach((e) => I.set(e.id, e)), se.forEach((e) => I.set(e.id, e));
85
+ const F = Array.from(I.values()), x = r(() => {
86
+ A.current += 1, y({ key: A.current, title: "Create sub-agent" });
42
87
  }, []);
43
- te(() => {
44
- if (i)
45
- return S(v), () => S(null);
46
- }, [S, v, i]);
47
- const W = I(
88
+ W(() => {
89
+ if (p)
90
+ return k(x), () => k(null);
91
+ }, [k, x, p]);
92
+ const re = r(
48
93
  async (e) => {
49
- if (!u)
94
+ if (!h)
50
95
  return;
51
- const t = await u(e);
52
- m.current += 1, p({
53
- key: m.current,
96
+ const o = await h(e);
97
+ A.current += 1, y({
98
+ key: A.current,
54
99
  title: "Edit sub-agent",
55
100
  editingId: e,
56
- initial: t
101
+ initial: o
57
102
  });
58
103
  },
59
- [u]
60
- ), $ = I(
104
+ [h]
105
+ ), ce = r(
61
106
  async (e) => {
62
- if (l?.editingId) {
63
- if (h) {
64
- const t = await h(l.editingId, e);
65
- O((n) => [
66
- ...n.filter((s) => s.id !== t.id),
67
- t
107
+ if (d?.editingId) {
108
+ if (w) {
109
+ const o = await w(d.editingId, e);
110
+ B((n) => [
111
+ ...n.filter((m) => m.id !== o.id),
112
+ o
68
113
  ]);
69
114
  }
70
- } else if (i) {
71
- const t = await i(e);
72
- O((n) => [...n, t]), A({ subagents: [...o.subagents, t.id] }), d("subagent", t.id, `sub-agent: ${t.name}`);
115
+ } else if (p) {
116
+ const o = await p(e);
117
+ B((n) => [...n, o]), i({ subagents: [...t.subagents, o.id] }), s("subagent", o.id, `sub-agent: ${o.name}`);
73
118
  }
74
- p(null);
119
+ y(null);
75
120
  },
76
121
  [
77
- l,
78
- h,
122
+ d,
123
+ w,
124
+ p,
79
125
  i,
80
- A,
81
- o.subagents,
82
- d
126
+ t.subagents,
127
+ s
83
128
  ]
84
- ), z = o.tools.map((e) => {
85
- const t = r.find((n) => n.tool_id === e);
86
- return t ? {
129
+ ), de = t.tools.map((e) => {
130
+ const o = b.find((n) => n.tool_id === e);
131
+ return o ? {
87
132
  id: e,
88
- label: t.display_name,
89
- icon: G[t.source ?? "manifest"]
133
+ label: o.display_name,
134
+ icon: te(o.source ?? g.Manifest)
90
135
  } : null;
91
- }).filter((e) => e !== null), V = r.map(D), q = (() => {
92
- const e = [], t = /* @__PURE__ */ new Map();
93
- return r.forEach((n) => {
94
- const s = n.source ?? "manifest";
95
- t.has(s) || (t.set(s, []), e.push(s)), t.get(s)?.push(D(n));
136
+ }).filter((e) => e !== null), pe = (t.restApiTools ?? []).map(
137
+ (e) => ({
138
+ id: e.id,
139
+ label: Pe(e),
140
+ icon: P[g.RestApi],
141
+ onConfigure: () => E(e)
142
+ })
143
+ ), ue = (t.configTools ?? []).map(
144
+ (e) => ({
145
+ id: e.id,
146
+ label: De(e),
147
+ icon: P[e.tool_key === "send_slack_message" ? g.Slack : g.EmailHandover],
148
+ onConfigure: () => L(e.tool_key, e)
149
+ })
150
+ ), me = [
151
+ ...de,
152
+ ...pe,
153
+ ...ue
154
+ ], ge = Le.filter(
155
+ (e) => {
156
+ const o = Q[e];
157
+ return !o || !!O?.[o];
158
+ }
159
+ ).map((e) => ({
160
+ source: e,
161
+ label: Me[e],
162
+ icon: P[e],
163
+ onSelect: () => M(e)
164
+ })), fe = b.map(Z), be = (() => {
165
+ const e = [], o = /* @__PURE__ */ new Map();
166
+ return b.forEach((n) => {
167
+ const m = n.source ?? g.Manifest;
168
+ o.has(m) || (o.set(m, []), e.push(m)), o.get(m)?.push(Z(n));
96
169
  }), e.map((n) => ({
97
170
  source: n,
98
- label: de(n),
99
- options: t.get(n) ?? []
171
+ label: He(n),
172
+ options: o.get(n) ?? []
100
173
  }));
101
- })(), J = o.subagents.map((e) => {
102
- const t = g.get(e);
103
- return t ? { id: e, label: t.name } : null;
104
- }).filter((e) => e !== null), Q = x.map((e) => ({
174
+ })(), Se = t.subagents.map((e) => {
175
+ const o = I.get(e);
176
+ return o ? { id: e, label: o.name } : null;
177
+ }).filter((e) => e !== null), Te = F.map((e) => ({
105
178
  label: e.name,
106
179
  value: e.id
107
- })), E = N(T), X = H(r, [], E), Y = H(
180
+ })), G = Y(H), he = X(b, [], G), ye = X(
108
181
  [],
109
- x,
110
- E
111
- ), Z = b.map((e) => ({
182
+ F,
183
+ G
184
+ ), Ae = C.map((e) => ({
112
185
  label: e.label,
113
186
  value: e.value,
114
- selected: e.value === o.model
115
- })), y = b.find((e) => e.value === o.model);
116
- return /* @__PURE__ */ c(oe, { children: [
117
- /* @__PURE__ */ a(se, { title: F.title, helper: F.helper }),
118
- /* @__PURE__ */ c(ne, { $grow: !0, children: [
119
- /* @__PURE__ */ c(P, { children: [
120
- /* @__PURE__ */ a(
121
- k,
187
+ selected: e.value === t.model
188
+ })), K = C.find((e) => e.value === t.model), U = a?.kind === "config" && a.toolKey ? O?.[a.toolKey] : void 0;
189
+ return /* @__PURE__ */ T(ve, { children: [
190
+ /* @__PURE__ */ l(_e, { title: ee.title, helper: ee.helper }),
191
+ /* @__PURE__ */ T(Ie, { $grow: !0, children: [
192
+ /* @__PURE__ */ T(V, { children: [
193
+ /* @__PURE__ */ l(
194
+ q,
122
195
  {
123
196
  fieldKey: "instructions",
124
197
  "data-test": "agent-instructions",
125
198
  label: "Instructions",
126
- maxLength: f.instructions,
199
+ maxLength: S.instructions,
127
200
  placeholder: "Write what this agent should do. Type @ to reference a tool or sub-agent.",
128
201
  minHeight: "200px"
129
202
  }
130
203
  ),
131
- /* @__PURE__ */ a(
132
- k,
204
+ /* @__PURE__ */ l(
205
+ q,
133
206
  {
134
207
  fieldKey: "guardrail",
135
208
  "data-test": "agent-guardrail",
136
209
  label: "Guardrails",
137
- maxLength: f.guardrail,
210
+ maxLength: S.guardrail,
138
211
  placeholder: "Things this agent must never do. Type @ to reference a tool or sub-agent.",
139
212
  minHeight: "140px"
140
213
  }
141
214
  )
142
215
  ] }),
143
- /* @__PURE__ */ a(ae, {}),
144
- /* @__PURE__ */ c(P, { children: [
145
- /* @__PURE__ */ a(
146
- _,
216
+ /* @__PURE__ */ l(Ce, {}),
217
+ /* @__PURE__ */ T(V, { children: [
218
+ /* @__PURE__ */ l(
219
+ J,
147
220
  {
148
221
  title: "Tools",
149
222
  helper: "Actions this agent can take while responding.",
150
223
  dataTestPrefix: "agent-tools",
151
- items: z,
152
- addableOptions: V,
153
- sourceGroups: q,
154
- mentionItems: X,
224
+ items: me,
225
+ addableOptions: fe,
226
+ sourceGroups: be,
227
+ mentionItems: he,
228
+ actionSources: ge,
155
229
  emptyText: "No tools added yet.",
156
230
  onAdd: (e) => {
157
- d("tool", e), w("tool", e);
231
+ s("tool", e), c("tool", e);
158
232
  },
159
- onRemove: (e) => C("tool", e)
233
+ onRemove: (e) => D("tool", e)
160
234
  }
161
235
  ),
162
- /* @__PURE__ */ a(
163
- _,
236
+ /* @__PURE__ */ l(
237
+ J,
164
238
  {
165
239
  title: "Sub-agents",
166
240
  helper: "Other agents this agent can hand off the conversation to.",
167
241
  dataTestPrefix: "agent-subagents",
168
- items: J,
169
- addableOptions: Q,
170
- mentionItems: Y,
242
+ items: Se,
243
+ addableOptions: Te,
244
+ mentionItems: ye,
171
245
  emptyText: "No sub-agents added yet.",
172
246
  onAdd: (e) => {
173
- d("subagent", e), w("subagent", e);
247
+ s("subagent", e), c("subagent", e);
174
248
  },
175
- onRemove: (e) => C("subagent", e),
176
- onConfigure: u ? W : void 0,
177
- createOption: i ? { label: "Create new", onSelect: v } : void 0
249
+ onRemove: (e) => D("subagent", e),
250
+ onConfigure: h ? re : void 0,
251
+ createOption: p ? { label: "Create new", onSelect: x } : void 0
178
252
  }
179
253
  ),
180
- b.length > 0 && /* @__PURE__ */ c(le, { children: [
181
- /* @__PURE__ */ a(L, { color: M.content.primary, children: "Advanced settings" }),
182
- /* @__PURE__ */ a(L, { color: M.content.secondary, children: "Select AI model" }),
183
- /* @__PURE__ */ a(
184
- pe,
254
+ C.length > 0 && /* @__PURE__ */ T(Oe, { children: [
255
+ /* @__PURE__ */ l($, { color: z.content.primary, children: "Advanced settings" }),
256
+ /* @__PURE__ */ l($, { color: z.content.secondary, children: "Select AI model" }),
257
+ /* @__PURE__ */ l(
258
+ Fe,
185
259
  {
186
260
  "data-test": "agent-model",
187
261
  size: "small",
188
262
  width: "100%",
189
263
  placeHolder: "Select model",
190
- options: Z,
191
- defaultOptions: y ? [
264
+ options: Ae,
265
+ defaultOptions: K ? [
192
266
  {
193
- label: y.label,
194
- value: y.value
267
+ label: K.label,
268
+ value: K.value
195
269
  }
196
270
  ] : void 0,
197
271
  onSelect: (e) => {
198
- const t = me(e);
199
- t && B("model", t);
272
+ const o = Ge(e);
273
+ o && f("model", o);
200
274
  }
201
275
  }
202
276
  )
203
277
  ] })
204
278
  ] })
205
279
  ] }),
206
- l && /* @__PURE__ */ a(
207
- ie,
280
+ d && /* @__PURE__ */ l(
281
+ Re,
282
+ {
283
+ title: d.title,
284
+ initial: d.initial,
285
+ availableTools: b,
286
+ configToolTemplates: O,
287
+ appLabel: Y(H),
288
+ charLimits: S,
289
+ onImprove: le,
290
+ onImproveToolInstructions: R,
291
+ onClose: () => y(null),
292
+ onSave: ce
293
+ },
294
+ d.key
295
+ ),
296
+ a?.kind === "restapi" && /* @__PURE__ */ l(
297
+ ke,
298
+ {
299
+ initial: a.initialRest,
300
+ charLimits: S,
301
+ onImprove: R,
302
+ onClose: () => u(null),
303
+ onSave: ie
304
+ },
305
+ a.key
306
+ ),
307
+ a?.kind === "config" && a.toolKey && U && /* @__PURE__ */ l(
308
+ we,
208
309
  {
209
- title: l.title,
210
- initial: l.initial,
211
- availableTools: r,
212
- appLabel: N(T),
213
- charLimits: f,
214
- onImprove: j,
215
- onClose: () => p(null),
216
- onSave: $
310
+ toolKey: a.toolKey,
311
+ template: U,
312
+ initial: a.initialConfig,
313
+ charLimits: S,
314
+ onImprove: R,
315
+ onClose: () => u(null),
316
+ onSave: ae
217
317
  },
218
- l.key
318
+ a.key
219
319
  )
220
320
  ] });
221
321
  };
222
322
  export {
223
- Le as Step3HowItResponds
323
+ so as Step3HowItResponds
224
324
  };
225
325
  //# 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 { AgentTool, SubAgentDraft, SubAgentRef } from '../AgentBuilder.model';\nimport {\n\tSectionBodyWrap,\n\tSideSection,\n\tStep3Divider,\n\tStep3Grid,\n\tStep3Root,\n} from '../AgentBuilder.styled';\nimport { CreateSubAgentPanel } from '../components/CreateSubAgentPanel';\nimport { MentionField } from '../components/MentionField';\nimport {\n\tSelectableItem,\n\tSelectableListSection,\n\tSourceGroup,\n} from '../components/SelectableListSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\n\ttoolSourceLabel,\n} from '../utils/mentionSerialization';\nimport { renderSourceIcon, SOURCE_ICONS } from '../utils/sourceIcons';\n\n/** Source brand glyph for a tool, as a dropdown leadingIcon element. */\nconst toolIconEl = (source: string): JSX.Element | undefined =>\n\trenderSourceIcon(SOURCE_ICONS[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 ?? '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\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\tapplicationType,\n\t\tcharLimits,\n\t\tinsertMention,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\tregisterSubAgentCreator,\n\t} = useAgentBuilderContext();\n\n\tconst [panel, setPanel] = useState<SubAgentPanelState | null>(null);\n\tconst panelKeyRef = useRef(0);\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: SOURCE_ICONS[tool.source ?? '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// 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 ?? '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 = buildAgentMentionItems(availableTools, [], appLabel);\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\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={toolItems}\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\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\tonRemove={(id) => removeReference('tool', id)}\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\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\tappLabel={appTypeLabel(applicationType)}\n\t\t\t\t\tcharLimits={charLimits}\n\t\t\t\t\tonImprove={onImproveSubAgent}\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\t\t</Step3Root>\n\t);\n};\n"],"names":["toolIconEl","source","renderSourceIcon","SOURCE_ICONS","toolOption","t","STEP","STEP_DEFINITIONS","Step3HowItResponds","value","patch","updateField","addReference","removeReference","availableTools","availableSubAgents","availableModels","applicationType","charLimits","insertMention","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","registerSubAgentCreator","useAgentBuilderContext","panel","setPanel","useState","panelKeyRef","useRef","createdSubAgents","setCreatedSubAgents","subAgentById","s","knownSubAgents","openCreate","useCallback","useEffect","openConfigure","id","data","handlePanelSave","draft","ref","prev","toolItems","tool","x","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","appLabel","appTypeLabel","toolMentionItems","buildAgentMentionItems","subAgentMentionItems","modelOptions","m","selectedModel","Step3Root","jsx","StepSectionHeader","jsxs","Step3Grid","SectionBodyWrap","MentionField","Step3Divider","SelectableListSection","SideSection","TitleSmall","COLORS","Dropdown","opt","v","unwrapDropdownValue","CreateSubAgentPanel"],"mappings":";;;;;;;;;;;;;;;AA+BA,MAAMA,KAAa,CAACC,MACnBC,GAAiBC,EAAaF,CAAM,CAAC,KAAK,QAGrCG,IAAa,CAACC,OAAgC;AAAA,EACnD,OAAOA,EAAE;AAAA,EACT,OAAOA,EAAE;AAAA,EACT,aAAaL,GAAWK,EAAE,UAAU,UAAU;AAC/C,IAEMC,IAAOC,GAAiB,CAAC,GAUlBC,KAA+B,MAAM;AACjD,QAAM;AAAA,IACL,OAAAC;AAAA,IACA,OAAAC;AAAA,IACA,aAAAC;AAAA,IACA,cAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,YAAAC;AAAA,IACA,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AAAA,4BACCD,GAAA,EAAW,OAAOC,EAAO,QAAQ,WAAW,UAAA,mBAE7C;AAAA,UACA,gBAAAV;AAAA,YAACW;AAAA,YAAA;AAAA,cACA,aAAU;AAAA,cACV,MAAK;AAAA,cACL,OAAM;AAAA,cACN,aAAY;AAAA,cACZ,SAASf;AAAA,cACT,gBACCE,IACG;AAAA,gBACA;AAAA,kBACC,OAAOA,EAAc;AAAA,kBACrB,OAAOA,EAAc;AAAA,gBAAA;AAAA,cACtB,IAEA;AAAA,cAEJ,UAAU,CAACc,MAAQ;AAClB,sBAAMC,IAAIC,GAAoBF,CAAG;AACjC,gBAAIC,KACHrE,EAAY,SAASqE,CAAC;AAAA,cAExB;AAAA,YAAA;AAAA,UAAA;AAAA,QACD,EAAA,CACD;AAAA,MAAA,EAAA,CAEF;AAAA,IAAA,GACD;AAAA,IAECtD,KACA,gBAAAyC;AAAA,MAACe;AAAA,MAAA;AAAA,QAEA,OAAOxD,EAAM;AAAA,QACb,SAASA,EAAM;AAAA,QACf,gBAAAZ;AAAA,QACA,UAAU6C,EAAa1C,CAAe;AAAA,QACtC,YAAAC;AAAA,QACA,WAAWK;AAAA,QACX,SAAS,MAAMI,EAAS,IAAI;AAAA,QAC5B,QAAQe;AAAA,MAAA;AAAA,MARHhB,EAAM;AAAA,IAAA;AAAA,EASZ,GAEF;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 {\n\tCONFIG_TOOL_SOURCES,\n\tTOOL_ACTION_SOURCES,\n\tTOOL_SOURCE_LABELS,\n\tToolAction,\n\tToolSource,\n} from '../constants/tools';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport {\n\tappTypeLabel,\n\tbuildAgentMentionItems,\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';\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: ToolAction[] = TOOL_ACTION_SOURCES.filter(\n\t\t(source) => {\n\t\t\tconst toolKey = CONFIG_TOOL_SOURCES[source];\n\t\t\treturn !toolKey || Boolean(configToolTemplates?.[toolKey]);\n\t\t},\n\t).map((source) => ({\n\t\tsource,\n\t\tlabel: TOOL_SOURCE_LABELS[source],\n\t\ticon: SOURCE_ICONS[source],\n\t\tonSelect: () => openToolAction(source),\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 = buildAgentMentionItems(availableTools, [], appLabel);\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/>\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\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","TOOL_ACTION_SOURCES","TOOL_SOURCE_LABELS","toolOptions","toolSourceGroups","order","bySource","src","toolSourceLabel","subAgentItems","sub","subAgentOptions","appLabel","appTypeLabel","toolMentionItems","buildAgentMentionItems","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":";;;;;;;;;;;;;;;;;;AAuDA,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,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;AAAA,IACA,iBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,oBAA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AAS,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,6 +1,7 @@
1
1
  import { ApplicationType } from '@bikdotai/bik-models/growth';
2
2
  import { MentionItem } from '../../../editor';
3
- import { AgentTool, SubAgentRef } from '../AgentBuilder.model';
3
+ import { AgentTool, ConfigToolConfig, RestApiToolConfig, SubAgentRef } from '../AgentBuilder.model';
4
+ import { TOOL_SOURCE_LABELS } from '../constants/tools';
4
5
  /**
5
6
  * Serialization helpers between the BikEditor document and the firebase
6
7
  * `instructions` string.
@@ -23,8 +24,7 @@ export interface MentionKindMeta {
23
24
  /** For tools: the source bucket (manifest / shopify / …) the picker groups by. */
24
25
  source?: string;
25
26
  }
26
- /** Display labels for the known tool sources (drives picker headers + chip prefix). */
27
- export declare const TOOL_SOURCE_LABELS: Record<string, string>;
27
+ export { TOOL_SOURCE_LABELS };
28
28
  /** Human label for a tool source; falls back to the host-app label, then the raw key. */
29
29
  export declare const toolSourceLabel: (source: string | undefined, fallback?: string) => string;
30
30
  /** Human label for the host application, used as the tool-chip prefix. */
@@ -38,6 +38,21 @@ export declare const appTypeLabel: (applicationType?: ApplicationType) => string
38
38
  * picker rows, and `meta.kind` drives the `{{tool}}` / `{{subagent}}` colour.
39
39
  */
40
40
  export declare const buildAgentMentionItems: (tools: AgentTool[], subAgents: SubAgentRef[], appLabel?: string) => MentionItem[];
41
+ /** Display name for a shared config tool: first recipient / channel, else generic. */
42
+ export declare const configToolName: (t: ConfigToolConfig) => string;
43
+ /** Display name for a Rest API tool row / chip. */
44
+ export declare const restApiToolName: (t: RestApiToolConfig) => string;
45
+ /** The `@`-mention chip item for a Rest API tool (kind 'tool', restapi source). */
46
+ export declare const restApiMentionItem: (t: RestApiToolConfig) => MentionItem;
47
+ /** The `@`-mention chip item for a shared config tool (email / Slack). */
48
+ export declare const configToolMentionItem: (t: ConfigToolConfig) => MentionItem;
49
+ /**
50
+ * Mention items for the inline-configured custom tools (Rest API + email / Slack)
51
+ * so their `{{tool:<id>}}` tokens rehydrate as chips — they live on the agent
52
+ * value, not in the catalog `availableTools`. Merge alongside
53
+ * {@link buildAgentMentionItems} in the editor's mention list.
54
+ */
55
+ export declare const buildCustomToolMentionItems: (configTools?: ConfigToolConfig[], restApiTools?: RestApiToolConfig[]) => MentionItem[];
41
56
  /**
42
57
  * Public: HTML for one mention chip, for inserting at the cursor (e.g. when a
43
58
  * tool / sub-agent is added from the Step-3 side panel). Round-trips through the