@sleep2agi/agent-network 2.3.0-preview.181 → 2.3.0-preview.184
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/node-secret-file.d.ts +32 -0
- package/dist/src/node-server.d.ts +0 -12
- package/dist/src/node-server.js +8 -8
- package/dist/src/opencode-agent-node-pair.d.ts +6 -6
- package/dist/src/os-user.d.ts +4 -0
- package/dist/src/scoped-secrets.d.ts +23 -0
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function a0_0x2045(){const _0x30d566=['898992pVSRvv','running','get_all_status','SSE\x20reconnecting\x20in\x20','call','processInbox','355CzYpVw','task.started','agent','send_message','signal','lifecycleTracking','CommHub\x20response\x20omitted\x20task_id','from_alias','networkId','send_rejected','application/json,\x20text/event-stream','848607jRuAlf','alias','[REDACTED]','error_message','message','replace','[commhub:task]\x20',']\x20[commhub:','registered','autoConnect','\x20transport=','idle','\x20error=','send_reply','slice','319558ImumPh','5333148CqsCmu','lifecycle_tracking','sdk-','parentTaskId','url','from_session','toString','min','emit','status','new_task','2358020iTEdXy','broadcast','duration_ms','delivered','\x20network_id=','catch','Authorization','2717416ENiGfm','task_id','getAllStatus','SSE\x20error:\x20','text','resumeId','heartbeatTimer','task.ack','sseAbort','SSE\x20connected','error_code','application/json','parent_task_id','network_id','body','messages','failed','new_message','abort','<unknown>','token','send','get_inbox','s...','toTimeString','connected','string','\x20from=','ack_inbox','unknown\x20error','parse','read','send_failed','\x20task_id=','data:\x20','tools/call','\x20to=','content','connect','name','/events/','1poZono','not_tracked','message_id','disconnected','disconnect','error','reconnectDelay','\x20parent_task_id=','fromAlias','AbortError','sending','2.0','task.send.delivered','transport','Bearer\x20','getReader','\x20lifecycle=','reply','SSE\x20failed:\x20','startsWith','send_task','CommHub\x20rejected\x20task','sdk','cwd','now','json','task.send.failed','4596mNvAhB','task.replied','/mcp','text/event-stream','split','connectSSE','sleep','match','POST','inbox\x20error:\x20','type','log','heartbeatInterval','stringify'];a0_0x2045=function(){return _0x30d566;};return a0_0x2045();}function a0_0x2f88(_0x54999f,_0x19eaa9){_0x54999f=_0x54999f-0x1de;const _0x204512=a0_0x2045();let _0x2f884a=_0x204512[_0x54999f];return _0x2f884a;}const a0_0x32cf33=a0_0x2f88;(function(_0x4c090d,_0x2b1fe6){const _0x19c426=a0_0x2f88,_0x3a618c=_0x4c090d();while(!![]){try{const _0x5c3ea9=-parseInt(_0x19c426(0x22a))/0x1*(parseInt(_0x19c426(0x1ee))/0x2)+parseInt(_0x19c426(0x1df))/0x3+parseInt(_0x19c426(0x253))/0x4+-parseInt(_0x19c426(0x259))/0x5*(parseInt(_0x19c426(0x245))/0x6)+-parseInt(_0x19c426(0x1fa))/0x7+-parseInt(_0x19c426(0x201))/0x8+parseInt(_0x19c426(0x1ef))/0x9;if(_0x5c3ea9===_0x2b1fe6)break;else _0x3a618c['push'](_0x3a618c['shift']());}catch(_0x2404f5){_0x3a618c['push'](_0x3a618c['shift']());}}}(a0_0x2045,0x3324f));import{EventEmitter as a0_0x3b27ed}from'events';import{hostname as a0_0x497543}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2fd6c8,_0x380f4d)=>(_0x2fd6c8??_0x380f4d)[a0_0x32cf33(0x1e4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x32cf33(0x1ed)](0x0,0xf0);function N(_0x24d8aa){const _0x17d297=a0_0x32cf33;return(_0x24d8aa instanceof Error?_0x24d8aa[_0x17d297(0x1e3)]:String(_0x24d8aa??_0x17d297(0x21e)))[_0x17d297(0x1e4)](K,_0x17d297(0x1e1))[_0x17d297(0x1e4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x17d297(0x1ed)](0x0,0xf0);}function O(_0x34c24f,_0x133462=process.env.ANET_TASK_TRACE_FORMAT===a0_0x32cf33(0x243)){const _0x1e6cfc=a0_0x32cf33;if(_0x133462)return JSON['stringify'](_0x34c24f);let _0x182678=L(_0x34c24f[_0x1e6cfc(0x20d)],'<missing>'),_0x543377=L(_0x34c24f[_0x1e6cfc(0x202)],'<pending>'),_0x348da1=_0x34c24f[_0x1e6cfc(0x20b)]?_0x1e6cfc(0x1eb)+_0x34c24f[_0x1e6cfc(0x20b)]+':'+(_0x34c24f[_0x1e6cfc(0x1e2)]??''):'';return _0x1e6cfc(0x1e5)+_0x34c24f[_0x1e6cfc(0x1f8)]+_0x1e6cfc(0x21c)+L(_0x34c24f[_0x1e6cfc(0x260)],_0x1e6cfc(0x214))+_0x1e6cfc(0x225)+L(_0x34c24f['to_alias'],_0x1e6cfc(0x214))+_0x1e6cfc(0x222)+_0x543377+_0x1e6cfc(0x231)+_0x182678+_0x1e6cfc(0x1fe)+L(_0x34c24f[_0x1e6cfc(0x20e)],_0x1e6cfc(0x214))+_0x1e6cfc(0x1e9)+_0x34c24f[_0x1e6cfc(0x237)]+'\x20duration_ms='+_0x34c24f[_0x1e6cfc(0x1fc)]+_0x1e6cfc(0x23a)+_0x34c24f[_0x1e6cfc(0x1f0)]+_0x348da1;}function U(_0x153209){const _0xcb07e0=a0_0x32cf33;return{'event':{'sending':'task.send.start','delivered':_0xcb07e0(0x236),'failed':_0xcb07e0(0x244),'acked':_0xcb07e0(0x208),'started':_0xcb07e0(0x25a),'replied':_0xcb07e0(0x246),'expired':'task.expired'}[_0x153209[_0xcb07e0(0x1f8)]],..._0x153209};}function j(_0x38f774){const _0x2ef376=a0_0x32cf33;let _0x36604a=_0x38f774?.[_0x2ef376(0x202)]||_0x38f774?.[_0x2ef376(0x22c)]||_0x38f774?.['id'];if(_0x36604a)return String(_0x36604a);let _0x291ec5=_0x38f774?.[_0x2ef376(0x226)]?.[0x0]?.[_0x2ef376(0x205)];if(typeof _0x291ec5!==_0x2ef376(0x21b))return null;try{let _0x172a61=JSON[_0x2ef376(0x21f)](_0x291ec5);return _0x172a61?.['task_id']||_0x172a61?.[_0x2ef376(0x22c)]||_0x172a61?.['id']||null;}catch{return null;}}async function X(_0x3ec07c,_0x516016){const _0x3a7276=a0_0x32cf33;let _0x38e66c=_0x516016[_0x3a7276(0x242)]??Date[_0x3a7276(0x242)],_0x259a29=_0x38e66c(),_0x3e4bec=(_0x249bd6,_0x5c4c44,_0x5a7d7,_0x57b306)=>{const _0x4f0fd5=_0x3a7276;_0x516016[_0x4f0fd5(0x250)](O(U({'from_alias':_0x3ec07c[_0x4f0fd5(0x232)],'to_alias':_0x3ec07c['toAlias'],'task_id':_0x5c4c44,'parent_task_id':_0x3ec07c[_0x4f0fd5(0x1f2)],'network_id':_0x3ec07c['networkId'],'transport':_0x3ec07c['transport'],'status':_0x249bd6,'duration_ms':_0x38e66c()-_0x259a29,'lifecycle_tracking':_0x3ec07c[_0x4f0fd5(0x25e)],..._0x5a7d7!==void 0x0?{'error_code':_0x57b306||_0x4f0fd5(0x221),'error_message':N(_0x5a7d7)}:{}})));};_0x3e4bec(_0x3a7276(0x234),null);try{let _0x37eefa=await _0x516016['send'](),_0x3a061a=j(_0x37eefa);if(_0x3a061a)_0x3e4bec(_0x3a7276(0x1fd),_0x3a061a);else{if(_0x37eefa?.['ok']===!0x1||_0x37eefa?.['error'])_0x3e4bec('failed',_0x3a061a,_0x37eefa?.[_0x3a7276(0x22f)]||_0x3a7276(0x23f),_0x3a7276(0x262));else _0x3e4bec(_0x3a7276(0x211),null,_0x3a7276(0x25f),'missing_task_id');}return _0x37eefa;}catch(_0x56e82c){throw _0x3e4bec('failed',null,_0x56e82c,_0x3a7276(0x221)),_0x56e82c;}}async function Y(_0x154f3b,_0xa82bd9){const _0x4733f8=a0_0x32cf33;return X({'fromAlias':_0x154f3b[_0x4733f8(0x232)],'toAlias':_0x154f3b[_0x4733f8(0x1e0)],'parentTaskId':_0x154f3b[_0x4733f8(0x1f2)]||null,'networkId':_0x154f3b[_0x4733f8(0x261)]||null,'transport':'mcp_http','lifecycleTracking':_0x4733f8(0x22b)},_0xa82bd9);}class $ extends a0_0x3b27ed{['url'];[a0_0x32cf33(0x1e0)];['token'];[a0_0x32cf33(0x25b)];[a0_0x32cf33(0x206)];[a0_0x32cf33(0x251)];[a0_0x32cf33(0x230)];['heartbeatTimer'];['sseAbort'];[a0_0x32cf33(0x254)]=!0x1;constructor(_0x1f21f0){const _0x282766=a0_0x32cf33;super();if(this[_0x282766(0x1f3)]=_0x1f21f0[_0x282766(0x1f3)][_0x282766(0x1e4)](/\/$/,''),this['alias']=_0x1f21f0[_0x282766(0x1e0)],this['token']=_0x1f21f0['token'],this[_0x282766(0x25b)]=_0x1f21f0[_0x282766(0x25b)]||_0x282766(0x240),this['resumeId']=_0x282766(0x1f1)+_0x1f21f0['alias']+'-'+Date[_0x282766(0x242)]()[_0x282766(0x1f5)](0x24),this[_0x282766(0x251)]=_0x1f21f0['heartbeatInterval']??0x2bf20,this[_0x282766(0x230)]=_0x1f21f0[_0x282766(0x230)]??0xbb8,_0x1f21f0[_0x282766(0x1e8)]!==!0x1)this[_0x282766(0x227)]();}[a0_0x32cf33(0x250)](_0x254961){const _0x40f27d=a0_0x32cf33;console[_0x40f27d(0x250)]('['+new Date()[_0x40f27d(0x219)]()[_0x40f27d(0x1ed)](0x0,0x8)+_0x40f27d(0x1e6)+this['alias']+']\x20'+_0x254961);}async['call'](_0x43a562,_0x218bfb){const _0x6ee5b=a0_0x32cf33;let _0x776743={'Content-Type':_0x6ee5b(0x20c),'Accept':_0x6ee5b(0x1de)};if(this['token'])_0x776743[_0x6ee5b(0x200)]=_0x6ee5b(0x238)+this['token'];let _0x2ddb11=await(await fetch(this[_0x6ee5b(0x1f3)]+_0x6ee5b(0x247),{'method':_0x6ee5b(0x24d),'headers':_0x776743,'body':JSON[_0x6ee5b(0x252)]({'jsonrpc':_0x6ee5b(0x235),'id':Date[_0x6ee5b(0x242)](),'method':_0x6ee5b(0x224),'params':{'name':_0x43a562,'arguments':_0x218bfb}})}))['text'](),_0x58eb7d=_0x2ddb11[_0x6ee5b(0x24c)](/data: (.+)/),_0x3d2417=_0x58eb7d?JSON[_0x6ee5b(0x21f)](_0x58eb7d[0x1]):JSON['parse'](_0x2ddb11),_0x1c69a3=_0x3d2417?.['result']?.['content']?.[0x0]?.['text'];return _0x1c69a3?JSON['parse'](_0x1c69a3):_0x3d2417;}async[a0_0x32cf33(0x227)](){const _0x12a2b5=a0_0x32cf33;if(this[_0x12a2b5(0x254)])return;this[_0x12a2b5(0x254)]=!0x0,await this['status']('idle'),this[_0x12a2b5(0x250)](_0x12a2b5(0x1e7)),this[_0x12a2b5(0x207)]=setInterval(()=>{const _0x120255=_0x12a2b5;this['status'](_0x120255(0x1ea))[_0x120255(0x1ff)](_0xfc128f=>this[_0x120255(0x250)]('heartbeat\x20failed:\x20'+_0xfc128f[_0x120255(0x1e3)]));},this[_0x12a2b5(0x251)]),this['connectSSE']();}async[a0_0x32cf33(0x22e)](){const _0xab3fc=a0_0x32cf33;if(this[_0xab3fc(0x254)]=!0x1,this[_0xab3fc(0x209)]?.[_0xab3fc(0x213)](),this[_0xab3fc(0x207)])clearInterval(this[_0xab3fc(0x207)]);await this[_0xab3fc(0x1f8)]('offline')[_0xab3fc(0x1ff)](()=>{}),this[_0xab3fc(0x250)](_0xab3fc(0x22d));}async[a0_0x32cf33(0x216)](_0x27c40e,_0x4ee14b,_0x55ef18='normal'){const _0x4d011f=a0_0x32cf33;return Y({'alias':_0x27c40e,'fromAlias':this[_0x4d011f(0x1e0)]},{'log':_0x3779f8=>console[_0x4d011f(0x250)](_0x3779f8),'send':()=>this[_0x4d011f(0x257)](_0x4d011f(0x23e),{'alias':_0x27c40e,'task':_0x4ee14b,'priority':_0x55ef18,'from_session':this[_0x4d011f(0x1e0)]})});}async[a0_0x32cf33(0x1e3)](_0x5e91e1,_0x3fa960){const _0x45ed3e=a0_0x32cf33;return this['call'](_0x45ed3e(0x25c),{'alias':_0x5e91e1,'message':_0x3fa960,'from_session':this[_0x45ed3e(0x1e0)]});}async[a0_0x32cf33(0x23b)](_0x39836c,_0x53af3b,_0xb3d124='completed'){const _0x3a2c01=a0_0x32cf33;return this[_0x3a2c01(0x257)](_0x3a2c01(0x1ec),{'in_reply_to':_0x39836c,'text':_0x53af3b,'status':_0xb3d124});}async['status'](_0x45b0b8,_0x223f88){const _0x543fb0=a0_0x32cf33;return this[_0x543fb0(0x257)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x543fb0(0x1e0)],'status':_0x45b0b8,'server':a0_0x497543(),'hostname':a0_0x497543(),'agent':this[_0x543fb0(0x25b)],'project_dir':process[_0x543fb0(0x241)](),..._0x223f88});}async[a0_0x32cf33(0x203)](){const _0x38a1cd=a0_0x32cf33;return this['call'](_0x38a1cd(0x255),{});}async[a0_0x32cf33(0x1fb)](_0x387792,_0x3720df){const _0x3e5eb8=a0_0x32cf33;return this[_0x3e5eb8(0x257)]('broadcast',{'message':_0x387792,'filter_server':_0x3720df?.['server'],'filter_status':_0x3720df?.['status']});}async[a0_0x32cf33(0x24a)](){const _0x1ed0d7=a0_0x32cf33;let _0x25dfa9=encodeURIComponent(this['alias']),_0x4195e7=this[_0x1ed0d7(0x1f3)]+_0x1ed0d7(0x229)+_0x25dfa9,_0x42fcf1=this[_0x1ed0d7(0x230)];while(this[_0x1ed0d7(0x254)]){try{this[_0x1ed0d7(0x209)]=new AbortController();let _0x26052e={'Accept':_0x1ed0d7(0x248)};if(this[_0x1ed0d7(0x215)])_0x26052e[_0x1ed0d7(0x200)]=_0x1ed0d7(0x238)+this[_0x1ed0d7(0x215)];let _0x46086d=await fetch(_0x4195e7,{'headers':_0x26052e,'signal':this['sseAbort'][_0x1ed0d7(0x25d)]});if(!_0x46086d['ok']||!_0x46086d[_0x1ed0d7(0x20f)]){this[_0x1ed0d7(0x250)](_0x1ed0d7(0x23c)+_0x46086d[_0x1ed0d7(0x1f8)]),await this[_0x1ed0d7(0x24b)](_0x42fcf1),_0x42fcf1=Math[_0x1ed0d7(0x1f6)](_0x42fcf1*1.5,0xea60);continue;}_0x42fcf1=this[_0x1ed0d7(0x230)];let _0x5743a0=_0x46086d['body'][_0x1ed0d7(0x239)](),_0x5c0217=new TextDecoder(),_0xa030d7='';while(this[_0x1ed0d7(0x254)]){let {done:_0x3df6b0,value:_0x51c677}=await _0x5743a0[_0x1ed0d7(0x220)]();if(_0x3df6b0)break;_0xa030d7+=_0x5c0217['decode'](_0x51c677,{'stream':!0x0});let _0x40ec4e=_0xa030d7[_0x1ed0d7(0x249)]('\x0a');_0xa030d7=_0x40ec4e['pop']()||'';for(let _0x31d781 of _0x40ec4e){if(!_0x31d781[_0x1ed0d7(0x23d)](_0x1ed0d7(0x223)))continue;try{let _0x1f5adc=JSON['parse'](_0x31d781[_0x1ed0d7(0x1ed)](0x6));if(_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x21a)){this[_0x1ed0d7(0x250)](_0x1ed0d7(0x20a)),this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x21a));continue;}if(_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x1f9)||_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x212)||_0x1f5adc[_0x1ed0d7(0x24f)]===_0x1ed0d7(0x1fb))await this[_0x1ed0d7(0x258)]();}catch{}}}}catch(_0x56f073){if(_0x56f073[_0x1ed0d7(0x228)]===_0x1ed0d7(0x233))break;this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x22f),_0x56f073),this[_0x1ed0d7(0x250)](_0x1ed0d7(0x204)+_0x56f073[_0x1ed0d7(0x1e3)]);}if(this[_0x1ed0d7(0x254)])this[_0x1ed0d7(0x1f7)](_0x1ed0d7(0x22d)),this[_0x1ed0d7(0x250)](_0x1ed0d7(0x256)+_0x42fcf1/0x3e8+_0x1ed0d7(0x218)),await this[_0x1ed0d7(0x24b)](_0x42fcf1),_0x42fcf1=Math[_0x1ed0d7(0x1f6)](_0x42fcf1*1.5,0xea60);}}async[a0_0x32cf33(0x258)](){const _0x5d87d7=a0_0x32cf33;try{let _0x298ebc=(await this[_0x5d87d7(0x257)](_0x5d87d7(0x217),{'alias':this[_0x5d87d7(0x1e0)],'limit':0xa}))?.[_0x5d87d7(0x210)]||[];for(let _0x3c3bf5 of _0x298ebc)await this[_0x5d87d7(0x257)](_0x5d87d7(0x21d),{'alias':this[_0x5d87d7(0x1e0)],'message_id':_0x3c3bf5['id']}),this[_0x5d87d7(0x250)]('←\x20'+_0x3c3bf5[_0x5d87d7(0x1f4)]+':\x20'+_0x3c3bf5[_0x5d87d7(0x226)][_0x5d87d7(0x1ed)](0x0,0x3c)),this[_0x5d87d7(0x1f7)]('task',_0x3c3bf5),this[_0x5d87d7(0x1f7)](_0x5d87d7(0x1e3),_0x3c3bf5);}catch(_0x4c5a91){this[_0x5d87d7(0x250)](_0x5d87d7(0x24e)+_0x4c5a91[_0x5d87d7(0x1e3)]);}}[a0_0x32cf33(0x24b)](_0x235d31){return new Promise(_0x2182c1=>setTimeout(_0x2182c1,_0x235d31));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x2eb4c7=a0_0x337c;(function(_0x1e804b,_0x5d505d){const _0x2b5448=a0_0x337c,_0x6cd885=_0x1e804b();while(!![]){try{const _0x3f0c7d=parseInt(_0x2b5448(0x1a6))/0x1+-parseInt(_0x2b5448(0x188))/0x2+-parseInt(_0x2b5448(0x19d))/0x3+-parseInt(_0x2b5448(0x173))/0x4*(-parseInt(_0x2b5448(0x16b))/0x5)+parseInt(_0x2b5448(0x156))/0x6*(parseInt(_0x2b5448(0x1a8))/0x7)+-parseInt(_0x2b5448(0x1ae))/0x8*(parseInt(_0x2b5448(0x17d))/0x9)+parseInt(_0x2b5448(0x161))/0xa;if(_0x3f0c7d===_0x5d505d)break;else _0x6cd885['push'](_0x6cd885['shift']());}catch(_0x178423){_0x6cd885['push'](_0x6cd885['shift']());}}}(a0_0x141b,0x99ee1));import{EventEmitter as a0_0x4ff83b}from'events';import{hostname as a0_0x116f3d}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x624f4b,_0x151779)=>(_0x624f4b??_0x151779)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2eb4c7(0x16c)](0x0,0xf0);function N(_0x95f33f){const _0x20209b=a0_0x2eb4c7;return(_0x95f33f instanceof Error?_0x95f33f['message']:String(_0x95f33f??_0x20209b(0x186)))[_0x20209b(0x178)](K,_0x20209b(0x155))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x30ecb1,_0x4f7058=process.env.ANET_TASK_TRACE_FORMAT===a0_0x2eb4c7(0x153)){const _0x98bb93=a0_0x2eb4c7;if(_0x4f7058)return JSON[_0x98bb93(0x16e)](_0x30ecb1);let _0x1f876d=L(_0x30ecb1[_0x98bb93(0x17f)],_0x98bb93(0x1c0)),_0x4ff64c=L(_0x30ecb1['task_id'],_0x98bb93(0x1ac)),_0x20942d=_0x30ecb1[_0x98bb93(0x1c3)]?'\x20error='+_0x30ecb1[_0x98bb93(0x1c3)]+':'+(_0x30ecb1[_0x98bb93(0x1b7)]??''):'';return _0x98bb93(0x179)+_0x30ecb1[_0x98bb93(0x18b)]+'\x20from='+L(_0x30ecb1['from_alias'],_0x98bb93(0x1bf))+'\x20to='+L(_0x30ecb1[_0x98bb93(0x154)],'<unknown>')+_0x98bb93(0x1b6)+_0x4ff64c+_0x98bb93(0x1c9)+_0x1f876d+_0x98bb93(0x1c4)+L(_0x30ecb1[_0x98bb93(0x171)],_0x98bb93(0x1bf))+_0x98bb93(0x194)+_0x30ecb1['transport']+_0x98bb93(0x18a)+_0x30ecb1[_0x98bb93(0x193)]+'\x20lifecycle='+_0x30ecb1[_0x98bb93(0x17e)]+_0x20942d;}function U(_0x19d99a){const _0x2c846d=a0_0x2eb4c7;return{'event':{'sending':'task.send.start','delivered':_0x2c846d(0x1bc),'failed':'task.send.failed','acked':_0x2c846d(0x1b9),'started':'task.started','replied':_0x2c846d(0x16d),'expired':'task.expired'}[_0x19d99a['status']],..._0x19d99a};}function j(_0x13e606){const _0x8a9485=a0_0x2eb4c7;let _0x4443ef=_0x13e606?.['task_id']||_0x13e606?.['message_id']||_0x13e606?.['id'];if(_0x4443ef)return String(_0x4443ef);let _0x56355a=_0x13e606?.['content']?.[0x0]?.['text'];if(typeof _0x56355a!==_0x8a9485(0x185))return null;try{let _0x72185a=JSON['parse'](_0x56355a);return _0x72185a?.['task_id']||_0x72185a?.['message_id']||_0x72185a?.['id']||null;}catch{return null;}}async function X(_0x5767e4,_0x28db05){const _0x2725dd=a0_0x2eb4c7;let _0x1cb674=_0x28db05[_0x2725dd(0x167)]??Date['now'],_0x8d3945=_0x1cb674(),_0x1c04a2=(_0x173757,_0x496ac3,_0x2c8a00,_0x3764a4)=>{const _0x16a0a9=_0x2725dd;_0x28db05[_0x16a0a9(0x1af)](O(U({'from_alias':_0x5767e4[_0x16a0a9(0x1c6)],'to_alias':_0x5767e4['toAlias'],'task_id':_0x496ac3,'parent_task_id':_0x5767e4[_0x16a0a9(0x1c1)],'network_id':_0x5767e4[_0x16a0a9(0x197)],'transport':_0x5767e4[_0x16a0a9(0x19f)],'status':_0x173757,'duration_ms':_0x1cb674()-_0x8d3945,'lifecycle_tracking':_0x5767e4[_0x16a0a9(0x1ca)],..._0x2c8a00!==void 0x0?{'error_code':_0x3764a4||_0x16a0a9(0x17b),'error_message':N(_0x2c8a00)}:{}})));};_0x1c04a2(_0x2725dd(0x187),null);try{let _0x4614ef=await _0x28db05['send'](),_0x2e993e=j(_0x4614ef);if(_0x2e993e)_0x1c04a2(_0x2725dd(0x1bd),_0x2e993e);else{if(_0x4614ef?.['ok']===!0x1||_0x4614ef?.['error'])_0x1c04a2('failed',_0x2e993e,_0x4614ef?.[_0x2725dd(0x1c2)]||_0x2725dd(0x1a0),_0x2725dd(0x1a2));else _0x1c04a2(_0x2725dd(0x15f),null,'CommHub\x20response\x20omitted\x20task_id',_0x2725dd(0x18e));}return _0x4614ef;}catch(_0x5d1b0b){throw _0x1c04a2('failed',null,_0x5d1b0b,_0x2725dd(0x17b)),_0x5d1b0b;}}async function Y(_0x346077,_0x2591ad){const _0x1a8a43=a0_0x2eb4c7;return X({'fromAlias':_0x346077[_0x1a8a43(0x1c6)],'toAlias':_0x346077[_0x1a8a43(0x18f)],'parentTaskId':_0x346077[_0x1a8a43(0x1c1)]||null,'networkId':_0x346077[_0x1a8a43(0x197)]||null,'transport':_0x1a8a43(0x1c5),'lifecycleTracking':_0x1a8a43(0x17c)},_0x2591ad);}function a0_0x337c(_0x2f2c7c,_0x40324a){_0x2f2c7c=_0x2f2c7c-0x151;const _0x141bc1=a0_0x141b();let _0x337c32=_0x141bc1[_0x2f2c7c];return _0x337c32;}class $ extends a0_0x4ff83b{['url'];[a0_0x2eb4c7(0x18f)];['token'];[a0_0x2eb4c7(0x170)];['resumeId'];['heartbeatInterval'];['reconnectDelay'];[a0_0x2eb4c7(0x183)];[a0_0x2eb4c7(0x1b8)];['running']=!0x1;constructor(_0xd1e618){const _0x504f9f=a0_0x2eb4c7;super();if(this['url']=_0xd1e618[_0x504f9f(0x157)][_0x504f9f(0x178)](/\/$/,''),this[_0x504f9f(0x18f)]=_0xd1e618[_0x504f9f(0x18f)],this['token']=_0xd1e618[_0x504f9f(0x1b1)],this[_0x504f9f(0x170)]=_0xd1e618[_0x504f9f(0x170)]||_0x504f9f(0x165),this[_0x504f9f(0x192)]='sdk-'+_0xd1e618[_0x504f9f(0x18f)]+'-'+Date[_0x504f9f(0x167)]()[_0x504f9f(0x1a9)](0x24),this[_0x504f9f(0x15a)]=_0xd1e618[_0x504f9f(0x15a)]??0x2bf20,this[_0x504f9f(0x160)]=_0xd1e618[_0x504f9f(0x160)]??0xbb8,_0xd1e618[_0x504f9f(0x163)]!==!0x1)this[_0x504f9f(0x174)]();}[a0_0x2eb4c7(0x1af)](_0x11952e){const _0xc08f82=a0_0x2eb4c7;console['log']('['+new Date()[_0xc08f82(0x180)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0xc08f82(0x18f)]+']\x20'+_0x11952e);}async['call'](_0x309a2a,_0x55107c){const _0x559a9d=a0_0x2eb4c7;let _0x212d83={'Content-Type':_0x559a9d(0x1a7),'Accept':'application/json,\x20text/event-stream'};if(this[_0x559a9d(0x1b1)])_0x212d83[_0x559a9d(0x190)]=_0x559a9d(0x166)+this['token'];let _0x48fa61=await(await fetch(this[_0x559a9d(0x157)]+_0x559a9d(0x15d),{'method':_0x559a9d(0x16f),'headers':_0x212d83,'body':JSON[_0x559a9d(0x16e)]({'jsonrpc':'2.0','id':Date[_0x559a9d(0x167)](),'method':_0x559a9d(0x191),'params':{'name':_0x309a2a,'arguments':_0x55107c}})}))[_0x559a9d(0x1b4)](),_0x53202f=_0x48fa61[_0x559a9d(0x158)](/data: (.+)/),_0x4df14a=_0x53202f?JSON[_0x559a9d(0x199)](_0x53202f[0x1]):JSON[_0x559a9d(0x199)](_0x48fa61),_0x529a79=_0x4df14a?.['result']?.['content']?.[0x0]?.[_0x559a9d(0x1b4)];return _0x529a79?JSON[_0x559a9d(0x199)](_0x529a79):_0x4df14a;}async[a0_0x2eb4c7(0x174)](){const _0x75c740=a0_0x2eb4c7;if(this[_0x75c740(0x15b)])return;this['running']=!0x0,await this[_0x75c740(0x18b)](_0x75c740(0x168)),this[_0x75c740(0x1af)]('registered'),this[_0x75c740(0x183)]=setInterval(()=>{const _0x3248f5=_0x75c740;this[_0x3248f5(0x18b)](_0x3248f5(0x168))[_0x3248f5(0x1be)](_0x5ed12a=>this['log'](_0x3248f5(0x19c)+_0x5ed12a[_0x3248f5(0x1a4)]));},this[_0x75c740(0x15a)]),this[_0x75c740(0x1b0)]();}async['disconnect'](){const _0x1a49c4=a0_0x2eb4c7;if(this[_0x1a49c4(0x15b)]=!0x1,this[_0x1a49c4(0x1b8)]?.[_0x1a49c4(0x16a)](),this['heartbeatTimer'])clearInterval(this[_0x1a49c4(0x183)]);await this[_0x1a49c4(0x18b)](_0x1a49c4(0x1c8))['catch'](()=>{}),this[_0x1a49c4(0x1af)](_0x1a49c4(0x1bb));}async[a0_0x2eb4c7(0x184)](_0x244f70,_0x4bde7a,_0x12f0ff=a0_0x2eb4c7(0x15e)){const _0x2b7350=a0_0x2eb4c7;return Y({'alias':_0x244f70,'fromAlias':this[_0x2b7350(0x18f)]},{'log':_0x5d23f1=>console[_0x2b7350(0x1af)](_0x5d23f1),'send':()=>this['call']('send_task',{'alias':_0x244f70,'task':_0x4bde7a,'priority':_0x12f0ff,'from_session':this[_0x2b7350(0x18f)]})});}async[a0_0x2eb4c7(0x1a4)](_0x16b8a9,_0x1efd9d){const _0x1022df=a0_0x2eb4c7;return this['call'](_0x1022df(0x18c),{'alias':_0x16b8a9,'message':_0x1efd9d,'from_session':this[_0x1022df(0x18f)]});}async['reply'](_0x2bbd0e,_0x16b725,_0x41a68b='completed'){const _0x6a38dc=a0_0x2eb4c7;return this[_0x6a38dc(0x19b)]('send_reply',{'in_reply_to':_0x2bbd0e,'text':_0x16b725,'status':_0x41a68b});}async[a0_0x2eb4c7(0x18b)](_0x1ee112,_0x45f143){const _0xd95a9c=a0_0x2eb4c7;return this[_0xd95a9c(0x19b)](_0xd95a9c(0x1c7),{'resume_id':this[_0xd95a9c(0x192)],'alias':this[_0xd95a9c(0x18f)],'status':_0x1ee112,'server':a0_0x116f3d(),'hostname':a0_0x116f3d(),'agent':this[_0xd95a9c(0x170)],'project_dir':process['cwd'](),..._0x45f143});}async[a0_0x2eb4c7(0x176)](){const _0x58b162=a0_0x2eb4c7;return this['call'](_0x58b162(0x17a),{});}async[a0_0x2eb4c7(0x1b5)](_0x2e1e05,_0x3fee2f){const _0x29ccc1=a0_0x2eb4c7;return this['call'](_0x29ccc1(0x1b5),{'message':_0x2e1e05,'filter_server':_0x3fee2f?.[_0x29ccc1(0x1ab)],'filter_status':_0x3fee2f?.['status']});}async['connectSSE'](){const _0xd6d71a=a0_0x2eb4c7;let _0x57f55a=encodeURIComponent(this[_0xd6d71a(0x18f)]),_0x598f34=this[_0xd6d71a(0x157)]+_0xd6d71a(0x1aa)+_0x57f55a,_0x48af3a=this[_0xd6d71a(0x160)];while(this[_0xd6d71a(0x15b)]){try{this[_0xd6d71a(0x1b8)]=new AbortController();let _0x453475={'Accept':'text/event-stream'};if(this[_0xd6d71a(0x1b1)])_0x453475[_0xd6d71a(0x190)]=_0xd6d71a(0x166)+this['token'];let _0x3c00d1=await fetch(_0x598f34,{'headers':_0x453475,'signal':this[_0xd6d71a(0x1b8)][_0xd6d71a(0x162)]});if(!_0x3c00d1['ok']||!_0x3c00d1[_0xd6d71a(0x195)]){this[_0xd6d71a(0x1af)]('SSE\x20failed:\x20'+_0x3c00d1[_0xd6d71a(0x18b)]),await this[_0xd6d71a(0x198)](_0x48af3a),_0x48af3a=Math[_0xd6d71a(0x1a5)](_0x48af3a*1.5,0xea60);continue;}_0x48af3a=this[_0xd6d71a(0x160)];let _0x535dda=_0x3c00d1[_0xd6d71a(0x195)][_0xd6d71a(0x164)](),_0x479def=new TextDecoder(),_0x1f411c='';while(this[_0xd6d71a(0x15b)]){let {done:_0x22a15c,value:_0x50ba6a}=await _0x535dda['read']();if(_0x22a15c)break;_0x1f411c+=_0x479def[_0xd6d71a(0x152)](_0x50ba6a,{'stream':!0x0});let _0x387bec=_0x1f411c['split']('\x0a');_0x1f411c=_0x387bec[_0xd6d71a(0x19a)]()||'';for(let _0x3f929a of _0x387bec){if(!_0x3f929a['startsWith'](_0xd6d71a(0x169)))continue;try{let _0x4a659b=JSON['parse'](_0x3f929a[_0xd6d71a(0x16c)](0x6));if(_0x4a659b[_0xd6d71a(0x1b3)]===_0xd6d71a(0x175)){this['log'](_0xd6d71a(0x181)),this['emit']('connected');continue;}if(_0x4a659b[_0xd6d71a(0x1b3)]==='new_task'||_0x4a659b[_0xd6d71a(0x1b3)]===_0xd6d71a(0x172)||_0x4a659b[_0xd6d71a(0x1b3)]==='broadcast')await this[_0xd6d71a(0x1a1)]();}catch{}}}}catch(_0xeaad65){if(_0xeaad65[_0xd6d71a(0x196)]===_0xd6d71a(0x182))break;this[_0xd6d71a(0x189)](_0xd6d71a(0x1c2),_0xeaad65),this[_0xd6d71a(0x1af)](_0xd6d71a(0x1b2)+_0xeaad65[_0xd6d71a(0x1a4)]);}if(this[_0xd6d71a(0x15b)])this[_0xd6d71a(0x189)](_0xd6d71a(0x1bb)),this[_0xd6d71a(0x1af)](_0xd6d71a(0x19e)+_0x48af3a/0x3e8+_0xd6d71a(0x15c)),await this[_0xd6d71a(0x198)](_0x48af3a),_0x48af3a=Math['min'](_0x48af3a*1.5,0xea60);}}async[a0_0x2eb4c7(0x1a1)](){const _0x5df912=a0_0x2eb4c7;try{let _0x539981=(await this['call'](_0x5df912(0x18d),{'alias':this['alias'],'limit':0xa}))?.[_0x5df912(0x151)]||[];for(let _0x11c09b of _0x539981)await this[_0x5df912(0x19b)](_0x5df912(0x1a3),{'alias':this[_0x5df912(0x18f)],'message_id':_0x11c09b['id']}),this[_0x5df912(0x1af)]('←\x20'+_0x11c09b[_0x5df912(0x159)]+':\x20'+_0x11c09b[_0x5df912(0x1ad)][_0x5df912(0x16c)](0x0,0x3c)),this['emit'](_0x5df912(0x177),_0x11c09b),this[_0x5df912(0x189)](_0x5df912(0x1a4),_0x11c09b);}catch(_0x377930){this[_0x5df912(0x1af)](_0x5df912(0x1ba)+_0x377930['message']);}}[a0_0x2eb4c7(0x198)](_0x20c37b){return new Promise(_0x5d904a=>setTimeout(_0x5d904a,_0x20c37b));}}var F=$;export{F as default,$ as CommHub};function a0_0x141b(){const _0x15e4db=['idle','data:\x20','abort','9105qSptjZ','slice','task.replied','stringify','POST','agent','network_id','new_message','844IIPyPo','connect','connected','getAllStatus','task','replace','[commhub:task]\x20','get_all_status','send_failed','not_tracked','6122943UPBDHM','lifecycle_tracking','parent_task_id','toTimeString','SSE\x20connected','AbortError','heartbeatTimer','send','string','unknown\x20error','sending','2272372jhIEpN','emit','\x20duration_ms=','status','send_message','get_inbox','missing_task_id','alias','Authorization','tools/call','resumeId','duration_ms','\x20transport=','body','name','networkId','sleep','parse','pop','call','heartbeat\x20failed:\x20','1667007ZjsXqE','SSE\x20reconnecting\x20in\x20','transport','CommHub\x20rejected\x20task','processInbox','send_rejected','ack_inbox','message','min','568034xfbufb','application/json','56OlQzba','toString','/events/','server','<pending>','content','8TOCQzj','log','connectSSE','token','SSE\x20error:\x20','type','text','broadcast','\x20task_id=','error_message','sseAbort','task.ack','inbox\x20error:\x20','disconnected','task.send.delivered','delivered','catch','<unknown>','<missing>','parentTaskId','error','error_code','\x20network_id=','mcp_http','fromAlias','report_status','offline','\x20parent_task_id=','lifecycleTracking','messages','decode','json','to_alias','[REDACTED]','506712yDBSDg','url','match','from_session','heartbeatInterval','running','s...','/mcp','normal','failed','reconnectDelay','13747980tHJtvq','signal','autoConnect','getReader','sdk','Bearer\x20','now'];a0_0x141b=function(){return _0x15e4db;};return a0_0x141b();}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const SECRET_KEYS_FILE = "secrets.env";
|
|
2
|
+
export declare const NODE_SECRET_KEYS_MAX = 50;
|
|
3
|
+
export declare function nodeSecretFilePath(nodeDir: string): string;
|
|
4
|
+
export type NodeSecretKeysRead = {
|
|
5
|
+
kind: "ok";
|
|
6
|
+
keys: string[];
|
|
7
|
+
} | {
|
|
8
|
+
kind: "missing";
|
|
9
|
+
} | {
|
|
10
|
+
kind: "unsafe";
|
|
11
|
+
reason: string;
|
|
12
|
+
};
|
|
13
|
+
/** Names only. Never returns values, and never throws. */
|
|
14
|
+
export declare function readNodeSecretKeys(nodeDir: string): NodeSecretKeysRead;
|
|
15
|
+
/** File mode warning: the loader refuses a secrets.env that is not 0600, so the
|
|
16
|
+
* CLI should say so instead of printing a list the node will silently skip. */
|
|
17
|
+
export declare function nodeSecretFileModeWarning(nodeDir: string): string | null;
|
|
18
|
+
export type NodeSecretWriteResult = {
|
|
19
|
+
kind: "ok";
|
|
20
|
+
changed: boolean;
|
|
21
|
+
} | {
|
|
22
|
+
kind: "rejected";
|
|
23
|
+
reason: string;
|
|
24
|
+
};
|
|
25
|
+
/** Replace the value of one key, or append it. Line-based so comments and the
|
|
26
|
+
* operator's own ordering survive; only the matching line is rewritten.
|
|
27
|
+
*
|
|
28
|
+
* The value arrives from the caller (CLI reads stdin) — it is never logged,
|
|
29
|
+
* never echoed, and never put in an error message. */
|
|
30
|
+
export declare function writeNodeSecret(nodeDir: string, key: string, value: string): NodeSecretWriteResult;
|
|
31
|
+
/** Drop the key's line(s). Returns changed=false when the key was not present. */
|
|
32
|
+
export declare function removeNodeSecret(nodeDir: string, key: string): NodeSecretWriteResult;
|
|
@@ -1,14 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* CommHub Channel Plugin for Claude Code
|
|
4
|
-
*
|
|
5
|
-
* Alias resolution (priority order):
|
|
6
|
-
* 1. COMMHUB_ALIAS env var
|
|
7
|
-
* 2. Project .env: ~/.claude/channels/commhub/{project-path}/.env
|
|
8
|
-
* 3. tmux session name
|
|
9
|
-
* 4. hostname
|
|
10
|
-
*
|
|
11
|
-
* Shared config from: ~/.claude/channels/commhub/.env
|
|
12
|
-
* COMMHUB_URL, COMMHUB_TOKEN
|
|
13
|
-
*/
|
|
14
2
|
export {};
|