@tangle-network/agent-app 0.60.142 → 0.60.143
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/assistant/index.js +6 -9
- package/dist/assistant/index.js.map +1 -1
- package/dist/chat-routes/index.js +55 -4
- package/dist/chat-routes/index.js.map +1 -1
- package/dist/chat-routes/reasoning-clock.d.ts +31 -0
- package/dist/{chunk-EGEULRT2.js → chunk-T4JJXUJI.js} +971 -850
- package/dist/chunk-T4JJXUJI.js.map +1 -0
- package/dist/web-react/chat-stream.d.ts +49 -0
- package/dist/web-react/index.d.ts +11 -5
- package/dist/web-react/index.js +7 -1
- package/dist/web-react/reasoning-row.d.ts +34 -0
- package/package.json +1 -1
- package/dist/chunk-EGEULRT2.js.map +0 -1
|
@@ -57,9 +57,9 @@ import {
|
|
|
57
57
|
} from "./chunk-6VQCFJWP.js";
|
|
58
58
|
|
|
59
59
|
// src/web-react/index.tsx
|
|
60
|
-
import { useEffect as
|
|
60
|
+
import { useEffect as useEffect15, useMemo as useMemo8, useRef as useRef13, useState as useState20, memo } from "react";
|
|
61
61
|
import { isViewerMessage, MessageAuthor, TRANSCRIPT_TEXT } from "@tangle-network/ui/chat";
|
|
62
|
-
import { InlineToolItem
|
|
62
|
+
import { InlineToolItem } from "@tangle-network/ui/run";
|
|
63
63
|
|
|
64
64
|
// src/web-react/smooth-text.ts
|
|
65
65
|
import { useEffect, useRef, useState } from "react";
|
|
@@ -1325,7 +1325,164 @@ function TurnProgress({ phase, pendingMessage = "Sending\u2026", startedAt, show
|
|
|
1325
1325
|
);
|
|
1326
1326
|
}
|
|
1327
1327
|
|
|
1328
|
+
// src/web-react/reasoning-row.tsx
|
|
1329
|
+
import { useEffect as useEffect6, useMemo as useMemo3, useRef as useRef5, useState as useState8 } from "react";
|
|
1330
|
+
import { RunRowShell } from "@tangle-network/ui/run";
|
|
1331
|
+
import { Markdown } from "@tangle-network/ui/markdown";
|
|
1332
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1333
|
+
function reasoningPreview(text) {
|
|
1334
|
+
const flat = text.replace(/[*_`#>]+/g, "").replace(/\s+/g, " ").trim();
|
|
1335
|
+
if (!flat) return void 0;
|
|
1336
|
+
return flat.length > 120 ? `${flat.slice(0, 119)}\u2026` : flat;
|
|
1337
|
+
}
|
|
1338
|
+
function thoughtForLabel(durationMs) {
|
|
1339
|
+
const seconds = Math.max(1, Math.round(durationMs / 1e3));
|
|
1340
|
+
return `Thought for ${seconds} second${seconds === 1 ? "" : "s"}`;
|
|
1341
|
+
}
|
|
1342
|
+
function useSecondTick(active) {
|
|
1343
|
+
const [, setTick] = useState8(0);
|
|
1344
|
+
useEffect6(() => {
|
|
1345
|
+
if (!active) return;
|
|
1346
|
+
const id = setInterval(() => setTick((n) => n + 1), 1e3);
|
|
1347
|
+
return () => clearInterval(id);
|
|
1348
|
+
}, [active]);
|
|
1349
|
+
}
|
|
1350
|
+
var defaultRenderText = (text) => /* @__PURE__ */ jsx8(Markdown, { children: text });
|
|
1351
|
+
function ReasoningRow({
|
|
1352
|
+
text,
|
|
1353
|
+
startedAt,
|
|
1354
|
+
endedAt,
|
|
1355
|
+
thinking: thinkingProp,
|
|
1356
|
+
defaultOpen = false,
|
|
1357
|
+
renderText = defaultRenderText,
|
|
1358
|
+
className
|
|
1359
|
+
}) {
|
|
1360
|
+
const thinking = thinkingProp ?? (startedAt !== void 0 && endedAt === void 0);
|
|
1361
|
+
const shown = useSmoothText(text, thinking);
|
|
1362
|
+
const body = useMemo3(() => renderText(shown), [renderText, shown]);
|
|
1363
|
+
const visible = text.trim() !== "";
|
|
1364
|
+
const seenStart = useRef5(null);
|
|
1365
|
+
const seenEnd = useRef5(null);
|
|
1366
|
+
if (thinking && visible) {
|
|
1367
|
+
if (seenStart.current === null) seenStart.current = Date.now();
|
|
1368
|
+
seenEnd.current = null;
|
|
1369
|
+
} else if (seenStart.current !== null && seenEnd.current === null) {
|
|
1370
|
+
seenEnd.current = Date.now();
|
|
1371
|
+
}
|
|
1372
|
+
const start = startedAt ?? seenStart.current ?? void 0;
|
|
1373
|
+
const end = endedAt ?? seenEnd.current ?? void 0;
|
|
1374
|
+
useSecondTick(thinking);
|
|
1375
|
+
const [toggled, setToggled] = useState8(null);
|
|
1376
|
+
const open = toggled ?? (thinking || defaultOpen);
|
|
1377
|
+
const scrollRef = useRef5(null);
|
|
1378
|
+
useEffect6(() => {
|
|
1379
|
+
const el = scrollRef.current;
|
|
1380
|
+
if (el && thinking) el.scrollTop = el.scrollHeight;
|
|
1381
|
+
}, [shown, thinking]);
|
|
1382
|
+
if (!visible) return null;
|
|
1383
|
+
const elapsedSeconds = thinking && start !== void 0 ? Math.max(0, Math.floor((Date.now() - start) / 1e3)) : 0;
|
|
1384
|
+
const durationMs = !thinking && start !== void 0 && end !== void 0 && end >= start ? end - start : void 0;
|
|
1385
|
+
const title = thinking ? (
|
|
1386
|
+
// The sweep through the glyphs is the working-versus-stuck signal; reduced
|
|
1387
|
+
// motion swaps it for a static underline (`.agent-shimmer` in the theme).
|
|
1388
|
+
/* @__PURE__ */ jsxs6("span", { className: "agent-shimmer", "data-motion": "essential", children: [
|
|
1389
|
+
"Thinking",
|
|
1390
|
+
elapsedSeconds >= 1 ? ` \xB7 ${elapsedSeconds}s` : "\u2026"
|
|
1391
|
+
] })
|
|
1392
|
+
) : durationMs !== void 0 ? thoughtForLabel(durationMs) : "Thought process";
|
|
1393
|
+
return /* @__PURE__ */ jsx8(
|
|
1394
|
+
RunRowShell,
|
|
1395
|
+
{
|
|
1396
|
+
className,
|
|
1397
|
+
icon: /* @__PURE__ */ jsx8(BrainGlyph, { className: "h-3.5 w-3.5" }),
|
|
1398
|
+
title,
|
|
1399
|
+
description: thinking ? void 0 : reasoningPreview(text),
|
|
1400
|
+
status: thinking ? "running" : "idle",
|
|
1401
|
+
open,
|
|
1402
|
+
onOpenChange: setToggled,
|
|
1403
|
+
children: /* @__PURE__ */ jsx8(
|
|
1404
|
+
"div",
|
|
1405
|
+
{
|
|
1406
|
+
ref: scrollRef,
|
|
1407
|
+
"data-reasoning": thinking ? "thinking" : "settled",
|
|
1408
|
+
"aria-busy": thinking || void 0,
|
|
1409
|
+
className: "max-h-48 overflow-y-auto px-3 py-2.5 text-sm leading-relaxed text-muted-foreground",
|
|
1410
|
+
children: body
|
|
1411
|
+
}
|
|
1412
|
+
)
|
|
1413
|
+
}
|
|
1414
|
+
);
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1328
1417
|
// src/web-react/chat-stream.ts
|
|
1418
|
+
var trackedCallbacks = /* @__PURE__ */ new WeakSet();
|
|
1419
|
+
function trackChatReasoning(callbacks, now = Date.now) {
|
|
1420
|
+
let state = null;
|
|
1421
|
+
let paragraph = false;
|
|
1422
|
+
let replayedFrom;
|
|
1423
|
+
const publish = (next) => {
|
|
1424
|
+
state = next;
|
|
1425
|
+
callbacks.onReasoningState?.(next);
|
|
1426
|
+
};
|
|
1427
|
+
const stop = () => {
|
|
1428
|
+
if (state?.thinking) publish({ ...state, endedAt: now(), thinking: false });
|
|
1429
|
+
};
|
|
1430
|
+
const tracked = {
|
|
1431
|
+
...callbacks,
|
|
1432
|
+
onReasoning: (delta) => {
|
|
1433
|
+
callbacks.onReasoning?.(delta);
|
|
1434
|
+
if (!delta) return;
|
|
1435
|
+
if (!state) {
|
|
1436
|
+
publish({ text: delta, startedAt: replayedFrom ?? now(), thinking: true });
|
|
1437
|
+
} else {
|
|
1438
|
+
const joined = (paragraph || !state.thinking) && state.text.trim() ? `${state.text.trimEnd()}
|
|
1439
|
+
|
|
1440
|
+
${delta.trimStart()}` : state.text + delta;
|
|
1441
|
+
publish({ text: joined, ...state.startedAt !== void 0 ? { startedAt: state.startedAt } : {}, thinking: true });
|
|
1442
|
+
}
|
|
1443
|
+
paragraph = false;
|
|
1444
|
+
},
|
|
1445
|
+
onText: (delta) => {
|
|
1446
|
+
if (delta) stop();
|
|
1447
|
+
callbacks.onText?.(delta);
|
|
1448
|
+
},
|
|
1449
|
+
onToolCall: (call) => {
|
|
1450
|
+
if (state) paragraph = true;
|
|
1451
|
+
callbacks.onToolCall?.(call);
|
|
1452
|
+
},
|
|
1453
|
+
onErrorEventDetail: (detail) => {
|
|
1454
|
+
stop();
|
|
1455
|
+
callbacks.onErrorEventDetail?.(detail);
|
|
1456
|
+
},
|
|
1457
|
+
end: stop,
|
|
1458
|
+
replay: () => {
|
|
1459
|
+
replayedFrom = state?.startedAt ?? replayedFrom;
|
|
1460
|
+
state = null;
|
|
1461
|
+
paragraph = false;
|
|
1462
|
+
}
|
|
1463
|
+
};
|
|
1464
|
+
trackedCallbacks.add(tracked);
|
|
1465
|
+
return tracked;
|
|
1466
|
+
}
|
|
1467
|
+
function chatReasoningFromParts(parts) {
|
|
1468
|
+
const runs = (parts ?? []).filter((part) => {
|
|
1469
|
+
const record = part;
|
|
1470
|
+
return record?.type === "reasoning" && typeof record.text === "string" && record.text.trim() !== "";
|
|
1471
|
+
});
|
|
1472
|
+
if (runs.length === 0) return void 0;
|
|
1473
|
+
const times = runs.map((run) => run.time && typeof run.time === "object" ? run.time : {});
|
|
1474
|
+
const finite = (value) => typeof value === "number" && Number.isFinite(value);
|
|
1475
|
+
const starts = times.map((time) => time.start).filter(finite);
|
|
1476
|
+
const ends = times.map((time) => time.end).filter(finite);
|
|
1477
|
+
const startedAt = starts.length > 0 ? Math.min(...starts) : void 0;
|
|
1478
|
+
const endedAt = ends.length > 0 ? Math.max(...ends) : void 0;
|
|
1479
|
+
return {
|
|
1480
|
+
text: runs.map((run) => run.text.trim()).join("\n\n"),
|
|
1481
|
+
...startedAt !== void 0 ? { startedAt } : {},
|
|
1482
|
+
...startedAt !== void 0 && endedAt !== void 0 && endedAt >= startedAt ? { endedAt } : {},
|
|
1483
|
+
thinking: false
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1329
1486
|
function dispatchChatStreamLine(line, cb) {
|
|
1330
1487
|
let receivedContent = false;
|
|
1331
1488
|
let turnId;
|
|
@@ -1465,24 +1622,30 @@ async function consumeChatStream(body, cb) {
|
|
|
1465
1622
|
let buffer = "";
|
|
1466
1623
|
let turnId = null;
|
|
1467
1624
|
let receivedContent = false;
|
|
1625
|
+
const owned = !trackedCallbacks.has(cb) && cb.onReasoningState ? trackChatReasoning(cb) : null;
|
|
1626
|
+
const callbacks = owned ?? cb;
|
|
1468
1627
|
const handle = (line) => {
|
|
1469
|
-
const r = dispatchChatStreamLine(line,
|
|
1628
|
+
const r = dispatchChatStreamLine(line, callbacks);
|
|
1470
1629
|
if (r.turnId) {
|
|
1471
1630
|
turnId = r.turnId;
|
|
1472
1631
|
cb.onTurnId?.(r.turnId);
|
|
1473
1632
|
}
|
|
1474
1633
|
if (r.receivedContent) receivedContent = true;
|
|
1475
1634
|
};
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
if (
|
|
1480
|
-
|
|
1635
|
+
try {
|
|
1636
|
+
for (; ; ) {
|
|
1637
|
+
const { done, value } = await reader.read();
|
|
1638
|
+
if (done) {
|
|
1639
|
+
if (buffer.trim()) handle(buffer);
|
|
1640
|
+
break;
|
|
1641
|
+
}
|
|
1642
|
+
buffer += decoder.decode(value, { stream: true });
|
|
1643
|
+
const lines = buffer.split("\n");
|
|
1644
|
+
buffer = lines.pop() ?? "";
|
|
1645
|
+
for (const line of lines) handle(line);
|
|
1481
1646
|
}
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
buffer = lines.pop() ?? "";
|
|
1485
|
-
for (const line of lines) handle(line);
|
|
1647
|
+
} finally {
|
|
1648
|
+
owned?.end();
|
|
1486
1649
|
}
|
|
1487
1650
|
return { turnId, receivedContent };
|
|
1488
1651
|
}
|
|
@@ -1493,26 +1656,33 @@ async function streamChatTurn(opts) {
|
|
|
1493
1656
|
throw new Error(err.error ?? `HTTP ${res.status}`);
|
|
1494
1657
|
}
|
|
1495
1658
|
let turnId = res.headers.get("x-turn-id")?.trim() || null;
|
|
1496
|
-
const
|
|
1659
|
+
const withTurnId = {
|
|
1497
1660
|
...opts.callbacks,
|
|
1498
1661
|
onTurnId: (id) => {
|
|
1499
1662
|
turnId = id;
|
|
1500
1663
|
opts.callbacks.onTurnId?.(id);
|
|
1501
1664
|
}
|
|
1502
1665
|
};
|
|
1666
|
+
const tracked = opts.callbacks.onReasoningState ? trackChatReasoning(withTurnId) : null;
|
|
1667
|
+
const cb = tracked ?? withTurnId;
|
|
1503
1668
|
try {
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1669
|
+
try {
|
|
1670
|
+
return await consumeChatStream(res.body, cb);
|
|
1671
|
+
} catch (transportErr) {
|
|
1672
|
+
if (!turnId || !opts.resume) throw transportErr;
|
|
1673
|
+
opts.onResetForResume?.();
|
|
1674
|
+
tracked?.replay();
|
|
1675
|
+
const resumed = await opts.resume(turnId, 0);
|
|
1676
|
+
if (!resumed.ok || !resumed.body) throw transportErr;
|
|
1677
|
+
return await consumeChatStream(resumed.body, cb);
|
|
1678
|
+
}
|
|
1679
|
+
} finally {
|
|
1680
|
+
tracked?.end();
|
|
1511
1681
|
}
|
|
1512
1682
|
}
|
|
1513
1683
|
|
|
1514
1684
|
// src/web-react/workspace-prewarm.ts
|
|
1515
|
-
import { useCallback as useCallback2, useEffect as
|
|
1685
|
+
import { useCallback as useCallback2, useEffect as useEffect7 } from "react";
|
|
1516
1686
|
var DEFAULT_MIN_INTERVAL_MS = 6e4;
|
|
1517
1687
|
var lastSent = /* @__PURE__ */ new Map();
|
|
1518
1688
|
var inFlight = /* @__PURE__ */ new Set();
|
|
@@ -1539,7 +1709,7 @@ function requestWorkspacePrewarm(url, options = {}) {
|
|
|
1539
1709
|
function useWorkspacePrewarm(options) {
|
|
1540
1710
|
const { url, enabled = true, minIntervalMs } = options;
|
|
1541
1711
|
const active = enabled && Boolean(url);
|
|
1542
|
-
|
|
1712
|
+
useEffect7(() => {
|
|
1543
1713
|
if (!active || !url || typeof document === "undefined") return;
|
|
1544
1714
|
const fire = () => {
|
|
1545
1715
|
requestWorkspacePrewarm(url, { minIntervalMs });
|
|
@@ -1574,12 +1744,12 @@ function getChatFundingRecovery(failure) {
|
|
|
1574
1744
|
}
|
|
1575
1745
|
|
|
1576
1746
|
// src/web-react/agent-profile-viewer.tsx
|
|
1577
|
-
import { useState as
|
|
1747
|
+
import { useState as useState9 } from "react";
|
|
1578
1748
|
import { Button, CodeBlock, Tabs, TabsContent, TabsList, TabsTrigger } from "@tangle-network/sandbox-ui/primitives";
|
|
1579
1749
|
import { CopyButton } from "@tangle-network/sandbox-ui/markdown";
|
|
1580
1750
|
|
|
1581
1751
|
// src/web-react/agent-profile-layout.tsx
|
|
1582
|
-
import { jsx as
|
|
1752
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1583
1753
|
var sectionGlyphs = {
|
|
1584
1754
|
Identity: { path: "M20 21v-2a7 7 0 0 0-14 0v2 M16 7a4 4 0 1 1-8 0 4 4 0 0 1 8 0", color: "bg-primary/10 text-primary" },
|
|
1585
1755
|
"Prompts and instructions": { path: "M8 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-3 M9 15l3-1 9-9-2-2-9 9-1 3", color: "bg-primary/10 text-primary" },
|
|
@@ -1589,23 +1759,23 @@ var sectionGlyphs = {
|
|
|
1589
1759
|
var resourceGlyph = { path: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8l-6-6 M14 2v6h6 M8 13h8m-8 4h6", color: "bg-warning/10 text-warning-strong" };
|
|
1590
1760
|
function ProfileSectionHeading({ title }) {
|
|
1591
1761
|
const glyph = sectionGlyphs[title] ?? resourceGlyph;
|
|
1592
|
-
return /* @__PURE__ */
|
|
1593
|
-
/* @__PURE__ */
|
|
1594
|
-
/* @__PURE__ */
|
|
1762
|
+
return /* @__PURE__ */ jsxs7("span", { className: "flex min-w-0 items-center gap-3", children: [
|
|
1763
|
+
/* @__PURE__ */ jsx9("span", { className: `flex size-9 shrink-0 items-center justify-center rounded-lg ${glyph.color}`, children: /* @__PURE__ */ jsx9("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", className: "size-4", fill: "none", stroke: "currentColor", strokeWidth: "1.7", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx9("path", { d: glyph.path }) }) }),
|
|
1764
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 break-words text-sm font-semibold text-foreground", children: title })
|
|
1595
1765
|
] });
|
|
1596
1766
|
}
|
|
1597
1767
|
function ProfileCard({ title, description, children }) {
|
|
1598
|
-
return /* @__PURE__ */
|
|
1599
|
-
/* @__PURE__ */
|
|
1600
|
-
/* @__PURE__ */
|
|
1601
|
-
description && /* @__PURE__ */
|
|
1768
|
+
return /* @__PURE__ */ jsxs7("section", { "aria-label": title, className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: [
|
|
1769
|
+
/* @__PURE__ */ jsxs7("header", { className: "border-b border-border bg-muted/35 px-4 py-3 sm:px-5", children: [
|
|
1770
|
+
/* @__PURE__ */ jsx9("h3", { children: /* @__PURE__ */ jsx9(ProfileSectionHeading, { title }) }),
|
|
1771
|
+
description && /* @__PURE__ */ jsx9("p", { className: "mt-2 text-sm leading-6 text-muted-foreground", children: description })
|
|
1602
1772
|
] }),
|
|
1603
|
-
/* @__PURE__ */
|
|
1773
|
+
/* @__PURE__ */ jsx9("div", { className: "min-w-0 space-y-4 p-4 sm:p-5", children })
|
|
1604
1774
|
] });
|
|
1605
1775
|
}
|
|
1606
1776
|
|
|
1607
1777
|
// src/web-react/agent-profile-viewer.tsx
|
|
1608
|
-
import { jsx as
|
|
1778
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1609
1779
|
function nonempty(value) {
|
|
1610
1780
|
return Boolean(value?.trim());
|
|
1611
1781
|
}
|
|
@@ -1615,43 +1785,43 @@ function resourceName(resource) {
|
|
|
1615
1785
|
}
|
|
1616
1786
|
function ResourceRow({ label, resource, path }) {
|
|
1617
1787
|
const name = resourceName(resource);
|
|
1618
|
-
return /* @__PURE__ */
|
|
1619
|
-
/* @__PURE__ */
|
|
1620
|
-
/* @__PURE__ */
|
|
1621
|
-
path && /* @__PURE__ */
|
|
1622
|
-
/* @__PURE__ */
|
|
1623
|
-
resource.kind === "github" && resource.ref && /* @__PURE__ */
|
|
1788
|
+
return /* @__PURE__ */ jsxs8("li", { className: "min-w-0 py-2 first:pt-0 last:pb-0", children: [
|
|
1789
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
|
|
1790
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 text-sm font-medium text-muted-foreground", children: label }),
|
|
1791
|
+
path && /* @__PURE__ */ jsx10("code", { className: "break-all font-mono text-sm text-foreground", children: path }),
|
|
1792
|
+
/* @__PURE__ */ jsx10("span", { className: "min-w-0 break-all text-sm text-foreground", children: name }),
|
|
1793
|
+
resource.kind === "github" && resource.ref && /* @__PURE__ */ jsxs8("span", { className: "shrink-0 text-sm text-muted-foreground", children: [
|
|
1624
1794
|
"at ",
|
|
1625
1795
|
resource.ref
|
|
1626
1796
|
] })
|
|
1627
1797
|
] }),
|
|
1628
|
-
resource.kind === "inline" && nonempty(resource.content) && /* @__PURE__ */
|
|
1629
|
-
/* @__PURE__ */
|
|
1630
|
-
/* @__PURE__ */
|
|
1798
|
+
resource.kind === "inline" && nonempty(resource.content) && /* @__PURE__ */ jsxs8("details", { className: "mt-1.5", children: [
|
|
1799
|
+
/* @__PURE__ */ jsx10("summary", { className: "w-fit cursor-pointer select-none text-sm text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: "View inline content" }),
|
|
1800
|
+
/* @__PURE__ */ jsx10("pre", { className: "mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 p-3 text-sm leading-relaxed text-foreground", children: resource.content })
|
|
1631
1801
|
] })
|
|
1632
1802
|
] });
|
|
1633
1803
|
}
|
|
1634
1804
|
function PromptDetail({ label, path, note, value }) {
|
|
1635
|
-
return /* @__PURE__ */
|
|
1636
|
-
/* @__PURE__ */
|
|
1637
|
-
/* @__PURE__ */
|
|
1638
|
-
/* @__PURE__ */
|
|
1639
|
-
/* @__PURE__ */
|
|
1805
|
+
return /* @__PURE__ */ jsxs8("div", { className: "min-w-0 space-y-3", children: [
|
|
1806
|
+
/* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
|
|
1807
|
+
/* @__PURE__ */ jsx10("h4", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
1808
|
+
/* @__PURE__ */ jsx10("code", { className: "block break-all font-mono text-xs text-primary", children: path }),
|
|
1809
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm leading-6 text-muted-foreground", children: note })
|
|
1640
1810
|
] }),
|
|
1641
|
-
/* @__PURE__ */
|
|
1811
|
+
/* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/35 p-4 text-sm leading-7 text-foreground", children: value })
|
|
1642
1812
|
] });
|
|
1643
1813
|
}
|
|
1644
1814
|
function ProfileSection({ title, children }) {
|
|
1645
|
-
return /* @__PURE__ */
|
|
1815
|
+
return /* @__PURE__ */ jsx10(ProfileCard, { title, children });
|
|
1646
1816
|
}
|
|
1647
1817
|
function ProfileConfiguration({ expanded, children }) {
|
|
1648
|
-
if (expanded) return /* @__PURE__ */
|
|
1649
|
-
return /* @__PURE__ */
|
|
1650
|
-
/* @__PURE__ */
|
|
1818
|
+
if (expanded) return /* @__PURE__ */ jsx10("div", { className: "space-y-4", children });
|
|
1819
|
+
return /* @__PURE__ */ jsxs8("details", { className: "group/config border-t border-border pt-4", children: [
|
|
1820
|
+
/* @__PURE__ */ jsxs8("summary", { className: "flex cursor-pointer list-none items-center justify-between gap-3 rounded-sm py-2 font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", children: [
|
|
1651
1821
|
"Profile configuration ",
|
|
1652
|
-
/* @__PURE__ */
|
|
1822
|
+
/* @__PURE__ */ jsx10("span", { "aria-hidden": "true", className: "text-muted-foreground group-open/config:rotate-90", children: "\u203A" })
|
|
1653
1823
|
] }),
|
|
1654
|
-
/* @__PURE__ */
|
|
1824
|
+
/* @__PURE__ */ jsx10("div", { className: "space-y-4 pt-4", children })
|
|
1655
1825
|
] });
|
|
1656
1826
|
}
|
|
1657
1827
|
function permissionRows(profile) {
|
|
@@ -1703,21 +1873,21 @@ function ProfileOverview({ profile, defaultExpanded = true, showIdentity = true
|
|
|
1703
1873
|
const hasBehavior = Boolean(nonempty(prompt?.systemPrompt) || nonempty(prompt?.appendSystemPrompt) || instructions.length || (typeof resourceInstructions === "string" ? nonempty(resourceInstructions) : resourceInstructions));
|
|
1704
1874
|
const hasConfiguration = Boolean(hasBehavior || tools.length || permissions.length || mcp.length || profile.connections?.length || resources.length || profile.resources?.failOnError || profile.subagents && Object.keys(profile.subagents).length || profile.hooks && Object.keys(profile.hooks).length || profile.modes && Object.keys(profile.modes).length);
|
|
1705
1875
|
const hasProfileDetails = Boolean(profile.model?.default || profile.model?.small || profile.model?.reasoningEffort || profile.model?.provider || profile.harness || profile.description || profile.version || profile.tags?.length || hasConfiguration);
|
|
1706
|
-
return /* @__PURE__ */
|
|
1707
|
-
(showIdentity || nonempty(profile.description)) && /* @__PURE__ */
|
|
1708
|
-
showIdentity && /* @__PURE__ */
|
|
1709
|
-
nonempty(profile.description) && /* @__PURE__ */
|
|
1876
|
+
return /* @__PURE__ */ jsxs8("div", { className: "min-w-0 text-sm text-foreground", children: [
|
|
1877
|
+
(showIdentity || nonempty(profile.description)) && /* @__PURE__ */ jsxs8("header", { className: "mb-6 min-w-0", children: [
|
|
1878
|
+
showIdentity && /* @__PURE__ */ jsx10("h2", { className: "break-words text-lg font-semibold leading-tight text-foreground", children: nonempty(profile.name) ? profile.name : "Unnamed profile" }),
|
|
1879
|
+
nonempty(profile.description) && /* @__PURE__ */ jsx10("p", { className: "mt-2 whitespace-pre-wrap break-words leading-6 text-muted-foreground", children: profile.description })
|
|
1710
1880
|
] }),
|
|
1711
|
-
!hasProfileDetails && /* @__PURE__ */
|
|
1712
|
-
(hasConfiguration || profile.model || profile.harness || profile.version || profile.tags?.length) && /* @__PURE__ */
|
|
1713
|
-
hasBehavior && /* @__PURE__ */
|
|
1714
|
-
!nonempty(prompt?.systemPrompt) && /* @__PURE__ */
|
|
1715
|
-
/* @__PURE__ */
|
|
1716
|
-
/* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1881
|
+
!hasProfileDetails && /* @__PURE__ */ jsx10("p", { className: "text-muted-foreground", children: "No profile details are configured." }),
|
|
1882
|
+
(hasConfiguration || profile.model || profile.harness || profile.version || profile.tags?.length) && /* @__PURE__ */ jsxs8(ProfileConfiguration, { expanded: defaultExpanded, children: [
|
|
1883
|
+
hasBehavior && /* @__PURE__ */ jsx10(ProfileSection, { title: "Prompts and instructions", children: /* @__PURE__ */ jsxs8("div", { className: "space-y-6", children: [
|
|
1884
|
+
!nonempty(prompt?.systemPrompt) && /* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
|
|
1885
|
+
/* @__PURE__ */ jsx10("h4", { className: "text-sm font-semibold", children: "System prompt" }),
|
|
1886
|
+
/* @__PURE__ */ jsx10("code", { className: "block font-mono text-xs text-primary", children: "prompt.systemPrompt" }),
|
|
1887
|
+
/* @__PURE__ */ jsx10("p", { className: "text-sm leading-6 text-muted-foreground", children: "No override configured. The runtime supplies its default system prompt." })
|
|
1718
1888
|
] }),
|
|
1719
|
-
nonempty(prompt?.systemPrompt) && /* @__PURE__ */
|
|
1720
|
-
nonempty(prompt?.appendSystemPrompt) && /* @__PURE__ */
|
|
1889
|
+
nonempty(prompt?.systemPrompt) && /* @__PURE__ */ jsx10(PromptDetail, { label: "System prompt", path: "prompt.systemPrompt", note: "The profile\u2019s system prompt override. Replaces the harness default where supported.", value: prompt.systemPrompt }),
|
|
1890
|
+
nonempty(prompt?.appendSystemPrompt) && /* @__PURE__ */ jsx10(
|
|
1721
1891
|
PromptDetail,
|
|
1722
1892
|
{
|
|
1723
1893
|
label: "Appended system prompt",
|
|
@@ -1726,63 +1896,63 @@ function ProfileOverview({ profile, defaultExpanded = true, showIdentity = true
|
|
|
1726
1896
|
value: prompt.appendSystemPrompt
|
|
1727
1897
|
}
|
|
1728
1898
|
),
|
|
1729
|
-
instructions.length > 0 && /* @__PURE__ */
|
|
1730
|
-
/* @__PURE__ */
|
|
1731
|
-
/* @__PURE__ */
|
|
1732
|
-
/* @__PURE__ */
|
|
1733
|
-
/* @__PURE__ */
|
|
1899
|
+
instructions.length > 0 && /* @__PURE__ */ jsxs8("div", { className: "space-y-1.5", children: [
|
|
1900
|
+
/* @__PURE__ */ jsx10("h4", { className: "text-sm font-semibold text-foreground", children: "Project instructions" }),
|
|
1901
|
+
/* @__PURE__ */ jsx10("code", { className: "block break-all font-mono text-xs text-primary", children: "prompt.instructions" }),
|
|
1902
|
+
/* @__PURE__ */ jsx10("p", { className: "pb-2 text-sm leading-6 text-muted-foreground", children: "Lower-priority workspace guidance. These entries are separate from the system prompt." }),
|
|
1903
|
+
/* @__PURE__ */ jsx10("ul", { className: "space-y-2", children: instructions.map((instruction, index) => /* @__PURE__ */ jsx10("li", { children: /* @__PURE__ */ jsx10("div", { className: "whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/35 p-4 text-sm leading-7", children: instruction }) }, `${index}:${instruction}`)) })
|
|
1734
1904
|
] }),
|
|
1735
|
-
typeof resourceInstructions === "string" && nonempty(resourceInstructions) && /* @__PURE__ */
|
|
1736
|
-
resourceInstructions && typeof resourceInstructions !== "string" && /* @__PURE__ */
|
|
1905
|
+
typeof resourceInstructions === "string" && nonempty(resourceInstructions) && /* @__PURE__ */ jsx10(PromptDetail, { label: "Resource instructions", path: "resources.instructions", note: "Instructions declared with workspace resources. Their loading is controlled by the runtime.", value: resourceInstructions }),
|
|
1906
|
+
resourceInstructions && typeof resourceInstructions !== "string" && /* @__PURE__ */ jsx10("ul", { children: /* @__PURE__ */ jsx10(ResourceRow, { label: "resources.instructions", resource: resourceInstructions }) })
|
|
1737
1907
|
] }) }),
|
|
1738
|
-
(profile.model?.default || profile.model?.small || profile.model?.provider || profile.model?.reasoningEffort || profile.harness) && /* @__PURE__ */
|
|
1908
|
+
(profile.model?.default || profile.model?.small || profile.model?.provider || profile.model?.reasoningEffort || profile.harness) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Model and runtime", children: /* @__PURE__ */ jsx10("dl", { className: "grid gap-x-6 gap-y-4 sm:grid-cols-2", children: [
|
|
1739
1909
|
["Default model", profile.model?.default],
|
|
1740
1910
|
["Provider", profile.model?.provider],
|
|
1741
1911
|
["Preferred harness", profile.harness],
|
|
1742
1912
|
["Reasoning", profile.model?.reasoningEffort],
|
|
1743
1913
|
["Small model", profile.model?.small]
|
|
1744
|
-
].filter(([, value]) => value).map(([label, value]) => /* @__PURE__ */
|
|
1745
|
-
/* @__PURE__ */
|
|
1746
|
-
/* @__PURE__ */
|
|
1914
|
+
].filter(([, value]) => value).map(([label, value]) => /* @__PURE__ */ jsxs8("div", { className: "min-w-0", children: [
|
|
1915
|
+
/* @__PURE__ */ jsx10("dt", { className: "mb-1 text-sm text-muted-foreground", children: label }),
|
|
1916
|
+
/* @__PURE__ */ jsx10("dd", { className: "break-words font-medium", children: value })
|
|
1747
1917
|
] }, label)) }) }),
|
|
1748
|
-
(tools.length > 0 || permissions.length > 0) && /* @__PURE__ */
|
|
1918
|
+
(tools.length > 0 || permissions.length > 0) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Tools and permissions", children: /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10("ul", { className: "divide-y divide-border/70", children: [.../* @__PURE__ */ new Set([...tools.map(([name]) => name), ...permissions.map(([name]) => name)])].sort().map((name) => {
|
|
1749
1919
|
const enabled = tools.find(([tool]) => tool === name)?.[1];
|
|
1750
1920
|
const policy = permissions.find(([permission]) => permission === name)?.[1];
|
|
1751
|
-
return /* @__PURE__ */
|
|
1752
|
-
/* @__PURE__ */
|
|
1753
|
-
/* @__PURE__ */
|
|
1921
|
+
return /* @__PURE__ */ jsxs8("li", { className: "flex min-w-0 items-center justify-between gap-4 py-1.5 first:pt-0 last:pb-0", children: [
|
|
1922
|
+
/* @__PURE__ */ jsx10("code", { className: "min-w-0 break-all font-mono text-sm text-foreground", children: name }),
|
|
1923
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 text-sm text-muted-foreground", children: [enabled === void 0 ? void 0 : enabled ? "Enabled" : "Disabled", policy].filter(Boolean).join(" \xB7 ") })
|
|
1754
1924
|
] }, name);
|
|
1755
1925
|
}) }) }) }),
|
|
1756
|
-
mcp.length > 0 && /* @__PURE__ */
|
|
1757
|
-
/* @__PURE__ */
|
|
1758
|
-
/* @__PURE__ */
|
|
1926
|
+
mcp.length > 0 && /* @__PURE__ */ jsx10(ProfileSection, { title: "MCP servers", children: /* @__PURE__ */ jsx10("ul", { className: "divide-y divide-border/70", children: mcp.map(([name, server]) => /* @__PURE__ */ jsxs8("li", { className: "flex min-w-0 items-center justify-between gap-4 py-1.5 first:pt-0 last:pb-0", children: [
|
|
1927
|
+
/* @__PURE__ */ jsx10("span", { className: "min-w-0 break-words font-medium text-foreground", children: name }),
|
|
1928
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 text-sm text-muted-foreground", children: server.enabled === false ? "Disabled in profile" : "Enabled in profile" })
|
|
1759
1929
|
] }, name)) }) }),
|
|
1760
|
-
Boolean(profile.connections?.length) && /* @__PURE__ */
|
|
1761
|
-
/* @__PURE__ */
|
|
1762
|
-
connection.capabilities.length > 0 && /* @__PURE__ */
|
|
1930
|
+
Boolean(profile.connections?.length) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Hub capabilities", children: /* @__PURE__ */ jsx10("ul", { className: "space-y-2", children: profile.connections?.map((connection, index) => /* @__PURE__ */ jsxs8("li", { className: "min-w-0", children: [
|
|
1931
|
+
/* @__PURE__ */ jsx10("p", { className: "font-medium text-foreground", children: connection.alias || "Hub connection" }),
|
|
1932
|
+
connection.capabilities.length > 0 && /* @__PURE__ */ jsx10("ul", { className: "mt-1 flex flex-wrap gap-1.5", children: connection.capabilities.map((capability, capabilityIndex) => /* @__PURE__ */ jsx10("li", { className: "rounded-full bg-muted px-2 py-0.5 text-sm text-muted-foreground", children: capability }, `${capability}:${capabilityIndex}`)) })
|
|
1763
1933
|
] }, `${connection.alias ?? "connection"}:${index}`)) }) }),
|
|
1764
|
-
(resources.length > 0 || profile.resources?.failOnError) && /* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
profile.resources?.failOnError && /* @__PURE__ */
|
|
1934
|
+
(resources.length > 0 || profile.resources?.failOnError) && /* @__PURE__ */ jsxs8(ProfileSection, { title: "Declared resources", children: [
|
|
1935
|
+
/* @__PURE__ */ jsx10("ul", { className: "divide-y divide-border/70", children: resources.map(({ key, ...item }) => /* @__PURE__ */ jsx10(ResourceRow, { ...item }, key)) }),
|
|
1936
|
+
profile.resources?.failOnError && /* @__PURE__ */ jsx10("p", { className: "mt-2 text-sm text-muted-foreground", children: "Profile configuration requires declared resources to load successfully." })
|
|
1767
1937
|
] }),
|
|
1768
|
-
Boolean(profile.subagents && Object.keys(profile.subagents).length) && /* @__PURE__ */
|
|
1769
|
-
/* @__PURE__ */
|
|
1770
|
-
nonempty(subagent.description) && /* @__PURE__ */
|
|
1938
|
+
Boolean(profile.subagents && Object.keys(profile.subagents).length) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Subagents", children: /* @__PURE__ */ jsx10("ul", { className: "divide-y divide-border/70", children: Object.entries(profile.subagents ?? {}).sort(([a], [b]) => a.localeCompare(b)).map(([name, subagent]) => /* @__PURE__ */ jsxs8("li", { className: "py-1.5 first:pt-0 last:pb-0", children: [
|
|
1939
|
+
/* @__PURE__ */ jsx10("p", { className: "font-medium text-foreground", children: name }),
|
|
1940
|
+
nonempty(subagent.description) && /* @__PURE__ */ jsx10("p", { className: "mt-0.5 whitespace-pre-wrap break-words text-sm leading-relaxed text-muted-foreground", children: subagent.description })
|
|
1771
1941
|
] }, name)) }) }),
|
|
1772
|
-
Boolean(profile.hooks && Object.keys(profile.hooks).length) && /* @__PURE__ */
|
|
1773
|
-
/* @__PURE__ */
|
|
1774
|
-
/* @__PURE__ */
|
|
1942
|
+
Boolean(profile.hooks && Object.keys(profile.hooks).length) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Lifecycle hooks", children: /* @__PURE__ */ jsx10("ul", { className: "space-y-1", children: Object.entries(profile.hooks ?? {}).sort(([a], [b]) => a.localeCompare(b)).map(([event, commands]) => /* @__PURE__ */ jsxs8("li", { className: "flex min-w-0 justify-between gap-4", children: [
|
|
1943
|
+
/* @__PURE__ */ jsx10("code", { className: "font-mono text-sm text-foreground", children: event }),
|
|
1944
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-sm text-muted-foreground", children: [
|
|
1775
1945
|
commands.length,
|
|
1776
1946
|
" configured"
|
|
1777
1947
|
] })
|
|
1778
1948
|
] }, event)) }) }),
|
|
1779
|
-
Boolean(profile.modes && Object.keys(profile.modes).length) && /* @__PURE__ */
|
|
1780
|
-
(profile.version || profile.tags?.length) && /* @__PURE__ */
|
|
1781
|
-
profile.version && /* @__PURE__ */
|
|
1949
|
+
Boolean(profile.modes && Object.keys(profile.modes).length) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Modes", children: /* @__PURE__ */ jsx10("ul", { className: "flex flex-wrap gap-1.5", children: Object.keys(profile.modes ?? {}).sort().map((mode) => /* @__PURE__ */ jsx10("li", { className: "rounded-full bg-muted px-2 py-0.5 text-sm text-muted-foreground", children: mode }, mode)) }) }),
|
|
1950
|
+
(profile.version || profile.tags?.length) && /* @__PURE__ */ jsx10(ProfileSection, { title: "Metadata", children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap gap-x-4 gap-y-2 text-muted-foreground", children: [
|
|
1951
|
+
profile.version && /* @__PURE__ */ jsxs8("span", { children: [
|
|
1782
1952
|
"Version ",
|
|
1783
1953
|
profile.version
|
|
1784
1954
|
] }),
|
|
1785
|
-
profile.tags?.map((tag) => /* @__PURE__ */
|
|
1955
|
+
profile.tags?.map((tag) => /* @__PURE__ */ jsx10("span", { children: tag }, tag))
|
|
1786
1956
|
] }) })
|
|
1787
1957
|
] })
|
|
1788
1958
|
] });
|
|
@@ -1790,54 +1960,54 @@ function ProfileOverview({ profile, defaultExpanded = true, showIdentity = true
|
|
|
1790
1960
|
function JsonValue({ value, name }) {
|
|
1791
1961
|
if (value !== null && typeof value === "object") {
|
|
1792
1962
|
const entries = Object.entries(value);
|
|
1793
|
-
return /* @__PURE__ */
|
|
1794
|
-
/* @__PURE__ */
|
|
1795
|
-
/* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
1963
|
+
return /* @__PURE__ */ jsx10("li", { className: "min-w-0 list-none", children: /* @__PURE__ */ jsxs8("details", { open: true, children: [
|
|
1964
|
+
/* @__PURE__ */ jsxs8("summary", { className: "cursor-pointer break-all rounded px-2 py-2 font-mono text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: [
|
|
1965
|
+
/* @__PURE__ */ jsx10("span", { className: "font-medium text-primary", children: name }),
|
|
1966
|
+
/* @__PURE__ */ jsx10("span", { className: "ml-2 text-xs text-muted-foreground", children: Array.isArray(value) ? `Array \xB7 ${entries.length}` : `Object \xB7 ${entries.length}` })
|
|
1797
1967
|
] }),
|
|
1798
|
-
/* @__PURE__ */
|
|
1799
|
-
entries.map(([key, child]) => /* @__PURE__ */
|
|
1800
|
-
entries.length === 0 && /* @__PURE__ */
|
|
1968
|
+
/* @__PURE__ */ jsxs8("ul", { className: "ml-3 min-w-0 border-l border-border pl-3", children: [
|
|
1969
|
+
entries.map(([key, child]) => /* @__PURE__ */ jsx10(JsonValue, { name: key, value: child }, key)),
|
|
1970
|
+
entries.length === 0 && /* @__PURE__ */ jsx10("li", { className: "block px-2 py-1 font-mono text-sm text-muted-foreground", children: Array.isArray(value) ? "[]" : "{}" })
|
|
1801
1971
|
] })
|
|
1802
1972
|
] }) });
|
|
1803
1973
|
}
|
|
1804
|
-
return /* @__PURE__ */
|
|
1805
|
-
/* @__PURE__ */
|
|
1974
|
+
return /* @__PURE__ */ jsxs8("li", { className: "min-w-0 list-none px-2 py-2", children: [
|
|
1975
|
+
/* @__PURE__ */ jsxs8("span", { className: "block break-all font-mono text-xs font-medium text-primary", children: [
|
|
1806
1976
|
name,
|
|
1807
|
-
/* @__PURE__ */
|
|
1977
|
+
/* @__PURE__ */ jsx10("span", { className: "ml-2 font-normal text-muted-foreground", children: value === null ? "null" : typeof value })
|
|
1808
1978
|
] }),
|
|
1809
|
-
/* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx10("span", { className: "mt-1 block whitespace-pre-wrap break-words font-mono text-sm leading-6 text-foreground", children: typeof value === "string" ? value || '""' : JSON.stringify(value) })
|
|
1810
1980
|
] });
|
|
1811
1981
|
}
|
|
1812
1982
|
function AgentProfileViewer({ profile, className = "", showFullProfile = false, ...overview }) {
|
|
1813
|
-
const [view, setView] =
|
|
1983
|
+
const [view, setView] = useState9("overview");
|
|
1814
1984
|
const json = showFullProfile ? JSON.stringify(profile, null, 2) : "";
|
|
1815
|
-
return /* @__PURE__ */
|
|
1816
|
-
/* @__PURE__ */
|
|
1817
|
-
/* @__PURE__ */
|
|
1818
|
-
/* @__PURE__ */
|
|
1819
|
-
/* @__PURE__ */
|
|
1820
|
-
/* @__PURE__ */
|
|
1985
|
+
return /* @__PURE__ */ jsx10("section", { className: `min-w-0 text-sm text-foreground ${className}`.trim(), "aria-label": "Agent profile", children: showFullProfile ? /* @__PURE__ */ jsxs8(Tabs, { value: view, onValueChange: setView, children: [
|
|
1986
|
+
/* @__PURE__ */ jsxs8("div", { className: "mb-4 flex min-w-0 flex-wrap items-center justify-between gap-3 rounded-xl border border-border bg-card p-2", children: [
|
|
1987
|
+
/* @__PURE__ */ jsxs8(TabsList, { "aria-label": "Profile view", className: "h-auto flex-wrap justify-start", children: [
|
|
1988
|
+
/* @__PURE__ */ jsx10(TabsTrigger, { value: "overview", children: "Overview" }),
|
|
1989
|
+
/* @__PURE__ */ jsx10(TabsTrigger, { value: "json", children: "JSON tree" }),
|
|
1990
|
+
/* @__PURE__ */ jsx10(TabsTrigger, { value: "raw", children: "Raw" })
|
|
1821
1991
|
] }),
|
|
1822
|
-
/* @__PURE__ */
|
|
1823
|
-
/* @__PURE__ */
|
|
1824
|
-
/* @__PURE__ */
|
|
1992
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
1993
|
+
/* @__PURE__ */ jsx10(CopyButton, { text: json }),
|
|
1994
|
+
/* @__PURE__ */ jsx10(Button, { asChild: true, variant: "outline", size: "sm", children: /* @__PURE__ */ jsx10("a", { href: `data:application/json;charset=utf-8,${encodeURIComponent(json)}`, download: "agent-profile.json", children: "Download" }) })
|
|
1825
1995
|
] })
|
|
1826
1996
|
] }),
|
|
1827
|
-
/* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
1829
|
-
/* @__PURE__ */
|
|
1830
|
-
/* @__PURE__ */
|
|
1831
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ jsx10(TabsContent, { value: "overview", className: "mt-0", children: /* @__PURE__ */ jsx10(ProfileOverview, { profile, ...overview }) }),
|
|
1998
|
+
/* @__PURE__ */ jsx10(TabsContent, { value: "json", className: "mt-0", children: /* @__PURE__ */ jsxs8("div", { className: "min-w-0 overflow-hidden rounded-xl border border-border bg-card", children: [
|
|
1999
|
+
/* @__PURE__ */ jsxs8("div", { className: "border-b border-border bg-muted/35 p-4", children: [
|
|
2000
|
+
/* @__PURE__ */ jsx10(ProfileSectionHeading, { title: "Full profile JSON" }),
|
|
2001
|
+
/* @__PURE__ */ jsx10("p", { className: "mt-2 text-sm leading-6 text-muted-foreground", children: "Every configured field, including extensions. Expand or collapse any object." })
|
|
1832
2002
|
] }),
|
|
1833
|
-
/* @__PURE__ */
|
|
2003
|
+
/* @__PURE__ */ jsx10("ul", { className: "min-w-0 p-2 sm:p-4", children: Object.entries(profile).map(([key, value]) => /* @__PURE__ */ jsx10(JsonValue, { name: key, value }, key)) })
|
|
1834
2004
|
] }) }),
|
|
1835
|
-
/* @__PURE__ */
|
|
1836
|
-
] }) : /* @__PURE__ */
|
|
2005
|
+
/* @__PURE__ */ jsx10(TabsContent, { value: "raw", className: "min-w-0 mt-0", children: /* @__PURE__ */ jsx10(CodeBlock, { code: json, language: "json", label: "agent-profile.json", showLineNumbers: true, className: "max-w-full" }) })
|
|
2006
|
+
] }) : /* @__PURE__ */ jsx10(ProfileOverview, { profile, ...overview }) });
|
|
1837
2007
|
}
|
|
1838
2008
|
|
|
1839
2009
|
// src/web-react/durable-plan-flow.ts
|
|
1840
|
-
import { useCallback as useCallback3, useEffect as
|
|
2010
|
+
import { useCallback as useCallback3, useEffect as useEffect8, useRef as useRef6, useState as useState10 } from "react";
|
|
1841
2011
|
var DurablePlanClientError = class extends Error {
|
|
1842
2012
|
constructor(message, status, code, currentPlan) {
|
|
1843
2013
|
super(message);
|
|
@@ -1924,13 +2094,13 @@ function createDurablePlanDecisionClient(options) {
|
|
|
1924
2094
|
};
|
|
1925
2095
|
}
|
|
1926
2096
|
function useDurablePlanFlow(options) {
|
|
1927
|
-
const [plan, setPlan] =
|
|
1928
|
-
const [deciding, setDeciding] =
|
|
1929
|
-
const [restoring, setRestoring] =
|
|
1930
|
-
const [error, setError] =
|
|
1931
|
-
const attachments =
|
|
1932
|
-
const decisionInFlight =
|
|
1933
|
-
|
|
2097
|
+
const [plan, setPlan] = useState10(options.plan);
|
|
2098
|
+
const [deciding, setDeciding] = useState10(null);
|
|
2099
|
+
const [restoring, setRestoring] = useState10(false);
|
|
2100
|
+
const [error, setError] = useState10(null);
|
|
2101
|
+
const attachments = useRef6(/* @__PURE__ */ new Map());
|
|
2102
|
+
const decisionInFlight = useRef6(false);
|
|
2103
|
+
useEffect8(() => setPlan(options.plan), [options.plan]);
|
|
1934
2104
|
const apply = useCallback3(async (result) => {
|
|
1935
2105
|
setPlan(result.plan);
|
|
1936
2106
|
options.onUpdated?.(result.plan);
|
|
@@ -2099,7 +2269,7 @@ function createDurableInteractionAnswerSubmitter(options) {
|
|
|
2099
2269
|
}
|
|
2100
2270
|
|
|
2101
2271
|
// src/web-react/use-chat-interactions.ts
|
|
2102
|
-
import { useCallback as useCallback4, useMemo as
|
|
2272
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useState as useState11 } from "react";
|
|
2103
2273
|
function hasPendingContentDuplicate(list, interaction) {
|
|
2104
2274
|
if (interaction.status !== "pending") return false;
|
|
2105
2275
|
const signature = questionInteractionContentSignature(interaction);
|
|
@@ -2178,7 +2348,7 @@ function hydrateChatInteractions(list, persisted) {
|
|
|
2178
2348
|
return persisted.reduce(upsertChatInteraction, list);
|
|
2179
2349
|
}
|
|
2180
2350
|
function useChatInteractions(options = {}) {
|
|
2181
|
-
const [interactions, setInteractions] =
|
|
2351
|
+
const [interactions, setInteractions] = useState11([]);
|
|
2182
2352
|
const upsert = useCallback4((interaction) => {
|
|
2183
2353
|
setInteractions((prev) => upsertChatInteraction(prev, interaction));
|
|
2184
2354
|
}, []);
|
|
@@ -2200,12 +2370,12 @@ function useChatInteractions(options = {}) {
|
|
|
2200
2370
|
setInteractions((prev) => terminalizePendingChatInteractions(prev, status));
|
|
2201
2371
|
}, []);
|
|
2202
2372
|
const reset = useCallback4(() => setInteractions([]), []);
|
|
2203
|
-
const pending =
|
|
2373
|
+
const pending = useMemo4(() => interactions.filter((item) => item.status === "pending"), [interactions]);
|
|
2204
2374
|
return { interactions, pending, upsert, applyCancel, markResolved, restore, hydrate, terminalizePending, reset };
|
|
2205
2375
|
}
|
|
2206
2376
|
|
|
2207
2377
|
// src/web-react/use-file-mentions.ts
|
|
2208
|
-
import { useCallback as useCallback5, useMemo as
|
|
2378
|
+
import { useCallback as useCallback5, useMemo as useMemo5, useRef as useRef7, useState as useState12 } from "react";
|
|
2209
2379
|
var FILE_MENTION_KIND = "file";
|
|
2210
2380
|
function toMentionItem(file) {
|
|
2211
2381
|
return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
|
|
@@ -2263,11 +2433,11 @@ function useFileMentions(options) {
|
|
|
2263
2433
|
emptyText = DEFAULT_MENTION_EMPTY_TEXT
|
|
2264
2434
|
} = options;
|
|
2265
2435
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2266
|
-
const [state, setState] =
|
|
2267
|
-
const stateRef =
|
|
2436
|
+
const [state, setState] = useState12({ kind: "idle" });
|
|
2437
|
+
const stateRef = useRef7(state);
|
|
2268
2438
|
stateRef.current = state;
|
|
2269
|
-
const inFlightRef =
|
|
2270
|
-
const [mentions, setMentions] =
|
|
2439
|
+
const inFlightRef = useRef7(null);
|
|
2440
|
+
const [mentions, setMentions] = useState12([]);
|
|
2271
2441
|
const load = useCallback5(() => {
|
|
2272
2442
|
if (inFlightRef.current) return inFlightRef.current;
|
|
2273
2443
|
if (stateRef.current.kind === "idle") {
|
|
@@ -2322,7 +2492,7 @@ function useFileMentions(options) {
|
|
|
2322
2492
|
setMentions(items.filter((item) => item.kind === void 0 || item.kind === FILE_MENTION_KIND).map(toFileMention));
|
|
2323
2493
|
}, []);
|
|
2324
2494
|
const clearMentions = useCallback5(() => setMentions([]), []);
|
|
2325
|
-
const mention =
|
|
2495
|
+
const mention = useMemo5(
|
|
2326
2496
|
() => ({
|
|
2327
2497
|
fetchItems,
|
|
2328
2498
|
onMentionsChange,
|
|
@@ -2374,8 +2544,8 @@ function segmentMentionContent(content, parts) {
|
|
|
2374
2544
|
}
|
|
2375
2545
|
|
|
2376
2546
|
// src/web-react/mission-activity.tsx
|
|
2377
|
-
import { useCallback as useCallback6, useEffect as
|
|
2378
|
-
import { Fragment as Fragment2, jsx as
|
|
2547
|
+
import { useCallback as useCallback6, useEffect as useEffect9, useState as useState13 } from "react";
|
|
2548
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2379
2549
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
|
|
2380
2550
|
var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
|
|
2381
2551
|
var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted"]);
|
|
@@ -2422,19 +2592,19 @@ function waterfallLayout(trace) {
|
|
|
2422
2592
|
});
|
|
2423
2593
|
}
|
|
2424
2594
|
function ChevronGlyph({ className }) {
|
|
2425
|
-
return /* @__PURE__ */
|
|
2595
|
+
return /* @__PURE__ */ jsx11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx11("path", { d: "m6 9 6 6 6-6" }) });
|
|
2426
2596
|
}
|
|
2427
2597
|
function RefreshGlyph({ className }) {
|
|
2428
|
-
return /* @__PURE__ */
|
|
2598
|
+
return /* @__PURE__ */ jsx11("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx11("path", { d: "M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6" }) });
|
|
2429
2599
|
}
|
|
2430
2600
|
function CopyGlyph({ className }) {
|
|
2431
|
-
return /* @__PURE__ */
|
|
2432
|
-
/* @__PURE__ */
|
|
2433
|
-
/* @__PURE__ */
|
|
2601
|
+
return /* @__PURE__ */ jsxs9("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
2602
|
+
/* @__PURE__ */ jsx11("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2603
|
+
/* @__PURE__ */ jsx11("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2434
2604
|
] });
|
|
2435
2605
|
}
|
|
2436
2606
|
function TraceIdCopy({ traceId }) {
|
|
2437
|
-
const [copied, setCopied] =
|
|
2607
|
+
const [copied, setCopied] = useState13(false);
|
|
2438
2608
|
const copy = useCallback6(() => {
|
|
2439
2609
|
void navigator.clipboard?.writeText(traceId).then(
|
|
2440
2610
|
() => {
|
|
@@ -2445,7 +2615,7 @@ function TraceIdCopy({ traceId }) {
|
|
|
2445
2615
|
}
|
|
2446
2616
|
);
|
|
2447
2617
|
}, [traceId]);
|
|
2448
|
-
return /* @__PURE__ */
|
|
2618
|
+
return /* @__PURE__ */ jsxs9(
|
|
2449
2619
|
"button",
|
|
2450
2620
|
{
|
|
2451
2621
|
type: "button",
|
|
@@ -2454,29 +2624,29 @@ function TraceIdCopy({ traceId }) {
|
|
|
2454
2624
|
"aria-label": "Copy trace id",
|
|
2455
2625
|
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground",
|
|
2456
2626
|
children: [
|
|
2457
|
-
/* @__PURE__ */
|
|
2458
|
-
/* @__PURE__ */
|
|
2459
|
-
copied && /* @__PURE__ */
|
|
2627
|
+
/* @__PURE__ */ jsx11("span", { className: "truncate", children: traceId }),
|
|
2628
|
+
/* @__PURE__ */ jsx11(CopyGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
2629
|
+
copied && /* @__PURE__ */ jsx11("span", { className: "shrink-0 not-italic text-success", children: "copied" })
|
|
2460
2630
|
]
|
|
2461
2631
|
}
|
|
2462
2632
|
);
|
|
2463
2633
|
}
|
|
2464
2634
|
function StatusDot({ tone }) {
|
|
2465
|
-
return /* @__PURE__ */
|
|
2466
|
-
/* @__PURE__ */
|
|
2635
|
+
return /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center", children: [
|
|
2636
|
+
/* @__PURE__ */ jsx11(
|
|
2467
2637
|
"span",
|
|
2468
2638
|
{
|
|
2469
2639
|
"aria-hidden": true,
|
|
2470
2640
|
className: `h-2 w-2 shrink-0 rounded-full ${tone === "live" ? "bg-warning" : tone === "ok" ? "bg-success" : tone === "error" ? "bg-destructive" : "bg-muted-foreground/40"}`
|
|
2471
2641
|
}
|
|
2472
2642
|
),
|
|
2473
|
-
/* @__PURE__ */
|
|
2643
|
+
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: tone })
|
|
2474
2644
|
] });
|
|
2475
2645
|
}
|
|
2476
2646
|
function RunLabel({ tool, detail, live }) {
|
|
2477
|
-
return /* @__PURE__ */
|
|
2478
|
-
/* @__PURE__ */
|
|
2479
|
-
/* @__PURE__ */
|
|
2647
|
+
return /* @__PURE__ */ jsxs9("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
2648
|
+
/* @__PURE__ */ jsx11("span", { className: live ? "agent-shimmer font-medium" : "font-medium", "data-motion": live ? "essential" : void 0, children: tool }),
|
|
2649
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-muted-foreground", children: [
|
|
2480
2650
|
" \u2014 ",
|
|
2481
2651
|
detail
|
|
2482
2652
|
] })
|
|
@@ -2491,19 +2661,19 @@ function FlowWaterfall({ trace }) {
|
|
|
2491
2661
|
const rows = waterfallLayout(trace);
|
|
2492
2662
|
if (rows.length === 0) return null;
|
|
2493
2663
|
const cost = formatActivityCost(trace.costUsd);
|
|
2494
|
-
return /* @__PURE__ */
|
|
2495
|
-
rows.map((row, i) => /* @__PURE__ */
|
|
2496
|
-
/* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2664
|
+
return /* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
|
|
2665
|
+
rows.map((row, i) => /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto] items-center gap-2", children: [
|
|
2666
|
+
/* @__PURE__ */ jsx11("span", { className: "truncate font-mono text-xs text-muted-foreground", title: row.name, children: row.name }),
|
|
2667
|
+
/* @__PURE__ */ jsx11("div", { className: "relative h-2 rounded-sm bg-secondary", children: /* @__PURE__ */ jsx11(
|
|
2498
2668
|
"div",
|
|
2499
2669
|
{
|
|
2500
2670
|
className: `absolute inset-y-0 rounded-sm ${row.ok ? BAR_CLASS[row.kind] : "bg-destructive/80"} ${row.approx ? "opacity-70" : ""}`,
|
|
2501
2671
|
style: { left: `${row.offsetPct}%`, width: `${row.widthPct}%` }
|
|
2502
2672
|
}
|
|
2503
2673
|
) }),
|
|
2504
|
-
/* @__PURE__ */
|
|
2674
|
+
/* @__PURE__ */ jsx11("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground/70", children: row.durationLabel })
|
|
2505
2675
|
] }, i)),
|
|
2506
|
-
/* @__PURE__ */
|
|
2676
|
+
/* @__PURE__ */ jsxs9("p", { className: "pt-0.5 text-right font-mono text-xs tabular-nums text-muted-foreground/60", children: [
|
|
2507
2677
|
(trace.totalMs / 1e3).toFixed(1),
|
|
2508
2678
|
"s",
|
|
2509
2679
|
cost ? ` \xB7 ${cost}` : ""
|
|
@@ -2515,35 +2685,35 @@ function LaneRow({ run, staggerIndex }) {
|
|
|
2515
2685
|
const tone = activityTone(run.status);
|
|
2516
2686
|
const cost = formatActivityCost(run.costUsd);
|
|
2517
2687
|
const duration = formatActivityDuration(run.durationMs);
|
|
2518
|
-
return /* @__PURE__ */
|
|
2519
|
-
/* @__PURE__ */
|
|
2520
|
-
/* @__PURE__ */
|
|
2521
|
-
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */
|
|
2522
|
-
/* @__PURE__ */
|
|
2523
|
-
tone !== "live" && tone !== "ok" && /* @__PURE__ */
|
|
2524
|
-
cost && /* @__PURE__ */
|
|
2525
|
-
duration && /* @__PURE__ */
|
|
2688
|
+
return /* @__PURE__ */ jsxs9("div", { className: "agent-arrive flex items-center gap-2 py-1 text-xs", style: arrival, children: [
|
|
2689
|
+
/* @__PURE__ */ jsx11(StatusDot, { tone }),
|
|
2690
|
+
/* @__PURE__ */ jsx11(RunLabel, { tool: run.tool, detail: run.detail, live: tone === "live" }),
|
|
2691
|
+
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */ jsx11("span", { className: "shrink-0 rounded-full bg-warning/10 px-1.5 py-0.5 font-mono text-xs text-warning", children: [run.iteration !== void 0 ? `iter ${run.iteration}` : null, run.phase ?? null].filter(Boolean).join(" \xB7 ") }),
|
|
2692
|
+
/* @__PURE__ */ jsxs9("span", { className: "flex shrink-0 items-center gap-1.5 font-mono text-xs tabular-nums text-muted-foreground/70", children: [
|
|
2693
|
+
tone !== "live" && tone !== "ok" && /* @__PURE__ */ jsx11("span", { children: run.status }),
|
|
2694
|
+
cost && /* @__PURE__ */ jsx11("span", { children: cost }),
|
|
2695
|
+
duration && /* @__PURE__ */ jsx11("span", { children: duration })
|
|
2526
2696
|
] })
|
|
2527
2697
|
] });
|
|
2528
2698
|
}
|
|
2529
2699
|
function MissionActivityLane({ activity, startedAt, nowMs }) {
|
|
2530
|
-
const [expanded, setExpanded] =
|
|
2700
|
+
const [expanded, setExpanded] = useState13(false);
|
|
2531
2701
|
if (activity.length === 0) return null;
|
|
2532
|
-
return /* @__PURE__ */
|
|
2533
|
-
activity.map((run, index) => /* @__PURE__ */
|
|
2534
|
-
/* @__PURE__ */
|
|
2702
|
+
return /* @__PURE__ */ jsxs9("div", { className: "mt-1 border-l border-border pl-3", children: [
|
|
2703
|
+
activity.map((run, index) => /* @__PURE__ */ jsx11(LaneRow, { run, staggerIndex: index }, run.taskId)),
|
|
2704
|
+
/* @__PURE__ */ jsxs9(
|
|
2535
2705
|
"button",
|
|
2536
2706
|
{
|
|
2537
2707
|
type: "button",
|
|
2538
2708
|
onClick: () => setExpanded((v) => !v),
|
|
2539
2709
|
className: "flex items-center gap-1 py-0.5 text-xs font-medium text-muted-foreground/70 transition hover:text-foreground",
|
|
2540
2710
|
children: [
|
|
2541
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ jsx11(ChevronGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
2542
2712
|
"timeline"
|
|
2543
2713
|
]
|
|
2544
2714
|
}
|
|
2545
2715
|
),
|
|
2546
|
-
expanded && /* @__PURE__ */
|
|
2716
|
+
expanded && /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx11(
|
|
2547
2717
|
FlowWaterfall,
|
|
2548
2718
|
{
|
|
2549
2719
|
trace: stepActivityFlowTrace(activity, {
|
|
@@ -2560,39 +2730,39 @@ function ActivityRow({
|
|
|
2560
2730
|
staggerIndex
|
|
2561
2731
|
}) {
|
|
2562
2732
|
const arrival = useArrivalStyle(staggerIndex);
|
|
2563
|
-
const [open, setOpen] =
|
|
2733
|
+
const [open, setOpen] = useState13(false);
|
|
2564
2734
|
const tone = activityTone(record.status);
|
|
2565
2735
|
const cost = formatActivityCost(record.costUsd);
|
|
2566
2736
|
const duration = formatActivityDuration(record.durationMs);
|
|
2567
|
-
return /* @__PURE__ */
|
|
2568
|
-
/* @__PURE__ */
|
|
2569
|
-
/* @__PURE__ */
|
|
2570
|
-
/* @__PURE__ */
|
|
2571
|
-
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */
|
|
2572
|
-
/* @__PURE__ */
|
|
2737
|
+
return /* @__PURE__ */ jsxs9("div", { className: "agent-arrive rounded-lg border border-card-edge bg-card", style: arrival, children: [
|
|
2738
|
+
/* @__PURE__ */ jsxs9("button", { type: "button", onClick: () => setOpen((v) => !v), className: "flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm", children: [
|
|
2739
|
+
/* @__PURE__ */ jsx11(StatusDot, { tone }),
|
|
2740
|
+
/* @__PURE__ */ jsx11(RunLabel, { tool: record.tool, detail: record.detail, live: tone === "live" }),
|
|
2741
|
+
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */ jsx11("span", { className: "shrink-0 rounded-full bg-warning/10 px-2 py-0.5 font-mono text-xs text-warning", children: [record.iteration !== void 0 ? `iter ${record.iteration}` : null, record.phase ?? null].filter(Boolean).join(" \xB7 ") }),
|
|
2742
|
+
/* @__PURE__ */ jsx11(
|
|
2573
2743
|
"span",
|
|
2574
2744
|
{
|
|
2575
2745
|
className: `shrink-0 rounded-full px-2 py-0.5 text-xs font-medium ${tone === "ok" ? "bg-success/10 text-success" : tone === "error" ? "bg-destructive/10 text-destructive" : tone === "live" ? "bg-warning/10 text-warning" : "bg-secondary text-muted-foreground"}`,
|
|
2576
2746
|
children: record.status
|
|
2577
2747
|
}
|
|
2578
2748
|
),
|
|
2579
|
-
cost && /* @__PURE__ */
|
|
2580
|
-
/* @__PURE__ */
|
|
2749
|
+
cost && /* @__PURE__ */ jsx11("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground", children: cost }),
|
|
2750
|
+
/* @__PURE__ */ jsx11(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
|
|
2581
2751
|
] }),
|
|
2582
|
-
open && /* @__PURE__ */
|
|
2583
|
-
record.durationMs !== void 0 && /* @__PURE__ */
|
|
2584
|
-
/* @__PURE__ */
|
|
2585
|
-
/* @__PURE__ */
|
|
2586
|
-
/* @__PURE__ */
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
/* @__PURE__ */
|
|
2589
|
-
duration && /* @__PURE__ */
|
|
2590
|
-
/* @__PURE__ */
|
|
2591
|
-
/* @__PURE__ */
|
|
2752
|
+
open && /* @__PURE__ */ jsxs9("div", { className: "space-y-2.5 border-t border-border px-3 py-2.5", children: [
|
|
2753
|
+
record.durationMs !== void 0 && /* @__PURE__ */ jsx11("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx11(FlowWaterfall, { trace: stepActivityFlowTrace([record]) }) }),
|
|
2754
|
+
/* @__PURE__ */ jsxs9("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-xs", children: [
|
|
2755
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "task" }),
|
|
2756
|
+
/* @__PURE__ */ jsx11("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
|
|
2757
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "started" }),
|
|
2758
|
+
/* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
|
|
2759
|
+
duration && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2760
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "duration" }),
|
|
2761
|
+
/* @__PURE__ */ jsx11("dd", { className: "text-muted-foreground", children: duration })
|
|
2592
2762
|
] }),
|
|
2593
|
-
record.traceId && /* @__PURE__ */
|
|
2594
|
-
/* @__PURE__ */
|
|
2595
|
-
/* @__PURE__ */
|
|
2763
|
+
record.traceId && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2764
|
+
/* @__PURE__ */ jsx11("dt", { className: "text-muted-foreground/60", children: "trace" }),
|
|
2765
|
+
/* @__PURE__ */ jsx11("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx11(TraceIdCopy, { traceId: record.traceId }) })
|
|
2596
2766
|
] })
|
|
2597
2767
|
] }),
|
|
2598
2768
|
record.missionRef && renderMissionRef?.(record.missionRef, record)
|
|
@@ -2600,10 +2770,10 @@ function ActivityRow({
|
|
|
2600
2770
|
] });
|
|
2601
2771
|
}
|
|
2602
2772
|
function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent activity", emptyLabel = "No agent runs yet." }) {
|
|
2603
|
-
const [rows, setRows] =
|
|
2604
|
-
const [cursor, setCursor] =
|
|
2605
|
-
const [status, setStatus] =
|
|
2606
|
-
const [error, setError] =
|
|
2773
|
+
const [rows, setRows] = useState13([]);
|
|
2774
|
+
const [cursor, setCursor] = useState13(void 0);
|
|
2775
|
+
const [status, setStatus] = useState13("loading");
|
|
2776
|
+
const [error, setError] = useState13(null);
|
|
2607
2777
|
const load = useCallback6(
|
|
2608
2778
|
async (from) => {
|
|
2609
2779
|
setStatus("loading");
|
|
@@ -2620,14 +2790,14 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2620
2790
|
},
|
|
2621
2791
|
[fetchActivity]
|
|
2622
2792
|
);
|
|
2623
|
-
|
|
2793
|
+
useEffect9(() => {
|
|
2624
2794
|
void load();
|
|
2625
2795
|
}, [load]);
|
|
2626
2796
|
const loading = status === "loading";
|
|
2627
|
-
return /* @__PURE__ */
|
|
2628
|
-
/* @__PURE__ */
|
|
2629
|
-
/* @__PURE__ */
|
|
2630
|
-
/* @__PURE__ */
|
|
2797
|
+
return /* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
2798
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
2799
|
+
/* @__PURE__ */ jsx11("h2", { className: "flex-1 text-sm font-semibold", children: title }),
|
|
2800
|
+
/* @__PURE__ */ jsx11(
|
|
2631
2801
|
"button",
|
|
2632
2802
|
{
|
|
2633
2803
|
type: "button",
|
|
@@ -2635,15 +2805,15 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2635
2805
|
disabled: loading,
|
|
2636
2806
|
"aria-label": "Refresh",
|
|
2637
2807
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
2638
|
-
children: /* @__PURE__ */
|
|
2808
|
+
children: /* @__PURE__ */ jsx11(RefreshGlyph, { className: `h-3.5 w-3.5 ${loading ? "animate-spin" : ""}` })
|
|
2639
2809
|
}
|
|
2640
2810
|
)
|
|
2641
2811
|
] }),
|
|
2642
|
-
status === "error" && /* @__PURE__ */
|
|
2643
|
-
status === "ready" && rows.length === 0 && /* @__PURE__ */
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
cursor && /* @__PURE__ */
|
|
2812
|
+
status === "error" && /* @__PURE__ */ jsx11("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
|
|
2813
|
+
status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx11("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
|
|
2814
|
+
/* @__PURE__ */ jsx11("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
|
|
2815
|
+
/* @__PURE__ */ jsx11("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record, index) => /* @__PURE__ */ jsx11(ActivityRow, { record, renderMissionRef, staggerIndex: index }, record.taskId)) }),
|
|
2816
|
+
cursor && /* @__PURE__ */ jsx11(
|
|
2647
2817
|
"button",
|
|
2648
2818
|
{
|
|
2649
2819
|
type: "button",
|
|
@@ -2657,7 +2827,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2657
2827
|
}
|
|
2658
2828
|
|
|
2659
2829
|
// src/web-react/provenance.tsx
|
|
2660
|
-
import { useCallback as useCallback7, useEffect as
|
|
2830
|
+
import { useCallback as useCallback7, useEffect as useEffect10, useId, useRef as useRef8, useState as useState14 } from "react";
|
|
2661
2831
|
|
|
2662
2832
|
// src/web-react/provenance-model.ts
|
|
2663
2833
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -2817,7 +2987,7 @@ function provenanceTriggerLabel(record, standing) {
|
|
|
2817
2987
|
}
|
|
2818
2988
|
|
|
2819
2989
|
// src/web-react/provenance.tsx
|
|
2820
|
-
import { jsx as
|
|
2990
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2821
2991
|
var BASIS_TONES = {
|
|
2822
2992
|
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
2823
2993
|
entered: "border-success/30 bg-success/10 text-success",
|
|
@@ -2842,27 +3012,27 @@ function BasisGlyph({ basis, className }) {
|
|
|
2842
3012
|
};
|
|
2843
3013
|
switch (basis) {
|
|
2844
3014
|
case "extracted":
|
|
2845
|
-
return /* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
2847
|
-
/* @__PURE__ */
|
|
2848
|
-
/* @__PURE__ */
|
|
3015
|
+
return /* @__PURE__ */ jsxs10("svg", { ...shared, children: [
|
|
3016
|
+
/* @__PURE__ */ jsx12("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
3017
|
+
/* @__PURE__ */ jsx12("polyline", { points: "14 3 14 8 19 8" }),
|
|
3018
|
+
/* @__PURE__ */ jsx12("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
2849
3019
|
] });
|
|
2850
3020
|
case "entered":
|
|
2851
|
-
return /* @__PURE__ */
|
|
2852
|
-
/* @__PURE__ */
|
|
2853
|
-
/* @__PURE__ */
|
|
3021
|
+
return /* @__PURE__ */ jsxs10("svg", { ...shared, children: [
|
|
3022
|
+
/* @__PURE__ */ jsx12("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
3023
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "7", r: "4" })
|
|
2854
3024
|
] });
|
|
2855
3025
|
case "computed":
|
|
2856
|
-
return /* @__PURE__ */
|
|
2857
|
-
/* @__PURE__ */
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2860
|
-
/* @__PURE__ */
|
|
3026
|
+
return /* @__PURE__ */ jsxs10("svg", { ...shared, children: [
|
|
3027
|
+
/* @__PURE__ */ jsx12("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
3028
|
+
/* @__PURE__ */ jsx12("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
3029
|
+
/* @__PURE__ */ jsx12("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
3030
|
+
/* @__PURE__ */ jsx12("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
2861
3031
|
] });
|
|
2862
3032
|
case "asserted":
|
|
2863
|
-
return /* @__PURE__ */
|
|
2864
|
-
/* @__PURE__ */
|
|
2865
|
-
/* @__PURE__ */
|
|
3033
|
+
return /* @__PURE__ */ jsxs10("svg", { ...shared, children: [
|
|
3034
|
+
/* @__PURE__ */ jsx12("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1" }),
|
|
3035
|
+
/* @__PURE__ */ jsx12("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
2866
3036
|
] });
|
|
2867
3037
|
}
|
|
2868
3038
|
}
|
|
@@ -2882,11 +3052,11 @@ function SourceRow({
|
|
|
2882
3052
|
const status = source.status ?? "ready";
|
|
2883
3053
|
const statusLine = describeProvenanceSourceStatus(source);
|
|
2884
3054
|
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
2885
|
-
return /* @__PURE__ */
|
|
2886
|
-
/* @__PURE__ */
|
|
2887
|
-
/* @__PURE__ */
|
|
2888
|
-
source.locator && /* @__PURE__ */
|
|
2889
|
-
openable && (onOpenSource ? /* @__PURE__ */
|
|
3055
|
+
return /* @__PURE__ */ jsxs10("li", { className: "rounded-md border border-card-edge bg-card px-2.5 py-2", children: [
|
|
3056
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
3057
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm font-medium text-foreground", children: source.label }),
|
|
3058
|
+
source.locator && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: source.locator }),
|
|
3059
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs10(
|
|
2890
3060
|
"button",
|
|
2891
3061
|
{
|
|
2892
3062
|
type: "button",
|
|
@@ -2897,7 +3067,7 @@ function SourceRow({
|
|
|
2897
3067
|
source.label
|
|
2898
3068
|
]
|
|
2899
3069
|
}
|
|
2900
|
-
) : /* @__PURE__ */
|
|
3070
|
+
) : /* @__PURE__ */ jsxs10(
|
|
2901
3071
|
"a",
|
|
2902
3072
|
{
|
|
2903
3073
|
href: source.href,
|
|
@@ -2911,7 +3081,7 @@ function SourceRow({
|
|
|
2911
3081
|
}
|
|
2912
3082
|
))
|
|
2913
3083
|
] }),
|
|
2914
|
-
source.quote && /* @__PURE__ */
|
|
3084
|
+
source.quote && /* @__PURE__ */ jsxs10("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
2915
3085
|
"\u201C",
|
|
2916
3086
|
source.quote,
|
|
2917
3087
|
"\u201D"
|
|
@@ -2920,14 +3090,14 @@ function SourceRow({
|
|
|
2920
3090
|
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
2921
3091
|
// — a spinner alone and a greyed row alone both render as "nothing
|
|
2922
3092
|
// here".
|
|
2923
|
-
/* @__PURE__ */
|
|
3093
|
+
/* @__PURE__ */ jsxs10(
|
|
2924
3094
|
"p",
|
|
2925
3095
|
{
|
|
2926
3096
|
role: "status",
|
|
2927
3097
|
className: `mt-1 text-xs ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
2928
3098
|
children: [
|
|
2929
3099
|
statusLine,
|
|
2930
|
-
status === "unavailable" && onRetrySource && /* @__PURE__ */
|
|
3100
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx12(
|
|
2931
3101
|
"button",
|
|
2932
3102
|
{
|
|
2933
3103
|
type: "button",
|
|
@@ -2951,9 +3121,9 @@ function ProvenanceValue({
|
|
|
2951
3121
|
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
2952
3122
|
className
|
|
2953
3123
|
}) {
|
|
2954
|
-
const [open, setOpen] =
|
|
2955
|
-
const triggerRef =
|
|
2956
|
-
const rootRef =
|
|
3124
|
+
const [open, setOpen] = useState14(defaultOpen);
|
|
3125
|
+
const triggerRef = useRef8(null);
|
|
3126
|
+
const rootRef = useRef8(null);
|
|
2957
3127
|
const panelId = useId();
|
|
2958
3128
|
const standing = rollUpProvenanceStanding(record, confidencePolicy);
|
|
2959
3129
|
const basisMeta = provenanceBasisMeta(record.basis);
|
|
@@ -2976,7 +3146,7 @@ function ProvenanceValue({
|
|
|
2976
3146
|
if (!open) closeTrailsOutside(rootRef.current);
|
|
2977
3147
|
setOpen(!open);
|
|
2978
3148
|
}, [open]);
|
|
2979
|
-
|
|
3149
|
+
useEffect10(() => {
|
|
2980
3150
|
const root = rootRef.current;
|
|
2981
3151
|
if (!open || root === null) return;
|
|
2982
3152
|
const entry = { root, close: () => setOpen(false) };
|
|
@@ -2994,12 +3164,12 @@ function ProvenanceValue({
|
|
|
2994
3164
|
document.removeEventListener("touchstart", onPointerDown, true);
|
|
2995
3165
|
};
|
|
2996
3166
|
}, [open]);
|
|
2997
|
-
const summary = /* @__PURE__ */
|
|
2998
|
-
record.label && /* @__PURE__ */
|
|
2999
|
-
/* @__PURE__ */
|
|
3167
|
+
const summary = /* @__PURE__ */ jsxs10("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
3168
|
+
record.label && /* @__PURE__ */ jsx12("span", { className: "text-xs text-muted-foreground", children: record.label }),
|
|
3169
|
+
/* @__PURE__ */ jsx12("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
|
|
3000
3170
|
] });
|
|
3001
3171
|
if (maxDepth <= 0) {
|
|
3002
|
-
return /* @__PURE__ */
|
|
3172
|
+
return /* @__PURE__ */ jsxs10(
|
|
3003
3173
|
"div",
|
|
3004
3174
|
{
|
|
3005
3175
|
className: `inline-block max-w-full [overflow-wrap:anywhere] ${className ?? ""}`,
|
|
@@ -3007,22 +3177,22 @@ function ProvenanceValue({
|
|
|
3007
3177
|
"data-provenance-standing": standing,
|
|
3008
3178
|
children: [
|
|
3009
3179
|
summary,
|
|
3010
|
-
/* @__PURE__ */
|
|
3180
|
+
/* @__PURE__ */ jsxs10(
|
|
3011
3181
|
"span",
|
|
3012
3182
|
{
|
|
3013
3183
|
className: `ml-1.5 inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[record.basis]}`,
|
|
3014
3184
|
children: [
|
|
3015
|
-
/* @__PURE__ */
|
|
3185
|
+
/* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3016
3186
|
basisMeta.label
|
|
3017
3187
|
]
|
|
3018
3188
|
}
|
|
3019
3189
|
),
|
|
3020
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsx12("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record) })
|
|
3021
3191
|
]
|
|
3022
3192
|
}
|
|
3023
3193
|
);
|
|
3024
3194
|
}
|
|
3025
|
-
return /* @__PURE__ */
|
|
3195
|
+
return /* @__PURE__ */ jsxs10(
|
|
3026
3196
|
"div",
|
|
3027
3197
|
{
|
|
3028
3198
|
ref: rootRef,
|
|
@@ -3031,9 +3201,9 @@ function ProvenanceValue({
|
|
|
3031
3201
|
"data-provenance-basis": record.basis,
|
|
3032
3202
|
"data-provenance-standing": standing,
|
|
3033
3203
|
children: [
|
|
3034
|
-
/* @__PURE__ */
|
|
3204
|
+
/* @__PURE__ */ jsxs10("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
3035
3205
|
summary,
|
|
3036
|
-
/* @__PURE__ */
|
|
3206
|
+
/* @__PURE__ */ jsxs10(
|
|
3037
3207
|
"button",
|
|
3038
3208
|
{
|
|
3039
3209
|
ref: triggerRef,
|
|
@@ -3044,17 +3214,17 @@ function ProvenanceValue({
|
|
|
3044
3214
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3045
3215
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium transition hover:brightness-105 focus:outline-none focus-visible:ring-2 focus-visible:ring-ring ${BASIS_TONES[record.basis]}`,
|
|
3046
3216
|
children: [
|
|
3047
|
-
/* @__PURE__ */
|
|
3048
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsx12(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3218
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": true, children: basisMeta.label })
|
|
3049
3219
|
]
|
|
3050
3220
|
}
|
|
3051
3221
|
),
|
|
3052
3222
|
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
3053
3223
|
// someone to open the panel. `aria-hidden` because the trigger's
|
|
3054
3224
|
// accessible name already carries it — this is the visual half.
|
|
3055
|
-
/* @__PURE__ */
|
|
3225
|
+
/* @__PURE__ */ jsx12("span", { "aria-hidden": true, className: `text-xs font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
3056
3226
|
] }),
|
|
3057
|
-
open && /* @__PURE__ */
|
|
3227
|
+
open && /* @__PURE__ */ jsxs10(
|
|
3058
3228
|
"div",
|
|
3059
3229
|
{
|
|
3060
3230
|
id: panelId,
|
|
@@ -3062,19 +3232,19 @@ function ProvenanceValue({
|
|
|
3062
3232
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3063
3233
|
className: "mt-1.5 w-full min-w-0 space-y-2 rounded-lg border border-border bg-card px-3 py-2.5 text-left",
|
|
3064
3234
|
children: [
|
|
3065
|
-
/* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3235
|
+
/* @__PURE__ */ jsxs10("div", { children: [
|
|
3236
|
+
/* @__PURE__ */ jsx12("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
|
|
3237
|
+
/* @__PURE__ */ jsxs10("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
3068
3238
|
standingMeta.label,
|
|
3069
3239
|
" \u2014 ",
|
|
3070
3240
|
provenanceNextMove(record, standing, confidencePolicy)
|
|
3071
3241
|
] }),
|
|
3072
|
-
basisMeta.checkableAgainst === null && /* @__PURE__ */
|
|
3242
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs10("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
|
|
3073
3243
|
basisMeta.meaning,
|
|
3074
3244
|
" There is nothing outside the model to check it against."
|
|
3075
3245
|
] })
|
|
3076
3246
|
] }),
|
|
3077
|
-
sources.length > 0 && /* @__PURE__ */
|
|
3247
|
+
sources.length > 0 && /* @__PURE__ */ jsx12("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx12(
|
|
3078
3248
|
SourceRow,
|
|
3079
3249
|
{
|
|
3080
3250
|
source,
|
|
@@ -3087,12 +3257,12 @@ function ProvenanceValue({
|
|
|
3087
3257
|
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
3088
3258
|
// An unavailable source already states itself on its own row; a
|
|
3089
3259
|
// structural gap has no row to state it, so it gets one here.
|
|
3090
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsx12("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-xs leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
3091
3261
|
)),
|
|
3092
|
-
loading.length > 0 && sources.length === 0 && /* @__PURE__ */
|
|
3093
|
-
inputs.length > 0 && /* @__PURE__ */
|
|
3094
|
-
/* @__PURE__ */
|
|
3095
|
-
/* @__PURE__ */
|
|
3262
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx12("p", { role: "status", className: "text-xs text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
3263
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs10("div", { className: "border-t border-border pt-2", children: [
|
|
3264
|
+
/* @__PURE__ */ jsx12("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
|
|
3265
|
+
/* @__PURE__ */ jsx12("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx12("li", { children: /* @__PURE__ */ jsx12(
|
|
3096
3266
|
ProvenanceValue,
|
|
3097
3267
|
{
|
|
3098
3268
|
record: input,
|
|
@@ -3113,26 +3283,26 @@ function ProvenanceValue({
|
|
|
3113
3283
|
}
|
|
3114
3284
|
function ProvenanceLegend({ bases, className }) {
|
|
3115
3285
|
if (bases.length === 0) return null;
|
|
3116
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsx12("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
3117
3287
|
const meta = provenanceBasisMeta(basis);
|
|
3118
|
-
return /* @__PURE__ */
|
|
3119
|
-
/* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ jsxs10("li", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
3289
|
+
/* @__PURE__ */ jsxs10(
|
|
3120
3290
|
"span",
|
|
3121
3291
|
{
|
|
3122
3292
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[basis]}`,
|
|
3123
3293
|
children: [
|
|
3124
|
-
/* @__PURE__ */
|
|
3294
|
+
/* @__PURE__ */ jsx12(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
3125
3295
|
meta.label
|
|
3126
3296
|
]
|
|
3127
3297
|
}
|
|
3128
3298
|
),
|
|
3129
|
-
/* @__PURE__ */
|
|
3299
|
+
/* @__PURE__ */ jsx12("span", { children: meta.meaning })
|
|
3130
3300
|
] }, basis);
|
|
3131
3301
|
}) });
|
|
3132
3302
|
}
|
|
3133
3303
|
|
|
3134
3304
|
// src/web-react/seat-paywall.tsx
|
|
3135
|
-
import { Fragment as Fragment3, jsx as
|
|
3305
|
+
import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3136
3306
|
function usd(cents) {
|
|
3137
3307
|
return new Intl.NumberFormat("en-US", {
|
|
3138
3308
|
style: "currency",
|
|
@@ -3142,7 +3312,7 @@ function usd(cents) {
|
|
|
3142
3312
|
}).format(cents / 100);
|
|
3143
3313
|
}
|
|
3144
3314
|
function CheckGlyph3() {
|
|
3145
|
-
return /* @__PURE__ */
|
|
3315
|
+
return /* @__PURE__ */ jsx13(
|
|
3146
3316
|
"svg",
|
|
3147
3317
|
{
|
|
3148
3318
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -3153,14 +3323,14 @@ function CheckGlyph3() {
|
|
|
3153
3323
|
strokeLinecap: "round",
|
|
3154
3324
|
strokeLinejoin: "round",
|
|
3155
3325
|
"aria-hidden": true,
|
|
3156
|
-
children: /* @__PURE__ */
|
|
3326
|
+
children: /* @__PURE__ */ jsx13("path", { d: "M20 6 9 17l-5-5" })
|
|
3157
3327
|
}
|
|
3158
3328
|
);
|
|
3159
3329
|
}
|
|
3160
3330
|
function Benefit({ children }) {
|
|
3161
|
-
return /* @__PURE__ */
|
|
3162
|
-
/* @__PURE__ */
|
|
3163
|
-
/* @__PURE__ */
|
|
3331
|
+
return /* @__PURE__ */ jsxs11("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
3332
|
+
/* @__PURE__ */ jsx13("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx13(CheckGlyph3, {}) }),
|
|
3333
|
+
/* @__PURE__ */ jsx13("span", { children })
|
|
3164
3334
|
] });
|
|
3165
3335
|
}
|
|
3166
3336
|
function SeatPaywall({
|
|
@@ -3178,45 +3348,45 @@ function SeatPaywall({
|
|
|
3178
3348
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
3179
3349
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
3180
3350
|
const introductory = offer?.introductory ?? null;
|
|
3181
|
-
return /* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ jsx13("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs11("div", { className: "w-full max-w-md rounded-2xl border border-card-edge bg-card p-8", children: [
|
|
3352
|
+
/* @__PURE__ */ jsx13("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: product }),
|
|
3353
|
+
/* @__PURE__ */ jsxs11("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
3184
3354
|
"Unlock ",
|
|
3185
3355
|
product
|
|
3186
3356
|
] }),
|
|
3187
|
-
tagline && /* @__PURE__ */
|
|
3188
|
-
introductory ? /* @__PURE__ */
|
|
3189
|
-
/* @__PURE__ */
|
|
3190
|
-
/* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
3357
|
+
tagline && /* @__PURE__ */ jsx13("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
3358
|
+
introductory ? /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3359
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3360
|
+
/* @__PURE__ */ jsx13("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
3361
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
3192
3362
|
] }),
|
|
3193
|
-
/* @__PURE__ */
|
|
3363
|
+
/* @__PURE__ */ jsxs11("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3194
3364
|
"Includes ",
|
|
3195
3365
|
usd(introductory.includedCreditsCents),
|
|
3196
3366
|
" of AI usage in your first month"
|
|
3197
3367
|
] }),
|
|
3198
|
-
/* @__PURE__ */
|
|
3368
|
+
/* @__PURE__ */ jsxs11("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3199
3369
|
"Then ",
|
|
3200
3370
|
recurringPrice,
|
|
3201
3371
|
"/mo \xB7 includes ",
|
|
3202
3372
|
recurringUsage,
|
|
3203
3373
|
"/mo of AI usage"
|
|
3204
3374
|
] })
|
|
3205
|
-
] }) : /* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3207
|
-
/* @__PURE__ */
|
|
3208
|
-
/* @__PURE__ */
|
|
3375
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3376
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3377
|
+
/* @__PURE__ */ jsx13("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
3378
|
+
/* @__PURE__ */ jsx13("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
3209
3379
|
] }),
|
|
3210
|
-
/* @__PURE__ */
|
|
3380
|
+
/* @__PURE__ */ jsxs11("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3211
3381
|
"Includes ",
|
|
3212
3382
|
recurringUsage,
|
|
3213
3383
|
"/mo of AI usage"
|
|
3214
3384
|
] })
|
|
3215
3385
|
] }),
|
|
3216
|
-
/* @__PURE__ */
|
|
3386
|
+
/* @__PURE__ */ jsx13("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
3217
3387
|
`Full access to ${product}`
|
|
3218
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
3388
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx13(Benefit, { children: benefit }, i)) }),
|
|
3389
|
+
/* @__PURE__ */ jsx13(
|
|
3220
3390
|
"button",
|
|
3221
3391
|
{
|
|
3222
3392
|
type: "button",
|
|
@@ -3226,7 +3396,7 @@ function SeatPaywall({
|
|
|
3226
3396
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? "Continue to checkout"
|
|
3227
3397
|
}
|
|
3228
3398
|
),
|
|
3229
|
-
footnote && /* @__PURE__ */
|
|
3399
|
+
footnote && /* @__PURE__ */ jsx13("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
3230
3400
|
] }) });
|
|
3231
3401
|
}
|
|
3232
3402
|
|
|
@@ -3235,11 +3405,11 @@ import {
|
|
|
3235
3405
|
Fragment as Fragment4,
|
|
3236
3406
|
isValidElement,
|
|
3237
3407
|
useCallback as useCallback8,
|
|
3238
|
-
useEffect as
|
|
3408
|
+
useEffect as useEffect11,
|
|
3239
3409
|
useId as useId2,
|
|
3240
|
-
useMemo as
|
|
3241
|
-
useRef as
|
|
3242
|
-
useState as
|
|
3410
|
+
useMemo as useMemo6,
|
|
3411
|
+
useRef as useRef9,
|
|
3412
|
+
useState as useState15
|
|
3243
3413
|
} from "react";
|
|
3244
3414
|
|
|
3245
3415
|
// src/web-react/record-grid-model.ts
|
|
@@ -3595,7 +3765,7 @@ function pruneRecordGridOverlay(rows, overlay) {
|
|
|
3595
3765
|
}
|
|
3596
3766
|
|
|
3597
3767
|
// src/web-react/record-grid.tsx
|
|
3598
|
-
import { jsx as
|
|
3768
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3599
3769
|
var EMPTY_RECORD_GRID_ROWS = [];
|
|
3600
3770
|
var CELL_KEY_SEPARATOR = "\0";
|
|
3601
3771
|
function cellKey(rowId, columnId) {
|
|
@@ -3655,50 +3825,50 @@ function RecordGrid({
|
|
|
3655
3825
|
className
|
|
3656
3826
|
}) {
|
|
3657
3827
|
const fieldPrefix = useId2();
|
|
3658
|
-
const [overlay, setOverlay] =
|
|
3659
|
-
const [editing, setEditingState] =
|
|
3660
|
-
const [cellErrors, setCellErrors] =
|
|
3661
|
-
const [rowErrors, setRowErrors] =
|
|
3662
|
-
const [pendingRows, setPendingRows] =
|
|
3663
|
-
const [focus, setFocus] =
|
|
3664
|
-
const [openSource, setOpenSource] =
|
|
3665
|
-
const [confirmDelete, setConfirmDelete] =
|
|
3666
|
-
const [adding, setAdding] =
|
|
3667
|
-
const [draft, setDraft] =
|
|
3668
|
-
const [draftErrors, setDraftErrors] =
|
|
3669
|
-
const [draftError, setDraftError] =
|
|
3670
|
-
const [creating, setCreating] =
|
|
3671
|
-
const cellRefs =
|
|
3672
|
-
const settling =
|
|
3673
|
-
const draftCounter =
|
|
3674
|
-
const editingRef =
|
|
3828
|
+
const [overlay, setOverlay] = useState15(EMPTY_RECORD_GRID_OVERLAY);
|
|
3829
|
+
const [editing, setEditingState] = useState15(null);
|
|
3830
|
+
const [cellErrors, setCellErrors] = useState15({});
|
|
3831
|
+
const [rowErrors, setRowErrors] = useState15({});
|
|
3832
|
+
const [pendingRows, setPendingRows] = useState15({});
|
|
3833
|
+
const [focus, setFocus] = useState15(null);
|
|
3834
|
+
const [openSource, setOpenSource] = useState15(null);
|
|
3835
|
+
const [confirmDelete, setConfirmDelete] = useState15(null);
|
|
3836
|
+
const [adding, setAdding] = useState15(false);
|
|
3837
|
+
const [draft, setDraft] = useState15({ ...newRowDefaults ?? {} });
|
|
3838
|
+
const [draftErrors, setDraftErrors] = useState15({});
|
|
3839
|
+
const [draftError, setDraftError] = useState15(null);
|
|
3840
|
+
const [creating, setCreating] = useState15(false);
|
|
3841
|
+
const cellRefs = useRef9(/* @__PURE__ */ new Map());
|
|
3842
|
+
const settling = useRef9(false);
|
|
3843
|
+
const draftCounter = useRef9(0);
|
|
3844
|
+
const editingRef = useRef9(null);
|
|
3675
3845
|
const setEditing = useCallback8((next) => {
|
|
3676
3846
|
editingRef.current = next;
|
|
3677
3847
|
setEditingState(next);
|
|
3678
3848
|
}, []);
|
|
3679
3849
|
const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
|
|
3680
|
-
|
|
3850
|
+
useEffect11(() => {
|
|
3681
3851
|
setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
|
|
3682
3852
|
}, [callerRows]);
|
|
3683
|
-
const visibleRows =
|
|
3684
|
-
const diffs =
|
|
3853
|
+
const visibleRows = useMemo6(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
|
|
3854
|
+
const diffs = useMemo6(
|
|
3685
3855
|
() => proposed === void 0 ? null : diffRecordGridProposal(visibleRows, proposed),
|
|
3686
3856
|
[proposed, visibleRows]
|
|
3687
3857
|
);
|
|
3688
3858
|
const reviewing = diffs !== null && diffs.length > 0;
|
|
3689
|
-
const diffByRow =
|
|
3690
|
-
const diffCellByKey =
|
|
3859
|
+
const diffByRow = useMemo6(() => new Map((diffs ?? []).map((diff) => [diff.rowId, diff])), [diffs]);
|
|
3860
|
+
const diffCellByKey = useMemo6(() => {
|
|
3691
3861
|
const map = /* @__PURE__ */ new Map();
|
|
3692
3862
|
for (const diff of diffs ?? []) {
|
|
3693
3863
|
for (const cell of diff.cells) map.set(cellKey(diff.rowId, cell.columnId), cell);
|
|
3694
3864
|
}
|
|
3695
3865
|
return map;
|
|
3696
3866
|
}, [diffs]);
|
|
3697
|
-
const addedRows =
|
|
3867
|
+
const addedRows = useMemo6(
|
|
3698
3868
|
() => (diffs ?? []).filter((diff) => diff.kind === "added").map((diff) => diff.row),
|
|
3699
3869
|
[diffs]
|
|
3700
3870
|
);
|
|
3701
|
-
const activeFocus =
|
|
3871
|
+
const activeFocus = useMemo6(() => {
|
|
3702
3872
|
if (focus === null) return null;
|
|
3703
3873
|
if (!visibleRows.some((row) => row.id === focus.rowId)) return null;
|
|
3704
3874
|
if (!columns.some((column) => column.id === focus.columnId)) return null;
|
|
@@ -3907,9 +4077,9 @@ function RecordGrid({
|
|
|
3907
4077
|
[beginEdit, columns, editing, focusCell, onUpdate, reviewing, visibleRows]
|
|
3908
4078
|
);
|
|
3909
4079
|
if (state.status === "idle" || state.status === "loading") {
|
|
3910
|
-
return /* @__PURE__ */
|
|
4080
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3911
4081
|
toolbar,
|
|
3912
|
-
/* @__PURE__ */
|
|
4082
|
+
/* @__PURE__ */ jsxs12(
|
|
3913
4083
|
"div",
|
|
3914
4084
|
{
|
|
3915
4085
|
role: "status",
|
|
@@ -3917,22 +4087,22 @@ function RecordGrid({
|
|
|
3917
4087
|
"aria-live": "polite",
|
|
3918
4088
|
className: "space-y-2 rounded-xl border border-card-edge bg-card p-4",
|
|
3919
4089
|
children: [
|
|
3920
|
-
/* @__PURE__ */
|
|
4090
|
+
/* @__PURE__ */ jsxs12("span", { className: "sr-only", children: [
|
|
3921
4091
|
"Loading ",
|
|
3922
4092
|
caption
|
|
3923
4093
|
] }),
|
|
3924
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
4094
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx14("div", { className: "h-8 animate-pulse rounded-md bg-secondary", "aria-hidden": true }, index))
|
|
3925
4095
|
]
|
|
3926
4096
|
}
|
|
3927
4097
|
)
|
|
3928
4098
|
] });
|
|
3929
4099
|
}
|
|
3930
4100
|
if (state.status === "error") {
|
|
3931
|
-
return /* @__PURE__ */
|
|
4101
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3932
4102
|
toolbar,
|
|
3933
|
-
/* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
4103
|
+
/* @__PURE__ */ jsxs12("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
4104
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-destructive", children: state.message }),
|
|
4105
|
+
/* @__PURE__ */ jsx14(
|
|
3936
4106
|
"button",
|
|
3937
4107
|
{
|
|
3938
4108
|
type: "button",
|
|
@@ -3944,7 +4114,7 @@ function RecordGrid({
|
|
|
3944
4114
|
] })
|
|
3945
4115
|
] });
|
|
3946
4116
|
}
|
|
3947
|
-
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */
|
|
4117
|
+
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */ jsx14(
|
|
3948
4118
|
AddRecordForm,
|
|
3949
4119
|
{
|
|
3950
4120
|
columns,
|
|
@@ -3963,13 +4133,13 @@ function RecordGrid({
|
|
|
3963
4133
|
}
|
|
3964
4134
|
) : null;
|
|
3965
4135
|
if (visibleRows.length === 0 && !reviewing) {
|
|
3966
|
-
return /* @__PURE__ */
|
|
4136
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3967
4137
|
toolbar,
|
|
3968
|
-
addForm ?? /* @__PURE__ */
|
|
3969
|
-
/* @__PURE__ */
|
|
3970
|
-
empty.description && /* @__PURE__ */
|
|
3971
|
-
/* @__PURE__ */
|
|
3972
|
-
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */
|
|
4138
|
+
addForm ?? /* @__PURE__ */ jsxs12("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
|
|
4139
|
+
/* @__PURE__ */ jsx14("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
|
|
4140
|
+
empty.description && /* @__PURE__ */ jsx14("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
|
|
4141
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
|
|
4142
|
+
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */ jsx14(
|
|
3973
4143
|
"button",
|
|
3974
4144
|
{
|
|
3975
4145
|
type: "button",
|
|
@@ -3978,7 +4148,7 @@ function RecordGrid({
|
|
|
3978
4148
|
children: empty.action.label
|
|
3979
4149
|
}
|
|
3980
4150
|
)),
|
|
3981
|
-
onCreate && /* @__PURE__ */
|
|
4151
|
+
onCreate && /* @__PURE__ */ jsx14(
|
|
3982
4152
|
"button",
|
|
3983
4153
|
{
|
|
3984
4154
|
type: "button",
|
|
@@ -4003,18 +4173,18 @@ function RecordGrid({
|
|
|
4003
4173
|
addedCount > 0 ? `${addedCount} added` : null,
|
|
4004
4174
|
removedCount > 0 ? `${removedCount} removed` : null
|
|
4005
4175
|
].filter((part) => part !== null).join(" \xB7 ");
|
|
4006
|
-
const reviewBar = reviewing ? /* @__PURE__ */
|
|
4176
|
+
const reviewBar = reviewing ? /* @__PURE__ */ jsxs12(
|
|
4007
4177
|
"div",
|
|
4008
4178
|
{
|
|
4009
4179
|
"data-record-grid-review": "",
|
|
4010
4180
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-xl border border-card-edge bg-card px-4 py-2.5",
|
|
4011
4181
|
children: [
|
|
4012
|
-
/* @__PURE__ */
|
|
4013
|
-
/* @__PURE__ */
|
|
4014
|
-
/* @__PURE__ */
|
|
4182
|
+
/* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
|
|
4183
|
+
/* @__PURE__ */ jsx14("p", { className: "text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: "Proposed changes" }),
|
|
4184
|
+
/* @__PURE__ */ jsx14("p", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: reviewSummary })
|
|
4015
4185
|
] }),
|
|
4016
|
-
(onAcceptAll || onRejectAll) && /* @__PURE__ */
|
|
4017
|
-
onRejectAll && /* @__PURE__ */
|
|
4186
|
+
(onAcceptAll || onRejectAll) && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
4187
|
+
onRejectAll && /* @__PURE__ */ jsx14(
|
|
4018
4188
|
"button",
|
|
4019
4189
|
{
|
|
4020
4190
|
type: "button",
|
|
@@ -4024,7 +4194,7 @@ function RecordGrid({
|
|
|
4024
4194
|
children: "Reject all"
|
|
4025
4195
|
}
|
|
4026
4196
|
),
|
|
4027
|
-
onAcceptAll && /* @__PURE__ */
|
|
4197
|
+
onAcceptAll && /* @__PURE__ */ jsx14(
|
|
4028
4198
|
"button",
|
|
4029
4199
|
{
|
|
4030
4200
|
type: "button",
|
|
@@ -4038,10 +4208,10 @@ function RecordGrid({
|
|
|
4038
4208
|
]
|
|
4039
4209
|
}
|
|
4040
4210
|
) : null;
|
|
4041
|
-
return /* @__PURE__ */
|
|
4211
|
+
return /* @__PURE__ */ jsxs12("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4042
4212
|
toolbar,
|
|
4043
4213
|
reviewBar,
|
|
4044
|
-
/* @__PURE__ */
|
|
4214
|
+
/* @__PURE__ */ jsx14("div", { className: "overflow-x-auto rounded-xl border border-card-edge bg-card", children: /* @__PURE__ */ jsxs12(
|
|
4045
4215
|
"table",
|
|
4046
4216
|
{
|
|
4047
4217
|
role: "grid",
|
|
@@ -4049,8 +4219,8 @@ function RecordGrid({
|
|
|
4049
4219
|
className: "w-full border-collapse text-left text-sm",
|
|
4050
4220
|
onKeyDown: handleGridKeyDown,
|
|
4051
4221
|
children: [
|
|
4052
|
-
/* @__PURE__ */
|
|
4053
|
-
columns.map((column) => /* @__PURE__ */
|
|
4222
|
+
/* @__PURE__ */ jsx14("thead", { children: /* @__PURE__ */ jsxs12("tr", { role: "row", className: "border-b border-border text-xs uppercase tracking-[0.05em] text-muted-foreground", children: [
|
|
4223
|
+
columns.map((column) => /* @__PURE__ */ jsx14(
|
|
4054
4224
|
"th",
|
|
4055
4225
|
{
|
|
4056
4226
|
role: "columnheader",
|
|
@@ -4060,17 +4230,17 @@ function RecordGrid({
|
|
|
4060
4230
|
},
|
|
4061
4231
|
column.id
|
|
4062
4232
|
)),
|
|
4063
|
-
showActionsColumn && /* @__PURE__ */
|
|
4233
|
+
showActionsColumn && /* @__PURE__ */ jsx14("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx14("span", { className: "sr-only", children: reviewing ? "Review" : "Row actions" }) })
|
|
4064
4234
|
] }) }),
|
|
4065
|
-
/* @__PURE__ */
|
|
4235
|
+
/* @__PURE__ */ jsxs12("tbody", { children: [
|
|
4066
4236
|
visibleRows.map((row) => {
|
|
4067
4237
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
4068
4238
|
const pending = row.id in pendingRows;
|
|
4069
4239
|
const rowError = rowErrors[row.id];
|
|
4070
4240
|
const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
|
|
4071
4241
|
const removedRow = rowDiff?.kind === "removed";
|
|
4072
|
-
return /* @__PURE__ */
|
|
4073
|
-
/* @__PURE__ */
|
|
4242
|
+
return /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
4243
|
+
/* @__PURE__ */ jsxs12(
|
|
4074
4244
|
"tr",
|
|
4075
4245
|
{
|
|
4076
4246
|
role: "row",
|
|
@@ -4090,8 +4260,8 @@ function RecordGrid({
|
|
|
4090
4260
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
4091
4261
|
const cellDiff = rowDiff?.kind === "changed" ? diffCellByKey.get(key) : void 0;
|
|
4092
4262
|
if (isEditing && editable) {
|
|
4093
|
-
return /* @__PURE__ */
|
|
4094
|
-
/* @__PURE__ */
|
|
4263
|
+
return /* @__PURE__ */ jsxs12("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
4264
|
+
/* @__PURE__ */ jsx14(
|
|
4095
4265
|
CellEditor,
|
|
4096
4266
|
{
|
|
4097
4267
|
column,
|
|
@@ -4104,11 +4274,11 @@ function RecordGrid({
|
|
|
4104
4274
|
onCancel: () => cancelEdit(row, column)
|
|
4105
4275
|
}
|
|
4106
4276
|
),
|
|
4107
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
4277
|
+
cellError !== void 0 && /* @__PURE__ */ jsx14("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
4108
4278
|
] }, column.id);
|
|
4109
4279
|
}
|
|
4110
4280
|
if (column.kind === "boolean" && editable) {
|
|
4111
|
-
return /* @__PURE__ */
|
|
4281
|
+
return /* @__PURE__ */ jsx14("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx14(
|
|
4112
4282
|
"input",
|
|
4113
4283
|
{
|
|
4114
4284
|
type: "checkbox",
|
|
@@ -4127,7 +4297,7 @@ function RecordGrid({
|
|
|
4127
4297
|
) }, column.id);
|
|
4128
4298
|
}
|
|
4129
4299
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
4130
|
-
return /* @__PURE__ */
|
|
4300
|
+
return /* @__PURE__ */ jsx14(
|
|
4131
4301
|
"td",
|
|
4132
4302
|
{
|
|
4133
4303
|
role: "gridcell",
|
|
@@ -4145,20 +4315,20 @@ function RecordGrid({
|
|
|
4145
4315
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
4146
4316
|
column
|
|
4147
4317
|
)} ${editable ? "cursor-text" : ""}`,
|
|
4148
|
-
children: /* @__PURE__ */
|
|
4149
|
-
column.id === columns[0]?.id && removedRow && /* @__PURE__ */
|
|
4150
|
-
cellDiff ? /* @__PURE__ */
|
|
4151
|
-
/* @__PURE__ */
|
|
4152
|
-
/* @__PURE__ */
|
|
4153
|
-
/* @__PURE__ */
|
|
4154
|
-
] }) : /* @__PURE__ */
|
|
4318
|
+
children: /* @__PURE__ */ jsxs12("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4319
|
+
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx14("span", { className: "inline-flex shrink-0 rounded border border-destructive/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-destructive", children: "Remove" }),
|
|
4320
|
+
cellDiff ? /* @__PURE__ */ jsxs12("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
4321
|
+
/* @__PURE__ */ jsx14("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
4322
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
4323
|
+
/* @__PURE__ */ jsx14("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
4324
|
+
] }) : /* @__PURE__ */ jsx14(
|
|
4155
4325
|
"span",
|
|
4156
4326
|
{
|
|
4157
4327
|
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
4158
4328
|
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
4159
4329
|
}
|
|
4160
4330
|
),
|
|
4161
|
-
source && /* @__PURE__ */
|
|
4331
|
+
source && /* @__PURE__ */ jsx14(
|
|
4162
4332
|
SourceMarker,
|
|
4163
4333
|
{
|
|
4164
4334
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -4174,7 +4344,7 @@ function RecordGrid({
|
|
|
4174
4344
|
column.id
|
|
4175
4345
|
);
|
|
4176
4346
|
}),
|
|
4177
|
-
showActionsColumn && /* @__PURE__ */
|
|
4347
|
+
showActionsColumn && /* @__PURE__ */ jsx14("td", { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx14(
|
|
4178
4348
|
ReviewActions,
|
|
4179
4349
|
{
|
|
4180
4350
|
rowId: row.id,
|
|
@@ -4183,8 +4353,8 @@ function RecordGrid({
|
|
|
4183
4353
|
onAccept: onAcceptRow,
|
|
4184
4354
|
onReject: onRejectRow
|
|
4185
4355
|
}
|
|
4186
|
-
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */
|
|
4187
|
-
/* @__PURE__ */
|
|
4356
|
+
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4357
|
+
/* @__PURE__ */ jsx14(
|
|
4188
4358
|
"button",
|
|
4189
4359
|
{
|
|
4190
4360
|
type: "button",
|
|
@@ -4194,7 +4364,7 @@ function RecordGrid({
|
|
|
4194
4364
|
children: "Delete"
|
|
4195
4365
|
}
|
|
4196
4366
|
),
|
|
4197
|
-
/* @__PURE__ */
|
|
4367
|
+
/* @__PURE__ */ jsx14(
|
|
4198
4368
|
"button",
|
|
4199
4369
|
{
|
|
4200
4370
|
type: "button",
|
|
@@ -4204,14 +4374,14 @@ function RecordGrid({
|
|
|
4204
4374
|
children: "Cancel"
|
|
4205
4375
|
}
|
|
4206
4376
|
)
|
|
4207
|
-
] }) : /* @__PURE__ */
|
|
4377
|
+
] }) : /* @__PURE__ */ jsx14(
|
|
4208
4378
|
"button",
|
|
4209
4379
|
{
|
|
4210
4380
|
type: "button",
|
|
4211
4381
|
"aria-label": `Delete ${rowLabel}`,
|
|
4212
4382
|
onClick: () => setConfirmDelete(row.id),
|
|
4213
4383
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
4214
|
-
children: /* @__PURE__ */
|
|
4384
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4215
4385
|
"svg",
|
|
4216
4386
|
{
|
|
4217
4387
|
viewBox: "0 0 24 24",
|
|
@@ -4223,8 +4393,8 @@ function RecordGrid({
|
|
|
4223
4393
|
strokeLinejoin: "round",
|
|
4224
4394
|
"aria-hidden": true,
|
|
4225
4395
|
children: [
|
|
4226
|
-
/* @__PURE__ */
|
|
4227
|
-
/* @__PURE__ */
|
|
4396
|
+
/* @__PURE__ */ jsx14("polyline", { points: "3 6 5 6 21 6" }),
|
|
4397
|
+
/* @__PURE__ */ jsx14("path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" })
|
|
4228
4398
|
]
|
|
4229
4399
|
}
|
|
4230
4400
|
)
|
|
@@ -4233,12 +4403,12 @@ function RecordGrid({
|
|
|
4233
4403
|
]
|
|
4234
4404
|
}
|
|
4235
4405
|
),
|
|
4236
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
4406
|
+
rowError !== void 0 && /* @__PURE__ */ jsx14("tr", { role: "row", className: "border-b border-border", children: /* @__PURE__ */ jsx14("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx14("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
4237
4407
|
] }, row.id);
|
|
4238
4408
|
}),
|
|
4239
4409
|
reviewing && addedRows.map((row) => {
|
|
4240
4410
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
4241
|
-
return /* @__PURE__ */
|
|
4411
|
+
return /* @__PURE__ */ jsxs12(
|
|
4242
4412
|
"tr",
|
|
4243
4413
|
{
|
|
4244
4414
|
role: "row",
|
|
@@ -4249,9 +4419,9 @@ function RecordGrid({
|
|
|
4249
4419
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
4250
4420
|
const value = row.values[column.id] ?? null;
|
|
4251
4421
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
4252
|
-
return /* @__PURE__ */
|
|
4253
|
-
columnIndex === 0 && /* @__PURE__ */
|
|
4254
|
-
/* @__PURE__ */
|
|
4422
|
+
return /* @__PURE__ */ jsx14("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs12("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4423
|
+
columnIndex === 0 && /* @__PURE__ */ jsx14("span", { className: "inline-flex shrink-0 rounded border border-success/60 px-1 py-px text-[11px] font-semibold uppercase tracking-[0.05em] text-success", children: "New" }),
|
|
4424
|
+
/* @__PURE__ */ jsx14(
|
|
4255
4425
|
"span",
|
|
4256
4426
|
{
|
|
4257
4427
|
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
@@ -4260,7 +4430,7 @@ function RecordGrid({
|
|
|
4260
4430
|
)
|
|
4261
4431
|
] }) }, column.id);
|
|
4262
4432
|
}),
|
|
4263
|
-
/* @__PURE__ */
|
|
4433
|
+
/* @__PURE__ */ jsx14("td", { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx14(
|
|
4264
4434
|
ReviewActions,
|
|
4265
4435
|
{
|
|
4266
4436
|
rowId: row.id,
|
|
@@ -4276,8 +4446,8 @@ function RecordGrid({
|
|
|
4276
4446
|
);
|
|
4277
4447
|
})
|
|
4278
4448
|
] }),
|
|
4279
|
-
hasFooter && /* @__PURE__ */
|
|
4280
|
-
columns.map((column) => /* @__PURE__ */
|
|
4449
|
+
hasFooter && /* @__PURE__ */ jsx14("tfoot", { children: /* @__PURE__ */ jsxs12("tr", { role: "row", className: "border-t-2 border-border", children: [
|
|
4450
|
+
columns.map((column) => /* @__PURE__ */ jsx14(
|
|
4281
4451
|
"td",
|
|
4282
4452
|
{
|
|
4283
4453
|
role: "gridcell",
|
|
@@ -4286,19 +4456,19 @@ function RecordGrid({
|
|
|
4286
4456
|
},
|
|
4287
4457
|
column.id
|
|
4288
4458
|
)),
|
|
4289
|
-
showActionsColumn && /* @__PURE__ */
|
|
4459
|
+
showActionsColumn && /* @__PURE__ */ jsx14("td", { role: "gridcell" })
|
|
4290
4460
|
] }) })
|
|
4291
4461
|
]
|
|
4292
4462
|
}
|
|
4293
4463
|
) }),
|
|
4294
|
-
onCreate && !reviewing && (addForm ?? /* @__PURE__ */
|
|
4464
|
+
onCreate && !reviewing && (addForm ?? /* @__PURE__ */ jsxs12(
|
|
4295
4465
|
"button",
|
|
4296
4466
|
{
|
|
4297
4467
|
type: "button",
|
|
4298
4468
|
onClick: openAdd,
|
|
4299
4469
|
className: "inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition hover:bg-accent",
|
|
4300
4470
|
children: [
|
|
4301
|
-
/* @__PURE__ */
|
|
4471
|
+
/* @__PURE__ */ jsxs12(
|
|
4302
4472
|
"svg",
|
|
4303
4473
|
{
|
|
4304
4474
|
viewBox: "0 0 24 24",
|
|
@@ -4310,8 +4480,8 @@ function RecordGrid({
|
|
|
4310
4480
|
strokeLinejoin: "round",
|
|
4311
4481
|
"aria-hidden": true,
|
|
4312
4482
|
children: [
|
|
4313
|
-
/* @__PURE__ */
|
|
4314
|
-
/* @__PURE__ */
|
|
4483
|
+
/* @__PURE__ */ jsx14("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
4484
|
+
/* @__PURE__ */ jsx14("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
4315
4485
|
]
|
|
4316
4486
|
}
|
|
4317
4487
|
),
|
|
@@ -4323,8 +4493,8 @@ function RecordGrid({
|
|
|
4323
4493
|
}
|
|
4324
4494
|
function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
4325
4495
|
const noun = kind === "changed" ? `proposed change to ${rowLabel}` : kind === "added" ? `new row ${rowLabel}` : `removal of ${rowLabel}`;
|
|
4326
|
-
return /* @__PURE__ */
|
|
4327
|
-
onReject && /* @__PURE__ */
|
|
4496
|
+
return /* @__PURE__ */ jsxs12("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4497
|
+
onReject && /* @__PURE__ */ jsx14(
|
|
4328
4498
|
"button",
|
|
4329
4499
|
{
|
|
4330
4500
|
type: "button",
|
|
@@ -4334,7 +4504,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
4334
4504
|
children: "Reject"
|
|
4335
4505
|
}
|
|
4336
4506
|
),
|
|
4337
|
-
onAccept && /* @__PURE__ */
|
|
4507
|
+
onAccept && /* @__PURE__ */ jsx14(
|
|
4338
4508
|
"button",
|
|
4339
4509
|
{
|
|
4340
4510
|
type: "button",
|
|
@@ -4355,7 +4525,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4355
4525
|
className: INPUT_CLASS
|
|
4356
4526
|
};
|
|
4357
4527
|
if (column.kind === "select") {
|
|
4358
|
-
return /* @__PURE__ */
|
|
4528
|
+
return /* @__PURE__ */ jsxs12(
|
|
4359
4529
|
"select",
|
|
4360
4530
|
{
|
|
4361
4531
|
...shared,
|
|
@@ -4372,8 +4542,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4372
4542
|
},
|
|
4373
4543
|
onBlur: () => onCommit(text),
|
|
4374
4544
|
children: [
|
|
4375
|
-
/* @__PURE__ */
|
|
4376
|
-
column.options.map((option) => /* @__PURE__ */
|
|
4545
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
4546
|
+
column.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option.value, children: option.label }, option.value))
|
|
4377
4547
|
]
|
|
4378
4548
|
}
|
|
4379
4549
|
);
|
|
@@ -4391,7 +4561,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4391
4561
|
}
|
|
4392
4562
|
};
|
|
4393
4563
|
if (column.kind === "text" && column.multiline === true) {
|
|
4394
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ jsx14(
|
|
4395
4565
|
"textarea",
|
|
4396
4566
|
{
|
|
4397
4567
|
...shared,
|
|
@@ -4403,7 +4573,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4403
4573
|
}
|
|
4404
4574
|
);
|
|
4405
4575
|
}
|
|
4406
|
-
return /* @__PURE__ */
|
|
4576
|
+
return /* @__PURE__ */ jsx14(
|
|
4407
4577
|
"input",
|
|
4408
4578
|
{
|
|
4409
4579
|
...shared,
|
|
@@ -4425,8 +4595,8 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4425
4595
|
[onToggle]
|
|
4426
4596
|
);
|
|
4427
4597
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
4428
|
-
return /* @__PURE__ */
|
|
4429
|
-
/* @__PURE__ */
|
|
4598
|
+
return /* @__PURE__ */ jsxs12("span", { ref: containerRef, className: "relative inline-flex", children: [
|
|
4599
|
+
/* @__PURE__ */ jsx14(
|
|
4430
4600
|
"button",
|
|
4431
4601
|
{
|
|
4432
4602
|
type: "button",
|
|
@@ -4439,7 +4609,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4439
4609
|
onToggle();
|
|
4440
4610
|
},
|
|
4441
4611
|
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
4442
|
-
children: /* @__PURE__ */
|
|
4612
|
+
children: /* @__PURE__ */ jsx14(
|
|
4443
4613
|
"svg",
|
|
4444
4614
|
{
|
|
4445
4615
|
viewBox: "0 0 24 24",
|
|
@@ -4449,12 +4619,12 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4449
4619
|
strokeWidth: "2.5",
|
|
4450
4620
|
strokeLinecap: "round",
|
|
4451
4621
|
"aria-hidden": true,
|
|
4452
|
-
children: /* @__PURE__ */
|
|
4622
|
+
children: /* @__PURE__ */ jsx14("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
4453
4623
|
}
|
|
4454
4624
|
)
|
|
4455
4625
|
}
|
|
4456
4626
|
),
|
|
4457
|
-
/* @__PURE__ */
|
|
4627
|
+
/* @__PURE__ */ jsxs12(
|
|
4458
4628
|
PopoverSurface,
|
|
4459
4629
|
{
|
|
4460
4630
|
open,
|
|
@@ -4464,17 +4634,17 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4464
4634
|
panelRef,
|
|
4465
4635
|
className: `w-64 rounded-lg border border-card-edge bg-popover p-3 text-left ${OVERLAY_SHADOW}`,
|
|
4466
4636
|
children: [
|
|
4467
|
-
source.quote && /* @__PURE__ */
|
|
4637
|
+
source.quote && /* @__PURE__ */ jsxs12("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
4468
4638
|
"\u201C",
|
|
4469
4639
|
source.quote,
|
|
4470
4640
|
"\u201D"
|
|
4471
4641
|
] }),
|
|
4472
|
-
/* @__PURE__ */
|
|
4642
|
+
/* @__PURE__ */ jsxs12("span", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
4473
4643
|
source.label ?? "Source",
|
|
4474
4644
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
4475
4645
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
4476
4646
|
] }),
|
|
4477
|
-
source.href && /* @__PURE__ */
|
|
4647
|
+
source.href && /* @__PURE__ */ jsx14(
|
|
4478
4648
|
"a",
|
|
4479
4649
|
{
|
|
4480
4650
|
href: source.href,
|
|
@@ -4502,8 +4672,8 @@ function AddRecordForm({
|
|
|
4502
4672
|
onSubmit,
|
|
4503
4673
|
onCancel
|
|
4504
4674
|
}) {
|
|
4505
|
-
const groups =
|
|
4506
|
-
return /* @__PURE__ */
|
|
4675
|
+
const groups = useMemo6(() => groupColumns(columns), [columns]);
|
|
4676
|
+
return /* @__PURE__ */ jsxs12(
|
|
4507
4677
|
"form",
|
|
4508
4678
|
{
|
|
4509
4679
|
noValidate: true,
|
|
@@ -4514,31 +4684,31 @@ function AddRecordForm({
|
|
|
4514
4684
|
},
|
|
4515
4685
|
className: "space-y-4 rounded-xl border border-card-edge bg-card p-4",
|
|
4516
4686
|
children: [
|
|
4517
|
-
/* @__PURE__ */
|
|
4518
|
-
formError !== null && /* @__PURE__ */
|
|
4687
|
+
/* @__PURE__ */ jsx14("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
4688
|
+
formError !== null && /* @__PURE__ */ jsx14("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
4519
4689
|
groups.map((group) => {
|
|
4520
4690
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
4521
4691
|
if (fields.length === 0) return null;
|
|
4522
|
-
return /* @__PURE__ */
|
|
4692
|
+
return /* @__PURE__ */ jsxs12(
|
|
4523
4693
|
"fieldset",
|
|
4524
4694
|
{
|
|
4525
4695
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-card-edge p-3",
|
|
4526
4696
|
children: [
|
|
4527
|
-
group.label !== null && /* @__PURE__ */
|
|
4528
|
-
/* @__PURE__ */
|
|
4697
|
+
group.label !== null && /* @__PURE__ */ jsx14("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
4698
|
+
/* @__PURE__ */ jsx14("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
4529
4699
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
4530
4700
|
const errorId = `${fieldId}-error`;
|
|
4531
4701
|
const message = errors[column.id];
|
|
4532
|
-
return /* @__PURE__ */
|
|
4702
|
+
return /* @__PURE__ */ jsxs12(
|
|
4533
4703
|
"div",
|
|
4534
4704
|
{
|
|
4535
4705
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
4536
4706
|
children: [
|
|
4537
|
-
/* @__PURE__ */
|
|
4707
|
+
/* @__PURE__ */ jsxs12("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
4538
4708
|
column.header,
|
|
4539
|
-
column.required === true && /* @__PURE__ */
|
|
4709
|
+
column.required === true && /* @__PURE__ */ jsx14("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
4540
4710
|
] }),
|
|
4541
|
-
/* @__PURE__ */
|
|
4711
|
+
/* @__PURE__ */ jsx14(
|
|
4542
4712
|
DraftField,
|
|
4543
4713
|
{
|
|
4544
4714
|
column,
|
|
@@ -4549,8 +4719,8 @@ function AddRecordForm({
|
|
|
4549
4719
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
4550
4720
|
}
|
|
4551
4721
|
),
|
|
4552
|
-
column.hint && /* @__PURE__ */
|
|
4553
|
-
message !== void 0 && /* @__PURE__ */
|
|
4722
|
+
column.hint && /* @__PURE__ */ jsx14("p", { className: "mt-1 text-xs text-muted-foreground", children: column.hint }),
|
|
4723
|
+
message !== void 0 && /* @__PURE__ */ jsx14("p", { id: errorId, role: "alert", className: "mt-1 text-xs text-destructive", children: message })
|
|
4554
4724
|
]
|
|
4555
4725
|
},
|
|
4556
4726
|
column.id
|
|
@@ -4561,8 +4731,8 @@ function AddRecordForm({
|
|
|
4561
4731
|
group.label ?? "_"
|
|
4562
4732
|
);
|
|
4563
4733
|
}),
|
|
4564
|
-
/* @__PURE__ */
|
|
4565
|
-
/* @__PURE__ */
|
|
4734
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
4735
|
+
/* @__PURE__ */ jsx14(
|
|
4566
4736
|
"button",
|
|
4567
4737
|
{
|
|
4568
4738
|
type: "submit",
|
|
@@ -4571,7 +4741,7 @@ function AddRecordForm({
|
|
|
4571
4741
|
children: busy ? "Saving\u2026" : "Save"
|
|
4572
4742
|
}
|
|
4573
4743
|
),
|
|
4574
|
-
/* @__PURE__ */
|
|
4744
|
+
/* @__PURE__ */ jsx14(
|
|
4575
4745
|
"button",
|
|
4576
4746
|
{
|
|
4577
4747
|
type: "button",
|
|
@@ -4592,7 +4762,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4592
4762
|
"aria-describedby": describedBy
|
|
4593
4763
|
};
|
|
4594
4764
|
if (column.kind === "boolean") {
|
|
4595
|
-
return /* @__PURE__ */
|
|
4765
|
+
return /* @__PURE__ */ jsx14(
|
|
4596
4766
|
"input",
|
|
4597
4767
|
{
|
|
4598
4768
|
...shared,
|
|
@@ -4604,7 +4774,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4604
4774
|
);
|
|
4605
4775
|
}
|
|
4606
4776
|
if (column.kind === "select") {
|
|
4607
|
-
return /* @__PURE__ */
|
|
4777
|
+
return /* @__PURE__ */ jsxs12(
|
|
4608
4778
|
"select",
|
|
4609
4779
|
{
|
|
4610
4780
|
...shared,
|
|
@@ -4612,14 +4782,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4612
4782
|
value: typeof value === "string" ? value : "",
|
|
4613
4783
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
4614
4784
|
children: [
|
|
4615
|
-
/* @__PURE__ */
|
|
4616
|
-
column.options.map((option) => /* @__PURE__ */
|
|
4785
|
+
/* @__PURE__ */ jsx14("option", { value: "", children: "\u2014" }),
|
|
4786
|
+
column.options.map((option) => /* @__PURE__ */ jsx14("option", { value: option.value, children: option.label }, option.value))
|
|
4617
4787
|
]
|
|
4618
4788
|
}
|
|
4619
4789
|
);
|
|
4620
4790
|
}
|
|
4621
4791
|
if (column.kind === "text" && column.multiline === true) {
|
|
4622
|
-
return /* @__PURE__ */
|
|
4792
|
+
return /* @__PURE__ */ jsx14(
|
|
4623
4793
|
"textarea",
|
|
4624
4794
|
{
|
|
4625
4795
|
...shared,
|
|
@@ -4631,7 +4801,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4631
4801
|
);
|
|
4632
4802
|
}
|
|
4633
4803
|
if (column.kind === "number" || column.kind === "currency") {
|
|
4634
|
-
return /* @__PURE__ */
|
|
4804
|
+
return /* @__PURE__ */ jsx14(
|
|
4635
4805
|
"input",
|
|
4636
4806
|
{
|
|
4637
4807
|
...shared,
|
|
@@ -4651,7 +4821,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4651
4821
|
}
|
|
4652
4822
|
);
|
|
4653
4823
|
}
|
|
4654
|
-
return /* @__PURE__ */
|
|
4824
|
+
return /* @__PURE__ */ jsx14(
|
|
4655
4825
|
"input",
|
|
4656
4826
|
{
|
|
4657
4827
|
...shared,
|
|
@@ -4666,18 +4836,18 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4666
4836
|
// src/web-react/command-palette.tsx
|
|
4667
4837
|
import {
|
|
4668
4838
|
useCallback as useCallback9,
|
|
4669
|
-
useEffect as
|
|
4839
|
+
useEffect as useEffect12,
|
|
4670
4840
|
useId as useId3,
|
|
4671
|
-
useMemo as
|
|
4672
|
-
useRef as
|
|
4673
|
-
useState as
|
|
4841
|
+
useMemo as useMemo7,
|
|
4842
|
+
useRef as useRef10,
|
|
4843
|
+
useState as useState16
|
|
4674
4844
|
} from "react";
|
|
4675
4845
|
import { Dialog, DialogContent, DialogTitle } from "@tangle-network/ui/primitives";
|
|
4676
|
-
import { jsx as
|
|
4846
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4677
4847
|
function SearchGlyph({ className }) {
|
|
4678
|
-
return /* @__PURE__ */
|
|
4679
|
-
/* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4848
|
+
return /* @__PURE__ */ jsxs13("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
4849
|
+
/* @__PURE__ */ jsx15("circle", { cx: "11", cy: "11", r: "8" }),
|
|
4850
|
+
/* @__PURE__ */ jsx15("path", { d: "m21 21-4.3-4.3" })
|
|
4681
4851
|
] });
|
|
4682
4852
|
}
|
|
4683
4853
|
function CommandPalette({
|
|
@@ -4694,7 +4864,7 @@ function CommandPalette({
|
|
|
4694
4864
|
emptyMessage,
|
|
4695
4865
|
label = "Command palette"
|
|
4696
4866
|
}) {
|
|
4697
|
-
const [internalOpen, setInternalOpen] =
|
|
4867
|
+
const [internalOpen, setInternalOpen] = useState16(false);
|
|
4698
4868
|
const open = controlledOpen ?? internalOpen;
|
|
4699
4869
|
const setOpen = useCallback9(
|
|
4700
4870
|
(next) => {
|
|
@@ -4703,16 +4873,16 @@ function CommandPalette({
|
|
|
4703
4873
|
},
|
|
4704
4874
|
[controlledOpen, onOpenChange]
|
|
4705
4875
|
);
|
|
4706
|
-
const [query, setQuery] =
|
|
4707
|
-
const [active, setActive] =
|
|
4708
|
-
const inputRef =
|
|
4876
|
+
const [query, setQuery] = useState16(initialQuery ?? "");
|
|
4877
|
+
const [active, setActive] = useState16(0);
|
|
4878
|
+
const inputRef = useRef10(null);
|
|
4709
4879
|
const surfaceId = useId3();
|
|
4710
4880
|
const listId = `${surfaceId}-list`;
|
|
4711
|
-
const flat =
|
|
4712
|
-
const sections =
|
|
4881
|
+
const flat = useMemo7(() => filterCommandPaletteItems(items, query), [items, query]);
|
|
4882
|
+
const sections = useMemo7(() => groupCommandPaletteItems(flat), [flat]);
|
|
4713
4883
|
const activeIndex = flat.length === 0 ? 0 : Math.min(active, flat.length - 1);
|
|
4714
4884
|
const activeId = flat.length > 0 ? `${listId}-${activeIndex}` : void 0;
|
|
4715
|
-
|
|
4885
|
+
useEffect12(() => {
|
|
4716
4886
|
if (!hotkey) return;
|
|
4717
4887
|
function onKeyDown(e) {
|
|
4718
4888
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
@@ -4723,14 +4893,14 @@ function CommandPalette({
|
|
|
4723
4893
|
document.addEventListener("keydown", onKeyDown);
|
|
4724
4894
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
4725
4895
|
}, [hotkey, open, setOpen]);
|
|
4726
|
-
const restoreFocusRef =
|
|
4727
|
-
|
|
4896
|
+
const restoreFocusRef = useRef10(null);
|
|
4897
|
+
useEffect12(() => {
|
|
4728
4898
|
if (open) return;
|
|
4729
4899
|
setQuery(initialQuery ?? "");
|
|
4730
4900
|
onQueryChange?.(initialQuery ?? "");
|
|
4731
4901
|
setActive(0);
|
|
4732
4902
|
}, [open]);
|
|
4733
|
-
|
|
4903
|
+
useEffect12(() => {
|
|
4734
4904
|
if (!open || !activeId) return;
|
|
4735
4905
|
document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
|
|
4736
4906
|
}, [open, activeId]);
|
|
@@ -4755,7 +4925,7 @@ function CommandPalette({
|
|
|
4755
4925
|
}
|
|
4756
4926
|
};
|
|
4757
4927
|
let rowIndex = -1;
|
|
4758
|
-
return /* @__PURE__ */
|
|
4928
|
+
return /* @__PURE__ */ jsx15(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs13(
|
|
4759
4929
|
DialogContent,
|
|
4760
4930
|
{
|
|
4761
4931
|
hideCloseButton: true,
|
|
@@ -4774,10 +4944,10 @@ function CommandPalette({
|
|
|
4774
4944
|
...{ [POPOVER_SURFACE_ATTR]: surfaceId },
|
|
4775
4945
|
className: `top-[15%] z-[1000] flex max-h-[70vh] w-[560px] max-w-[calc(100vw-2rem)] translate-y-0 flex-col gap-0 overflow-hidden rounded-xl border-card-edge bg-popover p-0 ${OVERLAY_SHADOW}`,
|
|
4776
4946
|
children: [
|
|
4777
|
-
/* @__PURE__ */
|
|
4778
|
-
/* @__PURE__ */
|
|
4779
|
-
/* @__PURE__ */
|
|
4780
|
-
/* @__PURE__ */
|
|
4947
|
+
/* @__PURE__ */ jsx15(DialogTitle, { className: "sr-only", children: label }),
|
|
4948
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
4949
|
+
/* @__PURE__ */ jsx15(SearchGlyph, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
4950
|
+
/* @__PURE__ */ jsx15(
|
|
4781
4951
|
"input",
|
|
4782
4952
|
{
|
|
4783
4953
|
ref: inputRef,
|
|
@@ -4799,15 +4969,15 @@ function CommandPalette({
|
|
|
4799
4969
|
}
|
|
4800
4970
|
)
|
|
4801
4971
|
] }),
|
|
4802
|
-
/* @__PURE__ */
|
|
4803
|
-
loading && /* @__PURE__ */
|
|
4804
|
-
!loading && flat.length === 0 && /* @__PURE__ */
|
|
4805
|
-
!loading && sections.map((section) => /* @__PURE__ */
|
|
4806
|
-
/* @__PURE__ */
|
|
4972
|
+
/* @__PURE__ */ jsxs13("div", { role: "listbox", id: listId, className: "min-h-0 flex-1 overflow-y-auto p-1 pb-2", children: [
|
|
4973
|
+
loading && /* @__PURE__ */ jsx15("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading\u2026" }),
|
|
4974
|
+
!loading && flat.length === 0 && /* @__PURE__ */ jsx15("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: emptyMessage ?? (query.trim() ? `No results for \u201C${query.trim()}\u201D` : "Nothing here yet") }),
|
|
4975
|
+
!loading && sections.map((section) => /* @__PURE__ */ jsxs13("div", { children: [
|
|
4976
|
+
/* @__PURE__ */ jsx15("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.group }),
|
|
4807
4977
|
section.items.map((item) => {
|
|
4808
4978
|
rowIndex += 1;
|
|
4809
4979
|
const index = rowIndex;
|
|
4810
|
-
return /* @__PURE__ */
|
|
4980
|
+
return /* @__PURE__ */ jsxs13(
|
|
4811
4981
|
"div",
|
|
4812
4982
|
{
|
|
4813
4983
|
id: `${listId}-${index}`,
|
|
@@ -4817,9 +4987,9 @@ function CommandPalette({
|
|
|
4817
4987
|
onClick: () => choose(item),
|
|
4818
4988
|
className: `flex w-full cursor-pointer items-center gap-2.5 rounded-md px-3 py-2.5 text-left text-sm ${index === activeIndex ? "bg-accent" : ""}`,
|
|
4819
4989
|
children: [
|
|
4820
|
-
/* @__PURE__ */
|
|
4821
|
-
item.description && /* @__PURE__ */
|
|
4822
|
-
item.hint && /* @__PURE__ */
|
|
4990
|
+
/* @__PURE__ */ jsx15("span", { className: "truncate text-foreground", children: item.label }),
|
|
4991
|
+
item.description && /* @__PURE__ */ jsx15("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
4992
|
+
item.hint && /* @__PURE__ */ jsx15("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
4823
4993
|
]
|
|
4824
4994
|
},
|
|
4825
4995
|
item.id
|
|
@@ -4827,15 +4997,15 @@ function CommandPalette({
|
|
|
4827
4997
|
})
|
|
4828
4998
|
] }, section.group))
|
|
4829
4999
|
] }),
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4832
|
-
/* @__PURE__ */
|
|
4833
|
-
/* @__PURE__ */
|
|
4834
|
-
/* @__PURE__ */
|
|
4835
|
-
/* @__PURE__ */
|
|
4836
|
-
/* @__PURE__ */
|
|
4837
|
-
/* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
5000
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
5001
|
+
/* @__PURE__ */ jsx15("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
5002
|
+
/* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1.5", children: [
|
|
5003
|
+
/* @__PURE__ */ jsx15("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
5004
|
+
/* @__PURE__ */ jsx15("span", { children: "navigate" }),
|
|
5005
|
+
/* @__PURE__ */ jsx15("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
5006
|
+
/* @__PURE__ */ jsx15("span", { children: "select" }),
|
|
5007
|
+
/* @__PURE__ */ jsx15("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
5008
|
+
/* @__PURE__ */ jsx15("span", { children: "close" })
|
|
4839
5009
|
] })
|
|
4840
5010
|
] })
|
|
4841
5011
|
]
|
|
@@ -4844,7 +5014,7 @@ function CommandPalette({
|
|
|
4844
5014
|
}
|
|
4845
5015
|
|
|
4846
5016
|
// src/web-react/sparkline.tsx
|
|
4847
|
-
import { jsx as
|
|
5017
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4848
5018
|
var DEFAULT_SPARKLINE_WIDTH = 96;
|
|
4849
5019
|
var DEFAULT_SPARKLINE_HEIGHT = 24;
|
|
4850
5020
|
var DEFAULT_INSET = 2.5;
|
|
@@ -4950,21 +5120,21 @@ function Sparkline({
|
|
|
4950
5120
|
const geometry = sparklineGeometry(values, { width, height });
|
|
4951
5121
|
const accessibleName = sparklineLabel(values, { label, format });
|
|
4952
5122
|
if (geometry.points.length === 0) {
|
|
4953
|
-
return /* @__PURE__ */
|
|
5123
|
+
return /* @__PURE__ */ jsxs14(
|
|
4954
5124
|
"span",
|
|
4955
5125
|
{
|
|
4956
5126
|
"data-sparkline": geometry.gaps > 0 ? "unavailable" : "empty",
|
|
4957
5127
|
className: joinClasses("text-[11px] text-muted-foreground", className),
|
|
4958
5128
|
children: [
|
|
4959
|
-
/* @__PURE__ */
|
|
4960
|
-
/* @__PURE__ */
|
|
5129
|
+
/* @__PURE__ */ jsx16("span", { className: "sr-only", children: accessibleName }),
|
|
5130
|
+
/* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: geometry.gaps > 0 ? unavailableLabel : emptyLabel })
|
|
4961
5131
|
]
|
|
4962
5132
|
}
|
|
4963
5133
|
);
|
|
4964
5134
|
}
|
|
4965
5135
|
const drawsLine = geometry.segments.some((segment) => segment.length > 1);
|
|
4966
5136
|
const end = geometry.points[geometry.points.length - 1];
|
|
4967
|
-
return /* @__PURE__ */
|
|
5137
|
+
return /* @__PURE__ */ jsxs14(
|
|
4968
5138
|
"svg",
|
|
4969
5139
|
{
|
|
4970
5140
|
role: "img",
|
|
@@ -4981,7 +5151,7 @@ function Sparkline({
|
|
|
4981
5151
|
geometry.segments.map((segment, index) => {
|
|
4982
5152
|
const key = `segment-${index}`;
|
|
4983
5153
|
if (segment.length > 1) {
|
|
4984
|
-
return /* @__PURE__ */
|
|
5154
|
+
return /* @__PURE__ */ jsx16(
|
|
4985
5155
|
"polyline",
|
|
4986
5156
|
{
|
|
4987
5157
|
points: sparklinePointsAttribute(segment),
|
|
@@ -4997,9 +5167,9 @@ function Sparkline({
|
|
|
4997
5167
|
}
|
|
4998
5168
|
const only = segment[0];
|
|
4999
5169
|
if (only.x === end.x && only.y === end.y) return null;
|
|
5000
|
-
return /* @__PURE__ */
|
|
5170
|
+
return /* @__PURE__ */ jsx16("circle", { cx: only.x, cy: only.y, r: DOT_RADIUS, fill: "currentColor" }, key);
|
|
5001
5171
|
}),
|
|
5002
|
-
/* @__PURE__ */
|
|
5172
|
+
/* @__PURE__ */ jsx16("circle", { cx: end.x, cy: end.y, r: DOT_RADIUS, fill: "currentColor" })
|
|
5003
5173
|
]
|
|
5004
5174
|
}
|
|
5005
5175
|
);
|
|
@@ -5009,11 +5179,11 @@ function Sparkline({
|
|
|
5009
5179
|
import {
|
|
5010
5180
|
isValidElement as isValidElement2,
|
|
5011
5181
|
useCallback as useCallback10,
|
|
5012
|
-
useEffect as
|
|
5013
|
-
useRef as
|
|
5014
|
-
useState as
|
|
5182
|
+
useEffect as useEffect13,
|
|
5183
|
+
useRef as useRef11,
|
|
5184
|
+
useState as useState17
|
|
5015
5185
|
} from "react";
|
|
5016
|
-
import { Fragment as Fragment5, jsx as
|
|
5186
|
+
import { Fragment as Fragment5, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5017
5187
|
function insightDelta(value, previous) {
|
|
5018
5188
|
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
5019
5189
|
if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
|
|
@@ -5066,7 +5236,7 @@ function InsightCard({
|
|
|
5066
5236
|
const tone = delta ? insightDeltaTone(delta.direction, polarity) : "neutral";
|
|
5067
5237
|
const unavailable = typeof value === "number" && !Number.isFinite(value);
|
|
5068
5238
|
const shown = typeof value === "number" ? format(value) : value;
|
|
5069
|
-
return /* @__PURE__ */
|
|
5239
|
+
return /* @__PURE__ */ jsxs15(
|
|
5070
5240
|
"article",
|
|
5071
5241
|
{
|
|
5072
5242
|
"data-insight-card": "",
|
|
@@ -5074,40 +5244,40 @@ function InsightCard({
|
|
|
5074
5244
|
className: joinClasses("agent-arrive flex h-full flex-col rounded-xl border border-card-edge bg-card p-4", className),
|
|
5075
5245
|
style,
|
|
5076
5246
|
children: [
|
|
5077
|
-
eyebrow ? /* @__PURE__ */
|
|
5078
|
-
/* @__PURE__ */
|
|
5079
|
-
/* @__PURE__ */
|
|
5247
|
+
eyebrow ? /* @__PURE__ */ jsx17("p", { "data-insight-eyebrow": "", className: "mb-0.5 text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: eyebrow }) : null,
|
|
5248
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
5249
|
+
/* @__PURE__ */ jsx17("h3", { className: "text-[13px] font-medium text-muted-foreground", children: title }),
|
|
5080
5250
|
live ? (
|
|
5081
5251
|
// No `data-motion` opt-out: the word is the signal and the sweep is
|
|
5082
5252
|
// emphasis, so the reduced-motion floor reaches this like everything
|
|
5083
5253
|
// else and leaves a static, legible label.
|
|
5084
|
-
/* @__PURE__ */
|
|
5254
|
+
/* @__PURE__ */ jsx17("span", { className: "agent-shimmer shrink-0 text-[11px] font-medium", "data-insight-live": "", children: liveLabel })
|
|
5085
5255
|
) : null
|
|
5086
5256
|
] }),
|
|
5087
|
-
/* @__PURE__ */
|
|
5088
|
-
/* @__PURE__ */
|
|
5089
|
-
/* @__PURE__ */
|
|
5090
|
-
] }) : /* @__PURE__ */
|
|
5091
|
-
/* @__PURE__ */
|
|
5092
|
-
unit ? /* @__PURE__ */
|
|
5257
|
+
/* @__PURE__ */ jsx17("p", { className: "mt-1 flex items-baseline gap-1", children: unavailable ? /* @__PURE__ */ jsxs15("span", { "data-insight-value": "unavailable", className: "text-xl font-semibold text-muted-foreground", children: [
|
|
5258
|
+
/* @__PURE__ */ jsx17("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
|
|
5259
|
+
/* @__PURE__ */ jsx17("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
|
|
5260
|
+
] }) : /* @__PURE__ */ jsxs15(Fragment5, { children: [
|
|
5261
|
+
/* @__PURE__ */ jsx17("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
|
|
5262
|
+
unit ? /* @__PURE__ */ jsx17("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
|
|
5093
5263
|
] }) }),
|
|
5094
|
-
delta ? /* @__PURE__ */
|
|
5095
|
-
/* @__PURE__ */
|
|
5264
|
+
delta ? /* @__PURE__ */ jsxs15("p", { "data-insight-delta": delta.direction, className: `mt-0.5 text-[11px] font-medium ${TONE_CLASS[tone]}`, children: [
|
|
5265
|
+
/* @__PURE__ */ jsxs15("span", { "aria-hidden": "true", children: [
|
|
5096
5266
|
DIRECTION_GLYPH[delta.direction],
|
|
5097
5267
|
" "
|
|
5098
5268
|
] }),
|
|
5099
5269
|
formatInsightDelta(delta, format)
|
|
5100
5270
|
] }) : null,
|
|
5101
|
-
description ? /* @__PURE__ */
|
|
5102
|
-
series ? /* @__PURE__ */
|
|
5103
|
-
action ? /* @__PURE__ */
|
|
5271
|
+
description ? /* @__PURE__ */ jsx17("p", { className: "mt-1 text-[11px] text-muted-foreground", children: description }) : null,
|
|
5272
|
+
series ? /* @__PURE__ */ jsx17("div", { className: "mt-2 text-muted-foreground", children: /* @__PURE__ */ jsx17(Sparkline, { values: series, label: seriesLabel ?? title, format }) }) : null,
|
|
5273
|
+
action ? /* @__PURE__ */ jsx17("div", { className: "mt-3", children: renderInsightAction(action) }) : null
|
|
5104
5274
|
]
|
|
5105
5275
|
}
|
|
5106
5276
|
);
|
|
5107
5277
|
}
|
|
5108
5278
|
function renderInsightAction(action) {
|
|
5109
5279
|
if (isValidElement2(action)) return action;
|
|
5110
|
-
return /* @__PURE__ */
|
|
5280
|
+
return /* @__PURE__ */ jsx17(
|
|
5111
5281
|
"button",
|
|
5112
5282
|
{
|
|
5113
5283
|
type: "button",
|
|
@@ -5176,14 +5346,14 @@ function InsightDeck({
|
|
|
5176
5346
|
className,
|
|
5177
5347
|
onPageChange
|
|
5178
5348
|
}) {
|
|
5179
|
-
const [page, setPage] =
|
|
5180
|
-
const [held, setHeld] =
|
|
5349
|
+
const [page, setPage] = useState17(0);
|
|
5350
|
+
const [held, setHeld] = useState17(null);
|
|
5181
5351
|
const answered = state.status === "error" || state.status === "empty";
|
|
5182
5352
|
const carried = state.status === "ready" ? state.value : answered ? null : held;
|
|
5183
5353
|
if (carried !== held) setHeld(carried);
|
|
5184
5354
|
const shown = carried !== null && state.status !== "ready" ? { status: "ready", value: carried, retry: state.retry } : state;
|
|
5185
5355
|
const refreshing = shown !== state;
|
|
5186
|
-
const reported =
|
|
5356
|
+
const reported = useRef11(0);
|
|
5187
5357
|
const settlePage = useCallback10(
|
|
5188
5358
|
(next) => {
|
|
5189
5359
|
if (reported.current === next) return;
|
|
@@ -5192,7 +5362,7 @@ function InsightDeck({
|
|
|
5192
5362
|
},
|
|
5193
5363
|
[onPageChange]
|
|
5194
5364
|
);
|
|
5195
|
-
return /* @__PURE__ */
|
|
5365
|
+
return /* @__PURE__ */ jsx17(
|
|
5196
5366
|
AsyncView,
|
|
5197
5367
|
{
|
|
5198
5368
|
state: shown,
|
|
@@ -5200,7 +5370,7 @@ function InsightDeck({
|
|
|
5200
5370
|
loadingLabel,
|
|
5201
5371
|
retryLabel,
|
|
5202
5372
|
className,
|
|
5203
|
-
children: (insights) => /* @__PURE__ */
|
|
5373
|
+
children: (insights) => /* @__PURE__ */ jsx17(
|
|
5204
5374
|
InsightPages,
|
|
5205
5375
|
{
|
|
5206
5376
|
insights,
|
|
@@ -5267,13 +5437,13 @@ function InsightPages({
|
|
|
5267
5437
|
const pageCount = insightPageCount(insights.length, size);
|
|
5268
5438
|
const current = Math.min(Math.max(page, 0), pageCount - 1);
|
|
5269
5439
|
const visible = insightPageSlice(insights, current, size);
|
|
5270
|
-
const sectionRef =
|
|
5271
|
-
const listRef =
|
|
5272
|
-
const recoverFocus =
|
|
5273
|
-
|
|
5440
|
+
const sectionRef = useRef11(null);
|
|
5441
|
+
const listRef = useRef11(null);
|
|
5442
|
+
const recoverFocus = useRef11(false);
|
|
5443
|
+
useEffect13(() => {
|
|
5274
5444
|
onPageSettled(current);
|
|
5275
5445
|
}, [current, onPageSettled]);
|
|
5276
|
-
|
|
5446
|
+
useEffect13(() => {
|
|
5277
5447
|
if (!recoverFocus.current) return;
|
|
5278
5448
|
recoverFocus.current = false;
|
|
5279
5449
|
sectionRef.current?.focus();
|
|
@@ -5313,7 +5483,7 @@ function InsightPages({
|
|
|
5313
5483
|
}
|
|
5314
5484
|
if (moved) event.preventDefault();
|
|
5315
5485
|
};
|
|
5316
|
-
return /* @__PURE__ */
|
|
5486
|
+
return /* @__PURE__ */ jsxs15(
|
|
5317
5487
|
"section",
|
|
5318
5488
|
{
|
|
5319
5489
|
ref: sectionRef,
|
|
@@ -5325,7 +5495,7 @@ function InsightPages({
|
|
|
5325
5495
|
tabIndex: pageCount > 1 ? 0 : void 0,
|
|
5326
5496
|
"aria-keyshortcuts": pageCount > 1 ? "ArrowLeft ArrowRight PageUp PageDown Home End" : void 0,
|
|
5327
5497
|
children: [
|
|
5328
|
-
/* @__PURE__ */
|
|
5498
|
+
/* @__PURE__ */ jsx17("ul", { ref: listRef, className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: visible.map(({ id, style, ...card }, index) => (
|
|
5329
5499
|
// The page index is in the key on purpose: a page turn is an arrival,
|
|
5330
5500
|
// and reusing the node would swap the text under a card that never
|
|
5331
5501
|
// moved. Remounting replays `.agent-arrive` with the new stagger.
|
|
@@ -5336,10 +5506,10 @@ function InsightPages({
|
|
|
5336
5506
|
// does not arrive a second time. The key does BOTH jobs — but only
|
|
5337
5507
|
// because the deck now keeps this subtree mounted across a reload
|
|
5338
5508
|
// (see `InsightDeck`); a key is never compared across a teardown.
|
|
5339
|
-
/* @__PURE__ */
|
|
5509
|
+
/* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsx17(InsightCard, { ...card, style: staggerStyle(index, style) }) }, `${current}:${id}`)
|
|
5340
5510
|
)) }),
|
|
5341
|
-
/* @__PURE__ */
|
|
5342
|
-
/* @__PURE__ */
|
|
5511
|
+
/* @__PURE__ */ jsxs15("div", { className: pageCount > 1 ? "flex items-center justify-between gap-2" : void 0, children: [
|
|
5512
|
+
/* @__PURE__ */ jsxs15(
|
|
5343
5513
|
"p",
|
|
5344
5514
|
{
|
|
5345
5515
|
role: "status",
|
|
@@ -5353,8 +5523,8 @@ function InsightPages({
|
|
|
5353
5523
|
]
|
|
5354
5524
|
}
|
|
5355
5525
|
),
|
|
5356
|
-
pageCount > 1 ? /* @__PURE__ */
|
|
5357
|
-
/* @__PURE__ */
|
|
5526
|
+
pageCount > 1 ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
5527
|
+
/* @__PURE__ */ jsx17(PagerButton, { label: "Previous insights", glyph: "\u2039", atEnd: current === 0, onClick: () => goTo(current - 1) }),
|
|
5358
5528
|
pageCount <= MAX_PAGE_DOTS ? Array.from({ length: pageCount }, (_, index) => (
|
|
5359
5529
|
// WCAG 2.2 SC 2.5.8 wants a 24x24 CSS px target. The dot stays
|
|
5360
5530
|
// 8px because a 24px dot is a different control; the BUTTON
|
|
@@ -5362,7 +5532,7 @@ function InsightPages({
|
|
|
5362
5532
|
// and the span is the graphic. The Spacing exception cannot
|
|
5363
5533
|
// rescue the bare dot — at a 12px pitch the 24px circle around
|
|
5364
5534
|
// each centre overlaps its neighbour's.
|
|
5365
|
-
/* @__PURE__ */
|
|
5535
|
+
/* @__PURE__ */ jsx17(
|
|
5366
5536
|
"button",
|
|
5367
5537
|
{
|
|
5368
5538
|
type: "button",
|
|
@@ -5370,7 +5540,7 @@ function InsightPages({
|
|
|
5370
5540
|
"aria-current": index === current ? "page" : void 0,
|
|
5371
5541
|
onClick: () => goTo(index),
|
|
5372
5542
|
className: "group flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
5373
|
-
children: /* @__PURE__ */
|
|
5543
|
+
children: /* @__PURE__ */ jsx17(
|
|
5374
5544
|
"span",
|
|
5375
5545
|
{
|
|
5376
5546
|
"aria-hidden": "true",
|
|
@@ -5384,7 +5554,7 @@ function InsightPages({
|
|
|
5384
5554
|
index
|
|
5385
5555
|
)
|
|
5386
5556
|
)) : null,
|
|
5387
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsx17(
|
|
5388
5558
|
PagerButton,
|
|
5389
5559
|
{
|
|
5390
5560
|
label: "Next insights",
|
|
@@ -5405,7 +5575,7 @@ function PagerButton({
|
|
|
5405
5575
|
atEnd,
|
|
5406
5576
|
onClick
|
|
5407
5577
|
}) {
|
|
5408
|
-
return /* @__PURE__ */
|
|
5578
|
+
return /* @__PURE__ */ jsx17(
|
|
5409
5579
|
"button",
|
|
5410
5580
|
{
|
|
5411
5581
|
type: "button",
|
|
@@ -5415,15 +5585,15 @@ function PagerButton({
|
|
|
5415
5585
|
if (!atEnd) onClick();
|
|
5416
5586
|
},
|
|
5417
5587
|
className: `flex h-6 w-6 items-center justify-center rounded-md border border-border text-xs text-muted-foreground transition ${atEnd ? "opacity-40" : "hover:bg-accent hover:text-foreground"}`,
|
|
5418
|
-
children: /* @__PURE__ */
|
|
5588
|
+
children: /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", children: glyph })
|
|
5419
5589
|
}
|
|
5420
5590
|
);
|
|
5421
5591
|
}
|
|
5422
5592
|
|
|
5423
5593
|
// src/web-react/api-access-panel.tsx
|
|
5424
|
-
import { useEffect as
|
|
5594
|
+
import { useEffect as useEffect14, useRef as useRef12, useState as useState18 } from "react";
|
|
5425
5595
|
import { PageHeader } from "@tangle-network/ui/primitives";
|
|
5426
|
-
import { jsx as
|
|
5596
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5427
5597
|
var defaultExpiryChoices = [1, 7, 30];
|
|
5428
5598
|
var inputClass = "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm text-foreground";
|
|
5429
5599
|
var buttonClass = "inline-flex items-center justify-center rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50";
|
|
@@ -5477,31 +5647,31 @@ function ApiAccessPanel({
|
|
|
5477
5647
|
onRevoke,
|
|
5478
5648
|
onChanged
|
|
5479
5649
|
}) {
|
|
5480
|
-
const [name, setName] =
|
|
5481
|
-
const [reach, setReach] =
|
|
5650
|
+
const [name, setName] = useState18("");
|
|
5651
|
+
const [reach, setReach] = useState18("");
|
|
5482
5652
|
const selectedWorkspace = workspaces?.some((workspace) => workspace.id === reach) ? reach : "";
|
|
5483
5653
|
const workspaceName = (id) => workspaces?.find((workspace) => workspace.id === id)?.name ?? `A removed ${workspaceNoun.singular}`;
|
|
5484
5654
|
const allowedDays = [...new Set(expiryDays)].filter((days2) => days2 > 0 && Number.isFinite(new Date(Date.now() + days2 * 864e5).getTime()));
|
|
5485
5655
|
const fallbackDays = allowedDays.includes(defaultExpiryDays) ? defaultExpiryDays : allowedDays[0];
|
|
5486
|
-
const [days, setDays] =
|
|
5656
|
+
const [days, setDays] = useState18(fallbackDays);
|
|
5487
5657
|
const selectedDays = days !== void 0 && allowedDays.includes(days) ? days : fallbackDays;
|
|
5488
|
-
const [scopes, setScopes] =
|
|
5489
|
-
const [creating, setCreating] =
|
|
5490
|
-
const [revoking, setRevoking] =
|
|
5491
|
-
const [created, setCreated] =
|
|
5492
|
-
const [notice, setNotice] =
|
|
5493
|
-
const [error, setError] =
|
|
5494
|
-
const keyHeading =
|
|
5495
|
-
const nameInput =
|
|
5496
|
-
const keyWasShown =
|
|
5658
|
+
const [scopes, setScopes] = useState18(() => expandScopes(defaultScopes, access));
|
|
5659
|
+
const [creating, setCreating] = useState18(false);
|
|
5660
|
+
const [revoking, setRevoking] = useState18(null);
|
|
5661
|
+
const [created, setCreated] = useState18(null);
|
|
5662
|
+
const [notice, setNotice] = useState18(null);
|
|
5663
|
+
const [error, setError] = useState18(null);
|
|
5664
|
+
const keyHeading = useRef12(null);
|
|
5665
|
+
const nameInput = useRef12(null);
|
|
5666
|
+
const keyWasShown = useRef12(false);
|
|
5497
5667
|
const selectedScopes = pruneScopes(scopes, access);
|
|
5498
|
-
|
|
5668
|
+
useEffect14(() => {
|
|
5499
5669
|
setScopes((current) => {
|
|
5500
5670
|
const next = pruneScopes(current, access);
|
|
5501
5671
|
return next.length === current.length ? current : next;
|
|
5502
5672
|
});
|
|
5503
5673
|
}, [access]);
|
|
5504
|
-
|
|
5674
|
+
useEffect14(() => {
|
|
5505
5675
|
if (created) {
|
|
5506
5676
|
keyHeading.current?.focus();
|
|
5507
5677
|
keyWasShown.current = true;
|
|
@@ -5547,10 +5717,10 @@ function ApiAccessPanel({
|
|
|
5547
5717
|
setRevoking(null);
|
|
5548
5718
|
}
|
|
5549
5719
|
}
|
|
5550
|
-
return /* @__PURE__ */
|
|
5551
|
-
/* @__PURE__ */
|
|
5552
|
-
accountHref && /* @__PURE__ */
|
|
5553
|
-
/* @__PURE__ */
|
|
5720
|
+
return /* @__PURE__ */ jsx18("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs16("div", { className: "mx-auto max-w-2xl space-y-8 px-4 py-8 sm:px-8", children: [
|
|
5721
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
5722
|
+
accountHref && /* @__PURE__ */ jsx18("a", { href: accountHref, className: "text-sm text-muted-foreground hover:text-foreground", children: "Account" }),
|
|
5723
|
+
/* @__PURE__ */ jsx18(
|
|
5554
5724
|
PageHeader,
|
|
5555
5725
|
{
|
|
5556
5726
|
className: "mb-0",
|
|
@@ -5559,14 +5729,14 @@ function ApiAccessPanel({
|
|
|
5559
5729
|
}
|
|
5560
5730
|
)
|
|
5561
5731
|
] }),
|
|
5562
|
-
error && /* @__PURE__ */
|
|
5563
|
-
notice && /* @__PURE__ */
|
|
5564
|
-
created ? /* @__PURE__ */
|
|
5565
|
-
/* @__PURE__ */
|
|
5566
|
-
/* @__PURE__ */
|
|
5567
|
-
/* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
5569
|
-
/* @__PURE__ */
|
|
5732
|
+
error && /* @__PURE__ */ jsx18("p", { role: "alert", className: "rounded-lg border border-destructive/40 p-3 text-sm text-destructive", children: error }),
|
|
5733
|
+
notice && /* @__PURE__ */ jsx18("p", { role: "status", className: "text-sm text-muted-foreground", children: notice }),
|
|
5734
|
+
created ? /* @__PURE__ */ jsxs16("section", { "aria-labelledby": "save-api-key", className: "space-y-4 rounded-xl border border-border bg-card p-5", children: [
|
|
5735
|
+
/* @__PURE__ */ jsx18("h2", { ref: keyHeading, tabIndex: -1, id: "save-api-key", className: "font-medium outline-none", children: "Save your key" }),
|
|
5736
|
+
/* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: "Copy it directly into your client\u2019s secret storage. It is shown only now. Keep it out of chat messages and prompts." }),
|
|
5737
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-2", children: [
|
|
5738
|
+
/* @__PURE__ */ jsx18("input", { "aria-label": "New API key", type: "password", value: created.key, readOnly: true, autoComplete: "off", className: `${inputClass} min-w-0 font-mono` }),
|
|
5739
|
+
/* @__PURE__ */ jsx18("button", { className: buttonClass, onClick: async () => {
|
|
5570
5740
|
try {
|
|
5571
5741
|
await navigator.clipboard.writeText(created.key);
|
|
5572
5742
|
setNotice("Key copied");
|
|
@@ -5575,46 +5745,46 @@ function ApiAccessPanel({
|
|
|
5575
5745
|
}
|
|
5576
5746
|
}, children: "Copy key" })
|
|
5577
5747
|
] }),
|
|
5578
|
-
/* @__PURE__ */
|
|
5748
|
+
/* @__PURE__ */ jsx18("button", { className: outlineClass, onClick: () => {
|
|
5579
5749
|
setCreated(null);
|
|
5580
5750
|
setNotice(null);
|
|
5581
5751
|
}, children: "I\u2019ve saved it" })
|
|
5582
|
-
] }) : /* @__PURE__ */
|
|
5583
|
-
/* @__PURE__ */
|
|
5584
|
-
/* @__PURE__ */
|
|
5585
|
-
/* @__PURE__ */
|
|
5586
|
-
/* @__PURE__ */
|
|
5587
|
-
/* @__PURE__ */
|
|
5752
|
+
] }) : /* @__PURE__ */ jsxs16("form", { onSubmit: createKey, className: "space-y-5 rounded-xl border border-border bg-card p-5", children: [
|
|
5753
|
+
/* @__PURE__ */ jsx18("h2", { className: "font-medium", children: "Create a key" }),
|
|
5754
|
+
/* @__PURE__ */ jsxs16("div", { className: "grid gap-4 sm:grid-cols-[1fr_10rem]", children: [
|
|
5755
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-1.5", children: [
|
|
5756
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium", htmlFor: "key-name", children: "Name" }),
|
|
5757
|
+
/* @__PURE__ */ jsx18("input", { ref: nameInput, id: "key-name", className: inputClass, value: name, onChange: (event) => setName(event.target.value), placeholder: "Client on my server", maxLength: 100, required: true, autoComplete: "off" })
|
|
5588
5758
|
] }),
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5591
|
-
/* @__PURE__ */
|
|
5759
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-1.5", children: [
|
|
5760
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium", htmlFor: "key-expiry", children: "Expires in" }),
|
|
5761
|
+
/* @__PURE__ */ jsx18("select", { id: "key-expiry", value: selectedDays ?? "", onChange: (event) => setDays(Number(event.target.value)), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: allowedDays.map((days2) => /* @__PURE__ */ jsxs16("option", { value: days2, children: [
|
|
5592
5762
|
days2,
|
|
5593
5763
|
" ",
|
|
5594
5764
|
days2 === 1 ? "day" : "days"
|
|
5595
5765
|
] }, days2)) })
|
|
5596
5766
|
] })
|
|
5597
5767
|
] }),
|
|
5598
|
-
workspaces && workspaces.length > 0 && /* @__PURE__ */
|
|
5599
|
-
/* @__PURE__ */
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
/* @__PURE__ */
|
|
5768
|
+
workspaces && workspaces.length > 0 && /* @__PURE__ */ jsxs16("div", { className: "space-y-1.5", children: [
|
|
5769
|
+
/* @__PURE__ */ jsx18("label", { className: "text-sm font-medium", htmlFor: "key-reach", children: "Reaches" }),
|
|
5770
|
+
/* @__PURE__ */ jsxs16("select", { id: "key-reach", value: selectedWorkspace, onChange: (event) => setReach(event.target.value), className: "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm", children: [
|
|
5771
|
+
/* @__PURE__ */ jsxs16("option", { value: "", children: [
|
|
5602
5772
|
"All ",
|
|
5603
5773
|
workspaceNoun.plural,
|
|
5604
5774
|
", including new ones"
|
|
5605
5775
|
] }),
|
|
5606
|
-
workspaces.map((workspace) => /* @__PURE__ */
|
|
5776
|
+
workspaces.map((workspace) => /* @__PURE__ */ jsxs16("option", { value: workspace.id, children: [
|
|
5607
5777
|
"Only ",
|
|
5608
5778
|
workspace.name
|
|
5609
5779
|
] }, workspace.id))
|
|
5610
5780
|
] })
|
|
5611
5781
|
] }),
|
|
5612
|
-
/* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5782
|
+
/* @__PURE__ */ jsxs16("fieldset", { className: "space-y-3", children: [
|
|
5783
|
+
/* @__PURE__ */ jsx18("legend", { className: "mb-3 text-sm font-medium", children: "Permissions" }),
|
|
5614
5784
|
access.map((option) => {
|
|
5615
5785
|
const unavailable = !expandScopes([option.scope], access).includes(option.scope);
|
|
5616
|
-
return /* @__PURE__ */
|
|
5617
|
-
/* @__PURE__ */
|
|
5786
|
+
return /* @__PURE__ */ jsxs16("label", { className: "flex cursor-pointer items-start gap-3", children: [
|
|
5787
|
+
/* @__PURE__ */ jsx18(
|
|
5618
5788
|
"input",
|
|
5619
5789
|
{
|
|
5620
5790
|
type: "checkbox",
|
|
@@ -5624,42 +5794,42 @@ function ApiAccessPanel({
|
|
|
5624
5794
|
onChange: (event) => setScopes((current) => event.target.checked ? expandScopes([...current, option.scope], access) : pruneScopes(current.filter((scope) => scope !== option.scope), access))
|
|
5625
5795
|
}
|
|
5626
5796
|
),
|
|
5627
|
-
/* @__PURE__ */
|
|
5628
|
-
/* @__PURE__ */
|
|
5629
|
-
/* @__PURE__ */
|
|
5630
|
-
unavailable && /* @__PURE__ */
|
|
5797
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-sm", children: [
|
|
5798
|
+
/* @__PURE__ */ jsx18("span", { className: "block font-medium", children: option.label }),
|
|
5799
|
+
/* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: option.description }),
|
|
5800
|
+
unavailable && /* @__PURE__ */ jsx18("span", { className: "block text-muted-foreground", children: "Required permission unavailable." })
|
|
5631
5801
|
] })
|
|
5632
5802
|
] }, option.scope);
|
|
5633
5803
|
})
|
|
5634
5804
|
] }),
|
|
5635
|
-
limitsDescription && /* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5805
|
+
limitsDescription && /* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: limitsDescription }),
|
|
5806
|
+
/* @__PURE__ */ jsx18("button", { className: buttonClass, type: "submit", disabled: creating || !name.trim() || !selectedScopes.length || selectedDays === void 0, children: creating ? "Creating\u2026" : "Create key" })
|
|
5637
5807
|
] }),
|
|
5638
|
-
/* @__PURE__ */
|
|
5639
|
-
/* @__PURE__ */
|
|
5640
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
5641
|
-
/* @__PURE__ */
|
|
5642
|
-
/* @__PURE__ */
|
|
5643
|
-
/* @__PURE__ */
|
|
5644
|
-
/* @__PURE__ */
|
|
5645
|
-
workspaces && /* @__PURE__ */
|
|
5808
|
+
/* @__PURE__ */ jsxs16("section", { "aria-labelledby": "existing-keys", className: "space-y-3", children: [
|
|
5809
|
+
/* @__PURE__ */ jsx18("h2", { id: "existing-keys", className: "font-medium", children: "Your keys" }),
|
|
5810
|
+
keys.length === 0 ? /* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: "No keys yet." }) : /* @__PURE__ */ jsx18("ul", { className: "divide-y divide-border rounded-xl border border-border bg-card", children: keys.map((key) => /* @__PURE__ */ jsxs16("li", { className: "flex items-start justify-between gap-3 p-4", children: [
|
|
5811
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 space-y-1", children: [
|
|
5812
|
+
/* @__PURE__ */ jsx18("p", { className: "break-words text-sm font-medium", children: key.name }),
|
|
5813
|
+
/* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: key.expiresAt ? `${new Date(key.expiresAt).getTime() <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleDateString()}` : "No expiry" }),
|
|
5814
|
+
/* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: key.scopes.map((scope) => access.find((access2) => access2.scope === scope)?.label ?? scope).join(" \xB7 ") }),
|
|
5815
|
+
workspaces && /* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: key.workspaceIds?.length ? `Only ${key.workspaceIds.map(workspaceName).join(", ")}` : `All ${workspaceNoun.plural}` })
|
|
5646
5816
|
] }),
|
|
5647
|
-
/* @__PURE__ */
|
|
5817
|
+
/* @__PURE__ */ jsx18("button", { className: outlineClass, disabled: revoking !== null, onClick: () => revokeKey(key.id), "aria-label": `Revoke ${key.name}`, children: revoking === key.id ? "Revoking\u2026" : "Revoke" })
|
|
5648
5818
|
] }, key.id)) })
|
|
5649
5819
|
] }),
|
|
5650
|
-
/* @__PURE__ */
|
|
5820
|
+
/* @__PURE__ */ jsxs16("p", { className: "text-sm text-muted-foreground", children: [
|
|
5651
5821
|
"Use ",
|
|
5652
|
-
/* @__PURE__ */
|
|
5822
|
+
/* @__PURE__ */ jsx18("code", { className: "text-sm", children: baseUrl }),
|
|
5653
5823
|
" as the API base and send the key as a Bearer credential."
|
|
5654
5824
|
] })
|
|
5655
5825
|
] }) });
|
|
5656
5826
|
}
|
|
5657
5827
|
|
|
5658
5828
|
// src/web-react/agent-setup-block.tsx
|
|
5659
|
-
import { useState as
|
|
5660
|
-
import { jsx as
|
|
5829
|
+
import { useState as useState19 } from "react";
|
|
5830
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5661
5831
|
function AgentSetupBlock({ productName, setupUrl, markdown, className }) {
|
|
5662
|
-
const [notice, setNotice] =
|
|
5832
|
+
const [notice, setNotice] = useState19(null);
|
|
5663
5833
|
const prompt = markdown ?? `Set up ${productName} for me. Fetch ${setupUrl} and follow every step in it.`;
|
|
5664
5834
|
async function copy() {
|
|
5665
5835
|
try {
|
|
@@ -5669,15 +5839,15 @@ function AgentSetupBlock({ productName, setupUrl, markdown, className }) {
|
|
|
5669
5839
|
setNotice(`Clipboard unavailable. Open ${setupUrl} and copy it from there.`);
|
|
5670
5840
|
}
|
|
5671
5841
|
}
|
|
5672
|
-
return /* @__PURE__ */
|
|
5842
|
+
return /* @__PURE__ */ jsxs17(
|
|
5673
5843
|
"section",
|
|
5674
5844
|
{
|
|
5675
5845
|
"aria-labelledby": "agent-setup-heading",
|
|
5676
5846
|
className: `space-y-3 rounded-xl border border-border bg-card p-5 ${className ?? ""}`.trim(),
|
|
5677
5847
|
children: [
|
|
5678
|
-
/* @__PURE__ */
|
|
5679
|
-
/* @__PURE__ */
|
|
5680
|
-
/* @__PURE__ */
|
|
5848
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-wrap items-center justify-between gap-3", children: [
|
|
5849
|
+
/* @__PURE__ */ jsx19("h2", { id: "agent-setup-heading", className: "font-medium text-foreground", children: "Hand this to your agent" }),
|
|
5850
|
+
/* @__PURE__ */ jsx19(
|
|
5681
5851
|
"button",
|
|
5682
5852
|
{
|
|
5683
5853
|
type: "button",
|
|
@@ -5687,17 +5857,17 @@ function AgentSetupBlock({ productName, setupUrl, markdown, className }) {
|
|
|
5687
5857
|
}
|
|
5688
5858
|
)
|
|
5689
5859
|
] }),
|
|
5690
|
-
/* @__PURE__ */
|
|
5860
|
+
/* @__PURE__ */ jsxs17("p", { className: "text-sm text-muted-foreground", children: [
|
|
5691
5861
|
"Your coding agent sets up ",
|
|
5692
5862
|
productName,
|
|
5693
5863
|
" end to end: it asks you to approve once, gets its own capped key, installs the client, and verifies a first call."
|
|
5694
5864
|
] }),
|
|
5695
|
-
/* @__PURE__ */
|
|
5865
|
+
/* @__PURE__ */ jsxs17("p", { className: "text-sm text-muted-foreground", children: [
|
|
5696
5866
|
"Raw prompt:",
|
|
5697
5867
|
" ",
|
|
5698
|
-
/* @__PURE__ */
|
|
5868
|
+
/* @__PURE__ */ jsx19("a", { href: setupUrl, className: "font-mono text-foreground underline", children: setupUrl })
|
|
5699
5869
|
] }),
|
|
5700
|
-
notice ? /* @__PURE__ */
|
|
5870
|
+
notice ? /* @__PURE__ */ jsx19("p", { role: "status", className: "text-sm text-foreground", children: notice }) : null
|
|
5701
5871
|
]
|
|
5702
5872
|
}
|
|
5703
5873
|
);
|
|
@@ -5705,37 +5875,37 @@ function AgentSetupBlock({ productName, setupUrl, markdown, className }) {
|
|
|
5705
5875
|
|
|
5706
5876
|
// src/web-react/agent-profile-choices.tsx
|
|
5707
5877
|
import { useId as useId4 } from "react";
|
|
5708
|
-
import { jsx as
|
|
5878
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5709
5879
|
function AgentProfileChoices({ value, profiles, onChange, disabled, locked, lockReason, onNewChat, label = "Agent profile" }) {
|
|
5710
5880
|
const name = useId4();
|
|
5711
5881
|
const selected = profiles.find((profile) => profile.id === value);
|
|
5712
5882
|
if (locked) {
|
|
5713
|
-
return /* @__PURE__ */
|
|
5714
|
-
/* @__PURE__ */
|
|
5715
|
-
/* @__PURE__ */
|
|
5716
|
-
onNewChat && !disabled && /* @__PURE__ */
|
|
5883
|
+
return /* @__PURE__ */ jsxs18("div", { className: "space-y-2 rounded-lg border border-border p-3 text-sm", children: [
|
|
5884
|
+
/* @__PURE__ */ jsx20("p", { className: "font-medium text-foreground", children: selected?.name ?? value }),
|
|
5885
|
+
/* @__PURE__ */ jsx20("p", { className: "text-muted-foreground", children: lockReason ?? "This conversation stays on its current profile." }),
|
|
5886
|
+
onNewChat && !disabled && /* @__PURE__ */ jsx20("button", { type: "button", onClick: onNewChat, className: "text-sm font-medium text-primary underline underline-offset-4", children: "New chat to switch profile" })
|
|
5717
5887
|
] });
|
|
5718
5888
|
}
|
|
5719
|
-
return /* @__PURE__ */
|
|
5720
|
-
/* @__PURE__ */
|
|
5721
|
-
/* @__PURE__ */
|
|
5722
|
-
profiles.map((profile) => /* @__PURE__ */
|
|
5723
|
-
/* @__PURE__ */
|
|
5889
|
+
return /* @__PURE__ */ jsxs18("fieldset", { disabled, className: "min-w-0 space-y-1", children: [
|
|
5890
|
+
/* @__PURE__ */ jsx20("legend", { className: "sr-only", children: label }),
|
|
5891
|
+
/* @__PURE__ */ jsxs18("div", { className: "max-h-48 space-y-1 overflow-y-auto", children: [
|
|
5892
|
+
profiles.map((profile) => /* @__PURE__ */ jsxs18("label", { className: "flex min-h-10 cursor-pointer items-start gap-2 rounded-lg border border-transparent p-2 text-sm hover:bg-muted has-[:checked]:border-border has-[:checked]:bg-muted has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-60", children: [
|
|
5893
|
+
/* @__PURE__ */ jsx20("input", { type: "radio", name, value: profile.id, checked: profile.id === value, disabled, onChange: () => {
|
|
5724
5894
|
if (!disabled) onChange(profile.id);
|
|
5725
5895
|
}, className: "mt-1 shrink-0 accent-primary" }),
|
|
5726
|
-
/* @__PURE__ */
|
|
5727
|
-
/* @__PURE__ */
|
|
5728
|
-
profile.description && /* @__PURE__ */
|
|
5896
|
+
/* @__PURE__ */ jsxs18("span", { className: "min-w-0", children: [
|
|
5897
|
+
/* @__PURE__ */ jsx20("span", { className: "block font-medium text-foreground", children: profile.name }),
|
|
5898
|
+
profile.description && /* @__PURE__ */ jsx20("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: profile.description })
|
|
5729
5899
|
] })
|
|
5730
5900
|
] }, profile.id)),
|
|
5731
|
-
profiles.length === 0 && /* @__PURE__ */
|
|
5901
|
+
profiles.length === 0 && /* @__PURE__ */ jsx20("p", { role: "status", className: "p-2 text-sm text-muted-foreground", children: "No profiles available." })
|
|
5732
5902
|
] })
|
|
5733
5903
|
] });
|
|
5734
5904
|
}
|
|
5735
5905
|
|
|
5736
5906
|
// src/web-react/composer-profile-pill.tsx
|
|
5737
5907
|
import { AgentProfilePicker } from "@tangle-network/sandbox-ui/chat";
|
|
5738
|
-
import { jsx as
|
|
5908
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
5739
5909
|
var TRIGGER = {
|
|
5740
5910
|
composer: "max-w-[180px]",
|
|
5741
5911
|
// A menu panel repoints surface-container to its own tone, which would leave
|
|
@@ -5758,7 +5928,7 @@ function ComposerProfilePill({
|
|
|
5758
5928
|
placement = "composer",
|
|
5759
5929
|
className
|
|
5760
5930
|
}) {
|
|
5761
|
-
return /* @__PURE__ */
|
|
5931
|
+
return /* @__PURE__ */ jsx21(
|
|
5762
5932
|
AgentProfilePicker,
|
|
5763
5933
|
{
|
|
5764
5934
|
value: selection.value,
|
|
@@ -5780,7 +5950,7 @@ function ComposerProfilePill({
|
|
|
5780
5950
|
}
|
|
5781
5951
|
|
|
5782
5952
|
// src/web-react/index.tsx
|
|
5783
|
-
import { Fragment as Fragment6, jsx as
|
|
5953
|
+
import { Fragment as Fragment6, jsx as jsx22, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5784
5954
|
function formatModelCost(msg, models) {
|
|
5785
5955
|
if (msg.promptTokens == null && msg.completionTokens == null) return null;
|
|
5786
5956
|
const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
|
|
@@ -5789,51 +5959,46 @@ function formatModelCost(msg, models) {
|
|
|
5789
5959
|
if (!isFinite(cost) || cost <= 0) return null;
|
|
5790
5960
|
return cost < 0.01 ? `$${cost.toFixed(4)}` : `$${cost.toFixed(2)}`;
|
|
5791
5961
|
}
|
|
5792
|
-
function reasoningPreview(reasoning) {
|
|
5793
|
-
const flat = reasoning.replace(/\s+/g, " ").trim();
|
|
5794
|
-
if (!flat) return void 0;
|
|
5795
|
-
return flat.length > 120 ? `${flat.slice(0, 119)}\u2026` : flat;
|
|
5796
|
-
}
|
|
5797
5962
|
function formatTokensPerSecond(msg) {
|
|
5798
5963
|
if (msg.completionTokens == null || !msg.durationMs) return null;
|
|
5799
5964
|
return `${Math.round(msg.completionTokens / (msg.durationMs / 1e3))} tok/s`;
|
|
5800
5965
|
}
|
|
5801
5966
|
function RunDrillIn({ run, onClose }) {
|
|
5802
|
-
return /* @__PURE__ */
|
|
5803
|
-
/* @__PURE__ */
|
|
5804
|
-
/* @__PURE__ */
|
|
5967
|
+
return /* @__PURE__ */ jsxs19("div", { className: `fixed inset-y-0 right-0 z-50 flex w-[480px] max-w-full flex-col border-l border-card-edge bg-popover ${OVERLAY_SHADOW}`, children: [
|
|
5968
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
5969
|
+
/* @__PURE__ */ jsx22(
|
|
5805
5970
|
"span",
|
|
5806
5971
|
{
|
|
5807
5972
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
5808
5973
|
}
|
|
5809
5974
|
),
|
|
5810
|
-
/* @__PURE__ */
|
|
5811
|
-
/* @__PURE__ */
|
|
5812
|
-
/* @__PURE__ */
|
|
5975
|
+
/* @__PURE__ */ jsxs19("div", { className: "min-w-0 flex-1", children: [
|
|
5976
|
+
/* @__PURE__ */ jsx22("p", { className: "truncate text-[15px] font-semibold", children: run.title }),
|
|
5977
|
+
/* @__PURE__ */ jsx22("p", { className: "truncate font-mono text-xs text-muted-foreground", children: run.toolName })
|
|
5813
5978
|
] }),
|
|
5814
|
-
/* @__PURE__ */
|
|
5979
|
+
/* @__PURE__ */ jsx22(
|
|
5815
5980
|
"button",
|
|
5816
5981
|
{
|
|
5817
5982
|
type: "button",
|
|
5818
5983
|
onClick: onClose,
|
|
5819
5984
|
"aria-label": "Close",
|
|
5820
5985
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
5821
|
-
children: /* @__PURE__ */
|
|
5986
|
+
children: /* @__PURE__ */ jsx22("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx22("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
5822
5987
|
}
|
|
5823
5988
|
)
|
|
5824
5989
|
] }),
|
|
5825
|
-
/* @__PURE__ */
|
|
5826
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
5827
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
5828
|
-
/* @__PURE__ */
|
|
5829
|
-
/* @__PURE__ */
|
|
5830
|
-
/* @__PURE__ */
|
|
5831
|
-
/* @__PURE__ */
|
|
5990
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
5991
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
5992
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs19("div", { className: "rounded-lg border border-card-edge bg-card", children: [
|
|
5993
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5", children: [
|
|
5994
|
+
/* @__PURE__ */ jsx22("span", { className: `font-mono text-xs ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
5995
|
+
/* @__PURE__ */ jsx22("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
5996
|
+
/* @__PURE__ */ jsx22("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: new Date(step.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) })
|
|
5832
5997
|
] }),
|
|
5833
|
-
step.detail && /* @__PURE__ */
|
|
5998
|
+
step.detail && /* @__PURE__ */ jsx22("pre", { className: "max-h-48 overflow-auto whitespace-pre-wrap px-3 py-2 font-mono text-xs leading-relaxed text-muted-foreground", children: step.detail })
|
|
5834
5999
|
] }, i))
|
|
5835
6000
|
] }),
|
|
5836
|
-
/* @__PURE__ */
|
|
6001
|
+
/* @__PURE__ */ jsx22("p", { className: "border-t border-border px-4 py-2 text-xs text-muted-foreground", children: "Read-only transcript \u2014 reply in the main chat." })
|
|
5837
6002
|
] });
|
|
5838
6003
|
}
|
|
5839
6004
|
function pendingApprovalOf(call) {
|
|
@@ -5849,23 +6014,23 @@ function ChatEmptyState({
|
|
|
5849
6014
|
}) {
|
|
5850
6015
|
const doorCount = Math.min(doors?.length ?? 0, 3);
|
|
5851
6016
|
const doorsGridClass = doorCount === 1 ? "mx-auto max-w-sm sm:grid-cols-1" : doorCount === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3";
|
|
5852
|
-
return /* @__PURE__ */
|
|
5853
|
-
/* @__PURE__ */
|
|
5854
|
-
/* @__PURE__ */
|
|
5855
|
-
/* @__PURE__ */
|
|
5856
|
-
subline && /* @__PURE__ */
|
|
5857
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
6017
|
+
return /* @__PURE__ */ jsxs19("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
6018
|
+
/* @__PURE__ */ jsx22("span", { className: "mb-5 inline-flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 ring-1 ring-primary/15", children: /* @__PURE__ */ jsx22(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
6019
|
+
/* @__PURE__ */ jsx22("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: productName }),
|
|
6020
|
+
/* @__PURE__ */ jsx22("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground", children: headline }),
|
|
6021
|
+
subline && /* @__PURE__ */ jsx22("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
6022
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx22("div", { className: `mt-7 grid w-full gap-2.5 ${doorsGridClass}`, children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs19(
|
|
5858
6023
|
"button",
|
|
5859
6024
|
{
|
|
5860
6025
|
type: "button",
|
|
5861
6026
|
onClick: door.onSelect,
|
|
5862
6027
|
className: "group flex min-h-[44px] flex-col items-start rounded-xl border border-border bg-card px-4 py-3 text-left transition hover:border-primary/40 hover:bg-accent",
|
|
5863
6028
|
children: [
|
|
5864
|
-
/* @__PURE__ */
|
|
6029
|
+
/* @__PURE__ */ jsxs19("span", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
5865
6030
|
door.icon,
|
|
5866
6031
|
door.label
|
|
5867
6032
|
] }),
|
|
5868
|
-
door.description && /* @__PURE__ */
|
|
6033
|
+
door.description && /* @__PURE__ */ jsx22("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
5869
6034
|
]
|
|
5870
6035
|
},
|
|
5871
6036
|
i
|
|
@@ -5874,26 +6039,26 @@ function ChatEmptyState({
|
|
|
5874
6039
|
}
|
|
5875
6040
|
function ToolGlyph({ name, className }) {
|
|
5876
6041
|
if (name.startsWith("sandbox_")) {
|
|
5877
|
-
return /* @__PURE__ */
|
|
5878
|
-
/* @__PURE__ */
|
|
5879
|
-
/* @__PURE__ */
|
|
6042
|
+
return /* @__PURE__ */ jsxs19("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6043
|
+
/* @__PURE__ */ jsx22("polyline", { points: "4 17 10 11 4 5" }),
|
|
6044
|
+
/* @__PURE__ */ jsx22("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
5880
6045
|
] });
|
|
5881
6046
|
}
|
|
5882
6047
|
if (name === "submit_proposal") {
|
|
5883
|
-
return /* @__PURE__ */
|
|
5884
|
-
/* @__PURE__ */
|
|
5885
|
-
/* @__PURE__ */
|
|
6048
|
+
return /* @__PURE__ */ jsxs19("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6049
|
+
/* @__PURE__ */ jsx22("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
6050
|
+
/* @__PURE__ */ jsx22("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
5886
6051
|
] });
|
|
5887
6052
|
}
|
|
5888
6053
|
if (name === "schedule_followup") {
|
|
5889
|
-
return /* @__PURE__ */
|
|
5890
|
-
/* @__PURE__ */
|
|
5891
|
-
/* @__PURE__ */
|
|
6054
|
+
return /* @__PURE__ */ jsxs19("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
6055
|
+
/* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "9" }),
|
|
6056
|
+
/* @__PURE__ */ jsx22("path", { d: "M12 7v5l3 3" })
|
|
5892
6057
|
] });
|
|
5893
6058
|
}
|
|
5894
|
-
return /* @__PURE__ */
|
|
5895
|
-
/* @__PURE__ */
|
|
5896
|
-
/* @__PURE__ */
|
|
6059
|
+
return /* @__PURE__ */ jsxs19("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6060
|
+
/* @__PURE__ */ jsx22("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
6061
|
+
/* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "4" })
|
|
5897
6062
|
] });
|
|
5898
6063
|
}
|
|
5899
6064
|
function toolOutcomeOf(call) {
|
|
@@ -5979,40 +6144,40 @@ function truncate(v, max = 240) {
|
|
|
5979
6144
|
function KvRows({ data }) {
|
|
5980
6145
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
5981
6146
|
if (!entries.length) return null;
|
|
5982
|
-
return /* @__PURE__ */
|
|
5983
|
-
/* @__PURE__ */
|
|
5984
|
-
/* @__PURE__ */
|
|
6147
|
+
return /* @__PURE__ */ jsx22("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs19("div", { className: "contents", children: [
|
|
6148
|
+
/* @__PURE__ */ jsx22("dt", { className: "font-mono text-xs text-muted-foreground", children: k }),
|
|
6149
|
+
/* @__PURE__ */ jsx22("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", children: truncate(v) })
|
|
5985
6150
|
] }, k)) });
|
|
5986
6151
|
}
|
|
5987
6152
|
function ShellDetail({ call }) {
|
|
5988
6153
|
const outcome = toolOutcomeOf(call);
|
|
5989
6154
|
const r = outcome?.result ?? {};
|
|
5990
|
-
return /* @__PURE__ */
|
|
5991
|
-
/* @__PURE__ */
|
|
5992
|
-
/* @__PURE__ */
|
|
5993
|
-
/* @__PURE__ */
|
|
5994
|
-
r.exitCode != null && /* @__PURE__ */
|
|
6155
|
+
return /* @__PURE__ */ jsxs19("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-xs leading-relaxed", children: [
|
|
6156
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
|
|
6157
|
+
/* @__PURE__ */ jsx22("span", { className: "select-none text-zinc-500", children: "$" }),
|
|
6158
|
+
/* @__PURE__ */ jsx22("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
|
|
6159
|
+
r.exitCode != null && /* @__PURE__ */ jsxs19("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
|
|
5995
6160
|
"exit ",
|
|
5996
6161
|
r.exitCode
|
|
5997
6162
|
] })
|
|
5998
6163
|
] }),
|
|
5999
|
-
/* @__PURE__ */
|
|
6164
|
+
/* @__PURE__ */ jsx22("pre", { className: "max-h-56 overflow-auto whitespace-pre-wrap px-3 pb-2.5 pt-1.5 text-zinc-300", children: outcome?.ok === false ? outcome.message ?? "failed" : [r.stdout, r.stderr].filter(Boolean).join("\n") || "(no output)" })
|
|
6000
6165
|
] });
|
|
6001
6166
|
}
|
|
6002
6167
|
function DefaultToolDetail({ call }) {
|
|
6003
6168
|
const result = call.result;
|
|
6004
6169
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
6005
|
-
return /* @__PURE__ */
|
|
6006
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
6007
|
-
/* @__PURE__ */
|
|
6008
|
-
/* @__PURE__ */
|
|
6170
|
+
return /* @__PURE__ */ jsxs19("div", { className: "space-y-2", children: [
|
|
6171
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs19("div", { children: [
|
|
6172
|
+
/* @__PURE__ */ jsx22("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
6173
|
+
/* @__PURE__ */ jsx22(KvRows, { data: call.args })
|
|
6009
6174
|
] }),
|
|
6010
|
-
envelope ? /* @__PURE__ */
|
|
6011
|
-
/* @__PURE__ */
|
|
6012
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
6013
|
-
] }) : result != null ? /* @__PURE__ */
|
|
6014
|
-
/* @__PURE__ */
|
|
6015
|
-
/* @__PURE__ */
|
|
6175
|
+
envelope ? /* @__PURE__ */ jsxs19("div", { children: [
|
|
6176
|
+
/* @__PURE__ */ jsx22("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
6177
|
+
envelope.ok === false ? /* @__PURE__ */ jsx22("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx22(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx22("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
6178
|
+
] }) : result != null ? /* @__PURE__ */ jsxs19("div", { children: [
|
|
6179
|
+
/* @__PURE__ */ jsx22("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
6180
|
+
/* @__PURE__ */ jsx22("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(result) })
|
|
6016
6181
|
] }) : null
|
|
6017
6182
|
] });
|
|
6018
6183
|
}
|
|
@@ -6023,24 +6188,24 @@ function ProposalCard({
|
|
|
6023
6188
|
approval,
|
|
6024
6189
|
renderers
|
|
6025
6190
|
}) {
|
|
6026
|
-
const [expanded, setExpanded] =
|
|
6191
|
+
const [expanded, setExpanded] = useState20(false);
|
|
6027
6192
|
const { summary, meta, typeSlug } = proposalPreview(call);
|
|
6028
6193
|
const custom = renderers?.[call.name]?.(call, message);
|
|
6029
6194
|
const { pending: deciding, run: decide } = usePending();
|
|
6030
|
-
return /* @__PURE__ */
|
|
6031
|
-
/* @__PURE__ */
|
|
6032
|
-
/* @__PURE__ */
|
|
6033
|
-
/* @__PURE__ */
|
|
6034
|
-
/* @__PURE__ */
|
|
6035
|
-
/* @__PURE__ */
|
|
6036
|
-
summary && /* @__PURE__ */
|
|
6037
|
-
typeSlug && /* @__PURE__ */
|
|
6038
|
-
meta.length > 0 && /* @__PURE__ */
|
|
6195
|
+
return /* @__PURE__ */ jsxs19("div", { className: "w-full max-w-full rounded-xl border border-warning/50 bg-warning/[0.06] text-sm shadow-sm ring-1 ring-warning/10", children: [
|
|
6196
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
6197
|
+
/* @__PURE__ */ jsx22("span", { className: "mt-0.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-warning/15 text-warning", children: /* @__PURE__ */ jsx22(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
6198
|
+
/* @__PURE__ */ jsxs19("div", { className: "min-w-0 flex-1", children: [
|
|
6199
|
+
/* @__PURE__ */ jsx22("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-warning-strong", children: approval ? "Needs your approval" : "Awaiting approval" }),
|
|
6200
|
+
/* @__PURE__ */ jsx22("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
6201
|
+
summary && /* @__PURE__ */ jsx22("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
6202
|
+
typeSlug && /* @__PURE__ */ jsx22("p", { className: "mt-1 font-mono text-xs text-muted-foreground", children: typeSlug }),
|
|
6203
|
+
meta.length > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx22("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-muted-foreground", children: m }, i)) })
|
|
6039
6204
|
] })
|
|
6040
6205
|
] }),
|
|
6041
|
-
/* @__PURE__ */
|
|
6042
|
-
approval && /* @__PURE__ */
|
|
6043
|
-
/* @__PURE__ */
|
|
6206
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
6207
|
+
approval && /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
6208
|
+
/* @__PURE__ */ jsx22(
|
|
6044
6209
|
"button",
|
|
6045
6210
|
{
|
|
6046
6211
|
type: "button",
|
|
@@ -6050,7 +6215,7 @@ function ProposalCard({
|
|
|
6050
6215
|
children: "Approve & run"
|
|
6051
6216
|
}
|
|
6052
6217
|
),
|
|
6053
|
-
/* @__PURE__ */
|
|
6218
|
+
/* @__PURE__ */ jsx22(
|
|
6054
6219
|
"button",
|
|
6055
6220
|
{
|
|
6056
6221
|
type: "button",
|
|
@@ -6061,7 +6226,7 @@ function ProposalCard({
|
|
|
6061
6226
|
}
|
|
6062
6227
|
)
|
|
6063
6228
|
] }),
|
|
6064
|
-
/* @__PURE__ */
|
|
6229
|
+
/* @__PURE__ */ jsxs19(
|
|
6065
6230
|
"button",
|
|
6066
6231
|
{
|
|
6067
6232
|
type: "button",
|
|
@@ -6070,12 +6235,12 @@ function ProposalCard({
|
|
|
6070
6235
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
6071
6236
|
children: [
|
|
6072
6237
|
expanded ? "Hide details" : "View details",
|
|
6073
|
-
/* @__PURE__ */
|
|
6238
|
+
/* @__PURE__ */ jsx22(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
6074
6239
|
]
|
|
6075
6240
|
}
|
|
6076
6241
|
)
|
|
6077
6242
|
] }),
|
|
6078
|
-
expanded && /* @__PURE__ */
|
|
6243
|
+
expanded && /* @__PURE__ */ jsx22("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx22(DefaultToolDetail, { call }) })
|
|
6079
6244
|
] });
|
|
6080
6245
|
}
|
|
6081
6246
|
function formatFollowupWhen(when) {
|
|
@@ -6090,14 +6255,14 @@ function FollowupCard({ call }) {
|
|
|
6090
6255
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
6091
6256
|
const failed = toolCallFailed(call);
|
|
6092
6257
|
const errorText = failed ? toolOutcomeOf(call)?.message ?? "Scheduling failed" : null;
|
|
6093
|
-
return /* @__PURE__ */
|
|
6094
|
-
/* @__PURE__ */
|
|
6095
|
-
/* @__PURE__ */
|
|
6096
|
-
/* @__PURE__ */
|
|
6097
|
-
when && /* @__PURE__ */
|
|
6098
|
-
/* @__PURE__ */
|
|
6258
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxs19("div", { className: "min-w-0 flex-1 overflow-hidden rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--md3-surface-container)]", children: [
|
|
6259
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex w-full items-center gap-2.5 px-3 py-2", children: [
|
|
6260
|
+
/* @__PURE__ */ jsx22("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-[var(--radius-sm)] border border-border bg-muted text-muted-foreground", children: /* @__PURE__ */ jsx22(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
6261
|
+
/* @__PURE__ */ jsx22("span", { className: "shrink-0 whitespace-nowrap text-xs font-medium text-foreground", children: friendlyToolTitle(call) }),
|
|
6262
|
+
when && /* @__PURE__ */ jsx22("span", { title: when, className: "hidden min-w-0 flex-1 truncate font-mono text-xs tabular-nums text-muted-foreground sm:inline", children: formatFollowupWhen(when) }),
|
|
6263
|
+
/* @__PURE__ */ jsx22("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: call.status === "running" ? /* @__PURE__ */ jsx22("svg", { className: "h-3 w-3 shrink-0 animate-spin text-[var(--accent-text)]", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx22("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }) : /* @__PURE__ */ jsx22("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${failed ? "bg-[var(--surface-danger-text)]" : "bg-[var(--surface-success-text)]"}` }) })
|
|
6099
6264
|
] }),
|
|
6100
|
-
errorText && /* @__PURE__ */
|
|
6265
|
+
errorText && /* @__PURE__ */ jsx22("div", { className: "border-t border-border px-3 py-2 text-xs text-[var(--surface-danger-text)]", children: errorText })
|
|
6101
6266
|
] }) });
|
|
6102
6267
|
}
|
|
6103
6268
|
function toolRowTitle(call) {
|
|
@@ -6120,10 +6285,10 @@ function ToolCallCard({
|
|
|
6120
6285
|
const arrival = useArrivalStyle(staggerIndex ?? 0);
|
|
6121
6286
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
6122
6287
|
const kind = blockKindOf(call);
|
|
6123
|
-
const arrive = (row) => /* @__PURE__ */
|
|
6288
|
+
const arrive = (row) => /* @__PURE__ */ jsx22("div", { className: "agent-arrive", style: arrival, children: row });
|
|
6124
6289
|
if (pending) {
|
|
6125
6290
|
return arrive(
|
|
6126
|
-
/* @__PURE__ */
|
|
6291
|
+
/* @__PURE__ */ jsx22(
|
|
6127
6292
|
ProposalCard,
|
|
6128
6293
|
{
|
|
6129
6294
|
call,
|
|
@@ -6136,18 +6301,18 @@ function ToolCallCard({
|
|
|
6136
6301
|
);
|
|
6137
6302
|
}
|
|
6138
6303
|
if (kind === "followup") {
|
|
6139
|
-
return arrive(/* @__PURE__ */
|
|
6304
|
+
return arrive(/* @__PURE__ */ jsx22(FollowupCard, { call }));
|
|
6140
6305
|
}
|
|
6141
6306
|
const custom = renderers?.[call.name]?.(call, message);
|
|
6142
6307
|
return arrive(
|
|
6143
|
-
/* @__PURE__ */
|
|
6308
|
+
/* @__PURE__ */ jsx22(
|
|
6144
6309
|
InlineToolItem,
|
|
6145
6310
|
{
|
|
6146
6311
|
part: chatToolCallPart(call),
|
|
6147
6312
|
title: toolRowTitle(call),
|
|
6148
6313
|
description: toolRowDescription(call),
|
|
6149
|
-
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
6150
|
-
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */
|
|
6314
|
+
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx22(ShellDetail, { call }) : /* @__PURE__ */ jsx22(DefaultToolDetail, { call })),
|
|
6315
|
+
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */ jsx22(
|
|
6151
6316
|
"button",
|
|
6152
6317
|
{
|
|
6153
6318
|
type: "button",
|
|
@@ -6155,9 +6320,9 @@ function ToolCallCard({
|
|
|
6155
6320
|
"aria-label": "Open full transcript",
|
|
6156
6321
|
title: "Open full transcript",
|
|
6157
6322
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
6158
|
-
children: /* @__PURE__ */
|
|
6159
|
-
/* @__PURE__ */
|
|
6160
|
-
/* @__PURE__ */
|
|
6323
|
+
children: /* @__PURE__ */ jsxs19("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6324
|
+
/* @__PURE__ */ jsx22("path", { d: "M7 17 17 7" }),
|
|
6325
|
+
/* @__PURE__ */ jsx22("path", { d: "M7 7h10v10" })
|
|
6161
6326
|
] })
|
|
6162
6327
|
}
|
|
6163
6328
|
) : void 0
|
|
@@ -6166,7 +6331,7 @@ function ToolCallCard({
|
|
|
6166
6331
|
);
|
|
6167
6332
|
}
|
|
6168
6333
|
function StreamingCaret() {
|
|
6169
|
-
return /* @__PURE__ */
|
|
6334
|
+
return /* @__PURE__ */ jsx22(
|
|
6170
6335
|
"span",
|
|
6171
6336
|
{
|
|
6172
6337
|
className: "ml-0.5 inline-block h-[1.1em] w-[3px] translate-y-[2px] animate-[agent-caret_1s_step-end_infinite] rounded-sm bg-foreground/70",
|
|
@@ -6183,7 +6348,7 @@ function SegmentText({
|
|
|
6183
6348
|
messageClassName
|
|
6184
6349
|
}) {
|
|
6185
6350
|
const text = useSmoothText(content, streaming);
|
|
6186
|
-
const body =
|
|
6351
|
+
const body = useMemo8(() => renderBody(text), [renderBody, text]);
|
|
6187
6352
|
if (!content.trim() && !showCaret) return null;
|
|
6188
6353
|
return (
|
|
6189
6354
|
// A settled run arrives from a short blur; the LIVE run does not, because
|
|
@@ -6191,9 +6356,9 @@ function SegmentText({
|
|
|
6191
6356
|
// the container on top of that makes the paragraph shimmer while it types.
|
|
6192
6357
|
// The distinction is what separates "the answer materialised" from "the
|
|
6193
6358
|
// log was appended to".
|
|
6194
|
-
/* @__PURE__ */
|
|
6359
|
+
/* @__PURE__ */ jsxs19("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
6195
6360
|
body,
|
|
6196
|
-
showCaret && /* @__PURE__ */
|
|
6361
|
+
showCaret && /* @__PURE__ */ jsx22(StreamingCaret, {})
|
|
6197
6362
|
] })
|
|
6198
6363
|
);
|
|
6199
6364
|
}
|
|
@@ -6218,7 +6383,7 @@ function SegmentedBody({
|
|
|
6218
6383
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
6219
6384
|
(tc) => !segmentToolIds.has(tc.id)
|
|
6220
6385
|
);
|
|
6221
|
-
const renderToolCard = (call, index) => /* @__PURE__ */
|
|
6386
|
+
const renderToolCard = (call, index) => /* @__PURE__ */ jsx22(
|
|
6222
6387
|
ToolCallCard,
|
|
6223
6388
|
{
|
|
6224
6389
|
call,
|
|
@@ -6247,12 +6412,12 @@ function SegmentedBody({
|
|
|
6247
6412
|
const children = [];
|
|
6248
6413
|
for (const g of groups) {
|
|
6249
6414
|
if (g.kind === "notice") {
|
|
6250
|
-
children.push(/* @__PURE__ */
|
|
6415
|
+
children.push(/* @__PURE__ */ jsx22(SegmentNotice, { tone: g.tone, content: g.content }, `notice-${g.index}`));
|
|
6251
6416
|
continue;
|
|
6252
6417
|
}
|
|
6253
6418
|
if (g.kind === "text") {
|
|
6254
6419
|
children.push(
|
|
6255
|
-
/* @__PURE__ */
|
|
6420
|
+
/* @__PURE__ */ jsx22(
|
|
6256
6421
|
SegmentText,
|
|
6257
6422
|
{
|
|
6258
6423
|
content: g.content,
|
|
@@ -6268,13 +6433,13 @@ function SegmentedBody({
|
|
|
6268
6433
|
}
|
|
6269
6434
|
if (!streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool)) {
|
|
6270
6435
|
children.push(
|
|
6271
|
-
/* @__PURE__ */
|
|
6272
|
-
/* @__PURE__ */
|
|
6436
|
+
/* @__PURE__ */ jsxs19("details", { children: [
|
|
6437
|
+
/* @__PURE__ */ jsxs19("summary", { className: "cursor-pointer select-none rounded-md py-0.5 text-xs font-medium text-muted-foreground [transition:color_var(--motion-control)] hover:text-foreground", children: [
|
|
6273
6438
|
"Worked through ",
|
|
6274
6439
|
g.calls.length,
|
|
6275
6440
|
" steps"
|
|
6276
6441
|
] }),
|
|
6277
|
-
/* @__PURE__ */
|
|
6442
|
+
/* @__PURE__ */ jsx22("div", { className: "mt-1.5 flex flex-col gap-1.5", children: g.calls.map(renderToolCard) })
|
|
6278
6443
|
] }, `tools-fold-${g.index}`)
|
|
6279
6444
|
);
|
|
6280
6445
|
continue;
|
|
@@ -6283,9 +6448,9 @@ function SegmentedBody({
|
|
|
6283
6448
|
}
|
|
6284
6449
|
leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
|
|
6285
6450
|
if (streaming && segments[lastIndex]?.kind === "tool") {
|
|
6286
|
-
children.push(/* @__PURE__ */
|
|
6451
|
+
children.push(/* @__PURE__ */ jsx22(StreamingCaret, {}, "streaming-caret"));
|
|
6287
6452
|
}
|
|
6288
|
-
return /* @__PURE__ */
|
|
6453
|
+
return /* @__PURE__ */ jsx22("div", { className: "flex flex-col gap-2", children });
|
|
6289
6454
|
}
|
|
6290
6455
|
var QUIET_META_LANE_CLASS = "mt-1 flex h-[18px] items-center gap-2 text-xs tabular-nums text-muted-foreground opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-within:opacity-100 motion-reduce:transition-none [@media(hover:none)]:opacity-100";
|
|
6291
6456
|
function copyTextOf(msg) {
|
|
@@ -6294,9 +6459,9 @@ function copyTextOf(msg) {
|
|
|
6294
6459
|
return msg.content;
|
|
6295
6460
|
}
|
|
6296
6461
|
function CopyMessageButton({ text }) {
|
|
6297
|
-
const [copied, setCopied] =
|
|
6298
|
-
const timerRef =
|
|
6299
|
-
|
|
6462
|
+
const [copied, setCopied] = useState20(false);
|
|
6463
|
+
const timerRef = useRef13(null);
|
|
6464
|
+
useEffect15(
|
|
6300
6465
|
() => () => {
|
|
6301
6466
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
6302
6467
|
},
|
|
@@ -6315,7 +6480,7 @@ function CopyMessageButton({ text }) {
|
|
|
6315
6480
|
}
|
|
6316
6481
|
);
|
|
6317
6482
|
};
|
|
6318
|
-
return /* @__PURE__ */
|
|
6483
|
+
return /* @__PURE__ */ jsx22(
|
|
6319
6484
|
"button",
|
|
6320
6485
|
{
|
|
6321
6486
|
type: "button",
|
|
@@ -6323,9 +6488,9 @@ function CopyMessageButton({ text }) {
|
|
|
6323
6488
|
"aria-label": "Copy message",
|
|
6324
6489
|
title: "Copy message",
|
|
6325
6490
|
className: "rounded p-0.5 text-muted-foreground transition hover:bg-accent hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
6326
|
-
children: copied ? /* @__PURE__ */
|
|
6327
|
-
/* @__PURE__ */
|
|
6328
|
-
/* @__PURE__ */
|
|
6491
|
+
children: copied ? /* @__PURE__ */ jsx22("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx22("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs19("svg", { className: "h-3.5 w-3.5", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6492
|
+
/* @__PURE__ */ jsx22("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
6493
|
+
/* @__PURE__ */ jsx22("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
6329
6494
|
] })
|
|
6330
6495
|
}
|
|
6331
6496
|
);
|
|
@@ -6347,82 +6512,35 @@ function AssistantMessageImpl({
|
|
|
6347
6512
|
chrome
|
|
6348
6513
|
}) {
|
|
6349
6514
|
const content = useSmoothText(msg.content, streaming);
|
|
6350
|
-
const
|
|
6351
|
-
const body = useMemo7(() => renderBody(content), [renderBody, content]);
|
|
6515
|
+
const body = useMemo8(() => renderBody(content), [renderBody, content]);
|
|
6352
6516
|
const segments = msg.segments;
|
|
6353
6517
|
const hasAnswerText = content !== "" || (segments?.some((s) => (s.kind === "text" || s.kind === "notice") && s.content.trim() !== "") ?? false);
|
|
6354
|
-
const reasoningScrollRef = useRef12(null);
|
|
6355
|
-
const thinkStartRef = useRef12(null);
|
|
6356
|
-
const thinkMsRef = useRef12(null);
|
|
6357
|
-
if (streaming && reasoning && !hasAnswerText && thinkStartRef.current === null) {
|
|
6358
|
-
thinkStartRef.current = performance.now();
|
|
6359
|
-
}
|
|
6360
|
-
if (hasAnswerText && thinkStartRef.current !== null && thinkMsRef.current === null) {
|
|
6361
|
-
thinkMsRef.current = performance.now() - thinkStartRef.current;
|
|
6362
|
-
}
|
|
6363
|
-
useEffect14(() => {
|
|
6364
|
-
const el = reasoningScrollRef.current;
|
|
6365
|
-
if (el && streaming && !hasAnswerText) el.scrollTop = el.scrollHeight;
|
|
6366
|
-
}, [reasoning, streaming, hasAnswerText]);
|
|
6367
|
-
const thinkingSeconds = useThinkingSeconds(
|
|
6368
|
-
streaming && !!reasoning && !hasAnswerText
|
|
6369
|
-
);
|
|
6370
|
-
const [reasoningToggled, setReasoningToggled] = useState19(null);
|
|
6371
|
-
const reasoningOpen = reasoningToggled ?? !hasAnswerText;
|
|
6372
6518
|
const quiet = chrome === "quiet";
|
|
6373
|
-
return /* @__PURE__ */
|
|
6374
|
-
quiet && msg.author && /* @__PURE__ */
|
|
6375
|
-
!quiet && /* @__PURE__ */
|
|
6519
|
+
return /* @__PURE__ */ jsxs19("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
6520
|
+
quiet && msg.author && /* @__PURE__ */ jsx22(MessageAuthor, { author: msg.author, className: "mb-1.5" }),
|
|
6521
|
+
!quiet && /* @__PURE__ */ jsxs19(
|
|
6376
6522
|
"div",
|
|
6377
6523
|
{
|
|
6378
6524
|
className: `mb-1 flex ${msg.author ? "items-center" : "items-baseline"} gap-2 text-xs tabular-nums text-muted-foreground`,
|
|
6379
6525
|
children: [
|
|
6380
|
-
msg.author ? /* @__PURE__ */
|
|
6381
|
-
msg.modelUsed && /* @__PURE__ */
|
|
6382
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
6383
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
6526
|
+
msg.author ? /* @__PURE__ */ jsx22(MessageAuthor, { author: msg.author }) : /* @__PURE__ */ jsx22("span", { className: "font-semibold uppercase tracking-[0.05em]", children: agentLabel }),
|
|
6527
|
+
msg.modelUsed && /* @__PURE__ */ jsx22("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
6528
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx22("span", { children: formatTokensPerSecond(msg) }),
|
|
6529
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx22("span", { children: formatModelCost(msg, models) })
|
|
6384
6530
|
]
|
|
6385
6531
|
}
|
|
6386
6532
|
),
|
|
6387
|
-
|
|
6388
|
-
|
|
6389
|
-
// kind. The shimmer title is a NODE (ui widened `title` to ReactNode for
|
|
6390
|
-
// exactly this): the sweep through the glyphs is the working-vs-stuck
|
|
6391
|
-
// signal. Open while thinking, auto-collapse on the first answer token,
|
|
6392
|
-
// and a click outranks the default from then on — the contract the old
|
|
6393
|
-
// hand-rolled disclosure had, now enforced through the shell's
|
|
6394
|
-
// controlled `open`.
|
|
6395
|
-
/* @__PURE__ */ jsx21(
|
|
6396
|
-
RunRowShell,
|
|
6533
|
+
/* @__PURE__ */ jsx22(
|
|
6534
|
+
ReasoningRow,
|
|
6397
6535
|
{
|
|
6398
6536
|
className: "mb-2",
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
] }) : thinkMsRef.current != null ? (
|
|
6404
|
-
// Words, not the abbreviated unit — "Thought for 4 seconds" reads
|
|
6405
|
-
// like a sentence; "4s" reads like a log line.
|
|
6406
|
-
`Thought for ${(() => {
|
|
6407
|
-
const s = Math.max(1, Math.round(thinkMsRef.current / 1e3));
|
|
6408
|
-
return `${s} second${s === 1 ? "" : "s"}`;
|
|
6409
|
-
})()}`
|
|
6410
|
-
) : "Thought process",
|
|
6411
|
-
description: hasAnswerText ? reasoningPreview(reasoning) : void 0,
|
|
6412
|
-
status: hasAnswerText ? "idle" : "running",
|
|
6413
|
-
open: reasoningOpen,
|
|
6414
|
-
onOpenChange: (next) => setReasoningToggled(next),
|
|
6415
|
-
children: /* @__PURE__ */ jsx21(
|
|
6416
|
-
"div",
|
|
6417
|
-
{
|
|
6418
|
-
ref: reasoningScrollRef,
|
|
6419
|
-
className: "max-h-48 overflow-y-auto whitespace-pre-wrap px-3 py-2.5 text-sm leading-relaxed text-muted-foreground",
|
|
6420
|
-
children: reasoning
|
|
6421
|
-
}
|
|
6422
|
-
)
|
|
6537
|
+
text: msg.reasoning ?? "",
|
|
6538
|
+
startedAt: msg.reasoningStartedAt,
|
|
6539
|
+
endedAt: msg.reasoningEndedAt,
|
|
6540
|
+
thinking: streaming && !hasAnswerText && msg.reasoningEndedAt === void 0
|
|
6423
6541
|
}
|
|
6424
6542
|
),
|
|
6425
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
6543
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx22(
|
|
6426
6544
|
SegmentedBody,
|
|
6427
6545
|
{
|
|
6428
6546
|
segments,
|
|
@@ -6434,12 +6552,12 @@ function AssistantMessageImpl({
|
|
|
6434
6552
|
toolRenderers,
|
|
6435
6553
|
messageClassName
|
|
6436
6554
|
}
|
|
6437
|
-
) : /* @__PURE__ */
|
|
6438
|
-
/* @__PURE__ */
|
|
6555
|
+
) : /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
6556
|
+
/* @__PURE__ */ jsxs19("div", { className: messageClassName, children: [
|
|
6439
6557
|
body,
|
|
6440
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
6558
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx22(StreamingCaret, {})
|
|
6441
6559
|
] }),
|
|
6442
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
6560
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx22(
|
|
6443
6561
|
ToolCallCard,
|
|
6444
6562
|
{
|
|
6445
6563
|
call: tc,
|
|
@@ -6452,7 +6570,7 @@ function AssistantMessageImpl({
|
|
|
6452
6570
|
tc.id
|
|
6453
6571
|
)) })
|
|
6454
6572
|
] }),
|
|
6455
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
6573
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx22(
|
|
6456
6574
|
DurableChatCards,
|
|
6457
6575
|
{
|
|
6458
6576
|
...durableCards,
|
|
@@ -6461,7 +6579,7 @@ function AssistantMessageImpl({
|
|
|
6461
6579
|
className: "mt-3"
|
|
6462
6580
|
}
|
|
6463
6581
|
),
|
|
6464
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
6582
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx22(
|
|
6465
6583
|
WorkProductCard,
|
|
6466
6584
|
{
|
|
6467
6585
|
part,
|
|
@@ -6471,7 +6589,7 @@ function AssistantMessageImpl({
|
|
|
6471
6589
|
`${part.ref.id}:${part.ref.version}`
|
|
6472
6590
|
)),
|
|
6473
6591
|
renderExtras?.(msg),
|
|
6474
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
6592
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-2", children: /* @__PURE__ */ jsx22(
|
|
6475
6593
|
MessageAttachments,
|
|
6476
6594
|
{
|
|
6477
6595
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -6479,18 +6597,18 @@ function AssistantMessageImpl({
|
|
|
6479
6597
|
justify: "start"
|
|
6480
6598
|
}
|
|
6481
6599
|
) }),
|
|
6482
|
-
quiet && /* @__PURE__ */
|
|
6483
|
-
/* @__PURE__ */
|
|
6484
|
-
msg.modelUsed && /* @__PURE__ */
|
|
6485
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
6486
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
6600
|
+
quiet && /* @__PURE__ */ jsxs19("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
6601
|
+
/* @__PURE__ */ jsx22(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
6602
|
+
msg.modelUsed && /* @__PURE__ */ jsx22("span", { className: "font-mono", children: msg.modelUsed }),
|
|
6603
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx22("span", { children: formatTokensPerSecond(msg) }),
|
|
6604
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx22("span", { children: formatModelCost(msg, models) })
|
|
6487
6605
|
] })
|
|
6488
6606
|
] });
|
|
6489
6607
|
}
|
|
6490
6608
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
6491
6609
|
function useThinkingSeconds(active) {
|
|
6492
|
-
const [seconds, setSeconds] =
|
|
6493
|
-
|
|
6610
|
+
const [seconds, setSeconds] = useState20(0);
|
|
6611
|
+
useEffect15(() => {
|
|
6494
6612
|
if (!active) return;
|
|
6495
6613
|
setSeconds(0);
|
|
6496
6614
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
@@ -6499,9 +6617,9 @@ function useThinkingSeconds(active) {
|
|
|
6499
6617
|
return seconds;
|
|
6500
6618
|
}
|
|
6501
6619
|
function ThinkingRow({ agentLabel, chrome = "labeled", phase }) {
|
|
6502
|
-
return /* @__PURE__ */
|
|
6503
|
-
chrome !== "quiet" && /* @__PURE__ */
|
|
6504
|
-
/* @__PURE__ */
|
|
6620
|
+
return /* @__PURE__ */ jsxs19("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
6621
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx22("p", { className: "mb-1 text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: agentLabel }),
|
|
6622
|
+
/* @__PURE__ */ jsx22(TurnProgress, { phase, pendingMessage: "Thinking\u2026", className: "text-[15px]" })
|
|
6505
6623
|
] });
|
|
6506
6624
|
}
|
|
6507
6625
|
var NOTICE_TONE_CLASS = {
|
|
@@ -6509,29 +6627,29 @@ var NOTICE_TONE_CLASS = {
|
|
|
6509
6627
|
warning: "border-warning/40 bg-warning/10 text-warning-strong"
|
|
6510
6628
|
};
|
|
6511
6629
|
function SegmentNotice({ tone, content }) {
|
|
6512
|
-
return /* @__PURE__ */
|
|
6630
|
+
return /* @__PURE__ */ jsxs19(
|
|
6513
6631
|
"div",
|
|
6514
6632
|
{
|
|
6515
6633
|
"data-notice-tone": tone,
|
|
6516
6634
|
className: `flex items-start gap-2.5 rounded-lg border px-3 py-2.5 text-sm ${NOTICE_TONE_CLASS[tone]}`,
|
|
6517
6635
|
children: [
|
|
6518
|
-
/* @__PURE__ */
|
|
6519
|
-
/* @__PURE__ */
|
|
6520
|
-
/* @__PURE__ */
|
|
6636
|
+
/* @__PURE__ */ jsxs19("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6637
|
+
/* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "9" }),
|
|
6638
|
+
/* @__PURE__ */ jsx22("path", { d: "M12 8v4m0 4h.01" })
|
|
6521
6639
|
] }),
|
|
6522
|
-
/* @__PURE__ */
|
|
6640
|
+
/* @__PURE__ */ jsx22("span", { className: "min-w-0 flex-1 whitespace-pre-wrap break-words", children: content })
|
|
6523
6641
|
]
|
|
6524
6642
|
}
|
|
6525
6643
|
);
|
|
6526
6644
|
}
|
|
6527
6645
|
function StreamErrorRow({ message, onRetry }) {
|
|
6528
|
-
return /* @__PURE__ */
|
|
6529
|
-
/* @__PURE__ */
|
|
6530
|
-
/* @__PURE__ */
|
|
6531
|
-
/* @__PURE__ */
|
|
6646
|
+
return /* @__PURE__ */ jsx22("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs19("div", { role: "alert", className: "flex items-start gap-2.5 rounded-lg border border-destructive/40 bg-destructive/5 px-3 py-2.5 text-sm text-destructive", children: [
|
|
6647
|
+
/* @__PURE__ */ jsxs19("svg", { className: "mt-0.5 h-4 w-4 shrink-0", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6648
|
+
/* @__PURE__ */ jsx22("circle", { cx: "12", cy: "12", r: "9" }),
|
|
6649
|
+
/* @__PURE__ */ jsx22("path", { d: "M12 8v4m0 4h.01" })
|
|
6532
6650
|
] }),
|
|
6533
|
-
/* @__PURE__ */
|
|
6534
|
-
onRetry && /* @__PURE__ */
|
|
6651
|
+
/* @__PURE__ */ jsx22("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
6652
|
+
onRetry && /* @__PURE__ */ jsx22(
|
|
6535
6653
|
"button",
|
|
6536
6654
|
{
|
|
6537
6655
|
type: "button",
|
|
@@ -6550,19 +6668,19 @@ function OtherPersonMessage({
|
|
|
6550
6668
|
resolveAttachmentUrl
|
|
6551
6669
|
}) {
|
|
6552
6670
|
const attachments = resolveAttachmentUrl ? attachmentPartsFromMessageParts(msg.parts) : [];
|
|
6553
|
-
return /* @__PURE__ */
|
|
6554
|
-
/* @__PURE__ */
|
|
6555
|
-
/* @__PURE__ */
|
|
6556
|
-
/* @__PURE__ */
|
|
6671
|
+
return /* @__PURE__ */ jsxs19("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
6672
|
+
/* @__PURE__ */ jsxs19("div", { className: `w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
6673
|
+
/* @__PURE__ */ jsx22(MessageAuthor, { author, className: "mb-1.5" }),
|
|
6674
|
+
/* @__PURE__ */ jsx22(
|
|
6557
6675
|
"div",
|
|
6558
6676
|
{
|
|
6559
6677
|
className: `w-fit max-w-full rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-4 py-2.5 text-[hsl(var(--foreground))] ${quiet ? "" : "rounded-tl-md "}${messageClassName}`,
|
|
6560
|
-
children: /* @__PURE__ */
|
|
6678
|
+
children: /* @__PURE__ */ jsx22("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
6561
6679
|
}
|
|
6562
6680
|
),
|
|
6563
|
-
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */
|
|
6681
|
+
resolveAttachmentUrl && attachments.length > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx22(MessageAttachments, { parts: attachments, resolveFileUrl: resolveAttachmentUrl, justify: "start" }) })
|
|
6564
6682
|
] }),
|
|
6565
|
-
quiet && /* @__PURE__ */
|
|
6683
|
+
quiet && /* @__PURE__ */ jsx22("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-start`, children: /* @__PURE__ */ jsx22(CopyMessageButton, { text: msg.content }) })
|
|
6566
6684
|
] });
|
|
6567
6685
|
}
|
|
6568
6686
|
function ChatMessages({
|
|
@@ -6591,23 +6709,23 @@ function ChatMessages({
|
|
|
6591
6709
|
}) {
|
|
6592
6710
|
const messageClassName = messageSize === "large" ? `agent-app-message-copy ${TRANSCRIPT_TEXT} [--transcript-font-size:1.0625rem]` : `agent-app-message-copy ${TRANSCRIPT_TEXT}`;
|
|
6593
6711
|
const assistantMessageClassName = `${messageClassName} bg-transparent text-[hsl(var(--foreground))]`;
|
|
6594
|
-
const renderBody =
|
|
6595
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
6712
|
+
const renderBody = useMemo8(
|
|
6713
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx22("p", { className: "whitespace-pre-wrap", children: content })),
|
|
6596
6714
|
[renderMarkdown]
|
|
6597
6715
|
);
|
|
6598
6716
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
6599
6717
|
const quiet = chrome === "quiet";
|
|
6600
6718
|
if (messages.length === 0 && !loading && !error) {
|
|
6601
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
6602
|
-
return /* @__PURE__ */
|
|
6719
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx22(ChatEmptyState, { ...emptyState });
|
|
6720
|
+
return /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
6603
6721
|
header,
|
|
6604
6722
|
empty
|
|
6605
6723
|
] });
|
|
6606
6724
|
}
|
|
6607
|
-
return /* @__PURE__ */
|
|
6725
|
+
return /* @__PURE__ */ jsxs19(Fragment6, { children: [
|
|
6608
6726
|
header,
|
|
6609
6727
|
messages.map(
|
|
6610
|
-
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */
|
|
6728
|
+
(msg) => msg.role === "user" && msg.author && !isViewerMessage(msg.author, viewerId) ? /* @__PURE__ */ jsx22(
|
|
6611
6729
|
OtherPersonMessage,
|
|
6612
6730
|
{
|
|
6613
6731
|
msg,
|
|
@@ -6617,17 +6735,17 @@ function ChatMessages({
|
|
|
6617
6735
|
resolveAttachmentUrl
|
|
6618
6736
|
},
|
|
6619
6737
|
msg.id
|
|
6620
|
-
) : msg.role === "user" ? /* @__PURE__ */
|
|
6621
|
-
/* @__PURE__ */
|
|
6622
|
-
!quiet && /* @__PURE__ */
|
|
6623
|
-
/* @__PURE__ */
|
|
6738
|
+
) : msg.role === "user" ? /* @__PURE__ */ jsxs19("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
6739
|
+
/* @__PURE__ */ jsxs19("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
6740
|
+
!quiet && /* @__PURE__ */ jsx22("p", { className: "mb-1 text-right text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: userLabel }),
|
|
6741
|
+
/* @__PURE__ */ jsx22(
|
|
6624
6742
|
"div",
|
|
6625
6743
|
{
|
|
6626
6744
|
className: `rounded-2xl bg-[hsl(var(--foreground))] px-4 py-2.5 text-[hsl(var(--background))] ${quiet ? "" : "rounded-tr-md "}${messageClassName}`,
|
|
6627
|
-
children: /* @__PURE__ */
|
|
6745
|
+
children: /* @__PURE__ */ jsx22("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
6628
6746
|
}
|
|
6629
6747
|
),
|
|
6630
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
6748
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx22(
|
|
6631
6749
|
MessageAttachments,
|
|
6632
6750
|
{
|
|
6633
6751
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -6636,8 +6754,8 @@ function ChatMessages({
|
|
|
6636
6754
|
}
|
|
6637
6755
|
) })
|
|
6638
6756
|
] }),
|
|
6639
|
-
quiet && /* @__PURE__ */
|
|
6640
|
-
] }, msg.id) : /* @__PURE__ */
|
|
6757
|
+
quiet && /* @__PURE__ */ jsx22("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx22(CopyMessageButton, { text: msg.content }) })
|
|
6758
|
+
] }, msg.id) : /* @__PURE__ */ jsx22(
|
|
6641
6759
|
AssistantMessage,
|
|
6642
6760
|
{
|
|
6643
6761
|
msg,
|
|
@@ -6658,8 +6776,8 @@ function ChatMessages({
|
|
|
6658
6776
|
msg.id
|
|
6659
6777
|
)
|
|
6660
6778
|
),
|
|
6661
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
6662
|
-
error && !loading && /* @__PURE__ */
|
|
6779
|
+
loading && lastIsUser && /* @__PURE__ */ jsx22(ThinkingRow, { agentLabel, chrome, phase: turnPhase }),
|
|
6780
|
+
error && !loading && /* @__PURE__ */ jsx22(StreamErrorRow, { message: error, onRetry })
|
|
6663
6781
|
] });
|
|
6664
6782
|
}
|
|
6665
6783
|
|
|
@@ -6694,6 +6812,9 @@ export {
|
|
|
6694
6812
|
triggerAttachmentDownload,
|
|
6695
6813
|
MessageAttachments,
|
|
6696
6814
|
TurnProgress,
|
|
6815
|
+
ReasoningRow,
|
|
6816
|
+
trackChatReasoning,
|
|
6817
|
+
chatReasoningFromParts,
|
|
6697
6818
|
dispatchChatStreamLine,
|
|
6698
6819
|
consumeChatStream,
|
|
6699
6820
|
streamChatTurn,
|
|
@@ -6804,4 +6925,4 @@ export {
|
|
|
6804
6925
|
useThinkingSeconds,
|
|
6805
6926
|
ChatMessages
|
|
6806
6927
|
};
|
|
6807
|
-
//# sourceMappingURL=chunk-
|
|
6928
|
+
//# sourceMappingURL=chunk-T4JJXUJI.js.map
|