5959 margin-left : 8px ;
6060 cursor : pointer;
6161 }
62+ .ada-badge {
63+ font-size : 9px ;
64+ background : # 1e3a5f ;
65+ padding : 2px 6px ;
66+ border-radius : 12px ;
67+ margin-left : 8px ;
68+ cursor : pointer;
69+ color : # c9a028 ;
70+ }
6271 input , button {
6372 padding : 10px ;
6473 font-size : 14px ;
@@ -358,6 +367,13 @@ <h2>AION · Ada‑VELA</h2>
358367 const openCount = extra . receipt . still_open || 0 ;
359368 extraHtml += `<span class="receipt-badge" data-receipt='${ JSON . stringify ( extra . receipt ) . replace ( / ' / g, "'" ) } '>📋 ${ extra . receipt . epistemic_weight || 'receipt' } (${ openCount } open)</span>` ;
360369 }
370+ // ADA loop metadata
371+ if ( extra . adaLoop ) {
372+ const loop = extra . adaLoop ;
373+ const status = loop . converged ? '✅' : '🔄' ;
374+ const text = `${ status } ADA: ${ loop . rounds } rounds${ loop . converged ? '' : ' (unconverged)' } ` ;
375+ extraHtml += `<span class="ada-badge" data-ada='${ JSON . stringify ( loop ) . replace ( / ' / g, "'" ) } '>${ text } </span>` ;
376+ }
361377 div . innerHTML = `<strong>${ role === 'user' ? 'You' : 'AI' } :</strong> ${ escapeHtml ( text ) } ${ extraHtml } ` ;
362378 chatDiv . appendChild ( div ) ;
363379 chatDiv . scrollTop = chatDiv . scrollHeight ;
@@ -367,6 +383,10 @@ <h2>AION · Ada‑VELA</h2>
367383 if ( receiptBadge && extra . receipt ) {
368384 receiptBadge . onclick = ( ) => showModal ( 'Checkpoint Receipt' , JSON . stringify ( extra . receipt , null , 2 ) ) ;
369385 }
386+ const adaBadge = div . querySelector ( '.ada-badge' ) ;
387+ if ( adaBadge && extra . adaLoop ) {
388+ adaBadge . onclick = ( ) => showModal ( 'ADA Loop Details' , JSON . stringify ( extra . adaLoop , null , 2 ) ) ;
389+ }
370390 }
371391
372392 function addSystemMessage ( text ) {
@@ -621,6 +641,7 @@ <h3>📋 Clarification Required</h3>
621641 lastResponse = result . response ;
622642 thinking . remove ( ) ;
623643
644+ // Update VELA badge
624645 if ( result . pac ) {
625646 const ppi = result . pac . ppi ;
626647 const cls = ppi < 30 ? 'vela-block' : ( ppi < 70 ? 'vela-flag' : 'vela-pass' ) ;
@@ -633,7 +654,9 @@ <h3>📋 Clarification Required</h3>
633654 velaDisplay . innerHTML = `⚖️ VELA: ${ result . vela_status } ` ;
634655 }
635656
636- addMessage ( 'ai' , result . response , { sealHash : true , receipt : result . checkpoint_receipt } ) ;
657+ // ADA loop metadata (if present)
658+ const adaLoop = result . ada_loop ;
659+ addMessage ( 'ai' , result . response , { sealHash : true , receipt : result . checkpoint_receipt , adaLoop } ) ;
637660 } else {
638661 thinking . innerHTML = '<strong>AI:</strong> Error: No response' ;
639662 }
0 commit comments