@sleep2agi/agent-network 2.3.0-preview.143 → 2.3.0-preview.144
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_0xe80285=a0_0x3cad;(function(_0x24d1c3,_0x3a3b42){const _0x1bfd76=a0_0x3cad,_0x553e03=_0x24d1c3();while(!![]){try{const _0x397e69=-parseInt(_0x1bfd76(0x81))/0x1+parseInt(_0x1bfd76(0xd0))/0x2+-parseInt(_0x1bfd76(0xaf))/0x3*(-parseInt(_0x1bfd76(0x75))/0x4)+parseInt(_0x1bfd76(0xd4))/0x5*(parseInt(_0x1bfd76(0x93))/0x6)+-parseInt(_0x1bfd76(0x72))/0x7+-parseInt(_0x1bfd76(0x83))/0x8+-parseInt(_0x1bfd76(0xbd))/0x9;if(_0x397e69===_0x3a3b42)break;else _0x553e03['push'](_0x553e03['shift']());}catch(_0x399fcf){_0x553e03['push'](_0x553e03['shift']());}}}(a0_0x516a,0x82a58));import{EventEmitter as a0_0x27824a}from'events';import{hostname as a0_0x1a07fb}from'os';function a0_0x3cad(_0x1d7e21,_0xd09352){_0x1d7e21=_0x1d7e21-0x6b;const _0x516aed=a0_0x516a();let _0x3cad04=_0x516aed[_0x1d7e21];return _0x3cad04;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x52e8c9,_0x1bcc97)=>(_0x52e8c9??_0x1bcc97)[a0_0xe80285(0xd1)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x5fcf67){const _0x16ba2a=a0_0xe80285;return(_0x5fcf67 instanceof Error?_0x5fcf67['message']:String(_0x5fcf67??_0x16ba2a(0xec)))[_0x16ba2a(0xd1)](K,_0x16ba2a(0xa2))[_0x16ba2a(0xd1)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x16ba2a(0xaa)](0x0,0xf0);}function O(_0x3ad6be,_0x4c2c0a=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0xf5dd4c=a0_0xe80285;if(_0x4c2c0a)return JSON[_0xf5dd4c(0x70)](_0x3ad6be);let _0x50da43=L(_0x3ad6be['parent_task_id'],_0xf5dd4c(0xe4)),_0xe379c3=L(_0x3ad6be['task_id'],_0xf5dd4c(0xdf)),_0x325b04=_0x3ad6be[_0xf5dd4c(0xa4)]?'\x20error='+_0x3ad6be[_0xf5dd4c(0xa4)]+':'+(_0x3ad6be['error_message']??''):'';return _0xf5dd4c(0xc6)+_0x3ad6be['status']+'\x20from='+L(_0x3ad6be[_0xf5dd4c(0xb9)],_0xf5dd4c(0xd2))+_0xf5dd4c(0xc5)+L(_0x3ad6be[_0xf5dd4c(0xb8)],_0xf5dd4c(0xd2))+_0xf5dd4c(0xcc)+_0xe379c3+_0xf5dd4c(0xc7)+_0x50da43+'\x20network_id='+L(_0x3ad6be[_0xf5dd4c(0xe0)],_0xf5dd4c(0xd2))+'\x20transport='+_0x3ad6be[_0xf5dd4c(0xdc)]+_0xf5dd4c(0x6d)+_0x3ad6be['duration_ms']+'\x20lifecycle='+_0x3ad6be[_0xf5dd4c(0x94)]+_0x325b04;}function a0_0x516a(){const _0x40f4b8=['agent','<pending>','network_id','connected','type','parentTaskId','<missing>','server','task','decode','Bearer\x20','failed','name','task.expired','unknown\x20error','task.ack','processInbox','body','new_task','disconnect','data:\x20','\x20duration_ms=','Authorization','signal','stringify','from_session','1522514hRnYWe','log','ack_inbox','555532rFDUfH','completed','autoConnect','s...','SSE\x20error:\x20','sseAbort','heartbeatTimer','connectSSE','send_rejected','inbox\x20error:\x20','cwd','message_id','764922SOAAkF','connect','595584YyzQZj','pop','read','alias','application/json','text/event-stream','POST','toAlias','task.started','fromAlias','url','task_id','parse','send','send_reply','2.0','6PwodFm','lifecycle_tracking','AbortError','application/json,\x20text/event-stream','emit','offline','normal','sdk-','report_status','SSE\x20connected','resumeId','get_inbox','messages','message','abort','[REDACTED]','CommHub\x20rejected\x20task','error_code','registered','task.replied','sdk','getAllStatus','reconnectDelay','slice','call','token','lifecycleTracking','networkId','6zZTyQX','new_message','send_failed','not_tracked','heartbeatInterval','tools/call','disconnected','startsWith','send_message','to_alias','from_alias','content','/mcp','text','2925090cSxldD','broadcast','get_all_status','task.send.start','status','send_task','sending','missing_task_id','\x20to=','[commhub:task]\x20','\x20parent_task_id=','result','running','delivered','SSE\x20failed:\x20','\x20task_id=','sleep','idle','CommHub\x20response\x20omitted\x20task_id','1187738NEjGjB','replace','<unknown>','mcp_http','5226875uAtPwx',']\x20[commhub:','getReader','task.send.failed','heartbeat\x20failed:\x20','task.send.delivered','error','now','transport','toString'];a0_0x516a=function(){return _0x40f4b8;};return a0_0x516a();}function U(_0x40d7b2){const _0x32647c=a0_0xe80285;return{'event':{'sending':_0x32647c(0xc0),'delivered':_0x32647c(0xd9),'failed':_0x32647c(0xd7),'acked':_0x32647c(0xed),'started':_0x32647c(0x8b),'replied':_0x32647c(0xa6),'expired':_0x32647c(0xeb)}[_0x40d7b2['status']],..._0x40d7b2};}function j(_0x1cdaff){const _0x4b3a8f=a0_0xe80285;let _0x27e0c3=_0x1cdaff?.['task_id']||_0x1cdaff?.[_0x4b3a8f(0x80)]||_0x1cdaff?.['id'];if(_0x27e0c3)return String(_0x27e0c3);let _0x5d5313=_0x1cdaff?.['content']?.[0x0]?.['text'];if(typeof _0x5d5313!=='string')return null;try{let _0x3bc713=JSON[_0x4b3a8f(0x8f)](_0x5d5313);return _0x3bc713?.[_0x4b3a8f(0x8e)]||_0x3bc713?.[_0x4b3a8f(0x80)]||_0x3bc713?.['id']||null;}catch{return null;}}async function X(_0x1270d9,_0x6ae44d){const _0x40ffb3=a0_0xe80285;let _0x117de9=_0x6ae44d['now']??Date[_0x40ffb3(0xdb)],_0x5758a4=_0x117de9(),_0x102da7=(_0x275e07,_0x442ea6,_0x2141f3,_0xe9febd)=>{const _0x46a6a9=_0x40ffb3;_0x6ae44d[_0x46a6a9(0x73)](O(U({'from_alias':_0x1270d9['fromAlias'],'to_alias':_0x1270d9[_0x46a6a9(0x8a)],'task_id':_0x442ea6,'parent_task_id':_0x1270d9[_0x46a6a9(0xe3)],'network_id':_0x1270d9[_0x46a6a9(0xae)],'transport':_0x1270d9[_0x46a6a9(0xdc)],'status':_0x275e07,'duration_ms':_0x117de9()-_0x5758a4,'lifecycle_tracking':_0x1270d9[_0x46a6a9(0xad)],..._0x2141f3!==void 0x0?{'error_code':_0xe9febd||_0x46a6a9(0xb1),'error_message':N(_0x2141f3)}:{}})));};_0x102da7(_0x40ffb3(0xc3),null);try{let _0x593a7f=await _0x6ae44d[_0x40ffb3(0x90)](),_0x1f6c42=j(_0x593a7f);if(_0x1f6c42)_0x102da7(_0x40ffb3(0xca),_0x1f6c42);else{if(_0x593a7f?.['ok']===!0x1||_0x593a7f?.[_0x40ffb3(0xda)])_0x102da7(_0x40ffb3(0xe9),_0x1f6c42,_0x593a7f?.['error']||_0x40ffb3(0xa3),_0x40ffb3(0x7d));else _0x102da7(_0x40ffb3(0xe9),null,_0x40ffb3(0xcf),_0x40ffb3(0xc4));}return _0x593a7f;}catch(_0x34da4d){throw _0x102da7('failed',null,_0x34da4d,'send_failed'),_0x34da4d;}}async function Y(_0x178a68,_0x3fe262){const _0x4b9a43=a0_0xe80285;return X({'fromAlias':_0x178a68[_0x4b9a43(0x8c)],'toAlias':_0x178a68[_0x4b9a43(0x86)],'parentTaskId':_0x178a68[_0x4b9a43(0xe3)]||null,'networkId':_0x178a68['networkId']||null,'transport':_0x4b9a43(0xd3),'lifecycleTracking':_0x4b9a43(0xb2)},_0x3fe262);}class $ extends a0_0x27824a{[a0_0xe80285(0x8d)];['alias'];['token'];[a0_0xe80285(0xde)];[a0_0xe80285(0x9d)];[a0_0xe80285(0xb3)];[a0_0xe80285(0xa9)];[a0_0xe80285(0x7b)];[a0_0xe80285(0x7a)];[a0_0xe80285(0xc9)]=!0x1;constructor(_0x26a04b){const _0x9db33a=a0_0xe80285;super();if(this['url']=_0x26a04b[_0x9db33a(0x8d)][_0x9db33a(0xd1)](/\/$/,''),this[_0x9db33a(0x86)]=_0x26a04b[_0x9db33a(0x86)],this[_0x9db33a(0xac)]=_0x26a04b[_0x9db33a(0xac)],this['agent']=_0x26a04b[_0x9db33a(0xde)]||_0x9db33a(0xa7),this[_0x9db33a(0x9d)]=_0x9db33a(0x9a)+_0x26a04b[_0x9db33a(0x86)]+'-'+Date[_0x9db33a(0xdb)]()[_0x9db33a(0xdd)](0x24),this[_0x9db33a(0xb3)]=_0x26a04b[_0x9db33a(0xb3)]??0x2bf20,this['reconnectDelay']=_0x26a04b[_0x9db33a(0xa9)]??0xbb8,_0x26a04b[_0x9db33a(0x77)]!==!0x1)this[_0x9db33a(0x82)]();}[a0_0xe80285(0x73)](_0x5898c2){const _0x270472=a0_0xe80285;console['log']('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x270472(0xd5)+this[_0x270472(0x86)]+']\x20'+_0x5898c2);}async[a0_0xe80285(0xab)](_0x46ce25,_0x61d3e7){const _0x13c687=a0_0xe80285;let _0x5bf0ea={'Content-Type':_0x13c687(0x87),'Accept':_0x13c687(0x96)};if(this[_0x13c687(0xac)])_0x5bf0ea[_0x13c687(0x6e)]='Bearer\x20'+this[_0x13c687(0xac)];let _0x3a5113=await(await fetch(this[_0x13c687(0x8d)]+_0x13c687(0xbb),{'method':_0x13c687(0x89),'headers':_0x5bf0ea,'body':JSON[_0x13c687(0x70)]({'jsonrpc':_0x13c687(0x92),'id':Date['now'](),'method':_0x13c687(0xb4),'params':{'name':_0x46ce25,'arguments':_0x61d3e7}})}))[_0x13c687(0xbc)](),_0x4e42b0=_0x3a5113['match'](/data: (.+)/),_0x3bb9fa=_0x4e42b0?JSON[_0x13c687(0x8f)](_0x4e42b0[0x1]):JSON[_0x13c687(0x8f)](_0x3a5113),_0xaa4985=_0x3bb9fa?.[_0x13c687(0xc8)]?.[_0x13c687(0xba)]?.[0x0]?.[_0x13c687(0xbc)];return _0xaa4985?JSON[_0x13c687(0x8f)](_0xaa4985):_0x3bb9fa;}async[a0_0xe80285(0x82)](){const _0x544370=a0_0xe80285;if(this['running'])return;this['running']=!0x0,await this['status'](_0x544370(0xce)),this['log'](_0x544370(0xa5)),this[_0x544370(0x7b)]=setInterval(()=>{const _0x237735=_0x544370;this[_0x237735(0xc1)](_0x237735(0xce))['catch'](_0x38be8a=>this[_0x237735(0x73)](_0x237735(0xd8)+_0x38be8a['message']));},this['heartbeatInterval']),this[_0x544370(0x7c)]();}async[a0_0xe80285(0x6b)](){const _0x1c971d=a0_0xe80285;if(this['running']=!0x1,this['sseAbort']?.[_0x1c971d(0xa1)](),this[_0x1c971d(0x7b)])clearInterval(this[_0x1c971d(0x7b)]);await this['status'](_0x1c971d(0x98))['catch'](()=>{}),this['log']('disconnected');}async[a0_0xe80285(0x90)](_0x37b967,_0x1dfe21,_0x344db9=a0_0xe80285(0x99)){const _0x35b40b=a0_0xe80285;return Y({'alias':_0x37b967,'fromAlias':this['alias']},{'log':_0x1f2917=>console[_0x35b40b(0x73)](_0x1f2917),'send':()=>this[_0x35b40b(0xab)](_0x35b40b(0xc2),{'alias':_0x37b967,'task':_0x1dfe21,'priority':_0x344db9,'from_session':this[_0x35b40b(0x86)]})});}async['message'](_0x39aaad,_0x21ad2c){const _0x16cd6d=a0_0xe80285;return this[_0x16cd6d(0xab)](_0x16cd6d(0xb7),{'alias':_0x39aaad,'message':_0x21ad2c,'from_session':this[_0x16cd6d(0x86)]});}async['reply'](_0x11a7fa,_0x3763e7,_0x4ecf90=a0_0xe80285(0x76)){const _0x46376a=a0_0xe80285;return this['call'](_0x46376a(0x91),{'in_reply_to':_0x11a7fa,'text':_0x3763e7,'status':_0x4ecf90});}async[a0_0xe80285(0xc1)](_0x4070fd,_0x21f209){const _0x296808=a0_0xe80285;return this[_0x296808(0xab)](_0x296808(0x9b),{'resume_id':this[_0x296808(0x9d)],'alias':this[_0x296808(0x86)],'status':_0x4070fd,'server':a0_0x1a07fb(),'hostname':a0_0x1a07fb(),'agent':this[_0x296808(0xde)],'project_dir':process[_0x296808(0x7f)](),..._0x21f209});}async[a0_0xe80285(0xa8)](){const _0x3adafd=a0_0xe80285;return this[_0x3adafd(0xab)](_0x3adafd(0xbf),{});}async[a0_0xe80285(0xbe)](_0x23deb5,_0x5a84d2){const _0x293ccb=a0_0xe80285;return this[_0x293ccb(0xab)](_0x293ccb(0xbe),{'message':_0x23deb5,'filter_server':_0x5a84d2?.[_0x293ccb(0xe5)],'filter_status':_0x5a84d2?.[_0x293ccb(0xc1)]});}async[a0_0xe80285(0x7c)](){const _0x3a93f2=a0_0xe80285;let _0x2517c9=encodeURIComponent(this[_0x3a93f2(0x86)]),_0x48d553=this['url']+'/events/'+_0x2517c9,_0x4ba80a=this[_0x3a93f2(0xa9)];while(this[_0x3a93f2(0xc9)]){try{this['sseAbort']=new AbortController();let _0x4e1d58={'Accept':_0x3a93f2(0x88)};if(this['token'])_0x4e1d58['Authorization']=_0x3a93f2(0xe8)+this[_0x3a93f2(0xac)];let _0x4e9631=await fetch(_0x48d553,{'headers':_0x4e1d58,'signal':this[_0x3a93f2(0x7a)][_0x3a93f2(0x6f)]});if(!_0x4e9631['ok']||!_0x4e9631[_0x3a93f2(0xef)]){this[_0x3a93f2(0x73)](_0x3a93f2(0xcb)+_0x4e9631['status']),await this[_0x3a93f2(0xcd)](_0x4ba80a),_0x4ba80a=Math['min'](_0x4ba80a*1.5,0xea60);continue;}_0x4ba80a=this['reconnectDelay'];let _0x5ccef7=_0x4e9631[_0x3a93f2(0xef)][_0x3a93f2(0xd6)](),_0x2fb1e8=new TextDecoder(),_0xfa900='';while(this['running']){let {done:_0xf3ad6f,value:_0x168870}=await _0x5ccef7[_0x3a93f2(0x85)]();if(_0xf3ad6f)break;_0xfa900+=_0x2fb1e8[_0x3a93f2(0xe7)](_0x168870,{'stream':!0x0});let _0xaeea5d=_0xfa900['split']('\x0a');_0xfa900=_0xaeea5d[_0x3a93f2(0x84)]()||'';for(let _0xdd2570 of _0xaeea5d){if(!_0xdd2570[_0x3a93f2(0xb6)](_0x3a93f2(0x6c)))continue;try{let _0x34920a=JSON[_0x3a93f2(0x8f)](_0xdd2570[_0x3a93f2(0xaa)](0x6));if(_0x34920a[_0x3a93f2(0xe2)]==='connected'){this[_0x3a93f2(0x73)](_0x3a93f2(0x9c)),this[_0x3a93f2(0x97)](_0x3a93f2(0xe1));continue;}if(_0x34920a['type']===_0x3a93f2(0xf0)||_0x34920a['type']===_0x3a93f2(0xb0)||_0x34920a[_0x3a93f2(0xe2)]==='broadcast')await this['processInbox']();}catch{}}}}catch(_0x396ce1){if(_0x396ce1[_0x3a93f2(0xea)]===_0x3a93f2(0x95))break;this[_0x3a93f2(0x97)](_0x3a93f2(0xda),_0x396ce1),this[_0x3a93f2(0x73)](_0x3a93f2(0x79)+_0x396ce1[_0x3a93f2(0xa0)]);}if(this['running'])this[_0x3a93f2(0x97)](_0x3a93f2(0xb5)),this[_0x3a93f2(0x73)]('SSE\x20reconnecting\x20in\x20'+_0x4ba80a/0x3e8+_0x3a93f2(0x78)),await this['sleep'](_0x4ba80a),_0x4ba80a=Math['min'](_0x4ba80a*1.5,0xea60);}}async[a0_0xe80285(0xee)](){const _0x4d8233=a0_0xe80285;try{let _0x9d7915=(await this['call'](_0x4d8233(0x9e),{'alias':this['alias'],'limit':0xa}))?.[_0x4d8233(0x9f)]||[];for(let _0x389691 of _0x9d7915)await this['call'](_0x4d8233(0x74),{'alias':this['alias'],'message_id':_0x389691['id']}),this['log']('←\x20'+_0x389691[_0x4d8233(0x71)]+':\x20'+_0x389691[_0x4d8233(0xba)][_0x4d8233(0xaa)](0x0,0x3c)),this[_0x4d8233(0x97)](_0x4d8233(0xe6),_0x389691),this['emit'](_0x4d8233(0xa0),_0x389691);}catch(_0x3d4ce2){this['log'](_0x4d8233(0x7e)+_0x3d4ce2['message']);}}[a0_0xe80285(0xcd)](_0x1011cb){return new Promise(_0x5c8ab9=>setTimeout(_0x5c8ab9,_0x1011cb));}}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;
|