@bikdotai/bik-component-library 0.0.821-beta.0 → 0.0.821-beta.10

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 (90) 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 +152 -60
  4. package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  5. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +2 -0
  6. package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -0
  7. package/dist/cjs/components/agent-builder/components/MentionEditor.js +2 -0
  8. package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -0
  9. package/dist/cjs/components/agent-builder/components/MentionField.js +2 -0
  10. package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -0
  11. package/dist/cjs/components/agent-builder/components/MentionPicker.js +12 -12
  12. package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
  13. package/dist/cjs/components/agent-builder/components/SelectableListSection.js +1 -1
  14. package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
  15. package/dist/cjs/components/agent-builder/components/UndoToast.js +2 -0
  16. package/dist/cjs/components/agent-builder/components/UndoToast.js.map +1 -0
  17. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
  18. package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  19. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
  20. package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  21. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +3 -3
  22. package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  23. package/dist/cjs/components/agent-listing/AgentListing.js +1 -1
  24. package/dist/cjs/components/agent-listing/AgentListing.js.map +1 -1
  25. package/dist/cjs/components/agent-listing/AgentListingFilters.js +1 -1
  26. package/dist/cjs/components/agent-listing/AgentListingFilters.js.map +1 -1
  27. package/dist/cjs/components/agent-listing/AgentTable.js +1 -1
  28. package/dist/cjs/components/agent-listing/AgentTable.js.map +1 -1
  29. package/dist/cjs/components/agent-listing/AgentTableRow.js +1 -1
  30. package/dist/cjs/components/agent-listing/AgentTableRow.js.map +1 -1
  31. package/dist/cjs/components/agent-listing/DeleteAgentModal.js +2 -0
  32. package/dist/cjs/components/agent-listing/DeleteAgentModal.js.map +1 -0
  33. package/dist/esm/components/agent-builder/AgentBuilder.js +141 -128
  34. package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
  35. package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +34 -0
  36. package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +34 -0
  37. package/dist/esm/components/agent-builder/AgentBuilder.styled.js +206 -82
  38. package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
  39. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +25 -0
  40. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +207 -0
  41. package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -0
  42. package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +33 -0
  43. package/dist/esm/components/agent-builder/components/MentionEditor.js +99 -0
  44. package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -0
  45. package/dist/esm/components/agent-builder/components/MentionField.d.ts +19 -0
  46. package/dist/esm/components/agent-builder/components/MentionField.js +61 -0
  47. package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -0
  48. package/dist/esm/components/agent-builder/components/MentionPicker.js +84 -71
  49. package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
  50. package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +18 -1
  51. package/dist/esm/components/agent-builder/components/SelectableListSection.js +102 -57
  52. package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
  53. package/dist/esm/components/agent-builder/components/UndoToast.d.ts +7 -0
  54. package/dist/esm/components/agent-builder/components/UndoToast.js +27 -0
  55. package/dist/esm/components/agent-builder/components/UndoToast.js.map +1 -0
  56. package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +43 -5
  57. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +135 -87
  58. package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
  59. package/dist/esm/components/agent-builder/index.d.ts +1 -1
  60. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +149 -68
  61. package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
  62. package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +6 -0
  63. package/dist/esm/components/agent-builder/utils/mentionSerialization.js +53 -52
  64. package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
  65. package/dist/esm/components/agent-listing/AgentListing.js +126 -91
  66. package/dist/esm/components/agent-listing/AgentListing.js.map +1 -1
  67. package/dist/esm/components/agent-listing/AgentListing.model.d.ts +9 -0
  68. package/dist/esm/components/agent-listing/AgentListingFilters.d.ts +2 -0
  69. package/dist/esm/components/agent-listing/AgentListingFilters.js +37 -33
  70. package/dist/esm/components/agent-listing/AgentListingFilters.js.map +1 -1
  71. package/dist/esm/components/agent-listing/AgentTable.d.ts +1 -0
  72. package/dist/esm/components/agent-listing/AgentTable.js +13 -11
  73. package/dist/esm/components/agent-listing/AgentTable.js.map +1 -1
  74. package/dist/esm/components/agent-listing/AgentTableRow.d.ts +2 -0
  75. package/dist/esm/components/agent-listing/AgentTableRow.js +70 -50
  76. package/dist/esm/components/agent-listing/AgentTableRow.js.map +1 -1
  77. package/dist/esm/components/agent-listing/DeleteAgentModal.d.ts +16 -0
  78. package/dist/esm/components/agent-listing/DeleteAgentModal.js +69 -0
  79. package/dist/esm/components/agent-listing/DeleteAgentModal.js.map +1 -0
  80. package/package.json +1 -1
  81. package/dist/cjs/components/agent-builder/components/InstructionsField.js +0 -2
  82. package/dist/cjs/components/agent-builder/components/InstructionsField.js.map +0 -1
  83. package/dist/cjs/components/agent-builder/components/RichTextField.js +0 -2
  84. package/dist/cjs/components/agent-builder/components/RichTextField.js.map +0 -1
  85. package/dist/esm/components/agent-builder/components/InstructionsField.d.ts +0 -2
  86. package/dist/esm/components/agent-builder/components/InstructionsField.js +0 -81
  87. package/dist/esm/components/agent-builder/components/InstructionsField.js.map +0 -1
  88. package/dist/esm/components/agent-builder/components/RichTextField.d.ts +0 -21
  89. package/dist/esm/components/agent-builder/components/RichTextField.js +0 -66
  90. package/dist/esm/components/agent-builder/components/RichTextField.js.map +0 -1
