@opengeni/react 0.46.1 → 0.52.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/README.md +158 -14
  2. package/dist/artifacts-document.d.ts +3 -0
  3. package/dist/artifacts-document.js +17 -0
  4. package/dist/artifacts-document.js.map +1 -0
  5. package/dist/artifacts-presentation.d.ts +3 -0
  6. package/dist/artifacts-presentation.js +17 -0
  7. package/dist/artifacts-presentation.js.map +1 -0
  8. package/dist/artifacts-spreadsheet.d.ts +3 -0
  9. package/dist/artifacts-spreadsheet.js +17 -0
  10. package/dist/artifacts-spreadsheet.js.map +1 -0
  11. package/dist/artifacts.d.ts +2 -0
  12. package/dist/artifacts.js +170 -0
  13. package/dist/artifacts.js.map +1 -0
  14. package/dist/chunk-6BBWWOOU.js +82 -0
  15. package/dist/chunk-6BBWWOOU.js.map +1 -0
  16. package/dist/{chunk-HFO4ERGQ.js → chunk-724BW4TW.js} +586 -35
  17. package/dist/chunk-724BW4TW.js.map +1 -0
  18. package/dist/chunk-7I2KB3OK.js +3895 -0
  19. package/dist/chunk-7I2KB3OK.js.map +1 -0
  20. package/dist/chunk-7WCLAEFV.js +2828 -0
  21. package/dist/chunk-7WCLAEFV.js.map +1 -0
  22. package/dist/{chunk-U3CSCMWA.js → chunk-FK6VG4LL.js} +9 -13
  23. package/dist/chunk-FK6VG4LL.js.map +1 -0
  24. package/dist/{chunk-SRFUT2ZU.js → chunk-FWS3KC3Z.js} +120 -64
  25. package/dist/chunk-FWS3KC3Z.js.map +1 -0
  26. package/dist/{chunk-EKZH6IDG.js → chunk-HDBG7XGO.js} +62 -1
  27. package/dist/chunk-HDBG7XGO.js.map +1 -0
  28. package/dist/chunk-HUIKIDM5.js +2148 -0
  29. package/dist/chunk-HUIKIDM5.js.map +1 -0
  30. package/dist/{chunk-LGVMUIRV.js → chunk-JAGDUCZQ.js} +1053 -390
  31. package/dist/chunk-JAGDUCZQ.js.map +1 -0
  32. package/dist/{chunk-LWR4MXSS.js → chunk-JR3QFY6B.js} +420 -35
  33. package/dist/chunk-JR3QFY6B.js.map +1 -0
  34. package/dist/chunk-JVYQRRC4.js +53 -0
  35. package/dist/chunk-JVYQRRC4.js.map +1 -0
  36. package/dist/chunk-KCGXPP5V.js +157 -0
  37. package/dist/chunk-KCGXPP5V.js.map +1 -0
  38. package/dist/{chunk-EB67J347.js → chunk-KZ73RL76.js} +111 -31
  39. package/dist/chunk-KZ73RL76.js.map +1 -0
  40. package/dist/chunk-PEI6RANI.js +3234 -0
  41. package/dist/chunk-PEI6RANI.js.map +1 -0
  42. package/dist/{chunk-3PB7MIT6.js → chunk-ROIRTM37.js} +220 -72
  43. package/dist/chunk-ROIRTM37.js.map +1 -0
  44. package/dist/chunk-VZTQ73XT.js +86 -0
  45. package/dist/chunk-VZTQ73XT.js.map +1 -0
  46. package/dist/{chunk-VCBFUSUZ.js → chunk-WSK7G5LE.js} +72 -4
  47. package/dist/chunk-WSK7G5LE.js.map +1 -0
  48. package/dist/{chunk-FGZUCXZF.js → chunk-WYA65Y3F.js} +16 -16
  49. package/dist/chunk-WYA65Y3F.js.map +1 -0
  50. package/dist/{chunk-6EDV6YFE.js → chunk-X4S56Y2H.js} +147 -35
  51. package/dist/chunk-X4S56Y2H.js.map +1 -0
  52. package/dist/client.d.ts +7 -1
  53. package/dist/clipboard.d.ts +1 -0
  54. package/dist/clipboard.js +7 -0
  55. package/dist/clipboard.js.map +1 -0
  56. package/dist/commands/index.d.ts +3 -3
  57. package/dist/commands/registry.d.ts +1 -1
  58. package/dist/commands/types.d.ts +1 -1
  59. package/dist/components/approval-surface.d.ts +2 -2
  60. package/dist/components/artifacts/artifact-surface.d.ts +18 -0
  61. package/dist/components/artifacts/document-editor.d.ts +172 -0
  62. package/dist/components/artifacts/editable-artifact-ui.d.ts +13 -0
  63. package/dist/components/artifacts/editable-artifact-workbench.d.ts +49 -0
  64. package/dist/components/artifacts/editable-document.d.ts +24 -0
  65. package/dist/components/artifacts/editable-presentation.d.ts +24 -0
  66. package/dist/components/artifacts/editable-spreadsheet.d.ts +32 -0
  67. package/dist/components/artifacts/index.d.ts +8 -0
  68. package/dist/components/artifacts/presentation-editor.d.ts +297 -0
  69. package/dist/components/artifacts/spreadsheet-canvas.d.ts +120 -0
  70. package/dist/components/artifacts/spreadsheet-grid.d.ts +113 -0
  71. package/dist/components/browser-viewer.d.ts +29 -0
  72. package/dist/components/chat-composer.d.ts +13 -8
  73. package/dist/components/code-editor.d.ts +25 -3
  74. package/dist/components/command-palette.d.ts +2 -2
  75. package/dist/components/composer-transcription-control.d.ts +4 -2
  76. package/dist/components/composer.d.ts +29 -15
  77. package/dist/components/computer-viewer.d.ts +23 -0
  78. package/dist/components/copy-button.d.ts +2 -2
  79. package/dist/components/desktop-viewer.d.ts +25 -21
  80. package/dist/components/diff-view.d.ts +1 -1
  81. package/dist/components/enrollment-consent.d.ts +1 -1
  82. package/dist/components/enrollment-device-flow.d.ts +1 -1
  83. package/dist/components/file-browser.d.ts +2 -2
  84. package/dist/components/fleet-tile.d.ts +1 -1
  85. package/dist/components/generated-video-player.d.ts +10 -0
  86. package/dist/components/human-input-form.d.ts +1 -1
  87. package/dist/components/human-input-surface.d.ts +2 -2
  88. package/dist/components/interactive-workbench-viewers.d.ts +2 -0
  89. package/dist/components/machine-card.d.ts +2 -2
  90. package/dist/components/machine-dock-bar.d.ts +3 -3
  91. package/dist/components/machine-health-pill.d.ts +2 -2
  92. package/dist/components/machine-input-display.d.ts +1 -1
  93. package/dist/components/machine-metrics.d.ts +2 -2
  94. package/dist/components/machine-status-pill.d.ts +4 -4
  95. package/dist/components/machines/health.d.ts +1 -1
  96. package/dist/components/machines/machine-detail.d.ts +5 -3
  97. package/dist/components/machines/metric-history-chart.d.ts +1 -1
  98. package/dist/components/machines/metric-sparkline.d.ts +2 -2
  99. package/dist/components/machines/series.d.ts +2 -2
  100. package/dist/components/machines-dashboard.d.ts +5 -5
  101. package/dist/components/markdown.d.ts +1 -1
  102. package/dist/components/message-timeline.d.ts +22 -5
  103. package/dist/components/model-picker.d.ts +2 -2
  104. package/dist/components/model-policy-picker.d.ts +7 -7
  105. package/dist/components/pierre-diff.d.ts +1 -1
  106. package/dist/components/pierre-file.d.ts +1 -1
  107. package/dist/components/queue-draft-policy.d.ts +1 -1
  108. package/dist/components/queue-surface-implementation.d.ts +3 -3
  109. package/dist/components/queue-surface-state.d.ts +4 -4
  110. package/dist/components/queue-surface.d.ts +5 -5
  111. package/dist/components/sandbox-files.d.ts +5 -5
  112. package/dist/components/sandbox-terminal.d.ts +50 -4
  113. package/dist/components/sandbox-workspace.d.ts +30 -10
  114. package/dist/components/session-chrome.d.ts +4 -4
  115. package/dist/components/session-status.d.ts +2 -2
  116. package/dist/components/timeline-annotation-selection.d.ts +9 -0
  117. package/dist/components/timeline-annotations-dialog.d.ts +16 -0
  118. package/dist/components/timeline-annotations.d.ts +13 -0
  119. package/dist/components/tooltip.d.ts +4 -4
  120. package/dist/components/user-message-body.d.ts +2 -2
  121. package/dist/components/workbench-changes.d.ts +2 -2
  122. package/dist/components/workspace-dock.d.ts +3 -1
  123. package/dist/composer.d.ts +11 -11
  124. package/dist/composer.js +7 -7
  125. package/dist/hooks/internal.d.ts +7 -1
  126. package/dist/hooks/use-attached-browsers.d.ts +21 -0
  127. package/dist/hooks/use-available-models.d.ts +2 -2
  128. package/dist/hooks/use-billing-usage.d.ts +1 -1
  129. package/dist/hooks/use-browser-frame-stream.d.ts +28 -0
  130. package/dist/hooks/use-browser-identities.d.ts +26 -0
  131. package/dist/hooks/use-browser-session.d.ts +28 -0
  132. package/dist/hooks/use-browser-sessions.d.ts +32 -0
  133. package/dist/hooks/use-codex-accounts.d.ts +3 -3
  134. package/dist/hooks/use-composer.d.ts +36 -9
  135. package/dist/hooks/use-computer-frame-stream.d.ts +24 -0
  136. package/dist/hooks/use-computer-session.d.ts +28 -0
  137. package/dist/hooks/use-computer-sessions.d.ts +28 -0
  138. package/dist/hooks/use-desktop-stream.d.ts +1 -1
  139. package/dist/hooks/use-environments.d.ts +11 -5
  140. package/dist/hooks/use-file-attachments.d.ts +1 -1
  141. package/dist/hooks/use-goal.d.ts +2 -2
  142. package/dist/hooks/use-human-input.d.ts +2 -2
  143. package/dist/hooks/use-last-started-turn-policy.d.ts +2 -2
  144. package/dist/hooks/use-machine-chip.d.ts +2 -2
  145. package/dist/hooks/use-machines.d.ts +10 -3
  146. package/dist/hooks/use-packs.d.ts +7 -2
  147. package/dist/hooks/use-rigs.d.ts +1 -1
  148. package/dist/hooks/use-sandbox-files.d.ts +25 -4
  149. package/dist/hooks/use-sandbox-git.d.ts +13 -5
  150. package/dist/hooks/use-sandbox-terminal.d.ts +1 -1
  151. package/dist/hooks/use-scheduled-tasks.d.ts +1 -1
  152. package/dist/hooks/use-session-capabilities.d.ts +5 -4
  153. package/dist/hooks/use-session-control.d.ts +1 -1
  154. package/dist/hooks/use-session-events.d.ts +2 -2
  155. package/dist/hooks/use-session-lineage.d.ts +1 -1
  156. package/dist/hooks/use-session-mcp-approval-policy.d.ts +2 -2
  157. package/dist/hooks/use-session.d.ts +2 -2
  158. package/dist/hooks/use-slash-commands.d.ts +1 -1
  159. package/dist/hooks/use-terminal-stream.d.ts +8 -2
  160. package/dist/hooks/use-transcription.d.ts +2 -2
  161. package/dist/hooks/use-turn-queue.d.ts +2 -2
  162. package/dist/hooks/use-video-artifact-playback.d.ts +9 -0
  163. package/dist/hooks/use-voice-input.d.ts +6 -4
  164. package/dist/hooks/use-workspace-capture.d.ts +1 -1
  165. package/dist/hooks/use-workspace-edit.d.ts +1 -1
  166. package/dist/hooks/use-workspace-sessions.d.ts +1 -1
  167. package/dist/hooks/use-workspaces.d.ts +1 -1
  168. package/dist/index.d.ts +158 -154
  169. package/dist/index.js +1718 -908
  170. package/dist/index.js.map +1 -1
  171. package/dist/interaction.d.ts +23 -0
  172. package/dist/interaction.js +36 -0
  173. package/dist/interaction.js.map +1 -0
  174. package/dist/interactive-workbench-viewers-KHNOHWQE.js +13 -0
  175. package/dist/interactive-workbench-viewers-KHNOHWQE.js.map +1 -0
  176. package/dist/lib/composer-responsive-context.d.ts +9 -0
  177. package/dist/lib/relay-wire.d.ts +4 -0
  178. package/dist/lib/sandbox-liveness.d.ts +9 -0
  179. package/dist/lib/terminal-capability.d.ts +5 -0
  180. package/dist/lib/use-portal-token-style.d.ts +14 -3
  181. package/dist/lib/xterm-theme.d.ts +1 -1
  182. package/dist/machines.d.ts +30 -30
  183. package/dist/machines.js +3 -3
  184. package/dist/provider.d.ts +4 -4
  185. package/dist/{queue-surface-implementation-J4XJFKRW.js → queue-surface-implementation-2KVJTYXH.js} +117 -64
  186. package/dist/queue-surface-implementation-2KVJTYXH.js.map +1 -0
  187. package/dist/realtime/dropdown-menu.d.ts +8 -8
  188. package/dist/realtime/realtime-control.d.ts +15 -6
  189. package/dist/realtime.d.ts +4 -4
  190. package/dist/realtime.js +30 -33
  191. package/dist/realtime.js.map +1 -1
  192. package/dist/session-context.d.ts +19 -1
  193. package/dist/session-ui.d.ts +14 -14
  194. package/dist/session-ui.js +6 -5
  195. package/dist/session.d.ts +28 -28
  196. package/dist/session.js +5 -5
  197. package/dist/timeline/activity-rail.d.ts +6 -3
  198. package/dist/timeline/disclosure-context.d.ts +1 -1
  199. package/dist/timeline/fleet-decision-projection.d.ts +1 -1
  200. package/dist/timeline/fleet-decision-row.d.ts +3 -3
  201. package/dist/timeline/index.d.ts +19 -19
  202. package/dist/timeline/parsers.d.ts +6 -3
  203. package/dist/timeline/projection.d.ts +3 -3
  204. package/dist/timeline/registry.d.ts +10 -1
  205. package/dist/timeline/screenshot-lightbox.d.ts +2 -2
  206. package/dist/timeline/shared.d.ts +21 -10
  207. package/dist/timeline/tool-diff.d.ts +2 -2
  208. package/dist/timeline/tool-renderers.d.ts +1 -1
  209. package/dist/timeline/turn-summary.d.ts +3 -3
  210. package/dist/timeline/types.d.ts +42 -2
  211. package/dist/timeline-annotation-selection-3L7LHGG2.js +187 -0
  212. package/dist/timeline-annotation-selection-3L7LHGG2.js.map +1 -0
  213. package/dist/timeline-annotations-dialog-U7EVLR75.js +196 -0
  214. package/dist/timeline-annotations-dialog-U7EVLR75.js.map +1 -0
  215. package/dist/voice-recording-store.d.ts +8 -2
  216. package/package.json +52 -7
  217. package/src/artifacts-document.ts +31 -0
  218. package/src/artifacts-presentation.ts +36 -0
  219. package/src/artifacts-spreadsheet.ts +21 -0
  220. package/src/artifacts.ts +86 -0
  221. package/src/client.ts +90 -1
  222. package/src/clipboard.ts +2 -0
  223. package/src/components/artifacts/artifact-surface.tsx +93 -0
  224. package/src/components/artifacts/document-editor.tsx +2255 -0
  225. package/src/components/artifacts/editable-artifact-ui.tsx +89 -0
  226. package/src/components/artifacts/editable-artifact-workbench.tsx +203 -0
  227. package/src/components/artifacts/editable-document.tsx +657 -0
  228. package/src/components/artifacts/editable-presentation.tsx +1020 -0
  229. package/src/components/artifacts/editable-spreadsheet.tsx +733 -0
  230. package/src/components/artifacts/index.ts +99 -0
  231. package/src/components/artifacts/presentation-editor.tsx +3148 -0
  232. package/src/components/artifacts/spreadsheet-canvas.ts +799 -0
  233. package/src/components/artifacts/spreadsheet-grid.tsx +2129 -0
  234. package/src/components/browser-viewer.tsx +1592 -0
  235. package/src/components/chat-composer.tsx +25 -2
  236. package/src/components/code-editor.tsx +90 -31
  237. package/src/components/command-palette.tsx +1 -1
  238. package/src/components/composer-transcription-control.tsx +51 -22
  239. package/src/components/composer.tsx +49 -23
  240. package/src/components/computer-viewer.tsx +1139 -0
  241. package/src/components/copy-button.tsx +1 -1
  242. package/src/components/desktop-viewer.tsx +103 -75
  243. package/src/components/file-browser.tsx +39 -17
  244. package/src/components/generated-video-player.tsx +89 -0
  245. package/src/components/human-input-form.tsx +2 -2
  246. package/src/components/interactive-workbench-viewers.ts +2 -0
  247. package/src/components/machine-card.tsx +1 -1
  248. package/src/components/machine-input-display.ts +3 -0
  249. package/src/components/machines/machine-detail.tsx +39 -15
  250. package/src/components/machines-dashboard.tsx +7 -6
  251. package/src/components/message-timeline.tsx +327 -37
  252. package/src/components/model-picker.tsx +2 -2
  253. package/src/components/model-policy-picker.tsx +16 -15
  254. package/src/components/queue-surface-implementation.tsx +135 -75
  255. package/src/components/queue-surface-state.tsx +2 -2
  256. package/src/components/sandbox-files.tsx +142 -62
  257. package/src/components/sandbox-terminal.tsx +119 -35
  258. package/src/components/sandbox-workspace.tsx +394 -228
  259. package/src/components/session-chrome.tsx +67 -27
  260. package/src/components/timeline-annotation-selection.tsx +221 -0
  261. package/src/components/timeline-annotations-dialog.tsx +213 -0
  262. package/src/components/timeline-annotations.tsx +84 -0
  263. package/src/components/tooltip.tsx +13 -16
  264. package/src/components/user-message-body.tsx +1 -1
  265. package/src/components/workbench-changes.tsx +192 -35
  266. package/src/components/workspace-dock.tsx +13 -5
  267. package/src/composer.ts +3 -0
  268. package/src/hooks/internal.ts +132 -38
  269. package/src/hooks/use-attached-browsers.ts +152 -0
  270. package/src/hooks/use-browser-frame-stream.ts +316 -0
  271. package/src/hooks/use-browser-identities.ts +225 -0
  272. package/src/hooks/use-browser-session.ts +476 -0
  273. package/src/hooks/use-browser-sessions.ts +281 -0
  274. package/src/hooks/use-codex-accounts.ts +4 -4
  275. package/src/hooks/use-composer.ts +769 -24
  276. package/src/hooks/use-computer-frame-stream.ts +311 -0
  277. package/src/hooks/use-computer-session.ts +442 -0
  278. package/src/hooks/use-computer-sessions.ts +245 -0
  279. package/src/hooks/use-environments.ts +24 -5
  280. package/src/hooks/use-file-attachments.ts +70 -32
  281. package/src/hooks/use-goal.ts +17 -5
  282. package/src/hooks/use-machine-chip.ts +5 -3
  283. package/src/hooks/use-machines.ts +79 -3
  284. package/src/hooks/use-packs.ts +51 -0
  285. package/src/hooks/use-sandbox-files.ts +382 -88
  286. package/src/hooks/use-sandbox-git.ts +208 -46
  287. package/src/hooks/use-sandbox-terminal.ts +3 -2
  288. package/src/hooks/use-session-capabilities.ts +94 -70
  289. package/src/hooks/use-session-events.ts +18 -4
  290. package/src/hooks/use-terminal-stream.ts +102 -23
  291. package/src/hooks/use-transcription.ts +4 -14
  292. package/src/hooks/use-turn-queue.ts +17 -5
  293. package/src/hooks/use-video-artifact-playback.ts +28 -0
  294. package/src/hooks/use-voice-input.ts +163 -19
  295. package/src/hooks/use-windowed-sections.ts +9 -7
  296. package/src/hooks/use-workspace-edit.ts +2 -1
  297. package/src/index.ts +21 -6
  298. package/src/interaction.ts +71 -0
  299. package/src/lib/composer-responsive-context.ts +15 -0
  300. package/src/lib/relay-wire.ts +4 -0
  301. package/src/lib/sandbox-liveness.ts +11 -0
  302. package/src/lib/terminal-capability.ts +10 -0
  303. package/src/lib/use-portal-token-style.ts +60 -15
  304. package/src/provider.tsx +52 -7
  305. package/src/realtime/dropdown-menu.tsx +15 -19
  306. package/src/realtime/realtime-control.tsx +16 -5
  307. package/src/session-context.ts +90 -0
  308. package/src/timeline/activity-rail.tsx +31 -6
  309. package/src/timeline/index.ts +4 -1
  310. package/src/timeline/parsers.ts +46 -20
  311. package/src/timeline/projection.ts +233 -13
  312. package/src/timeline/registry.ts +19 -0
  313. package/src/timeline/screenshot-lightbox.tsx +30 -9
  314. package/src/timeline/shared.tsx +59 -11
  315. package/src/timeline/tool-renderers.tsx +421 -24
  316. package/src/timeline/turn-summary.tsx +2 -2
  317. package/src/timeline/types.ts +58 -2
  318. package/src/voice-recording-store.ts +15 -0
  319. package/styles/compiled.css +5298 -0
  320. package/styles/compiled.d.ts +2 -0
  321. package/styles/effective-tokens.css +27 -0
  322. package/styles/index.css +18 -0
  323. package/styles/responsive.css +208 -0
  324. package/styles/responsive.d.ts +2 -0
  325. package/styles/tokens.css +50 -17
  326. package/dist/chunk-3PB7MIT6.js.map +0 -1
  327. package/dist/chunk-6EDV6YFE.js.map +0 -1
  328. package/dist/chunk-EB67J347.js.map +0 -1
  329. package/dist/chunk-EKZH6IDG.js.map +0 -1
  330. package/dist/chunk-FGZUCXZF.js.map +0 -1
  331. package/dist/chunk-HFO4ERGQ.js.map +0 -1
  332. package/dist/chunk-JB5725BI.js +0 -48
  333. package/dist/chunk-JB5725BI.js.map +0 -1
  334. package/dist/chunk-LGVMUIRV.js.map +0 -1
  335. package/dist/chunk-LWR4MXSS.js.map +0 -1
  336. package/dist/chunk-SRFUT2ZU.js.map +0 -1
  337. package/dist/chunk-U3CSCMWA.js.map +0 -1
  338. package/dist/chunk-VCBFUSUZ.js.map +0 -1
  339. package/dist/fleet-decision-projection-SLNZMS42.js +0 -241
  340. package/dist/fleet-decision-projection-SLNZMS42.js.map +0 -1
  341. package/dist/queue-surface-implementation-J4XJFKRW.js.map +0 -1
