@nivaro/react 0.2.54 → 0.2.56
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 +99 -98
- package/dist/index.d.ts +367 -2
- package/dist/index.js +645 -616
- package/dist/layout-editor.d.ts +4 -0
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/ItemEditForm.js +4066 -3832
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +599 -552
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +76 -73
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +292 -279
- package/dist/shared/components/item-edit/GroupSection.js +698 -574
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +39 -32
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
- package/dist/shared/components/layout-editor/AddPanel.js +134 -117
- package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
- package/dist/shared/components/layout-editor/CollabParts.js +80 -75
- package/dist/shared/components/layout-editor/DesignNode.js +126 -120
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
- package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
- package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
- package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
- package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
- package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
- package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
- package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
- package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
- package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +81 -77
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
- package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
- package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +101 -52
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-ops.js +84 -82
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/stale-chunk.js +60 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { jsxs as n, jsx as t, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import { useQueryClient as z, useQuery as V, useInfiniteQuery as Z, useMutation as q } from "@tanstack/react-query";
|
|
3
|
+
import { Bot as G, Plug as H, Loader2 as k, ListChecks as X, KeyRound as Y, ChevronRight as J, AlertTriangle as ee, Undo2 as te } from "lucide-react";
|
|
4
|
+
import { useState as N, useRef as ae, useMemo as A, Fragment as ne } from "react";
|
|
5
|
+
import { useNivaroClient as re, useItemNavigation as E } from "../../context.js";
|
|
6
|
+
import { get as L, del as se, post as le } from "../../lib/commands.js";
|
|
7
|
+
import { cn as g, formatDate as w, formatRelative as M, formatNumber as f, formatDateTime as oe, formatFileSize as U } from "../../lib/utils.js";
|
|
8
|
+
import { SimpleSelectXs as ie } from "../ui/SimpleSelect.js";
|
|
9
|
+
import { Skeleton as de } from "../ui/skeleton.js";
|
|
10
|
+
import { SectionCard as R, EmptyLine as y, ConfirmButton as O, Pill as Q } from "./primitives.js";
|
|
11
|
+
const ce = {
|
|
12
|
+
oauth: "Signed in",
|
|
13
|
+
api_key: "API key",
|
|
14
|
+
token: "Personal token"
|
|
15
|
+
}, T = (e) => ["nvr-mcp-connections", e];
|
|
16
|
+
function me({ days: e }) {
|
|
17
|
+
const i = Math.max(1, ...e.map((r) => r.calls));
|
|
18
|
+
return /* @__PURE__ */ t("div", { className: "flex h-6 items-end gap-[2px]", "aria-hidden": !0, children: e.map((r) => {
|
|
19
|
+
const l = r.calls ? Math.max(3, Math.round(r.calls / i * 24)) : 2, d = r.errors + r.refused;
|
|
20
|
+
return /* @__PURE__ */ t(
|
|
21
|
+
"span",
|
|
22
|
+
{
|
|
23
|
+
"data-tip": `${w(`${r.day}T12:00:00Z`, { month: "short", day: "numeric" })}: ${f(r.calls)} call${r.calls === 1 ? "" : "s"}${d ? `, ${d} not ok` : ""}`,
|
|
24
|
+
className: g(
|
|
25
|
+
"relative w-[5px] overflow-hidden rounded-[1px]",
|
|
26
|
+
r.calls ? "bg-nvr-cyan/50 dark:bg-nvr-cyan/40" : "bg-slate-200 dark:bg-muted"
|
|
27
|
+
),
|
|
28
|
+
style: { height: l },
|
|
29
|
+
children: d > 0 && /* @__PURE__ */ t(
|
|
30
|
+
"span",
|
|
31
|
+
{
|
|
32
|
+
className: "absolute inset-x-0 bottom-0 bg-amber-500 dark:bg-amber-400",
|
|
33
|
+
style: { height: `${Math.round(d / r.calls * 100)}%` }
|
|
34
|
+
}
|
|
35
|
+
)
|
|
36
|
+
},
|
|
37
|
+
r.day
|
|
38
|
+
);
|
|
39
|
+
}) });
|
|
40
|
+
}
|
|
41
|
+
function pe({ s: e }) {
|
|
42
|
+
return !e || e.calls === 0 ? /* @__PURE__ */ t("span", { className: "text-[12px] text-slate-500 dark:text-slate-400", children: "No tool calls" }) : /* @__PURE__ */ n("span", { className: "text-[12px] tabular-nums text-slate-600 dark:text-slate-300", children: [
|
|
43
|
+
/* @__PURE__ */ t("b", { className: "font-semibold text-slate-800 dark:text-slate-100", children: f(e.calls) }),
|
|
44
|
+
" ",
|
|
45
|
+
"call",
|
|
46
|
+
e.calls === 1 ? "" : "s",
|
|
47
|
+
e.refused > 0 && /* @__PURE__ */ n("span", { className: "text-amber-700 dark:text-amber-400", children: [
|
|
48
|
+
" ",
|
|
49
|
+
"· ",
|
|
50
|
+
f(e.refused),
|
|
51
|
+
" refused"
|
|
52
|
+
] }),
|
|
53
|
+
e.errors > 0 && /* @__PURE__ */ n("span", { className: "text-red-600 dark:text-red-400", children: [
|
|
54
|
+
" · ",
|
|
55
|
+
f(e.errors),
|
|
56
|
+
" failed"
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ n("span", { className: "text-slate-500 dark:text-slate-400", children: [
|
|
59
|
+
" · ",
|
|
60
|
+
U(e.bytes)
|
|
61
|
+
] })
|
|
62
|
+
] });
|
|
63
|
+
}
|
|
64
|
+
function ue({ kind: e }) {
|
|
65
|
+
return /* @__PURE__ */ t(Q, { tone: e === "oauth" ? "brand" : "neutral", children: ce[e] });
|
|
66
|
+
}
|
|
67
|
+
function he({ c: e }) {
|
|
68
|
+
if (!e.idle || e.idle.status === "active") return null;
|
|
69
|
+
const i = w(`${e.idle.revoke_on}T12:00:00Z`, {
|
|
70
|
+
month: "short",
|
|
71
|
+
day: "numeric",
|
|
72
|
+
year: "numeric"
|
|
73
|
+
});
|
|
74
|
+
return /* @__PURE__ */ n("p", { className: "mt-1.5 flex items-center gap-1.5 text-[12px] text-amber-700 dark:text-amber-400", children: [
|
|
75
|
+
/* @__PURE__ */ t(ee, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
76
|
+
"Unused for ",
|
|
77
|
+
e.idle.idle_days,
|
|
78
|
+
" days — it will be disconnected on ",
|
|
79
|
+
i,
|
|
80
|
+
" unless it is used."
|
|
81
|
+
] });
|
|
82
|
+
}
|
|
83
|
+
const xe = {
|
|
84
|
+
ok: { label: "Done", tone: "green" },
|
|
85
|
+
refused: { label: "Refused", tone: "amber" },
|
|
86
|
+
error: { label: "Failed", tone: "red" }
|
|
87
|
+
}, be = {
|
|
88
|
+
create: "Created",
|
|
89
|
+
update: "Changed",
|
|
90
|
+
delete: "Deleted"
|
|
91
|
+
};
|
|
92
|
+
function K({ rows: e = 3 }) {
|
|
93
|
+
return /* @__PURE__ */ t("div", { className: "space-y-3", "aria-busy": "true", children: Array.from({ length: e }, (i, r) => /* @__PURE__ */ t(de, { className: "h-10 rounded-md" }, r)) });
|
|
94
|
+
}
|
|
95
|
+
function fe({
|
|
96
|
+
c: e,
|
|
97
|
+
onShowCalls: i,
|
|
98
|
+
onDisconnect: r,
|
|
99
|
+
disconnecting: l
|
|
100
|
+
}) {
|
|
101
|
+
var u, p, h;
|
|
102
|
+
const d = ((u = e.stats) == null ? void 0 : u.last_call_at) ?? e.last_used_at;
|
|
103
|
+
return /* @__PURE__ */ n("li", { className: "flex flex-wrap items-center gap-x-6 gap-y-3 py-3 first:pt-0 last:pb-0", children: [
|
|
104
|
+
/* @__PURE__ */ n("div", { className: "min-w-[220px] flex-1", children: [
|
|
105
|
+
/* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
106
|
+
/* @__PURE__ */ t("span", { className: "truncate text-[13px] font-semibold text-slate-800 dark:text-slate-100", children: e.name }),
|
|
107
|
+
/* @__PURE__ */ t(ue, { kind: e.kind })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ n("p", { className: "mt-0.5 text-[12px] text-slate-500 dark:text-slate-400", children: [
|
|
110
|
+
e.created_at ? `Connected ${w(e.created_at)}` : "Seen in the request log",
|
|
111
|
+
" · ",
|
|
112
|
+
d ? `last used ${M(d)}` : "never used"
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ t(he, { c: e })
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ n("div", { className: "flex min-w-[180px] flex-col gap-1", children: [
|
|
117
|
+
e.stats && /* @__PURE__ */ t(me, { days: e.stats.days }),
|
|
118
|
+
/* @__PURE__ */ t(pe, { s: e.stats })
|
|
119
|
+
] }),
|
|
120
|
+
/* @__PURE__ */ t("div", { className: "hidden min-w-[160px] flex-wrap gap-1 lg:flex", children: (((p = e.stats) == null ? void 0 : p.top_tools) ?? []).slice(0, 4).map((c) => /* @__PURE__ */ t(
|
|
121
|
+
"span",
|
|
122
|
+
{
|
|
123
|
+
"data-tip": `${f(c.calls)} call${c.calls === 1 ? "" : "s"}`,
|
|
124
|
+
className: "rounded bg-slate-100 px-1.5 py-px font-mono text-[11px] text-slate-600 dark:bg-muted dark:text-slate-300",
|
|
125
|
+
children: c.tool
|
|
126
|
+
},
|
|
127
|
+
c.tool
|
|
128
|
+
)) }),
|
|
129
|
+
/* @__PURE__ */ n("div", { className: "ml-auto flex items-center gap-1.5", children: [
|
|
130
|
+
(((h = e.stats) == null ? void 0 : h.calls) ?? 0) > 0 && /* @__PURE__ */ t(
|
|
131
|
+
"button",
|
|
132
|
+
{
|
|
133
|
+
type: "button",
|
|
134
|
+
onClick: i,
|
|
135
|
+
className: "h-7 rounded-md px-2 text-[12px] font-medium text-slate-600 transition-colors hover:bg-muted hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:text-slate-300 dark:hover:text-white",
|
|
136
|
+
children: "View calls"
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
e.kind === "oauth" && e.created_at ? /* @__PURE__ */ t(
|
|
140
|
+
O,
|
|
141
|
+
{
|
|
142
|
+
onConfirm: r,
|
|
143
|
+
disabled: l,
|
|
144
|
+
confirmLabel: "Disconnect now?",
|
|
145
|
+
title: `Disconnect ${e.name}`,
|
|
146
|
+
className: "h-7 rounded-md border border-slate-200 px-2.5 text-[12px] font-medium text-slate-700 transition-colors hover:border-red-300 hover:text-red-600 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-red-400/40 disabled:opacity-40 dark:border-border dark:text-slate-200 dark:hover:border-red-500/50 dark:hover:text-red-400",
|
|
147
|
+
armedClassName: "border-red-300 bg-red-50 text-red-700 dark:border-red-500/50 dark:bg-red-500/10 dark:text-red-400",
|
|
148
|
+
children: l ? /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5 animate-spin" }) : "Disconnect"
|
|
149
|
+
}
|
|
150
|
+
) : e.kind !== "oauth" ? /* @__PURE__ */ n(
|
|
151
|
+
"span",
|
|
152
|
+
{
|
|
153
|
+
className: "inline-flex items-center gap-1 text-[11.5px] text-slate-500 dark:text-slate-400",
|
|
154
|
+
"data-tip": "Switch it off from API keys (administrators)",
|
|
155
|
+
children: [
|
|
156
|
+
/* @__PURE__ */ t(Y, { className: "h-3.5 w-3.5" }),
|
|
157
|
+
" Managed by an administrator"
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
) : null
|
|
161
|
+
] })
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
function ge({
|
|
165
|
+
w: e,
|
|
166
|
+
onUndo: i,
|
|
167
|
+
undoing: r
|
|
168
|
+
}) {
|
|
169
|
+
const { urlFor: l, open: d } = E(), u = e.collection && e.item ? { collection: e.collection, itemId: e.item } : null;
|
|
170
|
+
return /* @__PURE__ */ n("li", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 py-1.5", children: [
|
|
171
|
+
/* @__PURE__ */ n("span", { className: "text-[12px] text-slate-700 dark:text-slate-200", children: [
|
|
172
|
+
be[e.action] ?? e.action,
|
|
173
|
+
" ",
|
|
174
|
+
u && e.action !== "delete" ? /* @__PURE__ */ n(
|
|
175
|
+
"a",
|
|
176
|
+
{
|
|
177
|
+
href: l(u),
|
|
178
|
+
onClick: (p) => {
|
|
179
|
+
p.metaKey || p.ctrlKey || (p.preventDefault(), d(u));
|
|
180
|
+
},
|
|
181
|
+
className: "font-mono text-[11.5px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
182
|
+
children: [
|
|
183
|
+
e.collection,
|
|
184
|
+
" #",
|
|
185
|
+
e.item
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
) : /* @__PURE__ */ n("span", { className: "font-mono text-[11.5px]", children: [
|
|
189
|
+
e.collection ?? "",
|
|
190
|
+
" ",
|
|
191
|
+
e.item ? `#${e.item}` : ""
|
|
192
|
+
] })
|
|
193
|
+
] }),
|
|
194
|
+
e.undoable ? /* @__PURE__ */ n(
|
|
195
|
+
O,
|
|
196
|
+
{
|
|
197
|
+
onConfirm: i,
|
|
198
|
+
disabled: r,
|
|
199
|
+
confirmLabel: e.action === "create" ? "Delete it?" : "Put it back?",
|
|
200
|
+
title: e.action === "create" ? "Undo: delete the record the agent created" : "Undo: put back the values from before",
|
|
201
|
+
className: "inline-flex h-6 items-center gap-1 rounded-md border border-slate-200 px-2 text-[11.5px] font-medium text-slate-700 transition-colors hover:border-nvr-cyan hover:text-nvr-navy focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 disabled:opacity-40 dark:border-border dark:text-slate-200 dark:hover:text-nvr-cyan",
|
|
202
|
+
armedClassName: "border-amber-300 bg-amber-50 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/10 dark:text-amber-300",
|
|
203
|
+
children: [
|
|
204
|
+
r ? /* @__PURE__ */ t(k, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ t(te, { className: "h-3 w-3" }),
|
|
205
|
+
"Undo"
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
) : /* @__PURE__ */ t("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: e.reason })
|
|
209
|
+
] });
|
|
210
|
+
}
|
|
211
|
+
function ye({
|
|
212
|
+
call: e,
|
|
213
|
+
onUndo: i,
|
|
214
|
+
undoingId: r
|
|
215
|
+
}) {
|
|
216
|
+
const [l, d] = N(!1), { urlFor: u, open: p } = E(), h = xe[e.outcome], c = e.writes.length > 0 || !!e.message, s = e.record, x = s != null && s.id ? { collection: s.collection, itemId: s.id } : null;
|
|
217
|
+
return /* @__PURE__ */ n(ne, { children: [
|
|
218
|
+
/* @__PURE__ */ n(
|
|
219
|
+
"tr",
|
|
220
|
+
{
|
|
221
|
+
className: g(
|
|
222
|
+
"border-b border-slate-100 align-middle last:border-0 dark:border-border/60",
|
|
223
|
+
c && "cursor-pointer hover:bg-muted/60"
|
|
224
|
+
),
|
|
225
|
+
onClick: () => c && d((o) => !o),
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ t("td", { className: "w-5 py-2 pl-1 pr-0", children: c && /* @__PURE__ */ t(
|
|
228
|
+
"button",
|
|
229
|
+
{
|
|
230
|
+
type: "button",
|
|
231
|
+
onClick: (o) => {
|
|
232
|
+
o.stopPropagation(), d((b) => !b);
|
|
233
|
+
},
|
|
234
|
+
"aria-expanded": l,
|
|
235
|
+
"aria-label": l ? "Hide what this call changed" : "Show what this call changed",
|
|
236
|
+
className: "flex h-5 w-5 items-center justify-center rounded text-slate-400 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:hover:text-slate-200",
|
|
237
|
+
children: /* @__PURE__ */ t(
|
|
238
|
+
J,
|
|
239
|
+
{
|
|
240
|
+
className: g(
|
|
241
|
+
"h-3.5 w-3.5 transition-transform duration-150",
|
|
242
|
+
l && "rotate-90"
|
|
243
|
+
)
|
|
244
|
+
}
|
|
245
|
+
)
|
|
246
|
+
}
|
|
247
|
+
) }),
|
|
248
|
+
/* @__PURE__ */ t(
|
|
249
|
+
"td",
|
|
250
|
+
{
|
|
251
|
+
className: "whitespace-nowrap py-2 pr-3 text-slate-500 dark:text-slate-400",
|
|
252
|
+
"data-tip": oe(e.at),
|
|
253
|
+
children: M(e.at)
|
|
254
|
+
}
|
|
255
|
+
),
|
|
256
|
+
/* @__PURE__ */ t("td", { className: "max-w-[160px] truncate py-2 pr-3 text-slate-700 dark:text-slate-200", children: e.app }),
|
|
257
|
+
/* @__PURE__ */ t("td", { className: "py-2 pr-3 font-mono text-[11.5px] text-slate-700 dark:text-slate-200", children: e.tool ?? "—" }),
|
|
258
|
+
/* @__PURE__ */ t("td", { className: "max-w-[220px] truncate py-2 pr-3", children: x ? /* @__PURE__ */ n(
|
|
259
|
+
"a",
|
|
260
|
+
{
|
|
261
|
+
href: u(x),
|
|
262
|
+
onClick: (o) => {
|
|
263
|
+
o.stopPropagation(), !(o.metaKey || o.ctrlKey) && (o.preventDefault(), p(x));
|
|
264
|
+
},
|
|
265
|
+
className: "font-mono text-[11.5px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
|
|
266
|
+
children: [
|
|
267
|
+
s == null ? void 0 : s.collection,
|
|
268
|
+
" #",
|
|
269
|
+
s == null ? void 0 : s.id
|
|
270
|
+
]
|
|
271
|
+
}
|
|
272
|
+
) : s ? /* @__PURE__ */ t("span", { className: "font-mono text-[11.5px] text-slate-600 dark:text-slate-300", children: s.collection }) : /* @__PURE__ */ t("span", { className: "text-slate-400 dark:text-slate-500", children: "—" }) }),
|
|
273
|
+
/* @__PURE__ */ t("td", { className: "py-2 pr-3", children: /* @__PURE__ */ n("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
274
|
+
/* @__PURE__ */ t(Q, { tone: h.tone, children: h.label }),
|
|
275
|
+
e.writes.length > 0 && /* @__PURE__ */ n("span", { className: "text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
276
|
+
e.writes.length,
|
|
277
|
+
" write",
|
|
278
|
+
e.writes.length === 1 ? "" : "s"
|
|
279
|
+
] })
|
|
280
|
+
] }) }),
|
|
281
|
+
/* @__PURE__ */ t("td", { className: "whitespace-nowrap py-2 pr-1 text-right tabular-nums text-slate-500 dark:text-slate-400", children: e.bytes != null ? U(e.bytes) : "" })
|
|
282
|
+
]
|
|
283
|
+
}
|
|
284
|
+
),
|
|
285
|
+
l && /* @__PURE__ */ n("tr", { className: "border-b border-slate-100 dark:border-border/60", children: [
|
|
286
|
+
/* @__PURE__ */ t("td", {}),
|
|
287
|
+
/* @__PURE__ */ n("td", { colSpan: 6, className: "pb-3 pr-3", children: [
|
|
288
|
+
e.message && /* @__PURE__ */ n("p", { className: "mb-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: [
|
|
289
|
+
/* @__PURE__ */ t("span", { className: "font-medium", children: e.outcome === "refused" ? "Nivaro said no: " : "It failed: " }),
|
|
290
|
+
e.message
|
|
291
|
+
] }),
|
|
292
|
+
e.writes.length > 0 && /* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: e.writes.map((o) => /* @__PURE__ */ t(
|
|
293
|
+
ge,
|
|
294
|
+
{
|
|
295
|
+
w: o,
|
|
296
|
+
onUndo: () => i(o),
|
|
297
|
+
undoing: r === o.activity_id
|
|
298
|
+
},
|
|
299
|
+
o.activity_id
|
|
300
|
+
)) }),
|
|
301
|
+
/* @__PURE__ */ n("p", { className: "mt-1 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
302
|
+
e.api_calls,
|
|
303
|
+
" request",
|
|
304
|
+
e.api_calls === 1 ? "" : "s",
|
|
305
|
+
" into Nivaro · ",
|
|
306
|
+
e.ms,
|
|
307
|
+
" ms"
|
|
308
|
+
] })
|
|
309
|
+
] })
|
|
310
|
+
] })
|
|
311
|
+
] });
|
|
312
|
+
}
|
|
313
|
+
function De({ className: e }) {
|
|
314
|
+
var P, S, $, F, D, I;
|
|
315
|
+
const i = re(), r = z(), [l, d] = N(""), u = ae(null), [p, h] = N(null), c = V({
|
|
316
|
+
queryKey: T("mine"),
|
|
317
|
+
queryFn: () => i.request(L("/mcp-connections/mine")).then((a) => a.data)
|
|
318
|
+
}), s = Z({
|
|
319
|
+
queryKey: ["nvr-mcp-activity", l],
|
|
320
|
+
initialPageParam: null,
|
|
321
|
+
queryFn: ({ pageParam: a }) => i.request(
|
|
322
|
+
L(
|
|
323
|
+
"/mcp-connections/mine/activity",
|
|
324
|
+
{ ...l ? { conn: l } : {}, ...a ? { before: a } : {}, limit: 50 }
|
|
325
|
+
)
|
|
326
|
+
).then((m) => m.data),
|
|
327
|
+
getNextPageParam: (a) => a.next_before
|
|
328
|
+
}), x = q({
|
|
329
|
+
mutationFn: (a) => i.request(se(`/mcp-connections/mine/${a}`)),
|
|
330
|
+
onSuccess: () => {
|
|
331
|
+
h({ tone: "ok", text: "Disconnected. Its tokens stopped working at once." }), r.invalidateQueries({ queryKey: T("mine") });
|
|
332
|
+
},
|
|
333
|
+
onError: (a) => h({ tone: "bad", text: (a == null ? void 0 : a.message) || "Could not disconnect" })
|
|
334
|
+
}), o = q({
|
|
335
|
+
mutationFn: (a) => i.request(le(`/mcp-connections/mine/activity/${a.activity_id}/undo`)),
|
|
336
|
+
onSuccess: (a, m) => {
|
|
337
|
+
h({
|
|
338
|
+
tone: "ok",
|
|
339
|
+
text: m.action === "create" ? "Undone — the record was deleted." : "Undone — the previous values are back."
|
|
340
|
+
}), r.invalidateQueries({ queryKey: ["nvr-mcp-activity"] });
|
|
341
|
+
},
|
|
342
|
+
onError: (a) => h({ tone: "bad", text: (a == null ? void 0 : a.message) || "Could not undo that change" })
|
|
343
|
+
}), b = ((P = c.data) == null ? void 0 : P.connections) ?? [], C = A(() => {
|
|
344
|
+
var a;
|
|
345
|
+
return ((a = s.data) == null ? void 0 : a.pages.flatMap((m) => m.calls)) ?? [];
|
|
346
|
+
}, [s.data]), j = ((S = c.data) == null ? void 0 : S.logged) !== !1 && ((F = ($ = s.data) == null ? void 0 : $.pages[0]) == null ? void 0 : F.logged) !== !1, _ = A(
|
|
347
|
+
() => [
|
|
348
|
+
{ value: "", label: "Every app" },
|
|
349
|
+
...b.filter((a) => {
|
|
350
|
+
var m;
|
|
351
|
+
return (((m = a.stats) == null ? void 0 : m.calls) ?? 0) > 0;
|
|
352
|
+
}).map((a) => ({ value: a.conn, label: a.name }))
|
|
353
|
+
],
|
|
354
|
+
[b]
|
|
355
|
+
), v = (D = c.data) == null ? void 0 : D.settings;
|
|
356
|
+
return /* @__PURE__ */ n("div", { className: g("flex flex-col gap-4", e), "data-nvr-agents": !0, children: [
|
|
357
|
+
p && /* @__PURE__ */ n(
|
|
358
|
+
"div",
|
|
359
|
+
{
|
|
360
|
+
role: "status",
|
|
361
|
+
className: g(
|
|
362
|
+
"flex items-center justify-between gap-3 rounded-md border px-3 py-2 text-[12.5px]",
|
|
363
|
+
p.tone === "ok" ? "border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-500/30 dark:bg-emerald-500/10 dark:text-emerald-300" : "border-red-200 bg-red-50 text-red-700 dark:border-red-500/30 dark:bg-red-500/10 dark:text-red-300"
|
|
364
|
+
),
|
|
365
|
+
children: [
|
|
366
|
+
p.text,
|
|
367
|
+
/* @__PURE__ */ t(
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
type: "button",
|
|
371
|
+
onClick: () => h(null),
|
|
372
|
+
className: "text-[12px] font-medium underline-offset-2 hover:underline",
|
|
373
|
+
children: "Dismiss"
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ t(
|
|
380
|
+
R,
|
|
381
|
+
{
|
|
382
|
+
icon: /* @__PURE__ */ t(H, { className: "h-4 w-4" }),
|
|
383
|
+
title: "Connected apps",
|
|
384
|
+
hint: "AI assistants that act as you through Nivaro’s MCP server, with your permissions",
|
|
385
|
+
children: c.isLoading ? /* @__PURE__ */ t(K, {}) : c.isError ? /* @__PURE__ */ t(y, { children: "Connected apps could not be loaded. Try again in a moment." }) : b.length === 0 ? /* @__PURE__ */ n("div", { className: "flex items-start gap-3", children: [
|
|
386
|
+
/* @__PURE__ */ t(G, { className: "mt-0.5 h-5 w-5 shrink-0 text-slate-400" }),
|
|
387
|
+
/* @__PURE__ */ t("p", { className: "max-w-[70ch] text-[12.5px] text-slate-600 dark:text-slate-300", children: "No assistant is connected. Add Nivaro as a connector in Claude, ChatGPT, Claude Code or Codex and sign in — the app shows up here with what it did, and you can disconnect it at any time." })
|
|
388
|
+
] }) : /* @__PURE__ */ n(W, { children: [
|
|
389
|
+
/* @__PURE__ */ t("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: b.map((a) => /* @__PURE__ */ t(
|
|
390
|
+
fe,
|
|
391
|
+
{
|
|
392
|
+
c: a,
|
|
393
|
+
onShowCalls: () => {
|
|
394
|
+
var m;
|
|
395
|
+
d(a.conn), (m = u.current) == null || m.scrollIntoView({ block: "start", behavior: "smooth" });
|
|
396
|
+
},
|
|
397
|
+
onDisconnect: () => x.mutate(a.conn),
|
|
398
|
+
disconnecting: x.isPending && x.variables === a.conn
|
|
399
|
+
},
|
|
400
|
+
a.conn
|
|
401
|
+
)) }),
|
|
402
|
+
v && /* @__PURE__ */ n("p", { className: "mt-3 text-[11.5px] text-slate-500 dark:text-slate-400", children: [
|
|
403
|
+
"Figures cover the last ",
|
|
404
|
+
((I = c.data) == null ? void 0 : I.window_days) ?? 14,
|
|
405
|
+
" days. A connection left unused for ",
|
|
406
|
+
v.idle_flag_days,
|
|
407
|
+
" days is pointed out to you, and disconnected after",
|
|
408
|
+
" ",
|
|
409
|
+
v.idle_revoke_days,
|
|
410
|
+
" days with a week’s notice."
|
|
411
|
+
] })
|
|
412
|
+
] })
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
/* @__PURE__ */ t("div", { ref: u, className: "scroll-mt-4", children: /* @__PURE__ */ t(
|
|
416
|
+
R,
|
|
417
|
+
{
|
|
418
|
+
icon: /* @__PURE__ */ t(X, { className: "h-4 w-4" }),
|
|
419
|
+
title: "What my agents did",
|
|
420
|
+
hint: "Every tool call, newest first. Open one to see its changes and undo them.",
|
|
421
|
+
actions: _.length > 2 ? /* @__PURE__ */ t(
|
|
422
|
+
ie,
|
|
423
|
+
{
|
|
424
|
+
value: l,
|
|
425
|
+
onChange: d,
|
|
426
|
+
options: _,
|
|
427
|
+
ariaLabel: "Show calls from"
|
|
428
|
+
}
|
|
429
|
+
) : null,
|
|
430
|
+
children: j ? s.isLoading ? /* @__PURE__ */ t(K, { rows: 5 }) : s.isError ? /* @__PURE__ */ t(y, { children: "The list could not be loaded. Try again in a moment." }) : C.length === 0 ? /* @__PURE__ */ t(y, { children: l ? "This app made no tool calls in the last 14 days." : "Your agents made no tool calls in the last 14 days." }) : /* @__PURE__ */ n("div", { className: "-mx-1 overflow-x-auto", children: [
|
|
431
|
+
/* @__PURE__ */ n("table", { className: "w-full min-w-[640px] text-left text-[12px]", children: [
|
|
432
|
+
/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ n("tr", { className: "border-b border-slate-200 text-[11px] font-medium text-slate-500 dark:border-border dark:text-slate-400", children: [
|
|
433
|
+
/* @__PURE__ */ t("th", { className: "w-5" }),
|
|
434
|
+
/* @__PURE__ */ t("th", { className: "py-1.5 pr-3 font-medium", children: "When" }),
|
|
435
|
+
/* @__PURE__ */ t("th", { className: "py-1.5 pr-3 font-medium", children: "App" }),
|
|
436
|
+
/* @__PURE__ */ t("th", { className: "py-1.5 pr-3 font-medium", children: "Tool" }),
|
|
437
|
+
/* @__PURE__ */ t("th", { className: "py-1.5 pr-3 font-medium", children: "Record" }),
|
|
438
|
+
/* @__PURE__ */ t("th", { className: "py-1.5 pr-3 font-medium", children: "Result" }),
|
|
439
|
+
/* @__PURE__ */ t("th", { className: "py-1.5 pr-1 text-right font-medium", children: "Answer size" })
|
|
440
|
+
] }) }),
|
|
441
|
+
/* @__PURE__ */ t("tbody", { children: C.map((a) => {
|
|
442
|
+
var m;
|
|
443
|
+
return /* @__PURE__ */ t(
|
|
444
|
+
ye,
|
|
445
|
+
{
|
|
446
|
+
call: a,
|
|
447
|
+
onUndo: (B) => o.mutate(B),
|
|
448
|
+
undoingId: o.isPending ? ((m = o.variables) == null ? void 0 : m.activity_id) ?? null : null
|
|
449
|
+
},
|
|
450
|
+
a.id
|
|
451
|
+
);
|
|
452
|
+
}) })
|
|
453
|
+
] }),
|
|
454
|
+
s.hasNextPage && /* @__PURE__ */ n(
|
|
455
|
+
"button",
|
|
456
|
+
{
|
|
457
|
+
type: "button",
|
|
458
|
+
onClick: () => void s.fetchNextPage(),
|
|
459
|
+
disabled: s.isFetchingNextPage,
|
|
460
|
+
className: "mt-3 inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 px-3 text-[12px] font-medium text-slate-700 transition-colors hover:bg-muted disabled:opacity-40 dark:border-border dark:text-slate-200",
|
|
461
|
+
children: [
|
|
462
|
+
s.isFetchingNextPage && /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
463
|
+
"Show older calls"
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
)
|
|
467
|
+
] }) : /* @__PURE__ */ t(y, { children: "Tool calls are not recorded on this instance yet — it needs the latest update." })
|
|
468
|
+
}
|
|
469
|
+
) })
|
|
470
|
+
] });
|
|
471
|
+
}
|
|
472
|
+
export {
|
|
473
|
+
De as AgentsPanel,
|
|
474
|
+
pe as CallFigures,
|
|
475
|
+
me as CallsSparkline,
|
|
476
|
+
he as IdleNote,
|
|
477
|
+
ue as KindPill,
|
|
478
|
+
T as mcpConnectionsKey
|
|
479
|
+
};
|