@tangle-network/agent-app 0.52.16 → 0.52.18
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 +1 -1
- package/dist/{chunk-IK7JCJQF.js → chunk-2LPNGZFG.js} +1119 -862
- package/dist/chunk-2LPNGZFG.js.map +1 -0
- package/dist/web-react/agent-profile-editor.d.ts +4 -1
- package/dist/web-react/agent-profile-registry-search.d.ts +17 -0
- package/dist/web-react/agent-profile-registry.d.ts +54 -0
- package/dist/web-react/index.d.ts +2 -0
- package/dist/web-react/index.js +5 -1
- package/dist/web-react/turn-funding-recovery.d.ts +20 -0
- package/package.json +1 -1
- package/dist/chunk-IK7JCJQF.js.map +0 -1
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from "./chunk-YJMCRXQQ.js";
|
|
51
51
|
|
|
52
52
|
// src/web-react/index.tsx
|
|
53
|
-
import { useEffect as useEffect13, useMemo as useMemo7, useRef as
|
|
53
|
+
import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef13, useState as useState18, memo } from "react";
|
|
54
54
|
import { InlineToolItem, RunRowShell } from "@tangle-network/ui/run";
|
|
55
55
|
|
|
56
56
|
// src/web-react/smooth-text.ts
|
|
@@ -1415,11 +1415,241 @@ async function streamChatTurn(opts) {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
|
+
// src/web-react/turn-funding-recovery.ts
|
|
1419
|
+
function getChatFundingRecovery(failure) {
|
|
1420
|
+
const code = typeof failure === "object" && failure ? failure.code : void 0;
|
|
1421
|
+
const message = typeof failure === "string" ? failure : failure?.message ?? "";
|
|
1422
|
+
let reason;
|
|
1423
|
+
if (code === "insufficient_credits") reason = "insufficient_credits";
|
|
1424
|
+
else if (code === "paid_access_required" || code === "funding_required") reason = "paid_access_required";
|
|
1425
|
+
else if (/\binsufficient credits\b/i.test(message)) reason = "insufficient_credits";
|
|
1426
|
+
else if (/\binference requires verified paid access\b/i.test(message)) reason = "paid_access_required";
|
|
1427
|
+
if (!reason) return null;
|
|
1428
|
+
return {
|
|
1429
|
+
reason,
|
|
1430
|
+
title: reason === "insufficient_credits" ? "Insufficient credits" : "Paid access required",
|
|
1431
|
+
message: reason === "insufficient_credits" ? "Open billing to add funds before trying again." : "Open billing to check your funded balance or paid seat before trying again.",
|
|
1432
|
+
actionLabel: "Open billing",
|
|
1433
|
+
retryable: false
|
|
1434
|
+
};
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1418
1437
|
// src/web-react/agent-profile-editor.tsx
|
|
1419
|
-
import { useEffect as useEffect5, useId, useState as
|
|
1438
|
+
import { useEffect as useEffect5, useId, useState as useState8 } from "react";
|
|
1420
1439
|
import { agentProfileSchema } from "@tangle-network/agent-interface/profile-schema";
|
|
1421
|
-
import { Button, Input, Textarea, Switch, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@tangle-network/sandbox-ui/primitives";
|
|
1440
|
+
import { Button as Button2, Input as Input2, Textarea, Switch, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@tangle-network/sandbox-ui/primitives";
|
|
1441
|
+
|
|
1442
|
+
// src/web-react/agent-profile-registry-search.tsx
|
|
1443
|
+
import { useRef as useRef5, useState as useState7 } from "react";
|
|
1444
|
+
import { Button, Input } from "@tangle-network/sandbox-ui/primitives";
|
|
1445
|
+
|
|
1446
|
+
// src/web-react/agent-profile-registry.ts
|
|
1447
|
+
var AgentProfileRegistryError = class extends Error {
|
|
1448
|
+
constructor(kind, message) {
|
|
1449
|
+
super(message);
|
|
1450
|
+
this.kind = kind;
|
|
1451
|
+
this.name = "AgentProfileRegistryError";
|
|
1452
|
+
}
|
|
1453
|
+
kind;
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
// src/web-react/agent-profile-registry-search.tsx
|
|
1422
1457
|
import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1458
|
+
var idle = { status: "idle", results: [], unavailable: [], failure: null };
|
|
1459
|
+
function failureOf(cause) {
|
|
1460
|
+
if (cause instanceof AgentProfileRegistryError) return { kind: cause.kind, message: cause.message };
|
|
1461
|
+
return { kind: "failed", message: cause instanceof Error ? cause.message : "Registry search failed." };
|
|
1462
|
+
}
|
|
1463
|
+
function failureText(failure) {
|
|
1464
|
+
if (failure.kind === "authorization-required") {
|
|
1465
|
+
return "Registry search needs authorization. Sign in again or ask a workspace owner.";
|
|
1466
|
+
}
|
|
1467
|
+
if (failure.kind === "unavailable") return failure.message || "Registry search is unavailable right now.";
|
|
1468
|
+
return failure.message || "Registry search failed.";
|
|
1469
|
+
}
|
|
1470
|
+
function useRegistrySearch(search) {
|
|
1471
|
+
const [state, setState] = useState7(idle);
|
|
1472
|
+
const request = useRef5(0);
|
|
1473
|
+
async function run(query) {
|
|
1474
|
+
const text = query.trim();
|
|
1475
|
+
if (!text) return;
|
|
1476
|
+
const epoch = ++request.current;
|
|
1477
|
+
const controller = new AbortController();
|
|
1478
|
+
setState((current) => ({ ...current, status: "searching", failure: null }));
|
|
1479
|
+
try {
|
|
1480
|
+
const result = await search(text, controller.signal);
|
|
1481
|
+
if (request.current !== epoch) return;
|
|
1482
|
+
setState({ status: "done", results: result.items, unavailable: result.unavailable ?? [], failure: null });
|
|
1483
|
+
} catch (cause) {
|
|
1484
|
+
if (request.current !== epoch) return;
|
|
1485
|
+
setState({ status: "done", results: [], unavailable: [], failure: failureOf(cause) });
|
|
1486
|
+
}
|
|
1487
|
+
}
|
|
1488
|
+
return { state, run };
|
|
1489
|
+
}
|
|
1490
|
+
function SearchBox({ label, placeholder, disabled, onSearch }) {
|
|
1491
|
+
const [query, setQuery] = useState7("");
|
|
1492
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
|
|
1493
|
+
/* @__PURE__ */ jsx7(
|
|
1494
|
+
Input,
|
|
1495
|
+
{
|
|
1496
|
+
"aria-label": label,
|
|
1497
|
+
disabled,
|
|
1498
|
+
value: query,
|
|
1499
|
+
placeholder,
|
|
1500
|
+
onChange: (event) => setQuery(event.target.value),
|
|
1501
|
+
onKeyDown: (event) => {
|
|
1502
|
+
if (event.key === "Enter") {
|
|
1503
|
+
event.preventDefault();
|
|
1504
|
+
onSearch(query);
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
}
|
|
1508
|
+
),
|
|
1509
|
+
/* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: disabled || !query.trim(), onClick: () => onSearch(query), children: "Search" })
|
|
1510
|
+
] });
|
|
1511
|
+
}
|
|
1512
|
+
function SearchStatus({ state, empty }) {
|
|
1513
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1514
|
+
state.status === "searching" && /* @__PURE__ */ jsx7("p", { role: "status", className: "text-xs text-muted-foreground", children: "Searching\u2026" }),
|
|
1515
|
+
state.failure && /* @__PURE__ */ jsx7("p", { role: "alert", className: "text-xs text-destructive", children: failureText(state.failure) }),
|
|
1516
|
+
!state.failure && state.unavailable.length > 0 && /* @__PURE__ */ jsxs5("p", { role: "status", className: "text-xs text-muted-foreground", children: [
|
|
1517
|
+
"Some catalogs could not answer: ",
|
|
1518
|
+
state.unavailable.join(", "),
|
|
1519
|
+
"."
|
|
1520
|
+
] }),
|
|
1521
|
+
state.status === "done" && !state.failure && state.results.length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: empty })
|
|
1522
|
+
] });
|
|
1523
|
+
}
|
|
1524
|
+
function AgentProfileRegistrySkillSearch({ registry, disabled, existing, validate, onAdd }) {
|
|
1525
|
+
const { state, run } = useRegistrySearch(async (query, signal) => {
|
|
1526
|
+
const result = await registry.searchSkills(query, signal);
|
|
1527
|
+
return { items: result.skills, unavailable: result.unavailable };
|
|
1528
|
+
});
|
|
1529
|
+
const [added, setAdded] = useState7([]);
|
|
1530
|
+
return /* @__PURE__ */ jsxs5("div", { className: "space-y-2 rounded-lg border border-border p-3", children: [
|
|
1531
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm font-medium text-foreground", children: "Find skills in maintained catalogs" }),
|
|
1532
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Search shows each skill's source and declared permissions. Adding a skill saves a reference; nothing is installed until the profile runs." }),
|
|
1533
|
+
/* @__PURE__ */ jsx7(
|
|
1534
|
+
SearchBox,
|
|
1535
|
+
{
|
|
1536
|
+
label: "Search skill catalogs",
|
|
1537
|
+
placeholder: "Search skills",
|
|
1538
|
+
disabled: disabled || state.status === "searching",
|
|
1539
|
+
onSearch: (query) => void run(query)
|
|
1540
|
+
}
|
|
1541
|
+
),
|
|
1542
|
+
/* @__PURE__ */ jsx7(SearchStatus, { state, empty: "No skills matched that search." }),
|
|
1543
|
+
state.results.length > 0 && /* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: state.results.map((skill, index) => {
|
|
1544
|
+
const configured = existing.some((ref) => ref.name === skill.name) || added.includes(skill.name);
|
|
1545
|
+
const issue = configured ? null : validate(skill.ref);
|
|
1546
|
+
return /* @__PURE__ */ jsxs5(
|
|
1547
|
+
"li",
|
|
1548
|
+
{
|
|
1549
|
+
className: "space-y-1 rounded-lg border border-border p-3 text-sm",
|
|
1550
|
+
"aria-label": `Catalog skill ${skill.name}`,
|
|
1551
|
+
children: [
|
|
1552
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
|
|
1553
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
|
|
1554
|
+
/* @__PURE__ */ jsx7("span", { className: "block break-words font-medium text-foreground", children: skill.name }),
|
|
1555
|
+
/* @__PURE__ */ jsx7("span", { className: "block text-xs text-muted-foreground", children: skill.catalog })
|
|
1556
|
+
] }),
|
|
1557
|
+
/* @__PURE__ */ jsx7(
|
|
1558
|
+
Button,
|
|
1559
|
+
{
|
|
1560
|
+
type: "button",
|
|
1561
|
+
variant: "outline",
|
|
1562
|
+
size: "sm",
|
|
1563
|
+
disabled: disabled || configured || Boolean(issue),
|
|
1564
|
+
"aria-label": `Add skill ${skill.name}`,
|
|
1565
|
+
onClick: () => {
|
|
1566
|
+
if (onAdd(skill.ref)) setAdded((current) => [...current, skill.name]);
|
|
1567
|
+
},
|
|
1568
|
+
children: configured ? "Added" : "Add skill"
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1571
|
+
] }),
|
|
1572
|
+
skill.description && /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: skill.description }),
|
|
1573
|
+
skill.ref.kind === "github" && /* @__PURE__ */ jsxs5("p", { className: "break-words text-xs text-muted-foreground", children: [
|
|
1574
|
+
"Source: ",
|
|
1575
|
+
skill.ref.repository,
|
|
1576
|
+
" / ",
|
|
1577
|
+
skill.ref.path,
|
|
1578
|
+
skill.ref.ref ? ` @ ${skill.ref.ref}` : ""
|
|
1579
|
+
] }),
|
|
1580
|
+
skill.permissions && skill.permissions.length > 0 && /* @__PURE__ */ jsxs5("p", { className: "text-xs text-muted-foreground", children: [
|
|
1581
|
+
"Requests: ",
|
|
1582
|
+
skill.permissions.join(", ")
|
|
1583
|
+
] }),
|
|
1584
|
+
issue && /* @__PURE__ */ jsx7("p", { className: "text-xs text-destructive", children: issue })
|
|
1585
|
+
]
|
|
1586
|
+
},
|
|
1587
|
+
`${skill.catalog}:${skill.name}:${index}`
|
|
1588
|
+
);
|
|
1589
|
+
}) })
|
|
1590
|
+
] });
|
|
1591
|
+
}
|
|
1592
|
+
function AgentProfileRegistryMcpSearch({ registry, disabled, existingNames, validate, onAdd }) {
|
|
1593
|
+
const { state, run } = useRegistrySearch(async (query, signal) => {
|
|
1594
|
+
const result = await registry.searchMcpServers(query, signal);
|
|
1595
|
+
return { items: result.mcpServers, unavailable: result.unavailable };
|
|
1596
|
+
});
|
|
1597
|
+
const [added, setAdded] = useState7([]);
|
|
1598
|
+
return /* @__PURE__ */ jsxs5("div", { className: "space-y-2 rounded-lg border border-border p-3", children: [
|
|
1599
|
+
/* @__PURE__ */ jsx7("p", { className: "text-sm font-medium text-foreground", children: "Find MCP servers in registries" }),
|
|
1600
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Results come from the official MCP Registry and configured custom registries. Listing does not imply trust or authorize installation." }),
|
|
1601
|
+
/* @__PURE__ */ jsx7(
|
|
1602
|
+
SearchBox,
|
|
1603
|
+
{
|
|
1604
|
+
label: "Search MCP registries",
|
|
1605
|
+
placeholder: "Search MCP servers",
|
|
1606
|
+
disabled: disabled || state.status === "searching",
|
|
1607
|
+
onSearch: (query) => void run(query)
|
|
1608
|
+
}
|
|
1609
|
+
),
|
|
1610
|
+
/* @__PURE__ */ jsx7(SearchStatus, { state, empty: "No MCP servers matched that search." }),
|
|
1611
|
+
state.results.length > 0 && /* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: state.results.map((item, index) => {
|
|
1612
|
+
const configured = existingNames.includes(item.name) || added.includes(item.name);
|
|
1613
|
+
const issue = configured ? null : validate(item.name, item.server);
|
|
1614
|
+
return /* @__PURE__ */ jsxs5(
|
|
1615
|
+
"li",
|
|
1616
|
+
{
|
|
1617
|
+
className: "space-y-1 rounded-lg border border-border p-3 text-sm",
|
|
1618
|
+
"aria-label": `Registry server ${item.name}`,
|
|
1619
|
+
children: [
|
|
1620
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
|
|
1621
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
|
|
1622
|
+
/* @__PURE__ */ jsx7("span", { className: "block break-words font-medium text-foreground", children: item.name }),
|
|
1623
|
+
/* @__PURE__ */ jsx7("span", { className: "block text-xs text-muted-foreground", children: item.catalog })
|
|
1624
|
+
] }),
|
|
1625
|
+
/* @__PURE__ */ jsx7(
|
|
1626
|
+
Button,
|
|
1627
|
+
{
|
|
1628
|
+
type: "button",
|
|
1629
|
+
variant: "outline",
|
|
1630
|
+
size: "sm",
|
|
1631
|
+
disabled: disabled || configured || Boolean(issue),
|
|
1632
|
+
"aria-label": `Add server ${item.name}`,
|
|
1633
|
+
onClick: () => {
|
|
1634
|
+
if (onAdd(item.name, item.server)) setAdded((current) => [...current, item.name]);
|
|
1635
|
+
},
|
|
1636
|
+
children: configured ? "Added" : "Add server"
|
|
1637
|
+
}
|
|
1638
|
+
)
|
|
1639
|
+
] }),
|
|
1640
|
+
item.description && /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: item.description }),
|
|
1641
|
+
/* @__PURE__ */ jsx7("p", { className: "break-words text-xs text-muted-foreground", children: "command" in item.server ? `Command: ${item.server.command}` : `URL: ${item.server.url}` }),
|
|
1642
|
+
issue && /* @__PURE__ */ jsx7("p", { className: "text-xs text-destructive", children: issue })
|
|
1643
|
+
]
|
|
1644
|
+
},
|
|
1645
|
+
`${item.catalog}:${item.name}:${index}`
|
|
1646
|
+
);
|
|
1647
|
+
}) })
|
|
1648
|
+
] });
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
// src/web-react/agent-profile-editor.tsx
|
|
1652
|
+
import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1423
1653
|
var RESOURCE_KIND_LABELS = {
|
|
1424
1654
|
files: "Resource files",
|
|
1425
1655
|
skills: "Skills",
|
|
@@ -1433,34 +1663,34 @@ function configuredResourceCount(profile, kind) {
|
|
|
1433
1663
|
return Array.isArray(resource) ? resource.length : resource ? 1 : 0;
|
|
1434
1664
|
}
|
|
1435
1665
|
function Field({ label, hint, children }) {
|
|
1436
|
-
return /* @__PURE__ */
|
|
1437
|
-
/* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ jsxs6("label", { className: "block space-y-1.5 text-sm font-medium text-foreground", children: [
|
|
1667
|
+
/* @__PURE__ */ jsx8("span", { children: label }),
|
|
1438
1668
|
children,
|
|
1439
|
-
hint && /* @__PURE__ */
|
|
1669
|
+
hint && /* @__PURE__ */ jsx8("span", { className: "block text-xs font-normal text-muted-foreground", children: hint })
|
|
1440
1670
|
] });
|
|
1441
1671
|
}
|
|
1442
1672
|
function Section({ title, description, children }) {
|
|
1443
|
-
return /* @__PURE__ */
|
|
1444
|
-
/* @__PURE__ */
|
|
1445
|
-
/* @__PURE__ */
|
|
1446
|
-
description && /* @__PURE__ */
|
|
1673
|
+
return /* @__PURE__ */ jsxs6("section", { className: "space-y-4 rounded-xl border border-border bg-card p-4 sm:p-5", children: [
|
|
1674
|
+
/* @__PURE__ */ jsxs6("div", { children: [
|
|
1675
|
+
/* @__PURE__ */ jsx8("h2", { className: "text-base font-semibold text-foreground", children: title }),
|
|
1676
|
+
description && /* @__PURE__ */ jsx8("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
1447
1677
|
] }),
|
|
1448
1678
|
children
|
|
1449
1679
|
] });
|
|
1450
1680
|
}
|
|
1451
1681
|
function Disclosure({ title, description, detail, children }) {
|
|
1452
|
-
return /* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
1454
|
-
/* @__PURE__ */
|
|
1455
|
-
/* @__PURE__ */
|
|
1456
|
-
description && /* @__PURE__ */
|
|
1682
|
+
return /* @__PURE__ */ jsxs6("details", { className: "group rounded-xl border border-border bg-card", children: [
|
|
1683
|
+
/* @__PURE__ */ jsxs6("summary", { className: "flex cursor-pointer list-none items-center justify-between gap-4 rounded-xl p-4 marker:hidden focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:p-5", children: [
|
|
1684
|
+
/* @__PURE__ */ jsxs6("span", { children: [
|
|
1685
|
+
/* @__PURE__ */ jsx8("span", { className: "block text-base font-semibold text-foreground", children: title }),
|
|
1686
|
+
description && /* @__PURE__ */ jsx8("span", { className: "mt-1 block text-sm text-muted-foreground", children: description })
|
|
1457
1687
|
] }),
|
|
1458
|
-
/* @__PURE__ */
|
|
1688
|
+
/* @__PURE__ */ jsxs6("span", { className: "flex shrink-0 items-center gap-2 text-sm text-muted-foreground", children: [
|
|
1459
1689
|
detail,
|
|
1460
|
-
/* @__PURE__ */
|
|
1690
|
+
/* @__PURE__ */ jsx8("span", { "aria-hidden": "true", className: "transition-transform group-open:rotate-180", children: "\u2304" })
|
|
1461
1691
|
] })
|
|
1462
1692
|
] }),
|
|
1463
|
-
/* @__PURE__ */
|
|
1693
|
+
/* @__PURE__ */ jsx8("div", { className: "space-y-4 border-t border-border p-4 sm:p-5", children })
|
|
1464
1694
|
] });
|
|
1465
1695
|
}
|
|
1466
1696
|
function issueMessage(error) {
|
|
@@ -1518,17 +1748,17 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGit
|
|
|
1518
1748
|
function change(field, text) {
|
|
1519
1749
|
onChange({ ...draft, [field]: text });
|
|
1520
1750
|
}
|
|
1521
|
-
return /* @__PURE__ */
|
|
1522
|
-
/* @__PURE__ */
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1525
|
-
/* @__PURE__ */
|
|
1526
|
-
/* @__PURE__ */
|
|
1751
|
+
return /* @__PURE__ */ jsxs6("div", { className: "grid gap-3 sm:grid-cols-2", children: [
|
|
1752
|
+
/* @__PURE__ */ jsx8(Field, { label: "Source", children: /* @__PURE__ */ jsxs6(Select, { disabled, value: draft.kind, onValueChange: (kind) => change("kind", kind), children: [
|
|
1753
|
+
/* @__PURE__ */ jsx8(SelectTrigger, { "aria-label": "Source", children: /* @__PURE__ */ jsx8(SelectValue, {}) }),
|
|
1754
|
+
/* @__PURE__ */ jsxs6(SelectContent, { children: [
|
|
1755
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "github", children: "GitHub file" }),
|
|
1756
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "inline", children: "Inline content" })
|
|
1527
1757
|
] })
|
|
1528
1758
|
] }) }),
|
|
1529
|
-
draft.kind === "github" ? /* @__PURE__ */
|
|
1530
|
-
/* @__PURE__ */
|
|
1531
|
-
|
|
1759
|
+
draft.kind === "github" ? /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1760
|
+
/* @__PURE__ */ jsx8(Field, { label: "Repository", hint: "GitHub owner/repo", children: /* @__PURE__ */ jsx8(
|
|
1761
|
+
Input2,
|
|
1532
1762
|
{
|
|
1533
1763
|
disabled,
|
|
1534
1764
|
value: draft.repository,
|
|
@@ -1536,8 +1766,8 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGit
|
|
|
1536
1766
|
placeholder: "owner/repo"
|
|
1537
1767
|
}
|
|
1538
1768
|
) }),
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
|
|
1769
|
+
/* @__PURE__ */ jsx8(Field, { label: "Repository path", hint: "Relative to the repository root", children: /* @__PURE__ */ jsx8(
|
|
1770
|
+
Input2,
|
|
1541
1771
|
{
|
|
1542
1772
|
disabled,
|
|
1543
1773
|
value: draft.path,
|
|
@@ -1545,8 +1775,8 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGit
|
|
|
1545
1775
|
placeholder: pathPlaceholder
|
|
1546
1776
|
}
|
|
1547
1777
|
) }),
|
|
1548
|
-
/* @__PURE__ */
|
|
1549
|
-
|
|
1778
|
+
/* @__PURE__ */ jsx8(Field, { label: requireGitHubCommitSha ? "Commit SHA" : "Ref", hint: requireGitHubCommitSha ? "Use the full 40-character SHA of a fixed commit." : "Defaults to the main branch", children: /* @__PURE__ */ jsx8(
|
|
1779
|
+
Input2,
|
|
1550
1780
|
{
|
|
1551
1781
|
disabled,
|
|
1552
1782
|
value: draft.ref,
|
|
@@ -1554,13 +1784,13 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGit
|
|
|
1554
1784
|
placeholder: requireGitHubCommitSha ? "40-character commit SHA" : "main"
|
|
1555
1785
|
}
|
|
1556
1786
|
) }),
|
|
1557
|
-
/* @__PURE__ */
|
|
1787
|
+
/* @__PURE__ */ jsx8(
|
|
1558
1788
|
Field,
|
|
1559
1789
|
{
|
|
1560
1790
|
label: requireSkillName ? "Skill name" : "Name",
|
|
1561
1791
|
hint: requireSkillName ? "Unique lowercase name, up to 64 letters, numbers, dots, dashes, or underscores." : "Defaults to the source filename",
|
|
1562
|
-
children: /* @__PURE__ */
|
|
1563
|
-
|
|
1792
|
+
children: /* @__PURE__ */ jsx8(
|
|
1793
|
+
Input2,
|
|
1564
1794
|
{
|
|
1565
1795
|
disabled,
|
|
1566
1796
|
value: draft.name,
|
|
@@ -1570,14 +1800,14 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGit
|
|
|
1570
1800
|
)
|
|
1571
1801
|
}
|
|
1572
1802
|
)
|
|
1573
|
-
] }) : /* @__PURE__ */
|
|
1574
|
-
/* @__PURE__ */
|
|
1803
|
+
] }) : /* @__PURE__ */ jsxs6(Fragment3, { children: [
|
|
1804
|
+
/* @__PURE__ */ jsx8(
|
|
1575
1805
|
Field,
|
|
1576
1806
|
{
|
|
1577
1807
|
label: requireSkillName ? "Skill name" : "File name",
|
|
1578
1808
|
hint: requireSkillName ? "Unique lowercase name, up to 64 letters, numbers, dots, dashes, or underscores." : void 0,
|
|
1579
|
-
children: /* @__PURE__ */
|
|
1580
|
-
|
|
1809
|
+
children: /* @__PURE__ */ jsx8(
|
|
1810
|
+
Input2,
|
|
1581
1811
|
{
|
|
1582
1812
|
disabled,
|
|
1583
1813
|
value: draft.name,
|
|
@@ -1587,7 +1817,7 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGit
|
|
|
1587
1817
|
)
|
|
1588
1818
|
}
|
|
1589
1819
|
),
|
|
1590
|
-
/* @__PURE__ */
|
|
1820
|
+
/* @__PURE__ */ jsx8("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx8(Field, { label: "Content", children: /* @__PURE__ */ jsx8(
|
|
1591
1821
|
Textarea,
|
|
1592
1822
|
{
|
|
1593
1823
|
className: "min-h-32 font-mono text-sm",
|
|
@@ -1638,28 +1868,29 @@ function AgentProfileEditor({
|
|
|
1638
1868
|
requireGitHubCommitSha = false,
|
|
1639
1869
|
requireUniqueSkillNames = false,
|
|
1640
1870
|
showToolsAndPermissions = true,
|
|
1641
|
-
publicHttpsMcpOnly = false
|
|
1871
|
+
publicHttpsMcpOnly = false,
|
|
1872
|
+
registry
|
|
1642
1873
|
}) {
|
|
1643
1874
|
const id = useId();
|
|
1644
1875
|
const workspaceFilePrefix = normalizedFilePathPrefix(filePathPrefix);
|
|
1645
|
-
const [error, setError] =
|
|
1646
|
-
const [newTool, setNewTool] =
|
|
1647
|
-
const [showAllTools, setShowAllTools] =
|
|
1648
|
-
const [mcpName, setMcpName] =
|
|
1649
|
-
const [mcpKind, setMcpKind] =
|
|
1876
|
+
const [error, setError] = useState8(null);
|
|
1877
|
+
const [newTool, setNewTool] = useState8("");
|
|
1878
|
+
const [showAllTools, setShowAllTools] = useState8(false);
|
|
1879
|
+
const [mcpName, setMcpName] = useState8("");
|
|
1880
|
+
const [mcpKind, setMcpKind] = useState8("http");
|
|
1650
1881
|
const selectedMcpKind = publicHttpsMcpOnly && mcpKind === "stdio" ? "http" : mcpKind;
|
|
1651
|
-
const [mcpTarget, setMcpTarget] =
|
|
1652
|
-
const [resourceDrafts, setResourceDrafts] =
|
|
1653
|
-
const [resourceEdit, setResourceEdit] =
|
|
1654
|
-
const [newFile, setNewFile] =
|
|
1882
|
+
const [mcpTarget, setMcpTarget] = useState8("");
|
|
1883
|
+
const [resourceDrafts, setResourceDrafts] = useState8({ skills: emptyResourceDraft(), tools: emptyResourceDraft() });
|
|
1884
|
+
const [resourceEdit, setResourceEdit] = useState8(null);
|
|
1885
|
+
const [newFile, setNewFile] = useState8(() => ({
|
|
1655
1886
|
path: normalizedFilePathPrefix(filePathPrefix) ?? "",
|
|
1656
1887
|
resource: { ...emptyResourceDraft(), kind: "inline" },
|
|
1657
1888
|
executable: false
|
|
1658
1889
|
}));
|
|
1659
|
-
const [addingFile, setAddingFile] =
|
|
1660
|
-
const [fileEdit, setFileEdit] =
|
|
1661
|
-
const [json, setJson] =
|
|
1662
|
-
const [jsonDirty, setJsonDirty] =
|
|
1890
|
+
const [addingFile, setAddingFile] = useState8(false);
|
|
1891
|
+
const [fileEdit, setFileEdit] = useState8(null);
|
|
1892
|
+
const [json, setJson] = useState8(() => JSON.stringify(value, null, 2));
|
|
1893
|
+
const [jsonDirty, setJsonDirty] = useState8(false);
|
|
1663
1894
|
useEffect5(() => {
|
|
1664
1895
|
if (!jsonDirty) setJson(JSON.stringify(value, null, 2));
|
|
1665
1896
|
}, [value, jsonDirty]);
|
|
@@ -1744,9 +1975,9 @@ function AgentProfileEditor({
|
|
|
1744
1975
|
return emit({ ...value, resources: { ...value.resources, files: next } });
|
|
1745
1976
|
}
|
|
1746
1977
|
function fileFields(draft, onChange2) {
|
|
1747
|
-
return /* @__PURE__ */
|
|
1748
|
-
/* @__PURE__ */
|
|
1749
|
-
|
|
1978
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
1979
|
+
/* @__PURE__ */ jsx8(Field, { label: "Workspace path", hint: workspaceFilePrefix ? "Place this file under " + workspaceFilePrefix : "Relative to the agent workspace", children: /* @__PURE__ */ jsx8(
|
|
1980
|
+
Input2,
|
|
1750
1981
|
{
|
|
1751
1982
|
disabled: editingDisabled,
|
|
1752
1983
|
value: draft.path,
|
|
@@ -1754,7 +1985,7 @@ function AgentProfileEditor({
|
|
|
1754
1985
|
placeholder: workspaceFilePrefix ? workspaceFilePrefix + "guide.md" : "docs/guide.md"
|
|
1755
1986
|
}
|
|
1756
1987
|
) }),
|
|
1757
|
-
/* @__PURE__ */
|
|
1988
|
+
/* @__PURE__ */ jsx8(
|
|
1758
1989
|
ResourceFields,
|
|
1759
1990
|
{
|
|
1760
1991
|
draft: draft.resource,
|
|
@@ -1764,8 +1995,8 @@ function AgentProfileEditor({
|
|
|
1764
1995
|
onChange: (resource) => onChange2({ ...draft, resource })
|
|
1765
1996
|
}
|
|
1766
1997
|
),
|
|
1767
|
-
allowExecutableFiles || draft.executable ? /* @__PURE__ */
|
|
1768
|
-
/* @__PURE__ */
|
|
1998
|
+
allowExecutableFiles || draft.executable ? /* @__PURE__ */ jsxs6("label", { className: "flex items-center gap-2 text-sm text-foreground", children: [
|
|
1999
|
+
/* @__PURE__ */ jsx8(
|
|
1769
2000
|
Switch,
|
|
1770
2001
|
{
|
|
1771
2002
|
disabled: editingDisabled || !allowExecutableFiles && !draft.executable,
|
|
@@ -1776,25 +2007,25 @@ function AgentProfileEditor({
|
|
|
1776
2007
|
}
|
|
1777
2008
|
),
|
|
1778
2009
|
"Executable file"
|
|
1779
|
-
] }) : /* @__PURE__ */
|
|
2010
|
+
] }) : /* @__PURE__ */ jsx8("p", { className: "text-xs text-muted-foreground", children: "Executable files are unavailable for this profile." })
|
|
1780
2011
|
] });
|
|
1781
2012
|
}
|
|
1782
2013
|
function resourceSection(key, title, description) {
|
|
1783
2014
|
const refs = value.resources?.[key] ?? [];
|
|
1784
2015
|
const draft = resourceDrafts[key];
|
|
1785
|
-
return /* @__PURE__ */
|
|
1786
|
-
refs.length === 0 && /* @__PURE__ */
|
|
1787
|
-
/* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ jsxs6(Disclosure, { title, description, detail: refs.length ? refs.length + " configured" : "Optional", children: [
|
|
2017
|
+
refs.length === 0 && /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "None configured." }),
|
|
2018
|
+
/* @__PURE__ */ jsx8("ul", { className: "space-y-2", children: refs.map((ref, index) => {
|
|
1788
2019
|
const issue = resourceIssue(key, resourceDraft(ref), refs, index, true);
|
|
1789
|
-
return /* @__PURE__ */
|
|
1790
|
-
/* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */
|
|
1792
|
-
/* @__PURE__ */
|
|
1793
|
-
/* @__PURE__ */
|
|
2020
|
+
return /* @__PURE__ */ jsxs6("li", { className: "space-y-3 rounded-lg border border-border p-3 text-sm", "aria-label": title + " " + (index + 1), children: [
|
|
2021
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
|
|
2022
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
2023
|
+
/* @__PURE__ */ jsx8("span", { className: "block break-words font-medium text-foreground", children: ref.name || (ref.kind === "github" ? ref.path : "Inline resource") }),
|
|
2024
|
+
/* @__PURE__ */ jsx8("span", { className: "block break-words text-xs " + (ref.kind === "github" && !ref.repository ? "text-destructive" : "text-muted-foreground"), children: ref.kind === "github" ? (ref.repository ? ref.repository + " / " : "Repository required \xB7 ") + ref.path + (ref.ref ? " @ " + ref.ref : "") : "Inline content" })
|
|
1794
2025
|
] }),
|
|
1795
|
-
/* @__PURE__ */
|
|
1796
|
-
/* @__PURE__ */
|
|
1797
|
-
|
|
2026
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 gap-1", children: [
|
|
2027
|
+
/* @__PURE__ */ jsx8(
|
|
2028
|
+
Button2,
|
|
1798
2029
|
{
|
|
1799
2030
|
type: "button",
|
|
1800
2031
|
variant: "ghost",
|
|
@@ -1804,8 +2035,8 @@ function AgentProfileEditor({
|
|
|
1804
2035
|
children: "Edit"
|
|
1805
2036
|
}
|
|
1806
2037
|
),
|
|
1807
|
-
/* @__PURE__ */
|
|
1808
|
-
|
|
2038
|
+
/* @__PURE__ */ jsx8(
|
|
2039
|
+
Button2,
|
|
1809
2040
|
{
|
|
1810
2041
|
type: "button",
|
|
1811
2042
|
variant: "ghost",
|
|
@@ -1820,12 +2051,12 @@ function AgentProfileEditor({
|
|
|
1820
2051
|
)
|
|
1821
2052
|
] })
|
|
1822
2053
|
] }),
|
|
1823
|
-
(requireGitHubCommitSha || key === "skills" && requireUniqueSkillNames) && issue && /* @__PURE__ */
|
|
2054
|
+
(requireGitHubCommitSha || key === "skills" && requireUniqueSkillNames) && issue && /* @__PURE__ */ jsxs6("p", { className: "text-xs text-destructive", children: [
|
|
1824
2055
|
issue,
|
|
1825
2056
|
" Edit this resource before saving."
|
|
1826
2057
|
] }),
|
|
1827
|
-
resourceEdit?.key === key && resourceEdit.index === index && /* @__PURE__ */
|
|
1828
|
-
/* @__PURE__ */
|
|
2058
|
+
resourceEdit?.key === key && resourceEdit.index === index && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 border-t border-border pt-3", children: [
|
|
2059
|
+
/* @__PURE__ */ jsx8(
|
|
1829
2060
|
ResourceFields,
|
|
1830
2061
|
{
|
|
1831
2062
|
draft: resourceEdit.draft,
|
|
@@ -1836,15 +2067,25 @@ function AgentProfileEditor({
|
|
|
1836
2067
|
onChange: (next) => setResourceEdit({ key, index, draft: next })
|
|
1837
2068
|
}
|
|
1838
2069
|
),
|
|
1839
|
-
/* @__PURE__ */
|
|
1840
|
-
/* @__PURE__ */
|
|
1841
|
-
/* @__PURE__ */
|
|
2070
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
2071
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "outline", disabled: editingDisabled, onClick: applyResourceEdit, children: "Apply changes" }),
|
|
2072
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", onClick: () => setResourceEdit(null), children: "Cancel" })
|
|
1842
2073
|
] })
|
|
1843
2074
|
] })
|
|
1844
2075
|
] }, index);
|
|
1845
2076
|
}) }),
|
|
1846
|
-
|
|
1847
|
-
|
|
2077
|
+
key === "skills" && registry && /* @__PURE__ */ jsx8(
|
|
2078
|
+
AgentProfileRegistrySkillSearch,
|
|
2079
|
+
{
|
|
2080
|
+
registry,
|
|
2081
|
+
disabled: editingDisabled,
|
|
2082
|
+
existing: refs,
|
|
2083
|
+
validate: (ref) => resourceIssue("skills", resourceDraft(ref), refs),
|
|
2084
|
+
onAdd: (ref) => resources("skills", [...value.resources?.skills ?? [], ref])
|
|
2085
|
+
}
|
|
2086
|
+
),
|
|
2087
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-3 rounded-lg border border-dashed border-border p-3", children: [
|
|
2088
|
+
/* @__PURE__ */ jsx8(
|
|
1848
2089
|
ResourceFields,
|
|
1849
2090
|
{
|
|
1850
2091
|
draft,
|
|
@@ -1855,12 +2096,12 @@ function AgentProfileEditor({
|
|
|
1855
2096
|
onChange: (next) => setResourceDrafts((current) => ({ ...current, [key]: next }))
|
|
1856
2097
|
}
|
|
1857
2098
|
),
|
|
1858
|
-
/* @__PURE__ */
|
|
2099
|
+
/* @__PURE__ */ jsxs6(Button2, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => addResource(key), children: [
|
|
1859
2100
|
"Add ",
|
|
1860
2101
|
key === "skills" ? "skill" : "tool file"
|
|
1861
2102
|
] })
|
|
1862
2103
|
] }),
|
|
1863
|
-
/* @__PURE__ */
|
|
2104
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-muted-foreground", children: "GitHub files are fetched when the profile runs. Saving does not verify their contents or availability." })
|
|
1864
2105
|
] });
|
|
1865
2106
|
}
|
|
1866
2107
|
function addMcp() {
|
|
@@ -1901,37 +2142,37 @@ function AgentProfileEditor({
|
|
|
1901
2142
|
setError(cause instanceof Error ? cause.message : "Invalid JSON");
|
|
1902
2143
|
}
|
|
1903
2144
|
}
|
|
1904
|
-
return /* @__PURE__ */
|
|
1905
|
-
error && /* @__PURE__ */
|
|
1906
|
-
jsonDirty && /* @__PURE__ */
|
|
1907
|
-
unsupportedResources.length > 0 && /* @__PURE__ */
|
|
2145
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-5 " + (className ?? ""), "aria-label": "Agent profile editor", children: [
|
|
2146
|
+
error && /* @__PURE__ */ jsx8("p", { role: "alert", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive", children: error }),
|
|
2147
|
+
jsonDirty && /* @__PURE__ */ jsx8("p", { role: "status", className: "rounded-lg border border-border bg-muted p-3 text-sm text-foreground", children: "Apply or discard edits in Advanced JSON before using the other fields." }),
|
|
2148
|
+
unsupportedResources.length > 0 && /* @__PURE__ */ jsxs6("p", { role: "status", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-foreground", children: [
|
|
1908
2149
|
"This profile contains resources this product does not support: ",
|
|
1909
2150
|
unsupportedResources.map((kind) => RESOURCE_KIND_LABELS[kind] + " (" + configuredResourceCount(value, kind) + ")").join(", "),
|
|
1910
2151
|
". They remain in the profile. Review or remove them in Advanced JSON before saving."
|
|
1911
2152
|
] }),
|
|
1912
|
-
constrainedEntryCount > 0 && /* @__PURE__ */
|
|
2153
|
+
constrainedEntryCount > 0 && /* @__PURE__ */ jsxs6("p", { role: "status", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-foreground", children: [
|
|
1913
2154
|
constrainedEntryCount,
|
|
1914
2155
|
" configured resource ",
|
|
1915
2156
|
constrainedEntryCount === 1 ? "entry needs" : "entries need",
|
|
1916
2157
|
" repair before this product can save the profile. Review the resource sections or Advanced JSON. Existing values remain unchanged until you edit them."
|
|
1917
2158
|
] }),
|
|
1918
|
-
invalidMcpCount > 0 && /* @__PURE__ */
|
|
2159
|
+
invalidMcpCount > 0 && /* @__PURE__ */ jsxs6("p", { role: "status", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-foreground", children: [
|
|
1919
2160
|
invalidMcpCount,
|
|
1920
2161
|
" configured MCP ",
|
|
1921
2162
|
invalidMcpCount === 1 ? "server needs" : "servers need",
|
|
1922
2163
|
" a public HTTPS endpoint before this product can save the profile. Review MCP servers or Advanced JSON. Existing values remain unchanged until you edit them."
|
|
1923
2164
|
] }),
|
|
1924
|
-
/* @__PURE__ */
|
|
1925
|
-
/* @__PURE__ */
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
/* @__PURE__ */
|
|
2165
|
+
/* @__PURE__ */ jsxs6(Section, { title: "Profile", description: "Name the agent and set its instructions.", children: [
|
|
2166
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
2167
|
+
/* @__PURE__ */ jsx8(Field, { label: "Name", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: value.name ?? "", onChange: (event) => emit({ ...value, name: event.target.value }) }) }),
|
|
2168
|
+
/* @__PURE__ */ jsx8(Field, { label: "Description", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: value.description ?? "", onChange: (event) => emit({ ...value, description: event.target.value }) }) })
|
|
1928
2169
|
] }),
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
/* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
1932
|
-
/* @__PURE__ */
|
|
1933
|
-
(value.prompt?.instructions ?? []).map((instruction, index) => /* @__PURE__ */
|
|
1934
|
-
/* @__PURE__ */
|
|
2170
|
+
/* @__PURE__ */ jsxs6("div", { role: "group", "aria-label": "Agent instructions", className: "space-y-2", children: [
|
|
2171
|
+
/* @__PURE__ */ jsx8("p", { className: "text-sm font-medium text-foreground", children: "Agent instructions" }),
|
|
2172
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-muted-foreground", children: "Project-level instructions. Each entry remains separate." }),
|
|
2173
|
+
/* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
|
|
2174
|
+
(value.prompt?.instructions ?? []).map((instruction, index) => /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-2", children: [
|
|
2175
|
+
/* @__PURE__ */ jsx8(
|
|
1935
2176
|
Textarea,
|
|
1936
2177
|
{
|
|
1937
2178
|
"aria-label": "Instruction " + (index + 1),
|
|
@@ -1941,8 +2182,8 @@ function AgentProfileEditor({
|
|
|
1941
2182
|
onChange: (event) => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).map((item, i) => i === index ? event.target.value : item) })
|
|
1942
2183
|
}
|
|
1943
2184
|
),
|
|
1944
|
-
/* @__PURE__ */
|
|
1945
|
-
|
|
2185
|
+
/* @__PURE__ */ jsx8(
|
|
2186
|
+
Button2,
|
|
1946
2187
|
{
|
|
1947
2188
|
type: "button",
|
|
1948
2189
|
variant: "ghost",
|
|
@@ -1954,35 +2195,35 @@ function AgentProfileEditor({
|
|
|
1954
2195
|
}
|
|
1955
2196
|
)
|
|
1956
2197
|
] }, index)),
|
|
1957
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => prompt({ ...value.prompt, instructions: [...value.prompt?.instructions ?? [], ""] }), children: "Add instruction" })
|
|
1958
2199
|
] })
|
|
1959
2200
|
] }),
|
|
1960
|
-
/* @__PURE__ */
|
|
1961
|
-
/* @__PURE__ */
|
|
1962
|
-
/* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
1964
|
-
/* @__PURE__ */
|
|
2201
|
+
/* @__PURE__ */ jsxs6("details", { className: "rounded-lg border border-border p-3", children: [
|
|
2202
|
+
/* @__PURE__ */ jsx8("summary", { className: "cursor-pointer font-medium text-foreground", children: "System prompt overrides" }),
|
|
2203
|
+
/* @__PURE__ */ jsxs6("div", { className: "mt-4 space-y-4", children: [
|
|
2204
|
+
/* @__PURE__ */ jsx8(Field, { label: "Append to system prompt", hint: "Keeps the harness system prompt and adds this text.", children: /* @__PURE__ */ jsx8(Textarea, { className: "min-h-24", disabled: editingDisabled, value: value.prompt?.appendSystemPrompt ?? "", onChange: (event) => prompt({ ...value.prompt, appendSystemPrompt: event.target.value }) }) }),
|
|
2205
|
+
/* @__PURE__ */ jsx8(Field, { label: "Replace system prompt", hint: "Only use when the harness supports full replacement.", children: /* @__PURE__ */ jsx8(Textarea, { className: "min-h-24", disabled: editingDisabled, value: value.prompt?.systemPrompt ?? "", onChange: (event) => prompt({ ...value.prompt, systemPrompt: event.target.value }) }) })
|
|
1965
2206
|
] })
|
|
1966
2207
|
] })
|
|
1967
2208
|
] }),
|
|
1968
|
-
/* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
/* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
/* @__PURE__ */
|
|
2209
|
+
/* @__PURE__ */ jsxs6(Section, { title: "Model", description: "Set model preferences. The host decides which models can run.", children: [
|
|
2210
|
+
/* @__PURE__ */ jsx8("div", { className: "grid gap-4 sm:grid-cols-2", children: /* @__PURE__ */ jsx8(Field, { label: "Default model", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: value.model?.default ?? "", onChange: (event) => model({ ...value.model, default: event.target.value }), placeholder: "provider/model" }) }) }),
|
|
2211
|
+
/* @__PURE__ */ jsxs6("details", { className: "rounded-lg border border-border p-3", children: [
|
|
2212
|
+
/* @__PURE__ */ jsx8("summary", { className: "cursor-pointer font-medium text-foreground", children: "More model settings" }),
|
|
2213
|
+
/* @__PURE__ */ jsxs6("div", { className: "mt-4 grid gap-4 sm:grid-cols-2", children: [
|
|
2214
|
+
/* @__PURE__ */ jsx8(Field, { label: "Small model", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: value.model?.small ?? "", onChange: (event) => model({ ...value.model, small: event.target.value }), placeholder: "provider/model" }) }),
|
|
2215
|
+
/* @__PURE__ */ jsx8(Field, { label: "Provider hint", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: value.model?.provider ?? "", onChange: (event) => model({ ...value.model, provider: event.target.value }) }) }),
|
|
2216
|
+
/* @__PURE__ */ jsx8(Field, { label: "Thinking level", children: /* @__PURE__ */ jsxs6(
|
|
1976
2217
|
Select,
|
|
1977
2218
|
{
|
|
1978
2219
|
disabled: editingDisabled,
|
|
1979
2220
|
value: value.model?.reasoningEffort ?? "default",
|
|
1980
2221
|
onValueChange: (level) => model({ ...value.model, reasoningEffort: level === "default" ? void 0 : level }),
|
|
1981
2222
|
children: [
|
|
1982
|
-
/* @__PURE__ */
|
|
1983
|
-
/* @__PURE__ */
|
|
1984
|
-
/* @__PURE__ */
|
|
1985
|
-
["none", "minimal", "low", "medium", "high", "xhigh", "ultracode"].map((level) => /* @__PURE__ */
|
|
2223
|
+
/* @__PURE__ */ jsx8(SelectTrigger, { "aria-label": "Thinking level", children: /* @__PURE__ */ jsx8(SelectValue, {}) }),
|
|
2224
|
+
/* @__PURE__ */ jsxs6(SelectContent, { children: [
|
|
2225
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "default", children: "Harness default" }),
|
|
2226
|
+
["none", "minimal", "low", "medium", "high", "xhigh", "ultracode"].map((level) => /* @__PURE__ */ jsx8(SelectItem, { value: level, children: level }, level))
|
|
1986
2227
|
] })
|
|
1987
2228
|
]
|
|
1988
2229
|
}
|
|
@@ -1990,11 +2231,11 @@ function AgentProfileEditor({
|
|
|
1990
2231
|
] })
|
|
1991
2232
|
] })
|
|
1992
2233
|
] }),
|
|
1993
|
-
showToolsAndPermissions && /* @__PURE__ */
|
|
1994
|
-
Object.keys(value.tools ?? {}).length === 0 && /* @__PURE__ */
|
|
1995
|
-
/* @__PURE__ */
|
|
1996
|
-
/* @__PURE__ */
|
|
1997
|
-
/* @__PURE__ */
|
|
2234
|
+
showToolsAndPermissions && /* @__PURE__ */ jsxs6(Disclosure, { title: "Tools and permissions", description: "Choose which tools are available and when each needs approval.", detail: Object.keys(value.tools ?? {}).length + " configured", children: [
|
|
2235
|
+
Object.keys(value.tools ?? {}).length === 0 && /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "No tool rules added." }),
|
|
2236
|
+
/* @__PURE__ */ jsx8("div", { className: "space-y-2", children: Object.entries(value.tools ?? {}).slice(0, showAllTools ? void 0 : 4).map(([name, enabled]) => /* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-border p-3 text-sm", children: [
|
|
2237
|
+
/* @__PURE__ */ jsxs6("label", { className: "flex min-w-32 flex-1 items-center gap-2", children: [
|
|
2238
|
+
/* @__PURE__ */ jsx8(
|
|
1998
2239
|
Switch,
|
|
1999
2240
|
{
|
|
2000
2241
|
disabled: editingDisabled,
|
|
@@ -2004,9 +2245,9 @@ function AgentProfileEditor({
|
|
|
2004
2245
|
),
|
|
2005
2246
|
name
|
|
2006
2247
|
] }),
|
|
2007
|
-
/* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2009
|
-
/* @__PURE__ */
|
|
2248
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex min-w-36 items-center gap-2 text-muted-foreground", children: [
|
|
2249
|
+
/* @__PURE__ */ jsx8("span", { children: "Permission" }),
|
|
2250
|
+
/* @__PURE__ */ jsxs6(
|
|
2010
2251
|
Select,
|
|
2011
2252
|
{
|
|
2012
2253
|
disabled: editingDisabled,
|
|
@@ -2018,27 +2259,27 @@ function AgentProfileEditor({
|
|
|
2018
2259
|
emit({ ...value, permissions });
|
|
2019
2260
|
},
|
|
2020
2261
|
children: [
|
|
2021
|
-
/* @__PURE__ */
|
|
2022
|
-
/* @__PURE__ */
|
|
2023
|
-
/* @__PURE__ */
|
|
2024
|
-
/* @__PURE__ */
|
|
2025
|
-
/* @__PURE__ */
|
|
2026
|
-
/* @__PURE__ */
|
|
2262
|
+
/* @__PURE__ */ jsx8(SelectTrigger, { "aria-label": "Permission for " + name, children: /* @__PURE__ */ jsx8(SelectValue, {}) }),
|
|
2263
|
+
/* @__PURE__ */ jsxs6(SelectContent, { children: [
|
|
2264
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "default", children: "Default" }),
|
|
2265
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "allow", children: "Allow" }),
|
|
2266
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "ask", children: "Ask" }),
|
|
2267
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "deny", children: "Deny" })
|
|
2027
2268
|
] })
|
|
2028
2269
|
]
|
|
2029
2270
|
}
|
|
2030
2271
|
)
|
|
2031
2272
|
] }),
|
|
2032
|
-
/* @__PURE__ */
|
|
2273
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", className: "text-destructive", disabled: editingDisabled, onClick: () => {
|
|
2033
2274
|
const tools = { ...value.tools };
|
|
2034
2275
|
delete tools[name];
|
|
2035
2276
|
emit({ ...value, tools });
|
|
2036
2277
|
}, children: "Remove" })
|
|
2037
2278
|
] }, name)) }),
|
|
2038
|
-
Object.keys(value.tools ?? {}).length > 4 && /* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2040
|
-
/* @__PURE__ */
|
|
2041
|
-
/* @__PURE__ */
|
|
2279
|
+
Object.keys(value.tools ?? {}).length > 4 && /* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", onClick: () => setShowAllTools((current) => !current), children: showAllTools ? "Show fewer rules" : "Show " + (Object.keys(value.tools ?? {}).length - 4) + " more rules" }),
|
|
2280
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
2281
|
+
/* @__PURE__ */ jsx8(Input2, { "aria-label": "New tool name", disabled: editingDisabled, value: newTool, onChange: (event) => setNewTool(event.target.value), placeholder: "Tool name" }),
|
|
2282
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => {
|
|
2042
2283
|
const name = newTool.trim();
|
|
2043
2284
|
if (!name || name in (value.tools ?? {})) {
|
|
2044
2285
|
setError("Enter a unique tool name.");
|
|
@@ -2047,59 +2288,73 @@ function AgentProfileEditor({
|
|
|
2047
2288
|
if (emit({ ...value, tools: { ...value.tools, [name]: true } })) setNewTool("");
|
|
2048
2289
|
}, children: "Add tool" })
|
|
2049
2290
|
] }),
|
|
2050
|
-
/* @__PURE__ */
|
|
2291
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-muted-foreground", children: "Nested permission rules remain in Advanced JSON." })
|
|
2051
2292
|
] }),
|
|
2052
2293
|
allowsResource("skills") && resourceSection("skills", "Skills", "Add skill packages from a repository or inline content."),
|
|
2053
2294
|
allowsResource("tools") && resourceSection("tools", "Tool files", "Provide files that a supported harness can discover as tools."),
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
Object.keys(value.mcp ?? {}).length === 0 && /* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
/* @__PURE__ */
|
|
2059
|
-
/* @__PURE__ */
|
|
2060
|
-
server.enabled !== false && /* @__PURE__ */
|
|
2061
|
-
publicHttpsMcpOnly && publicHttpsMcpError(server) && /* @__PURE__ */
|
|
2295
|
+
/* @__PURE__ */ jsxs6(Disclosure, { title: "MCP servers", description: publicHttpsMcpOnly ? "Configure public HTTPS servers. Use secret references for credentials." : "Configure remote or local servers. Use secret references for credentials.", detail: Object.keys(value.mcp ?? {}).length + " configured", children: [
|
|
2296
|
+
Object.keys(value.mcp ?? {}).length === 0 && /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "No servers configured." }),
|
|
2297
|
+
/* @__PURE__ */ jsx8("ul", { className: "space-y-2", children: Object.entries(value.mcp ?? {}).map(([name, server]) => /* @__PURE__ */ jsxs6("li", { className: "flex items-center justify-between gap-3 rounded-lg border border-border p-3 text-sm", children: [
|
|
2298
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
2299
|
+
/* @__PURE__ */ jsx8("span", { className: "font-medium", children: name }),
|
|
2300
|
+
/* @__PURE__ */ jsx8("span", { className: "ml-2 text-xs text-muted-foreground", children: server.enabled === false ? "Disabled" : "command" in server ? "Local" : "Remote" }),
|
|
2301
|
+
server.enabled !== false && /* @__PURE__ */ jsx8("p", { className: "truncate text-xs text-muted-foreground", children: "command" in server ? server.command : server.url }),
|
|
2302
|
+
publicHttpsMcpOnly && publicHttpsMcpError(server) && /* @__PURE__ */ jsxs6("p", { className: "text-xs text-destructive", children: [
|
|
2062
2303
|
publicHttpsMcpError(server),
|
|
2063
2304
|
" Remove this server or edit it in Advanced JSON before saving."
|
|
2064
2305
|
] })
|
|
2065
2306
|
] }),
|
|
2066
|
-
/* @__PURE__ */
|
|
2307
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", className: "text-destructive", disabled: editingDisabled, onClick: () => {
|
|
2067
2308
|
const mcp = { ...value.mcp };
|
|
2068
2309
|
delete mcp[name];
|
|
2069
2310
|
emit({ ...value, mcp });
|
|
2070
2311
|
}, children: "Remove" })
|
|
2071
2312
|
] }, name)) }),
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2077
|
-
/* @__PURE__ */
|
|
2078
|
-
/* @__PURE__ */
|
|
2079
|
-
!publicHttpsMcpOnly && /* @__PURE__ */
|
|
2313
|
+
/* @__PURE__ */ jsxs6("div", { className: "grid gap-3 rounded-lg border border-dashed border-border p-3 sm:grid-cols-[1fr_10rem]", children: [
|
|
2314
|
+
/* @__PURE__ */ jsx8(Field, { label: "Server name", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: mcpName, onChange: (event) => setMcpName(event.target.value), placeholder: "search" }) }),
|
|
2315
|
+
/* @__PURE__ */ jsx8(Field, { label: "Transport", children: /* @__PURE__ */ jsxs6(Select, { disabled: editingDisabled, value: selectedMcpKind, onValueChange: (kind) => setMcpKind(kind), children: [
|
|
2316
|
+
/* @__PURE__ */ jsx8(SelectTrigger, { "aria-label": "Transport", children: /* @__PURE__ */ jsx8(SelectValue, {}) }),
|
|
2317
|
+
/* @__PURE__ */ jsxs6(SelectContent, { children: [
|
|
2318
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "http", children: "HTTP" }),
|
|
2319
|
+
/* @__PURE__ */ jsx8(SelectItem, { value: "sse", children: "SSE" }),
|
|
2320
|
+
!publicHttpsMcpOnly && /* @__PURE__ */ jsx8(SelectItem, { value: "stdio", children: "Local command" })
|
|
2080
2321
|
] })
|
|
2081
2322
|
] }) }),
|
|
2082
|
-
/* @__PURE__ */
|
|
2083
|
-
/* @__PURE__ */
|
|
2323
|
+
/* @__PURE__ */ jsx8("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx8(Field, { label: selectedMcpKind === "stdio" ? "Command" : "URL", children: /* @__PURE__ */ jsx8(Input2, { disabled: editingDisabled, value: mcpTarget, onChange: (event) => setMcpTarget(event.target.value), placeholder: selectedMcpKind === "stdio" ? "mcp-server" : "https://example.com/mcp" }) }) }),
|
|
2324
|
+
/* @__PURE__ */ jsx8("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx8(Button2, { type: "button", variant: "outline", disabled: editingDisabled, onClick: addMcp, children: "Add server" }) })
|
|
2084
2325
|
] }),
|
|
2085
|
-
/* @__PURE__ */
|
|
2326
|
+
registry && /* @__PURE__ */ jsx8(
|
|
2327
|
+
AgentProfileRegistryMcpSearch,
|
|
2328
|
+
{
|
|
2329
|
+
registry,
|
|
2330
|
+
disabled: editingDisabled,
|
|
2331
|
+
existingNames: Object.keys(value.mcp ?? {}),
|
|
2332
|
+
validate: (name, server) => {
|
|
2333
|
+
if (!name.trim()) return "The registry returned a server without a usable name.";
|
|
2334
|
+
if (name in (value.mcp ?? {})) return "A server with that name already exists.";
|
|
2335
|
+
return publicHttpsMcpOnly ? publicHttpsMcpError(server) : null;
|
|
2336
|
+
},
|
|
2337
|
+
onAdd: (name, server) => emit({ ...value, mcp: { ...value.mcp, [name]: server } })
|
|
2338
|
+
}
|
|
2339
|
+
),
|
|
2340
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-muted-foreground", children: "Arguments, headers, environment, and secret references remain in Advanced JSON." })
|
|
2086
2341
|
] }),
|
|
2087
|
-
allowsResource("files") && /* @__PURE__ */
|
|
2088
|
-
(value.resources?.files ?? []).length === 0 && /* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2342
|
+
allowsResource("files") && /* @__PURE__ */ jsxs6(Disclosure, { title: "Resource files", description: "Configure files for the agent workspace. The runtime determines whether it can place them.", detail: (value.resources?.files ?? []).length + " configured", children: [
|
|
2343
|
+
(value.resources?.files ?? []).length === 0 && /* @__PURE__ */ jsx8("p", { className: "text-sm text-muted-foreground", children: "No resource files configured." }),
|
|
2344
|
+
/* @__PURE__ */ jsx8("ul", { className: "space-y-2", children: (value.resources?.files ?? []).map((mount, index) => {
|
|
2090
2345
|
const issues = fileIssues(fileDraft(mount), workspaceFilePrefix, allowExecutableFiles, requireGitHubCommitSha, true);
|
|
2091
|
-
return /* @__PURE__ */
|
|
2092
|
-
/* @__PURE__ */
|
|
2093
|
-
/* @__PURE__ */
|
|
2094
|
-
/* @__PURE__ */
|
|
2095
|
-
/* @__PURE__ */
|
|
2346
|
+
return /* @__PURE__ */ jsxs6("li", { className: "space-y-3 rounded-lg border border-border p-3 text-sm", "aria-label": "Resource file " + (index + 1), children: [
|
|
2347
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
|
|
2348
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
2349
|
+
/* @__PURE__ */ jsx8("span", { className: "block break-words font-medium text-foreground", children: mount.path }),
|
|
2350
|
+
/* @__PURE__ */ jsxs6("span", { className: "block break-words text-xs " + (mount.resource.kind === "github" && !mount.resource.repository ? "text-destructive" : "text-muted-foreground"), children: [
|
|
2096
2351
|
mount.resource.kind === "github" ? (mount.resource.repository ? mount.resource.repository + " / " : "Repository required \xB7 ") + mount.resource.path + (mount.resource.ref ? " @ " + mount.resource.ref : "") : "Inline \xB7 " + mount.resource.name,
|
|
2097
2352
|
mount.executable ? " \xB7 executable" : ""
|
|
2098
2353
|
] })
|
|
2099
2354
|
] }),
|
|
2100
|
-
/* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
|
|
2355
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex shrink-0 gap-1", children: [
|
|
2356
|
+
/* @__PURE__ */ jsx8(
|
|
2357
|
+
Button2,
|
|
2103
2358
|
{
|
|
2104
2359
|
type: "button",
|
|
2105
2360
|
variant: "ghost",
|
|
@@ -2109,8 +2364,8 @@ function AgentProfileEditor({
|
|
|
2109
2364
|
children: "Edit"
|
|
2110
2365
|
}
|
|
2111
2366
|
),
|
|
2112
|
-
/* @__PURE__ */
|
|
2113
|
-
|
|
2367
|
+
/* @__PURE__ */ jsx8(
|
|
2368
|
+
Button2,
|
|
2114
2369
|
{
|
|
2115
2370
|
type: "button",
|
|
2116
2371
|
variant: "ghost",
|
|
@@ -2125,16 +2380,16 @@ function AgentProfileEditor({
|
|
|
2125
2380
|
)
|
|
2126
2381
|
] })
|
|
2127
2382
|
] }),
|
|
2128
|
-
issues.length > 0 && /* @__PURE__ */
|
|
2383
|
+
issues.length > 0 && /* @__PURE__ */ jsx8("div", { className: "space-y-1 text-xs text-destructive", children: issues.map((issue) => /* @__PURE__ */ jsxs6("p", { children: [
|
|
2129
2384
|
issue,
|
|
2130
2385
|
" Edit this file before saving."
|
|
2131
2386
|
] }, issue)) }),
|
|
2132
|
-
mount.resource.kind === "inline" && fileEdit?.index !== index && /* @__PURE__ */
|
|
2133
|
-
fileEdit?.index === index && /* @__PURE__ */
|
|
2387
|
+
mount.resource.kind === "inline" && fileEdit?.index !== index && /* @__PURE__ */ jsx8("pre", { className: "max-h-24 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted p-2 text-xs text-muted-foreground", children: mount.resource.content || "(Empty file)" }),
|
|
2388
|
+
fileEdit?.index === index && /* @__PURE__ */ jsxs6("div", { className: "space-y-3 border-t border-border pt-3", children: [
|
|
2134
2389
|
fileFields(fileEdit.draft, (draft) => setFileEdit({ index, draft })),
|
|
2135
|
-
/* @__PURE__ */
|
|
2136
|
-
/* @__PURE__ */
|
|
2137
|
-
|
|
2390
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
2391
|
+
/* @__PURE__ */ jsx8(
|
|
2392
|
+
Button2,
|
|
2138
2393
|
{
|
|
2139
2394
|
type: "button",
|
|
2140
2395
|
variant: "outline",
|
|
@@ -2145,16 +2400,16 @@ function AgentProfileEditor({
|
|
|
2145
2400
|
children: "Apply changes"
|
|
2146
2401
|
}
|
|
2147
2402
|
),
|
|
2148
|
-
/* @__PURE__ */
|
|
2403
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", onClick: () => setFileEdit(null), children: "Cancel" })
|
|
2149
2404
|
] })
|
|
2150
2405
|
] })
|
|
2151
2406
|
] }, index);
|
|
2152
2407
|
}) }),
|
|
2153
|
-
addingFile ? /* @__PURE__ */
|
|
2408
|
+
addingFile ? /* @__PURE__ */ jsxs6("div", { className: "space-y-3 rounded-lg border border-dashed border-border p-3", children: [
|
|
2154
2409
|
fileFields(newFile, setNewFile),
|
|
2155
|
-
/* @__PURE__ */
|
|
2156
|
-
/* @__PURE__ */
|
|
2157
|
-
|
|
2410
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex gap-2", children: [
|
|
2411
|
+
/* @__PURE__ */ jsx8(
|
|
2412
|
+
Button2,
|
|
2158
2413
|
{
|
|
2159
2414
|
type: "button",
|
|
2160
2415
|
variant: "outline",
|
|
@@ -2168,31 +2423,31 @@ function AgentProfileEditor({
|
|
|
2168
2423
|
children: "Add file"
|
|
2169
2424
|
}
|
|
2170
2425
|
),
|
|
2171
|
-
/* @__PURE__ */
|
|
2426
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", onClick: () => setAddingFile(false), children: "Cancel" })
|
|
2172
2427
|
] })
|
|
2173
|
-
] }) : /* @__PURE__ */
|
|
2428
|
+
] }) : /* @__PURE__ */ jsx8(Button2, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => setAddingFile(true), children: "Add file" })
|
|
2174
2429
|
] }),
|
|
2175
|
-
/* @__PURE__ */
|
|
2176
|
-
/* @__PURE__ */
|
|
2177
|
-
/* @__PURE__ */
|
|
2430
|
+
/* @__PURE__ */ jsxs6(Disclosure, { title: "Advanced JSON", description: "Edit the full canonical profile, including hooks, modes, connections, and extensions.", children: [
|
|
2431
|
+
/* @__PURE__ */ jsx8("label", { htmlFor: id + "-json", className: "sr-only", children: "Full profile JSON" }),
|
|
2432
|
+
/* @__PURE__ */ jsx8(Textarea, { id: id + "-json", className: "min-h-72 font-mono text-xs", spellCheck: false, disabled, value: json, onChange: (event) => {
|
|
2178
2433
|
setJson(event.target.value);
|
|
2179
2434
|
setJsonDirty(true);
|
|
2180
2435
|
} }),
|
|
2181
|
-
/* @__PURE__ */
|
|
2182
|
-
/* @__PURE__ */
|
|
2183
|
-
jsonDirty && /* @__PURE__ */
|
|
2436
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
2437
|
+
/* @__PURE__ */ jsx8(Button2, { type: "button", variant: "outline", disabled: disabled || !jsonDirty, onClick: applyJson, children: "Apply JSON" }),
|
|
2438
|
+
jsonDirty && /* @__PURE__ */ jsx8(Button2, { type: "button", variant: "ghost", className: "text-destructive", disabled, onClick: () => {
|
|
2184
2439
|
setJson(JSON.stringify(value, null, 2));
|
|
2185
2440
|
setJsonDirty(false);
|
|
2186
2441
|
setError(null);
|
|
2187
2442
|
}, children: "Discard JSON edits" })
|
|
2188
2443
|
] }),
|
|
2189
|
-
/* @__PURE__ */
|
|
2444
|
+
/* @__PURE__ */ jsx8("p", { className: "text-xs text-muted-foreground", children: "Profiles are public configuration. Store credentials in a vault and reference them by secret key." })
|
|
2190
2445
|
] })
|
|
2191
2446
|
] });
|
|
2192
2447
|
}
|
|
2193
2448
|
|
|
2194
2449
|
// src/web-react/agent-profile-viewer.tsx
|
|
2195
|
-
import { jsx as
|
|
2450
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2196
2451
|
function nonempty(value) {
|
|
2197
2452
|
return Boolean(value?.trim());
|
|
2198
2453
|
}
|
|
@@ -2206,38 +2461,38 @@ function resourceName(resource) {
|
|
|
2206
2461
|
}
|
|
2207
2462
|
function ResourceRow({ label, resource, path }) {
|
|
2208
2463
|
const name = resourceName(resource);
|
|
2209
|
-
return /* @__PURE__ */
|
|
2210
|
-
/* @__PURE__ */
|
|
2211
|
-
/* @__PURE__ */
|
|
2212
|
-
path && /* @__PURE__ */
|
|
2213
|
-
/* @__PURE__ */
|
|
2214
|
-
resource.kind === "github" && resource.ref && /* @__PURE__ */
|
|
2464
|
+
return /* @__PURE__ */ jsxs7("li", { className: "min-w-0 py-2 first:pt-0 last:pb-0", children: [
|
|
2465
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-0.5", children: [
|
|
2466
|
+
/* @__PURE__ */ jsx9("span", { className: "shrink-0 text-xs font-medium text-muted-foreground", children: label }),
|
|
2467
|
+
path && /* @__PURE__ */ jsx9("code", { className: "break-all font-mono text-xs text-foreground", children: path }),
|
|
2468
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 break-all text-sm text-foreground", children: name }),
|
|
2469
|
+
resource.kind === "github" && resource.ref && /* @__PURE__ */ jsxs7("span", { className: "shrink-0 text-xs text-muted-foreground", children: [
|
|
2215
2470
|
"at ",
|
|
2216
2471
|
resource.ref
|
|
2217
2472
|
] })
|
|
2218
2473
|
] }),
|
|
2219
|
-
resource.kind === "inline" && nonempty(resource.content) && /* @__PURE__ */
|
|
2220
|
-
/* @__PURE__ */
|
|
2221
|
-
/* @__PURE__ */
|
|
2474
|
+
resource.kind === "inline" && nonempty(resource.content) && /* @__PURE__ */ jsxs7("details", { className: "mt-1.5", children: [
|
|
2475
|
+
/* @__PURE__ */ jsx9("summary", { className: "w-fit cursor-pointer select-none text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", children: "View inline content" }),
|
|
2476
|
+
/* @__PURE__ */ jsx9("pre", { className: "mt-2 max-h-64 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 p-3 text-xs leading-relaxed text-foreground", children: resource.content })
|
|
2222
2477
|
] })
|
|
2223
2478
|
] });
|
|
2224
2479
|
}
|
|
2225
2480
|
function PromptDetail({ label, note, value }) {
|
|
2226
|
-
return /* @__PURE__ */
|
|
2227
|
-
/* @__PURE__ */
|
|
2228
|
-
/* @__PURE__ */
|
|
2229
|
-
/* @__PURE__ */
|
|
2230
|
-
/* @__PURE__ */
|
|
2231
|
-
note && /* @__PURE__ */
|
|
2232
|
-
/* @__PURE__ */
|
|
2481
|
+
return /* @__PURE__ */ jsxs7("details", { className: "group/prompt min-w-0", children: [
|
|
2482
|
+
/* @__PURE__ */ jsxs7("summary", { className: "flex min-w-0 cursor-pointer list-none items-start gap-2 rounded-md py-1 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", children: [
|
|
2483
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "mt-1 shrink-0 text-muted-foreground transition-transform group-open/prompt:rotate-90", children: "\u203A" }),
|
|
2484
|
+
/* @__PURE__ */ jsxs7("span", { className: "min-w-0 flex-1", children: [
|
|
2485
|
+
/* @__PURE__ */ jsx9("span", { className: "font-medium text-foreground", children: label }),
|
|
2486
|
+
note && /* @__PURE__ */ jsx9("span", { className: "ml-2 text-xs text-muted-foreground", children: note }),
|
|
2487
|
+
/* @__PURE__ */ jsx9("span", { className: "mt-1 block truncate text-xs text-muted-foreground", children: preview(value) })
|
|
2233
2488
|
] })
|
|
2234
2489
|
] }),
|
|
2235
|
-
/* @__PURE__ */
|
|
2490
|
+
/* @__PURE__ */ jsx9("pre", { className: "mb-2 ml-4 max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted/50 p-3 text-sm leading-relaxed text-foreground", children: value })
|
|
2236
2491
|
] });
|
|
2237
2492
|
}
|
|
2238
2493
|
function ProfileSection({ title, children }) {
|
|
2239
|
-
return /* @__PURE__ */
|
|
2240
|
-
/* @__PURE__ */
|
|
2494
|
+
return /* @__PURE__ */ jsxs7("section", { className: "min-w-0 py-3 first:pt-0 last:pb-0", "aria-label": title, children: [
|
|
2495
|
+
/* @__PURE__ */ jsx9("h3", { className: "mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
|
|
2241
2496
|
children
|
|
2242
2497
|
] });
|
|
2243
2498
|
}
|
|
@@ -2290,45 +2545,45 @@ function AgentProfileViewer({ profile, className = "", defaultExpanded = true })
|
|
|
2290
2545
|
const hasBehavior = Boolean(nonempty(prompt?.systemPrompt) || nonempty(prompt?.appendSystemPrompt) || instructions.length || (typeof resourceInstructions === "string" ? nonempty(resourceInstructions) : resourceInstructions));
|
|
2291
2546
|
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);
|
|
2292
2547
|
const hasProfileDetails = Boolean(profile.model?.default || profile.model?.small || profile.model?.reasoningEffort || profile.harness || profile.description || profile.version || profile.tags?.length || hasConfiguration);
|
|
2293
|
-
return /* @__PURE__ */
|
|
2294
|
-
/* @__PURE__ */
|
|
2295
|
-
/* @__PURE__ */
|
|
2296
|
-
nonempty(profile.description) && /* @__PURE__ */
|
|
2297
|
-
(profile.model?.default || profile.model?.small || profile.model?.reasoningEffort || profile.harness || profile.version || profile.tags?.length) && /* @__PURE__ */
|
|
2298
|
-
profile.model?.default && /* @__PURE__ */
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2548
|
+
return /* @__PURE__ */ jsxs7("section", { className: `min-w-0 text-sm ${className}`.trim(), "aria-label": "Agent profile", children: [
|
|
2549
|
+
/* @__PURE__ */ jsxs7("header", { className: "min-w-0 rounded-xl border border-border bg-card p-4 shadow-sm", children: [
|
|
2550
|
+
/* @__PURE__ */ jsx9("h2", { className: "break-words text-lg font-semibold leading-tight text-foreground", children: nonempty(profile.name) ? profile.name : "Unnamed profile" }),
|
|
2551
|
+
nonempty(profile.description) && /* @__PURE__ */ jsx9("p", { className: "mt-1 whitespace-pre-wrap break-words leading-relaxed text-muted-foreground", children: profile.description }),
|
|
2552
|
+
(profile.model?.default || profile.model?.small || profile.model?.reasoningEffort || profile.harness || profile.version || profile.tags?.length) && /* @__PURE__ */ jsxs7("dl", { className: "mt-3 flex flex-wrap gap-x-4 gap-y-1 text-xs", children: [
|
|
2553
|
+
profile.model?.default && /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
|
|
2554
|
+
/* @__PURE__ */ jsx9("dt", { className: "text-muted-foreground", children: "Default model" }),
|
|
2555
|
+
/* @__PURE__ */ jsx9("dd", { className: "font-medium text-foreground", children: profile.model.default })
|
|
2301
2556
|
] }),
|
|
2302
|
-
profile.model?.small && /* @__PURE__ */
|
|
2303
|
-
/* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2557
|
+
profile.model?.small && /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
|
|
2558
|
+
/* @__PURE__ */ jsx9("dt", { className: "text-muted-foreground", children: "Small model" }),
|
|
2559
|
+
/* @__PURE__ */ jsx9("dd", { className: "font-medium text-foreground", children: profile.model.small })
|
|
2305
2560
|
] }),
|
|
2306
|
-
profile.model?.reasoningEffort && /* @__PURE__ */
|
|
2307
|
-
/* @__PURE__ */
|
|
2308
|
-
/* @__PURE__ */
|
|
2561
|
+
profile.model?.reasoningEffort && /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
|
|
2562
|
+
/* @__PURE__ */ jsx9("dt", { className: "text-muted-foreground", children: "Reasoning" }),
|
|
2563
|
+
/* @__PURE__ */ jsx9("dd", { className: "font-medium text-foreground", children: profile.model.reasoningEffort })
|
|
2309
2564
|
] }),
|
|
2310
|
-
profile.harness && /* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2312
|
-
/* @__PURE__ */
|
|
2565
|
+
profile.harness && /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
|
|
2566
|
+
/* @__PURE__ */ jsx9("dt", { className: "text-muted-foreground", children: "Preferred harness" }),
|
|
2567
|
+
/* @__PURE__ */ jsx9("dd", { className: "font-medium text-foreground", children: profile.harness })
|
|
2313
2568
|
] }),
|
|
2314
|
-
profile.version && /* @__PURE__ */
|
|
2315
|
-
/* @__PURE__ */
|
|
2316
|
-
/* @__PURE__ */
|
|
2569
|
+
profile.version && /* @__PURE__ */ jsxs7("div", { className: "flex gap-1", children: [
|
|
2570
|
+
/* @__PURE__ */ jsx9("dt", { className: "text-muted-foreground", children: "Version" }),
|
|
2571
|
+
/* @__PURE__ */ jsx9("dd", { className: "font-medium text-foreground", children: profile.version })
|
|
2317
2572
|
] }),
|
|
2318
|
-
profile.tags?.map((tag) => /* @__PURE__ */
|
|
2573
|
+
profile.tags?.map((tag) => /* @__PURE__ */ jsx9("div", { className: "rounded-full bg-muted px-2 py-0.5 text-muted-foreground", children: tag }, tag))
|
|
2319
2574
|
] })
|
|
2320
2575
|
] }),
|
|
2321
|
-
!hasProfileDetails && /* @__PURE__ */
|
|
2322
|
-
hasConfiguration && /* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
2324
|
-
/* @__PURE__ */
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
2576
|
+
!hasProfileDetails && /* @__PURE__ */ jsx9("p", { className: "mt-4 border-t border-border pt-3 text-sm text-muted-foreground", children: "No profile details are configured." }),
|
|
2577
|
+
hasConfiguration && /* @__PURE__ */ jsxs7("details", { open: defaultExpanded, className: "group/config mt-4 rounded-xl border border-border bg-card p-4 shadow-sm", children: [
|
|
2578
|
+
/* @__PURE__ */ jsxs7("summary", { className: "flex cursor-pointer list-none items-center gap-2 rounded-md py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring [&::-webkit-details-marker]:hidden", children: [
|
|
2579
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": "true", className: "text-muted-foreground transition-transform group-open/config:rotate-90", children: "\u203A" }),
|
|
2580
|
+
/* @__PURE__ */ jsx9("span", { className: "font-medium text-foreground", children: "Profile configuration" }),
|
|
2581
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: [hasBehavior && "Instructions", (tools.length || permissions.length) > 0 && "Tools", mcp.length > 0 && "MCP", (resources.length || profile.resources?.failOnError) && "Resources", profile.connections?.length && "Connections", profile.subagents && Object.keys(profile.subagents).length > 0 && "Subagents", profile.hooks && Object.keys(profile.hooks).length > 0 && "Hooks", profile.modes && Object.keys(profile.modes).length > 0 && "Modes"].filter(Boolean).join(" \xB7 ") })
|
|
2327
2582
|
] }),
|
|
2328
|
-
/* @__PURE__ */
|
|
2329
|
-
hasBehavior && /* @__PURE__ */
|
|
2330
|
-
nonempty(prompt?.systemPrompt) && /* @__PURE__ */
|
|
2331
|
-
nonempty(prompt?.appendSystemPrompt) && /* @__PURE__ */
|
|
2583
|
+
/* @__PURE__ */ jsxs7("div", { className: "divide-y divide-border border-t border-border", children: [
|
|
2584
|
+
hasBehavior && /* @__PURE__ */ jsx9(ProfileSection, { title: "Instructions", children: /* @__PURE__ */ jsxs7("div", { className: "space-y-2", children: [
|
|
2585
|
+
nonempty(prompt?.systemPrompt) && /* @__PURE__ */ jsx9(PromptDetail, { label: "System prompt", note: "Replaces the harness default", value: prompt.systemPrompt }),
|
|
2586
|
+
nonempty(prompt?.appendSystemPrompt) && /* @__PURE__ */ jsx9(
|
|
2332
2587
|
PromptDetail,
|
|
2333
2588
|
{
|
|
2334
2589
|
label: "Added system prompt",
|
|
@@ -2336,55 +2591,55 @@ function AgentProfileViewer({ profile, className = "", defaultExpanded = true })
|
|
|
2336
2591
|
value: prompt.appendSystemPrompt
|
|
2337
2592
|
}
|
|
2338
2593
|
),
|
|
2339
|
-
instructions.length > 0 && /* @__PURE__ */
|
|
2340
|
-
/* @__PURE__ */
|
|
2594
|
+
instructions.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "space-y-1.5", children: [
|
|
2595
|
+
/* @__PURE__ */ jsxs7("h4", { className: "font-medium text-foreground", children: [
|
|
2341
2596
|
"Project instructions ",
|
|
2342
|
-
/* @__PURE__ */
|
|
2597
|
+
/* @__PURE__ */ jsx9("span", { className: "ml-1 font-normal text-xs text-muted-foreground", children: "Lower-privilege workspace guidance" })
|
|
2343
2598
|
] }),
|
|
2344
|
-
/* @__PURE__ */
|
|
2599
|
+
/* @__PURE__ */ jsx9("ul", { className: "space-y-2", children: instructions.map((instruction, index) => /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9(PromptDetail, { label: `Instruction ${index + 1}`, value: instruction }) }, `${index}:${instruction}`)) })
|
|
2345
2600
|
] }),
|
|
2346
|
-
typeof resourceInstructions === "string" && nonempty(resourceInstructions) && /* @__PURE__ */
|
|
2347
|
-
resourceInstructions && typeof resourceInstructions !== "string" && /* @__PURE__ */
|
|
2601
|
+
typeof resourceInstructions === "string" && nonempty(resourceInstructions) && /* @__PURE__ */ jsx9(PromptDetail, { label: "Resource instructions", note: "Configured in resources", value: resourceInstructions }),
|
|
2602
|
+
resourceInstructions && typeof resourceInstructions !== "string" && /* @__PURE__ */ jsx9("ul", { children: /* @__PURE__ */ jsx9(ResourceRow, { label: "Instruction resource", resource: resourceInstructions }) })
|
|
2348
2603
|
] }) }),
|
|
2349
|
-
(tools.length > 0 || permissions.length > 0) && /* @__PURE__ */
|
|
2604
|
+
(tools.length > 0 || permissions.length > 0) && /* @__PURE__ */ jsx9(ProfileSection, { title: "Tool policy", children: /* @__PURE__ */ jsx9("div", { children: /* @__PURE__ */ jsx9("ul", { className: "divide-y divide-border/70", children: [.../* @__PURE__ */ new Set([...tools.map(([name]) => name), ...permissions.map(([name]) => name)])].sort().map((name) => {
|
|
2350
2605
|
const enabled = tools.find(([tool]) => tool === name)?.[1];
|
|
2351
2606
|
const policy = permissions.find(([permission]) => permission === name)?.[1];
|
|
2352
|
-
return /* @__PURE__ */
|
|
2353
|
-
/* @__PURE__ */
|
|
2354
|
-
/* @__PURE__ */
|
|
2607
|
+
return /* @__PURE__ */ jsxs7("li", { className: "flex min-w-0 items-center justify-between gap-4 py-1.5 first:pt-0 last:pb-0", children: [
|
|
2608
|
+
/* @__PURE__ */ jsx9("code", { className: "min-w-0 break-all font-mono text-xs text-foreground", children: name }),
|
|
2609
|
+
/* @__PURE__ */ jsx9("span", { className: "shrink-0 text-xs text-muted-foreground", children: [enabled === void 0 ? void 0 : enabled ? "Enabled" : "Disabled", policy].filter(Boolean).join(" \xB7 ") })
|
|
2355
2610
|
] }, name);
|
|
2356
2611
|
}) }) }) }),
|
|
2357
|
-
mcp.length > 0 && /* @__PURE__ */
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
/* @__PURE__ */
|
|
2612
|
+
mcp.length > 0 && /* @__PURE__ */ jsx9(ProfileSection, { title: "MCP servers", children: /* @__PURE__ */ jsx9("ul", { className: "divide-y divide-border/70", children: mcp.map(([name, server]) => /* @__PURE__ */ jsxs7("li", { className: "flex min-w-0 items-center justify-between gap-4 py-1.5 first:pt-0 last:pb-0", children: [
|
|
2613
|
+
/* @__PURE__ */ jsx9("span", { className: "min-w-0 break-words font-medium text-foreground", children: name }),
|
|
2614
|
+
/* @__PURE__ */ jsx9("span", { className: "shrink-0 text-xs text-muted-foreground", children: server.enabled === false ? "Disabled in profile" : "Enabled in profile" })
|
|
2360
2615
|
] }, name)) }) }),
|
|
2361
|
-
Boolean(profile.connections?.length) && /* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
connection.capabilities.length > 0 && /* @__PURE__ */
|
|
2616
|
+
Boolean(profile.connections?.length) && /* @__PURE__ */ jsx9(ProfileSection, { title: "Hub capabilities", children: /* @__PURE__ */ jsx9("ul", { className: "space-y-2", children: profile.connections?.map((connection, index) => /* @__PURE__ */ jsxs7("li", { className: "min-w-0", children: [
|
|
2617
|
+
/* @__PURE__ */ jsx9("p", { className: "font-medium text-foreground", children: connection.alias || "Hub connection" }),
|
|
2618
|
+
connection.capabilities.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "mt-1 flex flex-wrap gap-1.5", children: connection.capabilities.map((capability, capabilityIndex) => /* @__PURE__ */ jsx9("li", { className: "rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground", children: capability }, `${capability}:${capabilityIndex}`)) })
|
|
2364
2619
|
] }, `${connection.alias ?? "connection"}:${index}`)) }) }),
|
|
2365
|
-
(resources.length > 0 || profile.resources?.failOnError) && /* @__PURE__ */
|
|
2366
|
-
/* @__PURE__ */
|
|
2367
|
-
profile.resources?.failOnError && /* @__PURE__ */
|
|
2620
|
+
(resources.length > 0 || profile.resources?.failOnError) && /* @__PURE__ */ jsxs7(ProfileSection, { title: "Declared resources", children: [
|
|
2621
|
+
/* @__PURE__ */ jsx9("ul", { className: "divide-y divide-border/70", children: resources.map(({ key, ...item }) => /* @__PURE__ */ jsx9(ResourceRow, { ...item }, key)) }),
|
|
2622
|
+
profile.resources?.failOnError && /* @__PURE__ */ jsx9("p", { className: "mt-2 text-xs text-muted-foreground", children: "Profile configuration requires declared resources to load successfully." })
|
|
2368
2623
|
] }),
|
|
2369
|
-
Boolean(profile.subagents && Object.keys(profile.subagents).length) && /* @__PURE__ */
|
|
2370
|
-
/* @__PURE__ */
|
|
2371
|
-
nonempty(subagent.description) && /* @__PURE__ */
|
|
2624
|
+
Boolean(profile.subagents && Object.keys(profile.subagents).length) && /* @__PURE__ */ jsx9(ProfileSection, { title: "Subagents", children: /* @__PURE__ */ jsx9("ul", { className: "divide-y divide-border/70", children: Object.entries(profile.subagents ?? {}).sort(([a], [b]) => a.localeCompare(b)).map(([name, subagent]) => /* @__PURE__ */ jsxs7("li", { className: "py-1.5 first:pt-0 last:pb-0", children: [
|
|
2625
|
+
/* @__PURE__ */ jsx9("p", { className: "font-medium text-foreground", children: name }),
|
|
2626
|
+
nonempty(subagent.description) && /* @__PURE__ */ jsx9("p", { className: "mt-0.5 whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-foreground", children: subagent.description })
|
|
2372
2627
|
] }, name)) }) }),
|
|
2373
|
-
Boolean(profile.hooks && Object.keys(profile.hooks).length) && /* @__PURE__ */
|
|
2374
|
-
/* @__PURE__ */
|
|
2375
|
-
/* @__PURE__ */
|
|
2628
|
+
Boolean(profile.hooks && Object.keys(profile.hooks).length) && /* @__PURE__ */ jsx9(ProfileSection, { title: "Lifecycle hooks", children: /* @__PURE__ */ jsx9("ul", { className: "space-y-1", children: Object.entries(profile.hooks ?? {}).sort(([a], [b]) => a.localeCompare(b)).map(([event, commands]) => /* @__PURE__ */ jsxs7("li", { className: "flex min-w-0 justify-between gap-4", children: [
|
|
2629
|
+
/* @__PURE__ */ jsx9("code", { className: "font-mono text-xs text-foreground", children: event }),
|
|
2630
|
+
/* @__PURE__ */ jsxs7("span", { className: "text-xs text-muted-foreground", children: [
|
|
2376
2631
|
commands.length,
|
|
2377
2632
|
" configured"
|
|
2378
2633
|
] })
|
|
2379
2634
|
] }, event)) }) }),
|
|
2380
|
-
Boolean(profile.modes && Object.keys(profile.modes).length) && /* @__PURE__ */
|
|
2635
|
+
Boolean(profile.modes && Object.keys(profile.modes).length) && /* @__PURE__ */ jsx9(ProfileSection, { title: "Modes", children: /* @__PURE__ */ jsx9("ul", { className: "flex flex-wrap gap-1.5", children: Object.keys(profile.modes ?? {}).sort().map((mode) => /* @__PURE__ */ jsx9("li", { className: "rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground", children: mode }, mode)) }) })
|
|
2381
2636
|
] })
|
|
2382
2637
|
] })
|
|
2383
2638
|
] });
|
|
2384
2639
|
}
|
|
2385
2640
|
|
|
2386
2641
|
// src/web-react/durable-plan-flow.ts
|
|
2387
|
-
import { useCallback as useCallback2, useEffect as useEffect6, useRef as
|
|
2642
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
|
|
2388
2643
|
var DurablePlanClientError = class extends Error {
|
|
2389
2644
|
constructor(message, status, code, currentPlan) {
|
|
2390
2645
|
super(message);
|
|
@@ -2471,12 +2726,12 @@ function createDurablePlanDecisionClient(options) {
|
|
|
2471
2726
|
};
|
|
2472
2727
|
}
|
|
2473
2728
|
function useDurablePlanFlow(options) {
|
|
2474
|
-
const [plan, setPlan] =
|
|
2475
|
-
const [deciding, setDeciding] =
|
|
2476
|
-
const [restoring, setRestoring] =
|
|
2477
|
-
const [error, setError] =
|
|
2478
|
-
const attachments =
|
|
2479
|
-
const decisionInFlight =
|
|
2729
|
+
const [plan, setPlan] = useState9(options.plan);
|
|
2730
|
+
const [deciding, setDeciding] = useState9(null);
|
|
2731
|
+
const [restoring, setRestoring] = useState9(false);
|
|
2732
|
+
const [error, setError] = useState9(null);
|
|
2733
|
+
const attachments = useRef6(/* @__PURE__ */ new Map());
|
|
2734
|
+
const decisionInFlight = useRef6(false);
|
|
2480
2735
|
useEffect6(() => setPlan(options.plan), [options.plan]);
|
|
2481
2736
|
const apply = useCallback2(async (result) => {
|
|
2482
2737
|
setPlan(result.plan);
|
|
@@ -2646,7 +2901,7 @@ function createDurableInteractionAnswerSubmitter(options) {
|
|
|
2646
2901
|
}
|
|
2647
2902
|
|
|
2648
2903
|
// src/web-react/use-chat-interactions.ts
|
|
2649
|
-
import { useCallback as useCallback3, useMemo as useMemo3, useState as
|
|
2904
|
+
import { useCallback as useCallback3, useMemo as useMemo3, useState as useState10 } from "react";
|
|
2650
2905
|
function hasPendingContentDuplicate(list, interaction) {
|
|
2651
2906
|
if (interaction.status !== "pending") return false;
|
|
2652
2907
|
const signature = questionInteractionContentSignature(interaction);
|
|
@@ -2725,7 +2980,7 @@ function hydrateChatInteractions(list, persisted) {
|
|
|
2725
2980
|
return persisted.reduce(upsertChatInteraction, list);
|
|
2726
2981
|
}
|
|
2727
2982
|
function useChatInteractions(options = {}) {
|
|
2728
|
-
const [interactions, setInteractions] =
|
|
2983
|
+
const [interactions, setInteractions] = useState10([]);
|
|
2729
2984
|
const upsert = useCallback3((interaction) => {
|
|
2730
2985
|
setInteractions((prev) => upsertChatInteraction(prev, interaction));
|
|
2731
2986
|
}, []);
|
|
@@ -2752,7 +3007,7 @@ function useChatInteractions(options = {}) {
|
|
|
2752
3007
|
}
|
|
2753
3008
|
|
|
2754
3009
|
// src/web-react/use-file-mentions.ts
|
|
2755
|
-
import { useCallback as useCallback4, useMemo as useMemo4, useRef as
|
|
3010
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef7, useState as useState11 } from "react";
|
|
2756
3011
|
var FILE_MENTION_KIND = "file";
|
|
2757
3012
|
function toMentionItem(file) {
|
|
2758
3013
|
return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
|
|
@@ -2810,11 +3065,11 @@ function useFileMentions(options) {
|
|
|
2810
3065
|
emptyText = DEFAULT_MENTION_EMPTY_TEXT
|
|
2811
3066
|
} = options;
|
|
2812
3067
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
2813
|
-
const [state, setState] =
|
|
2814
|
-
const stateRef =
|
|
3068
|
+
const [state, setState] = useState11({ kind: "idle" });
|
|
3069
|
+
const stateRef = useRef7(state);
|
|
2815
3070
|
stateRef.current = state;
|
|
2816
|
-
const inFlightRef =
|
|
2817
|
-
const [mentions, setMentions] =
|
|
3071
|
+
const inFlightRef = useRef7(null);
|
|
3072
|
+
const [mentions, setMentions] = useState11([]);
|
|
2818
3073
|
const load = useCallback4(() => {
|
|
2819
3074
|
if (inFlightRef.current) return inFlightRef.current;
|
|
2820
3075
|
if (stateRef.current.kind === "idle") {
|
|
@@ -2921,8 +3176,8 @@ function segmentMentionContent(content, parts) {
|
|
|
2921
3176
|
}
|
|
2922
3177
|
|
|
2923
3178
|
// src/web-react/mission-activity.tsx
|
|
2924
|
-
import { useCallback as useCallback5, useEffect as useEffect7, useState as
|
|
2925
|
-
import { Fragment as
|
|
3179
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState12 } from "react";
|
|
3180
|
+
import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2926
3181
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
|
|
2927
3182
|
var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
|
|
2928
3183
|
var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted"]);
|
|
@@ -2969,19 +3224,19 @@ function waterfallLayout(trace) {
|
|
|
2969
3224
|
});
|
|
2970
3225
|
}
|
|
2971
3226
|
function ChevronGlyph({ className }) {
|
|
2972
|
-
return /* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsx10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx10("path", { d: "m6 9 6 6 6-6" }) });
|
|
2973
3228
|
}
|
|
2974
3229
|
function RefreshGlyph({ className }) {
|
|
2975
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsx10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx10("path", { d: "M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6" }) });
|
|
2976
3231
|
}
|
|
2977
3232
|
function CopyGlyph({ className }) {
|
|
2978
|
-
return /* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
2980
|
-
/* @__PURE__ */
|
|
3233
|
+
return /* @__PURE__ */ jsxs8("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
3234
|
+
/* @__PURE__ */ jsx10("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
3235
|
+
/* @__PURE__ */ jsx10("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2981
3236
|
] });
|
|
2982
3237
|
}
|
|
2983
3238
|
function TraceIdCopy({ traceId }) {
|
|
2984
|
-
const [copied, setCopied] =
|
|
3239
|
+
const [copied, setCopied] = useState12(false);
|
|
2985
3240
|
const copy = useCallback5(() => {
|
|
2986
3241
|
void navigator.clipboard?.writeText(traceId).then(
|
|
2987
3242
|
() => {
|
|
@@ -2992,7 +3247,7 @@ function TraceIdCopy({ traceId }) {
|
|
|
2992
3247
|
}
|
|
2993
3248
|
);
|
|
2994
3249
|
}, [traceId]);
|
|
2995
|
-
return /* @__PURE__ */
|
|
3250
|
+
return /* @__PURE__ */ jsxs8(
|
|
2996
3251
|
"button",
|
|
2997
3252
|
{
|
|
2998
3253
|
type: "button",
|
|
@@ -3001,29 +3256,29 @@ function TraceIdCopy({ traceId }) {
|
|
|
3001
3256
|
"aria-label": "Copy trace id",
|
|
3002
3257
|
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground",
|
|
3003
3258
|
children: [
|
|
3004
|
-
/* @__PURE__ */
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
copied && /* @__PURE__ */
|
|
3259
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate", children: traceId }),
|
|
3260
|
+
/* @__PURE__ */ jsx10(CopyGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
3261
|
+
copied && /* @__PURE__ */ jsx10("span", { className: "shrink-0 not-italic text-success", children: "copied" })
|
|
3007
3262
|
]
|
|
3008
3263
|
}
|
|
3009
3264
|
);
|
|
3010
3265
|
}
|
|
3011
3266
|
function StatusDot({ tone }) {
|
|
3012
|
-
return /* @__PURE__ */
|
|
3013
|
-
/* @__PURE__ */
|
|
3267
|
+
return /* @__PURE__ */ jsxs8("span", { className: "inline-flex items-center", children: [
|
|
3268
|
+
/* @__PURE__ */ jsx10(
|
|
3014
3269
|
"span",
|
|
3015
3270
|
{
|
|
3016
3271
|
"aria-hidden": true,
|
|
3017
3272
|
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"}`
|
|
3018
3273
|
}
|
|
3019
3274
|
),
|
|
3020
|
-
/* @__PURE__ */
|
|
3275
|
+
/* @__PURE__ */ jsx10("span", { className: "sr-only", children: tone })
|
|
3021
3276
|
] });
|
|
3022
3277
|
}
|
|
3023
3278
|
function RunLabel({ tool, detail, live }) {
|
|
3024
|
-
return /* @__PURE__ */
|
|
3025
|
-
/* @__PURE__ */
|
|
3026
|
-
/* @__PURE__ */
|
|
3279
|
+
return /* @__PURE__ */ jsxs8("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
3280
|
+
/* @__PURE__ */ jsx10("span", { className: live ? "agent-shimmer font-medium" : "font-medium", "data-motion": live ? "essential" : void 0, children: tool }),
|
|
3281
|
+
/* @__PURE__ */ jsxs8("span", { className: "text-muted-foreground", children: [
|
|
3027
3282
|
" \u2014 ",
|
|
3028
3283
|
detail
|
|
3029
3284
|
] })
|
|
@@ -3038,19 +3293,19 @@ function FlowWaterfall({ trace }) {
|
|
|
3038
3293
|
const rows = waterfallLayout(trace);
|
|
3039
3294
|
if (rows.length === 0) return null;
|
|
3040
3295
|
const cost = formatActivityCost(trace.costUsd);
|
|
3041
|
-
return /* @__PURE__ */
|
|
3042
|
-
rows.map((row, i) => /* @__PURE__ */
|
|
3043
|
-
/* @__PURE__ */
|
|
3044
|
-
/* @__PURE__ */
|
|
3296
|
+
return /* @__PURE__ */ jsxs8("div", { className: "space-y-1", children: [
|
|
3297
|
+
rows.map((row, i) => /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto] items-center gap-2", children: [
|
|
3298
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate font-mono text-xs text-muted-foreground", title: row.name, children: row.name }),
|
|
3299
|
+
/* @__PURE__ */ jsx10("div", { className: "relative h-2 rounded-sm bg-secondary", children: /* @__PURE__ */ jsx10(
|
|
3045
3300
|
"div",
|
|
3046
3301
|
{
|
|
3047
3302
|
className: `absolute inset-y-0 rounded-sm ${row.ok ? BAR_CLASS[row.kind] : "bg-destructive/80"} ${row.approx ? "opacity-70" : ""}`,
|
|
3048
3303
|
style: { left: `${row.offsetPct}%`, width: `${row.widthPct}%` }
|
|
3049
3304
|
}
|
|
3050
3305
|
) }),
|
|
3051
|
-
/* @__PURE__ */
|
|
3306
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground/70", children: row.durationLabel })
|
|
3052
3307
|
] }, i)),
|
|
3053
|
-
/* @__PURE__ */
|
|
3308
|
+
/* @__PURE__ */ jsxs8("p", { className: "pt-0.5 text-right font-mono text-xs tabular-nums text-muted-foreground/60", children: [
|
|
3054
3309
|
(trace.totalMs / 1e3).toFixed(1),
|
|
3055
3310
|
"s",
|
|
3056
3311
|
cost ? ` \xB7 ${cost}` : ""
|
|
@@ -3062,35 +3317,35 @@ function LaneRow({ run, staggerIndex }) {
|
|
|
3062
3317
|
const tone = activityTone(run.status);
|
|
3063
3318
|
const cost = formatActivityCost(run.costUsd);
|
|
3064
3319
|
const duration = formatActivityDuration(run.durationMs);
|
|
3065
|
-
return /* @__PURE__ */
|
|
3066
|
-
/* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */
|
|
3069
|
-
/* @__PURE__ */
|
|
3070
|
-
tone !== "live" && tone !== "ok" && /* @__PURE__ */
|
|
3071
|
-
cost && /* @__PURE__ */
|
|
3072
|
-
duration && /* @__PURE__ */
|
|
3320
|
+
return /* @__PURE__ */ jsxs8("div", { className: "agent-arrive flex items-center gap-2 py-1 text-xs", style: arrival, children: [
|
|
3321
|
+
/* @__PURE__ */ jsx10(StatusDot, { tone }),
|
|
3322
|
+
/* @__PURE__ */ jsx10(RunLabel, { tool: run.tool, detail: run.detail, live: tone === "live" }),
|
|
3323
|
+
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */ jsx10("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 ") }),
|
|
3324
|
+
/* @__PURE__ */ jsxs8("span", { className: "flex shrink-0 items-center gap-1.5 font-mono text-xs tabular-nums text-muted-foreground/70", children: [
|
|
3325
|
+
tone !== "live" && tone !== "ok" && /* @__PURE__ */ jsx10("span", { children: run.status }),
|
|
3326
|
+
cost && /* @__PURE__ */ jsx10("span", { children: cost }),
|
|
3327
|
+
duration && /* @__PURE__ */ jsx10("span", { children: duration })
|
|
3073
3328
|
] })
|
|
3074
3329
|
] });
|
|
3075
3330
|
}
|
|
3076
3331
|
function MissionActivityLane({ activity, startedAt, nowMs }) {
|
|
3077
|
-
const [expanded, setExpanded] =
|
|
3332
|
+
const [expanded, setExpanded] = useState12(false);
|
|
3078
3333
|
if (activity.length === 0) return null;
|
|
3079
|
-
return /* @__PURE__ */
|
|
3080
|
-
activity.map((run, index) => /* @__PURE__ */
|
|
3081
|
-
/* @__PURE__ */
|
|
3334
|
+
return /* @__PURE__ */ jsxs8("div", { className: "mt-1 border-l border-border pl-3", children: [
|
|
3335
|
+
activity.map((run, index) => /* @__PURE__ */ jsx10(LaneRow, { run, staggerIndex: index }, run.taskId)),
|
|
3336
|
+
/* @__PURE__ */ jsxs8(
|
|
3082
3337
|
"button",
|
|
3083
3338
|
{
|
|
3084
3339
|
type: "button",
|
|
3085
3340
|
onClick: () => setExpanded((v) => !v),
|
|
3086
3341
|
className: "flex items-center gap-1 py-0.5 text-xs font-medium text-muted-foreground/70 transition hover:text-foreground",
|
|
3087
3342
|
children: [
|
|
3088
|
-
/* @__PURE__ */
|
|
3343
|
+
/* @__PURE__ */ jsx10(ChevronGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
3089
3344
|
"timeline"
|
|
3090
3345
|
]
|
|
3091
3346
|
}
|
|
3092
3347
|
),
|
|
3093
|
-
expanded && /* @__PURE__ */
|
|
3348
|
+
expanded && /* @__PURE__ */ jsx10("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx10(
|
|
3094
3349
|
FlowWaterfall,
|
|
3095
3350
|
{
|
|
3096
3351
|
trace: stepActivityFlowTrace(activity, {
|
|
@@ -3107,39 +3362,39 @@ function ActivityRow({
|
|
|
3107
3362
|
staggerIndex
|
|
3108
3363
|
}) {
|
|
3109
3364
|
const arrival = useArrivalStyle(staggerIndex);
|
|
3110
|
-
const [open, setOpen] =
|
|
3365
|
+
const [open, setOpen] = useState12(false);
|
|
3111
3366
|
const tone = activityTone(record.status);
|
|
3112
3367
|
const cost = formatActivityCost(record.costUsd);
|
|
3113
3368
|
const duration = formatActivityDuration(record.durationMs);
|
|
3114
|
-
return /* @__PURE__ */
|
|
3115
|
-
/* @__PURE__ */
|
|
3116
|
-
/* @__PURE__ */
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */
|
|
3119
|
-
/* @__PURE__ */
|
|
3369
|
+
return /* @__PURE__ */ jsxs8("div", { className: "agent-arrive rounded-lg border border-card-edge bg-card", style: arrival, children: [
|
|
3370
|
+
/* @__PURE__ */ jsxs8("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: [
|
|
3371
|
+
/* @__PURE__ */ jsx10(StatusDot, { tone }),
|
|
3372
|
+
/* @__PURE__ */ jsx10(RunLabel, { tool: record.tool, detail: record.detail, live: tone === "live" }),
|
|
3373
|
+
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */ jsx10("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 ") }),
|
|
3374
|
+
/* @__PURE__ */ jsx10(
|
|
3120
3375
|
"span",
|
|
3121
3376
|
{
|
|
3122
3377
|
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"}`,
|
|
3123
3378
|
children: record.status
|
|
3124
3379
|
}
|
|
3125
3380
|
),
|
|
3126
|
-
cost && /* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3381
|
+
cost && /* @__PURE__ */ jsx10("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground", children: cost }),
|
|
3382
|
+
/* @__PURE__ */ jsx10(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
|
|
3128
3383
|
] }),
|
|
3129
|
-
open && /* @__PURE__ */
|
|
3130
|
-
record.durationMs !== void 0 && /* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */
|
|
3136
|
-
duration && /* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3384
|
+
open && /* @__PURE__ */ jsxs8("div", { className: "space-y-2.5 border-t border-border px-3 py-2.5", children: [
|
|
3385
|
+
record.durationMs !== void 0 && /* @__PURE__ */ jsx10("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx10(FlowWaterfall, { trace: stepActivityFlowTrace([record]) }) }),
|
|
3386
|
+
/* @__PURE__ */ jsxs8("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-xs", children: [
|
|
3387
|
+
/* @__PURE__ */ jsx10("dt", { className: "text-muted-foreground/60", children: "task" }),
|
|
3388
|
+
/* @__PURE__ */ jsx10("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
|
|
3389
|
+
/* @__PURE__ */ jsx10("dt", { className: "text-muted-foreground/60", children: "started" }),
|
|
3390
|
+
/* @__PURE__ */ jsx10("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
|
|
3391
|
+
duration && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
3392
|
+
/* @__PURE__ */ jsx10("dt", { className: "text-muted-foreground/60", children: "duration" }),
|
|
3393
|
+
/* @__PURE__ */ jsx10("dd", { className: "text-muted-foreground", children: duration })
|
|
3139
3394
|
] }),
|
|
3140
|
-
record.traceId && /* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3142
|
-
/* @__PURE__ */
|
|
3395
|
+
record.traceId && /* @__PURE__ */ jsxs8(Fragment4, { children: [
|
|
3396
|
+
/* @__PURE__ */ jsx10("dt", { className: "text-muted-foreground/60", children: "trace" }),
|
|
3397
|
+
/* @__PURE__ */ jsx10("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx10(TraceIdCopy, { traceId: record.traceId }) })
|
|
3143
3398
|
] })
|
|
3144
3399
|
] }),
|
|
3145
3400
|
record.missionRef && renderMissionRef?.(record.missionRef, record)
|
|
@@ -3147,10 +3402,10 @@ function ActivityRow({
|
|
|
3147
3402
|
] });
|
|
3148
3403
|
}
|
|
3149
3404
|
function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent activity", emptyLabel = "No agent runs yet." }) {
|
|
3150
|
-
const [rows, setRows] =
|
|
3151
|
-
const [cursor, setCursor] =
|
|
3152
|
-
const [status, setStatus] =
|
|
3153
|
-
const [error, setError] =
|
|
3405
|
+
const [rows, setRows] = useState12([]);
|
|
3406
|
+
const [cursor, setCursor] = useState12(void 0);
|
|
3407
|
+
const [status, setStatus] = useState12("loading");
|
|
3408
|
+
const [error, setError] = useState12(null);
|
|
3154
3409
|
const load = useCallback5(
|
|
3155
3410
|
async (from) => {
|
|
3156
3411
|
setStatus("loading");
|
|
@@ -3171,10 +3426,10 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
3171
3426
|
void load();
|
|
3172
3427
|
}, [load]);
|
|
3173
3428
|
const loading = status === "loading";
|
|
3174
|
-
return /* @__PURE__ */
|
|
3175
|
-
/* @__PURE__ */
|
|
3176
|
-
/* @__PURE__ */
|
|
3177
|
-
/* @__PURE__ */
|
|
3429
|
+
return /* @__PURE__ */ jsxs8("div", { className: "space-y-2", children: [
|
|
3430
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2", children: [
|
|
3431
|
+
/* @__PURE__ */ jsx10("h2", { className: "flex-1 text-sm font-semibold", children: title }),
|
|
3432
|
+
/* @__PURE__ */ jsx10(
|
|
3178
3433
|
"button",
|
|
3179
3434
|
{
|
|
3180
3435
|
type: "button",
|
|
@@ -3182,15 +3437,15 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
3182
3437
|
disabled: loading,
|
|
3183
3438
|
"aria-label": "Refresh",
|
|
3184
3439
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
3185
|
-
children: /* @__PURE__ */
|
|
3440
|
+
children: /* @__PURE__ */ jsx10(RefreshGlyph, { className: `h-3.5 w-3.5 ${loading ? "animate-spin" : ""}` })
|
|
3186
3441
|
}
|
|
3187
3442
|
)
|
|
3188
3443
|
] }),
|
|
3189
|
-
status === "error" && /* @__PURE__ */
|
|
3190
|
-
status === "ready" && rows.length === 0 && /* @__PURE__ */
|
|
3191
|
-
/* @__PURE__ */
|
|
3192
|
-
/* @__PURE__ */
|
|
3193
|
-
cursor && /* @__PURE__ */
|
|
3444
|
+
status === "error" && /* @__PURE__ */ jsx10("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
|
|
3445
|
+
status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx10("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
|
|
3446
|
+
/* @__PURE__ */ jsx10("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
|
|
3447
|
+
/* @__PURE__ */ jsx10("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record, index) => /* @__PURE__ */ jsx10(ActivityRow, { record, renderMissionRef, staggerIndex: index }, record.taskId)) }),
|
|
3448
|
+
cursor && /* @__PURE__ */ jsx10(
|
|
3194
3449
|
"button",
|
|
3195
3450
|
{
|
|
3196
3451
|
type: "button",
|
|
@@ -3204,7 +3459,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
3204
3459
|
}
|
|
3205
3460
|
|
|
3206
3461
|
// src/web-react/provenance.tsx
|
|
3207
|
-
import { useCallback as useCallback6, useEffect as useEffect8, useId as useId2, useRef as
|
|
3462
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useId as useId2, useRef as useRef8, useState as useState13 } from "react";
|
|
3208
3463
|
|
|
3209
3464
|
// src/web-react/provenance-model.ts
|
|
3210
3465
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -3364,7 +3619,7 @@ function provenanceTriggerLabel(record, standing) {
|
|
|
3364
3619
|
}
|
|
3365
3620
|
|
|
3366
3621
|
// src/web-react/provenance.tsx
|
|
3367
|
-
import { jsx as
|
|
3622
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3368
3623
|
var BASIS_TONES = {
|
|
3369
3624
|
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
3370
3625
|
entered: "border-success/30 bg-success/10 text-success",
|
|
@@ -3389,27 +3644,27 @@ function BasisGlyph({ basis, className }) {
|
|
|
3389
3644
|
};
|
|
3390
3645
|
switch (basis) {
|
|
3391
3646
|
case "extracted":
|
|
3392
|
-
return /* @__PURE__ */
|
|
3393
|
-
/* @__PURE__ */
|
|
3394
|
-
/* @__PURE__ */
|
|
3395
|
-
/* @__PURE__ */
|
|
3647
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3648
|
+
/* @__PURE__ */ jsx11("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
3649
|
+
/* @__PURE__ */ jsx11("polyline", { points: "14 3 14 8 19 8" }),
|
|
3650
|
+
/* @__PURE__ */ jsx11("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
3396
3651
|
] });
|
|
3397
3652
|
case "entered":
|
|
3398
|
-
return /* @__PURE__ */
|
|
3399
|
-
/* @__PURE__ */
|
|
3400
|
-
/* @__PURE__ */
|
|
3653
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3654
|
+
/* @__PURE__ */ jsx11("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
3655
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "7", r: "4" })
|
|
3401
3656
|
] });
|
|
3402
3657
|
case "computed":
|
|
3403
|
-
return /* @__PURE__ */
|
|
3404
|
-
/* @__PURE__ */
|
|
3405
|
-
/* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3658
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3659
|
+
/* @__PURE__ */ jsx11("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
3660
|
+
/* @__PURE__ */ jsx11("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
3661
|
+
/* @__PURE__ */ jsx11("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
3662
|
+
/* @__PURE__ */ jsx11("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
3408
3663
|
] });
|
|
3409
3664
|
case "asserted":
|
|
3410
|
-
return /* @__PURE__ */
|
|
3411
|
-
/* @__PURE__ */
|
|
3412
|
-
/* @__PURE__ */
|
|
3665
|
+
return /* @__PURE__ */ jsxs9("svg", { ...shared, children: [
|
|
3666
|
+
/* @__PURE__ */ jsx11("path", { d: "M12 3v3M12 18v3M3 12h3M18 12h3M5.6 5.6l2.1 2.1M16.3 16.3l2.1 2.1M18.4 5.6l-2.1 2.1M7.7 16.3l-2.1 2.1" }),
|
|
3667
|
+
/* @__PURE__ */ jsx11("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
3413
3668
|
] });
|
|
3414
3669
|
}
|
|
3415
3670
|
}
|
|
@@ -3429,11 +3684,11 @@ function SourceRow({
|
|
|
3429
3684
|
const status = source.status ?? "ready";
|
|
3430
3685
|
const statusLine = describeProvenanceSourceStatus(source);
|
|
3431
3686
|
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
3432
|
-
return /* @__PURE__ */
|
|
3433
|
-
/* @__PURE__ */
|
|
3434
|
-
/* @__PURE__ */
|
|
3435
|
-
source.locator && /* @__PURE__ */
|
|
3436
|
-
openable && (onOpenSource ? /* @__PURE__ */
|
|
3687
|
+
return /* @__PURE__ */ jsxs9("li", { className: "rounded-md border border-card-edge bg-card px-2.5 py-2", children: [
|
|
3688
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
3689
|
+
/* @__PURE__ */ jsx11("span", { className: "text-sm font-medium text-foreground", children: source.label }),
|
|
3690
|
+
source.locator && /* @__PURE__ */ jsx11("span", { className: "text-xs text-muted-foreground", children: source.locator }),
|
|
3691
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs9(
|
|
3437
3692
|
"button",
|
|
3438
3693
|
{
|
|
3439
3694
|
type: "button",
|
|
@@ -3444,7 +3699,7 @@ function SourceRow({
|
|
|
3444
3699
|
source.label
|
|
3445
3700
|
]
|
|
3446
3701
|
}
|
|
3447
|
-
) : /* @__PURE__ */
|
|
3702
|
+
) : /* @__PURE__ */ jsxs9(
|
|
3448
3703
|
"a",
|
|
3449
3704
|
{
|
|
3450
3705
|
href: source.href,
|
|
@@ -3458,7 +3713,7 @@ function SourceRow({
|
|
|
3458
3713
|
}
|
|
3459
3714
|
))
|
|
3460
3715
|
] }),
|
|
3461
|
-
source.quote && /* @__PURE__ */
|
|
3716
|
+
source.quote && /* @__PURE__ */ jsxs9("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
3462
3717
|
"\u201C",
|
|
3463
3718
|
source.quote,
|
|
3464
3719
|
"\u201D"
|
|
@@ -3467,14 +3722,14 @@ function SourceRow({
|
|
|
3467
3722
|
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
3468
3723
|
// — a spinner alone and a greyed row alone both render as "nothing
|
|
3469
3724
|
// here".
|
|
3470
|
-
/* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ jsxs9(
|
|
3471
3726
|
"p",
|
|
3472
3727
|
{
|
|
3473
3728
|
role: "status",
|
|
3474
3729
|
className: `mt-1 text-xs ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
3475
3730
|
children: [
|
|
3476
3731
|
statusLine,
|
|
3477
|
-
status === "unavailable" && onRetrySource && /* @__PURE__ */
|
|
3732
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx11(
|
|
3478
3733
|
"button",
|
|
3479
3734
|
{
|
|
3480
3735
|
type: "button",
|
|
@@ -3498,9 +3753,9 @@ function ProvenanceValue({
|
|
|
3498
3753
|
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
3499
3754
|
className
|
|
3500
3755
|
}) {
|
|
3501
|
-
const [open, setOpen] =
|
|
3502
|
-
const triggerRef =
|
|
3503
|
-
const rootRef =
|
|
3756
|
+
const [open, setOpen] = useState13(defaultOpen);
|
|
3757
|
+
const triggerRef = useRef8(null);
|
|
3758
|
+
const rootRef = useRef8(null);
|
|
3504
3759
|
const panelId = useId2();
|
|
3505
3760
|
const standing = rollUpProvenanceStanding(record, confidencePolicy);
|
|
3506
3761
|
const basisMeta = provenanceBasisMeta(record.basis);
|
|
@@ -3541,12 +3796,12 @@ function ProvenanceValue({
|
|
|
3541
3796
|
document.removeEventListener("touchstart", onPointerDown, true);
|
|
3542
3797
|
};
|
|
3543
3798
|
}, [open]);
|
|
3544
|
-
const summary = /* @__PURE__ */
|
|
3545
|
-
record.label && /* @__PURE__ */
|
|
3546
|
-
/* @__PURE__ */
|
|
3799
|
+
const summary = /* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
3800
|
+
record.label && /* @__PURE__ */ jsx11("span", { className: "text-xs text-muted-foreground", children: record.label }),
|
|
3801
|
+
/* @__PURE__ */ jsx11("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
|
|
3547
3802
|
] });
|
|
3548
3803
|
if (maxDepth <= 0) {
|
|
3549
|
-
return /* @__PURE__ */
|
|
3804
|
+
return /* @__PURE__ */ jsxs9(
|
|
3550
3805
|
"div",
|
|
3551
3806
|
{
|
|
3552
3807
|
className: `inline-block max-w-full ${className ?? ""}`,
|
|
@@ -3554,22 +3809,22 @@ function ProvenanceValue({
|
|
|
3554
3809
|
"data-provenance-standing": standing,
|
|
3555
3810
|
children: [
|
|
3556
3811
|
summary,
|
|
3557
|
-
/* @__PURE__ */
|
|
3812
|
+
/* @__PURE__ */ jsxs9(
|
|
3558
3813
|
"span",
|
|
3559
3814
|
{
|
|
3560
3815
|
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]}`,
|
|
3561
3816
|
children: [
|
|
3562
|
-
/* @__PURE__ */
|
|
3817
|
+
/* @__PURE__ */ jsx11(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3563
3818
|
basisMeta.label
|
|
3564
3819
|
]
|
|
3565
3820
|
}
|
|
3566
3821
|
),
|
|
3567
|
-
/* @__PURE__ */
|
|
3822
|
+
/* @__PURE__ */ jsx11("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record) })
|
|
3568
3823
|
]
|
|
3569
3824
|
}
|
|
3570
3825
|
);
|
|
3571
3826
|
}
|
|
3572
|
-
return /* @__PURE__ */
|
|
3827
|
+
return /* @__PURE__ */ jsxs9(
|
|
3573
3828
|
"div",
|
|
3574
3829
|
{
|
|
3575
3830
|
ref: rootRef,
|
|
@@ -3578,9 +3833,9 @@ function ProvenanceValue({
|
|
|
3578
3833
|
"data-provenance-basis": record.basis,
|
|
3579
3834
|
"data-provenance-standing": standing,
|
|
3580
3835
|
children: [
|
|
3581
|
-
/* @__PURE__ */
|
|
3836
|
+
/* @__PURE__ */ jsxs9("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
3582
3837
|
summary,
|
|
3583
|
-
/* @__PURE__ */
|
|
3838
|
+
/* @__PURE__ */ jsxs9(
|
|
3584
3839
|
"button",
|
|
3585
3840
|
{
|
|
3586
3841
|
ref: triggerRef,
|
|
@@ -3591,17 +3846,17 @@ function ProvenanceValue({
|
|
|
3591
3846
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3592
3847
|
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]}`,
|
|
3593
3848
|
children: [
|
|
3594
|
-
/* @__PURE__ */
|
|
3595
|
-
/* @__PURE__ */
|
|
3849
|
+
/* @__PURE__ */ jsx11(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
3850
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, children: basisMeta.label })
|
|
3596
3851
|
]
|
|
3597
3852
|
}
|
|
3598
3853
|
),
|
|
3599
3854
|
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
3600
3855
|
// someone to open the panel. `aria-hidden` because the trigger's
|
|
3601
3856
|
// accessible name already carries it — this is the visual half.
|
|
3602
|
-
/* @__PURE__ */
|
|
3857
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": true, className: `text-xs font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
3603
3858
|
] }),
|
|
3604
|
-
open && /* @__PURE__ */
|
|
3859
|
+
open && /* @__PURE__ */ jsxs9(
|
|
3605
3860
|
"div",
|
|
3606
3861
|
{
|
|
3607
3862
|
id: panelId,
|
|
@@ -3609,19 +3864,19 @@ function ProvenanceValue({
|
|
|
3609
3864
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
3610
3865
|
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",
|
|
3611
3866
|
children: [
|
|
3612
|
-
/* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3614
|
-
/* @__PURE__ */
|
|
3867
|
+
/* @__PURE__ */ jsxs9("div", { children: [
|
|
3868
|
+
/* @__PURE__ */ jsx11("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
|
|
3869
|
+
/* @__PURE__ */ jsxs9("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
3615
3870
|
standingMeta.label,
|
|
3616
3871
|
" \u2014 ",
|
|
3617
3872
|
provenanceNextMove(record, standing, confidencePolicy)
|
|
3618
3873
|
] }),
|
|
3619
|
-
basisMeta.checkableAgainst === null && /* @__PURE__ */
|
|
3874
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs9("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
|
|
3620
3875
|
basisMeta.meaning,
|
|
3621
3876
|
" There is nothing outside the model to check it against."
|
|
3622
3877
|
] })
|
|
3623
3878
|
] }),
|
|
3624
|
-
sources.length > 0 && /* @__PURE__ */
|
|
3879
|
+
sources.length > 0 && /* @__PURE__ */ jsx11("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx11(
|
|
3625
3880
|
SourceRow,
|
|
3626
3881
|
{
|
|
3627
3882
|
source,
|
|
@@ -3634,12 +3889,12 @@ function ProvenanceValue({
|
|
|
3634
3889
|
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
3635
3890
|
// An unavailable source already states itself on its own row; a
|
|
3636
3891
|
// structural gap has no row to state it, so it gets one here.
|
|
3637
|
-
/* @__PURE__ */
|
|
3892
|
+
/* @__PURE__ */ jsx11("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-xs leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
3638
3893
|
)),
|
|
3639
|
-
loading.length > 0 && sources.length === 0 && /* @__PURE__ */
|
|
3640
|
-
inputs.length > 0 && /* @__PURE__ */
|
|
3641
|
-
/* @__PURE__ */
|
|
3642
|
-
/* @__PURE__ */
|
|
3894
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx11("p", { role: "status", className: "text-xs text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
3895
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "border-t border-border pt-2", children: [
|
|
3896
|
+
/* @__PURE__ */ jsx11("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
|
|
3897
|
+
/* @__PURE__ */ jsx11("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input, index) => /* @__PURE__ */ jsx11("li", { children: /* @__PURE__ */ jsx11(
|
|
3643
3898
|
ProvenanceValue,
|
|
3644
3899
|
{
|
|
3645
3900
|
record: input,
|
|
@@ -3660,26 +3915,26 @@ function ProvenanceValue({
|
|
|
3660
3915
|
}
|
|
3661
3916
|
function ProvenanceLegend({ bases, className }) {
|
|
3662
3917
|
if (bases.length === 0) return null;
|
|
3663
|
-
return /* @__PURE__ */
|
|
3918
|
+
return /* @__PURE__ */ jsx11("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
3664
3919
|
const meta = provenanceBasisMeta(basis);
|
|
3665
|
-
return /* @__PURE__ */
|
|
3666
|
-
/* @__PURE__ */
|
|
3920
|
+
return /* @__PURE__ */ jsxs9("li", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
3921
|
+
/* @__PURE__ */ jsxs9(
|
|
3667
3922
|
"span",
|
|
3668
3923
|
{
|
|
3669
3924
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[basis]}`,
|
|
3670
3925
|
children: [
|
|
3671
|
-
/* @__PURE__ */
|
|
3926
|
+
/* @__PURE__ */ jsx11(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
3672
3927
|
meta.label
|
|
3673
3928
|
]
|
|
3674
3929
|
}
|
|
3675
3930
|
),
|
|
3676
|
-
/* @__PURE__ */
|
|
3931
|
+
/* @__PURE__ */ jsx11("span", { children: meta.meaning })
|
|
3677
3932
|
] }, basis);
|
|
3678
3933
|
}) });
|
|
3679
3934
|
}
|
|
3680
3935
|
|
|
3681
3936
|
// src/web-react/seat-paywall.tsx
|
|
3682
|
-
import { Fragment as
|
|
3937
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3683
3938
|
function usd(cents) {
|
|
3684
3939
|
return new Intl.NumberFormat("en-US", {
|
|
3685
3940
|
style: "currency",
|
|
@@ -3689,7 +3944,7 @@ function usd(cents) {
|
|
|
3689
3944
|
}).format(cents / 100);
|
|
3690
3945
|
}
|
|
3691
3946
|
function CheckGlyph3() {
|
|
3692
|
-
return /* @__PURE__ */
|
|
3947
|
+
return /* @__PURE__ */ jsx12(
|
|
3693
3948
|
"svg",
|
|
3694
3949
|
{
|
|
3695
3950
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -3700,14 +3955,14 @@ function CheckGlyph3() {
|
|
|
3700
3955
|
strokeLinecap: "round",
|
|
3701
3956
|
strokeLinejoin: "round",
|
|
3702
3957
|
"aria-hidden": true,
|
|
3703
|
-
children: /* @__PURE__ */
|
|
3958
|
+
children: /* @__PURE__ */ jsx12("path", { d: "M20 6 9 17l-5-5" })
|
|
3704
3959
|
}
|
|
3705
3960
|
);
|
|
3706
3961
|
}
|
|
3707
3962
|
function Benefit({ children }) {
|
|
3708
|
-
return /* @__PURE__ */
|
|
3709
|
-
/* @__PURE__ */
|
|
3710
|
-
/* @__PURE__ */
|
|
3963
|
+
return /* @__PURE__ */ jsxs10("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
3964
|
+
/* @__PURE__ */ jsx12("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx12(CheckGlyph3, {}) }),
|
|
3965
|
+
/* @__PURE__ */ jsx12("span", { children })
|
|
3711
3966
|
] });
|
|
3712
3967
|
}
|
|
3713
3968
|
function SeatPaywall({
|
|
@@ -3725,45 +3980,45 @@ function SeatPaywall({
|
|
|
3725
3980
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
3726
3981
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
3727
3982
|
const introductory = offer?.introductory ?? null;
|
|
3728
|
-
return /* @__PURE__ */
|
|
3729
|
-
/* @__PURE__ */
|
|
3730
|
-
/* @__PURE__ */
|
|
3983
|
+
return /* @__PURE__ */ jsx12("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs10("div", { className: "w-full max-w-md rounded-2xl border border-card-edge bg-card p-8", children: [
|
|
3984
|
+
/* @__PURE__ */ jsx12("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: product }),
|
|
3985
|
+
/* @__PURE__ */ jsxs10("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
3731
3986
|
"Unlock ",
|
|
3732
3987
|
product
|
|
3733
3988
|
] }),
|
|
3734
|
-
tagline && /* @__PURE__ */
|
|
3735
|
-
introductory ? /* @__PURE__ */
|
|
3736
|
-
/* @__PURE__ */
|
|
3737
|
-
/* @__PURE__ */
|
|
3738
|
-
/* @__PURE__ */
|
|
3989
|
+
tagline && /* @__PURE__ */ jsx12("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
3990
|
+
introductory ? /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
3991
|
+
/* @__PURE__ */ jsxs10("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3992
|
+
/* @__PURE__ */ jsx12("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
3993
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
3739
3994
|
] }),
|
|
3740
|
-
/* @__PURE__ */
|
|
3995
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3741
3996
|
"Includes ",
|
|
3742
3997
|
usd(introductory.includedCreditsCents),
|
|
3743
3998
|
" of AI usage in your first month"
|
|
3744
3999
|
] }),
|
|
3745
|
-
/* @__PURE__ */
|
|
4000
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3746
4001
|
"Then ",
|
|
3747
4002
|
recurringPrice,
|
|
3748
4003
|
"/mo \xB7 includes ",
|
|
3749
4004
|
recurringUsage,
|
|
3750
4005
|
"/mo of AI usage"
|
|
3751
4006
|
] })
|
|
3752
|
-
] }) : /* @__PURE__ */
|
|
3753
|
-
/* @__PURE__ */
|
|
3754
|
-
/* @__PURE__ */
|
|
3755
|
-
/* @__PURE__ */
|
|
4007
|
+
] }) : /* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
4008
|
+
/* @__PURE__ */ jsxs10("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
4009
|
+
/* @__PURE__ */ jsx12("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
4010
|
+
/* @__PURE__ */ jsx12("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
3756
4011
|
] }),
|
|
3757
|
-
/* @__PURE__ */
|
|
4012
|
+
/* @__PURE__ */ jsxs10("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
3758
4013
|
"Includes ",
|
|
3759
4014
|
recurringUsage,
|
|
3760
4015
|
"/mo of AI usage"
|
|
3761
4016
|
] })
|
|
3762
4017
|
] }),
|
|
3763
|
-
/* @__PURE__ */
|
|
4018
|
+
/* @__PURE__ */ jsx12("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
3764
4019
|
`Full access to ${product}`
|
|
3765
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
4020
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx12(Benefit, { children: benefit }, i)) }),
|
|
4021
|
+
/* @__PURE__ */ jsx12(
|
|
3767
4022
|
"button",
|
|
3768
4023
|
{
|
|
3769
4024
|
type: "button",
|
|
@@ -3773,20 +4028,20 @@ function SeatPaywall({
|
|
|
3773
4028
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? "Continue to checkout"
|
|
3774
4029
|
}
|
|
3775
4030
|
),
|
|
3776
|
-
footnote && /* @__PURE__ */
|
|
4031
|
+
footnote && /* @__PURE__ */ jsx12("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
3777
4032
|
] }) });
|
|
3778
4033
|
}
|
|
3779
4034
|
|
|
3780
4035
|
// src/web-react/record-grid.tsx
|
|
3781
4036
|
import {
|
|
3782
|
-
Fragment as
|
|
4037
|
+
Fragment as Fragment6,
|
|
3783
4038
|
isValidElement,
|
|
3784
4039
|
useCallback as useCallback7,
|
|
3785
4040
|
useEffect as useEffect9,
|
|
3786
4041
|
useId as useId3,
|
|
3787
4042
|
useMemo as useMemo5,
|
|
3788
|
-
useRef as
|
|
3789
|
-
useState as
|
|
4043
|
+
useRef as useRef9,
|
|
4044
|
+
useState as useState14
|
|
3790
4045
|
} from "react";
|
|
3791
4046
|
|
|
3792
4047
|
// src/web-react/record-grid-model.ts
|
|
@@ -4142,7 +4397,7 @@ function pruneRecordGridOverlay(rows, overlay) {
|
|
|
4142
4397
|
}
|
|
4143
4398
|
|
|
4144
4399
|
// src/web-react/record-grid.tsx
|
|
4145
|
-
import { jsx as
|
|
4400
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4146
4401
|
var EMPTY_RECORD_GRID_ROWS = [];
|
|
4147
4402
|
var CELL_KEY_SEPARATOR = "\0";
|
|
4148
4403
|
function cellKey(rowId, columnId) {
|
|
@@ -4202,23 +4457,23 @@ function RecordGrid({
|
|
|
4202
4457
|
className
|
|
4203
4458
|
}) {
|
|
4204
4459
|
const fieldPrefix = useId3();
|
|
4205
|
-
const [overlay, setOverlay] =
|
|
4206
|
-
const [editing, setEditingState] =
|
|
4207
|
-
const [cellErrors, setCellErrors] =
|
|
4208
|
-
const [rowErrors, setRowErrors] =
|
|
4209
|
-
const [pendingRows, setPendingRows] =
|
|
4210
|
-
const [focus, setFocus] =
|
|
4211
|
-
const [openSource, setOpenSource] =
|
|
4212
|
-
const [confirmDelete, setConfirmDelete] =
|
|
4213
|
-
const [adding, setAdding] =
|
|
4214
|
-
const [draft, setDraft] =
|
|
4215
|
-
const [draftErrors, setDraftErrors] =
|
|
4216
|
-
const [draftError, setDraftError] =
|
|
4217
|
-
const [creating, setCreating] =
|
|
4218
|
-
const cellRefs =
|
|
4219
|
-
const settling =
|
|
4220
|
-
const draftCounter =
|
|
4221
|
-
const editingRef =
|
|
4460
|
+
const [overlay, setOverlay] = useState14(EMPTY_RECORD_GRID_OVERLAY);
|
|
4461
|
+
const [editing, setEditingState] = useState14(null);
|
|
4462
|
+
const [cellErrors, setCellErrors] = useState14({});
|
|
4463
|
+
const [rowErrors, setRowErrors] = useState14({});
|
|
4464
|
+
const [pendingRows, setPendingRows] = useState14({});
|
|
4465
|
+
const [focus, setFocus] = useState14(null);
|
|
4466
|
+
const [openSource, setOpenSource] = useState14(null);
|
|
4467
|
+
const [confirmDelete, setConfirmDelete] = useState14(null);
|
|
4468
|
+
const [adding, setAdding] = useState14(false);
|
|
4469
|
+
const [draft, setDraft] = useState14({ ...newRowDefaults ?? {} });
|
|
4470
|
+
const [draftErrors, setDraftErrors] = useState14({});
|
|
4471
|
+
const [draftError, setDraftError] = useState14(null);
|
|
4472
|
+
const [creating, setCreating] = useState14(false);
|
|
4473
|
+
const cellRefs = useRef9(/* @__PURE__ */ new Map());
|
|
4474
|
+
const settling = useRef9(false);
|
|
4475
|
+
const draftCounter = useRef9(0);
|
|
4476
|
+
const editingRef = useRef9(null);
|
|
4222
4477
|
const setEditing = useCallback7((next) => {
|
|
4223
4478
|
editingRef.current = next;
|
|
4224
4479
|
setEditingState(next);
|
|
@@ -4454,9 +4709,9 @@ function RecordGrid({
|
|
|
4454
4709
|
[beginEdit, columns, editing, focusCell, onUpdate, reviewing, visibleRows]
|
|
4455
4710
|
);
|
|
4456
4711
|
if (state.status === "idle" || state.status === "loading") {
|
|
4457
|
-
return /* @__PURE__ */
|
|
4712
|
+
return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4458
4713
|
toolbar,
|
|
4459
|
-
/* @__PURE__ */
|
|
4714
|
+
/* @__PURE__ */ jsxs11(
|
|
4460
4715
|
"div",
|
|
4461
4716
|
{
|
|
4462
4717
|
role: "status",
|
|
@@ -4464,22 +4719,22 @@ function RecordGrid({
|
|
|
4464
4719
|
"aria-live": "polite",
|
|
4465
4720
|
className: "space-y-2 rounded-xl border border-card-edge bg-card p-4",
|
|
4466
4721
|
children: [
|
|
4467
|
-
/* @__PURE__ */
|
|
4722
|
+
/* @__PURE__ */ jsxs11("span", { className: "sr-only", children: [
|
|
4468
4723
|
"Loading ",
|
|
4469
4724
|
caption
|
|
4470
4725
|
] }),
|
|
4471
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
4726
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx13("div", { className: "h-8 animate-pulse rounded-md bg-secondary", "aria-hidden": true }, index))
|
|
4472
4727
|
]
|
|
4473
4728
|
}
|
|
4474
4729
|
)
|
|
4475
4730
|
] });
|
|
4476
4731
|
}
|
|
4477
4732
|
if (state.status === "error") {
|
|
4478
|
-
return /* @__PURE__ */
|
|
4733
|
+
return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4479
4734
|
toolbar,
|
|
4480
|
-
/* @__PURE__ */
|
|
4481
|
-
/* @__PURE__ */
|
|
4482
|
-
/* @__PURE__ */
|
|
4735
|
+
/* @__PURE__ */ jsxs11("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
4736
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-destructive", children: state.message }),
|
|
4737
|
+
/* @__PURE__ */ jsx13(
|
|
4483
4738
|
"button",
|
|
4484
4739
|
{
|
|
4485
4740
|
type: "button",
|
|
@@ -4491,7 +4746,7 @@ function RecordGrid({
|
|
|
4491
4746
|
] })
|
|
4492
4747
|
] });
|
|
4493
4748
|
}
|
|
4494
|
-
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */
|
|
4749
|
+
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */ jsx13(
|
|
4495
4750
|
AddRecordForm,
|
|
4496
4751
|
{
|
|
4497
4752
|
columns,
|
|
@@ -4510,13 +4765,13 @@ function RecordGrid({
|
|
|
4510
4765
|
}
|
|
4511
4766
|
) : null;
|
|
4512
4767
|
if (visibleRows.length === 0 && !reviewing) {
|
|
4513
|
-
return /* @__PURE__ */
|
|
4768
|
+
return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4514
4769
|
toolbar,
|
|
4515
|
-
addForm ?? /* @__PURE__ */
|
|
4516
|
-
/* @__PURE__ */
|
|
4517
|
-
empty.description && /* @__PURE__ */
|
|
4518
|
-
/* @__PURE__ */
|
|
4519
|
-
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */
|
|
4770
|
+
addForm ?? /* @__PURE__ */ jsxs11("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
|
|
4771
|
+
/* @__PURE__ */ jsx13("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
|
|
4772
|
+
empty.description && /* @__PURE__ */ jsx13("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
|
|
4773
|
+
/* @__PURE__ */ jsxs11("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
|
|
4774
|
+
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */ jsx13(
|
|
4520
4775
|
"button",
|
|
4521
4776
|
{
|
|
4522
4777
|
type: "button",
|
|
@@ -4525,7 +4780,7 @@ function RecordGrid({
|
|
|
4525
4780
|
children: empty.action.label
|
|
4526
4781
|
}
|
|
4527
4782
|
)),
|
|
4528
|
-
onCreate && /* @__PURE__ */
|
|
4783
|
+
onCreate && /* @__PURE__ */ jsx13(
|
|
4529
4784
|
"button",
|
|
4530
4785
|
{
|
|
4531
4786
|
type: "button",
|
|
@@ -4550,18 +4805,18 @@ function RecordGrid({
|
|
|
4550
4805
|
addedCount > 0 ? `${addedCount} added` : null,
|
|
4551
4806
|
removedCount > 0 ? `${removedCount} removed` : null
|
|
4552
4807
|
].filter((part) => part !== null).join(" \xB7 ");
|
|
4553
|
-
const reviewBar = reviewing ? /* @__PURE__ */
|
|
4808
|
+
const reviewBar = reviewing ? /* @__PURE__ */ jsxs11(
|
|
4554
4809
|
"div",
|
|
4555
4810
|
{
|
|
4556
4811
|
"data-record-grid-review": "",
|
|
4557
4812
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-xl border border-card-edge bg-card px-4 py-2.5",
|
|
4558
4813
|
children: [
|
|
4559
|
-
/* @__PURE__ */
|
|
4560
|
-
/* @__PURE__ */
|
|
4561
|
-
/* @__PURE__ */
|
|
4814
|
+
/* @__PURE__ */ jsxs11("div", { className: "min-w-0", children: [
|
|
4815
|
+
/* @__PURE__ */ jsx13("p", { className: "text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: "Proposed changes" }),
|
|
4816
|
+
/* @__PURE__ */ jsx13("p", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: reviewSummary })
|
|
4562
4817
|
] }),
|
|
4563
|
-
(onAcceptAll || onRejectAll) && /* @__PURE__ */
|
|
4564
|
-
onRejectAll && /* @__PURE__ */
|
|
4818
|
+
(onAcceptAll || onRejectAll) && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
4819
|
+
onRejectAll && /* @__PURE__ */ jsx13(
|
|
4565
4820
|
"button",
|
|
4566
4821
|
{
|
|
4567
4822
|
type: "button",
|
|
@@ -4571,7 +4826,7 @@ function RecordGrid({
|
|
|
4571
4826
|
children: "Reject all"
|
|
4572
4827
|
}
|
|
4573
4828
|
),
|
|
4574
|
-
onAcceptAll && /* @__PURE__ */
|
|
4829
|
+
onAcceptAll && /* @__PURE__ */ jsx13(
|
|
4575
4830
|
"button",
|
|
4576
4831
|
{
|
|
4577
4832
|
type: "button",
|
|
@@ -4585,10 +4840,10 @@ function RecordGrid({
|
|
|
4585
4840
|
]
|
|
4586
4841
|
}
|
|
4587
4842
|
) : null;
|
|
4588
|
-
return /* @__PURE__ */
|
|
4843
|
+
return /* @__PURE__ */ jsxs11("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
4589
4844
|
toolbar,
|
|
4590
4845
|
reviewBar,
|
|
4591
|
-
/* @__PURE__ */
|
|
4846
|
+
/* @__PURE__ */ jsx13("div", { className: "overflow-x-auto rounded-xl border border-card-edge bg-card", children: /* @__PURE__ */ jsxs11(
|
|
4592
4847
|
"table",
|
|
4593
4848
|
{
|
|
4594
4849
|
role: "grid",
|
|
@@ -4596,8 +4851,8 @@ function RecordGrid({
|
|
|
4596
4851
|
className: "w-full border-collapse text-left text-sm",
|
|
4597
4852
|
onKeyDown: handleGridKeyDown,
|
|
4598
4853
|
children: [
|
|
4599
|
-
/* @__PURE__ */
|
|
4600
|
-
columns.map((column) => /* @__PURE__ */
|
|
4854
|
+
/* @__PURE__ */ jsx13("thead", { children: /* @__PURE__ */ jsxs11("tr", { role: "row", className: "border-b border-border text-xs uppercase tracking-[0.05em] text-muted-foreground", children: [
|
|
4855
|
+
columns.map((column) => /* @__PURE__ */ jsx13(
|
|
4601
4856
|
"th",
|
|
4602
4857
|
{
|
|
4603
4858
|
role: "columnheader",
|
|
@@ -4607,17 +4862,17 @@ function RecordGrid({
|
|
|
4607
4862
|
},
|
|
4608
4863
|
column.id
|
|
4609
4864
|
)),
|
|
4610
|
-
showActionsColumn && /* @__PURE__ */
|
|
4865
|
+
showActionsColumn && /* @__PURE__ */ jsx13("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx13("span", { className: "sr-only", children: reviewing ? "Review" : "Row actions" }) })
|
|
4611
4866
|
] }) }),
|
|
4612
|
-
/* @__PURE__ */
|
|
4867
|
+
/* @__PURE__ */ jsxs11("tbody", { children: [
|
|
4613
4868
|
visibleRows.map((row) => {
|
|
4614
4869
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
4615
4870
|
const pending = row.id in pendingRows;
|
|
4616
4871
|
const rowError = rowErrors[row.id];
|
|
4617
4872
|
const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
|
|
4618
4873
|
const removedRow = rowDiff?.kind === "removed";
|
|
4619
|
-
return /* @__PURE__ */
|
|
4620
|
-
/* @__PURE__ */
|
|
4874
|
+
return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
4875
|
+
/* @__PURE__ */ jsxs11(
|
|
4621
4876
|
"tr",
|
|
4622
4877
|
{
|
|
4623
4878
|
role: "row",
|
|
@@ -4637,8 +4892,8 @@ function RecordGrid({
|
|
|
4637
4892
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
4638
4893
|
const cellDiff = rowDiff?.kind === "changed" ? diffCellByKey.get(key) : void 0;
|
|
4639
4894
|
if (isEditing && editable) {
|
|
4640
|
-
return /* @__PURE__ */
|
|
4641
|
-
/* @__PURE__ */
|
|
4895
|
+
return /* @__PURE__ */ jsxs11("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
4896
|
+
/* @__PURE__ */ jsx13(
|
|
4642
4897
|
CellEditor,
|
|
4643
4898
|
{
|
|
4644
4899
|
column,
|
|
@@ -4651,11 +4906,11 @@ function RecordGrid({
|
|
|
4651
4906
|
onCancel: () => cancelEdit(row, column)
|
|
4652
4907
|
}
|
|
4653
4908
|
),
|
|
4654
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
4909
|
+
cellError !== void 0 && /* @__PURE__ */ jsx13("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
4655
4910
|
] }, column.id);
|
|
4656
4911
|
}
|
|
4657
4912
|
if (column.kind === "boolean" && editable) {
|
|
4658
|
-
return /* @__PURE__ */
|
|
4913
|
+
return /* @__PURE__ */ jsx13("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx13(
|
|
4659
4914
|
"input",
|
|
4660
4915
|
{
|
|
4661
4916
|
type: "checkbox",
|
|
@@ -4674,7 +4929,7 @@ function RecordGrid({
|
|
|
4674
4929
|
) }, column.id);
|
|
4675
4930
|
}
|
|
4676
4931
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
4677
|
-
return /* @__PURE__ */
|
|
4932
|
+
return /* @__PURE__ */ jsx13(
|
|
4678
4933
|
"td",
|
|
4679
4934
|
{
|
|
4680
4935
|
role: "gridcell",
|
|
@@ -4692,20 +4947,20 @@ function RecordGrid({
|
|
|
4692
4947
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
4693
4948
|
column
|
|
4694
4949
|
)} ${editable ? "cursor-text" : ""}`,
|
|
4695
|
-
children: /* @__PURE__ */
|
|
4696
|
-
column.id === columns[0]?.id && removedRow && /* @__PURE__ */
|
|
4697
|
-
cellDiff ? /* @__PURE__ */
|
|
4698
|
-
/* @__PURE__ */
|
|
4699
|
-
/* @__PURE__ */
|
|
4700
|
-
/* @__PURE__ */
|
|
4701
|
-
] }) : /* @__PURE__ */
|
|
4950
|
+
children: /* @__PURE__ */ jsxs11("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4951
|
+
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx13("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" }),
|
|
4952
|
+
cellDiff ? /* @__PURE__ */ jsxs11("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
4953
|
+
/* @__PURE__ */ jsx13("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
4954
|
+
/* @__PURE__ */ jsx13("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
4955
|
+
/* @__PURE__ */ jsx13("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
4956
|
+
] }) : /* @__PURE__ */ jsx13(
|
|
4702
4957
|
"span",
|
|
4703
4958
|
{
|
|
4704
4959
|
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
4705
4960
|
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
4706
4961
|
}
|
|
4707
4962
|
),
|
|
4708
|
-
source && /* @__PURE__ */
|
|
4963
|
+
source && /* @__PURE__ */ jsx13(
|
|
4709
4964
|
SourceMarker,
|
|
4710
4965
|
{
|
|
4711
4966
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -4721,7 +4976,7 @@ function RecordGrid({
|
|
|
4721
4976
|
column.id
|
|
4722
4977
|
);
|
|
4723
4978
|
}),
|
|
4724
|
-
showActionsColumn && /* @__PURE__ */
|
|
4979
|
+
showActionsColumn && /* @__PURE__ */ jsx13("td", { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx13(
|
|
4725
4980
|
ReviewActions,
|
|
4726
4981
|
{
|
|
4727
4982
|
rowId: row.id,
|
|
@@ -4730,8 +4985,8 @@ function RecordGrid({
|
|
|
4730
4985
|
onAccept: onAcceptRow,
|
|
4731
4986
|
onReject: onRejectRow
|
|
4732
4987
|
}
|
|
4733
|
-
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */
|
|
4734
|
-
/* @__PURE__ */
|
|
4988
|
+
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4989
|
+
/* @__PURE__ */ jsx13(
|
|
4735
4990
|
"button",
|
|
4736
4991
|
{
|
|
4737
4992
|
type: "button",
|
|
@@ -4741,7 +4996,7 @@ function RecordGrid({
|
|
|
4741
4996
|
children: "Delete"
|
|
4742
4997
|
}
|
|
4743
4998
|
),
|
|
4744
|
-
/* @__PURE__ */
|
|
4999
|
+
/* @__PURE__ */ jsx13(
|
|
4745
5000
|
"button",
|
|
4746
5001
|
{
|
|
4747
5002
|
type: "button",
|
|
@@ -4751,14 +5006,14 @@ function RecordGrid({
|
|
|
4751
5006
|
children: "Cancel"
|
|
4752
5007
|
}
|
|
4753
5008
|
)
|
|
4754
|
-
] }) : /* @__PURE__ */
|
|
5009
|
+
] }) : /* @__PURE__ */ jsx13(
|
|
4755
5010
|
"button",
|
|
4756
5011
|
{
|
|
4757
5012
|
type: "button",
|
|
4758
5013
|
"aria-label": `Delete ${rowLabel}`,
|
|
4759
5014
|
onClick: () => setConfirmDelete(row.id),
|
|
4760
5015
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
4761
|
-
children: /* @__PURE__ */
|
|
5016
|
+
children: /* @__PURE__ */ jsxs11(
|
|
4762
5017
|
"svg",
|
|
4763
5018
|
{
|
|
4764
5019
|
viewBox: "0 0 24 24",
|
|
@@ -4770,8 +5025,8 @@ function RecordGrid({
|
|
|
4770
5025
|
strokeLinejoin: "round",
|
|
4771
5026
|
"aria-hidden": true,
|
|
4772
5027
|
children: [
|
|
4773
|
-
/* @__PURE__ */
|
|
4774
|
-
/* @__PURE__ */
|
|
5028
|
+
/* @__PURE__ */ jsx13("polyline", { points: "3 6 5 6 21 6" }),
|
|
5029
|
+
/* @__PURE__ */ jsx13("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" })
|
|
4775
5030
|
]
|
|
4776
5031
|
}
|
|
4777
5032
|
)
|
|
@@ -4780,12 +5035,12 @@ function RecordGrid({
|
|
|
4780
5035
|
]
|
|
4781
5036
|
}
|
|
4782
5037
|
),
|
|
4783
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
5038
|
+
rowError !== void 0 && /* @__PURE__ */ jsx13("tr", { role: "row", className: "border-b border-border", children: /* @__PURE__ */ jsx13("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx13("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
4784
5039
|
] }, row.id);
|
|
4785
5040
|
}),
|
|
4786
5041
|
reviewing && addedRows.map((row) => {
|
|
4787
5042
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
4788
|
-
return /* @__PURE__ */
|
|
5043
|
+
return /* @__PURE__ */ jsxs11(
|
|
4789
5044
|
"tr",
|
|
4790
5045
|
{
|
|
4791
5046
|
role: "row",
|
|
@@ -4796,9 +5051,9 @@ function RecordGrid({
|
|
|
4796
5051
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
4797
5052
|
const value = row.values[column.id] ?? null;
|
|
4798
5053
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
4799
|
-
return /* @__PURE__ */
|
|
4800
|
-
columnIndex === 0 && /* @__PURE__ */
|
|
4801
|
-
/* @__PURE__ */
|
|
5054
|
+
return /* @__PURE__ */ jsx13("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs11("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
5055
|
+
columnIndex === 0 && /* @__PURE__ */ jsx13("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" }),
|
|
5056
|
+
/* @__PURE__ */ jsx13(
|
|
4802
5057
|
"span",
|
|
4803
5058
|
{
|
|
4804
5059
|
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
@@ -4807,7 +5062,7 @@ function RecordGrid({
|
|
|
4807
5062
|
)
|
|
4808
5063
|
] }) }, column.id);
|
|
4809
5064
|
}),
|
|
4810
|
-
/* @__PURE__ */
|
|
5065
|
+
/* @__PURE__ */ jsx13("td", { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx13(
|
|
4811
5066
|
ReviewActions,
|
|
4812
5067
|
{
|
|
4813
5068
|
rowId: row.id,
|
|
@@ -4823,8 +5078,8 @@ function RecordGrid({
|
|
|
4823
5078
|
);
|
|
4824
5079
|
})
|
|
4825
5080
|
] }),
|
|
4826
|
-
hasFooter && /* @__PURE__ */
|
|
4827
|
-
columns.map((column) => /* @__PURE__ */
|
|
5081
|
+
hasFooter && /* @__PURE__ */ jsx13("tfoot", { children: /* @__PURE__ */ jsxs11("tr", { role: "row", className: "border-t-2 border-border", children: [
|
|
5082
|
+
columns.map((column) => /* @__PURE__ */ jsx13(
|
|
4828
5083
|
"td",
|
|
4829
5084
|
{
|
|
4830
5085
|
role: "gridcell",
|
|
@@ -4833,19 +5088,19 @@ function RecordGrid({
|
|
|
4833
5088
|
},
|
|
4834
5089
|
column.id
|
|
4835
5090
|
)),
|
|
4836
|
-
showActionsColumn && /* @__PURE__ */
|
|
5091
|
+
showActionsColumn && /* @__PURE__ */ jsx13("td", { role: "gridcell" })
|
|
4837
5092
|
] }) })
|
|
4838
5093
|
]
|
|
4839
5094
|
}
|
|
4840
5095
|
) }),
|
|
4841
|
-
onCreate && !reviewing && (addForm ?? /* @__PURE__ */
|
|
5096
|
+
onCreate && !reviewing && (addForm ?? /* @__PURE__ */ jsxs11(
|
|
4842
5097
|
"button",
|
|
4843
5098
|
{
|
|
4844
5099
|
type: "button",
|
|
4845
5100
|
onClick: openAdd,
|
|
4846
5101
|
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",
|
|
4847
5102
|
children: [
|
|
4848
|
-
/* @__PURE__ */
|
|
5103
|
+
/* @__PURE__ */ jsxs11(
|
|
4849
5104
|
"svg",
|
|
4850
5105
|
{
|
|
4851
5106
|
viewBox: "0 0 24 24",
|
|
@@ -4857,8 +5112,8 @@ function RecordGrid({
|
|
|
4857
5112
|
strokeLinejoin: "round",
|
|
4858
5113
|
"aria-hidden": true,
|
|
4859
5114
|
children: [
|
|
4860
|
-
/* @__PURE__ */
|
|
4861
|
-
/* @__PURE__ */
|
|
5115
|
+
/* @__PURE__ */ jsx13("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
5116
|
+
/* @__PURE__ */ jsx13("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
4862
5117
|
]
|
|
4863
5118
|
}
|
|
4864
5119
|
),
|
|
@@ -4870,8 +5125,8 @@ function RecordGrid({
|
|
|
4870
5125
|
}
|
|
4871
5126
|
function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
4872
5127
|
const noun = kind === "changed" ? `proposed change to ${rowLabel}` : kind === "added" ? `new row ${rowLabel}` : `removal of ${rowLabel}`;
|
|
4873
|
-
return /* @__PURE__ */
|
|
4874
|
-
onReject && /* @__PURE__ */
|
|
5128
|
+
return /* @__PURE__ */ jsxs11("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
5129
|
+
onReject && /* @__PURE__ */ jsx13(
|
|
4875
5130
|
"button",
|
|
4876
5131
|
{
|
|
4877
5132
|
type: "button",
|
|
@@ -4881,7 +5136,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
4881
5136
|
children: "Reject"
|
|
4882
5137
|
}
|
|
4883
5138
|
),
|
|
4884
|
-
onAccept && /* @__PURE__ */
|
|
5139
|
+
onAccept && /* @__PURE__ */ jsx13(
|
|
4885
5140
|
"button",
|
|
4886
5141
|
{
|
|
4887
5142
|
type: "button",
|
|
@@ -4902,7 +5157,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4902
5157
|
className: INPUT_CLASS
|
|
4903
5158
|
};
|
|
4904
5159
|
if (column.kind === "select") {
|
|
4905
|
-
return /* @__PURE__ */
|
|
5160
|
+
return /* @__PURE__ */ jsxs11(
|
|
4906
5161
|
"select",
|
|
4907
5162
|
{
|
|
4908
5163
|
...shared,
|
|
@@ -4919,8 +5174,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4919
5174
|
},
|
|
4920
5175
|
onBlur: () => onCommit(text),
|
|
4921
5176
|
children: [
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5177
|
+
/* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
|
|
5178
|
+
column.options.map((option) => /* @__PURE__ */ jsx13("option", { value: option.value, children: option.label }, option.value))
|
|
4924
5179
|
]
|
|
4925
5180
|
}
|
|
4926
5181
|
);
|
|
@@ -4938,7 +5193,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4938
5193
|
}
|
|
4939
5194
|
};
|
|
4940
5195
|
if (column.kind === "text" && column.multiline === true) {
|
|
4941
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx13(
|
|
4942
5197
|
"textarea",
|
|
4943
5198
|
{
|
|
4944
5199
|
...shared,
|
|
@@ -4950,7 +5205,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
4950
5205
|
}
|
|
4951
5206
|
);
|
|
4952
5207
|
}
|
|
4953
|
-
return /* @__PURE__ */
|
|
5208
|
+
return /* @__PURE__ */ jsx13(
|
|
4954
5209
|
"input",
|
|
4955
5210
|
{
|
|
4956
5211
|
...shared,
|
|
@@ -4972,8 +5227,8 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4972
5227
|
[onToggle]
|
|
4973
5228
|
);
|
|
4974
5229
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
4975
|
-
return /* @__PURE__ */
|
|
4976
|
-
/* @__PURE__ */
|
|
5230
|
+
return /* @__PURE__ */ jsxs11("span", { ref: containerRef, className: "relative inline-flex", children: [
|
|
5231
|
+
/* @__PURE__ */ jsx13(
|
|
4977
5232
|
"button",
|
|
4978
5233
|
{
|
|
4979
5234
|
type: "button",
|
|
@@ -4986,7 +5241,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4986
5241
|
onToggle();
|
|
4987
5242
|
},
|
|
4988
5243
|
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
4989
|
-
children: /* @__PURE__ */
|
|
5244
|
+
children: /* @__PURE__ */ jsx13(
|
|
4990
5245
|
"svg",
|
|
4991
5246
|
{
|
|
4992
5247
|
viewBox: "0 0 24 24",
|
|
@@ -4996,12 +5251,12 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4996
5251
|
strokeWidth: "2.5",
|
|
4997
5252
|
strokeLinecap: "round",
|
|
4998
5253
|
"aria-hidden": true,
|
|
4999
|
-
children: /* @__PURE__ */
|
|
5254
|
+
children: /* @__PURE__ */ jsx13("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
5000
5255
|
}
|
|
5001
5256
|
)
|
|
5002
5257
|
}
|
|
5003
5258
|
),
|
|
5004
|
-
/* @__PURE__ */
|
|
5259
|
+
/* @__PURE__ */ jsxs11(
|
|
5005
5260
|
PopoverSurface,
|
|
5006
5261
|
{
|
|
5007
5262
|
open,
|
|
@@ -5011,17 +5266,17 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
5011
5266
|
panelRef,
|
|
5012
5267
|
className: `w-64 rounded-lg border border-card-edge bg-popover p-3 text-left ${OVERLAY_SHADOW}`,
|
|
5013
5268
|
children: [
|
|
5014
|
-
source.quote && /* @__PURE__ */
|
|
5269
|
+
source.quote && /* @__PURE__ */ jsxs11("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
5015
5270
|
"\u201C",
|
|
5016
5271
|
source.quote,
|
|
5017
5272
|
"\u201D"
|
|
5018
5273
|
] }),
|
|
5019
|
-
/* @__PURE__ */
|
|
5274
|
+
/* @__PURE__ */ jsxs11("span", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
5020
5275
|
source.label ?? "Source",
|
|
5021
5276
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
5022
5277
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
5023
5278
|
] }),
|
|
5024
|
-
source.href && /* @__PURE__ */
|
|
5279
|
+
source.href && /* @__PURE__ */ jsx13(
|
|
5025
5280
|
"a",
|
|
5026
5281
|
{
|
|
5027
5282
|
href: source.href,
|
|
@@ -5050,7 +5305,7 @@ function AddRecordForm({
|
|
|
5050
5305
|
onCancel
|
|
5051
5306
|
}) {
|
|
5052
5307
|
const groups = useMemo5(() => groupColumns(columns), [columns]);
|
|
5053
|
-
return /* @__PURE__ */
|
|
5308
|
+
return /* @__PURE__ */ jsxs11(
|
|
5054
5309
|
"form",
|
|
5055
5310
|
{
|
|
5056
5311
|
noValidate: true,
|
|
@@ -5061,31 +5316,31 @@ function AddRecordForm({
|
|
|
5061
5316
|
},
|
|
5062
5317
|
className: "space-y-4 rounded-xl border border-card-edge bg-card p-4",
|
|
5063
5318
|
children: [
|
|
5064
|
-
/* @__PURE__ */
|
|
5065
|
-
formError !== null && /* @__PURE__ */
|
|
5319
|
+
/* @__PURE__ */ jsx13("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
5320
|
+
formError !== null && /* @__PURE__ */ jsx13("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
5066
5321
|
groups.map((group) => {
|
|
5067
5322
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
5068
5323
|
if (fields.length === 0) return null;
|
|
5069
|
-
return /* @__PURE__ */
|
|
5324
|
+
return /* @__PURE__ */ jsxs11(
|
|
5070
5325
|
"fieldset",
|
|
5071
5326
|
{
|
|
5072
5327
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-card-edge p-3",
|
|
5073
5328
|
children: [
|
|
5074
|
-
group.label !== null && /* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5329
|
+
group.label !== null && /* @__PURE__ */ jsx13("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
5330
|
+
/* @__PURE__ */ jsx13("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
5076
5331
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
5077
5332
|
const errorId = `${fieldId}-error`;
|
|
5078
5333
|
const message = errors[column.id];
|
|
5079
|
-
return /* @__PURE__ */
|
|
5334
|
+
return /* @__PURE__ */ jsxs11(
|
|
5080
5335
|
"div",
|
|
5081
5336
|
{
|
|
5082
5337
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
5083
5338
|
children: [
|
|
5084
|
-
/* @__PURE__ */
|
|
5339
|
+
/* @__PURE__ */ jsxs11("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
5085
5340
|
column.header,
|
|
5086
|
-
column.required === true && /* @__PURE__ */
|
|
5341
|
+
column.required === true && /* @__PURE__ */ jsx13("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
5087
5342
|
] }),
|
|
5088
|
-
/* @__PURE__ */
|
|
5343
|
+
/* @__PURE__ */ jsx13(
|
|
5089
5344
|
DraftField,
|
|
5090
5345
|
{
|
|
5091
5346
|
column,
|
|
@@ -5096,8 +5351,8 @@ function AddRecordForm({
|
|
|
5096
5351
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
5097
5352
|
}
|
|
5098
5353
|
),
|
|
5099
|
-
column.hint && /* @__PURE__ */
|
|
5100
|
-
message !== void 0 && /* @__PURE__ */
|
|
5354
|
+
column.hint && /* @__PURE__ */ jsx13("p", { className: "mt-1 text-xs text-muted-foreground", children: column.hint }),
|
|
5355
|
+
message !== void 0 && /* @__PURE__ */ jsx13("p", { id: errorId, role: "alert", className: "mt-1 text-xs text-destructive", children: message })
|
|
5101
5356
|
]
|
|
5102
5357
|
},
|
|
5103
5358
|
column.id
|
|
@@ -5108,8 +5363,8 @@ function AddRecordForm({
|
|
|
5108
5363
|
group.label ?? "_"
|
|
5109
5364
|
);
|
|
5110
5365
|
}),
|
|
5111
|
-
/* @__PURE__ */
|
|
5112
|
-
/* @__PURE__ */
|
|
5366
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
5367
|
+
/* @__PURE__ */ jsx13(
|
|
5113
5368
|
"button",
|
|
5114
5369
|
{
|
|
5115
5370
|
type: "submit",
|
|
@@ -5118,7 +5373,7 @@ function AddRecordForm({
|
|
|
5118
5373
|
children: busy ? "Saving\u2026" : "Save"
|
|
5119
5374
|
}
|
|
5120
5375
|
),
|
|
5121
|
-
/* @__PURE__ */
|
|
5376
|
+
/* @__PURE__ */ jsx13(
|
|
5122
5377
|
"button",
|
|
5123
5378
|
{
|
|
5124
5379
|
type: "button",
|
|
@@ -5139,7 +5394,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5139
5394
|
"aria-describedby": describedBy
|
|
5140
5395
|
};
|
|
5141
5396
|
if (column.kind === "boolean") {
|
|
5142
|
-
return /* @__PURE__ */
|
|
5397
|
+
return /* @__PURE__ */ jsx13(
|
|
5143
5398
|
"input",
|
|
5144
5399
|
{
|
|
5145
5400
|
...shared,
|
|
@@ -5151,7 +5406,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5151
5406
|
);
|
|
5152
5407
|
}
|
|
5153
5408
|
if (column.kind === "select") {
|
|
5154
|
-
return /* @__PURE__ */
|
|
5409
|
+
return /* @__PURE__ */ jsxs11(
|
|
5155
5410
|
"select",
|
|
5156
5411
|
{
|
|
5157
5412
|
...shared,
|
|
@@ -5159,14 +5414,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5159
5414
|
value: typeof value === "string" ? value : "",
|
|
5160
5415
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
5161
5416
|
children: [
|
|
5162
|
-
/* @__PURE__ */
|
|
5163
|
-
column.options.map((option) => /* @__PURE__ */
|
|
5417
|
+
/* @__PURE__ */ jsx13("option", { value: "", children: "\u2014" }),
|
|
5418
|
+
column.options.map((option) => /* @__PURE__ */ jsx13("option", { value: option.value, children: option.label }, option.value))
|
|
5164
5419
|
]
|
|
5165
5420
|
}
|
|
5166
5421
|
);
|
|
5167
5422
|
}
|
|
5168
5423
|
if (column.kind === "text" && column.multiline === true) {
|
|
5169
|
-
return /* @__PURE__ */
|
|
5424
|
+
return /* @__PURE__ */ jsx13(
|
|
5170
5425
|
"textarea",
|
|
5171
5426
|
{
|
|
5172
5427
|
...shared,
|
|
@@ -5178,7 +5433,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5178
5433
|
);
|
|
5179
5434
|
}
|
|
5180
5435
|
if (column.kind === "number" || column.kind === "currency") {
|
|
5181
|
-
return /* @__PURE__ */
|
|
5436
|
+
return /* @__PURE__ */ jsx13(
|
|
5182
5437
|
"input",
|
|
5183
5438
|
{
|
|
5184
5439
|
...shared,
|
|
@@ -5198,7 +5453,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
5198
5453
|
}
|
|
5199
5454
|
);
|
|
5200
5455
|
}
|
|
5201
|
-
return /* @__PURE__ */
|
|
5456
|
+
return /* @__PURE__ */ jsx13(
|
|
5202
5457
|
"input",
|
|
5203
5458
|
{
|
|
5204
5459
|
...shared,
|
|
@@ -5216,15 +5471,15 @@ import {
|
|
|
5216
5471
|
useEffect as useEffect10,
|
|
5217
5472
|
useId as useId4,
|
|
5218
5473
|
useMemo as useMemo6,
|
|
5219
|
-
useRef as
|
|
5220
|
-
useState as
|
|
5474
|
+
useRef as useRef10,
|
|
5475
|
+
useState as useState15
|
|
5221
5476
|
} from "react";
|
|
5222
5477
|
import { createPortal } from "react-dom";
|
|
5223
|
-
import { Fragment as
|
|
5478
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
5224
5479
|
function SearchGlyph({ className }) {
|
|
5225
|
-
return /* @__PURE__ */
|
|
5226
|
-
/* @__PURE__ */
|
|
5227
|
-
/* @__PURE__ */
|
|
5480
|
+
return /* @__PURE__ */ jsxs12("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5481
|
+
/* @__PURE__ */ jsx14("circle", { cx: "11", cy: "11", r: "8" }),
|
|
5482
|
+
/* @__PURE__ */ jsx14("path", { d: "m21 21-4.3-4.3" })
|
|
5228
5483
|
] });
|
|
5229
5484
|
}
|
|
5230
5485
|
function CommandPalette({
|
|
@@ -5239,7 +5494,7 @@ function CommandPalette({
|
|
|
5239
5494
|
emptyMessage,
|
|
5240
5495
|
label = "Command palette"
|
|
5241
5496
|
}) {
|
|
5242
|
-
const [internalOpen, setInternalOpen] =
|
|
5497
|
+
const [internalOpen, setInternalOpen] = useState15(false);
|
|
5243
5498
|
const open = controlledOpen ?? internalOpen;
|
|
5244
5499
|
const setOpen = useCallback8(
|
|
5245
5500
|
(next) => {
|
|
@@ -5248,9 +5503,9 @@ function CommandPalette({
|
|
|
5248
5503
|
},
|
|
5249
5504
|
[controlledOpen, onOpenChange]
|
|
5250
5505
|
);
|
|
5251
|
-
const [query, setQuery] =
|
|
5252
|
-
const [active, setActive] =
|
|
5253
|
-
const inputRef =
|
|
5506
|
+
const [query, setQuery] = useState15(initialQuery ?? "");
|
|
5507
|
+
const [active, setActive] = useState15(0);
|
|
5508
|
+
const inputRef = useRef10(null);
|
|
5254
5509
|
const surfaceId = useId4();
|
|
5255
5510
|
const listId = `${surfaceId}-list`;
|
|
5256
5511
|
const flat = useMemo6(() => filterCommandPaletteItems(items, query), [items, query]);
|
|
@@ -5268,7 +5523,7 @@ function CommandPalette({
|
|
|
5268
5523
|
document.addEventListener("keydown", onKeyDown);
|
|
5269
5524
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
5270
5525
|
}, [hotkey, open, setOpen]);
|
|
5271
|
-
const restoreFocusRef =
|
|
5526
|
+
const restoreFocusRef = useRef10(null);
|
|
5272
5527
|
useEffect10(() => {
|
|
5273
5528
|
if (open) {
|
|
5274
5529
|
restoreFocusRef.current = document.activeElement;
|
|
@@ -5311,8 +5566,8 @@ function CommandPalette({
|
|
|
5311
5566
|
if (!open || typeof document === "undefined") return null;
|
|
5312
5567
|
let rowIndex = -1;
|
|
5313
5568
|
return createPortal(
|
|
5314
|
-
/* @__PURE__ */
|
|
5315
|
-
/* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
5570
|
+
/* @__PURE__ */ jsx14(
|
|
5316
5571
|
"div",
|
|
5317
5572
|
{
|
|
5318
5573
|
"aria-hidden": true,
|
|
@@ -5321,7 +5576,7 @@ function CommandPalette({
|
|
|
5321
5576
|
className: "fixed inset-0 z-[999] bg-background/80"
|
|
5322
5577
|
}
|
|
5323
5578
|
),
|
|
5324
|
-
/* @__PURE__ */
|
|
5579
|
+
/* @__PURE__ */ jsx14("div", { className: "pointer-events-none fixed inset-x-0 top-[15%] z-[1000] flex justify-center px-4", children: /* @__PURE__ */ jsxs12(
|
|
5325
5580
|
"div",
|
|
5326
5581
|
{
|
|
5327
5582
|
role: "dialog",
|
|
@@ -5330,9 +5585,9 @@ function CommandPalette({
|
|
|
5330
5585
|
...{ [POPOVER_SURFACE_ATTR]: surfaceId },
|
|
5331
5586
|
className: `agent-pop-in pointer-events-auto flex max-h-[70vh] w-[560px] max-w-full flex-col overflow-hidden rounded-xl border border-card-edge bg-popover ${OVERLAY_SHADOW}`,
|
|
5332
5587
|
children: [
|
|
5333
|
-
/* @__PURE__ */
|
|
5334
|
-
/* @__PURE__ */
|
|
5335
|
-
/* @__PURE__ */
|
|
5588
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
5589
|
+
/* @__PURE__ */ jsx14(SearchGlyph, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
5590
|
+
/* @__PURE__ */ jsx14(
|
|
5336
5591
|
"input",
|
|
5337
5592
|
{
|
|
5338
5593
|
ref: inputRef,
|
|
@@ -5353,15 +5608,15 @@ function CommandPalette({
|
|
|
5353
5608
|
}
|
|
5354
5609
|
)
|
|
5355
5610
|
] }),
|
|
5356
|
-
/* @__PURE__ */
|
|
5357
|
-
loading && /* @__PURE__ */
|
|
5358
|
-
!loading && flat.length === 0 && /* @__PURE__ */
|
|
5359
|
-
!loading && sections.map((section) => /* @__PURE__ */
|
|
5360
|
-
/* @__PURE__ */
|
|
5611
|
+
/* @__PURE__ */ jsxs12("div", { role: "listbox", id: listId, className: "min-h-0 flex-1 overflow-y-auto p-1 pb-2", children: [
|
|
5612
|
+
loading && /* @__PURE__ */ jsx14("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading\u2026" }),
|
|
5613
|
+
!loading && flat.length === 0 && /* @__PURE__ */ jsx14("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") }),
|
|
5614
|
+
!loading && sections.map((section) => /* @__PURE__ */ jsxs12("div", { children: [
|
|
5615
|
+
/* @__PURE__ */ jsx14("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.group }),
|
|
5361
5616
|
section.items.map((item) => {
|
|
5362
5617
|
rowIndex += 1;
|
|
5363
5618
|
const index = rowIndex;
|
|
5364
|
-
return /* @__PURE__ */
|
|
5619
|
+
return /* @__PURE__ */ jsxs12(
|
|
5365
5620
|
"div",
|
|
5366
5621
|
{
|
|
5367
5622
|
id: `${listId}-${index}`,
|
|
@@ -5371,9 +5626,9 @@ function CommandPalette({
|
|
|
5371
5626
|
onClick: () => choose(item),
|
|
5372
5627
|
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" : ""}`,
|
|
5373
5628
|
children: [
|
|
5374
|
-
/* @__PURE__ */
|
|
5375
|
-
item.description && /* @__PURE__ */
|
|
5376
|
-
item.hint && /* @__PURE__ */
|
|
5629
|
+
/* @__PURE__ */ jsx14("span", { className: "truncate text-foreground", children: item.label }),
|
|
5630
|
+
item.description && /* @__PURE__ */ jsx14("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
5631
|
+
item.hint && /* @__PURE__ */ jsx14("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
5377
5632
|
]
|
|
5378
5633
|
},
|
|
5379
5634
|
item.id
|
|
@@ -5381,15 +5636,15 @@ function CommandPalette({
|
|
|
5381
5636
|
})
|
|
5382
5637
|
] }, section.group))
|
|
5383
5638
|
] }),
|
|
5384
|
-
/* @__PURE__ */
|
|
5385
|
-
/* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5387
|
-
/* @__PURE__ */
|
|
5388
|
-
/* @__PURE__ */
|
|
5389
|
-
/* @__PURE__ */
|
|
5390
|
-
/* @__PURE__ */
|
|
5391
|
-
/* @__PURE__ */
|
|
5392
|
-
/* @__PURE__ */
|
|
5639
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
5640
|
+
/* @__PURE__ */ jsx14("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
5641
|
+
/* @__PURE__ */ jsxs12("span", { className: "flex items-center gap-1.5", children: [
|
|
5642
|
+
/* @__PURE__ */ jsx14("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
5643
|
+
/* @__PURE__ */ jsx14("span", { children: "navigate" }),
|
|
5644
|
+
/* @__PURE__ */ jsx14("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
5645
|
+
/* @__PURE__ */ jsx14("span", { children: "select" }),
|
|
5646
|
+
/* @__PURE__ */ jsx14("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
5647
|
+
/* @__PURE__ */ jsx14("span", { children: "close" })
|
|
5393
5648
|
] })
|
|
5394
5649
|
] })
|
|
5395
5650
|
]
|
|
@@ -5401,7 +5656,7 @@ function CommandPalette({
|
|
|
5401
5656
|
}
|
|
5402
5657
|
|
|
5403
5658
|
// src/web-react/sparkline.tsx
|
|
5404
|
-
import { jsx as
|
|
5659
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5405
5660
|
var DEFAULT_SPARKLINE_WIDTH = 96;
|
|
5406
5661
|
var DEFAULT_SPARKLINE_HEIGHT = 24;
|
|
5407
5662
|
var DEFAULT_INSET = 2.5;
|
|
@@ -5507,21 +5762,21 @@ function Sparkline({
|
|
|
5507
5762
|
const geometry = sparklineGeometry(values, { width, height });
|
|
5508
5763
|
const accessibleName = sparklineLabel(values, { label, format });
|
|
5509
5764
|
if (geometry.points.length === 0) {
|
|
5510
|
-
return /* @__PURE__ */
|
|
5765
|
+
return /* @__PURE__ */ jsxs13(
|
|
5511
5766
|
"span",
|
|
5512
5767
|
{
|
|
5513
5768
|
"data-sparkline": geometry.gaps > 0 ? "unavailable" : "empty",
|
|
5514
5769
|
className: joinClasses("text-[11px] text-muted-foreground", className),
|
|
5515
5770
|
children: [
|
|
5516
|
-
/* @__PURE__ */
|
|
5517
|
-
/* @__PURE__ */
|
|
5771
|
+
/* @__PURE__ */ jsx15("span", { className: "sr-only", children: accessibleName }),
|
|
5772
|
+
/* @__PURE__ */ jsx15("span", { "aria-hidden": "true", children: geometry.gaps > 0 ? unavailableLabel : emptyLabel })
|
|
5518
5773
|
]
|
|
5519
5774
|
}
|
|
5520
5775
|
);
|
|
5521
5776
|
}
|
|
5522
5777
|
const drawsLine = geometry.segments.some((segment) => segment.length > 1);
|
|
5523
5778
|
const end = geometry.points[geometry.points.length - 1];
|
|
5524
|
-
return /* @__PURE__ */
|
|
5779
|
+
return /* @__PURE__ */ jsxs13(
|
|
5525
5780
|
"svg",
|
|
5526
5781
|
{
|
|
5527
5782
|
role: "img",
|
|
@@ -5538,7 +5793,7 @@ function Sparkline({
|
|
|
5538
5793
|
geometry.segments.map((segment, index) => {
|
|
5539
5794
|
const key = `segment-${index}`;
|
|
5540
5795
|
if (segment.length > 1) {
|
|
5541
|
-
return /* @__PURE__ */
|
|
5796
|
+
return /* @__PURE__ */ jsx15(
|
|
5542
5797
|
"polyline",
|
|
5543
5798
|
{
|
|
5544
5799
|
points: sparklinePointsAttribute(segment),
|
|
@@ -5554,9 +5809,9 @@ function Sparkline({
|
|
|
5554
5809
|
}
|
|
5555
5810
|
const only = segment[0];
|
|
5556
5811
|
if (only.x === end.x && only.y === end.y) return null;
|
|
5557
|
-
return /* @__PURE__ */
|
|
5812
|
+
return /* @__PURE__ */ jsx15("circle", { cx: only.x, cy: only.y, r: DOT_RADIUS, fill: "currentColor" }, key);
|
|
5558
5813
|
}),
|
|
5559
|
-
/* @__PURE__ */
|
|
5814
|
+
/* @__PURE__ */ jsx15("circle", { cx: end.x, cy: end.y, r: DOT_RADIUS, fill: "currentColor" })
|
|
5560
5815
|
]
|
|
5561
5816
|
}
|
|
5562
5817
|
);
|
|
@@ -5567,10 +5822,10 @@ import {
|
|
|
5567
5822
|
isValidElement as isValidElement2,
|
|
5568
5823
|
useCallback as useCallback9,
|
|
5569
5824
|
useEffect as useEffect11,
|
|
5570
|
-
useRef as
|
|
5571
|
-
useState as
|
|
5825
|
+
useRef as useRef11,
|
|
5826
|
+
useState as useState16
|
|
5572
5827
|
} from "react";
|
|
5573
|
-
import { Fragment as
|
|
5828
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5574
5829
|
function insightDelta(value, previous) {
|
|
5575
5830
|
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
5576
5831
|
if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
|
|
@@ -5623,7 +5878,7 @@ function InsightCard({
|
|
|
5623
5878
|
const tone = delta ? insightDeltaTone(delta.direction, polarity) : "neutral";
|
|
5624
5879
|
const unavailable = typeof value === "number" && !Number.isFinite(value);
|
|
5625
5880
|
const shown = typeof value === "number" ? format(value) : value;
|
|
5626
|
-
return /* @__PURE__ */
|
|
5881
|
+
return /* @__PURE__ */ jsxs14(
|
|
5627
5882
|
"article",
|
|
5628
5883
|
{
|
|
5629
5884
|
"data-insight-card": "",
|
|
@@ -5631,40 +5886,40 @@ function InsightCard({
|
|
|
5631
5886
|
className: joinClasses("agent-arrive flex h-full flex-col rounded-xl border border-card-edge bg-card p-4", className),
|
|
5632
5887
|
style,
|
|
5633
5888
|
children: [
|
|
5634
|
-
eyebrow ? /* @__PURE__ */
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5889
|
+
eyebrow ? /* @__PURE__ */ jsx16("p", { "data-insight-eyebrow": "", className: "mb-0.5 text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: eyebrow }) : null,
|
|
5890
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
5891
|
+
/* @__PURE__ */ jsx16("h3", { className: "text-[13px] font-medium text-muted-foreground", children: title }),
|
|
5637
5892
|
live ? (
|
|
5638
5893
|
// No `data-motion` opt-out: the word is the signal and the sweep is
|
|
5639
5894
|
// emphasis, so the reduced-motion floor reaches this like everything
|
|
5640
5895
|
// else and leaves a static, legible label.
|
|
5641
|
-
/* @__PURE__ */
|
|
5896
|
+
/* @__PURE__ */ jsx16("span", { className: "agent-shimmer shrink-0 text-[11px] font-medium", "data-insight-live": "", children: liveLabel })
|
|
5642
5897
|
) : null
|
|
5643
5898
|
] }),
|
|
5644
|
-
/* @__PURE__ */
|
|
5645
|
-
/* @__PURE__ */
|
|
5646
|
-
/* @__PURE__ */
|
|
5647
|
-
] }) : /* @__PURE__ */
|
|
5648
|
-
/* @__PURE__ */
|
|
5649
|
-
unit ? /* @__PURE__ */
|
|
5899
|
+
/* @__PURE__ */ jsx16("p", { className: "mt-1 flex items-baseline gap-1", children: unavailable ? /* @__PURE__ */ jsxs14("span", { "data-insight-value": "unavailable", className: "text-xl font-semibold text-muted-foreground", children: [
|
|
5900
|
+
/* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
|
|
5901
|
+
/* @__PURE__ */ jsx16("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
|
|
5902
|
+
] }) : /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
5903
|
+
/* @__PURE__ */ jsx16("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
|
|
5904
|
+
unit ? /* @__PURE__ */ jsx16("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
|
|
5650
5905
|
] }) }),
|
|
5651
|
-
delta ? /* @__PURE__ */
|
|
5652
|
-
/* @__PURE__ */
|
|
5906
|
+
delta ? /* @__PURE__ */ jsxs14("p", { "data-insight-delta": delta.direction, className: `mt-0.5 text-[11px] font-medium ${TONE_CLASS[tone]}`, children: [
|
|
5907
|
+
/* @__PURE__ */ jsxs14("span", { "aria-hidden": "true", children: [
|
|
5653
5908
|
DIRECTION_GLYPH[delta.direction],
|
|
5654
5909
|
" "
|
|
5655
5910
|
] }),
|
|
5656
5911
|
formatInsightDelta(delta, format)
|
|
5657
5912
|
] }) : null,
|
|
5658
|
-
description ? /* @__PURE__ */
|
|
5659
|
-
series ? /* @__PURE__ */
|
|
5660
|
-
action ? /* @__PURE__ */
|
|
5913
|
+
description ? /* @__PURE__ */ jsx16("p", { className: "mt-1 text-[11px] text-muted-foreground", children: description }) : null,
|
|
5914
|
+
series ? /* @__PURE__ */ jsx16("div", { className: "mt-2 text-muted-foreground", children: /* @__PURE__ */ jsx16(Sparkline, { values: series, label: seriesLabel ?? title, format }) }) : null,
|
|
5915
|
+
action ? /* @__PURE__ */ jsx16("div", { className: "mt-3", children: renderInsightAction(action) }) : null
|
|
5661
5916
|
]
|
|
5662
5917
|
}
|
|
5663
5918
|
);
|
|
5664
5919
|
}
|
|
5665
5920
|
function renderInsightAction(action) {
|
|
5666
5921
|
if (isValidElement2(action)) return action;
|
|
5667
|
-
return /* @__PURE__ */
|
|
5922
|
+
return /* @__PURE__ */ jsx16(
|
|
5668
5923
|
"button",
|
|
5669
5924
|
{
|
|
5670
5925
|
type: "button",
|
|
@@ -5733,14 +5988,14 @@ function InsightDeck({
|
|
|
5733
5988
|
className,
|
|
5734
5989
|
onPageChange
|
|
5735
5990
|
}) {
|
|
5736
|
-
const [page, setPage] =
|
|
5737
|
-
const [held, setHeld] =
|
|
5991
|
+
const [page, setPage] = useState16(0);
|
|
5992
|
+
const [held, setHeld] = useState16(null);
|
|
5738
5993
|
const answered = state.status === "error" || state.status === "empty";
|
|
5739
5994
|
const carried = state.status === "ready" ? state.value : answered ? null : held;
|
|
5740
5995
|
if (carried !== held) setHeld(carried);
|
|
5741
5996
|
const shown = carried !== null && state.status !== "ready" ? { status: "ready", value: carried, retry: state.retry } : state;
|
|
5742
5997
|
const refreshing = shown !== state;
|
|
5743
|
-
const reported =
|
|
5998
|
+
const reported = useRef11(0);
|
|
5744
5999
|
const settlePage = useCallback9(
|
|
5745
6000
|
(next) => {
|
|
5746
6001
|
if (reported.current === next) return;
|
|
@@ -5749,7 +6004,7 @@ function InsightDeck({
|
|
|
5749
6004
|
},
|
|
5750
6005
|
[onPageChange]
|
|
5751
6006
|
);
|
|
5752
|
-
return /* @__PURE__ */
|
|
6007
|
+
return /* @__PURE__ */ jsx16(
|
|
5753
6008
|
AsyncView,
|
|
5754
6009
|
{
|
|
5755
6010
|
state: shown,
|
|
@@ -5757,7 +6012,7 @@ function InsightDeck({
|
|
|
5757
6012
|
loadingLabel,
|
|
5758
6013
|
retryLabel,
|
|
5759
6014
|
className,
|
|
5760
|
-
children: (insights) => /* @__PURE__ */
|
|
6015
|
+
children: (insights) => /* @__PURE__ */ jsx16(
|
|
5761
6016
|
InsightPages,
|
|
5762
6017
|
{
|
|
5763
6018
|
insights,
|
|
@@ -5824,9 +6079,9 @@ function InsightPages({
|
|
|
5824
6079
|
const pageCount = insightPageCount(insights.length, size);
|
|
5825
6080
|
const current = Math.min(Math.max(page, 0), pageCount - 1);
|
|
5826
6081
|
const visible = insightPageSlice(insights, current, size);
|
|
5827
|
-
const sectionRef =
|
|
5828
|
-
const listRef =
|
|
5829
|
-
const recoverFocus =
|
|
6082
|
+
const sectionRef = useRef11(null);
|
|
6083
|
+
const listRef = useRef11(null);
|
|
6084
|
+
const recoverFocus = useRef11(false);
|
|
5830
6085
|
useEffect11(() => {
|
|
5831
6086
|
onPageSettled(current);
|
|
5832
6087
|
}, [current, onPageSettled]);
|
|
@@ -5870,7 +6125,7 @@ function InsightPages({
|
|
|
5870
6125
|
}
|
|
5871
6126
|
if (moved) event.preventDefault();
|
|
5872
6127
|
};
|
|
5873
|
-
return /* @__PURE__ */
|
|
6128
|
+
return /* @__PURE__ */ jsxs14(
|
|
5874
6129
|
"section",
|
|
5875
6130
|
{
|
|
5876
6131
|
ref: sectionRef,
|
|
@@ -5882,7 +6137,7 @@ function InsightPages({
|
|
|
5882
6137
|
tabIndex: pageCount > 1 ? 0 : void 0,
|
|
5883
6138
|
"aria-keyshortcuts": pageCount > 1 ? "ArrowLeft ArrowRight PageUp PageDown Home End" : void 0,
|
|
5884
6139
|
children: [
|
|
5885
|
-
/* @__PURE__ */
|
|
6140
|
+
/* @__PURE__ */ jsx16("ul", { ref: listRef, className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: visible.map(({ id, style, ...card }, index) => (
|
|
5886
6141
|
// The page index is in the key on purpose: a page turn is an arrival,
|
|
5887
6142
|
// and reusing the node would swap the text under a card that never
|
|
5888
6143
|
// moved. Remounting replays `.agent-arrive` with the new stagger.
|
|
@@ -5893,10 +6148,10 @@ function InsightPages({
|
|
|
5893
6148
|
// does not arrive a second time. The key does BOTH jobs — but only
|
|
5894
6149
|
// because the deck now keeps this subtree mounted across a reload
|
|
5895
6150
|
// (see `InsightDeck`); a key is never compared across a teardown.
|
|
5896
|
-
/* @__PURE__ */
|
|
6151
|
+
/* @__PURE__ */ jsx16("li", { children: /* @__PURE__ */ jsx16(InsightCard, { ...card, style: staggerStyle(index, style) }) }, `${current}:${id}`)
|
|
5897
6152
|
)) }),
|
|
5898
|
-
/* @__PURE__ */
|
|
5899
|
-
/* @__PURE__ */
|
|
6153
|
+
/* @__PURE__ */ jsxs14("div", { className: pageCount > 1 ? "flex items-center justify-between gap-2" : void 0, children: [
|
|
6154
|
+
/* @__PURE__ */ jsxs14(
|
|
5900
6155
|
"p",
|
|
5901
6156
|
{
|
|
5902
6157
|
role: "status",
|
|
@@ -5910,8 +6165,8 @@ function InsightPages({
|
|
|
5910
6165
|
]
|
|
5911
6166
|
}
|
|
5912
6167
|
),
|
|
5913
|
-
pageCount > 1 ? /* @__PURE__ */
|
|
5914
|
-
/* @__PURE__ */
|
|
6168
|
+
pageCount > 1 ? /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
|
|
6169
|
+
/* @__PURE__ */ jsx16(PagerButton, { label: "Previous insights", glyph: "\u2039", atEnd: current === 0, onClick: () => goTo(current - 1) }),
|
|
5915
6170
|
pageCount <= MAX_PAGE_DOTS ? Array.from({ length: pageCount }, (_, index) => (
|
|
5916
6171
|
// WCAG 2.2 SC 2.5.8 wants a 24x24 CSS px target. The dot stays
|
|
5917
6172
|
// 8px because a 24px dot is a different control; the BUTTON
|
|
@@ -5919,7 +6174,7 @@ function InsightPages({
|
|
|
5919
6174
|
// and the span is the graphic. The Spacing exception cannot
|
|
5920
6175
|
// rescue the bare dot — at a 12px pitch the 24px circle around
|
|
5921
6176
|
// each centre overlaps its neighbour's.
|
|
5922
|
-
/* @__PURE__ */
|
|
6177
|
+
/* @__PURE__ */ jsx16(
|
|
5923
6178
|
"button",
|
|
5924
6179
|
{
|
|
5925
6180
|
type: "button",
|
|
@@ -5927,7 +6182,7 @@ function InsightPages({
|
|
|
5927
6182
|
"aria-current": index === current ? "page" : void 0,
|
|
5928
6183
|
onClick: () => goTo(index),
|
|
5929
6184
|
className: "group flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
5930
|
-
children: /* @__PURE__ */
|
|
6185
|
+
children: /* @__PURE__ */ jsx16(
|
|
5931
6186
|
"span",
|
|
5932
6187
|
{
|
|
5933
6188
|
"aria-hidden": "true",
|
|
@@ -5941,7 +6196,7 @@ function InsightPages({
|
|
|
5941
6196
|
index
|
|
5942
6197
|
)
|
|
5943
6198
|
)) : null,
|
|
5944
|
-
/* @__PURE__ */
|
|
6199
|
+
/* @__PURE__ */ jsx16(
|
|
5945
6200
|
PagerButton,
|
|
5946
6201
|
{
|
|
5947
6202
|
label: "Next insights",
|
|
@@ -5962,7 +6217,7 @@ function PagerButton({
|
|
|
5962
6217
|
atEnd,
|
|
5963
6218
|
onClick
|
|
5964
6219
|
}) {
|
|
5965
|
-
return /* @__PURE__ */
|
|
6220
|
+
return /* @__PURE__ */ jsx16(
|
|
5966
6221
|
"button",
|
|
5967
6222
|
{
|
|
5968
6223
|
type: "button",
|
|
@@ -5972,14 +6227,14 @@ function PagerButton({
|
|
|
5972
6227
|
if (!atEnd) onClick();
|
|
5973
6228
|
},
|
|
5974
6229
|
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"}`,
|
|
5975
|
-
children: /* @__PURE__ */
|
|
6230
|
+
children: /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", children: glyph })
|
|
5976
6231
|
}
|
|
5977
6232
|
);
|
|
5978
6233
|
}
|
|
5979
6234
|
|
|
5980
6235
|
// src/web-react/api-access-panel.tsx
|
|
5981
|
-
import { useEffect as useEffect12, useRef as
|
|
5982
|
-
import { jsx as
|
|
6236
|
+
import { useEffect as useEffect12, useRef as useRef12, useState as useState17 } from "react";
|
|
6237
|
+
import { jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5983
6238
|
var defaultExpiryChoices = [1, 7, 30];
|
|
5984
6239
|
var inputClass = "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm text-foreground";
|
|
5985
6240
|
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";
|
|
@@ -6031,20 +6286,20 @@ function ApiAccessPanel({
|
|
|
6031
6286
|
onRevoke,
|
|
6032
6287
|
onChanged
|
|
6033
6288
|
}) {
|
|
6034
|
-
const [name, setName] =
|
|
6289
|
+
const [name, setName] = useState17("");
|
|
6035
6290
|
const allowedDays = [...new Set(expiryDays)].filter((days2) => days2 > 0 && Number.isFinite(new Date(Date.now() + days2 * 864e5).getTime()));
|
|
6036
6291
|
const fallbackDays = allowedDays.includes(defaultExpiryDays) ? defaultExpiryDays : allowedDays[0];
|
|
6037
|
-
const [days, setDays] =
|
|
6292
|
+
const [days, setDays] = useState17(fallbackDays);
|
|
6038
6293
|
const selectedDays = days !== void 0 && allowedDays.includes(days) ? days : fallbackDays;
|
|
6039
|
-
const [scopes, setScopes] =
|
|
6040
|
-
const [creating, setCreating] =
|
|
6041
|
-
const [revoking, setRevoking] =
|
|
6042
|
-
const [created, setCreated] =
|
|
6043
|
-
const [notice, setNotice] =
|
|
6044
|
-
const [error, setError] =
|
|
6045
|
-
const keyHeading =
|
|
6046
|
-
const nameInput =
|
|
6047
|
-
const keyWasShown =
|
|
6294
|
+
const [scopes, setScopes] = useState17(() => expandScopes(defaultScopes, access));
|
|
6295
|
+
const [creating, setCreating] = useState17(false);
|
|
6296
|
+
const [revoking, setRevoking] = useState17(null);
|
|
6297
|
+
const [created, setCreated] = useState17(null);
|
|
6298
|
+
const [notice, setNotice] = useState17(null);
|
|
6299
|
+
const [error, setError] = useState17(null);
|
|
6300
|
+
const keyHeading = useRef12(null);
|
|
6301
|
+
const nameInput = useRef12(null);
|
|
6302
|
+
const keyWasShown = useRef12(false);
|
|
6048
6303
|
const selectedScopes = pruneScopes(scopes, access);
|
|
6049
6304
|
useEffect12(() => {
|
|
6050
6305
|
setScopes((current) => {
|
|
@@ -6097,20 +6352,20 @@ function ApiAccessPanel({
|
|
|
6097
6352
|
setRevoking(null);
|
|
6098
6353
|
}
|
|
6099
6354
|
}
|
|
6100
|
-
return /* @__PURE__ */
|
|
6101
|
-
/* @__PURE__ */
|
|
6102
|
-
accountHref && /* @__PURE__ */
|
|
6103
|
-
/* @__PURE__ */
|
|
6104
|
-
/* @__PURE__ */
|
|
6355
|
+
return /* @__PURE__ */ jsx17("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs15("div", { className: "mx-auto max-w-2xl space-y-8 px-4 py-8 sm:px-8", children: [
|
|
6356
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
6357
|
+
accountHref && /* @__PURE__ */ jsx17("a", { href: accountHref, className: "text-sm text-muted-foreground hover:text-foreground", children: "Account" }),
|
|
6358
|
+
/* @__PURE__ */ jsx17("h1", { className: "text-2xl font-semibold text-foreground", children: "API access" }),
|
|
6359
|
+
/* @__PURE__ */ jsx17("p", { className: "text-sm text-muted-foreground", children: description ?? "Connect a client to your account. Each key acts with your permissions and only the access you choose." })
|
|
6105
6360
|
] }),
|
|
6106
|
-
error && /* @__PURE__ */
|
|
6107
|
-
notice && /* @__PURE__ */
|
|
6108
|
-
created ? /* @__PURE__ */
|
|
6109
|
-
/* @__PURE__ */
|
|
6110
|
-
/* @__PURE__ */
|
|
6111
|
-
/* @__PURE__ */
|
|
6112
|
-
/* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6361
|
+
error && /* @__PURE__ */ jsx17("p", { role: "alert", className: "rounded-lg border border-destructive/40 p-3 text-sm text-destructive", children: error }),
|
|
6362
|
+
notice && /* @__PURE__ */ jsx17("p", { role: "status", className: "text-sm text-muted-foreground", children: notice }),
|
|
6363
|
+
created ? /* @__PURE__ */ jsxs15("section", { "aria-labelledby": "save-api-key", className: "space-y-4 rounded-xl border border-border bg-card p-5", children: [
|
|
6364
|
+
/* @__PURE__ */ jsx17("h2", { ref: keyHeading, tabIndex: -1, id: "save-api-key", className: "font-medium outline-none", children: "Save your key" }),
|
|
6365
|
+
/* @__PURE__ */ jsx17("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." }),
|
|
6366
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-2", children: [
|
|
6367
|
+
/* @__PURE__ */ jsx17("input", { "aria-label": "New API key", type: "password", value: created.key, readOnly: true, autoComplete: "off", className: `${inputClass} min-w-0 font-mono` }),
|
|
6368
|
+
/* @__PURE__ */ jsx17("button", { className: buttonClass, onClick: async () => {
|
|
6114
6369
|
try {
|
|
6115
6370
|
await navigator.clipboard.writeText(created.key);
|
|
6116
6371
|
setNotice("Key copied");
|
|
@@ -6119,32 +6374,32 @@ function ApiAccessPanel({
|
|
|
6119
6374
|
}
|
|
6120
6375
|
}, children: "Copy key" })
|
|
6121
6376
|
] }),
|
|
6122
|
-
/* @__PURE__ */
|
|
6377
|
+
/* @__PURE__ */ jsx17("button", { className: outlineClass, onClick: () => {
|
|
6123
6378
|
setCreated(null);
|
|
6124
6379
|
setNotice(null);
|
|
6125
6380
|
}, children: "I\u2019ve saved it" })
|
|
6126
|
-
] }) : /* @__PURE__ */
|
|
6127
|
-
/* @__PURE__ */
|
|
6128
|
-
/* @__PURE__ */
|
|
6129
|
-
/* @__PURE__ */
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
/* @__PURE__ */
|
|
6381
|
+
] }) : /* @__PURE__ */ jsxs15("form", { onSubmit: createKey, className: "space-y-5 rounded-xl border border-border bg-card p-5", children: [
|
|
6382
|
+
/* @__PURE__ */ jsx17("h2", { className: "font-medium", children: "Create a key" }),
|
|
6383
|
+
/* @__PURE__ */ jsxs15("div", { className: "grid gap-4 sm:grid-cols-[1fr_10rem]", children: [
|
|
6384
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-1.5", children: [
|
|
6385
|
+
/* @__PURE__ */ jsx17("label", { className: "text-sm font-medium", htmlFor: "key-name", children: "Name" }),
|
|
6386
|
+
/* @__PURE__ */ jsx17("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" })
|
|
6132
6387
|
] }),
|
|
6133
|
-
/* @__PURE__ */
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
6388
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-1.5", children: [
|
|
6389
|
+
/* @__PURE__ */ jsx17("label", { className: "text-sm font-medium", htmlFor: "key-expiry", children: "Expires in" }),
|
|
6390
|
+
/* @__PURE__ */ jsx17("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__ */ jsxs15("option", { value: days2, children: [
|
|
6136
6391
|
days2,
|
|
6137
6392
|
" ",
|
|
6138
6393
|
days2 === 1 ? "day" : "days"
|
|
6139
6394
|
] }, days2)) })
|
|
6140
6395
|
] })
|
|
6141
6396
|
] }),
|
|
6142
|
-
/* @__PURE__ */
|
|
6143
|
-
/* @__PURE__ */
|
|
6397
|
+
/* @__PURE__ */ jsxs15("fieldset", { className: "space-y-3", children: [
|
|
6398
|
+
/* @__PURE__ */ jsx17("legend", { className: "mb-3 text-sm font-medium", children: "Permissions" }),
|
|
6144
6399
|
access.map((option) => {
|
|
6145
6400
|
const unavailable = !expandScopes([option.scope], access).includes(option.scope);
|
|
6146
|
-
return /* @__PURE__ */
|
|
6147
|
-
/* @__PURE__ */
|
|
6401
|
+
return /* @__PURE__ */ jsxs15("label", { className: "flex cursor-pointer items-start gap-3", children: [
|
|
6402
|
+
/* @__PURE__ */ jsx17(
|
|
6148
6403
|
"input",
|
|
6149
6404
|
{
|
|
6150
6405
|
type: "checkbox",
|
|
@@ -6154,38 +6409,38 @@ function ApiAccessPanel({
|
|
|
6154
6409
|
onChange: (event) => setScopes((current) => event.target.checked ? expandScopes([...current, option.scope], access) : pruneScopes(current.filter((scope) => scope !== option.scope), access))
|
|
6155
6410
|
}
|
|
6156
6411
|
),
|
|
6157
|
-
/* @__PURE__ */
|
|
6158
|
-
/* @__PURE__ */
|
|
6159
|
-
/* @__PURE__ */
|
|
6160
|
-
unavailable && /* @__PURE__ */
|
|
6412
|
+
/* @__PURE__ */ jsxs15("span", { className: "text-sm", children: [
|
|
6413
|
+
/* @__PURE__ */ jsx17("span", { className: "block font-medium", children: option.label }),
|
|
6414
|
+
/* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: option.description }),
|
|
6415
|
+
unavailable && /* @__PURE__ */ jsx17("span", { className: "block text-muted-foreground", children: "Required permission unavailable." })
|
|
6161
6416
|
] })
|
|
6162
6417
|
] }, option.scope);
|
|
6163
6418
|
})
|
|
6164
6419
|
] }),
|
|
6165
|
-
limitsDescription && /* @__PURE__ */
|
|
6166
|
-
/* @__PURE__ */
|
|
6420
|
+
limitsDescription && /* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: limitsDescription }),
|
|
6421
|
+
/* @__PURE__ */ jsx17("button", { className: buttonClass, type: "submit", disabled: creating || !name.trim() || !selectedScopes.length || selectedDays === void 0, children: creating ? "Creating\u2026" : "Create key" })
|
|
6167
6422
|
] }),
|
|
6168
|
-
/* @__PURE__ */
|
|
6169
|
-
/* @__PURE__ */
|
|
6170
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
6171
|
-
/* @__PURE__ */
|
|
6172
|
-
/* @__PURE__ */
|
|
6173
|
-
/* @__PURE__ */
|
|
6174
|
-
/* @__PURE__ */
|
|
6423
|
+
/* @__PURE__ */ jsxs15("section", { "aria-labelledby": "existing-keys", className: "space-y-3", children: [
|
|
6424
|
+
/* @__PURE__ */ jsx17("h2", { id: "existing-keys", className: "font-medium", children: "Your keys" }),
|
|
6425
|
+
keys.length === 0 ? /* @__PURE__ */ jsx17("p", { className: "text-sm text-muted-foreground", children: "No keys yet." }) : /* @__PURE__ */ jsx17("ul", { className: "divide-y divide-border rounded-xl border border-border bg-card", children: keys.map((key) => /* @__PURE__ */ jsxs15("li", { className: "flex items-start justify-between gap-3 p-4", children: [
|
|
6426
|
+
/* @__PURE__ */ jsxs15("div", { className: "min-w-0 space-y-1", children: [
|
|
6427
|
+
/* @__PURE__ */ jsx17("p", { className: "break-words text-sm font-medium", children: key.name }),
|
|
6428
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: key.expiresAt ? `${new Date(key.expiresAt).getTime() <= Date.now() ? "Expired" : "Expires"} ${new Date(key.expiresAt).toLocaleDateString()}` : "No expiry" }),
|
|
6429
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs text-muted-foreground", children: key.scopes.map((scope) => access.find((access2) => access2.scope === scope)?.label ?? scope).join(" \xB7 ") })
|
|
6175
6430
|
] }),
|
|
6176
|
-
/* @__PURE__ */
|
|
6431
|
+
/* @__PURE__ */ jsx17("button", { className: outlineClass, disabled: revoking !== null, onClick: () => revokeKey(key.id), "aria-label": `Revoke ${key.name}`, children: revoking === key.id ? "Revoking\u2026" : "Revoke" })
|
|
6177
6432
|
] }, key.id)) })
|
|
6178
6433
|
] }),
|
|
6179
|
-
/* @__PURE__ */
|
|
6434
|
+
/* @__PURE__ */ jsxs15("p", { className: "text-sm text-muted-foreground", children: [
|
|
6180
6435
|
"Use ",
|
|
6181
|
-
/* @__PURE__ */
|
|
6436
|
+
/* @__PURE__ */ jsx17("code", { className: "text-xs", children: baseUrl }),
|
|
6182
6437
|
" as the API base and send the key as a Bearer credential."
|
|
6183
6438
|
] })
|
|
6184
6439
|
] }) });
|
|
6185
6440
|
}
|
|
6186
6441
|
|
|
6187
6442
|
// src/web-react/index.tsx
|
|
6188
|
-
import { Fragment as
|
|
6443
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6189
6444
|
function formatModelCost(msg, models) {
|
|
6190
6445
|
if (msg.promptTokens == null && msg.completionTokens == null) return null;
|
|
6191
6446
|
const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
|
|
@@ -6204,41 +6459,41 @@ function formatTokensPerSecond(msg) {
|
|
|
6204
6459
|
return `${Math.round(msg.completionTokens / (msg.durationMs / 1e3))} tok/s`;
|
|
6205
6460
|
}
|
|
6206
6461
|
function RunDrillIn({ run, onClose }) {
|
|
6207
|
-
return /* @__PURE__ */
|
|
6208
|
-
/* @__PURE__ */
|
|
6209
|
-
/* @__PURE__ */
|
|
6462
|
+
return /* @__PURE__ */ jsxs16("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: [
|
|
6463
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
6464
|
+
/* @__PURE__ */ jsx18(
|
|
6210
6465
|
"span",
|
|
6211
6466
|
{
|
|
6212
6467
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
6213
6468
|
}
|
|
6214
6469
|
),
|
|
6215
|
-
/* @__PURE__ */
|
|
6216
|
-
/* @__PURE__ */
|
|
6217
|
-
/* @__PURE__ */
|
|
6470
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1", children: [
|
|
6471
|
+
/* @__PURE__ */ jsx18("p", { className: "truncate text-[15px] font-semibold", children: run.title }),
|
|
6472
|
+
/* @__PURE__ */ jsx18("p", { className: "truncate font-mono text-xs text-muted-foreground", children: run.toolName })
|
|
6218
6473
|
] }),
|
|
6219
|
-
/* @__PURE__ */
|
|
6474
|
+
/* @__PURE__ */ jsx18(
|
|
6220
6475
|
"button",
|
|
6221
6476
|
{
|
|
6222
6477
|
type: "button",
|
|
6223
6478
|
onClick: onClose,
|
|
6224
6479
|
"aria-label": "Close",
|
|
6225
6480
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
6226
|
-
children: /* @__PURE__ */
|
|
6481
|
+
children: /* @__PURE__ */ jsx18("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx18("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
6227
6482
|
}
|
|
6228
6483
|
)
|
|
6229
6484
|
] }),
|
|
6230
|
-
/* @__PURE__ */
|
|
6231
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
6232
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
6233
|
-
/* @__PURE__ */
|
|
6234
|
-
/* @__PURE__ */
|
|
6235
|
-
/* @__PURE__ */
|
|
6236
|
-
/* @__PURE__ */
|
|
6485
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
6486
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx18("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
6487
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs16("div", { className: "rounded-lg border border-card-edge bg-card", children: [
|
|
6488
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5", children: [
|
|
6489
|
+
/* @__PURE__ */ jsx18("span", { className: `font-mono text-xs ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
6490
|
+
/* @__PURE__ */ jsx18("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
6491
|
+
/* @__PURE__ */ jsx18("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: new Date(step.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) })
|
|
6237
6492
|
] }),
|
|
6238
|
-
step.detail && /* @__PURE__ */
|
|
6493
|
+
step.detail && /* @__PURE__ */ jsx18("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 })
|
|
6239
6494
|
] }, i))
|
|
6240
6495
|
] }),
|
|
6241
|
-
/* @__PURE__ */
|
|
6496
|
+
/* @__PURE__ */ jsx18("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." })
|
|
6242
6497
|
] });
|
|
6243
6498
|
}
|
|
6244
6499
|
function pendingApprovalOf(call) {
|
|
@@ -6254,23 +6509,23 @@ function ChatEmptyState({
|
|
|
6254
6509
|
}) {
|
|
6255
6510
|
const doorCount = Math.min(doors?.length ?? 0, 3);
|
|
6256
6511
|
const doorsGridClass = doorCount === 1 ? "mx-auto max-w-sm sm:grid-cols-1" : doorCount === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3";
|
|
6257
|
-
return /* @__PURE__ */
|
|
6258
|
-
/* @__PURE__ */
|
|
6259
|
-
/* @__PURE__ */
|
|
6260
|
-
/* @__PURE__ */
|
|
6261
|
-
subline && /* @__PURE__ */
|
|
6262
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
6512
|
+
return /* @__PURE__ */ jsxs16("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
6513
|
+
/* @__PURE__ */ jsx18("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__ */ jsx18(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
6514
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: productName }),
|
|
6515
|
+
/* @__PURE__ */ jsx18("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground", children: headline }),
|
|
6516
|
+
subline && /* @__PURE__ */ jsx18("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
6517
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx18("div", { className: `mt-7 grid w-full gap-2.5 ${doorsGridClass}`, children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs16(
|
|
6263
6518
|
"button",
|
|
6264
6519
|
{
|
|
6265
6520
|
type: "button",
|
|
6266
6521
|
onClick: door.onSelect,
|
|
6267
6522
|
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",
|
|
6268
6523
|
children: [
|
|
6269
|
-
/* @__PURE__ */
|
|
6524
|
+
/* @__PURE__ */ jsxs16("span", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
6270
6525
|
door.icon,
|
|
6271
6526
|
door.label
|
|
6272
6527
|
] }),
|
|
6273
|
-
door.description && /* @__PURE__ */
|
|
6528
|
+
door.description && /* @__PURE__ */ jsx18("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
6274
6529
|
]
|
|
6275
6530
|
},
|
|
6276
6531
|
i
|
|
@@ -6279,26 +6534,26 @@ function ChatEmptyState({
|
|
|
6279
6534
|
}
|
|
6280
6535
|
function ToolGlyph({ name, className }) {
|
|
6281
6536
|
if (name.startsWith("sandbox_")) {
|
|
6282
|
-
return /* @__PURE__ */
|
|
6283
|
-
/* @__PURE__ */
|
|
6284
|
-
/* @__PURE__ */
|
|
6537
|
+
return /* @__PURE__ */ jsxs16("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6538
|
+
/* @__PURE__ */ jsx18("polyline", { points: "4 17 10 11 4 5" }),
|
|
6539
|
+
/* @__PURE__ */ jsx18("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
6285
6540
|
] });
|
|
6286
6541
|
}
|
|
6287
6542
|
if (name === "submit_proposal") {
|
|
6288
|
-
return /* @__PURE__ */
|
|
6289
|
-
/* @__PURE__ */
|
|
6290
|
-
/* @__PURE__ */
|
|
6543
|
+
return /* @__PURE__ */ jsxs16("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6544
|
+
/* @__PURE__ */ jsx18("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
6545
|
+
/* @__PURE__ */ jsx18("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
6291
6546
|
] });
|
|
6292
6547
|
}
|
|
6293
6548
|
if (name === "schedule_followup") {
|
|
6294
|
-
return /* @__PURE__ */
|
|
6295
|
-
/* @__PURE__ */
|
|
6296
|
-
/* @__PURE__ */
|
|
6549
|
+
return /* @__PURE__ */ jsxs16("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
6550
|
+
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "9" }),
|
|
6551
|
+
/* @__PURE__ */ jsx18("path", { d: "M12 7v5l3 3" })
|
|
6297
6552
|
] });
|
|
6298
6553
|
}
|
|
6299
|
-
return /* @__PURE__ */
|
|
6300
|
-
/* @__PURE__ */
|
|
6301
|
-
/* @__PURE__ */
|
|
6554
|
+
return /* @__PURE__ */ jsxs16("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
6555
|
+
/* @__PURE__ */ jsx18("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
6556
|
+
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "4" })
|
|
6302
6557
|
] });
|
|
6303
6558
|
}
|
|
6304
6559
|
function toolOutcomeOf(call) {
|
|
@@ -6384,40 +6639,40 @@ function truncate(v, max = 240) {
|
|
|
6384
6639
|
function KvRows({ data }) {
|
|
6385
6640
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
6386
6641
|
if (!entries.length) return null;
|
|
6387
|
-
return /* @__PURE__ */
|
|
6388
|
-
/* @__PURE__ */
|
|
6389
|
-
/* @__PURE__ */
|
|
6642
|
+
return /* @__PURE__ */ jsx18("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs16("div", { className: "contents", children: [
|
|
6643
|
+
/* @__PURE__ */ jsx18("dt", { className: "font-mono text-xs text-muted-foreground", children: k }),
|
|
6644
|
+
/* @__PURE__ */ jsx18("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", children: truncate(v) })
|
|
6390
6645
|
] }, k)) });
|
|
6391
6646
|
}
|
|
6392
6647
|
function ShellDetail({ call }) {
|
|
6393
6648
|
const outcome = toolOutcomeOf(call);
|
|
6394
6649
|
const r = outcome?.result ?? {};
|
|
6395
|
-
return /* @__PURE__ */
|
|
6396
|
-
/* @__PURE__ */
|
|
6397
|
-
/* @__PURE__ */
|
|
6398
|
-
/* @__PURE__ */
|
|
6399
|
-
r.exitCode != null && /* @__PURE__ */
|
|
6650
|
+
return /* @__PURE__ */ jsxs16("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-xs leading-relaxed", children: [
|
|
6651
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
|
|
6652
|
+
/* @__PURE__ */ jsx18("span", { className: "select-none text-zinc-500", children: "$" }),
|
|
6653
|
+
/* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
|
|
6654
|
+
r.exitCode != null && /* @__PURE__ */ jsxs16("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
|
|
6400
6655
|
"exit ",
|
|
6401
6656
|
r.exitCode
|
|
6402
6657
|
] })
|
|
6403
6658
|
] }),
|
|
6404
|
-
/* @__PURE__ */
|
|
6659
|
+
/* @__PURE__ */ jsx18("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)" })
|
|
6405
6660
|
] });
|
|
6406
6661
|
}
|
|
6407
6662
|
function DefaultToolDetail({ call }) {
|
|
6408
6663
|
const result = call.result;
|
|
6409
6664
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
6410
|
-
return /* @__PURE__ */
|
|
6411
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
6412
|
-
/* @__PURE__ */
|
|
6413
|
-
/* @__PURE__ */
|
|
6665
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
6666
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs16("div", { children: [
|
|
6667
|
+
/* @__PURE__ */ jsx18("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
6668
|
+
/* @__PURE__ */ jsx18(KvRows, { data: call.args })
|
|
6414
6669
|
] }),
|
|
6415
|
-
envelope ? /* @__PURE__ */
|
|
6416
|
-
/* @__PURE__ */
|
|
6417
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
6418
|
-
] }) : result != null ? /* @__PURE__ */
|
|
6419
|
-
/* @__PURE__ */
|
|
6420
|
-
/* @__PURE__ */
|
|
6670
|
+
envelope ? /* @__PURE__ */ jsxs16("div", { children: [
|
|
6671
|
+
/* @__PURE__ */ jsx18("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
6672
|
+
envelope.ok === false ? /* @__PURE__ */ jsx18("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx18(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx18("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
6673
|
+
] }) : result != null ? /* @__PURE__ */ jsxs16("div", { children: [
|
|
6674
|
+
/* @__PURE__ */ jsx18("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
6675
|
+
/* @__PURE__ */ jsx18("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(result) })
|
|
6421
6676
|
] }) : null
|
|
6422
6677
|
] });
|
|
6423
6678
|
}
|
|
@@ -6428,24 +6683,24 @@ function ProposalCard({
|
|
|
6428
6683
|
approval,
|
|
6429
6684
|
renderers
|
|
6430
6685
|
}) {
|
|
6431
|
-
const [expanded, setExpanded] =
|
|
6686
|
+
const [expanded, setExpanded] = useState18(false);
|
|
6432
6687
|
const { summary, meta, typeSlug } = proposalPreview(call);
|
|
6433
6688
|
const custom = renderers?.[call.name]?.(call, message);
|
|
6434
6689
|
const { pending: deciding, run: decide } = usePending();
|
|
6435
|
-
return /* @__PURE__ */
|
|
6436
|
-
/* @__PURE__ */
|
|
6437
|
-
/* @__PURE__ */
|
|
6438
|
-
/* @__PURE__ */
|
|
6439
|
-
/* @__PURE__ */
|
|
6440
|
-
/* @__PURE__ */
|
|
6441
|
-
summary && /* @__PURE__ */
|
|
6442
|
-
typeSlug && /* @__PURE__ */
|
|
6443
|
-
meta.length > 0 && /* @__PURE__ */
|
|
6690
|
+
return /* @__PURE__ */ jsxs16("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: [
|
|
6691
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
6692
|
+
/* @__PURE__ */ jsx18("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__ */ jsx18(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
6693
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1", children: [
|
|
6694
|
+
/* @__PURE__ */ jsx18("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-warning-strong", children: approval ? "Needs your approval" : "Awaiting approval" }),
|
|
6695
|
+
/* @__PURE__ */ jsx18("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
6696
|
+
summary && /* @__PURE__ */ jsx18("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
6697
|
+
typeSlug && /* @__PURE__ */ jsx18("p", { className: "mt-1 font-mono text-xs text-muted-foreground", children: typeSlug }),
|
|
6698
|
+
meta.length > 0 && /* @__PURE__ */ jsx18("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx18("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-muted-foreground", children: m }, i)) })
|
|
6444
6699
|
] })
|
|
6445
6700
|
] }),
|
|
6446
|
-
/* @__PURE__ */
|
|
6447
|
-
approval && /* @__PURE__ */
|
|
6448
|
-
/* @__PURE__ */
|
|
6701
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
6702
|
+
approval && /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
6703
|
+
/* @__PURE__ */ jsx18(
|
|
6449
6704
|
"button",
|
|
6450
6705
|
{
|
|
6451
6706
|
type: "button",
|
|
@@ -6455,7 +6710,7 @@ function ProposalCard({
|
|
|
6455
6710
|
children: "Approve & run"
|
|
6456
6711
|
}
|
|
6457
6712
|
),
|
|
6458
|
-
/* @__PURE__ */
|
|
6713
|
+
/* @__PURE__ */ jsx18(
|
|
6459
6714
|
"button",
|
|
6460
6715
|
{
|
|
6461
6716
|
type: "button",
|
|
@@ -6466,7 +6721,7 @@ function ProposalCard({
|
|
|
6466
6721
|
}
|
|
6467
6722
|
)
|
|
6468
6723
|
] }),
|
|
6469
|
-
/* @__PURE__ */
|
|
6724
|
+
/* @__PURE__ */ jsxs16(
|
|
6470
6725
|
"button",
|
|
6471
6726
|
{
|
|
6472
6727
|
type: "button",
|
|
@@ -6475,12 +6730,12 @@ function ProposalCard({
|
|
|
6475
6730
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
6476
6731
|
children: [
|
|
6477
6732
|
expanded ? "Hide details" : "View details",
|
|
6478
|
-
/* @__PURE__ */
|
|
6733
|
+
/* @__PURE__ */ jsx18(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
6479
6734
|
]
|
|
6480
6735
|
}
|
|
6481
6736
|
)
|
|
6482
6737
|
] }),
|
|
6483
|
-
expanded && /* @__PURE__ */
|
|
6738
|
+
expanded && /* @__PURE__ */ jsx18("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx18(DefaultToolDetail, { call }) })
|
|
6484
6739
|
] });
|
|
6485
6740
|
}
|
|
6486
6741
|
function formatFollowupWhen(when) {
|
|
@@ -6495,14 +6750,14 @@ function FollowupCard({ call }) {
|
|
|
6495
6750
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
6496
6751
|
const failed = toolCallFailed(call);
|
|
6497
6752
|
const errorText = failed ? toolOutcomeOf(call)?.message ?? "Scheduling failed" : null;
|
|
6498
|
-
return /* @__PURE__ */
|
|
6499
|
-
/* @__PURE__ */
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
when && /* @__PURE__ */
|
|
6503
|
-
/* @__PURE__ */
|
|
6753
|
+
return /* @__PURE__ */ jsx18("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1 overflow-hidden rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--md3-surface-container)]", children: [
|
|
6754
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex w-full items-center gap-2.5 px-3 py-2", children: [
|
|
6755
|
+
/* @__PURE__ */ jsx18("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__ */ jsx18(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
6756
|
+
/* @__PURE__ */ jsx18("span", { className: "shrink-0 whitespace-nowrap text-xs font-medium text-foreground", children: friendlyToolTitle(call) }),
|
|
6757
|
+
when && /* @__PURE__ */ jsx18("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) }),
|
|
6758
|
+
/* @__PURE__ */ jsx18("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: call.status === "running" ? /* @__PURE__ */ jsx18("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__ */ jsx18("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }) : /* @__PURE__ */ jsx18("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${failed ? "bg-[var(--surface-danger-text)]" : "bg-[var(--surface-success-text)]"}` }) })
|
|
6504
6759
|
] }),
|
|
6505
|
-
errorText && /* @__PURE__ */
|
|
6760
|
+
errorText && /* @__PURE__ */ jsx18("div", { className: "border-t border-border px-3 py-2 text-xs text-[var(--surface-danger-text)]", children: errorText })
|
|
6506
6761
|
] }) });
|
|
6507
6762
|
}
|
|
6508
6763
|
function toolRowTitle(call) {
|
|
@@ -6525,10 +6780,10 @@ function ToolCallCard({
|
|
|
6525
6780
|
const arrival = useArrivalStyle(staggerIndex ?? 0);
|
|
6526
6781
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
6527
6782
|
const kind = blockKindOf(call);
|
|
6528
|
-
const arrive = (row) => /* @__PURE__ */
|
|
6783
|
+
const arrive = (row) => /* @__PURE__ */ jsx18("div", { className: "agent-arrive", style: arrival, children: row });
|
|
6529
6784
|
if (pending) {
|
|
6530
6785
|
return arrive(
|
|
6531
|
-
/* @__PURE__ */
|
|
6786
|
+
/* @__PURE__ */ jsx18(
|
|
6532
6787
|
ProposalCard,
|
|
6533
6788
|
{
|
|
6534
6789
|
call,
|
|
@@ -6541,18 +6796,18 @@ function ToolCallCard({
|
|
|
6541
6796
|
);
|
|
6542
6797
|
}
|
|
6543
6798
|
if (kind === "followup") {
|
|
6544
|
-
return arrive(/* @__PURE__ */
|
|
6799
|
+
return arrive(/* @__PURE__ */ jsx18(FollowupCard, { call }));
|
|
6545
6800
|
}
|
|
6546
6801
|
const custom = renderers?.[call.name]?.(call, message);
|
|
6547
6802
|
return arrive(
|
|
6548
|
-
/* @__PURE__ */
|
|
6803
|
+
/* @__PURE__ */ jsx18(
|
|
6549
6804
|
InlineToolItem,
|
|
6550
6805
|
{
|
|
6551
6806
|
part: chatToolCallPart(call),
|
|
6552
6807
|
title: toolRowTitle(call),
|
|
6553
6808
|
description: toolRowDescription(call),
|
|
6554
|
-
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
6555
|
-
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */
|
|
6809
|
+
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx18(ShellDetail, { call }) : /* @__PURE__ */ jsx18(DefaultToolDetail, { call })),
|
|
6810
|
+
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */ jsx18(
|
|
6556
6811
|
"button",
|
|
6557
6812
|
{
|
|
6558
6813
|
type: "button",
|
|
@@ -6560,9 +6815,9 @@ function ToolCallCard({
|
|
|
6560
6815
|
"aria-label": "Open full transcript",
|
|
6561
6816
|
title: "Open full transcript",
|
|
6562
6817
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
6563
|
-
children: /* @__PURE__ */
|
|
6564
|
-
/* @__PURE__ */
|
|
6565
|
-
/* @__PURE__ */
|
|
6818
|
+
children: /* @__PURE__ */ jsxs16("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: [
|
|
6819
|
+
/* @__PURE__ */ jsx18("path", { d: "M7 17 17 7" }),
|
|
6820
|
+
/* @__PURE__ */ jsx18("path", { d: "M7 7h10v10" })
|
|
6566
6821
|
] })
|
|
6567
6822
|
}
|
|
6568
6823
|
) : void 0
|
|
@@ -6571,7 +6826,7 @@ function ToolCallCard({
|
|
|
6571
6826
|
);
|
|
6572
6827
|
}
|
|
6573
6828
|
function StreamingCaret() {
|
|
6574
|
-
return /* @__PURE__ */
|
|
6829
|
+
return /* @__PURE__ */ jsx18(
|
|
6575
6830
|
"span",
|
|
6576
6831
|
{
|
|
6577
6832
|
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",
|
|
@@ -6596,9 +6851,9 @@ function SegmentText({
|
|
|
6596
6851
|
// the container on top of that makes the paragraph shimmer while it types.
|
|
6597
6852
|
// The distinction is what separates "the answer materialised" from "the
|
|
6598
6853
|
// log was appended to".
|
|
6599
|
-
/* @__PURE__ */
|
|
6854
|
+
/* @__PURE__ */ jsxs16("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
6600
6855
|
body,
|
|
6601
|
-
showCaret && /* @__PURE__ */
|
|
6856
|
+
showCaret && /* @__PURE__ */ jsx18(StreamingCaret, {})
|
|
6602
6857
|
] })
|
|
6603
6858
|
);
|
|
6604
6859
|
}
|
|
@@ -6623,7 +6878,7 @@ function SegmentedBody({
|
|
|
6623
6878
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
6624
6879
|
(tc) => !segmentToolIds.has(tc.id)
|
|
6625
6880
|
);
|
|
6626
|
-
const renderToolCard = (call, index) => /* @__PURE__ */
|
|
6881
|
+
const renderToolCard = (call, index) => /* @__PURE__ */ jsx18(
|
|
6627
6882
|
ToolCallCard,
|
|
6628
6883
|
{
|
|
6629
6884
|
call,
|
|
@@ -6651,7 +6906,7 @@ function SegmentedBody({
|
|
|
6651
6906
|
for (const g of groups) {
|
|
6652
6907
|
if (g.kind === "text") {
|
|
6653
6908
|
children.push(
|
|
6654
|
-
/* @__PURE__ */
|
|
6909
|
+
/* @__PURE__ */ jsx18(
|
|
6655
6910
|
SegmentText,
|
|
6656
6911
|
{
|
|
6657
6912
|
content: g.content,
|
|
@@ -6667,13 +6922,13 @@ function SegmentedBody({
|
|
|
6667
6922
|
}
|
|
6668
6923
|
if (!streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool)) {
|
|
6669
6924
|
children.push(
|
|
6670
|
-
/* @__PURE__ */
|
|
6671
|
-
/* @__PURE__ */
|
|
6925
|
+
/* @__PURE__ */ jsxs16("details", { children: [
|
|
6926
|
+
/* @__PURE__ */ jsxs16("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: [
|
|
6672
6927
|
"Worked through ",
|
|
6673
6928
|
g.calls.length,
|
|
6674
6929
|
" steps"
|
|
6675
6930
|
] }),
|
|
6676
|
-
/* @__PURE__ */
|
|
6931
|
+
/* @__PURE__ */ jsx18("div", { className: "mt-1.5 flex flex-col gap-1.5", children: g.calls.map(renderToolCard) })
|
|
6677
6932
|
] }, `tools-fold-${g.index}`)
|
|
6678
6933
|
);
|
|
6679
6934
|
continue;
|
|
@@ -6682,9 +6937,9 @@ function SegmentedBody({
|
|
|
6682
6937
|
}
|
|
6683
6938
|
leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
|
|
6684
6939
|
if (streaming && segments[lastIndex]?.kind === "tool") {
|
|
6685
|
-
children.push(/* @__PURE__ */
|
|
6940
|
+
children.push(/* @__PURE__ */ jsx18(StreamingCaret, {}, "streaming-caret"));
|
|
6686
6941
|
}
|
|
6687
|
-
return /* @__PURE__ */
|
|
6942
|
+
return /* @__PURE__ */ jsx18("div", { className: "flex flex-col gap-2", children });
|
|
6688
6943
|
}
|
|
6689
6944
|
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";
|
|
6690
6945
|
function copyTextOf(msg) {
|
|
@@ -6693,8 +6948,8 @@ function copyTextOf(msg) {
|
|
|
6693
6948
|
return msg.content;
|
|
6694
6949
|
}
|
|
6695
6950
|
function CopyMessageButton({ text }) {
|
|
6696
|
-
const [copied, setCopied] =
|
|
6697
|
-
const timerRef =
|
|
6951
|
+
const [copied, setCopied] = useState18(false);
|
|
6952
|
+
const timerRef = useRef13(null);
|
|
6698
6953
|
useEffect13(
|
|
6699
6954
|
() => () => {
|
|
6700
6955
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
@@ -6714,7 +6969,7 @@ function CopyMessageButton({ text }) {
|
|
|
6714
6969
|
}
|
|
6715
6970
|
);
|
|
6716
6971
|
};
|
|
6717
|
-
return /* @__PURE__ */
|
|
6972
|
+
return /* @__PURE__ */ jsx18(
|
|
6718
6973
|
"button",
|
|
6719
6974
|
{
|
|
6720
6975
|
type: "button",
|
|
@@ -6722,9 +6977,9 @@ function CopyMessageButton({ text }) {
|
|
|
6722
6977
|
"aria-label": "Copy message",
|
|
6723
6978
|
title: "Copy message",
|
|
6724
6979
|
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",
|
|
6725
|
-
children: copied ? /* @__PURE__ */
|
|
6726
|
-
/* @__PURE__ */
|
|
6727
|
-
/* @__PURE__ */
|
|
6980
|
+
children: copied ? /* @__PURE__ */ jsx18("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__ */ jsx18("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs16("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: [
|
|
6981
|
+
/* @__PURE__ */ jsx18("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
6982
|
+
/* @__PURE__ */ jsx18("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
6728
6983
|
] })
|
|
6729
6984
|
}
|
|
6730
6985
|
);
|
|
@@ -6750,9 +7005,9 @@ function AssistantMessageImpl({
|
|
|
6750
7005
|
const body = useMemo7(() => renderBody(content), [renderBody, content]);
|
|
6751
7006
|
const segments = msg.segments;
|
|
6752
7007
|
const hasAnswerText = content !== "" || (segments?.some((s) => s.kind === "text" && s.content.trim() !== "") ?? false);
|
|
6753
|
-
const reasoningScrollRef =
|
|
6754
|
-
const thinkStartRef =
|
|
6755
|
-
const thinkMsRef =
|
|
7008
|
+
const reasoningScrollRef = useRef13(null);
|
|
7009
|
+
const thinkStartRef = useRef13(null);
|
|
7010
|
+
const thinkMsRef = useRef13(null);
|
|
6756
7011
|
if (streaming && reasoning && !hasAnswerText && thinkStartRef.current === null) {
|
|
6757
7012
|
thinkStartRef.current = performance.now();
|
|
6758
7013
|
}
|
|
@@ -6766,15 +7021,15 @@ function AssistantMessageImpl({
|
|
|
6766
7021
|
const thinkingSeconds = useThinkingSeconds(
|
|
6767
7022
|
streaming && !!reasoning && !hasAnswerText
|
|
6768
7023
|
);
|
|
6769
|
-
const [reasoningToggled, setReasoningToggled] =
|
|
7024
|
+
const [reasoningToggled, setReasoningToggled] = useState18(null);
|
|
6770
7025
|
const reasoningOpen = reasoningToggled ?? !hasAnswerText;
|
|
6771
7026
|
const quiet = chrome === "quiet";
|
|
6772
|
-
return /* @__PURE__ */
|
|
6773
|
-
!quiet && /* @__PURE__ */
|
|
6774
|
-
/* @__PURE__ */
|
|
6775
|
-
msg.modelUsed && /* @__PURE__ */
|
|
6776
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
6777
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
7027
|
+
return /* @__PURE__ */ jsxs16("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7028
|
+
!quiet && /* @__PURE__ */ jsxs16("div", { className: "mb-1 flex items-baseline gap-2 text-xs tabular-nums text-muted-foreground", children: [
|
|
7029
|
+
/* @__PURE__ */ jsx18("span", { className: "font-semibold uppercase tracking-[0.05em]", children: agentLabel }),
|
|
7030
|
+
msg.modelUsed && /* @__PURE__ */ jsx18("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
7031
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx18("span", { children: formatTokensPerSecond(msg) }),
|
|
7032
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx18("span", { children: formatModelCost(msg, models) })
|
|
6778
7033
|
] }),
|
|
6779
7034
|
reasoning && // The canonical run-row grammar (RunRowShell — the same shell the tool
|
|
6780
7035
|
// rows compose): one family of rows instead of a bespoke disclosure per
|
|
@@ -6784,12 +7039,12 @@ function AssistantMessageImpl({
|
|
|
6784
7039
|
// and a click outranks the default from then on — the contract the old
|
|
6785
7040
|
// hand-rolled disclosure had, now enforced through the shell's
|
|
6786
7041
|
// controlled `open`.
|
|
6787
|
-
/* @__PURE__ */
|
|
7042
|
+
/* @__PURE__ */ jsx18(
|
|
6788
7043
|
RunRowShell,
|
|
6789
7044
|
{
|
|
6790
7045
|
className: "mb-2",
|
|
6791
|
-
icon: /* @__PURE__ */
|
|
6792
|
-
title: !hasAnswerText ? /* @__PURE__ */
|
|
7046
|
+
icon: /* @__PURE__ */ jsx18(BrainGlyph, { className: "h-3.5 w-3.5" }),
|
|
7047
|
+
title: !hasAnswerText ? /* @__PURE__ */ jsxs16("span", { className: "agent-shimmer", "data-motion": "essential", children: [
|
|
6793
7048
|
"Thinking",
|
|
6794
7049
|
thinkingSeconds >= 1 ? ` \xB7 ${thinkingSeconds}s` : "\u2026"
|
|
6795
7050
|
] }) : thinkMsRef.current != null ? (
|
|
@@ -6804,7 +7059,7 @@ function AssistantMessageImpl({
|
|
|
6804
7059
|
status: hasAnswerText ? "idle" : "running",
|
|
6805
7060
|
open: reasoningOpen,
|
|
6806
7061
|
onOpenChange: (next) => setReasoningToggled(next),
|
|
6807
|
-
children: /* @__PURE__ */
|
|
7062
|
+
children: /* @__PURE__ */ jsx18(
|
|
6808
7063
|
"div",
|
|
6809
7064
|
{
|
|
6810
7065
|
ref: reasoningScrollRef,
|
|
@@ -6814,7 +7069,7 @@ function AssistantMessageImpl({
|
|
|
6814
7069
|
)
|
|
6815
7070
|
}
|
|
6816
7071
|
),
|
|
6817
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
7072
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx18(
|
|
6818
7073
|
SegmentedBody,
|
|
6819
7074
|
{
|
|
6820
7075
|
segments,
|
|
@@ -6826,12 +7081,12 @@ function AssistantMessageImpl({
|
|
|
6826
7081
|
toolRenderers,
|
|
6827
7082
|
messageClassName
|
|
6828
7083
|
}
|
|
6829
|
-
) : /* @__PURE__ */
|
|
6830
|
-
/* @__PURE__ */
|
|
7084
|
+
) : /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
7085
|
+
/* @__PURE__ */ jsxs16("div", { className: messageClassName, children: [
|
|
6831
7086
|
body,
|
|
6832
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
7087
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx18(StreamingCaret, {})
|
|
6833
7088
|
] }),
|
|
6834
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
7089
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx18("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx18(
|
|
6835
7090
|
ToolCallCard,
|
|
6836
7091
|
{
|
|
6837
7092
|
call: tc,
|
|
@@ -6844,7 +7099,7 @@ function AssistantMessageImpl({
|
|
|
6844
7099
|
tc.id
|
|
6845
7100
|
)) })
|
|
6846
7101
|
] }),
|
|
6847
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
7102
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx18(
|
|
6848
7103
|
DurableChatCards,
|
|
6849
7104
|
{
|
|
6850
7105
|
...durableCards,
|
|
@@ -6853,7 +7108,7 @@ function AssistantMessageImpl({
|
|
|
6853
7108
|
className: "mt-3"
|
|
6854
7109
|
}
|
|
6855
7110
|
),
|
|
6856
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
7111
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx18(
|
|
6857
7112
|
WorkProductCard,
|
|
6858
7113
|
{
|
|
6859
7114
|
part,
|
|
@@ -6863,7 +7118,7 @@ function AssistantMessageImpl({
|
|
|
6863
7118
|
`${part.ref.id}:${part.ref.version}`
|
|
6864
7119
|
)),
|
|
6865
7120
|
renderExtras?.(msg),
|
|
6866
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
7121
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx18("div", { className: "mt-2", children: /* @__PURE__ */ jsx18(
|
|
6867
7122
|
MessageAttachments,
|
|
6868
7123
|
{
|
|
6869
7124
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -6871,17 +7126,17 @@ function AssistantMessageImpl({
|
|
|
6871
7126
|
justify: "start"
|
|
6872
7127
|
}
|
|
6873
7128
|
) }),
|
|
6874
|
-
quiet && /* @__PURE__ */
|
|
6875
|
-
/* @__PURE__ */
|
|
6876
|
-
msg.modelUsed && /* @__PURE__ */
|
|
6877
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
6878
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
7129
|
+
quiet && /* @__PURE__ */ jsxs16("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
7130
|
+
/* @__PURE__ */ jsx18(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
7131
|
+
msg.modelUsed && /* @__PURE__ */ jsx18("span", { className: "font-mono", children: msg.modelUsed }),
|
|
7132
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx18("span", { children: formatTokensPerSecond(msg) }),
|
|
7133
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx18("span", { children: formatModelCost(msg, models) })
|
|
6879
7134
|
] })
|
|
6880
7135
|
] });
|
|
6881
7136
|
}
|
|
6882
7137
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
6883
7138
|
function useThinkingSeconds(active) {
|
|
6884
|
-
const [seconds, setSeconds] =
|
|
7139
|
+
const [seconds, setSeconds] = useState18(0);
|
|
6885
7140
|
useEffect13(() => {
|
|
6886
7141
|
if (!active) return;
|
|
6887
7142
|
setSeconds(0);
|
|
@@ -6892,23 +7147,23 @@ function useThinkingSeconds(active) {
|
|
|
6892
7147
|
}
|
|
6893
7148
|
function ThinkingRow({ agentLabel, chrome = "labeled" }) {
|
|
6894
7149
|
const seconds = useThinkingSeconds(true);
|
|
6895
|
-
return /* @__PURE__ */
|
|
6896
|
-
chrome !== "quiet" && /* @__PURE__ */
|
|
6897
|
-
/* @__PURE__ */
|
|
6898
|
-
/* @__PURE__ */
|
|
7150
|
+
return /* @__PURE__ */ jsxs16("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
7151
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx18("p", { className: "mb-1 text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: agentLabel }),
|
|
7152
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 text-[15px] text-muted-foreground", children: [
|
|
7153
|
+
/* @__PURE__ */ jsx18("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx18("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }),
|
|
6899
7154
|
"Thinking",
|
|
6900
7155
|
seconds >= 3 ? ` \xB7 ${seconds}s` : "..."
|
|
6901
7156
|
] })
|
|
6902
7157
|
] });
|
|
6903
7158
|
}
|
|
6904
7159
|
function StreamErrorRow({ message, onRetry }) {
|
|
6905
|
-
return /* @__PURE__ */
|
|
6906
|
-
/* @__PURE__ */
|
|
6907
|
-
/* @__PURE__ */
|
|
6908
|
-
/* @__PURE__ */
|
|
7160
|
+
return /* @__PURE__ */ jsx18("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs16("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: [
|
|
7161
|
+
/* @__PURE__ */ jsxs16("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: [
|
|
7162
|
+
/* @__PURE__ */ jsx18("circle", { cx: "12", cy: "12", r: "9" }),
|
|
7163
|
+
/* @__PURE__ */ jsx18("path", { d: "M12 8v4m0 4h.01" })
|
|
6909
7164
|
] }),
|
|
6910
|
-
/* @__PURE__ */
|
|
6911
|
-
onRetry && /* @__PURE__ */
|
|
7165
|
+
/* @__PURE__ */ jsx18("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
7166
|
+
onRetry && /* @__PURE__ */ jsx18(
|
|
6912
7167
|
"button",
|
|
6913
7168
|
{
|
|
6914
7169
|
type: "button",
|
|
@@ -6944,32 +7199,32 @@ function ChatMessages({
|
|
|
6944
7199
|
const messageClassName = messageSize === "large" ? "agent-app-message-copy text-[17px] leading-[1.6]" : "agent-app-message-copy text-base leading-[1.6]";
|
|
6945
7200
|
const assistantMessageClassName = `${messageClassName} bg-transparent text-[hsl(var(--foreground))]`;
|
|
6946
7201
|
const renderBody = useMemo7(
|
|
6947
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
7202
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx18("p", { className: "whitespace-pre-wrap", children: content })),
|
|
6948
7203
|
[renderMarkdown]
|
|
6949
7204
|
);
|
|
6950
7205
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
6951
7206
|
const quiet = chrome === "quiet";
|
|
6952
7207
|
if (messages.length === 0 && !loading && !error) {
|
|
6953
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
6954
|
-
return /* @__PURE__ */
|
|
7208
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx18(ChatEmptyState, { ...emptyState });
|
|
7209
|
+
return /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
6955
7210
|
header,
|
|
6956
7211
|
empty
|
|
6957
7212
|
] });
|
|
6958
7213
|
}
|
|
6959
|
-
return /* @__PURE__ */
|
|
7214
|
+
return /* @__PURE__ */ jsxs16(Fragment9, { children: [
|
|
6960
7215
|
header,
|
|
6961
7216
|
messages.map(
|
|
6962
|
-
(msg) => msg.role === "user" ? /* @__PURE__ */
|
|
6963
|
-
/* @__PURE__ */
|
|
6964
|
-
!quiet && /* @__PURE__ */
|
|
6965
|
-
/* @__PURE__ */
|
|
7217
|
+
(msg) => msg.role === "user" ? /* @__PURE__ */ jsxs16("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
7218
|
+
/* @__PURE__ */ jsxs16("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
7219
|
+
!quiet && /* @__PURE__ */ jsx18("p", { className: "mb-1 text-right text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: userLabel }),
|
|
7220
|
+
/* @__PURE__ */ jsx18(
|
|
6966
7221
|
"div",
|
|
6967
7222
|
{
|
|
6968
7223
|
className: `rounded-2xl bg-[hsl(var(--foreground))] px-4 py-2.5 text-[hsl(var(--background))] ${quiet ? "" : "rounded-tr-md "}${messageClassName}`,
|
|
6969
|
-
children: /* @__PURE__ */
|
|
7224
|
+
children: /* @__PURE__ */ jsx18("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
6970
7225
|
}
|
|
6971
7226
|
),
|
|
6972
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
7227
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx18("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx18(
|
|
6973
7228
|
MessageAttachments,
|
|
6974
7229
|
{
|
|
6975
7230
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -6978,8 +7233,8 @@ function ChatMessages({
|
|
|
6978
7233
|
}
|
|
6979
7234
|
) })
|
|
6980
7235
|
] }),
|
|
6981
|
-
quiet && /* @__PURE__ */
|
|
6982
|
-
] }, msg.id) : /* @__PURE__ */
|
|
7236
|
+
quiet && /* @__PURE__ */ jsx18("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx18(CopyMessageButton, { text: msg.content }) })
|
|
7237
|
+
] }, msg.id) : /* @__PURE__ */ jsx18(
|
|
6983
7238
|
AssistantMessage,
|
|
6984
7239
|
{
|
|
6985
7240
|
msg,
|
|
@@ -7000,8 +7255,8 @@ function ChatMessages({
|
|
|
7000
7255
|
msg.id
|
|
7001
7256
|
)
|
|
7002
7257
|
),
|
|
7003
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
7004
|
-
error && !loading && /* @__PURE__ */
|
|
7258
|
+
loading && lastIsUser && /* @__PURE__ */ jsx18(ThinkingRow, { agentLabel, chrome }),
|
|
7259
|
+
error && !loading && /* @__PURE__ */ jsx18(StreamErrorRow, { message: error, onRetry })
|
|
7005
7260
|
] });
|
|
7006
7261
|
}
|
|
7007
7262
|
|
|
@@ -7036,6 +7291,8 @@ export {
|
|
|
7036
7291
|
dispatchChatStreamLine,
|
|
7037
7292
|
consumeChatStream,
|
|
7038
7293
|
streamChatTurn,
|
|
7294
|
+
getChatFundingRecovery,
|
|
7295
|
+
AgentProfileRegistryError,
|
|
7039
7296
|
AgentProfileEditor,
|
|
7040
7297
|
AgentProfileViewer,
|
|
7041
7298
|
DurablePlanClientError,
|
|
@@ -7138,4 +7395,4 @@ export {
|
|
|
7138
7395
|
useThinkingSeconds,
|
|
7139
7396
|
ChatMessages
|
|
7140
7397
|
};
|
|
7141
|
-
//# sourceMappingURL=chunk-
|
|
7398
|
+
//# sourceMappingURL=chunk-2LPNGZFG.js.map
|