@opengeni/react 7.4.0 → 7.5.0-canary.36919050519001

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 (210) hide show
  1. package/README.md +124 -27
  2. package/dist/artifacts-document.js +3 -2
  3. package/dist/artifacts-presentation.js +3 -2
  4. package/dist/artifacts-spreadsheet.js +2 -2
  5. package/dist/artifacts.d.ts +1 -0
  6. package/dist/artifacts.js +516 -1413
  7. package/dist/artifacts.js.map +1 -1
  8. package/dist/{browser-viewer-2E6R2Y4W.js → browser-viewer-Z7S7QEJL.js} +6 -5
  9. package/dist/chat-interactive-block-UGBTNB3L.js +11 -0
  10. package/dist/{chunk-Y3QTZN2F.js → chunk-2VFNCX4E.js} +6 -6
  11. package/dist/{chunk-UDD6DLLT.js → chunk-3IJJEYW4.js} +15 -3
  12. package/dist/chunk-3IJJEYW4.js.map +1 -0
  13. package/dist/chunk-4RVYOY4O.js +379 -0
  14. package/dist/chunk-4RVYOY4O.js.map +1 -0
  15. package/dist/chunk-5CVXZA3Y.js +292 -0
  16. package/dist/chunk-5CVXZA3Y.js.map +1 -0
  17. package/dist/{chunk-5YK2ZDIG.js → chunk-5J4FOW6Q.js} +2 -10
  18. package/dist/chunk-5J4FOW6Q.js.map +1 -0
  19. package/dist/{chunk-KVERXCFY.js → chunk-5KYZIQFY.js} +40 -3
  20. package/dist/chunk-5KYZIQFY.js.map +1 -0
  21. package/dist/{chunk-KNDIXZN6.js → chunk-7UAMYXJY.js} +25 -18
  22. package/dist/{chunk-KNDIXZN6.js.map → chunk-7UAMYXJY.js.map} +1 -1
  23. package/dist/{chunk-SEEVCT36.js → chunk-A4UJB2MM.js} +2 -2
  24. package/dist/{chunk-X4HIN6TV.js → chunk-AFLPWUQ7.js} +71 -162
  25. package/dist/chunk-AFLPWUQ7.js.map +1 -0
  26. package/dist/chunk-B3V6TG77.js +41 -0
  27. package/dist/chunk-B3V6TG77.js.map +1 -0
  28. package/dist/{chunk-XEJEOAOV.js → chunk-B7WMS3CS.js} +51 -40
  29. package/dist/chunk-B7WMS3CS.js.map +1 -0
  30. package/dist/{chunk-S5JQ4R22.js → chunk-BDKR6BAR.js} +54 -24
  31. package/dist/chunk-BDKR6BAR.js.map +1 -0
  32. package/dist/{chunk-4MDLEHXL.js → chunk-DYWBUX5Q.js} +24 -12
  33. package/dist/chunk-DYWBUX5Q.js.map +1 -0
  34. package/dist/{chunk-YZ3YYMOM.js → chunk-E3G7SAYZ.js} +252 -624
  35. package/dist/chunk-E3G7SAYZ.js.map +1 -0
  36. package/dist/chunk-JT4JW7BC.js +54 -0
  37. package/dist/chunk-JT4JW7BC.js.map +1 -0
  38. package/dist/{chunk-5AZSK6MV.js → chunk-LWNLETQT.js} +5 -5
  39. package/dist/{chunk-USXVQACU.js → chunk-M7LBYP63.js} +5 -4
  40. package/dist/{chunk-USXVQACU.js.map → chunk-M7LBYP63.js.map} +1 -1
  41. package/dist/{chunk-L4OSXQ6H.js → chunk-NBOHNRLJ.js} +1289 -1060
  42. package/dist/chunk-NBOHNRLJ.js.map +1 -0
  43. package/dist/chunk-RHREZ7BO.js +11 -0
  44. package/dist/chunk-RHREZ7BO.js.map +1 -0
  45. package/dist/chunk-SCOTPE2I.js +589 -0
  46. package/dist/chunk-SCOTPE2I.js.map +1 -0
  47. package/dist/chunk-WEHMPOXK.js +39 -0
  48. package/dist/chunk-WEHMPOXK.js.map +1 -0
  49. package/dist/chunk-WRHIZYZF.js +988 -0
  50. package/dist/chunk-WRHIZYZF.js.map +1 -0
  51. package/dist/{chunk-3E2AITTZ.js → chunk-WUISZ3WU.js} +32 -28
  52. package/dist/{chunk-3E2AITTZ.js.map → chunk-WUISZ3WU.js.map} +1 -1
  53. package/dist/chunk-XCHWDJ22.js +107 -0
  54. package/dist/chunk-XCHWDJ22.js.map +1 -0
  55. package/dist/{chunk-DUEBTL3N.js → chunk-Y2PRMYLC.js} +4 -3
  56. package/dist/{chunk-DUEBTL3N.js.map → chunk-Y2PRMYLC.js.map} +1 -1
  57. package/dist/chunk-YBXQDQFX.js +1772 -0
  58. package/dist/chunk-YBXQDQFX.js.map +1 -0
  59. package/dist/chunk-YV4L3ILF.js +9 -0
  60. package/dist/chunk-YV4L3ILF.js.map +1 -0
  61. package/dist/{chunk-V2ABIVYJ.js → chunk-ZXSEDZP7.js} +70 -6
  62. package/dist/chunk-ZXSEDZP7.js.map +1 -0
  63. package/dist/components/artifacts/artifact-chrome.d.ts +120 -0
  64. package/dist/components/artifacts/artifact-sandbox.d.ts +27 -0
  65. package/dist/components/artifacts/chat-interactive-block.d.ts +29 -0
  66. package/dist/components/artifacts/deferred-chat-media.d.ts +15 -0
  67. package/dist/components/artifacts/editable-artifact-ui.d.ts +2 -1
  68. package/dist/components/artifacts/editable-artifact-view.d.ts +46 -0
  69. package/dist/components/artifacts/index.d.ts +7 -0
  70. package/dist/components/artifacts/latest-task-runner.d.ts +15 -0
  71. package/dist/components/artifacts/session-artifact-viewer.d.ts +39 -0
  72. package/dist/components/artifacts/site-view.d.ts +23 -0
  73. package/dist/components/browser-select-control.d.ts +3 -1
  74. package/dist/components/code-editor.d.ts +1 -4
  75. package/dist/components/desktop-viewer.d.ts +1 -1
  76. package/dist/components/message-timeline.d.ts +20 -3
  77. package/dist/components/open-geni-links.d.ts +16 -0
  78. package/dist/components/session-conversation.d.ts +20 -1
  79. package/dist/components/timeline-pill-geometry.d.ts +8 -0
  80. package/dist/components/timeline-pill-placement.d.ts +24 -0
  81. package/dist/components/usage-limit-notice.d.ts +49 -0
  82. package/dist/components/usage-member-list.d.ts +91 -0
  83. package/dist/components/usage-meter.d.ts +73 -0
  84. package/dist/composer.js +5 -5
  85. package/dist/{computer-viewer-WMJE6OA3.js → computer-viewer-KJWLH3GI.js} +7 -5
  86. package/dist/connect.js +7 -6
  87. package/dist/connect.js.map +1 -1
  88. package/dist/conversation-timeline.d.ts +1 -1
  89. package/dist/desktop.d.ts +7 -0
  90. package/dist/desktop.js +26 -0
  91. package/dist/desktop.js.map +1 -0
  92. package/dist/editor.d.ts +7 -0
  93. package/dist/editor.js +21 -0
  94. package/dist/editor.js.map +1 -0
  95. package/dist/hooks/latest-question.d.ts +1 -1
  96. package/dist/hooks/use-composer.d.ts +4 -0
  97. package/dist/hooks/use-desktop-stream.d.ts +1 -1
  98. package/dist/hooks/use-usage.d.ts +40 -0
  99. package/dist/index.d.ts +7 -2
  100. package/dist/index.js +460 -1386
  101. package/dist/index.js.map +1 -1
  102. package/dist/interaction.js +8 -6
  103. package/dist/interaction.js.map +1 -1
  104. package/dist/{latest-question-QB4EUCW5.js → latest-question-IS445HOW.js} +3 -3
  105. package/dist/lib/format.d.ts +6 -1
  106. package/dist/lib/workbench-peers.d.ts +36 -0
  107. package/dist/machines.js +2 -2
  108. package/dist/{markdown-table-layout-PFUEZ2U4.js → markdown-table-layout-QXSLK4BY.js} +37 -5
  109. package/dist/markdown-table-layout-QXSLK4BY.js.map +1 -0
  110. package/dist/{queue-surface-implementation-IM2HD3SK.js → queue-surface-implementation-2CAQAIHM.js} +2 -2
  111. package/dist/realtime.js +3 -3
  112. package/dist/{sandbox-files-PXPIZAFG.js → sandbox-files-AEJTWGT4.js} +8 -5
  113. package/dist/sandbox-files-AEJTWGT4.js.map +1 -0
  114. package/dist/session-ui.d.ts +9 -2
  115. package/dist/session-ui.js +39 -20
  116. package/dist/session-ui.js.map +1 -1
  117. package/dist/session.js +4 -4
  118. package/dist/sites.js +4 -289
  119. package/dist/sites.js.map +1 -1
  120. package/dist/terminal.d.ts +8 -0
  121. package/dist/terminal.js +31 -0
  122. package/dist/terminal.js.map +1 -0
  123. package/dist/timeline/allowance-exhausted-row.d.ts +24 -0
  124. package/dist/timeline/genie-loading.d.ts +3 -1
  125. package/dist/timeline/types.d.ts +8 -1
  126. package/dist/{timeline-annotation-selection-ODLVF4OI.js → timeline-annotation-selection-DMLMM2TX.js} +6 -1
  127. package/dist/timeline-annotation-selection-DMLMM2TX.js.map +1 -0
  128. package/dist/timeline-pill-geometry-Z23V243M.js +110 -0
  129. package/dist/timeline-pill-geometry-Z23V243M.js.map +1 -0
  130. package/dist/usage/allowance-copy.d.ts +25 -0
  131. package/dist/usage/summary.d.ts +35 -0
  132. package/dist/usage.d.ts +13 -0
  133. package/dist/usage.js +1073 -0
  134. package/dist/usage.js.map +1 -0
  135. package/package.json +19 -3
  136. package/src/artifacts.ts +37 -0
  137. package/src/components/artifacts/artifact-chrome.tsx +413 -0
  138. package/src/components/artifacts/artifact-sandbox.tsx +185 -0
  139. package/src/components/artifacts/chat-interactive-block.tsx +260 -0
  140. package/src/components/artifacts/deferred-chat-media.tsx +67 -0
  141. package/src/components/artifacts/editable-artifact-ui.tsx +3 -1
  142. package/src/components/artifacts/editable-artifact-view.tsx +187 -0
  143. package/src/components/artifacts/editable-artifact-workbench.tsx +5 -2
  144. package/src/components/artifacts/editable-document.tsx +34 -36
  145. package/src/components/artifacts/editable-presentation.tsx +21 -16
  146. package/src/components/artifacts/index.ts +41 -0
  147. package/src/components/artifacts/latest-task-runner.ts +49 -0
  148. package/src/components/artifacts/session-artifact-viewer.tsx +376 -0
  149. package/src/components/artifacts/site-view.tsx +116 -0
  150. package/src/components/browser-select-control.tsx +4 -1
  151. package/src/components/browser-viewer.tsx +81 -22
  152. package/src/components/code-editor.tsx +13 -16
  153. package/src/components/computer-viewer.tsx +51 -23
  154. package/src/components/desktop-viewer.tsx +1 -1
  155. package/src/components/markdown-table-layout.ts +49 -5
  156. package/src/components/markdown.tsx +5 -2
  157. package/src/components/message-timeline.tsx +557 -516
  158. package/src/components/open-geni-links.tsx +24 -0
  159. package/src/components/sandbox-terminal.tsx +48 -11
  160. package/src/components/session-chrome.tsx +22 -3
  161. package/src/components/session-conversation.tsx +195 -102
  162. package/src/components/timeline-annotation-selection.tsx +7 -0
  163. package/src/components/timeline-pill-geometry.ts +169 -0
  164. package/src/components/timeline-pill-placement.ts +99 -0
  165. package/src/components/usage-limit-notice.tsx +179 -0
  166. package/src/components/usage-member-list.tsx +792 -0
  167. package/src/components/usage-meter.tsx +382 -0
  168. package/src/conversation-timeline.ts +10 -2
  169. package/src/desktop.ts +24 -0
  170. package/src/editor.ts +13 -0
  171. package/src/hooks/use-available-models.ts +1 -1
  172. package/src/hooks/use-composer.ts +57 -2
  173. package/src/hooks/use-desktop-stream.ts +19 -28
  174. package/src/hooks/use-usage.ts +100 -0
  175. package/src/index.ts +22 -0
  176. package/src/lib/format.ts +32 -6
  177. package/src/lib/workbench-peers.ts +62 -0
  178. package/src/session-ui.ts +22 -0
  179. package/src/terminal.ts +26 -0
  180. package/src/timeline/activity-rail.tsx +5 -3
  181. package/src/timeline/allowance-exhausted-row.tsx +86 -0
  182. package/src/timeline/genie-loading.tsx +16 -6
  183. package/src/timeline/projection.ts +78 -4
  184. package/src/timeline/types.ts +8 -0
  185. package/src/usage/allowance-copy.ts +64 -0
  186. package/src/usage/summary.ts +93 -0
  187. package/src/usage.ts +50 -0
  188. package/styles/compiled.css +325 -0
  189. package/dist/chunk-4MDLEHXL.js.map +0 -1
  190. package/dist/chunk-5YK2ZDIG.js.map +0 -1
  191. package/dist/chunk-KVERXCFY.js.map +0 -1
  192. package/dist/chunk-L4OSXQ6H.js.map +0 -1
  193. package/dist/chunk-S5JQ4R22.js.map +0 -1
  194. package/dist/chunk-UDD6DLLT.js.map +0 -1
  195. package/dist/chunk-UGMKPUEM.js +0 -299
  196. package/dist/chunk-UGMKPUEM.js.map +0 -1
  197. package/dist/chunk-V2ABIVYJ.js.map +0 -1
  198. package/dist/chunk-X4HIN6TV.js.map +0 -1
  199. package/dist/chunk-XEJEOAOV.js.map +0 -1
  200. package/dist/chunk-YZ3YYMOM.js.map +0 -1
  201. package/dist/markdown-table-layout-PFUEZ2U4.js.map +0 -1
  202. package/dist/timeline-annotation-selection-ODLVF4OI.js.map +0 -1
  203. /package/dist/{browser-viewer-2E6R2Y4W.js.map → browser-viewer-Z7S7QEJL.js.map} +0 -0
  204. /package/dist/{computer-viewer-WMJE6OA3.js.map → chat-interactive-block-UGBTNB3L.js.map} +0 -0
  205. /package/dist/{chunk-Y3QTZN2F.js.map → chunk-2VFNCX4E.js.map} +0 -0
  206. /package/dist/{chunk-SEEVCT36.js.map → chunk-A4UJB2MM.js.map} +0 -0
  207. /package/dist/{chunk-5AZSK6MV.js.map → chunk-LWNLETQT.js.map} +0 -0
  208. /package/dist/{sandbox-files-PXPIZAFG.js.map → computer-viewer-KJWLH3GI.js.map} +0 -0
  209. /package/dist/{latest-question-QB4EUCW5.js.map → latest-question-IS445HOW.js.map} +0 -0
  210. /package/dist/{queue-surface-implementation-IM2HD3SK.js.map → queue-surface-implementation-2CAQAIHM.js.map} +0 -0
