@declarion/react 0.445.0 → 0.516.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.
Files changed (43) hide show
  1. package/dist-lib/components/agents/AgentChatPanel.impl.js +349 -332
  2. package/dist-lib/components/detail-layout/DetailAuditStrip.js +1 -1
  3. package/dist-lib/components/detail-layout/EvidenceBlock.js +36 -24
  4. package/dist-lib/components/detail-layout/FieldRow.js +56 -60
  5. package/dist-lib/components/detail-layout/FieldsBlock.js +48 -47
  6. package/dist-lib/components/detail-layout/PropertiesBlock.js +42 -41
  7. package/dist-lib/components/detail-layout/labelLayout.js +35 -0
  8. package/dist-lib/components/fields/JsonField.js +128 -125
  9. package/dist-lib/components/fields/StringField.js +10 -25
  10. package/dist-lib/components/fields/StructureField.js +125 -167
  11. package/dist-lib/components/fields/ValueRows.js +114 -0
  12. package/dist-lib/components/fields/cells/factories/id.js +10 -0
  13. package/dist-lib/components/fields/cells/factories/nextRun.js +18 -27
  14. package/dist-lib/components/fields/cells/factories/refLink.js +15 -41
  15. package/dist-lib/components/fields/cells/registry.js +25 -23
  16. package/dist-lib/components/file-widgets/DocumentCard.js +142 -142
  17. package/dist-lib/components/file-widgets/helpers.js +32 -19
  18. package/dist-lib/components/file-widgets/host.js +4 -1
  19. package/dist-lib/components/list/PeekFieldCell.js +57 -55
  20. package/dist-lib/components/list/QuickPeek.js +109 -121
  21. package/dist-lib/components/pages/SmartDetailPage.impl.js +403 -400
  22. package/dist-lib/components/pages/SmartListPage.impl.js +260 -260
  23. package/dist-lib/components/pages/list/ListCardRow.js +101 -100
  24. package/dist-lib/components/pages/list/cardProjection.js +117 -112
  25. package/dist-lib/components/pages/list/useListQuery.js +1 -1
  26. package/dist-lib/components/pages/list/useListRowInteraction.js +68 -65
  27. package/dist-lib/components/primitives/IdBadge.js +27 -0
  28. package/dist-lib/components/primitives/RowField.js +11 -43
  29. package/dist-lib/components/shared/CopyButton.js +13 -18
  30. package/dist-lib/components/shared/RefChip.js +33 -0
  31. package/dist-lib/declarion-react.css +1 -1
  32. package/dist-lib/hooks/useAgentConversation.js +134 -110
  33. package/dist-lib/hooks/useCopy.js +18 -0
  34. package/dist-lib/index.d.ts +55 -20
  35. package/dist-lib/index.js +116 -111
  36. package/dist-lib/lib/realtime-reconcile.js +70 -59
  37. package/dist-lib/lib/reference.js +52 -34
  38. package/dist-lib/lib/short-id.js +12 -0
  39. package/dist-lib/testing.d.ts +1 -1
  40. package/dist-lib/types/schema.js +84 -80
  41. package/dist-lib/{useResponsiveMode-3hOLBkey.d.ts → useResponsiveMode-BObVfNyN.d.ts} +7 -2
  42. package/package.json +1 -1
  43. package/dist-lib/components/primitives/RecordIdBadge.js +0 -25
@@ -15,81 +15,85 @@ import { useText as f } from "../../hooks/useText.js";
15
15
  import { useTabNavigate as p } from "../../hooks/useTabNavigate.js";
16
16
  import { screenTitleForPath as m } from "../../types/schema.js";
17
17
  import { useEntity as h } from "../../hooks/useEntity.js";
18
- import { failureTitle as te } from "../../lib/failure.js";
19
- import { formatOffsetTimestamp as g } from "../../lib/timestamp.js";
20
- import { pluralText as _, textWithNodes as v } from "../../lib/language.js";
21
- import { useFileSelection as ne } from "../file-widgets/useFileSelection.js";
22
- import { ComposerAttachments as y, MessageAttachments as b, replyFilesVisible as x } from "./ChatAttachments.js";
23
- import { cloneElement as re, isValidElement as S, useEffect as C, useRef as w, useState as T } from "react";
24
- import { jsx as E, jsxs as D } from "react/jsx-runtime";
25
- import { useLocation as ie } from "react-router";
26
- import ae from "react-textarea-autosize";
18
+ import { failureTitle as g } from "../../lib/failure.js";
19
+ import { formatOffsetTimestamp as _ } from "../../lib/timestamp.js";
20
+ import { pluralText as v, textWithNodes as y } from "../../lib/language.js";
21
+ import { useFileSelection as te } from "../file-widgets/useFileSelection.js";
22
+ import { ComposerAttachments as b, MessageAttachments as x, replyFilesVisible as S } from "./ChatAttachments.js";
23
+ import { cloneElement as C, isValidElement as ne, useEffect as w, useRef as T, useState as E } from "react";
24
+ import { jsx as D, jsxs as O } from "react/jsx-runtime";
25
+ import { useLocation as re } from "react-router";
26
+ import ie from "react-textarea-autosize";
27
27
  // src/components/agents/AgentChatPanel.impl.tsx
