1515 padding : 20px ;
1616 background : # 0a0a0f ;
1717 color : # f0f0f8 ;
18- position : relative;
1918 }
2019 # chat {
2120 height : 500px ;
2524 padding : 10px ;
2625 background : # 0f0f14 ;
2726 border-radius : 8px ;
28- scroll-behavior : smooth;
2927 }
3028 .message {
3129 margin : 8px 0 ;
5553 .vela-pass { background : # 1e4620 ; color : # 4ade80 ; }
5654 .vela-flag { background : # 5f3a1a ; color : # ffaa33 ; }
5755 .vela-block { background : # 5f1a1a ; color : # ff4d4d ; }
58- .checkpoint-badge {
59- font-size : 10px ;
60- padding : 2px 6px ;
61- border-radius : 12px ;
62- background : # 2a2a3a ;
63- margin-left : 8px ;
64- }
6556 input , button {
6657 padding : 10px ;
6758 font-size : 14px ;
181172 padding : 4px 8px ;
182173 border-radius : 12px ;
183174 }
184- .checkpoint-display {
185- font-size : 11px ;
186- padding : 8px ;
187- background : # 0f0f14 ;
188- border-radius : 8px ;
189- margin-top : 8px ;
190- }
191175 .modal-overlay {
192176 position : fixed;
193177 top : 0 ; left : 0 ; right : 0 ; bottom : 0 ;
@@ -282,7 +266,6 @@ <h2>AION · Ada‑VELA</h2>
282266 </ div >
283267 </ div >
284268 < div class ="selected-values " id ="selectedValues "> </ div >
285- < div id ="checkpointDisplay " class ="checkpoint-display "> </ div >
286269 </ div >
287270
288271 < div class ="status-bar ">
@@ -350,7 +333,6 @@ <h2>AION · Ada‑VELA</h2>
350333 let lastResponse = null ;
351334 let isSending = false ;
352335 let structuredModeActive = false ;
353- let currentCheckpoints = { preCleared : [ ] , open : [ ] } ;
354336
355337 // DOM elements
356338 const chatDiv = document . getElementById ( 'chat' ) ;
@@ -364,7 +346,6 @@ <h2>AION · Ada‑VELA</h2>
364346 const lastSealSpan = document . getElementById ( 'lastSeal' ) ;
365347 const structuredUI = document . getElementById ( 'structuredUI' ) ;
366348 const selectedValuesDiv = document . getElementById ( 'selectedValues' ) ;
367- const checkpointDisplay = document . getElementById ( 'checkpointDisplay' ) ;
368349 const itlIntent = document . getElementById ( 'itlIntent' ) ;
369350 const itlDomain = document . getElementById ( 'itlDomain' ) ;
370351 const itlEmotion = document . getElementById ( 'itlEmotion' ) ;
@@ -409,7 +390,7 @@ <h2>AION · Ada‑VELA</h2>
409390 return data ;
410391 } ) ;
411392
412- // ========== GATE-ITL ==========
393+ // ========== Structured Mode: Build formatted message ==========
413394 function updateSelectedValuesDisplay ( ) {
414395 const selected = {
415396 intent : itlIntent . options [ itlIntent . selectedIndex ] ?. text ,
@@ -421,42 +402,12 @@ <h2>AION · Ada‑VELA</h2>
421402 . map ( ( [ k , v ] ) => `<span class="selected-value">${ k } : ${ v } </span>` ) . join ( '' ) ;
422403 }
423404
424- function updateCheckpointDisplay ( ) {
425- checkpointDisplay . innerHTML = `
426- ✅ Pre-cleared: ${ currentCheckpoints . preCleared . map ( c => `<span style="color:#4ade80">${ c } </span>` ) . join ( ', ' ) || 'none' } <br>
427- 🔓 Still open: ${ currentCheckpoints . open . map ( c => `<span style="color:#ffaa33">${ c } </span>` ) . join ( ', ' ) || 'none' }
428- ` ;
429- }
430-
431- function buildStructuredFragment ( message ) {
405+ function formatStructuredMessage ( rawMessage ) {
432406 const intent = itlIntent . value ;
433407 const domain = itlDomain . value ;
434408 const emotion = itlEmotion . value ;
435409 const timeSens = itlTime . value ;
436-
437- const preCleared = [ ] ;
438- if ( intent ) preCleared . push ( 'intent' ) ;
439- if ( domain ) preCleared . push ( 'domain' ) ;
440- if ( emotion ) preCleared . push ( 'emotional_state' ) ;
441- if ( timeSens ) preCleared . push ( 'time_sensitivity' ) ;
442- if ( message ) preCleared . push ( 'content' ) ;
443-
444- const open = [ ] ;
445- if ( ! intent ) open . push ( 'intent_ambiguous' ) ;
446- if ( ! domain ) open . push ( 'domain_boundary_exceeded' ) ;
447- if ( message . length < 3 ) open . push ( 'context_missing' ) ;
448-
449- currentCheckpoints = { preCleared, open } ;
450- updateCheckpointDisplay ( ) ;
451-
452- return {
453- intent, domain, emotion, timeSens, message,
454- checkpoints : currentCheckpoints ,
455- toText : ( ) => {
456- // Convert to a human-readable format for the assistant
457- return `[STRUCTURED MODE] Intent: ${ intent } , Domain: ${ domain } , Emotional state: ${ emotion } , Time sensitivity: ${ timeSens } \n\nMessage: ${ message } ` ;
458- }
459- } ;
410+ return `[STRUCTURED MODE]\nIntent: ${ intent } \nDomain: ${ domain } \nEmotional state: ${ emotion } \nTime sensitivity: ${ timeSens } \n\nMessage: ${ rawMessage } ` ;
460411 }
461412
462413 // ========== UI ==========
@@ -470,9 +421,6 @@ <h2>AION · Ada‑VELA</h2>
470421 const cls = v . status === 'BLOCKED' ? 'vela-block' : ( v . status === 'FLAGGED' ? 'vela-flag' : 'vela-pass' ) ;
471422 extraHtml += `<span class="vela-badge ${ cls } ">⚖️ VELA: ${ v . status } </span>` ;
472423 }
473- if ( extra . checkpoints ) {
474- extraHtml += `<span class="checkpoint-badge">📋 ${ extra . checkpoints . preCleared . length } /${ extra . checkpoints . preCleared . length + extra . checkpoints . open . length } cleared</span>` ;
475- }
476424 msgDiv . innerHTML = `<strong>${ role === 'user' ? 'You' : 'AI' } :</strong> ${ escapeHtml ( text ) } ${ extraHtml } ` ;
477425 chatDiv . appendChild ( msgDiv ) ;
478426 chatDiv . scrollTop = chatDiv . scrollHeight ;
@@ -540,7 +488,7 @@ <h2>AION · Ada‑VELA</h2>
540488 showModal ( 'Ada‑VELA Trace' , JSON . stringify ( trace , null , 2 ) ) ;
541489 }
542490
543- // ========== Send (works for both modes) ==========
491+ // ========== Send ==========
544492 async function send ( ) {
545493 if ( isSending ) { showToast ( 'Already sending, please wait...' ) ; return ; }
546494 const rawMessage = inputField . value . trim ( ) ;
@@ -551,31 +499,13 @@ <h2>AION · Ada‑VELA</h2>
551499 isSending = true ;
552500
553501 let payloadText = rawMessage ;
554- let checkpointsInfo = null ;
555-
556502 if ( structuredModeActive ) {
557- const fragment = buildStructuredFragment ( rawMessage ) ;
558- if ( ! fragment ) {
559- showToast ( 'Failed to build structured fragment' , true ) ;
560- inputField . disabled = false ;
561- isSending = false ;
562- return ;
563- }
564- // Convert fragment to human-readable text for the AI
565- payloadText = fragment . toText ( ) ;
566- checkpointsInfo = fragment . checkpoints ;
567-
568- // CEP Intercept: if open checkpoints exist and not urgent
569- if ( fragment . checkpoints . open . length > 0 && fragment . timeSens !== 'now' ) {
570- addSystemMessage ( `⚠️ **CEP INTERCEPT** – ${ fragment . checkpoints . open . length } checkpoint(s) open.\n\nPlease clarify: ${ fragment . checkpoints . open . join ( ', ' ) } ` ) ;
571- inputField . disabled = false ;
572- isSending = false ;
573- return ;
574- }
503+ payloadText = formatStructuredMessage ( rawMessage ) ;
504+ addMessage ( 'user' , rawMessage , { structured : true } ) ;
505+ } else {
506+ addMessage ( 'user' , rawMessage ) ;
575507 }
576508
577- addMessage ( 'user' , rawMessage , { checkpoints : checkpointsInfo } ) ;
578-
579509 const thinking = document . createElement ( 'div' ) ;
580510 thinking . className = 'message ai' ;
581511 thinking . innerHTML = '<strong>AI:</strong> ...' ;
@@ -592,7 +522,7 @@ <h2>AION · Ada‑VELA</h2>
592522 const cls = v . status === 'BLOCKED' ? 'vela-block' : ( v . status === 'FLAGGED' ? 'vela-flag' : 'vela-pass' ) ;
593523 velaDisplay . className = `vela-badge ${ cls } ` ;
594524 velaDisplay . innerHTML = `⚖️ VELA: ${ v . status } ` ;
595- addMessage ( 'ai' , result . response , { sealHash : true , velaResult : v , checkpoints : checkpointsInfo } ) ;
525+ addMessage ( 'ai' , result . response , { sealHash : true , velaResult : v } ) ;
596526 } else {
597527 thinking . innerHTML = '<strong>AI:</strong> Error: No response' ;
598528 }
@@ -615,8 +545,7 @@ <h2>AION · Ada‑VELA</h2>
615545 modeBadge . classList . add ( 'structured' ) ;
616546 inputField . placeholder = 'Type your message (will be structured)' ;
617547 updateSelectedValuesDisplay ( ) ;
618- buildStructuredFragment ( '' ) ;
619- addSystemMessage ( '🌌 **STRUCTURED MODE ACTIVE**\n\nSet intent, domain, emotion, time. Your message will be wrapped with these fields.' ) ;
548+ addSystemMessage ( '🌌 **STRUCTURED MODE ACTIVE**\n\nSet intent, domain, emotion, time. Your message will be sent with these fields.' ) ;
620549 } else {
621550 structuredUI . classList . remove ( 'active' ) ;
622551 modeBadge . textContent = '⚡ REGULAR' ;
@@ -644,20 +573,11 @@ <h2>AION · Ada‑VELA</h2>
644573 inputField . addEventListener ( 'keypress' , ( e ) => { if ( e . key === 'Enter' ) send ( ) ; } ) ;
645574
646575 [ itlIntent , itlDomain , itlEmotion , itlTime ] . forEach ( el => {
647- el . addEventListener ( 'change' , ( ) => {
648- if ( structuredModeActive ) {
649- updateSelectedValuesDisplay ( ) ;
650- buildStructuredFragment ( inputField . value . trim ( ) ) ;
651- }
652- } ) ;
653- } ) ;
654- inputField . addEventListener ( 'input' , ( ) => {
655- if ( structuredModeActive ) buildStructuredFragment ( inputField . value . trim ( ) ) ;
576+ el . addEventListener ( 'change' , updateSelectedValuesDisplay ) ;
656577 } ) ;
657-
658578 updateSelectedValuesDisplay ( ) ;
659- buildStructuredFragment ( '' ) ;
660- addMessage ( 'ai' , 'Ada‑VELA active. Click + → Structured Mode to activate GATE-ITL .' ) ;
579+
580+ addMessage ( 'ai' , 'Ada‑VELA active. Click + → Structured Mode to activate.' ) ;
661581 </ script >
662582</ body >
663583</ html >
0 commit comments