@ -365,9 +365,16 @@ if (parsed.calls.length === 0) { if (hasMarker) { try { var __dh = hashText(text
canStart = true ;
canStart = true ;
} ) ;
} ) ;
setInterval ( function ( ) {
setInterval ( function ( ) {
BRIDGE . health ( ) . then ( function ( r ) { if ( UI && UI . setConnected ) UI . setConnected ( ! ! ( r && r . ok ) ) ; } ) ;
BRIDGE . health ( ) . then ( function ( r ) {
if ( UI && UI . setConnected ) UI . setConnected ( ! ! ( r && r . ok ) ) ;
if ( r && r . ok ) _ _refreshStats ( ) ;
} ) ;
} , 30000 ) ;
} , 30000 ) ;
_ _refreshStats ( ) ;
_ _refreshStats ( ) ;
// Keep stats fresh: without this, if bridge was down at init, the panel
// stays stuck at "? 0 (always 0)" until F5. Refresh every 30s, and also
// immediately on every successful health probe.
setInterval ( _ _refreshStats , 30000 ) ;
} ) ;
} ) ;
} ) ;
} ) ;
function _ _refreshStats ( ) { try { var DB = globalThis . DSH _BRIDGE ; if ( ! UI || ! UI . setStats ) return ; if ( ! DB || ! DB . fetchBridge ) { UI . setStats ( '?' , 0 , 0 ) ; return ; } DB . fetchBridge ( 'GET' , '/memory/state' ) . then ( function ( j ) { var st = ( j && j . ok && j . data ) ? j . data : { } ; var entries = st . entries || [ ] ; var total = entries . length ; var alwaysN = entries . filter ( function ( e ) { return e . importance === 'always' && e . state !== 'archive' && e . state !== 'done' ; } ) . length ; return DB . fetchBridge ( 'GET' , '/health' ) . then ( function ( hj ) { UI . setStats ( ( hj && hj . ok && hj . workspace ) || '?' , total , alwaysN ) ; } ) ; } ) . catch ( function ( e ) { console . warn ( '[dsh-memory] stats ' + String ( e ) ) ; UI . setStats ( '?' , 0 , 0 ) ; } ) ; } catch ( e ) { console . warn ( '[dsh-memory] stats ' + String ( e ) ) ; } }
function _ _refreshStats ( ) { try { var DB = globalThis . DSH _BRIDGE ; if ( ! UI || ! UI . setStats ) return ; if ( ! DB || ! DB . fetchBridge ) { UI . setStats ( '?' , 0 , 0 ) ; return ; } DB . fetchBridge ( 'GET' , '/memory/state' ) . then ( function ( j ) { var st = ( j && j . ok && j . data ) ? j . data : { } ; var entries = st . entries || [ ] ; var total = entries . length ; var alwaysN = entries . filter ( function ( e ) { return e . importance === 'always' && e . state !== 'archive' && e . state !== 'done' ; } ) . length ; return DB . fetchBridge ( 'GET' , '/health' ) . then ( function ( hj ) { UI . setStats ( ( hj && hj . ok && hj . workspace ) || '?' , total , alwaysN ) ; } ) ; } ) . catch ( function ( e ) { console . warn ( '[dsh-memory] stats ' + String ( e ) ) ; UI . setStats ( '?' , 0 , 0 ) ; } ) ; } catch ( e ) { console . warn ( '[dsh-memory] stats ' + String ( e ) ) ; } }