@@ -0,0 +1,196 @@
1
+ // src/components/timeline-annotations-dialog.tsx
2
+ import { useEffect, useLayoutEffect, useRef, useState } from "react";
3
+ import { createPortal } from "react-dom";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ function cssEscapeAttribute(value) {
6
+ if (typeof CSS !== "undefined" && typeof CSS.escape === "function") return CSS.escape(value);
7
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
8
+ }
9
+ function revealLoadedSource(source) {
10
+ if (typeof document === "undefined") return false;
11
+ const element = document.querySelector(
12
+ `[data-og-annotation-source-key="${cssEscapeAttribute(source.eventId)}"]`
13
+ );
14
+ if (!(element instanceof HTMLElement)) return false;
15
+ element.scrollIntoView({ block: "center", behavior: "smooth" });
16
+ element.animate?.(
17
+ [
18
+ { outline: "2px solid color-mix(in srgb, currentColor 55%, transparent)" },
19
+ { outline: "2px solid transparent" }
20
+ ],
21
+ { duration: 1600, easing: "ease-out" }
22
+ );
23
+ return true;
24
+ }
25
+ function sourceLabel(annotation) {
26
+ if (annotation.source.label) return annotation.source.label;
27
+ switch (annotation.source.kind) {
28
+ case "user_message":
29
+ return "User message";
30
+ case "assistant_message":
31
+ return "Assistant message";
32
+ case "tool_output":
33
+ return "Tool output";
34
+ }
35
+ }
36
+ function TimelineAnnotationsDialog({
37
+ annotations,
38
+ editable,
39
+ focusAnnotationId,
40
+ onFocusConsumed,
41
+ onUpdate,
42
+ onRemove,
43
+ onRevealSource,
44
+ triggerRef,
45
+ countLabel,
46
+ onDismiss
47
+ }) {
48
+ const [unavailableId, setUnavailableId] = useState(null);
49
+ const [position, setPosition] = useState({ left: 12, top: 12, above: false });
50
+ const panelRef = useRef(null);
51
+ const noteRefs = useRef(/* @__PURE__ */ new Map());
52
+ useLayoutEffect(() => {
53
+ if (!focusAnnotationId) return;
54
+ const note = noteRefs.current.get(focusAnnotationId);
55
+ note?.focus();
56
+ if (note && document.activeElement === note) onFocusConsumed?.();
57
+ }, [focusAnnotationId, onFocusConsumed]);
58
+ useEffect(() => {
59
+ const updatePosition = () => {
60
+ const rect = triggerRef.current?.getBoundingClientRect();
61
+ if (!rect) return;
62
+ const panelWidth = Math.min(400, window.innerWidth - 24);
63
+ const left = Math.min(
64
+ Math.max(12, rect.left),
65
+ Math.max(12, window.innerWidth - panelWidth - 12)
66
+ );
67
+ const above = rect.top > Math.min(360, window.innerHeight * 0.55);
68
+ setPosition({ left, top: above ? rect.top - 8 : rect.bottom + 8, above });
69
+ };
70
+ const onKeyDown = (event) => {
71
+ if (event.key === "Escape") onDismiss(true);
72
+ };
73
+ const onPointerDown = (event) => {
74
+ if (!(event.target instanceof Node)) return;
75
+ if (panelRef.current?.contains(event.target) || triggerRef.current?.contains(event.target)) {
76
+ return;
77
+ }
78
+ onDismiss(false);
79
+ };
80
+ updatePosition();
81
+ window.addEventListener("resize", updatePosition);
82
+ window.addEventListener("scroll", updatePosition, true);
83
+ document.addEventListener("keydown", onKeyDown);
84
+ document.addEventListener("pointerdown", onPointerDown);
85
+ if (!focusAnnotationId) {
86
+ window.setTimeout(() => {
87
+ if (document.activeElement === triggerRef.current) panelRef.current?.focus();
88
+ }, 0);
89
+ }
90
+ return () => {
91
+ window.removeEventListener("resize", updatePosition);
92
+ window.removeEventListener("scroll", updatePosition, true);
93
+ document.removeEventListener("keydown", onKeyDown);
94
+ document.removeEventListener("pointerdown", onPointerDown);
95
+ };
96
+ }, [focusAnnotationId, onDismiss, triggerRef]);
97
+ if (typeof document === "undefined") return null;
98
+ return createPortal(
99
+ /* @__PURE__ */ jsxs(
100
+ "div",
101
+ {
102
+ ref: panelRef,
103
+ role: "dialog",
104
+ tabIndex: -1,
105
+ style: {
106
+ left: position.left,
107
+ top: position.top,
108
+ transform: position.above ? "translateY(-100%)" : void 0
109
+ },
110
+ className: "og-root fixed z-[75] box-border max-h-[min(32rem,70vh)] w-[min(25rem,calc(100vw-1.5rem))] overflow-y-auto rounded-og-lg border border-og-border bg-og-surface-1 p-3 text-og-fg shadow-xl outline-hidden",
111
+ "aria-label": editable ? "Review timeline annotations" : "Timeline annotations",
112
+ children: [
113
+ /* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center justify-between gap-3", children: [
114
+ /* @__PURE__ */ jsxs("div", { children: [
115
+ /* @__PURE__ */ jsx("p", { className: "text-og-sm font-semibold", children: countLabel }),
116
+ /* @__PURE__ */ jsx("p", { className: "text-og-xs text-og-fg-subtle", children: editable ? "Add a note for each quoted source." : "Sent with this message." })
117
+ ] }),
118
+ /* @__PURE__ */ jsx(
119
+ "button",
120
+ {
121
+ type: "button",
122
+ className: "rounded-md border-0 bg-transparent px-2 py-1 text-og-xs text-og-fg outline-hidden hover:bg-og-surface-2 focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-[44px]",
123
+ onClick: () => onDismiss(true),
124
+ children: "Close"
125
+ }
126
+ )
127
+ ] }),
128
+ /* @__PURE__ */ jsx("div", { className: "grid gap-2.5", children: annotations.map((annotation, index) => /* @__PURE__ */ jsxs(
129
+ "section",
130
+ {
131
+ className: "rounded-og-md border border-og-border bg-og-surface-2/60 p-2.5",
132
+ "aria-label": `Annotation ${index + 1}`,
133
+ children: [
134
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2", children: [
135
+ /* @__PURE__ */ jsxs(
136
+ "button",
137
+ {
138
+ type: "button",
139
+ className: "truncate rounded border-0 bg-transparent text-left text-og-xs font-medium text-og-fg-muted underline-offset-2 outline-hidden hover:text-og-fg hover:underline focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-[44px]",
140
+ onClick: () => {
141
+ const revealed = onRevealSource?.(annotation.source) ?? revealLoadedSource(annotation.source);
142
+ setUnavailableId(revealed ? null : annotation.id);
143
+ },
144
+ children: [
145
+ sourceLabel(annotation),
146
+ " \xB7 view source"
147
+ ]
148
+ }
149
+ ),
150
+ editable && onRemove ? /* @__PURE__ */ jsx(
151
+ "button",
152
+ {
153
+ type: "button",
154
+ className: "shrink-0 rounded border-0 bg-transparent p-1 text-og-fg-subtle outline-hidden hover:bg-og-surface-1 hover:text-og-status-failed focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:size-[44px]",
155
+ "aria-label": `Remove annotation ${index + 1}`,
156
+ onClick: () => onRemove(annotation.id),
157
+ children: /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-og-md leading-none", children: "\xD7" })
158
+ }
159
+ ) : null
160
+ ] }),
161
+ unavailableId === annotation.id ? /* @__PURE__ */ jsx("p", { role: "status", className: "mt-1 text-og-xs text-og-status-waiting", children: "Source is outside the loaded timeline window." }) : null,
162
+ /* @__PURE__ */ jsx("blockquote", { className: "mt-2 max-h-28 overflow-auto whitespace-pre-wrap border-l-2 border-og-border pl-2 text-og-sm leading-5 text-og-fg-muted", children: annotation.quote }),
163
+ editable && onUpdate ? /* @__PURE__ */ jsxs("label", { className: "mt-2 block text-og-xs font-medium text-og-fg-muted", children: [
164
+ "Note",
165
+ /* @__PURE__ */ jsx(
166
+ "textarea",
167
+ {
168
+ ref: (node) => {
169
+ if (node) noteRefs.current.set(annotation.id, node);
170
+ else noteRefs.current.delete(annotation.id);
171
+ },
172
+ value: annotation.note,
173
+ rows: 2,
174
+ maxLength: 2048,
175
+ placeholder: "What should the agent do with this?",
176
+ className: "mt-1 w-full resize-y rounded-og-sm border border-og-border bg-og-surface-1 px-2.5 py-2 text-og-sm leading-5 text-og-fg outline-hidden placeholder:text-og-fg-subtle focus:border-og-accent focus:ring-1 focus:ring-og-accent",
177
+ onInput: (event) => onUpdate(annotation.id, event.currentTarget.value)
178
+ }
179
+ )
180
+ ] }) : annotation.note ? /* @__PURE__ */ jsx("p", { className: "mt-2 whitespace-pre-wrap text-og-sm leading-5 text-og-fg", children: annotation.note }) : null
181
+ ]
182
+ },
183
+ annotation.id
184
+ )) })
185
+ ]
186
+ }
187
+ ),
188
+ document.body
189
+ );
190
+ }
191
+ var timeline_annotations_dialog_default = TimelineAnnotationsDialog;
192
+ export {
193
+ TimelineAnnotationsDialog,
194
+ timeline_annotations_dialog_default as default
195
+ };
196
+ //# sourceMappingURL=timeline-annotations-dialog-U7EVLR75.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/timeline-annotations-dialog.tsx"],"sourcesContent":["import type { TimelineAnnotationSource } from \"@opengeni/sdk\";\nimport { useEffect, useLayoutEffect, useRef, useState, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport type { TimelineAnnotationLike } from \"./timeline-annotations\";\n\nfunction cssEscapeAttribute(value: string): string {\n if (typeof CSS !== \"undefined\" && typeof CSS.escape === \"function\") return CSS.escape(value);\n return value.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"');\n}\n\nfunction revealLoadedSource(source: TimelineAnnotationSource): boolean {\n if (typeof document === \"undefined\") return false;\n const element = document.querySelector(\n `[data-og-annotation-source-key=\"${cssEscapeAttribute(source.eventId)}\"]`,\n );\n if (!(element instanceof HTMLElement)) return false;\n element.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n element.animate?.(\n [\n { outline: \"2px solid color-mix(in srgb, currentColor 55%, transparent)\" },\n { outline: \"2px solid transparent\" },\n ],\n { duration: 1600, easing: \"ease-out\" },\n );\n return true;\n}\n\nfunction sourceLabel(annotation: TimelineAnnotationLike): string {\n if (annotation.source.label) return annotation.source.label;\n switch (annotation.source.kind) {\n case \"user_message\":\n return \"User message\";\n case \"assistant_message\":\n return \"Assistant message\";\n case \"tool_output\":\n return \"Tool output\";\n }\n}\n\nexport function TimelineAnnotationsDialog({\n annotations,\n editable,\n focusAnnotationId,\n onFocusConsumed,\n onUpdate,\n onRemove,\n onRevealSource,\n triggerRef,\n countLabel,\n onDismiss,\n}: {\n annotations: readonly TimelineAnnotationLike[];\n editable: boolean;\n focusAnnotationId?: string | null | undefined;\n onFocusConsumed?: (() => void) | undefined;\n onUpdate?: ((id: string, note: string) => void) | undefined;\n onRemove?: ((id: string) => void) | undefined;\n onRevealSource?: ((source: TimelineAnnotationSource) => boolean) | undefined;\n triggerRef: RefObject<HTMLButtonElement | null>;\n countLabel: string;\n onDismiss: (restoreFocus: boolean) => void;\n}) {\n const [unavailableId, setUnavailableId] = useState<string | null>(null);\n const [position, setPosition] = useState({ left: 12, top: 12, above: false });\n const panelRef = useRef<HTMLDivElement | null>(null);\n const noteRefs = useRef(new Map<string, HTMLTextAreaElement>());\n\n useLayoutEffect(() => {\n if (!focusAnnotationId) return;\n const note = noteRefs.current.get(focusAnnotationId);\n note?.focus();\n if (note && document.activeElement === note) onFocusConsumed?.();\n }, [focusAnnotationId, onFocusConsumed]);\n\n useEffect(() => {\n const updatePosition = () => {\n const rect = triggerRef.current?.getBoundingClientRect();\n if (!rect) return;\n const panelWidth = Math.min(400, window.innerWidth - 24);\n const left = Math.min(\n Math.max(12, rect.left),\n Math.max(12, window.innerWidth - panelWidth - 12),\n );\n const above = rect.top > Math.min(360, window.innerHeight * 0.55);\n setPosition({ left, top: above ? rect.top - 8 : rect.bottom + 8, above });\n };\n const onKeyDown = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") onDismiss(true);\n };\n const onPointerDown = (event: PointerEvent) => {\n if (!(event.target instanceof Node)) return;\n if (panelRef.current?.contains(event.target) || triggerRef.current?.contains(event.target)) {\n return;\n }\n onDismiss(false);\n };\n updatePosition();\n window.addEventListener(\"resize\", updatePosition);\n window.addEventListener(\"scroll\", updatePosition, true);\n document.addEventListener(\"keydown\", onKeyDown);\n document.addEventListener(\"pointerdown\", onPointerDown);\n if (!focusAnnotationId) {\n window.setTimeout(() => {\n if (document.activeElement === triggerRef.current) panelRef.current?.focus();\n }, 0);\n }\n return () => {\n window.removeEventListener(\"resize\", updatePosition);\n window.removeEventListener(\"scroll\", updatePosition, true);\n document.removeEventListener(\"keydown\", onKeyDown);\n document.removeEventListener(\"pointerdown\", onPointerDown);\n };\n }, [focusAnnotationId, onDismiss, triggerRef]);\n\n if (typeof document === \"undefined\") return null;\n return createPortal(\n <div\n ref={panelRef}\n role=\"dialog\"\n tabIndex={-1}\n style={{\n left: position.left,\n top: position.top,\n transform: position.above ? \"translateY(-100%)\" : undefined,\n }}\n className=\"og-root fixed z-[75] box-border max-h-[min(32rem,70vh)] w-[min(25rem,calc(100vw-1.5rem))] overflow-y-auto rounded-og-lg border border-og-border bg-og-surface-1 p-3 text-og-fg shadow-xl outline-hidden\"\n aria-label={editable ? \"Review timeline annotations\" : \"Timeline annotations\"}\n >\n <div className=\"mb-2 flex items-center justify-between gap-3\">\n <div>\n <p className=\"text-og-sm font-semibold\">{countLabel}</p>\n <p className=\"text-og-xs text-og-fg-subtle\">\n {editable ? \"Add a note for each quoted source.\" : \"Sent with this message.\"}\n </p>\n </div>\n <button\n type=\"button\"\n className=\"rounded-md border-0 bg-transparent px-2 py-1 text-og-xs text-og-fg outline-hidden hover:bg-og-surface-2 focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-[44px]\"\n onClick={() => onDismiss(true)}\n >\n Close\n </button>\n </div>\n <div className=\"grid gap-2.5\">\n {annotations.map((annotation, index) => (\n <section\n key={annotation.id}\n className=\"rounded-og-md border border-og-border bg-og-surface-2/60 p-2.5\"\n aria-label={`Annotation ${index + 1}`}\n >\n <div className=\"flex items-center justify-between gap-2\">\n <button\n type=\"button\"\n className=\"truncate rounded border-0 bg-transparent text-left text-og-xs font-medium text-og-fg-muted underline-offset-2 outline-hidden hover:text-og-fg hover:underline focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:min-h-[44px]\"\n onClick={() => {\n const revealed =\n onRevealSource?.(annotation.source) ?? revealLoadedSource(annotation.source);\n setUnavailableId(revealed ? null : annotation.id);\n }}\n >\n {sourceLabel(annotation)} · view source\n </button>\n {editable && onRemove ? (\n <button\n type=\"button\"\n className=\"shrink-0 rounded border-0 bg-transparent p-1 text-og-fg-subtle outline-hidden hover:bg-og-surface-1 hover:text-og-status-failed focus-visible:ring-2 focus-visible:ring-og-accent pointer-coarse:size-[44px]\"\n aria-label={`Remove annotation ${index + 1}`}\n onClick={() => onRemove(annotation.id)}\n >\n <span aria-hidden=\"true\" className=\"text-og-md leading-none\">\n ×\n </span>\n </button>\n ) : null}\n </div>\n {unavailableId === annotation.id ? (\n <p role=\"status\" className=\"mt-1 text-og-xs text-og-status-waiting\">\n Source is outside the loaded timeline window.\n </p>\n ) : null}\n <blockquote className=\"mt-2 max-h-28 overflow-auto whitespace-pre-wrap border-l-2 border-og-border pl-2 text-og-sm leading-5 text-og-fg-muted\">\n {annotation.quote}\n </blockquote>\n {editable && onUpdate ? (\n <label className=\"mt-2 block text-og-xs font-medium text-og-fg-muted\">\n Note\n <textarea\n ref={(node) => {\n if (node) noteRefs.current.set(annotation.id, node);\n else noteRefs.current.delete(annotation.id);\n }}\n value={annotation.note}\n rows={2}\n maxLength={2048}\n placeholder=\"What should the agent do with this?\"\n className=\"mt-1 w-full resize-y rounded-og-sm border border-og-border bg-og-surface-1 px-2.5 py-2 text-og-sm leading-5 text-og-fg outline-hidden placeholder:text-og-fg-subtle focus:border-og-accent focus:ring-1 focus:ring-og-accent\"\n onInput={(event) => onUpdate(annotation.id, event.currentTarget.value)}\n />\n </label>\n ) : annotation.note ? (\n <p className=\"mt-2 whitespace-pre-wrap text-og-sm leading-5 text-og-fg\">\n {annotation.note}\n </p>\n ) : null}\n </section>\n ))}\n </div>\n </div>,\n document.body,\n );\n}\n\nex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WAAW,OAAO,WAAW,EAAE;AAAA,sBAClD;AAAA,sBAEC;AAAA,oCAAY,UAAU;AAAA,wBAAE;AAAA;AAAA;AAAA,kBAC3B;AAAA,kBACC,YAAY,WACX;AAAA,oBAAC;AAAA;AAAA,sBACC,MAAK;AAAA,sBACL,WAAU;AAAA,sBACV,cAAY,qBAAqB,QAAQ,CAAC;AAAA,sBAC1C,SAAS,MAAM,SAAS,WAAW,EAAE;AAAA,sBAErC,8BAAC,UAAK,eAAY,QAAO,WAAU,2BAA0B,kBAE7D;AAAA;AAAA,kBACF,IACE;AAAA,mBACN;AAAA,gBACC,kBAAkB,WAAW,KAC5B,oBAAC,OAAE,MAAK,UAAS,WAAU,0CAAyC,2DAEpE,IACE;AAAA,gBACJ,oBAAC,gBAAW,WAAU,0HACnB,qBAAW,OACd;AAAA,gBACC,YAAY,WACX,qBAAC,WAAM,WAAU,sDAAqD;AAAA;AAAA,kBAEpE;AAAA,oBAAC;AAAA;AAAA,sBACC,KAAK,CAAC,SAAS;AACb,4BAAI,KAAM,UAAS,QAAQ,IAAI,WAAW,IAAI,IAAI;AAAA,4BAC7C,UAAS,QAAQ,OAAO,WAAW,EAAE;AAAA,sBAC5C;AAAA,sBACA,OAAO,WAAW;AAAA,sBAClB,MAAM;AAAA,sBACN,WAAW;AAAA,sBACX,aAAY;AAAA,sBACZ,WAAU;AAAA,sBACV,SAAS,CAAC,UAAU,SAAS,WAAW,IAAI,MAAM,cAAc,KAAK;AAAA;AAAA,kBACvE;AAAA,mBACF,IACE,WAAW,OACb,oBAAC,OAAE,WAAU,4DACV,qBAAW,MACd,IACE;AAAA;AAAA;AAAA,YAzDC,WAAW;AAAA,UA0DlB,CACD,GACH;AAAA;AAAA;AAAA,IACF;AAAA,IACA,SAAS;AAAA,EACX;AACF;AAEA,IAAO,sCAAQ;","names":[]}
@@ -3,6 +3,8 @@ export type VoiceRecordingUploadState = "pending" | "syncing" | "retrying" | "co
3
3
  export type VoiceRecordingTranscriptionState = "pending" | "transcribing" | "retrying" | "complete";
