@declarion/react 0.186.0 → 0.189.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/client.js +73 -73
- package/dist-lib/components/agents/AgentChatPanel.impl.js +170 -121
- package/dist-lib/index.d.ts +11 -1
- package/package.json +1 -1
package/dist-lib/api/client.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ApiError as e, NetworkError as t, errorCodeOf as n, readProblem as r } from "../types/api.js";
|
|
2
2
|
import { loginPathForCurrentLocation as i } from "./auth-redirect.js";
|
|
3
3
|
import { observe as a } from "../lib/versionTracker.js";
|
|
4
|
-
import { awaitEmbedToken as
|
|
5
|
-
import { REFRESH_TIMEOUT_MS as
|
|
6
|
-
import { clearAccessExpiry as f, recordAccessExpiry as p } from "./access-expiry.js";
|
|
4
|
+
import { awaitEmbedToken as ee, clearEmbedToken as o, getEmbedToken as s, isEmbedTokenMode as c } from "../embed/token.js";
|
|
5
|
+
import { REFRESH_TIMEOUT_MS as l, requestTimeoutMs as u } from "./request-bounds.js";
|
|
6
|
+
import { clearAccessExpiry as d, clearSignOut as f, recordAccessExpiry as p } from "./access-expiry.js";
|
|
7
7
|
import { sameAudience as m } from "./audience.js";
|
|
8
8
|
// src/api/client.ts
|
|
9
9
|
var h = (e) => JSON.stringify(e ?? {}), g = null, _ = "declarion.auth.refresh.result", v = "declarion.auth.refresh";
|
|
@@ -31,7 +31,7 @@ function x(e) {
|
|
|
31
31
|
async function S() {
|
|
32
32
|
let e = navigator.locks;
|
|
33
33
|
if (!e) {
|
|
34
|
-
await
|
|
34
|
+
await F();
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
37
37
|
let t = Date.now();
|
|
@@ -43,7 +43,7 @@ async function S() {
|
|
|
43
43
|
} else try {
|
|
44
44
|
b({
|
|
45
45
|
ok: !0,
|
|
46
|
-
access_expires_at: await
|
|
46
|
+
access_expires_at: await F()
|
|
47
47
|
});
|
|
48
48
|
} catch (e) {
|
|
49
49
|
throw e instanceof C && b({
|
|
@@ -65,27 +65,27 @@ function T() {
|
|
|
65
65
|
}), w;
|
|
66
66
|
}
|
|
67
67
|
function E(e) {
|
|
68
|
-
return O || (
|
|
68
|
+
return O || (I = null, c() || p(e), typeof window > "u") ? Promise.resolve() : T().then((t) => t.scheduleRenewal(e), () => void 0);
|
|
69
69
|
}
|
|
70
70
|
function D() {
|
|
71
|
-
|
|
71
|
+
d(), w?.then((e) => e.cancelRenewal());
|
|
72
72
|
}
|
|
73
73
|
var O = !1;
|
|
74
|
-
function
|
|
74
|
+
function k() {
|
|
75
75
|
O = !0, D();
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function A() {
|
|
78
78
|
return O;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
return O = !1,
|
|
80
|
+
function j(e) {
|
|
81
|
+
return O = !1, f(), L += 1, E(e);
|
|
82
82
|
}
|
|
83
83
|
typeof window < "u" && window.addEventListener("storage", (e) => {
|
|
84
|
-
if (e.key !== _ ||
|
|
84
|
+
if (e.key !== _ || c()) return;
|
|
85
85
|
let t = y(() => e.newValue);
|
|
86
86
|
t?.ok && t.access_expires_at && E(t.access_expires_at);
|
|
87
87
|
});
|
|
88
|
-
async function
|
|
88
|
+
async function M(e, n, r) {
|
|
89
89
|
let i = new AbortController(), a = setTimeout(() => i.abort(), r);
|
|
90
90
|
try {
|
|
91
91
|
return await fetch(e, {
|
|
@@ -98,145 +98,145 @@ async function j(e, n, r) {
|
|
|
98
98
|
clearTimeout(a);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
async function
|
|
101
|
+
async function N(e) {
|
|
102
102
|
try {
|
|
103
103
|
return (await e.json())?.result?.expires_at;
|
|
104
104
|
} catch {
|
|
105
105
|
return;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
function
|
|
109
|
-
return
|
|
108
|
+
function P() {
|
|
109
|
+
return M("/api/actions/auth.refresh", {
|
|
110
110
|
method: "POST",
|
|
111
111
|
credentials: "include",
|
|
112
112
|
headers: { "Content-Type": "application/json" },
|
|
113
113
|
body: h({})
|
|
114
|
-
},
|
|
114
|
+
}, l);
|
|
115
115
|
}
|
|
116
|
-
async function
|
|
117
|
-
let t = await
|
|
116
|
+
async function F() {
|
|
117
|
+
let t = await P();
|
|
118
118
|
if (t.status === 429) {
|
|
119
119
|
let e = parseInt(t.headers.get("Retry-After") || "1", 10);
|
|
120
|
-
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await
|
|
120
|
+
await r(t), await new Promise((t) => setTimeout(t, e * 1e3)), t = await P();
|
|
121
121
|
}
|
|
122
122
|
if (t.status >= 500) {
|
|
123
123
|
let n = await r(t);
|
|
124
124
|
throw new e(t.status, n.body, n.raw);
|
|
125
125
|
}
|
|
126
126
|
if (!t.ok) throw await r(t), new C(t.status);
|
|
127
|
-
let n = await
|
|
127
|
+
let n = await N(t);
|
|
128
128
|
return E(n), n;
|
|
129
129
|
}
|
|
130
|
-
var
|
|
131
|
-
function
|
|
130
|
+
var I = null, L = 0, R = /* @__PURE__ */ new Set(["auth.token_refresh_needed", "auth.unauthorized"]);
|
|
131
|
+
function z(n) {
|
|
132
132
|
return n instanceof t || n instanceof e;
|
|
133
133
|
}
|
|
134
|
-
async function
|
|
134
|
+
async function B() {
|
|
135
135
|
if (O) throw new C(401);
|
|
136
|
-
if (
|
|
136
|
+
if (I !== null) throw new C(I);
|
|
137
137
|
if (g) return g;
|
|
138
|
-
let e =
|
|
138
|
+
let e = L;
|
|
139
139
|
return g = S().catch((t) => {
|
|
140
|
-
throw t instanceof C && e ===
|
|
140
|
+
throw t instanceof C && e === L && (I = t.status), t;
|
|
141
141
|
}).finally(() => {
|
|
142
142
|
g = null;
|
|
143
143
|
}), g;
|
|
144
144
|
}
|
|
145
|
-
var
|
|
145
|
+
var V = () => {
|
|
146
146
|
if (typeof window > "u") return;
|
|
147
147
|
let { pathname: e } = window.location;
|
|
148
148
|
e.startsWith("/login") || e.startsWith("/signup") || e === "/reset" || e === "/forgot" || e === "/2fa" || (window.location.href = i());
|
|
149
149
|
};
|
|
150
|
-
function
|
|
151
|
-
let t =
|
|
152
|
-
return
|
|
150
|
+
function H(e) {
|
|
151
|
+
let t = V;
|
|
152
|
+
return V = e, t;
|
|
153
153
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
154
|
+
function U() {
|
|
155
|
+
return V;
|
|
156
156
|
}
|
|
157
|
-
var
|
|
157
|
+
var W = ({ status: e, code: t, message: n }) => {
|
|
158
158
|
console.error(`[API ${e}] ${t}: ${n}`);
|
|
159
159
|
};
|
|
160
|
-
function
|
|
160
|
+
function G(e, t, n, r) {
|
|
161
161
|
let i = new Headers(e);
|
|
162
162
|
return !i.has("Content-Type") && t && i.set("Content-Type", "application/json"), n.setAccept && !i.has("Accept") && i.set("Accept", "*/*"), r && i.set("Authorization", `Bearer ${r}`), i;
|
|
163
163
|
}
|
|
164
|
-
var
|
|
165
|
-
function
|
|
166
|
-
|
|
164
|
+
var K = null, q;
|
|
165
|
+
function J(e) {
|
|
166
|
+
q = e, K && e !== void 0 && !m(K.reader, e) && (K = null);
|
|
167
167
|
}
|
|
168
|
-
function
|
|
169
|
-
(
|
|
168
|
+
function te(e, t) {
|
|
169
|
+
(q === void 0 || m(e, q)) && (K = t ? {
|
|
170
170
|
language: t,
|
|
171
171
|
reader: e
|
|
172
172
|
} : null);
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
|
|
174
|
+
function ne(e) {
|
|
175
|
+
K = e ? {
|
|
176
176
|
language: e,
|
|
177
|
-
reader:
|
|
177
|
+
reader: q ?? null
|
|
178
178
|
} : null;
|
|
179
179
|
}
|
|
180
180
|
function Y() {
|
|
181
|
-
return
|
|
181
|
+
return K?.language ?? null;
|
|
182
182
|
}
|
|
183
183
|
function X(e) {
|
|
184
184
|
let t = Y();
|
|
185
185
|
return !t || !e.startsWith("/api/") || /[?&]language=/.test(e) ? e : `${e}${e.includes("?") ? "&" : "?"}language=${encodeURIComponent(t)}`;
|
|
186
186
|
}
|
|
187
|
-
async function Z(t, i,
|
|
188
|
-
let
|
|
187
|
+
async function Z(t, i, l, d) {
|
|
188
|
+
let f = X(t), p = c(), m = p ? "omit" : i.credentials ?? "include", h = p || m !== "omit", g = G(i.headers, !!i.body, l, p ? s() : null), _ = u(t, i), v = L, y = await M(f, {
|
|
189
189
|
...i,
|
|
190
|
-
headers:
|
|
191
|
-
credentials:
|
|
192
|
-
},
|
|
193
|
-
if (a(
|
|
194
|
-
let { raw: t, body: a } = await r(
|
|
195
|
-
if (
|
|
190
|
+
headers: g,
|
|
191
|
+
credentials: m
|
|
192
|
+
}, _);
|
|
193
|
+
if (a(y.headers), !y.ok) {
|
|
194
|
+
let { raw: t, body: a } = await r(y), s = n(a.type), c = a.title ?? "";
|
|
195
|
+
if (h && y.status === 401 && R.has(s)) try {
|
|
196
196
|
let t = null;
|
|
197
|
-
|
|
198
|
-
let a =
|
|
197
|
+
p ? (o(), t = await ee()) : await B();
|
|
198
|
+
let a = G(i.headers, !!i.body, l, t), s = await M(f, {
|
|
199
199
|
...i,
|
|
200
200
|
headers: a,
|
|
201
|
-
credentials:
|
|
202
|
-
},
|
|
203
|
-
if (!
|
|
204
|
-
let t = await r(
|
|
205
|
-
throw !
|
|
201
|
+
credentials: m
|
|
202
|
+
}, _);
|
|
203
|
+
if (!s.ok) {
|
|
204
|
+
let t = await r(s);
|
|
205
|
+
throw !p && v === L && s.status === 401 && R.has(n(t.body.type)) && (I = 401), s.status === 401 && !l.isSessionProbe && V(), new e(s.status, t.body, t.raw);
|
|
206
206
|
}
|
|
207
|
-
return
|
|
207
|
+
return d(s);
|
|
208
208
|
} catch (n) {
|
|
209
|
-
throw
|
|
209
|
+
throw z(n) ? n : (l.isSessionProbe || V(), new e(401, a, t));
|
|
210
210
|
}
|
|
211
|
-
throw
|
|
212
|
-
status:
|
|
213
|
-
code:
|
|
214
|
-
message:
|
|
215
|
-
}), new e(
|
|
211
|
+
throw h && y.status === 401 && !l.isSessionProbe && V(), W({
|
|
212
|
+
status: y.status,
|
|
213
|
+
code: s,
|
|
214
|
+
message: c
|
|
215
|
+
}), new e(y.status, a, t);
|
|
216
216
|
}
|
|
217
|
-
return
|
|
217
|
+
return d(y);
|
|
218
218
|
}
|
|
219
219
|
function Q(e) {
|
|
220
220
|
return e.status === 204 ? Promise.resolve(void 0) : e.json();
|
|
221
221
|
}
|
|
222
|
-
async function
|
|
222
|
+
async function re(e, t = {}, { isSessionProbe: n = !1 } = {}) {
|
|
223
223
|
return Z(e, t, {
|
|
224
224
|
setAccept: !1,
|
|
225
225
|
isSessionProbe: n
|
|
226
226
|
}, Q);
|
|
227
227
|
}
|
|
228
|
-
async function
|
|
228
|
+
async function ie(e) {
|
|
229
229
|
return {
|
|
230
230
|
blob: await e.blob(),
|
|
231
231
|
filename: $(e.headers),
|
|
232
232
|
headers: e.headers
|
|
233
233
|
};
|
|
234
234
|
}
|
|
235
|
-
async function
|
|
235
|
+
async function ae(e, t = {}) {
|
|
236
236
|
return Z(e, t, {
|
|
237
237
|
setAccept: !0,
|
|
238
238
|
isSessionProbe: !1
|
|
239
|
-
},
|
|
239
|
+
}, ie);
|
|
240
240
|
}
|
|
241
241
|
function $(e) {
|
|
242
242
|
let t = e.get("Content-Disposition");
|
|
@@ -248,7 +248,7 @@ function $(e) {
|
|
|
248
248
|
let r = t.match(/filename\s*=\s*("([^"]+)"|([^;]+))/i);
|
|
249
249
|
return r ? (r[2] ?? r[3] ?? "").trim() : "";
|
|
250
250
|
}
|
|
251
|
-
async function
|
|
251
|
+
async function oe(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, credentials: i } = {}) {
|
|
252
252
|
return (await Z(`/api/actions/${encodeURIComponent(e)}`, {
|
|
253
253
|
method: "POST",
|
|
254
254
|
body: h(t),
|
|
@@ -259,4 +259,4 @@ async function ae(e, t = {}, { isSessionProbe: n = !1, keepalive: r = !1, creden
|
|
|
259
259
|
isSessionProbe: n
|
|
260
260
|
}, Q)).result;
|
|
261
261
|
}
|
|
262
|
-
export { C as RefreshDeadError,
|
|
262
|
+
export { C as RefreshDeadError, re as apiFetch, ae as apiFetchBlob, j as beginSessionInPage, oe as callHandler, D as cancelProactiveRefresh, Y as currentPublishedLanguage, k as endSessionInPage, B as ensureRefresh, U as getPersistentAuthFailureHandler, A as isSignedOutInPage, z as isTransientFailure, $ as parseContentDispositionFilename, ne as publishLanguage, te as publishLanguageFor, E as scheduleProactiveRefresh, J as setLanguageReader, H as setPersistentAuthFailureHandler, X as withPublishedLanguage };
|
|
@@ -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,24 +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:
|
|
233
|
+
turns: g.turns
|
|
234
234
|
}, e.message.id) : /* @__PURE__ */ w(de, { run: e }, e.id)),
|
|
235
|
-
|
|
236
|
-
X.map((e) => /* @__PURE__ */ w(
|
|
235
|
+
_e.map((e) => /* @__PURE__ */ w(ce, { agentTurn: e }, e.id)),
|
|
236
|
+
X.map((e) => /* @__PURE__ */ w(ve, {
|
|
237
237
|
tool: e,
|
|
238
|
-
onApprove: async (t) =>
|
|
239
|
-
onReject: async (t) =>
|
|
238
|
+
onApprove: async (t) => g.approve(e.id, t),
|
|
239
|
+
onReject: async (t) => g.reject(e.id, t)
|
|
240
240
|
}, e.id)),
|
|
241
241
|
Z.map((e) => /* @__PURE__ */ w(s, {
|
|
242
242
|
...le(b, e),
|
|
243
|
-
onSubmit: (t) => void
|
|
244
|
-
onCancel: () => void
|
|
243
|
+
onSubmit: (t) => void g.submitInput(e.id, t),
|
|
244
|
+
onCancel: () => void g.cancelInput(e.id)
|
|
245
245
|
}, e.id)),
|
|
246
|
-
|
|
246
|
+
Q.map((e) => /* @__PURE__ */ w(ue, { invocation: e }, e.id)),
|
|
247
247
|
xe && !Se && /* @__PURE__ */ T("div", {
|
|
248
248
|
style: {
|
|
249
249
|
display: "flex",
|
|
@@ -297,7 +297,7 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
297
297
|
background: "var(--surface-2)"
|
|
298
298
|
},
|
|
299
299
|
children: [
|
|
300
|
-
/* @__PURE__ */ w(
|
|
300
|
+
/* @__PURE__ */ w(y, {
|
|
301
301
|
selections: F.selections,
|
|
302
302
|
onCancel: F.cancel,
|
|
303
303
|
onRemove: F.remove
|
|
@@ -359,7 +359,7 @@ function oe({ open: n, onClose: i, context: d, title: p = "", askOnOpen: m, dock
|
|
|
359
359
|
title: b("agent.panel.attach_files", "Attach files")
|
|
360
360
|
}),
|
|
361
361
|
xe ? /* @__PURE__ */ w("button", {
|
|
362
|
-
onClick: () => void
|
|
362
|
+
onClick: () => void g.cancel(),
|
|
363
363
|
"aria-label": b("agent.panel.stop", "Stop generating"),
|
|
364
364
|
title: b("agent.panel.stop", "Stop generating"),
|
|
365
365
|
style: {
|
|
@@ -462,7 +462,7 @@ function D({ children: t, dataMessageId: n, dataStreaming: r }) {
|
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
464
|
function ce({ agentTurn: e }) {
|
|
465
|
-
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;
|
|
466
466
|
return /* @__PURE__ */ T("div", {
|
|
467
467
|
"data-agent-turn": e.id,
|
|
468
468
|
"data-turn-status": e.status,
|
|
@@ -498,7 +498,7 @@ function le(e, t) {
|
|
|
498
498
|
};
|
|
499
499
|
}
|
|
500
500
|
function ue({ invocation: e }) {
|
|
501
|
-
let t =
|
|
501
|
+
let t = d();
|
|
502
502
|
return /* @__PURE__ */ w("div", {
|
|
503
503
|
"data-agent-invocation": e.id,
|
|
504
504
|
"data-invocation-status": "outcome_unknown",
|
|
@@ -510,7 +510,7 @@ function ue({ invocation: e }) {
|
|
|
510
510
|
fontSize: 11.5,
|
|
511
511
|
color: "var(--text-2)"
|
|
512
512
|
},
|
|
513
|
-
children:
|
|
513
|
+
children: _(t("agent.panel.outcome_uncertain", "The outcome of {tool} is unknown. It was not retried automatically."), { tool: /* @__PURE__ */ w("span", {
|
|
514
514
|
className: "mono",
|
|
515
515
|
children: e.tool_code
|
|
516
516
|
}) })
|
|
@@ -571,20 +571,20 @@ function de({ run: e }) {
|
|
|
571
571
|
});
|
|
572
572
|
}
|
|
573
573
|
function A() {
|
|
574
|
-
let e =
|
|
574
|
+
let e = d();
|
|
575
575
|
return (t, n, r) => {
|
|
576
576
|
let i = [];
|
|
577
|
-
return t > 0 && i.push(
|
|
577
|
+
return t > 0 && i.push(g(e, "agent.panel.operations", t, {
|
|
578
578
|
one: "{count} operation",
|
|
579
579
|
other: "{count} operations"
|
|
580
|
-
})), 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, {
|
|
581
581
|
one: "{count} failed",
|
|
582
582
|
other: "{count} failed"
|
|
583
583
|
})), i.join(" · ") || e("agent.panel.worked", "worked");
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
function j({ call: e }) {
|
|
587
|
-
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";
|
|
588
588
|
return /* @__PURE__ */ T("div", {
|
|
589
589
|
"data-activity-call": e.name,
|
|
590
590
|
"data-call-state": c,
|
|
@@ -641,7 +641,7 @@ function M(e) {
|
|
|
641
641
|
return e === "succeeded" || e === "failed" || e === "rejected" || e === "canceled" || e === "outcome_unknown";
|
|
642
642
|
}
|
|
643
643
|
function fe({ conversations: e, hasMore: t, onShowMore: n, currentId: r, onPick: i }) {
|
|
644
|
-
let a =
|
|
644
|
+
let a = d();
|
|
645
645
|
return e.length === 0 ? /* @__PURE__ */ w("div", {
|
|
646
646
|
style: {
|
|
647
647
|
padding: "8px 12px",
|
|
@@ -706,10 +706,10 @@ function pe(e, t) {
|
|
|
706
706
|
}
|
|
707
707
|
function me(e, t) {
|
|
708
708
|
let n = [], r = pe(e, t);
|
|
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(
|
|
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;
|
|
710
710
|
}
|
|
711
711
|
function N(e) {
|
|
712
|
-
let t =
|
|
712
|
+
let t = d(), { value: n } = u("agents.transcript_names", "code"), { data: r } = l();
|
|
713
713
|
return n === "display" && t(r?.actions?.[e]?.display?.name ?? P(r, e)) || e;
|
|
714
714
|
}
|
|
715
715
|
function P(e, t) {
|
|
@@ -719,7 +719,7 @@ function P(e, t) {
|
|
|
719
719
|
function he({ message: e, delivered: t, showsPlace: n, turns: r }) {
|
|
720
720
|
let i = ne(e, r) ? e.attachments : void 0;
|
|
721
721
|
if (e.role === "user") {
|
|
722
|
-
let t =
|
|
722
|
+
let t = q(e.content);
|
|
723
723
|
return e.content.some((e) => e.type !== "text" && e.type !== "location") ? /* @__PURE__ */ w(B, {
|
|
724
724
|
message: e,
|
|
725
725
|
files: i
|
|
@@ -752,7 +752,10 @@ function he({ message: e, delivered: t, showsPlace: n, turns: r }) {
|
|
|
752
752
|
showsPlace: n
|
|
753
753
|
}) : /* @__PURE__ */ T(D, {
|
|
754
754
|
dataMessageId: e.id,
|
|
755
|
-
children: [e.content.map((
|
|
755
|
+
children: [e.content.map((t, n) => /* @__PURE__ */ w(G, {
|
|
756
|
+
block: t,
|
|
757
|
+
sentByMessenger: !!e.bot_id
|
|
758
|
+
}, n)), /* @__PURE__ */ w(R, {
|
|
756
759
|
message: e,
|
|
757
760
|
showsPlace: n
|
|
758
761
|
})]
|
|
@@ -760,7 +763,10 @@ function he({ message: e, delivered: t, showsPlace: n, turns: r }) {
|
|
|
760
763
|
dataMessageId: e.id,
|
|
761
764
|
dataStreaming: e.streaming,
|
|
762
765
|
children: [
|
|
763
|
-
e.content.map((
|
|
766
|
+
e.content.map((t, n) => /* @__PURE__ */ w(G, {
|
|
767
|
+
block: t,
|
|
768
|
+
sentByMessenger: !!e.bot_id
|
|
769
|
+
}, n)),
|
|
764
770
|
e.streaming && /* @__PURE__ */ w(se, {}),
|
|
765
771
|
/* @__PURE__ */ w(b, {
|
|
766
772
|
files: i,
|
|
@@ -797,7 +803,7 @@ function I(e) {
|
|
|
797
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));
|
|
798
804
|
}
|
|
799
805
|
function L({ message: e, showsPlace: t }) {
|
|
800
|
-
let n =
|
|
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") : "";
|
|
801
807
|
return /* @__PURE__ */ T("div", {
|
|
802
808
|
"data-message-id": e.id,
|
|
803
809
|
"data-person-on-messenger": r ? "heard" : i ? "pressed" : "reacted",
|
|
@@ -831,7 +837,7 @@ function L({ message: e, showsPlace: t }) {
|
|
|
831
837
|
});
|
|
832
838
|
}
|
|
833
839
|
function R({ message: e, showsPlace: t }) {
|
|
834
|
-
let n =
|
|
840
|
+
let n = d(), r = p("agent_message")?.fields.get("delivery_status");
|
|
835
841
|
if (!e.bot_id) return null;
|
|
836
842
|
let i = [];
|
|
837
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", {
|
|
@@ -862,14 +868,17 @@ function B({ message: e, files: t }) {
|
|
|
862
868
|
alignItems: "flex-end",
|
|
863
869
|
overflowWrap: "anywhere"
|
|
864
870
|
},
|
|
865
|
-
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, {
|
|
866
875
|
files: t,
|
|
867
876
|
align: "end"
|
|
868
877
|
})]
|
|
869
878
|
});
|
|
870
879
|
}
|
|
871
880
|
function V({ href: e, children: t, ...n }) {
|
|
872
|
-
let r =
|
|
881
|
+
let r = f(), i = {
|
|
873
882
|
color: "var(--accent-text)",
|
|
874
883
|
textDecoration: "underline"
|
|
875
884
|
}, a = H(e);
|
|
@@ -959,40 +968,80 @@ var U = {
|
|
|
959
968
|
});
|
|
960
969
|
}
|
|
961
970
|
};
|
|
962
|
-
function W({
|
|
963
|
-
|
|
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();
|
|
964
1006
|
switch (e.type) {
|
|
965
|
-
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", {
|
|
966
1015
|
className: "agent-md",
|
|
967
|
-
children: /* @__PURE__ */ w(i, {
|
|
1016
|
+
children: [/* @__PURE__ */ w(i, {
|
|
968
1017
|
content: e.text,
|
|
969
1018
|
plugins: "gfm",
|
|
970
1019
|
prose: !1,
|
|
971
1020
|
skipHtml: !1,
|
|
972
1021
|
components: U
|
|
973
|
-
})
|
|
1022
|
+
}), e.buttons?.length ? /* @__PURE__ */ w(W, { rows: e.buttons }) : null]
|
|
974
1023
|
});
|
|
975
1024
|
case "tool_use": {
|
|
976
|
-
let
|
|
977
|
-
return /* @__PURE__ */ w(
|
|
1025
|
+
let t = J(n, e.name, e.input);
|
|
1026
|
+
return /* @__PURE__ */ w(K, {
|
|
978
1027
|
kind: "call",
|
|
979
|
-
label:
|
|
980
|
-
sub:
|
|
1028
|
+
label: t.label,
|
|
1029
|
+
sub: t.sub,
|
|
981
1030
|
body: e.input
|
|
982
1031
|
});
|
|
983
1032
|
}
|
|
984
|
-
case "tool_result": return /* @__PURE__ */ w(
|
|
1033
|
+
case "tool_result": return /* @__PURE__ */ w(K, {
|
|
985
1034
|
kind: "result",
|
|
986
|
-
label:
|
|
1035
|
+
label: Y(n, e),
|
|
987
1036
|
body: e.output,
|
|
988
1037
|
isError: !!e.is_error
|
|
989
1038
|
});
|
|
990
|
-
case "elicit_response": return /* @__PURE__ */ w(
|
|
1039
|
+
case "elicit_response": return /* @__PURE__ */ w(K, {
|
|
991
1040
|
kind: "result",
|
|
992
|
-
label:
|
|
1041
|
+
label: n("agent.panel.chip.answer", "answer"),
|
|
993
1042
|
body: e.data
|
|
994
1043
|
});
|
|
995
|
-
case "decision": return /* @__PURE__ */ w(
|
|
1044
|
+
case "decision": return /* @__PURE__ */ w(Z, { block: e });
|
|
996
1045
|
case "location":
|
|
997
1046
|
case "thinking":
|
|
998
1047
|
case "redacted_thinking": return null;
|
|
@@ -1028,7 +1077,7 @@ function W({ block: e }) {
|
|
|
1028
1077
|
default: return null;
|
|
1029
1078
|
}
|
|
1030
1079
|
}
|
|
1031
|
-
function
|
|
1080
|
+
function K({ kind: e, label: t, sub: n, body: r, isError: i }) {
|
|
1032
1081
|
return /* @__PURE__ */ T("details", {
|
|
1033
1082
|
style: {
|
|
1034
1083
|
marginTop: 6,
|
|
@@ -1113,10 +1162,10 @@ function G({ kind: e, label: t, sub: n, body: r, isError: i }) {
|
|
|
1113
1162
|
})]
|
|
1114
1163
|
});
|
|
1115
1164
|
}
|
|
1116
|
-
function
|
|
1165
|
+
function q(e) {
|
|
1117
1166
|
return e.map((e) => e.type === "text" ? e.text : "").join("");
|
|
1118
1167
|
}
|
|
1119
|
-
function
|
|
1168
|
+
function J(e, t, n) {
|
|
1120
1169
|
if (t === "action.invoke") {
|
|
1121
1170
|
let r = typeof n?.code == "string" ? n.code : "";
|
|
1122
1171
|
if (r) return {
|
|
@@ -1126,14 +1175,14 @@ function q(e, t, n) {
|
|
|
1126
1175
|
}
|
|
1127
1176
|
return { label: t };
|
|
1128
1177
|
}
|
|
1129
|
-
function
|
|
1178
|
+
function Y(e, t) {
|
|
1130
1179
|
return t.name ? t.name : t.is_error ? e("agent.panel.chip.error", "error") : e("agent.panel.chip.result", "result");
|
|
1131
1180
|
}
|
|
1132
|
-
function
|
|
1181
|
+
function X(e, t) {
|
|
1133
1182
|
return t === "approved" ? e("agent.panel.decision.approve", "Approved") : e("agent.panel.decision.reject", "Rejected");
|
|
1134
1183
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let t =
|
|
1184
|
+
function Z({ block: e }) {
|
|
1185
|
+
let t = d(), n = e.decision === "approved", r = n ? "var(--success)" : "var(--destructive)";
|
|
1137
1186
|
return /* @__PURE__ */ T("div", {
|
|
1138
1187
|
style: {
|
|
1139
1188
|
marginTop: 6,
|
|
@@ -1160,7 +1209,7 @@ function X({ block: e }) {
|
|
|
1160
1209
|
}),
|
|
1161
1210
|
/* @__PURE__ */ w("span", {
|
|
1162
1211
|
style: { fontWeight: 600 },
|
|
1163
|
-
children:
|
|
1212
|
+
children: X(t, e.decision)
|
|
1164
1213
|
}),
|
|
1165
1214
|
/* @__PURE__ */ w("span", {
|
|
1166
1215
|
className: "mono",
|
|
@@ -1183,7 +1232,7 @@ function X({ block: e }) {
|
|
|
1183
1232
|
async function ge(e, t) {
|
|
1184
1233
|
let n = [];
|
|
1185
1234
|
for (let r of t) {
|
|
1186
|
-
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");
|
|
1187
1236
|
i && n.push(`${t}\n${i}`);
|
|
1188
1237
|
}
|
|
1189
1238
|
let r = n.join("\n\n");
|
|
@@ -1193,16 +1242,16 @@ async function ge(e, t) {
|
|
|
1193
1242
|
console.error("agent: copyTranscript failed", e);
|
|
1194
1243
|
}
|
|
1195
1244
|
}
|
|
1196
|
-
function
|
|
1245
|
+
function _e(e, t) {
|
|
1197
1246
|
switch (t.type) {
|
|
1198
1247
|
case "text": return t.text;
|
|
1199
1248
|
case "tool_use": {
|
|
1200
|
-
let n =
|
|
1249
|
+
let n = J(e, t.name, t.input);
|
|
1201
1250
|
return `${n.sub ? `→ ${n.label} (${n.sub})` : `→ ${n.label}`}\n${JSON.stringify(t.input, null, 2)}`;
|
|
1202
1251
|
}
|
|
1203
|
-
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)}`;
|
|
1204
1253
|
case "elicit_response": return `${e("agent.panel.chip.answer", "answer")}\n${JSON.stringify(t.data, null, 2)}`;
|
|
1205
|
-
case "decision": return `${
|
|
1254
|
+
case "decision": return `${X(e, t.decision)} ${t.tool_code}${t.note ? ` — ${t.note}` : ""}`;
|
|
1206
1255
|
case "system": return `— ${t.reason}`;
|
|
1207
1256
|
case "summary": return t.text;
|
|
1208
1257
|
case "attachment": return t.content;
|
|
@@ -1212,23 +1261,23 @@ function Z(e, t) {
|
|
|
1212
1261
|
function Q(e, t) {
|
|
1213
1262
|
return e("agent.panel.proposal", "Run {code}.", { code: t });
|
|
1214
1263
|
}
|
|
1215
|
-
function
|
|
1216
|
-
let a =
|
|
1217
|
-
if (!
|
|
1218
|
-
|
|
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);
|
|
1219
1268
|
try {
|
|
1220
1269
|
await r(e);
|
|
1221
1270
|
} catch (e) {
|
|
1222
|
-
|
|
1271
|
+
h(m(o, e)), _(!1);
|
|
1223
1272
|
}
|
|
1224
1273
|
}
|
|
1225
|
-
},
|
|
1226
|
-
if (!
|
|
1227
|
-
|
|
1274
|
+
}, y = async () => {
|
|
1275
|
+
if (!g) {
|
|
1276
|
+
_(!0);
|
|
1228
1277
|
try {
|
|
1229
|
-
await i(
|
|
1278
|
+
await i(f.trim() || void 0);
|
|
1230
1279
|
} catch (e) {
|
|
1231
|
-
|
|
1280
|
+
h(m(o, e)), _(!1);
|
|
1232
1281
|
}
|
|
1233
1282
|
}
|
|
1234
1283
|
}, b = typeof t.confidence == "number" ? Math.round(Math.max(0, Math.min(1, t.confidence)) * 100) : null;
|
|
@@ -1303,7 +1352,7 @@ function _e({ tool: t, onApprove: r, onReject: i }) {
|
|
|
1303
1352
|
}),
|
|
1304
1353
|
/* @__PURE__ */ T("button", {
|
|
1305
1354
|
type: "button",
|
|
1306
|
-
onClick: () =>
|
|
1355
|
+
onClick: () => ee((e) => !e),
|
|
1307
1356
|
style: {
|
|
1308
1357
|
background: "transparent",
|
|
1309
1358
|
border: 0,
|
|
@@ -1344,18 +1393,18 @@ function _e({ tool: t, onApprove: r, onReject: i }) {
|
|
|
1344
1393
|
},
|
|
1345
1394
|
children: s
|
|
1346
1395
|
}),
|
|
1347
|
-
|
|
1396
|
+
p && /* @__PURE__ */ w("div", {
|
|
1348
1397
|
style: {
|
|
1349
1398
|
marginTop: 4,
|
|
1350
1399
|
fontSize: 10.5,
|
|
1351
1400
|
color: "var(--text-2)"
|
|
1352
1401
|
},
|
|
1353
|
-
children:
|
|
1402
|
+
children: p
|
|
1354
1403
|
}),
|
|
1355
|
-
|
|
1404
|
+
l && /* @__PURE__ */ w("input", {
|
|
1356
1405
|
type: "text",
|
|
1357
|
-
value:
|
|
1358
|
-
onChange: (e) =>
|
|
1406
|
+
value: f,
|
|
1407
|
+
onChange: (e) => te(e.target.value),
|
|
1359
1408
|
placeholder: a("agent.panel.reject_note", "Why not? (optional) — then Send rejection"),
|
|
1360
1409
|
autoFocus: !0,
|
|
1361
1410
|
style: {
|
|
@@ -1377,32 +1426,32 @@ function _e({ tool: t, onApprove: r, onReject: i }) {
|
|
|
1377
1426
|
justifyContent: "flex-end"
|
|
1378
1427
|
},
|
|
1379
1428
|
children: [
|
|
1380
|
-
|
|
1429
|
+
l ? /* @__PURE__ */ w(n, {
|
|
1381
1430
|
size: "xs",
|
|
1382
1431
|
kind: "ghost",
|
|
1383
|
-
onClick:
|
|
1384
|
-
disabled:
|
|
1432
|
+
onClick: y,
|
|
1433
|
+
disabled: g,
|
|
1385
1434
|
children: a("agent.panel.reject_send", "Send rejection")
|
|
1386
1435
|
}) : /* @__PURE__ */ w(n, {
|
|
1387
1436
|
size: "xs",
|
|
1388
1437
|
kind: "ghost",
|
|
1389
|
-
onClick: () =>
|
|
1390
|
-
disabled:
|
|
1438
|
+
onClick: () => u(!0),
|
|
1439
|
+
disabled: g,
|
|
1391
1440
|
children: a("agent.panel.reject", "Reject…")
|
|
1392
1441
|
}),
|
|
1393
1442
|
t.confirmation_mode !== "always" && /* @__PURE__ */ w(n, {
|
|
1394
1443
|
size: "xs",
|
|
1395
1444
|
kind: "ghost",
|
|
1396
|
-
onClick: () =>
|
|
1397
|
-
disabled:
|
|
1445
|
+
onClick: () => v("conversation"),
|
|
1446
|
+
disabled: g,
|
|
1398
1447
|
children: a("agent.panel.approve_chat", "Approve for this chat")
|
|
1399
1448
|
}),
|
|
1400
1449
|
/* @__PURE__ */ w(n, {
|
|
1401
1450
|
size: "xs",
|
|
1402
1451
|
kind: "primary",
|
|
1403
1452
|
icon: /* @__PURE__ */ w(e.check, { size: 11 }),
|
|
1404
|
-
onClick: () =>
|
|
1405
|
-
disabled:
|
|
1453
|
+
onClick: () => v("call"),
|
|
1454
|
+
disabled: g,
|
|
1406
1455
|
children: a("agent.panel.approve_once", "Approve once")
|
|
1407
1456
|
})
|
|
1408
1457
|
]
|
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 };
|