Skip to content

API Reference parrot.e2e.targets.ui

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.e2e.targets.ui

View source

ui build/preview target adapter (FEAT-581, M4).

Implements spec §3 "M4"'s parrot.e2e.targets.ui factory, per spec §2 "Target and Authentication Design":

ui | Build/serve with pnpm using fixture backend URL before build; HTTP
`/admin/` readiness followed by declared browser checks. Health alone
is not browser evidence.

:meth:_UIAdapter.prepare never spawns anything itself (the :class:~parrot.e2e.targets.base.TargetAdapter contract, matching every sibling M4 adapter): the real pnpm build then pnpm preview two-step runs entirely inside the launched child, via this module's own :func:run_ui_entrypoint, the same sys.executable -c "..." bootstrap technique :mod:parrot.e2e.targets.mcp/:mod:parrot.e2e.targets.botmanager already use. Only presence/prerequisite checks (pnpm/node binaries, an installed node_modules) happen in :meth:prepare -- never an auto-install (spec §7: "target-specific preflight rather than installation side effects"), and no subprocess is spawned before the supervisor's own spawn (:mod:parrot.e2e.targets.base's own contract: "raised before any subprocess is spawned").

Build output (packages/ai-parrot-server/src/parrot/server/ui/dist/, vite.config.ts's own build.outDir) is already .gitignored (.gitignore:399) -- generated output stays isolated from tracked source (spec §7 "UI build writes must stay in generated/artifact directories; if a build changes tracked output, identity validation correctly invalidates evidence"); this adapter never edits vite.config.ts and never writes anywhere under the UI project's own tracked src/.

PUBLIC_API_URL (options["backend_url"], spec: "using fixture backend URL before build") is exported into the build's own environment before pnpm build runs -- vite.config.ts's envPrefix: ['VITE_', 'PUBLIC_'] bakes it into the built client bundle as a literal import.meta.env substitution at build time, never only the dev-server proxy target (which the production vite preview server this adapter launches does not use at all).

:meth:_UIAdapter.ready matches the spec row verbatim: "HTTP /admin/ readiness followed by declared browser checks. Health alone is not browser evidence." -- the declared browser checks are a later, scenario-level concern (TASK-3548's own file scope), out of this adapter's own scope. This adapter's own readiness combines the preview server's /admin/ route with a best-effort reachability probe of the configured backend URL (spec: "using fixture backend URL"; any HTTP response counts as reachable -- this adapter has no way to know which specific health-check shape the plan's chosen backend target kind exposes, so it never asserts a status code or body against it).

Function build_ui_adapter

Build the ui target adapter.

build_ui_adapter() -> _UIAdapter

Returns: _UIAdapter — A fresh :class:_UIAdapter with an empty endpoint table.

Function run_ui_entrypoint

Build then serve the real admin UI (real, unmocked pnpm build/pnpm preview).

The synchronous bootstrap invoked by :data:_UI_BOOTSTRAP, inside the child process the supervisor spawns. Runs pnpm build to completion first, blocking (PUBLIC_API_URL is already present in this process's own environment -- merged in by :meth:_UIAdapter.prepare's :class:~parrot.e2e.targets.base.LaunchSpec -- so vite.config.ts's envPrefix bakes it into the built client bundle), then chdirs into the UI project directory and execs into pnpm preview so the same process (same PID, same process group) keeps serving -- the supervisor's own SIGTERM/SIGKILL teardown reaches this process transparently across the exec.

run_ui_entrypoint() -> None

Raises:

  • SystemExit — If pnpm build exits nonzero -- this process exits with that same code, which the supervisor's own readiness-await loop reports as an early-exit target failure (never masked as "still starting").

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally