@opengeni/react 3.5.1-canary.0 → 3.7.0-canary.1

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 (87) hide show
  1. package/dist/artifacts.d.ts +1 -1
  2. package/dist/artifacts.js +248 -6
  3. package/dist/artifacts.js.map +1 -1
  4. package/dist/{browser-viewer-E5DDEFQ4.js → browser-viewer-NTD6UIPR.js} +3 -3
  5. package/dist/{chunk-W2RGYBCV.js → chunk-24M4YBCL.js} +4 -4
  6. package/dist/{chunk-WY3MELVJ.js → chunk-5IXTJTK3.js} +1438 -397
  7. package/dist/chunk-5IXTJTK3.js.map +1 -0
  8. package/dist/chunk-5PQJOCX5.js +902 -0
  9. package/dist/chunk-5PQJOCX5.js.map +1 -0
  10. package/dist/{chunk-UNCXXIQR.js → chunk-INGB2N5R.js} +4310 -3982
  11. package/dist/chunk-INGB2N5R.js.map +1 -0
  12. package/dist/{chunk-TJFMMDQU.js → chunk-MOWYEBCQ.js} +1839 -17
  13. package/dist/chunk-MOWYEBCQ.js.map +1 -0
  14. package/dist/chunk-PAJU5KKL.js +331 -0
  15. package/dist/chunk-PAJU5KKL.js.map +1 -0
  16. package/dist/{chunk-VTOREEXF.js → chunk-PLYRL5ER.js} +24 -2
  17. package/dist/{chunk-VTOREEXF.js.map → chunk-PLYRL5ER.js.map} +1 -1
  18. package/dist/{chunk-YVCHAQZY.js → chunk-ZFOFY5ST.js} +27 -349
  19. package/dist/chunk-ZFOFY5ST.js.map +1 -0
  20. package/dist/client.d.ts +1 -1
  21. package/dist/components/artifacts/index.d.ts +1 -1
  22. package/dist/components/artifacts/published-html-artifact-frame.d.ts +46 -3
  23. package/dist/components/composer.d.ts +2 -0
  24. package/dist/components/session-chrome.d.ts +38 -5
  25. package/dist/components/session-commands-panel.d.ts +6 -0
  26. package/dist/components/session-conversation.d.ts +14 -0
  27. package/dist/components/timeline-anchor.d.ts +21 -0
  28. package/dist/composer.js +2 -3
  29. package/dist/conversation-timeline.d.ts +5 -0
  30. package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
  31. package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
  32. package/dist/hooks/use-file-attachments.d.ts +6 -0
  33. package/dist/hooks/use-sandbox-files.d.ts +4 -1
  34. package/dist/hooks/use-workspace-edit.d.ts +4 -0
  35. package/dist/index.d.ts +4 -1
  36. package/dist/index.js +823 -965
  37. package/dist/index.js.map +1 -1
  38. package/dist/interaction.js +2 -2
  39. package/dist/lib/format.d.ts +5 -0
  40. package/dist/machines.js +3 -2
  41. package/dist/session-ui.d.ts +3 -0
  42. package/dist/session-ui.js +14 -4
  43. package/dist/session.js +19 -19
  44. package/dist/timeline/registry.d.ts +2 -0
  45. package/dist/timeline/types.d.ts +4 -2
  46. package/package.json +2 -2
  47. package/src/artifacts.ts +3 -0
  48. package/src/client.ts +2 -1
  49. package/src/components/artifacts/index.ts +3 -0
  50. package/src/components/artifacts/published-html-artifact-frame.tsx +307 -4
  51. package/src/components/composer.tsx +89 -25
  52. package/src/components/machine-input-display.ts +6 -0
  53. package/src/components/message-timeline.tsx +351 -204
  54. package/src/components/sandbox-workspace.tsx +11 -1
  55. package/src/components/session-chrome.tsx +501 -128
  56. package/src/components/session-commands-panel.tsx +113 -0
  57. package/src/components/session-conversation.tsx +141 -0
  58. package/src/components/timeline-anchor.tsx +91 -0
  59. package/src/conversation-timeline.ts +83 -0
  60. package/src/hooks/use-file-attachments.ts +34 -0
  61. package/src/hooks/use-sandbox-files.ts +68 -20
  62. package/src/hooks/use-session-background-commands.ts +21 -10
  63. package/src/hooks/use-session-events.ts +56 -39
  64. package/src/hooks/use-session.ts +23 -2
  65. package/src/hooks/use-workspace-edit.ts +23 -5
  66. package/src/index.ts +4 -0
  67. package/src/lib/format.ts +32 -0
  68. package/src/session-ui.ts +3 -0
  69. package/src/timeline/fleet-decision-projection.ts +2 -1
  70. package/src/timeline/fleet-decision-row.tsx +1 -0
  71. package/src/timeline/projection.ts +157 -19
  72. package/src/timeline/registry.ts +15 -3
  73. package/src/timeline/tool-renderers.tsx +117 -1
  74. package/src/timeline/types.ts +12 -1
  75. package/styles/compiled.css +495 -411
  76. package/styles/index.css +23 -0
  77. package/dist/chunk-7EAFGICR.js +0 -302
  78. package/dist/chunk-7EAFGICR.js.map +0 -1
  79. package/dist/chunk-IB27C53Y.js +0 -2582
  80. package/dist/chunk-IB27C53Y.js.map +0 -1
  81. package/dist/chunk-TJFMMDQU.js.map +0 -1
  82. package/dist/chunk-UNCXXIQR.js.map +0 -1
  83. package/dist/chunk-WY3MELVJ.js.map +0 -1
  84. package/dist/chunk-YVCHAQZY.js.map +0 -1
  85. package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
  86. /package/dist/{browser-viewer-E5DDEFQ4.js.map → browser-viewer-NTD6UIPR.js.map} +0 -0
  87. /package/dist/{chunk-W2RGYBCV.js.map → chunk-24M4YBCL.js.map} +0 -0
