@sleep2agi/agent-network 2.3.0-preview.263 → 2.3.0-preview.265
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/build-info.json +4 -3
- package/dist/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/node-create-network.d.ts +17 -0
- package/dist/src/node-server.js +8 -8
- package/dist/src/opencode-agent-node-pair.d.ts +6 -6
- package/dist/src/opencode-generation-create.d.ts +10 -0
- package/dist/src/sse-session-match.d.ts +13 -0
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x250709=a0_0x2e28;(function(_0x214ef6,_0x55066f){const _0x8d354a=a0_0x2e28,_0x5b9091=_0x214ef6();while(!![]){try{const _0x4a4d01=-parseInt(_0x8d354a(0xba))/0x1+-parseInt(_0x8d354a(0xa1))/0x2*(-parseInt(_0x8d354a(0xd2))/0x3)+-parseInt(_0x8d354a(0x8e))/0x4+parseInt(_0x8d354a(0xd9))/0x5+-parseInt(_0x8d354a(0xce))/0x6*(parseInt(_0x8d354a(0xe5))/0x7)+-parseInt(_0x8d354a(0xe1))/0x8*(parseInt(_0x8d354a(0x73))/0x9)+parseInt(_0x8d354a(0x9a))/0xa;if(_0x4a4d01===_0x55066f)break;else _0x5b9091['push'](_0x5b9091['shift']());}catch(_0xd9fe05){_0x5b9091['push'](_0x5b9091['shift']());}}}(a0_0x1b83,0x4c4a6));import{EventEmitter as a0_0x1d9de2}from'events';import{hostname as a0_0x25b044}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1c19e1,_0x3daf75)=>(_0x1c19e1??_0x3daf75)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x250709(0x82)](0x0,0xf0);function N(_0x711857){const _0x988ab7=a0_0x250709;return(_0x711857 instanceof Error?_0x711857[_0x988ab7(0x6e)]:String(_0x711857??_0x988ab7(0x92)))[_0x988ab7(0xbf)](K,_0x988ab7(0xe8))[_0x988ab7(0xbf)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function a0_0x1b83(){const _0x30fd2d=['SSE\x20connected','name','reconnectDelay','token','SSE\x20reconnecting\x20in\x20','lifecycle_tracking','cwd','get_all_status','<missing>','tools/call','send_message','send_task','\x20parent_task_id=','51401TGbiBt','application/json','autoConnect','SSE\x20error:\x20','inbox\x20error:\x20','replace','processInbox','CommHub\x20rejected\x20task','type','new_message','error','Bearer\x20','networkId','connected','task','task.send.failed','/events/','SSE\x20failed:\x20','2.0','task_id','300SHaZCM','failed','task.started','emit','1354008iNkMPF','error_code','now','connect','log','idle','parse','2825535BclTgb','normal','application/json,\x20text/event-stream','task.replied','heartbeatInterval','AbortError','send_failed','\x20error=','1917560LtJLZc','text','delivered','toTimeString','371KwbhSy','Authorization','parent_task_id','[REDACTED]','message','\x20task_id=','CommHub\x20response\x20omitted\x20task_id','duration_ms','server','18VaFcGy','getAllStatus','task.send.delivered','\x20transport=','broadcast','read','<unknown>','result','fromAlias','call','task.send.start','\x20from=','sleep','mcp_http','report_status','slice','send_rejected','min','s...','not_tracked','match','send','sending','catch','body','url','resumeId','2430592ooYMCu',']\x20[commhub:','toString','running','unknown\x20error','get_inbox','sseAbort','status','task.expired','connectSSE','new_task','disconnect','4371320aFRIvt','to_alias','decode','/mcp','\x20lifecycle=','message_id','agent','2JlQyAZ','error_message','heartbeatTimer','transport','parentTaskId','network_id','content','offline','alias','getReader','disconnected','\x20duration_ms='];a0_0x1b83=function(){return _0x30fd2d;};return a0_0x1b83();}function O(_0x42ff55,_0x173015=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0xf85987=a0_0x250709;if(_0x173015)return JSON['stringify'](_0x42ff55);let _0x3de815=L(_0x42ff55[_0xf85987(0xe7)],_0xf85987(0xb5)),_0x599bb4=L(_0x42ff55[_0xf85987(0xcd)],'<pending>'),_0x273407=_0x42ff55[_0xf85987(0xd3)]?_0xf85987(0xe0)+_0x42ff55[_0xf85987(0xd3)]+':'+(_0x42ff55[_0xf85987(0xa2)]??''):'';return'[commhub:task]\x20'+_0x42ff55[_0xf85987(0x95)]+_0xf85987(0x7e)+L(_0x42ff55['from_alias'],_0xf85987(0x79))+'\x20to='+L(_0x42ff55[_0xf85987(0x9b)],_0xf85987(0x79))+_0xf85987(0x6f)+_0x599bb4+_0xf85987(0xb9)+_0x3de815+'\x20network_id='+L(_0x42ff55[_0xf85987(0xa6)],_0xf85987(0x79))+_0xf85987(0x76)+_0x42ff55['transport']+_0xf85987(0xac)+_0x42ff55[_0xf85987(0x71)]+_0xf85987(0x9e)+_0x42ff55[_0xf85987(0xb2)]+_0x273407;}function a0_0x2e28(_0x41d831,_0x43f250){_0x41d831=_0x41d831-0x6e;const _0x1b832d=a0_0x1b83();let _0x2e2837=_0x1b832d[_0x41d831];return _0x2e2837;}function U(_0x32ba6c){const _0x413c3a=a0_0x250709;return{'event':{'sending':_0x413c3a(0x7d),'delivered':_0x413c3a(0x75),'failed':_0x413c3a(0xc9),'acked':'task.ack','started':_0x413c3a(0xd0),'replied':_0x413c3a(0xdc),'expired':_0x413c3a(0x96)}[_0x32ba6c['status']],..._0x32ba6c};}function j(_0x49f308){const _0x2479e5=a0_0x250709;let _0x375f4f=_0x49f308?.[_0x2479e5(0xcd)]||_0x49f308?.[_0x2479e5(0x9f)]||_0x49f308?.['id'];if(_0x375f4f)return String(_0x375f4f);let _0x5ed2fd=_0x49f308?.[_0x2479e5(0xa7)]?.[0x0]?.[_0x2479e5(0xe2)];if(typeof _0x5ed2fd!=='string')return null;try{let _0x1445a3=JSON['parse'](_0x5ed2fd);return _0x1445a3?.[_0x2479e5(0xcd)]||_0x1445a3?.[_0x2479e5(0x9f)]||_0x1445a3?.['id']||null;}catch{return null;}}async function X(_0x4b58d1,_0x375ad9){const _0x785fed=a0_0x250709;let _0x53bdc0=_0x375ad9[_0x785fed(0xd4)]??Date[_0x785fed(0xd4)],_0x455be0=_0x53bdc0(),_0x5f5a47=(_0x4c0db1,_0x4b9daa,_0x2363a2,_0x1c2ca6)=>{const _0x480b35=_0x785fed;_0x375ad9[_0x480b35(0xd6)](O(U({'from_alias':_0x4b58d1[_0x480b35(0x7b)],'to_alias':_0x4b58d1['toAlias'],'task_id':_0x4b9daa,'parent_task_id':_0x4b58d1[_0x480b35(0xa5)],'network_id':_0x4b58d1[_0x480b35(0xc6)],'transport':_0x4b58d1[_0x480b35(0xa4)],'status':_0x4c0db1,'duration_ms':_0x53bdc0()-_0x455be0,'lifecycle_tracking':_0x4b58d1['lifecycleTracking'],..._0x2363a2!==void 0x0?{'error_code':_0x1c2ca6||_0x480b35(0xdf),'error_message':N(_0x2363a2)}:{}})));};_0x5f5a47(_0x785fed(0x89),null);try{let _0x31de65=await _0x375ad9[_0x785fed(0x88)](),_0x45365f=j(_0x31de65);if(_0x45365f)_0x5f5a47(_0x785fed(0xe3),_0x45365f);else{if(_0x31de65?.['ok']===!0x1||_0x31de65?.[_0x785fed(0xc4)])_0x5f5a47(_0x785fed(0xcf),_0x45365f,_0x31de65?.[_0x785fed(0xc4)]||_0x785fed(0xc1),_0x785fed(0x83));else _0x5f5a47(_0x785fed(0xcf),null,_0x785fed(0x70),'missing_task_id');}return _0x31de65;}catch(_0x572ffb){throw _0x5f5a47('failed',null,_0x572ffb,_0x785fed(0xdf)),_0x572ffb;}}async function Y(_0x454747,_0x2c22d6){const _0x3b5838=a0_0x250709;return X({'fromAlias':_0x454747[_0x3b5838(0x7b)],'toAlias':_0x454747[_0x3b5838(0xa9)],'parentTaskId':_0x454747[_0x3b5838(0xa5)]||null,'networkId':_0x454747[_0x3b5838(0xc6)]||null,'transport':_0x3b5838(0x80),'lifecycleTracking':_0x3b5838(0x86)},_0x2c22d6);}class $ extends a0_0x1d9de2{[a0_0x250709(0x8c)];[a0_0x250709(0xa9)];[a0_0x250709(0xb0)];[a0_0x250709(0xa0)];[a0_0x250709(0x8d)];[a0_0x250709(0xdd)];['reconnectDelay'];[a0_0x250709(0xa3)];[a0_0x250709(0x94)];[a0_0x250709(0x91)]=!0x1;constructor(_0x529b99){const _0x1fda21=a0_0x250709;super();if(this['url']=_0x529b99[_0x1fda21(0x8c)]['replace'](/\/$/,''),this['alias']=_0x529b99['alias'],this['token']=_0x529b99[_0x1fda21(0xb0)],this[_0x1fda21(0xa0)]=_0x529b99['agent']||'sdk',this[_0x1fda21(0x8d)]='sdk-'+_0x529b99[_0x1fda21(0xa9)]+'-'+Date[_0x1fda21(0xd4)]()[_0x1fda21(0x90)](0x24),this[_0x1fda21(0xdd)]=_0x529b99[_0x1fda21(0xdd)]??0x2bf20,this[_0x1fda21(0xaf)]=_0x529b99[_0x1fda21(0xaf)]??0xbb8,_0x529b99[_0x1fda21(0xbc)]!==!0x1)this[_0x1fda21(0xd5)]();}[a0_0x250709(0xd6)](_0x46807a){const _0x69dcaf=a0_0x250709;console[_0x69dcaf(0xd6)]('['+new Date()[_0x69dcaf(0xe4)]()[_0x69dcaf(0x82)](0x0,0x8)+_0x69dcaf(0x8f)+this[_0x69dcaf(0xa9)]+']\x20'+_0x46807a);}async['call'](_0x4c18ff,_0x5dd282){const _0x51d405=a0_0x250709;let _0x310452={'Content-Type':_0x51d405(0xbb),'Accept':_0x51d405(0xdb)};if(this[_0x51d405(0xb0)])_0x310452[_0x51d405(0xe6)]=_0x51d405(0xc5)+this[_0x51d405(0xb0)];let _0x5560b0=await(await fetch(this[_0x51d405(0x8c)]+_0x51d405(0x9d),{'method':'POST','headers':_0x310452,'body':JSON['stringify']({'jsonrpc':_0x51d405(0xcc),'id':Date[_0x51d405(0xd4)](),'method':_0x51d405(0xb6),'params':{'name':_0x4c18ff,'arguments':_0x5dd282}})}))[_0x51d405(0xe2)](),_0xc78e11=_0x5560b0[_0x51d405(0x87)](/data: (.+)/),_0x2fdfb1=_0xc78e11?JSON[_0x51d405(0xd8)](_0xc78e11[0x1]):JSON['parse'](_0x5560b0),_0x1fb409=_0x2fdfb1?.[_0x51d405(0x7a)]?.[_0x51d405(0xa7)]?.[0x0]?.[_0x51d405(0xe2)];return _0x1fb409?JSON[_0x51d405(0xd8)](_0x1fb409):_0x2fdfb1;}async[a0_0x250709(0xd5)](){const _0x136d86=a0_0x250709;if(this[_0x136d86(0x91)])return;this['running']=!0x0,await this[_0x136d86(0x95)](_0x136d86(0xd7)),this[_0x136d86(0xd6)]('registered'),this[_0x136d86(0xa3)]=setInterval(()=>{const _0xab4749=_0x136d86;this['status'](_0xab4749(0xd7))[_0xab4749(0x8a)](_0x108c0d=>this['log']('heartbeat\x20failed:\x20'+_0x108c0d[_0xab4749(0x6e)]));},this[_0x136d86(0xdd)]),this[_0x136d86(0x97)]();}async[a0_0x250709(0x99)](){const _0x13033e=a0_0x250709;if(this[_0x13033e(0x91)]=!0x1,this[_0x13033e(0x94)]?.['abort'](),this[_0x13033e(0xa3)])clearInterval(this[_0x13033e(0xa3)]);await this['status'](_0x13033e(0xa8))['catch'](()=>{}),this[_0x13033e(0xd6)](_0x13033e(0xab));}async['send'](_0x55c386,_0x491d31,_0x52e316=a0_0x250709(0xda)){const _0x12fd47=a0_0x250709;return Y({'alias':_0x55c386,'fromAlias':this[_0x12fd47(0xa9)]},{'log':_0x210c62=>console[_0x12fd47(0xd6)](_0x210c62),'send':()=>this['call'](_0x12fd47(0xb8),{'alias':_0x55c386,'task':_0x491d31,'priority':_0x52e316,'from_session':this[_0x12fd47(0xa9)]})});}async[a0_0x250709(0x6e)](_0x2a1536,_0x449280){const _0x5df2a4=a0_0x250709;return this[_0x5df2a4(0x7c)](_0x5df2a4(0xb7),{'alias':_0x2a1536,'message':_0x449280,'from_session':this[_0x5df2a4(0xa9)]});}async['reply'](_0x44b7ca,_0x4eccda,_0xc05fc5='completed'){const _0x52e49b=a0_0x250709;return this[_0x52e49b(0x7c)]('send_reply',{'in_reply_to':_0x44b7ca,'text':_0x4eccda,'status':_0xc05fc5});}async[a0_0x250709(0x95)](_0x4d81a9,_0x50b1d3){const _0x1c1db1=a0_0x250709;return this[_0x1c1db1(0x7c)](_0x1c1db1(0x81),{'resume_id':this[_0x1c1db1(0x8d)],'alias':this['alias'],'status':_0x4d81a9,'server':a0_0x25b044(),'hostname':a0_0x25b044(),'agent':this['agent'],'project_dir':process[_0x1c1db1(0xb3)](),..._0x50b1d3});}async[a0_0x250709(0x74)](){const _0x5aa99=a0_0x250709;return this[_0x5aa99(0x7c)](_0x5aa99(0xb4),{});}async[a0_0x250709(0x77)](_0x493e6e,_0x2819c2){const _0x5ba341=a0_0x250709;return this['call'](_0x5ba341(0x77),{'message':_0x493e6e,'filter_server':_0x2819c2?.[_0x5ba341(0x72)],'filter_status':_0x2819c2?.[_0x5ba341(0x95)]});}async[a0_0x250709(0x97)](){const _0x5f3625=a0_0x250709;let _0x433c0c=encodeURIComponent(this[_0x5f3625(0xa9)]),_0xe057a3=this[_0x5f3625(0x8c)]+_0x5f3625(0xca)+_0x433c0c,_0x39966e=this['reconnectDelay'];while(this[_0x5f3625(0x91)]){try{this[_0x5f3625(0x94)]=new AbortController();let _0x244c7d={'Accept':'text/event-stream'};if(this[_0x5f3625(0xb0)])_0x244c7d[_0x5f3625(0xe6)]=_0x5f3625(0xc5)+this['token'];let _0xaf42c0=await fetch(_0xe057a3,{'headers':_0x244c7d,'signal':this[_0x5f3625(0x94)]['signal']});if(!_0xaf42c0['ok']||!_0xaf42c0[_0x5f3625(0x8b)]){this[_0x5f3625(0xd6)](_0x5f3625(0xcb)+_0xaf42c0[_0x5f3625(0x95)]),await this[_0x5f3625(0x7f)](_0x39966e),_0x39966e=Math[_0x5f3625(0x84)](_0x39966e*1.5,0xea60);continue;}_0x39966e=this[_0x5f3625(0xaf)];let _0x2406f6=_0xaf42c0[_0x5f3625(0x8b)][_0x5f3625(0xaa)](),_0x3eaf95=new TextDecoder(),_0x582b08='';while(this['running']){let {done:_0x45b12f,value:_0x146b67}=await _0x2406f6[_0x5f3625(0x78)]();if(_0x45b12f)break;_0x582b08+=_0x3eaf95[_0x5f3625(0x9c)](_0x146b67,{'stream':!0x0});let _0x49541d=_0x582b08['split']('\x0a');_0x582b08=_0x49541d['pop']()||'';for(let _0x2283d2 of _0x49541d){if(!_0x2283d2['startsWith']('data:\x20'))continue;try{let _0x40802f=JSON['parse'](_0x2283d2['slice'](0x6));if(_0x40802f[_0x5f3625(0xc2)]===_0x5f3625(0xc7)){this['log'](_0x5f3625(0xad)),this[_0x5f3625(0xd1)](_0x5f3625(0xc7));continue;}if(_0x40802f[_0x5f3625(0xc2)]===_0x5f3625(0x98)||_0x40802f[_0x5f3625(0xc2)]===_0x5f3625(0xc3)||_0x40802f[_0x5f3625(0xc2)]===_0x5f3625(0x77))await this['processInbox']();}catch{}}}}catch(_0x5175e4){if(_0x5175e4[_0x5f3625(0xae)]===_0x5f3625(0xde))break;this[_0x5f3625(0xd1)](_0x5f3625(0xc4),_0x5175e4),this['log'](_0x5f3625(0xbd)+_0x5175e4[_0x5f3625(0x6e)]);}if(this[_0x5f3625(0x91)])this[_0x5f3625(0xd1)](_0x5f3625(0xab)),this[_0x5f3625(0xd6)](_0x5f3625(0xb1)+_0x39966e/0x3e8+_0x5f3625(0x85)),await this[_0x5f3625(0x7f)](_0x39966e),_0x39966e=Math[_0x5f3625(0x84)](_0x39966e*1.5,0xea60);}}async[a0_0x250709(0xc0)](){const _0x218a71=a0_0x250709;try{let _0x237664=(await this[_0x218a71(0x7c)](_0x218a71(0x93),{'alias':this[_0x218a71(0xa9)],'limit':0xa}))?.['messages']||[];for(let _0x4ff0f3 of _0x237664)await this[_0x218a71(0x7c)]('ack_inbox',{'alias':this['alias'],'message_id':_0x4ff0f3['id']}),this['log']('←\x20'+_0x4ff0f3['from_session']+':\x20'+_0x4ff0f3['content'][_0x218a71(0x82)](0x0,0x3c)),this[_0x218a71(0xd1)](_0x218a71(0xc8),_0x4ff0f3),this[_0x218a71(0xd1)]('message',_0x4ff0f3);}catch(_0x406e04){this[_0x218a71(0xd6)](_0x218a71(0xbe)+_0x406e04['message']);}}[a0_0x250709(0x7f)](_0x407f4b){return new Promise(_0x23add1=>setTimeout(_0x23add1,_0x407f4b));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x2788ae=a0_0x1127;(function(_0x3e1f65,_0x5137d1){const _0x20846b=a0_0x1127,_0x1ec76a=_0x3e1f65();while(!![]){try{const _0x16182e=parseInt(_0x20846b(0x1c6))/0x1*(parseInt(_0x20846b(0x1ff))/0x2)+-parseInt(_0x20846b(0x1e6))/0x3*(-parseInt(_0x20846b(0x1d2))/0x4)+-parseInt(_0x20846b(0x1f1))/0x5+parseInt(_0x20846b(0x214))/0x6*(parseInt(_0x20846b(0x1de))/0x7)+parseInt(_0x20846b(0x226))/0x8+parseInt(_0x20846b(0x222))/0x9+-parseInt(_0x20846b(0x1e4))/0xa;if(_0x16182e===_0x5137d1)break;else _0x1ec76a['push'](_0x1ec76a['shift']());}catch(_0x3b237e){_0x1ec76a['push'](_0x1ec76a['shift']());}}}(a0_0x3164,0xa3798));import{EventEmitter as a0_0x128c83}from'events';import{hostname as a0_0x521838}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x5d91fa,_0xde6489)=>(_0x5d91fa??_0xde6489)[a0_0x2788ae(0x1ec)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2788ae(0x202)](0x0,0xf0);function N(_0xb11b93){const _0x199481=a0_0x2788ae;return(_0xb11b93 instanceof Error?_0xb11b93[_0x199481(0x220)]:String(_0xb11b93??_0x199481(0x1e9)))[_0x199481(0x1ec)](K,_0x199481(0x235))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x199481(0x202)](0x0,0xf0);}function O(_0x2b24e5,_0x10f149=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0xbb625e=a0_0x2788ae;if(_0x10f149)return JSON[_0xbb625e(0x238)](_0x2b24e5);let _0x2b99a9=L(_0x2b24e5[_0xbb625e(0x237)],_0xbb625e(0x1d5)),_0x48558a=L(_0x2b24e5['task_id'],'<pending>'),_0x492f0c=_0x2b24e5['error_code']?_0xbb625e(0x22d)+_0x2b24e5['error_code']+':'+(_0x2b24e5[_0xbb625e(0x234)]??''):'';return'[commhub:task]\x20'+_0x2b24e5['status']+'\x20from='+L(_0x2b24e5[_0xbb625e(0x1fa)],_0xbb625e(0x22a))+_0xbb625e(0x1c3)+L(_0x2b24e5[_0xbb625e(0x23d)],'<unknown>')+_0xbb625e(0x205)+_0x48558a+_0xbb625e(0x219)+_0x2b99a9+_0xbb625e(0x1e0)+L(_0x2b24e5[_0xbb625e(0x231)],_0xbb625e(0x22a))+_0xbb625e(0x20a)+_0x2b24e5[_0xbb625e(0x22c)]+'\x20duration_ms='+_0x2b24e5[_0xbb625e(0x1c5)]+_0xbb625e(0x1e7)+_0x2b24e5['lifecycle_tracking']+_0x492f0c;}function a0_0x1127(_0x4067eb,_0x43e514){_0x4067eb=_0x4067eb-0x1c1;const _0x316496=a0_0x3164();let _0x1127db=_0x316496[_0x4067eb];return _0x1127db;}function U(_0xeba0e4){const _0x542bb6=a0_0x2788ae;return{'event':{'sending':_0x542bb6(0x203),'delivered':'task.send.delivered','failed':_0x542bb6(0x233),'acked':_0x542bb6(0x229),'started':_0x542bb6(0x212),'replied':_0x542bb6(0x215),'expired':_0x542bb6(0x1f0)}[_0xeba0e4[_0x542bb6(0x217)]],..._0xeba0e4};}function j(_0x126311){const _0x403cc5=a0_0x2788ae;let _0x17ff82=_0x126311?.['task_id']||_0x126311?.[_0x403cc5(0x210)]||_0x126311?.['id'];if(_0x17ff82)return String(_0x17ff82);let _0xbcec94=_0x126311?.[_0x403cc5(0x23f)]?.[0x0]?.[_0x403cc5(0x1e1)];if(typeof _0xbcec94!==_0x403cc5(0x1cc))return null;try{let _0x4f79f4=JSON[_0x403cc5(0x1df)](_0xbcec94);return _0x4f79f4?.[_0x403cc5(0x1ed)]||_0x4f79f4?.[_0x403cc5(0x210)]||_0x4f79f4?.['id']||null;}catch{return null;}}async function X(_0x263660,_0x1eda36){const _0x561f45=a0_0x2788ae;let _0x5cf7ce=_0x1eda36[_0x561f45(0x1dc)]??Date['now'],_0x21886f=_0x5cf7ce(),_0x3e192a=(_0xdc3a19,_0x44a7b2,_0x5863ac,_0x4741ed)=>{const _0x158020=_0x561f45;_0x1eda36['log'](O(U({'from_alias':_0x263660[_0x158020(0x1cd)],'to_alias':_0x263660[_0x158020(0x1c7)],'task_id':_0x44a7b2,'parent_task_id':_0x263660['parentTaskId'],'network_id':_0x263660[_0x158020(0x1ee)],'transport':_0x263660[_0x158020(0x22c)],'status':_0xdc3a19,'duration_ms':_0x5cf7ce()-_0x21886f,'lifecycle_tracking':_0x263660[_0x158020(0x230)],..._0x5863ac!==void 0x0?{'error_code':_0x4741ed||_0x158020(0x21a),'error_message':N(_0x5863ac)}:{}})));};_0x3e192a(_0x561f45(0x20f),null);try{let _0x22394f=await _0x1eda36['send'](),_0x2a9809=j(_0x22394f);if(_0x2a9809)_0x3e192a('delivered',_0x2a9809);else{if(_0x22394f?.['ok']===!0x1||_0x22394f?.[_0x561f45(0x1dd)])_0x3e192a(_0x561f45(0x240),_0x2a9809,_0x22394f?.[_0x561f45(0x1dd)]||_0x561f45(0x218),_0x561f45(0x1d4));else _0x3e192a('failed',null,_0x561f45(0x23a),_0x561f45(0x1ea));}return _0x22394f;}catch(_0x13d14f){throw _0x3e192a(_0x561f45(0x240),null,_0x13d14f,'send_failed'),_0x13d14f;}}async function Y(_0x22ea2d,_0x2f88de){const _0x2f11c2=a0_0x2788ae;return X({'fromAlias':_0x22ea2d['fromAlias'],'toAlias':_0x22ea2d['alias'],'parentTaskId':_0x22ea2d[_0x2f11c2(0x20e)]||null,'networkId':_0x22ea2d[_0x2f11c2(0x1ee)]||null,'transport':_0x2f11c2(0x1f4),'lifecycleTracking':_0x2f11c2(0x20b)},_0x2f88de);}class $ extends a0_0x128c83{[a0_0x2788ae(0x1ef)];['alias'];[a0_0x2788ae(0x21f)];[a0_0x2788ae(0x20c)];[a0_0x2788ae(0x1f5)];[a0_0x2788ae(0x216)];[a0_0x2788ae(0x22e)];['heartbeatTimer'];[a0_0x2788ae(0x1f7)];[a0_0x2788ae(0x1d6)]=!0x1;constructor(_0x4ef2b7){const _0x37c722=a0_0x2788ae;super();if(this['url']=_0x4ef2b7['url'][_0x37c722(0x1ec)](/\/$/,''),this['alias']=_0x4ef2b7['alias'],this[_0x37c722(0x21f)]=_0x4ef2b7[_0x37c722(0x21f)],this[_0x37c722(0x20c)]=_0x4ef2b7[_0x37c722(0x20c)]||'sdk',this[_0x37c722(0x1f5)]='sdk-'+_0x4ef2b7[_0x37c722(0x211)]+'-'+Date[_0x37c722(0x1dc)]()[_0x37c722(0x1eb)](0x24),this[_0x37c722(0x216)]=_0x4ef2b7[_0x37c722(0x216)]??0x2bf20,this[_0x37c722(0x22e)]=_0x4ef2b7[_0x37c722(0x22e)]??0xbb8,_0x4ef2b7[_0x37c722(0x208)]!==!0x1)this[_0x37c722(0x1c9)]();}[a0_0x2788ae(0x1fc)](_0xc2ffc5){const _0x54dcfd=a0_0x2788ae;console['log']('['+new Date()['toTimeString']()['slice'](0x0,0x8)+_0x54dcfd(0x21e)+this[_0x54dcfd(0x211)]+']\x20'+_0xc2ffc5);}async[a0_0x2788ae(0x1f6)](_0x10b77a,_0x85186e){const _0x139943=a0_0x2788ae;let _0x534d11={'Content-Type':_0x139943(0x1fb),'Accept':_0x139943(0x1c8)};if(this[_0x139943(0x21f)])_0x534d11[_0x139943(0x23c)]=_0x139943(0x223)+this[_0x139943(0x21f)];let _0xdabf5a=await(await fetch(this[_0x139943(0x1ef)]+_0x139943(0x236),{'method':_0x139943(0x206),'headers':_0x534d11,'body':JSON['stringify']({'jsonrpc':'2.0','id':Date[_0x139943(0x1dc)](),'method':'tools/call','params':{'name':_0x10b77a,'arguments':_0x85186e}})}))[_0x139943(0x1e1)](),_0x4cd71a=_0xdabf5a[_0x139943(0x1c1)](/data: (.+)/),_0x373799=_0x4cd71a?JSON[_0x139943(0x1df)](_0x4cd71a[0x1]):JSON[_0x139943(0x1df)](_0xdabf5a),_0x2ff6d0=_0x373799?.[_0x139943(0x1cb)]?.[_0x139943(0x23f)]?.[0x0]?.['text'];return _0x2ff6d0?JSON[_0x139943(0x1df)](_0x2ff6d0):_0x373799;}async[a0_0x2788ae(0x1c9)](){const _0x36e2f2=a0_0x2788ae;if(this[_0x36e2f2(0x1d6)])return;this[_0x36e2f2(0x1d6)]=!0x0,await this[_0x36e2f2(0x217)](_0x36e2f2(0x22f)),this[_0x36e2f2(0x1fc)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x1b499e=_0x36e2f2;this[_0x1b499e(0x217)](_0x1b499e(0x22f))[_0x1b499e(0x21d)](_0x32cccf=>this[_0x1b499e(0x1fc)](_0x1b499e(0x1d7)+_0x32cccf[_0x1b499e(0x220)]));},this[_0x36e2f2(0x216)]),this[_0x36e2f2(0x224)]();}async[a0_0x2788ae(0x1d1)](){const _0x4fb8ce=a0_0x2788ae;if(this[_0x4fb8ce(0x1d6)]=!0x1,this['sseAbort']?.['abort'](),this[_0x4fb8ce(0x200)])clearInterval(this['heartbeatTimer']);await this[_0x4fb8ce(0x217)](_0x4fb8ce(0x1fd))[_0x4fb8ce(0x21d)](()=>{}),this[_0x4fb8ce(0x1fc)](_0x4fb8ce(0x209));}async[a0_0x2788ae(0x1d0)](_0x2bee36,_0x470a5c,_0x55fe1f=a0_0x2788ae(0x1fe)){const _0x1e08bf=a0_0x2788ae;return Y({'alias':_0x2bee36,'fromAlias':this['alias']},{'log':_0x28108f=>console[_0x1e08bf(0x1fc)](_0x28108f),'send':()=>this[_0x1e08bf(0x1f6)](_0x1e08bf(0x239),{'alias':_0x2bee36,'task':_0x470a5c,'priority':_0x55fe1f,'from_session':this[_0x1e08bf(0x211)]})});}async[a0_0x2788ae(0x220)](_0x543b90,_0x3fb63a){const _0x4c326d=a0_0x2788ae;return this[_0x4c326d(0x1f6)](_0x4c326d(0x1f3),{'alias':_0x543b90,'message':_0x3fb63a,'from_session':this['alias']});}async[a0_0x2788ae(0x213)](_0x2da846,_0x5f130f,_0x33cac7=a0_0x2788ae(0x21c)){const _0x556af2=a0_0x2788ae;return this[_0x556af2(0x1f6)](_0x556af2(0x1cf),{'in_reply_to':_0x2da846,'text':_0x5f130f,'status':_0x33cac7});}async[a0_0x2788ae(0x217)](_0x2f7277,_0x1c9a14){const _0x5275bd=a0_0x2788ae;return this['call'](_0x5275bd(0x23b),{'resume_id':this[_0x5275bd(0x1f5)],'alias':this[_0x5275bd(0x211)],'status':_0x2f7277,'server':a0_0x521838(),'hostname':a0_0x521838(),'agent':this['agent'],'project_dir':process['cwd'](),..._0x1c9a14});}async[a0_0x2788ae(0x1e2)](){const _0x54ab57=a0_0x2788ae;return this[_0x54ab57(0x1f6)](_0x54ab57(0x1e8),{});}async[a0_0x2788ae(0x1ce)](_0x4bd048,_0x43060d){const _0x1c0bc6=a0_0x2788ae;return this[_0x1c0bc6(0x1f6)](_0x1c0bc6(0x1ce),{'message':_0x4bd048,'filter_server':_0x43060d?.['server'],'filter_status':_0x43060d?.['status']});}async[a0_0x2788ae(0x224)](){const _0x3e5de4=a0_0x2788ae;let _0x21cc29=encodeURIComponent(this['alias']),_0x13cb91=this[_0x3e5de4(0x1ef)]+_0x3e5de4(0x221)+_0x21cc29,_0x13b96a=this[_0x3e5de4(0x22e)];while(this[_0x3e5de4(0x1d6)]){try{this['sseAbort']=new AbortController();let _0x2d57df={'Accept':_0x3e5de4(0x207)};if(this[_0x3e5de4(0x21f)])_0x2d57df[_0x3e5de4(0x23c)]=_0x3e5de4(0x223)+this['token'];let _0x4a35bf=await fetch(_0x13cb91,{'headers':_0x2d57df,'signal':this[_0x3e5de4(0x1f7)][_0x3e5de4(0x1e3)]});if(!_0x4a35bf['ok']||!_0x4a35bf[_0x3e5de4(0x242)]){this[_0x3e5de4(0x1fc)](_0x3e5de4(0x1f2)+_0x4a35bf[_0x3e5de4(0x217)]),await this[_0x3e5de4(0x243)](_0x13b96a),_0x13b96a=Math[_0x3e5de4(0x1d9)](_0x13b96a*1.5,0xea60);continue;}_0x13b96a=this['reconnectDelay'];let _0x46d92a=_0x4a35bf['body'][_0x3e5de4(0x1e5)](),_0x3cecf0=new TextDecoder(),_0x1ed38a='';while(this[_0x3e5de4(0x1d6)]){let {done:_0x183582,value:_0xcb0011}=await _0x46d92a[_0x3e5de4(0x1d3)]();if(_0x183582)break;_0x1ed38a+=_0x3cecf0['decode'](_0xcb0011,{'stream':!0x0});let _0x944dcf=_0x1ed38a[_0x3e5de4(0x1db)]('\x0a');_0x1ed38a=_0x944dcf[_0x3e5de4(0x232)]()||'';for(let _0x1ddbf1 of _0x944dcf){if(!_0x1ddbf1[_0x3e5de4(0x1ca)](_0x3e5de4(0x227)))continue;try{let _0xaf7b2f=JSON[_0x3e5de4(0x1df)](_0x1ddbf1[_0x3e5de4(0x202)](0x6));if(_0xaf7b2f[_0x3e5de4(0x23e)]==='connected'){this['log'](_0x3e5de4(0x228)),this[_0x3e5de4(0x1f9)]('connected');continue;}if(_0xaf7b2f[_0x3e5de4(0x23e)]==='new_task'||_0xaf7b2f[_0x3e5de4(0x23e)]==='new_message'||_0xaf7b2f[_0x3e5de4(0x23e)]===_0x3e5de4(0x1ce))await this[_0x3e5de4(0x22b)]();}catch{}}}}catch(_0x3df3a4){if(_0x3df3a4[_0x3e5de4(0x201)]===_0x3e5de4(0x20d))break;this[_0x3e5de4(0x1f9)]('error',_0x3df3a4),this[_0x3e5de4(0x1fc)](_0x3e5de4(0x1c4)+_0x3df3a4[_0x3e5de4(0x220)]);}if(this[_0x3e5de4(0x1d6)])this[_0x3e5de4(0x1f9)](_0x3e5de4(0x209)),this[_0x3e5de4(0x1fc)](_0x3e5de4(0x204)+_0x13b96a/0x3e8+_0x3e5de4(0x1da)),await this[_0x3e5de4(0x243)](_0x13b96a),_0x13b96a=Math[_0x3e5de4(0x1d9)](_0x13b96a*1.5,0xea60);}}async['processInbox'](){const _0x4c3c5e=a0_0x2788ae;try{let _0x2a15aa=(await this[_0x4c3c5e(0x1f6)](_0x4c3c5e(0x1d8),{'alias':this[_0x4c3c5e(0x211)],'limit':0xa}))?.[_0x4c3c5e(0x21b)]||[];for(let _0x434266 of _0x2a15aa)await this['call'](_0x4c3c5e(0x241),{'alias':this['alias'],'message_id':_0x434266['id']}),this[_0x4c3c5e(0x1fc)]('←\x20'+_0x434266[_0x4c3c5e(0x225)]+':\x20'+_0x434266[_0x4c3c5e(0x23f)][_0x4c3c5e(0x202)](0x0,0x3c)),this[_0x4c3c5e(0x1f9)](_0x4c3c5e(0x1c2),_0x434266),this[_0x4c3c5e(0x1f9)](_0x4c3c5e(0x220),_0x434266);}catch(_0x1d986e){this[_0x4c3c5e(0x1fc)](_0x4c3c5e(0x1f8)+_0x1d986e[_0x4c3c5e(0x220)]);}}[a0_0x2788ae(0x243)](_0x380ea0){return new Promise(_0x5ae906=>setTimeout(_0x5ae906,_0x380ea0));}}function a0_0x3164(){const _0x307d82=['CommHub\x20response\x20omitted\x20task_id','report_status','Authorization','to_alias','type','content','failed','ack_inbox','body','sleep','match','task','\x20to=','SSE\x20error:\x20','duration_ms','11683IrUoVR','toAlias','application/json,\x20text/event-stream','connect','startsWith','result','string','fromAlias','broadcast','send_reply','send','disconnect','3576292ksKFIC','read','send_rejected','<missing>','running','heartbeat\x20failed:\x20','get_inbox','min','s...','split','now','error','4637143iwayUG','parse','\x20network_id=','text','getAllStatus','signal','21028050vAMiNt','getReader','3dwyomF','\x20lifecycle=','get_all_status','unknown\x20error','missing_task_id','toString','replace','task_id','networkId','url','task.expired','5988725EvRQMx','SSE\x20failed:\x20','send_message','mcp_http','resumeId','call','sseAbort','inbox\x20error:\x20','emit','from_alias','application/json','log','offline','normal','166CcvTey','heartbeatTimer','name','slice','task.send.start','SSE\x20reconnecting\x20in\x20','\x20task_id=','POST','text/event-stream','autoConnect','disconnected','\x20transport=','not_tracked','agent','AbortError','parentTaskId','sending','message_id','alias','task.started','reply','12KaEooZ','task.replied','heartbeatInterval','status','CommHub\x20rejected\x20task','\x20parent_task_id=','send_failed','messages','completed','catch',']\x20[commhub:','token','message','/events/','779292lupqeD','Bearer\x20','connectSSE','from_session','5559152qFqipT','data:\x20','SSE\x20connected','task.ack','<unknown>','processInbox','transport','\x20error=','reconnectDelay','idle','lifecycleTracking','network_id','pop','task.send.failed','error_message','[REDACTED]','/mcp','parent_task_id','stringify','send_task'];a0_0x3164=function(){return _0x307d82;};return a0_0x3164();}var F=$;export{F as default,$ as CommHub};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HubNetwork } from "./node-ls-all";
|
|
2
|
+
export declare const WRITABLE_CREATE_NETWORK_ROLES: Set<string>;
|
|
3
|
+
export type CreateNetworkResolution = {
|
|
4
|
+
ok: true;
|
|
5
|
+
network_id: string;
|
|
6
|
+
network_name: string | null;
|
|
7
|
+
} | {
|
|
8
|
+
ok: false;
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Resolve an explicit `--network <id|name>` flag for `anet node create`.
|
|
13
|
+
*
|
|
14
|
+
* Uses the same exact-id / exact-name / unique-prefix matcher as `anet node ls --all`
|
|
15
|
+
* (`pickNetwork`), and refuses read-only memberships before requesting a node token.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveExplicitCreateNetwork(networks: HubNetwork[], rawFlag: string | undefined): CreateNetworkResolution;
|