@declarion/react 0.104.0 → 0.109.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 (34) hide show
  1. package/dist-lib/api/agents.js +8 -7
  2. package/dist-lib/api/client.js +48 -49
  3. package/dist-lib/components/agents/AgentChatPanel.impl.js +362 -301
  4. package/dist-lib/components/agents/ChatAttachments.js +144 -0
  5. package/dist-lib/components/agents/transcript-runs.js +1 -1
  6. package/dist-lib/components/chrome/AssociationTabs.js +89 -75
  7. package/dist-lib/components/detail-layout/AssociatedBlock.js +243 -235
  8. package/dist-lib/components/detail-layout/ChildrenCards.js +57 -55
  9. package/dist-lib/components/detail-layout/ChildrenList.js +45 -43
  10. package/dist-lib/components/detail-layout/ChildrenTable.js +93 -91
  11. package/dist-lib/components/detail-layout/ChildrenTimeline.js +160 -155
  12. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +127 -121
  13. package/dist-lib/components/fields/RefCombobox.js +53 -48
  14. package/dist-lib/components/fields/index.js +1 -0
  15. package/dist-lib/components/file-widgets/useFileSelection.js +152 -0
  16. package/dist-lib/components/pages/SmartDetailPage.impl.js +506 -482
  17. package/dist-lib/components/pages/SmartRecordListPage.impl.js +335 -300
  18. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +112 -109
  19. package/dist-lib/components/params/ParamsBlock.js +18 -15
  20. package/dist-lib/components/params/param-editors.js +60 -54
  21. package/dist-lib/components/primitives/RetryButton.js +14 -0
  22. package/dist-lib/components/primitives/StatTile.js +42 -34
  23. package/dist-lib/hooks/useAgentConversation.js +18 -13
  24. package/dist-lib/hooks/useParams.js +54 -52
  25. package/dist-lib/hooks/useSchema.js +5 -2
  26. package/dist-lib/hooks/useTimelineData.js +26 -24
  27. package/dist-lib/index.d.ts +89 -5
  28. package/dist-lib/index.js +95 -93
  29. package/dist-lib/lib/read-display-state.js +19 -0
  30. package/dist-lib/stores/auth.js +1 -0
  31. package/dist-lib/testing.d.ts +1 -1
  32. package/dist-lib/types/fieldType.js +1 -1
  33. package/dist-lib/{useResponsiveMode-ECv1AEhv.d.ts → useResponsiveMode-DODbtSrY.d.ts} +3 -0
  34. package/package.json +1 -1
@@ -12,55 +12,61 @@ import { useParam as d } from "../../hooks/useParams.js";
12
12
  import { useTabNavigate as f } from "../../hooks/useTabNavigate.js";
13
13
  import { useEntity as p } from "../../hooks/useEntity.js";
14
14
  import { Markdown as m } from "../shared/Markdown.js";
15
- import { AgentElicitForm as h } from "./AgentElicitForm.js";
16
- import { AgentPicker as g } from "./AgentPicker.js";
17
- import { useAgentConversation as _ } from "../../hooks/useAgentConversation.js";
18
- import { useWindowConversation as v } from "../../hooks/useWindowConversation.js";
19
- import { fold as y } from "./transcript-runs.js";
20
- import { useEffect as b, useRef as x, useState as S } from "react";
21
- import { jsx as C, jsxs as w } from "react/jsx-runtime";
22
- import { useLocation as T } from "react-router";
23
- import ee from "react-textarea-autosize";
15
+ import { useFileSelection as h } from "../file-widgets/useFileSelection.js";
16
+ import { AgentElicitForm as g } from "./AgentElicitForm.js";
17
+ import { AgentPicker as _ } from "./AgentPicker.js";
18
+ import { useAgentConversation as v } from "../../hooks/useAgentConversation.js";
19
+ import { useWindowConversation as y } from "../../hooks/useWindowConversation.js";
20
+ import { fold as b } from "./transcript-runs.js";
21
+ import { ComposerAttachments as x, MessageAttachments as S, replyFilesVisible as C } from "./ChatAttachments.js";
22
+ import { useEffect as w, useRef as T, useState as E } from "react";
23
+ import { jsx as D, jsxs as O } from "react/jsx-runtime";
24
+ import { useLocation as ee } from "react-router";
25
+ import te from "react-textarea-autosize";
24
26
  //#region src/components/agents/AgentChatPanel.impl.tsx
25
- var te = 80;
26
- function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docked: p = !1 }) {
27
- let m = _();
28
- v(m.conversationId);
29
- let E = l(), { pathname: D } = T(), { data: A } = n(), j = s ? t(E, D, A?.screens, A?.entities)?.title : void 0, M = l("errors"), [N, P] = S(""), [F, I] = S(null), L = x(null), [R, z] = S(!1), B = x(null), V = x(null), H = x(!0), [U, W] = S(!1), G = () => {
30
- let e = V.current;
27
+ var ne = 80;
28
+ function k({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docked: p = !1 }) {
29
+ let m = v();
30
+ y(m.conversationId);
31
+ let S = l(), { pathname: C } = ee(), { data: k } = n(), A = s ? t(S, C, k?.screens, k?.entities)?.title : void 0, M = l("errors"), [N, P] = E(""), [F, I] = E(null), L = T(null), [R, z] = E(!1), B = T(null), V = h({
32
+ entityCode: "agent_message",
33
+ fieldCode: "attachments"
34
+ }), H = T(null), U = T(null), W = T(!0), [G, K] = E(!1), q = () => {
35
+ let e = U.current;
31
36
  if (!e) return;
32
- let t = e.scrollHeight - e.scrollTop - e.clientHeight <= te;
33
- H.current = t, t && U && W(!1);
34
- }, K = (e = "smooth") => {
35
- let t = V.current;
37
+ let t = e.scrollHeight - e.scrollTop - e.clientHeight <= ne;
38
+ W.current = t, t && G && K(!1);
39
+ }, J = (e = "smooth") => {
40
+ let t = U.current;
36
41
  t && (t.scrollTo({
37
42
  top: t.scrollHeight,
38
43
  behavior: e
39
- }), H.current = !0, W(!1));
44
+ }), W.current = !0, K(!1));
40
45
  };
