@burdenoff/microfe-botmanor 2026.1123.4 → 2026.1123.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,40 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { ListBotmanorAgentsPageDocument as e } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { useBotlit as t } from "../providers/BotlitProvider.js";
|
|
3
|
+
import { graphqlErrorMessage as n } from "../utils/errors.js";
|
|
4
|
+
import { buildMutationInput as r, fieldsOf as i } from "./internal/mutationInput.js";
|
|
5
|
+
import { useWorkspacePaginatedQuery as a, useWorkspaceQuery as o } from "./internal/workspaceGateway.js";
|
|
6
|
+
import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
7
|
+
import { gql as d } from "@apollo/client";
|
|
8
|
+
import { useGatewayClient as f } from "@burdenoff/fe-libs/shared/graphql";
|
|
8
9
|
// src/botlit/hooks/useAgents.ts
|
|
9
|
-
var
|
|
10
|
-
query ListBotmanorAgents($filters: BotmanorAgentFilterInput, $pagination: PaginationInput) {
|
|
11
|
-
listBotmanorAgents(filters: $filters, pagination: $pagination) {
|
|
12
|
-
id
|
|
13
|
-
name
|
|
14
|
-
slug
|
|
15
|
-
description
|
|
16
|
-
avatar
|
|
17
|
-
type
|
|
18
|
-
status
|
|
19
|
-
visibility
|
|
20
|
-
capabilities
|
|
21
|
-
llmModelId
|
|
22
|
-
fallbackModelIds
|
|
23
|
-
bucketId
|
|
24
|
-
executionCount
|
|
25
|
-
lastExecutedAt
|
|
26
|
-
specialization
|
|
27
|
-
tagIds
|
|
28
|
-
tags
|
|
29
|
-
knowledgeBaseIds
|
|
30
|
-
createdAt
|
|
31
|
-
updatedAt
|
|
32
|
-
createdById
|
|
33
|
-
updatedById
|
|
34
|
-
workspaceId
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`, p = u`
|
|
10
|
+
var p = d`
|
|
38
11
|
query GetBotmanorAgent($id: ID!) {
|
|
39
12
|
getBotmanorAgent(id: $id) {
|
|
40
13
|
id
|
|
@@ -71,7 +44,7 @@ var f = u`
|
|
|
71
44
|
workspaceId
|
|
72
45
|
}
|
|
73
46
|
}
|
|
74
|
-
`, m =
|
|
47
|
+
`, m = d`
|
|
75
48
|
mutation CreateBotmanorAgent($input: CreateBotmanorAgentInput!) {
|
|
76
49
|
createBotmanorAgent(input: $input) {
|
|
77
50
|
id
|
|
@@ -96,7 +69,7 @@ var f = u`
|
|
|
96
69
|
workspaceId
|
|
97
70
|
}
|
|
98
71
|
}
|
|
99
|
-
`, h =
|
|
72
|
+
`, h = d`
|
|
100
73
|
mutation UpdateBotmanorAgent($id: ID!, $input: UpdateBotmanorAgentInput!) {
|
|
101
74
|
updateBotmanorAgent(id: $id, input: $input) {
|
|
102
75
|
id
|
|
@@ -126,11 +99,11 @@ var f = u`
|
|
|
126
99
|
workspaceId
|
|
127
100
|
}
|
|
128
101
|
}
|
|
129
|
-
`, g =
|
|
102
|
+
`, g = d`
|
|
130
103
|
mutation DeleteBotmanorAgent($id: ID!) {
|
|
131
104
|
deleteBotmanorAgent(id: $id)
|
|
132
105
|
}
|
|
133
|
-
`, _ =
|
|
106
|
+
`, _ = d`
|
|
134
107
|
query ListAgentVersions($agentId: ID!, $pagination: PaginationInput) {
|
|
135
108
|
listAgentVersions(agentId: $agentId, pagination: $pagination) {
|
|
136
109
|
id
|
|
@@ -145,7 +118,7 @@ var f = u`
|
|
|
145
118
|
publishedAt
|
|
146
119
|
}
|
|
147
120
|
}
|
|
148
|
-
`, v =
|
|
121
|
+
`, v = d`
|
|
149
122
|
mutation PublishAgentVersion($agentId: ID!, $versionId: ID!, $changelog: String) {
|
|
150
123
|
publishAgentVersion(agentId: $agentId, versionId: $versionId, changelog: $changelog) {
|
|
151
124
|
id
|
|
@@ -157,7 +130,7 @@ var f = u`
|
|
|
157
130
|
publishedAt
|
|
158
131
|
}
|
|
159
132
|
}
|
|
160
|
-
`, y =
|
|
133
|
+
`, y = d`
|
|
161
134
|
mutation RollbackAgentVersion($agentId: ID!, $targetVersionId: ID!) {
|
|
162
135
|
rollbackAgentVersion(agentId: $agentId, targetVersionId: $targetVersionId) {
|
|
163
136
|
id
|
|
@@ -169,7 +142,7 @@ var f = u`
|
|
|
169
142
|
publishedAt
|
|
170
143
|
}
|
|
171
144
|
}
|
|
172
|
-
`, b = 100, x = [], S =
|
|
145
|
+
`, b = 100, x = [], S = i({
|
|
173
146
|
avatar: !0,
|
|
174
147
|
bucketId: !0,
|
|
175
148
|
capabilities: !0,
|
|
@@ -194,9 +167,9 @@ var f = u`
|
|
|
194
167
|
visibility: !0,
|
|
195
168
|
workflowIds: !0
|
|
196
169
|
});
|
|
197
|
-
function C(e,
|
|
170
|
+
function C(e, t) {
|
|
198
171
|
let r = e.error;
|
|
199
|
-
if (r != null) throw Error(
|
|
172
|
+
if (r != null) throw Error(n(r, t), { cause: r });
|
|
200
173
|
}
|
|
201
174
|
function w(e) {
|
|
202
175
|
return e;
|
|
@@ -210,20 +183,21 @@ function T(e, t) {
|
|
|
210
183
|
bucketId: t?.bucketId
|
|
211
184
|
};
|
|
212
185
|
}
|
|
213
|
-
function E(
|
|
214
|
-
let { workspaceId:
|
|
215
|
-
return
|
|
216
|
-
document:
|
|
217
|
-
variables:
|
|
186
|
+
function E(n, r) {
|
|
187
|
+
let { workspaceId: i } = t(), o = l(() => ({ filters: T(i, n) }), [n, i]);
|
|
188
|
+
return a({
|
|
189
|
+
document: e,
|
|
190
|
+
variables: o,
|
|
218
191
|
pageSize: b,
|
|
219
|
-
extractRows: (e) => e?.
|
|
192
|
+
extractRows: (e) => e?.listBotmanorAgentsPage.items ?? [],
|
|
193
|
+
extractNextOffset: (e) => e?.listBotmanorAgentsPage.nextOffset ?? null,
|
|
220
194
|
select: (e) => e,
|
|
221
195
|
fallback: x,
|
|
222
|
-
enabled: !!
|
|
196
|
+
enabled: !!i && r?.enabled !== !1,
|
|
223
197
|
errorMessage: "Failed to load agents"
|
|
224
198
|
});
|
|
225
199
|
}
|
|
226
|
-
var D =
|
|
200
|
+
var D = d`
|
|
227
201
|
query GetBotmanorAgentCounts {
|
|
228
202
|
getBotmanorAgentCounts {
|
|
229
203
|
total
|
|
@@ -235,18 +209,18 @@ var D = u`
|
|
|
235
209
|
}
|
|
236
210
|
}
|
|
237
211
|
`;
|
|
238
|
-
function O(
|
|
239
|
-
let { workspaceId: n } =
|
|
240
|
-
return
|
|
212
|
+
function O(e = !0) {
|
|
213
|
+
let { workspaceId: n } = t(), r = l(() => ({}), []);
|
|
214
|
+
return o({
|
|
241
215
|
document: D,
|
|
242
216
|
variables: r,
|
|
243
217
|
select: (e) => e?.getBotmanorAgentCounts ?? null,
|
|
244
218
|
fallback: null,
|
|
245
|
-
enabled:
|
|
219
|
+
enabled: e && !!n,
|
|
246
220
|
errorMessage: "Failed to load agent counts"
|
|
247
221
|
});
|
|
248
222
|
}
|
|
249
|
-
var k =
|
|
223
|
+
var k = d`
|
|
250
224
|
query GetBotmanorAgentUsage($id: ID!) {
|
|
251
225
|
getBotmanorAgentUsage(id: $id) {
|
|
252
226
|
bots {
|
|
@@ -263,8 +237,8 @@ var k = u`
|
|
|
263
237
|
}
|
|
264
238
|
`;
|
|
265
239
|
function A() {
|
|
266
|
-
let e = w(
|
|
267
|
-
return
|
|
240
|
+
let e = w(f("workspace"));
|
|
241
|
+
return s(async (t) => {
|
|
268
242
|
let n = await e.query({
|
|
269
243
|
query: k,
|
|
270
244
|
variables: { id: t },
|
|
@@ -279,10 +253,10 @@ function A() {
|
|
|
279
253
|
}, [e]);
|
|
280
254
|
}
|
|
281
255
|
function j(e) {
|
|
282
|
-
let t = w(
|
|
256
|
+
let t = w(f("workspace")), [n, r] = u(null), [i, a] = u(!!e), [o, l] = u(), d = s(async () => {
|
|
283
257
|
if (!e) r(null), a(!1);
|
|
284
258
|
else {
|
|
285
|
-
a(!0),
|
|
259
|
+
a(!0), l(void 0);
|
|
286
260
|
try {
|
|
287
261
|
let n = await t.query({
|
|
288
262
|
query: p,
|
|
@@ -292,40 +266,40 @@ function j(e) {
|
|
|
292
266
|
if (i != null) throw i instanceof Error ? i : /* @__PURE__ */ Error("Failed to load agent");
|
|
293
267
|
r(n.data?.getBotmanorAgent ?? null);
|
|
294
268
|
} catch (e) {
|
|
295
|
-
r(null),
|
|
269
|
+
r(null), l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load agent"));
|
|
296
270
|
} finally {
|
|
297
271
|
a(!1);
|
|
298
272
|
}
|
|
299
273
|
}
|
|
300
274
|
}, [e, t]);
|
|
301
|
-
return
|
|
302
|
-
|
|
303
|
-
}, [
|
|
275
|
+
return c(() => {
|
|
276
|
+
d();
|
|
277
|
+
}, [d]), {
|
|
304
278
|
data: n,
|
|
305
279
|
loading: i,
|
|
306
|
-
error:
|
|
307
|
-
refetch:
|
|
280
|
+
error: o,
|
|
281
|
+
refetch: d
|
|
308
282
|
};
|
|
309
283
|
}
|
|
310
284
|
function M() {
|
|
311
|
-
let e = w(
|
|
285
|
+
let e = w(f("workspace")), [t, r] = u({
|
|
312
286
|
data: void 0,
|
|
313
287
|
loading: !1,
|
|
314
288
|
error: void 0
|
|
315
289
|
});
|
|
316
|
-
return [
|
|
290
|
+
return [s(async (t) => {
|
|
317
291
|
r({
|
|
318
292
|
data: void 0,
|
|
319
293
|
loading: !0,
|
|
320
294
|
error: void 0
|
|
321
295
|
});
|
|
322
296
|
try {
|
|
323
|
-
let
|
|
297
|
+
let n = await e.mutate({
|
|
324
298
|
mutation: m,
|
|
325
|
-
variables: { input:
|
|
299
|
+
variables: { input: t }
|
|
326
300
|
});
|
|
327
|
-
C(
|
|
328
|
-
let i =
|
|
301
|
+
C(n, "Failed to create agent");
|
|
302
|
+
let i = n.data?.createBotmanorAgent;
|
|
329
303
|
if (!i) throw Error("Failed to create agent");
|
|
330
304
|
return r({
|
|
331
305
|
data: i,
|
|
@@ -333,37 +307,37 @@ function M() {
|
|
|
333
307
|
error: void 0
|
|
334
308
|
}), i;
|
|
335
309
|
} catch (e) {
|
|
336
|
-
let
|
|
310
|
+
let t = Error(n(e, "Failed to create agent"), { cause: e });
|
|
337
311
|
throw r({
|
|
338
312
|
data: void 0,
|
|
339
313
|
loading: !1,
|
|
340
|
-
error:
|
|
341
|
-
}),
|
|
314
|
+
error: t
|
|
315
|
+
}), t;
|
|
342
316
|
}
|
|
343
|
-
}, [e]),
|
|
317
|
+
}, [e]), t];
|
|
344
318
|
}
|
|
345
319
|
function N() {
|
|
346
|
-
let e = w(
|
|
320
|
+
let e = w(f("workspace")), [t, i] = u({
|
|
347
321
|
data: void 0,
|
|
348
322
|
loading: !1,
|
|
349
323
|
error: void 0
|
|
350
324
|
});
|
|
351
|
-
return [
|
|
325
|
+
return [s(async ({ agentId: t, input: a }) => {
|
|
352
326
|
i({
|
|
353
327
|
data: void 0,
|
|
354
328
|
loading: !0,
|
|
355
329
|
error: void 0
|
|
356
330
|
});
|
|
357
331
|
try {
|
|
358
|
-
let
|
|
332
|
+
let n = await e.mutate({
|
|
359
333
|
mutation: h,
|
|
360
334
|
variables: {
|
|
361
|
-
id:
|
|
362
|
-
input:
|
|
335
|
+
id: t,
|
|
336
|
+
input: r(a, S)
|
|
363
337
|
}
|
|
364
338
|
});
|
|
365
|
-
C(
|
|
366
|
-
let o =
|
|
339
|
+
C(n, "Failed to update agent");
|
|
340
|
+
let o = n.data?.updateBotmanorAgent;
|
|
367
341
|
if (!o) throw Error("Failed to update agent");
|
|
368
342
|
return i({
|
|
369
343
|
data: o,
|
|
@@ -371,54 +345,54 @@ function N() {
|
|
|
371
345
|
error: void 0
|
|
372
346
|
}), o;
|
|
373
347
|
} catch (e) {
|
|
374
|
-
let
|
|
348
|
+
let t = Error(n(e, "Failed to update agent"), { cause: e });
|
|
375
349
|
throw i({
|
|
376
350
|
data: void 0,
|
|
377
351
|
loading: !1,
|
|
378
|
-
error:
|
|
379
|
-
}),
|
|
352
|
+
error: t
|
|
353
|
+
}), t;
|
|
380
354
|
}
|
|
381
|
-
}, [e]),
|
|
355
|
+
}, [e]), t];
|
|
382
356
|
}
|
|
383
357
|
function P() {
|
|
384
|
-
let e = w(
|
|
358
|
+
let e = w(f("workspace")), [t, r] = u({
|
|
385
359
|
data: void 0,
|
|
386
360
|
loading: !1,
|
|
387
361
|
error: void 0
|
|
388
362
|
});
|
|
389
|
-
return [
|
|
363
|
+
return [s(async (t) => {
|
|
390
364
|
r({
|
|
391
365
|
data: void 0,
|
|
392
366
|
loading: !0,
|
|
393
367
|
error: void 0
|
|
394
368
|
});
|
|
395
369
|
try {
|
|
396
|
-
let
|
|
370
|
+
let n = await e.mutate({
|
|
397
371
|
mutation: g,
|
|
398
|
-
variables: { id:
|
|
372
|
+
variables: { id: t }
|
|
399
373
|
});
|
|
400
|
-
C(
|
|
401
|
-
let i =
|
|
374
|
+
C(n, "Failed to delete agent");
|
|
375
|
+
let i = n.data?.deleteBotmanorAgent ?? !1;
|
|
402
376
|
return r({
|
|
403
377
|
data: i,
|
|
404
378
|
loading: !1,
|
|
405
379
|
error: void 0
|
|
406
380
|
}), i;
|
|
407
381
|
} catch (e) {
|
|
408
|
-
let
|
|
382
|
+
let t = Error(n(e, "Failed to delete agent"), { cause: e });
|
|
409
383
|
throw r({
|
|
410
384
|
data: void 0,
|
|
411
385
|
loading: !1,
|
|
412
|
-
error:
|
|
413
|
-
}),
|
|
386
|
+
error: t
|
|
387
|
+
}), t;
|
|
414
388
|
}
|
|
415
|
-
}, [e]),
|
|
389
|
+
}, [e]), t];
|
|
416
390
|
}
|
|
417
391
|
function F(e) {
|
|
418
|
-
let t = w(
|
|
392
|
+
let t = w(f("workspace")), [n, r] = u([]), [i, a] = u(!1), [o, l] = u(), d = s(async () => {
|
|
419
393
|
if (!e) r([]);
|
|
420
394
|
else {
|
|
421
|
-
a(!0),
|
|
395
|
+
a(!0), l(void 0);
|
|
422
396
|
try {
|
|
423
397
|
let n = (await t.query({
|
|
424
398
|
query: _,
|
|
@@ -433,28 +407,28 @@ function F(e) {
|
|
|
433
407
|
})).data?.listAgentVersions ?? [];
|
|
434
408
|
r([...n].sort((e, t) => e.createdAt && t.createdAt ? t.createdAt.localeCompare(e.createdAt) : 0));
|
|
435
409
|
} catch (e) {
|
|
436
|
-
|
|
410
|
+
l(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to load agent versions"));
|
|
437
411
|
} finally {
|
|
438
412
|
a(!1);
|
|
439
413
|
}
|
|
440
414
|
}
|
|
441
415
|
}, [e, t]);
|
|
442
|
-
return
|
|
443
|
-
|
|
444
|
-
}, [
|
|
416
|
+
return c(() => {
|
|
417
|
+
d();
|
|
418
|
+
}, [d]), {
|
|
445
419
|
data: n,
|
|
446
420
|
loading: i,
|
|
447
|
-
error:
|
|
448
|
-
refetch:
|
|
421
|
+
error: o,
|
|
422
|
+
refetch: d
|
|
449
423
|
};
|
|
450
424
|
}
|
|
451
425
|
function I() {
|
|
452
|
-
let e = w(
|
|
426
|
+
let e = w(f("workspace")), [t, n] = u({
|
|
453
427
|
data: void 0,
|
|
454
428
|
loading: !1,
|
|
455
429
|
error: void 0
|
|
456
430
|
});
|
|
457
|
-
return [
|
|
431
|
+
return [s(async ({ agentId: t, versionId: r, changelog: i }) => {
|
|
458
432
|
n({
|
|
459
433
|
data: void 0,
|
|
460
434
|
loading: !0,
|
|
@@ -486,12 +460,12 @@ function I() {
|
|
|
486
460
|
}, [e]), t];
|
|
487
461
|
}
|
|
488
462
|
function L() {
|
|
489
|
-
let e = w(
|
|
463
|
+
let e = w(f("workspace")), [t, n] = u({
|
|
490
464
|
data: void 0,
|
|
491
465
|
loading: !1,
|
|
492
466
|
error: void 0
|
|
493
467
|
});
|
|
494
|
-
return [
|
|
468
|
+
return [s(async ({ agentId: t, targetVersionId: r }) => {
|
|
495
469
|
n({
|
|
496
470
|
data: void 0,
|
|
497
471
|
loading: !0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgents.js","names":["LIST_AGENTS_DOCUMENT","GET_AGENT_DOCUMENT","CREATE_AGENT_DOCUMENT","UPDATE_AGENT_DOCUMENT","DELETE_AGENT_DOCUMENT","LIST_AGENT_VERSIONS_DOCUMENT","PUBLISH_AGENT_VERSION_DOCUMENT","ROLLBACK_AGENT_VERSION_DOCUMENT","LIST_PAGE_SIZE","NO_AGENTS","UPDATE_AGENT_FIELDS","fieldsOf","throwOperationError","operationError","result","graphqlErrorMessage","fallback","getWorkspaceClient","client","buildAgentFilter","workspaceId","filter","useAgents","useBotlit","variables","useMemo","useWorkspacePaginatedQuery","data","rows","options","GET_AGENT_COUNTS_DOCUMENT","useAgentCounts","useWorkspaceQuery","enabled","GET_AGENT_USAGE_DOCUMENT","useLoadAgentUsage","useGatewayClient","useCallback","agentId","useAgent","setData","useState","loading","setLoading","error","setError","refetch","queryError","useEffect","useCreateAgent","state","setState","createdAgent","mutationError","useUpdateAgent","buildMutationInput","input","updatedAgent","useDeleteAgent","deleted","useAgentVersions","versions","a","b","usePublishAgentVersion","published","changelog","useRollbackAgentVersion","rolledBack"],"sources":["../../../src/botlit/hooks/useAgents.ts"],"sourcesContent":["import { gql, type ApolloClient } from '@apollo/client';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\n\nimport type { UpdateBotmanorAgentInput } from '../../generated/wspace-types';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport type { AgentFilter } from '../types';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspacePaginatedQuery,\n useWorkspaceQuery,\n type PaginatedQueryResult,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_AGENTS_DOCUMENT = gql`\n query ListBotmanorAgents($filters: BotmanorAgentFilterInput, $pagination: PaginationInput) {\n listBotmanorAgents(filters: $filters, pagination: $pagination) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n bucketId\n executionCount\n lastExecutedAt\n specialization\n tagIds\n tags\n knowledgeBaseIds\n createdAt\n updatedAt\n createdById\n updatedById\n workspaceId\n }\n }\n`;\n\nconst GET_AGENT_DOCUMENT = gql`\n query GetBotmanorAgent($id: ID!) {\n getBotmanorAgent(id: $id) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n bucketId\n currentVersionId\n draftVersionId\n executionCount\n lastExecutedAt\n specialization\n systemPrompt\n temperature\n maxTokens\n maxConcurrentExecutions\n knowledgeBaseIds\n mcpConnectionIds\n workflowIds\n tagIds\n tags\n metadata\n createdAt\n updatedAt\n createdById\n updatedById\n workspaceId\n }\n }\n`;\n\nconst CREATE_AGENT_DOCUMENT = gql`\n mutation CreateBotmanorAgent($input: CreateBotmanorAgentInput!) {\n createBotmanorAgent(input: $input) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n systemPrompt\n temperature\n maxTokens\n maxConcurrentExecutions\n tagIds\n tags\n createdAt\n updatedAt\n workspaceId\n }\n }\n`;\n\nconst UPDATE_AGENT_DOCUMENT = gql`\n mutation UpdateBotmanorAgent($id: ID!, $input: UpdateBotmanorAgentInput!) {\n updateBotmanorAgent(id: $id, input: $input) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n systemPrompt\n temperature\n maxTokens\n maxConcurrentExecutions\n knowledgeBaseIds\n mcpConnectionIds\n workflowIds\n tagIds\n tags\n metadata\n createdAt\n updatedAt\n updatedById\n workspaceId\n }\n }\n`;\n\nconst DELETE_AGENT_DOCUMENT = gql`\n mutation DeleteBotmanorAgent($id: ID!) {\n deleteBotmanorAgent(id: $id)\n }\n`;\n\n// BOFF-4381: agent version history, publish, and rollback.\nconst LIST_AGENT_VERSIONS_DOCUMENT = gql`\n query ListAgentVersions($agentId: ID!, $pagination: PaginationInput) {\n listAgentVersions(agentId: $agentId, pagination: $pagination) {\n id\n agentId\n version\n status\n changelog\n config\n createdById\n createdAt\n publishedById\n publishedAt\n }\n }\n`;\n\nconst PUBLISH_AGENT_VERSION_DOCUMENT = gql`\n mutation PublishAgentVersion($agentId: ID!, $versionId: ID!, $changelog: String) {\n publishAgentVersion(agentId: $agentId, versionId: $versionId, changelog: $changelog) {\n id\n agentId\n version\n status\n changelog\n publishedById\n publishedAt\n }\n }\n`;\n\nconst ROLLBACK_AGENT_VERSION_DOCUMENT = gql`\n mutation RollbackAgentVersion($agentId: ID!, $targetVersionId: ID!) {\n rollbackAgentVersion(agentId: $agentId, targetVersionId: $targetVersionId) {\n id\n agentId\n version\n status\n changelog\n publishedById\n publishedAt\n }\n }\n`;\n\ntype WorkspaceClient = ApolloClient;\n\nexport interface AgentRecord {\n id: string;\n name: string;\n slug: string;\n description?: string | null;\n /** Emoji chosen for the agent; null means the default. */\n avatar?: string | null;\n type: string;\n status: string;\n visibility?: string | null;\n capabilities?: string[] | null;\n llmModelId?: string | null;\n /** BOFF-15360 — ordered fallback models. */\n fallbackModelIds?: string[] | null;\n bucketId?: string | null;\n currentVersionId?: string | null;\n draftVersionId?: string | null;\n executionCount?: number | null;\n lastExecutedAt?: string | null;\n specialization?: string | null;\n systemPrompt?: string | null;\n temperature?: number | null;\n maxTokens?: number | null;\n maxConcurrentExecutions?: number | null;\n knowledgeBaseIds?: string[] | null;\n mcpConnectionIds?: string[] | null;\n workflowIds?: string[] | null;\n tagIds?: string[] | null;\n /** Entity-owned universal tag records (JSON). */\n tags?: unknown;\n metadata?: Record<string, unknown> | null;\n createdAt?: string | null;\n updatedAt?: string | null;\n createdById?: string | null;\n updatedById?: string | null;\n workspaceId?: string | null;\n}\n\ninterface ListBotmanorAgentsData {\n listBotmanorAgents: AgentRecord[];\n}\n\nconst LIST_PAGE_SIZE = 100;\nconst NO_AGENTS: AgentRecord[] = [];\n\ninterface GetAgentData {\n getBotmanorAgent: AgentRecord | null;\n}\n\ninterface CreateAgentData {\n createBotmanorAgent: AgentRecord;\n}\n\ninterface UpdateAgentData {\n updateBotmanorAgent: AgentRecord;\n}\n\ninterface DeleteAgentData {\n deleteBotmanorAgent: boolean;\n}\n\nexport interface AgentVersionRecord {\n id: string;\n agentId: string;\n version: string;\n status: 'DRAFT' | 'PUBLISHED' | 'HISTORICAL';\n changelog?: string | null;\n config?: Record<string, unknown> | null;\n createdById?: string | null;\n createdAt?: string | null;\n publishedById?: string | null;\n publishedAt?: string | null;\n}\n\ninterface ListAgentVersionsData {\n listAgentVersions: AgentVersionRecord[];\n}\n\ninterface PublishAgentVersionData {\n publishAgentVersion: AgentVersionRecord;\n}\n\ninterface RollbackAgentVersionData {\n rollbackAgentVersion: AgentVersionRecord;\n}\n\ninterface AgentMutationState<T> {\n data: T | undefined;\n loading: boolean;\n error: Error | undefined;\n}\n\ninterface CreateAgentInput {\n workspaceId: string;\n name: string;\n slug?: string;\n description?: string;\n avatar?: string;\n type: string;\n systemPrompt: string;\n temperature?: number;\n maxTokens?: number;\n maxConcurrentExecutions?: number;\n capabilities?: string[];\n llmModelId?: string;\n fallbackModelIds?: string[];\n knowledgeBaseIds?: string[];\n mcpConnectionIds?: string[];\n visibility?: string;\n}\n\ninterface UpdateAgentInput {\n agentId: string;\n input: GraphQLInput<UpdateBotmanorAgentInput>;\n}\n\nconst UPDATE_AGENT_FIELDS = fieldsOf<UpdateBotmanorAgentInput>({\n avatar: true,\n bucketId: true,\n capabilities: true,\n context: true,\n description: true,\n knowledgeBaseIds: true,\n llmModelId: true,\n fallbackModelIds: true,\n maxConcurrentExecutions: true,\n maxTokens: true,\n mcpConnectionIds: true,\n metadata: true,\n name: true,\n slug: true,\n specialization: true,\n status: true,\n systemPrompt: true,\n tagIds: true,\n tags: true,\n temperature: true,\n type: true,\n visibility: true,\n workflowIds: true,\n});\n\n/**\n * Apollo v4 resolves a mutation with `result.error` set (and no data) when the\n * server answers with a GraphQL error, instead of rejecting. Throw it so the\n * caller sees the server's actionable message (\"An agent named ... already\n * exists\") and not the generic fallback.\n */\nfunction throwOperationError(result: unknown, fallback: string): void {\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw new Error(graphqlErrorMessage(operationError, fallback), { cause: operationError });\n }\n}\n\nfunction getWorkspaceClient(client: unknown): WorkspaceClient {\n return client as WorkspaceClient;\n}\n\nfunction buildAgentFilter(\n workspaceId: string | undefined,\n filter?: AgentFilter\n): Record<string, unknown> | undefined {\n if (!workspaceId && !filter) return undefined;\n\n return {\n workspaceId,\n search: filter?.search,\n status: filter?.status?.[0],\n visibility: filter?.visibility?.[0],\n bucketId: filter?.bucketId,\n };\n}\n\nexport const agentKeys = {\n all: ['agents'] as const,\n lists: () => [...agentKeys.all, 'list'] as const,\n list: (filter?: AgentFilter) => [...agentKeys.lists(), filter] as const,\n details: () => [...agentKeys.all, 'detail'] as const,\n detail: (id: string) => [...agentKeys.details(), id] as const,\n};\n\nexport function useAgents(\n filter?: AgentFilter,\n options?: { enabled?: boolean }\n): PaginatedQueryResult<AgentRecord[]> {\n const { workspaceId } = useBotlit();\n\n const variables = useMemo(\n () => ({ filters: buildAgentFilter(workspaceId, filter) }),\n [filter, workspaceId]\n );\n\n return useWorkspacePaginatedQuery<ListBotmanorAgentsData, AgentRecord, AgentRecord[]>({\n document: LIST_AGENTS_DOCUMENT,\n variables,\n pageSize: LIST_PAGE_SIZE,\n extractRows: (data) => data?.listBotmanorAgents ?? [],\n select: (rows) => rows,\n fallback: NO_AGENTS,\n enabled: Boolean(workspaceId) && options?.enabled !== false,\n errorMessage: 'Failed to load agents',\n });\n}\n\n/**\n * Exact agent counts by status for the workspace (BOFF-12426). Unlike\n * `useAgents` this is not capped at one page, so it is the source for\n * dashboard totals. `total` counts every status.\n */\nexport interface AgentCounts {\n total: number;\n draft: number;\n active: number;\n paused: number;\n training: number;\n archived: number;\n}\n\ninterface AgentCountsData {\n getBotmanorAgentCounts?: AgentCounts | null;\n}\n\nconst GET_AGENT_COUNTS_DOCUMENT = gql`\n query GetBotmanorAgentCounts {\n getBotmanorAgentCounts {\n total\n draft\n active\n paused\n training\n archived\n }\n }\n`;\n\nexport function useAgentCounts(enabled = true): QueryResult<AgentCounts | null> {\n const { workspaceId } = useBotlit();\n const variables = useMemo(() => ({}), []);\n\n return useWorkspaceQuery<AgentCountsData, AgentCounts | null>({\n document: GET_AGENT_COUNTS_DOCUMENT,\n variables,\n select: (data) => data?.getBotmanorAgentCounts ?? null,\n fallback: null,\n enabled: enabled && Boolean(workspaceId),\n errorMessage: 'Failed to load agent counts',\n });\n}\n\n/** What still uses an agent, shown in the delete confirmation (BOFF-12457). */\nexport interface AgentUsage {\n bots: Array<{ id: string; name: string; isDefault: boolean }>;\n a2aConnections: Array<{ id: string; name: string }>;\n workflowIds: string[];\n}\n\ninterface AgentUsageData {\n getBotmanorAgentUsage?: AgentUsage | null;\n}\n\nconst GET_AGENT_USAGE_DOCUMENT = gql`\n query GetBotmanorAgentUsage($id: ID!) {\n getBotmanorAgentUsage(id: $id) {\n bots {\n id\n name\n isDefault\n }\n a2aConnections {\n id\n name\n }\n workflowIds\n }\n }\n`;\n\n/** Returns a function that reads what uses an agent. Reads fresh every time, because a delete is about to rely on it. */\nexport function useLoadAgentUsage() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n\n return useCallback(\n async (agentId: string): Promise<AgentUsage> => {\n const result = await client.query<AgentUsageData>({\n query: GET_AGENT_USAGE_DOCUMENT,\n variables: { id: agentId },\n fetchPolicy: 'network-only',\n });\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw operationError instanceof Error\n ? operationError\n : new Error('Failed to load agent usage');\n }\n return (\n result.data?.getBotmanorAgentUsage ?? { bots: [], a2aConnections: [], workflowIds: [] }\n );\n },\n [client]\n );\n}\n\nexport function useAgent(agentId: string | undefined) {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [data, setData] = useState<AgentRecord | null>(null);\n // Loading from the first render when there is an id to read, so a page never\n // shows \"not found\" (or an empty form) for the frame before the read starts.\n const [loading, setLoading] = useState(Boolean(agentId));\n const [error, setError] = useState<Error | undefined>();\n\n const refetch = useCallback(async () => {\n if (!agentId) {\n setData(null);\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(undefined);\n try {\n const result = await client.query<GetAgentData>({\n query: GET_AGENT_DOCUMENT,\n variables: { id: agentId },\n fetchPolicy: 'network-only',\n });\n // Apollo v4 resolves (not rejects) with `result.error` set on GraphQL errors.\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw operationError instanceof Error ? operationError : new Error('Failed to load agent');\n }\n setData(result.data?.getBotmanorAgent ?? null);\n } catch (queryError) {\n setData(null);\n setError(queryError instanceof Error ? queryError : new Error('Failed to load agent'));\n } finally {\n setLoading(false);\n }\n }, [agentId, client]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { data, loading, error, refetch };\n}\n\nexport function useCreateAgent() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const createAgent = useCallback(\n async (input: CreateAgentInput) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<CreateAgentData>({\n mutation: CREATE_AGENT_DOCUMENT,\n variables: { input },\n });\n throwOperationError(result, 'Failed to create agent');\n\n const createdAgent = result.data?.createBotmanorAgent;\n if (!createdAgent) {\n throw new Error('Failed to create agent');\n }\n\n setState({ data: createdAgent, loading: false, error: undefined });\n return createdAgent;\n } catch (mutationError) {\n const error = new Error(graphqlErrorMessage(mutationError, 'Failed to create agent'), {\n cause: mutationError,\n });\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [createAgent, state] as const;\n}\n\nexport function useUpdateAgent() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const updateAgent = useCallback(\n async ({ agentId, input }: UpdateAgentInput) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<UpdateAgentData>({\n mutation: UPDATE_AGENT_DOCUMENT,\n variables: { id: agentId, input: buildMutationInput(input, UPDATE_AGENT_FIELDS) },\n });\n throwOperationError(result, 'Failed to update agent');\n\n const updatedAgent = result.data?.updateBotmanorAgent;\n if (!updatedAgent) {\n throw new Error('Failed to update agent');\n }\n\n setState({ data: updatedAgent, loading: false, error: undefined });\n return updatedAgent;\n } catch (mutationError) {\n const error = new Error(graphqlErrorMessage(mutationError, 'Failed to update agent'), {\n cause: mutationError,\n });\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [updateAgent, state] as const;\n}\n\nexport function useDeleteAgent() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<boolean>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const deleteAgent = useCallback(\n async (agentId: string) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<DeleteAgentData>({\n mutation: DELETE_AGENT_DOCUMENT,\n variables: { id: agentId },\n });\n throwOperationError(result, 'Failed to delete agent');\n\n const deleted = result.data?.deleteBotmanorAgent ?? false;\n setState({ data: deleted, loading: false, error: undefined });\n return deleted;\n } catch (mutationError) {\n const error = new Error(graphqlErrorMessage(mutationError, 'Failed to delete agent'), {\n cause: mutationError,\n });\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [deleteAgent, state] as const;\n}\n\n// ============================================================================\n// VERSIONING (BOFF-4381) — version history, publish, rollback\n// ============================================================================\n\nexport function useAgentVersions(agentId: string | undefined) {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [data, setData] = useState<AgentVersionRecord[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | undefined>();\n\n const refetch = useCallback(async () => {\n if (!agentId) {\n setData([]);\n return;\n }\n\n setLoading(true);\n setError(undefined);\n try {\n const result = await client.query<ListAgentVersionsData>({\n query: LIST_AGENT_VERSIONS_DOCUMENT,\n variables: { agentId, pagination: { limit: 50, offset: 0 } },\n fetchPolicy: 'network-only',\n });\n const versions = result.data?.listAgentVersions ?? [];\n // Newest first, regardless of what the server returned.\n setData(\n [...versions].sort((a, b) =>\n a.createdAt && b.createdAt ? b.createdAt.localeCompare(a.createdAt) : 0\n )\n );\n } catch (queryError) {\n setError(\n queryError instanceof Error ? queryError : new Error('Failed to load agent versions')\n );\n } finally {\n setLoading(false);\n }\n }, [agentId, client]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { data, loading, error, refetch };\n}\n\nexport function usePublishAgentVersion() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentVersionRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const publishAgentVersion = useCallback(\n async ({\n agentId,\n versionId,\n changelog,\n }: {\n agentId: string;\n versionId: string;\n changelog?: string;\n }) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<PublishAgentVersionData>({\n mutation: PUBLISH_AGENT_VERSION_DOCUMENT,\n variables: { agentId, versionId, changelog: changelog?.trim() || undefined },\n });\n\n const published = result.data?.publishAgentVersion;\n if (!published) {\n throw new Error('Failed to publish agent version');\n }\n\n setState({ data: published, loading: false, error: undefined });\n return published;\n } catch (mutationError) {\n const error =\n mutationError instanceof Error\n ? mutationError\n : new Error('Failed to publish agent version');\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [publishAgentVersion, state] as const;\n}\n\nexport function useRollbackAgentVersion() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentVersionRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const rollbackAgentVersion = useCallback(\n async ({ agentId, targetVersionId }: { agentId: string; targetVersionId: string }) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<RollbackAgentVersionData>({\n mutation: ROLLBACK_AGENT_VERSION_DOCUMENT,\n variables: { agentId, targetVersionId },\n });\n\n const rolledBack = result.data?.rollbackAgentVersion;\n if (!rolledBack) {\n throw new Error('Failed to roll back agent version');\n }\n\n setState({ data: rolledBack, loading: false, error: undefined });\n return rolledBack;\n } catch (mutationError) {\n const error =\n mutationError instanceof Error\n ? mutationError\n : new Error('Failed to roll back agent version');\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [rollbackAgentVersion, state] as const;\n}\n"],"mappings":";;;;;;;;AAgBA,IAAMA,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8B1BC,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCxBC,IAAwB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;GA2B3BC,IAAwB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgC3BC,IAAwB,CAAG;;;;GAO3BC,IAA+B,CAAG;;;;;;;;;;;;;;;GAiBlCC,IAAiC,CAAG;;;;;;;;;;;;GAcpCC,IAAkC,CAAG;;;;;;;;;;;;GA0DrCC,IAAiB,KACjBC,IAA2B,CAAC,GAyE5BC,IAAsBC,EAAmC;CAC7D,QAAQ;CACR,UAAU;CACV,cAAc;CACd,SAAS;CACT,aAAa;CACb,kBAAkB;CAClB,YAAY;CACZ,kBAAkB;CAClB,yBAAyB;CACzB,WAAW;CACX,kBAAkB;CAClB,UAAU;CACV,MAAM;CACN,MAAM;CACN,gBAAgB;CAChB,QAAQ;CACR,cAAc;CACd,QAAQ;CACR,MAAM;CACN,aAAa;CACb,MAAM;CACN,YAAY;CACZ,aAAa;AACf,CAAC;AAQD,SAASC,EAAoB,GAAiB,GAAwB;CACpE,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","LIST_AGENT_VERSIONS_DOCUMENT","PUBLISH_AGENT_VERSION_DOCUMENT","ROLLBACK_AGENT_VERSION_DOCUMENT","LIST_PAGE_SIZE","NO_AGENTS","UPDATE_AGENT_FIELDS","fieldsOf","throwOperationError","operationError","result","graphqlErrorMessage","fallback","getWorkspaceClient","client","buildAgentFilter","workspaceId","filter","useAgents","useBotlit","variables","useMemo","useWorkspacePaginatedQuery","ListBotmanorAgentsPageDocument","data","rows","options","GET_AGENT_COUNTS_DOCUMENT","useAgentCounts","useWorkspaceQuery","enabled","GET_AGENT_USAGE_DOCUMENT","useLoadAgentUsage","useGatewayClient","useCallback","agentId","useAgent","setData","useState","loading","setLoading","error","setError","refetch","queryError","useEffect","useCreateAgent","state","setState","createdAgent","mutationError","useUpdateAgent","buildMutationInput","input","updatedAgent","useDeleteAgent","deleted","useAgentVersions","versions","a","b","usePublishAgentVersion","published","changelog","useRollbackAgentVersion","rolledBack"],"sources":["../../../src/botlit/hooks/useAgents.ts"],"sourcesContent":["import { gql, type ApolloClient } from '@apollo/client';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\n\nimport {\n ListBotmanorAgentsPageDocument,\n type ListBotmanorAgentsPageQuery,\n} from '../../generated/wspace-operations';\nimport type { UpdateBotmanorAgentInput } from '../../generated/wspace-types';\nimport { useBotlit } from '../providers/BotlitProvider';\nimport type { AgentFilter } from '../types';\nimport { graphqlErrorMessage } from '../utils/errors';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspacePaginatedQuery,\n useWorkspaceQuery,\n type PaginatedQueryResult,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst GET_AGENT_DOCUMENT = gql`\n query GetBotmanorAgent($id: ID!) {\n getBotmanorAgent(id: $id) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n bucketId\n currentVersionId\n draftVersionId\n executionCount\n lastExecutedAt\n specialization\n systemPrompt\n temperature\n maxTokens\n maxConcurrentExecutions\n knowledgeBaseIds\n mcpConnectionIds\n workflowIds\n tagIds\n tags\n metadata\n createdAt\n updatedAt\n createdById\n updatedById\n workspaceId\n }\n }\n`;\n\nconst CREATE_AGENT_DOCUMENT = gql`\n mutation CreateBotmanorAgent($input: CreateBotmanorAgentInput!) {\n createBotmanorAgent(input: $input) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n systemPrompt\n temperature\n maxTokens\n maxConcurrentExecutions\n tagIds\n tags\n createdAt\n updatedAt\n workspaceId\n }\n }\n`;\n\nconst UPDATE_AGENT_DOCUMENT = gql`\n mutation UpdateBotmanorAgent($id: ID!, $input: UpdateBotmanorAgentInput!) {\n updateBotmanorAgent(id: $id, input: $input) {\n id\n name\n slug\n description\n avatar\n type\n status\n visibility\n capabilities\n llmModelId\n fallbackModelIds\n systemPrompt\n temperature\n maxTokens\n maxConcurrentExecutions\n knowledgeBaseIds\n mcpConnectionIds\n workflowIds\n tagIds\n tags\n metadata\n createdAt\n updatedAt\n updatedById\n workspaceId\n }\n }\n`;\n\nconst DELETE_AGENT_DOCUMENT = gql`\n mutation DeleteBotmanorAgent($id: ID!) {\n deleteBotmanorAgent(id: $id)\n }\n`;\n\n// BOFF-4381: agent version history, publish, and rollback.\nconst LIST_AGENT_VERSIONS_DOCUMENT = gql`\n query ListAgentVersions($agentId: ID!, $pagination: PaginationInput) {\n listAgentVersions(agentId: $agentId, pagination: $pagination) {\n id\n agentId\n version\n status\n changelog\n config\n createdById\n createdAt\n publishedById\n publishedAt\n }\n }\n`;\n\nconst PUBLISH_AGENT_VERSION_DOCUMENT = gql`\n mutation PublishAgentVersion($agentId: ID!, $versionId: ID!, $changelog: String) {\n publishAgentVersion(agentId: $agentId, versionId: $versionId, changelog: $changelog) {\n id\n agentId\n version\n status\n changelog\n publishedById\n publishedAt\n }\n }\n`;\n\nconst ROLLBACK_AGENT_VERSION_DOCUMENT = gql`\n mutation RollbackAgentVersion($agentId: ID!, $targetVersionId: ID!) {\n rollbackAgentVersion(agentId: $agentId, targetVersionId: $targetVersionId) {\n id\n agentId\n version\n status\n changelog\n publishedById\n publishedAt\n }\n }\n`;\n\ntype WorkspaceClient = ApolloClient;\n\nexport interface AgentRecord {\n id: string;\n name: string;\n slug: string;\n description?: string | null;\n /** Emoji chosen for the agent; null means the default. */\n avatar?: string | null;\n type: string;\n status: string;\n visibility?: string | null;\n capabilities?: string[] | null;\n llmModelId?: string | null;\n /** BOFF-15360 — ordered fallback models. */\n fallbackModelIds?: string[] | null;\n bucketId?: string | null;\n currentVersionId?: string | null;\n draftVersionId?: string | null;\n executionCount?: number | null;\n lastExecutedAt?: string | null;\n specialization?: string | null;\n systemPrompt?: string | null;\n temperature?: number | null;\n maxTokens?: number | null;\n maxConcurrentExecutions?: number | null;\n knowledgeBaseIds?: string[] | null;\n mcpConnectionIds?: string[] | null;\n workflowIds?: string[] | null;\n tagIds?: string[] | null;\n /** Entity-owned universal tag records (JSON). */\n tags?: unknown;\n metadata?: Record<string, unknown> | null;\n createdAt?: string | null;\n updatedAt?: string | null;\n createdById?: string | null;\n updatedById?: string | null;\n workspaceId?: string | null;\n}\n\nconst LIST_PAGE_SIZE = 100;\nconst NO_AGENTS: AgentRecord[] = [];\n\ninterface GetAgentData {\n getBotmanorAgent: AgentRecord | null;\n}\n\ninterface CreateAgentData {\n createBotmanorAgent: AgentRecord;\n}\n\ninterface UpdateAgentData {\n updateBotmanorAgent: AgentRecord;\n}\n\ninterface DeleteAgentData {\n deleteBotmanorAgent: boolean;\n}\n\nexport interface AgentVersionRecord {\n id: string;\n agentId: string;\n version: string;\n status: 'DRAFT' | 'PUBLISHED' | 'HISTORICAL';\n changelog?: string | null;\n config?: Record<string, unknown> | null;\n createdById?: string | null;\n createdAt?: string | null;\n publishedById?: string | null;\n publishedAt?: string | null;\n}\n\ninterface ListAgentVersionsData {\n listAgentVersions: AgentVersionRecord[];\n}\n\ninterface PublishAgentVersionData {\n publishAgentVersion: AgentVersionRecord;\n}\n\ninterface RollbackAgentVersionData {\n rollbackAgentVersion: AgentVersionRecord;\n}\n\ninterface AgentMutationState<T> {\n data: T | undefined;\n loading: boolean;\n error: Error | undefined;\n}\n\ninterface CreateAgentInput {\n workspaceId: string;\n name: string;\n slug?: string;\n description?: string;\n avatar?: string;\n type: string;\n systemPrompt: string;\n temperature?: number;\n maxTokens?: number;\n maxConcurrentExecutions?: number;\n capabilities?: string[];\n llmModelId?: string;\n fallbackModelIds?: string[];\n knowledgeBaseIds?: string[];\n mcpConnectionIds?: string[];\n visibility?: string;\n}\n\ninterface UpdateAgentInput {\n agentId: string;\n input: GraphQLInput<UpdateBotmanorAgentInput>;\n}\n\nconst UPDATE_AGENT_FIELDS = fieldsOf<UpdateBotmanorAgentInput>({\n avatar: true,\n bucketId: true,\n capabilities: true,\n context: true,\n description: true,\n knowledgeBaseIds: true,\n llmModelId: true,\n fallbackModelIds: true,\n maxConcurrentExecutions: true,\n maxTokens: true,\n mcpConnectionIds: true,\n metadata: true,\n name: true,\n slug: true,\n specialization: true,\n status: true,\n systemPrompt: true,\n tagIds: true,\n tags: true,\n temperature: true,\n type: true,\n visibility: true,\n workflowIds: true,\n});\n\n/**\n * Apollo v4 resolves a mutation with `result.error` set (and no data) when the\n * server answers with a GraphQL error, instead of rejecting. Throw it so the\n * caller sees the server's actionable message (\"An agent named ... already\n * exists\") and not the generic fallback.\n */\nfunction throwOperationError(result: unknown, fallback: string): void {\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw new Error(graphqlErrorMessage(operationError, fallback), { cause: operationError });\n }\n}\n\nfunction getWorkspaceClient(client: unknown): WorkspaceClient {\n return client as WorkspaceClient;\n}\n\nfunction buildAgentFilter(\n workspaceId: string | undefined,\n filter?: AgentFilter\n): Record<string, unknown> | undefined {\n if (!workspaceId && !filter) return undefined;\n\n return {\n workspaceId,\n search: filter?.search,\n status: filter?.status?.[0],\n visibility: filter?.visibility?.[0],\n bucketId: filter?.bucketId,\n };\n}\n\nexport const agentKeys = {\n all: ['agents'] as const,\n lists: () => [...agentKeys.all, 'list'] as const,\n list: (filter?: AgentFilter) => [...agentKeys.lists(), filter] as const,\n details: () => [...agentKeys.all, 'detail'] as const,\n detail: (id: string) => [...agentKeys.details(), id] as const,\n};\n\nexport function useAgents(\n filter?: AgentFilter,\n options?: { enabled?: boolean }\n): PaginatedQueryResult<AgentRecord[]> {\n const { workspaceId } = useBotlit();\n\n const variables = useMemo(\n () => ({ filters: buildAgentFilter(workspaceId, filter) }),\n [filter, workspaceId]\n );\n\n return useWorkspacePaginatedQuery<ListBotmanorAgentsPageQuery, AgentRecord, AgentRecord[]>({\n document: ListBotmanorAgentsPageDocument,\n variables,\n pageSize: LIST_PAGE_SIZE,\n extractRows: (data) => data?.listBotmanorAgentsPage.items ?? [],\n extractNextOffset: (data) => data?.listBotmanorAgentsPage.nextOffset ?? null,\n select: (rows) => rows,\n fallback: NO_AGENTS,\n enabled: Boolean(workspaceId) && options?.enabled !== false,\n errorMessage: 'Failed to load agents',\n });\n}\n\n/**\n * Exact agent counts by status for the workspace (BOFF-12426). Unlike\n * `useAgents` this is not capped at one page, so it is the source for\n * dashboard totals. `total` counts every status.\n */\nexport interface AgentCounts {\n total: number;\n draft: number;\n active: number;\n paused: number;\n training: number;\n archived: number;\n}\n\ninterface AgentCountsData {\n getBotmanorAgentCounts?: AgentCounts | null;\n}\n\nconst GET_AGENT_COUNTS_DOCUMENT = gql`\n query GetBotmanorAgentCounts {\n getBotmanorAgentCounts {\n total\n draft\n active\n paused\n training\n archived\n }\n }\n`;\n\nexport function useAgentCounts(enabled = true): QueryResult<AgentCounts | null> {\n const { workspaceId } = useBotlit();\n const variables = useMemo(() => ({}), []);\n\n return useWorkspaceQuery<AgentCountsData, AgentCounts | null>({\n document: GET_AGENT_COUNTS_DOCUMENT,\n variables,\n select: (data) => data?.getBotmanorAgentCounts ?? null,\n fallback: null,\n enabled: enabled && Boolean(workspaceId),\n errorMessage: 'Failed to load agent counts',\n });\n}\n\n/** What still uses an agent, shown in the delete confirmation (BOFF-12457). */\nexport interface AgentUsage {\n bots: Array<{ id: string; name: string; isDefault: boolean }>;\n a2aConnections: Array<{ id: string; name: string }>;\n workflowIds: string[];\n}\n\ninterface AgentUsageData {\n getBotmanorAgentUsage?: AgentUsage | null;\n}\n\nconst GET_AGENT_USAGE_DOCUMENT = gql`\n query GetBotmanorAgentUsage($id: ID!) {\n getBotmanorAgentUsage(id: $id) {\n bots {\n id\n name\n isDefault\n }\n a2aConnections {\n id\n name\n }\n workflowIds\n }\n }\n`;\n\n/** Returns a function that reads what uses an agent. Reads fresh every time, because a delete is about to rely on it. */\nexport function useLoadAgentUsage() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n\n return useCallback(\n async (agentId: string): Promise<AgentUsage> => {\n const result = await client.query<AgentUsageData>({\n query: GET_AGENT_USAGE_DOCUMENT,\n variables: { id: agentId },\n fetchPolicy: 'network-only',\n });\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw operationError instanceof Error\n ? operationError\n : new Error('Failed to load agent usage');\n }\n return (\n result.data?.getBotmanorAgentUsage ?? { bots: [], a2aConnections: [], workflowIds: [] }\n );\n },\n [client]\n );\n}\n\nexport function useAgent(agentId: string | undefined) {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [data, setData] = useState<AgentRecord | null>(null);\n // Loading from the first render when there is an id to read, so a page never\n // shows \"not found\" (or an empty form) for the frame before the read starts.\n const [loading, setLoading] = useState(Boolean(agentId));\n const [error, setError] = useState<Error | undefined>();\n\n const refetch = useCallback(async () => {\n if (!agentId) {\n setData(null);\n setLoading(false);\n return;\n }\n\n setLoading(true);\n setError(undefined);\n try {\n const result = await client.query<GetAgentData>({\n query: GET_AGENT_DOCUMENT,\n variables: { id: agentId },\n fetchPolicy: 'network-only',\n });\n // Apollo v4 resolves (not rejects) with `result.error` set on GraphQL errors.\n const operationError = (result as { error?: unknown }).error;\n if (operationError != null) {\n throw operationError instanceof Error ? operationError : new Error('Failed to load agent');\n }\n setData(result.data?.getBotmanorAgent ?? null);\n } catch (queryError) {\n setData(null);\n setError(queryError instanceof Error ? queryError : new Error('Failed to load agent'));\n } finally {\n setLoading(false);\n }\n }, [agentId, client]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { data, loading, error, refetch };\n}\n\nexport function useCreateAgent() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const createAgent = useCallback(\n async (input: CreateAgentInput) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<CreateAgentData>({\n mutation: CREATE_AGENT_DOCUMENT,\n variables: { input },\n });\n throwOperationError(result, 'Failed to create agent');\n\n const createdAgent = result.data?.createBotmanorAgent;\n if (!createdAgent) {\n throw new Error('Failed to create agent');\n }\n\n setState({ data: createdAgent, loading: false, error: undefined });\n return createdAgent;\n } catch (mutationError) {\n const error = new Error(graphqlErrorMessage(mutationError, 'Failed to create agent'), {\n cause: mutationError,\n });\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [createAgent, state] as const;\n}\n\nexport function useUpdateAgent() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const updateAgent = useCallback(\n async ({ agentId, input }: UpdateAgentInput) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<UpdateAgentData>({\n mutation: UPDATE_AGENT_DOCUMENT,\n variables: { id: agentId, input: buildMutationInput(input, UPDATE_AGENT_FIELDS) },\n });\n throwOperationError(result, 'Failed to update agent');\n\n const updatedAgent = result.data?.updateBotmanorAgent;\n if (!updatedAgent) {\n throw new Error('Failed to update agent');\n }\n\n setState({ data: updatedAgent, loading: false, error: undefined });\n return updatedAgent;\n } catch (mutationError) {\n const error = new Error(graphqlErrorMessage(mutationError, 'Failed to update agent'), {\n cause: mutationError,\n });\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [updateAgent, state] as const;\n}\n\nexport function useDeleteAgent() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<boolean>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const deleteAgent = useCallback(\n async (agentId: string) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<DeleteAgentData>({\n mutation: DELETE_AGENT_DOCUMENT,\n variables: { id: agentId },\n });\n throwOperationError(result, 'Failed to delete agent');\n\n const deleted = result.data?.deleteBotmanorAgent ?? false;\n setState({ data: deleted, loading: false, error: undefined });\n return deleted;\n } catch (mutationError) {\n const error = new Error(graphqlErrorMessage(mutationError, 'Failed to delete agent'), {\n cause: mutationError,\n });\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [deleteAgent, state] as const;\n}\n\n// ============================================================================\n// VERSIONING (BOFF-4381) — version history, publish, rollback\n// ============================================================================\n\nexport function useAgentVersions(agentId: string | undefined) {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [data, setData] = useState<AgentVersionRecord[]>([]);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<Error | undefined>();\n\n const refetch = useCallback(async () => {\n if (!agentId) {\n setData([]);\n return;\n }\n\n setLoading(true);\n setError(undefined);\n try {\n const result = await client.query<ListAgentVersionsData>({\n query: LIST_AGENT_VERSIONS_DOCUMENT,\n variables: { agentId, pagination: { limit: 50, offset: 0 } },\n fetchPolicy: 'network-only',\n });\n const versions = result.data?.listAgentVersions ?? [];\n // Newest first, regardless of what the server returned.\n setData(\n [...versions].sort((a, b) =>\n a.createdAt && b.createdAt ? b.createdAt.localeCompare(a.createdAt) : 0\n )\n );\n } catch (queryError) {\n setError(\n queryError instanceof Error ? queryError : new Error('Failed to load agent versions')\n );\n } finally {\n setLoading(false);\n }\n }, [agentId, client]);\n\n useEffect(() => {\n void refetch();\n }, [refetch]);\n\n return { data, loading, error, refetch };\n}\n\nexport function usePublishAgentVersion() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentVersionRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const publishAgentVersion = useCallback(\n async ({\n agentId,\n versionId,\n changelog,\n }: {\n agentId: string;\n versionId: string;\n changelog?: string;\n }) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<PublishAgentVersionData>({\n mutation: PUBLISH_AGENT_VERSION_DOCUMENT,\n variables: { agentId, versionId, changelog: changelog?.trim() || undefined },\n });\n\n const published = result.data?.publishAgentVersion;\n if (!published) {\n throw new Error('Failed to publish agent version');\n }\n\n setState({ data: published, loading: false, error: undefined });\n return published;\n } catch (mutationError) {\n const error =\n mutationError instanceof Error\n ? mutationError\n : new Error('Failed to publish agent version');\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [publishAgentVersion, state] as const;\n}\n\nexport function useRollbackAgentVersion() {\n const client = getWorkspaceClient(useGatewayClient('workspace'));\n const [state, setState] = useState<AgentMutationState<AgentVersionRecord>>({\n data: undefined,\n loading: false,\n error: undefined,\n });\n\n const rollbackAgentVersion = useCallback(\n async ({ agentId, targetVersionId }: { agentId: string; targetVersionId: string }) => {\n setState({ data: undefined, loading: true, error: undefined });\n try {\n const result = await client.mutate<RollbackAgentVersionData>({\n mutation: ROLLBACK_AGENT_VERSION_DOCUMENT,\n variables: { agentId, targetVersionId },\n });\n\n const rolledBack = result.data?.rollbackAgentVersion;\n if (!rolledBack) {\n throw new Error('Failed to roll back agent version');\n }\n\n setState({ data: rolledBack, loading: false, error: undefined });\n return rolledBack;\n } catch (mutationError) {\n const error =\n mutationError instanceof Error\n ? mutationError\n : new Error('Failed to roll back agent version');\n setState({ data: undefined, loading: false, error });\n throw error;\n }\n },\n [client]\n );\n\n return [rollbackAgentVersion, state] as const;\n}\n"],"mappings":";;;;;;;;;AAoBA,IAAMA,IAAqB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCxBC,IAAwB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;GA2B3BC,IAAwB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgC3BC,IAAwB,CAAG;;;;GAO3BC,IAA+B,CAAG;;;;;;;;;;;;;;;GAiBlCC,IAAiC,CAAG;;;;;;;;;;;;GAcpCC,IAAkC,CAAG;;;;;;;;;;;;GAsDrCC,IAAiB,KACjBC,IAA2B,CAAC,GAyE5BC,IAAsBC,EAAmC;CAC7D,QAAQ;CACR,UAAU;CACV,cAAc;CACd,SAAS;CACT,aAAa;CACb,kBAAkB;CAClB,YAAY;CACZ,kBAAkB;CAClB,yBAAyB;CACzB,WAAW;CACX,kBAAkB;CAClB,UAAU;CACV,MAAM;CACN,MAAM;CACN,gBAAgB;CAChB,QAAQ;CACR,cAAc;CACd,QAAQ;CACR,MAAM;CACN,aAAa;CACb,MAAM;CACN,YAAY;CACZ,aAAa;AACf,CAAC;AAQD,SAASC,EAAoB,GAAiB,GAAwB;CACpE,IAAMC,IAAkBC,EAA+B;CACvD,IAAID,KAAkB,MACpB,MAAU,MAAME,EAAoBF,GAAgBG,CAAQ,GAAG,EAAE,OAAOH,EAAe,CAAC;AAE5F;AAEA,SAASI,EAAmB,GAAkC;CAC5D,OAAOC;AACT;AAEA,SAASC,EACP,GACA,GACqC;CACrC,IAAKC,KAAgBC,GAErB,OAAO;EACL;EACA,QAAQA,GAAQ;EAChB,QAAQA,GAAQ,SAAS;EACzB,YAAYA,GAAQ,aAAa;EACjC,UAAUA,GAAQ;CACpB;AACF;AAUA,SAAgBC,EACd,GACA,GACqC;CACrC,IAAM,EAAE,mBAAgBC,EAAU,GAE5BC,IAAYC,SACT,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;CACxC,IAAMlD,IAASD,EAAmBoB,EAAiB,WAAW,CAAC,GACzD,CAACc,GAAOC,KAAYV,EAAiD;EACzE,MAAM,KAAA;EACN,SAAS;EACT,OAAO,KAAA;CACT,CAAC;CA8BD,OAAO,CA5BsBJ,EAC3B,OAAO,EAAE,YAAS,yBAAoE;EACpF,EAAS;GAAE,MAAM,KAAA;GAAW,SAAS;GAAM,OAAO,KAAA;EAAU,CAAC;EAC7D,IAAI;GAMF,IAAM+B,KAAa,MALEnD,EAAO,OAAiC;IAC3D,UAAUX;IACV,WAAW;KAAE;KAAS;IAAgB;GACxC,CAAC,EAAA,CAEyB,MAAM;GAChC,IAAI,CAAC8D,GACH,MAAU,MAAM,mCAAmC;GAIrD,OADAjB,EAAS;IAAE,MAAMiB;IAAY,SAAS;IAAO,OAAO,KAAA;GAAU,CAAC,GACxDA;EACT,SAASf,GAAe;GACtB,IAAMT,IACJS,aAAyB,QACrBA,IACA,gBAAI,MAAM,mCAAmC;GAEnD,MADAF,EAAS;IAAE,MAAM,KAAA;IAAW,SAAS;IAAO;GAAM,CAAC,GAC7CP;EACR;CACF,GACA,CAAC3B,CAAM,CAGD,GAAsBiC,CAAK;AACrC"}
|
|
@@ -1266,6 +1266,40 @@ export type ListBotmanorAgentsQuery = {
|
|
|
1266
1266
|
workspaceId: string;
|
|
1267
1267
|
}>;
|
|
1268
1268
|
};
|
|
1269
|
+
export type ListBotmanorAgentsPageQueryVariables = Exact<{
|
|
1270
|
+
filters?: Types.BotmanorAgentFilterInput | null | undefined;
|
|
1271
|
+
pagination?: Types.PaginationInput | null | undefined;
|
|
1272
|
+
}>;
|
|
1273
|
+
export type ListBotmanorAgentsPageQuery = {
|
|
1274
|
+
listBotmanorAgentsPage: {
|
|
1275
|
+
nextOffset: number | null;
|
|
1276
|
+
items: Array<{
|
|
1277
|
+
id: string;
|
|
1278
|
+
name: string;
|
|
1279
|
+
slug: string;
|
|
1280
|
+
description: string | null;
|
|
1281
|
+
avatar: string | null;
|
|
1282
|
+
type: Types.BotmanorAgentType;
|
|
1283
|
+
status: Types.BotmanorAgentStatus;
|
|
1284
|
+
visibility: Types.AgentVisibility;
|
|
1285
|
+
capabilities: Array<Types.BotmanorAgentCapability>;
|
|
1286
|
+
llmModelId: string | null;
|
|
1287
|
+
fallbackModelIds: Array<string>;
|
|
1288
|
+
bucketId: string | null;
|
|
1289
|
+
executionCount: number;
|
|
1290
|
+
lastExecutedAt: string | null;
|
|
1291
|
+
specialization: string | null;
|
|
1292
|
+
tagIds: Array<string>;
|
|
1293
|
+
tags: Record<string, unknown>;
|
|
1294
|
+
knowledgeBaseIds: Array<string>;
|
|
1295
|
+
createdAt: string;
|
|
1296
|
+
updatedAt: string;
|
|
1297
|
+
createdById: string;
|
|
1298
|
+
updatedById: string;
|
|
1299
|
+
workspaceId: string;
|
|
1300
|
+
}>;
|
|
1301
|
+
};
|
|
1302
|
+
};
|
|
1269
1303
|
export type GetBotmanorAgentQueryVariables = Exact<{
|
|
1270
1304
|
id: string | number;
|
|
1271
1305
|
}>;
|
|
@@ -4666,6 +4700,32 @@ export type ListBotmanorAgentsQueryHookResult = ReturnType<typeof useListBotmano
|
|
|
4666
4700
|
export type ListBotmanorAgentsLazyQueryHookResult = ReturnType<typeof useListBotmanorAgentsLazyQuery>;
|
|
4667
4701
|
export type ListBotmanorAgentsSuspenseQueryHookResult = ReturnType<typeof useListBotmanorAgentsSuspenseQuery>;
|
|
4668
4702
|
export type ListBotmanorAgentsQueryResult = Apollo.QueryResult<Types.ListBotmanorAgentsQuery, Types.ListBotmanorAgentsQueryVariables>;
|
|
4703
|
+
export declare const ListBotmanorAgentsPageDocument: Apollo.DocumentNode;
|
|
4704
|
+
/**
|
|
4705
|
+
* __useListBotmanorAgentsPageQuery__
|
|
4706
|
+
*
|
|
4707
|
+
* To run a query within a React component, call `useListBotmanorAgentsPageQuery` and pass it any options that fit your needs.
|
|
4708
|
+
* When your component renders, `useListBotmanorAgentsPageQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
4709
|
+
* you can use to render your UI.
|
|
4710
|
+
*
|
|
4711
|
+
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
4712
|
+
*
|
|
4713
|
+
* @example
|
|
4714
|
+
* const { data, loading, error } = useListBotmanorAgentsPageQuery({
|
|
4715
|
+
* variables: {
|
|
4716
|
+
* filters: // value for 'filters'
|
|
4717
|
+
* pagination: // value for 'pagination'
|
|
4718
|
+
* },
|
|
4719
|
+
* });
|
|
4720
|
+
*/
|
|
4721
|
+
export declare function useListBotmanorAgentsPageQuery(baseOptions?: ApolloReactHooks.QueryHookOptions<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables>): ApolloReactHooks.useQuery.Result<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables, "empty" | "complete" | "streaming", Types.ListBotmanorAgentsPageQueryVariables, undefined>;
|
|
4722
|
+
export declare function useListBotmanorAgentsPageLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables>): ApolloReactHooks.useLazyQuery.ResultTuple<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables, "empty" | "complete" | "streaming", undefined>;
|
|
4723
|
+
export declare function useListBotmanorAgentsPageSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables>;
|
|
4724
|
+
export declare function useListBotmanorAgentsPageSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.ListBotmanorAgentsPageQuery | undefined, Types.ListBotmanorAgentsPageQueryVariables>;
|
|
4725
|
+
export type ListBotmanorAgentsPageQueryHookResult = ReturnType<typeof useListBotmanorAgentsPageQuery>;
|
|
4726
|
+
export type ListBotmanorAgentsPageLazyQueryHookResult = ReturnType<typeof useListBotmanorAgentsPageLazyQuery>;
|
|
4727
|
+
export type ListBotmanorAgentsPageSuspenseQueryHookResult = ReturnType<typeof useListBotmanorAgentsPageSuspenseQuery>;
|
|
4728
|
+
export type ListBotmanorAgentsPageQueryResult = Apollo.QueryResult<Types.ListBotmanorAgentsPageQuery, Types.ListBotmanorAgentsPageQueryVariables>;
|
|
4669
4729
|
export declare const GetBotmanorAgentDocument: Apollo.DocumentNode;
|
|
4670
4730
|
/**
|
|
4671
4731
|
* __useGetBotmanorAgentQuery__
|