mirror of
https://github.com/rookiestar28/ComfyUI-OpenClaw.git
synced 2026-08-14 08:52:45 +00:00
Update active ComfyUI and standalone frontend compatibility anchors while preserving desktop as a lagging host surface. Refresh host-surface expectations and compatibility governance tests. Validation: Windows full test gate passed with Playwright 39 passed.
9.0 KiB
9.0 KiB
Frontend UX Walkthrough (ComfyUI-OpenClaw)
This document summarizes the current OpenClaw sidebar UI structure and how to verify it after changes.
UI Structure
- Entry:
web/openclaw.jsregisters the extension; host sidebar registration is routed throughweb/openclaw_sidebar_registration.jsso current ComfyUI sidebar-store hosts and older frontend facade hosts share one compatibility path. - Shell:
web/openclaw_ui.jsnow acts as the composition root for the sidebar shell and public singleton exports. - Actions:
web/openclaw_actions.jsowns submit/cancel/retry wiring and guarded action routing for the shell. - Queue monitor:
web/openclaw_queue_monitor.jsowns queue polling lifecycle and transient banner/status updates used by the shell. - Event/task polling: admin-console and model/task views consume deterministic delta metadata (
effective_since_seq,next_since_seq, reset/truncation hints) instead of assuming every refresh is a full snapshot. - Notification center:
web/openclaw_notification_center.jsowns persistent in-app notification storage, dedupe, acknowledge, dismiss, and deep-link behavior. - Banner runtime:
web/openclaw_banner_manager.jsowns transient banner state and shell-facing banner transitions. - Tabs:
web/openclaw_tabs.jsmanages tab registration, rendering, and remount safety. - API:
web/openclaw_api.jsprovides a normalized fetch wrapper and OpenClaw endpoints (legacy Moltbot endpoints still work). - Host surface:
web/openclaw_host_surface.jsresolves the active frontend host surface and stamps explicit metadata so standalone frontend vs desktop-embedded behavior stays testable. - Output refs:
web/openclaw_asset_refs.jsnormalizes classic history refs,asset_hash/hashrefs, and current previewable media groups (images,video,audio,3d, boundedtext) onto one media-aware contract. File-like refs stay on the bounded/viewpreview path, text refs stay escaped and bounded, and asset-service-only refs remain explicit fallback states instead of silently auto-fetching/api/assets. - Styles:
web/openclaw.cssprovides shared design tokens and component classes. - Errors and compatibility helpers:
web/openclaw_utils.jsprovidesshowError()/clearError()plus runtime legacy-class alias helpers used to keep canonicalopenclaw-*markup compatible with existingmoltbot-*selectors.
Refactor note:
web/openclaw_ui.jsshould stay focused on shell composition, shared singleton ownership, and exports.- New shell behaviors should prefer the extracted action/queue modules unless they truly belong to top-level shell assembly.
- New tab markup should use canonical
openclaw-*classes; legacymoltbot-*aliases are generated centrally at runtime instead of being duplicated in each template. - New host sidebar registration changes should stay in
web/openclaw_sidebar_registration.jsrather than duplicating ComfyUI frontend API detection inside the extension entrypoint. - Host-sensitive behaviors should consume the shared host-surface helper rather than inferring desktop vs standalone frontend from ad-hoc globals.
- Output preview flows should consume the shared asset-ref normalizer rather than assembling
/viewURLs independently in each tab, treating non-image media as broken images, or silently widening runtime behavior to direct/api/assetsfetches. - Explorer/preflight consumers should treat inventory diagnostics as snapshot-first and surface
snapshot_ts,scan_state,stale, andlast_errorinstead of blocking the UI on full rescans. - Explorer/preflight rendering should keep actionable missing-node/model failures separate from suppressed inactive-branch findings returned by the backend.
Feature Gating (Capabilities)
- Backend exposes
GET /openclaw/capabilities(legacy/moltbot/capabilitiesstill works). - Frontend fetches capabilities during setup and conditionally registers tabs:
assist_planner→ Plannerassist_refiner→ Refinerassist_streaming→ enable Planner/Refiner incremental live preview (fallback remains non-streaming)scheduler→ Variants (current gating)presets→ Libraryapprovals→ Approvals
If capabilities are unavailable, the full tab set is registered to surface actionable errors (instead of “missing tabs”).
If assist_streaming is unavailable or the stream transport degrades, Planner/Refiner automatically fall back to the existing non-stream request path.
Host-Surface Contract
- OpenClaw treats standalone
ComfyUI_frontendanddesktopas distinct frontend host surfaces. - The sidebar stamps its resolved host surface and refreshed host-reference metadata at mount time so desktop bundle drift is explicit in diagnostics and regression tests.
- The standalone Remote Admin Console now stamps the same host-surface metadata on its document root, including desktop
0.9.4, bundled core0.22.3, embedded frontend1.43.18, and lagging parity relative to standalone frontend1.47.6. - Graph/widget compatibility code should route through shared host helpers to keep nested-subgraph and promoted-widget behavior aligned with current upstream host semantics.
Standalone Remote Admin Console
- Entry route:
GET /openclaw/admin(legacyGET /moltbot/adminstill works). - HTML shell:
web/admin_console.html - Runtime app module:
web/admin_console_app.js - Runtime API module:
web/admin_console_api.js - Purpose: mobile-friendly standalone operations UI for non-sidebar workflows.
- Security model:
- The page itself is a static shell and can render without authentication.
- All write APIs still enforce backend admin policy (
X-OpenClaw-Admin-Tokenand remote policy such asOPENCLAW_ALLOW_REMOTE_ADMIN).
- Runtime behaviors:
- Dashboard summary + health/config snapshots
- Jobs/Events polling + SSE stream connect/fallback
- Delta-aware polling cursors for events and managed-task refresh loops
- Approvals/Schedules/Triggers control actions
- Config read/partial write and diagnostics access
- Quick Actions (retry/refresh/drill) remain backend-authorized
Remote Console Manual Checks
- Open
http://<host>:<port>/openclaw/adminfrom desktop and phone browsers. - Save an admin token via the console and verify protected actions succeed.
- Clear token and verify write actions fail with explicit auth/policy errors.
- Connect SSE, then trigger a run; verify event stream updates and fallback polling still works.
- Confirm there is no blank/overflow breakage on narrow mobile widths.
- If you are validating desktop parity, confirm the page root resolves the expected host-surface metadata instead of silently defaulting to standalone assumptions.
Quick Manual Checks
- Open ComfyUI and confirm OpenClaw appears in the sidebar.
- Switch between all visible tabs multiple times (and reopen the sidebar if possible) and ensure panes do not go blank.
- Confirm the sidebar host-surface metadata resolves correctly for the current environment instead of defaulting silently.
- Planner: click Plan Generation with minimal input and confirm either live preview/stage updates appear (when streaming is supported) or a readable fallback result/error appears.
- Refiner: click Refine Prompts (with or without image) and confirm either live preview/stage updates appear (when streaming is supported) or a readable fallback result/error appears.
- Jobs: verify output previews still resolve for classic history refs, hash-backed refs, and supported media-aware refs (
images,video,audio,3d, boundedtext); asset-service-only refs should stay explicit as a bounded fallback state, and repeated polls should not duplicate rows after reconnect/resume. - Explorer: verify preflight inventory can show
refreshing/stale/errorstate without freezing the tab while deep scan work continues, and verify inactive-branch suppressed findings render separately from actionable failures. - Library/Approvals: if backend endpoints are not enabled, confirm the UI shows a clear error state (no crashes).
- If you simulate/fake a stream failure in dev tools, confirm Planner/Refiner retry through the classic non-stream path without duplicate submits or broken loading state.
E2E (Playwright) Checks
- Run:
npm test - Tests live in:
tests/e2e/specs/ - Harness:
tests/e2e/test-harness.html(mocks ComfyUI core + basic OpenClaw API calls) - Harness bootstrap now retries one transient
openclaw.jsmodule-fetch failure before surfacing a hard load error, so CI-only first-request flakiness does not get misreported as a permanent sidebar failure. - Web helper/self-test harness:
web/tests/e2e-harness.html(includes frontend helper and wrapper idempotence checks) - Desktop host parity lane:
tests/e2e/specs/desktop_host_parity.spec.jsverifies standalone vs desktop host evidence separately and covers both sidebar and Remote Admin host-sensitive behavior under the shared harness shims. - When investigating suspected harness flakes locally, prefer
npm run test:stress -- <spec>so the same shared bootstrap path is exercised repeatedly without changing the defaultnpm testcontract.