Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 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 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | import type { CallState } from './talkToNumber/useRealtimeVoice' interface ModeDebug { current: string previous: string | null transitions: Array<{ from: string to: string action: string timestamp: number tools: string[] }> } interface VoiceDebugPanelsProps { voiceState: CallState modeDebug: ModeDebug | null activeGameId: string | null currentInstructions: string | null isDark: boolean } export function VoiceDebugPanels({ voiceState, modeDebug, activeGameId, currentInstructions, }: VoiceDebugPanelsProps) { return ( <> {voiceState !== 'idle' && modeDebug && ( <div data-component="voice-mode-debug" style={{ position: 'fixed', top: 'calc(var(--app-nav-height, 56px) + 16px)', left: 16, zIndex: 9999, background: 'rgba(17,24,39,0.93)', backdropFilter: 'blur(8px)', borderRadius: 8, padding: '12px 16px', color: 'rgba(243,244,246,1)', fontSize: 12, width: 280, maxHeight: 'calc(100dvh - var(--app-nav-height, 56px) - 48px)', display: 'flex', flexDirection: 'column', boxShadow: '0 4px 12px rgba(0,0,0,0.3)', pointerEvents: 'auto', }} > <div style={{ fontWeight: 700, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.05em', opacity: 0.6, marginBottom: 8, flexShrink: 0, }} > Voice State Machine </div> {/* Current state — prominent pill */} <div data-element="current-mode" style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 8 }} > <span style={{ display: 'inline-block', padding: '2px 10px', borderRadius: 12, fontWeight: 700, fontSize: 13, color: '#fff', background: ( { answering: '#3b82f6', familiarizing: '#8b5cf6', default: '#22c55e', conference: '#06b6d4', exploration: '#f59e0b', game: '#ef4444', winding_down: '#f97316', hanging_up: '#6b7280', } as Record<string, string> )[modeDebug.current] ?? '#6b7280', }} > {modeDebug.current} </span> {modeDebug.previous && ( <span style={{ opacity: 0.5, fontSize: 11 }}> {'<-'} {modeDebug.previous} </span> )} </div> {/* Active game ID */} {activeGameId && ( <div style={{ fontSize: 11, opacity: 0.7, marginBottom: 6 }}>Game: {activeGameId}</div> )} {/* Transition log — scrollable, newest on top */} <div data-element="transition-log" style={{ overflowY: 'auto', flex: 1, minHeight: 0, maxHeight: 200, borderTop: '1px solid rgba(255,255,255,0.1)', paddingTop: 6, marginTop: 2, }} > {[...modeDebug.transitions].reverse().map((t, i) => { const age = Date.now() - t.timestamp const ageStr = age < 60_000 ? `${Math.round(age / 1000)}s` : `${Math.round(age / 60_000)}m` return ( <div key={i} style={{ display: 'flex', gap: 6, fontSize: 10, lineHeight: '18px', opacity: i === 0 ? 1 : 0.6, }} > <span style={{ color: '#9ca3af', minWidth: 24, textAlign: 'right', flexShrink: 0 }} > {ageStr} </span> <span style={{ flexShrink: 0 }}> {t.from} {'>'} {t.to} </span> <span style={{ color: '#6b7280', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', }} > {t.action} </span> </div> ) })} </div> {/* Active tools list */} {modeDebug.transitions.length > 0 && ( <div data-element="active-tools" style={{ fontSize: 10, color: '#6b7280', marginTop: 6, borderTop: '1px solid rgba(255,255,255,0.1)', paddingTop: 6, wordBreak: 'break-word', }} > Tools: {modeDebug.transitions[modeDebug.transitions.length - 1].tools.join(', ')} </div> )} </div> )} {currentInstructions && ( <div data-component="voice-context-debug" style={{ position: 'fixed', bottom: 16, right: 16, zIndex: 9999, background: 'rgba(17,24,39,0.93)', backdropFilter: 'blur(8px)', borderRadius: 8, padding: '12px 16px', color: 'rgba(243,244,246,1)', fontSize: 12, width: 'min(520px, calc(100vw - 320px))', maxHeight: 'calc(100dvh - var(--app-nav-height, 56px) - 48px)', display: 'flex', flexDirection: 'column', boxShadow: '0 4px 12px rgba(0,0,0,0.3)', pointerEvents: 'auto', }} > <div style={{ fontWeight: 700, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.05em', opacity: 0.6, marginBottom: 8, flexShrink: 0, }} > Voice Agent Context ({Math.round(currentInstructions.length / 1000)}k chars) </div> <pre data-element="voice-context-text" style={{ margin: 0, padding: 8, background: 'rgba(0,0,0,0.3)', borderRadius: 6, fontSize: 10, lineHeight: 1.4, whiteSpace: 'pre-wrap', wordBreak: 'break-word', overflowY: 'auto', flex: 1, minHeight: 0, color: 'rgba(209, 213, 219, 0.9)', fontFamily: 'ui-monospace, "SF Mono", Menlo, monospace', }} > {currentInstructions} </pre> </div> )} </> ) } |