@declarion/react 0.185.0 → 0.188.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.
|
@@ -7,28 +7,28 @@ import { useAgentConversation as a } from "../../hooks/useAgentConversation.js";
|
|
|
7
7
|
import { useWindowConversation as o } from "../../hooks/useWindowConversation.js";
|
|
8
8
|
import { AgentElicitForm as s } from "./AgentElicitForm.js";
|
|
9
9
|
import { AgentPicker as c } from "./AgentPicker.js";
|
|
10
|
-
import { fold as
|
|
11
|
-
import { useSchema as
|
|
12
|
-
import { useParam as
|
|
13
|
-
import { useText as
|
|
14
|
-
import { useTabNavigate as
|
|
15
|
-
import { screenTitleForPath as
|
|
16
|
-
import { useEntity as
|
|
17
|
-
import { failureTitle as
|
|
18
|
-
import { formatOffsetTimestamp as
|
|
19
|
-
import { pluralText as
|
|
20
|
-
import { useFileSelection as
|
|
21
|
-
import { ComposerAttachments as
|
|
10
|
+
import { fold as ee } from "./transcript-runs.js";
|
|
11
|
+
import { useSchema as l } from "../../hooks/useSchema.js";
|
|
12
|
+
import { useParam as u } from "../../hooks/useParams.js";
|
|
13
|
+
import { useText as d } from "../../hooks/useText.js";
|
|
14
|
+
import { useTabNavigate as f } from "../../hooks/useTabNavigate.js";
|
|
15
|
+
import { screenTitleForPath as te } from "../../types/schema.js";
|
|
16
|
+
import { useEntity as p } from "../../hooks/useEntity.js";
|
|
17
|
+
import { failureTitle as m } from "../../lib/failure.js";
|
|
18
|
+
import { formatOffsetTimestamp as h } from "../../lib/timestamp.js";
|
|
19
|
+
import { pluralText as g, textWithNodes as _ } from "../../lib/language.js";
|
|
20
|
+
import { useFileSelection as v } from "../file-widgets/useFileSelection.js";
|
|
21
|
+
import { ComposerAttachments as y, MessageAttachments as b, replyFilesVisible as ne } from "./ChatAttachments.js";
|
|
22
22
|
import { useEffect as x, useRef as S, useState as C } from "react";
|
|
23
23
|
import { jsx as w, jsxs as T } from "react/jsx-runtime";
|
|
24
24
|
import { useLocation as re } from "react-router";
|
|
25
25
|
import ie from "react-textarea-autosize";
|
|
26
26
|
// src/components/agents/AgentChatPanel.impl.tsx
|
|
27
27
|
var ae = 80, E = "/errors/";
|
|
28
|
-
function oe({ open: n, onClose: i, context:
|
|
29
|
-
let
|
|
30
|
-
o(
|
|
31
|
-
let b =
|
|
28
|
+
function oe({ open: n, onClose: i, context: u, title: f = "", askOnOpen: p, docked: h = !1 }) {
|
|
29
|
+
let g = a();
|
|
30
|
+
o(g.conversationId);
|
|
31
|
+
let b = d(), { pathname: ne } = re(), { data: E } = l(), oe = u ? te(b, ne, E?.screens, E?.entities)?.title : void 0, se = d("errors"), [O, k] = C(""), [A, j] = C(null), M = S(null), [me, N] = C(!1), P = S(null), F = v({
|
|
32
32
|
entityCode: "agent_message",
|
|
33
33
|
fieldCode: "attachments"
|
|
34
34
|
}), I = S(null), L = S(null), R = S(!0), [z, B] = C(!1), V = () => {
|
|
@@ -42,16 +42,16 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
42
42
|
top: t.scrollHeight,
|
|
43
43
|
behavior: e
|
|
44
44
|
}), R.current = !0, B(!1));
|
|
45
|
-
}, U =
|
|
45
|
+
}, U = g.openedConversation?.id, W = S(!0);
|
|
46
46
|
x(() => {
|
|
47
47
|
W.current = !0;
|
|
48
48
|
}, [n, U]), x(() => {
|
|
49
|
-
if (W.current && U &&
|
|
49
|
+
if (W.current && U && g.messages.length > 0) {
|
|
50
50
|
let e = requestAnimationFrame(() => H("instant"));
|
|
51
51
|
return () => cancelAnimationFrame(e);
|
|
52
52
|
}
|
|
53
53
|
R.current ? H("smooth") : B(!0);
|
|
54
|
-
}, [
|
|
54
|
+
}, [g.messages, U]);
|
|
55
55
|
let G = () => {
|
|
56
56
|
W.current = !0, requestAnimationFrame(() => H("instant"));
|
|
57
57
|
}, K = () => {
|
|
@@ -67,28 +67,28 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
67
67
|
}, []), x(() => {
|
|
68
68
|
n && H("instant");
|
|
69
69
|
}, [n]), x(() => {
|
|
70
|
-
let e =
|
|
70
|
+
let e = p?.trim();
|
|
71
71
|
n && e && M.current !== e && (M.current = e, P.current?.(e));
|
|
72
|
-
}, [n,
|
|
72
|
+
}, [n, p]), !n) return null;
|
|
73
73
|
let J = async (e) => {
|
|
74
74
|
let t = F.readyFiles, n = F.selections.filter((e) => e.state === "ready").map((e) => e.localId);
|
|
75
75
|
if ((e.trim() || t.length !== 0) && F.settled) {
|
|
76
76
|
j(null), k("");
|
|
77
77
|
try {
|
|
78
|
-
await
|
|
78
|
+
await g.send(e, u, t), F.release(n);
|
|
79
79
|
} catch (t) {
|
|
80
|
-
console.error("agent send failed", t), j(
|
|
80
|
+
console.error("agent send failed", t), j(m(se, t)), k(e);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
P.current = J;
|
|
85
85
|
let Y = (e) => {
|
|
86
86
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), J(O));
|
|
87
|
-
}, X =
|
|
87
|
+
}, X = g.invocations.filter((e) => e.status === "pending_approval"), Z = g.invocations.filter((e) => e.kind === "input_request" && e.status === "pending_input"), _e = g.turns.filter((e) => e.status === "queued" || e.status === "running" || e.status === "waiting" || e.status === "failed"), Q = g.invocations.filter((e) => e.status === "outcome_unknown"), ye = g.messages.length === 0 && !g.turn.streaming, be = X.length > 0 || Z.length > 0, xe = g.turn.streaming && !be || g.turns.some((e) => e.status === "running"), Se = g.messages.some((e) => e.role === "assistant" && e.streaming && e.content.length > 0), $ = (O.trim().length > 0 || F.readyFiles.length > 0) && F.settled;
|
|
88
88
|
return /* @__PURE__ */ T("aside", {
|
|
89
89
|
"aria-label": b("shell.ai_assistant", "AI Assistant"),
|
|
90
90
|
style: {
|
|
91
|
-
...
|
|
91
|
+
...h ? {
|
|
92
92
|
gridArea: "assistant",
|
|
93
93
|
minWidth: 0,
|
|
94
94
|
minHeight: 0
|
|
@@ -140,7 +140,7 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
140
140
|
fontWeight: 600,
|
|
141
141
|
color: "var(--text)"
|
|
142
142
|
},
|
|
143
|
-
children:
|
|
143
|
+
children: g.openedConversation && pe(b, g.openedConversation) || f
|
|
144
144
|
}), /* @__PURE__ */ T("div", {
|
|
145
145
|
style: {
|
|
146
146
|
fontSize: 10.5,
|
|
@@ -154,27 +154,27 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
154
154
|
height: 5,
|
|
155
155
|
background: "var(--success)",
|
|
156
156
|
borderRadius: 999
|
|
157
|
-
} }),
|
|
157
|
+
} }), _(b("agent.panel.context", "context: {context}"), { context: /* @__PURE__ */ w("span", { children: oe || b("agent.panel.context_platform", "Platform") }) })]
|
|
158
158
|
})]
|
|
159
159
|
}),
|
|
160
|
-
|
|
160
|
+
g.messages.length > 0 && /* @__PURE__ */ w(t, {
|
|
161
161
|
size: 24,
|
|
162
162
|
icon: /* @__PURE__ */ w(e.copy, { size: 12 }),
|
|
163
|
-
onClick: () => void ge(b,
|
|
163
|
+
onClick: () => void ge(b, g.messages),
|
|
164
164
|
title: b("agent.panel.copy_all", "Copy entire conversation")
|
|
165
165
|
}),
|
|
166
166
|
/* @__PURE__ */ w(t, {
|
|
167
167
|
size: 24,
|
|
168
168
|
icon: /* @__PURE__ */ w(e.clock, { size: 12 }),
|
|
169
169
|
onClick: () => {
|
|
170
|
-
N((e) => !e),
|
|
170
|
+
N((e) => !e), g.refreshConversations();
|
|
171
171
|
},
|
|
172
172
|
title: b("agent.panel.earlier", "Earlier conversations")
|
|
173
173
|
}),
|
|
174
|
-
|
|
174
|
+
g.conversationId && /* @__PURE__ */ w(t, {
|
|
175
175
|
size: 24,
|
|
176
176
|
icon: /* @__PURE__ */ w(e.plus, { size: 12 }),
|
|
177
|
-
onClick:
|
|
177
|
+
onClick: g.startNew,
|
|
178
178
|
title: b("agent.panel.new_conversation", "New conversation")
|
|
179
179
|
}),
|
|
180
180
|
/* @__PURE__ */ w(t, {
|
|
@@ -190,19 +190,19 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
190
190
|
})
|
|
191
191
|
]
|
|
192
192
|
}),
|
|
193
|
-
!
|
|
194
|
-
agents:
|
|
195
|
-
selectedId:
|
|
196
|
-
onSelect:
|
|
193
|
+
!g.conversationId && /* @__PURE__ */ w(c, {
|
|
194
|
+
agents: g.agents,
|
|
195
|
+
selectedId: g.selectedAgentId,
|
|
196
|
+
onSelect: g.selectAgent,
|
|
197
197
|
label: b("agent.panel.agent", "Agent")
|
|
198
198
|
}),
|
|
199
199
|
me && /* @__PURE__ */ w(fe, {
|
|
200
|
-
conversations:
|
|
201
|
-
hasMore:
|
|
202
|
-
onShowMore: () => void
|
|
203
|
-
currentId:
|
|
200
|
+
conversations: g.conversations,
|
|
201
|
+
hasMore: g.moreConversations,
|
|
202
|
+
onShowMore: () => void g.showMoreConversations(),
|
|
203
|
+
currentId: g.conversationId,
|
|
204
204
|
onPick: (e) => {
|
|
205
|
-
|
|
205
|
+
g.setConversationId(e), N(!1), G();
|
|
206
206
|
}
|
|
207
207
|
}),
|
|
208
208
|
/* @__PURE__ */ w("div", {
|
|
@@ -226,23 +226,24 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
226
226
|
},
|
|
227
227
|
children: [
|
|
228
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
|
-
|
|
229
|
+
ee(g.messages, g.invocations).map((e) => e.kind === "message" ? /* @__PURE__ */ w(he, {
|
|
230
230
|
message: e.message,
|
|
231
231
|
delivered: e.delivered,
|
|
232
|
-
|
|
232
|
+
showsPlace: e.showsPlace,
|
|
233
|
+
turns: g.turns
|
|
233
234
|
}, e.message.id) : /* @__PURE__ */ w(de, { run: e }, e.id)),
|
|
234
|
-
|
|
235
|
-
X.map((e) => /* @__PURE__ */ w(
|
|
235
|
+
_e.map((e) => /* @__PURE__ */ w(ce, { agentTurn: e }, e.id)),
|
|
236
|
+
X.map((e) => /* @__PURE__ */ w(ve, {
|
|
236
237
|
tool: e,
|
|
237
|
-
onApprove: async (t) =>
|
|
238
|
-
onReject: async (t) =>
|
|
238
|
+
onApprove: async (t) => g.approve(e.id, t),
|
|
239
|
+
onReject: async (t) => g.reject(e.id, t)
|
|
239
240
|
}, e.id)),
|
|
240
241
|
Z.map((e) => /* @__PURE__ */ w(s, {
|
|
241
242
|
...le(b, e),
|
|
242
|
-
onSubmit: (t) => void
|
|
243
|
-
onCancel: () => void
|
|
243
|
+
onSubmit: (t) => void g.submitInput(e.id, t),
|
|
244
|
+
onCancel: () => void g.cancelInput(e.id)
|
|
244
245
|
}, e.id)),
|
|
245
|
-
|
|
246
|
+
Q.map((e) => /* @__PURE__ */ w(ue, { invocation: e }, e.id)),
|
|
246
247
|
xe && !Se && /* @__PURE__ */ T("div", {
|
|
247
248
|
style: {
|
|
248
249
|
display: "flex",
|
|
@@ -296,7 +297,7 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
296
297
|
background: "var(--surface-2)"
|
|
297
298
|
},
|
|
298
299
|
children: [
|
|
299
|
-
/* @__PURE__ */ w(
|
|
300
|
+
/* @__PURE__ */ w(y, {
|
|
300
301
|
selections: F.selections,
|
|
301
302
|
onCancel: F.cancel,
|
|
302
303
|
onRemove: F.remove
|
|
@@ -358,7 +359,7 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
358
359
|
title: b("agent.panel.attach_files", "Attach files")
|
|
359
360
|
}),
|
|
360
361
|
xe ? /* @__PURE__ */ w("button", {
|
|
361
|
-
onClick: () => void
|
|
362
|
+
onClick: () => void g.cancel(),
|
|
362
363
|
"aria-label": b("agent.panel.stop", "Stop generating"),
|
|
363
364
|
title: b("agent.panel.stop", "Stop generating"),
|
|
364
365
|
style: {
|
|
@@ -461,7 +462,7 @@ function D({ children: t, dataMessageId: n, dataStreaming: r }) {
|
|
|
461
462
|
});
|
|
462
463
|
}
|
|
463
464
|
function ce({ agentTurn: e }) {
|
|
464
|
-
let t =
|
|
465
|
+
let t = d(), n = d("errors"), r = p("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
466
|
return /* @__PURE__ */ T("div", {
|
|
466
467
|
"data-agent-turn": e.id,
|
|
467
468
|
"data-turn-status": e.status,
|
|
@@ -497,7 +498,7 @@ function le(e, t) {
|
|
|
497
498
|
};
|
|
498
499
|
}
|
|
499
500
|
function ue({ invocation: e }) {
|
|
500
|
-
let t =
|
|
501
|
+
let t = d();
|
|
501
502
|
return /* @__PURE__ */ w("div", {
|
|
502
503
|
"data-agent-invocation": e.id,
|
|
503
504
|
"data-invocation-status": "outcome_unknown",
|
|
@@ -509,7 +510,7 @@ function ue({ invocation: e }) {
|
|
|
509
510
|
fontSize: 11.5,
|
|
510
511
|
color: "var(--text-2)"
|
|
511
512
|
},
|
|
512
|
-
children:
|
|
513
|
+
children: _(t("agent.panel.outcome_uncertain", "The outcome of {tool} is unknown. It was not retried automatically."), { tool: /* @__PURE__ */ w("span", {
|
|
513
514
|
className: "mono",
|
|
514
515
|
children: e.tool_code
|
|
515
516
|
}) })
|
|
@@ -570,20 +571,20 @@ function de({ run: e }) {
|
|
|
570
571
|
});
|
|
571
572
|
}
|
|
572
573
|
function A() {
|
|
573
|
-
let e =
|
|
574
|
+
let e = d();
|
|
574
575
|
return (t, n, r) => {
|
|
575
576
|
let i = [];
|
|
576
|
-
return t > 0 && i.push(
|
|
577
|
+
return t > 0 && i.push(g(e, "agent.panel.operations", t, {
|
|
577
578
|
one: "{count} operation",
|
|
578
579
|
other: "{count} operations"
|
|
579
|
-
})), n > 0 && i.push(e("agent.panel.running", "running")), r > 0 && i.push(
|
|
580
|
+
})), n > 0 && i.push(e("agent.panel.running", "running")), r > 0 && i.push(g(e, "agent.panel.failed_count", r, {
|
|
580
581
|
one: "{count} failed",
|
|
581
582
|
other: "{count} failed"
|
|
582
583
|
})), i.join(" · ") || e("agent.panel.worked", "worked");
|
|
583
584
|
};
|
|
584
585
|
}
|
|
585
586
|
function j({ call: e }) {
|
|
586
|
-
let [t, n] = C(!1), r =
|
|
587
|
+
let [t, n] = C(!1), r = d(), i = N(e.name), a = p("agent_tool_invocation")?.fields.get("status"), o = e.status ?? "running", s = r(a?.values?.find((e) => e.code === o)?.name) || o, c = e.status === "outcome_unknown" ? "outcome_unknown" : e.isError ? "failed" : M(e.status) ? "ok" : "running";
|
|
587
588
|
return /* @__PURE__ */ T("div", {
|
|
588
589
|
"data-activity-call": e.name,
|
|
589
590
|
"data-call-state": c,
|
|
@@ -640,7 +641,7 @@ function M(e) {
|
|
|
640
641
|
return e === "succeeded" || e === "failed" || e === "rejected" || e === "canceled" || e === "outcome_unknown";
|
|
641
642
|
}
|
|
642
643
|
function fe({ conversations: e, hasMore: t, onShowMore: n, currentId: r, onPick: i }) {
|
|
643
|
-
let a =
|
|
644
|
+
let a = d();
|
|
644
645
|
return e.length === 0 ? /* @__PURE__ */ w("div", {
|
|
645
646
|
style: {
|
|
646
647
|
padding: "8px 12px",
|
|
@@ -705,23 +706,23 @@ function pe(e, t) {
|
|
|
705
706
|
}
|
|
706
707
|
function me(e, t) {
|
|
707
708
|
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(
|
|
709
|
+
return r && n.push(r), t.chat_id && !t.title?.includes(z(t.chat_id)) && n.push(e("agent.panel.messenger_chat", "chat {chat}", { chat: z(t.chat_id) })), t.topic_id && n.push(e("agent.panel.messenger_topic", "topic {topic}", { topic: t.topic_id })), t.updated_at && n.push(h(t.updated_at, { zone: e.timeZone })), n;
|
|
709
710
|
}
|
|
710
711
|
function N(e) {
|
|
711
|
-
let t =
|
|
712
|
+
let t = d(), { value: n } = u("agents.transcript_names", "code"), { data: r } = l();
|
|
712
713
|
return n === "display" && t(r?.actions?.[e]?.display?.name ?? P(r, e)) || e;
|
|
713
714
|
}
|
|
714
715
|
function P(e, t) {
|
|
715
716
|
let n = t.indexOf(".");
|
|
716
717
|
if (!(n < 0)) return e?.entities?.[t.slice(0, n)]?.actions?.[t.slice(n + 1)]?.display?.name;
|
|
717
718
|
}
|
|
718
|
-
function he({ message: e, delivered: t,
|
|
719
|
-
let
|
|
719
|
+
function he({ message: e, delivered: t, showsPlace: n, turns: r }) {
|
|
720
|
+
let i = ne(e, r) ? e.attachments : void 0;
|
|
720
721
|
if (e.role === "user") {
|
|
721
|
-
let t =
|
|
722
|
+
let t = q(e.content);
|
|
722
723
|
return e.content.some((e) => e.type !== "text" && e.type !== "location") ? /* @__PURE__ */ w(B, {
|
|
723
724
|
message: e,
|
|
724
|
-
files:
|
|
725
|
+
files: i
|
|
725
726
|
}) : /* @__PURE__ */ T("div", {
|
|
726
727
|
style: {
|
|
727
728
|
alignSelf: "flex-end",
|
|
@@ -736,27 +737,45 @@ function he({ message: e, delivered: t, turns: n }) {
|
|
|
736
737
|
children: [
|
|
737
738
|
t && /* @__PURE__ */ w(F, { text: t }),
|
|
738
739
|
/* @__PURE__ */ w(b, {
|
|
739
|
-
files:
|
|
740
|
+
files: i,
|
|
740
741
|
align: "end"
|
|
741
742
|
}),
|
|
742
|
-
/* @__PURE__ */ w(R, {
|
|
743
|
+
/* @__PURE__ */ w(R, {
|
|
744
|
+
message: e,
|
|
745
|
+
showsPlace: n
|
|
746
|
+
})
|
|
743
747
|
]
|
|
744
748
|
});
|
|
745
749
|
}
|
|
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, {
|
|
750
|
+
return e.role === "tool" ? /* @__PURE__ */ w(B, { message: e }) : e.role === "system" ? e.content.some((e) => e.type === "decision") ? /* @__PURE__ */ w(B, { message: e }) : I(e) ? /* @__PURE__ */ w(L, {
|
|
751
|
+
message: e,
|
|
752
|
+
showsPlace: n
|
|
753
|
+
}) : /* @__PURE__ */ T(D, {
|
|
747
754
|
dataMessageId: e.id,
|
|
748
|
-
children: [e.content.map((
|
|
749
|
-
|
|
755
|
+
children: [e.content.map((t, n) => /* @__PURE__ */ w(G, {
|
|
756
|
+
block: t,
|
|
757
|
+
sentByMessenger: !!e.bot_id
|
|
758
|
+
}, n)), /* @__PURE__ */ w(R, {
|
|
759
|
+
message: e,
|
|
760
|
+
showsPlace: n
|
|
761
|
+
})]
|
|
762
|
+
}) : e.content.length === 0 && !i?.length ? null : /* @__PURE__ */ T(D, {
|
|
750
763
|
dataMessageId: e.id,
|
|
751
764
|
dataStreaming: e.streaming,
|
|
752
765
|
children: [
|
|
753
|
-
e.content.map((
|
|
766
|
+
e.content.map((t, n) => /* @__PURE__ */ w(G, {
|
|
767
|
+
block: t,
|
|
768
|
+
sentByMessenger: !!e.bot_id
|
|
769
|
+
}, n)),
|
|
754
770
|
e.streaming && /* @__PURE__ */ w(se, {}),
|
|
755
771
|
/* @__PURE__ */ w(b, {
|
|
756
|
-
files:
|
|
772
|
+
files: i,
|
|
757
773
|
align: "start"
|
|
758
774
|
}),
|
|
759
|
-
t && /* @__PURE__ */ w(R, {
|
|
775
|
+
t && /* @__PURE__ */ w(R, {
|
|
776
|
+
message: t,
|
|
777
|
+
showsPlace: n
|
|
778
|
+
})
|
|
760
779
|
]
|
|
761
780
|
});
|
|
762
781
|
}
|
|
@@ -783,11 +802,11 @@ function F({ text: e, dim: t }) {
|
|
|
783
802
|
function I(e) {
|
|
784
803
|
return !e.bot_id || e.delivery_key ? !1 : e.content.some((e) => e.type === "reaction" || e.type === "text" && (!!e.callback_data || e.heard === !0));
|
|
785
804
|
}
|
|
786
|
-
function L({ message: e }) {
|
|
787
|
-
let
|
|
805
|
+
function L({ message: e, showsPlace: t }) {
|
|
806
|
+
let n = d(), r = e.content.some((e) => e.type === "text" && e.heard === !0), i = e.content.some((e) => e.type === "text" && !!e.callback_data), a = q(e.content), o = e.content.find((e) => e.type === "reaction"), s = o?.type === "reaction" ? o.emoji ?? "" : a, c = r ? n("agent.panel.heard_started_nothing", "Heard, started nothing") : i ? n("agent.panel.pressed_button", "Pressed a button") : "";
|
|
788
807
|
return /* @__PURE__ */ T("div", {
|
|
789
808
|
"data-message-id": e.id,
|
|
790
|
-
"data-person-on-messenger":
|
|
809
|
+
"data-person-on-messenger": r ? "heard" : i ? "pressed" : "reacted",
|
|
791
810
|
style: {
|
|
792
811
|
alignSelf: "flex-end",
|
|
793
812
|
maxWidth: "80%",
|
|
@@ -797,28 +816,31 @@ function L({ message: e }) {
|
|
|
797
816
|
alignItems: "flex-end"
|
|
798
817
|
},
|
|
799
818
|
children: [
|
|
800
|
-
|
|
801
|
-
text:
|
|
802
|
-
dim:
|
|
819
|
+
s && /* @__PURE__ */ w(F, {
|
|
820
|
+
text: s,
|
|
821
|
+
dim: r
|
|
803
822
|
}),
|
|
804
|
-
|
|
823
|
+
c && /* @__PURE__ */ w("div", {
|
|
805
824
|
"data-messenger-mark": !0,
|
|
806
825
|
style: {
|
|
807
826
|
fontSize: 10.5,
|
|
808
827
|
color: "var(--text-3)",
|
|
809
828
|
marginTop: 2
|
|
810
829
|
},
|
|
811
|
-
children:
|
|
830
|
+
children: c
|
|
812
831
|
}),
|
|
813
|
-
/* @__PURE__ */ w(R, {
|
|
832
|
+
/* @__PURE__ */ w(R, {
|
|
833
|
+
message: e,
|
|
834
|
+
showsPlace: t
|
|
835
|
+
})
|
|
814
836
|
]
|
|
815
837
|
});
|
|
816
838
|
}
|
|
817
|
-
function R({ message: e }) {
|
|
818
|
-
let
|
|
839
|
+
function R({ message: e, showsPlace: t }) {
|
|
840
|
+
let n = d(), r = p("agent_message")?.fields.get("delivery_status");
|
|
819
841
|
if (!e.bot_id) return null;
|
|
820
|
-
let
|
|
821
|
-
return e.bot &&
|
|
842
|
+
let i = [];
|
|
843
|
+
return t && e.bot && i.push(e.bot), t && e.chat_id && i.push(n("agent.panel.messenger_chat", "chat {chat}", { chat: z(e.chat_id) })), t && e.topic_id && i.push(n("agent.panel.messenger_topic", "topic {topic}", { topic: e.topic_id })), !e.delivery_key && e.sender_external_id && (e.sender_user || z(e.sender_external_id) !== z(e.chat_id ?? "")) && i.push(n("agent.panel.messenger_from", "from {sender}", { sender: e.sender_user || z(e.sender_external_id) })), e.delivery_status && i.push(n(r?.values?.find((t) => t.code === e.delivery_status)?.name) || e.delivery_status), i.length === 0 ? null : /* @__PURE__ */ w("div", {
|
|
822
844
|
"data-messenger-facts": !0,
|
|
823
845
|
"data-delivery-status": e.delivery_status ?? void 0,
|
|
824
846
|
style: {
|
|
@@ -827,7 +849,7 @@ function R({ message: e }) {
|
|
|
827
849
|
marginTop: 2,
|
|
828
850
|
overflowWrap: "anywhere"
|
|
829
851
|
},
|
|
830
|
-
children:
|
|
852
|
+
children: i.join(" · ")
|
|
831
853
|
});
|
|
832
854
|
}
|
|
833
855
|
function z(e) {
|
|
@@ -846,14 +868,17 @@ function B({ message: e, files: t }) {
|
|
|
846
868
|
alignItems: "flex-end",
|
|
847
869
|
overflowWrap: "anywhere"
|
|
848
870
|
},
|
|
849
|
-
children: [e.content.map((
|
|
871
|
+
children: [e.content.map((t, n) => /* @__PURE__ */ w(G, {
|
|
872
|
+
block: t,
|
|
873
|
+
sentByMessenger: !!e.bot_id
|
|
874
|
+
}, n)), /* @__PURE__ */ w(b, {
|
|
850
875
|
files: t,
|
|
851
876
|
align: "end"
|
|
852
877
|
})]
|
|
853
878
|
});
|
|
854
879
|
}
|
|
855
880
|
function V({ href: e, children: t, ...n }) {
|
|
856
|
-
let r =
|
|
881
|
+
let r = f(), i = {
|
|
857
882
|
color: "var(--accent-text)",
|
|
858
883
|
textDecoration: "underline"
|
|
859
884
|
}, a = H(e);
|
|
@@ -943,40 +968,80 @@ var U = {
|
|
|
943
968
|
});
|
|
944
969
|
}
|
|
945
970
|
};
|
|
946
|
-
function W({
|
|
947
|
-
|
|
971
|
+
function W({ rows: e }) {
|
|
972
|
+
return /* @__PURE__ */ w("div", {
|
|
973
|
+
"data-messenger-buttons": !0,
|
|
974
|
+
style: {
|
|
975
|
+
display: "flex",
|
|
976
|
+
flexDirection: "column",
|
|
977
|
+
gap: 4,
|
|
978
|
+
marginTop: 6
|
|
979
|
+
},
|
|
980
|
+
children: e.map((e, t) => /* @__PURE__ */ w("div", {
|
|
981
|
+
style: {
|
|
982
|
+
display: "flex",
|
|
983
|
+
gap: 4
|
|
984
|
+
},
|
|
985
|
+
children: e.map((e, t) => /* @__PURE__ */ w("span", {
|
|
986
|
+
title: e.url ?? e.web_app?.url,
|
|
987
|
+
style: {
|
|
988
|
+
flex: 1,
|
|
989
|
+
minWidth: 0,
|
|
990
|
+
padding: "4px 8px",
|
|
991
|
+
textAlign: "center",
|
|
992
|
+
fontSize: 12,
|
|
993
|
+
lineHeight: 1.4,
|
|
994
|
+
border: "1px solid var(--border)",
|
|
995
|
+
borderRadius: "var(--radius-md)",
|
|
996
|
+
color: "var(--text-2)",
|
|
997
|
+
overflowWrap: "anywhere"
|
|
998
|
+
},
|
|
999
|
+
children: e.text
|
|
1000
|
+
}, t))
|
|
1001
|
+
}, t))
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
function G({ block: e, sentByMessenger: t }) {
|
|
1005
|
+
let n = d();
|
|
948
1006
|
switch (e.type) {
|
|
949
|
-
case "text": return /* @__PURE__ */
|
|
1007
|
+
case "text": return t ? /* @__PURE__ */ T("div", {
|
|
1008
|
+
"data-messenger-text": !0,
|
|
1009
|
+
style: {
|
|
1010
|
+
whiteSpace: "pre-wrap",
|
|
1011
|
+
overflowWrap: "anywhere"
|
|
1012
|
+
},
|
|
1013
|
+
children: [e.text, e.buttons?.length ? /* @__PURE__ */ w(W, { rows: e.buttons }) : null]
|
|
1014
|
+
}) : /* @__PURE__ */ T("div", {
|
|
950
1015
|
className: "agent-md",
|
|
951
|
-
children: /* @__PURE__ */ w(i, {
|
|
1016
|
+
children: [/* @__PURE__ */ w(i, {
|
|
952
1017
|
content: e.text,
|
|
953
1018
|
plugins: "gfm",
|
|
954
1019
|
prose: !1,
|
|
955
1020
|
skipHtml: !1,
|
|
956
1021
|
components: U
|
|
957
|
-
})
|
|
1022
|
+
}), e.buttons?.length ? /* @__PURE__ */ w(W, { rows: e.buttons }) : null]
|
|
958
1023
|
});
|
|
959
1024
|
case "tool_use": {
|
|
960
|
-
let
|
|
961
|
-
return /* @__PURE__ */ w(
|
|
1025
|
+
let t = J(n, e.name, e.input);
|
|
1026
|
+
return /* @__PURE__ */ w(K, {
|
|
962
1027
|
kind: "call",
|
|
963
|
-
label:
|
|
964
|
-
sub:
|
|
1028
|
+
label: t.label,
|
|
1029
|
+
sub: t.sub,
|
|
965
1030
|
body: e.input
|
|
966
1031
|
});
|
|
967
1032
|
}
|
|
968
|
-
case "tool_result": return /* @__PURE__ */ w(
|
|
1033
|
+
case "tool_result": return /* @__PURE__ */ w(K, {
|
|
969
1034
|
kind: "result",
|
|
970
|
-
label:
|
|
1035
|
+
label: Y(n, e),
|
|
971
1036
|
body: e.output,
|
|
972
1037
|
isError: !!e.is_error
|
|
973
1038
|
});
|
|
974
|
-
case "elicit_response": return /* @__PURE__ */ w(
|
|
1039
|
+
case "elicit_response": return /* @__PURE__ */ w(K, {
|
|
975
1040
|
kind: "result",
|
|
976
|
-
label:
|
|
1041
|
+
label: n("agent.panel.chip.answer", "answer"),
|
|
977
1042
|
body: e.data
|
|
978
1043
|
});
|
|
979
|
-
case "decision": return /* @__PURE__ */ w(
|
|
1044
|
+
case "decision": return /* @__PURE__ */ w(Z, { block: e });
|
|
980
1045
|
case "location":
|
|
981
1046
|
case "thinking":
|
|
982
1047
|
case "redacted_thinking": return null;
|
|
@@ -1012,7 +1077,7 @@ function W({ block: e }) {
|
|
|
1012
1077
|
default: return null;
|
|
1013
1078
|
}
|
|
1014
1079
|
}
|
|
1015
|
-
function
|
|
1080
|
+
function K({ kind: e, label: t, sub: n, body: r, isError: i }) {
|
|
1016
1081
|
return /* @__PURE__ */ T("details", {
|
|
1017
1082
|
style: {
|
|
1018
1083
|
marginTop: 6,
|
|
@@ -1097,10 +1162,10 @@ function G({ kind: e, label: t, sub: n, body: r, isError: i }) {
|
|
|
1097
1162
|
})]
|
|
1098
1163
|
});
|
|
1099
1164
|
}
|
|
1100
|
-
function
|
|
1165
|
+
function q(e) {
|
|
1101
1166
|
return e.map((e) => e.type === "text" ? e.text : "").join("");
|
|
1102
1167
|
}
|
|
1103
|
-
function
|
|
1168
|
+
function J(e, t, n) {
|
|
1104
1169
|
if (t === "action.invoke") {
|
|
1105
1170
|
let r = typeof n?.code == "string" ? n.code : "";
|
|
1106
1171
|
if (r) return {
|
|
@@ -1110,14 +1175,14 @@ function q(e, t, n) {
|
|
|
1110
1175
|
}
|
|
1111
1176
|
return { label: t };
|
|
1112
1177
|
}
|
|
1113
|
-
function
|
|
1178
|
+
function Y(e, t) {
|
|
1114
1179
|
return t.name ? t.name : t.is_error ? e("agent.panel.chip.error", "error") : e("agent.panel.chip.result", "result");
|
|
1115
1180
|
}
|
|
1116
|
-
function
|
|
1181
|
+
function X(e, t) {
|
|
1117
1182
|
return t === "approved" ? e("agent.panel.decision.approve", "Approved") : e("agent.panel.decision.reject", "Rejected");
|
|
1118
1183
|
}
|
|
1119
|
-
function
|
|
1120
|
-
let t =
|
|
1184
|
+
function Z({ block: e }) {
|
|
1185
|
+
let t = d(), n = e.decision === "approved", r = n ? "var(--success)" : "var(--destructive)";
|
|
1121
1186
|
return /* @__PURE__ */ T("div", {
|
|
1122
1187
|
style: {
|
|
1123
1188
|
marginTop: 6,
|
|
@@ -1144,7 +1209,7 @@ function X({ block: e }) {
|
|
|
1144
1209
|
}),
|
|
1145
1210
|
/* @__PURE__ */ w("span", {
|
|
1146
1211
|
style: { fontWeight: 600 },
|
|
1147
|
-
children:
|
|
1212
|
+
children: X(t, e.decision)
|
|
1148
1213
|
}),
|
|
1149
1214
|
/* @__PURE__ */ w("span", {
|
|
1150
1215
|
className: "mono",
|
|
@@ -1167,7 +1232,7 @@ function X({ block: e }) {
|
|
|
1167
1232
|
async function ge(e, t) {
|
|
1168
1233
|
let n = [];
|
|
1169
1234
|
for (let r of t) {
|
|
1170
|
-
let t = `[${r.role}]`, i = r.content.map((t) =>
|
|
1235
|
+
let t = `[${r.role}]`, i = r.content.map((t) => _e(e, t)).filter((e) => e.length > 0).join("\n");
|
|
1171
1236
|
i && n.push(`${t}\n${i}`);
|
|
1172
1237
|
}
|
|
1173
1238
|
let r = n.join("\n\n");
|
|
@@ -1177,16 +1242,16 @@ async function ge(e, t) {
|
|
|
1177
1242
|
console.error("agent: copyTranscript failed", e);
|
|
1178
1243
|
}
|
|
1179
1244
|
}
|
|
1180
|
-
function
|
|
1245
|
+
function _e(e, t) {
|
|
1181
1246
|
switch (t.type) {
|
|
1182
1247
|
case "text": return t.text;
|
|
1183
1248
|
case "tool_use": {
|
|
1184
|
-
let n =
|
|
1249
|
+
let n = J(e, t.name, t.input);
|
|
1185
1250
|
return `${n.sub ? `→ ${n.label} (${n.sub})` : `→ ${n.label}`}\n${JSON.stringify(t.input, null, 2)}`;
|
|
1186
1251
|
}
|
|
1187
|
-
case "tool_result": return `${`${t.is_error ? "✗" : "✓"} ${
|
|
1252
|
+
case "tool_result": return `${`${t.is_error ? "✗" : "✓"} ${Y(e, t)}`}\n${JSON.stringify(t.output, null, 2)}`;
|
|
1188
1253
|
case "elicit_response": return `${e("agent.panel.chip.answer", "answer")}\n${JSON.stringify(t.data, null, 2)}`;
|
|
1189
|
-
case "decision": return `${
|
|
1254
|
+
case "decision": return `${X(e, t.decision)} ${t.tool_code}${t.note ? ` — ${t.note}` : ""}`;
|
|
1190
1255
|
case "system": return `— ${t.reason}`;
|
|
1191
1256
|
case "summary": return t.text;
|
|
1192
1257
|
case "attachment": return t.content;
|
|
@@ -1196,23 +1261,23 @@ function Z(e, t) {
|
|
|
1196
1261
|
function Q(e, t) {
|
|
1197
1262
|
return e("agent.panel.proposal", "Run {code}.", { code: t });
|
|
1198
1263
|
}
|
|
1199
|
-
function
|
|
1200
|
-
let a =
|
|
1201
|
-
if (!
|
|
1202
|
-
|
|
1264
|
+
function ve({ tool: t, onApprove: r, onReject: i }) {
|
|
1265
|
+
let a = d(), o = d("errors"), s = JSON.stringify(t.params ?? {}, null, 2), [c, ee] = C(!1), [l, u] = C(!1), [f, te] = C(""), [p, h] = C(null), [g, _] = C(!1), v = async (e) => {
|
|
1266
|
+
if (!g) {
|
|
1267
|
+
_(!0);
|
|
1203
1268
|
try {
|
|
1204
1269
|
await r(e);
|
|
1205
1270
|
} catch (e) {
|
|
1206
|
-
|
|
1271
|
+
h(m(o, e)), _(!1);
|
|
1207
1272
|
}
|
|
1208
1273
|
}
|
|
1209
|
-
},
|
|
1210
|
-
if (!
|
|
1211
|
-
|
|
1274
|
+
}, y = async () => {
|
|
1275
|
+
if (!g) {
|
|
1276
|
+
_(!0);
|
|
1212
1277
|
try {
|
|
1213
|
-
await i(
|
|
1278
|
+
await i(f.trim() || void 0);
|
|
1214
1279
|
} catch (e) {
|
|
1215
|
-
|
|
1280
|
+
h(m(o, e)), _(!1);
|
|
1216
1281
|
}
|
|
1217
1282
|
}
|
|
1218
1283
|
}, b = typeof t.confidence == "number" ? Math.round(Math.max(0, Math.min(1, t.confidence)) * 100) : null;
|
|
@@ -1287,7 +1352,7 @@ function _e({ tool: t, onApprove: r, onReject: i }) {
|
|
|
1287
1352
|
}),
|
|
1288
1353
|
/* @__PURE__ */ T("button", {
|
|
1289
1354
|
type: "button",
|
|
1290
|
-
onClick: () =>
|
|
1355
|
+
onClick: () => ee((e) => !e),
|
|
1291
1356
|
style: {
|
|
1292
1357
|
background: "transparent",
|
|
1293
1358
|
border: 0,
|
|
@@ -1328,18 +1393,18 @@ function _e({ tool: t, onApprove: r, onReject: i }) {
|
|
|
1328
1393
|
},
|
|
1329
1394
|
children: s
|
|
1330
1395
|
}),
|
|
1331
|
-
|
|
1396
|
+
p && /* @__PURE__ */ w("div", {
|
|
1332
1397
|
style: {
|
|
1333
1398
|
marginTop: 4,
|
|
1334
1399
|
fontSize: 10.5,
|
|
1335
1400
|
color: "var(--text-2)"
|
|
1336
1401
|
},
|
|
1337
|
-
children:
|
|
1402
|
+
children: p
|
|
1338
1403
|
}),
|
|
1339
|
-
|
|
1404
|
+
l && /* @__PURE__ */ w("input", {
|
|
1340
1405
|
type: "text",
|
|
1341
|
-
value:
|
|
1342
|
-
onChange: (e) =>
|
|
1406
|
+
value: f,
|
|
1407
|
+
onChange: (e) => te(e.target.value),
|
|
1343
1408
|
placeholder: a("agent.panel.reject_note", "Why not? (optional) — then Send rejection"),
|
|
1344
1409
|
autoFocus: !0,
|
|
1345
1410
|
style: {
|
|
@@ -1361,32 +1426,32 @@ function _e({ tool: t, onApprove: r, onReject: i }) {
|
|
|
1361
1426
|
justifyContent: "flex-end"
|
|
1362
1427
|
},
|
|
1363
1428
|
children: [
|
|
1364
|
-
|
|
1429
|
+
l ? /* @__PURE__ */ w(n, {
|
|
1365
1430
|
size: "xs",
|
|
1366
1431
|
kind: "ghost",
|
|
1367
|
-
onClick:
|
|
1368
|
-
disabled:
|
|
1432
|
+
onClick: y,
|
|
1433
|
+
disabled: g,
|
|
1369
1434
|
children: a("agent.panel.reject_send", "Send rejection")
|
|
1370
1435
|
}) : /* @__PURE__ */ w(n, {
|
|
1371
1436
|
size: "xs",
|
|
1372
1437
|
kind: "ghost",
|
|
1373
|
-
onClick: () =>
|
|
1374
|
-
disabled:
|
|
1438
|
+
onClick: () => u(!0),
|
|
1439
|
+
disabled: g,
|
|
1375
1440
|
children: a("agent.panel.reject", "Reject…")
|
|
1376
1441
|
}),
|
|
1377
1442
|
t.confirmation_mode !== "always" && /* @__PURE__ */ w(n, {
|
|
1378
1443
|
size: "xs",
|
|
1379
1444
|
kind: "ghost",
|
|
1380
|
-
onClick: () =>
|
|
1381
|
-
disabled:
|
|
1445
|
+
onClick: () => v("conversation"),
|
|
1446
|
+
disabled: g,
|
|
1382
1447
|
children: a("agent.panel.approve_chat", "Approve for this chat")
|
|
1383
1448
|
}),
|
|
1384
1449
|
/* @__PURE__ */ w(n, {
|
|
1385
1450
|
size: "xs",
|
|
1386
1451
|
kind: "primary",
|
|
1387
1452
|
icon: /* @__PURE__ */ w(e.check, { size: 11 }),
|
|
1388
|
-
onClick: () =>
|
|
1389
|
-
disabled:
|
|
1453
|
+
onClick: () => v("call"),
|
|
1454
|
+
disabled: g,
|
|
1390
1455
|
children: a("agent.panel.approve_once", "Approve once")
|
|
1391
1456
|
})
|
|
1392
1457
|
]
|
|
@@ -1,41 +1,55 @@
|
|
|
1
1
|
// src/components/agents/transcript-runs.ts
|
|
2
2
|
var e = /* @__PURE__ */ new Set(["operation.search"]);
|
|
3
|
-
function t(t,
|
|
4
|
-
let
|
|
5
|
-
for (let e of
|
|
6
|
-
let
|
|
3
|
+
function t(t, a = []) {
|
|
4
|
+
let c = [], l = /* @__PURE__ */ new Map();
|
|
5
|
+
for (let e of a) e.assistant_message_id && e.provider_call_id && l.set(i(e.assistant_message_id, e.provider_call_id), e);
|
|
6
|
+
let u = /* @__PURE__ */ new Map(), d = new Set(t.filter((e) => e.role === "assistant").map((e) => e.id));
|
|
7
7
|
for (let e of t) {
|
|
8
8
|
let t = e.delivery_key?.startsWith("reply:") ? e.delivery_key.slice(6) : "";
|
|
9
|
-
|
|
9
|
+
d.has(t) && u.set(t, e);
|
|
10
10
|
}
|
|
11
|
-
let
|
|
12
|
-
for (let
|
|
13
|
-
if (
|
|
14
|
-
let t = n
|
|
15
|
-
if (
|
|
16
|
-
let e =
|
|
17
|
-
|
|
11
|
+
let f = new Set(u.values());
|
|
12
|
+
for (let n of t) {
|
|
13
|
+
if (f.has(n)) continue;
|
|
14
|
+
let t = r(n, l);
|
|
15
|
+
if (s(n)) {
|
|
16
|
+
let e = u.get(n.id);
|
|
17
|
+
c.push({
|
|
18
18
|
kind: "message",
|
|
19
|
-
message:
|
|
19
|
+
message: o(n),
|
|
20
20
|
...e ? { delivered: e } : {}
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
if (t.length === 0) continue;
|
|
24
|
-
let i =
|
|
24
|
+
let i = c[c.length - 1], a = i?.kind === "run" ? i : (c.push({
|
|
25
25
|
kind: "run",
|
|
26
|
-
id:
|
|
26
|
+
id: n.id,
|
|
27
27
|
calls: []
|
|
28
|
-
}),
|
|
29
|
-
for (let n of t) e.has(n.name) ||
|
|
30
|
-
|
|
28
|
+
}), c[c.length - 1]);
|
|
29
|
+
for (let n of t) e.has(n.name) || a.calls.push(n);
|
|
30
|
+
a.calls.length === 0 && c.pop();
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return n(c), c;
|
|
33
33
|
}
|
|
34
|
-
function n(e
|
|
34
|
+
function n(e) {
|
|
35
|
+
let t = "";
|
|
36
|
+
for (let n of e) {
|
|
37
|
+
if (n.kind !== "message") continue;
|
|
38
|
+
let e = n.delivered ?? n.message;
|
|
39
|
+
if (!e.bot_id) continue;
|
|
40
|
+
let r = [
|
|
41
|
+
e.bot_id,
|
|
42
|
+
e.chat_id ?? "",
|
|
43
|
+
e.topic_id ?? ""
|
|
44
|
+
].join("\0");
|
|
45
|
+
r !== t && (n.showsPlace = !0), t = r;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function r(e, t) {
|
|
35
49
|
let n = [];
|
|
36
|
-
for (let
|
|
37
|
-
if (
|
|
38
|
-
let a =
|
|
50
|
+
for (let r of e.content ?? []) {
|
|
51
|
+
if (r.type !== "tool_use") continue;
|
|
52
|
+
let a = r, o = a.id ?? "", s = t.get(i(e.id, o)), c = s?.status;
|
|
39
53
|
n.push({
|
|
40
54
|
id: s?.id ?? `${e.id}:${o || n.length}`,
|
|
41
55
|
name: a.name ?? "",
|
|
@@ -48,22 +62,22 @@ function n(e, t) {
|
|
|
48
62
|
}
|
|
49
63
|
return n;
|
|
50
64
|
}
|
|
51
|
-
function
|
|
65
|
+
function i(e, t) {
|
|
52
66
|
return `${e}\u0000${t}`;
|
|
53
67
|
}
|
|
54
|
-
var
|
|
68
|
+
var a = /* @__PURE__ */ new Set([
|
|
55
69
|
"tool_use",
|
|
56
70
|
"tool_result",
|
|
57
71
|
"thinking",
|
|
58
72
|
"redacted_thinking"
|
|
59
73
|
]);
|
|
60
|
-
function
|
|
74
|
+
function o(e) {
|
|
61
75
|
return {
|
|
62
76
|
...e,
|
|
63
|
-
content: (e.content ?? []).filter((e) => !
|
|
77
|
+
content: (e.content ?? []).filter((e) => !a.has(e.type))
|
|
64
78
|
};
|
|
65
79
|
}
|
|
66
|
-
function
|
|
67
|
-
return (e.attachments?.length ?? 0) > 0 || (e.content ?? []).some((e) => !
|
|
80
|
+
function s(e) {
|
|
81
|
+
return (e.attachments?.length ?? 0) > 0 || (e.content ?? []).some((e) => !a.has(e.type));
|
|
68
82
|
}
|
|
69
83
|
export { t as fold };
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -1990,11 +1990,21 @@ interface CommandPaletteProps {
|
|
|
1990
1990
|
}
|
|
1991
1991
|
export declare function CommandPalette(props: CommandPaletteProps): import("react").JSX.Element;
|
|
1992
1992
|
type AgentRole = "user" | "assistant" | "tool" | "system";
|
|
1993
|
+
/** A button a messenger message carried; the panel shows it, only the messenger presses it. */
|
|
1994
|
+
type AgentMessengerButton = {
|
|
1995
|
+
text: string;
|
|
1996
|
+
callback_data?: string;
|
|
1997
|
+
url?: string;
|
|
1998
|
+
web_app?: {
|
|
1999
|
+
url: string;
|
|
2000
|
+
};
|
|
2001
|
+
};
|
|
1993
2002
|
type AgentContentBlock = {
|
|
1994
2003
|
type: "text";
|
|
1995
2004
|
text: string;
|
|
1996
2005
|
callback_data?: string;
|
|
1997
2006
|
heard?: boolean;
|
|
2007
|
+
buttons?: AgentMessengerButton[][];
|
|
1998
2008
|
} | {
|
|
1999
2009
|
type: "reaction";
|
|
2000
2010
|
emoji?: string;
|
|
@@ -2411,4 +2421,4 @@ export declare function isFieldSoDProtected(schema: Schema | undefined, entity:
|
|
|
2411
2421
|
* both classification name + required_permission hint).
|
|
2412
2422
|
*/
|
|
2413
2423
|
export declare function fieldAccessInfo(entity: Entity | undefined, fieldName: string): FieldAccessInfo | undefined;
|
|
2414
|
-
export { type Action, ActionBatchError, type ActionExecuteRequest, type ActionExecuteResponse, type ActionItemError, type ActionItemSkip, type ActionListPage, type AgentChatPanelProps, type AgentContentBlock, type AgentConversation, type AgentConversationDrawerProps, type AgentConversationStatus, type AgentElicitFormProps, type AgentInvocationKind, type AgentInvocationStatus, type AgentMessage, type AgentPickerProps, type AgentRole, type AgentToolInvocation, type AgentTurn, type AgentTurnState, type AgentTurnStatus, type AggregateGroup, type AggregateParams, type AggregateResponse, type ApiError, App as Declarion, type ApprovalScope, type AuthShellProps, type AuthUser, type AvailableAgent, type AvatarProps, type BatchOp, type BatchOpResult, type BatchResponse, type BoolToggleProps, type BrandGlyphProps, type BreadcrumbsProps, type BtnKind, type BtnProps, type BtnSize, CURSOR_LANGUAGE_CHANGED, CURSOR_SEMANTICS_MISMATCH, type CanonicalLocation, type ChangePasswordDialogProps, type CheckProps, type CheckSetupResponse, type ChildRelation, type ChipProps, type ClassificationTierDef, type CommandAction, type CommandActionType, type CommandPaletteProps, type CropperOptions, type CropperResult, type Crumb, type CurrencyDisplay, type CurrentScreen, type CursorActionDataResult, type CursorEntityDataParams, type CursorEntityDataResult, type CustomScreenProps, DEFAULT_RESPONSIVE_BREAKPOINTS, type DataResponse, type DateInputProps, type DraftEntry, type DropdownProps, DynamicIcon, type EnrichedRow, type Entity, type EntityField, type EnumDef, type FieldAccessInfo, type FieldLabelProps, type FileAddress, type FileDraftScopeApi, type FileFieldDef, type FileFieldDisplay, type FileFieldMode, type FileSelection, type FileSelectionEvent, type FileSelectionState, type FileSelectionSummary, type FileWidget, type FileWidgetProps, type FilterNode, type FilterOp, type FilterRecord, type FilterRecordField, type FilterRecordFields, type FilterURLState, type HoverCardAlign, type HoverCardProps, type HydratedFile, Icon, type IconBtnProps, type IconDef, type IconName, type IconProps, type ImageCropper, type InfoTooltipProps, type InlineEditCellProps, type InlineEditKind, type InlineEditTrigger, type JsonFieldProps, type LanguageDef, type LayoutWidget, type LayoutWidgetProps, type ListMeta, type ListParams, type ListResponse, type LiveObjectResult, type LocalizedString, type LoginResponse, MANDATORY_LANGUAGE, MULTIPLE_VALUES, type MassEditTarget, type MassEditTargetKind, type MenuItemProps, type MoneyTextOptions, type MultiSelectProps, NO_VALUE_OPS, type NavNode, OP_LABELS, type ObjectActionBarProps, type ObjectActionBarSlot, type ObjectActionSelection, OrderedMap, type PageStateSetter, type ParameterDef, type PasswordInputProps, type PatchMap, type PillProps, type PillSize, type PillTone, type PkValues, type PropertyDef, type PropertyValue, type PublicParam, type QEFieldProps, type QuickEditCellProps, type QuickPeekFieldSpec, type QuickPeekProps, type RailAreaItem, type RailProps, type ReadDisplayState, type ReadQuery, type RecordIdBadgeProps, type RefComboboxProps, type RefFieldItem, type RefFieldProps, type RefreshControlProps, type Refs, type ResponsiveBreakpoints, type ResponsiveMode, ResponsiveModeProvider, type ResponsiveViewport, type ReturnTarget, type RowFieldProps, type RowHelpers, type RunActionOptions, type Schema, type Screen, type ScreenBack, type ScrollAnchor, type ScrollableVirtualizer, type SectionBadge, type SectionCardProps, type SectionEmphasis, type SelectOption, type SelectProps, type SidebarProps, type StatTileProps, type StatTileTone, type StatusDef, type StatusGroupDef, type StatusInfo, type StructureDef, type TabItem, type TabStripProps, type TagsInputProps, type Tenant, type TenantChipProps, type TextAreaProps, type TextFn, type TextInputProps, type TextVars, type TooltipProps, type TopBarProps, type UploadCheck, type UploadProgress, type UploadedFile, type UseFileSelection, type UseFileSelectionOptions, type UseObjectActionsResult, type UseScreenBackOptions, type UseScreenTabOptions, type V2ListParams, type V2ListResponse, type V2Meta, type V2ParamInstance, type V2PropertyInstance, type V2StatusInstance, type ViewFieldProps, type ViewportCategory, buildActionBody, buildDetailHrefFromId, buildEntityDetailHref, buildRowDetailHref, countActiveFilters, deleteObject, executeAction, extractPkValues, fieldDisplayName, getIcon, getPrimaryKeyFields, hasOrGroups, isCursorStaleError, makeTextFn, parseFilterURLState, parseFiltersFromURL, pickLocalized, pkValuePartsToId, pkValuesFromId, pkValuesToDetailId, pkValuesToId, pluralText, resolveDetailRoute, resolveViewportCategory, restoreObject, setFiltersInURL, setIconRegistry, textWithNodes, useLocation, useNavigate, useParams, useResponsiveMode, useSearchParams };
|
|
2424
|
+
export { type Action, ActionBatchError, type ActionExecuteRequest, type ActionExecuteResponse, type ActionItemError, type ActionItemSkip, type ActionListPage, type AgentChatPanelProps, type AgentContentBlock, type AgentConversation, type AgentConversationDrawerProps, type AgentConversationStatus, type AgentElicitFormProps, type AgentInvocationKind, type AgentInvocationStatus, type AgentMessage, type AgentMessengerButton, type AgentPickerProps, type AgentRole, type AgentToolInvocation, type AgentTurn, type AgentTurnState, type AgentTurnStatus, type AggregateGroup, type AggregateParams, type AggregateResponse, type ApiError, App as Declarion, type ApprovalScope, type AuthShellProps, type AuthUser, type AvailableAgent, type AvatarProps, type BatchOp, type BatchOpResult, type BatchResponse, type BoolToggleProps, type BrandGlyphProps, type BreadcrumbsProps, type BtnKind, type BtnProps, type BtnSize, CURSOR_LANGUAGE_CHANGED, CURSOR_SEMANTICS_MISMATCH, type CanonicalLocation, type ChangePasswordDialogProps, type CheckProps, type CheckSetupResponse, type ChildRelation, type ChipProps, type ClassificationTierDef, type CommandAction, type CommandActionType, type CommandPaletteProps, type CropperOptions, type CropperResult, type Crumb, type CurrencyDisplay, type CurrentScreen, type CursorActionDataResult, type CursorEntityDataParams, type CursorEntityDataResult, type CustomScreenProps, DEFAULT_RESPONSIVE_BREAKPOINTS, type DataResponse, type DateInputProps, type DraftEntry, type DropdownProps, DynamicIcon, type EnrichedRow, type Entity, type EntityField, type EnumDef, type FieldAccessInfo, type FieldLabelProps, type FileAddress, type FileDraftScopeApi, type FileFieldDef, type FileFieldDisplay, type FileFieldMode, type FileSelection, type FileSelectionEvent, type FileSelectionState, type FileSelectionSummary, type FileWidget, type FileWidgetProps, type FilterNode, type FilterOp, type FilterRecord, type FilterRecordField, type FilterRecordFields, type FilterURLState, type HoverCardAlign, type HoverCardProps, type HydratedFile, Icon, type IconBtnProps, type IconDef, type IconName, type IconProps, type ImageCropper, type InfoTooltipProps, type InlineEditCellProps, type InlineEditKind, type InlineEditTrigger, type JsonFieldProps, type LanguageDef, type LayoutWidget, type LayoutWidgetProps, type ListMeta, type ListParams, type ListResponse, type LiveObjectResult, type LocalizedString, type LoginResponse, MANDATORY_LANGUAGE, MULTIPLE_VALUES, type MassEditTarget, type MassEditTargetKind, type MenuItemProps, type MoneyTextOptions, type MultiSelectProps, NO_VALUE_OPS, type NavNode, OP_LABELS, type ObjectActionBarProps, type ObjectActionBarSlot, type ObjectActionSelection, OrderedMap, type PageStateSetter, type ParameterDef, type PasswordInputProps, type PatchMap, type PillProps, type PillSize, type PillTone, type PkValues, type PropertyDef, type PropertyValue, type PublicParam, type QEFieldProps, type QuickEditCellProps, type QuickPeekFieldSpec, type QuickPeekProps, type RailAreaItem, type RailProps, type ReadDisplayState, type ReadQuery, type RecordIdBadgeProps, type RefComboboxProps, type RefFieldItem, type RefFieldProps, type RefreshControlProps, type Refs, type ResponsiveBreakpoints, type ResponsiveMode, ResponsiveModeProvider, type ResponsiveViewport, type ReturnTarget, type RowFieldProps, type RowHelpers, type RunActionOptions, type Schema, type Screen, type ScreenBack, type ScrollAnchor, type ScrollableVirtualizer, type SectionBadge, type SectionCardProps, type SectionEmphasis, type SelectOption, type SelectProps, type SidebarProps, type StatTileProps, type StatTileTone, type StatusDef, type StatusGroupDef, type StatusInfo, type StructureDef, type TabItem, type TabStripProps, type TagsInputProps, type Tenant, type TenantChipProps, type TextAreaProps, type TextFn, type TextInputProps, type TextVars, type TooltipProps, type TopBarProps, type UploadCheck, type UploadProgress, type UploadedFile, type UseFileSelection, type UseFileSelectionOptions, type UseObjectActionsResult, type UseScreenBackOptions, type UseScreenTabOptions, type V2ListParams, type V2ListResponse, type V2Meta, type V2ParamInstance, type V2PropertyInstance, type V2StatusInstance, type ViewFieldProps, type ViewportCategory, buildActionBody, buildDetailHrefFromId, buildEntityDetailHref, buildRowDetailHref, countActiveFilters, deleteObject, executeAction, extractPkValues, fieldDisplayName, getIcon, getPrimaryKeyFields, hasOrGroups, isCursorStaleError, makeTextFn, parseFilterURLState, parseFiltersFromURL, pickLocalized, pkValuePartsToId, pkValuesFromId, pkValuesToDetailId, pkValuesToId, pluralText, resolveDetailRoute, resolveViewportCategory, restoreObject, setFiltersInURL, setIconRegistry, textWithNodes, useLocation, useNavigate, useParams, useResponsiveMode, useSearchParams };
|