@sleep2agi/agent-network 2.3.0-preview.65 → 2.3.0-preview.67
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/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
- package/dist/src/im/feishu/worker.js +118 -118
- package/dist/src/node-server.js +7 -7
- package/dist/src/opencode-agent-node-pair.d.ts +6 -6
- package/dist/src/package-mode-preflight.d.ts +12 -2
- package/dist/src/posix-modes.d.ts +36 -0
- package/dist/src/win-launcher.d.ts +20 -0
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x1a7b7b=a0_0xb7d1;(function(_0x57df4e,_0x3cfdd6){const _0x3e2d41=a0_0xb7d1,_0x413f5e=_0x57df4e();while(!![]){try{const _0x229d94=-parseInt(_0x3e2d41(0x1be))/0x1+parseInt(_0x3e2d41(0x18e))/0x2+-parseInt(_0x3e2d41(0x1d8))/0x3*(-parseInt(_0x3e2d41(0x189))/0x4)+parseInt(_0x3e2d41(0x1a9))/0x5*(parseInt(_0x3e2d41(0x164))/0x6)+-parseInt(_0x3e2d41(0x181))/0x7+parseInt(_0x3e2d41(0x19e))/0x8*(parseInt(_0x3e2d41(0x1d9))/0x9)+-parseInt(_0x3e2d41(0x1b0))/0xa*(parseInt(_0x3e2d41(0x17a))/0xb);if(_0x229d94===_0x3cfdd6)break;else _0x413f5e['push'](_0x413f5e['shift']());}catch(_0x316152){_0x413f5e['push'](_0x413f5e['shift']());}}}(a0_0x27fe,0x4d3b2));import{EventEmitter as a0_0x3ef3ff}from'events';import{hostname as a0_0x4f787a}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x21fd9e,_0x49dcb5)=>(_0x21fd9e??_0x49dcb5)[a0_0x1a7b7b(0x1ca)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x1a7b7b(0x1aa)](0x0,0xf0);function a0_0xb7d1(_0x105827,_0x236745){_0x105827=_0x105827-0x159;const _0x27fe75=a0_0x27fe();let _0xb7d1c8=_0x27fe75[_0x105827];return _0xb7d1c8;}function N(_0x2d7611){const _0x2eb664=a0_0x1a7b7b;return(_0x2d7611 instanceof Error?_0x2d7611['message']:String(_0x2d7611??_0x2eb664(0x19f)))[_0x2eb664(0x1ca)](K,_0x2eb664(0x1b8))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x4a4817,_0x4316fb=process.env.ANET_TASK_TRACE_FORMAT===a0_0x1a7b7b(0x15d)){const _0x366580=a0_0x1a7b7b;if(_0x4316fb)return JSON[_0x366580(0x1a2)](_0x4a4817);let _0x186079=L(_0x4a4817[_0x366580(0x197)],'<missing>'),_0x179d0a=L(_0x4a4817[_0x366580(0x1a3)],_0x366580(0x1ab)),_0x545b25=_0x4a4817[_0x366580(0x166)]?_0x366580(0x196)+_0x4a4817['error_code']+':'+(_0x4a4817[_0x366580(0x198)]??''):'';return _0x366580(0x1ac)+_0x4a4817[_0x366580(0x177)]+_0x366580(0x1ba)+L(_0x4a4817['from_alias'],_0x366580(0x1a1))+_0x366580(0x19a)+L(_0x4a4817[_0x366580(0x199)],_0x366580(0x1a1))+_0x366580(0x1c7)+_0x179d0a+'\x20parent_task_id='+_0x186079+_0x366580(0x1a6)+L(_0x4a4817[_0x366580(0x1cf)],_0x366580(0x1a1))+_0x366580(0x167)+_0x4a4817[_0x366580(0x1b3)]+_0x366580(0x1d6)+_0x4a4817[_0x366580(0x1b7)]+_0x366580(0x1da)+_0x4a4817[_0x366580(0x159)]+_0x545b25;}function U(_0x46151d){const _0x5c6e74=a0_0x1a7b7b;return{'event':{'sending':_0x5c6e74(0x1b4),'delivered':'task.send.delivered','failed':'task.send.failed','acked':'task.ack','started':'task.started','replied':_0x5c6e74(0x1c2),'expired':_0x5c6e74(0x161)}[_0x46151d[_0x5c6e74(0x177)]],..._0x46151d};}function j(_0x38bd1b){const _0x2130af=a0_0x1a7b7b;let _0x22edb4=_0x38bd1b?.['task_id']||_0x38bd1b?.[_0x2130af(0x16d)]||_0x38bd1b?.['id'];if(_0x22edb4)return String(_0x22edb4);let _0x4391f9=_0x38bd1b?.['content']?.[0x0]?.[_0x2130af(0x182)];if(typeof _0x4391f9!==_0x2130af(0x162))return null;try{let _0x55f7d7=JSON[_0x2130af(0x1bd)](_0x4391f9);return _0x55f7d7?.[_0x2130af(0x1a3)]||_0x55f7d7?.[_0x2130af(0x16d)]||_0x55f7d7?.['id']||null;}catch{return null;}}async function X(_0x25ea99,_0x5a2c5c){const _0x10f98b=a0_0x1a7b7b;let _0x415d12=_0x5a2c5c['now']??Date[_0x10f98b(0x176)],_0x4f1a0f=_0x415d12(),_0x480ab7=(_0x2768f0,_0x180c0c,_0x291e3f,_0x1ab843)=>{const _0x43aded=_0x10f98b;_0x5a2c5c['log'](O(U({'from_alias':_0x25ea99[_0x43aded(0x1db)],'to_alias':_0x25ea99[_0x43aded(0x1d2)],'task_id':_0x180c0c,'parent_task_id':_0x25ea99[_0x43aded(0x1d1)],'network_id':_0x25ea99['networkId'],'transport':_0x25ea99['transport'],'status':_0x2768f0,'duration_ms':_0x415d12()-_0x4f1a0f,'lifecycle_tracking':_0x25ea99[_0x43aded(0x15b)],..._0x291e3f!==void 0x0?{'error_code':_0x1ab843||_0x43aded(0x18a),'error_message':N(_0x291e3f)}:{}})));};_0x480ab7('sending',null);try{let _0x2d3c76=await _0x5a2c5c[_0x10f98b(0x19d)](),_0x49aeae=j(_0x2d3c76);if(_0x49aeae)_0x480ab7(_0x10f98b(0x1b9),_0x49aeae);else{if(_0x2d3c76?.['ok']===!0x1||_0x2d3c76?.[_0x10f98b(0x15f)])_0x480ab7('failed',_0x49aeae,_0x2d3c76?.[_0x10f98b(0x15f)]||_0x10f98b(0x1cc),_0x10f98b(0x183));else _0x480ab7('failed',null,_0x10f98b(0x191),'missing_task_id');}return _0x2d3c76;}catch(_0x5ae34c){throw _0x480ab7(_0x10f98b(0x18c),null,_0x5ae34c,'send_failed'),_0x5ae34c;}}function a0_0x27fe(){const _0x3dc577=['decode','emit','registered','name','76xYNayB','send_failed','alias','failed','cwd','603646migLvK','networkId','report_status','CommHub\x20response\x20omitted\x20task_id','agent','messages','disconnected','s...','\x20error=','parent_task_id','error_message','to_alias','\x20to=','connectSSE','get_all_status','send','8DTWIpp','unknown\x20error','sseAbort','<unknown>','stringify','task_id','tools/call','mcp_http','\x20network_id=','pop','heartbeatInterval','10bUKkgA','slice','<pending>','[commhub:task]\x20','sdk','get_inbox','split','40jtDtVV','result','idle','transport','task.send.start','heartbeatTimer','ack_inbox','duration_ms','[REDACTED]','delivered','\x20from=','heartbeat\x20failed:\x20','SSE\x20reconnecting\x20in\x20','parse','122831QAIlit','task','POST','new_task','task.replied','log','message','Authorization','abort','\x20task_id=','normal','match','replace','application/json,\x20text/event-stream','CommHub\x20rejected\x20task','token','disconnect','network_id','send_task','parentTaskId','toAlias','url','from_session','2.0','\x20duration_ms=','min','12183yLeDvp','5557896cEGPKb','\x20lifecycle=','fromAlias','lifecycle_tracking','Bearer\x20','lifecycleTracking','catch','json','SSE\x20connected','error','call','task.expired','string','startsWith','155436FoJBVX','getAllStatus','error_code','\x20transport=','broadcast','application/json','reconnectDelay','toString','not_tracked','message_id','resumeId','send_reply',']\x20[commhub:','connect','sdk-','running','sleep','toTimeString','now','status','completed','/events/','43714tBnBkG','body','getReader','autoConnect','content','SSE\x20failed:\x20','type','4152911YKylCH','text','send_rejected','AbortError'];a0_0x27fe=function(){return _0x3dc577;};return a0_0x27fe();}async function Y(_0x3f4d86,_0x2a188c){const _0x5bb92f=a0_0x1a7b7b;return X({'fromAlias':_0x3f4d86['fromAlias'],'toAlias':_0x3f4d86[_0x5bb92f(0x18b)],'parentTaskId':_0x3f4d86[_0x5bb92f(0x1d1)]||null,'networkId':_0x3f4d86[_0x5bb92f(0x18f)]||null,'transport':_0x5bb92f(0x1a5),'lifecycleTracking':_0x5bb92f(0x16c)},_0x2a188c);}class $ extends a0_0x3ef3ff{[a0_0x1a7b7b(0x1d3)];['alias'];[a0_0x1a7b7b(0x1cd)];[a0_0x1a7b7b(0x192)];[a0_0x1a7b7b(0x16e)];[a0_0x1a7b7b(0x1a8)];[a0_0x1a7b7b(0x16a)];['heartbeatTimer'];[a0_0x1a7b7b(0x1a0)];[a0_0x1a7b7b(0x173)]=!0x1;constructor(_0x10d30c){const _0x15d9b0=a0_0x1a7b7b;super();if(this[_0x15d9b0(0x1d3)]=_0x10d30c[_0x15d9b0(0x1d3)]['replace'](/\/$/,''),this[_0x15d9b0(0x18b)]=_0x10d30c[_0x15d9b0(0x18b)],this['token']=_0x10d30c[_0x15d9b0(0x1cd)],this[_0x15d9b0(0x192)]=_0x10d30c['agent']||_0x15d9b0(0x1ad),this['resumeId']=_0x15d9b0(0x172)+_0x10d30c[_0x15d9b0(0x18b)]+'-'+Date[_0x15d9b0(0x176)]()[_0x15d9b0(0x16b)](0x24),this[_0x15d9b0(0x1a8)]=_0x10d30c[_0x15d9b0(0x1a8)]??0x2bf20,this[_0x15d9b0(0x16a)]=_0x10d30c['reconnectDelay']??0xbb8,_0x10d30c[_0x15d9b0(0x17d)]!==!0x1)this[_0x15d9b0(0x171)]();}[a0_0x1a7b7b(0x1c3)](_0x3af729){const _0x1922a8=a0_0x1a7b7b;console[_0x1922a8(0x1c3)]('['+new Date()[_0x1922a8(0x175)]()['slice'](0x0,0x8)+_0x1922a8(0x170)+this[_0x1922a8(0x18b)]+']\x20'+_0x3af729);}async[a0_0x1a7b7b(0x160)](_0xe4c7b6,_0x2f2390){const _0x1c2606=a0_0x1a7b7b;let _0x509df2={'Content-Type':_0x1c2606(0x169),'Accept':_0x1c2606(0x1cb)};if(this[_0x1c2606(0x1cd)])_0x509df2[_0x1c2606(0x1c5)]='Bearer\x20'+this[_0x1c2606(0x1cd)];let _0x36e012=await(await fetch(this[_0x1c2606(0x1d3)]+'/mcp',{'method':_0x1c2606(0x1c0),'headers':_0x509df2,'body':JSON[_0x1c2606(0x1a2)]({'jsonrpc':_0x1c2606(0x1d5),'id':Date[_0x1c2606(0x176)](),'method':_0x1c2606(0x1a4),'params':{'name':_0xe4c7b6,'arguments':_0x2f2390}})}))[_0x1c2606(0x182)](),_0xd7b9b5=_0x36e012[_0x1c2606(0x1c9)](/data: (.+)/),_0x107647=_0xd7b9b5?JSON[_0x1c2606(0x1bd)](_0xd7b9b5[0x1]):JSON[_0x1c2606(0x1bd)](_0x36e012),_0x40377d=_0x107647?.[_0x1c2606(0x1b1)]?.['content']?.[0x0]?.[_0x1c2606(0x182)];return _0x40377d?JSON['parse'](_0x40377d):_0x107647;}async[a0_0x1a7b7b(0x171)](){const _0x2f0c28=a0_0x1a7b7b;if(this[_0x2f0c28(0x173)])return;this[_0x2f0c28(0x173)]=!0x0,await this['status'](_0x2f0c28(0x1b2)),this[_0x2f0c28(0x1c3)](_0x2f0c28(0x187)),this[_0x2f0c28(0x1b5)]=setInterval(()=>{const _0x1da1d6=_0x2f0c28;this['status']('idle')[_0x1da1d6(0x15c)](_0x46fb73=>this['log'](_0x1da1d6(0x1bb)+_0x46fb73[_0x1da1d6(0x1c4)]));},this['heartbeatInterval']),this['connectSSE']();}async[a0_0x1a7b7b(0x1ce)](){const _0x6d4962=a0_0x1a7b7b;if(this[_0x6d4962(0x173)]=!0x1,this['sseAbort']?.[_0x6d4962(0x1c6)](),this[_0x6d4962(0x1b5)])clearInterval(this[_0x6d4962(0x1b5)]);await this[_0x6d4962(0x177)]('offline')[_0x6d4962(0x15c)](()=>{}),this[_0x6d4962(0x1c3)]('disconnected');}async[a0_0x1a7b7b(0x19d)](_0x1ee25b,_0x3c924e,_0x32683e=a0_0x1a7b7b(0x1c8)){const _0x4e5258=a0_0x1a7b7b;return Y({'alias':_0x1ee25b,'fromAlias':this[_0x4e5258(0x18b)]},{'log':_0x39d045=>console[_0x4e5258(0x1c3)](_0x39d045),'send':()=>this[_0x4e5258(0x160)](_0x4e5258(0x1d0),{'alias':_0x1ee25b,'task':_0x3c924e,'priority':_0x32683e,'from_session':this['alias']})});}async['message'](_0x5adef0,_0x31d674){const _0x163b69=a0_0x1a7b7b;return this[_0x163b69(0x160)]('send_message',{'alias':_0x5adef0,'message':_0x31d674,'from_session':this['alias']});}async['reply'](_0x4dbd91,_0x2c8d62,_0x31936c=a0_0x1a7b7b(0x178)){const _0x5c4457=a0_0x1a7b7b;return this[_0x5c4457(0x160)](_0x5c4457(0x16f),{'in_reply_to':_0x4dbd91,'text':_0x2c8d62,'status':_0x31936c});}async[a0_0x1a7b7b(0x177)](_0x569d04,_0x54086b){const _0x9cdf20=a0_0x1a7b7b;return this[_0x9cdf20(0x160)](_0x9cdf20(0x190),{'resume_id':this['resumeId'],'alias':this[_0x9cdf20(0x18b)],'status':_0x569d04,'server':a0_0x4f787a(),'hostname':a0_0x4f787a(),'agent':this['agent'],'project_dir':process[_0x9cdf20(0x18d)](),..._0x54086b});}async[a0_0x1a7b7b(0x165)](){const _0x3be1bb=a0_0x1a7b7b;return this[_0x3be1bb(0x160)](_0x3be1bb(0x19c),{});}async[a0_0x1a7b7b(0x168)](_0x24a929,_0x433873){const _0x49ff7b=a0_0x1a7b7b;return this[_0x49ff7b(0x160)](_0x49ff7b(0x168),{'message':_0x24a929,'filter_server':_0x433873?.['server'],'filter_status':_0x433873?.[_0x49ff7b(0x177)]});}async[a0_0x1a7b7b(0x19b)](){const _0x4404c8=a0_0x1a7b7b;let _0x2a85ff=encodeURIComponent(this[_0x4404c8(0x18b)]),_0x4e5f54=this['url']+_0x4404c8(0x179)+_0x2a85ff,_0x33a024=this['reconnectDelay'];while(this[_0x4404c8(0x173)]){try{this[_0x4404c8(0x1a0)]=new AbortController();let _0x446333={'Accept':'text/event-stream'};if(this['token'])_0x446333['Authorization']=_0x4404c8(0x15a)+this[_0x4404c8(0x1cd)];let _0x51f1a8=await fetch(_0x4e5f54,{'headers':_0x446333,'signal':this[_0x4404c8(0x1a0)]['signal']});if(!_0x51f1a8['ok']||!_0x51f1a8[_0x4404c8(0x17b)]){this[_0x4404c8(0x1c3)](_0x4404c8(0x17f)+_0x51f1a8['status']),await this[_0x4404c8(0x174)](_0x33a024),_0x33a024=Math[_0x4404c8(0x1d7)](_0x33a024*1.5,0xea60);continue;}_0x33a024=this[_0x4404c8(0x16a)];let _0x7f242a=_0x51f1a8[_0x4404c8(0x17b)][_0x4404c8(0x17c)](),_0x4c0fee=new TextDecoder(),_0x1f318a='';while(this['running']){let {done:_0x3906e9,value:_0x3e7805}=await _0x7f242a['read']();if(_0x3906e9)break;_0x1f318a+=_0x4c0fee[_0x4404c8(0x185)](_0x3e7805,{'stream':!0x0});let _0x3e7d05=_0x1f318a[_0x4404c8(0x1af)]('\x0a');_0x1f318a=_0x3e7d05[_0x4404c8(0x1a7)]()||'';for(let _0x1880fc of _0x3e7d05){if(!_0x1880fc[_0x4404c8(0x163)]('data:\x20'))continue;try{let _0x64fdc0=JSON[_0x4404c8(0x1bd)](_0x1880fc[_0x4404c8(0x1aa)](0x6));if(_0x64fdc0[_0x4404c8(0x180)]==='connected'){this[_0x4404c8(0x1c3)](_0x4404c8(0x15e)),this[_0x4404c8(0x186)]('connected');continue;}if(_0x64fdc0[_0x4404c8(0x180)]===_0x4404c8(0x1c1)||_0x64fdc0[_0x4404c8(0x180)]==='new_message'||_0x64fdc0[_0x4404c8(0x180)]===_0x4404c8(0x168))await this['processInbox']();}catch{}}}}catch(_0x3542a4){if(_0x3542a4[_0x4404c8(0x188)]===_0x4404c8(0x184))break;this[_0x4404c8(0x186)](_0x4404c8(0x15f),_0x3542a4),this[_0x4404c8(0x1c3)]('SSE\x20error:\x20'+_0x3542a4[_0x4404c8(0x1c4)]);}if(this['running'])this[_0x4404c8(0x186)](_0x4404c8(0x194)),this[_0x4404c8(0x1c3)](_0x4404c8(0x1bc)+_0x33a024/0x3e8+_0x4404c8(0x195)),await this['sleep'](_0x33a024),_0x33a024=Math['min'](_0x33a024*1.5,0xea60);}}async['processInbox'](){const _0x528eb2=a0_0x1a7b7b;try{let _0x106403=(await this[_0x528eb2(0x160)](_0x528eb2(0x1ae),{'alias':this['alias'],'limit':0xa}))?.[_0x528eb2(0x193)]||[];for(let _0xc09b99 of _0x106403)await this[_0x528eb2(0x160)](_0x528eb2(0x1b6),{'alias':this['alias'],'message_id':_0xc09b99['id']}),this[_0x528eb2(0x1c3)]('←\x20'+_0xc09b99[_0x528eb2(0x1d4)]+':\x20'+_0xc09b99[_0x528eb2(0x17e)][_0x528eb2(0x1aa)](0x0,0x3c)),this[_0x528eb2(0x186)](_0x528eb2(0x1bf),_0xc09b99),this['emit'](_0x528eb2(0x1c4),_0xc09b99);}catch(_0x2398c5){this[_0x528eb2(0x1c3)]('inbox\x20error:\x20'+_0x2398c5['message']);}}['sleep'](_0x2736d6){return new Promise(_0x4a4f96=>setTimeout(_0x4a4f96,_0x2736d6));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x517d1f=a0_0x35cf;(function(_0x3a1ffa,_0x243bbe){const _0x3f1791=a0_0x35cf,_0xb95119=_0x3a1ffa();while(!![]){try{const _0x59c2d4=-parseInt(_0x3f1791(0x150))/0x1*(parseInt(_0x3f1791(0x161))/0x2)+-parseInt(_0x3f1791(0x12d))/0x3+-parseInt(_0x3f1791(0x160))/0x4*(parseInt(_0x3f1791(0x179))/0x5)+-parseInt(_0x3f1791(0x176))/0x6+parseInt(_0x3f1791(0x157))/0x7+-parseInt(_0x3f1791(0x17d))/0x8+parseInt(_0x3f1791(0x109))/0x9;if(_0x59c2d4===_0x243bbe)break;else _0xb95119['push'](_0xb95119['shift']());}catch(_0x18916b){_0xb95119['push'](_0xb95119['shift']());}}}(a0_0x42bb,0x9090a));import{EventEmitter as a0_0x1726db}from'events';import{hostname as a0_0x2b7564}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4212b3,_0x117c43)=>(_0x4212b3??_0x117c43)[a0_0x517d1f(0x136)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x517d1f(0x126)](0x0,0xf0);function N(_0x338ee8){const _0x4567d5=a0_0x517d1f;return(_0x338ee8 instanceof Error?_0x338ee8[_0x4567d5(0x171)]:String(_0x338ee8??'unknown\x20error'))[_0x4567d5(0x136)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4567d5(0x126)](0x0,0xf0);}function O(_0x4e5718,_0x577c25=process.env.ANET_TASK_TRACE_FORMAT===a0_0x517d1f(0x17e)){const _0x685adc=a0_0x517d1f;if(_0x577c25)return JSON[_0x685adc(0x17a)](_0x4e5718);let _0x5a1be1=L(_0x4e5718[_0x685adc(0xfe)],_0x685adc(0x164)),_0x593441=L(_0x4e5718[_0x685adc(0x11a)],_0x685adc(0x105)),_0x5231ba=_0x4e5718[_0x685adc(0x119)]?'\x20error='+_0x4e5718[_0x685adc(0x119)]+':'+(_0x4e5718[_0x685adc(0x149)]??''):'';return'[commhub:task]\x20'+_0x4e5718[_0x685adc(0x10c)]+'\x20from='+L(_0x4e5718[_0x685adc(0x134)],_0x685adc(0x103))+_0x685adc(0x17b)+L(_0x4e5718[_0x685adc(0x153)],_0x685adc(0x103))+_0x685adc(0x147)+_0x593441+_0x685adc(0x11c)+_0x5a1be1+_0x685adc(0x12a)+L(_0x4e5718[_0x685adc(0x12e)],_0x685adc(0x103))+_0x685adc(0x140)+_0x4e5718[_0x685adc(0x172)]+'\x20duration_ms='+_0x4e5718[_0x685adc(0x14e)]+_0x685adc(0x117)+_0x4e5718[_0x685adc(0x15e)]+_0x5231ba;}function U(_0x40baca){const _0x5ebdc3=a0_0x517d1f;return{'event':{'sending':_0x5ebdc3(0x148),'delivered':_0x5ebdc3(0x10b),'failed':_0x5ebdc3(0x115),'acked':_0x5ebdc3(0x111),'started':_0x5ebdc3(0x108),'replied':_0x5ebdc3(0x168),'expired':_0x5ebdc3(0x129)}[_0x40baca[_0x5ebdc3(0x10c)]],..._0x40baca};}function j(_0x5edc64){const _0x1b2749=a0_0x517d1f;let _0x4947da=_0x5edc64?.[_0x1b2749(0x11a)]||_0x5edc64?.[_0x1b2749(0x14d)]||_0x5edc64?.['id'];if(_0x4947da)return String(_0x4947da);let _0x1196e3=_0x5edc64?.[_0x1b2749(0x15b)]?.[0x0]?.[_0x1b2749(0x15c)];if(typeof _0x1196e3!==_0x1b2749(0x11b))return null;try{let _0x15e866=JSON[_0x1b2749(0x13a)](_0x1196e3);return _0x15e866?.[_0x1b2749(0x11a)]||_0x15e866?.['message_id']||_0x15e866?.['id']||null;}catch{return null;}}async function X(_0x3436c1,_0x1cbc1e){const _0x37621e=a0_0x517d1f;let _0x35cb93=_0x1cbc1e['now']??Date['now'],_0x56f2b8=_0x35cb93(),_0x5285c7=(_0x17e458,_0x3bbaac,_0x55bfca,_0x4e49f5)=>{const _0x118583=a0_0x35cf;_0x1cbc1e['log'](O(U({'from_alias':_0x3436c1[_0x118583(0x16f)],'to_alias':_0x3436c1['toAlias'],'task_id':_0x3bbaac,'parent_task_id':_0x3436c1[_0x118583(0x13f)],'network_id':_0x3436c1[_0x118583(0x133)],'transport':_0x3436c1[_0x118583(0x172)],'status':_0x17e458,'duration_ms':_0x35cb93()-_0x56f2b8,'lifecycle_tracking':_0x3436c1[_0x118583(0x142)],..._0x55bfca!==void 0x0?{'error_code':_0x4e49f5||_0x118583(0x107),'error_message':N(_0x55bfca)}:{}})));};_0x5285c7(_0x37621e(0x163),null);try{let _0x19dfac=await _0x1cbc1e[_0x37621e(0x146)](),_0x569816=j(_0x19dfac);if(_0x569816)_0x5285c7(_0x37621e(0x152),_0x569816);else{if(_0x19dfac?.['ok']===!0x1||_0x19dfac?.[_0x37621e(0x12f)])_0x5285c7('failed',_0x569816,_0x19dfac?.['error']||_0x37621e(0x16b),_0x37621e(0x138));else _0x5285c7(_0x37621e(0x122),null,_0x37621e(0x10d),_0x37621e(0x16a));}return _0x19dfac;}catch(_0x4d0a25){throw _0x5285c7(_0x37621e(0x122),null,_0x4d0a25,'send_failed'),_0x4d0a25;}}async function Y(_0x410c09,_0x4b2793){const _0x3389d8=a0_0x517d1f;return X({'fromAlias':_0x410c09[_0x3389d8(0x16f)],'toAlias':_0x410c09[_0x3389d8(0x120)],'parentTaskId':_0x410c09[_0x3389d8(0x13f)]||null,'networkId':_0x410c09[_0x3389d8(0x133)]||null,'transport':'mcp_http','lifecycleTracking':_0x3389d8(0x177)},_0x4b2793);}function a0_0x42bb(){const _0x1cb441=['autoConnect','reply','task.send.failed','sdk','\x20lifecycle=','application/json','error_code','task_id','string','\x20parent_task_id=','broadcast','running','heartbeatTimer','alias','toString','failed','data:\x20','SSE\x20error:\x20','body','slice','send_reply','catch','task.expired','\x20network_id=','cwd','disconnect','2390448eAQtjT','network_id','error','normal','reconnectDelay','send_message','networkId','from_alias','task','replace','POST','send_rejected','heartbeat\x20failed:\x20','parse','text/event-stream','connected','log','server','parentTaskId','\x20transport=','processInbox','lifecycleTracking','disconnected','SSE\x20reconnecting\x20in\x20','SSE\x20failed:\x20','send','\x20task_id=','task.send.start','error_message','inbox\x20error:\x20','url','s...','message_id','duration_ms','sdk-','101197oJghsY','startsWith','delivered','to_alias','Authorization','offline','agent','7899164ifhwUo','read','name','ack_inbox','content','text','new_task','lifecycle_tracking','sleep','4nYQPYv','2mLxLVp','application/json,\x20text/event-stream','sending','<missing>','connectSSE','token','get_all_status','task.replied','match','missing_task_id','CommHub\x20rejected\x20task','2.0','type','now','fromAlias','get_inbox','message','transport','connect','Bearer\x20','resumeId','5880894yUXmsS','not_tracked','idle','4747115iMCoMb','stringify','\x20to=','pop','1110064iiTLvU','json','parent_task_id','heartbeatInterval','abort','/events/','signal','<unknown>','min','<pending>','completed','send_failed','task.started','21870261WPafHy','/mcp','task.send.delivered','status','CommHub\x20response\x20omitted\x20task_id','sseAbort','call','getReader','task.ack','emit'];a0_0x42bb=function(){return _0x1cb441;};return a0_0x42bb();}class $ extends a0_0x1726db{[a0_0x517d1f(0x14b)];[a0_0x517d1f(0x120)];[a0_0x517d1f(0x166)];[a0_0x517d1f(0x156)];[a0_0x517d1f(0x175)];['heartbeatInterval'];[a0_0x517d1f(0x131)];[a0_0x517d1f(0x11f)];['sseAbort'];[a0_0x517d1f(0x11e)]=!0x1;constructor(_0x3b8333){const _0x50b9fa=a0_0x517d1f;super();if(this[_0x50b9fa(0x14b)]=_0x3b8333[_0x50b9fa(0x14b)]['replace'](/\/$/,''),this['alias']=_0x3b8333['alias'],this['token']=_0x3b8333[_0x50b9fa(0x166)],this[_0x50b9fa(0x156)]=_0x3b8333[_0x50b9fa(0x156)]||_0x50b9fa(0x116),this[_0x50b9fa(0x175)]=_0x50b9fa(0x14f)+_0x3b8333[_0x50b9fa(0x120)]+'-'+Date[_0x50b9fa(0x16e)]()[_0x50b9fa(0x121)](0x24),this['heartbeatInterval']=_0x3b8333[_0x50b9fa(0xff)]??0x2bf20,this['reconnectDelay']=_0x3b8333[_0x50b9fa(0x131)]??0xbb8,_0x3b8333[_0x50b9fa(0x113)]!==!0x1)this[_0x50b9fa(0x173)]();}[a0_0x517d1f(0x13d)](_0x29c842){const _0x5b7ca1=a0_0x517d1f;console[_0x5b7ca1(0x13d)]('['+new Date()['toTimeString']()[_0x5b7ca1(0x126)](0x0,0x8)+']\x20[commhub:'+this[_0x5b7ca1(0x120)]+']\x20'+_0x29c842);}async['call'](_0x1ac54c,_0x13971c){const _0x2e9985=a0_0x517d1f;let _0x84c15d={'Content-Type':_0x2e9985(0x118),'Accept':_0x2e9985(0x162)};if(this[_0x2e9985(0x166)])_0x84c15d[_0x2e9985(0x154)]=_0x2e9985(0x174)+this[_0x2e9985(0x166)];let _0x3aa945=await(await fetch(this[_0x2e9985(0x14b)]+_0x2e9985(0x10a),{'method':_0x2e9985(0x137),'headers':_0x84c15d,'body':JSON[_0x2e9985(0x17a)]({'jsonrpc':_0x2e9985(0x16c),'id':Date['now'](),'method':'tools/call','params':{'name':_0x1ac54c,'arguments':_0x13971c}})}))[_0x2e9985(0x15c)](),_0x378c2e=_0x3aa945[_0x2e9985(0x169)](/data: (.+)/),_0x1b1da6=_0x378c2e?JSON[_0x2e9985(0x13a)](_0x378c2e[0x1]):JSON['parse'](_0x3aa945),_0x9d31ba=_0x1b1da6?.['result']?.[_0x2e9985(0x15b)]?.[0x0]?.[_0x2e9985(0x15c)];return _0x9d31ba?JSON[_0x2e9985(0x13a)](_0x9d31ba):_0x1b1da6;}async[a0_0x517d1f(0x173)](){const _0x114cf1=a0_0x517d1f;if(this['running'])return;this[_0x114cf1(0x11e)]=!0x0,await this[_0x114cf1(0x10c)](_0x114cf1(0x178)),this[_0x114cf1(0x13d)]('registered'),this[_0x114cf1(0x11f)]=setInterval(()=>{const _0x238fc1=_0x114cf1;this['status'](_0x238fc1(0x178))['catch'](_0x360aa0=>this[_0x238fc1(0x13d)](_0x238fc1(0x139)+_0x360aa0['message']));},this[_0x114cf1(0xff)]),this[_0x114cf1(0x165)]();}async[a0_0x517d1f(0x12c)](){const _0x1394f2=a0_0x517d1f;if(this[_0x1394f2(0x11e)]=!0x1,this['sseAbort']?.[_0x1394f2(0x100)](),this['heartbeatTimer'])clearInterval(this[_0x1394f2(0x11f)]);await this[_0x1394f2(0x10c)](_0x1394f2(0x155))[_0x1394f2(0x128)](()=>{}),this[_0x1394f2(0x13d)](_0x1394f2(0x143));}async['send'](_0x2d0a2f,_0xab1b7c,_0x49cdd5=a0_0x517d1f(0x130)){const _0x172c0f=a0_0x517d1f;return Y({'alias':_0x2d0a2f,'fromAlias':this[_0x172c0f(0x120)]},{'log':_0x1efd3d=>console['log'](_0x1efd3d),'send':()=>this['call']('send_task',{'alias':_0x2d0a2f,'task':_0xab1b7c,'priority':_0x49cdd5,'from_session':this[_0x172c0f(0x120)]})});}async['message'](_0xa67724,_0x4dd06d){const _0x5ebbd2=a0_0x517d1f;return this[_0x5ebbd2(0x10f)](_0x5ebbd2(0x132),{'alias':_0xa67724,'message':_0x4dd06d,'from_session':this['alias']});}async[a0_0x517d1f(0x114)](_0x3dd789,_0x234a18,_0x2fe917=a0_0x517d1f(0x106)){const _0x1c55db=a0_0x517d1f;return this[_0x1c55db(0x10f)](_0x1c55db(0x127),{'in_reply_to':_0x3dd789,'text':_0x234a18,'status':_0x2fe917});}async[a0_0x517d1f(0x10c)](_0x1f3dc7,_0x5de153){const _0x1a5e89=a0_0x517d1f;return this[_0x1a5e89(0x10f)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x1f3dc7,'server':a0_0x2b7564(),'hostname':a0_0x2b7564(),'agent':this['agent'],'project_dir':process[_0x1a5e89(0x12b)](),..._0x5de153});}async['getAllStatus'](){const _0x3aefb0=a0_0x517d1f;return this[_0x3aefb0(0x10f)](_0x3aefb0(0x167),{});}async[a0_0x517d1f(0x11d)](_0x4ec4c6,_0x3388dc){const _0x53973b=a0_0x517d1f;return this['call'](_0x53973b(0x11d),{'message':_0x4ec4c6,'filter_server':_0x3388dc?.[_0x53973b(0x13e)],'filter_status':_0x3388dc?.[_0x53973b(0x10c)]});}async[a0_0x517d1f(0x165)](){const _0x369ede=a0_0x517d1f;let _0x2f7edd=encodeURIComponent(this['alias']),_0x131ba4=this[_0x369ede(0x14b)]+_0x369ede(0x101)+_0x2f7edd,_0x25dc02=this[_0x369ede(0x131)];while(this[_0x369ede(0x11e)]){try{this[_0x369ede(0x10e)]=new AbortController();let _0x24a0f1={'Accept':_0x369ede(0x13b)};if(this[_0x369ede(0x166)])_0x24a0f1[_0x369ede(0x154)]=_0x369ede(0x174)+this['token'];let _0x297ef3=await fetch(_0x131ba4,{'headers':_0x24a0f1,'signal':this['sseAbort'][_0x369ede(0x102)]});if(!_0x297ef3['ok']||!_0x297ef3[_0x369ede(0x125)]){this[_0x369ede(0x13d)](_0x369ede(0x145)+_0x297ef3['status']),await this[_0x369ede(0x15f)](_0x25dc02),_0x25dc02=Math[_0x369ede(0x104)](_0x25dc02*1.5,0xea60);continue;}_0x25dc02=this[_0x369ede(0x131)];let _0xb4fed6=_0x297ef3[_0x369ede(0x125)][_0x369ede(0x110)](),_0x292ca6=new TextDecoder(),_0x12c6f1='';while(this[_0x369ede(0x11e)]){let {done:_0x1af3dc,value:_0x3ebeb6}=await _0xb4fed6[_0x369ede(0x158)]();if(_0x1af3dc)break;_0x12c6f1+=_0x292ca6['decode'](_0x3ebeb6,{'stream':!0x0});let _0x44a389=_0x12c6f1['split']('\x0a');_0x12c6f1=_0x44a389[_0x369ede(0x17c)]()||'';for(let _0x1ac5b5 of _0x44a389){if(!_0x1ac5b5[_0x369ede(0x151)](_0x369ede(0x123)))continue;try{let _0x3973f2=JSON['parse'](_0x1ac5b5[_0x369ede(0x126)](0x6));if(_0x3973f2['type']===_0x369ede(0x13c)){this['log']('SSE\x20connected'),this[_0x369ede(0x112)](_0x369ede(0x13c));continue;}if(_0x3973f2[_0x369ede(0x16d)]===_0x369ede(0x15d)||_0x3973f2['type']==='new_message'||_0x3973f2[_0x369ede(0x16d)]===_0x369ede(0x11d))await this[_0x369ede(0x141)]();}catch{}}}}catch(_0x45a0df){if(_0x45a0df[_0x369ede(0x159)]==='AbortError')break;this['emit'](_0x369ede(0x12f),_0x45a0df),this['log'](_0x369ede(0x124)+_0x45a0df[_0x369ede(0x171)]);}if(this[_0x369ede(0x11e)])this[_0x369ede(0x112)]('disconnected'),this[_0x369ede(0x13d)](_0x369ede(0x144)+_0x25dc02/0x3e8+_0x369ede(0x14c)),await this[_0x369ede(0x15f)](_0x25dc02),_0x25dc02=Math[_0x369ede(0x104)](_0x25dc02*1.5,0xea60);}}async[a0_0x517d1f(0x141)](){const _0x37260=a0_0x517d1f;try{let _0x17ad16=(await this[_0x37260(0x10f)](_0x37260(0x170),{'alias':this[_0x37260(0x120)],'limit':0xa}))?.['messages']||[];for(let _0x41b47d of _0x17ad16)await this['call'](_0x37260(0x15a),{'alias':this[_0x37260(0x120)],'message_id':_0x41b47d['id']}),this['log']('←\x20'+_0x41b47d['from_session']+':\x20'+_0x41b47d[_0x37260(0x15b)]['slice'](0x0,0x3c)),this[_0x37260(0x112)](_0x37260(0x135),_0x41b47d),this['emit']('message',_0x41b47d);}catch(_0xca6970){this[_0x37260(0x13d)](_0x37260(0x14a)+_0xca6970[_0x37260(0x171)]);}}[a0_0x517d1f(0x15f)](_0x32b102){return new Promise(_0x4f7788=>setTimeout(_0x4f7788,_0x32b102));}}var F=$;function a0_0x35cf(_0x3c6411,_0x4a2004){_0x3c6411=_0x3c6411-0xfe;const _0x42bb64=a0_0x42bb();let _0x35cf0c=_0x42bb64[_0x3c6411];return _0x35cf0c;}export{F as default,$ as CommHub};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CopresenceStartupFailure {
|
|
2
|
+
/** 等的那个 attach launcher 路径。 */
|
|
3
|
+
attachScript: string;
|
|
4
|
+
/** bridge 输出的落盘文件(可能还不存在——bridge 可能压根没起来)。 */
|
|
5
|
+
bridgeLog: string;
|
|
6
|
+
/** 节点自己的日志目录。 */
|
|
7
|
+
nodeLogDir: string;
|
|
8
|
+
/** 判定失败的那一刻,bridge 的 tmux 会话还在不在。 */
|
|
9
|
+
bridgeAlive: boolean;
|
|
10
|
+
/** 等了多少秒。 */
|
|
11
|
+
waitedSeconds: number;
|
|
12
|
+
/** 落盘日志的尾巴(读不到就给空串)。 */
|
|
13
|
+
logTail: string;
|
|
14
|
+
/** tmux pane 的尾巴;会话已死时必然是空。 */
|
|
15
|
+
paneTail: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function describeCopresenceStartupFailure(f: CopresenceStartupFailure): string[];
|