@burdenoff/fluidgrids-fe-sdk 2026.1109.9 → 2026.1110.2
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/{ExecutionDetailPage-2ORSV3YN.js → ExecutionDetailPage-UXQFBLF3.js} +14 -14
- package/dist/{ExecutionsListPage-MY45NECW.js → ExecutionsListPage-A4GCUNFR.js} +11 -11
- package/dist/{WorkflowBuilder-MWC2BCTQ.js → WorkflowBuilder-ZLVMV2UA.js} +21 -15
- package/dist/{WorkflowsList-6AG7CFZM.js → WorkflowsList-XPNGNR4A.js} +8 -8
- package/dist/{agentTools-5O2KPQYJ.js → agentTools-V26FOMTS.js} +5 -7
- package/dist/{chunk-ACME5GOU.js → chunk-2DBAQR6F.js} +2 -2
- package/dist/{chunk-MYE6CMGK.js → chunk-2H4XAES7.js} +3 -3
- package/dist/{chunk-IZSWG5G3.js → chunk-3F4DIVKT.js} +1 -1
- package/dist/chunk-3JGAI5YC.js +1437 -0
- package/dist/{chunk-MSNCU6US.js → chunk-5TGPH3CX.js} +4 -4
- package/dist/{chunk-U52PO4QQ.js → chunk-5V7PMLQN.js} +1320 -58
- package/dist/{chunk-TKSVFP36.js → chunk-5ZAOXCIQ.js} +6 -6
- package/dist/{chunk-POCNG3PM.js → chunk-6CPQVLHT.js} +15 -16
- package/dist/{chunk-2LERIIZM.js → chunk-7UFE2CHD.js} +308 -1026
- package/dist/{chunk-VAWYR6P4.js → chunk-A6Q4FWB6.js} +9 -1
- package/dist/{chunk-G4NAU6FF.js → chunk-CBX2CXGH.js} +8 -8
- package/dist/{chunk-5UA262ZO.js → chunk-CKF2FBUP.js} +1 -1
- package/dist/{chunk-5YLS3WH5.js → chunk-D4L5BN64.js} +1 -1
- package/dist/{chunk-VYXTP6YF.js → chunk-DDINUPO3.js} +2185 -5390
- package/dist/{chunk-DFFQYK2X.js → chunk-DIIGFBYT.js} +1 -1
- package/dist/{chunk-3T3C3475.js → chunk-G7BT24PD.js} +550 -3
- package/dist/chunk-HORSE7WX.js +54 -0
- package/dist/{chunk-7ADEPA4W.js → chunk-I3DBTNWQ.js} +6 -6
- package/dist/{chunk-HZ7FQCFU.js → chunk-JNSHR2J2.js} +1 -1
- package/dist/{chunk-ZXLXZFWO.js → chunk-K22NDWSD.js} +2 -2
- package/dist/{chunk-JXCJRBWD.js → chunk-K2X63CR2.js} +1 -5
- package/dist/{chunk-Q526TUOC.js → chunk-L5MZ74DA.js} +1 -1
- package/dist/{chunk-WKF72AS2.js → chunk-OVZA4IM7.js} +4 -4
- package/dist/{chunk-GR3QNLFS.js → chunk-OZNFRJKC.js} +5 -5
- package/dist/{chunk-NEB4Y7AX.js → chunk-PI4AW4T2.js} +241 -34
- package/dist/{chunk-TNMXKPJX.js → chunk-PICOXEUO.js} +4 -4
- package/dist/{chunk-QWDF72GZ.js → chunk-QGRVYPQC.js} +2 -2
- package/dist/{chunk-THIMC2ZD.js → chunk-WGUHISC2.js} +29 -11
- package/dist/{chunk-B3USL2JQ.js → chunk-X7XVRJK2.js} +2 -2
- package/dist/{chunk-4EZFAL24.js → chunk-XLU63IUB.js} +6 -6
- package/dist/{chunk-CX3LABFK.js → chunk-Z6D6YL7C.js} +1 -1
- package/dist/{chunk-NCXK2AO6.js → chunk-ZQTANHKA.js} +2 -2
- package/dist/chunk-ZZBZPBO5.js +1644 -0
- package/dist/executions.js +15 -15
- package/dist/history.js +7 -9
- package/dist/index.d.ts +367 -159
- package/dist/index.js +592 -68
- package/dist/{node-detail-view-ZFGS3FWU.js → node-detail-view-2AFXRNX6.js} +19 -864
- package/dist/nodes.js +2 -2
- package/dist/observability.js +7 -7
- package/dist/{quick-config-panel-ZDGYZR7Y.js → quick-config-panel-U4AELSCT.js} +12 -54
- package/dist/settings.js +9 -9
- package/dist/templates.js +21 -14
- package/dist/workflow-builder.js +22 -16
- package/dist/workflow-preview.js +2 -2
- package/dist/workflows-list.js +8 -8
- package/package.json +1 -1
- package/dist/chunk-GTEBQQ7J.js +0 -24
- package/dist/chunk-O2OFNGAF.js +0 -338
- package/dist/chunk-QTOPG7SR.js +0 -501
- package/dist/chunk-U7UNWR3D.js +0 -260
package/dist/chunk-QTOPG7SR.js
DELETED
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
import { emptyAgentForm, agentToForm, describeRule, formToInput, AgentFormError, DEFAULT_GRANT_DAYS, MAX_GRANT_DAYS, grantDays } from './chunk-WZ3EJVS6.js';
|
|
2
|
-
import { useAgentDefinitions, useAgentDefinitionList, useConnections } from './chunk-VYXTP6YF.js';
|
|
3
|
-
import { useTr } from './chunk-UULVIT25.js';
|
|
4
|
-
import { describeOperationError } from './chunk-JKLZ6YZ3.js';
|
|
5
|
-
import { useState, useCallback, useEffect } from 'react';
|
|
6
|
-
import { Icon } from '@iconify/react';
|
|
7
|
-
import { Button } from '@burdenoff/fe-libs/button';
|
|
8
|
-
import { Badge, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Label, Input, Switch, Textarea, Checkbox } from '@burdenoff/fe-libs/ui';
|
|
9
|
-
import { toast } from 'sonner';
|
|
10
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
function errorMessage(err) {
|
|
13
|
-
if (err instanceof AgentFormError) return err.message;
|
|
14
|
-
return describeOperationError(err);
|
|
15
|
-
}
|
|
16
|
-
function AgentEditor({
|
|
17
|
-
initial,
|
|
18
|
-
onCancel,
|
|
19
|
-
onSave
|
|
20
|
-
}) {
|
|
21
|
-
const tr = useTr();
|
|
22
|
-
const [form, setForm] = useState(initial);
|
|
23
|
-
const [busy, setBusy] = useState(false);
|
|
24
|
-
const { connections, loading: connectionsLoading } = useConnections();
|
|
25
|
-
const setTool = (index, patch) => setForm((current) => ({
|
|
26
|
-
...current,
|
|
27
|
-
tools: current.tools.map(
|
|
28
|
-
(row, i) => i === index ? { ...row, ...patch } : row
|
|
29
|
-
)
|
|
30
|
-
}));
|
|
31
|
-
const toggleConnection = (id, on) => setForm((current) => ({
|
|
32
|
-
...current,
|
|
33
|
-
connectionScope: on ? [.../* @__PURE__ */ new Set([...current.connectionScope, id])] : current.connectionScope.filter((value) => value !== id)
|
|
34
|
-
}));
|
|
35
|
-
const submit = async () => {
|
|
36
|
-
setBusy(true);
|
|
37
|
-
try {
|
|
38
|
-
await onSave(form);
|
|
39
|
-
} catch (err) {
|
|
40
|
-
toast.error(errorMessage(err));
|
|
41
|
-
} finally {
|
|
42
|
-
setBusy(false);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return /* @__PURE__ */ jsxs(
|
|
46
|
-
"div",
|
|
47
|
-
{
|
|
48
|
-
className: "rounded-lg border border-border-secondary bg-background-primary p-4 space-y-4",
|
|
49
|
-
"data-testid": "agent-definition-editor",
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ jsxs("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
52
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
53
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: "agent-name", children: tr("fluidgrids.agents.name", "Name") }),
|
|
54
|
-
/* @__PURE__ */ jsx(
|
|
55
|
-
Input,
|
|
56
|
-
{
|
|
57
|
-
id: "agent-name",
|
|
58
|
-
value: form.name,
|
|
59
|
-
onChange: (e) => setForm({ ...form, name: e.target.value }),
|
|
60
|
-
"data-testid": "agent-definition-name"
|
|
61
|
-
}
|
|
62
|
-
)
|
|
63
|
-
] }),
|
|
64
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-end gap-2", children: [
|
|
65
|
-
/* @__PURE__ */ jsx(
|
|
66
|
-
Switch,
|
|
67
|
-
{
|
|
68
|
-
id: "agent-active",
|
|
69
|
-
checked: form.status === "ACTIVE",
|
|
70
|
-
onCheckedChange: (on) => setForm({ ...form, status: on ? "ACTIVE" : "DISABLED" })
|
|
71
|
-
}
|
|
72
|
-
),
|
|
73
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: "agent-active", children: tr("fluidgrids.agents.active", "Active") })
|
|
74
|
-
] })
|
|
75
|
-
] }),
|
|
76
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
77
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: "agent-description", children: tr("fluidgrids.agents.description", "Description") }),
|
|
78
|
-
/* @__PURE__ */ jsx(
|
|
79
|
-
Textarea,
|
|
80
|
-
{
|
|
81
|
-
id: "agent-description",
|
|
82
|
-
value: form.description,
|
|
83
|
-
onChange: (e) => setForm({ ...form, description: e.target.value }),
|
|
84
|
-
rows: 2
|
|
85
|
-
}
|
|
86
|
-
)
|
|
87
|
-
] }),
|
|
88
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
89
|
-
/* @__PURE__ */ jsx(Label, { children: tr("fluidgrids.agents.tools", "Tools the agent may call") }),
|
|
90
|
-
/* @__PURE__ */ jsx("p", { className: "text-xs text-text-secondary", children: tr(
|
|
91
|
-
"fluidgrids.agents.toolsHelp",
|
|
92
|
-
"A node type (for example store/slack) and the operations of it the agent may call, separated by commas. Leave the operations empty to allow every operation of that node type. Nothing else can be called."
|
|
93
|
-
) }),
|
|
94
|
-
form.tools.map((row, index) => /* @__PURE__ */ jsxs(
|
|
95
|
-
"div",
|
|
96
|
-
{
|
|
97
|
-
className: "flex flex-wrap items-center gap-2",
|
|
98
|
-
"data-testid": `agent-definition-tool-${index}`,
|
|
99
|
-
children: [
|
|
100
|
-
/* @__PURE__ */ jsx(
|
|
101
|
-
Input,
|
|
102
|
-
{
|
|
103
|
-
className: "w-48",
|
|
104
|
-
placeholder: "store/slack",
|
|
105
|
-
value: row.nodeType,
|
|
106
|
-
onChange: (e) => setTool(index, { nodeType: e.target.value }),
|
|
107
|
-
"aria-label": tr("fluidgrids.agents.nodeType", "Node type")
|
|
108
|
-
}
|
|
109
|
-
),
|
|
110
|
-
/* @__PURE__ */ jsx(
|
|
111
|
-
Input,
|
|
112
|
-
{
|
|
113
|
-
className: "min-w-48 flex-1",
|
|
114
|
-
placeholder: "postMessage, listChannels",
|
|
115
|
-
value: row.operations,
|
|
116
|
-
onChange: (e) => setTool(index, { operations: e.target.value }),
|
|
117
|
-
"aria-label": tr("fluidgrids.agents.operations", "Operations")
|
|
118
|
-
}
|
|
119
|
-
),
|
|
120
|
-
/* @__PURE__ */ jsx(
|
|
121
|
-
Button,
|
|
122
|
-
{
|
|
123
|
-
variant: "ghost",
|
|
124
|
-
size: "sm",
|
|
125
|
-
onClick: () => setForm({
|
|
126
|
-
...form,
|
|
127
|
-
tools: form.tools.filter((_, i) => i !== index)
|
|
128
|
-
}),
|
|
129
|
-
"aria-label": tr("fluidgrids.agents.removeTool", "Remove tool"),
|
|
130
|
-
children: /* @__PURE__ */ jsx(Icon, { icon: "mdi:close", width: 16 })
|
|
131
|
-
}
|
|
132
|
-
)
|
|
133
|
-
]
|
|
134
|
-
},
|
|
135
|
-
index
|
|
136
|
-
)),
|
|
137
|
-
/* @__PURE__ */ jsxs(
|
|
138
|
-
Button,
|
|
139
|
-
{
|
|
140
|
-
variant: "outline",
|
|
141
|
-
size: "sm",
|
|
142
|
-
onClick: () => setForm({
|
|
143
|
-
...form,
|
|
144
|
-
tools: [...form.tools, { nodeType: "", operations: "" }]
|
|
145
|
-
}),
|
|
146
|
-
children: [
|
|
147
|
-
/* @__PURE__ */ jsx(Icon, { icon: "mdi:plus", width: 16 }),
|
|
148
|
-
tr("fluidgrids.agents.addTool", "Add tool")
|
|
149
|
-
]
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
] }),
|
|
153
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
154
|
-
/* @__PURE__ */ jsx(Label, { children: tr(
|
|
155
|
-
"fluidgrids.agents.connections",
|
|
156
|
-
"Connections the agent's tools may use"
|
|
157
|
-
) }),
|
|
158
|
-
connectionsLoading ? /* @__PURE__ */ jsx("p", { className: "text-xs text-text-secondary", children: tr("fluidgrids.agents.loadingConnections", "Loading connections\u2026") }) : connections.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-xs text-text-secondary", children: tr(
|
|
159
|
-
"fluidgrids.agents.noConnections",
|
|
160
|
-
"This workspace has no connections yet."
|
|
161
|
-
) }) : /* @__PURE__ */ jsx("div", { className: "grid gap-1 sm:grid-cols-2", children: connections.map((connection) => /* @__PURE__ */ jsxs(
|
|
162
|
-
"label",
|
|
163
|
-
{
|
|
164
|
-
className: "flex items-center gap-2 text-sm text-text-primary",
|
|
165
|
-
children: [
|
|
166
|
-
/* @__PURE__ */ jsx(
|
|
167
|
-
Checkbox,
|
|
168
|
-
{
|
|
169
|
-
checked: form.connectionScope.includes(connection.id),
|
|
170
|
-
onCheckedChange: (on) => toggleConnection(connection.id, on === true)
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
/* @__PURE__ */ jsx("span", { children: connection.name }),
|
|
174
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-text-tertiary", children: connection.provider?.name ?? connection.providerId })
|
|
175
|
-
]
|
|
176
|
-
},
|
|
177
|
-
connection.id
|
|
178
|
-
)) })
|
|
179
|
-
] }),
|
|
180
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
181
|
-
/* @__PURE__ */ jsx(
|
|
182
|
-
Switch,
|
|
183
|
-
{
|
|
184
|
-
id: "agent-approval",
|
|
185
|
-
checked: form.requireToolApproval,
|
|
186
|
-
onCheckedChange: (on) => setForm({ ...form, requireToolApproval: on })
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: "agent-approval", children: tr(
|
|
190
|
-
"fluidgrids.agents.requireApproval",
|
|
191
|
-
"Every tool call waits for a person's approval"
|
|
192
|
-
) })
|
|
193
|
-
] }),
|
|
194
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
195
|
-
/* @__PURE__ */ jsx(
|
|
196
|
-
Button,
|
|
197
|
-
{
|
|
198
|
-
onClick: () => void submit(),
|
|
199
|
-
disabled: busy,
|
|
200
|
-
"data-testid": "agent-definition-save",
|
|
201
|
-
children: tr("fluidgrids.agents.save", "Save agent")
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: onCancel, disabled: busy, children: tr("fluidgrids.agents.cancel", "Cancel") })
|
|
205
|
-
] })
|
|
206
|
-
]
|
|
207
|
-
}
|
|
208
|
-
);
|
|
209
|
-
}
|
|
210
|
-
function AgentGrants({
|
|
211
|
-
agent,
|
|
212
|
-
loadGrants,
|
|
213
|
-
onGrant,
|
|
214
|
-
onRevoke
|
|
215
|
-
}) {
|
|
216
|
-
const tr = useTr();
|
|
217
|
-
const [grants, setGrants] = useState(null);
|
|
218
|
-
const [days, setDays] = useState(String(DEFAULT_GRANT_DAYS));
|
|
219
|
-
const [busy, setBusy] = useState(false);
|
|
220
|
-
const load = useCallback(async () => {
|
|
221
|
-
try {
|
|
222
|
-
setGrants(await loadGrants(agent.id));
|
|
223
|
-
} catch (err) {
|
|
224
|
-
setGrants([]);
|
|
225
|
-
toast.error(errorMessage(err));
|
|
226
|
-
}
|
|
227
|
-
}, [agent.id, loadGrants]);
|
|
228
|
-
useEffect(() => {
|
|
229
|
-
void load();
|
|
230
|
-
}, [load]);
|
|
231
|
-
const run = async (action, done) => {
|
|
232
|
-
setBusy(true);
|
|
233
|
-
try {
|
|
234
|
-
await action();
|
|
235
|
-
toast.success(done);
|
|
236
|
-
await load();
|
|
237
|
-
} catch (err) {
|
|
238
|
-
toast.error(errorMessage(err));
|
|
239
|
-
} finally {
|
|
240
|
-
setBusy(false);
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const mine = grants?.find(
|
|
244
|
-
(grant) => grant.isMine && grant.status === "ACTIVE"
|
|
245
|
-
);
|
|
246
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", "data-testid": `agent-grants-${agent.id}`, children: [
|
|
247
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-2", children: mine ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
248
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-text-primary", children: mine.expiresAt ? tr(
|
|
249
|
-
"fluidgrids.agents.myGrantUntil",
|
|
250
|
-
"This agent may act for you until {{date}}.",
|
|
251
|
-
{ date: new Date(mine.expiresAt).toLocaleDateString() }
|
|
252
|
-
) : tr(
|
|
253
|
-
"fluidgrids.agents.myGrant",
|
|
254
|
-
"This agent may act for you."
|
|
255
|
-
) }),
|
|
256
|
-
/* @__PURE__ */ jsx(
|
|
257
|
-
Button,
|
|
258
|
-
{
|
|
259
|
-
variant: "outline",
|
|
260
|
-
size: "sm",
|
|
261
|
-
disabled: busy,
|
|
262
|
-
onClick: () => void run(
|
|
263
|
-
() => onRevoke(agent.id, null),
|
|
264
|
-
tr("fluidgrids.agents.withdrawn", "Grant withdrawn")
|
|
265
|
-
),
|
|
266
|
-
"data-testid": "agent-grant-withdraw",
|
|
267
|
-
children: tr("fluidgrids.agents.withdraw", "Withdraw my grant")
|
|
268
|
-
}
|
|
269
|
-
)
|
|
270
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
271
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: `grant-days-${agent.id}`, className: "text-sm", children: tr("fluidgrids.agents.grantFor", "Let it act for me for") }),
|
|
272
|
-
/* @__PURE__ */ jsx(
|
|
273
|
-
Input,
|
|
274
|
-
{
|
|
275
|
-
id: `grant-days-${agent.id}`,
|
|
276
|
-
className: "w-20",
|
|
277
|
-
type: "number",
|
|
278
|
-
min: 1,
|
|
279
|
-
max: MAX_GRANT_DAYS,
|
|
280
|
-
value: days,
|
|
281
|
-
onChange: (e) => setDays(e.target.value)
|
|
282
|
-
}
|
|
283
|
-
),
|
|
284
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-text-secondary", children: tr("fluidgrids.agents.days", "days") }),
|
|
285
|
-
/* @__PURE__ */ jsx(
|
|
286
|
-
Button,
|
|
287
|
-
{
|
|
288
|
-
size: "sm",
|
|
289
|
-
disabled: busy || agent.status !== "ACTIVE",
|
|
290
|
-
onClick: () => void run(
|
|
291
|
-
async () => onGrant(agent.id, grantDays(days)),
|
|
292
|
-
tr("fluidgrids.agents.granted", "Grant given")
|
|
293
|
-
),
|
|
294
|
-
"data-testid": "agent-grant-give",
|
|
295
|
-
children: tr("fluidgrids.agents.grant", "Grant")
|
|
296
|
-
}
|
|
297
|
-
)
|
|
298
|
-
] }) }),
|
|
299
|
-
grants && grants.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "space-y-1 text-xs text-text-secondary", children: grants.map((grant) => /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-2", children: [
|
|
300
|
-
/* @__PURE__ */ jsx("span", { className: "font-mono", children: grant.userId }),
|
|
301
|
-
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: grant.status }),
|
|
302
|
-
grant.expiresAt ? /* @__PURE__ */ jsx("span", { children: tr("fluidgrids.agents.until", "until {{date}}", {
|
|
303
|
-
date: new Date(grant.expiresAt).toLocaleDateString()
|
|
304
|
-
}) }) : null,
|
|
305
|
-
!grant.isMine && grant.status === "ACTIVE" ? /* @__PURE__ */ jsx(
|
|
306
|
-
Button,
|
|
307
|
-
{
|
|
308
|
-
variant: "ghost",
|
|
309
|
-
size: "sm",
|
|
310
|
-
disabled: busy,
|
|
311
|
-
onClick: () => void run(
|
|
312
|
-
() => onRevoke(agent.id, grant.userId),
|
|
313
|
-
tr("fluidgrids.agents.revoked", "Grant revoked")
|
|
314
|
-
),
|
|
315
|
-
children: tr("fluidgrids.agents.revoke", "Revoke")
|
|
316
|
-
}
|
|
317
|
-
) : null
|
|
318
|
-
] }, grant.userId)) }) : null
|
|
319
|
-
] });
|
|
320
|
-
}
|
|
321
|
-
function AgentsTab() {
|
|
322
|
-
const tr = useTr();
|
|
323
|
-
const { agents, loading, error, save, remove, grants, grant, revoke } = useAgentDefinitions();
|
|
324
|
-
const [editing, setEditing] = useState(null);
|
|
325
|
-
const onSave = async (form) => {
|
|
326
|
-
const input = formToInput(form);
|
|
327
|
-
await save(editing?.id ?? null, input);
|
|
328
|
-
toast.success(tr("fluidgrids.agents.saved", "Agent saved"));
|
|
329
|
-
setEditing(null);
|
|
330
|
-
};
|
|
331
|
-
const onDelete = async (agent) => {
|
|
332
|
-
try {
|
|
333
|
-
await remove(agent.id);
|
|
334
|
-
toast.success(tr("fluidgrids.agents.deleted", "Agent deleted"));
|
|
335
|
-
} catch (err) {
|
|
336
|
-
toast.error(errorMessage(err));
|
|
337
|
-
}
|
|
338
|
-
};
|
|
339
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-4", "data-testid": "agents-tab", children: [
|
|
340
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
|
|
341
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
342
|
-
/* @__PURE__ */ jsx("h3", { className: "text-base font-semibold text-text-primary", children: tr("fluidgrids.agents.title", "Agents") }),
|
|
343
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-text-secondary", children: tr(
|
|
344
|
-
"fluidgrids.agents.subtitle",
|
|
345
|
-
"Give an AI Agent node an identity of its own. It can only call the tools and connections you allow, only for people who granted it, and every tool call is recorded under the agent and the person."
|
|
346
|
-
) })
|
|
347
|
-
] }),
|
|
348
|
-
!editing ? /* @__PURE__ */ jsxs(
|
|
349
|
-
Button,
|
|
350
|
-
{
|
|
351
|
-
onClick: () => setEditing({ id: null, form: emptyAgentForm() }),
|
|
352
|
-
"data-testid": "agent-definition-new",
|
|
353
|
-
children: [
|
|
354
|
-
/* @__PURE__ */ jsx(Icon, { icon: "mdi:plus", width: 16 }),
|
|
355
|
-
tr("fluidgrids.agents.new", "New agent")
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
) : null
|
|
359
|
-
] }),
|
|
360
|
-
editing ? /* @__PURE__ */ jsx(
|
|
361
|
-
AgentEditor,
|
|
362
|
-
{
|
|
363
|
-
initial: editing.form,
|
|
364
|
-
onCancel: () => setEditing(null),
|
|
365
|
-
onSave
|
|
366
|
-
}
|
|
367
|
-
) : null,
|
|
368
|
-
error ? /* @__PURE__ */ jsx("p", { className: "text-sm text-destructive", children: errorMessage(error) }) : null,
|
|
369
|
-
loading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-text-secondary", children: tr("fluidgrids.agents.loading", "Loading agents\u2026") }) : agents.length === 0 && !error ? /* @__PURE__ */ jsx("p", { className: "text-sm text-text-secondary", children: tr("fluidgrids.agents.empty", "No agents yet.") }) : /* @__PURE__ */ jsx("ul", { className: "space-y-3", children: agents.map((agent) => /* @__PURE__ */ jsxs(
|
|
370
|
-
"li",
|
|
371
|
-
{
|
|
372
|
-
className: "rounded-lg border border-border-secondary bg-background-secondary p-3 space-y-2",
|
|
373
|
-
"data-testid": `agent-definition-${agent.id}`,
|
|
374
|
-
children: [
|
|
375
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
|
|
376
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
377
|
-
/* @__PURE__ */ jsx(Icon, { icon: "mdi:robot-outline", width: 18 }),
|
|
378
|
-
/* @__PURE__ */ jsx("span", { className: "font-medium text-text-primary", children: agent.name }),
|
|
379
|
-
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: agent.status }),
|
|
380
|
-
agent.requireToolApproval ? /* @__PURE__ */ jsx(Badge, { variant: "outline", children: tr(
|
|
381
|
-
"fluidgrids.agents.approvalBadge",
|
|
382
|
-
"Approval required"
|
|
383
|
-
) }) : null
|
|
384
|
-
] }),
|
|
385
|
-
/* @__PURE__ */ jsxs("div", { className: "flex gap-1", children: [
|
|
386
|
-
/* @__PURE__ */ jsx(
|
|
387
|
-
Button,
|
|
388
|
-
{
|
|
389
|
-
variant: "ghost",
|
|
390
|
-
size: "sm",
|
|
391
|
-
onClick: () => setEditing({ id: agent.id, form: agentToForm(agent) }),
|
|
392
|
-
children: tr("fluidgrids.agents.edit", "Edit")
|
|
393
|
-
}
|
|
394
|
-
),
|
|
395
|
-
/* @__PURE__ */ jsx(
|
|
396
|
-
Button,
|
|
397
|
-
{
|
|
398
|
-
variant: "ghost",
|
|
399
|
-
size: "sm",
|
|
400
|
-
onClick: () => void onDelete(agent),
|
|
401
|
-
children: tr("fluidgrids.agents.delete", "Delete")
|
|
402
|
-
}
|
|
403
|
-
)
|
|
404
|
-
] })
|
|
405
|
-
] }),
|
|
406
|
-
agent.description ? /* @__PURE__ */ jsx("p", { className: "text-sm text-text-secondary", children: agent.description }) : null,
|
|
407
|
-
/* @__PURE__ */ jsx("div", { className: "text-xs text-text-secondary", children: agent.toolAllowlist.length > 0 ? agent.toolAllowlist.map(describeRule).join(" \xB7 ") : tr("fluidgrids.agents.noTools", "No tools allowed") }),
|
|
408
|
-
/* @__PURE__ */ jsx("div", { className: "text-xs text-text-tertiary", children: tr(
|
|
409
|
-
"fluidgrids.agents.connectionCount",
|
|
410
|
-
"{{count}} connections in scope",
|
|
411
|
-
{ count: agent.connectionScope.length }
|
|
412
|
-
) }),
|
|
413
|
-
/* @__PURE__ */ jsx(
|
|
414
|
-
AgentGrants,
|
|
415
|
-
{
|
|
416
|
-
agent,
|
|
417
|
-
loadGrants: grants,
|
|
418
|
-
onGrant: grant,
|
|
419
|
-
onRevoke: revoke
|
|
420
|
-
}
|
|
421
|
-
)
|
|
422
|
-
]
|
|
423
|
-
},
|
|
424
|
-
agent.id
|
|
425
|
-
)) })
|
|
426
|
-
] });
|
|
427
|
-
}
|
|
428
|
-
var NONE = "__no_agent__";
|
|
429
|
-
function AgentDefinitionSelectField({
|
|
430
|
-
value,
|
|
431
|
-
onChange,
|
|
432
|
-
sectionLabelClassName,
|
|
433
|
-
testIdPrefix = "ndv"
|
|
434
|
-
}) {
|
|
435
|
-
const tr = useTr();
|
|
436
|
-
const { agents, loading } = useAgentDefinitionList();
|
|
437
|
-
const selected = value ? agents.find((agent) => agent.id === value) : void 0;
|
|
438
|
-
const missing = Boolean(value) && !loading && !selected;
|
|
439
|
-
return /* @__PURE__ */ jsxs(
|
|
440
|
-
"section",
|
|
441
|
-
{
|
|
442
|
-
className: "space-y-2",
|
|
443
|
-
"data-testid": `${testIdPrefix}-agent-identity`,
|
|
444
|
-
children: [
|
|
445
|
-
/* @__PURE__ */ jsx("div", { className: sectionLabelClassName, children: tr("fluidgrids.builder.agentIdentity.label", "Agent identity") }),
|
|
446
|
-
/* @__PURE__ */ jsxs(
|
|
447
|
-
Select,
|
|
448
|
-
{
|
|
449
|
-
value: value ?? NONE,
|
|
450
|
-
onValueChange: (next) => onChange(next === NONE ? null : next),
|
|
451
|
-
children: [
|
|
452
|
-
/* @__PURE__ */ jsx(
|
|
453
|
-
SelectTrigger,
|
|
454
|
-
{
|
|
455
|
-
className: "w-full",
|
|
456
|
-
"data-testid": `${testIdPrefix}-agent-identity-select`,
|
|
457
|
-
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
458
|
-
}
|
|
459
|
-
),
|
|
460
|
-
/* @__PURE__ */ jsxs(
|
|
461
|
-
SelectContent,
|
|
462
|
-
{
|
|
463
|
-
style: { zIndex: 1100 },
|
|
464
|
-
children: [
|
|
465
|
-
/* @__PURE__ */ jsx(SelectItem, { value: NONE, children: tr(
|
|
466
|
-
"fluidgrids.builder.agentIdentity.none",
|
|
467
|
-
"None (tools run as the workflow)"
|
|
468
|
-
) }),
|
|
469
|
-
agents.map((agent) => /* @__PURE__ */ jsx(
|
|
470
|
-
SelectItem,
|
|
471
|
-
{
|
|
472
|
-
value: agent.id,
|
|
473
|
-
disabled: agent.status !== "ACTIVE",
|
|
474
|
-
children: agent.name
|
|
475
|
-
},
|
|
476
|
-
agent.id
|
|
477
|
-
))
|
|
478
|
-
]
|
|
479
|
-
}
|
|
480
|
-
)
|
|
481
|
-
]
|
|
482
|
-
}
|
|
483
|
-
),
|
|
484
|
-
selected ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: selected.toolAllowlist.length > 0 ? tr(
|
|
485
|
-
"fluidgrids.builder.agentIdentity.allows",
|
|
486
|
-
"Allowed tools: {{tools}}. Each tool call needs a grant from the person the run is attributed to.",
|
|
487
|
-
{ tools: selected.toolAllowlist.map(describeRule).join(" \xB7 ") }
|
|
488
|
-
) : tr(
|
|
489
|
-
"fluidgrids.builder.agentIdentity.noTools",
|
|
490
|
-
"This agent allows no tools."
|
|
491
|
-
) }) : null,
|
|
492
|
-
missing ? /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: tr(
|
|
493
|
-
"fluidgrids.builder.agentIdentity.missing",
|
|
494
|
-
"The selected agent no longer exists in this workspace; saving will be refused."
|
|
495
|
-
) }) : null
|
|
496
|
-
]
|
|
497
|
-
}
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
export { AgentDefinitionSelectField, AgentsTab };
|