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