@sleep2agi/agent-network 2.2.17-preview.0 → 2.2.18-preview.0
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_0x584588=a0_0x1c20;(function(_0x4034f7,_0x1ddc2c){const _0x3a5c44=a0_0x1c20,_0x1cf8d7=_0x4034f7();while(!![]){try{const _0x169192=-parseInt(_0x3a5c44(0x1c8))/0x1+-parseInt(_0x3a5c44(0x1ca))/0x2+parseInt(_0x3a5c44(0x18f))/0x3*(parseInt(_0x3a5c44(0x1e0))/0x4)+parseInt(_0x3a5c44(0x1db))/0x5*(parseInt(_0x3a5c44(0x1a3))/0x6)+-parseInt(_0x3a5c44(0x1a7))/0x7*(-parseInt(_0x3a5c44(0x1ab))/0x8)+-parseInt(_0x3a5c44(0x19d))/0x9*(parseInt(_0x3a5c44(0x196))/0xa)+parseInt(_0x3a5c44(0x1d9))/0xb;if(_0x169192===_0x1ddc2c)break;else _0x1cf8d7['push'](_0x1cf8d7['shift']());}catch(_0x47fc2a){_0x1cf8d7['push'](_0x1cf8d7['shift']());}}}(a0_0x5f00,0x9165f));function a0_0x1c20(_0x18afbe,_0x262736){_0x18afbe=_0x18afbe-0x18a;const _0x5f0051=a0_0x5f00();let _0x1c2082=_0x5f0051[_0x18afbe];return _0x1c2082;}function a0_0x5f00(){const _0x350088=['content','error','disconnected','heartbeat\x20failed:\x20','text','/mcp','connect','19966133LWniLp','abort','3844040LmpoGD','2.0','getReader','from_session','SSE\x20error:\x20','525752qJqvGl','cwd','body','POST','split','emit','3YcCFfK','application/json','status','running','registered','AbortError','connected','4010FaSaYs','sseAbort','name','token','get_inbox','Authorization','report_status','22455yhxTHi','sdk','heartbeatInterval','log','SSE\x20failed:\x20','heartbeatTimer','6yZOouL','slice','send_message','task','3361183hytxKF','s...','signal',']\x20[commhub:','8ZTfdUj','Bearer\x20','parse','now','processInbox','agent','connectSSE','reply','catch','reconnectDelay','send_task','pop','get_all_status','idle','normal','result','type','url','alias','getAllStatus','read','resumeId','min','disconnect','call','replace','autoConnect','SSE\x20connected','completed','1047359bacXwy','message','1104226JCiQBH','new_task','tools/call','sdk-','broadcast','messages','sleep','startsWith'];a0_0x5f00=function(){return _0x350088;};return a0_0x5f00();}import{EventEmitter as a0_0x3ef94b}from'events';import{hostname as a0_0x12b62a}from'os';class T extends a0_0x3ef94b{[a0_0x584588(0x1bc)];[a0_0x584588(0x1bd)];[a0_0x584588(0x199)];[a0_0x584588(0x1b0)];['resumeId'];[a0_0x584588(0x19f)];['reconnectDelay'];[a0_0x584588(0x1a2)];[a0_0x584588(0x197)];[a0_0x584588(0x192)]=!0x1;constructor(_0x16f66a){const _0x45f1d8=a0_0x584588;super();if(this['url']=_0x16f66a[_0x45f1d8(0x1bc)][_0x45f1d8(0x1c4)](/\/$/,''),this[_0x45f1d8(0x1bd)]=_0x16f66a['alias'],this[_0x45f1d8(0x199)]=_0x16f66a[_0x45f1d8(0x199)],this[_0x45f1d8(0x1b0)]=_0x16f66a[_0x45f1d8(0x1b0)]||_0x45f1d8(0x19e),this['resumeId']=_0x45f1d8(0x1cd)+_0x16f66a[_0x45f1d8(0x1bd)]+'-'+Date['now']()['toString'](0x24),this[_0x45f1d8(0x19f)]=_0x16f66a[_0x45f1d8(0x19f)]??0x2bf20,this[_0x45f1d8(0x1b4)]=_0x16f66a[_0x45f1d8(0x1b4)]??0xbb8,_0x16f66a[_0x45f1d8(0x1c5)]!==!0x1)this[_0x45f1d8(0x1d8)]();}[a0_0x584588(0x1a0)](_0x521db2){const _0x177728=a0_0x584588;console['log']('['+new Date()['toTimeString']()[_0x177728(0x1a4)](0x0,0x8)+_0x177728(0x1aa)+this['alias']+']\x20'+_0x521db2);}async[a0_0x584588(0x1c3)](_0x3c04c3,_0x40f06b){const _0x32d3c0=a0_0x584588;let _0x4be1a7={'Content-Type':_0x32d3c0(0x190),'Accept':'application/json,\x20text/event-stream'};if(this[_0x32d3c0(0x199)])_0x4be1a7[_0x32d3c0(0x19b)]=_0x32d3c0(0x1ac)+this[_0x32d3c0(0x199)];let _0x478647=await(await fetch(this[_0x32d3c0(0x1bc)]+_0x32d3c0(0x1d7),{'method':_0x32d3c0(0x18c),'headers':_0x4be1a7,'body':JSON['stringify']({'jsonrpc':_0x32d3c0(0x1dc),'id':Date[_0x32d3c0(0x1ae)](),'method':_0x32d3c0(0x1cc),'params':{'name':_0x3c04c3,'arguments':_0x40f06b}})}))[_0x32d3c0(0x1d6)](),_0x1b7142=_0x478647['match'](/data: (.+)/),_0x18dfaa=_0x1b7142?JSON[_0x32d3c0(0x1ad)](_0x1b7142[0x1]):JSON[_0x32d3c0(0x1ad)](_0x478647),_0x2de2b8=_0x18dfaa?.[_0x32d3c0(0x1ba)]?.[_0x32d3c0(0x1d2)]?.[0x0]?.[_0x32d3c0(0x1d6)];return _0x2de2b8?JSON[_0x32d3c0(0x1ad)](_0x2de2b8):_0x18dfaa;}async['connect'](){const _0x979ef8=a0_0x584588;if(this[_0x979ef8(0x192)])return;this['running']=!0x0,await this[_0x979ef8(0x191)](_0x979ef8(0x1b8)),this[_0x979ef8(0x1a0)](_0x979ef8(0x193)),this[_0x979ef8(0x1a2)]=setInterval(()=>{const _0x26968e=_0x979ef8;this[_0x26968e(0x191)](_0x26968e(0x1b8))[_0x26968e(0x1b3)](_0x22c0ed=>this[_0x26968e(0x1a0)](_0x26968e(0x1d5)+_0x22c0ed['message']));},this[_0x979ef8(0x19f)]),this[_0x979ef8(0x1b1)]();}async[a0_0x584588(0x1c2)](){const _0x518b21=a0_0x584588;if(this[_0x518b21(0x192)]=!0x1,this[_0x518b21(0x197)]?.[_0x518b21(0x1da)](),this['heartbeatTimer'])clearInterval(this[_0x518b21(0x1a2)]);await this[_0x518b21(0x191)]('offline')[_0x518b21(0x1b3)](()=>{}),this[_0x518b21(0x1a0)](_0x518b21(0x1d4));}async['send'](_0x5db2d9,_0x20c551,_0xae8e5a=a0_0x584588(0x1b9)){const _0x13fdc9=a0_0x584588;return this[_0x13fdc9(0x1c3)](_0x13fdc9(0x1b5),{'alias':_0x5db2d9,'task':_0x20c551,'priority':_0xae8e5a,'from_session':this[_0x13fdc9(0x1bd)]});}async[a0_0x584588(0x1c9)](_0x603c9e,_0x2e3b3b){const _0x52ba03=a0_0x584588;return this[_0x52ba03(0x1c3)](_0x52ba03(0x1a5),{'alias':_0x603c9e,'message':_0x2e3b3b,'from_session':this[_0x52ba03(0x1bd)]});}async[a0_0x584588(0x1b2)](_0x256e01,_0x61bdf0,_0x51925d=a0_0x584588(0x1c7)){const _0x120c93=a0_0x584588;return this[_0x120c93(0x1c3)]('send_reply',{'in_reply_to':_0x256e01,'text':_0x61bdf0,'status':_0x51925d});}async[a0_0x584588(0x191)](_0x110dd0,_0x545447){const _0x41acfc=a0_0x584588;return this['call'](_0x41acfc(0x19c),{'resume_id':this[_0x41acfc(0x1c0)],'alias':this['alias'],'status':_0x110dd0,'server':a0_0x12b62a(),'hostname':a0_0x12b62a(),'agent':this['agent'],'project_dir':process[_0x41acfc(0x18a)](),..._0x545447});}async[a0_0x584588(0x1be)](){const _0xe3d9a3=a0_0x584588;return this[_0xe3d9a3(0x1c3)](_0xe3d9a3(0x1b7),{});}async[a0_0x584588(0x1ce)](_0x247e4a,_0x6f6744){const _0x119147=a0_0x584588;return this[_0x119147(0x1c3)](_0x119147(0x1ce),{'message':_0x247e4a,'filter_server':_0x6f6744?.['server'],'filter_status':_0x6f6744?.[_0x119147(0x191)]});}async['connectSSE'](){const _0x5d2f31=a0_0x584588;let _0x1924f7=encodeURIComponent(this['alias']),_0x345c6a=this[_0x5d2f31(0x1bc)]+'/events/'+_0x1924f7,_0x48f699=this['reconnectDelay'];while(this[_0x5d2f31(0x192)]){try{this[_0x5d2f31(0x197)]=new AbortController();let _0x500685={'Accept':'text/event-stream'};if(this[_0x5d2f31(0x199)])_0x500685[_0x5d2f31(0x19b)]=_0x5d2f31(0x1ac)+this[_0x5d2f31(0x199)];let _0x382888=await fetch(_0x345c6a,{'headers':_0x500685,'signal':this[_0x5d2f31(0x197)][_0x5d2f31(0x1a9)]});if(!_0x382888['ok']||!_0x382888[_0x5d2f31(0x18b)]){this['log'](_0x5d2f31(0x1a1)+_0x382888['status']),await this[_0x5d2f31(0x1d0)](_0x48f699),_0x48f699=Math[_0x5d2f31(0x1c1)](_0x48f699*1.5,0xea60);continue;}_0x48f699=this[_0x5d2f31(0x1b4)];let _0x634af9=_0x382888[_0x5d2f31(0x18b)][_0x5d2f31(0x1dd)](),_0x130a28=new TextDecoder(),_0x258f37='';while(this[_0x5d2f31(0x192)]){let {done:_0x5adda0,value:_0x4e2eaa}=await _0x634af9[_0x5d2f31(0x1bf)]();if(_0x5adda0)break;_0x258f37+=_0x130a28['decode'](_0x4e2eaa,{'stream':!0x0});let _0x432cfc=_0x258f37[_0x5d2f31(0x18d)]('\x0a');_0x258f37=_0x432cfc[_0x5d2f31(0x1b6)]()||'';for(let _0x3357a7 of _0x432cfc){if(!_0x3357a7[_0x5d2f31(0x1d1)]('data:\x20'))continue;try{let _0x38769f=JSON[_0x5d2f31(0x1ad)](_0x3357a7['slice'](0x6));if(_0x38769f[_0x5d2f31(0x1bb)]===_0x5d2f31(0x195)){this[_0x5d2f31(0x1a0)](_0x5d2f31(0x1c6)),this[_0x5d2f31(0x18e)](_0x5d2f31(0x195));continue;}if(_0x38769f[_0x5d2f31(0x1bb)]===_0x5d2f31(0x1cb)||_0x38769f[_0x5d2f31(0x1bb)]==='new_message'||_0x38769f['type']===_0x5d2f31(0x1ce))await this[_0x5d2f31(0x1af)]();}catch{}}}}catch(_0x35802b){if(_0x35802b[_0x5d2f31(0x198)]===_0x5d2f31(0x194))break;this[_0x5d2f31(0x18e)](_0x5d2f31(0x1d3),_0x35802b),this[_0x5d2f31(0x1a0)](_0x5d2f31(0x1df)+_0x35802b[_0x5d2f31(0x1c9)]);}if(this[_0x5d2f31(0x192)])this[_0x5d2f31(0x18e)](_0x5d2f31(0x1d4)),this['log']('SSE\x20reconnecting\x20in\x20'+_0x48f699/0x3e8+_0x5d2f31(0x1a8)),await this[_0x5d2f31(0x1d0)](_0x48f699),_0x48f699=Math[_0x5d2f31(0x1c1)](_0x48f699*1.5,0xea60);}}async[a0_0x584588(0x1af)](){const _0x326db9=a0_0x584588;try{let _0x414e84=(await this[_0x326db9(0x1c3)](_0x326db9(0x19a),{'alias':this[_0x326db9(0x1bd)],'limit':0xa}))?.[_0x326db9(0x1cf)]||[];for(let _0x724e89 of _0x414e84)await this[_0x326db9(0x1c3)]('ack_inbox',{'alias':this[_0x326db9(0x1bd)],'message_id':_0x724e89['id']}),this[_0x326db9(0x1a0)]('←\x20'+_0x724e89[_0x326db9(0x1de)]+':\x20'+_0x724e89['content'][_0x326db9(0x1a4)](0x0,0x3c)),this[_0x326db9(0x18e)](_0x326db9(0x1a6),_0x724e89),this[_0x326db9(0x18e)]('message',_0x724e89);}catch(_0x1b2c99){this['log']('inbox\x20error:\x20'+_0x1b2c99[_0x326db9(0x1c9)]);}}[a0_0x584588(0x1d0)](_0x408406){return new Promise(_0x4a6959=>setTimeout(_0x4a6959,_0x408406));}}var $=T;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_0x38142f=a0_0x4424;function a0_0x1c09(){const _0x2a9bc9=['session\x20disconnected','content','→\x20injected\x20task\x20','1709IPveFa','648040WCTOUq','6eSWHxO','split','\x20RESUME_ID=','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','startsWith','connected','type','slice','commhub_get_all_status','report_status','shutting\x20down,\x20reporting\x20offline...','unknown\x20tool','\x20CWD=','2003905WjVBVH','string','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','2.0','get','init\x20failed:\x20','none','fatal:\x20','join','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','failed','commhub-channel','send_task','message','connecting\x20to\x20','statusText','tools/call','data:\x20','set','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','Message\x20content','completed','message_id','...\x20TMUX=','low','notification','then','alias','/mcp','params','SSE\x20fatal:\x20','SSE\x20connected\x20as\x20\x22','Authorization','parse','Bearer\x20','.env','commhub_reply','\x20/\x20hostname=','exit','commhub_send_task','config.json','blocked','Current\x20task\x20description','offline','tmux\x20display-message\x20-p\x20\x27#S\x27','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','catch','1756efmcuZ','write','re-registered\x20as\x20\x22','registered\x20as\x20\x22','\x20from\x20','ack_inbox','13180706mZYfks','delete','new_message','messages','POST','cwd','setRequestHandler','utf-8','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','1233tElWzq','2025-03-26','find','priority','replace','Priority\x20(default:\x20normal)','Target\x20session\x20alias','ENV:\x20URL=','51640wFsYqi','get_all_status','1227bkZABy','object','Session\x20alias:\x20','.anet','new_task','stderr','cancelled','unattributed-','\x22\x20after\x20SSE\x20reconnect','getReader','\x20PROJECT_ENV=','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_send_message','\x22\x20(','indexOf','trim','3832451HWwUEa','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','body','.claude/channels/commhub','SSE\x20error:\x20','commhub','task','from_session','warning:\x20could\x20not\x20register:\x20','min','SIGTERM','pop','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','normal','claude-code','SIGINT','Reply\x20text\x20/\x20result\x20summary','/events/','←\x20message\x20from\x20','notifications/claude/channel','read','in_progress','inbox_count',']\x20[commhub]\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','heartbeat\x20failed:\x20','now','no\x20response','306CQlVdu','result','length','stringify','end','application/json','idle','error','MCP\x20stdio\x20connected','status','text','from','decode','hub','application/json,\x20text/event-stream','\x20priority=','commhub_report_status','stdin','starting\x20SSE\x20listener...','\x20ALIAS=','Task\x20content','broadcast','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.'];a0_0x1c09=function(){return _0x2a9bc9;};return a0_0x1c09();}(function(_0x50c277,_0x8db3c0){const _0x57bafa=a0_0x4424,_0x5af65c=_0x50c277();while(!![]){try{const _0x348a84=-parseInt(_0x57bafa(0x1c1))/0x1*(-parseInt(_0x57bafa(0x245))/0x2)+-parseInt(_0x57bafa(0x219))/0x3*(parseInt(_0x57bafa(0x200))/0x4)+parseInt(_0x57bafa(0x1d0))/0x5*(parseInt(_0x57bafa(0x1c3))/0x6)+parseInt(_0x57bafa(0x229))/0x7+-parseInt(_0x57bafa(0x1c2))/0x8+-parseInt(_0x57bafa(0x20f))/0x9*(-parseInt(_0x57bafa(0x217))/0xa)+-parseInt(_0x57bafa(0x206))/0xb;if(_0x348a84===_0x8db3c0)break;else _0x5af65c['push'](_0x5af65c['shift']());}catch(_0x14ad07){_0x5af65c['push'](_0x5af65c['shift']());}}}(a0_0x1c09,0x6feb1));import{readFileSync as a0_0x502f74,existsSync as a0_0x4685e8}from'fs';import{randomUUID as a0_0x32d3e7}from'crypto';import{join as a0_0x5a8e60}from'path';import{hostname as a0_0x3fd573}from'os';import{execSync as a0_0x2759a3}from'child_process';function a0_0x4424(_0x1df627,_0x54a176){_0x1df627=_0x1df627-0x1bd;const _0x1c094e=a0_0x1c09();let _0x4424a5=_0x1c094e[_0x1df627];return _0x4424a5;}import{Server as a0_0x496de7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x336f42}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x4d1428,CallToolRequestSchema as a0_0x5bb0a3}from'@modelcontextprotocol/sdk/types.js';function I(_0x4417e9){const _0x48128f=a0_0x4424;if(!a0_0x4685e8(_0x4417e9))return;for(let _0x46f146 of a0_0x502f74(_0x4417e9,_0x48128f(0x20d))[_0x48128f(0x1c4)]('\x0a')){let _0x2d4c40=_0x46f146[_0x48128f(0x228)]();if(!_0x2d4c40||_0x2d4c40[_0x48128f(0x1c7)]('#'))continue;let _0x4811df=_0x2d4c40[_0x48128f(0x227)]('=');if(_0x4811df<0x0)continue;let _0x1e0ed0=_0x2d4c40['slice'](0x0,_0x4811df)[_0x48128f(0x228)](),_0xccc09b=_0x2d4c40['slice'](_0x4811df+0x1)[_0x48128f(0x228)]()[_0x48128f(0x213)](/^["']|["']$/g,'');if(!process.env[_0x1e0ed0])process.env[_0x1e0ed0]=_0xccc09b;}}var L=process.env.HOME||'~',U=a0_0x5a8e60(L,a0_0x38142f(0x22c));I(a0_0x5a8e60(U,a0_0x38142f(0x1f4)));var v=process[a0_0x38142f(0x20b)]()[a0_0x38142f(0x213)](/\//g,'-');I(a0_0x5a8e60(U,v,'.env'));function d(){const _0x39d5ac=a0_0x38142f;try{return a0_0x2759a3(_0x39d5ac(0x1fd),{'encoding':_0x39d5ac(0x20d),'timeout':0x7d0})['trim']();}catch{return'';}}function m(){const _0x2c6f37=a0_0x38142f;try{let _0x4b5fa1=a0_0x5a8e60(L,_0x2c6f37(0x21c),_0x2c6f37(0x1f9));if(a0_0x4685e8(_0x4b5fa1))return JSON[_0x2c6f37(0x1f2)](a0_0x502f74(_0x4b5fa1,_0x2c6f37(0x20d)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u['hub']||'http://127.0.0.1:9200',f=process.env.COMMHUB_TMUX||d();function r(){const _0x207fe8=a0_0x38142f;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x207fe8(0x228)]())return process.env.COMMHUB_ALIAS[_0x207fe8(0x228)]();return process['stderr'][_0x207fe8(0x201)](_0x207fe8(0x1c6)+(_0x207fe8(0x1fe)+(f||'(none)')+_0x207fe8(0x1f6)+a0_0x3fd573()+'.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a')),_0x207fe8(0x220)+process['pid'];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x32d3e7(),F=process.env.COMMHUB_TOKEN||u['token']||'';function W(_0x271b77){const _0xd129f5=a0_0x38142f;let _0x1dbb5a=new Date()['toTimeString']()[_0xd129f5(0x1ca)](0x0,0x8);process[_0xd129f5(0x21e)][_0xd129f5(0x201)]('['+_0x1dbb5a+_0xd129f5(0x240)+_0x271b77+'\x0a');}function N(_0x20aab2){return new Promise(_0x4affa6=>setTimeout(_0x4affa6,_0x20aab2));}W(a0_0x38142f(0x216)+j+a0_0x38142f(0x258)+G+a0_0x38142f(0x1c5)+K[a0_0x38142f(0x1ca)](0x0,0x8)+a0_0x38142f(0x1e8)+(f||a0_0x38142f(0x1d6))+a0_0x38142f(0x1cf)+process['cwd']()+a0_0x38142f(0x223)+v);var D=new Map(),x=new a0_0x496de7({'name':a0_0x38142f(0x1db),'version':'0.3.0'},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x38142f(0x241),a0_0x38142f(0x22a),a0_0x38142f(0x1e3),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.',a0_0x38142f(0x21b)+G][a0_0x38142f(0x1d8)]('\x0a')});x[a0_0x38142f(0x20c)](a0_0x4d1428,async()=>({'tools':[{'name':a0_0x38142f(0x1f5),'description':a0_0x38142f(0x1e4),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x38142f(0x235)},'text':{'type':a0_0x38142f(0x1d1),'description':a0_0x38142f(0x239)},'status':{'type':'string','enum':['completed',a0_0x38142f(0x1da),a0_0x38142f(0x21f),'blocked',a0_0x38142f(0x24c),a0_0x38142f(0x23e)],'description':a0_0x38142f(0x1d2)}},'required':[a0_0x38142f(0x24f)]}},{'name':a0_0x38142f(0x255),'description':a0_0x38142f(0x1d9),'inputSchema':{'type':a0_0x38142f(0x21a),'properties':{'status':{'type':'string','enum':['working',a0_0x38142f(0x24b),a0_0x38142f(0x1fa),'error']},'task':{'type':a0_0x38142f(0x1d1),'description':a0_0x38142f(0x1fb)},'progress':{'type':'number','description':'Progress\x200-100'}},'required':[a0_0x38142f(0x24e)]}},{'name':a0_0x38142f(0x1f8),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x38142f(0x21a),'properties':{'alias':{'type':'string','description':a0_0x38142f(0x215)},'task':{'type':a0_0x38142f(0x1d1),'description':a0_0x38142f(0x259)},'priority':{'type':a0_0x38142f(0x1d1),'enum':['high','normal',a0_0x38142f(0x1e9)],'description':a0_0x38142f(0x214)}},'required':['alias',a0_0x38142f(0x22f)]}},{'name':a0_0x38142f(0x225),'description':a0_0x38142f(0x1bd),'inputSchema':{'type':a0_0x38142f(0x21a),'properties':{'alias':{'type':a0_0x38142f(0x1d1),'description':'Target\x20session\x20alias'},'message':{'type':'string','description':a0_0x38142f(0x1e5)}},'required':[a0_0x38142f(0x1ec),a0_0x38142f(0x1dd)]}},{'name':a0_0x38142f(0x1cb),'description':a0_0x38142f(0x224),'inputSchema':{'type':a0_0x38142f(0x21a),'properties':{}}}]}));async function Y(_0x5eb45a,_0x4582d0){const _0x29d0f2=a0_0x38142f;let _0x2dd730=await fetch(j+_0x29d0f2(0x1ed),{'method':_0x29d0f2(0x20a),'headers':{'Content-Type':_0x29d0f2(0x24a),'Accept':_0x29d0f2(0x253),...F?{'Authorization':_0x29d0f2(0x1f3)+F}:{}},'body':JSON[_0x29d0f2(0x248)]({'jsonrpc':'2.0','id':0x1,'method':'initialize','params':{'protocolVersion':_0x29d0f2(0x210),'capabilities':{},'clientInfo':{'name':_0x29d0f2(0x1db),'version':'0.3.0'}}})});if(!_0x2dd730['ok']){let _0xbaefa2=await _0x2dd730[_0x29d0f2(0x24f)]();return W('CommHub\x20init\x20failed:\x20'+_0x2dd730[_0x29d0f2(0x24e)]+'\x20'+_0xbaefa2['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x29d0f2(0x1d5)+_0x2dd730[_0x29d0f2(0x24e)]};}await _0x2dd730[_0x29d0f2(0x24f)]();let _0x4b78fa=(await(await fetch(j+'/mcp',{'method':_0x29d0f2(0x20a),'headers':{'Content-Type':'application/json','Accept':_0x29d0f2(0x253),...F?{'Authorization':_0x29d0f2(0x1f3)+F}:{}},'body':JSON['stringify']({'jsonrpc':_0x29d0f2(0x1d3),'id':0x2,'method':_0x29d0f2(0x1e0),'params':{'name':_0x5eb45a,'arguments':_0x4582d0}})}))[_0x29d0f2(0x24f)]())[_0x29d0f2(0x1c4)]('\x0a')['find'](_0x34d090=>_0x34d090[_0x29d0f2(0x1c7)](_0x29d0f2(0x1e1)));if(_0x4b78fa){let _0x599c1a=JSON[_0x29d0f2(0x1f2)](_0x4b78fa[_0x29d0f2(0x1ca)](0x6));return _0x599c1a?.[_0x29d0f2(0x246)]?.['content']?.[0x0]?.['text']?JSON[_0x29d0f2(0x1f2)](_0x599c1a['result'][_0x29d0f2(0x1bf)][0x0][_0x29d0f2(0x24f)]):_0x599c1a;}return{'ok':!0x1,'error':_0x29d0f2(0x244)};}x['setRequestHandler'](a0_0x5bb0a3,async _0xf3dae4=>{const _0x42540c=a0_0x38142f;let {name:_0x4904e9,arguments:_0x35d0b1}=_0xf3dae4[_0x42540c(0x1ee)];if(_0x4904e9===_0x42540c(0x1f5)){let {task_id:_0x116758,text:_0x5ce3d4,status:_0x4b9c5f}=_0x35d0b1;if(_0x4b9c5f===_0x42540c(0x1e6)||_0x4b9c5f===_0x42540c(0x1da)||_0x4b9c5f===_0x42540c(0x21f)){let _0x22516e=_0x4b9c5f==='completed'?'replied':_0x4b9c5f,_0xcc78e=_0x116758?D[_0x42540c(0x1d4)](_0x116758)||_0x42540c(0x252):_0x42540c(0x252),_0x496ef7=await Y('send_reply',{'alias':_0xcc78e,'text':_0x5ce3d4,'in_reply_to':_0x116758||void 0x0,'status':_0x22516e,'from_session':G});if(_0x116758)D[_0x42540c(0x207)](_0x116758);return{'content':[{'type':_0x42540c(0x24f),'text':JSON[_0x42540c(0x248)](_0x496ef7)}]};}let _0x32df23=await Y(_0x42540c(0x1cc),{'resume_id':K,'alias':G,'status':_0x4b9c5f==='blocked'?_0x42540c(0x1fa):_0x4b9c5f===_0x42540c(0x24c)?_0x42540c(0x24c):'working','task':_0x5ce3d4[_0x42540c(0x1ca)](0x0,0xc8),'output':_0x5ce3d4});return{'content':[{'type':'text','text':JSON['stringify'](_0x32df23)}]};}if(_0x4904e9===_0x42540c(0x255)){let {status:_0x4af0c0,task:_0x4a6c57,progress:_0x323e37}=_0x35d0b1,_0x42a70b=await Y(_0x42540c(0x1cc),{'resume_id':K,'alias':G,'status':_0x4af0c0,'task':_0x4a6c57,'progress':_0x323e37});return{'content':[{'type':'text','text':JSON[_0x42540c(0x248)](_0x42a70b)}]};}if(_0x4904e9===_0x42540c(0x1f8)){let {alias:_0x33a9ad,task:_0x3970c1,priority:_0x45179d}=_0x35d0b1,_0x182037=await Y(_0x42540c(0x1dc),{'alias':_0x33a9ad,'task':_0x3970c1,'priority':_0x45179d||'normal','from_session':G});return{'content':[{'type':_0x42540c(0x24f),'text':JSON[_0x42540c(0x248)](_0x182037)}]};}if(_0x4904e9===_0x42540c(0x225)){let {alias:_0x5c0a53,message:_0x15a0c6}=_0x35d0b1,_0x4c3b97=await Y('send_message',{'alias':_0x5c0a53,'message':_0x15a0c6,'from_session':G});return{'content':[{'type':_0x42540c(0x24f),'text':JSON[_0x42540c(0x248)](_0x4c3b97)}]};}if(_0x4904e9===_0x42540c(0x1cb)){let _0x428abd=await Y(_0x42540c(0x218),{});return{'content':[{'type':_0x42540c(0x24f),'text':JSON['stringify'](_0x428abd)}]};}return{'content':[{'type':_0x42540c(0x24f),'text':JSON[_0x42540c(0x248)]({'error':_0x42540c(0x1ce)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x40c01b=a0_0x38142f;try{await Y('report_status',{'resume_id':K,'alias':G,'status':_0x40c01b(0x24b),'server':a0_0x3fd573(),'hostname':a0_0x3fd573(),'agent':'claude-code','project_dir':process[_0x40c01b(0x20b)](),'tmux_name':f||void 0x0}),W(_0x40c01b(0x202)+G+_0x40c01b(0x221));}catch(_0x9b0538){W('re-register\x20failed:\x20'+_0x9b0538);}}async function o(){const _0x7189a7=a0_0x38142f;let _0x3a4327=j+_0x7189a7(0x23a)+encodeURIComponent(G),_0x2264fa={};if(F)_0x2264fa[_0x7189a7(0x1f1)]='Bearer\x20'+F;W(_0x7189a7(0x1de)+_0x3a4327);let _0x8a1043=O,_0x2d9adf=!0x0,_0x69193d=null;while(!0x0){try{let _0x42be1d=await fetch(_0x3a4327,{'headers':_0x2264fa});if(!_0x42be1d['ok']){if(W(_0x7189a7(0x22d)+_0x42be1d[_0x7189a7(0x24e)]+'\x20'+_0x42be1d[_0x7189a7(0x1df)]),_0x69193d=_0x69193d??Date[_0x7189a7(0x243)](),Date[_0x7189a7(0x243)]()-_0x69193d>T){W(_0x7189a7(0x20e)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x8a1043),_0x8a1043=Math[_0x7189a7(0x232)](_0x8a1043*0x2,R);continue;}let _0x5ad2d5=_0x42be1d[_0x7189a7(0x22b)][_0x7189a7(0x222)](),_0x15a1ea=new TextDecoder(),_0x2988d7='';_0x8a1043=O;while(!0x0){let {done:_0x482d2d,value:_0x436e5f}=await _0x5ad2d5[_0x7189a7(0x23d)]();if(_0x482d2d)break;_0x2988d7+=_0x15a1ea[_0x7189a7(0x251)](_0x436e5f,{'stream':!0x0});let _0x270518=_0x2988d7['split']('\x0a\x0a');_0x2988d7=_0x270518[_0x7189a7(0x234)]()||'';for(let _0x139206 of _0x270518){let _0x2d29b8=_0x139206[_0x7189a7(0x1c4)]('\x0a')[_0x7189a7(0x211)](_0xa0eadf=>_0xa0eadf['startsWith'](_0x7189a7(0x1e1)));if(!_0x2d29b8)continue;try{let _0x2af66f=JSON['parse'](_0x2d29b8['slice'](0x6));if(await a(_0x2af66f),_0x2af66f['type']===_0x7189a7(0x1c8)){if(_0x69193d=null,!_0x2d9adf)await l();_0x2d9adf=!0x1;}}catch(_0x21e8c4){W('parse\x20error:\x20'+_0x21e8c4);}}}W('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0xf5a5ba){W('SSE\x20connection\x20error:\x20'+_0xf5a5ba);}if(_0x69193d=_0x69193d??Date[_0x7189a7(0x243)](),Date[_0x7189a7(0x243)]()-_0x69193d>T){W(_0x7189a7(0x20e)+j+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await N(_0x8a1043),_0x8a1043=Math['min'](_0x8a1043*0x2,R);}}async function a(_0x32790b){const _0x2ce92b=a0_0x38142f;if(_0x32790b[_0x2ce92b(0x1c9)]===_0x2ce92b(0x1c8)){W(_0x2ce92b(0x1f0)+G+'\x22');return;}if(_0x32790b[_0x2ce92b(0x1c9)]===_0x2ce92b(0x208)){if(W(_0x2ce92b(0x23b)+_0x32790b['from']+':\x20'+_0x32790b[_0x2ce92b(0x1dd)][_0x2ce92b(0x1ca)](0x0,0x3c)),await x[_0x2ce92b(0x1ea)]({'method':_0x2ce92b(0x23c),'params':{'content':_0x32790b[_0x2ce92b(0x1dd)],'meta':{'sender':_0x32790b[_0x2ce92b(0x250)]||_0x2ce92b(0x252),'sender_id':_0x2ce92b(0x22e),'user':_0x32790b['from']||_0x2ce92b(0x252),'priority':'normal'}}}),_0x32790b[_0x2ce92b(0x1e7)])await Y('ack_inbox',{'alias':G,'message_id':_0x32790b[_0x2ce92b(0x1e7)]});return;}if(_0x32790b[_0x2ce92b(0x1c9)]===_0x2ce92b(0x21d)||_0x32790b['type']===_0x2ce92b(0x25a)){W('←\x20'+_0x32790b[_0x2ce92b(0x1c9)]+':\x20inbox_count='+_0x32790b[_0x2ce92b(0x23f)]+_0x2ce92b(0x254)+(_0x32790b[_0x2ce92b(0x212)]||_0x2ce92b(0x236)));let _0x1ed77e=await Y('get_inbox',{'alias':G,'limit':0x5});if(_0x1ed77e?.['ok']&&_0x1ed77e[_0x2ce92b(0x209)]?.[_0x2ce92b(0x247)]>0x0)for(let _0x4f143a of _0x1ed77e[_0x2ce92b(0x209)]){let _0x447110={'sender':_0x4f143a['from_session']||_0x2ce92b(0x252),'sender_id':_0x2ce92b(0x22e),'user':_0x4f143a['from_session']||_0x2ce92b(0x252),'task_id':_0x4f143a['id'],'priority':_0x4f143a[_0x2ce92b(0x212)]||_0x2ce92b(0x236)};D[_0x2ce92b(0x1e2)](_0x4f143a['id'],_0x4f143a[_0x2ce92b(0x230)]||_0x2ce92b(0x252)),await x[_0x2ce92b(0x1ea)]({'method':_0x2ce92b(0x23c),'params':{'content':_0x4f143a[_0x2ce92b(0x1bf)],'meta':_0x447110}}),W(_0x2ce92b(0x1c0)+_0x4f143a['id'][_0x2ce92b(0x1ca)](0x0,0x8)+_0x2ce92b(0x204)+_0x4f143a[_0x2ce92b(0x230)]+':\x20'+_0x4f143a['content'][_0x2ce92b(0x1ca)](0x0,0x3c)),await Y(_0x2ce92b(0x205),{'alias':G,'message_id':_0x4f143a['id']});}}}async function n(){const _0x3336f0=a0_0x38142f;let _0x586c69=new a0_0x336f42();await x['connect'](_0x586c69),W(_0x3336f0(0x24d)),W(_0x3336f0(0x257)),o()[_0x3336f0(0x1ff)](_0x57697c=>W(_0x3336f0(0x1ef)+_0x57697c)),Y(_0x3336f0(0x1cc),{'resume_id':K,'alias':G,'status':'idle','server':a0_0x3fd573(),'hostname':a0_0x3fd573(),'agent':_0x3336f0(0x237),'project_dir':process[_0x3336f0(0x20b)](),'tmux_name':f||void 0x0})[_0x3336f0(0x1eb)](()=>W(_0x3336f0(0x203)+G+_0x3336f0(0x226)+K['slice'](0x0,0x8)+')'))[_0x3336f0(0x1ff)](_0x4bb860=>W(_0x3336f0(0x231)+_0x4bb860)),setInterval(()=>{const _0x4e1db6=_0x3336f0;Y(_0x4e1db6(0x1cc),{'resume_id':K,'alias':G,'status':_0x4e1db6(0x24b),'server':a0_0x3fd573(),'hostname':a0_0x3fd573(),'agent':_0x4e1db6(0x237),'project_dir':process['cwd'](),'tmux_name':f||void 0x0})[_0x4e1db6(0x1ff)](_0x2f6a8d=>W(_0x4e1db6(0x242)+_0x2f6a8d));},0x2bf20),W('ready\x20—\x20waiting\x20for\x20events');}n()[a0_0x38142f(0x1ff)](_0x2a55cf=>{const _0x36bda4=a0_0x38142f;W(_0x36bda4(0x1d7)+_0x2a55cf),process[_0x36bda4(0x1f7)](0x1);});async function b(){const _0x4ee618=a0_0x38142f;W(_0x4ee618(0x1cd)),await Y(_0x4ee618(0x1cc),{'resume_id':K,'alias':G,'status':_0x4ee618(0x1fc),'task':_0x4ee618(0x1be)})['catch'](()=>{}),process[_0x4ee618(0x1f7)](0x0);}process[a0_0x38142f(0x256)]['on'](a0_0x38142f(0x249),()=>b()),process['on'](a0_0x38142f(0x233),()=>b()),process['on'](a0_0x38142f(0x238),()=>b());
|
|
2
|
+
const a0_0x19b54f=a0_0x83a7;(function(_0x8b9378,_0x46ce2d){const _0x479a20=a0_0x83a7,_0x19ac74=_0x8b9378();while(!![]){try{const _0x1fa3f0=parseInt(_0x479a20(0x1b5))/0x1+-parseInt(_0x479a20(0x1d9))/0x2*(-parseInt(_0x479a20(0x205))/0x3)+parseInt(_0x479a20(0x226))/0x4*(parseInt(_0x479a20(0x1fe))/0x5)+-parseInt(_0x479a20(0x218))/0x6*(parseInt(_0x479a20(0x1af))/0x7)+parseInt(_0x479a20(0x1e4))/0x8+-parseInt(_0x479a20(0x1cf))/0x9+-parseInt(_0x479a20(0x1ca))/0xa*(-parseInt(_0x479a20(0x1f5))/0xb);if(_0x1fa3f0===_0x46ce2d)break;else _0x19ac74['push'](_0x19ac74['shift']());}catch(_0x12be8a){_0x19ac74['push'](_0x19ac74['shift']());}}}(a0_0x53d4,0xa0417));import{readFileSync as a0_0x3c6e43,existsSync as a0_0x29d297}from'fs';import{randomUUID as a0_0x29680f}from'crypto';import{join as a0_0x22cf0c}from'path';import{hostname as a0_0x1025a0}from'os';import{execSync as a0_0x50203b}from'child_process';import{Server as a0_0x43a465}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x32fca4}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xcdfeef,CallToolRequestSchema as a0_0x3e6b8a}from'@modelcontextprotocol/sdk/types.js';function I(_0x23aabb){const _0x5b89bd=a0_0x83a7;if(!a0_0x29d297(_0x23aabb))return;for(let _0x552a6d of a0_0x3c6e43(_0x23aabb,_0x5b89bd(0x19c))[_0x5b89bd(0x1a5)]('\x0a')){let _0x4bbb95=_0x552a6d[_0x5b89bd(0x211)]();if(!_0x4bbb95||_0x4bbb95[_0x5b89bd(0x1f1)]('#'))continue;let _0x43791c=_0x4bbb95[_0x5b89bd(0x1be)]('=');if(_0x43791c<0x0)continue;let _0x291c5b=_0x4bbb95[_0x5b89bd(0x200)](0x0,_0x43791c)[_0x5b89bd(0x211)](),_0xca4710=_0x4bbb95[_0x5b89bd(0x200)](_0x43791c+0x1)[_0x5b89bd(0x211)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x291c5b])process.env[_0x291c5b]=_0xca4710;}}var L=process.env.HOME||'~',U=a0_0x22cf0c(L,'.claude/channels/commhub');I(a0_0x22cf0c(U,a0_0x19b54f(0x1dd)));function a0_0x53d4(){const _0x5d9286=['7680996HNThck','stdin','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','Current\x20task\x20description','Priority\x20(default:\x20normal)','new_task','error','0.3.0','commhub','replied','4qbRRER','pop','blocked','\x20/\x20hostname=','.env','alias','ENV:\x20URL=','2.0','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','heartbeat\x20failed:\x20','/mcp','6610376JiYppH','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','initialize','unknown\x20tool','idle','end','catch','inbox_count','type','SIGTERM','\x22\x20after\x20SSE\x20reconnect','\x20from\x20',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','startsWith','application/json,\x20text/event-stream','now','length','11iahRwD','messages','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','Message\x20content','Task\x20content','ack_inbox','POST','high','cancelled','1880PikKdQ','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','slice','in_progress','report_status','http://127.0.0.1:9200','token','159207JgsnFc','claude-code','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','parse','read','\x20RESUME_ID=','get_all_status','starting\x20SSE\x20listener...','cwd','result','notifications/claude/channel','send_reply','trim','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','\x22\x20(','data:\x20','commhub_report_status','application/json','object','35118EMhKVE','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','\x20CWD=','stringify',']\x20[commhub]\x20','Progress\x200-100','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','params','exit','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','statusText','setRequestHandler','task','completed','9796GZDmFw','from_session','warning:\x20could\x20not\x20register:\x20','SSE\x20stream\x20ended,\x20reconnecting...','notification','getReader','session\x20disconnected','message_id','normal','toTimeString','offline','Authorization','→\x20injected\x20task\x20','commhub-channel','send_message','Reply\x20text\x20/\x20result\x20summary','write','utf-8','←\x20message\x20from\x20','Target\x20session\x20alias','delete','broadcast','commhub_send_message','string','find','hub','split','stderr','status','connected','new_message','...\x20TMUX=','tools/call','get','init\x20failed:\x20','text','1309BenFSz','config.json','commhub_send_task','re-register\x20failed:\x20','SIGINT','parse\x20error:\x20','580914DoFwnd','content','/events/','commhub_get_all_status','pid','SSE\x20fatal:\x20',':\x20inbox_count=','message','SSE\x20connected\x20as\x20\x22','indexOf','set','commhub_reply','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','body','MCP\x20stdio\x20connected','re-registered\x20as\x20\x22','priority','replace','working','send_task','failed','1701890Sjgwcc','min','none','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','ready\x20—\x20waiting\x20for\x20events'];a0_0x53d4=function(){return _0x5d9286;};return a0_0x53d4();}var v=process[a0_0x19b54f(0x20d)]()[a0_0x19b54f(0x1c6)](/\//g,'-');I(a0_0x22cf0c(U,v,'.env'));function d(){const _0x5adaa7=a0_0x19b54f;try{return a0_0x50203b('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x5adaa7(0x19c),'timeout':0x7d0})[_0x5adaa7(0x211)]();}catch{return'';}}function m(){const _0x3f6c47=a0_0x19b54f;try{let _0x216a5d=a0_0x22cf0c(L,'.anet',_0x3f6c47(0x1b0));if(a0_0x29d297(_0x216a5d))return JSON[_0x3f6c47(0x208)](a0_0x3c6e43(_0x216a5d,_0x3f6c47(0x19c)));}catch{}return{};}var u=m(),j=process.env.COMMHUB_URL||u[a0_0x19b54f(0x1a4)]||a0_0x19b54f(0x203),f=process.env.COMMHUB_TMUX||d();function r(){const _0x5c2e74=a0_0x19b54f;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x5c2e74(0x211)]())return process.env.COMMHUB_ALIAS[_0x5c2e74(0x211)]();return process[_0x5c2e74(0x1a6)]['write'](_0x5c2e74(0x1c1)+(_0x5c2e74(0x212)+(f||'(none)')+_0x5c2e74(0x1dc)+a0_0x1025a0()+_0x5c2e74(0x1d1))),'unattributed-'+process[_0x5c2e74(0x1b9)];}var G=r(),K=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x29680f(),F=process.env.COMMHUB_TOKEN||u[a0_0x19b54f(0x204)]||'';function W(_0x37cc67){const _0x8c0324=a0_0x19b54f;let _0x421f4e=new Date()[_0x8c0324(0x22f)]()[_0x8c0324(0x200)](0x0,0x8);process[_0x8c0324(0x1a6)][_0x8c0324(0x19b)]('['+_0x421f4e+_0x8c0324(0x21c)+_0x37cc67+'\x0a');}function N(_0x3ed8ce){return new Promise(_0xb1afa4=>setTimeout(_0xb1afa4,_0x3ed8ce));}W(a0_0x19b54f(0x1df)+j+'\x20ALIAS='+G+a0_0x19b54f(0x20a)+K[a0_0x19b54f(0x200)](0x0,0x8)+a0_0x19b54f(0x1aa)+(f||a0_0x19b54f(0x1cc))+a0_0x19b54f(0x21a)+process[a0_0x19b54f(0x20d)]()+'\x20PROJECT_ENV='+v);var D=new Map(),x=new a0_0x43a465({'name':a0_0x19b54f(0x198),'version':a0_0x19b54f(0x1d6)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x19b54f(0x1f7),a0_0x19b54f(0x1e5),a0_0x19b54f(0x219),'You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','Session\x20alias:\x20'+G]['join']('\x0a')});function a0_0x83a7(_0x19fbbf,_0x563c80){_0x19fbbf=_0x19fbbf-0x197;const _0x53d4fb=a0_0x53d4();let _0x83a7e9=_0x53d4fb[_0x19fbbf];return _0x83a7e9;}x[a0_0x19b54f(0x223)](a0_0xcdfeef,async()=>({'tools':[{'name':a0_0x19b54f(0x1c0),'description':a0_0x19b54f(0x1ff),'inputSchema':{'type':'object','properties':{'task_id':{'type':a0_0x19b54f(0x1a2),'description':a0_0x19b54f(0x207)},'text':{'type':'string','description':a0_0x19b54f(0x19a)},'status':{'type':'string','enum':[a0_0x19b54f(0x225),a0_0x19b54f(0x1c9),a0_0x19b54f(0x1fd),a0_0x19b54f(0x1db),'error',a0_0x19b54f(0x201)],'description':'Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates'}},'required':[a0_0x19b54f(0x1ae)]}},{'name':a0_0x19b54f(0x215),'description':a0_0x19b54f(0x221),'inputSchema':{'type':a0_0x19b54f(0x217),'properties':{'status':{'type':a0_0x19b54f(0x1a2),'enum':[a0_0x19b54f(0x1c7),a0_0x19b54f(0x1e8),a0_0x19b54f(0x1db),a0_0x19b54f(0x1d5)]},'task':{'type':a0_0x19b54f(0x1a2),'description':a0_0x19b54f(0x1d2)},'progress':{'type':'number','description':a0_0x19b54f(0x21d)}},'required':[a0_0x19b54f(0x1a7)]}},{'name':'commhub_send_task','description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x19b54f(0x217),'properties':{'alias':{'type':'string','description':a0_0x19b54f(0x19e)},'task':{'type':a0_0x19b54f(0x1a2),'description':a0_0x19b54f(0x1f9)},'priority':{'type':a0_0x19b54f(0x1a2),'enum':[a0_0x19b54f(0x1fc),a0_0x19b54f(0x22e),'low'],'description':a0_0x19b54f(0x1d3)}},'required':[a0_0x19b54f(0x1de),a0_0x19b54f(0x224)]}},{'name':a0_0x19b54f(0x1a1),'description':a0_0x19b54f(0x1e1),'inputSchema':{'type':a0_0x19b54f(0x217),'properties':{'alias':{'type':a0_0x19b54f(0x1a2),'description':a0_0x19b54f(0x19e)},'message':{'type':a0_0x19b54f(0x1a2),'description':a0_0x19b54f(0x1f8)}},'required':['alias',a0_0x19b54f(0x1bc)]}},{'name':a0_0x19b54f(0x1b8),'description':a0_0x19b54f(0x1cd),'inputSchema':{'type':'object','properties':{}}}]}));async function Y(_0x53ba17,_0x5cffd2){const _0x1ee7b2=a0_0x19b54f;let _0x4fae4a=await fetch(j+_0x1ee7b2(0x1e3),{'method':'POST','headers':{'Content-Type':'application/json','Accept':_0x1ee7b2(0x1f2),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON['stringify']({'jsonrpc':_0x1ee7b2(0x1e0),'id':0x1,'method':_0x1ee7b2(0x1e6),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x1ee7b2(0x198),'version':'0.3.0'}}})});if(!_0x4fae4a['ok']){let _0x435bd4=await _0x4fae4a[_0x1ee7b2(0x1ae)]();return W('CommHub\x20init\x20failed:\x20'+_0x4fae4a[_0x1ee7b2(0x1a7)]+'\x20'+_0x435bd4['slice'](0x0,0x64)),{'ok':!0x1,'error':_0x1ee7b2(0x1ad)+_0x4fae4a[_0x1ee7b2(0x1a7)]};}await _0x4fae4a[_0x1ee7b2(0x1ae)]();let _0xc6044e=(await(await fetch(j+_0x1ee7b2(0x1e3),{'method':_0x1ee7b2(0x1fb),'headers':{'Content-Type':_0x1ee7b2(0x216),'Accept':_0x1ee7b2(0x1f2),...F?{'Authorization':'Bearer\x20'+F}:{}},'body':JSON[_0x1ee7b2(0x21b)]({'jsonrpc':_0x1ee7b2(0x1e0),'id':0x2,'method':_0x1ee7b2(0x1ab),'params':{'name':_0x53ba17,'arguments':_0x5cffd2}})}))[_0x1ee7b2(0x1ae)]())[_0x1ee7b2(0x1a5)]('\x0a')[_0x1ee7b2(0x1a3)](_0xd633f8=>_0xd633f8[_0x1ee7b2(0x1f1)](_0x1ee7b2(0x214)));if(_0xc6044e){let _0x2faf4f=JSON['parse'](_0xc6044e[_0x1ee7b2(0x200)](0x6));return _0x2faf4f?.[_0x1ee7b2(0x20e)]?.[_0x1ee7b2(0x1b6)]?.[0x0]?.['text']?JSON['parse'](_0x2faf4f['result'][_0x1ee7b2(0x1b6)][0x0][_0x1ee7b2(0x1ae)]):_0x2faf4f;}return{'ok':!0x1,'error':'no\x20response'};}x[a0_0x19b54f(0x223)](a0_0x3e6b8a,async _0x59d741=>{const _0x284708=a0_0x19b54f;let {name:_0x14134d,arguments:_0x25d865}=_0x59d741[_0x284708(0x21f)];if(_0x14134d===_0x284708(0x1c0)){let {task_id:_0x2d40e9,text:_0x4c9a2c,status:_0x10b435}=_0x25d865;if(_0x10b435==='completed'||_0x10b435===_0x284708(0x1c9)||_0x10b435===_0x284708(0x1fd)){let _0x10840c=_0x10b435===_0x284708(0x225)?_0x284708(0x1d8):_0x10b435,_0x20da8c=_0x2d40e9?D[_0x284708(0x1ac)](_0x2d40e9)||_0x284708(0x1a4):_0x284708(0x1a4),_0x1f23eb=await Y(_0x284708(0x210),{'alias':_0x20da8c,'text':_0x4c9a2c,'in_reply_to':_0x2d40e9||void 0x0,'status':_0x10840c,'from_session':G});if(_0x2d40e9)D[_0x284708(0x19f)](_0x2d40e9);return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)](_0x1f23eb)}]};}let _0x3df172=await Y(_0x284708(0x202),{'resume_id':K,'alias':G,'status':_0x10b435===_0x284708(0x1db)?'blocked':_0x10b435===_0x284708(0x1d5)?'error':_0x284708(0x1c7),'task':_0x4c9a2c[_0x284708(0x200)](0x0,0xc8),'output':_0x4c9a2c});return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)](_0x3df172)}]};}if(_0x14134d===_0x284708(0x215)){let {status:_0x330773,task:_0x3b84b3,progress:_0x36686b}=_0x25d865,_0x2efd8e=await Y(_0x284708(0x202),{'resume_id':K,'alias':G,'status':_0x330773,'task':_0x3b84b3,'progress':_0x36686b});return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)](_0x2efd8e)}]};}if(_0x14134d===_0x284708(0x1b1)){let {alias:_0x47cc7a,task:_0xf23985,priority:_0x227138}=_0x25d865,_0x1338bb=await Y(_0x284708(0x1c8),{'alias':_0x47cc7a,'task':_0xf23985,'priority':_0x227138||'normal','from_session':G});return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)](_0x1338bb)}]};}if(_0x14134d===_0x284708(0x1a1)){let {alias:_0x13cba5,message:_0x5b07b0}=_0x25d865,_0x5c12cf=await Y(_0x284708(0x199),{'alias':_0x13cba5,'message':_0x5b07b0,'from_session':G});return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)](_0x5c12cf)}]};}if(_0x14134d===_0x284708(0x1b8)){let _0x237746=await Y(_0x284708(0x20b),{});return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)](_0x237746)}]};}return{'content':[{'type':_0x284708(0x1ae),'text':JSON[_0x284708(0x21b)]({'error':_0x284708(0x1e7)})}]};});var O=0x3e8,R=0x7530,T=0x36ee80;async function l(){const _0x35bd31=a0_0x19b54f;try{await Y('report_status',{'resume_id':K,'alias':G,'status':_0x35bd31(0x1e8),'server':a0_0x1025a0(),'hostname':a0_0x1025a0(),'agent':_0x35bd31(0x206),'project_dir':process[_0x35bd31(0x20d)](),'tmux_name':f||void 0x0}),W(_0x35bd31(0x1c4)+G+_0x35bd31(0x1ee));}catch(_0x23fd28){W(_0x35bd31(0x1b2)+_0x23fd28);}}async function o(){const _0x527db5=a0_0x19b54f;let _0x1f5750=j+_0x527db5(0x1b7)+encodeURIComponent(G),_0x35a62d={};if(F)_0x35a62d[_0x527db5(0x231)]='Bearer\x20'+F;W('connecting\x20to\x20'+_0x1f5750);let _0x3b0876=O,_0x5f519a=!0x0,_0x4ff48e=null;while(!0x0){try{let _0x2bf192=await fetch(_0x1f5750,{'headers':_0x35a62d});if(!_0x2bf192['ok']){if(W('SSE\x20error:\x20'+_0x2bf192[_0x527db5(0x1a7)]+'\x20'+_0x2bf192[_0x527db5(0x222)]),_0x4ff48e=_0x4ff48e??Date[_0x527db5(0x1f3)](),Date[_0x527db5(0x1f3)]()-_0x4ff48e>T){W(_0x527db5(0x21e)+j+_0x527db5(0x1f0));return;}await N(_0x3b0876),_0x3b0876=Math[_0x527db5(0x1cb)](_0x3b0876*0x2,R);continue;}let _0x2ea475=_0x2bf192[_0x527db5(0x1c2)][_0x527db5(0x22b)](),_0x5bcf54=new TextDecoder(),_0xb310b8='';_0x3b0876=O;while(!0x0){let {done:_0x67c80a,value:_0xcbbdc9}=await _0x2ea475[_0x527db5(0x209)]();if(_0x67c80a)break;_0xb310b8+=_0x5bcf54['decode'](_0xcbbdc9,{'stream':!0x0});let _0x20b36c=_0xb310b8[_0x527db5(0x1a5)]('\x0a\x0a');_0xb310b8=_0x20b36c[_0x527db5(0x1da)]()||'';for(let _0x289dd7 of _0x20b36c){let _0x4a7cc9=_0x289dd7[_0x527db5(0x1a5)]('\x0a')[_0x527db5(0x1a3)](_0xaf13bd=>_0xaf13bd[_0x527db5(0x1f1)]('data:\x20'));if(!_0x4a7cc9)continue;try{let _0x287750=JSON['parse'](_0x4a7cc9[_0x527db5(0x200)](0x6));if(await a(_0x287750),_0x287750[_0x527db5(0x1ec)]===_0x527db5(0x1a8)){if(_0x4ff48e=null,!_0x5f519a)await l();_0x5f519a=!0x1;}}catch(_0x1d4f31){W(_0x527db5(0x1b4)+_0x1d4f31);}}}W(_0x527db5(0x229));}catch(_0xc6e948){W('SSE\x20connection\x20error:\x20'+_0xc6e948);}if(_0x4ff48e=_0x4ff48e??Date[_0x527db5(0x1f3)](),Date['now']()-_0x4ff48e>T){W('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+j+_0x527db5(0x1f0));return;}await N(_0x3b0876),_0x3b0876=Math[_0x527db5(0x1cb)](_0x3b0876*0x2,R);}}async function a(_0x343720){const _0x3737c0=a0_0x19b54f;if(_0x343720[_0x3737c0(0x1ec)]==='connected'){W(_0x3737c0(0x1bd)+G+'\x22');return;}if(_0x343720[_0x3737c0(0x1ec)]===_0x3737c0(0x1a9)){if(W(_0x3737c0(0x19d)+_0x343720['from']+':\x20'+_0x343720[_0x3737c0(0x1bc)][_0x3737c0(0x200)](0x0,0x3c)),await x['notification']({'method':_0x3737c0(0x20f),'params':{'content':_0x343720[_0x3737c0(0x1bc)],'meta':{'sender':_0x343720['from']||_0x3737c0(0x1a4),'sender_id':_0x3737c0(0x1d7),'user':_0x343720['from']||_0x3737c0(0x1a4),'priority':_0x3737c0(0x22e)}}}),_0x343720[_0x3737c0(0x22d)])await Y(_0x3737c0(0x1fa),{'alias':G,'message_id':_0x343720[_0x3737c0(0x22d)]});return;}if(_0x343720[_0x3737c0(0x1ec)]===_0x3737c0(0x1d4)||_0x343720['type']===_0x3737c0(0x1a0)){W('←\x20'+_0x343720[_0x3737c0(0x1ec)]+_0x3737c0(0x1bb)+_0x343720[_0x3737c0(0x1eb)]+'\x20priority='+(_0x343720[_0x3737c0(0x1c5)]||'normal'));let _0xb876fe=await Y('get_inbox',{'alias':G,'limit':0x5});if(_0xb876fe?.['ok']&&_0xb876fe[_0x3737c0(0x1f6)]?.[_0x3737c0(0x1f4)]>0x0)for(let _0x35399b of _0xb876fe[_0x3737c0(0x1f6)]){let _0x4af4ba={'sender':_0x35399b[_0x3737c0(0x227)]||_0x3737c0(0x1a4),'sender_id':'commhub','user':_0x35399b[_0x3737c0(0x227)]||_0x3737c0(0x1a4),'task_id':_0x35399b['id'],'priority':_0x35399b['priority']||'normal'};D[_0x3737c0(0x1bf)](_0x35399b['id'],_0x35399b[_0x3737c0(0x227)]||_0x3737c0(0x1a4)),await x[_0x3737c0(0x22a)]({'method':'notifications/claude/channel','params':{'content':_0x35399b['content'],'meta':_0x4af4ba}}),W(_0x3737c0(0x197)+_0x35399b['id'][_0x3737c0(0x200)](0x0,0x8)+_0x3737c0(0x1ef)+_0x35399b[_0x3737c0(0x227)]+':\x20'+_0x35399b['content'][_0x3737c0(0x200)](0x0,0x3c)),await Y(_0x3737c0(0x1fa),{'alias':G,'message_id':_0x35399b['id']});}}}async function n(){const _0x3c798b=a0_0x19b54f;let _0x89b357=new a0_0x32fca4();await x['connect'](_0x89b357),W(_0x3c798b(0x1c3)),W(_0x3c798b(0x20c)),o()['catch'](_0x6babae=>W(_0x3c798b(0x1ba)+_0x6babae)),Y(_0x3c798b(0x202),{'resume_id':K,'alias':G,'status':_0x3c798b(0x1e8),'server':a0_0x1025a0(),'hostname':a0_0x1025a0(),'agent':'claude-code','project_dir':process[_0x3c798b(0x20d)](),'tmux_name':f||void 0x0})['then'](()=>W('registered\x20as\x20\x22'+G+_0x3c798b(0x213)+K[_0x3c798b(0x200)](0x0,0x8)+')'))[_0x3c798b(0x1ea)](_0x3e39d6=>W(_0x3c798b(0x228)+_0x3e39d6)),setInterval(()=>{const _0x51e2ce=_0x3c798b;Y('report_status',{'resume_id':K,'alias':G,'status':'idle','server':a0_0x1025a0(),'hostname':a0_0x1025a0(),'agent':'claude-code','project_dir':process['cwd'](),'tmux_name':f||void 0x0})['catch'](_0x95444b=>W(_0x51e2ce(0x1e2)+_0x95444b));},0x2bf20),W(_0x3c798b(0x1ce));}n()[a0_0x19b54f(0x1ea)](_0x3a1cf2=>{const _0x24c1ee=a0_0x19b54f;W('fatal:\x20'+_0x3a1cf2),process[_0x24c1ee(0x220)](0x1);});async function b(){const _0x42ea72=a0_0x19b54f;W('shutting\x20down,\x20reporting\x20offline...'),await Y(_0x42ea72(0x202),{'resume_id':K,'alias':G,'status':_0x42ea72(0x230),'task':_0x42ea72(0x22c)})[_0x42ea72(0x1ea)](()=>{}),process['exit'](0x0);}process[a0_0x19b54f(0x1d0)]['on'](a0_0x19b54f(0x1e9),()=>b()),process['on'](a0_0x19b54f(0x1ed),()=>b()),process['on'](a0_0x19b54f(0x1b3),()=>b());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.18-preview.0",
|
|
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",
|