Repository navigation
Settings, Help, Theme UI with AI Assistant Panels - #239
Conversation
Session/User Architecture Fixes: - SessionDaemonServer: Reconstruct user from DB when loading sessions from file (prevents stale user state from JSON serialization) - SessionDaemonServer: Refresh user from DB when returning existing shared session (ensures browser gets current contentState, preferences) - BaseWidget: Handle both BaseUser instances and plain objects from WebSocket (plain objects from JSON don't have id getter, access entity.id directly) Documentation: - README: Add link to AI-ALIGNMENT-PHILOSOPHY.md in Architecture & Vision section Note: Tab system infrastructure is in place but browser session user transmission needs more architectural work to fully function. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add state/content/close and state/content/switch commands (generated) - Implement tab click handler in MainWidget (switches rooms via ROOM_SELECTED) - Implement tab close handler with optimistic UI - Optimize RoomListWidget.selectRoom() with optimistic UI (no server blocking) - Add ROOM_SELECTED subscription to RoomListWidget for sidebar sync - Fix UserStateEntity.addContentItem() deduplication (check entityId not id) Known issues: Tab active CSS not updating, some state bugs with room mapping 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add PANTHEON and DEV_UPDATES to DEFAULT_ROOMS with deterministic UUIDs - Update seed script to use ROOM_IDS constants instead of hardcoded strings - Fix seed script to check for existing rooms (not just users) before creating - Import stringToUUID for message ID generation This fixes the state bugs where Dev Updates was going to Academy - the non-UUID string IDs were causing lookups to fail and trigger fallbacks. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- JTAGClientBrowser: Dispatch DOM events for incoming WebSocket events so browser widgets can receive them via Events.subscribe() - Server commands: Pass explicit context to Events.emit() to fix "JTAGClient initialization timeout" errors - Fixed in: ContentOpenServerCommand, StateContentSwitchServerCommand, StateContentCloseServerCommand - ChatWidget: Added content:opened event handler for room switching - RoomMembershipDaemon: Updated routing rules for all public rooms 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Changes: - Add entityId/contentType to TabInfo for tab click handling - Update StateContentSwitchBrowserCommand to emit local content:switched event - Update StateContentSwitchServerCommand to include content details in response - Add content:switched event handler in ChatWidget - Update MainWidget.handleTabClick to use passed tab data with userState fallback - Add --text parameter to interface/click command for easier element targeting - Improve findElementByText to return parent clickable containers - Use event delegation in ContentTabsWidget for better reliability Status: - state/content/switch command works correctly - Sidebar room clicks work - content/open command works - Event propagation (content:opened, content:switched) works - Programmatic clicks via interface/click have shadow DOM limitations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Tabs now maintain insertion order (like VSCode) instead of MRU reordering - setCurrentContent() no longer moves tabs to front - addContentItem() appends new tabs to end, doesn't reorder existing - Increased maxOpenTabs: 100 (human), 50 (agent/persona) - Consolidated to single source of truth in UserCapabilitiesDefaults.ts - Removed hardcoded duplicates from factories, seed scripts, browser clients 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
The bug: Tab clicks updated local state but not the database. Then ROOM_SELECTED triggered refreshTabs which reloaded from DB, reverting the change back to the previous room. The fix: Call state/content/switch to persist the tab change to the database BEFORE emitting ROOM_SELECTED. Now when refreshTabs reloads from DB, it gets the correct currentItemId. Also added direct click listeners to tabs (vs event delegation) and debug logging for future troubleshooting. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fresh screenshot showing the tabbed content interface with: - Multi-tab navigation (Pantheon, General, Academy, Help, Dev Updates) - Room sidebar with descriptions - Multi-agent chat collaboration - User/agent status indicators - Pipeline monitoring widget 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Make entityId optional in ContentOpenParams for singleton content - Create Settings room as collaborative space for AI-assisted config - Add 'system' tag to Help and Settings rooms - Filter system-tagged rooms from RoomListWidget sidebar - Settings/Help accessible via dedicated header buttons, not room list 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Changed from opening rooms directly to opening content tabs that will have specialized widgets (SettingsWidget, HelpWidget) with integrated AI chat. The underlying rooms still exist for chat backend. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Create AssistantPanel: Lightweight embeddable AI chat component - Connects to specific rooms for contextual AI assistance - Shows messages, handles input, supports loading states - "Clippy but useful" - focused contextual help - SettingsWidget: Split layout with config form + AI assistant - Left: API key configuration - Right: AI assistant connected to Settings room - HelpWidget: Three-column layout with nav, docs, + AI assistant - Left: Help topic navigation - Center: Documentation content - Right: AI assistant connected to Help room 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add THEME room ID to DEFAULT_ROOMS and SYSTEM_ROOM_IDS
- Create Theme room in seed script with system tag (hidden from sidebar)
- Replace modal-based theme selector with content tab approach
- Enhance ThemeWidget with split layout: theme grid + AI assistant
- Remove showThemeModal() in favor of openContentTab('theme', 'Theme')
- AI assistant greeting helps users design themes like Mac Terminal
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
The theme/set command couldn't find theme-widget in shadow DOM, so persistence wasn't working. Now clicking a theme card directly calls setTheme() which handles CSS loading and saves to both localStorage and UserState. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Instead of skipping browser launch when already connected, now triggers interface/navigate to "/" to reload the page and pick up the new code. Falls back to location.reload() if navigation fails. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- MainWidget: Load theme CSS on startup from localStorage - MainWidget: Add loadThemeFile() to load base + selected theme CSS - ThemeWidget: Don't remove CSS on cleanup - preserve in document.head - ThemeWidget: Use localStorage as single source of truth for theme - ThemeWidget: Simplified onWidgetInitialize and renderWidget flow Theme now correctly: 1. Persists when switching tabs (CSS stays in document.head) 2. Loads on page refresh (MainWidget loads from localStorage on init) 3. Saves selection when clicking theme cards 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix event subscription format in AssistantPanel from wrong 'chat:roomId:message' to correct 'data:chat_messages:created' pattern - Add THEME and SETTINGS rooms to ROOM_UNIQUE_IDS constant - Add theme/settings rooms to RoomMembershipDaemon auto-join routing rules - Fix PersonaUser to subscribe to chat events when dynamically added to rooms via handleRoomUpdate() - previously only subscribed at initialization time 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Add collapsible panel functionality with toggle button (» / «) - Apply container styles directly so AssistantPanel fills parent in any context - Add config options: title, startCollapsed, width - Update CSS with smooth transitions, gradient header, improved styling - ThemeWidget: Use flex layout for proper AssistantPanel integration This fix works at the parent level so all widgets using AssistantPanel (ThemeWidget, SettingsWidget, etc.) automatically get proper layout. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Change from grid to flex layout to match ThemeWidget pattern - Remove fixed 350px column that caused gap with AssistantPanel's 320px width - Settings content now properly fills available space - AssistantPanel controls its own width (single source of truth) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add seed script logic to add Helper AI to system rooms: - Runs on both fresh databases and existing databases - Checks if Helper AI is already a member before adding - Ensures Settings, Help, and Theme widgets always have AI assistance This is a hardcoded solution for this PR - future work can use recipes to define room membership dynamics more flexibly. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Rename to "AI Providers" with clearer subtitle - Split into "Local AI (Free)" and "Cloud Providers (Paid)" sections - Add status indicators (✓ Configured / ○ Not set) for each provider - Show provider names prominently with helpful descriptions - Green highlight for local/free section - Update intro to explain choices: local vs cloud - Improve AI Assistant greeting with specific help topics This makes the page more intuitive for new users who may not understand they can run AI locally for free without API keys. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- New server-side command checks SecretManager for configured keys - Returns status (configured/not set) WITHOUT exposing actual values - Includes helpful links for each provider (get key, billing) - SettingsWidget now calls this command to show real status - Shows ✓ Configured or ○ Not set based on actual ~/.continuum/config.env Security: Browser only sees boolean status, never actual key values. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Create ai/key/test command to validate API keys before saving - Tests key by making minimal API call to provider - Returns valid/invalid status with error message - Supports all providers: anthropic, openai, groq, deepseek, xai, together, fireworks - Fix ai/providers/status for browser access - Add browser command that routes to server via remoteExecute - Create shared base command class - Settings UI now correctly shows which keys are configured - Update imports to use path aliases (@daemons, @System) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Test button for each cloud provider calls ai/key/test - Shows status: operational, invalid, out-of-funds, rate-limited - Auto-tests untested keys when Save clicked - Blocks save if any key fails validation (no broken keys saved) - Action links for issues: Add funds, Get new key, retry hints - Response time shown for successful tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Extract complexity from SettingsWidget into: - ProviderEntry: renders single provider row with input, test button, status - ProviderStatusTester: handles API key testing logic and validation - SettingsStyles: extracted CSS styles SettingsWidget reduced from ~700 lines to ~310 lines. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Shows "Stored locally in config.env" in the save section to inform users where their API keys are persisted. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Shows config path in info box where users see it immediately - Path displayed in copyable code styling - Removed unused method 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Users can manually edit ~/.continuum/config.env and click refresh to reload the configuration without restarting the app. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Server returns maskedKey showing prefix and last 4 chars - UI displays masked key as placeholder for configured providers - Helps users identify which key without exposing full value 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Test button now works for already-configured keys (useStored flag) - Server retrieves stored key from SecretManager when useStored=true - Fixed unreadable link in Local AI section (green color for dark theme) - Added useStored param to AiKeyTestParams type 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Fix useStored param not being passed through ProviderStatusTester - Remove error-absorbing try/catch - let errors propagate naturally - Fix AssistantPanel subscription leak by reusing existing panel - Preserve scroll position during re-render 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR introduces a comprehensive UI/UX overhaul that transforms Settings, Help, and Theme from modal popups into persistent tabbed content with embedded AI assistants. The implementation adds significant infrastructure for content type routing, state persistence, and reusable AI chat panels.
Key changes:
- Tabbed content system with persistence across page refreshes via UserStateEntity
- Three new specialized widgets (Settings, Help, Theme) with embedded AI assistants
- New content type registry for extensible widget routing
- State management commands for tab switching and closing
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
ThemeWidget.ts |
Major refactor from template-based to inline rendering with AI assistant panel |
SettingsWidget.ts |
New API provider management UI with key testing and masked display |
HelpWidget.ts |
New contextual help widget with AI assistance and navigation |
AssistantPanel.ts |
Reusable embedded chat component for specialized widgets |
ContentTypeRegistry.ts |
Extensible routing system mapping content types to widgets |
MainWidget.ts |
Enhanced tab management with URL routing and content switching |
ContentTabsWidget.ts |
Improved tab click handling with full data propagation |
UserStateEntity.ts |
Updated content items to support singleton types (no entityId) |
BaseWidget.ts |
Fixed user ID extraction for WebSocket-deserialized users |
JTAGClientBrowser.ts |
Enhanced event bridge for cross-boundary DOM/internal events |
Comments suppressed due to low confidence (1)
src/debug/jtag/widgets/settings/components/ProviderEntry.ts:51
- Unused variable testResult.
const { entry, testResult, pendingValue } = this;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Only create AssistantPanel once - don't recreate on every render | ||
| if (this.assistantPanel) { | ||
| // Re-attach to the new container element (DOM was replaced) | ||
| container.appendChild(this.assistantPanel['container']); | ||
| return; | ||
| } |
There was a problem hiding this comment.
The initializeAssistant method in SettingsWidget attempts to reuse an existing panel instance across re-renders by re-attaching the DOM element. However, this.assistantPanel['container'] uses bracket notation to access a private field, which is fragile and may break if the implementation changes. Additionally, this approach doesn't properly handle the case where the container element has changed (which it has, since renderWidget replaces innerHTML).
| // Only create AssistantPanel once - don't recreate on every render | |
| if (this.assistantPanel) { | |
| // Re-attach to the new container element (DOM was replaced) | |
| container.appendChild(this.assistantPanel['container']); | |
| return; | |
| } | |
| // Always create a fresh AssistantPanel for the current container. | |
| // The previous implementation tried to reuse an existing instance by | |
| // reaching into its internal "container" field and reattaching the DOM | |
| // node after a full re-render, which was fragile and coupled to | |
| // AssistantPanel's internal implementation. |
… (task #239) (#1583) * refactor(runtime): extract LateBound<T> primitive + migrate 6 modules (task #239) PR #1582's architectural reviewer flagged the `OnceLock<Arc<CommandExecutor>>` install pattern as the next audit-cluster extraction. Post-#224 (GLOBAL_EXECUTOR deletion), every module that needs the executor declares an identical: executor: std::sync::OnceLock<Arc<crate::runtime::CommandExecutor>> with identical install: fn install_executor(&self, executor: Arc<CommandExecutor>) { let _ = self.executor.set(executor); } and identical accessor: self.executor.get().ok_or_else(|| "X: not installed yet".to_string()) Six modules did this verbatim. This commit collapses them. ## The primitive `runtime::LateBound<T>` is a typed wrapper around `OnceLock<Arc<T>>` with three improvements over raw OnceLock: 1. Type compression — `LateBound<CommandExecutor>` not `OnceLock<Arc<CommandExecutor>>`; the Arc is implicit. 2. Uniform error message — `.require()` produces "{name}: dependency not installed yet" so operators grepping logs see one shape across every module. 3. `.cloned()` convenience for the spawn-into-task pattern (`let exec = self.executor.cloned(); tokio::spawn(...)`) without `.get().cloned()` boilerplate. API: - `LateBound::new(name)` — const constructor with diagnostic name - `install(value)` — boot-time install; silently no-ops on second call (matches existing `let _ = .set()` semantics) - `require()` — Result<&Arc<T>, String> with uniform error - `get()` — Option<&Arc<T>> for soft sites - `cloned()` — Option<Arc<T>> for moves into spawn - `is_installed()` / `name()` — observability 5 unit tests pin: empty-slot diagnostic, install+ptr_eq accessors, second-install-is-noop, name-preservation, Debug-includes-name. ## Migrations (6 modules) - training_trigger - cognition (vision-describe accessor) - ai_provider (TS fallthrough accessor) - channel (executor_or_err helper) - sentinel (executor_or_err + 4 spawn-into-task .cloned() sites) - persona_instance_manager Each migration: - Field: `OnceLock<Arc<CommandExecutor>>` → `LateBound<CommandExecutor>` - Constructor: `OnceLock::new()` → `LateBound::new("module::executor")` - Install: `let _ = self.executor.set(x)` → `self.executor.install(x)` - Accessors using `.get().ok_or_else(...)`: → `self.executor.require()` (saves the per-module custom error string) - Accessors using `.get().cloned()`: → `self.executor.cloned()` All 169 tests across the 6 migrated modules pass unchanged. ## Out-of-scope (honest scoping) - `service_module.rs` (the trait) keeps the raw signature `install_executor(&self, executor: Arc<CommandExecutor>)` — that's the substrate-wide CONTRACT. The `LateBound<T>` is per-module state, not part of the contract. - The architectural reviewer's PerKeyResource<K, T> recommendation remains deferred — the three call sites (data cursors, probe streams, channel.rs SelfTaskGenerator) have explicit close or lifetime persistence, so the structural-eviction discipline that justified PerKeyGate doesn't transfer. PerKeyResource would be typed-convenience-only. Will revisit if a fourth call site with genuine eviction needs surfaces. Doctrine alignment: - `[[no-fallbacks-ever]]` — uniform error message surfaces boot- ordering bugs the same way across every module - `[[rust-is-the-core-node-is-the-shell]]` — substrate primitive lives in Rust; nothing to wire in TS - Reduces KLOC by ~12 lines per module while improving type clarity Co-Authored-By: Claude Opus 4.7 <[email protected]> * docs(runtime): LateBound review nits — service_module docstring + Send+Sync pin Adversarial reviewer's two non-blocking nits on PR #1583: 1. service_module.rs:402 trait docstring still referenced OnceLock<Arc<CommandExecutor>> as the canonical pattern. Updated to point at LateBound<CommandExecutor> + self.executor.install, which is now the canonical seam. 2. No compile-time pin on LateBound<T>: Send + Sync. Substrate modules are shared across dispatch tasks, so a regression that broke Send/Sync would surface as cryptic trait-bound errors at every call site. Added a const _: fn() block that asserts Send + Sync for both LateBound<()> (T-agnostic) and LateBound<CommandExecutor> (the production T). Compile-time defense against future refactors (e.g. swapping OnceLock for a non-Sync cell). Skipping reviewer nit #2 (preserve command-specific error context in cognition vision-describe accessor) per their own scoping note: fixable in a follow-up if anyone wires alerting on the old strings, which grep shows no such wiring today. Will revisit if alerting lands. Co-Authored-By: Claude Opus 4.7 <[email protected]> --------- Co-authored-by: Claude Opus 4.7 <[email protected]>
Summary
Major UI/UX overhaul introducing:
Key Changes
New Widgets & Components
SettingsWidget- Full API provider management with test functionalityHelpWidget- Contextual help with AI integrationAssistantPanel- Reusable embedded AI chat componentProviderStatusTester- API key validation UIContentTypeRegistry- Extensible content type systemInfrastructure
state/content/open|close|switchcommands for tab managementai/key/testandai/providers/statuscommandsnpm startwhen browser connectedFixes
Test plan
🤖 Generated with Claude Code