@burdenoff/microfe-botmanor 2026.1120.21 → 2026.1120.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/botlit/BotmanorRootInner.js +46 -45
  2. package/dist/botlit/BotmanorRootInner.js.map +1 -1
  3. package/dist/botlit/components/A2ACardVerificationCard.d.ts +8 -0
  4. package/dist/botlit/components/A2ACardVerificationCard.js +123 -0
  5. package/dist/botlit/components/A2ACardVerificationCard.js.map +1 -0
  6. package/dist/botlit/components/A2ARunCollaborationPanel.d.ts +4 -0
  7. package/dist/botlit/components/A2ARunCollaborationPanel.js +149 -0
  8. package/dist/botlit/components/A2ARunCollaborationPanel.js.map +1 -0
  9. package/dist/botlit/components/A2AVerificationBadge.d.ts +4 -0
  10. package/dist/botlit/components/A2AVerificationBadge.js +37 -0
  11. package/dist/botlit/components/A2AVerificationBadge.js.map +1 -0
  12. package/dist/botlit/components/AgentA2APanel.js +85 -73
  13. package/dist/botlit/components/AgentA2APanel.js.map +1 -1
  14. package/dist/botlit/components/PlanUsageCard.d.ts +2 -0
  15. package/dist/botlit/components/PlanUsageCard.js +79 -0
  16. package/dist/botlit/components/PlanUsageCard.js.map +1 -0
  17. package/dist/botlit/components/QuotaExhaustedDialog.d.ts +14 -3
  18. package/dist/botlit/components/QuotaExhaustedDialog.js +33 -13
  19. package/dist/botlit/components/QuotaExhaustedDialog.js.map +1 -1
  20. package/dist/botlit/hooks/index.d.ts +1 -1
  21. package/dist/botlit/hooks/useA2A.d.ts +36 -0
  22. package/dist/botlit/hooks/useA2A.js +154 -109
  23. package/dist/botlit/hooks/useA2A.js.map +1 -1
  24. package/dist/botlit/hooks/useA2APlan.d.ts +8 -0
  25. package/dist/botlit/hooks/useA2APlan.js +24 -0
  26. package/dist/botlit/hooks/useA2APlan.js.map +1 -0
  27. package/dist/botlit/hooks/usePlanUsage.d.ts +19 -0
  28. package/dist/botlit/hooks/usePlanUsage.js +45 -0
  29. package/dist/botlit/hooks/usePlanUsage.js.map +1 -0
  30. package/dist/botlit/pages/A2AAgentDetailPage.js +384 -342
  31. package/dist/botlit/pages/A2AAgentDetailPage.js.map +1 -1
  32. package/dist/botlit/pages/A2ARegistryPage.js +148 -140
  33. package/dist/botlit/pages/A2ARegistryPage.js.map +1 -1
  34. package/dist/botlit/pages/BotDetailPage.js +4 -4
  35. package/dist/botlit/pages/DashboardPage.js +151 -149
  36. package/dist/botlit/pages/DashboardPage.js.map +1 -1
  37. package/dist/botlit/pages/ExecutionDetailPage.js +172 -170
  38. package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
  39. package/dist/botlit/providers/QuotaGuard.d.ts +2 -0
  40. package/dist/botlit/providers/QuotaGuard.js +51 -0
  41. package/dist/botlit/providers/QuotaGuard.js.map +1 -0
  42. package/dist/botlit/providers/quotaGuardContext.d.ts +11 -0
  43. package/dist/botlit/providers/quotaGuardContext.js +9 -0
  44. package/dist/botlit/providers/quotaGuardContext.js.map +1 -0
  45. package/dist/botlit/utils/a2aRunCollaboration.d.ts +37 -0
  46. package/dist/botlit/utils/a2aRunCollaboration.js +42 -0
  47. package/dist/botlit/utils/a2aRunCollaboration.js.map +1 -0
  48. package/dist/botlit/utils/a2aVerificationStatus.d.ts +11 -0
  49. package/dist/botlit/utils/a2aVerificationStatus.js +18 -0
  50. package/dist/botlit/utils/a2aVerificationStatus.js.map +1 -0
  51. package/dist/botlit/utils/quotaErrors.d.ts +48 -0
  52. package/dist/botlit/utils/quotaErrors.js +118 -0
  53. package/dist/botlit/utils/quotaErrors.js.map +1 -0
  54. package/dist/botlit/utils/watchPlanLimits.d.ts +12 -0
  55. package/dist/botlit/utils/watchPlanLimits.js +27 -0
  56. package/dist/botlit/utils/watchPlanLimits.js.map +1 -0
  57. package/dist/generated/wspace-operations.d.ts +211 -0
  58. package/dist/generated/wspace-operations.js +206 -114
  59. package/dist/generated/wspace-operations.js.map +1 -1
  60. package/dist/generated/wspace-types.d.ts +74 -1
  61. package/dist/generated/wspace-types.js.map +1 -1
  62. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- import { CreateA2ARegistryEntryDocument as e, DeleteA2ARegistryEntryDocument as t, GetA2ARegistryEntryDocument as n, ListA2ARegistryEntriesDocument as r, UpdateA2ARegistryEntryDocument as i } from "../../generated/wspace-operations.js";
