@nivaro/react 0.3.137 → 0.3.138
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/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +1 -1
- package/dist/index.d.ts +95 -4
- package/dist/index.js +748 -743
- package/dist/shared/components/CollectionBrowserView.js +392 -389
- package/dist/shared/components/DelegateCoverLine.js +80 -87
- package/dist/shared/components/ItemEditForm.js +589 -588
- package/dist/shared/components/MyWorkView.js +284 -286
- package/dist/shared/components/NotificationBell.js +251 -205
- package/dist/shared/components/ai/AiAnalyticsView.js +878 -417
- package/dist/shared/components/ai/AiPlanCard.js +164 -122
- package/dist/shared/components/ai/AiPlanUndo.js +291 -0
- package/dist/shared/components/ai/call-log/CallDrawer.js +357 -0
- package/dist/shared/components/ai/call-log/RawJson.js +126 -0
- package/dist/shared/components/ai/call-log/ThreadView.js +223 -0
- package/dist/shared/components/ai/call-log/TranscriptView.js +227 -0
- package/dist/shared/components/ai/call-log/controls.js +364 -0
- package/dist/shared/components/ai/call-log/format.js +46 -0
- package/dist/shared/components/ai/call-log/url.js +105 -0
- package/dist/shared/components/chat/chat-core.js +422 -346
- package/dist/shared/components/integrations/IntegrationObligationsView.js +98 -98
- package/dist/shared/components/integrations/RecordIntegrationPreview.js +102 -93
- package/dist/shared/components/integrations/console/api.js +11 -1
- package/dist/shared/components/item-edit/HeaderRollupExplainer.js +5 -1
- package/dist/shared/components/item-edit/RecordLiveSync.js +241 -229
- package/dist/shared/components/item-edit/RecordRecapChanges.js +166 -0
- package/dist/shared/components/item-edit/RecordRecapStrip.js +254 -84
- package/dist/shared/components/item-edit/live-related.js +34 -18
- package/dist/shared/components/panels/RevisionsPanel.js +735 -683
- package/dist/shared/components/queue/QueueWorklist.js +323 -316
- package/dist/shared/components/support/SupportRequestDialog.js +198 -181
- package/dist/shared/components/trackers/use-tracker-link.js +74 -65
- package/dist/shared/lib/config-update-refresh.js +34 -0
- package/dist/shared/lib/config-watch.js +17 -17
- package/dist/shared/lib/gap-refresh.js +49 -0
- package/dist/shared/lib/integration-dots.js +8 -8
- package/dist/shared/lib/live-ops.js +26 -23
- package/dist/shared/lib/live-pickers.js +1 -1
- package/dist/shared/lib/live-queries.js +223 -195
- package/dist/shared/lib/live.js +56 -51
- package/dist/shared/lib/obligation-banner.js +11 -10
- package/dist/shared/lib/obligation-filters.js +22 -18
- package/dist/shared/lib/obligation-reason-text.js +18 -8
- package/dist/shared/lib/presence-hooks.js +133 -132
- package/dist/shared/lib/reconnect-resync.js +90 -0
- package/dist/shared/lib/record-room-holds.js +43 -0
- package/dist/shared/lib/socket-realtime.js +116 -105
- package/dist/shared/lib/user-sync.js +1 -6
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as N } from "react/jsx-runtime";
|
|
2
|
+
import { Check as k, Copy as y, ChevronRight as w } from "lucide-react";
|
|
3
|
+
import { useState as m } from "react";
|
|
4
|
+
import { cn as v } from "../../../lib/utils.js";
|
|
5
|
+
const u = 600;
|
|
6
|
+
function S({ value: e }) {
|
|
7
|
+
const [r, o] = m(!1), i = e.length > u, n = i && !r ? `${e.slice(0, u)}…` : e;
|
|
8
|
+
return /* @__PURE__ */ s("span", { className: "whitespace-pre-wrap break-words text-emerald-800 dark:text-[#b9d3a6]", children: [
|
|
9
|
+
'"',
|
|
10
|
+
n,
|
|
11
|
+
'"',
|
|
12
|
+
i && /* @__PURE__ */ t(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
type: "button",
|
|
16
|
+
onClick: () => o(!r),
|
|
17
|
+
className: "ml-1.5 rounded px-1 font-sans text-[10.5px] text-nvr-cyan underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
18
|
+
children: r ? "show less" : `show all ${e.length.toLocaleString("en-US")} characters`
|
|
19
|
+
}
|
|
20
|
+
)
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
function C({ value: e }) {
|
|
24
|
+
return e === null ? /* @__PURE__ */ t("span", { className: "text-violet-700 dark:text-[#c8b6e2]", children: "null" }) : typeof e == "string" ? /* @__PURE__ */ t(S, { value: e }) : typeof e == "number" ? /* @__PURE__ */ t("span", { className: "text-sky-800 dark:text-[#b3c4dd]", children: String(e) }) : typeof e == "boolean" ? /* @__PURE__ */ t("span", { className: "text-violet-700 dark:text-[#c8b6e2]", children: String(e) }) : /* @__PURE__ */ t("span", { children: String(e) });
|
|
25
|
+
}
|
|
26
|
+
function b({
|
|
27
|
+
name: e,
|
|
28
|
+
value: r,
|
|
29
|
+
depth: o,
|
|
30
|
+
foldKeys: i
|
|
31
|
+
}) {
|
|
32
|
+
const n = Array.isArray(r), d = !!r && typeof r == "object", l = o < 2 && !(e && i.has(e)), [a, x] = m(l), f = e != null && /* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
33
|
+
/^\d+$/.test(e) ? e : `"${e}"`,
|
|
34
|
+
":",
|
|
35
|
+
" "
|
|
36
|
+
] });
|
|
37
|
+
if (!d)
|
|
38
|
+
return /* @__PURE__ */ s("div", { className: "pl-4", children: [
|
|
39
|
+
f,
|
|
40
|
+
/* @__PURE__ */ t(C, { value: r })
|
|
41
|
+
] });
|
|
42
|
+
const c = n ? r.map((p, h) => [String(h), p]) : Object.entries(r), g = n ? `[${c.length} ${c.length === 1 ? "item" : "items"}]` : `{${c.length} ${c.length === 1 ? "key" : "keys"}}`;
|
|
43
|
+
return /* @__PURE__ */ s("div", { className: o > 0 ? "pl-4" : "", children: [
|
|
44
|
+
/* @__PURE__ */ s(
|
|
45
|
+
"button",
|
|
46
|
+
{
|
|
47
|
+
type: "button",
|
|
48
|
+
onClick: () => x(!a),
|
|
49
|
+
"aria-expanded": a,
|
|
50
|
+
className: "-ml-4 inline-flex items-center gap-0.5 rounded text-left hover:bg-slate-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ t(
|
|
53
|
+
w,
|
|
54
|
+
{
|
|
55
|
+
className: v(
|
|
56
|
+
"h-3 w-3 shrink-0 text-slate-400 transition-transform duration-150 motion-reduce:transition-none",
|
|
57
|
+
a && "rotate-90"
|
|
58
|
+
),
|
|
59
|
+
"aria-hidden": !0
|
|
60
|
+
}
|
|
61
|
+
),
|
|
62
|
+
f,
|
|
63
|
+
!a && /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-muted-foreground", children: g }),
|
|
64
|
+
a && /* @__PURE__ */ t("span", { className: "text-slate-400", children: n ? "[" : "{" })
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
a && /* @__PURE__ */ s(N, { children: [
|
|
69
|
+
c.map(([p, h]) => /* @__PURE__ */ t(b, { name: p, value: h, depth: o + 1, foldKeys: i }, p)),
|
|
70
|
+
/* @__PURE__ */ t("div", { className: "text-slate-400", children: n ? "]" : "}" })
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
function R({
|
|
75
|
+
value: e,
|
|
76
|
+
text: r,
|
|
77
|
+
cut: o,
|
|
78
|
+
foldKeys: i = [],
|
|
79
|
+
label: n
|
|
80
|
+
}) {
|
|
81
|
+
const [d, l] = m(!1), a = async () => {
|
|
82
|
+
try {
|
|
83
|
+
await navigator.clipboard.writeText(
|
|
84
|
+
e != null ? JSON.stringify(e, null, 2) : r ?? ""
|
|
85
|
+
), l(!0), setTimeout(() => l(!1), 1500);
|
|
86
|
+
} catch {
|
|
87
|
+
l(!1);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
return /* @__PURE__ */ s(
|
|
91
|
+
"section",
|
|
92
|
+
{
|
|
93
|
+
"aria-label": n,
|
|
94
|
+
className: "min-w-0 rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ s("header", { className: "flex items-center gap-2 border-b border-slate-100 px-3 py-1.5 dark:border-border/60", children: [
|
|
97
|
+
/* @__PURE__ */ t("h4", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: n }),
|
|
98
|
+
o && /* @__PURE__ */ t(
|
|
99
|
+
"span",
|
|
100
|
+
{
|
|
101
|
+
className: "rounded bg-amber-50 px-1.5 py-px text-[10.5px] text-amber-800 dark:bg-[#d4936a]/10 dark:text-[#e2b192]",
|
|
102
|
+
"data-tip": "The log keeps the first 48 KB of a request and 16 KB of a response",
|
|
103
|
+
children: "cut at the log's size limit"
|
|
104
|
+
}
|
|
105
|
+
),
|
|
106
|
+
/* @__PURE__ */ s(
|
|
107
|
+
"button",
|
|
108
|
+
{
|
|
109
|
+
type: "button",
|
|
110
|
+
onClick: () => void a(),
|
|
111
|
+
className: "ml-auto inline-flex h-6 items-center gap-1 rounded px-1.5 text-[11px] text-slate-500 hover:bg-slate-100 hover:text-slate-800 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-muted-foreground dark:hover:bg-muted dark:hover:text-foreground",
|
|
112
|
+
children: [
|
|
113
|
+
d ? /* @__PURE__ */ t(k, { className: "h-3 w-3", "aria-hidden": !0 }) : /* @__PURE__ */ t(y, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
114
|
+
d ? "Copied" : "Copy"
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] }),
|
|
119
|
+
/* @__PURE__ */ t("div", { className: "max-h-[60vh] overflow-auto px-3 py-2 pl-7 font-mono text-[11px] leading-[1.55]", children: e != null ? /* @__PURE__ */ t(b, { name: null, value: e, depth: 0, foldKeys: new Set(i) }) : r ? /* @__PURE__ */ t("pre", { className: "whitespace-pre-wrap break-words", children: r }) : /* @__PURE__ */ t("span", { className: "font-sans text-slate-500", children: "Not stored." }) })
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
export {
|
|
125
|
+
R as RawJson
|
|
126
|
+
};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useQuery as k } from "@tanstack/react-query";
|
|
3
|
+
import { ArrowLeft as v, Wrench as N, ChevronRight as w, ThumbsUp as y, ThumbsDown as _ } from "lucide-react";
|
|
4
|
+
import { useState as T, useRef as C, useEffect as q } from "react";
|
|
5
|
+
import { useNivaroClient as S } from "../../../context.js";
|
|
6
|
+
import { get as $ } from "../../../lib/commands.js";
|
|
7
|
+
import { cn as m } from "../../../lib/utils.js";
|
|
8
|
+
import { QueryErrorState as L } from "../../QueryErrorState.js";
|
|
9
|
+
import { SheetTitle as A } from "../../ui/sheet.js";
|
|
10
|
+
import { Skeleton as f } from "../../ui/skeleton.js";
|
|
11
|
+
import { AiMarkdown as R } from "../AiMarkdown.js";
|
|
12
|
+
import { num as b, usd as x, tok as g, secs as p, whenShort as j, resultLabel as E, resultOf as F } from "./format.js";
|
|
13
|
+
import { Fold as O } from "./TranscriptView.js";
|
|
14
|
+
function Q({ f: e }) {
|
|
15
|
+
return /* @__PURE__ */ s("li", { className: "flex items-start gap-1.5 text-[11.5px]", children: [
|
|
16
|
+
e.rating > 0 ? /* @__PURE__ */ t(
|
|
17
|
+
y,
|
|
18
|
+
{
|
|
19
|
+
className: "mt-0.5 h-3 w-3 text-green-700 dark:text-[#b9d3a6]",
|
|
20
|
+
"aria-label": "Thumbs up"
|
|
21
|
+
}
|
|
22
|
+
) : /* @__PURE__ */ t(
|
|
23
|
+
_,
|
|
24
|
+
{
|
|
25
|
+
className: "mt-0.5 h-3 w-3 text-red-700 dark:text-[#eaa3a3]",
|
|
26
|
+
"aria-label": "Thumbs down"
|
|
27
|
+
}
|
|
28
|
+
),
|
|
29
|
+
/* @__PURE__ */ s("span", { className: "text-slate-600 dark:text-slate-300", children: [
|
|
30
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: e.user_name }),
|
|
31
|
+
e.comment ? ` — ${e.comment}` : ""
|
|
32
|
+
] })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
function V({
|
|
36
|
+
turn: e,
|
|
37
|
+
index: c,
|
|
38
|
+
focused: n,
|
|
39
|
+
currentCall: h,
|
|
40
|
+
onOpenCall: o
|
|
41
|
+
}) {
|
|
42
|
+
const [a, u] = T(n), i = C(null);
|
|
43
|
+
return q(() => {
|
|
44
|
+
var r;
|
|
45
|
+
n && ((r = i.current) == null || r.scrollIntoView({ block: "start", behavior: "smooth" }));
|
|
46
|
+
}, [n]), /* @__PURE__ */ s(
|
|
47
|
+
"li",
|
|
48
|
+
{
|
|
49
|
+
ref: i,
|
|
50
|
+
"data-ai-thread-turn": c,
|
|
51
|
+
className: m(
|
|
52
|
+
"scroll-mt-3 rounded-lg border bg-white dark:bg-card",
|
|
53
|
+
n ? "border-nvr-cyan/60 ring-1 ring-nvr-cyan/30" : "border-slate-200 dark:border-border"
|
|
54
|
+
),
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-0.5 border-b border-slate-100 px-3 py-1.5 text-[11px] text-slate-500 dark:border-border/60 dark:text-muted-foreground", children: [
|
|
57
|
+
/* @__PURE__ */ s("span", { className: "font-semibold text-slate-700 dark:text-slate-200", children: [
|
|
58
|
+
"Turn ",
|
|
59
|
+
c
|
|
60
|
+
] }),
|
|
61
|
+
e.asked_by && /* @__PURE__ */ t("span", { children: e.asked_by }),
|
|
62
|
+
e.asked_at && /* @__PURE__ */ t("span", { children: j(e.asked_at) }),
|
|
63
|
+
n && /* @__PURE__ */ t("span", { className: "rounded-full bg-nvr-cyan/15 px-2 py-px font-medium text-slate-800 dark:text-foreground", children: "this call's turn" }),
|
|
64
|
+
/* @__PURE__ */ t("span", { className: "ml-auto tabular-nums", children: e.calls.length > 0 ? `${x(e.cost_usd)} · ${g(e.tokens)} tokens · ${p(e.latency_ms)}` : "" })
|
|
65
|
+
] }),
|
|
66
|
+
/* @__PURE__ */ s("div", { className: "flex flex-col gap-2.5 px-3 py-3", children: [
|
|
67
|
+
e.question ? /* @__PURE__ */ t("div", { className: "rounded-lg bg-slate-100 px-3 py-2 text-[13px] leading-relaxed text-slate-900 dark:bg-muted dark:text-foreground", children: /* @__PURE__ */ t("p", { className: "whitespace-pre-wrap break-words", children: e.question }) }) : e.withheld ? /* @__PURE__ */ t("p", { className: "text-[12px] italic text-slate-500", children: "This message was removed." }) : null,
|
|
68
|
+
e.trace.length > 0 && /* @__PURE__ */ t("ul", { className: "flex flex-wrap gap-1.5", children: e.trace.map((r, l) => /* @__PURE__ */ s(
|
|
69
|
+
"li",
|
|
70
|
+
{
|
|
71
|
+
className: m(
|
|
72
|
+
"inline-flex max-w-full items-center gap-1 rounded-full border px-2 py-px text-[11px]",
|
|
73
|
+
r.error ? "border-red-200 bg-red-50 text-red-800 dark:border-[#e08383]/30 dark:bg-[#e08383]/10 dark:text-[#eaa3a3]" : "border-slate-200 bg-slate-50 text-slate-600 dark:border-border dark:bg-muted dark:text-muted-foreground"
|
|
74
|
+
),
|
|
75
|
+
"data-tip": r.summary ?? void 0,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ t(N, { className: "h-3 w-3 shrink-0", "aria-hidden": !0 }),
|
|
78
|
+
/* @__PURE__ */ t("span", { className: "font-mono", children: r.tool }),
|
|
79
|
+
r.summary && /* @__PURE__ */ s("span", { className: "truncate", children: [
|
|
80
|
+
"· ",
|
|
81
|
+
r.summary
|
|
82
|
+
] })
|
|
83
|
+
]
|
|
84
|
+
},
|
|
85
|
+
l
|
|
86
|
+
)) }),
|
|
87
|
+
e.answer != null ? /* @__PURE__ */ t(R, { content: e.answer, className: "text-[13px]" }) : e.withheld ? /* @__PURE__ */ t("p", { className: "text-[12px] italic text-slate-500", children: "This answer was withheld (its author's access only)." }) : /* @__PURE__ */ t("p", { className: "text-[12px] italic text-slate-500", children: "No answer was stored." }),
|
|
88
|
+
e.feedback.length > 0 && /* @__PURE__ */ t("ul", { className: "flex flex-col gap-1", children: e.feedback.map((r, l) => (
|
|
89
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: feedback in order
|
|
90
|
+
/* @__PURE__ */ t(Q, { f: r }, l)
|
|
91
|
+
)) }),
|
|
92
|
+
e.calls.length > 0 && /* @__PURE__ */ s("div", { children: [
|
|
93
|
+
/* @__PURE__ */ s(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
type: "button",
|
|
97
|
+
onClick: () => u(!a),
|
|
98
|
+
"aria-expanded": a,
|
|
99
|
+
className: "inline-flex items-center gap-1 rounded text-[11.5px] text-slate-600 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-muted-foreground dark:hover:text-foreground",
|
|
100
|
+
children: [
|
|
101
|
+
/* @__PURE__ */ t(
|
|
102
|
+
w,
|
|
103
|
+
{
|
|
104
|
+
className: m(
|
|
105
|
+
"h-3 w-3 transition-transform duration-150 motion-reduce:transition-none",
|
|
106
|
+
a && "rotate-90"
|
|
107
|
+
),
|
|
108
|
+
"aria-hidden": !0
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
e.calls.length,
|
|
112
|
+
" model ",
|
|
113
|
+
e.calls.length === 1 ? "call" : "calls"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ t(O, { open: a, children: /* @__PURE__ */ t("ul", { className: "mt-1.5 divide-y divide-slate-100 rounded-md border border-slate-100 text-[11.5px] dark:divide-border/60 dark:border-border/60", children: e.calls.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ s(
|
|
118
|
+
"button",
|
|
119
|
+
{
|
|
120
|
+
type: "button",
|
|
121
|
+
onClick: () => o(r.id),
|
|
122
|
+
className: m(
|
|
123
|
+
"grid w-full grid-cols-[1fr_auto] items-center gap-x-3 px-2.5 py-1.5 text-left hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-nvr-cyan/50 dark:hover:bg-muted/40",
|
|
124
|
+
h === r.id && "bg-nvr-cyan/10"
|
|
125
|
+
),
|
|
126
|
+
children: [
|
|
127
|
+
/* @__PURE__ */ s("span", { className: "min-w-0 truncate", children: [
|
|
128
|
+
/* @__PURE__ */ t("span", { className: "font-mono text-[11px]", children: r.model }),
|
|
129
|
+
/* @__PURE__ */ s("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
|
|
130
|
+
" ",
|
|
131
|
+
"· ",
|
|
132
|
+
E(F(r)),
|
|
133
|
+
r.tools.length ? ` · ${r.tools.join(", ")}` : ""
|
|
134
|
+
] })
|
|
135
|
+
] }),
|
|
136
|
+
/* @__PURE__ */ s("span", { className: "tabular-nums text-slate-500 dark:text-muted-foreground", children: [
|
|
137
|
+
x(r.cost_usd, 3),
|
|
138
|
+
" · ",
|
|
139
|
+
p(r.latency_ms)
|
|
140
|
+
] })
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
) }, r.id)) }) })
|
|
144
|
+
] })
|
|
145
|
+
] })
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function Y({
|
|
151
|
+
callId: e,
|
|
152
|
+
onBack: c,
|
|
153
|
+
onOpenCall: n
|
|
154
|
+
}) {
|
|
155
|
+
var i, r;
|
|
156
|
+
const h = S(), o = k({
|
|
157
|
+
queryKey: ["nvr-ai-call-thread", e],
|
|
158
|
+
queryFn: () => h.request($("/ai/call-log/thread", { call: String(e) }))
|
|
159
|
+
}), a = (i = o.data) == null ? void 0 : i.data, u = (a == null ? void 0 : a.turns.findIndex(
|
|
160
|
+
(l) => a.focus_message_id && l.answer_id === a.focus_message_id || l.calls.some((d) => d.id === e)
|
|
161
|
+
)) ?? -1;
|
|
162
|
+
return /* @__PURE__ */ s("div", { className: "flex min-h-0 flex-1 flex-col animate-in fade-in-0 slide-in-from-right-6 duration-200 motion-reduce:animate-none", children: [
|
|
163
|
+
/* @__PURE__ */ s("div", { className: "shrink-0 border-b border-slate-200 px-5 pb-3 pt-4 pr-12 dark:border-border", children: [
|
|
164
|
+
/* @__PURE__ */ s(
|
|
165
|
+
"button",
|
|
166
|
+
{
|
|
167
|
+
type: "button",
|
|
168
|
+
onClick: c,
|
|
169
|
+
className: "mb-1.5 inline-flex items-center gap-1 rounded text-[12px] text-slate-500 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-muted-foreground dark:hover:text-foreground",
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ t(v, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
172
|
+
" Back to the call"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
/* @__PURE__ */ t(A, { className: "line-clamp-2 text-[16px] font-semibold tracking-[-0.01em] text-slate-900 dark:text-foreground", children: ((r = a == null ? void 0 : a.conversation) == null ? void 0 : r.title) || (a ? "Conversation" : "Loading the conversation…") }),
|
|
177
|
+
a && /* @__PURE__ */ s("p", { className: "mt-1 text-[12px] text-slate-500 dark:text-muted-foreground", children: [
|
|
178
|
+
a.conversation ? `${a.conversation.owner_name}'s conversation · ` : "Rebuilt from what the model was sent (no saved thread) · ",
|
|
179
|
+
b(a.totals.turns),
|
|
180
|
+
" ",
|
|
181
|
+
a.totals.turns === 1 ? "turn" : "turns",
|
|
182
|
+
" · ",
|
|
183
|
+
b(a.totals.calls),
|
|
184
|
+
" ",
|
|
185
|
+
"model calls · ",
|
|
186
|
+
x(a.totals.cost_usd),
|
|
187
|
+
" · ",
|
|
188
|
+
g(a.totals.tokens),
|
|
189
|
+
" tokens ·",
|
|
190
|
+
" ",
|
|
191
|
+
p(a.totals.latency_ms),
|
|
192
|
+
" in the model"
|
|
193
|
+
] })
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ s("div", { className: "min-h-0 flex-1 overflow-y-auto bg-slate-50 px-4 py-4 dark:bg-background sm:px-5", children: [
|
|
196
|
+
o.isLoading ? /* @__PURE__ */ s("div", { className: "flex flex-col gap-3", children: [
|
|
197
|
+
/* @__PURE__ */ t(f, { className: "h-24 w-full" }),
|
|
198
|
+
/* @__PURE__ */ t(f, { className: "h-32 w-full" })
|
|
199
|
+
] }) : o.isError ? /* @__PURE__ */ t(
|
|
200
|
+
L,
|
|
201
|
+
{
|
|
202
|
+
error: o.error,
|
|
203
|
+
what: "the conversation",
|
|
204
|
+
onRetry: () => void o.refetch()
|
|
205
|
+
}
|
|
206
|
+
) : a != null && a.turns.length ? /* @__PURE__ */ t("ol", { className: "flex flex-col gap-3", children: a.turns.map((l, d) => /* @__PURE__ */ t(
|
|
207
|
+
V,
|
|
208
|
+
{
|
|
209
|
+
turn: l,
|
|
210
|
+
index: d + 1,
|
|
211
|
+
focused: d === u,
|
|
212
|
+
currentCall: e,
|
|
213
|
+
onOpenCall: n
|
|
214
|
+
},
|
|
215
|
+
l.question_id || l.answer_id || d
|
|
216
|
+
)) }) : /* @__PURE__ */ t("p", { className: "text-[12.5px] text-slate-500", children: "This conversation has no turns left." }),
|
|
217
|
+
(a == null ? void 0 : a.reconstructed) && /* @__PURE__ */ t("p", { className: "mt-3 text-[11.5px] text-slate-500 dark:text-muted-foreground", children: "The person's Ask AI history was off for this question (or it came from the chat bot), so there is no saved thread: the earlier turns are what the model was sent with it." })
|
|
218
|
+
] })
|
|
219
|
+
] });
|
|
220
|
+
}
|
|
221
|
+
export {
|
|
222
|
+
Y as ThreadView
|
|
223
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { jsxs as r, jsx as e, Fragment as f } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronRight as b, MessageSquare as N, FileText as v, Wrench as y, AlertTriangle as _ } from "lucide-react";
|
|
3
|
+
import { useState as g } from "react";
|
|
4
|
+
import { cn as x } from "../../../lib/utils.js";
|
|
5
|
+
import { AiMarkdown as h } from "../AiMarkdown.js";
|
|
6
|
+
import { num as p } from "./format.js";
|
|
7
|
+
function k({ open: t, children: l }) {
|
|
8
|
+
return /* @__PURE__ */ e(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
className: x(
|
|
12
|
+
"grid transition-[grid-template-rows,opacity] duration-200 ease-out motion-reduce:transition-none",
|
|
13
|
+
t ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"
|
|
14
|
+
),
|
|
15
|
+
"aria-hidden": !t,
|
|
16
|
+
children: /* @__PURE__ */ e("div", { className: "min-h-0 overflow-hidden", children: t ? l : null })
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
function q({
|
|
21
|
+
step: t,
|
|
22
|
+
index: l,
|
|
23
|
+
onNextCall: m
|
|
24
|
+
}) {
|
|
25
|
+
const [d, o] = g(!1), a = t.result;
|
|
26
|
+
return /* @__PURE__ */ r(
|
|
27
|
+
"li",
|
|
28
|
+
{
|
|
29
|
+
"data-ai-tool-step": t.name,
|
|
30
|
+
className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
|
|
31
|
+
children: [
|
|
32
|
+
/* @__PURE__ */ r("div", { className: "flex flex-wrap items-center gap-2 px-3 pt-2.5", children: [
|
|
33
|
+
/* @__PURE__ */ e(y, { className: "h-3.5 w-3.5 text-slate-400", "aria-hidden": !0 }),
|
|
34
|
+
/* @__PURE__ */ e("span", { className: "font-mono text-[12px] font-semibold text-slate-800 dark:text-slate-100", children: t.name }),
|
|
35
|
+
/* @__PURE__ */ r("span", { className: "text-[11px] text-slate-400", children: [
|
|
36
|
+
"step ",
|
|
37
|
+
l
|
|
38
|
+
] }),
|
|
39
|
+
t.from_this_call && /* @__PURE__ */ e(
|
|
40
|
+
"span",
|
|
41
|
+
{
|
|
42
|
+
className: "rounded-full border border-sky-200 bg-sky-50 px-2 py-px text-[10.5px] font-medium text-sky-800 dark:border-[#8fa6c9]/30 dark:bg-[#8fa6c9]/10 dark:text-[#b3c4dd]",
|
|
43
|
+
"data-tip": "This call asked for the tool; its result went into the next call of the same question",
|
|
44
|
+
children: "asked by this call"
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
] }),
|
|
48
|
+
t.input.length > 0 && /* @__PURE__ */ e("dl", { className: "mx-3 mt-2 grid grid-cols-[minmax(80px,max-content)_1fr] gap-x-3 gap-y-0.5 text-[11.5px]", children: t.input.map(([s, i]) => /* @__PURE__ */ r("div", { className: "contents", children: [
|
|
49
|
+
/* @__PURE__ */ e("dt", { className: "text-slate-500 dark:text-muted-foreground", children: s }),
|
|
50
|
+
/* @__PURE__ */ e("dd", { className: "min-w-0 break-words font-mono text-[11px] text-slate-800 dark:text-slate-200", children: i })
|
|
51
|
+
] }, s)) }),
|
|
52
|
+
/* @__PURE__ */ r("div", { className: "mt-2 border-t border-slate-100 px-3 py-2 text-[12px] dark:border-border/60", children: [
|
|
53
|
+
a == null ? /* @__PURE__ */ e("span", { className: "text-slate-500 dark:text-muted-foreground", children: t.from_this_call ? /* @__PURE__ */ r(f, { children: [
|
|
54
|
+
"The result went into the next call.",
|
|
55
|
+
" ",
|
|
56
|
+
m && /* @__PURE__ */ e(
|
|
57
|
+
"button",
|
|
58
|
+
{
|
|
59
|
+
type: "button",
|
|
60
|
+
onClick: m,
|
|
61
|
+
className: "rounded text-nvr-cyan underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
62
|
+
children: "Open it"
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
] }) : "No result was stored for this step." }) : a.error ? /* @__PURE__ */ r("span", { className: "inline-flex items-start gap-1.5 text-red-700 dark:text-[#eaa3a3]", children: [
|
|
66
|
+
/* @__PURE__ */ e(_, { className: "mt-0.5 h-3.5 w-3.5 shrink-0", "aria-hidden": !0 }),
|
|
67
|
+
/* @__PURE__ */ e("span", { className: "break-words", children: a.text })
|
|
68
|
+
] }) : /* @__PURE__ */ r("div", { className: "flex flex-wrap items-baseline gap-x-3 gap-y-1", children: [
|
|
69
|
+
/* @__PURE__ */ e("span", { className: "font-medium text-slate-800 dark:text-slate-100", children: a.rows != null ? `Returned ${a.text}` : "Returned" }),
|
|
70
|
+
a.columns.length > 0 && /* @__PURE__ */ e("span", { className: "min-w-0 truncate text-[11px] text-slate-500 dark:text-muted-foreground", children: a.columns.join(" · ") }),
|
|
71
|
+
a.rows == null && /* @__PURE__ */ e("span", { className: "w-full break-words text-[11.5px] text-slate-600 dark:text-slate-300", children: a.text }),
|
|
72
|
+
a.sample.length > 0 && /* @__PURE__ */ r(
|
|
73
|
+
"button",
|
|
74
|
+
{
|
|
75
|
+
type: "button",
|
|
76
|
+
onClick: () => o(!d),
|
|
77
|
+
"aria-expanded": d,
|
|
78
|
+
className: "ml-auto inline-flex items-center gap-0.5 rounded text-[11px] text-nvr-cyan hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ e(
|
|
81
|
+
b,
|
|
82
|
+
{
|
|
83
|
+
className: x(
|
|
84
|
+
"h-3 w-3 transition-transform duration-150 motion-reduce:transition-none",
|
|
85
|
+
d && "rotate-90"
|
|
86
|
+
),
|
|
87
|
+
"aria-hidden": !0
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
d ? "Hide rows" : a.sample.length === 1 ? "Peek at the row" : `Peek at ${Math.min(5, a.sample.length)} rows`
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }),
|
|
95
|
+
a && a.sample.length > 0 && /* @__PURE__ */ e(k, { open: d, children: /* @__PURE__ */ e("div", { className: "mt-2 overflow-x-auto rounded border border-slate-100 dark:border-border/60", children: /* @__PURE__ */ r("table", { className: "w-full text-left text-[11px]", children: [
|
|
96
|
+
/* @__PURE__ */ e("thead", { className: "bg-slate-50 text-slate-500 dark:bg-muted/40 dark:text-muted-foreground", children: /* @__PURE__ */ e("tr", { children: a.columns.map((s) => /* @__PURE__ */ e("th", { className: "whitespace-nowrap px-2 py-1 font-medium", children: s }, s)) }) }),
|
|
97
|
+
/* @__PURE__ */ e("tbody", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.sample.map((s, i) => (
|
|
98
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: a fixed peek of stored rows
|
|
99
|
+
/* @__PURE__ */ e("tr", { children: a.columns.map((n) => /* @__PURE__ */ e("td", { className: "max-w-[220px] truncate px-2 py-1", children: s[n] }, n)) }, i)
|
|
100
|
+
)) })
|
|
101
|
+
] }) }) })
|
|
102
|
+
] })
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
function P({
|
|
108
|
+
t,
|
|
109
|
+
askedBy: l,
|
|
110
|
+
onShowRaw: m,
|
|
111
|
+
onNextCall: d
|
|
112
|
+
}) {
|
|
113
|
+
const [o, a] = g(!1);
|
|
114
|
+
let s = 0;
|
|
115
|
+
const i = [
|
|
116
|
+
t.hidden.system_chars > 0 && `the system prompt (${p(t.hidden.system_chars)} characters)`,
|
|
117
|
+
t.hidden.tool_definitions > 0 && `${t.hidden.tool_definitions} tool definition${t.hidden.tool_definitions === 1 ? "" : "s"}`,
|
|
118
|
+
t.hidden.cache_markers > 0 && `${t.hidden.cache_markers} cache marker${t.hidden.cache_markers === 1 ? "" : "s"}`
|
|
119
|
+
].filter(Boolean);
|
|
120
|
+
return /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-col gap-3", "data-ai-transcript": !0, children: [
|
|
121
|
+
t.unreadable && /* @__PURE__ */ r("p", { className: "rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-[12px] text-amber-900 dark:border-[#d4936a]/30 dark:bg-[#d4936a]/10 dark:text-[#e2b192]", children: [
|
|
122
|
+
"This call was logged before the readable log: its stored request ran out of room inside the system prompt, so the messages were not kept.",
|
|
123
|
+
" ",
|
|
124
|
+
/* @__PURE__ */ e("button", { type: "button", onClick: m, className: "underline", children: "View raw" })
|
|
125
|
+
] }),
|
|
126
|
+
t.earlier.length > 0 && /* @__PURE__ */ r("div", { className: "rounded-lg border border-dashed border-slate-300 dark:border-border", children: [
|
|
127
|
+
/* @__PURE__ */ r(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
type: "button",
|
|
131
|
+
onClick: () => a(!o),
|
|
132
|
+
"aria-expanded": o,
|
|
133
|
+
className: "flex w-full items-center gap-1.5 rounded-lg px-3 py-2 text-left text-[12px] text-slate-600 hover:bg-slate-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50 dark:text-muted-foreground dark:hover:bg-muted/40",
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ e(
|
|
136
|
+
b,
|
|
137
|
+
{
|
|
138
|
+
className: x(
|
|
139
|
+
"h-3.5 w-3.5 transition-transform duration-150 motion-reduce:transition-none",
|
|
140
|
+
o && "rotate-90"
|
|
141
|
+
),
|
|
142
|
+
"aria-hidden": !0
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
"Earlier in this conversation · ",
|
|
146
|
+
t.earlier.length,
|
|
147
|
+
" ",
|
|
148
|
+
t.earlier.length === 1 ? "message" : "messages",
|
|
149
|
+
" the model was also sent"
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
/* @__PURE__ */ e(k, { open: o, children: /* @__PURE__ */ e("ol", { className: "flex flex-col gap-2 px-3 pb-3", children: t.earlier.map((n, c) => (
|
|
154
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: turns in their stored order
|
|
155
|
+
/* @__PURE__ */ r("li", { className: "text-[12px]", children: [
|
|
156
|
+
/* @__PURE__ */ e("div", { className: "mb-0.5 text-[10.5px] font-medium uppercase tracking-wide text-slate-400", children: n.role === "user" ? l ?? "The person" : "Ask AI" }),
|
|
157
|
+
n.role === "user" ? /* @__PURE__ */ e("p", { className: "whitespace-pre-wrap text-slate-700 dark:text-slate-300", children: n.text }) : /* @__PURE__ */ e(
|
|
158
|
+
h,
|
|
159
|
+
{
|
|
160
|
+
content: n.text,
|
|
161
|
+
className: "text-[12px] text-slate-600 dark:text-slate-300"
|
|
162
|
+
}
|
|
163
|
+
)
|
|
164
|
+
] }, c)
|
|
165
|
+
)) }) })
|
|
166
|
+
] }),
|
|
167
|
+
t.steps.length === 0 && !t.unreadable && /* @__PURE__ */ e("p", { className: "text-[12px] text-slate-500 dark:text-muted-foreground", children: "This call carried no message from a person (a background job or a one-shot helper)." }),
|
|
168
|
+
/* @__PURE__ */ e("ol", { className: "flex flex-col gap-3", children: t.steps.map((n, c) => n.kind === "question" ? (
|
|
169
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: steps in their stored order
|
|
170
|
+
/* @__PURE__ */ r("li", { "data-ai-question": !0, children: [
|
|
171
|
+
/* @__PURE__ */ r("div", { className: "mb-1 flex items-center gap-1.5 text-[11px] text-slate-500 dark:text-muted-foreground", children: [
|
|
172
|
+
/* @__PURE__ */ e(N, { className: "h-3.5 w-3.5", "aria-hidden": !0 }),
|
|
173
|
+
l ? `${l} asked` : "Asked"
|
|
174
|
+
] }),
|
|
175
|
+
/* @__PURE__ */ r("div", { className: "rounded-lg bg-slate-100 px-3 py-2.5 text-[13px] leading-relaxed text-slate-900 dark:bg-muted dark:text-foreground", children: [
|
|
176
|
+
/* @__PURE__ */ e("p", { className: "whitespace-pre-wrap break-words", children: n.text || "(no words, only files)" }),
|
|
177
|
+
n.attachments.length > 0 && /* @__PURE__ */ e("ul", { className: "mt-2 flex flex-wrap gap-1.5", children: n.attachments.map((u, w) => /* @__PURE__ */ r(
|
|
178
|
+
"li",
|
|
179
|
+
{
|
|
180
|
+
className: "inline-flex items-center gap-1 rounded border border-slate-200 bg-white px-1.5 py-0.5 text-[11px] text-slate-600 dark:border-border dark:bg-card dark:text-muted-foreground",
|
|
181
|
+
children: [
|
|
182
|
+
/* @__PURE__ */ e(v, { className: "h-3 w-3", "aria-hidden": !0 }),
|
|
183
|
+
u.name ?? u.media_type ?? u.type,
|
|
184
|
+
u.size_kb != null ? ` · ${p(u.size_kb)} KB` : ""
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
w
|
|
188
|
+
)) })
|
|
189
|
+
] })
|
|
190
|
+
] }, c)
|
|
191
|
+
) : n.kind === "note" ? /* @__PURE__ */ e(
|
|
192
|
+
"li",
|
|
193
|
+
{
|
|
194
|
+
className: "pl-1 text-[12px] italic text-slate-500 dark:text-muted-foreground",
|
|
195
|
+
children: n.text
|
|
196
|
+
},
|
|
197
|
+
c
|
|
198
|
+
) : n.kind === "tool" ? (s++, /* @__PURE__ */ e(q, { step: n, index: s, onNextCall: d }, c)) : (
|
|
199
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: steps in their stored order
|
|
200
|
+
/* @__PURE__ */ r("li", { "data-ai-answer": !0, children: [
|
|
201
|
+
/* @__PURE__ */ e("div", { className: "mb-1 text-[11px] text-slate-500 dark:text-muted-foreground", children: n.final ? "Ask AI answered" : "Ask AI said, then called tools" }),
|
|
202
|
+
/* @__PURE__ */ e("div", { className: "rounded-lg border border-slate-200 bg-white px-3.5 py-3 dark:border-border dark:bg-card", children: /* @__PURE__ */ e(h, { content: n.text, className: "text-[13px]" }) })
|
|
203
|
+
] }, c)
|
|
204
|
+
)) }),
|
|
205
|
+
(i.length > 0 || t.cut.request || t.cut.response) && /* @__PURE__ */ r("p", { className: "text-[11.5px] text-slate-500 dark:text-muted-foreground", children: [
|
|
206
|
+
i.length > 0 && /* @__PURE__ */ r(f, { children: [
|
|
207
|
+
"Left out here: ",
|
|
208
|
+
i.join(", "),
|
|
209
|
+
". "
|
|
210
|
+
] }),
|
|
211
|
+
(t.cut.request || t.cut.response) && `The stored ${t.cut.request && t.cut.response ? "request and response were" : t.cut.request ? "request was" : "response was"} cut at the log's size limit. `,
|
|
212
|
+
/* @__PURE__ */ e(
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
type: "button",
|
|
216
|
+
onClick: m,
|
|
217
|
+
className: "rounded text-nvr-cyan underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
|
|
218
|
+
children: "View raw"
|
|
219
|
+
}
|
|
220
|
+
)
|
|
221
|
+
] })
|
|
222
|
+
] });
|
|
223
|
+
}
|
|
224
|
+
export {
|
|
225
|
+
k as Fold,
|
|
226
|
+
P as TranscriptView
|
|
227
|
+
};
|