@agent-factory-platform/agent-react 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,71 +1,73 @@
1
- var ne = Object.defineProperty;
2
- var W = (e) => {
1
+ var Be = Object.defineProperty;
2
+ var Re = (e) => {
3
3
  throw TypeError(e);
4
4
  };
5
- var te = (e, a, s) => a in e ? ne(e, a, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[a] = s;
6
- var U = (e, a, s) => te(e, typeof a != "symbol" ? a + "" : a, s), $ = (e, a, s) => a.has(e) || W("Cannot " + s);
7
- var u = (e, a, s) => ($(e, a, "read from private field"), s ? s.call(e) : a.get(e)), S = (e, a, s) => a.has(e) ? W("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(e) : a.set(e, s), J = (e, a, s, o) => ($(e, a, "write to private field"), o ? o.call(e, s) : a.set(e, s), s), C = (e, a, s) => ($(e, a, "access private method"), s);
8
- import { useSyncExternalStore as X, useState as q, useMemo as se } from "react";
9
- import { jsx as t, jsxs as i, Fragment as K } from "react/jsx-runtime";
10
- import { Card as re, CardLabel as Z, CardTitle as y, Tag as k, Button as w, AvatarBadge as Y, Textarea as F, StateView as L, Input as P } from "@agent-factory-platform/ui-kit";
11
- import { Wrench as oe, CircleStop as ie, Send as le, Bot as ee, Sparkles as ce, Check as de, MessageSquarePlus as ue, ChevronRight as he, Trash2 as pe } from "lucide-react";
12
- import { AgentSessionModel as je } from "@agent-factory-platform/client";
13
- function fe(e) {
14
- return X(e.subscribe, e.getSnapshot, e.getSnapshot);
5
+ var Le = (e, l, s) => l in e ? Be(e, l, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[l] = s;
6
+ var pe = (e, l, s) => Le(e, typeof l != "symbol" ? l + "" : l, s), ge = (e, l, s) => l.has(e) || Re("Cannot " + s);
7
+ var _ = (e, l, s) => (ge(e, l, "read from private field"), s ? s.call(e) : l.get(e)), K = (e, l, s) => l.has(e) ? Re("Cannot add the same private member more than once") : l instanceof WeakSet ? l.add(e) : l.set(e, s), $e = (e, l, s, r) => (ge(e, l, "write to private field"), r ? r.call(e, s) : l.set(e, s), s), te = (e, l, s) => (ge(e, l, "access private method"), s);
8
+ import { useSyncExternalStore as qe, useState as T, useMemo as Oe, useEffect as Ue } from "react";
9
+ import { jsx as a, jsxs as t, Fragment as me } from "react/jsx-runtime";
10
+ import { create as m } from "@bufbuild/protobuf";
11
+ import { agentV1 as v } from "@agent-factory-platform/client";
12
+ import { AgentSessionModel as Ea } from "@agent-factory-platform/client";
13
+ import { Card as V, CardLabel as N, CardTitle as P, Tag as y, Button as S, AvatarBadge as ve, Textarea as re, StateView as z, Input as x, NativeSelect as fe, Switch as D } from "@agent-factory-platform/ui-kit";
14
+ import { Wrench as Je, Paperclip as Fe, CircleStop as Ke, Send as Ge, Bot as De, Sparkles as Ve, Check as He, MessageSquarePlus as Ye, ChevronRight as We, Trash2 as Qe, PackageCheck as Xe, Network as Ie, BookOpen as Ze, Brain as ea, GitFork as aa } from "lucide-react";
15
+ function na(e) {
16
+ return qe(e.subscribe, e.getSnapshot, e.getSnapshot);
15
17
  }
16
- var f, g, A, R, v, z;
17
- class qe {
18
+ var B, L, G, se, O, ie;
19
+ class _a {
18
20
  constructor() {
19
- S(this, v);
20
- S(this, f, /* @__PURE__ */ new Map());
21
- S(this, g, /* @__PURE__ */ new Map());
22
- S(this, A, /* @__PURE__ */ new Set());
23
- S(this, R, 0);
24
- U(this, "getSnapshot", () => u(this, R));
25
- U(this, "subscribe", (a) => (u(this, A).add(a), () => u(this, A).delete(a)));
21
+ K(this, O);
22
+ K(this, B, /* @__PURE__ */ new Map());
23
+ K(this, L, /* @__PURE__ */ new Map());
24
+ K(this, G, /* @__PURE__ */ new Set());
25
+ K(this, se, 0);
26
+ pe(this, "getSnapshot", () => _(this, se));
27
+ pe(this, "subscribe", (l) => (_(this, G).add(l), () => _(this, G).delete(l)));
26
28
  }
27
- register(a, s) {
28
- const o = s;
29
- return u(this, f).set(a, o), C(this, v, z).call(this), () => {
30
- if (u(this, f).get(a) !== o) return !1;
31
- const n = u(this, f).delete(a);
32
- return n && C(this, v, z).call(this), n;
29
+ register(l, s) {
30
+ const r = s;
31
+ return _(this, B).set(l, r), te(this, O, ie).call(this), () => {
32
+ if (_(this, B).get(l) !== r) return !1;
33
+ const n = _(this, B).delete(l);
34
+ return n && te(this, O, ie).call(this), n;
33
35
  };
34
36
  }
35
- registerData(a, s, o) {
36
- const n = { decode: s, renderer: o };
37
- return u(this, g).set(a, n), C(this, v, z).call(this), () => {
38
- if (u(this, g).get(a) !== n) return !1;
39
- const c = u(this, g).delete(a);
40
- return c && C(this, v, z).call(this), c;
37
+ registerData(l, s, r) {
38
+ const n = { decode: s, renderer: r };
39
+ return _(this, L).set(l, n), te(this, O, ie).call(this), () => {
40
+ if (_(this, L).get(l) !== n) return !1;
41
+ const o = _(this, L).delete(l);
42
+ return o && te(this, O, ie).call(this), o;
41
43
  };
42
44
  }
43
- render(a, s) {
44
- if (a === "data") {
45
- const n = s, c = u(this, g).get(n.name);
46
- if (!c) return B(n.name, "unknown");
45
+ render(l, s) {
46
+ if (l === "data") {
47
+ const n = s, o = _(this, L).get(n.name);
48
+ if (!o) return be(n.name, "unknown");
47
49
  try {
48
- const r = { ...n, value: c.decode(n.value) }, l = c.renderer;
49
- return /* @__PURE__ */ t(l, { value: r });
50
+ const c = { ...n, value: o.decode(n.value) }, d = o.renderer;
51
+ return /* @__PURE__ */ a(d, { value: c });
50
52
  } catch {
51
- return B(n.name, "malformed");
53
+ return be(n.name, "malformed");
52
54
  }
53
55
  }
54
- const o = u(this, f).get(a);
55
- return o ? /* @__PURE__ */ t(o, { value: s }) : null;
56
+ const r = _(this, B).get(l);
57
+ return r ? /* @__PURE__ */ a(r, { value: s }) : null;
56
58
  }
57
59
  }
58
- f = new WeakMap(), g = new WeakMap(), A = new WeakMap(), R = new WeakMap(), v = new WeakSet(), z = function() {
59
- J(this, R, u(this, R) + 1), u(this, A).forEach((a) => a());
60
+ B = new WeakMap(), L = new WeakMap(), G = new WeakMap(), se = new WeakMap(), O = new WeakSet(), ie = function() {
61
+ $e(this, se, _(this, se) + 1), _(this, G).forEach((l) => l());
60
62
  };
61
- function B(e, a) {
62
- return /* @__PURE__ */ i("span", { "data-agent-data-fallback": a, children: [
63
- a === "malformed" ? "Invalid" : "Unsupported",
63
+ function be(e, l) {
64
+ return /* @__PURE__ */ t("span", { "data-agent-data-fallback": l, children: [
65
+ l === "malformed" ? "Invalid" : "Unsupported",
64
66
  " data slot: ",
65
67
  e || "(unnamed)"
66
68
  ] });
67
69
  }
68
- const G = {
70
+ const Se = {
69
71
  assistant: "Assistant",
70
72
  newSession: "New conversation",
71
73
  sessions: "Conversations",
@@ -77,221 +79,1414 @@ const G = {
77
79
  retry: "Retry",
78
80
  execution: "Execution",
79
81
  explicitSkill: "Invoke skill"
80
- }, D = (e) => ({ ...G, ...e }), ge = () => () => {
81
- }, O = () => 0;
82
- function I(e) {
83
- X((e == null ? void 0 : e.subscribe) ?? ge, (e == null ? void 0 : e.getSnapshot) ?? O, (e == null ? void 0 : e.getSnapshot) ?? O);
82
+ }, ce = (e) => ({
83
+ ...Se,
84
+ ...e
85
+ }), la = () => () => {
86
+ }, Me = () => 0;
87
+ function de(e) {
88
+ qe(
89
+ (e == null ? void 0 : e.subscribe) ?? la,
90
+ (e == null ? void 0 : e.getSnapshot) ?? Me,
91
+ (e == null ? void 0 : e.getSnapshot) ?? Me
92
+ );
84
93
  }
85
- function ve({ sessions: e, activeSessionId: a, onSelect: s, onNew: o, onDelete: n, labels: c }) {
86
- const r = D(c);
87
- return /* @__PURE__ */ i("aside", { className: "af-agent-threads", "aria-label": r.sessions, children: [
88
- /* @__PURE__ */ i("div", { className: "af-agent-threads__header", children: [
89
- /* @__PURE__ */ t("strong", { children: r.sessions }),
90
- /* @__PURE__ */ t(w, { size: "icon", variant: "ghost", onClick: o, "aria-label": r.newSession, children: /* @__PURE__ */ t(ue, { size: 17, "aria-hidden": !0 }) })
94
+ function ta({
95
+ sessions: e,
96
+ activeSessionId: l,
97
+ onSelect: s,
98
+ onNew: r,
99
+ onDelete: n,
100
+ labels: o
101
+ }) {
102
+ const c = ce(o);
103
+ return /* @__PURE__ */ t("aside", { className: "af-agent-threads", "aria-label": c.sessions, children: [
104
+ /* @__PURE__ */ t("div", { className: "af-agent-threads__header", children: [
105
+ /* @__PURE__ */ a("strong", { children: c.sessions }),
106
+ /* @__PURE__ */ a(
107
+ S,
108
+ {
109
+ size: "icon",
110
+ variant: "ghost",
111
+ onClick: r,
112
+ "aria-label": c.newSession,
113
+ children: /* @__PURE__ */ a(Ye, { size: 17, "aria-hidden": !0 })
114
+ }
115
+ )
91
116
  ] }),
92
- /* @__PURE__ */ t("div", { className: "af-agent-threads__list", children: e.map((l) => /* @__PURE__ */ i("div", { className: "af-agent-thread-row", "data-active": l.id === a || void 0, children: [
93
- /* @__PURE__ */ i("button", { type: "button", className: "af-agent-thread-row__select", onClick: () => s(l.id), children: [
94
- /* @__PURE__ */ t("span", { children: l.profileRevisionId }),
95
- /* @__PURE__ */ t(he, { size: 14, "aria-hidden": !0 })
96
- ] }),
97
- n && /* @__PURE__ */ t("button", { type: "button", className: "af-agent-icon-button", onClick: () => n(l.id), "aria-label": `Delete ${l.id}`, children: /* @__PURE__ */ t(pe, { size: 14, "aria-hidden": !0 }) })
98
- ] }, l.id)) })
117
+ /* @__PURE__ */ a("div", { className: "af-agent-threads__list", children: e.map((d) => /* @__PURE__ */ t(
118
+ "div",
119
+ {
120
+ className: "af-agent-thread-row",
121
+ "data-active": d.id === l || void 0,
122
+ children: [
123
+ /* @__PURE__ */ t(
124
+ "button",
125
+ {
126
+ type: "button",
127
+ className: "af-agent-thread-row__select",
128
+ onClick: () => s(d.id),
129
+ children: [
130
+ /* @__PURE__ */ a("span", { children: d.profileRevisionId }),
131
+ /* @__PURE__ */ a(We, { size: 14, "aria-hidden": !0 })
132
+ ]
133
+ }
134
+ ),
135
+ n && /* @__PURE__ */ a(
136
+ "button",
137
+ {
138
+ type: "button",
139
+ className: "af-agent-icon-button",
140
+ onClick: () => n(d.id),
141
+ "aria-label": `Delete ${d.id}`,
142
+ children: /* @__PURE__ */ a(Qe, { size: 14, "aria-hidden": !0 })
143
+ }
144
+ )
145
+ ]
146
+ },
147
+ d.id
148
+ )) })
99
149
  ] });
100
150
  }
101
- function be({ profileRevisionId: e, explicitSkillSlug: a, onExplicitSkillChange: s, labels: o, registry: n }) {
102
- I(n);
103
- const c = n == null ? void 0 : n.render("resource-bar", { profileRevisionId: e, explicitSkillSlug: a, setExplicitSkillSlug: s });
104
- if (c) return c;
105
- const r = D(o);
106
- return /* @__PURE__ */ i("div", { className: "af-agent-resources", "aria-label": "Agent resources", children: [
107
- /* @__PURE__ */ t(k, { tone: "cool", children: e }),
108
- /* @__PURE__ */ t(P, { "aria-label": r.explicitSkill, placeholder: r.explicitSkill, value: a, onChange: (l) => s(l.target.value) })
151
+ function ia({
152
+ profileRevisionId: e,
153
+ explicitSkillSlug: l,
154
+ onExplicitSkillChange: s,
155
+ labels: r,
156
+ registry: n
157
+ }) {
158
+ de(n);
159
+ const o = n == null ? void 0 : n.render("resource-bar", {
160
+ profileRevisionId: e,
161
+ explicitSkillSlug: l,
162
+ setExplicitSkillSlug: s
163
+ });
164
+ if (o) return o;
165
+ const c = ce(r);
166
+ return /* @__PURE__ */ t("div", { className: "af-agent-resources", "aria-label": "Agent resources", children: [
167
+ /* @__PURE__ */ a(y, { tone: "cool", children: e }),
168
+ /* @__PURE__ */ a(
169
+ x,
170
+ {
171
+ "aria-label": c.explicitSkill,
172
+ placeholder: c.explicitSkill,
173
+ value: l,
174
+ onChange: (d) => s(d.target.value)
175
+ }
176
+ )
109
177
  ] });
110
178
  }
111
- function me({ items: e, label: a = G.execution, registry: s }) {
112
- I(s);
113
- const o = e.filter((n) => n.kind === "step_started" || n.kind === "step_finished" || n.kind === "retry_scheduled");
114
- return o.length ? /* @__PURE__ */ i("details", { className: "af-agent-trace", children: [
115
- /* @__PURE__ */ i("summary", { children: [
116
- /* @__PURE__ */ t(ce, { size: 14, "aria-hidden": !0 }),
117
- a,
118
- /* @__PURE__ */ t(k, { size: "micro", tone: "cool", children: o.length })
179
+ function ra({
180
+ items: e,
181
+ label: l = Se.execution,
182
+ registry: s
183
+ }) {
184
+ return de(s), e.length ? /* @__PURE__ */ t("details", { className: "af-agent-trace", children: [
185
+ /* @__PURE__ */ t("summary", { children: [
186
+ /* @__PURE__ */ a(Ve, { size: 14, "aria-hidden": !0 }),
187
+ l,
188
+ /* @__PURE__ */ a(y, { size: "micro", tone: "cool", children: e.length })
119
189
  ] }),
120
- /* @__PURE__ */ t("ol", { children: o.map((n) => /* @__PURE__ */ t("li", { children: (s == null ? void 0 : s.render("trace-item", n)) ?? /* @__PURE__ */ i(K, { children: [
121
- /* @__PURE__ */ i("span", { children: [
122
- /* @__PURE__ */ t(de, { size: 13, "aria-hidden": !0 }),
123
- n.kind
190
+ /* @__PURE__ */ a("ol", { children: e.map((r) => /* @__PURE__ */ a("li", { "data-category": r.category, children: (s == null ? void 0 : s.render("trace-item", r)) ?? /* @__PURE__ */ t(me, { children: [
191
+ /* @__PURE__ */ t("span", { children: [
192
+ /* @__PURE__ */ a(He, { size: 13, "aria-hidden": !0 }),
193
+ r.kind
124
194
  ] }),
125
- /* @__PURE__ */ t("span", { children: n.status })
126
- ] }) }, n.anchorSeq.toString())) })
195
+ /* @__PURE__ */ a("span", { children: [r.status, r.detail].filter(Boolean).join(" · ") })
196
+ ] }) }, r.anchorSeq.toString())) })
127
197
  ] }) : null;
128
198
  }
129
- function Se({ interaction: e, onResolve: a }) {
130
- const [s, o] = q(!1), [n, c] = q(""), r = async (l) => {
131
- o(!0), c("");
199
+ function sa({
200
+ interaction: e,
201
+ onResolve: l
202
+ }) {
203
+ const [s, r] = T(!1), [n, o] = T(""), c = async (u) => {
204
+ r(!0), o("");
132
205
  try {
133
- await a(l);
134
- } catch (d) {
135
- c(d instanceof Error ? d.message : String(d));
206
+ await l(u);
207
+ } catch (f) {
208
+ o(f instanceof Error ? f.message : String(f));
136
209
  } finally {
137
- o(!1);
210
+ r(!1);
138
211
  }
139
- };
140
- return /* @__PURE__ */ i(re, { as: "article", tone: "warm", className: "af-agent-action", children: [
141
- /* @__PURE__ */ i("div", { children: [
142
- /* @__PURE__ */ i(Z, { children: [
143
- /* @__PURE__ */ t(oe, { size: 14, "aria-hidden": !0 }),
212
+ }, d = e.resolvedAt ? new Date(Number(e.resolvedAt.seconds) * 1e3).toLocaleString() : "";
213
+ return /* @__PURE__ */ t(V, { as: "article", tone: "warm", className: "af-agent-action", children: [
214
+ /* @__PURE__ */ t("div", { children: [
215
+ /* @__PURE__ */ t(N, { children: [
216
+ /* @__PURE__ */ a(Je, { size: 14, "aria-hidden": !0 }),
144
217
  " Approval required"
145
218
  ] }),
146
- /* @__PURE__ */ t(y, { children: e.kind })
219
+ /* @__PURE__ */ a(P, { children: e.kind }),
220
+ d && /* @__PURE__ */ t("p", { children: [
221
+ "Resolved ",
222
+ d
223
+ ] })
147
224
  ] }),
148
- /* @__PURE__ */ t(k, { tone: e.status === "pending" ? "warning" : "neutral", children: e.status }),
149
- e.status === "pending" && /* @__PURE__ */ i("div", { className: "af-agent-action__buttons", children: [
150
- /* @__PURE__ */ t(w, { size: "compact", disabled: s, onClick: () => void r("confirmed"), children: s ? "Resolving…" : "Confirm" }),
151
- /* @__PURE__ */ t(w, { size: "compact", variant: "secondary", disabled: s, onClick: () => void r("rejected"), children: "Reject" })
225
+ /* @__PURE__ */ a(y, { tone: e.status === "pending" ? "warning" : "neutral", children: e.status }),
226
+ e.status === "pending" && /* @__PURE__ */ t("div", { className: "af-agent-action__buttons", children: [
227
+ /* @__PURE__ */ a(
228
+ S,
229
+ {
230
+ size: "compact",
231
+ disabled: s,
232
+ onClick: () => void c("confirmed"),
233
+ children: s ? "Resolving…" : "Confirm"
234
+ }
235
+ ),
236
+ /* @__PURE__ */ a(
237
+ S,
238
+ {
239
+ size: "compact",
240
+ variant: "secondary",
241
+ disabled: s,
242
+ onClick: () => void c("rejected"),
243
+ children: "Reject"
244
+ }
245
+ )
152
246
  ] }),
153
- n && /* @__PURE__ */ t("p", { role: "alert", children: n })
247
+ n && /* @__PURE__ */ a("p", { role: "alert", children: n })
154
248
  ] });
155
249
  }
156
- function ke({ value: e, onChange: a, onSubmit: s, running: o, onStop: n, labels: c }) {
157
- const r = D(c);
158
- return /* @__PURE__ */ i("form", { className: "af-agent-composer", onSubmit: (d) => {
159
- d.preventDefault(), e.trim() && !o && s();
160
- }, children: [
161
- /* @__PURE__ */ t(F, { rows: 2, variant: "bare", value: e, onChange: (d) => a(d.target.value), "aria-label": r.composer, placeholder: r.composer, onKeyDown: (d) => {
162
- d.key === "Enter" && !d.shiftKey && (d.preventDefault(), e.trim() && !o && s());
163
- } }),
164
- o ? /* @__PURE__ */ t(w, { type: "button", size: "icon", variant: "secondary", onClick: n, "aria-label": r.stop, children: /* @__PURE__ */ t(ie, { size: 17, "aria-hidden": !0 }) }) : /* @__PURE__ */ t(w, { type: "submit", size: "icon", disabled: !e.trim(), "aria-label": r.send, children: /* @__PURE__ */ t(le, { size: 17, "aria-hidden": !0 }) })
165
- ] });
250
+ function ca({
251
+ value: e,
252
+ onChange: l,
253
+ onSubmit: s,
254
+ running: r,
255
+ onStop: n,
256
+ onInject: o,
257
+ onAttachResource: c,
258
+ resources: d = [],
259
+ onRemoveResource: u,
260
+ labels: f
261
+ }) {
262
+ const g = ce(f);
263
+ return /* @__PURE__ */ t(
264
+ "form",
265
+ {
266
+ className: "af-agent-composer",
267
+ "data-running": r || void 0,
268
+ onSubmit: (b) => {
269
+ b.preventDefault(), e.trim() && s();
270
+ },
271
+ children: [
272
+ d.length > 0 && /* @__PURE__ */ a(
273
+ "div",
274
+ {
275
+ className: "af-agent-composer__resources",
276
+ "aria-label": "Attached resources",
277
+ children: d.map((b) => /* @__PURE__ */ t(y, { tone: "cool", children: [
278
+ b.label,
279
+ u && /* @__PURE__ */ a(
280
+ "button",
281
+ {
282
+ type: "button",
283
+ "aria-label": `Remove ${b.label}`,
284
+ onClick: () => u(b.resourceId),
285
+ children: "×"
286
+ }
287
+ )
288
+ ] }, b.resourceId))
289
+ }
290
+ ),
291
+ /* @__PURE__ */ a(
292
+ re,
293
+ {
294
+ rows: 2,
295
+ variant: "bare",
296
+ value: e,
297
+ onChange: (b) => l(b.target.value),
298
+ "aria-label": g.composer,
299
+ placeholder: r ? "Steer the active run" : g.composer,
300
+ onKeyDown: (b) => {
301
+ b.key === "Enter" && !b.shiftKey && (b.preventDefault(), e.trim() && s());
302
+ }
303
+ }
304
+ ),
305
+ /* @__PURE__ */ t("div", { className: "af-agent-composer__actions", children: [
306
+ c && /* @__PURE__ */ a(
307
+ S,
308
+ {
309
+ type: "button",
310
+ size: "icon",
311
+ variant: "ghost",
312
+ onClick: c,
313
+ "aria-label": "Attach document",
314
+ children: /* @__PURE__ */ a(Fe, { size: 17, "aria-hidden": !0 })
315
+ }
316
+ ),
317
+ r && o && /* @__PURE__ */ a(
318
+ S,
319
+ {
320
+ type: "button",
321
+ size: "compact",
322
+ variant: "ghost",
323
+ disabled: !e.trim(),
324
+ onClick: o,
325
+ children: "Inject"
326
+ }
327
+ ),
328
+ r ? /* @__PURE__ */ a(
329
+ S,
330
+ {
331
+ type: "button",
332
+ size: "icon",
333
+ variant: "secondary",
334
+ onClick: n,
335
+ "aria-label": g.stop,
336
+ children: /* @__PURE__ */ a(Ke, { size: 17, "aria-hidden": !0 })
337
+ }
338
+ ) : /* @__PURE__ */ a(
339
+ S,
340
+ {
341
+ type: "submit",
342
+ size: "icon",
343
+ disabled: !e.trim(),
344
+ "aria-label": g.send,
345
+ children: /* @__PURE__ */ a(Ge, { size: 17, "aria-hidden": !0 })
346
+ }
347
+ )
348
+ ] })
349
+ ]
350
+ }
351
+ );
166
352
  }
167
- function Ae({ items: e, registry: a, onResolveInteraction: s }) {
168
- I(a);
169
- const o = e.filter((n) => n.slot !== "trace-item" && (n.slot !== "message-content" || n.text.length > 0));
170
- return /* @__PURE__ */ t(K, { children: o.map((n) => n.slot === "message-content" ? /* @__PURE__ */ i("article", { className: "af-agent-message", "data-role": n.role, "data-anchor-seq": n.anchorSeq.toString(), "data-last-updated-seq": n.lastUpdatedSeq.toString(), children: [
171
- /* @__PURE__ */ t(Y, { initials: n.role === "user" ? "You" : "AF", size: 30 }),
172
- /* @__PURE__ */ i("div", { className: "af-agent-message__body", children: [
173
- /* @__PURE__ */ t("strong", { children: n.role === "user" ? "You" : "Agent" }),
174
- /* @__PURE__ */ t("div", { className: "af-agent-message__content", children: (a == null ? void 0 : a.render("message-content", n)) ?? n.text })
353
+ function da({
354
+ item: e
355
+ }) {
356
+ return /* @__PURE__ */ t(V, { as: "article", children: [
357
+ /* @__PURE__ */ t("div", { children: [
358
+ /* @__PURE__ */ t(N, { children: [
359
+ "Tool · ",
360
+ e.phase
361
+ ] }),
362
+ /* @__PURE__ */ a(P, { children: e.name || e.callId })
363
+ ] }),
364
+ /* @__PURE__ */ a(y, { tone: e.error ? "warning" : "cool", children: e.error ? "failed" : e.phase }),
365
+ e.arguments !== void 0 && /* @__PURE__ */ t("details", { children: [
366
+ /* @__PURE__ */ a("summary", { children: "Arguments" }),
367
+ /* @__PURE__ */ a("pre", { children: JSON.stringify(e.arguments, null, 2) })
368
+ ] }),
369
+ e.result !== void 0 && /* @__PURE__ */ t("details", { open: e.error, children: [
370
+ /* @__PURE__ */ a("summary", { children: "Result" }),
371
+ /* @__PURE__ */ a("pre", { children: JSON.stringify(e.result, null, 2) })
175
372
  ] })
176
- ] }, `message-${n.anchorSeq}`) : /* @__PURE__ */ t("div", { className: "af-agent-surface", "data-slot": n.slot, "data-anchor-seq": n.anchorSeq.toString(), "data-last-updated-seq": n.lastUpdatedSeq.toString(), children: n.slot === "tool-card" ? (a == null ? void 0 : a.render("tool-card", n)) ?? /* @__PURE__ */ i(k, { tone: n.error ? "warning" : "cool", children: [
177
- n.phase,
178
- " · ",
179
- n.name || n.callId
180
- ] }) : n.slot === "action" ? (a == null ? void 0 : a.render("action", n)) ?? (s ? /* @__PURE__ */ t(Se, { interaction: { id: n.interactionId, kind: Q(n), status: n.phase === "requested" ? "pending" : "resolved" }, onResolve: (c) => s(n.interactionId, c) }) : /* @__PURE__ */ i(k, { tone: "warning", children: [
181
- Q(n),
182
- " · ",
183
- n.phase
184
- ] })) : n.slot === "citation" ? (a == null ? void 0 : a.render("citation", n)) ?? /* @__PURE__ */ t(k, { children: n.resourceId }) : a ? a.render("data", n) : B(n.name, "unknown") }, n.slot === "tool-card" ? `tool-${n.callId}` : n.slot === "action" ? `action-${n.interactionId}` : `${n.slot}-${n.anchorSeq}-${n.blockIndex}`)) });
373
+ ] });
185
374
  }
186
- function Q(e) {
187
- const a = e.payload && typeof e.payload == "object" && !Array.isArray(e.payload) ? e.payload.action : void 0;
188
- return a && typeof a == "object" && !Array.isArray(a) && typeof a.kind == "string" ? a.kind : e.kind;
375
+ function oa({
376
+ items: e,
377
+ registry: l,
378
+ onResolveInteraction: s
379
+ }) {
380
+ de(l);
381
+ const r = e.filter(
382
+ (n) => n.slot !== "trace-item" && (n.slot !== "message-content" || n.text.length > 0)
383
+ );
384
+ return /* @__PURE__ */ a(me, { children: r.map(
385
+ (n) => n.slot === "message-content" ? /* @__PURE__ */ t(
386
+ "article",
387
+ {
388
+ className: "af-agent-message",
389
+ "data-role": n.role,
390
+ "data-anchor-seq": n.anchorSeq.toString(),
391
+ "data-last-updated-seq": n.lastUpdatedSeq.toString(),
392
+ children: [
393
+ /* @__PURE__ */ a(
394
+ ve,
395
+ {
396
+ initials: n.role === "user" ? "You" : "AF",
397
+ size: 30
398
+ }
399
+ ),
400
+ /* @__PURE__ */ t("div", { className: "af-agent-message__body", children: [
401
+ /* @__PURE__ */ a("strong", { children: n.role === "user" ? "You" : "Agent" }),
402
+ /* @__PURE__ */ a("div", { className: "af-agent-message__content", children: (l == null ? void 0 : l.render("message-content", n)) ?? n.text })
403
+ ] })
404
+ ]
405
+ },
406
+ `message-${n.anchorSeq}`
407
+ ) : /* @__PURE__ */ a(
408
+ "div",
409
+ {
410
+ className: "af-agent-surface",
411
+ "data-slot": n.slot,
412
+ "data-anchor-seq": n.anchorSeq.toString(),
413
+ "data-last-updated-seq": n.lastUpdatedSeq.toString(),
414
+ children: n.slot === "tool-card" ? (l == null ? void 0 : l.render("tool-card", n)) ?? /* @__PURE__ */ a(da, { item: n }) : n.slot === "action" ? (l == null ? void 0 : l.render("action", n)) ?? (s ? /* @__PURE__ */ a(
415
+ sa,
416
+ {
417
+ interaction: {
418
+ id: n.interactionId,
419
+ kind: je(n),
420
+ status: n.phase === "requested" ? "pending" : "resolved"
421
+ },
422
+ onResolve: (o) => s(n.interactionId, o)
423
+ }
424
+ ) : /* @__PURE__ */ t(y, { tone: "warning", children: [
425
+ je(n),
426
+ " · ",
427
+ n.phase
428
+ ] })) : n.slot === "citation" ? (l == null ? void 0 : l.render("citation", n)) ?? /* @__PURE__ */ a(y, { children: n.resourceId }) : l ? l.render("data", n) : be(n.name, "unknown")
429
+ },
430
+ n.slot === "tool-card" ? `tool-${n.callId}` : n.slot === "action" ? `action-${n.interactionId}` : `${n.slot}-${n.anchorSeq}-${n.blockIndex}`
431
+ )
432
+ ) });
189
433
  }
190
- function we({ model: e, explicitSkillSlug: a = "", registry: s, header: o, labels: n, onError: c }) {
191
- var H, V;
192
- I(s);
193
- const r = D(n), l = fe(e), [d, p] = q(""), [T, N] = q(""), _ = l.status === "submitting" || l.status === "queued" || l.status === "running" || l.status === "waiting_for_input", b = l.projection.items.filter((h) => h.slot === "trace-item"), E = l.projection.items.filter((h) => h.slot !== "trace-item" && (h.slot !== "message-content" || h.text.length > 0)), M = (h) => c == null ? void 0 : c(h instanceof Error ? h : new Error(String(h))), j = async (h) => {
194
- var x;
195
- const m = h.trim();
196
- if (m) {
197
- p(""), N(m);
434
+ function je(e) {
435
+ const l = e.payload && typeof e.payload == "object" && !Array.isArray(e.payload) ? e.payload.action : void 0;
436
+ return l && typeof l == "object" && !Array.isArray(l) && typeof l.kind == "string" ? l.kind : e.kind;
437
+ }
438
+ function ha({
439
+ model: e,
440
+ explicitSkillSlug: l = "",
441
+ resources: s = [],
442
+ onRemoveResource: r,
443
+ onAttachResource: n,
444
+ registry: o,
445
+ header: c,
446
+ labels: d,
447
+ onError: u
448
+ }) {
449
+ var Y, W;
450
+ de(o);
451
+ const f = ce(d), g = na(e), [C, b] = T(""), [w, M] = T(""), U = g.status === "submitting" || g.status === "queued" || g.status === "running" || g.status === "waiting_for_input", oe = g.projection.items.filter(
452
+ (k) => k.slot === "trace-item"
453
+ ), H = g.projection.items.filter(
454
+ (k) => k.slot !== "trace-item" && (k.slot !== "message-content" || k.text.length > 0)
455
+ ), J = (k) => u == null ? void 0 : u(k instanceof Error ? k : new Error(String(k))), R = async (k, j = U ? "steer" : "followup") => {
456
+ var Q;
457
+ const A = k.trim();
458
+ if (A) {
459
+ b(""), M(A);
198
460
  try {
199
- await e.submitText(m, a);
200
- } catch (ae) {
201
- p(((x = e.getSnapshot().retryDraft) == null ? void 0 : x.text) ?? m), M(ae);
461
+ j === "steer" ? await e.steerText(A) : j === "inject" ? await e.injectText(A) : await e.submitContent(
462
+ [
463
+ m(v.ContentBlockSchema, {
464
+ block: {
465
+ case: "text",
466
+ value: m(v.TextBlockSchema, { text: A })
467
+ }
468
+ }),
469
+ ...s.map(
470
+ (E) => m(v.ContentBlockSchema, {
471
+ block: {
472
+ case: "resource",
473
+ value: m(v.ResourceBlockSchema, {
474
+ resourceId: E.resourceId,
475
+ mediaType: E.mediaType ?? "application/vnd.agentfactory.document"
476
+ })
477
+ }
478
+ })
479
+ )
480
+ ],
481
+ l
482
+ );
483
+ } catch (E) {
484
+ b(((Q = e.getSnapshot().retryDraft) == null ? void 0 : Q.text) ?? A), J(E);
202
485
  }
203
486
  }
204
487
  };
205
- return /* @__PURE__ */ i("section", { className: "af-agent-conversation", "aria-label": r.assistant, children: [
206
- o && /* @__PURE__ */ t("header", { className: "af-agent-conversation__header", children: o }),
207
- /* @__PURE__ */ i("div", { className: "af-agent-messages", "aria-live": "polite", children: [
208
- !E.length && l.status === "idle" && /* @__PURE__ */ t(L, { size: "md", title: r.emptyTitle, description: r.emptyDescription, icon: /* @__PURE__ */ t(ee, { size: 24, "aria-hidden": !0 }) }),
209
- /* @__PURE__ */ t(Ae, { items: E, registry: s, onResolveInteraction: async (h, m) => {
210
- try {
211
- await e.resolveInteraction(h, m);
212
- } catch (x) {
213
- throw M(x), x;
488
+ return /* @__PURE__ */ t("section", { className: "af-agent-conversation", "aria-label": f.assistant, children: [
489
+ c && /* @__PURE__ */ a("header", { className: "af-agent-conversation__header", children: c }),
490
+ /* @__PURE__ */ t("div", { className: "af-agent-messages", "aria-live": "polite", children: [
491
+ !H.length && g.status === "idle" && /* @__PURE__ */ a(
492
+ z,
493
+ {
494
+ size: "md",
495
+ title: f.emptyTitle,
496
+ description: f.emptyDescription,
497
+ icon: /* @__PURE__ */ a(De, { size: 24, "aria-hidden": !0 })
498
+ }
499
+ ),
500
+ /* @__PURE__ */ a(
501
+ oa,
502
+ {
503
+ items: H,
504
+ registry: o,
505
+ onResolveInteraction: async (k, j) => {
506
+ try {
507
+ await e.resolveInteraction(k, j);
508
+ } catch (A) {
509
+ throw J(A), A;
510
+ }
511
+ }
512
+ }
513
+ ),
514
+ g.status !== "waiting_for_input" && U && /* @__PURE__ */ a("span", { className: "af-agent-thinking", children: "Thinking…" }),
515
+ g.status === "disconnected" && /* @__PURE__ */ a(
516
+ z,
517
+ {
518
+ variant: "error",
519
+ size: "sm",
520
+ title: ((Y = g.error) == null ? void 0 : Y.message) ?? "Disconnected",
521
+ action: {
522
+ label: f.retry,
523
+ onClick: () => void e.retry().catch(J)
524
+ }
525
+ }
526
+ ),
527
+ g.status === "failed" && /* @__PURE__ */ a(
528
+ z,
529
+ {
530
+ variant: "error",
531
+ size: "sm",
532
+ title: ((W = g.error) == null ? void 0 : W.message) ?? "Run failed",
533
+ action: { label: f.retry, onClick: () => void R(w) }
534
+ }
535
+ ),
536
+ g.status === "max_steps_reached" && /* @__PURE__ */ a(
537
+ z,
538
+ {
539
+ variant: "error",
540
+ size: "sm",
541
+ title: "Maximum steps reached",
542
+ action: { label: f.retry, onClick: () => void R(w) }
543
+ }
544
+ ),
545
+ /* @__PURE__ */ a(
546
+ ra,
547
+ {
548
+ items: oe,
549
+ registry: o,
550
+ label: f.execution
214
551
  }
215
- } }),
216
- l.status !== "waiting_for_input" && _ && /* @__PURE__ */ t("span", { className: "af-agent-thinking", children: "Thinking…" }),
217
- l.status === "disconnected" && /* @__PURE__ */ t(L, { variant: "error", size: "sm", title: ((H = l.error) == null ? void 0 : H.message) ?? "Disconnected", action: { label: r.retry, onClick: () => void e.retry().catch(M) } }),
218
- l.status === "failed" && /* @__PURE__ */ t(L, { variant: "error", size: "sm", title: ((V = l.error) == null ? void 0 : V.message) ?? "Run failed", action: { label: r.retry, onClick: () => void j(T) } }),
219
- l.status === "max_steps_reached" && /* @__PURE__ */ t(L, { variant: "error", size: "sm", title: "Maximum steps reached", action: { label: r.retry, onClick: () => void j(T) } }),
220
- /* @__PURE__ */ t(me, { items: b, registry: s, label: r.execution })
552
+ )
221
553
  ] }),
222
- (s == null ? void 0 : s.render("composer", { draft: d, running: _, submit: () => void j(d), stop: () => void e.cancel(), setDraft: p })) ?? /* @__PURE__ */ t(ke, { value: d, onChange: p, onSubmit: () => void j(d), running: _, onStop: () => void e.cancel(), labels: r })
554
+ (o == null ? void 0 : o.render("composer", {
555
+ draft: C,
556
+ running: U,
557
+ submit: () => void R(C),
558
+ stop: () => void e.cancel(),
559
+ setDraft: b
560
+ })) ?? /* @__PURE__ */ a(
561
+ ca,
562
+ {
563
+ value: C,
564
+ onChange: b,
565
+ onSubmit: () => void R(C),
566
+ running: U,
567
+ onStop: () => void e.cancel(),
568
+ onInject: () => void R(C, "inject"),
569
+ onAttachResource: n,
570
+ resources: s,
571
+ onRemoveResource: r,
572
+ labels: f
573
+ }
574
+ )
223
575
  ] });
224
576
  }
225
- function Re({ model: e, title: a = G.assistant, subtitle: s, profileRevisionId: o, sessions: n, activeSessionId: c, onSelectSession: r, onNewSession: l, onDeleteSession: d, registry: p, labels: T }) {
226
- const [N, _] = q(""), b = D(T), E = se(() => /* @__PURE__ */ i(K, { children: [
227
- /* @__PURE__ */ i("div", { className: "af-agent-title", children: [
228
- /* @__PURE__ */ t(Y, { initials: "AF", size: 36 }),
229
- /* @__PURE__ */ i("div", { children: [
230
- /* @__PURE__ */ t("strong", { children: a }),
231
- s && /* @__PURE__ */ t("span", { children: s })
232
- ] })
577
+ function Na({
578
+ model: e,
579
+ title: l = Se.assistant,
580
+ subtitle: s,
581
+ profileRevisionId: r,
582
+ sessions: n,
583
+ activeSessionId: o,
584
+ onSelectSession: c,
585
+ onNewSession: d,
586
+ onDeleteSession: u,
587
+ registry: f,
588
+ labels: g
589
+ }) {
590
+ const [C, b] = T(""), w = ce(g), M = Oe(
591
+ () => /* @__PURE__ */ t(me, { children: [
592
+ /* @__PURE__ */ t("div", { className: "af-agent-title", children: [
593
+ /* @__PURE__ */ a(ve, { initials: "AF", size: 36 }),
594
+ /* @__PURE__ */ t("div", { children: [
595
+ /* @__PURE__ */ a("strong", { children: l }),
596
+ s && /* @__PURE__ */ a("span", { children: s })
597
+ ] })
598
+ ] }),
599
+ /* @__PURE__ */ a(
600
+ ia,
601
+ {
602
+ profileRevisionId: r,
603
+ explicitSkillSlug: C,
604
+ onExplicitSkillChange: b,
605
+ registry: f,
606
+ labels: w
607
+ }
608
+ )
233
609
  ] }),
234
- /* @__PURE__ */ t(be, { profileRevisionId: o, explicitSkillSlug: N, onExplicitSkillChange: _, registry: p, labels: b })
235
- ] }), [a, s, o, N, p, b]);
236
- return /* @__PURE__ */ i("div", { className: "af-agent-chat", "data-testid": "agent-chat", children: [
237
- n && r && l && /* @__PURE__ */ t(ve, { sessions: n, activeSessionId: c, onSelect: r, onNew: l, onDelete: d, labels: b }),
238
- /* @__PURE__ */ t(we, { model: e, explicitSkillSlug: N, registry: p, header: E, labels: b })
610
+ [l, s, r, C, f, w]
611
+ );
612
+ return /* @__PURE__ */ t("div", { className: "af-agent-chat", "data-testid": "agent-chat", children: [
613
+ n && c && d && /* @__PURE__ */ a(
614
+ ta,
615
+ {
616
+ sessions: n,
617
+ activeSessionId: o,
618
+ onSelect: c,
619
+ onNew: d,
620
+ onDelete: u,
621
+ labels: w
622
+ }
623
+ ),
624
+ /* @__PURE__ */ a(
625
+ ha,
626
+ {
627
+ model: e,
628
+ explicitSkillSlug: C,
629
+ registry: f,
630
+ header: M,
631
+ labels: w
632
+ }
633
+ )
239
634
  ] });
240
635
  }
241
- function De({ revision: e, onChange: a, onSave: s, saving: o = !1, registry: n }) {
242
- I(n);
243
- const c = n == null ? void 0 : n.render("profile-editor", { revision: e, onChange: a });
244
- return c || /* @__PURE__ */ i("form", { className: "af-agent-persona", onSubmit: (r) => {
245
- r.preventDefault(), s();
246
- }, children: [
247
- /* @__PURE__ */ i("div", { className: "af-agent-persona__intro", children: [
248
- /* @__PURE__ */ t(Y, { initials: e.name || "AF", src: e.avatar || void 0, size: 48 }),
249
- /* @__PURE__ */ i("div", { children: [
250
- /* @__PURE__ */ i(Z, { children: [
251
- /* @__PURE__ */ t(ee, { size: 14, "aria-hidden": !0 }),
252
- " Agent Profile"
636
+ function ua({
637
+ revision: e,
638
+ onChange: l,
639
+ onSave: s,
640
+ saving: r = !1,
641
+ showSave: n = !0,
642
+ registry: o
643
+ }) {
644
+ de(o);
645
+ const c = o == null ? void 0 : o.render("profile-editor", { revision: e, onChange: l });
646
+ return c || /* @__PURE__ */ t(
647
+ "form",
648
+ {
649
+ className: "af-agent-persona",
650
+ onSubmit: (d) => {
651
+ d.preventDefault(), s();
652
+ },
653
+ children: [
654
+ /* @__PURE__ */ t("div", { className: "af-agent-persona__intro", children: [
655
+ /* @__PURE__ */ a(
656
+ ve,
657
+ {
658
+ initials: e.name || "AF",
659
+ src: e.avatar || void 0,
660
+ size: 48
661
+ }
662
+ ),
663
+ /* @__PURE__ */ t("div", { children: [
664
+ /* @__PURE__ */ t(N, { children: [
665
+ /* @__PURE__ */ a(De, { size: 14, "aria-hidden": !0 }),
666
+ " Agent Profile"
667
+ ] }),
668
+ /* @__PURE__ */ a(P, { children: e.name || "Untitled Agent" })
669
+ ] })
670
+ ] }),
671
+ /* @__PURE__ */ t("label", { children: [
672
+ /* @__PURE__ */ a("span", { children: "Name" }),
673
+ /* @__PURE__ */ a(
674
+ x,
675
+ {
676
+ required: !0,
677
+ value: e.name,
678
+ onChange: (d) => l({ ...e, name: d.target.value })
679
+ }
680
+ )
681
+ ] }),
682
+ /* @__PURE__ */ t("label", { children: [
683
+ /* @__PURE__ */ a("span", { children: "Description" }),
684
+ /* @__PURE__ */ a(
685
+ x,
686
+ {
687
+ value: e.description,
688
+ onChange: (d) => l({ ...e, description: d.target.value })
689
+ }
690
+ )
691
+ ] }),
692
+ /* @__PURE__ */ t("label", { children: [
693
+ /* @__PURE__ */ a("span", { children: "Avatar URL" }),
694
+ /* @__PURE__ */ a(
695
+ x,
696
+ {
697
+ type: "url",
698
+ value: e.avatar,
699
+ onChange: (d) => l({ ...e, avatar: d.target.value })
700
+ }
701
+ )
702
+ ] }),
703
+ /* @__PURE__ */ t("label", { children: [
704
+ /* @__PURE__ */ a("span", { children: "Persona" }),
705
+ /* @__PURE__ */ a(
706
+ re,
707
+ {
708
+ required: !0,
709
+ rows: 5,
710
+ value: e.persona,
711
+ onChange: (d) => l({ ...e, persona: d.target.value })
712
+ }
713
+ )
714
+ ] }),
715
+ /* @__PURE__ */ t("label", { children: [
716
+ /* @__PURE__ */ a("span", { children: "Purpose" }),
717
+ /* @__PURE__ */ a(
718
+ re,
719
+ {
720
+ required: !0,
721
+ rows: 3,
722
+ value: e.purpose,
723
+ onChange: (d) => l({ ...e, purpose: d.target.value })
724
+ }
725
+ )
726
+ ] }),
727
+ n && /* @__PURE__ */ a(S, { type: "submit", disabled: r, children: r ? "Saving…" : "Save revision" })
728
+ ]
729
+ }
730
+ );
731
+ }
732
+ const pa = (e) => e ? `${e} warning${e === 1 ? "" : "s"}` : "Ready", ga = (e) => ({
733
+ capability_not_installed: "Capability is not installed",
734
+ capability_version_unavailable: "Capability version is unavailable",
735
+ mcp_disabled: "MCP server is disabled",
736
+ model_unavailable: "Model is unavailable",
737
+ plugin_dependency_unavailable: "Plugin dependency is unavailable",
738
+ plugin_resolution_invalid: "Plugin selection is invalid",
739
+ plugin_unavailable: "Plugin is unavailable",
740
+ skill_provider_unavailable: "Skill provider is unavailable"
741
+ })[e] ?? e.replaceAll("_", " ");
742
+ function Pa({
743
+ composition: e,
744
+ loading: l = !1,
745
+ error: s = ""
746
+ }) {
747
+ return l ? /* @__PURE__ */ a(z, { size: "sm", title: "Inspecting composition…" }) : s ? /* @__PURE__ */ a(
748
+ z,
749
+ {
750
+ size: "sm",
751
+ variant: "error",
752
+ title: "Composition unavailable",
753
+ description: s
754
+ }
755
+ ) : e != null && e.items.length ? /* @__PURE__ */ t(
756
+ "section",
757
+ {
758
+ className: "af-agent-composition",
759
+ "aria-label": "Effective composition",
760
+ children: [
761
+ /* @__PURE__ */ t("header", { children: [
762
+ /* @__PURE__ */ t("div", { children: [
763
+ /* @__PURE__ */ a(N, { children: "Effective composition" }),
764
+ /* @__PURE__ */ a(P, { children: e.model || "No model selected" })
765
+ ] }),
766
+ /* @__PURE__ */ a(y, { tone: e.issues.length ? "warning" : "success", children: pa(e.issues.length) })
767
+ ] }),
768
+ e.issues.length > 0 && /* @__PURE__ */ a(
769
+ "ul",
770
+ {
771
+ className: "af-agent-composition__issues",
772
+ "aria-label": "Composition warnings",
773
+ children: e.issues.map((r) => /* @__PURE__ */ t("li", { children: [
774
+ /* @__PURE__ */ a("strong", { children: ga(r.code) }),
775
+ " ",
776
+ r.message
777
+ ] }, `${r.code}:${r.message}`))
778
+ }
779
+ ),
780
+ /* @__PURE__ */ a("div", { className: "af-agent-composition__items", children: e.items.map((r) => /* @__PURE__ */ t(
781
+ V,
782
+ {
783
+ as: "article",
784
+ children: [
785
+ /* @__PURE__ */ t("div", { children: [
786
+ /* @__PURE__ */ t(N, { children: [
787
+ r.kind,
788
+ " · ",
789
+ r.source
790
+ ] }),
791
+ /* @__PURE__ */ a(P, { children: r.id })
792
+ ] }),
793
+ /* @__PURE__ */ a(
794
+ y,
795
+ {
796
+ tone: r.status === "unavailable" ? "warning" : ["allowed", "enabled", "selected"].includes(r.status) ? "success" : "neutral",
797
+ children: r.status
798
+ }
799
+ ),
800
+ r.version && /* @__PURE__ */ t("p", { children: [
801
+ "Version ",
802
+ r.version
803
+ ] }),
804
+ r.reasoningEfforts.length > 0 && /* @__PURE__ */ t("p", { children: [
805
+ "Reasoning: ",
806
+ r.reasoningEfforts.join(", ")
807
+ ] }),
808
+ r.inputModalities.length > 0 && /* @__PURE__ */ t("p", { children: [
809
+ "Input: ",
810
+ r.inputModalities.join(", ")
811
+ ] }),
812
+ r.permissions.length > 0 && /* @__PURE__ */ t("p", { children: [
813
+ "Permissions: ",
814
+ r.permissions.join(", ")
815
+ ] }),
816
+ r.dependencies.length > 0 && /* @__PURE__ */ t("p", { children: [
817
+ "Dependencies: ",
818
+ r.dependencies.join(", ")
819
+ ] }),
820
+ r.reason && /* @__PURE__ */ a("p", { role: r.status === "available" ? void 0 : "alert", children: r.reason })
821
+ ]
822
+ },
823
+ `${r.kind}:${r.id}:${r.version}:${r.source}`
824
+ )) })
825
+ ]
826
+ }
827
+ ) : /* @__PURE__ */ a(
828
+ z,
829
+ {
830
+ size: "sm",
831
+ title: "No deployed capabilities",
832
+ description: "This Profile has no inspectable composition yet."
833
+ }
834
+ );
835
+ }
836
+ function Aa({
837
+ revision: e,
838
+ composition: l,
839
+ onChange: s,
840
+ onSave: r
841
+ }) {
842
+ var H, J, R, Y, W, k, j, A, Q, E, ke, ye, Ce, we, _e, Ne, Pe, Ae, ze, xe;
843
+ const [n, o] = T(e), [c, d] = T(
844
+ "idle"
845
+ ), [u, f] = T(""), g = (l == null ? void 0 : l.items.filter(
846
+ (i) => i.kind === "skill" || i.kind === "skill_pack" || i.kind === "plugin" || i.kind === "mcp"
847
+ )) ?? [], C = (l == null ? void 0 : l.items.filter(
848
+ (i) => i.kind === "model" && i.status !== "unavailable"
849
+ )) ?? [], b = (l == null ? void 0 : l.items.filter((i) => i.kind === "tool")) ?? [], w = (i) => s({
850
+ ...e,
851
+ runtimePolicy: {
852
+ ...m(v.RuntimePolicySchema),
853
+ ...e.runtimePolicy,
854
+ ...i
855
+ }
856
+ }), M = (i, h) => {
857
+ var p;
858
+ return w({
859
+ limits: {
860
+ ...m(v.ProfileLimitsSchema),
861
+ ...(p = e.runtimePolicy) == null ? void 0 : p.limits,
862
+ [i]: i === "maxTokens" ? BigInt(h || 0) : Number(h || 0)
863
+ }
864
+ });
865
+ }, U = (i, h) => {
866
+ if (i.kind === "skill" || i.kind === "skill_pack") {
867
+ const p = i.kind === "skill" ? { ...e.skills } : { ...e.skillPacks };
868
+ h ? p[i.id] = i.version : delete p[i.id], s(
869
+ i.kind === "skill" ? { ...e, skills: p } : { ...e, skillPacks: p }
870
+ );
871
+ }
872
+ if (i.kind === "plugin" || i.kind === "mcp") {
873
+ const p = { ...e.plugins };
874
+ h ? p[i.id] = m(v.PluginConfigSchema, {
875
+ version: i.version
876
+ }) : delete p[i.id], s({ ...e, plugins: p });
877
+ }
878
+ }, oe = async () => {
879
+ d("pending"), f("");
880
+ try {
881
+ const i = await r(e);
882
+ o(i ?? e), i && s(i), d("success");
883
+ } catch (i) {
884
+ s(n), f(i instanceof Error ? i.message : String(i)), d("error");
885
+ }
886
+ };
887
+ return /* @__PURE__ */ t("div", { className: "af-agent-settings", children: [
888
+ /* @__PURE__ */ a(
889
+ ua,
890
+ {
891
+ revision: e,
892
+ onChange: s,
893
+ onSave: () => void oe(),
894
+ saving: c === "pending",
895
+ showSave: !1
896
+ }
897
+ ),
898
+ /* @__PURE__ */ t("fieldset", { children: [
899
+ /* @__PURE__ */ a("legend", { children: "Runtime" }),
900
+ /* @__PURE__ */ t("label", { children: [
901
+ /* @__PURE__ */ a("span", { children: "Preferred model" }),
902
+ /* @__PURE__ */ a(
903
+ fe,
904
+ {
905
+ label: "Model",
906
+ value: ((J = (H = e.runtimePolicy) == null ? void 0 : H.model) == null ? void 0 : J.preferred) ?? "",
907
+ options: C.map((i) => ({
908
+ value: i.id,
909
+ label: `${i.id} · ${i.source}`
910
+ })),
911
+ onChange: (i) => {
912
+ var p, $, I;
913
+ const h = new Set(($ = (p = e.runtimePolicy) == null ? void 0 : p.model) == null ? void 0 : $.allowed);
914
+ h.add(i), w({
915
+ model: {
916
+ ...m(v.ModelPolicySchema),
917
+ ...(I = e.runtimePolicy) == null ? void 0 : I.model,
918
+ preferred: i,
919
+ allowed: [...h]
920
+ }
921
+ });
922
+ }
923
+ }
924
+ )
925
+ ] }),
926
+ /* @__PURE__ */ a(
927
+ "div",
928
+ {
929
+ className: "af-agent-settings__checklist",
930
+ "aria-label": "Allowed models",
931
+ children: C.map((i) => {
932
+ var h, p, $, I;
933
+ return /* @__PURE__ */ a(
934
+ D,
935
+ {
936
+ label: `Allow ${i.id}`,
937
+ checked: ((p = (h = e.runtimePolicy) == null ? void 0 : h.model) == null ? void 0 : p.allowed.includes(i.id)) ?? !1,
938
+ disabled: i.id === ((I = ($ = e.runtimePolicy) == null ? void 0 : $.model) == null ? void 0 : I.preferred),
939
+ onCheckedChange: (he) => {
940
+ var X, Z, ee;
941
+ const F = new Set((Z = (X = e.runtimePolicy) == null ? void 0 : X.model) == null ? void 0 : Z.allowed);
942
+ he ? F.add(i.id) : F.delete(i.id), w({
943
+ model: {
944
+ ...m(v.ModelPolicySchema),
945
+ ...(ee = e.runtimePolicy) == null ? void 0 : ee.model,
946
+ allowed: [...F]
947
+ }
948
+ });
949
+ }
950
+ },
951
+ i.id
952
+ );
953
+ })
954
+ }
955
+ ),
956
+ /* @__PURE__ */ t("label", { children: [
957
+ /* @__PURE__ */ a("span", { children: "Reasoning" }),
958
+ /* @__PURE__ */ a(
959
+ fe,
960
+ {
961
+ label: "Reasoning",
962
+ value: ((R = e.runtimePolicy) == null ? void 0 : R.reasoning) ?? "medium",
963
+ options: ((Y = C.find(
964
+ (i) => {
965
+ var h, p;
966
+ return i.id === ((p = (h = e.runtimePolicy) == null ? void 0 : h.model) == null ? void 0 : p.preferred);
967
+ }
968
+ )) != null && Y.reasoningEfforts.length ? C.find(
969
+ (i) => {
970
+ var h, p;
971
+ return i.id === ((p = (h = e.runtimePolicy) == null ? void 0 : h.model) == null ? void 0 : p.preferred);
972
+ }
973
+ ).reasoningEfforts : ["low", "medium", "high"]).map((i) => ({ value: i, label: i })),
974
+ onChange: (i) => w({ reasoning: i })
975
+ }
976
+ )
977
+ ] }),
978
+ /* @__PURE__ */ t("div", { className: "af-agent-settings__limits", children: [
979
+ /* @__PURE__ */ t("label", { children: [
980
+ /* @__PURE__ */ a("span", { children: "Max steps" }),
981
+ /* @__PURE__ */ a(
982
+ x,
983
+ {
984
+ "aria-label": "Max steps",
985
+ type: "number",
986
+ min: "1",
987
+ value: ((k = (W = e.runtimePolicy) == null ? void 0 : W.limits) == null ? void 0 : k.maxSteps) || "",
988
+ onChange: (i) => M("maxSteps", i.target.value)
989
+ }
990
+ )
253
991
  ] }),
254
- /* @__PURE__ */ t(y, { children: e.name || "Untitled Agent" })
992
+ /* @__PURE__ */ t("label", { children: [
993
+ /* @__PURE__ */ a("span", { children: "Max tool calls" }),
994
+ /* @__PURE__ */ a(
995
+ x,
996
+ {
997
+ "aria-label": "Max tool calls",
998
+ type: "number",
999
+ min: "0",
1000
+ value: ((A = (j = e.runtimePolicy) == null ? void 0 : j.limits) == null ? void 0 : A.maxToolCalls) || "",
1001
+ onChange: (i) => M("maxToolCalls", i.target.value)
1002
+ }
1003
+ )
1004
+ ] }),
1005
+ /* @__PURE__ */ t("label", { children: [
1006
+ /* @__PURE__ */ a("span", { children: "Max tokens" }),
1007
+ /* @__PURE__ */ a(
1008
+ x,
1009
+ {
1010
+ "aria-label": "Max tokens",
1011
+ type: "number",
1012
+ min: "1",
1013
+ value: ((ke = (E = (Q = e.runtimePolicy) == null ? void 0 : Q.limits) == null ? void 0 : E.maxTokens) == null ? void 0 : ke.toString()) ?? "",
1014
+ onChange: (i) => M("maxTokens", i.target.value)
1015
+ }
1016
+ )
1017
+ ] })
255
1018
  ] })
256
1019
  ] }),
257
- /* @__PURE__ */ i("label", { children: [
258
- /* @__PURE__ */ t("span", { children: "Name" }),
259
- /* @__PURE__ */ t(P, { required: !0, value: e.name, onChange: (r) => a({ ...e, name: r.target.value }) })
1020
+ /* @__PURE__ */ t("fieldset", { children: [
1021
+ /* @__PURE__ */ a("legend", { children: "Tool policy" }),
1022
+ /* @__PURE__ */ a(
1023
+ D,
1024
+ {
1025
+ label: "Allow every deployed tool",
1026
+ checked: ((Ce = (ye = e.runtimePolicy) == null ? void 0 : ye.tools) == null ? void 0 : Ce.allowAll) ?? !1,
1027
+ onCheckedChange: (i) => {
1028
+ var h;
1029
+ return w({
1030
+ tools: {
1031
+ ...m(v.ToolPolicySchema),
1032
+ ...(h = e.runtimePolicy) == null ? void 0 : h.tools,
1033
+ allowAll: i
1034
+ }
1035
+ });
1036
+ }
1037
+ }
1038
+ ),
1039
+ b.map((i) => {
1040
+ var $, I, he, F, X, Z, ee, Te;
1041
+ const h = ((I = ($ = e.runtimePolicy) == null ? void 0 : $.tools) == null ? void 0 : I.allowAll) || ((F = (he = e.runtimePolicy) == null ? void 0 : he.tools) == null ? void 0 : F.allowed.includes(i.id)), p = (Z = (X = e.runtimePolicy) == null ? void 0 : X.tools) == null ? void 0 : Z.requireConfirmation.includes(
1042
+ i.id
1043
+ );
1044
+ return /* @__PURE__ */ t("div", { className: "af-agent-settings__tool", children: [
1045
+ /* @__PURE__ */ a(
1046
+ D,
1047
+ {
1048
+ label: i.id,
1049
+ checked: !!h,
1050
+ disabled: (Te = (ee = e.runtimePolicy) == null ? void 0 : ee.tools) == null ? void 0 : Te.allowAll,
1051
+ onCheckedChange: (ue) => {
1052
+ var ae, ne, le;
1053
+ const q = new Set(
1054
+ (ne = (ae = e.runtimePolicy) == null ? void 0 : ae.tools) == null ? void 0 : ne.allowed
1055
+ );
1056
+ ue ? q.add(i.id) : q.delete(i.id), w({
1057
+ tools: {
1058
+ ...m(v.ToolPolicySchema),
1059
+ ...(le = e.runtimePolicy) == null ? void 0 : le.tools,
1060
+ allowed: [...q]
1061
+ }
1062
+ });
1063
+ }
1064
+ }
1065
+ ),
1066
+ /* @__PURE__ */ a(
1067
+ D,
1068
+ {
1069
+ label: "Require confirmation",
1070
+ checked: !!p,
1071
+ disabled: !h,
1072
+ onCheckedChange: (ue) => {
1073
+ var ae, ne, le;
1074
+ const q = new Set(
1075
+ (ne = (ae = e.runtimePolicy) == null ? void 0 : ae.tools) == null ? void 0 : ne.requireConfirmation
1076
+ );
1077
+ ue ? q.add(i.id) : q.delete(i.id), w({
1078
+ tools: {
1079
+ ...m(v.ToolPolicySchema),
1080
+ ...(le = e.runtimePolicy) == null ? void 0 : le.tools,
1081
+ requireConfirmation: [...q]
1082
+ }
1083
+ });
1084
+ }
1085
+ }
1086
+ )
1087
+ ] }, i.id);
1088
+ })
260
1089
  ] }),
261
- /* @__PURE__ */ i("label", { children: [
262
- /* @__PURE__ */ t("span", { children: "Avatar URL" }),
263
- /* @__PURE__ */ t(P, { type: "url", value: e.avatar, onChange: (r) => a({ ...e, avatar: r.target.value }) })
1090
+ /* @__PURE__ */ t("fieldset", { children: [
1091
+ /* @__PURE__ */ a("legend", { children: "Capabilities" }),
1092
+ g.length ? g.map((i) => /* @__PURE__ */ a(
1093
+ D,
1094
+ {
1095
+ label: `${i.kind} · ${i.id} (${i.version})`,
1096
+ checked: i.kind === "skill" ? i.id in e.skills : i.kind === "skill_pack" ? i.id in e.skillPacks : i.id in e.plugins,
1097
+ disabled: i.status === "unavailable",
1098
+ onCheckedChange: (h) => U(i, h)
1099
+ },
1100
+ `${i.kind}:${i.id}`
1101
+ )) : /* @__PURE__ */ a("p", { children: "No deployed Skills or Plugins." })
264
1102
  ] }),
265
- /* @__PURE__ */ i("label", { children: [
266
- /* @__PURE__ */ t("span", { children: "Persona" }),
267
- /* @__PURE__ */ t(F, { required: !0, rows: 5, value: e.persona, onChange: (r) => a({ ...e, persona: r.target.value }) })
1103
+ /* @__PURE__ */ t("fieldset", { children: [
1104
+ /* @__PURE__ */ a("legend", { children: "Context" }),
1105
+ /* @__PURE__ */ t("label", { children: [
1106
+ /* @__PURE__ */ a("span", { children: "Memory" }),
1107
+ /* @__PURE__ */ a(
1108
+ fe,
1109
+ {
1110
+ label: "Memory",
1111
+ value: ((we = e.memory) == null ? void 0 : we.mode) ?? "disabled",
1112
+ options: ["disabled", "session", "subject"].map((i) => ({
1113
+ value: i,
1114
+ label: i
1115
+ })),
1116
+ onChange: (i) => s({
1117
+ ...e,
1118
+ memory: {
1119
+ ...m(v.MemoryPolicySchema),
1120
+ ...e.memory,
1121
+ mode: i
1122
+ }
1123
+ })
1124
+ }
1125
+ )
1126
+ ] }),
1127
+ /* @__PURE__ */ t("label", { children: [
1128
+ /* @__PURE__ */ a("span", { children: "Memory TTL days" }),
1129
+ /* @__PURE__ */ a(
1130
+ x,
1131
+ {
1132
+ "aria-label": "Memory TTL days",
1133
+ type: "number",
1134
+ min: "0",
1135
+ value: ((Ne = (_e = e.memory) == null ? void 0 : _e.ttlDays) == null ? void 0 : Ne.toString()) ?? "",
1136
+ onChange: (i) => s({
1137
+ ...e,
1138
+ memory: {
1139
+ ...m(v.MemoryPolicySchema),
1140
+ ...e.memory,
1141
+ ttlDays: BigInt(i.target.value || 0)
1142
+ }
1143
+ })
1144
+ }
1145
+ )
1146
+ ] }),
1147
+ /* @__PURE__ */ t("label", { children: [
1148
+ /* @__PURE__ */ a("span", { children: "Knowledge space IDs" }),
1149
+ /* @__PURE__ */ a(
1150
+ re,
1151
+ {
1152
+ "aria-label": "Knowledge space IDs",
1153
+ rows: 2,
1154
+ value: e.knowledgeBindings.map((i) => i.resourceId).join(`
1155
+ `),
1156
+ onChange: (i) => s({
1157
+ ...e,
1158
+ knowledgeBindings: i.target.value.split(`
1159
+ `).map((h) => h.trim()).filter(Boolean).map(
1160
+ (h) => m(v.KnowledgeBindingSchema, {
1161
+ resourceId: h,
1162
+ role: "reader"
1163
+ })
1164
+ )
1165
+ })
1166
+ }
1167
+ )
1168
+ ] }),
1169
+ /* @__PURE__ */ a(
1170
+ D,
1171
+ {
1172
+ label: "Subagents",
1173
+ checked: ((Pe = e.subagent) == null ? void 0 : Pe.enabled) ?? !1,
1174
+ onCheckedChange: (i) => s({
1175
+ ...e,
1176
+ subagent: {
1177
+ ...m(v.CapabilityPolicySchema),
1178
+ ...e.subagent,
1179
+ enabled: i
1180
+ }
1181
+ })
1182
+ }
1183
+ ),
1184
+ /* @__PURE__ */ t("label", { children: [
1185
+ /* @__PURE__ */ a("span", { children: "Subagent providers" }),
1186
+ /* @__PURE__ */ a(
1187
+ x,
1188
+ {
1189
+ "aria-label": "Subagent providers",
1190
+ value: ((Ae = e.subagent) == null ? void 0 : Ae.providers.join(", ")) ?? "",
1191
+ onChange: (i) => s({
1192
+ ...e,
1193
+ subagent: {
1194
+ ...m(v.CapabilityPolicySchema),
1195
+ ...e.subagent,
1196
+ providers: Ee(i.target.value)
1197
+ }
1198
+ })
1199
+ }
1200
+ )
1201
+ ] }),
1202
+ /* @__PURE__ */ a(
1203
+ D,
1204
+ {
1205
+ label: "Collaboration",
1206
+ checked: ((ze = e.collaboration) == null ? void 0 : ze.enabled) ?? !1,
1207
+ onCheckedChange: (i) => s({
1208
+ ...e,
1209
+ collaboration: {
1210
+ ...m(v.CapabilityPolicySchema),
1211
+ ...e.collaboration,
1212
+ enabled: i
1213
+ }
1214
+ })
1215
+ }
1216
+ ),
1217
+ /* @__PURE__ */ t("label", { children: [
1218
+ /* @__PURE__ */ a("span", { children: "Collaboration providers" }),
1219
+ /* @__PURE__ */ a(
1220
+ x,
1221
+ {
1222
+ "aria-label": "Collaboration providers",
1223
+ value: ((xe = e.collaboration) == null ? void 0 : xe.providers.join(", ")) ?? "",
1224
+ onChange: (i) => s({
1225
+ ...e,
1226
+ collaboration: {
1227
+ ...m(v.CapabilityPolicySchema),
1228
+ ...e.collaboration,
1229
+ providers: Ee(i.target.value)
1230
+ }
1231
+ })
1232
+ }
1233
+ )
1234
+ ] }),
1235
+ /* @__PURE__ */ a(
1236
+ fa,
1237
+ {
1238
+ value: e.outputPolicy,
1239
+ onChange: (i) => s({ ...e, outputPolicy: i })
1240
+ }
1241
+ )
268
1242
  ] }),
269
- /* @__PURE__ */ i("label", { children: [
270
- /* @__PURE__ */ t("span", { children: "Purpose" }),
271
- /* @__PURE__ */ t(F, { required: !0, rows: 3, value: e.purpose, onChange: (r) => a({ ...e, purpose: r.target.value }) })
1243
+ /* @__PURE__ */ t("div", { className: "af-agent-settings__save", children: [
1244
+ /* @__PURE__ */ a(
1245
+ S,
1246
+ {
1247
+ type: "button",
1248
+ onClick: () => void oe(),
1249
+ disabled: c === "pending",
1250
+ children: c === "pending" ? "Saving…" : "Save Profile"
1251
+ }
1252
+ ),
1253
+ c === "success" && /* @__PURE__ */ t("span", { role: "status", children: [
1254
+ "Saved revision ",
1255
+ n.revision.toString(),
1256
+ ". Existing sessions keep their pinned revision."
1257
+ ] }),
1258
+ c === "error" && /* @__PURE__ */ t("span", { role: "alert", children: [
1259
+ "Save failed: ",
1260
+ u
1261
+ ] })
1262
+ ] })
1263
+ ] });
1264
+ }
1265
+ const Ee = (e) => [
1266
+ ...new Set(
1267
+ e.split(",").map((l) => l.trim()).filter(Boolean)
1268
+ )
1269
+ ].sort();
1270
+ function fa({
1271
+ value: e,
1272
+ onChange: l
1273
+ }) {
1274
+ const s = JSON.stringify(e ?? {}, null, 2), [r, n] = T(s), [o, c] = T("");
1275
+ return Ue(() => n(s), [s]), /* @__PURE__ */ t("label", { children: [
1276
+ /* @__PURE__ */ a("span", { children: "Output policy JSON" }),
1277
+ /* @__PURE__ */ a(
1278
+ re,
1279
+ {
1280
+ "aria-label": "Output policy JSON",
1281
+ rows: 4,
1282
+ value: r,
1283
+ onChange: (u) => n(u.target.value),
1284
+ onBlur: () => {
1285
+ try {
1286
+ const u = JSON.parse(r);
1287
+ if (!u || typeof u != "object" || Array.isArray(u))
1288
+ throw new Error("Output policy must be a JSON object");
1289
+ c(""), l(
1290
+ u
1291
+ );
1292
+ } catch (u) {
1293
+ c(u instanceof Error ? u.message : String(u));
1294
+ }
1295
+ }
1296
+ }
1297
+ ),
1298
+ o && /* @__PURE__ */ a("span", { role: "alert", children: o })
1299
+ ] });
1300
+ }
1301
+ function za({
1302
+ editor: e,
1303
+ preview: l
1304
+ }) {
1305
+ return /* @__PURE__ */ t("div", { className: "af-agent-studio", children: [
1306
+ /* @__PURE__ */ a("section", { "aria-label": "Agent configuration", children: e }),
1307
+ /* @__PURE__ */ a("section", { "aria-label": "Agent preview", children: l })
1308
+ ] });
1309
+ }
1310
+ function xa({ skills: e, installed: l, busy: s = "", completeness: r = "complete", onInstall: n, onUninstall: o }) {
1311
+ return e.length ? /* @__PURE__ */ t("section", { className: "af-agent-manager", "aria-label": "Skill and SkillPack catalog", children: [
1312
+ /* @__PURE__ */ t("header", { children: [
1313
+ /* @__PURE__ */ t("div", { children: [
1314
+ /* @__PURE__ */ t(N, { children: [
1315
+ /* @__PURE__ */ a(Xe, { size: 14, "aria-hidden": !0 }),
1316
+ " Capability catalog"
1317
+ ] }),
1318
+ /* @__PURE__ */ t(P, { children: [
1319
+ e.length,
1320
+ " deployed definitions"
1321
+ ] })
1322
+ ] }),
1323
+ /* @__PURE__ */ a(y, { tone: r === "complete" ? "success" : "warning", children: r })
272
1324
  ] }),
273
- /* @__PURE__ */ t(w, { type: "submit", disabled: o, children: o ? "Saving…" : "Save revision" })
1325
+ /* @__PURE__ */ a("div", { className: "af-agent-manager__list", children: e.map((c) => {
1326
+ const d = ba(c), u = l.has(d);
1327
+ return /* @__PURE__ */ t(V, { as: "article", children: [
1328
+ /* @__PURE__ */ t("div", { children: [
1329
+ /* @__PURE__ */ t(N, { children: [
1330
+ c.kind,
1331
+ " · ",
1332
+ c.provider
1333
+ ] }),
1334
+ /* @__PURE__ */ a(P, { children: c.title || c.slug }),
1335
+ /* @__PURE__ */ a("p", { children: c.description || `${c.slug}@${c.version}` })
1336
+ ] }),
1337
+ /* @__PURE__ */ t("div", { className: "af-agent-manager__actions", children: [
1338
+ /* @__PURE__ */ a(y, { tone: u ? "success" : "neutral", children: u ? "Installed" : c.trust || "Available" }),
1339
+ /* @__PURE__ */ a(S, { size: "compact", variant: u ? "secondary" : "primary", disabled: s === d, onClick: () => void (u ? o(c) : n(c)), children: s === d ? "Updating…" : u ? "Uninstall" : "Install" })
1340
+ ] })
1341
+ ] }, d);
1342
+ }) })
1343
+ ] }) : /* @__PURE__ */ a(z, { size: "sm", title: "No Skills available", description: "The configured providers returned an empty catalog." });
1344
+ }
1345
+ function Ta({ memories: e, busy: l = "", onConfirm: s, onDelete: r }) {
1346
+ return /* @__PURE__ */ t("section", { className: "af-agent-manager", "aria-label": "Memory center", children: [
1347
+ /* @__PURE__ */ a("header", { children: /* @__PURE__ */ t("div", { children: [
1348
+ /* @__PURE__ */ t(N, { children: [
1349
+ /* @__PURE__ */ a(ea, { size: 14, "aria-hidden": !0 }),
1350
+ " Governed memory"
1351
+ ] }),
1352
+ /* @__PURE__ */ t(P, { children: [
1353
+ e.length,
1354
+ " records"
1355
+ ] })
1356
+ ] }) }),
1357
+ e.length ? /* @__PURE__ */ a("div", { className: "af-agent-manager__list", children: e.map((n) => /* @__PURE__ */ t(V, { as: "article", children: [
1358
+ /* @__PURE__ */ t("div", { children: [
1359
+ /* @__PURE__ */ t(N, { children: [
1360
+ n.status,
1361
+ " · ",
1362
+ n.risk || "unrated"
1363
+ ] }),
1364
+ /* @__PURE__ */ a(P, { children: n.content }),
1365
+ /* @__PURE__ */ t("p", { children: [
1366
+ "Source ",
1367
+ n.sourceSessionId || "unknown",
1368
+ " · event ",
1369
+ n.sourceEventSeq.toString()
1370
+ ] })
1371
+ ] }),
1372
+ /* @__PURE__ */ t("div", { className: "af-agent-manager__actions", children: [
1373
+ /* @__PURE__ */ a(y, { tone: n.status === "confirmed" ? "success" : "warning", children: n.status }),
1374
+ n.status !== "confirmed" && /* @__PURE__ */ a(S, { size: "compact", disabled: l === n.id, onClick: () => void s(n), children: "Confirm" }),
1375
+ /* @__PURE__ */ a(S, { size: "compact", variant: "ghost", disabled: l === n.id, onClick: () => void r(n), children: "Delete" })
1376
+ ] })
1377
+ ] }, n.id)) }) : /* @__PURE__ */ a(z, { size: "sm", title: "No retained memories", description: "Candidates appear here with source, risk and consent state." })
1378
+ ] });
1379
+ }
1380
+ function Ra({ collaboration: e, tasks: l, busy: s = !1, onCancel: r }) {
1381
+ return e ? /* @__PURE__ */ t("section", { className: "af-agent-manager", "aria-label": "Collaboration tasks", children: [
1382
+ /* @__PURE__ */ t("header", { children: [
1383
+ /* @__PURE__ */ t("div", { children: [
1384
+ /* @__PURE__ */ t(N, { children: [
1385
+ /* @__PURE__ */ a(Ie, { size: 14, "aria-hidden": !0 }),
1386
+ " Collaboration"
1387
+ ] }),
1388
+ /* @__PURE__ */ a(P, { children: e.id })
1389
+ ] }),
1390
+ /* @__PURE__ */ t("div", { className: "af-agent-manager__actions", children: [
1391
+ /* @__PURE__ */ a(y, { tone: e.status === "completed" ? "success" : "cool", children: e.status }),
1392
+ r && e.status !== "completed" && /* @__PURE__ */ a(S, { size: "compact", variant: "secondary", disabled: s, onClick: () => void r(), children: s ? "Cancelling…" : "Cancel" })
1393
+ ] })
1394
+ ] }),
1395
+ /* @__PURE__ */ a("ol", { className: "af-agent-task-tree", children: l.map((n) => /* @__PURE__ */ t("li", { children: [
1396
+ /* @__PURE__ */ a("span", { "aria-hidden": !0 }),
1397
+ /* @__PURE__ */ t("div", { children: [
1398
+ /* @__PURE__ */ a("strong", { children: n.objective }),
1399
+ /* @__PURE__ */ t("p", { children: [
1400
+ n.provider,
1401
+ " · ",
1402
+ n.status,
1403
+ " · attempt ",
1404
+ n.attempts
1405
+ ] }),
1406
+ n.result && /* @__PURE__ */ a("p", { children: n.result })
1407
+ ] }),
1408
+ /* @__PURE__ */ a(y, { tone: n.status === "completed" ? "success" : n.status === "failed" ? "warning" : "cool", children: n.status })
1409
+ ] }, n.id)) })
1410
+ ] }) : /* @__PURE__ */ a(z, { size: "sm", title: "No active collaboration", description: "Subagent and collaboration runs will expose their task tree here.", icon: /* @__PURE__ */ a(Ie, { size: 22, "aria-hidden": !0 }) });
1411
+ }
1412
+ function $a({ documents: e, onBind: l, onAttach: s, onOpen: r }) {
1413
+ return /* @__PURE__ */ t("section", { className: "af-agent-manager", "aria-label": "Agent document library", children: [
1414
+ /* @__PURE__ */ a("header", { children: /* @__PURE__ */ t("div", { children: [
1415
+ /* @__PURE__ */ t(N, { children: [
1416
+ /* @__PURE__ */ a(Ze, { size: 14, "aria-hidden": !0 }),
1417
+ " Agent and Docs"
1418
+ ] }),
1419
+ /* @__PURE__ */ t(P, { children: [
1420
+ e.length,
1421
+ " accessible documents"
1422
+ ] })
1423
+ ] }) }),
1424
+ e.length ? /* @__PURE__ */ a("div", { className: "af-agent-manager__list", children: e.map((n) => /* @__PURE__ */ t(V, { as: "article", children: [
1425
+ /* @__PURE__ */ t("div", { children: [
1426
+ /* @__PURE__ */ t(N, { children: [
1427
+ n.space,
1428
+ " · revision ",
1429
+ n.revision
1430
+ ] }),
1431
+ /* @__PURE__ */ a(P, { children: n.title }),
1432
+ /* @__PURE__ */ a("p", { children: n.availability || "Ready for grounded context and document actions" })
1433
+ ] }),
1434
+ /* @__PURE__ */ t("div", { className: "af-agent-manager__actions", children: [
1435
+ /* @__PURE__ */ a(y, { tone: n.bound ? "success" : "neutral", children: n.bound ? "Space in Profile knowledge" : "Space not bound" }),
1436
+ /* @__PURE__ */ a(S, { size: "compact", variant: "secondary", onClick: () => l(n), children: n.bound ? "Unbind space" : "Bind space" }),
1437
+ /* @__PURE__ */ a(S, { size: "compact", variant: n.attached ? "secondary" : "primary", onClick: () => s(n), children: n.attached ? "Remove from prompt" : "Use in prompt" }),
1438
+ r && /* @__PURE__ */ a(S, { size: "compact", variant: "ghost", onClick: () => r(n), children: "Open editor" })
1439
+ ] })
1440
+ ] }, n.id)) }) : /* @__PURE__ */ a(z, { size: "sm", title: "No accessible documents", description: "Create or share a Docs space, then bind its knowledge to this Profile or attach one document to a prompt." })
274
1441
  ] });
275
1442
  }
276
- function Ie({ editor: e, preview: a }) {
277
- return /* @__PURE__ */ i("div", { className: "af-agent-studio", children: [
278
- /* @__PURE__ */ t("section", { "aria-label": "Agent configuration", children: e }),
279
- /* @__PURE__ */ t("section", { "aria-label": "Agent preview", children: a })
1443
+ function Ia({ revisions: e, currentId: l, onFork: s }) {
1444
+ return /* @__PURE__ */ t("section", { className: "af-agent-manager", "aria-label": "Profile revision history", children: [
1445
+ /* @__PURE__ */ a("header", { children: /* @__PURE__ */ t("div", { children: [
1446
+ /* @__PURE__ */ t(N, { children: [
1447
+ /* @__PURE__ */ a(aa, { size: 14, "aria-hidden": !0 }),
1448
+ " Revision history"
1449
+ ] }),
1450
+ /* @__PURE__ */ t(P, { children: [
1451
+ e.length,
1452
+ " immutable revisions"
1453
+ ] })
1454
+ ] }) }),
1455
+ /* @__PURE__ */ a("ol", { className: "af-agent-revisions", children: [...e].sort((r, n) => Number(n.revision - r.revision)).map((r) => /* @__PURE__ */ t("li", { children: [
1456
+ /* @__PURE__ */ t("div", { children: [
1457
+ /* @__PURE__ */ t("strong", { children: [
1458
+ "Revision ",
1459
+ r.revision.toString()
1460
+ ] }),
1461
+ /* @__PURE__ */ a("p", { children: r.id })
1462
+ ] }),
1463
+ /* @__PURE__ */ a(y, { tone: r.id === l ? "success" : "neutral", children: r.id === l ? "Current" : "Pinned" }),
1464
+ s && /* @__PURE__ */ a(S, { size: "compact", variant: "ghost", onClick: () => s(r), children: "Start session" })
1465
+ ] }, r.id)) })
280
1466
  ] });
281
1467
  }
1468
+ const ba = (e) => `${e.kind}:${e.slug}@${e.version}`;
282
1469
  export {
283
- Se as AgentActionCard,
284
- Re as AgentChat,
285
- ke as AgentComposer,
286
- we as AgentConversation,
287
- me as AgentExecutionTrace,
288
- De as AgentProfileEditor,
289
- be as AgentResourceBar,
290
- ve as AgentSessionList,
291
- je as AgentSessionModel,
292
- qe as AgentSlotRegistry,
293
- Ie as AgentStudio,
294
- G as DEFAULT_AGENT_UI_LABELS,
295
- B as dataFallback,
296
- fe as useAgentSession
1470
+ sa as AgentActionCard,
1471
+ xa as AgentCapabilityCatalog,
1472
+ Na as AgentChat,
1473
+ Ra as AgentCollaborationCenter,
1474
+ ca as AgentComposer,
1475
+ Pa as AgentCompositionPanel,
1476
+ ha as AgentConversation,
1477
+ $a as AgentDocumentLibrary,
1478
+ ra as AgentExecutionTrace,
1479
+ Ta as AgentMemoryCenter,
1480
+ ua as AgentProfileEditor,
1481
+ Aa as AgentProfileSettings,
1482
+ ia as AgentResourceBar,
1483
+ Ia as AgentRevisionHistory,
1484
+ ta as AgentSessionList,
1485
+ Ea as AgentSessionModel,
1486
+ _a as AgentSlotRegistry,
1487
+ za as AgentStudio,
1488
+ Se as DEFAULT_AGENT_UI_LABELS,
1489
+ ba as capabilityKey,
1490
+ be as dataFallback,
1491
+ na as useAgentSession
297
1492
  };