@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
package/dist-lib/api/agents.js
CHANGED
|
@@ -50,19 +50,36 @@ async function l(t) {
|
|
|
50
50
|
async function u(t) {
|
|
51
51
|
await e("agents.cancel_conversation", { conversation_id: t });
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
function d(e) {
|
|
54
|
+
return (e.data ?? []).map((t) => {
|
|
55
|
+
let n = t.agent_id ? e.$refs?.agent?.[t.agent_id] : void 0;
|
|
56
|
+
return {
|
|
57
|
+
...t,
|
|
58
|
+
agent: n?.code,
|
|
59
|
+
agent_name: n?.name
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async function f(e = 1) {
|
|
64
|
+
return d(await t("agent_conversation", {
|
|
55
65
|
sort: "updated_at:desc",
|
|
56
|
-
page:
|
|
66
|
+
page: e,
|
|
57
67
|
per_page: 50
|
|
58
|
-
});
|
|
59
|
-
return (e.data ?? []).map((t) => ({
|
|
60
|
-
...t,
|
|
61
|
-
agent: t.agent_id ? e.$refs?.agent?.[t.agent_id]?.code : void 0
|
|
62
68
|
}));
|
|
63
69
|
}
|
|
64
|
-
async function
|
|
65
|
-
return
|
|
70
|
+
async function p(e) {
|
|
71
|
+
return d(await t("agent_conversation", {
|
|
72
|
+
filters: [{
|
|
73
|
+
field: "id",
|
|
74
|
+
op: "eq",
|
|
75
|
+
value: e
|
|
76
|
+
}],
|
|
77
|
+
page: 1,
|
|
78
|
+
per_page: 1
|
|
79
|
+
}))[0];
|
|
80
|
+
}
|
|
81
|
+
async function m(e) {
|
|
82
|
+
return _("agent_turn", {
|
|
66
83
|
filters: [{
|
|
67
84
|
field: "conversation_id",
|
|
68
85
|
op: "eq",
|
|
@@ -71,8 +88,8 @@ async function f(e) {
|
|
|
71
88
|
sort: "runnable_message_seq:asc"
|
|
72
89
|
});
|
|
73
90
|
}
|
|
74
|
-
async function
|
|
75
|
-
return
|
|
91
|
+
async function h(e) {
|
|
92
|
+
return _("agent_tool_invocation", {
|
|
76
93
|
filters: [{
|
|
77
94
|
field: "conversation_id",
|
|
78
95
|
op: "eq",
|
|
@@ -81,7 +98,7 @@ async function p(e) {
|
|
|
81
98
|
sort: "created_at:asc"
|
|
82
99
|
});
|
|
83
100
|
}
|
|
84
|
-
async function
|
|
101
|
+
async function g(e) {
|
|
85
102
|
let n = [];
|
|
86
103
|
for (let r = 1;; r += 1) {
|
|
87
104
|
let i = await t("agent_message", {
|
|
@@ -102,7 +119,7 @@ async function m(e) {
|
|
|
102
119
|
if (a.length === 0) throw Error("agent_message pagination did not advance");
|
|
103
120
|
}
|
|
104
121
|
}
|
|
105
|
-
async function
|
|
122
|
+
async function _(e, n) {
|
|
106
123
|
let r = [];
|
|
107
124
|
for (let i = 1;; i += 1) {
|
|
108
125
|
let a = await t(e, {
|
|
@@ -114,4 +131,4 @@ async function h(e, n) {
|
|
|
114
131
|
if (o.length === 0) throw Error(`${e} pagination did not advance`);
|
|
115
132
|
}
|
|
116
133
|
}
|
|
117
|
-
export { a as answerQuestion, s as approveInvocation, u as cancelConversation, l as cancelInvocation, r as createConversation, n as listAvailableAgents,
|
|
134
|
+
export { a as answerQuestion, s as approveInvocation, u as cancelConversation, l as cancelInvocation, r as createConversation, n as listAvailableAgents, f as listConversations, p as loadConversation, h as loadConversationInvocations, m as loadConversationTurns, g as loadHistory, c as rejectInvocation, o as sendElicitResponse, i as sendMessage };
|
|
@@ -140,9 +140,9 @@ function M({ open: n, onOpenChange: c, action: u, actionName: d, onSubmit: C, is
|
|
|
140
140
|
M,
|
|
141
141
|
W,
|
|
142
142
|
I
|
|
143
|
-
]), [K] = y(G), [q, J] = y(K);
|
|
143
|
+
]), [K] = y(G), [q, J] = y(K), [Y, X] = y(!1);
|
|
144
144
|
m(n && JSON.stringify(q) !== JSON.stringify(K));
|
|
145
|
-
let
|
|
145
|
+
let Z = h((e, t) => {
|
|
146
146
|
J((n) => {
|
|
147
147
|
let r = {
|
|
148
148
|
...n,
|
|
@@ -156,11 +156,14 @@ function M({ open: n, onOpenChange: c, action: u, actionName: d, onSubmit: C, is
|
|
|
156
156
|
}
|
|
157
157
|
return r;
|
|
158
158
|
});
|
|
159
|
-
}, [F]),
|
|
159
|
+
}, [F]), Q = h(() => {
|
|
160
160
|
let e = { ...q };
|
|
161
161
|
for (let [t, n] of V) {
|
|
162
162
|
let r = q[t], i = r == null || r === "";
|
|
163
|
-
if (n.required && i)
|
|
163
|
+
if (n.required && i) {
|
|
164
|
+
X(!0);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
164
167
|
i && !T(n, K[t], r) && delete e[t];
|
|
165
168
|
}
|
|
166
169
|
C(e);
|
|
@@ -304,19 +307,19 @@ function M({ open: n, onOpenChange: c, action: u, actionName: d, onSubmit: C, is
|
|
|
304
307
|
filterTargets: t,
|
|
305
308
|
selectedRows: M,
|
|
306
309
|
value: q[e] ?? {},
|
|
307
|
-
onChange: (t) =>
|
|
310
|
+
onChange: (t) => Z(e, t)
|
|
308
311
|
});
|
|
309
312
|
} else if (n.type === "status_group") i = /* @__PURE__ */ x(A, {
|
|
310
313
|
param: n,
|
|
311
314
|
value: q[e],
|
|
312
|
-
onChange: (t) =>
|
|
315
|
+
onChange: (t) => Z(e, t),
|
|
313
316
|
statusGroups: H,
|
|
314
317
|
formData: q
|
|
315
318
|
});
|
|
316
319
|
else if (n.type === "status") i = /* @__PURE__ */ x(j, {
|
|
317
320
|
param: n,
|
|
318
321
|
value: q[e],
|
|
319
|
-
onChange: (t) =>
|
|
322
|
+
onChange: (t) => Z(e, t),
|
|
320
323
|
statusGroups: H,
|
|
321
324
|
formData: q
|
|
322
325
|
});
|
|
@@ -327,7 +330,7 @@ function M({ open: n, onOpenChange: c, action: u, actionName: d, onSubmit: C, is
|
|
|
327
330
|
fieldName: e,
|
|
328
331
|
value: q[e],
|
|
329
332
|
mode: "edit",
|
|
330
|
-
onChange: (t) =>
|
|
333
|
+
onChange: (t) => Z(e, t),
|
|
331
334
|
t: N
|
|
332
335
|
});
|
|
333
336
|
}
|
|
@@ -339,6 +342,16 @@ function M({ open: n, onOpenChange: c, action: u, actionName: d, onSubmit: C, is
|
|
|
339
342
|
children: r
|
|
340
343
|
}),
|
|
341
344
|
i,
|
|
345
|
+
Y && n.required && (q[e] == null || q[e] === "") && /* @__PURE__ */ x("p", {
|
|
346
|
+
role: "alert",
|
|
347
|
+
style: {
|
|
348
|
+
fontSize: 11,
|
|
349
|
+
color: "var(--danger)",
|
|
350
|
+
marginTop: 4,
|
|
351
|
+
marginBottom: 0
|
|
352
|
+
},
|
|
353
|
+
children: N("record.field.required", "Required")
|
|
354
|
+
}),
|
|
342
355
|
n.display?.description && /* @__PURE__ */ x("p", {
|
|
343
356
|
style: {
|
|
344
357
|
fontSize: 11,
|
|
@@ -376,7 +389,7 @@ function M({ open: n, onOpenChange: c, action: u, actionName: d, onSubmit: C, is
|
|
|
376
389
|
kind: "primary",
|
|
377
390
|
danger: L,
|
|
378
391
|
icon: x(D ? a : L ? r.trash : r.bolt, { size: 13 }),
|
|
379
|
-
onClick:
|
|
392
|
+
onClick: Q,
|
|
380
393
|
disabled: D,
|
|
381
394
|
children: D ? N("action.dialog.working", "Working…") : d || N("dialog.confirm", "Confirm")
|
|
382
395
|
})
|