Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: add URL navigation to browser page

Adam Eivy4d5ddd461416
diff --git a/.changelog/v0.11.17.md b/.changelog/v0.11.17.md
index 7c60185324..f5ca74d7fa 100644
--- a/.changelog/v0.11.17.md
+++ b/.changelog/v0.11.17.md
@@ -212,6 +212,12 @@ This release focuses on security improvements, bug fixes for the AI runner syste
- **Learning tab shows both**: The Duration Estimates table now displays both average and estimated (P80) columns so users can see the range
- **Backward compatible**: Existing learning data without max/P80 fields gracefully falls back to using the average
+### Browser URL Navigation
+- **Open URL in CDP browser**: Added a URL input bar to the Browser page that opens any URL in a new tab of the managed CDP browser
+- **Auto-prefix**: URLs without a protocol are automatically prefixed with `https://`
+- **Server endpoint**: New `POST /api/browser/navigate` route with Zod URL validation, using CDP's `/json/new` endpoint to open tabs
+- **Conditional visibility**: The URL bar only appears when the browser is connected, keeping the UI clean when the browser is stopped
+
### Architecture Documentation Update
- **Updated system diagram**: Expanded the architecture diagram to include portos-browser and portos-autofixer as PM2-managed satellite services alongside Chief of Staff
- **New data flow sections**: Added Browser Automation Flow and Autofixer Flow documenting how each service communicates with the rest of PortOS
diff --git a/client/src/pages/Browser.jsx b/client/src/pages/Browser.jsx
index 12acddc345..b6534fba76 100644
--- a/client/src/pages/Browser.jsx
+++ b/client/src/pages/Browser.jsx
@@ -2,12 +2,12 @@ import { useState, useEffect, useCallback } from 'react';
import {
Globe, Play, Square, RefreshCw, Settings, Activity,
Monitor, Wifi, WifiOff, Clock, Cpu, MemoryStick,
- FileText, ChevronDown, ChevronRight
+ FileText, ChevronDown, ChevronRight, ExternalLink
} from 'lucide-react';
import {
getBrowserStatus, getBrowserConfig, updateBrowserConfig,
launchBrowser, stopBrowser, restartBrowser,
- getBrowserLogs
+ getBrowserLogs, navigateBrowser
} from '../services/api';
import toast from 'react-hot-toast';
@@ -48,6 +48,7 @@ export default function BrowserPage() {
const [logs, setLogs] = useState('');
const [config, setConfig] = useState(null);
const [configDraft, setConfigDraft] = useState(null);
+ const [navUrl, setNavUrl] = useState('');
const fetchStatus = useCallback(async () => {
const data = await getBrowserStatus().catch(() => null);
@@ -118,6 +119,23 @@ export default function BrowserPage() {
}
}, [configDraft]);
+ const handleNavigate = useCallback(async () => {
+ const trimmed = navUrl.trim();
+ if (!trimmed) return;
+ const url = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
+ setActionLoading('navigate');
+ const result = await navigateBrowser(url).catch(err => {
+ toast.error(`Failed to navigate: ${err.message}`);
+ return null;
+ });
+ if (result) {
+ toast.success(`Opened ${url}`);
+ setNavUrl('');
+ await fetchStatus();
+ }
+ setActionLoading(null);
+ }, [navUrl, fetchStatus]);
+
const isRunning = status?.process?.status === 'online';
const isConnected = status?.connected;
@@ -379,6 +397,39 @@ export default function BrowserPage() {
</div>
</div>
+ {/* Navigate to URL */}
+ {isConnected && (
+ <div className="bg-port-card border border-port-border rounded-xl p-5">
+ <h3 className="text-lg font-semibold text-white mb-4 flex items-center gap-2">
+ <ExternalLink size={20} className="text-port-accent" />
+ Open URL
+ </h3>
+ <form
+ onSubmit={e => { e.preventDefault(); handleNavigate(); }}
+ className="flex gap-2"
+ >
+ <input
+ type="text"
+ value={navUrl}
+ onChange={e => setNavUrl(e.target.value)}
+ placeholder="https://example.com"
+ className="flex-1 px-3 py-2 bg-port-bg border border-port-border rounded-lg text-white text-sm focus:outline-none focus:border-port-accent placeholder-gray-600"
+ />
+ <button
+ type="submit"
+ disabled={!navUrl.trim() || actionLoading !== null}
+ className="flex items-center gap-2 px-5 py-2 bg-port-accent text-white rounded-lg font-medium hover:bg-port-accent/80 transition-colors disabled:opacity-50"
+ >
+ {actionLoading === 'navigate'
+ ? <RefreshCw size={16} className="animate-spin" />
+ : <Globe size={16} />
+ }
+ Go
+ </button>
+ </form>
+ </div>
+ )}
+
{/* Open Pages */}
<div className="bg-port-card border border-port-border rounded-xl overflow-hidden">
<button
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 7d8d292246..2eea77dd66 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -907,6 +907,10 @@ export const getBrowserProcess = () => request('/browser/process');
export const getBrowserPages = () => request('/browser/pages');
export const getBrowserVersion = () => request('/browser/version');
export const getBrowserLogs = (lines = 50) => request(`/browser/logs?lines=${lines}`);
+export const navigateBrowser = (url) => request('/browser/navigate', {
+ method: 'POST',
+ body: JSON.stringify({ url })
+});
// Default export for simplified imports
export default {
diff --git a/server/routes/browser.js b/server/routes/browser.js
index 5d0b0987f1..84d0b91c6a 100644
--- a/server/routes/browser.js
+++ b/server/routes/browser.js
@@ -5,6 +5,10 @@ import * as browserService from '../services/browserService.js';
const router = express.Router();
// Validation schemas
+const navigateSchema = z.object({
+ url: z.string().url()
+});
+
const updateConfigSchema = z.object({
cdpPort: z.number().int().min(1024).max(65535).optional(),
cdpHost: z.enum(['127.0.0.1', 'localhost', '::1']).optional(),
@@ -54,6 +58,14 @@ router.post('/restart', async (req, res) => {
res.json(status);
});
+// POST /api/browser/navigate - Open a URL in the CDP browser
+router.post('/navigate', async (req, res) => {
+ const { url } = navigateSchema.parse(req.body);
+ console.log(`🌐 Navigate requested: ${url}`);
+ const page = await browserService.navigateToUrl(url);
+ res.json(page);
+});
+
// GET /api/browser/health - Quick health check
router.get('/health', async (req, res) => {
const health = await browserService.getHealthStatus();
diff --git a/server/services/browserService.js b/server/services/browserService.js
index d9320384c8..442a7daa66 100644
--- a/server/services/browserService.js
+++ b/server/services/browserService.js
@@ -162,6 +162,28 @@ export async function getRecentLogs(lines = 50) {
return { stdout: stdout || '', stderr: stderr || '' };
}
+// ---------- CDP navigation ----------
+
+export async function navigateToUrl(url) {
+ const config = await loadConfig();
+ const newTabUrl = `http://${config.cdpHost}:${config.cdpPort}/json/new?${encodeURIComponent(url)}`;
+
+ const controller = new AbortController();
+ const timeout = setTimeout(() => controller.abort(), 10000);
+
+ const response = await fetch(newTabUrl, { method: 'PUT', signal: controller.signal });
+ clearTimeout(timeout);
+
+ if (!response.ok) {
+ const text = await response.text().catch(() => '');
+ throw new Error(`CDP navigate failed (${response.status}): ${text}`);
+ }
+
+ const page = await response.json();
+ console.log(`🌐 Opened ${url} in CDP browser (tab ${page.id})`);
+ return { id: page.id, title: page.title || '(loading)', url: page.url, type: page.type };
+}
+
// ---------- CDP page listing (connects to the debug endpoint) ----------
export async function getOpenPages() {