@lawreneliang/atel-sdk 0.5.5 → 0.5.6

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.
@@ -1 +1 @@
1
- function _0x2684(_0xd22881,_0x28869d){_0xd22881=_0xd22881-0x112;const _0x2ae944=_0x2ae9();let _0x2684f0=_0x2ae944[_0xd22881];if(_0x2684['kgeNsO']===undefined){var _0x27ec83=function(_0x33026c){const _0x49fad3='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x211c3f='',_0x48dfcd='';for(let _0x30f8a4=0x0,_0x21b317,_0x409fac,_0x4d6d1e=0x0;_0x409fac=_0x33026c['charAt'](_0x4d6d1e++);~_0x409fac&&(_0x21b317=_0x30f8a4%0x4?_0x21b317*0x40+_0x409fac:_0x409fac,_0x30f8a4++%0x4)?_0x211c3f+=String['fromCharCode'](0xff&_0x21b317>>(-0x2*_0x30f8a4&0x6)):0x0){_0x409fac=_0x49fad3['indexOf'](_0x409fac);}for(let _0x28524b=0x0,_0x5a17a7=_0x211c3f['length'];_0x28524b<_0x5a17a7;_0x28524b++){_0x48dfcd+='%'+('00'+_0x211c3f['charCodeAt'](_0x28524b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x48dfcd);};_0x2684['NihqGk']=_0x27ec83,_0x2684['zzeFGJ']={},_0x2684['kgeNsO']=!![];}const _0x45a547=_0x2ae944[0x0],_0x45cb50=_0xd22881+_0x45a547,_0x5a3463=_0x2684['zzeFGJ'][_0x45cb50];return!_0x5a3463?(_0x2684f0=_0x2684['NihqGk'](_0x2684f0),_0x2684['zzeFGJ'][_0x45cb50]=_0x2684f0):_0x2684f0=_0x5a3463,_0x2684f0;}const _0x1bf616=_0x2684;(function(_0x4ebe0c,_0xe9ffc1){const _0x4bb7b2=_0x2684,_0x548b30=_0x4ebe0c();while(!![]){try{const _0x24297c=parseInt(_0x4bb7b2(0x135))/0x1*(-parseInt(_0x4bb7b2(0x132))/0x2)+parseInt(_0x4bb7b2(0x13f))/0x3+-parseInt(_0x4bb7b2(0x155))/0x4*(-parseInt(_0x4bb7b2(0x12f))/0x5)+-parseInt(_0x4bb7b2(0x15b))/0x6*(parseInt(_0x4bb7b2(0x16a))/0x7)+parseInt(_0x4bb7b2(0x177))/0x8+-parseInt(_0x4bb7b2(0x122))/0x9+-parseInt(_0x4bb7b2(0x14e))/0xa;if(_0x24297c===_0xe9ffc1)break;else _0x548b30['push'](_0x548b30['shift']());}catch(_0x5ef976){_0x548b30['push'](_0x548b30['shift']());}}}(_0x2ae9,0xd34f9));import{createHash}from'node:crypto';import{writeFile}from'node:fs/promises';import{writeFileSync,readFileSync,mkdirSync,existsSync,appendFileSync}from'node:fs';import{join,dirname}from'node:path';function sha256(_0x43b930){const _0x596e13=_0x2684,_0x1a6650={'onxzY':function(_0x3aceef,_0x30ef45){return _0x3aceef(_0x30ef45);},'IeBvQ':_0x596e13(0x170),'oZTzr':_0x596e13(0x120)};return _0x1a6650['onxzY'](createHash,'sha256')['update'](_0x43b930,_0x1a6650['IeBvQ'])['digest'](_0x1a6650['oZTzr']);}function sortedStringify(_0x1c9198){const _0x55aeea=_0x2684,_0xfd98b6={'UOais':function(_0x2d1dca,_0x380305,_0x445e31){return _0x2d1dca(_0x380305,_0x445e31);},'FCDGg':_0x55aeea(0x170),'cRbYj':function(_0x289c49,_0x474cad){return _0x289c49===_0x474cad;}};if(_0xfd98b6[_0x55aeea(0x16e)](_0x1c9198,null)||_0x1c9198===undefined)return JSON[_0x55aeea(0x14c)](_0x1c9198);if(typeof _0x1c9198!=='object'){if('rxSZz'!=='rxSZz'){const _0x178feb=_0x3365c9??this['getStoragePath']();if(!_0x178feb)throw new _0xb7e003(_0x55aeea(0x169));const _0x54af02=_0xa38bec(_0x178feb);if(!_0x44578c(_0x54af02)){const _0x4785ca={};_0x4785ca[_0x55aeea(0x160)]=!![],_0xfd98b6['UOais'](_0x1abbee,_0x54af02,_0x4785ca);}const _0x6989ef=this[_0x55aeea(0x114)]['map'](_0x234b9f=>_0x9601e5[_0x55aeea(0x14c)](_0x234b9f))[_0x55aeea(0x16b)]('\x0a');_0x51604e(_0x178feb,_0x6989ef+(this['events']['length']>0x0?'\x0a':''),_0xfd98b6['FCDGg']);}else return JSON[_0x55aeea(0x14c)](_0x1c9198);}if(Array[_0x55aeea(0x121)](_0x1c9198))return'['+_0x1c9198['map'](_0x9975d4=>sortedStringify(_0x9975d4))[_0x55aeea(0x16b)](',')+']';const _0x291e25=_0x1c9198,_0x2bc0a9=Object['keys'](_0x291e25)[_0x55aeea(0x179)](),_0x37c3c1=_0x2bc0a9[_0x55aeea(0x137)](_0x3057be=>JSON[_0x55aeea(0x14c)](_0x3057be)+':'+sortedStringify(_0x291e25[_0x3057be]));return'{'+_0x37c3c1['join'](',')+'}';}export function computeEventHash(_0x17e6b1,_0xeb8586,_0x259486,_0x37c1eb,_0x51ddec){const _0x2c8af4=_0x2684,_0x120d9={'KpSlC':function(_0x467da5,_0x167894){return _0x467da5(_0x167894);}},_0x117576=_0x120d9[_0x2c8af4(0x168)](sha256,_0x120d9[_0x2c8af4(0x168)](sortedStringify,_0x37c1eb)),_0x467791=_0x17e6b1+'|'+_0xeb8586+'|'+_0x259486+'|'+_0x117576+'|'+_0x51ddec;return _0x120d9[_0x2c8af4(0x168)](sha256,_0x467791);}const GENESIS_PREV=_0x1bf616(0x129);export class ExecutionTrace{[_0x1bf616(0x157)];['identity'];[_0x1bf616(0x13c)];['storage'];['events']=[];['seq']=0x0;['finalized']=![];[_0x1bf616(0x15c)]=![];[_0x1bf616(0x172)]=0x0;constructor(_0x1276ad,_0x5b1723,_0x598947){const _0x320ed5=_0x1bf616,_0xadd568={'IhfKc':function(_0x29674c,_0x28304b,_0x2e4013){return _0x29674c(_0x28304b,_0x2e4013);},'qBOuw':function(_0x4a4178,_0x342d93){return _0x4a4178(_0x342d93);},'rtFoL':function(_0x36e0cc,_0x1b5fb6){return _0x36e0cc!==_0x1b5fb6;},'HoNRW':'aILwd','TiiXt':function(_0x2cbade,_0x3aad6c,_0x578bf6){return _0x2cbade(_0x3aad6c,_0x578bf6);}};this[_0x320ed5(0x157)]=_0x1276ad,this[_0x320ed5(0x162)]=_0x5b1723,this[_0x320ed5(0x13c)]=_0x598947?.[_0x320ed5(0x13c)]??0x32,this['storage']=_0x598947?.['storage'];if(this['storage']){if(!_0xadd568['qBOuw'](existsSync,this[_0x320ed5(0x17c)][_0x320ed5(0x149)])){if(_0xadd568[_0x320ed5(0x159)](_0xadd568['HoNRW'],_0x320ed5(0x161))){const _0x2ede5a={};_0x2ede5a[_0x320ed5(0x160)]=!![],_0xadd568['TiiXt'](mkdirSync,this[_0x320ed5(0x17c)][_0x320ed5(0x149)],_0x2ede5a);}else{if(!this[_0x320ed5(0x17c)])return _0x209864;return _0xadd568[_0x320ed5(0x176)](_0x3d599e,this['storage']['dir'],this[_0x320ed5(0x157)]+_0x320ed5(0x124));}}}}[_0x1bf616(0x15d)](_0x4c2f17,_0xf9ebbb){const _0x1e8a7f=_0x1bf616,_0x2a75b7={};_0x2a75b7['GtJnN']='Cannot\x20append\x20to\x20a\x20finalized\x20trace',_0x2a75b7['ntrdk']=_0x1e8a7f(0x13d),_0x2a75b7['pzIfn']=_0x1e8a7f(0x17f),_0x2a75b7['pFcxA']=function(_0x3cf6cc,_0x34a265){return _0x3cf6cc>_0x34a265;},_0x2a75b7[_0x1e8a7f(0x134)]=function(_0x102083,_0x69b4c8){return _0x102083-_0x69b4c8;},_0x2a75b7['JxWlq']='CHECKPOINT';const _0x3da999=_0x2a75b7;if(this['finalized'])throw new Error(_0x3da999['GtJnN']);if(this['failed']){if(_0x3da999[_0x1e8a7f(0x154)]===_0x1e8a7f(0x152))this[_0x1e8a7f(0x178)]();else throw new Error(_0x3da999['pzIfn']);}const _0xdd17e1=new Date()['toISOString'](),_0xd48f58=_0x3da999['pFcxA'](this['events']['length'],0x0)?this[_0x1e8a7f(0x114)][_0x3da999[_0x1e8a7f(0x134)](this['events'][_0x1e8a7f(0x131)],0x1)]['hash']:GENESIS_PREV,_0x5d5387=computeEventHash(this['seq'],_0xdd17e1,_0x4c2f17,_0xf9ebbb,_0xd48f58),_0x30bbed={};_0x30bbed[_0x1e8a7f(0x171)]=this['seq'],_0x30bbed['ts']=_0xdd17e1,_0x30bbed[_0x1e8a7f(0x144)]=_0x4c2f17,_0x30bbed[_0x1e8a7f(0x125)]=this[_0x1e8a7f(0x157)],_0x30bbed[_0x1e8a7f(0x174)]=_0xf9ebbb,_0x30bbed['prev']=_0xd48f58,_0x30bbed['hash']=_0x5d5387;const _0xba5f25=_0x30bbed;return this[_0x1e8a7f(0x114)]['push'](_0xba5f25),this['seq']++,this[_0x1e8a7f(0x172)]++,this[_0x1e8a7f(0x17c)]?.[_0x1e8a7f(0x150)]&&this[_0x1e8a7f(0x145)](_0xba5f25),_0x4c2f17!==_0x3da999[_0x1e8a7f(0x17e)]&&this[_0x1e8a7f(0x172)]>=this['checkpointInterval']&&this['checkpoint'](),_0xba5f25;}[_0x1bf616(0x178)](){const _0x37f0b2=_0x1bf616,_0x1ba944={};_0x1ba944[_0x37f0b2(0x156)]=_0x37f0b2(0x147),_0x1ba944['opdKP']=function(_0x2e469f,_0x10128f){return _0x2e469f>_0x10128f;},_0x1ba944[_0x37f0b2(0x16d)]=function(_0x300587,_0x31b970){return _0x300587-_0x31b970;},_0x1ba944[_0x37f0b2(0x15f)]='CHECKPOINT';const _0x521864=_0x1ba944;if(this['finalized']||this[_0x37f0b2(0x15c)])throw new Error(_0x521864[_0x37f0b2(0x156)]);const _0x573488=this['getStats'](),_0x41a108=_0x521864[_0x37f0b2(0x11f)](this['events']['length'],0x0)?this[_0x37f0b2(0x114)][_0x521864[_0x37f0b2(0x16d)](this[_0x37f0b2(0x114)]['length'],0x1)]['hash']:GENESIS_PREV,_0x153b23=this['events']['map'](_0x44c83c=>_0x44c83c[_0x37f0b2(0x140)]),_0x478090=this['simpleMerkleRoot'](_0x153b23),_0x96ccca={};_0x96ccca[_0x37f0b2(0x151)]=_0x478090,_0x96ccca[_0x37f0b2(0x165)]=_0x573488['event_count'],_0x96ccca[_0x37f0b2(0x14b)]=_0x573488[_0x37f0b2(0x14b)],_0x96ccca[_0x37f0b2(0x148)]=_0x41a108;const _0x18908b=_0x96ccca,_0x40a090=new Date()[_0x37f0b2(0x119)](),_0x5bb3f3=this['events']['length']>0x0?this[_0x37f0b2(0x114)][this['events'][_0x37f0b2(0x131)]-0x1][_0x37f0b2(0x140)]:GENESIS_PREV,_0x310ba6=computeEventHash(this['seq'],_0x40a090,_0x37f0b2(0x130),_0x18908b,_0x5bb3f3),_0x15f629=this['identity']['sign'](_0x310ba6),_0x5c1ec3={};_0x5c1ec3[_0x37f0b2(0x171)]=this['seq'],_0x5c1ec3['ts']=_0x40a090,_0x5c1ec3['type']=_0x521864['WizOQ'],_0x5c1ec3[_0x37f0b2(0x125)]=this[_0x37f0b2(0x157)],_0x5c1ec3['data']=_0x18908b,_0x5c1ec3[_0x37f0b2(0x167)]=_0x5bb3f3,_0x5c1ec3[_0x37f0b2(0x140)]=_0x310ba6,_0x5c1ec3[_0x37f0b2(0x153)]=_0x15f629;const _0x1885d6=_0x5c1ec3;return this[_0x37f0b2(0x114)][_0x37f0b2(0x14d)](_0x1885d6),this['seq']++,this['eventsSinceCheckpoint']=0x0,this[_0x37f0b2(0x17c)]?.[_0x37f0b2(0x150)]&&this[_0x37f0b2(0x145)](_0x1885d6),_0x1885d6;}['finalize'](_0x1937bd){const _0x58ff3e=_0x1bf616,_0x3667d7={};_0x3667d7[_0x58ff3e(0x12c)]=_0x58ff3e(0x158),_0x3667d7[_0x58ff3e(0x11e)]='TASK_RESULT';const _0x2c5c61=_0x3667d7;if(this['finalized'])throw new Error(_0x2c5c61['VKTcY']);if(this['failed'])throw new Error('Cannot\x20finalize\x20a\x20failed\x20trace');const _0x373476=this[_0x58ff3e(0x15d)](_0x2c5c61['TSAhQ'],_0x1937bd);return this[_0x58ff3e(0x112)]=!![],_0x373476['hash'];}[_0x1bf616(0x163)](_0x34f7c8){const _0x54a5c8=_0x1bf616,_0x476639={};_0x476639['viivL']=function(_0x12a04b,_0x297714){return _0x12a04b instanceof _0x297714;};const _0x1aefa5=_0x476639;if(this[_0x54a5c8(0x112)])throw new Error(_0x54a5c8(0x11a));if(this['failed'])throw new Error('Trace\x20has\x20already\x20been\x20marked\x20as\x20failed');const _0x2b29b2=_0x1aefa5[_0x54a5c8(0x15e)](_0x34f7c8,Error)?{'error':_0x34f7c8[_0x54a5c8(0x116)],'stack':_0x34f7c8[_0x54a5c8(0x175)]}:_0x34f7c8,_0x1822c2=this['append']('TASK_FAILED',_0x2b29b2);return this['failed']=!![],_0x1822c2;}['verify'](){const _0xc1db05=_0x1bf616,_0x1ec63b={'bmMTO':function(_0x211623,_0x46e87c){return _0x211623<_0x46e87c;},'cIWRe':function(_0x1b9d71,_0x118366){return _0x1b9d71(_0x118366);},'mCQwK':function(_0x28ced1,_0x3541b0){return _0x28ced1+_0x3541b0;},'QLUYx':function(_0x47e104,_0x310eb4){return _0x47e104<_0x310eb4;},'fkGfj':function(_0x490957,_0x1384e4){return _0x490957===_0x1384e4;},'EayJr':'yZxoT','zyHto':function(_0x807f71,_0x34e81a){return _0x807f71!==_0x34e81a;},'FXYdo':_0xc1db05(0x13b),'FZBBa':_0xc1db05(0x130)},_0x706c9a=[];for(let _0x240a1c=0x0;_0x1ec63b[_0xc1db05(0x17a)](_0x240a1c,this['events'][_0xc1db05(0x131)]);_0x240a1c++){if(_0x1ec63b[_0xc1db05(0x143)](_0x1ec63b[_0xc1db05(0x12a)],_0x1ec63b['EayJr'])){const _0x1d14cf=this[_0xc1db05(0x114)][_0x240a1c],_0x26b4b4=_0x1ec63b['fkGfj'](_0x240a1c,0x0)?GENESIS_PREV:this['events'][_0x240a1c-0x1][_0xc1db05(0x140)];if(_0x1ec63b[_0xc1db05(0x115)](_0x1d14cf['prev'],_0x26b4b4)){if(_0x1ec63b['FXYdo']===_0x1ec63b['FXYdo'])_0x706c9a['push'](_0xc1db05(0x118)+_0x1d14cf[_0xc1db05(0x171)]+':\x20prev\x20mismatch\x20—\x20expected\x20\x22'+_0x26b4b4+'\x22,\x20got\x20\x22'+_0x1d14cf[_0xc1db05(0x167)]+'\x22');else throw new _0x1b5c38(_0xc1db05(0x126));}const _0x367c95=computeEventHash(_0x1d14cf['seq'],_0x1d14cf['ts'],_0x1d14cf['type'],_0x1d14cf['data'],_0x1d14cf[_0xc1db05(0x167)]);_0x1ec63b[_0xc1db05(0x115)](_0x367c95,_0x1d14cf[_0xc1db05(0x140)])&&_0x706c9a[_0xc1db05(0x14d)]('Event\x20#'+_0x1d14cf[_0xc1db05(0x171)]+_0xc1db05(0x11b)+_0x367c95+_0xc1db05(0x138)+_0x1d14cf[_0xc1db05(0x140)]+'\x22');if(_0x1d14cf[_0xc1db05(0x144)]===_0x1ec63b[_0xc1db05(0x13a)]&&_0x1d14cf[_0xc1db05(0x153)]){const _0x25564f=this[_0xc1db05(0x162)]['verify'](_0x1d14cf['hash'],_0x1d14cf['sig']);!_0x25564f&&_0x706c9a['push'](_0xc1db05(0x118)+_0x1d14cf[_0xc1db05(0x171)]+':\x20checkpoint\x20signature\x20invalid');}}else{const _0x2deba8=[];for(let _0x35d118=0x0;_0x1ec63b[_0xc1db05(0x128)](_0x35d118,_0x550fca['length']);_0x35d118+=0x2){_0x35d118+0x1<_0x4c27c0['length']?_0x2deba8['push'](_0x1ec63b['cIWRe'](_0x4231d6,_0x1ec63b['mCQwK'](_0x5e8b09[_0x35d118],_0x3237c0[_0x35d118+0x1]))):_0x2deba8['push'](_0x41a9c3(_0x3777c7[_0x35d118]+_0x330d85[_0x35d118]));}_0x233bca=_0x2deba8;}}const _0xec9914={};return _0xec9914[_0xc1db05(0x136)]=_0x706c9a[_0xc1db05(0x131)]===0x0,_0xec9914[_0xc1db05(0x11c)]=_0x706c9a,_0xec9914;}[_0x1bf616(0x14f)](){const _0x2ba56f=_0x1bf616;return this['events']['map'](_0x57f97a=>JSON[_0x2ba56f(0x14c)](_0x57f97a))['join']('\x0a');}async[_0x1bf616(0x164)](_0xec6317){const _0x25789f=_0x1bf616,_0x2edeaf=this['export']();await writeFile(_0xec6317,_0x2edeaf,_0x25789f(0x170));}['getEvents'](){return[...this['events']];}[_0x1bf616(0x17d)](){const _0x1d0c2e=_0x1bf616,_0x3f8593={};_0x3f8593[_0x1d0c2e(0x17b)]=function(_0x5c8592,_0x3c6d12){return _0x5c8592-_0x3c6d12;},_0x3f8593['QXcJL']=function(_0x534ff8,_0x5bda09){return _0x534ff8&&_0x5bda09;};const _0x352763=_0x3f8593,_0x4330c7=this['events'][_0x1d0c2e(0x123)](_0x438325=>_0x438325['type']==='TOOL_CALL')[_0x1d0c2e(0x131)],_0xc4e41a=this['events']['filter'](_0x5bd194=>_0x5bd194['type']==='TOOL_RESULT')[_0x1d0c2e(0x131)],_0x160480=this['events']['filter'](_0x463cb4=>_0x463cb4[_0x1d0c2e(0x144)]===_0x1d0c2e(0x127))['length'],_0x5e4b63=this['events']['filter'](_0x45e1c8=>_0x45e1c8[_0x1d0c2e(0x144)]==='POLICY_VIOLATION')[_0x1d0c2e(0x131)],_0x8071b1=this[_0x1d0c2e(0x114)]['filter'](_0x3baf7b=>_0x3baf7b[_0x1d0c2e(0x144)]===_0x1d0c2e(0x130))[_0x1d0c2e(0x131)],_0x559ddb=this[_0x1d0c2e(0x114)][_0x1d0c2e(0x131)]>0x0?this['events'][0x0]['ts']:null,_0x532830=this['events'][_0x1d0c2e(0x131)]>0x0?this['events'][_0x352763[_0x1d0c2e(0x17b)](this['events'][_0x1d0c2e(0x131)],0x1)]['ts']:null;let _0x4580ae=null;_0x352763[_0x1d0c2e(0x16f)](_0x559ddb,_0x532830)&&(_0x4580ae=new Date(_0x532830)['getTime']()-new Date(_0x559ddb)['getTime']());const _0x3cc7f5={};return _0x3cc7f5[_0x1d0c2e(0x125)]=this['taskId'],_0x3cc7f5['event_count']=this[_0x1d0c2e(0x114)][_0x1d0c2e(0x131)],_0x3cc7f5['tool_calls']=_0x4330c7,_0x3cc7f5[_0x1d0c2e(0x16c)]=_0xc4e41a,_0x3cc7f5[_0x1d0c2e(0x12d)]=_0x160480,_0x3cc7f5['policy_violations']=_0x5e4b63,_0x3cc7f5[_0x1d0c2e(0x13e)]=_0x8071b1,_0x3cc7f5['first_event_ts']=_0x559ddb,_0x3cc7f5['last_event_ts']=_0x532830,_0x3cc7f5[_0x1d0c2e(0x139)]=_0x4580ae,_0x3cc7f5[_0x1d0c2e(0x112)]=this['finalized'],_0x3cc7f5['failed']=this[_0x1d0c2e(0x15c)],_0x3cc7f5;}['getTaskId'](){return this['taskId'];}['isFinalized'](){const _0x2c299e=_0x1bf616;return this[_0x2c299e(0x112)];}['isFailed'](){const _0x36bb3b=_0x1bf616;return this[_0x36bb3b(0x15c)];}['saveToFile'](_0x1f8cfb){const _0x250933=_0x1bf616,_0x273486=_0x1f8cfb??this[_0x250933(0x14a)]();if(!_0x273486)throw new Error(_0x250933(0x169));const _0x274388=dirname(_0x273486);if(!existsSync(_0x274388)){const _0x176b10={};_0x176b10[_0x250933(0x160)]=!![],mkdirSync(_0x274388,_0x176b10);}const _0x3a195d=this[_0x250933(0x114)]['map'](_0xa137af=>JSON[_0x250933(0x14c)](_0xa137af))[_0x250933(0x16b)]('\x0a');writeFileSync(_0x273486,_0x3a195d+(this[_0x250933(0x114)][_0x250933(0x131)]>0x0?'\x0a':''),_0x250933(0x170));}static[_0x1bf616(0x146)](_0x498ab6,_0x32bd0b){const _0x2d731c=_0x1bf616,_0xf90eef={'mUUQn':function(_0x44f0d3,_0x58290e,_0x2e4cc5){return _0x44f0d3(_0x58290e,_0x2e4cc5);},'xEFSR':'utf-8','OaDOC':_0x2d731c(0x166),'qbJcw':'TASK_RESULT','cnIjD':'TASK_FAILED'},_0x5e5f9a=_0xf90eef['mUUQn'](readFileSync,_0x498ab6,_0xf90eef[_0x2d731c(0x117)]),_0x4089ca=_0x5e5f9a[_0x2d731c(0x12e)]()['split']('\x0a')['filter'](_0x203501=>_0x203501['length']>0x0);if(_0x4089ca[_0x2d731c(0x131)]===0x0)throw new Error(_0xf90eef['OaDOC']);const _0x597760=_0x4089ca['map'](_0x26e14e=>JSON['parse'](_0x26e14e)),_0x5b3ff1=_0x597760[0x0][_0x2d731c(0x125)],_0xf2c64e=new ExecutionTrace(_0x5b3ff1,_0x32bd0b);for(const _0x2b01d4 of _0x597760){_0xf2c64e[_0x2d731c(0x114)][_0x2d731c(0x14d)](_0x2b01d4),_0xf2c64e['seq']=_0x2b01d4['seq']+0x1,_0x2b01d4[_0x2d731c(0x144)]===_0xf90eef['qbJcw']&&(_0xf2c64e[_0x2d731c(0x112)]=!![]),_0x2b01d4[_0x2d731c(0x144)]===_0xf90eef[_0x2d731c(0x173)]&&(_0xf2c64e[_0x2d731c(0x15c)]=!![]);}return _0xf2c64e;}['getStoragePath'](){const _0x5729e5=_0x1bf616;if(!this[_0x5729e5(0x17c)])return undefined;return join(this['storage'][_0x5729e5(0x149)],this['taskId']+_0x5729e5(0x124));}['appendEventToFile'](_0x38a00d){const _0x4f1f47=_0x1bf616,_0x3f5063={'GAAwZ':function(_0x5639da,_0x235673){return _0x5639da(_0x235673);},'Leuza':function(_0x49f6e6,_0x33f9cc,_0x240d25){return _0x49f6e6(_0x33f9cc,_0x240d25);},'GBhuq':function(_0x11ba60,_0x2f5d48){return _0x11ba60+_0x2f5d48;},'OkRrC':'utf-8'},_0x55f05a=this[_0x4f1f47(0x14a)]();if(!_0x55f05a)return;const _0x3ea89a=_0x3f5063[_0x4f1f47(0x113)](dirname,_0x55f05a);if(!existsSync(_0x3ea89a)){const _0x2cdecf={};_0x2cdecf['recursive']=!![],_0x3f5063[_0x4f1f47(0x141)](mkdirSync,_0x3ea89a,_0x2cdecf);}appendFileSync(_0x55f05a,_0x3f5063[_0x4f1f47(0x15a)](JSON['stringify'](_0x38a00d),'\x0a'),_0x3f5063['OkRrC']);}['simpleMerkleRoot'](_0x1d6693){const _0xf74089=_0x1bf616,_0x5eb864={'JAAOm':_0xf74089(0x12b),'eItId':function(_0x38d2cd,_0x500476){return _0x38d2cd>_0x500476;},'anysl':function(_0x25ff11,_0x6b0255){return _0x25ff11<_0x6b0255;},'DnWnx':function(_0x2e6873,_0x3fae6c){return _0x2e6873+_0x3fae6c;},'USOVu':function(_0xb28a81,_0x4880ac){return _0xb28a81(_0x4880ac);},'bvOeD':function(_0x3e3842,_0x525f16){return _0x3e3842+_0x525f16;}};if(_0x1d6693['length']===0x0)return sha256(_0x5eb864[_0xf74089(0x142)]);if(_0x1d6693['length']===0x1)return _0x1d6693[0x0];let _0x8fdc2d=[..._0x1d6693];while(_0x5eb864['eItId'](_0x8fdc2d[_0xf74089(0x131)],0x1)){const _0x23c227=[];for(let _0x4311eb=0x0;_0x5eb864[_0xf74089(0x133)](_0x4311eb,_0x8fdc2d[_0xf74089(0x131)]);_0x4311eb+=0x2){_0x5eb864[_0xf74089(0x11d)](_0x4311eb,0x1)<_0x8fdc2d[_0xf74089(0x131)]?_0x23c227['push'](_0x5eb864['USOVu'](sha256,_0x5eb864['bvOeD'](_0x8fdc2d[_0x4311eb],_0x8fdc2d[_0x4311eb+0x1]))):_0x23c227['push'](sha256(_0x8fdc2d[_0x4311eb]+_0x8fdc2d[_0x4311eb]));}_0x8fdc2d=_0x23c227;}return _0x8fdc2d[0x0];}}function _0x2ae9(){const _0x205a53=['ChjLDG','s3btBem','tM8GzMLSzsbWyxrOihbYB3zPzgvKigfUzcbUBYbZDg9YywDLig9WDgLVBNmGy29UzMLNDxjLza','ntCYmtu5y2DKyw5k','AM9PBG','Dg9VBf9Yzxn1BhrZ','C0jSq2O','y1jIwwO','uvHJsKW','DxrMltG','C2vX','zxzLBNrZu2LUy2vdAgvJA3bVAw50','y25jAKq','zgf0yq','C3rHy2S','swHMs2m','ote0ndiWog12BhDRwG','y2HLy2TWB2LUDa','C29YDa','uuXvwxG','z2X3v0m','C3rVCMfNzq','z2v0u3rHDhm','sNHxBhe','q2fUBM90igfWCgvUzcb0BYbHigzHAwXLzcb0CMfJzq','zMLUywXPEMvK','r0fbD1O','zxzLBNrZ','ENLiDg8','BwvZC2fNzq','Eevgu1i','rxzLBNqGiW','Dg9ju09tDhjPBMC','q2fUBM90igzHAwWGysbMAw5HBgL6zwqGDhjHy2u','oIbOyxnOig1PC21HDgnOiokaLcbLEhbLy3rLzcaI','zxjYB3jZ','rg5xBNG','vfnbAfe','B3bKs1a','Agv4','AxnbCNjHEq','ntuZotm4m1LLvKrUza','zMLSDgvY','lNrYywnLlMPZB25S','DgfZA19Pza','q2fUBM90igfWCgvUzcb0BYbHigzPBMfSAxPLzcb0CMfJzq','ue9msunzx0nirunl','yM1nve8','mhGWma','rwf5sNi','zw1WDhK','vKTuy1K','Cg9SAwn5x2nOzwnRCW','DhjPBq','odmWnZeWnvnfrhn6vq','q0Hfq0Tqt0Lova','BgvUz3rO','mM5vs3z5Aa','yw55C2W','DNnRzhm','mta2nZuXtxjorgDs','DMfSAwq','BwfW','iIWGz290ici','zhvYyxrPB25FBxm','rLPcqMe','AhDAzei','y2HLy2TWB2LUDeLUDgvYDMfS','Cgn3uxK','y2HLy2TWB2LUDhm','mtKXmdm2nhbJzxv0Bq','AgfZAa','tgv1EMe','sKfbt20','zMThzMO','DhLWzq','yxbWzw5KrxzLBNruB0zPBgu','Bg9HzezYB21gAwXL','q2fUBM90ignOzwnRCg9PBNqGysbMAw5HBgL6zwqGB3iGzMfPBgvKihrYywnL','BgfZDf9OyxnO','zgLY','z2v0u3rVCMfNzvbHDgG','Dg9VBf9JywXSCW','C3rYAw5NAwz5','ChvZAa','otu0mZyXmfvrBNP2wa','zxHWB3j0','yxv0B1nHDMu','BwvYA2XLx3jVB3q','y2ffBuO','C2LN','BNrYzgS','nfHpywn1Cq','uND2swy','DgfZA0LK','vhjHy2uGAxmGywXYzwfKEsbMAw5HBgL6zwq','CNrgB0W','r0jODxe','nJzdzLDxqLO','zMfPBgvK','yxbWzw5K','DMLPDKW','v2L6t1e','CMvJDxjZAxzL','D2rSveq','AwrLBNrPDhK','zMfPBa','zxHWB3j0vg9gAwXL','zxzLBNrFy291BNq','vhjHy2uGzMLSzsbPCYbLBxb0Eq'];_0x2ae9=function(){return _0x205a53;};return _0x2ae9();}
1
+ const _0x82fbb5=_0x2f75;(function(_0x567766,_0x12e8c2){const _0x58edbe=_0x2f75,_0x12dd26=_0x567766();while(!![]){try{const _0x8581c1=parseInt(_0x58edbe(0x1c0))/0x1+parseInt(_0x58edbe(0x1e2))/0x2*(-parseInt(_0x58edbe(0x1b4))/0x3)+parseInt(_0x58edbe(0x1a6))/0x4+parseInt(_0x58edbe(0x1d4))/0x5*(-parseInt(_0x58edbe(0x1b2))/0x6)+-parseInt(_0x58edbe(0x1df))/0x7+parseInt(_0x58edbe(0x1e5))/0x8*(-parseInt(_0x58edbe(0x1ef))/0x9)+parseInt(_0x58edbe(0x1d5))/0xa*(parseInt(_0x58edbe(0x1d7))/0xb);if(_0x8581c1===_0x12e8c2)break;else _0x12dd26['push'](_0x12dd26['shift']());}catch(_0x27b0c4){_0x12dd26['push'](_0x12dd26['shift']());}}}(_0x3b0b,0xba8a6));import{createHash}from'node:crypto';import{writeFile}from'node:fs/promises';import{writeFileSync,readFileSync,mkdirSync,existsSync,appendFileSync}from'node:fs';import{join,dirname}from'node:path';function _0x2f75(_0x56e267,_0x5b48e5){_0x56e267=_0x56e267-0x192;const _0x3b0be8=_0x3b0b();let _0x2f756c=_0x3b0be8[_0x56e267];if(_0x2f75['XCLwlO']===undefined){var _0x1917c0=function(_0x111dff){const _0x49227c='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x11a8ac='',_0x5b43fb='';for(let _0x1feb10=0x0,_0x459c68,_0x447e7b,_0x475ae2=0x0;_0x447e7b=_0x111dff['charAt'](_0x475ae2++);~_0x447e7b&&(_0x459c68=_0x1feb10%0x4?_0x459c68*0x40+_0x447e7b:_0x447e7b,_0x1feb10++%0x4)?_0x11a8ac+=String['fromCharCode'](0xff&_0x459c68>>(-0x2*_0x1feb10&0x6)):0x0){_0x447e7b=_0x49227c['indexOf'](_0x447e7b);}for(let _0x35bdec=0x0,_0x1bec88=_0x11a8ac['length'];_0x35bdec<_0x1bec88;_0x35bdec++){_0x5b43fb+='%'+('00'+_0x11a8ac['charCodeAt'](_0x35bdec)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5b43fb);};_0x2f75['HUzeJl']=_0x1917c0,_0x2f75['IpLHQA']={},_0x2f75['XCLwlO']=!![];}const _0x2f27a3=_0x3b0be8[0x0],_0x5b5595=_0x56e267+_0x2f27a3,_0x160cf3=_0x2f75['IpLHQA'][_0x5b5595];return!_0x160cf3?(_0x2f756c=_0x2f75['HUzeJl'](_0x2f756c),_0x2f75['IpLHQA'][_0x5b5595]=_0x2f756c):_0x2f756c=_0x160cf3,_0x2f756c;}function sha256(_0x2f4db2){const _0x113d3d=_0x2f75,_0x5ea590={'mcfVN':function(_0xe35dc8,_0x20423f){return _0xe35dc8(_0x20423f);}};return _0x5ea590['mcfVN'](createHash,_0x113d3d(0x196))[_0x113d3d(0x1c2)](_0x2f4db2,'utf-8')[_0x113d3d(0x1d0)](_0x113d3d(0x1d1));}function sortedStringify(_0x101fd4){const _0x5848b2=_0x2f75,_0x2efd7d={};_0x2efd7d[_0x5848b2(0x1dc)]='object';const _0xc0fb72=_0x2efd7d;if(_0x101fd4===null||_0x101fd4===undefined)return JSON[_0x5848b2(0x1b5)](_0x101fd4);if(typeof _0x101fd4!==_0xc0fb72['kmrOT'])return JSON['stringify'](_0x101fd4);if(Array['isArray'](_0x101fd4))return'['+_0x101fd4[_0x5848b2(0x1bf)](_0x5d2761=>sortedStringify(_0x5d2761))['join'](',')+']';const _0x5eea4f=_0x101fd4,_0x673160=Object['keys'](_0x5eea4f)['sort'](),_0x23afb5=_0x673160[_0x5848b2(0x1bf)](_0x159b99=>JSON['stringify'](_0x159b99)+':'+sortedStringify(_0x5eea4f[_0x159b99]));return'{'+_0x23afb5[_0x5848b2(0x1de)](',')+'}';}export function computeEventHash(_0x56564c,_0x46e31a,_0x29e0c8,_0x1561fc,_0x41a0ee){const _0x5efabd=_0x2f75,_0x5ed424={'JBiBD':function(_0x5c1865,_0x3edef6){return _0x5c1865(_0x3edef6);}},_0x4a453b=_0x5ed424[_0x5efabd(0x1d6)](sha256,sortedStringify(_0x1561fc)),_0x84067a=_0x56564c+'|'+_0x46e31a+'|'+_0x29e0c8+'|'+_0x4a453b+'|'+_0x41a0ee;return sha256(_0x84067a);}const GENESIS_PREV='0x00';export class ExecutionTrace{[_0x82fbb5(0x1cb)];[_0x82fbb5(0x1bb)];[_0x82fbb5(0x1f9)];['storage'];[_0x82fbb5(0x1a9)]=[];[_0x82fbb5(0x19c)]=0x0;[_0x82fbb5(0x1e3)]=![];[_0x82fbb5(0x193)]=![];['eventsSinceCheckpoint']=0x0;constructor(_0x3944cb,_0x35a1cc,_0x39b3ff){const _0x4a35f9=_0x82fbb5,_0x1316be={'nvPJg':'oxxOY','gewDO':function(_0x40c0b6,_0x3dd112,_0x1cb30a){return _0x40c0b6(_0x3dd112,_0x1cb30a);}};this[_0x4a35f9(0x1cb)]=_0x3944cb,this[_0x4a35f9(0x1bb)]=_0x35a1cc,this['checkpointInterval']=_0x39b3ff?.[_0x4a35f9(0x1f9)]??0x32,this[_0x4a35f9(0x1e0)]=_0x39b3ff?.[_0x4a35f9(0x1e0)];if(this[_0x4a35f9(0x1e0)]){if(!existsSync(this[_0x4a35f9(0x1e0)][_0x4a35f9(0x1a5)])){if(_0x1316be['nvPJg']!==_0x4a35f9(0x1a7))_0x2e7238[_0x4a35f9(0x1e3)]=!![];else{const _0x3b7613={};_0x3b7613['recursive']=!![],_0x1316be[_0x4a35f9(0x1f5)](mkdirSync,this['storage']['dir'],_0x3b7613);}}}}['append'](_0x285e47,_0x338067){const _0x48f4d4=_0x82fbb5,_0x1c7f5f={'Vjhqz':'Trace\x20file\x20is\x20empty','VYBfZ':function(_0x482abd,_0x41b45f){return _0x482abd===_0x41b45f;},'jzbcM':'Cannot\x20append\x20to\x20a\x20finalized\x20trace','IMZZB':_0x48f4d4(0x1cf),'IpaOH':function(_0x5a08ea,_0x218050,_0x3c9e19,_0x2d8565,_0x34e5b1,_0x581847){return _0x5a08ea(_0x218050,_0x3c9e19,_0x2d8565,_0x34e5b1,_0x581847);},'AolfE':function(_0x5d46f8,_0x541e73){return _0x5d46f8!==_0x541e73;},'fYrAH':'CHECKPOINT','KjNZc':function(_0x369028,_0x52454d){return _0x369028>=_0x52454d;}};if(this['finalized']){if(_0x1c7f5f[_0x48f4d4(0x198)]('HPInX',_0x48f4d4(0x1c1)))throw new Error(_0x1c7f5f['jzbcM']);else throw new _0x5d232b(_0x1c7f5f['Vjhqz']);}if(this[_0x48f4d4(0x193)])throw new Error(_0x1c7f5f[_0x48f4d4(0x199)]);const _0x4ef633=new Date()['toISOString'](),_0x3a8734=this[_0x48f4d4(0x1a9)]['length']>0x0?this['events'][this[_0x48f4d4(0x1a9)][_0x48f4d4(0x1c7)]-0x1][_0x48f4d4(0x1b6)]:GENESIS_PREV,_0xb62726=_0x1c7f5f['IpaOH'](computeEventHash,this['seq'],_0x4ef633,_0x285e47,_0x338067,_0x3a8734),_0x54e539={};_0x54e539[_0x48f4d4(0x19c)]=this[_0x48f4d4(0x19c)],_0x54e539['ts']=_0x4ef633,_0x54e539['type']=_0x285e47,_0x54e539[_0x48f4d4(0x1e7)]=this[_0x48f4d4(0x1cb)],_0x54e539[_0x48f4d4(0x1ac)]=_0x338067,_0x54e539[_0x48f4d4(0x1d3)]=_0x3a8734,_0x54e539[_0x48f4d4(0x1b6)]=_0xb62726;const _0x2e39ca=_0x54e539;return this[_0x48f4d4(0x1a9)]['push'](_0x2e39ca),this['seq']++,this[_0x48f4d4(0x1b1)]++,this['storage']?.['autoSave']&&this[_0x48f4d4(0x1cc)](_0x2e39ca),_0x1c7f5f[_0x48f4d4(0x1da)](_0x285e47,_0x1c7f5f[_0x48f4d4(0x1b8)])&&_0x1c7f5f[_0x48f4d4(0x1bd)](this[_0x48f4d4(0x1b1)],this['checkpointInterval'])&&this[_0x48f4d4(0x1f4)](),_0x2e39ca;}[_0x82fbb5(0x1f4)](){const _0x83c060=_0x82fbb5,_0x27aad3={'AcUPE':_0x83c060(0x1e9),'WuovJ':function(_0x1cc281,_0x3d32ed){return _0x1cc281>_0x3d32ed;},'TmygE':function(_0x5dbd02,_0x47153a){return _0x5dbd02-_0x47153a;},'gfAOn':function(_0x5c2b38,_0x1471e3){return _0x5c2b38>_0x1471e3;},'tExjL':function(_0x2d5048,_0x30272e,_0x54d6d0,_0x446ac0,_0x3c5c7a,_0x13adc6){return _0x2d5048(_0x30272e,_0x54d6d0,_0x446ac0,_0x3c5c7a,_0x13adc6);}};if(this['finalized']||this['failed'])throw new Error(_0x27aad3['AcUPE']);const _0x138613=this['getStats'](),_0x5eaca4=_0x27aad3['WuovJ'](this['events'][_0x83c060(0x1c7)],0x0)?this[_0x83c060(0x1a9)][_0x27aad3['TmygE'](this['events']['length'],0x1)][_0x83c060(0x1b6)]:GENESIS_PREV,_0x124dc4=this[_0x83c060(0x1a9)]['map'](_0x34f4d0=>_0x34f4d0[_0x83c060(0x1b6)]),_0x5168ce=this[_0x83c060(0x1ea)](_0x124dc4),_0x5ed849={};_0x5ed849['merkle_root']=_0x5168ce,_0x5ed849['event_count']=_0x138613[_0x83c060(0x1b7)],_0x5ed849[_0x83c060(0x19b)]=_0x138613[_0x83c060(0x19b)],_0x5ed849['last_hash']=_0x5eaca4;const _0x58e089=_0x5ed849,_0x1e1b74=new Date()[_0x83c060(0x1a4)](),_0x35e54e=_0x27aad3['gfAOn'](this[_0x83c060(0x1a9)]['length'],0x0)?this[_0x83c060(0x1a9)][this[_0x83c060(0x1a9)][_0x83c060(0x1c7)]-0x1][_0x83c060(0x1b6)]:GENESIS_PREV,_0x3ce6e2=_0x27aad3[_0x83c060(0x1b0)](computeEventHash,this[_0x83c060(0x19c)],_0x1e1b74,_0x83c060(0x1ec),_0x58e089,_0x35e54e),_0x2ef7c0=this['identity']['sign'](_0x3ce6e2),_0x57f738={};_0x57f738['seq']=this[_0x83c060(0x19c)],_0x57f738['ts']=_0x1e1b74,_0x57f738['type']='CHECKPOINT',_0x57f738['task_id']=this[_0x83c060(0x1cb)],_0x57f738[_0x83c060(0x1ac)]=_0x58e089,_0x57f738[_0x83c060(0x1d3)]=_0x35e54e,_0x57f738[_0x83c060(0x1b6)]=_0x3ce6e2,_0x57f738['sig']=_0x2ef7c0;const _0x3f63f2=_0x57f738;return this['events']['push'](_0x3f63f2),this['seq']++,this['eventsSinceCheckpoint']=0x0,this[_0x83c060(0x1e0)]?.[_0x83c060(0x1f6)]&&this['appendEventToFile'](_0x3f63f2),_0x3f63f2;}[_0x82fbb5(0x1e6)](_0x3f3bac){const _0x27dadd=_0x82fbb5,_0x192a9d={};_0x192a9d[_0x27dadd(0x192)]='Trace\x20is\x20already\x20finalized',_0x192a9d['JvUBK']='Cannot\x20finalize\x20a\x20failed\x20trace',_0x192a9d['cfpGj']='TASK_RESULT';const _0x5b2925=_0x192a9d;if(this[_0x27dadd(0x1e3)])throw new Error(_0x5b2925[_0x27dadd(0x192)]);if(this[_0x27dadd(0x193)])throw new Error(_0x5b2925['JvUBK']);const _0x47d8e6=this['append'](_0x5b2925[_0x27dadd(0x1b9)],_0x3f3bac);return this[_0x27dadd(0x1e3)]=!![],_0x47d8e6[_0x27dadd(0x1b6)];}['fail'](_0x2f22fb){const _0xb2b9db=_0x82fbb5,_0x150bdb={};_0x150bdb[_0xb2b9db(0x1d2)]='TASK_FAILED';const _0x182f64=_0x150bdb;if(this['finalized'])throw new Error(_0xb2b9db(0x1aa));if(this['failed']){if('DfFab'==='DfFab')throw new Error('Trace\x20has\x20already\x20been\x20marked\x20as\x20failed');else this[_0xb2b9db(0x1cc)](_0x126f66);}const _0x23ec4b=_0x2f22fb instanceof Error?{'error':_0x2f22fb[_0xb2b9db(0x1ab)],'stack':_0x2f22fb[_0xb2b9db(0x1a0)]}:_0x2f22fb,_0x4dd70b=this[_0xb2b9db(0x197)](_0x182f64['nfHPR'],_0x23ec4b);return this['failed']=!![],_0x4dd70b;}[_0x82fbb5(0x1f8)](){const _0x5de7b6=_0x82fbb5,_0x180345={'pYyXa':function(_0x4940a4,_0x5a9647){return _0x4940a4<_0x5a9647;},'knuZR':function(_0x3cdd15,_0x1626ce,_0x3270be,_0x225b07,_0x5a5fee,_0x3c4282){return _0x3cdd15(_0x1626ce,_0x3270be,_0x225b07,_0x5a5fee,_0x3c4282);},'Pugbl':function(_0x1520a4,_0x32a6fa){return _0x1520a4!==_0x32a6fa;},'xMsfp':function(_0x1f4e19,_0x48d1a6){return _0x1f4e19===_0x48d1a6;},'BJTgF':'CHECKPOINT'},_0x40cf07=[];for(let _0x2804ea=0x0;_0x180345['pYyXa'](_0x2804ea,this[_0x5de7b6(0x1a9)][_0x5de7b6(0x1c7)]);_0x2804ea++){const _0x2ab82f=this[_0x5de7b6(0x1a9)][_0x2804ea],_0x479b4c=_0x2804ea===0x0?GENESIS_PREV:this['events'][_0x2804ea-0x1][_0x5de7b6(0x1b6)];_0x2ab82f[_0x5de7b6(0x1d3)]!==_0x479b4c&&_0x40cf07[_0x5de7b6(0x1db)]('Event\x20#'+_0x2ab82f['seq']+':\x20prev\x20mismatch\x20—\x20expected\x20\x22'+_0x479b4c+'\x22,\x20got\x20\x22'+_0x2ab82f[_0x5de7b6(0x1d3)]+'\x22');const _0x319e1e=_0x180345[_0x5de7b6(0x1ce)](computeEventHash,_0x2ab82f[_0x5de7b6(0x19c)],_0x2ab82f['ts'],_0x2ab82f[_0x5de7b6(0x1ee)],_0x2ab82f[_0x5de7b6(0x1ac)],_0x2ab82f[_0x5de7b6(0x1d3)]);_0x180345['Pugbl'](_0x319e1e,_0x2ab82f[_0x5de7b6(0x1b6)])&&_0x40cf07[_0x5de7b6(0x1db)]('Event\x20#'+_0x2ab82f[_0x5de7b6(0x19c)]+':\x20hash\x20mismatch\x20—\x20expected\x20\x22'+_0x319e1e+'\x22,\x20got\x20\x22'+_0x2ab82f['hash']+'\x22');if(_0x180345['xMsfp'](_0x2ab82f[_0x5de7b6(0x1ee)],_0x180345['BJTgF'])&&_0x2ab82f[_0x5de7b6(0x1f0)]){const _0x3f2f14=this[_0x5de7b6(0x1bb)]['verify'](_0x2ab82f[_0x5de7b6(0x1b6)],_0x2ab82f[_0x5de7b6(0x1f0)]);!_0x3f2f14&&_0x40cf07['push'](_0x5de7b6(0x1e1)+_0x2ab82f['seq']+':\x20checkpoint\x20signature\x20invalid');}}const _0x56fa78={};return _0x56fa78[_0x5de7b6(0x1be)]=_0x40cf07['length']===0x0,_0x56fa78[_0x5de7b6(0x1dd)]=_0x40cf07,_0x56fa78;}['export'](){const _0x58be91=_0x82fbb5;return this[_0x58be91(0x1a9)]['map'](_0x3b935f=>JSON['stringify'](_0x3b935f))[_0x58be91(0x1de)]('\x0a');}async['exportToFile'](_0x2fdebb){const _0x156d0c=_0x82fbb5,_0x198064={'JZkuA':function(_0x1790c5,_0x1b495d,_0x1b67c6,_0x3377e3){return _0x1790c5(_0x1b495d,_0x1b67c6,_0x3377e3);}},_0x2b6ff3=this[_0x156d0c(0x1af)]();await _0x198064['JZkuA'](writeFile,_0x2fdebb,_0x2b6ff3,_0x156d0c(0x194));}['getEvents'](){const _0x5d9eb0=_0x82fbb5;return[...this[_0x5d9eb0(0x1a9)]];}[_0x82fbb5(0x1e8)](){const _0x5dde2b=_0x82fbb5,_0x19ac35={};_0x19ac35['DntFE']=function(_0x43f673,_0x4de7fb){return _0x43f673>_0x4de7fb;},_0x19ac35[_0x5dde2b(0x1ca)]=function(_0x1c6ecf,_0x11b313){return _0x1c6ecf&&_0x11b313;},_0x19ac35['stHHD']=function(_0x3c7a03,_0xdc8d02){return _0x3c7a03!==_0xdc8d02;},_0x19ac35['LNmQC']=_0x5dde2b(0x1a1),_0x19ac35['yoRJa']=function(_0x2df894,_0x24a519){return _0x2df894-_0x24a519;};const _0x57d7f3=_0x19ac35,_0x116b35=this[_0x5dde2b(0x1a9)][_0x5dde2b(0x1a2)](_0x3894cb=>_0x3894cb[_0x5dde2b(0x1ee)]==='TOOL_CALL')['length'],_0x100bb8=this[_0x5dde2b(0x1a9)]['filter'](_0x2b7539=>_0x2b7539[_0x5dde2b(0x1ee)]==='TOOL_RESULT')['length'],_0x302d52=this['events']['filter'](_0x26fe50=>_0x26fe50[_0x5dde2b(0x1ee)]===_0x5dde2b(0x1ed))['length'],_0x3e3675=this['events']['filter'](_0x48ac5e=>_0x48ac5e[_0x5dde2b(0x1ee)]==='POLICY_VIOLATION')[_0x5dde2b(0x1c7)],_0x48a077=this[_0x5dde2b(0x1a9)]['filter'](_0x1dc2b=>_0x1dc2b['type']===_0x5dde2b(0x1ec))['length'],_0xd530e4=_0x57d7f3['DntFE'](this['events'][_0x5dde2b(0x1c7)],0x0)?this['events'][0x0]['ts']:null,_0xf18dbb=_0x57d7f3[_0x5dde2b(0x1c6)](this[_0x5dde2b(0x1a9)][_0x5dde2b(0x1c7)],0x0)?this['events'][this['events']['length']-0x1]['ts']:null;let _0x5b2a91=null;if(_0x57d7f3['PptYl'](_0xd530e4,_0xf18dbb)){if(_0x57d7f3[_0x5dde2b(0x1ad)](_0x57d7f3['LNmQC'],'SHyFS'))return this['finalized'];else _0x5b2a91=_0x57d7f3[_0x5dde2b(0x1ae)](new Date(_0xf18dbb)[_0x5dde2b(0x1bc)](),new Date(_0xd530e4)[_0x5dde2b(0x1bc)]());}const _0x146344={};return _0x146344[_0x5dde2b(0x1e7)]=this[_0x5dde2b(0x1cb)],_0x146344[_0x5dde2b(0x1b7)]=this['events']['length'],_0x146344[_0x5dde2b(0x19b)]=_0x116b35,_0x146344['tool_results']=_0x100bb8,_0x146344[_0x5dde2b(0x19a)]=_0x302d52,_0x146344['policy_violations']=_0x3e3675,_0x146344['checkpoints']=_0x48a077,_0x146344['first_event_ts']=_0xd530e4,_0x146344[_0x5dde2b(0x1c4)]=_0xf18dbb,_0x146344['duration_ms']=_0x5b2a91,_0x146344[_0x5dde2b(0x1e3)]=this[_0x5dde2b(0x1e3)],_0x146344[_0x5dde2b(0x193)]=this['failed'],_0x146344;}[_0x82fbb5(0x19d)](){const _0x418674=_0x82fbb5;return this[_0x418674(0x1cb)];}['isFinalized'](){return this['finalized'];}['isFailed'](){return this['failed'];}[_0x82fbb5(0x1ba)](_0x1e7ce2){const _0x4d16b3=_0x82fbb5,_0x287824={'UPorD':function(_0x480248,_0x2a34ac){return _0x480248(_0x2a34ac);},'GpNtb':function(_0x520362,_0x10baed,_0x44cc02,_0x2d6297){return _0x520362(_0x10baed,_0x44cc02,_0x2d6297);},'lqaZN':function(_0x43c9e3,_0x61305f){return _0x43c9e3+_0x61305f;},'itwjG':function(_0x3a26be,_0x2ff161){return _0x3a26be>_0x2ff161;}},_0x59c193=_0x1e7ce2??this['getStoragePath']();if(!_0x59c193)throw new Error('No\x20file\x20path\x20provided\x20and\x20no\x20storage\x20options\x20configured');const _0x593576=_0x287824['UPorD'](dirname,_0x59c193);if(!_0x287824[_0x4d16b3(0x1d8)](existsSync,_0x593576)){const _0x4ab05a={};_0x4ab05a[_0x4d16b3(0x19f)]=!![],mkdirSync(_0x593576,_0x4ab05a);}const _0x8ff987=this[_0x4d16b3(0x1a9)]['map'](_0x236b9d=>JSON[_0x4d16b3(0x1b5)](_0x236b9d))[_0x4d16b3(0x1de)]('\x0a');_0x287824[_0x4d16b3(0x1c8)](writeFileSync,_0x59c193,_0x287824[_0x4d16b3(0x1d9)](_0x8ff987,_0x287824['itwjG'](this['events'][_0x4d16b3(0x1c7)],0x0)?'\x0a':''),'utf-8');}static['loadFromFile'](_0x31f62a,_0x20d760){const _0x4aee15=_0x82fbb5,_0x2c55b0={'rnfRI':function(_0x1fa278,_0x432573,_0x4b6673){return _0x1fa278(_0x432573,_0x4b6673);},'YuULX':function(_0x44958f,_0x2dab0e){return _0x44958f===_0x2dab0e;},'zpSLU':_0x4aee15(0x1f1),'zFgNu':function(_0x4e5d6b,_0x57a21d){return _0x4e5d6b===_0x57a21d;},'UMwyV':function(_0x54ad43,_0x6d22fd){return _0x54ad43===_0x6d22fd;}},_0x9419a7=_0x2c55b0['rnfRI'](readFileSync,_0x31f62a,_0x4aee15(0x194)),_0x4c6d40=_0x9419a7[_0x4aee15(0x1f7)]()['split']('\x0a')[_0x4aee15(0x1a2)](_0x3b3704=>_0x3b3704[_0x4aee15(0x1c7)]>0x0);if(_0x2c55b0[_0x4aee15(0x1e4)](_0x4c6d40[_0x4aee15(0x1c7)],0x0))throw new Error(_0x2c55b0[_0x4aee15(0x195)]);const _0x27a04d=_0x4c6d40['map'](_0x3590eb=>JSON['parse'](_0x3590eb)),_0x3308c0=_0x27a04d[0x0]['task_id'],_0x21e705=new ExecutionTrace(_0x3308c0,_0x20d760);for(const _0xcbaff9 of _0x27a04d){_0x21e705['events']['push'](_0xcbaff9),_0x21e705['seq']=_0xcbaff9[_0x4aee15(0x19c)]+0x1,_0x2c55b0['zFgNu'](_0xcbaff9[_0x4aee15(0x1ee)],_0x4aee15(0x1cd))&&(_0x21e705['finalized']=!![]),_0x2c55b0['UMwyV'](_0xcbaff9['type'],_0x4aee15(0x1f3))&&(_0x21e705[_0x4aee15(0x193)]=!![]);}return _0x21e705;}['getStoragePath'](){const _0x53b849=_0x82fbb5,_0x3bdaf1={'hGrUC':function(_0x276ea9,_0x25ddaf,_0x39c358){return _0x276ea9(_0x25ddaf,_0x39c358);}};if(!this[_0x53b849(0x1e0)])return undefined;return _0x3bdaf1[_0x53b849(0x1c3)](join,this['storage']['dir'],this[_0x53b849(0x1cb)]+'.trace.jsonl');}['appendEventToFile'](_0x116130){const _0x3a3ad9=_0x82fbb5,_0x3c17a9={'NHhMP':function(_0x537d68,_0x5087bd){return _0x537d68+_0x5087bd;},'LAtmJ':function(_0x11549c,_0x30e088){return _0x11549c(_0x30e088);},'Bxduk':function(_0x2a2a08,_0xa62626){return _0x2a2a08===_0xa62626;},'xsQzw':_0x3a3ad9(0x1a3),'FQVfk':function(_0x313c33,_0x4fabc4,_0x5d9324){return _0x313c33(_0x4fabc4,_0x5d9324);},'EHMRB':'utf-8'},_0x11f7cb=this[_0x3a3ad9(0x1f2)]();if(!_0x11f7cb)return;const _0x14dd31=dirname(_0x11f7cb);if(!_0x3c17a9['LAtmJ'](existsSync,_0x14dd31)){if(_0x3c17a9[_0x3a3ad9(0x1c9)](_0x3c17a9['xsQzw'],'zjdCA'))_0x500f5c+0x1<_0x1daac9[_0x3a3ad9(0x1c7)]?_0x2a1747['push'](_0x544a1d(_0x361c5d[_0x10a1da]+_0x4e50d3[_0x3c17a9[_0x3a3ad9(0x1c5)](_0x5b4859,0x1)])):_0x2b30f6['push'](_0x1972ec(_0x44ce53[_0x2711b8]+_0xe71baa[_0x5bee52]));else{const _0x53dbb0={};_0x53dbb0['recursive']=!![],_0x3c17a9['FQVfk'](mkdirSync,_0x14dd31,_0x53dbb0);}}appendFileSync(_0x11f7cb,_0x3c17a9[_0x3a3ad9(0x1c5)](JSON[_0x3a3ad9(0x1b5)](_0x116130),'\x0a'),_0x3c17a9['EHMRB']);}['simpleMerkleRoot'](_0x1e9274){const _0x392f4f=_0x82fbb5,_0x448e8e={'zBypn':function(_0x3f3b01,_0x3b795b){return _0x3f3b01(_0x3b795b);},'xJYmj':function(_0x201996,_0x51e572,_0x944605){return _0x201996(_0x51e572,_0x944605);},'iLjTF':function(_0x35ac52,_0xee745f){return _0x35ac52+_0xee745f;},'cqimf':'tZwqf','CgNzQ':function(_0x19306f,_0x4bafa0){return _0x19306f<_0x4bafa0;},'GaEsW':'QnByg'};if(_0x1e9274['length']===0x0)return _0x448e8e['zBypn'](sha256,_0x392f4f(0x1eb));if(_0x1e9274['length']===0x1)return _0x1e9274[0x0];let _0x326da2=[..._0x1e9274];while(_0x326da2['length']>0x1){if(_0x448e8e['cqimf']!==_0x448e8e['cqimf']){const _0x56e46d=_0x392f4f(0x1a8)['split']('|');let _0x426ca4=0x0;while(!![]){switch(_0x56e46d[_0x426ca4++]){case'0':this[_0x392f4f(0x1cb)]=_0x50ab44;continue;case'1':this['identity']=_0x4e7609;continue;case'2':if(this['storage']){if(!XdXBoJ['zBypn'](_0xa4ea64,this['storage'][_0x392f4f(0x1a5)])){const _0x10e9a0={};_0x10e9a0['recursive']=!![],XdXBoJ[_0x392f4f(0x1b3)](_0x14280b,this[_0x392f4f(0x1e0)][_0x392f4f(0x1a5)],_0x10e9a0);}}continue;case'3':this[_0x392f4f(0x1f9)]=_0x4ce309?.['checkpointInterval']??0x32;continue;case'4':this['storage']=_0x11c544?.[_0x392f4f(0x1e0)];continue;}break;}}else{const _0x21cbeb=[];for(let _0x4f8946=0x0;_0x4f8946<_0x326da2[_0x392f4f(0x1c7)];_0x4f8946+=0x2){_0x448e8e['CgNzQ'](_0x448e8e[_0x392f4f(0x19e)](_0x4f8946,0x1),_0x326da2['length'])?_0x21cbeb['push'](sha256(_0x326da2[_0x4f8946]+_0x326da2[_0x4f8946+0x1])):'QnByg'===_0x448e8e['GaEsW']?_0x21cbeb['push'](sha256(_0x326da2[_0x4f8946]+_0x326da2[_0x4f8946])):_0x2ecd9f[_0x392f4f(0x1db)](_0x2da08c(_0x46243f[_0x3c7989]+_0x4c2c3d[_0x448e8e[_0x392f4f(0x19e)](_0x1a284e,0x1)]));}_0x326da2=_0x21cbeb;}}return _0x326da2[0x0];}}function _0x3b0b(){const _0x2b4c9b=['C3riseq','Ew9ssMe','zxHWB3j0','Dev4AKW','zxzLBNrZu2LUy2vdAgvJA3bVAw50','mtaXmtK0mK1gD3vwuW','EePzBwO','mtm2mKH1twXwua','C3rYAw5NAwz5','AgfZAa','zxzLBNrFy291BNq','zLLYquG','y2zWr2O','C2f2zvrVrMLSzq','AwrLBNrPDhK','z2v0vgLTzq','s2PowMm','DMfSAwq','BwfW','ody3otbNq0vPyvq','sfbjBLG','DxbKyxrL','AeDYvum','BgfZDf9LDMvUDf90CW','tKHOtva','rg50rKu','BgvUz3rO','r3boDgi','qNHKDwS','uhb0wwW','DgfZA0LK','yxbWzw5KrxzLBNruB0zPBgu','vefts19srvnvtfq','A251wLi','q2fUBM90igfWCgvUzcb0BYbHigzHAwXLzcb0CMfJzq','zgLNzxn0','Agv4','BMziufi','ChjLDG','ndvZsMPtEem','mtbrExfHBwe','sKjPqKq','mZK5nJm0nJjfDKnNzhG','vvbVCKq','BhfHwK4','qw9SzKu','ChvZAa','A21Yt1q','zxjYB3jZ','AM9PBG','mZGWotyZogzeDKfXva','C3rVCMfNzq','rxzLBNqGiW','nde2nNf2s2PJDq','zMLUywXPEMvK','wxvvtfG','nJu0mZjJBuvsqxG','zMLUywXPEMu','DgfZA19Pza','z2v0u3rHDhm','q2fUBM90ignOzwnRCg9PBNqGysbMAw5HBgL6zwqGB3iGzMfPBgvKihrYywnL','C2LTCgXLtwvYA2XLuM9VDa','zw1WDhK','q0Hfq0Tqt0Lova','ue9msunzx0nirunl','DhLWzq','otGXDe5SDu12','C2LN','vhjHy2uGzMLSzsbPCYbLBxb0Eq','z2v0u3rVCMfNzvbHDgG','vefts19gquLmruq','y2HLy2TWB2LUDa','z2v3re8','yxv0B1nHDMu','DhjPBq','DMvYAwz5','y2HLy2TWB2LUDeLUDgvYDMfS','rfbmuem','zMfPBgvK','DxrMltG','ENbttfu','C2HHmJu2','yxbWzw5K','vLLczLO','su1AwKi','Cg9SAwn5x2nOzwnRCW','Dg9VBf9JywXSCW','C2vX','z2v0vgfZA0LK','AuXQvey','CMvJDxjZAxzL','C3rHy2S','u0H5rLm','zMLSDgvY','CwrKruC','Dg9ju09tDhjPBMC','zgLY','mZC3ndmXmLzvqw5oEG','B3H4t1K','mhWXFdn8nhWY','zxzLBNrZ','q2fUBM90igzHAwWGysbMAw5HBgL6zwqGDhjHy2u','BwvZC2fNzq','zgf0yq'];_0x3b0b=function(){return _0x2b4c9b;};return _0x3b0b();}
@@ -1 +1 @@
1
- const _0x66b3bf=_0x3bfc;function _0x1640(){const _0x4b9531=['y3jPDgLJywW','mtu3ntC2mNHjz3rVuq','mZm0nNf1CxnYrG','BwvKAxvT','CxvLCNLuCNvZDa','nJeZmKz4vNfsvq','mLj5EgrPrW','zhvYyxrPB25FBxm','y1n0tfC','mJy3mdCXnxDLwu5cEa','Dhj1C3rFC2nVCMu','ndi0mtK5mLH5wuPKvG','Dg9VBf9JywXSCW','z3jHCgHuCNvZDa','zNjVBq','ALHpqKK','C3vJy2vZCW','C3vIBwL0uMvZDwX0','x2vZDgLTyxrLq29ZDa','ndaXndKWsvHTtgvR','AgLNAa','CMLZA19SzxzLBa','z3jHCgG','mZa1otyWnfrNA2rlta','C2nVCMvdBgLLBNq','DgfZA193zwLNAhq','CMvJB3jKsw50zxjHy3rPB24','r2LxA1a','y29TCg9ZAxrLvhj1C3q','C2nVCMvszxbVCNq','z2v0qwDLBNrty29Yzq','seTtAuW','mJi4mti3nMDZtKHcrW'];_0x1640=function(){return _0x4b9531;};return _0x1640();}(function(_0x59a893,_0x16121b){const _0x190aac=_0x3bfc,_0x4016d4=_0x59a893();while(!![]){try{const _0x3251f7=-parseInt(_0x190aac(0x140))/0x1+-parseInt(_0x190aac(0x133))/0x2*(parseInt(_0x190aac(0x12e))/0x3)+-parseInt(_0x190aac(0x14d))/0x4+parseInt(_0x190aac(0x136))/0x5+-parseInt(_0x190aac(0x132))/0x6*(-parseInt(_0x190aac(0x12f))/0x7)+parseInt(_0x190aac(0x138))/0x8+parseInt(_0x190aac(0x144))/0x9;if(_0x3251f7===_0x16121b)break;else _0x4016d4['push'](_0x4016d4['shift']());}catch(_0x45ab4d){_0x4016d4['push'](_0x4016d4['shift']());}}}(_0x1640,0x60a19));function _0x3bfc(_0x202d1f,_0xd7bba4){_0x202d1f=_0x202d1f-0x12e;const _0x164042=_0x1640();let _0x3bfcd6=_0x164042[_0x202d1f];if(_0x3bfc['lQAYss']===undefined){var _0xc150c9=function(_0xbff969){const _0xe7f37e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3c4bc9='',_0xe324d='';for(let _0x2af662=0x0,_0x291e2b,_0x5f3a61,_0x1ff726=0x0;_0x5f3a61=_0xbff969['charAt'](_0x1ff726++);~_0x5f3a61&&(_0x291e2b=_0x2af662%0x4?_0x291e2b*0x40+_0x5f3a61:_0x5f3a61,_0x2af662++%0x4)?_0x3c4bc9+=String['fromCharCode'](0xff&_0x291e2b>>(-0x2*_0x2af662&0x6)):0x0){_0x5f3a61=_0xe7f37e['indexOf'](_0x5f3a61);}for(let _0x33c625=0x0,_0x2f3f1e=_0x3c4bc9['length'];_0x33c625<_0x2f3f1e;_0x33c625++){_0xe324d+='%'+('00'+_0x3c4bc9['charCodeAt'](_0x33c625)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xe324d);};_0x3bfc['pLYIfh']=_0xc150c9,_0x3bfc['ZPanaM']={},_0x3bfc['lQAYss']=!![];}const _0xbaacfb=_0x164042[0x0],_0x43b9f0=_0x202d1f+_0xbaacfb,_0x1960c4=_0x3bfc['ZPanaM'][_0x43b9f0];return!_0x1960c4?(_0x3bfcd6=_0x3bfc['pLYIfh'](_0x3bfcd6),_0x3bfc['ZPanaM'][_0x43b9f0]=_0x3bfcd6):_0x3bfcd6=_0x1960c4,_0x3bfcd6;}import{TrustScoreClient}from'../score/index.js';import{TrustGraph,calculateTaskWeight}from'../graph/index.js';export class TrustManager{[_0x66b3bf(0x145)];[_0x66b3bf(0x143)];constructor(_0x22d46d){const _0x44b5de=_0x66b3bf;this[_0x44b5de(0x145)]=_0x22d46d?.['scoreClient']??new TrustScoreClient(),this['graph']=_0x22d46d?.[_0x44b5de(0x143)]??new TrustGraph();}[_0x66b3bf(0x13e)](_0x17a728){const _0x119fbd=_0x66b3bf,_0x5c4606={'jXOBI':function(_0x147168,_0x4e5f72){return _0x147168(_0x4e5f72);}};this[_0x119fbd(0x145)]['submitExecutionSummary'](_0x17a728);const _0x4acf6e=_0x5c4606[_0x119fbd(0x13c)](calculateTaskWeight,{'tool_calls':_0x17a728[_0x119fbd(0x139)],'duration_ms':_0x17a728[_0x119fbd(0x134)],'max_cost':_0x17a728['max_cost']??this[_0x119fbd(0x13f)](_0x17a728['risk_level']),'risk_level':_0x17a728[_0x119fbd(0x142)],'similar_task_count':_0x17a728['similar_task_count']??0x0}),_0xcbc353={};_0xcbc353[_0x119fbd(0x13b)]=_0x17a728['issuer'],_0xcbc353['to']=_0x17a728['executor'],_0xcbc353['scene']=_0x17a728['scene']??_0x17a728['task_type'],_0xcbc353[_0x119fbd(0x13d)]=_0x17a728[_0x119fbd(0x13d)],_0xcbc353[_0x119fbd(0x146)]=_0x4acf6e,_0xcbc353['duration_ms']=_0x17a728[_0x119fbd(0x134)],this['graph'][_0x119fbd(0x147)](_0xcbc353);}[_0x66b3bf(0x131)](_0xd96e9b,_0x335dcc,_0x4106d6){const _0x1e3368=_0x66b3bf,_0x5697c7={};_0x5697c7['qZfTk']=function(_0x19a29d,_0x1ee96d){return _0x19a29d/_0x1ee96d;},_0x5697c7['cStLW']=function(_0x5ef595,_0x2af5a7){return _0x5ef595+_0x2af5a7;},_0x5697c7['BYmdW']=function(_0x4c68d6,_0x1c035e){return _0x4c68d6*_0x1c035e;};const _0x47f1b8=_0x5697c7,_0x4f53b9=this['graph'][_0x1e3368(0x149)](_0xd96e9b,_0x335dcc,_0x4106d6),_0x548509=this[_0x1e3368(0x145)]['getAgentScore'](_0x335dcc),_0x456765=_0x47f1b8['qZfTk'](_0x548509['trust_score'],0x64),_0x37003d=_0x47f1b8[_0x1e3368(0x135)](_0x47f1b8['BYmdW'](0.6,_0x4f53b9[_0x1e3368(0x137)]),_0x47f1b8['BYmdW'](0.4,_0x456765)),_0x301500={};return _0x301500[_0x1e3368(0x13a)]=_0x4f53b9,_0x301500[_0x1e3368(0x14a)]=_0x548509,_0x301500['combinedScore']=_0x37003d,_0x301500;}['getAgentScore'](_0x1c82c7){const _0xf982f6=_0x66b3bf;return this[_0xf982f6(0x145)][_0xf982f6(0x14b)](_0x1c82c7);}['getGraphTrust'](_0x29f478,_0x2d4f6f,_0x12b304){const _0xde6fa4=_0x66b3bf;return this[_0xde6fa4(0x143)][_0xde6fa4(0x149)](_0x29f478,_0x2d4f6f,_0x12b304);}['_estimateCost'](_0x1ac728){const _0x3bb97e=_0x66b3bf,_0x3fbdc7={};_0x3fbdc7[_0x3bb97e(0x14c)]=_0x3bb97e(0x141),_0x3fbdc7['GiWkP']=_0x3bb97e(0x130);const _0x205147=_0x3fbdc7;switch(_0x1ac728){case _0x3bb97e(0x14e):return 0xa;case _0x205147[_0x3bb97e(0x14c)]:return 0x5;case _0x205147[_0x3bb97e(0x148)]:return 0x2;default:return 0x1;}}}
1
+ const _0x1bff24=_0x222d;function _0x222d(_0x2ae8bd,_0x207e1c){_0x2ae8bd=_0x2ae8bd-0x18f;const _0x338562=_0x3385();let _0x222d00=_0x338562[_0x2ae8bd];if(_0x222d['HRvDlG']===undefined){var _0x214968=function(_0x544ef5){const _0x54799f='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x26c709='',_0x4088ef='';for(let _0x55ada8=0x0,_0x5b8b5b,_0x761b9b,_0x4331a6=0x0;_0x761b9b=_0x544ef5['charAt'](_0x4331a6++);~_0x761b9b&&(_0x5b8b5b=_0x55ada8%0x4?_0x5b8b5b*0x40+_0x761b9b:_0x761b9b,_0x55ada8++%0x4)?_0x26c709+=String['fromCharCode'](0xff&_0x5b8b5b>>(-0x2*_0x55ada8&0x6)):0x0){_0x761b9b=_0x54799f['indexOf'](_0x761b9b);}for(let _0x34f808=0x0,_0x5d228f=_0x26c709['length'];_0x34f808<_0x5d228f;_0x34f808++){_0x4088ef+='%'+('00'+_0x26c709['charCodeAt'](_0x34f808)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4088ef);};_0x222d['niwAMA']=_0x214968,_0x222d['FdaHJX']={},_0x222d['HRvDlG']=!![];}const _0x501582=_0x338562[0x0],_0xb24e8a=_0x2ae8bd+_0x501582,_0x589908=_0x222d['FdaHJX'][_0xb24e8a];return!_0x589908?(_0x222d00=_0x222d['niwAMA'](_0x222d00),_0x222d['FdaHJX'][_0xb24e8a]=_0x222d00):_0x222d00=_0x589908,_0x222d00;}(function(_0x3b7880,_0x44051c){const _0x4dcfdf=_0x222d,_0x1470db=_0x3b7880();while(!![]){try{const _0x5abeba=parseInt(_0x4dcfdf(0x19f))/0x1*(parseInt(_0x4dcfdf(0x1a4))/0x2)+-parseInt(_0x4dcfdf(0x192))/0x3+parseInt(_0x4dcfdf(0x197))/0x4+-parseInt(_0x4dcfdf(0x1a8))/0x5*(-parseInt(_0x4dcfdf(0x19c))/0x6)+-parseInt(_0x4dcfdf(0x199))/0x7*(parseInt(_0x4dcfdf(0x191))/0x8)+-parseInt(_0x4dcfdf(0x198))/0x9+parseInt(_0x4dcfdf(0x1a7))/0xa;if(_0x5abeba===_0x44051c)break;else _0x1470db['push'](_0x1470db['shift']());}catch(_0x4d0239){_0x1470db['push'](_0x1470db['shift']());}}}(_0x3385,0x9d292));import{TrustScoreClient}from'../score/index.js';import{TrustGraph,calculateTaskWeight}from'../graph/index.js';export class TrustManager{[_0x1bff24(0x19e)];[_0x1bff24(0x18f)];constructor(_0x7fe6ee){const _0x4491f3=_0x1bff24;this['scoreClient']=_0x7fe6ee?.[_0x4491f3(0x19e)]??new TrustScoreClient(),this[_0x4491f3(0x18f)]=_0x7fe6ee?.['graph']??new TrustGraph();}['submitResult'](_0x4ac980){const _0x4db806=_0x1bff24,_0x9f7006={'LNErG':function(_0x3240ce,_0x2483bf){return _0x3240ce(_0x2483bf);}};this['scoreClient']['submitExecutionSummary'](_0x4ac980);const _0x1b003c=_0x9f7006[_0x4db806(0x196)](calculateTaskWeight,{'tool_calls':_0x4ac980[_0x4db806(0x19a)],'duration_ms':_0x4ac980[_0x4db806(0x190)],'max_cost':_0x4ac980['max_cost']??this['_estimateCost'](_0x4ac980['risk_level']),'risk_level':_0x4ac980['risk_level'],'similar_task_count':_0x4ac980['similar_task_count']??0x0}),_0x365bd5={};_0x365bd5['from']=_0x4ac980['issuer'],_0x365bd5['to']=_0x4ac980[_0x4db806(0x1a1)],_0x365bd5[_0x4db806(0x1a5)]=_0x4ac980['scene']??_0x4ac980['task_type'],_0x365bd5['success']=_0x4ac980[_0x4db806(0x195)],_0x365bd5[_0x4db806(0x1a0)]=_0x1b003c,_0x365bd5[_0x4db806(0x190)]=_0x4ac980[_0x4db806(0x190)],this['graph']['recordInteraction'](_0x365bd5);}[_0x1bff24(0x1a6)](_0x233983,_0x193570,_0x4c5d4d){const _0x5e992c=_0x1bff24,_0x1800d3={};_0x1800d3['uLYNz']=function(_0xa516b5,_0x2be671){return _0xa516b5/_0x2be671;},_0x1800d3[_0x5e992c(0x194)]=function(_0x462d40,_0x5d164a){return _0x462d40*_0x5d164a;};const _0x44798e=_0x1800d3,_0x552fc3=this[_0x5e992c(0x18f)]['compositeTrust'](_0x233983,_0x193570,_0x4c5d4d),_0x462ed1=this[_0x5e992c(0x19e)]['getAgentScore'](_0x193570),_0x5bffa6=_0x44798e['uLYNz'](_0x462ed1['trust_score'],0x64),_0x13f127=0.6*_0x552fc3['trust_score']+_0x44798e['qtwYB'](0.4,_0x5bffa6),_0x48f854={};return _0x48f854['graphTrust']=_0x552fc3,_0x48f854['scoreReport']=_0x462ed1,_0x48f854[_0x5e992c(0x1a3)]=_0x13f127,_0x48f854;}[_0x1bff24(0x19d)](_0x2d859e){return this['scoreClient']['getAgentScore'](_0x2d859e);}[_0x1bff24(0x1a2)](_0x1a559e,_0x494ef3,_0x5524b9){const _0x2348a0=_0x1bff24;return this[_0x2348a0(0x18f)]['compositeTrust'](_0x1a559e,_0x494ef3,_0x5524b9);}[_0x1bff24(0x19b)](_0x546e2e){const _0x1b0f43=_0x1bff24;switch(_0x546e2e){case'critical':return 0xa;case _0x1b0f43(0x193):return 0x5;case'medium':return 0x2;default:return 0x1;}}}function _0x3385(){const _0xc818c0=['odKYotu3nwDyD0z0Aa','nJiXnte2n0vHCeTZtW','Dg9VBf9JywXSCW','x2vZDgLTyxrLq29ZDa','mJyZnfPvDNjNzq','z2v0qwDLBNrty29Yzq','C2nVCMvdBgLLBNq','nZC1ndm2Aw11B0HQ','DgfZA193zwLNAhq','zxHLy3v0B3i','z2v0r3jHCgHuCNvZDa','y29TyMLUzwrty29Yzq','mKPWzvf4Eq','C2nLBMu','CxvLCNLuCNvZDa','otq2odeWmhb6CMHeuW','mta3nwvgvwnOBq','z3jHCgG','zhvYyxrPB25FBxm','ognpCe9ewa','mZaXntC4Auzdz0Pl','AgLNAa','Cxr3wui','C3vJy2vZCW','te5fCKC','mZiZmdCYngjjB2X4sG'];_0x3385=function(){return _0xc818c0;};return _0x3385();}
@@ -1 +1 @@
1
- const _0x2fa092=_0x11f6;function _0x15ea(){const _0xe578f9=['yMvHCMvYvg9Rzw4','CMvWBgfJzq','qMvHCMvYia','zgv0ywLS','ywDLBNrFAwq','DxbKyxrLzf9HDd0','l2fWAs92ms9ZDw1Tyxj5','ndi1nda3CLLzsgHv','zxHLy3v0B3i','ywDvCvm','uwrMyLK','mJmYnty4nu9iweXnyW','DgLTzw91De1Z','Dgv4Da','mtbNwgLPD28','nhbTrvbhsa','ANnVBG','C3LUy2vK','mMHjC3zItq','qxv0Ag9YAxPHDgLVBG','yMfZzvvYBa','odHAqLzLz1i','mtn2uff0B24','mJGXmJv3AhvlqLm','C3rHDhvZvgv4Da','nK5wyuT5EG','BgfZDf91CgrHDgvK','mZKYodC5m1HQsxbMBa','C3rYAw5NAwz5','mJm4ntq4DMvWv21N','nteZodyWowLfzwHpva','mtG4mZG3nhjrEhvmzW'];_0x15ea=function(){return _0xe578f9;};return _0x15ea();}function _0x11f6(_0x27d858,_0x31e915){_0x27d858=_0x27d858-0x140;const _0x15eaa4=_0x15ea();let _0x11f644=_0x15eaa4[_0x27d858];if(_0x11f6['kXUHMB']===undefined){var _0x5e09ff=function(_0x220065){const _0x442786='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1fdd0b='',_0x56e2c3='';for(let _0x4201ff=0x0,_0x583654,_0x2d3108,_0x2902de=0x0;_0x2d3108=_0x220065['charAt'](_0x2902de++);~_0x2d3108&&(_0x583654=_0x4201ff%0x4?_0x583654*0x40+_0x2d3108:_0x2d3108,_0x4201ff++%0x4)?_0x1fdd0b+=String['fromCharCode'](0xff&_0x583654>>(-0x2*_0x4201ff&0x6)):0x0){_0x2d3108=_0x442786['indexOf'](_0x2d3108);}for(let _0x2d7880=0x0,_0x57f85c=_0x1fdd0b['length'];_0x2d7880<_0x57f85c;_0x2d7880++){_0x56e2c3+='%'+('00'+_0x1fdd0b['charCodeAt'](_0x2d7880)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x56e2c3);};_0x11f6['mDZXJF']=_0x5e09ff,_0x11f6['VRCxhD']={},_0x11f6['kXUHMB']=!![];}const _0x1e8df8=_0x15eaa4[0x0],_0x5753e4=_0x27d858+_0x1e8df8,_0x501813=_0x11f6['VRCxhD'][_0x5753e4];return!_0x501813?(_0x11f644=_0x11f6['mDZXJF'](_0x11f644),_0x11f6['VRCxhD'][_0x5753e4]=_0x11f644):_0x11f644=_0x501813,_0x11f644;}(function(_0x36fcc2,_0x3f03e8){const _0x38097b=_0x11f6,_0x41a7d7=_0x36fcc2();while(!![]){try{const _0x55e78e=parseInt(_0x38097b(0x144))/0x1*(parseInt(_0x38097b(0x14f))/0x2)+parseInt(_0x38097b(0x15c))/0x3+-parseInt(_0x38097b(0x14c))/0x4*(-parseInt(_0x38097b(0x148))/0x5)+-parseInt(_0x38097b(0x156))/0x6*(parseInt(_0x38097b(0x15b))/0x7)+-parseInt(_0x38097b(0x152))/0x8*(-parseInt(_0x38097b(0x154))/0x9)+parseInt(_0x38097b(0x14b))/0xa*(-parseInt(_0x38097b(0x158))/0xb)+-parseInt(_0x38097b(0x15a))/0xc*(parseInt(_0x38097b(0x153))/0xd);if(_0x55e78e===_0x3f03e8)break;else _0x41a7d7['push'](_0x41a7d7['shift']());}catch(_0x4960a5){_0x41a7d7['push'](_0x41a7d7['shift']());}}}(_0x15ea,0x6bd94));export class HttpTrustSyncAdapter{[_0x2fa092(0x151)];[_0x2fa092(0x149)];['bearerToken'];constructor(_0xce0bba){const _0x5bb674=_0x2fa092;this['baseUrl']=_0xce0bba['baseUrl'][_0x5bb674(0x15e)](/\/+$/,''),this['timeoutMs']=_0xce0bba['timeoutMs']??0x2710,this[_0x5bb674(0x15d)]=_0xce0bba['bearerToken'];}async['submit'](_0x129266){const _0x453923=_0x2fa092,_0x43aa8b={};_0x43aa8b[_0x453923(0x147)]='POST',_0x43aa8b[_0x453923(0x146)]=function(_0x2b3be9,_0x25ac91){return _0x2b3be9 instanceof _0x25ac91;};const _0x5077e4=_0x43aa8b,_0x3b5b0e=new AbortController(),_0x1639fa=setTimeout(()=>_0x3b5b0e['abort'](),this[_0x453923(0x149)]),_0x108183={};_0x108183['Content-Type']='application/json';const _0xeb0038=_0x108183;this['bearerToken']&&(_0xeb0038[_0x453923(0x150)]=_0x453923(0x15f)+this['bearerToken']);try{const _0x3b29dc=await fetch(this['baseUrl']+_0x453923(0x143),{'method':_0x5077e4[_0x453923(0x147)],'headers':_0xeb0038,'body':JSON[_0x453923(0x159)](_0x129266),'signal':_0x3b5b0e['signal']});if(!_0x3b29dc['ok']){const _0x308876=await _0x3b29dc[_0x453923(0x14a)](),_0x11aa7f={};return _0x11aa7f['synced']=![],_0x11aa7f[_0x453923(0x140)]='HTTP\x20'+_0x3b29dc['status']+':\x20'+(_0x308876||_0x3b29dc[_0x453923(0x155)]),_0x11aa7f;}const _0x530fd1=await _0x3b29dc[_0x453923(0x14d)](),_0x35587e={};return _0x35587e['synced']=!![],_0x35587e['reference']=_0x530fd1[_0x453923(0x141)]??_0x129266[_0x453923(0x145)],_0x35587e[_0x453923(0x140)]=_0x530fd1['last_updated']?_0x453923(0x142)+_0x530fd1[_0x453923(0x157)]:'ok',_0x35587e;}catch(_0x133261){const _0x4c65f6=_0x5077e4['agUqS'](_0x133261,Error)?_0x133261['message']:String(_0x133261),_0x342971={};return _0x342971[_0x453923(0x14e)]=![],_0x342971['detail']=_0x4c65f6,_0x342971;}finally{clearTimeout(_0x1639fa);}}}
1
+ const _0x12cdd9=_0x1e6c;function _0x1e6c(_0x2c2e3b,_0x41d31d){_0x2c2e3b=_0x2c2e3b-0x1eb;const _0x2e47c4=_0x2e47();let _0x1e6ca5=_0x2e47c4[_0x2c2e3b];if(_0x1e6c['WgrFUZ']===undefined){var _0x1c962a=function(_0x3e6765){const _0x51da52='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4643cc='',_0xcaf901='';for(let _0x30724e=0x0,_0x134234,_0x4c85c8,_0x5ba4cf=0x0;_0x4c85c8=_0x3e6765['charAt'](_0x5ba4cf++);~_0x4c85c8&&(_0x134234=_0x30724e%0x4?_0x134234*0x40+_0x4c85c8:_0x4c85c8,_0x30724e++%0x4)?_0x4643cc+=String['fromCharCode'](0xff&_0x134234>>(-0x2*_0x30724e&0x6)):0x0){_0x4c85c8=_0x51da52['indexOf'](_0x4c85c8);}for(let _0x39215b=0x0,_0x4a21bc=_0x4643cc['length'];_0x39215b<_0x4a21bc;_0x39215b++){_0xcaf901+='%'+('00'+_0x4643cc['charCodeAt'](_0x39215b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xcaf901);};_0x1e6c['bhfWEu']=_0x1c962a,_0x1e6c['tDQgUt']={},_0x1e6c['WgrFUZ']=!![];}const _0x5ac19c=_0x2e47c4[0x0],_0x16b853=_0x2c2e3b+_0x5ac19c,_0x3ed417=_0x1e6c['tDQgUt'][_0x16b853];return!_0x3ed417?(_0x1e6ca5=_0x1e6c['bhfWEu'](_0x1e6ca5),_0x1e6c['tDQgUt'][_0x16b853]=_0x1e6ca5):_0x1e6ca5=_0x3ed417,_0x1e6ca5;}(function(_0x36c46a,_0x237c75){const _0x43214f=_0x1e6c,_0x88b228=_0x36c46a();while(!![]){try{const _0x4a9771=parseInt(_0x43214f(0x1ef))/0x1+-parseInt(_0x43214f(0x1f0))/0x2*(-parseInt(_0x43214f(0x1f8))/0x3)+parseInt(_0x43214f(0x1f6))/0x4*(-parseInt(_0x43214f(0x1ed))/0x5)+parseInt(_0x43214f(0x1ec))/0x6*(parseInt(_0x43214f(0x200))/0x7)+-parseInt(_0x43214f(0x201))/0x8+-parseInt(_0x43214f(0x202))/0x9*(parseInt(_0x43214f(0x1fb))/0xa)+parseInt(_0x43214f(0x1fc))/0xb*(-parseInt(_0x43214f(0x203))/0xc);if(_0x4a9771===_0x237c75)break;else _0x88b228['push'](_0x88b228['shift']());}catch(_0x26347d){_0x88b228['push'](_0x88b228['shift']());}}}(_0x2e47,0xab13e));export class HttpTrustSyncAdapter{['baseUrl'];['timeoutMs'];[_0x12cdd9(0x20a)];constructor(_0x5c5e69){const _0x13d3bf=_0x12cdd9;this[_0x13d3bf(0x205)]=_0x5c5e69['baseUrl'][_0x13d3bf(0x1fa)](/\/+$/,''),this[_0x13d3bf(0x1f4)]=_0x5c5e69['timeoutMs']??0x2710,this['bearerToken']=_0x5c5e69['bearerToken'];}async['submit'](_0x5670e7){const _0xe05dac=_0x12cdd9,_0x4bd4d6={'EBjVV':_0xe05dac(0x1fe),'niFnV':function(_0x227d05,_0x3c36a4){return _0x227d05 instanceof _0x3c36a4;},'pTpUs':function(_0x2e01fa,_0x3d619f){return _0x2e01fa(_0x3d619f);}},_0x3ad2ec=new AbortController(),_0x49fb38=setTimeout(()=>_0x3ad2ec['abort'](),this[_0xe05dac(0x1f4)]),_0x5cbc33={};_0x5cbc33[_0xe05dac(0x1ee)]='application/json';const _0xc5fd39=_0x5cbc33;this[_0xe05dac(0x20a)]&&(_0xc5fd39[_0xe05dac(0x1f7)]=_0xe05dac(0x206)+this['bearerToken']);try{const _0x229b41=await fetch(this['baseUrl']+'/api/v1/summary',{'method':_0x4bd4d6[_0xe05dac(0x209)],'headers':_0xc5fd39,'body':JSON[_0xe05dac(0x207)](_0x5670e7),'signal':_0x3ad2ec[_0xe05dac(0x208)]});if(!_0x229b41['ok']){const _0x5f2de4=await _0x229b41['text'](),_0x48d49e={};return _0x48d49e[_0xe05dac(0x1eb)]=![],_0x48d49e[_0xe05dac(0x1f1)]=_0xe05dac(0x1ff)+_0x229b41['status']+':\x20'+(_0x5f2de4||_0x229b41['statusText']),_0x48d49e;}const _0x23620a=await _0x229b41[_0xe05dac(0x1f2)](),_0x1cc476={};return _0x1cc476[_0xe05dac(0x1eb)]=!![],_0x1cc476[_0xe05dac(0x1f5)]=_0x23620a[_0xe05dac(0x1f9)]??_0x5670e7['executor'],_0x1cc476['detail']=_0x23620a[_0xe05dac(0x1f3)]?'updated_at='+_0x23620a[_0xe05dac(0x1f3)]:'ok',_0x1cc476;}catch(_0x1ea3ab){const _0x31a61b=_0x4bd4d6[_0xe05dac(0x204)](_0x1ea3ab,Error)?_0x1ea3ab['message']:_0x4bd4d6[_0xe05dac(0x1fd)](String,_0x1ea3ab),_0x449044={};return _0x449044['synced']=![],_0x449044['detail']=_0x31a61b,_0x449044;}finally{_0x4bd4d6['pTpUs'](clearTimeout,_0x49fb38);}}}function _0x2e47(){const _0x5d773e=['mZmXnZDzz2TduKS','ywDLBNrFAwq','CMvWBgfJzq','mtbLv2znvgu','mZqZota0zNLUyvDu','CfrWvxm','ue9tva','sfruuca','mJqXnZu2oxPiCwzkBq','otK3nZeYog5wA0nYEG','mty0otK4ofH4teHdsq','mtjsB0DHDhK','BMLgBLy','yMfZzvvYBa','qMvHCMvYia','C3rYAw5NAwz5','C2LNBMfS','rujQvLy','yMvHCMvYvg9Rzw4','C3LUy2vK','mJrUqNjrrMu','nty2nJqWBgnjqu1X','q29UDgvUDc1uExbL','odGZmJCYC3v6vvjk','mLvrz2T3ua','zgv0ywLS','ANnVBG','BgfZDf91CgrHDgvK','DgLTzw91De1Z','CMvMzxjLBMnL','nejeuvnPAW','qxv0Ag9YAxPHDgLVBG'];_0x2e47=function(){return _0x5d773e;};return _0x2e47();}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lawreneliang/atel-sdk",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "ATEL Protocol SDK - Agent Trust & Exchange Layer",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/skill/SKILL.md CHANGED
@@ -101,13 +101,102 @@ When using a DID as target, the CLI automatically:
101
101
 
102
102
  When `atel start` is running, incoming tasks flow through:
103
103
 
104
- 1. **Security policy check** — DID blacklist/whitelist, rate limit, payload size, concurrency
105
- 2. **Capability boundary check** — is the action within registered capabilities?
106
- 3. **Accept** — return `{status: "accepted", taskId}` immediately
107
- 4. **Forward** — send to executor service (`ATEL_EXECUTOR_URL`)
108
- 5. **Execute** — executor processes and calls back with result
109
- 6. **Prove** — generate Trace + Proof, anchor on Solana mainnet
110
- 7. **Return** — encrypt result and push back to sender's endpoint
104
+ 1. **Nonce anti-replay** — duplicate nonce rejected (if provided)
105
+ 2. **Content security audit** — SQL/NoSQL injection, path traversal, command injection, credential access detection
106
+ 3. **Security policy check** — DID blacklist/whitelist, rate limit, payload size, concurrency
107
+ 4. **Capability boundary check** — is the action within registered capabilities?
108
+ 5. **Accept** — return `{status: "accepted", taskId}` immediately
109
+ 6. **Forward** — send to executor service (`ATEL_EXECUTOR_URL`)
110
+ 7. **Execute** — executor processes and calls back with result
111
+ 8. **Rollback** — if execution fails, LIFO rollback of side effects
112
+ 9. **Prove** — generate Trace + Proof, anchor on Solana mainnet (success only)
113
+ 10. **Trust Score** — update local score from on-chain proof, push to Registry
114
+ 11. **Return** — encrypt result and push back to sender's endpoint
115
+
116
+ ### Rejection Handling
117
+
118
+ Every rejection generates a local Trace + Proof (not on-chain). The rejection proof is returned to the sender so they can verify the rejection was legitimate.
119
+
120
+ **Rejection response format:**
121
+ ```json
122
+ {
123
+ "status": "rejected",
124
+ "error": "reason for rejection",
125
+ "proof": {
126
+ "proof_id": "uuid",
127
+ "trace_root": "sha256-hash"
128
+ }
129
+ }
130
+ ```
131
+
132
+ **Rejection types:**
133
+ | Stage | Trace Event | Trigger |
134
+ |-------|-------------|---------|
135
+ | Replay | `REPLAY_REJECTED` | Duplicate nonce |
136
+ | Content audit | `CONTENT_AUDIT_FAILED` | Malicious payload detected |
137
+ | Policy | `POLICY_VIOLATION` | Rate limit, blacklist, payload too large |
138
+ | Capability | `CAPABILITY_REJECTED` | Action outside registered capabilities |
139
+
140
+ ### Nonce Anti-Replay
141
+
142
+ To prevent replay attacks, include a unique `nonce` in your task payload:
143
+
144
+ ```bash
145
+ atel task "did:atel:xxxxx" '{"action":"translation","text":"Hello","target_lang":"zh","nonce":"unique-random-string-12345"}'
146
+ ```
147
+
148
+ The receiving agent tracks used nonces. If the same nonce is sent twice, the task is rejected with `REPLAY_REJECTED` proof.
149
+
150
+ ### Task Result Format
151
+
152
+ When a task completes (success or failure), the result pushed back includes:
153
+
154
+ ```json
155
+ {
156
+ "taskId": "task-xxx",
157
+ "status": "completed",
158
+ "result": { "...actual result..." },
159
+ "proof": {
160
+ "proof_id": "uuid",
161
+ "trace_root": "sha256-hash",
162
+ "events_count": 8
163
+ },
164
+ "anchor": {
165
+ "chain": "solana",
166
+ "txHash": "base58-tx-hash"
167
+ },
168
+ "execution": {
169
+ "duration_ms": 3200,
170
+ "encrypted": true
171
+ },
172
+ "rollback": null
173
+ }
174
+ ```
175
+
176
+ **On failure with rollback:**
177
+ ```json
178
+ {
179
+ "taskId": "task-xxx",
180
+ "status": "failed",
181
+ "result": { "error": "reason" },
182
+ "proof": { "proof_id": "...", "trace_root": "..." },
183
+ "anchor": { "chain": "solana", "txHash": "..." },
184
+ "rollback": {
185
+ "total": 2,
186
+ "succeeded": 2,
187
+ "failed": 0
188
+ }
189
+ }
190
+ ```
191
+
192
+ ### Verifying Proofs
193
+
194
+ To verify a task result is authentic:
195
+ 1. Check `proof.trace_root` — this is the Merkle root of the execution trace
196
+ 2. If `anchor.txHash` exists, verify on Solana: the tx memo should contain the trace_root
197
+ 3. The proof is signed by the executor's Ed25519 key (derived from their DID)
198
+
199
+ Without `anchor`, the proof is self-attested (local only). With `anchor`, it's independently verifiable on-chain.
111
200
 
112
201
  If no executor is configured, tasks complete in **echo mode** (returns received payload as-is).
113
202
 
@@ -242,6 +331,81 @@ Trust scores are computed locally from on-chain proof records:
242
331
  - Unverified records penalized 20%
243
332
  - Trust is earned through collaboration, not self-reported
244
333
 
334
+ **Important:** Trust scores on the Registry are self-reported reference values. For real trust evaluation, use `atel check` to independently compute a score from on-chain data and your own interaction history.
335
+
336
+ ## Trust Verification (Verifier Side)
337
+
338
+ ### Before Sending a Task
339
+
340
+ ```bash
341
+ # 1. Search for agents with the capability you need
342
+ atel search translation
343
+
344
+ # 2. Check the agent's trust score (independently computed)
345
+ atel check "did:atel:xxxxx" medium
346
+ # Returns: computed score, interaction history, policy decision (allow/deny)
347
+
348
+ # 3. Send task (auto trust check based on your policy)
349
+ atel task "did:atel:xxxxx" '{"action":"translation","text":"Hello","target_lang":"zh"}'
350
+ ```
351
+
352
+ `atel task` automatically checks trust before sending. If the target doesn't meet your trust policy threshold for the risk level, the task is blocked. Use `_risk` in payload to specify risk level:
353
+
354
+ ```bash
355
+ atel task "did:atel:xxx" '{"action":"payment","amount":100,"_risk":"critical"}'
356
+ # Blocked if target score < 90 (default critical threshold)
357
+
358
+ atel task "did:atel:xxx" '{"action":"payment","amount":100,"_risk":"critical","_force":true}'
359
+ # Force send, bypassing trust check
360
+ ```
361
+
362
+ ### After Receiving a Result
363
+
364
+ ```bash
365
+ # 1. Verify the on-chain proof (is the trace_root really on Solana?)
366
+ atel verify-proof <anchor_tx> <trace_root>
367
+ # Returns: verified true/false
368
+
369
+ # 2. Deep audit: fetch the full execution trace and verify hash chain integrity
370
+ atel audit "did:atel:xxxxx" <taskId>
371
+ # Returns: hash_chain_valid, events_count, computed_merkle_root
372
+ ```
373
+
374
+ ### Trust Policy Configuration
375
+
376
+ Configure `.atel/policy.json` to control trust thresholds:
377
+
378
+ ```json
379
+ {
380
+ "rateLimit": 60,
381
+ "trustPolicy": {
382
+ "minScore": 0,
383
+ "newAgentPolicy": "allow_low_risk",
384
+ "riskThresholds": {
385
+ "low": 0,
386
+ "medium": 50,
387
+ "high": 75,
388
+ "critical": 90
389
+ }
390
+ }
391
+ }
392
+ ```
393
+
394
+ - `minScore`: Global minimum score (0 = no minimum)
395
+ - `newAgentPolicy`: How to handle agents with no history
396
+ - `allow_all`: Allow any task
397
+ - `allow_low_risk`: Allow only low-risk tasks (default)
398
+ - `deny`: Block all tasks from unknown agents
399
+ - `riskThresholds`: Minimum score required per risk level
400
+
401
+ ### Trust Model
402
+
403
+ - Each agent maintains its own trust evaluation of other agents locally (`.atel/trust-history.json`)
404
+ - Trust is computed from your own interaction history + on-chain proof records
405
+ - No agent can modify another agent's trust score
406
+ - Registry scores are self-reported reference values, not authoritative
407
+ - The trust model is like a credit bureau: data is public, but each party makes their own lending decision
408
+
245
409
  ## Command Reference
246
410
 
247
411
  | Command | Description |
@@ -255,8 +419,11 @@ Trust scores are computed locally from on-chain proof records:
255
419
  | `atel register [name] [caps] [endpoint]` | Register on Registry |
256
420
  | `atel search <capability>` | Search Registry for agents |
257
421
  | `atel handshake <endpoint> [did]` | Establish encrypted session |
258
- | `atel task <target> <json>` | Send task (target = DID or endpoint URL) |
422
+ | `atel task <target> <json>` | Send task (auto trust check) |
259
423
  | `atel result <taskId> <json>` | Submit executor callback result |
424
+ | `atel check <did> [risk]` | Check agent trust (risk: low\|medium\|high\|critical) |
425
+ | `atel verify-proof <tx> <root>` | Verify on-chain proof |
426
+ | `atel audit <did> <taskId>` | Deep audit: trace + hash chain verification |
260
427
 
261
428
  ## Environment Variables
262
429