4
4
  export type VoiceRecordingFinalizationState = "pending" | "transcript-ready" | "handed-off";
5
5
  export type VoiceRecordingChunkUploadState = "pending" | "syncing" | "complete";
6
+ export type VoiceRecordingRecoveryMode = "automatic" | "manual";
7
+ export type VoiceRecordingHandoffMode = "append" | "explicit";
6
8
  export type VoiceRecordingManifest = {
7
9
  version: 1;
8
10
  recordingId: string;
@@ -15,6 +17,10 @@ export type VoiceRecordingManifest = {
15
17
  uploadState: VoiceRecordingUploadState;
16
18
  transcriptionState: VoiceRecordingTranscriptionState;
17
19
  finalizationState: VoiceRecordingFinalizationState;
20
+ /** Whether safe server reconciliation should continue without another user action. */
21
+ recoveryMode: VoiceRecordingRecoveryMode;
22
+ /** Delayed/recovered results require explicit insertion instead of mutating an uncertain draft. */
23
+ handoffMode: VoiceRecordingHandoffMode;
18
24
  /** Tab/process lease. A different owner may take over only after this heartbeat is stale. */
19
25
  ownerId: string | null;
20
26
  ownerHeartbeatAt: string | null;
@@ -63,7 +69,7 @@ export interface VoiceRecordingStore {
63
69
  claimManifest(recordingId: string, ownerId: string, claimedAt: string, staleBefore: string): Promise<VoiceRecordingManifest>;
64
70
  listChunks(recordingId: string): Promise<VoiceRecordingChunk[]>;
65
71
  persistChunk(input: PersistVoiceRecordingChunkInput): Promise<PersistVoiceRecordingChunkResult>;
66
- updateManifest(recordingId: string, update: Partial<Pick<VoiceRecordingManifest, "captureState" | "uploadState" | "transcriptionState" | "finalizationState" | "ownerId" | "ownerHeartbeatAt" | "transcriptText">>, updatedAt: string, ownerId?: string | undefined): Promise<VoiceRecordingManifest>;
72
+ updateManifest(recordingId: string, update: Partial<Pick<VoiceRecordingManifest, "captureState" | "uploadState" | "transcriptionState" | "finalizationState" | "ownerId" | "ownerHeartbeatAt" | "transcriptText" | "recoveryMode" | "handoffMode">>, updatedAt: string, ownerId?: string | undefined): Promise<VoiceRecordingManifest>;
67
73
  discard(recordingId: string, ownerId?: string | undefined): Promise<void>;
68
74
  cleanupHandedOffManifests(ownership: {
69
75
  ownerId: string;
@@ -114,7 +120,7 @@ export declare class IndexedDbVoiceRecordingStore implements VoiceRecordingStore
114
120
  claimManifest(recordingId: string, ownerId: string, claimedAt: string, staleBefore: string): Promise<VoiceRecordingManifest>;
115
121
  listChunks(recordingId: string): Promise<VoiceRecordingChunk[]>;
116
122
  persistChunk(input: PersistVoiceRecordingChunkInput): Promise<PersistVoiceRecordingChunkResult>;
117
- updateManifest(recordingId: string, update: Partial<Pick<VoiceRecordingManifest, "captureState" | "uploadState" | "transcriptionState" | "finalizationState" | "ownerId" | "ownerHeartbeatAt" | "transcriptText">>, updatedAt: string, ownerId?: string | undefined): Promise<VoiceRecordingManifest>;
123
+ updateManifest(recordingId: string, update: Partial<Pick<VoiceRecordingManifest, "captureState" | "uploadState" | "transcriptionState" | "finalizationState" | "ownerId" | "ownerHeartbeatAt" | "transcriptText" | "recoveryMode" | "handoffMode">>, updatedAt: string, ownerId?: string | undefined): Promise<VoiceRecordingManifest>;
118
124
  discard(recordingId: string, ownerId?: string | undefined): Promise<void>;
119
125
  cleanupHandedOffManifests(ownership: {
120
126
  ownerId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/react",
3
- "version": "0.46.1",
3
+ "version": "0.52.1",
4
4
  "description": "React hooks and styled components for OpenGeni: live session streaming, chat composer, message timeline, session status, and fleet views — token-themed (CSS variables), dark-first, built on Tailwind v4 + Radix + Motion.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -14,7 +14,9 @@
14
14
  "styles"
15
15
  ],
16
16
  "type": "module",
17
- "sideEffects": false,
17
+ "sideEffects": [
18
+ "**/*.css"
19
+ ],
18
20
  "main": "./dist/index.js",
19
21
  "module": "./dist/index.js",
20
22
  "types": "./dist/index.d.ts",
@@ -41,19 +43,56 @@
41
43
  },
42
44
  "./model-policy": {
43
45
  "types": "./dist/model-policy.d.ts",
44
- "import": "./dist/model-policy.js"
46
+ "import": "./dist/model-policy.js",
47
+ "default": "./dist/model-policy.js"
45
48
  },
46
49
  "./realtime": {
47
50
  "types": "./dist/realtime.d.ts",
48
51
  "import": "./dist/realtime.js"
49
52
  },
53
+ "./artifacts": {
54
+ "types": "./dist/artifacts.d.ts",
55
+ "import": "./dist/artifacts.js"
56
+ },
57
+ "./artifacts/spreadsheet": {
58
+ "types": "./dist/artifacts-spreadsheet.d.ts",
59
+ "import": "./dist/artifacts-spreadsheet.js"
60
+ },
61
+ "./artifacts/document": {
62
+ "types": "./dist/artifacts-document.d.ts",
63
+ "import": "./dist/artifacts-document.js"
64
+ },
65
+ "./artifacts/presentation": {
66
+ "types": "./dist/artifacts-presentation.d.ts",
67
+ "import": "./dist/artifacts-presentation.js"
68
+ },
69
+ "./interaction": {
70
+ "types": "./dist/interaction.d.ts",
71
+ "import": "./dist/interaction.js"
72
+ },
73
+ "./clipboard": {
74
+ "types": "./dist/clipboard.d.ts",
75
+ "import": "./dist/clipboard.js"
76
+ },
50
77
  "./styles.css": {
51
78
  "types": "./styles/index.d.ts",
52
- "import": "./styles/index.css"
79
+ "style": "./styles/index.css",
80
+ "default": "./styles/index.css"
81
+ },
82
+ "./compiled.css": {
83
+ "types": "./styles/compiled.d.ts",
84
+ "style": "./styles/compiled.css",
85
+ "default": "./styles/compiled.css"
86
+ },
87
+ "./responsive.css": {
88
+ "types": "./styles/responsive.d.ts",
89
+ "style": "./styles/responsive.css",
90
+ "default": "./styles/responsive.css"
53
91
  },
54
92
  "./tokens.css": {
55
93
  "types": "./styles/tokens.d.ts",
56
- "import": "./styles/tokens.css"
94
+ "style": "./styles/tokens.css",
95
+ "default": "./styles/tokens.css"
57
96
  }
58
97
  },
59
98
  "publishConfig": {
@@ -62,7 +101,9 @@
62
101
  },
63
102
  "scripts": {
64
103
  "typecheck": "tsc --noEmit",
65
- "build": "bun ../../scripts/build-typescript-package.ts",
104
+ "build": "bun run build:css && bun ../../scripts/build-typescript-package.ts",
105
+ "build:css": "bun scripts/build-compiled-css.ts",
106
+ "check:css": "bun scripts/build-compiled-css.ts --check",
66
107
  "demo": "vite dev demo --port 3100",
67
108
  "demo:build": "vite build demo",
68
109
  "demo:build:deployed": "OPENGENI_REACT_DEMO_BASE=/react-demo/ OPENGENI_REACT_DEMO_OUT_DIR=../../../apps/web/dist/react-demo vite build demo",
@@ -75,7 +116,7 @@
75
116
  "@dnd-kit/utilities": "3.2.2",
76
117
  "@fontsource-variable/noto-sans-arabic": "5.2.10",
77
118
  "@fontsource-variable/noto-sans-jp": "5.2.10",
78
- "@opengeni/sdk": "^0.46.0",
119
+ "@opengeni/sdk": "^0.52.1",
79
120
  "clsx": "^2.1.1",
80
121
  "lucide-react": "^1.8.0",
81
122
  "motion": "^12.0.0",
@@ -94,6 +135,7 @@
94
135
  "@codemirror/lang-markdown": "^6.0.0",
95
136
  "@codemirror/lang-python": "^6.0.0",
96
137
  "@novnc/novnc": "^1.7.0",
138
+ "@opengeni/artifact-tool": ">=0.1.0 <0.3.0",
97
139
  "@pierre/diffs": "^1.2.11",
98
140
  "@uiw/react-codemirror": "^4.23.0",
99
141
  "@xterm/addon-fit": "^0.11.0",
@@ -125,6 +167,9 @@
125
167
  "@novnc/novnc": {
126
168
  "optional": true
127
169
  },
170
+ "@opengeni/artifact-tool": {
171
+ "optional": true
172
+ },
128
173
  "@pierre/diffs": {
129
174
  "optional": true
130
175
  },
@@ -0,0 +1,31 @@
1
+ /** Document-only artifact surface. Import from `@opengeni/react/artifacts/document`. */
2
+ export {
3
+ EditableDocumentArtifactSurface,
4
+ type EditableDocumentArtifactSurfaceProps,
5
+ } from "./components/artifacts/editable-document";
6
+ export {
7
+ DocumentArtifactSurface,
8
+ DocumentEditor,
9
+ DocumentProjectionArtifactSurface,
10
+ DocumentProjectionEditor,
11
+ type DocumentArtifactSurfaceProps,
12
+ type DocumentCommit,
13
+ type DocumentCommitHandler,
14
+ type DocumentEditorProps,
15
+ type DocumentEditorProjection,
16
+ type DocumentLayoutMode,
17
+ type DocumentProjectionArtifactSurfaceProps,
18
+ type DocumentProjectionBlock,
19
+ type DocumentProjectionChange,
20
+ type DocumentProjectionComment,
21
+ type DocumentProjectionEditorProps,
22
+ type DocumentProjectionPageBreak,
23
+ type DocumentProjectionPageGeometry,
24
+ type DocumentProjectionParagraph,
25
+ type DocumentProjectionParagraphStyle,
26
+ type DocumentProjectionSection,
27
+ type DocumentProjectionTable,
28
+ type DocumentProjectionTextRun,
29
+ type DocumentProjectionTextStyle,
30
+ type DocumentSelection,
31
+ } from "./components/artifacts/document-editor";
@@ -0,0 +1,36 @@
1
+ /** Presentation-only artifact surface. Import from `@opengeni/react/artifacts/presentation`. */
2
+ export {
3
+ EditablePresentationArtifactSurface,
4
+ type EditablePresentationArtifactSurfaceProps,
5
+ } from "./components/artifacts/editable-presentation";
6
+ export {
7
+ PresentationArtifactSurface,
8
+ PresentationEditor,
9
+ PresentationProjectionArtifactSurface,
10
+ PresentationProjectionEditor,
11
+ type PresentationArtifactSurfaceProps,
12
+ type PresentationCommit,
13
+ type PresentationCommitHandler,
14
+ type PresentationEditorProps,
15
+ type PresentationEditorProjection,
16
+ type PresentationProjectionArtifactSurfaceProps,
17
+ type PresentationProjectionChart,
18
+ type PresentationProjectionChartSeries,
19
+ type PresentationProjectionConnector,
20
+ type PresentationProjectionEditorProps,
21
+ type PresentationProjectionElementMetadata,
22
+ type PresentationProjectionElement,
23
+ type PresentationProjectionFill,
24
+ type PresentationProjectionGroup,
25
+ type PresentationProjectionImage,
26
+ type PresentationProjectionLine,
27
+ type PresentationProjectionPosition,
28
+ type PresentationProjectionRichText,
29
+ type PresentationProjectionShape,
30
+ type PresentationProjectionTable,
31
+ type PresentationProjectionTableCell,
32
+ type PresentationProjectionTextParagraph,
33
+ type PresentationProjectionTextRun,
34
+ type PresentationProjectionTextStyle,
35
+ type PresentationSlideProjection,
36
+ } from "./components/artifacts/presentation-editor";
@@ -0,0 +1,21 @@
1
+ /** Spreadsheet-only artifact surface. Import from `@opengeni/react/artifacts/spreadsheet`. */
2
+ export {
3
+ SpreadsheetArtifactSurface,
4
+ SpreadsheetGrid,
5
+ SpreadsheetProjectionGrid,
6
+ type SpreadsheetArtifactSurfaceProps,
7
+ type SpreadsheetCommit,
8
+ type SpreadsheetRangeCommit,
9
+ type SpreadsheetGridProps,
10
+ type SpreadsheetGridProjection,
11
+ type SpreadsheetProjectionCell,
12
+ type SpreadsheetProjectionGridProps,
13
+ type SpreadsheetSelection,
14
+ type SpreadsheetViewport,
15
+ } from "./components/artifacts/spreadsheet-grid";
16
+ export {
17
+ EditableSpreadsheetArtifactSurface,
18
+ EditableSpreadsheetGrid,
19
+ type EditableSpreadsheetArtifactSurfaceProps,
20
+ type EditableSpreadsheetGridProps,
21
+ } from "./components/artifacts/editable-spreadsheet";
@@ -0,0 +1,86 @@
1
+ /** Public artifact surfaces. Import from `@opengeni/react/artifacts`. */
2
+ export {
3
+ ArtifactSurface,
4
+ DocumentArtifactSurface,
5
+ DocumentEditor,
6
+ DocumentProjectionArtifactSurface,
7
+ DocumentProjectionEditor,
8
+ BrowserEditableArtifactWorkbench,
9
+ EditableDocumentArtifactSurface,
10
+ EditableArtifactWorkbench,
11
+ EditableArtifactWorkbenchHost,
12
+ EditablePresentationArtifactSurface,
13
+ EditableSpreadsheetArtifactSurface,
14
+ EditableSpreadsheetGrid,
15
+ PresentationArtifactSurface,
16
+ PresentationEditor,
17
+ PresentationProjectionArtifactSurface,
18
+ PresentationProjectionEditor,
19
+ SpreadsheetArtifactSurface,
20
+ SpreadsheetGrid,
21
+ SpreadsheetProjectionGrid,
22
+ type ArtifactModality,
23
+ type ArtifactSurfaceProps,
24
+ type DocumentArtifactSurfaceProps,
25
+ type DocumentCommit,
26
+ type DocumentCommitHandler,
27
+ type DocumentEditorProps,
28
+ type DocumentEditorProjection,
29
+ type DocumentLayoutMode,
30
+ type DocumentProjectionArtifactSurfaceProps,
31
+ type DocumentProjectionBlock,
32
+ type DocumentProjectionChange,
33
+ type DocumentProjectionComment,
34
+ type DocumentProjectionEditorProps,
35
+ type DocumentProjectionPageBreak,
36
+ type DocumentProjectionPageGeometry,
37
+ type DocumentProjectionParagraph,
38
+ type DocumentProjectionParagraphStyle,
39
+ type DocumentProjectionSection,
40
+ type DocumentProjectionTable,
41
+ type DocumentProjectionTextRun,
42
+ type DocumentProjectionTextStyle,
43
+ type DocumentSelection,
44
+ type BrowserEditableArtifactWorkbenchOptions,
45
+ type BrowserEditableArtifactWorkbenchProps,
46
+ type EditableDocumentArtifactSurfaceProps,
47
+ type EditableArtifactWorkbenchHostProps,
48
+ type EditableArtifactWorkbenchProps,
49
+ type EditablePresentationArtifactSurfaceProps,
50
+ type EditableSpreadsheetArtifactSurfaceProps,
51
+ type EditableSpreadsheetGridProps,
52
+ type PresentationArtifactSurfaceProps,
53
+ type PresentationCommit,
54
+ type PresentationCommitHandler,
55
+ type PresentationEditorProps,
56
+ type PresentationEditorProjection,
57
+ type PresentationProjectionArtifactSurfaceProps,
58
+ type PresentationProjectionChart,
59
+ type PresentationProjectionChartSeries,
60
+ type PresentationProjectionConnector,
61
+ type PresentationProjectionEditorProps,
62
+ type PresentationProjectionElementMetadata,
63
+ type PresentationProjectionElement,
64
+ type PresentationProjectionFill,
65
+ type PresentationProjectionGroup,
66
+ type PresentationProjectionImage,
67
+ type PresentationProjectionLine,
68
+ type PresentationProjectionPosition,
69
+ type PresentationProjectionRichText,
70
+ type PresentationProjectionShape,
71
+ type PresentationProjectionTable,
72
+ type PresentationProjectionTableCell,
73
+ type PresentationProjectionTextParagraph,
74
+ type PresentationProjectionTextRun,
75
+ type PresentationProjectionTextStyle,
76
+ type PresentationSlideProjection,
77
+ type SpreadsheetArtifactSurfaceProps,
78
+ type SpreadsheetCommit,
79
+ type SpreadsheetRangeCommit,
80
+ type SpreadsheetGridProps,
81
+ type SpreadsheetGridProjection,
82
+ type SpreadsheetProjectionCell,
83
+ type SpreadsheetProjectionGridProps,
84
+ type SpreadsheetSelection,
85
+ type SpreadsheetViewport,
86
+ } from "./components/artifacts";