The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
import type { DesktopBootProgress, DesktopBootstrapState } from '@/global'
function noopUnsubscribe(): () => void {
return () => undefined
}
function readyBootProgress(): DesktopBootProgress {
return {
error: null,
fakeMode: false,
message: 'Hermes browser-hosted desktop is ready',
phase: 'runtime.ready',
progress: 100,
running: false,
timestamp: Date.now()
}
}
function readyBootstrapState(): DesktopBootstrapState {
return {
active: false,
// A browser host never runs an in-app bundled payload.
bundled: false,
completedAt: Date.now(),
error: null,
log: [],
manifest: null,
setupChoice: null,
stages: {},
startedAt: null,
unsupportedPlatform: null
}
}
function browserUnsupported(feature: string): Error {
return new Error(`${feature} is not available in the browser-hosted Desktop`)
}
// Bridge members that need no per-install state: native-only capabilities
// answered with a fixed browser result, a refusal, or a no-op.
export const BROWSER_BRIDGE_STUBS = {
applyConnectionConfig: async () => {
throw browserUnsupported('Gateway reconfiguration')
},
cancelBootstrap: async () => ({ cancelled: false, ok: true }),
// Rendering an untrusted link must not contact its destination. PrettyLink
// uses the URL slug when no title is available; Electron keeps its resolver.
fetchLinkTitle: async () => '',
claimAmbientCue: async () => true,
cloud: {
agentSignIn: async (dashboardUrl: string) => ({ baseUrl: dashboardUrl, connected: false }),
discover: async () => ({ agents: [] }),
login: async () => ({ ok: false, portalBaseUrl: '', signedIn: false }),
logout: async () => ({ ok: true, portalBaseUrl: '', signedIn: false }),
status: async () => ({ portalBaseUrl: '', signedIn: false })
},
continueBootstrapLocal: async () => ({ ok: true }),
getBootProgress: async () => readyBootProgress(),
getBootstrapState: async () => readyBootstrapState(),
getRecentLogs: async () => ({ lines: [], path: '' }),
// Venv/plugin receipts live on the server host; a browser tab has none of its own.
getSyncStatus: async () => null,
getRemoteDisplayReason: async () => 'Browser-hosted Desktop uses this server as its backend',
windowControls: {
custom: false,
minimize: () => { throw browserUnsupported('Native window controls') },
toggleMaximize: () => { throw browserUnsupported('Native window controls') },
close: () => { throw browserUnsupported('Native window controls') }
},
getPathForFile: () => '',
normalizePreviewTarget: async () => null,
onBackendExit: noopUnsubscribe,
onBootProgress: noopUnsubscribe,
onBootstrapEvent: noopUnsubscribe,
onFoundInPage: noopUnsubscribe,
onPreviewFileChanged: noopUnsubscribe,
probeConnectionConfig: async (remoteUrl: string) => ({
authMode: 'unknown' as const,
baseUrl: remoteUrl,
error: 'Gateway reconfiguration is unavailable in browser-hosted Desktop',
providers: [],
reachable: false,
version: null
}),
revealLogs: async () => ({
error: 'Native log reveal is unavailable in browser-hosted Desktop',
ok: false,
path: ''
}),
repairBootstrap: async () => ({ ok: true }),
resetBootstrap: async () => ({ ok: true }),
saveConnectionConfig: async () => {
throw browserUnsupported('Gateway reconfiguration')
},
sanitizeWorkspaceCwd: async (cwd?: null | string) => ({ cwd: cwd || '', sanitized: false }),
sshConfigHosts: async () => ({ hosts: [] }),
sshResolveHost: async () => ({ hostname: null, identityFile: null, port: null, user: null }),
stopFindInPage: async () => undefined,
stopPreviewFileWatch: async () => true,
themes: {
fetchMarketplace: async (id: string) => ({ displayName: id, extensionId: id, themes: [] }),
searchMarketplace: async () => []
},
uninstall: {
openAppsSettings: async () => undefined,
run: async () => ({ error: 'Run `hermes uninstall` on the server host', ok: false }),
summary: async () => ({
agent_installed: true,
// Package removal belongs to the server host, never this browser tab.
code_removal_allowed: false,
gui_installed: true,
hermes_home: '',
// No OS package owns a browser tab either: About shows no uninstall section.
native_removal_instructions: null,
packaged_app_paths: [],
platform: 'browser',
source_built_artifacts: [],
userdata_dir: '',
userdata_exists: true
})
},
// Update holds are an Electron boot state; a browser boot never reports one.
updateHold: {
quit: async () => ({ ok: false }),
recheck: async () => ({ ok: false }),
startAnyway: async () => ({ ok: false })
},
updates: {
apply: async () => ({ command: 'hermes update', manual: true, message: 'Run `hermes update` on the server host', ok: false }),
check: async () => ({ message: 'Use `hermes update` on the server host', reason: 'browser-hosted', supported: false }),
onProgress: noopUnsubscribe
},
watchPreviewFile: async (url: string) => ({ id: `browser:${url}`, path: url })
} satisfies Partial<Window['hermesDesktop']>