12 KiB
Repository Notes
-
This repository is a near-direct port of the OpenHands frontend, adapted to talk straight to
software-agent-sdk/agent_serverwithout the usual OpenHands app backend. -
Frontend API adaptation lives mainly in
src/api/:option-servicefabricates an OSS web-client config and reads models/providers fromagent_serverLLM endpoints.settings-servicestores settings locally in browser localStorage and reads schemas fromagent_server/api/settings/*endpoints.v1-conversation-service,event-service,sandbox-service,git-service, andskills-serviceare mapped directly toagent_serverREST endpoints.open-hands-axiosinjects the optionalX-Session-API-Keyfrom env/local config for all requests.
-
Supported env vars for deployment:
VITE_BACKEND_BASE_URLfor the agent server base URL.VITE_SESSION_API_KEYfor optional session auth.VITE_WORKING_DIRfor the default workspace path sent when starting conversations.VITE_WORKER_URLSas a comma-separated list of browser worker URLs if you want the Browser tab to probe exposed app hosts.VITE_ENABLE_BROWSER_TOOLS=falseto omitBrowserToolSetfrom new conversation payloads.
-
The UI keeps most OpenHands routes/layout intact, but SaaS/org/billing/integration behavior is intentionally hidden or stubbed via the fabricated OSS config because there is no separate app backend.
-
Verification command:
npm run typecheck && npm run build. -
GitHub automation now includes
.github/workflows/ci.ymlfornpm ci,npm test, andnpm run build, plus.github/dependabot.ymlwith weekly npm/github-actions updates gated by a 7-day cooldown. -
Direct
dependenciesanddevDependenciesinpackage.jsonare exact-pinned (no caret ranges); reproducible installs should use the committedpackage-lock.jsonplusnpm ci, and targeted transitive fixes still belong inoverrides. -
package-lock.jsonmust also retain the optional peer entry fornode_modules/vite-tsconfig-paths/node_modules/typescript@5.9.3; without that nested lock entry, cleannpm ciinstalls on CI fail withMissing: typescript@5.9.3 from lock file. -
npm testnow runsnpm run make-i18nfirst so clean environments generatesrc/i18n/declaration.tsbefore Vitest loads aliased imports. -
__tests__/vite-config.test.tsshould importvite.configdirectly under// @vitest-environment node; spawning plainnode -e 'import ./vite.config.ts'is not portable across Node patch releases in CI. -
vitest.setup.tsmust guard DOM-specific globals (HTMLCanvasElement,HTMLElement,window) because some suites run in the Node environment instead of jsdom. -
@openhands/typescript-clientis consumed directly fromgithub:OpenHands/typescript-client#4716d2e; that package ships the needed subpath exports forclient/http-client,events/remote-events-list, andworkspace/remote-workspace. -
Shared TypeScript-client adapters live in
src/api/typescript-client.ts; prefer those helpers for agent-server-backed REST/workspace/event/VS Code calls before falling back toopen-hands-axios. -
Local verification/build gotchas:
npm run typecheckassumes generated translation types exist; runnpm run make-i18nfirst ifsrc/i18n/declaration.tsis missing.
-
Phase-1 OSS cleanup removed SaaS-only auth/org/billing/onboarding/payment/invitation codepaths, routes, and tests. Keep
integrations,git-settings,secrets, MCP settings, and other local/self-hosted flows intact when simplifying OSS behavior. -
When merging main into the Phase-1 OSS cleanup branch, keep the new agent-server compatibility bootstrap in
src/root.tsx, but do not reintroduce SaaS invitation cleanup or enterprise CTA chrome in the OSS user menu; the OSS account menu should just render settings links plus Docs. -
During the Phase-1 OSS cleanup audit, the runtime SaaS removals held up, but route-level regression coverage for still-active OSS settings pages had been deleted too aggressively. Keep focused tests for local/self-hosted screens like
app-settings,llm-settings,git-settings,mcp-settings, andsecrets-settingseven when stripping SaaS-only code. -
npm run dev:mockneeds MSW handlers for the direct agent-server routes used by the adapted frontend, not the original OpenHands mock paths. Key routes that must stay covered are:- bootstrap/model loading:
/server_info,/api/llm/models/verified,/api/llm/providers - settings schemas:
/api/settings/agent-schema,/api/settings/conversation-schema - conversation browsing/loading:
/api/conversations/search,/api/conversations?ids=...,/api/conversations/:id,/api/conversations/:id/events/* - runtime git panels:
/api/git/changes,/api/git/diff
- bootstrap/model loading:
-
Static mock verification needs a build created with
VITE_MOCK_API=true(usenpm run build:mock); the client must start MSW whenever that flag is enabled, even in production/static builds, otherwise routes like/settingsand the conversations pane fall through to the static server and crash on undefined.filter/.mapassumptions. -
Frontend compatibility guard:
OptionService.getConfig()now uses/server_info.versionto block unsupported agent-server versions before the app loads. Git history insoftware-agent-sdkshows/api/settings/agent-schemaand/api/settings/conversation-schemafirst shipped in tagv1.17.0, so the GUI currently treats< 1.17.0(or unknown/unparseable versions) as incompatible,useConfigstops retrying that case, andsrc/root.tsxrenders a blocking unsupported-version notice on every route. -
Useful regression tests for mock mode live in
__tests__/api/option-service.test.ts,__tests__/api/mock-conversation-handlers.test.ts, and__tests__/api/mock-settings-handlers.test.ts. -
Browser-verified mock-mode tour artifact was generated at
artifacts/frontend-tour.gif. -
Live
agent_servercompatibility quirks discovered during browser verification:-
Latest
openhands-agent-serverlive-mode notes (verified against 1.18.1):/api/settings/agent-schemaand/api/settings/conversation-schemaexist on recent servers, but they return401when the server was started withSESSION_API_KEYorOH_SESSION_API_KEYS_0; the frontend must send the same value asVITE_SESSION_API_KEY/X-Session-API-Key.- The provider/model picker should use
/api/llm/providers,/api/llm/models, and/api/llm/models/verified;/api/v1/config/providers/searchand/api/v1/config/models/search404 on current live agent-server releases. - When the browser is accessing the frontend through a remote host (for example an All Hands work URL) but
VITE_BACKEND_BASE_URLpoints at127.0.0.1/localhost, browser-side REST calls must fall back to the frontend origin so Vite can proxy/apiand/socketsto the local backend.
-
GET /api/conversationsexpects repeatedidsparams (?ids=a&ids=b), not Axios's default bracket form (ids[]=a), so the shared Axios client needs a custom params serializer. -
Runtime git panels should prefer the conversation's reported
workspace.working_dirwhen present; falling back to/workspace/projectcan produce 500s likeNot a git repositoryfor direct local workspaces such as/workspace/project/agent-server-gui. -
For the current
openhands-agent-serverPyPI/uv-tool flow,uv tool install -U openhands-agent-serveralone was not sufficient in this environment. A working install was:uv tool install -U --with openhands-tools --with openhands-workspace openhands-agent-serveruv tool installexposes the executable asagent-server, notopenhands-agent-server, and may require adding~/.local/bintoPATH.
-
Current SDK / agent-server conversation start payloads must use SDK-registered snake_case tool names, not the old class-style names. Working names against SDK v1.18.1 were:
terminalfile_editortask_trackerbrowser_tool_setUsingTerminalTool/FileEditorTool/TaskTrackerTool/BrowserToolSetcaused live/api/conversations/{id}/eventsruns to fail withToolDefinition '<name>' is not registered.
-
The root compatibility bootstrap now treats
/server_infonetwork/timeout failures as a first-classAgentServerUnavailableError, uses a short 5s timeout for that probe, and disables React Query retries/toasts for the initial config fetch so missing backends fail fast with an explicit full-screen notice. -
For local verification in this repo, setting
VITE_WORKING_DIR=/workspace/project/agent-server-guiavoids initial Changes-tab 500s from pointing conversations at the non-repo parent/workspace/project. -
OpenHands Cloud sandbox development note: do not reuse the sandbox's existing agent-server for this frontend. Current agent-server releases use a shared
openhandstmux socket and defaultworkspace/conversations, so a naive second server in the same sandbox can kill the cloud session's tmux state or attach to the same persisted conversations.npm run devis now the recommended local workflow and starts an isolated local agent-server for the checkout by overridingTMUX_TMPDIR,OH_CONVERSATIONS_PATH,OH_BASH_EVENTS_DIR, andOH_VSCODE_PORTunder.openhands-dev/; usenpm run dev:frontendonly when intentionally pointing at a separately managed backend, ornpm run dev:mockfor mock mode. -
A successful end-to-end live run in this environment required a real LLM config (
LLM_MODEL+LLM_API_KEY). The defaultlitellm_proxy/...model with nollm_api_keyfailed at runtime with alitellm.AuthenticationError.
-
-
README expectation: keep the first section as a concrete, chronological from-scratch quickstart for running this frontend against a real
openhands-agent-server(clone, install backend, optional.env, runnpm run dev). -
Keep README user-focused and move contributor/developer-specific workflows (Cloud sandbox debugging,
dev:safe, mock mode, detailed env vars/build-test notes) intoDEVELOPMENT.md. -
scripts/dev-safe.mjsshould fail fast ifagent-servercannot be spawned (for example missing PATH entries). -
Vite dev mode can black-screen on first load with
504 Outdated Optimize Depif core client-entry deps are not prebundled; keepreact,react/jsx-runtime,react-dom/client, andreact-router/dominoptimizeDeps.include. -
As an OpenHands incubator Sandbox project, the repo should carry the standard sandbox warning badge in
README.mdand include a rootLICENSEfile to satisfy the incubator-program requirements. -
OpenHands repo bootstrap files live under
.openhands/:.openhands/setup.shinstalls frontend dependencies withnpm ciwhen needed, creates.envfrom.env.sampleif missing, appendsVITE_WORKING_DIRfor this repo when unset, and generatessrc/i18n/declaration.tsvianpm run make-i18n..openhands/pre-commit.shmirrors the repo's local quality gate withnpm run lint && npm run test.
-
.github/workflows/pr-review.ymlis configured for on-demand OpenHands reviews only (review-thislabel or requestingopenhands-agent/all-hands-bot), uses the OpenHands app LLM proxy defaults, and expects a repositoryLLM_API_KEYsecret. -
HeroUI v3 migration notes:
@heroui/reactno longer exports the old Tailwindheroui()plugin or v2 autocomplete item/section components;hero.ts/tailwind.config.jsshould not importherouifrom@heroui/react.- Tailwind v4 integration now works by importing
@heroui/styles/themes/defaultinsrc/tailwind.cssand sourcing the v3 package files fromnode_modules/@heroui/react/dist/**/*. - For settings-style dropdowns, the previous
Autocomplete+AutocompleteItem/AutocompleteSectionAPI is incompatible with v3; this repo now uses a lightweight custom input/dropdown implementation insrc/components/features/settings/settings-dropdown-input.tsx, andModelSelectorbuilds on that wrapper.