@@ -34,7 +34,7 @@ export function usePersistCompletedSession({
3434 if ( ! engineReady ) {
3535 return ;
3636 }
37- if ( status !== "completed" || completedAt == null || engineSummary . completion < 1 ) {
37+ if ( status !== "completed" || completedAt == null ) {
3838 return ;
3939 }
4040 if ( lastPersistedAt . current === completedAt ) {
@@ -61,15 +61,29 @@ export function usePersistCompletedSession({
6161 promptPreview,
6262 targetLength : engineSummary . target_length ,
6363 typedLength : engineSummary . typed_length ,
64+ keystrokes : ( engineSummary as any ) . keystrokes ,
6465 correct : engineSummary . correct ,
6566 incorrect : engineSummary . incorrect ,
6667 accuracy : engineSummary . accuracy ,
68+ completion : engineSummary . completion ,
6769 wpm : metrics . wpm ,
6870 elapsedMs : metrics . elapsedMs ,
6971 startedAt : startedAtEpoch ,
7072 completedAt : finishedAtEpoch ,
7173 attempts : attemptsSnapshot ,
7274 } ) ;
75+ try {
76+ const event = new CustomEvent ( "devkeys:session-saved" , {
77+ detail : {
78+ id : sessionId ,
79+ promptId,
80+ language,
81+ } ,
82+ } ) ;
83+ window . dispatchEvent ( event ) ;
84+ } catch {
85+ // no-op in non-DOM environments
86+ }
7387 } ) ( ) ;
7488 } , [
7589 attempts ,
0 commit comments