@burdenoff/microfe-botmanor 2026.1205.2 → 2026.1206.1

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.
@@ -8,89 +8,89 @@ import { cn as s } from "../utils/cn.js";
8
8
  import { APPROVAL_SCOPES as c, RULE_SCOPE_DAYS as l, argumentLines as u, availableScopes as d, countBySource as f, decisionNeedsNote as p, defaultScope as m, fixedDefaultLabel as h, isRuleScope as g, shortHash as _, stewardOptions as v, timeLeft as y } from "../utils/stewardApprovals.js";
9
9
  import { BOTMANOR_PERMISSIONS as b } from "../permissions/botmanorPermissions.js";
10
10
  import { BotmanorPermissionGate as x } from "../permissions/useBotmanorPermissions.js";
11
- import { useMemo as S, useState as C } from "react";
12
- import { Textarea as w, ThemedSelect as T } from "@burdenoff/fe-libs/ui";
13
- import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
14
- import { CheckCircle2 as k, Inbox as A, Lock as j, ShieldAlert as M, XCircle as N } from "lucide-react";
15
- import { toast as P } from "sonner";
11
+ import { useId as S, useMemo as C, useRef as w, useState as T } from "react";
12
+ import { Textarea as E, ThemedSelect as D } from "@burdenoff/fe-libs/ui";
13
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
14
+ import { AlertTriangle as j, CheckCircle2 as M, Inbox as N, Lock as P, ShieldAlert as F, XCircle as I } from "lucide-react";
15
+ import { toast as L } from "sonner";
16
16
  // src/botlit/components/StewardApprovalsInbox.tsx
17
- var F = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", I = "h-9 rounded-md border border-border-default bg-bg-surface px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", L = ({ active: e, onClick: t, children: n }) => /* @__PURE__ */ D("button", {
17
+ var R = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", z = "h-9 rounded-md border border-border-default bg-bg-surface px-3 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", B = ({ active: e, onClick: t, children: n }) => /* @__PURE__ */ k("button", {
18
18
  type: "button",
19
19
  "aria-pressed": e,
20
20
  onClick: t,
21
- className: s(F, e ? "border-primary bg-bg-sunken text-text-primary" : "border-border-subtle text-text-secondary hover:text-text-primary"),
21
+ className: s(R, e ? "border-primary bg-bg-sunken text-text-primary" : "border-border-subtle text-text-secondary hover:text-text-primary"),
22
22
  children: n
