@bikdotai/bik-component-library 0.0.852 → 0.0.853-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/add-variableV2/AddDataPill.js +10 -0
- package/dist/cjs/components/add-variableV2/AddDataPill.js.map +1 -0
- package/dist/cjs/components/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +11 -11
- package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js +5 -5
- package/dist/cjs/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +7 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js +1 -1
- package/dist/cjs/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionPicker.js +41 -14
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js +6 -5
- package/dist/cjs/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js +2 -2
- package/dist/cjs/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js +65 -0
- package/dist/cjs/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js +10 -0
- package/dist/cjs/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/tools.js +1 -1
- package/dist/cjs/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js +1 -1
- package/dist/cjs/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +4 -4
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js +1 -1
- package/dist/cjs/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/cjs/editor/BikEditor.js +1 -1
- package/dist/cjs/editor/BikEditor.js.map +1 -1
- package/dist/cjs/editor/BikEditor.styles.js +11 -3
- package/dist/cjs/editor/BikEditor.styles.js.map +1 -1
- package/dist/cjs/editor/BikEditor.types.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js +1 -1
- package/dist/cjs/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/add-variableV2/AddDataPill.d.ts +24 -0
- package/dist/esm/components/add-variableV2/AddDataPill.js +33 -0
- package/dist/esm/components/add-variableV2/AddDataPill.js.map +1 -0
- package/dist/esm/components/add-variableV2/index.d.ts +1 -0
- package/dist/esm/components/agent-builder/AgentBuilder.js +71 -69
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +182 -136
- package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.d.ts +3 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +214 -207
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +12 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +144 -103
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +48 -45
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +14 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.js +276 -208
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.d.ts +8 -0
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js +184 -168
- package/dist/esm/components/agent-builder/components/RestApiToolPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.d.ts +9 -0
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js +67 -48
- package/dist/esm/components/agent-builder/components/ToolInstructionsField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/VariableInlineField.d.ts +26 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js +149 -0
- package/dist/esm/components/agent-builder/components/VariableInlineField.js.map +1 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.d.ts +46 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js +118 -0
- package/dist/esm/components/agent-builder/components/VariableTriggerArea.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/tools.d.ts +1 -1
- package/dist/esm/components/agent-builder/constants/tools.js +13 -12
- package/dist/esm/components/agent-builder/constants/tools.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +7 -0
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +99 -96
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +160 -156
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +14 -4
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +54 -36
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/variable-picker-v3/Content.js +16 -15
- package/dist/esm/components/variable-picker-v3/Content.js.map +1 -1
- package/dist/esm/editor/BikEditor.js +70 -64
- package/dist/esm/editor/BikEditor.js.map +1 -1
- package/dist/esm/editor/BikEditor.styles.js +12 -4
- package/dist/esm/editor/BikEditor.styles.js.map +1 -1
- package/dist/esm/editor/BikEditor.types.d.ts +9 -0
- package/dist/esm/editor/BikEditor.types.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionDropdown.js +28 -28
- package/dist/esm/editor/extensions/mention/MentionDropdown.js.map +1 -1
- package/dist/esm/editor/extensions/mention/MentionExtension.js +23 -19
- package/dist/esm/editor/extensions/mention/MentionExtension.js.map +1 -1
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/index.js +543 -541
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { useState as c, useCallback as t } from "react";
|
|
3
|
-
import { COLORS as
|
|
4
|
-
import { BuilderRoot as
|
|
5
|
-
import { AgentBuilderFooter as
|
|
6
|
-
import { AgentBuilderTopBar as
|
|
7
|
-
import { DiscardModal as
|
|
8
|
-
import { GoLiveModal as
|
|
9
|
-
import { StepRail as
|
|
10
|
-
import { UndoToast as
|
|
11
|
-
import { AgentBuilderProvider as
|
|
12
|
-
import { Step1About as
|
|
3
|
+
import { COLORS as se } from "../../constants/Theme.js";
|
|
4
|
+
import { BuilderRoot as le, Main as ce, Rail as de, Content as ue, ContentCard as ge, StepScroll as fe } from "./AgentBuilder.styled.js";
|
|
5
|
+
import { AgentBuilderFooter as me } from "./components/AgentBuilderFooter.js";
|
|
6
|
+
import { AgentBuilderTopBar as he } from "./components/AgentBuilderTopBar.js";
|
|
7
|
+
import { DiscardModal as ve } from "./components/DiscardModal.js";
|
|
8
|
+
import { GoLiveModal as pe } from "./components/GoLiveModal.js";
|
|
9
|
+
import { StepRail as Se } from "./components/StepRail.js";
|
|
10
|
+
import { UndoToast as be } from "./components/UndoToast.js";
|
|
11
|
+
import { AgentBuilderProvider as Ce, useAgentBuilderContext as Ae } from "./context/AgentBuilderContext.js";
|
|
12
|
+
import { Step1About as De } from "./steps/Step1About.js";
|
|
13
13
|
import { Step2WhenItStepsIn as Le } from "./steps/Step2WhenItStepsIn.js";
|
|
14
|
-
import { Step3HowItResponds as
|
|
15
|
-
import { Step4HandoverRules as
|
|
16
|
-
import { Spinner as
|
|
17
|
-
const
|
|
18
|
-
const { activeStep: d } =
|
|
14
|
+
import { Step3HowItResponds as Te } from "./steps/Step3HowItResponds.js";
|
|
15
|
+
import { Step4HandoverRules as ye } from "./steps/Step4HandoverRules.js";
|
|
16
|
+
import { Spinner as Be } from "../spinner/Spinner.js";
|
|
17
|
+
const Ge = () => {
|
|
18
|
+
const { activeStep: d } = Ae();
|
|
19
19
|
switch (d) {
|
|
20
20
|
case "about":
|
|
21
|
-
return /* @__PURE__ */ o(
|
|
21
|
+
return /* @__PURE__ */ o(De, {});
|
|
22
22
|
case "trigger":
|
|
23
23
|
return /* @__PURE__ */ o(Le, {});
|
|
24
24
|
case "response":
|
|
25
|
-
return /* @__PURE__ */ o(De, {});
|
|
26
|
-
case "handover":
|
|
27
25
|
return /* @__PURE__ */ o(Te, {});
|
|
26
|
+
case "handover":
|
|
27
|
+
return /* @__PURE__ */ o(ye, {});
|
|
28
28
|
default:
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
|
-
},
|
|
31
|
+
}, Ie = (d) => {
|
|
32
32
|
const {
|
|
33
33
|
config: P,
|
|
34
34
|
onChange: v,
|
|
@@ -55,33 +55,34 @@ const Be = () => {
|
|
|
55
55
|
availableModels: U = [],
|
|
56
56
|
configToolTemplates: z,
|
|
57
57
|
integrationStatus: E,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
variablesData: W,
|
|
59
|
+
validation: $,
|
|
60
|
+
applicationType: q,
|
|
61
|
+
charLimits: J,
|
|
61
62
|
isSaving: b,
|
|
62
63
|
isPublishing: C,
|
|
63
|
-
isLoading:
|
|
64
|
-
footerHint:
|
|
65
|
-
disableStepNavigation:
|
|
64
|
+
isLoading: K,
|
|
65
|
+
footerHint: Q = "Changes don’t affect customers until you go live",
|
|
66
|
+
disableStepNavigation: V,
|
|
66
67
|
debugLog: A
|
|
67
|
-
} = P, [
|
|
68
|
-
(n, ...
|
|
69
|
-
A && console.log(`[AgentBuilder] ${n}`, ...
|
|
68
|
+
} = P, [D, a] = c(null), [L, T] = c(!1), [X, l] = c(!1), [y, B] = c(!1), e = t(
|
|
69
|
+
(n, ...ie) => {
|
|
70
|
+
A && console.log(`[AgentBuilder] ${n}`, ...ie);
|
|
70
71
|
},
|
|
71
72
|
[A]
|
|
72
|
-
),
|
|
73
|
+
), Y = t(
|
|
73
74
|
(n) => {
|
|
74
75
|
e("onChange", n), v(n);
|
|
75
76
|
},
|
|
76
77
|
[e, v]
|
|
77
|
-
),
|
|
78
|
+
), Z = t(
|
|
78
79
|
(n) => {
|
|
79
80
|
e("onStepChange", n), u?.(n);
|
|
80
81
|
},
|
|
81
82
|
[e, u]
|
|
82
|
-
),
|
|
83
|
+
), _ = t(() => (e("onSaveDraft"), r()), [e, r]), ee = t(() => (e("onPublish"), S()), [e, S]), ne = t(() => {
|
|
83
84
|
e("onBack"), l(!0);
|
|
84
|
-
}, [e]),
|
|
85
|
+
}, [e]), oe = t(() => {
|
|
85
86
|
e("onDiscardAndLeave"), l(!1), p();
|
|
86
87
|
}, [e, p]), G = t(async () => {
|
|
87
88
|
e("onSaveDraftAndLeave");
|
|
@@ -95,16 +96,16 @@ const Be = () => {
|
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
l(!1), g?.();
|
|
98
|
-
}, [e, r, g]),
|
|
99
|
+
}, [e, r, g]), te = t(() => {
|
|
99
100
|
e("onTestAgent"), f?.();
|
|
100
101
|
}, [e, f]), I = t(() => {
|
|
101
102
|
e("onGoToDashboard"), m?.();
|
|
102
|
-
}, [e, m]),
|
|
103
|
+
}, [e, m]), ae = t(
|
|
103
104
|
(n) => (e("onCreateSubAgent", n), i ? i(n) : Promise.reject(new Error("onCreateSubAgent not provided"))),
|
|
104
105
|
[e, i]
|
|
105
|
-
),
|
|
106
|
+
), re = async () => {
|
|
106
107
|
e("onGoLiveConfirm");
|
|
107
|
-
const n =
|
|
108
|
+
const n = ee();
|
|
108
109
|
if (n && typeof n.then == "function") {
|
|
109
110
|
T(!0);
|
|
110
111
|
try {
|
|
@@ -116,12 +117,12 @@ const Be = () => {
|
|
|
116
117
|
a("success");
|
|
117
118
|
};
|
|
118
119
|
return /* @__PURE__ */ o(
|
|
119
|
-
|
|
120
|
+
Ce,
|
|
120
121
|
{
|
|
121
122
|
value: s,
|
|
122
|
-
onChange:
|
|
123
|
+
onChange: Y,
|
|
123
124
|
activeStep: H,
|
|
124
|
-
onStepChange: u ?
|
|
125
|
+
onStepChange: u ? Z : void 0,
|
|
125
126
|
availableTools: F,
|
|
126
127
|
availableSubAgents: N,
|
|
127
128
|
availableIntents: O,
|
|
@@ -129,29 +130,30 @@ const Be = () => {
|
|
|
129
130
|
configToolTemplates: z,
|
|
130
131
|
integrationStatus: E,
|
|
131
132
|
onConnectIntegration: x,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
variablesData: W,
|
|
134
|
+
validation: $,
|
|
135
|
+
applicationType: q,
|
|
136
|
+
charLimits: J,
|
|
137
|
+
disableStepNavigation: V,
|
|
138
|
+
onCreateSubAgent: i ? ae : void 0,
|
|
137
139
|
onFetchSubAgent: w,
|
|
138
140
|
onUpdateSubAgent: M,
|
|
139
141
|
onImproveSubAgent: k,
|
|
140
142
|
onImproveToolInstructions: R,
|
|
141
|
-
children: /* @__PURE__ */ h(
|
|
143
|
+
children: /* @__PURE__ */ h(le, { "data-test": j["data-test"] ?? "agent-builder", children: [
|
|
142
144
|
/* @__PURE__ */ o(
|
|
143
|
-
|
|
145
|
+
he,
|
|
144
146
|
{
|
|
145
147
|
name: s.name,
|
|
146
148
|
status: s.status,
|
|
147
|
-
onBack: g ?
|
|
149
|
+
onBack: g ? ne : void 0,
|
|
148
150
|
onSaveDraft: G,
|
|
149
151
|
isSaving: b || y
|
|
150
152
|
}
|
|
151
153
|
),
|
|
152
|
-
/* @__PURE__ */ h(
|
|
153
|
-
/* @__PURE__ */ o(
|
|
154
|
-
/* @__PURE__ */ o(
|
|
154
|
+
/* @__PURE__ */ h(ce, { children: [
|
|
155
|
+
/* @__PURE__ */ o(de, { children: /* @__PURE__ */ o(Se, {}) }),
|
|
156
|
+
/* @__PURE__ */ o(ue, { children: K ? /* @__PURE__ */ o(
|
|
155
157
|
"div",
|
|
156
158
|
{
|
|
157
159
|
style: {
|
|
@@ -160,57 +162,57 @@ const Be = () => {
|
|
|
160
162
|
justifyContent: "center",
|
|
161
163
|
height: "100%"
|
|
162
164
|
},
|
|
163
|
-
children: /* @__PURE__ */ o(
|
|
165
|
+
children: /* @__PURE__ */ o(Be, { size: "large", color: se.stroke.brand })
|
|
164
166
|
}
|
|
165
|
-
) : /* @__PURE__ */ h(
|
|
166
|
-
/* @__PURE__ */ o(
|
|
167
|
+
) : /* @__PURE__ */ h(ge, { children: [
|
|
168
|
+
/* @__PURE__ */ o(fe, { children: /* @__PURE__ */ o(Ge, {}) }),
|
|
167
169
|
/* @__PURE__ */ o(
|
|
168
|
-
|
|
170
|
+
me,
|
|
169
171
|
{
|
|
170
|
-
footerHint:
|
|
171
|
-
onTestAgent: f ?
|
|
172
|
+
footerHint: Q,
|
|
173
|
+
onTestAgent: f ? te : void 0,
|
|
172
174
|
onGoLive: () => {
|
|
173
175
|
e("onGoLive"), a("confirm");
|
|
174
176
|
},
|
|
175
|
-
isPublishing: C ||
|
|
177
|
+
isPublishing: C || L
|
|
176
178
|
}
|
|
177
179
|
)
|
|
178
180
|
] }) })
|
|
179
181
|
] }),
|
|
180
182
|
/* @__PURE__ */ o(
|
|
181
|
-
|
|
183
|
+
pe,
|
|
182
184
|
{
|
|
183
|
-
mode:
|
|
185
|
+
mode: D,
|
|
184
186
|
onClose: () => {
|
|
185
|
-
const n =
|
|
187
|
+
const n = D === "success";
|
|
186
188
|
a(null), n && I();
|
|
187
189
|
},
|
|
188
|
-
onConfirm:
|
|
190
|
+
onConfirm: re,
|
|
189
191
|
onSaveDraft: () => {
|
|
190
|
-
a(null),
|
|
192
|
+
a(null), _();
|
|
191
193
|
},
|
|
192
194
|
onGoToDashboard: m ? I : void 0,
|
|
193
|
-
isPublishing: C ||
|
|
195
|
+
isPublishing: C || L
|
|
194
196
|
}
|
|
195
197
|
),
|
|
196
198
|
/* @__PURE__ */ o(
|
|
197
|
-
|
|
199
|
+
ve,
|
|
198
200
|
{
|
|
199
|
-
open:
|
|
201
|
+
open: X,
|
|
200
202
|
onClose: () => l(!1),
|
|
201
|
-
onDiscard:
|
|
203
|
+
onDiscard: oe,
|
|
202
204
|
onSaveDraft: G,
|
|
203
205
|
disableSaveDraft: !s.name.trim(),
|
|
204
206
|
isSaving: b || y
|
|
205
207
|
}
|
|
206
208
|
),
|
|
207
|
-
/* @__PURE__ */ o(
|
|
209
|
+
/* @__PURE__ */ o(be, {})
|
|
208
210
|
] })
|
|
209
211
|
}
|
|
210
212
|
);
|
|
211
213
|
};
|
|
212
|
-
|
|
214
|
+
Ie.displayName = "AgentBuilder";
|
|
213
215
|
export {
|
|
214
|
-
|
|
216
|
+
Ie as AgentBuilder
|
|
215
217
|
};
|
|
216
218
|
//# 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 {\n\tAgentBuilderProps,\n\tAgentValue,\n\tSubAgentDraft,\n} from './AgentBuilder.model';\nimport {\n\tBuilderRoot,\n\tContent,\n\tContentCard,\n\tMain,\n\tRail,\n\tStepScroll,\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\tonImproveToolInstructions,\n\t\tonConnectIntegration,\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\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\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 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\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\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\tonImproveToolInstructions={onImproveToolInstructions}\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\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\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<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\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<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\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\tdisableSaveDraft={!value.name.trim()}\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","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","wasSuccess","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,MAAMA,KAAwB,MAAM;AACnC,QAAM,EAAE,YAAAC,EAAA,IAAeC,GAAA;AACvB,UAAQD,GAAA;AAAA,IACP,KAAK;AACJ,+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IAAsB;AAAA,YACzD,cAAc7B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAAyB;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACrC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUU,KAAYa;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA9E,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\tStepScroll,\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\tonImproveToolInstructions,\n\t\tonConnectIntegration,\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\tconfigToolTemplates,\n\t\tintegrationStatus,\n\t\tvariablesData,\n\t\tvalidation,\n\t\tapplicationType,\n\t\tcharLimits,\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 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\tconfigToolTemplates={configToolTemplates}\n\t\t\tintegrationStatus={integrationStatus}\n\t\t\tonConnectIntegration={onConnectIntegration}\n\t\t\tvariablesData={variablesData}\n\t\t\tvalidation={validation}\n\t\t\tapplicationType={applicationType}\n\t\t\tcharLimits={charLimits}\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\tonImproveToolInstructions={onImproveToolInstructions}\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\tonSaveDraft={handleSaveDraftAndLeave}\n\t\t\t\t\tisSaving={isSaving || savingAndLeaving}\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<StepScroll>\n\t\t\t\t\t\t\t\t\t<StepContent />\n\t\t\t\t\t\t\t\t</StepScroll>\n\t\t\t\t\t\t\t\t<AgentBuilderFooter\n\t\t\t\t\t\t\t\t\tfooterHint={footerHint}\n\t\t\t\t\t\t\t\t\tonTestAgent={onTestAgent ? handleTestAgent : undefined}\n\t\t\t\t\t\t\t\t\tonGoLive={() => {\n\t\t\t\t\t\t\t\t\t\tlogAction('onGoLive');\n\t\t\t\t\t\t\t\t\t\tsetModalMode('confirm');\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tisPublishing={isPublishing || publishingLocal}\n\t\t\t\t\t\t\t\t/>\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<GoLiveModal\n\t\t\t\t\tmode={modalMode}\n\t\t\t\t\tonClose={() => {\n\t\t\t\t\t\tconst wasSuccess = modalMode === 'success';\n\t\t\t\t\t\tsetModalMode(null);\n\t\t\t\t\t\tif (wasSuccess) {\n\t\t\t\t\t\t\thandleGoToDashboard();\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\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\tdisableSaveDraft={!value.name.trim()}\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","onImproveToolInstructions","onConnectIntegration","rest","value","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","variablesData","validation","applicationType","charLimits","isSaving","isPublishing","isLoading","footerHint","disableStepNavigation","debugLog","modalMode","setModalMode","useState","publishingLocal","setPublishingLocal","showLeaveConfirm","setShowLeaveConfirm","savingAndLeaving","setSavingAndLeaving","logAction","useCallback","action","args","handleChange","patch","handleStepChange","step","handleSaveDraft","handlePublish","handleBack","handleDiscardAndLeave","handleSaveDraftAndLeave","result","handleTestAgent","handleGoToDashboard","handleCreateSubAgent","draft","handleConfirmGoLive","jsx","AgentBuilderProvider","BuilderRoot","AgentBuilderTopBar","Main","Rail","StepRail","Content","Spinner","COLORS","ContentCard","StepScroll","AgentBuilderFooter","GoLiveModal","wasSuccess","DiscardModal","UndoToast"],"mappings":";;;;;;;;;;;;;;;;AA+BA,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,2BAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,IACAhB,GACE;AAAA,IACL,OAAAiB;AAAA,IACA,YAAAxB;AAAA,IACA,gBAAAyB;AAAA,IACA,oBAAAC;AAAA,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AX,EAACtE,IAAA,CAAA,CAAY,GACd;AAAA,YACA,gBAAAsE;AAAA,cAACY;AAAA,cAAA;AAAA,gBACA,YAAA3C;AAAA,gBACA,aAAavB,IAAciD,KAAkB;AAAA,gBAC7C,UAAU,MAAM;AACf,kBAAAd,EAAU,UAAU,GACpBR,EAAa,SAAS;AAAA,gBACvB;AAAA,gBACA,cAAcN,KAAgBQ;AAAA,cAAA;AAAA,YAAA;AAAA,UAC/B,EAAA,CACD,EAAA,CAEF;AAAA,QAAA,GACD;AAAA,QAEA,gBAAAyB;AAAA,UAACa;AAAA,UAAA;AAAA,YACA,MAAMzC;AAAA,YACN,SAAS,MAAM;AACd,oBAAM0C,IAAa1C,MAAc;AACjC,cAAAC,EAAa,IAAI,GACbyC,KACHlB,EAAA;AAAA,YAEF;AAAA,YACA,WAAWG;AAAA,YACX,aAAa,MAAM;AAClB,cAAA1B,EAAa,IAAI,GACjBgB,EAAA;AAAA,YACD;AAAA,YACA,iBAAiB1C,IAAkBiD,IAAsB;AAAA,YACzD,cAAc7B,KAAgBQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAG/B,gBAAAyB;AAAA,UAACe;AAAA,UAAA;AAAA,YACA,MAAMtC;AAAA,YACN,SAAS,MAAMC,EAAoB,EAAK;AAAA,YACxC,WAAWc;AAAA,YACX,aAAaC;AAAA,YACb,kBAAkB,CAACtC,EAAM,KAAK,KAAA;AAAA,YAC9B,UAAUW,KAAYa;AAAA,UAAA;AAAA,QAAA;AAAA,0BAGtBqC,IAAA,CAAA,CAAU;AAAA,MAAA,EAAA,CACZ;AAAA,IAAA;AAAA,EAAA;AAGH;AAEA/E,GAAa,cAAc;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AgentConfig, AgentHandoverConfig, AgentToolDoc, IntentOption, ModelOption, StepKey, StepValidation, SubAgentRef, Trigger } from '@bikdotai/bik-models/ai-agents';
|
|
2
2
|
import { ApplicationType } from '@bikdotai/bik-models/growth';
|
|
3
|
+
import { VariableListInterfaceV3 } from '../variable-picker-v3/model';
|
|
3
4
|
import { AgentCharLimits } from './constants/charLimits';
|
|
4
5
|
import { ConfigToolKey, ToolSource } from './constants/tools';
|
|
5
6
|
/**
|
|
@@ -232,6 +233,13 @@ export interface AgentBuilderConfig {
|
|
|
232
233
|
* {@link AgentBuilderProps.onConnectIntegration}.
|
|
233
234
|
*/
|
|
234
235
|
integrationStatus?: Partial<Record<ToolSource, boolean>>;
|
|
236
|
+
/**
|
|
237
|
+
* Variable catalog for the `@` picker's "Variables" view (the shared
|
|
238
|
+
* VariablePicker's `data` shape). Picking a variable inserts its
|
|
239
|
+
* `{{actualValue}}` token into the instructions / guardrails at the cursor.
|
|
240
|
+
* Omit (or pass empty) to hide the Variables category entirely.
|
|
241
|
+
*/
|
|
242
|
+
variablesData?: VariableListInterfaceV3[];
|
|
235
243
|
/** Host application context the merchant runs in (e.g. ApplicationType.MANIFEST). */
|
|
236
244
|
applicationType?: ApplicationType;
|
|
237
245
|
/** Optional consumer-supplied validity; merged over the builder's derived validity. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
+
import { VariableListInterfaceV3 } from '../../variable-picker-v3/model';
|
|
2
3
|
import { ConfigToolConfig, ConfigToolKey, ParamsBlob } from '../AgentBuilder.model';
|
|
3
4
|
import { AgentCharLimits } from '../constants/charLimits';
|
|
4
5
|
interface ConfigToolPanelProps {
|
|
@@ -18,6 +19,13 @@ interface ConfigToolPanelProps {
|
|
|
18
19
|
/** Optional "Improve with AI" for multiline fields. Omit to hide it. */
|
|
19
20
|
onImprove?: (text: string) => Promise<string>;
|
|
20
21
|
charLimits?: AgentCharLimits;
|
|
22
|
+
/**
|
|
23
|
+
* Variable catalog for the `@` trigger. When non-empty, `@` in the email
|
|
24
|
+
* tool's Subject / Send To / Reply To / CC opens the variable picker
|
|
25
|
+
* directly, and Message Instructions upgrades to the variables-only mention
|
|
26
|
+
* editor. Absent → the drawer behaves exactly as before.
|
|
27
|
+
*/
|
|
28
|
+
variablesData?: VariableListInterfaceV3[];
|
|
21
29
|
/** SideModal stacking order — raise it when opened over another drawer. */
|
|
22
30
|
zIndex?: number;
|
|
23
31
|
}
|