@sleep2agi/agent-network 2.3.0-preview.143 → 2.3.0-preview.145
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/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x534c7b=a0_0x47bc;(function(_0x7fa15b,_0x52b52b){const _0x1ba2bf=a0_0x47bc,_0x46fba5=_0x7fa15b();while(!![]){try{const _0x3529a6=-parseInt(_0x1ba2bf(0xd7))/0x1+-parseInt(_0x1ba2bf(0xde))/0x2+parseInt(_0x1ba2bf(0x9d))/0x3*(parseInt(_0x1ba2bf(0x97))/0x4)+-parseInt(_0x1ba2bf(0x7e))/0x5+parseInt(_0x1ba2bf(0xa7))/0x6*(parseInt(_0x1ba2bf(0xd5))/0x7)+parseInt(_0x1ba2bf(0xdb))/0x8+parseInt(_0x1ba2bf(0x7c))/0x9*(parseInt(_0x1ba2bf(0xc3))/0xa);if(_0x3529a6===_0x52b52b)break;else _0x46fba5['push'](_0x46fba5['shift']());}catch(_0x28bab1){_0x46fba5['push'](_0x46fba5['shift']());}}}(a0_0x59c9,0xd08ec));import{EventEmitter as a0_0x1281ff}from'events';import{hostname as a0_0x129268}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1ea1be,_0xe1524a)=>(_0x1ea1be??_0xe1524a)[a0_0x534c7b(0xe9)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x5d74a4){const _0x1d9bc9=a0_0x534c7b;return(_0x5d74a4 instanceof Error?_0x5d74a4['message']:String(_0x5d74a4??_0x1d9bc9(0xca)))['replace'](K,_0x1d9bc9(0xaf))[_0x1d9bc9(0xe9)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function a0_0x47bc(_0x44be75,_0x2a9af5){_0x44be75=_0x44be75-0x65;const _0x59c97a=a0_0x59c9();let _0x47bca8=_0x59c97a[_0x44be75];return _0x47bca8;}function O(_0x5e1b40,_0x1ca9d3=process.env.ANET_TASK_TRACE_FORMAT===a0_0x534c7b(0xa3)){const _0x488277=a0_0x534c7b;if(_0x1ca9d3)return JSON[_0x488277(0xb8)](_0x5e1b40);let _0x5094b3=L(_0x5e1b40[_0x488277(0x8d)],'<missing>'),_0x591f17=L(_0x5e1b40[_0x488277(0x73)],_0x488277(0x81)),_0x36d2a0=_0x5e1b40['error_code']?_0x488277(0x8b)+_0x5e1b40[_0x488277(0xad)]+':'+(_0x5e1b40[_0x488277(0xe4)]??''):'';return'[commhub:task]\x20'+_0x5e1b40['status']+_0x488277(0xb3)+L(_0x5e1b40[_0x488277(0xc8)],_0x488277(0x94))+_0x488277(0xdc)+L(_0x5e1b40[_0x488277(0xec)],'<unknown>')+_0x488277(0xbf)+_0x591f17+_0x488277(0xe0)+_0x5094b3+_0x488277(0xa4)+L(_0x5e1b40[_0x488277(0x76)],_0x488277(0x94))+_0x488277(0x6f)+_0x5e1b40[_0x488277(0x92)]+_0x488277(0x89)+_0x5e1b40[_0x488277(0xc0)]+'\x20lifecycle='+_0x5e1b40[_0x488277(0x7f)]+_0x36d2a0;}function U(_0x15514f){const _0x109cd2=a0_0x534c7b;return{'event':{'sending':_0x109cd2(0xc4),'delivered':_0x109cd2(0x65),'failed':'task.send.failed','acked':_0x109cd2(0x87),'started':_0x109cd2(0x70),'replied':_0x109cd2(0xb7),'expired':_0x109cd2(0xb5)}[_0x15514f[_0x109cd2(0xb6)]],..._0x15514f};}function a0_0x59c9(){const _0x5b458a=['message_id','3MyZXYw','match','type','inbox\x20error:\x20','string','connectSSE','json','\x20network_id=','alias','content','276kbeImw','error','reconnectDelay','AbortError','name','failed','error_code','heartbeatTimer','[REDACTED]','getReader','autoConnect','parse','\x20from=','server','task.expired','status','task.replied','stringify','report_status','connected','lifecycleTracking','sdk','missing_task_id','task','\x20task_id=','duration_ms','SSE\x20connected','POST','285410qCjCBP','task.send.start','SSE\x20error:\x20','emit','connect','from_alias','reply','unknown\x20error','text','sseAbort','now','startsWith','resumeId','call','send_reply',']\x20[commhub:','sleep','url','15260FrPXmN','abort','537703vjtoHq','text/event-stream','toAlias','getAllStatus','10136248lCDakz','\x20to=','fromAlias','2352552sRrUvh','parentTaskId','\x20parent_task_id=','2.0','min','signal','error_message','data:\x20','from_session','running','token','replace','split','sending','to_alias','catch','heartbeat\x20failed:\x20','task.send.delivered','delivered','send_message','pop','tools/call','SSE\x20reconnecting\x20in\x20','messages','Bearer\x20','/events/','completed','\x20transport=','task.started','normal','body','task_id','read','offline','network_id','result','s...','disconnected','processInbox','send_task','108BHumEV','get_inbox','1334575DJwqbV','lifecycle_tracking','application/json','<pending>','log','cwd','slice','CommHub\x20response\x20omitted\x20task_id','send_failed','task.ack','networkId','\x20duration_ms=','registered','\x20error=','toTimeString','parent_task_id','toString','agent','message','send_rejected','transport','Authorization','<unknown>','sdk-','broadcast','4501372VSPkHP','application/json,\x20text/event-stream','heartbeatInterval','mcp_http','send'];a0_0x59c9=function(){return _0x5b458a;};return a0_0x59c9();}function j(_0x399b12){const _0x160613=a0_0x534c7b;let _0x31323e=_0x399b12?.['task_id']||_0x399b12?.[_0x160613(0x9c)]||_0x399b12?.['id'];if(_0x31323e)return String(_0x31323e);let _0x11defa=_0x399b12?.[_0x160613(0xa6)]?.[0x0]?.[_0x160613(0xcb)];if(typeof _0x11defa!==_0x160613(0xa1))return null;try{let _0x276d1f=JSON['parse'](_0x11defa);return _0x276d1f?.[_0x160613(0x73)]||_0x276d1f?.['message_id']||_0x276d1f?.['id']||null;}catch{return null;}}async function X(_0x2d6689,_0x234150){const _0x23042f=a0_0x534c7b;let _0x4616b1=_0x234150[_0x23042f(0xcd)]??Date[_0x23042f(0xcd)],_0x367f44=_0x4616b1(),_0x2ae182=(_0xa22398,_0x9c00d7,_0x3ee450,_0x186be5)=>{const _0x164d8e=_0x23042f;_0x234150[_0x164d8e(0x82)](O(U({'from_alias':_0x2d6689[_0x164d8e(0xdd)],'to_alias':_0x2d6689[_0x164d8e(0xd9)],'task_id':_0x9c00d7,'parent_task_id':_0x2d6689[_0x164d8e(0xdf)],'network_id':_0x2d6689[_0x164d8e(0x88)],'transport':_0x2d6689[_0x164d8e(0x92)],'status':_0xa22398,'duration_ms':_0x4616b1()-_0x367f44,'lifecycle_tracking':_0x2d6689[_0x164d8e(0xbb)],..._0x3ee450!==void 0x0?{'error_code':_0x186be5||'send_failed','error_message':N(_0x3ee450)}:{}})));};_0x2ae182(_0x23042f(0xeb),null);try{let _0x2710fc=await _0x234150[_0x23042f(0x9b)](),_0x11f14f=j(_0x2710fc);if(_0x11f14f)_0x2ae182(_0x23042f(0x66),_0x11f14f);else{if(_0x2710fc?.['ok']===!0x1||_0x2710fc?.[_0x23042f(0xa8)])_0x2ae182(_0x23042f(0xac),_0x11f14f,_0x2710fc?.[_0x23042f(0xa8)]||'CommHub\x20rejected\x20task',_0x23042f(0x91));else _0x2ae182(_0x23042f(0xac),null,_0x23042f(0x85),_0x23042f(0xbd));}return _0x2710fc;}catch(_0x151c02){throw _0x2ae182('failed',null,_0x151c02,_0x23042f(0x86)),_0x151c02;}}async function Y(_0x47ac8a,_0x28793b){const _0x38722a=a0_0x534c7b;return X({'fromAlias':_0x47ac8a[_0x38722a(0xdd)],'toAlias':_0x47ac8a[_0x38722a(0xa5)],'parentTaskId':_0x47ac8a[_0x38722a(0xdf)]||null,'networkId':_0x47ac8a['networkId']||null,'transport':_0x38722a(0x9a),'lifecycleTracking':'not_tracked'},_0x28793b);}class $ extends a0_0x1281ff{['url'];[a0_0x534c7b(0xa5)];['token'];[a0_0x534c7b(0x8f)];[a0_0x534c7b(0xcf)];[a0_0x534c7b(0x99)];['reconnectDelay'];[a0_0x534c7b(0xae)];[a0_0x534c7b(0xcc)];['running']=!0x1;constructor(_0xff663e){const _0x5e4777=a0_0x534c7b;super();if(this[_0x5e4777(0xd4)]=_0xff663e['url'][_0x5e4777(0xe9)](/\/$/,''),this['alias']=_0xff663e[_0x5e4777(0xa5)],this[_0x5e4777(0xe8)]=_0xff663e['token'],this[_0x5e4777(0x8f)]=_0xff663e[_0x5e4777(0x8f)]||_0x5e4777(0xbc),this[_0x5e4777(0xcf)]=_0x5e4777(0x95)+_0xff663e[_0x5e4777(0xa5)]+'-'+Date[_0x5e4777(0xcd)]()[_0x5e4777(0x8e)](0x24),this[_0x5e4777(0x99)]=_0xff663e[_0x5e4777(0x99)]??0x2bf20,this['reconnectDelay']=_0xff663e[_0x5e4777(0xa9)]??0xbb8,_0xff663e[_0x5e4777(0xb1)]!==!0x1)this[_0x5e4777(0xc7)]();}[a0_0x534c7b(0x82)](_0x559aa4){const _0x5a037f=a0_0x534c7b;console[_0x5a037f(0x82)]('['+new Date()[_0x5a037f(0x8c)]()[_0x5a037f(0x84)](0x0,0x8)+_0x5a037f(0xd2)+this[_0x5a037f(0xa5)]+']\x20'+_0x559aa4);}async[a0_0x534c7b(0xd0)](_0x51f861,_0x491367){const _0x4794f4=a0_0x534c7b;let _0x4598d={'Content-Type':_0x4794f4(0x80),'Accept':_0x4794f4(0x98)};if(this[_0x4794f4(0xe8)])_0x4598d[_0x4794f4(0x93)]=_0x4794f4(0x6c)+this[_0x4794f4(0xe8)];let _0x50b22e=await(await fetch(this[_0x4794f4(0xd4)]+'/mcp',{'method':_0x4794f4(0xc2),'headers':_0x4598d,'body':JSON[_0x4794f4(0xb8)]({'jsonrpc':_0x4794f4(0xe1),'id':Date[_0x4794f4(0xcd)](),'method':_0x4794f4(0x69),'params':{'name':_0x51f861,'arguments':_0x491367}})}))[_0x4794f4(0xcb)](),_0x492d95=_0x50b22e[_0x4794f4(0x9e)](/data: (.+)/),_0x23dc66=_0x492d95?JSON[_0x4794f4(0xb2)](_0x492d95[0x1]):JSON[_0x4794f4(0xb2)](_0x50b22e),_0x337c37=_0x23dc66?.[_0x4794f4(0x77)]?.[_0x4794f4(0xa6)]?.[0x0]?.['text'];return _0x337c37?JSON['parse'](_0x337c37):_0x23dc66;}async[a0_0x534c7b(0xc7)](){const _0x1c72bf=a0_0x534c7b;if(this[_0x1c72bf(0xe7)])return;this[_0x1c72bf(0xe7)]=!0x0,await this[_0x1c72bf(0xb6)]('idle'),this[_0x1c72bf(0x82)](_0x1c72bf(0x8a)),this['heartbeatTimer']=setInterval(()=>{const _0x2e8048=_0x1c72bf;this['status']('idle')[_0x2e8048(0xed)](_0x53d31d=>this[_0x2e8048(0x82)](_0x2e8048(0xee)+_0x53d31d[_0x2e8048(0x90)]));},this[_0x1c72bf(0x99)]),this[_0x1c72bf(0xa2)]();}async['disconnect'](){const _0x1ccec9=a0_0x534c7b;if(this['running']=!0x1,this[_0x1ccec9(0xcc)]?.[_0x1ccec9(0xd6)](),this[_0x1ccec9(0xae)])clearInterval(this[_0x1ccec9(0xae)]);await this[_0x1ccec9(0xb6)](_0x1ccec9(0x75))[_0x1ccec9(0xed)](()=>{}),this['log'](_0x1ccec9(0x79));}async[a0_0x534c7b(0x9b)](_0x55236e,_0x3a8459,_0x24bfc1=a0_0x534c7b(0x71)){const _0x9435c8=a0_0x534c7b;return Y({'alias':_0x55236e,'fromAlias':this[_0x9435c8(0xa5)]},{'log':_0x4db526=>console[_0x9435c8(0x82)](_0x4db526),'send':()=>this[_0x9435c8(0xd0)](_0x9435c8(0x7b),{'alias':_0x55236e,'task':_0x3a8459,'priority':_0x24bfc1,'from_session':this[_0x9435c8(0xa5)]})});}async['message'](_0xb7fb4b,_0x318d32){const _0x2ae8bd=a0_0x534c7b;return this[_0x2ae8bd(0xd0)](_0x2ae8bd(0x67),{'alias':_0xb7fb4b,'message':_0x318d32,'from_session':this[_0x2ae8bd(0xa5)]});}async[a0_0x534c7b(0xc9)](_0x435fb3,_0x42e151,_0x957a73=a0_0x534c7b(0x6e)){const _0x45c118=a0_0x534c7b;return this['call'](_0x45c118(0xd1),{'in_reply_to':_0x435fb3,'text':_0x42e151,'status':_0x957a73});}async[a0_0x534c7b(0xb6)](_0x45c9ab,_0x1ce4d6){const _0x44c196=a0_0x534c7b;return this['call'](_0x44c196(0xb9),{'resume_id':this[_0x44c196(0xcf)],'alias':this[_0x44c196(0xa5)],'status':_0x45c9ab,'server':a0_0x129268(),'hostname':a0_0x129268(),'agent':this['agent'],'project_dir':process[_0x44c196(0x83)](),..._0x1ce4d6});}async[a0_0x534c7b(0xda)](){const _0x5950b7=a0_0x534c7b;return this[_0x5950b7(0xd0)]('get_all_status',{});}async[a0_0x534c7b(0x96)](_0x163c84,_0x3e45eb){const _0x3d8b5d=a0_0x534c7b;return this[_0x3d8b5d(0xd0)](_0x3d8b5d(0x96),{'message':_0x163c84,'filter_server':_0x3e45eb?.[_0x3d8b5d(0xb4)],'filter_status':_0x3e45eb?.[_0x3d8b5d(0xb6)]});}async[a0_0x534c7b(0xa2)](){const _0x63abc1=a0_0x534c7b;let _0x4f51c0=encodeURIComponent(this[_0x63abc1(0xa5)]),_0x159568=this[_0x63abc1(0xd4)]+_0x63abc1(0x6d)+_0x4f51c0,_0x2b993a=this[_0x63abc1(0xa9)];while(this[_0x63abc1(0xe7)]){try{this[_0x63abc1(0xcc)]=new AbortController();let _0xfee657={'Accept':_0x63abc1(0xd8)};if(this[_0x63abc1(0xe8)])_0xfee657[_0x63abc1(0x93)]=_0x63abc1(0x6c)+this[_0x63abc1(0xe8)];let _0x27890c=await fetch(_0x159568,{'headers':_0xfee657,'signal':this[_0x63abc1(0xcc)][_0x63abc1(0xe3)]});if(!_0x27890c['ok']||!_0x27890c['body']){this[_0x63abc1(0x82)]('SSE\x20failed:\x20'+_0x27890c[_0x63abc1(0xb6)]),await this[_0x63abc1(0xd3)](_0x2b993a),_0x2b993a=Math[_0x63abc1(0xe2)](_0x2b993a*1.5,0xea60);continue;}_0x2b993a=this[_0x63abc1(0xa9)];let _0x3fda30=_0x27890c[_0x63abc1(0x72)][_0x63abc1(0xb0)](),_0x4cbb5d=new TextDecoder(),_0x146c5c='';while(this[_0x63abc1(0xe7)]){let {done:_0x3a83f4,value:_0x2fbbb1}=await _0x3fda30[_0x63abc1(0x74)]();if(_0x3a83f4)break;_0x146c5c+=_0x4cbb5d['decode'](_0x2fbbb1,{'stream':!0x0});let _0x5e51fb=_0x146c5c[_0x63abc1(0xea)]('\x0a');_0x146c5c=_0x5e51fb[_0x63abc1(0x68)]()||'';for(let _0x2a8259 of _0x5e51fb){if(!_0x2a8259[_0x63abc1(0xce)](_0x63abc1(0xe5)))continue;try{let _0x4c4de6=JSON['parse'](_0x2a8259[_0x63abc1(0x84)](0x6));if(_0x4c4de6[_0x63abc1(0x9f)]===_0x63abc1(0xba)){this[_0x63abc1(0x82)](_0x63abc1(0xc1)),this[_0x63abc1(0xc6)](_0x63abc1(0xba));continue;}if(_0x4c4de6[_0x63abc1(0x9f)]==='new_task'||_0x4c4de6[_0x63abc1(0x9f)]==='new_message'||_0x4c4de6[_0x63abc1(0x9f)]===_0x63abc1(0x96))await this[_0x63abc1(0x7a)]();}catch{}}}}catch(_0x327b75){if(_0x327b75[_0x63abc1(0xab)]===_0x63abc1(0xaa))break;this[_0x63abc1(0xc6)]('error',_0x327b75),this['log'](_0x63abc1(0xc5)+_0x327b75[_0x63abc1(0x90)]);}if(this[_0x63abc1(0xe7)])this[_0x63abc1(0xc6)]('disconnected'),this[_0x63abc1(0x82)](_0x63abc1(0x6a)+_0x2b993a/0x3e8+_0x63abc1(0x78)),await this[_0x63abc1(0xd3)](_0x2b993a),_0x2b993a=Math[_0x63abc1(0xe2)](_0x2b993a*1.5,0xea60);}}async[a0_0x534c7b(0x7a)](){const _0x240d2d=a0_0x534c7b;try{let _0x459a7c=(await this[_0x240d2d(0xd0)](_0x240d2d(0x7d),{'alias':this[_0x240d2d(0xa5)],'limit':0xa}))?.[_0x240d2d(0x6b)]||[];for(let _0x456b70 of _0x459a7c)await this['call']('ack_inbox',{'alias':this[_0x240d2d(0xa5)],'message_id':_0x456b70['id']}),this['log']('←\x20'+_0x456b70[_0x240d2d(0xe6)]+':\x20'+_0x456b70[_0x240d2d(0xa6)][_0x240d2d(0x84)](0x0,0x3c)),this[_0x240d2d(0xc6)](_0x240d2d(0xbe),_0x456b70),this[_0x240d2d(0xc6)](_0x240d2d(0x90),_0x456b70);}catch(_0x36dbe4){this[_0x240d2d(0x82)](_0x240d2d(0xa0)+_0x36dbe4[_0x240d2d(0x90)]);}}['sleep'](_0x43c676){return new Promise(_0x67e119=>setTimeout(_0x67e119,_0x43c676));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x58cada=a0_0x5441;(function(_0x1621f7,_0x58a20b){const _0x5eca70=a0_0x5441,_0x8de785=_0x1621f7();while(!![]){try{const _0x56b16d=-parseInt(_0x5eca70(0x113))/0x1+parseInt(_0x5eca70(0xe8))/0x2*(-parseInt(_0x5eca70(0xc5))/0x3)+-parseInt(_0x5eca70(0xcc))/0x4*(-parseInt(_0x5eca70(0xea))/0x5)+parseInt(_0x5eca70(0xde))/0x6+parseInt(_0x5eca70(0xb3))/0x7+-parseInt(_0x5eca70(0x10b))/0x8*(-parseInt(_0x5eca70(0xe5))/0x9)+parseInt(_0x5eca70(0x107))/0xa*(parseInt(_0x5eca70(0xd9))/0xb);if(_0x56b16d===_0x58a20b)break;else _0x8de785['push'](_0x8de785['shift']());}catch(_0x37ad15){_0x8de785['push'](_0x8de785['shift']());}}}(a0_0x1a7e,0xd78fa));import{EventEmitter as a0_0x41d38a}from'events';import{hostname as a0_0x445e88}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x445d6b,_0x482ae0)=>(_0x445d6b??_0x482ae0)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x58cada(0xf2)](0x0,0xf0);function N(_0x59f14d){const _0x1c97a3=a0_0x58cada;return(_0x59f14d instanceof Error?_0x59f14d[_0x1c97a3(0xc7)]:String(_0x59f14d??_0x1c97a3(0x10f)))[_0x1c97a3(0x10e)](K,'[REDACTED]')[_0x1c97a3(0x10e)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x329be0,_0x1f22cb=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x4e69bb=a0_0x58cada;if(_0x1f22cb)return JSON[_0x4e69bb(0xb7)](_0x329be0);let _0x39eb39=L(_0x329be0['parent_task_id'],_0x4e69bb(0xe0)),_0xac0405=L(_0x329be0[_0x4e69bb(0xee)],'<pending>'),_0x597670=_0x329be0[_0x4e69bb(0xba)]?_0x4e69bb(0xc0)+_0x329be0[_0x4e69bb(0xba)]+':'+(_0x329be0[_0x4e69bb(0x10a)]??''):'';return _0x4e69bb(0xd3)+_0x329be0[_0x4e69bb(0xc8)]+_0x4e69bb(0xff)+L(_0x329be0[_0x4e69bb(0x105)],_0x4e69bb(0x109))+'\x20to='+L(_0x329be0[_0x4e69bb(0x121)],_0x4e69bb(0x109))+'\x20task_id='+_0xac0405+_0x4e69bb(0xda)+_0x39eb39+_0x4e69bb(0x119)+L(_0x329be0[_0x4e69bb(0xb2)],_0x4e69bb(0x109))+_0x4e69bb(0xd8)+_0x329be0[_0x4e69bb(0xaf)]+'\x20duration_ms='+_0x329be0['duration_ms']+_0x4e69bb(0xb8)+_0x329be0[_0x4e69bb(0xef)]+_0x597670;}function a0_0x5441(_0x6276cd,_0x29c6ce){_0x6276cd=_0x6276cd-0xaa;const _0x1a7efc=a0_0x1a7e();let _0x544106=_0x1a7efc[_0x6276cd];return _0x544106;}function U(_0x1baf21){const _0x23bb58=a0_0x58cada;return{'event':{'sending':_0x23bb58(0xfd),'delivered':_0x23bb58(0xcf),'failed':'task.send.failed','acked':_0x23bb58(0x110),'started':'task.started','replied':_0x23bb58(0x112),'expired':_0x23bb58(0xb4)}[_0x1baf21[_0x23bb58(0xc8)]],..._0x1baf21};}function j(_0x40b313){const _0x16f836=a0_0x58cada;let _0x3a0e81=_0x40b313?.[_0x16f836(0xee)]||_0x40b313?.[_0x16f836(0xaa)]||_0x40b313?.['id'];if(_0x3a0e81)return String(_0x3a0e81);let _0x3f08d1=_0x40b313?.['content']?.[0x0]?.['text'];if(typeof _0x3f08d1!==_0x16f836(0xb5))return null;try{let _0x51df9e=JSON[_0x16f836(0xdd)](_0x3f08d1);return _0x51df9e?.[_0x16f836(0xee)]||_0x51df9e?.[_0x16f836(0xaa)]||_0x51df9e?.['id']||null;}catch{return null;}}async function X(_0x20ca9d,_0x4fd9bf){const _0x130f2f=a0_0x58cada;let _0x13d60f=_0x4fd9bf[_0x130f2f(0xab)]??Date['now'],_0x43518c=_0x13d60f(),_0x5c234b=(_0x5a0131,_0x3fa617,_0x44f866,_0x3686f1)=>{const _0x5d855a=_0x130f2f;_0x4fd9bf[_0x5d855a(0xce)](O(U({'from_alias':_0x20ca9d[_0x5d855a(0xe4)],'to_alias':_0x20ca9d[_0x5d855a(0x11c)],'task_id':_0x3fa617,'parent_task_id':_0x20ca9d[_0x5d855a(0xf4)],'network_id':_0x20ca9d[_0x5d855a(0x10c)],'transport':_0x20ca9d[_0x5d855a(0xaf)],'status':_0x5a0131,'duration_ms':_0x13d60f()-_0x43518c,'lifecycle_tracking':_0x20ca9d['lifecycleTracking'],..._0x44f866!==void 0x0?{'error_code':_0x3686f1||_0x5d855a(0xe9),'error_message':N(_0x44f866)}:{}})));};_0x5c234b(_0x130f2f(0x108),null);try{let _0x4fe6b4=await _0x4fd9bf['send'](),_0x5bc512=j(_0x4fe6b4);if(_0x5bc512)_0x5c234b(_0x130f2f(0x100),_0x5bc512);else{if(_0x4fe6b4?.['ok']===!0x1||_0x4fe6b4?.['error'])_0x5c234b(_0x130f2f(0xe6),_0x5bc512,_0x4fe6b4?.[_0x130f2f(0x10d)]||'CommHub\x20rejected\x20task',_0x130f2f(0xed));else _0x5c234b(_0x130f2f(0xe6),null,'CommHub\x20response\x20omitted\x20task_id','missing_task_id');}return _0x4fe6b4;}catch(_0x466678){throw _0x5c234b(_0x130f2f(0xe6),null,_0x466678,_0x130f2f(0xe9)),_0x466678;}}function a0_0x1a7e(){const _0x7db67e=['sending','<unknown>','error_message','88qHcjhM','networkId','error','replace','unknown\x20error','task.ack','not_tracked','task.replied','275349sTVelv','/mcp','reconnectDelay','connect','SSE\x20failed:\x20','task','\x20network_id=','from_session','get_all_status','toAlias','running','tools/call','/events/','min','to_alias','agent','SSE\x20connected','sleep','processInbox','message_id','now','cwd','abort','broadcast','transport','toTimeString',']\x20[commhub:','network_id','6177500VwKHeL','task.expired','string','heartbeatTimer','stringify','\x20lifecycle=','token','error_code','sseAbort','AbortError','completed','mcp_http','new_task','\x20error=','url','offline','text','getAllStatus','6OtWIdv','get_inbox','message','status','pop','SSE\x20error:\x20','name','28rnKNRi','new_message','log','task.send.delivered','reply','signal','send','[commhub:task]\x20','application/json,\x20text/event-stream','toString','heartbeat\x20failed:\x20','send_reply','\x20transport=','197131ONcoZT','\x20parent_task_id=','startsWith','decode','parse','27342FnWNbB','catch','<missing>','Authorization','application/json','call','fromAlias','243162DAYGgD','failed','emit','847134oXhfWT','send_failed','548145CKLiKh','Bearer\x20','send_message','send_rejected','task_id','lifecycle_tracking','alias','content','slice','match','parentTaskId','resumeId','normal','inbox\x20error:\x20','s...','connectSSE','type','disconnected','text/event-stream','task.send.start','idle','\x20from=','delivered','read','POST','body','heartbeatInterval','from_alias','sdk-','30uhNRTI'];a0_0x1a7e=function(){return _0x7db67e;};return a0_0x1a7e();}async function Y(_0x40eac0,_0x5c5897){const _0x3cd2d8=a0_0x58cada;return X({'fromAlias':_0x40eac0[_0x3cd2d8(0xe4)],'toAlias':_0x40eac0[_0x3cd2d8(0xf0)],'parentTaskId':_0x40eac0[_0x3cd2d8(0xf4)]||null,'networkId':_0x40eac0['networkId']||null,'transport':_0x3cd2d8(0xbe),'lifecycleTracking':_0x3cd2d8(0x111)},_0x5c5897);}class $ extends a0_0x41d38a{['url'];['alias'];['token'];[a0_0x58cada(0x122)];['resumeId'];['heartbeatInterval'];[a0_0x58cada(0x115)];[a0_0x58cada(0xb6)];['sseAbort'];['running']=!0x1;constructor(_0x5d6564){const _0xb9c95f=a0_0x58cada;super();if(this[_0xb9c95f(0xc1)]=_0x5d6564[_0xb9c95f(0xc1)][_0xb9c95f(0x10e)](/\/$/,''),this[_0xb9c95f(0xf0)]=_0x5d6564[_0xb9c95f(0xf0)],this[_0xb9c95f(0xb9)]=_0x5d6564[_0xb9c95f(0xb9)],this[_0xb9c95f(0x122)]=_0x5d6564[_0xb9c95f(0x122)]||'sdk',this[_0xb9c95f(0xf5)]=_0xb9c95f(0x106)+_0x5d6564['alias']+'-'+Date['now']()[_0xb9c95f(0xd5)](0x24),this[_0xb9c95f(0x104)]=_0x5d6564['heartbeatInterval']??0x2bf20,this['reconnectDelay']=_0x5d6564[_0xb9c95f(0x115)]??0xbb8,_0x5d6564['autoConnect']!==!0x1)this[_0xb9c95f(0x116)]();}[a0_0x58cada(0xce)](_0x2716bb){const _0x29af49=a0_0x58cada;console[_0x29af49(0xce)]('['+new Date()[_0x29af49(0xb0)]()[_0x29af49(0xf2)](0x0,0x8)+_0x29af49(0xb1)+this[_0x29af49(0xf0)]+']\x20'+_0x2716bb);}async[a0_0x58cada(0xe3)](_0x519204,_0x3acee8){const _0x3d0207=a0_0x58cada;let _0x127361={'Content-Type':_0x3d0207(0xe2),'Accept':_0x3d0207(0xd4)};if(this[_0x3d0207(0xb9)])_0x127361['Authorization']=_0x3d0207(0xeb)+this[_0x3d0207(0xb9)];let _0x200a36=await(await fetch(this[_0x3d0207(0xc1)]+_0x3d0207(0x114),{'method':_0x3d0207(0x102),'headers':_0x127361,'body':JSON[_0x3d0207(0xb7)]({'jsonrpc':'2.0','id':Date[_0x3d0207(0xab)](),'method':_0x3d0207(0x11e),'params':{'name':_0x519204,'arguments':_0x3acee8}})}))[_0x3d0207(0xc3)](),_0x531884=_0x200a36[_0x3d0207(0xf3)](/data: (.+)/),_0x56e0bf=_0x531884?JSON[_0x3d0207(0xdd)](_0x531884[0x1]):JSON[_0x3d0207(0xdd)](_0x200a36),_0x2b09de=_0x56e0bf?.['result']?.[_0x3d0207(0xf1)]?.[0x0]?.['text'];return _0x2b09de?JSON[_0x3d0207(0xdd)](_0x2b09de):_0x56e0bf;}async[a0_0x58cada(0x116)](){const _0x351691=a0_0x58cada;if(this['running'])return;this[_0x351691(0x11d)]=!0x0,await this[_0x351691(0xc8)]('idle'),this[_0x351691(0xce)]('registered'),this[_0x351691(0xb6)]=setInterval(()=>{const _0x19e8ca=_0x351691;this[_0x19e8ca(0xc8)](_0x19e8ca(0xfe))[_0x19e8ca(0xdf)](_0x29bc09=>this['log'](_0x19e8ca(0xd6)+_0x29bc09[_0x19e8ca(0xc7)]));},this['heartbeatInterval']),this['connectSSE']();}async['disconnect'](){const _0x306ec7=a0_0x58cada;if(this[_0x306ec7(0x11d)]=!0x1,this[_0x306ec7(0xbb)]?.[_0x306ec7(0xad)](),this[_0x306ec7(0xb6)])clearInterval(this[_0x306ec7(0xb6)]);await this[_0x306ec7(0xc8)](_0x306ec7(0xc2))[_0x306ec7(0xdf)](()=>{}),this['log'](_0x306ec7(0xfb));}async[a0_0x58cada(0xd2)](_0x2cc332,_0x2ab31b,_0x44fd9d=a0_0x58cada(0xf6)){const _0x1b5c24=a0_0x58cada;return Y({'alias':_0x2cc332,'fromAlias':this[_0x1b5c24(0xf0)]},{'log':_0x346181=>console[_0x1b5c24(0xce)](_0x346181),'send':()=>this[_0x1b5c24(0xe3)]('send_task',{'alias':_0x2cc332,'task':_0x2ab31b,'priority':_0x44fd9d,'from_session':this['alias']})});}async[a0_0x58cada(0xc7)](_0x212e7b,_0x35ce52){const _0x87f5d8=a0_0x58cada;return this[_0x87f5d8(0xe3)](_0x87f5d8(0xec),{'alias':_0x212e7b,'message':_0x35ce52,'from_session':this[_0x87f5d8(0xf0)]});}async[a0_0x58cada(0xd0)](_0x34a35a,_0x286803,_0x29ed3f=a0_0x58cada(0xbd)){const _0x540d4e=a0_0x58cada;return this[_0x540d4e(0xe3)](_0x540d4e(0xd7),{'in_reply_to':_0x34a35a,'text':_0x286803,'status':_0x29ed3f});}async[a0_0x58cada(0xc8)](_0x1ded28,_0x33f4d7){const _0x90de94=a0_0x58cada;return this[_0x90de94(0xe3)]('report_status',{'resume_id':this[_0x90de94(0xf5)],'alias':this['alias'],'status':_0x1ded28,'server':a0_0x445e88(),'hostname':a0_0x445e88(),'agent':this[_0x90de94(0x122)],'project_dir':process[_0x90de94(0xac)](),..._0x33f4d7});}async[a0_0x58cada(0xc4)](){const _0x14e4b5=a0_0x58cada;return this[_0x14e4b5(0xe3)](_0x14e4b5(0x11b),{});}async[a0_0x58cada(0xae)](_0x53469c,_0x3b8ac4){const _0x25f02b=a0_0x58cada;return this[_0x25f02b(0xe3)](_0x25f02b(0xae),{'message':_0x53469c,'filter_server':_0x3b8ac4?.['server'],'filter_status':_0x3b8ac4?.[_0x25f02b(0xc8)]});}async[a0_0x58cada(0xf9)](){const _0x29d8da=a0_0x58cada;let _0x1597f9=encodeURIComponent(this[_0x29d8da(0xf0)]),_0x2c73d6=this[_0x29d8da(0xc1)]+_0x29d8da(0x11f)+_0x1597f9,_0x137ca3=this['reconnectDelay'];while(this[_0x29d8da(0x11d)]){try{this[_0x29d8da(0xbb)]=new AbortController();let _0x4daa38={'Accept':_0x29d8da(0xfc)};if(this[_0x29d8da(0xb9)])_0x4daa38[_0x29d8da(0xe1)]=_0x29d8da(0xeb)+this['token'];let _0x31e4c7=await fetch(_0x2c73d6,{'headers':_0x4daa38,'signal':this['sseAbort'][_0x29d8da(0xd1)]});if(!_0x31e4c7['ok']||!_0x31e4c7[_0x29d8da(0x103)]){this[_0x29d8da(0xce)](_0x29d8da(0x117)+_0x31e4c7['status']),await this[_0x29d8da(0x124)](_0x137ca3),_0x137ca3=Math['min'](_0x137ca3*1.5,0xea60);continue;}_0x137ca3=this[_0x29d8da(0x115)];let _0x2b66e1=_0x31e4c7[_0x29d8da(0x103)]['getReader'](),_0x42293d=new TextDecoder(),_0x45cc6f='';while(this[_0x29d8da(0x11d)]){let {done:_0x140de3,value:_0x5b147d}=await _0x2b66e1[_0x29d8da(0x101)]();if(_0x140de3)break;_0x45cc6f+=_0x42293d[_0x29d8da(0xdc)](_0x5b147d,{'stream':!0x0});let _0x174d6c=_0x45cc6f['split']('\x0a');_0x45cc6f=_0x174d6c[_0x29d8da(0xc9)]()||'';for(let _0x359513 of _0x174d6c){if(!_0x359513[_0x29d8da(0xdb)]('data:\x20'))continue;try{let _0x3b3abf=JSON[_0x29d8da(0xdd)](_0x359513[_0x29d8da(0xf2)](0x6));if(_0x3b3abf[_0x29d8da(0xfa)]==='connected'){this[_0x29d8da(0xce)](_0x29d8da(0x123)),this[_0x29d8da(0xe7)]('connected');continue;}if(_0x3b3abf[_0x29d8da(0xfa)]===_0x29d8da(0xbf)||_0x3b3abf[_0x29d8da(0xfa)]===_0x29d8da(0xcd)||_0x3b3abf[_0x29d8da(0xfa)]===_0x29d8da(0xae))await this[_0x29d8da(0x125)]();}catch{}}}}catch(_0x538694){if(_0x538694[_0x29d8da(0xcb)]===_0x29d8da(0xbc))break;this['emit'](_0x29d8da(0x10d),_0x538694),this[_0x29d8da(0xce)](_0x29d8da(0xca)+_0x538694[_0x29d8da(0xc7)]);}if(this[_0x29d8da(0x11d)])this[_0x29d8da(0xe7)]('disconnected'),this[_0x29d8da(0xce)]('SSE\x20reconnecting\x20in\x20'+_0x137ca3/0x3e8+_0x29d8da(0xf8)),await this[_0x29d8da(0x124)](_0x137ca3),_0x137ca3=Math[_0x29d8da(0x120)](_0x137ca3*1.5,0xea60);}}async[a0_0x58cada(0x125)](){const _0x1544e7=a0_0x58cada;try{let _0x55242b=(await this[_0x1544e7(0xe3)](_0x1544e7(0xc6),{'alias':this[_0x1544e7(0xf0)],'limit':0xa}))?.['messages']||[];for(let _0x318901 of _0x55242b)await this[_0x1544e7(0xe3)]('ack_inbox',{'alias':this[_0x1544e7(0xf0)],'message_id':_0x318901['id']}),this[_0x1544e7(0xce)]('←\x20'+_0x318901[_0x1544e7(0x11a)]+':\x20'+_0x318901[_0x1544e7(0xf1)][_0x1544e7(0xf2)](0x0,0x3c)),this[_0x1544e7(0xe7)](_0x1544e7(0x118),_0x318901),this['emit'](_0x1544e7(0xc7),_0x318901);}catch(_0x14fd7e){this[_0x1544e7(0xce)](_0x1544e7(0xf7)+_0x14fd7e[_0x1544e7(0xc7)]);}}['sleep'](_0x4f8ea6){return new Promise(_0x49516e=>setTimeout(_0x49516e,_0x4f8ea6));}}var F=$;export{F as default,$ as CommHub};
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #562 step 2 — remote lifecycle: act on a node that lives on ANOTHER machine.
|
|
3
|
+
*
|
|
4
|
+
* anet node start <alias> --remote [--network <id|name>] [--yes] [--wait <s>]
|
|
5
|
+
* anet node stop <alias> --remote [--network <id|name>] [--yes] [--wait <s>] [--force]
|
|
6
|
+
* anet node restart <alias> --remote [--network <id|name>] [--yes] [--wait <s>]
|
|
7
|
+
* anet node edit <alias> --model <id> --remote [--network <id|name>] [--yes] [--wait <s>]
|
|
8
|
+
*
|
|
9
|
+
* Nothing new on the Hub: these are the same MCP tools the app calls (POST /mcp tools/call):
|
|
10
|
+
* start → start_node Hub → that machine's daemon (host_supervisor) spawns the child
|
|
11
|
+
* stop → stop_node Hub → that machine's daemon stops the child
|
|
12
|
+
* restart → restart_node Hub → the node itself drains + exits 75; its `anet node start`
|
|
13
|
+
* wrapper respawns it (whoever ran that wrapper: a daemon or a person)
|
|
14
|
+
* edit → update_node_config same doorbell; a model change is restart-tier
|
|
15
|
+
* Permission checks are the Hub's (canWrite: member+, not viewer, not agent-restricted); this
|
|
16
|
+
* module never decides who may do what — it only refuses what cannot work, BEFORE dispatching:
|
|
17
|
+
* start/stop (need the machine's daemon):
|
|
18
|
+
* - no online daemon on the node's machine → "this machine can't be managed remotely"
|
|
19
|
+
* - the node was not created by a daemon → the Hub keeps no daemon for it
|
|
20
|
+
* - the daemon that created it is offline
|
|
21
|
+
* restart/edit (#570 — no daemon involved, the Hub pushes to the node itself):
|
|
22
|
+
* - the node is not running → nothing would receive the doorbell
|
|
23
|
+
* - it does not report config_update_capable → no exit-75 supervisor: it would just die
|
|
24
|
+
*
|
|
25
|
+
* Pure functions here; the HTTP calls live in bin/cli.ts (nodeRemoteCommand).
|
|
26
|
+
*/
|
|
27
|
+
import type { PlannedCommand } from "./codex-menu";
|
|
28
|
+
export type RemoteVerb = "start" | "stop" | "restart" | "edit";
|
|
29
|
+
export declare const REMOTE_VERBS: readonly RemoteVerb[];
|
|
30
|
+
export declare const DEFAULT_WAIT_SECONDS = 60;
|
|
31
|
+
export declare const MAX_WAIT_SECONDS = 600;
|
|
32
|
+
export type RemoteArgs = {
|
|
33
|
+
verb: RemoteVerb;
|
|
34
|
+
alias: string | null;
|
|
35
|
+
network: string | null;
|
|
36
|
+
model: string | null;
|
|
37
|
+
yes: boolean;
|
|
38
|
+
force: boolean;
|
|
39
|
+
waitSeconds: number;
|
|
40
|
+
error: string | null;
|
|
41
|
+
};
|
|
42
|
+
/** True when this `anet node <verb> …` invocation is the remote form. */
|
|
43
|
+
export declare function isRemoteInvocation(argv: string[]): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* @param argv everything after `anet node <verb>` (the verb itself excluded).
|
|
46
|
+
* Unknown flags are refused: a local-only flag (`--tmux`, `--copresence`, `--runtime` …) silently
|
|
47
|
+
* ignored on a remote node would be a lie about what was done.
|
|
48
|
+
*/
|
|
49
|
+
export declare function parseRemoteArgs(verb: RemoteVerb, argv: string[]): RemoteArgs;
|
|
50
|
+
export type HubNodeRow = {
|
|
51
|
+
node_id: string;
|
|
52
|
+
alias: string;
|
|
53
|
+
hostname?: string | null;
|
|
54
|
+
role?: string | null;
|
|
55
|
+
lifecycle_state?: string | null;
|
|
56
|
+
lifecycle_controllable?: boolean;
|
|
57
|
+
lifecycle_daemon_node_id?: string | null;
|
|
58
|
+
model?: string | null;
|
|
59
|
+
};
|
|
60
|
+
export type HubSession = {
|
|
61
|
+
alias?: string;
|
|
62
|
+
node_id?: string | null;
|
|
63
|
+
status?: string | null;
|
|
64
|
+
hostname?: string | null;
|
|
65
|
+
host?: {
|
|
66
|
+
hostname?: string | null;
|
|
67
|
+
} | null;
|
|
68
|
+
last_seen_at?: string | null;
|
|
69
|
+
updated_at?: string | null;
|
|
70
|
+
model?: string | null;
|
|
71
|
+
};
|
|
72
|
+
/** GET /api/host-supervisors row: the daemon's node id is `daemon_node_id` (not `node_id`). */
|
|
73
|
+
export type HubDaemon = {
|
|
74
|
+
daemon_node_id?: string;
|
|
75
|
+
alias?: string;
|
|
76
|
+
hostname?: string | null;
|
|
77
|
+
online?: boolean;
|
|
78
|
+
last_seen_at?: string | null;
|
|
79
|
+
};
|
|
80
|
+
export type RemoteTarget = {
|
|
81
|
+
node_id: string;
|
|
82
|
+
alias: string;
|
|
83
|
+
hostname: string | null;
|
|
84
|
+
lifecycle_state: string;
|
|
85
|
+
session_status: string | null;
|
|
86
|
+
session_seen: string | null;
|
|
87
|
+
model: string | null;
|
|
88
|
+
/** The daemon that created the node (start/stop go through it). null = not daemon-managed: only
|
|
89
|
+
* restart/edit resolve without one. `online` is false only for restart/edit (they don't need it). */
|
|
90
|
+
daemon: {
|
|
91
|
+
node_id: string;
|
|
92
|
+
alias: string;
|
|
93
|
+
online: boolean;
|
|
94
|
+
} | null;
|
|
95
|
+
};
|
|
96
|
+
export type ResolveResult = {
|
|
97
|
+
ok: true;
|
|
98
|
+
target: RemoteTarget;
|
|
99
|
+
} | {
|
|
100
|
+
ok: false;
|
|
101
|
+
code: "not_found" | "is_daemon" | "daemons_not_visible" | "no_daemon_on_host" | "not_daemon_managed" | "creator_daemon_offline";
|
|
102
|
+
message: string;
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
* @param nodes GET /api/nodes?alias=<alias>&network_id=<net> (rows; newest first)
|
|
106
|
+
* @param sessions GET /api/status?network_id=<net> (sessions)
|
|
107
|
+
* @param daemons GET /api/host-supervisors?network_id=<net> (daemons; [] = none visible)
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveRemoteTarget(verb: RemoteVerb, alias: string, nodes: HubNodeRow[], sessions: HubSession[], daemons: HubDaemon[]): ResolveResult;
|
|
110
|
+
export type Precheck = {
|
|
111
|
+
kind: "go";
|
|
112
|
+
} | {
|
|
113
|
+
kind: "noop";
|
|
114
|
+
message: string;
|
|
115
|
+
} | {
|
|
116
|
+
kind: "refuse";
|
|
117
|
+
message: string;
|
|
118
|
+
};
|
|
119
|
+
export declare function isRunning(t: RemoteTarget): boolean;
|
|
120
|
+
export declare function precheck(verb: RemoteVerb, t: RemoteTarget, cfg?: {
|
|
121
|
+
config_update_capable?: boolean;
|
|
122
|
+
} | null): Precheck;
|
|
123
|
+
export declare function remoteCommandArgv(a: {
|
|
124
|
+
verb: RemoteVerb;
|
|
125
|
+
alias: string;
|
|
126
|
+
networkId: string;
|
|
127
|
+
model?: string | null;
|
|
128
|
+
force?: boolean;
|
|
129
|
+
}): string[];
|
|
130
|
+
export declare function describePlan(verb: RemoteVerb, t: RemoteTarget, model?: string | null): string;
|
|
131
|
+
/** The one-line "where/what" header printed before the plan. */
|
|
132
|
+
export declare function describeTarget(verb: RemoteVerb, t: RemoteTarget): string;
|
|
133
|
+
export declare function planRemote(a: {
|
|
134
|
+
verb: RemoteVerb;
|
|
135
|
+
target: RemoteTarget;
|
|
136
|
+
networkId: string;
|
|
137
|
+
model?: string | null;
|
|
138
|
+
force?: boolean;
|
|
139
|
+
}): PlannedCommand;
|
|
140
|
+
export declare function toolCall(verb: RemoteVerb, t: RemoteTarget, networkId: string, opts?: {
|
|
141
|
+
model?: string | null;
|
|
142
|
+
force?: boolean;
|
|
143
|
+
baseRevision?: number;
|
|
144
|
+
}): {
|
|
145
|
+
name: string;
|
|
146
|
+
arguments: Record<string, unknown>;
|
|
147
|
+
};
|
|
148
|
+
export declare function explainHubRefusal(verb: RemoteVerb, alias: string, r: any): string;
|
|
149
|
+
export type Observation = {
|
|
150
|
+
lifecycle_state: string | null;
|
|
151
|
+
session_status: string | null;
|
|
152
|
+
session_seen: string | null;
|
|
153
|
+
config_revision: number | null;
|
|
154
|
+
model: string | null;
|
|
155
|
+
};
|
|
156
|
+
export type Outcome = {
|
|
157
|
+
state: "pending";
|
|
158
|
+
} | {
|
|
159
|
+
state: "done";
|
|
160
|
+
message: string;
|
|
161
|
+
} | {
|
|
162
|
+
state: "failed";
|
|
163
|
+
message: string;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* @param before what the hub showed right before dispatch
|
|
167
|
+
* @param now what it shows now
|
|
168
|
+
* Seen-times are compared as the hub's own strings (changed or not), never against this machine's
|
|
169
|
+
* clock: the node is on another machine and the hub on a third.
|
|
170
|
+
*/
|
|
171
|
+
export declare function evaluateOutcome(verb: RemoteVerb, t: RemoteTarget, before: Observation, now: Observation, want?: {
|
|
172
|
+
model?: string | null;
|
|
173
|
+
baseRevision?: number;
|
|
174
|
+
}): Outcome;
|
|
175
|
+
/**
|
|
176
|
+
* @param last the last observation before the deadline (null = none could be read). For restart/edit it
|
|
177
|
+
* tells "went down and never came back" (the supervisor did not respawn it — a real failure
|
|
178
|
+
* worth a different next step) apart from "still finishing its turn".
|
|
179
|
+
*/
|
|
180
|
+
export declare function timeoutMessage(verb: RemoteVerb, alias: string, seconds: number, last?: Observation | null, host?: string | null): string;
|