28
- var oe = 80, se = "/errors/";
29
- function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, docked: g = !1, agentCode: _ }) {
30
- let b = a(void 0, _);
31
- s(b.conversationId);
32
- let x = f(), { pathname: re } = ie(), { data: S } = u(), se = d ? m(x, re, S?.screens, S?.entities)?.title : void 0, ce = f("errors"), [O, A] = T(""), [j, M] = T(null), N = w(null), [P, F] = T(!1), I = w(null), L = ne({
28
+ var ae = 80, k = "/errors/";
29
+ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, docked: _ = !1, agentCode: v, conversationScope: x }) {
30
+ let S = a(void 0, v, x);
31
+ s(S.conversationId);
32
+ let C = f(), { pathname: ne } = re(), { data: k } = u(), oe = d ? m(C, ne, k?.screens, k?.entities)?.title : void 0, se = f("errors"), [j, M] = E(""), [fe, pe] = E(null), N = T(null), [ge, P] = E(!1), F = T(null), I = te({
33
33
  entityCode: "agent_message",
34
34
  fieldCode: "attachments"
35
- }), R = w(null), z = w(null), B = w(!0), [V, H] = T(!1), U = () => {
36
- let e = z.current;
35
+ }), L = T(null), R = T(null), z = T(!0), [B, V] = E(!1), ve = () => {
36
+ let e = R.current;
37
37
  if (!e) return;
38
- let t = e.scrollHeight - e.scrollTop - e.clientHeight <= oe;
39
- B.current = t, t && V && H(!1);
40
- }, W = (e = "smooth") => {
41
- let t = z.current;
38
+ let t = e.scrollHeight - e.scrollTop - e.clientHeight <= ae;
39
+ z.current = t, t && B && V(!1);
40
+ }, H = (e = "smooth") => {
41
+ let t = R.current;
42
42
  t && (t.scrollTo({
43
43
  top: t.scrollHeight,
44
44
  behavior: e
45
- }), B.current = !0, H(!1));
46
- }, G = b.openedConversation?.id, ge = o((e) => e.user?.id), K = b.openedConversation?.user_id, q = !!K && K !== ge, J = w(!0);
47
- C(() => {
48
- J.current = !0;
49
- }, [n, G]), C(() => {
50
- if (J.current && G && b.messages.length > 0) {
51
- let e = requestAnimationFrame(() => W("instant"));
45
+ }), z.current = !0, V(!1));
46
+ }, U = S.openedConversation?.id, W = o((e) => e.user?.id), G = S.openedConversation?.user_id, K = !!G && G !== W, q = T(!0);
47
+ w(() => {
48
+ q.current = !0;
49
+ }, [n, U]), w(() => {
50
+ if (q.current && U && S.messages.length > 0) {
51
+ let e = requestAnimationFrame(() => H("instant"));
52
52
  return () => cancelAnimationFrame(e);
53
53
  }
54
- B.current ? W("smooth") : H(!0);
55
- }, [b.messages, G]);
56
- let _e = () => {
57
- J.current = !0, requestAnimationFrame(() => W("instant"));
54
+ z.current ? H("smooth") : V(!0);
55
+ }, [S.messages, U]);
56
+ let J = () => {
57
+ q.current = !0, requestAnimationFrame(() => H("instant"));
58
58
  }, Y = () => {
59
- J.current = !1;
60
- }, X = w(null);
61
- if (C(() => {
59
+ q.current = !1;
60
+ }, X = T(null);
61
+ if (w(() => {
62
62
  let e = X.current;
63
63
  if (!e || typeof ResizeObserver > "u") return;
64
64
  let t = new ResizeObserver(() => {
65
- J.current && W("instant");
65
+ q.current && H("instant");
66
66
  });
67
67
  return t.observe(e), () => t.disconnect();
68
- }, []), C(() => {
69
- n && W("instant");
70
- }, [n]), C(() => {
68
+ }, []), w(() => {
69
+ n && H("instant");
70
+ }, [n]), w(() => {
71
71
  let e = h?.trim();
72
- n && e && N.current !== e && (N.current = e, I.current?.(e));
73
- }, [n, h]), !n) return null;
72
+ n && e && N.current !== e && S.agentLookup === "found" && (N.current = e, F.current?.(e));
73
+ }, [
74
+ n,
75
+ h,
76
+ S.agentLookup
77
+ ]), !n) return null;
74
78
  let Z = async (e) => {
75
- let t = L.readyFiles, n = L.selections.filter((e) => e.state === "ready").map((e) => e.localId);
76
- if ((e.trim() || t.length !== 0) && L.settled) {
77
- M(null), A("");
79
+ let t = I.readyFiles, n = I.selections.filter((e) => e.state === "ready").map((e) => e.localId);
80
+ if ((e.trim() || t.length !== 0) && I.settled) {
81
+ pe(null), M("");
78
82
  try {
79
- await b.send(e, d, t), L.release(n);
83
+ await S.send(e, d, t), I.release(n);
80
84
  } catch (t) {
81
- console.error("agent send failed", t), M(te(ce, t)), A(e);
85
+ console.error("agent send failed", t), pe(g(se, t)), M(e);
82
86
  }
83
87
  }
84
88
  };
85
- I.current = Z;
86
- let ve = (e) => {
87
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Z(O));
88
- }, be = b.invocations.filter((e) => e.status === "pending_approval"), Q = b.invocations.filter((e) => e.kind === "input_request" && e.status === "pending_input"), Se = b.turns.filter((e) => e.status === "queued" || e.status === "running" || e.status === "waiting" || e.status === "failed"), Ce = b.invocations.filter((e) => e.status === "outcome_unknown"), we = b.messages.length === 0 && !b.turn.streaming, Te = be.length > 0 || Q.length > 0, Ee = b.turn.streaming && !Te || b.turns.some((e) => e.status === "running"), De = b.messages.some((e) => e.role === "assistant" && e.streaming && e.content.length > 0), $ = (O.trim().length > 0 || L.readyFiles.length > 0) && L.settled;
89
- return /* @__PURE__ */ D("aside", {
90
- "aria-label": x("shell.ai_assistant", "AI Assistant"),
89
+ F.current = Z;
90
+ let be = (e) => {
91
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Z(j));
92
+ }, Q = S.invocations.filter((e) => e.status === "pending_approval"), Se = S.invocations.filter((e) => e.kind === "input_request" && e.status === "pending_input"), Ce = S.turns.filter((e) => e.status === "queued" || e.status === "running" || e.status === "waiting" || e.status === "failed"), we = S.invocations.filter((e) => e.status === "outcome_unknown"), Te = S.messages.length === 0 && !S.turn.streaming, Ee = Q.length > 0 || Se.length > 0, De = S.turn.streaming && !Ee || S.turns.some((e) => e.status === "running"), Oe = S.messages.some((e) => e.role === "assistant" && e.streaming && e.content.length > 0), $ = (j.trim().length > 0 || I.readyFiles.length > 0) && I.settled && S.agentLookup === "found";
93
+ return /* @__PURE__ */ O("aside", {
94
+ "aria-label": C("shell.ai_assistant", "AI Assistant"),
91
95
  style: {
92
- ...g ? {
96
+ ..._ ? {
93
97
  gridArea: "assistant",
94
98
  minWidth: 0,
95
99
  minHeight: 0
@@ -108,7 +112,7 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
108
112
  flexDirection: "column"
109
113
  },
110
114
  children: [
111
- /* @__PURE__ */ D("div", {
115
+ /* @__PURE__ */ O("div", {
112
116
  style: {
113
117
  display: "flex",
114
118
  alignItems: "center",
@@ -117,7 +121,7 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
117
121
  borderBottom: "1px solid var(--divider)"
118
122
  },
119
123
  children: [
120
- /* @__PURE__ */ E("span", {
124
+ /* @__PURE__ */ D("span", {
121
125
  style: {
122
126
  width: 22,
123
127
  height: 22,
@@ -127,22 +131,22 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
127
131
  alignItems: "center",
128
132
  justifyContent: "center"
129
133
  },
130
- children: /* @__PURE__ */ E(e.sparkle, {
134
+ children: /* @__PURE__ */ D(e.sparkle, {
131
135
  size: 13,
132
136
  style: { color: "var(--accent-foreground)" }
133
137
  })
134
138
  }),
135
- /* @__PURE__ */ D("div", {
139
+ /* @__PURE__ */ O("div", {
136
140
  style: { flex: 1 },
137
- children: [/* @__PURE__ */ E("div", {
141
+ children: [/* @__PURE__ */ D("div", {
138
142
  "data-conversation-agent": !0,
139
143
  style: {
140
144
  fontSize: 12.5,
141
145
  fontWeight: 600,
142
146
  color: "var(--text)"
143
147
  },
144
- children: b.openedConversation && me(x, b.openedConversation) || p
145
- }), /* @__PURE__ */ D("div", {
148
+ children: S.openedConversation && he(C, S.openedConversation) || p
149
+ }), /* @__PURE__ */ O("div", {
146
150
  style: {
147
151
  fontSize: 10.5,
148
152
  color: "var(--text-3)",
@@ -150,65 +154,65 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
150
154
  alignItems: "center",
151
155
  gap: 4
152
156
  },
153
- children: [/* @__PURE__ */ E("span", { style: {
157
+ children: [/* @__PURE__ */ D("span", { style: {
154
158
  width: 5,
155
159
  height: 5,
156
160
  background: "var(--success)",
157
161
  borderRadius: 999
158
- } }), v(x("agent.panel.context", "context: {context}"), { context: /* @__PURE__ */ E("span", { children: se || x("agent.panel.context_platform", "Platform") }) })]
162
+ } }), y(C("agent.panel.context", "context: {context}"), { context: /* @__PURE__ */ D("span", { children: oe || C("agent.panel.context_platform", "Platform") }) })]
159
163
  })]
160
164
  }),
161
- b.messages.length > 0 && /* @__PURE__ */ E(t, {
165
+ S.messages.length > 0 && /* @__PURE__ */ D(t, {
162
166
  size: 24,
163
- icon: /* @__PURE__ */ E(e.copy, { size: 12 }),
164
- onClick: () => void ye(x, b.messages),
165
- title: x("agent.panel.copy_all", "Copy entire conversation")
167
+ icon: /* @__PURE__ */ D(e.copy, { size: 12 }),
168
+ onClick: () => void ye(C, S.messages),
169
+ title: C("agent.panel.copy_all", "Copy entire conversation")
166
170
  }),
167
- /* @__PURE__ */ E(t, {
171
+ /* @__PURE__ */ D(t, {
168
172
  size: 24,
169
- icon: /* @__PURE__ */ E(e.clock, { size: 12 }),
173
+ icon: /* @__PURE__ */ D(e.clock, { size: 12 }),
170
174
  onClick: () => {
171
- F((e) => !e), b.refreshConversations();
175
+ P((e) => !e), S.refreshConversations();
172
176
  },
173
- title: x("agent.panel.earlier", "Earlier conversations")
177
+ title: C("agent.panel.earlier", "Earlier conversations")
174
178
  }),
175
- b.conversationId && /* @__PURE__ */ E(t, {
179
+ S.conversationId && /* @__PURE__ */ D(t, {
176
180
  size: 24,
177
- icon: /* @__PURE__ */ E(e.plus, { size: 12 }),
178
- onClick: b.startNew,
179
- title: x("agent.panel.new_conversation", "New conversation")
181
+ icon: /* @__PURE__ */ D(e.plus, { size: 12 }),
182
+ onClick: S.startNew,
183
+ title: C("agent.panel.new_conversation", "New conversation")
180
184
  }),
181
- /* @__PURE__ */ E(t, {
185
+ /* @__PURE__ */ D(t, {
182
186
  size: 24,
183
- icon: /* @__PURE__ */ E(e.settings, { size: 12 }),
184
- title: x("agent.panel.preferences", "Preferences")
187
+ icon: /* @__PURE__ */ D(e.settings, { size: 12 }),
188
+ title: C("agent.panel.preferences", "Preferences")
185
189
  }),
186
- /* @__PURE__ */ E(t, {
190
+ /* @__PURE__ */ D(t, {
187
191
  size: 24,
188
- icon: /* @__PURE__ */ E(e.x, { size: 13 }),
192
+ icon: /* @__PURE__ */ D(e.x, { size: 13 }),
189
193
  onClick: i,
190
- title: x("agent.panel.close", "Close")
194
+ title: C("agent.panel.close", "Close")
191
195
  })
192
196
  ]
193
197
  }),
194
- !b.conversationId && /* @__PURE__ */ E(ee, {
195
- agents: b.agents,
196
- selectedId: b.selectedAgentId,
197
- onSelect: b.selectAgent,
198
- label: x("agent.panel.agent", "Agent")
198
+ !S.conversationId && /* @__PURE__ */ D(ee, {
199
+ agents: S.agents,
200
+ selectedId: S.selectedAgentId,
201
+ onSelect: S.selectAgent,
202
+ label: C("agent.panel.agent", "Agent")
199
203
  }),
200
- P && /* @__PURE__ */ E(pe, {
201
- conversations: b.conversations,
202
- hasMore: b.moreConversations,
203
- onShowMore: () => void b.showMoreConversations(),
204
- currentId: b.conversationId,
204
+ ge && /* @__PURE__ */ D(me, {
205
+ conversations: S.conversations,
206
+ hasMore: S.moreConversations,
207
+ onShowMore: () => void S.showMoreConversations(),
208
+ currentId: S.conversationId,
205
209
  onPick: (e) => {
206
- b.setConversationId(e), F(!1), _e();
210
+ S.setConversationId(e), P(!1), J();
207
211
  }
208
212
  }),
209
- /* @__PURE__ */ E("div", {
210
- ref: z,
211
- onScroll: U,
213
+ /* @__PURE__ */ D("div", {
214
+ ref: R,
215
+ onScroll: ve,
212
216
  onWheel: Y,
213
217
  onTouchMove: Y,
214
218
  onKeyDown: Y,
@@ -218,7 +222,7 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
218
222
  padding: "12px 14px",
219
223
  position: "relative"
220
224
  },
221
- children: /* @__PURE__ */ D("div", {
225
+ children: /* @__PURE__ */ O("div", {
222
226
  ref: X,
223
227
  style: {
224
228
  display: "flex",
@@ -226,26 +230,26 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
226
230
  gap: 12
227
231
  },
228
232
  children: [
229
- we && /* @__PURE__ */ E(k, { children: x("agent.panel.intro", "Hi — I can answer questions about your data, suggest actions, draft YAML definitions, and run allowed tools within your permissions. What would you like to do?") }),
230
- l(b.messages, b.invocations).map((e) => e.kind === "message" ? /* @__PURE__ */ E(he, {
233
+ Te && /* @__PURE__ */ D(A, { children: C("agent.panel.intro", "Hi — I can answer questions about your data, suggest actions, draft YAML definitions, and run allowed tools within your permissions. What would you like to do?") }),
234
+ l(S.messages, S.invocations).map((e) => e.kind === "message" ? /* @__PURE__ */ D(_e, {
231
235
  message: e.message,
232
236
  delivered: e.delivered,
233
237
  showsPlace: e.showsPlace,
234
- turns: b.turns
235
- }, e.message.id) : /* @__PURE__ */ E(fe, { run: e }, e.id)),
236
- Se.map((e) => /* @__PURE__ */ E(le, { agentTurn: e }, e.id)),
237
- be.map((e) => /* @__PURE__ */ E(xe, {
238
+ turns: S.turns
239
+ }, e.message.id) : /* @__PURE__ */ D(de, { run: e }, e.id)),
240
+ Ce.map((e) => /* @__PURE__ */ D(ce, { agentTurn: e }, e.id)),
241
+ Q.map((e) => /* @__PURE__ */ D(xe, {
238
242
  tool: e,
239
- onApprove: async (t) => b.approve(e.id, t),
240
- onReject: async (t) => b.reject(e.id, t)
243
+ onApprove: async (t) => S.approve(e.id, t),
244
+ onReject: async (t) => S.reject(e.id, t)
241
245
  }, e.id)),
242
- Q.map((e) => /* @__PURE__ */ E(c, {
243
- ...ue(x, e),
244
- onSubmit: (t) => void b.submitInput(e.id, t),
245
- onCancel: () => void b.cancelInput(e.id)
246
+ Se.map((e) => /* @__PURE__ */ D(c, {
247
+ ...le(C, e),
248
+ onSubmit: (t) => void S.submitInput(e.id, t),
249
+ onCancel: () => void S.cancelInput(e.id)
246
250
  }, e.id)),
247
- Ce.map((e) => /* @__PURE__ */ E(de, { invocation: e }, e.id)),
248
- Ee && !De && /* @__PURE__ */ D("div", {
251
+ we.map((e) => /* @__PURE__ */ D(ue, { invocation: e }, e.id)),
252
+ De && !Oe && /* @__PURE__ */ O("div", {
249
253
  style: {
250
254
  display: "flex",
251
255
  gap: 6,
@@ -253,9 +257,22 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
253
257
  color: "var(--text-3)",
254
258
  fontSize: 11.5
255
259
  },
256
- children: [/* @__PURE__ */ E(r, { size: 12 }), x("agent.panel.thinking", "Thinking…")]
260
+ children: [/* @__PURE__ */ D(r, { size: 12 }), C("agent.panel.thinking", "Thinking…")]
261
+ }),
262
+ fe && /* @__PURE__ */ D("div", {
263
+ style: {
264
+ padding: "8px 10px",
265
+ background: "var(--surface-2)",
266
+ border: "1px solid var(--border)",
267
+ borderRadius: "var(--radius-md)",
268
+ fontSize: 11.5,
269
+ color: "var(--text-2)"
270
+ },
271
+ children: /* @__PURE__ */ D("strong", { children: fe })
257
272
  }),
258
- j && /* @__PURE__ */ E("div", {
273
+ S.agentLookup === "missing" && /* @__PURE__ */ D("div", {
274
+ role: "alert",
275
+ "data-testid": "agent-missing",
259
276
  style: {
260
277
  padding: "8px 10px",
261
278
  background: "var(--surface-2)",
@@ -264,13 +281,13 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
264
281
  fontSize: 11.5,
265
282
  color: "var(--text-2)"
266
283
  },
267
- children: /* @__PURE__ */ E("strong", { children: j })
284
+ children: C("agent.panel.agent_missing", "This assistant is not available to you here. Ask an administrator to enable it.")
268
285
  })
269
286
  ]
270
287
  })
271
288
  }),
272
- V && /* @__PURE__ */ D("button", {
273
- onClick: () => W("smooth"),
289
+ B && /* @__PURE__ */ O("button", {
290
+ onClick: () => H("smooth"),
274
291
  style: {
275
292
  position: "absolute",
276
293
  right: 16,
@@ -289,9 +306,9 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
289
306
  gap: 4,
290
307
  zIndex: 1
291
308
  },
292
- children: [/* @__PURE__ */ E(e.arrowDown, { size: 11 }), x("agent.panel.jump_latest", "Jump to latest")]
309
+ children: [/* @__PURE__ */ D(e.arrowDown, { size: 11 }), C("agent.panel.jump_latest", "Jump to latest")]
293
310
  }),
294
- q ? /* @__PURE__ */ E("div", {
311
+ K ? /* @__PURE__ */ D("div", {
295
312
  role: "note",
296
313
  "data-testid": "agent-chat-not-yours",
297
314
  style: {
@@ -301,29 +318,29 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
301
318
  fontSize: 11.5,
302
319
  color: "var(--text-3)"
303
320
  },
304
- children: x("agent.panel.not_yours", "This conversation belongs to another person, so it is read-only here.")
305
- }) : /* @__PURE__ */ D("div", {
321
+ children: C("agent.panel.not_yours", "This conversation belongs to another person, so it is read-only here.")
322
+ }) : /* @__PURE__ */ O("div", {
306
323
  style: {
307
324
  padding: 10,
308
325
  borderTop: "1px solid var(--divider)",
309
326
  background: "var(--surface-2)"
310
327
  },
311
328
  children: [
312
- /* @__PURE__ */ E(y, {
313
- selections: L.selections,
314
- onCancel: L.cancel,
315
- onRemove: L.remove
329
+ /* @__PURE__ */ D(b, {
330
+ selections: I.selections,
331
+ onCancel: I.cancel,
332
+ onRemove: I.remove
316
333
  }),
317
- L.failed && /* @__PURE__ */ E("div", {
334
+ I.failed && /* @__PURE__ */ D("div", {
318
335
  role: "status",
319
336
  style: {
320
337
  fontSize: 11,
321
338
  color: "var(--destructive)",
322
339
  paddingBottom: 6
323
340
  },
324
- children: x("agent.panel.remove_failed_files", "Remove the files that failed to upload to send the message.")
341
+ children: C("agent.panel.remove_failed_files", "Remove the files that failed to upload to send the message.")
325
342
  }),
326
- /* @__PURE__ */ D("div", {
343
+ /* @__PURE__ */ O("div", {
327
344
  style: {
328
345
  display: "flex",
329
346
  alignItems: "flex-end",
@@ -334,11 +351,11 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
334
351
  borderRadius: "var(--radius-md)"
335
352
  },
336
353
  children: [
337
- /* @__PURE__ */ E(ae, {
338
- value: O,
339
- onChange: (e) => A(e.target.value),
340
- onKeyDown: ve,
341
- placeholder: x("agent.panel.ask_placeholder", "Ask or describe what you want…"),
354
+ /* @__PURE__ */ D(ie, {
355
+ value: j,
356
+ onChange: (e) => M(e.target.value),
357
+ onKeyDown: be,
358
+ placeholder: C("agent.panel.ask_placeholder", "Ask or describe what you want…"),
342
359
  minRows: 1,
343
360
  maxRows: 8,
344
361
  style: {
@@ -354,26 +371,26 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
354
371
  fontFamily: "inherit"
355
372
  }
356
373
  }),
357
- /* @__PURE__ */ E("input", {
358
- ref: R,
374
+ /* @__PURE__ */ D("input", {
375
+ ref: L,
359
376
  type: "file",
360
377
  multiple: !0,
361
378
  hidden: !0,
362
379
  "data-testid": "agent-chat-file-input",
363
380
  onChange: (e) => {
364
- e.target.files && L.add(e.target.files), e.target.value = "";
381
+ e.target.files && I.add(e.target.files), e.target.value = "";
365
382
  }
366
383
  }),
367
- /* @__PURE__ */ E(t, {
384
+ /* @__PURE__ */ D(t, {
368
385
  size: 26,
369
- icon: /* @__PURE__ */ E(e.paperclip, { size: 12 }),
370
- onClick: () => R.current?.click(),
371
- title: x("agent.panel.attach_files", "Attach files")
386
+ icon: /* @__PURE__ */ D(e.paperclip, { size: 12 }),
387
+ onClick: () => L.current?.click(),
388
+ title: C("agent.panel.attach_files", "Attach files")
372
389
  }),
373
- Ee ? /* @__PURE__ */ E("button", {
374
- onClick: () => void b.cancel(),
375
- "aria-label": x("agent.panel.stop", "Stop generating"),
376
- title: x("agent.panel.stop", "Stop generating"),
390
+ De ? /* @__PURE__ */ D("button", {
391
+ onClick: () => void S.cancel(),
392
+ "aria-label": C("agent.panel.stop", "Stop generating"),
393
+ title: C("agent.panel.stop", "Stop generating"),
377
394
  style: {
378
395
  width: 26,
379
396
  height: 26,
@@ -386,11 +403,11 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
386
403
  alignItems: "center",
387
404
  justifyContent: "center"
388
405
  },
389
- children: /* @__PURE__ */ E(e.x, { size: 13 })
390
- }) : /* @__PURE__ */ E("button", {
391
- onClick: () => void Z(O),
406
+ children: /* @__PURE__ */ D(e.x, { size: 13 })
407
+ }) : /* @__PURE__ */ D("button", {
408
+ onClick: () => void Z(j),
392
409
  disabled: !$,
393
- "aria-label": x("agent.panel.send", "Send"),
410
+ "aria-label": C("agent.panel.send", "Send"),
394
411
  style: {
395
412
  width: 26,
396
413
  height: 26,
@@ -403,11 +420,11 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
403
420
  alignItems: "center",
404
421
  justifyContent: "center"
405
422
  },
406
- children: /* @__PURE__ */ E(e.arrowUp, { size: 13 })
423
+ children: /* @__PURE__ */ D(e.arrowUp, { size: 13 })
407
424
  })
408
425
  ]
409
426
  }),
410
- /* @__PURE__ */ D("div", {
427
+ /* @__PURE__ */ O("div", {
411
428
  style: {
412
429
  display: "flex",
413
430
  alignItems: "center",
@@ -416,15 +433,15 @@ function ce({ open: n, onClose: i, context: d, title: p = "", askOnOpen: h, dock
416
433
  fontSize: 10.5,
417
434
  color: "var(--text-4)"
418
435
  },
419
- children: [/* @__PURE__ */ E(e.shield, { size: 10 }), /* @__PURE__ */ E("span", { children: x("agent.panel.footer", "Runs within your permissions. All actions audit-logged.") })]
436
+ children: [/* @__PURE__ */ D(e.shield, { size: 10 }), /* @__PURE__ */ D("span", { children: C("agent.panel.footer", "Runs within your permissions. All actions audit-logged.") })]
420
437
  })
421
438
  ]
422
439
  })
423
440
  ]
424
441
  });
425
442
  }
426
- function O() {
427
- return /* @__PURE__ */ E("span", {
443
+ function se() {
444
+ return /* @__PURE__ */ D("span", {
428
445
  "aria-hidden": !0,
429
446
  style: {
430
447
  display: "inline-block",
@@ -437,8 +454,8 @@ function O() {
437
454
  }
438
455
  });
439
456
  }
440
- function k({ children: t, dataMessageId: n, dataStreaming: r }) {
441
- return /* @__PURE__ */ D("div", {
457
+ function A({ children: t, dataMessageId: n, dataStreaming: r }) {
458
+ return /* @__PURE__ */ O("div", {
442
459
  "data-message-id": n,
443
460
  "data-streaming": r ? "true" : void 0,
444
461
  style: {
@@ -446,7 +463,7 @@ function k({ children: t, dataMessageId: n, dataStreaming: r }) {
446
463
  gap: 8,
447
464
  alignItems: "flex-start"
448
465
  },
449
- children: [/* @__PURE__ */ E("span", {
466
+ children: [/* @__PURE__ */ D("span", {
450
467
  style: {
451
468
  width: 20,
452
469
  height: 20,
@@ -459,8 +476,8 @@ function k({ children: t, dataMessageId: n, dataStreaming: r }) {
459
476
  flexShrink: 0,
460
477
  marginTop: 2
461
478
  },
462
- children: /* @__PURE__ */ E(e.sparkle, { size: 11 })
463
- }), /* @__PURE__ */ E("div", {
479
+ children: /* @__PURE__ */ D(e.sparkle, { size: 11 })
480
+ }), /* @__PURE__ */ D("div", {
464
481
  style: {
465
482
  flex: 1,
466
483
  minWidth: 0,
@@ -473,9 +490,9 @@ function k({ children: t, dataMessageId: n, dataStreaming: r }) {
473
490
  })]
474
491
  });
475
492
  }
476
- function le({ agentTurn: e }) {
477
- let t = f(), n = f("errors"), r = h("agent_turn")?.fields.get("status"), i = e.status === "failed" ? A(e) : void 0, a = i ? n(i.code, i.title || n("agents.turn_failed", "The assistant could not finish this turn.")) : void 0;
478
- return /* @__PURE__ */ D("div", {
493
+ function ce({ agentTurn: e }) {
494
+ let t = f(), n = f("errors"), r = h("agent_turn")?.fields.get("status"), i = e.status === "failed" ? j(e) : void 0, a = i ? n(i.code, i.title || n("agents.turn_failed", "The assistant could not finish this turn.")) : void 0;
495
+ return /* @__PURE__ */ O("div", {
479
496
  "data-agent-turn": e.id,
480
497
  "data-turn-status": e.status,
481
498
  style: {
@@ -490,28 +507,28 @@ function le({ agentTurn: e }) {
490
507
  ]
491
508
  });
492
509
  }
493
- function A(e) {
494
- let t = j(e.error_details) ? e.error_details.error : void 0, n = j(t) ? t : {}, r = typeof n.type == "string" ? n.type : "";
510
+ function j(e) {
511
+ let t = M(e.error_details) ? e.error_details.error : void 0, n = M(t) ? t : {}, r = typeof n.type == "string" ? n.type : "";
495
512
  return {
496
- code: r.startsWith(se) ? r.slice(8) : e.error_code ?? "",
513
+ code: r.startsWith(k) ? r.slice(8) : e.error_code ?? "",
497
514
  title: typeof n.title == "string" ? n.title : ""
498
515
  };
499
516
  }
500
- function ue(e, t) {
517
+ function le(e, t) {
501
518
  let n = e("agent.panel.input_needed", "Your response is needed."), r = t.question;
502
519
  if (r && (r.message || r.schema)) return {
503
520
  message: r.message || t.reason || n,
504
- schema: j(r.schema) ? r.schema : {}
521
+ schema: M(r.schema) ? r.schema : {}
505
522
  };
506
523
  let i = t.params ?? {};
507
524
  return {
508
525
  message: typeof i.message == "string" ? i.message : t.reason || n,
509
- schema: j(i.schema) ? i.schema : {}
526
+ schema: M(i.schema) ? i.schema : {}
510
527
  };
511
528
  }
512
- function de({ invocation: e }) {
529
+ function ue({ invocation: e }) {
513
530
  let t = f();
514
- return /* @__PURE__ */ E("div", {
531
+ return /* @__PURE__ */ D("div", {
515
532
  "data-agent-invocation": e.id,
516
533
  "data-invocation-status": "outcome_unknown",
517
534
  style: {
@@ -522,33 +539,33 @@ function de({ invocation: e }) {
522
539
  fontSize: 11.5,
523
540
  color: "var(--text-2)"
524
541
  },
525
- children: v(t("agent.panel.outcome_uncertain", "The outcome of {tool} is unknown. It was not retried automatically."), { tool: /* @__PURE__ */ E("span", {
542
+ children: y(t("agent.panel.outcome_uncertain", "The outcome of {tool} is unknown. It was not retried automatically."), { tool: /* @__PURE__ */ D("span", {
526
543
  className: "mono",
527
544
  children: e.tool_code
528
545
  }) })
529
546
  });
530
547
  }
531
- function j(e) {
548
+ function M(e) {
532
549
  return typeof e == "object" && !!e && !Array.isArray(e);
533
550
  }
534
- function fe({ run: e }) {
535
- let [t, n] = T(!1), r = M(), i = e.calls.filter((e) => e.isError).length, a = e.calls.filter((e) => !P(e.status)).length;
536
- return /* @__PURE__ */ D("div", {
551
+ function de({ run: e }) {
552
+ let [t, n] = E(!1), r = fe(), i = e.calls.filter((e) => e.isError).length, a = e.calls.filter((e) => !N(e.status)).length;
553
+ return /* @__PURE__ */ O("div", {
537
554
  "data-activity-run": e.id,
538
555
  style: {
539
556
  display: "flex",
540
557
  gap: 8,
541
558
  alignItems: "flex-start"
542
559
  },
543
- children: [/* @__PURE__ */ E("span", { style: {
560
+ children: [/* @__PURE__ */ D("span", { style: {
544
561
  width: 20,
545
562
  flexShrink: 0
546
- } }), /* @__PURE__ */ D("div", {
563
+ } }), /* @__PURE__ */ O("div", {
547
564
  style: {
548
565
  flex: 1,
549
566
  minWidth: 0
550
567
  },
551
- children: [/* @__PURE__ */ D("button", {
568
+ children: [/* @__PURE__ */ O("button", {
552
569
  type: "button",
553
570
  onClick: () => n((e) => !e),
554
571
  "data-activity-toggle": !0,
@@ -566,41 +583,41 @@ function fe({ run: e }) {
566
583
  borderRadius: 999,
567
584
  cursor: "pointer"
568
585
  },
569
- children: [/* @__PURE__ */ E("span", {
586
+ children: [/* @__PURE__ */ D("span", {
570
587
  "aria-hidden": !0,
571
588
  children: t ? "▾" : "▸"
572
- }), /* @__PURE__ */ E("span", { children: r(e.calls.length, a, i) })]
573
- }), t && /* @__PURE__ */ E("div", {
589
+ }), /* @__PURE__ */ D("span", { children: r(e.calls.length, a, i) })]
590
+ }), t && /* @__PURE__ */ D("div", {
574
591
  style: {
575
592
  marginTop: 4,
576
593
  display: "flex",
577
594
  flexDirection: "column",
578
595
  gap: 3
579
596
  },
580
- children: e.calls.map((e) => /* @__PURE__ */ E(N, { call: e }, e.id))
597
+ children: e.calls.map((e) => /* @__PURE__ */ D(pe, { call: e }, e.id))
581
598
  })]
582
599
  })]
583
600
  });
584
601
  }
585
- function M() {
602
+ function fe() {
586
603
  let e = f();
587
604
  return (t, n, r) => {
588
605
  let i = [];
589
- return t > 0 && i.push(_(e, "agent.panel.operations", t, {
606
+ return t > 0 && i.push(v(e, "agent.panel.operations", t, {
590
607
  one: "{count} operation",
591
608
  other: "{count} operations"
592
- })), n > 0 && i.push(e("agent.panel.running", "running")), r > 0 && i.push(_(e, "agent.panel.failed_count", r, {
609
+ })), n > 0 && i.push(e("agent.panel.running", "running")), r > 0 && i.push(v(e, "agent.panel.failed_count", r, {
593
610
  one: "{count} failed",
594
611
  other: "{count} failed"
595
612
  })), i.join(" · ") || e("agent.panel.worked", "worked");
596
613
  };
597
614
  }
598
- function N({ call: e }) {
599
- let [t, n] = T(!1), r = f(), i = I(e.name), a = h("agent_tool_invocation")?.fields.get("status"), o = e.status ?? "running", s = r(a?.values?.find((e) => e.code === o)?.name) || o, c = e.status === "outcome_unknown" ? "outcome_unknown" : e.isError ? "failed" : P(e.status) ? "ok" : "running";
600
- return /* @__PURE__ */ D("div", {
615
+ function pe({ call: e }) {
616
+ let [t, n] = E(!1), r = f(), i = P(e.name), a = h("agent_tool_invocation")?.fields.get("status"), o = e.status ?? "running", s = r(a?.values?.find((e) => e.code === o)?.name) || o, c = e.status === "outcome_unknown" ? "outcome_unknown" : e.isError ? "failed" : N(e.status) ? "ok" : "running";
617
+ return /* @__PURE__ */ O("div", {
601
618
  "data-activity-call": e.name,
602
619
  "data-call-state": c,
603
- children: [/* @__PURE__ */ D("button", {
620
+ children: [/* @__PURE__ */ O("button", {
604
621
  type: "button",
605
622
  onClick: () => n((e) => !e),
606
623
  style: {
@@ -615,20 +632,20 @@ function N({ call: e }) {
615
632
  color: c === "failed" ? "var(--danger)" : "var(--text-2)"
616
633
  },
617
634
  children: [
618
- /* @__PURE__ */ E("span", {
635
+ /* @__PURE__ */ D("span", {
619
636
  "aria-hidden": !0,
620
637
  children: t ? "▾" : "▸"
621
638
  }),
622
- /* @__PURE__ */ E("span", {
639
+ /* @__PURE__ */ D("span", {
623
640
  className: "mono",
624
641
  children: i
625
642
  }),
626
- /* @__PURE__ */ E("span", {
643
+ /* @__PURE__ */ D("span", {
627
644
  style: { color: "var(--text-3)" },
628
645
  children: s
629
646
  })
630
647
  ]
631
- }), t && /* @__PURE__ */ E("pre", {
648
+ }), t && /* @__PURE__ */ D("pre", {
632
649
  style: {
633
650
  margin: "2px 0 0 18px",
634
651
  padding: 6,
@@ -649,26 +666,26 @@ function N({ call: e }) {
649
666
  })]
650
667
  });
651
668
  }
652
- function P(e) {
669
+ function N(e) {
653
670
  return e === "succeeded" || e === "failed" || e === "rejected" || e === "canceled" || e === "outcome_unknown";
654
671
  }
655
- function pe({ conversations: e, hasMore: t, onShowMore: n, currentId: r, onPick: i }) {
672
+ function me({ conversations: e, hasMore: t, onShowMore: n, currentId: r, onPick: i }) {
656
673
  let a = f();
657
- return e.length === 0 ? /* @__PURE__ */ E("div", {
674
+ return e.length === 0 ? /* @__PURE__ */ D("div", {
658
675
  style: {
659
676
  padding: "8px 12px",
660
677
  fontSize: 11.5,
661
678
  color: "var(--text-3)"
662
679
  },
663
680
  children: a("agent.panel.no_earlier", "No earlier conversations.")
664
- }) : /* @__PURE__ */ D("div", {
681
+ }) : /* @__PURE__ */ O("div", {
665
682
  "data-conversation-list": !0,
666
683
  style: {
667
684
  maxHeight: 200,
668
685
  overflowY: "auto",
669
686
  borderBottom: "1px solid var(--border)"
670
687
  },
671
- children: [e.map((e) => /* @__PURE__ */ D("button", {
688
+ children: [e.map((e) => /* @__PURE__ */ O("button", {
672
689
  type: "button",
673
690
  "data-conversation-id": e.id,
674
691
  onClick: () => i(e.id),
@@ -683,19 +700,19 @@ function pe({ conversations: e, hasMore: t, onShowMore: n, currentId: r, onPick:
683
700
  cursor: "pointer",
684
701
  color: "var(--text)"
685
702
  },
686
- children: [/* @__PURE__ */ E("div", {
703
+ children: [/* @__PURE__ */ D("div", {
687
704
  style: { overflowWrap: "anywhere" },
688
705
  children: e.title?.trim() || a("agent.panel.untitled", "Untitled conversation")
689
- }), /* @__PURE__ */ E("div", {
706
+ }), /* @__PURE__ */ D("div", {
690
707
  "data-conversation-facts": !0,
691
708
  style: {
692
709
  fontSize: 10.5,
693
710
  color: "var(--text-3)",
694
711
  overflowWrap: "anywhere"
695
712
  },
696
- children: F(a, e).join(" · ")
713
+ children: ge(a, e).join(" · ")
697
714
  })]
698
- }, e.id)), t && /* @__PURE__ */ E("button", {
715
+ }, e.id)), t && /* @__PURE__ */ D("button", {
699
716
  type: "button",
700
717
  "data-conversation-more": !0,
701
718
  onClick: n,
@@ -713,29 +730,29 @@ function pe({ conversations: e, hasMore: t, onShowMore: n, currentId: r, onPick:
713
730
  })]
714
731
  });
715
732
  }
716
- function me(e, t) {
733
+ function he(e, t) {
717
734
  return t.agent_name && e(t.agent_name) || t.agent;
718
735
  }
719
- function F(e, t) {
720
- let n = [], r = me(e, t);
721
- return r && n.push(r), t.chat_id && !t.title && n.push(e("agent.panel.messenger_chat", "chat {chat}", { chat: H(t.chat_id) })), t.topic_id && n.push(e("agent.panel.messenger_topic", "topic {topic}", { topic: t.topic_id })), t.updated_at && n.push(g(t.updated_at, { zone: e.timeZone })), n;
736
+ function ge(e, t) {
737
+ let n = [], r = he(e, t);
738
+ return r && n.push(r), t.chat_id && !t.title && n.push(e("agent.panel.messenger_chat", "chat {chat}", { chat: B(t.chat_id) })), t.topic_id && n.push(e("agent.panel.messenger_topic", "topic {topic}", { topic: t.topic_id })), t.updated_at && n.push(_(t.updated_at, { zone: e.timeZone })), n;
722
739
  }
723
- function I(e) {
740
+ function P(e) {
724
741
  let t = f(), { value: n } = d("agents.transcript_names", "code"), { data: r } = u();
725
- return n === "display" && t(r?.actions?.[e]?.display?.name ?? L(r, e)) || e;
742
+ return n === "display" && t(r?.actions?.[e]?.display?.name ?? F(r, e)) || e;
726
743
  }
727
- function L(e, t) {
744
+ function F(e, t) {
728
745
  let n = t.indexOf(".");
729
746
  if (!(n < 0)) return e?.entities?.[t.slice(0, n)]?.actions?.[t.slice(n + 1)]?.display?.name;
730
747
  }
731
- function he({ message: e, delivered: t, showsPlace: n, turns: r }) {
732
- let i = x(e, r) ? e.attachments : void 0;
748
+ function _e({ message: e, delivered: t, showsPlace: n, turns: r }) {
749
+ let i = S(e, r) ? e.attachments : void 0;
733
750
  if (e.role === "user") {
734
- let t = _e(e.content);
735
- return e.content.some((e) => e.type !== "text" && e.type !== "location") ? /* @__PURE__ */ E(U, {
751
+ let t = q(e.content);
752
+ return e.content.some((e) => e.type !== "text" && e.type !== "location") ? /* @__PURE__ */ D(V, {
736
753
  message: e,
737
754
  files: i
738
- }) : /* @__PURE__ */ D("div", {
755
+ }) : /* @__PURE__ */ O("div", {
739
756
  style: {
740
757
  alignSelf: "flex-end",
741
758
  maxWidth: "80%",
@@ -747,52 +764,52 @@ function he({ message: e, delivered: t, showsPlace: n, turns: r }) {
747
764
  "data-message-id": e.id,
748
765
  "data-streaming": e.streaming ? "true" : void 0,
749
766
  children: [
750
- t && /* @__PURE__ */ E(R, { text: t }),
751
- /* @__PURE__ */ E(b, {
767
+ t && /* @__PURE__ */ D(I, { text: t }),
768
+ /* @__PURE__ */ D(x, {
752
769
  files: i,
753
770
  align: "end"
754
771
  }),
755
- /* @__PURE__ */ E(V, {
772
+ /* @__PURE__ */ D(z, {
756
773
  message: e,
757
774
  showsPlace: n
758
775
  })
759
776
  ]
760
777
  });
761
778
  }
762
- return e.role === "tool" ? /* @__PURE__ */ E(U, { message: e }) : e.role === "system" ? e.content.some((e) => e.type === "decision") ? /* @__PURE__ */ E(U, { message: e }) : z(e) ? /* @__PURE__ */ E(B, {
779
+ return e.role === "tool" ? /* @__PURE__ */ D(V, { message: e }) : e.role === "system" ? e.content.some((e) => e.type === "decision") ? /* @__PURE__ */ D(V, { message: e }) : L(e) ? /* @__PURE__ */ D(R, {
763
780
  message: e,
764
781
  showsPlace: n
765
- }) : /* @__PURE__ */ D(k, {
782
+ }) : /* @__PURE__ */ O(A, {
766
783
  dataMessageId: e.id,
767
- children: [e.content.map((t, n) => /* @__PURE__ */ E(q, {
784
+ children: [e.content.map((t, n) => /* @__PURE__ */ D(G, {
768
785
  block: t,
769
786
  sentByMessenger: !!e.bot_id
770
- }, n)), /* @__PURE__ */ E(V, {
787
+ }, n)), /* @__PURE__ */ D(z, {
771
788
  message: e,
772
789
  showsPlace: n
773
790
  })]
774
- }) : e.content.length === 0 && !i?.length ? null : /* @__PURE__ */ D(k, {
791
+ }) : e.content.length === 0 && !i?.length ? null : /* @__PURE__ */ O(A, {
775
792
  dataMessageId: e.id,
776
793
  dataStreaming: e.streaming,
777
794
  children: [
778
- e.content.map((t, n) => /* @__PURE__ */ E(q, {
795
+ e.content.map((t, n) => /* @__PURE__ */ D(G, {
779
796
  block: t,
780
797
  sentByMessenger: !!e.bot_id
781
798
  }, n)),
782
- e.streaming && /* @__PURE__ */ E(O, {}),
783
- /* @__PURE__ */ E(b, {
799
+ e.streaming && /* @__PURE__ */ D(se, {}),
800
+ /* @__PURE__ */ D(x, {
784
801
  files: i,
785
802
  align: "start"
786
803
  }),
787
- t && /* @__PURE__ */ E(V, {
804
+ t && /* @__PURE__ */ D(z, {
788
805
  message: t,
789
806
  showsPlace: n
790
807
  })
791
808
  ]
792
809
  });
793
810
  }
794
- function R({ text: e, dim: t }) {
795
- return /* @__PURE__ */ E("div", {
811
+ function I({ text: e, dim: t }) {
812
+ return /* @__PURE__ */ D("div", {
796
813
  style: {
797
814
  padding: "8px 12px",
798
815
  borderRadius: "var(--radius-lg)",
@@ -811,12 +828,12 @@ function R({ text: e, dim: t }) {
811
828
  children: e
812
829
  });
813
830
  }
814
- function z(e) {
831
+ function L(e) {
815
832
  return !e.bot_id || e.delivery_key ? !1 : e.content.some((e) => e.type === "reaction" || e.type === "text" && (!!e.callback_data || e.heard === !0));
816
833
  }
817
- function B({ message: e, showsPlace: t }) {
818
- let n = f(), r = e.content.some((e) => e.type === "text" && e.heard === !0), i = e.content.some((e) => e.type === "text" && !!e.callback_data), a = _e(e.content), o = e.content.find((e) => e.type === "reaction"), s = o?.type === "reaction" ? o.emoji ?? "" : a, c = r ? n("agent.panel.heard_started_nothing", "Heard, started nothing") : i ? n("agent.panel.pressed_button", "Pressed a button") : "";
819
- return /* @__PURE__ */ D("div", {
834
+ function R({ message: e, showsPlace: t }) {
835
+ let n = f(), r = e.content.some((e) => e.type === "text" && e.heard === !0), i = e.content.some((e) => e.type === "text" && !!e.callback_data), a = q(e.content), o = e.content.find((e) => e.type === "reaction"), s = o?.type === "reaction" ? o.emoji ?? "" : a, c = r ? n("agent.panel.heard_started_nothing", "Heard, started nothing") : i ? n("agent.panel.pressed_button", "Pressed a button") : "";
836
+ return /* @__PURE__ */ O("div", {
820
837
  "data-message-id": e.id,
821
838
  "data-person-on-messenger": r ? "heard" : i ? "pressed" : "reacted",
822
839
  style: {
@@ -828,11 +845,11 @@ function B({ message: e, showsPlace: t }) {
828
845
  alignItems: "flex-end"
829
846
  },
830
847
  children: [
831
- s && /* @__PURE__ */ E(R, {
848
+ s && /* @__PURE__ */ D(I, {
832
849
  text: s,
833
850
  dim: r
834
851
  }),
835
- c && /* @__PURE__ */ E("div", {
852
+ c && /* @__PURE__ */ D("div", {
836
853
  "data-messenger-mark": !0,
837
854
  style: {
838
855
  fontSize: 10.5,
@@ -841,18 +858,18 @@ function B({ message: e, showsPlace: t }) {
841
858
  },
842
859
  children: c
843
860
  }),
844
- /* @__PURE__ */ E(V, {
861
+ /* @__PURE__ */ D(z, {
845
862
  message: e,
846
863
  showsPlace: t
847
864
  })
848
865
  ]
849
866
  });
850
867
  }
851
- function V({ message: e, showsPlace: t }) {
868
+ function z({ message: e, showsPlace: t }) {
852
869
  let n = f(), r = h("agent_message")?.fields.get("delivery_status");
853
870
  if (!e.bot_id) return null;
854
871
  let i = [];
855
- return t && e.bot && i.push(e.bot), t && e.chat_id && i.push(n("agent.panel.messenger_chat", "chat {chat}", { chat: H(e.chat_id) })), t && e.topic_id && i.push(n("agent.panel.messenger_topic", "topic {topic}", { topic: e.topic_id })), !e.delivery_key && e.sender_external_id && (e.sender_user || H(e.sender_external_id) !== H(e.chat_id ?? "")) && i.push(n("agent.panel.messenger_from", "from {sender}", { sender: e.sender_user || H(e.sender_external_id) })), e.delivery_status && i.push(n(r?.values?.find((t) => t.code === e.delivery_status)?.name) || e.delivery_status), i.length === 0 ? null : /* @__PURE__ */ E("div", {
872
+ return t && e.bot && i.push(e.bot), t && e.chat_id && i.push(n("agent.panel.messenger_chat", "chat {chat}", { chat: B(e.chat_id) })), t && e.topic_id && i.push(n("agent.panel.messenger_topic", "topic {topic}", { topic: e.topic_id })), !e.delivery_key && e.sender_external_id && (e.sender_user || B(e.sender_external_id) !== B(e.chat_id ?? "")) && i.push(n("agent.panel.messenger_from", "from {sender}", { sender: e.sender_user || B(e.sender_external_id) })), e.delivery_status && i.push(n(r?.values?.find((t) => t.code === e.delivery_status)?.name) || e.delivery_status), i.length === 0 ? null : /* @__PURE__ */ D("div", {
856
873
  "data-messenger-facts": !0,
857
874
  "data-delivery-status": e.delivery_status ?? void 0,
858
875
  style: {
@@ -864,11 +881,11 @@ function V({ message: e, showsPlace: t }) {
864
881
  children: i.join(" · ")
865
882
  });
866
883
  }
867
- function H(e) {
884
+ function B(e) {
868
885
  return e.slice(e.indexOf(":") + 1);
869
886
  }
870
- function U({ message: e, files: t }) {
871
- return /* @__PURE__ */ D("div", {
887
+ function V({ message: e, files: t }) {
888
+ return /* @__PURE__ */ O("div", {
872
889
  "data-message-id": e.id,
873
890
  "data-streaming": e.streaming ? "true" : void 0,
874
891
  style: {
@@ -880,21 +897,21 @@ function U({ message: e, files: t }) {
880
897
  alignItems: "flex-end",
881
898
  overflowWrap: "anywhere"
882
899
  },
883
- children: [e.content.map((t, n) => /* @__PURE__ */ E(q, {
900
+ children: [e.content.map((t, n) => /* @__PURE__ */ D(G, {
884
901
  block: t,
885
902
  sentByMessenger: !!e.bot_id
886
- }, n)), /* @__PURE__ */ E(b, {
903
+ }, n)), /* @__PURE__ */ D(x, {
887
904
  files: t,
888
905
  align: "end"
889
906
  })]
890
907
  });
891
908
  }
892
- function W({ href: e, children: t, ...n }) {
909
+ function ve({ href: e, children: t, ...n }) {
893
910
  let r = p(), i = {
894
911
  color: "var(--accent-text)",
895
912
  textDecoration: "underline"
896
- }, a = G(e);
897
- return a ? /* @__PURE__ */ E("a", {
913
+ }, a = H(e);
914
+ return a ? /* @__PURE__ */ D("a", {
898
915
  ...n,
899
916
  href: e,
900
917
  style: i,
@@ -902,7 +919,7 @@ function W({ href: e, children: t, ...n }) {
902
919
  e.preventDefault(), r(a);
903
920
  },
904
921
  children: t
905
- }) : /* @__PURE__ */ E("a", {
922
+ }) : /* @__PURE__ */ D("a", {
906
923
  ...n,
907
924
  href: e,
908
925
  target: "_blank",
@@ -911,7 +928,7 @@ function W({ href: e, children: t, ...n }) {
911
928
  children: t
912
929
  });
913
930
  }
914
- function G(e) {
931
+ function H(e) {
915
932
  if (typeof e != "string") return null;
916
933
  let t;
917
934
  try {
@@ -921,10 +938,10 @@ function G(e) {
921
938
  }
922
939
  return t.origin === window.location.origin ? `${t.pathname}${t.search}${t.hash}` : null;
923
940
  }
924
- var ge = {
925
- a: W,
941
+ var U = {
942
+ a: ve,
926
943
  pre({ node: e, children: t, ...n }) {
927
- return /* @__PURE__ */ E("pre", {
944
+ return /* @__PURE__ */ D("pre", {
928
945
  ...n,
929
946
  style: {
930
947
  background: "var(--surface-2)",
@@ -936,14 +953,14 @@ var ge = {
936
953
  fontSize: 11.5,
937
954
  lineHeight: 1.5
938
955
  },
939
- children: S(t) ? re(t, { block: !0 }) : t
956
+ children: ne(t) ? C(t, { block: !0 }) : t
940
957
  });
941
958
  },
942
959
  code({ node: e, block: t, children: n, ...r }) {
943
- return t ? /* @__PURE__ */ E("code", {
960
+ return t ? /* @__PURE__ */ D("code", {
944
961
  ...r,
945
962
  children: n
946
- }) : /* @__PURE__ */ E("code", {
963
+ }) : /* @__PURE__ */ D("code", {
947
964
  ...r,
948
965
  style: {
949
966
  background: "var(--surface-2)",
@@ -956,7 +973,7 @@ var ge = {
956
973
  });
957
974
  },
958
975
  ul({ children: e, ...t }) {
959
- return /* @__PURE__ */ E("ul", {
976
+ return /* @__PURE__ */ D("ul", {
960
977
  ...t,
961
978
  style: {
962
979
  paddingLeft: 18,
@@ -966,7 +983,7 @@ var ge = {
966
983
  });
967
984
  },
968
985
  ol({ children: e, ...t }) {
969
- return /* @__PURE__ */ E("ol", {
986
+ return /* @__PURE__ */ D("ol", {
970
987
  ...t,
971
988
  style: {
972
989
  paddingLeft: 20,
@@ -976,15 +993,15 @@ var ge = {
976
993
  });
977
994
  },
978
995
  p({ children: e, ...t }) {
979
- return /* @__PURE__ */ E("p", {
996
+ return /* @__PURE__ */ D("p", {
980
997
  ...t,
981
998
  style: { margin: "4px 0" },
982
999
  children: e
983
1000
  });
984
1001
  }
985
1002
  };
986
- function K({ rows: e }) {
987
- return /* @__PURE__ */ E("div", {
1003
+ function W({ rows: e }) {
1004
+ return /* @__PURE__ */ D("div", {
988
1005
  "data-messenger-buttons": !0,
989
1006
  style: {
990
1007
  display: "flex",
@@ -992,12 +1009,12 @@ function K({ rows: e }) {
992
1009
  gap: 4,
993
1010
  marginTop: 6
994
1011
  },
995
- children: e.map((e, t) => /* @__PURE__ */ E("div", {
1012
+ children: e.map((e, t) => /* @__PURE__ */ D("div", {
996
1013
  style: {
997
1014
  display: "flex",
998
1015
  gap: 4
999
1016
  },
1000
- children: e.map((e, t) => /* @__PURE__ */ E("span", {
1017
+ children: e.map((e, t) => /* @__PURE__ */ D("span", {
1001
1018
  title: e.url ?? e.web_app?.url,
1002
1019
  style: {
1003
1020
  flex: 1,
@@ -1016,51 +1033,51 @@ function K({ rows: e }) {
1016
1033
  }, t))
1017
1034
  });
1018
1035
  }
1019
- function q({ block: e, sentByMessenger: t }) {
1036
+ function G({ block: e, sentByMessenger: t }) {
1020
1037
  let n = f();
1021
1038
  switch (e.type) {
1022
- case "text": return t ? /* @__PURE__ */ D("div", {
1039
+ case "text": return t ? /* @__PURE__ */ O("div", {
1023
1040
  "data-messenger-text": !0,
1024
1041
  style: {
1025
1042
  whiteSpace: "pre-wrap",
1026
1043
  overflowWrap: "anywhere"
1027
1044
  },
1028
- children: [e.text, e.buttons?.length ? /* @__PURE__ */ E(K, { rows: e.buttons }) : null]
1029
- }) : /* @__PURE__ */ D("div", {
1045
+ children: [e.text, e.buttons?.length ? /* @__PURE__ */ D(W, { rows: e.buttons }) : null]
1046
+ }) : /* @__PURE__ */ O("div", {
1030
1047
  className: "agent-md",
1031
- children: [/* @__PURE__ */ E(i, {
1048
+ children: [/* @__PURE__ */ D(i, {
1032
1049
  content: e.text,
1033
1050
  plugins: "gfm",
1034
1051
  prose: !1,
1035
1052
  skipHtml: !1,
1036
- components: ge
1037
- }), e.buttons?.length ? /* @__PURE__ */ E(K, { rows: e.buttons }) : null]
1053
+ components: U
1054
+ }), e.buttons?.length ? /* @__PURE__ */ D(W, { rows: e.buttons }) : null]
1038
1055
  });
1039
1056
  case "tool_use": {
1040
- let t = Y(n, e.name, e.input);
1041
- return /* @__PURE__ */ E(J, {
1057
+ let t = J(n, e.name, e.input);
1058
+ return /* @__PURE__ */ D(K, {
1042
1059
  kind: "call",
1043
1060
  label: t.label,
1044
1061
  sub: t.sub,
1045
1062
  body: e.input
1046
1063
  });
1047
1064
  }
1048
- case "tool_result": return /* @__PURE__ */ E(J, {
1065
+ case "tool_result": return /* @__PURE__ */ D(K, {
1049
1066
  kind: "result",
1050
- label: X(n, e),
1067
+ label: Y(n, e),
1051
1068
  body: e.output,
1052
1069
  isError: !!e.is_error
1053
1070
  });
1054
- case "elicit_response": return /* @__PURE__ */ E(J, {
1071
+ case "elicit_response": return /* @__PURE__ */ D(K, {
1055
1072
  kind: "result",
1056
1073
  label: n("agent.panel.chip.answer", "answer"),
1057
1074
  body: e.data
1058
1075
  });
1059
- case "decision": return /* @__PURE__ */ E(ve, { block: e });
1076
+ case "decision": return /* @__PURE__ */ D(Z, { block: e });
1060
1077
  case "location":
1061
1078
  case "thinking":
1062
1079
  case "redacted_thinking": return null;
1063
- case "system": return /* @__PURE__ */ D("div", {
1080
+ case "system": return /* @__PURE__ */ O("div", {
1064
1081
  style: {
1065
1082
  fontSize: 10.5,
1066
1083
  fontStyle: "italic",
@@ -1068,7 +1085,7 @@ function q({ block: e, sentByMessenger: t }) {
1068
1085
  },
1069
1086
  children: ["— ", e.reason]
1070
1087
  });
1071
- case "summary": return /* @__PURE__ */ E("div", {
1088
+ case "summary": return /* @__PURE__ */ D("div", {
1072
1089
  style: {
1073
1090
  fontSize: 10.5,
1074
1091
  fontStyle: "italic",
@@ -1076,7 +1093,7 @@ function q({ block: e, sentByMessenger: t }) {
1076
1093
  },
1077
1094
  children: e.text
1078
1095
  });
1079
- case "attachment": return /* @__PURE__ */ E("pre", {
1096
+ case "attachment": return /* @__PURE__ */ D("pre", {
1080
1097
  className: "mono",
1081
1098
  style: {
1082
1099
  marginTop: 8,
@@ -1092,8 +1109,8 @@ function q({ block: e, sentByMessenger: t }) {
1092
1109
  default: return null;
1093
1110
  }
1094
1111
  }
1095
- function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1096
- return /* @__PURE__ */ D("details", {
1112
+ function K({ kind: e, label: t, sub: n, body: r, isError: i }) {
1113
+ return /* @__PURE__ */ O("details", {
1097
1114
  style: {
1098
1115
  marginTop: 6,
1099
1116
  background: "var(--surface-2)",
@@ -1106,7 +1123,7 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1106
1123
  boxSizing: "border-box",
1107
1124
  overflow: "hidden"
1108
1125
  },
1109
- children: [/* @__PURE__ */ D("summary", {
1126
+ children: [/* @__PURE__ */ O("summary", {
1110
1127
  style: {
1111
1128
  padding: "5px 8px",
1112
1129
  cursor: "pointer",
@@ -1118,7 +1135,7 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1118
1135
  color: "var(--text-2)"
1119
1136
  },
1120
1137
  children: [
1121
- /* @__PURE__ */ E("span", {
1138
+ /* @__PURE__ */ D("span", {
1122
1139
  "aria-hidden": !0,
1123
1140
  style: {
1124
1141
  color: i ? "var(--destructive)" : "var(--text-3)",
@@ -1127,7 +1144,7 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1127
1144
  },
1128
1145
  children: e === "call" ? "→" : i ? "✗" : "✓"
1129
1146
  }),
1130
- /* @__PURE__ */ E("span", {
1147
+ /* @__PURE__ */ D("span", {
1131
1148
  className: "mono",
1132
1149
  style: {
1133
1150
  color: "var(--text-2)",
@@ -1139,7 +1156,7 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1139
1156
  },
1140
1157
  children: t
1141
1158
  }),
1142
- n && /* @__PURE__ */ E("span", {
1159
+ n && /* @__PURE__ */ D("span", {
1143
1160
  style: {
1144
1161
  fontSize: 10,
1145
1162
  color: "var(--text-4)",
@@ -1151,8 +1168,8 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1151
1168
  },
1152
1169
  children: n
1153
1170
  }),
1154
- /* @__PURE__ */ E("span", { style: { flex: 1 } }),
1155
- /* @__PURE__ */ E("span", {
1171
+ /* @__PURE__ */ D("span", { style: { flex: 1 } }),
1172
+ /* @__PURE__ */ D("span", {
1156
1173
  "aria-hidden": !0,
1157
1174
  style: {
1158
1175
  fontSize: 9,
@@ -1161,7 +1178,7 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1161
1178
  children: "▾"
1162
1179
  })
1163
1180
  ]
1164
- }), /* @__PURE__ */ E("pre", {
1181
+ }), /* @__PURE__ */ D("pre", {
1165
1182
  className: "mono",
1166
1183
  style: {
1167
1184
  margin: 0,
@@ -1177,10 +1194,10 @@ function J({ kind: e, label: t, sub: n, body: r, isError: i }) {
1177
1194
  })]
1178
1195
  });
1179
1196
  }
1180
- function _e(e) {
1197
+ function q(e) {
1181
1198
  return e.map((e) => e.type === "text" ? e.text : "").join("");
1182
1199
  }
1183
- function Y(e, t, n) {
1200
+ function J(e, t, n) {
1184
1201
  if (t === "action.invoke") {
1185
1202
  let r = typeof n?.code == "string" ? n.code : "";
1186
1203
  if (r) return {
@@ -1190,15 +1207,15 @@ function Y(e, t, n) {
1190
1207
  }
1191
1208
  return { label: t };
1192
1209
  }
1193
- function X(e, t) {
1210
+ function Y(e, t) {
1194
1211
  return t.name ? t.name : t.is_error ? e("agent.panel.chip.error", "error") : e("agent.panel.chip.result", "result");
1195
1212
  }
1196
- function Z(e, t) {
1213
+ function X(e, t) {
1197
1214
  return t === "approved" ? e("agent.panel.decision.approve", "Approved") : e("agent.panel.decision.reject", "Rejected");
1198
1215
  }
1199
- function ve({ block: e }) {
1216
+ function Z({ block: e }) {
1200
1217
  let t = f(), n = e.decision === "approved", r = n ? "var(--success)" : "var(--destructive)";
1201
- return /* @__PURE__ */ D("div", {
1218
+ return /* @__PURE__ */ O("div", {
1202
1219
  style: {
1203
1220
  marginTop: 6,
1204
1221
  padding: "5px 10px",
@@ -1214,7 +1231,7 @@ function ve({ block: e }) {
1214
1231
  },
1215
1232
  title: e.decided_at ? t("agent.panel.decided_at", "decided {time}", { time: e.decided_at }) : void 0,
1216
1233
  children: [
1217
- /* @__PURE__ */ E("span", {
1234
+ /* @__PURE__ */ D("span", {
1218
1235
  "aria-hidden": !0,
1219
1236
  style: {
1220
1237
  color: r,
@@ -1222,11 +1239,11 @@ function ve({ block: e }) {
1222
1239
  },
1223
1240
  children: n ? "✓" : "✗"
1224
1241
  }),
1225
- /* @__PURE__ */ E("span", {
1242
+ /* @__PURE__ */ D("span", {
1226
1243
  style: { fontWeight: 600 },
1227
- children: Z(t, e.decision)
1244
+ children: X(t, e.decision)
1228
1245
  }),
1229
- /* @__PURE__ */ E("span", {
1246
+ /* @__PURE__ */ D("span", {
1230
1247
  className: "mono",
1231
1248
  style: {
1232
1249
  color: "var(--text-3)",
@@ -1234,7 +1251,7 @@ function ve({ block: e }) {
1234
1251
  },
1235
1252
  children: e.tool_code
1236
1253
  }),
1237
- e.note && /* @__PURE__ */ D("span", {
1254
+ e.note && /* @__PURE__ */ O("span", {
1238
1255
  style: {
1239
1256
  color: "var(--text-3)",
1240
1257
  fontStyle: "italic"
@@ -1261,12 +1278,12 @@ function be(e, t) {
1261
1278
  switch (t.type) {
1262
1279
  case "text": return t.text;
1263
1280
  case "tool_use": {
1264
- let n = Y(e, t.name, t.input);
1281
+ let n = J(e, t.name, t.input);
1265
1282
  return `${n.sub ? `→ ${n.label} (${n.sub})` : `→ ${n.label}`}\n${JSON.stringify(t.input, null, 2)}`;
1266
1283
  }
1267
- case "tool_result": return `${`${t.is_error ? "✗" : "✓"} ${X(e, t)}`}\n${JSON.stringify(t.output, null, 2)}`;
1284
+ case "tool_result": return `${`${t.is_error ? "✗" : "✓"} ${Y(e, t)}`}\n${JSON.stringify(t.output, null, 2)}`;
1268
1285
  case "elicit_response": return `${e("agent.panel.chip.answer", "answer")}\n${JSON.stringify(t.data, null, 2)}`;
1269
- case "decision": return `${Z(e, t.decision)} ${t.tool_code}${t.note ? ` — ${t.note}` : ""}`;
1286
+ case "decision": return `${X(e, t.decision)} ${t.tool_code}${t.note ? ` — ${t.note}` : ""}`;
1270
1287
  case "system": return `— ${t.reason}`;
1271
1288
  case "summary": return t.text;
1272
1289
  case "attachment": return t.content;
@@ -1277,26 +1294,26 @@ function Q(e, t) {
1277
1294
  return e("agent.panel.proposal", "Run {code}.", { code: t });
1278
1295
  }
1279
1296
  function xe({ tool: t, onApprove: r, onReject: i }) {
1280
- let a = f(), o = f("errors"), s = JSON.stringify(t.params ?? {}, null, 2), [c, ee] = T(!1), [l, u] = T(!1), [d, p] = T(""), [m, h] = T(null), [g, _] = T(!1), v = async (e) => {
1281
- if (!g) {
1282
- _(!0);
1297
+ let a = f(), o = f("errors"), s = JSON.stringify(t.params ?? {}, null, 2), [c, ee] = E(!1), [l, u] = E(!1), [d, p] = E(""), [m, h] = E(null), [_, v] = E(!1), y = async (e) => {
1298
+ if (!_) {
1299
+ v(!0);
1283
1300
  try {
1284
1301
  await r(e);
1285
1302
  } catch (e) {
1286
- h(te(o, e)), _(!1);
1303
+ h(g(o, e)), v(!1);
1287
1304
  }
1288
1305
  }
1289
- }, ne = async () => {
1290
- if (!g) {
1291
- _(!0);
1306
+ }, te = async () => {
1307
+ if (!_) {
1308
+ v(!0);
1292
1309
  try {
1293
1310
  await i(d.trim() || void 0);
1294
1311
  } catch (e) {
1295
- h(te(o, e)), _(!1);
1312
+ h(g(o, e)), v(!1);
1296
1313
  }
1297
1314
  }
1298
- }, y = typeof t.confidence == "number" ? Math.round(Math.max(0, Math.min(1, t.confidence)) * 100) : null;
1299
- return /* @__PURE__ */ D("div", {
1315
+ }, b = typeof t.confidence == "number" ? Math.round(Math.max(0, Math.min(1, t.confidence)) * 100) : null;
1316
+ return /* @__PURE__ */ O("div", {
1300
1317
  style: {
1301
1318
  marginTop: 4,
1302
1319
  padding: "10px 12px",
@@ -1305,7 +1322,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1305
1322
  borderRadius: "var(--radius-md)"
1306
1323
  },
1307
1324
  children: [
1308
- /* @__PURE__ */ D("div", {
1325
+ /* @__PURE__ */ O("div", {
1309
1326
  style: {
1310
1327
  display: "flex",
1311
1328
  alignItems: "center",
@@ -1313,11 +1330,11 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1313
1330
  marginBottom: 6
1314
1331
  },
1315
1332
  children: [
1316
- /* @__PURE__ */ E(e.bolt, {
1333
+ /* @__PURE__ */ D(e.bolt, {
1317
1334
  size: 11,
1318
1335
  style: { color: "var(--accent)" }
1319
1336
  }),
1320
- /* @__PURE__ */ E("span", {
1337
+ /* @__PURE__ */ D("span", {
1321
1338
  style: {
1322
1339
  fontSize: 11.5,
1323
1340
  fontWeight: 600,
@@ -1325,7 +1342,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1325
1342
  },
1326
1343
  children: a("agent.panel.proposed", "AI proposed")
1327
1344
  }),
1328
- /* @__PURE__ */ E("span", {
1345
+ /* @__PURE__ */ D("span", {
1329
1346
  className: "mono",
1330
1347
  style: {
1331
1348
  fontSize: 10.5,
@@ -1333,8 +1350,8 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1333
1350
  },
1334
1351
  children: t.tool_code
1335
1352
  }),
1336
- y !== null && /* @__PURE__ */ E("span", {
1337
- title: a("agent.panel.confidence_title", "LLM confidence {percent}%", { percent: y }),
1353
+ b !== null && /* @__PURE__ */ D("span", {
1354
+ title: a("agent.panel.confidence_title", "LLM confidence {percent}%", { percent: b }),
1338
1355
  style: {
1339
1356
  marginLeft: "auto",
1340
1357
  fontSize: 10,
@@ -1343,11 +1360,11 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1343
1360
  border: "1px solid var(--border)",
1344
1361
  borderRadius: 999
1345
1362
  },
1346
- children: a("agent.panel.confidence", "{percent}% confident", { percent: y })
1363
+ children: a("agent.panel.confidence", "{percent}% confident", { percent: b })
1347
1364
  })
1348
1365
  ]
1349
1366
  }),
1350
- /* @__PURE__ */ E("div", {
1367
+ /* @__PURE__ */ D("div", {
1351
1368
  style: {
1352
1369
  fontSize: 12,
1353
1370
  lineHeight: 1.45,
@@ -1356,7 +1373,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1356
1373
  },
1357
1374
  children: t.question?.message?.trim() || Q(a, t.tool_code)
1358
1375
  }),
1359
- t.reason?.trim() && /* @__PURE__ */ E("div", {
1376
+ t.reason?.trim() && /* @__PURE__ */ D("div", {
1360
1377
  style: {
1361
1378
  fontSize: 11.5,
1362
1379
  lineHeight: 1.45,
@@ -1365,7 +1382,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1365
1382
  },
1366
1383
  children: t.reason.trim()
1367
1384
  }),
1368
- /* @__PURE__ */ D("button", {
1385
+ /* @__PURE__ */ O("button", {
1369
1386
  type: "button",
1370
1387
  onClick: () => ee((e) => !e),
1371
1388
  style: {
@@ -1380,7 +1397,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1380
1397
  alignItems: "center",
1381
1398
  gap: 4
1382
1399
  },
1383
- children: [/* @__PURE__ */ E("span", {
1400
+ children: [/* @__PURE__ */ D("span", {
1384
1401
  style: {
1385
1402
  display: "inline-block",
1386
1403
  transform: c ? "rotate(90deg)" : "none",
@@ -1391,7 +1408,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1391
1408
  children: "▶"
1392
1409
  }), c ? a("agent.panel.hide_params", "Hide parameters") : a("agent.panel.view_params", "View parameters")]
1393
1410
  }),
1394
- c && /* @__PURE__ */ E("pre", {
1411
+ c && /* @__PURE__ */ D("pre", {
1395
1412
  className: "mono",
1396
1413
  style: {
1397
1414
  width: "100%",
@@ -1408,7 +1425,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1408
1425
  },
1409
1426
  children: s
1410
1427
  }),
1411
- m && /* @__PURE__ */ E("div", {
1428
+ m && /* @__PURE__ */ D("div", {
1412
1429
  style: {
1413
1430
  marginTop: 4,
1414
1431
  fontSize: 10.5,
@@ -1416,7 +1433,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1416
1433
  },
1417
1434
  children: m
1418
1435
  }),
1419
- l && /* @__PURE__ */ E("input", {
1436
+ l && /* @__PURE__ */ D("input", {
1420
1437
  type: "text",
1421
1438
  value: d,
1422
1439
  onChange: (e) => p(e.target.value),
@@ -1433,7 +1450,7 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1433
1450
  color: "var(--text)"
1434
1451
  }
1435
1452
  }),
1436
- /* @__PURE__ */ D("div", {
1453
+ /* @__PURE__ */ O("div", {
1437
1454
  style: {
1438
1455
  display: "flex",
1439
1456
  gap: 6,
@@ -1441,32 +1458,32 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1441
1458
  justifyContent: "flex-end"
1442
1459
  },
1443
1460
  children: [
1444
- l ? /* @__PURE__ */ E(n, {
1461
+ l ? /* @__PURE__ */ D(n, {
1445
1462
  size: "xs",
1446
1463
  kind: "ghost",
1447
- onClick: ne,
1448
- disabled: g,
1464
+ onClick: te,
1465
+ disabled: _,
1449
1466
  children: a("agent.panel.reject_send", "Send rejection")
1450
- }) : /* @__PURE__ */ E(n, {
1467
+ }) : /* @__PURE__ */ D(n, {
1451
1468
  size: "xs",
1452
1469
  kind: "ghost",
1453
1470
  onClick: () => u(!0),
1454
- disabled: g,
1471
+ disabled: _,
1455
1472
  children: a("agent.panel.reject", "Reject…")
1456
1473
  }),
1457
- t.confirmation_mode !== "always" && /* @__PURE__ */ E(n, {
1474
+ t.confirmation_mode !== "always" && /* @__PURE__ */ D(n, {
1458
1475
  size: "xs",
1459
1476
  kind: "ghost",
1460
- onClick: () => v("conversation"),
1461
- disabled: g,
1477
+ onClick: () => y("conversation"),
1478
+ disabled: _,
1462
1479
  children: a("agent.panel.approve_chat", "Approve for this chat")
1463
1480
  }),
1464
- /* @__PURE__ */ E(n, {
1481
+ /* @__PURE__ */ D(n, {
1465
1482
  size: "xs",
1466
1483
  kind: "primary",
1467
- icon: /* @__PURE__ */ E(e.check, { size: 11 }),
1468
- onClick: () => v("call"),
1469
- disabled: g,
1484
+ icon: /* @__PURE__ */ D(e.check, { size: 11 }),
1485
+ onClick: () => y("call"),
1486
+ disabled: _,
1470
1487
  children: a("agent.panel.approve_once", "Approve once")
1471
1488
  })
1472
1489
  ]
@@ -1474,4 +1491,4 @@ function xe({ tool: t, onApprove: r, onReject: i }) {
1474
1491
  ]
1475
1492
  });
1476
1493
  }
1477
- export { ce as AgentChatPanel, Q as proposalFallback };
1494
+ export { oe as AgentChatPanel, Q as proposalFallback };