@@ -11,54 +11,47 @@ import { drawFrame, drawPanel } from '/src/engine/debug/index.js';
1111const theme = new Theme ( ThemeTokens ) ;
1212
1313export default class Phase19FoundationScene extends Scene {
14- constructor ( { runtimeLayer = null } = { } ) {
14+ constructor ( { phase19Flow = null } = { } ) {
1515 super ( ) ;
1616 this . elapsed = 0 ;
17- this . runtimeLayer = runtimeLayer ;
17+ this . phase19Flow = phase19Flow ;
1818 this . lastHeartbeatTick = 0 ;
1919 this . lastHeartbeatTime = 0 ;
2020 this . lastRuntimeTransition = 'idle' ;
21- this . unsubscribeHeartbeat = null ;
2221 this . unsubscribeRuntimeState = null ;
2322 }
2423
2524 enter ( engine ) {
26- if ( ! this . runtimeLayer ) return ;
27- this . unsubscribeRuntimeState = this . runtimeLayer . onStateChange ( ( { previous, next } ) => {
25+ if ( ! this . phase19Flow ) return ;
26+ this . unsubscribeRuntimeState = this . phase19Flow . onStateChange ( ( { previous, next } ) => {
2827 this . lastRuntimeTransition = `${ previous } -> ${ next } ` ;
2928 } ) ;
30- const channel = this . runtimeLayer . getService ( 'phase19.channel' ) ;
31- if ( channel && typeof channel . subscribe === 'function' ) {
32- this . unsubscribeHeartbeat = channel . subscribe ( 'phase19.heartbeat' , ( payload ) => {
33- this . lastHeartbeatTick = Number ( payload ?. tick ) || 0 ;
34- this . lastHeartbeatTime = Number ( payload ?. t ) || 0 ;
35- } ) ;
36- }
37- this . runtimeLayer . start ( { engine, scene : this } ) ;
29+ this . phase19Flow . start ( { engine, scene : this } ) ;
3830 }
3931
4032 update ( dtSeconds ) {
4133 this . elapsed += dtSeconds ;
42- this . runtimeLayer ?. update ( dtSeconds , { scene : this } ) ;
34+ this . phase19Flow ?. update ( dtSeconds , { scene : this } ) ;
35+ const snapshot = this . phase19Flow ?. getSnapshot ?. ( ) ;
36+ if ( snapshot ?. flow ) {
37+ this . lastHeartbeatTick = Number ( snapshot . flow . lastHeartbeatTick ) || 0 ;
38+ this . lastHeartbeatTime = Number ( snapshot . flow . lastHeartbeatSeconds ) || 0 ;
39+ }
4340 }
4441
4542 exit ( ) {
46- if ( typeof this . unsubscribeHeartbeat === 'function' ) {
47- this . unsubscribeHeartbeat ( ) ;
48- this . unsubscribeHeartbeat = null ;
49- }
5043 if ( typeof this . unsubscribeRuntimeState === 'function' ) {
5144 this . unsubscribeRuntimeState ( ) ;
5245 this . unsubscribeRuntimeState = null ;
5346 }
54- this . runtimeLayer ?. stop ( { scene : this } ) ;
47+ this . phase19Flow ?. stop ( { scene : this } ) ;
5548 }
5649
5750 render ( renderer ) {
5851 drawFrame ( renderer , theme , [
59- 'Sample 1901 - Phase 19 Core Services ' ,
60- 'Minimal Phase 19 core-services skeleton wired into foundation sample .' ,
61- 'No feature implementation in this core-services slice.' ,
52+ 'Sample 1901 - Phase 19 Integration Flow ' ,
53+ 'Minimal Phase 19 integration flow wired over runtime layer + core services .' ,
54+ 'No feature implementation in this integration slice.' ,
6255 ] ) ;
6356
6457 renderer . drawRect ( 120 , 212 , 720 , 200 , '#0f172a' ) ;
@@ -72,23 +65,30 @@ export default class Phase19FoundationScene extends Scene {
7265 font : '16px monospace' ,
7366 } ) ;
7467
75- const runtimeSnapshot = this . runtimeLayer ?. getSnapshot ?. ( ) || {
68+ const phase19Snapshot = this . phase19Flow ?. getSnapshot ?. ( ) || {
69+ runtime : {
70+ state : 'idle' ,
71+ tickCount : 0 ,
72+ serviceIds : [ ] ,
73+ } ,
74+ flow : {
75+ runtimeStateEvents : 0 ,
76+ } ,
77+ } ;
78+ const runtimeSnapshot = phase19Snapshot . runtime || {
7679 state : 'idle' ,
7780 tickCount : 0 ,
7881 serviceIds : [ ] ,
7982 } ;
80- const channelSnapshot = this . runtimeLayer ?. getService ?. ( 'phase19.channel' ) ?. getSnapshot ?. ( ) || {
81- publishedCount : 0 ,
82- lastChannel : 'none' ,
83- } ;
83+ const flowSnapshot = phase19Snapshot . flow || { runtimeStateEvents : 0 } ;
8484 drawPanel ( renderer , 620 , 34 , 300 , 160 , 'Phase 19 Bootstrap' , [
85- 'Status: initialized (runtime layer) ' ,
85+ 'Status: initialized' ,
8686 'Folder: samples/phase-19' ,
8787 'Entry sample: 1901' ,
8888 `Runtime: ${ runtimeSnapshot . state } | tick ${ runtimeSnapshot . tickCount } ` ,
8989 `Transition: ${ this . lastRuntimeTransition } ` ,
90+ `Flow events: ${ flowSnapshot . runtimeStateEvents } ` ,
9091 `Services: ${ runtimeSnapshot . serviceIds . length } ` ,
91- `Published: ${ channelSnapshot . publishedCount } (${ channelSnapshot . lastChannel } )` ,
9292 `Heartbeat tick: ${ this . lastHeartbeatTick } @ ${ this . lastHeartbeatTime . toFixed ( 2 ) } s` ,
9393 ] ) ;
9494 }
0 commit comments