@opengeni/react 1.0.1 → 1.0.2-canary.37191796234001
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 +651 -21
- package/dist/accounts.d.ts +64 -0
- package/dist/accounts.js +822 -0
- package/dist/accounts.js.map +1 -0
- package/dist/approvals.d.ts +2 -1
- package/dist/artifacts-document.js +3 -2
- package/dist/artifacts-presentation.js +3 -2
- package/dist/artifacts-spreadsheet.js +2 -2
- package/dist/artifacts.d.ts +4 -1
- package/dist/artifacts.js +518 -42
- package/dist/artifacts.js.map +1 -1
- package/dist/browser-viewer-GTR5XQ7X.js +16 -0
- package/dist/capability-catalog-row.d.ts +20 -0
- package/dist/capability-logo-fallback.d.ts +3 -0
- package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
- package/dist/chat-interactive-block-UGBTNB3L.js.map +1 -0
- package/dist/{chunk-5UQPNLIO.js → chunk-23J2ZNXT.js} +4117 -3896
- package/dist/chunk-23J2ZNXT.js.map +1 -0
- package/dist/chunk-447JLCBU.js +209 -0
- package/dist/chunk-447JLCBU.js.map +1 -0
- package/dist/chunk-4RVYOY4O.js +379 -0
- package/dist/chunk-4RVYOY4O.js.map +1 -0
- package/dist/chunk-5CVXZA3Y.js +292 -0
- package/dist/chunk-5CVXZA3Y.js.map +1 -0
- package/dist/chunk-5J4FOW6Q.js +108 -0
- package/dist/chunk-5J4FOW6Q.js.map +1 -0
- package/dist/chunk-A2PI6UMY.js +41 -0
- package/dist/chunk-A2PI6UMY.js.map +1 -0
- package/dist/{chunk-7WCLAEFV.js → chunk-A4UJB2MM.js} +37 -27
- package/dist/chunk-A4UJB2MM.js.map +1 -0
- package/dist/chunk-B3V6TG77.js +41 -0
- package/dist/chunk-B3V6TG77.js.map +1 -0
- package/dist/chunk-BRM6FVZA.js +302 -0
- package/dist/chunk-BRM6FVZA.js.map +1 -0
- package/dist/chunk-C5X5AJXK.js +182 -0
- package/dist/chunk-C5X5AJXK.js.map +1 -0
- package/dist/chunk-CR7U7HAR.js +453 -0
- package/dist/chunk-CR7U7HAR.js.map +1 -0
- package/dist/{chunk-R3AZOAB5.js → chunk-DYWBUX5Q.js} +29 -123
- package/dist/chunk-DYWBUX5Q.js.map +1 -0
- package/dist/chunk-E3G7SAYZ.js +3124 -0
- package/dist/chunk-E3G7SAYZ.js.map +1 -0
- package/dist/chunk-ELCE5SXV.js +359 -0
- package/dist/chunk-ELCE5SXV.js.map +1 -0
- package/dist/chunk-ERGYJIBB.js +21 -0
- package/dist/chunk-ERGYJIBB.js.map +1 -0
- package/dist/chunk-FFA2OVOV.js +319 -0
- package/dist/chunk-FFA2OVOV.js.map +1 -0
- package/dist/chunk-FZCP527Y.js +116 -0
- package/dist/chunk-FZCP527Y.js.map +1 -0
- package/dist/chunk-GIMRELBW.js +14 -0
- package/dist/chunk-GIMRELBW.js.map +1 -0
- package/dist/{chunk-6KLX2RH5.js → chunk-H2NJQORO.js} +1069 -79
- package/dist/chunk-H2NJQORO.js.map +1 -0
- package/dist/chunk-I7IWRQLN.js +1608 -0
- package/dist/chunk-I7IWRQLN.js.map +1 -0
- package/dist/{chunk-HA46CYQK.js → chunk-IQUCRAT7.js} +792 -537
- package/dist/chunk-IQUCRAT7.js.map +1 -0
- package/dist/chunk-IWIDV7SB.js +1 -0
- package/dist/chunk-IWIDV7SB.js.map +1 -0
- package/dist/chunk-J2QWVSQY.js +312 -0
- package/dist/chunk-J2QWVSQY.js.map +1 -0
- package/dist/chunk-JFNEV4LU.js +2733 -0
- package/dist/chunk-JFNEV4LU.js.map +1 -0
- package/dist/chunk-JT4JW7BC.js +54 -0
- package/dist/chunk-JT4JW7BC.js.map +1 -0
- package/dist/chunk-K3HQAKQX.js +24 -0
- package/dist/chunk-K3HQAKQX.js.map +1 -0
- package/dist/{chunk-C5ZPSSS5.js → chunk-NEXLLTP4.js} +2 -1
- package/dist/{chunk-C5ZPSSS5.js.map → chunk-NEXLLTP4.js.map} +1 -1
- package/dist/chunk-NZUI76EM.js +371 -0
- package/dist/chunk-NZUI76EM.js.map +1 -0
- package/dist/{chunk-PEI6RANI.js → chunk-PNY3JKBJ.js} +309 -74
- package/dist/chunk-PNY3JKBJ.js.map +1 -0
- package/dist/{chunk-IGC6A2ZI.js → chunk-Q5QBEZIQ.js} +777 -246
- package/dist/chunk-Q5QBEZIQ.js.map +1 -0
- package/dist/chunk-RHREZ7BO.js +11 -0
- package/dist/chunk-RHREZ7BO.js.map +1 -0
- package/dist/chunk-SCOTPE2I.js +589 -0
- package/dist/chunk-SCOTPE2I.js.map +1 -0
- package/dist/{chunk-B6WPZSTT.js → chunk-SJZDKVW2.js} +1331 -1163
- package/dist/chunk-SJZDKVW2.js.map +1 -0
- package/dist/chunk-TMJRG4YC.js +12803 -0
- package/dist/chunk-TMJRG4YC.js.map +1 -0
- package/dist/chunk-TMYGL6X5.js +742 -0
- package/dist/chunk-TMYGL6X5.js.map +1 -0
- package/dist/chunk-UGLEYEMP.js +33 -0
- package/dist/chunk-UGLEYEMP.js.map +1 -0
- package/dist/chunk-UK4TINKT.js +27 -0
- package/dist/chunk-UK4TINKT.js.map +1 -0
- package/dist/chunk-UTRTG6LH.js +220 -0
- package/dist/chunk-UTRTG6LH.js.map +1 -0
- package/dist/chunk-WEHMPOXK.js +39 -0
- package/dist/chunk-WEHMPOXK.js.map +1 -0
- package/dist/chunk-WRHIZYZF.js +988 -0
- package/dist/chunk-WRHIZYZF.js.map +1 -0
- package/dist/{chunk-HUIKIDM5.js → chunk-WUISZ3WU.js} +223 -115
- package/dist/chunk-WUISZ3WU.js.map +1 -0
- package/dist/chunk-XCHWDJ22.js +107 -0
- package/dist/chunk-XCHWDJ22.js.map +1 -0
- package/dist/chunk-XOAMRDDK.js +481 -0
- package/dist/chunk-XOAMRDDK.js.map +1 -0
- package/dist/chunk-XUW2UWQM.js +299 -0
- package/dist/chunk-XUW2UWQM.js.map +1 -0
- package/dist/{chunk-KCGXPP5V.js → chunk-Y2PRMYLC.js} +11 -6
- package/dist/chunk-Y2PRMYLC.js.map +1 -0
- package/dist/chunk-YBXQDQFX.js +1772 -0
- package/dist/chunk-YBXQDQFX.js.map +1 -0
- package/dist/{chunk-KZ73RL76.js → chunk-YQEAA6LT.js} +7 -3
- package/dist/chunk-YQEAA6LT.js.map +1 -0
- package/dist/chunk-YV4L3ILF.js +9 -0
- package/dist/chunk-YV4L3ILF.js.map +1 -0
- package/dist/{chunk-LLOLUHVG.js → chunk-YWFG7ZX7.js} +1358 -2746
- package/dist/chunk-YWFG7ZX7.js.map +1 -0
- package/dist/chunk-ZYRGEKWS.js +216 -0
- package/dist/chunk-ZYRGEKWS.js.map +1 -0
- package/dist/client.d.ts +7 -4
- package/dist/clipboard.js +1 -0
- package/dist/commands/types.d.ts +2 -0
- package/dist/components/anthropic-mark.d.ts +3 -0
- package/dist/components/approval-surface.d.ts +15 -0
- package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
- package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
- package/dist/components/artifacts/artifact-surface.d.ts +3 -1
- package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
- package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
- package/dist/components/artifacts/document-editor.d.ts +4 -2
- package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
- package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
- package/dist/components/artifacts/editable-document.d.ts +1 -1
- package/dist/components/artifacts/editable-presentation.d.ts +2 -2
- package/dist/components/artifacts/editable-spreadsheet.d.ts +2 -1
- package/dist/components/artifacts/index.d.ts +8 -1
- package/dist/components/artifacts/inline-html-document.d.ts +2 -0
- package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
- package/dist/components/artifacts/presentation-editor.d.ts +6 -2
- package/dist/components/artifacts/published-html-artifact-frame.d.ts +48 -3
- package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
- package/dist/components/artifacts/site-view.d.ts +23 -0
- package/dist/components/artifacts/spreadsheet-general-display.d.ts +24 -0
- package/dist/components/artifacts/visualization-assets.gen.d.ts +2 -0
- package/dist/components/browser-select-control.d.ts +16 -0
- package/dist/components/browser-viewer.d.ts +10 -1
- package/dist/components/chat-composer.d.ts +21 -3
- package/dist/components/child-session-link.d.ts +5 -0
- package/dist/components/claude-mark.d.ts +3 -0
- package/dist/components/code-editor.d.ts +1 -4
- package/dist/components/composer.d.ts +45 -4
- package/dist/components/computer-viewer.d.ts +4 -1
- package/dist/components/copy-button.d.ts +3 -1
- package/dist/components/desktop-viewer.d.ts +1 -1
- package/dist/components/enrollment-consent.d.ts +6 -3
- package/dist/components/file-browser.d.ts +10 -1
- package/dist/components/fleet-tile.d.ts +2 -2
- package/dist/components/grok-mark.d.ts +26 -0
- package/dist/components/human-input-form.d.ts +21 -2
- package/dist/components/human-input-surface.d.ts +6 -3
- package/dist/components/machine-card.d.ts +4 -1
- package/dist/components/machines/machine-detail.d.ts +4 -1
- package/dist/components/machines/machine-operation-policy.d.ts +11 -0
- package/dist/components/machines-dashboard.d.ts +3 -1
- package/dist/components/markdown-table-layout.d.ts +12 -0
- package/dist/components/markdown.d.ts +47 -3
- package/dist/components/message-timeline.d.ts +72 -9
- package/dist/components/model-mark.d.ts +29 -0
- package/dist/components/model-policy-picker-menu.d.ts +9 -0
- package/dist/components/model-policy-picker.d.ts +62 -13
- package/dist/components/open-geni-chat.d.ts +55 -0
- package/dist/components/open-geni-links.d.ts +68 -0
- package/dist/components/openrouter-mark.d.ts +6 -0
- package/dist/components/pierre-file.d.ts +1 -1
- package/dist/components/preview-loading.d.ts +2 -0
- package/dist/components/queue-item-content.d.ts +9 -0
- package/dist/components/sandbox-files.d.ts +13 -2
- package/dist/components/sandbox-workspace.d.ts +43 -3
- package/dist/components/session-capability-frame.d.ts +35 -0
- package/dist/components/session-chrome.d.ts +66 -8
- package/dist/components/session-commands-panel.d.ts +6 -0
- package/dist/components/session-commands.d.ts +6 -0
- package/dist/components/session-connection-request.d.ts +8 -0
- package/dist/components/session-conversation.d.ts +86 -0
- package/dist/components/session-list.d.ts +36 -0
- package/dist/components/session-mcp-capability-card.d.ts +41 -0
- package/dist/components/timeline-anchor.d.ts +24 -0
- package/dist/components/timeline-annotation-chrome.d.ts +25 -0
- package/dist/components/timeline-annotation-layout.d.ts +42 -0
- package/dist/components/timeline-annotation-markers.d.ts +8 -0
- package/dist/components/timeline-annotation-reveal-context.d.ts +4 -0
- package/dist/components/timeline-annotation-shared.d.ts +31 -0
- package/dist/components/timeline-annotations-dialog.d.ts +3 -2
- package/dist/components/timeline-annotations.d.ts +13 -3
- package/dist/components/timeline-reading-progress.d.ts +11 -0
- package/dist/components/timeline-search.d.ts +34 -0
- package/dist/components/timeline-settlement.d.ts +16 -0
- package/dist/components/tip-follow.d.ts +16 -0
- package/dist/components/usage-limit-notice.d.ts +49 -0
- package/dist/components/usage-member-list.d.ts +91 -0
- package/dist/components/usage-meter.d.ts +73 -0
- package/dist/components/use-viewer-menu-dismiss.d.ts +2 -0
- package/dist/components/user-message-body.d.ts +10 -1
- package/dist/components/workspace-dock.d.ts +6 -2
- package/dist/composer.d.ts +5 -4
- package/dist/composer.js +15 -9
- package/dist/computer-viewer-ENHVAZ2Q.js +19 -0
- package/dist/computer-viewer-ENHVAZ2Q.js.map +1 -0
- package/dist/connect-account-identity.d.ts +8 -0
- package/dist/connect-accounts.d.ts +15 -0
- package/dist/connect-chooser.d.ts +18 -0
- package/dist/connect-panel.d.ts +18 -0
- package/dist/connect-setup.d.ts +16 -0
- package/dist/connect.d.ts +21 -0
- package/dist/connect.js +2129 -0
- package/dist/connect.js.map +1 -0
- package/dist/connection-catalog.d.ts +38 -0
- package/dist/connection-discovery.d.ts +12 -0
- package/dist/connection-installed.d.ts +17 -0
- package/dist/connection-logo.d.ts +9 -0
- package/dist/connection-service-logo.d.ts +8 -0
- package/dist/connection-service-presentation.d.ts +13 -0
- package/dist/connection-skeleton.d.ts +5 -0
- package/dist/connection-type-picker.d.ts +6 -0
- package/dist/conversation-timeline.d.ts +5 -0
- package/dist/desktop.d.ts +7 -0
- package/dist/desktop.js +26 -0
- package/dist/desktop.js.map +1 -0
- package/dist/device-authorization.d.ts +23 -0
- package/dist/diffs.d.ts +8 -0
- package/dist/diffs.js +14 -0
- package/dist/diffs.js.map +1 -0
- package/dist/discovery-cache.d.ts +5 -0
- package/dist/editor.d.ts +7 -0
- package/dist/editor.js +21 -0
- package/dist/editor.js.map +1 -0
- package/dist/embedded-session-client.d.ts +23 -0
- package/dist/file-node-visibility.d.ts +15 -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/channel-cache.d.ts +23 -0
- package/dist/hooks/latest-question.d.ts +25 -0
- package/dist/hooks/shared-machines-list.d.ts +14 -0
- package/dist/hooks/use-attached-browsers.d.ts +2 -1
- package/dist/hooks/use-browser-frame-stream.d.ts +1 -1
- package/dist/hooks/use-browser-session.d.ts +12 -1
- package/dist/hooks/use-channels.d.ts +1 -0
- package/dist/hooks/use-codex-accounts.d.ts +25 -7
- package/dist/hooks/use-composer.d.ts +45 -9
- package/dist/hooks/use-computer-frame-stream.d.ts +1 -1
- package/dist/hooks/use-computer-input-posture.d.ts +13 -0
- package/dist/hooks/use-computer-session.d.ts +2 -0
- package/dist/hooks/use-connect.d.ts +22 -0
- package/dist/hooks/use-desktop-stream.d.ts +1 -1
- package/dist/hooks/use-file-attachments.d.ts +21 -2
- package/dist/hooks/use-machine-chip.d.ts +3 -3
- package/dist/hooks/use-machines.d.ts +19 -1
- package/dist/hooks/use-sandbox-files.d.ts +5 -1
- package/dist/hooks/use-session-background-commands.d.ts +14 -0
- package/dist/hooks/use-session-events.d.ts +30 -8
- package/dist/hooks/use-session-lineage.d.ts +4 -0
- package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
- package/dist/hooks/use-session.d.ts +6 -0
- package/dist/hooks/use-turn-queue.d.ts +12 -0
- package/dist/hooks/use-usage.d.ts +40 -0
- package/dist/hooks/use-workspace-edit.d.ts +4 -0
- package/dist/hooks/use-workspace-sessions.d.ts +27 -5
- package/dist/human-input.d.ts +3 -1
- package/dist/identity-link-accounts.d.ts +11 -0
- package/dist/identity-link-consent.d.ts +18 -0
- package/dist/index.d.ts +60 -17
- package/dist/index.js +2237 -6200
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +35 -184
- package/dist/interaction.js.map +1 -1
- package/dist/latest-question-755OW5DS.js +117 -0
- package/dist/latest-question-755OW5DS.js.map +1 -0
- package/dist/lib/error-message.d.ts +7 -0
- package/dist/lib/format.d.ts +36 -2
- package/dist/lib/host-theme.d.ts +70 -0
- package/dist/lib/interaction-errors.d.ts +6 -0
- package/dist/lib/menu-styles.d.ts +22 -0
- package/dist/lib/pierre-diffs-loader.d.ts +20 -0
- package/dist/lib/workbench-peers.d.ts +36 -0
- package/dist/lib/xterm-theme.d.ts +7 -5
- package/dist/machines.d.ts +4 -2
- package/dist/machines.js +14 -4
- package/dist/markdown-table-layout-QXSLK4BY.js +106 -0
- package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
- package/dist/mcp-connection-status.d.ts +14 -0
- package/dist/model-policy-picker-menu-PWRI7R2X.js +14 -0
- package/dist/model-policy-picker-menu-PWRI7R2X.js.map +1 -0
- package/dist/model-policy.d.ts +19 -3
- package/dist/model-policy.js +9 -1
- package/dist/older-history.d.ts +30 -0
- package/dist/platform-activity-row-627BFZ46.js +182 -0
- package/dist/platform-activity-row-627BFZ46.js.map +1 -0
- package/dist/plugin-details.d.ts +14 -0
- package/dist/plugin-discovery.d.ts +25 -0
- package/dist/provider.d.ts +13 -1
- package/dist/{queue-surface-implementation-2KVJTYXH.js → queue-surface-implementation-ZHFI5JBP.js} +131 -44
- package/dist/queue-surface-implementation-ZHFI5JBP.js.map +1 -0
- package/dist/realtime/realtime-control.d.ts +6 -3
- package/dist/realtime.js +133 -74
- package/dist/realtime.js.map +1 -1
- package/dist/sandbox-files-BBC47SLD.js +20 -0
- package/dist/sandbox-files-BBC47SLD.js.map +1 -0
- package/dist/session-auth-recommendation.d.ts +5 -0
- package/dist/session-capability-policy.d.ts +12 -0
- package/dist/session-ui.d.ts +30 -2
- package/dist/session-ui.js +85 -7
- package/dist/session-ui.js.map +1 -1
- package/dist/session.d.ts +8 -2
- package/dist/session.js +30 -19
- package/dist/sites-ui.d.ts +34 -0
- package/dist/sites.d.ts +3 -0
- package/dist/sites.js +11 -0
- package/dist/sites.js.map +1 -0
- package/dist/skill-discovery.d.ts +47 -0
- package/dist/terminal.d.ts +8 -0
- package/dist/terminal.js +31 -0
- package/dist/terminal.js.map +1 -0
- package/dist/timeline/activity-rail.d.ts +11 -2
- package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
- package/dist/timeline/compaction-copy.d.ts +10 -0
- package/dist/timeline/entrance.d.ts +13 -1
- package/dist/timeline/genie-loading.d.ts +34 -0
- package/dist/timeline/index.d.ts +6 -2
- package/dist/timeline/knowledge-receipt.d.ts +17 -0
- package/dist/timeline/platform-activity-row.d.ts +14 -0
- package/dist/timeline/presented-image.d.ts +6 -0
- package/dist/timeline/projection.d.ts +31 -2
- package/dist/timeline/registry.d.ts +2 -0
- package/dist/timeline/retained-image.d.ts +18 -0
- package/dist/timeline/rolling-activity.d.ts +11 -0
- package/dist/timeline/screenshot-lightbox.d.ts +16 -1
- package/dist/timeline/shared.d.ts +8 -3
- package/dist/timeline/startup-preference.d.ts +3 -0
- package/dist/timeline/startup-timings.d.ts +4 -0
- package/dist/timeline/tool-display-name.d.ts +2 -1
- package/dist/timeline/turn-summary.d.ts +32 -3
- package/dist/timeline/types.d.ts +141 -7
- package/dist/timeline-annotation-markers-GNDHTGBD.js +165 -0
- package/dist/timeline-annotation-markers-GNDHTGBD.js.map +1 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js +241 -0
- package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js +273 -0
- package/dist/timeline-annotations-dialog-ELRDBHTS.js.map +1 -0
- package/dist/types/machines.d.ts +2 -2
- package/dist/usage/allowance-copy.d.ts +25 -0
- package/dist/usage/summary.d.ts +35 -0
- package/dist/usage.d.ts +13 -0
- package/dist/usage.js +1074 -0
- package/dist/usage.js.map +1 -0
- package/package.json +44 -4
- package/src/accounts.tsx +1072 -0
- package/src/approvals.ts +8 -1
- package/src/artifacts.ts +42 -0
- package/src/assets/README.md +8 -0
- package/src/assets/gmail.ico +0 -0
- package/src/assets/outlook.ico +0 -0
- package/src/capability-catalog-row.tsx +94 -0
- package/src/capability-logo-fallback.ts +22 -0
- package/src/client.ts +22 -13
- package/src/commands/registry.ts +18 -15
- package/src/commands/types.ts +2 -0
- package/src/components/anthropic-mark.tsx +10 -0
- package/src/components/approval-surface.tsx +171 -37
- package/src/components/artifacts/artifact-chrome.tsx +413 -0
- package/src/components/artifacts/artifact-sandbox.tsx +185 -0
- package/src/components/artifacts/artifact-surface.tsx +39 -19
- package/src/components/artifacts/chat-interactive-block.tsx +260 -0
- package/src/components/artifacts/deferred-chat-media.tsx +67 -0
- package/src/components/artifacts/document-editor.tsx +141 -16
- package/src/components/artifacts/editable-artifact-ui.tsx +4 -2
- package/src/components/artifacts/editable-artifact-view.tsx +187 -0
- package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
- package/src/components/artifacts/editable-document.tsx +37 -36
- package/src/components/artifacts/editable-presentation.tsx +36 -18
- package/src/components/artifacts/editable-spreadsheet.tsx +5 -2
- package/src/components/artifacts/index.ts +44 -0
- package/src/components/artifacts/inline-html-document.ts +24 -0
- package/src/components/artifacts/latest-task-runner.ts +49 -0
- package/src/components/artifacts/presentation-editor.tsx +323 -67
- package/src/components/artifacts/published-html-artifact-frame.tsx +338 -5
- package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
- package/src/components/artifacts/site-view.tsx +116 -0
- package/src/components/artifacts/spreadsheet-canvas.ts +5 -10
- package/src/components/artifacts/spreadsheet-general-display.ts +43 -0
- package/src/components/artifacts/spreadsheet-grid.tsx +12 -13
- 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/browser-select-control.tsx +312 -0
- package/src/components/browser-viewer.tsx +1054 -314
- package/src/components/chat-composer.tsx +131 -85
- package/src/components/child-session-link.tsx +27 -0
- package/src/components/claude-mark.tsx +10 -0
- package/src/components/code-editor.tsx +13 -16
- package/src/components/composer-transcription-control.tsx +7 -5
- package/src/components/composer.tsx +376 -49
- package/src/components/computer-viewer.tsx +1041 -329
- package/src/components/copy-button.tsx +13 -5
- package/src/components/desktop-viewer.tsx +1 -1
- package/src/components/enrollment-consent.tsx +65 -7
- package/src/components/enrollment-device-flow.tsx +1 -1
- package/src/components/file-browser.tsx +158 -34
- package/src/components/fleet-tile.tsx +8 -16
- package/src/components/generated-video-player.tsx +4 -2
- package/src/components/grok-mark.tsx +33 -0
- package/src/components/human-input-form.tsx +455 -114
- package/src/components/human-input-surface.tsx +18 -7
- package/src/components/interaction-intervention-banner.tsx +2 -2
- package/src/components/machine-card.tsx +119 -4
- package/src/components/machine-dock-bar.tsx +1 -1
- package/src/components/machine-input-display.ts +23 -2
- package/src/components/machines/machine-detail.tsx +52 -2
- package/src/components/machines/machine-operation-policy.tsx +179 -0
- package/src/components/machines-dashboard.tsx +8 -17
- package/src/components/markdown-table-layout.ts +132 -0
- package/src/components/markdown.tsx +473 -44
- package/src/components/message-timeline.tsx +2498 -663
- package/src/components/model-mark.tsx +90 -0
- package/src/components/model-picker.tsx +15 -4
- package/src/components/model-policy-picker-menu.tsx +424 -0
- package/src/components/model-policy-picker.tsx +337 -381
- package/src/components/open-geni-chat.tsx +319 -0
- package/src/components/open-geni-links.tsx +179 -0
- package/src/components/openrouter-mark.tsx +13 -0
- package/src/components/pierre-diff.tsx +41 -16
- package/src/components/pierre-file.tsx +36 -11
- package/src/components/preview-loading.tsx +154 -0
- package/src/components/queue-item-content.ts +14 -0
- package/src/components/queue-surface-implementation.tsx +132 -42
- package/src/components/queue-surface-state.tsx +3 -1
- package/src/components/sandbox-files.tsx +267 -35
- package/src/components/sandbox-terminal.tsx +48 -11
- package/src/components/sandbox-workspace.tsx +337 -135
- package/src/components/session-capability-frame.tsx +192 -0
- package/src/components/session-chrome.tsx +1027 -328
- package/src/components/session-commands-panel.tsx +126 -0
- package/src/components/session-commands.tsx +18 -0
- package/src/components/session-connection-request.tsx +97 -0
- package/src/components/session-conversation.tsx +512 -0
- package/src/components/session-list.tsx +250 -0
- package/src/components/session-mcp-capability-card.tsx +680 -0
- package/src/components/session-status.tsx +1 -1
- package/src/components/timeline-anchor.tsx +119 -0
- package/src/components/timeline-annotation-chrome.tsx +196 -0
- package/src/components/timeline-annotation-layout.ts +268 -0
- package/src/components/timeline-annotation-markers.tsx +185 -0
- package/src/components/timeline-annotation-reveal-context.ts +9 -0
- package/src/components/timeline-annotation-selection.tsx +106 -54
- package/src/components/timeline-annotation-shared.ts +245 -0
- package/src/components/timeline-annotations-dialog.tsx +185 -128
- package/src/components/timeline-annotations.tsx +189 -45
- package/src/components/timeline-reading-progress.ts +80 -0
- package/src/components/timeline-search.tsx +168 -0
- package/src/components/timeline-settlement.ts +60 -0
- package/src/components/tip-follow.ts +70 -7
- package/src/components/tooltip.tsx +38 -5
- package/src/components/usage-limit-notice.tsx +179 -0
- package/src/components/usage-member-list.tsx +792 -0
- package/src/components/usage-meter.tsx +382 -0
- package/src/components/use-viewer-menu-dismiss.ts +33 -0
- package/src/components/user-message-body.tsx +194 -49
- package/src/components/workspace-dock.tsx +141 -175
- package/src/composer.ts +6 -1
- package/src/connect-account-identity.tsx +34 -0
- package/src/connect-accounts.tsx +233 -0
- package/src/connect-chooser.tsx +336 -0
- package/src/connect-panel.tsx +99 -0
- package/src/connect-setup.tsx +307 -0
- package/src/connect.ts +60 -0
- package/src/connection-assets.d.ts +4 -0
- package/src/connection-catalog.tsx +162 -0
- package/src/connection-discovery.tsx +235 -0
- package/src/connection-installed.tsx +51 -0
- package/src/connection-logo.tsx +37 -0
- package/src/connection-service-logo.tsx +55 -0
- package/src/connection-service-presentation.ts +46 -0
- package/src/connection-skeleton.tsx +16 -0
- package/src/connection-type-picker.tsx +36 -0
- package/src/conversation-timeline.ts +92 -0
- package/src/desktop.ts +24 -0
- package/src/device-authorization.tsx +98 -0
- package/src/diffs.ts +16 -0
- package/src/discovery-cache.ts +42 -0
- package/src/editor.ts +13 -0
- package/src/embedded-session-client.ts +104 -0
- package/src/file-node-visibility.ts +66 -0
- package/src/hooks/channel-cache.ts +104 -0
- package/src/hooks/internal.ts +3 -2
- package/src/hooks/latest-question.ts +164 -0
- package/src/hooks/shared-machines-list.ts +239 -0
- package/src/hooks/use-attached-browsers.ts +5 -1
- package/src/hooks/use-available-models.ts +20 -14
- package/src/hooks/use-browser-frame-stream.ts +25 -3
- package/src/hooks/use-browser-session.ts +271 -71
- package/src/hooks/use-browser-sessions.ts +7 -1
- package/src/hooks/use-channels.ts +32 -10
- package/src/hooks/use-codex-accounts.ts +78 -21
- package/src/hooks/use-composer.ts +1034 -320
- package/src/hooks/use-computer-frame-stream.ts +39 -16
- package/src/hooks/use-computer-input-posture.ts +94 -0
- package/src/hooks/use-computer-session.ts +110 -32
- package/src/hooks/use-computer-sessions.ts +8 -1
- package/src/hooks/use-connect.ts +23 -0
- package/src/hooks/use-desktop-stream.ts +19 -28
- package/src/hooks/use-file-attachments.ts +118 -10
- package/src/hooks/use-goal.ts +36 -9
- package/src/hooks/use-human-input.ts +31 -4
- package/src/hooks/use-last-started-turn-policy.ts +15 -13
- package/src/hooks/use-machine-chip.ts +23 -6
- package/src/hooks/use-machines.ts +104 -6
- package/src/hooks/use-sandbox-files.ts +253 -150
- package/src/hooks/use-sandbox-git.ts +58 -29
- package/src/hooks/use-session-background-commands.ts +67 -0
- package/src/hooks/use-session-capabilities.ts +21 -2
- package/src/hooks/use-session-events.ts +759 -433
- package/src/hooks/use-session-lineage.ts +28 -6
- package/src/hooks/use-session-mcp-approval-policy.ts +13 -5
- package/src/hooks/use-session.ts +75 -16
- package/src/hooks/use-slash-commands.ts +6 -11
- package/src/hooks/use-turn-queue.ts +113 -13
- package/src/hooks/use-usage.ts +100 -0
- package/src/hooks/use-voice-input.ts +12 -1
- package/src/hooks/use-workspace-capture.ts +3 -2
- package/src/hooks/use-workspace-edit.ts +23 -5
- package/src/hooks/use-workspace-sessions.ts +99 -11
- package/src/human-input.ts +12 -1
- package/src/identity-link-accounts.tsx +148 -0
- package/src/identity-link-consent.tsx +192 -0
- package/src/index.ts +157 -12
- package/src/interaction.ts +1 -0
- package/src/lib/error-message.ts +37 -0
- package/src/lib/format.ts +150 -14
- package/src/lib/host-theme.ts +511 -0
- package/src/lib/interaction-errors.ts +33 -0
- package/src/lib/menu-styles.ts +44 -0
- package/src/lib/pierre-diffs-loader.ts +53 -0
- package/src/lib/workbench-peers.ts +62 -0
- package/src/lib/xterm-theme.ts +23 -21
- package/src/machines.ts +9 -1
- package/src/mcp-connection-status.ts +35 -0
- package/src/model-policy.ts +223 -69
- package/src/older-history.ts +87 -0
- package/src/plugin-details.tsx +185 -0
- package/src/plugin-discovery.tsx +196 -0
- package/src/provider.tsx +55 -14
- package/src/realtime/dropdown-menu.tsx +19 -12
- package/src/realtime/realtime-control.tsx +133 -46
- package/src/session-auth-recommendation.ts +48 -0
- package/src/session-capability-policy.ts +83 -0
- package/src/session-context.ts +1 -0
- package/src/session-ui.ts +66 -2
- package/src/session.ts +18 -1
- package/src/sites-ui.tsx +402 -0
- package/src/sites.ts +3 -0
- package/src/skill-discovery.tsx +208 -0
- package/src/terminal.ts +26 -0
- package/src/timeline/activity-rail.tsx +171 -80
- package/src/timeline/allowance-exhausted-row.tsx +86 -0
- package/src/timeline/compaction-copy.ts +42 -0
- package/src/timeline/entrance.tsx +28 -3
- package/src/timeline/fleet-decision-projection.ts +2 -1
- package/src/timeline/fleet-decision-row.tsx +1 -0
- package/src/timeline/genie-loading.tsx +136 -0
- package/src/timeline/index.ts +11 -0
- package/src/timeline/knowledge-receipt.tsx +100 -0
- package/src/timeline/parsers.ts +2 -2
- package/src/timeline/platform-activity-row.tsx +216 -0
- package/src/timeline/presented-image.ts +49 -0
- package/src/timeline/projection.ts +1600 -84
- package/src/timeline/registry.ts +15 -3
- package/src/timeline/retained-image.ts +97 -0
- package/src/timeline/rolling-activity.tsx +92 -0
- package/src/timeline/screenshot-lightbox.tsx +115 -17
- package/src/timeline/shared.tsx +47 -15
- package/src/timeline/startup-preference.ts +33 -0
- package/src/timeline/startup-timings.tsx +145 -0
- package/src/timeline/tool-display-name.ts +8 -6
- package/src/timeline/tool-renderers.tsx +497 -128
- package/src/timeline/turn-summary.tsx +208 -44
- package/src/timeline/types.ts +186 -7
- package/src/types/machines.ts +10 -0
- package/src/usage/allowance-copy.ts +64 -0
- package/src/usage/summary.ts +93 -0
- package/src/usage.ts +50 -0
- package/styles/compiled.css +2098 -757
- package/styles/connect.css +284 -0
- package/styles/connect.d.ts +1 -0
- package/styles/effective-tokens.css +1 -0
- package/styles/index.css +201 -9
- package/styles/responsive.css +27 -1
- package/styles/session-capability.css +44 -0
- package/styles/tokens.css +135 -65
- package/dist/chunk-5UQPNLIO.js.map +0 -1
- package/dist/chunk-6KLX2RH5.js.map +0 -1
- package/dist/chunk-7WCLAEFV.js.map +0 -1
- package/dist/chunk-B6WPZSTT.js.map +0 -1
- package/dist/chunk-FK6VG4LL.js +0 -90
- package/dist/chunk-FK6VG4LL.js.map +0 -1
- package/dist/chunk-HA46CYQK.js.map +0 -1
- package/dist/chunk-HUIKIDM5.js.map +0 -1
- package/dist/chunk-IGC6A2ZI.js.map +0 -1
- package/dist/chunk-KCGXPP5V.js.map +0 -1
- package/dist/chunk-KZ73RL76.js.map +0 -1
- package/dist/chunk-LAKLF4PA.js +0 -141
- package/dist/chunk-LAKLF4PA.js.map +0 -1
- package/dist/chunk-LLOLUHVG.js.map +0 -1
- package/dist/chunk-MKPIAGVL.js +0 -465
- package/dist/chunk-MKPIAGVL.js.map +0 -1
- package/dist/chunk-PEI6RANI.js.map +0 -1
- package/dist/chunk-R3AZOAB5.js.map +0 -1
- package/dist/chunk-WSK7G5LE.js +0 -170
- package/dist/chunk-WSK7G5LE.js.map +0 -1
- package/dist/chunk-XBZWOM2K.js +0 -218
- package/dist/chunk-XBZWOM2K.js.map +0 -1
- package/dist/chunk-Y7OEDUJ5.js +0 -8810
- package/dist/chunk-Y7OEDUJ5.js.map +0 -1
- package/dist/fleet-decision-row-GGCAT4E4.js.map +0 -1
- package/dist/hooks/use-packs.d.ts +0 -32
- package/dist/interactive-workbench-viewers-TOHBXJEE.js +0 -15
- package/dist/queue-surface-implementation-2KVJTYXH.js.map +0 -1
- package/dist/timeline-annotation-selection-3L7LHGG2.js +0 -187
- package/dist/timeline-annotation-selection-3L7LHGG2.js.map +0 -1
- package/dist/timeline-annotations-dialog-U7EVLR75.js +0 -196
- package/dist/timeline-annotations-dialog-U7EVLR75.js.map +0 -1
- package/src/hooks/use-packs.ts +0 -157
- /package/dist/{interactive-workbench-viewers-TOHBXJEE.js.map → browser-viewer-GTR5XQ7X.js.map} +0 -0
|
@@ -0,0 +1,1608 @@
|
|
|
1
|
+
import {
|
|
2
|
+
prefersReducedMotion
|
|
3
|
+
} from "./chunk-GIMRELBW.js";
|
|
4
|
+
import {
|
|
5
|
+
annotatableText,
|
|
6
|
+
rangeFromOffsets,
|
|
7
|
+
visibleClientRect
|
|
8
|
+
} from "./chunk-447JLCBU.js";
|
|
9
|
+
import {
|
|
10
|
+
chainLinkResolvers,
|
|
11
|
+
useOpenGeniLinkResolver
|
|
12
|
+
} from "./chunk-XCHWDJ22.js";
|
|
13
|
+
import {
|
|
14
|
+
copyTextToClipboard,
|
|
15
|
+
tableElementToTsv
|
|
16
|
+
} from "./chunk-JVYQRRC4.js";
|
|
17
|
+
import {
|
|
18
|
+
Tooltip,
|
|
19
|
+
TooltipContent,
|
|
20
|
+
TooltipProvider,
|
|
21
|
+
TooltipTrigger,
|
|
22
|
+
useLightboxOptional
|
|
23
|
+
} from "./chunk-BRM6FVZA.js";
|
|
24
|
+
import {
|
|
25
|
+
stringifyPayload
|
|
26
|
+
} from "./chunk-UTRTG6LH.js";
|
|
27
|
+
import {
|
|
28
|
+
cn
|
|
29
|
+
} from "./chunk-22KP6LR5.js";
|
|
30
|
+
|
|
31
|
+
// src/timeline/disclosure-context.tsx
|
|
32
|
+
import { createContext, useContext } from "react";
|
|
33
|
+
import { jsx } from "react/jsx-runtime";
|
|
34
|
+
var DisclosureDefaultsContext = createContext(void 0);
|
|
35
|
+
function DisclosureDefaultsProvider({
|
|
36
|
+
defaultOpen,
|
|
37
|
+
children
|
|
38
|
+
}) {
|
|
39
|
+
return /* @__PURE__ */ jsx(DisclosureDefaultsContext.Provider, { value: defaultOpen, children });
|
|
40
|
+
}
|
|
41
|
+
function useForcedDefaultOpen() {
|
|
42
|
+
return useContext(DisclosureDefaultsContext);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// src/timeline/shared.tsx
|
|
46
|
+
import { CameraIcon, CameraOffIcon, ChevronRightIcon } from "lucide-react";
|
|
47
|
+
import { createContext as createContext3, useContext as useContext3, useEffect, useState } from "react";
|
|
48
|
+
|
|
49
|
+
// src/components/timeline-search.tsx
|
|
50
|
+
import { createContext as createContext2, useContext as useContext2, useLayoutEffect, useRef } from "react";
|
|
51
|
+
var TimelineSearchRevealContext = createContext2(null);
|
|
52
|
+
var useTimelineSearchReveal = () => useContext2(TimelineSearchRevealContext);
|
|
53
|
+
function isTimelineSearchTarget(item, target) {
|
|
54
|
+
const sources = item.sourceEvents ?? ("annotationSource" in item && item.annotationSource ? [item.annotationSource] : []);
|
|
55
|
+
return sources.some(
|
|
56
|
+
(source) => source.sequence === target.sequence && (!target.eventId || source.eventId === target.eventId)
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
function literalSearchOffset(text, query, occurrence = 0) {
|
|
60
|
+
if (!query || !Number.isSafeInteger(occurrence) || occurrence < 0) return -1;
|
|
61
|
+
const pattern = new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "giu");
|
|
62
|
+
let match;
|
|
63
|
+
let index = 0;
|
|
64
|
+
while (match = pattern.exec(text)) {
|
|
65
|
+
if (index++ === occurrence) return match.index;
|
|
66
|
+
}
|
|
67
|
+
return -1;
|
|
68
|
+
}
|
|
69
|
+
function matchAtOffset(text, query, offset) {
|
|
70
|
+
if (!query || !Number.isSafeInteger(offset) || offset < 0 || offset > text.length) return -1;
|
|
71
|
+
const pattern = new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "iyu");
|
|
72
|
+
pattern.lastIndex = offset;
|
|
73
|
+
return pattern.exec(text)?.index === offset ? offset : -1;
|
|
74
|
+
}
|
|
75
|
+
function searchMatchOffset(text, target) {
|
|
76
|
+
if (target.offset != null) return matchAtOffset(text, target.query, target.offset);
|
|
77
|
+
return literalSearchOffset(text, target.query, target.occurrence);
|
|
78
|
+
}
|
|
79
|
+
var nextHighlightId = 0;
|
|
80
|
+
function useTimelineSearchNavigation(root, itemId, target, releasePin, revision) {
|
|
81
|
+
const highlightName = useRef("");
|
|
82
|
+
if (!highlightName.current) highlightName.current = `og-search-${++nextHighlightId}`;
|
|
83
|
+
const key = target ? JSON.stringify([
|
|
84
|
+
itemId,
|
|
85
|
+
target.sequence,
|
|
86
|
+
target.eventId,
|
|
87
|
+
target.query,
|
|
88
|
+
target.occurrence ?? 0,
|
|
89
|
+
target.offset ?? null
|
|
90
|
+
]) : null;
|
|
91
|
+
const navigated = useRef(null);
|
|
92
|
+
useLayoutEffect(() => {
|
|
93
|
+
if (!key) navigated.current = null;
|
|
94
|
+
if (!key || !target || !itemId || !root.current) return;
|
|
95
|
+
releasePin();
|
|
96
|
+
const scroller = root.current;
|
|
97
|
+
const registry = globalThis.CSS?.highlights;
|
|
98
|
+
const HighlightClass = globalThis.Highlight;
|
|
99
|
+
const style = document.createElement("style");
|
|
100
|
+
style.textContent = `::highlight(${highlightName.current}) { background: var(--og-color-accent-deep); color: var(--og-color-accent-fg); }`;
|
|
101
|
+
scroller.append(style);
|
|
102
|
+
let frame = 0;
|
|
103
|
+
const update = () => {
|
|
104
|
+
const source = [...scroller.querySelectorAll("[data-og-search-item]")].find(
|
|
105
|
+
(element) => element.dataset.ogSearchItem === itemId
|
|
106
|
+
);
|
|
107
|
+
if (!source) return;
|
|
108
|
+
const materialized = [
|
|
109
|
+
...source.querySelectorAll("[data-og-search-occurrence]")
|
|
110
|
+
].find(
|
|
111
|
+
(element) => element.dataset.ogSearchSequence === String(target.sequence) && element.dataset.ogSearchQuery === target.query && (target.offset != null ? element.dataset.ogSearchOffset === String(target.offset) : element.dataset.ogSearchOccurrence === String(target.occurrence ?? 0))
|
|
112
|
+
);
|
|
113
|
+
const { text, spans } = annotatableText(materialized ?? source);
|
|
114
|
+
const offset = materialized ? matchAtOffset(text, target.query, 0) : target.offset != null ? -1 : searchMatchOffset(text, target);
|
|
115
|
+
const range = offset < 0 ? null : rangeFromOffsets(spans, offset, offset + target.query.length);
|
|
116
|
+
if (range && registry && HighlightClass)
|
|
117
|
+
registry.set(highlightName.current, new HighlightClass(range));
|
|
118
|
+
else registry?.delete(highlightName.current);
|
|
119
|
+
const rect = range ? visibleClientRect(range) : null;
|
|
120
|
+
if (navigated.current === key || !range || !rect) return;
|
|
121
|
+
const box = rect;
|
|
122
|
+
if (!box.height && !box.width) return;
|
|
123
|
+
scroller.scrollTop += box.top - scroller.getBoundingClientRect().top - scroller.clientHeight / 2;
|
|
124
|
+
navigated.current = key;
|
|
125
|
+
};
|
|
126
|
+
const schedule = () => {
|
|
127
|
+
cancelAnimationFrame(frame);
|
|
128
|
+
frame = requestAnimationFrame(update);
|
|
129
|
+
};
|
|
130
|
+
const observer = new MutationObserver(schedule);
|
|
131
|
+
observer.observe(scroller, { childList: true, subtree: true, characterData: true });
|
|
132
|
+
const resize = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
|
|
133
|
+
resize?.observe(scroller);
|
|
134
|
+
schedule();
|
|
135
|
+
return () => {
|
|
136
|
+
observer.disconnect();
|
|
137
|
+
resize?.disconnect();
|
|
138
|
+
cancelAnimationFrame(frame);
|
|
139
|
+
registry?.delete(highlightName.current);
|
|
140
|
+
style.remove();
|
|
141
|
+
};
|
|
142
|
+
}, [key, root, itemId, target, releasePin, revision]);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// src/timeline/shared.tsx
|
|
146
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
147
|
+
var ToolCallTruncationContext = createContext3(null);
|
|
148
|
+
function ToolCallTruncationProvider({
|
|
149
|
+
value,
|
|
150
|
+
children
|
|
151
|
+
}) {
|
|
152
|
+
return /* @__PURE__ */ jsx2(ToolCallTruncationContext.Provider, { value, children });
|
|
153
|
+
}
|
|
154
|
+
var ICON_TONE = {
|
|
155
|
+
accent: "text-og-accent",
|
|
156
|
+
failed: "text-og-status-failed",
|
|
157
|
+
running: "text-og-status-running",
|
|
158
|
+
muted: "text-og-fg-subtle"
|
|
159
|
+
};
|
|
160
|
+
var CompactActivityContext = createContext3(false);
|
|
161
|
+
function ActivityDisclosure({
|
|
162
|
+
icon,
|
|
163
|
+
iconTone: iconToneProp = "muted",
|
|
164
|
+
title,
|
|
165
|
+
titleMono,
|
|
166
|
+
running,
|
|
167
|
+
preview,
|
|
168
|
+
compactPreview,
|
|
169
|
+
media,
|
|
170
|
+
chip: chipProp,
|
|
171
|
+
failed,
|
|
172
|
+
cancelled,
|
|
173
|
+
expandable = true,
|
|
174
|
+
defaultOpen,
|
|
175
|
+
children
|
|
176
|
+
}) {
|
|
177
|
+
const iconTone = failed && iconToneProp === "muted" ? "failed" : iconToneProp;
|
|
178
|
+
const chip = chipProp ?? (failed ? { tone: "bad", text: "failed" } : cancelled ? { tone: "interrupted", text: "interrupted" } : void 0);
|
|
179
|
+
const forcedDefaultOpen = useForcedDefaultOpen();
|
|
180
|
+
const [open, setOpen] = useState(defaultOpen ?? forcedDefaultOpen ?? false);
|
|
181
|
+
const searchReveal = useTimelineSearchReveal();
|
|
182
|
+
useEffect(() => {
|
|
183
|
+
if (searchReveal) setOpen(true);
|
|
184
|
+
}, [searchReveal]);
|
|
185
|
+
const truncation = useContext3(ToolCallTruncationContext);
|
|
186
|
+
const compact = useContext3(CompactActivityContext);
|
|
187
|
+
if (compact)
|
|
188
|
+
return /* @__PURE__ */ jsxs("span", { className: "og-rolling-label", children: [
|
|
189
|
+
/* @__PURE__ */ jsx2("span", { className: cn("shrink-0", ICON_TONE[iconTone]), children: icon }),
|
|
190
|
+
/* @__PURE__ */ jsxs("span", { className: "og-command-reel", children: [
|
|
191
|
+
/* @__PURE__ */ jsx2("span", { className: "og-reel-title", children: title }),
|
|
192
|
+
(compactPreview === void 0 ? preview : compactPreview) ? /* @__PURE__ */ jsx2("span", { className: "og-reel-preview text-og-fg-subtle", children: compactPreview === void 0 ? preview : compactPreview }) : null
|
|
193
|
+
] })
|
|
194
|
+
] });
|
|
195
|
+
const hasBody = expandable && (children != null || truncation != null);
|
|
196
|
+
const previewVisible = preview != null && !open;
|
|
197
|
+
const rowClass = cn(
|
|
198
|
+
"group/disclosure flex w-full min-w-0 items-center gap-2 rounded-og-sm px-1.5 py-1.5 text-left text-og-base",
|
|
199
|
+
"text-og-fg-muted transition-colors duration-150",
|
|
200
|
+
// A tool row is a touch target on coarse pointers: grow its hit area to the
|
|
201
|
+
// 44px mobile minimum without loosening the dense desktop rail.
|
|
202
|
+
"pointer-coarse:min-h-11 pointer-coarse:py-2.5"
|
|
203
|
+
);
|
|
204
|
+
const inner = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
205
|
+
hasBody ? /* @__PURE__ */ jsx2(ChevronRightIcon, { className: "size-3.5 shrink-0 text-og-fg-subtle transition-transform duration-[var(--_og-duration-disclose)] ease-og-in-out group-data-[state=open]/disclosure:rotate-90" }) : /* @__PURE__ */ jsx2("span", { className: "size-3.5 shrink-0" }),
|
|
206
|
+
/* @__PURE__ */ jsx2("span", { className: cn("shrink-0", ICON_TONE[iconTone]), children: icon }),
|
|
207
|
+
/* @__PURE__ */ jsxs("span", { className: cn("og-command-reel", running && "og-command-reel-running"), children: [
|
|
208
|
+
/* @__PURE__ */ jsx2(
|
|
209
|
+
"span",
|
|
210
|
+
{
|
|
211
|
+
className: cn(
|
|
212
|
+
"min-w-0 shrink truncate text-og-base font-medium",
|
|
213
|
+
titleMono && "font-og-mono text-og-sm font-normal"
|
|
214
|
+
),
|
|
215
|
+
children: title
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
previewVisible && !media ? /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate text-og-sm text-og-fg-subtle", children: preview }) : /* @__PURE__ */ jsx2("span", { className: "flex-1" })
|
|
219
|
+
] }),
|
|
220
|
+
media && !open ? /* @__PURE__ */ jsx2("span", { className: "ml-auto flex shrink-0 items-center gap-2 pl-2", children: media }) : chip && !open ? /* @__PURE__ */ jsx2("span", { className: "ml-auto shrink-0 pl-2", children: /* @__PURE__ */ jsx2(Chip, { chip }) }) : null
|
|
221
|
+
] });
|
|
222
|
+
const dataStatus = cancelled ? "cancelled" : failed ? "failed" : void 0;
|
|
223
|
+
if (!hasBody) {
|
|
224
|
+
return /* @__PURE__ */ jsx2("div", { className: cn(rowClass, "cursor-default"), "data-status": dataStatus, children: inner });
|
|
225
|
+
}
|
|
226
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
227
|
+
/* @__PURE__ */ jsx2(
|
|
228
|
+
"div",
|
|
229
|
+
{
|
|
230
|
+
role: "button",
|
|
231
|
+
tabIndex: 0,
|
|
232
|
+
"aria-expanded": open,
|
|
233
|
+
"data-state": open ? "open" : "closed",
|
|
234
|
+
onClick: () => setOpen((prev) => !prev),
|
|
235
|
+
onKeyDown: (event) => {
|
|
236
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
237
|
+
event.preventDefault();
|
|
238
|
+
setOpen((prev) => !prev);
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
"data-status": dataStatus,
|
|
242
|
+
className: cn(
|
|
243
|
+
rowClass,
|
|
244
|
+
"cursor-pointer outline-hidden hover:bg-og-surface-1 hover:text-og-fg",
|
|
245
|
+
"focus-visible:ring-2 focus-visible:ring-og-accent focus-visible:ring-offset-0"
|
|
246
|
+
),
|
|
247
|
+
children: inner
|
|
248
|
+
}
|
|
249
|
+
),
|
|
250
|
+
open ? /* @__PURE__ */ jsxs("div", { className: "mb-2 ml-7 mt-1.5 flex flex-col gap-2 overflow-hidden animate-og-expand", children: [
|
|
251
|
+
children,
|
|
252
|
+
truncation ? /* @__PURE__ */ jsx2(ToolCallTruncationNotice, { truncation }) : null
|
|
253
|
+
] }) : null
|
|
254
|
+
] });
|
|
255
|
+
}
|
|
256
|
+
function ToolCallTruncationNotice({ truncation }) {
|
|
257
|
+
const fullEvidence = truncation.fullEvidence.available ? "retained" : truncation.fullEvidence.reason ?? "unavailable";
|
|
258
|
+
return /* @__PURE__ */ jsxs("div", { "data-og-tool-output-truncation": "", className: "text-og-sm leading-5 text-og-fg-subtle", children: [
|
|
259
|
+
"Output bounded at ",
|
|
260
|
+
/* @__PURE__ */ jsx2("code", { className: "font-og-mono", children: truncation.surface }),
|
|
261
|
+
truncation.omittedBytes != null && truncation.omittedBytes > 0 ? ` \xB7 ${truncation.omittedBytes.toLocaleString()} bytes omitted` : null,
|
|
262
|
+
" \xB7 reason ",
|
|
263
|
+
/* @__PURE__ */ jsx2("code", { className: "font-og-mono", children: truncation.reason }),
|
|
264
|
+
" \xB7 full evidence ",
|
|
265
|
+
/* @__PURE__ */ jsx2("code", { className: "font-og-mono", children: fullEvidence })
|
|
266
|
+
] });
|
|
267
|
+
}
|
|
268
|
+
function Chip({ chip }) {
|
|
269
|
+
const base = "inline-flex items-center font-og-mono text-og-xs leading-none";
|
|
270
|
+
const withText = chip.text ? "gap-1.5" : "gap-0";
|
|
271
|
+
if (chip.tone === "bad") {
|
|
272
|
+
return /* @__PURE__ */ jsxs("span", { className: cn(base, withText, "text-og-status-failed"), children: [
|
|
273
|
+
/* @__PURE__ */ jsx2("span", { className: "size-1.5 rounded-full bg-og-status-failed" }),
|
|
274
|
+
chip.text
|
|
275
|
+
] });
|
|
276
|
+
}
|
|
277
|
+
if (chip.tone === "interrupted") {
|
|
278
|
+
return /* @__PURE__ */ jsx2("span", { className: cn(base, "text-og-fg-subtle og-cancelled-chip"), children: chip.text });
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ jsx2("span", { className: cn(base, "text-og-fg-subtle"), children: chip.text });
|
|
281
|
+
}
|
|
282
|
+
function TermBlock({
|
|
283
|
+
command,
|
|
284
|
+
workdir,
|
|
285
|
+
output,
|
|
286
|
+
live,
|
|
287
|
+
tailLines = 12,
|
|
288
|
+
failed
|
|
289
|
+
}) {
|
|
290
|
+
const [full, setFull] = useState(false);
|
|
291
|
+
const empty = output.trim() === "";
|
|
292
|
+
const lines = output.split("\n");
|
|
293
|
+
const big = lines.length > tailLines + 4;
|
|
294
|
+
const shown = full || !big ? output : lines.slice(-tailLines).join("\n");
|
|
295
|
+
const showMore = big && !full;
|
|
296
|
+
const showHeader = command != null || workdir != null;
|
|
297
|
+
return /* @__PURE__ */ jsxs(
|
|
298
|
+
"div",
|
|
299
|
+
{
|
|
300
|
+
className: cn(
|
|
301
|
+
"min-w-0 border-l-2 pl-3",
|
|
302
|
+
failed ? "border-og-status-failed/50" : live ? "border-og-status-running/50" : "border-og-border"
|
|
303
|
+
),
|
|
304
|
+
children: [
|
|
305
|
+
showHeader ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pb-1", children: [
|
|
306
|
+
/* @__PURE__ */ jsx2("span", { className: "select-none text-og-status-idle", children: "$" }),
|
|
307
|
+
command != null ? /* @__PURE__ */ jsx2("span", { className: "min-w-0 flex-1 truncate font-og-mono text-og-sm text-og-fg-muted", children: command }) : /* @__PURE__ */ jsx2("span", { className: "flex-1" }),
|
|
308
|
+
workdir ? /* @__PURE__ */ jsx2("span", { className: "shrink-0 font-og-mono text-og-xs text-og-fg-subtle", children: workdir }) : null
|
|
309
|
+
] }) : null,
|
|
310
|
+
empty ? /* @__PURE__ */ jsx2("p", { className: "font-og-mono text-og-xs italic text-og-fg-subtle", children: "(no output)" }) : /* @__PURE__ */ jsxs("pre", { className: "max-h-72 overflow-auto whitespace-pre-wrap break-all font-og-mono text-og-xs leading-5 text-og-fg-muted", children: [
|
|
311
|
+
shown,
|
|
312
|
+
live ? /* @__PURE__ */ jsx2("span", { className: "ml-px inline-block h-[1em] w-[2px] translate-y-[2px] animate-og-blink bg-og-accent align-middle" }) : null
|
|
313
|
+
] }),
|
|
314
|
+
showMore ? /* @__PURE__ */ jsxs(
|
|
315
|
+
"button",
|
|
316
|
+
{
|
|
317
|
+
type: "button",
|
|
318
|
+
onClick: () => setFull(true),
|
|
319
|
+
className: "mt-1 text-left text-og-xs text-og-fg-subtle transition-colors hover:text-og-fg",
|
|
320
|
+
children: [
|
|
321
|
+
"show full output (",
|
|
322
|
+
lines.length,
|
|
323
|
+
" lines)"
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
) : null
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
function PayloadBlock({
|
|
332
|
+
label,
|
|
333
|
+
value,
|
|
334
|
+
failed
|
|
335
|
+
}) {
|
|
336
|
+
const text = typeof value === "string" ? value : stringifyPayload(value);
|
|
337
|
+
if (!text || text.trim() === "") {
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
return /* @__PURE__ */ jsxs(
|
|
341
|
+
"div",
|
|
342
|
+
{
|
|
343
|
+
className: cn(
|
|
344
|
+
"min-w-0 border-l-2 pl-3",
|
|
345
|
+
failed ? "border-og-status-failed/50" : "border-og-border"
|
|
346
|
+
),
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ jsx2("p", { className: "mb-1 text-og-xs font-medium uppercase tracking-[0.08em] text-og-fg-subtle", children: label }),
|
|
349
|
+
/* @__PURE__ */ jsx2(
|
|
350
|
+
"pre",
|
|
351
|
+
{
|
|
352
|
+
className: cn(
|
|
353
|
+
"max-h-64 overflow-auto whitespace-pre-wrap break-all font-og-mono text-og-xs leading-5",
|
|
354
|
+
failed ? "text-og-status-failed" : "text-og-fg-muted"
|
|
355
|
+
),
|
|
356
|
+
children: text
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
]
|
|
360
|
+
}
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
function BodyNote({
|
|
364
|
+
children,
|
|
365
|
+
tone
|
|
366
|
+
}) {
|
|
367
|
+
if (tone === "error") {
|
|
368
|
+
return /* @__PURE__ */ jsx2("div", { className: "border-l-2 border-og-status-failed/50 pl-3 font-og-mono text-og-xs leading-5 text-og-status-failed", children });
|
|
369
|
+
}
|
|
370
|
+
return /* @__PURE__ */ jsx2("p", { className: "px-0.5 text-og-sm italic leading-5 text-og-fg-subtle", children });
|
|
371
|
+
}
|
|
372
|
+
var MEDIA_BOX = "h-7 w-[52px] shrink-0 rounded-og-xs border border-og-border";
|
|
373
|
+
function MediaSkeleton() {
|
|
374
|
+
return /* @__PURE__ */ jsxs(
|
|
375
|
+
"span",
|
|
376
|
+
{
|
|
377
|
+
className: cn(
|
|
378
|
+
MEDIA_BOX,
|
|
379
|
+
"relative inline-flex items-center justify-center overflow-hidden bg-og-surface-2"
|
|
380
|
+
),
|
|
381
|
+
children: [
|
|
382
|
+
/* @__PURE__ */ jsx2("span", { className: "absolute inset-0 animate-og-pulse bg-og-surface-3/50" }),
|
|
383
|
+
/* @__PURE__ */ jsx2(CameraIcon, { className: "relative size-3.5 text-og-fg-subtle" })
|
|
384
|
+
]
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
}
|
|
388
|
+
function MediaEmpty() {
|
|
389
|
+
return /* @__PURE__ */ jsx2("span", { className: cn(MEDIA_BOX, "inline-flex items-center justify-center bg-og-bg"), children: /* @__PURE__ */ jsx2(CameraOffIcon, { className: "size-3.5 text-og-fg-subtle" }) });
|
|
390
|
+
}
|
|
391
|
+
function Thumbnail({
|
|
392
|
+
src,
|
|
393
|
+
caption,
|
|
394
|
+
alt = "screenshot",
|
|
395
|
+
expandLabel = "Expand screenshot",
|
|
396
|
+
lightboxLabel = "Screenshot",
|
|
397
|
+
downloadFilename
|
|
398
|
+
}) {
|
|
399
|
+
const lightbox = useLightboxOptional();
|
|
400
|
+
const [failed, setFailed] = useState(false);
|
|
401
|
+
if (failed) {
|
|
402
|
+
return /* @__PURE__ */ jsx2(MediaEmpty, {});
|
|
403
|
+
}
|
|
404
|
+
const img = /* @__PURE__ */ jsx2(
|
|
405
|
+
"img",
|
|
406
|
+
{
|
|
407
|
+
src,
|
|
408
|
+
alt,
|
|
409
|
+
onError: () => setFailed(true),
|
|
410
|
+
className: "h-full w-full object-cover transition-opacity group-hover/thumb:opacity-80"
|
|
411
|
+
}
|
|
412
|
+
);
|
|
413
|
+
if (!lightbox) {
|
|
414
|
+
return /* @__PURE__ */ jsx2("span", { className: cn(MEDIA_BOX, "inline-flex overflow-hidden bg-og-bg"), children: img });
|
|
415
|
+
}
|
|
416
|
+
return /* @__PURE__ */ jsx2(
|
|
417
|
+
"button",
|
|
418
|
+
{
|
|
419
|
+
type: "button",
|
|
420
|
+
onClick: (event) => {
|
|
421
|
+
event.stopPropagation();
|
|
422
|
+
lightbox.open(src, caption, event.currentTarget, lightboxLabel, downloadFilename);
|
|
423
|
+
},
|
|
424
|
+
onKeyDown: (event) => {
|
|
425
|
+
if (event.key === "Enter" || event.key === " ") {
|
|
426
|
+
event.stopPropagation();
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
className: cn(
|
|
430
|
+
MEDIA_BOX,
|
|
431
|
+
"group/thumb relative inline-flex overflow-hidden bg-og-bg outline-hidden",
|
|
432
|
+
"focus-visible:ring-2 focus-visible:ring-og-accent"
|
|
433
|
+
),
|
|
434
|
+
"aria-label": expandLabel,
|
|
435
|
+
children: img
|
|
436
|
+
}
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
function ScreenshotFigure({
|
|
440
|
+
src,
|
|
441
|
+
caption,
|
|
442
|
+
alt = "screenshot",
|
|
443
|
+
expandLabel = "Expand screenshot",
|
|
444
|
+
lightboxLabel = "Screenshot",
|
|
445
|
+
downloadFilename
|
|
446
|
+
}) {
|
|
447
|
+
const lightbox = useLightboxOptional();
|
|
448
|
+
const [failed, setFailed] = useState(false);
|
|
449
|
+
const surface = "block w-full overflow-hidden rounded-og-md border border-og-border bg-og-bg";
|
|
450
|
+
const img = /* @__PURE__ */ jsx2(
|
|
451
|
+
"img",
|
|
452
|
+
{
|
|
453
|
+
src,
|
|
454
|
+
alt,
|
|
455
|
+
onError: () => setFailed(true),
|
|
456
|
+
className: "max-h-80 w-full object-contain"
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
return /* @__PURE__ */ jsxs("figure", { className: "m-0 min-w-0", children: [
|
|
460
|
+
failed ? /* @__PURE__ */ jsx2("div", { className: "rounded-og-md border border-og-border bg-og-bg px-3 py-6 text-center font-og-mono text-og-xs text-og-fg-subtle", children: "image unavailable" }) : lightbox ? /* @__PURE__ */ jsx2(
|
|
461
|
+
"button",
|
|
462
|
+
{
|
|
463
|
+
type: "button",
|
|
464
|
+
onClick: (event) => lightbox.open(src, caption, event.currentTarget, lightboxLabel, downloadFilename),
|
|
465
|
+
className: surface,
|
|
466
|
+
"aria-label": expandLabel,
|
|
467
|
+
children: img
|
|
468
|
+
}
|
|
469
|
+
) : /* @__PURE__ */ jsx2("div", { className: surface, children: img }),
|
|
470
|
+
caption ? /* @__PURE__ */ jsx2("figcaption", { className: "mt-1.5 font-og-mono text-og-xs text-og-fg-subtle", children: caption }) : null
|
|
471
|
+
] });
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// src/components/copy-button.tsx
|
|
475
|
+
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
476
|
+
import { memo, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
477
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
478
|
+
var COPIED_MS = 1600;
|
|
479
|
+
var CopyButton = memo(function CopyButton2({
|
|
480
|
+
text,
|
|
481
|
+
label = "Copy",
|
|
482
|
+
className,
|
|
483
|
+
reveal = "group-hover"
|
|
484
|
+
}) {
|
|
485
|
+
const [copied, setCopied] = useState2(false);
|
|
486
|
+
const [tipOpen, setTipOpen] = useState2(false);
|
|
487
|
+
const timerRef = useRef2(null);
|
|
488
|
+
useEffect2(() => {
|
|
489
|
+
return () => {
|
|
490
|
+
if (timerRef.current !== null) {
|
|
491
|
+
clearTimeout(timerRef.current);
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
}, []);
|
|
495
|
+
const onClick = async (event) => {
|
|
496
|
+
event.preventDefault();
|
|
497
|
+
event.stopPropagation();
|
|
498
|
+
const button = event.currentTarget;
|
|
499
|
+
const pointerActivated = event.detail > 0;
|
|
500
|
+
const value = typeof text === "function" ? text() : text;
|
|
501
|
+
const ok = await copyTextToClipboard(value);
|
|
502
|
+
if (!ok) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
setCopied(true);
|
|
506
|
+
setTipOpen(true);
|
|
507
|
+
if (timerRef.current !== null) {
|
|
508
|
+
clearTimeout(timerRef.current);
|
|
509
|
+
}
|
|
510
|
+
timerRef.current = setTimeout(() => {
|
|
511
|
+
timerRef.current = null;
|
|
512
|
+
setCopied(false);
|
|
513
|
+
setTipOpen(false);
|
|
514
|
+
}, COPIED_MS);
|
|
515
|
+
if (pointerActivated) {
|
|
516
|
+
button.blur();
|
|
517
|
+
}
|
|
518
|
+
};
|
|
519
|
+
const tip = copied ? "Copied" : label;
|
|
520
|
+
return /* @__PURE__ */ jsxs2(
|
|
521
|
+
Tooltip,
|
|
522
|
+
{
|
|
523
|
+
open: copied ? true : tipOpen,
|
|
524
|
+
onOpenChange: (next) => {
|
|
525
|
+
if (!copied) {
|
|
526
|
+
setTipOpen(next);
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
children: [
|
|
530
|
+
/* @__PURE__ */ jsx3(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx3(
|
|
531
|
+
"button",
|
|
532
|
+
{
|
|
533
|
+
type: "button",
|
|
534
|
+
"data-og-copy": "",
|
|
535
|
+
"data-state": copied ? "copied" : "idle",
|
|
536
|
+
"aria-label": tip,
|
|
537
|
+
onClick,
|
|
538
|
+
className: cn(
|
|
539
|
+
"inline-flex size-7 shrink-0 items-center justify-center rounded-og-sm pointer-coarse:size-11",
|
|
540
|
+
"text-og-fg-subtle transition-[opacity,color,background-color] duration-150",
|
|
541
|
+
"hover:bg-og-surface-2/80 hover:text-og-fg",
|
|
542
|
+
"focus-visible:opacity-100 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-og-accent/40",
|
|
543
|
+
reveal === "group-hover" && "opacity-0 group-hover/copy:opacity-100 group-focus-within/copy:opacity-100 pointer-coarse:opacity-70",
|
|
544
|
+
copied && "opacity-100 text-og-accent",
|
|
545
|
+
className
|
|
546
|
+
),
|
|
547
|
+
children: copied ? /* @__PURE__ */ jsx3(CheckIcon, { className: "size-3.5", "aria-hidden": true }) : /* @__PURE__ */ jsx3(CopyIcon, { className: "size-3.5", "aria-hidden": true })
|
|
548
|
+
}
|
|
549
|
+
) }),
|
|
550
|
+
/* @__PURE__ */ jsx3(TooltipContent, { side: "top", children: tip })
|
|
551
|
+
]
|
|
552
|
+
}
|
|
553
|
+
);
|
|
554
|
+
});
|
|
555
|
+
function CopyHoverFrame({
|
|
556
|
+
children,
|
|
557
|
+
className,
|
|
558
|
+
copyText,
|
|
559
|
+
label,
|
|
560
|
+
align = "end",
|
|
561
|
+
trailing
|
|
562
|
+
}) {
|
|
563
|
+
if (copyText.trim().length === 0) {
|
|
564
|
+
return /* @__PURE__ */ jsx3("div", { className, children });
|
|
565
|
+
}
|
|
566
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("group/copy", className), children: [
|
|
567
|
+
children,
|
|
568
|
+
/* @__PURE__ */ jsxs2(
|
|
569
|
+
"div",
|
|
570
|
+
{
|
|
571
|
+
"data-og-annotation-chrome": "",
|
|
572
|
+
className: cn(
|
|
573
|
+
"flex h-6 items-center gap-1.5 pointer-coarse:h-11",
|
|
574
|
+
align === "end" ? "justify-end" : "justify-start"
|
|
575
|
+
),
|
|
576
|
+
children: [
|
|
577
|
+
/* @__PURE__ */ jsx3(
|
|
578
|
+
CopyButton,
|
|
579
|
+
{
|
|
580
|
+
text: copyText,
|
|
581
|
+
label,
|
|
582
|
+
reveal: "group-hover",
|
|
583
|
+
className: "size-6 pointer-coarse:size-11"
|
|
584
|
+
}
|
|
585
|
+
),
|
|
586
|
+
trailing
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
)
|
|
590
|
+
] });
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// src/components/markdown.tsx
|
|
594
|
+
import {
|
|
595
|
+
Children,
|
|
596
|
+
createContext as createContext4,
|
|
597
|
+
useContext as useContext4,
|
|
598
|
+
isValidElement,
|
|
599
|
+
memo as memo2,
|
|
600
|
+
useEffect as useEffect4,
|
|
601
|
+
useMemo,
|
|
602
|
+
useReducer,
|
|
603
|
+
useRef as useRef4,
|
|
604
|
+
useState as useState3
|
|
605
|
+
} from "react";
|
|
606
|
+
import ReactMarkdown, {
|
|
607
|
+
defaultUrlTransform
|
|
608
|
+
} from "react-markdown";
|
|
609
|
+
import remarkGfm from "remark-gfm";
|
|
610
|
+
import { PanelsTopLeftIcon } from "lucide-react";
|
|
611
|
+
|
|
612
|
+
// src/lib/motion-inspect.ts
|
|
613
|
+
var MOTION_INSPECT_SCALE = 1;
|
|
614
|
+
|
|
615
|
+
// src/components/preview-loading.tsx
|
|
616
|
+
import { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
617
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
618
|
+
function PreviewLoading() {
|
|
619
|
+
const ref = useRef3(null);
|
|
620
|
+
useEffect3(() => {
|
|
621
|
+
const canvas = ref.current;
|
|
622
|
+
if (!canvas) return;
|
|
623
|
+
let ctx;
|
|
624
|
+
try {
|
|
625
|
+
ctx = canvas.getContext("2d");
|
|
626
|
+
} catch {
|
|
627
|
+
return;
|
|
628
|
+
}
|
|
629
|
+
if (!ctx) return;
|
|
630
|
+
const context = ctx;
|
|
631
|
+
const motion = window.matchMedia?.("(prefers-reduced-motion: reduce)");
|
|
632
|
+
let frame;
|
|
633
|
+
let time = 2;
|
|
634
|
+
let last;
|
|
635
|
+
let disposed = false;
|
|
636
|
+
let visible = false;
|
|
637
|
+
const canAnimate = () => !disposed && visible && !document.hidden && motion?.matches === false;
|
|
638
|
+
function draw() {
|
|
639
|
+
const w = canvas.clientWidth;
|
|
640
|
+
const h = canvas.clientHeight;
|
|
641
|
+
if (!w || !h || document.hidden || disposed) return;
|
|
642
|
+
const d = Math.min(window.devicePixelRatio || 1, 2);
|
|
643
|
+
if (canvas.width !== Math.round(w * d) || canvas.height !== Math.round(h * d)) {
|
|
644
|
+
canvas.width = Math.round(w * d);
|
|
645
|
+
canvas.height = Math.round(h * d);
|
|
646
|
+
}
|
|
647
|
+
const style = getComputedStyle(canvas);
|
|
648
|
+
const ink = style.getPropertyValue("--_og-preview-ink").trim() || "#9fdccd";
|
|
649
|
+
const glowColor = style.getPropertyValue("--_og-preview-glow").trim() || "#5fb8a3";
|
|
650
|
+
context.setTransform(d, 0, 0, d, 0, 0);
|
|
651
|
+
context.clearRect(0, 0, w, h);
|
|
652
|
+
const cx = w * (0.5 + 0.13 * Math.sin(time * 0.21));
|
|
653
|
+
const cy = h * (0.5 + 0.12 * Math.cos(time * 0.27));
|
|
654
|
+
const glow = context.createRadialGradient(cx, cy, 0, cx, cy, Math.max(w, h) * 0.65);
|
|
655
|
+
glow.addColorStop(0, glowColor);
|
|
656
|
+
glow.addColorStop(1, "transparent");
|
|
657
|
+
context.globalAlpha = 0.09;
|
|
658
|
+
context.fillStyle = glow;
|
|
659
|
+
context.fillRect(0, 0, w, h);
|
|
660
|
+
const rows = Math.ceil(h / 18) + 7;
|
|
661
|
+
const cols = Math.ceil(w / 18) + 7;
|
|
662
|
+
const points = Array.from(
|
|
663
|
+
{ length: rows },
|
|
664
|
+
(_row, r) => Array.from({ length: cols }, (_col, c) => {
|
|
665
|
+
const x = (c - 3) * 18;
|
|
666
|
+
const y = (r - 3) * 18;
|
|
667
|
+
const dist = Math.hypot((x - cx) * 0.8, y - cy);
|
|
668
|
+
const wave = Math.sin(dist * 0.032 - time * 0.95);
|
|
669
|
+
return {
|
|
670
|
+
x: x + (x - cx) / Math.max(dist, 1) * wave * 4,
|
|
671
|
+
y: y + (y - cy) / Math.max(dist, 1) * wave * 4,
|
|
672
|
+
l: Math.pow((wave + 1) / 2, 5)
|
|
673
|
+
};
|
|
674
|
+
})
|
|
675
|
+
);
|
|
676
|
+
context.strokeStyle = ink;
|
|
677
|
+
context.fillStyle = ink;
|
|
678
|
+
context.lineWidth = 0.65;
|
|
679
|
+
points.forEach(
|
|
680
|
+
(row, r) => row.forEach((p, c) => {
|
|
681
|
+
context.globalAlpha = 0.035 + p.l * 0.055;
|
|
682
|
+
context.beginPath();
|
|
683
|
+
if (c + 1 < cols) {
|
|
684
|
+
context.moveTo(p.x, p.y);
|
|
685
|
+
context.lineTo(row[c + 1].x, row[c + 1].y);
|
|
686
|
+
}
|
|
687
|
+
if (r + 1 < rows) {
|
|
688
|
+
context.moveTo(p.x, p.y);
|
|
689
|
+
context.lineTo(points[r + 1][c].x, points[r + 1][c].y);
|
|
690
|
+
}
|
|
691
|
+
context.stroke();
|
|
692
|
+
context.globalAlpha = 0.15 + p.l * 0.55;
|
|
693
|
+
context.beginPath();
|
|
694
|
+
context.arc(p.x, p.y, 0.85 + p.l * 0.65, 0, Math.PI * 2);
|
|
695
|
+
context.fill();
|
|
696
|
+
})
|
|
697
|
+
);
|
|
698
|
+
context.globalAlpha = 1;
|
|
699
|
+
canvas.dataset.painted = "true";
|
|
700
|
+
}
|
|
701
|
+
function stop() {
|
|
702
|
+
if (frame !== void 0) window.cancelAnimationFrame(frame);
|
|
703
|
+
frame = void 0;
|
|
704
|
+
last = void 0;
|
|
705
|
+
}
|
|
706
|
+
function tick(stamp) {
|
|
707
|
+
frame = void 0;
|
|
708
|
+
if (!canAnimate()) return;
|
|
709
|
+
if (last !== void 0) time += Math.min((stamp - last) / 1e3, 0.05);
|
|
710
|
+
last = stamp;
|
|
711
|
+
draw();
|
|
712
|
+
frame = window.requestAnimationFrame(tick);
|
|
713
|
+
}
|
|
714
|
+
function refresh() {
|
|
715
|
+
stop();
|
|
716
|
+
if (disposed || document.hidden || !visible && intersection) return;
|
|
717
|
+
draw();
|
|
718
|
+
if (canAnimate() && typeof window.requestAnimationFrame === "function") {
|
|
719
|
+
frame = window.requestAnimationFrame(tick);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
const intersection = typeof IntersectionObserver === "function" ? new IntersectionObserver(([entry]) => {
|
|
723
|
+
visible = entry?.isIntersecting === true;
|
|
724
|
+
refresh();
|
|
725
|
+
}) : void 0;
|
|
726
|
+
intersection?.observe(canvas);
|
|
727
|
+
const resize = typeof ResizeObserver === "function" ? new ResizeObserver(refresh) : void 0;
|
|
728
|
+
resize?.observe(canvas);
|
|
729
|
+
const theme = typeof MutationObserver === "function" ? new MutationObserver(refresh) : void 0;
|
|
730
|
+
for (let ancestor = canvas.parentElement; ancestor; ancestor = ancestor.parentElement) {
|
|
731
|
+
theme?.observe(ancestor, {
|
|
732
|
+
attributes: true,
|
|
733
|
+
attributeFilter: ["class", "style", "data-og-theme"]
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
motion?.addEventListener?.("change", refresh);
|
|
737
|
+
document.addEventListener("visibilitychange", refresh);
|
|
738
|
+
window.addEventListener("resize", refresh);
|
|
739
|
+
if (!intersection) draw();
|
|
740
|
+
return () => {
|
|
741
|
+
disposed = true;
|
|
742
|
+
stop();
|
|
743
|
+
intersection?.disconnect();
|
|
744
|
+
resize?.disconnect();
|
|
745
|
+
theme?.disconnect();
|
|
746
|
+
motion?.removeEventListener?.("change", refresh);
|
|
747
|
+
document.removeEventListener("visibilitychange", refresh);
|
|
748
|
+
window.removeEventListener("resize", refresh);
|
|
749
|
+
};
|
|
750
|
+
}, []);
|
|
751
|
+
return /* @__PURE__ */ jsxs3("div", { className: "og-preview-loading", children: [
|
|
752
|
+
/* @__PURE__ */ jsx4("canvas", { ref, "aria-hidden": "true" }),
|
|
753
|
+
/* @__PURE__ */ jsx4("span", { className: "og-preview-loading-label", children: "Preparing preview\u2026" })
|
|
754
|
+
] });
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// src/components/soften-streaming-markdown.ts
|
|
758
|
+
function softenStreamingMarkdown(source) {
|
|
759
|
+
if (source.length === 0) {
|
|
760
|
+
return source;
|
|
761
|
+
}
|
|
762
|
+
let text = source;
|
|
763
|
+
if (countFences(text) % 2 === 1) {
|
|
764
|
+
text += text.endsWith("\n") ? "```" : "\n```";
|
|
765
|
+
}
|
|
766
|
+
const segments = splitByFences(text);
|
|
767
|
+
for (const segment of segments) {
|
|
768
|
+
if (segment.kind === "fence") {
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
segment.value = closeInlineMarkers(segment.value);
|
|
772
|
+
}
|
|
773
|
+
let result = segments.map((segment) => segment.value).join("");
|
|
774
|
+
if (text.endsWith("\n") && !result.endsWith("\n")) {
|
|
775
|
+
result += "\n";
|
|
776
|
+
}
|
|
777
|
+
return result;
|
|
778
|
+
}
|
|
779
|
+
function countFences(text) {
|
|
780
|
+
let count = 0;
|
|
781
|
+
for (const line of text.split("\n")) {
|
|
782
|
+
if (/^ {0,3}```/.test(line)) {
|
|
783
|
+
count += 1;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
return count;
|
|
787
|
+
}
|
|
788
|
+
function splitByFences(text) {
|
|
789
|
+
const segments = [];
|
|
790
|
+
const lines = text.split("\n");
|
|
791
|
+
let buf = [];
|
|
792
|
+
let inFence = false;
|
|
793
|
+
const flush = (kind, mode) => {
|
|
794
|
+
if (buf.length === 0) {
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
let value = buf.join("\n");
|
|
798
|
+
if (mode === "boundary") {
|
|
799
|
+
value += "\n";
|
|
800
|
+
}
|
|
801
|
+
segments.push({ kind, value });
|
|
802
|
+
buf = [];
|
|
803
|
+
};
|
|
804
|
+
for (const line of lines) {
|
|
805
|
+
const isFence = /^ {0,3}```/.test(line);
|
|
806
|
+
if (isFence) {
|
|
807
|
+
if (inFence) {
|
|
808
|
+
buf.push(line);
|
|
809
|
+
flush("fence", "end");
|
|
810
|
+
inFence = false;
|
|
811
|
+
} else {
|
|
812
|
+
flush("prose", "boundary");
|
|
813
|
+
buf.push(line);
|
|
814
|
+
inFence = true;
|
|
815
|
+
}
|
|
816
|
+
continue;
|
|
817
|
+
}
|
|
818
|
+
buf.push(line);
|
|
819
|
+
}
|
|
820
|
+
flush(inFence ? "fence" : "prose", "end");
|
|
821
|
+
return segments;
|
|
822
|
+
}
|
|
823
|
+
function closeInlineMarkers(prose) {
|
|
824
|
+
let text = prose;
|
|
825
|
+
text = closeDelimiter(text, "~~");
|
|
826
|
+
text = closeDelimiter(text, "**");
|
|
827
|
+
text = closeDelimiter(text, "__");
|
|
828
|
+
text = closeSingleBackticks(text);
|
|
829
|
+
text = closeSingleAsterisks(text);
|
|
830
|
+
text = closeUnfinishedLink(text);
|
|
831
|
+
return text;
|
|
832
|
+
}
|
|
833
|
+
function closeDelimiter(text, delimiter) {
|
|
834
|
+
let count = 0;
|
|
835
|
+
let i = 0;
|
|
836
|
+
while (i < text.length) {
|
|
837
|
+
if (text[i] === "\\" && i + 1 < text.length) {
|
|
838
|
+
i += 2;
|
|
839
|
+
continue;
|
|
840
|
+
}
|
|
841
|
+
if (text.startsWith(delimiter, i)) {
|
|
842
|
+
count += 1;
|
|
843
|
+
i += delimiter.length;
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
i += 1;
|
|
847
|
+
}
|
|
848
|
+
return count % 2 === 1 ? insertBeforeTrailingNewlines(text, delimiter) : text;
|
|
849
|
+
}
|
|
850
|
+
function insertBeforeTrailingNewlines(text, suffix) {
|
|
851
|
+
let end = text.length;
|
|
852
|
+
while (end > 0 && text[end - 1] === "\n") {
|
|
853
|
+
end -= 1;
|
|
854
|
+
}
|
|
855
|
+
return text.slice(0, end) + suffix + text.slice(end);
|
|
856
|
+
}
|
|
857
|
+
function closeSingleBackticks(text) {
|
|
858
|
+
let count = 0;
|
|
859
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
860
|
+
if (text[i] === "\\" && i + 1 < text.length) {
|
|
861
|
+
i += 1;
|
|
862
|
+
continue;
|
|
863
|
+
}
|
|
864
|
+
if (text[i] === "`") {
|
|
865
|
+
if (text.startsWith("```", i)) {
|
|
866
|
+
i += 2;
|
|
867
|
+
continue;
|
|
868
|
+
}
|
|
869
|
+
count += 1;
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
return count % 2 === 1 ? insertBeforeTrailingNewlines(text, "`") : text;
|
|
873
|
+
}
|
|
874
|
+
function closeSingleAsterisks(text) {
|
|
875
|
+
let count = 0;
|
|
876
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
877
|
+
if (text[i] === "\\" && i + 1 < text.length) {
|
|
878
|
+
i += 1;
|
|
879
|
+
continue;
|
|
880
|
+
}
|
|
881
|
+
if (text[i] === "*" && text[i + 1] === "*") {
|
|
882
|
+
i += 1;
|
|
883
|
+
continue;
|
|
884
|
+
}
|
|
885
|
+
if (text[i] === "*") {
|
|
886
|
+
count += 1;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
return count % 2 === 1 ? insertBeforeTrailingNewlines(text, "*") : text;
|
|
890
|
+
}
|
|
891
|
+
function closeUnfinishedLink(text) {
|
|
892
|
+
const open = text.lastIndexOf("](");
|
|
893
|
+
if (open === -1) {
|
|
894
|
+
return text;
|
|
895
|
+
}
|
|
896
|
+
const after = text.slice(open + 2);
|
|
897
|
+
if (after.includes(")")) {
|
|
898
|
+
return text;
|
|
899
|
+
}
|
|
900
|
+
if (after.includes("[")) {
|
|
901
|
+
return text;
|
|
902
|
+
}
|
|
903
|
+
return insertBeforeTrailingNewlines(text, ")");
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// src/components/stream-reveal.ts
|
|
907
|
+
var INK_FADE_MS = 420 * MOTION_INSPECT_SCALE;
|
|
908
|
+
var INITIAL_ANIMATED_LIMIT = 400;
|
|
909
|
+
function createStreamReveal() {
|
|
910
|
+
let batches = [];
|
|
911
|
+
let revealedChars = -1;
|
|
912
|
+
return {
|
|
913
|
+
observe(text, now) {
|
|
914
|
+
if (revealedChars === -1) {
|
|
915
|
+
revealedChars = text.length > INITIAL_ANIMATED_LIMIT ? text.length : 0;
|
|
916
|
+
}
|
|
917
|
+
if (text.length <= revealedChars) {
|
|
918
|
+
revealedChars = Math.max(revealedChars, text.length);
|
|
919
|
+
return;
|
|
920
|
+
}
|
|
921
|
+
batches.push({ start: revealedChars, end: text.length, birth: now });
|
|
922
|
+
revealedChars = text.length;
|
|
923
|
+
batches = batches.filter((batch) => batch.birth + INK_FADE_MS > now);
|
|
924
|
+
},
|
|
925
|
+
delayFor(offset, now) {
|
|
926
|
+
const batch = findBatch(batches, offset);
|
|
927
|
+
if (!batch) {
|
|
928
|
+
return null;
|
|
929
|
+
}
|
|
930
|
+
const delay = batch.birth - now;
|
|
931
|
+
return delay + INK_FADE_MS <= 0 ? null : delay;
|
|
932
|
+
},
|
|
933
|
+
hasActive(now) {
|
|
934
|
+
const last = batches[batches.length - 1];
|
|
935
|
+
return last !== void 0 && last.birth + INK_FADE_MS > now;
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
function findBatch(batches, offset) {
|
|
940
|
+
let low = 0;
|
|
941
|
+
let high = batches.length - 1;
|
|
942
|
+
while (low <= high) {
|
|
943
|
+
const mid = low + high >> 1;
|
|
944
|
+
const batch = batches[mid];
|
|
945
|
+
if (offset < batch.start) {
|
|
946
|
+
high = mid - 1;
|
|
947
|
+
} else if (offset >= batch.end) {
|
|
948
|
+
low = mid + 1;
|
|
949
|
+
} else {
|
|
950
|
+
return batch;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
return null;
|
|
954
|
+
}
|
|
955
|
+
function rehypeStreamReveal(options) {
|
|
956
|
+
const { reveal, now } = options;
|
|
957
|
+
return (tree) => {
|
|
958
|
+
walk(tree, false);
|
|
959
|
+
};
|
|
960
|
+
function walk(node, insideVerbatim) {
|
|
961
|
+
if (!node.children) {
|
|
962
|
+
return;
|
|
963
|
+
}
|
|
964
|
+
const verbatim = insideVerbatim || node.tagName === "code" || node.tagName === "pre";
|
|
965
|
+
const next = [];
|
|
966
|
+
for (const child of node.children) {
|
|
967
|
+
if (child.type === "text" && !verbatim) {
|
|
968
|
+
next.push(...splitTextNode(child));
|
|
969
|
+
continue;
|
|
970
|
+
}
|
|
971
|
+
walk(child, verbatim);
|
|
972
|
+
next.push(child);
|
|
973
|
+
}
|
|
974
|
+
node.children = next;
|
|
975
|
+
}
|
|
976
|
+
function splitTextNode(node) {
|
|
977
|
+
const sourceOffset = node.position?.start?.offset;
|
|
978
|
+
if (sourceOffset === void 0) {
|
|
979
|
+
return [node];
|
|
980
|
+
}
|
|
981
|
+
const value = node.value;
|
|
982
|
+
const out = [];
|
|
983
|
+
let plain = "";
|
|
984
|
+
const flushPlain = () => {
|
|
985
|
+
if (plain.length > 0) {
|
|
986
|
+
out.push({ type: "text", value: plain });
|
|
987
|
+
plain = "";
|
|
988
|
+
}
|
|
989
|
+
};
|
|
990
|
+
let i = 0;
|
|
991
|
+
while (i < value.length) {
|
|
992
|
+
const delay = reveal.delayFor(sourceOffset + i, now);
|
|
993
|
+
let j = i + 1;
|
|
994
|
+
while (j < value.length) {
|
|
995
|
+
const nextDelay = reveal.delayFor(sourceOffset + j, now);
|
|
996
|
+
if (nextDelay !== delay) {
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
j += 1;
|
|
1000
|
+
}
|
|
1001
|
+
const slice = value.slice(i, j);
|
|
1002
|
+
if (delay === null) {
|
|
1003
|
+
plain += slice;
|
|
1004
|
+
} else {
|
|
1005
|
+
flushPlain();
|
|
1006
|
+
out.push({
|
|
1007
|
+
type: "element",
|
|
1008
|
+
tagName: "span",
|
|
1009
|
+
properties: {
|
|
1010
|
+
className: ["og-stream-ink"],
|
|
1011
|
+
style: `animation-delay:${Math.round(delay)}ms`
|
|
1012
|
+
},
|
|
1013
|
+
children: [{ type: "text", value: slice }]
|
|
1014
|
+
});
|
|
1015
|
+
}
|
|
1016
|
+
i = j;
|
|
1017
|
+
}
|
|
1018
|
+
flushPlain();
|
|
1019
|
+
return out.length > 0 ? out : [node];
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
|
|
1023
|
+
// src/components/markdown.tsx
|
|
1024
|
+
import {
|
|
1025
|
+
parseOpenGeniLink,
|
|
1026
|
+
parseSandboxLink,
|
|
1027
|
+
parseRetainedFileReference,
|
|
1028
|
+
isReservedOpenGeniLink,
|
|
1029
|
+
openGeniLinkScheme
|
|
1030
|
+
} from "@opengeni/sdk";
|
|
1031
|
+
import { Fragment as Fragment2, jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1032
|
+
var InteractiveContext = createContext4({ source: "" });
|
|
1033
|
+
var baseComponents = {
|
|
1034
|
+
h1: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1035
|
+
"h1",
|
|
1036
|
+
{
|
|
1037
|
+
className: "mt-5 mb-2.5 text-xl font-semibold tracking-tight text-og-fg first:mt-0",
|
|
1038
|
+
...props,
|
|
1039
|
+
children
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
h2: ({ children, ...props }) => /* @__PURE__ */ jsx5("h2", { className: "mt-5 mb-2 text-lg font-semibold tracking-tight text-og-fg first:mt-0", ...props, children }),
|
|
1043
|
+
h3: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1044
|
+
"h3",
|
|
1045
|
+
{
|
|
1046
|
+
className: "mt-4 mb-1.5 text-og-md font-semibold tracking-tight text-og-fg first:mt-0",
|
|
1047
|
+
...props,
|
|
1048
|
+
children
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
h4: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1052
|
+
"h4",
|
|
1053
|
+
{
|
|
1054
|
+
className: "mt-4 mb-1.5 text-og-sm font-semibold uppercase tracking-[0.04em] text-og-fg first:mt-0",
|
|
1055
|
+
...props,
|
|
1056
|
+
children
|
|
1057
|
+
}
|
|
1058
|
+
),
|
|
1059
|
+
p: ({ children, ...props }) => /* @__PURE__ */ jsx5("p", { className: "my-2.5 leading-7 first:mt-0 last:mb-0", ...props, children }),
|
|
1060
|
+
strong: ({ children, ...props }) => /* @__PURE__ */ jsx5("strong", { className: "font-semibold text-og-fg", ...props, children }),
|
|
1061
|
+
em: ({ children, ...props }) => /* @__PURE__ */ jsx5("em", { className: "italic", ...props, children }),
|
|
1062
|
+
ul: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1063
|
+
"ul",
|
|
1064
|
+
{
|
|
1065
|
+
className: "my-2.5 ml-5 flex list-disc flex-col gap-1 marker:text-og-fg-subtle first:mt-0 last:mb-0",
|
|
1066
|
+
...props,
|
|
1067
|
+
children
|
|
1068
|
+
}
|
|
1069
|
+
),
|
|
1070
|
+
ol: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1071
|
+
"ol",
|
|
1072
|
+
{
|
|
1073
|
+
className: "my-2.5 ml-5 flex list-decimal flex-col gap-1 marker:text-og-fg-subtle first:mt-0 last:mb-0",
|
|
1074
|
+
...props,
|
|
1075
|
+
children
|
|
1076
|
+
}
|
|
1077
|
+
),
|
|
1078
|
+
// GFM task-list items carry a leading checkbox <input>; `list-none` + a
|
|
1079
|
+
// negative margin pull the checkbox back to the bullet column so it aligns
|
|
1080
|
+
// with the text.
|
|
1081
|
+
li: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1082
|
+
"li",
|
|
1083
|
+
{
|
|
1084
|
+
className: "leading-7 marker:text-og-fg-subtle [&>ul]:my-1 [&>ol]:my-1 [&:has(>input)]:list-none [&:has(>input)]:-ml-5",
|
|
1085
|
+
...props,
|
|
1086
|
+
children
|
|
1087
|
+
}
|
|
1088
|
+
),
|
|
1089
|
+
input: ({ type, ...props }) => type === "checkbox" ? /* @__PURE__ */ jsx5(
|
|
1090
|
+
"input",
|
|
1091
|
+
{
|
|
1092
|
+
...props,
|
|
1093
|
+
type: "checkbox",
|
|
1094
|
+
disabled: true,
|
|
1095
|
+
className: "mr-2 size-3.5 translate-y-[2px] cursor-default accent-og-accent align-baseline"
|
|
1096
|
+
}
|
|
1097
|
+
) : /* @__PURE__ */ jsx5("input", { type, ...props }),
|
|
1098
|
+
blockquote: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1099
|
+
"blockquote",
|
|
1100
|
+
{
|
|
1101
|
+
className: "my-3 border-l-2 border-og-border-strong pl-3.5 text-og-fg-muted [&>p]:my-1.5 first:mt-0 last:mb-0",
|
|
1102
|
+
...props,
|
|
1103
|
+
children
|
|
1104
|
+
}
|
|
1105
|
+
),
|
|
1106
|
+
hr: (props) => /* @__PURE__ */ jsx5("hr", { className: "my-4 border-0 border-t border-og-border", ...props }),
|
|
1107
|
+
// Inline `code` vs fenced code blocks. react-markdown v10 no longer passes an
|
|
1108
|
+
// `inline` flag; a fenced block is a <code> whose parent is <pre> (styled by
|
|
1109
|
+
// the `pre` renderer), so a `code` reaching here is treated as inline.
|
|
1110
|
+
code: ({ children, className: _className, ...props }) => /* @__PURE__ */ jsx5(
|
|
1111
|
+
"code",
|
|
1112
|
+
{
|
|
1113
|
+
className: "rounded-og-xs bg-og-surface-2 px-1 py-0.5 font-og-mono text-og-sm text-og-fg",
|
|
1114
|
+
...props,
|
|
1115
|
+
children
|
|
1116
|
+
}
|
|
1117
|
+
),
|
|
1118
|
+
// Fenced code — quiet mono block (no card / no nested vertical scroll).
|
|
1119
|
+
pre: InteractiveCodeBlock,
|
|
1120
|
+
// Tables stay unboxed (hairline rules); hover reveals a TSV copy control.
|
|
1121
|
+
table: ({ children, ...props }) => /* @__PURE__ */ jsx5(MarkdownTable, { ...props, children }),
|
|
1122
|
+
thead: ({ children, ...props }) => /* @__PURE__ */ jsx5("thead", { ...props, children }),
|
|
1123
|
+
th: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1124
|
+
"th",
|
|
1125
|
+
{
|
|
1126
|
+
className: "border-b border-og-border px-0 py-1.5 pr-4 text-left font-medium text-og-fg first:pl-0",
|
|
1127
|
+
...props,
|
|
1128
|
+
children
|
|
1129
|
+
}
|
|
1130
|
+
),
|
|
1131
|
+
td: ({ children, ...props }) => /* @__PURE__ */ jsx5(
|
|
1132
|
+
"td",
|
|
1133
|
+
{
|
|
1134
|
+
className: "border-b border-og-border/70 px-0 py-1.5 pr-4 align-top text-og-fg-muted [tr:last-child>&]:border-b-0",
|
|
1135
|
+
...props,
|
|
1136
|
+
children
|
|
1137
|
+
}
|
|
1138
|
+
),
|
|
1139
|
+
img: MarkdownImage
|
|
1140
|
+
};
|
|
1141
|
+
var MARKDOWN_LINK_CLASS = "break-words font-medium text-og-accent-strong underline-offset-2 hover:underline";
|
|
1142
|
+
var MarkdownLinkContext = createContext4({});
|
|
1143
|
+
var UNAVAILABLE_LABEL = {
|
|
1144
|
+
file: "This file needs a workspace-aware host to open",
|
|
1145
|
+
"editable-artifact": "This artifact needs a workspace-aware host to open",
|
|
1146
|
+
site: "This Site needs a workspace-aware host to open"
|
|
1147
|
+
};
|
|
1148
|
+
function linkActionTitle(target) {
|
|
1149
|
+
if (target.kind === "sandbox-file") {
|
|
1150
|
+
return target.line !== null ? `Open ${target.path} at line ${target.line}` : `Open ${target.path}`;
|
|
1151
|
+
}
|
|
1152
|
+
return target.kind === "file" ? "Open file" : target.kind === "site" ? "Open Site" : "Open artifact";
|
|
1153
|
+
}
|
|
1154
|
+
var markdownComponents = {
|
|
1155
|
+
...baseComponents,
|
|
1156
|
+
p: ({ children, node, ...props }) => {
|
|
1157
|
+
const containsArtifact = node?.children.some(
|
|
1158
|
+
(child) => child.type === "element" && child.tagName === "img" && typeof child.properties.src === "string" && retainedImageId(child.properties.src)
|
|
1159
|
+
);
|
|
1160
|
+
const Tag = containsArtifact ? "div" : "p";
|
|
1161
|
+
return /* @__PURE__ */ jsx5(Tag, { className: "my-2.5 leading-7 first:mt-0 last:mb-0", ...props, children });
|
|
1162
|
+
},
|
|
1163
|
+
a: ({ children, href, ...props }) => {
|
|
1164
|
+
const { onSandboxFile, artifactHref, resolveLink } = useContext4(MarkdownLinkContext);
|
|
1165
|
+
const inherited = useOpenGeniLinkResolver();
|
|
1166
|
+
const target = parseOpenGeniLink(href);
|
|
1167
|
+
if (target) {
|
|
1168
|
+
if (target.kind === "file" && target.workspaceId === null && artifactHref) {
|
|
1169
|
+
const destination2 = defaultUrlTransform(artifactHref(target.fileId));
|
|
1170
|
+
if (destination2) {
|
|
1171
|
+
return /* @__PURE__ */ jsx5(
|
|
1172
|
+
"a",
|
|
1173
|
+
{
|
|
1174
|
+
className: MARKDOWN_LINK_CLASS,
|
|
1175
|
+
href: destination2,
|
|
1176
|
+
target: "_blank",
|
|
1177
|
+
rel: "noreferrer noopener",
|
|
1178
|
+
children
|
|
1179
|
+
}
|
|
1180
|
+
);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
const resolution = target.kind === "sandbox-file" && onSandboxFile ? { open: () => onSandboxFile(target.path, target.line ?? void 0) } : chainLinkResolvers(resolveLink, inherited)?.(target);
|
|
1184
|
+
const destination = resolution?.href ? defaultUrlTransform(resolution.href) : "";
|
|
1185
|
+
if (destination) {
|
|
1186
|
+
return /* @__PURE__ */ jsx5(
|
|
1187
|
+
"a",
|
|
1188
|
+
{
|
|
1189
|
+
className: MARKDOWN_LINK_CLASS,
|
|
1190
|
+
href: destination,
|
|
1191
|
+
target: "_blank",
|
|
1192
|
+
rel: "noreferrer noopener",
|
|
1193
|
+
children
|
|
1194
|
+
}
|
|
1195
|
+
);
|
|
1196
|
+
}
|
|
1197
|
+
if (resolution?.open) {
|
|
1198
|
+
return /* @__PURE__ */ jsx5(ActionMarkdownLink, { title: linkActionTitle(target), onOpen: resolution.open, children });
|
|
1199
|
+
}
|
|
1200
|
+
if (target.kind === "sandbox-file") {
|
|
1201
|
+
return /* @__PURE__ */ jsx5(
|
|
1202
|
+
"span",
|
|
1203
|
+
{
|
|
1204
|
+
className: "break-words font-medium text-og-fg-subtle underline decoration-dotted underline-offset-2",
|
|
1205
|
+
"aria-disabled": "true",
|
|
1206
|
+
title: "This sandbox file requires a session-aware handler",
|
|
1207
|
+
children
|
|
1208
|
+
}
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
return /* @__PURE__ */ jsxs4("span", { title: UNAVAILABLE_LABEL[target.kind], "data-og-link-unavailable": target.kind, children: [
|
|
1212
|
+
children,
|
|
1213
|
+
" (artifact unavailable)"
|
|
1214
|
+
] });
|
|
1215
|
+
}
|
|
1216
|
+
if (isReservedOpenGeniLink(href) || !href) {
|
|
1217
|
+
return /* @__PURE__ */ jsxs4(
|
|
1218
|
+
"span",
|
|
1219
|
+
{
|
|
1220
|
+
className: "break-words text-og-fg-subtle",
|
|
1221
|
+
"aria-disabled": "true",
|
|
1222
|
+
title: isSandboxHref(href) ? "This sandbox file reference is invalid" : "This link is unavailable",
|
|
1223
|
+
children: [
|
|
1224
|
+
children,
|
|
1225
|
+
" (link unavailable)"
|
|
1226
|
+
]
|
|
1227
|
+
}
|
|
1228
|
+
);
|
|
1229
|
+
}
|
|
1230
|
+
return /* @__PURE__ */ jsx5(
|
|
1231
|
+
"a",
|
|
1232
|
+
{
|
|
1233
|
+
className: MARKDOWN_LINK_CLASS,
|
|
1234
|
+
target: "_blank",
|
|
1235
|
+
rel: "noreferrer noopener",
|
|
1236
|
+
href,
|
|
1237
|
+
...props,
|
|
1238
|
+
children
|
|
1239
|
+
}
|
|
1240
|
+
);
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
function ActionMarkdownLink({
|
|
1244
|
+
title,
|
|
1245
|
+
onOpen,
|
|
1246
|
+
children
|
|
1247
|
+
}) {
|
|
1248
|
+
const [state, setState] = useState3("idle");
|
|
1249
|
+
return /* @__PURE__ */ jsxs4(
|
|
1250
|
+
"button",
|
|
1251
|
+
{
|
|
1252
|
+
type: "button",
|
|
1253
|
+
className: cn(
|
|
1254
|
+
MARKDOWN_LINK_CLASS,
|
|
1255
|
+
"inline-flex min-h-7 cursor-pointer items-center aria-disabled:cursor-wait aria-disabled:opacity-70 pointer-coarse:min-h-11"
|
|
1256
|
+
),
|
|
1257
|
+
"aria-disabled": state === "loading" || void 0,
|
|
1258
|
+
"aria-busy": state === "loading",
|
|
1259
|
+
title: state === "error" ? "Couldn't open this file. Select to retry." : title,
|
|
1260
|
+
onClick: () => {
|
|
1261
|
+
if (state === "loading") return;
|
|
1262
|
+
setState("loading");
|
|
1263
|
+
void Promise.resolve().then(onOpen).then(
|
|
1264
|
+
() => setState("idle"),
|
|
1265
|
+
() => setState("error")
|
|
1266
|
+
);
|
|
1267
|
+
},
|
|
1268
|
+
children: [
|
|
1269
|
+
children,
|
|
1270
|
+
state === "loading" ? " (opening\u2026)" : state === "error" ? " (retry)" : null
|
|
1271
|
+
]
|
|
1272
|
+
}
|
|
1273
|
+
);
|
|
1274
|
+
}
|
|
1275
|
+
function isSandboxHref(href) {
|
|
1276
|
+
return openGeniLinkScheme(href) === "sandbox";
|
|
1277
|
+
}
|
|
1278
|
+
function sandboxFileLocationFromHref(href) {
|
|
1279
|
+
return parseSandboxLink(href);
|
|
1280
|
+
}
|
|
1281
|
+
function sandboxFilePathFromHref(href) {
|
|
1282
|
+
return sandboxFileLocationFromHref(href)?.path ?? null;
|
|
1283
|
+
}
|
|
1284
|
+
function retainedImageId(src) {
|
|
1285
|
+
return parseRetainedFileReference(src);
|
|
1286
|
+
}
|
|
1287
|
+
function MarkdownImage({ src, alt }) {
|
|
1288
|
+
const { renderImage, suppressImages } = useContext4(InteractiveContext);
|
|
1289
|
+
if (suppressImages)
|
|
1290
|
+
return /* @__PURE__ */ jsxs4("span", { "data-og-image-placeholder": "", children: [
|
|
1291
|
+
alt || "Image",
|
|
1292
|
+
" (preview unavailable)"
|
|
1293
|
+
] });
|
|
1294
|
+
if (!src) return /* @__PURE__ */ jsx5("span", { children: alt ?? "Image unavailable" });
|
|
1295
|
+
if (retainedImageId(src))
|
|
1296
|
+
return renderImage ? /* @__PURE__ */ jsx5(Fragment2, { children: renderImage({ src, alt: alt ?? "" }) }) : /* @__PURE__ */ jsxs4("span", { children: [
|
|
1297
|
+
alt || "Image",
|
|
1298
|
+
" (preview unavailable)"
|
|
1299
|
+
] });
|
|
1300
|
+
return /* @__PURE__ */ jsx5("img", { src, alt: alt ?? "", loading: "lazy", className: "my-3 max-w-full rounded-og-md" });
|
|
1301
|
+
}
|
|
1302
|
+
var markdownUrlTransform = (url, key, node) => key === "href" && node.tagName === "a" && isReservedOpenGeniLink(url) || key === "src" && node.tagName === "img" && retainedImageId(url) ? url : defaultUrlTransform(url);
|
|
1303
|
+
var REVEAL_LINGER_MS = 480 * MOTION_INSPECT_SCALE;
|
|
1304
|
+
var MARKDOWN_SETTLE_MS = 480 * MOTION_INSPECT_SCALE;
|
|
1305
|
+
function nodeText(node) {
|
|
1306
|
+
if (node == null || typeof node === "boolean") {
|
|
1307
|
+
return "";
|
|
1308
|
+
}
|
|
1309
|
+
if (typeof node === "string" || typeof node === "number") {
|
|
1310
|
+
return String(node);
|
|
1311
|
+
}
|
|
1312
|
+
if (Array.isArray(node)) {
|
|
1313
|
+
return node.map(nodeText).join("");
|
|
1314
|
+
}
|
|
1315
|
+
if (isValidElement(node)) {
|
|
1316
|
+
return nodeText(node.props.children);
|
|
1317
|
+
}
|
|
1318
|
+
return "";
|
|
1319
|
+
}
|
|
1320
|
+
function fenceLanguage(children) {
|
|
1321
|
+
let found = null;
|
|
1322
|
+
Children.forEach(children, (child) => {
|
|
1323
|
+
if (found || !isValidElement(child)) {
|
|
1324
|
+
return;
|
|
1325
|
+
}
|
|
1326
|
+
const match = /language-([a-zA-Z0-9_+-]+)/.exec(child.props.className ?? "");
|
|
1327
|
+
if (match?.[1]) {
|
|
1328
|
+
found = match[1];
|
|
1329
|
+
}
|
|
1330
|
+
});
|
|
1331
|
+
return found;
|
|
1332
|
+
}
|
|
1333
|
+
function InteractiveCodeBlock({ children, node }) {
|
|
1334
|
+
const { source, render, streaming } = useContext4(InteractiveContext);
|
|
1335
|
+
const language = fenceLanguage(children);
|
|
1336
|
+
if (render && (language === "opengeni-html" || language === "opengeni-site")) {
|
|
1337
|
+
const start = node?.position?.start.offset;
|
|
1338
|
+
const end = node?.position?.end.offset;
|
|
1339
|
+
const original = start !== void 0 && end !== void 0 && end <= source.length ? source.slice(start, end) : "";
|
|
1340
|
+
const lines = original.trimEnd().split("\n");
|
|
1341
|
+
const opening = lines[0]?.match(/^ {0,3}([\x60]{3,}|~{3,})/);
|
|
1342
|
+
const closing = lines.at(-1)?.replace(/^\s*(?:>\s*)+/, "").trim();
|
|
1343
|
+
const complete = opening && lines.length > 1 && closing && closing.length >= opening[1].length && [...closing].every((c) => c === opening[1][0]);
|
|
1344
|
+
if (!complete) {
|
|
1345
|
+
return /* @__PURE__ */ jsx5("div", { role: "status", "aria-live": "polite", "aria-busy": streaming === true, className: "my-3", children: streaming ? /* @__PURE__ */ jsx5(PreviewLoading, {}) : /* @__PURE__ */ jsx5(
|
|
1346
|
+
ActivityDisclosure,
|
|
1347
|
+
{
|
|
1348
|
+
icon: /* @__PURE__ */ jsx5(PanelsTopLeftIcon, { "aria-hidden": true, className: "size-3.5" }),
|
|
1349
|
+
title: "Preview incomplete",
|
|
1350
|
+
running: false,
|
|
1351
|
+
expandable: false,
|
|
1352
|
+
preview: "Generation stopped before the preview was ready."
|
|
1353
|
+
}
|
|
1354
|
+
) });
|
|
1355
|
+
}
|
|
1356
|
+
return /* @__PURE__ */ jsx5(Fragment2, { children: render({
|
|
1357
|
+
kind: language === "opengeni-html" ? "html" : "site",
|
|
1358
|
+
content: nodeText(children).replace(/\n$/, "")
|
|
1359
|
+
}) });
|
|
1360
|
+
}
|
|
1361
|
+
return /* @__PURE__ */ jsx5(MarkdownCodeBlock, { children });
|
|
1362
|
+
}
|
|
1363
|
+
function MarkdownCodeBlock({ children }) {
|
|
1364
|
+
const code = nodeText(children).replace(/\n$/, "");
|
|
1365
|
+
const language = fenceLanguage(children);
|
|
1366
|
+
return /* @__PURE__ */ jsxs4("div", { className: "group/copy relative mt-3 first:mt-0", children: [
|
|
1367
|
+
/* @__PURE__ */ jsxs4("div", { className: "pointer-events-none absolute top-1.5 right-1.5 z-10 flex items-center gap-1", children: [
|
|
1368
|
+
language ? /* @__PURE__ */ jsx5("span", { className: "rounded px-1 py-0.5 font-og-mono text-[10px] uppercase tracking-wide text-og-fg-subtle/80 opacity-0 transition-opacity group-hover/copy:opacity-100 pointer-coarse:opacity-70", children: language }) : null,
|
|
1369
|
+
/* @__PURE__ */ jsx5("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx5(CopyButton, { text: code, label: "Copy code", reveal: "group-hover" }) })
|
|
1370
|
+
] }),
|
|
1371
|
+
/* @__PURE__ */ jsx5(
|
|
1372
|
+
"pre",
|
|
1373
|
+
{
|
|
1374
|
+
tabIndex: 0,
|
|
1375
|
+
className: "overflow-x-auto overflow-y-hidden rounded-og-md bg-og-surface-1/70 px-3 py-2.5 font-og-mono text-og-sm leading-5 text-og-fg-muted [scrollbar-gutter:stable] [&>code]:block [&>code]:border-0 [&>code]:bg-transparent [&>code]:p-0 [&>code]:leading-5 [&>code]:text-inherit",
|
|
1376
|
+
children
|
|
1377
|
+
}
|
|
1378
|
+
)
|
|
1379
|
+
] });
|
|
1380
|
+
}
|
|
1381
|
+
function MarkdownTable({ children, className, ...props }) {
|
|
1382
|
+
const wrapperRef = useRef4(null);
|
|
1383
|
+
const tableRef = useRef4(null);
|
|
1384
|
+
const layoutRef = useRef4(void 0);
|
|
1385
|
+
useEffect4(() => {
|
|
1386
|
+
const wrapper = wrapperRef.current;
|
|
1387
|
+
const table = tableRef.current;
|
|
1388
|
+
if (!wrapper?.closest("[data-og-wide-table-message]") || !table) return;
|
|
1389
|
+
let disposed = false;
|
|
1390
|
+
void import("./markdown-table-layout-QXSLK4BY.js").then(({ observeMarkdownTableLayout }) => {
|
|
1391
|
+
if (!disposed) layoutRef.current = observeMarkdownTableLayout(wrapper, table);
|
|
1392
|
+
}).catch(() => {
|
|
1393
|
+
});
|
|
1394
|
+
return () => {
|
|
1395
|
+
disposed = true;
|
|
1396
|
+
layoutRef.current?.disconnect();
|
|
1397
|
+
layoutRef.current = void 0;
|
|
1398
|
+
};
|
|
1399
|
+
}, []);
|
|
1400
|
+
useEffect4(() => {
|
|
1401
|
+
layoutRef.current?.measure();
|
|
1402
|
+
}, [children]);
|
|
1403
|
+
return /* @__PURE__ */ jsxs4("div", { ref: wrapperRef, className: "group/copy relative mt-3 max-w-full first:mt-0", children: [
|
|
1404
|
+
/* @__PURE__ */ jsx5("div", { className: "pointer-events-none absolute top-0 right-0 z-10", children: /* @__PURE__ */ jsx5("div", { className: "pointer-events-auto", children: /* @__PURE__ */ jsx5(
|
|
1405
|
+
CopyButton,
|
|
1406
|
+
{
|
|
1407
|
+
text: () => tableElementToTsv(tableRef.current),
|
|
1408
|
+
label: "Copy table",
|
|
1409
|
+
reveal: "group-hover"
|
|
1410
|
+
}
|
|
1411
|
+
) }) }),
|
|
1412
|
+
/* @__PURE__ */ jsx5("div", { className: "overflow-x-auto", tabIndex: 0, children: /* @__PURE__ */ jsx5(
|
|
1413
|
+
"table",
|
|
1414
|
+
{
|
|
1415
|
+
ref: tableRef,
|
|
1416
|
+
className: cn("w-full min-w-0 border-collapse text-og-base", className),
|
|
1417
|
+
...props,
|
|
1418
|
+
children
|
|
1419
|
+
}
|
|
1420
|
+
) })
|
|
1421
|
+
] });
|
|
1422
|
+
}
|
|
1423
|
+
function MarkdownImpl({
|
|
1424
|
+
children,
|
|
1425
|
+
artifactHref,
|
|
1426
|
+
className,
|
|
1427
|
+
streaming = false,
|
|
1428
|
+
onSandboxFile,
|
|
1429
|
+
renderInteractiveBlock,
|
|
1430
|
+
renderImage,
|
|
1431
|
+
resolveLink,
|
|
1432
|
+
suppressImages
|
|
1433
|
+
}) {
|
|
1434
|
+
const revealRef = useRef4(null);
|
|
1435
|
+
const bodyRef = useRef4(null);
|
|
1436
|
+
const [, bump] = useReducer((n) => n + 1, 0);
|
|
1437
|
+
const [settling, setSettling] = useState3(false);
|
|
1438
|
+
const hadRevealRef = useRef4(false);
|
|
1439
|
+
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
1440
|
+
const crystallize = (mutate) => {
|
|
1441
|
+
mutate();
|
|
1442
|
+
setSettling(true);
|
|
1443
|
+
bump();
|
|
1444
|
+
return setTimeout(() => setSettling(false), MARKDOWN_SETTLE_MS);
|
|
1445
|
+
};
|
|
1446
|
+
if (streaming && revealRef.current === null && !prefersReducedMotion()) {
|
|
1447
|
+
revealRef.current = createStreamReveal();
|
|
1448
|
+
}
|
|
1449
|
+
const reveal = revealRef.current;
|
|
1450
|
+
if (reveal !== null && streaming) {
|
|
1451
|
+
reveal.observe(children, now);
|
|
1452
|
+
}
|
|
1453
|
+
if (reveal !== null) {
|
|
1454
|
+
hadRevealRef.current = true;
|
|
1455
|
+
}
|
|
1456
|
+
const revealActive = reveal !== null && (streaming || reveal.hasActive(now));
|
|
1457
|
+
const rehypePlugins = revealActive && reveal !== null ? [[rehypeStreamReveal, { reveal, now }]] : void 0;
|
|
1458
|
+
useEffect4(() => {
|
|
1459
|
+
if (streaming || revealRef.current === null) {
|
|
1460
|
+
return;
|
|
1461
|
+
}
|
|
1462
|
+
let clearSettle;
|
|
1463
|
+
const timer = setTimeout(() => {
|
|
1464
|
+
const shouldSettle = hadRevealRef.current && !prefersReducedMotion();
|
|
1465
|
+
if (shouldSettle) {
|
|
1466
|
+
hadRevealRef.current = false;
|
|
1467
|
+
}
|
|
1468
|
+
if (shouldSettle) {
|
|
1469
|
+
clearSettle = crystallize(() => {
|
|
1470
|
+
revealRef.current = null;
|
|
1471
|
+
});
|
|
1472
|
+
} else {
|
|
1473
|
+
revealRef.current = null;
|
|
1474
|
+
bump();
|
|
1475
|
+
}
|
|
1476
|
+
}, REVEAL_LINGER_MS);
|
|
1477
|
+
return () => {
|
|
1478
|
+
clearTimeout(timer);
|
|
1479
|
+
if (clearSettle !== void 0) {
|
|
1480
|
+
clearTimeout(clearSettle);
|
|
1481
|
+
}
|
|
1482
|
+
};
|
|
1483
|
+
}, [streaming]);
|
|
1484
|
+
const wasStreamingRef = useRef4(streaming);
|
|
1485
|
+
useEffect4(() => {
|
|
1486
|
+
const ended = wasStreamingRef.current && !streaming;
|
|
1487
|
+
wasStreamingRef.current = streaming;
|
|
1488
|
+
if (!ended || revealRef.current !== null || prefersReducedMotion()) {
|
|
1489
|
+
return;
|
|
1490
|
+
}
|
|
1491
|
+
setSettling(true);
|
|
1492
|
+
const timer = setTimeout(() => setSettling(false), MARKDOWN_SETTLE_MS);
|
|
1493
|
+
return () => clearTimeout(timer);
|
|
1494
|
+
}, [streaming]);
|
|
1495
|
+
const parseText = streaming || revealActive ? softenStreamingMarkdown(children) : children;
|
|
1496
|
+
const linkContext = useMemo(
|
|
1497
|
+
() => ({ onSandboxFile, artifactHref, resolveLink }),
|
|
1498
|
+
[onSandboxFile, artifactHref, resolveLink]
|
|
1499
|
+
);
|
|
1500
|
+
const interactiveContext = useMemo(
|
|
1501
|
+
() => ({
|
|
1502
|
+
source: children,
|
|
1503
|
+
streaming,
|
|
1504
|
+
...renderInteractiveBlock ? { render: renderInteractiveBlock } : {},
|
|
1505
|
+
...renderImage ? { renderImage } : {},
|
|
1506
|
+
...suppressImages ? { suppressImages } : {}
|
|
1507
|
+
}),
|
|
1508
|
+
[children, streaming, renderInteractiveBlock, renderImage, suppressImages]
|
|
1509
|
+
);
|
|
1510
|
+
return /* @__PURE__ */ jsx5(MarkdownLinkContext.Provider, { value: linkContext, children: /* @__PURE__ */ jsx5(InteractiveContext.Provider, { value: interactiveContext, children: /* @__PURE__ */ jsx5(TooltipProvider, { delayDuration: 400, children: /* @__PURE__ */ jsx5(
|
|
1511
|
+
"div",
|
|
1512
|
+
{
|
|
1513
|
+
ref: bodyRef,
|
|
1514
|
+
className: cn(
|
|
1515
|
+
"og-markdown-body min-w-0 break-words",
|
|
1516
|
+
settling && "og-markdown-settle",
|
|
1517
|
+
className
|
|
1518
|
+
),
|
|
1519
|
+
children: /* @__PURE__ */ jsx5(
|
|
1520
|
+
ReactMarkdown,
|
|
1521
|
+
{
|
|
1522
|
+
remarkPlugins: [remarkGfm],
|
|
1523
|
+
rehypePlugins,
|
|
1524
|
+
components: markdownComponents,
|
|
1525
|
+
urlTransform: markdownUrlTransform,
|
|
1526
|
+
children: parseText
|
|
1527
|
+
}
|
|
1528
|
+
)
|
|
1529
|
+
}
|
|
1530
|
+
) }) }) });
|
|
1531
|
+
}
|
|
1532
|
+
var Markdown = memo2(function SearchableMarkdown(props) {
|
|
1533
|
+
const [retained, setRetained] = useState3(
|
|
1534
|
+
null
|
|
1535
|
+
);
|
|
1536
|
+
if (props.searchTarget && (retained?.target !== props.searchTarget || retained.text !== props.children)) {
|
|
1537
|
+
setRetained({ text: props.children, target: props.searchTarget });
|
|
1538
|
+
}
|
|
1539
|
+
const target = props.searchTarget ?? (retained?.text === props.children ? retained.target : null);
|
|
1540
|
+
if (!target) return /* @__PURE__ */ jsx5(MarkdownImpl, { ...props });
|
|
1541
|
+
const offset = searchMatchOffset(props.children, target);
|
|
1542
|
+
if (offset < 0)
|
|
1543
|
+
return props.searchTarget ? /* @__PURE__ */ jsx5("div", { role: "status", children: "This match is no longer in the message source." }) : /* @__PURE__ */ jsx5(MarkdownImpl, { ...props });
|
|
1544
|
+
let start = Math.max(0, offset - 240);
|
|
1545
|
+
let end = Math.min(props.children.length, offset + target.query.length + 240);
|
|
1546
|
+
if (start > 0 && /[\uDC00-\uDFFF]/.test(props.children[start])) start--;
|
|
1547
|
+
if (end < props.children.length && /[\uDC00-\uDFFF]/.test(props.children[end])) end++;
|
|
1548
|
+
const MatchTag = props.searchTarget ? "mark" : "span";
|
|
1549
|
+
return /* @__PURE__ */ jsxs4("div", { className: cn("og-markdown-body min-w-0 break-words", props.className), children: [
|
|
1550
|
+
/* @__PURE__ */ jsxs4("div", { "data-og-annotation-chrome": "", className: "text-xs opacity-70", children: [
|
|
1551
|
+
"Match in message source \xB7 Excerpt stays in place when Find closes",
|
|
1552
|
+
/* @__PURE__ */ jsx5(
|
|
1553
|
+
"button",
|
|
1554
|
+
{
|
|
1555
|
+
type: "button",
|
|
1556
|
+
disabled: !!props.searchTarget,
|
|
1557
|
+
title: props.searchTarget ? "Close Find to show the formatted message" : void 0,
|
|
1558
|
+
className: "ml-2 inline-flex min-h-7 items-center rounded-og-sm px-1.5 text-og-xs font-medium text-og-fg-muted outline-hidden hover:text-og-fg focus-visible:ring-2 focus-visible:ring-og-accent/45 pointer-coarse:min-h-11 disabled:opacity-50",
|
|
1559
|
+
onClick: () => setRetained(null),
|
|
1560
|
+
children: "Show formatted message"
|
|
1561
|
+
}
|
|
1562
|
+
)
|
|
1563
|
+
] }),
|
|
1564
|
+
/* @__PURE__ */ jsxs4("div", { style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere" }, children: [
|
|
1565
|
+
start > 0 ? "\u2026" : "",
|
|
1566
|
+
props.children.slice(start, offset),
|
|
1567
|
+
/* @__PURE__ */ jsx5(
|
|
1568
|
+
MatchTag,
|
|
1569
|
+
{
|
|
1570
|
+
"data-og-search-occurrence": target.occurrence ?? 0,
|
|
1571
|
+
"data-og-search-sequence": target.sequence,
|
|
1572
|
+
"data-og-search-query": target.query,
|
|
1573
|
+
"data-og-search-offset": offset,
|
|
1574
|
+
children: props.children.slice(offset, offset + target.query.length)
|
|
1575
|
+
}
|
|
1576
|
+
),
|
|
1577
|
+
props.children.slice(offset + target.query.length, end),
|
|
1578
|
+
end < props.children.length ? "\u2026" : ""
|
|
1579
|
+
] })
|
|
1580
|
+
] });
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
export {
|
|
1584
|
+
TimelineSearchRevealContext,
|
|
1585
|
+
useTimelineSearchReveal,
|
|
1586
|
+
isTimelineSearchTarget,
|
|
1587
|
+
useTimelineSearchNavigation,
|
|
1588
|
+
DisclosureDefaultsProvider,
|
|
1589
|
+
useForcedDefaultOpen,
|
|
1590
|
+
ToolCallTruncationProvider,
|
|
1591
|
+
CompactActivityContext,
|
|
1592
|
+
ActivityDisclosure,
|
|
1593
|
+
TermBlock,
|
|
1594
|
+
PayloadBlock,
|
|
1595
|
+
BodyNote,
|
|
1596
|
+
MediaSkeleton,
|
|
1597
|
+
MediaEmpty,
|
|
1598
|
+
Thumbnail,
|
|
1599
|
+
ScreenshotFigure,
|
|
1600
|
+
MOTION_INSPECT_SCALE,
|
|
1601
|
+
CopyButton,
|
|
1602
|
+
CopyHoverFrame,
|
|
1603
|
+
sandboxFileLocationFromHref,
|
|
1604
|
+
sandboxFilePathFromHref,
|
|
1605
|
+
retainedImageId,
|
|
1606
|
+
Markdown
|
|
1607
|
+
};
|
|
1608
|
+
//# sourceMappingURL=chunk-I7IWRQLN.js.map
|