Skip to content

Commit 7add4c7

Browse files
joelteplyclaude
andauthored
Unified Positronic Content Architecture - Cache-first State Management (#255)
* Add Vite + Signals foundation for incremental widget migration Sets up Vite alongside existing esbuild for gradual migration: New files: - vite.config.ts - Vite configuration with path aliases - src/vite-entry.ts - Reactive primitives (signal, effect, computed) - index.html - Demo showcasing old vs new patterns New npm scripts: - npm run dev:vite - Vite dev server on port 9100 - npm run build:vite - Vite production build Reactive patterns demonstrated: - signal() - Observable values - effect() - Auto-run on signal changes - createWidgetStore() - Centralized widget state - bindText/bindClass() - Reactive DOM bindings This enables incremental widget migration: 1. Old widgets keep working with esbuild 2. New/migrated widgets use Vite patterns 3. Both run together during transition 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix executable permissions on all shell scripts Git was storing .sh files as 100644 (non-executable) instead of 100755. This caused `chmod +x` to be needed after every merge/checkout. Fixed 30+ shell scripts in: - scripts/ - workers/ - backups/ - commands/ - system/genome/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * converted room list to use vite signals * configs * Convert widget CSS to SCSS for Positron migration Migrate 12 widget stylesheets from plain CSS to SCSS: - buttons, status-view (simple widgets) - room-list, user-list (sidebar widgets) - continuum-widget, main-panel, sidebar-panel (layout) - continuum-emoter, continuum-metrics, cognition-histogram (status) - theme-widget (controls) Benefits: - Use shared variables from widgets/shared/styles/variables - Nested selectors for cleaner organization - Generate both .css and .styles.ts via compile-sass.ts - Foundation for reactive Positron widget system Note: chat-widget.css kept as plain CSS (SCSS conversion caused layout issues - will revisit with more careful conversion) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Enable bundle minification for faster load times Performance improvements: - Enable Vite minification (2.8MB → 2.6MB, 657KB gzipped) - Update HTML template to use ES module loading - Add waitForJtag() for module load synchronization - Export jtag to globalThis at module load time Code splitting was attempted but caused circular dependency issues (Cannot access 'Xe' before initialization). Keeping single bundle with minification as the safe optimization for now. Note: Future optimization could split widgets/commands into lazy chunks once circular deps are resolved. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix tab performance issue * signal based widgets * significant widget speed improvements * significant log improvement * Remove TypeScript fallback from vector search - Rust only Vector search now fails fast if Rust worker unavailable instead of falling back to slow TypeScript implementation. Performance improvement: - Before (TypeScript fallback): 12-25 seconds for 46K vectors - After (Rust only): 785ms for 46K vectors (~15-30x faster) Changes: - Remove try/catch fallback in vectorSearch() method - Remove TypeScript cosine similarity computation - Remove fetch-all-vectors + fetch-each-record pattern - Remove unused SimilarityMetrics import - Add clear error message when Rust worker unavailable The getAllVectors() method remains for backfillVectors() which needs to iterate all records for embedding generation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Bundle CLI for 4x faster startup (0.6s vs 2.6s CPU time) - Add esbuild CLI bundler (6.6MB bundle with minification) - Lazy-load proto in InferenceGrpcClient to enable bundling - Update ./jtag script to use bundle when available - Add build:cli npm script and include in postbuild - Fix CommandGenerator to not run CLI code when bundled The bundle reduces CLI startup from ~2.6s to ~0.6s CPU time. Network latency to server dominates total wall-clock time. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Eliminate redundant command discovery on CLI connect The connect() method was calling list() after initialize() had already discovered commands via discoverCommands(). This caused two round-trips to the server for command listing. Now connect() builds the listResult from the already-populated discoveredCommands map, eliminating the redundant network call. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * less logging * cleanup of warnings, bad types * reduced logging * much reduced logging * lots of warnings * faster * substantially faster * fixes for speed * shared entity stuff * room list widget seems ok * fix infinite loop issue * user list works * sql count issues * cleaning up event emission bs * fixing memory issues * Fix chat memory leaks + restore avatar animation Memory leak fix (event delegation): - Add MessageEventDelegator for single-listener pattern on chat container - Remove per-element addEventListener in ImageMessageAdapter, URLCardAdapter - Add static handler methods called via data-action attributes - Wire delegation into ChatWidget with proper cleanup in disconnectedCallback Avatar animation fix: - UserListWidget migration to ReactiveListWidget broke live AI status updates - EntityScroller caches rendered elements, so reactive state changes alone don't update existing items - Fix: updateAIStatus() now does direct DOM manipulation alongside reactive state updates for cached elements 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * dynamic widget sidebar ok * fix all widgets * scroller updates * remove synchronous write * more async stuff * Move AsyncStorage.ts from widgets/ to system/ - fix layering violation system/core/browser/LocalStorageStateManager.ts was importing from widgets/shared/AsyncStorage.ts which violates the module hierarchy (system/ should not import from widgets/). This layering violation could cause circular dependencies during module resolution at initialization time. Changes: - Move AsyncStorage.ts to system/core/browser/ - Update LocalStorageStateManager.ts import to use local path - Update ChatMessageCache.ts import to use system path 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * lora docs * fix tab naming * tab naming * Migrate all localStorage to non-blocking asyncStorage Performance optimization to eliminate main thread blocking: - LocalStorageDataBackend: All CRUD operations now use asyncStorage - SyncQueue: Queue persistence now non-blocking - LocalStorageStateBackend: UserState persistence now async - SiteState: Theme persistence now async - WebViewWidget: URL persistence now async - NavigateBrowserCommand: Pending URL storage now async - ConsoleDaemonBrowser: Batched log writes with requestIdleCallback - OfflineStorageAdapter: user_states sync uses IndexedDB - PositronContentStateAdapter: Event handlers wrapped in requestIdleCallback - MainWidget: Callbacks wrapped in offMainThread helper - ContentStateService: Added smart change detection to prevent unnecessary updates New IndexedDBBackend for truly async storage (user_states collection). Fixes 10-second UI hangs during tab switches caused by synchronous localStorage writes blocking the main thread. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Convert SettingsWidget from BaseWidget to ReactiveWidget - SettingsWidget now extends ReactiveWidget with Lit templates - Created ProvidersSection component with SCSS styling - Uses proper typed executeCommand<Params, Result>() pattern - Added @reactive() decorated state properties - Workaround: requestUpdate() needed after state changes (TC39 decorator timing issue - outer containers need conversion) - Integrated ProvidersSection with Lit property binding Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Conversion of outer containers to reactive elements plan * Convert RightPanelWidget and PersonaBrainWidget to ReactiveWidget - RightPanelWidget: Now extends ReactiveWidget directly with Lit templates instead of BaseSidePanelWidget (which used innerHTML) - PersonaBrainWidget: Full conversion from BasePanelWidget to ReactiveWidget - Uses @reactive() properties for state management - renderContent() returns TemplateResult instead of Promise<string> - Uses unsafeHTML() for complex SVG brain visualization - Added updated() lifecycle for dynamic event listeners - Fixed entityId/UUID normalization (handles both formats) This reduces lag when transitioning to persona views by using Lit's efficient DOM diffing instead of full innerHTML recreation. Note: Phase 1.x technical debt documented - entityId format normalization should be done in MainWidget, not in every content widget. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add PersonaBrainWidget caching + Convert ContentTabsWidget to ReactiveWidget PersonaBrainWidget: - Only reload data when entityId actually changes - When switching back to same persona, preserve cached state for instant display - Handles both UUID and uniqueId formats in same-entity check ContentTabsWidget: - Converted from BaseWidget to ReactiveWidget - Uses Lit templates instead of innerHTML - Uses @click handlers instead of manual event listener setup - Cleaner React-style state subscription pattern Reducing innerHTML usage from 30+ to ~27 files. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Convert 5 more widgets to ReactiveWidget pattern Eliminated innerHTML usage in: - ContinuumMetricsWidget: Inlined styles, Lit templates - HeaderControlsWidget: Lit templates with right-alignment fix - PositronCursorWidget: Reactive state for cursor position/visibility - SettingsAssistantWidget: Event subscriptions via createMountEffect - PanelLayoutWidget: Simple container with slot support All widgets now use: - @reactive() decorators for state - renderContent() returning TemplateResult - Static styles with unsafeCSS() - createMountEffect() for subscriptions Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Convert CognitionHistogram + Enhance Metrics with 2x2 grid CognitionHistogramWidget: - Convert from BaseWidget to ReactiveWidget - Inline external HTML/CSS templates - Use createMountEffect for event subscriptions - Lit templates with @click handlers ContinuumMetricsWidget: - Replace single metric view with 2x2 grid showing all 4 metrics - Color-coded sparklines: Requests (cyan), Tokens (red), Latency (gold), Cost (green) - Each card shows title, value, and mini chart - More real estate for better data visibility at a glance Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix ContinuumMetricsWidget sparkline rendering and add smart time range - Fix SVG polyline rendering by using inline points attribute instead of returning TemplateResult from helper function (Lit template quirk) - Add auto-detection of optimal time range based on data distribution: picks smallest range containing ≥70% of activity - Clean up CSS: remove fixed heights, let content flow naturally - Remove cognition-histogram-widget from layout (merged into metrics) - Simplify code from 395 to 260 lines Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove orphaned cognition-histogram widget and unused templates - Delete entire cognition-histogram widget (merged into continuum-metrics) - Remove unused continuum-metrics.html template (ReactiveWidget uses renderContent) - Prevents future confusion from orphaned code Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix performance and sidebar layout issues - Remove LocalStorageDataBackend logging that caused 42k+ console messages - Optimize ThemeWidget CSS loading with parallel Promise.all requests - Fix sidebar gap by conditionally rendering empty dynamic slot - Remove user-list-widget height constraints (max-height: 600px) - Add flex to last persistent slot to fill available space Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Give rooms less flex priority than users & agents Dynamic slot (rooms) gets flex: 0.3, persistent slot (users) keeps flex: 1. Users & agents now fills most of the sidebar, rooms stays compact. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add reactive scroll-to-selected for room list Uses Lit's updated() lifecycle to scroll active room into view when @reactive() currentRoomId changes. Smooth animation with scrollIntoView({ block: 'nearest', behavior: 'smooth' }). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add shouldAddEntity filtering to ReactiveListWidget base class - Base class now applies shouldAddEntity filter in getLoadFunction - RoomListWidget filters out system rooms and DMs via shouldAddEntity override - Improved scroll-to-selected with double rAF and container bounds check - Common pattern now available to all list widgets Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Replace user list search with filter chips - Remove text search box (wasn't working reliably) - Add clickable filter chips: All | Human | Persona | Agent | Online - Chips are toggleable - can combine type + online filters - Compact icon-only design with hover/active states - Cyan glow for active chips, green for online filter Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Improve filter chip organization and hover labels - Group type filters (All|Human|Persona|Agent) separate from status (Online) - Add vertical divider between filter groups - Labels hidden by default, expand on hover with smooth animation - Active chips always show their label - Smaller, more compact chip design Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix filter chip active state and label visibility - Add requestUpdate() to ensure header re-renders on filter change - Increase active chip label opacity to 1 (was 0.8) - Active chips now have stronger glow and always show labels - Clicking type filter properly removes ALL and shows selected type label Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix filter chips to actually filter the user list Use scroller.clear() + scroller.load() instead of refresh() to ensure items are re-rendered with updated filter state. The getRenderFunction checks matchesFilters() for each item on load. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add widget technical debt documentation and PR description - WIDGET-TECHNICAL-DEBT.md: Full audit of innerHTML (20), timeouts (26), BaseWidget (9) - PR-DESCRIPTION-WIDGET-OVERHAUL.md: Ready for PR creation - Priority order for fixes documented - Testing checklist included Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Refactor ChatWidget to use DOM APIs instead of innerHTML - Add MemberChipData interface for type-safe member chip rendering - Replace header innerHTML with targeted DOM updates (updateHeaderElements) - Replace message innerHTML with DOM structure building - Add buildMemberChipData, createMemberChip, updateMemberChip methods - Only adapter content uses innerHTML (adapters return HTML strings) - Update technical debt docs to reflect ChatWidget progress Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * soething fixed * Fix BaseWidget to render instantly with loading state (React pattern) - Change connectedCallback from blocking async to non-blocking sync - Render "Loading..." state immediately on mount - Fire async initialization in background without blocking UI - All BaseWidget subclasses now show instant feedback This fixes 10-30 second UI freezes when switching tabs. The React pattern: 1. Render shell immediately (loading state) 2. Async work runs in background 3. UI updates when data arrives Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add optimistic updates for opening new content tabs - UserListWidget: Open profile tab immediately, persist in background - Tab shows "Loading..." instantly via BaseWidget non-blocking pattern - Server content/open command runs in background (fire-and-forget) This completes the React pattern for tab opening: 1. Local state update → tab appears instantly 2. Widget renders loading state → user sees feedback 3. Server persistence → eventually consistent Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add optimistic tab creation for room selection RoomListWidget was missing contentState update - tab had to wait for server event. Now creates tab immediately via contentState.addItem(). Flow: 1. contentState.addItem() → tab appears instantly 2. pageState.setContent() → ChatWidget loads room 3. Commands.execute() → server persists (background) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Revert sidebar optimistic tab creation - was breaking content sync Sidebar widgets (RoomListWidget, UserListWidget) should not manage contentState directly - that creates race conditions with the server event system. Kept: - BaseWidget non-blocking render (Loading... immediately) - MainWidget tab switching (existing tabs flip instantly) Reverted: - RoomListWidget optimistic contentState updates - UserListWidget optimistic contentState updates Sidebar clicks now go through server properly: 1. Command fires (fire-and-forget) 2. Server creates content item 3. Server emits content:opened 4. PositronContentStateAdapter updates local state + triggers view switch Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix RoomListWidget selection not updating on tab switch The entityId from pageState could be UUID or uniqueId format, but currentRoomId comparison in renderItem uses room.id (UUID). Fix: Look up matching room by both UUID and uniqueId to find the correct room.id for highlighting. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix URL not updating on tab switch - use uniqueId for URLs The handleTabClick method was using entityId (UUID) for building URLs instead of uniqueId (human-readable like "general", "dev-updates"). Changed to look up contentItem.uniqueId and use it for URL paths, falling back to entityId if uniqueId is not available. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix URL not updating on tab click - add URL updates to ContentTabsWidget The actual tab clicks go through ContentTabsWidget.handleTabClick, not MainWidget.handleTabClick. Added URL updates to ContentTabsWidget: - Added uniqueId to TabInfo interface - Pass uniqueId when building tabs from contentState - Update URL in handleTabClick using uniqueId for human-readable paths - Update URL in handleTabClose when switching to new current tab Note: URL updates are now scattered across widgets - needs centralized UrlStateService in future refactor. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Centralize content/tab/URL logic and fix event message persistence 1. ContentService: New centralized service for all content operations - open(): handles tab creation, view switch, URL update, persist - switchTo(): handles tab switch, view, URL, persist - close(): handles tab close, switch to next, URL, persist - Single source of truth instead of scattered widget logic 2. EntityScroller: Fix event-added entities being wiped on refresh - Track entities added via real-time events in eventAddedIds Set - diffAndUpdateDOM now preserves event-added entities - Only removes entities from previous DB loads, not live events - Fixes messages disappearing when switching tabs 3. Widget updates: - ContentTabsWidget: uses ContentService.switchTo/close - RoomListWidget: uses ContentService.open Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add EntityCacheService as single source of truth for entity data Phase 1-3 of Unified Positronic Architecture: - Create EntityCacheService with per-collection stores - eventAddedIds tracking (entities from events survive DB refresh) - Subscribe/notify pattern with microtask batching - Auto-subscribe to entity events when widgets subscribe - Integrate ChatWidget to populate cache when loading messages This lays the foundation for: - 60fps responsive UI (instant cache reads vs DB queries) - No message flickering on tab switch - Consistent state across all widgets Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add recipe awareness and cache-first routing (Phases 4-5) ContentService (Phase 4): - Look up recipe ID for content type on open() - Store recipeId in content item metadata - Pre-populate EntityCacheService for content type's collection - Map content types to entity collections RoutingService (Phase 5): - Check EntityCacheService before DB queries (cache-first) - Populate EntityCacheService on DB resolution - Resolution order: local cache → EntityCache → DB - Instant resolution when entities already cached This completes the Unified Positronic Content Architecture: - EntityCacheService as single source of truth - 60fps-capable instant cache reads - Recipe-aware content management - Unified caching across all entity resolution Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix instant tab creation and prevent tab flickering - UserListWidget: Use ContentService.open() for instant profile tabs - DiagnosticsWidget: Use ContentService.open() for instant log tabs - UserProfileWidget: Use ContentService.open() for cognition/navigation - PersonaBrainWidget: Use ContentService.open() for log viewer tabs - PositronContentStateAdapter: Fix temp ID → real ID update race condition that caused tabs to disappear for 5 seconds then reappear The root cause was handleContentOpened() setting currentItemId to server's real ID before updating the existing item's temp ID, causing currentItem lookup to fail temporarily. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add circuit breaker and instant hydration for responsive UI Circuit Breaker (CandleGrpcAdapter): - Track consecutive timeouts and fail fast after 2 failures - 60-second cooldown before retrying local inference - Prevents cascading failures when Candle is overloaded - Health check returns unhealthy when circuit is open Instant Hydration Pattern: - Widgets implement onActivate(entityId, metadata) for instant rendering - Pass full entity in ContentService.open() metadata - Clear/populate/query pattern: clear old state, populate with passed data, query only what's missing - Same entity = refresh deltas, different entity = full clear Tab Flickering Fix: - PositronContentStateAdapter checks ContentStateService singleton first - Updates temp ID to real ID before setting currentItemId - Prevents tabs from disappearing during ID synchronization Room Selection Fix: - RoomListWidget guard checks pageState instead of roomId - Prevents "click does nothing" when roomId matches default Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix stale chat when switching back to same room When returning to a previously viewed room, the ChatWidget was skipping the refresh entirely because roomId === currentRoomId. This caused stale message history since new messages weren't loaded. Fix: Call scroller.refresh() when switching to the same room instead of just returning early. This loads any new messages that arrived while viewing other content. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add useCollection/useEntity data hooks to ReactiveWidget Unified data interface for all widgets using EntityCacheService: - useCollection<T>(): Subscribe to entity collections with filtering, sorting, limit - Automatically subscribes to cache for real-time updates - Loads from DB if cache is empty - Returns handle with refresh(), setFilter(), count() - Auto-cleanup on widget disconnect - useEntity<T>(): Subscribe to single entity by ID - Real-time updates when entity changes - Auto-cleanup on disconnect This eliminates per-widget caching code and provides a consistent React-like data layer across all widgets. Example usage: this.useCollection<ChatMessageEntity>({ collection: 'chat_messages', filter: m => m.roomId === this.roomId, onData: (messages) => this.renderMessages(messages) }); Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Fix widget-loading centering by adding :host styles The loading state wasn't centered because the shadow root host element lacked width/height. Added :host styles to ensure the container fills its parent. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Add humanMessage priority scoring to ai/should-respond-fast - Add 25-point humanMessage bonus to scoring weights - Add senderType param to detect human vs AI senders - Add isHumanSender() lookup when senderType not provided - Update browser/server commands with new scoreBreakdown fields Ensures AIs prioritize responding to human messages over AI-to-AI chatter. Human question now scores 40 (25 human + 10 question + 5 unanswered) vs 15 before. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Update generated schema with senderType parameter Regenerated after humanMessage priority scoring addition. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Remove dead code ChatMessageCache.ts EntityCacheService is now the single source of truth for entity data. ChatMessageCache was implemented but never imported or used. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * Address Copilot review feedback - Add verbose logging to catch block in ContinuumEmoterWidget - Use CSS.escape() for personaId in UserListWidget selectors - Add comment documenting MongoDB-style $in operator in ChatWidget - Scope .closest() selector in MessageEventDelegator to message-row - Replace polling with dynamic import in universal-demo.html Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Joel <undefined> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5aaefec commit 7add4c7

