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