@tangle-network/agent-app 0.50.25 → 0.50.27

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.
Files changed (32) hide show
  1. package/dist/assistant/index.js +1 -1
  2. package/dist/chat-routes/index.js +4 -4
  3. package/dist/{chunk-EA3GB7F4.js → chunk-KTV5RQBQ.js} +4 -4
  4. package/dist/{chunk-BPEIQWLK.js → chunk-M2SAK7ZH.js} +280 -146
  5. package/dist/chunk-M2SAK7ZH.js.map +1 -0
  6. package/dist/{chunk-6UBRYSED.js → chunk-QWYAR2CY.js} +2 -2
  7. package/dist/{chunk-VC3N3RZU.js → chunk-RFVTTZPG.js} +2 -2
  8. package/dist/{chunk-VC3N3RZU.js.map → chunk-RFVTTZPG.js.map} +1 -1
  9. package/dist/{chunk-EX2XVDPE.js → chunk-TJCTC5QI.js} +2 -2
  10. package/dist/hosted-agent/application-verification.d.ts +26 -0
  11. package/dist/hosted-agent/application.d.ts +3 -0
  12. package/dist/hosted-agent/application.js +33 -7
  13. package/dist/hosted-agent/application.js.map +1 -1
  14. package/dist/hosted-agent/react/ApplicationLineSetup.d.ts +10 -3
  15. package/dist/hosted-agent/react/LineSetup.d.ts +1 -1
  16. package/dist/hosted-agent/react/contracts.d.ts +9 -0
  17. package/dist/hosted-agent/react/index.d.ts +1 -1
  18. package/dist/hosted-agent/react/index.js +202 -72
  19. package/dist/hosted-agent/react/index.js.map +1 -1
  20. package/dist/hosted-agent/react/lines.css +14 -4
  21. package/dist/hosted-agent/workspace-line.d.ts +9 -2
  22. package/dist/preset-cloudflare/index.js +2 -2
  23. package/dist/sandbox/index.js +4 -4
  24. package/dist/tools/index.js +4 -4
  25. package/dist/web-react/agent-profile-editor.d.ts +13 -1
  26. package/dist/web-react/index.js +1 -1
  27. package/dist/work-product/index.js +2 -2
  28. package/package.json +11 -11
  29. package/dist/chunk-BPEIQWLK.js.map +0 -1
  30. /package/dist/{chunk-EA3GB7F4.js.map → chunk-KTV5RQBQ.js.map} +0 -0
  31. /package/dist/{chunk-6UBRYSED.js.map → chunk-QWYAR2CY.js.map} +0 -0
  32. /package/dist/{chunk-EX2XVDPE.js.map → chunk-TJCTC5QI.js.map} +0 -0
@@ -1482,13 +1482,39 @@ function resourceRef(draft) {
1482
1482
  ...draft.name.trim() ? { name: draft.name.trim() } : {}
1483
1483
  };
1484
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.";
1485
+ function validRelativePath(path) {
1486
+ return path.length <= 240 && !path.startsWith("/") && !path.includes("\\") && !/[\u0000-\u001f\u007f]/.test(path) && path.split("/").every((segment) => segment !== "" && segment !== "." && segment !== "..");
1487
+ }
1488
+ function normalizedFilePathPrefix(prefix) {
1489
+ const folder = prefix?.trim().replace(/\/+$/, "");
1490
+ return folder ? folder + "/" : void 0;
1491
+ }
1492
+ function resourceError(draft, requireGitHubCommitSha = false, stored = false) {
1493
+ const checked = stored ? draft : resourceDraft(resourceRef(draft));
1494
+ if (checked.kind === "inline") return checked.name.trim() ? null : "Enter a name for the inline file.";
1495
+ if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(checked.repository)) return "Enter a GitHub repository as owner/repo.";
1496
+ if (!checked.path) return "Enter a path within the GitHub repository.";
1497
+ if (requireGitHubCommitSha) {
1498
+ if (checked.repository.length > 200 || checked.repository.split("/").some((segment) => segment === "." || segment === "..")) {
1499
+ return "Enter a GitHub repository as owner/repo.";
1500
+ }
1501
+ if (!/^[0-9a-f]{40}$/i.test(checked.ref)) return "Enter a 40-character GitHub commit SHA.";
1502
+ if (!validRelativePath(checked.path) || /[?#%]/.test(checked.path)) return "Enter a relative repository path without traversal or URL characters.";
1503
+ if (checked.name && (!checked.name.trim() || checked.name.length > 160 || /[\u0000-\u001f\u007f]/.test(checked.name))) {
1504
+ return "Enter a short file name without control characters.";
1505
+ }
1506
+ }
1489
1507
  return null;
1490
1508
  }
1491
- function ResourceFields({ draft, onChange, disabled, pathPlaceholder }) {
1509
+ function skillNameError(draft, refs, index, stored = false) {
1510
+ const name = stored ? draft.name : draft.name.trim();
1511
+ if (!/^[a-z0-9][a-z0-9._-]{0,63}$/.test(name)) {
1512
+ return "Enter a lowercase skill name of up to 64 letters, numbers, dots, dashes, or underscores.";
1513
+ }
1514
+ if (refs.some((ref, item) => item !== index && ref.name === name)) return "A skill with that name already exists.";
1515
+ return null;
1516
+ }
1517
+ function ResourceFields({ draft, onChange, disabled, pathPlaceholder, requireGitHubCommitSha, requireSkillName }) {
1492
1518
  function change(field, text) {
1493
1519
  onChange({ ...draft, [field]: text });
1494
1520
  }
@@ -1519,33 +1545,48 @@ function ResourceFields({ draft, onChange, disabled, pathPlaceholder }) {
1519
1545
  placeholder: pathPlaceholder
1520
1546
  }
1521
1547
  ) }),
1522
- /* @__PURE__ */ jsx7(Field, { label: "Ref", hint: "Defaults to the main branch", children: /* @__PURE__ */ jsx7(
1548
+ /* @__PURE__ */ jsx7(Field, { label: requireGitHubCommitSha ? "Commit SHA" : "Ref", hint: requireGitHubCommitSha ? "Use the full 40-character SHA of a fixed commit." : "Defaults to the main branch", children: /* @__PURE__ */ jsx7(
1523
1549
  Input,
1524
1550
  {
1525
1551
  disabled,
1526
1552
  value: draft.ref,
1527
1553
  onChange: (event) => change("ref", event.target.value),
1528
- placeholder: "main"
1554
+ placeholder: requireGitHubCommitSha ? "40-character commit SHA" : "main"
1529
1555
  }
1530
1556
  ) }),
1531
- /* @__PURE__ */ jsx7(Field, { label: "Name", hint: "Defaults to the source filename", children: /* @__PURE__ */ jsx7(
1532
- Input,
1557
+ /* @__PURE__ */ jsx7(
1558
+ Field,
1533
1559
  {
1534
- disabled,
1535
- value: draft.name,
1536
- onChange: (event) => change("name", event.target.value)
1560
+ label: requireSkillName ? "Skill name" : "Name",
1561
+ hint: requireSkillName ? "Unique lowercase name, up to 64 letters, numbers, dots, dashes, or underscores." : "Defaults to the source filename",
1562
+ children: /* @__PURE__ */ jsx7(
1563
+ Input,
1564
+ {
1565
+ disabled,
1566
+ value: draft.name,
1567
+ onChange: (event) => change("name", event.target.value),
1568
+ placeholder: requireSkillName ? "research" : void 0
1569
+ }
1570
+ )
1537
1571
  }
1538
- ) })
1572
+ )
1539
1573
  ] }) : /* @__PURE__ */ jsxs5(Fragment2, { children: [
1540
- /* @__PURE__ */ jsx7(Field, { label: "File name", children: /* @__PURE__ */ jsx7(
1541
- Input,
1574
+ /* @__PURE__ */ jsx7(
1575
+ Field,
1542
1576
  {
1543
- disabled,
1544
- value: draft.name,
1545
- onChange: (event) => change("name", event.target.value),
1546
- placeholder: "guide.md"
1577
+ label: requireSkillName ? "Skill name" : "File name",
1578
+ hint: requireSkillName ? "Unique lowercase name, up to 64 letters, numbers, dots, dashes, or underscores." : void 0,
1579
+ children: /* @__PURE__ */ jsx7(
1580
+ Input,
1581
+ {
1582
+ disabled,
1583
+ value: draft.name,
1584
+ onChange: (event) => change("name", event.target.value),
1585
+ placeholder: requireSkillName ? "research" : "guide.md"
1586
+ }
1587
+ )
1547
1588
  }
1548
- ) }),
1589
+ ),
1549
1590
  /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: "Content", children: /* @__PURE__ */ jsx7(
1550
1591
  Textarea,
1551
1592
  {
@@ -1564,17 +1605,57 @@ function fileDraft(mount) {
1564
1605
  function fileMount(draft) {
1565
1606
  return { path: draft.path.trim(), resource: resourceRef(draft.resource), ...draft.executable ? { executable: true } : {} };
1566
1607
  }
1567
- function AgentProfileEditor({ value, onChange, disabled = false, className, allowedResourceKinds }) {
1608
+ function fileIssues(draft, filePathPrefix, allowExecutableFiles, requireGitHubCommitSha, stored = false) {
1609
+ const issues = [];
1610
+ const path = stored ? draft.path : draft.path.trim();
1611
+ if (!path) issues.push("Enter a workspace path for the file.");
1612
+ else if (filePathPrefix && (!path.startsWith(filePathPrefix) || !validRelativePath(path))) {
1613
+ issues.push("Enter a relative workspace path under " + filePathPrefix + " without traversal.");
1614
+ }
1615
+ if (!allowExecutableFiles && draft.executable) issues.push("Executable resource files are not allowed.");
1616
+ const resourceIssue = resourceError(draft.resource, requireGitHubCommitSha, stored);
1617
+ if (resourceIssue) issues.push(resourceIssue);
1618
+ return issues;
1619
+ }
1620
+ function publicHttpsMcpError(server) {
1621
+ if (server.enabled === false) return null;
1622
+ if (!("url" in server) || !server.url) return "Use a public HTTPS MCP endpoint.";
1623
+ try {
1624
+ const url = new URL(server.url);
1625
+ if (url.protocol === "https:" && !url.username && !url.password && !url.search && !url.hash && url.hostname.includes(".") && !/^\d+\.\d+\.\d+\.\d+$/.test(url.hostname) && !url.hostname.includes(":") && !url.hostname.endsWith(".local") && !url.hostname.endsWith(".internal")) return null;
1626
+ } catch {
1627
+ }
1628
+ return "Use a public HTTPS MCP endpoint without credentials, query, fragment, or local address.";
1629
+ }
1630
+ function AgentProfileEditor({
1631
+ value,
1632
+ onChange,
1633
+ disabled = false,
1634
+ className,
1635
+ allowedResourceKinds,
1636
+ filePathPrefix,
1637
+ allowExecutableFiles = true,
1638
+ requireGitHubCommitSha = false,
1639
+ requireUniqueSkillNames = false,
1640
+ showToolsAndPermissions = true,
1641
+ publicHttpsMcpOnly = false
1642
+ }) {
1568
1643
  const id = useId();
1644
+ const workspaceFilePrefix = normalizedFilePathPrefix(filePathPrefix);
1569
1645
  const [error, setError] = useState7(null);
1570
1646
  const [newTool, setNewTool] = useState7("");
1571
1647
  const [showAllTools, setShowAllTools] = useState7(false);
1572
1648
  const [mcpName, setMcpName] = useState7("");
1573
1649
  const [mcpKind, setMcpKind] = useState7("http");
1650
+ const selectedMcpKind = publicHttpsMcpOnly && mcpKind === "stdio" ? "http" : mcpKind;
1574
1651
  const [mcpTarget, setMcpTarget] = useState7("");
1575
1652
  const [resourceDrafts, setResourceDrafts] = useState7({ skills: emptyResourceDraft(), tools: emptyResourceDraft() });
1576
1653
  const [resourceEdit, setResourceEdit] = useState7(null);
1577
- const [newFile, setNewFile] = useState7({ path: "", resource: { ...emptyResourceDraft(), kind: "inline" }, executable: false });
1654
+ const [newFile, setNewFile] = useState7(() => ({
1655
+ path: normalizedFilePathPrefix(filePathPrefix) ?? "",
1656
+ resource: { ...emptyResourceDraft(), kind: "inline" },
1657
+ executable: false
1658
+ }));
1578
1659
  const [addingFile, setAddingFile] = useState7(false);
1579
1660
  const [fileEdit, setFileEdit] = useState7(null);
1580
1661
  const [json, setJson] = useState7(() => JSON.stringify(value, null, 2));
@@ -1585,6 +1666,11 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1585
1666
  const editingDisabled = disabled || jsonDirty;
1586
1667
  const allowsResource = (kind) => !allowedResourceKinds || allowedResourceKinds.includes(kind);
1587
1668
  const unsupportedResources = Object.keys(RESOURCE_KIND_LABELS).filter((kind) => !allowsResource(kind) && configuredResourceCount(value, kind) > 0);
1669
+ const skills = value.resources?.skills ?? [];
1670
+ const toolFiles = value.resources?.tools ?? [];
1671
+ const instructions = value.resources?.instructions;
1672
+ const constrainedEntryCount = workspaceFilePrefix || !allowExecutableFiles || requireGitHubCommitSha || requireUniqueSkillNames ? (value.resources?.files ?? []).filter((mount) => fileIssues(fileDraft(mount), workspaceFilePrefix, allowExecutableFiles, requireGitHubCommitSha, true).length > 0).length + skills.filter((ref, index) => resourceIssue("skills", resourceDraft(ref), skills, index, true)).length + toolFiles.filter((ref, index) => requireGitHubCommitSha && resourceIssue("tools", resourceDraft(ref), toolFiles, index, true)).length + Number(Boolean(requireGitHubCommitSha && instructions && typeof instructions === "object" && resourceError(resourceDraft(instructions), true, true))) : 0;
1673
+ const invalidMcpCount = publicHttpsMcpOnly ? Object.values(value.mcp ?? {}).filter((server) => publicHttpsMcpError(server)).length : 0;
1588
1674
  function emit(next) {
1589
1675
  if (jsonDirty) {
1590
1676
  setError("Apply or discard JSON edits first.");
@@ -1608,23 +1694,26 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1608
1694
  function resources(key, refs) {
1609
1695
  return emit({ ...value, resources: { ...value.resources, [key]: refs } });
1610
1696
  }
1697
+ function resourceIssue(key, draft, refs, index, stored = false) {
1698
+ if (key === "skills" && requireUniqueSkillNames) {
1699
+ const issue = skillNameError(draft, refs, index, stored);
1700
+ if (issue) return issue;
1701
+ }
1702
+ return resourceError(draft, requireGitHubCommitSha, stored);
1703
+ }
1611
1704
  function addResource(key) {
1612
1705
  const draft = resourceDrafts[key];
1613
- const issue = resourceError(draft);
1706
+ const refs = value.resources?.[key] ?? [];
1707
+ const issue = resourceIssue(key, draft, refs);
1614
1708
  if (issue) {
1615
1709
  setError(issue);
1616
1710
  return;
1617
1711
  }
1618
- if (!resources(key, [...value.resources?.[key] ?? [], resourceRef(draft)])) return;
1712
+ if (!resources(key, [...refs, resourceRef(draft)])) return;
1619
1713
  setResourceDrafts((current) => ({ ...current, [key]: emptyResourceDraft() }));
1620
1714
  }
1621
1715
  function applyResourceEdit() {
1622
1716
  if (!resourceEdit) return;
1623
- const issue = resourceError(resourceEdit.draft);
1624
- if (issue) {
1625
- setError(issue);
1626
- return;
1627
- }
1628
1717
  const { key, index, draft } = resourceEdit;
1629
1718
  const refs = value.resources?.[key] ?? [];
1630
1719
  if (!refs[index]) {
@@ -1632,15 +1721,16 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1632
1721
  setResourceEdit(null);
1633
1722
  return;
1634
1723
  }
1724
+ const issue = resourceIssue(key, draft, refs, index);
1725
+ if (issue) {
1726
+ setError(issue);
1727
+ return;
1728
+ }
1635
1729
  if (resources(key, refs.map((ref, item) => item === index ? resourceRef(draft) : ref))) setResourceEdit(null);
1636
1730
  }
1637
1731
  function saveFile(draft, index) {
1638
1732
  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);
1733
+ const issue = fileIssues(draft, workspaceFilePrefix, allowExecutableFiles, requireGitHubCommitSha)[0];
1644
1734
  if (issue) {
1645
1735
  setError(issue);
1646
1736
  return false;
@@ -1655,13 +1745,13 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1655
1745
  }
1656
1746
  function fileFields(draft, onChange2) {
1657
1747
  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(
1748
+ /* @__PURE__ */ jsx7(Field, { label: "Workspace path", hint: workspaceFilePrefix ? "Place this file under " + workspaceFilePrefix : "Relative to the agent workspace", children: /* @__PURE__ */ jsx7(
1659
1749
  Input,
1660
1750
  {
1661
1751
  disabled: editingDisabled,
1662
1752
  value: draft.path,
1663
1753
  onChange: (event) => onChange2({ ...draft, path: event.target.value }),
1664
- placeholder: "docs/guide.md"
1754
+ placeholder: workspaceFilePrefix ? workspaceFilePrefix + "guide.md" : "docs/guide.md"
1665
1755
  }
1666
1756
  ) }),
1667
1757
  /* @__PURE__ */ jsx7(
@@ -1670,20 +1760,23 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1670
1760
  draft: draft.resource,
1671
1761
  disabled: editingDisabled,
1672
1762
  pathPlaceholder: "docs/guide.md",
1763
+ requireGitHubCommitSha,
1673
1764
  onChange: (resource) => onChange2({ ...draft, resource })
1674
1765
  }
1675
1766
  ),
1676
- /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-sm text-foreground", children: [
1767
+ allowExecutableFiles || draft.executable ? /* @__PURE__ */ jsxs5("label", { className: "flex items-center gap-2 text-sm text-foreground", children: [
1677
1768
  /* @__PURE__ */ jsx7(
1678
1769
  Switch,
1679
1770
  {
1680
- disabled: editingDisabled,
1771
+ disabled: editingDisabled || !allowExecutableFiles && !draft.executable,
1681
1772
  checked: draft.executable,
1682
- onCheckedChange: (executable) => onChange2({ ...draft, executable })
1773
+ onCheckedChange: (executable) => {
1774
+ if (allowExecutableFiles || !executable) onChange2({ ...draft, executable });
1775
+ }
1683
1776
  }
1684
1777
  ),
1685
1778
  "Executable file"
1686
- ] })
1779
+ ] }) : /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Executable files are unavailable for this profile." })
1687
1780
  ] });
1688
1781
  }
1689
1782
  function resourceSection(key, title, description) {
@@ -1691,62 +1784,73 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1691
1784
  const draft = resourceDrafts[key];
1692
1785
  return /* @__PURE__ */ jsxs5(Disclosure, { title, description, detail: refs.length ? refs.length + " configured" : "Optional", children: [
1693
1786
  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" })
1787
+ /* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: refs.map((ref, index) => {
1788
+ const issue = resourceIssue(key, resourceDraft(ref), refs, index, true);
1789
+ return /* @__PURE__ */ jsxs5("li", { className: "space-y-3 rounded-lg border border-border p-3 text-sm", "aria-label": title + " " + (index + 1), children: [
1790
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
1791
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1792
+ /* @__PURE__ */ jsx7("span", { className: "block break-words font-medium text-foreground", children: ref.name || (ref.kind === "github" ? ref.path : "Inline resource") }),
1793
+ /* @__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" })
1794
+ ] }),
1795
+ /* @__PURE__ */ jsxs5("div", { className: "flex shrink-0 gap-1", children: [
1796
+ /* @__PURE__ */ jsx7(
1797
+ Button,
1798
+ {
1799
+ type: "button",
1800
+ variant: "ghost",
1801
+ disabled: editingDisabled,
1802
+ "aria-label": "Edit " + title.toLowerCase() + " " + (index + 1),
1803
+ onClick: () => setResourceEdit({ key, index, draft: resourceDraft(ref) }),
1804
+ children: "Edit"
1805
+ }
1806
+ ),
1807
+ /* @__PURE__ */ jsx7(
1808
+ Button,
1809
+ {
1810
+ type: "button",
1811
+ variant: "ghost",
1812
+ className: "text-destructive",
1813
+ disabled: editingDisabled,
1814
+ "aria-label": "Remove " + title.toLowerCase() + " " + (index + 1),
1815
+ onClick: () => {
1816
+ if (resources(key, refs.filter((_, item) => item !== index))) setResourceEdit(null);
1817
+ },
1818
+ children: "Remove"
1819
+ }
1820
+ )
1821
+ ] })
1699
1822
  ] }),
1700
- /* @__PURE__ */ jsxs5("div", { className: "flex shrink-0 gap-1", children: [
1823
+ (requireGitHubCommitSha || key === "skills" && requireUniqueSkillNames) && issue && /* @__PURE__ */ jsxs5("p", { className: "text-xs text-destructive", children: [
1824
+ issue,
1825
+ " Edit this resource before saving."
1826
+ ] }),
1827
+ resourceEdit?.key === key && resourceEdit.index === index && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 border-t border-border pt-3", children: [
1701
1828
  /* @__PURE__ */ jsx7(
1702
- Button,
1829
+ ResourceFields,
1703
1830
  {
1704
- type: "button",
1705
- variant: "ghost",
1831
+ draft: resourceEdit.draft,
1706
1832
  disabled: editingDisabled,
1707
- "aria-label": "Edit " + title.toLowerCase() + " " + (index + 1),
1708
- onClick: () => setResourceEdit({ key, index, draft: resourceDraft(ref) }),
1709
- children: "Edit"
1833
+ requireGitHubCommitSha,
1834
+ requireSkillName: key === "skills" && requireUniqueSkillNames,
1835
+ pathPlaceholder: key === "skills" ? "research/SKILL.md" : "tools/search.ts",
1836
+ onChange: (next) => setResourceEdit({ key, index, draft: next })
1710
1837
  }
1711
1838
  ),
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
- )
1726
- ] })
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" })
1839
+ /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
1840
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: editingDisabled, onClick: applyResourceEdit, children: "Apply changes" }),
1841
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", onClick: () => setResourceEdit(null), children: "Cancel" })
1842
+ ] })
1741
1843
  ] })
