@tutti-os/agent-gui 0.0.23 → 0.0.25

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 (30) hide show
  1. package/dist/AgentMessageMarkdown-BnpM_dCB.d.ts +658 -0
  2. package/dist/agent-conversation/index.d.ts +5 -14
  3. package/dist/agent-conversation/index.js +3 -3
  4. package/dist/agent-message-center/index.d.ts +2 -2
  5. package/dist/agent-message-center/index.js +3 -3
  6. package/dist/{agentConversationVM-CGYkOuOP.d.ts → agentConversationVM-BvlmCNOm.d.ts} +2 -2
  7. package/dist/app/renderer/agentactivity.css +21 -28
  8. package/dist/{chunk-MQAGIHYM.js → chunk-3QDLVPMJ.js} +36 -4
  9. package/dist/chunk-3QDLVPMJ.js.map +1 -0
  10. package/dist/{chunk-3LVEFR2N.js → chunk-5PIXN7UF.js} +15 -14
  11. package/dist/{chunk-3LVEFR2N.js.map → chunk-5PIXN7UF.js.map} +1 -1
  12. package/dist/{chunk-ZC4E2QJU.js → chunk-OSBLVO4N.js} +3 -3
  13. package/dist/{chunk-7Q3JKSQ5.js → chunk-VNRRXUI3.js} +125 -44
  14. package/dist/chunk-VNRRXUI3.js.map +1 -0
  15. package/dist/{chunk-CCI6EK5W.js → chunk-YHRJD6HA.js} +1 -1
  16. package/dist/chunk-YHRJD6HA.js.map +1 -0
  17. package/dist/context-mention-palette/index.d.ts +1 -3
  18. package/dist/context-mention-palette/index.js +2 -2
  19. package/dist/index.d.ts +29 -417
  20. package/dist/index.js +473 -130
  21. package/dist/index.js.map +1 -1
  22. package/dist/plan-decision-ops.d.ts +2 -2
  23. package/dist/workspace-agent-generated-files.d.ts +1 -1
  24. package/dist/{workspaceAgentActivityListViewModel-BK_J3aNX.d.ts → workspaceAgentActivityListViewModel-jRF8cP37.d.ts} +2 -2
  25. package/package.json +12 -12
  26. package/dist/AgentMessageMarkdown-DeYPURtF.d.ts +0 -7
  27. package/dist/chunk-7Q3JKSQ5.js.map +0 -1
  28. package/dist/chunk-CCI6EK5W.js.map +0 -1
  29. package/dist/chunk-MQAGIHYM.js.map +0 -1
  30. /package/dist/{chunk-ZC4E2QJU.js.map → chunk-OSBLVO4N.js.map} +0 -0
@@ -7,14 +7,14 @@ import {
7
7
  AgentGUIConversation_styles_default,
8
8
  MessageSquareMoreIcon,
9
9
  extractAgentMcpToolTarget
10
- } from "./chunk-7Q3JKSQ5.js";
10
+ } from "./chunk-VNRRXUI3.js";
11
11
  import {
12
12
  Spinner
13
13
  } from "./chunk-F7XLV7M3.js";
14
14
  import {
15
15
  getOptionalAgentHostApi,
16
16
  useOptionalAgentHostApi
17
- } from "./chunk-CCI6EK5W.js";
17
+ } from "./chunk-YHRJD6HA.js";
18
18
  import {
19
19
  translate
20
20
  } from "./chunk-GLDKFIWM.js";
@@ -1120,4 +1120,4 @@ export {
1120
1120
  isPromptRequestIdTitle,
1121
1121
  AgentInteractivePromptSurface
1122
1122
  };
1123
- //# sourceMappingURL=chunk-ZC4E2QJU.js.map
1123
+ //# sourceMappingURL=chunk-OSBLVO4N.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getOptionalAgentHostApi,
3
3
  useOptionalAgentHostApi
