@tangle-network/agent-app 0.45.22 → 0.45.24
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/{DesignCanvas-ZG7DJS7C.js → DesignCanvas-3RRPVPCP.js} +2 -2
- package/dist/{DesignCanvasEditor-SLFMHOII.js → DesignCanvasEditor-KAMMEX7E.js} +4 -4
- package/dist/{TimelineEditor-6PV42FLG.js → TimelineEditor-IIBVCAZV.js} +2 -2
- package/dist/VaultPane-MUWGYVJ7.js +7 -0
- package/dist/assistant/index.d.ts +11 -0
- package/dist/assistant/index.js +89 -56
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-react/index.js +4 -1
- package/dist/chat-react/index.js.map +1 -1
- package/dist/{chunk-MLACJ6DB.js → chunk-7O4FZAFP.js} +10 -10
- package/dist/chunk-7O4FZAFP.js.map +1 -0
- package/dist/{chunk-OASVAPRL.js → chunk-AWPK7ZDS.js} +3 -3
- package/dist/{chunk-YTMKRL3L.js → chunk-HZ4WCA37.js} +3 -2
- package/dist/chunk-HZ4WCA37.js.map +1 -0
- package/dist/{chunk-FVJP2RTC.js → chunk-JJJEO4ND.js} +91 -36
- package/dist/chunk-JJJEO4ND.js.map +1 -0
- package/dist/{chunk-NZVBJM73.js → chunk-KOMP6NDW.js} +1114 -494
- package/dist/chunk-KOMP6NDW.js.map +1 -0
- package/dist/{chunk-TZO3SOUL.js → chunk-LSQR6HM6.js} +49 -33
- package/dist/chunk-LSQR6HM6.js.map +1 -0
- package/dist/{chunk-3IHYJIDJ.js → chunk-NC2V63EL.js} +15 -15
- package/dist/chunk-NC2V63EL.js.map +1 -0
- package/dist/{chunk-73CQJOIU.js → chunk-OYGM5WLD.js} +5 -5
- package/dist/chunk-OYGM5WLD.js.map +1 -0
- package/dist/chunk-XEA5EG6P.js +1478 -0
- package/dist/chunk-XEA5EG6P.js.map +1 -0
- package/dist/chunk-YIQHOAHN.js +340 -0
- package/dist/chunk-YIQHOAHN.js.map +1 -0
- package/dist/design-canvas-react/index.d.ts +2 -2
- package/dist/design-canvas-react/index.js +9 -9
- package/dist/design-canvas-react/index.js.map +1 -1
- package/dist/design-canvas-react/lazy.js +1 -1
- package/dist/legibility/cli.d.ts +1 -0
- package/dist/legibility/cli.js +143 -0
- package/dist/legibility/cli.js.map +1 -0
- package/dist/legibility/index.d.ts +572 -0
- package/dist/legibility/index.js +33 -0
- package/dist/legibility/index.js.map +1 -0
- package/dist/sequences-react/index.js +2 -2
- package/dist/theme/index.d.ts +27 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/tailwind-preset.d.ts +25 -0
- package/dist/theme/tailwind-preset.js +55 -1
- package/dist/theme/tailwind-preset.js.map +1 -1
- package/dist/theme/tokens.css +298 -40
- package/dist/vault/index.js +1 -1
- package/dist/vault/lazy.js +1 -1
- package/dist/web-react/async/index.js +19 -307
- package/dist/web-react/async/index.js.map +1 -1
- package/dist/web-react/index.d.ts +321 -6
- package/dist/web-react/index.js +34 -2
- package/dist/work-product-react/index.js +1 -1
- package/package.json +7 -1
- package/dist/VaultPane-HFH734K6.js +0 -7
- package/dist/chunk-3IHYJIDJ.js.map +0 -1
- package/dist/chunk-73CQJOIU.js.map +0 -1
- package/dist/chunk-FVJP2RTC.js.map +0 -1
- package/dist/chunk-MLACJ6DB.js.map +0 -1
- package/dist/chunk-NZVBJM73.js.map +0 -1
- package/dist/chunk-TZO3SOUL.js.map +0 -1
- package/dist/chunk-YTMKRL3L.js.map +0 -1
- /package/dist/{DesignCanvas-ZG7DJS7C.js.map → DesignCanvas-3RRPVPCP.js.map} +0 -0
- /package/dist/{DesignCanvasEditor-SLFMHOII.js.map → DesignCanvasEditor-KAMMEX7E.js.map} +0 -0
- /package/dist/{TimelineEditor-6PV42FLG.js.map → TimelineEditor-IIBVCAZV.js.map} +0 -0
- /package/dist/{VaultPane-HFH734K6.js.map → VaultPane-MUWGYVJ7.js.map} +0 -0
- /package/dist/{chunk-OASVAPRL.js.map → chunk-AWPK7ZDS.js.map} +0 -0
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
WorkProductCard,
|
|
11
11
|
workProductPartsFromMessageParts
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HZ4WCA37.js";
|
|
13
13
|
import {
|
|
14
14
|
attachmentPartsFromMessageParts
|
|
15
15
|
} from "./chunk-B2UEW62O.js";
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./chunk-TH7L265V.js";
|
|
37
37
|
|
|
38
38
|
// src/web-react/index.tsx
|
|
39
|
-
import { useEffect as
|
|
39
|
+
import { useEffect as useEffect12, useMemo as useMemo9, useRef as useRef11, useState as useState16, memo } from "react";
|
|
40
40
|
|
|
41
41
|
// src/web-react/smooth-text.ts
|
|
42
42
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -166,7 +166,7 @@ function usePopover(open, setOpen) {
|
|
|
166
166
|
}
|
|
167
167
|
};
|
|
168
168
|
}
|
|
169
|
-
var POPOVER_OPTION_FOCUS = "focus
|
|
169
|
+
var POPOVER_OPTION_FOCUS = "focus-visible:[outline-offset:-2px]";
|
|
170
170
|
function usePending() {
|
|
171
171
|
const [pending, setPending] = useState2(false);
|
|
172
172
|
const inFlight = useRef2(false);
|
|
@@ -278,7 +278,7 @@ function ModelPicker({ value, onChange, models, loading, renderProviderBadge, re
|
|
|
278
278
|
type: "button",
|
|
279
279
|
...triggerProps,
|
|
280
280
|
onClick: () => setOpen(!open),
|
|
281
|
-
className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30
|
|
281
|
+
className: "inline-flex items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
|
|
282
282
|
children: [
|
|
283
283
|
selected ? renderProviderBadge ? renderProviderBadge(selected.provider) : /* @__PURE__ */ jsx2(ProviderLogo, { provider: selected.provider, size: 16 }) : /* @__PURE__ */ jsx2(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
284
284
|
/* @__PURE__ */ jsx2("span", { className: "max-w-[160px] truncate", children: selected?.name ?? value }),
|
|
@@ -297,7 +297,7 @@ function ModelPicker({ value, onChange, models, loading, renderProviderBadge, re
|
|
|
297
297
|
value: query,
|
|
298
298
|
onChange: (e) => setQuery(e.target.value),
|
|
299
299
|
placeholder: "Search models...",
|
|
300
|
-
className: "flex-1 bg-transparent text-sm
|
|
300
|
+
className: "flex-1 bg-transparent text-sm placeholder:text-muted-foreground"
|
|
301
301
|
}
|
|
302
302
|
)
|
|
303
303
|
] }) }),
|
|
@@ -343,7 +343,7 @@ function EffortPicker({ value, onChange, levels = DEFAULT_EFFORT_LEVELS, label =
|
|
|
343
343
|
...triggerProps,
|
|
344
344
|
onClick: () => setOpen(!open),
|
|
345
345
|
title: label ? `${label} \u2014 how hard the agent reasons before answering` : "Reasoning effort",
|
|
346
|
-
className: "inline-flex min-h-[36px] items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30
|
|
346
|
+
className: "inline-flex min-h-[36px] items-center gap-1.5 rounded-full border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
|
|
347
347
|
children: [
|
|
348
348
|
/* @__PURE__ */ jsx2(SparkleGlyph, { className: "h-3.5 w-3.5 text-muted-foreground" }),
|
|
349
349
|
/* @__PURE__ */ jsxs2("span", { children: [
|
|
@@ -581,12 +581,12 @@ function InteractionActionButton({
|
|
|
581
581
|
type: "button",
|
|
582
582
|
onClick,
|
|
583
583
|
disabled,
|
|
584
|
-
className: `inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-40
|
|
584
|
+
className: `inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm font-medium transition disabled:cursor-not-allowed disabled:opacity-40 ${variantClasses}`,
|
|
585
585
|
children
|
|
586
586
|
}
|
|
587
587
|
);
|
|
588
588
|
}
|
|
589
|
-
var FIELD_INPUT_CLASSES = "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground
|
|
589
|
+
var FIELD_INPUT_CLASSES = "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus:border-primary disabled:opacity-50";
|
|
590
590
|
function QuestionOptionList({
|
|
591
591
|
groupName,
|
|
592
592
|
idPrefix,
|
|
@@ -923,7 +923,7 @@ function DurablePlanCard({
|
|
|
923
923
|
{
|
|
924
924
|
type: "button",
|
|
925
925
|
onClick: () => setExpanded((value) => !value),
|
|
926
|
-
className: "mt-1 text-xs text-muted-foreground hover:text-foreground
|
|
926
|
+
className: "mt-1 text-xs text-muted-foreground hover:text-foreground",
|
|
927
927
|
children: expanded ? "Collapse plan" : "Show full plan"
|
|
928
928
|
}
|
|
929
929
|
)
|
|
@@ -939,7 +939,7 @@ function DurablePlanCard({
|
|
|
939
939
|
onChange: (event) => setFeedback(event.target.value),
|
|
940
940
|
rows: 2,
|
|
941
941
|
placeholder: "Describe what you want changed in the plan",
|
|
942
|
-
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm
|
|
942
|
+
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm focus:border-primary disabled:opacity-50"
|
|
943
943
|
}
|
|
944
944
|
)
|
|
945
945
|
] }),
|
|
@@ -1071,7 +1071,7 @@ function InteractionPlanCard({
|
|
|
1071
1071
|
{
|
|
1072
1072
|
type: "button",
|
|
1073
1073
|
onClick: () => setExpanded((prev) => !prev),
|
|
1074
|
-
className: "mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground transition hover:text-foreground
|
|
1074
|
+
className: "mt-1 inline-flex items-center gap-1 text-xs text-muted-foreground transition hover:text-foreground",
|
|
1075
1075
|
children: [
|
|
1076
1076
|
/* @__PURE__ */ jsx6(ChevronDownGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
1077
1077
|
expanded ? "Collapse plan" : "Show full plan"
|
|
@@ -1090,7 +1090,7 @@ function InteractionPlanCard({
|
|
|
1090
1090
|
onChange: (event) => setValues((prev) => ({ ...prev, [field.name]: { ...prev[field.name], text: event.target.value } })),
|
|
1091
1091
|
rows: 2,
|
|
1092
1092
|
placeholder: field.type === "text" ? field.placeholder ?? "Optional feedback for the agent" : void 0,
|
|
1093
|
-
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground
|
|
1093
|
+
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus:border-primary disabled:opacity-50"
|
|
1094
1094
|
}
|
|
1095
1095
|
) : /* @__PURE__ */ jsx6(
|
|
1096
1096
|
"input",
|
|
@@ -1100,7 +1100,7 @@ function InteractionPlanCard({
|
|
|
1100
1100
|
disabled,
|
|
1101
1101
|
"aria-label": field.label,
|
|
1102
1102
|
onChange: (event) => setValues((prev) => ({ ...prev, [field.name]: { ...prev[field.name], text: event.target.value } })),
|
|
1103
|
-
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground
|
|
1103
|
+
className: "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground focus:border-primary disabled:opacity-50"
|
|
1104
1104
|
}
|
|
1105
1105
|
)
|
|
1106
1106
|
] }, field.name)) }),
|
|
@@ -1309,7 +1309,7 @@ function AttachmentThumbnail({ part, resolveFileUrl, fetchFile }) {
|
|
|
1309
1309
|
window.open(objectUrl, "_blank", "noopener");
|
|
1310
1310
|
}, [objectUrl]);
|
|
1311
1311
|
if (!result) {
|
|
1312
|
-
return /* @__PURE__ */ jsx8("span", { className: "inline-block h-16 w-16 shrink-0 animate-pulse rounded-md bg-muted"
|
|
1312
|
+
return /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", className: "inline-block h-16 w-16 shrink-0 animate-pulse rounded-md bg-muted" });
|
|
1313
1313
|
}
|
|
1314
1314
|
if (!result.ok || !objectUrl) {
|
|
1315
1315
|
return /* @__PURE__ */ jsx8(AttachmentThumbnailError, { name: part.name });
|
|
@@ -1320,7 +1320,7 @@ function AttachmentThumbnail({ part, resolveFileUrl, fetchFile }) {
|
|
|
1320
1320
|
type: "button",
|
|
1321
1321
|
onClick: handleClick,
|
|
1322
1322
|
"aria-label": `Open ${part.name}`,
|
|
1323
|
-
className: "h-16 w-16 shrink-0 overflow-hidden rounded-md border border-border
|
|
1323
|
+
className: "h-16 w-16 shrink-0 overflow-hidden rounded-md border border-border",
|
|
1324
1324
|
children: /* @__PURE__ */ jsx8("img", { src: objectUrl, alt: part.name, className: "h-16 w-16 object-cover" })
|
|
1325
1325
|
}
|
|
1326
1326
|
);
|
|
@@ -1588,9 +1588,28 @@ function UploadGlyph({ className }) {
|
|
|
1588
1588
|
return /* @__PURE__ */ jsx9("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx9("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12" }) });
|
|
1589
1589
|
}
|
|
1590
1590
|
var MAX_HEIGHT = 168;
|
|
1591
|
+
var DEFAULT_SEND_FAILURE = "Message not sent. Your draft is still here \u2014 try again.";
|
|
1592
|
+
function isRejectedOutcome(outcome) {
|
|
1593
|
+
return typeof outcome === "object" && outcome !== null && outcome.ok === false;
|
|
1594
|
+
}
|
|
1595
|
+
function isPromise(value) {
|
|
1596
|
+
return typeof value?.then === "function";
|
|
1597
|
+
}
|
|
1598
|
+
function sendFailureText(error, fallback) {
|
|
1599
|
+
if (typeof error === "object" && error !== null && "ok" in error) {
|
|
1600
|
+
const named = error.error;
|
|
1601
|
+
if (typeof named === "string" && named.trim() !== "") return named;
|
|
1602
|
+
return fallback;
|
|
1603
|
+
}
|
|
1604
|
+
if (typeof error === "string" && error.trim() !== "") return error;
|
|
1605
|
+
if (error instanceof Error && error.message.trim() !== "") return error.message;
|
|
1606
|
+
return fallback;
|
|
1607
|
+
}
|
|
1591
1608
|
function ChatComposer({
|
|
1592
1609
|
onSend,
|
|
1593
1610
|
onSendParts,
|
|
1611
|
+
onSendFailed,
|
|
1612
|
+
sendFailureMessage = DEFAULT_SEND_FAILURE,
|
|
1594
1613
|
onCancel,
|
|
1595
1614
|
isStreaming = false,
|
|
1596
1615
|
disabled = false,
|
|
@@ -1616,6 +1635,8 @@ function ChatComposer({
|
|
|
1616
1635
|
const isControlled = value !== void 0;
|
|
1617
1636
|
const [internal, setInternal] = useState7(initialValue ?? "");
|
|
1618
1637
|
const text = isControlled ? value : internal;
|
|
1638
|
+
const textRef = useRef5(text);
|
|
1639
|
+
textRef.current = text;
|
|
1619
1640
|
const textareaRef = useRef5(null);
|
|
1620
1641
|
const fileInputRef = useRef5(null);
|
|
1621
1642
|
const folderInputRef = useRef5(null);
|
|
@@ -1659,6 +1680,18 @@ function ChatComposer({
|
|
|
1659
1680
|
el.focus();
|
|
1660
1681
|
el.setSelectionRange(text.length, text.length);
|
|
1661
1682
|
}, [text]);
|
|
1683
|
+
const restoreCaretRef = useRef5(null);
|
|
1684
|
+
useEffect6(() => {
|
|
1685
|
+
const pending = restoreCaretRef.current;
|
|
1686
|
+
if (!pending || pending.text !== text) return;
|
|
1687
|
+
restoreCaretRef.current = null;
|
|
1688
|
+
const el = textareaRef.current;
|
|
1689
|
+
if (!el) return;
|
|
1690
|
+
el.focus();
|
|
1691
|
+
const start = Math.min(pending.start, text.length);
|
|
1692
|
+
const end = Math.min(pending.end, text.length);
|
|
1693
|
+
el.setSelectionRange(start, end);
|
|
1694
|
+
}, [text]);
|
|
1662
1695
|
useEffect6(() => {
|
|
1663
1696
|
if (!focusShortcut || disabled) return;
|
|
1664
1697
|
function onKeyDown(e) {
|
|
@@ -1673,20 +1706,68 @@ function ChatComposer({
|
|
|
1673
1706
|
const readyFileCount = pendingFiles.filter((f) => f.status === "ready").length;
|
|
1674
1707
|
const hasSendable = text.trim().length > 0 || readyFileCount > 0;
|
|
1675
1708
|
const canSend = hasSendable && !isStreaming && !disabled;
|
|
1709
|
+
const [failedSend, setFailedSend] = useState7(null);
|
|
1710
|
+
const failSend = useCallback2(
|
|
1711
|
+
(error, draft, trimmed, parts, caret) => {
|
|
1712
|
+
const message = sendFailureText(error, sendFailureMessage);
|
|
1713
|
+
const restored = textRef.current === "";
|
|
1714
|
+
if (restored) {
|
|
1715
|
+
const el = textareaRef.current;
|
|
1716
|
+
setText(draft);
|
|
1717
|
+
if (el && el.value === draft) {
|
|
1718
|
+
el.focus();
|
|
1719
|
+
el.setSelectionRange(Math.min(caret.start, draft.length), Math.min(caret.end, draft.length));
|
|
1720
|
+
} else {
|
|
1721
|
+
restoreCaretRef.current = { text: draft, start: caret.start, end: caret.end };
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
setFailedSend({ message, text: draft, trimmed, parts, restored });
|
|
1725
|
+
onSendFailed?.({ message, text: draft, parts, error, restored });
|
|
1726
|
+
},
|
|
1727
|
+
[onSendFailed, sendFailureMessage, setText]
|
|
1728
|
+
);
|
|
1729
|
+
const dispatchSend = useCallback2(
|
|
1730
|
+
(draft, trimmed, parts, caret) => {
|
|
1731
|
+
let outcome;
|
|
1732
|
+
try {
|
|
1733
|
+
outcome = onSendParts ? onSendParts(trimmed, parts) : onSend?.(trimmed);
|
|
1734
|
+
} catch (error) {
|
|
1735
|
+
failSend(error, draft, trimmed, parts, caret);
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
if (isPromise(outcome)) {
|
|
1739
|
+
void outcome.then(
|
|
1740
|
+
(settled) => {
|
|
1741
|
+
if (isRejectedOutcome(settled)) failSend(settled, draft, trimmed, parts, caret);
|
|
1742
|
+
},
|
|
1743
|
+
(error) => failSend(error, draft, trimmed, parts, caret)
|
|
1744
|
+
);
|
|
1745
|
+
return;
|
|
1746
|
+
}
|
|
1747
|
+
if (isRejectedOutcome(outcome)) failSend(outcome, draft, trimmed, parts, caret);
|
|
1748
|
+
},
|
|
1749
|
+
[onSend, onSendParts, failSend]
|
|
1750
|
+
);
|
|
1676
1751
|
const send = useCallback2(() => {
|
|
1677
1752
|
const trimmed = text.trim();
|
|
1678
1753
|
if (isStreaming || disabled) return;
|
|
1679
1754
|
const readyFiles = pendingFiles.filter((f) => f.status === "ready");
|
|
1680
1755
|
if (!trimmed && readyFiles.length === 0) return;
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
return;
|
|
1686
|
-
}
|
|
1687
|
-
onSend?.(trimmed);
|
|
1756
|
+
const parts = onSendParts ? readyFiles.filter((f) => f.part).map((f) => f.part) : [];
|
|
1757
|
+
const el = textareaRef.current;
|
|
1758
|
+
const caret = { start: el?.selectionStart ?? text.length, end: el?.selectionEnd ?? text.length };
|
|
1759
|
+
setFailedSend(null);
|
|
1688
1760
|
setText("");
|
|
1689
|
-
|
|
1761
|
+
textRef.current = "";
|
|
1762
|
+
dispatchSend(text, trimmed, parts, caret);
|
|
1763
|
+
}, [text, isStreaming, disabled, onSendParts, pendingFiles, setText, dispatchSend]);
|
|
1764
|
+
const retryFailedSend = useCallback2(() => {
|
|
1765
|
+
const failure = failedSend;
|
|
1766
|
+
if (!failure || isStreaming || disabled) return;
|
|
1767
|
+
setFailedSend(null);
|
|
1768
|
+
const caret = { start: failure.text.length, end: failure.text.length };
|
|
1769
|
+
dispatchSend(failure.text, failure.trimmed, failure.parts, caret);
|
|
1770
|
+
}, [failedSend, isStreaming, disabled, dispatchSend]);
|
|
1690
1771
|
const handleKeyDown = (e) => {
|
|
1691
1772
|
if (e.nativeEvent.isComposing) return;
|
|
1692
1773
|
if (e.key === "Enter" && !e.shiftKey) {
|
|
@@ -1752,6 +1833,50 @@ function ChatComposer({
|
|
|
1752
1833
|
/* @__PURE__ */ jsx9("p", { className: "mt-0.5 text-xs text-muted-foreground", children: dropDescription })
|
|
1753
1834
|
] }) }),
|
|
1754
1835
|
showAbove && /* @__PURE__ */ jsx9("div", { className: "mb-1.5 flex flex-wrap items-center gap-1.5 px-1", children: controls }),
|
|
1836
|
+
failedSend && /* @__PURE__ */ jsxs7(
|
|
1837
|
+
"div",
|
|
1838
|
+
{
|
|
1839
|
+
role: "alert",
|
|
1840
|
+
"data-testid": "composer-send-error",
|
|
1841
|
+
className: "mb-2 rounded-xl border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",
|
|
1842
|
+
children: [
|
|
1843
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-2", children: [
|
|
1844
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 flex-1", children: failedSend.message }),
|
|
1845
|
+
/* @__PURE__ */ jsx9(
|
|
1846
|
+
"button",
|
|
1847
|
+
{
|
|
1848
|
+
type: "button",
|
|
1849
|
+
"aria-label": "Dismiss send error",
|
|
1850
|
+
onClick: () => setFailedSend(null),
|
|
1851
|
+
className: "shrink-0 font-medium underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
|
|
1852
|
+
children: "Dismiss"
|
|
1853
|
+
}
|
|
1854
|
+
)
|
|
1855
|
+
] }),
|
|
1856
|
+
!failedSend.restored && /* @__PURE__ */ jsxs7("div", { className: "mt-1.5", children: [
|
|
1857
|
+
/* @__PURE__ */ jsx9(
|
|
1858
|
+
"p",
|
|
1859
|
+
{
|
|
1860
|
+
"data-testid": "composer-unsent-draft",
|
|
1861
|
+
className: "max-h-20 overflow-y-auto whitespace-pre-wrap rounded-lg border border-destructive/30 bg-card px-2 py-1 text-foreground",
|
|
1862
|
+
children: failedSend.text
|
|
1863
|
+
}
|
|
1864
|
+
),
|
|
1865
|
+
/* @__PURE__ */ jsx9(
|
|
1866
|
+
"button",
|
|
1867
|
+
{
|
|
1868
|
+
type: "button",
|
|
1869
|
+
"aria-label": "Retry sending the unsent message",
|
|
1870
|
+
onClick: retryFailedSend,
|
|
1871
|
+
disabled: isStreaming || disabled,
|
|
1872
|
+
className: "mt-1.5 font-medium underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-50 focus:outline-none focus-visible:ring-2 focus-visible:ring-destructive/50",
|
|
1873
|
+
children: "Retry"
|
|
1874
|
+
}
|
|
1875
|
+
)
|
|
1876
|
+
] })
|
|
1877
|
+
]
|
|
1878
|
+
}
|
|
1879
|
+
),
|
|
1755
1880
|
pendingFiles.length > 0 && /* @__PURE__ */ jsx9("div", { className: "mb-2 flex flex-wrap gap-1.5", children: [...folderChips, ...fileChips].map((f) => /* @__PURE__ */ jsxs7(
|
|
1756
1881
|
"span",
|
|
1757
1882
|
{
|
|
@@ -2499,7 +2624,7 @@ function TraceIdCopy({ traceId }) {
|
|
|
2499
2624
|
onClick: copy,
|
|
2500
2625
|
title: "Copy trace id",
|
|
2501
2626
|
"aria-label": "Copy trace id",
|
|
2502
|
-
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground
|
|
2627
|
+
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground",
|
|
2503
2628
|
children: [
|
|
2504
2629
|
/* @__PURE__ */ jsx10("span", { className: "truncate", children: traceId }),
|
|
2505
2630
|
/* @__PURE__ */ jsx10(CopyGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
@@ -2686,7 +2811,8 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2686
2811
|
] }),
|
|
2687
2812
|
error && /* @__PURE__ */ jsx10("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
|
|
2688
2813
|
!error && rows.length === 0 && !loading && /* @__PURE__ */ jsx10("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
|
|
2689
|
-
/* @__PURE__ */ jsx10("
|
|
2814
|
+
/* @__PURE__ */ jsx10("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
|
|
2815
|
+
/* @__PURE__ */ jsx10("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record) => /* @__PURE__ */ jsx10(ActivityRow, { record, renderMissionRef }, record.taskId)) }),
|
|
2690
2816
|
cursor && /* @__PURE__ */ jsx10(
|
|
2691
2817
|
"button",
|
|
2692
2818
|
{
|
|
@@ -2700,8 +2826,483 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2700
2826
|
] });
|
|
2701
2827
|
}
|
|
2702
2828
|
|
|
2829
|
+
// src/web-react/provenance.tsx
|
|
2830
|
+
import { useCallback as useCallback7, useEffect as useEffect9, useId, useRef as useRef8, useState as useState12 } from "react";
|
|
2831
|
+
|
|
2832
|
+
// src/web-react/provenance-model.ts
|
|
2833
|
+
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
2834
|
+
var BASIS_META = {
|
|
2835
|
+
extracted: {
|
|
2836
|
+
label: "From document",
|
|
2837
|
+
meaning: "Read out of a source document.",
|
|
2838
|
+
checkableAgainst: "the document it was read from"
|
|
2839
|
+
},
|
|
2840
|
+
entered: {
|
|
2841
|
+
label: "Entered by a person",
|
|
2842
|
+
meaning: "A person typed or confirmed this value.",
|
|
2843
|
+
checkableAgainst: "the person who entered it"
|
|
2844
|
+
},
|
|
2845
|
+
computed: {
|
|
2846
|
+
label: "Computed",
|
|
2847
|
+
meaning: "Produced from other values.",
|
|
2848
|
+
checkableAgainst: "the values it was computed from"
|
|
2849
|
+
},
|
|
2850
|
+
asserted: {
|
|
2851
|
+
label: "Agent, unverified",
|
|
2852
|
+
meaning: "The agent stated this. No source was recorded behind it.",
|
|
2853
|
+
checkableAgainst: null
|
|
2854
|
+
}
|
|
2855
|
+
};
|
|
2856
|
+
function provenanceBasisMeta(basis) {
|
|
2857
|
+
return BASIS_META[basis];
|
|
2858
|
+
}
|
|
2859
|
+
var STANDING_META = {
|
|
2860
|
+
settled: { label: "Traced", action: "Nothing to check \u2014 this value can be traced to where it came from." },
|
|
2861
|
+
check: { label: "Check the source", action: "Open the source and confirm this value before you rely on it." },
|
|
2862
|
+
confirm: { label: "Needs a person", action: "Someone has to confirm this value before it is used." }
|
|
2863
|
+
};
|
|
2864
|
+
function provenanceStandingMeta(standing) {
|
|
2865
|
+
return STANDING_META[standing];
|
|
2866
|
+
}
|
|
2867
|
+
var STANDING_SEVERITY = { settled: 0, check: 1, confirm: 2 };
|
|
2868
|
+
function weakerProvenanceStanding(a, b) {
|
|
2869
|
+
return STANDING_SEVERITY[a] >= STANDING_SEVERITY[b] ? a : b;
|
|
2870
|
+
}
|
|
2871
|
+
var DEFAULT_PROVENANCE_CONFIDENCE_POLICY = {
|
|
2872
|
+
settledAtOrAbove: 0.9,
|
|
2873
|
+
checkAtOrAbove: 0.6
|
|
2874
|
+
};
|
|
2875
|
+
function standingFromConfidence(confidence, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
|
|
2876
|
+
if (confidence >= policy.settledAtOrAbove) return "settled";
|
|
2877
|
+
if (confidence >= policy.checkAtOrAbove) return "check";
|
|
2878
|
+
return "confirm";
|
|
2879
|
+
}
|
|
2880
|
+
function standingFromBasis(basis) {
|
|
2881
|
+
return basis === "asserted" ? "check" : "settled";
|
|
2882
|
+
}
|
|
2883
|
+
function describeProvenanceSourceStatus(source) {
|
|
2884
|
+
if (source.status === "loading") return `Looking up ${source.label}\u2026`;
|
|
2885
|
+
if (source.status === "unavailable") {
|
|
2886
|
+
return source.unavailableReason ? `${source.label} could not be opened \u2014 ${source.unavailableReason}` : `${source.label} could not be opened.`;
|
|
2887
|
+
}
|
|
2888
|
+
return null;
|
|
2889
|
+
}
|
|
2890
|
+
function provenanceGaps(record) {
|
|
2891
|
+
const gaps = [];
|
|
2892
|
+
const sources = record.sources ?? [];
|
|
2893
|
+
if (record.basis === "extracted" && sources.length === 0) {
|
|
2894
|
+
gaps.push({
|
|
2895
|
+
kind: "no-source",
|
|
2896
|
+
message: "Read from a document, but no document is on file \u2014 nothing here shows where this came from."
|
|
2897
|
+
});
|
|
2898
|
+
}
|
|
2899
|
+
if (record.basis === "computed" && (record.inputs ?? []).length === 0) {
|
|
2900
|
+
gaps.push({
|
|
2901
|
+
kind: "no-inputs",
|
|
2902
|
+
message: "Computed, but the values it was computed from are not recorded."
|
|
2903
|
+
});
|
|
2904
|
+
}
|
|
2905
|
+
for (const source of sources) {
|
|
2906
|
+
if (source.status !== "unavailable") continue;
|
|
2907
|
+
gaps.push({
|
|
2908
|
+
kind: "unavailable-source",
|
|
2909
|
+
message: describeProvenanceSourceStatus(source) ?? `${source.label} could not be opened.`,
|
|
2910
|
+
source
|
|
2911
|
+
});
|
|
2912
|
+
}
|
|
2913
|
+
return gaps;
|
|
2914
|
+
}
|
|
2915
|
+
function loadingProvenanceSources(record) {
|
|
2916
|
+
return (record.sources ?? []).filter((source) => source.status === "loading");
|
|
2917
|
+
}
|
|
2918
|
+
function resolveProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
|
|
2919
|
+
let standing = record.standing ?? (record.confidence === void 0 ? standingFromBasis(record.basis) : standingFromConfidence(record.confidence, policy));
|
|
2920
|
+
if (record.basis === "asserted") standing = weakerProvenanceStanding(standing, "check");
|
|
2921
|
+
for (const gap of provenanceGaps(record)) {
|
|
2922
|
+
standing = weakerProvenanceStanding(standing, gap.kind === "unavailable-source" ? "check" : "confirm");
|
|
2923
|
+
}
|
|
2924
|
+
return standing;
|
|
2925
|
+
}
|
|
2926
|
+
function rollUpProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY, seen = /* @__PURE__ */ new Set()) {
|
|
2927
|
+
if (seen.has(record)) return "settled";
|
|
2928
|
+
seen.add(record);
|
|
2929
|
+
let standing = resolveProvenanceStanding(record, policy);
|
|
2930
|
+
for (const input of record.inputs ?? []) {
|
|
2931
|
+
standing = weakerProvenanceStanding(standing, rollUpProvenanceStanding(input, policy, seen));
|
|
2932
|
+
}
|
|
2933
|
+
return standing;
|
|
2934
|
+
}
|
|
2935
|
+
function sourcePhrase(source) {
|
|
2936
|
+
return source.locator ? `${source.label}, ${source.locator}` : source.label;
|
|
2937
|
+
}
|
|
2938
|
+
function inputPhrase(input) {
|
|
2939
|
+
return input.label ?? input.display;
|
|
2940
|
+
}
|
|
2941
|
+
function describeProvenance(record) {
|
|
2942
|
+
const sources = record.sources ?? [];
|
|
2943
|
+
const first = sources[0];
|
|
2944
|
+
const more = sources.length > 1 ? ` and ${sources.length - 1} more source${sources.length > 2 ? "s" : ""}` : "";
|
|
2945
|
+
switch (record.basis) {
|
|
2946
|
+
case "extracted":
|
|
2947
|
+
return first ? `Read from ${sourcePhrase(first)}${more}.` : "Read from a document, but no document is on file.";
|
|
2948
|
+
case "entered":
|
|
2949
|
+
return first ? `Entered by ${sourcePhrase(first)}.` : "Entered by a person.";
|
|
2950
|
+
case "computed": {
|
|
2951
|
+
const inputs = record.inputs ?? [];
|
|
2952
|
+
if (record.derivation) return `Computed from ${record.derivation}.`;
|
|
2953
|
+
if (inputs.length === 0) return "Computed, but the values it was computed from are not recorded.";
|
|
2954
|
+
return `Computed from ${inputs.map(inputPhrase).join(", ")}.`;
|
|
2955
|
+
}
|
|
2956
|
+
case "asserted":
|
|
2957
|
+
return first ? `Stated by the agent, pointing at ${sourcePhrase(first)} \u2014 not verified against it.` : "Stated by the agent, with no source to check it against.";
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
function provenanceNextMove(record, standing, policy = DEFAULT_PROVENANCE_CONFIDENCE_POLICY) {
|
|
2961
|
+
const generic = provenanceStandingMeta(standing).action;
|
|
2962
|
+
if (standing === "settled") return generic;
|
|
2963
|
+
const gaps = provenanceGaps(record);
|
|
2964
|
+
if (gaps.some((gap) => gap.kind === "no-source")) {
|
|
2965
|
+
return "Nobody recorded where this came from. Confirm the value and record its source before it is used.";
|
|
2966
|
+
}
|
|
2967
|
+
if (gaps.some((gap) => gap.kind === "no-inputs")) {
|
|
2968
|
+
return "Nobody recorded what this was computed from. Confirm the value and record its inputs before it is used.";
|
|
2969
|
+
}
|
|
2970
|
+
if (gaps.some((gap) => gap.kind === "unavailable-source")) {
|
|
2971
|
+
return "The source could not be opened. Try again, or confirm this value another way before you rely on it.";
|
|
2972
|
+
}
|
|
2973
|
+
if (record.basis === "asserted" && (record.sources ?? []).length === 0) {
|
|
2974
|
+
return "The agent gave no source. Check this against the real document before you rely on it.";
|
|
2975
|
+
}
|
|
2976
|
+
if (record.basis === "computed" && (record.inputs ?? []).length > 0 && resolveProvenanceStanding(record, policy) === "settled") {
|
|
2977
|
+
return "One of the values this was computed from still needs checking \u2014 open the marked ones below.";
|
|
2978
|
+
}
|
|
2979
|
+
return generic;
|
|
2980
|
+
}
|
|
2981
|
+
function provenanceTriggerLabel(record, standing) {
|
|
2982
|
+
const value = record.display.trim() === "" ? "this missing value" : `\u201C${record.display}\u201D`;
|
|
2983
|
+
const named = record.label ? `${record.label} ${value}` : value;
|
|
2984
|
+
const basis = provenanceBasisMeta(record.basis).label;
|
|
2985
|
+
const next = standing === "settled" ? "" : ` ${provenanceStandingMeta(standing).label}.`;
|
|
2986
|
+
return `Where ${named} came from \u2014 ${basis}.${next}`;
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2989
|
+
// src/web-react/provenance.tsx
|
|
2990
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2991
|
+
var BASIS_TONES = {
|
|
2992
|
+
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
2993
|
+
entered: "border-success/30 bg-success/10 text-success",
|
|
2994
|
+
computed: "border-border bg-muted/50 text-foreground",
|
|
2995
|
+
asserted: "border-warning/40 bg-warning/10 text-warning"
|
|
2996
|
+
};
|
|
2997
|
+
var STANDING_TONES = {
|
|
2998
|
+
settled: "text-muted-foreground",
|
|
2999
|
+
check: "text-warning",
|
|
3000
|
+
confirm: "text-destructive"
|
|
3001
|
+
};
|
|
3002
|
+
function BasisGlyph({ basis, className }) {
|
|
3003
|
+
const shared = {
|
|
3004
|
+
viewBox: "0 0 24 24",
|
|
3005
|
+
fill: "none",
|
|
3006
|
+
stroke: "currentColor",
|
|
3007
|
+
strokeWidth: 2,
|
|
3008
|
+
strokeLinecap: "round",
|
|
3009
|
+
strokeLinejoin: "round",
|
|
3010
|
+
"aria-hidden": true,
|
|
3011
|
+
className
|
|
3012
|
+
};
|
|
3013
|
+
switch (basis) {
|
|
3014
|
+
case "extracted":
|
|
3015
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3016
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
3017
|
+
/* @__PURE__ */ jsx11("polyline", { points: "14 3 14 8 19 8" }),
|
|
3018
|
+
/* @__PURE__ */ jsx11("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
3019
|
+
] });
|
|
3020
|
+
case "entered":
|
|
3021
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3022
|
+
/* @__PURE__ */ jsx11("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
3023
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "7", r: "4" })
|
|
3024
|
+
] });
|
|
3025
|
+
case "computed":
|
|
3026
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3027
|
+
/* @__PURE__ */ jsx11("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
3028
|
+
/* @__PURE__ */ jsx11("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
3029
|
+
/* @__PURE__ */ jsx11("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
3030
|
+
/* @__PURE__ */ jsx11("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
3031
|
+
] });
|
|
3032
|
+
case "asserted":
|
|
3033
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3034
|
+
/* @__PURE__ */ jsx11("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1" }),
|
|
3035
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
3036
|
+
] });
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
var openPanels = /* @__PURE__ */ new Set();
|
|
3040
|
+
function closeTrailsOutside(root) {
|
|
3041
|
+
for (const other of Array.from(openPanels)) {
|
|
3042
|
+
if (root === null || !other.root.contains(root)) other.close();
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
3045
|
+
var DEFAULT_MISSING_VALUE_LABEL = "No value recorded";
|
|
3046
|
+
function SourceRow({
|
|
3047
|
+
source,
|
|
3048
|
+
record,
|
|
3049
|
+
onOpenSource,
|
|
3050
|
+
onRetrySource
|
|
3051
|
+
}) {
|
|
3052
|
+
const status = source.status ?? "ready";
|
|
3053
|
+
const statusLine = describeProvenanceSourceStatus(source);
|
|
3054
|
+
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
3055
|
+
return /* @__PURE__ */ jsxs9("li", { className: "rounded-md border border-border/60 bg-background/40 px-2.5 py-2", children: [
|
|
3056
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
3057
|
+
/* @__PURE__ */ jsx11("span", { className: "text-[13px] font-medium text-foreground", children: source.label }),
|
|
3058
|
+
source.locator && /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-muted-foreground", children: source.locator }),
|
|
3059
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs9(
|
|
3060
|
+
"button",
|
|
3061
|
+
{
|
|
3062
|
+
type: "button",
|
|
3063
|
+
onClick: () => onOpenSource(source, record),
|
|
3064
|
+
className: "rounded px-1 text-[11px] font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3065
|
+
children: [
|
|
3066
|
+
"Open ",
|
|
3067
|
+
source.label
|
|
3068
|
+
]
|
|
3069
|
+
}
|
|
3070
|
+
) : /* @__PURE__ */ jsxs9(
|
|
3071
|
+
"a",
|
|
3072
|
+
{
|
|
3073
|
+
href: source.href,
|
|
3074
|
+
target: "_blank",
|
|
3075
|
+
rel: "noreferrer",
|
|
3076
|
+
className: "rounded px-1 text-[11px] font-medium text-primary underline-offset-2 hover:underline focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3077
|
+
children: [
|
|
3078
|
+
"Open ",
|
|
3079
|
+
source.label
|
|
3080
|
+
]
|
|
3081
|
+
}
|
|
3082
|
+
))
|
|
3083
|
+
] }),
|
|
3084
|
+
source.quote && /* @__PURE__ */ jsxs9("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
3085
|
+
"\u201C",
|
|
3086
|
+
source.quote,
|
|
3087
|
+
"\u201D"
|
|
3088
|
+
] }),
|
|
3089
|
+
statusLine && // `role="status"` and not `alert`: the reader opened this panel, so the
|
|
3090
|
+
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
3091
|
+
// — a spinner alone and a greyed row alone both render as "nothing
|
|
3092
|
+
// here".
|
|
3093
|
+
/* @__PURE__ */ jsxs9(
|
|
3094
|
+
"p",
|
|
3095
|
+
{
|
|
3096
|
+
role: "status",
|
|
3097
|
+
className: `mt-1 text-[11px] ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
3098
|
+
children: [
|
|
3099
|
+
statusLine,
|
|
3100
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx11(
|
|
3101
|
+
"button",
|
|
3102
|
+
{
|
|
3103
|
+
type: "button",
|
|
3104
|
+
onClick: () => onRetrySource(source, record),
|
|
3105
|
+
className: "ml-2 rounded border border-border px-1.5 py-0.5 text-[11px] font-medium text-foreground hover:bg-accent/30 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
3106
|
+
children: "Try again"
|
|
3107
|
+
}
|
|
3108
|
+
)
|
|
3109
|
+
]
|
|
3110
|
+
}
|
|
3111
|
+
)
|
|
3112
|
+
] });
|
|
3113
|
+
}
|
|
3114
|
+
function ProvenanceValue({
|
|
3115
|
+
record,
|
|
3116
|
+
onOpenSource,
|
|
3117
|
+
onRetrySource,
|
|
3118
|
+
confidencePolicy,
|
|
3119
|
+
maxDepth = 2,
|
|
3120
|
+
defaultOpen = false,
|
|
3121
|
+
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
3122
|
+
className
|
|
3123
|
+
}) {
|
|
3124
|
+
const [open, setOpen] = useState12(defaultOpen);
|
|
3125
|
+
const triggerRef = useRef8(null);
|
|
3126
|
+
const rootRef = useRef8(null);
|
|
3127
|
+
const panelId = useId();
|
|
3128
|
+
const standing = rollUpProvenanceStanding(record, confidencePolicy);
|
|
3129
|
+
const basisMeta = provenanceBasisMeta(record.basis);
|
|
3130
|
+
const standingMeta = provenanceStandingMeta(standing);
|
|
3131
|
+
const gaps = provenanceGaps(record);
|
|
3132
|
+
const loading = loadingProvenanceSources(record);
|
|
3133
|
+
const sources = record.sources ?? [];
|
|
3134
|
+
const inputs = record.inputs ?? [];
|
|
3135
|
+
const hasValue = record.display.trim() !== "";
|
|
3136
|
+
const onKeyDown = useCallback7(
|
|
3137
|
+
(event) => {
|
|
3138
|
+
if (event.key !== "Escape" || !open) return;
|
|
3139
|
+
event.stopPropagation();
|
|
3140
|
+
setOpen(false);
|
|
3141
|
+
triggerRef.current?.focus();
|
|
3142
|
+
},
|
|
3143
|
+
[open]
|
|
3144
|
+
);
|
|
3145
|
+
const onToggle = useCallback7(() => {
|
|
3146
|
+
if (!open) closeTrailsOutside(rootRef.current);
|
|
3147
|
+
setOpen(!open);
|
|
3148
|
+
}, [open]);
|
|
3149
|
+
useEffect9(() => {
|
|
3150
|
+
const root = rootRef.current;
|
|
3151
|
+
if (!open || root === null) return;
|
|
3152
|
+
const entry = { root, close: () => setOpen(false) };
|
|
3153
|
+
openPanels.add(entry);
|
|
3154
|
+
const onPointerDown = (event) => {
|
|
3155
|
+
const target = event.target;
|
|
3156
|
+
if (target instanceof Node && root.contains(target)) return;
|
|
3157
|
+
setOpen(false);
|
|
3158
|
+
};
|
|
3159
|
+
document.addEventListener("mousedown", onPointerDown, true);
|
|
3160
|
+
document.addEventListener("touchstart", onPointerDown, true);
|
|
3161
|
+
return () => {
|
|
3162
|
+
openPanels.delete(entry);
|
|
3163
|
+
document.removeEventListener("mousedown", onPointerDown, true);
|
|
3164
|
+
document.removeEventListener("touchstart", onPointerDown, true);
|
|
3165
|
+
};
|
|
3166
|
+
}, [open]);
|
|
3167
|
+
const summary = /* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
3168
|
+
record.label && /* @__PURE__ */ jsx11("span", { className: "text-[11px] text-muted-foreground", children: record.label }),
|
|
3169
|
+
/* @__PURE__ */ jsx11("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
|
|
3170
|
+
] });
|
|
3171
|
+
if (maxDepth <= 0) {
|
|
3172
|
+
return /* @__PURE__ */ jsxs9(
|
|
3173
|
+
"div",
|
|
3174
|
+
{
|
|
3175
|
+
className: `inline-block max-w-full ${className ?? ""}`,
|
|
3176
|
+
"data-provenance-basis": record.basis,
|
|
3177
|
+
"data-provenance-standing": standing,
|
|
3178
|
+
children: [
|
|
3179
|
+
summary,
|
|
3180
|
+
/* @__PURE__ */ jsxs9(
|
|
3181
|
+
"span",
|
|
3182
|
+
{
|
|
3183
|
+
className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${BASIS_TONES[record.basis]}`,
|
|
3184
|
+
children: [
|
|
3185
|
+
/* @__PURE__ */ jsx11(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3186
|
+
basisMeta.label
|
|
3187
|
+
]
|
|
3188
|
+
}
|
|
3189
|
+
),
|
|
3190
|
+
/* @__PURE__ */ jsx11("span", { className: "mt-0.5 block text-[11px] text-muted-foreground", children: describeProvenance(record) })
|
|
3191
|
+
]
|
|
3192
|
+
}
|
|
3193
|
+
);
|
|
3194
|
+
}
|
|
3195
|
+
return /* @__PURE__ */ jsxs9(
|
|
3196
|
+
"div",
|
|
3197
|
+
{
|
|
3198
|
+
ref: rootRef,
|
|
3199
|
+
className: `inline-block max-w-full ${className ?? ""}`,
|
|
3200
|
+
onKeyDown,
|
|
3201
|
+
"data-provenance-basis": record.basis,
|
|
3202
|
+
"data-provenance-standing": standing,
|
|
3203
|
+
children: [
|
|
3204
|
+
/* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
3205
|
+
summary,
|
|
3206
|
+
/* @__PURE__ */ jsxs9(
|
|
3207
|
+
"button",
|
|
3208
|
+
{
|
|
3209
|
+
ref: triggerRef,
|
|
3210
|
+
type: "button",
|
|
3211
|
+
onClick: onToggle,
|
|
3212
|
+
"aria-expanded": open,
|
|
3213
|
+
"aria-controls": panelId,
|
|
3214
|
+
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3215
|
+
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record.basis]}`,
|
|
3216
|
+
children: [
|
|
3217
|
+
/* @__PURE__ */ jsx11(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3218
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, children: basisMeta.label })
|
|
3219
|
+
]
|
|
3220
|
+
}
|
|
3221
|
+
),
|
|
3222
|
+
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
3223
|
+
// someone to open the panel. `aria-hidden` because the trigger's
|
|
3224
|
+
// accessible name already carries it — this is the visual half.
|
|
3225
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: `text-[10px] font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
3226
|
+
] }),
|
|
3227
|
+
open && /* @__PURE__ */ jsxs9(
|
|
3228
|
+
"div",
|
|
3229
|
+
{
|
|
3230
|
+
id: panelId,
|
|
3231
|
+
role: "group",
|
|
3232
|
+
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3233
|
+
className: "mt-1.5 w-full min-w-0 space-y-2 rounded-lg border border-border bg-card px-3 py-2.5 text-left",
|
|
3234
|
+
children: [
|
|
3235
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
3236
|
+
/* @__PURE__ */ jsx11("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
|
|
3237
|
+
/* @__PURE__ */ jsxs9("p", { className: `mt-0.5 text-[11px] leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
3238
|
+
standingMeta.label,
|
|
3239
|
+
" \u2014 ",
|
|
3240
|
+
provenanceNextMove(record, standing, confidencePolicy)
|
|
3241
|
+
] }),
|
|
3242
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs9("p", { className: "mt-0.5 text-[11px] leading-snug text-muted-foreground", children: [
|
|
3243
|
+
basisMeta.meaning,
|
|
3244
|
+
" There is nothing outside the model to check it against."
|
|
3245
|
+
] })
|
|
3246
|
+
] }),
|
|
3247
|
+
sources.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx11(
|
|
3248
|
+
SourceRow,
|
|
3249
|
+
{
|
|
3250
|
+
source,
|
|
3251
|
+
record,
|
|
3252
|
+
onOpenSource,
|
|
3253
|
+
onRetrySource
|
|
3254
|
+
},
|
|
3255
|
+
`${source.label}-${source.locator ?? ""}-${index}`
|
|
3256
|
+
)) }),
|
|
3257
|
+
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
3258
|
+
// An unavailable source already states itself on its own row; a
|
|
3259
|
+
// structural gap has no row to state it, so it gets one here.
|
|
3260
|
+
/* @__PURE__ */ jsx11("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-[11px] leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
3261
|
+
)),
|
|
3262
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx11("p", { role: "status", className: "text-[11px] text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
3263
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "border-t border-border/60 pt-2", children: [
|
|
3264
|
+
/* @__PURE__ */ jsx11("p", { className: "text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
|
|
3265
|
+
/* @__PURE__ */ jsx11("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
3266
|
+
ProvenanceValue,
|
|
3267
|
+
{
|
|
3268
|
+
record: input,
|
|
3269
|
+
onOpenSource,
|
|
3270
|
+
onRetrySource,
|
|
3271
|
+
confidencePolicy,
|
|
3272
|
+
maxDepth: maxDepth - 1,
|
|
3273
|
+
missingValueLabel
|
|
3274
|
+
}
|
|
3275
|
+
) }, `${input.label ?? input.display}-${index}`)) })
|
|
3276
|
+
] })
|
|
3277
|
+
]
|
|
3278
|
+
}
|
|
3279
|
+
)
|
|
3280
|
+
]
|
|
3281
|
+
}
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3284
|
+
function ProvenanceLegend({ bases, className }) {
|
|
3285
|
+
if (bases.length === 0) return null;
|
|
3286
|
+
return /* @__PURE__ */ jsx11("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
3287
|
+
const meta = provenanceBasisMeta(basis);
|
|
3288
|
+
return /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-1.5 text-[11px] text-muted-foreground", children: [
|
|
3289
|
+
/* @__PURE__ */ jsxs9(
|
|
3290
|
+
"span",
|
|
3291
|
+
{
|
|
3292
|
+
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px] font-medium ${BASIS_TONES[basis]}`,
|
|
3293
|
+
children: [
|
|
3294
|
+
/* @__PURE__ */ jsx11(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
3295
|
+
meta.label
|
|
3296
|
+
]
|
|
3297
|
+
}
|
|
3298
|
+
),
|
|
3299
|
+
/* @__PURE__ */ jsx11("span", { children: meta.meaning })
|
|
3300
|
+
] }, basis);
|
|
3301
|
+
}) });
|
|
3302
|
+
}
|
|
3303
|
+
|
|
2703
3304
|
// src/web-react/seat-paywall.tsx
|
|
2704
|
-
import { Fragment as Fragment5, jsx as
|
|
3305
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2705
3306
|
function usd(cents) {
|
|
2706
3307
|
return new Intl.NumberFormat("en-US", {
|
|
2707
3308
|
style: "currency",
|
|
@@ -2711,7 +3312,7 @@ function usd(cents) {
|
|
|
2711
3312
|
}).format(cents / 100);
|
|
2712
3313
|
}
|
|
2713
3314
|
function CheckGlyph3() {
|
|
2714
|
-
return /* @__PURE__ */
|
|
3315
|
+
return /* @__PURE__ */ jsx12(
|
|
2715
3316
|
"svg",
|
|
2716
3317
|
{
|
|
2717
3318
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -2722,14 +3323,14 @@ function CheckGlyph3() {
|
|
|
2722
3323
|
strokeLinecap: "round",
|
|
2723
3324
|
strokeLinejoin: "round",
|
|
2724
3325
|
"aria-hidden": true,
|
|
2725
|
-
children: /* @__PURE__ */
|
|
3326
|
+
children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
|
|
2726
3327
|
}
|
|
2727
3328
|
);
|
|
2728
3329
|
}
|
|
2729
3330
|
function Benefit({ children }) {
|
|
2730
|
-
return /* @__PURE__ */
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
3331
|
+
return /* @__PURE__ */ jsxs10("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
3332
|
+
/* @__PURE__ */ jsx12("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx12(CheckGlyph3, {}) }),
|
|
3333
|
+
/* @__PURE__ */ jsx12("span", { children })
|
|
2733
3334
|
] });
|
|
2734
3335
|
}
|
|
2735
3336
|
function SeatPaywall({
|
|
@@ -2747,46 +3348,46 @@ function SeatPaywall({
|
|
|
2747
3348
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
2748
3349
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
2749
3350
|
const introductory = offer?.introductory ?? null;
|
|
2750
|
-
return /* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
/* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ jsx12("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs10("div", { className: "w-full max-w-md rounded-2xl border border-border bg-card p-8 shadow-sm", children: [
|
|
3352
|
+
/* @__PURE__ */ jsx12("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: product }),
|
|
3353
|
+
/* @__PURE__ */ jsxs10("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
2753
3354
|
"Unlock ",
|
|
2754
3355
|
product
|
|
2755
3356
|
] }),
|
|
2756
|
-
tagline && /* @__PURE__ */
|
|
2757
|
-
introductory ? /* @__PURE__ */
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
/* @__PURE__ */
|
|
3357
|
+
tagline && /* @__PURE__ */ jsx12("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
3358
|
+
introductory ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3359
|
+
/* @__PURE__ */ jsxs10("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3360
|
+
/* @__PURE__ */ jsx12("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
3361
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
2761
3362
|
] }),
|
|
2762
|
-
/* @__PURE__ */
|
|
3363
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
2763
3364
|
"Includes ",
|
|
2764
3365
|
usd(introductory.includedCreditsCents),
|
|
2765
3366
|
" of AI usage in your first month"
|
|
2766
3367
|
] }),
|
|
2767
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
2768
3369
|
"Then ",
|
|
2769
3370
|
recurringPrice,
|
|
2770
3371
|
"/mo \xB7 includes ",
|
|
2771
3372
|
recurringUsage,
|
|
2772
3373
|
"/mo of AI usage"
|
|
2773
3374
|
] })
|
|
2774
|
-
] }) : /* @__PURE__ */
|
|
2775
|
-
/* @__PURE__ */
|
|
2776
|
-
/* @__PURE__ */
|
|
2777
|
-
/* @__PURE__ */
|
|
3375
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3376
|
+
/* @__PURE__ */ jsxs10("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3377
|
+
/* @__PURE__ */ jsx12("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
3378
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
2778
3379
|
] }),
|
|
2779
|
-
/* @__PURE__ */
|
|
3380
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
2780
3381
|
"Includes ",
|
|
2781
3382
|
recurringUsage,
|
|
2782
3383
|
"/mo of AI usage"
|
|
2783
3384
|
] })
|
|
2784
3385
|
] }),
|
|
2785
|
-
/* @__PURE__ */
|
|
3386
|
+
/* @__PURE__ */ jsx12("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
2786
3387
|
`Full access to ${product}`,
|
|
2787
3388
|
`${recurringUsage}/mo of AI usage included`
|
|
2788
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
2789
|
-
/* @__PURE__ */
|
|
3389
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx12(Benefit, { children: benefit }, i)) }),
|
|
3390
|
+
/* @__PURE__ */ jsx12(
|
|
2790
3391
|
"button",
|
|
2791
3392
|
{
|
|
2792
3393
|
type: "button",
|
|
@@ -2796,32 +3397,32 @@ function SeatPaywall({
|
|
|
2796
3397
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? `Unlock ${product}`
|
|
2797
3398
|
}
|
|
2798
3399
|
),
|
|
2799
|
-
footnote && /* @__PURE__ */
|
|
3400
|
+
footnote && /* @__PURE__ */ jsx12("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
2800
3401
|
] }) });
|
|
2801
3402
|
}
|
|
2802
3403
|
|
|
2803
3404
|
// src/web-react/session-history.tsx
|
|
2804
3405
|
import {
|
|
2805
|
-
useCallback as
|
|
2806
|
-
useEffect as
|
|
3406
|
+
useCallback as useCallback8,
|
|
3407
|
+
useEffect as useEffect10,
|
|
2807
3408
|
useMemo as useMemo6,
|
|
2808
|
-
useRef as
|
|
2809
|
-
useState as
|
|
3409
|
+
useRef as useRef9,
|
|
3410
|
+
useState as useState13
|
|
2810
3411
|
} from "react";
|
|
2811
|
-
import { Fragment as Fragment6, jsx as
|
|
3412
|
+
import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2812
3413
|
function rethrowAsync(error) {
|
|
2813
3414
|
queueMicrotask(() => {
|
|
2814
3415
|
throw error;
|
|
2815
3416
|
});
|
|
2816
3417
|
}
|
|
2817
3418
|
function useInfiniteScroll(onLoadMore, { enabled, root, rootMargin = "300px" }) {
|
|
2818
|
-
const [sentinel, setSentinel] =
|
|
2819
|
-
const sentinelRef =
|
|
2820
|
-
const onLoadMoreRef =
|
|
2821
|
-
|
|
3419
|
+
const [sentinel, setSentinel] = useState13(null);
|
|
3420
|
+
const sentinelRef = useCallback8((node) => setSentinel(node), []);
|
|
3421
|
+
const onLoadMoreRef = useRef9(onLoadMore);
|
|
3422
|
+
useEffect10(() => {
|
|
2822
3423
|
onLoadMoreRef.current = onLoadMore;
|
|
2823
3424
|
}, [onLoadMore]);
|
|
2824
|
-
|
|
3425
|
+
useEffect10(() => {
|
|
2825
3426
|
if (!sentinel || !enabled) return;
|
|
2826
3427
|
if (typeof IntersectionObserver === "undefined") return;
|
|
2827
3428
|
const observer = new IntersectionObserver(
|
|
@@ -2850,24 +3451,24 @@ function useSessionHistory({
|
|
|
2850
3451
|
initialPage,
|
|
2851
3452
|
defaultSort = "newest"
|
|
2852
3453
|
}) {
|
|
2853
|
-
const [items, setItems] =
|
|
2854
|
-
const [nextCursor, setNextCursor] =
|
|
2855
|
-
const [phase, setPhase] =
|
|
2856
|
-
const [reloadKey, setReloadKey] =
|
|
2857
|
-
const seqRef =
|
|
2858
|
-
const resetAbortRef =
|
|
2859
|
-
const loadMoreAbortRef =
|
|
2860
|
-
const loadingMoreRef =
|
|
2861
|
-
const lastOpRef =
|
|
2862
|
-
const nextCursorRef =
|
|
3454
|
+
const [items, setItems] = useState13(initialPage.items);
|
|
3455
|
+
const [nextCursor, setNextCursor] = useState13(initialPage.nextCursor ?? null);
|
|
3456
|
+
const [phase, setPhase] = useState13("idle");
|
|
3457
|
+
const [reloadKey, setReloadKey] = useState13(0);
|
|
3458
|
+
const seqRef = useRef9(0);
|
|
3459
|
+
const resetAbortRef = useRef9(null);
|
|
3460
|
+
const loadMoreAbortRef = useRef9(null);
|
|
3461
|
+
const loadingMoreRef = useRef9(false);
|
|
3462
|
+
const lastOpRef = useRef9("first");
|
|
3463
|
+
const nextCursorRef = useRef9(nextCursor);
|
|
2863
3464
|
nextCursorRef.current = nextCursor;
|
|
2864
|
-
const viewRef =
|
|
3465
|
+
const viewRef = useRef9({ q, sort, fetchPage });
|
|
2865
3466
|
viewRef.current = { q, sort, fetchPage };
|
|
2866
|
-
const seedRef =
|
|
3467
|
+
const seedRef = useRef9(initialPage);
|
|
2867
3468
|
seedRef.current = initialPage;
|
|
2868
3469
|
const isDefaultView = q === "" && sort === defaultSort;
|
|
2869
3470
|
const seedKey = useMemo6(() => seedSignature(initialPage), [initialPage]);
|
|
2870
|
-
|
|
3471
|
+
useEffect10(() => {
|
|
2871
3472
|
resetAbortRef.current?.abort();
|
|
2872
3473
|
loadMoreAbortRef.current?.abort();
|
|
2873
3474
|
loadingMoreRef.current = false;
|
|
@@ -2898,7 +3499,7 @@ function useSessionHistory({
|
|
|
2898
3499
|
})();
|
|
2899
3500
|
return () => controller.abort();
|
|
2900
3501
|
}, [q, sort, seedKey, isDefaultView, reloadKey]);
|
|
2901
|
-
const loadMore =
|
|
3502
|
+
const loadMore = useCallback8(() => {
|
|
2902
3503
|
const cursor = nextCursorRef.current;
|
|
2903
3504
|
if (!cursor || loadingMoreRef.current) return;
|
|
2904
3505
|
const { q: currentQ, sort: currentSort, fetchPage: currentFetch } = viewRef.current;
|
|
@@ -2923,14 +3524,14 @@ function useSessionHistory({
|
|
|
2923
3524
|
}
|
|
2924
3525
|
})();
|
|
2925
3526
|
}, []);
|
|
2926
|
-
const retry =
|
|
3527
|
+
const retry = useCallback8(() => {
|
|
2927
3528
|
if (lastOpRef.current === "more") loadMore();
|
|
2928
3529
|
else setReloadKey((key) => key + 1);
|
|
2929
3530
|
}, [loadMore]);
|
|
2930
|
-
const reload =
|
|
3531
|
+
const reload = useCallback8(() => {
|
|
2931
3532
|
setReloadKey((key) => key + 1);
|
|
2932
3533
|
}, []);
|
|
2933
|
-
|
|
3534
|
+
useEffect10(
|
|
2934
3535
|
() => () => {
|
|
2935
3536
|
resetAbortRef.current?.abort();
|
|
2936
3537
|
loadMoreAbortRef.current?.abort();
|
|
@@ -2971,21 +3572,21 @@ function useSessionActions({
|
|
|
2971
3572
|
labels
|
|
2972
3573
|
}) {
|
|
2973
3574
|
const text = { ...DEFAULT_LABELS, ...labels };
|
|
2974
|
-
const [renameTarget, setRenameTarget] =
|
|
2975
|
-
const [renameValue, setRenameValue] =
|
|
2976
|
-
const [deleteTarget, setDeleteTarget] =
|
|
2977
|
-
const [busy, setBusy] =
|
|
2978
|
-
const [error, setError] =
|
|
2979
|
-
const openRename =
|
|
3575
|
+
const [renameTarget, setRenameTarget] = useState13(null);
|
|
3576
|
+
const [renameValue, setRenameValue] = useState13("");
|
|
3577
|
+
const [deleteTarget, setDeleteTarget] = useState13(null);
|
|
3578
|
+
const [busy, setBusy] = useState13(false);
|
|
3579
|
+
const [error, setError] = useState13(null);
|
|
3580
|
+
const openRename = useCallback8((session) => {
|
|
2980
3581
|
setError(null);
|
|
2981
3582
|
setRenameTarget(session);
|
|
2982
3583
|
setRenameValue(session.title ?? "");
|
|
2983
3584
|
}, []);
|
|
2984
|
-
const openDelete =
|
|
3585
|
+
const openDelete = useCallback8((session) => {
|
|
2985
3586
|
setError(null);
|
|
2986
3587
|
setDeleteTarget(session);
|
|
2987
3588
|
}, []);
|
|
2988
|
-
const submitRename =
|
|
3589
|
+
const submitRename = useCallback8(async () => {
|
|
2989
3590
|
if (!renameTarget) return;
|
|
2990
3591
|
const title = renameValue.trim();
|
|
2991
3592
|
if (!title || title === renameTarget.title) {
|
|
@@ -3007,7 +3608,7 @@ function useSessionActions({
|
|
|
3007
3608
|
setBusy(false);
|
|
3008
3609
|
}
|
|
3009
3610
|
}, [renameTarget, renameValue, renameSession, notify, onChanged, text.renamed, text.renameFailed]);
|
|
3010
|
-
const confirmDelete =
|
|
3611
|
+
const confirmDelete = useCallback8(async () => {
|
|
3011
3612
|
if (!deleteTarget) return;
|
|
3012
3613
|
const deletingCurrent = currentSessionId != null && deleteTarget.id === currentSessionId;
|
|
3013
3614
|
setBusy(true);
|
|
@@ -3026,21 +3627,21 @@ function useSessionActions({
|
|
|
3026
3627
|
setBusy(false);
|
|
3027
3628
|
}
|
|
3028
3629
|
}, [deleteTarget, currentSessionId, deleteSession, notify, onChanged, onDeletedCurrent, text.deleted, text.deleteFailed]);
|
|
3029
|
-
const dialogs = /* @__PURE__ */
|
|
3030
|
-
renameTarget && /* @__PURE__ */
|
|
3630
|
+
const dialogs = /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
3631
|
+
renameTarget && /* @__PURE__ */ jsxs11(
|
|
3031
3632
|
SessionDialog,
|
|
3032
3633
|
{
|
|
3033
3634
|
title: text.renameTitle,
|
|
3034
3635
|
onClose: () => setRenameTarget(null),
|
|
3035
3636
|
busy,
|
|
3036
3637
|
error,
|
|
3037
|
-
footer: /* @__PURE__ */
|
|
3038
|
-
/* @__PURE__ */
|
|
3039
|
-
/* @__PURE__ */
|
|
3638
|
+
footer: /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
3639
|
+
/* @__PURE__ */ jsx13(DialogButton, { onClick: () => setRenameTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
3640
|
+
/* @__PURE__ */ jsx13(DialogButton, { onClick: () => void submitRename(), disabled: busy || !renameValue.trim(), children: text.renameSubmit })
|
|
3040
3641
|
] }),
|
|
3041
3642
|
children: [
|
|
3042
|
-
/* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsx13("label", { htmlFor: "agent-app-rename-session", className: "text-xs text-muted-foreground", children: text.renameField }),
|
|
3644
|
+
/* @__PURE__ */ jsx13(
|
|
3044
3645
|
"input",
|
|
3045
3646
|
{
|
|
3046
3647
|
id: "agent-app-rename-session",
|
|
@@ -3053,24 +3654,24 @@ function useSessionActions({
|
|
|
3053
3654
|
void submitRename();
|
|
3054
3655
|
}
|
|
3055
3656
|
},
|
|
3056
|
-
className: "mt-1.5 h-9 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground
|
|
3657
|
+
className: "mt-1.5 h-9 w-full rounded-md border border-border bg-background px-3 text-sm text-foreground"
|
|
3057
3658
|
}
|
|
3058
3659
|
)
|
|
3059
3660
|
]
|
|
3060
3661
|
}
|
|
3061
3662
|
),
|
|
3062
|
-
deleteTarget && /* @__PURE__ */
|
|
3663
|
+
deleteTarget && /* @__PURE__ */ jsx13(
|
|
3063
3664
|
SessionDialog,
|
|
3064
3665
|
{
|
|
3065
3666
|
title: text.deleteTitle,
|
|
3066
3667
|
onClose: () => setDeleteTarget(null),
|
|
3067
3668
|
busy,
|
|
3068
3669
|
error,
|
|
3069
|
-
footer: /* @__PURE__ */
|
|
3070
|
-
/* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3670
|
+
footer: /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
3671
|
+
/* @__PURE__ */ jsx13(DialogButton, { onClick: () => setDeleteTarget(null), disabled: busy, variant: "ghost", children: text.cancel }),
|
|
3672
|
+
/* @__PURE__ */ jsx13(DialogButton, { onClick: () => void confirmDelete(), disabled: busy, variant: "destructive", children: text.deleteSubmit })
|
|
3072
3673
|
] }),
|
|
3073
|
-
children: /* @__PURE__ */
|
|
3674
|
+
children: /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: text.deleteBody(sessionLabel(deleteTarget)) })
|
|
3074
3675
|
}
|
|
3075
3676
|
)
|
|
3076
3677
|
] });
|
|
@@ -3083,7 +3684,7 @@ function DialogButton({
|
|
|
3083
3684
|
variant = "primary"
|
|
3084
3685
|
}) {
|
|
3085
3686
|
const tone = variant === "ghost" ? "text-muted-foreground hover:bg-accent/30 hover:text-foreground" : variant === "destructive" ? "bg-destructive text-destructive-foreground hover:opacity-90" : "bg-primary text-primary-foreground hover:opacity-90";
|
|
3086
|
-
return /* @__PURE__ */
|
|
3687
|
+
return /* @__PURE__ */ jsx13(
|
|
3087
3688
|
"button",
|
|
3088
3689
|
{
|
|
3089
3690
|
type: "button",
|
|
@@ -3102,15 +3703,15 @@ function SessionDialog({
|
|
|
3102
3703
|
busy,
|
|
3103
3704
|
error
|
|
3104
3705
|
}) {
|
|
3105
|
-
|
|
3706
|
+
useEffect10(() => {
|
|
3106
3707
|
const onKey = (e) => {
|
|
3107
3708
|
if (e.key === "Escape" && !busy) onClose();
|
|
3108
3709
|
};
|
|
3109
3710
|
document.addEventListener("keydown", onKey);
|
|
3110
3711
|
return () => document.removeEventListener("keydown", onKey);
|
|
3111
3712
|
}, [busy, onClose]);
|
|
3112
|
-
return /* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3713
|
+
return /* @__PURE__ */ jsxs11("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", children: [
|
|
3714
|
+
/* @__PURE__ */ jsx13(
|
|
3114
3715
|
"div",
|
|
3115
3716
|
{
|
|
3116
3717
|
className: "absolute inset-0 bg-black/50",
|
|
@@ -3120,7 +3721,7 @@ function SessionDialog({
|
|
|
3120
3721
|
"aria-hidden": true
|
|
3121
3722
|
}
|
|
3122
3723
|
),
|
|
3123
|
-
/* @__PURE__ */
|
|
3724
|
+
/* @__PURE__ */ jsxs11(
|
|
3124
3725
|
"div",
|
|
3125
3726
|
{
|
|
3126
3727
|
role: "dialog",
|
|
@@ -3128,17 +3729,17 @@ function SessionDialog({
|
|
|
3128
3729
|
"aria-label": title,
|
|
3129
3730
|
className: "relative w-full max-w-sm rounded-xl border border-border bg-card p-5 shadow-lg",
|
|
3130
3731
|
children: [
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3133
|
-
error && /* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3732
|
+
/* @__PURE__ */ jsx13("h2", { className: "text-sm font-semibold text-foreground", children: title }),
|
|
3733
|
+
/* @__PURE__ */ jsx13("div", { className: "mt-3", children }),
|
|
3734
|
+
error && /* @__PURE__ */ jsx13("p", { role: "alert", className: "mt-3 rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: error }),
|
|
3735
|
+
/* @__PURE__ */ jsx13("div", { className: "mt-5 flex justify-end gap-2", children: footer })
|
|
3135
3736
|
]
|
|
3136
3737
|
}
|
|
3137
3738
|
)
|
|
3138
3739
|
] });
|
|
3139
3740
|
}
|
|
3140
3741
|
function AnchorLink({ to, className, children }) {
|
|
3141
|
-
return /* @__PURE__ */
|
|
3742
|
+
return /* @__PURE__ */ jsx13("a", { href: to, className, children });
|
|
3142
3743
|
}
|
|
3143
3744
|
var MINUTE = 6e4;
|
|
3144
3745
|
var HOUR = 60 * MINUTE;
|
|
@@ -3155,14 +3756,17 @@ function formatSessionTimestamp(isoDate) {
|
|
|
3155
3756
|
return new Date(at).toLocaleDateString(void 0, { month: "short", day: "numeric" });
|
|
3156
3757
|
}
|
|
3157
3758
|
function SkeletonRows() {
|
|
3158
|
-
return /* @__PURE__ */
|
|
3159
|
-
/* @__PURE__ */
|
|
3160
|
-
/* @__PURE__ */
|
|
3161
|
-
|
|
3162
|
-
|
|
3759
|
+
return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
3760
|
+
/* @__PURE__ */ jsx13("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "sr-only", children: "Loading sessions\u2026" }),
|
|
3761
|
+
/* @__PURE__ */ jsx13("div", { className: "flex flex-col gap-0.5", "aria-hidden": true, children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3 px-3 py-2.5", children: [
|
|
3762
|
+
/* @__PURE__ */ jsx13("div", { className: "h-4 w-4 animate-pulse rounded bg-muted" }),
|
|
3763
|
+
/* @__PURE__ */ jsx13("div", { className: "h-4 w-1/2 animate-pulse rounded bg-muted" }),
|
|
3764
|
+
/* @__PURE__ */ jsx13("div", { className: "ml-auto h-3 w-12 animate-pulse rounded bg-muted" })
|
|
3765
|
+
] }, i)) })
|
|
3766
|
+
] });
|
|
3163
3767
|
}
|
|
3164
3768
|
function MessageIcon({ className }) {
|
|
3165
|
-
return /* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 24 24", className, fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx13("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) });
|
|
3166
3770
|
}
|
|
3167
3771
|
function SessionHistoryPanel({
|
|
3168
3772
|
history,
|
|
@@ -3189,7 +3793,7 @@ function SessionHistoryPanel({
|
|
|
3189
3793
|
contentWidth = "reading",
|
|
3190
3794
|
className
|
|
3191
3795
|
}) {
|
|
3192
|
-
const scrollRef =
|
|
3796
|
+
const scrollRef = useRef9(null);
|
|
3193
3797
|
const sentinelRef = useInfiniteScroll(history.loadMore, {
|
|
3194
3798
|
enabled: history.hasMore && !history.isLoadingMore && !history.isError,
|
|
3195
3799
|
root: scrollRef,
|
|
@@ -3198,15 +3802,15 @@ function SessionHistoryPanel({
|
|
|
3198
3802
|
const searchTerm = query.trim();
|
|
3199
3803
|
const isSearching = searchTerm.length > 0;
|
|
3200
3804
|
const column = contentWidth === "full" ? "w-full" : "mx-auto w-full max-w-4xl";
|
|
3201
|
-
const [selectedIds, setSelectedIds] =
|
|
3202
|
-
const [ageDays, setAgeDays] =
|
|
3203
|
-
const [bulkTarget, setBulkTarget] =
|
|
3204
|
-
const [bulkBusy, setBulkBusy] =
|
|
3205
|
-
const [bulkError, setBulkError] =
|
|
3206
|
-
|
|
3805
|
+
const [selectedIds, setSelectedIds] = useState13(/* @__PURE__ */ new Set());
|
|
3806
|
+
const [ageDays, setAgeDays] = useState13("30");
|
|
3807
|
+
const [bulkTarget, setBulkTarget] = useState13(null);
|
|
3808
|
+
const [bulkBusy, setBulkBusy] = useState13(false);
|
|
3809
|
+
const [bulkError, setBulkError] = useState13(null);
|
|
3810
|
+
useEffect10(() => {
|
|
3207
3811
|
setSelectedIds(/* @__PURE__ */ new Set());
|
|
3208
3812
|
}, [searchTerm, sort]);
|
|
3209
|
-
|
|
3813
|
+
useEffect10(() => {
|
|
3210
3814
|
const visible = new Set(history.items.map((item) => item.id));
|
|
3211
3815
|
setSelectedIds((current) => {
|
|
3212
3816
|
const next = new Set([...current].filter((id) => visible.has(id)));
|
|
@@ -3217,7 +3821,7 @@ function SessionHistoryPanel({
|
|
|
3217
3821
|
const allVisibleSelected = history.items.length > 0 && history.items.every((item) => selectedIds.has(item.id));
|
|
3218
3822
|
const parsedAgeDays = Number(ageDays);
|
|
3219
3823
|
const validAgeDays = Number.isInteger(parsedAgeDays) && parsedAgeDays >= 1 && parsedAgeDays <= 36500;
|
|
3220
|
-
const openBulkAction =
|
|
3824
|
+
const openBulkAction = useCallback8((action) => {
|
|
3221
3825
|
const verb = deleteLabel.toLowerCase();
|
|
3222
3826
|
if (action.kind === "selected") {
|
|
3223
3827
|
setBulkTarget({
|
|
@@ -3234,7 +3838,7 @@ function SessionHistoryPanel({
|
|
|
3234
3838
|
body: "This applies to every matching session in this workspace, including sessions not currently loaded in this list."
|
|
3235
3839
|
});
|
|
3236
3840
|
}, [deleteLabel]);
|
|
3237
|
-
const confirmBulkAction =
|
|
3841
|
+
const confirmBulkAction = useCallback8(async () => {
|
|
3238
3842
|
if (!bulkTarget || !onBulkAction) return;
|
|
3239
3843
|
setBulkBusy(true);
|
|
3240
3844
|
setBulkError(null);
|
|
@@ -3249,25 +3853,25 @@ function SessionHistoryPanel({
|
|
|
3249
3853
|
setBulkBusy(false);
|
|
3250
3854
|
}
|
|
3251
3855
|
}, [bulkTarget, deleteLabel, history, onBulkAction]);
|
|
3252
|
-
return /* @__PURE__ */
|
|
3253
|
-
/* @__PURE__ */
|
|
3254
|
-
/* @__PURE__ */
|
|
3255
|
-
newSessionHref && /* @__PURE__ */
|
|
3856
|
+
return /* @__PURE__ */ jsxs11("div", { className: `flex min-h-0 min-w-0 flex-1 flex-col ${className ?? ""}`, children: [
|
|
3857
|
+
/* @__PURE__ */ jsx13("header", { className: "flex h-14 shrink-0 items-center border-b border-border px-4 sm:px-6", children: /* @__PURE__ */ jsxs11("div", { className: `flex items-center gap-3 px-3 ${column}`, children: [
|
|
3858
|
+
/* @__PURE__ */ jsx13("h1", { className: "flex-1 truncate text-sm font-semibold text-foreground", children: title }),
|
|
3859
|
+
newSessionHref && /* @__PURE__ */ jsxs11(
|
|
3256
3860
|
Link,
|
|
3257
3861
|
{
|
|
3258
3862
|
to: newSessionHref,
|
|
3259
3863
|
className: "inline-flex h-8 shrink-0 items-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition hover:opacity-90",
|
|
3260
3864
|
children: [
|
|
3261
|
-
/* @__PURE__ */
|
|
3865
|
+
/* @__PURE__ */ jsx13("span", { "aria-hidden": true, className: "text-sm leading-none", children: "+" }),
|
|
3262
3866
|
"New chat"
|
|
3263
3867
|
]
|
|
3264
3868
|
}
|
|
3265
3869
|
)
|
|
3266
3870
|
] }) }),
|
|
3267
|
-
/* @__PURE__ */
|
|
3268
|
-
hasAnySessions && /* @__PURE__ */
|
|
3269
|
-
/* @__PURE__ */
|
|
3270
|
-
/* @__PURE__ */
|
|
3871
|
+
/* @__PURE__ */ jsxs11("div", { ref: scrollRef, className: "min-h-0 flex-1 overflow-y-auto", children: [
|
|
3872
|
+
hasAnySessions && /* @__PURE__ */ jsxs11("div", { className: "sticky top-0 z-10 bg-background px-4 sm:px-6", children: [
|
|
3873
|
+
/* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 px-3 pb-3 pt-4 sm:flex-row sm:items-center sm:gap-3 ${column}`, children: [
|
|
3874
|
+
/* @__PURE__ */ jsx13(
|
|
3271
3875
|
"input",
|
|
3272
3876
|
{
|
|
3273
3877
|
type: "search",
|
|
@@ -3275,26 +3879,26 @@ function SessionHistoryPanel({
|
|
|
3275
3879
|
onChange: (e) => onQueryChange(e.target.value),
|
|
3276
3880
|
placeholder: "Search your sessions\u2026",
|
|
3277
3881
|
"aria-label": "Search sessions",
|
|
3278
|
-
className: "h-9 min-w-0 appearance-none rounded-md border border-border bg-card px-3 text-sm text-foreground
|
|
3882
|
+
className: "h-9 min-w-0 appearance-none rounded-md border border-border bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground sm:flex-1 [&::-webkit-search-cancel-button]:appearance-none"
|
|
3279
3883
|
}
|
|
3280
3884
|
),
|
|
3281
|
-
/* @__PURE__ */
|
|
3885
|
+
/* @__PURE__ */ jsxs11(
|
|
3282
3886
|
"select",
|
|
3283
3887
|
{
|
|
3284
3888
|
value: sort,
|
|
3285
3889
|
onChange: (e) => onSortChange(e.target.value),
|
|
3286
3890
|
"aria-label": "Sort sessions",
|
|
3287
|
-
className: "h-9 shrink-0 appearance-none rounded-md border border-border bg-card px-2 text-sm text-foreground
|
|
3891
|
+
className: "h-9 shrink-0 appearance-none rounded-md border border-border bg-card px-2 text-sm text-foreground sm:w-[132px]",
|
|
3288
3892
|
children: [
|
|
3289
|
-
/* @__PURE__ */
|
|
3290
|
-
/* @__PURE__ */
|
|
3893
|
+
/* @__PURE__ */ jsx13("option", { value: "newest", children: "Newest" }),
|
|
3894
|
+
/* @__PURE__ */ jsx13("option", { value: "oldest", children: "Oldest" })
|
|
3291
3895
|
]
|
|
3292
3896
|
}
|
|
3293
3897
|
)
|
|
3294
3898
|
] }),
|
|
3295
|
-
onBulkAction && /* @__PURE__ */
|
|
3296
|
-
/* @__PURE__ */
|
|
3297
|
-
/* @__PURE__ */
|
|
3899
|
+
onBulkAction && /* @__PURE__ */ jsxs11("div", { className: `flex flex-col gap-2 border-t border-border/60 px-3 py-3 ${column}`, children: [
|
|
3900
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3901
|
+
/* @__PURE__ */ jsx13(
|
|
3298
3902
|
"button",
|
|
3299
3903
|
{
|
|
3300
3904
|
type: "button",
|
|
@@ -3304,7 +3908,7 @@ function SessionHistoryPanel({
|
|
|
3304
3908
|
children: "Select all"
|
|
3305
3909
|
}
|
|
3306
3910
|
),
|
|
3307
|
-
/* @__PURE__ */
|
|
3911
|
+
/* @__PURE__ */ jsx13(
|
|
3308
3912
|
"button",
|
|
3309
3913
|
{
|
|
3310
3914
|
type: "button",
|
|
@@ -3314,11 +3918,11 @@ function SessionHistoryPanel({
|
|
|
3314
3918
|
children: "Deselect all"
|
|
3315
3919
|
}
|
|
3316
3920
|
),
|
|
3317
|
-
/* @__PURE__ */
|
|
3921
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-xs text-muted-foreground", "aria-live": "polite", children: [
|
|
3318
3922
|
selectedCount,
|
|
3319
3923
|
" selected"
|
|
3320
3924
|
] }),
|
|
3321
|
-
selectedCount > 0 && /* @__PURE__ */
|
|
3925
|
+
selectedCount > 0 && /* @__PURE__ */ jsxs11(
|
|
3322
3926
|
"button",
|
|
3323
3927
|
{
|
|
3324
3928
|
type: "button",
|
|
@@ -3331,9 +3935,9 @@ function SessionHistoryPanel({
|
|
|
3331
3935
|
}
|
|
3332
3936
|
)
|
|
3333
3937
|
] }),
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3336
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
3939
|
+
/* @__PURE__ */ jsx13("label", { htmlFor: "agent-app-session-age", className: "text-xs text-muted-foreground", children: "Session age" }),
|
|
3940
|
+
/* @__PURE__ */ jsx13(
|
|
3337
3941
|
"input",
|
|
3338
3942
|
{
|
|
3339
3943
|
id: "agent-app-session-age",
|
|
@@ -3343,11 +3947,11 @@ function SessionHistoryPanel({
|
|
|
3343
3947
|
value: ageDays,
|
|
3344
3948
|
onChange: (event) => setAgeDays(event.target.value),
|
|
3345
3949
|
"aria-invalid": ageDays.length > 0 && !validAgeDays,
|
|
3346
|
-
className: "h-8 w-20 rounded-md border border-border bg-card px-2 text-xs tabular-nums text-foreground
|
|
3950
|
+
className: "h-8 w-20 rounded-md border border-border bg-card px-2 text-xs tabular-nums text-foreground"
|
|
3347
3951
|
}
|
|
3348
3952
|
),
|
|
3349
|
-
/* @__PURE__ */
|
|
3350
|
-
/* @__PURE__ */
|
|
3953
|
+
/* @__PURE__ */ jsx13("span", { className: "text-xs text-muted-foreground", children: "days" }),
|
|
3954
|
+
/* @__PURE__ */ jsxs11(
|
|
3351
3955
|
"button",
|
|
3352
3956
|
{
|
|
3353
3957
|
type: "button",
|
|
@@ -3360,7 +3964,7 @@ function SessionHistoryPanel({
|
|
|
3360
3964
|
]
|
|
3361
3965
|
}
|
|
3362
3966
|
),
|
|
3363
|
-
/* @__PURE__ */
|
|
3967
|
+
/* @__PURE__ */ jsxs11(
|
|
3364
3968
|
"button",
|
|
3365
3969
|
{
|
|
3366
3970
|
type: "button",
|
|
@@ -3376,15 +3980,15 @@ function SessionHistoryPanel({
|
|
|
3376
3980
|
] })
|
|
3377
3981
|
] })
|
|
3378
3982
|
] }),
|
|
3379
|
-
/* @__PURE__ */
|
|
3380
|
-
/* @__PURE__ */
|
|
3381
|
-
/* @__PURE__ */
|
|
3382
|
-
] }) : history.isLoadingFirst ? /* @__PURE__ */
|
|
3983
|
+
/* @__PURE__ */ jsx13("div", { className: `px-4 pb-8 pt-1 sm:px-6 ${column}`, children: !hasAnySessions ? /* @__PURE__ */ jsxs11("div", { className: "flex min-h-[50vh] flex-col items-center justify-center gap-2 text-center", children: [
|
|
3984
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-foreground", children: emptyTitle }),
|
|
3985
|
+
/* @__PURE__ */ jsx13("p", { className: "max-w-xs text-xs text-muted-foreground", children: emptyDescription })
|
|
3986
|
+
] }) : history.isLoadingFirst ? /* @__PURE__ */ jsx13(SkeletonRows, {}) : history.items.length === 0 ? history.isError ? /* @__PURE__ */ jsx13(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load your sessions." }) : isSearching ? /* @__PURE__ */ jsxs11("p", { className: "py-16 text-center text-sm text-muted-foreground", children: [
|
|
3383
3987
|
"No sessions match \u201C",
|
|
3384
3988
|
searchTerm,
|
|
3385
3989
|
"\u201D."
|
|
3386
|
-
] }) : /* @__PURE__ */
|
|
3387
|
-
history.items.map((session) => /* @__PURE__ */
|
|
3990
|
+
] }) : /* @__PURE__ */ jsx13("p", { className: "py-16 text-center text-sm text-muted-foreground", children: "No sessions remain." }) : /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-0.5", children: [
|
|
3991
|
+
history.items.map((session) => /* @__PURE__ */ jsx13(
|
|
3388
3992
|
SessionRow,
|
|
3389
3993
|
{
|
|
3390
3994
|
session,
|
|
@@ -3411,10 +4015,10 @@ function SessionHistoryPanel({
|
|
|
3411
4015
|
},
|
|
3412
4016
|
session.id
|
|
3413
4017
|
)),
|
|
3414
|
-
history.isError ? /* @__PURE__ */
|
|
4018
|
+
history.isError ? /* @__PURE__ */ jsx13(ErrorBlock, { onRetry: history.retry, message: "Couldn\u2019t load more sessions.", inline: true }) : history.hasMore ? /* @__PURE__ */ jsx13("div", { ref: sentinelRef, className: "flex items-center justify-center py-6", children: history.isLoadingMore && /* @__PURE__ */ jsx13("span", { role: "status", "aria-live": "polite", "aria-busy": true, className: "text-xs text-muted-foreground", children: "Loading\u2026" }) }) : null
|
|
3415
4019
|
] }) })
|
|
3416
4020
|
] }),
|
|
3417
|
-
bulkTarget && /* @__PURE__ */
|
|
4021
|
+
bulkTarget && /* @__PURE__ */ jsx13(
|
|
3418
4022
|
SessionDialog,
|
|
3419
4023
|
{
|
|
3420
4024
|
title: bulkTarget.title,
|
|
@@ -3426,8 +4030,8 @@ function SessionHistoryPanel({
|
|
|
3426
4030
|
},
|
|
3427
4031
|
busy: bulkBusy,
|
|
3428
4032
|
error: bulkError,
|
|
3429
|
-
footer: /* @__PURE__ */
|
|
3430
|
-
/* @__PURE__ */
|
|
4033
|
+
footer: /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4034
|
+
/* @__PURE__ */ jsx13(
|
|
3431
4035
|
DialogButton,
|
|
3432
4036
|
{
|
|
3433
4037
|
onClick: () => {
|
|
@@ -3439,21 +4043,21 @@ function SessionHistoryPanel({
|
|
|
3439
4043
|
children: "Cancel"
|
|
3440
4044
|
}
|
|
3441
4045
|
),
|
|
3442
|
-
/* @__PURE__ */
|
|
4046
|
+
/* @__PURE__ */ jsx13(DialogButton, { onClick: () => void confirmBulkAction(), disabled: bulkBusy, variant: "destructive", children: bulkBusy ? "Working\u2026" : deleteLabel })
|
|
3443
4047
|
] }),
|
|
3444
|
-
children: /* @__PURE__ */
|
|
4048
|
+
children: /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground", children: bulkTarget.body })
|
|
3445
4049
|
}
|
|
3446
4050
|
)
|
|
3447
4051
|
] });
|
|
3448
4052
|
}
|
|
3449
4053
|
function ErrorBlock({ message, onRetry, inline }) {
|
|
3450
|
-
return /* @__PURE__ */
|
|
4054
|
+
return /* @__PURE__ */ jsxs11(
|
|
3451
4055
|
"div",
|
|
3452
4056
|
{
|
|
3453
4057
|
className: inline ? "flex items-center justify-center gap-3 py-6 text-sm text-muted-foreground" : "flex min-h-[40vh] flex-col items-center justify-center gap-3 text-center",
|
|
3454
4058
|
children: [
|
|
3455
|
-
/* @__PURE__ */
|
|
3456
|
-
/* @__PURE__ */
|
|
4059
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: message }),
|
|
4060
|
+
/* @__PURE__ */ jsx13(
|
|
3457
4061
|
"button",
|
|
3458
4062
|
{
|
|
3459
4063
|
type: "button",
|
|
@@ -3482,12 +4086,12 @@ function SessionRow({
|
|
|
3482
4086
|
selected,
|
|
3483
4087
|
onSelectedChange
|
|
3484
4088
|
}) {
|
|
3485
|
-
const [menuOpen, setMenuOpen] =
|
|
4089
|
+
const [menuOpen, setMenuOpen] = useState13(false);
|
|
3486
4090
|
const extras = extraActions?.(session) ?? [];
|
|
3487
4091
|
const hasMenu = Boolean(onRename) || Boolean(onDelete) || extras.length > 0;
|
|
3488
4092
|
const showUnread = Boolean(session.unread) && !responding;
|
|
3489
|
-
return /* @__PURE__ */
|
|
3490
|
-
selectable && /* @__PURE__ */
|
|
4093
|
+
return /* @__PURE__ */ jsxs11("div", { className: "group relative flex items-center gap-2 rounded-lg px-3 py-2.5 transition-colors hover:bg-accent/20", children: [
|
|
4094
|
+
selectable && /* @__PURE__ */ jsx13(
|
|
3491
4095
|
"input",
|
|
3492
4096
|
{
|
|
3493
4097
|
type: "checkbox",
|
|
@@ -3497,10 +4101,10 @@ function SessionRow({
|
|
|
3497
4101
|
className: "h-4 w-4 shrink-0 rounded border-border accent-primary"
|
|
3498
4102
|
}
|
|
3499
4103
|
),
|
|
3500
|
-
/* @__PURE__ */
|
|
3501
|
-
showUnread && /* @__PURE__ */
|
|
3502
|
-
/* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
4104
|
+
/* @__PURE__ */ jsxs11(Link, { to: href, className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
4105
|
+
showUnread && /* @__PURE__ */ jsx13("span", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-primary", "aria-hidden": true }),
|
|
4106
|
+
/* @__PURE__ */ jsx13(MessageIcon, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
4107
|
+
/* @__PURE__ */ jsx13(
|
|
3504
4108
|
"span",
|
|
3505
4109
|
{
|
|
3506
4110
|
className: `truncate text-sm ${responding ? "text-muted-foreground" : "text-foreground"} ${showUnread ? "font-semibold" : ""}`,
|
|
@@ -3509,9 +4113,9 @@ function SessionRow({
|
|
|
3509
4113
|
}
|
|
3510
4114
|
)
|
|
3511
4115
|
] }),
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
hasMenu && /* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */
|
|
4116
|
+
/* @__PURE__ */ jsx13("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: timestamp }),
|
|
4117
|
+
hasMenu && /* @__PURE__ */ jsxs11("div", { className: "relative shrink-0", children: [
|
|
4118
|
+
/* @__PURE__ */ jsx13(
|
|
3515
4119
|
"button",
|
|
3516
4120
|
{
|
|
3517
4121
|
type: "button",
|
|
@@ -3519,13 +4123,13 @@ function SessionRow({
|
|
|
3519
4123
|
"aria-expanded": menuOpen,
|
|
3520
4124
|
onClick: () => setMenuOpen((open) => !open),
|
|
3521
4125
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition hover:bg-muted hover:text-foreground focus-visible:opacity-100 sm:opacity-0 sm:group-hover:opacity-100 aria-expanded:opacity-100",
|
|
3522
|
-
children: /* @__PURE__ */
|
|
4126
|
+
children: /* @__PURE__ */ jsx13("span", { "aria-hidden": true, className: "text-base leading-none", children: "\u22EF" })
|
|
3523
4127
|
}
|
|
3524
4128
|
),
|
|
3525
|
-
menuOpen && /* @__PURE__ */
|
|
3526
|
-
/* @__PURE__ */
|
|
3527
|
-
/* @__PURE__ */
|
|
3528
|
-
onRename && /* @__PURE__ */
|
|
4129
|
+
menuOpen && /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4130
|
+
/* @__PURE__ */ jsx13("div", { className: "fixed inset-0 z-20", onClick: () => setMenuOpen(false), "aria-hidden": true }),
|
|
4131
|
+
/* @__PURE__ */ jsxs11("div", { className: "absolute right-0 z-30 mt-1 w-36 overflow-hidden rounded-md border border-border bg-card py-1 shadow-lg", children: [
|
|
4132
|
+
onRename && /* @__PURE__ */ jsx13(
|
|
3529
4133
|
"button",
|
|
3530
4134
|
{
|
|
3531
4135
|
type: "button",
|
|
@@ -3537,7 +4141,7 @@ function SessionRow({
|
|
|
3537
4141
|
children: renameLabel
|
|
3538
4142
|
}
|
|
3539
4143
|
),
|
|
3540
|
-
extras.map((action) => /* @__PURE__ */
|
|
4144
|
+
extras.map((action) => /* @__PURE__ */ jsx13(
|
|
3541
4145
|
"button",
|
|
3542
4146
|
{
|
|
3543
4147
|
type: "button",
|
|
@@ -3550,7 +4154,7 @@ function SessionRow({
|
|
|
3550
4154
|
},
|
|
3551
4155
|
action.id
|
|
3552
4156
|
)),
|
|
3553
|
-
onDelete && /* @__PURE__ */
|
|
4157
|
+
onDelete && /* @__PURE__ */ jsx13(
|
|
3554
4158
|
"button",
|
|
3555
4159
|
{
|
|
3556
4160
|
type: "button",
|
|
@@ -3571,12 +4175,12 @@ function SessionRow({
|
|
|
3571
4175
|
// src/web-react/record-grid.tsx
|
|
3572
4176
|
import {
|
|
3573
4177
|
Fragment as Fragment7,
|
|
3574
|
-
useCallback as
|
|
3575
|
-
useEffect as
|
|
3576
|
-
useId,
|
|
4178
|
+
useCallback as useCallback9,
|
|
4179
|
+
useEffect as useEffect11,
|
|
4180
|
+
useId as useId2,
|
|
3577
4181
|
useMemo as useMemo7,
|
|
3578
|
-
useRef as
|
|
3579
|
-
useState as
|
|
4182
|
+
useRef as useRef10,
|
|
4183
|
+
useState as useState14
|
|
3580
4184
|
} from "react";
|
|
3581
4185
|
|
|
3582
4186
|
// src/web-react/record-grid-model.ts
|
|
@@ -3906,7 +4510,7 @@ function pruneRecordGridOverlay(rows, overlay) {
|
|
|
3906
4510
|
}
|
|
3907
4511
|
|
|
3908
4512
|
// src/web-react/record-grid.tsx
|
|
3909
|
-
import { jsx as
|
|
4513
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3910
4514
|
var CELL_KEY_SEPARATOR = "\0";
|
|
3911
4515
|
function cellKey(rowId, columnId) {
|
|
3912
4516
|
return `${rowId}${CELL_KEY_SEPARATOR}${columnId}`;
|
|
@@ -3932,7 +4536,7 @@ function groupColumns(columns) {
|
|
|
3932
4536
|
return groups;
|
|
3933
4537
|
}
|
|
3934
4538
|
var INPUT_CLASS = "w-full rounded-md border border-border bg-background px-2 py-1 text-sm text-foreground outline-none focus:border-primary/60 focus:ring-1 focus:ring-primary/40";
|
|
3935
|
-
var
|
|
4539
|
+
var BASIS_TONES2 = {
|
|
3936
4540
|
source: "border-primary/60 text-primary",
|
|
3937
4541
|
confirmed: "border-success/60 text-success",
|
|
3938
4542
|
derived: "border-border text-muted-foreground"
|
|
@@ -3960,29 +4564,29 @@ function RecordGrid({
|
|
|
3960
4564
|
loadingRowCount = 3,
|
|
3961
4565
|
className
|
|
3962
4566
|
}) {
|
|
3963
|
-
const fieldPrefix =
|
|
3964
|
-
const [overlay, setOverlay] =
|
|
3965
|
-
const [editing, setEditingState] =
|
|
3966
|
-
const [cellErrors, setCellErrors] =
|
|
3967
|
-
const [rowErrors, setRowErrors] =
|
|
3968
|
-
const [pendingRows, setPendingRows] =
|
|
3969
|
-
const [focus, setFocus] =
|
|
3970
|
-
const [openSource, setOpenSource] =
|
|
3971
|
-
const [confirmDelete, setConfirmDelete] =
|
|
3972
|
-
const [adding, setAdding] =
|
|
3973
|
-
const [draft, setDraft] =
|
|
3974
|
-
const [draftErrors, setDraftErrors] =
|
|
3975
|
-
const [draftError, setDraftError] =
|
|
3976
|
-
const [creating, setCreating] =
|
|
3977
|
-
const cellRefs =
|
|
3978
|
-
const settling =
|
|
3979
|
-
const draftCounter =
|
|
3980
|
-
const editingRef =
|
|
3981
|
-
const setEditing =
|
|
4567
|
+
const fieldPrefix = useId2();
|
|
4568
|
+
const [overlay, setOverlay] = useState14(EMPTY_RECORD_GRID_OVERLAY);
|
|
4569
|
+
const [editing, setEditingState] = useState14(null);
|
|
4570
|
+
const [cellErrors, setCellErrors] = useState14({});
|
|
4571
|
+
const [rowErrors, setRowErrors] = useState14({});
|
|
4572
|
+
const [pendingRows, setPendingRows] = useState14({});
|
|
4573
|
+
const [focus, setFocus] = useState14(null);
|
|
4574
|
+
const [openSource, setOpenSource] = useState14(null);
|
|
4575
|
+
const [confirmDelete, setConfirmDelete] = useState14(null);
|
|
4576
|
+
const [adding, setAdding] = useState14(false);
|
|
4577
|
+
const [draft, setDraft] = useState14({ ...newRowDefaults ?? {} });
|
|
4578
|
+
const [draftErrors, setDraftErrors] = useState14({});
|
|
4579
|
+
const [draftError, setDraftError] = useState14(null);
|
|
4580
|
+
const [creating, setCreating] = useState14(false);
|
|
4581
|
+
const cellRefs = useRef10(/* @__PURE__ */ new Map());
|
|
4582
|
+
const settling = useRef10(false);
|
|
4583
|
+
const draftCounter = useRef10(0);
|
|
4584
|
+
const editingRef = useRef10(null);
|
|
4585
|
+
const setEditing = useCallback9((next) => {
|
|
3982
4586
|
editingRef.current = next;
|
|
3983
4587
|
setEditingState(next);
|
|
3984
4588
|
}, []);
|
|
3985
|
-
|
|
4589
|
+
useEffect11(() => {
|
|
3986
4590
|
setOverlay((current) => pruneRecordGridOverlay(rows, current));
|
|
3987
4591
|
}, [rows]);
|
|
3988
4592
|
const visibleRows = useMemo7(() => projectRecordGridRows(rows, overlay), [rows, overlay]);
|
|
@@ -3992,7 +4596,7 @@ function RecordGrid({
|
|
|
3992
4596
|
if (!columns.some((column) => column.id === focus.columnId)) return null;
|
|
3993
4597
|
return focus;
|
|
3994
4598
|
}, [columns, focus, visibleRows]);
|
|
3995
|
-
const setCellError =
|
|
4599
|
+
const setCellError = useCallback9((key, message) => {
|
|
3996
4600
|
setCellErrors((current) => {
|
|
3997
4601
|
if (message === null) {
|
|
3998
4602
|
if (!(key in current)) return current;
|
|
@@ -4004,7 +4608,7 @@ function RecordGrid({
|
|
|
4004
4608
|
return { ...current, [key]: message };
|
|
4005
4609
|
});
|
|
4006
4610
|
}, []);
|
|
4007
|
-
const setRowError =
|
|
4611
|
+
const setRowError = useCallback9((rowId, message) => {
|
|
4008
4612
|
setRowErrors((current) => {
|
|
4009
4613
|
if (message === null) {
|
|
4010
4614
|
if (!(rowId in current)) return current;
|
|
@@ -4015,7 +4619,7 @@ function RecordGrid({
|
|
|
4015
4619
|
return { ...current, [rowId]: message };
|
|
4016
4620
|
});
|
|
4017
4621
|
}, []);
|
|
4018
|
-
const setRowPending =
|
|
4622
|
+
const setRowPending = useCallback9((rowId, pending) => {
|
|
4019
4623
|
setPendingRows((current) => {
|
|
4020
4624
|
if (pending) return rowId in current ? current : { ...current, [rowId]: true };
|
|
4021
4625
|
if (!(rowId in current)) return current;
|
|
@@ -4024,11 +4628,11 @@ function RecordGrid({
|
|
|
4024
4628
|
return next;
|
|
4025
4629
|
});
|
|
4026
4630
|
}, []);
|
|
4027
|
-
const focusCell =
|
|
4631
|
+
const focusCell = useCallback9((rowId, columnId) => {
|
|
4028
4632
|
setFocus({ rowId, columnId });
|
|
4029
4633
|
cellRefs.current.get(cellKey(rowId, columnId))?.focus();
|
|
4030
4634
|
}, []);
|
|
4031
|
-
const beginEdit =
|
|
4635
|
+
const beginEdit = useCallback9(
|
|
4032
4636
|
(row, column) => {
|
|
4033
4637
|
setCellError(cellKey(row.id, column.id), null);
|
|
4034
4638
|
setEditing({
|
|
@@ -4039,7 +4643,7 @@ function RecordGrid({
|
|
|
4039
4643
|
},
|
|
4040
4644
|
[setCellError, setEditing]
|
|
4041
4645
|
);
|
|
4042
|
-
const applyCellWrite =
|
|
4646
|
+
const applyCellWrite = useCallback9(
|
|
4043
4647
|
async (row, column, value) => {
|
|
4044
4648
|
if (!onUpdate) return;
|
|
4045
4649
|
const values = { ...row.values, [column.id]: value };
|
|
@@ -4067,7 +4671,7 @@ function RecordGrid({
|
|
|
4067
4671
|
},
|
|
4068
4672
|
[locale, onUpdate, setRowError, setRowPending]
|
|
4069
4673
|
);
|
|
4070
|
-
const commitEdit =
|
|
4674
|
+
const commitEdit = useCallback9(
|
|
4071
4675
|
async (row, column, text) => {
|
|
4072
4676
|
const open = editingRef.current;
|
|
4073
4677
|
if (open === null || open.rowId !== row.id || open.columnId !== column.id) return;
|
|
@@ -4091,7 +4695,7 @@ function RecordGrid({
|
|
|
4091
4695
|
},
|
|
4092
4696
|
[applyCellWrite, setCellError, setEditing]
|
|
4093
4697
|
);
|
|
4094
|
-
const cancelEdit =
|
|
4698
|
+
const cancelEdit = useCallback9(
|
|
4095
4699
|
(row, column) => {
|
|
4096
4700
|
setCellError(cellKey(row.id, column.id), null);
|
|
4097
4701
|
setEditing(null);
|
|
@@ -4099,7 +4703,7 @@ function RecordGrid({
|
|
|
4099
4703
|
},
|
|
4100
4704
|
[focusCell, setCellError, setEditing]
|
|
4101
4705
|
);
|
|
4102
|
-
const performDelete =
|
|
4706
|
+
const performDelete = useCallback9(
|
|
4103
4707
|
async (row) => {
|
|
4104
4708
|
if (!onDelete) return;
|
|
4105
4709
|
setConfirmDelete(null);
|
|
@@ -4117,16 +4721,16 @@ function RecordGrid({
|
|
|
4117
4721
|
},
|
|
4118
4722
|
[columns, onDelete, setRowError]
|
|
4119
4723
|
);
|
|
4120
|
-
const resetDraft =
|
|
4724
|
+
const resetDraft = useCallback9(() => {
|
|
4121
4725
|
setDraft({ ...newRowDefaults ?? {} });
|
|
4122
4726
|
setDraftErrors({});
|
|
4123
4727
|
setDraftError(null);
|
|
4124
4728
|
}, [newRowDefaults]);
|
|
4125
|
-
const openAdd =
|
|
4729
|
+
const openAdd = useCallback9(() => {
|
|
4126
4730
|
resetDraft();
|
|
4127
4731
|
setAdding(true);
|
|
4128
4732
|
}, [resetDraft]);
|
|
4129
|
-
const submitDraft =
|
|
4733
|
+
const submitDraft = useCallback9(async () => {
|
|
4130
4734
|
if (!onCreate) return;
|
|
4131
4735
|
const validated = validateRecordGridRow(columns, draft);
|
|
4132
4736
|
if (!validated.succeeded) {
|
|
@@ -4156,7 +4760,7 @@ function RecordGrid({
|
|
|
4156
4760
|
setOverlay((current) => withoutRecordGridCreated(current, draftId));
|
|
4157
4761
|
setDraftError(outcome.error);
|
|
4158
4762
|
}, [columns, draft, fieldPrefix, onCreate, resetDraft]);
|
|
4159
|
-
const handleGridKeyDown =
|
|
4763
|
+
const handleGridKeyDown = useCallback9(
|
|
4160
4764
|
(event) => {
|
|
4161
4765
|
if (editing !== null) return;
|
|
4162
4766
|
const target = event.target;
|
|
@@ -4196,9 +4800,9 @@ function RecordGrid({
|
|
|
4196
4800
|
);
|
|
4197
4801
|
const dataState = typeof error === "string" && error !== "" ? "error" : state;
|
|
4198
4802
|
if (dataState === "loading") {
|
|
4199
|
-
return /* @__PURE__ */
|
|
4803
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4200
4804
|
toolbar,
|
|
4201
|
-
/* @__PURE__ */
|
|
4805
|
+
/* @__PURE__ */ jsxs12(
|
|
4202
4806
|
"div",
|
|
4203
4807
|
{
|
|
4204
4808
|
role: "status",
|
|
@@ -4206,22 +4810,22 @@ function RecordGrid({
|
|
|
4206
4810
|
"aria-live": "polite",
|
|
4207
4811
|
className: "space-y-2 rounded-xl border border-border bg-card p-4",
|
|
4208
4812
|
children: [
|
|
4209
|
-
/* @__PURE__ */
|
|
4813
|
+
/* @__PURE__ */ jsxs12("span", { className: "sr-only", children: [
|
|
4210
4814
|
"Loading ",
|
|
4211
4815
|
caption
|
|
4212
4816
|
] }),
|
|
4213
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
4817
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx14("div", { className: "h-8 animate-pulse rounded-md bg-muted/50", "aria-hidden": true }, index))
|
|
4214
4818
|
]
|
|
4215
4819
|
}
|
|
4216
4820
|
)
|
|
4217
4821
|
] });
|
|
4218
4822
|
}
|
|
4219
4823
|
if (dataState === "error") {
|
|
4220
|
-
return /* @__PURE__ */
|
|
4824
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4221
4825
|
toolbar,
|
|
4222
|
-
/* @__PURE__ */
|
|
4223
|
-
/* @__PURE__ */
|
|
4224
|
-
onRetry && /* @__PURE__ */
|
|
4826
|
+
/* @__PURE__ */ jsxs12("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
4827
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-destructive", children: typeof error === "string" && error !== "" ? error : `${caption} could not be loaded.` }),
|
|
4828
|
+
onRetry && /* @__PURE__ */ jsx14(
|
|
4225
4829
|
"button",
|
|
4226
4830
|
{
|
|
4227
4831
|
type: "button",
|
|
@@ -4233,7 +4837,7 @@ function RecordGrid({
|
|
|
4233
4837
|
] })
|
|
4234
4838
|
] });
|
|
4235
4839
|
}
|
|
4236
|
-
const addForm = adding && onCreate ? /* @__PURE__ */
|
|
4840
|
+
const addForm = adding && onCreate ? /* @__PURE__ */ jsx14(
|
|
4237
4841
|
AddRecordForm,
|
|
4238
4842
|
{
|
|
4239
4843
|
columns,
|
|
@@ -4252,14 +4856,14 @@ function RecordGrid({
|
|
|
4252
4856
|
}
|
|
4253
4857
|
) : null;
|
|
4254
4858
|
if (visibleRows.length === 0) {
|
|
4255
|
-
return /* @__PURE__ */
|
|
4859
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4256
4860
|
toolbar,
|
|
4257
|
-
addForm ?? /* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */
|
|
4259
|
-
empty.description && /* @__PURE__ */
|
|
4260
|
-
/* @__PURE__ */
|
|
4861
|
+
addForm ?? /* @__PURE__ */ jsxs12("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
|
|
4862
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
|
|
4863
|
+
empty.description && /* @__PURE__ */ jsx14("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
|
|
4864
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
|
|
4261
4865
|
empty.action,
|
|
4262
|
-
onCreate && /* @__PURE__ */
|
|
4866
|
+
onCreate && /* @__PURE__ */ jsx14(
|
|
4263
4867
|
"button",
|
|
4264
4868
|
{
|
|
4265
4869
|
type: "button",
|
|
@@ -4274,9 +4878,9 @@ function RecordGrid({
|
|
|
4274
4878
|
}
|
|
4275
4879
|
const hasFooter = columns.some((column) => column.footerValue !== void 0);
|
|
4276
4880
|
const columnSpan = columns.length + (onDelete ? 1 : 0);
|
|
4277
|
-
return /* @__PURE__ */
|
|
4881
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4278
4882
|
toolbar,
|
|
4279
|
-
/* @__PURE__ */
|
|
4883
|
+
/* @__PURE__ */ jsx14("div", { className: "overflow-x-auto rounded-xl border border-border bg-card", children: /* @__PURE__ */ jsxs12(
|
|
4280
4884
|
"table",
|
|
4281
4885
|
{
|
|
4282
4886
|
role: "grid",
|
|
@@ -4284,8 +4888,8 @@ function RecordGrid({
|
|
|
4284
4888
|
className: "w-full border-collapse text-left text-sm",
|
|
4285
4889
|
onKeyDown: handleGridKeyDown,
|
|
4286
4890
|
children: [
|
|
4287
|
-
/* @__PURE__ */
|
|
4288
|
-
columns.map((column) => /* @__PURE__ */
|
|
4891
|
+
/* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsxs12("tr", { role: "row", className: "border-b border-border text-[11px] uppercase tracking-wide text-muted-foreground", children: [
|
|
4892
|
+
columns.map((column) => /* @__PURE__ */ jsx14(
|
|
4289
4893
|
"th",
|
|
4290
4894
|
{
|
|
4291
4895
|
role: "columnheader",
|
|
@@ -4295,14 +4899,14 @@ function RecordGrid({
|
|
|
4295
4899
|
},
|
|
4296
4900
|
column.id
|
|
4297
4901
|
)),
|
|
4298
|
-
onDelete && /* @__PURE__ */
|
|
4902
|
+
onDelete && /* @__PURE__ */ jsx14("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx14("span", { className: "sr-only", children: "Row actions" }) })
|
|
4299
4903
|
] }) }),
|
|
4300
|
-
/* @__PURE__ */
|
|
4904
|
+
/* @__PURE__ */ jsx14("tbody", { children: visibleRows.map((row) => {
|
|
4301
4905
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
4302
4906
|
const pending = row.id in pendingRows;
|
|
4303
4907
|
const rowError = rowErrors[row.id];
|
|
4304
|
-
return /* @__PURE__ */
|
|
4305
|
-
/* @__PURE__ */
|
|
4908
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4909
|
+
/* @__PURE__ */ jsxs12("tr", { role: "row", "aria-busy": pending, className: `border-b border-border/50 ${pending ? "opacity-60" : ""}`, children: [
|
|
4306
4910
|
columns.map((column) => {
|
|
4307
4911
|
const key = cellKey(row.id, column.id);
|
|
4308
4912
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
@@ -4314,8 +4918,8 @@ function RecordGrid({
|
|
|
4314
4918
|
const source = row.sources?.[column.id];
|
|
4315
4919
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
4316
4920
|
if (isEditing && editable) {
|
|
4317
|
-
return /* @__PURE__ */
|
|
4318
|
-
/* @__PURE__ */
|
|
4921
|
+
return /* @__PURE__ */ jsxs12("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
4922
|
+
/* @__PURE__ */ jsx14(
|
|
4319
4923
|
CellEditor,
|
|
4320
4924
|
{
|
|
4321
4925
|
column,
|
|
@@ -4328,11 +4932,11 @@ function RecordGrid({
|
|
|
4328
4932
|
onCancel: () => cancelEdit(row, column)
|
|
4329
4933
|
}
|
|
4330
4934
|
),
|
|
4331
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
4935
|
+
cellError !== void 0 && /* @__PURE__ */ jsx14("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] leading-snug text-destructive", children: cellError })
|
|
4332
4936
|
] }, column.id);
|
|
4333
4937
|
}
|
|
4334
4938
|
if (column.kind === "boolean" && editable) {
|
|
4335
|
-
return /* @__PURE__ */
|
|
4939
|
+
return /* @__PURE__ */ jsx14("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx14(
|
|
4336
4940
|
"input",
|
|
4337
4941
|
{
|
|
4338
4942
|
type: "checkbox",
|
|
@@ -4351,7 +4955,7 @@ function RecordGrid({
|
|
|
4351
4955
|
) }, column.id);
|
|
4352
4956
|
}
|
|
4353
4957
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
4354
|
-
return /* @__PURE__ */
|
|
4958
|
+
return /* @__PURE__ */ jsx14(
|
|
4355
4959
|
"td",
|
|
4356
4960
|
{
|
|
4357
4961
|
role: "gridcell",
|
|
@@ -4369,9 +4973,9 @@ function RecordGrid({
|
|
|
4369
4973
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
4370
4974
|
column
|
|
4371
4975
|
)} ${editable ? "cursor-text" : ""}`,
|
|
4372
|
-
children: /* @__PURE__ */
|
|
4373
|
-
/* @__PURE__ */
|
|
4374
|
-
source && /* @__PURE__ */
|
|
4976
|
+
children: /* @__PURE__ */ jsxs12("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4977
|
+
/* @__PURE__ */ jsx14("span", { className: display === "" ? "text-muted-foreground" : "truncate text-foreground", children: display === "" ? applicable ? "\u2014" : "n/a" : display }),
|
|
4978
|
+
source && /* @__PURE__ */ jsx14(
|
|
4375
4979
|
SourceMarker,
|
|
4376
4980
|
{
|
|
4377
4981
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -4387,8 +4991,8 @@ function RecordGrid({
|
|
|
4387
4991
|
column.id
|
|
4388
4992
|
);
|
|
4389
4993
|
}),
|
|
4390
|
-
onDelete && /* @__PURE__ */
|
|
4391
|
-
/* @__PURE__ */
|
|
4994
|
+
onDelete && /* @__PURE__ */ jsx14("td", { role: "gridcell", className: "px-3 py-2 text-right", children: row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4995
|
+
/* @__PURE__ */ jsx14(
|
|
4392
4996
|
"button",
|
|
4393
4997
|
{
|
|
4394
4998
|
type: "button",
|
|
@@ -4398,7 +5002,7 @@ function RecordGrid({
|
|
|
4398
5002
|
children: "Delete"
|
|
4399
5003
|
}
|
|
4400
5004
|
),
|
|
4401
|
-
/* @__PURE__ */
|
|
5005
|
+
/* @__PURE__ */ jsx14(
|
|
4402
5006
|
"button",
|
|
4403
5007
|
{
|
|
4404
5008
|
type: "button",
|
|
@@ -4408,14 +5012,14 @@ function RecordGrid({
|
|
|
4408
5012
|
children: "Cancel"
|
|
4409
5013
|
}
|
|
4410
5014
|
)
|
|
4411
|
-
] }) : /* @__PURE__ */
|
|
5015
|
+
] }) : /* @__PURE__ */ jsx14(
|
|
4412
5016
|
"button",
|
|
4413
5017
|
{
|
|
4414
5018
|
type: "button",
|
|
4415
5019
|
"aria-label": `Delete ${rowLabel}`,
|
|
4416
5020
|
onClick: () => setConfirmDelete(row.id),
|
|
4417
5021
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
4418
|
-
children: /* @__PURE__ */
|
|
5022
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4419
5023
|
"svg",
|
|
4420
5024
|
{
|
|
4421
5025
|
viewBox: "0 0 24 24",
|
|
@@ -4427,19 +5031,19 @@ function RecordGrid({
|
|
|
4427
5031
|
strokeLinejoin: "round",
|
|
4428
5032
|
"aria-hidden": true,
|
|
4429
5033
|
children: [
|
|
4430
|
-
/* @__PURE__ */
|
|
4431
|
-
/* @__PURE__ */
|
|
5034
|
+
/* @__PURE__ */ jsx14("polyline", { points: "3 6 5 6 21 6" }),
|
|
5035
|
+
/* @__PURE__ */ jsx14("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
4432
5036
|
]
|
|
4433
5037
|
}
|
|
4434
5038
|
)
|
|
4435
5039
|
}
|
|
4436
5040
|
) })
|
|
4437
5041
|
] }),
|
|
4438
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
5042
|
+
rowError !== void 0 && /* @__PURE__ */ jsx14("tr", { role: "row", className: "border-b border-border/50", children: /* @__PURE__ */ jsx14("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx14("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
4439
5043
|
] }, row.id);
|
|
4440
5044
|
}) }),
|
|
4441
|
-
hasFooter && /* @__PURE__ */
|
|
4442
|
-
columns.map((column) => /* @__PURE__ */
|
|
5045
|
+
hasFooter && /* @__PURE__ */ jsx14("tfoot", { children: /* @__PURE__ */ jsxs12("tr", { role: "row", className: "border-t-2 border-border", children: [
|
|
5046
|
+
columns.map((column) => /* @__PURE__ */ jsx14(
|
|
4443
5047
|
"td",
|
|
4444
5048
|
{
|
|
4445
5049
|
role: "gridcell",
|
|
@@ -4448,19 +5052,19 @@ function RecordGrid({
|
|
|
4448
5052
|
},
|
|
4449
5053
|
column.id
|
|
4450
5054
|
)),
|
|
4451
|
-
onDelete && /* @__PURE__ */
|
|
5055
|
+
onDelete && /* @__PURE__ */ jsx14("td", { role: "gridcell" })
|
|
4452
5056
|
] }) })
|
|
4453
5057
|
]
|
|
4454
5058
|
}
|
|
4455
5059
|
) }),
|
|
4456
|
-
onCreate && (addForm ?? /* @__PURE__ */
|
|
5060
|
+
onCreate && (addForm ?? /* @__PURE__ */ jsxs12(
|
|
4457
5061
|
"button",
|
|
4458
5062
|
{
|
|
4459
5063
|
type: "button",
|
|
4460
5064
|
onClick: openAdd,
|
|
4461
5065
|
className: "inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30",
|
|
4462
5066
|
children: [
|
|
4463
|
-
/* @__PURE__ */
|
|
5067
|
+
/* @__PURE__ */ jsxs12(
|
|
4464
5068
|
"svg",
|
|
4465
5069
|
{
|
|
4466
5070
|
viewBox: "0 0 24 24",
|
|
@@ -4472,8 +5076,8 @@ function RecordGrid({
|
|
|
4472
5076
|
strokeLinejoin: "round",
|
|
4473
5077
|
"aria-hidden": true,
|
|
4474
5078
|
children: [
|
|
4475
|
-
/* @__PURE__ */
|
|
4476
|
-
/* @__PURE__ */
|
|
5079
|
+
/* @__PURE__ */ jsx14("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
5080
|
+
/* @__PURE__ */ jsx14("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
4477
5081
|
]
|
|
4478
5082
|
}
|
|
4479
5083
|
),
|
|
@@ -4492,7 +5096,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4492
5096
|
className: INPUT_CLASS
|
|
4493
5097
|
};
|
|
4494
5098
|
if (column.kind === "select") {
|
|
4495
|
-
return /* @__PURE__ */
|
|
5099
|
+
return /* @__PURE__ */ jsxs12(
|
|
4496
5100
|
"select",
|
|
4497
5101
|
{
|
|
4498
5102
|
...shared,
|
|
@@ -4509,8 +5113,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4509
5113
|
},
|
|
4510
5114
|
onBlur: () => onCommit(text),
|
|
4511
5115
|
children: [
|
|
4512
|
-
/* @__PURE__ */
|
|
4513
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5116
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
5117
|
+
column.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option.value, children: option.label }, option.value))
|
|
4514
5118
|
]
|
|
4515
5119
|
}
|
|
4516
5120
|
);
|
|
@@ -4528,7 +5132,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4528
5132
|
}
|
|
4529
5133
|
};
|
|
4530
5134
|
if (column.kind === "text" && column.multiline === true) {
|
|
4531
|
-
return /* @__PURE__ */
|
|
5135
|
+
return /* @__PURE__ */ jsx14(
|
|
4532
5136
|
"textarea",
|
|
4533
5137
|
{
|
|
4534
5138
|
...shared,
|
|
@@ -4540,7 +5144,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4540
5144
|
}
|
|
4541
5145
|
);
|
|
4542
5146
|
}
|
|
4543
|
-
return /* @__PURE__ */
|
|
5147
|
+
return /* @__PURE__ */ jsx14(
|
|
4544
5148
|
"input",
|
|
4545
5149
|
{
|
|
4546
5150
|
...shared,
|
|
@@ -4555,8 +5159,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4555
5159
|
}
|
|
4556
5160
|
function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle }) {
|
|
4557
5161
|
const basis = source.basis ?? "source";
|
|
4558
|
-
return /* @__PURE__ */
|
|
4559
|
-
/* @__PURE__ */
|
|
5162
|
+
return /* @__PURE__ */ jsxs12("span", { className: "relative inline-flex", children: [
|
|
5163
|
+
/* @__PURE__ */ jsx14(
|
|
4560
5164
|
"button",
|
|
4561
5165
|
{
|
|
4562
5166
|
type: "button",
|
|
@@ -4568,8 +5172,8 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4568
5172
|
event.stopPropagation();
|
|
4569
5173
|
onToggle();
|
|
4570
5174
|
},
|
|
4571
|
-
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${
|
|
4572
|
-
children: /* @__PURE__ */
|
|
5175
|
+
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
5176
|
+
children: /* @__PURE__ */ jsx14(
|
|
4573
5177
|
"svg",
|
|
4574
5178
|
{
|
|
4575
5179
|
viewBox: "0 0 24 24",
|
|
@@ -4579,29 +5183,29 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4579
5183
|
strokeWidth: "2.5",
|
|
4580
5184
|
strokeLinecap: "round",
|
|
4581
5185
|
"aria-hidden": true,
|
|
4582
|
-
children: /* @__PURE__ */
|
|
5186
|
+
children: /* @__PURE__ */ jsx14("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
4583
5187
|
}
|
|
4584
5188
|
)
|
|
4585
5189
|
}
|
|
4586
5190
|
),
|
|
4587
|
-
open && /* @__PURE__ */
|
|
5191
|
+
open && /* @__PURE__ */ jsxs12(
|
|
4588
5192
|
"span",
|
|
4589
5193
|
{
|
|
4590
5194
|
id: panelId,
|
|
4591
5195
|
role: "note",
|
|
4592
5196
|
className: "absolute left-0 top-5 z-10 w-64 rounded-lg border border-border bg-card p-3 text-left shadow-lg",
|
|
4593
5197
|
children: [
|
|
4594
|
-
source.quote && /* @__PURE__ */
|
|
5198
|
+
source.quote && /* @__PURE__ */ jsxs12("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
4595
5199
|
"\u201C",
|
|
4596
5200
|
source.quote,
|
|
4597
5201
|
"\u201D"
|
|
4598
5202
|
] }),
|
|
4599
|
-
/* @__PURE__ */
|
|
5203
|
+
/* @__PURE__ */ jsxs12("span", { className: "mt-2 block text-[11px] text-muted-foreground", children: [
|
|
4600
5204
|
source.label ?? "Source",
|
|
4601
5205
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
4602
5206
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
4603
5207
|
] }),
|
|
4604
|
-
source.href && /* @__PURE__ */
|
|
5208
|
+
source.href && /* @__PURE__ */ jsx14(
|
|
4605
5209
|
"a",
|
|
4606
5210
|
{
|
|
4607
5211
|
href: source.href,
|
|
@@ -4630,7 +5234,7 @@ function AddRecordForm({
|
|
|
4630
5234
|
onCancel
|
|
4631
5235
|
}) {
|
|
4632
5236
|
const groups = useMemo7(() => groupColumns(columns), [columns]);
|
|
4633
|
-
return /* @__PURE__ */
|
|
5237
|
+
return /* @__PURE__ */ jsxs12(
|
|
4634
5238
|
"form",
|
|
4635
5239
|
{
|
|
4636
5240
|
noValidate: true,
|
|
@@ -4641,31 +5245,31 @@ function AddRecordForm({
|
|
|
4641
5245
|
},
|
|
4642
5246
|
className: "space-y-4 rounded-xl border border-border bg-card p-4",
|
|
4643
5247
|
children: [
|
|
4644
|
-
/* @__PURE__ */
|
|
4645
|
-
formError !== null && /* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ jsx14("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
5249
|
+
formError !== null && /* @__PURE__ */ jsx14("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
4646
5250
|
groups.map((group) => {
|
|
4647
5251
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
4648
5252
|
if (fields.length === 0) return null;
|
|
4649
|
-
return /* @__PURE__ */
|
|
5253
|
+
return /* @__PURE__ */ jsxs12(
|
|
4650
5254
|
"fieldset",
|
|
4651
5255
|
{
|
|
4652
5256
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-border/70 p-3",
|
|
4653
5257
|
children: [
|
|
4654
|
-
group.label !== null && /* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
5258
|
+
group.label !== null && /* @__PURE__ */ jsx14("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
5259
|
+
/* @__PURE__ */ jsx14("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
4656
5260
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
4657
5261
|
const errorId = `${fieldId}-error`;
|
|
4658
5262
|
const message = errors[column.id];
|
|
4659
|
-
return /* @__PURE__ */
|
|
5263
|
+
return /* @__PURE__ */ jsxs12(
|
|
4660
5264
|
"div",
|
|
4661
5265
|
{
|
|
4662
5266
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
4663
5267
|
children: [
|
|
4664
|
-
/* @__PURE__ */
|
|
5268
|
+
/* @__PURE__ */ jsxs12("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
4665
5269
|
column.header,
|
|
4666
|
-
column.required === true && /* @__PURE__ */
|
|
5270
|
+
column.required === true && /* @__PURE__ */ jsx14("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
4667
5271
|
] }),
|
|
4668
|
-
/* @__PURE__ */
|
|
5272
|
+
/* @__PURE__ */ jsx14(
|
|
4669
5273
|
DraftField,
|
|
4670
5274
|
{
|
|
4671
5275
|
column,
|
|
@@ -4676,8 +5280,8 @@ function AddRecordForm({
|
|
|
4676
5280
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
4677
5281
|
}
|
|
4678
5282
|
),
|
|
4679
|
-
column.hint && /* @__PURE__ */
|
|
4680
|
-
message !== void 0 && /* @__PURE__ */
|
|
5283
|
+
column.hint && /* @__PURE__ */ jsx14("p", { className: "mt-1 text-[11px] text-muted-foreground", children: column.hint }),
|
|
5284
|
+
message !== void 0 && /* @__PURE__ */ jsx14("p", { id: errorId, role: "alert", className: "mt-1 text-[11px] text-destructive", children: message })
|
|
4681
5285
|
]
|
|
4682
5286
|
},
|
|
4683
5287
|
column.id
|
|
@@ -4688,8 +5292,8 @@ function AddRecordForm({
|
|
|
4688
5292
|
group.label ?? "_"
|
|
4689
5293
|
);
|
|
4690
5294
|
}),
|
|
4691
|
-
/* @__PURE__ */
|
|
4692
|
-
/* @__PURE__ */
|
|
5295
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
5296
|
+
/* @__PURE__ */ jsx14(
|
|
4693
5297
|
"button",
|
|
4694
5298
|
{
|
|
4695
5299
|
type: "submit",
|
|
@@ -4698,7 +5302,7 @@ function AddRecordForm({
|
|
|
4698
5302
|
children: busy ? "Saving\u2026" : "Save"
|
|
4699
5303
|
}
|
|
4700
5304
|
),
|
|
4701
|
-
/* @__PURE__ */
|
|
5305
|
+
/* @__PURE__ */ jsx14(
|
|
4702
5306
|
"button",
|
|
4703
5307
|
{
|
|
4704
5308
|
type: "button",
|
|
@@ -4719,7 +5323,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4719
5323
|
"aria-describedby": describedBy
|
|
4720
5324
|
};
|
|
4721
5325
|
if (column.kind === "boolean") {
|
|
4722
|
-
return /* @__PURE__ */
|
|
5326
|
+
return /* @__PURE__ */ jsx14(
|
|
4723
5327
|
"input",
|
|
4724
5328
|
{
|
|
4725
5329
|
...shared,
|
|
@@ -4731,7 +5335,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4731
5335
|
);
|
|
4732
5336
|
}
|
|
4733
5337
|
if (column.kind === "select") {
|
|
4734
|
-
return /* @__PURE__ */
|
|
5338
|
+
return /* @__PURE__ */ jsxs12(
|
|
4735
5339
|
"select",
|
|
4736
5340
|
{
|
|
4737
5341
|
...shared,
|
|
@@ -4739,14 +5343,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4739
5343
|
value: typeof value === "string" ? value : "",
|
|
4740
5344
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
4741
5345
|
children: [
|
|
4742
|
-
/* @__PURE__ */
|
|
4743
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5346
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
5347
|
+
column.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option.value, children: option.label }, option.value))
|
|
4744
5348
|
]
|
|
4745
5349
|
}
|
|
4746
5350
|
);
|
|
4747
5351
|
}
|
|
4748
5352
|
if (column.kind === "text" && column.multiline === true) {
|
|
4749
|
-
return /* @__PURE__ */
|
|
5353
|
+
return /* @__PURE__ */ jsx14(
|
|
4750
5354
|
"textarea",
|
|
4751
5355
|
{
|
|
4752
5356
|
...shared,
|
|
@@ -4758,7 +5362,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4758
5362
|
);
|
|
4759
5363
|
}
|
|
4760
5364
|
if (column.kind === "number" || column.kind === "currency") {
|
|
4761
|
-
return /* @__PURE__ */
|
|
5365
|
+
return /* @__PURE__ */ jsx14(
|
|
4762
5366
|
"input",
|
|
4763
5367
|
{
|
|
4764
5368
|
...shared,
|
|
@@ -4778,7 +5382,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4778
5382
|
}
|
|
4779
5383
|
);
|
|
4780
5384
|
}
|
|
4781
|
-
return /* @__PURE__ */
|
|
5385
|
+
return /* @__PURE__ */ jsx14(
|
|
4782
5386
|
"input",
|
|
4783
5387
|
{
|
|
4784
5388
|
...shared,
|
|
@@ -4791,8 +5395,8 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4791
5395
|
}
|
|
4792
5396
|
|
|
4793
5397
|
// src/web-react/agent-session-controls.tsx
|
|
4794
|
-
import { useMemo as useMemo8, useState as
|
|
4795
|
-
import { jsx as
|
|
5398
|
+
import { useMemo as useMemo8, useState as useState15 } from "react";
|
|
5399
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4796
5400
|
var HARNESS_LABELS = {
|
|
4797
5401
|
opencode: "OpenCode (any model)",
|
|
4798
5402
|
"claude-code": "Claude Code (Anthropic)",
|
|
@@ -4812,25 +5416,25 @@ function harnessLabel(h) {
|
|
|
4812
5416
|
return HARNESS_LABELS[h] ?? h;
|
|
4813
5417
|
}
|
|
4814
5418
|
function ChevronDown2({ className }) {
|
|
4815
|
-
return /* @__PURE__ */
|
|
5419
|
+
return /* @__PURE__ */ jsx15("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx15("path", { d: "m6 9 6 6 6-6" }) });
|
|
4816
5420
|
}
|
|
4817
5421
|
function GearGlyph({ className }) {
|
|
4818
|
-
return /* @__PURE__ */
|
|
4819
|
-
/* @__PURE__ */
|
|
4820
|
-
/* @__PURE__ */
|
|
5422
|
+
return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5423
|
+
/* @__PURE__ */ jsx15("circle", { cx: "12", cy: "12", r: "3" }),
|
|
5424
|
+
/* @__PURE__ */ jsx15("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z" })
|
|
4821
5425
|
] });
|
|
4822
5426
|
}
|
|
4823
|
-
var FOCUS_RING = "
|
|
5427
|
+
var FOCUS_RING = "";
|
|
4824
5428
|
function HarnessPicker({
|
|
4825
5429
|
value,
|
|
4826
5430
|
onChange,
|
|
4827
5431
|
available
|
|
4828
5432
|
}) {
|
|
4829
|
-
const [open, setOpen] =
|
|
5433
|
+
const [open, setOpen] = useState15(false);
|
|
4830
5434
|
const { containerRef, triggerProps } = usePopover(open, setOpen);
|
|
4831
5435
|
const options = available ?? Object.keys(HARNESS_LABELS);
|
|
4832
|
-
return /* @__PURE__ */
|
|
4833
|
-
/* @__PURE__ */
|
|
5436
|
+
return /* @__PURE__ */ jsxs13("div", { ref: containerRef, className: "relative inline-flex", children: [
|
|
5437
|
+
/* @__PURE__ */ jsxs13(
|
|
4834
5438
|
"button",
|
|
4835
5439
|
{
|
|
4836
5440
|
type: "button",
|
|
@@ -4839,12 +5443,12 @@ function HarnessPicker({
|
|
|
4839
5443
|
title: "Agent backend",
|
|
4840
5444
|
className: `inline-flex w-full items-center justify-between gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent/30 ${FOCUS_RING}`,
|
|
4841
5445
|
children: [
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
/* @__PURE__ */
|
|
5446
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate", children: harnessLabel(value) }),
|
|
5447
|
+
/* @__PURE__ */ jsx15(ChevronDown2, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
4844
5448
|
]
|
|
4845
5449
|
}
|
|
4846
5450
|
),
|
|
4847
|
-
open && /* @__PURE__ */
|
|
5451
|
+
open && /* @__PURE__ */ jsx15("div", { role: "menu", className: "absolute bottom-full left-0 z-50 mb-2 max-h-64 w-full min-w-[220px] overflow-y-auto rounded-xl border border-border bg-card p-1 shadow-lg", children: options.map((h) => /* @__PURE__ */ jsx15(
|
|
4848
5452
|
"button",
|
|
4849
5453
|
{
|
|
4850
5454
|
type: "button",
|
|
@@ -4891,11 +5495,11 @@ function AgentSessionControls(props) {
|
|
|
4891
5495
|
className
|
|
4892
5496
|
} = props;
|
|
4893
5497
|
const { onModel, onHarness } = useCoherentHandlers(props);
|
|
4894
|
-
const [open, setOpen] =
|
|
5498
|
+
const [open, setOpen] = useState15(false);
|
|
4895
5499
|
const { containerRef: popoverRef, triggerProps } = usePopover(open, setOpen);
|
|
4896
5500
|
const selectedModel = models.find((m) => m.id === model);
|
|
4897
5501
|
const showEffort = selectedModel?.supportsReasoning ?? true;
|
|
4898
|
-
const modelPicker = /* @__PURE__ */
|
|
5502
|
+
const modelPicker = /* @__PURE__ */ jsx15(
|
|
4899
5503
|
ModelPicker,
|
|
4900
5504
|
{
|
|
4901
5505
|
value: model,
|
|
@@ -4906,17 +5510,17 @@ function AgentSessionControls(props) {
|
|
|
4906
5510
|
}
|
|
4907
5511
|
);
|
|
4908
5512
|
if (layout === "inline") {
|
|
4909
|
-
return /* @__PURE__ */
|
|
5513
|
+
return /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
|
|
4910
5514
|
modelPicker,
|
|
4911
|
-
showHarness && /* @__PURE__ */
|
|
4912
|
-
showEffort && /* @__PURE__ */
|
|
5515
|
+
showHarness && /* @__PURE__ */ jsx15(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
|
|
5516
|
+
showEffort && /* @__PURE__ */ jsx15(EffortPicker, { value: effort, onChange: onEffortChange })
|
|
4913
5517
|
] });
|
|
4914
5518
|
}
|
|
4915
5519
|
const hasAdvanced = showHarness || showEffort;
|
|
4916
|
-
return /* @__PURE__ */
|
|
5520
|
+
return /* @__PURE__ */ jsxs13("div", { className: `flex items-center gap-1.5 ${className ?? ""}`, children: [
|
|
4917
5521
|
modelPicker,
|
|
4918
|
-
hasAdvanced && /* @__PURE__ */
|
|
4919
|
-
/* @__PURE__ */
|
|
5522
|
+
hasAdvanced && /* @__PURE__ */ jsxs13("div", { ref: popoverRef, className: "relative inline-flex", children: [
|
|
5523
|
+
/* @__PURE__ */ jsx15(
|
|
4920
5524
|
"button",
|
|
4921
5525
|
{
|
|
4922
5526
|
type: "button",
|
|
@@ -4925,19 +5529,19 @@ function AgentSessionControls(props) {
|
|
|
4925
5529
|
title: "Model settings \u2014 pick the agent backend and how hard it thinks",
|
|
4926
5530
|
className: `flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground data-[state=open]:bg-muted ${FOCUS_RING}`,
|
|
4927
5531
|
"data-state": open ? "open" : "closed",
|
|
4928
|
-
children: /* @__PURE__ */
|
|
5532
|
+
children: /* @__PURE__ */ jsx15(GearGlyph, { className: "h-4 w-4" })
|
|
4929
5533
|
}
|
|
4930
5534
|
),
|
|
4931
|
-
open && /* @__PURE__ */
|
|
4932
|
-
showHarness && /* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
4934
|
-
/* @__PURE__ */
|
|
4935
|
-
/* @__PURE__ */
|
|
5535
|
+
open && /* @__PURE__ */ jsxs13("div", { className: "absolute bottom-full left-0 z-50 mb-2 w-72 space-y-3 rounded-xl border border-border bg-card p-3 shadow-lg", children: [
|
|
5536
|
+
showHarness && /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
|
|
5537
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-foreground", children: "Agent backend" }),
|
|
5538
|
+
/* @__PURE__ */ jsx15(HarnessPicker, { value: harness, onChange: onHarness, available: availableHarnesses }),
|
|
5539
|
+
/* @__PURE__ */ jsx15("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "The engine that runs the agent. Switching it keeps your model choice compatible." })
|
|
4936
5540
|
] }),
|
|
4937
|
-
showEffort && /* @__PURE__ */
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
/* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
5541
|
+
showEffort && /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
|
|
5542
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs font-medium text-foreground", children: "Thinking" }),
|
|
5543
|
+
/* @__PURE__ */ jsx15(EffortPicker, { value: effort, onChange: onEffortChange, label: "" }),
|
|
5544
|
+
/* @__PURE__ */ jsx15("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "How hard the agent thinks before answering. Higher is slower but more thorough." })
|
|
4941
5545
|
] })
|
|
4942
5546
|
] })
|
|
4943
5547
|
] })
|
|
@@ -4945,7 +5549,7 @@ function AgentSessionControls(props) {
|
|
|
4945
5549
|
}
|
|
4946
5550
|
|
|
4947
5551
|
// src/web-react/index.tsx
|
|
4948
|
-
import { Fragment as Fragment8, jsx as
|
|
5552
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4949
5553
|
function formatModelCost(msg, models) {
|
|
4950
5554
|
if (msg.promptTokens == null && msg.completionTokens == null) return null;
|
|
4951
5555
|
const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
|
|
@@ -4959,41 +5563,41 @@ function formatTokensPerSecond(msg) {
|
|
|
4959
5563
|
return `${Math.round(msg.completionTokens / (msg.durationMs / 1e3))} tok/s`;
|
|
4960
5564
|
}
|
|
4961
5565
|
function RunDrillIn({ run, onClose }) {
|
|
4962
|
-
return /* @__PURE__ */
|
|
4963
|
-
/* @__PURE__ */
|
|
4964
|
-
/* @__PURE__ */
|
|
5566
|
+
return /* @__PURE__ */ jsxs14("div", { className: "fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-border bg-card shadow-xl", children: [
|
|
5567
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
5568
|
+
/* @__PURE__ */ jsx16(
|
|
4965
5569
|
"span",
|
|
4966
5570
|
{
|
|
4967
5571
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
4968
5572
|
}
|
|
4969
5573
|
),
|
|
4970
|
-
/* @__PURE__ */
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
/* @__PURE__ */
|
|
5574
|
+
/* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
|
|
5575
|
+
/* @__PURE__ */ jsx16("p", { className: "truncate text-sm font-semibold", children: run.title }),
|
|
5576
|
+
/* @__PURE__ */ jsx16("p", { className: "truncate font-mono text-[11px] text-muted-foreground", children: run.toolName })
|
|
4973
5577
|
] }),
|
|
4974
|
-
/* @__PURE__ */
|
|
5578
|
+
/* @__PURE__ */ jsx16(
|
|
4975
5579
|
"button",
|
|
4976
5580
|
{
|
|
4977
5581
|
type: "button",
|
|
4978
5582
|
onClick: onClose,
|
|
4979
5583
|
"aria-label": "Close",
|
|
4980
5584
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent/30 hover:text-foreground",
|
|
4981
|
-
children: /* @__PURE__ */
|
|
5585
|
+
children: /* @__PURE__ */ jsx16("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx16("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
4982
5586
|
}
|
|
4983
5587
|
)
|
|
4984
5588
|
] }),
|
|
4985
|
-
/* @__PURE__ */
|
|
4986
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
4987
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
4988
|
-
/* @__PURE__ */
|
|
4989
|
-
/* @__PURE__ */
|
|
4990
|
-
/* @__PURE__ */
|
|
4991
|
-
/* @__PURE__ */
|
|
5589
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
5590
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
5591
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs14("div", { className: "rounded-lg border border-border/60 bg-background", children: [
|
|
5592
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-baseline gap-2 border-b border-border/40 px-3 py-1.5", children: [
|
|
5593
|
+
/* @__PURE__ */ jsx16("span", { className: `font-mono text-[11px] ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
5594
|
+
/* @__PURE__ */ jsx16("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
5595
|
+
/* @__PURE__ */ jsx16("span", { className: "shrink-0 text-[10px] text-muted-foreground", children: new Date(step.at).toLocaleTimeString() })
|
|
4992
5596
|
] }),
|
|
4993
|
-
step.detail && /* @__PURE__ */
|
|
5597
|
+
step.detail && /* @__PURE__ */ jsx16("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-[11px] leading-relaxed text-muted-foreground", children: step.detail })
|
|
4994
5598
|
] }, i))
|
|
4995
5599
|
] }),
|
|
4996
|
-
/* @__PURE__ */
|
|
5600
|
+
/* @__PURE__ */ jsx16("p", { className: "border-t border-border px-4 py-2 text-[11px] text-muted-foreground", children: "Readonly drill-in. Follow up in the main chat." })
|
|
4997
5601
|
] });
|
|
4998
5602
|
}
|
|
4999
5603
|
function pendingApprovalOf(call) {
|
|
@@ -5007,20 +5611,20 @@ function ChatEmptyState({
|
|
|
5007
5611
|
subline = "Describe the outcome you want. The agent works through it step by step, and pauses for your approval before anything irreversible.",
|
|
5008
5612
|
doors
|
|
5009
5613
|
}) {
|
|
5010
|
-
return /* @__PURE__ */
|
|
5011
|
-
/* @__PURE__ */
|
|
5012
|
-
/* @__PURE__ */
|
|
5013
|
-
/* @__PURE__ */
|
|
5014
|
-
subline && /* @__PURE__ */
|
|
5015
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
5614
|
+
return /* @__PURE__ */ jsxs14("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
5615
|
+
/* @__PURE__ */ jsx16("span", { className: "mb-5 inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-primary/15", children: /* @__PURE__ */ jsx16(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
5616
|
+
/* @__PURE__ */ jsx16("p", { className: "text-[11px] font-semibold uppercase tracking-[0.18em] text-muted-foreground", children: productName }),
|
|
5617
|
+
/* @__PURE__ */ jsx16("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground sm:text-[28px]", children: headline }),
|
|
5618
|
+
subline && /* @__PURE__ */ jsx16("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
5619
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-7 grid w-full gap-2.5 sm:grid-cols-3", children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs14(
|
|
5016
5620
|
"button",
|
|
5017
5621
|
{
|
|
5018
5622
|
type: "button",
|
|
5019
5623
|
onClick: door.onSelect,
|
|
5020
|
-
className: "group flex min-h-[44px] flex-col items-start rounded-xl border border-border bg-card px-4 py-3 text-left transition hover:border-primary/40 hover:bg-accent/30
|
|
5624
|
+
className: "group flex min-h-[44px] flex-col items-start rounded-xl border border-border bg-card px-4 py-3 text-left transition hover:border-primary/40 hover:bg-accent/30",
|
|
5021
5625
|
children: [
|
|
5022
|
-
/* @__PURE__ */
|
|
5023
|
-
door.description && /* @__PURE__ */
|
|
5626
|
+
/* @__PURE__ */ jsx16("span", { className: "text-sm font-semibold text-foreground", children: door.label }),
|
|
5627
|
+
door.description && /* @__PURE__ */ jsx16("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
5024
5628
|
]
|
|
5025
5629
|
},
|
|
5026
5630
|
i
|
|
@@ -5029,26 +5633,26 @@ function ChatEmptyState({
|
|
|
5029
5633
|
}
|
|
5030
5634
|
function ToolGlyph({ name, className }) {
|
|
5031
5635
|
if (name.startsWith("sandbox_")) {
|
|
5032
|
-
return /* @__PURE__ */
|
|
5033
|
-
/* @__PURE__ */
|
|
5034
|
-
/* @__PURE__ */
|
|
5636
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5637
|
+
/* @__PURE__ */ jsx16("polyline", { points: "4 17 10 11 4 5" }),
|
|
5638
|
+
/* @__PURE__ */ jsx16("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
5035
5639
|
] });
|
|
5036
5640
|
}
|
|
5037
5641
|
if (name === "submit_proposal") {
|
|
5038
|
-
return /* @__PURE__ */
|
|
5039
|
-
/* @__PURE__ */
|
|
5040
|
-
/* @__PURE__ */
|
|
5642
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5643
|
+
/* @__PURE__ */ jsx16("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
5644
|
+
/* @__PURE__ */ jsx16("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
5041
5645
|
] });
|
|
5042
5646
|
}
|
|
5043
5647
|
if (name === "schedule_followup") {
|
|
5044
|
-
return /* @__PURE__ */
|
|
5045
|
-
/* @__PURE__ */
|
|
5046
|
-
/* @__PURE__ */
|
|
5648
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
5649
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5650
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 7v5l3 3" })
|
|
5047
5651
|
] });
|
|
5048
5652
|
}
|
|
5049
|
-
return /* @__PURE__ */
|
|
5050
|
-
/* @__PURE__ */
|
|
5051
|
-
/* @__PURE__ */
|
|
5653
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5654
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
5655
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "4" })
|
|
5052
5656
|
] });
|
|
5053
5657
|
}
|
|
5054
5658
|
function toolOutcomeOf(call) {
|
|
@@ -5116,40 +5720,40 @@ function truncate(v, max = 240) {
|
|
|
5116
5720
|
function KvRows({ data }) {
|
|
5117
5721
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
5118
5722
|
if (!entries.length) return null;
|
|
5119
|
-
return /* @__PURE__ */
|
|
5120
|
-
/* @__PURE__ */
|
|
5121
|
-
/* @__PURE__ */
|
|
5723
|
+
return /* @__PURE__ */ jsx16("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs14("div", { className: "contents", children: [
|
|
5724
|
+
/* @__PURE__ */ jsx16("dt", { className: "font-mono text-[11px] text-muted-foreground", children: k }),
|
|
5725
|
+
/* @__PURE__ */ jsx16("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-[11px] text-muted-foreground", children: truncate(v) })
|
|
5122
5726
|
] }, k)) });
|
|
5123
5727
|
}
|
|
5124
5728
|
function ShellDetail({ call }) {
|
|
5125
5729
|
const outcome = toolOutcomeOf(call);
|
|
5126
5730
|
const r = outcome?.result ?? {};
|
|
5127
|
-
return /* @__PURE__ */
|
|
5128
|
-
/* @__PURE__ */
|
|
5129
|
-
/* @__PURE__ */
|
|
5130
|
-
/* @__PURE__ */
|
|
5131
|
-
r.exitCode != null && /* @__PURE__ */
|
|
5731
|
+
return /* @__PURE__ */ jsxs14("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-[11px] leading-relaxed", children: [
|
|
5732
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
|
|
5733
|
+
/* @__PURE__ */ jsx16("span", { className: "select-none text-zinc-500", children: "$" }),
|
|
5734
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
|
|
5735
|
+
r.exitCode != null && /* @__PURE__ */ jsxs14("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
|
|
5132
5736
|
"exit ",
|
|
5133
5737
|
r.exitCode
|
|
5134
5738
|
] })
|
|
5135
5739
|
] }),
|
|
5136
|
-
/* @__PURE__ */
|
|
5740
|
+
/* @__PURE__ */ jsx16("pre", { className: "max-h-56 overflow-auto whitespace-pre-wrap px-3 pb-2.5 pt-1.5 text-zinc-300", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
|
|
5137
5741
|
] });
|
|
5138
5742
|
}
|
|
5139
5743
|
function DefaultToolDetail({ call }) {
|
|
5140
5744
|
const result = call.result;
|
|
5141
5745
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
5142
|
-
return /* @__PURE__ */
|
|
5143
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
5145
|
-
/* @__PURE__ */
|
|
5746
|
+
return /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
|
|
5747
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs14("div", { children: [
|
|
5748
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
5749
|
+
/* @__PURE__ */ jsx16(KvRows, { data: call.args })
|
|
5146
5750
|
] }),
|
|
5147
|
-
envelope ? /* @__PURE__ */
|
|
5148
|
-
/* @__PURE__ */
|
|
5149
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
5150
|
-
] }) : result != null ? /* @__PURE__ */
|
|
5151
|
-
/* @__PURE__ */
|
|
5152
|
-
/* @__PURE__ */
|
|
5751
|
+
envelope ? /* @__PURE__ */ jsxs14("div", { children: [
|
|
5752
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
5753
|
+
envelope.ok === false ? /* @__PURE__ */ jsx16("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx16(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx16("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
5754
|
+
] }) : result != null ? /* @__PURE__ */ jsxs14("div", { children: [
|
|
5755
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
5756
|
+
/* @__PURE__ */ jsx16("p", { className: "font-mono text-[11px] text-muted-foreground", children: truncate(result) })
|
|
5153
5757
|
] }) : null
|
|
5154
5758
|
] });
|
|
5155
5759
|
}
|
|
@@ -5160,69 +5764,69 @@ function ProposalCard({
|
|
|
5160
5764
|
approval,
|
|
5161
5765
|
renderers
|
|
5162
5766
|
}) {
|
|
5163
|
-
const [expanded, setExpanded] =
|
|
5767
|
+
const [expanded, setExpanded] = useState16(false);
|
|
5164
5768
|
const { summary, meta } = proposalPreview(call);
|
|
5165
5769
|
const custom = renderers?.[call.name]?.(call, message);
|
|
5166
5770
|
const { pending: deciding, run: decide } = usePending();
|
|
5167
|
-
return /* @__PURE__ */
|
|
5168
|
-
/* @__PURE__ */
|
|
5169
|
-
/* @__PURE__ */
|
|
5170
|
-
/* @__PURE__ */
|
|
5171
|
-
/* @__PURE__ */
|
|
5172
|
-
/* @__PURE__ */
|
|
5173
|
-
summary && /* @__PURE__ */
|
|
5174
|
-
meta.length > 0 && /* @__PURE__ */
|
|
5771
|
+
return /* @__PURE__ */ jsxs14("div", { className: "w-full max-w-full rounded-xl border border-warning/50 bg-warning/[0.06] text-sm shadow-sm ring-1 ring-warning/10", children: [
|
|
5772
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
5773
|
+
/* @__PURE__ */ jsx16("span", { className: "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-warning/15 text-warning", children: /* @__PURE__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
5774
|
+
/* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
|
|
5775
|
+
/* @__PURE__ */ jsx16("p", { className: "text-[10px] font-semibold uppercase tracking-wider text-warning-strong", children: "Needs your approval" }),
|
|
5776
|
+
/* @__PURE__ */ jsx16("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
5777
|
+
summary && /* @__PURE__ */ jsx16("p", { className: "mt-1 text-[13px] leading-relaxed text-muted-foreground", children: summary }),
|
|
5778
|
+
meta.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx16("span", { className: "rounded-full bg-muted/60 px-2 py-0.5 text-[11px] font-medium text-muted-foreground", children: m }, i)) })
|
|
5175
5779
|
] })
|
|
5176
5780
|
] }),
|
|
5177
|
-
/* @__PURE__ */
|
|
5178
|
-
approval ? /* @__PURE__ */
|
|
5179
|
-
/* @__PURE__ */
|
|
5781
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
5782
|
+
approval ? /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5783
|
+
/* @__PURE__ */ jsx16(
|
|
5180
5784
|
"button",
|
|
5181
5785
|
{
|
|
5182
5786
|
type: "button",
|
|
5183
5787
|
disabled: deciding,
|
|
5184
5788
|
onClick: () => decide(() => approval.onApprove(pending.proposalId, call.id)),
|
|
5185
|
-
className: "inline-flex min-h-[40px] flex-1 items-center justify-center rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground shadow-sm transition hover:bg-primary/90
|
|
5789
|
+
className: "inline-flex min-h-[40px] flex-1 items-center justify-center rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground shadow-sm transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-60 sm:flex-none sm:min-w-[160px]",
|
|
5186
5790
|
children: "Approve & run"
|
|
5187
5791
|
}
|
|
5188
5792
|
),
|
|
5189
|
-
/* @__PURE__ */
|
|
5793
|
+
/* @__PURE__ */ jsx16(
|
|
5190
5794
|
"button",
|
|
5191
5795
|
{
|
|
5192
5796
|
type: "button",
|
|
5193
5797
|
disabled: deciding,
|
|
5194
5798
|
onClick: () => decide(() => approval.onReject(pending.proposalId, call.id)),
|
|
5195
|
-
className: "inline-flex min-h-[40px] items-center justify-center rounded-lg border border-border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground transition hover:bg-accent/30 hover:text-foreground
|
|
5799
|
+
className: "inline-flex min-h-[40px] items-center justify-center rounded-lg border border-border bg-transparent px-4 py-2 text-sm font-medium text-muted-foreground transition hover:bg-accent/30 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-60",
|
|
5196
5800
|
children: "Reject"
|
|
5197
5801
|
}
|
|
5198
5802
|
)
|
|
5199
|
-
] }) : /* @__PURE__ */
|
|
5200
|
-
/* @__PURE__ */
|
|
5803
|
+
] }) : /* @__PURE__ */ jsx16("span", { className: "text-[12px] font-medium text-muted-foreground", children: "Awaiting approval\u2026" }),
|
|
5804
|
+
/* @__PURE__ */ jsxs14(
|
|
5201
5805
|
"button",
|
|
5202
5806
|
{
|
|
5203
5807
|
type: "button",
|
|
5204
5808
|
onClick: () => setExpanded((v) => !v),
|
|
5205
5809
|
"aria-expanded": expanded,
|
|
5206
|
-
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground
|
|
5810
|
+
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
5207
5811
|
children: [
|
|
5208
5812
|
expanded ? "Hide details" : "View details",
|
|
5209
|
-
/* @__PURE__ */
|
|
5813
|
+
/* @__PURE__ */ jsx16(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
5210
5814
|
]
|
|
5211
5815
|
}
|
|
5212
5816
|
)
|
|
5213
5817
|
] }),
|
|
5214
|
-
expanded && /* @__PURE__ */
|
|
5818
|
+
expanded && /* @__PURE__ */ jsx16("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx16(DefaultToolDetail, { call }) })
|
|
5215
5819
|
] });
|
|
5216
5820
|
}
|
|
5217
5821
|
function FollowupCard({ call }) {
|
|
5218
5822
|
const a = call.args ?? {};
|
|
5219
5823
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
5220
|
-
return /* @__PURE__ */
|
|
5221
|
-
/* @__PURE__ */
|
|
5222
|
-
/* @__PURE__ */
|
|
5223
|
-
/* @__PURE__ */
|
|
5824
|
+
return /* @__PURE__ */ jsxs14("div", { className: "w-fit min-w-[260px] max-w-full rounded-lg border border-border/60 border-l-2 border-l-primary/60 bg-muted/20 px-3 py-2 text-sm", children: [
|
|
5825
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
|
|
5826
|
+
/* @__PURE__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-primary/80" }),
|
|
5827
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate font-medium text-foreground", children: friendlyToolTitle(call) })
|
|
5224
5828
|
] }),
|
|
5225
|
-
when && /* @__PURE__ */
|
|
5829
|
+
when && /* @__PURE__ */ jsx16("p", { className: "mt-0.5 pl-[22px] text-[12px] text-muted-foreground", children: when })
|
|
5226
5830
|
] });
|
|
5227
5831
|
}
|
|
5228
5832
|
function ToolCallCard({
|
|
@@ -5232,13 +5836,13 @@ function ToolCallCard({
|
|
|
5232
5836
|
onOpenRun,
|
|
5233
5837
|
renderers
|
|
5234
5838
|
}) {
|
|
5235
|
-
const [expanded, setExpanded] =
|
|
5839
|
+
const [expanded, setExpanded] = useState16(false);
|
|
5236
5840
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
5237
5841
|
const kind = blockKindOf(call);
|
|
5238
5842
|
const failed = call.status === "error" || toolOutcomeOf(call)?.ok === false;
|
|
5239
5843
|
const custom = renderers?.[call.name]?.(call, message);
|
|
5240
5844
|
if (pending) {
|
|
5241
|
-
return /* @__PURE__ */
|
|
5845
|
+
return /* @__PURE__ */ jsx16(
|
|
5242
5846
|
ProposalCard,
|
|
5243
5847
|
{
|
|
5244
5848
|
call,
|
|
@@ -5250,31 +5854,31 @@ function ToolCallCard({
|
|
|
5250
5854
|
);
|
|
5251
5855
|
}
|
|
5252
5856
|
if (kind === "followup" && !failed) {
|
|
5253
|
-
return /* @__PURE__ */
|
|
5857
|
+
return /* @__PURE__ */ jsx16(FollowupCard, { call });
|
|
5254
5858
|
}
|
|
5255
5859
|
const isCommand = kind === "command";
|
|
5256
|
-
return /* @__PURE__ */
|
|
5860
|
+
return /* @__PURE__ */ jsxs14(
|
|
5257
5861
|
"div",
|
|
5258
5862
|
{
|
|
5259
5863
|
className: `w-fit min-w-[280px] max-w-full rounded-lg border text-xs transition ${failed ? "border-destructive/40 bg-destructive/5" : "border-border/60 bg-muted/20"}`,
|
|
5260
5864
|
children: [
|
|
5261
|
-
/* @__PURE__ */
|
|
5262
|
-
/* @__PURE__ */
|
|
5865
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex w-full items-center gap-2 px-3 py-2", children: [
|
|
5866
|
+
/* @__PURE__ */ jsxs14(
|
|
5263
5867
|
"button",
|
|
5264
5868
|
{
|
|
5265
5869
|
type: "button",
|
|
5266
5870
|
onClick: () => setExpanded((v) => !v),
|
|
5267
5871
|
"aria-expanded": expanded,
|
|
5268
|
-
className: "flex min-w-0 flex-1 items-center gap-2 rounded text-left
|
|
5872
|
+
className: "flex min-w-0 flex-1 items-center gap-2 rounded text-left",
|
|
5269
5873
|
children: [
|
|
5270
|
-
/* @__PURE__ */
|
|
5874
|
+
/* @__PURE__ */ jsx16(
|
|
5271
5875
|
"span",
|
|
5272
5876
|
{
|
|
5273
5877
|
className: `h-2 w-2 shrink-0 rounded-full ${call.status === "running" ? "animate-pulse bg-warning" : failed ? "bg-destructive" : "bg-success"}`
|
|
5274
5878
|
}
|
|
5275
5879
|
),
|
|
5276
|
-
/* @__PURE__ */
|
|
5277
|
-
/* @__PURE__ */
|
|
5880
|
+
/* @__PURE__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
|
|
5881
|
+
/* @__PURE__ */ jsx16(
|
|
5278
5882
|
"span",
|
|
5279
5883
|
{
|
|
5280
5884
|
className: `min-w-0 flex-1 truncate ${isCommand ? "font-mono text-[12px] tracking-tight text-foreground/90" : "font-medium"}`,
|
|
@@ -5284,22 +5888,22 @@ function ToolCallCard({
|
|
|
5284
5888
|
]
|
|
5285
5889
|
}
|
|
5286
5890
|
),
|
|
5287
|
-
/* @__PURE__ */
|
|
5288
|
-
/* @__PURE__ */
|
|
5891
|
+
/* @__PURE__ */ jsx16("span", { className: "shrink-0 text-[11px] text-muted-foreground", children: call.status === "running" ? "running\u2026" : failed ? "failed" : "done" }),
|
|
5892
|
+
/* @__PURE__ */ jsx16(
|
|
5289
5893
|
"button",
|
|
5290
5894
|
{
|
|
5291
5895
|
type: "button",
|
|
5292
5896
|
onClick: () => setExpanded((v) => !v),
|
|
5293
5897
|
"aria-label": expanded ? "Collapse details" : "Expand details",
|
|
5294
5898
|
"aria-expanded": expanded,
|
|
5295
|
-
className: "shrink-0 rounded p-0.5
|
|
5296
|
-
children: /* @__PURE__ */
|
|
5899
|
+
className: "shrink-0 rounded p-0.5",
|
|
5900
|
+
children: /* @__PURE__ */ jsx16(ChevronDown, { className: `h-3 w-3 text-muted-foreground transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
5297
5901
|
}
|
|
5298
5902
|
)
|
|
5299
5903
|
] }),
|
|
5300
|
-
expanded && /* @__PURE__ */
|
|
5301
|
-
custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
5302
|
-
onOpenRun && call.name.startsWith("sandbox_") && /* @__PURE__ */
|
|
5904
|
+
expanded && /* @__PURE__ */ jsxs14("div", { className: "border-t border-border/40 px-3 py-2.5", children: [
|
|
5905
|
+
custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx16(ShellDetail, { call }) : /* @__PURE__ */ jsx16(DefaultToolDetail, { call })),
|
|
5906
|
+
onOpenRun && call.name.startsWith("sandbox_") && /* @__PURE__ */ jsx16(
|
|
5303
5907
|
"button",
|
|
5304
5908
|
{
|
|
5305
5909
|
type: "button",
|
|
@@ -5314,7 +5918,7 @@ function ToolCallCard({
|
|
|
5314
5918
|
);
|
|
5315
5919
|
}
|
|
5316
5920
|
function StreamingCaret() {
|
|
5317
|
-
return /* @__PURE__ */
|
|
5921
|
+
return /* @__PURE__ */ jsx16(
|
|
5318
5922
|
"span",
|
|
5319
5923
|
{
|
|
5320
5924
|
className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-pulse rounded-sm bg-foreground/70",
|
|
@@ -5332,9 +5936,9 @@ function SegmentText({
|
|
|
5332
5936
|
const text = useSmoothText(content, streaming);
|
|
5333
5937
|
const body = useMemo9(() => renderBody(text), [renderBody, text]);
|
|
5334
5938
|
if (!content.trim() && !showCaret) return null;
|
|
5335
|
-
return /* @__PURE__ */
|
|
5939
|
+
return /* @__PURE__ */ jsxs14("div", { className: messageClassName, children: [
|
|
5336
5940
|
body,
|
|
5337
|
-
showCaret && /* @__PURE__ */
|
|
5941
|
+
showCaret && /* @__PURE__ */ jsx16(StreamingCaret, {})
|
|
5338
5942
|
] });
|
|
5339
5943
|
}
|
|
5340
5944
|
var COLLAPSE_TOOL_RUN_AT = 3;
|
|
@@ -5358,7 +5962,7 @@ function SegmentedBody({
|
|
|
5358
5962
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
5359
5963
|
(tc) => !segmentToolIds.has(tc.id)
|
|
5360
5964
|
);
|
|
5361
|
-
const renderToolCard = (call) => /* @__PURE__ */
|
|
5965
|
+
const renderToolCard = (call) => /* @__PURE__ */ jsx16(
|
|
5362
5966
|
ToolCallCard,
|
|
5363
5967
|
{
|
|
5364
5968
|
call,
|
|
@@ -5381,9 +5985,9 @@ function SegmentedBody({
|
|
|
5381
5985
|
else groups.push({ kind: "tools", index: i, calls: [seg.call] });
|
|
5382
5986
|
}
|
|
5383
5987
|
}
|
|
5384
|
-
return /* @__PURE__ */
|
|
5988
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2", children: [
|
|
5385
5989
|
groups.map(
|
|
5386
|
-
(g) => g.kind === "text" ? /* @__PURE__ */
|
|
5990
|
+
(g) => g.kind === "text" ? /* @__PURE__ */ jsx16(
|
|
5387
5991
|
SegmentText,
|
|
5388
5992
|
{
|
|
5389
5993
|
content: g.content,
|
|
@@ -5393,24 +5997,24 @@ function SegmentedBody({
|
|
|
5393
5997
|
messageClassName
|
|
5394
5998
|
},
|
|
5395
5999
|
`text-${g.index}`
|
|
5396
|
-
) : !streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool) ? /* @__PURE__ */
|
|
6000
|
+
) : !streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool) ? /* @__PURE__ */ jsxs14(
|
|
5397
6001
|
"details",
|
|
5398
6002
|
{
|
|
5399
6003
|
className: "rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2",
|
|
5400
6004
|
children: [
|
|
5401
|
-
/* @__PURE__ */
|
|
6005
|
+
/* @__PURE__ */ jsxs14("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: [
|
|
5402
6006
|
"Worked through ",
|
|
5403
6007
|
g.calls.length,
|
|
5404
6008
|
" steps"
|
|
5405
6009
|
] }),
|
|
5406
|
-
/* @__PURE__ */
|
|
6010
|
+
/* @__PURE__ */ jsx16("div", { className: "mt-2 flex flex-col gap-2", children: g.calls.map(renderToolCard) })
|
|
5407
6011
|
]
|
|
5408
6012
|
},
|
|
5409
6013
|
`tools-${g.index}`
|
|
5410
|
-
) : /* @__PURE__ */
|
|
6014
|
+
) : /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-2", children: g.calls.map(renderToolCard) }, `tools-${g.index}`)
|
|
5411
6015
|
),
|
|
5412
6016
|
leftoverToolCalls.map(renderToolCard),
|
|
5413
|
-
streaming && segments[lastIndex]?.kind === "tool" && /* @__PURE__ */
|
|
6017
|
+
streaming && segments[lastIndex]?.kind === "tool" && /* @__PURE__ */ jsx16(StreamingCaret, {})
|
|
5414
6018
|
] });
|
|
5415
6019
|
}
|
|
5416
6020
|
function AssistantMessageImpl({
|
|
@@ -5433,37 +6037,37 @@ function AssistantMessageImpl({
|
|
|
5433
6037
|
const body = useMemo9(() => renderBody(content), [renderBody, content]);
|
|
5434
6038
|
const segments = msg.segments;
|
|
5435
6039
|
const hasAnswerText = content !== "" || (segments?.some((s) => s.kind === "text" && s.content.trim() !== "") ?? false);
|
|
5436
|
-
const reasoningScrollRef =
|
|
5437
|
-
const thinkStartRef =
|
|
5438
|
-
const thinkMsRef =
|
|
6040
|
+
const reasoningScrollRef = useRef11(null);
|
|
6041
|
+
const thinkStartRef = useRef11(null);
|
|
6042
|
+
const thinkMsRef = useRef11(null);
|
|
5439
6043
|
if (streaming && reasoning && !hasAnswerText && thinkStartRef.current === null) {
|
|
5440
6044
|
thinkStartRef.current = performance.now();
|
|
5441
6045
|
}
|
|
5442
6046
|
if (hasAnswerText && thinkStartRef.current !== null && thinkMsRef.current === null) {
|
|
5443
6047
|
thinkMsRef.current = performance.now() - thinkStartRef.current;
|
|
5444
6048
|
}
|
|
5445
|
-
|
|
6049
|
+
useEffect12(() => {
|
|
5446
6050
|
const el = reasoningScrollRef.current;
|
|
5447
6051
|
if (el && streaming && !hasAnswerText) el.scrollTop = el.scrollHeight;
|
|
5448
6052
|
}, [reasoning, streaming, hasAnswerText]);
|
|
5449
6053
|
const thinkingSeconds = useThinkingSeconds(
|
|
5450
6054
|
streaming && !!reasoning && !hasAnswerText
|
|
5451
6055
|
);
|
|
5452
|
-
return /* @__PURE__ */
|
|
5453
|
-
/* @__PURE__ */
|
|
5454
|
-
/* @__PURE__ */
|
|
5455
|
-
msg.modelUsed && /* @__PURE__ */
|
|
5456
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
5457
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
6056
|
+
return /* @__PURE__ */ jsxs14("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
6057
|
+
/* @__PURE__ */ jsxs14("div", { className: "mb-1 flex items-baseline gap-2 text-[11px] tracking-wide text-muted-foreground", children: [
|
|
6058
|
+
/* @__PURE__ */ jsx16("span", { className: "font-semibold uppercase", children: agentLabel }),
|
|
6059
|
+
msg.modelUsed && /* @__PURE__ */ jsx16("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
6060
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx16("span", { children: formatTokensPerSecond(msg) }),
|
|
6061
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx16("span", { children: formatModelCost(msg, models) })
|
|
5458
6062
|
] }),
|
|
5459
|
-
reasoning && /* @__PURE__ */
|
|
5460
|
-
/* @__PURE__ */
|
|
6063
|
+
reasoning && /* @__PURE__ */ jsxs14("details", { className: "mb-2 rounded-lg border-l-2 border-border/70 bg-muted/20 px-3 py-2", open: !hasAnswerText, children: [
|
|
6064
|
+
/* @__PURE__ */ jsx16("summary", { className: "cursor-pointer select-none text-xs font-medium text-muted-foreground", children: !hasAnswerText ? /* @__PURE__ */ jsxs14("span", { className: "animate-pulse", children: [
|
|
5461
6065
|
"Thinking",
|
|
5462
6066
|
thinkingSeconds >= 3 ? ` \xB7 ${thinkingSeconds}s` : "\u2026"
|
|
5463
6067
|
] }) : thinkMsRef.current != null ? `Thought for ${Math.max(1, Math.round(thinkMsRef.current / 1e3))}s` : "Thought process" }),
|
|
5464
|
-
/* @__PURE__ */
|
|
6068
|
+
/* @__PURE__ */ jsx16("div", { ref: reasoningScrollRef, className: "mt-2 max-h-48 overflow-y-auto whitespace-pre-wrap text-[13px] leading-relaxed text-muted-foreground", children: reasoning })
|
|
5465
6069
|
] }),
|
|
5466
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
6070
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx16(
|
|
5467
6071
|
SegmentedBody,
|
|
5468
6072
|
{
|
|
5469
6073
|
segments,
|
|
@@ -5475,12 +6079,12 @@ function AssistantMessageImpl({
|
|
|
5475
6079
|
toolRenderers,
|
|
5476
6080
|
messageClassName
|
|
5477
6081
|
}
|
|
5478
|
-
) : /* @__PURE__ */
|
|
5479
|
-
/* @__PURE__ */
|
|
6082
|
+
) : /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
6083
|
+
/* @__PURE__ */ jsxs14("div", { className: messageClassName, children: [
|
|
5480
6084
|
body,
|
|
5481
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
6085
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx16(StreamingCaret, {})
|
|
5482
6086
|
] }),
|
|
5483
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
6087
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc) => /* @__PURE__ */ jsx16(
|
|
5484
6088
|
ToolCallCard,
|
|
5485
6089
|
{
|
|
5486
6090
|
call: tc,
|
|
@@ -5492,7 +6096,7 @@ function AssistantMessageImpl({
|
|
|
5492
6096
|
tc.id
|
|
5493
6097
|
)) })
|
|
5494
6098
|
] }),
|
|
5495
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
6099
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx16(
|
|
5496
6100
|
DurableChatCards,
|
|
5497
6101
|
{
|
|
5498
6102
|
...durableCards,
|
|
@@ -5501,7 +6105,7 @@ function AssistantMessageImpl({
|
|
|
5501
6105
|
className: "mt-3"
|
|
5502
6106
|
}
|
|
5503
6107
|
),
|
|
5504
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
6108
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx16(
|
|
5505
6109
|
WorkProductCard,
|
|
5506
6110
|
{
|
|
5507
6111
|
part,
|
|
@@ -5511,7 +6115,7 @@ function AssistantMessageImpl({
|
|
|
5511
6115
|
`${part.ref.id}:${part.ref.version}`
|
|
5512
6116
|
)),
|
|
5513
6117
|
renderExtras?.(msg),
|
|
5514
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
6118
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-2", children: /* @__PURE__ */ jsx16(
|
|
5515
6119
|
MessageAttachments,
|
|
5516
6120
|
{
|
|
5517
6121
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -5523,8 +6127,8 @@ function AssistantMessageImpl({
|
|
|
5523
6127
|
}
|
|
5524
6128
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
5525
6129
|
function useThinkingSeconds(active) {
|
|
5526
|
-
const [seconds, setSeconds] =
|
|
5527
|
-
|
|
6130
|
+
const [seconds, setSeconds] = useState16(0);
|
|
6131
|
+
useEffect12(() => {
|
|
5528
6132
|
if (!active) return;
|
|
5529
6133
|
setSeconds(0);
|
|
5530
6134
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
@@ -5534,23 +6138,23 @@ function useThinkingSeconds(active) {
|
|
|
5534
6138
|
}
|
|
5535
6139
|
function ThinkingRow({ agentLabel }) {
|
|
5536
6140
|
const seconds = useThinkingSeconds(true);
|
|
5537
|
-
return /* @__PURE__ */
|
|
5538
|
-
/* @__PURE__ */
|
|
5539
|
-
/* @__PURE__ */
|
|
5540
|
-
/* @__PURE__ */
|
|
6141
|
+
return /* @__PURE__ */ jsxs14("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
6142
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: agentLabel }),
|
|
6143
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 text-base text-muted-foreground", children: [
|
|
6144
|
+
/* @__PURE__ */ jsx16("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx16("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }),
|
|
5541
6145
|
"Thinking",
|
|
5542
6146
|
seconds >= 3 ? ` \xB7 ${seconds}s` : "..."
|
|
5543
6147
|
] })
|
|
5544
6148
|
] });
|
|
5545
6149
|
}
|
|
5546
6150
|
function StreamErrorRow({ message, onRetry }) {
|
|
5547
|
-
return /* @__PURE__ */
|
|
5548
|
-
/* @__PURE__ */
|
|
5549
|
-
/* @__PURE__ */
|
|
5550
|
-
/* @__PURE__ */
|
|
6151
|
+
return /* @__PURE__ */ jsx16("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs14("div", { role: "alert", className: "flex items-start gap-2.5 rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-2.5 text-sm text-destructive", children: [
|
|
6152
|
+
/* @__PURE__ */ jsxs14("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6153
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "9" }),
|
|
6154
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 8v4m0 4h.01" })
|
|
5551
6155
|
] }),
|
|
5552
|
-
/* @__PURE__ */
|
|
5553
|
-
onRetry && /* @__PURE__ */
|
|
6156
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
6157
|
+
onRetry && /* @__PURE__ */ jsx16(
|
|
5554
6158
|
"button",
|
|
5555
6159
|
{
|
|
5556
6160
|
type: "button",
|
|
@@ -5584,30 +6188,30 @@ function ChatMessages({
|
|
|
5584
6188
|
}) {
|
|
5585
6189
|
const messageClassName = messageSize === "large" ? "agent-app-message-copy text-[17px] leading-[1.75]" : "agent-app-message-copy text-base leading-[1.75]";
|
|
5586
6190
|
const renderBody = useMemo9(
|
|
5587
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
6191
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx16("p", { className: "whitespace-pre-wrap", children: content })),
|
|
5588
6192
|
[renderMarkdown]
|
|
5589
6193
|
);
|
|
5590
6194
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
5591
6195
|
if (messages.length === 0 && !loading && !error) {
|
|
5592
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
5593
|
-
return /* @__PURE__ */
|
|
6196
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx16(ChatEmptyState, { ...emptyState });
|
|
6197
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5594
6198
|
header,
|
|
5595
6199
|
empty
|
|
5596
6200
|
] });
|
|
5597
6201
|
}
|
|
5598
|
-
return /* @__PURE__ */
|
|
6202
|
+
return /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5599
6203
|
header,
|
|
5600
6204
|
messages.map(
|
|
5601
|
-
(msg) => msg.role === "user" ? /* @__PURE__ */
|
|
5602
|
-
/* @__PURE__ */
|
|
5603
|
-
/* @__PURE__ */
|
|
6205
|
+
(msg) => msg.role === "user" ? /* @__PURE__ */ jsx16("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs14("div", { className: "ml-auto w-fit max-w-[85%]", children: [
|
|
6206
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-right text-[11px] font-semibold uppercase tracking-wide text-muted-foreground", children: userLabel }),
|
|
6207
|
+
/* @__PURE__ */ jsx16(
|
|
5604
6208
|
"div",
|
|
5605
6209
|
{
|
|
5606
6210
|
className: `rounded-2xl rounded-tr-md bg-primary/10 px-4 py-2.5 ${messageClassName}`,
|
|
5607
|
-
children: /* @__PURE__ */
|
|
6211
|
+
children: /* @__PURE__ */ jsx16("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
5608
6212
|
}
|
|
5609
6213
|
),
|
|
5610
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
6214
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx16(
|
|
5611
6215
|
MessageAttachments,
|
|
5612
6216
|
{
|
|
5613
6217
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -5615,7 +6219,7 @@ function ChatMessages({
|
|
|
5615
6219
|
justify: "end"
|
|
5616
6220
|
}
|
|
5617
6221
|
) })
|
|
5618
|
-
] }) }, msg.id) : /* @__PURE__ */
|
|
6222
|
+
] }) }, msg.id) : /* @__PURE__ */ jsx16(
|
|
5619
6223
|
AssistantMessage,
|
|
5620
6224
|
{
|
|
5621
6225
|
msg,
|
|
@@ -5635,8 +6239,8 @@ function ChatMessages({
|
|
|
5635
6239
|
msg.id
|
|
5636
6240
|
)
|
|
5637
6241
|
),
|
|
5638
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
5639
|
-
error && !loading && /* @__PURE__ */
|
|
6242
|
+
loading && lastIsUser && /* @__PURE__ */ jsx16(ThinkingRow, { agentLabel }),
|
|
6243
|
+
error && !loading && /* @__PURE__ */ jsx16(StreamErrorRow, { message: error, onRetry })
|
|
5640
6244
|
] });
|
|
5641
6245
|
}
|
|
5642
6246
|
|
|
@@ -5706,6 +6310,22 @@ export {
|
|
|
5706
6310
|
FlowWaterfall,
|
|
5707
6311
|
MissionActivityLane,
|
|
5708
6312
|
AgentActivityPanel,
|
|
6313
|
+
PROVENANCE_BASES,
|
|
6314
|
+
provenanceBasisMeta,
|
|
6315
|
+
provenanceStandingMeta,
|
|
6316
|
+
weakerProvenanceStanding,
|
|
6317
|
+
DEFAULT_PROVENANCE_CONFIDENCE_POLICY,
|
|
6318
|
+
standingFromConfidence,
|
|
6319
|
+
describeProvenanceSourceStatus,
|
|
6320
|
+
provenanceGaps,
|
|
6321
|
+
loadingProvenanceSources,
|
|
6322
|
+
resolveProvenanceStanding,
|
|
6323
|
+
rollUpProvenanceStanding,
|
|
6324
|
+
describeProvenance,
|
|
6325
|
+
provenanceNextMove,
|
|
6326
|
+
provenanceTriggerLabel,
|
|
6327
|
+
ProvenanceValue,
|
|
6328
|
+
ProvenanceLegend,
|
|
5709
6329
|
SeatPaywall,
|
|
5710
6330
|
useInfiniteScroll,
|
|
5711
6331
|
useSessionHistory,
|
|
@@ -5744,4 +6364,4 @@ export {
|
|
|
5744
6364
|
useThinkingSeconds,
|
|
5745
6365
|
ChatMessages
|
|
5746
6366
|
};
|
|
5747
|
-
//# sourceMappingURL=chunk-
|
|
6367
|
+
//# sourceMappingURL=chunk-KOMP6NDW.js.map
|