Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(modules): fold TinyBrowser into TinyComputer and add computer model config

Steven Enamakel152a243a8d5a
diff --git a/.gitmodules b/.gitmodules
index 4e30c32d7b..7054caa020 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -54,12 +54,9 @@
[submodule "vendor/tinyskills"]
path = vendor/tinyskills
url = https://github.com/tinyhumansai/tinyskills
-[submodule "vendor/tinydesktop"]
- path = vendor/tinydesktop
+[submodule "vendor/tinycomputer"]
+ path = vendor/tinycomputer
url = https://github.com/tinyhumansai/tinycomputer.git
-[submodule "vendor/tinybrowser"]
- path = vendor/tinybrowser
- url = https://github.com/tinyhumansai/tinybrowser.git
[submodule "vendor/tinysearch"]
path = vendor/tinysearch
url = https://github.com/tinyhumansai/tinysearch.git
diff --git a/Cargo.lock b/Cargo.lock
index beecb91d6c..862b47dcd5 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3907,8 +3907,6 @@ dependencies = [
"tinyagents-registry",
"tinyagents-runtime",
"tinyagents-session",
- "tinybrowser-bus",
- "tinybrowser-control",
"tinybus",
"tinychannels",
"tinychannels-bus",
@@ -3926,7 +3924,6 @@ dependencies = [
"tinyinference-local",
"tinyinference-providers",
"tinyinference-voice",
- "tinyjevclient 0.2.1",
"tinyjuice",
"tinyjuice-bus",
"tinymcp",
@@ -4007,7 +4004,7 @@ dependencies = [
"tinyinference-core",
"tinyinference-llm",
"tinyinference-local",
- "tinyjevclient 0.2.1 (git+https://github.com/tinyhumansai/tinyjevclient?rev=84b3983c7e1e14f7515658ceafabb6c4e7967c94)",
+ "tinyjevclient",
"tinymcp",
"tinymcp-bus",
"tinymemory-api",
@@ -4080,7 +4077,7 @@ dependencies = [
"thiserror 2.0.20",
"tinychannels-bus",
"tinyhumans-sdk",
- "tinyjevclient 0.2.1 (git+https://github.com/tinyhumansai/tinyjevclient?rev=84b3983c7e1e14f7515658ceafabb6c4e7967c94)",
+ "tinyjevclient",
"tinytools 0.4.1",
"tinytools-jev",
"tokio",
@@ -6277,24 +6274,6 @@ dependencies = [
"tracing",
]
-[[package]]
-name = "tinybrowser-bus"
-version = "0.2.3"
-dependencies = [
- "serde",
- "serde_json",
-]
-
-[[package]]
-name = "tinybrowser-control"
-version = "0.2.3"
-dependencies = [
- "serde_json",
- "thiserror 2.0.20",
- "tinybrowser-bus",
- "tinyjevclient 0.2.1",
-]
-
[[package]]
name = "tinybus"
version = "0.1.2"
@@ -6403,7 +6382,7 @@ dependencies = [
[[package]]
name = "tinycomputer-bus"
-version = "0.5.2"
+version = "0.6.0"
dependencies = [
"serde",
"serde_json",
@@ -6640,18 +6619,6 @@ dependencies = [
"uuid",
]
-[[package]]
-name = "tinyjevclient"
-version = "0.2.1"
-dependencies = [
- "httpdate",
- "reqwest",
- "serde",
- "serde_json",
- "thiserror 2.0.20",
- "tokio",
-]
-
[[package]]
name = "tinyjevclient"
version = "0.2.1"
diff --git a/app/src/components/desktop/DesktopConnectionPage.tsx b/app/src/components/desktop/DesktopConnectionPage.tsx
index e4e9df1b90..4a317dd196 100644
--- a/app/src/components/desktop/DesktopConnectionPage.tsx
+++ b/app/src/components/desktop/DesktopConnectionPage.tsx
@@ -76,7 +76,14 @@ function permissionSettingsUrl(kind: PermissionKind, platform: string): string |
return null;
}
-export default function DesktopConnectionPage() {
+export interface DesktopConnectionPageProps {
+ /** Render only the body, for hosting inside the Computer panel's chip tabs. */
+ embedded?: boolean;
+}
+
+export default function DesktopConnectionPage({
+ embedded = false,
+}: DesktopConnectionPageProps = {}) {
const { t } = useT();
const [localHost, setLocalHost] = useState<boolean | null>(null);
const [status, setStatus] = useState<DesktopStatus | null>(null);
@@ -258,181 +265,190 @@ export default function DesktopConnectionPage() {
</Badge>
) : null;
- return (
- <SettingsTabbedPage
- title={t('desktop.title')}
- description={t('desktop.description')}
- headerAction={
- <Button
- variant="secondary"
- size="sm"
- leadingIcon={<RefreshCw className="h-3.5 w-3.5" aria-hidden />}
- onClick={() => {
- void refresh();
- if (status?.enabled && status.approvals_enabled) void refreshPending();
- }}
- disabled={loading}>
- {t('common.refresh')}
- </Button>
- }>
- <div className="space-y-4" data-testid="desktop-connection-page">
- <Alert variant="warning" density="compact" role={undefined}>
- <AlertDescription>{t('connections.earlyAlphaNotice')}</AlertDescription>
- </Alert>
+ const refreshButton = (
+ <Button
+ variant="secondary"
+ size="sm"
+ leadingIcon={<RefreshCw className="h-3.5 w-3.5" aria-hidden />}
+ onClick={() => {
+ void refresh();
+ if (status?.enabled && status.approvals_enabled) void refreshPending();
+ }}
+ disabled={loading}>
+ {t('common.refresh')}
+ </Button>
+ );
- {loading && !status && <CenteredLoadingState label={t('common.loading')} />}
+ const body = (
+ <div className="space-y-4" data-testid="desktop-connection-page">
+ <Alert variant="warning" density="compact" role={undefined}>
+ <AlertDescription>{t('connections.earlyAlphaNotice')}</AlertDescription>
+ </Alert>
- {status && !status.supported && (
- <Alert variant="info" density="compact">
- <AlertDescription>{t('desktop.unsupported')}</AlertDescription>
- </Alert>
- )}
+ {loading && !status && <CenteredLoadingState label={t('common.loading')} />}
- {/* ── Master switch: on/off, where it stands, and why ────────────── */}
- {status?.supported && (
- <Card data-testid="desktop-status-card">
- <div className="flex items-center gap-3 p-4">
- <IconTile icon={Monitor} active={status.enabled} size="lg" />
- <div className="min-w-0 flex-1">
- <label
- htmlFor="desktop-enabled-switch"
- className="flex flex-wrap items-center gap-2 text-sm font-semibold text-content">
- {t('desktop.enableLabel')}
- {statusBadge}
- </label>
- <p className="mt-0.5 text-xs text-content-muted">{t('desktop.localOnly')}</p>
- </div>
- <Switch
- id="desktop-enabled-switch"
- checked={status.enabled}
- disabled={busy}
- onCheckedChange={() => void setEnabled()}
- aria-label={status.enabled ? t('common.disable') : t('common.enable')}
- />
- </div>
- {(status.reason || (status.enabled && !ready)) && (
- <div className="px-4 py-3 text-xs text-content-muted">
- {status.reason ??
- (status.module_state === 'failed'
- ? t('desktop.moduleUnavailable')
- : t('desktop.enabledPending'))}
- </div>
- )}
- </Card>
- )}
+ {status && !status.supported && (
+ <Alert variant="info" density="compact">
+ <AlertDescription>{t('desktop.unsupported')}</AlertDescription>
+ </Alert>
+ )}
- {status?.supported && status.enabled && (
- <>
- {/* ── Pending approvals ──────────────────────────────────────── */}
- {status.approvals_enabled && pending.length > 0 && (
- <Card
- title={t('chat.approval.title')}
- headerRight={<Badge variant="warning">{pending.length}</Badge>}
- data-testid="desktop-pending-card">
- {pending.map(entry => (
- <div
- key={entry.confirmation_id}
- className="flex flex-wrap items-center gap-3 px-4 py-3">
- <div className="min-w-0 flex-1">
- <p className="text-sm font-medium text-content">
- {entry.target_name
- ? t('desktop.approvalSummary')
- .replace(
- '{operation}',
- t(
- `desktop.action.${entry.operation.toLowerCase()}`,
- entry.operation
- )
- )
- .replace('{target}', entry.target_name)
- .replace('{app}', entry.app)
- : t('common.notAvailable')}
- </p>
- <p className="mt-0.5 text-xs text-content-muted">{entry.reason}</p>
- </div>
- <div className="flex shrink-0 gap-2">
- <Button
- size="sm"
- variant="secondary"
- leadingIcon={<X className="h-3.5 w-3.5" aria-hidden />}
- disabled={busy}
- onClick={() => void decide(entry.confirmation_id, false)}>
- {t('chat.approval.deny')}
- </Button>
- <Button
- size="sm"
- leadingIcon={<Check className="h-3.5 w-3.5" aria-hidden />}
- disabled={busy || !entry.action_summary || !entry.target_name}
- onClick={() => void decide(entry.confirmation_id, true)}>
- {t('chat.approval.approve')}
- </Button>
- </div>
- </div>
- ))}
- </Card>
- )}
- </>
- )}
+ {/* ── Master switch: on/off, where it stands, and why ────────────── */}
+ {status?.supported && (
+ <Card data-testid="desktop-status-card">
+ <div className="flex items-center gap-3 p-4">
+ <IconTile icon={Monitor} active={status.enabled} size="lg" />
+ <div className="min-w-0 flex-1">
+ <label
+ htmlFor="desktop-enabled-switch"
+ className="flex flex-wrap items-center gap-2 text-sm font-semibold text-content">
+ {t('desktop.enableLabel')}
+ {statusBadge}
+ </label>
+ <p className="mt-0.5 text-xs text-content-muted">{t('desktop.localOnly')}</p>
+ </div>
+ <Switch
+ id="desktop-enabled-switch"
+ checked={status.enabled}
+ disabled={busy}
+ onCheckedChange={() => void setEnabled()}
+ aria-label={status.enabled ? t('common.disable') : t('common.enable')}
+ />
+ </div>
+ {(status.reason || (status.enabled && !ready)) && (
+ <div className="px-4 py-3 text-xs text-content-muted">
+ {status.reason ??
+ (status.module_state === 'failed'
+ ? t('desktop.moduleUnavailable')
+ : t('desktop.enabledPending'))}
+ </div>
+ )}
+ </Card>
+ )}
- {/* Permissions and the access check are short cards: side by side. */}
- {status?.supported && (
- <TileGrid columns={2}>
+ {status?.supported && status.enabled && (
+ <>
+ {/* ── Pending approvals ──────────────────────────────────────── */}
+ {status.approvals_enabled && pending.length > 0 && (
<Card
- title={t('desktop.permissions')}
- description={t('desktop.captureNote')}
- className="h-full">
- {permissionRow('accessibility', status.accessibility)}
- {permissionRow('screen_recording', status.screen_recording)}
- </Card>
- {/* ── Access check ───────────────────────────────────────── */}
- {status.enabled && (
- <Card title={t('desktop.checkHeading')} className="h-full">
- <Field
- label={t('desktop.checkLabel')}
- description={t('desktop.testDescription')}
- control={
+ title={t('chat.approval.title')}
+ headerRight={<Badge variant="warning">{pending.length}</Badge>}
+ data-testid="desktop-pending-card">
+ {pending.map(entry => (
+ <div
+ key={entry.confirmation_id}
+ className="flex flex-wrap items-center gap-3 px-4 py-3">
+ <div className="min-w-0 flex-1">
+ <p className="text-sm font-medium text-content">
+ {entry.target_name
+ ? t('desktop.approvalSummary')
+ .replace(
+ '{operation}',
+ t(`desktop.action.${entry.operation.toLowerCase()}`, entry.operation)
+ )
+ .replace('{target}', entry.target_name)
+ .replace('{app}', entry.app)
+ : t('common.notAvailable')}
+ </p>
+ <p className="mt-0.5 text-xs text-content-muted">{entry.reason}</p>
+ </div>
+ <div className="flex shrink-0 gap-2">
<Button
+ size="sm"
variant="secondary"
+ leadingIcon={<X className="h-3.5 w-3.5" aria-hidden />}
+ disabled={busy}
+ onClick={() => void decide(entry.confirmation_id, false)}>
+ {t('chat.approval.deny')}
+ </Button>
+ <Button
size="sm"
- leadingIcon={
- busy ? <Spinner /> : <Activity className="h-3.5 w-3.5" aria-hidden />
- }
- onClick={() => void runProbe()}
- disabled={busy}>
- {t('desktop.testButton')}
+ leadingIcon={<Check className="h-3.5 w-3.5" aria-hidden />}
+ disabled={busy || !entry.action_summary || !entry.target_name}
+ onClick={() => void decide(entry.confirmation_id, true)}>
+ {t('chat.approval.approve')}
</Button>
- }
- />
- {probe && (
- <div className="p-4">
- <Alert
- variant={probe.ok ? 'success' : 'warning'}
- density="compact"
- role="status">
- <AlertDescription>
- {probe.ok
- ? t('desktop.testPassed')
- : (probe.reason ?? t('desktop.testFailed'))}
- </AlertDescription>
- </Alert>
</div>
- )}
- </Card>
- )}
- </TileGrid>
- )}
+ </div>
+ ))}
+ </Card>
+ )}
+ </>
+ )}
- {error && (
- <Alert variant="destructive" density="compact">
- <AlertDescription>{error}</AlertDescription>
- </Alert>
- )}
- {pendingError && (
- <Alert variant="destructive" density="compact">
- <AlertDescription>{pendingError}</AlertDescription>
- </Alert>
- )}
+ {/* Permissions and the access check are short cards: side by side. */}
+ {status?.supported && (
+ <TileGrid columns={2}>
+ <Card
+ title={t('desktop.permissions')}
+ description={t('desktop.captureNote')}
+ className="h-full">
+ {permissionRow('accessibility', status.accessibility)}
+ {permissionRow('screen_recording', status.screen_recording)}
+ </Card>
+ {/* ── Access check ───────────────────────────────────────── */}
+ {status.enabled && (
+ <Card title={t('desktop.checkHeading')} className="h-full">
+ <Field
+ label={t('desktop.checkLabel')}
+ description={t('desktop.testDescription')}
+ control={
+ <Button
+ variant="secondary"
+ size="sm"
+ leadingIcon={
+ busy ? <Spinner /> : <Activity className="h-3.5 w-3.5" aria-hidden />
+ }
+ onClick={() => void runProbe()}
+ disabled={busy}>
+ {t('desktop.testButton')}
+ </Button>
+ }
+ />
+ {probe && (
+ <div className="p-4">
+ <Alert variant={probe.ok ? 'success' : 'warning'} density="compact" role="status">
+ <AlertDescription>
+ {probe.ok
+ ? t('desktop.testPassed')
+ : (probe.reason ?? t('desktop.testFailed'))}
+ </AlertDescription>
+ </Alert>
+ </div>
+ )}
+ </Card>
+ )}
+ </TileGrid>
+ )}
+
+ {error && (
+ <Alert variant="destructive" density="compact">
+ <AlertDescription>{error}</AlertDescription>
+ </Alert>
+ )}
+ {pendingError && (
+ <Alert variant="destructive" density="compact">
+ <AlertDescription>{pendingError}</AlertDescription>
+ </Alert>
+ )}
+ </div>
+ );
+
+ if (embedded) {
+ return (
+ <div className="space-y-4">
+ <div className="flex justify-end">{refreshButton}</div>
+ {body}
</div>
+ );
+ }
+
+ return (
+ <SettingsTabbedPage
+ title={t('desktop.title')}
+ description={t('desktop.description')}
+ headerAction={refreshButton}>
+ {body}
</SettingsTabbedPage>
);
}
diff --git a/app/src/components/settings/panels/BrowserConnectionsPanel.tsx b/app/src/components/settings/panels/BrowserConnectionsPanel.tsx
index 9d3af45403..2afa43643e 100644
--- a/app/src/components/settings/panels/BrowserConnectionsPanel.tsx
+++ b/app/src/components/settings/panels/BrowserConnectionsPanel.tsx
@@ -55,7 +55,14 @@ const defaults: BrowserSettings = {
task_timeout_secs: 120,
};
-export default function BrowserConnectionsPanel() {
+export interface BrowserConnectionsPanelProps {
+ /** Render only the body, for hosting inside the Computer panel's chip tabs. */
+ embedded?: boolean;
+}
+
+export default function BrowserConnectionsPanel({
+ embedded = false,
+}: BrowserConnectionsPanelProps = {}) {
const { t } = useT();
const [settings, setSettings] = useState<BrowserSettings>(defaults);
const [module, setModule] = useState<ModuleStatus | null>(null);
@@ -76,7 +83,7 @@ export default function BrowserConnectionsPanel() {
setBillingRoute(configResponse.result.browser_billing_route ?? null);
const httpRequest = (config.http_request ?? {}) as { allowed_domains?: string[] };
setAllowedDomains(httpRequest.allowed_domains ?? []);
- setModule(moduleResponse.result.modules.find(item => item.id === 'tinybrowser') ?? null);
+ setModule(moduleResponse.result.modules.find(item => item.id === 'tinycomputer') ?? null);
}, []);
useEffect(() => {
@@ -122,7 +129,7 @@ export default function BrowserConnectionsPanel() {
try {
const response = await callCoreRpc<{ result: { module: ModuleStatus } }>({
method: 'openhuman.modules_load',
- params: { id: 'tinybrowser' },
+ params: { id: 'tinycomputer' },
});
setModule(response.result.module);
setMessage(response.result.module.detail ?? t('connections.browser.moduleChecked'));
@@ -179,136 +186,140 @@ export default function BrowserConnectionsPanel() {
? t('connections.browser.routeHosted')
: t('connections.browser.unknown');
- return (
- <SettingsTabbedPage
- title={t('connections.tabs.browser')}
- description={t('connections.browser.description')}>
- <div className="max-w-5xl space-y-4 text-sm text-content">
- <Alert variant="warning" role={undefined}>
- <AlertDescription>{t('connections.earlyAlphaNotice')}</AlertDescription>
- </Alert>
- <Card title={t('connections.browser.module')} padded divided={false}>
- <div className="flex flex-wrap items-center justify-between gap-4">
- <div className="flex flex-wrap items-center gap-3">
- <Badge variant={module?.state === 'ready' ? 'success' : 'neutral'}>
- {module?.state ?? t('connections.browser.unknown')}
- </Badge>
- <span className="text-content-muted">{t('connections.browser.chrome')}</span>
- <Badge
- variant={
- chromeReady === true ? 'success' : chromeReady === false ? 'warning' : 'neutral'
- }>
- {chromeReady === true
- ? t('connections.browser.chromeReady')
- : chromeReady === false
- ? t('connections.browser.chromeNotReady')
- : t('connections.browser.notVerified')}
- </Badge>
- </div>
- <div className="flex flex-wrap gap-2">
- <Button variant="secondary" size="sm" disabled={busy} onClick={testModule}>
- {t('connections.browser.testModule')}
- </Button>
- <Button variant="secondary" size="sm" disabled={busy} onClick={testBrowser}>
- {t('connections.browser.testBrowser')}
- </Button>
- </div>
+ const body = (
+ <div className="max-w-5xl space-y-4 text-sm text-content">
+ <Alert variant="warning" role={undefined}>
+ <AlertDescription>{t('connections.earlyAlphaNotice')}</AlertDescription>
+ </Alert>
+ <Card title={t('connections.browser.module')} padded divided={false}>
+ <div className="flex flex-wrap items-center justify-between gap-4">
+ <div className="flex flex-wrap items-center gap-3">
+ <Badge variant={module?.state === 'ready' ? 'success' : 'neutral'}>
+ {module?.state ?? t('connections.browser.unknown')}
+ </Badge>
+ <span className="text-content-muted">{t('connections.browser.chrome')}</span>
+ <Badge
+ variant={
+ chromeReady === true ? 'success' : chromeReady === false ? 'warning' : 'neutral'
+ }>
+ {chromeReady === true
+ ? t('connections.browser.chromeReady')
+ : chromeReady === false
+ ? t('connections.browser.chromeNotReady')
+ : t('connections.browser.notVerified')}
+ </Badge>
</div>
- {module?.detail && <p className="mt-3 text-content-muted">{module.detail}</p>}
- <p className="mt-3 text-xs text-content-muted">
- {t('connections.browser.localOverride')}
- </p>
- </Card>
+ <div className="flex flex-wrap gap-2">
+ <Button variant="secondary" size="sm" disabled={busy} onClick={testModule}>
+ {t('connections.browser.testModule')}
+ </Button>
+ <Button variant="secondary" size="sm" disabled={busy} onClick={testBrowser}>
+ {t('connections.browser.testBrowser')}
+ </Button>
+ </div>
+ </div>
+ {module?.detail && <p className="mt-3 text-content-muted">{module.detail}</p>}
+ <p className="mt-3 text-xs text-content-muted">{t('connections.browser.localOverride')}</p>
+ </Card>
- <div className="grid gap-4 lg:grid-cols-2">
- <Card title={t('connections.tabs.browser')} padded divided={false}>
- <div className="space-y-5">
- <div className="flex items-center justify-between gap-4">
- <Label htmlFor="browser-enabled">{t('connections.browser.enabled')}</Label>
- <Switch
- id="browser-enabled"
- checked={settings.enabled}
- onCheckedChange={enabled => setSettings(current => ({ ...current, enabled }))}
- />
- </div>
- <div className="flex items-center justify-between gap-4">
- <Label htmlFor="browser-headless">{t('connections.browser.headless')}</Label>
- <Switch
- id="browser-headless"
- checked={settings.headless}
- onCheckedChange={headless => setSettings(current => ({ ...current, headless }))}
- />
- </div>
- <div className="grid gap-4 sm:grid-cols-2">
- {field('viewport_width', t('connections.browser.width'), 'number')}
- {field('viewport_height', t('connections.browser.height'), 'number')}
- </div>
+ <div className="grid gap-4 lg:grid-cols-2">
+ <Card title={t('connections.tabs.browser')} padded divided={false}>
+ <div className="space-y-5">
+ <div className="flex items-center justify-between gap-4">
+ <Label htmlFor="browser-enabled">{t('connections.browser.enabled')}</Label>
+ <Switch
+ id="browser-enabled"
+ checked={settings.enabled}
+ onCheckedChange={enabled => setSettings(current => ({ ...current, enabled }))}
+ />
</div>
- </Card>
-
- <Card title={t('connections.browser.profileMode')} padded divided={false}>
- <div className="space-y-4">
- <div className="space-y-1.5">
- <Label htmlFor="browser-profile-mode">{t('connections.browser.profileMode')}</Label>
- <NativeSelect
- id="browser-profile-mode"
- className="w-full"
- value={settings.profile_mode ?? 'fresh'}
- onChange={event =>
- setSettings(current => ({
- ...current,
- profile_mode: event.target.value as 'fresh' | 'persistent',
- }))
- }>
- <option value="fresh">{t('connections.browser.fresh')}</option>
- <option value="persistent">{t('connections.browser.persistent')}</option>
- </NativeSelect>
- </div>
- {settings.profile_mode === 'persistent' &&
- field('profile_path', t('connections.browser.profilePath'))}
- {field('chrome_path', t('connections.browser.chromePath'))}
- {field('download_dir', t('connections.browser.downloadDir'))}
+ <div className="flex items-center justify-between gap-4">
+ <Label htmlFor="browser-headless">{t('connections.browser.headless')}</Label>
+ <Switch
+ id="browser-headless"
+ checked={settings.headless}
+ onCheckedChange={headless => setSettings(current => ({ ...current, headless }))}
+ />
</div>
- </Card>
-
- <Card title={t('connections.browser.maxSteps')} padded divided={false}>
<div className="grid gap-4 sm:grid-cols-2">
- {field('max_task_steps', t('connections.browser.maxSteps'), 'number')}
- {field('task_timeout_secs', t('connections.browser.timeout'), 'number')}
+ {field('viewport_width', t('connections.browser.width'), 'number')}
+ {field('viewport_height', t('connections.browser.height'), 'number')}
</div>
- <p className="mt-4 text-xs text-content-muted">
- {t('connections.browser.testInConversation')}
- </p>
- </Card>
+ </div>
+ </Card>
- <Card title={t('connections.browser.allowedWebsites')} padded divided={false}>
- <p className="text-content-muted">{t('connections.browser.sharedPolicy')}</p>
- <p className="mt-3 break-words font-medium">
- {allowedDomains.length
- ? allowedDomains.join(', ')
- : t('connections.browser.noneAllowed')}
- </p>
- <Button asChild variant="tertiary" size="sm" className="mt-3 px-0">
- <Link to="/connections?tab=search">{t('connections.browser.manageWebsites')}</Link>
- </Button>
- </Card>
- </div>
+ <Card title={t('connections.browser.profileMode')} padded divided={false}>
+ <div className="space-y-4">
+ <div className="space-y-1.5">
+ <Label htmlFor="browser-profile-mode">{t('connections.browser.profileMode')}</Label>
+ <NativeSelect
+ id="browser-profile-mode"
+ className="w-full"
+ value={settings.profile_mode ?? 'fresh'}
+ onChange={event =>
+ setSettings(current => ({
+ ...current,
+ profile_mode: event.target.value as 'fresh' | 'persistent',
+ }))
+ }>
+ <option value="fresh">{t('connections.browser.fresh')}</option>
+ <option value="persistent">{t('connections.browser.persistent')}</option>
+ </NativeSelect>
+ </div>
+ {settings.profile_mode === 'persistent' &&
+ field('profile_path', t('connections.browser.profilePath'))}
+ {field('chrome_path', t('connections.browser.chromePath'))}
+ {field('download_dir', t('connections.browser.downloadDir'))}
+ </div>
+ </Card>
- <div className="flex flex-wrap items-center justify-between gap-3">
- <p className="text-content-muted">
- {t('connections.browser.jevRoute')}:{' '}
- <span className="font-medium text-content">{agenticRoute}</span>
+ <Card title={t('connections.browser.maxSteps')} padded divided={false}>
+ <div className="grid gap-4 sm:grid-cols-2">
+ {field('max_task_steps', t('connections.browser.maxSteps'), 'number')}
+ {field('task_timeout_secs', t('connections.browser.timeout'), 'number')}
+ </div>
+ <p className="mt-4 text-xs text-content-muted">
+ {t('connections.browser.testInConversation')}
</p>
- <Button disabled={busy} onClick={save}>
- {t('connections.browser.save')}
+ </Card>
+
+ <Card title={t('connections.browser.allowedWebsites')} padded divided={false}>
+ <p className="text-content-muted">{t('connections.browser.sharedPolicy')}</p>
+ <p className="mt-3 break-words font-medium">
+ {allowedDomains.length
+ ? allowedDomains.join(', ')
+ : t('connections.browser.noneAllowed')}
+ </p>
+ <Button asChild variant="tertiary" size="sm" className="mt-3 px-0">
+ <Link to="/connections?tab=search">{t('connections.browser.manageWebsites')}</Link>
</Button>
- </div>
- {message && (
- <Alert variant="info" role="status">
- <AlertDescription>{message}</AlertDescription>
- </Alert>
- )}
+ </Card>
</div>
+
+ <div className="flex flex-wrap items-center justify-between gap-3">
+ <p className="text-content-muted">
+ {t('connections.browser.jevRoute')}:{' '}
+ <span className="font-medium text-content">{agenticRoute}</span>
+ </p>
+ <Button disabled={busy} onClick={save}>
+ {t('connections.browser.save')}
+ </Button>
+ </div>
+ {message && (
+ <Alert variant="info" role="status">
+ <AlertDescription>{message}</AlertDescription>
+ </Alert>
+ )}
+ </div>
+ );
+
+ if (embedded) return body;
+
+ return (
+ <SettingsTabbedPage
+ title={t('connections.tabs.browser')}
+ description={t('connections.browser.description')}>
+ {body}
</SettingsTabbedPage>
);
}
diff --git a/app/src/utils/tauriCommands/config.ts b/app/src/utils/tauriCommands/config.ts
index f6d00cac05..8b0d3299e6 100644
--- a/app/src/utils/tauriCommands/config.ts
+++ b/app/src/utils/tauriCommands/config.ts
@@ -151,7 +151,7 @@ export interface RuntimeSettingsUpdate {
export interface BrowserSettingsUpdate {
enabled?: boolean | null;
- backend?: 'tinybrowser' | null;
+ backend?: 'tinycomputer' | null;
headless?: boolean;
viewport_width?: number;
viewport_height?: number;
diff --git a/crates/openhuman-core/Cargo.toml b/crates/openhuman-core/Cargo.toml
index 21e8a1fdca..41cf8ef341 100644
--- a/crates/openhuman-core/Cargo.toml
+++ b/crates/openhuman-core/Cargo.toml
@@ -333,10 +333,7 @@ tinychannels = { version = "0.1", features = ["relay-websocket"], optional = tru
# never loads a module. The kernel-floor ratchet catches exactly that, and did.
tinybus = { path = "../../vendor/tinybus/crates/tinybus", default-features = false, features = ["macros", "uds"] }
tinysearch-bus = { path = "../../vendor/tinysearch/crates/tinysearch-bus" }
-tinycomputer-bus = { path = "../../vendor/tinydesktop/crates/tinycomputer-bus", optional = true }
-tinybrowser-bus = { path = "../../vendor/tinybrowser/crates/tinybrowser-bus" }
-tinybrowser-control = { path = "../../vendor/tinybrowser/crates/tinybrowser-control", default-features = false }
-tinyjevclient = { path = "../../vendor/tinybrowser/vendor/tinyjevclient/crates/tinyjevclient" }
+tinycomputer-bus = { path = "../../vendor/tinycomputer/crates/tinycomputer-bus", optional = true }
# Portable skill metadata, parsing, discovery, and filesystem hardening.
tinyskills = { path = "../../vendor/tinyskills/crates/tinyskills" }
serde = { version = "1", features = ["derive"] }
diff --git a/crates/openhuman-core/src/config/ops/loader/snapshot.rs b/crates/openhuman-core/src/config/ops/loader/snapshot.rs
index 1d18ec468f..afd8f6e2ba 100644
--- a/crates/openhuman-core/src/config/ops/loader/snapshot.rs
+++ b/crates/openhuman-core/src/config/ops/loader/snapshot.rs
@@ -16,10 +16,7 @@ pub fn snapshot_config_json(config: &Config) -> Result<serde_json::Value, String
}
value["seltz"]["api_key"] = serde_json::Value::Null;
#[cfg(feature = "modules")]
- let browser_billing_route = match crate::modules::browser_task::billing_route(config) {
- crate::modules::browser_task::BillingRoute::DirectOpenRouter => "direct_openrouter",
- crate::modules::browser_task::BillingRoute::Hosted => "hosted",
- };
+ let browser_billing_route = crate::modules::desktop::billing_route(config);
#[cfg(not(feature = "modules"))]
let browser_billing_route = "unavailable";
Ok(json!({
diff --git a/crates/openhuman-core/src/config/ops/ui.rs b/crates/openhuman-core/src/config/ops/ui.rs
index 80d4679984..7097651ef6 100644
--- a/crates/openhuman-core/src/config/ops/ui.rs
+++ b/crates/openhuman-core/src/config/ops/ui.rs
@@ -137,7 +137,10 @@ fn nonempty(value: String) -> Option<String> {
fn normalize_browser_backend(raw: &str) -> Result<String, String> {
let key = raw.trim().to_ascii_lowercase().replace('-', "_");
match key.as_str() {
- "tinybrowser" | "tiny_browser" => Ok("tinybrowser".to_string()),
+ // TinyBrowser was folded into TinyComputer; old values migrate.
+ "tinycomputer" | "tiny_computer" | "tinybrowser" | "tiny_browser" => {
+ Ok("tinycomputer".to_string())
+ }
"agent_browser" | "agentbrowser" => Ok("agent_browser".to_string()),
"playwright" => Ok("playwright".to_string()),
"rust_native" | "native" => Ok("rust_native".to_string()),
diff --git a/crates/openhuman-core/src/config/schema/computer.rs b/crates/openhuman-core/src/config/schema/computer.rs
new file mode 100644
index 0000000000..76ce224ecf
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/computer.rs
@@ -0,0 +1,52 @@
+//! TinyComputer model selection: the decision model that picks each step,
+//! and the reasoning models that plan a task and rescue a failed step.
+
+use schemars::JsonSchema;
+use serde::{Deserialize, Serialize};
+
+/// The model family that decides each desktop or browser step.
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
+#[serde(rename_all = "snake_case")]
+pub enum DecisionModel {
+ /// Jev, through TinyHumans (signed in) or the user's OpenRouter key.
+ #[default]
+ Jev,
+ /// OpenJev, the open Jev endpoint; needs an `openjev` credential.
+ OpenJev,
+ /// Levanto Sage; needs a `sage` credential.
+ Sage,
+}
+
+impl DecisionModel {
+ /// The stable wire spelling, as the module config and the UI use it.
+ #[must_use]
+ pub const fn as_str(self) -> &'static str {
+ match self {
+ Self::Jev => "jev",
+ Self::OpenJev => "open_jev",
+ Self::Sage => "sage",
+ }
+ }
+}
+
+#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
+#[serde(default)]
+pub struct ComputerConfig {
+ /// Which decision model TinyComputer asks for each step.
+ pub decision_model: DecisionModel,
+ /// Sage's fast mode: quicker, less deliberate decisions.
+ pub sage_fast: bool,
+ /// Model that turns a plain-language task into a flow. `None` keeps the
+ /// module's default.
+ pub planner_model: Option<String>,
+ /// Model a failed step is handed to for guidance before the task fails.
+ /// `None` keeps the module's default.
+ pub rescue_model: Option<String>,
+ /// How many times one task may be rescued; `0` turns rescue off and
+ /// `None` keeps the module's default (5, also its maximum).
+ pub max_rescues: Option<u32>,
+}
+
+#[cfg(test)]
+#[path = "computer_tests.rs"]
+mod tests;
diff --git a/crates/openhuman-core/src/config/schema/computer_tests.rs b/crates/openhuman-core/src/config/schema/computer_tests.rs
new file mode 100644
index 0000000000..1b80528736
--- /dev/null
+++ b/crates/openhuman-core/src/config/schema/computer_tests.rs
@@ -0,0 +1,29 @@
+use super::*;
+
+#[test]
+fn defaults_to_jev_and_module_models() {
+ let config = ComputerConfig::default();
+ assert_eq!(config.decision_model, DecisionModel::Jev);
+ assert!(!config.sage_fast);
+ assert_eq!(config.rescue_model, None);
+ assert_eq!(config.max_rescues, None);
+}
+
+#[test]
+fn parses_every_decision_model_and_rescue_settings() {
+ for (raw, model) in [
+ ("jev", DecisionModel::Jev),
+ ("open_jev", DecisionModel::OpenJev),
+ ("sage", DecisionModel::Sage),
+ ] {
+ let config: ComputerConfig = toml::from_str(&format!(
+ "decision_model = \"{raw}\"\nrescue_model = \"openai/gpt-6-luna\"\nmax_rescues = 0"
+ ))
+ .unwrap();
+ assert_eq!(config.decision_model, model);
+ assert_eq!(model.as_str(), raw);
+ assert_eq!(config.rescue_model.as_deref(), Some("openai/gpt-6-luna"));
+ assert_eq!(config.max_rescues, Some(0));
+ }
+ assert!(toml::from_str::<ComputerConfig>("decision_model = \"jet\"").is_err());
+}
diff --git a/crates/openhuman-core/src/config/schema/mod.rs b/crates/openhuman-core/src/config/schema/mod.rs
index be41a5c8e7..27cf866420 100644
--- a/crates/openhuman-core/src/config/schema/mod.rs
+++ b/crates/openhuman-core/src/config/schema/mod.rs
@@ -18,6 +18,8 @@ mod channels;
mod cli_overrides;
#[doc(hidden)]
pub use cli_overrides::AppliedInferenceOverride;
+mod computer;
+pub use computer::{ComputerConfig, DecisionModel};
mod context;
mod dashboard;
mod desktop;
diff --git a/crates/openhuman-core/src/config/schema/tools/browser.rs b/crates/openhuman-core/src/config/schema/tools/browser.rs
index 2f2dfeed2d..e44854020e 100644
--- a/crates/openhuman-core/src/config/schema/tools/browser.rs
+++ b/crates/openhuman-core/src/config/schema/tools/browser.rs
@@ -109,7 +109,7 @@ fn default_true() -> bool {
}
fn default_browser_backend() -> String {
- "tinybrowser".into()
+ "tinycomputer".into()
}
fn default_browser_webdriver_url() -> String {
diff --git a/crates/openhuman-core/src/config/schema/types/config.rs b/crates/openhuman-core/src/config/schema/types/config.rs
index e8797ace6d..5940f4e742 100644
--- a/crates/openhuman-core/src/config/schema/types/config.rs
+++ b/crates/openhuman-core/src/config/schema/types/config.rs
@@ -136,6 +136,10 @@ pub struct Config {
#[serde(default)]
pub desktop: DesktopConfig,
+ /// TinyComputer decision, planner and rescue models.
+ #[serde(default)]
+ pub computer: ComputerConfig,
+
/// Host-level switches for the configurable hook system. The hooks
/// themselves live in `hooks.json` files, not here — see
/// [`HooksConfig`].
diff --git a/crates/openhuman-core/src/config/schema/types/defaults.rs b/crates/openhuman-core/src/config/schema/types/defaults.rs
index f3a5153927..5460060b4a 100644
--- a/crates/openhuman-core/src/config/schema/types/defaults.rs
+++ b/crates/openhuman-core/src/config/schema/types/defaults.rs
@@ -44,6 +44,7 @@ impl Default for Config {
dashboard: DashboardConfig::default(),
autonomy: AutonomyConfig::default(),
desktop: DesktopConfig::default(),
+ computer: ComputerConfig::default(),
hooks: HooksConfig::default(),
privacy: PrivacyConfig::default(),
sandbox: SandboxConfig::default(),
diff --git a/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs b/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs
index c456b4dccc..05e2fbf981 100644
--- a/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs
+++ b/crates/openhuman-core/src/config/schemas/schema_defs/agent.rs
@@ -113,7 +113,7 @@ pub(super) fn lookup(function: &str) -> Option<ControllerSchema> {
optional_bool("enabled", "Enable browser integration."),
optional_string(
"backend",
- "Browser backend: tinybrowser (legacy values accepted for migration).",
+ "Browser backend: tinycomputer (legacy values, including tinybrowser, accepted for migration).",
),
optional_bool("headless", "Run Chrome without a visible window."),
optional_number("viewport_width", "Chrome viewport width in pixels (320-3840)."),
diff --git a/crates/openhuman-core/src/modules/browser.rs b/crates/openhuman-core/src/modules/browser.rs
index 0965ab028e..155cd66c5c 100644
--- a/crates/openhuman-core/src/modules/browser.rs
+++ b/crates/openhuman-core/src/modules/browser.rs
@@ -1,22 +1,28 @@
-//! Host adapter for the loadable TinyBrowser module.
+//! Host adapter for the browser members of the loadable TinyComputer module.
+//!
+//! TinyComputer serves its browser members (`BrowserOpenSession`,
+//! `BrowserNavigate`, ...) on the same interface as its desktop members, so
+//! this adapter shares the desktop adapter's proxy, which loads the module and
+//! refreshes its private configuration before a call.
use std::sync::Arc;
use serde::{de::DeserializeOwned, Serialize};
-use tinybrowser_bus::{
- names, Action, ActionOutcome, DownloadInfo, DownloadWaitRequest, NavigateRequest, PageState,
- PageText, ReadRequest, SessionId, SessionInfo, SessionOptions, Snapshot, SnapshotRequest,
- Viewport,
+use tinycomputer_bus::agent::Capabilities;
+use tinycomputer_bus::browser::{
+ names, Action, ActionOutcome, DownloadInfo, DownloadWaitRequest, NavigateRequest, PageState, PageText,
+ ReadRequest, SessionId, SessionInfo, SessionOptions, SessionRef, SessionRequest, Snapshot,
+ SnapshotRequest, Viewport,
};
+use tinycomputer_bus::DesktopResponse;
-use super::{host, ops, registry};
use crate::config::Config;
-pub const MODULE_ID: &str = "tinybrowser";
+pub const MODULE_ID: &str = super::desktop::MODULE_ID;
#[derive(Debug, thiserror::Error)]
pub enum BrowserCallError {
- #[error("TinyBrowser unavailable: {0}")]
+ #[error("TinyComputer browser unavailable: {0}")]
Unavailable(String),
#[error("browser request blocked: {0}")]
Policy(String),
@@ -31,9 +37,32 @@ impl BrowserCallError {
message: error.to_string(),
}
}
+
+ /// A failed reply names its error in `details.name` (the
+ /// `ai.tinyhumans.tinycomputer.Browser.Error.*` spelling); older replies
+ /// carry only the envelope code.
+ fn from_response(response: &DesktopResponse) -> Self {
+ let Some(error) = response.error.as_ref() else {
+ return Self::Bus {
+ name: "ModuleFailed".into(),
+ message: format!("{} failed without an error", response.command),
+ };
+ };
+ let name = error
+ .details
+ .as_ref()
+ .and_then(|details| details.get("name"))
+ .and_then(serde_json::Value::as_str)
+ .map(|name| name.rsplit('.').next().unwrap_or(name).to_owned())
+ .unwrap_or_else(|| error.code.clone());
+ Self::Bus {
+ name,
+ message: error.message.clone(),
+ }
+ }
}
-/// A TinyBrowser connection that applies this host's settings and shared web policy.
+/// A TinyComputer browser connection that applies this host's settings and shared web policy.
#[derive(Clone)]
pub struct BrowserClient {
config: Arc<Config>,
@@ -49,21 +78,27 @@ impl BrowserClient {
}
pub async fn ensure_ready(&self) -> Result<(), BrowserCallError> {
- ops::ensure_loaded(&self.config, MODULE_ID)
- .await
- .map_err(BrowserCallError::Unavailable)?;
let version = self.contract_version().await?;
- if !tinybrowser_bus::is_compatible(version) {
+ if !tinycomputer_bus::is_compatible(version) {
return Err(BrowserCallError::Unavailable(format!(
- "incompatible TinyBrowser contract: module {version:?}, host {:?}",
- tinybrowser_bus::CONTRACT_VERSION
+ "incompatible TinyComputer contract: module {version:?}, host {:?}",
+ tinycomputer_bus::CONTRACT_VERSION
)));
}
Ok(())
}
+ /// The module's contract version, from `Describe` (which answers raw
+ /// [`Capabilities`], not an envelope).
pub async fn contract_version(&self) -> Result<(u32, u32), BrowserCallError> {
- self.call(names::methods::CONTRACT_VERSION, ()).await
+ let proxy = super::desktop::proxy(&self.config)
+ .await
+ .map_err(BrowserCallError::Unavailable)?;
+ let capabilities: Capabilities = proxy
+ .call(tinycomputer_bus::agent::names::methods::DESCRIBE, ())
+ .await
+ .map_err(BrowserCallError::from_bus)?;
+ Ok(capabilities.contract_version)
}
pub async fn open_session(
@@ -117,7 +152,7 @@ impl BrowserClient {
options.default_timeout_ms = browser.task_timeout_secs.saturating_mul(1000);
options.allowed_origins =
origin.map_or_else(|| self.browser_origins(), |origin| vec![origin]);
- self.call(names::methods::OPEN_SESSION, (options,)).await
+ self.call(names::methods::OPEN_SESSION, options).await
}
/// Open a session bound to the host tree of an explicit destination.
@@ -155,7 +190,7 @@ impl BrowserClient {
) -> Result<PageState, BrowserCallError> {
self.check_url(&request.url)?;
let page: PageState = self
- .call(names::methods::NAVIGATE, (session, request))
+ .call(names::methods::NAVIGATE, SessionRequest::new(session.clone(), request))
.await?;
self.check_returned_url(&page.url)?;
Ok(page)
@@ -167,7 +202,7 @@ impl BrowserClient {
request: SnapshotRequest,
) -> Result<Snapshot, BrowserCallError> {
let snapshot: Snapshot = self
- .call(names::methods::SNAPSHOT, (session, request))
+ .call(names::methods::SNAPSHOT, SessionRequest::new(session.clone(), request))
.await?;
self.check_returned_url(&snapshot.url)?;
Ok(snapshot)
@@ -179,7 +214,7 @@ impl BrowserClient {
action: Action,
) -> Result<ActionOutcome, BrowserCallError> {
let outcome: ActionOutcome = self
- .call(names::methods::PERFORM, (session, action))
+ .call(names::methods::PERFORM, SessionRequest::new(session.clone(), action))
.await?;
self.check_returned_url(&outcome.page.url)?;
Ok(outcome)
@@ -191,7 +226,7 @@ impl BrowserClient {
request: ReadRequest,
) -> Result<PageText, BrowserCallError> {
let page: PageText = self
- .call(names::methods::READ_PAGE, (session, request))
+ .call(names::methods::READ_PAGE, SessionRequest::new(session.clone(), request))
.await?;
self.check_returned_url(&page.url)?;
Ok(page)
@@ -201,7 +236,8 @@ impl BrowserClient {
&self,
session: &SessionId,
) -> Result<Vec<DownloadInfo>, BrowserCallError> {
- self.call(names::methods::LIST_DOWNLOADS, (session,)).await
+ self.call(names::methods::LIST_DOWNLOADS, session_ref(session))
+ .await
}
pub async fn wait_download(
@@ -209,12 +245,18 @@ impl BrowserClient {
session: &SessionId,
request: DownloadWaitRequest,
) -> Result<DownloadInfo, BrowserCallError> {
- self.call(names::methods::WAIT_DOWNLOAD, (session, request))
+ self.call(
+ names::methods::WAIT_DOWNLOAD,
+ SessionRequest::new(session.clone(), request),
+ )
.await
}
pub async fn close_session(&self, session: &SessionId) -> Result<(), BrowserCallError> {
- self.call(names::methods::CLOSE_SESSION, (session,)).await
+ let _closed: serde_json::Value = self
+ .call(names::methods::CLOSE_SESSION, session_ref(session))
+ .await?;
+ Ok(())
}
pub(crate) fn check_url(&self, raw: &str) -> Result<(), BrowserCallError> {
@@ -284,13 +326,20 @@ impl BrowserClient {
.collect()
}
+ /// Origins a TinyComputer task may load: the allowed websites, in the
+ /// module's `https://.host` spelling. Empty when none are allowed, which a
+ /// task refuses, since an empty list means any origin to the module.
+ pub(crate) fn task_origins(&self) -> Vec<String> {
+ self.browser_origins()
+ }
+
fn browser_origins(&self) -> Vec<String> {
self.browser_origins_for_mode(browser_allow_all())
}
fn browser_origins_for_mode(&self, allow_all: bool) -> Vec<String> {
if allow_all {
- // A nonempty, unmatchable origin keeps TinyBrowser's document
+ // A nonempty, unmatchable origin keeps TinyComputer's document
// guard active before the caller supplies an explicit URL.
return vec!["https://.".to_owned()];
}
@@ -306,23 +355,36 @@ impl BrowserClient {
.collect()
}
- async fn call<A: Serialize, R: DeserializeOwned>(
+ async fn call<A: Serialize + Send, R: DeserializeOwned>(
&self,
member: &str,
- args: A,
+ request: A,
) -> Result<R, BrowserCallError> {
- let record = registry::find(MODULE_ID)
- .ok_or_else(|| BrowserCallError::Unavailable("TinyBrowser is not registered".into()))?;
- let runtime = host::runtime()
+ let proxy = super::desktop::proxy(&self.config)
.await
- .map_err(|_| BrowserCallError::Unavailable("the module bus is not running".into()))?;
- let proxy = runtime
- .proxy(record.bus_name, record.object_path)
- .map_err(BrowserCallError::from_bus)?;
- proxy
- .call(member, args)
+ .map_err(BrowserCallError::Unavailable)?;
+ tracing::debug!(member, "[browser] tinycomputer call");
+ let response: DesktopResponse = proxy
+ .call(member, (request,))
.await
- .map_err(BrowserCallError::from_bus)
+ .map_err(BrowserCallError::from_bus)?;
+ if !response.ok {
+ let error = BrowserCallError::from_response(&response);
+ tracing::debug!(member, error = %error, "[browser] tinycomputer call failed");
+ return Err(error);
+ }
+ serde_json::from_value(response.data.unwrap_or(serde_json::Value::Null)).map_err(|error| {
+ BrowserCallError::Bus {
+ name: "InvalidReply".into(),
+ message: format!("{member} returned an unexpected reply: {error}"),
+ }
+ })
+ }
+}
+
+fn session_ref(session: &SessionId) -> SessionRef {
+ SessionRef {
+ session: session.clone(),
}
}
@@ -368,40 +430,6 @@ fn private_or_local(host: &str) -> bool {
}
}
-impl tinybrowser_control::BrowserControl for BrowserClient {
- async fn snapshot(
- &self,
- session: &SessionId,
- request: &SnapshotRequest,
- ) -> Result<Snapshot, tinybrowser_control::BrowserControlError> {
- BrowserClient::snapshot(self, session, request.clone())
- .await
- .map_err(control_error)
- }
-
- async fn perform(
- &self,
- session: &SessionId,
- action: &Action,
- ) -> Result<ActionOutcome, tinybrowser_control::BrowserControlError> {
- BrowserClient::perform(self, session, action.clone())
- .await
- .map_err(control_error)
- }
-}
-
-fn control_error(error: BrowserCallError) -> tinybrowser_control::BrowserControlError {
- let name = match &error {
- BrowserCallError::Bus { name, .. } => name.clone(),
- BrowserCallError::Policy(_) => "PolicyDenied".into(),
- BrowserCallError::Unavailable(_) => "ModuleUnavailable".into(),
- };
- tinybrowser_control::BrowserControlError {
- name,
- message: error.to_string(),
- }
-}
-
#[cfg(test)]
#[path = "browser_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/modules/browser_task.rs b/crates/openhuman-core/src/modules/browser_task.rs
index 2bc5ace635..76c21b64c3 100644
--- a/crates/openhuman-core/src/modules/browser_task.rs
+++ b/crates/openhuman-core/src/modules/browser_task.rs
@@ -1,102 +1,185 @@
-//! Jev browser tasks, billed through the configured agentic route.
+//! Browser tasks run by TinyComputer's task members.
//!
-//! The controller links only the browser bus contract. `BrowserClient` supplies
-//! its browser port, while the same credential routing as other agentic work
-//! chooses direct OpenRouter or the hosted TinyHumans System One proxy.
+//! A task is handed to the module with `StartTask` and followed with
+//! `AwaitTask` until it finishes or pauses. The module drives its own browser
+//! session, asks its decision model (Jev, OpenJev or Sage) for each step, and
+//! hands a failed step to its rescue model before giving up. The host keeps
+//! the policy: which surfaces and origins a task may touch, how many actions
+//! it may take, and the approval for anything irreversible, which the module
+//! surfaces as `needs_approval` and only `ContinueTask.approve` releases.
-use std::time::Duration;
+use std::collections::BTreeMap;
+use std::time::{Duration, Instant};
-use tinybrowser_bus::SessionId;
-use tinybrowser_control::{BrowserControl, ControlLimits, JevController, TaskRequest, TaskResult};
-use tinyjevclient::{Client, ClientConfig};
+use serde::{de::DeserializeOwned, Serialize};
+use tinycomputer_bus::agent::{
+ names::methods, AgentResponse, AwaitTaskRequest, ContinueTaskRequest, PaymentMode,
+ StartTaskRequest, SurfaceKind, TaskBudget, TaskConstraints, TaskId, TaskRef, TaskView,
+};
use crate::config::Config;
-use crate::inference::provider::factory::{lookup_key_for_slug, provider_for_role};
-use crate::security::credentials::session_support::direct_backend_credential;
#[cfg(test)]
#[path = "browser_task_tests.rs"]
mod tests;
-/// The account charged for Jev decisions in a browser task.
-#[derive(Clone, Copy, Debug, Eq, PartialEq)]
-pub enum BillingRoute {
- /// The user's configured OpenRouter credential.
- DirectOpenRouter,
- /// OpenHuman's hosted System One proxy and managed credits.
- Hosted,
+/// The longest one `AwaitTask` long-poll asks for. The module caps it at 60s.
+const AWAIT_SLICE_MS: u64 = 30_000;
+/// The bus deadline for one call; beyond the longest long-poll.
+const CALL_TIMEOUT: Duration = Duration::from_secs(75);
+
+/// What the browser tool asks for.
+#[derive(Debug, Clone, Default)]
+pub struct BrowserTask {
+ /// The goal, in plain language.
+ pub goal: String,
+ /// Values the task may use, such as a name or an email address.
+ pub facts: BTreeMap<String, String>,
+ /// Origins the task's browser may load, in TinyComputer's
+ /// `https://.host` spelling. Never empty: empty means any origin.
+ pub origins: Vec<String>,
+ /// Upper bound on the actions the task may take.
+ pub max_actions: u32,
}
-/// Resolve the browser decision route from the configured agentic provider.
+/// Build the `StartTask` request for a browser-only task under host policy.
#[must_use]
-pub fn billing_route(config: &Config) -> BillingRoute {
- let agentic = provider_for_role("agentic", config);
- if agentic.starts_with("openrouter:") {
- BillingRoute::DirectOpenRouter
- } else {
- BillingRoute::Hosted
+pub fn start_request(config: &Config, task: &BrowserTask) -> StartTaskRequest {
+ StartTaskRequest {
+ task: Some(task.goal.clone()),
+ facts: task.facts.clone(),
+ constraints: TaskConstraints {
+ payment: PaymentMode::StopAtPayment,
+ surfaces: vec![SurfaceKind::Browser],
+ origins: task.origins.clone(),
+ allow_destructive: false,
+ browser_endpoint: None,
+ headed: !config.browser.headless,
+ },
+ budget: TaskBudget {
+ max_actions: Some(task.max_actions),
+ max_elapsed_ms: Some(config.browser.task_timeout_secs.saturating_mul(1000)),
+ max_rescues: config.computer.max_rescues,
+ ..TaskBudget::default()
+ },
+ ..StartTaskRequest::default()
}
}
-fn jev_client(config: &Config) -> Result<Client, String> {
- let client_config = match billing_route(config) {
- BillingRoute::DirectOpenRouter => {
- let key = lookup_key_for_slug("openrouter", config)
- .map_err(|_| "OpenRouter agentic credential is unavailable".to_owned())?;
- if key.trim().is_empty() {
- return Err("OpenRouter agentic credential is unavailable".to_owned());
- }
- ClientConfig::openrouter(key)
- }
- BillingRoute::Hosted => {
- // The hosted route reaches the backend host directly (not through
- // the transport port): without a TinyHumans connection or a usable
- // credential there is nothing to call, so refuse before any request.
- let credential = direct_backend_credential(config, "browser task (hosted jev)")
- .ok_or_else(|| "TinyHumans credential is unavailable".to_owned())?;
- let mut client_config = ClientConfig::tinyhumans_openrouter(credential.into_secret());
- client_config.base_url = crate::backend::base_url(&config.api_url)
- .map_err(|_| "TinyHumans backend is unavailable".to_owned())?;
- client_config
- }
- };
- Client::new(client_config).map_err(|_| "Jev client configuration is invalid".to_owned())
+/// Start a browser task and follow it until it pauses, finishes, or the host
+/// deadline passes (then the view still says `running`).
+///
+/// # Errors
+///
+/// Returns a module, transport, or task error without page content.
+pub async fn start(config: &Config, task: &BrowserTask) -> Result<TaskView, String> {
+ if task.origins.is_empty() {
+ return Err("a browser task needs at least one allowed origin".to_owned());
+ }
+ let request = start_request(config, task);
+ tracing::debug!(
+ origins = task.origins.len(),
+ max_actions = task.max_actions,
+ "[browser-task] starting"
+ );
+ let view: TaskView = call(config, methods::START_TASK, request, true).await?;
+ follow(config, view).await
}
-/// Run a bounded task in an existing browser session.
+/// Answer a paused task and follow it again.
+///
+/// # Errors
+///
+/// Returns a module, transport, or task error.
+pub async fn resume(config: &Config, request: ContinueTaskRequest) -> Result<TaskView, String> {
+ tracing::debug!(task = %request.id, approve = ?request.approve, "[browser-task] continuing");
+ let view: TaskView = call(config, methods::CONTINUE_TASK, request, true).await?;
+ follow(config, view).await
+}
+
+/// Keep following a task that was still running when the last call returned.
+///
+/// # Errors
///
-/// A consequential action returns `NeedsConfirmation` with an exact pending
-/// decision. The caller must obtain host confirmation before performing it.
+/// Returns a module, transport, or task error.
+pub async fn wait(config: &Config, id: TaskId) -> Result<TaskView, String> {
+ let view: TaskView = call(
+ config,
+ methods::AWAIT_TASK,
+ AwaitTaskRequest {
+ id,
+ timeout_ms: AWAIT_SLICE_MS,
+ },
+ false,
+ )
+ .await?;
+ follow(config, view).await
+}
+
+/// Cancel a task.
///
/// # Errors
///
-/// Returns a credential, provider, browser, or timeout error without exposing
-/// credentials or page content in the message.
-pub async fn run(
- browser: &impl BrowserControl,
+/// Returns a module or transport error.
+pub async fn cancel(config: &Config, id: TaskId) -> Result<TaskView, String> {
+ tracing::debug!(task = %id, "[browser-task] cancelling");
+ call(config, methods::CANCEL_TASK, TaskRef { id }, false).await
+}
+
+async fn follow(config: &Config, mut view: TaskView) -> Result<TaskView, String> {
+ let deadline =
+ Instant::now() + Duration::from_secs(config.browser.task_timeout_secs.max(1));
+ while matches!(view.status, tinycomputer_bus::agent::TaskStatus::Running) {
+ let left = deadline.saturating_duration_since(Instant::now());
+ if left.is_zero() {
+ tracing::debug!(task = %view.id, "[browser-task] host deadline reached while running");
+ break;
+ }
+ let timeout_ms = u64::try_from(left.as_millis())
+ .unwrap_or(u64::MAX)
+ .min(AWAIT_SLICE_MS);
+ view = call(
+ config,
+ methods::AWAIT_TASK,
+ AwaitTaskRequest {
+ id: view.id.clone(),
+ timeout_ms,
+ },
+ false,
+ )
+ .await?;
+ }
+ tracing::debug!(task = %view.id, progress = view.progress, "[browser-task] paused or finished");
+ Ok(view)
+}
+
+async fn call<Request: Serialize + Send, Reply: DeserializeOwned>(
config: &Config,
- session: &SessionId,
- task: TaskRequest,
- max_steps: usize,
-) -> Result<TaskResult, String> {
- let limits = ControlLimits {
- max_steps: max_steps.min(config.browser.max_task_steps),
- ..ControlLimits::default()
- };
- let controller = JevController::new(jev_client(config)?).with_limits(limits);
- let deadline = Duration::from_secs(config.browser.task_timeout_secs);
- tracing::debug!(route = ?billing_route(config), max_steps = limits.max_steps, "[browser-task] starting");
- tokio::time::timeout(deadline, controller.run(browser, session, &task))
- .await
- .map_err(|_| "browser task timed out".to_owned())?
- .map_err(|error| match error {
- tinybrowser_control::Error::InvalidTask { .. } => "invalid browser task".to_owned(),
- tinybrowser_control::Error::InvalidDecision { .. } => {
- "Jev returned an unusable browser decision".to_owned()
- }
- tinybrowser_control::Error::Provider { .. } => "Jev decision request failed".to_owned(),
- tinybrowser_control::Error::Browser { source } => {
- format!("browser operation failed: {}", source.wire_name())
- }
- })
+ member: &str,
+ request: Request,
+ confidential: bool,
+) -> Result<Reply, String> {
+ let proxy = super::desktop::proxy(config)
+ .await?
+ .with_timeout(CALL_TIMEOUT);
+ let response: AgentResponse<Reply> = if confidential {
+ proxy.call_confidential(member, (request,)).await
+ } else {
+ proxy.call(member, (request,)).await
+ }
+ .map_err(|error| format!("browser task {member} failed: {error}"))?;
+ unwrap_response(member, response)
+}
+
+fn unwrap_response<Reply>(member: &str, response: AgentResponse<Reply>) -> Result<Reply, String> {
+ match (response.ok, response.data, response.error) {
+ (true, Some(data), _) => Ok(data),
+ (_, _, Some(error)) => Err(format!(
+ "browser task {member} failed [{}]: {} {}",
+ error.code, error.message, error.hint
+ )
+ .trim_end()
+ .to_owned()),
+ _ => Err(format!("browser task {member} returned no result")),
+ }
}
diff --git a/crates/openhuman-core/src/modules/browser_task_tests.rs b/crates/openhuman-core/src/modules/browser_task_tests.rs
index 9a200241b6..f78085b80c 100644
--- a/crates/openhuman-core/src/modules/browser_task_tests.rs
+++ b/crates/openhuman-core/src/modules/browser_task_tests.rs
@@ -1,15 +1,68 @@
use super::*;
+use tinycomputer_bus::agent::AgentError;
+
+fn task() -> BrowserTask {
+ BrowserTask {
+ goal: "Find the opening hours".into(),
+ facts: BTreeMap::from([("name".into(), "Asha".into())]),
+ origins: vec!["https://.example.com".into()],
+ max_actions: 12,
+ }
+}
#[test]
-fn agentic_openrouter_uses_direct_billing() {
+fn start_request_confines_the_task_to_the_browser_under_host_policy() {
let mut config = Config::default();
- config.agentic_provider = Some("openrouter:some/model".to_owned());
- assert_eq!(billing_route(&config), BillingRoute::DirectOpenRouter);
+ config.browser.headless = false;
+ config.browser.task_timeout_secs = 90;
+ config.computer.max_rescues = Some(2);
+ let request = start_request(&config, &task());
+ assert_eq!(request.task.as_deref(), Some("Find the opening hours"));
+ assert_eq!(request.facts["name"], "Asha");
+ assert_eq!(request.constraints.surfaces, vec![SurfaceKind::Browser]);
+ assert_eq!(request.constraints.origins, vec!["https://.example.com"]);
+ assert_eq!(request.constraints.payment, PaymentMode::StopAtPayment);
+ assert!(!request.constraints.allow_destructive);
+ assert!(request.constraints.headed);
+ assert_eq!(request.budget.max_actions, Some(12));
+ assert_eq!(request.budget.max_elapsed_ms, Some(90_000));
+ assert_eq!(request.budget.max_rescues, Some(2));
+}
+
+#[tokio::test]
+async fn start_refuses_a_task_without_origins() {
+ let mut empty = task();
+ empty.origins.clear();
+ let error = start(&Config::default(), &empty).await.unwrap_err();
+ assert!(error.contains("allowed origin"), "{error}");
}
#[test]
-fn other_agentic_routes_use_hosted_billing() {
- let mut config = Config::default();
- config.agentic_provider = Some("openhuman".to_owned());
- assert_eq!(billing_route(&config), BillingRoute::Hosted);
+fn unwrap_response_returns_data_or_the_structured_error() {
+ let ok = AgentResponse {
+ ok: true,
+ data: Some(7),
+ error: None,
+ };
+ assert_eq!(unwrap_response("StartTask", ok), Ok(7));
+ let failed: AgentResponse<u32> = AgentResponse {
+ ok: false,
+ data: None,
+ error: Some(AgentError::new(
+ "PLANNER_UNAVAILABLE",
+ "no planner",
+ "configure one",
+ false,
+ )),
+ };
+ let error = unwrap_response("StartTask", failed).unwrap_err();
+ assert!(error.contains("PLANNER_UNAVAILABLE"), "{error}");
+ let empty: AgentResponse<u32> = AgentResponse {
+ ok: true,
+ data: None,
+ error: None,
+ };
+ assert!(unwrap_response("AwaitTask", empty)
+ .unwrap_err()
+ .contains("no result"));
}
diff --git a/crates/openhuman-core/src/modules/browser_tests.rs b/crates/openhuman-core/src/modules/browser_tests.rs
index 8d78153c9b..735def54e3 100644
--- a/crates/openhuman-core/src/modules/browser_tests.rs
+++ b/crates/openhuman-core/src/modules/browser_tests.rs
@@ -53,28 +53,66 @@ fn allow_all_starts_denied_and_explicit_urls_bind_one_https_host_tree() {
}
#[test]
-fn published_browser_release_covers_desktop_platforms() {
- let record = registry::find(MODULE_ID).unwrap();
+fn browser_members_share_the_tinycomputer_record() {
+ let record = crate::modules::registry::find(MODULE_ID).unwrap();
+ assert_eq!(MODULE_ID, "tinycomputer");
assert_eq!(record.bus_name, names::INTERFACE);
assert_eq!(record.object_path, names::OBJECT_PATH);
- assert_eq!(record.version, "0.2.3");
- assert_eq!(
- record.release_url,
- "https://github.com/tinyhumansai/tinybrowser/releases/tag/v0.2.3"
- );
- assert_eq!(record.assets.len(), 16);
- let keys = record
- .assets
- .iter()
- .map(|asset| asset.host_key)
- .collect::<std::collections::HashSet<_>>();
- assert_eq!(keys.len(), record.assets.len());
- for asset in record.assets {
- assert!(asset.archive.starts_with("tinybrowser-0.2.3-"));
- assert_eq!(asset.sha256.len(), 64);
+ assert_eq!(names::INTERFACE, tinycomputer_bus::names::INTERFACE);
+ for member in [
+ names::methods::OPEN_SESSION,
+ names::methods::NAVIGATE,
+ names::methods::SNAPSHOT,
+ names::methods::PERFORM,
+ names::methods::READ_PAGE,
+ names::methods::LIST_DOWNLOADS,
+ names::methods::WAIT_DOWNLOAD,
+ names::methods::CLOSE_SESSION,
+ ] {
+ assert!(
+ tinycomputer_bus::names::METHODS.contains(&member),
+ "{member} is not served"
+ );
+ }
+}
+
+#[test]
+fn failed_reply_maps_to_the_browser_error_name() {
+ let response: DesktopResponse = serde_json::from_value(serde_json::json!({
+ "version": "2.5",
+ "ok": false,
+ "command": "browser-navigate",
+ "error": {
+ "code": "POLICY_DENIED",
+ "message": "origin is not allowed",
+ "details": {"name": "ai.tinyhumans.tinycomputer.Browser.Error.BlockedByPolicy"}
+ }
+ }))
+ .unwrap();
+ match BrowserCallError::from_response(&response) {
+ BrowserCallError::Bus { name, message } => {
+ assert_eq!(name, "BlockedByPolicy");
+ assert_eq!(message, "origin is not allowed");
+ }
+ other => panic!("unexpected {other:?}"),
}
}
+#[test]
+fn failed_reply_without_a_name_falls_back_to_the_code() {
+ let response: DesktopResponse = serde_json::from_value(serde_json::json!({
+ "version": "2.5",
+ "ok": false,
+ "command": "browser-open-session",
+ "error": {"code": "BROWSER_UNAVAILABLE", "message": "no chrome"}
+ }))
+ .unwrap();
+ assert!(matches!(
+ BrowserCallError::from_response(&response),
+ BrowserCallError::Bus { name, .. } if name == "BROWSER_UNAVAILABLE"
+ ));
+}
+
#[test]
fn fresh_profile_is_the_default() {
let config = Config::default();
diff --git a/crates/openhuman-core/src/modules/desktop.rs b/crates/openhuman-core/src/modules/desktop.rs
index d5d556f066..a24863bc93 100644
--- a/crates/openhuman-core/src/modules/desktop.rs
+++ b/crates/openhuman-core/src/modules/desktop.rs
@@ -1,4 +1,4 @@
-//! Host calls to the attested tinydesktop module.
+//! Host calls to the attested tinycomputer module.
use std::hash::{Hash, Hasher};
use std::sync::OnceLock;
@@ -13,7 +13,7 @@ use crate::config::Config;
#[path = "desktop_tests.rs"]
mod tests;
-pub const MODULE_ID: &str = "tinydesktop";
+pub const MODULE_ID: &str = "tinycomputer";
/// This confidential payload is sent only to the module lifecycle callback.
/// Missing or expired host credentials remove the old Jev client on refresh.
@@ -57,6 +57,18 @@ pub fn module_config(config: &Config) -> serde_json::Value {
}
}
+/// Which account pays for TinyComputer's Jev decisions, for the settings UI:
+/// `hosted` (TinyHumans credits), `direct_openrouter` (the user's key), or
+/// `unavailable` (no credential yet).
+#[must_use]
+pub fn billing_route(config: &Config) -> &'static str {
+ match module_config(config)["jev"]["provider"].as_str() {
+ Some("tiny_humans_open_router") => "hosted",
+ Some("open_router") => "direct_openrouter",
+ _ => "unavailable",
+ }
+}
+
pub fn jev_ready(config: &Config) -> bool {
module_config(config)["jev"].is_object()
}
@@ -72,7 +84,9 @@ fn fingerprint(value: &serde_json::Value) -> u64 {
hasher.finish()
}
-async fn proxy(config: &Config) -> Result<Proxy, String> {
+/// Load the module, refresh its private configuration when it changed, and
+/// return a proxy for its one interface (desktop, browser and task members).
+pub(crate) async fn proxy(config: &Config) -> Result<Proxy, String> {
crate::modules::ops::ensure_loaded_within(
config,
MODULE_ID,
@@ -130,8 +144,11 @@ async fn call_with_proxy<Request: Serialize + Send>(
.with_timeout(std::time::Duration::from_secs(330))
});
let proxy = goal_proxy.as_ref().unwrap_or(proxy);
- let response = if member == names::methods::RUN_GOAL || member == names::methods::RESOLVE_INTENT
- {
+ // The contract's catalogue marks which members carry facts, credentials
+ // or page data; those travel confidentially.
+ let confidential =
+ tinycomputer_bus::catalogue::member(member).is_some_and(|entry| entry.confidential);
+ let response = if confidential {
proxy
.call_confidential::<DesktopResponse>(member, (request,))
.await
diff --git a/crates/openhuman-core/src/modules/registry.rs b/crates/openhuman-core/src/modules/registry.rs
index c34c3d8a53..7a96966183 100644
--- a/crates/openhuman-core/src/modules/registry.rs
+++ b/crates/openhuman-core/src/modules/registry.rs
@@ -34,8 +34,7 @@
#[path = "registry_tests.rs"]
mod tests;
-mod records_browser;
-mod records_desktop;
+mod records_computer;
mod records_docs_wallet;
mod records_extra;
mod records_mcp_connectors;
@@ -45,8 +44,7 @@ mod records_search;
mod records_voice;
use crate::modules::types::ModuleRecord;
-use records_browser::TINYBROWSER;
-use records_desktop::TINYDESKTOP;
+use records_computer::TINYCOMPUTER;
use records_docs_wallet::{TINYDOCS, TINYWALLET};
use records_extra::{TINYBOX, TINYCHANNELS, TINYHOSTS};
use records_mcp_connectors::{TINYCONNECTORS, TINYMCP};
@@ -57,8 +55,7 @@ use records_voice::TINYVOICE;
/// Every module this build can load.
pub const ALL: &[ModuleRecord] = &[
- TINYDESKTOP,
- TINYBROWSER,
+ TINYCOMPUTER,
TINYSEARCH,
TINYDOCS,
TINYWALLET,
diff --git a/crates/openhuman-core/src/modules/registry/records_browser.rs b/crates/openhuman-core/src/modules/registry/records_browser.rs
deleted file mode 100644
index f567ecc5de..0000000000
--- a/crates/openhuman-core/src/modules/registry/records_browser.rs
+++ /dev/null
@@ -1,95 +0,0 @@
-//! TinyBrowser release assets, pinned from its published `v0.2.2` checksum.toml.
-
-use crate::modules::types::{LoadPolicy, ModuleRecord, PlatformAsset};
-
-pub(crate) const TINYBROWSER: ModuleRecord = ModuleRecord {
- id: "tinybrowser",
- description: "Chrome browser automation",
- bus_name: tinybrowser_bus::names::INTERFACE,
- object_path: tinybrowser_bus::names::OBJECT_PATH,
- version: "0.2.3",
- release_url: "https://github.com/tinyhumansai/tinybrowser/releases/tag/v0.2.3",
- assets: &[
- PlatformAsset {
- host_key: "ubuntu-24.04-x86_64",
- archive: "tinybrowser-0.2.3-ubuntu-24.04-x86_64.tar.gz",
- sha256: "71f2186e5ca1ff23d47257ad068cb9f9c0f6e588227942dc2a5ef16f152903ec",
- },
- PlatformAsset {
- host_key: "ubuntu-24.04-arm64",
- archive: "tinybrowser-0.2.3-ubuntu-24.04-arm64.tar.gz",
- sha256: "21d8f95e4e2f802d7095d3203fb14472676231527f42a62398aa220389fc8b16",
- },
- PlatformAsset {
- host_key: "ubuntu-22.04-x86_64",
- archive: "tinybrowser-0.2.3-ubuntu-22.04-x86_64.tar.gz",
- sha256: "7f4d035e7c963e551e89be9672bdc482af9dc6c29e1b675abb36ff6cc3554ad0",
- },
- PlatformAsset {
- host_key: "ubuntu-22.04-arm64",
- archive: "tinybrowser-0.2.3-ubuntu-22.04-arm64.tar.gz",
- sha256: "61078341d33f11778687666fc12c7b9117e163e74a39a806358e61debac148dd",
- },
- PlatformAsset {
- host_key: "macos-26-arm64",
- archive: "tinybrowser-0.2.3-macos-26-arm64.tar.gz",
- sha256: "45e5f56e873e1259e0be1dd0c6f11e2d86ec8ff780eeef6594d3a65dd0ecd910",
- },
- PlatformAsset {
- host_key: "macos-26-x86_64",
- archive: "tinybrowser-0.2.3-macos-26-x86_64.tar.gz",
- sha256: "832e1397404edbebde17652ebe71bc0894b851a6a66476d999ebca760f696663",
- },
- PlatformAsset {
- host_key: "macos-15-arm64",
- archive: "tinybrowser-0.2.3-macos-15-arm64.tar.gz",
- sha256: "6f2ba00360ccd3324b7c48dccaf86412d3e907794fe4c9bbf2a6c08cffcb6f23",
- },
- PlatformAsset {
- host_key: "macos-15-x86_64",
- archive: "tinybrowser-0.2.3-macos-15-x86_64.tar.gz",
- sha256: "9c6ad8f7b719aa293e4fa833c3af6ed418fc831a2fbfda3d6114d739d2fcc12c",
- },
- PlatformAsset {
- host_key: "windows-2025-x86_64",
- archive: "tinybrowser-0.2.3-windows-2025-x86_64.zip",
- sha256: "cc3b3229b980c94b84ed007c1f1969f45fa37fbde27d7f4887183c7425ba8582",
- },
- PlatformAsset {
- host_key: "windows-2022-x86_64",
- archive: "tinybrowser-0.2.3-windows-2022-x86_64.zip",
- sha256: "3e50c4d1477e8c698cfcb3a52a418173ead052e81a6549f812af7ffef300cd74",
- },
- PlatformAsset {
- host_key: "windows-11-arm64",
- archive: "tinybrowser-0.2.3-windows-11-arm64.zip",
- sha256: "e33748c60f6b636aa1cba4a3560c34a8fbdf2119f1a592dd73aac120ebcee1d0",
- },
- PlatformAsset {
- host_key: "fedora-43-x86_64",
- archive: "tinybrowser-0.2.3-fedora-43-x86_64.tar.gz",
- sha256: "45dfad71ff02b2b72449971235ad0c9833abdfba40f64d41a6364785f029b780",
- },
- PlatformAsset {
- host_key: "fedora-43-arm64",
- archive: "tinybrowser-0.2.3-fedora-43-arm64.tar.gz",
- sha256: "56a195f3c4136eea350ffe247effaaa5ad9b3adbbb408b97265363489565f596",
- },
- PlatformAsset {
- host_key: "fedora-44-x86_64",
- archive: "tinybrowser-0.2.3-fedora-44-x86_64.tar.gz",
- sha256: "6aa6724275f01666954bde604116819c76e44dd1660506720bda74dab513078d",
- },
- PlatformAsset {
- host_key: "fedora-44-arm64",
- archive: "tinybrowser-0.2.3-fedora-44-arm64.tar.gz",
- sha256: "337e6beb0238e355dc58833b369d60eb51424a56588aa0751d66832e9b30fa7f",
- },
- PlatformAsset {
- host_key: "archlinux-rolling-x86_64",
- archive: "tinybrowser-0.2.3-archlinux-rolling-x86_64.tar.gz",
- sha256: "c2b423512e6ac6e552866e5aac231a890bf150a43275c989409db04c722969d5",
- },
- ],
- load: LoadPolicy::Lazy,
-};
diff --git a/crates/openhuman-core/src/modules/registry/records_desktop.rs b/crates/openhuman-core/src/modules/registry/records_computer.rs
similarity index 88%
rename from crates/openhuman-core/src/modules/registry/records_desktop.rs
rename to crates/openhuman-core/src/modules/registry/records_computer.rs
index 2711576966..21eb30a2e2 100644
--- a/crates/openhuman-core/src/modules/registry/records_desktop.rs
+++ b/crates/openhuman-core/src/modules/registry/records_computer.rs
@@ -1,11 +1,11 @@
-//! Native desktop module. Published digests are added only from its release manifest.
+//! Native computer-use module (desktop and browser control). Published digests are added only from its release manifest.
use crate::modules::types::{LoadPolicy, ModuleRecord, PlatformAsset};
use tinycomputer_bus::names;
-pub(crate) const TINYDESKTOP: ModuleRecord = ModuleRecord {
- id: "tinydesktop",
- description: "Permission-aware native desktop observation and control",
+pub(crate) const TINYCOMPUTER: ModuleRecord = ModuleRecord {
+ id: "tinycomputer",
+ description: "Permission-aware desktop and browser observation and control",
bus_name: names::INTERFACE,
object_path: names::OBJECT_PATH,
version: "0.5.2",
diff --git a/crates/openhuman-core/src/modules/schemas.rs b/crates/openhuman-core/src/modules/schemas.rs
index f18590a82f..e8e4f721cf 100644
--- a/crates/openhuman-core/src/modules/schemas.rs
+++ b/crates/openhuman-core/src/modules/schemas.rs
@@ -11,7 +11,7 @@
use serde_json::{Map, Value};
use std::sync::Arc;
-use tinybrowser_bus::SessionOptions;
+use tinycomputer_bus::browser::SessionOptions;
use super::ops;
use crate::config::rpc as config_rpc;
@@ -99,13 +99,13 @@ pub fn schemas(function: &str) -> ControllerSchema {
"browser_check_readiness" => ControllerSchema {
namespace: "modules",
function: "browser_check_readiness",
- description: "Load TinyBrowser and briefly launch Chrome to check readiness.",
+ description: "Load TinyComputer and briefly launch Chrome to check browser readiness.",
inputs: vec![],
outputs: vec![
FieldSchema {
name: "module_ready",
ty: TypeSchema::Bool,
- comment: "TinyBrowser module is serving.",
+ comment: "TinyComputer module is serving its browser members.",
required: true,
},
FieldSchema {
@@ -146,7 +146,7 @@ fn handle_browser_check_readiness(_params: Map<String, Value>) -> ControllerFutu
let client = super::browser::BrowserClient::new(Arc::new(config));
if client.ensure_ready().await.is_err() {
return Ok(
- serde_json::json!({"module_ready": false, "chrome_ready": false, "error": "TinyBrowser module is unavailable; configure a local module override"}),
+ serde_json::json!({"module_ready": false, "chrome_ready": false, "error": "TinyComputer module is unavailable; configure a local module override"}),
);
}
let opened = tokio::time::timeout(
diff --git a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs
index b8b826859e..6321fb4c79 100644
--- a/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs
+++ b/crates/openhuman-core/src/platform/about_app/catalog_localai_settings_mobile.rs
@@ -127,7 +127,7 @@ Capability {
domain: "desktop",
category: CapabilityCategory::Settings,
description: "Let agents inspect and control native desktop apps through a local, permission-aware connection. Desktop actions are discovered on demand.",
- how_to: "Connections → Desktop; enable access and grant operating system permissions when requested",
+ how_to: "Connections → Computer → Desktop; enable access and grant operating system permissions when requested",
status: CapabilityStatus::Beta,
privacy: DESKTOP_TO_JEV,
},
diff --git a/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs b/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs
index 3b7891286c..5127d73102 100644
--- a/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs
+++ b/crates/openhuman-core/src/platform/about_app/catalog_workflows_automation.rs
@@ -92,17 +92,17 @@ Capability {
privacy: DERIVED_TO_BACKEND,
},
Capability {
- id: "workflows.tinybrowser_automation",
+ id: "workflows.computer_browser_automation",
name: "Browser Automation",
domain: "workflows",
category: CapabilityCategory::Workflows,
- description: "Inspect pages and run bounded browser tasks in Chrome through TinyBrowser.",
- how_to: "Connections > Browser, then ask the assistant to use the browser",
+ description: "Inspect pages and run bounded browser tasks in Chrome through TinyComputer, with a rescue model for failed steps.",
+ how_to: "Connections > Computer > Browser, then ask the assistant to use the browser",
status: CapabilityStatus::Beta,
privacy: Some(CapabilityPrivacy {
leaves_device: true,
data_kind: PrivacyDataKind::Raw,
- destinations: &["Visited websites", "OpenRouter or OpenHuman backend for Jev tasks"],
+ destinations: &["Visited websites", "OpenRouter, OpenHuman backend, OpenJev or Sage for task decisions"],
}),
},
Capability {
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser.rs b/crates/openhuman-core/src/tools/impl/browser/browser.rs
index f8d0666631..258e44b6d5 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser.rs
@@ -1,4 +1,4 @@
-//! Agent-facing browser backed by the TinyBrowser module.
+//! Agent-facing browser backed by the TinyComputer module's browser and task members.
#[path = "browser_session_pool.rs"]
mod session_pool;
@@ -19,35 +19,30 @@ use std::{
sync::{Arc, Mutex as StdMutex},
time::Instant,
};
+use tinycomputer_bus::agent::{ContinueTaskRequest, TaskId, TaskStatus, TaskView};
#[cfg(test)]
use std::{collections::HashMap, time::Duration};
-use tinybrowser_bus::{
+use tinycomputer_bus::browser::{
Action, DownloadState, DownloadWaitRequest, LocateBy, Locator, NavigateRequest, ReadRequest,
- ScrollDirection, SessionId, SessionOptions, Snapshot, SnapshotRequest, Target, WaitState,
+ ScrollDirection, SessionId, SessionOptions, SnapshotRequest, Target, WaitState,
};
-use tinybrowser_control::{BrowserControl, BrowserControlError, TaskRequest, TaskStatus};
use tinytools::{Tool, ToolCallOptions, ToolResult, ToolRunContext};
use tokio::sync::Mutex;
+/// A task paused before an irreversible action, waiting for host approval.
struct Pending {
- session: SessionId,
- action: Action,
- url: String,
+ task: TaskId,
+ action: String,
+ target: String,
token: String,
}
impl Pending {
fn matches(&self, args: &Value) -> bool {
args["token"].as_str() == Some(self.token.as_str())
- && serde_json::to_value(&self.action).ok().as_ref() == Some(&args["pending_action"])
}
}
-struct BudgetedBrowser<'a> {
- client: &'a BrowserClient,
- security: &'a SecurityPolicy,
-}
-
fn needs_host_confirmation(action: &Action) -> bool {
matches!(
action,
@@ -170,36 +165,6 @@ async fn approve_browser_action(
Ok(())
}
-impl BrowserControl for BudgetedBrowser<'_> {
- async fn snapshot(
- &self,
- session: &SessionId,
- request: &SnapshotRequest,
- ) -> Result<Snapshot, BrowserControlError> {
- BrowserControl::snapshot(self.client, session, request).await
- }
-
- async fn perform(
- &self,
- session: &SessionId,
- action: &Action,
- ) -> Result<tinybrowser_bus::ActionOutcome, BrowserControlError> {
- approve_browser_action(self.client, session, action, false)
- .await
- .map_err(|error| BrowserControlError {
- name: "HostApprovalDenied".into(),
- message: error.to_string(),
- })?;
- if !self.security.record_action() {
- return Err(BrowserControlError {
- name: "ActionBudgetExceeded".into(),
- message: "Browser action budget exceeded".into(),
- });
- }
- BrowserControl::perform(self.client, session, action).await
- }
-}
-
pub struct BrowserTool {
security: Arc<SecurityPolicy>,
client: Arc<BrowserClient>,
@@ -343,75 +308,78 @@ impl BrowserTool {
Ok(json!({"closed": true}))
}
- async fn task(&self, id: &SessionId, args: &Value) -> anyhow::Result<Value> {
- let mut request = TaskRequest::new(required(args, "goal")?);
- if let Some(inputs) = args["inputs"].as_object() {
- let values = inputs
- .iter()
- .map(|(k, v)| {
- Ok((
- k.clone(),
- v.as_str()
- .ok_or_else(|| anyhow::anyhow!("Task input '{k}' must be text"))?
- .to_owned(),
- ))
- })
- .collect::<anyhow::Result<BTreeMap<_, _>>>()?;
- request = request.with_inputs(values);
- }
- let browser = BudgetedBrowser {
- client: &self.client,
- security: &self.security,
+ async fn task(&self, args: &Value) -> anyhow::Result<Value> {
+ let mut goal = required(args, "goal")?.to_owned();
+ let origins = match args["url"].as_str().filter(|url| !url.trim().is_empty()) {
+ Some(url) => {
+ self.client.check_url(url)?;
+ goal = format!("Start at {url}. {goal}");
+ self.client
+ .explicit_origin(url)?
+ .map_or_else(|| self.client.task_origins(), |origin| vec![origin])
+ }
+ None => self.client.task_origins(),
};
- let result = crate::modules::browser_task::run(
- &browser,
- self.client.config(),
- id,
- request.clone(),
- self.max_steps,
- )
- .await
- .map_err(anyhow::Error::msg)?;
- // The module can follow a link or redirect outside the configured
- // origins. The host must refuse to report that state as a successful
- // task, even though strict prevention requires module-level interception.
- self.client
- .read_page(
- id,
- ReadRequest {
- max_chars: 1,
- ..ReadRequest::default()
+ let facts = task_inputs(args)?;
+ let task = crate::modules::browser_task::BrowserTask {
+ goal,
+ facts,
+ origins,
+ max_actions: u32::try_from(self.max_steps).unwrap_or(u32::MAX),
+ };
+ let view = crate::modules::browser_task::start(self.client.config(), &task)
+ .await
+ .map_err(anyhow::Error::msg)?;
+ self.report(view).await
+ }
+
+ /// Answer a paused task (inputs, a free-text answer) or keep following a
+ /// running one.
+ async fn task_continue(&self, args: &Value) -> anyhow::Result<Value> {
+ let id = TaskId::new(required(args, "task_id")?);
+ let inputs = task_inputs(args)?;
+ let answer = args["answer"].as_str().map(str::to_owned);
+ let view = if inputs.is_empty() && answer.is_none() {
+ crate::modules::browser_task::wait(self.client.config(), id).await
+ } else {
+ crate::modules::browser_task::resume(
+ self.client.config(),
+ ContinueTaskRequest {
+ id,
+ inputs,
+ answer,
+ ..ContinueTaskRequest::default()
},
)
- .await?;
- let steps = result
- .steps
- .iter()
- .map(|step| {
- json!({
- "step": step.step,
- "operation": format!("{:?}", step.decision.operation),
- "page_changed": step.page_changed,
- "outcome": format!("{:?}", step.outcome),
- })
- })
- .collect::<Vec<_>>();
- let mut output = json!({"status": format!("{:?}", result.status), "steps": steps, "final_snapshot": result.final_snapshot});
- if result.status == TaskStatus::NeedsConfirmation {
- let decision = result
- .pending
- .ok_or_else(|| anyhow::anyhow!("No pending Jev decision"))?;
- let action = decision
- .to_action(&request, 250)?
- .ok_or_else(|| anyhow::anyhow!("No pending action"))?;
+ .await
+ }
+ .map_err(anyhow::Error::msg)?;
+ self.report(view).await
+ }
+
+ async fn task_cancel(&self, args: &Value) -> anyhow::Result<Value> {
+ let id = TaskId::new(required(args, "task_id")?);
+ *self.pending.lock().await = None;
+ let view = crate::modules::browser_task::cancel(self.client.config(), id)
+ .await
+ .map_err(anyhow::Error::msg)?;
+ Ok(serde_json::to_value(view)?)
+ }
+
+ /// Report a task view; a `needs_approval` pause is held with a one-use
+ /// token that only `confirm_pending` (through the host gate) can spend.
+ async fn report(&self, view: TaskView) -> anyhow::Result<Value> {
+ let mut output = serde_json::to_value(&view)?;
+ if let TaskStatus::NeedsApproval { action, target, .. } = &view.status {
let token = uuid::Uuid::new_v4().to_string();
*self.pending.lock().await = Some(Pending {
- session: id.clone(),
+ task: view.id.clone(),
action: action.clone(),
- url: result.final_snapshot.url,
+ target: target.clone(),
token: token.clone(),
});
- output["pending"] = json!({"action": action, "token": token, "approval": "Call confirm_pending with this token and pending_action to request host approval for this exact action"});
+ output["pending"] = json!({"task_id": view.id, "action": action, "target": target,
+ "token": token, "approval": "Call confirm_pending with this token to request host approval for this exact action"});
} else {
*self.pending.lock().await = None;
}
@@ -428,25 +396,22 @@ impl BrowserTool {
}
let pending = slot.take().expect("pending checked above");
drop(slot);
- let page = self
- .client
- .read_page(
- &pending.session,
- ReadRequest {
- max_chars: 1,
- ..ReadRequest::default()
- },
- )
- .await?;
- if page.url != pending.url {
- anyhow::bail!("Browser page changed during confirmation");
+ let approved = approve_task_action(&pending).await?;
+ let view = crate::modules::browser_task::resume(
+ self.client.config(),
+ ContinueTaskRequest {
+ id: pending.task,
+ approve: Some(approved),
+ ..ContinueTaskRequest::default()
+ },
+ )
+ .await
+ .map_err(anyhow::Error::msg)?;
+ let mut output = self.report(view).await?;
+ if !approved {
+ output["approval"] = json!("denied by the host");
}
- approve_browser_action(&self.client, &pending.session, &pending.action, true).await?;
- Ok(serde_json::to_value(
- self.client
- .perform(&pending.session, pending.action)
- .await?,
- )?)
+ Ok(output)
}
async fn run(&self, args: &Value) -> anyhow::Result<Value> {
@@ -454,12 +419,15 @@ impl BrowserTool {
if verb == "close" {
return self.close().await;
}
- if verb == "confirm_pending" {
- return self.confirm_pending(args).await;
+ match verb {
+ "confirm_pending" => return self.confirm_pending(args).await,
+ "task" => return self.task(args).await,
+ "task_continue" => return self.task_continue(args).await,
+ "task_cancel" => return self.task_cancel(args).await,
+ _ => {}
}
let starting_url = match verb {
"open" => Some(required(args, "url")?),
- "task" => args["url"].as_str().filter(|url| !url.trim().is_empty()),
_ => None,
};
let id = self.session_for_url(starting_url).await?;
@@ -511,28 +479,6 @@ impl BrowserTool {
json!({"url":p.url})
})
}
- "task" => {
- if let Some(url) = args["url"].as_str().filter(|url| !url.trim().is_empty()) {
- self.client.navigate(&id, NavigateRequest::new(url)).await?;
- } else {
- let page = self
- .client
- .read_page(
- &id,
- ReadRequest {
- max_chars: 1,
- ..ReadRequest::default()
- },
- )
- .await?;
- if page.url == "about:blank" {
- anyhow::bail!(
- "No browser page is open. Use browser action=open with an HTTPS URL or include url on task"
- );
- }
- }
- self.task(&id, args).await
- }
"list_downloads" => Ok(serde_json::to_value(
self.client.list_downloads(&id).await?,
)?),
@@ -570,6 +516,59 @@ impl BrowserTool {
}
}
+fn task_inputs(args: &Value) -> anyhow::Result<BTreeMap<String, String>> {
+ args["inputs"].as_object().map_or_else(
+ || Ok(BTreeMap::new()),
+ |inputs| {
+ inputs
+ .iter()
+ .map(|(k, v)| {
+ Ok((
+ k.clone(),
+ v.as_str()
+ .ok_or_else(|| anyhow::anyhow!("Task input '{k}' must be text"))?
+ .to_owned(),
+ ))
+ })
+ .collect()
+ },
+ )
+}
+
+/// Ask the host approval gate about a paused task's exact action. A missing
+/// gate denies: a task never takes an irreversible step unapproved.
+async fn approve_task_action(pending: &Pending) -> anyhow::Result<bool> {
+ let gate = ApprovalGate::try_global().ok_or_else(|| {
+ anyhow::anyhow!("[policy-denied] Browser action needs an interactive host approval gate")
+ })?;
+ let clean = |raw: &str| {
+ let cleaned = raw.chars().filter(|c| !c.is_control()).collect::<String>();
+ let mut short = cleaned.chars().take(160).collect::<String>();
+ if cleaned.chars().count() > 160 {
+ short.push('…');
+ }
+ short
+ };
+ let digest = Sha256::digest(serde_json::to_vec(&json!({
+ "task": pending.task, "action": pending.action, "target": pending.target
+ }))?);
+ let digest_hex = format!("{digest:x}");
+ let summary = format!(
+ "Browser task: {} — {} [action {}]",
+ clean(&pending.action),
+ clean(&pending.target),
+ &digest_hex[..12]
+ );
+ let args = json!({"action": "task_step", "target": summary, "exact_action_sha256": digest_hex});
+ Ok(match gate.intercept_forced("browser", &summary, args).await {
+ GateOutcome::Allow => true,
+ GateOutcome::Deny { reason } => {
+ tracing::debug!(%reason, "[browser] task action denied by host");
+ false
+ }
+ })
+}
+
fn required<'a>(args: &'a Value, key: &str) -> anyhow::Result<&'a str> {
args.get(key)
.and_then(Value::as_str)
@@ -655,19 +654,19 @@ impl Tool for BrowserTool {
}
fn description(&self) -> &str {
concat!(
- "TinyBrowser website operations. Call action=open with the starting URL in this tool ",
- "before snapshot, read_page, or task. browser_open is a separate one-shot session. ",
+ "TinyComputer website operations. Call action=open with the starting URL in this tool ",
+ "before snapshot or read_page. browser_open is a separate one-shot session. ",
"Then use snapshot for current ",
"accessibility refs such as @e1 and read_page for visible prose. Refs expire after ",
"navigation or a new snapshot; take a fresh snapshot instead of guessing a stale ref. ",
"For multi-step work, use task with an optional starting url, an observable final-state goal, and named exact ",
- "input values. Jev chooses among current refs and input names; it does not invent text ",
- "to enter. Check task status, steps, and final_snapshot before claiming completion. ",
- "DoneUnconfirmed needs direct inspection; Stuck calls for one fresh snapshot and ",
- "diagnosis; Blocked and Budget are stopping conditions. NeedsConfirmation returns an ",
- "exact pending action and token. Use confirm_pending only through the host approval ",
- "mechanism for that exact action. Direct consequential clicks and key presses also ",
- "require host approval. For downloads, inspect list_downloads and call wait_download; ",
+ "input values; TinyComputer runs it in its own browser session, and a failed step is ",
+ "handed to its rescue model before the task fails. The reply's status says what it needs: ",
+ "running (call task_continue with task_id to keep following it), needs_input (task_continue ",
+ "with inputs), needs_human (ask the user, then task_continue with answer=done), needs_approval ",
+ "(returns a pending token; use confirm_pending only through the host approval mechanism), ",
+ "checkpoint (always before payment), done, or failed with a hint. task_cancel stops it. ",
+ "Direct consequential clicks and key presses also require host approval. For downloads, inspect list_downloads and call wait_download; ",
"success is reported only after the tracked file path and byte count are verified. ",
"Keep the same conversation session across turns and close it when finished. Navigation ",
"obeys the shared allowed websites list; do not try to evade a blocked destination."
@@ -675,14 +674,15 @@ impl Tool for BrowserTool {
}
fn parameters_schema(&self) -> Value {
json!({"type":"object","properties":{
- "action":{"type":"string","enum":["open","snapshot","read_page","click","fill","type","get_text","get_title","get_url","wait","press","hover","scroll","is_visible","find","task","confirm_pending","list_downloads","wait_download","close"]},
- "url":{"type":"string","description":"Starting HTTPS URL for open or an optional starting URL for task"},"selector":{"type":"string"},"value":{"type":"string"},"text":{"type":"string"},"key":{"type":"string"},"direction":{"type":"string"},"pixels":{"type":"integer"},"ms":{"type":"integer"},"timeout_ms":{"type":"integer"},"interactive_only":{"type":"boolean"},"compact":{"type":"boolean"},"depth":{"type":"integer"},"by":{"type":"string"},"find_action":{"type":"string"},"fill_value":{"type":"string"},"goal":{"type":"string"},"inputs":{"type":"object","additionalProperties":{"type":"string"}},"token":{"type":"string","description":"Token returned with the exact pending action"},"pending_action":{"type":"object","description":"Exact pending action for host approval; must match the task result"}
+ "action":{"type":"string","enum":["open","snapshot","read_page","click","fill","type","get_text","get_title","get_url","wait","press","hover","scroll","is_visible","find","task","task_continue","task_cancel","confirm_pending","list_downloads","wait_download","close"]},
+ "url":{"type":"string","description":"Starting HTTPS URL for open or an optional starting URL for task"},"selector":{"type":"string"},"value":{"type":"string"},"text":{"type":"string"},"key":{"type":"string"},"direction":{"type":"string"},"pixels":{"type":"integer"},"ms":{"type":"integer"},"timeout_ms":{"type":"integer"},"interactive_only":{"type":"boolean"},"compact":{"type":"boolean"},"depth":{"type":"integer"},"by":{"type":"string"},"find_action":{"type":"string"},"fill_value":{"type":"string"},"goal":{"type":"string"},"inputs":{"type":"object","additionalProperties":{"type":"string"}},"task_id":{"type":"string","description":"Task id returned by task, for task_continue and task_cancel"},"answer":{"type":"string","description":"Free-text answer for a paused task; done after a needs_human pause"},"token":{"type":"string","description":"Token returned with the exact pending action"}
},"required":["action"]})
}
fn external_effect_with_args(&self, args: &Value) -> bool {
- // All mutating actions, including Jev task steps, use the forced gate
- // immediately before perform. Declaring an outer effect would park the
- // same call twice and cannot cover the actions chosen inside `task`.
+ // Direct mutating actions use the forced gate immediately before
+ // perform, and a task's irreversible step pauses as needs_approval for
+ // confirm_pending. Declaring an outer effect would park the same call
+ // twice and cannot cover the steps chosen inside `task`.
let _ = args;
false
}
@@ -692,7 +692,8 @@ impl Tool for BrowserTool {
"[policy-blocked] Action blocked: autonomy is read-only",
));
}
- if args["action"] != "task" && !self.security.record_action() {
+ // A task counts once here; its own steps are bounded by max_actions.
+ if !self.security.record_action() {
return Ok(ToolResult::error("Action blocked: rate limit exceeded"));
}
match self.run(&args).await {
@@ -741,5 +742,5 @@ impl Drop for BrowserTool {
}
#[cfg(test)]
-#[path = "browser_tinybrowser_tests.rs"]
+#[path = "browser_computer_tests.rs"]
mod tests;
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_tinybrowser_tests.rs b/crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs
similarity index 78%
rename from crates/openhuman-core/src/tools/impl/browser/browser_tinybrowser_tests.rs
rename to crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs
index e36bb65e5a..b5dbdbf0f8 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_tinybrowser_tests.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_computer_tests.rs
@@ -25,6 +25,8 @@ fn browser_tools_are_deferred_and_task_is_bounded() {
.clone();
assert!(actions.contains(&json!("task")));
assert!(actions.contains(&json!("confirm_pending")));
+ assert!(actions.contains(&json!("task_continue")));
+ assert!(actions.contains(&json!("task_cancel")));
// The tool gates immediately before dispatch, including controller steps.
// The outer middleware must not prompt a second time for the same action.
assert!(!tool.external_effect_with_args(&json!({"action":"confirm_pending"})));
@@ -94,39 +96,86 @@ fn direct_actions_use_typed_targets_and_reject_unbounded_inputs() {
}
#[test]
-fn confirmation_is_bound_to_one_pending_action() {
+fn confirmation_is_bound_to_one_pending_task_token() {
let pending = Pending {
- session: SessionId::new("one"),
- action: Action::Click {
- target: Target::reference("e1"),
- new_tab: false,
- },
- url: "https://example.com".into(),
+ task: TaskId::new("t-1"),
+ action: "Submit the booking".into(),
+ target: "Confirm button".into(),
token: "token-one".into(),
};
- let exact = json!({"token":"token-one","pending_action":pending.action.clone()});
- assert!(pending.matches(&exact));
- assert!(!pending.matches(&json!({"token":"token-two","pending_action":pending.action.clone()})));
- assert!(!pending.matches(&json!({"token":"token-one","pending_action":{"action":"back"}})));
+ assert!(pending.matches(&json!({"token":"token-one"})));
+ assert!(!pending.matches(&json!({"token":"token-two"})));
+ assert!(!pending.matches(&json!({})));
}
#[tokio::test]
-async fn jev_action_budget_stops_before_module_dispatch() {
- let client = BrowserClient::new(Arc::new(crate::config::Config::default()));
- let security = SecurityPolicy {
- enabled: true,
- max_actions_per_hour: 0,
- ..SecurityPolicy::default()
- };
- let browser = BudgetedBrowser {
- client: &client,
- security: &security,
- };
- let error = browser
- .perform(&SessionId::new("not-open"), &Action::Back)
+async fn needs_approval_view_is_held_behind_a_token_and_cleared_by_other_states() {
+ let client = Arc::new(BrowserClient::new(Arc::new(
+ crate::config::Config::default(),
+ )));
+ let tool = BrowserTool::new(Arc::new(SecurityPolicy::default()), client, 3);
+ let paused: TaskView = serde_json::from_value(json!({
+ "id": "t-1",
+ "status": {"state": "needs_approval", "action": "Send the message", "target": "Send"},
+ "summary": "Ready to send.",
+ "progress": 0.9,
+ "next": ["ContinueTask"]
+ }))
+ .unwrap();
+ let output = tool.report(paused).await.unwrap();
+ let token = output["pending"]["token"].as_str().unwrap().to_owned();
+ assert_eq!(output["pending"]["task_id"], "t-1");
+ assert!(tool.pending.lock().await.as_ref().unwrap().matches(&json!({"token": token})));
+
+ let done: TaskView = serde_json::from_value(json!({
+ "id": "t-1",
+ "status": {"state": "done", "answer": "Sent.", "records": {}},
+ "summary": "Sent.",
+ "progress": 1.0,
+ "next": []
+ }))
+ .unwrap();
+ let output = tool.report(done).await.unwrap();
+ assert!(output.get("pending").is_none());
+ assert!(tool.pending.lock().await.is_none());
+}
+
+#[tokio::test]
+async fn confirm_pending_without_a_held_action_is_refused() {
+ let client = Arc::new(BrowserClient::new(Arc::new(
+ crate::config::Config::default(),
+ )));
+ let tool = BrowserTool::new(Arc::new(SecurityPolicy::default()), client, 3);
+ let error = tool
+ .run(&json!({"action":"confirm_pending","token":"x"}))
.await
.unwrap_err();
- assert_eq!(error.name, "ActionBudgetExceeded");
+ assert!(error.to_string().contains("No pending"), "{error}");
+}
+
+#[tokio::test]
+async fn task_inputs_must_be_text() {
+ assert_eq!(
+ task_inputs(&json!({"inputs":{"name":"Asha"}})).unwrap()["name"],
+ "Asha"
+ );
+ assert!(task_inputs(&json!({"inputs":{"age":3}})).is_err());
+ assert!(task_inputs(&json!({})).unwrap().is_empty());
+}
+
+#[tokio::test]
+async fn task_without_allowed_websites_is_refused_before_the_module() {
+ let client = Arc::new(BrowserClient::new(Arc::new(
+ crate::config::Config::default(),
+ )));
+ if client.task_origins().is_empty() {
+ let tool = BrowserTool::new(Arc::new(SecurityPolicy::default()), client, 3);
+ let error = tool
+ .run(&json!({"action":"task","goal":"Read the news"}))
+ .await
+ .unwrap_err();
+ assert!(error.to_string().contains("allowed origin"), "{error}");
+ }
}
#[tokio::test]
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_open.rs b/crates/openhuman-core/src/tools/impl/browser/browser_open.rs
index a1b10182cb..a47ef2620d 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_open.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_open.rs
@@ -1,10 +1,10 @@
-//! Simple TinyBrowser entry point for opening a permitted page.
+//! Simple TinyComputer entry point for opening a permitted page.
use crate::modules::browser::BrowserClient;
use crate::security::SecurityPolicy;
use async_trait::async_trait;
use serde_json::json;
use std::sync::Arc;
-use tinybrowser_bus::NavigateRequest;
+use tinycomputer_bus::browser::NavigateRequest;
use tinytools::{Tool, ToolResult};
pub struct BrowserOpenTool {
@@ -38,7 +38,7 @@ impl Tool for BrowserOpenTool {
"browser_open"
}
fn description(&self) -> &str {
- "Open an approved HTTPS URL in a one-shot TinyBrowser session, report its title and URL, then close it. For DOM inspection or tasks, use browser action=open in the persistent conversation session."
+ "Open an approved HTTPS URL in a one-shot TinyComputer browser session, report its title and URL, then close it. For DOM inspection or tasks, use browser action=open in the persistent conversation session."
}
fn parameters_schema(&self) -> serde_json::Value {
json!({"type":"object","properties":{"url":{"type":"string","description":"HTTPS URL to open"}},"required":["url"]})
diff --git a/crates/openhuman-core/src/tools/impl/browser/browser_session_pool.rs b/crates/openhuman-core/src/tools/impl/browser/browser_session_pool.rs
index 476221ec24..c545d02655 100644
--- a/crates/openhuman-core/src/tools/impl/browser/browser_session_pool.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/browser_session_pool.rs
@@ -8,7 +8,7 @@ use std::{
sync::{Arc, OnceLock},
time::{Duration, Instant},
};
-use tinybrowser_bus::SessionId;
+use tinycomputer_bus::browser::SessionId;
use tokio::sync::Mutex;
pub(super) const MAX_THREAD_SESSIONS: usize = 6;
diff --git a/crates/openhuman-core/src/tools/impl/browser/mod.rs b/crates/openhuman-core/src/tools/impl/browser/mod.rs
index 5309174971..c3c3f4c162 100644
--- a/crates/openhuman-core/src/tools/impl/browser/mod.rs
+++ b/crates/openhuman-core/src/tools/impl/browser/mod.rs
@@ -1,4 +1,4 @@
-//! Browser tools backed by the loadable TinyBrowser module.
+//! Browser tools backed by the loadable TinyComputer module.
#[allow(clippy::module_inception)]
#[cfg(feature = "modules")]
diff --git a/scripts/ci/check-module-pins.mjs b/scripts/ci/check-module-pins.mjs
index 0dabf13b62..e96eb4bc34 100755
--- a/scripts/ci/check-module-pins.mjs
+++ b/scripts/ci/check-module-pins.mjs
@@ -78,11 +78,10 @@ const ROOT = resolve(process.argv[2] ?? join(HERE, "..", ".."));
// `vendor/tinyruntime` via `sharesWith`.
const PIN_MAP = {
tinysearch: { submodule: "vendor/tinysearch" },
- tinydesktop: { submodule: "vendor/tinydesktop" },
+ tinycomputer: { submodule: "vendor/tinycomputer" },
tinybox: { submodule: "vendor/tinybox" },
tinychannels: { submodule: "vendor/tinychannels" },
tinyhosts: { submodule: "vendor/tinyhosts" },
- tinybrowser: { submodule: "vendor/tinybrowser" },
tinydocs: { submodule: "vendor/tinydocs" },
tinywallet: { submodule: "vendor/tinywallet" },
tinymemory: { submodule: "vendor/tinymemory" },
diff --git a/scripts/ci/checkout-submodules.sh b/scripts/ci/checkout-submodules.sh
index 6edf80517d..f4748d801a 100755
--- a/scripts/ci/checkout-submodules.sh
+++ b/scripts/ci/checkout-submodules.sh
@@ -16,10 +16,6 @@ cd "$(dirname "$0")/../.."
NESTED=(
"vendor/tinyagents vendor/tinytools"
"vendor/tinyagents vendor/tinyinference"
- # OpenHuman's core depends on TinyBrowser's vendored Jev client directly.
- # TinyBrowser's own workspace also resolves its vendored TinyBus manifest.
- "vendor/tinybrowser vendor/tinyjevclient"
- "vendor/tinybrowser vendor/tinybus"
# The native TinyConnectors test module is built from its own manifest, so
# the root workspace's tinybus patch does not apply to this dependency.
"vendor/tinyconnectors vendor/tinybus"
diff --git a/scripts/debug/desktop-live.mjs b/scripts/debug/desktop-live.mjs
index dedfca4691..45b7e00341 100644
--- a/scripts/debug/desktop-live.mjs
+++ b/scripts/debug/desktop-live.mjs
@@ -47,7 +47,7 @@ if (localModule) {
{ mode: 0o600 });
console.log('Local debug module copied and operator allowlist written.');
const canonical = await realpath(destination);
- console.log(`Add [[modules.overrides]] with id = "tinydesktop" and path = ${JSON.stringify(canonical)} to the isolated core config, then restart the core.`);
+ console.log(`Add [[modules.overrides]] with id = "tinycomputer" and path = ${JSON.stringify(canonical)} to the isolated core config, then restart the core.`);
process.exit(0);
}
if (!process.argv.includes('--live')) fail('Pass --live to run real desktop actions.');
diff --git a/vendor/tinybrowser b/vendor/tinybrowser
deleted file mode 160000
index 4437353b9a..0000000000
--- a/vendor/tinybrowser
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 4437353b9a4d392ebf237edd52d6c7d64764b0fe
diff --git a/vendor/tinycomputer b/vendor/tinycomputer
new file mode 160000
index 0000000000..c5d8b5833a
--- /dev/null
+++ b/vendor/tinycomputer
@@ -0,0 +1 @@
+Subproject commit c5d8b5833a9dabaf5e5d0cf50e96bd122b8cc4d1
diff --git a/vendor/tinydesktop b/vendor/tinydesktop
deleted file mode 160000
index 6e09abb5d0..0000000000
--- a/vendor/tinydesktop
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 6e09abb5d0c7e31c0cabfe169acc2937a03ceb93