@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
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { jsxs as r, jsx as a, Fragment as
|
|
2
|
-
import { ListChecks as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useOptionalNivaroClient as
|
|
5
|
-
import { get as
|
|
1
|
+
import { jsxs as r, jsx as a, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { ListChecks as te, Filter as ae, Loader2 as N, Clock as I, RotateCcw as re, Undo2 as ne, Check as se, X as de, SkipForward as le, Ban as ie, CircleDashed as ce } from "lucide-react";
|
|
3
|
+
import { useState as f, useRef as X, useEffect as _, useCallback as oe } from "react";
|
|
4
|
+
import { useOptionalNivaroClient as pe } from "../../context.js";
|
|
5
|
+
import { get as me, post as ue } from "../../lib/commands.js";
|
|
6
6
|
import { cn as d } from "../../lib/utils.js";
|
|
7
|
-
import { Button as
|
|
8
|
-
import { AiPlanChanges as
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
import { Button as p } from "../ui/button.js";
|
|
8
|
+
import { AiPlanChanges as he } from "./AiPlanChanges.js";
|
|
9
|
+
import { ProgressLine as ge, AiPlanUndo as xe } from "./AiPlanUndo.js";
|
|
10
|
+
const fe = 3e3;
|
|
11
|
+
function be(n) {
|
|
11
12
|
return (n == null ? void 0 : n.message) || "The request failed";
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function ke({ status: n }) {
|
|
14
15
|
const l = "h-3.5 w-3.5 shrink-0";
|
|
15
|
-
return n === "running" ? /* @__PURE__ */ a(N, { className: d(l, "animate-spin text-nvr-cyan") }) : n === "done" ? /* @__PURE__ */ a(
|
|
16
|
+
return n === "running" ? /* @__PURE__ */ a(N, { className: d(l, "animate-spin text-nvr-cyan") }) : n === "done" ? /* @__PURE__ */ a(se, { className: d(l, "text-emerald-600 dark:text-emerald-400") }) : n === "failed" ? /* @__PURE__ */ a(de, { className: d(l, "text-rose-600 dark:text-rose-400") }) : n === "skipped" ? /* @__PURE__ */ a(le, { className: d(l, "text-amber-600 dark:text-amber-400") }) : n === "cancelled" ? /* @__PURE__ */ a(ie, { className: d(l, "text-muted-foreground") }) : /* @__PURE__ */ a(ce, { className: d(l, "text-muted-foreground") });
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function Ne(n) {
|
|
18
19
|
const l = new Date(n);
|
|
19
20
|
return Number.isNaN(l.getTime()) ? n : l.toLocaleString(void 0, {
|
|
20
21
|
weekday: "short",
|
|
@@ -24,16 +25,16 @@ function pe(n) {
|
|
|
24
25
|
minute: "2-digit"
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function we() {
|
|
28
29
|
const n = new Date(Date.now() + 36e5);
|
|
29
30
|
n.setMinutes(Math.ceil(n.getMinutes() / 15) * 15, 0, 0);
|
|
30
|
-
const l = (
|
|
31
|
+
const l = ($) => String($).padStart(2, "0");
|
|
31
32
|
return `${n.getFullYear()}-${l(n.getMonth() + 1)}-${l(n.getDate())}T${l(n.getHours())}:${l(n.getMinutes())}`;
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function ve(n) {
|
|
34
35
|
return n == null || n === "" ? "—" : typeof n == "object" ? JSON.stringify(n) : String(n);
|
|
35
36
|
}
|
|
36
|
-
const
|
|
37
|
+
const ye = {
|
|
37
38
|
amber: {
|
|
38
39
|
box: "rounded-lg border border-amber-200 bg-amber-50/60 p-3 dark:border-amber-800 dark:bg-amber-900/10",
|
|
39
40
|
icon: "text-amber-700 dark:text-amber-300",
|
|
@@ -57,82 +58,84 @@ const he = {
|
|
|
57
58
|
stepTitle: "break-words"
|
|
58
59
|
}
|
|
59
60
|
};
|
|
60
|
-
function
|
|
61
|
+
function Te({
|
|
61
62
|
plan: n,
|
|
62
63
|
subscribe: l,
|
|
63
|
-
className:
|
|
64
|
-
beforeSteps:
|
|
65
|
-
stepExtra:
|
|
64
|
+
className: $,
|
|
65
|
+
beforeSteps: Y,
|
|
66
|
+
stepExtra: L,
|
|
66
67
|
extraActions: R,
|
|
67
68
|
runDisabled: D,
|
|
68
|
-
onPlan:
|
|
69
|
-
quiet:
|
|
70
|
-
stepChanges:
|
|
69
|
+
onPlan: M,
|
|
70
|
+
quiet: O,
|
|
71
|
+
stepChanges: j,
|
|
72
|
+
hideUndo: G
|
|
71
73
|
}) {
|
|
72
|
-
var
|
|
73
|
-
const
|
|
74
|
-
|
|
74
|
+
var H, E;
|
|
75
|
+
const i = ye[O ? "quiet" : "amber"], o = pe(), [t, z] = f(n), [c, A] = f(null), [P, q] = f(null), [b, w] = f(null), [F, K] = f(!1), [v, Q] = f(!1), g = n.plan_id, y = X(0), C = X(M);
|
|
76
|
+
C.current = M, _(() => {
|
|
75
77
|
var e;
|
|
76
|
-
(e =
|
|
78
|
+
(e = C.current) == null || e.call(C, t);
|
|
77
79
|
}, [t]);
|
|
78
|
-
const
|
|
80
|
+
const k = oe(async () => {
|
|
79
81
|
if (!o) return;
|
|
80
82
|
const e = Date.now();
|
|
81
|
-
|
|
83
|
+
y.current = e;
|
|
82
84
|
try {
|
|
83
|
-
const s = await o.request(
|
|
84
|
-
|
|
85
|
+
const s = await o.request(me(`/ai/plans/${encodeURIComponent(g)}`));
|
|
86
|
+
y.current === e && (s != null && s.data) && z(s.data);
|
|
85
87
|
} catch {
|
|
86
88
|
}
|
|
87
|
-
}, [o,
|
|
89
|
+
}, [o, g]);
|
|
88
90
|
_(() => {
|
|
89
|
-
|
|
90
|
-
}, [
|
|
91
|
+
k();
|
|
92
|
+
}, [k]), _(() => {
|
|
91
93
|
if (l)
|
|
92
94
|
return l("ai:plan", (e) => {
|
|
93
|
-
if (String(e.plan_id ?? "").toUpperCase() !==
|
|
95
|
+
if (String(e.plan_id ?? "").toUpperCase() !== g.toUpperCase()) return;
|
|
94
96
|
const s = e.plan;
|
|
95
|
-
s != null && s.steps && (
|
|
97
|
+
s != null && s.steps && (y.current = Date.now(), z(s));
|
|
96
98
|
});
|
|
97
|
-
}, [l,
|
|
99
|
+
}, [l, g]), _(() => {
|
|
98
100
|
if (t.status !== "running") return;
|
|
99
|
-
const e = setInterval(() => void
|
|
101
|
+
const e = setInterval(() => void k(), fe);
|
|
100
102
|
return () => clearInterval(e);
|
|
101
|
-
}, [t.status,
|
|
103
|
+
}, [t.status, k]);
|
|
102
104
|
const h = async (e, s) => {
|
|
103
|
-
if (!(!o ||
|
|
104
|
-
|
|
105
|
+
if (!(!o || c)) {
|
|
106
|
+
A(e), q(null);
|
|
105
107
|
try {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
+
const m = await o.request(
|
|
109
|
+
ue(`/ai/plans/${encodeURIComponent(g)}/${e}`, s)
|
|
108
110
|
);
|
|
109
|
-
|
|
110
|
-
} catch (
|
|
111
|
-
|
|
111
|
+
m != null && m.data && (y.current = Date.now(), z(m.data), e === "schedule" && w(null));
|
|
112
|
+
} catch (m) {
|
|
113
|
+
q(be(m)), k();
|
|
112
114
|
} finally {
|
|
113
|
-
|
|
115
|
+
A(null);
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
|
-
},
|
|
117
|
-
return /* @__PURE__ */ r("div", { className: d("mt-2",
|
|
118
|
+
}, T = t.steps.filter((e) => e.state.status === "done").length, x = t.steps.filter((e) => e.state.status === "skipped").length, U = t.status === "proposed" || t.status === "paused", V = t.steps.filter((e) => e.state.status === "pending").length, Z = t.steps.length === 1, B = !G && !!o && t.can_undo === !0 && (((H = t.made_steps) == null ? void 0 : H.length) ?? 0) > 0 && t.status !== "running" && t.status !== "scheduled";
|
|
119
|
+
return /* @__PURE__ */ r("div", { className: d("mt-2", i.box, $), "data-ai-plan": t.status, children: [
|
|
118
120
|
/* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
|
|
119
|
-
/* @__PURE__ */ a(
|
|
121
|
+
/* @__PURE__ */ a(te, { className: d("mt-0.5 h-4 w-4 shrink-0", i.icon) }),
|
|
120
122
|
/* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
|
|
121
|
-
/* @__PURE__ */ r("p", { className: d("text-[12.5px] font-semibold",
|
|
123
|
+
/* @__PURE__ */ r("p", { className: d("text-[12.5px] font-semibold", i.title), children: [
|
|
122
124
|
t.status === "proposed" ? "Proposed plan: " : "Plan: ",
|
|
123
125
|
t.title
|
|
124
126
|
] }),
|
|
125
|
-
((
|
|
126
|
-
/* @__PURE__ */ r("p", { className: d("text-[11px]",
|
|
127
|
+
((E = t.impact) == null ? void 0 : E.summary) && /* @__PURE__ */ a("p", { className: d("text-[11.5px]", i.impact), "data-ai-plan-impact": !0, children: t.impact.summary }),
|
|
128
|
+
/* @__PURE__ */ r("p", { className: d("text-[11px]", i.progress), "data-ai-plan-progress": !0, children: [
|
|
127
129
|
t.steps.length,
|
|
128
130
|
" step",
|
|
129
131
|
t.steps.length === 1 ? "" : "s",
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
t.records_changed > 0 ? ` · ${t.records_changed} record${t.records_changed === 1 ? "" : "s"} changed` : ""
|
|
132
|
+
T + x > 0 ? ` · ${T} done` : "",
|
|
133
|
+
x > 0 ? ` · ${x} skipped` : "",
|
|
134
|
+
t.records_changed > 0 ? ` · ${t.records_changed.toLocaleString()} record${t.records_changed === 1 ? "" : "s"} changed` : ""
|
|
133
135
|
] })
|
|
134
136
|
] })
|
|
135
137
|
] }),
|
|
138
|
+
t.admin_unbounded && (t.status === "proposed" || t.status === "paused" || t.status === "scheduled") && /* @__PURE__ */ a("p", { className: d("mt-1.5 pl-6 text-[11.5px]", i.impact), "data-ai-plan-admin": !0, children: "Runs in the background — you can stop it at any time. Every change is logged as Ask AI for you and can be undone from AI plans for 30 days." }),
|
|
136
139
|
t.held && (t.status === "proposed" || t.status === "paused") && /* @__PURE__ */ r(
|
|
137
140
|
"p",
|
|
138
141
|
{
|
|
@@ -145,18 +148,18 @@ function ye({
|
|
|
145
148
|
]
|
|
146
149
|
}
|
|
147
150
|
),
|
|
148
|
-
|
|
151
|
+
Y,
|
|
149
152
|
/* @__PURE__ */ a("ol", { className: "mt-2 space-y-1.5", children: t.steps.map((e) => {
|
|
150
|
-
var
|
|
151
|
-
const s = e.preview ?? {},
|
|
153
|
+
var W;
|
|
154
|
+
const s = e.preview ?? {}, m = s.changes && typeof s.changes == "object" ? s.changes : null, J = j == null ? void 0 : j(e);
|
|
152
155
|
return /* @__PURE__ */ r(
|
|
153
156
|
"li",
|
|
154
157
|
{
|
|
155
|
-
className: d("rounded-md border px-2.5 py-1.5",
|
|
158
|
+
className: d("rounded-md border px-2.5 py-1.5", i.step),
|
|
156
159
|
"data-ai-plan-step": e.state.status,
|
|
157
160
|
children: [
|
|
158
161
|
/* @__PURE__ */ r("div", { className: "flex items-center gap-1.5", children: [
|
|
159
|
-
/* @__PURE__ */ a(
|
|
162
|
+
/* @__PURE__ */ a(ke, { status: e.state.status }),
|
|
160
163
|
/* @__PURE__ */ r("span", { className: "text-[11px] font-medium tabular-nums text-muted-foreground", children: [
|
|
161
164
|
e.n,
|
|
162
165
|
"."
|
|
@@ -164,44 +167,67 @@ function ye({
|
|
|
164
167
|
/* @__PURE__ */ a(
|
|
165
168
|
"span",
|
|
166
169
|
{
|
|
167
|
-
className: d("min-w-0 flex-1 text-[12.5px] text-foreground",
|
|
170
|
+
className: d("min-w-0 flex-1 text-[12.5px] text-foreground", i.stepTitle),
|
|
168
171
|
children: e.title
|
|
169
172
|
}
|
|
170
173
|
),
|
|
171
174
|
/* @__PURE__ */ a("span", { className: "shrink-0 rounded bg-muted px-1.5 py-px text-[10px] text-muted-foreground", children: e.kind_label })
|
|
172
175
|
] }),
|
|
173
176
|
e.condition && /* @__PURE__ */ r("p", { className: "mt-0.5 flex items-center gap-1 pl-5 text-[11px] text-muted-foreground", children: [
|
|
174
|
-
/* @__PURE__ */ a(
|
|
177
|
+
/* @__PURE__ */ a(ae, { className: "h-3 w-3" }),
|
|
175
178
|
" ",
|
|
176
179
|
e.condition
|
|
177
180
|
] }),
|
|
178
181
|
e.preview_changed && /* @__PURE__ */ a("p", { className: "mt-0.5 pl-5 text-[11px] font-medium text-amber-700 dark:text-amber-300", children: "Re-checked — this step changed since it was proposed." }),
|
|
179
|
-
|
|
180
|
-
|
|
182
|
+
J,
|
|
183
|
+
J === void 0 && m && Object.keys(m).length > 0 && /* @__PURE__ */ a("div", { className: "mt-0.5 space-y-px pl-5", children: Object.entries(m).slice(0, 6).map(([u, ee]) => /* @__PURE__ */ r(
|
|
181
184
|
"p",
|
|
182
185
|
{
|
|
183
186
|
className: "truncate text-[11px] text-slate-700 dark:text-slate-300",
|
|
184
187
|
children: [
|
|
185
|
-
/* @__PURE__ */ a("span", { className: "text-muted-foreground", children:
|
|
188
|
+
/* @__PURE__ */ a("span", { className: "text-muted-foreground", children: u }),
|
|
186
189
|
" → ",
|
|
187
|
-
|
|
190
|
+
ve(ee)
|
|
188
191
|
]
|
|
189
192
|
},
|
|
190
|
-
|
|
193
|
+
u
|
|
191
194
|
)) }),
|
|
192
195
|
s.recipients && s.recipients.length > 0 && /* @__PURE__ */ r("p", { className: "mt-0.5 truncate pl-5 text-[11px] text-muted-foreground", children: [
|
|
193
196
|
"To ",
|
|
194
|
-
s.recipients.map((
|
|
197
|
+
s.recipients.map((u) => u.name).join(", "),
|
|
195
198
|
(s.count ?? 0) > s.recipients.length ? ` +${(s.count ?? 0) - s.recipients.length} more` : ""
|
|
196
199
|
] }),
|
|
197
200
|
s.sample && s.sample.length > 0 && e.kind !== "create_task" && /* @__PURE__ */ r("p", { className: "mt-0.5 truncate pl-5 text-[11px] text-muted-foreground", children: [
|
|
198
201
|
"e.g.",
|
|
199
202
|
" ",
|
|
200
|
-
s.sample.slice(0, 4).map((
|
|
201
|
-
(s.count ?? 0) > 4 ? ` +${(s.count ?? 0) - 4} more` : ""
|
|
203
|
+
s.sample.slice(0, 4).map((u) => u.label).join(" · "),
|
|
204
|
+
(s.count ?? 0) > 4 ? ` +${((s.count ?? 0) - 4).toLocaleString()} more` : ""
|
|
202
205
|
] }),
|
|
206
|
+
e.state.status === "running" && e.state.progress && e.state.progress.total > 1 && /* @__PURE__ */ r("div", { className: "mt-1 pl-5", "data-ai-plan-step-progress": !0, children: [
|
|
207
|
+
/* @__PURE__ */ r("div", { className: "flex items-center justify-between gap-2 text-[11px] tabular-nums text-muted-foreground", children: [
|
|
208
|
+
/* @__PURE__ */ r("span", { children: [
|
|
209
|
+
e.state.progress.done.toLocaleString(),
|
|
210
|
+
" of",
|
|
211
|
+
" ",
|
|
212
|
+
e.state.progress.total.toLocaleString(),
|
|
213
|
+
" records"
|
|
214
|
+
] }),
|
|
215
|
+
/* @__PURE__ */ r("span", { children: [
|
|
216
|
+
Math.round(e.state.progress.done / e.state.progress.total * 100),
|
|
217
|
+
"%"
|
|
218
|
+
] })
|
|
219
|
+
] }),
|
|
220
|
+
/* @__PURE__ */ a(
|
|
221
|
+
ge,
|
|
222
|
+
{
|
|
223
|
+
pct: Math.round(e.state.progress.done / e.state.progress.total * 100),
|
|
224
|
+
label: `Step ${e.n} progress`
|
|
225
|
+
}
|
|
226
|
+
)
|
|
227
|
+
] }),
|
|
228
|
+
e.state.status === "cancelled" && e.state.error && /* @__PURE__ */ a("p", { className: "mt-0.5 pl-5 text-[11px] text-muted-foreground", children: e.state.error }),
|
|
203
229
|
e.state.status === "done" && e.state.records_changed > 0 && /* @__PURE__ */ r("p", { className: "mt-0.5 pl-5 text-[11px] text-emerald-700 dark:text-emerald-400", children: [
|
|
204
|
-
e.state.records_changed,
|
|
230
|
+
e.state.records_changed.toLocaleString(),
|
|
205
231
|
" record",
|
|
206
232
|
e.state.records_changed === 1 ? "" : "s",
|
|
207
233
|
" changed"
|
|
@@ -210,24 +236,25 @@ function ye({
|
|
|
210
236
|
"Skipped — ",
|
|
211
237
|
e.state.skip_reason
|
|
212
238
|
] }),
|
|
213
|
-
e.state.status !== "skipped" && (((
|
|
239
|
+
e.state.status !== "skipped" && (((W = e.state.skipped_records) == null ? void 0 : W.length) ?? 0) > 0 && /* @__PURE__ */ r("p", { className: "mt-0.5 pl-5 text-[11px] text-amber-700 dark:text-amber-300", children: [
|
|
214
240
|
"Left out ",
|
|
215
241
|
e.state.skipped_records.length,
|
|
216
242
|
":",
|
|
217
243
|
" ",
|
|
218
|
-
e.state.skipped_records.slice(0, 3).map((
|
|
244
|
+
e.state.skipped_records.slice(0, 3).map((u) => `${u.label ?? u.id} (${u.reason})`).join("; ")
|
|
219
245
|
] }),
|
|
220
246
|
e.state.status === "failed" && e.state.error && /* @__PURE__ */ a("p", { className: "mt-0.5 pl-5 text-[11px] text-rose-700 dark:text-rose-400", children: e.state.error }),
|
|
221
|
-
|
|
247
|
+
L == null ? void 0 : L(e, t)
|
|
222
248
|
]
|
|
223
249
|
},
|
|
224
250
|
e.id
|
|
225
251
|
);
|
|
226
252
|
}) }),
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
253
|
+
F && /* @__PURE__ */ a(he, { planId: g, title: t.title }),
|
|
254
|
+
v && B && /* @__PURE__ */ a(xe, { id: g, embedded: !0 }),
|
|
255
|
+
P && /* @__PURE__ */ a("p", { className: "mt-2 text-[11.5px] text-rose-700 dark:text-rose-400", children: P }),
|
|
256
|
+
b != null && U && /* @__PURE__ */ r("div", { className: "mt-2 flex flex-wrap items-center gap-2", "data-ai-plan-later": !0, children: [
|
|
257
|
+
/* @__PURE__ */ a("span", { className: d("text-[11.5px]", i.title), children: "Run at" }),
|
|
231
258
|
/* @__PURE__ */ a(
|
|
232
259
|
"input",
|
|
233
260
|
{
|
|
@@ -237,31 +264,31 @@ function ye({
|
|
|
237
264
|
"aria-label": "Run at",
|
|
238
265
|
className: d(
|
|
239
266
|
"h-7 rounded-md border bg-white px-2 text-[12px] text-foreground dark:bg-card",
|
|
240
|
-
|
|
267
|
+
O ? "border-slate-200 dark:border-border" : "border-amber-300 dark:border-amber-700"
|
|
241
268
|
)
|
|
242
269
|
}
|
|
243
270
|
),
|
|
244
271
|
/* @__PURE__ */ r(
|
|
245
|
-
|
|
272
|
+
p,
|
|
246
273
|
{
|
|
247
274
|
size: "sm",
|
|
248
275
|
className: "h-7 bg-nvr-cyan text-white hover:bg-nvr-cyan/90",
|
|
249
|
-
disabled: !!
|
|
276
|
+
disabled: !!c || !b,
|
|
250
277
|
onClick: () => h("schedule", { run_at: new Date(b).toISOString() }),
|
|
251
278
|
children: [
|
|
252
|
-
|
|
279
|
+
c === "schedule" ? /* @__PURE__ */ a(N, { className: "h-3 w-3 animate-spin" }) : null,
|
|
253
280
|
"Approve for then"
|
|
254
281
|
]
|
|
255
282
|
}
|
|
256
283
|
),
|
|
257
|
-
/* @__PURE__ */ a(
|
|
284
|
+
/* @__PURE__ */ a(p, { size: "sm", variant: "ghost", className: "h-7", onClick: () => w(null), children: "Cancel" }),
|
|
258
285
|
/* @__PURE__ */ a("span", { className: "w-full text-[11px] text-muted-foreground", children: "Each step is re-checked first; if the records changed, it waits for you to approve again." })
|
|
259
286
|
] }),
|
|
260
287
|
/* @__PURE__ */ r("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: [
|
|
261
|
-
|
|
288
|
+
U && o && D && /* @__PURE__ */ r(
|
|
262
289
|
"span",
|
|
263
290
|
{
|
|
264
|
-
className: d("flex items-center gap-1.5 text-[12px]",
|
|
291
|
+
className: d("flex items-center gap-1.5 text-[12px]", i.status),
|
|
265
292
|
"data-ai-plan-run-withheld": !0,
|
|
266
293
|
children: [
|
|
267
294
|
/* @__PURE__ */ a(I, { className: "h-3 w-3" }),
|
|
@@ -269,41 +296,41 @@ function ye({
|
|
|
269
296
|
]
|
|
270
297
|
}
|
|
271
298
|
),
|
|
272
|
-
|
|
299
|
+
U && o && !D && /* @__PURE__ */ r(S, { children: [
|
|
273
300
|
/* @__PURE__ */ r(
|
|
274
|
-
|
|
301
|
+
p,
|
|
275
302
|
{
|
|
276
303
|
size: "sm",
|
|
277
304
|
className: "h-7 bg-nvr-cyan text-white hover:bg-nvr-cyan/90",
|
|
278
|
-
disabled: !!
|
|
305
|
+
disabled: !!c,
|
|
279
306
|
onClick: () => h("run", { mode: "all" }),
|
|
280
307
|
"data-ai-plan-run": "all",
|
|
281
308
|
children: [
|
|
282
|
-
|
|
283
|
-
t.status === "paused" ? "Run the rest" : "Approve & run all"
|
|
309
|
+
c === "run" ? /* @__PURE__ */ a(N, { className: "h-3 w-3 animate-spin" }) : null,
|
|
310
|
+
t.status === "paused" ? "Run the rest" : Z ? "Approve & run" : "Approve & run all"
|
|
284
311
|
]
|
|
285
312
|
}
|
|
286
313
|
),
|
|
287
|
-
|
|
288
|
-
|
|
314
|
+
V > 1 && /* @__PURE__ */ a(
|
|
315
|
+
p,
|
|
289
316
|
{
|
|
290
317
|
size: "sm",
|
|
291
318
|
variant: "outline",
|
|
292
319
|
className: "h-7",
|
|
293
|
-
disabled: !!
|
|
320
|
+
disabled: !!c,
|
|
294
321
|
onClick: () => h("run", { mode: "next" }),
|
|
295
322
|
"data-ai-plan-run": "next",
|
|
296
323
|
children: "Run next step"
|
|
297
324
|
}
|
|
298
325
|
),
|
|
299
326
|
b == null && /* @__PURE__ */ r(
|
|
300
|
-
|
|
327
|
+
p,
|
|
301
328
|
{
|
|
302
329
|
size: "sm",
|
|
303
330
|
variant: "outline",
|
|
304
331
|
className: "h-7",
|
|
305
|
-
disabled: !!
|
|
306
|
-
onClick: () => w(
|
|
332
|
+
disabled: !!c,
|
|
333
|
+
onClick: () => w(we()),
|
|
307
334
|
"data-ai-plan-run": "later",
|
|
308
335
|
children: [
|
|
309
336
|
/* @__PURE__ */ a(I, { className: "h-3 w-3" }),
|
|
@@ -312,84 +339,84 @@ function ye({
|
|
|
312
339
|
}
|
|
313
340
|
),
|
|
314
341
|
/* @__PURE__ */ a(
|
|
315
|
-
|
|
342
|
+
p,
|
|
316
343
|
{
|
|
317
344
|
size: "sm",
|
|
318
345
|
variant: "ghost",
|
|
319
346
|
className: "h-7",
|
|
320
|
-
disabled: !!
|
|
347
|
+
disabled: !!c,
|
|
321
348
|
onClick: () => h("cancel"),
|
|
322
349
|
children: "Discard"
|
|
323
350
|
}
|
|
324
351
|
)
|
|
325
352
|
] }),
|
|
326
|
-
t.status === "scheduled" && /* @__PURE__ */ r(
|
|
353
|
+
t.status === "scheduled" && /* @__PURE__ */ r(S, { children: [
|
|
327
354
|
/* @__PURE__ */ r(
|
|
328
355
|
"span",
|
|
329
356
|
{
|
|
330
|
-
className: d("flex items-center gap-1.5 text-[12px]",
|
|
357
|
+
className: d("flex items-center gap-1.5 text-[12px]", i.status),
|
|
331
358
|
"data-ai-plan-scheduled": !0,
|
|
332
359
|
children: [
|
|
333
360
|
/* @__PURE__ */ a(I, { className: "h-3 w-3" }),
|
|
334
361
|
"Approved to run ",
|
|
335
|
-
t.schedule ?
|
|
362
|
+
t.schedule ? Ne(t.schedule.run_at) : "later"
|
|
336
363
|
]
|
|
337
364
|
}
|
|
338
365
|
),
|
|
339
366
|
o && /* @__PURE__ */ a(
|
|
340
|
-
|
|
367
|
+
p,
|
|
341
368
|
{
|
|
342
369
|
size: "sm",
|
|
343
370
|
variant: "ghost",
|
|
344
371
|
className: "h-7",
|
|
345
|
-
disabled: !!
|
|
372
|
+
disabled: !!c,
|
|
346
373
|
onClick: () => h("unschedule"),
|
|
347
374
|
children: "Cancel schedule"
|
|
348
375
|
}
|
|
349
376
|
)
|
|
350
377
|
] }),
|
|
351
|
-
t.status === "running" && /* @__PURE__ */ r(
|
|
352
|
-
/* @__PURE__ */ r("span", { className: d("flex items-center gap-1.5 text-[12px]",
|
|
378
|
+
t.status === "running" && /* @__PURE__ */ r(S, { children: [
|
|
379
|
+
/* @__PURE__ */ r("span", { className: d("flex items-center gap-1.5 text-[12px]", i.status), children: [
|
|
353
380
|
/* @__PURE__ */ a(N, { className: "h-3 w-3 animate-spin" }),
|
|
354
381
|
" Running…"
|
|
355
382
|
] }),
|
|
356
383
|
o && /* @__PURE__ */ a(
|
|
357
|
-
|
|
384
|
+
p,
|
|
358
385
|
{
|
|
359
386
|
size: "sm",
|
|
360
387
|
variant: "outline",
|
|
361
388
|
className: "h-7",
|
|
362
|
-
disabled: !!
|
|
389
|
+
disabled: !!c,
|
|
363
390
|
onClick: () => h("cancel"),
|
|
364
|
-
"data-tip": "Stop before the next step",
|
|
391
|
+
"data-tip": t.admin_unbounded ? "Stop after the records in flight — what ran can be undone" : "Stop before the next step",
|
|
365
392
|
children: "Stop"
|
|
366
393
|
}
|
|
367
394
|
)
|
|
368
395
|
] }),
|
|
369
|
-
t.status === "failed" && o && /* @__PURE__ */ r(
|
|
396
|
+
t.status === "failed" && o && /* @__PURE__ */ r(S, { children: [
|
|
370
397
|
/* @__PURE__ */ r(
|
|
371
|
-
|
|
398
|
+
p,
|
|
372
399
|
{
|
|
373
400
|
size: "sm",
|
|
374
401
|
variant: "outline",
|
|
375
402
|
className: "h-7",
|
|
376
|
-
disabled: !!
|
|
403
|
+
disabled: !!c,
|
|
377
404
|
onClick: () => h("retry"),
|
|
378
405
|
"data-ai-plan-retry": !0,
|
|
379
406
|
"data-tip": "Re-check the failed and remaining steps, then run them again",
|
|
380
407
|
children: [
|
|
381
|
-
|
|
408
|
+
c === "retry" ? /* @__PURE__ */ a(N, { className: "h-3 w-3 animate-spin" }) : /* @__PURE__ */ a(re, { className: "h-3 w-3" }),
|
|
382
409
|
"Re-check and retry"
|
|
383
410
|
]
|
|
384
411
|
}
|
|
385
412
|
),
|
|
386
413
|
/* @__PURE__ */ a(
|
|
387
|
-
|
|
414
|
+
p,
|
|
388
415
|
{
|
|
389
416
|
size: "sm",
|
|
390
417
|
variant: "ghost",
|
|
391
418
|
className: "h-7",
|
|
392
|
-
disabled: !!
|
|
419
|
+
disabled: !!c,
|
|
393
420
|
onClick: () => h("cancel"),
|
|
394
421
|
children: "Discard the rest"
|
|
395
422
|
}
|
|
@@ -397,14 +424,29 @@ function ye({
|
|
|
397
424
|
] }),
|
|
398
425
|
t.status === "executed" && /* @__PURE__ */ r("span", { className: "text-[12px] font-medium text-emerald-700 dark:text-emerald-400", children: [
|
|
399
426
|
"Done — ",
|
|
400
|
-
t.records_changed,
|
|
427
|
+
t.records_changed.toLocaleString(),
|
|
401
428
|
" record",
|
|
402
429
|
t.records_changed === 1 ? "" : "s",
|
|
403
430
|
" changed",
|
|
404
|
-
|
|
431
|
+
x > 0 ? `, ${x} step${x === 1 ? "" : "s"} skipped` : ""
|
|
405
432
|
] }),
|
|
406
|
-
t.status === "rejected" && /* @__PURE__ */ a("span", { className: "text-[12px] text-muted-foreground", children:
|
|
433
|
+
t.status === "rejected" && /* @__PURE__ */ a("span", { className: "text-[12px] text-muted-foreground", children: T > 0 ? "Stopped — the remaining steps did not run." : "Discarded — nothing changed." }),
|
|
407
434
|
t.status === "expired" && /* @__PURE__ */ a("span", { className: "text-[12px] text-muted-foreground", children: "Expired — ask again." }),
|
|
435
|
+
B && /* @__PURE__ */ r(
|
|
436
|
+
p,
|
|
437
|
+
{
|
|
438
|
+
size: "sm",
|
|
439
|
+
variant: v ? "secondary" : "outline",
|
|
440
|
+
className: "h-7",
|
|
441
|
+
onClick: () => Q((e) => !e),
|
|
442
|
+
"aria-expanded": v,
|
|
443
|
+
"data-ai-plan-undo-toggle": !0,
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ a(ne, { className: "h-3 w-3" }),
|
|
446
|
+
v ? "Hide undo" : "Undo…"
|
|
447
|
+
]
|
|
448
|
+
}
|
|
449
|
+
),
|
|
408
450
|
R == null ? void 0 : R(t),
|
|
409
451
|
o && t.impact !== void 0 && /* @__PURE__ */ a(
|
|
410
452
|
"button",
|
|
@@ -412,16 +454,16 @@ function ye({
|
|
|
412
454
|
type: "button",
|
|
413
455
|
className: d(
|
|
414
456
|
"ml-auto text-[11.5px] font-medium underline-offset-2 hover:underline",
|
|
415
|
-
|
|
457
|
+
i.link
|
|
416
458
|
),
|
|
417
|
-
onClick: () =>
|
|
459
|
+
onClick: () => K((e) => !e),
|
|
418
460
|
"data-ai-plan-changes-toggle": !0,
|
|
419
|
-
children:
|
|
461
|
+
children: F ? "Hide changes" : "What changes"
|
|
420
462
|
}
|
|
421
463
|
)
|
|
422
464
|
] })
|
|
423
465
|
] });
|
|
424
466
|
}
|
|
425
467
|
export {
|
|
426
|
-
|
|
468
|
+
Te as AiPlanCard
|
|
427
469
|
};
|