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