* /remote-control command — manages the bidirectional bridge connection. * * When enabled, sets replBridgeEnabled in AppState, which triggers * useReplBridge in REPL.tsx to initialize the bridge connection. * The bridge registers an environment, creates a session with the current * conversation
(t0)
| 36 | * URL and options to disconnect or continue. |
| 37 | */ |
| 38 | function BridgeToggle(t0) { |
| 39 | const $ = _c(10); |
| 40 | const { |
| 41 | onDone, |
| 42 | name |
| 43 | } = t0; |
| 44 | const setAppState = useSetAppState(); |
| 45 | const replBridgeConnected = useAppState(_temp); |
| 46 | const replBridgeEnabled = useAppState(_temp2); |
| 47 | const replBridgeOutboundOnly = useAppState(_temp3); |
| 48 | const [showDisconnectDialog, setShowDisconnectDialog] = useState(false); |
| 49 | let t1; |
| 50 | if ($[0] !== name || $[1] !== onDone || $[2] !== replBridgeConnected || $[3] !== replBridgeEnabled || $[4] !== replBridgeOutboundOnly || $[5] !== setAppState) { |
| 51 | t1 = () => { |
| 52 | if ((replBridgeConnected || replBridgeEnabled) && !replBridgeOutboundOnly) { |
| 53 | setShowDisconnectDialog(true); |
| 54 | return; |
| 55 | } |
| 56 | let cancelled = false; |
| 57 | (async () => { |
| 58 | const error = await checkBridgePrerequisites(); |
| 59 | if (cancelled) { |
| 60 | return; |
| 61 | } |
| 62 | if (error) { |
| 63 | logEvent("tengu_bridge_command", { |
| 64 | action: "preflight_failed" as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 65 | }); |
| 66 | onDone(error, { |
| 67 | display: "system" |
| 68 | }); |
| 69 | return; |
| 70 | } |
| 71 | if (shouldShowRemoteCallout()) { |
| 72 | setAppState(prev => { |
| 73 | if (prev.showRemoteCallout) { |
| 74 | return prev; |
| 75 | } |
| 76 | return { |
| 77 | ...prev, |
| 78 | showRemoteCallout: true, |
| 79 | replBridgeInitialName: name |
| 80 | }; |
| 81 | }); |
| 82 | onDone("", { |
| 83 | display: "system" |
| 84 | }); |
| 85 | return; |
| 86 | } |
| 87 | logEvent("tengu_bridge_command", { |
| 88 | action: "connect" as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 89 | }); |
| 90 | setAppState(prev_0 => { |
| 91 | if (prev_0.replBridgeEnabled && !prev_0.replBridgeOutboundOnly) { |
| 92 | return prev_0; |
| 93 | } |
| 94 | return { |
| 95 | ...prev_0, |
nothing calls this directly
no test coverage detected