@tangle-network/agent-app 0.50.22 → 0.50.24

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.
@@ -1419,7 +1419,19 @@ async function streamChatTurn(opts) {
1419
1419
  import { useEffect as useEffect5, useId, useState as useState7 } from "react";
1420
1420
  import { agentProfileSchema } from "@tangle-network/agent-interface/profile-schema";
1421
1421
  import { Button, Input, Textarea, Switch, Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@tangle-network/sandbox-ui/primitives";
1422
- import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1422
+ import { Fragment as Fragment2, jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
1423
+ var RESOURCE_KIND_LABELS = {
1424
+ files: "Resource files",
1425
+ skills: "Skills",
1426
+ tools: "Tool files",
1427
+ agents: "Agent files",
1428
+ commands: "Command files",
1429
+ instructions: "Resource instructions"
1430
+ };
1431
+ function configuredResourceCount(profile, kind) {
1432
+ const resource = profile.resources?.[kind];
1433
+ return Array.isArray(resource) ? resource.length : resource ? 1 : 0;
1434
+ }
1423
1435
  function Field({ label, hint, children }) {
1424
1436
  return /* @__PURE__ */ jsxs5("label", { className: "block space-y-1.5 text-sm font-medium text-foreground", children: [
1425
1437
  /* @__PURE__ */ jsx7("span", { children: label }),
@@ -1455,7 +1467,104 @@ function issueMessage(error) {
1455
1467
  const issue = error.issues[0];
1456
1468
  return issue ? (issue.path.map(String).join(".") || "Profile") + ": " + issue.message : "Invalid profile";
1457
1469
  }
1458
- function AgentProfileEditor({ value, onChange, disabled = false, className }) {
1470
+ function emptyResourceDraft() {
1471
+ return { kind: "github", repository: "", path: "", ref: "", name: "", content: "" };
1472
+ }
1473
+ function resourceDraft(ref) {
1474
+ return ref.kind === "github" ? { ...emptyResourceDraft(), kind: "github", repository: ref.repository ?? "", path: ref.path, ref: ref.ref ?? "", name: ref.name ?? "" } : { ...emptyResourceDraft(), kind: "inline", name: ref.name, content: ref.content };
1475
+ }
1476
+ function resourceRef(draft) {
1477
+ return draft.kind === "inline" ? { kind: "inline", name: draft.name.trim(), content: draft.content } : {
1478
+ kind: "github",
1479
+ repository: draft.repository.trim(),
1480
+ path: draft.path.trim(),
1481
+ ...draft.ref.trim() ? { ref: draft.ref.trim() } : {},
1482
+ ...draft.name.trim() ? { name: draft.name.trim() } : {}
1483
+ };
1484
+ }
1485
+ function resourceError(draft) {
1486
+ if (draft.kind === "inline") return draft.name.trim() ? null : "Enter a name for the inline file.";
1487
+ if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(draft.repository.trim())) return "Enter a GitHub repository as owner/repo.";
1488
+ if (!draft.path.trim()) return "Enter a path within the GitHub repository.";
1489
+ return null;
1490
+ }
1491
+ function ResourceFields({ draft, onChange, disabled, pathPlaceholder }) {
1492
+ function change(field, text) {
1493
+ onChange({ ...draft, [field]: text });
1494
+ }
1495
+ return /* @__PURE__ */ jsxs5("div", { className: "grid gap-3 sm:grid-cols-2", children: [
1496
+ /* @__PURE__ */ jsx7(Field, { label: "Source", children: /* @__PURE__ */ jsxs5(Select, { disabled, value: draft.kind, onValueChange: (kind) => change("kind", kind), children: [
1497
+ /* @__PURE__ */ jsx7(SelectTrigger, { "aria-label": "Source", children: /* @__PURE__ */ jsx7(SelectValue, {}) }),
1498
+ /* @__PURE__ */ jsxs5(SelectContent, { children: [
1499
+ /* @__PURE__ */ jsx7(SelectItem, { value: "github", children: "GitHub file" }),
1500
+ /* @__PURE__ */ jsx7(SelectItem, { value: "inline", children: "Inline content" })
1501
+ ] })
1502
+ ] }) }),
1503
+ draft.kind === "github" ? /* @__PURE__ */ jsxs5(Fragment2, { children: [
1504
+ /* @__PURE__ */ jsx7(Field, { label: "Repository", hint: "GitHub owner/repo", children: /* @__PURE__ */ jsx7(
1505
+ Input,
1506
+ {
1507
+ disabled,
1508
+ value: draft.repository,
1509
+ onChange: (event) => change("repository", event.target.value),
1510
+ placeholder: "owner/repo"
1511
+ }
1512
+ ) }),
1513
+ /* @__PURE__ */ jsx7(Field, { label: "Repository path", hint: "Relative to the repository root", children: /* @__PURE__ */ jsx7(
1514
+ Input,
1515
+ {
1516
+ disabled,
1517
+ value: draft.path,
1518
+ onChange: (event) => change("path", event.target.value),
1519
+ placeholder: pathPlaceholder
1520
+ }
1521
+ ) }),
1522
+ /* @__PURE__ */ jsx7(Field, { label: "Ref", hint: "Defaults to the main branch", children: /* @__PURE__ */ jsx7(
1523
+ Input,
1524
+ {
1525
+ disabled,
1526
+ value: draft.ref,
1527
+ onChange: (event) => change("ref", event.target.value),
1528
+ placeholder: "main"
1529
+ }
1530
+ ) }),
1531
+ /* @__PURE__ */ jsx7(Field, { label: "Name", hint: "Defaults to the source filename", children: /* @__PURE__ */ jsx7(
1532
+ Input,
1533
+ {
1534
+ disabled,
1535
+ value: draft.name,
1536
+ onChange: (event) => change("name", event.target.value)
1537
+ }
1538
+ ) })
1539
+ ] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
1540
+ /* @__PURE__ */ jsx7(Field, { label: "File name", children: /* @__PURE__ */ jsx7(
1541
+ Input,
1542
+ {
1543
+ disabled,
1544
+ value: draft.name,
1545
+ onChange: (event) => change("name", event.target.value),
1546
+ placeholder: "guide.md"
1547
+ }
1548
+ ) }),
1549
+ /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: "Content", children: /* @__PURE__ */ jsx7(
1550
+ Textarea,
1551
+ {
1552
+ className: "min-h-32 font-mono text-sm",
1553
+ disabled,
1554
+ value: draft.content,
1555
+ onChange: (event) => change("content", event.target.value)
1556
+ }
1557
+ ) }) })
1558
+ ] })
1559
+ ] });
1560
+ }
1561
+ function fileDraft(mount) {
1562
+ return { path: mount.path, resource: resourceDraft(mount.resource), executable: mount.executable ?? false };
1563
+ }
1564
+ function fileMount(draft) {
1565
+ return { path: draft.path.trim(), resource: resourceRef(draft.resource), ...draft.executable ? { executable: true } : {} };
1566
+ }
1567
+ function AgentProfileEditor({ value, onChange, disabled = false, className, allowedResourceKinds }) {
1459
1568
  const id = useId();
1460
1569
  const [error, setError] = useState7(null);
1461
1570
  const [newTool, setNewTool] = useState7("");
@@ -1463,13 +1572,19 @@ function AgentProfileEditor({ value, onChange, disabled = false, className }) {
1463
1572
  const [mcpName, setMcpName] = useState7("");
1464
1573
  const [mcpKind, setMcpKind] = useState7("http");
1465
1574
  const [mcpTarget, setMcpTarget] = useState7("");
1466
- const [resourceDrafts, setResourceDrafts] = useState7({});
1575
+ const [resourceDrafts, setResourceDrafts] = useState7({ skills: emptyResourceDraft(), tools: emptyResourceDraft() });
1576
+ const [resourceEdit, setResourceEdit] = useState7(null);
1577
+ const [newFile, setNewFile] = useState7({ path: "", resource: { ...emptyResourceDraft(), kind: "inline" }, executable: false });
1578
+ const [addingFile, setAddingFile] = useState7(false);
1579
+ const [fileEdit, setFileEdit] = useState7(null);
1467
1580
  const [json, setJson] = useState7(() => JSON.stringify(value, null, 2));
1468
1581
  const [jsonDirty, setJsonDirty] = useState7(false);
1469
1582
  useEffect5(() => {
1470
1583
  if (!jsonDirty) setJson(JSON.stringify(value, null, 2));
1471
1584
  }, [value, jsonDirty]);
1472
1585
  const editingDisabled = disabled || jsonDirty;
1586
+ const allowsResource = (kind) => !allowedResourceKinds || allowedResourceKinds.includes(kind);
1587
+ const unsupportedResources = Object.keys(RESOURCE_KIND_LABELS).filter((kind) => !allowsResource(kind) && configuredResourceCount(value, kind) > 0);
1473
1588
  function emit(next) {
1474
1589
  if (jsonDirty) {
1475
1590
  setError("Apply or discard JSON edits first.");
@@ -1494,74 +1609,154 @@ function AgentProfileEditor({ value, onChange, disabled = false, className }) {
1494
1609
  return emit({ ...value, resources: { ...value.resources, [key]: refs } });
1495
1610
  }
1496
1611
  function addResource(key) {
1497
- const draft = resourceDrafts[key] ?? { kind: "github", path: "", name: "", content: "" };
1498
- 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 };
1499
- if (draft.kind === "github" && !draft.path.trim() || draft.kind === "inline" && !draft.name.trim()) {
1500
- setError(draft.kind === "github" ? "Enter a resource path." : "Enter a resource name.");
1612
+ const draft = resourceDrafts[key];
1613
+ const issue = resourceError(draft);
1614
+ if (issue) {
1615
+ setError(issue);
1501
1616
  return;
1502
1617
  }
1503
- if (!resources(key, [...value.resources?.[key] ?? [], ref])) return;
1504
- setResourceDrafts((current) => ({ ...current, [key]: { ...draft, path: "", name: "", content: "" } }));
1618
+ if (!resources(key, [...value.resources?.[key] ?? [], resourceRef(draft)])) return;
1619
+ setResourceDrafts((current) => ({ ...current, [key]: emptyResourceDraft() }));
1505
1620
  }
1506
- function resourceSection(key, title, description) {
1621
+ function applyResourceEdit() {
1622
+ if (!resourceEdit) return;
1623
+ const issue = resourceError(resourceEdit.draft);
1624
+ if (issue) {
1625
+ setError(issue);
1626
+ return;
1627
+ }
1628
+ const { key, index, draft } = resourceEdit;
1507
1629
  const refs = value.resources?.[key] ?? [];
1508
- const draft = resourceDrafts[key] ?? { kind: "github", path: "", name: "", content: "" };
1509
- function change(field, text) {
1510
- setResourceDrafts((current) => ({ ...current, [key]: { ...draft, [field]: text } }));
1630
+ if (!refs[index]) {
1631
+ setError("This resource changed. Reopen it to edit.");
1632
+ setResourceEdit(null);
1633
+ return;
1511
1634
  }
1512
- return /* @__PURE__ */ jsxs5(Disclosure, { title, description, detail: refs.length ? refs.length + " added" : "Optional", children: [
1513
- refs.length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "None added." }),
1514
- /* @__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: [
1515
- /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1516
- /* @__PURE__ */ jsx7("span", { className: "font-medium", children: ref.name || (ref.kind === "github" ? ref.path : "Inline resource") }),
1517
- /* @__PURE__ */ jsx7("span", { className: "ml-2 text-xs text-muted-foreground", children: ref.kind === "github" ? "GitHub \xB7 " + ref.path : "Inline" }),
1518
- ref.kind === "github" && ref.repository && /* @__PURE__ */ jsx7("span", { className: "block text-xs text-muted-foreground", children: ref.repository })
1519
- ] }),
1635
+ if (resources(key, refs.map((ref, item) => item === index ? resourceRef(draft) : ref))) setResourceEdit(null);
1636
+ }
1637
+ function saveFile(draft, index) {
1638
+ const path = draft.path.trim();
1639
+ if (!path) {
1640
+ setError("Enter a workspace path for the file.");
1641
+ return false;
1642
+ }
1643
+ const issue = resourceError(draft.resource);
1644
+ if (issue) {
1645
+ setError(issue);
1646
+ return false;
1647
+ }
1648
+ const files = value.resources?.files ?? [];
1649
+ if (files.some((file, item) => file.path === path && item !== index)) {
1650
+ setError("A resource file already uses that workspace path.");
1651
+ return false;
1652
+ }
1653
+ const next = index === void 0 ? [...files, fileMount(draft)] : files.map((file, item) => item === index ? fileMount(draft) : file);
1654
+ return emit({ ...value, resources: { ...value.resources, files: next } });
1655
+ }
1656
+ function fileFields(draft, onChange2) {
1657
+ return /* @__PURE__ */ jsxs5("div", { className: "space-y-3", children: [
1658
+ /* @__PURE__ */ jsx7(Field, { label: "Workspace path", hint: "Relative to the agent workspace", children: /* @__PURE__ */ jsx7(
1659
+ Input,
1660
+ {
1661
+ disabled: editingDisabled,
1662
+ value: draft.path,
1663
+ onChange: (event) => onChange2({ ...draft, path: event.target.value }),
1664
+ placeholder: "docs/guide.md"
1665
+ }
1666
+ ) }),
1667
+ /* @__PURE__ */ jsx7(
1668
+ ResourceFields,
1669
+ {
1670
+ draft: draft.resource,
1671
+ disabled: editingDisabled,
1672
+ pathPlaceholder: "docs/guide.md",
1673
+ onChange: (resource) => onChange2({ ...draft, resource })
1674
+ }
1675
+ ),
1676
+ /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-sm text-foreground", children: [
1520
1677
  /* @__PURE__ */ jsx7(
1521
- Button,
1678
+ Switch,
1522
1679
  {
1523
- type: "button",
1524
- variant: "ghost",
1525
- className: "text-destructive",
1526
1680
  disabled: editingDisabled,
1527
- "aria-label": "Remove " + title.toLowerCase() + " " + (index + 1),
1528
- onClick: () => resources(key, refs.filter((_, item) => item !== index)),
1529
- children: "Remove"
1681
+ checked: draft.executable,
1682
+ onCheckedChange: (executable) => onChange2({ ...draft, executable })
1530
1683
  }
1531
- )
1532
- ] }, index)) }),
1533
- /* @__PURE__ */ jsxs5("div", { className: "grid gap-3 rounded-lg border border-dashed border-border p-3 sm:grid-cols-[10rem_1fr]", children: [
1534
- /* @__PURE__ */ jsx7(Field, { label: "Source", children: /* @__PURE__ */ jsxs5(Select, { disabled: editingDisabled, value: draft.kind, onValueChange: (kind) => change("kind", kind), children: [
1535
- /* @__PURE__ */ jsx7(SelectTrigger, { "aria-label": "Source", children: /* @__PURE__ */ jsx7(SelectValue, {}) }),
1536
- /* @__PURE__ */ jsxs5(SelectContent, { children: [
1537
- /* @__PURE__ */ jsx7(SelectItem, { value: "github", children: "GitHub path" }),
1538
- /* @__PURE__ */ jsx7(SelectItem, { value: "inline", children: "Inline content" })
1684
+ ),
1685
+ "Executable file"
1686
+ ] })
1687
+ ] });
1688
+ }
1689
+ function resourceSection(key, title, description) {
1690
+ const refs = value.resources?.[key] ?? [];
1691
+ const draft = resourceDrafts[key];
1692
+ return /* @__PURE__ */ jsxs5(Disclosure, { title, description, detail: refs.length ? refs.length + " configured" : "Optional", children: [
1693
+ refs.length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "None configured." }),
1694
+ /* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: refs.map((ref, index) => /* @__PURE__ */ jsxs5("li", { className: "space-y-3 rounded-lg border border-border p-3 text-sm", "aria-label": title + " " + (index + 1), children: [
1695
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
1696
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1697
+ /* @__PURE__ */ jsx7("span", { className: "block break-words font-medium text-foreground", children: ref.name || (ref.kind === "github" ? ref.path : "Inline resource") }),
1698
+ /* @__PURE__ */ jsx7("span", { className: "block break-words text-xs " + (ref.kind === "github" && !ref.repository ? "text-destructive" : "text-muted-foreground"), children: ref.kind === "github" ? (ref.repository ? ref.repository + " / " : "Repository required \xB7 ") + ref.path + (ref.ref ? " @ " + ref.ref : "") : "Inline content" })
1699
+ ] }),
1700
+ /* @__PURE__ */ jsxs5("div", { className: "flex shrink-0 gap-1", children: [
1701
+ /* @__PURE__ */ jsx7(
1702
+ Button,
1703
+ {
1704
+ type: "button",
1705
+ variant: "ghost",
1706
+ disabled: editingDisabled,
1707
+ "aria-label": "Edit " + title.toLowerCase() + " " + (index + 1),
1708
+ onClick: () => setResourceEdit({ key, index, draft: resourceDraft(ref) }),
1709
+ children: "Edit"
1710
+ }
1711
+ ),
1712
+ /* @__PURE__ */ jsx7(
1713
+ Button,
1714
+ {
1715
+ type: "button",
1716
+ variant: "ghost",
1717
+ className: "text-destructive",
1718
+ disabled: editingDisabled,
1719
+ "aria-label": "Remove " + title.toLowerCase() + " " + (index + 1),
1720
+ onClick: () => {
1721
+ if (resources(key, refs.filter((_, item) => item !== index))) setResourceEdit(null);
1722
+ },
1723
+ children: "Remove"
1724
+ }
1725
+ )
1539
1726
  ] })
1540
- ] }) }),
1541
- /* @__PURE__ */ jsx7(Field, { label: draft.kind === "github" ? "Path" : "Name", children: /* @__PURE__ */ jsx7(
1542
- Input,
1543
- {
1544
- disabled: editingDisabled,
1545
- value: draft.kind === "github" ? draft.path : draft.name,
1546
- onChange: (event) => change(draft.kind === "github" ? "path" : "name", event.target.value),
1547
- placeholder: draft.kind === "github" ? "skills/research/SKILL.md" : "Research skill"
1548
- }
1549
- ) }),
1550
- draft.kind === "inline" && /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: "Content", children: /* @__PURE__ */ jsx7(
1551
- Textarea,
1727
+ ] }),
1728
+ resourceEdit?.key === key && resourceEdit.index === index && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 border-t border-border pt-3", children: [
1729
+ /* @__PURE__ */ jsx7(
1730
+ ResourceFields,
1731
+ {
1732
+ draft: resourceEdit.draft,
1733
+ disabled: editingDisabled,
1734
+ pathPlaceholder: key === "skills" ? "research/SKILL.md" : "tools/search.ts",
1735
+ onChange: (next) => setResourceEdit({ key, index, draft: next })
1736
+ }
1737
+ ),
1738
+ /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
1739
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: editingDisabled, onClick: applyResourceEdit, children: "Apply changes" }),
1740
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", onClick: () => setResourceEdit(null), children: "Cancel" })
1741
+ ] })
1742
+ ] })
1743
+ ] }, index)) }),
1744
+ /* @__PURE__ */ jsxs5("div", { className: "space-y-3 rounded-lg border border-dashed border-border p-3", children: [
1745
+ /* @__PURE__ */ jsx7(
1746
+ ResourceFields,
1552
1747
  {
1553
- className: "min-h-28",
1748
+ draft,
1554
1749
  disabled: editingDisabled,
1555
- value: draft.content,
1556
- onChange: (event) => change("content", event.target.value)
1750
+ pathPlaceholder: key === "skills" ? "research/SKILL.md" : "tools/search.ts",
1751
+ onChange: (next) => setResourceDrafts((current) => ({ ...current, [key]: next }))
1557
1752
  }
1558
- ) }) }),
1559
- /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsxs5(Button, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => addResource(key), children: [
1753
+ ),
1754
+ /* @__PURE__ */ jsxs5(Button, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => addResource(key), children: [
1560
1755
  "Add ",
1561
1756
  key === "skills" ? "skill" : "tool file"
1562
- ] }) })
1757
+ ] })
1563
1758
  ] }),
