Skip to content

fix(web): sync runtime-facing chat and settings follow-ups - #1200

Closed
franknobox wants to merge 76 commits into
devfrom
patch/web-runtime-sync-followups-20260411
Closed

fix(web): sync runtime-facing chat and settings follow-ups#1200
franknobox wants to merge 76 commits into
devfrom
patch/web-runtime-sync-followups-20260411

Conversation

@franknobox

@franknobox franknobox commented Apr 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR wraps up the recent Web follow-ups after syncing dev into web, with a focus on chat runtime state, provider/settings flow, and runtime-facing form behavior.

Included

Chat runtime alignment

  • adapt Web chat turn streaming to the updated production coordinator observer flow
  • add turn.phase support to the Web chat stream model
  • improve stream-close recovery when a stream ends before a terminal event
  • keep chat-side tool and turn state more truthful to the current runtime lifecycle

Provider and settings flow

  • align onboarding and dashboard provider forms with the shared provider catalog flow
  • preserve user-entered provider routes more safely during provider switches
  • reject provider kind / route mismatches during provider apply
  • normalize provider readback between base URL and explicit endpoint semantics

Memory and preferences

  • expose memory.sliding_window in onboarding and dashboard settings
  • validate the memory window on save instead of forcing a number control UX
  • keep the current form state when the memory window input is invalid
  • keep the active runtime config aligned with the current ~/.loong/ home

UI and copy polish

  • refine runtime form copy so helper text stays brief and useful
  • simplify scattered helper text and keep guidance in the main note line
  • clean up runtime form input behavior and styling across the current theme system

Notes

  • record follow-up notes for skills runtime truth, tool explainability, chat personalization, and turn-phase UI in web/docs/note.md

Validation

  • npm.cmd run build in web/
  • cargo check -p loongclaw

Summary by CodeRabbit

  • New Features

    • Introduced Web Console for local interaction with chat sessions, provider configuration, and system dashboard.
    • Added chat interface with multi-session support, streaming messages, and session history.
    • Implemented personalization, channels, and skills management panels in Abilities section.
    • Added theme (dark/light) and language (English/Chinese) switching.
    • Introduced onboarding flow for provider setup and configuration validation.
    • Added installation, status, and removal commands for Web Console.
  • Chores

    • Updated git ignore patterns for temporary logs and build artifacts.
    • Reorganized conditional compilation for platform-specific modules.

franknobox and others added 30 commits March 17, 2026 15:01
Add proposed design documentation for the LoongClaw Web Console in both English and Chinese (web/DESIGN.md and web/DESIGN.zh-CN.md). Documents define goals, positioning, architecture (local-first frontend/backend split), conversation model, API surface, install/distribution modes, security defaults, commands, implementation phases, open questions, and acceptance criteria (last updated 2026-03-17).
Remove the old English web/DESIGN.md; relocate and update the Chinese DESIGN file to web/docs/DESIGN.zh-CN.md (rename and replace `webchat` keys/usages with `web` and adjust command names). Add new Chinese documentation files: web/docs/API.zh-CN.md (local HTTP API draft) and web/docs/STACK.zh-CN.md (web/ layout and tech-stack guidance). Overall: consolidate web documentation under web/docs and introduce API and STACK proposals in zh-CN.
Introduce a local Web Console API and integrate it into the daemon CLI. Adds a new axum-based web_cli with HTTP endpoints for health, meta, dashboard, chat sessions, history, turn submission, and CORS handling; exposes a WebCommand (serve) and wires it into the main daemon command runner.

Expand app memory/sqlite APIs to support listing and clearing recent conversation sessions: add ConversationSessionSummary type, list_recent_sessions_direct and clear_session_direct helpers, and expose them from memory/mod.rs. Make DEFAULT_TOKEN_TTL_S and bootstrap_kernel_context public to allow web API usage of kernel bootstrap.

