@arbidocs/react 0.3.147 → 0.3.149
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/index.cjs +347 -148
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +167 -5
- package/dist/index.d.ts +167 -5
- package/dist/index.js +336 -143
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var chunkZBZKHBDS_cjs = require('./chunk-ZBZKHBDS.cjs');
|
|
4
3
|
var chunkZMTLGO3K_cjs = require('./chunk-ZMTLGO3K.cjs');
|
|
4
|
+
var chunkZBZKHBDS_cjs = require('./chunk-ZBZKHBDS.cjs');
|
|
5
5
|
var React2 = require('react');
|
|
6
6
|
var reactQuery = require('@tanstack/react-query');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -1336,7 +1336,7 @@ function ArbiChat({
|
|
|
1336
1336
|
) }) });
|
|
1337
1337
|
}
|
|
1338
1338
|
var TypingIndicator = React2.memo(function TypingIndicator2() {
|
|
1339
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-start mb-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center", children: [
|
|
1339
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-full justify-start mb-2", "data-testid": "dm-typing-indicator", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-card border border-primary rounded-2xl rounded-bl-md px-4 py-2.5", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 items-center", children: [
|
|
1340
1340
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:0ms]" }),
|
|
1341
1341
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:150ms]" }),
|
|
1342
1342
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground animate-bounce [animation-delay:300ms]" })
|
|
@@ -1350,23 +1350,35 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1350
1350
|
read,
|
|
1351
1351
|
onDelete,
|
|
1352
1352
|
isLastOfRun = true,
|
|
1353
|
+
senderName,
|
|
1354
|
+
classNames,
|
|
1353
1355
|
renderMessage = (m) => m,
|
|
1354
|
-
formatTimestamp = (t) => t
|
|
1356
|
+
formatTimestamp = (t) => t,
|
|
1357
|
+
"data-testid": testId
|
|
1355
1358
|
}) {
|
|
1356
1359
|
const [isHovered, setIsHovered] = React2.useState(false);
|
|
1357
1360
|
const [isFocused, setIsFocused] = React2.useState(false);
|
|
1358
1361
|
const showDeleteButton = isHovered || isFocused;
|
|
1359
1362
|
if (deleted) {
|
|
1360
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1363
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1364
|
+
"div",
|
|
1365
|
+
{
|
|
1366
|
+
"data-testid": testId,
|
|
1367
|
+
className: `flex w-full ${isSent ? "justify-end" : "justify-start"} mb-2`,
|
|
1368
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm text-muted-foreground italic px-3 py-1", children: "Message deleted" })
|
|
1369
|
+
}
|
|
1370
|
+
);
|
|
1361
1371
|
}
|
|
1362
1372
|
const bubbleRadius = chunkZBZKHBDS_cjs.cn(
|
|
1363
1373
|
"rounded-2xl",
|
|
1364
|
-
isSent && isLastOfRun && "rounded-br-
|
|
1365
|
-
!isSent && isLastOfRun && "rounded-bl-
|
|
1374
|
+
isSent && isLastOfRun && "rounded-br-sm",
|
|
1375
|
+
!isSent && isLastOfRun && "rounded-bl-sm"
|
|
1366
1376
|
);
|
|
1377
|
+
const bubbleSurface = isSent ? chunkZBZKHBDS_cjs.cn("bg-ai-accent-soft text-foreground chat-bubble-sent", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn("border border-border bg-card text-card-foreground", classNames?.peerBubble);
|
|
1367
1378
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1368
1379
|
"div",
|
|
1369
1380
|
{
|
|
1381
|
+
"data-testid": testId,
|
|
1370
1382
|
className: chunkZBZKHBDS_cjs.cn(
|
|
1371
1383
|
"flex w-full items-end",
|
|
1372
1384
|
isLastOfRun ? "mb-2" : "mb-0.5",
|
|
@@ -1389,41 +1401,23 @@ var ChatBubble = React2.memo(function ChatBubble2({
|
|
|
1389
1401
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "w-3.5 h-3.5" })
|
|
1390
1402
|
}
|
|
1391
1403
|
),
|
|
1392
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1393
|
-
"div",
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
"
|
|
1404
|
-
{
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
children: [
|
|
1410
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1411
|
-
"span",
|
|
1412
|
-
{
|
|
1413
|
-
className: chunkZBZKHBDS_cjs.cn(
|
|
1414
|
-
"text-[11px] leading-none",
|
|
1415
|
-
isSent ? "text-primary-foreground/70" : "text-muted-foreground"
|
|
1416
|
-
),
|
|
1417
|
-
children: formatTimestamp(timestamp)
|
|
1418
|
-
}
|
|
1419
|
-
),
|
|
1420
|
-
isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 text-primary-foreground/80 flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 text-primary-foreground/60 flex-shrink-0" }))
|
|
1421
|
-
]
|
|
1422
|
-
}
|
|
1423
|
-
)
|
|
1424
|
-
]
|
|
1425
|
-
}
|
|
1426
|
-
) }),
|
|
1404
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col max-w-[80%] md:max-w-[60%]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkZBZKHBDS_cjs.cn("px-3.5 py-2 break-words shadow-sm", bubbleRadius, bubbleSurface), children: [
|
|
1405
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-sm [&_.markdown-content]:space-y-1.5 [&_pre]:max-w-full [&_pre]:overflow-x-auto", children: renderMessage(message) }),
|
|
1406
|
+
isLastOfRun && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1407
|
+
"div",
|
|
1408
|
+
{
|
|
1409
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
1410
|
+
"flex items-center gap-1.5 mt-0.5",
|
|
1411
|
+
isSent ? "justify-end" : "justify-start"
|
|
1412
|
+
),
|
|
1413
|
+
children: [
|
|
1414
|
+
senderName && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] font-medium leading-none opacity-90", children: senderName }),
|
|
1415
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[11px] leading-none opacity-70", children: formatTimestamp(timestamp) }),
|
|
1416
|
+
isSent && (read ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckCheck, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-80" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "w-3.5 h-3.5 flex-shrink-0 opacity-60" }))
|
|
1417
|
+
]
|
|
1418
|
+
}
|
|
1419
|
+
)
|
|
1420
|
+
] }) }),
|
|
1427
1421
|
!isSent && onDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1428
1422
|
"button",
|
|
1429
1423
|
{
|
|
@@ -2701,6 +2695,79 @@ function DocumentReview({
|
|
|
2701
2695
|
}
|
|
2702
2696
|
);
|
|
2703
2697
|
}
|
|
2698
|
+
var TIERS = [
|
|
2699
|
+
{ min: 0.7, tone: "bg-emerald-500", label: "High relevance" },
|
|
2700
|
+
{ min: 0.4, tone: "bg-amber-500", label: "Medium relevance" },
|
|
2701
|
+
{ min: -Infinity, tone: "bg-muted-foreground/40", label: "Low relevance" }
|
|
2702
|
+
];
|
|
2703
|
+
function RelevanceDot({ score }) {
|
|
2704
|
+
if (score == null) return null;
|
|
2705
|
+
const tier = TIERS.find((t) => score >= t.min) ?? TIERS[TIERS.length - 1];
|
|
2706
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2707
|
+
"span",
|
|
2708
|
+
{
|
|
2709
|
+
role: "img",
|
|
2710
|
+
"aria-label": tier.label,
|
|
2711
|
+
title: `${tier.label} (${score.toFixed(2)})`,
|
|
2712
|
+
className: chunkZBZKHBDS_cjs.cn("size-1.5 shrink-0 rounded-full", tier.tone),
|
|
2713
|
+
"data-testid": "passage-relevance"
|
|
2714
|
+
}
|
|
2715
|
+
);
|
|
2716
|
+
}
|
|
2717
|
+
function PassageCard({
|
|
2718
|
+
header,
|
|
2719
|
+
score,
|
|
2720
|
+
headerRight,
|
|
2721
|
+
active,
|
|
2722
|
+
onClick,
|
|
2723
|
+
footer,
|
|
2724
|
+
className,
|
|
2725
|
+
children,
|
|
2726
|
+
"data-testid": testId
|
|
2727
|
+
}) {
|
|
2728
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2729
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1.5 flex items-center gap-2", children: [
|
|
2730
|
+
header,
|
|
2731
|
+
(score != null || headerRight) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ml-auto flex shrink-0 items-center gap-2", children: [
|
|
2732
|
+
/* @__PURE__ */ jsxRuntime.jsx(RelevanceDot, { score }),
|
|
2733
|
+
headerRight
|
|
2734
|
+
] })
|
|
2735
|
+
] }),
|
|
2736
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "[&_mark]:rounded-sm [&_mark]:bg-ai-accent/20 [&_mark]:px-0.5 [&_mark]:font-medium [&_mark]:text-foreground", children })
|
|
2737
|
+
] });
|
|
2738
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2739
|
+
"div",
|
|
2740
|
+
{
|
|
2741
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
2742
|
+
"group rounded-lg border border-border bg-card p-3 text-left transition-colors",
|
|
2743
|
+
onClick && "hover:border-ai-accent/40 focus-within:ring-2 focus-within:ring-ai-accent/40",
|
|
2744
|
+
active && "border-ai-accent/60 ring-1 ring-ai-accent/30",
|
|
2745
|
+
className
|
|
2746
|
+
),
|
|
2747
|
+
children: [
|
|
2748
|
+
onClick ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2749
|
+
"div",
|
|
2750
|
+
{
|
|
2751
|
+
role: "button",
|
|
2752
|
+
tabIndex: 0,
|
|
2753
|
+
onClick,
|
|
2754
|
+
onKeyDown: (e) => {
|
|
2755
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
2756
|
+
e.preventDefault();
|
|
2757
|
+
onClick(e);
|
|
2758
|
+
}
|
|
2759
|
+
},
|
|
2760
|
+
"aria-current": active || void 0,
|
|
2761
|
+
"data-testid": testId,
|
|
2762
|
+
className: "cursor-pointer focus:outline-none",
|
|
2763
|
+
children: body
|
|
2764
|
+
}
|
|
2765
|
+
) : /* @__PURE__ */ jsxRuntime.jsx("div", { "aria-current": active || void 0, "data-testid": testId, children: body }),
|
|
2766
|
+
footer
|
|
2767
|
+
]
|
|
2768
|
+
}
|
|
2769
|
+
);
|
|
2770
|
+
}
|
|
2704
2771
|
function queryTerms(query) {
|
|
2705
2772
|
const terms = /* @__PURE__ */ new Set();
|
|
2706
2773
|
for (const phrase of query.match(/"([^"]+)"/g) ?? []) {
|
|
@@ -2717,20 +2784,10 @@ function HighlightedSnippet({ text, terms }) {
|
|
|
2717
2784
|
if (terms.length === 0) return [text];
|
|
2718
2785
|
const escaped = terms.map((t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
2719
2786
|
const re = new RegExp(`(${escaped.join("|")})`, "gi");
|
|
2720
|
-
return text.split(re).map(
|
|
2721
|
-
(part, i) => i % 2 === 1 ? /* @__PURE__ */ jsxRuntime.jsx("mark", { className: "rounded-sm bg-ai-accent/20 px-0.5 text-foreground", children: part }, i) : part
|
|
2722
|
-
);
|
|
2787
|
+
return text.split(re).map((part, i) => i % 2 === 1 ? /* @__PURE__ */ jsxRuntime.jsx("mark", { children: part }, i) : part);
|
|
2723
2788
|
}, [text, terms]);
|
|
2724
2789
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: nodes });
|
|
2725
2790
|
}
|
|
2726
|
-
function RelevanceDot({ score }) {
|
|
2727
|
-
if (score == null) return null;
|
|
2728
|
-
const tone = score >= 0.7 ? "bg-emerald-500" : score >= 0.4 ? "bg-amber-500" : "bg-muted-foreground/40";
|
|
2729
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-auto inline-flex items-center gap-1.5 text-[10px] text-muted-foreground", children: [
|
|
2730
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: chunkZBZKHBDS_cjs.cn("size-1.5 rounded-full", tone), "aria-hidden": true }),
|
|
2731
|
-
score.toFixed(2)
|
|
2732
|
-
] });
|
|
2733
|
-
}
|
|
2734
2791
|
function ResultRow({
|
|
2735
2792
|
result,
|
|
2736
2793
|
index,
|
|
@@ -2738,34 +2795,26 @@ function ResultRow({
|
|
|
2738
2795
|
isActive,
|
|
2739
2796
|
onSelect
|
|
2740
2797
|
}) {
|
|
2741
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
2742
|
-
|
|
2798
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2799
|
+
PassageCard,
|
|
2743
2800
|
{
|
|
2744
|
-
type: "button",
|
|
2745
2801
|
onClick: onSelect,
|
|
2802
|
+
active: isActive,
|
|
2803
|
+
score: result.score,
|
|
2746
2804
|
"data-testid": `arbi-semantic-search-result-${index}`,
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
"
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
children: [
|
|
2754
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
2755
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-3.5 shrink-0 text-ai-accent" }),
|
|
2756
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium text-foreground", children: result.docTitle ?? "Document" }),
|
|
2757
|
-
result.page != null && /* @__PURE__ */ jsxRuntime.jsxs(chunkZBZKHBDS_cjs.Badge, { variant: "secondary", children: [
|
|
2758
|
-
"p.",
|
|
2759
|
-
result.page
|
|
2760
|
-
] }),
|
|
2761
|
-
/* @__PURE__ */ jsxRuntime.jsx(RelevanceDot, { score: result.score })
|
|
2762
|
-
] }),
|
|
2763
|
-
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "line-clamp-3 text-xs leading-relaxed text-muted-foreground", children: [
|
|
2764
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: "\u2026 " }),
|
|
2765
|
-
/* @__PURE__ */ jsxRuntime.jsx(HighlightedSnippet, { text: result.content, terms }),
|
|
2766
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: " \u2026" })
|
|
2805
|
+
header: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2806
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { className: "size-3.5 shrink-0 text-ai-accent" }),
|
|
2807
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-xs font-medium text-foreground", children: result.docTitle ?? "Document" }),
|
|
2808
|
+
result.page != null && /* @__PURE__ */ jsxRuntime.jsxs(chunkZBZKHBDS_cjs.Badge, { variant: "secondary", children: [
|
|
2809
|
+
"p.",
|
|
2810
|
+
result.page
|
|
2767
2811
|
] })
|
|
2768
|
-
]
|
|
2812
|
+
] }),
|
|
2813
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "line-clamp-3 text-xs leading-relaxed text-muted-foreground", children: [
|
|
2814
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: "\u2026 " }),
|
|
2815
|
+
/* @__PURE__ */ jsxRuntime.jsx(HighlightedSnippet, { text: result.content, terms }),
|
|
2816
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground/60", children: " \u2026" })
|
|
2817
|
+
] })
|
|
2769
2818
|
}
|
|
2770
2819
|
);
|
|
2771
2820
|
}
|
|
@@ -5383,88 +5432,207 @@ function ConversationList({
|
|
|
5383
5432
|
selectedPeerId,
|
|
5384
5433
|
onSelect,
|
|
5385
5434
|
classNames,
|
|
5386
|
-
emptyState
|
|
5435
|
+
emptyState,
|
|
5436
|
+
header,
|
|
5437
|
+
className
|
|
5387
5438
|
}) {
|
|
5388
5439
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5389
5440
|
"aside",
|
|
5390
5441
|
{
|
|
5391
|
-
className:
|
|
5442
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5443
|
+
"flex min-h-0 flex-col border-b border-border md:w-80 md:shrink-0 md:border-b-0 md:border-r",
|
|
5444
|
+
className
|
|
5445
|
+
),
|
|
5392
5446
|
"data-testid": "arbi-dm-list",
|
|
5393
5447
|
children: [
|
|
5394
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 py-3", children: [
|
|
5448
|
+
header === void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-b border-border px-4 py-3", children: [
|
|
5395
5449
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-semibold text-foreground", children: "Conversations" }),
|
|
5396
5450
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
5397
5451
|
conversations.length,
|
|
5398
5452
|
" ",
|
|
5399
5453
|
conversations.length === 1 ? "colleague" : "colleagues"
|
|
5400
5454
|
] })
|
|
5401
|
-
] }),
|
|
5402
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 text-xs text-muted-foreground", children: emptyState ?? "No conversations yet." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "w-full", children: conversations.map((c) => {
|
|
5455
|
+
] }) : header,
|
|
5456
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1 overflow-y-auto", children: conversations.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 py-6 text-xs text-muted-foreground", children: emptyState ?? "No conversations yet." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "w-full", children: conversations.map((c, i) => {
|
|
5403
5457
|
const { peer, lastMessage, unreadCount } = c;
|
|
5458
|
+
const newSection = c.sectionLabel && c.sectionLabel !== conversations[i - 1]?.sectionLabel;
|
|
5404
5459
|
const active = peer.external_id === selectedPeerId;
|
|
5405
|
-
const preview = lastMessage
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
{
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5460
|
+
const preview = lastMessage?.body ?? "No messages yet \u2014 say hello";
|
|
5461
|
+
const unread = unreadCount > 0;
|
|
5462
|
+
const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5463
|
+
c.leading ?? /* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer }),
|
|
5464
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
5465
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
5466
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5467
|
+
"span",
|
|
5468
|
+
{
|
|
5469
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5470
|
+
"truncate text-sm text-foreground",
|
|
5471
|
+
unread ? "font-bold" : "font-semibold"
|
|
5472
|
+
),
|
|
5473
|
+
children: userDisplayName(peer)
|
|
5474
|
+
}
|
|
5475
|
+
),
|
|
5476
|
+
c.statusLabel ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5477
|
+
chunkZBZKHBDS_cjs.Badge,
|
|
5478
|
+
{
|
|
5479
|
+
variant: "outline",
|
|
5480
|
+
className: "shrink-0 rounded-full px-2 py-0 text-[10px] font-medium text-muted-foreground",
|
|
5481
|
+
children: c.statusLabel
|
|
5482
|
+
}
|
|
5483
|
+
) : unreadCount > 0 ? (
|
|
5484
|
+
// Quiet by default: a filled brand pill with a shadow
|
|
5485
|
+
// shouted louder than the message it was counting.
|
|
5486
|
+
// Enough to catch the eye scanning the list, no more.
|
|
5487
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5488
|
+
chunkZBZKHBDS_cjs.Badge,
|
|
5489
|
+
{
|
|
5490
|
+
variant: "accent",
|
|
5491
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5492
|
+
"min-w-[1.125rem] justify-center rounded-full px-1 py-0 text-[10px] font-medium leading-[1.125rem] shadow-none",
|
|
5493
|
+
classNames?.unreadBadge
|
|
5494
|
+
),
|
|
5495
|
+
children: unreadCount
|
|
5496
|
+
}
|
|
5497
|
+
)
|
|
5498
|
+
) : null
|
|
5499
|
+
] }),
|
|
5500
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1 flex items-center gap-1.5", children: [
|
|
5501
|
+
lastMessage?.isMine ? lastMessage.read ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5502
|
+
lucideReact.CheckCheck,
|
|
5503
|
+
{
|
|
5504
|
+
className: "size-3.5 shrink-0 text-ai-accent",
|
|
5505
|
+
"aria-label": "Read"
|
|
5506
|
+
}
|
|
5507
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5508
|
+
lucideReact.Check,
|
|
5509
|
+
{
|
|
5510
|
+
className: "size-3.5 shrink-0 text-muted-foreground",
|
|
5511
|
+
"aria-label": "Sent"
|
|
5512
|
+
}
|
|
5513
|
+
) : null,
|
|
5514
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5515
|
+
"p",
|
|
5516
|
+
{
|
|
5517
|
+
className: chunkZBZKHBDS_cjs.cn(
|
|
5518
|
+
"min-w-0 flex-1 truncate text-xs",
|
|
5519
|
+
unread ? "font-medium text-foreground" : "text-muted-foreground"
|
|
5520
|
+
),
|
|
5521
|
+
children: c.subtitle ?? preview
|
|
5522
|
+
}
|
|
5523
|
+
),
|
|
5524
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: lastMessage ? formatRelativeTime(lastMessage.createdAt) : "" })
|
|
5525
|
+
] })
|
|
5526
|
+
] })
|
|
5527
|
+
] });
|
|
5528
|
+
const rowClass = chunkZBZKHBDS_cjs.cn(
|
|
5529
|
+
// Each row is its own opaque surface. Left transparent it takes
|
|
5530
|
+
// the panel's colour, and the chips stop reading as cards at all
|
|
5531
|
+
// — which is the whole point of them.
|
|
5532
|
+
"flex w-full items-start gap-3 border-b border-border/60 bg-card px-4 py-3 text-left transition-colors",
|
|
5533
|
+
c.disabled ? "cursor-default" : active ? "bg-ai-accent-soft" : "hover:bg-accent/40"
|
|
5534
|
+
);
|
|
5535
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("li", { children: [
|
|
5536
|
+
newSection && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5537
|
+
"p",
|
|
5538
|
+
{
|
|
5539
|
+
className: "bg-muted/40 px-4 py-1.5 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
5540
|
+
"data-testid": "arbi-dm-section",
|
|
5541
|
+
children: c.sectionLabel
|
|
5542
|
+
}
|
|
5543
|
+
),
|
|
5544
|
+
c.disabled ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5545
|
+
"div",
|
|
5546
|
+
{
|
|
5547
|
+
"data-testid": `arbi-dm-conversation-${peer.external_id}`,
|
|
5548
|
+
className: rowClass,
|
|
5549
|
+
children: [
|
|
5550
|
+
body,
|
|
5551
|
+
c.trailing
|
|
5552
|
+
]
|
|
5553
|
+
}
|
|
5554
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
5555
|
+
"button",
|
|
5556
|
+
{
|
|
5557
|
+
type: "button",
|
|
5558
|
+
onClick: () => onSelect(peer.external_id),
|
|
5559
|
+
"data-testid": `arbi-dm-conversation-${peer.external_id}`,
|
|
5560
|
+
className: rowClass,
|
|
5561
|
+
children: body
|
|
5562
|
+
}
|
|
5563
|
+
)
|
|
5564
|
+
] }, peer.external_id);
|
|
5431
5565
|
}) }) })
|
|
5432
5566
|
]
|
|
5433
5567
|
}
|
|
5434
5568
|
);
|
|
5435
5569
|
}
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
|
|
5439
|
-
|
|
5440
|
-
|
|
5570
|
+
|
|
5571
|
+
// src/directmessages/grouping.ts
|
|
5572
|
+
var RUN_WINDOW_MS = 2 * 60 * 1e3;
|
|
5573
|
+
function dayKey(iso) {
|
|
5574
|
+
const d = new Date(iso);
|
|
5575
|
+
if (Number.isNaN(d.getTime())) return iso;
|
|
5576
|
+
return `${d.getFullYear()}-${d.getMonth() + 1}-${d.getDate()}`;
|
|
5577
|
+
}
|
|
5578
|
+
function annotateThread(messages, accessors, runWindowMs = RUN_WINDOW_MS) {
|
|
5579
|
+
const { senderId, createdAt } = accessors;
|
|
5580
|
+
return messages.map((message, i) => {
|
|
5581
|
+
const next = messages[i + 1];
|
|
5582
|
+
const prev = messages[i - 1];
|
|
5583
|
+
const day = dayKey(createdAt(message));
|
|
5584
|
+
const continuesIntoNext = !!next && senderId(next) === senderId(message) && dayKey(createdAt(next)) === day && Date.parse(createdAt(next)) - Date.parse(createdAt(message)) < runWindowMs;
|
|
5585
|
+
return {
|
|
5586
|
+
message,
|
|
5587
|
+
isLastOfRun: !continuesIntoNext,
|
|
5588
|
+
isFirstOfDay: !prev || dayKey(createdAt(prev)) !== day
|
|
5589
|
+
};
|
|
5590
|
+
});
|
|
5591
|
+
}
|
|
5592
|
+
function DateSeparator({ children }) {
|
|
5593
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-3 flex justify-center", "data-testid": "dm-date-separator", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded-full bg-background/80 px-2 py-0.5 text-xs text-muted-foreground", children }) });
|
|
5594
|
+
}
|
|
5595
|
+
function MessageBubble2({
|
|
5596
|
+
message,
|
|
5597
|
+
classNames,
|
|
5598
|
+
isLastOfRun = true,
|
|
5599
|
+
onDelete,
|
|
5600
|
+
deleted
|
|
5601
|
+
}) {
|
|
5602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
5603
|
+
ChatBubble,
|
|
5441
5604
|
{
|
|
5442
5605
|
"data-testid": "arbi-dm-message",
|
|
5443
|
-
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
|
|
5452
|
-
|
|
5453
|
-
"max-w-[80%] rounded-2xl px-3.5 py-2 text-sm shadow-sm",
|
|
5454
|
-
isMine ? chunkZBZKHBDS_cjs.cn("rounded-br-sm bg-accent text-accent-foreground", classNames?.ownBubble) : chunkZBZKHBDS_cjs.cn(
|
|
5455
|
-
"rounded-bl-sm border border-border bg-card text-card-foreground",
|
|
5456
|
-
classNames?.peerBubble
|
|
5457
|
-
)
|
|
5458
|
-
),
|
|
5459
|
-
children: message.body
|
|
5460
|
-
}
|
|
5461
|
-
)
|
|
5462
|
-
]
|
|
5606
|
+
message: message.body,
|
|
5607
|
+
timestamp: message.createdAt,
|
|
5608
|
+
isSent: message.isMine,
|
|
5609
|
+
read: message.read,
|
|
5610
|
+
deleted,
|
|
5611
|
+
onDelete,
|
|
5612
|
+
isLastOfRun,
|
|
5613
|
+
senderName: message.isMine ? "You" : userDisplayName(message.sender),
|
|
5614
|
+
classNames,
|
|
5615
|
+
formatTimestamp: formatRelativeTime
|
|
5463
5616
|
}
|
|
5464
5617
|
);
|
|
5465
5618
|
}
|
|
5466
|
-
|
|
5619
|
+
var THREAD_ACCESSORS = {
|
|
5620
|
+
senderId: (m) => m.sender.external_id,
|
|
5621
|
+
createdAt: (m) => m.createdAt
|
|
5622
|
+
};
|
|
5623
|
+
function MessageThread({
|
|
5624
|
+
conversation,
|
|
5625
|
+
classNames,
|
|
5626
|
+
emptyState,
|
|
5627
|
+
formatDay,
|
|
5628
|
+
onDeleteMessage,
|
|
5629
|
+
deletedIds
|
|
5630
|
+
}) {
|
|
5467
5631
|
const bottomRef = React2.useRef(null);
|
|
5632
|
+
const items = React2.useMemo(
|
|
5633
|
+
() => annotateThread(conversation?.messages ?? [], THREAD_ACCESSORS),
|
|
5634
|
+
[conversation?.messages]
|
|
5635
|
+
);
|
|
5468
5636
|
React2.useEffect(() => {
|
|
5469
5637
|
bottomRef.current?.scrollIntoView({ block: "end" });
|
|
5470
5638
|
}, [conversation?.peer.external_id, conversation?.messages.length]);
|
|
@@ -5477,7 +5645,7 @@ function MessageThread({ conversation, classNames, emptyState }) {
|
|
|
5477
5645
|
] })
|
|
5478
5646
|
] }) });
|
|
5479
5647
|
}
|
|
5480
|
-
const { peer
|
|
5648
|
+
const { peer } = conversation;
|
|
5481
5649
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5482
5650
|
/* @__PURE__ */ jsxRuntime.jsxs("header", { className: "flex items-center gap-3 border-b border-border px-4 py-3", children: [
|
|
5483
5651
|
/* @__PURE__ */ jsxRuntime.jsx(DmAvatar, { user: peer, className: "size-9" }),
|
|
@@ -5486,20 +5654,42 @@ function MessageThread({ conversation, classNames, emptyState }) {
|
|
|
5486
5654
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "truncate text-xs text-muted-foreground", children: peer.email })
|
|
5487
5655
|
] })
|
|
5488
5656
|
] }),
|
|
5489
|
-
/* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.ScrollArea, { className: "min-h-0 flex-1 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col
|
|
5490
|
-
|
|
5657
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkZBZKHBDS_cjs.ScrollArea, { className: "min-h-0 flex-1 bg-background", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col px-4 py-4", "data-testid": "arbi-dm-thread", children: [
|
|
5658
|
+
items.map(({ message: m, isLastOfRun, isFirstOfDay }) => /* @__PURE__ */ jsxRuntime.jsxs(React2.Fragment, { children: [
|
|
5659
|
+
isFirstOfDay && formatDay && /* @__PURE__ */ jsxRuntime.jsx(DateSeparator, { children: formatDay(m.createdAt) }),
|
|
5660
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5661
|
+
MessageBubble2,
|
|
5662
|
+
{
|
|
5663
|
+
message: m,
|
|
5664
|
+
classNames,
|
|
5665
|
+
isLastOfRun,
|
|
5666
|
+
deleted: deletedIds?.has(m.externalId),
|
|
5667
|
+
onDelete: onDeleteMessage ? () => onDeleteMessage(m) : void 0
|
|
5668
|
+
}
|
|
5669
|
+
)
|
|
5670
|
+
] }, m.externalId)),
|
|
5491
5671
|
/* @__PURE__ */ jsxRuntime.jsx("div", { ref: bottomRef })
|
|
5492
5672
|
] }) })
|
|
5493
5673
|
] });
|
|
5494
5674
|
}
|
|
5495
|
-
function DmComposer({
|
|
5675
|
+
function DmComposer({
|
|
5676
|
+
placeholder,
|
|
5677
|
+
disabled,
|
|
5678
|
+
busy,
|
|
5679
|
+
onSend,
|
|
5680
|
+
error,
|
|
5681
|
+
children,
|
|
5682
|
+
classNames
|
|
5683
|
+
}) {
|
|
5496
5684
|
const [draft, setDraft] = React2.useState("");
|
|
5685
|
+
const inputRef = React2.useRef(null);
|
|
5497
5686
|
const submit = async () => {
|
|
5498
5687
|
const text = draft.trim();
|
|
5499
|
-
if (!text || disabled) return;
|
|
5688
|
+
if (!text || disabled || busy) return;
|
|
5500
5689
|
setDraft("");
|
|
5501
5690
|
try {
|
|
5502
5691
|
await onSend(text);
|
|
5692
|
+
inputRef.current?.focus();
|
|
5503
5693
|
} catch {
|
|
5504
5694
|
setDraft(text);
|
|
5505
5695
|
}
|
|
@@ -5511,10 +5701,12 @@ function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
|
|
|
5511
5701
|
}
|
|
5512
5702
|
};
|
|
5513
5703
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-3", children: [
|
|
5704
|
+
children,
|
|
5514
5705
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-end gap-2", children: [
|
|
5515
5706
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5516
5707
|
chunkZBZKHBDS_cjs.Textarea,
|
|
5517
5708
|
{
|
|
5709
|
+
ref: inputRef,
|
|
5518
5710
|
value: draft,
|
|
5519
5711
|
onChange: (e) => setDraft(e.target.value),
|
|
5520
5712
|
onKeyDown,
|
|
@@ -5530,11 +5722,12 @@ function DmComposer({ placeholder, disabled, onSend, error, classNames }) {
|
|
|
5530
5722
|
{
|
|
5531
5723
|
type: "button",
|
|
5532
5724
|
onClick: () => void submit(),
|
|
5533
|
-
disabled: disabled || !draft.trim(),
|
|
5725
|
+
disabled: disabled || busy || !draft.trim(),
|
|
5534
5726
|
className: chunkZBZKHBDS_cjs.cn(classNames?.sendButton),
|
|
5535
5727
|
"data-testid": "arbi-dm-send",
|
|
5728
|
+
"aria-label": "Send message",
|
|
5536
5729
|
children: [
|
|
5537
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "size-4" }),
|
|
5730
|
+
busy ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Send, { className: "size-4" }),
|
|
5538
5731
|
" Send"
|
|
5539
5732
|
]
|
|
5540
5733
|
}
|
|
@@ -6738,6 +6931,14 @@ function DocumentGallery({
|
|
|
6738
6931
|
);
|
|
6739
6932
|
}
|
|
6740
6933
|
|
|
6934
|
+
Object.defineProperty(exports, "ArbiProvider", {
|
|
6935
|
+
enumerable: true,
|
|
6936
|
+
get: function () { return chunkZMTLGO3K_cjs.ArbiProvider; }
|
|
6937
|
+
});
|
|
6938
|
+
Object.defineProperty(exports, "useArbi", {
|
|
6939
|
+
enumerable: true,
|
|
6940
|
+
get: function () { return chunkZMTLGO3K_cjs.useArbi; }
|
|
6941
|
+
});
|
|
6741
6942
|
Object.defineProperty(exports, "AiMarkdown", {
|
|
6742
6943
|
enumerable: true,
|
|
6743
6944
|
get: function () { return chunkZBZKHBDS_cjs.AiMarkdown; }
|
|
@@ -7162,14 +7363,6 @@ Object.defineProperty(exports, "toggleVariants", {
|
|
|
7162
7363
|
enumerable: true,
|
|
7163
7364
|
get: function () { return chunkZBZKHBDS_cjs.toggleVariants; }
|
|
7164
7365
|
});
|
|
7165
|
-
Object.defineProperty(exports, "ArbiProvider", {
|
|
7166
|
-
enumerable: true,
|
|
7167
|
-
get: function () { return chunkZMTLGO3K_cjs.ArbiProvider; }
|
|
7168
|
-
});
|
|
7169
|
-
Object.defineProperty(exports, "useArbi", {
|
|
7170
|
-
enumerable: true,
|
|
7171
|
-
get: function () { return chunkZMTLGO3K_cjs.useArbi; }
|
|
7172
|
-
});
|
|
7173
7366
|
Object.defineProperty(exports, "Arbi", {
|
|
7174
7367
|
enumerable: true,
|
|
7175
7368
|
get: function () { return browser.Arbi; }
|
|
@@ -7207,6 +7400,7 @@ exports.CommandPaletteProvider = CommandPaletteProvider;
|
|
|
7207
7400
|
exports.ConversationList = ConversationList;
|
|
7208
7401
|
exports.DEFAULT_ASPECT_OPTIONS = DEFAULT_ASPECT_OPTIONS;
|
|
7209
7402
|
exports.DEFAULT_NOTIFY_TONE = DEFAULT_NOTIFY_TONE;
|
|
7403
|
+
exports.DateSeparator = DateSeparator;
|
|
7210
7404
|
exports.DirectMessages = DirectMessages;
|
|
7211
7405
|
exports.DmAvatar = DmAvatar;
|
|
7212
7406
|
exports.DmComposer = DmComposer;
|
|
@@ -7241,10 +7435,13 @@ exports.NEUTRAL_GRAY = NEUTRAL_GRAY2;
|
|
|
7241
7435
|
exports.NotificationBell = NotificationBell;
|
|
7242
7436
|
exports.OpenAIIcon = OpenAIIcon;
|
|
7243
7437
|
exports.PLACEHOLDER_COLOR = PLACEHOLDER_COLOR;
|
|
7438
|
+
exports.PassageCard = PassageCard;
|
|
7244
7439
|
exports.PdfIcon = PdfIcon;
|
|
7245
7440
|
exports.ProjectEntity = ProjectEntity;
|
|
7246
7441
|
exports.ProviderIcon = ProviderIcon;
|
|
7442
|
+
exports.RUN_WINDOW_MS = RUN_WINDOW_MS;
|
|
7247
7443
|
exports.RagDot = RagDot;
|
|
7444
|
+
exports.RelevanceDot = RelevanceDot;
|
|
7248
7445
|
exports.SemanticSearch = SemanticSearch;
|
|
7249
7446
|
exports.StatusPill = StatusPill;
|
|
7250
7447
|
exports.TAG_TYPE_ICONS = TAG_TYPE_ICONS;
|
|
@@ -7259,11 +7456,13 @@ exports.VISIBILITY_ICONS = VISIBILITY_ICONS;
|
|
|
7259
7456
|
exports.VidIcon = VidIcon;
|
|
7260
7457
|
exports.VisibilityIcon = VisibilityIcon;
|
|
7261
7458
|
exports.XlsIcon = XlsIcon;
|
|
7459
|
+
exports.annotateThread = annotateThread;
|
|
7262
7460
|
exports.arbiQueryKeys = arbiQueryKeys;
|
|
7263
7461
|
exports.configureEntityRegistry = configureEntityRegistry;
|
|
7264
7462
|
exports.configureRagLabels = configureRagLabels;
|
|
7265
7463
|
exports.configureStatusRegistry = configureStatusRegistry;
|
|
7266
7464
|
exports.cropImage = cropImage;
|
|
7465
|
+
exports.dayKey = dayKey;
|
|
7267
7466
|
exports.describeActivity = describeActivity;
|
|
7268
7467
|
exports.formatRelativeTime = formatRelativeTime;
|
|
7269
7468
|
exports.getEntityColor = getEntityColor2;
|