@centive/aria-sdk 0.7.8 → 0.7.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaStandaloneUI.d.ts","sourceRoot":"","sources":["../../src/components/AriaStandaloneUI.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1E,OAAO,KAAK,EAOV,KAAK,EACN,MAAM,SAAS,CAAC;AAOjB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"AriaStandaloneUI.d.ts","sourceRoot":"","sources":["../../src/components/AriaStandaloneUI.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAA4C,KAAK,EAAE,EAAE,MAAM,OAAO,CAAC;AAgB1E,OAAO,KAAK,EAOV,KAAK,EACN,MAAM,SAAS,CAAC;AAOjB,UAAU,qBAAqB;IAC7B,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,WAAW,CAAC;CACxB;AAED,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CA8etD,CAAC;AAk5BF,eAAe,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAW1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AriaProvider.d.ts","sourceRoot":"","sources":["../../src/context/AriaProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4C,KAAK,EAAE,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAW1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C,UAAU,iBAAiB;IACzB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAMD,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAmkB9C,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1339,8 +1339,8 @@ const Jr = (r, e) => {
|
|
|
1339
1339
|
*/
|
|
1340
1340
|
E.startsWith(er) && (R = E.slice(1), P = !0)
|
|
1341
1341
|
);
|
|
1342
|
-
const
|
|
1343
|
-
return dr(c, P, R,
|
|
1342
|
+
const S = d && d > l ? d - l : void 0;
|
|
1343
|
+
return dr(c, P, R, S);
|
|
1344
1344
|
};
|
|
1345
1345
|
if (e) {
|
|
1346
1346
|
const n = e + cr, c = a;
|
|
@@ -1385,20 +1385,20 @@ const Jr = (r, e) => {
|
|
|
1385
1385
|
isExternal: E,
|
|
1386
1386
|
modifiers: R,
|
|
1387
1387
|
hasImportantModifier: P,
|
|
1388
|
-
baseClassName:
|
|
1388
|
+
baseClassName: S,
|
|
1389
1389
|
maybePostfixModifierPosition: j
|
|
1390
1390
|
} = t(m);
|
|
1391
1391
|
if (E) {
|
|
1392
1392
|
l = m + (l.length > 0 ? " " + l : l);
|
|
1393
1393
|
continue;
|
|
1394
1394
|
}
|
|
1395
|
-
let H = !!j, W = a(H ?
|
|
1395
|
+
let H = !!j, W = a(H ? S.substring(0, j) : S);
|
|
1396
1396
|
if (!W) {
|
|
1397
1397
|
if (!H) {
|
|
1398
1398
|
l = m + (l.length > 0 ? " " + l : l);
|
|
1399
1399
|
continue;
|
|
1400
1400
|
}
|
|
1401
|
-
if (W = a(
|
|
1401
|
+
if (W = a(S), !W) {
|
|
1402
1402
|
l = m + (l.length > 0 ? " " + l : l);
|
|
1403
1403
|
continue;
|
|
1404
1404
|
}
|
|
@@ -1456,7 +1456,7 @@ const Jr = (r, e) => {
|
|
|
1456
1456
|
const a = Nr.exec(r);
|
|
1457
1457
|
return a ? a[1] ? e(a[1]) : t : !1;
|
|
1458
1458
|
}, Mr = (r) => r === "position" || r === "percentage", Cr = (r) => r === "image" || r === "url", Tr = (r) => r === "length" || r === "size" || r === "bg-size", Rr = (r) => r === "length", Pt = (r) => r === "number", Dt = (r) => r === "family-name", zr = (r) => r === "shadow", jt = () => {
|
|
1459
|
-
const r = Q("color"), e = Q("font"), t = Q("text"), a = Q("font-weight"), n = Q("tracking"), c = Q("leading"), s = Q("breakpoint"), u = Q("container"), l = Q("spacing"), d = Q("radius"), m = Q("shadow"), E = Q("inset-shadow"), R = Q("text-shadow"), P = Q("drop-shadow"),
|
|
1459
|
+
const r = Q("color"), e = Q("font"), t = Q("text"), a = Q("font-weight"), n = Q("tracking"), c = Q("leading"), s = Q("breakpoint"), u = Q("container"), l = Q("spacing"), d = Q("radius"), m = Q("shadow"), E = Q("inset-shadow"), R = Q("text-shadow"), P = Q("drop-shadow"), S = Q("blur"), j = Q("perspective"), H = Q("aspect"), W = Q("ease"), U = Q("animate"), V = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], h = () => [
|
|
1460
1460
|
"center",
|
|
1461
1461
|
"top",
|
|
1462
1462
|
"bottom",
|
|
@@ -1476,7 +1476,7 @@ const Jr = (r, e) => {
|
|
|
1476
1476
|
"left-bottom"
|
|
1477
1477
|
], L = () => [...h(), y, v], q = () => ["auto", "hidden", "clip", "visible", "scroll"], O = () => ["auto", "contain", "none"], N = () => [y, v, l], K = () => [ke, "full", "auto", ...N()], p = () => [be, "none", "subgrid", y, v], B = () => ["auto", {
|
|
1478
1478
|
span: ["full", be, y, v]
|
|
1479
|
-
}, be, y, v], ae = () => [be, "auto", y, v], ie = () => ["auto", "min", "max", "fr", y, v], $ = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], A = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"],
|
|
1479
|
+
}, be, y, v], ae = () => [be, "auto", y, v], ie = () => ["auto", "min", "max", "fr", y, v], $ = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], A = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], k = () => ["auto", ...N()], f = () => [ke, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...N()], x = () => [r, y, v], ge = () => [...h(), ur, gr, {
|
|
1480
1480
|
position: [y, v]
|
|
1481
1481
|
}], ue = () => ["no-repeat", {
|
|
1482
1482
|
repeat: ["", "x", "y", "space", "round"]
|
|
@@ -1494,7 +1494,7 @@ const Jr = (r, e) => {
|
|
|
1494
1494
|
// Deprecated since Tailwind CSS v4.0.0
|
|
1495
1495
|
"",
|
|
1496
1496
|
"none",
|
|
1497
|
-
|
|
1497
|
+
S,
|
|
1498
1498
|
y,
|
|
1499
1499
|
v
|
|
1500
1500
|
], he = () => ["none", T, y, v], pe = () => ["none", T, y, v], we = () => [T, y, v], fe = () => [ke, "full", ...N()];
|
|
@@ -2031,63 +2031,63 @@ const Jr = (r, e) => {
|
|
|
2031
2031
|
* @see https://tailwindcss.com/docs/margin
|
|
2032
2032
|
*/
|
|
2033
2033
|
m: [{
|
|
2034
|
-
m:
|
|
2034
|
+
m: k()
|
|
2035
2035
|
}],
|
|
2036
2036
|
/**
|
|
2037
2037
|
* Margin X
|
|
2038
2038
|
* @see https://tailwindcss.com/docs/margin
|
|
2039
2039
|
*/
|
|
2040
2040
|
mx: [{
|
|
2041
|
-
mx:
|
|
2041
|
+
mx: k()
|
|
2042
2042
|
}],
|
|
2043
2043
|
/**
|
|
2044
2044
|
* Margin Y
|
|
2045
2045
|
* @see https://tailwindcss.com/docs/margin
|
|
2046
2046
|
*/
|
|
2047
2047
|
my: [{
|
|
2048
|
-
my:
|
|
2048
|
+
my: k()
|
|
2049
2049
|
}],
|
|
2050
2050
|
/**
|
|
2051
2051
|
* Margin Start
|
|
2052
2052
|
* @see https://tailwindcss.com/docs/margin
|
|
2053
2053
|
*/
|
|
2054
2054
|
ms: [{
|
|
2055
|
-
ms:
|
|
2055
|
+
ms: k()
|
|
2056
2056
|
}],
|
|
2057
2057
|
/**
|
|
2058
2058
|
* Margin End
|
|
2059
2059
|
* @see https://tailwindcss.com/docs/margin
|
|
2060
2060
|
*/
|
|
2061
2061
|
me: [{
|
|
2062
|
-
me:
|
|
2062
|
+
me: k()
|
|
2063
2063
|
}],
|
|
2064
2064
|
/**
|
|
2065
2065
|
* Margin Top
|
|
2066
2066
|
* @see https://tailwindcss.com/docs/margin
|
|
2067
2067
|
*/
|
|
2068
2068
|
mt: [{
|
|
2069
|
-
mt:
|
|
2069
|
+
mt: k()
|
|
2070
2070
|
}],
|
|
2071
2071
|
/**
|
|
2072
2072
|
* Margin Right
|
|
2073
2073
|
* @see https://tailwindcss.com/docs/margin
|
|
2074
2074
|
*/
|
|
2075
2075
|
mr: [{
|
|
2076
|
-
mr:
|
|
2076
|
+
mr: k()
|
|
2077
2077
|
}],
|
|
2078
2078
|
/**
|
|
2079
2079
|
* Margin Bottom
|
|
2080
2080
|
* @see https://tailwindcss.com/docs/margin
|
|
2081
2081
|
*/
|
|
2082
2082
|
mb: [{
|
|
2083
|
-
mb:
|
|
2083
|
+
mb: k()
|
|
2084
2084
|
}],
|
|
2085
2085
|
/**
|
|
2086
2086
|
* Margin Left
|
|
2087
2087
|
* @see https://tailwindcss.com/docs/margin
|
|
2088
2088
|
*/
|
|
2089
2089
|
ml: [{
|
|
2090
|
-
ml:
|
|
2090
|
+
ml: k()
|
|
2091
2091
|
}],
|
|
2092
2092
|
/**
|
|
2093
2093
|
* Space Between X
|
|
@@ -4224,18 +4224,18 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4224
4224
|
}, [r]);
|
|
4225
4225
|
const E = async () => {
|
|
4226
4226
|
if (!n.trim() || !t || s) return;
|
|
4227
|
-
const
|
|
4227
|
+
const S = n.trim();
|
|
4228
4228
|
c(""), u(!0);
|
|
4229
4229
|
try {
|
|
4230
|
-
await e(
|
|
4230
|
+
await e(S);
|
|
4231
4231
|
} catch (j) {
|
|
4232
|
-
console.error("Failed to send message:", j), c(
|
|
4232
|
+
console.error("Failed to send message:", j), c(S);
|
|
4233
4233
|
} finally {
|
|
4234
4234
|
u(!1);
|
|
4235
4235
|
}
|
|
4236
|
-
}, R = (
|
|
4237
|
-
|
|
4238
|
-
}, P = (
|
|
4236
|
+
}, R = (S) => {
|
|
4237
|
+
S.key === "Enter" && !S.shiftKey && (S.preventDefault(), E());
|
|
4238
|
+
}, P = (S) => new Date(S).toLocaleTimeString("en-US", {
|
|
4239
4239
|
hour: "2-digit",
|
|
4240
4240
|
minute: "2-digit"
|
|
4241
4241
|
});
|
|
@@ -4282,12 +4282,12 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4282
4282
|
"text-xs",
|
|
4283
4283
|
d ? "text-gray-400" : "text-gray-500"
|
|
4284
4284
|
), children: "Aria is here to chat with you" })
|
|
4285
|
-
] }) : r.filter((
|
|
4285
|
+
] }) : r.filter((S) => S.content && S.content.trim() !== "").map((S, j) => /* @__PURE__ */ g(
|
|
4286
4286
|
"div",
|
|
4287
4287
|
{
|
|
4288
4288
|
className: i(
|
|
4289
4289
|
"flex gap-2 aria-animate-fade-in",
|
|
4290
|
-
|
|
4290
|
+
S.role === "user" ? "flex-row-reverse" : "flex-row"
|
|
4291
4291
|
),
|
|
4292
4292
|
style: { animationDelay: `${j * 50}ms` },
|
|
4293
4293
|
children: [
|
|
@@ -4296,9 +4296,9 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4296
4296
|
{
|
|
4297
4297
|
className: i(
|
|
4298
4298
|
"shrink-0 w-6 h-6 rounded-full flex items-center justify-center",
|
|
4299
|
-
|
|
4299
|
+
S.role === "user" ? "bg-indigo-500 text-white" : d ? "bg-gray-700 text-gray-300" : "bg-gray-200 text-gray-600"
|
|
4300
4300
|
),
|
|
4301
|
-
children:
|
|
4301
|
+
children: S.role === "user" ? /* @__PURE__ */ o(hr, { className: "h-3 w-3" }) : /* @__PURE__ */ o(mr, { className: "h-3 w-3" })
|
|
4302
4302
|
}
|
|
4303
4303
|
),
|
|
4304
4304
|
/* @__PURE__ */ g(
|
|
@@ -4306,7 +4306,7 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4306
4306
|
{
|
|
4307
4307
|
className: i(
|
|
4308
4308
|
"flex flex-col max-w-[80%]",
|
|
4309
|
-
|
|
4309
|
+
S.role === "user" ? "items-end" : "items-start"
|
|
4310
4310
|
),
|
|
4311
4311
|
children: [
|
|
4312
4312
|
/* @__PURE__ */ o(
|
|
@@ -4314,18 +4314,18 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4314
4314
|
{
|
|
4315
4315
|
className: i(
|
|
4316
4316
|
"px-3 py-2 rounded-2xl",
|
|
4317
|
-
|
|
4317
|
+
S.role === "user" ? "bg-indigo-500 text-white rounded-br-md" : d ? "bg-gray-800 text-gray-100 rounded-bl-md" : "bg-white shadow-sm text-gray-800 rounded-bl-md"
|
|
4318
4318
|
),
|
|
4319
4319
|
children: /* @__PURE__ */ o("p", { className: i(
|
|
4320
4320
|
"text-xs leading-relaxed break-words",
|
|
4321
|
-
|
|
4322
|
-
), children:
|
|
4321
|
+
S.role === "user" && "text-white"
|
|
4322
|
+
), children: S.content })
|
|
4323
4323
|
}
|
|
4324
4324
|
),
|
|
4325
4325
|
/* @__PURE__ */ o("span", { className: i(
|
|
4326
4326
|
"text-[9px] mt-1 px-1",
|
|
4327
4327
|
d ? "text-gray-500" : "text-gray-400"
|
|
4328
|
-
), children: P(
|
|
4328
|
+
), children: P(S.timestamp) })
|
|
4329
4329
|
]
|
|
4330
4330
|
}
|
|
4331
4331
|
)
|
|
@@ -4346,7 +4346,7 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4346
4346
|
Ir,
|
|
4347
4347
|
{
|
|
4348
4348
|
value: n,
|
|
4349
|
-
onChange: (
|
|
4349
|
+
onChange: (S) => c(S.target.value),
|
|
4350
4350
|
onKeyDown: R,
|
|
4351
4351
|
placeholder: t ? "Message Aria..." : "Connecting...",
|
|
4352
4352
|
disabled: !t || s,
|
|
@@ -4385,7 +4385,7 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4385
4385
|
theme: E,
|
|
4386
4386
|
setVideoElement: R,
|
|
4387
4387
|
isSessionPreloaded: P,
|
|
4388
|
-
refreshSession:
|
|
4388
|
+
refreshSession: S,
|
|
4389
4389
|
minimizeAssistant: j,
|
|
4390
4390
|
maximizeAssistant: H,
|
|
4391
4391
|
toolCallState: W
|
|
@@ -4544,7 +4544,7 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4544
4544
|
/* @__PURE__ */ g(
|
|
4545
4545
|
"button",
|
|
4546
4546
|
{
|
|
4547
|
-
onClick: () =>
|
|
4547
|
+
onClick: () => S(),
|
|
4548
4548
|
className: i(
|
|
4549
4549
|
"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium",
|
|
4550
4550
|
"transition-all duration-200",
|
|
@@ -4690,7 +4690,7 @@ const _t = ({ compact: r = !1 }) => {
|
|
|
4690
4690
|
/* @__PURE__ */ g(
|
|
4691
4691
|
"button",
|
|
4692
4692
|
{
|
|
4693
|
-
onClick: () =>
|
|
4693
|
+
onClick: () => S(),
|
|
4694
4694
|
className: i(
|
|
4695
4695
|
"inline-flex items-center gap-2 px-4 py-2 rounded-lg text-sm font-medium",
|
|
4696
4696
|
"transition-all duration-200",
|
|
@@ -4910,8 +4910,8 @@ const so = Dr, Gt = ({
|
|
|
4910
4910
|
children: /* @__PURE__ */ o("div", { className: i("aria-assistant-container", R && "aria-dark"), children: /* @__PURE__ */ g(
|
|
4911
4911
|
"button",
|
|
4912
4912
|
{
|
|
4913
|
-
onClick: (
|
|
4914
|
-
|
|
4913
|
+
onClick: (S) => {
|
|
4914
|
+
S.preventDefault(), c("user"), t?.();
|
|
4915
4915
|
},
|
|
4916
4916
|
className: i(
|
|
4917
4917
|
"group relative flex items-center gap-3 px-3.5 py-2.5 rounded-xl",
|
|
@@ -4943,9 +4943,9 @@ const so = Dr, Gt = ({
|
|
|
4943
4943
|
src: Me,
|
|
4944
4944
|
alt: E,
|
|
4945
4945
|
className: "w-full h-full object-cover",
|
|
4946
|
-
onError: (
|
|
4947
|
-
|
|
4948
|
-
const j =
|
|
4946
|
+
onError: (S) => {
|
|
4947
|
+
S.currentTarget.style.display = "none";
|
|
4948
|
+
const j = S.currentTarget.nextElementSibling;
|
|
4949
4949
|
j && (j.style.display = "flex");
|
|
4950
4950
|
}
|
|
4951
4951
|
}
|
|
@@ -5026,7 +5026,7 @@ const so = Dr, Gt = ({
|
|
|
5026
5026
|
] })
|
|
5027
5027
|
] });
|
|
5028
5028
|
}, lo = ({ config: r, children: e }) => {
|
|
5029
|
-
const [t, a] = z(!1), [n, c] = z(!1), [s, u] = z(!1), [l, d] = z(!1), [m, E] = z([]), [R, P] = z(""), [
|
|
5029
|
+
const [t, a] = z(!1), [n, c] = z(!1), [s, u] = z(!1), [l, d] = z(!1), [m, E] = z([]), [R, P] = z(""), [S, j] = z(!1), [H, W] = z(!1), [U, V] = z(null), [h, L] = z("user"), [q, O] = z("bottom-right"), [N, K] = z({
|
|
5030
5030
|
isActive: !1,
|
|
5031
5031
|
toolName: null,
|
|
5032
5032
|
toolData: null
|
|
@@ -5038,7 +5038,7 @@ const so = Dr, Gt = ({
|
|
|
5038
5038
|
lastError: null,
|
|
5039
5039
|
isPreloaded: !1,
|
|
5040
5040
|
isRefreshing: !1
|
|
5041
|
-
}), [ae, ie] = z("idle"), [$, A] = z(!1),
|
|
5041
|
+
}), [ae, ie] = z("idle"), [$, A] = z(!1), k = r.theme || "light", f = Y(null), x = Y(null), ge = Y(null), ue = Y(!0), le = C((b) => {
|
|
5042
5042
|
const { newStatus: M } = b.data;
|
|
5043
5043
|
ie(M), M === "preloading" || M === "connecting" ? t && d(!0) : M === "ready" ? (d(!1), u(!0)) : M === "error" && d(!1);
|
|
5044
5044
|
}, [t]), ne = C((b) => {
|
|
@@ -5151,10 +5151,10 @@ const so = Dr, Gt = ({
|
|
|
5151
5151
|
return;
|
|
5152
5152
|
}
|
|
5153
5153
|
const te = f.current.isAnamClientInitialized(), Ae = f.current.hasSessionToken(), or = f.current.getStatus();
|
|
5154
|
-
console.log("[AriaProvider] openAssistant - isAnamReady:", te, "hasToken:", Ae, "status:", or), te && or === "ready" ? (d(!1), u(!0), console.log("[AriaProvider] Opening with already initialized session")) : Ae ? (d(!0), console.log("[AriaProvider] Initializing Anam client on demand (lazy init)"), f.current.initializeSessionOnDemand().then(() => {
|
|
5154
|
+
console.log("[AriaProvider] openAssistant - isAnamReady:", te, "hasToken:", Ae, "status:", or), te && or === "ready" ? (d(!1), u(!0), console.log("[AriaProvider] Opening with already initialized session"), x.current && f.current && f.current.attachToVideoElement(x.current)) : Ae ? (d(!0), console.log("[AriaProvider] Initializing Anam client on demand (lazy init)"), f.current.initializeSessionOnDemand().then(() => {
|
|
5155
5155
|
console.log("[AriaProvider] Anam client initialized successfully"), d(!1), u(!0);
|
|
5156
5156
|
const oe = f.current.getSessionState();
|
|
5157
|
-
B(oe);
|
|
5157
|
+
B(oe), x.current && f.current && (console.log("[AriaProvider] Attaching video stream after initialization"), f.current.attachToVideoElement(x.current));
|
|
5158
5158
|
}).catch((oe) => {
|
|
5159
5159
|
console.error("[AriaProvider] Failed to initialize Anam client:", oe), d(!1), oe.message?.includes("expired") ? V("Session expired, getting a new session...") : V(oe instanceof Error ? oe.message : "Failed to initialize session");
|
|
5160
5160
|
})) : (d(!0), console.log("[AriaProvider] Opening, waiting for session token..."), f.current.isConnected() ? console.log("[AriaProvider] WebSocket connected, waiting for token response...") : (console.log("[AriaProvider] WebSocket not connected, connecting..."), f.current.connect()));
|
|
@@ -5191,7 +5191,7 @@ const so = Dr, Gt = ({
|
|
|
5191
5191
|
isLoading: l,
|
|
5192
5192
|
chatMessages: m,
|
|
5193
5193
|
liveTranscript: R,
|
|
5194
|
-
isChatVisible:
|
|
5194
|
+
isChatVisible: S,
|
|
5195
5195
|
isMuted: H,
|
|
5196
5196
|
error: U,
|
|
5197
5197
|
// Tool Call State
|
|
@@ -5217,7 +5217,7 @@ const so = Dr, Gt = ({
|
|
|
5217
5217
|
// Display State
|
|
5218
5218
|
displayMode: q,
|
|
5219
5219
|
triggerMode: h,
|
|
5220
|
-
theme:
|
|
5220
|
+
theme: k,
|
|
5221
5221
|
// Config
|
|
5222
5222
|
config: r,
|
|
5223
5223
|
// Utilities
|
|
@@ -5280,7 +5280,7 @@ const so = Dr, Gt = ({
|
|
|
5280
5280
|
E
|
|
5281
5281
|
]), P = C(async () => {
|
|
5282
5282
|
await s();
|
|
5283
|
-
}, [s]),
|
|
5283
|
+
}, [s]), S = C(async () => {
|
|
5284
5284
|
await u();
|
|
5285
5285
|
}, [u]), j = C(async () => {
|
|
5286
5286
|
await l();
|
|
@@ -5288,10 +5288,10 @@ const so = Dr, Gt = ({
|
|
|
5288
5288
|
d({ userTrigger: U });
|
|
5289
5289
|
}, [d]), W = Xe(() => ({
|
|
5290
5290
|
endSession: P,
|
|
5291
|
-
refreshSession:
|
|
5291
|
+
refreshSession: S,
|
|
5292
5292
|
startSession: j,
|
|
5293
5293
|
triggerSession: H
|
|
5294
|
-
}), [P,
|
|
5294
|
+
}), [P, S, j, H]);
|
|
5295
5295
|
return { session: R, actions: W };
|
|
5296
5296
|
}, go = ({ open: r, onOpenChange: e, children: t }) => /* @__PURE__ */ o(je, { children: r && /* @__PURE__ */ g("div", { className: "fixed inset-0 z-50 flex items-center justify-center aria-animate-fade-in", children: [
|
|
5297
5297
|
/* @__PURE__ */ o(
|
|
@@ -5428,7 +5428,7 @@ const $t = ({
|
|
|
5428
5428
|
triggerLabel: e,
|
|
5429
5429
|
container: t
|
|
5430
5430
|
}) => {
|
|
5431
|
-
const [a, n] = z(!1), [c, s] = z(!1), [u, l] = z(!1), [d, m] = z(!1), [E, R] = z([]), [P,
|
|
5431
|
+
const [a, n] = z(!1), [c, s] = z(!1), [u, l] = z(!1), [d, m] = z(!1), [E, R] = z([]), [P, S] = z(""), [j, H] = z(!1), [W, U] = z(!1), [V, h] = z(null), [, L] = z("user"), [q, O] = z("bottom-right"), [N, K] = z({
|
|
5432
5432
|
isActive: !1,
|
|
5433
5433
|
toolName: null,
|
|
5434
5434
|
toolData: null
|
|
@@ -5440,13 +5440,13 @@ const $t = ({
|
|
|
5440
5440
|
lastError: null,
|
|
5441
5441
|
isPreloaded: !1,
|
|
5442
5442
|
isRefreshing: !1
|
|
5443
|
-
}), [ae, ie] = z("idle"), [, $] = z(!1), A = Y(null),
|
|
5443
|
+
}), [ae, ie] = z("idle"), [, $] = z(!1), A = Y(null), k = Y(null), f = C((w) => {
|
|
5444
5444
|
const { newStatus: I } = w.data;
|
|
5445
5445
|
ie(I), I === "preloading" || I === "connecting" ? a && m(!0) : I === "ready" ? (m(!1), l(!0)) : I === "error" && m(!1);
|
|
5446
5446
|
}, [a]), x = C((w) => {
|
|
5447
5447
|
if (console.log("[AriaStandaloneUI] Session ready event:", w.data), A.current) {
|
|
5448
5448
|
const I = A.current.getSessionState();
|
|
5449
|
-
B(I),
|
|
5449
|
+
B(I), k.current && (console.log("[AriaStandaloneUI] Re-attaching video stream after session ready"), A.current.attachToVideoElement(k.current));
|
|
5450
5450
|
}
|
|
5451
5451
|
l(!0), m(!1), h(null);
|
|
5452
5452
|
}, []), ge = C((w) => {
|
|
@@ -5466,7 +5466,7 @@ const $t = ({
|
|
|
5466
5466
|
I && R(I);
|
|
5467
5467
|
}, []), ne = C((w) => {
|
|
5468
5468
|
const { liveTranscript: I } = w.data;
|
|
5469
|
-
I !== void 0 &&
|
|
5469
|
+
I !== void 0 && S(I);
|
|
5470
5470
|
}, []), _ = C((w) => {
|
|
5471
5471
|
const I = w.data;
|
|
5472
5472
|
K({
|
|
@@ -5475,8 +5475,8 @@ const $t = ({
|
|
|
5475
5475
|
toolData: I.toolData
|
|
5476
5476
|
});
|
|
5477
5477
|
}, []), G = C((w) => {
|
|
5478
|
-
const I =
|
|
5479
|
-
|
|
5478
|
+
const I = k.current;
|
|
5479
|
+
k.current = w, w && A.current ? (console.log("[AriaStandaloneUI] Attaching video stream to element"), A.current.attachToVideoElement(w)) : !w && I && A.current && (console.log("[AriaStandaloneUI] Detaching video stream from element"), A.current.detachFromVideoElement(I));
|
|
5480
5480
|
}, []), Z = C((w = "user") => {
|
|
5481
5481
|
if (L(w), O(w === "websocket" ? "center" : "bottom-right"), n(!0), s(!1), h(null), !A.current) return;
|
|
5482
5482
|
if (A.current.isSessionPaused()) {
|
|
@@ -5484,12 +5484,12 @@ const $t = ({
|
|
|
5484
5484
|
if ($(!1), re) {
|
|
5485
5485
|
m(!1), l(!0);
|
|
5486
5486
|
const We = A.current.getSessionState();
|
|
5487
|
-
B(We), R(A.current.getChatMessages());
|
|
5487
|
+
B(We), R(A.current.getChatMessages()), k.current && A.current && (console.log("[AriaStandaloneUI] Attaching video stream after resume"), A.current.attachToVideoElement(k.current));
|
|
5488
5488
|
} else
|
|
5489
5489
|
A.current.hasSessionToken() ? A.current.initializeSessionOnDemand().then(() => {
|
|
5490
5490
|
m(!1), l(!0);
|
|
5491
5491
|
const xe = A.current.getSessionState();
|
|
5492
|
-
B(xe);
|
|
5492
|
+
B(xe), k.current && A.current && (console.log("[AriaStandaloneUI] Attaching video stream after initialization (from resume)"), A.current.attachToVideoElement(k.current));
|
|
5493
5493
|
}).catch((xe) => {
|
|
5494
5494
|
m(!1), h(xe instanceof Error ? xe.message : "Failed to start new session");
|
|
5495
5495
|
}) : A.current.isConnected() || A.current.connect();
|
|
@@ -5499,10 +5499,10 @@ const $t = ({
|
|
|
5499
5499
|
return;
|
|
5500
5500
|
}
|
|
5501
5501
|
const ee = A.current.isAnamClientInitialized(), ye = A.current.hasSessionToken(), ze = A.current.getStatus();
|
|
5502
|
-
ee && ze === "ready" ? (m(!1), l(!0)) : ye ? (m(!0), A.current.initializeSessionOnDemand().then(() => {
|
|
5502
|
+
ee && ze === "ready" ? (m(!1), l(!0), k.current && A.current.attachToVideoElement(k.current)) : ye ? (m(!0), A.current.initializeSessionOnDemand().then(() => {
|
|
5503
5503
|
m(!1), l(!0);
|
|
5504
5504
|
const re = A.current.getSessionState();
|
|
5505
|
-
B(re);
|
|
5505
|
+
B(re), k.current && A.current && (console.log("[AriaStandaloneUI] Attaching video stream after initialization"), A.current.attachToVideoElement(k.current));
|
|
5506
5506
|
}).catch((re) => {
|
|
5507
5507
|
m(!1), h(re instanceof Error ? re.message : "Failed to initialize session");
|
|
5508
5508
|
})) : (m(!0), A.current.isConnected() || A.current.connect());
|
|
@@ -5511,7 +5511,7 @@ const $t = ({
|
|
|
5511
5511
|
}, []), F = C(() => {
|
|
5512
5512
|
s(!1);
|
|
5513
5513
|
}, []), ce = C(() => {
|
|
5514
|
-
n(!1), s(!1), A.current && (
|
|
5514
|
+
n(!1), s(!1), A.current && (k.current && A.current.detachFromVideoElement(k.current), S(""), console.log("[AriaStandaloneUI] Pausing session (widget closed)"), A.current.pauseSession(), $(!0));
|
|
5515
5515
|
}, []), he = C(() => {
|
|
5516
5516
|
console.log("[AriaStandaloneUI] WebSocket trigger event"), Z("websocket");
|
|
5517
5517
|
}, [Z]);
|
|
@@ -5522,7 +5522,7 @@ const $t = ({
|
|
|
5522
5522
|
}
|
|
5523
5523
|
const w = J.getInstance({});
|
|
5524
5524
|
return A.current = w, w.addEventListener("status_change", f), w.addEventListener("session_ready", x), w.addEventListener("session_error", ge), w.addEventListener("connection_change", ue), w.addEventListener("message_history", le), w.addEventListener("message_stream", ne), w.addEventListener("tool_call", _), w.setWebSocketTriggerCallback(he), queueMicrotask(() => {
|
|
5525
|
-
B(w.getSessionState()), ie(w.getStatus()), l(w.isConnected()), R(w.getChatMessages()),
|
|
5525
|
+
B(w.getSessionState()), ie(w.getStatus()), l(w.isConnected()), R(w.getChatMessages()), S(w.getLiveTranscript()), U(w.isMuted()), $(w.isSessionPaused());
|
|
5526
5526
|
const ee = w.getToolCallState();
|
|
5527
5527
|
K(ee);
|
|
5528
5528
|
}), () => {
|
|
@@ -5743,7 +5743,7 @@ const $t = ({
|
|
|
5743
5743
|
isMuted: E,
|
|
5744
5744
|
error: R,
|
|
5745
5745
|
toolCallState: P,
|
|
5746
|
-
setVideoElement:
|
|
5746
|
+
setVideoElement: S,
|
|
5747
5747
|
toggleChat: j,
|
|
5748
5748
|
sendMessage: H,
|
|
5749
5749
|
toggleMute: W,
|
|
@@ -5752,25 +5752,25 @@ const $t = ({
|
|
|
5752
5752
|
const V = Y(null), h = Y(null), [L, q] = z(""), [O, N] = z(!1), K = Y(null), p = n === "dark", B = c === "bottom-right", ae = c === "center";
|
|
5753
5753
|
X(() => {
|
|
5754
5754
|
h.current && (h.current.scrollTop = h.current.scrollHeight);
|
|
5755
|
-
}, [d]), X(() => (V.current && (console.log("[AriaWidgetStandalone] Registering video element, minimized:", e),
|
|
5756
|
-
|
|
5757
|
-
}), [
|
|
5755
|
+
}, [d]), X(() => (V.current && (console.log("[AriaWidgetStandalone] Registering video element, minimized:", e), S(V.current)), () => {
|
|
5756
|
+
S(null);
|
|
5757
|
+
}), [S, e]), X(() => {
|
|
5758
5758
|
K.current?.scrollIntoView({ behavior: "smooth" });
|
|
5759
5759
|
}, [l]);
|
|
5760
5760
|
const ie = async () => {
|
|
5761
5761
|
if (!L.trim() || !s || O) return;
|
|
5762
|
-
const
|
|
5762
|
+
const k = L.trim();
|
|
5763
5763
|
q(""), N(!0);
|
|
5764
5764
|
try {
|
|
5765
|
-
await H(
|
|
5765
|
+
await H(k);
|
|
5766
5766
|
} catch (f) {
|
|
5767
|
-
console.error("Failed to send message:", f), q(
|
|
5767
|
+
console.error("Failed to send message:", f), q(k);
|
|
5768
5768
|
} finally {
|
|
5769
5769
|
N(!1);
|
|
5770
5770
|
}
|
|
5771
|
-
}, $ = (
|
|
5772
|
-
|
|
5773
|
-
}, A = (
|
|
5771
|
+
}, $ = (k) => {
|
|
5772
|
+
k.key === "Enter" && !k.shiftKey && (k.preventDefault(), ie());
|
|
5773
|
+
}, A = (k) => new Date(k).toLocaleTimeString("en-US", {
|
|
5774
5774
|
hour: "2-digit",
|
|
5775
5775
|
minute: "2-digit"
|
|
5776
5776
|
});
|
|
@@ -5899,8 +5899,8 @@ const $t = ({
|
|
|
5899
5899
|
src: Me,
|
|
5900
5900
|
alt: "Aria",
|
|
5901
5901
|
className: "w-full h-full object-cover",
|
|
5902
|
-
onError: (
|
|
5903
|
-
|
|
5902
|
+
onError: (k) => {
|
|
5903
|
+
k.currentTarget.style.display = "none";
|
|
5904
5904
|
}
|
|
5905
5905
|
}
|
|
5906
5906
|
) })
|
|
@@ -6002,8 +6002,8 @@ const $t = ({
|
|
|
6002
6002
|
src: Me,
|
|
6003
6003
|
alt: "Aria",
|
|
6004
6004
|
className: "w-full h-full object-cover",
|
|
6005
|
-
onError: (
|
|
6006
|
-
|
|
6005
|
+
onError: (k) => {
|
|
6006
|
+
k.currentTarget.style.display = "none";
|
|
6007
6007
|
}
|
|
6008
6008
|
}
|
|
6009
6009
|
) })
|
|
@@ -6012,7 +6012,7 @@ const $t = ({
|
|
|
6012
6012
|
"text-2xl font-bold tracking-tight mb-2",
|
|
6013
6013
|
p ? "text-white" : "text-gray-900"
|
|
6014
6014
|
), children: "Aria is joining..." }),
|
|
6015
|
-
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 mb-6", children: [0, 1, 2].map((
|
|
6015
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-1.5 mb-6", children: [0, 1, 2].map((k) => /* @__PURE__ */ o(
|
|
6016
6016
|
"div",
|
|
6017
6017
|
{
|
|
6018
6018
|
className: i(
|
|
@@ -6021,10 +6021,10 @@ const $t = ({
|
|
|
6021
6021
|
),
|
|
6022
6022
|
style: {
|
|
6023
6023
|
animation: "aria-loading-bounce 1.4s ease-in-out infinite",
|
|
6024
|
-
animationDelay: `${
|
|
6024
|
+
animationDelay: `${k * 0.15}s`
|
|
6025
6025
|
}
|
|
6026
6026
|
},
|
|
6027
|
-
|
|
6027
|
+
k
|
|
6028
6028
|
)) }),
|
|
6029
6029
|
/* @__PURE__ */ o("p", { className: i(
|
|
6030
6030
|
"text-sm font-medium px-4 py-2 rounded-full",
|
|
@@ -6110,7 +6110,7 @@ const $t = ({
|
|
|
6110
6110
|
p ? "text-amber-400" : "text-amber-600"
|
|
6111
6111
|
), children: "Please wait..." })
|
|
6112
6112
|
] }),
|
|
6113
|
-
/* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 ml-1", children: [0, 1, 2].map((
|
|
6113
|
+
/* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 ml-1", children: [0, 1, 2].map((k) => /* @__PURE__ */ o(
|
|
6114
6114
|
"div",
|
|
6115
6115
|
{
|
|
6116
6116
|
className: i(
|
|
@@ -6119,10 +6119,10 @@ const $t = ({
|
|
|
6119
6119
|
),
|
|
6120
6120
|
style: {
|
|
6121
6121
|
animation: "aria-loading-bounce 1.4s ease-in-out infinite",
|
|
6122
|
-
animationDelay: `${
|
|
6122
|
+
animationDelay: `${k * 0.15}s`
|
|
6123
6123
|
}
|
|
6124
6124
|
},
|
|
6125
|
-
|
|
6125
|
+
k
|
|
6126
6126
|
)) })
|
|
6127
6127
|
]
|
|
6128
6128
|
}
|
|
@@ -6246,12 +6246,12 @@ const $t = ({
|
|
|
6246
6246
|
"text-xs",
|
|
6247
6247
|
p ? "text-gray-400" : "text-gray-500"
|
|
6248
6248
|
), children: "Aria is here to chat with you" })
|
|
6249
|
-
] }) : l.filter((
|
|
6249
|
+
] }) : l.filter((k) => k.content && k.content.trim() !== "").map((k, f) => /* @__PURE__ */ g(
|
|
6250
6250
|
"div",
|
|
6251
6251
|
{
|
|
6252
6252
|
className: i(
|
|
6253
6253
|
"flex gap-2 aria-animate-fade-in",
|
|
6254
|
-
|
|
6254
|
+
k.role === "user" ? "flex-row-reverse" : "flex-row"
|
|
6255
6255
|
),
|
|
6256
6256
|
style: { animationDelay: `${f * 50}ms` },
|
|
6257
6257
|
children: [
|
|
@@ -6260,9 +6260,9 @@ const $t = ({
|
|
|
6260
6260
|
{
|
|
6261
6261
|
className: i(
|
|
6262
6262
|
"shrink-0 w-6 h-6 rounded-full flex items-center justify-center",
|
|
6263
|
-
|
|
6263
|
+
k.role === "user" ? "bg-indigo-500 text-white" : p ? "bg-gray-700 text-gray-300" : "bg-gray-200 text-gray-600"
|
|
6264
6264
|
),
|
|
6265
|
-
children:
|
|
6265
|
+
children: k.role === "user" ? /* @__PURE__ */ o(hr, { className: "h-3 w-3" }) : /* @__PURE__ */ o(mr, { className: "h-3 w-3" })
|
|
6266
6266
|
}
|
|
6267
6267
|
),
|
|
6268
6268
|
/* @__PURE__ */ g(
|
|
@@ -6270,7 +6270,7 @@ const $t = ({
|
|
|
6270
6270
|
{
|
|
6271
6271
|
className: i(
|
|
6272
6272
|
"flex flex-col max-w-[80%]",
|
|
6273
|
-
|
|
6273
|
+
k.role === "user" ? "items-end" : "items-start"
|
|
6274
6274
|
),
|
|
6275
6275
|
children: [
|
|
6276
6276
|
/* @__PURE__ */ o(
|
|
@@ -6278,18 +6278,18 @@ const $t = ({
|
|
|
6278
6278
|
{
|
|
6279
6279
|
className: i(
|
|
6280
6280
|
"px-3 py-2 rounded-2xl",
|
|
6281
|
-
|
|
6281
|
+
k.role === "user" ? "bg-indigo-500 text-white rounded-br-md" : p ? "bg-gray-800 text-gray-100 rounded-bl-md" : "bg-white shadow-sm text-gray-800 rounded-bl-md"
|
|
6282
6282
|
),
|
|
6283
6283
|
children: /* @__PURE__ */ o("p", { className: i(
|
|
6284
6284
|
"text-xs leading-relaxed break-words",
|
|
6285
|
-
|
|
6286
|
-
), children:
|
|
6285
|
+
k.role === "user" && "text-white"
|
|
6286
|
+
), children: k.content })
|
|
6287
6287
|
}
|
|
6288
6288
|
),
|
|
6289
6289
|
/* @__PURE__ */ o("span", { className: i(
|
|
6290
6290
|
"text-[9px] mt-1 px-1",
|
|
6291
6291
|
p ? "text-gray-500" : "text-gray-400"
|
|
6292
|
-
), children: A(
|
|
6292
|
+
), children: A(k.timestamp) })
|
|
6293
6293
|
]
|
|
6294
6294
|
}
|
|
6295
6295
|
)
|
|
@@ -6310,7 +6310,7 @@ const $t = ({
|
|
|
6310
6310
|
"input",
|
|
6311
6311
|
{
|
|
6312
6312
|
value: L,
|
|
6313
|
-
onChange: (
|
|
6313
|
+
onChange: (k) => q(k.target.value),
|
|
6314
6314
|
onKeyDown: $,
|
|
6315
6315
|
placeholder: s ? "Message Aria..." : "Connecting...",
|
|
6316
6316
|
disabled: !s || O,
|