Add web/ frontend skeleton (assets, i18n, pages, TS config, package files) and update docs (API and DESIGN zh-CN) to describe the Web Phase 1 API and design. Update crates/daemon/Cargo.toml to include axum workspace dependency and export the new web_cli module.
Introduce a visual and structural overhaul for the dashboard and related UI: add decorative background ornaments/axes in RootLayout, update NavBar branding to a compact wordmark (LOONGCLAW web), and restructure the Chat composer (wrapped textarea, floating submit button with accessible sr-only label). Rewrite DashboardPage: new summary card layout, runtime/provider/memory/install/tools cards, two-column main/side layout, provider list and settings panel rework, and additional i18n keys for both en and zh-CN. Large CSS updates: custom scrollbars, background ornament/axis styles, many layout/component style refinements (panels, pills, dashboard grids, buttons, composer, responsive adjustments), and unify theming by adding new color variables and adjusting theme/panel/background gradients. These changes improve visual clarity, accessibility, and theming consistency while preparing the UI for future controlled write paths and runtime interactions.
Add PowerShell scripts scripts/web/start-dev.ps1 and scripts/web/stop-dev.ps1 to launch and stop the local web API (loongclaw) and Vite preview as hidden background processes. Both scripts manage processes by port, write runtime logs to %USERPROFILE%\.loongclaw\logs (web-api.log, web-api.err.log, web-preview.log, web-preview.err.log), and start the preview on port 4173 and the API on 4317 by default. Update web/docs/DESIGN.zh-CN.md and web/docs/STACK.zh-CN.md to document the runtime file/log location and recommend these scripts to avoid polluting the repository working tree and Git status with runtime artifacts.
# Conflicts:
#	crates/app/src/context.rs
Replace the old "preview" dev workflow with a "dev" workflow and adjust related logging/ports: rename PreviewHost/Port and preview logs to DevHost/DevPort and web-dev.log in start-dev.ps1, start vite in dev mode (remove prebuilt dist step), and update readiness checks and output messages. Update Chinese docs (API, DESIGN, STACK) to reflect current implementation progress, priorities, and the change to using vite dev; bump last-updated dates. UI changes: make Panel accept className and hideHeader, update ChatPage to use the new panel options and add a connection status dot. CSS overhaul: refine chat/panel layout and spacing, add scoped panel-chat-main rules, shared regions/comments, scrollbar styling, and tweak input background color in themes.css. These changes align the dev workflow to live dev (vite dev), improve chat UI flexibility and visuals, and bring docs up to date with current implementation status.
Introduce native provider streaming support and local web API streaming endpoints.

Key changes:
- Pass an optional AcpTurnEventSink through ConversationRuntime/provider request paths to emit incremental events.
- Implement execute_openai_streaming_turn_request to request provider-native SSE streams, decode OpenAI-style events, reconstruct assistant text and function/tool calls, and forward deltas to the event sink. Falls back to existing buffered path when needed.
- request_dispatch_runtime will prefer the native streaming path for OpenAI-compatible transports and fall back to the previous execute_model_request flow on errors or unsupported providers.
- Web daemon: add local API token auth (env / file), token resolution/generation, protected /api routes, an NDJSON streaming endpoint for turn events (/chat/sessions/{id}/turns/{turn_id}/stream), per-turn stream state, WebTurnEventSink to forward provider deltas to clients, and several dashboard/connectivity/config endpoints used by the UI.
- Update many call sites and tests to propagate the new optional event_sink parameter (using None where not applicable).
- Minor housekeeping: add temporary web log ignores to .gitignore and add required dependencies in daemon Cargo.toml.

These changes enable low-latency incremental assistant updates from compatible providers and a streaming web API for the frontend to consume them.
Add a memory window metric to the ChatPage inspector panel: introduce memoryWindow state, reset it when sessions change, and display localized label/value/pending/hint UI. Fetch the slidingWindow from dashboardApi.loadConfig() on auth/config changes and handle 401 via markUnauthorized. Add corresponding i18n entries for en and zh-CN.
Introduce a temporary Web-only "tool assist" feature to nudge discovery-first tool flows without changing user-visible messages or shared CLI behavior. Backend: add optional tool_assist_hint to ChatTurnRequest and thread it through run_chat_turn_stream to append a one-shot marker into the turn CLI system prompt when present. Frontend: add a persistent composer toggle, simple intent detection heuristics, and hint builder; pass toolAssistHint in createTurn when enabled. Also add i18n entries for the toggle (en/zh), small zh copy fixes, and basic CSS for the new toggle. This is intentionally lightweight and reversible (hint remains optional so rollback is a one-line removal).
Introduce a minimal web onboarding flow: server endpoints and frontend integration.

Server: crates/daemon/src/web_cli.rs
- Add onboarding payloads and request types.
- Implement /api/onboard/status, POST /api/onboard/provider and POST /api/onboard/validate.
- Add provider validation and probing utilities (header building, model selection, lightweight validation paths) and status-building logic.
- Persist minimal provider edits to local config and merge public/protected API routers.

Frontend and UX:
- Add OnboardingStatusPanel component and onboarding API client (web/src/features/onboarding/api/index.ts).
- Show onboarding panel in RootLayout when onboarding is blocking (useWebConnection integration).
- Update WebSessionContext and related assets to surface onboarding state.
- Add i18n keys for chat/common/dashboard locales.

Docs: Update Chinese docs (API, DESIGN, STACK) to document new onboarding endpoints, behavior and update timestamps.

Misc: minor CSS and dashboard/config payload additions to surface prompt/personality fields.

This implements a lightweight controlled write+validate path for onboarding provider configuration and a read-only status endpoint for guiding first-run UX.
Refactor: move onboarding-related types, handlers and helper functions out of crates/daemon/src/web_cli.rs into a new module crates/daemon/src/web_cli/onboarding.rs and update route registrations to call onboarding::onboard_status, onboarding::onboard_provider and onboarding::onboard_validate. Frontend: add web/src/styles/dashboard.css and import it from web/src/styles/index.css while removing the inlined dashboard styles from index.css. This cleans up the web CLI file and separates dashboard styles for better organization.
Introduce automatic local pairing and onboarding preferences support.

- Web API: add POST /onboard/pairing/auto and /onboard/pairing/clear to set/clear an HttpOnly pairing cookie (restricted to trusted loopback origins) so the token is not returned in plaintext to the page. Add POST /onboard/preferences to persist lightweight onboarding prefs (personality, memory_profile, prompt_addendum).
- Server: support extracting pairing token from Cookie header, build/clear pairing cookie helpers, allow Origin-based local CORS with Access-Control-Allow-Credentials and Vary: Origin, and add a WebApiError::forbidden helper.
- Onboarding: extend status payload with personality, memory_profile, prompt_addendum and wire preference write + auto-pairing/clear handlers; persist preferences into config when written.
- Docs & frontend: update Chinese API / DESIGN / STACK docs and touch frontend locales, onboarding UI, session/context and API client assets and styles to reflect the new endpoints and onboarding flows.

These changes enable a safer local auto-pairing UX, allow origin-restricted CORS for local dev, and surface light user preferences in onboarding.
Enhance auth-related UX by injecting tokenPath and tokenEnv into localized invalid-token messages. Update ChatPage and DashboardPage to obtain and pass tokenPath/tokenEnv from useWebConnection and to use them when constructing error strings (including updating toFriendlyChatError signature). Adjust OnboardingStatusPanel to show a new auto-pairing hint inside the token entry form. Add corresponding i18n strings in English and Chinese for the banner/body and the auto-pairing notice.
Relax provider validation to treat credential_status of "request_rejected" as an acceptable outcome alongside "validated"; the endpoint must still be reachable. This allows first-run onboarding to proceed when a provider rejects a provider-specific probe shape (which still proves the endpoint and credentials are wired up). Also clarifies the onboarding validation comment to explain the intent.
Back-end: add a new POST /onboard/provider/apply route that validates a candidate provider config and only writes it to disk when validation passes. Refactor onboarding write logic into helpers (load_or_default_web_config, apply_provider_request_to_config, route_matches_existing_provider_route) and make onboard_provider stop writing directly (delegating apply+validate to the new endpoint).

Front-end: add onboardingApi.applyProvider and update Dashboard to call it. Dashboard now shows a pending/success/error modal when applying provider settings, handles validation failures with appropriate messages, and updates onboarding state using a new acceptValidatedOnboardingStatus handler. WebSessionContext: persist onboarding validation keys via sessionStorage through a helper, expose acceptValidatedOnboardingStatus, and adjust auto-pairing / token pairing checks.

Other UI changes: make the root layout keep Chat and Dashboard mounted (hidden) to preserve state, wire Enter (without Shift/composition) to submit the chat composer, and tweak onboarding provider form behavior to clear inherited route when switching kinds. Add dashboard modal styles in CSS. Script: remove user-level ARK_API_KEY passthrough from start-dev.ps1.

These changes implement a safer apply/validate workflow for provider configuration and improve UX around applying settings and preserving UI state.
Add scripts/scripts/web/start-dev.sh and stop-dev.sh to manage the web development environment. start-dev.sh prepares log/run dirs, kills processes on configured ports, verifies the loongclaw daemon and Vite binaries, launches the API and Vite dev server (nohup), writes PID files, and waits for readiness endpoints. stop-dev.sh stops processes by PID files and by port (4317/4173) and cleans up PID files. Scripts use sensible defaults and locations (~/.loongclaw/{logs,run}) and provide guidance if build/install steps are missing.
Back-end: include ToolRuntimeConfig in dashboard API and pass it to build_tool_items so tool summaries reflect runtime readiness. Update build_tool_items to show runtime-aware details for browser_companion, add web_search and file_tools items.

Front-end: add workspace-stage class to workspace panes; reorganize DashboardPage to separate runtime and local config into stacked sections with headings; wire in new localized labels. Update i18n (en / zh-CN) to include new labels and tool names.

Session handling: persist an onboarding acknowledgment key in sessionStorage, expose acknowledgedOnboardingKey in WebSessionContext, and update helpers to persist/clear acknowledgment and use it in onboarding status.

