@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.
- package/dist/artifacts.d.ts +1 -1
- package/dist/artifacts.js +248 -6
- package/dist/artifacts.js.map +1 -1
- package/dist/{browser-viewer-E5DDEFQ4.js → browser-viewer-NTD6UIPR.js} +3 -3
- package/dist/{chunk-W2RGYBCV.js → chunk-24M4YBCL.js} +4 -4
- package/dist/{chunk-WY3MELVJ.js → chunk-5IXTJTK3.js} +1438 -397
- package/dist/chunk-5IXTJTK3.js.map +1 -0
- package/dist/chunk-5PQJOCX5.js +902 -0
- package/dist/chunk-5PQJOCX5.js.map +1 -0
- package/dist/{chunk-UNCXXIQR.js → chunk-INGB2N5R.js} +4310 -3982
- package/dist/chunk-INGB2N5R.js.map +1 -0
- package/dist/{chunk-TJFMMDQU.js → chunk-MOWYEBCQ.js} +1839 -17
- package/dist/chunk-MOWYEBCQ.js.map +1 -0
- package/dist/chunk-PAJU5KKL.js +331 -0
- package/dist/chunk-PAJU5KKL.js.map +1 -0
- package/dist/{chunk-VTOREEXF.js → chunk-PLYRL5ER.js} +24 -2
- package/dist/{chunk-VTOREEXF.js.map → chunk-PLYRL5ER.js.map} +1 -1
- package/dist/{chunk-YVCHAQZY.js → chunk-ZFOFY5ST.js} +27 -349
- package/dist/chunk-ZFOFY5ST.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/components/artifacts/index.d.ts +1 -1
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +46 -3
- package/dist/components/composer.d.ts +2 -0
- package/dist/components/session-chrome.d.ts +38 -5
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-conversation.d.ts +14 -0
- package/dist/components/timeline-anchor.d.ts +21 -0
- package/dist/composer.js +2 -3
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/{fleet-decision-row-GGCAT4E4.js → fleet-decision-row-YZ3ZKWMM.js} +2 -1
- package/dist/fleet-decision-row-YZ3ZKWMM.js.map +1 -0
- package/dist/hooks/use-file-attachments.d.ts +6 -0
- package/dist/hooks/use-sandbox-files.d.ts +4 -1
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.js +823 -965
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +2 -2
- package/dist/lib/format.d.ts +5 -0
- package/dist/machines.js +3 -2
- package/dist/session-ui.d.ts +3 -0
- package/dist/session-ui.js +14 -4
- package/dist/session.js +19 -19
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/types.d.ts +4 -2
- package/package.json +2 -2
- package/src/artifacts.ts +3 -0
- package/src/client.ts +2 -1
- package/src/components/artifacts/index.ts +3 -0
- package/src/components/artifacts/published-html-artifact-frame.tsx +307 -4
- package/src/components/composer.tsx +89 -25
- package/src/components/machine-input-display.ts +6 -0
- package/src/components/message-timeline.tsx +351 -204
- package/src/components/sandbox-workspace.tsx +11 -1
- package/src/components/session-chrome.tsx +501 -128
- package/src/components/session-commands-panel.tsx +113 -0
- package/src/components/session-conversation.tsx +141 -0
- package/src/components/timeline-anchor.tsx +91 -0
- package/src/conversation-timeline.ts +83 -0
- package/src/hooks/use-file-attachments.ts +34 -0
- package/src/hooks/use-sandbox-files.ts +68 -20
- package/src/hooks/use-session-background-commands.ts +21 -10
- package/src/hooks/use-session-events.ts +56 -39
- package/src/hooks/use-session.ts +23 -2
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/index.ts +4 -0
- package/src/lib/format.ts +32 -0
- package/src/session-ui.ts +3 -0
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/projection.ts +157 -19
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/tool-renderers.tsx +117 -1
- package/src/timeline/types.ts +12 -1
- package/styles/compiled.css +495 -411
- package/styles/index.css +23 -0
- package/dist/chunk-7EAFGICR.js +0 -302
- package/dist/chunk-7EAFGICR.js.map +0 -1
- package/dist/chunk-IB27C53Y.js +0 -2582
- package/dist/chunk-IB27C53Y.js.map +0 -1
- package/dist/chunk-TJFMMDQU.js.map +0 -1
- package/dist/chunk-UNCXXIQR.js.map +0 -1
- package/dist/chunk-WY3MELVJ.js.map +0 -1
- package/dist/chunk-YVCHAQZY.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- /package/dist/{browser-viewer-E5DDEFQ4.js.map → browser-viewer-NTD6UIPR.js.map} +0 -0
- /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
|
|
1655
|
-
|
|
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
|
|
1740
|
+
{lightbox && (attachment.previewUrl || canLoadPreview) ? (
|
|
1676
1741
|
<button
|
|
1677
1742
|
type="button"
|
|
1678
|
-
className=
|
|
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
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
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
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
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":
|