23
- }), R = ({ onOpenAgent: c }) => {
24
- let u = e(), [d, p] = C("ALL"), [m, h] = C(""), [g, _] = C(!1), [b, x] = C("PENDING"), [w, E] = C(null), k = d === "ALL" ? void 0 : d, j = b === "PENDING" ? "PENDING" : void 0, M = !!(k || m), N = o({
25
- status: j,
23
+ }), V = ({ onOpenAgent: c }) => {
24
+ let u = e(), [d, p] = T("ALL"), [m, h] = T(""), [g, _] = T(!1), [b, x] = T("PENDING"), [S, w] = T(null), E = d === "ALL" ? void 0 : d, O = b === "PENDING" ? "PENDING" : void 0, j = !!(E || m), M = o({
25
+ status: O,
26
26
  mine: g
27
- }), F = o({
28
- status: j,
27
+ }), P = o({
28
+ status: O,
29
29
  mine: g,
30
- source: k,
30
+ source: E,
31
31
  stewardId: m || void 0
32
- }, { enabled: M }), R = M ? F : N, { decide: B, pendingId: V } = a(), H = (e) => b === "PENDING" ? e : e.filter((e) => e.status !== "PENDING"), U = S(() => H(N.data), [N.data, b]), W = f(U), G = S(() => v(U), [U]), K = S(() => H(R.data), [R.data, b]), q = R.hasMore, J = async () => {
33
- await Promise.all([R.loadMore(), M && N.hasMore ? N.loadMore() : void 0]);
32
+ }, { enabled: j }), F = j ? P : M, { decide: I, pendingId: R } = a(), V = (e) => b === "PENDING" ? e : e.filter((e) => e.status !== "PENDING"), U = C(() => V(M.data), [M.data, b]), W = f(U), G = C(() => v(U), [U]), K = C(() => V(F.data), [F.data, b]), q = F.hasMore, J = async () => {
33
+ await Promise.all([F.loadMore(), j && M.hasMore ? M.loadMore() : void 0]);
34
34
  }, Y = async () => {
35
- await Promise.all([N.refetch(), M ? F.refetch() : void 0]);
36
- }, X = K.find((e) => e.id === w) ?? K[0] ?? null;
37
- return /* @__PURE__ */ O("div", {
35
+ await Promise.all([M.refetch(), j ? P.refetch() : void 0]);
36
+ }, X = K.find((e) => e.id === S) ?? K[0] ?? null;
37
+ return /* @__PURE__ */ A("div", {
38
38
  className: "space-y-4",
39
39
  "data-testid": "steward-approvals-inbox",
40
40
  children: [
41
- /* @__PURE__ */ O("div", {
41
+ /* @__PURE__ */ A("div", {
42
42
  className: "flex flex-wrap items-center gap-3",
43
43
  children: [
44
- /* @__PURE__ */ O("div", {
44
+ /* @__PURE__ */ A("div", {
45
45
  className: "flex flex-wrap items-center gap-2",
46
46
  role: "group",
47
47
  "aria-label": "Source",
48
48
  children: [
49
- /* @__PURE__ */ D("span", {
49
+ /* @__PURE__ */ k("span", {
50
50
  className: "text-sm text-text-secondary",
51
51
  children: u("botlit.stewardApprovals.filter.source", "Source")
52
52
  }),
53
- /* @__PURE__ */ D(L, {
53
+ /* @__PURE__ */ k(B, {
54
54
  active: d === "ALL",
55
55
  onClick: () => p("ALL"),
56
56
  children: `${u("botlit.stewardApprovals.filter.all", "All")} (${W.all})`
57
57
  }),
58
- /* @__PURE__ */ D(L, {
58
+ /* @__PURE__ */ k(B, {
59
59
  active: d === "AGENT_CHAT",
60
60
  onClick: () => p("AGENT_CHAT"),
61
61
  children: `${u("botlit.stewardApprovals.source.agentChat", "Agent chat")} (${W.agentChat})`
62
62
  }),
63
- /* @__PURE__ */ D(L, {
63
+ /* @__PURE__ */ k(B, {
64
64
  active: d === "STEWARD",
65
65
  onClick: () => p("STEWARD"),
66
66
  children: `${u("botlit.stewardApprovals.source.steward", "Steward")} (${W.steward})`
67
67
  })
68
68
  ]
69
69
  }),
70
- /* @__PURE__ */ O("div", {
70
+ /* @__PURE__ */ A("div", {
71
71
  className: "flex flex-wrap items-center gap-2",
72
- children: [/* @__PURE__ */ D(L, {
72
+ children: [/* @__PURE__ */ k(B, {
73
73
  active: g,
74
74
  onClick: () => _((e) => !e),
75
75
  children: u("botlit.stewardApprovals.filter.mine", "Only mine")
76
- }), /* @__PURE__ */ O(T, {
77
- className: I,
76
+ }), /* @__PURE__ */ A(D, {
77
+ className: z,
78
78
  "aria-label": u("botlit.stewardApprovals.filter.steward", "Steward"),
79
79
  value: m,
80
80
  onChange: (e) => h(e.target.value),
81
81
  disabled: G.length === 0,
82
- children: [/* @__PURE__ */ D("option", {
82
+ children: [/* @__PURE__ */ k("option", {
83
83
  value: "",
84
84
  children: u("botlit.stewardApprovals.filter.allStewards", "All stewards")
85
- }), G.map((e) => /* @__PURE__ */ D("option", {
85
+ }), G.map((e) => /* @__PURE__ */ k("option", {
86
86
  value: e.id,
87
87
  children: e.label
88
88
  }, e.id))]
89
89
  })]
90
90
  }),
91
- /* @__PURE__ */ D("div", {
91
+ /* @__PURE__ */ k("div", {
92
92
  className: "ms-auto",
93
- children: /* @__PURE__ */ D(n, {
93
+ children: /* @__PURE__ */ k(n, {
94
94
  variant: "outline",
95
95
  size: "sm",
96
96
  "aria-pressed": b === "DECIDED",
@@ -100,61 +100,61 @@ var F = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline
100
100
  })
101
101
  ]
102
102
  }),
103
- R.error ? /* @__PURE__ */ D(i, {
103
+ F.error ? /* @__PURE__ */ k(i, {
104
104
  resource: u("botlit.toolApprovals.resource", "tool approvals"),
105
- error: R.error,
106
- onRetry: () => void R.refetch()
107
- }) : R.loading && R.data.length === 0 ? /* @__PURE__ */ D("div", { className: "h-48 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer" }) : K.length === 0 ? /* @__PURE__ */ D(r, {
108
- icon: /* @__PURE__ */ D(A, { size: 32 }),
105
+ error: F.error,
106
+ onRetry: () => void F.refetch()
107
+ }) : F.loading && F.data.length === 0 ? /* @__PURE__ */ k("div", { className: "h-48 rounded-lg bg-bg-sunken motion-safe:animate-vc-shimmer" }) : K.length === 0 ? /* @__PURE__ */ k(r, {
108
+ icon: /* @__PURE__ */ k(N, { size: 32 }),
109
109
  title: b === "PENDING" ? u("botlit.stewardApprovals.empty.title", "Nothing is waiting for you") : u("botlit.stewardApprovals.empty.historyTitle", "No decisions yet"),
110
110
  description: u("botlit.stewardApprovals.empty.description", "Tool calls from agent chats and stewards that need a person appear here.")
111
- }) : /* @__PURE__ */ O("div", {
111
+ }) : /* @__PURE__ */ A("div", {
112
112
  className: "grid gap-4 lg:grid-cols-[minmax(0,5fr)_minmax(0,7fr)]",
113
- children: [/* @__PURE__ */ D("ul", {
113
+ children: [/* @__PURE__ */ k("ul", {
114
114
  className: "space-y-2",
115
115
  "aria-label": u("botlit.stewardApprovals.listLabel", "Approval requests"),
116
116
  "data-testid": "steward-approvals-list",
117
117
  children: K.map((e) => {
118
118
  let n = e.source === "STEWARD", r = X?.id === e.id;
119
- return /* @__PURE__ */ D("li", { children: /* @__PURE__ */ O("button", {
119
+ return /* @__PURE__ */ k("li", { children: /* @__PURE__ */ A("button", {
120
120
  type: "button",
121
121
  "aria-current": r ? "true" : void 0,
122
- onClick: () => E(e.id),
122
+ onClick: () => w(e.id),
123
123
  "data-testid": `steward-approval-row-${e.id}`,
124
124
  className: s("w-full rounded-lg border p-3 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", r ? "border-primary bg-bg-sunken" : "border-border-subtle"),
125
- children: [/* @__PURE__ */ O("div", {
125
+ children: [/* @__PURE__ */ A("div", {
126
126
  className: "flex flex-wrap items-center gap-2",
127
127
  children: [
128
- /* @__PURE__ */ D(t, {
128
+ /* @__PURE__ */ k(t, {
129
129
  variant: n ? "default" : "outline",
130
130
  children: n ? u("botlit.stewardApprovals.source.steward", "Steward") : u("botlit.stewardApprovals.source.agentChat", "Agent chat")
131
131
  }),
132
- /* @__PURE__ */ D("span", {
132
+ /* @__PURE__ */ k("span", {
133
133
  className: "font-medium",
134
134
  children: e.agentName ?? e.agentId
135
135
  }),
136
- e.fixedDefault && /* @__PURE__ */ D(t, {
136
+ e.fixedDefault && /* @__PURE__ */ k(t, {
137
137
  variant: "warning",
138
138
  children: u("botlit.stewardApprovals.alwaysAsks", "Always asks")
139
139
  }),
140
- /* @__PURE__ */ D("span", {
140
+ /* @__PURE__ */ k("span", {
141
141
  className: "ms-auto text-xs text-text-secondary",
142
142
  children: e.status === "PENDING" ? y(e.expiresAt) : e.status
143
143
  })
144
144
  ]
145
- }), /* @__PURE__ */ O("p", {
145
+ }), /* @__PURE__ */ A("p", {
146
146
  className: "mt-1 break-all font-mono text-xs text-text-secondary",
147
147
  children: [e.toolName, e.destination ? ` → ${e.destination}` : ""]
148
148
  })]
149
149
  }) }, e.id);
150
150
  })
151
- }), X && /* @__PURE__ */ D("section", {
151
+ }), X && /* @__PURE__ */ k("section", {
152
152
  className: "space-y-4 rounded-lg border border-border-subtle p-4",
153
153
  "aria-label": u("botlit.stewardApprovals.detailLabel", "Request details"),
154
154
  "data-testid": "steward-approval-detail",
155
- children: /* @__PURE__ */ D(z, {
155
+ children: /* @__PURE__ */ k(H, {
156
156
  request: X,
157
- busy: V === X.id,
157
+ busy: R === X.id,
158
158
  scopeLabel: (e) => {
159
159
  switch (e) {
160
160
  case "ONCE": return u("botlit.stewardApprovals.scope.once", "Once");
@@ -176,35 +176,35 @@ var F = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline
176
176
  onOpenAgent: c,
177
177
  onDecide: async (e, t, n) => {
178
178
  try {
179
- await B(X.id, e, t, n), P.success(e === "APPROVE" ? u("botlit.stewardApprovals.toast.approved", "Approved") : u("botlit.stewardApprovals.toast.denied", "Denied")), await Y();
179
+ await I(X.id, e, t, n), L.success(e === "APPROVE" ? u("botlit.stewardApprovals.toast.approved", "Approved") : u("botlit.stewardApprovals.toast.denied", "Denied")), await Y();
180
180
  } catch (e) {
181
- P.error(e instanceof Error ? e.message : u("botlit.toolApprovals.toast.error", "Could not record the decision"));
181
+ L.error(e instanceof Error ? e.message : u("botlit.toolApprovals.toast.error", "Could not record the decision"));
182
182
  }
183
183
  }
184
184
  }, X.id)
185
185
  })]
186
186
  }),
187
- q && !R.error ? /* @__PURE__ */ D("div", {
187
+ q && !F.error ? /* @__PURE__ */ k("div", {
188
188
  className: "flex justify-center",
189
- children: /* @__PURE__ */ D(n, {
189
+ children: /* @__PURE__ */ k(n, {
190
190
  variant: "outline",
191
191
  size: "sm",
192
- disabled: R.loading || R.loadingMore,
192
+ disabled: F.loading || F.loadingMore,
193
193
  onClick: () => void J(),
194
194
  children: u("botlit.stewardApprovals.loadMore", "Load more")
195
195
  })
196
196
  }) : null
197
197
  ]
198
198
  });
199
- }, z = ({ request: r, busy: i, scopeLabel: a, scopeHint: o, onOpenAgent: l, onDecide: f }) => {
200
- let v = e(), S = r.source === "STEWARD", T = r.status === "PENDING", A = d(r), [P, F] = C(m(r, r.requestedScope)), [I, L] = C(""), R = _(r.argumentsHash), z = u(r.arguments), B = !!r.fixedDefault && A.every((e) => !g(e));
201
- return /* @__PURE__ */ O(E, { children: [
202
- /* @__PURE__ */ O("div", {
199
+ }, H = ({ request: r, busy: i, scopeLabel: a, scopeHint: o, onOpenAgent: l, onDecide: f }) => {
200
+ let v = e(), C = r.source === "STEWARD", D = r.status === "PENDING", N = d(r), [L, R] = T(m(r, r.requestedScope)), [z, B] = T(""), [V, H] = T(!1), U = w(null), W = S(), G = p("DENY", z), K = V && G, q = _(r.argumentsHash), J = u(r.arguments), Y = !!r.fixedDefault && N.every((e) => !g(e));
201
+ return /* @__PURE__ */ A(O, { children: [
202
+ /* @__PURE__ */ A("div", {
203
203
  className: "flex flex-wrap items-start justify-between gap-2",
204
- children: [/* @__PURE__ */ O("h2", {
204
+ children: [/* @__PURE__ */ A("h2", {
205
205
  className: "text-lg font-semibold",
206
206
  children: [
207
- /* @__PURE__ */ D("button", {
207
+ /* @__PURE__ */ k("button", {
208
208
  type: "button",
209
209
  className: "text-primary hover:underline",
210
210
  onClick: () => l(r.agentId),
@@ -212,107 +212,107 @@ var F = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline
212
212
  }),
213
213
  " ",
214
214
  "· ",
215
- /* @__PURE__ */ D("code", {
215
+ /* @__PURE__ */ k("code", {
216
216
  className: "font-mono text-base",
217
217
  children: r.toolName
218
218
  })
219
219
  ]
220
- }), T && /* @__PURE__ */ D(t, {
220
+ }), D && /* @__PURE__ */ k(t, {
221
221
  variant: "warning",
222
222
  children: y(r.expiresAt) === "expired" ? v("botlit.stewardApprovals.expired", "Expired") : `${v("botlit.stewardApprovals.expiresIn", "Expires in")} ${y(r.expiresAt)}`
223
223
  })]
224
224
  }),
225
- r.fixedDefault && /* @__PURE__ */ O("div", {
225
+ r.fixedDefault && /* @__PURE__ */ A("div", {
226
226
  className: "flex items-start gap-2 rounded-md border border-border-subtle bg-bg-sunken p-3 text-sm",
227
227
  "data-testid": "fixed-default-notice",
228
- children: [/* @__PURE__ */ D(j, {
228
+ children: [/* @__PURE__ */ k(P, {
229
229
  size: 16,
230
230
  className: "mt-0.5 shrink-0",
231
231
  "aria-hidden": "true"
232
- }), /* @__PURE__ */ O("p", { children: [
233
- /* @__PURE__ */ O("span", {
232
+ }), /* @__PURE__ */ A("p", { children: [
233
+ /* @__PURE__ */ A("span", {
234
234
  className: "font-medium",
235
235
  children: [h(r.fixedDefault), "."]
236
236
  }),
237
237
  " ",
238
- B ? v("botlit.stewardApprovals.fixedDefault.locked", "This kind of call always goes to a person. It can be approved once or for this run, never as a standing rule.") : v("botlit.stewardApprovals.fixedDefault.exception", "This kind of call always goes to a person. A rule is possible only because it names an exact recipient and purpose.")
238
+ Y ? v("botlit.stewardApprovals.fixedDefault.locked", "This kind of call always goes to a person. It can be approved once or for this run, never as a standing rule.") : v("botlit.stewardApprovals.fixedDefault.exception", "This kind of call always goes to a person. A rule is possible only because it names an exact recipient and purpose.")
239
239
  ] })]
240
240
  }),
241
- S && /* @__PURE__ */ O("div", {
241
+ C && /* @__PURE__ */ A("div", {
242
242
  className: "rounded-md border border-border-subtle bg-bg-sunken p-3 text-sm",
243
243
  children: [
244
- /* @__PURE__ */ O("p", {
244
+ /* @__PURE__ */ A("p", {
245
245
  className: "flex items-center gap-2 font-medium",
246
246
  children: [
247
- /* @__PURE__ */ D(M, {
247
+ /* @__PURE__ */ k(F, {
248
248
  size: 14,
249
249
  "aria-hidden": "true"
250
250
  }),
251
251
  v("botlit.stewardApprovals.reviewer", "Reviewer model note"),
252
- r.reviewerVerdict && /* @__PURE__ */ D(t, {
252
+ r.reviewerVerdict && /* @__PURE__ */ k(t, {
253
253
  variant: "outline",
254
254
  children: r.reviewerVerdict
255
255
  })
256
256
  ]
257
257
  }),
258
- r.charterCitation ? /* @__PURE__ */ O("p", {
258
+ r.charterCitation ? /* @__PURE__ */ A("p", {
259
259
  className: "mt-1 break-words",
260
260
  children: [
261
261
  v("botlit.stewardApprovals.ownerSaid", "Owner said:"),
262
262
  " ",
263
- /* @__PURE__ */ O("em", { children: [
263
+ /* @__PURE__ */ A("em", { children: [
264
264
  "“",
265
265
  r.charterCitation,
266
266
  "”"
267
267
  ] })
268
268
  ]
269
- }) : /* @__PURE__ */ D("p", {
269
+ }) : /* @__PURE__ */ k("p", {
270
270
  className: "mt-1 text-text-secondary",
271
271
  children: v("botlit.stewardApprovals.noCitation", "No verified quote of the owner supports this call.")
272
272
  }),
273
- r.reviewerNote && /* @__PURE__ */ D("p", {
273
+ r.reviewerNote && /* @__PURE__ */ k("p", {
274
274
  className: "mt-1 break-words",
275
275
  children: r.reviewerNote
276
276
  })
277
277
  ]
278
278
  }),
279
- r.purpose && /* @__PURE__ */ O("p", {
279
+ r.purpose && /* @__PURE__ */ A("p", {
280
280
  className: "text-sm",
281
- children: [/* @__PURE__ */ O("span", {
281
+ children: [/* @__PURE__ */ A("span", {
282
282
  className: "text-text-secondary",
283
283
  children: [v("botlit.stewardApprovals.purpose", "Purpose:"), " "]
284
284
  }), r.purpose]
285
285
  }),
286
- /* @__PURE__ */ O("div", { children: [
287
- /* @__PURE__ */ O("p", {
286
+ /* @__PURE__ */ A("div", { children: [
287
+ /* @__PURE__ */ A("p", {
288
288
  className: "mb-1 text-xs text-text-secondary",
289
- children: [v("botlit.stewardApprovals.arguments", "Exact arguments"), S && ` · ${v("botlit.stewardApprovals.argumentsProvenance", "written by the steward model, not verified")}`]
289
+ children: [v("botlit.stewardApprovals.arguments", "Exact arguments"), C && ` · ${v("botlit.stewardApprovals.argumentsProvenance", "written by the steward model, not verified")}`]
290
290
  }),
291
- /* @__PURE__ */ D("dl", {
291
+ /* @__PURE__ */ k("dl", {
292
292
  className: "max-h-48 overflow-auto rounded-md bg-bg-sunken p-2 font-mono text-xs",
293
293
  "data-testid": "steward-approval-arguments",
294
- children: z.length === 0 ? /* @__PURE__ */ D("dd", {
294
+ children: J.length === 0 ? /* @__PURE__ */ k("dd", {
295
295
  className: "text-text-secondary",
296
296
  children: "{}"
297
- }) : z.map((e) => /* @__PURE__ */ O("div", {
297
+ }) : J.map((e) => /* @__PURE__ */ A("div", {
298
298
  className: "flex gap-2",
299
- children: [/* @__PURE__ */ O("dt", {
299
+ children: [/* @__PURE__ */ A("dt", {
300
300
  className: "shrink-0 text-text-secondary",
301
301
  children: [e.key, ":"]
302
- }), /* @__PURE__ */ D("dd", {
302
+ }), /* @__PURE__ */ k("dd", {
303
303
  className: "break-all",
304
304
  children: e.value
305
305
  })]
306
306
  }, e.key))
307
307
  }),
308
- R && /* @__PURE__ */ O("p", {
308
+ q && /* @__PURE__ */ A("p", {
309
309
  className: "mt-1 text-xs text-text-secondary",
310
310
  children: [
311
311
  v("botlit.stewardApprovals.hash", "Argument hash"),
312
312
  " ",
313
- /* @__PURE__ */ D("code", {
313
+ /* @__PURE__ */ k("code", {
314
314
  className: "font-mono",
315
- children: R
315
+ children: q
316
316
  }),
317
317
  " ·",
318
318
  " ",
@@ -320,82 +320,102 @@ var F = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline
320
320
  ]
321
321
  })
322
322
  ] }),
323
- !T && /* @__PURE__ */ O("div", {
323
+ !D && /* @__PURE__ */ A("div", {
324
324
  className: "space-y-1 text-sm",
325
325
  "data-testid": "steward-approval-outcome",
326
326
  children: [
327
- /* @__PURE__ */ O("p", { children: [
328
- /* @__PURE__ */ D(t, {
327
+ /* @__PURE__ */ A("p", { children: [
328
+ /* @__PURE__ */ k(t, {
329
329
  variant: r.status === "APPROVED" ? "success" : "outline",
330
330
  children: r.status
331
331
  }),
332
332
  " ",
333
333
  r.grantedScope && `${v("botlit.stewardApprovals.grantedScope", "Scope")}: ${a(r.grantedScope)}`
334
334
  ] }),
335
- r.decisionNote && /* @__PURE__ */ D("p", {
335
+ r.decisionNote && /* @__PURE__ */ k("p", {
336
336
  className: "break-words",
337
337
  children: r.decisionNote
338
338
  }),
339
- r.createdRuleId && /* @__PURE__ */ D("p", {
339
+ r.createdRuleId && /* @__PURE__ */ k("p", {
340
340
  className: "text-text-secondary",
341
341
  children: v("botlit.stewardApprovals.ruleCreated", "A standing rule was created from this approval.")
342
342
  })
343
343
  ]
344
344
  }),
345
- T && /* @__PURE__ */ D(x, {
345
+ D && /* @__PURE__ */ k(x, {
346
346
  permission: b.AGENT_APPROVE,
347
- fallback: /* @__PURE__ */ D("p", {
347
+ fallback: /* @__PURE__ */ k("p", {
348
348
  className: "text-sm text-text-secondary",
349
349
  "data-testid": "approve-forbidden",
350
350
  children: v("botlit.stewardApprovals.forbidden", "You can see this request but you do not have permission to decide it.")
351
351
  }),
352
- children: /* @__PURE__ */ O("div", {
352
+ children: /* @__PURE__ */ A("div", {
353
353
  className: "space-y-4",
354
354
  children: [
355
- S && /* @__PURE__ */ O("fieldset", {
355
+ C && /* @__PURE__ */ A("fieldset", {
356
356
  className: "space-y-2",
357
- children: [/* @__PURE__ */ D("legend", {
357
+ children: [/* @__PURE__ */ k("legend", {
358
358
  className: "mb-1 text-xs text-text-secondary",
359
359
  children: v("botlit.stewardApprovals.approveFor", "Approve for")
360
- }), c.filter((e) => A.includes(e)).map((e) => /* @__PURE__ */ O("label", {
361
- className: s("flex cursor-pointer items-start gap-3 rounded-md border p-2 text-sm", P === e ? "border-primary" : "border-border-subtle"),
362
- children: [/* @__PURE__ */ D("input", {
360
+ }), c.filter((e) => N.includes(e)).map((e) => /* @__PURE__ */ A("label", {
361
+ className: s("flex cursor-pointer items-start gap-3 rounded-md border p-2 text-sm", L === e ? "border-primary" : "border-border-subtle"),
362
+ children: [/* @__PURE__ */ k("input", {
363
363
  type: "radio",
364
364
  name: `scope-${r.id}`,
365
365
  className: "mt-1 shrink-0 accent-primary",
366
- checked: P === e,
367
- onChange: () => F(e)
368
- }), /* @__PURE__ */ O("span", { children: [/* @__PURE__ */ D("span", {
366
+ checked: L === e,
367
+ onChange: () => R(e)
368
+ }), /* @__PURE__ */ A("span", { children: [/* @__PURE__ */ k("span", {
369
369
  className: "font-medium",
370
370
  children: a(e)
371
- }), /* @__PURE__ */ D("span", {
371
+ }), /* @__PURE__ */ k("span", {
372
372
  className: "block text-xs text-text-secondary",
373
373
  children: o(e)
374
374
  })] })]
375
375
  }, e))]
376
376
  }),
377
- /* @__PURE__ */ D(w, {
378
- "aria-label": v("botlit.stewardApprovals.denyNote", "Deny note (required to deny)"),
379
- value: I,
380
- maxLength: 2e3,
381
- onChange: (e) => L(e.target.value),
382
- placeholder: v("botlit.stewardApprovals.denyPlaceholder", "Why is this denied?"),
383
- rows: 2
377
+ /* @__PURE__ */ A("div", {
378
+ className: "space-y-1.5",
379
+ children: [/* @__PURE__ */ k(E, {
380
+ ref: U,
381
+ "aria-label": v("botlit.stewardApprovals.denyNote", "Deny note (required to deny)"),
382
+ "aria-describedby": G ? W : void 0,
383
+ "aria-invalid": K || void 0,
384
+ value: z,
385
+ maxLength: 2e3,
386
+ onChange: (e) => {
387
+ B(e.target.value), p("DENY", e.target.value) || H(!1);
388
+ },
389
+ placeholder: v("botlit.stewardApprovals.denyPlaceholder", "Why is this denied?"),
390
+ rows: 2
391
+ }), G && /* @__PURE__ */ A("p", {
392
+ id: W,
393
+ "data-testid": "deny-note-hint",
394
+ "data-state": K ? "error" : "hint",
395
+ className: s("flex items-start gap-1.5 text-xs", K ? "rounded-md border border-status-warning-border bg-status-warning-bg-subtle px-2 py-1.5 font-medium text-status-warning-text" : "text-status-warning-text"),
396
+ children: [/* @__PURE__ */ k(j, {
397
+ size: 14,
398
+ className: "mt-px shrink-0",
399
+ "aria-hidden": "true"
400
+ }), v("botlit.stewardApprovals.denyNoteHint", "Add a reason to deny this request.")]
401
+ })]
384
402
  }),
385
- /* @__PURE__ */ O("div", {
403
+ /* @__PURE__ */ A("div", {
386
404
  className: "flex justify-end gap-2",
387
- children: [/* @__PURE__ */ D(n, {
405
+ children: [/* @__PURE__ */ k(n, {
388
406
  variant: "destructive",
389
- leftIcon: /* @__PURE__ */ D(N, { size: 14 }),
390
- disabled: i || p("DENY", I),
391
- title: p("DENY", I) ? v("botlit.stewardApprovals.denyNeedsNote", "Add a reason to deny") : void 0,
392
- onClick: () => void f("DENY", I, void 0),
407
+ leftIcon: /* @__PURE__ */ k(I, { size: 14 }),
408
+ disabled: i,
409
+ "aria-describedby": G ? W : void 0,
410
+ onClick: () => {
411
+ p("DENY", z) ? (H(!0), U.current?.focus()) : f("DENY", z, void 0);
412
+ },
393
413
  children: v("botlit.toolApprovals.deny", "Deny")
394
- }), /* @__PURE__ */ D(n, {
395
- leftIcon: /* @__PURE__ */ D(k, { size: 14 }),
414
+ }), /* @__PURE__ */ k(n, {
415
+ leftIcon: /* @__PURE__ */ k(M, { size: 14 }),
396
416
  isLoading: i,
397
- onClick: () => void f("APPROVE", I, S ? P : void 0),
398
- children: S ? `${v("botlit.toolApprovals.approve", "Approve")} — ${a(P).toLowerCase()}` : v("botlit.toolApprovals.approve", "Approve")
417
+ onClick: () => void f("APPROVE", z, C ? L : void 0),
418
+ children: C ? `${v("botlit.toolApprovals.approve", "Approve")} — ${a(L).toLowerCase()}` : v("botlit.toolApprovals.approve", "Approve")
399
419
  })]
400
420
  })
401
421
  ]
@@ -403,6 +423,6 @@ var F = "rounded-full border px-3 py-1 text-xs font-medium focus-visible:outline
403
423
  })
404
424
  ] });
405
425
  };
406
- export { R as StewardApprovalsInbox };
426
+ export { V as StewardApprovalsInbox };
407
427
 
408
428
  //# sourceMappingURL=StewardApprovalsInbox.js.map