Styling: tweak dashboard grid columns and provider min-width, add styles for stacked sections and workspace-stage.
Introduce a read-only Debug Console for the Dashboard: add server-side runtime debug state, recording of turn/tool events (started/finished/delta/failed/completed), and an API endpoint GET /api/dashboard/debug-console. Implement log tailing and ANSI-stripping utilities, limit and trim recent debug blocks, and wire debug recordings into onboarding and turn/tool event flows. Update chat history to use a visible-message-limited loader (ignoring internal assistant records so they don't consume UI message quota). Add frontend locale strings and docs describing the debug console, plus related UI/style changes.
Enable serving a same-origin static web UI from the daemon and add session-based auth. Introduces a --static-root option and static asset resolver + fallback (serve_web_static), enforces same-origin write origins, and adds session/pairing cookie builders and token extraction in a new auth module. Refactors debug console logic into its own module and adds a DebugConsolePanel React component. Updates API meta/onboarding payloads and frontend WebSessionContext, translations, and chat/onboarding UI to handle the new auth mode. Also adds start/stop scripts and temporary web dev logs.
Reorganize web helper scripts by moving start/stop scripts into scripts/web and update their internal path resolution. The PowerShell and shell start scripts now compute repo and web roots relative to the script location so they work after the move. .gitignore updated to ignore any .tmp-web-*.log files. Add placeholder web/README.md and web/INSTALL.md.
Expand web documentation (INSTALL, README, API, DESIGN, STACK) with installation steps, dev/same-origin runtimes, API surface details, onboarding states, engineering review notes and recommended next steps; add scripts and stack/version notes for local devs. Improve web/src/lib/api/client.ts by extending ApiRequestError with method and url, adding payload error extractors and describeApiFailure, and hardening apiFetch to catch network failures and produce clearer, actionable error messages (404/unreachable/contextual request target). These changes improve local onboarding, diagnostics and runtime error reporting for front-end developers.
Keep chat/dashboard UI state alive and modernize API usage across the app.

- RootLayout: add keep-alive caching for /chat and /dashboard outlets, wrap outlet in Suspense and preserve route elements to avoid losing state when switching sections.
- Router: lazy-load Chat and Dashboard pages and mount RootLayout as the workspace root.
- Chat page: add per-session view caching, persist selected session in sessionStorage, auto-scroll improvements, per-session stream/event handling, optimistic UI fixes and various stream/session state refactors.
- WebSessionContext: switch to onboardingApi helpers, add AbortController handling, centralize offline onboarding status construction and avoid noisy errors for aborted requests.
- API surfaces: refactor chat/dashboard/onboarding APIs to use new client primitives (apiGetData, apiPostData, apiOpenStream, request option/timeout handling, buildApiUrl), introduce default timeouts and better stream parsing/error messages.
- Onboarding/Dashboard UI: extract provider & preferences form helpers (providerConfig.ts), wire DashboardPage and OnboardingStatusPanel to use the new form utilities and unified save/validation/error handling.

These changes improve UX by preserving workspace state, make API calls more robust (timeouts/abort support), and consolidate onboarding/provider configuration logic into reusable utilities.
Add three new subcommands under `loongclaw web`:

- `web install --source <path>` — copies a built frontend dist
  directory to ~/.loongclaw/web/dist and writes an install.json
  manifest (installed_at, source_path, install_dir)
- `web status` — reads the manifest and reports install state,
  including an asset integrity check for dist/index.html
- `web remove [--force]` — removes dist/ and install.json;
  requires --force to confirm

`web serve` now auto-detects ~/.loongclaw/web/dist when
--static-root is not supplied, enabling same-origin-static mode
without an explicit flag after installation.

Also fix pre-existing clippy warnings (collapsible-if, wildcard
match, indexing-may-panic, clamp-like pattern) that were blocking
`-D warnings` in CI.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
franknobox and others added 20 commits April 5, 2026 02:47
…aces

- add the new Abilities page skeleton and wire it into navigation and keep-alive routing
- rename the visible Dashboard surface to Status while keeping dashboard code paths intact
- refine chat session/tool state presentation, including recent tool retention across session switches
- tighten chat header/layout details and restore the intended code block background treatment
- improve status-side tool summaries and refresh related Web docs to match the current structure
…followups-20260405

feat(web): add abilities shell and refine chat/status surfaces
- add the new Abilities page shell with left-side section navigation
- add initial Personalization, Channels, and Skills panels
- add daemon-side abilities endpoints and wire them into the Web API
- refine abilities page layout and styling to use a simpler line-based UI
- align visible dashboard tool metadata text with the updated formatting
- keep visible Dashboard naming as Status while leaving internal dashboard paths unchanged
- fix post-merge daemon compile issues in web abilities/channel read-model handling
…n UX

- add initial abilities personalization read/write flow and keep channels/skills in dedicated sections
- add abilities-specific select controls, layout refinements, and documentation notes
- refine chat sessions with local rename overrides, friendlier activity timestamps, and generating state hints
- update web docs to reflect the current abilities surface and chat session behavior
# Conflicts:
#	crates/app/src/memory/mod.rs
- split locale resources into app, abilities, chat, and dashboard namespaces\n- expand abilities with mascot controls plus refined channels and skills layouts\n- keep the experimental chat mascot hidden by default behind an abilities toggle\n- refine runtime page copy, tool metadata, and debug terminal presentation\n- suppress low-value debug noise and document follow-up channels/skills notes
…e-followups-20260406

feat(web): expand abilities workspace and polish runtime surfaces
- remove the duplicate futures-util workspace dependency from crates/daemon/Cargo.toml\n- add the missing WhatsappServe logging match arm so the daemon CLI builds again\n- unblock rebuilding loongclaw so the web subcommand is available on Linux and Windows
…-fix-20260407

fix(cli): restore web subcommand buildability
- add the missing unix-only fs import in doctor_security_cli\n- restore the gateway control runtime and token file mode constants\n- unblock cargo build --bin loongclaw on Linux after the recent merge
…-fix-20260407

fix(unix): restore daemon build after dev merge
…-20260411

fix (web) : provider setup flow and sync runtime-facing docs
@coderabbitai

coderabbitai Bot commented Apr 11, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 81e6fde3-c936-4117-bfb1-0dfbdeca7b95

📥 Commits

Reviewing files that changed from the base of the PR and between 45cb012 and 05dc641.

⛔ Files ignored due to path filters (3)
  • web/package-lock.json is excluded by !**/package-lock.json
  • web/public/favicon.svg is excluded by !**/*.svg
  • web/src/assets/brand/icon.svg is excluded by !**/*.svg
📒 Files selected for processing (128)
  • .gitignore
  • crates/app/src/chat/cli_input.rs
  • crates/app/src/config/mod.rs
  • crates/app/src/config/provider.rs
  • crates/app/src/context.rs
  • crates/app/src/conversation/runtime.rs
  • crates/app/src/conversation/turn_coordinator.rs
  • crates/app/src/memory/mod.rs
  • crates/app/src/memory/sqlite.rs
  • crates/app/src/provider/mod.rs
  • crates/app/src/provider/request_dispatch_runtime.rs
  • crates/app/src/provider/request_executor.rs
  • crates/app/src/provider/tests.rs
  • crates/daemon/src/command_kind.rs
  • crates/daemon/src/doctor_security_cli.rs
  • crates/daemon/src/gateway/control.rs
  • crates/daemon/src/lib.rs
  • crates/daemon/src/main.rs
  • crates/daemon/src/web/abilities.rs
  • crates/daemon/src/web/auth.rs
  • crates/daemon/src/web/chat.rs
  • crates/daemon/src/web/dashboard.rs
  • crates/daemon/src/web/debug_console.rs
  • crates/daemon/src/web/install.rs
  • crates/daemon/src/web/mod.rs
  • crates/daemon/src/web/onboarding.rs
  • crates/daemon/src/web/serve.rs
  • crates/daemon/tests/integration/import_cli.rs
  • scripts/web/start-dev.ps1
  • scripts/web/start-dev.sh
  • scripts/web/start-same-origin.ps1
  • scripts/web/start-same-origin.sh
  • scripts/web/stop-dev.ps1
  • scripts/web/stop-dev.sh
  • scripts/web/stop-same-origin.ps1
  • scripts/web/stop-same-origin.sh
  • web/.gitignore
  • web/INSTALL.md
  • web/README.md
  • web/docs/API.zh-CN.md
  • web/docs/DESIGN.zh-CN.md
  • web/docs/STACK.zh-CN.md
  • web/docs/note.md
  • web/index.html
  • web/package.json
  • web/public/site.webmanifest
  • web/src/App.tsx
  • web/src/app/i18n.ts
  • web/src/app/layouts/RootLayout.tsx
  • web/src/app/providers.tsx
  • web/src/app/router.tsx
  • web/src/assets/locales/en/abilities.json
  • web/src/assets/locales/en/app.json
  • web/src/assets/locales/en/chat.json
  • web/src/assets/locales/en/dashboard.json
  • web/src/assets/locales/zh-CN/abilities.json
  • web/src/assets/locales/zh-CN/app.json
  • web/src/assets/locales/zh-CN/chat.json
  • web/src/assets/locales/zh-CN/dashboard.json
  • web/src/components/feedback/CopyButton.tsx
  • web/src/components/feedback/index.ts
  • web/src/components/inputs/ChoiceField.tsx
  • web/src/components/layout/NavBar.tsx
  • web/src/components/navigation/index.ts
  • web/src/components/status/ConnectionBadge.tsx
  • web/src/components/status/LocalTokenBanner.tsx
  • web/src/components/surfaces/Panel.tsx
  • web/src/contexts/ThemeContext.tsx
  • web/src/contexts/ThemeContextValue.ts
  • web/src/contexts/WebSessionContext.tsx
  • web/src/features/abilities/api/index.ts
  • web/src/features/abilities/components/AbilitiesNav.tsx
  • web/src/features/abilities/components/AbilitiesSelectField.tsx
  • web/src/features/abilities/components/ChannelSurfaceIcon.tsx
  • web/src/features/abilities/components/ChannelsPanel.tsx
  • web/src/features/abilities/components/MascotPanel.tsx
  • web/src/features/abilities/components/PersonalizationPanel.tsx
  • web/src/features/abilities/components/SkillsPanel.tsx
  • web/src/features/abilities/hooks/useAbilitiesData.ts
  • web/src/features/abilities/pages/AbilitiesPage.tsx
  • web/src/features/chat/api/index.ts
  • web/src/features/chat/components/ChatMascot.tsx
  • web/src/features/chat/components/MarkdownBlock.tsx
  • web/src/features/chat/components/MarkdownCodeBlock.tsx
  • web/src/features/chat/components/chat-mascot.css
  • web/src/features/chat/components/index.ts
  • web/src/features/chat/hooks/index.ts
  • web/src/features/chat/hooks/useChatSessions.ts
  • web/src/features/chat/hooks/useChatStream.ts
  • web/src/features/chat/mascotPreference.ts
  • web/src/features/chat/pages/ChatPage.tsx
  • web/src/features/chat/types/index.ts
  • web/src/features/dashboard/api/index.ts
  • web/src/features/dashboard/components/DebugConsolePanel.tsx
  • web/src/features/dashboard/components/index.ts
  • web/src/features/dashboard/hooks/index.ts
  • web/src/features/dashboard/hooks/useDashboardData.ts
  • web/src/features/dashboard/pages/DashboardPage.tsx
  • web/src/features/dashboard/types/index.ts
  • web/src/features/onboarding/api/index.ts
  • web/src/features/onboarding/components/OnboardingStatusPanel.tsx
  • web/src/features/onboarding/hooks/useOnboardingFlow.ts
  • web/src/features/onboarding/provider/providerCatalog.ts
  • web/src/features/onboarding/provider/providerConfig.ts
  • web/src/hooks/useLocale.ts
  • web/src/hooks/useTheme.ts
  • web/src/hooks/useWebConnection.ts
  • web/src/hooks/useWebSessionManager.ts
  • web/src/lib/api/client.ts
  • web/src/lib/api/errors.ts
  • web/src/lib/api/types.ts
  • web/src/lib/auth/tokenHint.ts
  • web/src/lib/auth/tokenStore.ts
  • web/src/lib/config/env.ts
  • web/src/lib/utils/format.ts
  • web/src/lib/utils/storage.ts
  • web/src/main.tsx
  • web/src/styles/abilities.css
  • web/src/styles/chat.css
  • web/src/styles/dashboard.css
  • web/src/styles/index.css
  • web/src/styles/themes.css
  • web/src/styles/variables.css
  • web/src/vite-env.d.ts
  • web/tsconfig.app.json
  • web/tsconfig.json
  • web/tsconfig.node.json
  • web/vite.config.ts

📝 Walkthrough

Walkthrough

This pull request introduces a comprehensive Web Console feature for LoongClaw, adding a local web UI served by the daemon with chat, dashboard, abilities, and onboarding interfaces. It threads an optional event sink through the conversation/provider request pipeline, expands provider catalog metadata APIs, adds session management to the memory layer, and includes complete frontend implementation with localization and supporting startup scripts.

Changes

Cohort / File(s) Summary
Config & Provider Metadata
crates/app/src/config/provider.rs, crates/app/src/config/mod.rs
Added ProviderCatalogEntry struct and provider_catalog_entries() function; introduced is_coding_variant() and catalog_entry() methods on ProviderKind; added default_models_path_for_kind() helper and refactored configuration_hint() delegation to new kind_route_mismatch_hint() for Byteplus/Volcengine mismatch detection.
Conversation Event Sink Threading
crates/app/src/conversation/runtime.rs, crates/app/src/conversation/turn_coordinator.rs
Added request_turn_with_event_sink() method to ConversationRuntime trait; threaded optional AcpTurnEventSink parameter through turn continuation/resolution paths and into follow-up provider turn requests.
Provider Request Dispatch
crates/app/src/provider/mod.rs, crates/app/src/provider/request_dispatch_runtime.rs, crates/app/src/provider/tests.rs
Updated request_turn() and request_turn_in_view() signatures to accept optional event_sink parameter; implemented OpenAI streaming dispatch using execute_openai_streaming_turn_request with capability flags; updated test call sites.
Memory Session Management
crates/app/src/memory/sqlite.rs, crates/app/src/memory/mod.rs
Added ConversationSessionSummary struct; introduced list_recent_sessions_direct() and clear_session_direct() public APIs; re-exported new session/summary types and functions.
Daemon Context & Bootstrap
crates/app/src/context.rs
Updated bootstrap_kernel_context() to delegate to bootstrap_kernel_context_with_audit_sink() using InMemoryAuditSink::default() for ephemeral audit retention in MVP/development scenarios.
Daemon CLI & Utilities
crates/daemon/src/command_kind.rs, crates/daemon/src/main.rs, crates/daemon/src/doctor_security_cli.rs, crates/daemon/src/gateway/control.rs
Added Commands::Web variant handling; dispatched to web_cli::run_web_command(); added Unix-only #[cfg(unix)] guards for filesystem imports; reformatted gateway control whitespace.
Web Backend Core
crates/daemon/src/web/mod.rs, crates/daemon/src/web/serve.rs, crates/daemon/src/web/auth.rs
Introduced complete web API runtime with WebApiState, request/response envelopes, and error handling; implemented run_web_serve() with Axum router, CORS, and SPA fallback; added token-based authentication middleware (require_local_token, require_same_origin_write_origin) and cookie builders for session/pairing modes.
Web Handlers: Chat & Session
crates/daemon/src/web/chat.rs
Implemented chat session CRUD handlers (chat_sessions, create_chat_session, chat_history, delete_chat_session); added turn streaming endpoint (chat_turn_stream) with NDJSON output and per-turn event sink integration via run_chat_turn_stream.
Web Handlers: Dashboard & Status
crates/daemon/src/web/dashboard.rs
Implemented eight dashboard endpoints returning provider/runtime/config/connectivity/tools/debug-console summaries with probing, DNS resolution, and recommendation logic.
Web Handlers: Abilities
crates/daemon/src/web/abilities.rs
Implemented four ability endpoints (abilities_personalization, abilities_personalization_save, abilities_channels, abilities_skills) with configuration loading, field normalization, and snapshot building.
Web Handlers: Onboarding
crates/daemon/src/web/onboarding.rs
Implemented seven onboarding endpoints covering status, provider config/apply/validation, preferences, and pairing flows; added internal helpers for credential/endpoint validation via lightweight reqwest probes and config routing logic.
Web Handlers: Debug Console
crates/daemon/src/web/debug_console.rs
Implemented debug console endpoint with turn summary, tool activity, failure tracking, log tailing, and event block lifecycle; added record_debug_operation() helper for debug state mutations.
Web Installation Management
crates/daemon/src/web/install.rs
Implemented run_web_install(), run_web_status(), run_web_remove() with atomic staging/promotion, manifest persistence (install.json), and rollback on failure.
Integration Tests
crates/daemon/tests/integration/import_cli.rs
Updated test calls to mvp::provider::request_turn() with new None event_sink parameter.
Web Frontend: App Shell
web/src/App.tsx, web/src/app/router.tsx, web/src/app/layouts/RootLayout.tsx, web/src/app/providers.tsx, web/src/app/i18n.ts
Set up React app with Router, theme/session providers, root layout with keep-alive caching for /chat, /dashboard, /abilities, and i18n integration with locale persistence.
Web Frontend: Chat Feature
web/src/features/chat/pages/ChatPage.tsx, web/src/features/chat/api/index.ts, web/src/features/chat/hooks/useChatSessions.ts, web/src/features/chat/hooks/useChatStream.ts, web/src/features/chat/types/index.ts, web/src/features/chat/components/*
Implemented full chat UI with session management, message streaming (NDJSON), markdown rendering with syntax highlighting, mascot animations, tool status tracking, and per-session view state caching.
Web Frontend: Dashboard Feature
web/src/features/dashboard/pages/DashboardPage.tsx, web/src/features/dashboard/api/index.ts, web/src/features/dashboard/hooks/useDashboardData.ts, web/src/features/dashboard/components/*, web/src/features/dashboard/types/index.ts
Implemented dashboard with provider/runtime/config/connectivity/tools summaries, optional debug console polling, and settings application (provider/preferences) with modal-driven flows.
Web Frontend: Abilities Feature
web/src/features/abilities/pages/AbilitiesPage.tsx, web/src/features/abilities/api/index.ts, web/src/features/abilities/hooks/useAbilitiesData.ts, web/src/features/abilities/components/*
Implemented abilities pages (personalization, channels, skills, mascot) with form editing, read-only snapshots, channel icon mapping, and per-section loading/error handling.
Web Frontend: Onboarding Feature
web/src/features/onboarding/pages/*, web/src/features/onboarding/api/index.ts, web/src/features/onboarding/hooks/*, web/src/features/onboarding/components/OnboardingStatusPanel.tsx
Implemented onboarding flow with provider selection, API key input, preferences form, token pairing, and validation staging; added provider catalog building and form state hooks.
Web Frontend: Shared Hooks & Components
web/src/hooks/useTheme.ts, web/src/hooks/useLocale.ts, web/src/hooks/useWebConnection.ts, web/src/contexts/ThemeContext.tsx, web/src/contexts/ThemeContextValue.ts, web/src/contexts/WebSessionContext.tsx, web/src/components/*
Implemented theme/locale/connection context hooks, auth/status components (LocalTokenBanner, ConnectionBadge), layout components (NavBar, Panel), and reusable input components (ChoiceField, AbilitiesSelectField, CopyButton).
Web Frontend: Localization
web/src/assets/locales/en/*, web/src/assets/locales/zh-CN/*
Added complete bilingual i18n resources for chat, dashboard, abilities, and app-level UI (English and Simplified Chinese).
Web Startup Scripts
scripts/web/start-dev.sh, scripts/web/start-dev.ps1, scripts/web/start-same-origin.sh, scripts/web/start-same-origin.ps1, scripts/web/stop-dev.sh, scripts/web/stop-dev.ps1, scripts/web/stop-same-origin.sh, scripts/web/stop-same-origin.ps1
Added cross-platform (Bash and PowerShell) scripts for starting dev environment (separate daemon and Vite servers) and same-origin mode (static assets served with daemon); stop scripts to clean up ports.
Web Configuration & Docs
web/.gitignore, web/package.json, web/index.html, web/public/site.webmanifest, web/README.md, web/INSTALL.md, web/docs/API.zh-CN.md, web/docs/DESIGN.zh-CN.md, web/docs/STACK.zh-CN.md, web/docs/note.md
Added project configuration, build manifest, and comprehensive documentation (English README, bilingual design/API/stack docs, and feature notes).
Misc
.gitignore
Added log file ignore pattern /.tmp-web-*.log.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Web Client
    participant Server as Daemon (Web API)
    participant Runtime as Kernel Runtime
    participant Provider as LLM Provider
    
    Client->>Server: POST /api/chat/turn (input, sessionId)
    activate Server
    
    Server->>Server: Load config, init runtime
    Server->>Server: Create ACP EventSink
    Server->>Runtime: Create ConversationTurnCoordinator
    Server->>Runtime: request_turn_with_event_sink(eventSink)
    activate Runtime
    
    Runtime->>Provider: request_turn_in_view(eventSink)
    activate Provider
    
    Provider->>Provider: Build request body
    Provider->>Provider: execute_openai_streaming_turn_request
    note over Provider: Emits events via eventSink<br/>(turn.started, message.delta, tool.started, etc.)
    Provider-->>Runtime: ProviderTurn
    deactivate Provider
    
    Runtime-->>Server: ProviderTurn
    deactivate Runtime
    
    Server->>Server: Transform turn to NDJSON events
    note over Server: turn.started, message.delta chunks,<br/>turn.completed or turn.failed
    Server-->>Client: Response stream (application/x-ndjson)
    deactivate Server
    
    Client->>Client: Parse NDJSON, update UI<br/>(stream phase, assistant message, tools)
    note over Client: Keep-alive on disconnect,<br/>reconcile on unexpected close
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

web-console, conversation, config, memory, frontend, size: XL

Suggested reviewers

  • gh-xj
  • dianzuan
  • chumyin

Poem

🐰 A new web console hops into view,
With chat and dashboards shining bright and true!
Event sinks streaming through the conversation tide,
Onboarding flows and abilities ride.
From Rust backend to React's graceful dance,
The Web Console takes its grand stance!

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch patch/web-runtime-sync-followups-20260411

@github-actions github-actions Bot added documentation Improvements or additions to documentation. daemon Daemon binary, CLI entrypoints, and install flow. providers Provider routing, selection, and transport behavior. memory Memory system, context assembly, and persistence flow. conversation Conversation runtime, session flow, and prompt assembly. config Runtime config parsing, schema, and defaults. size: XL Very large pull request: more than 1000 changed lines. labels Apr 11, 2026
@franknobox franknobox closed this Apr 11, 2026
@franknobox
franknobox deleted the patch/web-runtime-sync-followups-20260411 branch April 15, 2026 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Runtime config parsing, schema, and defaults. conversation Conversation runtime, session flow, and prompt assembly. daemon Daemon binary, CLI entrypoints, and install flow. documentation Improvements or additions to documentation. memory Memory system, context assembly, and persistence flow. providers Provider routing, selection, and transport behavior. size: XL Very large pull request: more than 1000 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant