@opengeni/react 1.4.0 → 1.4.4
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 +8 -0
- package/dist/accounts.js +2 -0
- package/dist/accounts.js.map +1 -1
- package/dist/artifacts-document.js +5 -4
- package/dist/artifacts-presentation.js +5 -4
- package/dist/artifacts-spreadsheet.js +4 -3
- package/dist/artifacts.js +14 -13
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-5EEAS3IU.js +17 -0
- package/dist/chat-interactive-block-ZFHOKTMS.js +12 -0
- package/dist/{chunk-WEHMPOXK.js → chunk-2DDJ6YH6.js} +3 -1
- package/dist/{chunk-WEHMPOXK.js.map → chunk-2DDJ6YH6.js.map} +1 -1
- package/dist/{chunk-C5X5AJXK.js → chunk-2HVLQ26H.js} +5 -4
- package/dist/{chunk-C5X5AJXK.js.map → chunk-2HVLQ26H.js.map} +1 -1
- package/dist/{chunk-HDJWDK7W.js → chunk-2OQA3CPB.js} +300 -166
- package/dist/{chunk-HDJWDK7W.js.map → chunk-2OQA3CPB.js.map} +1 -1
- package/dist/{chunk-A4UJB2MM.js → chunk-32CGLXW2.js} +4 -3
- package/dist/{chunk-A4UJB2MM.js.map → chunk-32CGLXW2.js.map} +1 -1
- package/dist/{chunk-5CVXZA3Y.js → chunk-45NUOSXQ.js} +3 -2
- package/dist/{chunk-5CVXZA3Y.js.map → chunk-45NUOSXQ.js.map} +1 -1
- package/dist/{chunk-WUISZ3WU.js → chunk-53KJBGPZ.js} +5 -4
- package/dist/{chunk-WUISZ3WU.js.map → chunk-53KJBGPZ.js.map} +1 -1
- package/dist/{chunk-MBMPHOMA.js → chunk-55DXD22O.js} +3 -2
- package/dist/{chunk-MBMPHOMA.js.map → chunk-55DXD22O.js.map} +1 -1
- package/dist/{chunk-JT4JW7BC.js → chunk-5I4VRWBB.js} +3 -1
- package/dist/{chunk-JT4JW7BC.js.map → chunk-5I4VRWBB.js.map} +1 -1
- package/dist/{chunk-UK4TINKT.js → chunk-B27E3V37.js} +3 -1
- package/dist/{chunk-UK4TINKT.js.map → chunk-B27E3V37.js.map} +1 -1
- package/dist/{chunk-J6DBS4T3.js → chunk-BNKV5ZLF.js} +5 -4
- package/dist/{chunk-J6DBS4T3.js.map → chunk-BNKV5ZLF.js.map} +1 -1
- package/dist/{chunk-YM2DE7BQ.js → chunk-C5BF4L26.js} +13 -12
- package/dist/{chunk-YM2DE7BQ.js.map → chunk-C5BF4L26.js.map} +1 -1
- package/dist/{chunk-YBXQDQFX.js → chunk-C7CMD56T.js} +6 -5
- package/dist/{chunk-YBXQDQFX.js.map → chunk-C7CMD56T.js.map} +1 -1
- package/dist/{chunk-UGLEYEMP.js → chunk-CM7LVUKC.js} +3 -1
- package/dist/{chunk-UGLEYEMP.js.map → chunk-CM7LVUKC.js.map} +1 -1
- package/dist/{chunk-JVYQRRC4.js → chunk-CVYCLFMH.js} +3 -1
- package/dist/{chunk-JVYQRRC4.js.map → chunk-CVYCLFMH.js.map} +1 -1
- package/dist/{chunk-LJ2UTJJE.js → chunk-EAOSEIXB.js} +182 -97
- package/dist/chunk-EAOSEIXB.js.map +1 -0
- package/dist/{chunk-Y2PRMYLC.js → chunk-G3U2A6GS.js} +3 -2
- package/dist/{chunk-Y2PRMYLC.js.map → chunk-G3U2A6GS.js.map} +1 -1
- package/dist/{chunk-WZMYFJD3.js → chunk-G6YRCIYJ.js} +16 -7
- package/dist/{chunk-WZMYFJD3.js.map → chunk-G6YRCIYJ.js.map} +1 -1
- package/dist/{chunk-B3V6TG77.js → chunk-GC3PH6N7.js} +3 -1
- package/dist/{chunk-B3V6TG77.js.map → chunk-GC3PH6N7.js.map} +1 -1
- package/dist/{chunk-CJUO7J5Z.js → chunk-HXYOSSQO.js} +3 -2
- package/dist/{chunk-CJUO7J5Z.js.map → chunk-HXYOSSQO.js.map} +1 -1
- package/dist/{chunk-GYVRFZDY.js → chunk-I6OY3MWC.js} +310 -115
- package/dist/chunk-I6OY3MWC.js.map +1 -0
- package/dist/{chunk-BRM6FVZA.js → chunk-IEE7WCLN.js} +4 -3
- package/dist/{chunk-BRM6FVZA.js.map → chunk-IEE7WCLN.js.map} +1 -1
- package/dist/{chunk-DYWBUX5Q.js → chunk-IMSUVYQB.js} +6 -5
- package/dist/{chunk-DYWBUX5Q.js.map → chunk-IMSUVYQB.js.map} +1 -1
- package/dist/{chunk-LN6TCXD3.js → chunk-IUHHPMAX.js} +184 -48
- package/dist/chunk-IUHHPMAX.js.map +1 -0
- package/dist/{chunk-SGKD2OCN.js → chunk-IYQCWGU5.js} +6 -5
- package/dist/{chunk-SGKD2OCN.js.map → chunk-IYQCWGU5.js.map} +1 -1
- package/dist/{chunk-J2QWVSQY.js → chunk-JH7V627O.js} +8 -7
- package/dist/{chunk-J2QWVSQY.js.map → chunk-JH7V627O.js.map} +1 -1
- package/dist/{chunk-EESD3PY3.js → chunk-JHTIMBOL.js} +6 -5
- package/dist/{chunk-EESD3PY3.js.map → chunk-JHTIMBOL.js.map} +1 -1
- package/dist/{chunk-LNIRAOA3.js → chunk-L2J3PU7A.js} +7 -6
- package/dist/{chunk-LNIRAOA3.js.map → chunk-L2J3PU7A.js.map} +1 -1
- package/dist/{chunk-ZYRGEKWS.js → chunk-LJUMYUBO.js} +3 -1
- package/dist/{chunk-ZYRGEKWS.js.map → chunk-LJUMYUBO.js.map} +1 -1
- package/dist/{chunk-4RVYOY4O.js → chunk-LSW2OJVV.js} +4 -3
- package/dist/{chunk-4RVYOY4O.js.map → chunk-LSW2OJVV.js.map} +1 -1
- package/dist/{chunk-UTRTG6LH.js → chunk-LVS3MH5T.js} +3 -1
- package/dist/{chunk-UTRTG6LH.js.map → chunk-LVS3MH5T.js.map} +1 -1
- package/dist/chunk-M357MHH3.js +2 -0
- package/dist/{chunk-WRHIZYZF.js → chunk-MEQM4LI3.js} +6 -5
- package/dist/{chunk-WRHIZYZF.js.map → chunk-MEQM4LI3.js.map} +1 -1
- package/dist/chunk-NX4ADH73.js +14 -0
- package/dist/chunk-NX4ADH73.js.map +1 -0
- package/dist/{chunk-XCHWDJ22.js → chunk-OGTTUYNT.js} +3 -1
- package/dist/{chunk-XCHWDJ22.js.map → chunk-OGTTUYNT.js.map} +1 -1
- package/dist/{chunk-GIMRELBW.js → chunk-OYQQJL3J.js} +3 -1
- package/dist/{chunk-GIMRELBW.js.map → chunk-OYQQJL3J.js.map} +1 -1
- package/dist/{chunk-RSI7XYXL.js → chunk-PBCZL4JP.js} +6 -5
- package/dist/{chunk-RSI7XYXL.js.map → chunk-PBCZL4JP.js.map} +1 -1
- package/dist/{chunk-I7IWRQLN.js → chunk-PHBFJCEU.js} +17 -11
- package/dist/chunk-PHBFJCEU.js.map +1 -0
- package/dist/{chunk-3CTRFMAK.js → chunk-PKCAYHDC.js} +5 -4
- package/dist/{chunk-3CTRFMAK.js.map → chunk-PKCAYHDC.js.map} +1 -1
- package/dist/{chunk-K3HQAKQX.js → chunk-PMV53IMM.js} +3 -1
- package/dist/{chunk-K3HQAKQX.js.map → chunk-PMV53IMM.js.map} +1 -1
- package/dist/{chunk-YQEAA6LT.js → chunk-QHUE7E4N.js} +3 -2
- package/dist/{chunk-YQEAA6LT.js.map → chunk-QHUE7E4N.js.map} +1 -1
- package/dist/{chunk-OA6HFRQP.js → chunk-QMMCJGFI.js} +4 -3
- package/dist/{chunk-OA6HFRQP.js.map → chunk-QMMCJGFI.js.map} +1 -1
- package/dist/{chunk-YV4L3ILF.js → chunk-QV3DJVRZ.js} +3 -1
- package/dist/{chunk-YV4L3ILF.js.map → chunk-QV3DJVRZ.js.map} +1 -1
- package/dist/{chunk-447JLCBU.js → chunk-S2QH6EZ5.js} +3 -1
- package/dist/{chunk-447JLCBU.js.map → chunk-S2QH6EZ5.js.map} +1 -1
- package/dist/{chunk-PNY3JKBJ.js → chunk-SFH43JT2.js} +5 -4
- package/dist/{chunk-PNY3JKBJ.js.map → chunk-SFH43JT2.js.map} +1 -1
- package/dist/{chunk-AWZLIMKX.js → chunk-T46QZH3E.js} +3 -1
- package/dist/{chunk-AWZLIMKX.js.map → chunk-T46QZH3E.js.map} +1 -1
- package/dist/{chunk-5J4FOW6Q.js → chunk-TNEZNMSN.js} +3 -1
- package/dist/{chunk-5J4FOW6Q.js.map → chunk-TNEZNMSN.js.map} +1 -1
- package/dist/{chunk-22KP6LR5.js → chunk-TXS65BB2.js} +3 -1
- package/dist/{chunk-22KP6LR5.js.map → chunk-TXS65BB2.js.map} +1 -1
- package/dist/{chunk-H5X55XH7.js → chunk-UDPH5SLV.js} +4 -3
- package/dist/{chunk-H5X55XH7.js.map → chunk-UDPH5SLV.js.map} +1 -1
- package/dist/{chunk-VZTQ73XT.js → chunk-XEA5BCMA.js} +3 -1
- package/dist/{chunk-VZTQ73XT.js.map → chunk-XEA5BCMA.js.map} +1 -1
- package/dist/{chunk-5F4WR7X7.js → chunk-XS67YG5R.js} +3 -1
- package/dist/{chunk-5F4WR7X7.js.map → chunk-XS67YG5R.js.map} +1 -1
- package/dist/{chunk-TKOTKRWY.js → chunk-XTD7TZHW.js} +3 -1
- package/dist/{chunk-TKOTKRWY.js.map → chunk-XTD7TZHW.js.map} +1 -1
- package/dist/{chunk-A2PI6UMY.js → chunk-YSRBFJMQ.js} +3 -1
- package/dist/{chunk-A2PI6UMY.js.map → chunk-YSRBFJMQ.js.map} +1 -1
- package/dist/chunk-YVFRBXST.js +1420 -0
- package/dist/chunk-YVFRBXST.js.map +1 -0
- package/dist/{chunk-SCOTPE2I.js → chunk-YYLBXXTE.js} +3 -1
- package/dist/{chunk-SCOTPE2I.js.map → chunk-YYLBXXTE.js.map} +1 -1
- package/dist/{chunk-RHREZ7BO.js → chunk-ZUWF4NF7.js} +3 -1
- package/dist/{chunk-RHREZ7BO.js.map → chunk-ZUWF4NF7.js.map} +1 -1
- package/dist/clipboard.js +3 -2
- package/dist/components/composer-transcription-control.d.ts +4 -0
- package/dist/components/session-conversation.d.ts +6 -0
- package/dist/composer-voice-events.d.ts +8 -0
- package/dist/composer.js +15 -13
- package/dist/computer-viewer-ELNLZGHI.js +20 -0
- package/dist/connect.js +15 -12
- package/dist/connect.js.map +1 -1
- package/dist/desktop.js +6 -5
- package/dist/desktop.js.map +1 -1
- package/dist/diffs.js +2 -1
- package/dist/diffs.js.map +1 -1
- package/dist/editor.js +4 -3
- package/dist/editor.js.map +1 -1
- package/dist/embedded-voice-NIL4RDX3.js +69 -0
- package/dist/embedded-voice-NIL4RDX3.js.map +1 -0
- package/dist/{fleet-decision-row-YZ3ZKWMM.js → fleet-decision-row-SI63O5V4.js} +3 -1
- package/dist/{fleet-decision-row-YZ3ZKWMM.js.map → fleet-decision-row-SI63O5V4.js.map} +1 -1
- package/dist/hooks/use-client-config-flags.d.ts +6 -0
- package/dist/hooks/use-computer-session.d.ts +2 -0
- package/dist/hooks/use-realtime-voice-models.d.ts +9 -0
- package/dist/hooks/use-voice-input.d.ts +8 -1
- package/dist/index.js +47 -45
- package/dist/index.js.map +1 -1
- package/dist/interaction.js +14 -13
- package/dist/interaction.js.map +1 -1
- package/dist/{latest-question-GPYM2JNU.js → latest-question-2POFPYNB.js} +5 -4
- package/dist/{latest-question-GPYM2JNU.js.map → latest-question-2POFPYNB.js.map} +1 -1
- package/dist/machines.js +8 -7
- package/dist/{markdown-table-layout-QXSLK4BY.js → markdown-table-layout-DQ4DRNVT.js} +3 -1
- package/dist/{markdown-table-layout-QXSLK4BY.js.map → markdown-table-layout-DQ4DRNVT.js.map} +1 -1
- package/dist/model-policy-picker-menu-WRNSRFQC.js +15 -0
- package/dist/model-policy.js +2 -1
- package/dist/{noto-sans-arabic-loader-IA2T4X2A.js → noto-sans-arabic-loader-XSH2KYWJ.js} +3 -1
- package/dist/{noto-sans-arabic-loader-IA2T4X2A.js.map → noto-sans-arabic-loader-XSH2KYWJ.js.map} +1 -1
- package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js → noto-sans-jp-loader.generated-MR5L6V7K.js} +3 -1
- package/dist/{noto-sans-jp-loader.generated-HFGLYBR3.js.map → noto-sans-jp-loader.generated-MR5L6V7K.js.map} +1 -1
- package/dist/{platform-activity-row-627BFZ46.js → platform-activity-row-PJJVATTZ.js} +3 -1
- package/dist/{platform-activity-row-627BFZ46.js.map → platform-activity-row-PJJVATTZ.js.map} +1 -1
- package/dist/{queue-surface-implementation-ZHFI5JBP.js → queue-surface-implementation-67FS7FUI.js} +10 -9
- package/dist/{queue-surface-implementation-ZHFI5JBP.js.map → queue-surface-implementation-67FS7FUI.js.map} +1 -1
- package/dist/realtime/embedded-voice.d.ts +20 -0
- package/dist/realtime.js +22 -1353
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-34CJJNOY.js +21 -0
- package/dist/session-ui.js +32 -30
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +10 -9
- package/dist/sites.js +2 -1
- package/dist/terminal.js +6 -5
- package/dist/terminal.js.map +1 -1
- package/dist/{timeline-annotation-markers-GNDHTGBD.js → timeline-annotation-markers-U3G66KUD.js} +5 -4
- package/dist/{timeline-annotation-markers-GNDHTGBD.js.map → timeline-annotation-markers-U3G66KUD.js.map} +1 -1
- package/dist/{timeline-annotation-selection-DMLMM2TX.js → timeline-annotation-selection-BI7QTPTZ.js} +4 -3
- package/dist/{timeline-annotation-selection-DMLMM2TX.js.map → timeline-annotation-selection-BI7QTPTZ.js.map} +1 -1
- package/dist/{timeline-annotations-dialog-ELRDBHTS.js → timeline-annotations-dialog-FOMHSDTE.js} +7 -6
- package/dist/{timeline-annotations-dialog-ELRDBHTS.js.map → timeline-annotations-dialog-FOMHSDTE.js.map} +1 -1
- package/dist/usage.js +6 -5
- package/dist/usage.js.map +1 -1
- package/dist/voice-recording-owner.d.ts +7 -0
- package/package.json +3 -3
- package/src/components/composer-transcription-control.tsx +109 -27
- package/src/components/computer-viewer.tsx +139 -30
- package/src/components/markdown.tsx +7 -2
- package/src/components/message-timeline.tsx +10 -1
- package/src/components/session-conversation.tsx +44 -0
- package/src/components/session-list.tsx +1 -1
- package/src/components/session-proxy-scope.tsx +26 -5
- package/src/composer-voice-events.ts +12 -0
- package/src/connection-discovery.tsx +4 -1
- package/src/hooks/use-browser-session.ts +445 -168
- package/src/hooks/use-client-config-flags.ts +8 -0
- package/src/hooks/use-computer-session.ts +334 -98
- package/src/hooks/use-goal.ts +12 -1
- package/src/hooks/use-realtime-voice-models.ts +67 -0
- package/src/hooks/use-voice-input.ts +109 -18
- package/src/realtime/embedded-voice.tsx +81 -0
- package/src/realtime/realtime-control.tsx +82 -17
- package/src/voice-recording-owner.ts +22 -0
- package/styles/compiled.css +77 -18
- package/styles/index.css +49 -0
- package/styles/responsive.css +61 -4
- package/styles/session-capability.css +1 -1
- package/dist/browser-viewer-SHYKQRNX.js +0 -16
- package/dist/chat-interactive-block-UGBTNB3L.js +0 -11
- package/dist/chunk-GYVRFZDY.js.map +0 -1
- package/dist/chunk-I7IWRQLN.js.map +0 -1
- package/dist/chunk-IWIDV7SB.js +0 -1
- package/dist/chunk-LJ2UTJJE.js.map +0 -1
- package/dist/chunk-LN6TCXD3.js.map +0 -1
- package/dist/computer-viewer-6SRGWRUX.js +0 -19
- package/dist/model-policy-picker-menu-DXHUL73H.js +0 -14
- package/dist/sandbox-files-GORZOUUJ.js +0 -20
- /package/dist/{browser-viewer-SHYKQRNX.js.map → browser-viewer-5EEAS3IU.js.map} +0 -0
- /package/dist/{chat-interactive-block-UGBTNB3L.js.map → chat-interactive-block-ZFHOKTMS.js.map} +0 -0
- /package/dist/{chunk-IWIDV7SB.js.map → chunk-M357MHH3.js.map} +0 -0
- /package/dist/{computer-viewer-6SRGWRUX.js.map → computer-viewer-ELNLZGHI.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-DXHUL73H.js.map → model-policy-picker-menu-WRNSRFQC.js.map} +0 -0
- /package/dist/{sandbox-files-GORZOUUJ.js.map → sandbox-files-34CJJNOY.js.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/open-geni-links.tsx"],"sourcesContent":["import type { OpenGeniClient, OpenGeniLinkTarget } from \"@opengeni/sdk\";\nimport { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport type { OpenGeniLinkTarget };\n\n/**\n * How the host opens one OpenGeni object an agent linked in chat Markdown.\n *\n * - `{ href }` renders a real link (new tab) — use it for a host page URL.\n * - `{ open }` renders a button that runs the action (download, open a panel,\n * client-side navigation) with loading and retry states.\n * - `null` / `undefined` means \"not handled here\": the next resolver is asked,\n * and when none handles it the text renders as an unavailable reference —\n * never as a navigation that would 404 inside the host.\n */\nexport type OpenGeniLinkResolution =\n | { href: string; open?: undefined }\n | { open: () => void | Promise<void>; href?: undefined };\n\nexport type OpenGeniLinkResolver = (\n target: OpenGeniLinkTarget,\n) => OpenGeniLinkResolution | null | undefined;\n\nconst OpenGeniLinkContext = createContext<OpenGeniLinkResolver | null>(null);\n\n/** First resolver that handles a target wins. */\nexport function chainLinkResolvers(\n ...resolvers: ReadonlyArray<OpenGeniLinkResolver | null | undefined>\n): OpenGeniLinkResolver | null {\n const active = resolvers.filter((resolver): resolver is OpenGeniLinkResolver =>\n Boolean(resolver),\n );\n if (active.length === 0) return null;\n if (active.length === 1) return active[0]!;\n return (target) => {\n for (const resolver of active) {\n const resolution = resolver(target);\n if (resolution) return resolution;\n }\n return null;\n };\n}\n\n/**\n * Resolve OpenGeni object links (`artifact:`, `sandbox:`, editable artifacts,\n * Sites) for every {@link Markdown} body below. An inner provider is asked\n * before an outer one, so a host can override a single kind and keep defaults.\n */\nexport function OpenGeniLinkProvider({\n resolveLink,\n children,\n}: {\n resolveLink: OpenGeniLinkResolver | null | undefined;\n children: ReactNode;\n}) {\n const parent = useContext(OpenGeniLinkContext);\n const value = useMemo(() => chainLinkResolvers(resolveLink, parent), [resolveLink, parent]);\n return <OpenGeniLinkContext.Provider value={value}>{children}</OpenGeniLinkContext.Provider>;\n}\n\n/** The effective resolver from the nearest {@link OpenGeniLinkProvider}. */\nexport function useOpenGeniLinkResolver(): OpenGeniLinkResolver | null {\n return useContext(OpenGeniLinkContext);\n}\n\n// Every sandbox read the proxy forwards is bounded by the API's own maximum.\nconst SANDBOX_DOWNLOAD_MAX_BYTES = 25 * 1024 * 1024;\n\ntype SessionLinkClient = Partial<Pick<OpenGeniClient, \"createFileDownloadUrl\" | \"fsRead\">>;\n\nfunction saveBlob(blob: Blob, filename: string): void {\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n link.download = filename;\n link.rel = \"noopener\";\n document.body.append(link);\n link.click();\n link.remove();\n setTimeout(() => URL.revokeObjectURL(url), 60_000);\n}\n\nfunction openUrl(url: string): void {\n // A signed download URL is attachment-disposition; an anchor click keeps the\n // page and survives popup blockers after the awaited URL request.\n const link = document.createElement(\"a\");\n link.href = url;\n link.rel = \"noopener noreferrer\";\n link.target = \"_blank\";\n document.body.append(link);\n link.click();\n link.remove();\n}\n\nfunction base64Bytes(content: string): Uint8Array<ArrayBuffer> {\n const binary = atob(content);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);\n return bytes;\n}\n\n/**\n * Default resolver for a session conversation that talks to OpenGeni through\n * the normal SDK client (for example behind `createSessionProxyHandler`):\n *\n * - `artifact:<file>` downloads the retained file through a short-lived URL.\n * - `sandbox:<path>` downloads when enabled by the host proxy capability.\n *\n * Editable artifacts and Sites have no default: they need a host surface\n * (see `@opengeni/react/artifacts/*` and `@opengeni/react/sites`), so they stay\n * unavailable until the host resolves them.\n */\nexport function sessionLinkResolver(input: {\n client: SessionLinkClient;\n workspaceId: string;\n sessionId: string;\n sandboxFiles?: boolean;\n}): OpenGeniLinkResolver {\n const { client, workspaceId, sessionId } = input;\n return (target) => {\n if (target.kind === \"file\") {\n if (target.workspaceId !== null && target.workspaceId !== workspaceId) return null;\n if (typeof client.createFileDownloadUrl !== \"function\") return null;\n return {\n open: async () => {\n const { url } = await client.createFileDownloadUrl!(workspaceId, target.fileId, {\n sessionId,\n });\n openUrl(url);\n },\n };\n }\n if (target.kind === \"sandbox-file\") {\n if (input.sandboxFiles === false) return null;\n if (typeof client.fsRead !== \"function\") return null;\n return {\n open: async () => {\n const file = await client.fsRead!(workspaceId, sessionId, {\n path: target.path,\n encoding: \"base64\",\n maxBytes: SANDBOX_DOWNLOAD_MAX_BYTES,\n });\n if (file.truncated) throw new Error(\"File is too large to download here.\");\n const name = file.path.split(/[\\\\/]/u).at(-1) || \"download\";\n const bytes =\n file.encoding === \"base64\"\n ? base64Bytes(file.content)\n : new TextEncoder().encode(file.content);\n saveBlob(new Blob([bytes], { type: \"application/octet-stream\" }), name);\n },\n };\n }\n return null;\n };\n}\n\n/** An editable artifact or Site to open in a host-mounted viewer. */\nexport type OpenGeniViewerTarget = Readonly<{\n kind: \"editable-artifact\" | \"site\";\n artifactId: string;\n /** The link text the agent wrote, until the viewer loads the real title. */\n title?: string | undefined;\n}>;\n\n/**\n * \"Open in host viewer\": resolve agent links to editable artifacts and Sites\n * in this workspace to `open(target)`, for example to mount\n * `SessionArtifactViewer` beside the conversation. Other targets fall through.\n */\nexport function viewerLinkResolver(input: {\n workspaceId: string;\n open: (target: OpenGeniViewerTarget) => void;\n}): OpenGeniLinkResolver {\n return (target) => {\n if (target.kind !== \"editable-artifact\" && target.kind !== \"site\") return null;\n if (target.workspaceId !== input.workspaceId) return null;\n return { open: () => input.open({ kind: target.kind, artifactId: target.artifactId }) };\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/open-geni-links.tsx"],"sourcesContent":["import type { OpenGeniClient, OpenGeniLinkTarget } from \"@opengeni/sdk\";\nimport { createContext, useContext, useMemo, type ReactNode } from \"react\";\n\nexport type { OpenGeniLinkTarget };\n\n/**\n * How the host opens one OpenGeni object an agent linked in chat Markdown.\n *\n * - `{ href }` renders a real link (new tab) — use it for a host page URL.\n * - `{ open }` renders a button that runs the action (download, open a panel,\n * client-side navigation) with loading and retry states.\n * - `null` / `undefined` means \"not handled here\": the next resolver is asked,\n * and when none handles it the text renders as an unavailable reference —\n * never as a navigation that would 404 inside the host.\n */\nexport type OpenGeniLinkResolution =\n | { href: string; open?: undefined }\n | { open: () => void | Promise<void>; href?: undefined };\n\nexport type OpenGeniLinkResolver = (\n target: OpenGeniLinkTarget,\n) => OpenGeniLinkResolution | null | undefined;\n\nconst OpenGeniLinkContext = createContext<OpenGeniLinkResolver | null>(null);\n\n/** First resolver that handles a target wins. */\nexport function chainLinkResolvers(\n ...resolvers: ReadonlyArray<OpenGeniLinkResolver | null | undefined>\n): OpenGeniLinkResolver | null {\n const active = resolvers.filter((resolver): resolver is OpenGeniLinkResolver =>\n Boolean(resolver),\n );\n if (active.length === 0) return null;\n if (active.length === 1) return active[0]!;\n return (target) => {\n for (const resolver of active) {\n const resolution = resolver(target);\n if (resolution) return resolution;\n }\n return null;\n };\n}\n\n/**\n * Resolve OpenGeni object links (`artifact:`, `sandbox:`, editable artifacts,\n * Sites) for every {@link Markdown} body below. An inner provider is asked\n * before an outer one, so a host can override a single kind and keep defaults.\n */\nexport function OpenGeniLinkProvider({\n resolveLink,\n children,\n}: {\n resolveLink: OpenGeniLinkResolver | null | undefined;\n children: ReactNode;\n}) {\n const parent = useContext(OpenGeniLinkContext);\n const value = useMemo(() => chainLinkResolvers(resolveLink, parent), [resolveLink, parent]);\n return <OpenGeniLinkContext.Provider value={value}>{children}</OpenGeniLinkContext.Provider>;\n}\n\n/** The effective resolver from the nearest {@link OpenGeniLinkProvider}. */\nexport function useOpenGeniLinkResolver(): OpenGeniLinkResolver | null {\n return useContext(OpenGeniLinkContext);\n}\n\n// Every sandbox read the proxy forwards is bounded by the API's own maximum.\nconst SANDBOX_DOWNLOAD_MAX_BYTES = 25 * 1024 * 1024;\n\ntype SessionLinkClient = Partial<Pick<OpenGeniClient, \"createFileDownloadUrl\" | \"fsRead\">>;\n\nfunction saveBlob(blob: Blob, filename: string): void {\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.href = url;\n link.download = filename;\n link.rel = \"noopener\";\n document.body.append(link);\n link.click();\n link.remove();\n setTimeout(() => URL.revokeObjectURL(url), 60_000);\n}\n\nfunction openUrl(url: string): void {\n // A signed download URL is attachment-disposition; an anchor click keeps the\n // page and survives popup blockers after the awaited URL request.\n const link = document.createElement(\"a\");\n link.href = url;\n link.rel = \"noopener noreferrer\";\n link.target = \"_blank\";\n document.body.append(link);\n link.click();\n link.remove();\n}\n\nfunction base64Bytes(content: string): Uint8Array<ArrayBuffer> {\n const binary = atob(content);\n const bytes = new Uint8Array(binary.length);\n for (let index = 0; index < binary.length; index += 1) bytes[index] = binary.charCodeAt(index);\n return bytes;\n}\n\n/**\n * Default resolver for a session conversation that talks to OpenGeni through\n * the normal SDK client (for example behind `createSessionProxyHandler`):\n *\n * - `artifact:<file>` downloads the retained file through a short-lived URL.\n * - `sandbox:<path>` downloads when enabled by the host proxy capability.\n *\n * Editable artifacts and Sites have no default: they need a host surface\n * (see `@opengeni/react/artifacts/*` and `@opengeni/react/sites`), so they stay\n * unavailable until the host resolves them.\n */\nexport function sessionLinkResolver(input: {\n client: SessionLinkClient;\n workspaceId: string;\n sessionId: string;\n sandboxFiles?: boolean;\n}): OpenGeniLinkResolver {\n const { client, workspaceId, sessionId } = input;\n return (target) => {\n if (target.kind === \"file\") {\n if (target.workspaceId !== null && target.workspaceId !== workspaceId) return null;\n if (typeof client.createFileDownloadUrl !== \"function\") return null;\n return {\n open: async () => {\n const { url } = await client.createFileDownloadUrl!(workspaceId, target.fileId, {\n sessionId,\n });\n openUrl(url);\n },\n };\n }\n if (target.kind === \"sandbox-file\") {\n if (input.sandboxFiles === false) return null;\n if (typeof client.fsRead !== \"function\") return null;\n return {\n open: async () => {\n const file = await client.fsRead!(workspaceId, sessionId, {\n path: target.path,\n encoding: \"base64\",\n maxBytes: SANDBOX_DOWNLOAD_MAX_BYTES,\n });\n if (file.truncated) throw new Error(\"File is too large to download here.\");\n const name = file.path.split(/[\\\\/]/u).at(-1) || \"download\";\n const bytes =\n file.encoding === \"base64\"\n ? base64Bytes(file.content)\n : new TextEncoder().encode(file.content);\n saveBlob(new Blob([bytes], { type: \"application/octet-stream\" }), name);\n },\n };\n }\n return null;\n };\n}\n\n/** An editable artifact or Site to open in a host-mounted viewer. */\nexport type OpenGeniViewerTarget = Readonly<{\n kind: \"editable-artifact\" | \"site\";\n artifactId: string;\n /** The link text the agent wrote, until the viewer loads the real title. */\n title?: string | undefined;\n}>;\n\n/**\n * \"Open in host viewer\": resolve agent links to editable artifacts and Sites\n * in this workspace to `open(target)`, for example to mount\n * `SessionArtifactViewer` beside the conversation. Other targets fall through.\n */\nexport function viewerLinkResolver(input: {\n workspaceId: string;\n open: (target: OpenGeniViewerTarget) => void;\n}): OpenGeniLinkResolver {\n return (target) => {\n if (target.kind !== \"editable-artifact\" && target.kind !== \"site\") return null;\n if (target.workspaceId !== input.workspaceId) return null;\n return { open: () => input.open({ kind: target.kind, artifactId: target.artifactId }) };\n };\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// src/lib/motion.ts
|
|
2
4
|
import { flushSync } from "react-dom";
|
|
3
5
|
var query;
|
|
@@ -11,4 +13,4 @@ function prefersReducedMotion() {
|
|
|
11
13
|
export {
|
|
12
14
|
prefersReducedMotion
|
|
13
15
|
};
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-OYQQJL3J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/lib/motion.ts"],"sourcesContent":["import { flushSync } from \"react-dom\";\n\n/**\n * Live `prefers-reduced-motion` check for JS-driven motion (scroll glides,\n * streaming word reveals). CSS animations are already neutralized globally in\n * styles/index.css; this lets the imperative paths skip their work entirely.\n */\nlet query: MediaQueryList | null | undefined;\n\nexport function prefersReducedMotion(): boolean {\n if (query === undefined) {\n query =\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n : null;\n }\n return query?.matches ?? false;\n}\n\n/** Test seam: forget the cached MediaQueryList so a stubbed matchMedia applies. */\nexport function resetReducedMotionCache(): void {\n query = undefined;\n}\n\ntype ViewTransitionResult = { finished: Promise<void> };\ntype ViewTransitionCallback = () => void;\ntype ViewTransitionOptions = {\n update: ViewTransitionCallback;\n types?: string[];\n};\ntype ViewTransitionStarter = {\n (callback: ViewTransitionCallback): ViewTransitionResult;\n (options: ViewTransitionOptions): ViewTransitionResult;\n};\n\n/** Active VT type for markdown crystallize — scoped CSS, not a full-page blink. */\nexport const MARKDOWN_CRYSTALLIZE_VT_TYPE = \"og-md-crystallize\";\n\n/**\n * Run a DOM update inside the browser View Transition API when available.\n * Snapshots the before/after paint and cross-fades (or custom CSS morphs)\n * between them — the platform \"morph\" primitive React's experimental\n * `<ViewTransition>` wraps. Falls back to a synchronous update.\n */\nexport function runViewTransition(update: () => void, options?: { types?: string[] }): void {\n if (prefersReducedMotion()) {\n update();\n return;\n }\n const doc = typeof document !== \"undefined\" ? document : null;\n const start = doc\n ? ((doc as Document & { startViewTransition?: ViewTransitionStarter }).startViewTransition ??\n null)\n : null;\n if (typeof start !== \"function\") {\n update();\n return;\n }\n const types = options?.types;\n if (types && types.length > 0) {\n try {\n Reflect.apply(start, doc, [\n {\n update: () => {\n flushSync(update);\n },\n types,\n },\n ]);\n return;\n } catch {\n // Older engines only accept the callback form.\n }\n }\n Reflect.apply(start, doc, [\n () => {\n flushSync(update);\n },\n ]);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/lib/motion.ts"],"sourcesContent":["import { flushSync } from \"react-dom\";\n\n/**\n * Live `prefers-reduced-motion` check for JS-driven motion (scroll glides,\n * streaming word reveals). CSS animations are already neutralized globally in\n * styles/index.css; this lets the imperative paths skip their work entirely.\n */\nlet query: MediaQueryList | null | undefined;\n\nexport function prefersReducedMotion(): boolean {\n if (query === undefined) {\n query =\n typeof window !== \"undefined\" && typeof window.matchMedia === \"function\"\n ? window.matchMedia(\"(prefers-reduced-motion: reduce)\")\n : null;\n }\n return query?.matches ?? false;\n}\n\n/** Test seam: forget the cached MediaQueryList so a stubbed matchMedia applies. */\nexport function resetReducedMotionCache(): void {\n query = undefined;\n}\n\ntype ViewTransitionResult = { finished: Promise<void> };\ntype ViewTransitionCallback = () => void;\ntype ViewTransitionOptions = {\n update: ViewTransitionCallback;\n types?: string[];\n};\ntype ViewTransitionStarter = {\n (callback: ViewTransitionCallback): ViewTransitionResult;\n (options: ViewTransitionOptions): ViewTransitionResult;\n};\n\n/** Active VT type for markdown crystallize — scoped CSS, not a full-page blink. */\nexport const MARKDOWN_CRYSTALLIZE_VT_TYPE = \"og-md-crystallize\";\n\n/**\n * Run a DOM update inside the browser View Transition API when available.\n * Snapshots the before/after paint and cross-fades (or custom CSS morphs)\n * between them — the platform \"morph\" primitive React's experimental\n * `<ViewTransition>` wraps. Falls back to a synchronous update.\n */\nexport function runViewTransition(update: () => void, options?: { types?: string[] }): void {\n if (prefersReducedMotion()) {\n update();\n return;\n }\n const doc = typeof document !== \"undefined\" ? document : null;\n const start = doc\n ? ((doc as Document & { startViewTransition?: ViewTransitionStarter }).startViewTransition ??\n null)\n : null;\n if (typeof start !== \"function\") {\n update();\n return;\n }\n const types = options?.types;\n if (types && types.length > 0) {\n try {\n Reflect.apply(start, doc, [\n {\n update: () => {\n flushSync(update);\n },\n types,\n },\n ]);\n return;\n } catch {\n // Older engines only accept the callback form.\n }\n }\n Reflect.apply(start, doc, [\n () => {\n flushSync(update);\n },\n ]);\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAO1B,IAAI;AAEG,SAAS,uBAAgC;AAC9C,MAAI,UAAU,QAAW;AACvB,YACE,OAAO,WAAW,eAAe,OAAO,OAAO,eAAe,aAC1D,OAAO,WAAW,kCAAkC,IACpD;AAAA,EACR;AACA,SAAO,OAAO,WAAW;AAC3B;","names":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
3
|
COMPOSER_MODEL_UNAVAILABLE_MESSAGE,
|
|
3
4
|
ComposerReconciliationRequiredError,
|
|
@@ -5,17 +6,17 @@ import {
|
|
|
5
6
|
ComposerWorkspaceControlUnavailableError,
|
|
6
7
|
composerSubmissionCanRetry,
|
|
7
8
|
composerSubmissionErrorMessage
|
|
8
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LVS3MH5T.js";
|
|
9
10
|
import {
|
|
10
11
|
useSessionEventTrigger
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QHUE7E4N.js";
|
|
12
13
|
import {
|
|
13
14
|
normalizeError,
|
|
14
15
|
useErrorMessage
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-CM7LVUKC.js";
|
|
16
17
|
import {
|
|
17
18
|
useEmbeddedSession
|
|
18
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-XTD7TZHW.js";
|
|
19
20
|
|
|
20
21
|
// src/hooks/use-composer.ts
|
|
21
22
|
import {
|
|
@@ -2152,4 +2153,4 @@ export {
|
|
|
2152
2153
|
shouldSubmitOnKey,
|
|
2153
2154
|
shouldSteerOnKey
|
|
2154
2155
|
};
|
|
2155
|
-
//# sourceMappingURL=chunk-
|
|
2156
|
+
//# sourceMappingURL=chunk-PBCZL4JP.js.map
|