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