4
- } from "./chunk-CCI6EK5W.js";
4
+ } from "./chunk-YHRJD6HA.js";
5
5
  import {
6
6
  useTranslation
7
7
  } from "./chunk-GLDKFIWM.js";
@@ -257,6 +257,7 @@ import remarkGfm from "remark-gfm";
257
257
  import {
258
258
  resolveWorkspaceFileExtension,
259
259
  resolveWorkspaceImageMimeType,
260
+ resolveWorkspaceVideoMimeType,
260
261
  workspaceFileName as basenameWorkspacePath
261
262
  } from "@tutti-os/workspace-file-manager/services";
262
263
  import {
@@ -321,7 +322,7 @@ function resolveWorkspaceFilePathCandidate({
321
322
  return null;
322
323
  }
323
324
  const normalizedPath = normalizeWorkspaceFilePath(rawPath);
324
- if (isAbsoluteLocalPath(normalizedPath) && (isDirectAgentGeneratedImagePath(normalizedPath) || isDirectWorkspaceAppDataPath(normalizedPath))) {
325
+ if (isAbsoluteLocalPath(normalizedPath) && (isDirectAgentGeneratedMediaPath(normalizedPath) || isDirectWorkspaceAppDataPath(normalizedPath))) {
325
326
  const directoryPath = dirname(normalizedPath);
326
327
  return {
327
328
  path: normalizedPath,
@@ -335,7 +336,7 @@ function resolveWorkspaceFilePathCandidate({
335
336
  }
336
337
  const base = normalizeWorkspaceFilePath(basePath?.trim() || root);
337
338
  const resolvedPath = isAbsoluteLocalPath(normalizedPath) ? normalizedPath : normalizeWorkspaceFilePath(`${base}/${normalizedPath}`);
338
- if (!isInsideOrEqual(resolvedPath, root) && !isDirectAgentGeneratedImagePath(resolvedPath)) {
339
+ if (!isInsideOrEqual(resolvedPath, root) && !isDirectAgentGeneratedMediaPath(resolvedPath)) {
339
340
  return null;
340
341
  }
341
342
  return {
@@ -515,7 +516,7 @@ function isInsideOrEqual(path, root) {
515
516
  const comparison = isWindowsAbsolutePath(root) || isWindowsAbsolutePath(path) ? { path: path.toLowerCase(), root: root.toLowerCase() } : { path, root };
516
517
  return comparison.path === comparison.root || comparison.path.startsWith(`${comparison.root}/`);
517
518
  }
518
- function isDirectAgentGeneratedImagePath(path) {
519
+ function isDirectAgentGeneratedMediaPath(path) {
519
520
  if (!isAbsoluteLocalPath(path)) {
520
521
  return false;
521
522
  }
@@ -523,10 +524,10 @@ function isDirectAgentGeneratedImagePath(path) {
523
524
  if (!statePath) {
524
525
  return false;
525
526
  }
526
- if (statePath[1] !== "agent" || statePath[2] !== "runs" || !statePath.includes("generated_images")) {
527
+ if (statePath[1] !== "agent" || statePath[2] !== "runs" || !statePath.includes("generated_images") && !statePath.includes("generated_videos")) {
527
528
  return false;
528
529
  }
529
- return /\.(?:png|jpe?g|gif|webp|bmp)$/i.test(path);
530
+ return /\.(?:png|jpe?g|gif|webp|bmp|mp4|webm)$/i.test(path);
530
531
  }
531
532
  function isDirectWorkspaceAppDataPath(path) {
532
533
  if (!isAbsoluteLocalPath(path)) {
@@ -997,7 +998,7 @@ function AgentMessageMarkdown({
997
998
  )
998
999
  }
999
1000
  ),
1000
- img: (props) => /* @__PURE__ */ jsx2(MarkdownImage, { ...props, enableZoom: enableImageZoom }),
1001
+ img: (props) => /* @__PURE__ */ jsx2(MarkdownMedia, { ...props, enableZoom: enableImageZoom }),
1001
1002
  p: (props) => /* @__PURE__ */ jsx2(MarkdownParagraph, { ...props, inline }),
1002
1003
  ul: MarkdownUnorderedList,
1003
1004
  ol: MarkdownOrderedList,
@@ -1534,13 +1535,14 @@ function MarkdownCode({
1534
1535
  }
1535
1536
  return /* @__PURE__ */ jsx2("code", { ...props, className, children });
1536
1537
  }
1537
- var cachedMarkdownImages = /* @__PURE__ */ new Map();
1538
- var CACHED_MARKDOWN_IMAGE_REVOKE_DELAY_MS = 250;
1539
- function MarkdownImage({
1538
+ var cachedMarkdownMedia = /* @__PURE__ */ new Map();
1539
+ var CACHED_MARKDOWN_MEDIA_REVOKE_DELAY_MS = 250;
1540
+ function MarkdownMedia({
1540
1541
  node: _node,
1541
1542
  src,
1542
1543
  alt,
1543
1544
  className,
1545
+ title,
1544
1546
  enableZoom = false,
1545
1547
  ...props
1546
1548
  }) {
@@ -1552,9 +1554,10 @@ function MarkdownImage({
1552
1554
  const readWorkspaceImage = workspacePath ? agentHostApi?.workspace?.readFile : void 0;
1553
1555
  const canReadWorkspaceImage = Boolean(workspacePath && readWorkspaceImage);
1554
1556
  const shouldEnableZoom = enableZoom && !isInsideLink;
1555
- const resolvedSrc = typeof src === "string" ? resolveRenderableMarkdownImageSrc(src) : src;
1557
+ const fallbackMediaKind = typeof src === "string" ? resolveMarkdownMediaKind(src) : null;
1558
+ const resolvedSrc = typeof src === "string" ? resolveRenderableMarkdownMediaSrc(src) : src;
1556
1559
  const [state, setState] = useState2(
1557
- () => canReadWorkspaceImage && workspacePath ? peekCachedMarkdownImageState(workspacePath) ?? { status: "loading" } : null
1560
+ () => canReadWorkspaceImage && workspacePath ? peekCachedMarkdownMediaState(workspacePath) ?? { status: "loading" } : null
1558
1561
  );
1559
1562
  useEffect2(() => {
1560
1563
  if (!workspacePath || !readWorkspaceImage) {
@@ -1563,28 +1566,27 @@ function MarkdownImage({
1563
1566
  }
1564
1567
  const resolvedWorkspacePath = workspacePath;
1565
1568
  const resolvedReadWorkspaceImage = readWorkspaceImage;
1566
- const cachedSrc = retainCachedMarkdownImage(resolvedWorkspacePath);
1567
- if (cachedSrc) {
1568
- setState({ status: "ready", src: cachedSrc });
1569
+ const cached = retainCachedMarkdownMedia(resolvedWorkspacePath);
1570
+ if (cached) {
1571
+ setState({ kind: cached.kind, status: "ready", src: cached.src });
1569
1572
  return () => {
1570
- releaseCachedMarkdownImage(resolvedWorkspacePath, cachedSrc);
1573
+ releaseCachedMarkdownMedia(resolvedWorkspacePath, cached.src);
1571
1574
  };
1572
1575
  }
1573
- const resolvedMimeType = resolveWorkspaceImageMimeType(
1574
- resolvedWorkspacePath
1575
- );
1576
- if (!resolvedMimeType) {
1576
+ const mediaType = resolveMarkdownMediaType(resolvedWorkspacePath);
1577
+ if (!mediaType) {
1577
1578
  setState({
1578
1579
  status: "error",
1579
1580
  reason: "unsupported"
1580
1581
  });
1581
1582
  return;
1582
1583
  }
1583
- const imageMimeType = resolvedMimeType;
1584
+ const mediaKind = mediaType.kind;
1585
+ const mediaMimeType = mediaType.mimeType;
1584
1586
  let canceled = false;
1585
1587
  let objectUrl = null;
1586
1588
  setState({ status: "loading" });
1587
- async function loadWorkspaceImage() {
1589
+ async function loadWorkspaceMedia() {
1588
1590
  try {
1589
1591
  const result = await resolvedReadWorkspaceImage({
1590
1592
  path: resolvedWorkspacePath
@@ -1597,11 +1599,12 @@ function MarkdownImage({
1597
1599
  bytes.byteOffset,
1598
1600
  bytes.byteOffset + bytes.byteLength
1599
1601
  );
1600
- objectUrl = cacheMarkdownImage(
1602
+ objectUrl = cacheMarkdownMedia(
1601
1603
  resolvedWorkspacePath,
1602
- new Blob([arrayBuffer], { type: imageMimeType })
1604
+ mediaKind,
1605
+ new Blob([arrayBuffer], { type: mediaMimeType })
1603
1606
  );
1604
- setState({ status: "ready", src: objectUrl });
1607
+ setState({ kind: mediaKind, status: "ready", src: objectUrl });
1605
1608
  } catch (error) {
1606
1609
  if (!canceled) {
1607
1610
  setState({
@@ -1612,17 +1615,46 @@ function MarkdownImage({
1612
1615
  }
1613
1616
  }
1614
1617
  }
1615
- void loadWorkspaceImage();
1618
+ void loadWorkspaceMedia();
1616
1619
  return () => {
1617
1620
  canceled = true;
1618
1621
  if (objectUrl) {
1619
- releaseCachedMarkdownImage(resolvedWorkspacePath, objectUrl);
1622
+ releaseCachedMarkdownMedia(resolvedWorkspacePath, objectUrl);
1620
1623
  }
1621
1624
  };
1622
1625
  }, [canReadWorkspaceImage, workspacePath]);
1623
1626
  if (!workspacePath || !readWorkspaceImage) {
1627
+ if (fallbackMediaKind === "video") {
1628
+ if (!canRenderMarkdownVideoFallback(src)) {
1629
+ return /* @__PURE__ */ jsx2(UnsupportedMarkdownMediaPreview, {});
1630
+ }
1631
+ return /* @__PURE__ */ jsx2(
1632
+ "video",
1633
+ {
1634
+ src: resolvedSrc,
1635
+ "aria-label": alt || void 0,
1636
+ title: typeof title === "string" ? title : void 0,
1637
+ controls: true,
1638
+ playsInline: true,
1639
+ preload: "metadata",
1640
+ className: cn(
1641
+ "block max-h-[360px] max-w-full rounded-[8px] border border-[var(--line-2)] bg-[var(--background-panel)]",
1642
+ className
1643
+ )
1644
+ }
1645
+ );
1646
+ }
1624
1647
  if (!shouldEnableZoom) {
1625
- return /* @__PURE__ */ jsx2("img", { ...props, src: resolvedSrc, alt, className });
1648
+ return /* @__PURE__ */ jsx2(
1649
+ "img",
1650
+ {
1651
+ ...props,
1652
+ src: resolvedSrc,
1653
+ alt,
1654
+ title,
1655
+ className
1656
+ }
1657
+ );
1626
1658
  }
1627
1659
  return /* @__PURE__ */ jsx2(
1628
1660
  ZoomableImage,
@@ -1630,12 +1662,30 @@ function MarkdownImage({
1630
1662
  ...props,
1631
1663
  src: resolvedSrc,
1632
1664
  alt,
1665
+ title,
1633
1666
  className,
1634
1667
  wrapElement: "span"
1635
1668
  }
1636
1669
  );
1637
1670
  }
1638
1671
  if (state?.status === "ready") {
1672
+ if (state.kind === "video") {
1673
+ return /* @__PURE__ */ jsx2(
1674
+ "video",
1675
+ {
1676
+ src: state.src,
1677
+ "aria-label": alt || void 0,
1678
+ title: typeof title === "string" ? title : void 0,
1679
+ controls: true,
1680
+ playsInline: true,
1681
+ preload: "metadata",
1682
+ className: cn(
1683
+ "block max-h-[360px] max-w-full rounded-[8px] border border-[var(--line-2)] bg-[var(--background-panel)]",
1684
+ className
1685
+ )
1686
+ }
1687
+ );
1688
+ }
1639
1689
  if (!shouldEnableZoom) {
1640
1690
  return /* @__PURE__ */ jsx2(
1641
1691
  "img",
@@ -1643,6 +1693,7 @@ function MarkdownImage({
1643
1693
  ...props,
1644
1694
  src: state.src,
1645
1695
  alt,
1696
+ title,
1646
1697
  className: cn(
1647
1698
  "block max-h-[360px] max-w-full rounded-[8px] border border-[var(--line-2)] bg-[var(--background-panel)] object-contain",
1648
1699
  className
@@ -1656,6 +1707,7 @@ function MarkdownImage({
1656
1707
  ...props,
1657
1708
  src: state.src,
1658
1709
  alt,
1710
+ title,
1659
1711
  className: cn(
1660
1712
  "block max-h-[360px] max-w-full rounded-[8px] border border-[var(--line-2)] bg-[var(--background-panel)] object-contain",
1661
1713
  className
@@ -1668,6 +1720,10 @@ function MarkdownImage({
1668
1720
  message: state.detail ?? ""
1669
1721
  }) : t("agentHost.workspaceFileManager.previewLoading") });
1670
1722
  }
1723
+ function UnsupportedMarkdownMediaPreview() {
1724
+ const { t } = useTranslation();
1725
+ return /* @__PURE__ */ jsx2("span", { className: "flex min-h-[160px] w-full items-center justify-center rounded-[8px] border border-[var(--line-2)] bg-[var(--background-panel)] px-5 py-5 text-center text-[13px] leading-5 text-[var(--text-tertiary)]", children: t("agentHost.workspaceFileManager.previewUnsupported") });
1726
+ }
1671
1727
  var MARKDOWN_ORDERED_LIST_STYLE = {
1672
1728
  listStylePosition: "outside",
1673
1729
  margin: "12px 0 8px",
@@ -1741,7 +1797,7 @@ function isLocalAbsolutePath(path) {
1741
1797
  const candidate = path.trim();
1742
1798
  return candidate.length > 1 && candidate.startsWith("/") && !candidate.startsWith("//") && !candidate.includes("://") && !/\s/.test(candidate);
1743
1799
  }
1744
- function resolveRenderableMarkdownImageSrc(src) {
1800
+ function resolveRenderableMarkdownMediaSrc(src) {
1745
1801
  const trimmed = src.trim();
1746
1802
  if (!trimmed) {
1747
1803
  return src;
@@ -1751,12 +1807,36 @@ function resolveRenderableMarkdownImageSrc(src) {
1751
1807
  }
1752
1808
  return new URL(trimmed, "file://").toString();
1753
1809
  }
1754
- function peekCachedMarkdownImageState(path) {
1755
- const src = cachedMarkdownImages.get(path)?.objectUrl ?? null;
1756
- return src ? { status: "ready", src } : null;
1810
+ function canRenderMarkdownVideoFallback(src) {
1811
+ if (typeof src !== "string") {
1812
+ return false;
1813
+ }
1814
+ const trimmed = src.trim();
1815
+ if (!isLocalAbsolutePath(trimmed) || trimmed.startsWith("/workspace/")) {
1816
+ return true;
1817
+ }
1818
+ return isDirectAgentGeneratedMediaPath(trimmed);
1819
+ }
1820
+ function resolveMarkdownMediaKind(pathOrName) {
1821
+ return resolveMarkdownMediaType(pathOrName)?.kind ?? null;
1822
+ }
1823
+ function resolveMarkdownMediaType(pathOrName) {
1824
+ const imageMimeType = resolveWorkspaceImageMimeType(pathOrName);
1825
+ if (imageMimeType) {
1826
+ return { kind: "image", mimeType: imageMimeType };
1827
+ }
1828
+ const videoMimeType = resolveWorkspaceVideoMimeType(pathOrName);
1829
+ if (videoMimeType) {
1830
+ return { kind: "video", mimeType: videoMimeType };
1831
+ }
1832
+ return null;
1757
1833
  }
1758
- function retainCachedMarkdownImage(path) {
1759
- const entry = cachedMarkdownImages.get(path);
1834
+ function peekCachedMarkdownMediaState(path) {
1835
+ const entry = cachedMarkdownMedia.get(path);
1836
+ return entry ? { kind: entry.kind, status: "ready", src: entry.objectUrl } : null;
1837
+ }
1838
+ function retainCachedMarkdownMedia(path) {
1839
+ const entry = cachedMarkdownMedia.get(path);
1760
1840
  if (!entry) {
1761
1841
  return null;
1762
1842
  }
@@ -1765,10 +1845,10 @@ function retainCachedMarkdownImage(path) {
1765
1845
  clearTimeout(entry.revokeTimer);
1766
1846
  entry.revokeTimer = null;
1767
1847
  }
1768
- return entry.objectUrl;
1848
+ return { kind: entry.kind, src: entry.objectUrl };
1769
1849
  }
1770
- function cacheMarkdownImage(path, blob) {
1771
- const entry = cachedMarkdownImages.get(path);
1850
+ function cacheMarkdownMedia(path, kind, blob) {
1851
+ const entry = cachedMarkdownMedia.get(path);
1772
1852
  if (entry) {
1773
1853
  entry.refCount += 1;
1774
1854
  if (entry.revokeTimer) {
@@ -1778,15 +1858,16 @@ function cacheMarkdownImage(path, blob) {
1778
1858
  return entry.objectUrl;
1779
1859
  }
1780
1860
  const objectUrl = URL.createObjectURL(blob);
1781
- cachedMarkdownImages.set(path, {
1861
+ cachedMarkdownMedia.set(path, {
1862
+ kind,
1782
1863
  objectUrl,
1783
1864
  refCount: 1,
1784
1865
  revokeTimer: null
1785
1866
  });
1786
1867
  return objectUrl;
1787
1868
  }
1788
- function releaseCachedMarkdownImage(path, objectUrl) {
1789
- const entry = cachedMarkdownImages.get(path);
1869
+ function releaseCachedMarkdownMedia(path, objectUrl) {
1870
+ const entry = cachedMarkdownMedia.get(path);
1790
1871
  if (!entry || entry.objectUrl !== objectUrl) {
1791
1872
  URL.revokeObjectURL(objectUrl);
1792
1873
  return;
@@ -1796,13 +1877,13 @@ function releaseCachedMarkdownImage(path, objectUrl) {
1796
1877
  return;
1797
1878
  }
1798
1879
  entry.revokeTimer = setTimeout(() => {
1799
- const current = cachedMarkdownImages.get(path);
1880
+ const current = cachedMarkdownMedia.get(path);
1800
1881
  if (!current || current.objectUrl !== objectUrl || current.refCount > 0) {
1801
1882
  return;
1802
1883
  }
1803
- cachedMarkdownImages.delete(path);
1884
+ cachedMarkdownMedia.delete(path);
1804
1885
  URL.revokeObjectURL(objectUrl);
1805
- }, CACHED_MARKDOWN_IMAGE_REVOKE_DELAY_MS);
1886
+ }, CACHED_MARKDOWN_MEDIA_REVOKE_DELAY_MS);
1806
1887
  }
1807
1888
  function isHttpUrl(value) {
1808
1889
  const candidate = value.trim();
@@ -2587,4 +2668,4 @@ export {
2587
2668
  CustomScrollArea,
2588
2669
  MessageSquareMoreIcon
2589
2670
  };
2590
- //# sourceMappingURL=chunk-7Q3JKSQ5.js.map
2671
+ //# sourceMappingURL=chunk-VNRRXUI3.js.map