@bikdotai/bik-component-library 0.0.849-beta.5 → 0.0.849-beta.6

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 (28) hide show
  1. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +10 -10
  2. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +2 -2
  4. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/MentionPicker.js +49 -25
  6. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +9 -8
  8. package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  9. package/dist/cjs/components/agent-builder/components/VariableInlineField.js +56 -0
  10. package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +1 -0
  11. package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +5 -10
  12. package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +1 -1
  13. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +164 -149
  14. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  15. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +15 -13
  16. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
  17. package/dist/esm/components/agent-builder/components/MentionPicker.js +199 -165
  18. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  19. package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +3 -2
  20. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +160 -197
  21. package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
  22. package/dist/esm/components/agent-builder/components/VariableInlineField.d.ts +26 -0
  23. package/dist/esm/components/agent-builder/components/VariableInlineField.js +142 -0
  24. package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +1 -0
  25. package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +13 -0
  26. package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +75 -66
  27. package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +1 -1
  28. package/package.json +2 -1
@@ -1,89 +1,89 @@
1
- import { jsxs as d, jsx as t } from "react/jsx-runtime";
2
- import K from "../../../assets/icons/delete.svg.js";
3
- import Q from "../../../assets/icons/plus.svg.js";
4
- import { useState as l, useRef as $ } from "react";
5
- import b from "styled-components";
6
- import { TitleSmall as u } from "../../TypographyStyle.js";
7
- import { COLORS as i } from "../../../constants/Theme.js";
8
- import { FieldBlock as p } from "../AgentBuilder.styled.js";
9
- import { AGENT_CHAR_LIMITS as X } from "../constants/charLimits.js";
10
- import { DRAWER_BODY_STYLE as Z, DRAWER_HEADER_STYLE as ee, DrawerHeaderText as te } from "./DrawerHeaderText.js";
11
- import { ToolInstructionsField as re } from "./ToolInstructionsField.js";
12
- import { VariableTriggerArea as h } from "./VariableTriggerArea.js";
13
- import { SideModal as oe } from "../../side-modal/SideModal.js";
14
- import { Input as f } from "../../input/Input.js";
15
- import { Dropdown as ne } from "../../dropdown/Dropdown.js";
16
- import { unwrapDropdownValue as ae } from "../../dropdown/utils.js";
17
- import { Button as se } from "../../button/Button.js";
18
- import { BikEditor as q } from "../../../editor/BikEditor.js";
19
- const le = ["GET", "POST", "PUT", "PATCH", "DELETE"], ie = le.map((s) => ({
20
- label: s,
21
- value: s
22
- })), M = (s, y) => (y.textBefore.match(new RegExp('(?<!\\\\)"', "g"))?.length ?? 0) % 2 === 1 ? s : `"${s}"`, Ae = ({
23
- onClose: s,
24
- onSave: y,
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import U from "../../../assets/icons/delete.svg.js";
3
+ import W from "../../../assets/icons/plus.svg.js";
4
+ import { useState as a } from "react";
5
+ import T from "styled-components";
6
+ import { TitleSmall as p } from "../../TypographyStyle.js";
7
+ import { COLORS as s } from "../../../constants/Theme.js";
8
+ import { FieldBlock as d } from "../AgentBuilder.styled.js";
9
+ import { AGENT_CHAR_LIMITS as Y } from "../constants/charLimits.js";
10
+ import { DRAWER_BODY_STYLE as V, DRAWER_HEADER_STYLE as K, DrawerHeaderText as Q } from "./DrawerHeaderText.js";
11
+ import { ToolInstructionsField as X } from "./ToolInstructionsField.js";
12
+ import { VariableInlineField as k } from "./VariableInlineField.js";
13
+ import { SideModal as Z } from "../../side-modal/SideModal.js";
14
+ import { Input as A } from "../../input/Input.js";
15
+ import { Dropdown as ee } from "../../dropdown/Dropdown.js";
16
+ import { unwrapDropdownValue as te } from "../../dropdown/utils.js";
17
+ import { Button as re } from "../../button/Button.js";
18
+ import { BikEditor as P } from "../../../editor/BikEditor.js";
19
+ const oe = ["GET", "POST", "PUT", "PATCH", "DELETE"], ne = oe.map((i) => ({
20
+ label: i,
21
+ value: i
22
+ })), Ee = ({
23
+ onClose: i,
24
+ onSave: L,
25
25
  initial: n,
26
- onImprove: N,
27
- charLimits: I = X,
28
- zIndex: j,
29
- existingNames: z = [],
26
+ onImprove: O,
27
+ charLimits: S = Y,
28
+ zIndex: B,
29
+ existingNames: M = [],
30
30
  variablesData: c
31
31
  }) => {
32
- const [x, F] = l(n?.name ?? ""), E = $(null), H = $(null), [w, G] = l(n?.instructions ?? ""), [T, B] = l(n?.url ?? "https://"), [g, J] = l(
32
+ const [h, _] = a(n?.name ?? ""), [b, $] = a(n?.instructions ?? ""), [u, N] = a(n?.url ?? "https://"), [f, q] = a(
33
33
  n?.method ?? "POST"
34
- ), [k, v] = l(
34
+ ), [y, x] = a(
35
35
  n?.headers ?? [{ key: "", value: "" }]
36
- ), [A, U] = l(n?.requestBody ?? ""), [D, W] = l(
36
+ ), [C, j] = a(n?.requestBody ?? ""), [R, z] = a(
37
37
  n?.responseSample ?? ""
38
- ), [P, L] = l(!1), S = (e, r) => v(
39
- (o) => o.map((a, m) => m === e ? { ...a, ...r } : a)
40
- ), Y = () => v((e) => [...e, { key: "", value: "" }]), V = (e) => v((r) => r.filter((o, a) => a !== e)), C = x.trim(), R = C.length > 0 && z.some(
41
- (e) => e.trim().toLowerCase() === C.toLowerCase()
42
- ), O = C.length > 0 && T.trim().length > 0 && !R;
43
- return /* @__PURE__ */ d(
44
- oe,
38
+ ), [H, w] = a(!1), E = (e, r) => x(
39
+ (o) => o.map((m, J) => J === e ? { ...m, ...r } : m)
40
+ ), F = () => x((e) => [...e, { key: "", value: "" }]), G = (e) => x((r) => r.filter((o, m) => m !== e)), g = h.trim(), v = g.length > 0 && M.some(
41
+ (e) => e.trim().toLowerCase() === g.toLowerCase()
42
+ ), I = g.length > 0 && u.trim().length > 0 && !v;
43
+ return /* @__PURE__ */ l(
44
+ Z,
45
45
  {
46
46
  header: "Rest API",
47
47
  closeOnEscapeKey: !1,
48
- zIndex: j,
48
+ zIndex: B,
49
49
  headerCustomComponent: /* @__PURE__ */ t(
50
- te,
50
+ Q,
51
51
  {
52
52
  title: "Rest API",
53
53
  subtitle: "Connect to any API endpoint. Define the request and a sample response for the agent to reference."
54
54
  }
55
55
  ),
56
56
  width: "431px",
57
- headerStyle: ee,
58
- bodyStyle: Z,
59
- onClose: s,
57
+ headerStyle: K,
58
+ bodyStyle: V,
59
+ onClose: i,
60
60
  saveButtonProps: {
61
61
  "data-test": "restapi-save",
62
62
  buttonText: "Save",
63
63
  buttonType: "primary",
64
64
  size: "small",
65
- disabled: !O,
66
- isLoading: P,
65
+ disabled: !I,
66
+ isLoading: H,
67
67
  onClick: async () => {
68
- if (!O || P)
68
+ if (!I || H)
69
69
  return;
70
70
  const e = {
71
71
  id: n?.id ?? `restapi_${Date.now().toString(36)}`,
72
- name: x.trim(),
73
- instructions: w,
74
- url: T.trim(),
75
- method: g,
72
+ name: h.trim(),
73
+ instructions: b,
74
+ url: u.trim(),
75
+ method: f,
76
76
  // Drop fully-empty header rows.
77
- headers: k.filter((o) => o.key.trim() || o.value.trim()),
78
- requestBody: A,
79
- responseSample: D
80
- }, r = y(e);
77
+ headers: y.filter((o) => o.key.trim() || o.value.trim()),
78
+ requestBody: C,
79
+ responseSample: R
80
+ }, r = L(e);
81
81
  if (r && typeof r.then == "function") {
82
- L(!0);
82
+ w(!0);
83
83
  try {
84
84
  await r;
85
85
  } finally {
86
- L(!1);
86
+ w(!1);
87
87
  }
88
88
  }
89
89
  }
@@ -93,229 +93,192 @@ const le = ["GET", "POST", "PUT", "PATCH", "DELETE"], ie = le.map((s) => ({
93
93
  buttonText: "Cancel",
94
94
  buttonType: "tertiaryGray",
95
95
  size: "small",
96
- onClick: s
96
+ onClick: i
97
97
  },
98
98
  children: [
99
99
  /* @__PURE__ */ t(
100
- f,
100
+ A,
101
101
  {
102
102
  "data-test": "restapi-name",
103
103
  variant: "small",
104
104
  labelText: "Name",
105
105
  labelTextBold: !0,
106
106
  placeholder: "Enter action name",
107
- value: x,
108
- maxCharLimit: I.name,
109
- state: R ? "invalid" : void 0,
110
- errorMessage: R ? "A tool with this name already exists" : void 0,
111
- onChangeText: F
107
+ value: h,
108
+ maxCharLimit: S.name,
109
+ state: v ? "invalid" : void 0,
110
+ errorMessage: v ? "A tool with this name already exists" : void 0,
111
+ onChangeText: _
112
112
  }
113
113
  ),
114
114
  /* @__PURE__ */ t(
115
- re,
115
+ X,
116
116
  {
117
117
  "data-test": "restapi-instructions",
118
118
  label: "Instructions",
119
- value: w,
120
- onChange: G,
121
- maxLength: I.instructions,
119
+ value: b,
120
+ onChange: $,
121
+ maxLength: S.instructions,
122
122
  placeholder: "Describe how should the LLM generate the rest API",
123
- onImprove: N,
123
+ onImprove: O,
124
124
  variablesData: c
125
125
  }
126
126
  ),
127
- /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(
128
- h,
127
+ /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(
128
+ k,
129
129
  {
130
- addDataButton: !0,
131
- variablesData: c,
132
- onInsert: (e, r) => B((o) => {
133
- const a = r ?? o.length;
134
- return `${o.slice(0, a)}${e}${o.slice(a)}`;
135
- }),
136
- children: /* @__PURE__ */ t(
137
- f,
138
- {
139
- "data-test": "restapi-url",
140
- variant: "small",
141
- labelText: "Request URL",
142
- labelTextBold: !0,
143
- placeholder: "https://",
144
- type: "url",
145
- value: T,
146
- onChangeText: B
147
- }
148
- )
130
+ "data-test": "restapi-url",
131
+ label: "Request URL",
132
+ placeholder: "https://",
133
+ value: u,
134
+ onChange: N,
135
+ variablesData: c
149
136
  }
150
137
  ) }),
151
- /* @__PURE__ */ d(p, { children: [
152
- /* @__PURE__ */ t(u, { color: i.content.primary, children: "HTTP method" }),
138
+ /* @__PURE__ */ l(d, { children: [
139
+ /* @__PURE__ */ t(p, { color: s.content.primary, children: "HTTP method" }),
153
140
  /* @__PURE__ */ t(
154
- ne,
141
+ ee,
155
142
  {
156
143
  "data-test": "restapi-method",
157
144
  size: "small",
158
145
  width: "100%",
159
146
  dropdownWidth: "399px",
160
- options: ie,
161
- defaultOptions: [{ label: g, value: g }],
147
+ options: ne,
148
+ defaultOptions: [{ label: f, value: f }],
162
149
  onSelect: (e) => {
163
- const r = ae(e);
164
- r && J(r);
150
+ const r = te(e);
151
+ r && q(r);
165
152
  }
166
153
  }
167
154
  )
168
155
  ] }),
169
- /* @__PURE__ */ d(p, { children: [
170
- /* @__PURE__ */ t(u, { color: i.content.primary, children: "Headers" }),
171
- k.map((e, r) => (
156
+ /* @__PURE__ */ l(d, { children: [
157
+ /* @__PURE__ */ t(p, { color: s.content.primary, children: "Headers" }),
158
+ y.map((e, r) => (
159
+ // Key includes the row count: the value field is an uncontrolled
160
+ // editor, so add/remove must remount rows or a deleted row's text
161
+ // would linger in its reused neighbour.
172
162
  // eslint-disable-next-line react/no-array-index-key
173
- /* @__PURE__ */ d(de, { "data-test": `restapi-header-${r}`, children: [
174
- /* @__PURE__ */ t(
175
- f,
176
- {
177
- variant: "small",
178
- hideInputHeader: !0,
179
- placeholder: "Enter name",
180
- value: e.key,
181
- onChangeText: (o) => S(r, { key: o })
182
- }
183
- ),
184
- /* @__PURE__ */ t(
185
- h,
186
- {
187
- addDataButton: !0,
188
- variablesData: c,
189
- onInsert: (o, a) => {
190
- const m = a ?? e.value.length;
191
- S(r, {
192
- value: `${e.value.slice(0, m)}${o}${e.value.slice(m)}`
193
- });
194
- },
195
- children: /* @__PURE__ */ t(
196
- f,
163
+ /* @__PURE__ */ l(
164
+ ae,
165
+ {
166
+ "data-test": `restapi-header-${r}`,
167
+ children: [
168
+ /* @__PURE__ */ t(
169
+ A,
197
170
  {
198
171
  variant: "small",
199
172
  hideInputHeader: !0,
173
+ placeholder: "Enter name",
174
+ value: e.key,
175
+ onChangeText: (o) => E(r, { key: o })
176
+ }
177
+ ),
178
+ /* @__PURE__ */ t(
179
+ k,
180
+ {
200
181
  placeholder: "Enter value",
201
182
  value: e.value,
202
- onChangeText: (o) => S(r, { value: o })
183
+ onChange: (o) => E(r, { value: o }),
184
+ variablesData: c
203
185
  }
204
- )
205
- }
206
- ),
207
- /* @__PURE__ */ t(
208
- pe,
209
- {
210
- type: "button",
211
- "aria-label": "Remove header",
212
- "data-test": `restapi-header-remove-${r}`,
213
- onClick: () => V(r),
214
- children: /* @__PURE__ */ t(
215
- K,
186
+ ),
187
+ /* @__PURE__ */ t(
188
+ le,
216
189
  {
217
- width: 16,
218
- height: 16,
219
- color: i.content.secondary
190
+ type: "button",
191
+ "aria-label": "Remove header",
192
+ "data-test": `restapi-header-remove-${r}`,
193
+ onClick: () => G(r),
194
+ children: /* @__PURE__ */ t(
195
+ U,
196
+ {
197
+ width: 16,
198
+ height: 16,
199
+ color: s.content.secondary
200
+ }
201
+ )
220
202
  }
221
203
  )
222
- }
223
- )
224
- ] }, r)
204
+ ]
205
+ },
206
+ `${r}:${y.length}`
207
+ )
225
208
  )),
226
- /* @__PURE__ */ t(ce, { children: /* @__PURE__ */ t(
227
- se,
209
+ /* @__PURE__ */ t(se, { children: /* @__PURE__ */ t(
210
+ re,
228
211
  {
229
212
  "data-test": "restapi-add-header",
230
213
  buttonType: "dashRegular",
231
214
  size: "small",
232
- LeadingIcon: Q,
215
+ LeadingIcon: W,
233
216
  buttonText: "Add header",
234
- onClick: Y
217
+ onClick: F
235
218
  }
236
219
  ) })
237
220
  ] }),
238
- /* @__PURE__ */ d(p, { children: [
239
- /* @__PURE__ */ t(u, { color: i.content.primary, children: "Request " }),
221
+ /* @__PURE__ */ l(d, { children: [
222
+ /* @__PURE__ */ t(p, { color: s.content.primary, children: "Request " }),
240
223
  /* @__PURE__ */ t(
241
- h,
224
+ P,
242
225
  {
243
- addDataButton: !0,
244
- variablesData: c,
245
- transformToken: M,
246
- onInsert: (e) => E.current?.insertInlineContent(e),
247
- children: /* @__PURE__ */ t(
248
- q,
249
- {
250
- ref: E,
251
- features: { jsonMode: !0 },
252
- initialContent: A,
253
- style: _,
254
- placeholder: "Type or paste JSON here",
255
- onChange: (e) => U(e.text),
256
- minHeight: "120px",
257
- maxHeight: "240px"
258
- }
259
- )
226
+ features: { jsonMode: !0 },
227
+ initialContent: C,
228
+ style: D,
229
+ placeholder: "Type or paste JSON here",
230
+ onChange: (e) => j(e.text),
231
+ minHeight: "120px",
232
+ maxHeight: "240px"
260
233
  }
261
234
  )
262
235
  ] }),
263
- /* @__PURE__ */ d(p, { children: [
264
- /* @__PURE__ */ t(u, { color: i.content.primary, children: "Response " }),
236
+ /* @__PURE__ */ l(d, { children: [
237
+ /* @__PURE__ */ t(p, { color: s.content.primary, children: "Response " }),
265
238
  /* @__PURE__ */ t(
266
- h,
239
+ P,
267
240
  {
268
- addDataButton: !0,
269
- variablesData: c,
270
- transformToken: M,
271
- onInsert: (e) => H.current?.insertInlineContent(e),
272
- children: /* @__PURE__ */ t(
273
- q,
274
- {
275
- ref: H,
276
- features: { jsonMode: !0 },
277
- style: _,
278
- initialContent: D,
279
- placeholder: "Type or paste JSON here",
280
- onChange: (e) => W(e.text),
281
- minHeight: "120px",
282
- maxHeight: "240px"
283
- }
284
- )
241
+ features: { jsonMode: !0 },
242
+ style: D,
243
+ initialContent: R,
244
+ placeholder: "Type or paste JSON here",
245
+ onChange: (e) => z(e.text),
246
+ minHeight: "120px",
247
+ maxHeight: "240px"
285
248
  }
286
249
  )
287
250
  ] })
288
251
  ]
289
252
  }
290
253
  );
291
- }, de = b.div`
292
- display: flex;
254
+ }, ae = T.div`
255
+ display: grid;
256
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 32px;
293
257
  align-items: center;
294
258
  gap: 8px;
295
- `, ce = b.div`
259
+ `, se = T.div`
296
260
  display: flex;
297
- `, pe = b.button`
261
+ `, le = T.button`
298
262
  display: inline-flex;
299
263
  align-items: center;
300
264
  justify-content: center;
301
265
  flex-shrink: 0;
302
266
  width: 32px;
303
267
  height: 32px;
304
- border: 1px solid ${i.stroke.primary};
268
+ border: 1px solid ${s.stroke.primary};
305
269
  border-radius: 4px;
306
- background: ${i.surface.standard};
270
+ background: ${s.surface.standard};
307
271
  cursor: pointer;
308
272
 
309
273
  &:hover {
310
- border-color: ${i.content.secondary};
274
+ border-color: ${s.content.secondary};
311
275
  }
312
- `, _ = {
276
+ `, D = {
313
277
  borderRadius: "4px",
314
278
  overflow: "hidden"
315
279
  };
316
280
  export {
317
- _ as JsonFieldBox,
318
- Ae as RestApiToolPanel,
319
- M as jsonQuoteToken
281
+ D as JsonFieldBox,
282
+ Ee as RestApiToolPanel
320
283
  };
321
284
  //# sourceMappingURL=RestApiToolPanel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RestApiToolPanel.js","sources":["../../../../../src/components/agent-builder/components/RestApiToolPanel.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { BikEditor, BikEditorRef } from '@src/editor';\nimport React, { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tRestApiHeader,\n\tRestApiMethod,\n\tRestApiToolConfig,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\nimport { VariableTriggerArea } from './VariableTriggerArea';\n\ninterface RestApiToolPanelProps {\n\tonClose: () => void;\n\t/** Persist the config. A pending promise shows the Save loader. */\n\tonSave: (config: RestApiToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: RestApiToolConfig;\n\t/** Optional \"Improve with AI\" for the instructions field. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n\t/** Names of the OTHER tools — a new tool can't reuse one of these. */\n\texistingNames?: string[];\n\t/**\n\t * Variable catalog for the `@` trigger. When non-empty, `@` opens the\n\t * variable picker directly in Instructions / Request URL / header values /\n\t * Request / Response. Absent → the drawer behaves exactly as before.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n}\n\nconst METHODS: RestApiMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];\nconst METHOD_OPTIONS: SingleOption[] = METHODS.map((m) => ({\n\tlabel: m,\n\tvalue: m,\n}));\n\n/**\n * Keep the Request / Response bodies valid JSON: wrap the picked token in\n * quotes (`\"email\": \"{{variable:customer.email}}\"`) — unless the `@` was typed\n * inside a string literal already (odd number of unescaped `\"` before it, e.g.\n * `\"Bearer @`), where the bare token interpolates into the existing string.\n */\nexport const jsonQuoteToken = (\n\ttoken: string,\n\tctx: { textBefore: string },\n): string => {\n\tconst quotes = ctx.textBefore.match(/(?<!\\\\)\"/g)?.length ?? 0;\n\treturn quotes % 2 === 1 ? token : `\"${token}\"`;\n};\n\n/**\n * Right-side drawer to configure a \"Rest API\" tool: the endpoint the agent can\n * call, plus a JSON request-body template and a sample response. Mount it fresh\n * per open (key it) so `initial` seeds the state. Built on the shared `SideModal`\n * shell and the BikEditor JSON body mode for the Request / Response editors.\n */\nexport const RestApiToolPanel: React.FC<RestApiToolPanelProps> = ({\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tzIndex,\n\texistingNames = [],\n\tvariablesData,\n}) => {\n\tconst [name, setName] = useState(initial?.name ?? '');\n\t// `@`-picked variables insert into the JSON editors at their own cursor.\n\tconst requestEditorRef = useRef<BikEditorRef>(null);\n\tconst responseEditorRef = useRef<BikEditorRef>(null);\n\tconst [instructions, setInstructions] = useState(initial?.instructions ?? '');\n\t// New tools start with the scheme pre-filled so the user only types the host.\n\tconst [url, setUrl] = useState(initial?.url ?? 'https://');\n\tconst [method, setMethod] = useState<RestApiMethod>(\n\t\tinitial?.method ?? 'POST',\n\t);\n\tconst [headers, setHeaders] = useState<RestApiHeader[]>(\n\t\tinitial?.headers ?? [{ key: '', value: '' }],\n\t);\n\tconst [requestBody, setRequestBody] = useState(initial?.requestBody ?? '');\n\tconst [responseSample, setResponseSample] = useState(\n\t\tinitial?.responseSample ?? '',\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\tconst patchHeader = (i: number, patch: Partial<RestApiHeader>) =>\n\t\tsetHeaders((prev) =>\n\t\t\tprev.map((h, idx) => (idx === i ? { ...h, ...patch } : h)),\n\t\t);\n\tconst addHeader = () =>\n\t\tsetHeaders((prev) => [...prev, { key: '', value: '' }]);\n\tconst removeHeader = (i: number) =>\n\t\tsetHeaders((prev) => prev.filter((_, idx) => idx !== i));\n\n\tconst nameTrimmed = name.trim();\n\t// Case-insensitive: two tools can't share a name (the LLM references them by it).\n\tconst isDuplicateName =\n\t\tnameTrimmed.length > 0 &&\n\t\texistingNames.some(\n\t\t\t(n) => n.trim().toLowerCase() === nameTrimmed.toLowerCase(),\n\t\t);\n\tconst canSave =\n\t\tnameTrimmed.length > 0 && url.trim().length > 0 && !isDuplicateName;\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst config: RestApiToolConfig = {\n\t\t\tid: initial?.id ?? `restapi_${Date.now().toString(36)}`,\n\t\t\tname: name.trim(),\n\t\t\tinstructions,\n\t\t\turl: url.trim(),\n\t\t\tmethod,\n\t\t\t// Drop fully-empty header rows.\n\t\t\theaders: headers.filter((h) => h.key.trim() || h.value.trim()),\n\t\t\trequestBody,\n\t\t\tresponseSample,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\treturn (\n\t\t<SideModal\n\t\t\theader=\"Rest API\"\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText\n\t\t\t\t\ttitle=\"Rest API\"\n\t\t\t\t\tsubtitle=\"Connect to any API endpoint. Define the request and a sample response for the agent to reference.\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'restapi-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'restapi-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t<Input\n\t\t\t\tdata-test=\"restapi-name\"\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText=\"Name\"\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder=\"Enter action name\"\n\t\t\t\tvalue={name}\n\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\tstate={isDuplicateName ? 'invalid' : undefined}\n\t\t\t\terrorMessage={\n\t\t\t\t\tisDuplicateName ? 'A tool with this name already exists' : undefined\n\t\t\t\t}\n\t\t\t\tonChangeText={setName}\n\t\t\t/>\n\n\t\t\t<ToolInstructionsField\n\t\t\t\tdata-test=\"restapi-instructions\"\n\t\t\t\tlabel=\"Instructions\"\n\t\t\t\tvalue={instructions}\n\t\t\t\tonChange={setInstructions}\n\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\tplaceholder=\"Describe how should the LLM generate the rest API\"\n\t\t\t\tonImprove={onImprove}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t/>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<VariableTriggerArea\n\t\t\t\t\taddDataButton\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\tonInsert={(token, caret) =>\n\t\t\t\t\t\tsetUrl((u) => {\n\t\t\t\t\t\t\tconst at = caret ?? u.length;\n\t\t\t\t\t\t\treturn `${u.slice(0, at)}${token}${u.slice(at)}`;\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tdata-test=\"restapi-url\"\n\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\tlabelText=\"Request URL\"\n\t\t\t\t\t\tlabelTextBold\n\t\t\t\t\t\tplaceholder=\"https://\"\n\t\t\t\t\t\ttype=\"url\"\n\t\t\t\t\t\tvalue={url}\n\t\t\t\t\t\tonChangeText={setUrl}\n\t\t\t\t\t/>\n\t\t\t\t</VariableTriggerArea>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>HTTP method</TitleSmall>\n\t\t\t\t<Dropdown\n\t\t\t\t\tdata-test=\"restapi-method\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\tdropdownWidth=\"399px\"\n\t\t\t\t\toptions={METHOD_OPTIONS}\n\t\t\t\t\tdefaultOptions={[{ label: method, value: method }]}\n\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\tsetMethod(v as RestApiMethod);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Headers</TitleSmall>\n\t\t\t\t{headers.map((h, i) => (\n\t\t\t\t\t// eslint-disable-next-line react/no-array-index-key\n\t\t\t\t\t<HeaderRow key={i} data-test={`restapi-header-${i}`}>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\t\thideInputHeader\n\t\t\t\t\t\t\tplaceholder=\"Enter name\"\n\t\t\t\t\t\t\tvalue={h.key}\n\t\t\t\t\t\t\tonChangeText={(v) => patchHeader(i, { key: v })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VariableTriggerArea\n\t\t\t\t\t\t\taddDataButton\n\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t\tonInsert={(token, caret) => {\n\t\t\t\t\t\t\t\tconst at = caret ?? h.value.length;\n\t\t\t\t\t\t\t\tpatchHeader(i, {\n\t\t\t\t\t\t\t\t\tvalue: `${h.value.slice(0, at)}${token}${h.value.slice(at)}`,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\t\t\thideInputHeader\n\t\t\t\t\t\t\t\tplaceholder=\"Enter value\"\n\t\t\t\t\t\t\t\tvalue={h.value}\n\t\t\t\t\t\t\t\tonChangeText={(v) => patchHeader(i, { value: v })}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</VariableTriggerArea>\n\t\t\t\t\t\t<IconBtn\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\taria-label=\"Remove header\"\n\t\t\t\t\t\t\tdata-test={`restapi-header-remove-${i}`}\n\t\t\t\t\t\t\tonClick={() => removeHeader(i)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</IconBtn>\n\t\t\t\t\t</HeaderRow>\n\t\t\t\t))}\n\t\t\t\t<AddHeaderRow>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"restapi-add-header\"\n\t\t\t\t\t\tbuttonType=\"dashRegular\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\tbuttonText=\"Add header\"\n\t\t\t\t\t\tonClick={addHeader}\n\t\t\t\t\t/>\n\t\t\t\t</AddHeaderRow>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Request </TitleSmall>\n\t\t\t\t<VariableTriggerArea\n\t\t\t\t\taddDataButton\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\ttransformToken={jsonQuoteToken}\n\t\t\t\t\tonInsert={(token) =>\n\t\t\t\t\t\trequestEditorRef.current?.insertInlineContent(token)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<BikEditor\n\t\t\t\t\t\tref={requestEditorRef}\n\t\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\t\tinitialContent={requestBody}\n\t\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\t\tonChange={(c) => setRequestBody(c.text)}\n\t\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t\t/>\n\t\t\t\t</VariableTriggerArea>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Response </TitleSmall>\n\t\t\t\t<VariableTriggerArea\n\t\t\t\t\taddDataButton\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\ttransformToken={jsonQuoteToken}\n\t\t\t\t\tonInsert={(token) =>\n\t\t\t\t\t\tresponseEditorRef.current?.insertInlineContent(token)\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<BikEditor\n\t\t\t\t\t\tref={responseEditorRef}\n\t\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\t\tinitialContent={responseSample}\n\t\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\t\tonChange={(c) => setResponseSample(c.text)}\n\t\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t\t/>\n\t\t\t\t</VariableTriggerArea>\n\t\t\t</FieldBlock>\n\t\t</SideModal>\n\t);\n};\n\nconst HeaderRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n`;\n\nconst AddHeaderRow = styled.div`\n\tdisplay: flex;\n`;\n\nconst IconBtn = styled.button`\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-shrink: 0;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbackground: ${COLORS.surface.standard};\n\tcursor: pointer;\n\n\t&:hover {\n\t\tborder-color: ${COLORS.content.secondary};\n\t}\n`;\n\nexport const JsonFieldBox = {\n\tborderRadius: '4px',\n\toverflow: 'hidden',\n};\n"],"names":["METHODS","METHOD_OPTIONS","m","jsonQuoteToken","token","ctx","RestApiToolPanel","onClose","onSave","initial","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","existingNames","variablesData","name","setName","useState","requestEditorRef","useRef","responseEditorRef","instructions","setInstructions","url","setUrl","method","setMethod","headers","setHeaders","requestBody","setRequestBody","responseSample","setResponseSample","saving","setSaving","patchHeader","i","patch","prev","h","idx","addHeader","removeHeader","_","nameTrimmed","isDuplicateName","n","canSave","jsxs","SideModal","jsx","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","config","result","Input","ToolInstructionsField","FieldBlock","VariableTriggerArea","caret","u","at","TitleSmall","COLORS","Dropdown","opt","v","unwrapDropdownValue","HeaderRow","IconBtn","DeleteIcon","AddHeaderRow","Button","PlusIcon","BikEditor","JsonFieldBox","c","styled"],"mappings":";;;;;;;;;;;;;;;;;;AAkDA,MAAMA,KAA2B,CAAC,OAAO,QAAQ,OAAO,SAAS,QAAQ,GACnEC,KAAiCD,GAAQ,IAAI,CAACE,OAAO;AAAA,EAC1D,OAAOA;AAAA,EACP,OAAOA;AACR,EAAE,GAQWC,IAAiB,CAC7BC,GACAC,OAEeA,EAAI,WAAW,MAAM,WAAA,cAAA,GAAW,IAAG,UAAU,KAC5C,MAAM,IAAID,IAAQ,IAAIA,CAAK,KAS/BE,KAAoD,CAAC;AAAA,EACjE,SAAAC;AAAA,EACA,QA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,CAACC,MAAM/C,EAAe+C,EAAE,IAAI;AAAA,kBACtC,WAAU;AAAA,kBACV,WAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACX;AAAA,UAAA;AAAA,QACD,GACD;AAAA,0BAECnB,GAAA,EACA,UAAA;AAAA,UAAA,gBAAAR,EAACa,GAAA,EAAW,OAAOC,EAAO,QAAQ,SAAS,UAAA,aAAS;AAAA,UACpD,gBAAAd;AAAA,YAACS;AAAA,YAAA;AAAA,cACA,eAAa;AAAA,cACb,eAAA7C;AAAA,cACA,gBAAgBZ;AAAA,cAChB,UAAU,CAACC,MACViB,EAAkB,SAAS,oBAAoBjB,CAAK;AAAA,cAGrD,UAAA,gBAAA+C;AAAA,gBAACyB;AAAA,gBAAA;AAAA,kBACA,KAAKvD;AAAA,kBACL,UAAU,EAAE,UAAU,GAAA;AAAA,kBACtB,OAAOwD;AAAA,kBACP,gBAAgB7C;AAAA,kBAChB,aAAY;AAAA,kBACZ,UAAU,CAAC8C,MAAM7C,EAAkB6C,EAAE,IAAI;AAAA,kBACzC,WAAU;AAAA,kBACV,WAAU;AAAA,gBAAA;AAAA,cAAA;AAAA,YACX;AAAA,UAAA;AAAA,QACD,EAAA,CACD;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGH,GAEMR,KAAYS,EAAO;AAAA;AAAA;AAAA;AAAA,GAMnBN,KAAeM,EAAO;AAAA;AAAA,GAItBR,KAAUQ,EAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAOFd,EAAO,OAAO,OAAO;AAAA;AAAA,eAE3BA,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,kBAIpBA,EAAO,QAAQ,SAAS;AAAA;AAAA,GAI7BY,IAAe;AAAA,EAC3B,cAAc;AAAA,EACd,UAAU;AACX;"}
1
+ {"version":3,"file":"RestApiToolPanel.js","sources":["../../../../../src/components/agent-builder/components/RestApiToolPanel.tsx"],"sourcesContent":["import DeleteIcon from '@src/assets/icons/delete.svg';\nimport PlusIcon from '@src/assets/icons/plus.svg';\nimport { BikEditor } from '@src/editor';\nimport React, { useState } from 'react';\nimport styled from 'styled-components';\nimport { Button } from '@src/components/button';\nimport { Dropdown, unwrapDropdownValue } from '@src/components/dropdown';\nimport { SingleOption } from '@src/components/dropdown/type';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tRestApiHeader,\n\tRestApiMethod,\n\tRestApiToolConfig,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\nimport { VariableInlineField } from './VariableInlineField';\n\ninterface RestApiToolPanelProps {\n\tonClose: () => void;\n\t/** Persist the config. A pending promise shows the Save loader. */\n\tonSave: (config: RestApiToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: RestApiToolConfig;\n\t/** Optional \"Improve with AI\" for the instructions field. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n\t/** Names of the OTHER tools — a new tool can't reuse one of these. */\n\texistingNames?: string[];\n\t/**\n\t * Variable catalog for the `@` trigger. When non-empty, `@` opens the\n\t * variable picker directly in Instructions / Request URL / header values.\n\t * (Request / Response JSON editors are deliberately not wired for now.)\n\t * Absent → the drawer behaves exactly as before.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n}\n\nconst METHODS: RestApiMethod[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];\nconst METHOD_OPTIONS: SingleOption[] = METHODS.map((m) => ({\n\tlabel: m,\n\tvalue: m,\n}));\n\n/**\n * Keep the Request / Response bodies valid JSON: wrap the picked token in\n * quotes (`\"email\": \"{{variable:customer.email}}\"`) — unless the `@` was typed\n * inside a string literal already (odd number of unescaped `\"` before it, e.g.\n * `\"Bearer @`), where the bare token interpolates into the existing string.\n */\nexport const jsonQuoteToken = (\n\ttoken: string,\n\tctx: { textBefore: string },\n): string => {\n\tconst quotes = ctx.textBefore.match(/(?<!\\\\)\"/g)?.length ?? 0;\n\treturn quotes % 2 === 1 ? token : `\"${token}\"`;\n};\n\n/**\n * Right-side drawer to configure a \"Rest API\" tool: the endpoint the agent can\n * call, plus a JSON request-body template and a sample response. Mount it fresh\n * per open (key it) so `initial` seeds the state. Built on the shared `SideModal`\n * shell and the BikEditor JSON body mode for the Request / Response editors.\n */\nexport const RestApiToolPanel: React.FC<RestApiToolPanelProps> = ({\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tzIndex,\n\texistingNames = [],\n\tvariablesData,\n}) => {\n\tconst [name, setName] = useState(initial?.name ?? '');\n\tconst [instructions, setInstructions] = useState(initial?.instructions ?? '');\n\t// New tools start with the scheme pre-filled so the user only types the host.\n\tconst [url, setUrl] = useState(initial?.url ?? 'https://');\n\tconst [method, setMethod] = useState<RestApiMethod>(\n\t\tinitial?.method ?? 'POST',\n\t);\n\tconst [headers, setHeaders] = useState<RestApiHeader[]>(\n\t\tinitial?.headers ?? [{ key: '', value: '' }],\n\t);\n\tconst [requestBody, setRequestBody] = useState(initial?.requestBody ?? '');\n\tconst [responseSample, setResponseSample] = useState(\n\t\tinitial?.responseSample ?? '',\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\tconst patchHeader = (i: number, patch: Partial<RestApiHeader>) =>\n\t\tsetHeaders((prev) =>\n\t\t\tprev.map((h, idx) => (idx === i ? { ...h, ...patch } : h)),\n\t\t);\n\tconst addHeader = () =>\n\t\tsetHeaders((prev) => [...prev, { key: '', value: '' }]);\n\tconst removeHeader = (i: number) =>\n\t\tsetHeaders((prev) => prev.filter((_, idx) => idx !== i));\n\n\tconst nameTrimmed = name.trim();\n\t// Case-insensitive: two tools can't share a name (the LLM references them by it).\n\tconst isDuplicateName =\n\t\tnameTrimmed.length > 0 &&\n\t\texistingNames.some(\n\t\t\t(n) => n.trim().toLowerCase() === nameTrimmed.toLowerCase(),\n\t\t);\n\tconst canSave =\n\t\tnameTrimmed.length > 0 && url.trim().length > 0 && !isDuplicateName;\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst config: RestApiToolConfig = {\n\t\t\tid: initial?.id ?? `restapi_${Date.now().toString(36)}`,\n\t\t\tname: name.trim(),\n\t\t\tinstructions,\n\t\t\turl: url.trim(),\n\t\t\tmethod,\n\t\t\t// Drop fully-empty header rows.\n\t\t\theaders: headers.filter((h) => h.key.trim() || h.value.trim()),\n\t\t\trequestBody,\n\t\t\tresponseSample,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\treturn (\n\t\t<SideModal\n\t\t\theader=\"Rest API\"\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText\n\t\t\t\t\ttitle=\"Rest API\"\n\t\t\t\t\tsubtitle=\"Connect to any API endpoint. Define the request and a sample response for the agent to reference.\"\n\t\t\t\t/>\n\t\t\t}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'restapi-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'restapi-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t<Input\n\t\t\t\tdata-test=\"restapi-name\"\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText=\"Name\"\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder=\"Enter action name\"\n\t\t\t\tvalue={name}\n\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\tstate={isDuplicateName ? 'invalid' : undefined}\n\t\t\t\terrorMessage={\n\t\t\t\t\tisDuplicateName ? 'A tool with this name already exists' : undefined\n\t\t\t\t}\n\t\t\t\tonChangeText={setName}\n\t\t\t/>\n\n\t\t\t<ToolInstructionsField\n\t\t\t\tdata-test=\"restapi-instructions\"\n\t\t\t\tlabel=\"Instructions\"\n\t\t\t\tvalue={instructions}\n\t\t\t\tonChange={setInstructions}\n\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\tplaceholder=\"Describe how should the LLM generate the rest API\"\n\t\t\t\tonImprove={onImprove}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t/>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<VariableInlineField\n\t\t\t\t\tdata-test=\"restapi-url\"\n\t\t\t\t\tlabel=\"Request URL\"\n\t\t\t\t\tplaceholder=\"https://\"\n\t\t\t\t\tvalue={url}\n\t\t\t\t\tonChange={setUrl}\n\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>HTTP method</TitleSmall>\n\t\t\t\t<Dropdown\n\t\t\t\t\tdata-test=\"restapi-method\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\twidth=\"100%\"\n\t\t\t\t\tdropdownWidth=\"399px\"\n\t\t\t\t\toptions={METHOD_OPTIONS}\n\t\t\t\t\tdefaultOptions={[{ label: method, value: method }]}\n\t\t\t\t\tonSelect={(opt) => {\n\t\t\t\t\t\tconst v = unwrapDropdownValue(opt);\n\t\t\t\t\t\tif (v) {\n\t\t\t\t\t\t\tsetMethod(v as RestApiMethod);\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Headers</TitleSmall>\n\t\t\t\t{headers.map((h, i) => (\n\t\t\t\t\t// Key includes the row count: the value field is an uncontrolled\n\t\t\t\t\t// editor, so add/remove must remount rows or a deleted row's text\n\t\t\t\t\t// would linger in its reused neighbour.\n\t\t\t\t\t// eslint-disable-next-line react/no-array-index-key\n\t\t\t\t\t<HeaderRow\n\t\t\t\t\t\tkey={`${i}:${headers.length}`}\n\t\t\t\t\t\tdata-test={`restapi-header-${i}`}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\tvariant=\"small\"\n\t\t\t\t\t\t\thideInputHeader\n\t\t\t\t\t\t\tplaceholder=\"Enter name\"\n\t\t\t\t\t\t\tvalue={h.key}\n\t\t\t\t\t\t\tonChangeText={(v) => patchHeader(i, { key: v })}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<VariableInlineField\n\t\t\t\t\t\t\tplaceholder=\"Enter value\"\n\t\t\t\t\t\t\tvalue={h.value}\n\t\t\t\t\t\t\tonChange={(v) => patchHeader(i, { value: v })}\n\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<IconBtn\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\taria-label=\"Remove header\"\n\t\t\t\t\t\t\tdata-test={`restapi-header-remove-${i}`}\n\t\t\t\t\t\t\tonClick={() => removeHeader(i)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<DeleteIcon\n\t\t\t\t\t\t\t\twidth={16}\n\t\t\t\t\t\t\t\theight={16}\n\t\t\t\t\t\t\t\tcolor={COLORS.content.secondary}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</IconBtn>\n\t\t\t\t\t</HeaderRow>\n\t\t\t\t))}\n\t\t\t\t<AddHeaderRow>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tdata-test=\"restapi-add-header\"\n\t\t\t\t\t\tbuttonType=\"dashRegular\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\tLeadingIcon={PlusIcon}\n\t\t\t\t\t\tbuttonText=\"Add header\"\n\t\t\t\t\t\tonClick={addHeader}\n\t\t\t\t\t/>\n\t\t\t\t</AddHeaderRow>\n\t\t\t</FieldBlock>\n\n\t\t\t{/* Variables intentionally NOT wired here (yet) — the JSON editors are\n\t\t\t plain code fields; @ types a literal @. */}\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Request </TitleSmall>\n\t\t\t\t<BikEditor\n\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\tinitialContent={requestBody}\n\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\tonChange={(c) => setRequestBody(c.text)}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\n\t\t\t<FieldBlock>\n\t\t\t\t<TitleSmall color={COLORS.content.primary}>Response </TitleSmall>\n\t\t\t\t<BikEditor\n\t\t\t\t\tfeatures={{ jsonMode: true }}\n\t\t\t\t\tstyle={JsonFieldBox}\n\t\t\t\t\tinitialContent={responseSample}\n\t\t\t\t\tplaceholder=\"Type or paste JSON here\"\n\t\t\t\t\tonChange={(c) => setResponseSample(c.text)}\n\t\t\t\t\tminHeight=\"120px\"\n\t\t\t\t\tmaxHeight=\"240px\"\n\t\t\t\t/>\n\t\t\t</FieldBlock>\n\t\t</SideModal>\n\t);\n};\n\n// Fixed tracks (name / value / delete): minmax(0, …) lets the fields shrink\n// below their content width, so a long value scrolls inside its field and the\n// delete button can never be pushed off the row.\nconst HeaderRow = styled.div`\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) 32px;\n\talign-items: center;\n\tgap: 8px;\n`;\n\nconst AddHeaderRow = styled.div`\n\tdisplay: flex;\n`;\n\nconst IconBtn = styled.button`\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex-shrink: 0;\n\twidth: 32px;\n\theight: 32px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tbackground: ${COLORS.surface.standard};\n\tcursor: pointer;\n\n\t&:hover {\n\t\tborder-color: ${COLORS.content.secondary};\n\t}\n`;\n\nexport const JsonFieldBox = {\n\tborderRadius: '4px',\n\toverflow: 'hidden',\n};\n"],"names":["METHODS","METHOD_OPTIONS","m","RestApiToolPanel","onClose","onSave","initial","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","existingNames","variablesData","name","setName","useState","instructions","setInstructions","url","setUrl","method","setMethod","headers","setHeaders","requestBody","setRequestBody","responseSample","setResponseSample","saving","setSaving","patchHeader","i","patch","prev","h","idx","addHeader","removeHeader","_","nameTrimmed","isDuplicateName","n","canSave","jsxs","SideModal","jsx","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","config","result","Input","ToolInstructionsField","FieldBlock","VariableInlineField","TitleSmall","COLORS","Dropdown","opt","v","unwrapDropdownValue","HeaderRow","IconBtn","DeleteIcon","AddHeaderRow","Button","PlusIcon","BikEditor","JsonFieldBox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AAA;AAAA,qBAOFd,EAAO,OAAO,OAAO;AAAA;AAAA,eAE3BA,EAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,kBAIpBA,EAAO,QAAQ,SAAS;AAAA;AAAA,GAI7BY,IAAe;AAAA,EAC3B,cAAc;AAAA,EACd,UAAU;AACX;"}
@@ -0,0 +1,26 @@
1
+ import { default as React } from 'react';
2
+ import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
3
+ interface VariableInlineFieldProps {
4
+ /** Stored string, `{{variable:<name>}}` tokens inline (e.g. a URL). */
5
+ value: string;
6
+ onChange: (text: string) => void;
7
+ label?: string;
8
+ placeholder?: string;
9
+ /** Variable catalog. Absent / empty → behaves as a plain single-line input. */
10
+ variablesData?: VariableListInterfaceV3[];
11
+ 'data-test'?: string;
12
+ }
13
+ /**
14
+ * Single-line text field whose `{{variable:<name>}}` tokens render as the
15
+ * SAME purple `{{<name>}}` chips as the Instructions / Guardrails editors —
16
+ * BikEditor under the hood, styled like the small `Input`. Used for tool
17
+ * params that mix free text with variables (Request URL, header values).
18
+ *
19
+ * `@` opens the variable panel: after whitespace / at the start via the
20
+ * editor's native mention trigger, after URL/JSON delimiters (`https://@`)
21
+ * via the {@link VariableTriggerArea} wrapper — both render the same
22
+ * {@link MentionPicker}. Enter is swallowed (single-line), and any pasted
23
+ * newlines are dropped on serialize.
24
+ */
25
+ export declare const VariableInlineField: React.FC<VariableInlineFieldProps>;
26
+ export {};