@opengeni/react 5.1.0-canary.0 → 5.2.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/README.md +12 -0
- package/dist/artifacts.d.ts +2 -0
- package/dist/artifacts.js +1391 -2
- package/dist/artifacts.js.map +1 -1
- package/dist/chunk-2TKI3WEG.js +73 -0
- package/dist/chunk-2TKI3WEG.js.map +1 -0
- package/dist/{chunk-M2HNWZYR.js → chunk-IHQII5WO.js} +69 -18
- package/dist/chunk-IHQII5WO.js.map +1 -0
- package/dist/{chunk-5PQJOCX5.js → chunk-KANFU34B.js} +6 -4
- package/dist/chunk-KANFU34B.js.map +1 -0
- package/dist/{chunk-WS6D5BHH.js → chunk-O4NQNMPG.js} +2393 -2123
- package/dist/chunk-O4NQNMPG.js.map +1 -0
- package/dist/{chunk-HUMIRRYI.js → chunk-PZ27MCZP.js} +54 -19
- package/dist/chunk-PZ27MCZP.js.map +1 -0
- package/dist/{chunk-BRFMGY4L.js → chunk-UGMKPUEM.js} +28 -3
- package/dist/chunk-UGMKPUEM.js.map +1 -0
- package/dist/{chunk-BV5A4OTE.js → chunk-YS24CFDI.js} +44 -10
- package/dist/chunk-YS24CFDI.js.map +1 -0
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +2 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/markdown.d.ts +13 -1
- package/dist/components/session-chrome.d.ts +6 -1
- package/dist/{computer-viewer-7TEZC6Y2.js → computer-viewer-CTFCJVS7.js} +2 -2
- package/dist/connect.js +1 -1
- package/dist/hooks/use-file-attachments.d.ts +2 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +1 -1
- package/dist/{platform-activity-row-27LKAWZD.js → platform-activity-row-DUE2W74J.js} +6 -3
- package/dist/platform-activity-row-DUE2W74J.js.map +1 -0
- package/dist/session-ui.d.ts +2 -0
- package/dist/session-ui.js +7 -107
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +2 -2
- package/dist/sites-ui.d.ts +2 -1
- package/dist/sites.js +12 -4
- package/dist/sites.js.map +1 -1
- package/dist/timeline/activity-rail.d.ts +1 -0
- package/dist/timeline/genie-loading.d.ts +9 -1
- package/dist/timeline/index.d.ts +3 -1
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/platform-activity-row.d.ts +1 -2
- package/dist/timeline/retained-image.d.ts +16 -0
- package/dist/timeline/rolling-activity.d.ts +9 -0
- package/dist/timeline/shared.d.ts +4 -1
- package/dist/timeline/turn-summary.d.ts +4 -1
- package/dist/timeline/types.d.ts +13 -2
- package/package.json +4 -4
- package/src/artifacts.ts +2 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/published-html-artifact-frame.tsx +32 -2
- package/src/components/artifacts/visualization-assets/base.css +1015 -0
- package/src/components/artifacts/visualization-assets/helpers.html +349 -0
- package/src/components/artifacts/visualization-assets.gen.ts +3 -0
- package/src/components/computer-viewer.tsx +11 -3
- package/src/components/copy-button.tsx +7 -2
- package/src/components/markdown.tsx +111 -34
- package/src/components/message-timeline.tsx +48 -3
- package/src/components/session-chrome.tsx +14 -2
- package/src/hooks/use-computer-frame-stream.ts +17 -5
- package/src/hooks/use-computer-session.ts +36 -1
- package/src/hooks/use-file-attachments.ts +4 -1
- package/src/hooks/use-goal.ts +3 -1
- package/src/index.ts +12 -1
- package/src/session-ui.ts +3 -0
- package/src/sites-ui.tsx +23 -6
- package/src/timeline/activity-rail.tsx +31 -4
- package/src/timeline/genie-loading.tsx +18 -4
- package/src/timeline/index.ts +4 -0
- package/src/timeline/knowledge-receipt.tsx +100 -0
- package/src/timeline/platform-activity-row.tsx +5 -3
- package/src/timeline/projection.ts +40 -0
- package/src/timeline/retained-image.ts +91 -0
- package/src/timeline/rolling-activity.tsx +83 -0
- package/src/timeline/shared.tsx +33 -12
- package/src/timeline/tool-renderers.tsx +55 -91
- package/src/timeline/turn-summary.tsx +21 -15
- package/src/timeline/types.ts +14 -0
- package/styles/compiled.css +122 -0
- package/styles/index.css +49 -0
- package/dist/chunk-5PQJOCX5.js.map +0 -1
- package/dist/chunk-BRFMGY4L.js.map +0 -1
- package/dist/chunk-BV5A4OTE.js.map +0 -1
- package/dist/chunk-HUMIRRYI.js.map +0 -1
- package/dist/chunk-M2HNWZYR.js.map +0 -1
- package/dist/chunk-WS6D5BHH.js.map +0 -1
- package/dist/platform-activity-row-27LKAWZD.js.map +0 -1
- /package/dist/{computer-viewer-7TEZC6Y2.js.map → computer-viewer-CTFCJVS7.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0-canary.1",
|
|
4
4
|
"description": "React hooks and styled components for OpenGeni: live session streaming, chat composer, message timeline, session status, and fleet views — token-themed (CSS variables), dark-first, built on Tailwind v4 + Radix + Motion.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
},
|
|
119
119
|
"scripts": {
|
|
120
120
|
"typecheck": "tsc --noEmit",
|
|
121
|
-
"build": "bun run build:css && bun ../../scripts/build-typescript-package.ts",
|
|
121
|
+
"build": "bun run build:css && bun ../../scripts/generate-visualization-assets.ts && bun ../../scripts/build-typescript-package.ts",
|
|
122
122
|
"build:css": "bun scripts/build-compiled-css.ts",
|
|
123
123
|
"check:css": "bun scripts/build-compiled-css.ts --check",
|
|
124
124
|
"demo": "vite dev demo --port 3100",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"@dnd-kit/utilities": "3.2.2",
|
|
134
134
|
"@fontsource-variable/noto-sans-arabic": "5.2.10",
|
|
135
135
|
"@fontsource-variable/noto-sans-jp": "5.2.10",
|
|
136
|
-
"@opengeni/connect": "^0.2.0-canary.
|
|
137
|
-
"@opengeni/sdk": "^5.1.0-canary.
|
|
136
|
+
"@opengeni/connect": "^0.2.0-canary.8",
|
|
137
|
+
"@opengeni/sdk": "^5.1.0-canary.2",
|
|
138
138
|
"clsx": "^2.1.1",
|
|
139
139
|
"dequal": "2.0.3",
|
|
140
140
|
"lucide-react": "^1.8.0",
|
package/src/artifacts.ts
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { VISUALIZATION_CSS, VISUALIZATION_HELPERS } from "./visualization-assets.gen";
|
|
2
|
+
|
|
3
|
+
/** Conversation styling/helpers only. Rendering and tool transport remain in the Site frame. */
|
|
4
|
+
export function inlineHtmlDocument(fragment: string): string {
|
|
5
|
+
return (
|
|
6
|
+
'<!doctype html><html><head><meta name="viewport" content="width=device-width,initial-scale=1"><style>' +
|
|
7
|
+
VISUALIZATION_CSS +
|
|
8
|
+
"</style><style>html,body{margin:0;min-height:0}body{padding:16px;box-sizing:border-box}</style></head><body>" +
|
|
9
|
+
fragment +
|
|
10
|
+
VISUALIZATION_HELPERS +
|
|
11
|
+
`<script>
|
|
12
|
+
(()=>{
|
|
13
|
+
window.addEventListener('message',event=>{
|
|
14
|
+
if(event.source!==parent||event.data?.type!=='opengeni.preview.theme')return;
|
|
15
|
+
if(event.data.theme==='light'||event.data.theme==='dark')document.documentElement.style.colorScheme=event.data.theme;
|
|
16
|
+
previous=0;resize();
|
|
17
|
+
});
|
|
18
|
+
let previous=0;
|
|
19
|
+
const resize=()=>{const height=Math.ceil(document.body.getBoundingClientRect().height);if(height!==previous){previous=height;parent.postMessage({type:'opengeni.preview.height',height},'*')}};
|
|
20
|
+
new ResizeObserver(resize).observe(document.body);resize();
|
|
21
|
+
})();
|
|
22
|
+
</script></body></html>`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -18,7 +18,8 @@ import type {
|
|
|
18
18
|
ToolGatewayCallResponse,
|
|
19
19
|
ToolGatewayDeclarationsResponse,
|
|
20
20
|
} from "@opengeni/sdk";
|
|
21
|
-
import { useEffect, useRef, type CSSProperties } from "react";
|
|
21
|
+
import { useEffect, useRef, useState, type CSSProperties } from "react";
|
|
22
|
+
import { resolveSiteClientScript } from "@opengeni/sdk/site-document";
|
|
22
23
|
|
|
23
24
|
export const PUBLISHED_HTML_ARTIFACT_IFRAME_SANDBOX = [
|
|
24
25
|
"allow-downloads",
|
|
@@ -34,6 +35,8 @@ export const PUBLISHED_HTML_ARTIFACT_IFRAME_SANDBOX = [
|
|
|
34
35
|
|
|
35
36
|
export type PublishedHtmlArtifactFrameProps = {
|
|
36
37
|
html: string;
|
|
38
|
+
autoHeight?: boolean;
|
|
39
|
+
theme?: "light" | "dark";
|
|
37
40
|
title: string;
|
|
38
41
|
className?: string;
|
|
39
42
|
style?: CSSProperties;
|
|
@@ -58,6 +61,7 @@ const SITE_BRIDGE_BOOTSTRAP_SCRIPT = `<script>(()=>{const key=${JSON.stringify(
|
|
|
58
61
|
|
|
59
62
|
export function publishedHtmlArtifactDocument(html: string, toolBridgeEnabled: boolean): string {
|
|
60
63
|
if (!toolBridgeEnabled) return html;
|
|
64
|
+
html = resolveSiteClientScript(html);
|
|
61
65
|
const doctypeEnd = leadingDoctypeEnd(html);
|
|
62
66
|
if (doctypeEnd >= 0) {
|
|
63
67
|
return `${html.slice(0, doctypeEnd + 1)}${SITE_BRIDGE_BOOTSTRAP_SCRIPT}${html.slice(doctypeEnd + 1)}`;
|
|
@@ -87,6 +91,28 @@ function leadingDoctypeEnd(html: string): number {
|
|
|
87
91
|
*/
|
|
88
92
|
export function PublishedHtmlArtifactFrame(props: PublishedHtmlArtifactFrameProps) {
|
|
89
93
|
const frameRef = useRef<HTMLIFrameElement | null>(null);
|
|
94
|
+
const [height, setHeight] = useState<number>();
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (!props.autoHeight) return;
|
|
97
|
+
const receive = (event: MessageEvent) => {
|
|
98
|
+
if (
|
|
99
|
+
event.source !== frameRef.current?.contentWindow ||
|
|
100
|
+
event.data?.type !== "opengeni.preview.height"
|
|
101
|
+
)
|
|
102
|
+
return;
|
|
103
|
+
const value = event.data.height;
|
|
104
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
105
|
+
setHeight(Math.min(1200, Math.max(80, value)));
|
|
106
|
+
};
|
|
107
|
+
window.addEventListener("message", receive);
|
|
108
|
+
return () => window.removeEventListener("message", receive);
|
|
109
|
+
}, [props.autoHeight]);
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
frameRef.current?.contentWindow?.postMessage(
|
|
112
|
+
{ type: "opengeni.preview.theme", theme: props.theme },
|
|
113
|
+
"*",
|
|
114
|
+
);
|
|
115
|
+
}, [props.theme]);
|
|
90
116
|
const bridgeRef = useRef(props.toolBridge);
|
|
91
117
|
const onFrameLoadRef = useRef<() => void>(() => undefined);
|
|
92
118
|
const frameLoadPendingRef = useRef(false);
|
|
@@ -198,11 +224,15 @@ export function PublishedHtmlArtifactFrame(props: PublishedHtmlArtifactFrameProp
|
|
|
198
224
|
referrerPolicy="no-referrer"
|
|
199
225
|
srcDoc={publishedHtmlArtifactDocument(props.html, toolBridgeEnabled)}
|
|
200
226
|
onLoad={() => {
|
|
227
|
+
frameRef.current?.contentWindow?.postMessage(
|
|
228
|
+
{ type: "opengeni.preview.theme", theme: props.theme },
|
|
229
|
+
"*",
|
|
230
|
+
);
|
|
201
231
|
frameLoadPendingRef.current = true;
|
|
202
232
|
onFrameLoadRef.current();
|
|
203
233
|
}}
|
|
204
234
|
className={props.className}
|
|
205
|
-
style={props.style}
|
|
235
|
+
style={{ ...props.style, ...(props.autoHeight && height ? { height } : {}) }}
|
|
206
236
|
/>
|
|
207
237
|
);
|
|
208
238
|
}
|