@@ -1,138 +1,150 @@
1
- import { jsx as n, jsxs as y } from "react/jsx-runtime";
2
- import { useState as l, useCallback as t } from "react";
3
- import { COLORS as Y } from "../../constants/Theme.js";
4
- import { BuilderRoot as Z, Main as _, Rail as ee, Content as ne, ContentCard as oe } from "./AgentBuilder.styled.js";
5
- import { AgentBuilderFooter as te } from "./components/AgentBuilderFooter.js";
6
- import { AgentBuilderTopBar as ae } from "./components/AgentBuilderTopBar.js";
7
- import { DiscardModal as ie } from "./components/DiscardModal.js";
8
- import { GoLiveModal as se } from "./components/GoLiveModal.js";
9
- import { StepRail as re } from "./components/StepRail.js";
10
- import { AgentBuilderProvider as le, useAgentBuilderContext as de } from "./context/AgentBuilderContext.js";
11
- import { Step1About as ce } from "./steps/Step1About.js";
12
- import { Step2WhenItStepsIn as ue } from "./steps/Step2WhenItStepsIn.js";
13
- import { Step3HowItResponds as fe } from "./steps/Step3HowItResponds.js";
14
- import { Step4HandoverRules as he } from "./steps/Step4HandoverRules.js";
15
- import { Spinner as ge } from "../spinner/Spinner.js";
16
- const me = () => {
17
- const { activeStep: d } = de();
18
- switch (d) {
1
+ import { jsx as o, jsxs as B } from "react/jsx-runtime";
2
+ import { useState as d, useCallback as t } from "react";
3
+ import { COLORS as oe } from "../../constants/Theme.js";
4
+ import { BuilderRoot as te, Main as ae, Rail as re, Content as ie, ContentCard as se } from "./AgentBuilder.styled.js";
5
+ import { AgentBuilderFooter as le } from "./components/AgentBuilderFooter.js";
6
+ import { AgentBuilderTopBar as de } from "./components/AgentBuilderTopBar.js";
7
+ import { DiscardModal as ce } from "./components/DiscardModal.js";
8
+ import { GoLiveModal as ue } from "./components/GoLiveModal.js";
9
+ import { StepRail as ge } from "./components/StepRail.js";
10
+ import { UndoToast as fe } from "./components/UndoToast.js";
11
+ import { AgentBuilderProvider as he, useAgentBuilderContext as me } from "./context/AgentBuilderContext.js";
12
+ import { Step1About as ve } from "./steps/Step1About.js";
13
+ import { Step2WhenItStepsIn as pe } from "./steps/Step2WhenItStepsIn.js";
14
+ import { Step3HowItResponds as Se } from "./steps/Step3HowItResponds.js";
15
+ import { Step4HandoverRules as be } from "./steps/Step4HandoverRules.js";
16
+ import { Spinner as Ce } from "../spinner/Spinner.js";
17
+ const Ae = () => {
18
+ const { activeStep: c } = me();
19
+ switch (c) {
19
20
  case "about":
20
- return /* @__PURE__ */ n(ce, {});
21
+ return /* @__PURE__ */ o(ve, {});
21
22
  case "trigger":
22
- return /* @__PURE__ */ n(ue, {});
23
+ return /* @__PURE__ */ o(pe, {});
23
24
  case "response":
24
- return /* @__PURE__ */ n(fe, {});
25
+ return /* @__PURE__ */ o(Se, {});
25
26
  case "handover":
26
- return /* @__PURE__ */ n(he, {});
27
+ return /* @__PURE__ */ o(be, {});
27
28
  default:
28
29
  return null;
29
30
  }
30
- }, ve = (d) => {
31
+ }, De = (c) => {
31
32
  const {
32
- config: B,
33
- onChange: m,
34
- onStepChange: c,
35
- onDiscard: i,
36
- onSaveDraft: s,
37
- onPublish: v,
38
- onBack: u,
33
+ config: T,
34
+ onChange: v,
35
+ onStepChange: u,
36
+ onDiscard: r,
37
+ onSaveDraft: i,
38
+ onPublish: p,
39
+ onBack: g,
39
40
  onTestAgent: f,
40
41
  onGoToDashboard: h,
41
- ...T
42
- } = d, {
43
- value: g,
44
- activeStep: G,
45
- availableTools: P,
46
- availableSubAgents: M,
47
- availableIntents: k = [],
48
- availableModels: w = [],
49
- validation: R,
50
- applicationType: x,
51
- isSaving: p,
52
- isPublishing: S,
53
- isLoading: I,
54
- footerHint: j = "Changes don’t affect customers until you go live",
55
- disableStepNavigation: H,
56
- debugLog: b
57
- } = B, [N, a] = l(null), [C, A] = l(!1), [O, r] = l(!1), [z, D] = l(!1), e = t(
58
- (o, ...X) => {
59
- b && console.log(`[AgentBuilder] ${o}`, ...X);
42
+ onCreateSubAgent: s,
43
+ onFetchSubAgent: G,
44
+ onUpdateSubAgent: P,
45
+ onImproveSubAgent: w,
46
+ ...M
47
+ } = c, {
48
+ value: m,
49
+ activeStep: k,
50
+ availableTools: I,
51
+ availableSubAgents: R,
52
+ availableIntents: x = [],
53
+ availableModels: j = [],
54
+ validation: H,
55
+ applicationType: F,
56
+ isSaving: S,
57
+ isPublishing: b,
58
+ isLoading: N,
59
+ footerHint: O = "Changes don’t affect customers until you go live",
60
+ disableStepNavigation: U,
61
+ debugLog: C
62
+ } = T, [z, a] = d(null), [A, D] = d(!1), [E, l] = d(!1), [W, L] = d(!1), e = t(
63
+ (n, ...ne) => {
64
+ C && console.log(`[AgentBuilder] ${n}`, ...ne);
60
65
  },
61
- [b]
62
- ), F = t(
63
- (o) => {
64
- e("onChange", o), m(o);
66
+ [C]
67
+ ), $ = t(
68
+ (n) => {
69
+ e("onChange", n), v(n);
65
70
  },
66
- [e, m]
67
- ), W = t(
68
- (o) => {
69
- e("onStepChange", o), c?.(o);
71
+ [e, v]
72
+ ), q = t(
73
+ (n) => {
74
+ e("onStepChange", n), u?.(n);
70
75
  },
71
- [e, c]
72
- ), $ = t(() => {
73
- e("onDiscard"), i();
74
- }, [e, i]), L = t(() => (e("onSaveDraft"), s()), [e, s]), q = t(() => (e("onPublish"), v()), [e, v]), E = t(() => {
75
- e("onBack"), r(!0);
76
- }, [e]), J = t(() => {
77
- e("onDiscardAndLeave"), r(!1), i();
78
- }, [e, i]), K = t(async () => {
76
+ [e, u]
77
+ ), J = t(() => {
78
+ e("onDiscard"), r();
79
+ }, [e, r]), y = t(() => (e("onSaveDraft"), i()), [e, i]), K = t(() => (e("onPublish"), p()), [e, p]), Q = t(() => {
80
+ e("onBack"), l(!0);
81
+ }, [e]), V = t(() => {
82
+ e("onDiscardAndLeave"), l(!1), r();
83
+ }, [e, r]), X = t(async () => {
79
84
  e("onSaveDraftAndLeave");
80
- const o = s();
81
- if (o && typeof o.then == "function") {
82
- D(!0);
85
+ const n = i();
86
+ if (n && typeof n.then == "function") {
87
+ L(!0);
83
88
  try {
84
- await o;
89
+ await n;
85
90
  } finally {
86
- D(!1);
91
+ L(!1);
87
92
  }
88
93
  }
89
- r(!1), u?.();
90
- }, [e, s, u]), Q = t(() => {
94
+ l(!1), g?.();
95
+ }, [e, i, g]), Y = t(() => {
91
96
  e("onTestAgent"), f?.();
92
- }, [e, f]), U = t(() => {
97
+ }, [e, f]), Z = t(() => {
93
98
  e("onGoToDashboard"), h?.();
94
- }, [e, h]), V = async () => {
99
+ }, [e, h]), _ = t(
100
+ (n) => (e("onCreateSubAgent", n), s ? s(n) : Promise.reject(new Error("onCreateSubAgent not provided"))),
101
+ [e, s]
102
+ ), ee = async () => {
95
103
  e("onGoLiveConfirm");
96
- const o = q();
97
- if (o && typeof o.then == "function") {
98
- A(!0);
104
+ const n = K();
105
+ if (n && typeof n.then == "function") {
106
+ D(!0);
99
107
  try {
100
- await o, a("success");
108
+ await n, a("success");
101
109
  } finally {
102
- A(!1);
110
+ D(!1);
103
111
  }
104
112
  } else
105
113
  a("success");
106
114
  };
107
- return /* @__PURE__ */ n(
108
- le,
115
+ return /* @__PURE__ */ o(
116
+ he,
109
117
  {
110
- value: g,
111
- onChange: F,
112
- activeStep: G,
113
- onStepChange: c ? W : void 0,
114
- availableTools: P,
115
- availableSubAgents: M,
116
- availableIntents: k,
117
- availableModels: w,
118
- validation: R,
119
- applicationType: x,
120
- disableStepNavigation: H,
121
- children: /* @__PURE__ */ y(Z, { "data-test": T["data-test"] ?? "agent-builder", children: [
122
- /* @__PURE__ */ n(
123
- ae,
118
+ value: m,
119
+ onChange: $,
120
+ activeStep: k,
121
+ onStepChange: u ? q : void 0,
122
+ availableTools: I,
123
+ availableSubAgents: R,
124
+ availableIntents: x,
125
+ availableModels: j,
126
+ validation: H,
127
+ applicationType: F,
128
+ disableStepNavigation: U,
129
+ onCreateSubAgent: s ? _ : void 0,
130
+ onFetchSubAgent: G,
131
+ onUpdateSubAgent: P,
132
+ onImproveSubAgent: w,
133
+ children: /* @__PURE__ */ B(te, { "data-test": M["data-test"] ?? "agent-builder", children: [
134
+ /* @__PURE__ */ o(
135
+ de,
124
136
  {
125
- name: g.name,
126
- status: g.status,
127
- onBack: u ? E : void 0,
128
- onDiscard: $,
129
- onSaveDraft: L,
130
- isSaving: p
137
+ name: m.name,
138
+ status: m.status,
139
+ onBack: g ? Q : void 0,
140
+ onDiscard: J,
141
+ onSaveDraft: y,
142
+ isSaving: S
131
143
  }
132
144
  ),
133
- /* @__PURE__ */ y(_, { children: [
134
- /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(re, {}) }),
135
- /* @__PURE__ */ n(ne, { children: I ? /* @__PURE__ */ n(
145
+ /* @__PURE__ */ B(ae, { children: [
146
+ /* @__PURE__ */ o(re, { children: /* @__PURE__ */ o(ge, {}) }),
147
+ /* @__PURE__ */ o(ie, { children: N ? /* @__PURE__ */ o(
136
148
  "div",
137
149
  {
138
150
  style: {
@@ -141,50 +153,51 @@ const me = () => {
141
153
  justifyContent: "center",
142
154
  height: "100%"
143
155
  },
144
- children: /* @__PURE__ */ n(ge, { size: "large", color: Y.stroke.brand })
156
+ children: /* @__PURE__ */ o(Ce, { size: "large", color: oe.stroke.brand })
145
157
  }
146
- ) : /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ n(me, {}) }) })
158
+ ) : /* @__PURE__ */ o(se, { children: /* @__PURE__ */ o(Ae, {}) }) })
147
159
  ] }),
148
- /* @__PURE__ */ n(
149
- te,
160
+ /* @__PURE__ */ o(
161
+ le,
150
162
  {
151
- footerHint: j,
152
- onTestAgent: f ? Q : void 0,
163
+ footerHint: O,
164
+ onTestAgent: f ? Y : void 0,
153
165
  onGoLive: () => {
154
166
  e("onGoLive"), a("confirm");
155
167
  },
156
- isPublishing: S || C
168
+ isPublishing: b || A
157
169
  }
158
170
  ),
159
- /* @__PURE__ */ n(
160
- se,
171
+ /* @__PURE__ */ o(
172
+ ue,
161
173
  {
162
- mode: N,
174
+ mode: z,
163
175
  onClose: () => a(null),
164
- onConfirm: V,
176
+ onConfirm: ee,
165
177
  onSaveDraft: () => {
166
- a(null), L();
178
+ a(null), y();
167
179
  },
168
- onGoToDashboard: h ? U : void 0,
169
- isPublishing: S || C
180
+ onGoToDashboard: h ? Z : void 0,
181
+ isPublishing: b || A
170
182
  }
171
183
  ),
172
- /* @__PURE__ */ n(
173
- ie,
184
+ /* @__PURE__ */ o(
185
+ ce,
174
186
  {
175
- open: O,
176
- onClose: () => r(!1),
177
- onDiscard: J,
178
- onSaveDraft: K,
179
- isSaving: p || z
187
+ open: E,
188
+ onClose: () => l(!1),
189
+ onDiscard: V,
190
+ onSaveDraft: X,
191
+ isSaving: S || W
180
192
  }
181
- )
193
+ ),
194
+ /* @__PURE__ */ o(fe, {})
182
195
  ] })
183
196
  }
184
197
  );
185
198
  };
186
- ve.displayName = "AgentBuilder";
199
+ De.displayName = "AgentBuilder";
187
200
  export {
188
- ve as AgentBuilder
201
+ De as AgentBuilder
189
202
  };
190
203
  //# sourceMappingURL=AgentBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport { AgentBuilderProps, AgentValue } from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tvalidation,\n\t\tapplicationType,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleDiscard = useCallback(() => {\n\t\tlogAction('onDiscard');\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(() => {\n\t\tlogAction('onTestAgent');\n\t\tonTestAgent?.();\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonDiscard={handleDiscard}\n\t\t\t\t\tonSaveDraft={handleSaveDraft}\n\t\t\t\t\tisSaving={isSaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t}}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => setModalMode(null)}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","validation","applicationType","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleDiscard","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","AgentBuilderFooter","GoLiveModal","DiscardModal"],"mappings":";;;;;;;;;;;;;;;AAyBA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EA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BAACQ,IAAA,EAAQ,MAAK,SAAQ,OAAOC,EAAO,OAAO,MAAA,CAAO;AAAA,YAAA;AAAA,UAAA,IAGnD,gBAAAT,EAACU,IAAA,EACA,UAAA,gBAAAV,EAAC3D,IAAA,CAAA,CAAY,GACd,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAA2D;AAAA,UAACW;AAAA,UAAA;AAAA,YACA,YAAAzC;AAAA,YACA,aAAab,IAAcwC,IAAkB;AAAA,YAC7C,UAAU,MAAM;AACf,cAAAf,EAAU,UAAU,GACpBR,EAAa,SAAS;AAAA,YACvB;AAAA,YACA,cAAcN,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAAwB;AAAA,UAACY;AAAA,UAAA;AAAA,YACA,MAAMvC;AAAA,YACN,SAAS,MAAMC,EAAa,IAAI;AAAA,YAChC,WAAWyB;AAAA,YACX,aAAa,MAAM;AAClB,cAAAzB,EAAa,IAAI,GACjBiB,EAAA;AAAA,YACD;AAAA,YACA,iBAAiBjC,IAAkBwC,IAAsB;AAAA,YACzD,cAAc9B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAAwB;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAMnC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWe;AAAA,YACX,aAAaC;AAAA,YACb,UAAU5B,KAAYa;AAAA,UAAA;AAAA,QAAA;AAAA,MACvB,EAAA,CACD;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAhC,GAAa,cAAc;"}
1
+ {"version":3,"file":"AgentBuilder.js","sources":["../../../../src/components/agent-builder/AgentBuilder.tsx"],"sourcesContent":["import React, { useCallback, useState } from 'react';\nimport { Spinner } from '@src/components/spinner';\nimport { COLORS } from '@src/constants/Theme';\nimport {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n} from './AgentBuilder.styled';\nimport { AgentBuilderFooter } from './components/AgentBuilderFooter';\nimport { AgentBuilderTopBar } from './components/AgentBuilderTopBar';\nimport { DiscardModal } from './components/DiscardModal';\nimport { GoLiveModal, GoLiveModalMode } from './components/GoLiveModal';\nimport { StepRail } from './components/StepRail';\nimport { UndoToast } from './components/UndoToast';\nimport {\n\tAgentBuilderProvider,\n\tuseAgentBuilderContext,\n} from './context/AgentBuilderContext';\nimport { Step1About } from './steps/Step1About';\nimport { Step2WhenItStepsIn } from './steps/Step2WhenItStepsIn';\nimport { Step3HowItResponds } from './steps/Step3HowItResponds';\nimport { Step4HandoverRules } from './steps/Step4HandoverRules';\n\nconst StepContent: React.FC = () => {\n\tconst { activeStep } = useAgentBuilderContext();\n\tswitch (activeStep) {\n\t\tcase 'about':\n\t\t\treturn <Step1About />;\n\t\tcase 'trigger':\n\t\t\treturn <Step2WhenItStepsIn />;\n\t\tcase 'response':\n\t\t\treturn <Step3HowItResponds />;\n\t\tcase 'handover':\n\t\t\treturn <Step4HandoverRules />;\n\t\tdefault:\n\t\t\treturn null;\n\t}\n};\n\n/**\n * 4-step creation/edit wizard body for an AI agent. Presentational and\n * controlled — the consumer owns the `value`, persistence and routing.\n *\n * @example\n * <AgentBuilder\n * value={agent}\n * onChange={(patch) => setAgent({ ...agent, ...patch })}\n * availableTools={tools}\n * availableSubAgents={subAgents}\n * onDiscard={() => router.back()}\n * onSaveDraft={saveDraft}\n * onPublish={publish}\n * />\n */\nexport const AgentBuilder: React.FC<AgentBuilderProps> = (props) => {\n\tconst {\n\t\tconfig,\n\t\tonChange,\n\t\tonStepChange,\n\t\tonDiscard,\n\t\tonSaveDraft,\n\t\tonPublish,\n\t\tonBack,\n\t\tonTestAgent,\n\t\tonGoToDashboard,\n\t\tonCreateSubAgent,\n\t\tonFetchSubAgent,\n\t\tonUpdateSubAgent,\n\t\tonImproveSubAgent,\n\t\t...rest\n\t} = props;\n\tconst {\n\t\tvalue,\n\t\tactiveStep,\n\t\tavailableTools,\n\t\tavailableSubAgents,\n\t\tavailableIntents = [],\n\t\tavailableModels = [],\n\t\tvalidation,\n\t\tapplicationType,\n\t\tisSaving,\n\t\tisPublishing,\n\t\tisLoading,\n\t\tfooterHint = 'Changes don’t affect customers until you go live',\n\t\tdisableStepNavigation,\n\t\tdebugLog,\n\t} = config;\n\n\tconst [modalMode, setModalMode] = useState<GoLiveModalMode>(null);\n\tconst [publishingLocal, setPublishingLocal] = useState(false);\n\t// Back was pressed → confirm leaving (save draft / discard) before navigating.\n\tconst [showLeaveConfirm, setShowLeaveConfirm] = useState(false);\n\tconst [savingAndLeaving, setSavingAndLeaving] = useState(false);\n\n\t// Gated debug logging: each handler logs at its start only when `debugLog`.\n\tconst logAction = useCallback(\n\t\t(action: string, ...args: unknown[]) => {\n\t\t\tif (debugLog) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(`[AgentBuilder] ${action}`, ...args);\n\t\t\t}\n\t\t},\n\t\t[debugLog],\n\t);\n\n\tconst handleChange = useCallback(\n\t\t(patch: Partial<AgentValue>) => {\n\t\t\tlogAction('onChange', patch);\n\t\t\tonChange(patch);\n\t\t},\n\t\t[logAction, onChange],\n\t);\n\tconst handleStepChange = useCallback(\n\t\t(step: Parameters<NonNullable<typeof onStepChange>>[0]) => {\n\t\t\tlogAction('onStepChange', step);\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[logAction, onStepChange],\n\t);\n\tconst handleDiscard = useCallback(() => {\n\t\tlogAction('onDiscard');\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\tconst handleSaveDraft = useCallback(() => {\n\t\tlogAction('onSaveDraft');\n\t\treturn onSaveDraft();\n\t}, [logAction, onSaveDraft]);\n\tconst handlePublish = useCallback(() => {\n\t\tlogAction('onPublish');\n\t\treturn onPublish();\n\t}, [logAction, onPublish]);\n\t// Back opens the \"Save as draft?\" confirmation rather than leaving directly.\n\tconst handleBack = useCallback(() => {\n\t\tlogAction('onBack');\n\t\tsetShowLeaveConfirm(true);\n\t}, [logAction]);\n\n\t// Modal \"Discard\" defers to the parent's discard handler (same as the top bar).\n\tconst handleDiscardAndLeave = useCallback(() => {\n\t\tlogAction('onDiscardAndLeave');\n\t\tsetShowLeaveConfirm(false);\n\t\tonDiscard();\n\t}, [logAction, onDiscard]);\n\n\tconst handleSaveDraftAndLeave = useCallback(async () => {\n\t\tlogAction('onSaveDraftAndLeave');\n\t\tconst result = onSaveDraft();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSavingAndLeaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSavingAndLeaving(false);\n\t\t\t}\n\t\t}\n\t\tsetShowLeaveConfirm(false);\n\t\tonBack?.();\n\t}, [logAction, onSaveDraft, onBack]);\n\tconst handleTestAgent = useCallback(() => {\n\t\tlogAction('onTestAgent');\n\t\tonTestAgent?.();\n\t}, [logAction, onTestAgent]);\n\tconst handleGoToDashboard = useCallback(() => {\n\t\tlogAction('onGoToDashboard');\n\t\tonGoToDashboard?.();\n\t}, [logAction, onGoToDashboard]);\n\tconst handleCreateSubAgent = useCallback(\n\t\t(draft: SubAgentDraft) => {\n\t\t\tlogAction('onCreateSubAgent', draft);\n\t\t\treturn onCreateSubAgent\n\t\t\t\t? onCreateSubAgent(draft)\n\t\t\t\t: Promise.reject(new Error('onCreateSubAgent not provided'));\n\t\t},\n\t\t[logAction, onCreateSubAgent],\n\t);\n\n\tconst handleConfirmGoLive = async () => {\n\t\tlogAction('onGoLiveConfirm');\n\t\tconst result = handlePublish();\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetPublishingLocal(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t\tsetModalMode('success');\n\t\t\t} finally {\n\t\t\t\tsetPublishingLocal(false);\n\t\t\t}\n\t\t} else {\n\t\t\tsetModalMode('success');\n\t\t}\n\t};\n\n\treturn (\n\t\t<AgentBuilderProvider\n\t\t\tvalue={value}\n\t\t\tonChange={handleChange}\n\t\t\tactiveStep={activeStep}\n\t\t\tonStepChange={onStepChange ? handleStepChange : undefined}\n\t\t\tavailableTools={availableTools}\n\t\t\tavailableSubAgents={availableSubAgents}\n\t\t\tavailableIntents={availableIntents}\n\t\t\tavailableModels={availableModels}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tdisableStepNavigation={disableStepNavigation}\n\t\t\tonCreateSubAgent={onCreateSubAgent ? handleCreateSubAgent : undefined}\n\t\t\tonFetchSubAgent={onFetchSubAgent}\n\t\t\tonUpdateSubAgent={onUpdateSubAgent}\n\t\t\tonImproveSubAgent={onImproveSubAgent}\n\t\t>\n\t\t\t<BuilderRoot data-test={rest['data-test'] ?? 'agent-builder'}>\n\t\t\t\t<AgentBuilderTopBar\n\t\t\t\t\tname={value.name}\n\t\t\t\t\tstatus={value.status}\n\t\t\t\t\tonBack={onBack ? handleBack : undefined}\n\t\t\t\t\tonDiscard={handleDiscard}\n\t\t\t\t\tonSaveDraft={handleSaveDraft}\n\t\t\t\t\tisSaving={isSaving}\n\t\t\t\t/>\n\n\t\t\t\t<Main>\n\t\t\t\t\t<Rail>\n\t\t\t\t\t\t<StepRail />\n\t\t\t\t\t</Rail>\n\t\t\t\t\t<Content>\n\t\t\t\t\t\t{isLoading ? (\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\t\t\t\theight: '100%',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Spinner size=\"large\" color={COLORS.stroke.brand} />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<ContentCard>\n\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t</ContentCard>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</Content>\n\t\t\t\t</Main>\n\n\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t}}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => setModalMode(null)}\n\t\t\t\t\tonConfirm={handleConfirmGoLive}\n\t\t\t\t\tonSaveDraft={() => {\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\thandleSaveDraft();\n\t\t\t\t\t}}\n\t\t\t\t\tonGoToDashboard={onGoToDashboard ? handleGoToDashboard : undefined}\n\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t/>\n\n\t\t\t\t<DiscardModal\n\t\t\t\t\topen={showLeaveConfirm}\n\t\t\t\t\tonClose={() => setShowLeaveConfirm(false)}\n\t\t\t\t\tonDiscard={handleDiscardAndLeave}\n\t\t\t\t\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\n\t\t\t\t/>\n\n\t\t\t\t<UndoToast />\n\t\t\t</BuilderRoot>\n\t\t</AgentBuilderProvider>\n\t);\n};\n\nAgentBuilder.displayName = 'AgentBuilder';\n"],"names":["StepContent","activeStep","useAgentBuilderContext","Step1About","Step2WhenItStepsIn","Step3HowItResponds","Step4HandoverRules","AgentBuilder","props","config","onChange","onStepChange","onDiscard","onSaveDraft","onPublish","onBack","onTestAgent","onGoToDashboard","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","validation","applicationType","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleDiscard","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","AgentBuilderFooter","GoLiveModal","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA8BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+BAAQE,IAAA,EAAW;AAAA,IACpB,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B,KAAK;AACJ,+BAAQC,IAAA,EAAmB;AAAA,IAC5B;AACC,aAAO;AAAA,EAAA;AAEV,GAiBaC,KAA4C,CAACC,MAAU;AACnE,QAAM;AAAA,IACL,QAAAC;AAAA,IACA,UAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,QAAAC;AAAA,IACA,aAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,mBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACAd,GACE;AAAA,IACL,OAAAe;AAAA,IACA,YAAAtB;AAAA,IACA,gBAAAuB;AAAA,IACA,oBAAAC;AAAA,IACA,kBAAAC,IAAmB,CAAA;AAAA,IACnB,iBAAAC,IAAkB,CAAA;AAAA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C,IAAkB;AAAA,YAC7C,UAAU,MAAM;AACf,cAAAf,EAAU,UAAU,GACpBR,EAAa,SAAS;AAAA,YACvB;AAAA,YACA,cAAcN,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA0B;AAAA,UAACY;AAAA,UAAA;AAAA,YACA,MAAMzC;AAAA,YACN,SAAS,MAAMC,EAAa,IAAI;AAAA,YAChC,WAAW2B;AAAA,YACX,aAAa,MAAM;AAClB,cAAA3B,EAAa,IAAI,GACjBiB,EAAA;AAAA,YACD;AAAA,YACA,iBAAiBrC,IAAkB4C,IAAsB;AAAA,YACzD,cAAc9B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAA0B;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAMrC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWe;AAAA,YACX,aAAaC;AAAA,YACb,UAAU5B,KAAYa;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBoC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEAxE,GAAa,cAAc;"}
@@ -14,6 +14,17 @@ export type AgentValue = AgentConfig & {
14
14
  };
15
15
  export type AgentTool = AgentToolDoc;
16
16
  export type AgentTriggerValue = Trigger;
17
+ /**
18
+ * The data captured by the "Create sub-agent" drawer. The consumer persists it
19
+ * (as an `isEntry: false` agent) and returns the created {@link SubAgentRef}.
20
+ */
21
+ export interface SubAgentDraft {
22
+ name: string;
23
+ instructions: string;
24
+ guardrail: string;
25
+ /** Tool ids the sub-agent can use. */
26
+ tools: string[];
27
+ }
17
28
  export type { AgentConfig, AgentToolDoc, AgentStatus, StepKey, StepValidation, TriggerMode, Trigger, HandoverMethod, AgentHandoverConfig, SubAgentRef, IntentOption, ModelOption, } from '@bikdotai/bik-models/ai-agents';
18
29
  /**
19
30
  * All non-function (data / reference / flag) props, grouped into one object.
@@ -69,5 +80,28 @@ export interface AgentBuilderProps {
69
80
  onTestAgent?: () => void;
70
81
  /** After a successful go-live, navigate to the dashboard. Drives the success modal CTA. */
71
82
  onGoToDashboard?: () => void;
83
+ /**
84
+ * Create a sub-agent inline (the Step-3 "Create sub-agent" drawer). The
85
+ * consumer persists the draft and resolves with the created agent's
86
+ * `{ id, name }`; the builder then references it in `subagents`. Omit to hide
87
+ * the create flow (sub-agents fall back to selecting existing ones).
88
+ */
89
+ onCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;
90
+ /**
91
+ * Fetch an existing sub-agent's editable data when the user clicks
92
+ * "Configure" on a sub-agent row. The builder opens the drawer in edit mode
93
+ * prefilled with the result. Omit to hide the Configure action.
94
+ */
95
+ onFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;
96
+ /**
97
+ * Persist edits to an existing sub-agent (drawer submit in edit mode).
98
+ * Resolves with the updated `{ id, name }`.
99
+ */
100
+ onUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;
101
+ /**
102
+ * Optional "Improve with AI" for the sub-agent drawer's instructions /
103
+ * guardrails. Resolves with the rewritten text. Omit to hide the buttons.
104
+ */
105
+ onImproveSubAgent?: (kind: 'instructions' | 'guardrail', text: string) => Promise<string>;
72
106
  'data-test'?: string;
73
107
  }
@@ -110,6 +110,15 @@ export declare const RowText: import('styled-components').StyledComponent<"div",
110
110
  export declare const RowRemoveButton: import('styled-components').StyledComponent<"button", any, {
111
111
  className: "bik-row-remove-button";
112
112
  }, "className">;
113
+ export declare const RowActions: import('styled-components').StyledComponent<"div", any, {
114
+ className: "bik-row-actions";
115
+ }, "className">;
116
+ export declare const RowActionDivider: import('styled-components').StyledComponent<"span", any, {
117
+ className: "bik-row-action-divider";
118
+ }, "className">;
119
+ export declare const RowMenuButton: import('styled-components').StyledComponent<"button", any, {
120
+ className: "bik-row-menu-button";
121
+ }, "className">;
113
122
  export declare const ModalBody: import('styled-components').StyledComponent<"div", any, {
114
123
  className: "bik-modal-body";
115
124
  }, "className">;
@@ -119,3 +128,28 @@ export declare const ModalIcon: import('styled-components').StyledComponent<"div
119
128
  export declare const ModalActions: import('styled-components').StyledComponent<"div", any, {
120
129
  className: "bik-modal-actions";
121
130
  }, "className">;
131
+ export declare const SubAgentScrim: import('styled-components').StyledComponent<"div", any, {
132
+ className: "bik-subagent-scrim";
133
+ }, "className">;
134
+ export declare const SubAgentPanel: import('styled-components').StyledComponent<"div", any, {
135
+ className: "bik-subagent-panel";
136
+ }, "className">;
137
+ export declare const SubAgentPanelHeader: import('styled-components').StyledComponent<"div", any, {
138
+ className: "bik-subagent-panel-header";
139
+ }, "className">;
140
+ export declare const SubAgentPanelHeaderText: import('styled-components').StyledComponent<"div", any, {
141
+ className: "bik-subagent-panel-header-text";
142
+ }, "className">;
143
+ export declare const SubAgentPanelBody: import('styled-components').StyledComponent<"div", any, {
144
+ className: "bik-subagent-panel-body";
145
+ }, "className">;
146
+ export declare const SubAgentPanelFooter: import('styled-components').StyledComponent<"div", any, {
147
+ className: "bik-subagent-panel-footer";
148
+ }, "className">;
149
+ export declare const SubAgentCloseButton: import('styled-components').StyledComponent<"button", any, {
150
+ className: "bik-subagent-close";
151
+ }, "className">;
152
+ /** Inline action row inside a rich field (e.g. "Improve with AI"). */
153
+ export declare const FieldActionRow: import('styled-components').StyledComponent<"div", any, {
154
+ className: "bik-field-action-row";
155
+ }, "className">;