mirror of
https://github.com/stablyai/orca.git
synced 2026-11-03 02:27:43 +00:00
With "Remote server workspaces" set to "Server (streamed)", a paired server that has no way to stream pages (an orcad `orca serve`: its browser engine offers no screencast) could not take the desktop's new tabs. The desktop fell back to a plain desktop tab the server never heard of: it browsed from the desktop's network and never appeared in `orca tab list`, so agents could not see or drive the page the user was on. The setting is a rendering preference. When the server cannot stream, the desktop now renders the page itself as a page the server owns (the existing client-hosted path), so traffic still goes through the server and the tab is listed and drivable from the server's CLI. Servers that can stream keep rendering on the server; an explicit server placement is unchanged. Refs #35156
57 lines
1.9 KiB
TypeScript
57 lines
1.9 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
expectsBrowserClientHosting,
|
|
runtimeAdvertisesBrowserClientHosting
|
|
} from './browser-client-hosting-eligibility'
|
|
|
|
const CLIENT_HOST_CAPABILITIES = [
|
|
'browser.clientHost.v1',
|
|
'browser.clientHost.pageMetadata.v1',
|
|
'browser.clientHost.automation.v1',
|
|
'network.browserTunnel.v1',
|
|
'network.browserTunnel.executionHosts.v1'
|
|
]
|
|
|
|
const ELIGIBLE = {
|
|
enabled: true,
|
|
preference: 'auto' as const,
|
|
deviceScope: 'desktop',
|
|
capabilities: [...CLIENT_HOST_CAPABILITIES, 'browser.screencast.v1']
|
|
}
|
|
|
|
describe('expectsBrowserClientHosting', () => {
|
|
it('accepts a desktop runtime that advertises the whole capability set', () => {
|
|
expect(expectsBrowserClientHosting(ELIGIBLE)).toBe(true)
|
|
})
|
|
|
|
it('treats an unset preference as auto', () => {
|
|
expect(expectsBrowserClientHosting({ ...ELIGIBLE, preference: undefined })).toBe(true)
|
|
})
|
|
|
|
it('hosts on this device when the server-render setting meets a server that cannot stream', () => {
|
|
expect(
|
|
expectsBrowserClientHosting({
|
|
...ELIGIBLE,
|
|
enabled: false,
|
|
capabilities: CLIENT_HOST_CAPABILITIES
|
|
})
|
|
).toBe(true)
|
|
})
|
|
|
|
it.each([
|
|
{ name: 'client hosting is disabled', input: { enabled: false } },
|
|
{ name: 'the caller asked for a server page', input: { preference: 'server' as const } },
|
|
{ name: 'the runtime is a mobile device', input: { deviceScope: 'mobile' } },
|
|
{ name: 'the runtime advertises nothing', input: { capabilities: undefined } }
|
|
])('refuses when $name', ({ input }) => {
|
|
expect(expectsBrowserClientHosting({ ...ELIGIBLE, ...input })).toBe(false)
|
|
})
|
|
|
|
it.each(CLIENT_HOST_CAPABILITIES)('refuses without %s', (missing) => {
|
|
const capabilities = ELIGIBLE.capabilities.filter((capability) => capability !== missing)
|
|
|
|
expect(runtimeAdvertisesBrowserClientHosting(capabilities)).toBe(false)
|
|
expect(expectsBrowserClientHosting({ ...ELIGIBLE, capabilities })).toBe(false)
|
|
})
|
|
})
|