1742
- ] })
1743
- ] }, index)) }),
1844
+ ] }, index);
1845
+ }) }),
1744
1846
  /* @__PURE__ */ jsxs5("div", { className: "space-y-3 rounded-lg border border-dashed border-border p-3", children: [
1745
1847
  /* @__PURE__ */ jsx7(
1746
1848
  ResourceFields,
1747
1849
  {
1748
1850
  draft,
1749
1851
  disabled: editingDisabled,
1852
+ requireGitHubCommitSha,
1853
+ requireSkillName: key === "skills" && requireUniqueSkillNames,
1750
1854
  pathPlaceholder: key === "skills" ? "research/SKILL.md" : "tools/search.ts",
1751
1855
  onChange: (next) => setResourceDrafts((current) => ({ ...current, [key]: next }))
1752
1856
  }
@@ -1770,7 +1874,14 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1770
1874
  setError("A server with that name already exists.");
1771
1875
  return;
1772
1876
  }
1773
- const server = mcpKind === "stdio" ? { command: target } : { transport: mcpKind, url: target };
1877
+ const server = selectedMcpKind === "stdio" ? { command: target } : { transport: selectedMcpKind, url: target };
1878
+ if (publicHttpsMcpOnly) {
1879
+ const issue = publicHttpsMcpError(server);
1880
+ if (issue) {
1881
+ setError(issue);
1882
+ return;
1883
+ }
1884
+ }
1774
1885
  if (emit({ ...value, mcp: { ...value.mcp, [name]: server } })) {
1775
1886
  setMcpName("");
1776
1887
  setMcpTarget("");
@@ -1798,6 +1909,18 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1798
1909
  unsupportedResources.map((kind) => RESOURCE_KIND_LABELS[kind] + " (" + configuredResourceCount(value, kind) + ")").join(", "),
1799
1910
  ". They remain in the profile. Review or remove them in Advanced JSON before saving."
1800
1911
  ] }),
1912
+ constrainedEntryCount > 0 && /* @__PURE__ */ jsxs5("p", { role: "status", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-foreground", children: [
1913
+ constrainedEntryCount,
1914
+ " configured resource ",
1915
+ constrainedEntryCount === 1 ? "entry needs" : "entries need",
1916
+ " repair before this product can save the profile. Review the resource sections or Advanced JSON. Existing values remain unchanged until you edit them."
1917
+ ] }),
1918
+ invalidMcpCount > 0 && /* @__PURE__ */ jsxs5("p", { role: "status", className: "rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm text-foreground", children: [
1919
+ invalidMcpCount,
1920
+ " configured MCP ",
1921
+ invalidMcpCount === 1 ? "server needs" : "servers need",
1922
+ " a public HTTPS endpoint before this product can save the profile. Review MCP servers or Advanced JSON. Existing values remain unchanged until you edit them."
1923
+ ] }),
1801
1924
  /* @__PURE__ */ jsxs5(Section, { title: "Profile", description: "Name the agent and set its instructions.", children: [
1802
1925
  /* @__PURE__ */ jsxs5("div", { className: "grid gap-4 sm:grid-cols-2", children: [
1803
1926
  /* @__PURE__ */ jsx7(Field, { label: "Name", children: /* @__PURE__ */ jsx7(Input, { disabled: editingDisabled, value: value.name ?? "", onChange: (event) => emit({ ...value, name: event.target.value }) }) }),
@@ -1867,7 +1990,7 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1867
1990
  ] })
1868
1991
  ] })
