Commit 5a438bb
Feature/client daemon refactoring (#256)
* fix significant widget and daemon bottlenecks
* persona fixes
* Add concurrent inference worker pool (4 parallel model instances)
- Create worker_pool.rs with multi-instance model loading
- Each worker has own QuantizedModelState + Metal GPU device
- Request channel distributes work via tokio mpsc
- Semaphore tracks available workers for backpressure
- Auto-detect worker count based on system memory (~2GB per worker)
- Update InferenceCoordinator: maxConcurrent 1→3, reduced cooldowns
- Fallback to single BF16 instance when LoRA adapters requested
Before: 1 request/~6s + 30s timeout cascade
After: 4 requests/~6s in parallel, no timeouts
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add DaemonOrchestrator for wave-based parallel startup
- Daemons start in dependency order: critical → integration → lightweight
- Critical path (data, command, events, session): 350ms max
- Integration daemons wait for DataDaemon before starting
- Lightweight daemons (health, widget, logger) start immediately
- Phase breakdown metrics logged for observability
Phases:
- critical: 4 daemons, max=207ms (UI can render)
- integration: 7 daemons, max=3518ms (AIProvider bottleneck)
- lightweight: 7 daemons, max=130ms
Total startup: 3531ms (critical path ready much sooner)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix browser launch logic and startup reliability
- Fix SystemOrchestrator navigate command (remove invalid --path param)
- Fix launch-and-capture.ts: check ping, refresh if connected, open if not
- Fix SystemMetricsCollector countCommands to use ping instead of browser logs
- Add deterministic UUIDs for seeded users (Joel, Claude Code)
- Improve UserDaemonServer error logging for persona client creation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix browser launch and UUID generation
Browser launch:
- ALWAYS open browser window, don't just reload
- Ensures user sees something even if WebSocket connected but window closed
- Both SystemOrchestrator and launch-and-capture now open browser unconditionally
UUID fix:
- stringToUUID now generates valid 36-char UUIDs (was generating 32-char)
- Last segment now correctly 12 chars instead of 8
ChatWidget:
- Use server backend for $in queries (localStorage doesn't support $in)
- Add debug logging for member loading
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add backend:server support for browser data commands
- DataReadBrowserCommand now supports backend:'server' to bypass localStorage
- ChatWidget uses server backend for room queries to avoid stale cache
- Fixes issues with members not loading due to localStorage not supporting $in
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Consolidate identifier resolution + encode compression ethos
CONSOLIDATION (Ministry of Code Deletion):
- RoutingService is now THE single source of truth for room/user resolution
- Added resolveRoomIdentifier() and resolveUserIdentifier() convenience functions
- Added name fallback query for legacy support
- Migrated ChatSendServerCommand: deleted findRoom(), uses RoutingService
- Migrated ChatAnalyzeServerCommand: deleted resolveRoom(), uses RoutingService
- Migrated ChatPollServerCommand: deleted inline resolution, uses RoutingService
- WallTypes.isRoomUUID() now delegates to RoutingService.isUUID()
- MainWidget: deleted dead handleTabClick/handleTabClose, simplified openContentTab
ETHOS (CLAUDE.md):
- Added "The Compression Principle" - one logical decision, one place
- Added "The Methodical Process" - 8 mandatory steps, outlier validation
- Encoded the Ministry philosophy: deletion without loss = compression = efficiency
Net change: +306/-298 lines (compression-neutral while adding documentation)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix UUID corruption and contentState persistence issues
Key fixes:
- data-clear.ts: Clear session metadata during reseed to prevent stale
entityIds from persisting (root cause of corrupted UUID bug)
- MainWidget.ts: Add userId setup with retry in openContentFromUrl() and
initializeContentTabs() to ensure ContentService can persist to database
- RoutingService.ts: Fix example UUID in comment
- SchemaBasedFactory.ts: Fix hardcoded test UUID
The corrupted UUID issue (5e71a0c8-0303-4eb8-a478-3a121248) was caused by
stale session metadata files that weren't cleared during data reseed.
The session files stored old entityIds that no longer existed after
reseeding the database.
ContentState persistence now works - tabs are saved to database with
correct UUIDs. Tab restore on refresh still needs investigation due to
session management timing issues.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix tab restoration by bypassing stale localStorage cache
Root cause: Browser's OfflineStorageAdapter caches user_states in
localStorage. When tabs are opened, the server database is updated,
but localStorage retains stale data. On page refresh, loadUserContext()
would get old cached data with fewer/no openItems.
Fix: Add `backend: 'server'` to user_states query in loadUserContext()
to bypass localStorage cache and always fetch fresh contentState from
the server database.
Also added debug logging (temporary) to help diagnose initialization
timing issues between loadUserContext() and initializeContentTabs().
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* cleanup scripts
* Fix Clippy warnings in Rust workers
- inference-grpc: Fix dead code, use pool stats, proper strip_prefix
- data-daemon: Fix HDD acronym, add type alias for complex type
- inference: Collapse nested if-let
- model.rs: Use struct literal instead of removed new()
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix AI persona death and Clippy duplicate_mod warning
Root cause: UserDaemon's initializeDeferred() tried to create persona
clients before JTAGSystem.daemons was populated. DataDaemon emits
system:ready during its initialize() phase, triggering UserDaemon's
ensurePersonaClients() which needs CommandDaemon. But CommandDaemon
wasn't yet registered to JTAGSystem.daemons (only happens AFTER
orchestrator.startAll() returns).
Fix:
1. CommandDaemonServer now registers itself to globalThis during its
initialize() phase, providing early access for other daemons
2. JTAGSystem.getCommandsInterface() now checks globalThis first,
falling back to this.daemons for compatibility
Also fixed Clippy duplicate_mod warning in training-worker:
- logger_client.rs now re-exports JTAG protocol types
- messages.rs uses re-exports instead of including jtag_protocol directly
Verified: All 11 AI personas now healthy and responding to messages.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* reliabiity issues resolved.
* more reliable models
* Verify daemon refinements working
- Per-persona inference logging confirmed (Helper AI, Teacher AI, etc.)
- System utilities correctly show [unknown] in Rust logs
- AI responses verified working via Candle gRPC and cloud APIs
- Version bump 1.0.7184
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix inference bottlenecks: SignalDetector + prompt truncation
1. SignalDetector: Switch from local (slow) to Groq (fast)
- Was flooding local inference queue with classification calls
- Groq responds in <1s vs local ~10s
- Frees local queue for actual persona responses
2. CandleGrpcAdapter: Add prompt truncation (24K char limit)
- Prevents "narrow invalid args" tensor dimension errors
- Large RAG contexts were sending 74000+ char prompts
- Model has 8K token (~32K char) context window
- Truncation preserves system prompt + recent messages
Before: Constant queue backlog, tensor errors, hangs
After: Workers have availability, no tensor errors, faster responses
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix chat scroll latch: use latch state instead of fixed threshold
The chat widget was unlatching from the bottom when large messages
arrived because the fixed 200px threshold was too small.
Changes:
- Add isLatchedToBottom state to track user intent
- Dynamic threshold: max of config, 50% viewport, or 500px
- ResizeObserver checks latch state instead of distance
- Scroll handler updates latch with tighter 100px threshold
- Scroll listener active when autoScroll enabled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Fix initial scroll to bottom on fresh chat load
The scrollToEnd was called immediately after adding items to DOM,
but the browser hadn't laid them out yet. Using double-rAF ensures
the DOM is fully rendered before scrolling.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* audit fix
---------
Co-authored-by: Joel <undefined>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 7add4c7 commit 5a438bb
File tree
144 files changed
+3182
-8687
lines changed- archive
- src/debug/jtag
- api/data-seed
- commands
- collaboration
- chat
- analyze/server
- poll/server
- send/server
- content/open
- server
- data
- list
- browser
- read/browser
- daemons
- ai-provider-daemon
- adapters
- server
- command-daemon
- server
- data-daemon
- server
- events-daemon
- server
- lease-daemon/server
- session-daemon
- browser
- server
- user-daemon
- server
- docs
- scripts
- signaling/server
- system
- coordination/server
- core
- services
- types
- data/entities
- orchestration
- routing
- state
- user
- server
- modules
- cognition/memory
- tests/test-utils
- widgets
- chat
- chat-widget
- user-list
- continuum-metrics
- main
- user-profile
- workers
- data-daemon/src
- inference-grpc
- proto
- src
- inference/src
- logger/src
- training/src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
144 files changed
+3182
-8687
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
34 | 125 | | |
35 | 126 | | |
36 | 127 | | |
| |||
File renamed without changes.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| 43 | + | |
42 | 44 | | |
43 | | - | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
73 | | - | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
97 | 99 | | |
98 | 100 | | |
99 | 101 | | |
100 | | - | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
135 | | - | |
| 137 | + | |
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
| |||
161 | 163 | | |
162 | 164 | | |
163 | 165 | | |
164 | | - | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
190 | 192 | | |
191 | 193 | | |
192 | 194 | | |
193 | | - | |
| 195 | + | |
194 | 196 | | |
195 | 197 | | |
196 | 198 | | |
| |||
Lines changed: 18 additions & 43 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
16 | 14 | | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
29 | 43 | | |
30 | 44 | | |
31 | 45 | | |
| |||
182 | 196 | | |
183 | 197 | | |
184 | 198 | | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | 199 | | |
Lines changed: 5 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | 11 | | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
34 | 29 | | |
35 | 30 | | |
36 | 31 | | |
| |||
Lines changed: 11 additions & 49 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
39 | 42 | | |
40 | 43 | | |
41 | 44 | | |
42 | | - | |
| 45 | + | |
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
111 | | - | |
| 114 | + | |
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
115 | | - | |
| 118 | + | |
116 | 119 | | |
117 | 120 | | |
118 | | - | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | 125 | | |
164 | 126 | | |
165 | 127 | | |
| |||
0 commit comments