41
- if (b(() => {
42
- H.current ? K("smooth") : W(!0);
43
- }, [m.messages]), b(() => {
44
- e && K("instant");
45
- }, [e]), b(() => {
46
+ if (w(() => {
47
+ W.current ? J("smooth") : K(!0);
48
+ }, [m.messages]), w(() => {
49
+ e && J("instant");
50
+ }, [e]), w(() => {
46
51
  let t = f?.trim();
47
52
  e && t && L.current !== t && (L.current = t, B.current?.(t));
48
53
  }, [e, f]), !e) return null;
49
- let q = async (e) => {
50
- if (e.trim()) {
54
+ let Y = async (e) => {
55
+ let t = V.readyFiles, n = V.selections.filter((e) => e.state === "ready").map((e) => e.localId);
56
+ if ((e.trim() || t.length !== 0) && V.settled) {
51
57
  I(null), P("");
52
58
  try {
53
- await m.send(e, s);
59
+ await m.send(e, s, t), V.release(n);
54
60
  } catch (t) {
55
61
  console.error("agent send failed", t), I(a(M, t)), P(e);
56
62
  }
57
63
  }
58
64
  };
59
- B.current = q;
60
- let J = (e) => {
61
- e.key === "Enter" && !e.shiftKey && (e.preventDefault(), q(N));
62
- }, Y = m.invocations.filter((e) => e.status === "pending_approval"), X = m.invocations.filter((e) => e.kind === "input_request" && e.status === "pending_input"), le = m.turns.filter((e) => e.status === "queued" || e.status === "running" || e.status === "waiting" || e.status === "failed"), ue = m.invocations.filter((e) => e.status === "outcome_unknown"), de = m.messages.length === 0 && !m.turn.streaming, Z = Y.length > 0 || X.length > 0, Q = m.turn.streaming && !Z || m.turns.some((e) => e.status === "running"), fe = m.messages.some((e) => e.role === "assistant" && e.streaming && e.content.length > 0), $ = N.trim().length > 0;
63
- return /* @__PURE__ */ w("aside", {
65
+ B.current = Y;
66
+ let X = (e) => {
67
+ e.key === "Enter" && !e.shiftKey && (e.preventDefault(), Y(N));
68
+ }, Z = m.invocations.filter((e) => e.status === "pending_approval"), Q = m.invocations.filter((e) => e.kind === "input_request" && e.status === "pending_input"), de = m.turns.filter((e) => e.status === "queued" || e.status === "running" || e.status === "waiting" || e.status === "failed"), fe = m.invocations.filter((e) => e.status === "outcome_unknown"), pe = m.messages.length === 0 && !m.turn.streaming, me = Z.length > 0 || Q.length > 0, he = m.turn.streaming && !me || m.turns.some((e) => e.status === "running"), ge = m.messages.some((e) => e.role === "assistant" && e.streaming && e.content.length > 0), $ = (N.trim().length > 0 || V.readyFiles.length > 0) && V.settled;
69
+ return /* @__PURE__ */ O("aside", {
64
70
  style: {
65
71
  ...p ? {
66
72
  gridArea: "assistant",
@@ -81,7 +87,7 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
81
87
  flexDirection: "column"
82
88
  },
83
89
  children: [
84
- /* @__PURE__ */ w("div", {
90
+ /* @__PURE__ */ O("div", {
85
91
  style: {
86
92
  display: "flex",
87
93
  alignItems: "center",
@@ -90,7 +96,7 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
90
96
  borderBottom: "1px solid var(--divider)"
91
97
  },
92
98
  children: [
93
- /* @__PURE__ */ C("span", {
99
+ /* @__PURE__ */ D("span", {
94
100
  style: {
95
101
  width: 22,
96
102
  height: 22,
@@ -100,21 +106,21 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
100
106
  alignItems: "center",
101
107
  justifyContent: "center"
102
108
  },
103
- children: /* @__PURE__ */ C(o.sparkle, {
109
+ children: /* @__PURE__ */ D(o.sparkle, {
104
110
  size: 13,
105
111
  style: { color: "var(--accent-foreground)" }
106
112
  })
107
113
  }),
108
- /* @__PURE__ */ w("div", {
114
+ /* @__PURE__ */ O("div", {
109
115
  style: { flex: 1 },
110
- children: [/* @__PURE__ */ C("div", {
116
+ children: [/* @__PURE__ */ D("div", {
111
117
  style: {
112
118
  fontSize: 12.5,
113
119
  fontWeight: 600,
114
120
  color: "var(--text)"
115
121
  },
116
122
  children: d
117
- }), /* @__PURE__ */ w("div", {
123
+ }), /* @__PURE__ */ O("div", {
118
124
  style: {
119
125
  fontSize: 10.5,
120
126
  color: "var(--text-3)",
@@ -122,63 +128,63 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
122
128
  alignItems: "center",
123
129
  gap: 4
124
130
  },
125
- children: [/* @__PURE__ */ C("span", { style: {
131
+ children: [/* @__PURE__ */ D("span", { style: {
126
132
  width: 5,
127
133
  height: 5,
128
134
  background: "var(--success)",
129
135
  borderRadius: 999
130
- } }), i(E("agent.panel.context", "context: {context}"), { context: /* @__PURE__ */ C("span", { children: j || E("agent.panel.context_platform", "Platform") }) })]
136
+ } }), i(S("agent.panel.context", "context: {context}"), { context: /* @__PURE__ */ D("span", { children: A || S("agent.panel.context_platform", "Platform") }) })]
131
137
  })]
132
138
  }),
133
- m.messages.length > 0 && /* @__PURE__ */ C(c, {
139
+ m.messages.length > 0 && /* @__PURE__ */ D(c, {
134
140
  size: 24,
135
- icon: /* @__PURE__ */ C(o.copy, { size: 12 }),
136
- onClick: () => void se(E, m.messages),
137
- title: E("agent.panel.copy_all", "Copy entire conversation")
141
+ icon: /* @__PURE__ */ D(o.copy, { size: 12 }),
142
+ onClick: () => void le(S, m.messages),
143
+ title: S("agent.panel.copy_all", "Copy entire conversation")
138
144
  }),
139
- /* @__PURE__ */ C(c, {
145
+ /* @__PURE__ */ D(c, {
140
146
  size: 24,
141
- icon: /* @__PURE__ */ C(o.clock, { size: 12 }),
147
+ icon: /* @__PURE__ */ D(o.clock, { size: 12 }),
142
148
  onClick: () => {
143
149
  z((e) => !e), m.refreshConversations();
144
150
  },
145
- title: E("agent.panel.earlier", "Earlier conversations")
151
+ title: S("agent.panel.earlier", "Earlier conversations")
146
152
  }),
147
- m.conversationId && /* @__PURE__ */ C(c, {
153
+ m.conversationId && /* @__PURE__ */ D(c, {
148
154
  size: 24,
149
- icon: /* @__PURE__ */ C(o.plus, { size: 12 }),
155
+ icon: /* @__PURE__ */ D(o.plus, { size: 12 }),
150
156
  onClick: m.startNew,
151
- title: E("agent.panel.new_conversation", "New conversation")
157
+ title: S("agent.panel.new_conversation", "New conversation")
152
158
  }),
153
- /* @__PURE__ */ C(c, {
159
+ /* @__PURE__ */ D(c, {
154
160
  size: 24,
155
- icon: /* @__PURE__ */ C(o.settings, { size: 12 }),
156
- title: E("agent.panel.preferences", "Preferences")
161
+ icon: /* @__PURE__ */ D(o.settings, { size: 12 }),
162
+ title: S("agent.panel.preferences", "Preferences")
157
163
  }),
158
- /* @__PURE__ */ C(c, {
164
+ /* @__PURE__ */ D(c, {
159
165
  size: 24,
160
- icon: /* @__PURE__ */ C(o.x, { size: 13 }),
166
+ icon: /* @__PURE__ */ D(o.x, { size: 13 }),
161
167
  onClick: r,
162
- title: E("agent.panel.close", "Close")
168
+ title: S("agent.panel.close", "Close")
163
169
  })
164
170
  ]
165
171
  }),
166
- !m.conversationId && /* @__PURE__ */ C(g, {
172
+ !m.conversationId && /* @__PURE__ */ D(_, {
167
173
  agents: m.agents,
168
174
  selectedId: m.selectedAgentId,
169
175
  onSelect: m.selectAgent,
170
- label: E("agent.panel.agent", "Agent")
176
+ label: S("agent.panel.agent", "Agent")
171
177
  }),
172
- R && /* @__PURE__ */ C(ae, {
178
+ R && /* @__PURE__ */ D(se, {
173
179
  conversations: m.conversations,
174
180
  currentId: m.conversationId,
175
181
  onPick: (e) => {
176
182
  m.setConversationId(e), z(!1);
177
183
  }
178
184
  }),
179
- /* @__PURE__ */ w("div", {
180
- ref: V,
181
- onScroll: G,
185
+ /* @__PURE__ */ O("div", {
186
+ ref: U,
187
+ onScroll: q,
182
188
  style: {
183
189
  flex: 1,
184
190
  overflowY: "auto",
@@ -189,21 +195,24 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
189
195
  position: "relative"
190
196
  },
191
197
  children: [
192
- de && /* @__PURE__ */ C(O, { children: E("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?") }),
193
- y(m.messages, m.invocations).map((e) => e.kind === "message" ? /* @__PURE__ */ C(oe, { message: e.message }, e.message.id) : /* @__PURE__ */ C(ie, { run: e }, e.id)),
194
- le.map((e) => /* @__PURE__ */ C(k, { agentTurn: e }, e.id)),
195
- Y.map((e) => /* @__PURE__ */ C(ce, {
198
+ pe && /* @__PURE__ */ D(j, { children: S("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?") }),
199
+ b(m.messages, m.invocations).map((e) => e.kind === "message" ? /* @__PURE__ */ D(ce, {
200
+ message: e.message,
201
+ turns: m.turns
202
+ }, e.message.id) : /* @__PURE__ */ D(oe, { run: e }, e.id)),
203
+ de.map((e) => /* @__PURE__ */ D(re, { agentTurn: e }, e.id)),
204
+ Z.map((e) => /* @__PURE__ */ D(ue, {
196
205
  tool: e,
197
206
  onApprove: async (t) => m.approve(e.id, t),
198
207
  onReject: async (t) => m.reject(e.id, t)
199
208
  }, e.id)),
200
- X.map((e) => /* @__PURE__ */ C(h, {
201
- ...ne(E, e),
209
+ Q.map((e) => /* @__PURE__ */ D(g, {
210
+ ...ie(S, e),
202
211
  onSubmit: (t) => void m.submitInput(e.id, t),
203
212
  onCancel: () => void m.cancelInput(e.id)
204
213
  }, e.id)),
205
- ue.map((e) => /* @__PURE__ */ C(re, { invocation: e }, e.id)),
206
- Q && !fe && /* @__PURE__ */ w("div", {
214
+ fe.map((e) => /* @__PURE__ */ D(ae, { invocation: e }, e.id)),
215
+ he && !ge && /* @__PURE__ */ O("div", {
207
216
  style: {
208
217
  display: "flex",
209
218
  gap: 6,
@@ -211,9 +220,9 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
211
220
  color: "var(--text-3)",
212
221
  fontSize: 11.5
213
222
  },
214
- children: [/* @__PURE__ */ C(u, { size: 12 }), E("agent.panel.thinking", "Thinking…")]
223
+ children: [/* @__PURE__ */ D(u, { size: 12 }), S("agent.panel.thinking", "Thinking…")]
215
224
  }),
216
- F && /* @__PURE__ */ C("div", {
225
+ F && /* @__PURE__ */ D("div", {
217
226
  style: {
218
227
  padding: "8px 10px",
219
228
  background: "var(--surface-2)",
@@ -222,12 +231,12 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
222
231
  fontSize: 11.5,
223
232
  color: "var(--text-2)"
224
233
  },
225
- children: /* @__PURE__ */ C("strong", { children: F })
234
+ children: /* @__PURE__ */ D("strong", { children: F })
226
235
  })
227
236
  ]
228
237
  }),
229
- U && /* @__PURE__ */ w("button", {
230
- onClick: () => K("smooth"),
238
+ G && /* @__PURE__ */ O("button", {
239
+ onClick: () => J("smooth"),
231
240
  style: {
232
241
  position: "absolute",
233
242
  right: 16,
@@ -246,103 +255,131 @@ function E({ open: e, onClose: r, context: s, title: d = "", askOnOpen: f, docke
246
255
  gap: 4,
247
256
  zIndex: 1
248
257
  },
249
- children: [/* @__PURE__ */ C(o.arrowDown, { size: 11 }), E("agent.panel.jump_latest", "Jump to latest")]
258
+ children: [/* @__PURE__ */ D(o.arrowDown, { size: 11 }), S("agent.panel.jump_latest", "Jump to latest")]
250
259
  }),
251
- /* @__PURE__ */ w("div", {
260
+ /* @__PURE__ */ O("div", {
252
261
  style: {
253
262
  padding: 10,
254
263
  borderTop: "1px solid var(--divider)",
255
264
  background: "var(--surface-2)"
256
265
  },
257
- children: [/* @__PURE__ */ w("div", {
258
- style: {
259
- display: "flex",
260
- alignItems: "flex-end",
261
- gap: 6,
262
- padding: 6,
263
- background: "var(--surface)",
264
- border: "1px solid var(--border)",
265
- borderRadius: "var(--radius-md)"
266
- },
267
- children: [
268
- /* @__PURE__ */ C(ee, {
269
- value: N,
270
- onChange: (e) => P(e.target.value),
271
- onKeyDown: J,
272
- placeholder: E("agent.panel.ask_placeholder", "Ask or describe what you want…"),
273
- minRows: 1,
274
- maxRows: 8,
275
- style: {
276
- flex: 1,
277
- border: 0,
278
- outline: 0,
279
- background: "transparent",
280
- resize: "none",
281
- fontSize: 12.5,
282
- lineHeight: 1.5,
283
- color: "var(--text)",
284
- padding: "4px 6px",
285
- fontFamily: "inherit"
286
- }
287
- }),
288
- /* @__PURE__ */ C(c, {
289
- size: 26,
290
- icon: /* @__PURE__ */ C(o.paperclip, { size: 12 }),
291
- title: E("agent.panel.attach_context", "Attach context")
292
- }),
293
- Q ? /* @__PURE__ */ C("button", {
294
- onClick: () => void m.cancel(),
295
- "aria-label": E("agent.panel.stop", "Stop generating"),
296
- title: E("agent.panel.stop", "Stop generating"),
297
- style: {
298
- width: 26,
299
- height: 26,
300
- borderRadius: "var(--radius-md)",
301
- border: 0,
302
- cursor: "pointer",
303
- background: "var(--destructive)",
304
- color: "var(--destructive-foreground)",
305
- display: "inline-flex",
306
- alignItems: "center",
307
- justifyContent: "center"
308
- },
309
- children: /* @__PURE__ */ C(o.x, { size: 13 })
310
- }) : /* @__PURE__ */ C("button", {
311
- onClick: () => void q(N),
312
- disabled: !$,
313
- "aria-label": E("agent.panel.send", "Send"),
314
- style: {
315
- width: 26,
316
- height: 26,
317
- borderRadius: "var(--radius-md)",
318
- border: 0,
319
- cursor: $ ? "pointer" : "default",
320
- background: $ ? "var(--accent)" : "var(--surface-3)",
321
- color: $ ? "var(--accent-foreground)" : "var(--text-4)",
322
- display: "inline-flex",
323
- alignItems: "center",
324
- justifyContent: "center"
325
- },
326
- children: /* @__PURE__ */ C(o.arrowUp, { size: 13 })
327
- })
328
- ]
329
- }), /* @__PURE__ */ w("div", {
330
- style: {
331
- display: "flex",
332
- alignItems: "center",
333
- gap: 6,
334
- marginTop: 6,
335
- fontSize: 10.5,
336
- color: "var(--text-4)"
337
- },
338
- children: [/* @__PURE__ */ C(o.shield, { size: 10 }), /* @__PURE__ */ C("span", { children: E("agent.panel.footer", "Runs within your permissions. All actions audit-logged.") })]
339
- })]
266
+ children: [
267
+ /* @__PURE__ */ D(x, {
268
+ selections: V.selections,
269
+ onCancel: V.cancel,
270
+ onRemove: V.remove
271
+ }),
272
+ V.failed && /* @__PURE__ */ D("div", {
273
+ role: "status",
274
+ style: {
275
+ fontSize: 11,
276
+ color: "var(--destructive)",
277
+ paddingBottom: 6
278
+ },
279
+ children: S("agent.panel.remove_failed_files", "Remove the files that failed to upload to send the message.")
280
+ }),
281
+ /* @__PURE__ */ O("div", {
282
+ style: {
283
+ display: "flex",
284
+ alignItems: "flex-end",
285
+ gap: 6,
286
+ padding: 6,
287
+ background: "var(--surface)",
288
+ border: "1px solid var(--border)",
289
+ borderRadius: "var(--radius-md)"
290
+ },
291
+ children: [
292
+ /* @__PURE__ */ D(te, {
293
+ value: N,
294
+ onChange: (e) => P(e.target.value),
295
+ onKeyDown: X,
296
+ placeholder: S("agent.panel.ask_placeholder", "Ask or describe what you want…"),
297
+ minRows: 1,
298
+ maxRows: 8,
299
+ style: {
300
+ flex: 1,
301
+ border: 0,
302
+ outline: 0,
303
+ background: "transparent",
304
+ resize: "none",
305
+ fontSize: 12.5,
306
+ lineHeight: 1.5,
307
+ color: "var(--text)",
308
+ padding: "4px 6px",
309
+ fontFamily: "inherit"
310
+ }
311
+ }),
312
+ /* @__PURE__ */ D("input", {
313
+ ref: H,
314
+ type: "file",
315
+ multiple: !0,
316
+ hidden: !0,
317
+ "data-testid": "agent-chat-file-input",
318
+ onChange: (e) => {
319
+ e.target.files && V.add(e.target.files), e.target.value = "";
320
+ }
321
+ }),
322
+ /* @__PURE__ */ D(c, {
323
+ size: 26,
324
+ icon: /* @__PURE__ */ D(o.paperclip, { size: 12 }),
325
+ onClick: () => H.current?.click(),
326
+ title: S("agent.panel.attach_files", "Attach files")
327
+ }),
328
+ he ? /* @__PURE__ */ D("button", {
329
+ onClick: () => void m.cancel(),
330
+ "aria-label": S("agent.panel.stop", "Stop generating"),
331
+ title: S("agent.panel.stop", "Stop generating"),
332
+ style: {
333
+ width: 26,
334
+ height: 26,
335
+ borderRadius: "var(--radius-md)",
336
+ border: 0,
337
+ cursor: "pointer",
338
+ background: "var(--destructive)",
339
+ color: "var(--destructive-foreground)",
340
+ display: "inline-flex",
341
+ alignItems: "center",
342
+ justifyContent: "center"
343
+ },
344
+ children: /* @__PURE__ */ D(o.x, { size: 13 })
345
+ }) : /* @__PURE__ */ D("button", {
346
+ onClick: () => void Y(N),
347
+ disabled: !$,
348
+ "aria-label": S("agent.panel.send", "Send"),
349
+ style: {
350
+ width: 26,
351
+ height: 26,
352
+ borderRadius: "var(--radius-md)",
353
+ border: 0,
354
+ cursor: $ ? "pointer" : "default",
355
+ background: $ ? "var(--accent)" : "var(--surface-3)",
356
+ color: $ ? "var(--accent-foreground)" : "var(--text-4)",
357
+ display: "inline-flex",
358
+ alignItems: "center",
359
+ justifyContent: "center"
360
+ },
361
+ children: /* @__PURE__ */ D(o.arrowUp, { size: 13 })
362
+ })
363
+ ]
364
+ }),
365
+ /* @__PURE__ */ O("div", {
366
+ style: {
367
+ display: "flex",
368
+ alignItems: "center",
369
+ gap: 6,
370
+ marginTop: 6,
371
+ fontSize: 10.5,
372
+ color: "var(--text-4)"
373
+ },
374
+ children: [/* @__PURE__ */ D(o.shield, { size: 10 }), /* @__PURE__ */ D("span", { children: S("agent.panel.footer", "Runs within your permissions. All actions audit-logged.") })]
375
+ })
376
+ ]
340
377
  })
341
378
  ]
342
379
  });
343
380
  }
344
- function D() {
345
- return /* @__PURE__ */ C("span", {
381
+ function A() {
382
+ return /* @__PURE__ */ D("span", {
346
383
  "aria-hidden": !0,
347
384
  style: {
348
385
  display: "inline-block",
@@ -355,8 +392,8 @@ function D() {
355
392
  }
356
393
  });
357
394
  }
358
- function O({ children: e, dataMessageId: t, dataStreaming: n }) {
359
- return /* @__PURE__ */ w("div", {
395
+ function j({ children: e, dataMessageId: t, dataStreaming: n }) {
396
+ return /* @__PURE__ */ O("div", {
360
397
  "data-message-id": t,
361
398
  "data-streaming": n ? "true" : void 0,
362
399
  style: {
@@ -364,7 +401,7 @@ function O({ children: e, dataMessageId: t, dataStreaming: n }) {
364
401
  gap: 8,
365
402
  alignItems: "flex-start"
366
403
  },
367
- children: [/* @__PURE__ */ C("span", {
404
+ children: [/* @__PURE__ */ D("span", {
368
405
  style: {
369
406
  width: 20,
370
407
  height: 20,
@@ -377,8 +414,8 @@ function O({ children: e, dataMessageId: t, dataStreaming: n }) {
377
414
  flexShrink: 0,
378
415
  marginTop: 2
379
416
  },
380
- children: /* @__PURE__ */ C(o.sparkle, { size: 11 })
381
- }), /* @__PURE__ */ C("div", {
417
+ children: /* @__PURE__ */ D(o.sparkle, { size: 11 })
418
+ }), /* @__PURE__ */ D("div", {
382
419
  style: {
383
420
  flex: 1,
384
421
  minWidth: 0,
@@ -390,9 +427,9 @@ function O({ children: e, dataMessageId: t, dataStreaming: n }) {
390
427
  })]
391
428
  });
392
429
  }
393
- function k({ agentTurn: t }) {
430
+ function re({ agentTurn: t }) {
394
431
  let n = l(), r = l("errors"), i = p("agent_turn")?.fields.get("status"), a = t.status === "failed" ? r(t.error_code ?? "", e(t.error_details) || r("agents.turn_failed", "The assistant could not finish this turn.")) : void 0;
395
- return /* @__PURE__ */ w("div", {
432
+ return /* @__PURE__ */ O("div", {
396
433
  "data-agent-turn": t.id,
397
434
  "data-turn-status": t.status,
398
435
  style: {
@@ -407,21 +444,21 @@ function k({ agentTurn: t }) {
407
444
  ]
408
445
  });
409
446
  }
410
- function ne(e, t) {
447
+ function ie(e, t) {
411
448
  let n = e("agent.panel.input_needed", "Your response is needed."), r = t.question;
412
449
  if (r && (r.message || r.schema)) return {
413
450
  message: r.message || t.reason || n,
414
- schema: A(r.schema) ? r.schema : {}
451
+ schema: M(r.schema) ? r.schema : {}
415
452
  };
416
453
  let i = t.params ?? {};
417
454
  return {
418
455
  message: typeof i.message == "string" ? i.message : t.reason || n,
419
- schema: A(i.schema) ? i.schema : {}
456
+ schema: M(i.schema) ? i.schema : {}
420
457
  };
421
458
  }
422
- function re({ invocation: e }) {
459
+ function ae({ invocation: e }) {
423
460
  let t = l();
424
- return /* @__PURE__ */ C("div", {
461
+ return /* @__PURE__ */ D("div", {
425
462
  "data-agent-invocation": e.id,
426
463
  "data-invocation-status": "outcome_unknown",
427
464
  style: {
@@ -432,33 +469,33 @@ function re({ invocation: e }) {
432
469
  fontSize: 11.5,
433
470
  color: "var(--text-2)"
434
471
  },
435
- children: i(t("agent.panel.outcome_uncertain", "The outcome of {tool} is unknown. It was not retried automatically."), { tool: /* @__PURE__ */ C("span", {
472
+ children: i(t("agent.panel.outcome_uncertain", "The outcome of {tool} is unknown. It was not retried automatically."), { tool: /* @__PURE__ */ D("span", {
436
473
  className: "mono",
437
474
  children: e.tool_code
438
475
  }) })
439
476
  });
440
477
  }
441
- function A(e) {
478
+ function M(e) {
442
479
  return typeof e == "object" && !!e && !Array.isArray(e);
443
480
  }
444
- function ie({ run: e }) {
445
- let [t, n] = S(!1), r = j(), i = e.calls.filter((e) => e.isError).length, a = e.calls.filter((e) => !N(e.status)).length;
446
- return /* @__PURE__ */ w("div", {
481
+ function oe({ run: e }) {
482
+ let [t, n] = E(!1), r = N(), i = e.calls.filter((e) => e.isError).length, a = e.calls.filter((e) => !F(e.status)).length;
483
+ return /* @__PURE__ */ O("div", {
447
484
  "data-activity-run": e.id,
448
485
  style: {
449
486
  display: "flex",
450
487
  gap: 8,
451
488
  alignItems: "flex-start"
452
489
  },
453
- children: [/* @__PURE__ */ C("span", { style: {
490
+ children: [/* @__PURE__ */ D("span", { style: {
454
491
  width: 20,
455
492
  flexShrink: 0
456
- } }), /* @__PURE__ */ w("div", {
493
+ } }), /* @__PURE__ */ O("div", {
457
494
  style: {
458
495
  flex: 1,
459
496
  minWidth: 0
460
497
  },
461
- children: [/* @__PURE__ */ w("button", {
498
+ children: [/* @__PURE__ */ O("button", {
462
499
  type: "button",
463
500
  onClick: () => n((e) => !e),
464
501
  "data-activity-toggle": !0,
@@ -476,23 +513,23 @@ function ie({ run: e }) {
476
513
  borderRadius: 999,
477
514
  cursor: "pointer"
478
515
  },
479
- children: [/* @__PURE__ */ C("span", {
516
+ children: [/* @__PURE__ */ D("span", {
480
517
  "aria-hidden": !0,
481
518
  children: t ? "▾" : "▸"
482
- }), /* @__PURE__ */ C("span", { children: r(e.calls.length, a, i) })]
483
- }), t && /* @__PURE__ */ C("div", {
519
+ }), /* @__PURE__ */ D("span", { children: r(e.calls.length, a, i) })]
520
+ }), t && /* @__PURE__ */ D("div", {
484
521
  style: {
485
522
  marginTop: 4,
486
523
  display: "flex",
487
524
  flexDirection: "column",
488
525
  gap: 3
489
526
  },
490
- children: e.calls.map((e) => /* @__PURE__ */ C(M, { call: e }, e.id))
527
+ children: e.calls.map((e) => /* @__PURE__ */ D(P, { call: e }, e.id))
491
528
  })]
492
529
  })]
493
530
  });
494
531
  }
495
- function j() {
532
+ function N() {
496
533
  let e = l();
497
534
  return (t, n, i) => {
498
535
  let a = [];
@@ -505,12 +542,12 @@ function j() {
505
542
  })), a.join(" · ") || e("agent.panel.worked", "worked");
506
543
  };
507
544
  }
508
- function M({ call: e }) {
509
- let [t, n] = S(!1), r = l(), i = P(e.name), a = p("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";
510
- return /* @__PURE__ */ w("div", {
545
+ function P({ call: e }) {
546
+ let [t, n] = E(!1), r = l(), i = I(e.name), a = p("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" : F(e.status) ? "ok" : "running";
547
+ return /* @__PURE__ */ O("div", {
511
548
  "data-activity-call": e.name,
512
549
  "data-call-state": c,
513
- children: [/* @__PURE__ */ w("button", {
550
+ children: [/* @__PURE__ */ O("button", {
514
551
  type: "button",
515
552
  onClick: () => n((e) => !e),
516
553
  style: {
@@ -525,20 +562,20 @@ function M({ call: e }) {
525
562
  color: c === "failed" ? "var(--danger)" : "var(--text-2)"
526
563
  },
527
564
  children: [
528
- /* @__PURE__ */ C("span", {
565
+ /* @__PURE__ */ D("span", {
529
566
  "aria-hidden": !0,
530
567
  children: t ? "▾" : "▸"
531
568
  }),
532
- /* @__PURE__ */ C("span", {
569
+ /* @__PURE__ */ D("span", {
533
570
  className: "mono",
534
571
  children: i
535
572
  }),
536
- /* @__PURE__ */ C("span", {
573
+ /* @__PURE__ */ D("span", {
537
574
  style: { color: "var(--text-3)" },
538
575
  children: s
539
576
  })
540
577
  ]
541
- }), t && /* @__PURE__ */ C("pre", {
578
+ }), t && /* @__PURE__ */ D("pre", {
542
579
  style: {
543
580
  margin: "2px 0 0 18px",
544
581
  padding: 6,
@@ -559,26 +596,26 @@ function M({ call: e }) {
559
596
  })]
560
597
  });
561
598
  }
562
- function N(e) {
599
+ function F(e) {
563
600
  return e === "succeeded" || e === "failed" || e === "rejected" || e === "canceled" || e === "outcome_unknown";
564
601
  }
565
- function ae({ conversations: e, currentId: t, onPick: n }) {
602
+ function se({ conversations: e, currentId: t, onPick: n }) {
566
603
  let r = l();
567
- return e.length === 0 ? /* @__PURE__ */ C("div", {
604
+ return e.length === 0 ? /* @__PURE__ */ D("div", {
568
605
  style: {
569
606
  padding: "8px 12px",
570
607
  fontSize: 11.5,
571
608
  color: "var(--text-3)"
572
609
  },
573
610
  children: r("agent.panel.no_earlier", "No earlier conversations.")
574
- }) : /* @__PURE__ */ C("div", {
611
+ }) : /* @__PURE__ */ D("div", {
575
612
  "data-conversation-list": !0,
576
613
  style: {
577
614
  maxHeight: 200,
578
615
  overflowY: "auto",
579
616
  borderBottom: "1px solid var(--border)"
580
617
  },
581
- children: e.map((e) => /* @__PURE__ */ C("button", {
618
+ children: e.map((e) => /* @__PURE__ */ D("button", {
582
619
  type: "button",
583
620
  "data-conversation-id": e.id,
584
621
  onClick: () => n(e.id),
@@ -597,44 +634,65 @@ function ae({ conversations: e, currentId: t, onPick: n }) {
597
634
  }, e.id))
598
635
  });
599
636
  }
600
- function P(e) {
637
+ function I(e) {
601
638
  let t = l(), { value: r } = d("agents.transcript_names", "code"), { data: i } = n();
602
- return r === "display" && t(i?.actions?.[e]?.display?.name ?? F(i, e)) || e;
639
+ return r === "display" && t(i?.actions?.[e]?.display?.name ?? L(i, e)) || e;
603
640
  }
604
- function F(e, t) {
641
+ function L(e, t) {
605
642
  let n = t.indexOf(".");
606
643
  if (!(n < 0)) return e?.entities?.[t.slice(0, n)]?.actions?.[t.slice(n + 1)]?.display?.name;
607
644
  }
608
- function oe({ message: e }) {
645
+ function ce({ message: e, turns: t }) {
646
+ let n = C(e, t) ? e.attachments : void 0;
609
647
  if (e.role === "user") {
610
- let t = H(e.content), n = e.content.some((e) => e.type !== "text" && e.type !== "location");
611
- return t && !n ? /* @__PURE__ */ C("div", {
648
+ let t = W(e.content);
649
+ return e.content.some((e) => e.type !== "text" && e.type !== "location") ? /* @__PURE__ */ D(R, {
650
+ message: e,
651
+ files: n
652
+ }) : /* @__PURE__ */ O("div", {
612
653
  style: {
613
654
  alignSelf: "flex-end",
614
655
  maxWidth: "80%",
615
- padding: "8px 12px",
616
- background: "var(--inverted-surface)",
617
- color: "var(--inverted-surface-fg)",
618
- borderRadius: "var(--radius-lg)",
619
- fontSize: 12.5,
620
- lineHeight: 1.5
656
+ display: "flex",
657
+ flexDirection: "column",
658
+ alignItems: "flex-end"
621
659
  },
622
660
  "data-message-id": e.id,
623
661
  "data-streaming": e.streaming ? "true" : void 0,
624
- children: t
625
- }) : /* @__PURE__ */ C(I, { message: e });
662
+ children: [t && /* @__PURE__ */ D("div", {
663
+ style: {
664
+ padding: "8px 12px",
665
+ background: "var(--inverted-surface)",
666
+ color: "var(--inverted-surface-fg)",
667
+ borderRadius: "var(--radius-lg)",
668
+ fontSize: 12.5,
669
+ lineHeight: 1.5
670
+ },
671
+ children: t
672
+ }), /* @__PURE__ */ D(S, {
673
+ files: n,
674
+ align: "end"
675
+ })]
676
+ });
626
677
  }
627
- return e.role === "tool" ? /* @__PURE__ */ C(I, { message: e }) : e.role === "system" ? e.content.some((e) => e.type === "decision") ? /* @__PURE__ */ C(I, { message: e }) : /* @__PURE__ */ C(O, {
678
+ return e.role === "tool" ? /* @__PURE__ */ D(R, { message: e }) : e.role === "system" ? e.content.some((e) => e.type === "decision") ? /* @__PURE__ */ D(R, { message: e }) : /* @__PURE__ */ D(j, {
628
679
  dataMessageId: e.id,
629
- children: e.content.map((e, t) => /* @__PURE__ */ C(B, { block: e }, t))
630
- }) : e.content.length === 0 ? null : /* @__PURE__ */ w(O, {
680
+ children: e.content.map((e, t) => /* @__PURE__ */ D(H, { block: e }, t))
681
+ }) : e.content.length === 0 && !n?.length ? null : /* @__PURE__ */ O(j, {
631
682
  dataMessageId: e.id,
632
683
  dataStreaming: e.streaming,
633
- children: [e.content.map((e, t) => /* @__PURE__ */ C(B, { block: e }, t)), e.streaming && /* @__PURE__ */ C(D, {})]
684
+ children: [
685
+ e.content.map((e, t) => /* @__PURE__ */ D(H, { block: e }, t)),
686
+ e.streaming && /* @__PURE__ */ D(A, {}),
687
+ /* @__PURE__ */ D(S, {
688
+ files: n,
689
+ align: "start"
690
+ })
691
+ ]
634
692
  });
635
693
  }
636
- function I({ message: e }) {
637
- return /* @__PURE__ */ C("div", {
694
+ function R({ message: e, files: t }) {
695
+ return /* @__PURE__ */ O("div", {
638
696
  "data-message-id": e.id,
639
697
  "data-streaming": e.streaming ? "true" : void 0,
640
698
  style: {
@@ -644,15 +702,18 @@ function I({ message: e }) {
644
702
  flexDirection: "column",
645
703
  alignItems: "flex-end"
646
704
  },
647
- children: e.content.map((e, t) => /* @__PURE__ */ C(B, { block: e }, t))
705
+ children: [e.content.map((e, t) => /* @__PURE__ */ D(H, { block: e }, t)), /* @__PURE__ */ D(S, {
706
+ files: t,
707
+ align: "end"
708
+ })]
648
709
  });
649
710
  }
650
- function L({ href: e, children: t, ...n }) {
711
+ function z({ href: e, children: t, ...n }) {
651
712
  let r = f(), i = {
652
713
  color: "var(--accent-text)",
653
714
  textDecoration: "underline"
654
- }, a = R(e);
655
- return a ? /* @__PURE__ */ C("a", {
715
+ }, a = B(e);
716
+ return a ? /* @__PURE__ */ D("a", {
656
717
  ...n,
657
718
  href: e,
658
719
  style: i,
@@ -660,7 +721,7 @@ function L({ href: e, children: t, ...n }) {
660
721
  e.preventDefault(), r(a);
661
722
  },
662
723
  children: t
663
- }) : /* @__PURE__ */ C("a", {
724
+ }) : /* @__PURE__ */ D("a", {
664
725
  ...n,
665
726
  href: e,
666
727
  target: "_blank",
@@ -669,7 +730,7 @@ function L({ href: e, children: t, ...n }) {
669
730
  children: t
670
731
  });
671
732
  }
672
- function R(e) {
733
+ function B(e) {
673
734
  if (typeof e != "string") return null;
674
735
  let t;
675
736
  try {
@@ -679,10 +740,10 @@ function R(e) {
679
740
  }
680
741
  return t.origin === window.location.origin ? `${t.pathname}${t.search}${t.hash}` : null;
681
742
  }
682
- var z = {
683
- a: L,
743
+ var V = {
744
+ a: z,
684
745
  code({ node: e, inline: t, className: n, children: r, ...i }) {
685
- return t ? /* @__PURE__ */ C("code", {
746
+ return t ? /* @__PURE__ */ D("code", {
686
747
  ...i,
687
748
  style: {
688
749
  background: "var(--surface-2)",
@@ -692,7 +753,7 @@ var z = {
692
753
  fontSize: "0.92em"
693
754
  },
694
755
  children: r
695
- }) : /* @__PURE__ */ C("pre", {
756
+ }) : /* @__PURE__ */ D("pre", {
696
757
  style: {
697
758
  background: "var(--surface-2)",
698
759
  border: "1px solid var(--border)",
@@ -703,7 +764,7 @@ var z = {
703
764
  fontSize: 11.5,
704
765
  lineHeight: 1.5
705
766
  },
706
- children: /* @__PURE__ */ C("code", {
767
+ children: /* @__PURE__ */ D("code", {
707
768
  className: n,
708
769
  ...i,
709
770
  children: r
@@ -711,7 +772,7 @@ var z = {
711
772
  });
712
773
  },
713
774
  ul({ children: e, ...t }) {
714
- return /* @__PURE__ */ C("ul", {
775
+ return /* @__PURE__ */ D("ul", {
715
776
  ...t,
716
777
  style: {
717
778
  paddingLeft: 18,
@@ -721,7 +782,7 @@ var z = {
721
782
  });
722
783
  },
723
784
  ol({ children: e, ...t }) {
724
- return /* @__PURE__ */ C("ol", {
785
+ return /* @__PURE__ */ D("ol", {
725
786
  ...t,
726
787
  style: {
727
788
  paddingLeft: 20,
@@ -731,51 +792,51 @@ var z = {
731
792
  });
732
793
  },
733
794
  p({ children: e, ...t }) {
734
- return /* @__PURE__ */ C("p", {
795
+ return /* @__PURE__ */ D("p", {
735
796
  ...t,
736
797
  style: { margin: "4px 0" },
737
798
  children: e
738
799
  });
739
800
  }
740
801
  };
741
- function B({ block: e }) {
802
+ function H({ block: e }) {
742
803
  let t = l();
743
804
  switch (e.type) {
744
- case "text": return /* @__PURE__ */ C("div", {
805
+ case "text": return /* @__PURE__ */ D("div", {
745
806
  className: "agent-md",
746
- children: /* @__PURE__ */ C(m, {
807
+ children: /* @__PURE__ */ D(m, {
747
808
  content: e.text,
748
809
  plugins: "gfm",
749
810
  prose: !1,
750
811
  skipHtml: !1,
751
- components: z
812
+ components: V
752
813
  })
753
814
  });
754
815
  case "tool_use": {
755
- let n = U(t, e.name, e.input);
756
- return /* @__PURE__ */ C(V, {
816
+ let n = G(t, e.name, e.input);
817
+ return /* @__PURE__ */ D(U, {
757
818
  kind: "call",
758
819
  label: n.label,
759
820
  sub: n.sub,
760
821
  body: e.input
761
822
  });
762
823
  }
763
- case "tool_result": return /* @__PURE__ */ C(V, {
824
+ case "tool_result": return /* @__PURE__ */ D(U, {
764
825
  kind: "result",
765
- label: W(t, e),
826
+ label: K(t, e),
766
827
  body: e.output,
767
828
  isError: !!e.is_error
768
829
  });
769
- case "elicit_response": return /* @__PURE__ */ C(V, {
830
+ case "elicit_response": return /* @__PURE__ */ D(U, {
770
831
  kind: "result",
771
832
  label: t("agent.panel.chip.answer", "answer"),
772
833
  body: e.data
773
834
  });
774
- case "decision": return /* @__PURE__ */ C(K, { block: e });
835
+ case "decision": return /* @__PURE__ */ D(J, { block: e });
775
836
  case "location":
776
837
  case "thinking":
777
838
  case "redacted_thinking": return null;
778
- case "system": return /* @__PURE__ */ w("div", {
839
+ case "system": return /* @__PURE__ */ O("div", {
779
840
  style: {
780
841
  fontSize: 10.5,
781
842
  fontStyle: "italic",
@@ -783,7 +844,7 @@ function B({ block: e }) {
783
844
  },
784
845
  children: ["— ", e.reason]
785
846
  });
786
- case "summary": return /* @__PURE__ */ C("div", {
847
+ case "summary": return /* @__PURE__ */ D("div", {
787
848
  style: {
788
849
  fontSize: 10.5,
789
850
  fontStyle: "italic",
@@ -791,7 +852,7 @@ function B({ block: e }) {
791
852
  },
792
853
  children: e.text
793
854
  });
794
- case "attachment": return /* @__PURE__ */ C("pre", {
855
+ case "attachment": return /* @__PURE__ */ D("pre", {
795
856
  className: "mono",
796
857
  style: {
797
858
  marginTop: 8,
@@ -807,8 +868,8 @@ function B({ block: e }) {
807
868
  default: return null;
808
869
  }
809
870
  }
810
- function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
811
- return /* @__PURE__ */ w("details", {
871
+ function U({ kind: e, label: t, sub: n, body: r, isError: i }) {
872
+ return /* @__PURE__ */ O("details", {
812
873
  style: {
813
874
  marginTop: 6,
814
875
  background: "var(--surface-2)",
@@ -821,7 +882,7 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
821
882
  boxSizing: "border-box",
822
883
  overflow: "hidden"
823
884
  },
824
- children: [/* @__PURE__ */ w("summary", {
885
+ children: [/* @__PURE__ */ O("summary", {
825
886
  style: {
826
887
  padding: "5px 8px",
827
888
  cursor: "pointer",
@@ -833,7 +894,7 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
833
894
  color: "var(--text-2)"
834
895
  },
835
896
  children: [
836
- /* @__PURE__ */ C("span", {
897
+ /* @__PURE__ */ D("span", {
837
898
  "aria-hidden": !0,
838
899
  style: {
839
900
  color: i ? "var(--destructive)" : "var(--text-3)",
@@ -842,7 +903,7 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
842
903
  },
843
904
  children: e === "call" ? "→" : i ? "✗" : "✓"
844
905
  }),
845
- /* @__PURE__ */ C("span", {
906
+ /* @__PURE__ */ D("span", {
846
907
  className: "mono",
847
908
  style: {
848
909
  color: "var(--text-2)",
@@ -854,7 +915,7 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
854
915
  },
855
916
  children: t
856
917
  }),
857
- n && /* @__PURE__ */ C("span", {
918
+ n && /* @__PURE__ */ D("span", {
858
919
  style: {
859
920
  fontSize: 10,
860
921
  color: "var(--text-4)",
@@ -866,8 +927,8 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
866
927
  },
867
928
  children: n
868
929
  }),
869
- /* @__PURE__ */ C("span", { style: { flex: 1 } }),
870
- /* @__PURE__ */ C("span", {
930
+ /* @__PURE__ */ D("span", { style: { flex: 1 } }),
931
+ /* @__PURE__ */ D("span", {
871
932
  "aria-hidden": !0,
872
933
  style: {
873
934
  fontSize: 9,
@@ -876,7 +937,7 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
876
937
  children: "▾"
877
938
  })
878
939
  ]
879
- }), /* @__PURE__ */ C("pre", {
940
+ }), /* @__PURE__ */ D("pre", {
880
941
  className: "mono",
881
942
  style: {
882
943
  margin: 0,
@@ -892,10 +953,10 @@ function V({ kind: e, label: t, sub: n, body: r, isError: i }) {
892
953
  })]
893
954
  });
894
955
  }
895
- function H(e) {
956
+ function W(e) {
896
957
  return e.map((e) => e.type === "text" ? e.text : "").join("");
897
958
  }
898
- function U(e, t, n) {
959
+ function G(e, t, n) {
899
960
  if (t === "action.invoke") {
900
961
  let r = typeof n?.code == "string" ? n.code : "";
901
962
  if (r) return {
@@ -905,15 +966,15 @@ function U(e, t, n) {
905
966
  }
906
967
  return { label: t };
907
968
  }
908
- function W(e, t) {
969
+ function K(e, t) {
909
970
  return t.name ? t.name : t.is_error ? e("agent.panel.chip.error", "error") : e("agent.panel.chip.result", "result");
910
971
  }
911
- function G(e, t) {
972
+ function q(e, t) {
912
973
  return t === "approved" ? e("agent.panel.decision.approve", "Approved") : e("agent.panel.decision.reject", "Rejected");
913
974
  }
914
- function K({ block: e }) {
975
+ function J({ block: e }) {
915
976
  let t = l(), n = e.decision === "approved", r = n ? "var(--success)" : "var(--destructive)";
916
- return /* @__PURE__ */ w("div", {
977
+ return /* @__PURE__ */ O("div", {
917
978
  style: {
918
979
  marginTop: 6,
919
980
  padding: "5px 10px",
@@ -929,7 +990,7 @@ function K({ block: e }) {
929
990
  },
930
991
  title: e.decided_at ? t("agent.panel.decided_at", "decided {time}", { time: e.decided_at }) : void 0,
931
992
  children: [
932
- /* @__PURE__ */ C("span", {
993
+ /* @__PURE__ */ D("span", {
933
994
  "aria-hidden": !0,
934
995
  style: {
935
996
  color: r,
@@ -937,11 +998,11 @@ function K({ block: e }) {
937
998
  },
938
999
  children: n ? "✓" : "✗"
939
1000
  }),
940
- /* @__PURE__ */ C("span", {
1001
+ /* @__PURE__ */ D("span", {
941
1002
  style: { fontWeight: 600 },
942
- children: G(t, e.decision)
1003
+ children: q(t, e.decision)
943
1004
  }),
944
- /* @__PURE__ */ C("span", {
1005
+ /* @__PURE__ */ D("span", {
945
1006
  className: "mono",
946
1007
  style: {
947
1008
  color: "var(--text-3)",
@@ -949,7 +1010,7 @@ function K({ block: e }) {
949
1010
  },
950
1011
  children: e.tool_code
951
1012
  }),
952
- e.note && /* @__PURE__ */ w("span", {
1013
+ e.note && /* @__PURE__ */ O("span", {
953
1014
  style: {
954
1015
  color: "var(--text-3)",
955
1016
  fontStyle: "italic"
@@ -959,10 +1020,10 @@ function K({ block: e }) {
959
1020
  ]
960
1021
  });
961
1022
  }
962
- async function se(e, t) {
1023
+ async function le(e, t) {
963
1024
  let n = [];
964
1025
  for (let r of t) {
965
- let t = `[${r.role}]`, i = r.content.map((t) => q(e, t)).filter((e) => e.length > 0).join("\n");
1026
+ let t = `[${r.role}]`, i = r.content.map((t) => Y(e, t)).filter((e) => e.length > 0).join("\n");
966
1027
  i && n.push(`${t}\n${i}`);
967
1028
  }
968
1029
  let r = n.join("\n\n");
@@ -972,27 +1033,27 @@ async function se(e, t) {
972
1033
  console.error("agent: copyTranscript failed", e);
973
1034
  }
974
1035
  }
975
- function q(e, t) {
1036
+ function Y(e, t) {
976
1037
  switch (t.type) {
977
1038
  case "text": return t.text;
978
1039
  case "tool_use": {
979
- let n = U(e, t.name, t.input);
1040
+ let n = G(e, t.name, t.input);
980
1041
  return `${n.sub ? `→ ${n.label} (${n.sub})` : `→ ${n.label}`}\n${JSON.stringify(t.input, null, 2)}`;
981
1042
  }
982
- case "tool_result": return `${`${t.is_error ? "✗" : "✓"} ${W(e, t)}`}\n${JSON.stringify(t.output, null, 2)}`;
1043
+ case "tool_result": return `${`${t.is_error ? "✗" : "✓"} ${K(e, t)}`}\n${JSON.stringify(t.output, null, 2)}`;
983
1044
  case "elicit_response": return `${e("agent.panel.chip.answer", "answer")}\n${JSON.stringify(t.data, null, 2)}`;
984
- case "decision": return `${G(e, t.decision)} ${t.tool_code}${t.note ? ` — ${t.note}` : ""}`;
1045
+ case "decision": return `${q(e, t.decision)} ${t.tool_code}${t.note ? ` — ${t.note}` : ""}`;
985
1046
  case "system": return `— ${t.reason}`;
986
1047
  case "summary": return t.text;
987
1048
  case "attachment": return t.content;
988
1049
  default: return "";
989
1050
  }
990
1051
  }
991
- function J(e, t) {
1052
+ function X(e, t) {
992
1053
  return e("agent.panel.proposal", "Run {code}.", { code: t });
993
1054
  }
994
- function ce({ tool: e, onApprove: t, onReject: n }) {
995
- let r = l(), i = l("errors"), c = JSON.stringify(e.params ?? {}, null, 2), [u, d] = S(!1), [f, p] = S(!1), [m, h] = S(""), [g, _] = S(null), [v, y] = S(!1), b = async (e) => {
1055
+ function ue({ tool: e, onApprove: t, onReject: n }) {
1056
+ let r = l(), i = l("errors"), c = JSON.stringify(e.params ?? {}, null, 2), [u, d] = E(!1), [f, p] = E(!1), [m, h] = E(""), [g, _] = E(null), [v, y] = E(!1), b = async (e) => {
996
1057
  if (!v) {
997
1058
  y(!0);
998
1059
  try {
@@ -1010,8 +1071,8 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1010
1071
  _(a(i, e)), y(!1);
1011
1072
  }
1012
1073
  }
1013
- }, T = typeof e.confidence == "number" ? Math.round(Math.max(0, Math.min(1, e.confidence)) * 100) : null;
1014
- return /* @__PURE__ */ w("div", {
1074
+ }, S = typeof e.confidence == "number" ? Math.round(Math.max(0, Math.min(1, e.confidence)) * 100) : null;
1075
+ return /* @__PURE__ */ O("div", {
1015
1076
  style: {
1016
1077
  marginTop: 4,
1017
1078
  padding: "10px 12px",
@@ -1020,7 +1081,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1020
1081
  borderRadius: "var(--radius-md)"
1021
1082
  },
1022
1083
  children: [
1023
- /* @__PURE__ */ w("div", {
1084
+ /* @__PURE__ */ O("div", {
1024
1085
  style: {
1025
1086
  display: "flex",
1026
1087
  alignItems: "center",
@@ -1028,11 +1089,11 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1028
1089
  marginBottom: 6
1029
1090
  },
1030
1091
  children: [
1031
- /* @__PURE__ */ C(o.bolt, {
1092
+ /* @__PURE__ */ D(o.bolt, {
1032
1093
  size: 11,
1033
1094
  style: { color: "var(--accent)" }
1034
1095
  }),
1035
- /* @__PURE__ */ C("span", {
1096
+ /* @__PURE__ */ D("span", {
1036
1097
  style: {
1037
1098
  fontSize: 11.5,
1038
1099
  fontWeight: 600,
@@ -1040,7 +1101,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1040
1101
  },
1041
1102
  children: r("agent.panel.proposed", "AI proposed")
1042
1103
  }),
1043
- /* @__PURE__ */ C("span", {
1104
+ /* @__PURE__ */ D("span", {
1044
1105
  className: "mono",
1045
1106
  style: {
1046
1107
  fontSize: 10.5,
@@ -1048,8 +1109,8 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1048
1109
  },
1049
1110
  children: e.tool_code
1050
1111
  }),
1051
- T !== null && /* @__PURE__ */ C("span", {
1052
- title: r("agent.panel.confidence_title", "LLM confidence {percent}%", { percent: T }),
1112
+ S !== null && /* @__PURE__ */ D("span", {
1113
+ title: r("agent.panel.confidence_title", "LLM confidence {percent}%", { percent: S }),
1053
1114
  style: {
1054
1115
  marginLeft: "auto",
1055
1116
  fontSize: 10,
@@ -1058,20 +1119,20 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1058
1119
  border: "1px solid var(--border)",
1059
1120
  borderRadius: 999
1060
1121
  },
1061
- children: r("agent.panel.confidence", "{percent}% confident", { percent: T })
1122
+ children: r("agent.panel.confidence", "{percent}% confident", { percent: S })
1062
1123
  })
1063
1124
  ]
1064
1125
  }),
1065
- /* @__PURE__ */ C("div", {
1126
+ /* @__PURE__ */ D("div", {
1066
1127
  style: {
1067
1128
  fontSize: 12,
1068
1129
  lineHeight: 1.45,
1069
1130
  color: "var(--text)",
1070
1131
  marginBottom: 8
1071
1132
  },
1072
- children: e.question?.message?.trim() || J(r, e.tool_code)
1133
+ children: e.question?.message?.trim() || X(r, e.tool_code)
1073
1134
  }),
1074
- e.reason?.trim() && /* @__PURE__ */ C("div", {
1135
+ e.reason?.trim() && /* @__PURE__ */ D("div", {
1075
1136
  style: {
1076
1137
  fontSize: 11.5,
1077
1138
  lineHeight: 1.45,
@@ -1080,7 +1141,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1080
1141
  },
1081
1142
  children: e.reason.trim()
1082
1143
  }),
1083
- /* @__PURE__ */ w("button", {
1144
+ /* @__PURE__ */ O("button", {
1084
1145
  type: "button",
1085
1146
  onClick: () => d((e) => !e),
1086
1147
  style: {
@@ -1095,7 +1156,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1095
1156
  alignItems: "center",
1096
1157
  gap: 4
1097
1158
  },
1098
- children: [/* @__PURE__ */ C("span", {
1159
+ children: [/* @__PURE__ */ D("span", {
1099
1160
  style: {
1100
1161
  display: "inline-block",
1101
1162
  transform: u ? "rotate(90deg)" : "none",
@@ -1106,7 +1167,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1106
1167
  children: "▶"
1107
1168
  }), u ? r("agent.panel.hide_params", "Hide parameters") : r("agent.panel.view_params", "View parameters")]
1108
1169
  }),
1109
- u && /* @__PURE__ */ C("pre", {
1170
+ u && /* @__PURE__ */ D("pre", {
1110
1171
  className: "mono",
1111
1172
  style: {
1112
1173
  width: "100%",
@@ -1123,7 +1184,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1123
1184
  },
1124
1185
  children: c
1125
1186
  }),
1126
- g && /* @__PURE__ */ C("div", {
1187
+ g && /* @__PURE__ */ D("div", {
1127
1188
  style: {
1128
1189
  marginTop: 4,
1129
1190
  fontSize: 10.5,
@@ -1131,7 +1192,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1131
1192
  },
1132
1193
  children: g
1133
1194
  }),
1134
- f && /* @__PURE__ */ C("input", {
1195
+ f && /* @__PURE__ */ D("input", {
1135
1196
  type: "text",
1136
1197
  value: m,
1137
1198
  onChange: (e) => h(e.target.value),
@@ -1148,7 +1209,7 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1148
1209
  color: "var(--text)"
1149
1210
  }
1150
1211
  }),
1151
- /* @__PURE__ */ w("div", {
1212
+ /* @__PURE__ */ O("div", {
1152
1213
  style: {
1153
1214
  display: "flex",
1154
1215
  gap: 6,
@@ -1156,30 +1217,30 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1156
1217
  justifyContent: "flex-end"
1157
1218
  },
1158
1219
  children: [
1159
- f ? /* @__PURE__ */ C(s, {
1220
+ f ? /* @__PURE__ */ D(s, {
1160
1221
  size: "xs",
1161
1222
  kind: "ghost",
1162
1223
  onClick: x,
1163
1224
  disabled: v,
1164
1225
  children: r("agent.panel.reject_send", "Send rejection")
1165
- }) : /* @__PURE__ */ C(s, {
1226
+ }) : /* @__PURE__ */ D(s, {
1166
1227
  size: "xs",
1167
1228
  kind: "ghost",
1168
1229
  onClick: () => p(!0),
1169
1230
  disabled: v,
1170
1231
  children: r("agent.panel.reject", "Reject…")
1171
1232
  }),
1172
- e.confirmation_mode !== "always" && /* @__PURE__ */ C(s, {
1233
+ e.confirmation_mode !== "always" && /* @__PURE__ */ D(s, {
1173
1234
  size: "xs",
1174
1235
  kind: "ghost",
1175
1236
  onClick: () => b("conversation"),
1176
1237
  disabled: v,
1177
1238
  children: r("agent.panel.approve_chat", "Approve for this chat")
1178
1239
  }),
1179
- /* @__PURE__ */ C(s, {
1240
+ /* @__PURE__ */ D(s, {
1180
1241
  size: "xs",
1181
1242
  kind: "primary",
1182
- icon: /* @__PURE__ */ C(o.check, { size: 11 }),
1243
+ icon: /* @__PURE__ */ D(o.check, { size: 11 }),
1183
1244
  onClick: () => b("call"),
1184
1245
  disabled: v,
1185
1246
  children: r("agent.panel.approve_once", "Approve once")
@@ -1190,4 +1251,4 @@ function ce({ tool: e, onApprove: t, onReject: n }) {
1190
1251
  });
1191
1252
  }
1192
1253
  //#endregion
1193
- export { E as AgentChatPanel, J as proposalFallback };
1254
+ export { k as AgentChatPanel, X as proposalFallback };