1869
1992
  ] }),
1870
- /* @__PURE__ */ jsxs5(Disclosure, { title: "Tools and permissions", description: "Choose which tools are available and when each needs approval.", detail: Object.keys(value.tools ?? {}).length + " configured", children: [
1993
+ showToolsAndPermissions && /* @__PURE__ */ jsxs5(Disclosure, { title: "Tools and permissions", description: "Choose which tools are available and when each needs approval.", detail: Object.keys(value.tools ?? {}).length + " configured", children: [
1871
1994
  Object.keys(value.tools ?? {}).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No tool rules added." }),
1872
1995
  /* @__PURE__ */ jsx7("div", { className: "space-y-2", children: Object.entries(value.tools ?? {}).slice(0, showAllTools ? void 0 : 4).map(([name, enabled]) => /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-center gap-3 rounded-lg border border-border p-3 text-sm", children: [
1873
1996
  /* @__PURE__ */ jsxs5("label", { className: "flex min-w-32 flex-1 items-center gap-2", children: [
@@ -1928,13 +2051,17 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1928
2051
  ] }),
1929
2052
  allowsResource("skills") && resourceSection("skills", "Skills", "Add skill packages from a repository or inline content."),
1930
2053
  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: [
2054
+ /* @__PURE__ */ jsxs5(Disclosure, { title: "MCP servers", description: publicHttpsMcpOnly ? "Configure public HTTPS servers. Use secret references for credentials." : "Configure remote or local servers. Use secret references for credentials.", detail: Object.keys(value.mcp ?? {}).length + " configured", children: [
1932
2055
  Object.keys(value.mcp ?? {}).length === 0 && /* @__PURE__ */ jsx7("p", { className: "text-sm text-muted-foreground", children: "No servers configured." }),
1933
2056
  /* @__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: [
1934
2057
  /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
1935
2058
  /* @__PURE__ */ jsx7("span", { className: "font-medium", children: name }),
1936
2059
  /* @__PURE__ */ jsx7("span", { className: "ml-2 text-xs text-muted-foreground", children: server.enabled === false ? "Disabled" : "command" in server ? "Local" : "Remote" }),
1937
- server.enabled !== false && /* @__PURE__ */ jsx7("p", { className: "truncate text-xs text-muted-foreground", children: "command" in server ? server.command : server.url })
2060
+ server.enabled !== false && /* @__PURE__ */ jsx7("p", { className: "truncate text-xs text-muted-foreground", children: "command" in server ? server.command : server.url }),
2061
+ publicHttpsMcpOnly && publicHttpsMcpError(server) && /* @__PURE__ */ jsxs5("p", { className: "text-xs text-destructive", children: [
2062
+ publicHttpsMcpError(server),
2063
+ " Remove this server or edit it in Advanced JSON before saving."
2064
+ ] })
1938
2065
  ] }),
1939
2066
  /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", className: "text-destructive", disabled: editingDisabled, onClick: () => {
1940
2067
  const mcp = { ...value.mcp };
@@ -1944,78 +2071,85 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
1944
2071
  ] }, name)) }),
1945
2072
  /* @__PURE__ */ jsxs5("div", { className: "grid gap-3 rounded-lg border border-dashed border-border p-3 sm:grid-cols-[1fr_10rem]", children: [
1946
2073
  /* @__PURE__ */ jsx7(Field, { label: "Server name", children: /* @__PURE__ */ jsx7(Input, { disabled: editingDisabled, value: mcpName, onChange: (event) => setMcpName(event.target.value), placeholder: "search" }) }),
1947
- /* @__PURE__ */ jsx7(Field, { label: "Transport", children: /* @__PURE__ */ jsxs5(Select, { disabled: editingDisabled, value: mcpKind, onValueChange: (kind) => setMcpKind(kind), children: [
2074
+ /* @__PURE__ */ jsx7(Field, { label: "Transport", children: /* @__PURE__ */ jsxs5(Select, { disabled: editingDisabled, value: selectedMcpKind, onValueChange: (kind) => setMcpKind(kind), children: [
1948
2075
  /* @__PURE__ */ jsx7(SelectTrigger, { "aria-label": "Transport", children: /* @__PURE__ */ jsx7(SelectValue, {}) }),
1949
2076
  /* @__PURE__ */ jsxs5(SelectContent, { children: [
1950
2077
  /* @__PURE__ */ jsx7(SelectItem, { value: "http", children: "HTTP" }),
1951
2078
  /* @__PURE__ */ jsx7(SelectItem, { value: "sse", children: "SSE" }),
1952
- /* @__PURE__ */ jsx7(SelectItem, { value: "stdio", children: "Local command" })
2079
+ !publicHttpsMcpOnly && /* @__PURE__ */ jsx7(SelectItem, { value: "stdio", children: "Local command" })
1953
2080
  ] })
1954
2081
  ] }) }),
1955
- /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: mcpKind === "stdio" ? "Command" : "URL", children: /* @__PURE__ */ jsx7(Input, { disabled: editingDisabled, value: mcpTarget, onChange: (event) => setMcpTarget(event.target.value), placeholder: mcpKind === "stdio" ? "mcp-server" : "https://example.com/mcp" }) }) }),
2082
+ /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Field, { label: selectedMcpKind === "stdio" ? "Command" : "URL", children: /* @__PURE__ */ jsx7(Input, { disabled: editingDisabled, value: mcpTarget, onChange: (event) => setMcpTarget(event.target.value), placeholder: selectedMcpKind === "stdio" ? "mcp-server" : "https://example.com/mcp" }) }) }),
1956
2083
  /* @__PURE__ */ jsx7("div", { className: "sm:col-span-2", children: /* @__PURE__ */ jsx7(Button, { type: "button", variant: "outline", disabled: editingDisabled, onClick: addMcp, children: "Add server" }) })
1957
2084
  ] }),
1958
2085
  /* @__PURE__ */ jsx7("p", { className: "text-xs text-muted-foreground", children: "Arguments, headers, environment, and secret references remain in Advanced JSON." })
1959
2086
  ] }),
