@opengeni/react 7.6.1-canary.37073905159001 → 7.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -19
- package/dist/{browser-viewer-63TXMINB.js → browser-viewer-5X47I6T2.js} +5 -6
- package/dist/{chunk-TKB4SB44.js → chunk-45GE35O7.js} +2 -10
- package/dist/chunk-45GE35O7.js.map +1 -0
- package/dist/{chunk-DOJWJQ3F.js → chunk-5EXGU7UF.js} +3 -3
- package/dist/{chunk-YN7I3STW.js → chunk-6NEZPF53.js} +32 -153
- package/dist/chunk-6NEZPF53.js.map +1 -0
- package/dist/{chunk-I7IWRQLN.js → chunk-BI57CQUV.js} +2 -2
- package/dist/{chunk-6ZSWSH4I.js → chunk-CHPKSLPN.js} +1 -3
- package/dist/chunk-CHPKSLPN.js.map +1 -0
- package/dist/{chunk-Q5QBEZIQ.js → chunk-DV2DBNPQ.js} +29 -48
- package/dist/chunk-DV2DBNPQ.js.map +1 -0
- package/dist/{chunk-RDKBXMWX.js → chunk-FGBCYQOT.js} +74 -120
- package/dist/chunk-FGBCYQOT.js.map +1 -0
- package/dist/{chunk-AAG4R3QN.js → chunk-KGENSZKS.js} +3 -4
- package/dist/chunk-KGENSZKS.js.map +1 -0
- package/dist/{chunk-YQEAA6LT.js → chunk-KZ73RL76.js} +3 -7
- package/dist/chunk-KZ73RL76.js.map +1 -0
- package/dist/{chunk-LFXYGZWK.js → chunk-LZ3KHA55.js} +60 -169
- package/dist/chunk-LZ3KHA55.js.map +1 -0
- package/dist/{chunk-2QUSQVF2.js → chunk-UINDK6C3.js} +3 -3
- package/dist/{chunk-UTRTG6LH.js → chunk-UJRYEWZI.js} +8 -48
- package/dist/chunk-UJRYEWZI.js.map +1 -0
- package/dist/{chunk-XOAMRDDK.js → chunk-VGIKFIO2.js} +3 -6
- package/dist/chunk-VGIKFIO2.js.map +1 -0
- package/dist/{chunk-ELCE5SXV.js → chunk-WZ55DVGK.js} +4 -8
- package/dist/chunk-WZ55DVGK.js.map +1 -0
- package/dist/{chunk-IQUCRAT7.js → chunk-XA6R7DJQ.js} +3 -3
- package/dist/{chunk-TOAH2BKA.js → chunk-YCGBREUV.js} +2 -6
- package/dist/{chunk-TOAH2BKA.js.map → chunk-YCGBREUV.js.map} +1 -1
- package/dist/{chunk-HNFCAQ5R.js → chunk-YRYF2GLG.js} +31 -39
- package/dist/chunk-YRYF2GLG.js.map +1 -0
- package/dist/{chunk-GISEVGS6.js → chunk-YSMMDOOE.js} +2 -10
- package/dist/chunk-YSMMDOOE.js.map +1 -0
- package/dist/{chunk-CWWKTNKK.js → chunk-Z3DISEQN.js} +18 -35
- package/dist/chunk-Z3DISEQN.js.map +1 -0
- package/dist/client.d.ts +1 -4
- package/dist/commands/types.d.ts +0 -2
- package/dist/components/approval-surface.d.ts +0 -15
- package/dist/composer.js +7 -8
- package/dist/{computer-viewer-X2MBRZY4.js → computer-viewer-7GF35SNY.js} +4 -5
- package/dist/connect.js +3 -3
- package/dist/hooks/use-browser-session.d.ts +0 -4
- package/dist/hooks/use-composer.d.ts +0 -2
- package/dist/hooks/use-computer-session.d.ts +0 -2
- package/dist/hooks/use-file-attachments.d.ts +0 -2
- package/dist/hooks/use-session-events.d.ts +1 -1
- package/dist/hooks/use-workspace-sessions.d.ts +5 -15
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -28
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +1 -1
- package/dist/interaction.js +5 -6
- package/dist/interaction.js.map +1 -1
- package/dist/{latest-question-CNEZ5KAN.js → latest-question-3BJGKQQ6.js} +3 -3
- package/dist/lib/format.d.ts +3 -27
- package/dist/lib/interaction-errors.d.ts +0 -3
- package/dist/machines.js +4 -5
- package/dist/{model-policy-picker-menu-JSA64TNN.js → model-policy-picker-menu-PUTA5JOB.js} +4 -4
- package/dist/model-policy.js +1 -1
- package/dist/provider.d.ts +1 -5
- package/dist/{queue-surface-implementation-HENWYFWA.js → queue-surface-implementation-2CAQAIHM.js} +2 -3
- package/dist/{queue-surface-implementation-HENWYFWA.js.map → queue-surface-implementation-2CAQAIHM.js.map} +1 -1
- package/dist/realtime.js +2 -2
- package/dist/{sandbox-files-BBC47SLD.js → sandbox-files-AEJTWGT4.js} +3 -4
- package/dist/session-ui.d.ts +1 -1
- package/dist/session-ui.js +12 -13
- package/dist/session-ui.js.map +1 -1
- package/dist/session.js +6 -7
- package/dist/usage.js +1 -2
- package/dist/usage.js.map +1 -1
- package/package.json +3 -3
- package/src/client.ts +1 -5
- package/src/commands/registry.ts +15 -18
- package/src/commands/types.ts +0 -2
- package/src/components/approval-surface.tsx +42 -166
- package/src/components/browser-viewer.tsx +9 -38
- package/src/components/composer.tsx +2 -9
- package/src/components/computer-viewer.tsx +30 -160
- package/src/components/generated-video-player.tsx +2 -4
- package/src/components/human-input-form.tsx +5 -18
- package/src/components/message-timeline.tsx +2 -4
- package/src/components/open-geni-chat.tsx +4 -11
- package/src/components/queue-surface-state.tsx +1 -3
- package/src/components/session-chrome.tsx +2 -5
- package/src/components/session-commands-panel.tsx +1 -3
- package/src/components/session-conversation.tsx +2 -4
- package/src/components/session-list.tsx +5 -7
- package/src/components/session-mcp-capability-card.tsx +1 -11
- package/src/hooks/internal.ts +2 -3
- package/src/hooks/use-browser-session.ts +79 -115
- package/src/hooks/use-composer.ts +31 -70
- package/src/hooks/use-computer-session.ts +6 -57
- package/src/hooks/use-file-attachments.ts +3 -16
- package/src/hooks/use-goal.ts +1 -2
- package/src/hooks/use-session-capabilities.ts +2 -3
- package/src/hooks/use-session-events.ts +8 -15
- package/src/hooks/use-slash-commands.ts +11 -6
- package/src/hooks/use-turn-queue.ts +1 -2
- package/src/hooks/use-workspace-sessions.ts +7 -40
- package/src/index.ts +2 -7
- package/src/interaction.ts +0 -1
- package/src/lib/format.ts +9 -73
- package/src/lib/interaction-errors.ts +0 -15
- package/src/model-policy.ts +0 -5
- package/src/provider.tsx +4 -12
- package/src/session-ui.ts +1 -1
- package/src/timeline/projection.ts +1 -12
- package/styles/compiled.css +0 -14
- package/dist/chunk-6ZSWSH4I.js.map +0 -1
- package/dist/chunk-AAG4R3QN.js.map +0 -1
- package/dist/chunk-CWWKTNKK.js.map +0 -1
- package/dist/chunk-ELCE5SXV.js.map +0 -1
- package/dist/chunk-GISEVGS6.js.map +0 -1
- package/dist/chunk-HNFCAQ5R.js.map +0 -1
- package/dist/chunk-LFXYGZWK.js.map +0 -1
- package/dist/chunk-Q5QBEZIQ.js.map +0 -1
- package/dist/chunk-RDKBXMWX.js.map +0 -1
- package/dist/chunk-TKB4SB44.js.map +0 -1
- package/dist/chunk-UGLEYEMP.js +0 -33
- package/dist/chunk-UGLEYEMP.js.map +0 -1
- package/dist/chunk-UTRTG6LH.js.map +0 -1
- package/dist/chunk-XOAMRDDK.js.map +0 -1
- package/dist/chunk-YN7I3STW.js.map +0 -1
- package/dist/chunk-YQEAA6LT.js.map +0 -1
- package/dist/lib/error-message.d.ts +0 -7
- package/src/lib/error-message.ts +0 -37
- /package/dist/{browser-viewer-63TXMINB.js.map → browser-viewer-5X47I6T2.js.map} +0 -0
- /package/dist/{chunk-DOJWJQ3F.js.map → chunk-5EXGU7UF.js.map} +0 -0
- /package/dist/{chunk-I7IWRQLN.js.map → chunk-BI57CQUV.js.map} +0 -0
- /package/dist/{chunk-2QUSQVF2.js.map → chunk-UINDK6C3.js.map} +0 -0
- /package/dist/{chunk-IQUCRAT7.js.map → chunk-XA6R7DJQ.js.map} +0 -0
- /package/dist/{computer-viewer-X2MBRZY4.js.map → computer-viewer-7GF35SNY.js.map} +0 -0
- /package/dist/{latest-question-CNEZ5KAN.js.map → latest-question-3BJGKQQ6.js.map} +0 -0
- /package/dist/{model-policy-picker-menu-JSA64TNN.js.map → model-policy-picker-menu-PUTA5JOB.js.map} +0 -0
- /package/dist/{sandbox-files-BBC47SLD.js.map → sandbox-files-AEJTWGT4.js.map} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InteractionInterventionBanner,
|
|
3
|
-
isInteractionControlUnavailable,
|
|
4
3
|
isNonRetryableInteractionError,
|
|
5
4
|
isSourcePlacementChangedError,
|
|
6
5
|
useInteractionInterventions,
|
|
7
6
|
useInteractionInvalidation
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-YSMMDOOE.js";
|
|
9
8
|
import {
|
|
10
9
|
copyTextToClipboard
|
|
11
10
|
} from "./chunk-JVYQRRC4.js";
|
|
@@ -23,7 +22,7 @@ import {
|
|
|
23
22
|
} from "./chunk-5J4FOW6Q.js";
|
|
24
23
|
import {
|
|
25
24
|
usePageLiveActivity
|
|
26
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-KZ73RL76.js";
|
|
27
26
|
import {
|
|
28
27
|
useEmbeddedComputerInteraction
|
|
29
28
|
} from "./chunk-NEXLLTP4.js";
|
|
@@ -453,7 +452,6 @@ function useComputerSession(options) {
|
|
|
453
452
|
requestRef.current.controller?.abort();
|
|
454
453
|
const controller = new AbortController();
|
|
455
454
|
requestRef.current = { id, controller };
|
|
456
|
-
let discoveryCompleted = false;
|
|
457
455
|
try {
|
|
458
456
|
const [session, targetResponse] = await Promise.all([
|
|
459
457
|
client.getComputerSession(workspaceId, computerSessionId, {
|
|
@@ -463,7 +461,6 @@ function useComputerSession(options) {
|
|
|
463
461
|
signal: controller.signal
|
|
464
462
|
})
|
|
465
463
|
]);
|
|
466
|
-
discoveryCompleted = true;
|
|
467
464
|
if (!mountedRef.current || requestRef.current.id !== id) return;
|
|
468
465
|
const targets = sortComputerTargets(targetResponse.targets);
|
|
469
466
|
const selected = chooseTarget(targets, selectedTargetIdRef.current, session.platform);
|
|
@@ -480,8 +477,7 @@ function useComputerSession(options) {
|
|
|
480
477
|
selectedTargetId: selected?.id ?? null,
|
|
481
478
|
observation: retainedObservation,
|
|
482
479
|
loading: false,
|
|
483
|
-
error: null
|
|
484
|
-
controlError: null
|
|
480
|
+
error: null
|
|
485
481
|
} : current
|
|
486
482
|
);
|
|
487
483
|
const observation = selected ? await client.observeComputerTarget(workspaceId, computerSessionId, selected.id, {
|
|
@@ -504,16 +500,11 @@ function useComputerSession(options) {
|
|
|
504
500
|
);
|
|
505
501
|
} catch (cause) {
|
|
506
502
|
if (controller.signal.aborted || !mountedRef.current || requestRef.current.id !== id) return;
|
|
507
|
-
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
508
503
|
setState(
|
|
509
504
|
(current) => current.computerSessionId === computerSessionId ? {
|
|
510
505
|
...current,
|
|
511
506
|
loading: false,
|
|
512
|
-
error
|
|
513
|
-
controlError: isInteractionControlUnavailable(
|
|
514
|
-
error,
|
|
515
|
-
discoveryCompleted ? "observation" : "control"
|
|
516
|
-
) ? error : current.controlError
|
|
507
|
+
error: cause instanceof Error ? cause : new Error(String(cause))
|
|
517
508
|
} : current
|
|
518
509
|
);
|
|
519
510
|
} finally {
|
|
@@ -570,19 +561,11 @@ function useComputerSession(options) {
|
|
|
570
561
|
(current) => current.computerSessionId === scopeComputerSessionId ? { ...current, mutating: true, error: null } : current
|
|
571
562
|
);
|
|
572
563
|
try {
|
|
573
|
-
|
|
574
|
-
setState(
|
|
575
|
-
(current) => current.computerSessionId === scopeComputerSessionId ? { ...current, controlError: null } : current
|
|
576
|
-
);
|
|
577
|
-
return result;
|
|
564
|
+
return await operation();
|
|
578
565
|
} catch (cause) {
|
|
579
566
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
580
567
|
setState(
|
|
581
|
-
(current) => current.computerSessionId === scopeComputerSessionId ? {
|
|
582
|
-
...current,
|
|
583
|
-
error,
|
|
584
|
-
controlError: isInteractionControlUnavailable(error) ? error : current.controlError
|
|
585
|
-
} : current
|
|
568
|
+
(current) => current.computerSessionId === scopeComputerSessionId ? { ...current, error } : current
|
|
586
569
|
);
|
|
587
570
|
throw error;
|
|
588
571
|
} finally {
|
|
@@ -629,12 +612,7 @@ function useComputerSession(options) {
|
|
|
629
612
|
} catch (cause) {
|
|
630
613
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
631
614
|
setState(
|
|
632
|
-
(current) => current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? {
|
|
633
|
-
...current,
|
|
634
|
-
loading: false,
|
|
635
|
-
error,
|
|
636
|
-
controlError: isInteractionControlUnavailable(error, "observation") ? error : current.controlError
|
|
637
|
-
} : current
|
|
615
|
+
(current) => current.computerSessionId === computerSessionId && current.selectedTargetId === target.id ? { ...current, loading: false, error } : current
|
|
638
616
|
);
|
|
639
617
|
throw error;
|
|
640
618
|
}
|
|
@@ -706,19 +684,7 @@ function useComputerSession(options) {
|
|
|
706
684
|
);
|
|
707
685
|
const readClipboard = useCallback2(async () => {
|
|
708
686
|
if (!computerSessionId) throw new Error("No desktop is selected.");
|
|
709
|
-
|
|
710
|
-
return await client.readComputerClipboard(workspaceId, computerSessionId);
|
|
711
|
-
} catch (cause) {
|
|
712
|
-
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
713
|
-
setState(
|
|
714
|
-
(current) => current.computerSessionId === computerSessionId ? {
|
|
715
|
-
...current,
|
|
716
|
-
error,
|
|
717
|
-
controlError: isInteractionControlUnavailable(error) ? error : current.controlError
|
|
718
|
-
} : current
|
|
719
|
-
);
|
|
720
|
-
throw error;
|
|
721
|
-
}
|
|
687
|
+
return await client.readComputerClipboard(workspaceId, computerSessionId);
|
|
722
688
|
}, [client, computerSessionId, workspaceId]);
|
|
723
689
|
return {
|
|
724
690
|
session: visible.session,
|
|
@@ -728,7 +694,6 @@ function useComputerSession(options) {
|
|
|
728
694
|
loading: visible.loading,
|
|
729
695
|
mutating: visible.mutating,
|
|
730
696
|
error: visible.error,
|
|
731
|
-
controlError: visible.controlError,
|
|
732
697
|
refresh,
|
|
733
698
|
readClipboard,
|
|
734
699
|
selectTarget,
|
|
@@ -745,8 +710,7 @@ function emptyState(computerSessionId, loading) {
|
|
|
745
710
|
observation: null,
|
|
746
711
|
loading,
|
|
747
712
|
mutating: false,
|
|
748
|
-
error: null
|
|
749
|
-
controlError: null
|
|
713
|
+
error: null
|
|
750
714
|
};
|
|
751
715
|
}
|
|
752
716
|
function chooseTarget(targets, preferredId, platform) {
|
|
@@ -1120,9 +1084,7 @@ function ComputerViewer({
|
|
|
1120
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;
|
|
1121
1085
|
const rfbStream = frames.attachment?.stream.kind === "direct_rfb" ? frames.attachment.stream : null;
|
|
1122
1086
|
const machineLocked = selectedRegistrySession?.failureCode === "machine_locked";
|
|
1123
|
-
const
|
|
1124
|
-
const connectionState = controlUnavailable ? "error" : frames.state;
|
|
1125
|
-
const rfbInputEnabled = !machineLocked && !controlUnavailable && computer.session?.capabilities?.pointerInput === true && computer.session?.capabilities?.keyboardInput === true;
|
|
1087
|
+
const rfbInputEnabled = !machineLocked && computer.session?.capabilities?.pointerInput === true && computer.session?.capabilities?.keyboardInput === true;
|
|
1126
1088
|
const rfbCapability = useMemo2(() => {
|
|
1127
1089
|
if (!rfbStream || !frames.attachment) return null;
|
|
1128
1090
|
const bounds = computer.selectedTarget?.bounds;
|
|
@@ -1230,7 +1192,6 @@ function ComputerViewer({
|
|
|
1230
1192
|
]);
|
|
1231
1193
|
const perform = useCallback4(
|
|
1232
1194
|
async (action, frame) => {
|
|
1233
|
-
if (computer.controlError) throw computer.controlError;
|
|
1234
1195
|
let receipt;
|
|
1235
1196
|
if (action.type === "pointer") {
|
|
1236
1197
|
if (!frame) throw new Error("Desktop view is not ready for pointer input.");
|
|
@@ -1242,12 +1203,8 @@ function ComputerViewer({
|
|
|
1242
1203
|
throw new Error(receipt.error?.message ?? "Desktop input did not complete.");
|
|
1243
1204
|
}
|
|
1244
1205
|
},
|
|
1245
|
-
[act, actFromFrame
|
|
1206
|
+
[act, actFromFrame]
|
|
1246
1207
|
);
|
|
1247
|
-
const reconnect = () => {
|
|
1248
|
-
void refreshComputer();
|
|
1249
|
-
frames.reconnect();
|
|
1250
|
-
};
|
|
1251
1208
|
const copyFromRfb = useCallback4(
|
|
1252
1209
|
(event) => {
|
|
1253
1210
|
if (!rfbInputEnabled || !rfbStream || computer.session?.capabilities?.clipboard !== true)
|
|
@@ -1341,7 +1298,7 @@ function ComputerViewer({
|
|
|
1341
1298
|
},
|
|
1342
1299
|
onCreate: hideGenericCreate ? void 0 : createComputer,
|
|
1343
1300
|
onRefresh: () => {
|
|
1344
|
-
if (
|
|
1301
|
+
if (frames.state === "error" && !generationLossSelected && !generationLossFrames) {
|
|
1345
1302
|
frames.reconnect();
|
|
1346
1303
|
}
|
|
1347
1304
|
void Promise.all([refreshRegistry(), refreshComputer()]);
|
|
@@ -1399,19 +1356,7 @@ function ComputerViewer({
|
|
|
1399
1356
|
className: "h-full"
|
|
1400
1357
|
}
|
|
1401
1358
|
),
|
|
1402
|
-
!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:
|
|
1403
|
-
"Desktop controls unavailable",
|
|
1404
|
-
" ",
|
|
1405
|
-
/* @__PURE__ */ jsx(
|
|
1406
|
-
"button",
|
|
1407
|
-
{
|
|
1408
|
-
type: "button",
|
|
1409
|
-
onClick: reconnect,
|
|
1410
|
-
className: "pointer-events-auto ml-2 font-medium underline",
|
|
1411
|
-
children: "Reconnect"
|
|
1412
|
-
}
|
|
1413
|
-
)
|
|
1414
|
-
] }) : "View only \xB7 direct input unavailable" }) : null
|
|
1359
|
+
!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
|
|
1415
1360
|
] }) : /* @__PURE__ */ jsx(
|
|
1416
1361
|
ComputerViewport,
|
|
1417
1362
|
{
|
|
@@ -1419,18 +1364,16 @@ function ComputerViewer({
|
|
|
1419
1364
|
observation: computer.observation,
|
|
1420
1365
|
target: computer.selectedTarget,
|
|
1421
1366
|
machineLocked,
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
connectionError: computer.controlError ?? frames.error ?? computer.error,
|
|
1367
|
+
connectionState: frames.state,
|
|
1368
|
+
connectionError: frames.error ?? computer.error,
|
|
1425
1369
|
mutating: computer.mutating,
|
|
1426
1370
|
backgroundActions: computer.session?.capabilities?.backgroundActions === true,
|
|
1427
|
-
backgroundInput: computer.session?.capabilities?.backgroundInput === true,
|
|
1428
1371
|
clipboardEnabled: computer.session?.capabilities?.clipboard === true,
|
|
1429
1372
|
pointerInput: computer.session?.capabilities?.pointerInput === true,
|
|
1430
1373
|
keyboardInput: computer.session?.capabilities?.keyboardInput === true,
|
|
1431
1374
|
onAction: perform,
|
|
1432
1375
|
onReadClipboard: computer.readClipboard,
|
|
1433
|
-
onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : reconnect,
|
|
1376
|
+
onReconnect: generationLossSelected || generationLossFrames ? () => void 0 : frames.reconnect,
|
|
1434
1377
|
onError: (cause) => notifyError(cause, "Desktop input failed.")
|
|
1435
1378
|
},
|
|
1436
1379
|
JSON.stringify([
|
|
@@ -1444,8 +1387,7 @@ function ComputerViewer({
|
|
|
1444
1387
|
ComputerSemanticPanel,
|
|
1445
1388
|
{
|
|
1446
1389
|
observation: computer.observation,
|
|
1447
|
-
mutating: computer.mutating
|
|
1448
|
-
controlUnavailable,
|
|
1390
|
+
mutating: computer.mutating,
|
|
1449
1391
|
onAction: (action) => void perform(action, null).catch(
|
|
1450
1392
|
(cause) => notifyError(cause, "Desktop action failed.")
|
|
1451
1393
|
)
|
|
@@ -1457,11 +1399,10 @@ function ComputerViewer({
|
|
|
1457
1399
|
{
|
|
1458
1400
|
session: computer.session,
|
|
1459
1401
|
target: computer.selectedTarget,
|
|
1460
|
-
connectionState,
|
|
1461
|
-
controlUnavailable,
|
|
1402
|
+
connectionState: frames.state,
|
|
1462
1403
|
refreshing: registry.refreshing,
|
|
1463
1404
|
showControls,
|
|
1464
|
-
controlCount:
|
|
1405
|
+
controlCount: semanticNodes(computer.observation).length,
|
|
1465
1406
|
onToggleControls: () => setShowControls((current) => !current)
|
|
1466
1407
|
}
|
|
1467
1408
|
)
|
|
@@ -1686,7 +1627,6 @@ function ComputerLifecyclePanel(props) {
|
|
|
1686
1627
|
function ComputerViewport(props) {
|
|
1687
1628
|
const canvasRef = useRef4(null);
|
|
1688
1629
|
const inputRef = useRef4(null);
|
|
1689
|
-
const composingRef = useRef4(false);
|
|
1690
1630
|
const pointerStartRef = useRef4(null);
|
|
1691
1631
|
const clickTimerRef = useRef4(null);
|
|
1692
1632
|
const lastClickRef = useRef4(null);
|
|
@@ -1707,7 +1647,7 @@ function ComputerViewport(props) {
|
|
|
1707
1647
|
readClipboardRef.current = props.onReadClipboard;
|
|
1708
1648
|
errorRef.current = props.onError;
|
|
1709
1649
|
const streamFailed = props.connectionState === "error";
|
|
1710
|
-
const rawInputEnabled = !streamFailed && !props.
|
|
1650
|
+
const rawInputEnabled = !streamFailed && !props.machineLocked && (!props.backgroundActions || props.target?.kind === "screen" || props.target?.focused === true);
|
|
1711
1651
|
const clearBufferedInput = useCallback4(() => {
|
|
1712
1652
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
1713
1653
|
if (wheelRef.current?.timer) clearTimeout(wheelRef.current.timer);
|
|
@@ -1717,25 +1657,10 @@ function ComputerViewport(props) {
|
|
|
1717
1657
|
pendingTextRef.current = null;
|
|
1718
1658
|
pointerStartRef.current = null;
|
|
1719
1659
|
lastClickRef.current = null;
|
|
1720
|
-
composingRef.current = false;
|
|
1721
1660
|
if (inputRef.current) inputRef.current.value = "";
|
|
1722
1661
|
}, []);
|
|
1723
1662
|
const pointerInputEnabled = rawInputEnabled && props.pointerInput;
|
|
1724
1663
|
const keyboardInputEnabled = rawInputEnabled && props.keyboardInput;
|
|
1725
|
-
useLayoutEffect(() => {
|
|
1726
|
-
const canvas = canvasRef.current;
|
|
1727
|
-
const viewport = canvas?.parentElement;
|
|
1728
|
-
if (!canvas || !viewport) return;
|
|
1729
|
-
const fit = () => fitComputerCanvas(canvas);
|
|
1730
|
-
fit();
|
|
1731
|
-
if (typeof ResizeObserver === "undefined") {
|
|
1732
|
-
window.addEventListener("resize", fit);
|
|
1733
|
-
return () => window.removeEventListener("resize", fit);
|
|
1734
|
-
}
|
|
1735
|
-
const observer = new ResizeObserver(fit);
|
|
1736
|
-
observer.observe(viewport);
|
|
1737
|
-
return () => observer.disconnect();
|
|
1738
|
-
}, []);
|
|
1739
1664
|
const paintQueuedFrames = useCallback4(() => {
|
|
1740
1665
|
if (decodingFrameRef.current) return;
|
|
1741
1666
|
decodingFrameRef.current = true;
|
|
@@ -2000,9 +1925,6 @@ function ComputerViewport(props) {
|
|
|
2000
1925
|
};
|
|
2001
1926
|
const keyDown = (event) => {
|
|
2002
1927
|
if (!keyboardInputEnabled) return;
|
|
2003
|
-
if (composingRef.current || event.nativeEvent.isComposing || event.nativeEvent.keyCode === 229) {
|
|
2004
|
-
return;
|
|
2005
|
-
}
|
|
2006
1928
|
flushPendingWheel();
|
|
2007
1929
|
const command = event.metaKey || event.ctrlKey;
|
|
2008
1930
|
if (props.clipboardEnabled && command && !event.altKey && ["c", "v"].includes(event.key.toLowerCase())) {
|
|
@@ -2048,8 +1970,7 @@ function ComputerViewport(props) {
|
|
|
2048
1970
|
await dispatch({ type: "clipboard", operation: "paste" }, null);
|
|
2049
1971
|
});
|
|
2050
1972
|
};
|
|
2051
|
-
const input = (value
|
|
2052
|
-
if (composingRef.current || nativeComposing) return;
|
|
1973
|
+
const input = (value) => {
|
|
2053
1974
|
if (!value || !keyboardInputEnabled) return;
|
|
2054
1975
|
flushPendingWheel();
|
|
2055
1976
|
flushPendingClick();
|
|
@@ -2066,10 +1987,6 @@ function ComputerViewport(props) {
|
|
|
2066
1987
|
}
|
|
2067
1988
|
if (inputRef.current) inputRef.current.value = "";
|
|
2068
1989
|
};
|
|
2069
|
-
const compositionEnd = (event) => {
|
|
2070
|
-
composingRef.current = false;
|
|
2071
|
-
input(event.currentTarget.value || event.data);
|
|
2072
|
-
};
|
|
2073
1990
|
const showCanvas = props.frame !== null && paintedFrame !== null && sameComputerTarget(props.frame, paintedFrame) && !props.machineLocked && !streamFailed;
|
|
2074
1991
|
return /* @__PURE__ */ jsxs("div", { className: "relative min-h-0 flex-1 overflow-hidden bg-black", children: [
|
|
2075
1992
|
/* @__PURE__ */ jsx(
|
|
@@ -2096,11 +2013,7 @@ function ComputerViewport(props) {
|
|
|
2096
2013
|
{
|
|
2097
2014
|
ref: inputRef,
|
|
2098
2015
|
defaultValue: "",
|
|
2099
|
-
onInput: (event) => input(event.currentTarget.value
|
|
2100
|
-
onCompositionStart: () => {
|
|
2101
|
-
composingRef.current = true;
|
|
2102
|
-
},
|
|
2103
|
-
onCompositionEnd: compositionEnd,
|
|
2016
|
+
onInput: (event) => input(event.currentTarget.value),
|
|
2104
2017
|
onKeyDown: keyDown,
|
|
2105
2018
|
onCopy: copy,
|
|
2106
2019
|
onPaste: paste,
|
|
@@ -2117,7 +2030,6 @@ function ComputerViewport(props) {
|
|
|
2117
2030
|
{
|
|
2118
2031
|
observation: props.observation,
|
|
2119
2032
|
machineLocked: props.machineLocked,
|
|
2120
|
-
controlUnavailable: props.controlUnavailable,
|
|
2121
2033
|
connectionState: props.connectionState,
|
|
2122
2034
|
error: props.connectionError,
|
|
2123
2035
|
onAction: (action) => enqueue(action, null),
|
|
@@ -2157,14 +2069,14 @@ function ComputerViewportFallback(props) {
|
|
|
2157
2069
|
] }) });
|
|
2158
2070
|
}
|
|
2159
2071
|
const controlFailure = interactionControlFailureFromError(props.error);
|
|
2160
|
-
const interactive =
|
|
2072
|
+
const interactive = semanticNodes(props.observation).filter((node) => semanticAction(node) !== null).slice(0, 10);
|
|
2161
2073
|
return /* @__PURE__ */ jsx("div", { className: "absolute inset-0 grid place-items-center bg-og-bg p-6", children: /* @__PURE__ */ jsxs("div", { className: "w-full max-w-md rounded-og-lg border border-og-border bg-og-surface-1 p-4 shadow-lg", children: [
|
|
2162
2074
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2163
2075
|
props.error ? /* @__PURE__ */ jsx(CircleAlertIcon, { className: "size-4 text-og-danger" }) : /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-4 animate-spin text-og-fg-muted" }),
|
|
2164
|
-
/* @__PURE__ */ jsx("p", { className: "text-og-menu font-medium text-og-fg", children: isAttachedChromeGenerationLossError(props.error) ? "Chrome reconnected\u2014open a fresh browser/desktop." : props.
|
|
2076
|
+
/* @__PURE__ */ jsx("p", { className: "text-og-menu font-medium text-og-fg", children: isAttachedChromeGenerationLossError(props.error) ? "Chrome reconnected\u2014open a fresh browser/desktop." : props.error ? "Live view disconnected" : computerConnectionLabel(props.connectionState) })
|
|
2165
2077
|
] }),
|
|
2166
2078
|
props.error ? /* @__PURE__ */ jsx("p", { className: "mt-2 text-og-control leading-5 text-og-fg-muted", children: isAttachedChromeGenerationLossError(props.error) ? "Chrome reconnected\u2014open a fresh browser/desktop. Use Browser \u2192 New browser \u2192 Connected Chrome." : controlFailure?.message ?? props.error.message }) : null,
|
|
2167
|
-
interactive.length > 0
|
|
2079
|
+
interactive.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "mt-3 border-t border-og-border pt-3", children: [
|
|
2168
2080
|
/* @__PURE__ */ jsx("p", { className: "mb-2 text-og-xs text-og-fg-subtle", children: "App controls remain available" }),
|
|
2169
2081
|
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1.5", children: interactive.map((node) => /* @__PURE__ */ jsx(
|
|
2170
2082
|
"button",
|
|
@@ -2192,14 +2104,13 @@ function ComputerViewportFallback(props) {
|
|
|
2192
2104
|
] }) });
|
|
2193
2105
|
}
|
|
2194
2106
|
function ComputerSemanticPanel(props) {
|
|
2195
|
-
const nodes =
|
|
2107
|
+
const nodes = semanticNodes(props.observation).slice(0, 100);
|
|
2196
2108
|
return /* @__PURE__ */ jsxs("aside", { className: "box-border max-h-[40%] w-full shrink-0 overflow-y-auto border-t border-og-border bg-og-surface-1 p-2 @xl/computer-viewer:max-h-none @xl/computer-viewer:w-64 @xl/computer-viewer:border-t-0 @xl/computer-viewer:border-l", children: [
|
|
2197
2109
|
/* @__PURE__ */ jsxs("div", { className: "mb-2 flex items-center gap-1.5 px-1 text-og-xs font-medium uppercase tracking-[0.1em] text-og-fg-subtle", children: [
|
|
2198
2110
|
/* @__PURE__ */ jsx(KeyboardIcon, { className: "size-3" }),
|
|
2199
2111
|
" App controls"
|
|
2200
2112
|
] }),
|
|
2201
|
-
|
|
2202
|
-
nodes.length === 0 ? props.controlUnavailable ? null : /* @__PURE__ */ jsx("p", { className: "px-1 py-2 text-og-control leading-5 text-og-fg-muted", children: "This view has no accessibility controls. Use the live image instead." }) : /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: nodes.map((node) => /* @__PURE__ */ jsx(
|
|
2113
|
+
nodes.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-1 py-2 text-og-control leading-5 text-og-fg-muted", children: "This view has no accessibility controls. Use the live image instead." }) : /* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: nodes.map((node) => /* @__PURE__ */ jsx(
|
|
2203
2114
|
ComputerSemanticControl,
|
|
2204
2115
|
{
|
|
2205
2116
|
node,
|
|
@@ -2288,8 +2199,8 @@ function ComputerStatusBar(props) {
|
|
|
2288
2199
|
)
|
|
2289
2200
|
}
|
|
2290
2201
|
),
|
|
2291
|
-
/* @__PURE__ */ jsx("span", { children: props.
|
|
2292
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children:
|
|
2202
|
+
/* @__PURE__ */ jsx("span", { children: props.connectionState === "live" ? "Live" : computerConnectionLabel(props.connectionState) }),
|
|
2203
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: screen ? "Full screen \xB7 input may move pointer and focus" : props.session?.capabilities?.backgroundActions ? "Window \xB7 app controls work in the background" : props.target?.kind ?? "Desktop" }),
|
|
2293
2204
|
screen ? /* @__PURE__ */ jsx(MousePointer2Icon, { className: "size-3", "aria-hidden": true }) : null,
|
|
2294
2205
|
props.refreshing ? /* @__PURE__ */ jsx(LoaderCircleIcon, { className: "size-3 animate-spin" }) : null,
|
|
2295
2206
|
/* @__PURE__ */ jsxs(
|
|
@@ -2325,30 +2236,11 @@ function ComputerNotice(props) {
|
|
|
2325
2236
|
}
|
|
2326
2237
|
);
|
|
2327
2238
|
}
|
|
2328
|
-
|
|
2329
|
-
"frame",
|
|
2330
|
-
"panel",
|
|
2331
|
-
"section",
|
|
2332
|
-
"document",
|
|
2333
|
-
"document web",
|
|
2334
|
-
"static",
|
|
2335
|
-
"static text",
|
|
2336
|
-
"heading",
|
|
2337
|
-
"paragraph",
|
|
2338
|
-
"notification",
|
|
2339
|
-
"separator",
|
|
2340
|
-
"tool bar",
|
|
2341
|
-
"page tab list"
|
|
2342
|
-
]);
|
|
2343
|
-
function semanticControls(observation) {
|
|
2239
|
+
function semanticNodes(observation) {
|
|
2344
2240
|
if (observation?.semantic?.kind !== "snapshot") return [];
|
|
2345
2241
|
const result = [];
|
|
2346
2242
|
const visit = (node) => {
|
|
2347
|
-
|
|
2348
|
-
const label = node.name?.trim() || node.identifier?.trim();
|
|
2349
|
-
if (node.actions.includes("set_value") || label && label.toLowerCase() !== role && !structuralRoles.has(role) && semanticAction(node) !== null) {
|
|
2350
|
-
result.push(node);
|
|
2351
|
-
}
|
|
2243
|
+
result.push(node);
|
|
2352
2244
|
node.children?.forEach(visit);
|
|
2353
2245
|
};
|
|
2354
2246
|
observation.semantic.roots.forEach(visit);
|
|
@@ -2369,24 +2261,11 @@ function semanticValue(node) {
|
|
|
2369
2261
|
return typeof node.value === "string" ? node.value : null;
|
|
2370
2262
|
}
|
|
2371
2263
|
function paintCanvas(canvas, image, width, height) {
|
|
2372
|
-
const dimensionsChanged = canvas.width !== width || canvas.height !== height;
|
|
2373
2264
|
canvas.width = width;
|
|
2374
2265
|
canvas.height = height;
|
|
2375
2266
|
const context = canvas.getContext("2d", { alpha: false });
|
|
2376
2267
|
if (!context) throw new Error("Desktop canvas is unavailable.");
|
|
2377
2268
|
context.drawImage(image, 0, 0, width, height);
|
|
2378
|
-
if (dimensionsChanged) fitComputerCanvas(canvas);
|
|
2379
|
-
}
|
|
2380
|
-
function fitComputerCanvas(canvas) {
|
|
2381
|
-
const viewport = canvas.parentElement;
|
|
2382
|
-
if (!viewport || canvas.width <= 0 || canvas.height <= 0) return;
|
|
2383
|
-
const scale = Math.min(
|
|
2384
|
-
viewport.clientWidth / canvas.width,
|
|
2385
|
-
viewport.clientHeight / canvas.height
|
|
2386
|
-
);
|
|
2387
|
-
if (!Number.isFinite(scale) || scale <= 0) return;
|
|
2388
|
-
canvas.style.width = `${canvas.width * scale}px`;
|
|
2389
|
-
canvas.style.height = `${canvas.height * scale}px`;
|
|
2390
2269
|
}
|
|
2391
2270
|
function loadImage(url) {
|
|
2392
2271
|
return new Promise((resolve, reject) => {
|
|
@@ -2544,4 +2423,4 @@ export {
|
|
|
2544
2423
|
ComputerViewer,
|
|
2545
2424
|
computerKey
|
|
2546
2425
|
};
|
|
2547
|
-
//# sourceMappingURL=chunk-
|
|
2426
|
+
//# sourceMappingURL=chunk-6NEZPF53.js.map
|