File tree

329 files changed

+21043
-13295
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

329 files changed

+21043
-13295
lines changed

src/debug/jtag/.continuum/genome/python/bootstrap.sh

100644100755
File mode changed.

src/debug/jtag/.continuum/genome/python/train-wrapper.sh

100644100755
File mode changed.

src/debug/jtag/backups/backup-legacy-continuum.sh

100644100755
File mode changed.

src/debug/jtag/backups/cleanup-legacy-continuum.sh

100644100755
File mode changed.

src/debug/jtag/backups/migrate-persona-logs.sh

100644100755
File mode changed.

src/debug/jtag/browser-index.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,49 +26,37 @@ import { WidgetDiscovery } from './system/core/browser/utils/WidgetIntrospection
2626
export const jtag = {
2727
// Widget debugging utilities
2828
widgets: WidgetUtils,
29-
29+
3030
// Universal client interface - always returns connection result with client property
3131
async connect(): Promise<ReturnType<typeof JTAGClientBrowser.connectLocal>> {
32-
// Reduce log spam
33-
// console.debug('🔌 Browser: Connecting via JTAGClientBrowser (local connection)');
34-
35-
// Connect client FIRST
32+
// Connect client FIRST - widgets need it for resource loading
3633
const connectionResult = await JTAGClientBrowser.connectLocal();
3734
const client = connectionResult.client;
3835

3936
// Set up global window.jtag for widgets and tests
4037
(globalThis as any).jtag = client;
4138

42-
// Expose WidgetDiscovery for universal selector support (used by GlobalUtils.safeQuerySelector)
39+
// Expose WidgetDiscovery for universal selector support
4340
(globalThis as any).WidgetDiscovery = WidgetDiscovery;
4441

4542
// Register client in static registry for sharedInstance access
4643
JTAGClient.registerClient('default', client);
4744

48-
// NOW register widgets - after client is available for sharedInstance
49-
// console.debug(`🎭 Registering ${BROWSER_WIDGETS.length} widgets...`);
45+
// NOW register widgets - after client is available for resource loading
5046
BROWSER_WIDGETS.forEach(widget => {
5147
if (!customElements.get(widget.tagName)) {
5248
try {
5349
customElements.define(widget.tagName, widget.widgetClass);
54-
// console.debug(`✅ Registered widget: ${widget.tagName} (${widget.className})`);
5550
} catch (error) {
5651
console.warn(`⚠️ Failed to register widget ${widget.tagName}: ${error}`);
57-
console.warn(`⚠️ This usually means the constructor has already been used with this registry`);
58-
console.warn(`⚠️ Skipping registration for ${widget.tagName}`);
5952
}
60-
} else {
61-
console.warn(`⚠️ Widget ${widget.tagName} already registered, skipping`);
6253
}
6354
});
6455

65-
// Enhance client with organized services - no globals needed
56+
// Enhance client with organized services
6657
const services = createJTAGClientServices(client);
6758
Object.assign(client, services);
6859

69-
70-
71-
7260
return { ...connectionResult, client };
7361
},
7462

@@ -81,4 +69,8 @@ export const jtag = {
8169
// Direct export for advanced usage
8270
export { JTAGSystemBrowser };
8371
export * from './system/core/types/JTAGTypes';
84-
export * from './commands/interface/screenshot/shared/browser-utils/BrowserElementUtils';
72+
export * from './commands/interface/screenshot/shared/browser-utils/BrowserElementUtils';
73+
74+
// Set jtag on globalThis immediately for non-module scripts
75+
// This allows inline scripts to call jtag.connect() without waiting for imports
76+
(globalThis as any).jtag = jtag;

src/debug/jtag/browser/generated.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Browser Structure Registry - Auto-generated
33
*
4-
* Contains 11 daemons and 139 commands and 2 adapters and 26 widgets.
4+
* Contains 11 daemons and 139 commands and 2 adapters and 25 widgets.
55
* Generated by scripts/generate-structure.ts - DO NOT EDIT MANUALLY
66
*/
77

@@ -167,7 +167,6 @@ import { WebSocketTransportClientBrowser } from './../system/transports/websocke
167167
import { ChatWidget } from './../widgets/chat/chat-widget/ChatWidget';
168168
import { RoomListWidget } from './../widgets/chat/room-list/RoomListWidget';
169169
import { UserListWidget } from './../widgets/chat/user-list/UserListWidget';
170-
import { CognitionHistogramWidget } from './../widgets/cognition-histogram/CognitionHistogramWidget';
171170
import { ContentTabsWidget } from './../widgets/content-tabs/ContentTabsWidget';
172171
import { ContinuumEmoterWidget } from './../widgets/continuum-emoter/ContinuumEmoterWidget';
173172
import { ContinuumMetricsWidget } from './../widgets/continuum-metrics/ContinuumMetricsWidget';
@@ -994,12 +993,6 @@ export const BROWSER_WIDGETS: WidgetEntry[] = [
994993
widgetClass: UserListWidget,
995994
tagName: 'UserList'.replace(/([A-Z])/g, (match, p1, offset) => offset > 0 ? '-' + p1.toLowerCase() : p1.toLowerCase()) + '-widget'
996995
},
997-
{
998-
name: 'CognitionHistogram',
999-
className: 'CognitionHistogramWidget',
1000-
widgetClass: CognitionHistogramWidget,
1001-
tagName: 'CognitionHistogram'.replace(/([A-Z])/g, (match, p1, offset) => offset > 0 ? '-' + p1.toLowerCase() : p1.toLowerCase()) + '-widget'
1002-
},
1003996
{
1004997
name: 'ContentTabs',
1005998
className: 'ContentTabsWidget',

src/debug/jtag/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import * as path from 'path';
2121

2222
// Check for verbose flag EARLY to control module initialization logging
2323
if (process.argv.includes('--verbose')) {
24-
process.env.JTAG_VERBOSE = 'true';
24+
process.env.JTAG_VERBOSE = '1';
2525
}
2626

2727
// CRITICAL: Initialize SecretManager to load config.env into process.env SYNCHRONOUSLY
@@ -269,7 +269,7 @@ async function main() {
269269

270270
// Set environment variable for modules to check verbose mode
271271
if (behavior.logLevel === 'verbose') {
272-
process.env.JTAG_VERBOSE = 'true';
272+
process.env.JTAG_VERBOSE = '1';
273273
}
274274

275275
// Suppress ALL output unless verbose mode

src/debug/jtag/commands/ai/adapter/test/server/AdapterTestServerCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class AdapterTestServerCommand extends CommandBase<AdapterTestParams, Asy
7474
};
7575

7676
// Save to database using data/create command
77-
const createResult = await Commands.execute<DataCreateParams<TestExecutionEntity>, DataCreateResult>(DATA_COMMANDS.CREATE, {
77+
const createResult = await Commands.execute<DataCreateParams, DataCreateResult>(DATA_COMMANDS.CREATE, {
7878
collection: TestExecutionEntity.collection,
7979
data: execution,
8080
id: testId,
@@ -160,7 +160,7 @@ export class AdapterTestServerCommand extends CommandBase<AdapterTestParams, Asy
160160
* Helper to update test status in database
161161
*/
162162
private async updateTestStatus(testId: string, updates: Partial<TestExecutionEntity>): Promise<void> {
163-
await Commands.execute<DataUpdateParams<TestExecutionEntity>, CommandResult>(DATA_COMMANDS.UPDATE, {
163+
await Commands.execute<DataUpdateParams, CommandResult>(DATA_COMMANDS.UPDATE, {
164164
collection: TestExecutionEntity.collection,
165165
id: testId,
166166
data: {

src/debug/jtag/commands/ai/cost/server/AICostServerCommand.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class AICostServerCommand extends AICostCommand {
4141
}
4242

4343
// Query AIGenerationEntity from database using data/list - let SQL do the filtering
44-
const listParams = createDataListParams<AIGenerationEntity>(
44+
const listParams = createDataListParams(
4545
params.context,
4646
params.sessionId,
4747
{
@@ -52,7 +52,7 @@ export class AICostServerCommand extends AICostCommand {
5252
}
5353
);
5454

55-
const listResult = await Commands.execute<DataListParams<AIGenerationEntity>, DataListResult<AIGenerationEntity>>(
55+
const listResult = await Commands.execute<DataListParams, DataListResult<AIGenerationEntity>>(
5656
DATA_COMMANDS.LIST,
5757
listParams
5858
);

0 commit comments

Comments
 (0)