1960
2087
  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
2088
  (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" : ""
2089
+ /* @__PURE__ */ jsx7("ul", { className: "space-y-2", children: (value.resources?.files ?? []).map((mount, index) => {
2090
+ const issues = fileIssues(fileDraft(mount), workspaceFilePrefix, allowExecutableFiles, requireGitHubCommitSha, true);
2091
+ return /* @__PURE__ */ jsxs5("li", { className: "space-y-3 rounded-lg border border-border p-3 text-sm", "aria-label": "Resource file " + (index + 1), children: [
2092
+ /* @__PURE__ */ jsxs5("div", { className: "flex flex-wrap items-start justify-between gap-2", children: [
2093
+ /* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
2094
+ /* @__PURE__ */ jsx7("span", { className: "block break-words font-medium text-foreground", children: mount.path }),
2095
+ /* @__PURE__ */ jsxs5("span", { className: "block break-words text-xs " + (mount.resource.kind === "github" && !mount.resource.repository ? "text-destructive" : "text-muted-foreground"), children: [
2096
+ mount.resource.kind === "github" ? (mount.resource.repository ? mount.resource.repository + " / " : "Repository required \xB7 ") + mount.resource.path + (mount.resource.ref ? " @ " + mount.resource.ref : "") : "Inline \xB7 " + mount.resource.name,
2097
+ mount.executable ? " \xB7 executable" : ""
2098
+ ] })
2099
+ ] }),
2100
+ /* @__PURE__ */ jsxs5("div", { className: "flex shrink-0 gap-1", children: [
2101
+ /* @__PURE__ */ jsx7(
2102
+ Button,
2103
+ {
2104
+ type: "button",
2105
+ variant: "ghost",
2106
+ disabled: editingDisabled,
2107
+ "aria-label": "Edit resource file " + (index + 1),
2108
+ onClick: () => setFileEdit({ index, draft: fileDraft(mount) }),
2109
+ children: "Edit"
2110
+ }
2111
+ ),
2112
+ /* @__PURE__ */ jsx7(
2113
+ Button,
2114
+ {
2115
+ type: "button",
2116
+ variant: "ghost",
2117
+ className: "text-destructive",
2118
+ disabled: editingDisabled,
2119
+ "aria-label": "Remove resource file " + (index + 1),
2120
+ onClick: () => {
2121
+ if (emit({ ...value, resources: { ...value.resources, files: (value.resources?.files ?? []).filter((_, item) => item !== index) } })) setFileEdit(null);
2122
+ },
2123
+ children: "Remove"
2124
+ }
2125
+ )
1969
2126
  ] })
1970
2127
  ] }),
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
- )
1997
- ] })
1998
- ] }),
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" })
2128
+ issues.length > 0 && /* @__PURE__ */ jsx7("div", { className: "space-y-1 text-xs text-destructive", children: issues.map((issue) => /* @__PURE__ */ jsxs5("p", { children: [
2129
+ issue,
2130
+ " Edit this file before saving."
2131
+ ] }, issue)) }),
2132
+ 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)" }),
2133
+ fileEdit?.index === index && /* @__PURE__ */ jsxs5("div", { className: "space-y-3 border-t border-border pt-3", children: [
2134
+ fileFields(fileEdit.draft, (draft) => setFileEdit({ index, draft })),
2135
+ /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
2136
+ /* @__PURE__ */ jsx7(
2137
+ Button,
2138
+ {
2139
+ type: "button",
2140
+ variant: "outline",
2141
+ disabled: editingDisabled,
2142
+ onClick: () => {
2143
+ if (saveFile(fileEdit.draft, index)) setFileEdit(null);
2144
+ },
2145
+ children: "Apply changes"
2146
+ }
2147
+ ),
2148
+ /* @__PURE__ */ jsx7(Button, { type: "button", variant: "ghost", onClick: () => setFileEdit(null), children: "Cancel" })
2149
+ ] })
2016
2150
  ] })
2017
- ] })
2018
- ] }, index)) }),
2151
+ ] }, index);
2152
+ }) }),
2019
2153
  addingFile ? /* @__PURE__ */ jsxs5("div", { className: "space-y-3 rounded-lg border border-dashed border-border p-3", children: [
2020
2154
  fileFields(newFile, setNewFile),
2021
2155
  /* @__PURE__ */ jsxs5("div", { className: "flex gap-2", children: [
@@ -2027,7 +2161,7 @@ function AgentProfileEditor({ value, onChange, disabled = false, className, allo
2027
2161
  disabled: editingDisabled,
2028
2162
  onClick: () => {
2029
2163
  if (saveFile(newFile)) {
2030
- setNewFile({ path: "", resource: { ...emptyResourceDraft(), kind: "inline" }, executable: false });
2164
+ setNewFile({ path: workspaceFilePrefix ?? "", resource: { ...emptyResourceDraft(), kind: "inline" }, executable: false });
2031
2165
  setAddingFile(false);
2032
2166
  }
2033
2167
  },
@@ -6811,4 +6945,4 @@ export {
6811
6945
  useThinkingSeconds,
6812
6946
  ChatMessages
6813
6947
  };
6814
- //# sourceMappingURL=chunk-BPEIQWLK.js.map
6948
+ //# sourceMappingURL=chunk-M2SAK7ZH.js.map