@sleep2agi/agent-network 2.3.0-preview.32 → 2.3.0-preview.33
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 +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const a0_0xabe5fa=a0_0x488d;(function(_0x31e846,_0x222515){const _0x175214=a0_0x488d,_0x1967a4=_0x31e846();while(!![]){try{const _0x98b6e7=-parseInt(_0x175214(0xa6))/0x1*(-parseInt(_0x175214(0xa2))/0x2)+-parseInt(_0x175214(0x8d))/0x3*(-parseInt(_0x175214(0x7d))/0x4)+-parseInt(_0x175214(0xa9))/0x5+parseInt(_0x175214(0xb6))/0x6+parseInt(_0x175214(0xcf))/0x7*(-parseInt(_0x175214(0xb7))/0x8)+-parseInt(_0x175214(0xce))/0x9*(-parseInt(_0x175214(0x78))/0xa)+parseInt(_0x175214(0x88))/0xb*(-parseInt(_0x175214(0x7b))/0xc);if(_0x98b6e7===_0x222515)break;else _0x1967a4['push'](_0x1967a4['shift']());}catch(_0x1caa2e){_0x1967a4['push'](_0x1967a4['shift']());}}}(a0_0x1290,0x59f6d));import{EventEmitter as a0_0x539576}from'events';function a0_0x488d(_0x4a470f,_0x4a68b2){_0x4a470f=_0x4a470f-0x78;const _0x1290f6=a0_0x1290();let _0x488d8=_0x1290f6[_0x4a470f];return _0x488d8;}import{hostname as a0_0x394ad7}from'os';class T extends a0_0x539576{['url'];[a0_0xabe5fa(0xb2)];[a0_0xabe5fa(0xbf)];[a0_0xabe5fa(0x9f)];['resumeId'];[a0_0xabe5fa(0x8b)];[a0_0xabe5fa(0x9b)];['heartbeatTimer'];[a0_0xabe5fa(0xb5)];['running']=!0x1;constructor(_0x4d5613){const _0x577477=a0_0xabe5fa;super();if(this[_0x577477(0x8e)]=_0x4d5613[_0x577477(0x8e)][_0x577477(0x9a)](/\/$/,''),this['alias']=_0x4d5613[_0x577477(0xb2)],this[_0x577477(0xbf)]=_0x4d5613[_0x577477(0xbf)],this[_0x577477(0x9f)]=_0x4d5613['agent']||'sdk',this[_0x577477(0xae)]=_0x577477(0xc2)+_0x4d5613[_0x577477(0xb2)]+'-'+Date[_0x577477(0xbb)]()[_0x577477(0xa0)](0x24),this[_0x577477(0x8b)]=_0x4d5613[_0x577477(0x8b)]??0x2bf20,this[_0x577477(0x9b)]=_0x4d5613[_0x577477(0x9b)]??0xbb8,_0x4d5613['autoConnect']!==!0x1)this['connect']();}[a0_0xabe5fa(0x99)](_0x23c816){const _0xb18d1e=a0_0xabe5fa;console['log']('['+new Date()[_0xb18d1e(0xa5)]()[_0xb18d1e(0xc9)](0x0,0x8)+_0xb18d1e(0x7a)+this['alias']+']\x20'+_0x23c816);}async['call'](_0x4f4d7b,_0x182fa3){const _0x282218=a0_0xabe5fa;let _0x2de449={'Content-Type':_0x282218(0x97),'Accept':_0x282218(0xa1)};if(this[_0x282218(0xbf)])_0x2de449[_0x282218(0x8f)]='Bearer\x20'+this['token'];let _0x30087f=await(await fetch(this[_0x282218(0x8e)]+_0x282218(0x86),{'method':_0x282218(0xa3),'headers':_0x2de449,'body':JSON[_0x282218(0xc0)]({'jsonrpc':_0x282218(0xc1),'id':Date[_0x282218(0xbb)](),'method':_0x282218(0xb9),'params':{'name':_0x4f4d7b,'arguments':_0x182fa3}})}))[_0x282218(0xad)](),_0x26ce7c=_0x30087f['match'](/data: (.+)/),_0xd1ef47=_0x26ce7c?JSON[_0x282218(0xcd)](_0x26ce7c[0x1]):JSON[_0x282218(0xcd)](_0x30087f),_0x11f951=_0xd1ef47?.[_0x282218(0xab)]?.[_0x282218(0xbd)]?.[0x0]?.['text'];return _0x11f951?JSON[_0x282218(0xcd)](_0x11f951):_0xd1ef47;}async[a0_0xabe5fa(0xb3)](){const _0x31d312=a0_0xabe5fa;if(this[_0x31d312(0x91)])return;this['running']=!0x0,await this[_0x31d312(0xc8)](_0x31d312(0x79)),this[_0x31d312(0x99)](_0x31d312(0xb8)),this['heartbeatTimer']=setInterval(()=>{const _0x331cdb=_0x31d312;this[_0x331cdb(0xc8)](_0x331cdb(0x79))[_0x331cdb(0xc4)](_0x2b2f1b=>this[_0x331cdb(0x99)]('heartbeat\x20failed:\x20'+_0x2b2f1b[_0x331cdb(0xa7)]));},this['heartbeatInterval']),this[_0x31d312(0x90)]();}async[a0_0xabe5fa(0x94)](){const _0x23d47b=a0_0xabe5fa;if(this['running']=!0x1,this[_0x23d47b(0xb5)]?.[_0x23d47b(0xa4)](),this[_0x23d47b(0x84)])clearInterval(this[_0x23d47b(0x84)]);await this[_0x23d47b(0xc8)](_0x23d47b(0xac))[_0x23d47b(0xc4)](()=>{}),this[_0x23d47b(0x99)]('disconnected');}async['send'](_0xcbbf04,_0x32ea89,_0x371feb=a0_0xabe5fa(0xc7)){const _0x6b0db1=a0_0xabe5fa;return this[_0x6b0db1(0xb0)](_0x6b0db1(0x96),{'alias':_0xcbbf04,'task':_0x32ea89,'priority':_0x371feb,'from_session':this[_0x6b0db1(0xb2)]});}async[a0_0xabe5fa(0xa7)](_0x1beb3c,_0x29110d){const _0x505808=a0_0xabe5fa;return this['call']('send_message',{'alias':_0x1beb3c,'message':_0x29110d,'from_session':this[_0x505808(0xb2)]});}async[a0_0xabe5fa(0x89)](_0x243768,_0x5cedb4,_0x24e5da='completed'){const _0x4011b9=a0_0xabe5fa;return this[_0x4011b9(0xb0)](_0x4011b9(0xb4),{'in_reply_to':_0x243768,'text':_0x5cedb4,'status':_0x24e5da});}async[a0_0xabe5fa(0xc8)](_0xc4483a,_0x126e7e){const _0x74046f=a0_0xabe5fa;return this['call']('report_status',{'resume_id':this[_0x74046f(0xae)],'alias':this[_0x74046f(0xb2)],'status':_0xc4483a,'server':a0_0x394ad7(),'hostname':a0_0x394ad7(),'agent':this[_0x74046f(0x9f)],'project_dir':process[_0x74046f(0x8c)](),..._0x126e7e});}async[a0_0xabe5fa(0x81)](){const _0x3b48c3=a0_0xabe5fa;return this[_0x3b48c3(0xb0)]('get_all_status',{});}async[a0_0xabe5fa(0xa8)](_0x2ed927,_0x1e4d53){const _0x226893=a0_0xabe5fa;return this[_0x226893(0xb0)](_0x226893(0xa8),{'message':_0x2ed927,'filter_server':_0x1e4d53?.[_0x226893(0xaf)],'filter_status':_0x1e4d53?.[_0x226893(0xc8)]});}async['connectSSE'](){const _0x5cea1f=a0_0xabe5fa;let _0xd04e5=encodeURIComponent(this[_0x5cea1f(0xb2)]),_0x2ffd1c=this['url']+_0x5cea1f(0xcb)+_0xd04e5,_0x164717=this[_0x5cea1f(0x9b)];while(this[_0x5cea1f(0x91)]){try{this[_0x5cea1f(0xb5)]=new AbortController();let _0x399b0b={'Accept':'text/event-stream'};if(this[_0x5cea1f(0xbf)])_0x399b0b[_0x5cea1f(0x8f)]=_0x5cea1f(0xbc)+this['token'];let _0x5d1e9f=await fetch(_0x2ffd1c,{'headers':_0x399b0b,'signal':this[_0x5cea1f(0xb5)][_0x5cea1f(0x7e)]});if(!_0x5d1e9f['ok']||!_0x5d1e9f[_0x5cea1f(0x82)]){this[_0x5cea1f(0x99)](_0x5cea1f(0x83)+_0x5d1e9f[_0x5cea1f(0xc8)]),await this['sleep'](_0x164717),_0x164717=Math[_0x5cea1f(0x80)](_0x164717*1.5,0xea60);continue;}_0x164717=this[_0x5cea1f(0x9b)];let _0x39ba1a=_0x5d1e9f[_0x5cea1f(0x82)][_0x5cea1f(0x98)](),_0x10655b=new TextDecoder(),_0x104c45='';while(this[_0x5cea1f(0x91)]){let {done:_0x102c94,value:_0x34d5f4}=await _0x39ba1a[_0x5cea1f(0xcc)]();if(_0x102c94)break;_0x104c45+=_0x10655b[_0x5cea1f(0x92)](_0x34d5f4,{'stream':!0x0});let _0x32474c=_0x104c45[_0x5cea1f(0x7f)]('\x0a');_0x104c45=_0x32474c[_0x5cea1f(0x9e)]()||'';for(let _0x3152ad of _0x32474c){if(!_0x3152ad[_0x5cea1f(0xba)]('data:\x20'))continue;try{let _0x4815a2=JSON[_0x5cea1f(0xcd)](_0x3152ad[_0x5cea1f(0xc9)](0x6));if(_0x4815a2[_0x5cea1f(0x95)]===_0x5cea1f(0x87)){this[_0x5cea1f(0x99)](_0x5cea1f(0x93)),this[_0x5cea1f(0x9c)](_0x5cea1f(0x87));continue;}if(_0x4815a2[_0x5cea1f(0x95)]==='new_task'||_0x4815a2[_0x5cea1f(0x95)]===_0x5cea1f(0xca)||_0x4815a2['type']===_0x5cea1f(0xa8))await this[_0x5cea1f(0x7c)]();}catch{}}}}catch(_0xeda958){if(_0xeda958['name']==='AbortError')break;this[_0x5cea1f(0x9c)](_0x5cea1f(0x85),_0xeda958),this[_0x5cea1f(0x99)](_0x5cea1f(0x8a)+_0xeda958[_0x5cea1f(0xa7)]);}if(this[_0x5cea1f(0x91)])this[_0x5cea1f(0x9c)]('disconnected'),this[_0x5cea1f(0x99)]('SSE\x20reconnecting\x20in\x20'+_0x164717/0x3e8+_0x5cea1f(0xb1)),await this[_0x5cea1f(0xc6)](_0x164717),_0x164717=Math[_0x5cea1f(0x80)](_0x164717*1.5,0xea60);}}async[a0_0xabe5fa(0x7c)](){const _0x2cf4ba=a0_0xabe5fa;try{let _0x1fdf6a=(await this['call'](_0x2cf4ba(0x9d),{'alias':this[_0x2cf4ba(0xb2)],'limit':0xa}))?.[_0x2cf4ba(0xaa)]||[];for(let _0x171ffe of _0x1fdf6a)await this['call'](_0x2cf4ba(0xc5),{'alias':this[_0x2cf4ba(0xb2)],'message_id':_0x171ffe['id']}),this[_0x2cf4ba(0x99)]('←\x20'+_0x171ffe[_0x2cf4ba(0xc3)]+':\x20'+_0x171ffe[_0x2cf4ba(0xbd)]['slice'](0x0,0x3c)),this[_0x2cf4ba(0x9c)](_0x2cf4ba(0xbe),_0x171ffe),this['emit'](_0x2cf4ba(0xa7),_0x171ffe);}catch(_0x119411){this['log']('inbox\x20error:\x20'+_0x119411[_0x2cf4ba(0xa7)]);}}[a0_0xabe5fa(0xc6)](_0x49f5f4){return new Promise(_0x280c68=>setTimeout(_0x280c68,_0x49f5f4));}}var $=T;function a0_0x1290(){const _0x5b48b2=['running','decode','SSE\x20connected','disconnect','type','send_task','application/json','getReader','log','replace','reconnectDelay','emit','get_inbox','pop','agent','toString','application/json,\x20text/event-stream','1846eddNFT','POST','abort','toTimeString','362SCwjuB','message','broadcast','1330825Xsjlgl','messages','result','offline','text','resumeId','server','call','s...','alias','connect','send_reply','sseAbort','3498084KcTNcN','2682128NKgdIG','registered','tools/call','startsWith','now','Bearer\x20','content','task','token','stringify','2.0','sdk-','from_session','catch','ack_inbox','sleep','normal','status','slice','new_message','/events/','read','parse','10503JbvgtN','7MHDLBE','30CbvovA','idle',']\x20[commhub:','137532PzBAaT','processInbox','452qPXuVf','signal','split','min','getAllStatus','body','SSE\x20failed:\x20','heartbeatTimer','error','/mcp','connected','385BBuGDz','reply','SSE\x20error:\x20','heartbeatInterval','cwd','11958uoMnzl','url','Authorization','connectSSE'];a0_0x1290=function(){return _0x5b48b2;};return a0_0x1290();}export{$ as default,T as CommHub};
|
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x24b8d2=a0_0x1421;(function(_0x5878c9,_0x47e1a3){const _0x38c4e8=a0_0x1421,_0x31061b=_0x5878c9();while(!![]){try{const _0x4b6b23=-parseInt(_0x38c4e8(0x1b8))/0x1*(parseInt(_0x38c4e8(0x1ce))/0x2)+-parseInt(_0x38c4e8(0x194))/0x3+parseInt(_0x38c4e8(0x17b))/0x4+-parseInt(_0x38c4e8(0x172))/0x5+parseInt(_0x38c4e8(0x16a))/0x6+-parseInt(_0x38c4e8(0x1ad))/0x7+-parseInt(_0x38c4e8(0x15a))/0x8*(-parseInt(_0x38c4e8(0x188))/0x9);if(_0x4b6b23===_0x47e1a3)break;else _0x31061b['push'](_0x31061b['shift']());}catch(_0x525ad2){_0x31061b['push'](_0x31061b['shift']());}}}(a0_0x1c45,0x6cd19));import{readFileSync as a0_0x253642,existsSync as a0_0x58bf15}from'fs';import{randomUUID as a0_0x196c4b}from'crypto';import{join as a0_0x4084f1}from'path';import{hostname as a0_0x3c6840}from'os';import{execSync as a0_0x5e12e7}from'child_process';function B(_0x476ba9){const _0x5c954a=a0_0x1421;let _0x2ab572=_0x476ba9[_0x5c954a(0x19e)](/[^a-zA-Z0-9\-_]/g,'-');return _0x2ab572===''?_0x5c954a(0x195):_0x2ab572;}function a0_0x1421(_0x3507ba,_0x5c0f19){_0x3507ba=_0x3507ba-0x148;const _0x1c450a=a0_0x1c45();let _0x1421a4=_0x1c450a[_0x3507ba];return _0x1421a4;}import{Server as a0_0x34b4b9}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1f93af}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x40f659,CallToolRequestSchema as a0_0x318355}from'@modelcontextprotocol/sdk/types.js';function T(_0x181b8b){const _0x4dc1e3=a0_0x1421;if(!a0_0x58bf15(_0x181b8b))return;for(let _0x104633 of a0_0x253642(_0x181b8b,_0x4dc1e3(0x199))[_0x4dc1e3(0x1d0)]('\x0a')){let _0x5c480f=_0x104633[_0x4dc1e3(0x16d)]();if(!_0x5c480f||_0x5c480f[_0x4dc1e3(0x1c8)]('#'))continue;let _0x256bd7=_0x5c480f[_0x4dc1e3(0x1af)]('=');if(_0x256bd7<0x0)continue;let _0x571bf8=_0x5c480f[_0x4dc1e3(0x1bb)](0x0,_0x256bd7)[_0x4dc1e3(0x16d)](),_0x49a8ed=_0x5c480f['slice'](_0x256bd7+0x1)[_0x4dc1e3(0x16d)]()[_0x4dc1e3(0x19e)](/^["']|["']$/g,'');if(!process.env[_0x571bf8])process.env[_0x571bf8]=_0x49a8ed;}}var C=process.env.HOME||'~',r=a0_0x4084f1(C,'.claude/channels/commhub');T(a0_0x4084f1(r,a0_0x24b8d2(0x155)));var H=B(process[a0_0x24b8d2(0x178)]());T(a0_0x4084f1(r,H,a0_0x24b8d2(0x155)));function E(){const _0x204d9d=a0_0x24b8d2;try{return a0_0x5e12e7(_0x204d9d(0x1aa),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function _(){const _0x6bb1fd=a0_0x24b8d2;try{let _0x40b26c=a0_0x4084f1(C,_0x6bb1fd(0x169),_0x6bb1fd(0x1e6));if(a0_0x58bf15(_0x40b26c))return JSON['parse'](a0_0x253642(_0x40b26c,'utf-8'));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x24b8d2(0x1b4)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||E();function S(){const _0x12081c=a0_0x24b8d2;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x12081c(0x16d)]())return process.env.COMMHUB_ALIAS[_0x12081c(0x16d)]();return process[_0x12081c(0x15e)][_0x12081c(0x1d5)](_0x12081c(0x19d)+(_0x12081c(0x1db)+(j||'(none)')+_0x12081c(0x1c5)+a0_0x3c6840()+_0x12081c(0x1e5))),'unattributed-'+process[_0x12081c(0x161)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x196c4b(),k=process.env.COMMHUB_TOKEN||R[a0_0x24b8d2(0x150)]||'';function z(_0xa66984){const _0x43f624=a0_0x24b8d2;let _0x4cc164=new Date()['toTimeString']()[_0x43f624(0x1bb)](0x0,0x8);process[_0x43f624(0x15e)][_0x43f624(0x1d5)]('['+_0x4cc164+_0x43f624(0x18c)+_0xa66984+'\x0a');}function i(_0x21e041){return new Promise(_0x51a954=>setTimeout(_0x51a954,_0x21e041));}z(a0_0x24b8d2(0x1d8)+Y+a0_0x24b8d2(0x179)+p+a0_0x24b8d2(0x14f)+V[a0_0x24b8d2(0x1bb)](0x0,0x8)+a0_0x24b8d2(0x14d)+(j||'none')+a0_0x24b8d2(0x1d9)+process[a0_0x24b8d2(0x178)]()+a0_0x24b8d2(0x185)+H);var G=new Map(),K=new a0_0x34b4b9({'name':a0_0x24b8d2(0x151),'version':a0_0x24b8d2(0x154)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x24b8d2(0x15f),a0_0x24b8d2(0x1b1),a0_0x24b8d2(0x173),'Session\x20alias:\x20'+p]['join']('\x0a')});K[a0_0x24b8d2(0x168)](a0_0x40f659,async()=>({'tools':[{'name':a0_0x24b8d2(0x177),'description':a0_0x24b8d2(0x18a),'inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{'task_id':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x15d)},'text':{'type':'string','description':a0_0x24b8d2(0x1a2)},'status':{'type':a0_0x24b8d2(0x1c4),'enum':['completed',a0_0x24b8d2(0x148),a0_0x24b8d2(0x198),a0_0x24b8d2(0x15b),a0_0x24b8d2(0x1d2),a0_0x24b8d2(0x196)],'description':a0_0x24b8d2(0x170)}},'required':[a0_0x24b8d2(0x171)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{'status':{'type':a0_0x24b8d2(0x1c4),'enum':['working',a0_0x24b8d2(0x184),a0_0x24b8d2(0x15b),'error']},'task':{'type':'string','description':a0_0x24b8d2(0x1a1)},'progress':{'type':a0_0x24b8d2(0x18e),'description':a0_0x24b8d2(0x14e)}},'required':[a0_0x24b8d2(0x1ac)]}},{'name':a0_0x24b8d2(0x176),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{'alias':{'type':a0_0x24b8d2(0x1c4),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x1e2)},'priority':{'type':a0_0x24b8d2(0x1c4),'enum':[a0_0x24b8d2(0x191),a0_0x24b8d2(0x166),a0_0x24b8d2(0x1c0)],'description':a0_0x24b8d2(0x189)}},'required':['alias',a0_0x24b8d2(0x18f)]}},{'name':a0_0x24b8d2(0x1a4),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x17e)},'message':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x1d7)}},'required':[a0_0x24b8d2(0x158),a0_0x24b8d2(0x19c)]}},{'name':a0_0x24b8d2(0x153),'description':a0_0x24b8d2(0x1a5),'inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{}}}]}));async function Q(_0x375412,_0x14fe9b){const _0x145b4e=a0_0x24b8d2;let _0x4802ed=await fetch(Y+_0x145b4e(0x1b0),{'method':_0x145b4e(0x1a0),'headers':{'Content-Type':'application/json','Accept':_0x145b4e(0x1c2),...k?{'Authorization':'Bearer\x20'+k}:{}},'body':JSON[_0x145b4e(0x1cb)]({'jsonrpc':'2.0','id':0x1,'method':_0x145b4e(0x1c6),'params':{'protocolVersion':_0x145b4e(0x16f),'capabilities':{},'clientInfo':{'name':_0x145b4e(0x151),'version':_0x145b4e(0x154)}}})});if(!_0x4802ed['ok']){let _0x324dd8=await _0x4802ed[_0x145b4e(0x171)]();return z(_0x145b4e(0x1a7)+_0x4802ed[_0x145b4e(0x1ac)]+'\x20'+_0x324dd8[_0x145b4e(0x1bb)](0x0,0x64)),{'ok':!0x1,'error':_0x145b4e(0x1d1)+_0x4802ed[_0x145b4e(0x1ac)]};}await _0x4802ed[_0x145b4e(0x171)]();let _0x33726c=(await(await fetch(Y+'/mcp',{'method':'POST','headers':{'Content-Type':_0x145b4e(0x190),'Accept':_0x145b4e(0x1c2),...k?{'Authorization':_0x145b4e(0x162)+k}:{}},'body':JSON[_0x145b4e(0x1cb)]({'jsonrpc':_0x145b4e(0x19b),'id':0x2,'method':_0x145b4e(0x1d4),'params':{'name':_0x375412,'arguments':_0x14fe9b}})}))[_0x145b4e(0x171)]())['split']('\x0a')[_0x145b4e(0x1bf)](_0x3df66b=>_0x3df66b[_0x145b4e(0x1c8)](_0x145b4e(0x17d)));if(_0x33726c){let _0x3b6c94=JSON['parse'](_0x33726c['slice'](0x6));return _0x3b6c94?.[_0x145b4e(0x180)]?.[_0x145b4e(0x14c)]?.[0x0]?.['text']?JSON[_0x145b4e(0x1c7)](_0x3b6c94[_0x145b4e(0x180)]['content'][0x0]['text']):_0x3b6c94;}return{'ok':!0x1,'error':_0x145b4e(0x1d6)};}K[a0_0x24b8d2(0x168)](a0_0x318355,async _0x157ece=>{const _0x4effc4=a0_0x24b8d2;let {name:_0x3eb2e7,arguments:_0x1d973b}=_0x157ece[_0x4effc4(0x152)];if(_0x3eb2e7===_0x4effc4(0x177)){let {task_id:_0x5871f0,text:_0x374796,status:_0x102d0c}=_0x1d973b;if(_0x102d0c===_0x4effc4(0x1a9)||_0x102d0c===_0x4effc4(0x148)||_0x102d0c==='cancelled'){let _0x1d5a87=_0x102d0c==='completed'?_0x4effc4(0x192):_0x102d0c,_0x2f9d82=_0x5871f0?G[_0x4effc4(0x163)](_0x5871f0)||'hub':_0x4effc4(0x1b4),_0x5e8114=await Q(_0x4effc4(0x186),{'alias':_0x2f9d82,'text':_0x374796,'in_reply_to':_0x5871f0||void 0x0,'status':_0x1d5a87,'from_session':p});if(_0x5871f0)G['delete'](_0x5871f0);return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x5e8114)}]};}let _0x31a1e8=await Q(_0x4effc4(0x1dd),{'resume_id':V,'alias':p,'status':_0x102d0c===_0x4effc4(0x15b)?'blocked':_0x102d0c===_0x4effc4(0x1d2)?'error':_0x4effc4(0x1ae),'task':_0x374796[_0x4effc4(0x1bb)](0x0,0xc8),'output':_0x374796});return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x31a1e8)}]};}if(_0x3eb2e7===_0x4effc4(0x17c)){let {status:_0x19e967,task:_0x284bf9,progress:_0x35e5ce}=_0x1d973b,_0x43c6c2=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x19e967,'task':_0x284bf9,'progress':_0x35e5ce});return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x43c6c2)}]};}if(_0x3eb2e7===_0x4effc4(0x176)){let {alias:_0x2fab07,task:_0x950301,priority:_0xf0c9cc}=_0x1d973b,_0x2e3244=await Q(_0x4effc4(0x1e8),{'alias':_0x2fab07,'task':_0x950301,'priority':_0xf0c9cc||_0x4effc4(0x166),'from_session':p});return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x2e3244)}]};}if(_0x3eb2e7===_0x4effc4(0x1a4)){let {alias:_0x31dcbd,message:_0xa94ef5}=_0x1d973b,_0x386b5f=await Q(_0x4effc4(0x1c3),{'alias':_0x31dcbd,'message':_0xa94ef5,'from_session':p});return{'content':[{'type':'text','text':JSON[_0x4effc4(0x1cb)](_0x386b5f)}]};}if(_0x3eb2e7==='commhub_get_all_status'){let _0xa822cc=await Q(_0x4effc4(0x1da),{});return{'content':[{'type':_0x4effc4(0x171),'text':JSON['stringify'](_0xa822cc)}]};}return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)]({'error':'unknown\x20tool'})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x96c59b=a0_0x24b8d2;try{await Q(_0x96c59b(0x1dd),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x3c6840(),'hostname':a0_0x3c6840(),'agent':_0x96c59b(0x175),'project_dir':process['cwd'](),'tmux_name':j||void 0x0}),z(_0x96c59b(0x19a)+p+_0x96c59b(0x167));}catch(_0x2a8da6){z('re-register\x20failed:\x20'+_0x2a8da6);}}async function l(){const _0x5f022b=a0_0x24b8d2;let _0x5b45e2=Y+_0x5f022b(0x17a)+encodeURIComponent(p),_0x424691={};if(k)_0x424691[_0x5f022b(0x1e1)]=_0x5f022b(0x162)+k;z(_0x5f022b(0x1e4)+_0x5b45e2);let _0x4d7f60=D,_0x3a52d6=!0x0,_0x55e6c5=null;while(!0x0){try{let _0x4c7bfe=await fetch(_0x5b45e2,{'headers':_0x424691});if(!_0x4c7bfe['ok']){if(z(_0x5f022b(0x183)+_0x4c7bfe['status']+'\x20'+_0x4c7bfe[_0x5f022b(0x14b)]),_0x55e6c5=_0x55e6c5??Date['now'](),Date[_0x5f022b(0x1c1)]()-_0x55e6c5>O){z(_0x5f022b(0x156)+Y+_0x5f022b(0x1be));return;}await i(_0x4d7f60),_0x4d7f60=Math[_0x5f022b(0x160)](_0x4d7f60*0x2,v);continue;}let _0x50f29f=_0x4c7bfe['body'][_0x5f022b(0x1a8)](),_0xf695dd=new TextDecoder(),_0x3e7592='';_0x4d7f60=D;while(!0x0){let {done:_0x3574f2,value:_0xd0c89e}=await _0x50f29f['read']();if(_0x3574f2)break;_0x3e7592+=_0xf695dd[_0x5f022b(0x159)](_0xd0c89e,{'stream':!0x0});let _0x396550=_0x3e7592[_0x5f022b(0x1d0)]('\x0a\x0a');_0x3e7592=_0x396550[_0x5f022b(0x19f)]()||'';for(let _0x1f28b3 of _0x396550){let _0x30c2fb=_0x1f28b3[_0x5f022b(0x1d0)]('\x0a')[_0x5f022b(0x1bf)](_0x2674bb=>_0x2674bb[_0x5f022b(0x1c8)]('data:\x20'));if(!_0x30c2fb)continue;try{let _0x1e74ca=JSON['parse'](_0x30c2fb['slice'](0x6));if(await A(_0x1e74ca),_0x1e74ca[_0x5f022b(0x1e7)]===_0x5f022b(0x1cd)){if(_0x55e6c5=null,!_0x3a52d6)await m();_0x3a52d6=!0x1;}}catch(_0x51abc1){z(_0x5f022b(0x1e0)+_0x51abc1);}}}z('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x431502){z(_0x5f022b(0x18b)+_0x431502);}if(_0x55e6c5=_0x55e6c5??Date[_0x5f022b(0x1c1)](),Date[_0x5f022b(0x1c1)]()-_0x55e6c5>O){z('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+Y+_0x5f022b(0x1be));return;}await i(_0x4d7f60),_0x4d7f60=Math[_0x5f022b(0x160)](_0x4d7f60*0x2,v);}}function a0_0x1c45(){const _0x1f1655=['session\x20disconnected','status','3012254msTPPg','working','indexOf','/mcp','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','ack_inbox','broadcast','hub','SIGTERM','messages','unref','14902rDxujv','offline','object','slice','\x22\x20(','SIGINT',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','find','low','now','application/json,\x20text/event-stream','send_message','string','\x20/\x20hostname=','initialize','parse','startsWith','message_id','from','stringify','kill','connected','10MgcYjb',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','split','init\x20failed:\x20','error','set','tools/call','write','no\x20response','Message\x20content','ENV:\x20URL=','\x20CWD=','get_all_status','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','end','report_status','get_inbox','catch','parse\x20error:\x20','Authorization','Task\x20content','new_task','connecting\x20to\x20','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','config.json','type','send_task','failed','warning:\x20could\x20not\x20register:\x20','then','statusText','content','...\x20TMUX=','Progress\x200-100','\x20RESUME_ID=','token','commhub-channel','params','commhub_get_all_status','0.3.0','.env','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','from_session','alias','decode','222544RLftth','blocked','heartbeat\x20failed:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','stderr','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','min','pid','Bearer\x20','get','notifications/claude/channel','SSE\x20connected\x20as\x20\x22','normal','\x22\x20after\x20SSE\x20reconnect','setRequestHandler','.anet','761100VObXLJ','ESRCH','code','trim','inbox_count','2025-03-26','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','text','1949585kPTsrN','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','notification','claude-code','commhub_send_task','commhub_reply','cwd','\x20ALIAS=','/events/','2698888zoHQcx','commhub_report_status','data:\x20','Target\x20session\x20alias','parent\x20claude\x20pid=','result','MCP\x20stdio\x20connected','exit','SSE\x20error:\x20','idle','\x20PROJECT_ENV=','send_reply','commhub','441iVSCPb','Priority\x20(default:\x20normal)','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connection\x20error:\x20',']\x20[commhub]\x20','→\x20injected\x20task\x20','number','task','application/json','high','replied','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','2472552gDwuRD','unknown','in_progress','SSE\x20fatal:\x20','cancelled','utf-8','re-registered\x20as\x20\x22','2.0','message','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','replace','pop','POST','Current\x20task\x20description','Reply\x20text\x20/\x20result\x20summary','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','commhub_send_message','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','shutting\x20down,\x20reporting\x20offline...','CommHub\x20init\x20failed:\x20','getReader','completed','tmux\x20display-message\x20-p\x20\x27#S\x27'];a0_0x1c45=function(){return _0x1f1655;};return a0_0x1c45();}async function A(_0x3983e3){const _0x58db9f=a0_0x24b8d2;if(_0x3983e3[_0x58db9f(0x1e7)]===_0x58db9f(0x1cd)){z(_0x58db9f(0x165)+p+'\x22');return;}if(_0x3983e3[_0x58db9f(0x1e7)]==='new_message'){if(z('←\x20message\x20from\x20'+_0x3983e3['from']+':\x20'+_0x3983e3['message']['slice'](0x0,0x3c)),await K[_0x58db9f(0x174)]({'method':_0x58db9f(0x164),'params':{'content':_0x3983e3[_0x58db9f(0x19c)],'meta':{'sender':_0x3983e3[_0x58db9f(0x1ca)]||_0x58db9f(0x1b4),'sender_id':'commhub','user':_0x3983e3['from']||_0x58db9f(0x1b4),'priority':_0x58db9f(0x166)}}}),_0x3983e3[_0x58db9f(0x1c9)])await Q(_0x58db9f(0x1b2),{'alias':p,'message_id':_0x3983e3[_0x58db9f(0x1c9)]});return;}if(_0x3983e3[_0x58db9f(0x1e7)]===_0x58db9f(0x1e3)||_0x3983e3[_0x58db9f(0x1e7)]===_0x58db9f(0x1b3)){z('←\x20'+_0x3983e3['type']+':\x20inbox_count='+_0x3983e3[_0x58db9f(0x16e)]+'\x20priority='+(_0x3983e3['priority']||_0x58db9f(0x166)));let _0x464e9=await Q(_0x58db9f(0x1de),{'alias':p,'limit':0x5});if(_0x464e9?.['ok']&&_0x464e9[_0x58db9f(0x1b6)]?.['length']>0x0)for(let _0xcfeafe of _0x464e9[_0x58db9f(0x1b6)]){let _0x37838f={'sender':_0xcfeafe[_0x58db9f(0x157)]||_0x58db9f(0x1b4),'sender_id':_0x58db9f(0x187),'user':_0xcfeafe[_0x58db9f(0x157)]||'hub','task_id':_0xcfeafe['id'],'priority':_0xcfeafe['priority']||_0x58db9f(0x166)};G[_0x58db9f(0x1d3)](_0xcfeafe['id'],_0xcfeafe[_0x58db9f(0x157)]||'hub'),await K[_0x58db9f(0x174)]({'method':_0x58db9f(0x164),'params':{'content':_0xcfeafe[_0x58db9f(0x14c)],'meta':_0x37838f}}),z(_0x58db9f(0x18d)+_0xcfeafe['id'][_0x58db9f(0x1bb)](0x0,0x8)+'\x20from\x20'+_0xcfeafe[_0x58db9f(0x157)]+':\x20'+_0xcfeafe[_0x58db9f(0x14c)]['slice'](0x0,0x3c)),await Q(_0x58db9f(0x1b2),{'alias':p,'message_id':_0xcfeafe['id']});}}}async function t(){const _0x55f85d=a0_0x24b8d2;let _0x49c9c9=new a0_0x1f93af();await K['connect'](_0x49c9c9),z(_0x55f85d(0x181)),z('starting\x20SSE\x20listener...'),l()[_0x55f85d(0x1df)](_0x7eadeb=>z(_0x55f85d(0x197)+_0x7eadeb)),Q(_0x55f85d(0x1dd),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x3c6840(),'hostname':a0_0x3c6840(),'agent':'claude-code','project_dir':process[_0x55f85d(0x178)](),'tmux_name':j||void 0x0})[_0x55f85d(0x14a)](()=>z('registered\x20as\x20\x22'+p+_0x55f85d(0x1bc)+V[_0x55f85d(0x1bb)](0x0,0x8)+')'))['catch'](_0x3f0665=>z(_0x55f85d(0x149)+_0x3f0665)),setInterval(()=>{const _0x56fc60=_0x55f85d;Q(_0x56fc60(0x1dd),{'resume_id':V,'alias':p,'status':_0x56fc60(0x184),'server':a0_0x3c6840(),'hostname':a0_0x3c6840(),'agent':_0x56fc60(0x175),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x56fc60(0x1df)](_0x39ff5d=>z(_0x56fc60(0x15c)+_0x39ff5d));},0x2bf20),z('ready\x20—\x20waiting\x20for\x20events');}t()[a0_0x24b8d2(0x1df)](_0x254c13=>{z('fatal:\x20'+_0x254c13),process['exit'](0x1);});async function b(){const _0x4bebd1=a0_0x24b8d2;z(_0x4bebd1(0x1a6)),await Q(_0x4bebd1(0x1dd),{'resume_id':V,'alias':p,'status':_0x4bebd1(0x1b9),'task':_0x4bebd1(0x1ab)})[_0x4bebd1(0x1df)](()=>{}),process[_0x4bebd1(0x182)](0x0);}process['stdin']['on'](a0_0x24b8d2(0x1dc),()=>b()),process['on'](a0_0x24b8d2(0x1b5),()=>b()),process['on'](a0_0x24b8d2(0x1bd),()=>b());var d=process['ppid'];if(d&&d>0x1){let h=setInterval(()=>{const _0x4de6e5=a0_0x24b8d2;if(process['ppid']===0x1&&d!==0x1){z(_0x4de6e5(0x193)+d+_0x4de6e5(0x1cf)),b();return;}try{process[_0x4de6e5(0x1cc)](d,0x0);}catch(_0x217bc5){if(_0x217bc5?.[_0x4de6e5(0x16c)]===_0x4de6e5(0x16b))z(_0x4de6e5(0x17f)+d+_0x4de6e5(0x1a3)),b();}},0x7530);if(typeof h[a0_0x24b8d2(0x1b7)]==='function')h[a0_0x24b8d2(0x1b7)]();}
|
|
2
|
+
const a0_0x54e1f5=a0_0x57c3;(function(_0x15c99e,_0x41a28b){const _0x111653=a0_0x57c3,_0x4afc6e=_0x15c99e();while(!![]){try{const _0x37480b=parseInt(_0x111653(0x1a5))/0x1+-parseInt(_0x111653(0x1c3))/0x2*(parseInt(_0x111653(0x1bb))/0x3)+-parseInt(_0x111653(0x1a1))/0x4+-parseInt(_0x111653(0x197))/0x5+parseInt(_0x111653(0x167))/0x6+-parseInt(_0x111653(0x16e))/0x7*(-parseInt(_0x111653(0x1d0))/0x8)+parseInt(_0x111653(0x155))/0x9;if(_0x37480b===_0x41a28b)break;else _0x4afc6e['push'](_0x4afc6e['shift']());}catch(_0x183f43){_0x4afc6e['push'](_0x4afc6e['shift']());}}}(a0_0x52e6,0x52061));import{readFileSync as a0_0x21e889,existsSync as a0_0x5352c4}from'fs';import{randomUUID as a0_0xa2952e}from'crypto';import{join as a0_0x133f12}from'path';import{hostname as a0_0x39878a}from'os';import{execSync as a0_0x587a87}from'child_process';function B(_0xc23bf3){const _0x4f280a=a0_0x57c3;let _0x5d337f=_0xc23bf3[_0x4f280a(0x1c4)](/[^a-zA-Z0-9\-_]/g,'-');return _0x5d337f===''?_0x4f280a(0x193):_0x5d337f;}import{Server as a0_0x5a94eb}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x3c9bae}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x114469,CallToolRequestSchema as a0_0x15bb0c}from'@modelcontextprotocol/sdk/types.js';function T(_0x202e25){const _0x4e51c1=a0_0x57c3;if(!a0_0x5352c4(_0x202e25))return;for(let _0x597202 of a0_0x21e889(_0x202e25,_0x4e51c1(0x184))[_0x4e51c1(0x172)]('\x0a')){let _0x1135af=_0x597202['trim']();if(!_0x1135af||_0x1135af['startsWith']('#'))continue;let _0x4b1616=_0x1135af[_0x4e51c1(0x1a8)]('=');if(_0x4b1616<0x0)continue;let _0x88d0c5=_0x1135af[_0x4e51c1(0x1a7)](0x0,_0x4b1616)[_0x4e51c1(0x165)](),_0x57c15e=_0x1135af[_0x4e51c1(0x1a7)](_0x4b1616+0x1)[_0x4e51c1(0x165)]()[_0x4e51c1(0x1c4)](/^["']|["']$/g,'');if(!process.env[_0x88d0c5])process.env[_0x88d0c5]=_0x57c15e;}}var C=process.env.HOME||'~',r=a0_0x133f12(C,a0_0x54e1f5(0x182));T(a0_0x133f12(r,a0_0x54e1f5(0x140)));var H=B(process[a0_0x54e1f5(0x1b7)]());T(a0_0x133f12(r,H,'.env'));function E(){const _0x2af521=a0_0x54e1f5;try{return a0_0x587a87(_0x2af521(0x18b),{'encoding':_0x2af521(0x184),'timeout':0x7d0})[_0x2af521(0x165)]();}catch{return'';}}function _(){const _0x647ff=a0_0x54e1f5;try{let _0x1d5daa=a0_0x133f12(C,_0x647ff(0x15d),'config.json');if(a0_0x5352c4(_0x1d5daa))return JSON[_0x647ff(0x1bd)](a0_0x21e889(_0x1d5daa,_0x647ff(0x184)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x54e1f5(0x13f)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||E();function S(){const _0x400ec3=a0_0x54e1f5;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x400ec3(0x165)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x400ec3(0x196)][_0x400ec3(0x15b)]('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+(_0x400ec3(0x185)+(j||'(none)')+'\x20/\x20hostname='+a0_0x39878a()+'.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a')),_0x400ec3(0x176)+process[_0x400ec3(0x1b1)];}function a0_0x57c3(_0x28a39d,_0x8ce590){_0x28a39d=_0x28a39d-0x13c;const _0x52e6af=a0_0x52e6();let _0x57c3a0=_0x52e6af[_0x28a39d];return _0x57c3a0;}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0xa2952e(),k=process.env.COMMHUB_TOKEN||R['token']||'';function z(_0x22fd17){const _0x26e951=a0_0x54e1f5;let _0x5b8559=new Date()['toTimeString']()[_0x26e951(0x1a7)](0x0,0x8);process[_0x26e951(0x196)]['write']('['+_0x5b8559+_0x26e951(0x18f)+_0x22fd17+'\x0a');}function i(_0x287030){return new Promise(_0xddb40b=>setTimeout(_0xddb40b,_0x287030));}z(a0_0x54e1f5(0x1a0)+Y+a0_0x54e1f5(0x17e)+p+'\x20RESUME_ID='+V[a0_0x54e1f5(0x1a7)](0x0,0x8)+'...\x20TMUX='+(j||a0_0x54e1f5(0x146))+'\x20CWD='+process[a0_0x54e1f5(0x1b7)]()+'\x20PROJECT_ENV='+H);var G=new Map(),K=new a0_0x5a94eb({'name':a0_0x54e1f5(0x177),'version':a0_0x54e1f5(0x166)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x54e1f5(0x1bf),a0_0x54e1f5(0x156),a0_0x54e1f5(0x1b0),'Session\x20alias:\x20'+p][a0_0x54e1f5(0x16f)]('\x0a')});K['setRequestHandler'](a0_0x114469,async()=>({'tools':[{'name':a0_0x54e1f5(0x195),'description':a0_0x54e1f5(0x1ae),'inputSchema':{'type':a0_0x54e1f5(0x1ce),'properties':{'task_id':{'type':a0_0x54e1f5(0x181),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x54e1f5(0x181),'description':a0_0x54e1f5(0x14b)},'status':{'type':'string','enum':[a0_0x54e1f5(0x19e),a0_0x54e1f5(0x1cb),a0_0x54e1f5(0x152),'blocked','error',a0_0x54e1f5(0x192)],'description':a0_0x54e1f5(0x180)}},'required':[a0_0x54e1f5(0x1c9)]}},{'name':a0_0x54e1f5(0x1b6),'description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':'object','properties':{'status':{'type':'string','enum':['working',a0_0x54e1f5(0x169),a0_0x54e1f5(0x1c8),a0_0x54e1f5(0x13c)]},'task':{'type':'string','description':a0_0x54e1f5(0x1cc)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x54e1f5(0x188)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':'object','properties':{'alias':{'type':'string','description':a0_0x54e1f5(0x160)},'task':{'type':a0_0x54e1f5(0x181),'description':'Task\x20content'},'priority':{'type':a0_0x54e1f5(0x181),'enum':[a0_0x54e1f5(0x17a),a0_0x54e1f5(0x19f),a0_0x54e1f5(0x18d)],'description':a0_0x54e1f5(0x154)}},'required':[a0_0x54e1f5(0x19d),a0_0x54e1f5(0x162)]}},{'name':a0_0x54e1f5(0x1b2),'description':a0_0x54e1f5(0x1cd),'inputSchema':{'type':a0_0x54e1f5(0x1ce),'properties':{'alias':{'type':a0_0x54e1f5(0x181),'description':a0_0x54e1f5(0x160)},'message':{'type':'string','description':a0_0x54e1f5(0x199)}},'required':[a0_0x54e1f5(0x19d),a0_0x54e1f5(0x1b4)]}},{'name':a0_0x54e1f5(0x14d),'description':a0_0x54e1f5(0x178),'inputSchema':{'type':a0_0x54e1f5(0x1ce),'properties':{}}}]}));async function Q(_0x320092,_0x37bf53){const _0x2fbc62=a0_0x54e1f5;let _0x3af874=await fetch(Y+_0x2fbc62(0x170),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x2fbc62(0x18c),...k?{'Authorization':_0x2fbc62(0x14f)+k}:{}},'body':JSON[_0x2fbc62(0x151)]({'jsonrpc':_0x2fbc62(0x1ba),'id':0x1,'method':'initialize','params':{'protocolVersion':_0x2fbc62(0x158),'capabilities':{},'clientInfo':{'name':_0x2fbc62(0x177),'version':_0x2fbc62(0x166)}}})});if(!_0x3af874['ok']){let _0x2f3307=await _0x3af874[_0x2fbc62(0x1c9)]();return z('CommHub\x20init\x20failed:\x20'+_0x3af874[_0x2fbc62(0x188)]+'\x20'+_0x2f3307['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x2fbc62(0x18e)+_0x3af874['status']};}await _0x3af874[_0x2fbc62(0x1c9)]();let _0xb39705=(await(await fetch(Y+_0x2fbc62(0x170),{'method':_0x2fbc62(0x161),'headers':{'Content-Type':_0x2fbc62(0x17b),'Accept':_0x2fbc62(0x18c),...k?{'Authorization':_0x2fbc62(0x14f)+k}:{}},'body':JSON[_0x2fbc62(0x151)]({'jsonrpc':_0x2fbc62(0x1ba),'id':0x2,'method':_0x2fbc62(0x168),'params':{'name':_0x320092,'arguments':_0x37bf53}})}))['text']())[_0x2fbc62(0x172)]('\x0a')[_0x2fbc62(0x1af)](_0x3def90=>_0x3def90['startsWith']('data:\x20'));if(_0xb39705){let _0x6b4cfd=JSON['parse'](_0xb39705['slice'](0x6));return _0x6b4cfd?.[_0x2fbc62(0x1bc)]?.[_0x2fbc62(0x175)]?.[0x0]?.[_0x2fbc62(0x1c9)]?JSON[_0x2fbc62(0x1bd)](_0x6b4cfd[_0x2fbc62(0x1bc)][_0x2fbc62(0x175)][0x0][_0x2fbc62(0x1c9)]):_0x6b4cfd;}return{'ok':!0x1,'error':_0x2fbc62(0x1a9)};}function a0_0x52e6(){const _0x2cfeea=['set','session\x20disconnected','Target\x20session\x20alias','POST','task','send_reply','function','trim','0.3.0','3667680wBKPto','tools/call','idle','warning:\x20could\x20not\x20register:\x20','notification','send_message','ready\x20—\x20waiting\x20for\x20events','70896HsJGyx','join','/mcp','min','split','priority','SIGTERM','content','unattributed-','commhub-channel','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','read','high','application/json','end','SSE\x20stream\x20ended,\x20reconnecting...','\x20ALIAS=','\x20from\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','string','.claude/channels/commhub','→\x20injected\x20task\x20','utf-8','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','new_message','body','status','replied','report_status','tmux\x20display-message\x20-p\x20\x27#S\x27','application/json,\x20text/event-stream','low','init\x20failed:\x20',']\x20[commhub]\x20','stdin','from','in_progress','unknown','connected','commhub_reply','stderr','2480565lDZlnY','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','Message\x20content','starting\x20SSE\x20listener...','SSE\x20connected\x20as\x20\x22','shutting\x20down,\x20reporting\x20offline...','alias','completed','normal','ENV:\x20URL=','653212DDtrfj','parent\x20claude\x20pid=','setRequestHandler','connect','132387UNEyXD','ack_inbox','slice','indexOf','no\x20response','offline','now',':\x20inbox_count=','type','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','find','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','pid','commhub_send_message','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','message','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','commhub_report_status','cwd','←\x20message\x20from\x20','new_task','2.0','42gNfbWA','result','parse','re-registered\x20as\x20\x22','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','catch','get_inbox','parse\x20error:\x20','38772bUdwMc','replace','messages','message_id','pop','blocked','text','MCP\x20stdio\x20connected','failed','Current\x20task\x20description','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','object','ESRCH','200XgBwJn','delete','registered\x20as\x20\x22','error',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','startsWith','hub','.env','unref','get','ppid','length','exit','none','connecting\x20to\x20','notifications/claude/channel','then','claude-code','Reply\x20text\x20/\x20result\x20summary','SSE\x20error:\x20','commhub_get_all_status','re-register\x20failed:\x20','Bearer\x20','kill','stringify','cancelled','params','Priority\x20(default:\x20normal)','2429298YwbcbA','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','getReader','2025-03-26','SSE\x20connection\x20error:\x20','commhub_send_task','write','from_session','.anet'];a0_0x52e6=function(){return _0x2cfeea;};return a0_0x52e6();}K[a0_0x54e1f5(0x1a3)](a0_0x15bb0c,async _0x2f7a11=>{const _0x57282c=a0_0x54e1f5;let {name:_0x283b21,arguments:_0x147151}=_0x2f7a11[_0x57282c(0x153)];if(_0x283b21==='commhub_reply'){let {task_id:_0x14ebe7,text:_0x112722,status:_0x1a6a63}=_0x147151;if(_0x1a6a63==='completed'||_0x1a6a63===_0x57282c(0x1cb)||_0x1a6a63==='cancelled'){let _0x54c4a8=_0x1a6a63===_0x57282c(0x19e)?_0x57282c(0x189):_0x1a6a63,_0x242d74=_0x14ebe7?G[_0x57282c(0x142)](_0x14ebe7)||_0x57282c(0x13f):_0x57282c(0x13f),_0x5e1a5b=await Q(_0x57282c(0x163),{'alias':_0x242d74,'text':_0x112722,'in_reply_to':_0x14ebe7||void 0x0,'status':_0x54c4a8,'from_session':p});if(_0x14ebe7)G[_0x57282c(0x1d1)](_0x14ebe7);return{'content':[{'type':_0x57282c(0x1c9),'text':JSON[_0x57282c(0x151)](_0x5e1a5b)}]};}let _0x624518=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x1a6a63===_0x57282c(0x1c8)?_0x57282c(0x1c8):_0x1a6a63===_0x57282c(0x13c)?_0x57282c(0x13c):'working','task':_0x112722[_0x57282c(0x1a7)](0x0,0xc8),'output':_0x112722});return{'content':[{'type':_0x57282c(0x1c9),'text':JSON[_0x57282c(0x151)](_0x624518)}]};}if(_0x283b21===_0x57282c(0x1b6)){let {status:_0x765cd4,task:_0x23249e,progress:_0xf8040f}=_0x147151,_0x301e7d=await Q(_0x57282c(0x18a),{'resume_id':V,'alias':p,'status':_0x765cd4,'task':_0x23249e,'progress':_0xf8040f});return{'content':[{'type':_0x57282c(0x1c9),'text':JSON[_0x57282c(0x151)](_0x301e7d)}]};}if(_0x283b21===_0x57282c(0x15a)){let {alias:_0x1d8a09,task:_0x20db38,priority:_0x33e1ae}=_0x147151,_0x69a594=await Q('send_task',{'alias':_0x1d8a09,'task':_0x20db38,'priority':_0x33e1ae||_0x57282c(0x19f),'from_session':p});return{'content':[{'type':_0x57282c(0x1c9),'text':JSON[_0x57282c(0x151)](_0x69a594)}]};}if(_0x283b21===_0x57282c(0x1b2)){let {alias:_0x58032f,message:_0x82ad7}=_0x147151,_0x1a17dc=await Q(_0x57282c(0x16c),{'alias':_0x58032f,'message':_0x82ad7,'from_session':p});return{'content':[{'type':_0x57282c(0x1c9),'text':JSON[_0x57282c(0x151)](_0x1a17dc)}]};}if(_0x283b21===_0x57282c(0x14d)){let _0x439d82=await Q('get_all_status',{});return{'content':[{'type':'text','text':JSON['stringify'](_0x439d82)}]};}return{'content':[{'type':'text','text':JSON[_0x57282c(0x151)]({'error':'unknown\x20tool'})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x3e9efd=a0_0x54e1f5;try{await Q(_0x3e9efd(0x18a),{'resume_id':V,'alias':p,'status':_0x3e9efd(0x169),'server':a0_0x39878a(),'hostname':a0_0x39878a(),'agent':'claude-code','project_dir':process[_0x3e9efd(0x1b7)](),'tmux_name':j||void 0x0}),z(_0x3e9efd(0x1be)+p+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x35bc04){z(_0x3e9efd(0x14e)+_0x35bc04);}}async function l(){const _0x569f7b=a0_0x54e1f5;let _0x1945a9=Y+'/events/'+encodeURIComponent(p),_0x196300={};if(k)_0x196300['Authorization']=_0x569f7b(0x14f)+k;z(_0x569f7b(0x147)+_0x1945a9);let _0x1c1831=D,_0x5c3b04=!0x0,_0x136f92=null;while(!0x0){try{let _0x20b769=await fetch(_0x1945a9,{'headers':_0x196300});if(!_0x20b769['ok']){if(z(_0x569f7b(0x14c)+_0x20b769['status']+'\x20'+_0x20b769['statusText']),_0x136f92=_0x136f92??Date['now'](),Date[_0x569f7b(0x1ab)]()-_0x136f92>O){z(_0x569f7b(0x1b3)+Y+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await i(_0x1c1831),_0x1c1831=Math[_0x569f7b(0x171)](_0x1c1831*0x2,v);continue;}let _0x314663=_0x20b769[_0x569f7b(0x187)][_0x569f7b(0x157)](),_0x35ecb6=new TextDecoder(),_0x4ddb95='';_0x1c1831=D;while(!0x0){let {done:_0x1ed64d,value:_0x27257d}=await _0x314663[_0x569f7b(0x179)]();if(_0x1ed64d)break;_0x4ddb95+=_0x35ecb6['decode'](_0x27257d,{'stream':!0x0});let _0x4bfcf7=_0x4ddb95[_0x569f7b(0x172)]('\x0a\x0a');_0x4ddb95=_0x4bfcf7[_0x569f7b(0x1c7)]()||'';for(let _0x302a35 of _0x4bfcf7){let _0xe046ea=_0x302a35[_0x569f7b(0x172)]('\x0a')[_0x569f7b(0x1af)](_0xffc5ec=>_0xffc5ec[_0x569f7b(0x13e)]('data:\x20'));if(!_0xe046ea)continue;try{let _0x5b1d28=JSON[_0x569f7b(0x1bd)](_0xe046ea[_0x569f7b(0x1a7)](0x6));if(await A(_0x5b1d28),_0x5b1d28[_0x569f7b(0x1ad)]===_0x569f7b(0x194)){if(_0x136f92=null,!_0x5c3b04)await m();_0x5c3b04=!0x1;}}catch(_0x1358e6){z(_0x569f7b(0x1c2)+_0x1358e6);}}}z(_0x569f7b(0x17d));}catch(_0x1b4133){z(_0x569f7b(0x159)+_0x1b4133);}if(_0x136f92=_0x136f92??Date[_0x569f7b(0x1ab)](),Date[_0x569f7b(0x1ab)]()-_0x136f92>O){z(_0x569f7b(0x1b3)+Y+_0x569f7b(0x13d));return;}await i(_0x1c1831),_0x1c1831=Math['min'](_0x1c1831*0x2,v);}}async function A(_0x40b414){const _0x11b489=a0_0x54e1f5;if(_0x40b414[_0x11b489(0x1ad)]===_0x11b489(0x194)){z(_0x11b489(0x19b)+p+'\x22');return;}if(_0x40b414[_0x11b489(0x1ad)]===_0x11b489(0x186)){if(z(_0x11b489(0x1b8)+_0x40b414['from']+':\x20'+_0x40b414['message']['slice'](0x0,0x3c)),await K[_0x11b489(0x16b)]({'method':_0x11b489(0x148),'params':{'content':_0x40b414[_0x11b489(0x1b4)],'meta':{'sender':_0x40b414[_0x11b489(0x191)]||'hub','sender_id':'commhub','user':_0x40b414['from']||'hub','priority':_0x11b489(0x19f)}}}),_0x40b414[_0x11b489(0x1c6)])await Q(_0x11b489(0x1a6),{'alias':p,'message_id':_0x40b414[_0x11b489(0x1c6)]});return;}if(_0x40b414['type']===_0x11b489(0x1b9)||_0x40b414[_0x11b489(0x1ad)]==='broadcast'){z('←\x20'+_0x40b414[_0x11b489(0x1ad)]+_0x11b489(0x1ac)+_0x40b414['inbox_count']+'\x20priority='+(_0x40b414[_0x11b489(0x173)]||'normal'));let _0x36ef11=await Q(_0x11b489(0x1c1),{'alias':p,'limit':0x5});if(_0x36ef11?.['ok']&&_0x36ef11['messages']?.[_0x11b489(0x144)]>0x0)for(let _0x367b67 of _0x36ef11[_0x11b489(0x1c5)]){let _0x3b7b27={'sender':_0x367b67[_0x11b489(0x15c)]||'hub','sender_id':'commhub','user':_0x367b67[_0x11b489(0x15c)]||_0x11b489(0x13f),'task_id':_0x367b67['id'],'priority':_0x367b67[_0x11b489(0x173)]||_0x11b489(0x19f)};G[_0x11b489(0x15e)](_0x367b67['id'],_0x367b67[_0x11b489(0x15c)]||_0x11b489(0x13f)),await K[_0x11b489(0x16b)]({'method':_0x11b489(0x148),'params':{'content':_0x367b67[_0x11b489(0x175)],'meta':_0x3b7b27}}),z(_0x11b489(0x183)+_0x367b67['id'][_0x11b489(0x1a7)](0x0,0x8)+_0x11b489(0x17f)+_0x367b67[_0x11b489(0x15c)]+':\x20'+_0x367b67['content']['slice'](0x0,0x3c)),await Q(_0x11b489(0x1a6),{'alias':p,'message_id':_0x367b67['id']});}}}async function t(){const _0x2821ce=a0_0x54e1f5;let _0x4c3ee1=new a0_0x3c9bae();await K[_0x2821ce(0x1a4)](_0x4c3ee1),z(_0x2821ce(0x1ca)),z(_0x2821ce(0x19a)),l()[_0x2821ce(0x1c0)](_0x4b0935=>z('SSE\x20fatal:\x20'+_0x4b0935)),Q(_0x2821ce(0x18a),{'resume_id':V,'alias':p,'status':_0x2821ce(0x169),'server':a0_0x39878a(),'hostname':a0_0x39878a(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x2821ce(0x149)](()=>z(_0x2821ce(0x1d2)+p+'\x22\x20('+V['slice'](0x0,0x8)+')'))[_0x2821ce(0x1c0)](_0x5bc0f4=>z(_0x2821ce(0x16a)+_0x5bc0f4)),setInterval(()=>{const _0x5df461=_0x2821ce;Q(_0x5df461(0x18a),{'resume_id':V,'alias':p,'status':_0x5df461(0x169),'server':a0_0x39878a(),'hostname':a0_0x39878a(),'agent':_0x5df461(0x14a),'project_dir':process[_0x5df461(0x1b7)](),'tmux_name':j||void 0x0})['catch'](_0xbe936e=>z('heartbeat\x20failed:\x20'+_0xbe936e));},0x2bf20),z(_0x2821ce(0x16d));}t()[a0_0x54e1f5(0x1c0)](_0x34c1ba=>{const _0x1168ea=a0_0x54e1f5;z('fatal:\x20'+_0x34c1ba),process[_0x1168ea(0x145)](0x1);});async function b(){const _0x272d7e=a0_0x54e1f5;z(_0x272d7e(0x19c)),await Q('report_status',{'resume_id':V,'alias':p,'status':_0x272d7e(0x1aa),'task':_0x272d7e(0x15f)})[_0x272d7e(0x1c0)](()=>{}),process[_0x272d7e(0x145)](0x0);}process[a0_0x54e1f5(0x190)]['on'](a0_0x54e1f5(0x17c),()=>b()),process['on'](a0_0x54e1f5(0x174),()=>b()),process['on']('SIGINT',()=>b());var d=process[a0_0x54e1f5(0x143)];if(d&&d>0x1){let h=setInterval(()=>{const _0x1a98ee=a0_0x54e1f5;if(process[_0x1a98ee(0x143)]===0x1&&d!==0x1){z(_0x1a98ee(0x198)+d+')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat'),b();return;}try{process[_0x1a98ee(0x150)](d,0x0);}catch(_0x6da9d5){if(_0x6da9d5?.['code']===_0x1a98ee(0x1cf))z(_0x1a98ee(0x1a2)+d+_0x1a98ee(0x1b5)),b();}},0x7530);if(typeof h[a0_0x54e1f5(0x141)]===a0_0x54e1f5(0x164))h[a0_0x54e1f5(0x141)]();}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.3.0-preview.
|
|
3
|
+
"version": "2.3.0-preview.33",
|
|
4
4
|
"description": "AI Agent Network CLI — Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|