@@ -137,6 +137,7 @@ export type ChatComposerMessages = {
137
137
  uploading: string;
138
138
  uploadFailed: string;
139
139
  previewAttachment: (name: string) => string;
140
+ previewUnavailable?: string | undefined;
140
141
  attachmentPreviewLabel: string;
141
142
  downloadAttachment: (name: string) => string;
142
143
  closeAttachmentPreview: string;
@@ -204,6 +205,7 @@ export const defaultChatComposerMessages: ChatComposerMessages = {
204
205
  uploading: "Uploading",
205
206
  uploadFailed: "Upload failed",
206
207
  previewAttachment: (name) => `Preview ${name}`,
208
+ previewUnavailable: "Preview unavailable",
207
209
  attachmentPreviewLabel: "Attachment preview",
208
210
  downloadAttachment: (name) => `Download ${name}`,
209
211
  closeAttachmentPreview: "Close",
@@ -947,6 +949,7 @@ export function Attachments() {
947
949
  onRemove={controller.attachments.remove}
948
950
  onRetry={controller.attachments.retry}
949
951
  onRetainPreview={controller.attachments.retainPreview}
952
+ onLoadPreview={controller.attachments.loadPreview}
950
953
  />
951
954
  );
952
955
  }
@@ -1638,21 +1641,83 @@ function AttachmentChips({
1638
1641
  onRemove,
1639
1642
  onRetry,
1640
1643
  onRetainPreview,
1644
+ onLoadPreview,
1641
1645
  }: {
1642
1646
  attachments: UseFileAttachmentsResult["attachments"];
1643
1647
  messages: ChatComposerMessages;
1644
1648
  onRemove: (id: string) => void;
1645
1649
  onRetry?: ((id: string) => void) | undefined;
1646
1650
  onRetainPreview: UseFileAttachmentsResult["retainPreview"];
1651
+ onLoadPreview: UseFileAttachmentsResult["loadPreview"];
1647
1652
  }) {
1648
1653
  const lightbox = useLightboxOptional();
1654
+ const previewRequest = useRef<AbortController | null>(null);
1655
+ const [previewLoadingId, setPreviewLoadingId] = useState<string | null>(null);
1656
+ const [previewErrorId, setPreviewErrorId] = useState<string | null>(null);
1657
+
1658
+ useEffect(() => () => previewRequest.current?.abort(), [onLoadPreview]);
1659
+
1660
+ async function openPreview(
1661
+ attachment: UseFileAttachmentsResult["attachments"][number],
1662
+ source: HTMLButtonElement,
1663
+ canLoadPreview: boolean,
1664
+ ) {
1665
+ previewRequest.current?.abort();
1666
+ const attachmentId = attachment.id;
1667
+ const releaseSource = onRetainPreview(attachmentId);
1668
+ let src = attachment.previewUrl;
1669
+ if (!releaseSource && canLoadPreview) {
1670
+ const controller = new AbortController();
1671
+ previewRequest.current = controller;
1672
+ setPreviewLoadingId(attachmentId);
1673
+ setPreviewErrorId(null);
1674
+ try {
1675
+ src = await onLoadPreview!(attachmentId, controller.signal);
1676
+ if (controller.signal.aborted) return;
1677
+ if (!src) {
1678
+ setPreviewErrorId(attachmentId);
1679
+ return;
1680
+ }
1681
+ } catch {
1682
+ if (!controller.signal.aborted) setPreviewErrorId(attachmentId);
1683
+ return;
1684
+ } finally {
1685
+ if (previewRequest.current === controller) {
1686
+ setPreviewLoadingId(null);
1687
+ }
1688
+ }
1689
+ }
1690
+ lightbox!.open(
1691
+ src!,
1692
+ attachment.name,
1693
+ source,
1694
+ messages.attachmentPreviewLabel,
1695
+ attachment.name,
1696
+ {
1697
+ download: messages.downloadAttachment(attachment.name),
1698
+ close: messages.closeAttachmentPreview,
1699
+ },
1700
+ releaseSource,
1701
+ );
1702
+ }
1703
+
1649
1704
  return (
1650
1705
  <div className="flex flex-wrap gap-2 px-3 py-2">
1651
1706
  {attachments.map((attachment) => {
1652
1707
  const failed = attachment.status === "failed";
1653
1708
  const secureContextRequired = attachment.errorCode === "secure_context_required";
1654
- const statusText =
1655
- attachment.status === "uploading"
1709
+ const previewFailed = previewErrorId === attachment.id;
1710
+ const previewLoading = previewLoadingId === attachment.id;
1711
+ const canLoadPreview = Boolean(
1712
+ lightbox &&
1713
+ onLoadPreview &&
1714
+ attachment.status === "ready" &&
1715
+ attachment.file &&
1716
+ attachment.contentType.startsWith("image/"),
1717
+ );
1718
+ const statusText = previewFailed
1719
+ ? (messages.previewUnavailable ?? "Preview unavailable")
1720
+ : attachment.status === "uploading"
1656
1721
  ? messages.uploading
1657
1722
  : failed
1658
1723
  ? attachment.error || messages.uploadFailed
@@ -1672,32 +1737,31 @@ function AttachmentChips({
1672
1737
  : "max-w-[240px] border-og-border bg-og-surface-2",
1673
1738
  )}
1674
1739
  >
1675
- {attachment.previewUrl && lightbox ? (
1740
+ {lightbox && (attachment.previewUrl || canLoadPreview) ? (
1676
1741
  <button
1677
1742
  type="button"
1678
- className="size-8 shrink-0 overflow-hidden rounded outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent"
1743
+ className={cn(
1744
+ "size-8 shrink-0 overflow-hidden rounded outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent",
1745
+ !attachment.previewUrl && "flex items-center justify-center disabled:cursor-wait",
1746
+ )}
1679
1747
  aria-label={messages.previewAttachment(attachment.name)}
1680
- onClick={(event) => {
1681
- const releasePreview = onRetainPreview(attachment.id);
1682
- lightbox.open(
1683
- attachment.previewUrl!,
1684
- attachment.name,
1685
- event.currentTarget,
1686
- messages.attachmentPreviewLabel,
1687
- attachment.name,
1688
- {
1689
- download: messages.downloadAttachment(attachment.name),
1690
- close: messages.closeAttachmentPreview,
1691
- },
1692
- releasePreview,
1693
- );
1694
- }}
1748
+ aria-busy={previewLoading || undefined}
1749
+ disabled={previewLoading}
1750
+ onClick={(event) =>
1751
+ void openPreview(attachment, event.currentTarget, canLoadPreview)
1752
+ }
1695
1753
  >
1696
- <img
1697
- src={attachment.previewUrl}
1698
- alt=""
1699
- className="h-full w-full object-cover transition-opacity hover:opacity-80"
1700
- />
1754
+ {attachment.previewUrl ? (
1755
+ <img
1756
+ src={attachment.previewUrl}
1757
+ alt=""
1758
+ className="h-full w-full object-cover transition-opacity hover:opacity-80"
1759
+ />
1760
+ ) : previewLoading ? (
1761
+ <LoaderCircleIcon className="size-4 animate-og-spin text-og-fg-muted" />
1762
+ ) : (
1763
+ <ImageIcon className="size-4 text-og-fg-muted" />
1764
+ )}
1701
1765
  </button>
1702
1766
  ) : attachment.previewUrl ? (
1703
1767
  <img
@@ -1716,7 +1780,7 @@ function AttachmentChips({
1716
1780
  <div className="break-words text-og-xs leading-4 text-og-status-failed">
1717
1781
  {statusText}
1718
1782
  </div>
1719
- ) : failed ? (
1783
+ ) : failed || previewFailed ? (
1720
1784
  <ComposerTip tip={statusText}>
1721
1785
  <div className="truncate text-og-xs text-og-status-failed">{statusText}</div>
1722
1786
  </ComposerTip>
@@ -3,6 +3,8 @@ import type { MachineInputMember } from "../timeline/types";
3
3
  export const MACHINE_INPUT_META: Record<MachineInputMember["kind"], string> = {
4
4
  scheduled_occurrence: "Scheduled update",
5
5
  goal_continuation: "Goal continued",
6
+ background_command_result: "Command result received",
7
+ session_wait_timeout: "Wait ended",
6
8
  agent_message: "Agent update",
7
9
  agent_steer_instruction: "Agent direction",
8
10
  child_terminal_result: "Agent finished",
@@ -28,6 +30,10 @@ export function machineInputBatchLabel(members: readonly MachineInputMember[]):
28
30
  const kind = members[0]!.kind;
29
31
  const n = members.length;
30
32
  switch (kind) {
33
+ case "background_command_result":
34
+ return n === 1 ? "Command result received" : `${n} command results received`;
35
+ case "session_wait_timeout":
36
+ return n === 1 ? "Wait ended" : `${n} waits ended`;
31
37
  case "child_terminal_result":
32
38
  return n === 1 ? "Agent finished" : `${n} agents finished`;
33
39
  case "goal_continuation":