@@ -5,9 +5,12 @@ import {
5
5
  useInteractionInterventions,
6
6
  useInteractionInvalidation
7
7
  } from "./chunk-YSMMDOOE.js";
8
+ import {
9
+ copyTextToClipboard
10
+ } from "./chunk-JVYQRRC4.js";
8
11
  import {
9
12
  DesktopViewer
10
- } from "./chunk-4MDLEHXL.js";
13
+ } from "./chunk-DYWBUX5Q.js";
11
14
  import {
12
15
  STREAM_CLOSE_REASON_NORMAL,
13
16
  STREAM_KIND_COMPUTER,
@@ -16,7 +19,7 @@ import {
16
19
  decodeStreamOpenAck,
17
20
  encodeStreamClose,
18
21
  encodeStreamOpen
19
- } from "./chunk-5YK2ZDIG.js";
22
+ } from "./chunk-5J4FOW6Q.js";
20
23
  import {
21
24
  usePageLiveActivity
22
25
  } from "./chunk-KZ73RL76.js";
@@ -26,9 +29,6 @@ import {
26
29
  import {
27
30
  cn
28
31
  } from "./chunk-22KP6LR5.js";
29
- import {
30
- copyTextToClipboard
31
- } from "./chunk-JVYQRRC4.js";
32
32
 
33
33
  // src/components/computer-viewer.tsx
34
34
  import { interactionControlFailureFromError } from "@opengeni/sdk/interaction";
@@ -1083,13 +1083,15 @@ function ComputerViewer({
1083
1083
  });
1084
1084
  const displayedFrame = frames.frame && frames.frame.computerSessionId === selection?.sessionId && frames.frame.targetId === computer.selectedTarget?.id && frames.frame.targetGeneration === computer.selectedTarget?.targetGeneration ? frames.frame : null;
1085
1085
  const rfbStream = frames.attachment?.stream.kind === "direct_rfb" ? frames.attachment.stream : null;
1086
+ const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
1087
+ const rfbInputEnabled = !machineLocked && computer.session?.capabilities?.pointerInput === true && computer.session?.capabilities?.keyboardInput === true;
1086
1088
  const rfbCapability = useMemo2(() => {
1087
1089
  if (!rfbStream || !frames.attachment) return null;
1088
1090
  const bounds = computer.selectedTarget?.bounds;
1089
1091
  return {
1090
1092
  transport: "vnc-ws",
1091
1093
  client: "novnc",
1092
- mode: "interactive",
1094
+ mode: rfbInputEnabled ? "interactive" : "read-only",
1093
1095
  url: rfbStream.url,
1094
1096
  token: null,
1095
1097
  expiresAt: frames.attachment.expiresAt,
@@ -1101,8 +1103,7 @@ function ComputerViewer({
1101
1103
  sharedSessionIds: [],
1102
1104
  reason: null
1103
1105
  };
1104
- }, [computer.selectedTarget?.bounds, frames.attachment, rfbStream]);
1105
- const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
1106
+ }, [computer.selectedTarget?.bounds, frames.attachment, rfbInputEnabled, rfbStream]);
1106
1107
  const currentIds = useMemo2(() => new Set(relevant.map((session) => session.id)), [relevant]);
1107
1108
  useEffect4(() => {
1108
1109
  for (const intervention of interventions.interventions) {
@@ -1206,7 +1207,8 @@ function ComputerViewer({
1206
1207
  );
1207
1208
  const copyFromRfb = useCallback4(
1208
1209
  (event) => {
1209
- if (!rfbStream || computer.session?.capabilities?.clipboard !== true) return;
1210
+ if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
1211
+ return;
1210
1212
  event.preventDefault();
1211
1213
  event.stopPropagation();
1212
1214
  void perform({ type: "clipboard", operation: "copy" }, null).then(() => computer.readClipboard()).then(async (clipboard) => {
@@ -1215,11 +1217,12 @@ function ComputerViewer({
1215
1217
  }
1216
1218
  }).catch((cause) => notifyError(cause, "Could not copy from the desktop."));
1217
1219
  },
1218
- [computer, notifyError, perform, rfbStream]
1220
+ [computer, notifyError, perform, rfbInputEnabled, rfbStream]
1219
1221
  );
1220
1222
  const pasteIntoRfb = useCallback4(
1221
1223
  (text) => {
1222
- if (!rfbStream || computer.session?.capabilities?.clipboard !== true) return false;
1224
+ if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
1225
+ return false;
1223
1226
  void (async () => {
1224
1227
  await perform({ type: "clipboard", operation: "write", text }, null);
1225
1228
  assertExactComputerClipboard(await computer.readClipboard(), text);
@@ -1227,7 +1230,7 @@ function ComputerViewer({
1227
1230
  })().catch((cause) => notifyError(cause, "Could not paste into the desktop."));
1228
1231
  return true;
1229
1232
  },
1230
- [computer, notifyError, perform, rfbStream]
1233
+ [computer, notifyError, perform, rfbInputEnabled, rfbStream]
1231
1234
  );
1232
1235
  const hideGenericCreate = suppressGenericCreate && liveRelevant.length === 0;
1233
1236
  const generationLossSelected = selectedRegistrySession !== null && isAttachedChromeGenerationLoss(selectedRegistrySession);
@@ -1333,18 +1336,21 @@ function ComputerViewer({
1333
1336
  }
1334
1337
  ),
1335
1338
  /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1", children: [
1336
- rfbStream ? /* @__PURE__ */ jsx("div", { className: "relative min-h-0 flex-1 bg-black", onCopyCapture: copyFromRfb, children: /* @__PURE__ */ jsx(
1337
- DesktopViewer,
1338
- {
1339
- capability: rfbCapability,
1340
- interactive: true,
1341
- showControlToggle: false,
1342
- webSocketProtocols: rfbStream.protocols,
1343
- onPasteText: pasteIntoRfb,
1344
- targetPlatform: computer.session?.platform ?? null,
1345
- className: "h-full"
1346
- }
1347
- ) }) : /* @__PURE__ */ jsx(
1339
+ rfbStream ? /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 bg-black", onCopyCapture: copyFromRfb, children: [
1340
+ /* @__PURE__ */ jsx(
1341
+ DesktopViewer,
1342
+ {
1343
+ capability: rfbCapability,
1344
+ interactive: rfbInputEnabled,
1345
+ showControlToggle: false,
1346
+ webSocketProtocols: rfbStream.protocols,
1347
+ onPasteText: pasteIntoRfb,
1348
+ targetPlatform: computer.session?.platform ?? null,
1349
+ className: "h-full"
1350
+ }
1351
+ ),
1352
+ !rfbInputEnabled ? /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full border border-white/10 bg-black/70 px-3 py-1 text-[11px] text-white/80 backdrop-blur", children: "View only \xB7 direct input unavailable" }) : null
1353
+ ] }) : /* @__PURE__ */ jsx(
1348
1354
  ComputerViewport,
1349
1355
  {
1350
1356
  frame: machineLocked ? null : displayedFrame,
@@ -1356,6 +1362,8 @@ function ComputerViewer({
1356
1362
  mutating: computer.mutating,
1357
1363
  backgroundActions: computer.session?.capabilities?.backgroundActions === true,
1358
1364
  clipboardEnabled: computer.session?.capabilities?.clipboard === true,
1365
+ pointerInput: computer.session?.capabilities?.pointerInput === true,
1366
+ keyboardInput: computer.session?.capabilities?.keyboardInput === true,
1359
1367
  onAction: perform,
1360
1368
  onReadClipboard: computer.readClipboard,
1361
1369
  onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : frames.reconnect,
@@ -1642,6 +1650,8 @@ function ComputerViewport(props) {
1642
1650
  lastClickRef.current = null;
1643
1651
  if (inputRef.current) inputRef.current.value = "";
1644
1652
  }, []);
1653
+ const pointerInputEnabled = rawInputEnabled && props.pointerInput;
1654
+ const keyboardInputEnabled = rawInputEnabled && props.keyboardInput;
1645
1655
  const paintQueuedFrames = useCallback4(() => {
1646
1656
  if (decodingFrameRef.current) return;
1647
1657
  decodingFrameRef.current = true;
@@ -1714,11 +1724,11 @@ function ComputerViewport(props) {
1714
1724
  paintQueuedFrames();
1715
1725
  }, [clearBufferedInput, paintQueuedFrames, props.frame]);
1716
1726
  useLayoutEffect(() => {
1717
- if (!rawInputEnabled) {
1727
+ if (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) {
1718
1728
  actionQueueEpochRef.current += 1;
1719
1729
  clearBufferedInput();
1720
1730
  }
1721
- }, [clearBufferedInput, rawInputEnabled]);
1731
+ }, [clearBufferedInput, props.keyboardInput, props.pointerInput, rawInputEnabled]);
1722
1732
  const enqueue = useCallback4(
1723
1733
  (action, frame, after) => {
1724
1734
  const epoch = actionQueueEpochRef.current;
@@ -1788,6 +1798,8 @@ function ComputerViewport(props) {
1788
1798
  const frame = paintedFrameRef.current;
1789
1799
  if (!frame || props.mutating || !rawInputEnabled || event.button !== 0) return;
1790
1800
  event.preventDefault();
1801
+ if (keyboardInputEnabled) inputRef.current?.focus({ preventScroll: true });
1802
+ if (!pointerInputEnabled) return;
1791
1803
  flushPendingWheel();
1792
1804
  flushPendingText();
1793
1805
  pointerStartRef.current = {
@@ -1797,10 +1809,9 @@ function ComputerViewport(props) {
1797
1809
  frame
1798
1810
  };
1799
1811
  event.currentTarget.setPointerCapture?.(event.pointerId);
1800
- inputRef.current?.focus({ preventScroll: true });
1801
1812
  };
1802
1813
  const pointerUp = (event) => {
1803
- if (!rawInputEnabled) return;
1814
+ if (!pointerInputEnabled) return;
1804
1815
  const start = pointerStartRef.current;
1805
1816
  pointerStartRef.current = null;
1806
1817
  if (!start || start.pointerId !== event.pointerId) return;
@@ -1859,7 +1870,7 @@ function ComputerViewport(props) {
1859
1870
  };
1860
1871
  const contextMenu = (event) => {
1861
1872
  event.preventDefault();
1862
- if (!rawInputEnabled) return;
1873
+ if (!pointerInputEnabled) return;
1863
1874
  const frame = paintedFrameRef.current;
1864
1875
  if (!frame) return;
1865
1876
  flushPendingWheel();
@@ -1881,7 +1892,7 @@ function ComputerViewport(props) {
1881
1892
  }
1882
1893
  };
1883
1894
  const wheel = (event) => {
1884
- if (!rawInputEnabled) return;
1895
+ if (!pointerInputEnabled) return;
1885
1896
  const frame = paintedFrameRef.current;
1886
1897
  if (!frame) return;
1887
1898
  const at = point(frame, event.clientX, event.clientY);
@@ -1904,7 +1915,7 @@ function ComputerViewport(props) {
1904
1915
  };
1905
1916
  };
1906
1917
  const keyDown = (event) => {
1907
- if (!rawInputEnabled) return;
1918
+ if (!keyboardInputEnabled) return;
1908
1919
  flushPendingWheel();
1909
1920
  const command = event.metaKey || event.ctrlKey;
1910
1921
  if (props.clipboardEnabled && command && !event.altKey && ["c", "v"].includes(event.key.toLowerCase())) {
@@ -1919,7 +1930,7 @@ function ComputerViewport(props) {
1919
1930
  enqueue({ type: "keyboard", action: "press", value: key }, null);
1920
1931
  };
1921
1932
  const copy = (event) => {
1922
- if (!props.clipboardEnabled || !rawInputEnabled) return;
1933
+ if (!props.clipboardEnabled || !keyboardInputEnabled) return;
1923
1934
  event.preventDefault();
1924
1935
  flushPendingWheel();
1925
1936
  flushPendingText();
@@ -1935,7 +1946,7 @@ function ComputerViewport(props) {
1935
1946
  });
1936
1947
  };
1937
1948
  const paste = (event) => {
1938
- if (!props.clipboardEnabled || !rawInputEnabled) return;
1949
+ if (!props.clipboardEnabled || !keyboardInputEnabled) return;
1939
1950
  event.preventDefault();
1940
1951
  flushPendingWheel();
1941
1952
  flushPendingText();
@@ -1951,7 +1962,7 @@ function ComputerViewport(props) {
1951
1962
  });
1952
1963
  };
1953
1964
  const input = (value) => {
1954
- if (!value || !rawInputEnabled) return;
1965
+ if (!value || !keyboardInputEnabled) return;
1955
1966
  flushPendingWheel();
1956
1967
  flushPendingClick();
1957
1968
  const pending = pendingTextRef.current;
@@ -1976,7 +1987,7 @@ function ComputerViewport(props) {
1976
1987
  className: cn(
1977
1988
  "absolute inset-0 m-auto max-h-full max-w-full touch-none focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-og-accent",
1978
1989
  !showCanvas && "invisible",
1979
- !rawInputEnabled && "cursor-default"
1990
+ !pointerInputEnabled && "cursor-default"
1980
1991
  ),
1981
1992
  onPointerDown: pointerDown,
1982
1993
  onPointerUp: pointerUp,
@@ -2002,7 +2013,7 @@ function ComputerViewport(props) {
2002
2013
  autoCapitalize: "off",
2003
2014
  autoCorrect: "off",
2004
2015
  spellCheck: false,
2005
- disabled: !rawInputEnabled
2016
+ disabled: !keyboardInputEnabled
2006
2017
  }
2007
2018
  ),
2008
2019
  !showCanvas ? /* @__PURE__ */ jsx(
@@ -2020,9 +2031,9 @@ function ComputerViewport(props) {
2020
2031
  /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }),
2021
2032
  " Acting"
2022
2033
  ] }) : null,
2023
- showCanvas && !rawInputEnabled ? /* @__PURE__ */ jsxs("div", { className: "absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-2 rounded-full border border-white/10 bg-black/70 py-1 pl-3 pr-1 text-[11px] text-white/80 backdrop-blur", children: [
2024
- /* @__PURE__ */ jsx("span", { children: "Background view \xB7 use native controls" }),
2025
- props.target ? /* @__PURE__ */ jsx(
2034
+ showCanvas && (!rawInputEnabled || !props.pointerInput || !props.keyboardInput) ? /* @__PURE__ */ jsxs("div", { className: "absolute bottom-3 left-1/2 flex -translate-x-1/2 items-center gap-2 rounded-full border border-white/10 bg-black/70 py-1 pl-3 pr-1 text-[11px] text-white/80 backdrop-blur", children: [
2035
+ /* @__PURE__ */ jsx("span", { children: !rawInputEnabled && (props.pointerInput || props.keyboardInput) ? "Background view \xB7 use native controls" : !props.pointerInput && !props.keyboardInput ? "View only \xB7 mouse and keyboard unavailable" : props.keyboardInput ? "Keyboard only \xB7 mouse unavailable" : "Mouse only \xB7 keyboard unavailable" }),
2036
+ !rawInputEnabled && props.target && (props.pointerInput || props.keyboardInput) ? /* @__PURE__ */ jsx(
2026
2037
  "button",
2027
2038
  {
2028
2039
  type: "button",
@@ -2403,4 +2414,4 @@ export {
2403
2414
  ComputerViewer,
2404
2415
  computerKey
2405
2416
  };
2406
- //# sourceMappingURL=chunk-XEJEOAOV.js.map
2417
+ //# sourceMappingURL=chunk-B7WMS3CS.js.map