@bikdotai/bik-component-library 0.0.866 → 0.0.867
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/agent-builder/AgentBuilder.js +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js +151 -29
- package/dist/cjs/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js +2 -0
- package/dist/cjs/components/agent-builder/components/ChannelSelectModal.js.map +1 -0
- package/dist/cjs/components/agent-builder/components/ChannelsSection.js +2 -0
- package/dist/cjs/components/agent-builder/components/ChannelsSection.js.map +1 -0
- 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/GoLiveModal.js +1 -1
- package/dist/cjs/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/MentionEditor.js +2 -2
- 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 +13 -13
- package/dist/cjs/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js +3 -3
- package/dist/cjs/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/cjs/components/agent-builder/constants/channels.js +2 -0
- package/dist/cjs/components/agent-builder/constants/channels.js.map +1 -0
- package/dist/cjs/components/agent-builder/constants/steps.js +1 -1
- package/dist/cjs/components/agent-builder/constants/steps.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/Step1About.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step1About.js.map +1 -1
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.js +2 -2
- package/dist/cjs/components/agent-builder/steps/Step2WhenItStepsIn.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/steps/Step4HandoverRules.js +1 -1
- package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js +2 -2
- package/dist/cjs/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js +1 -1
- package/dist/cjs/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/cjs/icons/Social/Channels/ManifestGlass.js +2 -0
- package/dist/cjs/icons/Social/Channels/ManifestGlass.js.map +1 -0
- package/dist/cjs/icons/Social/Channels/ShipStation.js +2 -0
- package/dist/cjs/icons/Social/Channels/ShipStation.js.map +1 -0
- package/dist/cjs/icons/Social/Channels/Skio.js +2 -0
- package/dist/cjs/icons/Social/Channels/Skio.js.map +1 -0
- package/dist/cjs/icons/index.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.js +103 -97
- package/dist/esm/components/agent-builder/AgentBuilder.js.map +1 -1
- package/dist/esm/components/agent-builder/AgentBuilder.model.d.ts +76 -0
- package/dist/esm/components/agent-builder/AgentBuilder.styled.d.ts +68 -0
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js +224 -59
- package/dist/esm/components/agent-builder/AgentBuilder.styled.js.map +1 -1
- package/dist/esm/components/agent-builder/components/ChannelSelectModal.d.ts +26 -0
- package/dist/esm/components/agent-builder/components/ChannelSelectModal.js +121 -0
- package/dist/esm/components/agent-builder/components/ChannelSelectModal.js.map +1 -0
- package/dist/esm/components/agent-builder/components/ChannelsSection.d.ts +10 -0
- package/dist/esm/components/agent-builder/components/ChannelsSection.js +183 -0
- package/dist/esm/components/agent-builder/components/ChannelsSection.js.map +1 -0
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js +135 -132
- package/dist/esm/components/agent-builder/components/CreateSubAgentPanel.js.map +1 -1
- package/dist/esm/components/agent-builder/components/GoLiveModal.js +12 -12
- package/dist/esm/components/agent-builder/components/GoLiveModal.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionEditor.d.ts +2 -0
- package/dist/esm/components/agent-builder/components/MentionEditor.js +47 -45
- package/dist/esm/components/agent-builder/components/MentionEditor.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionField.js +52 -51
- package/dist/esm/components/agent-builder/components/MentionField.js.map +1 -1
- package/dist/esm/components/agent-builder/components/MentionPicker.d.ts +5 -0
- package/dist/esm/components/agent-builder/components/MentionPicker.js +134 -132
- package/dist/esm/components/agent-builder/components/MentionPicker.js.map +1 -1
- package/dist/esm/components/agent-builder/components/SelectableListSection.d.ts +2 -0
- package/dist/esm/components/agent-builder/components/SelectableListSection.js +48 -46
- package/dist/esm/components/agent-builder/components/SelectableListSection.js.map +1 -1
- package/dist/esm/components/agent-builder/constants/channels.d.ts +56 -0
- package/dist/esm/components/agent-builder/constants/channels.js +41 -0
- package/dist/esm/components/agent-builder/constants/channels.js.map +1 -0
- package/dist/esm/components/agent-builder/constants/steps.d.ts +31 -1
- package/dist/esm/components/agent-builder/constants/steps.js +15 -6
- package/dist/esm/components/agent-builder/constants/steps.js.map +1 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.d.ts +13 -1
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js +157 -148
- package/dist/esm/components/agent-builder/context/AgentBuilderContext.js.map +1 -1
- package/dist/esm/components/agent-builder/index.d.ts +5 -2
- package/dist/esm/components/agent-builder/steps/Step1About.js +15 -13
- package/dist/esm/components/agent-builder/steps/Step1About.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js +55 -48
- package/dist/esm/components/agent-builder/steps/Step2WhenItStepsIn.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js +158 -157
- package/dist/esm/components/agent-builder/steps/Step3HowItResponds.js.map +1 -1
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.d.ts +11 -0
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +127 -23
- package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/mentionSerialization.d.ts +10 -3
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js +31 -23
- package/dist/esm/components/agent-builder/utils/mentionSerialization.js.map +1 -1
- package/dist/esm/components/agent-builder/utils/sourceIcons.d.ts +7 -5
- package/dist/esm/components/agent-builder/utils/sourceIcons.js +26 -26
- package/dist/esm/components/agent-builder/utils/sourceIcons.js.map +1 -1
- package/dist/esm/icons/Social/Channels/ManifestGlass.d.ts +6 -0
- package/dist/esm/icons/Social/Channels/ManifestGlass.js +252 -0
- package/dist/esm/icons/Social/Channels/ManifestGlass.js.map +1 -0
- package/dist/esm/icons/Social/Channels/ShipStation.d.ts +6 -0
- package/dist/esm/icons/Social/Channels/ShipStation.js +31 -0
- package/dist/esm/icons/Social/Channels/ShipStation.js.map +1 -0
- package/dist/esm/icons/Social/Channels/Skio.d.ts +6 -0
- package/dist/{cjs/assets/icons/Skio.svg.js → esm/icons/Social/Channels/Skio.js} +31 -2
- package/dist/esm/icons/Social/Channels/Skio.js.map +1 -0
- package/dist/esm/icons/Social/Channels/index.d.ts +3 -0
- package/dist/esm/icons/index.d.ts +25 -25
- package/dist/esm/icons/index.js +330 -324
- package/dist/esm/icons/index.js.map +1 -1
- package/dist/esm/index.js +671 -663
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/assets/icons/BigCommerce.svg.js +0 -2
- package/dist/cjs/assets/icons/BigCommerce.svg.js.map +0 -1
- package/dist/cjs/assets/icons/Gorgias.svg.js +0 -2
- package/dist/cjs/assets/icons/Gorgias.svg.js.map +0 -1
- package/dist/cjs/assets/icons/ManifestGlass.svg.js +0 -2
- package/dist/cjs/assets/icons/ManifestGlass.svg.js.map +0 -1
- package/dist/cjs/assets/icons/ShipStation.svg.js +0 -2
- package/dist/cjs/assets/icons/ShipStation.svg.js.map +0 -1
- package/dist/cjs/assets/icons/Shopify.svg.js +0 -2
- package/dist/cjs/assets/icons/Shopify.svg.js.map +0 -1
- package/dist/cjs/assets/icons/Skio.svg.js.map +0 -1
- package/dist/esm/assets/icons/BigCommerce.svg.js +0 -6
- package/dist/esm/assets/icons/BigCommerce.svg.js.map +0 -1
- package/dist/esm/assets/icons/Gorgias.svg.js +0 -6
- package/dist/esm/assets/icons/Gorgias.svg.js.map +0 -1
- package/dist/esm/assets/icons/ManifestGlass.svg.js +0 -6
- package/dist/esm/assets/icons/ManifestGlass.svg.js.map +0 -1
- package/dist/esm/assets/icons/ShipStation.svg.js +0 -6
- package/dist/esm/assets/icons/ShipStation.svg.js.map +0 -1
- package/dist/esm/assets/icons/Shopify.svg.js +0 -6
- package/dist/esm/assets/icons/Shopify.svg.js.map +0 -1
- package/dist/esm/assets/icons/Skio.svg.js +0 -6
- package/dist/esm/assets/icons/Skio.svg.js.map +0 -1
|
@@ -1,117 +1,120 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import { AGENT_CHAR_LIMITS as
|
|
4
|
-
import { getStepIndex as
|
|
5
|
-
const
|
|
6
|
-
const t =
|
|
1
|
+
import { jsx as At } from "react/jsx-runtime";
|
|
2
|
+
import _t, { useState as S, useRef as d, useCallback as n, useMemo as B, useContext as Mt } from "react";
|
|
3
|
+
import { AGENT_CHAR_LIMITS as Ft } from "../constants/charLimits.js";
|
|
4
|
+
import { getStepIndex as St, STEP_KEYS as f } from "../constants/steps.js";
|
|
5
|
+
const lt = _t.createContext(null), Lt = () => {
|
|
6
|
+
const t = Mt(lt);
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(
|
|
9
9
|
"useAgentBuilderContext must be used within an AgentBuilderProvider"
|
|
10
10
|
);
|
|
11
11
|
return t;
|
|
12
|
-
},
|
|
13
|
-
const
|
|
12
|
+
}, Bt = (t, e) => {
|
|
13
|
+
const l = t.trigger.mode === "custom_intent" ? (t.trigger.custom_intent ?? "").trim().length > 0 : t.trigger.intents.length > 0;
|
|
14
14
|
return {
|
|
15
|
-
about: t.name.trim().length > 0 && t.name.length <=
|
|
16
|
-
trigger:
|
|
15
|
+
about: t.name.trim().length > 0 && t.name.length <= e.name && t.description.length <= e.description,
|
|
16
|
+
trigger: l,
|
|
17
17
|
// At least one of Instructions / Guardrails must be filled.
|
|
18
18
|
response: t.instructions.trim().length > 0 || (t.guardrail ?? "").trim().length > 0,
|
|
19
19
|
// Optional until specced further — never blocks go-live.
|
|
20
20
|
handover: !0
|
|
21
21
|
};
|
|
22
|
-
},
|
|
22
|
+
}, Pt = (t) => t.mode === "custom_intent" ? { ...t, intents: [] } : { ...t, custom_intent: "" }, Vt = ({
|
|
23
23
|
value: t,
|
|
24
|
-
onChange:
|
|
25
|
-
activeStep:
|
|
24
|
+
onChange: e,
|
|
25
|
+
activeStep: l,
|
|
26
26
|
onStepChange: P,
|
|
27
27
|
availableTools: R,
|
|
28
28
|
availableSubAgents: T,
|
|
29
29
|
availableIntents: E,
|
|
30
30
|
availableModels: $,
|
|
31
|
-
configToolTemplates:
|
|
32
|
-
integrationStatus:
|
|
33
|
-
onConnectIntegration:
|
|
34
|
-
variablesData:
|
|
35
|
-
validation:
|
|
36
|
-
applicationType:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
configToolTemplates: w,
|
|
32
|
+
integrationStatus: I,
|
|
33
|
+
onConnectIntegration: L,
|
|
34
|
+
variablesData: V,
|
|
35
|
+
validation: j,
|
|
36
|
+
applicationType: q,
|
|
37
|
+
availableChannels: y,
|
|
38
|
+
onManageChannels: H,
|
|
39
|
+
onSmartAgentHandover: K,
|
|
40
|
+
charLimits: h,
|
|
41
|
+
disableStepNavigation: G = !0,
|
|
42
|
+
onCreateSubAgent: N,
|
|
43
|
+
onFetchSubAgent: U,
|
|
44
|
+
onUpdateSubAgent: Y,
|
|
45
|
+
onImproveSubAgent: b,
|
|
46
|
+
onImproveToolInstructions: z,
|
|
47
|
+
children: xt
|
|
45
48
|
}) => {
|
|
46
|
-
const [
|
|
47
|
-
|
|
48
|
-
const [
|
|
49
|
-
(
|
|
50
|
-
|
|
49
|
+
const [pt, Rt] = S("about"), g = l ?? pt, c = St(g), J = d(t);
|
|
50
|
+
J.current = t;
|
|
51
|
+
const [Q, W] = S(0), M = d({}), X = d("instructions"), Z = n(
|
|
52
|
+
(s, o) => {
|
|
53
|
+
o ? M.current[s] = o : delete M.current[s];
|
|
51
54
|
},
|
|
52
55
|
[]
|
|
53
|
-
),
|
|
54
|
-
|
|
55
|
-
}, []),
|
|
56
|
-
|
|
57
|
-
}, []),
|
|
58
|
-
|
|
59
|
-
}, []),
|
|
56
|
+
), k = n((s) => {
|
|
57
|
+
X.current = s;
|
|
58
|
+
}, []), D = d(null), O = n((s) => {
|
|
59
|
+
D.current = s;
|
|
60
|
+
}, []), C = n(() => {
|
|
61
|
+
D.current?.();
|
|
62
|
+
}, []), a = d(
|
|
60
63
|
null
|
|
61
|
-
),
|
|
62
|
-
(
|
|
63
|
-
|
|
64
|
+
), v = n(
|
|
65
|
+
(s) => {
|
|
66
|
+
a.current = s;
|
|
64
67
|
},
|
|
65
68
|
[]
|
|
66
|
-
),
|
|
67
|
-
|
|
68
|
-
}, []),
|
|
69
|
-
(
|
|
69
|
+
), tt = n((s) => {
|
|
70
|
+
a.current?.(s);
|
|
71
|
+
}, []), st = n(
|
|
72
|
+
(s, o, i, p) => {
|
|
70
73
|
const u = M.current;
|
|
71
|
-
(u[
|
|
74
|
+
(u[X.current] ?? u.instructions)?.(s, o, i, p);
|
|
72
75
|
},
|
|
73
76
|
[]
|
|
74
|
-
), [
|
|
75
|
-
() => ({ ...
|
|
76
|
-
[
|
|
77
|
+
), [ot, F] = S(null), A = d(null), rt = d(0), _ = B(
|
|
78
|
+
() => ({ ...Ft, ...h }),
|
|
79
|
+
[h]
|
|
77
80
|
), x = B(
|
|
78
|
-
() => ({ ...
|
|
79
|
-
[t, _,
|
|
80
|
-
),
|
|
81
|
-
(
|
|
82
|
-
const
|
|
83
|
-
|
|
81
|
+
() => ({ ...Bt(t, _), ...j }),
|
|
82
|
+
[t, _, j]
|
|
83
|
+
), m = n(
|
|
84
|
+
(s) => {
|
|
85
|
+
const o = f.indexOf(s);
|
|
86
|
+
o > c && f.slice(0, o).some((i) => !x[i]) || (g === "trigger" && s !== "trigger" && e({ trigger: Pt(t.trigger) }), l === void 0 && Rt(s), P?.(s));
|
|
84
87
|
},
|
|
85
88
|
[
|
|
86
|
-
|
|
89
|
+
l,
|
|
87
90
|
P,
|
|
88
91
|
c,
|
|
89
92
|
x,
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
g,
|
|
94
|
+
e,
|
|
92
95
|
t.trigger
|
|
93
96
|
]
|
|
94
|
-
),
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
}, [c,
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
}, [c,
|
|
101
|
-
(
|
|
102
|
-
[
|
|
103
|
-
),
|
|
104
|
-
(
|
|
105
|
-
[
|
|
106
|
-
),
|
|
107
|
-
(
|
|
108
|
-
const i =
|
|
109
|
-
|
|
97
|
+
), et = n(() => {
|
|
98
|
+
const s = f[Math.min(c + 1, f.length - 1)];
|
|
99
|
+
m(s);
|
|
100
|
+
}, [c, m]), nt = n(() => {
|
|
101
|
+
const s = f[Math.max(c - 1, 0)];
|
|
102
|
+
m(s);
|
|
103
|
+
}, [c, m]), it = n(
|
|
104
|
+
(s) => e(s),
|
|
105
|
+
[e]
|
|
106
|
+
), ct = n(
|
|
107
|
+
(s, o) => e({ [s]: o }),
|
|
108
|
+
[e]
|
|
109
|
+
), ut = n(
|
|
110
|
+
(s, o) => {
|
|
111
|
+
const i = J.current;
|
|
112
|
+
s === "tool" ? !((i.configTools ?? []).some((u) => u.id === o) || (i.restApiTools ?? []).some((u) => u.id === o)) && !i.tools.includes(o) && e({ tools: [...i.tools, o] }) : i.subagents.includes(o) || e({ subagents: [...i.subagents, o] });
|
|
110
113
|
},
|
|
111
|
-
[
|
|
112
|
-
),
|
|
113
|
-
(
|
|
114
|
-
const i =
|
|
114
|
+
[e]
|
|
115
|
+
), dt = n(
|
|
116
|
+
(s, o) => {
|
|
117
|
+
const i = s === "tool" ? `{{tool:${o}}}` : `{{subagent:${o}}}`, p = (r) => r.split(i).join("");
|
|
115
118
|
A.current = {
|
|
116
119
|
tools: t.tools,
|
|
117
120
|
subagents: t.subagents,
|
|
@@ -123,115 +126,121 @@ const dt = Rt.createContext(null), $t = () => {
|
|
|
123
126
|
const u = {
|
|
124
127
|
instructions: p(t.instructions),
|
|
125
128
|
guardrail: p(t.guardrail ?? ""),
|
|
126
|
-
...
|
|
129
|
+
...s === "tool" ? {
|
|
127
130
|
// A tool id may be a catalog tool OR an inline custom tool — drop
|
|
128
131
|
// it from whichever list holds it (the others are no-op filters).
|
|
129
|
-
tools: t.tools.filter((
|
|
130
|
-
configTools: (t.configTools ?? []).filter((
|
|
132
|
+
tools: t.tools.filter((r) => r !== o),
|
|
133
|
+
configTools: (t.configTools ?? []).filter((r) => r.id !== o),
|
|
131
134
|
restApiTools: (t.restApiTools ?? []).filter(
|
|
132
|
-
(
|
|
135
|
+
(r) => r.id !== o
|
|
133
136
|
)
|
|
134
|
-
} : { subagents: t.subagents.filter((
|
|
137
|
+
} : { subagents: t.subagents.filter((r) => r !== o) }
|
|
135
138
|
};
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
|
|
139
|
-
id:
|
|
140
|
-
message: `${
|
|
139
|
+
e(u), W((r) => r + 1);
|
|
140
|
+
const ft = s === "tool" ? R.find((r) => r.tool_id === o)?.display_name ?? (t.restApiTools ?? []).find((r) => r.id === o)?.name ?? "Tool" : T.find((r) => r.id === o)?.name ?? "Sub-agent";
|
|
141
|
+
rt.current += 1, F({
|
|
142
|
+
id: rt.current,
|
|
143
|
+
message: `${s === "tool" ? "Tool" : "Sub-agent"} "${ft}" removed`
|
|
141
144
|
});
|
|
142
145
|
},
|
|
143
|
-
[R, T, t,
|
|
144
|
-
),
|
|
145
|
-
A.current && (
|
|
146
|
-
}, [
|
|
146
|
+
[R, T, t, e]
|
|
147
|
+
), gt = n(() => {
|
|
148
|
+
A.current && (e(A.current), A.current = null, W((s) => s + 1)), F(null);
|
|
149
|
+
}, [e]), mt = n(() => F(null), []), Tt = B(
|
|
147
150
|
() => ({
|
|
148
151
|
value: t,
|
|
149
|
-
patch:
|
|
150
|
-
updateField:
|
|
151
|
-
addReference:
|
|
152
|
-
removeReference:
|
|
153
|
-
mentionResetKey:
|
|
154
|
-
insertMention:
|
|
155
|
-
registerMentionField:
|
|
156
|
-
notifyMentionFocus:
|
|
157
|
-
undoToast:
|
|
158
|
-
undoRemoval:
|
|
159
|
-
dismissUndo:
|
|
160
|
-
activeStep:
|
|
152
|
+
patch: it,
|
|
153
|
+
updateField: ct,
|
|
154
|
+
addReference: ut,
|
|
155
|
+
removeReference: dt,
|
|
156
|
+
mentionResetKey: Q,
|
|
157
|
+
insertMention: st,
|
|
158
|
+
registerMentionField: Z,
|
|
159
|
+
notifyMentionFocus: k,
|
|
160
|
+
undoToast: ot,
|
|
161
|
+
undoRemoval: gt,
|
|
162
|
+
dismissUndo: mt,
|
|
163
|
+
activeStep: g,
|
|
161
164
|
activeIndex: c,
|
|
162
|
-
goToStep:
|
|
163
|
-
goNext:
|
|
164
|
-
goPrev:
|
|
165
|
+
goToStep: m,
|
|
166
|
+
goNext: et,
|
|
167
|
+
goPrev: nt,
|
|
165
168
|
isFirstStep: c === 0,
|
|
166
|
-
isLastStep: c ===
|
|
169
|
+
isLastStep: c === f.length - 1,
|
|
167
170
|
validation: x,
|
|
168
|
-
isActiveStepValid: x[
|
|
171
|
+
isActiveStepValid: x[g],
|
|
169
172
|
availableTools: R,
|
|
170
173
|
availableSubAgents: T,
|
|
171
174
|
availableIntents: E,
|
|
172
175
|
availableModels: $,
|
|
173
|
-
configToolTemplates:
|
|
174
|
-
integrationStatus:
|
|
175
|
-
onConnectIntegration:
|
|
176
|
-
variablesData:
|
|
177
|
-
applicationType:
|
|
176
|
+
configToolTemplates: w,
|
|
177
|
+
integrationStatus: I,
|
|
178
|
+
onConnectIntegration: L,
|
|
179
|
+
variablesData: V,
|
|
180
|
+
applicationType: q,
|
|
181
|
+
availableChannels: y,
|
|
182
|
+
onManageChannels: H,
|
|
183
|
+
onSmartAgentHandover: K,
|
|
178
184
|
charLimits: _,
|
|
179
|
-
disableStepNavigation:
|
|
180
|
-
onCreateSubAgent:
|
|
181
|
-
registerSubAgentCreator:
|
|
182
|
-
requestCreateSubAgent:
|
|
183
|
-
registerToolActionHandler:
|
|
184
|
-
requestToolAction:
|
|
185
|
-
onFetchSubAgent:
|
|
186
|
-
onUpdateSubAgent:
|
|
187
|
-
onImproveSubAgent:
|
|
188
|
-
onImproveToolInstructions:
|
|
185
|
+
disableStepNavigation: G,
|
|
186
|
+
onCreateSubAgent: N,
|
|
187
|
+
registerSubAgentCreator: O,
|
|
188
|
+
requestCreateSubAgent: C,
|
|
189
|
+
registerToolActionHandler: v,
|
|
190
|
+
requestToolAction: tt,
|
|
191
|
+
onFetchSubAgent: U,
|
|
192
|
+
onUpdateSubAgent: Y,
|
|
193
|
+
onImproveSubAgent: b,
|
|
194
|
+
onImproveToolInstructions: z
|
|
189
195
|
}),
|
|
190
196
|
[
|
|
191
197
|
t,
|
|
192
|
-
et,
|
|
193
|
-
nt,
|
|
194
|
-
rt,
|
|
195
198
|
it,
|
|
196
|
-
Y,
|
|
197
|
-
a,
|
|
198
|
-
Q,
|
|
199
|
-
W,
|
|
200
|
-
v,
|
|
201
199
|
ct,
|
|
202
200
|
ut,
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
l,
|
|
206
|
-
ot,
|
|
201
|
+
dt,
|
|
202
|
+
Q,
|
|
207
203
|
st,
|
|
204
|
+
Z,
|
|
205
|
+
k,
|
|
206
|
+
ot,
|
|
207
|
+
gt,
|
|
208
|
+
mt,
|
|
209
|
+
g,
|
|
210
|
+
c,
|
|
211
|
+
m,
|
|
212
|
+
et,
|
|
213
|
+
nt,
|
|
208
214
|
x,
|
|
209
215
|
R,
|
|
210
216
|
T,
|
|
211
217
|
E,
|
|
212
218
|
$,
|
|
213
|
-
h,
|
|
214
219
|
w,
|
|
215
|
-
H,
|
|
216
220
|
I,
|
|
221
|
+
L,
|
|
217
222
|
V,
|
|
218
|
-
_,
|
|
219
223
|
q,
|
|
220
224
|
y,
|
|
221
|
-
|
|
222
|
-
|
|
225
|
+
H,
|
|
226
|
+
K,
|
|
227
|
+
_,
|
|
228
|
+
G,
|
|
229
|
+
N,
|
|
223
230
|
O,
|
|
224
231
|
C,
|
|
225
|
-
|
|
232
|
+
v,
|
|
233
|
+
tt,
|
|
234
|
+
U,
|
|
235
|
+
Y,
|
|
226
236
|
b,
|
|
227
|
-
|
|
228
|
-
N
|
|
237
|
+
z
|
|
229
238
|
]
|
|
230
239
|
);
|
|
231
|
-
return /* @__PURE__ */
|
|
240
|
+
return /* @__PURE__ */ At(lt.Provider, { value: Tt, children: xt });
|
|
232
241
|
};
|
|
233
242
|
export {
|
|
234
|
-
|
|
235
|
-
|
|
243
|
+
Vt as AgentBuilderProvider,
|
|
244
|
+
Lt as useAgentBuilderContext
|
|
236
245
|
};
|
|
237
246
|
//# sourceMappingURL=AgentBuilderContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AgentBuilderContext.js","sources":["../../../../../src/components/agent-builder/context/AgentBuilderContext.tsx"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tAgentTool,\n\tAgentValue,\n\tConfigToolKey,\n\tIntentOption,\n\tModelOption,\n\tParamsBlob,\n\tStepKey,\n\tStepValidation,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { getStepIndex, STEP_KEYS } from '../constants/steps';\nimport type { ToolSource } from '../constants/tools';\n\n/** Mention-capable text fields in Step 3 (both store firebase token text). */\nexport type MentionFieldKey = 'instructions' | 'guardrail';\ntype MentionInsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n\t/** Tool source, for the chip's leading icon. Pass it for a JUST-created custom\n\t * tool that isn't in the editor's mention list yet (else the chip has no icon\n\t * until reload); existing tools resolve it from the list. */\n\tsource?: string,\n) => void;\n\n/** Toast shown after a tool / sub-agent is removed, offering an undo. */\nexport interface UndoToastState {\n\t/** Bumped per removal so the toast timer restarts. */\n\tid: number;\n\tmessage: string;\n}\n\nexport interface AgentBuilderContextShape {\n\t/** Controlled value relayed from props. */\n\tvalue: AgentValue;\n\t/** Patch one or more fields. */\n\tpatch: (partial: Partial<AgentValue>) => void;\n\t/** Patch a single field. */\n\tupdateField: <K extends keyof AgentValue>(key: K, val: AgentValue[K]) => void;\n\t/**\n\t * Remove a tool / sub-agent everywhere: drops it from the list AND strips ALL\n\t * its `{{tool:KEY}}` / `{{subagent:ID}}` tokens from BOTH the instructions and\n\t * the guardrails, remounts the editors, and raises an undo toast.\n\t */\n\tremoveReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/**\n\t * Append a tool / sub-agent id to its list (deduped), reading the LATEST value\n\t * via a ref. Use this instead of `patch({ tools: [...value.tools, id] })` from\n\t * any handler that may be captured with a stale `value` — notably the `@`\n\t * editor's mount-time `onSelect`, which would otherwise keep only the last pick.\n\t */\n\taddReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/** Remount signal for the mention editors after an external edit. */\n\tmentionResetKey: number;\n\t/**\n\t * Insert a tool / sub-agent mention chip at the last cursor position of\n\t * whichever mention field was focused most recently (Instructions or\n\t * Guardrails). `label` overrides the chip text (e.g. a just-created sub-agent\n\t * not yet in the available list).\n\t */\n\tinsertMention: MentionInsertFn;\n\t/** A mention field registers its editor-backed insert here (internal). */\n\tregisterMentionField: (\n\t\tfieldKey: MentionFieldKey,\n\t\tfn: MentionInsertFn | null,\n\t) => void;\n\t/** A mention field reports focus so inserts target it (internal). */\n\tnotifyMentionFocus: (fieldKey: MentionFieldKey) => void;\n\n\t// Undo (post-removal)\n\t/** Non-null while the undo toast should be visible. */\n\tundoToast: UndoToastState | null;\n\t/** Restore the last removed tool / sub-agent (list + stripped tokens). */\n\tundoRemoval: () => void;\n\t/** Dismiss the undo toast without restoring. */\n\tdismissUndo: () => void;\n\n\t// Navigation\n\tactiveStep: StepKey;\n\tactiveIndex: number;\n\tgoToStep: (step: StepKey) => void;\n\tgoNext: () => void;\n\tgoPrev: () => void;\n\tisFirstStep: boolean;\n\tisLastStep: boolean;\n\n\t// Validation\n\tvalidation: StepValidation;\n\tisActiveStepValid: boolean;\n\n\t// Reference data\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\t/**\n\t * Backend templates for the shared-drawer tools (email / Slack), keyed by\n\t * `tool_key`. A present key drives its dynamic form + enables its tool action.\n\t */\n\tconfigToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;\n\t/**\n\t * Per-source integration connection state (today: Slack). A source mapped to\n\t * `false` renders a \"Connect\" row in the `@` picker instead of drilling in;\n\t * `true`/absent renders normally. Fed by the consumer via `integrationStatus`.\n\t */\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\t/** Open the consumer's connect flow for an unconnected integration source. */\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/**\n\t * Variable catalog for the `@` picker's \"Variables\" view. Absent / empty →\n\t * the category is hidden. Fed by the consumer via `variablesData`.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */\n\tapplicationType?: ApplicationType;\n\t/** Resolved per-field character limits (consumer overrides merged over defaults). */\n\tcharLimits: AgentCharLimits;\n\t/** When true, step-rail items are not clickable (Back / Next only). */\n\tdisableStepNavigation: boolean;\n\n\t// Sub-agent creation (Step 3 drawer)\n\t/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/**\n\t * Step 3 registers its \"open create-sub-agent drawer\" action here so the `@`\n\t * picker's \"Create new\" row can trigger it. Pass `null` to unregister.\n\t */\n\tregisterSubAgentCreator: (fn: (() => void) | null) => void;\n\t/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */\n\trequestCreateSubAgent: () => void;\n\t/**\n\t * Step 3 registers its \"open the drawer for this built-in tool action\"\n\t * (Rest API / email handover / Slack) handler here so the `@` reference picker\n\t * can trigger it. Pass `null` to unregister.\n\t */\n\tregisterToolActionHandler: (\n\t\tfn: ((source: ToolSource) => void) | null,\n\t) => void;\n\t/** Open a built-in tool action's drawer (no-op until Step 3 registers it). */\n\trequestToolAction: (source: ToolSource) => void;\n\t/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\t/** Persist edits to an existing sub-agent. */\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/** Optional \"Improve with AI\" for the drawer's instructions / guardrails. */\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\t/** Optional \"Improve with AI\" for the Rest API / email-handover tool drawers. */\n\tonImproveToolInstructions?: (text: string) => Promise<string>;\n}\n\nconst AgentBuilderContext =\n\tReact.createContext<AgentBuilderContextShape | null>(null);\n\nexport const useAgentBuilderContext = (): AgentBuilderContextShape => {\n\tconst ctx = useContext(AgentBuilderContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'useAgentBuilderContext must be used within an AgentBuilderProvider',\n\t\t);\n\t}\n\treturn ctx;\n};\n\n/** Validity derived purely from the current value (no effects). */\nconst deriveValidation = (\n\tvalue: AgentValue,\n\tlimits: AgentCharLimits,\n): StepValidation => {\n\tconst triggerValid =\n\t\tvalue.trigger.mode === 'custom_intent'\n\t\t\t? (value.trigger.custom_intent ?? '').trim().length > 0\n\t\t\t: value.trigger.intents.length > 0;\n\n\treturn {\n\t\tabout:\n\t\t\tvalue.name.trim().length > 0 &&\n\t\t\tvalue.name.length <= limits.name &&\n\t\t\tvalue.description.length <= limits.description,\n\t\ttrigger: triggerValid,\n\t\t// At least one of Instructions / Guardrails must be filled.\n\t\tresponse:\n\t\t\tvalue.instructions.trim().length > 0 ||\n\t\t\t(value.guardrail ?? '').trim().length > 0,\n\t\t// Optional until specced further — never blocks go-live.\n\t\thandover: true,\n\t};\n};\n\n/**\n * Step 2's two trigger modes are mutually exclusive, so the unselected one's data\n * is dropped — but only when the merchant LEAVES step 2, never the instant they\n * toggle the radio. Toggling to compare the two options and finding your intents\n * (or the sentence you typed) gone reads as the builder eating your work.\n */\nconst triggerForSelectedMode = (\n\ttrigger: AgentValue['trigger'],\n): AgentValue['trigger'] =>\n\ttrigger.mode === 'custom_intent'\n\t\t? { ...trigger, intents: [] }\n\t\t: { ...trigger, custom_intent: '' };\n\ninterface ProviderProps {\n\tvalue: AgentValue;\n\tonChange: (patch: Partial<AgentValue>) => void;\n\tactiveStep?: StepKey;\n\tonStepChange?: (step: StepKey) => void;\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\tconfigToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\tvariablesData?: VariableListInterfaceV3[];\n\tvalidation?: Partial<StepValidation>;\n\tapplicationType?: ApplicationType;\n\tcharLimits?: Partial<AgentCharLimits>;\n\tdisableStepNavigation?: boolean;\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\tonImproveToolInstructions?: (text: string) => Promise<string>;\n\tchildren: React.ReactNode;\n}\n\nexport const AgentBuilderProvider: React.FC<ProviderProps> = ({\n\tvalue,\n\tonChange,\n\tactiveStep: controlledStep,\n\tonStepChange,\n\tavailableTools,\n\tavailableSubAgents,\n\tavailableIntents,\n\tavailableModels,\n\tconfigToolTemplates,\n\tintegrationStatus,\n\tonConnectIntegration,\n\tvariablesData,\n\tvalidation: validationOverride,\n\tapplicationType,\n\tcharLimits: charLimitsOverride,\n\tdisableStepNavigation = true,\n\tonCreateSubAgent,\n\tonFetchSubAgent,\n\tonUpdateSubAgent,\n\tonImproveSubAgent,\n\tonImproveToolInstructions,\n\tchildren,\n}) => {\n\tconst [internalStep, setInternalStep] = useState<StepKey>('about');\n\tconst activeStep = controlledStep ?? internalStep;\n\tconst activeIndex = getStepIndex(activeStep);\n\n\t// Latest value, so closure-captured handlers (e.g. the `@` editor's mount-time\n\t// mention onSelect) append against the current lists, not a stale snapshot.\n\tconst valueRef = useRef(value);\n\tvalueRef.current = value;\n\n\t// Bumped when a mention field is edited from OUTSIDE its editor (removing a\n\t// tool from the side list, undo), forcing the mention editors to remount.\n\tconst [mentionResetKey, setMentionResetKey] = useState(0);\n\n\t// Each mention field registers an editor-backed insert fn + reports focus, so\n\t// side-panel adds drop a chip into the last-focused field at its cursor.\n\tconst mentionInsertersRef = useRef<\n\t\tPartial<Record<MentionFieldKey, MentionInsertFn>>\n\t>({});\n\tconst lastFocusedFieldRef = useRef<MentionFieldKey>('instructions');\n\tconst registerMentionField = useCallback(\n\t\t(fieldKey: MentionFieldKey, fn: MentionInsertFn | null) => {\n\t\t\tif (fn) {\n\t\t\t\tmentionInsertersRef.current[fieldKey] = fn;\n\t\t\t} else {\n\t\t\t\tdelete mentionInsertersRef.current[fieldKey];\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst notifyMentionFocus = useCallback((fieldKey: MentionFieldKey) => {\n\t\tlastFocusedFieldRef.current = fieldKey;\n\t}, []);\n\n\t// Step 3 registers its drawer opener here; the `@` picker's \"Create new\" calls it.\n\tconst subAgentCreatorRef = useRef<(() => void) | null>(null);\n\tconst registerSubAgentCreator = useCallback((fn: (() => void) | null) => {\n\t\tsubAgentCreatorRef.current = fn;\n\t}, []);\n\tconst requestCreateSubAgent = useCallback(() => {\n\t\tsubAgentCreatorRef.current?.();\n\t}, []);\n\n\t// Step 3 registers a dispatcher that opens a built-in tool action's drawer.\n\tconst toolActionHandlerRef = useRef<((source: ToolSource) => void) | null>(\n\t\tnull,\n\t);\n\tconst registerToolActionHandler = useCallback(\n\t\t(fn: ((source: ToolSource) => void) | null) => {\n\t\t\ttoolActionHandlerRef.current = fn;\n\t\t},\n\t\t[],\n\t);\n\tconst requestToolAction = useCallback((source: ToolSource) => {\n\t\ttoolActionHandlerRef.current?.(source);\n\t}, []);\n\tconst insertMention = useCallback<MentionInsertFn>(\n\t\t(kind, id, label, source) => {\n\t\t\tconst inserters = mentionInsertersRef.current;\n\t\t\tconst target =\n\t\t\t\tinserters[lastFocusedFieldRef.current] ?? inserters.instructions;\n\t\t\ttarget?.(kind, id, label, source);\n\t\t},\n\t\t[],\n\t);\n\n\t// Undo state for the most recent removal.\n\tconst [undoToast, setUndoToast] = useState<UndoToastState | null>(null);\n\tconst undoSnapshotRef = useRef<Partial<AgentValue> | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\t// Consumer overrides merged over the built-in defaults (name 60, rest 1000).\n\tconst charLimits = useMemo<AgentCharLimits>(\n\t\t() => ({ ...AGENT_CHAR_LIMITS, ...charLimitsOverride }),\n\t\t[charLimitsOverride],\n\t);\n\n\tconst validation: StepValidation = useMemo(\n\t\t() => ({ ...deriveValidation(value, charLimits), ...validationOverride }),\n\t\t[value, charLimits, validationOverride],\n\t);\n\n\tconst goToStep = useCallback(\n\t\t(step: StepKey) => {\n\t\t\t// Forward jumps (side rail) must not skip past an incomplete step —\n\t\t\t// otherwise an agent with an empty step 3 could reach step 4 and be\n\t\t\t// published. Going back is always allowed.\n\t\t\tconst targetIndex = STEP_KEYS.indexOf(step);\n\t\t\tif (\n\t\t\t\ttargetIndex > activeIndex &&\n\t\t\t\tSTEP_KEYS.slice(0, targetIndex).some((k) => !validation[k])\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Leaving step 2 is the point the mode choice becomes final (Next, or a\n\t\t\t// rail jump). Done here rather than in Step 2's radio so switching back and\n\t\t\t// forth keeps both — see `triggerForSelectedMode`.\n\t\t\tif (activeStep === 'trigger' && step !== 'trigger') {\n\t\t\t\tonChange({ trigger: triggerForSelectedMode(value.trigger) });\n\t\t\t}\n\t\t\tif (controlledStep === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[\n\t\t\tcontrolledStep,\n\t\t\tonStepChange,\n\t\t\tactiveIndex,\n\t\t\tvalidation,\n\t\t\tactiveStep,\n\t\t\tonChange,\n\t\t\tvalue.trigger,\n\t\t],\n\t);\n\n\tconst goNext = useCallback(() => {\n\t\tconst next = STEP_KEYS[Math.min(activeIndex + 1, STEP_KEYS.length - 1)];\n\t\tgoToStep(next);\n\t}, [activeIndex, goToStep]);\n\n\tconst goPrev = useCallback(() => {\n\t\tconst prev = STEP_KEYS[Math.max(activeIndex - 1, 0)];\n\t\tgoToStep(prev);\n\t}, [activeIndex, goToStep]);\n\n\tconst patch = useCallback(\n\t\t(partial: Partial<AgentValue>) => onChange(partial),\n\t\t[onChange],\n\t);\n\n\tconst updateField = useCallback(\n\t\t<K extends keyof AgentValue>(key: K, val: AgentValue[K]) =>\n\t\t\tonChange({ [key]: val } as Partial<AgentValue>),\n\t\t[onChange],\n\t);\n\n\tconst addReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tconst v = valueRef.current;\n\t\t\tif (kind === 'tool') {\n\t\t\t\t// Custom tools (Rest API / email / Slack) track themselves on their own\n\t\t\t\t// lists; only catalog/native ids belong in `tools`. Picking an EXISTING\n\t\t\t\t// custom tool from the `@` picker must not leak its id in here — on save\n\t\t\t\t// it becomes a bogus native ref and create-agent validation rejects it.\n\t\t\t\tconst isCustom =\n\t\t\t\t\t(v.configTools ?? []).some((t) => t.id === id) ||\n\t\t\t\t\t(v.restApiTools ?? []).some((t) => t.id === id);\n\t\t\t\tif (!isCustom && !v.tools.includes(id)) {\n\t\t\t\t\tonChange({ tools: [...v.tools, id] });\n\t\t\t\t}\n\t\t\t} else if (!v.subagents.includes(id)) {\n\t\t\t\tonChange({ subagents: [...v.subagents, id] });\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t);\n\n\tconst removeReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\t// Tokens store the id for both kinds (a tool's id is its tool_id).\n\t\t\tconst token = kind === 'tool' ? `{{tool:${id}}}` : `{{subagent:${id}}}`;\n\t\t\tconst strip = (text: string) => text.split(token).join('');\n\n\t\t\t// Snapshot every field a removal touches, for undo. Custom tools (Rest\n\t\t\t// API / email / Slack) live on their own lists, so include them too.\n\t\t\tundoSnapshotRef.current = {\n\t\t\t\ttools: value.tools,\n\t\t\t\tsubagents: value.subagents,\n\t\t\t\tconfigTools: value.configTools,\n\t\t\t\trestApiTools: value.restApiTools,\n\t\t\t\tinstructions: value.instructions,\n\t\t\t\tguardrail: value.guardrail,\n\t\t\t};\n\n\t\t\tconst next: Partial<AgentValue> = {\n\t\t\t\tinstructions: strip(value.instructions),\n\t\t\t\tguardrail: strip(value.guardrail ?? ''),\n\t\t\t\t...(kind === 'tool'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t// A tool id may be a catalog tool OR an inline custom tool — drop\n\t\t\t\t\t\t\t// it from whichever list holds it (the others are no-op filters).\n\t\t\t\t\t\t\ttools: value.tools.filter((t) => t !== id),\n\t\t\t\t\t\t\tconfigTools: (value.configTools ?? []).filter((t) => t.id !== id),\n\t\t\t\t\t\t\trestApiTools: (value.restApiTools ?? []).filter(\n\t\t\t\t\t\t\t\t(t) => t.id !== id,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t }\n\t\t\t\t\t: { subagents: value.subagents.filter((s) => s !== id) }),\n\t\t\t};\n\t\t\tonChange(next);\n\t\t\tsetMentionResetKey((k) => k + 1);\n\n\t\t\tconst label =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? availableTools.find((t) => t.tool_id === id)?.display_name ??\n\t\t\t\t\t (value.restApiTools ?? []).find((t) => t.id === id)?.name ??\n\t\t\t\t\t 'Tool'\n\t\t\t\t\t: availableSubAgents.find((s) => s.id === id)?.name ?? 'Sub-agent';\n\t\t\tundoIdRef.current += 1;\n\t\t\tsetUndoToast({\n\t\t\t\tid: undoIdRef.current,\n\t\t\t\tmessage: `${kind === 'tool' ? 'Tool' : 'Sub-agent'} \"${label}\" removed`,\n\t\t\t});\n\t\t},\n\t\t[availableTools, availableSubAgents, value, onChange],\n\t);\n\n\tconst undoRemoval = useCallback(() => {\n\t\tif (undoSnapshotRef.current) {\n\t\t\tonChange(undoSnapshotRef.current);\n\t\t\tundoSnapshotRef.current = null;\n\t\t\tsetMentionResetKey((k) => k + 1);\n\t\t}\n\t\tsetUndoToast(null);\n\t}, [onChange]);\n\n\tconst dismissUndo = useCallback(() => setUndoToast(null), []);\n\n\tconst ctx = useMemo<AgentBuilderContextShape>(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tisFirstStep: activeIndex === 0,\n\t\t\tisLastStep: activeIndex === STEP_KEYS.length - 1,\n\t\t\tvalidation,\n\t\t\tisActiveStepValid: validation[activeStep],\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t\tvariablesData,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tregisterToolActionHandler,\n\t\t\trequestToolAction,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t\tonImproveToolInstructions,\n\t\t}),\n\t\t[\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tvalidation,\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t\tvariablesData,\n\t\t\tapplicationType,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tregisterToolActionHandler,\n\t\t\trequestToolAction,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t\tonImproveToolInstructions,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AgentBuilderContext.Provider value={ctx}>\n\t\t\t{children}\n\t\t</AgentBuilderContext.Provider>\n\t);\n};\n"],"names":["AgentBuilderContext","React","useAgentBuilderContext","ctx","useContext","deriveValidation","value","limits","triggerValid","triggerForSelectedMode","trigger","AgentBuilderProvider","onChange","controlledStep","onStepChange","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","onConnectIntegration","variablesData","validationOverride","applicationType","charLimitsOverride","disableStepNavigation","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","children","internalStep","setInternalStep","useState","activeStep","activeIndex","getStepIndex","valueRef","useRef","mentionResetKey","setMentionResetKey","mentionInsertersRef","lastFocusedFieldRef","registerMentionField","useCallback","fieldKey","fn","notifyMentionFocus","subAgentCreatorRef","registerSubAgentCreator","requestCreateSubAgent","toolActionHandlerRef","registerToolActionHandler","requestToolAction","source","insertMention","kind","id","label","inserters","undoToast","setUndoToast","undoSnapshotRef","undoIdRef","charLimits","useMemo","AGENT_CHAR_LIMITS","validation","goToStep","step","targetIndex","STEP_KEYS","k","goNext","next","goPrev","prev","patch","partial","updateField","key","val","addReference","v","t","removeReference","token","strip","text","s","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AC;AAAA,MACAC;AAAA,IAAA;AAAA,EACD;AAGD,4BACE/B,GAAoB,UAApB,EAA6B,OAAOG,IACnC,UAAA6B,IACF;AAEF;"}
|
|
1
|
+
{"version":3,"file":"AgentBuilderContext.js","sources":["../../../../../src/components/agent-builder/context/AgentBuilderContext.tsx"],"sourcesContent":["import type { ApplicationType } from '@bikdotai/bik-models/growth';\nimport React, {\n\tuseCallback,\n\tuseContext,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tAgentChannel,\n\tAgentChannelType,\n\tAgentTool,\n\tAgentValue,\n\tConfigToolKey,\n\tIntentOption,\n\tModelOption,\n\tParamsBlob,\n\tStepKey,\n\tStepValidation,\n\tSubAgentDraft,\n\tSubAgentRef,\n} from '../AgentBuilder.model';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { getStepIndex, STEP_KEYS } from '../constants/steps';\nimport type { ToolSource } from '../constants/tools';\n\n/** Mention-capable text fields in Step 3 (both store firebase token text). */\nexport type MentionFieldKey = 'instructions' | 'guardrail';\ntype MentionInsertFn = (\n\tkind: 'tool' | 'subagent',\n\tid: string,\n\tlabel?: string,\n\t/** Tool source, for the chip's leading icon. Pass it for a JUST-created custom\n\t * tool that isn't in the editor's mention list yet (else the chip has no icon\n\t * until reload); existing tools resolve it from the list. */\n\tsource?: string,\n) => void;\n\n/** Toast shown after a tool / sub-agent is removed, offering an undo. */\nexport interface UndoToastState {\n\t/** Bumped per removal so the toast timer restarts. */\n\tid: number;\n\tmessage: string;\n}\n\nexport interface AgentBuilderContextShape {\n\t/** Controlled value relayed from props. */\n\tvalue: AgentValue;\n\t/** Patch one or more fields. */\n\tpatch: (partial: Partial<AgentValue>) => void;\n\t/** Patch a single field. */\n\tupdateField: <K extends keyof AgentValue>(key: K, val: AgentValue[K]) => void;\n\t/**\n\t * Remove a tool / sub-agent everywhere: drops it from the list AND strips ALL\n\t * its `{{tool:KEY}}` / `{{subagent:ID}}` tokens from BOTH the instructions and\n\t * the guardrails, remounts the editors, and raises an undo toast.\n\t */\n\tremoveReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/**\n\t * Append a tool / sub-agent id to its list (deduped), reading the LATEST value\n\t * via a ref. Use this instead of `patch({ tools: [...value.tools, id] })` from\n\t * any handler that may be captured with a stale `value` — notably the `@`\n\t * editor's mount-time `onSelect`, which would otherwise keep only the last pick.\n\t */\n\taddReference: (kind: 'tool' | 'subagent', id: string) => void;\n\t/** Remount signal for the mention editors after an external edit. */\n\tmentionResetKey: number;\n\t/**\n\t * Insert a tool / sub-agent mention chip at the last cursor position of\n\t * whichever mention field was focused most recently (Instructions or\n\t * Guardrails). `label` overrides the chip text (e.g. a just-created sub-agent\n\t * not yet in the available list).\n\t */\n\tinsertMention: MentionInsertFn;\n\t/** A mention field registers its editor-backed insert here (internal). */\n\tregisterMentionField: (\n\t\tfieldKey: MentionFieldKey,\n\t\tfn: MentionInsertFn | null,\n\t) => void;\n\t/** A mention field reports focus so inserts target it (internal). */\n\tnotifyMentionFocus: (fieldKey: MentionFieldKey) => void;\n\n\t// Undo (post-removal)\n\t/** Non-null while the undo toast should be visible. */\n\tundoToast: UndoToastState | null;\n\t/** Restore the last removed tool / sub-agent (list + stripped tokens). */\n\tundoRemoval: () => void;\n\t/** Dismiss the undo toast without restoring. */\n\tdismissUndo: () => void;\n\n\t// Navigation\n\tactiveStep: StepKey;\n\tactiveIndex: number;\n\tgoToStep: (step: StepKey) => void;\n\tgoNext: () => void;\n\tgoPrev: () => void;\n\tisFirstStep: boolean;\n\tisLastStep: boolean;\n\n\t// Validation\n\tvalidation: StepValidation;\n\tisActiveStepValid: boolean;\n\n\t// Reference data\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\t/**\n\t * Backend templates for the shared-drawer tools (email / Slack), keyed by\n\t * `tool_key`. A present key drives its dynamic form + enables its tool action.\n\t */\n\tconfigToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;\n\t/**\n\t * Per-source integration connection state (today: Slack). A source mapped to\n\t * `false` renders a \"Connect\" row in the `@` picker instead of drilling in;\n\t * `true`/absent renders normally. Fed by the consumer via `integrationStatus`.\n\t */\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\t/** Open the consumer's connect flow for an unconnected integration source. */\n\tonConnectIntegration?: (source: ToolSource) => void;\n\t/**\n\t * Variable catalog for the `@` picker's \"Variables\" view. Absent / empty →\n\t * the category is hidden. Fed by the consumer via `variablesData`.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/** Host application context (e.g. MANIFEST) — drives tool-chip labelling. */\n\tapplicationType?: ApplicationType;\n\t/**\n\t * The store's connected channels + accounts. Absent / empty hides Step 1's\n\t * \"Channels to activate it on\" section entirely.\n\t */\n\tavailableChannels?: AgentChannel[];\n\t/** Open the consumer's channel-management screen. Omit to hide the link. */\n\tonManageChannels?: (type: AgentChannelType) => void;\n\t/** Open the consumer's smart-agent-handover settings (Step 4, BIK only). */\n\tonSmartAgentHandover?: () => void;\n\t/** Resolved per-field character limits (consumer overrides merged over defaults). */\n\tcharLimits: AgentCharLimits;\n\t/** When true, step-rail items are not clickable (Back / Next only). */\n\tdisableStepNavigation: boolean;\n\n\t// Sub-agent creation (Step 3 drawer)\n\t/** Persist a new sub-agent and resolve with its ref. Omit to hide the create flow. */\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/**\n\t * Step 3 registers its \"open create-sub-agent drawer\" action here so the `@`\n\t * picker's \"Create new\" row can trigger it. Pass `null` to unregister.\n\t */\n\tregisterSubAgentCreator: (fn: (() => void) | null) => void;\n\t/** Open the create-sub-agent drawer (no-op until Step 3 registers it). */\n\trequestCreateSubAgent: () => void;\n\t/**\n\t * Step 3 registers its \"open the drawer for this built-in tool action\"\n\t * (Rest API / email handover / Slack) handler here so the `@` reference picker\n\t * can trigger it. Pass `null` to unregister.\n\t */\n\tregisterToolActionHandler: (\n\t\tfn: ((source: ToolSource) => void) | null,\n\t) => void;\n\t/** Open a built-in tool action's drawer (no-op until Step 3 registers it). */\n\trequestToolAction: (source: ToolSource) => void;\n\t/** Fetch a sub-agent's editable data (Configure). Omit to hide Configure. */\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\t/** Persist edits to an existing sub-agent. */\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\t/** Optional \"Improve with AI\" for the drawer's instructions / guardrails. */\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\t/** Optional \"Improve with AI\" for the Rest API / email-handover tool drawers. */\n\tonImproveToolInstructions?: (text: string) => Promise<string>;\n}\n\nconst AgentBuilderContext =\n\tReact.createContext<AgentBuilderContextShape | null>(null);\n\nexport const useAgentBuilderContext = (): AgentBuilderContextShape => {\n\tconst ctx = useContext(AgentBuilderContext);\n\tif (!ctx) {\n\t\tthrow new Error(\n\t\t\t'useAgentBuilderContext must be used within an AgentBuilderProvider',\n\t\t);\n\t}\n\treturn ctx;\n};\n\n/** Validity derived purely from the current value (no effects). */\nconst deriveValidation = (\n\tvalue: AgentValue,\n\tlimits: AgentCharLimits,\n): StepValidation => {\n\tconst triggerValid =\n\t\tvalue.trigger.mode === 'custom_intent'\n\t\t\t? (value.trigger.custom_intent ?? '').trim().length > 0\n\t\t\t: value.trigger.intents.length > 0;\n\n\treturn {\n\t\tabout:\n\t\t\tvalue.name.trim().length > 0 &&\n\t\t\tvalue.name.length <= limits.name &&\n\t\t\tvalue.description.length <= limits.description,\n\t\ttrigger: triggerValid,\n\t\t// At least one of Instructions / Guardrails must be filled.\n\t\tresponse:\n\t\t\tvalue.instructions.trim().length > 0 ||\n\t\t\t(value.guardrail ?? '').trim().length > 0,\n\t\t// Optional until specced further — never blocks go-live.\n\t\thandover: true,\n\t};\n};\n\n/**\n * Step 2's two trigger modes are mutually exclusive, so the unselected one's data\n * is dropped — but only when the merchant LEAVES step 2, never the instant they\n * toggle the radio. Toggling to compare the two options and finding your intents\n * (or the sentence you typed) gone reads as the builder eating your work.\n */\nconst triggerForSelectedMode = (\n\ttrigger: AgentValue['trigger'],\n): AgentValue['trigger'] =>\n\ttrigger.mode === 'custom_intent'\n\t\t? { ...trigger, intents: [] }\n\t\t: { ...trigger, custom_intent: '' };\n\ninterface ProviderProps {\n\tvalue: AgentValue;\n\tonChange: (patch: Partial<AgentValue>) => void;\n\tactiveStep?: StepKey;\n\tonStepChange?: (step: StepKey) => void;\n\tavailableTools: AgentTool[];\n\tavailableSubAgents: SubAgentRef[];\n\tavailableIntents: IntentOption[];\n\tavailableModels: ModelOption[];\n\tconfigToolTemplates?: Partial<Record<ConfigToolKey, ParamsBlob>>;\n\tintegrationStatus?: Partial<Record<ToolSource, boolean>>;\n\tonConnectIntegration?: (source: ToolSource) => void;\n\tvariablesData?: VariableListInterfaceV3[];\n\tvalidation?: Partial<StepValidation>;\n\tapplicationType?: ApplicationType;\n\tavailableChannels?: AgentChannel[];\n\tonManageChannels?: (type: AgentChannelType) => void;\n\tonSmartAgentHandover?: () => void;\n\tcharLimits?: Partial<AgentCharLimits>;\n\tdisableStepNavigation?: boolean;\n\tonCreateSubAgent?: (draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonFetchSubAgent?: (id: string) => Promise<SubAgentDraft>;\n\tonUpdateSubAgent?: (id: string, draft: SubAgentDraft) => Promise<SubAgentRef>;\n\tonImproveSubAgent?: (\n\t\tkind: 'instructions' | 'guardrail',\n\t\ttext: string,\n\t) => Promise<string>;\n\tonImproveToolInstructions?: (text: string) => Promise<string>;\n\tchildren: React.ReactNode;\n}\n\nexport const AgentBuilderProvider: React.FC<ProviderProps> = ({\n\tvalue,\n\tonChange,\n\tactiveStep: controlledStep,\n\tonStepChange,\n\tavailableTools,\n\tavailableSubAgents,\n\tavailableIntents,\n\tavailableModels,\n\tconfigToolTemplates,\n\tintegrationStatus,\n\tonConnectIntegration,\n\tvariablesData,\n\tvalidation: validationOverride,\n\tapplicationType,\n\tavailableChannels,\n\tonManageChannels,\n\tonSmartAgentHandover,\n\tcharLimits: charLimitsOverride,\n\tdisableStepNavigation = true,\n\tonCreateSubAgent,\n\tonFetchSubAgent,\n\tonUpdateSubAgent,\n\tonImproveSubAgent,\n\tonImproveToolInstructions,\n\tchildren,\n}) => {\n\tconst [internalStep, setInternalStep] = useState<StepKey>('about');\n\tconst activeStep = controlledStep ?? internalStep;\n\tconst activeIndex = getStepIndex(activeStep);\n\n\t// Latest value, so closure-captured handlers (e.g. the `@` editor's mount-time\n\t// mention onSelect) append against the current lists, not a stale snapshot.\n\tconst valueRef = useRef(value);\n\tvalueRef.current = value;\n\n\t// Bumped when a mention field is edited from OUTSIDE its editor (removing a\n\t// tool from the side list, undo), forcing the mention editors to remount.\n\tconst [mentionResetKey, setMentionResetKey] = useState(0);\n\n\t// Each mention field registers an editor-backed insert fn + reports focus, so\n\t// side-panel adds drop a chip into the last-focused field at its cursor.\n\tconst mentionInsertersRef = useRef<\n\t\tPartial<Record<MentionFieldKey, MentionInsertFn>>\n\t>({});\n\tconst lastFocusedFieldRef = useRef<MentionFieldKey>('instructions');\n\tconst registerMentionField = useCallback(\n\t\t(fieldKey: MentionFieldKey, fn: MentionInsertFn | null) => {\n\t\t\tif (fn) {\n\t\t\t\tmentionInsertersRef.current[fieldKey] = fn;\n\t\t\t} else {\n\t\t\t\tdelete mentionInsertersRef.current[fieldKey];\n\t\t\t}\n\t\t},\n\t\t[],\n\t);\n\tconst notifyMentionFocus = useCallback((fieldKey: MentionFieldKey) => {\n\t\tlastFocusedFieldRef.current = fieldKey;\n\t}, []);\n\n\t// Step 3 registers its drawer opener here; the `@` picker's \"Create new\" calls it.\n\tconst subAgentCreatorRef = useRef<(() => void) | null>(null);\n\tconst registerSubAgentCreator = useCallback((fn: (() => void) | null) => {\n\t\tsubAgentCreatorRef.current = fn;\n\t}, []);\n\tconst requestCreateSubAgent = useCallback(() => {\n\t\tsubAgentCreatorRef.current?.();\n\t}, []);\n\n\t// Step 3 registers a dispatcher that opens a built-in tool action's drawer.\n\tconst toolActionHandlerRef = useRef<((source: ToolSource) => void) | null>(\n\t\tnull,\n\t);\n\tconst registerToolActionHandler = useCallback(\n\t\t(fn: ((source: ToolSource) => void) | null) => {\n\t\t\ttoolActionHandlerRef.current = fn;\n\t\t},\n\t\t[],\n\t);\n\tconst requestToolAction = useCallback((source: ToolSource) => {\n\t\ttoolActionHandlerRef.current?.(source);\n\t}, []);\n\tconst insertMention = useCallback<MentionInsertFn>(\n\t\t(kind, id, label, source) => {\n\t\t\tconst inserters = mentionInsertersRef.current;\n\t\t\tconst target =\n\t\t\t\tinserters[lastFocusedFieldRef.current] ?? inserters.instructions;\n\t\t\ttarget?.(kind, id, label, source);\n\t\t},\n\t\t[],\n\t);\n\n\t// Undo state for the most recent removal.\n\tconst [undoToast, setUndoToast] = useState<UndoToastState | null>(null);\n\tconst undoSnapshotRef = useRef<Partial<AgentValue> | null>(null);\n\tconst undoIdRef = useRef(0);\n\n\t// Consumer overrides merged over the built-in defaults (name 60, rest 1000).\n\tconst charLimits = useMemo<AgentCharLimits>(\n\t\t() => ({ ...AGENT_CHAR_LIMITS, ...charLimitsOverride }),\n\t\t[charLimitsOverride],\n\t);\n\n\tconst validation: StepValidation = useMemo(\n\t\t() => ({ ...deriveValidation(value, charLimits), ...validationOverride }),\n\t\t[value, charLimits, validationOverride],\n\t);\n\n\tconst goToStep = useCallback(\n\t\t(step: StepKey) => {\n\t\t\t// Forward jumps (side rail) must not skip past an incomplete step —\n\t\t\t// otherwise an agent with an empty step 3 could reach step 4 and be\n\t\t\t// published. Going back is always allowed.\n\t\t\tconst targetIndex = STEP_KEYS.indexOf(step);\n\t\t\tif (\n\t\t\t\ttargetIndex > activeIndex &&\n\t\t\t\tSTEP_KEYS.slice(0, targetIndex).some((k) => !validation[k])\n\t\t\t) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t// Leaving step 2 is the point the mode choice becomes final (Next, or a\n\t\t\t// rail jump). Done here rather than in Step 2's radio so switching back and\n\t\t\t// forth keeps both — see `triggerForSelectedMode`.\n\t\t\tif (activeStep === 'trigger' && step !== 'trigger') {\n\t\t\t\tonChange({ trigger: triggerForSelectedMode(value.trigger) });\n\t\t\t}\n\t\t\tif (controlledStep === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonStepChange?.(step);\n\t\t},\n\t\t[\n\t\t\tcontrolledStep,\n\t\t\tonStepChange,\n\t\t\tactiveIndex,\n\t\t\tvalidation,\n\t\t\tactiveStep,\n\t\t\tonChange,\n\t\t\tvalue.trigger,\n\t\t],\n\t);\n\n\tconst goNext = useCallback(() => {\n\t\tconst next = STEP_KEYS[Math.min(activeIndex + 1, STEP_KEYS.length - 1)];\n\t\tgoToStep(next);\n\t}, [activeIndex, goToStep]);\n\n\tconst goPrev = useCallback(() => {\n\t\tconst prev = STEP_KEYS[Math.max(activeIndex - 1, 0)];\n\t\tgoToStep(prev);\n\t}, [activeIndex, goToStep]);\n\n\tconst patch = useCallback(\n\t\t(partial: Partial<AgentValue>) => onChange(partial),\n\t\t[onChange],\n\t);\n\n\tconst updateField = useCallback(\n\t\t<K extends keyof AgentValue>(key: K, val: AgentValue[K]) =>\n\t\t\tonChange({ [key]: val } as Partial<AgentValue>),\n\t\t[onChange],\n\t);\n\n\tconst addReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\tconst v = valueRef.current;\n\t\t\tif (kind === 'tool') {\n\t\t\t\t// Custom tools (Rest API / email / Slack) track themselves on their own\n\t\t\t\t// lists; only catalog/native ids belong in `tools`. Picking an EXISTING\n\t\t\t\t// custom tool from the `@` picker must not leak its id in here — on save\n\t\t\t\t// it becomes a bogus native ref and create-agent validation rejects it.\n\t\t\t\tconst isCustom =\n\t\t\t\t\t(v.configTools ?? []).some((t) => t.id === id) ||\n\t\t\t\t\t(v.restApiTools ?? []).some((t) => t.id === id);\n\t\t\t\tif (!isCustom && !v.tools.includes(id)) {\n\t\t\t\t\tonChange({ tools: [...v.tools, id] });\n\t\t\t\t}\n\t\t\t} else if (!v.subagents.includes(id)) {\n\t\t\t\tonChange({ subagents: [...v.subagents, id] });\n\t\t\t}\n\t\t},\n\t\t[onChange],\n\t);\n\n\tconst removeReference = useCallback(\n\t\t(kind: 'tool' | 'subagent', id: string) => {\n\t\t\t// Tokens store the id for both kinds (a tool's id is its tool_id).\n\t\t\tconst token = kind === 'tool' ? `{{tool:${id}}}` : `{{subagent:${id}}}`;\n\t\t\tconst strip = (text: string) => text.split(token).join('');\n\n\t\t\t// Snapshot every field a removal touches, for undo. Custom tools (Rest\n\t\t\t// API / email / Slack) live on their own lists, so include them too.\n\t\t\tundoSnapshotRef.current = {\n\t\t\t\ttools: value.tools,\n\t\t\t\tsubagents: value.subagents,\n\t\t\t\tconfigTools: value.configTools,\n\t\t\t\trestApiTools: value.restApiTools,\n\t\t\t\tinstructions: value.instructions,\n\t\t\t\tguardrail: value.guardrail,\n\t\t\t};\n\n\t\t\tconst next: Partial<AgentValue> = {\n\t\t\t\tinstructions: strip(value.instructions),\n\t\t\t\tguardrail: strip(value.guardrail ?? ''),\n\t\t\t\t...(kind === 'tool'\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t// A tool id may be a catalog tool OR an inline custom tool — drop\n\t\t\t\t\t\t\t// it from whichever list holds it (the others are no-op filters).\n\t\t\t\t\t\t\ttools: value.tools.filter((t) => t !== id),\n\t\t\t\t\t\t\tconfigTools: (value.configTools ?? []).filter((t) => t.id !== id),\n\t\t\t\t\t\t\trestApiTools: (value.restApiTools ?? []).filter(\n\t\t\t\t\t\t\t\t(t) => t.id !== id,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t }\n\t\t\t\t\t: { subagents: value.subagents.filter((s) => s !== id) }),\n\t\t\t};\n\t\t\tonChange(next);\n\t\t\tsetMentionResetKey((k) => k + 1);\n\n\t\t\tconst label =\n\t\t\t\tkind === 'tool'\n\t\t\t\t\t? availableTools.find((t) => t.tool_id === id)?.display_name ??\n\t\t\t\t\t (value.restApiTools ?? []).find((t) => t.id === id)?.name ??\n\t\t\t\t\t 'Tool'\n\t\t\t\t\t: availableSubAgents.find((s) => s.id === id)?.name ?? 'Sub-agent';\n\t\t\tundoIdRef.current += 1;\n\t\t\tsetUndoToast({\n\t\t\t\tid: undoIdRef.current,\n\t\t\t\tmessage: `${kind === 'tool' ? 'Tool' : 'Sub-agent'} \"${label}\" removed`,\n\t\t\t});\n\t\t},\n\t\t[availableTools, availableSubAgents, value, onChange],\n\t);\n\n\tconst undoRemoval = useCallback(() => {\n\t\tif (undoSnapshotRef.current) {\n\t\t\tonChange(undoSnapshotRef.current);\n\t\t\tundoSnapshotRef.current = null;\n\t\t\tsetMentionResetKey((k) => k + 1);\n\t\t}\n\t\tsetUndoToast(null);\n\t}, [onChange]);\n\n\tconst dismissUndo = useCallback(() => setUndoToast(null), []);\n\n\tconst ctx = useMemo<AgentBuilderContextShape>(\n\t\t() => ({\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tisFirstStep: activeIndex === 0,\n\t\t\tisLastStep: activeIndex === STEP_KEYS.length - 1,\n\t\t\tvalidation,\n\t\t\tisActiveStepValid: validation[activeStep],\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t\tvariablesData,\n\t\t\tapplicationType,\n\t\t\tavailableChannels,\n\t\t\tonManageChannels,\n\t\t\tonSmartAgentHandover,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tregisterToolActionHandler,\n\t\t\trequestToolAction,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t\tonImproveToolInstructions,\n\t\t}),\n\t\t[\n\t\t\tvalue,\n\t\t\tpatch,\n\t\t\tupdateField,\n\t\t\taddReference,\n\t\t\tremoveReference,\n\t\t\tmentionResetKey,\n\t\t\tinsertMention,\n\t\t\tregisterMentionField,\n\t\t\tnotifyMentionFocus,\n\t\t\tundoToast,\n\t\t\tundoRemoval,\n\t\t\tdismissUndo,\n\t\t\tactiveStep,\n\t\t\tactiveIndex,\n\t\t\tgoToStep,\n\t\t\tgoNext,\n\t\t\tgoPrev,\n\t\t\tvalidation,\n\t\t\tavailableTools,\n\t\t\tavailableSubAgents,\n\t\t\tavailableIntents,\n\t\t\tavailableModels,\n\t\t\tconfigToolTemplates,\n\t\t\tintegrationStatus,\n\t\t\tonConnectIntegration,\n\t\t\tvariablesData,\n\t\t\tapplicationType,\n\t\t\tavailableChannels,\n\t\t\tonManageChannels,\n\t\t\tonSmartAgentHandover,\n\t\t\tcharLimits,\n\t\t\tdisableStepNavigation,\n\t\t\tonCreateSubAgent,\n\t\t\tregisterSubAgentCreator,\n\t\t\trequestCreateSubAgent,\n\t\t\tregisterToolActionHandler,\n\t\t\trequestToolAction,\n\t\t\tonFetchSubAgent,\n\t\t\tonUpdateSubAgent,\n\t\t\tonImproveSubAgent,\n\t\t\tonImproveToolInstructions,\n\t\t],\n\t);\n\n\treturn (\n\t\t<AgentBuilderContext.Provider value={ctx}>\n\t\t\t{children}\n\t\t</AgentBuilderContext.Provider>\n\t);\n};\n"],"names":["AgentBuilderContext","React","useAgentBuilderContext","ctx","useContext","deriveValidation","value","limits","triggerValid","triggerForSelectedMode","trigger","AgentBuilderProvider","onChange","controlledStep","onStepChange","availableTools","availableSubAgents","availableIntents","availableModels","configToolTemplates","integrationStatus","onConnectIntegration","variablesData","validationOverride","applicationType","availableChannels","onManageChannels","onSmartAgentHandover","charLimitsOverride","disableStepNavigation","onCreateSubAgent","onFetchSubAgent","onUpdateSubAgent","onImproveSubAgent","onImproveToolInstructions","children","internalStep","setInternalStep","useState","activeStep","activeIndex","getStepIndex","valueRef","useRef","mentionResetKey","setMentionResetKey","mentionInsertersRef","lastFocusedFieldRef","registerMentionField","useCallback","fieldKey","fn","notifyMentionFocus","subAgentCreatorRef","registerSubAgentCreator","requestCreateSubAgent","toolActionHandlerRef","registerToolActionHandler","requestToolAction","source","insertMention","kind","id","label","inserters","undoToast","setUndoToast","undoSnapshotRef","undoIdRef","charLimits","useMemo","AGENT_CHAR_LIMITS","validation","goToStep","step","targetIndex","STEP_KEYS","k","goNext","next","goPrev","prev","patch","partial","updateField","key","val","addReference","v","t","removeReference","token","strip","text","s","undoRemoval","dismissUndo"],"mappings":";;;;AAiLA,MAAMA,KACLC,GAAM,cAA+C,IAAI,GAE7CC,KAAyB,MAAgC;AACrE,QAAMC,IAAMC,GAAWJ,EAAmB;AAC1C,MAAI,CAACG;AACJ,UAAM,IAAI;AAAA,MACT;AAAA,IAAA;AAGF,SAAOA;AACR,GAGME,KAAmB,CACxBC,GACAC,MACoB;AACpB,QAAMC,IACLF,EAAM,QAAQ,SAAS,mBACnBA,EAAM,QAAQ,iBAAiB,IAAI,KAAA,EAAO,SAAS,IACpDA,EAAM,QAAQ,QAAQ,SAAS;AAEnC,SAAO;AAAA,IACN,OACCA,EAAM,KAAK,KAAA,EAAO,SAAS,KAC3BA,EAAM,KAAK,UAAUC,EAAO,QAC5BD,EAAM,YAAY,UAAUC,EAAO;AAAA,IACpC,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A,MACA,qBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,sBAAAC;AAAA,MACA,eAAAC;AAAA,MACA,iBAAAE;AAAA,MACA,mBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,sBAAAC;AAAA,MACA,YAAA0C;AAAA,MACA,uBAAAxC;AAAA,MACA,kBAAAC;AAAA,MACA,yBAAAwB;AAAA,MACA,uBAAAC;AAAA,MACA,2BAAAE;AAAA,MACA,mBAAAC;AAAA,MACA,iBAAA3B;AAAA,MACA,kBAAAC;AAAA,MACA,mBAAAC;AAAA,MACA,2BAAAC;AAAA,IAAA;AAAA,IAED;AAAA,MACC5B;AAAA,MACA4E;AAAA,MACAE;AAAA,MACAG;AAAA,MACAG;AAAA,MACA9C;AAAA,MACAgB;AAAA,MACAZ;AAAA,MACAI;AAAA,MACAa;AAAA,MACA8B;AAAA,MACAC;AAAA,MACAzD;AAAA,MACAC;AAAA,MACAiC;AAAA,MACAK;AAAA,MACAE;AAAA,MACAR;AAAA,MACAzD;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACAE;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,MACA0C;AAAA,MACAxC;AAAA,MACAC;AAAA,MACAwB;AAAA,MACAC;AAAA,MACAE;AAAA,MACAC;AAAA,MACA3B;AAAA,MACAC;AAAA,MACAC;AAAA,MACAC;AAAA,IAAA;AAAA,EACD;AAGD,4BACElC,GAAoB,UAApB,EAA6B,OAAOG,IACnC,UAAAgC,IACF;AAEF;"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export { AgentBuilder } from './AgentBuilder';
|
|
2
|
+
export { Channels } from '@bikdotai/bik-models/campaigns/models/Channel';
|
|
2
3
|
export { AgentStateModal } from './components/AgentStateModal';
|
|
3
4
|
export type { AgentModalState } from './components/AgentStateModal';
|
|
4
5
|
export { useAgentDraft } from './hooks/useAgentDraft';
|
|
5
6
|
export type { AgentDraft } from './hooks/useAgentDraft';
|
|
6
7
|
export { AGENT_CHAR_LIMITS } from './constants/charLimits';
|
|
7
8
|
export type { AgentCharLimits } from './constants/charLimits';
|
|
8
|
-
export { STEP_DEFINITIONS } from './constants/steps';
|
|
9
|
+
export { APP_TOKEN, resolveAppToken, STEP_DEFINITIONS, } from './constants/steps';
|
|
10
|
+
export { AGENT_CHANNEL_TYPES, channelPresentation, CHANNEL_PRESENTATION, } from './constants/channels';
|
|
11
|
+
export type { ChannelPresentation } from './constants/channels';
|
|
9
12
|
export { ToolSource } from './constants/tools';
|
|
10
13
|
export { buildAgentMentionItems, editorDocToInstructions, instructionsToEditorHtml, } from './utils/mentionSerialization';
|
|
11
|
-
export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, RestApiToolConfig, RestApiMethod, RestApiHeader, ConfigToolConfig, ConfigToolKey, ParamField, ParamsBlob, ToolRef, CatalogTool, CustomTool, } from './AgentBuilder.model';
|
|
14
|
+
export type { AgentBuilderProps, AgentBuilderConfig, AgentValue, AgentStatus as AgentBuilderStatus, StepKey, StepValidation, TriggerMode, AgentTriggerValue, AgentHandoverConfig, HandoverMethod, AgentTool, SubAgentRef, SubAgentDraft, IntentOption, ModelOption, RestApiToolConfig, RestApiMethod, RestApiHeader, ConfigToolConfig, ConfigToolKey, ParamField, ParamsBlob, ToolRef, CatalogTool, CustomTool, AgentChannel, AgentChannelAccount, AgentChannelSelection, AgentChannelStatus, AgentChannelType, } from './AgentBuilder.model';
|
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { SectionBodyWrap as m } from "../AgentBuilder.styled.js";
|
|
3
3
|
import { AiTextArea as l } from "../components/AiTextArea.js";
|
|
4
|
-
import {
|
|
4
|
+
import { ChannelsSection as p } from "../components/ChannelsSection.js";
|
|
5
|
+
import { StepSectionHeader as s } from "../components/StepSectionHeader.js";
|
|
5
6
|
import { STEP_DEFINITIONS as d } from "../constants/steps.js";
|
|
6
|
-
import { useAgentBuilderContext as
|
|
7
|
-
import { Input as
|
|
8
|
-
const o = d[0],
|
|
9
|
-
const { value: i, updateField:
|
|
7
|
+
import { useAgentBuilderContext as c } from "../context/AgentBuilderContext.js";
|
|
8
|
+
import { Input as h } from "../../input/Input.js";
|
|
9
|
+
const o = d[0], v = () => {
|
|
10
|
+
const { value: i, updateField: n, charLimits: a } = c();
|
|
10
11
|
return /* @__PURE__ */ r("div", { className: "bik-agent-step bik-agent-step--about", children: [
|
|
11
|
-
/* @__PURE__ */ e(
|
|
12
|
+
/* @__PURE__ */ e(s, { title: o.title, helper: o.helper }),
|
|
12
13
|
/* @__PURE__ */ r(m, { children: [
|
|
13
14
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
14
|
-
|
|
15
|
+
h,
|
|
15
16
|
{
|
|
16
17
|
"data-test": "agent-name",
|
|
17
18
|
labelText: "Agent name",
|
|
18
19
|
labelTextBold: !0,
|
|
19
20
|
placeholder: "Enter agent name",
|
|
20
21
|
value: i.name,
|
|
21
|
-
maxCharLimit:
|
|
22
|
+
maxCharLimit: a.name,
|
|
22
23
|
maxCharLimitPosition: "TOP",
|
|
23
24
|
maxCharStyle: { fontSize: 12, lineHeight: "16px" },
|
|
24
|
-
onChangeText: (t) =>
|
|
25
|
+
onChangeText: (t) => n("name", t)
|
|
25
26
|
}
|
|
26
27
|
) }),
|
|
27
28
|
/* @__PURE__ */ e(
|
|
@@ -30,16 +31,17 @@ const o = d[0], b = () => {
|
|
|
30
31
|
"data-test": "agent-description",
|
|
31
32
|
label: "What it does",
|
|
32
33
|
value: i.description,
|
|
33
|
-
onChange: (t) =>
|
|
34
|
-
maxLength:
|
|
34
|
+
onChange: (t) => n("description", t),
|
|
35
|
+
maxLength: a.description,
|
|
35
36
|
placeholder: "Enter description",
|
|
36
37
|
minHeight: "200px"
|
|
37
38
|
}
|
|
38
|
-
)
|
|
39
|
+
),
|
|
40
|
+
/* @__PURE__ */ e(p, {})
|
|
39
41
|
] })
|
|
40
42
|
] });
|
|
41
43
|
};
|
|
42
44
|
export {
|
|
43
|
-
|
|
45
|
+
v as Step1About
|
|
44
46
|
};
|
|
45
47
|
//# sourceMappingURL=Step1About.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Step1About.js","sources":["../../../../../src/components/agent-builder/steps/Step1About.tsx"],"sourcesContent":["import React from 'react';\nimport { Input } from '@src/components/input';\nimport { SectionBodyWrap } from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[0];\n\nexport const Step1About: React.FC = () => {\n\tconst { value, updateField, charLimits } = useAgentBuilderContext();\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--about\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<SectionBodyWrap>\n\t\t\t\t<div>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tdata-test=\"agent-name\"\n\t\t\t\t\t\tlabelText=\"Agent name\"\n\t\t\t\t\t\tlabelTextBold\n\t\t\t\t\t\tplaceholder=\"Enter agent name\"\n\t\t\t\t\t\tvalue={value.name}\n\t\t\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\t\t\tmaxCharLimitPosition=\"TOP\"\n\t\t\t\t\t\tmaxCharStyle={{ fontSize: 12, lineHeight: '16px' }}\n\t\t\t\t\t\tonChangeText={(text) => updateField('name', text)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<AiTextArea\n\t\t\t\t\tdata-test=\"agent-description\"\n\t\t\t\t\tlabel=\"What it does\"\n\t\t\t\t\tvalue={value.description}\n\t\t\t\t\tonChange={(text) => updateField('description', text)}\n\t\t\t\t\tmaxLength={charLimits.description}\n\t\t\t\t\tplaceholder=\"Enter description\"\n\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t/>\n\t\t\t</SectionBodyWrap>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step1About","value","updateField","charLimits","useAgentBuilderContext","jsxs","jsx","StepSectionHeader","SectionBodyWrap","Input","text","AiTextArea"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Step1About.js","sources":["../../../../../src/components/agent-builder/steps/Step1About.tsx"],"sourcesContent":["import React from 'react';\nimport { Input } from '@src/components/input';\nimport { SectionBodyWrap } from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { ChannelsSection } from '../components/ChannelsSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\nconst STEP = STEP_DEFINITIONS[0];\n\nexport const Step1About: React.FC = () => {\n\tconst { value, updateField, charLimits } = useAgentBuilderContext();\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--about\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<SectionBodyWrap>\n\t\t\t\t<div>\n\t\t\t\t\t<Input\n\t\t\t\t\t\tdata-test=\"agent-name\"\n\t\t\t\t\t\tlabelText=\"Agent name\"\n\t\t\t\t\t\tlabelTextBold\n\t\t\t\t\t\tplaceholder=\"Enter agent name\"\n\t\t\t\t\t\tvalue={value.name}\n\t\t\t\t\t\tmaxCharLimit={charLimits.name}\n\t\t\t\t\t\tmaxCharLimitPosition=\"TOP\"\n\t\t\t\t\t\tmaxCharStyle={{ fontSize: 12, lineHeight: '16px' }}\n\t\t\t\t\t\tonChangeText={(text) => updateField('name', text)}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\n\t\t\t\t<AiTextArea\n\t\t\t\t\tdata-test=\"agent-description\"\n\t\t\t\t\tlabel=\"What it does\"\n\t\t\t\t\tvalue={value.description}\n\t\t\t\t\tonChange={(text) => updateField('description', text)}\n\t\t\t\t\tmaxLength={charLimits.description}\n\t\t\t\t\tplaceholder=\"Enter description\"\n\t\t\t\t\tminHeight=\"200px\"\n\t\t\t\t/>\n\n\t\t\t\t<ChannelsSection />\n\t\t\t</SectionBodyWrap>\n\t\t</div>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","Step1About","value","updateField","charLimits","useAgentBuilderContext","jsxs","jsx","StepSectionHeader","SectionBodyWrap","Input","text","AiTextArea","ChannelsSection"],"mappings":";;;;;;;;AASA,MAAMA,IAAOC,EAAiB,CAAC,GAElBC,IAAuB,MAAM;AACzC,QAAM,EAAE,OAAAC,GAAO,aAAAC,GAAa,YAAAC,EAAA,IAAeC,EAAA;AAE3C,SACC,gBAAAC,EAAC,OAAA,EAAI,WAAU,wCACd,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAkB,OAAOT,EAAK,OAAO,QAAQA,EAAK,QAAQ;AAAA,sBAE1DU,GAAA,EACA,UAAA;AAAA,MAAA,gBAAAF,EAAC,OAAA,EACA,UAAA,gBAAAA;AAAA,QAACG;AAAA,QAAA;AAAA,UACA,aAAU;AAAA,UACV,WAAU;AAAA,UACV,eAAa;AAAA,UACb,aAAY;AAAA,UACZ,OAAOR,EAAM;AAAA,UACb,cAAcE,EAAW;AAAA,UACzB,sBAAqB;AAAA,UACrB,cAAc,EAAE,UAAU,IAAI,YAAY,OAAA;AAAA,UAC1C,cAAc,CAACO,MAASR,EAAY,QAAQQ,CAAI;AAAA,QAAA;AAAA,MAAA,GAElD;AAAA,MAEA,gBAAAJ;AAAA,QAACK;AAAA,QAAA;AAAA,UACA,aAAU;AAAA,UACV,OAAM;AAAA,UACN,OAAOV,EAAM;AAAA,UACb,UAAU,CAACS,MAASR,EAAY,eAAeQ,CAAI;AAAA,UACnD,WAAWP,EAAW;AAAA,UACtB,aAAY;AAAA,UACZ,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,wBAGVS,GAAA,CAAA,CAAgB;AAAA,IAAA,EAAA,CAClB;AAAA,EAAA,GACD;AAEF;"}
|