<commit_before>namespace $ {
	
	export type $mol_store_shared_data = Record< string , $hyoo_crowd_delta_value | string[] >
	
	export class $mol_store_shared extends $mol_store< $mol_store_shared_data > {
		
		@ $mol_mem_key
		store( prefix: string ) {
			return new this.$.$hyoo_crowd_graph
		}
		
		@ $mol_mem_key
		version_last( prefix: string, next?: number ) {
			return next ?? this.store( prefix ).clock.version_max
		}
		
		@ $mol_mem_key
		request( prefix: string ) {
			
			this.socket()
			
			$mol_fiber_defer( ()=>
				this.send(
					prefix,
					this.store( prefix ).delta(),
				)
			)
			
			return null
		}
		
		_send_task: undefined | $mol_fiber
		
		@ $mol_mem_key
		value< Key extends keyof $mol_store_shared_data >(
			key: Key,
			next?: $mol_store_shared_data[ Key ],
		) {
			
			let [ prefix, ... tail ] = key.split( '/' )
			let suffix = tail.join( '/' )
			
			if( !suffix ) {
				suffix = prefix
				prefix = ''
			}
			
			const store = this.store( prefix )
			const prev = $mol_mem_cached( ()=> this.value( key ) )

			this.request( prefix )
			this.version_last( prefix )
			
			if( next == undefined ) {
				
				// const delta = this.$.$mol_store_local.value( prefix )
				// if( delta ) store.apply( delta )
				
				return store.value( suffix )!
				
			} else {
				
				const val = store.value( suffix, next )
				
				if( !this._send_task ) {
					this._send_task = $mol_fiber_defer( ()=> {
						this.send(
							prefix,
							store.delta(),
						)
						this._send_task = undefined
					} )
				}
				
				// this.$.$mol_store_local.value( prefix, store.delta() )
				
				return val!
			}
		}
		
		@ $mol_mem_key
		selection<
			Key extends keyof $mol_store_shared_data
		>( key: Key, next?: number[] ) {
			
			let [ prefix, ... tail ] = key.split( '/' )
			let suffix = tail.join( '/' )
			
			if( !suffix ) {
				suffix = prefix
				prefix = ''<commit_msg>$mol_store_shared: fixed messaging break on delta gen error<commit_after>namespace $ {
	
	export type $mol_store_shared_data = Record< string , $hyoo_crowd_delta_value | string[] >
	
	export class $mol_store_shared extends $mol_store< $mol_store_shared_data > {
		
		@ $mol_mem_key
		store( prefix: string ) {
			return new this.$.$hyoo_crowd_graph
		}
		
		@ $mol_mem_key
		version_last( prefix: string, next?: number ) {
			return next ?? this.store( prefix ).clock.version_max
		}
		
		@ $mol_mem_key
		request( prefix: string ) {
			
			this.socket()
			
			$mol_fiber_defer( ()=>
				this.send(
					prefix,
					this.store( prefix ).delta(),
				)
			)
			
			return null
		}
		
		_send_task: undefined | $mol_fiber
		
		@ $mol_mem_key
		value< Key extends keyof $mol_store_shared_data >(
			key: Key,
			next?: $mol_store_shared_data[ Key ],
		) {
			
			let [ prefix, ... tail ] = key.split( '/' )
			let suffix = tail.join( '/' )
			
			if( !suffix ) {
				suffix = prefix
				prefix = ''
			}
			
			const store = this.store( prefix )
			const prev = $mol_mem_cached( ()=> this.value( key ) )

			this.request( prefix )
			this.version_last( prefix )
			
			if( next == undefined ) {
				
				// const delta = this.$.$mol_store_local.value( prefix )
				// if( delta ) store.apply( delta )
				
				return store.value( suffix )!
				
			} else {
				
				const val = store.value( suffix, next )
				
				if( !this._send_task ) {
					this._send_task = $mol_fiber_defer( ()=> {
						this._send_task = undefined
						this.send(
							prefix,
							store.delta(),
						)
					} )
				}
				
				// this.$.$mol_store_local.value( prefix, store.delta() )
				
				return val!
			}
		}
		
		@ $mol_mem_key
		selection<
			Key extends keyof $mol_store_shared_data
		>( key: Key, next?: number[] ) {
			
			let [ prefix, ... tail ] = key.split( '/' )
			let suffix = tail.join( '/' )
			
			if( !suffix ) {
				suffix = prefix
				prefix = ''
{'fraction_non_alphanumeric': 0.13707165109034267, 'fraction_numerical': 0.0, 'mean_word_length': 2.226968174204355, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '80273', 'n_tokens_mistral': 1824, 'n_tokens_neox': 1326, 'n_words': 287}