@tangle-network/agent-app 0.50.6 → 0.50.7
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-5DEQ2FJK.js → chunk-ZYJCWKZ7.js} +949 -604
- package/dist/chunk-ZYJCWKZ7.js.map +1 -0
- package/dist/web-react/agent-profile-editor.d.ts +9 -0
- package/dist/web-react/index.d.ts +1 -0
- package/dist/web-react/index.js +3 -1
- package/dist/workspace-apps/index.d.ts +10 -4
- package/dist/workspace-apps/index.js +30 -11
- package/dist/workspace-apps/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-5DEQ2FJK.js.map +0 -1
|
@@ -50,7 +50,7 @@ import {
|
|
|
50
50
|
} from "./chunk-M3K2HVQD.js";
|
|
51
51
|
|
|
52
52
|
// src/web-react/index.tsx
|
|
53
|
-
import { useEffect as
|
|
53
|
+
import { useEffect as useEffect13, useMemo as useMemo7, useRef as useRef12, useState as useState17, memo } from "react";
|
|
54
54
|
import { InlineToolItem, RunRowShell } from "@tangle-network/ui/run";
|
|
55
55
|
|
|
56
56
|
// src/web-react/smooth-text.ts
|
|
@@ -1415,8 +1415,352 @@ async function streamChatTurn(opts) {
|
|
|
1415
1415
|
}
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
|
+
// src/web-react/agent-profile-editor.tsx
|
|
1419
|
+
import { useEffect as useEffect5, useId, useState as useState7 } from "react";
|
|
1420
|
+
import { agentProfileSchema } from "@tangle-network/agent-interface/profile-schema";
|
|
1421
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1422
|
+
var input = "min-h-10 w-full rounded-lg border border-input bg-background px-3 py-2 text-sm text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50";
|
|
1423
|
+
var button = "rounded-lg border border-input bg-background px-3 py-2 text-sm font-medium text-foreground hover:bg-accent disabled:opacity-50";
|
|
1424
|
+
var remove = "text-destructive hover:underline disabled:opacity-50";
|
|
1425
|
+
function Field({ label, hint, children }) {
|
|
1426
|
+
return /* @__PURE__ */ jsxs5("label", { className: "block space-y-1.5 text-sm font-medium text-foreground", children: [
|
|
1427
|
+
/* @__PURE__ */ jsx7("span", { children: label }),
|
|
1428
|
+
children,
|
|
1429
|
+
hint && /* @__PURE__ */ jsx7("span", { className: "block text-xs font-normal text-muted-foreground", children: hint })
|
|
1430
|
+
] });
|
|
1431
|
+
}
|
|
1432
|
+
function Section({ title, description, children }) {
|
|
1433
|
+
return /* @__PURE__ */ jsxs5("section", { className: "space-y-4 rounded-xl border border-border bg-card p-4 sm:p-5", children: [
|
|
1434
|
+
/* @__PURE__ */ jsxs5("div", { children: [
|
|
1435
|
+
/* @__PURE__ */ jsx7("h2", { className: "text-base font-semibold text-foreground", children: title }),
|
|
1436
|
+
description && /* @__PURE__ */ jsx7("p", { className: "mt-1 text-sm text-muted-foreground", children: description })
|
|
1437
|
+
] }),
|
|
1438
|
+
children
|
|
1439
|
+
] });
|
|
1440
|
+
}
|
|
1441
|
+
function issueMessage(error) {
|
|
1442
|
+
const issue = error.issues[0];
|
|
1443
|
+
return issue ? (issue.path.map(String).join(".") || "Profile") + ": " + issue.message : "Invalid profile";
|
|
1444
|
+
}
|
|
1445
|
+
function AgentProfileEditor({ value, onChange, disabled = false, className }) {
|
|
1446
|
+
const id = useId();
|
|
1447
|
+
const [error, setError] = useState7(null);
|
|
1448
|
+
const [newTool, setNewTool] = useState7("");
|
|
1449
|
+
const [mcpName, setMcpName] = useState7("");
|
|
1450
|
+
const [mcpKind, setMcpKind] = useState7("http");
|
|
1451
|
+
const [mcpTarget, setMcpTarget] = useState7("");
|
|
1452
|
+
const [resourceDrafts, setResourceDrafts] = useState7({});
|
|
1453
|
+
const [json, setJson] = useState7(() => JSON.stringify(value, null, 2));
|
|
1454
|
+
const [jsonDirty, setJsonDirty] = useState7(false);
|
|
1455
|
+
useEffect5(() => {
|
|
1456
|
+
if (!jsonDirty) setJson(JSON.stringify(value, null, 2));
|
|
1457
|
+
}, [value, jsonDirty]);
|
|
1458
|
+
const editingDisabled = disabled || jsonDirty;
|
|
1459
|
+
function emit(next) {
|
|
1460
|
+
if (jsonDirty) {
|
|
1461
|
+
setError("Apply or discard JSON edits first.");
|
|
1462
|
+
return false;
|
|
1463
|
+
}
|
|
1464
|
+
const result = agentProfileSchema.safeParse(next);
|
|
1465
|
+
if (!result.success) {
|
|
1466
|
+
setError(issueMessage(result.error));
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1469
|
+
setError(null);
|
|
1470
|
+
onChange(result.data);
|
|
1471
|
+
return true;
|
|
1472
|
+
}
|
|
1473
|
+
function prompt(next) {
|
|
1474
|
+
emit({ ...value, prompt: next });
|
|
1475
|
+
}
|
|
1476
|
+
function model(next) {
|
|
1477
|
+
emit({ ...value, model: next });
|
|
1478
|
+
}
|
|
1479
|
+
function resources(key, refs) {
|
|
1480
|
+
return emit({ ...value, resources: { ...value.resources, [key]: refs } });
|
|
1481
|
+
}
|
|
1482
|
+
function addResource(key) {
|
|
1483
|
+
const draft = resourceDrafts[key] ?? { kind: "github", path: "", name: "", content: "" };
|
|
1484
|
+
const ref = draft.kind === "github" ? { kind: "github", path: draft.path.trim(), ...draft.name.trim() ? { name: draft.name.trim() } : {} } : { kind: "inline", name: draft.name.trim(), content: draft.content };
|
|
1485
|
+
if (draft.kind === "github" && !draft.path.trim() || draft.kind === "inline" && !draft.name.trim()) {
|
|
1486
|
+
setError(draft.kind === "github" ? "Enter a resource path." : "Enter a resource name.");
|
|
1487
|
+
return;
|
|
1488
|
+
}
|
|
1489
|
+
if (!resources(key, [...value.resources?.[key] ?? [], ref])) return;
|
|
1490
|
+
setResourceDrafts((current) => ({ ...current, [key]: { ...draft, path: "", name: "", content: "" } }));
|
|
1491
|
+
}
|
|
1492
|
+
function resourceSection(key, title, description) {
|
|
1493
|
+
const refs = value.resources?.[key] ?? [];
|
|
1494
|
+
const draft = resourceDrafts[key] ?? { kind: "github", path: "", name: "", content: "" };
|
|
1495
|
+
function change(field, text) {
|
|
1496
|
+
setResourceDrafts((current) => ({ ...current, [key]: { ...draft, [field]: text } }));
|
|
1497
|
+
}
|
|
1498
|
+
return /* @__PURE__ */ jsxs5(Section, { title, description, children: [
|
|
1499
|
+
refs.length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "None added." }),
|
|
1500
|
+
/* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: refs.map((ref, index) => /* @__PURE__ */ jsxs5("li", { className: "flex items-start justify-between gap-3 rounded-lg border border-border p-3 text-sm", children: [
|
|
1501
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
|
|
1502
|
+
/* @__PURE__ */ jsx7("span", { className: "font-medium", children: ref.name || (ref.kind === "github" ? ref.path : "Inline resource") }),
|
|
1503
|
+
/* @__PURE__ */ jsx7("span", { className: "ml-2 text-xs text-muted-foreground", children: ref.kind === "github" ? "GitHub \xB7 " + ref.path : "Inline" }),
|
|
1504
|
+
ref.kind === "github" && ref.repository && /* @__PURE__ */ jsx7("span", { className: "block text-xs text-muted-foreground", children: ref.repository })
|
|
1505
|
+
] }),
|
|
1506
|
+
/* @__PURE__ */ jsx7(
|
|
1507
|
+
"button",
|
|
1508
|
+
{
|
|
1509
|
+
type: "button",
|
|
1510
|
+
className: remove,
|
|
1511
|
+
disabled: editingDisabled,
|
|
1512
|
+
"aria-label": "Remove " + title.toLowerCase() + " " + (index + 1),
|
|
1513
|
+
onClick: () => resources(key, refs.filter((_, item) => item !== index)),
|
|
1514
|
+
children: "Remove"
|
|
1515
|
+
}
|
|
1516
|
+
)
|
|
1517
|
+
] }, index)) }),
|
|
1518
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid gap-3 rounded-lg border border-dashed border-border p-3 sm:grid-cols-[10rem_1fr]", children: [
|
|
1519
|
+
/* @__PURE__ */ jsx7(Field, { label: "Source", children: /* @__PURE__ */ jsxs5(
|
|
1520
|
+
"select",
|
|
1521
|
+
{
|
|
1522
|
+
className: input,
|
|
1523
|
+
disabled: editingDisabled,
|
|
1524
|
+
value: draft.kind,
|
|
1525
|
+
onChange: (event) => change("kind", event.target.value),
|
|
1526
|
+
children: [
|
|
1527
|
+
/* @__PURE__ */ jsx7("option", { value: "github", children: "GitHub path" }),
|
|
1528
|
+
/* @__PURE__ */ jsx7("option", { value: "inline", children: "Inline content" })
|
|
1529
|
+
]
|
|
1530
|
+
}
|
|
1531
|
+
) }),
|
|
1532
|
+
/* @__PURE__ */ jsx7(Field, { label: draft.kind === "github" ? "Path" : "Name", children: /* @__PURE__ */ jsx7(
|
|
1533
|
+
"input",
|
|
1534
|
+
{
|
|
1535
|
+
className: input,
|
|
1536
|
+
disabled: editingDisabled,
|
|
1537
|
+
value: draft.kind === "github" ? draft.path : draft.name,
|
|
1538
|
+
onChange: (event) => change(draft.kind === "github" ? "path" : "name", event.target.value),
|
|
1539
|
+
placeholder: draft.kind === "github" ? "skills/research/SKILL.md" : "Research skill"
|
|
1540
|
+
}
|
|
1541
|
+
) }),
|
|
1542
|
+
draft.kind === "inline" && /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: "Content", children: /* @__PURE__ */ jsx7(
|
|
1543
|
+
"textarea",
|
|
1544
|
+
{
|
|
1545
|
+
className: input + " min-h-28",
|
|
1546
|
+
disabled: editingDisabled,
|
|
1547
|
+
value: draft.content,
|
|
1548
|
+
onChange: (event) => change("content", event.target.value)
|
|
1549
|
+
}
|
|
1550
|
+
) }) }),
|
|
1551
|
+
/* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsxs5("button", { type: "button", className: button, disabled: editingDisabled, onClick: () => addResource(key), children: [
|
|
1552
|
+
"Add ",
|
|
1553
|
+
key === "skills" ? "skill" : "tool file"
|
|
1554
|
+
] }) })
|
|
1555
|
+
] }),
|
|
1556
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Repository, ref, and other options are available in Advanced JSON." })
|
|
1557
|
+
] });
|
|
1558
|
+
}
|
|
1559
|
+
function addMcp() {
|
|
1560
|
+
const name = mcpName.trim();
|
|
1561
|
+
const target = mcpTarget.trim();
|
|
1562
|
+
if (!name || !target) {
|
|
1563
|
+
setError("Enter a server name and URL or command.");
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
if (name in (value.mcp ?? {})) {
|
|
1567
|
+
setError("A server with that name already exists.");
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1570
|
+
const server = mcpKind === "stdio" ? { command: target } : { transport: mcpKind, url: target };
|
|
1571
|
+
if (emit({ ...value, mcp: { ...value.mcp, [name]: server } })) {
|
|
1572
|
+
setMcpName("");
|
|
1573
|
+
setMcpTarget("");
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
function applyJson() {
|
|
1577
|
+
try {
|
|
1578
|
+
const result = agentProfileSchema.safeParse(JSON.parse(json));
|
|
1579
|
+
if (!result.success) {
|
|
1580
|
+
setError(issueMessage(result.error));
|
|
1581
|
+
return;
|
|
1582
|
+
}
|
|
1583
|
+
setError(null);
|
|
1584
|
+
setJsonDirty(false);
|
|
1585
|
+
onChange(result.data);
|
|
1586
|
+
} catch (cause) {
|
|
1587
|
+
setError(cause instanceof Error ? cause.message : "Invalid JSON");
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
return /* @__PURE__ */ jsxs5("div", { className: "space-y-5 " + (className ?? ""), "aria-label": "Agent profile editor", children: [
|
|
1591
|
+
error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive", children: error }),
|
|
1592
|
+
/* @__PURE__ */ jsxs5(Section, { title: "Profile", description: "Name the agent and set its instructions. Replacing a system prompt changes how its harness behaves.", children: [
|
|
1593
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
1594
|
+
/* @__PURE__ */ jsx7(Field, { label: "Name", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: value.name ?? "", onChange: (event) => emit({ ...value, name: event.target.value }) }) }),
|
|
1595
|
+
/* @__PURE__ */ jsx7(Field, { label: "Description", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: value.description ?? "", onChange: (event) => emit({ ...value, description: event.target.value }) }) })
|
|
1596
|
+
] }),
|
|
1597
|
+
/* @__PURE__ */ jsx7(Field, { label: "Agent instructions", hint: "Project-level instructions. Each entry remains separate.", children: /* @__PURE__ */ jsxs5("div", { className: "space-y-2", children: [
|
|
1598
|
+
(value.prompt?.instructions ?? []).map((instruction, index) => /* @__PURE__ */ jsxs5("div", { className: "flex items-start gap-2", children: [
|
|
1599
|
+
/* @__PURE__ */ jsx7(
|
|
1600
|
+
"textarea",
|
|
1601
|
+
{
|
|
1602
|
+
className: input + " min-h-20",
|
|
1603
|
+
disabled: editingDisabled,
|
|
1604
|
+
value: instruction,
|
|
1605
|
+
onChange: (event) => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).map((item, i) => i === index ? event.target.value : item) })
|
|
1606
|
+
}
|
|
1607
|
+
),
|
|
1608
|
+
/* @__PURE__ */ jsx7(
|
|
1609
|
+
"button",
|
|
1610
|
+
{
|
|
1611
|
+
type: "button",
|
|
1612
|
+
className: remove + " pt-2",
|
|
1613
|
+
disabled: editingDisabled,
|
|
1614
|
+
"aria-label": "Remove instruction " + (index + 1),
|
|
1615
|
+
onClick: () => prompt({ ...value.prompt, instructions: (value.prompt?.instructions ?? []).filter((_, i) => i !== index) }),
|
|
1616
|
+
children: "Remove"
|
|
1617
|
+
}
|
|
1618
|
+
)
|
|
1619
|
+
] }, index)),
|
|
1620
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: editingDisabled, onClick: () => prompt({ ...value.prompt, instructions: [...value.prompt?.instructions ?? [], ""] }), children: "Add instruction" })
|
|
1621
|
+
] }) }),
|
|
1622
|
+
/* @__PURE__ */ jsx7(Field, { label: "Append to system prompt", hint: "Keeps the harness system prompt and adds this text.", children: /* @__PURE__ */ jsx7("textarea", { className: input + " min-h-24", disabled: editingDisabled, value: value.prompt?.appendSystemPrompt ?? "", onChange: (event) => prompt({ ...value.prompt, appendSystemPrompt: event.target.value }) }) }),
|
|
1623
|
+
/* @__PURE__ */ jsx7(Field, { label: "Replace system prompt", hint: "Only use when the harness supports full replacement.", children: /* @__PURE__ */ jsx7("textarea", { className: input + " min-h-24", disabled: editingDisabled, value: value.prompt?.systemPrompt ?? "", onChange: (event) => prompt({ ...value.prompt, systemPrompt: event.target.value }) }) })
|
|
1624
|
+
] }),
|
|
1625
|
+
/* @__PURE__ */ jsx7(Section, { title: "Model", description: "Set model preferences. The host decides which models can run.", children: /* @__PURE__ */ jsxs5("div", { className: "grid gap-4 sm:grid-cols-2", children: [
|
|
1626
|
+
/* @__PURE__ */ jsx7(Field, { label: "Default model", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: value.model?.default ?? "", onChange: (event) => model({ ...value.model, default: event.target.value }), placeholder: "provider/model" }) }),
|
|
1627
|
+
/* @__PURE__ */ jsx7(Field, { label: "Small model", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: value.model?.small ?? "", onChange: (event) => model({ ...value.model, small: event.target.value }), placeholder: "provider/model" }) }),
|
|
1628
|
+
/* @__PURE__ */ jsx7(Field, { label: "Provider hint", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: value.model?.provider ?? "", onChange: (event) => model({ ...value.model, provider: event.target.value }) }) }),
|
|
1629
|
+
/* @__PURE__ */ jsx7(Field, { label: "Thinking level", children: /* @__PURE__ */ jsxs5(
|
|
1630
|
+
"select",
|
|
1631
|
+
{
|
|
1632
|
+
className: input,
|
|
1633
|
+
disabled: editingDisabled,
|
|
1634
|
+
value: value.model?.reasoningEffort ?? "",
|
|
1635
|
+
onChange: (event) => model({ ...value.model, reasoningEffort: event.target.value ? event.target.value : void 0 }),
|
|
1636
|
+
children: [
|
|
1637
|
+
/* @__PURE__ */ jsx7("option", { value: "", children: "Harness default" }),
|
|
1638
|
+
["none", "minimal", "low", "medium", "high", "xhigh", "ultracode"].map((level) => /* @__PURE__ */ jsx7("option", { value: level, children: level }, level))
|
|
1639
|
+
]
|
|
1640
|
+
}
|
|
1641
|
+
) })
|
|
1642
|
+
] }) }),
|
|
1643
|
+
/* @__PURE__ */ jsxs5(Section, { title: "Tools and permissions", description: "Choose which tools are available and when each needs approval.", children: [
|
|
1644
|
+
Object.keys(value.tools ?? {}).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No tool rules added." }),
|
|
1645
|
+
/* @__PURE__ */ jsx7("div", { className: "space-y-2", children: Object.entries(value.tools ?? {}).map(([name, enabled]) => /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-border p-3 text-sm", children: [
|
|
1646
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex min-w-32 flex-1 items-center gap-2", children: [
|
|
1647
|
+
/* @__PURE__ */ jsx7(
|
|
1648
|
+
"input",
|
|
1649
|
+
{
|
|
1650
|
+
type: "checkbox",
|
|
1651
|
+
disabled: editingDisabled,
|
|
1652
|
+
checked: enabled,
|
|
1653
|
+
onChange: (event) => emit({ ...value, tools: { ...value.tools, [name]: event.target.checked } })
|
|
1654
|
+
}
|
|
1655
|
+
),
|
|
1656
|
+
name
|
|
1657
|
+
] }),
|
|
1658
|
+
/* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-muted-foreground", children: [
|
|
1659
|
+
"Permission",
|
|
1660
|
+
/* @__PURE__ */ jsxs5(
|
|
1661
|
+
"select",
|
|
1662
|
+
{
|
|
1663
|
+
className: "rounded-md border border-input bg-background px-2 py-1 text-foreground",
|
|
1664
|
+
disabled: editingDisabled,
|
|
1665
|
+
value: typeof value.permissions?.[name] === "string" ? value.permissions[name] : "",
|
|
1666
|
+
onChange: (event) => {
|
|
1667
|
+
const permissions = { ...value.permissions };
|
|
1668
|
+
if (event.target.value) permissions[name] = event.target.value;
|
|
1669
|
+
else delete permissions[name];
|
|
1670
|
+
emit({ ...value, permissions });
|
|
1671
|
+
},
|
|
1672
|
+
children: [
|
|
1673
|
+
/* @__PURE__ */ jsx7("option", { value: "", children: "Default" }),
|
|
1674
|
+
/* @__PURE__ */ jsx7("option", { value: "allow", children: "Allow" }),
|
|
1675
|
+
/* @__PURE__ */ jsx7("option", { value: "ask", children: "Ask" }),
|
|
1676
|
+
/* @__PURE__ */ jsx7("option", { value: "deny", children: "Deny" })
|
|
1677
|
+
]
|
|
1678
|
+
}
|
|
1679
|
+
)
|
|
1680
|
+
] }),
|
|
1681
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: remove, disabled: editingDisabled, onClick: () => {
|
|
1682
|
+
const tools = { ...value.tools };
|
|
1683
|
+
delete tools[name];
|
|
1684
|
+
emit({ ...value, tools });
|
|
1685
|
+
}, children: "Remove" })
|
|
1686
|
+
] }, name)) }),
|
|
1687
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
|
|
1688
|
+
/* @__PURE__ */ jsx7("input", { "aria-label": "New tool name", className: input, disabled: editingDisabled, value: newTool, onChange: (event) => setNewTool(event.target.value), placeholder: "Tool name" }),
|
|
1689
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: editingDisabled, onClick: () => {
|
|
1690
|
+
const name = newTool.trim();
|
|
1691
|
+
if (!name || name in (value.tools ?? {})) {
|
|
1692
|
+
setError("Enter a unique tool name.");
|
|
1693
|
+
return;
|
|
1694
|
+
}
|
|
1695
|
+
if (emit({ ...value, tools: { ...value.tools, [name]: true } })) setNewTool("");
|
|
1696
|
+
}, children: "Add tool" })
|
|
1697
|
+
] }),
|
|
1698
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Nested permission rules remain in Advanced JSON." })
|
|
1699
|
+
] }),
|
|
1700
|
+
resourceSection("skills", "Skills", "Add skill packages from a repository or inline content."),
|
|
1701
|
+
resourceSection("tools", "Tool files", "Provide files that a supported harness can discover as tools."),
|
|
1702
|
+
/* @__PURE__ */ jsxs5(Section, { title: "MCP servers", description: "Connect remote or local servers. Use secret references for credentials.", children: [
|
|
1703
|
+
Object.keys(value.mcp ?? {}).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No servers added." }),
|
|
1704
|
+
/* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: Object.entries(value.mcp ?? {}).map(([name, server]) => /* @__PURE__ */ jsxs5("li", { className: "flex items-center justify-between gap-3 rounded-lg border border-border p-3 text-sm", children: [
|
|
1705
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
|
|
1706
|
+
/* @__PURE__ */ jsx7("span", { className: "font-medium", children: name }),
|
|
1707
|
+
/* @__PURE__ */ jsx7("span", { className: "ml-2 text-xs text-muted-foreground", children: server.enabled === false ? "Disabled" : "command" in server ? "Local" : "Remote" }),
|
|
1708
|
+
server.enabled !== false && /* @__PURE__ */ jsx7("p", { className: "truncate text-xs text-muted-foreground", children: "command" in server ? server.command : server.url })
|
|
1709
|
+
] }),
|
|
1710
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: remove, disabled: editingDisabled, onClick: () => {
|
|
1711
|
+
const mcp = { ...value.mcp };
|
|
1712
|
+
delete mcp[name];
|
|
1713
|
+
emit({ ...value, mcp });
|
|
1714
|
+
}, children: "Remove" })
|
|
1715
|
+
] }, name)) }),
|
|
1716
|
+
/* @__PURE__ */ jsxs5("div", { className: "grid gap-3 rounded-lg border border-dashed border-border p-3 sm:grid-cols-[1fr_10rem]", children: [
|
|
1717
|
+
/* @__PURE__ */ jsx7(Field, { label: "Server name", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: mcpName, onChange: (event) => setMcpName(event.target.value), placeholder: "search" }) }),
|
|
1718
|
+
/* @__PURE__ */ jsx7(Field, { label: "Transport", children: /* @__PURE__ */ jsxs5("select", { className: input, disabled: editingDisabled, value: mcpKind, onChange: (event) => setMcpKind(event.target.value), children: [
|
|
1719
|
+
/* @__PURE__ */ jsx7("option", { value: "http", children: "HTTP" }),
|
|
1720
|
+
/* @__PURE__ */ jsx7("option", { value: "sse", children: "SSE" }),
|
|
1721
|
+
/* @__PURE__ */ jsx7("option", { value: "stdio", children: "Local command" })
|
|
1722
|
+
] }) }),
|
|
1723
|
+
/* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: mcpKind === "stdio" ? "Command" : "URL", children: /* @__PURE__ */ jsx7("input", { className: input, disabled: editingDisabled, value: mcpTarget, onChange: (event) => setMcpTarget(event.target.value), placeholder: mcpKind === "stdio" ? "mcp-server" : "https://example.com/mcp" }) }) }),
|
|
1724
|
+
/* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: editingDisabled, onClick: addMcp, children: "Add server" }) })
|
|
1725
|
+
] }),
|
|
1726
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Arguments, headers, environment, and secret references remain in Advanced JSON." })
|
|
1727
|
+
] }),
|
|
1728
|
+
/* @__PURE__ */ jsxs5(Section, { title: "Resource files", description: "Mount files in the agent workspace. Edit paths and content in Advanced JSON.", children: [
|
|
1729
|
+
(value.resources?.files ?? []).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No files mounted." }),
|
|
1730
|
+
/* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: (value.resources?.files ?? []).map((mount, index) => /* @__PURE__ */ jsxs5("li", { className: "flex items-center justify-between gap-3 rounded-lg border border-border p-3 text-sm", children: [
|
|
1731
|
+
/* @__PURE__ */ jsxs5("span", { className: "truncate", children: [
|
|
1732
|
+
mount.path,
|
|
1733
|
+
" ",
|
|
1734
|
+
/* @__PURE__ */ jsxs5("span", { className: "text-muted-foreground", children: [
|
|
1735
|
+
"\u2190 ",
|
|
1736
|
+
mount.resource.kind === "github" ? mount.resource.path : mount.resource.name
|
|
1737
|
+
] })
|
|
1738
|
+
] }),
|
|
1739
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: remove, disabled: editingDisabled, onClick: () => emit({ ...value, resources: { ...value.resources, files: (value.resources?.files ?? []).filter((_, i) => i !== index) } }), children: "Remove" })
|
|
1740
|
+
] }, index)) }),
|
|
1741
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: editingDisabled, onClick: () => emit({ ...value, resources: { ...value.resources, files: [...value.resources?.files ?? [], { path: "new-file.md", resource: { kind: "inline", name: "New file", content: "" } }] } }), children: "Add file" })
|
|
1742
|
+
] }),
|
|
1743
|
+
/* @__PURE__ */ jsxs5(Section, { title: "Advanced JSON", description: "Edit the full canonical profile, including hooks, modes, connections, and extensions.", children: [
|
|
1744
|
+
/* @__PURE__ */ jsx7("label", { htmlFor: id + "-json", className: "sr-only", children: "Full profile JSON" }),
|
|
1745
|
+
/* @__PURE__ */ jsx7("textarea", { id: id + "-json", className: input + " min-h-72 font-mono text-xs", spellCheck: false, disabled, value: json, onChange: (event) => {
|
|
1746
|
+
setJson(event.target.value);
|
|
1747
|
+
setJsonDirty(true);
|
|
1748
|
+
} }),
|
|
1749
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
1750
|
+
/* @__PURE__ */ jsx7("button", { type: "button", className: button, disabled: disabled || !jsonDirty, onClick: applyJson, children: "Apply JSON" }),
|
|
1751
|
+
jsonDirty && /* @__PURE__ */ jsx7("button", { type: "button", className: remove, disabled, onClick: () => {
|
|
1752
|
+
setJson(JSON.stringify(value, null, 2));
|
|
1753
|
+
setJsonDirty(false);
|
|
1754
|
+
setError(null);
|
|
1755
|
+
}, children: "Discard JSON edits" })
|
|
1756
|
+
] }),
|
|
1757
|
+
/* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Profiles are public configuration. Store credentials in a vault and reference them by secret key." })
|
|
1758
|
+
] })
|
|
1759
|
+
] });
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1418
1762
|
// src/web-react/durable-plan-flow.ts
|
|
1419
|
-
import { useCallback as useCallback2, useEffect as
|
|
1763
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useRef as useRef5, useState as useState8 } from "react";
|
|
1420
1764
|
var DurablePlanClientError = class extends Error {
|
|
1421
1765
|
constructor(message, status, code, currentPlan) {
|
|
1422
1766
|
super(message);
|
|
@@ -1469,7 +1813,7 @@ async function responseBody(response) {
|
|
|
1469
1813
|
}
|
|
1470
1814
|
function createDurablePlanDecisionClient(options) {
|
|
1471
1815
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
1472
|
-
const urlFor = (
|
|
1816
|
+
const urlFor = (input2) => typeof options.url === "function" ? options.url(input2) : options.url;
|
|
1473
1817
|
const read = async (response) => {
|
|
1474
1818
|
const body = await responseBody(response);
|
|
1475
1819
|
const result = parseDecisionResult(body);
|
|
@@ -1484,32 +1828,32 @@ function createDurablePlanDecisionClient(options) {
|
|
|
1484
1828
|
);
|
|
1485
1829
|
};
|
|
1486
1830
|
return {
|
|
1487
|
-
async current(
|
|
1488
|
-
const rawUrl = urlFor(
|
|
1831
|
+
async current(input2) {
|
|
1832
|
+
const rawUrl = urlFor(input2);
|
|
1489
1833
|
const url = new URL(rawUrl, globalThis.location?.origin ?? "http://localhost");
|
|
1490
|
-
url.searchParams.set("planId",
|
|
1491
|
-
if (
|
|
1834
|
+
url.searchParams.set("planId", input2.planId);
|
|
1835
|
+
if (input2.revision !== void 0) url.searchParams.set("revision", String(input2.revision));
|
|
1492
1836
|
const target = /^https?:/.test(rawUrl) ? url.toString() : `${url.pathname}${url.search}`;
|
|
1493
1837
|
return read(await fetchImpl(target, { method: "GET" }));
|
|
1494
1838
|
},
|
|
1495
|
-
async decide(
|
|
1496
|
-
const extra = typeof options.body === "function" ? options.body(
|
|
1497
|
-
return read(await fetchImpl(urlFor(
|
|
1839
|
+
async decide(input2) {
|
|
1840
|
+
const extra = typeof options.body === "function" ? options.body(input2) : options.body ?? {};
|
|
1841
|
+
return read(await fetchImpl(urlFor(input2), {
|
|
1498
1842
|
method: "POST",
|
|
1499
1843
|
headers: { "Content-Type": "application/json" },
|
|
1500
|
-
body: JSON.stringify({ ...extra, ...
|
|
1844
|
+
body: JSON.stringify({ ...extra, ...input2 })
|
|
1501
1845
|
}));
|
|
1502
1846
|
}
|
|
1503
1847
|
};
|
|
1504
1848
|
}
|
|
1505
1849
|
function useDurablePlanFlow(options) {
|
|
1506
|
-
const [plan, setPlan] =
|
|
1507
|
-
const [deciding, setDeciding] =
|
|
1508
|
-
const [restoring, setRestoring] =
|
|
1509
|
-
const [error, setError] =
|
|
1850
|
+
const [plan, setPlan] = useState8(options.plan);
|
|
1851
|
+
const [deciding, setDeciding] = useState8(null);
|
|
1852
|
+
const [restoring, setRestoring] = useState8(false);
|
|
1853
|
+
const [error, setError] = useState8(null);
|
|
1510
1854
|
const attachments = useRef5(/* @__PURE__ */ new Map());
|
|
1511
1855
|
const decisionInFlight = useRef5(false);
|
|
1512
|
-
|
|
1856
|
+
useEffect6(() => setPlan(options.plan), [options.plan]);
|
|
1513
1857
|
const apply = useCallback2(async (result) => {
|
|
1514
1858
|
setPlan(result.plan);
|
|
1515
1859
|
options.onUpdated?.(result.plan);
|
|
@@ -1678,7 +2022,7 @@ function createDurableInteractionAnswerSubmitter(options) {
|
|
|
1678
2022
|
}
|
|
1679
2023
|
|
|
1680
2024
|
// src/web-react/use-chat-interactions.ts
|
|
1681
|
-
import { useCallback as useCallback3, useMemo as useMemo3, useState as
|
|
2025
|
+
import { useCallback as useCallback3, useMemo as useMemo3, useState as useState9 } from "react";
|
|
1682
2026
|
function hasPendingContentDuplicate(list, interaction) {
|
|
1683
2027
|
if (interaction.status !== "pending") return false;
|
|
1684
2028
|
const signature = questionInteractionContentSignature(interaction);
|
|
@@ -1757,7 +2101,7 @@ function hydrateChatInteractions(list, persisted) {
|
|
|
1757
2101
|
return persisted.reduce(upsertChatInteraction, list);
|
|
1758
2102
|
}
|
|
1759
2103
|
function useChatInteractions(options = {}) {
|
|
1760
|
-
const [interactions, setInteractions] =
|
|
2104
|
+
const [interactions, setInteractions] = useState9([]);
|
|
1761
2105
|
const upsert = useCallback3((interaction) => {
|
|
1762
2106
|
setInteractions((prev) => upsertChatInteraction(prev, interaction));
|
|
1763
2107
|
}, []);
|
|
@@ -1784,7 +2128,7 @@ function useChatInteractions(options = {}) {
|
|
|
1784
2128
|
}
|
|
1785
2129
|
|
|
1786
2130
|
// src/web-react/use-file-mentions.ts
|
|
1787
|
-
import { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef6, useState as
|
|
2131
|
+
import { useCallback as useCallback4, useMemo as useMemo4, useRef as useRef6, useState as useState10 } from "react";
|
|
1788
2132
|
var FILE_MENTION_KIND = "file";
|
|
1789
2133
|
function toMentionItem(file) {
|
|
1790
2134
|
return { id: file.path, label: file.name, detail: file.path, kind: FILE_MENTION_KIND };
|
|
@@ -1842,11 +2186,11 @@ function useFileMentions(options) {
|
|
|
1842
2186
|
emptyText = DEFAULT_MENTION_EMPTY_TEXT
|
|
1843
2187
|
} = options;
|
|
1844
2188
|
const fetchImpl = options.fetchImpl ?? fetch;
|
|
1845
|
-
const [state, setState] =
|
|
2189
|
+
const [state, setState] = useState10({ kind: "idle" });
|
|
1846
2190
|
const stateRef = useRef6(state);
|
|
1847
2191
|
stateRef.current = state;
|
|
1848
2192
|
const inFlightRef = useRef6(null);
|
|
1849
|
-
const [mentions, setMentions] =
|
|
2193
|
+
const [mentions, setMentions] = useState10([]);
|
|
1850
2194
|
const load = useCallback4(() => {
|
|
1851
2195
|
if (inFlightRef.current) return inFlightRef.current;
|
|
1852
2196
|
if (stateRef.current.kind === "idle") {
|
|
@@ -1953,8 +2297,8 @@ function segmentMentionContent(content, parts) {
|
|
|
1953
2297
|
}
|
|
1954
2298
|
|
|
1955
2299
|
// src/web-react/mission-activity.tsx
|
|
1956
|
-
import { useCallback as useCallback5, useEffect as
|
|
1957
|
-
import { Fragment as Fragment2, jsx as
|
|
2300
|
+
import { useCallback as useCallback5, useEffect as useEffect7, useState as useState11 } from "react";
|
|
2301
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1958
2302
|
var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
|
|
1959
2303
|
var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
|
|
1960
2304
|
var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted"]);
|
|
@@ -2001,19 +2345,19 @@ function waterfallLayout(trace) {
|
|
|
2001
2345
|
});
|
|
2002
2346
|
}
|
|
2003
2347
|
function ChevronGlyph({ className }) {
|
|
2004
|
-
return /* @__PURE__ */
|
|
2348
|
+
return /* @__PURE__ */ jsx8("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx8("path", { d: "m6 9 6 6 6-6" }) });
|
|
2005
2349
|
}
|
|
2006
2350
|
function RefreshGlyph({ className }) {
|
|
2007
|
-
return /* @__PURE__ */
|
|
2351
|
+
return /* @__PURE__ */ jsx8("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx8("path", { d: "M21 12a9 9 0 1 1-2.64-6.36M21 3v6h-6" }) });
|
|
2008
2352
|
}
|
|
2009
2353
|
function CopyGlyph({ className }) {
|
|
2010
|
-
return /* @__PURE__ */
|
|
2011
|
-
/* @__PURE__ */
|
|
2012
|
-
/* @__PURE__ */
|
|
2354
|
+
return /* @__PURE__ */ jsxs6("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
2355
|
+
/* @__PURE__ */ jsx8("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
2356
|
+
/* @__PURE__ */ jsx8("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
2013
2357
|
] });
|
|
2014
2358
|
}
|
|
2015
2359
|
function TraceIdCopy({ traceId }) {
|
|
2016
|
-
const [copied, setCopied] =
|
|
2360
|
+
const [copied, setCopied] = useState11(false);
|
|
2017
2361
|
const copy = useCallback5(() => {
|
|
2018
2362
|
void navigator.clipboard?.writeText(traceId).then(
|
|
2019
2363
|
() => {
|
|
@@ -2024,7 +2368,7 @@ function TraceIdCopy({ traceId }) {
|
|
|
2024
2368
|
}
|
|
2025
2369
|
);
|
|
2026
2370
|
}, [traceId]);
|
|
2027
|
-
return /* @__PURE__ */
|
|
2371
|
+
return /* @__PURE__ */ jsxs6(
|
|
2028
2372
|
"button",
|
|
2029
2373
|
{
|
|
2030
2374
|
type: "button",
|
|
@@ -2033,29 +2377,29 @@ function TraceIdCopy({ traceId }) {
|
|
|
2033
2377
|
"aria-label": "Copy trace id",
|
|
2034
2378
|
className: "inline-flex min-w-0 items-center gap-1.5 rounded text-left font-mono text-muted-foreground transition hover:text-foreground",
|
|
2035
2379
|
children: [
|
|
2036
|
-
/* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
copied && /* @__PURE__ */
|
|
2380
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate", children: traceId }),
|
|
2381
|
+
/* @__PURE__ */ jsx8(CopyGlyph, { className: "h-3 w-3 shrink-0" }),
|
|
2382
|
+
copied && /* @__PURE__ */ jsx8("span", { className: "shrink-0 not-italic text-success", children: "copied" })
|
|
2039
2383
|
]
|
|
2040
2384
|
}
|
|
2041
2385
|
);
|
|
2042
2386
|
}
|
|
2043
2387
|
function StatusDot({ tone }) {
|
|
2044
|
-
return /* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2388
|
+
return /* @__PURE__ */ jsxs6("span", { className: "inline-flex items-center", children: [
|
|
2389
|
+
/* @__PURE__ */ jsx8(
|
|
2046
2390
|
"span",
|
|
2047
2391
|
{
|
|
2048
2392
|
"aria-hidden": true,
|
|
2049
2393
|
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"}`
|
|
2050
2394
|
}
|
|
2051
2395
|
),
|
|
2052
|
-
/* @__PURE__ */
|
|
2396
|
+
/* @__PURE__ */ jsx8("span", { className: "sr-only", children: tone })
|
|
2053
2397
|
] });
|
|
2054
2398
|
}
|
|
2055
2399
|
function RunLabel({ tool, detail, live }) {
|
|
2056
|
-
return /* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2058
|
-
/* @__PURE__ */
|
|
2400
|
+
return /* @__PURE__ */ jsxs6("span", { className: "min-w-0 flex-1 truncate", children: [
|
|
2401
|
+
/* @__PURE__ */ jsx8("span", { className: live ? "agent-shimmer font-medium" : "font-medium", "data-motion": live ? "essential" : void 0, children: tool }),
|
|
2402
|
+
/* @__PURE__ */ jsxs6("span", { className: "text-muted-foreground", children: [
|
|
2059
2403
|
" \u2014 ",
|
|
2060
2404
|
detail
|
|
2061
2405
|
] })
|
|
@@ -2070,19 +2414,19 @@ function FlowWaterfall({ trace }) {
|
|
|
2070
2414
|
const rows = waterfallLayout(trace);
|
|
2071
2415
|
if (rows.length === 0) return null;
|
|
2072
2416
|
const cost = formatActivityCost(trace.costUsd);
|
|
2073
|
-
return /* @__PURE__ */
|
|
2074
|
-
rows.map((row, i) => /* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2076
|
-
/* @__PURE__ */
|
|
2417
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-1", children: [
|
|
2418
|
+
rows.map((row, i) => /* @__PURE__ */ jsxs6("div", { className: "grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)_auto] items-center gap-2", children: [
|
|
2419
|
+
/* @__PURE__ */ jsx8("span", { className: "truncate font-mono text-xs text-muted-foreground", title: row.name, children: row.name }),
|
|
2420
|
+
/* @__PURE__ */ jsx8("div", { className: "relative h-2 rounded-sm bg-secondary", children: /* @__PURE__ */ jsx8(
|
|
2077
2421
|
"div",
|
|
2078
2422
|
{
|
|
2079
2423
|
className: `absolute inset-y-0 rounded-sm ${row.ok ? BAR_CLASS[row.kind] : "bg-destructive/80"} ${row.approx ? "opacity-70" : ""}`,
|
|
2080
2424
|
style: { left: `${row.offsetPct}%`, width: `${row.widthPct}%` }
|
|
2081
2425
|
}
|
|
2082
2426
|
) }),
|
|
2083
|
-
/* @__PURE__ */
|
|
2427
|
+
/* @__PURE__ */ jsx8("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground/70", children: row.durationLabel })
|
|
2084
2428
|
] }, i)),
|
|
2085
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ jsxs6("p", { className: "pt-0.5 text-right font-mono text-xs tabular-nums text-muted-foreground/60", children: [
|
|
2086
2430
|
(trace.totalMs / 1e3).toFixed(1),
|
|
2087
2431
|
"s",
|
|
2088
2432
|
cost ? ` \xB7 ${cost}` : ""
|
|
@@ -2094,35 +2438,35 @@ function LaneRow({ run, staggerIndex }) {
|
|
|
2094
2438
|
const tone = activityTone(run.status);
|
|
2095
2439
|
const cost = formatActivityCost(run.costUsd);
|
|
2096
2440
|
const duration = formatActivityDuration(run.durationMs);
|
|
2097
|
-
return /* @__PURE__ */
|
|
2098
|
-
/* @__PURE__ */
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */
|
|
2101
|
-
/* @__PURE__ */
|
|
2102
|
-
tone !== "live" && tone !== "ok" && /* @__PURE__ */
|
|
2103
|
-
cost && /* @__PURE__ */
|
|
2104
|
-
duration && /* @__PURE__ */
|
|
2441
|
+
return /* @__PURE__ */ jsxs6("div", { className: "agent-arrive flex items-center gap-2 py-1 text-xs", style: arrival, children: [
|
|
2442
|
+
/* @__PURE__ */ jsx8(StatusDot, { tone }),
|
|
2443
|
+
/* @__PURE__ */ jsx8(RunLabel, { tool: run.tool, detail: run.detail, live: tone === "live" }),
|
|
2444
|
+
tone === "live" && (run.iteration !== void 0 || run.phase !== void 0) && /* @__PURE__ */ jsx8("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 ") }),
|
|
2445
|
+
/* @__PURE__ */ jsxs6("span", { className: "flex shrink-0 items-center gap-1.5 font-mono text-xs tabular-nums text-muted-foreground/70", children: [
|
|
2446
|
+
tone !== "live" && tone !== "ok" && /* @__PURE__ */ jsx8("span", { children: run.status }),
|
|
2447
|
+
cost && /* @__PURE__ */ jsx8("span", { children: cost }),
|
|
2448
|
+
duration && /* @__PURE__ */ jsx8("span", { children: duration })
|
|
2105
2449
|
] })
|
|
2106
2450
|
] });
|
|
2107
2451
|
}
|
|
2108
2452
|
function MissionActivityLane({ activity, startedAt, nowMs }) {
|
|
2109
|
-
const [expanded, setExpanded] =
|
|
2453
|
+
const [expanded, setExpanded] = useState11(false);
|
|
2110
2454
|
if (activity.length === 0) return null;
|
|
2111
|
-
return /* @__PURE__ */
|
|
2112
|
-
activity.map((run, index) => /* @__PURE__ */
|
|
2113
|
-
/* @__PURE__ */
|
|
2455
|
+
return /* @__PURE__ */ jsxs6("div", { className: "mt-1 border-l border-border pl-3", children: [
|
|
2456
|
+
activity.map((run, index) => /* @__PURE__ */ jsx8(LaneRow, { run, staggerIndex: index }, run.taskId)),
|
|
2457
|
+
/* @__PURE__ */ jsxs6(
|
|
2114
2458
|
"button",
|
|
2115
2459
|
{
|
|
2116
2460
|
type: "button",
|
|
2117
2461
|
onClick: () => setExpanded((v) => !v),
|
|
2118
2462
|
className: "flex items-center gap-1 py-0.5 text-xs font-medium text-muted-foreground/70 transition hover:text-foreground",
|
|
2119
2463
|
children: [
|
|
2120
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ jsx8(ChevronGlyph, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` }),
|
|
2121
2465
|
"timeline"
|
|
2122
2466
|
]
|
|
2123
2467
|
}
|
|
2124
2468
|
),
|
|
2125
|
-
expanded && /* @__PURE__ */
|
|
2469
|
+
expanded && /* @__PURE__ */ jsx8("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx8(
|
|
2126
2470
|
FlowWaterfall,
|
|
2127
2471
|
{
|
|
2128
2472
|
trace: stepActivityFlowTrace(activity, {
|
|
@@ -2139,39 +2483,39 @@ function ActivityRow({
|
|
|
2139
2483
|
staggerIndex
|
|
2140
2484
|
}) {
|
|
2141
2485
|
const arrival = useArrivalStyle(staggerIndex);
|
|
2142
|
-
const [open, setOpen] =
|
|
2486
|
+
const [open, setOpen] = useState11(false);
|
|
2143
2487
|
const tone = activityTone(record.status);
|
|
2144
2488
|
const cost = formatActivityCost(record.costUsd);
|
|
2145
2489
|
const duration = formatActivityDuration(record.durationMs);
|
|
2146
|
-
return /* @__PURE__ */
|
|
2147
|
-
/* @__PURE__ */
|
|
2148
|
-
/* @__PURE__ */
|
|
2149
|
-
/* @__PURE__ */
|
|
2150
|
-
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */
|
|
2151
|
-
/* @__PURE__ */
|
|
2490
|
+
return /* @__PURE__ */ jsxs6("div", { className: "agent-arrive rounded-lg border border-card-edge bg-card", style: arrival, children: [
|
|
2491
|
+
/* @__PURE__ */ jsxs6("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: [
|
|
2492
|
+
/* @__PURE__ */ jsx8(StatusDot, { tone }),
|
|
2493
|
+
/* @__PURE__ */ jsx8(RunLabel, { tool: record.tool, detail: record.detail, live: tone === "live" }),
|
|
2494
|
+
tone === "live" && (record.iteration !== void 0 || record.phase !== void 0) && /* @__PURE__ */ jsx8("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 ") }),
|
|
2495
|
+
/* @__PURE__ */ jsx8(
|
|
2152
2496
|
"span",
|
|
2153
2497
|
{
|
|
2154
2498
|
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"}`,
|
|
2155
2499
|
children: record.status
|
|
2156
2500
|
}
|
|
2157
2501
|
),
|
|
2158
|
-
cost && /* @__PURE__ */
|
|
2159
|
-
/* @__PURE__ */
|
|
2502
|
+
cost && /* @__PURE__ */ jsx8("span", { className: "shrink-0 font-mono text-xs tabular-nums text-muted-foreground", children: cost }),
|
|
2503
|
+
/* @__PURE__ */ jsx8(ChevronGlyph, { className: `h-3 w-3 shrink-0 text-muted-foreground transition-transform ${open ? "rotate-180" : ""}` })
|
|
2160
2504
|
] }),
|
|
2161
|
-
open && /* @__PURE__ */
|
|
2162
|
-
record.durationMs !== void 0 && /* @__PURE__ */
|
|
2163
|
-
/* @__PURE__ */
|
|
2164
|
-
/* @__PURE__ */
|
|
2165
|
-
/* @__PURE__ */
|
|
2166
|
-
/* @__PURE__ */
|
|
2167
|
-
/* @__PURE__ */
|
|
2168
|
-
duration && /* @__PURE__ */
|
|
2169
|
-
/* @__PURE__ */
|
|
2170
|
-
/* @__PURE__ */
|
|
2505
|
+
open && /* @__PURE__ */ jsxs6("div", { className: "space-y-2.5 border-t border-border px-3 py-2.5", children: [
|
|
2506
|
+
record.durationMs !== void 0 && /* @__PURE__ */ jsx8("div", { className: "rounded-md border border-border bg-secondary p-2", children: /* @__PURE__ */ jsx8(FlowWaterfall, { trace: stepActivityFlowTrace([record]) }) }),
|
|
2507
|
+
/* @__PURE__ */ jsxs6("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1 font-mono text-xs", children: [
|
|
2508
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "task" }),
|
|
2509
|
+
/* @__PURE__ */ jsx8("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
|
|
2510
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "started" }),
|
|
2511
|
+
/* @__PURE__ */ jsx8("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
|
|
2512
|
+
duration && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2513
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "duration" }),
|
|
2514
|
+
/* @__PURE__ */ jsx8("dd", { className: "text-muted-foreground", children: duration })
|
|
2171
2515
|
] }),
|
|
2172
|
-
record.traceId && /* @__PURE__ */
|
|
2173
|
-
/* @__PURE__ */
|
|
2174
|
-
/* @__PURE__ */
|
|
2516
|
+
record.traceId && /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
2517
|
+
/* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "trace" }),
|
|
2518
|
+
/* @__PURE__ */ jsx8("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx8(TraceIdCopy, { traceId: record.traceId }) })
|
|
2175
2519
|
] })
|
|
2176
2520
|
] }),
|
|
2177
2521
|
record.missionRef && renderMissionRef?.(record.missionRef, record)
|
|
@@ -2179,10 +2523,10 @@ function ActivityRow({
|
|
|
2179
2523
|
] });
|
|
2180
2524
|
}
|
|
2181
2525
|
function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent activity", emptyLabel = "No agent runs yet." }) {
|
|
2182
|
-
const [rows, setRows] =
|
|
2183
|
-
const [cursor, setCursor] =
|
|
2184
|
-
const [status, setStatus] =
|
|
2185
|
-
const [error, setError] =
|
|
2526
|
+
const [rows, setRows] = useState11([]);
|
|
2527
|
+
const [cursor, setCursor] = useState11(void 0);
|
|
2528
|
+
const [status, setStatus] = useState11("loading");
|
|
2529
|
+
const [error, setError] = useState11(null);
|
|
2186
2530
|
const load = useCallback5(
|
|
2187
2531
|
async (from) => {
|
|
2188
2532
|
setStatus("loading");
|
|
@@ -2199,14 +2543,14 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2199
2543
|
},
|
|
2200
2544
|
[fetchActivity]
|
|
2201
2545
|
);
|
|
2202
|
-
|
|
2546
|
+
useEffect7(() => {
|
|
2203
2547
|
void load();
|
|
2204
2548
|
}, [load]);
|
|
2205
2549
|
const loading = status === "loading";
|
|
2206
|
-
return /* @__PURE__ */
|
|
2207
|
-
/* @__PURE__ */
|
|
2208
|
-
/* @__PURE__ */
|
|
2209
|
-
/* @__PURE__ */
|
|
2550
|
+
return /* @__PURE__ */ jsxs6("div", { className: "space-y-2", children: [
|
|
2551
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
2552
|
+
/* @__PURE__ */ jsx8("h2", { className: "flex-1 text-sm font-semibold", children: title }),
|
|
2553
|
+
/* @__PURE__ */ jsx8(
|
|
2210
2554
|
"button",
|
|
2211
2555
|
{
|
|
2212
2556
|
type: "button",
|
|
@@ -2214,15 +2558,15 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2214
2558
|
disabled: loading,
|
|
2215
2559
|
"aria-label": "Refresh",
|
|
2216
2560
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground disabled:opacity-50",
|
|
2217
|
-
children: /* @__PURE__ */
|
|
2561
|
+
children: /* @__PURE__ */ jsx8(RefreshGlyph, { className: `h-3.5 w-3.5 ${loading ? "animate-spin" : ""}` })
|
|
2218
2562
|
}
|
|
2219
2563
|
)
|
|
2220
2564
|
] }),
|
|
2221
|
-
status === "error" && /* @__PURE__ */
|
|
2222
|
-
status === "ready" && rows.length === 0 && /* @__PURE__ */
|
|
2223
|
-
/* @__PURE__ */
|
|
2224
|
-
/* @__PURE__ */
|
|
2225
|
-
cursor && /* @__PURE__ */
|
|
2565
|
+
status === "error" && /* @__PURE__ */ jsx8("p", { role: "alert", className: "rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive", children: error }),
|
|
2566
|
+
status === "ready" && rows.length === 0 && /* @__PURE__ */ jsx8("p", { className: "px-1 text-sm text-muted-foreground", children: emptyLabel }),
|
|
2567
|
+
/* @__PURE__ */ jsx8("span", { role: "status", "aria-live": "polite", "aria-busy": loading, className: "sr-only", children: loading ? "Loading activity\u2026" : "" }),
|
|
2568
|
+
/* @__PURE__ */ jsx8("div", { className: "space-y-1.5", "aria-busy": loading, children: rows.map((record, index) => /* @__PURE__ */ jsx8(ActivityRow, { record, renderMissionRef, staggerIndex: index }, record.taskId)) }),
|
|
2569
|
+
cursor && /* @__PURE__ */ jsx8(
|
|
2226
2570
|
"button",
|
|
2227
2571
|
{
|
|
2228
2572
|
type: "button",
|
|
@@ -2236,7 +2580,7 @@ function AgentActivityPanel({ fetchActivity, renderMissionRef, title = "Agent ac
|
|
|
2236
2580
|
}
|
|
2237
2581
|
|
|
2238
2582
|
// src/web-react/provenance.tsx
|
|
2239
|
-
import { useCallback as useCallback6, useEffect as
|
|
2583
|
+
import { useCallback as useCallback6, useEffect as useEffect8, useId as useId2, useRef as useRef7, useState as useState12 } from "react";
|
|
2240
2584
|
|
|
2241
2585
|
// src/web-react/provenance-model.ts
|
|
2242
2586
|
var PROVENANCE_BASES = ["extracted", "entered", "computed", "asserted"];
|
|
@@ -2336,16 +2680,16 @@ function rollUpProvenanceStanding(record, policy = DEFAULT_PROVENANCE_CONFIDENCE
|
|
|
2336
2680
|
if (seen.has(record)) return "settled";
|
|
2337
2681
|
seen.add(record);
|
|
2338
2682
|
let standing = resolveProvenanceStanding(record, policy);
|
|
2339
|
-
for (const
|
|
2340
|
-
standing = weakerProvenanceStanding(standing, rollUpProvenanceStanding(
|
|
2683
|
+
for (const input2 of record.inputs ?? []) {
|
|
2684
|
+
standing = weakerProvenanceStanding(standing, rollUpProvenanceStanding(input2, policy, seen));
|
|
2341
2685
|
}
|
|
2342
2686
|
return standing;
|
|
2343
2687
|
}
|
|
2344
2688
|
function sourcePhrase(source) {
|
|
2345
2689
|
return source.locator ? `${source.label}, ${source.locator}` : source.label;
|
|
2346
2690
|
}
|
|
2347
|
-
function inputPhrase(
|
|
2348
|
-
return
|
|
2691
|
+
function inputPhrase(input2) {
|
|
2692
|
+
return input2.label ?? input2.display;
|
|
2349
2693
|
}
|
|
2350
2694
|
function describeProvenance(record) {
|
|
2351
2695
|
const sources = record.sources ?? [];
|
|
@@ -2396,7 +2740,7 @@ function provenanceTriggerLabel(record, standing) {
|
|
|
2396
2740
|
}
|
|
2397
2741
|
|
|
2398
2742
|
// src/web-react/provenance.tsx
|
|
2399
|
-
import { jsx as
|
|
2743
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
2400
2744
|
var BASIS_TONES = {
|
|
2401
2745
|
extracted: "border-primary/30 bg-primary/10 text-primary",
|
|
2402
2746
|
entered: "border-success/30 bg-success/10 text-success",
|
|
@@ -2421,27 +2765,27 @@ function BasisGlyph({ basis, className }) {
|
|
|
2421
2765
|
};
|
|
2422
2766
|
switch (basis) {
|
|
2423
2767
|
case "extracted":
|
|
2424
|
-
return /* @__PURE__ */
|
|
2425
|
-
/* @__PURE__ */
|
|
2426
|
-
/* @__PURE__ */
|
|
2427
|
-
/* @__PURE__ */
|
|
2768
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2769
|
+
/* @__PURE__ */ jsx9("path", { d: "M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z" }),
|
|
2770
|
+
/* @__PURE__ */ jsx9("polyline", { points: "14 3 14 8 19 8" }),
|
|
2771
|
+
/* @__PURE__ */ jsx9("line", { x1: "9", y1: "13", x2: "15", y2: "13" })
|
|
2428
2772
|
] });
|
|
2429
2773
|
case "entered":
|
|
2430
|
-
return /* @__PURE__ */
|
|
2431
|
-
/* @__PURE__ */
|
|
2432
|
-
/* @__PURE__ */
|
|
2774
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2775
|
+
/* @__PURE__ */ jsx9("path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }),
|
|
2776
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "7", r: "4" })
|
|
2433
2777
|
] });
|
|
2434
2778
|
case "computed":
|
|
2435
|
-
return /* @__PURE__ */
|
|
2436
|
-
/* @__PURE__ */
|
|
2437
|
-
/* @__PURE__ */
|
|
2438
|
-
/* @__PURE__ */
|
|
2439
|
-
/* @__PURE__ */
|
|
2779
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2780
|
+
/* @__PURE__ */ jsx9("line", { x1: "4", y1: "9", x2: "20", y2: "9" }),
|
|
2781
|
+
/* @__PURE__ */ jsx9("line", { x1: "4", y1: "15", x2: "20", y2: "15" }),
|
|
2782
|
+
/* @__PURE__ */ jsx9("line", { x1: "10", y1: "3", x2: "8", y2: "21" }),
|
|
2783
|
+
/* @__PURE__ */ jsx9("line", { x1: "16", y1: "3", x2: "14", y2: "21" })
|
|
2440
2784
|
] });
|
|
2441
2785
|
case "asserted":
|
|
2442
|
-
return /* @__PURE__ */
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
/* @__PURE__ */
|
|
2786
|
+
return /* @__PURE__ */ jsxs7("svg", { ...shared, children: [
|
|
2787
|
+
/* @__PURE__ */ jsx9("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" }),
|
|
2788
|
+
/* @__PURE__ */ jsx9("circle", { cx: "12", cy: "12", r: "3.2" })
|
|
2445
2789
|
] });
|
|
2446
2790
|
}
|
|
2447
2791
|
}
|
|
@@ -2461,11 +2805,11 @@ function SourceRow({
|
|
|
2461
2805
|
const status = source.status ?? "ready";
|
|
2462
2806
|
const statusLine = describeProvenanceSourceStatus(source);
|
|
2463
2807
|
const openable = status === "ready" && (onOpenSource !== void 0 || source.href !== void 0);
|
|
2464
|
-
return /* @__PURE__ */
|
|
2465
|
-
/* @__PURE__ */
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
source.locator && /* @__PURE__ */
|
|
2468
|
-
openable && (onOpenSource ? /* @__PURE__ */
|
|
2808
|
+
return /* @__PURE__ */ jsxs7("li", { className: "rounded-md border border-card-edge bg-card px-2.5 py-2", children: [
|
|
2809
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
2810
|
+
/* @__PURE__ */ jsx9("span", { className: "text-sm font-medium text-foreground", children: source.label }),
|
|
2811
|
+
source.locator && /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: source.locator }),
|
|
2812
|
+
openable && (onOpenSource ? /* @__PURE__ */ jsxs7(
|
|
2469
2813
|
"button",
|
|
2470
2814
|
{
|
|
2471
2815
|
type: "button",
|
|
@@ -2476,7 +2820,7 @@ function SourceRow({
|
|
|
2476
2820
|
source.label
|
|
2477
2821
|
]
|
|
2478
2822
|
}
|
|
2479
|
-
) : /* @__PURE__ */
|
|
2823
|
+
) : /* @__PURE__ */ jsxs7(
|
|
2480
2824
|
"a",
|
|
2481
2825
|
{
|
|
2482
2826
|
href: source.href,
|
|
@@ -2490,7 +2834,7 @@ function SourceRow({
|
|
|
2490
2834
|
}
|
|
2491
2835
|
))
|
|
2492
2836
|
] }),
|
|
2493
|
-
source.quote && /* @__PURE__ */
|
|
2837
|
+
source.quote && /* @__PURE__ */ jsxs7("blockquote", { className: "mt-1 border-l-2 border-primary/50 pl-2 text-[12px] italic leading-snug text-foreground", children: [
|
|
2494
2838
|
"\u201C",
|
|
2495
2839
|
source.quote,
|
|
2496
2840
|
"\u201D"
|
|
@@ -2499,14 +2843,14 @@ function SourceRow({
|
|
|
2499
2843
|
// update is theirs to read, not an interruption. Either way it is TEXT
|
|
2500
2844
|
// — a spinner alone and a greyed row alone both render as "nothing
|
|
2501
2845
|
// here".
|
|
2502
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ jsxs7(
|
|
2503
2847
|
"p",
|
|
2504
2848
|
{
|
|
2505
2849
|
role: "status",
|
|
2506
2850
|
className: `mt-1 text-xs ${status === "unavailable" ? "text-destructive" : "text-muted-foreground"}`,
|
|
2507
2851
|
children: [
|
|
2508
2852
|
statusLine,
|
|
2509
|
-
status === "unavailable" && onRetrySource && /* @__PURE__ */
|
|
2853
|
+
status === "unavailable" && onRetrySource && /* @__PURE__ */ jsx9(
|
|
2510
2854
|
"button",
|
|
2511
2855
|
{
|
|
2512
2856
|
type: "button",
|
|
@@ -2530,10 +2874,10 @@ function ProvenanceValue({
|
|
|
2530
2874
|
missingValueLabel = DEFAULT_MISSING_VALUE_LABEL,
|
|
2531
2875
|
className
|
|
2532
2876
|
}) {
|
|
2533
|
-
const [open, setOpen] =
|
|
2877
|
+
const [open, setOpen] = useState12(defaultOpen);
|
|
2534
2878
|
const triggerRef = useRef7(null);
|
|
2535
2879
|
const rootRef = useRef7(null);
|
|
2536
|
-
const panelId =
|
|
2880
|
+
const panelId = useId2();
|
|
2537
2881
|
const standing = rollUpProvenanceStanding(record, confidencePolicy);
|
|
2538
2882
|
const basisMeta = provenanceBasisMeta(record.basis);
|
|
2539
2883
|
const standingMeta = provenanceStandingMeta(standing);
|
|
@@ -2555,7 +2899,7 @@ function ProvenanceValue({
|
|
|
2555
2899
|
if (!open) closeTrailsOutside(rootRef.current);
|
|
2556
2900
|
setOpen(!open);
|
|
2557
2901
|
}, [open]);
|
|
2558
|
-
|
|
2902
|
+
useEffect8(() => {
|
|
2559
2903
|
const root = rootRef.current;
|
|
2560
2904
|
if (!open || root === null) return;
|
|
2561
2905
|
const entry = { root, close: () => setOpen(false) };
|
|
@@ -2573,12 +2917,12 @@ function ProvenanceValue({
|
|
|
2573
2917
|
document.removeEventListener("touchstart", onPointerDown, true);
|
|
2574
2918
|
};
|
|
2575
2919
|
}, [open]);
|
|
2576
|
-
const summary = /* @__PURE__ */
|
|
2577
|
-
record.label && /* @__PURE__ */
|
|
2578
|
-
/* @__PURE__ */
|
|
2920
|
+
const summary = /* @__PURE__ */ jsxs7("span", { className: "inline-flex flex-wrap items-baseline gap-x-1.5", children: [
|
|
2921
|
+
record.label && /* @__PURE__ */ jsx9("span", { className: "text-xs text-muted-foreground", children: record.label }),
|
|
2922
|
+
/* @__PURE__ */ jsx9("span", { className: hasValue ? "text-sm text-foreground" : "text-sm italic text-muted-foreground", children: hasValue ? record.display : missingValueLabel })
|
|
2579
2923
|
] });
|
|
2580
2924
|
if (maxDepth <= 0) {
|
|
2581
|
-
return /* @__PURE__ */
|
|
2925
|
+
return /* @__PURE__ */ jsxs7(
|
|
2582
2926
|
"div",
|
|
2583
2927
|
{
|
|
2584
2928
|
className: `inline-block max-w-full ${className ?? ""}`,
|
|
@@ -2586,22 +2930,22 @@ function ProvenanceValue({
|
|
|
2586
2930
|
"data-provenance-standing": standing,
|
|
2587
2931
|
children: [
|
|
2588
2932
|
summary,
|
|
2589
|
-
/* @__PURE__ */
|
|
2933
|
+
/* @__PURE__ */ jsxs7(
|
|
2590
2934
|
"span",
|
|
2591
2935
|
{
|
|
2592
2936
|
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]}`,
|
|
2593
2937
|
children: [
|
|
2594
|
-
/* @__PURE__ */
|
|
2938
|
+
/* @__PURE__ */ jsx9(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
2595
2939
|
basisMeta.label
|
|
2596
2940
|
]
|
|
2597
2941
|
}
|
|
2598
2942
|
),
|
|
2599
|
-
/* @__PURE__ */
|
|
2943
|
+
/* @__PURE__ */ jsx9("span", { className: "mt-0.5 block text-xs text-muted-foreground", children: describeProvenance(record) })
|
|
2600
2944
|
]
|
|
2601
2945
|
}
|
|
2602
2946
|
);
|
|
2603
2947
|
}
|
|
2604
|
-
return /* @__PURE__ */
|
|
2948
|
+
return /* @__PURE__ */ jsxs7(
|
|
2605
2949
|
"div",
|
|
2606
2950
|
{
|
|
2607
2951
|
ref: rootRef,
|
|
@@ -2610,9 +2954,9 @@ function ProvenanceValue({
|
|
|
2610
2954
|
"data-provenance-basis": record.basis,
|
|
2611
2955
|
"data-provenance-standing": standing,
|
|
2612
2956
|
children: [
|
|
2613
|
-
/* @__PURE__ */
|
|
2957
|
+
/* @__PURE__ */ jsxs7("span", { className: "inline-flex flex-wrap items-baseline gap-1.5", children: [
|
|
2614
2958
|
summary,
|
|
2615
|
-
/* @__PURE__ */
|
|
2959
|
+
/* @__PURE__ */ jsxs7(
|
|
2616
2960
|
"button",
|
|
2617
2961
|
{
|
|
2618
2962
|
ref: triggerRef,
|
|
@@ -2623,17 +2967,17 @@ function ProvenanceValue({
|
|
|
2623
2967
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
2624
2968
|
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]}`,
|
|
2625
2969
|
children: [
|
|
2626
|
-
/* @__PURE__ */
|
|
2627
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsx9(BasisGlyph, { basis: record.basis, className: "h-3 w-3" }),
|
|
2971
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": true, children: basisMeta.label })
|
|
2628
2972
|
]
|
|
2629
2973
|
}
|
|
2630
2974
|
),
|
|
2631
2975
|
standing !== "settled" && // Legible at rest: what to do about the value does not wait for
|
|
2632
2976
|
// someone to open the panel. `aria-hidden` because the trigger's
|
|
2633
2977
|
// accessible name already carries it — this is the visual half.
|
|
2634
|
-
/* @__PURE__ */
|
|
2978
|
+
/* @__PURE__ */ jsx9("span", { "aria-hidden": true, className: `text-xs font-medium ${STANDING_TONES[standing]}`, children: standingMeta.label })
|
|
2635
2979
|
] }),
|
|
2636
|
-
open && /* @__PURE__ */
|
|
2980
|
+
open && /* @__PURE__ */ jsxs7(
|
|
2637
2981
|
"div",
|
|
2638
2982
|
{
|
|
2639
2983
|
id: panelId,
|
|
@@ -2641,19 +2985,19 @@ function ProvenanceValue({
|
|
|
2641
2985
|
"aria-label": provenanceTriggerLabel(record, standing),
|
|
2642
2986
|
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",
|
|
2643
2987
|
children: [
|
|
2644
|
-
/* @__PURE__ */
|
|
2645
|
-
/* @__PURE__ */
|
|
2646
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ jsxs7("div", { children: [
|
|
2989
|
+
/* @__PURE__ */ jsx9("p", { className: "text-[12px] leading-snug text-foreground", children: describeProvenance(record) }),
|
|
2990
|
+
/* @__PURE__ */ jsxs7("p", { className: `mt-0.5 text-xs leading-snug ${STANDING_TONES[standing]}`, children: [
|
|
2647
2991
|
standingMeta.label,
|
|
2648
2992
|
" \u2014 ",
|
|
2649
2993
|
provenanceNextMove(record, standing, confidencePolicy)
|
|
2650
2994
|
] }),
|
|
2651
|
-
basisMeta.checkableAgainst === null && /* @__PURE__ */
|
|
2995
|
+
basisMeta.checkableAgainst === null && /* @__PURE__ */ jsxs7("p", { className: "mt-0.5 text-xs leading-snug text-muted-foreground", children: [
|
|
2652
2996
|
basisMeta.meaning,
|
|
2653
2997
|
" There is nothing outside the model to check it against."
|
|
2654
2998
|
] })
|
|
2655
2999
|
] }),
|
|
2656
|
-
sources.length > 0 && /* @__PURE__ */
|
|
3000
|
+
sources.length > 0 && /* @__PURE__ */ jsx9("ul", { className: "space-y-1.5", children: sources.map((source, index) => /* @__PURE__ */ jsx9(
|
|
2657
3001
|
SourceRow,
|
|
2658
3002
|
{
|
|
2659
3003
|
source,
|
|
@@ -2666,22 +3010,22 @@ function ProvenanceValue({
|
|
|
2666
3010
|
gaps.filter((gap) => gap.kind !== "unavailable-source").map((gap) => (
|
|
2667
3011
|
// An unavailable source already states itself on its own row; a
|
|
2668
3012
|
// structural gap has no row to state it, so it gets one here.
|
|
2669
|
-
/* @__PURE__ */
|
|
3013
|
+
/* @__PURE__ */ jsx9("p", { className: "rounded-md bg-destructive/10 px-2 py-1.5 text-xs leading-snug text-destructive", children: gap.message }, gap.kind)
|
|
2670
3014
|
)),
|
|
2671
|
-
loading.length > 0 && sources.length === 0 && /* @__PURE__ */
|
|
2672
|
-
inputs.length > 0 && /* @__PURE__ */
|
|
2673
|
-
/* @__PURE__ */
|
|
2674
|
-
/* @__PURE__ */
|
|
3015
|
+
loading.length > 0 && sources.length === 0 && /* @__PURE__ */ jsx9("p", { role: "status", className: "text-xs text-muted-foreground", children: "Looking up where this came from\u2026" }),
|
|
3016
|
+
inputs.length > 0 && /* @__PURE__ */ jsxs7("div", { className: "border-t border-border pt-2", children: [
|
|
3017
|
+
/* @__PURE__ */ jsx9("p", { className: "text-xs font-medium uppercase tracking-[0.05em] text-muted-foreground", children: record.derivation ? `Computed from ${record.derivation}` : "Computed from" }),
|
|
3018
|
+
/* @__PURE__ */ jsx9("ul", { className: "mt-1.5 space-y-1.5", children: inputs.map((input2, index) => /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsx9(
|
|
2675
3019
|
ProvenanceValue,
|
|
2676
3020
|
{
|
|
2677
|
-
record:
|
|
3021
|
+
record: input2,
|
|
2678
3022
|
onOpenSource,
|
|
2679
3023
|
onRetrySource,
|
|
2680
3024
|
confidencePolicy,
|
|
2681
3025
|
maxDepth: maxDepth - 1,
|
|
2682
3026
|
missingValueLabel
|
|
2683
3027
|
}
|
|
2684
|
-
) }, `${
|
|
3028
|
+
) }, `${input2.label ?? input2.display}-${index}`)) })
|
|
2685
3029
|
] })
|
|
2686
3030
|
]
|
|
2687
3031
|
}
|
|
@@ -2692,26 +3036,26 @@ function ProvenanceValue({
|
|
|
2692
3036
|
}
|
|
2693
3037
|
function ProvenanceLegend({ bases, className }) {
|
|
2694
3038
|
if (bases.length === 0) return null;
|
|
2695
|
-
return /* @__PURE__ */
|
|
3039
|
+
return /* @__PURE__ */ jsx9("ul", { className: `flex flex-wrap items-center gap-x-3 gap-y-1.5 ${className ?? ""}`, children: bases.map((basis) => {
|
|
2696
3040
|
const meta = provenanceBasisMeta(basis);
|
|
2697
|
-
return /* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
3041
|
+
return /* @__PURE__ */ jsxs7("li", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
3042
|
+
/* @__PURE__ */ jsxs7(
|
|
2699
3043
|
"span",
|
|
2700
3044
|
{
|
|
2701
3045
|
className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs font-medium ${BASIS_TONES[basis]}`,
|
|
2702
3046
|
children: [
|
|
2703
|
-
/* @__PURE__ */
|
|
3047
|
+
/* @__PURE__ */ jsx9(BasisGlyph, { basis, className: "h-3 w-3" }),
|
|
2704
3048
|
meta.label
|
|
2705
3049
|
]
|
|
2706
3050
|
}
|
|
2707
3051
|
),
|
|
2708
|
-
/* @__PURE__ */
|
|
3052
|
+
/* @__PURE__ */ jsx9("span", { children: meta.meaning })
|
|
2709
3053
|
] }, basis);
|
|
2710
3054
|
}) });
|
|
2711
3055
|
}
|
|
2712
3056
|
|
|
2713
3057
|
// src/web-react/seat-paywall.tsx
|
|
2714
|
-
import { Fragment as Fragment3, jsx as
|
|
3058
|
+
import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
2715
3059
|
function usd(cents) {
|
|
2716
3060
|
return new Intl.NumberFormat("en-US", {
|
|
2717
3061
|
style: "currency",
|
|
@@ -2721,7 +3065,7 @@ function usd(cents) {
|
|
|
2721
3065
|
}).format(cents / 100);
|
|
2722
3066
|
}
|
|
2723
3067
|
function CheckGlyph3() {
|
|
2724
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsx10(
|
|
2725
3069
|
"svg",
|
|
2726
3070
|
{
|
|
2727
3071
|
className: "h-4 w-4 shrink-0 text-primary",
|
|
@@ -2732,14 +3076,14 @@ function CheckGlyph3() {
|
|
|
2732
3076
|
strokeLinecap: "round",
|
|
2733
3077
|
strokeLinejoin: "round",
|
|
2734
3078
|
"aria-hidden": true,
|
|
2735
|
-
children: /* @__PURE__ */
|
|
3079
|
+
children: /* @__PURE__ */ jsx10("path", { d: "M20 6 9 17l-5-5" })
|
|
2736
3080
|
}
|
|
2737
3081
|
);
|
|
2738
3082
|
}
|
|
2739
3083
|
function Benefit({ children }) {
|
|
2740
|
-
return /* @__PURE__ */
|
|
2741
|
-
/* @__PURE__ */
|
|
2742
|
-
/* @__PURE__ */
|
|
3084
|
+
return /* @__PURE__ */ jsxs8("li", { className: "flex items-start gap-2.5 text-sm text-foreground", children: [
|
|
3085
|
+
/* @__PURE__ */ jsx10("span", { className: "mt-0.5", children: /* @__PURE__ */ jsx10(CheckGlyph3, {}) }),
|
|
3086
|
+
/* @__PURE__ */ jsx10("span", { children })
|
|
2743
3087
|
] });
|
|
2744
3088
|
}
|
|
2745
3089
|
function SeatPaywall({
|
|
@@ -2757,45 +3101,45 @@ function SeatPaywall({
|
|
|
2757
3101
|
const recurringPrice = offer ? usd(offer.recurring.priceCents) : `$${priceUsd}`;
|
|
2758
3102
|
const recurringUsage = offer ? usd(offer.recurring.includedCreditsCents) : `$${includedUsageUsd}`;
|
|
2759
3103
|
const introductory = offer?.introductory ?? null;
|
|
2760
|
-
return /* @__PURE__ */
|
|
2761
|
-
/* @__PURE__ */
|
|
2762
|
-
/* @__PURE__ */
|
|
3104
|
+
return /* @__PURE__ */ jsx10("div", { className: "flex min-h-[60vh] w-full items-center justify-center p-6", children: /* @__PURE__ */ jsxs8("div", { className: "w-full max-w-md rounded-2xl border border-card-edge bg-card p-8", children: [
|
|
3105
|
+
/* @__PURE__ */ jsx10("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: product }),
|
|
3106
|
+
/* @__PURE__ */ jsxs8("h1", { className: "mt-2 text-2xl font-semibold tracking-tight text-foreground", children: [
|
|
2763
3107
|
"Unlock ",
|
|
2764
3108
|
product
|
|
2765
3109
|
] }),
|
|
2766
|
-
tagline && /* @__PURE__ */
|
|
2767
|
-
introductory ? /* @__PURE__ */
|
|
2768
|
-
/* @__PURE__ */
|
|
2769
|
-
/* @__PURE__ */
|
|
2770
|
-
/* @__PURE__ */
|
|
3110
|
+
tagline && /* @__PURE__ */ jsx10("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
|
|
3111
|
+
introductory ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
3112
|
+
/* @__PURE__ */ jsxs8("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3113
|
+
/* @__PURE__ */ jsx10("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
|
|
3114
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "first month" })
|
|
2771
3115
|
] }),
|
|
2772
|
-
/* @__PURE__ */
|
|
3116
|
+
/* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
2773
3117
|
"Includes ",
|
|
2774
3118
|
usd(introductory.includedCreditsCents),
|
|
2775
3119
|
" of AI usage in your first month"
|
|
2776
3120
|
] }),
|
|
2777
|
-
/* @__PURE__ */
|
|
3121
|
+
/* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
2778
3122
|
"Then ",
|
|
2779
3123
|
recurringPrice,
|
|
2780
3124
|
"/mo \xB7 includes ",
|
|
2781
3125
|
recurringUsage,
|
|
2782
3126
|
"/mo of AI usage"
|
|
2783
3127
|
] })
|
|
2784
|
-
] }) : /* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2787
|
-
/* @__PURE__ */
|
|
3128
|
+
] }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
|
|
3129
|
+
/* @__PURE__ */ jsxs8("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
|
|
3130
|
+
/* @__PURE__ */ jsx10("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
|
|
3131
|
+
/* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "/mo" })
|
|
2788
3132
|
] }),
|
|
2789
|
-
/* @__PURE__ */
|
|
3133
|
+
/* @__PURE__ */ jsxs8("p", { className: "mt-1 text-sm text-muted-foreground", children: [
|
|
2790
3134
|
"Includes ",
|
|
2791
3135
|
recurringUsage,
|
|
2792
3136
|
"/mo of AI usage"
|
|
2793
3137
|
] })
|
|
2794
3138
|
] }),
|
|
2795
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsx10("ul", { className: "mt-6 space-y-2.5", children: (benefits ?? [
|
|
2796
3140
|
`Full access to ${product}`
|
|
2797
|
-
]).map((benefit, i) => /* @__PURE__ */
|
|
2798
|
-
/* @__PURE__ */
|
|
3141
|
+
]).map((benefit, i) => /* @__PURE__ */ jsx10(Benefit, { children: benefit }, i)) }),
|
|
3142
|
+
/* @__PURE__ */ jsx10(
|
|
2799
3143
|
"button",
|
|
2800
3144
|
{
|
|
2801
3145
|
type: "button",
|
|
@@ -2805,7 +3149,7 @@ function SeatPaywall({
|
|
|
2805
3149
|
children: pending ? "Opening checkout\u2026" : ctaLabel ?? "Continue to checkout"
|
|
2806
3150
|
}
|
|
2807
3151
|
),
|
|
2808
|
-
footnote && /* @__PURE__ */
|
|
3152
|
+
footnote && /* @__PURE__ */ jsx10("p", { className: "mt-3 text-center text-xs text-muted-foreground/70", children: footnote })
|
|
2809
3153
|
] }) });
|
|
2810
3154
|
}
|
|
2811
3155
|
|
|
@@ -2814,11 +3158,11 @@ import {
|
|
|
2814
3158
|
Fragment as Fragment4,
|
|
2815
3159
|
isValidElement,
|
|
2816
3160
|
useCallback as useCallback7,
|
|
2817
|
-
useEffect as
|
|
2818
|
-
useId as
|
|
3161
|
+
useEffect as useEffect9,
|
|
3162
|
+
useId as useId3,
|
|
2819
3163
|
useMemo as useMemo5,
|
|
2820
3164
|
useRef as useRef8,
|
|
2821
|
-
useState as
|
|
3165
|
+
useState as useState13
|
|
2822
3166
|
} from "react";
|
|
2823
3167
|
|
|
2824
3168
|
// src/web-react/record-grid-model.ts
|
|
@@ -3174,7 +3518,7 @@ function pruneRecordGridOverlay(rows, overlay) {
|
|
|
3174
3518
|
}
|
|
3175
3519
|
|
|
3176
3520
|
// src/web-react/record-grid.tsx
|
|
3177
|
-
import { jsx as
|
|
3521
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
3178
3522
|
var EMPTY_RECORD_GRID_ROWS = [];
|
|
3179
3523
|
var CELL_KEY_SEPARATOR = "\0";
|
|
3180
3524
|
function cellKey(rowId, columnId) {
|
|
@@ -3233,20 +3577,20 @@ function RecordGrid({
|
|
|
3233
3577
|
loadingRowCount = 3,
|
|
3234
3578
|
className
|
|
3235
3579
|
}) {
|
|
3236
|
-
const fieldPrefix =
|
|
3237
|
-
const [overlay, setOverlay] =
|
|
3238
|
-
const [editing, setEditingState] =
|
|
3239
|
-
const [cellErrors, setCellErrors] =
|
|
3240
|
-
const [rowErrors, setRowErrors] =
|
|
3241
|
-
const [pendingRows, setPendingRows] =
|
|
3242
|
-
const [focus, setFocus] =
|
|
3243
|
-
const [openSource, setOpenSource] =
|
|
3244
|
-
const [confirmDelete, setConfirmDelete] =
|
|
3245
|
-
const [adding, setAdding] =
|
|
3246
|
-
const [draft, setDraft] =
|
|
3247
|
-
const [draftErrors, setDraftErrors] =
|
|
3248
|
-
const [draftError, setDraftError] =
|
|
3249
|
-
const [creating, setCreating] =
|
|
3580
|
+
const fieldPrefix = useId3();
|
|
3581
|
+
const [overlay, setOverlay] = useState13(EMPTY_RECORD_GRID_OVERLAY);
|
|
3582
|
+
const [editing, setEditingState] = useState13(null);
|
|
3583
|
+
const [cellErrors, setCellErrors] = useState13({});
|
|
3584
|
+
const [rowErrors, setRowErrors] = useState13({});
|
|
3585
|
+
const [pendingRows, setPendingRows] = useState13({});
|
|
3586
|
+
const [focus, setFocus] = useState13(null);
|
|
3587
|
+
const [openSource, setOpenSource] = useState13(null);
|
|
3588
|
+
const [confirmDelete, setConfirmDelete] = useState13(null);
|
|
3589
|
+
const [adding, setAdding] = useState13(false);
|
|
3590
|
+
const [draft, setDraft] = useState13({ ...newRowDefaults ?? {} });
|
|
3591
|
+
const [draftErrors, setDraftErrors] = useState13({});
|
|
3592
|
+
const [draftError, setDraftError] = useState13(null);
|
|
3593
|
+
const [creating, setCreating] = useState13(false);
|
|
3250
3594
|
const cellRefs = useRef8(/* @__PURE__ */ new Map());
|
|
3251
3595
|
const settling = useRef8(false);
|
|
3252
3596
|
const draftCounter = useRef8(0);
|
|
@@ -3256,7 +3600,7 @@ function RecordGrid({
|
|
|
3256
3600
|
setEditingState(next);
|
|
3257
3601
|
}, []);
|
|
3258
3602
|
const callerRows = state.status === "ready" || state.status === "empty" ? state.value : EMPTY_RECORD_GRID_ROWS;
|
|
3259
|
-
|
|
3603
|
+
useEffect9(() => {
|
|
3260
3604
|
setOverlay((current) => pruneRecordGridOverlay(callerRows, current));
|
|
3261
3605
|
}, [callerRows]);
|
|
3262
3606
|
const visibleRows = useMemo5(() => projectRecordGridRows(callerRows, overlay), [callerRows, overlay]);
|
|
@@ -3486,9 +3830,9 @@ function RecordGrid({
|
|
|
3486
3830
|
[beginEdit, columns, editing, focusCell, onUpdate, reviewing, visibleRows]
|
|
3487
3831
|
);
|
|
3488
3832
|
if (state.status === "idle" || state.status === "loading") {
|
|
3489
|
-
return /* @__PURE__ */
|
|
3833
|
+
return /* @__PURE__ */ jsxs9("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3490
3834
|
toolbar,
|
|
3491
|
-
/* @__PURE__ */
|
|
3835
|
+
/* @__PURE__ */ jsxs9(
|
|
3492
3836
|
"div",
|
|
3493
3837
|
{
|
|
3494
3838
|
role: "status",
|
|
@@ -3496,22 +3840,22 @@ function RecordGrid({
|
|
|
3496
3840
|
"aria-live": "polite",
|
|
3497
3841
|
className: "space-y-2 rounded-xl border border-card-edge bg-card p-4",
|
|
3498
3842
|
children: [
|
|
3499
|
-
/* @__PURE__ */
|
|
3843
|
+
/* @__PURE__ */ jsxs9("span", { className: "sr-only", children: [
|
|
3500
3844
|
"Loading ",
|
|
3501
3845
|
caption
|
|
3502
3846
|
] }),
|
|
3503
|
-
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */
|
|
3847
|
+
Array.from({ length: Math.max(1, loadingRowCount) }, (_, index) => /* @__PURE__ */ jsx11("div", { className: "h-8 animate-pulse rounded-md bg-secondary", "aria-hidden": true }, index))
|
|
3504
3848
|
]
|
|
3505
3849
|
}
|
|
3506
3850
|
)
|
|
3507
3851
|
] });
|
|
3508
3852
|
}
|
|
3509
3853
|
if (state.status === "error") {
|
|
3510
|
-
return /* @__PURE__ */
|
|
3854
|
+
return /* @__PURE__ */ jsxs9("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3511
3855
|
toolbar,
|
|
3512
|
-
/* @__PURE__ */
|
|
3513
|
-
/* @__PURE__ */
|
|
3514
|
-
/* @__PURE__ */
|
|
3856
|
+
/* @__PURE__ */ jsxs9("div", { role: "alert", className: "rounded-xl border border-destructive/40 bg-destructive/10 px-4 py-4", children: [
|
|
3857
|
+
/* @__PURE__ */ jsx11("p", { className: "text-sm font-medium text-destructive", children: state.message }),
|
|
3858
|
+
/* @__PURE__ */ jsx11(
|
|
3515
3859
|
"button",
|
|
3516
3860
|
{
|
|
3517
3861
|
type: "button",
|
|
@@ -3523,7 +3867,7 @@ function RecordGrid({
|
|
|
3523
3867
|
] })
|
|
3524
3868
|
] });
|
|
3525
3869
|
}
|
|
3526
|
-
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */
|
|
3870
|
+
const addForm = adding && onCreate && !reviewing ? /* @__PURE__ */ jsx11(
|
|
3527
3871
|
AddRecordForm,
|
|
3528
3872
|
{
|
|
3529
3873
|
columns,
|
|
@@ -3542,13 +3886,13 @@ function RecordGrid({
|
|
|
3542
3886
|
}
|
|
3543
3887
|
) : null;
|
|
3544
3888
|
if (visibleRows.length === 0 && !reviewing) {
|
|
3545
|
-
return /* @__PURE__ */
|
|
3889
|
+
return /* @__PURE__ */ jsxs9("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3546
3890
|
toolbar,
|
|
3547
|
-
addForm ?? /* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
3549
|
-
empty.description && /* @__PURE__ */
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */
|
|
3891
|
+
addForm ?? /* @__PURE__ */ jsxs9("div", { className: "rounded-xl border border-dashed border-border px-6 py-10 text-center", children: [
|
|
3892
|
+
/* @__PURE__ */ jsx11("p", { className: "text-sm font-medium text-foreground", children: empty.title }),
|
|
3893
|
+
empty.description && /* @__PURE__ */ jsx11("p", { className: "mx-auto mt-1 max-w-md text-sm text-muted-foreground", children: empty.description }),
|
|
3894
|
+
/* @__PURE__ */ jsxs9("div", { className: "mt-4 flex flex-wrap items-center justify-center gap-2", children: [
|
|
3895
|
+
empty.action && (isValidElement(empty.action) ? empty.action : /* @__PURE__ */ jsx11(
|
|
3552
3896
|
"button",
|
|
3553
3897
|
{
|
|
3554
3898
|
type: "button",
|
|
@@ -3557,7 +3901,7 @@ function RecordGrid({
|
|
|
3557
3901
|
children: empty.action.label
|
|
3558
3902
|
}
|
|
3559
3903
|
)),
|
|
3560
|
-
onCreate && /* @__PURE__ */
|
|
3904
|
+
onCreate && /* @__PURE__ */ jsx11(
|
|
3561
3905
|
"button",
|
|
3562
3906
|
{
|
|
3563
3907
|
type: "button",
|
|
@@ -3582,18 +3926,18 @@ function RecordGrid({
|
|
|
3582
3926
|
addedCount > 0 ? `${addedCount} added` : null,
|
|
3583
3927
|
removedCount > 0 ? `${removedCount} removed` : null
|
|
3584
3928
|
].filter((part) => part !== null).join(" \xB7 ");
|
|
3585
|
-
const reviewBar = reviewing ? /* @__PURE__ */
|
|
3929
|
+
const reviewBar = reviewing ? /* @__PURE__ */ jsxs9(
|
|
3586
3930
|
"div",
|
|
3587
3931
|
{
|
|
3588
3932
|
"data-record-grid-review": "",
|
|
3589
3933
|
className: "flex flex-wrap items-center justify-between gap-3 rounded-xl border border-card-edge bg-card px-4 py-2.5",
|
|
3590
3934
|
children: [
|
|
3591
|
-
/* @__PURE__ */
|
|
3592
|
-
/* @__PURE__ */
|
|
3593
|
-
/* @__PURE__ */
|
|
3935
|
+
/* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
|
|
3936
|
+
/* @__PURE__ */ jsx11("p", { className: "text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: "Proposed changes" }),
|
|
3937
|
+
/* @__PURE__ */ jsx11("p", { className: "mt-0.5 text-xs tabular-nums text-muted-foreground", children: reviewSummary })
|
|
3594
3938
|
] }),
|
|
3595
|
-
(onAcceptAll || onRejectAll) && /* @__PURE__ */
|
|
3596
|
-
onRejectAll && /* @__PURE__ */
|
|
3939
|
+
(onAcceptAll || onRejectAll) && /* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
3940
|
+
onRejectAll && /* @__PURE__ */ jsx11(
|
|
3597
3941
|
"button",
|
|
3598
3942
|
{
|
|
3599
3943
|
type: "button",
|
|
@@ -3603,7 +3947,7 @@ function RecordGrid({
|
|
|
3603
3947
|
children: "Reject all"
|
|
3604
3948
|
}
|
|
3605
3949
|
),
|
|
3606
|
-
onAcceptAll && /* @__PURE__ */
|
|
3950
|
+
onAcceptAll && /* @__PURE__ */ jsx11(
|
|
3607
3951
|
"button",
|
|
3608
3952
|
{
|
|
3609
3953
|
type: "button",
|
|
@@ -3617,10 +3961,10 @@ function RecordGrid({
|
|
|
3617
3961
|
]
|
|
3618
3962
|
}
|
|
3619
3963
|
) : null;
|
|
3620
|
-
return /* @__PURE__ */
|
|
3964
|
+
return /* @__PURE__ */ jsxs9("div", { className: `space-y-3 ${className ?? ""}`, children: [
|
|
3621
3965
|
toolbar,
|
|
3622
3966
|
reviewBar,
|
|
3623
|
-
/* @__PURE__ */
|
|
3967
|
+
/* @__PURE__ */ jsx11("div", { className: "overflow-x-auto rounded-xl border border-card-edge bg-card", children: /* @__PURE__ */ jsxs9(
|
|
3624
3968
|
"table",
|
|
3625
3969
|
{
|
|
3626
3970
|
role: "grid",
|
|
@@ -3628,8 +3972,8 @@ function RecordGrid({
|
|
|
3628
3972
|
className: "w-full border-collapse text-left text-sm",
|
|
3629
3973
|
onKeyDown: handleGridKeyDown,
|
|
3630
3974
|
children: [
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
columns.map((column) => /* @__PURE__ */
|
|
3975
|
+
/* @__PURE__ */ jsx11("thead", { children: /* @__PURE__ */ jsxs9("tr", { role: "row", className: "border-b border-border text-xs uppercase tracking-[0.05em] text-muted-foreground", children: [
|
|
3976
|
+
columns.map((column) => /* @__PURE__ */ jsx11(
|
|
3633
3977
|
"th",
|
|
3634
3978
|
{
|
|
3635
3979
|
role: "columnheader",
|
|
@@ -3639,17 +3983,17 @@ function RecordGrid({
|
|
|
3639
3983
|
},
|
|
3640
3984
|
column.id
|
|
3641
3985
|
)),
|
|
3642
|
-
showActionsColumn && /* @__PURE__ */
|
|
3986
|
+
showActionsColumn && /* @__PURE__ */ jsx11("th", { role: "columnheader", scope: "col", className: "w-px px-3 py-2 font-medium", children: /* @__PURE__ */ jsx11("span", { className: "sr-only", children: reviewing ? "Review" : "Row actions" }) })
|
|
3643
3987
|
] }) }),
|
|
3644
|
-
/* @__PURE__ */
|
|
3988
|
+
/* @__PURE__ */ jsxs9("tbody", { children: [
|
|
3645
3989
|
visibleRows.map((row) => {
|
|
3646
3990
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
3647
3991
|
const pending = row.id in pendingRows;
|
|
3648
3992
|
const rowError = rowErrors[row.id];
|
|
3649
3993
|
const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
|
|
3650
3994
|
const removedRow = rowDiff?.kind === "removed";
|
|
3651
|
-
return /* @__PURE__ */
|
|
3652
|
-
/* @__PURE__ */
|
|
3995
|
+
return /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
3996
|
+
/* @__PURE__ */ jsxs9(
|
|
3653
3997
|
"tr",
|
|
3654
3998
|
{
|
|
3655
3999
|
role: "row",
|
|
@@ -3669,8 +4013,8 @@ function RecordGrid({
|
|
|
3669
4013
|
const errorId = `${fieldPrefix}-cell-error-${row.id}-${column.id}`;
|
|
3670
4014
|
const cellDiff = rowDiff?.kind === "changed" ? diffCellByKey.get(key) : void 0;
|
|
3671
4015
|
if (isEditing && editable) {
|
|
3672
|
-
return /* @__PURE__ */
|
|
3673
|
-
/* @__PURE__ */
|
|
4016
|
+
return /* @__PURE__ */ jsxs9("td", { role: "gridcell", className: `px-3 py-1.5 ${alignmentClass(column)}`, children: [
|
|
4017
|
+
/* @__PURE__ */ jsx11(
|
|
3674
4018
|
CellEditor,
|
|
3675
4019
|
{
|
|
3676
4020
|
column,
|
|
@@ -3683,11 +4027,11 @@ function RecordGrid({
|
|
|
3683
4027
|
onCancel: () => cancelEdit(row, column)
|
|
3684
4028
|
}
|
|
3685
4029
|
),
|
|
3686
|
-
cellError !== void 0 && /* @__PURE__ */
|
|
4030
|
+
cellError !== void 0 && /* @__PURE__ */ jsx11("p", { id: errorId, role: "alert", className: "mt-1 text-xs leading-snug text-destructive", children: cellError })
|
|
3687
4031
|
] }, column.id);
|
|
3688
4032
|
}
|
|
3689
4033
|
if (column.kind === "boolean" && editable) {
|
|
3690
|
-
return /* @__PURE__ */
|
|
4034
|
+
return /* @__PURE__ */ jsx11("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsx11(
|
|
3691
4035
|
"input",
|
|
3692
4036
|
{
|
|
3693
4037
|
type: "checkbox",
|
|
@@ -3706,7 +4050,7 @@ function RecordGrid({
|
|
|
3706
4050
|
) }, column.id);
|
|
3707
4051
|
}
|
|
3708
4052
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
3709
|
-
return /* @__PURE__ */
|
|
4053
|
+
return /* @__PURE__ */ jsx11(
|
|
3710
4054
|
"td",
|
|
3711
4055
|
{
|
|
3712
4056
|
role: "gridcell",
|
|
@@ -3724,20 +4068,20 @@ function RecordGrid({
|
|
|
3724
4068
|
className: `px-3 py-2 outline-none focus:ring-2 focus:ring-inset focus:ring-primary/50 ${alignmentClass(
|
|
3725
4069
|
column
|
|
3726
4070
|
)} ${editable ? "cursor-text" : ""}`,
|
|
3727
|
-
children: /* @__PURE__ */
|
|
3728
|
-
column.id === columns[0]?.id && removedRow && /* @__PURE__ */
|
|
3729
|
-
cellDiff ? /* @__PURE__ */
|
|
3730
|
-
/* @__PURE__ */
|
|
3731
|
-
/* @__PURE__ */
|
|
3732
|
-
/* @__PURE__ */
|
|
3733
|
-
] }) : /* @__PURE__ */
|
|
4071
|
+
children: /* @__PURE__ */ jsxs9("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4072
|
+
column.id === columns[0]?.id && removedRow && /* @__PURE__ */ jsx11("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" }),
|
|
4073
|
+
cellDiff ? /* @__PURE__ */ jsxs9("span", { className: "inline-flex max-w-full flex-wrap items-baseline gap-x-1.5", children: [
|
|
4074
|
+
/* @__PURE__ */ jsx11("span", { className: "tabular-nums text-destructive line-through decoration-destructive/60", children: formatRecordGridValue(column, cellDiff.before, locale) || "\u2014" }),
|
|
4075
|
+
/* @__PURE__ */ jsx11("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "\u2192" }),
|
|
4076
|
+
/* @__PURE__ */ jsx11("span", { className: "tabular-nums font-medium text-success", children: formatRecordGridValue(column, cellDiff.after, locale) || "\u2014" })
|
|
4077
|
+
] }) : /* @__PURE__ */ jsx11(
|
|
3734
4078
|
"span",
|
|
3735
4079
|
{
|
|
3736
4080
|
className: removedRow ? "truncate text-destructive line-through decoration-destructive/60" : display === "" ? "text-muted-foreground" : "truncate text-foreground",
|
|
3737
4081
|
children: display === "" ? applicable ? "\u2014" : "n/a" : display
|
|
3738
4082
|
}
|
|
3739
4083
|
),
|
|
3740
|
-
source && /* @__PURE__ */
|
|
4084
|
+
source && /* @__PURE__ */ jsx11(
|
|
3741
4085
|
SourceMarker,
|
|
3742
4086
|
{
|
|
3743
4087
|
panelId: `${fieldPrefix}-source-${row.id}-${column.id}`,
|
|
@@ -3753,7 +4097,7 @@ function RecordGrid({
|
|
|
3753
4097
|
column.id
|
|
3754
4098
|
);
|
|
3755
4099
|
}),
|
|
3756
|
-
showActionsColumn && /* @__PURE__ */
|
|
4100
|
+
showActionsColumn && /* @__PURE__ */ jsx11("td", { role: "gridcell", className: "px-3 py-2 text-right", children: reviewing ? rowDiff && /* @__PURE__ */ jsx11(
|
|
3757
4101
|
ReviewActions,
|
|
3758
4102
|
{
|
|
3759
4103
|
rowId: row.id,
|
|
@@ -3762,8 +4106,8 @@ function RecordGrid({
|
|
|
3762
4106
|
onAccept: onAcceptRow,
|
|
3763
4107
|
onReject: onRejectRow
|
|
3764
4108
|
}
|
|
3765
|
-
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */
|
|
3766
|
-
/* @__PURE__ */
|
|
4109
|
+
) : row.readOnly === true ? null : confirmDelete === row.id ? /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4110
|
+
/* @__PURE__ */ jsx11(
|
|
3767
4111
|
"button",
|
|
3768
4112
|
{
|
|
3769
4113
|
type: "button",
|
|
@@ -3773,7 +4117,7 @@ function RecordGrid({
|
|
|
3773
4117
|
children: "Delete"
|
|
3774
4118
|
}
|
|
3775
4119
|
),
|
|
3776
|
-
/* @__PURE__ */
|
|
4120
|
+
/* @__PURE__ */ jsx11(
|
|
3777
4121
|
"button",
|
|
3778
4122
|
{
|
|
3779
4123
|
type: "button",
|
|
@@ -3783,14 +4127,14 @@ function RecordGrid({
|
|
|
3783
4127
|
children: "Cancel"
|
|
3784
4128
|
}
|
|
3785
4129
|
)
|
|
3786
|
-
] }) : /* @__PURE__ */
|
|
4130
|
+
] }) : /* @__PURE__ */ jsx11(
|
|
3787
4131
|
"button",
|
|
3788
4132
|
{
|
|
3789
4133
|
type: "button",
|
|
3790
4134
|
"aria-label": `Delete ${rowLabel}`,
|
|
3791
4135
|
onClick: () => setConfirmDelete(row.id),
|
|
3792
4136
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-destructive/10 hover:text-destructive",
|
|
3793
|
-
children: /* @__PURE__ */
|
|
4137
|
+
children: /* @__PURE__ */ jsxs9(
|
|
3794
4138
|
"svg",
|
|
3795
4139
|
{
|
|
3796
4140
|
viewBox: "0 0 24 24",
|
|
@@ -3802,8 +4146,8 @@ function RecordGrid({
|
|
|
3802
4146
|
strokeLinejoin: "round",
|
|
3803
4147
|
"aria-hidden": true,
|
|
3804
4148
|
children: [
|
|
3805
|
-
/* @__PURE__ */
|
|
3806
|
-
/* @__PURE__ */
|
|
4149
|
+
/* @__PURE__ */ jsx11("polyline", { points: "3 6 5 6 21 6" }),
|
|
4150
|
+
/* @__PURE__ */ jsx11("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" })
|
|
3807
4151
|
]
|
|
3808
4152
|
}
|
|
3809
4153
|
)
|
|
@@ -3812,12 +4156,12 @@ function RecordGrid({
|
|
|
3812
4156
|
]
|
|
3813
4157
|
}
|
|
3814
4158
|
),
|
|
3815
|
-
rowError !== void 0 && /* @__PURE__ */
|
|
4159
|
+
rowError !== void 0 && /* @__PURE__ */ jsx11("tr", { role: "row", className: "border-b border-border", children: /* @__PURE__ */ jsx11("td", { role: "gridcell", colSpan: columnSpan, className: "px-3 pb-2", children: /* @__PURE__ */ jsx11("p", { role: "alert", className: "rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs text-destructive", children: rowError }) }) })
|
|
3816
4160
|
] }, row.id);
|
|
3817
4161
|
}),
|
|
3818
4162
|
reviewing && addedRows.map((row) => {
|
|
3819
4163
|
const rowLabel = recordGridRowLabel(columns, row);
|
|
3820
|
-
return /* @__PURE__ */
|
|
4164
|
+
return /* @__PURE__ */ jsxs9(
|
|
3821
4165
|
"tr",
|
|
3822
4166
|
{
|
|
3823
4167
|
role: "row",
|
|
@@ -3828,9 +4172,9 @@ function RecordGrid({
|
|
|
3828
4172
|
const applicable = isRecordGridCellApplicable(column, row.values);
|
|
3829
4173
|
const value = row.values[column.id] ?? null;
|
|
3830
4174
|
const display = applicable ? formatRecordGridValue(column, value, locale) : "";
|
|
3831
|
-
return /* @__PURE__ */
|
|
3832
|
-
columnIndex === 0 && /* @__PURE__ */
|
|
3833
|
-
/* @__PURE__ */
|
|
4175
|
+
return /* @__PURE__ */ jsx11("td", { role: "gridcell", className: `px-3 py-2 ${alignmentClass(column)}`, children: /* @__PURE__ */ jsxs9("span", { className: "inline-flex max-w-full items-center gap-1.5", children: [
|
|
4176
|
+
columnIndex === 0 && /* @__PURE__ */ jsx11("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" }),
|
|
4177
|
+
/* @__PURE__ */ jsx11(
|
|
3834
4178
|
"span",
|
|
3835
4179
|
{
|
|
3836
4180
|
className: `tabular-nums ${display === "" ? "text-muted-foreground" : "truncate text-foreground"}`,
|
|
@@ -3839,7 +4183,7 @@ function RecordGrid({
|
|
|
3839
4183
|
)
|
|
3840
4184
|
] }) }, column.id);
|
|
3841
4185
|
}),
|
|
3842
|
-
/* @__PURE__ */
|
|
4186
|
+
/* @__PURE__ */ jsx11("td", { role: "gridcell", className: "px-3 py-2 text-right", children: /* @__PURE__ */ jsx11(
|
|
3843
4187
|
ReviewActions,
|
|
3844
4188
|
{
|
|
3845
4189
|
rowId: row.id,
|
|
@@ -3855,8 +4199,8 @@ function RecordGrid({
|
|
|
3855
4199
|
);
|
|
3856
4200
|
})
|
|
3857
4201
|
] }),
|
|
3858
|
-
hasFooter && /* @__PURE__ */
|
|
3859
|
-
columns.map((column) => /* @__PURE__ */
|
|
4202
|
+
hasFooter && /* @__PURE__ */ jsx11("tfoot", { children: /* @__PURE__ */ jsxs9("tr", { role: "row", className: "border-t-2 border-border", children: [
|
|
4203
|
+
columns.map((column) => /* @__PURE__ */ jsx11(
|
|
3860
4204
|
"td",
|
|
3861
4205
|
{
|
|
3862
4206
|
role: "gridcell",
|
|
@@ -3865,19 +4209,19 @@ function RecordGrid({
|
|
|
3865
4209
|
},
|
|
3866
4210
|
column.id
|
|
3867
4211
|
)),
|
|
3868
|
-
showActionsColumn && /* @__PURE__ */
|
|
4212
|
+
showActionsColumn && /* @__PURE__ */ jsx11("td", { role: "gridcell" })
|
|
3869
4213
|
] }) })
|
|
3870
4214
|
]
|
|
3871
4215
|
}
|
|
3872
4216
|
) }),
|
|
3873
|
-
onCreate && !reviewing && (addForm ?? /* @__PURE__ */
|
|
4217
|
+
onCreate && !reviewing && (addForm ?? /* @__PURE__ */ jsxs9(
|
|
3874
4218
|
"button",
|
|
3875
4219
|
{
|
|
3876
4220
|
type: "button",
|
|
3877
4221
|
onClick: openAdd,
|
|
3878
4222
|
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",
|
|
3879
4223
|
children: [
|
|
3880
|
-
/* @__PURE__ */
|
|
4224
|
+
/* @__PURE__ */ jsxs9(
|
|
3881
4225
|
"svg",
|
|
3882
4226
|
{
|
|
3883
4227
|
viewBox: "0 0 24 24",
|
|
@@ -3889,8 +4233,8 @@ function RecordGrid({
|
|
|
3889
4233
|
strokeLinejoin: "round",
|
|
3890
4234
|
"aria-hidden": true,
|
|
3891
4235
|
children: [
|
|
3892
|
-
/* @__PURE__ */
|
|
3893
|
-
/* @__PURE__ */
|
|
4236
|
+
/* @__PURE__ */ jsx11("line", { x1: "12", y1: "5", x2: "12", y2: "19" }),
|
|
4237
|
+
/* @__PURE__ */ jsx11("line", { x1: "5", y1: "12", x2: "19", y2: "12" })
|
|
3894
4238
|
]
|
|
3895
4239
|
}
|
|
3896
4240
|
),
|
|
@@ -3902,8 +4246,8 @@ function RecordGrid({
|
|
|
3902
4246
|
}
|
|
3903
4247
|
function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
3904
4248
|
const noun = kind === "changed" ? `proposed change to ${rowLabel}` : kind === "added" ? `new row ${rowLabel}` : `removal of ${rowLabel}`;
|
|
3905
|
-
return /* @__PURE__ */
|
|
3906
|
-
onReject && /* @__PURE__ */
|
|
4249
|
+
return /* @__PURE__ */ jsxs9("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
4250
|
+
onReject && /* @__PURE__ */ jsx11(
|
|
3907
4251
|
"button",
|
|
3908
4252
|
{
|
|
3909
4253
|
type: "button",
|
|
@@ -3913,7 +4257,7 @@ function ReviewActions({ rowId, kind, rowLabel, onAccept, onReject }) {
|
|
|
3913
4257
|
children: "Reject"
|
|
3914
4258
|
}
|
|
3915
4259
|
),
|
|
3916
|
-
onAccept && /* @__PURE__ */
|
|
4260
|
+
onAccept && /* @__PURE__ */ jsx11(
|
|
3917
4261
|
"button",
|
|
3918
4262
|
{
|
|
3919
4263
|
type: "button",
|
|
@@ -3934,7 +4278,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
3934
4278
|
className: INPUT_CLASS
|
|
3935
4279
|
};
|
|
3936
4280
|
if (column.kind === "select") {
|
|
3937
|
-
return /* @__PURE__ */
|
|
4281
|
+
return /* @__PURE__ */ jsxs9(
|
|
3938
4282
|
"select",
|
|
3939
4283
|
{
|
|
3940
4284
|
...shared,
|
|
@@ -3951,8 +4295,8 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
3951
4295
|
},
|
|
3952
4296
|
onBlur: () => onCommit(text),
|
|
3953
4297
|
children: [
|
|
3954
|
-
/* @__PURE__ */
|
|
3955
|
-
column.options.map((option) => /* @__PURE__ */
|
|
4298
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
|
|
4299
|
+
column.options.map((option) => /* @__PURE__ */ jsx11("option", { value: option.value, children: option.label }, option.value))
|
|
3956
4300
|
]
|
|
3957
4301
|
}
|
|
3958
4302
|
);
|
|
@@ -3970,7 +4314,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
3970
4314
|
}
|
|
3971
4315
|
};
|
|
3972
4316
|
if (column.kind === "text" && column.multiline === true) {
|
|
3973
|
-
return /* @__PURE__ */
|
|
4317
|
+
return /* @__PURE__ */ jsx11(
|
|
3974
4318
|
"textarea",
|
|
3975
4319
|
{
|
|
3976
4320
|
...shared,
|
|
@@ -3982,7 +4326,7 @@ function CellEditor({ column, rowLabel, text, invalid, describedBy, onText, onCo
|
|
|
3982
4326
|
}
|
|
3983
4327
|
);
|
|
3984
4328
|
}
|
|
3985
|
-
return /* @__PURE__ */
|
|
4329
|
+
return /* @__PURE__ */ jsx11(
|
|
3986
4330
|
"input",
|
|
3987
4331
|
{
|
|
3988
4332
|
...shared,
|
|
@@ -4004,8 +4348,8 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4004
4348
|
[onToggle]
|
|
4005
4349
|
);
|
|
4006
4350
|
const { containerRef, triggerRef, panelRef, triggerProps } = usePopover(open, setOpen);
|
|
4007
|
-
return /* @__PURE__ */
|
|
4008
|
-
/* @__PURE__ */
|
|
4351
|
+
return /* @__PURE__ */ jsxs9("span", { ref: containerRef, className: "relative inline-flex", children: [
|
|
4352
|
+
/* @__PURE__ */ jsx11(
|
|
4009
4353
|
"button",
|
|
4010
4354
|
{
|
|
4011
4355
|
type: "button",
|
|
@@ -4018,7 +4362,7 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4018
4362
|
onToggle();
|
|
4019
4363
|
},
|
|
4020
4364
|
className: `inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${BASIS_TONES2[basis]}`,
|
|
4021
|
-
children: /* @__PURE__ */
|
|
4365
|
+
children: /* @__PURE__ */ jsx11(
|
|
4022
4366
|
"svg",
|
|
4023
4367
|
{
|
|
4024
4368
|
viewBox: "0 0 24 24",
|
|
@@ -4028,12 +4372,12 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4028
4372
|
strokeWidth: "2.5",
|
|
4029
4373
|
strokeLinecap: "round",
|
|
4030
4374
|
"aria-hidden": true,
|
|
4031
|
-
children: /* @__PURE__ */
|
|
4375
|
+
children: /* @__PURE__ */ jsx11("path", { d: "M9 8h6M9 12h6M9 16h3" })
|
|
4032
4376
|
}
|
|
4033
4377
|
)
|
|
4034
4378
|
}
|
|
4035
4379
|
),
|
|
4036
|
-
/* @__PURE__ */
|
|
4380
|
+
/* @__PURE__ */ jsxs9(
|
|
4037
4381
|
PopoverSurface,
|
|
4038
4382
|
{
|
|
4039
4383
|
open,
|
|
@@ -4043,17 +4387,17 @@ function SourceMarker({ panelId, columnHeader, rowLabel, source, open, onToggle
|
|
|
4043
4387
|
panelRef,
|
|
4044
4388
|
className: `w-64 rounded-lg border border-card-edge bg-popover p-3 text-left ${OVERLAY_SHADOW}`,
|
|
4045
4389
|
children: [
|
|
4046
|
-
source.quote && /* @__PURE__ */
|
|
4390
|
+
source.quote && /* @__PURE__ */ jsxs9("span", { className: "block border-l-2 border-primary/50 pl-2 text-xs italic leading-snug text-foreground", children: [
|
|
4047
4391
|
"\u201C",
|
|
4048
4392
|
source.quote,
|
|
4049
4393
|
"\u201D"
|
|
4050
4394
|
] }),
|
|
4051
|
-
/* @__PURE__ */
|
|
4395
|
+
/* @__PURE__ */ jsxs9("span", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
4052
4396
|
source.label ?? "Source",
|
|
4053
4397
|
source.locator ? ` \xB7 ${source.locator}` : "",
|
|
4054
4398
|
` \xB7 ${BASIS_TITLES[basis]}`
|
|
4055
4399
|
] }),
|
|
4056
|
-
source.href && /* @__PURE__ */
|
|
4400
|
+
source.href && /* @__PURE__ */ jsx11(
|
|
4057
4401
|
"a",
|
|
4058
4402
|
{
|
|
4059
4403
|
href: source.href,
|
|
@@ -4082,7 +4426,7 @@ function AddRecordForm({
|
|
|
4082
4426
|
onCancel
|
|
4083
4427
|
}) {
|
|
4084
4428
|
const groups = useMemo5(() => groupColumns(columns), [columns]);
|
|
4085
|
-
return /* @__PURE__ */
|
|
4429
|
+
return /* @__PURE__ */ jsxs9(
|
|
4086
4430
|
"form",
|
|
4087
4431
|
{
|
|
4088
4432
|
noValidate: true,
|
|
@@ -4093,31 +4437,31 @@ function AddRecordForm({
|
|
|
4093
4437
|
},
|
|
4094
4438
|
className: "space-y-4 rounded-xl border border-card-edge bg-card p-4",
|
|
4095
4439
|
children: [
|
|
4096
|
-
/* @__PURE__ */
|
|
4097
|
-
formError !== null && /* @__PURE__ */
|
|
4440
|
+
/* @__PURE__ */ jsx11("h3", { className: "text-sm font-semibold text-foreground", children: label }),
|
|
4441
|
+
formError !== null && /* @__PURE__ */ jsx11("p", { role: "alert", className: "rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive", children: formError }),
|
|
4098
4442
|
groups.map((group) => {
|
|
4099
4443
|
const fields = group.columns.filter((column) => isRecordGridCellApplicable(column, draft));
|
|
4100
4444
|
if (fields.length === 0) return null;
|
|
4101
|
-
return /* @__PURE__ */
|
|
4445
|
+
return /* @__PURE__ */ jsxs9(
|
|
4102
4446
|
"fieldset",
|
|
4103
4447
|
{
|
|
4104
4448
|
className: group.label === null ? "min-w-0" : "min-w-0 rounded-lg border border-card-edge p-3",
|
|
4105
4449
|
children: [
|
|
4106
|
-
group.label !== null && /* @__PURE__ */
|
|
4107
|
-
/* @__PURE__ */
|
|
4450
|
+
group.label !== null && /* @__PURE__ */ jsx11("legend", { className: "px-1 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
4451
|
+
/* @__PURE__ */ jsx11("div", { className: "grid gap-3 sm:grid-cols-2", children: fields.map((column) => {
|
|
4108
4452
|
const fieldId = `${fieldPrefix}-${column.id}`;
|
|
4109
4453
|
const errorId = `${fieldId}-error`;
|
|
4110
4454
|
const message = errors[column.id];
|
|
4111
|
-
return /* @__PURE__ */
|
|
4455
|
+
return /* @__PURE__ */ jsxs9(
|
|
4112
4456
|
"div",
|
|
4113
4457
|
{
|
|
4114
4458
|
className: column.kind === "text" && column.multiline === true ? "sm:col-span-2" : "",
|
|
4115
4459
|
children: [
|
|
4116
|
-
/* @__PURE__ */
|
|
4460
|
+
/* @__PURE__ */ jsxs9("label", { htmlFor: fieldId, className: "mb-1 block text-xs font-medium text-muted-foreground", children: [
|
|
4117
4461
|
column.header,
|
|
4118
|
-
column.required === true && /* @__PURE__ */
|
|
4462
|
+
column.required === true && /* @__PURE__ */ jsx11("span", { className: "ml-0.5 text-destructive", children: "*" })
|
|
4119
4463
|
] }),
|
|
4120
|
-
/* @__PURE__ */
|
|
4464
|
+
/* @__PURE__ */ jsx11(
|
|
4121
4465
|
DraftField,
|
|
4122
4466
|
{
|
|
4123
4467
|
column,
|
|
@@ -4128,8 +4472,8 @@ function AddRecordForm({
|
|
|
4128
4472
|
onValue: (next) => setDraft({ ...draft, [column.id]: next })
|
|
4129
4473
|
}
|
|
4130
4474
|
),
|
|
4131
|
-
column.hint && /* @__PURE__ */
|
|
4132
|
-
message !== void 0 && /* @__PURE__ */
|
|
4475
|
+
column.hint && /* @__PURE__ */ jsx11("p", { className: "mt-1 text-xs text-muted-foreground", children: column.hint }),
|
|
4476
|
+
message !== void 0 && /* @__PURE__ */ jsx11("p", { id: errorId, role: "alert", className: "mt-1 text-xs text-destructive", children: message })
|
|
4133
4477
|
]
|
|
4134
4478
|
},
|
|
4135
4479
|
column.id
|
|
@@ -4140,8 +4484,8 @@ function AddRecordForm({
|
|
|
4140
4484
|
group.label ?? "_"
|
|
4141
4485
|
);
|
|
4142
4486
|
}),
|
|
4143
|
-
/* @__PURE__ */
|
|
4144
|
-
/* @__PURE__ */
|
|
4487
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
4488
|
+
/* @__PURE__ */ jsx11(
|
|
4145
4489
|
"button",
|
|
4146
4490
|
{
|
|
4147
4491
|
type: "submit",
|
|
@@ -4150,7 +4494,7 @@ function AddRecordForm({
|
|
|
4150
4494
|
children: busy ? "Saving\u2026" : "Save"
|
|
4151
4495
|
}
|
|
4152
4496
|
),
|
|
4153
|
-
/* @__PURE__ */
|
|
4497
|
+
/* @__PURE__ */ jsx11(
|
|
4154
4498
|
"button",
|
|
4155
4499
|
{
|
|
4156
4500
|
type: "button",
|
|
@@ -4171,7 +4515,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4171
4515
|
"aria-describedby": describedBy
|
|
4172
4516
|
};
|
|
4173
4517
|
if (column.kind === "boolean") {
|
|
4174
|
-
return /* @__PURE__ */
|
|
4518
|
+
return /* @__PURE__ */ jsx11(
|
|
4175
4519
|
"input",
|
|
4176
4520
|
{
|
|
4177
4521
|
...shared,
|
|
@@ -4183,7 +4527,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4183
4527
|
);
|
|
4184
4528
|
}
|
|
4185
4529
|
if (column.kind === "select") {
|
|
4186
|
-
return /* @__PURE__ */
|
|
4530
|
+
return /* @__PURE__ */ jsxs9(
|
|
4187
4531
|
"select",
|
|
4188
4532
|
{
|
|
4189
4533
|
...shared,
|
|
@@ -4191,14 +4535,14 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4191
4535
|
value: typeof value === "string" ? value : "",
|
|
4192
4536
|
onChange: (event) => onValue(event.target.value === "" ? null : event.target.value),
|
|
4193
4537
|
children: [
|
|
4194
|
-
/* @__PURE__ */
|
|
4195
|
-
column.options.map((option) => /* @__PURE__ */
|
|
4538
|
+
/* @__PURE__ */ jsx11("option", { value: "", children: "\u2014" }),
|
|
4539
|
+
column.options.map((option) => /* @__PURE__ */ jsx11("option", { value: option.value, children: option.label }, option.value))
|
|
4196
4540
|
]
|
|
4197
4541
|
}
|
|
4198
4542
|
);
|
|
4199
4543
|
}
|
|
4200
4544
|
if (column.kind === "text" && column.multiline === true) {
|
|
4201
|
-
return /* @__PURE__ */
|
|
4545
|
+
return /* @__PURE__ */ jsx11(
|
|
4202
4546
|
"textarea",
|
|
4203
4547
|
{
|
|
4204
4548
|
...shared,
|
|
@@ -4210,7 +4554,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4210
4554
|
);
|
|
4211
4555
|
}
|
|
4212
4556
|
if (column.kind === "number" || column.kind === "currency") {
|
|
4213
|
-
return /* @__PURE__ */
|
|
4557
|
+
return /* @__PURE__ */ jsx11(
|
|
4214
4558
|
"input",
|
|
4215
4559
|
{
|
|
4216
4560
|
...shared,
|
|
@@ -4230,7 +4574,7 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4230
4574
|
}
|
|
4231
4575
|
);
|
|
4232
4576
|
}
|
|
4233
|
-
return /* @__PURE__ */
|
|
4577
|
+
return /* @__PURE__ */ jsx11(
|
|
4234
4578
|
"input",
|
|
4235
4579
|
{
|
|
4236
4580
|
...shared,
|
|
@@ -4245,18 +4589,18 @@ function DraftField({ column, id, value, invalid, describedBy, onValue }) {
|
|
|
4245
4589
|
// src/web-react/command-palette.tsx
|
|
4246
4590
|
import {
|
|
4247
4591
|
useCallback as useCallback8,
|
|
4248
|
-
useEffect as
|
|
4249
|
-
useId as
|
|
4592
|
+
useEffect as useEffect10,
|
|
4593
|
+
useId as useId4,
|
|
4250
4594
|
useMemo as useMemo6,
|
|
4251
4595
|
useRef as useRef9,
|
|
4252
|
-
useState as
|
|
4596
|
+
useState as useState14
|
|
4253
4597
|
} from "react";
|
|
4254
4598
|
import { createPortal } from "react-dom";
|
|
4255
|
-
import { Fragment as Fragment5, jsx as
|
|
4599
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4256
4600
|
function SearchGlyph({ className }) {
|
|
4257
|
-
return /* @__PURE__ */
|
|
4258
|
-
/* @__PURE__ */
|
|
4259
|
-
/* @__PURE__ */
|
|
4601
|
+
return /* @__PURE__ */ jsxs10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
4602
|
+
/* @__PURE__ */ jsx12("circle", { cx: "11", cy: "11", r: "8" }),
|
|
4603
|
+
/* @__PURE__ */ jsx12("path", { d: "m21 21-4.3-4.3" })
|
|
4260
4604
|
] });
|
|
4261
4605
|
}
|
|
4262
4606
|
function CommandPalette({
|
|
@@ -4271,7 +4615,7 @@ function CommandPalette({
|
|
|
4271
4615
|
emptyMessage,
|
|
4272
4616
|
label = "Command palette"
|
|
4273
4617
|
}) {
|
|
4274
|
-
const [internalOpen, setInternalOpen] =
|
|
4618
|
+
const [internalOpen, setInternalOpen] = useState14(false);
|
|
4275
4619
|
const open = controlledOpen ?? internalOpen;
|
|
4276
4620
|
const setOpen = useCallback8(
|
|
4277
4621
|
(next) => {
|
|
@@ -4280,16 +4624,16 @@ function CommandPalette({
|
|
|
4280
4624
|
},
|
|
4281
4625
|
[controlledOpen, onOpenChange]
|
|
4282
4626
|
);
|
|
4283
|
-
const [query, setQuery] =
|
|
4284
|
-
const [active, setActive] =
|
|
4627
|
+
const [query, setQuery] = useState14(initialQuery ?? "");
|
|
4628
|
+
const [active, setActive] = useState14(0);
|
|
4285
4629
|
const inputRef = useRef9(null);
|
|
4286
|
-
const surfaceId =
|
|
4630
|
+
const surfaceId = useId4();
|
|
4287
4631
|
const listId = `${surfaceId}-list`;
|
|
4288
4632
|
const flat = useMemo6(() => filterCommandPaletteItems(items, query), [items, query]);
|
|
4289
4633
|
const sections = useMemo6(() => groupCommandPaletteItems(flat), [flat]);
|
|
4290
4634
|
const activeIndex = flat.length === 0 ? 0 : Math.min(active, flat.length - 1);
|
|
4291
4635
|
const activeId = flat.length > 0 ? `${listId}-${activeIndex}` : void 0;
|
|
4292
|
-
|
|
4636
|
+
useEffect10(() => {
|
|
4293
4637
|
if (!hotkey) return;
|
|
4294
4638
|
function onKeyDown(e) {
|
|
4295
4639
|
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") {
|
|
@@ -4301,7 +4645,7 @@ function CommandPalette({
|
|
|
4301
4645
|
return () => document.removeEventListener("keydown", onKeyDown);
|
|
4302
4646
|
}, [hotkey, open, setOpen]);
|
|
4303
4647
|
const restoreFocusRef = useRef9(null);
|
|
4304
|
-
|
|
4648
|
+
useEffect10(() => {
|
|
4305
4649
|
if (open) {
|
|
4306
4650
|
restoreFocusRef.current = document.activeElement;
|
|
4307
4651
|
inputRef.current?.focus();
|
|
@@ -4313,7 +4657,7 @@ function CommandPalette({
|
|
|
4313
4657
|
restoreFocusRef.current = null;
|
|
4314
4658
|
if (restore instanceof HTMLElement) restore.focus();
|
|
4315
4659
|
}, [open]);
|
|
4316
|
-
|
|
4660
|
+
useEffect10(() => {
|
|
4317
4661
|
if (!open || !activeId) return;
|
|
4318
4662
|
document.getElementById(activeId)?.scrollIntoView?.({ block: "nearest" });
|
|
4319
4663
|
}, [open, activeId]);
|
|
@@ -4343,8 +4687,8 @@ function CommandPalette({
|
|
|
4343
4687
|
if (!open || typeof document === "undefined") return null;
|
|
4344
4688
|
let rowIndex = -1;
|
|
4345
4689
|
return createPortal(
|
|
4346
|
-
/* @__PURE__ */
|
|
4347
|
-
/* @__PURE__ */
|
|
4690
|
+
/* @__PURE__ */ jsxs10(Fragment5, { children: [
|
|
4691
|
+
/* @__PURE__ */ jsx12(
|
|
4348
4692
|
"div",
|
|
4349
4693
|
{
|
|
4350
4694
|
"aria-hidden": true,
|
|
@@ -4353,7 +4697,7 @@ function CommandPalette({
|
|
|
4353
4697
|
className: "fixed inset-0 z-[999] bg-background/80"
|
|
4354
4698
|
}
|
|
4355
4699
|
),
|
|
4356
|
-
/* @__PURE__ */
|
|
4700
|
+
/* @__PURE__ */ jsx12("div", { className: "pointer-events-none fixed inset-x-0 top-[15%] z-[1000] flex justify-center px-4", children: /* @__PURE__ */ jsxs10(
|
|
4357
4701
|
"div",
|
|
4358
4702
|
{
|
|
4359
4703
|
role: "dialog",
|
|
@@ -4362,9 +4706,9 @@ function CommandPalette({
|
|
|
4362
4706
|
...{ [POPOVER_SURFACE_ATTR]: surfaceId },
|
|
4363
4707
|
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}`,
|
|
4364
4708
|
children: [
|
|
4365
|
-
/* @__PURE__ */
|
|
4366
|
-
/* @__PURE__ */
|
|
4367
|
-
/* @__PURE__ */
|
|
4709
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center gap-2 border-b border-border px-3 py-2.5", children: [
|
|
4710
|
+
/* @__PURE__ */ jsx12(SearchGlyph, { className: "h-4 w-4 shrink-0 text-muted-foreground" }),
|
|
4711
|
+
/* @__PURE__ */ jsx12(
|
|
4368
4712
|
"input",
|
|
4369
4713
|
{
|
|
4370
4714
|
ref: inputRef,
|
|
@@ -4385,15 +4729,15 @@ function CommandPalette({
|
|
|
4385
4729
|
}
|
|
4386
4730
|
)
|
|
4387
4731
|
] }),
|
|
4388
|
-
/* @__PURE__ */
|
|
4389
|
-
loading && /* @__PURE__ */
|
|
4390
|
-
!loading && flat.length === 0 && /* @__PURE__ */
|
|
4391
|
-
!loading && sections.map((section) => /* @__PURE__ */
|
|
4392
|
-
/* @__PURE__ */
|
|
4732
|
+
/* @__PURE__ */ jsxs10("div", { role: "listbox", id: listId, className: "min-h-0 flex-1 overflow-y-auto p-1 pb-2", children: [
|
|
4733
|
+
loading && /* @__PURE__ */ jsx12("div", { className: "px-3 py-4 text-center text-sm text-muted-foreground", children: "Loading\u2026" }),
|
|
4734
|
+
!loading && flat.length === 0 && /* @__PURE__ */ jsx12("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") }),
|
|
4735
|
+
!loading && sections.map((section) => /* @__PURE__ */ jsxs10("div", { children: [
|
|
4736
|
+
/* @__PURE__ */ jsx12("div", { className: "px-3 pb-1 pt-3 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.group }),
|
|
4393
4737
|
section.items.map((item) => {
|
|
4394
4738
|
rowIndex += 1;
|
|
4395
4739
|
const index = rowIndex;
|
|
4396
|
-
return /* @__PURE__ */
|
|
4740
|
+
return /* @__PURE__ */ jsxs10(
|
|
4397
4741
|
"div",
|
|
4398
4742
|
{
|
|
4399
4743
|
id: `${listId}-${index}`,
|
|
@@ -4403,9 +4747,9 @@ function CommandPalette({
|
|
|
4403
4747
|
onClick: () => choose(item),
|
|
4404
4748
|
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" : ""}`,
|
|
4405
4749
|
children: [
|
|
4406
|
-
/* @__PURE__ */
|
|
4407
|
-
item.description && /* @__PURE__ */
|
|
4408
|
-
item.hint && /* @__PURE__ */
|
|
4750
|
+
/* @__PURE__ */ jsx12("span", { className: "truncate text-foreground", children: item.label }),
|
|
4751
|
+
item.description && /* @__PURE__ */ jsx12("span", { className: "truncate text-xs text-muted-foreground", children: item.description }),
|
|
4752
|
+
item.hint && /* @__PURE__ */ jsx12("span", { className: "ml-auto shrink-0 text-xs tabular-nums text-muted-foreground", children: item.hint })
|
|
4409
4753
|
]
|
|
4410
4754
|
},
|
|
4411
4755
|
item.id
|
|
@@ -4413,15 +4757,15 @@ function CommandPalette({
|
|
|
4413
4757
|
})
|
|
4414
4758
|
] }, section.group))
|
|
4415
4759
|
] }),
|
|
4416
|
-
/* @__PURE__ */
|
|
4417
|
-
/* @__PURE__ */
|
|
4418
|
-
/* @__PURE__ */
|
|
4419
|
-
/* @__PURE__ */
|
|
4420
|
-
/* @__PURE__ */
|
|
4421
|
-
/* @__PURE__ */
|
|
4422
|
-
/* @__PURE__ */
|
|
4423
|
-
/* @__PURE__ */
|
|
4424
|
-
/* @__PURE__ */
|
|
4760
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex shrink-0 items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground", children: [
|
|
4761
|
+
/* @__PURE__ */ jsx12("span", { className: "tabular-nums", children: query.trim() ? `${flat.length} of ${items.length}` : `${items.length} items` }),
|
|
4762
|
+
/* @__PURE__ */ jsxs10("span", { className: "flex items-center gap-1.5", children: [
|
|
4763
|
+
/* @__PURE__ */ jsx12("kbd", { className: "rounded border border-border bg-background px-1 py-0.5", children: "\u2191\u2193" }),
|
|
4764
|
+
/* @__PURE__ */ jsx12("span", { children: "navigate" }),
|
|
4765
|
+
/* @__PURE__ */ jsx12("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "\u21B5" }),
|
|
4766
|
+
/* @__PURE__ */ jsx12("span", { children: "select" }),
|
|
4767
|
+
/* @__PURE__ */ jsx12("kbd", { className: "ml-1.5 rounded border border-border bg-background px-1 py-0.5", children: "esc" }),
|
|
4768
|
+
/* @__PURE__ */ jsx12("span", { children: "close" })
|
|
4425
4769
|
] })
|
|
4426
4770
|
] })
|
|
4427
4771
|
]
|
|
@@ -4433,7 +4777,7 @@ function CommandPalette({
|
|
|
4433
4777
|
}
|
|
4434
4778
|
|
|
4435
4779
|
// src/web-react/sparkline.tsx
|
|
4436
|
-
import { jsx as
|
|
4780
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4437
4781
|
var DEFAULT_SPARKLINE_WIDTH = 96;
|
|
4438
4782
|
var DEFAULT_SPARKLINE_HEIGHT = 24;
|
|
4439
4783
|
var DEFAULT_INSET = 2.5;
|
|
@@ -4539,21 +4883,21 @@ function Sparkline({
|
|
|
4539
4883
|
const geometry = sparklineGeometry(values, { width, height });
|
|
4540
4884
|
const accessibleName = sparklineLabel(values, { label, format });
|
|
4541
4885
|
if (geometry.points.length === 0) {
|
|
4542
|
-
return /* @__PURE__ */
|
|
4886
|
+
return /* @__PURE__ */ jsxs11(
|
|
4543
4887
|
"span",
|
|
4544
4888
|
{
|
|
4545
4889
|
"data-sparkline": geometry.gaps > 0 ? "unavailable" : "empty",
|
|
4546
4890
|
className: joinClasses("text-[11px] text-muted-foreground", className),
|
|
4547
4891
|
children: [
|
|
4548
|
-
/* @__PURE__ */
|
|
4549
|
-
/* @__PURE__ */
|
|
4892
|
+
/* @__PURE__ */ jsx13("span", { className: "sr-only", children: accessibleName }),
|
|
4893
|
+
/* @__PURE__ */ jsx13("span", { "aria-hidden": "true", children: geometry.gaps > 0 ? unavailableLabel : emptyLabel })
|
|
4550
4894
|
]
|
|
4551
4895
|
}
|
|
4552
4896
|
);
|
|
4553
4897
|
}
|
|
4554
4898
|
const drawsLine = geometry.segments.some((segment) => segment.length > 1);
|
|
4555
4899
|
const end = geometry.points[geometry.points.length - 1];
|
|
4556
|
-
return /* @__PURE__ */
|
|
4900
|
+
return /* @__PURE__ */ jsxs11(
|
|
4557
4901
|
"svg",
|
|
4558
4902
|
{
|
|
4559
4903
|
role: "img",
|
|
@@ -4570,7 +4914,7 @@ function Sparkline({
|
|
|
4570
4914
|
geometry.segments.map((segment, index) => {
|
|
4571
4915
|
const key = `segment-${index}`;
|
|
4572
4916
|
if (segment.length > 1) {
|
|
4573
|
-
return /* @__PURE__ */
|
|
4917
|
+
return /* @__PURE__ */ jsx13(
|
|
4574
4918
|
"polyline",
|
|
4575
4919
|
{
|
|
4576
4920
|
points: sparklinePointsAttribute(segment),
|
|
@@ -4586,9 +4930,9 @@ function Sparkline({
|
|
|
4586
4930
|
}
|
|
4587
4931
|
const only = segment[0];
|
|
4588
4932
|
if (only.x === end.x && only.y === end.y) return null;
|
|
4589
|
-
return /* @__PURE__ */
|
|
4933
|
+
return /* @__PURE__ */ jsx13("circle", { cx: only.x, cy: only.y, r: DOT_RADIUS, fill: "currentColor" }, key);
|
|
4590
4934
|
}),
|
|
4591
|
-
/* @__PURE__ */
|
|
4935
|
+
/* @__PURE__ */ jsx13("circle", { cx: end.x, cy: end.y, r: DOT_RADIUS, fill: "currentColor" })
|
|
4592
4936
|
]
|
|
4593
4937
|
}
|
|
4594
4938
|
);
|
|
@@ -4598,11 +4942,11 @@ function Sparkline({
|
|
|
4598
4942
|
import {
|
|
4599
4943
|
isValidElement as isValidElement2,
|
|
4600
4944
|
useCallback as useCallback9,
|
|
4601
|
-
useEffect as
|
|
4945
|
+
useEffect as useEffect11,
|
|
4602
4946
|
useRef as useRef10,
|
|
4603
|
-
useState as
|
|
4947
|
+
useState as useState15
|
|
4604
4948
|
} from "react";
|
|
4605
|
-
import { Fragment as Fragment6, jsx as
|
|
4949
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4606
4950
|
function insightDelta(value, previous) {
|
|
4607
4951
|
if (typeof value !== "number" || !Number.isFinite(value)) return null;
|
|
4608
4952
|
if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
|
|
@@ -4655,7 +4999,7 @@ function InsightCard({
|
|
|
4655
4999
|
const tone = delta ? insightDeltaTone(delta.direction, polarity) : "neutral";
|
|
4656
5000
|
const unavailable = typeof value === "number" && !Number.isFinite(value);
|
|
4657
5001
|
const shown = typeof value === "number" ? format(value) : value;
|
|
4658
|
-
return /* @__PURE__ */
|
|
5002
|
+
return /* @__PURE__ */ jsxs12(
|
|
4659
5003
|
"article",
|
|
4660
5004
|
{
|
|
4661
5005
|
"data-insight-card": "",
|
|
@@ -4663,40 +5007,40 @@ function InsightCard({
|
|
|
4663
5007
|
className: joinClasses("agent-arrive flex h-full flex-col rounded-xl border border-card-edge bg-card p-4", className),
|
|
4664
5008
|
style,
|
|
4665
5009
|
children: [
|
|
4666
|
-
eyebrow ? /* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
5010
|
+
eyebrow ? /* @__PURE__ */ jsx14("p", { "data-insight-eyebrow": "", className: "mb-0.5 text-[11px] font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: eyebrow }) : null,
|
|
5011
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-baseline justify-between gap-2", children: [
|
|
5012
|
+
/* @__PURE__ */ jsx14("h3", { className: "text-[13px] font-medium text-muted-foreground", children: title }),
|
|
4669
5013
|
live ? (
|
|
4670
5014
|
// No `data-motion` opt-out: the word is the signal and the sweep is
|
|
4671
5015
|
// emphasis, so the reduced-motion floor reaches this like everything
|
|
4672
5016
|
// else and leaves a static, legible label.
|
|
4673
|
-
/* @__PURE__ */
|
|
5017
|
+
/* @__PURE__ */ jsx14("span", { className: "agent-shimmer shrink-0 text-[11px] font-medium", "data-insight-live": "", children: liveLabel })
|
|
4674
5018
|
) : null
|
|
4675
5019
|
] }),
|
|
4676
|
-
/* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
] }) : /* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
4681
|
-
unit ? /* @__PURE__ */
|
|
5020
|
+
/* @__PURE__ */ jsx14("p", { className: "mt-1 flex items-baseline gap-1", children: unavailable ? /* @__PURE__ */ jsxs12("span", { "data-insight-value": "unavailable", className: "text-xl font-semibold text-muted-foreground", children: [
|
|
5021
|
+
/* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
|
|
5022
|
+
/* @__PURE__ */ jsx14("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
|
|
5023
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
5024
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
|
|
5025
|
+
unit ? /* @__PURE__ */ jsx14("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
|
|
4682
5026
|
] }) }),
|
|
4683
|
-
delta ? /* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
5027
|
+
delta ? /* @__PURE__ */ jsxs12("p", { "data-insight-delta": delta.direction, className: `mt-0.5 text-[11px] font-medium ${TONE_CLASS[tone]}`, children: [
|
|
5028
|
+
/* @__PURE__ */ jsxs12("span", { "aria-hidden": "true", children: [
|
|
4685
5029
|
DIRECTION_GLYPH[delta.direction],
|
|
4686
5030
|
" "
|
|
4687
5031
|
] }),
|
|
4688
5032
|
formatInsightDelta(delta, format)
|
|
4689
5033
|
] }) : null,
|
|
4690
|
-
description ? /* @__PURE__ */
|
|
4691
|
-
series ? /* @__PURE__ */
|
|
4692
|
-
action ? /* @__PURE__ */
|
|
5034
|
+
description ? /* @__PURE__ */ jsx14("p", { className: "mt-1 text-[11px] text-muted-foreground", children: description }) : null,
|
|
5035
|
+
series ? /* @__PURE__ */ jsx14("div", { className: "mt-2 text-muted-foreground", children: /* @__PURE__ */ jsx14(Sparkline, { values: series, label: seriesLabel ?? title, format }) }) : null,
|
|
5036
|
+
action ? /* @__PURE__ */ jsx14("div", { className: "mt-3", children: renderInsightAction(action) }) : null
|
|
4693
5037
|
]
|
|
4694
5038
|
}
|
|
4695
5039
|
);
|
|
4696
5040
|
}
|
|
4697
5041
|
function renderInsightAction(action) {
|
|
4698
5042
|
if (isValidElement2(action)) return action;
|
|
4699
|
-
return /* @__PURE__ */
|
|
5043
|
+
return /* @__PURE__ */ jsx14(
|
|
4700
5044
|
"button",
|
|
4701
5045
|
{
|
|
4702
5046
|
type: "button",
|
|
@@ -4765,8 +5109,8 @@ function InsightDeck({
|
|
|
4765
5109
|
className,
|
|
4766
5110
|
onPageChange
|
|
4767
5111
|
}) {
|
|
4768
|
-
const [page, setPage] =
|
|
4769
|
-
const [held, setHeld] =
|
|
5112
|
+
const [page, setPage] = useState15(0);
|
|
5113
|
+
const [held, setHeld] = useState15(null);
|
|
4770
5114
|
const answered = state.status === "error" || state.status === "empty";
|
|
4771
5115
|
const carried = state.status === "ready" ? state.value : answered ? null : held;
|
|
4772
5116
|
if (carried !== held) setHeld(carried);
|
|
@@ -4781,7 +5125,7 @@ function InsightDeck({
|
|
|
4781
5125
|
},
|
|
4782
5126
|
[onPageChange]
|
|
4783
5127
|
);
|
|
4784
|
-
return /* @__PURE__ */
|
|
5128
|
+
return /* @__PURE__ */ jsx14(
|
|
4785
5129
|
AsyncView,
|
|
4786
5130
|
{
|
|
4787
5131
|
state: shown,
|
|
@@ -4789,7 +5133,7 @@ function InsightDeck({
|
|
|
4789
5133
|
loadingLabel,
|
|
4790
5134
|
retryLabel,
|
|
4791
5135
|
className,
|
|
4792
|
-
children: (insights) => /* @__PURE__ */
|
|
5136
|
+
children: (insights) => /* @__PURE__ */ jsx14(
|
|
4793
5137
|
InsightPages,
|
|
4794
5138
|
{
|
|
4795
5139
|
insights,
|
|
@@ -4859,10 +5203,10 @@ function InsightPages({
|
|
|
4859
5203
|
const sectionRef = useRef10(null);
|
|
4860
5204
|
const listRef = useRef10(null);
|
|
4861
5205
|
const recoverFocus = useRef10(false);
|
|
4862
|
-
|
|
5206
|
+
useEffect11(() => {
|
|
4863
5207
|
onPageSettled(current);
|
|
4864
5208
|
}, [current, onPageSettled]);
|
|
4865
|
-
|
|
5209
|
+
useEffect11(() => {
|
|
4866
5210
|
if (!recoverFocus.current) return;
|
|
4867
5211
|
recoverFocus.current = false;
|
|
4868
5212
|
sectionRef.current?.focus();
|
|
@@ -4902,7 +5246,7 @@ function InsightPages({
|
|
|
4902
5246
|
}
|
|
4903
5247
|
if (moved) event.preventDefault();
|
|
4904
5248
|
};
|
|
4905
|
-
return /* @__PURE__ */
|
|
5249
|
+
return /* @__PURE__ */ jsxs12(
|
|
4906
5250
|
"section",
|
|
4907
5251
|
{
|
|
4908
5252
|
ref: sectionRef,
|
|
@@ -4914,7 +5258,7 @@ function InsightPages({
|
|
|
4914
5258
|
tabIndex: pageCount > 1 ? 0 : void 0,
|
|
4915
5259
|
"aria-keyshortcuts": pageCount > 1 ? "ArrowLeft ArrowRight PageUp PageDown Home End" : void 0,
|
|
4916
5260
|
children: [
|
|
4917
|
-
/* @__PURE__ */
|
|
5261
|
+
/* @__PURE__ */ jsx14("ul", { ref: listRef, className: "grid gap-3 sm:grid-cols-2 lg:grid-cols-3", children: visible.map(({ id, style, ...card }, index) => (
|
|
4918
5262
|
// The page index is in the key on purpose: a page turn is an arrival,
|
|
4919
5263
|
// and reusing the node would swap the text under a card that never
|
|
4920
5264
|
// moved. Remounting replays `.agent-arrive` with the new stagger.
|
|
@@ -4925,10 +5269,10 @@ function InsightPages({
|
|
|
4925
5269
|
// does not arrive a second time. The key does BOTH jobs — but only
|
|
4926
5270
|
// because the deck now keeps this subtree mounted across a reload
|
|
4927
5271
|
// (see `InsightDeck`); a key is never compared across a teardown.
|
|
4928
|
-
/* @__PURE__ */
|
|
5272
|
+
/* @__PURE__ */ jsx14("li", { children: /* @__PURE__ */ jsx14(InsightCard, { ...card, style: staggerStyle(index, style) }) }, `${current}:${id}`)
|
|
4929
5273
|
)) }),
|
|
4930
|
-
/* @__PURE__ */
|
|
4931
|
-
/* @__PURE__ */
|
|
5274
|
+
/* @__PURE__ */ jsxs12("div", { className: pageCount > 1 ? "flex items-center justify-between gap-2" : void 0, children: [
|
|
5275
|
+
/* @__PURE__ */ jsxs12(
|
|
4932
5276
|
"p",
|
|
4933
5277
|
{
|
|
4934
5278
|
role: "status",
|
|
@@ -4942,8 +5286,8 @@ function InsightPages({
|
|
|
4942
5286
|
]
|
|
4943
5287
|
}
|
|
4944
5288
|
),
|
|
4945
|
-
pageCount > 1 ? /* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
5289
|
+
pageCount > 1 ? /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1", children: [
|
|
5290
|
+
/* @__PURE__ */ jsx14(PagerButton, { label: "Previous insights", glyph: "\u2039", atEnd: current === 0, onClick: () => goTo(current - 1) }),
|
|
4947
5291
|
pageCount <= MAX_PAGE_DOTS ? Array.from({ length: pageCount }, (_, index) => (
|
|
4948
5292
|
// WCAG 2.2 SC 2.5.8 wants a 24x24 CSS px target. The dot stays
|
|
4949
5293
|
// 8px because a 24px dot is a different control; the BUTTON
|
|
@@ -4951,7 +5295,7 @@ function InsightPages({
|
|
|
4951
5295
|
// and the span is the graphic. The Spacing exception cannot
|
|
4952
5296
|
// rescue the bare dot — at a 12px pitch the 24px circle around
|
|
4953
5297
|
// each centre overlaps its neighbour's.
|
|
4954
|
-
/* @__PURE__ */
|
|
5298
|
+
/* @__PURE__ */ jsx14(
|
|
4955
5299
|
"button",
|
|
4956
5300
|
{
|
|
4957
5301
|
type: "button",
|
|
@@ -4959,7 +5303,7 @@ function InsightPages({
|
|
|
4959
5303
|
"aria-current": index === current ? "page" : void 0,
|
|
4960
5304
|
onClick: () => goTo(index),
|
|
4961
5305
|
className: "group flex h-6 w-6 shrink-0 items-center justify-center rounded-full",
|
|
4962
|
-
children: /* @__PURE__ */
|
|
5306
|
+
children: /* @__PURE__ */ jsx14(
|
|
4963
5307
|
"span",
|
|
4964
5308
|
{
|
|
4965
5309
|
"aria-hidden": "true",
|
|
@@ -4973,7 +5317,7 @@ function InsightPages({
|
|
|
4973
5317
|
index
|
|
4974
5318
|
)
|
|
4975
5319
|
)) : null,
|
|
4976
|
-
/* @__PURE__ */
|
|
5320
|
+
/* @__PURE__ */ jsx14(
|
|
4977
5321
|
PagerButton,
|
|
4978
5322
|
{
|
|
4979
5323
|
label: "Next insights",
|
|
@@ -4994,7 +5338,7 @@ function PagerButton({
|
|
|
4994
5338
|
atEnd,
|
|
4995
5339
|
onClick
|
|
4996
5340
|
}) {
|
|
4997
|
-
return /* @__PURE__ */
|
|
5341
|
+
return /* @__PURE__ */ jsx14(
|
|
4998
5342
|
"button",
|
|
4999
5343
|
{
|
|
5000
5344
|
type: "button",
|
|
@@ -5004,14 +5348,14 @@ function PagerButton({
|
|
|
5004
5348
|
if (!atEnd) onClick();
|
|
5005
5349
|
},
|
|
5006
5350
|
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"}`,
|
|
5007
|
-
children: /* @__PURE__ */
|
|
5351
|
+
children: /* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: glyph })
|
|
5008
5352
|
}
|
|
5009
5353
|
);
|
|
5010
5354
|
}
|
|
5011
5355
|
|
|
5012
5356
|
// src/web-react/api-access-panel.tsx
|
|
5013
|
-
import { useEffect as
|
|
5014
|
-
import { jsx as
|
|
5357
|
+
import { useEffect as useEffect12, useRef as useRef11, useState as useState16 } from "react";
|
|
5358
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5015
5359
|
var defaultExpiryChoices = [1, 7, 30];
|
|
5016
5360
|
var inputClass = "h-11 w-full rounded-lg border border-input bg-background px-3 text-sm text-foreground";
|
|
5017
5361
|
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";
|
|
@@ -5063,28 +5407,28 @@ function ApiAccessPanel({
|
|
|
5063
5407
|
onRevoke,
|
|
5064
5408
|
onChanged
|
|
5065
5409
|
}) {
|
|
5066
|
-
const [name, setName] =
|
|
5410
|
+
const [name, setName] = useState16("");
|
|
5067
5411
|
const allowedDays = [...new Set(expiryDays)].filter((days2) => days2 > 0 && Number.isFinite(new Date(Date.now() + days2 * 864e5).getTime()));
|
|
5068
5412
|
const fallbackDays = allowedDays.includes(defaultExpiryDays) ? defaultExpiryDays : allowedDays[0];
|
|
5069
|
-
const [days, setDays] =
|
|
5413
|
+
const [days, setDays] = useState16(fallbackDays);
|
|
5070
5414
|
const selectedDays = days !== void 0 && allowedDays.includes(days) ? days : fallbackDays;
|
|
5071
|
-
const [scopes, setScopes] =
|
|
5072
|
-
const [creating, setCreating] =
|
|
5073
|
-
const [revoking, setRevoking] =
|
|
5074
|
-
const [created, setCreated] =
|
|
5075
|
-
const [notice, setNotice] =
|
|
5076
|
-
const [error, setError] =
|
|
5415
|
+
const [scopes, setScopes] = useState16(() => expandScopes(defaultScopes, access));
|
|
5416
|
+
const [creating, setCreating] = useState16(false);
|
|
5417
|
+
const [revoking, setRevoking] = useState16(null);
|
|
5418
|
+
const [created, setCreated] = useState16(null);
|
|
5419
|
+
const [notice, setNotice] = useState16(null);
|
|
5420
|
+
const [error, setError] = useState16(null);
|
|
5077
5421
|
const keyHeading = useRef11(null);
|
|
5078
5422
|
const nameInput = useRef11(null);
|
|
5079
5423
|
const keyWasShown = useRef11(false);
|
|
5080
5424
|
const selectedScopes = pruneScopes(scopes, access);
|
|
5081
|
-
|
|
5425
|
+
useEffect12(() => {
|
|
5082
5426
|
setScopes((current) => {
|
|
5083
5427
|
const next = pruneScopes(current, access);
|
|
5084
5428
|
return next.length === current.length ? current : next;
|
|
5085
5429
|
});
|
|
5086
5430
|
}, [access]);
|
|
5087
|
-
|
|
5431
|
+
useEffect12(() => {
|
|
5088
5432
|
if (created) {
|
|
5089
5433
|
keyHeading.current?.focus();
|
|
5090
5434
|
keyWasShown.current = true;
|
|
@@ -5129,20 +5473,20 @@ function ApiAccessPanel({
|
|
|
5129
5473
|
setRevoking(null);
|
|
5130
5474
|
}
|
|
5131
5475
|
}
|
|
5132
|
-
return /* @__PURE__ */
|
|
5133
|
-
/* @__PURE__ */
|
|
5134
|
-
accountHref && /* @__PURE__ */
|
|
5135
|
-
/* @__PURE__ */
|
|
5136
|
-
/* @__PURE__ */
|
|
5476
|
+
return /* @__PURE__ */ jsx15("main", { className: "flex-1 overflow-y-auto", children: /* @__PURE__ */ jsxs13("div", { className: "mx-auto max-w-2xl space-y-8 px-4 py-8 sm:px-8", children: [
|
|
5477
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
5478
|
+
accountHref && /* @__PURE__ */ jsx15("a", { href: accountHref, className: "text-sm text-muted-foreground hover:text-foreground", children: "Account" }),
|
|
5479
|
+
/* @__PURE__ */ jsx15("h1", { className: "text-2xl font-semibold text-foreground", children: "API access" }),
|
|
5480
|
+
/* @__PURE__ */ jsx15("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." })
|
|
5137
5481
|
] }),
|
|
5138
|
-
error && /* @__PURE__ */
|
|
5139
|
-
notice && /* @__PURE__ */
|
|
5140
|
-
created ? /* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5142
|
-
/* @__PURE__ */
|
|
5143
|
-
/* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
5145
|
-
/* @__PURE__ */
|
|
5482
|
+
error && /* @__PURE__ */ jsx15("p", { role: "alert", className: "rounded-lg border border-destructive/40 p-3 text-sm text-destructive", children: error }),
|
|
5483
|
+
notice && /* @__PURE__ */ jsx15("p", { role: "status", className: "text-sm text-muted-foreground", children: notice }),
|
|
5484
|
+
created ? /* @__PURE__ */ jsxs13("section", { "aria-labelledby": "save-api-key", className: "space-y-4 rounded-xl border border-border bg-card p-5", children: [
|
|
5485
|
+
/* @__PURE__ */ jsx15("h2", { ref: keyHeading, tabIndex: -1, id: "save-api-key", className: "font-medium outline-none", children: "Save your key" }),
|
|
5486
|
+
/* @__PURE__ */ jsx15("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." }),
|
|
5487
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-2", children: [
|
|
5488
|
+
/* @__PURE__ */ jsx15("input", { "aria-label": "New API key", type: "password", value: created.key, readOnly: true, autoComplete: "off", className: `${inputClass} min-w-0 font-mono` }),
|
|
5489
|
+
/* @__PURE__ */ jsx15("button", { className: buttonClass, onClick: async () => {
|
|
5146
5490
|
try {
|
|
5147
5491
|
await navigator.clipboard.writeText(created.key);
|
|
5148
5492
|
setNotice("Key copied");
|
|
@@ -5151,32 +5495,32 @@ function ApiAccessPanel({
|
|
|
5151
5495
|
}
|
|
5152
5496
|
}, children: "Copy key" })
|
|
5153
5497
|
] }),
|
|
5154
|
-
/* @__PURE__ */
|
|
5498
|
+
/* @__PURE__ */ jsx15("button", { className: outlineClass, onClick: () => {
|
|
5155
5499
|
setCreated(null);
|
|
5156
5500
|
setNotice(null);
|
|
5157
5501
|
}, children: "I\u2019ve saved it" })
|
|
5158
|
-
] }) : /* @__PURE__ */
|
|
5159
|
-
/* @__PURE__ */
|
|
5160
|
-
/* @__PURE__ */
|
|
5161
|
-
/* @__PURE__ */
|
|
5162
|
-
/* @__PURE__ */
|
|
5163
|
-
/* @__PURE__ */
|
|
5502
|
+
] }) : /* @__PURE__ */ jsxs13("form", { onSubmit: createKey, className: "space-y-5 rounded-xl border border-border bg-card p-5", children: [
|
|
5503
|
+
/* @__PURE__ */ jsx15("h2", { className: "font-medium", children: "Create a key" }),
|
|
5504
|
+
/* @__PURE__ */ jsxs13("div", { className: "grid gap-4 sm:grid-cols-[1fr_10rem]", children: [
|
|
5505
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
|
|
5506
|
+
/* @__PURE__ */ jsx15("label", { className: "text-sm font-medium", htmlFor: "key-name", children: "Name" }),
|
|
5507
|
+
/* @__PURE__ */ jsx15("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" })
|
|
5164
5508
|
] }),
|
|
5165
|
-
/* @__PURE__ */
|
|
5166
|
-
/* @__PURE__ */
|
|
5167
|
-
/* @__PURE__ */
|
|
5509
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-1.5", children: [
|
|
5510
|
+
/* @__PURE__ */ jsx15("label", { className: "text-sm font-medium", htmlFor: "key-expiry", children: "Expires in" }),
|
|
5511
|
+
/* @__PURE__ */ jsx15("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__ */ jsxs13("option", { value: days2, children: [
|
|
5168
5512
|
days2,
|
|
5169
5513
|
" ",
|
|
5170
5514
|
days2 === 1 ? "day" : "days"
|
|
5171
5515
|
] }, days2)) })
|
|
5172
5516
|
] })
|
|
5173
5517
|
] }),
|
|
5174
|
-
/* @__PURE__ */
|
|
5175
|
-
/* @__PURE__ */
|
|
5518
|
+
/* @__PURE__ */ jsxs13("fieldset", { className: "space-y-3", children: [
|
|
5519
|
+
/* @__PURE__ */ jsx15("legend", { className: "mb-3 text-sm font-medium", children: "Permissions" }),
|
|
5176
5520
|
access.map((option) => {
|
|
5177
5521
|
const unavailable = !expandScopes([option.scope], access).includes(option.scope);
|
|
5178
|
-
return /* @__PURE__ */
|
|
5179
|
-
/* @__PURE__ */
|
|
5522
|
+
return /* @__PURE__ */ jsxs13("label", { className: "flex cursor-pointer items-start gap-3", children: [
|
|
5523
|
+
/* @__PURE__ */ jsx15(
|
|
5180
5524
|
"input",
|
|
5181
5525
|
{
|
|
5182
5526
|
type: "checkbox",
|
|
@@ -5186,38 +5530,38 @@ function ApiAccessPanel({
|
|
|
5186
5530
|
onChange: (event) => setScopes((current) => event.target.checked ? expandScopes([...current, option.scope], access) : pruneScopes(current.filter((scope) => scope !== option.scope), access))
|
|
5187
5531
|
}
|
|
5188
5532
|
),
|
|
5189
|
-
/* @__PURE__ */
|
|
5190
|
-
/* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5192
|
-
unavailable && /* @__PURE__ */
|
|
5533
|
+
/* @__PURE__ */ jsxs13("span", { className: "text-sm", children: [
|
|
5534
|
+
/* @__PURE__ */ jsx15("span", { className: "block font-medium", children: option.label }),
|
|
5535
|
+
/* @__PURE__ */ jsx15("span", { className: "text-muted-foreground", children: option.description }),
|
|
5536
|
+
unavailable && /* @__PURE__ */ jsx15("span", { className: "block text-muted-foreground", children: "Required permission unavailable." })
|
|
5193
5537
|
] })
|
|
5194
5538
|
] }, option.scope);
|
|
5195
5539
|
})
|
|
5196
5540
|
] }),
|
|
5197
|
-
limitsDescription && /* @__PURE__ */
|
|
5198
|
-
/* @__PURE__ */
|
|
5541
|
+
limitsDescription && /* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: limitsDescription }),
|
|
5542
|
+
/* @__PURE__ */ jsx15("button", { className: buttonClass, type: "submit", disabled: creating || !name.trim() || !selectedScopes.length || selectedDays === void 0, children: creating ? "Creating\u2026" : "Create key" })
|
|
5199
5543
|
] }),
|
|
5200
|
-
/* @__PURE__ */
|
|
5201
|
-
/* @__PURE__ */
|
|
5202
|
-
keys.length === 0 ? /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
5205
|
-
/* @__PURE__ */
|
|
5206
|
-
/* @__PURE__ */
|
|
5544
|
+
/* @__PURE__ */ jsxs13("section", { "aria-labelledby": "existing-keys", className: "space-y-3", children: [
|
|
5545
|
+
/* @__PURE__ */ jsx15("h2", { id: "existing-keys", className: "font-medium", children: "Your keys" }),
|
|
5546
|
+
keys.length === 0 ? /* @__PURE__ */ jsx15("p", { className: "text-sm text-muted-foreground", children: "No keys yet." }) : /* @__PURE__ */ jsx15("ul", { className: "divide-y divide-border rounded-xl border border-border bg-card", children: keys.map((key) => /* @__PURE__ */ jsxs13("li", { className: "flex items-start justify-between gap-3 p-4", children: [
|
|
5547
|
+
/* @__PURE__ */ jsxs13("div", { className: "min-w-0 space-y-1", children: [
|
|
5548
|
+
/* @__PURE__ */ jsx15("p", { className: "break-words text-sm font-medium", children: key.name }),
|
|
5549
|
+
/* @__PURE__ */ jsx15("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" }),
|
|
5550
|
+
/* @__PURE__ */ jsx15("p", { className: "text-xs text-muted-foreground", children: key.scopes.map((scope) => access.find((access2) => access2.scope === scope)?.label ?? scope).join(" \xB7 ") })
|
|
5207
5551
|
] }),
|
|
5208
|
-
/* @__PURE__ */
|
|
5552
|
+
/* @__PURE__ */ jsx15("button", { className: outlineClass, disabled: revoking !== null, onClick: () => revokeKey(key.id), "aria-label": `Revoke ${key.name}`, children: revoking === key.id ? "Revoking\u2026" : "Revoke" })
|
|
5209
5553
|
] }, key.id)) })
|
|
5210
5554
|
] }),
|
|
5211
|
-
/* @__PURE__ */
|
|
5555
|
+
/* @__PURE__ */ jsxs13("p", { className: "text-sm text-muted-foreground", children: [
|
|
5212
5556
|
"Use ",
|
|
5213
|
-
/* @__PURE__ */
|
|
5557
|
+
/* @__PURE__ */ jsx15("code", { className: "text-xs", children: baseUrl }),
|
|
5214
5558
|
" as the API base and send the key as a Bearer credential."
|
|
5215
5559
|
] })
|
|
5216
5560
|
] }) });
|
|
5217
5561
|
}
|
|
5218
5562
|
|
|
5219
5563
|
// src/web-react/index.tsx
|
|
5220
|
-
import { Fragment as Fragment7, jsx as
|
|
5564
|
+
import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5221
5565
|
function formatModelCost(msg, models) {
|
|
5222
5566
|
if (msg.promptTokens == null && msg.completionTokens == null) return null;
|
|
5223
5567
|
const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
|
|
@@ -5236,41 +5580,41 @@ function formatTokensPerSecond(msg) {
|
|
|
5236
5580
|
return `${Math.round(msg.completionTokens / (msg.durationMs / 1e3))} tok/s`;
|
|
5237
5581
|
}
|
|
5238
5582
|
function RunDrillIn({ run, onClose }) {
|
|
5239
|
-
return /* @__PURE__ */
|
|
5240
|
-
/* @__PURE__ */
|
|
5241
|
-
/* @__PURE__ */
|
|
5583
|
+
return /* @__PURE__ */ jsxs14("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: [
|
|
5584
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 border-b border-border px-4 py-3", children: [
|
|
5585
|
+
/* @__PURE__ */ jsx16(
|
|
5242
5586
|
"span",
|
|
5243
5587
|
{
|
|
5244
5588
|
className: `h-2 w-2 shrink-0 rounded-full ${run.status === "running" ? "bg-warning" : run.status === "error" ? "bg-destructive" : "bg-success"}`
|
|
5245
5589
|
}
|
|
5246
5590
|
),
|
|
5247
|
-
/* @__PURE__ */
|
|
5248
|
-
/* @__PURE__ */
|
|
5249
|
-
/* @__PURE__ */
|
|
5591
|
+
/* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
|
|
5592
|
+
/* @__PURE__ */ jsx16("p", { className: "truncate text-[15px] font-semibold", children: run.title }),
|
|
5593
|
+
/* @__PURE__ */ jsx16("p", { className: "truncate font-mono text-xs text-muted-foreground", children: run.toolName })
|
|
5250
5594
|
] }),
|
|
5251
|
-
/* @__PURE__ */
|
|
5595
|
+
/* @__PURE__ */ jsx16(
|
|
5252
5596
|
"button",
|
|
5253
5597
|
{
|
|
5254
5598
|
type: "button",
|
|
5255
5599
|
onClick: onClose,
|
|
5256
5600
|
"aria-label": "Close",
|
|
5257
5601
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
5258
|
-
children: /* @__PURE__ */
|
|
5602
|
+
children: /* @__PURE__ */ jsx16("svg", { className: "h-4 w-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: /* @__PURE__ */ jsx16("path", { d: "M18 6 6 18M6 6l12 12" }) })
|
|
5259
5603
|
}
|
|
5260
5604
|
)
|
|
5261
5605
|
] }),
|
|
5262
|
-
/* @__PURE__ */
|
|
5263
|
-
run.steps.length === 0 && /* @__PURE__ */
|
|
5264
|
-
run.steps.map((step, i) => /* @__PURE__ */
|
|
5265
|
-
/* @__PURE__ */
|
|
5266
|
-
/* @__PURE__ */
|
|
5267
|
-
/* @__PURE__ */
|
|
5268
|
-
/* @__PURE__ */
|
|
5606
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex-1 space-y-3 overflow-y-auto p-4", children: [
|
|
5607
|
+
run.steps.length === 0 && /* @__PURE__ */ jsx16("p", { className: "text-sm text-muted-foreground", children: "No steps recorded yet." }),
|
|
5608
|
+
run.steps.map((step, i) => /* @__PURE__ */ jsxs14("div", { className: "rounded-lg border border-card-edge bg-card", children: [
|
|
5609
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5", children: [
|
|
5610
|
+
/* @__PURE__ */ jsx16("span", { className: `font-mono text-xs ${step.status === "error" ? "text-destructive" : "text-muted-foreground"}`, children: step.status === "error" ? "\u2717" : "$" }),
|
|
5611
|
+
/* @__PURE__ */ jsx16("code", { className: "min-w-0 flex-1 truncate font-mono text-xs", children: step.label }),
|
|
5612
|
+
/* @__PURE__ */ jsx16("span", { className: "shrink-0 text-xs tabular-nums text-muted-foreground", children: new Date(step.at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" }) })
|
|
5269
5613
|
] }),
|
|
5270
|
-
step.detail && /* @__PURE__ */
|
|
5614
|
+
step.detail && /* @__PURE__ */ jsx16("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 })
|
|
5271
5615
|
] }, i))
|
|
5272
5616
|
] }),
|
|
5273
|
-
/* @__PURE__ */
|
|
5617
|
+
/* @__PURE__ */ jsx16("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." })
|
|
5274
5618
|
] });
|
|
5275
5619
|
}
|
|
5276
5620
|
function pendingApprovalOf(call) {
|
|
@@ -5286,23 +5630,23 @@ function ChatEmptyState({
|
|
|
5286
5630
|
}) {
|
|
5287
5631
|
const doorCount = Math.min(doors?.length ?? 0, 3);
|
|
5288
5632
|
const doorsGridClass = doorCount === 1 ? "mx-auto max-w-sm sm:grid-cols-1" : doorCount === 2 ? "sm:grid-cols-2" : "sm:grid-cols-3";
|
|
5289
|
-
return /* @__PURE__ */
|
|
5290
|
-
/* @__PURE__ */
|
|
5291
|
-
/* @__PURE__ */
|
|
5292
|
-
/* @__PURE__ */
|
|
5293
|
-
subline && /* @__PURE__ */
|
|
5294
|
-
doors && doors.length > 0 && /* @__PURE__ */
|
|
5633
|
+
return /* @__PURE__ */ jsxs14("div", { className: "mx-auto flex w-full max-w-2xl flex-col items-center px-6 py-12 text-center sm:py-20", children: [
|
|
5634
|
+
/* @__PURE__ */ jsx16("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__ */ jsx16(BrandMark, { size: 32, className: "shrink-0" }) }),
|
|
5635
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: productName }),
|
|
5636
|
+
/* @__PURE__ */ jsx16("h2", { className: "mt-1.5 text-balance text-2xl font-semibold leading-tight text-foreground", children: headline }),
|
|
5637
|
+
subline && /* @__PURE__ */ jsx16("p", { className: "mt-3 max-w-md text-[15px] leading-relaxed text-muted-foreground", children: subline }),
|
|
5638
|
+
doors && doors.length > 0 && /* @__PURE__ */ jsx16("div", { className: `mt-7 grid w-full gap-2.5 ${doorsGridClass}`, children: doors.slice(0, 3).map((door, i) => /* @__PURE__ */ jsxs14(
|
|
5295
5639
|
"button",
|
|
5296
5640
|
{
|
|
5297
5641
|
type: "button",
|
|
5298
5642
|
onClick: door.onSelect,
|
|
5299
5643
|
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",
|
|
5300
5644
|
children: [
|
|
5301
|
-
/* @__PURE__ */
|
|
5645
|
+
/* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-2 text-sm font-semibold text-foreground", children: [
|
|
5302
5646
|
door.icon,
|
|
5303
5647
|
door.label
|
|
5304
5648
|
] }),
|
|
5305
|
-
door.description && /* @__PURE__ */
|
|
5649
|
+
door.description && /* @__PURE__ */ jsx16("span", { className: "mt-0.5 text-[12px] leading-snug text-muted-foreground", children: door.description })
|
|
5306
5650
|
]
|
|
5307
5651
|
},
|
|
5308
5652
|
i
|
|
@@ -5311,26 +5655,26 @@ function ChatEmptyState({
|
|
|
5311
5655
|
}
|
|
5312
5656
|
function ToolGlyph({ name, className }) {
|
|
5313
5657
|
if (name.startsWith("sandbox_")) {
|
|
5314
|
-
return /* @__PURE__ */
|
|
5315
|
-
/* @__PURE__ */
|
|
5316
|
-
/* @__PURE__ */
|
|
5658
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5659
|
+
/* @__PURE__ */ jsx16("polyline", { points: "4 17 10 11 4 5" }),
|
|
5660
|
+
/* @__PURE__ */ jsx16("line", { x1: "12", y1: "19", x2: "20", y2: "19" })
|
|
5317
5661
|
] });
|
|
5318
5662
|
}
|
|
5319
5663
|
if (name === "submit_proposal") {
|
|
5320
|
-
return /* @__PURE__ */
|
|
5321
|
-
/* @__PURE__ */
|
|
5322
|
-
/* @__PURE__ */
|
|
5664
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5665
|
+
/* @__PURE__ */ jsx16("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
5666
|
+
/* @__PURE__ */ jsx16("path", { d: "M14 2v6h6M9 15l2 2 4-4" })
|
|
5323
5667
|
] });
|
|
5324
5668
|
}
|
|
5325
5669
|
if (name === "schedule_followup") {
|
|
5326
|
-
return /* @__PURE__ */
|
|
5327
|
-
/* @__PURE__ */
|
|
5328
|
-
/* @__PURE__ */
|
|
5670
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", "aria-hidden": true, children: [
|
|
5671
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "9" }),
|
|
5672
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 7v5l3 3" })
|
|
5329
5673
|
] });
|
|
5330
5674
|
}
|
|
5331
|
-
return /* @__PURE__ */
|
|
5332
|
-
/* @__PURE__ */
|
|
5333
|
-
/* @__PURE__ */
|
|
5675
|
+
return /* @__PURE__ */ jsxs14("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
|
|
5676
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 3v3m0 12v3M3 12h3m12 0h3" }),
|
|
5677
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "4" })
|
|
5334
5678
|
] });
|
|
5335
5679
|
}
|
|
5336
5680
|
function toolOutcomeOf(call) {
|
|
@@ -5416,40 +5760,40 @@ function truncate(v, max = 240) {
|
|
|
5416
5760
|
function KvRows({ data }) {
|
|
5417
5761
|
const entries = Object.entries(data).filter(([, v]) => v !== void 0 && v !== null && v !== "");
|
|
5418
5762
|
if (!entries.length) return null;
|
|
5419
|
-
return /* @__PURE__ */
|
|
5420
|
-
/* @__PURE__ */
|
|
5421
|
-
/* @__PURE__ */
|
|
5763
|
+
return /* @__PURE__ */ jsx16("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-1", children: entries.map(([k, v]) => /* @__PURE__ */ jsxs14("div", { className: "contents", children: [
|
|
5764
|
+
/* @__PURE__ */ jsx16("dt", { className: "font-mono text-xs text-muted-foreground", children: k }),
|
|
5765
|
+
/* @__PURE__ */ jsx16("dd", { className: "min-w-0 whitespace-pre-wrap break-words font-mono text-xs text-muted-foreground", children: truncate(v) })
|
|
5422
5766
|
] }, k)) });
|
|
5423
5767
|
}
|
|
5424
5768
|
function ShellDetail({ call }) {
|
|
5425
5769
|
const outcome = toolOutcomeOf(call);
|
|
5426
5770
|
const r = outcome?.result ?? {};
|
|
5427
|
-
return /* @__PURE__ */
|
|
5428
|
-
/* @__PURE__ */
|
|
5429
|
-
/* @__PURE__ */
|
|
5430
|
-
/* @__PURE__ */
|
|
5431
|
-
r.exitCode != null && /* @__PURE__ */
|
|
5771
|
+
return /* @__PURE__ */ jsxs14("div", { className: "overflow-hidden rounded-md bg-zinc-900 font-mono text-xs leading-relaxed", children: [
|
|
5772
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 px-3 pt-2 text-zinc-400", children: [
|
|
5773
|
+
/* @__PURE__ */ jsx16("span", { className: "select-none text-zinc-500", children: "$" }),
|
|
5774
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 truncate text-zinc-200", children: String(call.args?.command ?? "") }),
|
|
5775
|
+
r.exitCode != null && /* @__PURE__ */ jsxs14("span", { className: r.exitCode === 0 ? "text-success" : "text-destructive", children: [
|
|
5432
5776
|
"exit ",
|
|
5433
5777
|
r.exitCode
|
|
5434
5778
|
] })
|
|
5435
5779
|
] }),
|
|
5436
|
-
/* @__PURE__ */
|
|
5780
|
+
/* @__PURE__ */ jsx16("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)" })
|
|
5437
5781
|
] });
|
|
5438
5782
|
}
|
|
5439
5783
|
function DefaultToolDetail({ call }) {
|
|
5440
5784
|
const result = call.result;
|
|
5441
5785
|
const envelope = typeof result === "object" && result !== null ? result : null;
|
|
5442
|
-
return /* @__PURE__ */
|
|
5443
|
-
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */
|
|
5444
|
-
/* @__PURE__ */
|
|
5445
|
-
/* @__PURE__ */
|
|
5786
|
+
return /* @__PURE__ */ jsxs14("div", { className: "space-y-2", children: [
|
|
5787
|
+
call.args && Object.keys(call.args).length > 0 && /* @__PURE__ */ jsxs14("div", { children: [
|
|
5788
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Called with" }),
|
|
5789
|
+
/* @__PURE__ */ jsx16(KvRows, { data: call.args })
|
|
5446
5790
|
] }),
|
|
5447
|
-
envelope ? /* @__PURE__ */
|
|
5448
|
-
/* @__PURE__ */
|
|
5449
|
-
envelope.ok === false ? /* @__PURE__ */
|
|
5450
|
-
] }) : result != null ? /* @__PURE__ */
|
|
5451
|
-
/* @__PURE__ */
|
|
5452
|
-
/* @__PURE__ */
|
|
5791
|
+
envelope ? /* @__PURE__ */ jsxs14("div", { children: [
|
|
5792
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: envelope.ok === false ? "Failed" : "Result" }),
|
|
5793
|
+
envelope.ok === false ? /* @__PURE__ */ jsx16("p", { className: "text-xs text-destructive", children: envelope.message ?? "Tool failed" }) : envelope.result && typeof envelope.result === "object" ? /* @__PURE__ */ jsx16(KvRows, { data: envelope.result }) : envelope.result != null ? /* @__PURE__ */ jsx16("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(envelope.result) }) : null
|
|
5794
|
+
] }) : result != null ? /* @__PURE__ */ jsxs14("div", { children: [
|
|
5795
|
+
/* @__PURE__ */ jsx16("p", { className: "mb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
5796
|
+
/* @__PURE__ */ jsx16("p", { className: "font-mono text-xs text-muted-foreground", children: truncate(result) })
|
|
5453
5797
|
] }) : null
|
|
5454
5798
|
] });
|
|
5455
5799
|
}
|
|
@@ -5460,24 +5804,24 @@ function ProposalCard({
|
|
|
5460
5804
|
approval,
|
|
5461
5805
|
renderers
|
|
5462
5806
|
}) {
|
|
5463
|
-
const [expanded, setExpanded] =
|
|
5807
|
+
const [expanded, setExpanded] = useState17(false);
|
|
5464
5808
|
const { summary, meta, typeSlug } = proposalPreview(call);
|
|
5465
5809
|
const custom = renderers?.[call.name]?.(call, message);
|
|
5466
5810
|
const { pending: deciding, run: decide } = usePending();
|
|
5467
|
-
return /* @__PURE__ */
|
|
5468
|
-
/* @__PURE__ */
|
|
5469
|
-
/* @__PURE__ */
|
|
5470
|
-
/* @__PURE__ */
|
|
5471
|
-
/* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5473
|
-
summary && /* @__PURE__ */
|
|
5474
|
-
typeSlug && /* @__PURE__ */
|
|
5475
|
-
meta.length > 0 && /* @__PURE__ */
|
|
5811
|
+
return /* @__PURE__ */ jsxs14("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: [
|
|
5812
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-start gap-2.5 px-4 pt-3.5", children: [
|
|
5813
|
+
/* @__PURE__ */ jsx16("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__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
5814
|
+
/* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1", children: [
|
|
5815
|
+
/* @__PURE__ */ jsx16("p", { className: "text-xs font-semibold uppercase tracking-[0.05em] text-warning-strong", children: approval ? "Needs your approval" : "Awaiting approval" }),
|
|
5816
|
+
/* @__PURE__ */ jsx16("p", { className: "mt-0.5 text-[15px] font-semibold leading-snug text-foreground", children: friendlyToolTitle(call) }),
|
|
5817
|
+
summary && /* @__PURE__ */ jsx16("p", { className: "mt-1 text-xs leading-relaxed text-muted-foreground", children: summary }),
|
|
5818
|
+
typeSlug && /* @__PURE__ */ jsx16("p", { className: "mt-1 font-mono text-xs text-muted-foreground", children: typeSlug }),
|
|
5819
|
+
meta.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-1.5 flex flex-wrap items-center gap-1.5", children: meta.map((m, i) => /* @__PURE__ */ jsx16("span", { className: "rounded-full bg-secondary px-2 py-0.5 text-xs font-medium text-muted-foreground", children: m }, i)) })
|
|
5476
5820
|
] })
|
|
5477
5821
|
] }),
|
|
5478
|
-
/* @__PURE__ */
|
|
5479
|
-
approval && /* @__PURE__ */
|
|
5480
|
-
/* @__PURE__ */
|
|
5822
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
|
|
5823
|
+
approval && /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
5824
|
+
/* @__PURE__ */ jsx16(
|
|
5481
5825
|
"button",
|
|
5482
5826
|
{
|
|
5483
5827
|
type: "button",
|
|
@@ -5487,7 +5831,7 @@ function ProposalCard({
|
|
|
5487
5831
|
children: "Approve & run"
|
|
5488
5832
|
}
|
|
5489
5833
|
),
|
|
5490
|
-
/* @__PURE__ */
|
|
5834
|
+
/* @__PURE__ */ jsx16(
|
|
5491
5835
|
"button",
|
|
5492
5836
|
{
|
|
5493
5837
|
type: "button",
|
|
@@ -5498,7 +5842,7 @@ function ProposalCard({
|
|
|
5498
5842
|
}
|
|
5499
5843
|
)
|
|
5500
5844
|
] }),
|
|
5501
|
-
/* @__PURE__ */
|
|
5845
|
+
/* @__PURE__ */ jsxs14(
|
|
5502
5846
|
"button",
|
|
5503
5847
|
{
|
|
5504
5848
|
type: "button",
|
|
@@ -5507,12 +5851,12 @@ function ProposalCard({
|
|
|
5507
5851
|
className: "ml-auto inline-flex items-center gap-1 rounded text-[12px] font-medium text-muted-foreground transition hover:text-foreground",
|
|
5508
5852
|
children: [
|
|
5509
5853
|
expanded ? "Hide details" : "View details",
|
|
5510
|
-
/* @__PURE__ */
|
|
5854
|
+
/* @__PURE__ */ jsx16(ChevronDown, { className: `h-3 w-3 transition-transform ${expanded ? "rotate-180" : ""}` })
|
|
5511
5855
|
]
|
|
5512
5856
|
}
|
|
5513
5857
|
)
|
|
5514
5858
|
] }),
|
|
5515
|
-
expanded && /* @__PURE__ */
|
|
5859
|
+
expanded && /* @__PURE__ */ jsx16("div", { className: "border-t border-warning/20 px-4 py-3 text-xs", children: custom ?? /* @__PURE__ */ jsx16(DefaultToolDetail, { call }) })
|
|
5516
5860
|
] });
|
|
5517
5861
|
}
|
|
5518
5862
|
function formatFollowupWhen(when) {
|
|
@@ -5527,14 +5871,14 @@ function FollowupCard({ call }) {
|
|
|
5527
5871
|
const when = typeof a.when === "string" ? a.when : typeof a.at === "string" ? a.at : typeof a.schedule === "string" ? a.schedule : null;
|
|
5528
5872
|
const failed = toolCallFailed(call);
|
|
5529
5873
|
const errorText = failed ? toolOutcomeOf(call)?.message ?? "Scheduling failed" : null;
|
|
5530
|
-
return /* @__PURE__ */
|
|
5531
|
-
/* @__PURE__ */
|
|
5532
|
-
/* @__PURE__ */
|
|
5533
|
-
/* @__PURE__ */
|
|
5534
|
-
when && /* @__PURE__ */
|
|
5535
|
-
/* @__PURE__ */
|
|
5874
|
+
return /* @__PURE__ */ jsx16("div", { className: "flex items-start gap-2", children: /* @__PURE__ */ jsxs14("div", { className: "min-w-0 flex-1 overflow-hidden rounded-[var(--radius-lg)] border border-[var(--border-subtle)] bg-[var(--md3-surface-container)]", children: [
|
|
5875
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex w-full items-center gap-2.5 px-3 py-2", children: [
|
|
5876
|
+
/* @__PURE__ */ jsx16("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__ */ jsx16(ToolGlyph, { name: call.name, className: "h-3.5 w-3.5" }) }),
|
|
5877
|
+
/* @__PURE__ */ jsx16("span", { className: "shrink-0 whitespace-nowrap text-xs font-medium text-foreground", children: friendlyToolTitle(call) }),
|
|
5878
|
+
when && /* @__PURE__ */ jsx16("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) }),
|
|
5879
|
+
/* @__PURE__ */ jsx16("span", { className: "ml-auto flex shrink-0 items-center gap-1.5", children: call.status === "running" ? /* @__PURE__ */ jsx16("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__ */ jsx16("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }) : /* @__PURE__ */ jsx16("span", { className: `h-1.5 w-1.5 shrink-0 rounded-full ${failed ? "bg-[var(--surface-danger-text)]" : "bg-[var(--surface-success-text)]"}` }) })
|
|
5536
5880
|
] }),
|
|
5537
|
-
errorText && /* @__PURE__ */
|
|
5881
|
+
errorText && /* @__PURE__ */ jsx16("div", { className: "border-t border-border px-3 py-2 text-xs text-[var(--surface-danger-text)]", children: errorText })
|
|
5538
5882
|
] }) });
|
|
5539
5883
|
}
|
|
5540
5884
|
function toolRowTitle(call) {
|
|
@@ -5557,10 +5901,10 @@ function ToolCallCard({
|
|
|
5557
5901
|
const arrival = useArrivalStyle(staggerIndex ?? 0);
|
|
5558
5902
|
const pending = call.status === "done" ? pendingApprovalOf(call) : null;
|
|
5559
5903
|
const kind = blockKindOf(call);
|
|
5560
|
-
const arrive = (row) => /* @__PURE__ */
|
|
5904
|
+
const arrive = (row) => /* @__PURE__ */ jsx16("div", { className: "agent-arrive", style: arrival, children: row });
|
|
5561
5905
|
if (pending) {
|
|
5562
5906
|
return arrive(
|
|
5563
|
-
/* @__PURE__ */
|
|
5907
|
+
/* @__PURE__ */ jsx16(
|
|
5564
5908
|
ProposalCard,
|
|
5565
5909
|
{
|
|
5566
5910
|
call,
|
|
@@ -5573,18 +5917,18 @@ function ToolCallCard({
|
|
|
5573
5917
|
);
|
|
5574
5918
|
}
|
|
5575
5919
|
if (kind === "followup") {
|
|
5576
|
-
return arrive(/* @__PURE__ */
|
|
5920
|
+
return arrive(/* @__PURE__ */ jsx16(FollowupCard, { call }));
|
|
5577
5921
|
}
|
|
5578
5922
|
const custom = renderers?.[call.name]?.(call, message);
|
|
5579
5923
|
return arrive(
|
|
5580
|
-
/* @__PURE__ */
|
|
5924
|
+
/* @__PURE__ */ jsx16(
|
|
5581
5925
|
InlineToolItem,
|
|
5582
5926
|
{
|
|
5583
5927
|
part: chatToolCallPart(call),
|
|
5584
5928
|
title: toolRowTitle(call),
|
|
5585
5929
|
description: toolRowDescription(call),
|
|
5586
|
-
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */
|
|
5587
|
-
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */
|
|
5930
|
+
renderToolDetail: () => custom ?? (call.name === "sandbox_run_command" ? /* @__PURE__ */ jsx16(ShellDetail, { call }) : /* @__PURE__ */ jsx16(DefaultToolDetail, { call })),
|
|
5931
|
+
actions: onOpenRun && call.name.startsWith("sandbox_") ? /* @__PURE__ */ jsx16(
|
|
5588
5932
|
"button",
|
|
5589
5933
|
{
|
|
5590
5934
|
type: "button",
|
|
@@ -5592,9 +5936,9 @@ function ToolCallCard({
|
|
|
5592
5936
|
"aria-label": "Open full transcript",
|
|
5593
5937
|
title: "Open full transcript",
|
|
5594
5938
|
className: "rounded-md p-1.5 text-muted-foreground transition hover:bg-accent hover:text-foreground",
|
|
5595
|
-
children: /* @__PURE__ */
|
|
5596
|
-
/* @__PURE__ */
|
|
5597
|
-
/* @__PURE__ */
|
|
5939
|
+
children: /* @__PURE__ */ jsxs14("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: [
|
|
5940
|
+
/* @__PURE__ */ jsx16("path", { d: "M7 17 17 7" }),
|
|
5941
|
+
/* @__PURE__ */ jsx16("path", { d: "M7 7h10v10" })
|
|
5598
5942
|
] })
|
|
5599
5943
|
}
|
|
5600
5944
|
) : void 0
|
|
@@ -5603,7 +5947,7 @@ function ToolCallCard({
|
|
|
5603
5947
|
);
|
|
5604
5948
|
}
|
|
5605
5949
|
function StreamingCaret() {
|
|
5606
|
-
return /* @__PURE__ */
|
|
5950
|
+
return /* @__PURE__ */ jsx16(
|
|
5607
5951
|
"span",
|
|
5608
5952
|
{
|
|
5609
5953
|
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",
|
|
@@ -5628,9 +5972,9 @@ function SegmentText({
|
|
|
5628
5972
|
// the container on top of that makes the paragraph shimmer while it types.
|
|
5629
5973
|
// The distinction is what separates "the answer materialised" from "the
|
|
5630
5974
|
// log was appended to".
|
|
5631
|
-
/* @__PURE__ */
|
|
5975
|
+
/* @__PURE__ */ jsxs14("div", { className: `${messageClassName}${streaming ? "" : " agent-stream-in"}`, children: [
|
|
5632
5976
|
body,
|
|
5633
|
-
showCaret && /* @__PURE__ */
|
|
5977
|
+
showCaret && /* @__PURE__ */ jsx16(StreamingCaret, {})
|
|
5634
5978
|
] })
|
|
5635
5979
|
);
|
|
5636
5980
|
}
|
|
@@ -5655,7 +5999,7 @@ function SegmentedBody({
|
|
|
5655
5999
|
const leftoverToolCalls = (msg.toolCalls ?? []).filter(
|
|
5656
6000
|
(tc) => !segmentToolIds.has(tc.id)
|
|
5657
6001
|
);
|
|
5658
|
-
const renderToolCard = (call, index) => /* @__PURE__ */
|
|
6002
|
+
const renderToolCard = (call, index) => /* @__PURE__ */ jsx16(
|
|
5659
6003
|
ToolCallCard,
|
|
5660
6004
|
{
|
|
5661
6005
|
call,
|
|
@@ -5683,7 +6027,7 @@ function SegmentedBody({
|
|
|
5683
6027
|
for (const g of groups) {
|
|
5684
6028
|
if (g.kind === "text") {
|
|
5685
6029
|
children.push(
|
|
5686
|
-
/* @__PURE__ */
|
|
6030
|
+
/* @__PURE__ */ jsx16(
|
|
5687
6031
|
SegmentText,
|
|
5688
6032
|
{
|
|
5689
6033
|
content: g.content,
|
|
@@ -5699,13 +6043,13 @@ function SegmentedBody({
|
|
|
5699
6043
|
}
|
|
5700
6044
|
if (!streaming && g.calls.length >= COLLAPSE_TOOL_RUN_AT && !g.calls.some(isImportantTool)) {
|
|
5701
6045
|
children.push(
|
|
5702
|
-
/* @__PURE__ */
|
|
5703
|
-
/* @__PURE__ */
|
|
6046
|
+
/* @__PURE__ */ jsxs14("details", { children: [
|
|
6047
|
+
/* @__PURE__ */ jsxs14("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: [
|
|
5704
6048
|
"Worked through ",
|
|
5705
6049
|
g.calls.length,
|
|
5706
6050
|
" steps"
|
|
5707
6051
|
] }),
|
|
5708
|
-
/* @__PURE__ */
|
|
6052
|
+
/* @__PURE__ */ jsx16("div", { className: "mt-1.5 flex flex-col gap-1.5", children: g.calls.map(renderToolCard) })
|
|
5709
6053
|
] }, `tools-fold-${g.index}`)
|
|
5710
6054
|
);
|
|
5711
6055
|
continue;
|
|
@@ -5714,9 +6058,9 @@ function SegmentedBody({
|
|
|
5714
6058
|
}
|
|
5715
6059
|
leftoverToolCalls.forEach((call, index) => children.push(renderToolCard(call, index)));
|
|
5716
6060
|
if (streaming && segments[lastIndex]?.kind === "tool") {
|
|
5717
|
-
children.push(/* @__PURE__ */
|
|
6061
|
+
children.push(/* @__PURE__ */ jsx16(StreamingCaret, {}, "streaming-caret"));
|
|
5718
6062
|
}
|
|
5719
|
-
return /* @__PURE__ */
|
|
6063
|
+
return /* @__PURE__ */ jsx16("div", { className: "flex flex-col gap-2", children });
|
|
5720
6064
|
}
|
|
5721
6065
|
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";
|
|
5722
6066
|
function copyTextOf(msg) {
|
|
@@ -5725,9 +6069,9 @@ function copyTextOf(msg) {
|
|
|
5725
6069
|
return msg.content;
|
|
5726
6070
|
}
|
|
5727
6071
|
function CopyMessageButton({ text }) {
|
|
5728
|
-
const [copied, setCopied] =
|
|
6072
|
+
const [copied, setCopied] = useState17(false);
|
|
5729
6073
|
const timerRef = useRef12(null);
|
|
5730
|
-
|
|
6074
|
+
useEffect13(
|
|
5731
6075
|
() => () => {
|
|
5732
6076
|
if (timerRef.current !== null) clearTimeout(timerRef.current);
|
|
5733
6077
|
},
|
|
@@ -5746,7 +6090,7 @@ function CopyMessageButton({ text }) {
|
|
|
5746
6090
|
}
|
|
5747
6091
|
);
|
|
5748
6092
|
};
|
|
5749
|
-
return /* @__PURE__ */
|
|
6093
|
+
return /* @__PURE__ */ jsx16(
|
|
5750
6094
|
"button",
|
|
5751
6095
|
{
|
|
5752
6096
|
type: "button",
|
|
@@ -5754,9 +6098,9 @@ function CopyMessageButton({ text }) {
|
|
|
5754
6098
|
"aria-label": "Copy message",
|
|
5755
6099
|
title: "Copy message",
|
|
5756
6100
|
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",
|
|
5757
|
-
children: copied ? /* @__PURE__ */
|
|
5758
|
-
/* @__PURE__ */
|
|
5759
|
-
/* @__PURE__ */
|
|
6101
|
+
children: copied ? /* @__PURE__ */ jsx16("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__ */ jsx16("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxs14("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: [
|
|
6102
|
+
/* @__PURE__ */ jsx16("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
|
|
6103
|
+
/* @__PURE__ */ jsx16("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
5760
6104
|
] })
|
|
5761
6105
|
}
|
|
5762
6106
|
);
|
|
@@ -5791,22 +6135,22 @@ function AssistantMessageImpl({
|
|
|
5791
6135
|
if (hasAnswerText && thinkStartRef.current !== null && thinkMsRef.current === null) {
|
|
5792
6136
|
thinkMsRef.current = performance.now() - thinkStartRef.current;
|
|
5793
6137
|
}
|
|
5794
|
-
|
|
6138
|
+
useEffect13(() => {
|
|
5795
6139
|
const el = reasoningScrollRef.current;
|
|
5796
6140
|
if (el && streaming && !hasAnswerText) el.scrollTop = el.scrollHeight;
|
|
5797
6141
|
}, [reasoning, streaming, hasAnswerText]);
|
|
5798
6142
|
const thinkingSeconds = useThinkingSeconds(
|
|
5799
6143
|
streaming && !!reasoning && !hasAnswerText
|
|
5800
6144
|
);
|
|
5801
|
-
const [reasoningToggled, setReasoningToggled] =
|
|
6145
|
+
const [reasoningToggled, setReasoningToggled] = useState17(null);
|
|
5802
6146
|
const reasoningOpen = reasoningToggled ?? !hasAnswerText;
|
|
5803
6147
|
const quiet = chrome === "quiet";
|
|
5804
|
-
return /* @__PURE__ */
|
|
5805
|
-
!quiet && /* @__PURE__ */
|
|
5806
|
-
/* @__PURE__ */
|
|
5807
|
-
msg.modelUsed && /* @__PURE__ */
|
|
5808
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
5809
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
6148
|
+
return /* @__PURE__ */ jsxs14("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
6149
|
+
!quiet && /* @__PURE__ */ jsxs14("div", { className: "mb-1 flex items-baseline gap-2 text-xs tabular-nums text-muted-foreground", children: [
|
|
6150
|
+
/* @__PURE__ */ jsx16("span", { className: "font-semibold uppercase tracking-[0.05em]", children: agentLabel }),
|
|
6151
|
+
msg.modelUsed && /* @__PURE__ */ jsx16("span", { className: "font-mono normal-case", children: msg.modelUsed }),
|
|
6152
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx16("span", { children: formatTokensPerSecond(msg) }),
|
|
6153
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx16("span", { children: formatModelCost(msg, models) })
|
|
5810
6154
|
] }),
|
|
5811
6155
|
reasoning && // The canonical run-row grammar (RunRowShell — the same shell the tool
|
|
5812
6156
|
// rows compose): one family of rows instead of a bespoke disclosure per
|
|
@@ -5816,12 +6160,12 @@ function AssistantMessageImpl({
|
|
|
5816
6160
|
// and a click outranks the default from then on — the contract the old
|
|
5817
6161
|
// hand-rolled disclosure had, now enforced through the shell's
|
|
5818
6162
|
// controlled `open`.
|
|
5819
|
-
/* @__PURE__ */
|
|
6163
|
+
/* @__PURE__ */ jsx16(
|
|
5820
6164
|
RunRowShell,
|
|
5821
6165
|
{
|
|
5822
6166
|
className: "mb-2",
|
|
5823
|
-
icon: /* @__PURE__ */
|
|
5824
|
-
title: !hasAnswerText ? /* @__PURE__ */
|
|
6167
|
+
icon: /* @__PURE__ */ jsx16(BrainGlyph, { className: "h-3.5 w-3.5" }),
|
|
6168
|
+
title: !hasAnswerText ? /* @__PURE__ */ jsxs14("span", { className: "agent-shimmer", "data-motion": "essential", children: [
|
|
5825
6169
|
"Thinking",
|
|
5826
6170
|
thinkingSeconds >= 1 ? ` \xB7 ${thinkingSeconds}s` : "\u2026"
|
|
5827
6171
|
] }) : thinkMsRef.current != null ? (
|
|
@@ -5836,7 +6180,7 @@ function AssistantMessageImpl({
|
|
|
5836
6180
|
status: hasAnswerText ? "idle" : "running",
|
|
5837
6181
|
open: reasoningOpen,
|
|
5838
6182
|
onOpenChange: (next) => setReasoningToggled(next),
|
|
5839
|
-
children: /* @__PURE__ */
|
|
6183
|
+
children: /* @__PURE__ */ jsx16(
|
|
5840
6184
|
"div",
|
|
5841
6185
|
{
|
|
5842
6186
|
ref: reasoningScrollRef,
|
|
@@ -5846,7 +6190,7 @@ function AssistantMessageImpl({
|
|
|
5846
6190
|
)
|
|
5847
6191
|
}
|
|
5848
6192
|
),
|
|
5849
|
-
segments && segments.length > 0 ? /* @__PURE__ */
|
|
6193
|
+
segments && segments.length > 0 ? /* @__PURE__ */ jsx16(
|
|
5850
6194
|
SegmentedBody,
|
|
5851
6195
|
{
|
|
5852
6196
|
segments,
|
|
@@ -5858,12 +6202,12 @@ function AssistantMessageImpl({
|
|
|
5858
6202
|
toolRenderers,
|
|
5859
6203
|
messageClassName
|
|
5860
6204
|
}
|
|
5861
|
-
) : /* @__PURE__ */
|
|
5862
|
-
/* @__PURE__ */
|
|
6205
|
+
) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
6206
|
+
/* @__PURE__ */ jsxs14("div", { className: messageClassName, children: [
|
|
5863
6207
|
body,
|
|
5864
|
-
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */
|
|
6208
|
+
streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx16(StreamingCaret, {})
|
|
5865
6209
|
] }),
|
|
5866
|
-
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */
|
|
6210
|
+
msg.toolCalls && msg.toolCalls.length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-2 flex flex-col gap-1.5", children: msg.toolCalls.map((tc, index) => /* @__PURE__ */ jsx16(
|
|
5867
6211
|
ToolCallCard,
|
|
5868
6212
|
{
|
|
5869
6213
|
call: tc,
|
|
@@ -5876,7 +6220,7 @@ function AssistantMessageImpl({
|
|
|
5876
6220
|
tc.id
|
|
5877
6221
|
)) })
|
|
5878
6222
|
] }),
|
|
5879
|
-
durableCards && msg.parts && /* @__PURE__ */
|
|
6223
|
+
durableCards && msg.parts && /* @__PURE__ */ jsx16(
|
|
5880
6224
|
DurableChatCards,
|
|
5881
6225
|
{
|
|
5882
6226
|
...durableCards,
|
|
@@ -5885,7 +6229,7 @@ function AssistantMessageImpl({
|
|
|
5885
6229
|
className: "mt-3"
|
|
5886
6230
|
}
|
|
5887
6231
|
),
|
|
5888
|
-
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */
|
|
6232
|
+
workProductCards && workProductPartsFromMessageParts(msg.parts).map((part) => /* @__PURE__ */ jsx16(
|
|
5889
6233
|
WorkProductCard,
|
|
5890
6234
|
{
|
|
5891
6235
|
part,
|
|
@@ -5895,7 +6239,7 @@ function AssistantMessageImpl({
|
|
|
5895
6239
|
`${part.ref.id}:${part.ref.version}`
|
|
5896
6240
|
)),
|
|
5897
6241
|
renderExtras?.(msg),
|
|
5898
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
6242
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-2", children: /* @__PURE__ */ jsx16(
|
|
5899
6243
|
MessageAttachments,
|
|
5900
6244
|
{
|
|
5901
6245
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -5903,18 +6247,18 @@ function AssistantMessageImpl({
|
|
|
5903
6247
|
justify: "start"
|
|
5904
6248
|
}
|
|
5905
6249
|
) }),
|
|
5906
|
-
quiet && /* @__PURE__ */
|
|
5907
|
-
/* @__PURE__ */
|
|
5908
|
-
msg.modelUsed && /* @__PURE__ */
|
|
5909
|
-
formatTokensPerSecond(msg) && /* @__PURE__ */
|
|
5910
|
-
formatModelCost(msg, models) && /* @__PURE__ */
|
|
6250
|
+
quiet && /* @__PURE__ */ jsxs14("div", { "data-testid": "message-meta-lane", className: QUIET_META_LANE_CLASS, children: [
|
|
6251
|
+
/* @__PURE__ */ jsx16(CopyMessageButton, { text: copyTextOf(msg) }),
|
|
6252
|
+
msg.modelUsed && /* @__PURE__ */ jsx16("span", { className: "font-mono", children: msg.modelUsed }),
|
|
6253
|
+
formatTokensPerSecond(msg) && /* @__PURE__ */ jsx16("span", { children: formatTokensPerSecond(msg) }),
|
|
6254
|
+
formatModelCost(msg, models) && /* @__PURE__ */ jsx16("span", { children: formatModelCost(msg, models) })
|
|
5911
6255
|
] })
|
|
5912
6256
|
] });
|
|
5913
6257
|
}
|
|
5914
6258
|
var AssistantMessage = memo(AssistantMessageImpl);
|
|
5915
6259
|
function useThinkingSeconds(active) {
|
|
5916
|
-
const [seconds, setSeconds] =
|
|
5917
|
-
|
|
6260
|
+
const [seconds, setSeconds] = useState17(0);
|
|
6261
|
+
useEffect13(() => {
|
|
5918
6262
|
if (!active) return;
|
|
5919
6263
|
setSeconds(0);
|
|
5920
6264
|
const id = setInterval(() => setSeconds((s) => s + 1), 1e3);
|
|
@@ -5924,23 +6268,23 @@ function useThinkingSeconds(active) {
|
|
|
5924
6268
|
}
|
|
5925
6269
|
function ThinkingRow({ agentLabel, chrome = "labeled" }) {
|
|
5926
6270
|
const seconds = useThinkingSeconds(true);
|
|
5927
|
-
return /* @__PURE__ */
|
|
5928
|
-
chrome !== "quiet" && /* @__PURE__ */
|
|
5929
|
-
/* @__PURE__ */
|
|
5930
|
-
/* @__PURE__ */
|
|
6271
|
+
return /* @__PURE__ */ jsxs14("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: [
|
|
6272
|
+
chrome !== "quiet" && /* @__PURE__ */ jsx16("p", { className: "mb-1 text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: agentLabel }),
|
|
6273
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2 text-[15px] text-muted-foreground", children: [
|
|
6274
|
+
/* @__PURE__ */ jsx16("svg", { className: "h-4 w-4 animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", "aria-hidden": true, children: /* @__PURE__ */ jsx16("path", { d: "M21 12a9 9 0 1 1-6.219-8.56", strokeLinecap: "round" }) }),
|
|
5931
6275
|
"Thinking",
|
|
5932
6276
|
seconds >= 3 ? ` \xB7 ${seconds}s` : "..."
|
|
5933
6277
|
] })
|
|
5934
6278
|
] });
|
|
5935
6279
|
}
|
|
5936
6280
|
function StreamErrorRow({ message, onRetry }) {
|
|
5937
|
-
return /* @__PURE__ */
|
|
5938
|
-
/* @__PURE__ */
|
|
5939
|
-
/* @__PURE__ */
|
|
5940
|
-
/* @__PURE__ */
|
|
6281
|
+
return /* @__PURE__ */ jsx16("div", { className: "mx-auto w-full max-w-3xl px-6 py-3", children: /* @__PURE__ */ jsxs14("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: [
|
|
6282
|
+
/* @__PURE__ */ jsxs14("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: [
|
|
6283
|
+
/* @__PURE__ */ jsx16("circle", { cx: "12", cy: "12", r: "9" }),
|
|
6284
|
+
/* @__PURE__ */ jsx16("path", { d: "M12 8v4m0 4h.01" })
|
|
5941
6285
|
] }),
|
|
5942
|
-
/* @__PURE__ */
|
|
5943
|
-
onRetry && /* @__PURE__ */
|
|
6286
|
+
/* @__PURE__ */ jsx16("span", { className: "min-w-0 flex-1 break-words", children: message }),
|
|
6287
|
+
onRetry && /* @__PURE__ */ jsx16(
|
|
5944
6288
|
"button",
|
|
5945
6289
|
{
|
|
5946
6290
|
type: "button",
|
|
@@ -5975,32 +6319,32 @@ function ChatMessages({
|
|
|
5975
6319
|
}) {
|
|
5976
6320
|
const messageClassName = messageSize === "large" ? "agent-app-message-copy text-[17px] leading-[1.6]" : "agent-app-message-copy text-base leading-[1.6]";
|
|
5977
6321
|
const renderBody = useMemo7(
|
|
5978
|
-
() => renderMarkdown ?? ((content) => /* @__PURE__ */
|
|
6322
|
+
() => renderMarkdown ?? ((content) => /* @__PURE__ */ jsx16("p", { className: "whitespace-pre-wrap", children: content })),
|
|
5979
6323
|
[renderMarkdown]
|
|
5980
6324
|
);
|
|
5981
6325
|
const lastIsUser = messages[messages.length - 1]?.role === "user";
|
|
5982
6326
|
const quiet = chrome === "quiet";
|
|
5983
6327
|
if (messages.length === 0 && !loading && !error) {
|
|
5984
|
-
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */
|
|
5985
|
-
return /* @__PURE__ */
|
|
6328
|
+
const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx16(ChatEmptyState, { ...emptyState });
|
|
6329
|
+
return /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
5986
6330
|
header,
|
|
5987
6331
|
empty
|
|
5988
6332
|
] });
|
|
5989
6333
|
}
|
|
5990
|
-
return /* @__PURE__ */
|
|
6334
|
+
return /* @__PURE__ */ jsxs14(Fragment7, { children: [
|
|
5991
6335
|
header,
|
|
5992
6336
|
messages.map(
|
|
5993
|
-
(msg) => msg.role === "user" ? /* @__PURE__ */
|
|
5994
|
-
/* @__PURE__ */
|
|
5995
|
-
!quiet && /* @__PURE__ */
|
|
5996
|
-
/* @__PURE__ */
|
|
6337
|
+
(msg) => msg.role === "user" ? /* @__PURE__ */ jsxs14("div", { className: `mx-auto w-full max-w-3xl px-6 ${quiet ? "group pb-1 pt-3" : "py-3"}`, children: [
|
|
6338
|
+
/* @__PURE__ */ jsxs14("div", { className: `ml-auto w-fit ${quiet ? "max-w-[72%]" : "max-w-[85%]"}`, children: [
|
|
6339
|
+
!quiet && /* @__PURE__ */ jsx16("p", { className: "mb-1 text-right text-xs font-semibold uppercase tracking-[0.05em] text-muted-foreground", children: userLabel }),
|
|
6340
|
+
/* @__PURE__ */ jsx16(
|
|
5997
6341
|
"div",
|
|
5998
6342
|
{
|
|
5999
6343
|
className: quiet ? `rounded-2xl bg-[color-mix(in_srgb,hsl(var(--secondary))_65%,hsl(var(--background)))] px-4 py-2.5 ${messageClassName}` : `rounded-2xl rounded-tr-md bg-primary/10 px-4 py-2.5 ${messageClassName}`,
|
|
6000
|
-
children: /* @__PURE__ */
|
|
6344
|
+
children: /* @__PURE__ */ jsx16("p", { className: "whitespace-pre-wrap", children: msg.content })
|
|
6001
6345
|
}
|
|
6002
6346
|
),
|
|
6003
|
-
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */
|
|
6347
|
+
resolveAttachmentUrl && attachmentPartsFromMessageParts(msg.parts).length > 0 && /* @__PURE__ */ jsx16("div", { className: "mt-1.5", children: /* @__PURE__ */ jsx16(
|
|
6004
6348
|
MessageAttachments,
|
|
6005
6349
|
{
|
|
6006
6350
|
parts: attachmentPartsFromMessageParts(msg.parts),
|
|
@@ -6009,8 +6353,8 @@ function ChatMessages({
|
|
|
6009
6353
|
}
|
|
6010
6354
|
) })
|
|
6011
6355
|
] }),
|
|
6012
|
-
quiet && /* @__PURE__ */
|
|
6013
|
-
] }, msg.id) : /* @__PURE__ */
|
|
6356
|
+
quiet && /* @__PURE__ */ jsx16("div", { "data-testid": "message-meta-lane", className: `${QUIET_META_LANE_CLASS} justify-end`, children: /* @__PURE__ */ jsx16(CopyMessageButton, { text: msg.content }) })
|
|
6357
|
+
] }, msg.id) : /* @__PURE__ */ jsx16(
|
|
6014
6358
|
AssistantMessage,
|
|
6015
6359
|
{
|
|
6016
6360
|
msg,
|
|
@@ -6031,8 +6375,8 @@ function ChatMessages({
|
|
|
6031
6375
|
msg.id
|
|
6032
6376
|
)
|
|
6033
6377
|
),
|
|
6034
|
-
loading && lastIsUser && /* @__PURE__ */
|
|
6035
|
-
error && !loading && /* @__PURE__ */
|
|
6378
|
+
loading && lastIsUser && /* @__PURE__ */ jsx16(ThinkingRow, { agentLabel, chrome }),
|
|
6379
|
+
error && !loading && /* @__PURE__ */ jsx16(StreamErrorRow, { message: error, onRetry })
|
|
6036
6380
|
] });
|
|
6037
6381
|
}
|
|
6038
6382
|
|
|
@@ -6067,6 +6411,7 @@ export {
|
|
|
6067
6411
|
dispatchChatStreamLine,
|
|
6068
6412
|
consumeChatStream,
|
|
6069
6413
|
streamChatTurn,
|
|
6414
|
+
AgentProfileEditor,
|
|
6070
6415
|
DurablePlanClientError,
|
|
6071
6416
|
createDurablePlanDecisionClient,
|
|
6072
6417
|
useDurablePlanFlow,
|
|
@@ -6167,4 +6512,4 @@ export {
|
|
|
6167
6512
|
useThinkingSeconds,
|
|
6168
6513
|
ChatMessages
|
|
6169
6514
|
};
|
|
6170
|
-
//# sourceMappingURL=chunk-
|
|
6515
|
+
//# sourceMappingURL=chunk-ZYJCWKZ7.js.map
|