1564
- /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Repository, ref, and other options are available in Advanced JSON." })
1759
+ /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "GitHub files are fetched when the profile runs. Saving does not verify their contents or availability." })
1565
1760
  ] });
1566
1761
  }
1567
1762
  function addMcp() {
@@ -1598,6 +1793,11 @@ function AgentProfileEditor({ value, onChange, disabled = false, className }) {
1598
1793
  return /* @__PURE__ */ jsxs5("div", { className: "space-y-5 " + (className ?? ""), "aria-label": "Agent profile editor", children: [
1599
1794
  error && /* @__PURE__ */ jsx7("p", { role: "alert", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-destructive", children: error }),
1600
1795
  jsonDirty && /* @__PURE__ */ jsx7("p", { role: "status", className: "rounded-lg border border-border bg-muted p-3 text-sm text-foreground", children: "Apply or discard edits in Advanced JSON before using the other fields." }),
1796
+ unsupportedResources.length > 0 && /* @__PURE__ */ jsxs5("p", { role: "status", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-foreground", children: [
1797
+ "This profile contains resources this product does not support: ",
1798
+ unsupportedResources.map((kind) => RESOURCE_KIND_LABELS[kind] + " (" + configuredResourceCount(value, kind) + ")").join(", "),
1799
+ ". They remain in the profile. Review or remove them in Advanced JSON before saving."
1800
+ ] }),
1601
1801
  /* @__PURE__ */ jsxs5(Section, { title: "Profile", description: "Name the agent and set its instructions.", children: [
1602
1802
  /* @__PURE__ */ jsxs5("div", { className: "grid gap-4 sm:grid-cols-2", children: [
1603
1803
  /* @__PURE__ */ jsx7(Field, { label: "Name", children: /* @__PURE__ */ jsx7(Input, { disabled: editingDisabled, value: value.name ?? "", onChange: (event) => emit({ ...value, name: event.target.value }) }) }),
@@ -1726,10 +1926,10 @@ function AgentProfileEditor({ value, onChange, disabled = false, className }) {
1726
1926
  ] }),
1727
1927
  /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Nested permission rules remain in Advanced JSON." })
1728
1928
  ] }),
1729
- resourceSection("skills", "Skills", "Add skill packages from a repository or inline content."),
1730
- resourceSection("tools", "Tool files", "Provide files that a supported harness can discover as tools."),
1731
- /* @__PURE__ */ jsxs5(Disclosure, { title: "MCP servers", description: "Connect remote or local servers. Use secret references for credentials.", detail: Object.keys(value.mcp ?? {}).length + " connected", children: [
1732
- Object.keys(value.mcp ?? {}).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No servers added." }),
1929
+ allowsResource("skills") && resourceSection("skills", "Skills", "Add skill packages from a repository or inline content."),
1930
+ allowsResource("tools") && resourceSection("tools", "Tool files", "Provide files that a supported harness can discover as tools."),
1931
+ /* @__PURE__ */ jsxs5(Disclosure, { title: "MCP servers", description: "Configure remote or local servers. Use secret references for credentials.", detail: Object.keys(value.mcp ?? {}).length + " configured", children: [
1932
+ Object.keys(value.mcp ?? {}).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No servers configured." }),
1733
1933
  /* @__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: [
1734
1934
  /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1735
1935
  /* @__PURE__ */ jsx7("span", { className: "font-medium", children: name }),
@@ -1757,20 +1957,86 @@ function AgentProfileEditor({ value, onChange, disabled = false, className }) {
1757
1957
  ] }),
1758
1958
  /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Arguments, headers, environment, and secret references remain in Advanced JSON." })
1759
1959
  ] }),
1760
- /* @__PURE__ */ jsxs5(Disclosure, { title: "Resource files", description: "Mount files in the agent workspace. Edit paths and content in Advanced JSON.", detail: (value.resources?.files ?? []).length + " mounted", children: [
1761
- (value.resources?.files ?? []).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No files mounted." }),
1762
- /* @__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: [
1763
- /* @__PURE__ */ jsxs5("span", { className: "truncate", children: [
1764
- mount.path,
1765
- " ",
1766
- /* @__PURE__ */ jsxs5("span", { className: "text-muted-foreground", children: [
1767
- "\u2190 ",
1768
- mount.resource.kind === "github" ? mount.resource.path : mount.resource.name
1960
+ allowsResource("files") && /* @__PURE__ */ jsxs5(Disclosure, { title: "Resource files", description: "Configure files for the agent workspace. The runtime determines whether it can place them.", detail: (value.resources?.files ?? []).length + " configured", children: [
1961
+ (value.resources?.files ?? []).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No resource files configured." }),
1962
+ /* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: (value.resources?.files ?? []).map((mount, index) => /* @__PURE__ */ jsxs5("li", { className: "space-y-3 rounded-lg border border-border p-3 text-sm", "aria-label": "Resource file " + (index + 1), children: [
1963
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
1964
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1965
+ /* @__PURE__ */ jsx7("span", { className: "block break-words font-medium text-foreground", children: mount.path }),
1966
+ /* @__PURE__ */ jsxs5("span", { className: "block break-words text-xs " + (mount.resource.kind === "github" && !mount.resource.repository ? "text-destructive" : "text-muted-foreground"), children: [
1967
+ mount.resource.kind === "github" ? (mount.resource.repository ? mount.resource.repository + " / " : "Repository required \xB7 ") + mount.resource.path + (mount.resource.ref ? " @ " + mount.resource.ref : "") : "Inline \xB7 " + mount.resource.name,
1968
+ mount.executable ? " \xB7 executable" : ""
1969
+ ] })
1970
+ ] }),
1971
+ /* @__PURE__ */ jsxs5("div", { className: "flex shrink-0 gap-1", children: [
1972
+ /* @__PURE__ */ jsx7(
1973
+ Button,
1974
+ {
1975
+ type: "button",
1976
+ variant: "ghost",
1977
+ disabled: editingDisabled,
1978
+ "aria-label": "Edit resource file " + (index + 1),
1979
+ onClick: () => setFileEdit({ index, draft: fileDraft(mount) }),
1980
+ children: "Edit"
1981
+ }
1982
+ ),
1983
+ /* @__PURE__ */ jsx7(
1984
+ Button,
1985
+ {
1986
+ type: "button",
1987
+ variant: "ghost",
1988
+ className: "text-destructive",
1989
+ disabled: editingDisabled,
1990
+ "aria-label": "Remove resource file " + (index + 1),
1991
+ onClick: () => {
1992
+ if (emit({ ...value, resources: { ...value.resources, files: (value.resources?.files ?? []).filter((_, item) => item !== index) } })) setFileEdit(null);
1993
+ },
1994
+ children: "Remove"
1995
+ }
1996
+ )
1769
1997
  ] })
1770
1998
  ] }),
1771
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", className: "text-destructive", disabled: editingDisabled, onClick: () => emit({ ...value, resources: { ...value.resources, files: (value.resources?.files ?? []).filter((_, i) => i !== index) } }), children: "Remove" })
1999
+ mount.resource.kind === "inline" && fileEdit?.index !== index && /* @__PURE__ */ jsx7("pre", { className: "max-h-24 overflow-auto whitespace-pre-wrap break-words rounded-md bg-muted p-2 text-xs text-muted-foreground", children: mount.resource.content || "(Empty file)" }),
2000
+ fileEdit?.index === index && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 border-t border-border pt-3", children: [
2001
+ fileFields(fileEdit.draft, (draft) => setFileEdit({ index, draft })),
2002
+ /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
2003
+ /* @__PURE__ */ jsx7(
2004
+ Button,
2005
+ {
2006
+ type: "button",
2007
+ variant: "outline",
2008
+ disabled: editingDisabled,
2009
+ onClick: () => {
2010
+ if (saveFile(fileEdit.draft, index)) setFileEdit(null);
2011
+ },
2012
+ children: "Apply changes"
2013
+ }
2014
+ ),
2015
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", onClick: () => setFileEdit(null), children: "Cancel" })
2016
+ ] })
2017
+ ] })
1772
2018
  ] }, index)) }),
1773
- /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", 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" })
2019
+ addingFile ? /* @__PURE__ */ jsxs5("div", { className: "space-y-3 rounded-lg border border-dashed border-border p-3", children: [
2020
+ fileFields(newFile, setNewFile),
2021
+ /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
2022
+ /* @__PURE__ */ jsx7(
2023
+ Button,
2024
+ {
2025
+ type: "button",
2026
+ variant: "outline",
2027
+ disabled: editingDisabled,
2028
+ onClick: () => {
2029
+ if (saveFile(newFile)) {
2030
+ setNewFile({ path: "", resource: { ...emptyResourceDraft(), kind: "inline" }, executable: false });
2031
+ setAddingFile(false);
2032
+ }
2033
+ },
2034
+ children: "Add file"
2035
+ }
2036
+ ),
2037
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", onClick: () => setAddingFile(false), children: "Cancel" })
2038
+ ] })
2039
+ ] }) : /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: editingDisabled, onClick: () => setAddingFile(true), children: "Add file" })
1774
2040
  ] }),