2
- import { buildMutationInput as a, fieldsOf as o } from "./internal/mutationInput.js";
3
- import { useWorkspaceId as s, useWorkspaceMutation as c, useWorkspacePaginatedQuery as l, useWorkspaceQuery as u } from "./internal/workspaceGateway.js";
4
- import { useCallback as d, useMemo as f } from "react";
5
- var p = 2e3, m = 2048, h = 1048576, g = o({
1
+ import { CreateA2ARegistryEntryDocument as e, DeleteA2ARegistryEntryDocument as t, GetA2ARegistryEntryDocument as n, GetA2ARegistryEntryUsageDocument as r, ListA2ARegistryEntriesDocument as i, UpdateA2ARegistryEntryDocument as a, VerifyA2ARegistryEntryDocument as o } from "../../generated/wspace-operations.js";
2
+ import { buildMutationInput as s, fieldsOf as c } from "./internal/mutationInput.js";
3
+ import { useWorkspaceId as l, useWorkspaceMutation as u, useWorkspacePaginatedQuery as d, useWorkspaceQuery as f } from "./internal/workspaceGateway.js";
4
+ import { useCallback as p, useMemo as m } from "react";
5
+ var h = 2e3, g = 2048, ee = 1048576, _ = c({
6
6
  agentCard: !0,
7
7
  bucketId: !0,
8
8
  description: !0,
@@ -15,7 +15,7 @@ var p = 2e3, m = 2048, h = 1048576, g = o({
15
15
  visibility: !0,
16
16
  wellKnownUrl: !0,
17
17
  workspaceId: !0
18
- }), _ = o({
18
+ }), v = c({
19
19
  agentCard: !0,
20
20
  bucketId: !0,
21
21
  description: !0,
@@ -27,119 +27,130 @@ var p = 2e3, m = 2048, h = 1048576, g = o({
27
27
  trustLevel: !0,
28
28
  visibility: !0,
29
29
  wellKnownUrl: !0
30
- }), v = ["agent:delegate", "task:create"], y = [];
31
- function b(e) {
30
+ }), y = ["agent:delegate", "task:create"], b = [];
31
+ function x(e) {
32
32
  return typeof e == "object" && e && !Array.isArray(e) ? e : {};
33
33
  }
34
- function x(e, t = "") {
34
+ function S(e, t = "") {
35
35
  return typeof e == "string" ? e : t;
36
36
  }
37
- function S(e) {
38
- return e === !0;
39
- }
40
37
  function C(e) {
41
- return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
38
+ return e === !0;
42
39
  }
43
40
  function w(e) {
44
- return Array.isArray(e) ? e.map(b) : [];
41
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
45
42
  }
46
43
  function T(e) {
47
- let t = b(e), n = b(t.capabilities), r = b(t.authentication);
44
+ return Array.isArray(e) ? e.map(x) : [];
45
+ }
46
+ function E(e) {
47
+ let t = x(e);
48
+ return [
49
+ t.url,
50
+ ...T(t.supportedInterfaces).map((e) => e.url),
51
+ ...T(t.additionalInterfaces).map((e) => e.url)
52
+ ].find((e) => typeof e == "string" && e.trim() !== "") ?? "";
53
+ }
54
+ function D(e) {
55
+ return Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : S(x(e).scheme)).filter((e) => e !== "") : [];
56
+ }
57
+ function O(e) {
58
+ let t = x(e), n = x(t.capabilities), r = x(t.authentication);
48
59
  return {
49
- url: x(t.url),
50
- version: x(t.version),
51
- providerOrganization: x(b(t.provider).organization),
52
- documentationUrl: x(t.documentationUrl),
60
+ url: E(t),
61
+ version: S(t.version),
62
+ providerOrganization: S(x(t.provider).organization),
63
+ documentationUrl: S(t.documentationUrl),
53
64
  capabilities: {
54
- streaming: S(n.streaming),
55
- pushNotifications: S(n.pushNotifications),
56
- stateTransitionHistory: S(n.stateTransitionHistory)
65
+ streaming: C(n.streaming),
66
+ pushNotifications: C(n.pushNotifications),
67
+ stateTransitionHistory: C(n.stateTransitionHistory)
57
68
  },
58
- authenticationSchemes: C(r.schemes),
59
- defaultInputModes: C(t.defaultInputModes),
60
- defaultOutputModes: C(t.defaultOutputModes),
61
- skills: w(t.skills).map((e, t) => ({
62
- id: x(e.id, `skill-${t}`),
63
- name: x(e.name),
64
- description: x(e.description),
65
- tags: C(e.tags),
66
- examples: C(e.examples)
69
+ authenticationSchemes: D(r.schemes),
70
+ defaultInputModes: w(t.defaultInputModes),
71
+ defaultOutputModes: w(t.defaultOutputModes),
72
+ skills: T(t.skills).map((e, t) => ({
73
+ id: S(e.id, `skill-${t}`),
74
+ name: S(e.name),
75
+ description: S(e.description),
76
+ tags: w(e.tags),
77
+ examples: w(e.examples)
67
78
  }))
68
79
  };
69
80
  }
70
- var E = [
81
+ var k = [
71
82
  "bucketIds",
72
83
  "appIds",
73
84
  "knowledgeBaseIds"
74
85
  ];
75
- function D(e) {
76
- let t = b(e.scope), n = E.filter((e) => C(t[e]).length > 0).map((e) => `scope.${e}`);
77
- return Object.keys(b(e.rateLimit)).length > 0 && n.push("rateLimit"), n;
86
+ function A(e) {
87
+ let t = x(e.scope), n = k.filter((e) => w(t[e]).length > 0).map((e) => `scope.${e}`);
88
+ return Object.keys(x(e.rateLimit)).length > 0 && n.push("rateLimit"), n;
78
89
  }
79
- function O(e) {
80
- return w(e).map((e, t) => {
81
- let n = x(e.permission).trim().toLowerCase(), r = x(e.validFrom), i = x(e.validUntil);
90
+ function j(e) {
91
+ return T(e).map((e, t) => {
92
+ let n = S(e.permission).trim().toLowerCase(), r = S(e.validFrom), i = S(e.validUntil);
82
93
  return {
83
94
  id: `entitlement-${t}`,
84
95
  recognised: n.length > 0,
85
96
  permission: n,
86
- agentIds: C(b(e.scope).agentIds),
97
+ agentIds: w(x(e.scope).agentIds),
87
98
  validFrom: r || void 0,
88
99
  validUntil: i || void 0,
89
- unenforced: D(e)
100
+ unenforced: A(e)
90
101
  };
91
102
  });
92
103
  }
93
- function k(e) {
104
+ function M(e) {
94
105
  if (!e) return "";
95
106
  let t = Date.parse(e);
96
107
  return Number.isFinite(t) ? new Date(t).toISOString().slice(0, 10) : "";
97
108
  }
98
- function A(e) {
99
- return v.includes(e);
109
+ function N(e) {
110
+ return y.includes(e);
100
111
  }
101
- function j(e) {
102
- let t = w(e);
103
- return O(e).flatMap((e, n) => e.recognised && A(e.permission) ? [{
112
+ function P(e) {
113
+ let t = T(e);
114
+ return j(e).flatMap((e, n) => e.recognised && N(e.permission) ? [{
104
115
  permission: e.permission,
105
116
  agentIds: e.agentIds,
106
- validFrom: k(e.validFrom),
107
- validUntil: k(e.validUntil),
117
+ validFrom: M(e.validFrom),
118
+ validUntil: M(e.validUntil),
108
119
  original: t[n]
109
120
  }] : []);
110
121
  }
111
- function M(e) {
112
- let t = w(e);
113
- return O(e).flatMap((e, n) => e.recognised && A(e.permission) ? [] : [t[n]]);
122
+ function F(e) {
123
+ let t = T(e);
124
+ return j(e).flatMap((e, n) => e.recognised && N(e.permission) ? [] : [t[n]]);
114
125
  }
115
- function N(e, t = []) {
126
+ function I(e, t = []) {
116
127
  return [...e.map((e) => {
117
128
  let t = { ...e.original ?? {} };
118
129
  t.permission = e.permission;
119
- let n = { ...b(t.scope) };
130
+ let n = { ...x(t.scope) };
120
131
  e.agentIds.length > 0 ? n.agentIds = e.agentIds : delete n.agentIds, Object.keys(n).length > 0 ? t.scope = n : delete t.scope;
121
132
  let r = e.original ?? {}, i = (t) => {
122
- let n = x(r[t]);
123
- return n && k(n) === e[t] ? n : void 0;
133
+ let n = S(r[t]);
134
+ return n && M(n) === e[t] ? n : void 0;
124
135
  };
125
136
  return e.validFrom ? t.validFrom = i("validFrom") ?? `${e.validFrom}T00:00:00.000Z` : delete t.validFrom, e.validUntil ? t.validUntil = i("validUntil") ?? `${e.validUntil}T23:59:59.999Z` : delete t.validUntil, t;
126
137
  }), ...t];
127
138
  }
128
- function P(e) {
139
+ function L(e) {
129
140
  if (e.validFrom && e.validUntil && e.validUntil < e.validFrom) return "validityOrder";
130
141
  }
131
- function F(e, t = Date.now()) {
142
+ function R(e, t = Date.now()) {
132
143
  let n = (e) => {
133
144
  let n = e.validFrom ? Date.parse(e.validFrom) : NaN, r = e.validUntil ? Date.parse(e.validUntil) : NaN;
134
145
  return !(Number.isFinite(n) && t < n) && !(Number.isFinite(r) && t > r);
135
146
  };
136
- return O(e).some((e) => e.recognised && A(e.permission) && n(e));
147
+ return j(e).some((e) => e.recognised && N(e.permission) && n(e));
137
148
  }
138
- function I(e) {
149
+ function z(e) {
139
150
  let t = e.agentCard?.skills;
140
151
  return Array.isArray(t) ? t.length : 0;
141
152
  }
142
- function L(e) {
153
+ function B(e) {
143
154
  let t = [];
144
155
  if (!e) return {
145
156
  valid: !1,
@@ -151,16 +162,27 @@ function L(e) {
151
162
  for (let n of [
152
163
  "name",
153
164
  "description",
154
- "url",
155
165
  "version"
156
166
  ]) (typeof e[n] != "string" || e[n].trim() === "") && t.push({
157
167
  key: "botlit.a2aRegistry.validation.cardMissingField",
158
168
  fallback: "Agent card is missing \"{{field}}\"",
159
169
  params: { field: n }
160
170
  });
161
- return typeof e.url == "string" && e.url.trim() !== "" && !R(e.url) && t.push({
171
+ let n = E(e);
172
+ n === "" ? t.push({
173
+ key: "botlit.a2aRegistry.validation.cardNoEndpoint",
174
+ fallback: "Agent card is missing \"url\" (or an endpoint in \"supportedInterfaces\")"
175
+ }) : V(n) || t.push({
162
176
  key: "botlit.a2aRegistry.validation.cardUrlHttps",
163
- fallback: "The card's \"url\" must be an https:// address"
177
+ fallback: "The card's endpoint must be an https:// address"
178
+ });
179
+ let r = [...T(e.supportedInterfaces), ...T(e.additionalInterfaces)].map((e) => e.url);
180
+ return n !== "" && V(n) && r.some((e) => typeof e != "string" || !V(e)) && t.push({
181
+ key: "botlit.a2aRegistry.validation.cardInterfaceUrl",
182
+ fallback: "Every interface in the card needs an https:// \"url\""
183
+ }), T(e.supportedInterfaces).some((e) => S(e.protocolBinding).trim() === "" || S(e.protocolVersion).trim() === "") && t.push({
184
+ key: "botlit.a2aRegistry.validation.cardInterfaceProtocol",
185
+ fallback: "Each entry in \"supportedInterfaces\" needs a \"protocolBinding\" and a \"protocolVersion\""
164
186
  }), Array.isArray(e.skills) && e.skills.length !== 0 || t.push({
165
187
  key: "botlit.a2aRegistry.validation.cardNoSkills",
166
188
  fallback: "Agent card must advertise at least one skill"
@@ -169,7 +191,7 @@ function L(e) {
169
191
  errors: t
170
192
  };
171
193
  }
172
- function R(e) {
194
+ function V(e) {
173
195
  try {
174
196
  let t = new URL(e.trim());
175
197
  return t.protocol === "https:" && t.hostname.length > 0;
@@ -177,7 +199,7 @@ function R(e) {
177
199
  return !1;
178
200
  }
179
201
  }
180
- function z(e) {
202
+ function H(e) {
181
203
  try {
182
204
  let t = JSON.parse(e);
183
205
  return typeof t == "object" && t && !Array.isArray(t) ? t : void 0;
@@ -185,20 +207,20 @@ function z(e) {
185
207
  return;
186
208
  }
187
209
  }
188
- function B(e) {
210
+ function U(e) {
189
211
  let t = e.name.trim();
190
212
  if (t) return t;
191
- let n = z(e.agentCardJson)?.name;
213
+ let n = H(e.agentCardJson)?.name;
192
214
  return typeof n == "string" ? n.trim() : "";
193
215
  }
194
- function V(e) {
216
+ function W(e) {
195
217
  let t = e.description.trim();
196
218
  if (t) return t;
197
- let n = z(e.agentCardJson)?.description;
219
+ let n = H(e.agentCardJson)?.description;
198
220
  return typeof n == "string" ? n.trim() : "";
199
221
  }
200
- function H(e) {
201
- let t = {}, n = z(e.agentCardJson);
222
+ function G(e) {
223
+ let t = {}, n = H(e.agentCardJson);
202
224
  if (!e.agentCardJson.trim()) t.agentCardJson = {
203
225
  key: "botlit.a2aRegistry.validation.cardRequired",
204
226
  fallback: "An agent card is required"
@@ -212,10 +234,10 @@ function H(e) {
212
234
  fallback: "Agent card must be a valid JSON object"
213
235
  };
214
236
  else {
215
- let e = L(n);
237
+ let e = B(n);
216
238
  e.valid || (t.agentCardJson = e.errors[0]);
217
239
  }
218
- let r = B(e);
240
+ let r = U(e);
219
241
  r ? r.length > 255 && (t.name = {
220
242
  key: "botlit.a2aRegistry.validation.nameTooLong",
221
243
  fallback: "Name must be at most {{max}} characters",
@@ -223,58 +245,58 @@ function H(e) {
223
245
  }) : t.name = {
224
246
  key: "botlit.a2aRegistry.validation.nameRequired",
225
247
  fallback: "Enter a name, or paste a card that has one"
226
- }, V(e).length > 2e3 && (t.description = {
248
+ }, W(e).length > 2e3 && (t.description = {
227
249
  key: "botlit.a2aRegistry.validation.descriptionTooLong",
228
250
  fallback: "Description must be at most {{max}} characters",
229
- params: { max: p }
251
+ params: { max: h }
230
252
  });
231
253
  let i = e.wellKnownUrl.trim();
232
254
  return i && (i.length > 2048 ? t.wellKnownUrl = {
233
255
  key: "botlit.a2aRegistry.validation.urlTooLong",
234
256
  fallback: "URL must be at most {{max}} characters",
235
- params: { max: m }
236
- } : R(i) || (t.wellKnownUrl = {
257
+ params: { max: g }
258
+ } : V(i) || (t.wellKnownUrl = {
237
259
  key: "botlit.a2aRegistry.validation.wellKnownHttps",
238
260
  fallback: "Enter an https:// URL, e.g. https://agent.example.com/.well-known/agent.json"
239
261
  })), t;
240
262
  }
241
- function U(e) {
263
+ function K(e) {
242
264
  return e;
243
265
  }
244
- function W(e) {
245
- return e?.listA2ARegistryEntries ?? y;
266
+ function q(e) {
267
+ return e?.listA2ARegistryEntries ?? b;
246
268
  }
247
- function G(e) {
248
- let t = s(), n = e?.search?.trim().toLowerCase() ?? "", i = e?.status?.[0], a = e?.visibility?.[0], o = e?.trustLevel?.[0], c = e?.bucketId, u = f(() => ({ filters: {
269
+ function J(e) {
270
+ let t = l(), n = e?.search?.trim().toLowerCase() ?? "", r = e?.status?.[0], a = e?.visibility?.[0], o = e?.trustLevel?.[0], s = e?.bucketId, c = m(() => ({ filters: {
249
271
  workspaceId: t,
250
- status: i,
272
+ status: r,
251
273
  visibility: a,
252
274
  trustLevel: o,
253
- bucketId: c
275
+ bucketId: s
254
276
  } }), [
255
277
  t,
256
- i,
278
+ r,
257
279
  a,
258
280
  o,
259
- c
260
- ]), d = l({
261
- document: r,
262
- variables: u,
281
+ s
282
+ ]), u = d({
283
+ document: i,
284
+ variables: c,
263
285
  pageSize: 50,
264
- extractRows: W,
265
- select: U,
266
- fallback: y,
286
+ extractRows: q,
287
+ select: K,
288
+ fallback: b,
267
289
  enabled: !!t,
268
290
  errorMessage: "Failed to load the A2A registry"
269
- }), p = d.data, m = f(() => n ? p.filter((e) => e.name.toLowerCase().includes(n) || (e.description ?? "").toLowerCase().includes(n)) : p, [p, n]);
291
+ }), f = u.data, p = m(() => n ? f.filter((e) => e.name.toLowerCase().includes(n) || (e.description ?? "").toLowerCase().includes(n)) : f, [f, n]);
270
292
  return {
271
- ...d,
272
- data: m
293
+ ...u,
294
+ data: p
273
295
  };
274
296
  }
275
- function K(e) {
276
- let t = f(() => ({ id: e ?? "" }), [e]);
277
- return u({
297
+ function Y(e) {
298
+ let t = m(() => ({ id: e ?? "" }), [e]);
299
+ return f({
278
300
  document: n,
279
301
  variables: t,
280
302
  select: (e) => e?.getA2ARegistryEntry ?? null,
@@ -283,37 +305,60 @@ function K(e) {
283
305
  errorMessage: "Failed to load A2A agent"
284
306
  });
285
307
  }
286
- function q() {
287
- let t = s(), n = d((e) => ({ input: a({
308
+ function X() {
309
+ let t = l(), n = p((e) => ({ input: s({
288
310
  ...e,
289
311
  workspaceId: t
290
- }, g) }), [t]);
291
- return c({
312
+ }, _) }), [t]);
313
+ return u({
292
314
  document: e,
293
315
  variables: n,
294
316
  select: (e) => e?.createA2ARegistryEntry,
295
317
  errorMessage: "Failed to register A2A agent"
296
318
  });
297
319
  }
298
- function J() {
299
- return c({
300
- document: i,
320
+ function Z() {
321
+ return u({
322
+ document: a,
301
323
  variables: ({ agentId: e, input: t }) => ({
302
324
  id: e,
303
- input: a(t, _)
325
+ input: s(t, v)
304
326
  }),
305
327
  select: (e) => e?.updateA2ARegistryEntry,
306
328
  errorMessage: "Failed to update A2A agent"
307
329
  });
308
330
  }
309
- function Y() {
310
- return c({
331
+ function Q() {
332
+ return u({
311
333
  document: t,
312
334
  variables: (e) => ({ id: e }),
313
335
  select: (e) => e?.deleteA2ARegistryEntry,
314
336
  errorMessage: "Failed to remove A2A agent"
315
337
  });
316
338
  }
317
- export { h as A2A_AGENT_CARD_MAX_BYTES, p as A2A_DESCRIPTION_MAX, v as A2A_ENTITLEMENT_PERMISSIONS, m as A2A_URL_MAX, I as a2aAgentSkillCount, V as effectiveEntryDescription, B as effectiveEntryName, P as entitlementDraftError, F as entitlementsAllowConnections, R as isHttpsUrl, z as parseAgentCardJson, T as readAgentCard, O as readEntitlements, j as toEntitlementDrafts, N as toEntitlementsInput, M as unmanagedEntitlements, K as useA2AAgent, G as useA2AAgents, Y as useDeleteA2AAgent, q as useRegisterA2AAgent, J as useUpdateA2AAgent, L as validateAgentCard, H as validateRegistryForm };
339
+ function te() {
340
+ return u({
341
+ document: o,
342
+ variables: (e) => ({ id: e }),
343
+ select: (e) => e?.verifyA2ARegistryEntry,
344
+ errorMessage: "Failed to verify the agent card"
345
+ });
346
+ }
347
+ var $ = {
348
+ connectionCount: 0,
349
+ connections: []
350
+ };
351
+ function ne(e, t) {
352
+ let n = m(() => ({ id: e ?? "" }), [e]);
353
+ return f({
354
+ document: r,
355
+ variables: n,
356
+ select: (e) => e?.getA2ARegistryEntryUsage ?? $,
357
+ fallback: $,
358
+ enabled: !!e && t,
359
+ errorMessage: "Failed to load what uses this A2A agent"
360
+ });
361
+ }
362
+ export { ee as A2A_AGENT_CARD_MAX_BYTES, h as A2A_DESCRIPTION_MAX, y as A2A_ENTITLEMENT_PERMISSIONS, g as A2A_URL_MAX, z as a2aAgentSkillCount, W as effectiveEntryDescription, U as effectiveEntryName, L as entitlementDraftError, R as entitlementsAllowConnections, V as isHttpsUrl, H as parseAgentCardJson, E as preferredCardEndpoint, O as readAgentCard, j as readEntitlements, P as toEntitlementDrafts, I as toEntitlementsInput, F as unmanagedEntitlements, Y as useA2AAgent, ne as useA2AAgentUsage, J as useA2AAgents, Q as useDeleteA2AAgent, X as useRegisterA2AAgent, Z as useUpdateA2AAgent, te as useVerifyA2AAgent, B as validateAgentCard, G as validateRegistryForm };
318
363
 
319
364
  //# sourceMappingURL=useA2A.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useA2A.js","names":["A2A_DESCRIPTION_MAX","A2A_URL_MAX","A2A_AGENT_CARD_MAX_BYTES","REGISTER_AGENT_FIELDS","fieldsOf","UPDATE_AGENT_FIELDS","A2A_ENTITLEMENT_PERMISSIONS","NO_AGENTS","asRecord","value","asString","fallback","asBoolean","asStringArray","entry","asObjectArray","readAgentCard","source","card","capabilities","authentication","skill","index","UNENFORCED_SCOPE_KEYS","unenforcedFields","scope","entitlement","fields","key","readEntitlements","entitlements","permission","validFrom","validUntil","toDateInput","parsed","isEntitlementPermission","toEntitlementDrafts","rows","view","unmanagedEntitlements","toEntitlementsInput","drafts","row","draft","original","keep","stored","field","unmanaged","entitlementDraftError","entitlementsAllowConnections","isActive","from","until","now","a2aAgentSkillCount","skills","agent","validateAgentCard","errors","isHttpsUrl","url","parseAgentCardJson","json","effectiveEntryName","typed","values","cardName","effectiveEntryDescription","cardDescription","validateRegistryForm","issues","cardCheck","name","wellKnownUrl","identityRows","selectAgents","data","useA2AAgents","workspaceId","useWorkspaceId","search","filter","status","visibility","trustLevel","bucketId","variables","useMemo","result","useWorkspacePaginatedQuery","ListA2ARegistryEntriesDocument","useA2AAgent","agentId","useWorkspaceQuery","GetA2ARegistryEntryDocument","useRegisterA2AAgent","useCallback","buildMutationInput","input","useWorkspaceMutation","CreateA2ARegistryEntryDocument","useUpdateA2AAgent","UpdateA2ARegistryEntryDocument","useDeleteA2AAgent","DeleteA2ARegistryEntryDocument"],"sources":["../../../src/botlit/hooks/useA2A.ts"],"sourcesContent":["/**\n * A2A Registry Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listA2ARegistryEntries` / `getA2ARegistryEntry`\n * operations and the create/update/delete mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateA2ARegistryEntryDocument,\n DeleteA2ARegistryEntryDocument,\n GetA2ARegistryEntryDocument,\n ListA2ARegistryEntriesDocument,\n UpdateA2ARegistryEntryDocument,\n type CreateA2ARegistryEntryMutation,\n type DeleteA2ARegistryEntryMutation,\n type GetA2ARegistryEntryQuery,\n type ListA2ARegistryEntriesQuery,\n type UpdateA2ARegistryEntryMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateA2ARegistryEntryInput,\n UpdateA2ARegistryEntryInput,\n} from '../../generated/wspace-types';\nimport type { A2AAgentFilter } from '../types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspacePaginatedQuery,\n useWorkspaceQuery,\n type PaginatedQueryResult,\n type QueryResult,\n} from './internal/workspaceGateway';\n\n/** Page size for the registry list; further pages load on demand (BOFF-12509). */\nexport const A2A_LIST_PAGE_SIZE = 50;\n\n/** Field limits for a registry entry (BOFF-12508). The name column is VARCHAR(255). */\nexport const A2A_NAME_MAX = 255;\nexport const A2A_DESCRIPTION_MAX = 2000;\nexport const A2A_URL_MAX = 2048;\n/** The service refuses an agent card larger than 1 MiB. */\nexport const A2A_AGENT_CARD_MAX_BYTES = 1024 * 1024;\n\nexport interface A2AAgentRecord {\n id: string;\n name: string;\n status: string;\n visibility: string;\n trustLevel: string;\n /** A2A agent card (the `/.well-known/agent.json` document). */\n agentCard: Record<string, unknown>;\n entitlements: Record<string, unknown> | unknown[];\n description?: string | null;\n wellKnownUrl?: string | null;\n bucketId?: string | null;\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\n/** `CreateA2ARegistryEntryInput` minus the `workspaceId` the hook supplies. */\nexport type RegisterA2AAgentVariables = Omit<\n GraphQLInput<CreateA2ARegistryEntryInput>,\n 'workspaceId'\n>;\n\nexport interface UpdateA2AAgentVariables {\n agentId: string;\n input: GraphQLInput<UpdateA2ARegistryEntryInput>;\n}\n\nconst REGISTER_AGENT_FIELDS = fieldsOf<CreateA2ARegistryEntryInput>({\n agentCard: true,\n bucketId: true,\n description: true,\n entitlements: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n trustLevel: true,\n visibility: true,\n wellKnownUrl: true,\n workspaceId: true,\n});\n\nconst UPDATE_AGENT_FIELDS = fieldsOf<UpdateA2ARegistryEntryInput>({\n agentCard: true,\n bucketId: true,\n description: true,\n entitlements: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n trustLevel: true,\n visibility: true,\n wellKnownUrl: true,\n});\n\n/** One validation problem, as a translation key plus its English fallback. */\nexport interface A2AValidationIssue {\n key: string;\n fallback: string;\n params?: Record<string, string | number>;\n}\n\nexport interface AgentCardValidation {\n valid: boolean;\n errors: A2AValidationIssue[];\n}\n\n/**\n * The agent-card fields the UI renders. `agentCard` is a free-form `JSON`\n * column on the service, so every field is read defensively — a card that is\n * missing `capabilities`, or that stores `skills` as an object instead of an\n * array, must render as \"not supported\"/\"none\" rather than throw.\n */\nexport interface A2AAgentCardView {\n url: string;\n version: string;\n providerOrganization: string;\n documentationUrl: string;\n capabilities: {\n streaming: boolean;\n pushNotifications: boolean;\n stateTransitionHistory: boolean;\n };\n authenticationSchemes: string[];\n defaultInputModes: string[];\n defaultOutputModes: string[];\n skills: A2AAgentCardSkill[];\n}\n\nexport interface A2AAgentCardSkill {\n id: string;\n name: string;\n description: string;\n tags: string[];\n examples: string[];\n}\n\n/**\n * The permissions the service checks on a registry entry's entitlements\n * (`A2AEntitlementService`): a connection needs `agent:delegate` or\n * `task:create`, and a task sent to the entry needs `task:create`.\n */\nexport const A2A_ENTITLEMENT_PERMISSIONS = ['agent:delegate', 'task:create'] as const;\nexport type A2AEntitlementPermission = (typeof A2A_ENTITLEMENT_PERMISSIONS)[number];\n\n/**\n * One row of the `entitlements` JSON in the shape the service enforces\n * (BOFF-12506): a permission, an optional list of local sender agents it is\n * limited to, and an optional validity window. A row without a permission is\n * ignored by the service, so it is flagged `recognised: false` instead of\n * being shown as if it granted anything.\n */\nexport interface A2AEntitlementView {\n id: string;\n recognised: boolean;\n permission: string;\n /** Local agents that may use this grant; empty means every agent in the workspace. */\n agentIds: string[];\n validFrom?: string;\n validUntil?: string;\n /**\n * Fields the service stores but does not enforce on an A2A call (bucket, app\n * and knowledge-base scope, rate limits). Kept on save, listed read-only.\n */\n unenforced: string[];\n}\n\n/** Editable form of one entitlement. Dates are `YYYY-MM-DD` (empty = open-ended). */\nexport interface A2AEntitlementDraft {\n permission: A2AEntitlementPermission;\n agentIds: string[];\n validFrom: string;\n validUntil: string;\n /** The original JSON row, so fields the editor does not show survive a save. */\n original?: Record<string, unknown>;\n}\n\nconst NO_AGENTS: A2AAgentRecord[] = [];\n\nfunction asRecord(value: unknown): Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\nfunction asString(value: unknown, fallback = ''): string {\n return typeof value === 'string' ? value : fallback;\n}\n\nfunction asBoolean(value: unknown): boolean {\n return value === true;\n}\n\nfunction asStringArray(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((entry): entry is string => typeof entry === 'string')\n : [];\n}\n\nfunction asObjectArray(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value) ? value.map(asRecord) : [];\n}\n\n/** Reads the renderable view of an A2A agent card out of its JSON document. */\nexport function readAgentCard(card: Record<string, unknown> | undefined): A2AAgentCardView {\n const source = asRecord(card);\n const capabilities = asRecord(source.capabilities);\n const authentication = asRecord(source.authentication);\n\n return {\n url: asString(source.url),\n version: asString(source.version),\n providerOrganization: asString(asRecord(source.provider).organization),\n documentationUrl: asString(source.documentationUrl),\n capabilities: {\n streaming: asBoolean(capabilities.streaming),\n pushNotifications: asBoolean(capabilities.pushNotifications),\n stateTransitionHistory: asBoolean(capabilities.stateTransitionHistory),\n },\n authenticationSchemes: asStringArray(authentication.schemes),\n defaultInputModes: asStringArray(source.defaultInputModes),\n defaultOutputModes: asStringArray(source.defaultOutputModes),\n skills: asObjectArray(source.skills).map((skill, index) => ({\n id: asString(skill.id, `skill-${index}`),\n name: asString(skill.name),\n description: asString(skill.description),\n tags: asStringArray(skill.tags),\n examples: asStringArray(skill.examples),\n })),\n };\n}\n\nconst UNENFORCED_SCOPE_KEYS = ['bucketIds', 'appIds', 'knowledgeBaseIds'] as const;\n\nfunction unenforcedFields(entitlement: Record<string, unknown>): string[] {\n const scope = asRecord(entitlement.scope);\n const fields: string[] = UNENFORCED_SCOPE_KEYS.filter(\n (key) => asStringArray(scope[key]).length > 0\n ).map((key) => `scope.${key}`);\n if (Object.keys(asRecord(entitlement.rateLimit)).length > 0) fields.push('rateLimit');\n return fields;\n}\n\n/** Reads the entitlement rows out of the `entitlements` JSON column. */\nexport function readEntitlements(\n entitlements: Record<string, unknown> | unknown[] | null | undefined\n): A2AEntitlementView[] {\n return asObjectArray(entitlements).map((entitlement, index) => {\n const permission = asString(entitlement.permission).trim().toLowerCase();\n const validFrom = asString(entitlement.validFrom);\n const validUntil = asString(entitlement.validUntil);\n return {\n id: `entitlement-${index}`,\n recognised: permission.length > 0,\n permission,\n agentIds: asStringArray(asRecord(entitlement.scope).agentIds),\n validFrom: validFrom || undefined,\n validUntil: validUntil || undefined,\n unenforced: unenforcedFields(entitlement),\n };\n });\n}\n\nfunction toDateInput(value: string | undefined): string {\n if (!value) return '';\n const parsed = Date.parse(value);\n return Number.isFinite(parsed) ? new Date(parsed).toISOString().slice(0, 10) : '';\n}\n\nfunction isEntitlementPermission(value: string): value is A2AEntitlementPermission {\n return (A2A_ENTITLEMENT_PERMISSIONS as readonly string[]).includes(value);\n}\n\n/**\n * Editable drafts for the entitlements the service recognises. Rows it ignores\n * (no permission, or a permission it never checks) are not editable here;\n * `toEntitlementsInput` keeps them untouched.\n */\nexport function toEntitlementDrafts(\n entitlements: Record<string, unknown> | unknown[] | null | undefined\n): A2AEntitlementDraft[] {\n const rows = asObjectArray(entitlements);\n return readEntitlements(entitlements).flatMap((view, index) =>\n view.recognised && isEntitlementPermission(view.permission)\n ? [\n {\n permission: view.permission,\n agentIds: view.agentIds,\n validFrom: toDateInput(view.validFrom),\n validUntil: toDateInput(view.validUntil),\n original: rows[index],\n },\n ]\n : []\n );\n}\n\n/**\n * Rows of the stored JSON the editor does not manage, so a save from the\n * editor does not silently drop them.\n */\nexport function unmanagedEntitlements(\n entitlements: Record<string, unknown> | unknown[] | null | undefined\n): Record<string, unknown>[] {\n const rows = asObjectArray(entitlements);\n return readEntitlements(entitlements).flatMap((view, index) =>\n view.recognised && isEntitlementPermission(view.permission) ? [] : [rows[index]]\n );\n}\n\n/**\n * Serialises edited entitlements to the JSON the service enforces. A newly\n * chosen start date begins at 00:00 UTC and an end date runs to the end of\n * that UTC day; an unchanged stored timestamp is kept as it was.\n */\nexport function toEntitlementsInput(\n drafts: A2AEntitlementDraft[],\n unmanaged: Record<string, unknown>[] = []\n): Record<string, unknown>[] {\n const edited = drafts.map((draft) => {\n const row: Record<string, unknown> = { ...(draft.original ?? {}) };\n row.permission = draft.permission;\n const scope = { ...asRecord(row.scope) };\n if (draft.agentIds.length > 0) scope.agentIds = draft.agentIds;\n else delete scope.agentIds;\n if (Object.keys(scope).length > 0) row.scope = scope;\n else delete row.scope;\n // A stored timestamp whose day was not changed is kept exactly: the editor\n // works in days, and rewriting 12:00 as 23:59:59 would quietly extend it.\n const original = draft.original ?? {};\n const keep = (field: 'validFrom' | 'validUntil') => {\n const stored = asString(original[field]);\n return stored && toDateInput(stored) === draft[field] ? stored : undefined;\n };\n if (draft.validFrom) row.validFrom = keep('validFrom') ?? `${draft.validFrom}T00:00:00.000Z`;\n else delete row.validFrom;\n if (draft.validUntil)\n row.validUntil = keep('validUntil') ?? `${draft.validUntil}T23:59:59.999Z`;\n else delete row.validUntil;\n return row;\n });\n return [...edited, ...unmanaged];\n}\n\n/** Per-draft validation: an end date must not come before the start date. */\nexport function entitlementDraftError(draft: A2AEntitlementDraft): 'validityOrder' | undefined {\n if (draft.validFrom && draft.validUntil && draft.validUntil < draft.validFrom) {\n return 'validityOrder';\n }\n return undefined;\n}\n\n/**\n * True when at least one entitlement, valid now, lets a connection be made —\n * the service refuses every connection to an entry without one (default deny).\n */\nexport function entitlementsAllowConnections(\n entitlements: Record<string, unknown> | unknown[] | null | undefined,\n now: number = Date.now()\n): boolean {\n const isActive = (view: A2AEntitlementView) => {\n const from = view.validFrom ? Date.parse(view.validFrom) : NaN;\n const until = view.validUntil ? Date.parse(view.validUntil) : NaN;\n return !(Number.isFinite(from) && now < from) && !(Number.isFinite(until) && now > until);\n };\n return readEntitlements(entitlements).some(\n (view) => view.recognised && isEntitlementPermission(view.permission) && isActive(view)\n );\n}\n\n/** Number of skills the registered agent card advertises. */\nexport function a2aAgentSkillCount(agent: Pick<A2AAgentRecord, 'agentCard'>): number {\n const skills = agent.agentCard?.skills;\n return Array.isArray(skills) ? skills.length : 0;\n}\n\n/**\n * Structural check of an A2A agent card before it is registered. This validates\n * the document the caller supplies — it does NOT contact the remote agent.\n */\nexport function validateAgentCard(card: Record<string, unknown> | undefined): AgentCardValidation {\n const errors: A2AValidationIssue[] = [];\n if (!card) {\n return {\n valid: false,\n errors: [\n {\n key: 'botlit.a2aRegistry.validation.cardRequired',\n fallback: 'An agent card is required',\n },\n ],\n };\n }\n for (const field of ['name', 'description', 'url', 'version'] as const) {\n if (typeof card[field] !== 'string' || (card[field] as string).trim() === '') {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardMissingField',\n fallback: 'Agent card is missing \"{{field}}\"',\n params: { field },\n });\n }\n }\n if (typeof card.url === 'string' && card.url.trim() !== '' && !isHttpsUrl(card.url)) {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardUrlHttps',\n fallback: 'The card\\'s \"url\" must be an https:// address',\n });\n }\n if (!Array.isArray(card.skills) || card.skills.length === 0) {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardNoSkills',\n fallback: 'Agent card must advertise at least one skill',\n });\n }\n return { valid: errors.length === 0, errors };\n}\n\n/** True for an absolute `https://` URL with a host. */\nexport function isHttpsUrl(value: string): boolean {\n try {\n const url = new URL(value.trim());\n return url.protocol === 'https:' && url.hostname.length > 0;\n } catch {\n return false;\n }\n}\n\n/** The registry form as the page edits it. */\nexport interface A2ARegistryFormValues {\n name: string;\n description: string;\n wellKnownUrl: string;\n agentCardJson: string;\n}\n\nexport type A2ARegistryFormField = 'name' | 'description' | 'wellKnownUrl' | 'agentCardJson';\n\n/** Parses the edited agent card; returns undefined when the JSON is malformed. */\nexport function parseAgentCardJson(json: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(json);\n return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The name the entry is saved with: the typed name, or the card's own name\n * when the field is left empty (BOFF-12510), so the list and the card agree\n * unless the user deliberately overrides it.\n */\nexport function effectiveEntryName(values: A2ARegistryFormValues): string {\n const typed = values.name.trim();\n if (typed) return typed;\n const cardName = parseAgentCardJson(values.agentCardJson)?.name;\n return typeof cardName === 'string' ? cardName.trim() : '';\n}\n\n/** The description the entry is saved with (typed, else the card's). */\nexport function effectiveEntryDescription(values: A2ARegistryFormValues): string {\n const typed = values.description.trim();\n if (typed) return typed;\n const cardDescription = parseAgentCardJson(values.agentCardJson)?.description;\n return typeof cardDescription === 'string' ? cardDescription.trim() : '';\n}\n\n/**\n * Field-level validation for the register/edit form (BOFF-12508). Returns at\n * most one issue per field, so each can be shown inline next to its input.\n */\nexport function validateRegistryForm(\n values: A2ARegistryFormValues\n): Partial<Record<A2ARegistryFormField, A2AValidationIssue>> {\n const issues: Partial<Record<A2ARegistryFormField, A2AValidationIssue>> = {};\n\n const card = parseAgentCardJson(values.agentCardJson);\n if (!values.agentCardJson.trim()) {\n issues.agentCardJson = {\n key: 'botlit.a2aRegistry.validation.cardRequired',\n fallback: 'An agent card is required',\n };\n } else if (new TextEncoder().encode(values.agentCardJson).length > A2A_AGENT_CARD_MAX_BYTES) {\n issues.agentCardJson = {\n key: 'botlit.a2aRegistry.validation.cardTooLarge',\n fallback: 'The agent card must be at most 1 MiB',\n };\n } else if (!card) {\n issues.agentCardJson = {\n key: 'botlit.a2aRegistry.validation.cardInvalidJson',\n fallback: 'Agent card must be a valid JSON object',\n };\n } else {\n const cardCheck = validateAgentCard(card);\n if (!cardCheck.valid) issues.agentCardJson = cardCheck.errors[0];\n }\n\n const name = effectiveEntryName(values);\n if (!name) {\n issues.name = {\n key: 'botlit.a2aRegistry.validation.nameRequired',\n fallback: 'Enter a name, or paste a card that has one',\n };\n } else if (name.length > A2A_NAME_MAX) {\n issues.name = {\n key: 'botlit.a2aRegistry.validation.nameTooLong',\n fallback: 'Name must be at most {{max}} characters',\n params: { max: A2A_NAME_MAX },\n };\n }\n\n if (effectiveEntryDescription(values).length > A2A_DESCRIPTION_MAX) {\n issues.description = {\n key: 'botlit.a2aRegistry.validation.descriptionTooLong',\n fallback: 'Description must be at most {{max}} characters',\n params: { max: A2A_DESCRIPTION_MAX },\n };\n }\n\n const wellKnownUrl = values.wellKnownUrl.trim();\n if (wellKnownUrl) {\n if (wellKnownUrl.length > A2A_URL_MAX) {\n issues.wellKnownUrl = {\n key: 'botlit.a2aRegistry.validation.urlTooLong',\n fallback: 'URL must be at most {{max}} characters',\n params: { max: A2A_URL_MAX },\n };\n } else if (!isHttpsUrl(wellKnownUrl)) {\n issues.wellKnownUrl = {\n key: 'botlit.a2aRegistry.validation.wellKnownHttps',\n fallback: 'Enter an https:// URL, e.g. https://agent.example.com/.well-known/agent.json',\n };\n }\n }\n\n return issues;\n}\n\nfunction identityRows(rows: A2AAgentRecord[]): A2AAgentRecord[] {\n return rows;\n}\n\nfunction selectAgents(data: ListA2ARegistryEntriesQuery | undefined): A2AAgentRecord[] {\n return data?.listA2ARegistryEntries ?? NO_AGENTS;\n}\n\nexport const a2aKeys = {\n all: ['a2a'] as const,\n lists: () => [...a2aKeys.all, 'list'] as const,\n list: (filter?: A2AAgentFilter) => [...a2aKeys.lists(), filter] as const,\n details: () => [...a2aKeys.all, 'detail'] as const,\n detail: (id: string) => [...a2aKeys.details(), id] as const,\n};\n\n/**\n * The registry list, one page at a time (BOFF-12509). Status, trust level,\n * visibility and bucket filter on the server. The service has no free-text\n * filter, so `search` narrows the rows loaded so far; the page keeps loading\n * further pages while a search is active, so a match is never hidden behind\n * an unloaded page.\n */\nexport function useA2AAgents(filter?: A2AAgentFilter): PaginatedQueryResult<A2AAgentRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n const status = filter?.status?.[0];\n const visibility = filter?.visibility?.[0];\n const trustLevel = filter?.trustLevel?.[0];\n const bucketId = filter?.bucketId;\n\n const variables = useMemo(\n () => ({ filters: { workspaceId, status, visibility, trustLevel, bucketId } }),\n [workspaceId, status, visibility, trustLevel, bucketId]\n );\n\n const result = useWorkspacePaginatedQuery<\n ListA2ARegistryEntriesQuery,\n A2AAgentRecord,\n A2AAgentRecord[]\n >({\n document: ListA2ARegistryEntriesDocument,\n variables,\n pageSize: A2A_LIST_PAGE_SIZE,\n extractRows: selectAgents,\n select: identityRows,\n fallback: NO_AGENTS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load the A2A registry',\n });\n\n // Narrowed here, not in `select`: the paginated hook applies `select` only\n // when a page arrives, and a new search term must re-filter the loaded rows.\n const rows = result.data;\n const data = useMemo(\n () =>\n search\n ? rows.filter(\n (row) =>\n row.name.toLowerCase().includes(search) ||\n (row.description ?? '').toLowerCase().includes(search)\n )\n : rows,\n [rows, search]\n );\n\n return { ...result, data };\n}\n\nexport function useA2AAgent(agentId: string | undefined): QueryResult<A2AAgentRecord | null> {\n const variables = useMemo(() => ({ id: agentId ?? '' }), [agentId]);\n\n return useWorkspaceQuery<GetA2ARegistryEntryQuery, A2AAgentRecord | null>({\n document: GetA2ARegistryEntryDocument,\n variables,\n select: (data) => data?.getA2ARegistryEntry ?? null,\n fallback: null,\n enabled: Boolean(agentId),\n errorMessage: 'Failed to load A2A agent',\n });\n}\n\nexport function useRegisterA2AAgent() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: RegisterA2AAgentVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, REGISTER_AGENT_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateA2ARegistryEntryMutation,\n RegisterA2AAgentVariables,\n A2AAgentRecord\n >({\n document: CreateA2ARegistryEntryDocument,\n variables,\n select: (data) => data?.createA2ARegistryEntry,\n errorMessage: 'Failed to register A2A agent',\n });\n}\n\nexport function useUpdateA2AAgent() {\n return useWorkspaceMutation<\n UpdateA2ARegistryEntryMutation,\n UpdateA2AAgentVariables,\n A2AAgentRecord\n >({\n document: UpdateA2ARegistryEntryDocument,\n variables: ({ agentId, input }) => ({\n id: agentId,\n input: buildMutationInput(input, UPDATE_AGENT_FIELDS),\n }),\n select: (data) => data?.updateA2ARegistryEntry,\n errorMessage: 'Failed to update A2A agent',\n });\n}\n\nexport function useDeleteA2AAgent() {\n return useWorkspaceMutation<DeleteA2ARegistryEntryMutation, string, boolean>({\n document: DeleteA2ARegistryEntryDocument,\n variables: (agentId) => ({ id: agentId }),\n select: (data) => data?.deleteA2ARegistryEntry,\n errorMessage: 'Failed to remove A2A agent',\n });\n}\n\n/**\n * Validates an agent card locally before registration. There is no server-side\n * validation operation, so this deliberately reports only what can be checked\n * from the document itself.\n */\nexport function useValidateA2AAgent() {\n const validate = useCallback(\n async (card: Record<string, unknown> | undefined): Promise<AgentCardValidation> =>\n validateAgentCard(card),\n []\n );\n\n return [validate, { loading: false, error: undefined }] as const;\n}\n"],"mappings":";;;;AAyCA,IAAaA,IAAsB,KACtBC,IAAc,MAEdC,IAA2B,SAmClCC,IAAwBC,EAAsC;CAClE,WAAW;CACX,UAAU;CACV,aAAa;CACb,cAAc;CACd,UAAU;CACV,MAAM;CACN,QAAQ;CACR,MAAM;CACN,YAAY;CACZ,YAAY;CACZ,cAAc;CACd,aAAa;AACf,CAAC,GAEKC,IAAsBD,EAAsC;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S,MAAShB,GAAM;EACxB,cAAc;CAChB,CAAC;AACH"}
1
+ {"version":3,"file":"useA2A.js","names":["A2A_DESCRIPTION_MAX","A2A_URL_MAX","A2A_AGENT_CARD_MAX_BYTES","REGISTER_AGENT_FIELDS","fieldsOf","UPDATE_AGENT_FIELDS","A2A_ENTITLEMENT_PERMISSIONS","NO_AGENTS","asRecord","value","asString","fallback","asBoolean","asStringArray","entry","asObjectArray","preferredCardEndpoint","source","card","readSchemes","readAgentCard","capabilities","authentication","skill","index","UNENFORCED_SCOPE_KEYS","unenforcedFields","scope","entitlement","fields","key","readEntitlements","entitlements","permission","validFrom","validUntil","toDateInput","parsed","isEntitlementPermission","toEntitlementDrafts","rows","view","unmanagedEntitlements","toEntitlementsInput","drafts","row","draft","original","keep","stored","field","unmanaged","entitlementDraftError","entitlementsAllowConnections","isActive","from","until","now","a2aAgentSkillCount","skills","agent","validateAgentCard","errors","endpoint","isHttpsUrl","interfaceUrls","url","parseAgentCardJson","json","effectiveEntryName","typed","values","cardName","effectiveEntryDescription","cardDescription","validateRegistryForm","issues","cardCheck","name","wellKnownUrl","identityRows","selectAgents","data","useA2AAgents","workspaceId","useWorkspaceId","search","filter","status","visibility","trustLevel","bucketId","variables","useMemo","result","useWorkspacePaginatedQuery","ListA2ARegistryEntriesDocument","useA2AAgent","agentId","useWorkspaceQuery","GetA2ARegistryEntryDocument","useRegisterA2AAgent","useCallback","buildMutationInput","input","useWorkspaceMutation","CreateA2ARegistryEntryDocument","useUpdateA2AAgent","UpdateA2ARegistryEntryDocument","useDeleteA2AAgent","DeleteA2ARegistryEntryDocument","useVerifyA2AAgent","VerifyA2ARegistryEntryDocument","NO_USAGE","useA2AAgentUsage","GetA2ARegistryEntryUsageDocument","enabled"],"sources":["../../../src/botlit/hooks/useA2A.ts"],"sourcesContent":["/**\n * A2A Registry Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listA2ARegistryEntries` / `getA2ARegistryEntry`\n * operations and the create/update/delete mutations on wspace-botlit-svc.\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateA2ARegistryEntryDocument,\n DeleteA2ARegistryEntryDocument,\n GetA2ARegistryEntryDocument,\n GetA2ARegistryEntryUsageDocument,\n ListA2ARegistryEntriesDocument,\n UpdateA2ARegistryEntryDocument,\n VerifyA2ARegistryEntryDocument,\n type CreateA2ARegistryEntryMutation,\n type DeleteA2ARegistryEntryMutation,\n type GetA2ARegistryEntryQuery,\n type GetA2ARegistryEntryUsageQuery,\n type ListA2ARegistryEntriesQuery,\n type UpdateA2ARegistryEntryMutation,\n type VerifyA2ARegistryEntryMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateA2ARegistryEntryInput,\n UpdateA2ARegistryEntryInput,\n} from '../../generated/wspace-types';\nimport type { A2AAgentFilter } from '../types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspacePaginatedQuery,\n useWorkspaceQuery,\n type PaginatedQueryResult,\n type QueryResult,\n} from './internal/workspaceGateway';\n\n/** Page size for the registry list; further pages load on demand (BOFF-12509). */\nexport const A2A_LIST_PAGE_SIZE = 50;\n\n/** Field limits for a registry entry (BOFF-12508). The name column is VARCHAR(255). */\nexport const A2A_NAME_MAX = 255;\nexport const A2A_DESCRIPTION_MAX = 2000;\nexport const A2A_URL_MAX = 2048;\n/** The service refuses an agent card larger than 1 MiB. */\nexport const A2A_AGENT_CARD_MAX_BYTES = 1024 * 1024;\n\nexport interface A2AAgentRecord {\n id: string;\n name: string;\n status: string;\n visibility: string;\n trustLevel: string;\n /** A2A agent card (the `/.well-known/agent.json` document). */\n agentCard: Record<string, unknown>;\n entitlements: Record<string, unknown> | unknown[];\n description?: string | null;\n wellKnownUrl?: string | null;\n bucketId?: string | null;\n metadata?: Record<string, unknown> | null;\n revision: number;\n tags: string[];\n /** BOFF-15360 — the outcome of the last check of the published card. */\n verificationStatus: string;\n /** Why the last check failed (fetch, schema, origin or signature). */\n verificationError?: string | null;\n verifiedAt?: string | null;\n /** The card's JWS signature verified against the publisher's keys. */\n cardSigned: boolean;\n /** The trust level the registrant asked for; verification caps what it gets. */\n requestedTrustLevel: string;\n createdAt: string;\n updatedAt: string;\n createdById: string;\n updatedById: string;\n workspaceId: string;\n}\n\n/** `CreateA2ARegistryEntryInput` minus the `workspaceId` the hook supplies. */\nexport type RegisterA2AAgentVariables = Omit<\n GraphQLInput<CreateA2ARegistryEntryInput>,\n 'workspaceId'\n>;\n\nexport interface UpdateA2AAgentVariables {\n agentId: string;\n input: GraphQLInput<UpdateA2ARegistryEntryInput>;\n}\n\nconst REGISTER_AGENT_FIELDS = fieldsOf<CreateA2ARegistryEntryInput>({\n agentCard: true,\n bucketId: true,\n description: true,\n entitlements: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n trustLevel: true,\n visibility: true,\n wellKnownUrl: true,\n workspaceId: true,\n});\n\nconst UPDATE_AGENT_FIELDS = fieldsOf<UpdateA2ARegistryEntryInput>({\n agentCard: true,\n bucketId: true,\n description: true,\n entitlements: true,\n metadata: true,\n name: true,\n status: true,\n tags: true,\n trustLevel: true,\n visibility: true,\n wellKnownUrl: true,\n});\n\n/** One validation problem, as a translation key plus its English fallback. */\nexport interface A2AValidationIssue {\n key: string;\n fallback: string;\n params?: Record<string, string | number>;\n}\n\nexport interface AgentCardValidation {\n valid: boolean;\n errors: A2AValidationIssue[];\n}\n\n/**\n * The agent-card fields the UI renders. `agentCard` is a free-form `JSON`\n * column on the service, so every field is read defensively — a card that is\n * missing `capabilities`, or that stores `skills` as an object instead of an\n * array, must render as \"not supported\"/\"none\" rather than throw.\n */\nexport interface A2AAgentCardView {\n url: string;\n version: string;\n providerOrganization: string;\n documentationUrl: string;\n capabilities: {\n streaming: boolean;\n pushNotifications: boolean;\n stateTransitionHistory: boolean;\n };\n authenticationSchemes: string[];\n defaultInputModes: string[];\n defaultOutputModes: string[];\n skills: A2AAgentCardSkill[];\n}\n\nexport interface A2AAgentCardSkill {\n id: string;\n name: string;\n description: string;\n tags: string[];\n examples: string[];\n}\n\n/**\n * The permissions the service checks on a registry entry's entitlements\n * (`A2AEntitlementService`): a connection needs `agent:delegate` or\n * `task:create`, and a task sent to the entry needs `task:create`.\n */\nexport const A2A_ENTITLEMENT_PERMISSIONS = ['agent:delegate', 'task:create'] as const;\nexport type A2AEntitlementPermission = (typeof A2A_ENTITLEMENT_PERMISSIONS)[number];\n\n/**\n * One row of the `entitlements` JSON in the shape the service enforces\n * (BOFF-12506): a permission, an optional list of local sender agents it is\n * limited to, and an optional validity window. A row without a permission is\n * ignored by the service, so it is flagged `recognised: false` instead of\n * being shown as if it granted anything.\n */\nexport interface A2AEntitlementView {\n id: string;\n recognised: boolean;\n permission: string;\n /** Local agents that may use this grant; empty means every agent in the workspace. */\n agentIds: string[];\n validFrom?: string;\n validUntil?: string;\n /**\n * Fields the service stores but does not enforce on an A2A call (bucket, app\n * and knowledge-base scope, rate limits). Kept on save, listed read-only.\n */\n unenforced: string[];\n}\n\n/** Editable form of one entitlement. Dates are `YYYY-MM-DD` (empty = open-ended). */\nexport interface A2AEntitlementDraft {\n permission: A2AEntitlementPermission;\n agentIds: string[];\n validFrom: string;\n validUntil: string;\n /** The original JSON row, so fields the editor does not show survive a save. */\n original?: Record<string, unknown>;\n}\n\nconst NO_AGENTS: A2AAgentRecord[] = [];\n\nfunction asRecord(value: unknown): Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : {};\n}\n\nfunction asString(value: unknown, fallback = ''): string {\n return typeof value === 'string' ? value : fallback;\n}\n\nfunction asBoolean(value: unknown): boolean {\n return value === true;\n}\n\nfunction asStringArray(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((entry): entry is string => typeof entry === 'string')\n : [];\n}\n\nfunction asObjectArray(value: unknown): Record<string, unknown>[] {\n return Array.isArray(value) ? value.map(asRecord) : [];\n}\n\n/**\n * BOFF-15360 — the endpoint a card names first: `url` (A2A 0.x), else the\n * first of `supportedInterfaces` (A2A 1.0), else 0.3 `additionalInterfaces`.\n */\nexport function preferredCardEndpoint(card: Record<string, unknown> | undefined): string {\n const source = asRecord(card);\n const candidates = [\n source.url,\n ...asObjectArray(source.supportedInterfaces).map((entry) => entry.url),\n ...asObjectArray(source.additionalInterfaces).map((entry) => entry.url),\n ];\n const found = candidates.find(\n (value): value is string => typeof value === 'string' && value.trim() !== ''\n );\n return found ?? '';\n}\n\n/** Scheme names, whether a card lists them as strings or as `{ scheme }` objects. */\nfunction readSchemes(value: unknown): string[] {\n if (!Array.isArray(value)) return [];\n return value\n .map((entry) => (typeof entry === 'string' ? entry : asString(asRecord(entry).scheme)))\n .filter((entry) => entry !== '');\n}\n\n/** Reads the renderable view of an A2A agent card out of its JSON document. */\nexport function readAgentCard(card: Record<string, unknown> | undefined): A2AAgentCardView {\n const source = asRecord(card);\n const capabilities = asRecord(source.capabilities);\n const authentication = asRecord(source.authentication);\n\n return {\n url: preferredCardEndpoint(source),\n version: asString(source.version),\n providerOrganization: asString(asRecord(source.provider).organization),\n documentationUrl: asString(source.documentationUrl),\n capabilities: {\n streaming: asBoolean(capabilities.streaming),\n pushNotifications: asBoolean(capabilities.pushNotifications),\n stateTransitionHistory: asBoolean(capabilities.stateTransitionHistory),\n },\n authenticationSchemes: readSchemes(authentication.schemes),\n defaultInputModes: asStringArray(source.defaultInputModes),\n defaultOutputModes: asStringArray(source.defaultOutputModes),\n skills: asObjectArray(source.skills).map((skill, index) => ({\n id: asString(skill.id, `skill-${index}`),\n name: asString(skill.name),\n description: asString(skill.description),\n tags: asStringArray(skill.tags),\n examples: asStringArray(skill.examples),\n })),\n };\n}\n\nconst UNENFORCED_SCOPE_KEYS = ['bucketIds', 'appIds', 'knowledgeBaseIds'] as const;\n\nfunction unenforcedFields(entitlement: Record<string, unknown>): string[] {\n const scope = asRecord(entitlement.scope);\n const fields: string[] = UNENFORCED_SCOPE_KEYS.filter(\n (key) => asStringArray(scope[key]).length > 0\n ).map((key) => `scope.${key}`);\n if (Object.keys(asRecord(entitlement.rateLimit)).length > 0) fields.push('rateLimit');\n return fields;\n}\n\n/** Reads the entitlement rows out of the `entitlements` JSON column. */\nexport function readEntitlements(\n entitlements: Record<string, unknown> | unknown[] | null | undefined\n): A2AEntitlementView[] {\n return asObjectArray(entitlements).map((entitlement, index) => {\n const permission = asString(entitlement.permission).trim().toLowerCase();\n const validFrom = asString(entitlement.validFrom);\n const validUntil = asString(entitlement.validUntil);\n return {\n id: `entitlement-${index}`,\n recognised: permission.length > 0,\n permission,\n agentIds: asStringArray(asRecord(entitlement.scope).agentIds),\n validFrom: validFrom || undefined,\n validUntil: validUntil || undefined,\n unenforced: unenforcedFields(entitlement),\n };\n });\n}\n\nfunction toDateInput(value: string | undefined): string {\n if (!value) return '';\n const parsed = Date.parse(value);\n return Number.isFinite(parsed) ? new Date(parsed).toISOString().slice(0, 10) : '';\n}\n\nfunction isEntitlementPermission(value: string): value is A2AEntitlementPermission {\n return (A2A_ENTITLEMENT_PERMISSIONS as readonly string[]).includes(value);\n}\n\n/**\n * Editable drafts for the entitlements the service recognises. Rows it ignores\n * (no permission, or a permission it never checks) are not editable here;\n * `toEntitlementsInput` keeps them untouched.\n */\nexport function toEntitlementDrafts(\n entitlements: Record<string, unknown> | unknown[] | null | undefined\n): A2AEntitlementDraft[] {\n const rows = asObjectArray(entitlements);\n return readEntitlements(entitlements).flatMap((view, index) =>\n view.recognised && isEntitlementPermission(view.permission)\n ? [\n {\n permission: view.permission,\n agentIds: view.agentIds,\n validFrom: toDateInput(view.validFrom),\n validUntil: toDateInput(view.validUntil),\n original: rows[index],\n },\n ]\n : []\n );\n}\n\n/**\n * Rows of the stored JSON the editor does not manage, so a save from the\n * editor does not silently drop them.\n */\nexport function unmanagedEntitlements(\n entitlements: Record<string, unknown> | unknown[] | null | undefined\n): Record<string, unknown>[] {\n const rows = asObjectArray(entitlements);\n return readEntitlements(entitlements).flatMap((view, index) =>\n view.recognised && isEntitlementPermission(view.permission) ? [] : [rows[index]]\n );\n}\n\n/**\n * Serialises edited entitlements to the JSON the service enforces. A newly\n * chosen start date begins at 00:00 UTC and an end date runs to the end of\n * that UTC day; an unchanged stored timestamp is kept as it was.\n */\nexport function toEntitlementsInput(\n drafts: A2AEntitlementDraft[],\n unmanaged: Record<string, unknown>[] = []\n): Record<string, unknown>[] {\n const edited = drafts.map((draft) => {\n const row: Record<string, unknown> = { ...(draft.original ?? {}) };\n row.permission = draft.permission;\n const scope = { ...asRecord(row.scope) };\n if (draft.agentIds.length > 0) scope.agentIds = draft.agentIds;\n else delete scope.agentIds;\n if (Object.keys(scope).length > 0) row.scope = scope;\n else delete row.scope;\n // A stored timestamp whose day was not changed is kept exactly: the editor\n // works in days, and rewriting 12:00 as 23:59:59 would quietly extend it.\n const original = draft.original ?? {};\n const keep = (field: 'validFrom' | 'validUntil') => {\n const stored = asString(original[field]);\n return stored && toDateInput(stored) === draft[field] ? stored : undefined;\n };\n if (draft.validFrom) row.validFrom = keep('validFrom') ?? `${draft.validFrom}T00:00:00.000Z`;\n else delete row.validFrom;\n if (draft.validUntil)\n row.validUntil = keep('validUntil') ?? `${draft.validUntil}T23:59:59.999Z`;\n else delete row.validUntil;\n return row;\n });\n return [...edited, ...unmanaged];\n}\n\n/** Per-draft validation: an end date must not come before the start date. */\nexport function entitlementDraftError(draft: A2AEntitlementDraft): 'validityOrder' | undefined {\n if (draft.validFrom && draft.validUntil && draft.validUntil < draft.validFrom) {\n return 'validityOrder';\n }\n return undefined;\n}\n\n/**\n * True when at least one entitlement, valid now, lets a connection be made —\n * the service refuses every connection to an entry without one (default deny).\n */\nexport function entitlementsAllowConnections(\n entitlements: Record<string, unknown> | unknown[] | null | undefined,\n now: number = Date.now()\n): boolean {\n const isActive = (view: A2AEntitlementView) => {\n const from = view.validFrom ? Date.parse(view.validFrom) : NaN;\n const until = view.validUntil ? Date.parse(view.validUntil) : NaN;\n return !(Number.isFinite(from) && now < from) && !(Number.isFinite(until) && now > until);\n };\n return readEntitlements(entitlements).some(\n (view) => view.recognised && isEntitlementPermission(view.permission) && isActive(view)\n );\n}\n\n/** Number of skills the registered agent card advertises. */\nexport function a2aAgentSkillCount(agent: Pick<A2AAgentRecord, 'agentCard'>): number {\n const skills = agent.agentCard?.skills;\n return Array.isArray(skills) ? skills.length : 0;\n}\n\n/**\n * Structural check of an A2A agent card before it is registered. This validates\n * the document the caller supplies — it does NOT contact the remote agent.\n */\nexport function validateAgentCard(card: Record<string, unknown> | undefined): AgentCardValidation {\n const errors: A2AValidationIssue[] = [];\n if (!card) {\n return {\n valid: false,\n errors: [\n {\n key: 'botlit.a2aRegistry.validation.cardRequired',\n fallback: 'An agent card is required',\n },\n ],\n };\n }\n for (const field of ['name', 'description', 'version'] as const) {\n if (typeof card[field] !== 'string' || (card[field] as string).trim() === '') {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardMissingField',\n fallback: 'Agent card is missing \"{{field}}\"',\n params: { field },\n });\n }\n }\n // BOFF-15360 — an A2A 1.0 card may name its endpoint only in\n // supportedInterfaces; a 0.x card names it in \"url\".\n const endpoint = preferredCardEndpoint(card);\n if (endpoint === '') {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardNoEndpoint',\n fallback: 'Agent card is missing \"url\" (or an endpoint in \"supportedInterfaces\")',\n });\n } else if (!isHttpsUrl(endpoint)) {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardUrlHttps',\n fallback: \"The card's endpoint must be an https:// address\",\n });\n }\n // Every advertised endpoint, not only the preferred one, must be https.\n const interfaceUrls = [\n ...asObjectArray(card.supportedInterfaces),\n ...asObjectArray(card.additionalInterfaces),\n ].map((entry) => entry.url);\n if (\n endpoint !== '' &&\n isHttpsUrl(endpoint) &&\n interfaceUrls.some((url) => typeof url !== 'string' || !isHttpsUrl(url))\n ) {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardInterfaceUrl',\n fallback: 'Every interface in the card needs an https:// \"url\"',\n });\n }\n // An A2A 1.0 interface names the protocol binding and version it speaks.\n const incomplete = asObjectArray(card.supportedInterfaces).some(\n (entry) =>\n asString(entry.protocolBinding).trim() === '' || asString(entry.protocolVersion).trim() === ''\n );\n if (incomplete) {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardInterfaceProtocol',\n fallback:\n 'Each entry in \"supportedInterfaces\" needs a \"protocolBinding\" and a \"protocolVersion\"',\n });\n }\n if (!Array.isArray(card.skills) || card.skills.length === 0) {\n errors.push({\n key: 'botlit.a2aRegistry.validation.cardNoSkills',\n fallback: 'Agent card must advertise at least one skill',\n });\n }\n return { valid: errors.length === 0, errors };\n}\n\n/** True for an absolute `https://` URL with a host. */\nexport function isHttpsUrl(value: string): boolean {\n try {\n const url = new URL(value.trim());\n return url.protocol === 'https:' && url.hostname.length > 0;\n } catch {\n return false;\n }\n}\n\n/** The registry form as the page edits it. */\nexport interface A2ARegistryFormValues {\n name: string;\n description: string;\n wellKnownUrl: string;\n agentCardJson: string;\n}\n\nexport type A2ARegistryFormField = 'name' | 'description' | 'wellKnownUrl' | 'agentCardJson';\n\n/** Parses the edited agent card; returns undefined when the JSON is malformed. */\nexport function parseAgentCardJson(json: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(json);\n return typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : undefined;\n } catch {\n return undefined;\n }\n}\n\n/**\n * The name the entry is saved with: the typed name, or the card's own name\n * when the field is left empty (BOFF-12510), so the list and the card agree\n * unless the user deliberately overrides it.\n */\nexport function effectiveEntryName(values: A2ARegistryFormValues): string {\n const typed = values.name.trim();\n if (typed) return typed;\n const cardName = parseAgentCardJson(values.agentCardJson)?.name;\n return typeof cardName === 'string' ? cardName.trim() : '';\n}\n\n/** The description the entry is saved with (typed, else the card's). */\nexport function effectiveEntryDescription(values: A2ARegistryFormValues): string {\n const typed = values.description.trim();\n if (typed) return typed;\n const cardDescription = parseAgentCardJson(values.agentCardJson)?.description;\n return typeof cardDescription === 'string' ? cardDescription.trim() : '';\n}\n\n/**\n * Field-level validation for the register/edit form (BOFF-12508). Returns at\n * most one issue per field, so each can be shown inline next to its input.\n */\nexport function validateRegistryForm(\n values: A2ARegistryFormValues\n): Partial<Record<A2ARegistryFormField, A2AValidationIssue>> {\n const issues: Partial<Record<A2ARegistryFormField, A2AValidationIssue>> = {};\n\n const card = parseAgentCardJson(values.agentCardJson);\n if (!values.agentCardJson.trim()) {\n issues.agentCardJson = {\n key: 'botlit.a2aRegistry.validation.cardRequired',\n fallback: 'An agent card is required',\n };\n } else if (new TextEncoder().encode(values.agentCardJson).length > A2A_AGENT_CARD_MAX_BYTES) {\n issues.agentCardJson = {\n key: 'botlit.a2aRegistry.validation.cardTooLarge',\n fallback: 'The agent card must be at most 1 MiB',\n };\n } else if (!card) {\n issues.agentCardJson = {\n key: 'botlit.a2aRegistry.validation.cardInvalidJson',\n fallback: 'Agent card must be a valid JSON object',\n };\n } else {\n const cardCheck = validateAgentCard(card);\n if (!cardCheck.valid) issues.agentCardJson = cardCheck.errors[0];\n }\n\n const name = effectiveEntryName(values);\n if (!name) {\n issues.name = {\n key: 'botlit.a2aRegistry.validation.nameRequired',\n fallback: 'Enter a name, or paste a card that has one',\n };\n } else if (name.length > A2A_NAME_MAX) {\n issues.name = {\n key: 'botlit.a2aRegistry.validation.nameTooLong',\n fallback: 'Name must be at most {{max}} characters',\n params: { max: A2A_NAME_MAX },\n };\n }\n\n if (effectiveEntryDescription(values).length > A2A_DESCRIPTION_MAX) {\n issues.description = {\n key: 'botlit.a2aRegistry.validation.descriptionTooLong',\n fallback: 'Description must be at most {{max}} characters',\n params: { max: A2A_DESCRIPTION_MAX },\n };\n }\n\n const wellKnownUrl = values.wellKnownUrl.trim();\n if (wellKnownUrl) {\n if (wellKnownUrl.length > A2A_URL_MAX) {\n issues.wellKnownUrl = {\n key: 'botlit.a2aRegistry.validation.urlTooLong',\n fallback: 'URL must be at most {{max}} characters',\n params: { max: A2A_URL_MAX },\n };\n } else if (!isHttpsUrl(wellKnownUrl)) {\n issues.wellKnownUrl = {\n key: 'botlit.a2aRegistry.validation.wellKnownHttps',\n fallback: 'Enter an https:// URL, e.g. https://agent.example.com/.well-known/agent.json',\n };\n }\n }\n\n return issues;\n}\n\nfunction identityRows(rows: A2AAgentRecord[]): A2AAgentRecord[] {\n return rows;\n}\n\nfunction selectAgents(data: ListA2ARegistryEntriesQuery | undefined): A2AAgentRecord[] {\n return data?.listA2ARegistryEntries ?? NO_AGENTS;\n}\n\nexport const a2aKeys = {\n all: ['a2a'] as const,\n lists: () => [...a2aKeys.all, 'list'] as const,\n list: (filter?: A2AAgentFilter) => [...a2aKeys.lists(), filter] as const,\n details: () => [...a2aKeys.all, 'detail'] as const,\n detail: (id: string) => [...a2aKeys.details(), id] as const,\n};\n\n/**\n * The registry list, one page at a time (BOFF-12509). Status, trust level,\n * visibility and bucket filter on the server. The service has no free-text\n * filter, so `search` narrows the rows loaded so far; the page keeps loading\n * further pages while a search is active, so a match is never hidden behind\n * an unloaded page.\n */\nexport function useA2AAgents(filter?: A2AAgentFilter): PaginatedQueryResult<A2AAgentRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n const status = filter?.status?.[0];\n const visibility = filter?.visibility?.[0];\n const trustLevel = filter?.trustLevel?.[0];\n const bucketId = filter?.bucketId;\n\n const variables = useMemo(\n () => ({ filters: { workspaceId, status, visibility, trustLevel, bucketId } }),\n [workspaceId, status, visibility, trustLevel, bucketId]\n );\n\n const result = useWorkspacePaginatedQuery<\n ListA2ARegistryEntriesQuery,\n A2AAgentRecord,\n A2AAgentRecord[]\n >({\n document: ListA2ARegistryEntriesDocument,\n variables,\n pageSize: A2A_LIST_PAGE_SIZE,\n extractRows: selectAgents,\n select: identityRows,\n fallback: NO_AGENTS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load the A2A registry',\n });\n\n // Narrowed here, not in `select`: the paginated hook applies `select` only\n // when a page arrives, and a new search term must re-filter the loaded rows.\n const rows = result.data;\n const data = useMemo(\n () =>\n search\n ? rows.filter(\n (row) =>\n row.name.toLowerCase().includes(search) ||\n (row.description ?? '').toLowerCase().includes(search)\n )\n : rows,\n [rows, search]\n );\n\n return { ...result, data };\n}\n\nexport function useA2AAgent(agentId: string | undefined): QueryResult<A2AAgentRecord | null> {\n const variables = useMemo(() => ({ id: agentId ?? '' }), [agentId]);\n\n return useWorkspaceQuery<GetA2ARegistryEntryQuery, A2AAgentRecord | null>({\n document: GetA2ARegistryEntryDocument,\n variables,\n select: (data) => data?.getA2ARegistryEntry ?? null,\n fallback: null,\n enabled: Boolean(agentId),\n errorMessage: 'Failed to load A2A agent',\n });\n}\n\nexport function useRegisterA2AAgent() {\n const workspaceId = useWorkspaceId();\n\n const variables = useCallback(\n (input: RegisterA2AAgentVariables) => ({\n input: buildMutationInput({ ...input, workspaceId }, REGISTER_AGENT_FIELDS),\n }),\n [workspaceId]\n );\n\n return useWorkspaceMutation<\n CreateA2ARegistryEntryMutation,\n RegisterA2AAgentVariables,\n A2AAgentRecord\n >({\n document: CreateA2ARegistryEntryDocument,\n variables,\n select: (data) => data?.createA2ARegistryEntry,\n errorMessage: 'Failed to register A2A agent',\n });\n}\n\nexport function useUpdateA2AAgent() {\n return useWorkspaceMutation<\n UpdateA2ARegistryEntryMutation,\n UpdateA2AAgentVariables,\n A2AAgentRecord\n >({\n document: UpdateA2ARegistryEntryDocument,\n variables: ({ agentId, input }) => ({\n id: agentId,\n input: buildMutationInput(input, UPDATE_AGENT_FIELDS),\n }),\n select: (data) => data?.updateA2ARegistryEntry,\n errorMessage: 'Failed to update A2A agent',\n });\n}\n\nexport function useDeleteA2AAgent() {\n return useWorkspaceMutation<DeleteA2ARegistryEntryMutation, string, boolean>({\n document: DeleteA2ARegistryEntryDocument,\n variables: (agentId) => ({ id: agentId }),\n select: (data) => data?.deleteA2ARegistryEntry,\n errorMessage: 'Failed to remove A2A agent',\n });\n}\n\n/**\n * BOFF-15360 — fetch the entry's published card again through the service\n * (SSRF guard, schema, endpoint origin, signature) and re-derive its trust.\n * A failed check is a result, not an error: the entry comes back FAILED with\n * the reason in `verificationError`.\n */\nexport function useVerifyA2AAgent() {\n return useWorkspaceMutation<VerifyA2ARegistryEntryMutation, string, A2AAgentRecord>({\n document: VerifyA2ARegistryEntryDocument,\n variables: (agentId) => ({ id: agentId }),\n select: (data) => data?.verifyA2ARegistryEntry,\n errorMessage: 'Failed to verify the agent card',\n });\n}\n\n/**\n * Validates an agent card locally before registration. There is no server-side\n * validation operation, so this deliberately reports only what can be checked\n * from the document itself.\n */\nexport function useValidateA2AAgent() {\n const validate = useCallback(\n async (card: Record<string, unknown> | undefined): Promise<AgentCardValidation> =>\n validateAgentCard(card),\n []\n );\n\n return [validate, { loading: false, error: undefined }] as const;\n}\n\nexport interface A2AAgentUsage {\n connectionCount: number;\n connections: {\n id: string;\n name: string;\n senderAgentId: string;\n senderAgentName?: string | null;\n isActive: boolean;\n }[];\n}\n\nconst NO_USAGE: A2AAgentUsage = { connectionCount: 0, connections: [] };\n\n/**\n * BOFF-12511 — the A2A connections that target a registry entry, for the\n * delete confirmation. Deleting the entry removes them.\n */\nexport function useA2AAgentUsage(\n agentId: string | undefined,\n enabled: boolean\n): QueryResult<A2AAgentUsage> {\n const variables = useMemo(() => ({ id: agentId ?? '' }), [agentId]);\n return useWorkspaceQuery<GetA2ARegistryEntryUsageQuery, A2AAgentUsage>({\n document: GetA2ARegistryEntryUsageDocument,\n variables,\n select: (data) => data?.getA2ARegistryEntryUsage ?? NO_USAGE,\n fallback: NO_USAGE,\n enabled: Boolean(agentId) && enabled,\n errorMessage: 'Failed to load what uses this A2A agent',\n });\n}\n"],"mappings":";;;;AA6CA,IAAaA,IAAsB,KACtBC,IAAc,MAEdC,KAA2B,SA4ClCC,IAAwBC,EAAsC;CAClE,WAAW;CACX,UAAU;CACV,aAAa;CACb,cAAc;CACd,UAAU;CACV,MAAM;CACN,QAAQ;C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EAA6E;EAClF,UAAUO;EACV,YAAY,OAAa,EAAE,IAAId,EAAQ;EACvC,SAAS,MAAShB,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AA4BA,IAAM+B,IAA0B;CAAE,iBAAiB;CAAG,aAAa,CAAC;AAAE;AAMtE,SAAgBC,GACd,GACA,GAC4B;CAC5B,IAAMtB,IAAYC,SAAe,EAAE,IAAIK,KAAW,GAAG,IAAI,CAACA,CAAO,CAAC;CAClE,OAAOC,EAAgE;EACrE,UAAUgB;EACV;EACA,SAAS,MAASjC,GAAM,4BAA4B+B;EACpD,UAAUA;EACV,SAAS,EAAQf,KAAYkB;EAC7B,cAAc;CAChB,CAAC;AACH"}
@@ -0,0 +1,8 @@
1
+ import { CheckA2APlanQuotaQuery } from '../../generated/wspace-operations';
2
+ export type A2APlanAllowance = 'allowed' | 'exhausted' | 'unknown';
3
+ /** Reads the quota check the way the delegation service applies it. */
4
+ export declare function readA2APlanAllowance(check: CheckA2APlanQuotaQuery['checkWorkspaceQuota'] | null | undefined): A2APlanAllowance;
5
+ export declare function useA2APlanAllowance(): {
6
+ allowance: A2APlanAllowance;
7
+ loading: boolean;
8
+ };