@arclabs561/ai-visual-test 0.7.4 → 0.7.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +3 -0
- package/index.d.ts +140 -0
- package/package.json +2 -6
- package/src/batch-optimizer.mjs +3 -3
- package/src/cache.mjs +3 -4
- package/src/calibration-suite.mjs +197 -0
- package/src/constants.mjs +11 -0
- package/src/cost-optimization.mjs +1 -1
- package/src/explanation-manager.mjs +10 -6
- package/src/human-validation-manager.mjs +21 -8
- package/src/index.mjs +20 -10
- package/src/integrations/playwright.mjs +9 -9
- package/src/judge.mjs +7 -18
- package/src/limitations.mjs +106 -0
- package/src/load-env.mjs +3 -2
- package/src/model-tier-selector.mjs +1 -1
- package/src/rubrics.mjs +22 -2
- package/src/score-calibration.mjs +177 -0
- package/src/temporal-decision-manager.mjs +1 -1
- package/src/temporal-preprocessor.mjs +1 -1
- package/src/type-guards.mjs +5 -5
- package/src/utils/cached-llm.mjs +1 -1
- package/src/validation-result-normalizer.mjs +8 -0
- package/src/validation.mjs +13 -13
- package/src/validators/index.mjs +23 -2
- package/src/pricing.mjs +0 -28
- package/src/utils/path-validator.mjs +0 -88
- package/src/validation-framework.mjs +0 -325
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0x3b25(){const _0x276b7c=['uhjVz3i','zxzLBa','Aw50zxi','zMLSDgu','Dgf0zq','x2LKzw4','Aw9U','ywn0Aw8','DefJDgK','C3rqCNu','igfJDgK','y29UzMW','AgvwywW','ChvZAa','BgvUz3q','DhjLBMq','yxrL','kcGOlIS','mJu0otHYu1HhANi','DMf0Aw8','Axr5rgu','DgfTCa','ChjLChi','D1nPEMu','DML0EuW','B2jZzxi','BwfW','C29Yxsa','y29UC3q','AwDODa','CMvKDwm','u2nHBgu','CNvJDg8','ndCWzhvgy1br','EtOG','AxntDge','zxrLicG','sw5cywm','BMvKtM8','BM90zum','Bwf4tM8','yxnPBMC','mZa0mdG5v1LXyM1J','mtCYodHSBgvOALC','y2fJAgu','z2fTzvm','Axndywm','Aw5JBhu','Bg93','qMfJA2C','Cgf0Dgu','yxrZ','C3fYDa','B3vUDa','ignHy2G','yxrPB24','zwrdywm','Aw1L','CM5Z','twf4qwC','rMfJDg8','y29Ozxi','C29Tzq','C2nVCMu','sw50zxi','Aw5Nsw4','z2f0zwq','BgfZDfa','zxnZ','AgfZvxm','q2fJAgu','DgL2Axq','DgLTzxm','nZa3ndK5A2fRuhjg','yMXLu3q','DhvKzq','C291CMm','zxjjBNq','n3D2tu5fvq','nJa4mti0z25Owhz1','z2v0rMe','zgvJCMu','Awn0CW','Chj1BMu','BwfNBMK','nZCZnJm1uM1WrLzl','ze5VDgu','Bwv0CMK','A2DYB3u','w1bYzxa','C2LUzYa','vxnPBMC','Aw5JCMu','B2nLC3m','CYWGywm','C2XPy2u','C3rbz2C','zgvZ','y2vZC1q','z2v0q2e','Cg93','mdaWBxm','ywn0Axy','yxr0zw4','DgLMEva','zw5Jzq','DgvZDa','C3rLCa','BwvKAxu','C3noB3q','DgvJDg8','zwLNAhq','Aw5N','yNnLCNy','BM93','zwXHChm','zgvJyxK','BxvSDgK','z3jLz2e','yxr0zxi','BNvTyMu','ywDNCMu','zgv0zwm','zMfPBgu','ngP0uhLsBq','DhLWzq','nK5RuMLjzW','Bgf0zw4','C2vHCMm','mg1Z','Dg9tDhi','y29TCgW','DgvZ','CM9Jzxm','C3rnDwW','AgLNAa','mZm0nZn4BeXlwLK','CM91BMq','D2LUzg8','CMvWCM8','yxbWBhK','BwLUv2u'];_0x3b25=function(){return _0x276b7c;};return _0x3b25();}const _0x2a498c=_0x4109;(function(_0x5b53f0,_0x272427){const _0x24a88b=_0x4109,_0x48a15b=_0x5b53f0();while(!![]){try{const _0x3bc907=-parseInt(_0x24a88b(0x1d2))/0x1+-parseInt(_0x24a88b(0x23c))/0x2*(-parseInt(_0x24a88b(0x1ea))/0x3)+-parseInt(_0x24a88b(0x20f))/0x4+-parseInt(_0x24a88b(0x215))/0x5*(-parseInt(_0x24a88b(0x23e))/0x6)+parseInt(_0x24a88b(0x20e))/0x7*(parseInt(_0x24a88b(0x1eb))/0x8)+parseInt(_0x24a88b(0x209))/0x9+-parseInt(_0x24a88b(0x1e1))/0xa*(parseInt(_0x24a88b(0x248))/0xb);if(_0x3bc907===_0x272427)break;else _0x48a15b['push'](_0x48a15b['shift']());}catch(_0x261024){_0x48a15b['push'](_0x48a15b['shift']());}}}(_0x3b25,0x1cbab));const _0x38dcdd=(function(){let _0x2e1ba=!![];return function(_0x5508de,_0x22b862){const _0x223aee=_0x2e1ba?function(){const _0x32eb8a=_0x4109;if(_0x22b862){const _0x5bc56f=_0x22b862[_0x32eb8a(0x24c)](_0x5508de,arguments);return _0x22b862=null,_0x5bc56f;}}:function(){};return _0x2e1ba=![],_0x223aee;};}()),_0x4cce2c=_0x38dcdd(this,function(){const _0x179522=_0x4109;return _0x4cce2c[_0x179522(0x242)+_0x179522(0x230)]()['searc'+'h'](_0x179522(0x1d1)+')+)+)'+'+$')[_0x179522(0x242)+_0x179522(0x230)]()[_0x179522(0x1dc)+_0x179522(0x1e0)+'r'](_0x4cce2c)[_0x179522(0x240)+'h'](_0x179522(0x1d1)+')+)+)'+'+$');});_0x4cce2c();function _0x4109(_0xe8b169,_0x4e9de2){const _0x2babcd=_0x3b25();return _0x4109=function(_0x4cce2c,_0x38dcdd){_0x4cce2c=_0x4cce2c-0x1ce;let _0x3b2572=_0x2babcd[_0x4cce2c];if(_0x4109['KVwSdd']===undefined){var _0x410946=function(_0x182f46){const _0x233ca5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x46d1bc='',_0x38ad59='',_0x11b5bc=_0x46d1bc+_0x410946;for(let _0x51d02c=0x0,_0x53e513,_0x43f101,_0x3836e1=0x0;_0x43f101=_0x182f46['charAt'](_0x3836e1++);~_0x43f101&&(_0x53e513=_0x51d02c%0x4?_0x53e513*0x40+_0x43f101:_0x43f101,_0x51d02c++%0x4)?_0x46d1bc+=_0x11b5bc['charCodeAt'](_0x3836e1+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x53e513>>(-0x2*_0x51d02c&0x6)):_0x51d02c:0x0){_0x43f101=_0x233ca5['indexOf'](_0x43f101);}for(let _0x3d67bb=0x0,_0x5ee8db=_0x46d1bc['length'];_0x3d67bb<_0x5ee8db;_0x3d67bb++){_0x38ad59+='%'+('00'+_0x46d1bc['charCodeAt'](_0x3d67bb)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x38ad59);};_0x4109['aBHyph']=_0x410946,_0xe8b169=arguments,_0x4109['KVwSdd']=!![];}const _0x39cb10=_0x2babcd[0x0],_0x5af297=_0x4cce2c+_0x39cb10,_0x37f04c=_0xe8b169[_0x5af297];if(!_0x37f04c){const _0x75d388=function(_0x3deb78){this['XIutrL']=_0x3deb78,this['fIoAsw']=[0x1,0x0,0x0],this['qhFBVA']=function(){return'newState';},this['JVcqez']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['QxuGFY']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x75d388['prototype']['JPhBHQ']=function(){const _0x5c9130=new RegExp(this['JVcqez']+this['QxuGFY']),_0x2d1fee=_0x5c9130['test'](this['qhFBVA']['toString']())?--this['fIoAsw'][0x1]:--this['fIoAsw'][0x0];return this['Zsqltx'](_0x2d1fee);},_0x75d388['prototype']['Zsqltx']=function(_0x228212){if(!Boolean(~_0x228212))return _0x228212;return this['jPyimC'](this['XIutrL']);},_0x75d388['prototype']['jPyimC']=function(_0x187626){for(let _0x4cfa1e=0x0,_0x32ffee=this['fIoAsw']['length'];_0x4cfa1e<_0x32ffee;_0x4cfa1e++){this['fIoAsw']['push'](Math['round'](Math['random']())),_0x32ffee=this['fIoAsw']['length'];}return _0x187626(this['fIoAsw'][0x0]);},new _0x75d388(_0x4109)['JPhBHQ'](),_0x3b2572=_0x4109['aBHyph'](_0x3b2572),_0xe8b169[_0x5af297]=_0x3b2572;}else _0x3b2572=_0x37f04c;return _0x3b2572;},_0x4109(_0xe8b169,_0x4e9de2);}import{aggregateTemporalNotes}from'./temporal.mjs';import{aggregateMultiScale}from'./temporal-decision.mjs';import{pruneTemporalNotes,selectTopWeightedNotes}from'./temporal-note-pruner.mjs';import{log,warn}from'./logger.mjs';class ActivityDetector{[_0x2a498c(0x23a)+_0x2a498c(0x256)+_0x2a498c(0x1d8)+'evel'](_0x48c586,_0x3df9f3=0x1388){const _0x52fd9c=_0x2a498c;if(_0x48c586[_0x52fd9c(0x1ce)+'h']===0x0)return _0x52fd9c(0x1f0);const _0x5da27d=Date['now'](),_0x1cde8a=_0x48c586['filte'+'r'](_0x2c2cf1=>{const _0x1e490c=_0x52fd9c,_0x70f56e=_0x2c2cf1[_0x1e490c(0x208)+_0x1e490c(0x1d5)]||_0x2c2cf1['elaps'+'ed']||0x0,_0x21ead4=typeof _0x70f56e===_0x1e490c(0x238)+'r'?_0x70f56e:_0x5da27d;return _0x5da27d-_0x21ead4<_0x3df9f3;});if(_0x1cde8a['lengt'+'h']===0x0)return'low';const _0x40f2cc=_0x1cde8a[0x0],_0x372279=_0x1cde8a[_0x1cde8a[_0x52fd9c(0x1ce)+'h']-0x1],_0x298be5=_0x40f2cc['times'+_0x52fd9c(0x1d5)]||_0x40f2cc['elaps'+'ed']||_0x5da27d,_0x87c928=_0x372279['times'+_0x52fd9c(0x1d5)]||_0x372279['elaps'+'ed']||_0x5da27d,_0x40e651=Math['max'](0x64,_0x87c928-_0x298be5),_0x5c9a00=_0x1cde8a[_0x52fd9c(0x1ce)+'h']/(_0x40e651/0x3e8);if(_0x5c9a00>0xa)return _0x52fd9c(0x247);if(_0x5c9a00>0x1)return _0x52fd9c(0x22c)+'m';return _0x52fd9c(0x1f0);}[_0x2a498c(0x205)+_0x2a498c(0x20d)+'eract'+'ion'](_0x29faa7,_0x5f0f88=0x7d0){const _0xf94e6f=_0x2a498c;if(_0x29faa7['lengt'+'h']===0x0)return![];const _0x4f89e4=Date[_0xf94e6f(0x232)](),_0x56ca02=_0x29faa7[_0xf94e6f(0x21f)](-0x5)['filte'+'r'](_0x25deeb=>{const _0x440991=_0xf94e6f,_0x1e3893=_0x25deeb[_0x440991(0x208)+_0x440991(0x1d5)]||_0x25deeb['elaps'+'ed']||0x0,_0x4accbb=typeof _0x1e3893==='numbe'+'r'?_0x1e3893:_0x4f89e4;return _0x4f89e4-_0x4accbb<_0x5f0f88;});return _0x56ca02[_0xf94e6f(0x1fe)](_0x30dad2=>_0x30dad2[_0xf94e6f(0x22b)]?.[_0xf94e6f(0x1ef)+_0xf94e6f(0x221)]('inter'+_0xf94e6f(0x255)+'n')||_0x30dad2['step']?.[_0xf94e6f(0x1ef)+_0xf94e6f(0x221)]('click')||_0x30dad2[_0xf94e6f(0x22b)]?.['inclu'+'des']('actio'+'n')||_0x30dad2['obser'+'vatio'+'n']?.[_0xf94e6f(0x1ef)+_0xf94e6f(0x221)]('user')||_0x30dad2[_0xf94e6f(0x1d9)+'vatio'+'n']?.[_0xf94e6f(0x1ef)+_0xf94e6f(0x221)]('click'+'ed')||_0x30dad2[_0xf94e6f(0x1d9)+'vatio'+'n']?.[_0xf94e6f(0x1ef)+_0xf94e6f(0x221)](_0xf94e6f(0x250)+'actio'+'n'));}[_0x2a498c(0x1e3)+_0x2a498c(0x20a)+_0x2a498c(0x1d0)](_0x1f0002,_0x113d7d=0x7d0){const _0x127933=_0x2a498c;if(_0x1f0002['lengt'+'h']<0x3)return!![];const _0x5ecdbc=Date[_0x127933(0x232)](),_0x439095=_0x1f0002[_0x127933(0x21f)](-0x5)[_0x127933(0x251)+'r'](_0x134136=>{const _0x387aba=_0x127933,_0x11ba25=_0x134136['times'+'tamp']||_0x134136[_0x387aba(0x233)+'ed']||0x0,_0x53c4b8=typeof _0x11ba25===_0x387aba(0x238)+'r'?_0x11ba25:_0x5ecdbc;return _0x5ecdbc-_0x53c4b8<_0x113d7d;});if(_0x439095['lengt'+'h']<0x3)return!![];const _0x400ab5=_0x439095['map'](_0x162613=>{const _0x2a3213=_0x127933;if(_0x162613['score']!==undefined)return _0x162613['score'];if(_0x162613['gameS'+_0x2a3213(0x252)]?.['score']!==undefined)return _0x162613['gameS'+'tate']['score'];return 0x0;}),_0x23253a=_0x400ab5[_0x127933(0x1de)+'e']((_0x50fbd3,_0x20bb71)=>_0x50fbd3+_0x20bb71,0x0)/_0x400ab5[_0x127933(0x1ce)+'h'],_0x99aedc=_0x400ab5['reduc'+'e']((_0x23c121,_0x13d3e7)=>_0x23c121+Math[_0x127933(0x224)](_0x13d3e7-_0x23253a,0x2),0x0)/_0x400ab5['lengt'+'h'],_0x1d5764=Math[_0x127933(0x1f4)](_0x99aedc);return _0x1d5764<0.5;}}export class TemporalPreprocessingManager{constructor(_0x204901={}){const _0x185086=_0x2a498c;this['activ'+'ityDe'+_0x185086(0x22e)+'r']=new ActivityDetector();const _0x310532={};_0x310532[_0x185086(0x239)+_0x185086(0x202)]=null,_0x310532['multi'+'Scale']=null,_0x310532[_0x185086(0x1fd)+'ence']=null,_0x310532['prune'+_0x185086(0x216)+'s']=null,_0x310532['patte'+'rns']=null,_0x310532['lastP'+_0x185086(0x24b)+_0x185086(0x222)+_0x185086(0x1f9)]=0x0,_0x310532[_0x185086(0x1e7)+'ount']=0x0,this[_0x185086(0x1d6)+'ocess'+_0x185086(0x1f8)+'he']=_0x310532,this[_0x185086(0x1d6)+'ocess'+'Inter'+'val']=_0x204901[_0x185086(0x1d6)+_0x185086(0x21d)+_0x185086(0x200)+'val']||0x7d0,this['cache'+_0x185086(0x1fb)+'e']=_0x204901[_0x185086(0x1ec)+_0x185086(0x1fb)+'e']||0x1388,this['prepr'+_0x185086(0x21d)+_0x185086(0x201)+_0x185086(0x24e)+_0x185086(0x204)]=![],this[_0x185086(0x1d6)+_0x185086(0x21d)+'Queue']=[];}async['getFa'+_0x2a498c(0x220)+'regat'+_0x2a498c(0x254)](_0x131d60,_0xdf51c8={}){const _0x3fe972=_0x2a498c,_0x50b47b=this['activ'+_0x3fe972(0x1d4)+'tecto'+'r'][_0x3fe972(0x23a)+_0x3fe972(0x256)+_0x3fe972(0x1d8)+_0x3fe972(0x24f)](_0x131d60);if(_0x50b47b==='high'&&this[_0x3fe972(0x1ee)+_0x3fe972(0x25a)+'id'](_0x131d60))return log(_0x3fe972(0x219)+_0x3fe972(0x245)+'sor]\x20'+_0x3fe972(0x21b)+_0x3fe972(0x1f6)+'ed\x20ag'+_0x3fe972(0x236)+'tion\x20'+'(high'+_0x3fe972(0x258)+'vity)'),this['prepr'+_0x3fe972(0x21d)+'edCac'+'he']['aggre'+_0x3fe972(0x202)];return await aggregateTemporalNotes(_0x131d60,_0xdf51c8);}async[_0x2a498c(0x1d6)+'ocess'+_0x2a498c(0x1e5)+_0x2a498c(0x218)+'nd'](_0x2b5eb2,_0x2fe07d={}){const _0x5013ae=_0x2a498c;if(this['prepr'+_0x5013ae(0x21d)+_0x5013ae(0x201)+'Progr'+_0x5013ae(0x204)])return;const _0x4f940b=this['activ'+'ityDe'+'tecto'+'r']['detec'+_0x5013ae(0x256)+_0x5013ae(0x1d8)+_0x5013ae(0x24f)](_0x2b5eb2),_0xa1b108=this['activ'+_0x5013ae(0x1d4)+_0x5013ae(0x22e)+'r']['hasUs'+_0x5013ae(0x20d)+'eract'+_0x5013ae(0x254)](_0x2b5eb2),_0x587038=this['activ'+_0x5013ae(0x1d4)+_0x5013ae(0x22e)+'r'][_0x5013ae(0x1e3)+'bleSt'+'ate'](_0x2b5eb2);if(_0x4f940b===_0x5013ae(0x247)||_0xa1b108&&!_0x587038)return;this[_0x5013ae(0x1d6)+'ocess'+_0x5013ae(0x201)+'Progr'+'ess']=!![];try{const _0x1b2931={};_0x1b2931['windo'+_0x5013ae(0x1d7)]=_0x2fe07d['windo'+'wSize']||0x2710,_0x1b2931['decay'+_0x5013ae(0x1fc)+'r']=_0x2fe07d[_0x5013ae(0x234)+'Facto'+'r']||0.9;const _0x31d6ca=await aggregateTemporalNotes(_0x2b5eb2,_0x1b2931),_0x3c6c10={};_0x3c6c10['atten'+'tionW'+_0x5013ae(0x22f)+'s']=!![];const _0x45986b=aggregateMultiScale(_0x2b5eb2,_0x3c6c10),_0x35b543={};_0x35b543['maxNo'+_0x5013ae(0x244)]=_0x2fe07d['maxNo'+'tes']||0x14,_0x35b543[_0x5013ae(0x24d)+'ight']=_0x2fe07d[_0x5013ae(0x24d)+_0x5013ae(0x1dd)]||0.1;const _0x308713=pruneTemporalNotes(_0x2b5eb2,_0x35b543),_0x3e7a81={};_0x3e7a81['maxNo'+_0x5013ae(0x244)]=_0x2fe07d['maxNo'+'tes']||0x14;const _0x117d9d=selectTopWeightedNotes(_0x2b5eb2,_0x3e7a81),_0x3cd43d=this['_iden'+_0x5013ae(0x228)+_0x5013ae(0x237)+'ns'](_0x2b5eb2);this['prepr'+'ocess'+_0x5013ae(0x1f8)+'he']={'aggregated':_0x31d6ca,'multiScale':_0x45986b,'coherence':_0x31d6ca['coher'+'ence']||0x0,'prunedNotes':_0x308713,'topWeighted':_0x117d9d,'patterns':_0x3cd43d,'lastPreprocessTime':Date['now'](),'noteCount':_0x2b5eb2[_0x5013ae(0x1ce)+'h']},log(_0x5013ae(0x219)+_0x5013ae(0x245)+_0x5013ae(0x1db)+_0x5013ae(0x1f1)+_0x5013ae(0x249)+'\x20prep'+'roces'+_0x5013ae(0x21a)+_0x5013ae(0x243)+_0x5013ae(0x1e4)+_0x2b5eb2[_0x5013ae(0x1ce)+'h']+('\x20note'+_0x5013ae(0x21e)+_0x5013ae(0x207)+_0x5013ae(0x1e2))+_0x4f940b+')');}catch(_0x22c405){warn(_0x5013ae(0x219)+_0x5013ae(0x245)+_0x5013ae(0x1db)+_0x5013ae(0x1f1)+_0x5013ae(0x249)+'\x20prep'+_0x5013ae(0x245)+'sing\x20'+_0x5013ae(0x23b)+'d:\x20'+_0x22c405['messa'+'ge']);}finally{this[_0x5013ae(0x1d6)+_0x5013ae(0x21d)+'ingIn'+'Progr'+'ess']=![];}}['isCac'+'heVal'+'id'](_0x637f28){const _0x2db180=_0x2a498c;if(!this[_0x2db180(0x1d6)+'ocess'+_0x2db180(0x1f8)+'he']['aggre'+'gated'])return![];const _0x5713a0=Date[_0x2db180(0x232)]()-this[_0x2db180(0x1d6)+'ocess'+_0x2db180(0x1f8)+'he']['lastP'+'repro'+'cessT'+'ime'];if(_0x5713a0>this['cache'+'MaxAg'+'e'])return![];const _0x21ef50=Math['abs'](_0x637f28['lengt'+'h']-this[_0x2db180(0x1d6)+_0x2db180(0x21d)+_0x2db180(0x1f8)+'he']['noteC'+_0x2db180(0x1f5)]);if(_0x21ef50>_0x637f28['lengt'+'h']*0.2)return![];return!![];}[_0x2a498c(0x253)+'tifyP'+_0x2a498c(0x237)+'ns'](_0x5c70d7){const _0x353ab1=_0x2a498c;if(_0x5c70d7[_0x353ab1(0x1ce)+'h']<0x3){const _0xcd7993={};return _0xcd7993[_0x353ab1(0x1cf)+'s']=[],_0xcd7993['confl'+'icts']=[],_0xcd7993;}const _0x3cee91=[],_0x11cfde=[],_0x53b152=_0x5c70d7['map'](_0x340cb9=>_0x340cb9['score']||_0x340cb9[_0x353ab1(0x1ed)+_0x353ab1(0x252)]?.[_0x353ab1(0x1ff)]||0x0);if(_0x53b152[_0x353ab1(0x1ce)+'h']>=0x3){const _0x835687=_0x53b152[0x0],_0x4b5db1=_0x53b152[_0x53b152[_0x353ab1(0x1ce)+'h']-0x1];if(_0x4b5db1>_0x835687*1.1){const _0x373c77={};_0x373c77['type']=_0x353ab1(0x21c)+_0x353ab1(0x1e9),_0x373c77[_0x353ab1(0x217)+'c']='score',_0x373c77['magni'+_0x353ab1(0x20b)]=(_0x4b5db1-_0x835687)/_0x835687,_0x3cee91[_0x353ab1(0x25b)](_0x373c77);}else{if(_0x4b5db1<_0x835687*0.9){const _0x5a2d80={};_0x5a2d80[_0x353ab1(0x23d)]=_0x353ab1(0x211)+_0x353ab1(0x1e9),_0x5a2d80[_0x353ab1(0x217)+'c']=_0x353ab1(0x1ff),_0x5a2d80[_0x353ab1(0x214)+_0x353ab1(0x20b)]=(_0x835687-_0x4b5db1)/_0x835687,_0x3cee91['push'](_0x5a2d80);}}}const _0x567713=_0x5c70d7[_0x353ab1(0x1da)](_0xb0fdcf=>_0xb0fdcf[_0x353ab1(0x1d9)+_0x353ab1(0x1d3)+'n']||'')['filte'+'r'](_0xb103c1=>_0xb103c1[_0x353ab1(0x1ce)+'h']>0x0);if(_0x567713['lengt'+'h']>=0x2){const _0x2dcb4d=_0x567713['some'](_0x51c11f=>/good|great|excellent|improved|better/i['test'](_0x51c11f)),_0x338e3e=_0x567713['some'](_0x5c8603=>/bad|poor|worse|declined|problem/i[_0x353ab1(0x22a)](_0x5c8603));if(_0x2dcb4d&&_0x338e3e){const _0x39295c={};_0x39295c['type']='contr'+'adict'+'ory_o'+_0x353ab1(0x231)+_0x353ab1(0x1f7)+'s',_0x39295c['count']=_0x567713[_0x353ab1(0x1ce)+'h'],_0x11cfde['push'](_0x39295c);}}const _0x15979c={};return _0x15979c['trend'+'s']=_0x3cee91,_0x15979c[_0x353ab1(0x259)+_0x353ab1(0x212)]=_0x11cfde,_0x15979c;}[_0x2a498c(0x210)+_0x2a498c(0x246)+'tiSca'+'le'](_0x5e609f){const _0x160424=_0x2a498c;if(this['isCac'+_0x160424(0x25a)+'id'](_0x5e609f)&&this[_0x160424(0x1d6)+_0x160424(0x21d)+'edCac'+'he'][_0x160424(0x235)+_0x160424(0x1df)])return this['prepr'+'ocess'+'edCac'+'he'][_0x160424(0x235)+'Scale'];const _0x32ccb5={};return _0x32ccb5['atten'+'tionW'+'eight'+'s']=!![],aggregateMultiScale(_0x5e609f,_0x32ccb5);}['getFa'+'stPru'+'nedNo'+'tes'](_0x468c96,_0x41d2b3={}){const _0x568fe9=_0x2a498c;if(this[_0x568fe9(0x1ee)+_0x568fe9(0x25a)+'id'](_0x468c96)&&this[_0x568fe9(0x1d6)+'ocess'+_0x568fe9(0x1f8)+'he'][_0x568fe9(0x213)+'dNote'+'s'])return this['prepr'+_0x568fe9(0x21d)+'edCac'+'he']['prune'+_0x568fe9(0x216)+'s'];return pruneTemporalNotes(_0x468c96,_0x41d2b3);}[_0x2a498c(0x223)+'cheSt'+_0x2a498c(0x1f3)](){const _0x6a83c2=_0x2a498c;return{'hasCache':!!this['prepr'+_0x6a83c2(0x21d)+_0x6a83c2(0x1f8)+'he'][_0x6a83c2(0x239)+_0x6a83c2(0x202)],'cacheAge':this[_0x6a83c2(0x1d6)+'ocess'+'edCac'+'he'][_0x6a83c2(0x239)+_0x6a83c2(0x202)]?Date['now']()-this['prepr'+'ocess'+_0x6a83c2(0x1f8)+'he'][_0x6a83c2(0x203)+'repro'+_0x6a83c2(0x222)+_0x6a83c2(0x1f9)]:null,'noteCount':this['prepr'+'ocess'+'edCac'+'he'][_0x6a83c2(0x1e7)+'ount'],'coherence':this[_0x6a83c2(0x1d6)+'ocess'+'edCac'+'he']['coher'+_0x6a83c2(0x229)],'preprocessingInProgress':this[_0x6a83c2(0x1d6)+'ocess'+_0x6a83c2(0x201)+'Progr'+_0x6a83c2(0x204)]};}['clear'+_0x2a498c(0x206)](){const _0x10cef6=_0x2a498c,_0x2c0a92={};_0x2c0a92[_0x10cef6(0x239)+_0x10cef6(0x202)]=null,_0x2c0a92[_0x10cef6(0x235)+'Scale']=null,_0x2c0a92['coher'+'ence']=null,_0x2c0a92['prune'+'dNote'+'s']=null,_0x2c0a92['patte'+_0x10cef6(0x1fa)]=null,_0x2c0a92[_0x10cef6(0x203)+'repro'+'cessT'+_0x10cef6(0x1f9)]=0x0,_0x2c0a92[_0x10cef6(0x1e7)+_0x10cef6(0x1f5)]=0x0,this['prepr'+'ocess'+'edCac'+'he']=_0x2c0a92;}}export class AdaptiveTemporalProcessor{constructor(_0x4b4a1e={}){const _0x2b89fc=_0x2a498c;this['prepr'+'ocess'+'or']=new TemporalPreprocessingManager(_0x4b4a1e),this['activ'+_0x2b89fc(0x1d4)+_0x2b89fc(0x22e)+'r']=new ActivityDetector();}async['proce'+_0x2a498c(0x22d)+'es'](_0xee0f0f,_0x504cea={}){const _0x5c284f=_0x2a498c,_0x563cb2=this['activ'+'ityDe'+'tecto'+'r'][_0x5c284f(0x23a)+_0x5c284f(0x256)+'vityL'+'evel'](_0xee0f0f),_0xde988=this['activ'+_0x5c284f(0x1d4)+_0x5c284f(0x22e)+'r']['hasUs'+'erInt'+'eract'+_0x5c284f(0x254)](_0xee0f0f),_0x44232a=this[_0x5c284f(0x226)+'ityDe'+'tecto'+'r']['isSta'+'bleSt'+_0x5c284f(0x1d0)](_0xee0f0f);if(_0x563cb2===_0x5c284f(0x247)&&_0xde988){const _0x20a23c=await this[_0x5c284f(0x1d6)+'ocess'+'or'][_0x5c284f(0x210)+'stAgg'+'regat'+_0x5c284f(0x254)](_0xee0f0f,_0x504cea);return{'aggregated':_0x20a23c,'multiScale':this[_0x5c284f(0x1d6)+_0x5c284f(0x21d)+'or'][_0x5c284f(0x210)+'stMul'+'tiSca'+'le'](_0xee0f0f),'prunedNotes':this[_0x5c284f(0x1d6)+_0x5c284f(0x21d)+'or'][_0x5c284f(0x210)+_0x5c284f(0x257)+_0x5c284f(0x1e6)+_0x5c284f(0x244)](_0xee0f0f,_0x504cea),'source':_0x5c284f(0x1ec),'latency':'<10ms','activity':_0x563cb2,'metadata':{'noteCount':_0xee0f0f['lengt'+'h'],'cacheAge':this[_0x5c284f(0x1d6)+_0x5c284f(0x21d)+'or']['prepr'+_0x5c284f(0x21d)+'edCac'+'he'][_0x5c284f(0x203)+_0x5c284f(0x24b)+_0x5c284f(0x222)+'ime']?Date['now']()-this['prepr'+_0x5c284f(0x21d)+'or']['prepr'+_0x5c284f(0x21d)+_0x5c284f(0x1f8)+'he']['lastP'+_0x5c284f(0x24b)+_0x5c284f(0x222)+'ime']:null}};}if(_0x563cb2==='low'&&_0x44232a){await this[_0x5c284f(0x1d6)+'ocess'+'or']['prepr'+_0x5c284f(0x21d)+'InBac'+_0x5c284f(0x218)+'nd'](_0xee0f0f,_0x504cea);const _0x1658da={};_0x1658da[_0x5c284f(0x1e7)+_0x5c284f(0x1f5)]=_0xee0f0f['lengt'+'h'],_0x1658da['cache'+'Age']=0x0;const _0x41601f={};return _0x41601f['aggre'+'gated']=this['prepr'+_0x5c284f(0x21d)+'or']['prepr'+_0x5c284f(0x21d)+'edCac'+'he']['aggre'+'gated'],_0x41601f['multi'+'Scale']=this[_0x5c284f(0x1d6)+_0x5c284f(0x21d)+'or'][_0x5c284f(0x1d6)+'ocess'+'edCac'+'he'][_0x5c284f(0x235)+'Scale'],_0x41601f[_0x5c284f(0x213)+_0x5c284f(0x216)+'s']=this[_0x5c284f(0x1d6)+_0x5c284f(0x21d)+'or'][_0x5c284f(0x1d6)+'ocess'+_0x5c284f(0x1f8)+'he'][_0x5c284f(0x213)+'dNote'+'s'],_0x41601f[_0x5c284f(0x1f2)+'rns']=this['prepr'+'ocess'+'or']['prepr'+_0x5c284f(0x21d)+_0x5c284f(0x1f8)+'he'][_0x5c284f(0x1f2)+'rns'],_0x41601f[_0x5c284f(0x20c)+'e']='prepr'+_0x5c284f(0x21d)+'ed',_0x41601f[_0x5c284f(0x23f)+'cy']='100-1'+_0x5c284f(0x225)+'\x20(bac'+_0x5c284f(0x218)+'nd)',_0x41601f[_0x5c284f(0x226)+'ity']=_0x563cb2,_0x41601f['metad'+'ata']=_0x1658da,_0x41601f;}if(this['prepr'+_0x5c284f(0x21d)+'or']['isCac'+_0x5c284f(0x25a)+'id'](_0xee0f0f))return{'aggregated':await this['prepr'+_0x5c284f(0x21d)+'or'][_0x5c284f(0x210)+_0x5c284f(0x220)+'regat'+'ion'](_0xee0f0f,_0x504cea),'multiScale':this['prepr'+'ocess'+'or']['getFa'+'stMul'+'tiSca'+'le'](_0xee0f0f),'prunedNotes':this[_0x5c284f(0x1d6)+_0x5c284f(0x21d)+'or'][_0x5c284f(0x210)+'stPru'+'nedNo'+_0x5c284f(0x244)](_0xee0f0f,_0x504cea),'source':_0x5c284f(0x1ec),'latency':'<10ms','activity':_0x563cb2,'metadata':{'noteCount':_0xee0f0f['lengt'+'h'],'cacheAge':Date[_0x5c284f(0x232)]()-this['prepr'+'ocess'+'or']['prepr'+'ocess'+'edCac'+'he']['lastP'+_0x5c284f(0x24b)+'cessT'+'ime']}};else{const _0x478512={};_0x478512[_0x5c284f(0x24a)+_0x5c284f(0x1d7)]=_0x504cea['windo'+_0x5c284f(0x1d7)]||0x2710,_0x478512['decay'+_0x5c284f(0x1fc)+'r']=_0x504cea[_0x5c284f(0x234)+_0x5c284f(0x1fc)+'r']||0.9;const _0x57ba02=await aggregateTemporalNotes(_0xee0f0f,_0x478512),_0x4b4035={};_0x4b4035[_0x5c284f(0x227)+'tionW'+'eight'+'s']=!![];const _0x2e5fdd={};return _0x2e5fdd[_0x5c284f(0x1e8)+_0x5c284f(0x244)]=_0x504cea[_0x5c284f(0x1e8)+'tes']||0x14,{'aggregated':_0x57ba02,'multiScale':aggregateMultiScale(_0xee0f0f,_0x4b4035),'prunedNotes':pruneTemporalNotes(_0xee0f0f,_0x2e5fdd),'source':'compu'+'ted','latency':'50-20'+_0x5c284f(0x241),'activity':_0x563cb2,'metadata':{'noteCount':_0xee0f0f[_0x5c284f(0x1ce)+'h'],'cacheAge':null}};}}}export function createTemporalPreprocessingManager(_0x3a4747={}){return new TemporalPreprocessingManager(_0x3a4747);}export function createAdaptiveTemporalProcessor(_0x4194ce={}){return new AdaptiveTemporalProcessor(_0x4194ce);}
|
|
1
|
+
const _0x1d9337=_0x21f6;(function(_0x4a342c,_0x32e349){const _0x45ef8e=_0x21f6,_0x46d977=_0x4a342c();while(!![]){try{const _0x39c51b=-parseInt(_0x45ef8e(0x1bb))/0x1*(-parseInt(_0x45ef8e(0x15f))/0x2)+-parseInt(_0x45ef8e(0x19e))/0x3+parseInt(_0x45ef8e(0x14e))/0x4*(parseInt(_0x45ef8e(0x162))/0x5)+-parseInt(_0x45ef8e(0x14f))/0x6*(parseInt(_0x45ef8e(0x13b))/0x7)+-parseInt(_0x45ef8e(0x17e))/0x8+parseInt(_0x45ef8e(0x181))/0x9+parseInt(_0x45ef8e(0x19c))/0xa;if(_0x39c51b===_0x32e349)break;else _0x46d977['push'](_0x46d977['shift']());}catch(_0x3e8fd9){_0x46d977['push'](_0x46d977['shift']());}}}(_0xad42,0x80960));const _0xdc0245=(function(){let _0x9544eb=!![];return function(_0x5e1100,_0x34b1ec){const _0x1353c7=_0x9544eb?function(){if(_0x34b1ec){const _0x4cf58e=_0x34b1ec['apply'](_0x5e1100,arguments);return _0x34b1ec=null,_0x4cf58e;}}:function(){};return _0x9544eb=![],_0x1353c7;};}()),_0x5629a2=_0xdc0245(this,function(){const _0x56d511=_0x21f6;return _0x5629a2[_0x56d511(0x184)+_0x56d511(0x16b)]()[_0x56d511(0x198)+'h']('(((.+'+')+)+)'+'+$')[_0x56d511(0x184)+'ing']()[_0x56d511(0x151)+_0x56d511(0x191)+'r'](_0x5629a2)['searc'+'h'](_0x56d511(0x186)+')+)+)'+'+$');});function _0x21f6(_0xe6a0a0,_0x25a60a){const _0x1d950d=_0xad42();return _0x21f6=function(_0x5629a2,_0xdc0245){_0x5629a2=_0x5629a2-0x133;let _0xad4285=_0x1d950d[_0x5629a2];if(_0x21f6['oXigam']===undefined){var _0x21f6f2=function(_0x321689){const _0x641f48='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4a1a9d='',_0x566f99='',_0x2eaf59=_0x4a1a9d+_0x21f6f2;for(let _0x1b5454=0x0,_0x182935,_0x4da7bd,_0x258d91=0x0;_0x4da7bd=_0x321689['charAt'](_0x258d91++);~_0x4da7bd&&(_0x182935=_0x1b5454%0x4?_0x182935*0x40+_0x4da7bd:_0x4da7bd,_0x1b5454++%0x4)?_0x4a1a9d+=_0x2eaf59['charCodeAt'](_0x258d91+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x182935>>(-0x2*_0x1b5454&0x6)):_0x1b5454:0x0){_0x4da7bd=_0x641f48['indexOf'](_0x4da7bd);}for(let _0x5e5d66=0x0,_0x4c5931=_0x4a1a9d['length'];_0x5e5d66<_0x4c5931;_0x5e5d66++){_0x566f99+='%'+('00'+_0x4a1a9d['charCodeAt'](_0x5e5d66)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x566f99);};_0x21f6['yofgaV']=_0x21f6f2,_0xe6a0a0=arguments,_0x21f6['oXigam']=!![];}const _0x23d4ba=_0x1d950d[0x0],_0x5eb8a0=_0x5629a2+_0x23d4ba,_0x7207c6=_0xe6a0a0[_0x5eb8a0];if(!_0x7207c6){const _0x1c5448=function(_0x445547){this['ySrjoa']=_0x445547,this['IERUDA']=[0x1,0x0,0x0],this['bWwICe']=function(){return'newState';},this['Fxqoeu']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['cynEeD']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1c5448['prototype']['VaemyB']=function(){const _0x12ad39=new RegExp(this['Fxqoeu']+this['cynEeD']),_0x1db891=_0x12ad39['test'](this['bWwICe']['toString']())?--this['IERUDA'][0x1]:--this['IERUDA'][0x0];return this['WPdPCy'](_0x1db891);},_0x1c5448['prototype']['WPdPCy']=function(_0x96be3e){if(!Boolean(~_0x96be3e))return _0x96be3e;return this['ePVemc'](this['ySrjoa']);},_0x1c5448['prototype']['ePVemc']=function(_0x1ee919){for(let _0x259e4e=0x0,_0x4a0321=this['IERUDA']['length'];_0x259e4e<_0x4a0321;_0x259e4e++){this['IERUDA']['push'](Math['round'](Math['random']())),_0x4a0321=this['IERUDA']['length'];}return _0x1ee919(this['IERUDA'][0x0]);},new _0x1c5448(_0x21f6)['VaemyB'](),_0xad4285=_0x21f6['yofgaV'](_0xad4285),_0xe6a0a0[_0x5eb8a0]=_0xad4285;}else _0xad4285=_0x7207c6;return _0xad4285;},_0x21f6(_0xe6a0a0,_0x25a60a);}_0x5629a2();import{aggregateTemporalNotes}from'./temporal.mjs';import{aggregateMultiScale}from'./temporal-decision.mjs';import{pruneTemporalNotes,selectTopWeightedNotes}from'./temporal-note-pruner.mjs';import{log,warn}from'./logger.mjs';class ActivityDetector{['detec'+'tActi'+'vityL'+_0x1d9337(0x185)](_0x51c877,_0x4c04c4=0x1388){const _0x3d3d82=_0x1d9337;if(_0x51c877[_0x3d3d82(0x17b)+'h']===0x0)return _0x3d3d82(0x17d);const _0x46ec12=Date[_0x3d3d82(0x14a)](),_0xfaa356=_0x51c877[_0x3d3d82(0x139)+'r'](_0x42e108=>{const _0x4da252=_0x3d3d82,_0x50f5c7=_0x42e108['times'+'tamp']||_0x42e108[_0x4da252(0x1bf)+'ed']||0x0,_0x4a6f86=typeof _0x50f5c7===_0x4da252(0x13a)+'r'?_0x50f5c7:_0x46ec12;return _0x46ec12-_0x4a6f86<_0x4c04c4;});if(_0xfaa356['lengt'+'h']===0x0)return'low';const _0x12f0b7=_0xfaa356[0x0],_0x18b5ed=_0xfaa356[_0xfaa356['lengt'+'h']-0x1],_0x53cb57=_0x12f0b7[_0x3d3d82(0x15d)+'tamp']||_0x12f0b7[_0x3d3d82(0x1bf)+'ed']||_0x46ec12,_0x4508eb=_0x18b5ed[_0x3d3d82(0x15d)+_0x3d3d82(0x15c)]||_0x18b5ed['elaps'+'ed']||_0x46ec12,_0x137283=Math[_0x3d3d82(0x1af)](0x64,_0x4508eb-_0x53cb57),_0x5ce8e1=_0xfaa356[_0x3d3d82(0x17b)+'h']/(_0x137283/0x3e8);if(_0x5ce8e1>0xa)return'high';if(_0x5ce8e1>0x1)return'mediu'+'m';return _0x3d3d82(0x17d);}[_0x1d9337(0x13d)+_0x1d9337(0x159)+'eract'+'ion'](_0x31f10e,_0x173c58=0x7d0){const _0xb3614f=_0x1d9337;if(_0x31f10e['lengt'+'h']===0x0)return![];const _0x449669=Date[_0xb3614f(0x14a)](),_0x519c40=_0x31f10e[_0xb3614f(0x16e)](-0x5)['filte'+'r'](_0x2626ba=>{const _0x450b2e=_0xb3614f,_0x2bab20=_0x2626ba[_0x450b2e(0x15d)+_0x450b2e(0x15c)]||_0x2626ba['elaps'+'ed']||0x0,_0x1085b2=typeof _0x2bab20==='numbe'+'r'?_0x2bab20:_0x449669;return _0x449669-_0x1085b2<_0x173c58;});return _0x519c40[_0xb3614f(0x19d)](_0x4cd855=>_0x4cd855[_0xb3614f(0x1b0)]?.[_0xb3614f(0x1b3)+'des']('inter'+'actio'+'n')||_0x4cd855[_0xb3614f(0x1b0)]?.[_0xb3614f(0x1b3)+_0xb3614f(0x144)]('click')||_0x4cd855['step']?.['inclu'+_0xb3614f(0x144)]('actio'+'n')||_0x4cd855['obser'+'vatio'+'n']?.[_0xb3614f(0x1b3)+_0xb3614f(0x144)]('user')||_0x4cd855['obser'+'vatio'+'n']?.[_0xb3614f(0x1b3)+_0xb3614f(0x144)](_0xb3614f(0x171)+'ed')||_0x4cd855['obser'+_0xb3614f(0x17c)+'n']?.['inclu'+_0xb3614f(0x144)](_0xb3614f(0x1a6)+_0xb3614f(0x163)+'n'));}[_0x1d9337(0x179)+'bleSt'+'ate'](_0x466585,_0x4cf6cf=0x7d0){const _0xb9685d=_0x1d9337;if(_0x466585[_0xb9685d(0x17b)+'h']<0x3)return!![];const _0x16f5e1=Date['now'](),_0x28c5ec=_0x466585[_0xb9685d(0x16e)](-0x5)['filte'+'r'](_0x4e99f9=>{const _0x304bce=_0xb9685d,_0x5efde7=_0x4e99f9['times'+_0x304bce(0x15c)]||_0x4e99f9['elaps'+'ed']||0x0,_0x5a9485=typeof _0x5efde7==='numbe'+'r'?_0x5efde7:_0x16f5e1;return _0x16f5e1-_0x5a9485<_0x4cf6cf;});if(_0x28c5ec[_0xb9685d(0x17b)+'h']<0x3)return!![];const _0x32cc5f=_0x28c5ec[_0xb9685d(0x156)](_0xd2d02=>{const _0x38a310=_0xb9685d;if(_0xd2d02['score']!==undefined)return _0xd2d02[_0x38a310(0x16c)];if(_0xd2d02[_0x38a310(0x1b4)+_0x38a310(0x1be)]?.[_0x38a310(0x16c)]!==undefined)return _0xd2d02[_0x38a310(0x1b4)+'tate']['score'];return 0x0;}),_0x585617=_0x32cc5f[_0xb9685d(0x154)+'e']((_0x350c4c,_0x1ba908)=>_0x350c4c+_0x1ba908,0x0)/_0x32cc5f[_0xb9685d(0x17b)+'h'],_0x383603=_0x32cc5f['reduc'+'e']((_0x431bf8,_0x3d8d12)=>_0x431bf8+Math[_0xb9685d(0x1a2)](_0x3d8d12-_0x585617,0x2),0x0)/_0x32cc5f[_0xb9685d(0x17b)+'h'],_0x5253c4=Math[_0xb9685d(0x164)](_0x383603);return _0x5253c4<0.5;}}export class TemporalPreprocessingManager{constructor(_0xba6a24={}){const _0x29e42a=_0x1d9337;this[_0x29e42a(0x136)+'ityDe'+_0x29e42a(0x17f)+'r']=new ActivityDetector();const _0xfbb606={};_0xfbb606['aggre'+'gated']=null,_0xfbb606['multi'+'Scale']=null,_0xfbb606[_0x29e42a(0x192)+_0x29e42a(0x17a)]=null,_0xfbb606['prune'+_0x29e42a(0x176)+'s']=null,_0xfbb606['patte'+'rns']=null,_0xfbb606[_0x29e42a(0x197)+_0x29e42a(0x1ad)+_0x29e42a(0x199)+_0x29e42a(0x13c)]=0x0,_0xfbb606['noteC'+_0x29e42a(0x16a)]=0x0,this['prepr'+_0x29e42a(0x135)+'edCac'+'he']=_0xfbb606,this[_0x29e42a(0x14c)+'ocess'+'Inter'+_0x29e42a(0x18d)]=_0xba6a24[_0x29e42a(0x14c)+'ocess'+_0x29e42a(0x18a)+_0x29e42a(0x18d)]||0x7d0,this[_0x29e42a(0x193)+'MaxAg'+'e']=_0xba6a24['cache'+_0x29e42a(0x1aa)+'e']||0x1388,this[_0x29e42a(0x14c)+_0x29e42a(0x135)+'ingIn'+_0x29e42a(0x152)+'ess']=![],this[_0x29e42a(0x14c)+'ocess'+'Queue']=[];}async[_0x1d9337(0x1b9)+_0x1d9337(0x190)+_0x1d9337(0x183)+'ion'](_0x407b45,_0x38a2cf={}){const _0x29d5aa=_0x1d9337,_0x1b6629=this[_0x29d5aa(0x136)+_0x29d5aa(0x1a1)+'tecto'+'r']['detec'+_0x29d5aa(0x150)+'vityL'+'evel'](_0x407b45);if(_0x1b6629==='high'&&this[_0x29d5aa(0x19f)+'heVal'+'id'](_0x407b45))return log(_0x29d5aa(0x1b7)+_0x29d5aa(0x194)+'sor]\x20'+'Using'+_0x29d5aa(0x14b)+'ed\x20ag'+_0x29d5aa(0x155)+'tion\x20'+'(high'+_0x29d5aa(0x1bc)+'vity)'),this['prepr'+_0x29d5aa(0x135)+_0x29d5aa(0x1a9)+'he'][_0x29d5aa(0x137)+'gated'];return await aggregateTemporalNotes(_0x407b45,_0x38a2cf);}async[_0x1d9337(0x14c)+'ocess'+_0x1d9337(0x195)+_0x1d9337(0x1ba)+'nd'](_0x148d42,_0x2e700f={}){const _0x4a7b6a=_0x1d9337;if(this[_0x4a7b6a(0x14c)+'ocess'+'ingIn'+'Progr'+_0x4a7b6a(0x1a0)])return;const _0x5b1152=this[_0x4a7b6a(0x136)+'ityDe'+'tecto'+'r']['detec'+_0x4a7b6a(0x150)+'vityL'+'evel'](_0x148d42),_0x1d4dc8=this[_0x4a7b6a(0x136)+'ityDe'+'tecto'+'r']['hasUs'+_0x4a7b6a(0x159)+'eract'+_0x4a7b6a(0x14d)](_0x148d42),_0x16b368=this[_0x4a7b6a(0x136)+_0x4a7b6a(0x1a1)+_0x4a7b6a(0x17f)+'r'][_0x4a7b6a(0x179)+'bleSt'+_0x4a7b6a(0x178)](_0x148d42);if(_0x5b1152==='high'||_0x1d4dc8&&!_0x16b368)return;this[_0x4a7b6a(0x14c)+_0x4a7b6a(0x135)+_0x4a7b6a(0x166)+'Progr'+'ess']=!![];try{const _0x3775cb={};_0x3775cb['windo'+'wSize']=_0x2e700f['windo'+_0x4a7b6a(0x149)]||0x2710,_0x3775cb[_0x4a7b6a(0x18f)+'Facto'+'r']=_0x2e700f[_0x4a7b6a(0x18f)+_0x4a7b6a(0x170)+'r']||0.9;const _0x10f401=await aggregateTemporalNotes(_0x148d42,_0x3775cb),_0x68b47d={};_0x68b47d['atten'+'tionW'+_0x4a7b6a(0x196)+'s']=!![];const _0x430ce4=aggregateMultiScale(_0x148d42,_0x68b47d),_0x177d55={};_0x177d55['maxNo'+'tes']=_0x2e700f[_0x4a7b6a(0x169)+'tes']||0x14,_0x177d55[_0x4a7b6a(0x16f)+_0x4a7b6a(0x187)]=_0x2e700f[_0x4a7b6a(0x16f)+'ight']||0.1;const _0x618c87=pruneTemporalNotes(_0x148d42,_0x177d55),_0x5bc785={};_0x5bc785[_0x4a7b6a(0x169)+_0x4a7b6a(0x19b)]=_0x2e700f['maxNo'+'tes']||0x14;const _0x5b9c6c=selectTopWeightedNotes(_0x148d42,_0x5bc785),_0x2a3290=this['_iden'+'tifyP'+'atter'+'ns'](_0x148d42);this['prepr'+'ocess'+'edCac'+'he']={'aggregated':_0x10f401,'multiScale':_0x430ce4,'coherence':_0x10f401[_0x4a7b6a(0x192)+'ence']||0x0,'prunedNotes':_0x618c87,'topWeighted':_0x5b9c6c,'patterns':_0x2a3290,'lastPreprocessTime':Date['now'](),'noteCount':_0x148d42[_0x4a7b6a(0x17b)+'h']},log('[Prep'+_0x4a7b6a(0x194)+_0x4a7b6a(0x1b1)+'Backg'+'round'+'\x20prep'+_0x4a7b6a(0x194)+_0x4a7b6a(0x161)+'compl'+_0x4a7b6a(0x148)+_0x148d42[_0x4a7b6a(0x17b)+'h']+('\x20note'+'s,\x20ac'+'tivit'+'y:\x20')+_0x5b1152+')');}catch(_0x2e143f){warn(_0x4a7b6a(0x1b7)+_0x4a7b6a(0x194)+_0x4a7b6a(0x1b1)+'Backg'+'round'+_0x4a7b6a(0x141)+_0x4a7b6a(0x194)+_0x4a7b6a(0x161)+'faile'+_0x4a7b6a(0x167)+_0x2e143f[_0x4a7b6a(0x1b5)+'ge']);}finally{this[_0x4a7b6a(0x14c)+_0x4a7b6a(0x135)+'ingIn'+_0x4a7b6a(0x152)+'ess']=![];}}['isCac'+'heVal'+'id'](_0x1f7ee1){const _0x51d199=_0x1d9337;if(!this[_0x51d199(0x14c)+'ocess'+'edCac'+'he'][_0x51d199(0x137)+_0x51d199(0x168)])return![];const _0x35fee1=Date['now']()-this[_0x51d199(0x14c)+_0x51d199(0x135)+'edCac'+'he']['lastP'+_0x51d199(0x1ad)+'cessT'+_0x51d199(0x13c)];if(_0x35fee1>this[_0x51d199(0x193)+_0x51d199(0x1aa)+'e'])return![];const _0x5cf8ec=Math[_0x51d199(0x172)](_0x1f7ee1['lengt'+'h']-this[_0x51d199(0x14c)+_0x51d199(0x135)+_0x51d199(0x1a9)+'he'][_0x51d199(0x1bd)+'ount']);if(_0x5cf8ec>_0x1f7ee1['lengt'+'h']*0.2)return![];return!![];}['_iden'+'tifyP'+_0x1d9337(0x140)+'ns'](_0x252b6b){const _0x27437c=_0x1d9337;if(_0x252b6b[_0x27437c(0x17b)+'h']<0x3){const _0x274c50={};return _0x274c50['trend'+'s']=[],_0x274c50[_0x27437c(0x177)+'icts']=[],_0x274c50;}const _0x4fe55f=[],_0x5164a2=[],_0x2a7dbf=_0x252b6b['map'](_0x4b339f=>_0x4b339f[_0x27437c(0x16c)]||_0x4b339f[_0x27437c(0x1b4)+'tate']?.[_0x27437c(0x16c)]||0x0);if(_0x2a7dbf['lengt'+'h']>=0x3){const _0x389671=_0x2a7dbf[0x0],_0xd18280=_0x2a7dbf[_0x2a7dbf[_0x27437c(0x17b)+'h']-0x1];if(_0xd18280>_0x389671*1.1){const _0x36caa3={};_0x36caa3[_0x27437c(0x142)]=_0x27437c(0x18e)+'asing',_0x36caa3['metri'+'c']='score',_0x36caa3['magni'+_0x27437c(0x153)]=(_0xd18280-_0x389671)/_0x389671,_0x4fe55f['push'](_0x36caa3);}else{if(_0xd18280<_0x389671*0.9){const _0x1cef23={};_0x1cef23[_0x27437c(0x142)]=_0x27437c(0x157)+_0x27437c(0x1b6),_0x1cef23[_0x27437c(0x1a8)+'c']='score',_0x1cef23[_0x27437c(0x15e)+_0x27437c(0x153)]=(_0x389671-_0xd18280)/_0x389671,_0x4fe55f[_0x27437c(0x174)](_0x1cef23);}}}const _0x40c9d3=_0x252b6b[_0x27437c(0x156)](_0x4f72df=>_0x4f72df[_0x27437c(0x146)+_0x27437c(0x17c)+'n']||'')[_0x27437c(0x139)+'r'](_0x272023=>_0x272023['lengt'+'h']>0x0);if(_0x40c9d3['lengt'+'h']>=0x2){const _0x4880c5=_0x40c9d3[_0x27437c(0x19d)](_0x186b23=>/good|great|excellent|improved|better/i['test'](_0x186b23)),_0x59a601=_0x40c9d3['some'](_0x140159=>/bad|poor|worse|declined|problem/i[_0x27437c(0x13e)](_0x140159));if(_0x4880c5&&_0x59a601){const _0x15bd75={};_0x15bd75['type']='contr'+'adict'+_0x27437c(0x18b)+'bserv'+'ation'+'s',_0x15bd75['count']=_0x40c9d3['lengt'+'h'],_0x5164a2['push'](_0x15bd75);}}const _0x38ecb4={};return _0x38ecb4[_0x27437c(0x1a4)+'s']=_0x4fe55f,_0x38ecb4['confl'+'icts']=_0x5164a2,_0x38ecb4;}['getFa'+'stMul'+'tiSca'+'le'](_0x4d6ecd){const _0x15b4b0=_0x1d9337;if(this[_0x15b4b0(0x19f)+'heVal'+'id'](_0x4d6ecd)&&this['prepr'+_0x15b4b0(0x135)+_0x15b4b0(0x1a9)+'he']['multi'+_0x15b4b0(0x147)])return this['prepr'+'ocess'+'edCac'+'he']['multi'+'Scale'];const _0x160a1e={};return _0x160a1e[_0x15b4b0(0x1b2)+'tionW'+'eight'+'s']=!![],aggregateMultiScale(_0x4d6ecd,_0x160a1e);}[_0x1d9337(0x1b9)+_0x1d9337(0x133)+_0x1d9337(0x134)+_0x1d9337(0x19b)](_0x3e9678,_0x2fd7be={}){const _0x5c3233=_0x1d9337;if(this['isCac'+_0x5c3233(0x13f)+'id'](_0x3e9678)&&this[_0x5c3233(0x14c)+'ocess'+_0x5c3233(0x1a9)+'he'][_0x5c3233(0x189)+'dNote'+'s'])return this[_0x5c3233(0x14c)+'ocess'+_0x5c3233(0x1a9)+'he'][_0x5c3233(0x189)+_0x5c3233(0x176)+'s'];return pruneTemporalNotes(_0x3e9678,_0x2fd7be);}[_0x1d9337(0x160)+_0x1d9337(0x15a)+_0x1d9337(0x175)](){const _0x53089e=_0x1d9337;return{'hasCache':!!this['prepr'+_0x53089e(0x135)+_0x53089e(0x1a9)+'he']['aggre'+_0x53089e(0x168)],'cacheAge':this[_0x53089e(0x14c)+_0x53089e(0x135)+'edCac'+'he'][_0x53089e(0x137)+'gated']?Date[_0x53089e(0x14a)]()-this[_0x53089e(0x14c)+'ocess'+_0x53089e(0x1a9)+'he']['lastP'+'repro'+'cessT'+'ime']:null,'noteCount':this['prepr'+'ocess'+'edCac'+'he'][_0x53089e(0x1bd)+_0x53089e(0x16a)],'coherence':this['prepr'+'ocess'+_0x53089e(0x1a9)+'he']['coher'+'ence'],'preprocessingInProgress':this['prepr'+'ocess'+_0x53089e(0x166)+_0x53089e(0x152)+'ess']};}['clear'+_0x1d9337(0x19a)](){const _0x931843=_0x1d9337,_0x250ed8={};_0x250ed8['aggre'+'gated']=null,_0x250ed8[_0x931843(0x1a7)+_0x931843(0x147)]=null,_0x250ed8[_0x931843(0x192)+_0x931843(0x17a)]=null,_0x250ed8[_0x931843(0x189)+_0x931843(0x176)+'s']=null,_0x250ed8['patte'+_0x931843(0x18c)]=null,_0x250ed8['lastP'+_0x931843(0x1ad)+_0x931843(0x199)+_0x931843(0x13c)]=0x0,_0x250ed8[_0x931843(0x1bd)+'ount']=0x0,this['prepr'+'ocess'+_0x931843(0x1a9)+'he']=_0x250ed8;}}function _0xad42(){const _0x58fefe=['C3fYDa','ntaTmJa','Aw5Nsw4','zdOG','z2f0zwq','Bwf4tM8','B3vUDa','Aw5N','C2nVCMu','icHIywm','C2XPy2u','BwLUv2u','rMfJDg8','y2XPy2S','ywjZ','DgLVBLC','ChvZAa','yxrZ','ze5VDgu','y29UzMW','yxrL','AxntDge','zw5Jzq','BgvUz3q','DMf0Aw8','Bg93','ndiYmta4meDzBgf2wa','DgvJDg8','y29TChu','ndaXmdi5mMDUv3jvvG','qwDL','CMvNyxq','Dg9tDhi','zxzLBa','kcGOlIS','AwDODa','DML0EuW','Chj1BMu','sw50zxi','B3j5x28','CM5Z','DMfS','Aw5JCMu','zgvJyxK','C3rbz2C','CNvJDg8','y29Ozxi','y2fJAgu','CM9Jzxm','sw5cywm','zwLNAhq','BgfZDfa','C2vHCMm','y2vZC1q','q2fJAgu','DgvZ','mZq1mZqYmfnvzffitW','C29Tzq','mtmZotu4mwPODvvYwG','Axndywm','zxnZ','Axr5rgu','Cg93','DgvK','DhjLBMq','Axr5','Aw50zxi','BxvSDgK','Bwv0CMK','zwrdywm','twf4qwC','mg1Z','yxrH','CMvWCM8','DgLty2e','Bwf4','C3rLCa','C29Yxsa','yxr0zw4','Aw5JBhu','z2fTzvm','BwvZC2e','yxnPBMC','w1bYzxa','C291CMm','z2v0rMe','A2DYB3u','mu52DKTita','igfJDgK','BM90zum','Dgf0zq','zwXHChm','C3rqCNu','BMvKtM8','B2nLC3m','ywn0Axy','ywDNCMu','mdaWBxm','zMLSDgu','BNvTyMu','mZvKyvv0sM8','Aw1L','AgfZvxm','DgvZDa','AgvwywW','yxr0zxi','ihbYzxa','DhLWzq','BMqP','zgvZ','yMXLu3q','B2jZzxi','u2nHBgu','zxrLicG','D1nPEMu','BM93','ignHy2G','ChjLChi','Aw9U','ntuWody0wxzYuwLK','ndi5nJm2AK1pugL4','DefJDgK','y29UC3q','uhjVz3i','DhvKzq','CMvKDwm','z3jLz2e','BwfW','zgvJCMu','mtaWlte','zxjjBNq','y2HLu3q','pdeWBxm','DgfTCa','DgLTzxm','BwfNBMK','mtu4ntaZnLvyu21usq','z2v0q2e','C2LUzYa','mtbmBwvTC2e','ywn0Aw8'];_0xad42=function(){return _0x58fefe;};return _0xad42();}export class AdaptiveTemporalProcessor{constructor(_0x4bc047={}){const _0x495443=_0x1d9337;this['prepr'+_0x495443(0x135)+'or']=new TemporalPreprocessingManager(_0x4bc047),this[_0x495443(0x136)+_0x495443(0x1a1)+'tecto'+'r']=new ActivityDetector();}async['proce'+'ssNot'+'es'](_0x12f0b9,_0xabbdd3={}){const _0x379d2a=_0x1d9337,_0x514239=this['activ'+_0x379d2a(0x1a1)+'tecto'+'r']['detec'+'tActi'+_0x379d2a(0x188)+'evel'](_0x12f0b9),_0x1256c6=this['activ'+'ityDe'+'tecto'+'r']['hasUs'+'erInt'+'eract'+_0x379d2a(0x14d)](_0x12f0b9),_0x439e30=this['activ'+'ityDe'+_0x379d2a(0x17f)+'r']['isSta'+_0x379d2a(0x145)+'ate'](_0x12f0b9);if(_0x514239==='high'&&_0x1256c6){const _0x130500=await this['prepr'+'ocess'+'or']['getFa'+_0x379d2a(0x190)+_0x379d2a(0x183)+_0x379d2a(0x14d)](_0x12f0b9,_0xabbdd3);return{'aggregated':_0x130500,'multiScale':this[_0x379d2a(0x14c)+_0x379d2a(0x135)+'or']['getFa'+'stMul'+_0x379d2a(0x1ae)+'le'](_0x12f0b9),'prunedNotes':this['prepr'+_0x379d2a(0x135)+'or']['getFa'+_0x379d2a(0x133)+_0x379d2a(0x134)+_0x379d2a(0x19b)](_0x12f0b9,_0xabbdd3),'source':_0x379d2a(0x193),'latency':_0x379d2a(0x15b),'activity':_0x514239,'metadata':{'noteCount':_0x12f0b9[_0x379d2a(0x17b)+'h'],'cacheAge':this[_0x379d2a(0x14c)+'ocess'+'or'][_0x379d2a(0x14c)+'ocess'+_0x379d2a(0x1a9)+'he'][_0x379d2a(0x197)+'repro'+'cessT'+'ime']?Date['now']()-this[_0x379d2a(0x14c)+_0x379d2a(0x135)+'or']['prepr'+_0x379d2a(0x135)+'edCac'+'he'][_0x379d2a(0x197)+_0x379d2a(0x1ad)+'cessT'+'ime']:null}};}if(_0x514239===_0x379d2a(0x17d)&&_0x439e30){await this['prepr'+_0x379d2a(0x135)+'or']['prepr'+_0x379d2a(0x135)+'InBac'+'kgrou'+'nd'](_0x12f0b9,_0xabbdd3);const _0x267f61={};_0x267f61[_0x379d2a(0x1bd)+'ount']=_0x12f0b9[_0x379d2a(0x17b)+'h'],_0x267f61[_0x379d2a(0x193)+_0x379d2a(0x182)]=0x0;const _0x4531e9={};return _0x4531e9[_0x379d2a(0x137)+_0x379d2a(0x168)]=this[_0x379d2a(0x14c)+_0x379d2a(0x135)+'or']['prepr'+_0x379d2a(0x135)+'edCac'+'he'][_0x379d2a(0x137)+'gated'],_0x4531e9[_0x379d2a(0x1a7)+_0x379d2a(0x147)]=this[_0x379d2a(0x14c)+_0x379d2a(0x135)+'or']['prepr'+_0x379d2a(0x135)+_0x379d2a(0x1a9)+'he']['multi'+_0x379d2a(0x147)],_0x4531e9['prune'+_0x379d2a(0x176)+'s']=this['prepr'+_0x379d2a(0x135)+'or'][_0x379d2a(0x14c)+_0x379d2a(0x135)+_0x379d2a(0x1a9)+'he'][_0x379d2a(0x189)+_0x379d2a(0x176)+'s'],_0x4531e9['patte'+'rns']=this[_0x379d2a(0x14c)+_0x379d2a(0x135)+'or']['prepr'+_0x379d2a(0x135)+'edCac'+'he']['patte'+'rns'],_0x4531e9[_0x379d2a(0x1b8)+'e']='prepr'+_0x379d2a(0x135)+'ed',_0x4531e9['laten'+'cy']=_0x379d2a(0x158)+_0x379d2a(0x138)+_0x379d2a(0x16d)+_0x379d2a(0x1ba)+_0x379d2a(0x143),_0x4531e9[_0x379d2a(0x136)+_0x379d2a(0x1a5)]=_0x514239,_0x4531e9['metad'+_0x379d2a(0x1ac)]=_0x267f61,_0x4531e9;}if(this[_0x379d2a(0x14c)+'ocess'+'or'][_0x379d2a(0x19f)+_0x379d2a(0x13f)+'id'](_0x12f0b9))return{'aggregated':await this['prepr'+_0x379d2a(0x135)+'or']['getFa'+'stAgg'+_0x379d2a(0x183)+'ion'](_0x12f0b9,_0xabbdd3),'multiScale':this[_0x379d2a(0x14c)+'ocess'+'or'][_0x379d2a(0x1b9)+'stMul'+'tiSca'+'le'](_0x12f0b9),'prunedNotes':this[_0x379d2a(0x14c)+_0x379d2a(0x135)+'or']['getFa'+_0x379d2a(0x133)+'nedNo'+_0x379d2a(0x19b)](_0x12f0b9,_0xabbdd3),'source':_0x379d2a(0x193),'latency':'<10ms','activity':_0x514239,'metadata':{'noteCount':_0x12f0b9['lengt'+'h'],'cacheAge':Date['now']()-this['prepr'+'ocess'+'or']['prepr'+'ocess'+'edCac'+'he']['lastP'+_0x379d2a(0x1ad)+'cessT'+_0x379d2a(0x13c)]}};else{const _0x2251c9={};_0x2251c9['windo'+_0x379d2a(0x149)]=_0xabbdd3['windo'+'wSize']||0x2710,_0x2251c9[_0x379d2a(0x18f)+'Facto'+'r']=_0xabbdd3['decay'+_0x379d2a(0x170)+'r']||0.9;const _0x1eb13b=await aggregateTemporalNotes(_0x12f0b9,_0x2251c9),_0x106bd0={};_0x106bd0['atten'+_0x379d2a(0x173)+'eight'+'s']=!![];const _0xbcbc53={};return _0xbcbc53['maxNo'+_0x379d2a(0x19b)]=_0xabbdd3[_0x379d2a(0x169)+'tes']||0x14,{'aggregated':_0x1eb13b,'multiScale':aggregateMultiScale(_0x12f0b9,_0x106bd0),'prunedNotes':pruneTemporalNotes(_0x12f0b9,_0xbcbc53),'source':_0x379d2a(0x180)+_0x379d2a(0x1a3),'latency':_0x379d2a(0x165)+_0x379d2a(0x1ab),'activity':_0x514239,'metadata':{'noteCount':_0x12f0b9['lengt'+'h'],'cacheAge':null}};}}}export function createTemporalPreprocessingManager(_0x372861={}){return new TemporalPreprocessingManager(_0x372861);}export function createAdaptiveTemporalProcessor(_0x377acb={}){return new AdaptiveTemporalProcessor(_0x377acb);}
|
package/src/type-guards.mjs
CHANGED
|
@@ -185,7 +185,7 @@ export function isTemporalNote(value) {
|
|
|
185
185
|
*/
|
|
186
186
|
export function assertObject(value, name = 'value') {
|
|
187
187
|
if (!isObject(value)) {
|
|
188
|
-
throw new ValidationError(`${name} must be an object`,
|
|
188
|
+
throw new ValidationError(`${name} must be an object`, {
|
|
189
189
|
received: typeof value
|
|
190
190
|
});
|
|
191
191
|
}
|
|
@@ -201,7 +201,7 @@ export function assertObject(value, name = 'value') {
|
|
|
201
201
|
*/
|
|
202
202
|
export function assertString(value, name = 'value') {
|
|
203
203
|
if (!isString(value)) {
|
|
204
|
-
throw new ValidationError(`${name} must be a string`,
|
|
204
|
+
throw new ValidationError(`${name} must be a string`, {
|
|
205
205
|
received: typeof value
|
|
206
206
|
});
|
|
207
207
|
}
|
|
@@ -232,7 +232,7 @@ export function assertNonEmptyString(value, name = 'value') {
|
|
|
232
232
|
*/
|
|
233
233
|
export function assertNumber(value, name = 'value') {
|
|
234
234
|
if (!isNumber(value)) {
|
|
235
|
-
throw new ValidationError(`${name} must be a number`,
|
|
235
|
+
throw new ValidationError(`${name} must be a number`, {
|
|
236
236
|
received: typeof value
|
|
237
237
|
});
|
|
238
238
|
}
|
|
@@ -249,7 +249,7 @@ export function assertNumber(value, name = 'value') {
|
|
|
249
249
|
*/
|
|
250
250
|
export function assertArray(value, name = 'value') {
|
|
251
251
|
if (!isArray(value)) {
|
|
252
|
-
throw new ValidationError(`${name} must be an array`,
|
|
252
|
+
throw new ValidationError(`${name} must be an array`, {
|
|
253
253
|
received: typeof value
|
|
254
254
|
});
|
|
255
255
|
}
|
|
@@ -265,7 +265,7 @@ export function assertArray(value, name = 'value') {
|
|
|
265
265
|
*/
|
|
266
266
|
export function assertFunction(value, name = 'value') {
|
|
267
267
|
if (!isFunction(value)) {
|
|
268
|
-
throw new ValidationError(`${name} must be a function`,
|
|
268
|
+
throw new ValidationError(`${name} must be a function`, {
|
|
269
269
|
received: typeof value
|
|
270
270
|
});
|
|
271
271
|
}
|
package/src/utils/cached-llm.mjs
CHANGED
|
@@ -77,7 +77,7 @@ export function normalizePrompt(prompt) {
|
|
|
77
77
|
*/
|
|
78
78
|
export async function callLLMCached(prompt, provider, apiKey, options = {}) {
|
|
79
79
|
const {
|
|
80
|
-
useCache = process.env.DISABLE_LLM_CACHE !== 'true', //
|
|
80
|
+
useCache = process.env.DISABLE_LLM_CACHE !== 'true', // Same env var as config.mjs cacheEnabled
|
|
81
81
|
...llmOptions
|
|
82
82
|
} = options;
|
|
83
83
|
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { warn } from './logger.mjs';
|
|
9
|
+
import { calibrateScore } from './score-calibration.mjs';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Normalize validation result to ensure consistent structure
|
|
@@ -93,6 +94,13 @@ export function normalizeValidationResult(result, source = 'unknown') {
|
|
|
93
94
|
normalized.assessment = null;
|
|
94
95
|
}
|
|
95
96
|
|
|
97
|
+
// Apply score calibration if provider is known
|
|
98
|
+
// Stores both raw and calibrated scores for transparency
|
|
99
|
+
if (normalized.score !== null && normalized.provider) {
|
|
100
|
+
normalized.rawScore = normalized.score;
|
|
101
|
+
normalized.score = calibrateScore(normalized.score, normalized.provider);
|
|
102
|
+
}
|
|
103
|
+
|
|
96
104
|
return normalized;
|
|
97
105
|
}
|
|
98
106
|
|
package/src/validation.mjs
CHANGED
|
@@ -21,7 +21,7 @@ export function validateImagePath(imagePath, options = {}) {
|
|
|
21
21
|
const { baseDir = process.cwd() } = options;
|
|
22
22
|
|
|
23
23
|
if (typeof imagePath !== 'string') {
|
|
24
|
-
throw new ValidationError('Image path must be a string',
|
|
24
|
+
throw new ValidationError('Image path must be a string', {
|
|
25
25
|
received: typeof imagePath
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -69,7 +69,7 @@ export function validateImagePath(imagePath, options = {}) {
|
|
|
69
69
|
*/
|
|
70
70
|
export function validatePrompt(prompt, maxLength = VALIDATION_CONSTANTS.MAX_PROMPT_LENGTH) {
|
|
71
71
|
if (typeof prompt !== 'string') {
|
|
72
|
-
throw new ValidationError('Prompt must be a string',
|
|
72
|
+
throw new ValidationError('Prompt must be a string', {
|
|
73
73
|
received: typeof prompt
|
|
74
74
|
});
|
|
75
75
|
}
|
|
@@ -79,7 +79,7 @@ export function validatePrompt(prompt, maxLength = VALIDATION_CONSTANTS.MAX_PROM
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
if (prompt.length > maxLength) {
|
|
82
|
-
throw new ValidationError(`Prompt too long (max ${maxLength} characters)`,
|
|
82
|
+
throw new ValidationError(`Prompt too long (max ${maxLength} characters)`, {
|
|
83
83
|
length: prompt.length,
|
|
84
84
|
maxLength
|
|
85
85
|
});
|
|
@@ -102,7 +102,7 @@ export function validateContext(context, maxSize = VALIDATION_CONSTANTS.MAX_CONT
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
if (typeof context !== 'object' || Array.isArray(context)) {
|
|
105
|
-
throw new ValidationError('Context must be an object',
|
|
105
|
+
throw new ValidationError('Context must be an object', {
|
|
106
106
|
received: Array.isArray(context) ? 'array' : typeof context
|
|
107
107
|
});
|
|
108
108
|
}
|
|
@@ -111,7 +111,7 @@ export function validateContext(context, maxSize = VALIDATION_CONSTANTS.MAX_CONT
|
|
|
111
111
|
try {
|
|
112
112
|
const contextString = JSON.stringify(context);
|
|
113
113
|
if (contextString.length > maxSize) {
|
|
114
|
-
throw new ValidationError(`Context too large (max ${maxSize} bytes)`,
|
|
114
|
+
throw new ValidationError(`Context too large (max ${maxSize} bytes)`, {
|
|
115
115
|
size: contextString.length,
|
|
116
116
|
maxSize
|
|
117
117
|
});
|
|
@@ -120,7 +120,7 @@ export function validateContext(context, maxSize = VALIDATION_CONSTANTS.MAX_CONT
|
|
|
120
120
|
if (error instanceof ValidationError) {
|
|
121
121
|
throw error;
|
|
122
122
|
}
|
|
123
|
-
throw new ValidationError('Context contains non-serializable data',
|
|
123
|
+
throw new ValidationError('Context contains non-serializable data', {
|
|
124
124
|
originalError: error.message
|
|
125
125
|
});
|
|
126
126
|
}
|
|
@@ -139,20 +139,20 @@ export function validateContext(context, maxSize = VALIDATION_CONSTANTS.MAX_CONT
|
|
|
139
139
|
*/
|
|
140
140
|
export function validateTimeout(timeout, min = VALIDATION_CONSTANTS.MIN_TIMEOUT_MS, max = VALIDATION_CONSTANTS.MAX_TIMEOUT_MS) {
|
|
141
141
|
if (typeof timeout !== 'number') {
|
|
142
|
-
throw new ValidationError('Timeout must be a number',
|
|
142
|
+
throw new ValidationError('Timeout must be a number', {
|
|
143
143
|
received: typeof timeout
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
if (timeout < min) {
|
|
148
|
-
throw new ValidationError(`Timeout too short (min ${min}ms)`,
|
|
148
|
+
throw new ValidationError(`Timeout too short (min ${min}ms)`, {
|
|
149
149
|
timeout,
|
|
150
150
|
min
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
if (timeout > max) {
|
|
155
|
-
throw new ValidationError(`Timeout too long (max ${max}ms)`,
|
|
155
|
+
throw new ValidationError(`Timeout too long (max ${max}ms)`, {
|
|
156
156
|
timeout,
|
|
157
157
|
max
|
|
158
158
|
});
|
|
@@ -170,7 +170,7 @@ export function validateTimeout(timeout, min = VALIDATION_CONSTANTS.MIN_TIMEOUT_
|
|
|
170
170
|
*/
|
|
171
171
|
export function validateSchema(schema) {
|
|
172
172
|
if (!schema || typeof schema !== 'object' || Array.isArray(schema)) {
|
|
173
|
-
throw new ValidationError('Schema must be a non-empty object',
|
|
173
|
+
throw new ValidationError('Schema must be a non-empty object', {
|
|
174
174
|
received: Array.isArray(schema) ? 'array' : typeof schema
|
|
175
175
|
});
|
|
176
176
|
}
|
|
@@ -179,13 +179,13 @@ export function validateSchema(schema) {
|
|
|
179
179
|
|
|
180
180
|
for (const [key, field] of Object.entries(schema)) {
|
|
181
181
|
if (typeof field !== 'object' || Array.isArray(field)) {
|
|
182
|
-
throw new ValidationError(`Schema field "${key}" must be an object`,
|
|
182
|
+
throw new ValidationError(`Schema field "${key}" must be an object`, {
|
|
183
183
|
field
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
if (!field.type || !validTypes.includes(field.type)) {
|
|
188
|
-
throw new ValidationError(`Schema field "${key}" has invalid type`,
|
|
188
|
+
throw new ValidationError(`Schema field "${key}" has invalid type`, {
|
|
189
189
|
type: field.type,
|
|
190
190
|
validTypes
|
|
191
191
|
});
|
|
@@ -220,7 +220,7 @@ export function validateFilePath(filePath, options = {}) {
|
|
|
220
220
|
} = options;
|
|
221
221
|
|
|
222
222
|
if (typeof filePath !== 'string') {
|
|
223
|
-
throw new ValidationError('File path must be a string',
|
|
223
|
+
throw new ValidationError('File path must be a string', {
|
|
224
224
|
received: typeof filePath
|
|
225
225
|
});
|
|
226
226
|
}
|
package/src/validators/index.mjs
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Validators Sub-Module
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* All validation-related functionality grouped together.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* Import from 'ai-visual-test/validators'
|
|
7
|
+
*
|
|
8
|
+
* ## Which validator to use
|
|
9
|
+
*
|
|
10
|
+
* | Test type | Validator | Speed | Needs VLM? |
|
|
11
|
+
* |------------------------|----------------------------------|--------|------------|
|
|
12
|
+
* | Visual quality/design | `validateWithRubric()` | Slow | Yes |
|
|
13
|
+
* | Accessibility (fast) | `checkAllTextContrast()`, | Fast | No |
|
|
14
|
+
* | | `checkKeyboardNavigation()` | | |
|
|
15
|
+
* | Accessibility (full) | `validateAccessibilityHybrid()` | Medium | Yes |
|
|
16
|
+
* | Element position/size | `validateElementPosition()` | Fast | No |
|
|
17
|
+
* | State correctness | `validateStateProgrammatic()` | Fast | No |
|
|
18
|
+
* | State + visual context | `validateStateHybrid()` | Medium | Yes |
|
|
19
|
+
* | Batch (many pages) | `BatchValidator` | Varies | Yes |
|
|
20
|
+
* | Custom rubric scoring | `validateWithRubric()` | Slow | Yes |
|
|
21
|
+
*
|
|
22
|
+
* **Rule of thumb**: use programmatic validators for deterministic checks (contrast,
|
|
23
|
+
* position, state), hybrid validators when you need both programmatic precision and
|
|
24
|
+
* VLM judgment, and rubric-based validation for subjective quality assessment.
|
|
25
|
+
*
|
|
26
|
+
* VLM-based validators are slower and cost API tokens. Prefer programmatic validators
|
|
27
|
+
* when the check can be expressed as a deterministic rule.
|
|
7
28
|
*/
|
|
8
29
|
|
|
9
30
|
// Re-export everything from validators
|
package/src/pricing.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Provider Pricing Configuration
|
|
3
|
-
*
|
|
4
|
-
* Central source of truth for provider pricing.
|
|
5
|
-
* Used by config.mjs and cost-optimization.mjs.
|
|
6
|
-
*
|
|
7
|
-
* Pricing per 1M tokens (USD).
|
|
8
|
-
* Last updated: June 2025
|
|
9
|
-
*/
|
|
10
|
-
export const PROVIDER_PRICING = {
|
|
11
|
-
gemini: {
|
|
12
|
-
input: 0.10,
|
|
13
|
-
output: 0.40
|
|
14
|
-
},
|
|
15
|
-
openai: {
|
|
16
|
-
input: 5.00,
|
|
17
|
-
output: 15.00
|
|
18
|
-
},
|
|
19
|
-
claude: {
|
|
20
|
-
input: 3.00,
|
|
21
|
-
output: 15.00
|
|
22
|
-
},
|
|
23
|
-
groq: {
|
|
24
|
-
input: 0.59,
|
|
25
|
-
output: 0.79
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Path Validation Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides secure path validation to prevent path traversal attacks.
|
|
5
|
-
*
|
|
6
|
-
* NOTE: The primary validateFilePath() function is in src/validation.mjs.
|
|
7
|
-
* This module provides additional utilities for path validation.
|
|
8
|
-
*
|
|
9
|
-
* @deprecated validateFilePath() - Use validateFilePath() from '../validation.mjs' instead
|
|
10
|
-
* This function is kept for backward compatibility but delegates to the main implementation.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { resolve, normalize, basename } from 'path';
|
|
14
|
-
import { existsSync } from 'fs';
|
|
15
|
-
import { ValidationError } from '../errors.mjs';
|
|
16
|
-
import { validateFilePath as validateFilePathMain } from '../validation.mjs';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Validates and normalizes a file path to prevent path traversal attacks
|
|
20
|
-
*
|
|
21
|
-
* @deprecated Use validateFilePath() from '../validation.mjs' instead
|
|
22
|
-
* @param {string} userPath - User-provided file path
|
|
23
|
-
* @param {string} baseDir - Base directory (optional, defaults to process.cwd())
|
|
24
|
-
* @returns {string} - Resolved, normalized path
|
|
25
|
-
* @throws {ValidationError} - If path is invalid or outside base directory
|
|
26
|
-
*/
|
|
27
|
-
export function validateFilePath(userPath, baseDir = process.cwd()) {
|
|
28
|
-
// Validate empty string before delegating (main implementation also checks, but we want consistent error)
|
|
29
|
-
if (typeof userPath !== 'string' || !userPath.trim()) {
|
|
30
|
-
throw new ValidationError('File path must be a non-empty string', null, {
|
|
31
|
-
received: typeof userPath
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Delegate to main implementation for consistency
|
|
36
|
-
return validateFilePathMain(userPath, { baseDir });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Sanitize file path for error messages (prevents information disclosure)
|
|
41
|
-
*
|
|
42
|
-
* @param {string} fullPath - Full file path
|
|
43
|
-
* @param {number} maxDepth - Maximum directory depth to show (default: 2)
|
|
44
|
-
* @returns {string} - Sanitized path showing only last N components
|
|
45
|
-
*/
|
|
46
|
-
export function sanitizePathForError(fullPath, maxDepth = 2) {
|
|
47
|
-
if (typeof fullPath !== 'string') {
|
|
48
|
-
return '[invalid path]';
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const parts = fullPath.split('/').filter(p => p);
|
|
52
|
-
if (parts.length <= maxDepth) {
|
|
53
|
-
return fullPath;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Show only last maxDepth parts
|
|
57
|
-
return '.../' + parts.slice(-maxDepth).join('/');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Validate that a path is within allowed directories
|
|
62
|
-
*
|
|
63
|
-
* @param {string} userPath - User-provided path
|
|
64
|
-
* @param {string[]} allowedDirs - Array of allowed base directories
|
|
65
|
-
* @returns {string} - Resolved path if valid
|
|
66
|
-
* @throws {ValidationError} - If path is outside all allowed directories
|
|
67
|
-
*/
|
|
68
|
-
export function validatePathInAllowedDirs(userPath, allowedDirs) {
|
|
69
|
-
if (!Array.isArray(allowedDirs) || allowedDirs.length === 0) {
|
|
70
|
-
throw new ValidationError('allowedDirs must be a non-empty array');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
for (const allowedDir of allowedDirs) {
|
|
74
|
-
try {
|
|
75
|
-
const resolved = validateFilePath(userPath, allowedDir);
|
|
76
|
-
return resolved;
|
|
77
|
-
} catch {
|
|
78
|
-
// Try next allowed directory
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Path not in any allowed directory
|
|
84
|
-
throw new ValidationError('File path is outside allowed directories', userPath, {
|
|
85
|
-
allowedDirs
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|