1775
2041
  /* @__PURE__ */ jsxs5(Disclosure, { title: "Advanced JSON", description: "Edit the full canonical profile, including hooks, modes, connections, and extensions.", children: [
1776
2042
  /* @__PURE__ */ jsx7("label", { htmlFor: id + "-json", className: "sr-only", children: "Full profile JSON" }),
@@ -2330,7 +2596,7 @@ function segmentMentionContent(content, parts) {
2330
2596
 
2331
2597
  // src/web-react/mission-activity.tsx
2332
2598
  import { useCallback as useCallback5, useEffect as useEffect7, useState as useState11 } from "react";
2333
- import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2599
+ import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
2334
2600
  var LIVE_STATUSES = /* @__PURE__ */ new Set(["pending", "running"]);
2335
2601
  var OK_STATUSES = /* @__PURE__ */ new Set(["completed", "done", "succeeded"]);
2336
2602
  var ERROR_STATUSES = /* @__PURE__ */ new Set(["failed", "error", "cancelled", "aborted"]);
@@ -2541,11 +2807,11 @@ function ActivityRow({
2541
2807
  /* @__PURE__ */ jsx8("dd", { className: "truncate text-muted-foreground", children: record.taskId }),
2542
2808
  /* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "started" }),
2543
2809
  /* @__PURE__ */ jsx8("dd", { className: "text-muted-foreground", children: new Date(record.startedAt).toLocaleString() }),
2544
- duration && /* @__PURE__ */ jsxs6(Fragment2, { children: [
2810
+ duration && /* @__PURE__ */ jsxs6(Fragment3, { children: [
2545
2811
  /* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "duration" }),
2546
2812
  /* @__PURE__ */ jsx8("dd", { className: "text-muted-foreground", children: duration })
2547
2813
  ] }),
2548
- record.traceId && /* @__PURE__ */ jsxs6(Fragment2, { children: [
2814
+ record.traceId && /* @__PURE__ */ jsxs6(Fragment3, { children: [
2549
2815
  /* @__PURE__ */ jsx8("dt", { className: "text-muted-foreground/60", children: "trace" }),
2550
2816
  /* @__PURE__ */ jsx8("dd", { className: "min-w-0", children: /* @__PURE__ */ jsx8(TraceIdCopy, { traceId: record.traceId }) })
2551
2817
  ] })
@@ -3087,7 +3353,7 @@ function ProvenanceLegend({ bases, className }) {
3087
3353
  }
3088
3354
 
3089
3355
  // src/web-react/seat-paywall.tsx
3090
- import { Fragment as Fragment3, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3356
+ import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
3091
3357
  function usd(cents) {
3092
3358
  return new Intl.NumberFormat("en-US", {
3093
3359
  style: "currency",
@@ -3140,7 +3406,7 @@ function SeatPaywall({
3140
3406
  product
3141
3407
  ] }),
3142
3408
  tagline && /* @__PURE__ */ jsx10("p", { className: "mt-2 text-sm text-muted-foreground", children: tagline }),
3143
- introductory ? /* @__PURE__ */ jsxs8(Fragment3, { children: [
3409
+ introductory ? /* @__PURE__ */ jsxs8(Fragment4, { children: [
3144
3410
  /* @__PURE__ */ jsxs8("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
3145
3411
  /* @__PURE__ */ jsx10("span", { className: "text-3xl font-semibold text-foreground", children: usd(introductory.priceCents) }),
3146
3412
  /* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "first month" })
@@ -3157,7 +3423,7 @@ function SeatPaywall({
3157
3423
  recurringUsage,
3158
3424
  "/mo of AI usage"
3159
3425
  ] })
3160
- ] }) : /* @__PURE__ */ jsxs8(Fragment3, { children: [
3426
+ ] }) : /* @__PURE__ */ jsxs8(Fragment4, { children: [
3161
3427
  /* @__PURE__ */ jsxs8("div", { className: "mt-6 flex items-baseline gap-1.5", children: [
3162
3428
  /* @__PURE__ */ jsx10("span", { className: "text-3xl font-semibold text-foreground", children: recurringPrice }),
3163
3429
  /* @__PURE__ */ jsx10("span", { className: "text-sm text-muted-foreground", children: "/mo" })
@@ -3187,7 +3453,7 @@ function SeatPaywall({
3187
3453
 
3188
3454
  // src/web-react/record-grid.tsx
3189
3455
  import {
3190
- Fragment as Fragment4,
3456
+ Fragment as Fragment5,
3191
3457
  isValidElement,
3192
3458
  useCallback as useCallback7,
3193
3459
  useEffect as useEffect9,
@@ -4024,7 +4290,7 @@ function RecordGrid({
4024
4290
  const rowError = rowErrors[row.id];
4025
4291
  const rowDiff = reviewing ? diffByRow.get(row.id) : void 0;
4026
4292
  const removedRow = rowDiff?.kind === "removed";
4027
- return /* @__PURE__ */ jsxs9(Fragment4, { children: [
4293
+ return /* @__PURE__ */ jsxs9(Fragment5, { children: [
4028
4294
  /* @__PURE__ */ jsxs9(
4029
4295
  "tr",
4030
4296
  {
@@ -4628,7 +4894,7 @@ import {
4628
4894
  useState as useState14
4629
4895
  } from "react";
4630
4896
  import { createPortal } from "react-dom";
4631
- import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
4897
+ import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
4632
4898
  function SearchGlyph({ className }) {
4633
4899
  return /* @__PURE__ */ jsxs10("svg", { className, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: [
4634
4900
  /* @__PURE__ */ jsx12("circle", { cx: "11", cy: "11", r: "8" }),
@@ -4719,7 +4985,7 @@ function CommandPalette({
4719
4985
  if (!open || typeof document === "undefined") return null;
4720
4986
  let rowIndex = -1;
4721
4987
  return createPortal(
4722
- /* @__PURE__ */ jsxs10(Fragment5, { children: [
4988
+ /* @__PURE__ */ jsxs10(Fragment6, { children: [
4723
4989
  /* @__PURE__ */ jsx12(
4724
4990
  "div",
4725
4991
  {
@@ -4978,7 +5244,7 @@ import {
4978
5244
  useRef as useRef10,
4979
5245
  useState as useState15
4980
5246
  } from "react";
4981
- import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
5247
+ import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
4982
5248
  function insightDelta(value, previous) {
4983
5249
  if (typeof value !== "number" || !Number.isFinite(value)) return null;
4984
5250
  if (typeof previous !== "number" || !Number.isFinite(previous)) return null;
@@ -5052,7 +5318,7 @@ function InsightCard({
5052
5318
  /* @__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: [
5053
5319
  /* @__PURE__ */ jsx14("span", { "aria-hidden": "true", children: INSIGHT_UNAVAILABLE_GLYPH }),
5054
5320
  /* @__PURE__ */ jsx14("span", { className: "sr-only", children: INSIGHT_UNAVAILABLE_LABEL })
5055
- ] }) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
5321
+ ] }) : /* @__PURE__ */ jsxs12(Fragment7, { children: [
5056
5322
  /* @__PURE__ */ jsx14("span", { className: "text-xl font-semibold tabular-nums text-foreground", children: shown }),
5057
5323
  unit ? /* @__PURE__ */ jsx14("span", { className: "text-[11px] text-muted-foreground", children: unit }) : null
5058
5324
  ] }) }),
@@ -5593,7 +5859,7 @@ function ApiAccessPanel({
5593
5859
  }
5594
5860
 
5595
5861
  // src/web-react/index.tsx
5596
- import { Fragment as Fragment7, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
5862
+ import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
5597
5863
  function formatModelCost(msg, models) {
5598
5864
  if (msg.promptTokens == null && msg.completionTokens == null) return null;
5599
5865
  const pricing = models.find((m) => m.id === msg.modelUsed)?.pricing;
@@ -5852,7 +6118,7 @@ function ProposalCard({
5852
6118
  ] })
5853
6119
  ] }),
5854
6120
  /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap items-center gap-2 px-4 pb-3.5 pt-3", children: [
5855
- approval && /* @__PURE__ */ jsxs14(Fragment7, { children: [
6121
+ approval && /* @__PURE__ */ jsxs14(Fragment8, { children: [
5856
6122
  /* @__PURE__ */ jsx16(
5857
6123
  "button",
5858
6124
  {
@@ -6234,7 +6500,7 @@ function AssistantMessageImpl({
6234
6500
  toolRenderers,
6235
6501
  messageClassName
6236
6502
  }
6237
- ) : /* @__PURE__ */ jsxs14(Fragment7, { children: [
6503
+ ) : /* @__PURE__ */ jsxs14(Fragment8, { children: [
6238
6504
  /* @__PURE__ */ jsxs14("div", { className: messageClassName, children: [
6239
6505
  body,
6240
6506
  streaming && content && !msg.toolCalls?.length && /* @__PURE__ */ jsx16(StreamingCaret, {})
@@ -6358,12 +6624,12 @@ function ChatMessages({
6358
6624
  const quiet = chrome === "quiet";
6359
6625
  if (messages.length === 0 && !loading && !error) {
6360
6626
  const empty = renderEmpty ? renderEmpty() : /* @__PURE__ */ jsx16(ChatEmptyState, { ...emptyState });
6361
- return /* @__PURE__ */ jsxs14(Fragment7, { children: [
6627
+ return /* @__PURE__ */ jsxs14(Fragment8, { children: [
6362
6628
  header,
6363
6629
  empty
6364
6630
  ] });
6365
6631
  }
6366
- return /* @__PURE__ */ jsxs14(Fragment7, { children: [
6632
+ return /* @__PURE__ */ jsxs14(Fragment8, { children: [
6367
6633
  header,
6368
6634
  messages.map(
6369
6635
  (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: [
@@ -6544,4 +6810,4 @@ export {
6544
6810
  useThinkingSeconds,
6545
6811
  ChatMessages
6546
6812
  };
6547
- //# sourceMappingURL=chunk-ZNSR7RSQ.js.map
6813
+ //# sourceMappingURL=chunk-ES7OOOJV.js.map