@sleep2agi/agent-network 2.3.0-preview.90 → 2.3.0-preview.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/copresence-identity.d.ts +14 -0
- package/dist/src/node-server.js +7 -7
- package/dist/src/opencode-agent-node-pair.d.ts +2 -2
- package/dist/src/outbound-attachments.d.ts +3 -0
- package/dist/src/reply-local-links.d.ts +47 -0
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x50df69=a0_0x6d08;(function(_0x31dedc,_0x58d114){const _0x29e3c0=a0_0x6d08,_0x16fb4f=_0x31dedc();while(!![]){try{const _0x1d2a7d=parseInt(_0x29e3c0(0x1c4))/0x1*(-parseInt(_0x29e3c0(0x1d0))/0x2)+-parseInt(_0x29e3c0(0x1d2))/0x3*(-parseInt(_0x29e3c0(0x1a8))/0x4)+parseInt(_0x29e3c0(0x1a0))/0x5+parseInt(_0x29e3c0(0x16b))/0x6+parseInt(_0x29e3c0(0x1c3))/0x7+-parseInt(_0x29e3c0(0x1b0))/0x8+-parseInt(_0x29e3c0(0x1ae))/0x9*(parseInt(_0x29e3c0(0x1da))/0xa);if(_0x1d2a7d===_0x58d114)break;else _0x16fb4f['push'](_0x16fb4f['shift']());}catch(_0x1b50af){_0x16fb4f['push'](_0x16fb4f['shift']());}}}(a0_0x5250,0x35a3c));function a0_0x6d08(_0x41486a,_0x42ad7c){_0x41486a=_0x41486a-0x15d;const _0x525039=a0_0x5250();let _0x6d08c9=_0x525039[_0x41486a];return _0x6d08c9;}import{EventEmitter as a0_0x522963}from'events';function a0_0x5250(){const _0x4159cb=['lifecycleTracking','token','\x20transport=','reply','cwd','<unknown>','1457034CqJdlj','getReader','POST','get_all_status','send_message','<pending>','pop','toAlias','Bearer\x20','messages','application/json','agent','error_message','sdk-','Authorization','sleep','/events/','mcp_http','send_reply','\x20duration_ms=','resumeId','\x20lifecycle=','match','\x20task_id=','parentTaskId','emit','heartbeatInterval','completed','duration_ms','SSE\x20failed:\x20','send','new_task','body','disconnected','message_id','heartbeat\x20failed:\x20','unknown\x20error','getAllStatus','application/json,\x20text/event-stream','connected','\x20from=','reconnectDelay','send_task','normal','s...','server','delivered','CommHub\x20response\x20omitted\x20task_id','message','stringify','error_code','[REDACTED]','parse','495785rseDXk','get_inbox','type','url','<missing>','disconnect','tools/call','sdk','5316VIntJT','task.send.failed','error','json',']\x20[commhub:','not_tracked','9tzykLE','SSE\x20connected','2293328JJAHwR','fromAlias','processInbox','SSE\x20reconnecting\x20in\x20','\x20to=','lifecycle_tracking','task.send.delivered','transport','\x20parent_task_id=','task_id','catch','failed','sseAbort','task.ack','min','content','call','alias','/mcp','1398845gJPrQQ','1sMyzmX','offline','startsWith','task.replied','data:\x20','parent_task_id','toTimeString','missing_task_id','heartbeatTimer','log','status','split','397778CRkVvl','now','957XDNPzz','slice','\x20error=','connect','autoConnect','send_rejected','idle','to_alias','2605190OHdgkD','replace','\x20network_id=','text','task','running','network_id','string','networkId','connectSSE','send_failed'];a0_0x5250=function(){return _0x4159cb;};return a0_0x5250();}import{hostname as a0_0x21b1e0}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2ad2cb,_0x44ae8d)=>(_0x2ad2cb??_0x44ae8d)[a0_0x50df69(0x1db)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0xb6c746){const _0x73a7b=a0_0x50df69;return(_0xb6c746 instanceof Error?_0xb6c746[_0x73a7b(0x19b)]:String(_0xb6c746??_0x73a7b(0x18f)))[_0x73a7b(0x1db)](K,_0x73a7b(0x19e))[_0x73a7b(0x1db)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x73a7b(0x1d3)](0x0,0xf0);}function O(_0x491582,_0xbe8889=process.env.ANET_TASK_TRACE_FORMAT===a0_0x50df69(0x1ab)){const _0x5446ec=a0_0x50df69;if(_0xbe8889)return JSON['stringify'](_0x491582);let _0x483fea=L(_0x491582[_0x5446ec(0x1c9)],_0x5446ec(0x1a4)),_0x376ee3=L(_0x491582['task_id'],_0x5446ec(0x170)),_0x3ecec0=_0x491582[_0x5446ec(0x19d)]?_0x5446ec(0x1d4)+_0x491582[_0x5446ec(0x19d)]+':'+(_0x491582[_0x5446ec(0x177)]??''):'';return'[commhub:task]\x20'+_0x491582[_0x5446ec(0x1ce)]+_0x5446ec(0x193)+L(_0x491582['from_alias'],_0x5446ec(0x16a))+_0x5446ec(0x1b4)+L(_0x491582[_0x5446ec(0x1d9)],_0x5446ec(0x16a))+_0x5446ec(0x182)+_0x376ee3+_0x5446ec(0x1b8)+_0x483fea+_0x5446ec(0x1dc)+L(_0x491582[_0x5446ec(0x160)],_0x5446ec(0x16a))+_0x5446ec(0x167)+_0x491582['transport']+_0x5446ec(0x17e)+_0x491582[_0x5446ec(0x187)]+_0x5446ec(0x180)+_0x491582[_0x5446ec(0x1b5)]+_0x3ecec0;}function U(_0x1c9827){const _0x2694d2=a0_0x50df69;return{'event':{'sending':'task.send.start','delivered':_0x2694d2(0x1b6),'failed':_0x2694d2(0x1a9),'acked':_0x2694d2(0x1bd),'started':'task.started','replied':_0x2694d2(0x1c7),'expired':'task.expired'}[_0x1c9827[_0x2694d2(0x1ce)]],..._0x1c9827};}function j(_0x4a8db1){const _0x5199fa=a0_0x50df69;let _0x32a36e=_0x4a8db1?.[_0x5199fa(0x1b9)]||_0x4a8db1?.[_0x5199fa(0x18d)]||_0x4a8db1?.['id'];if(_0x32a36e)return String(_0x32a36e);let _0x16a0d1=_0x4a8db1?.[_0x5199fa(0x1bf)]?.[0x0]?.[_0x5199fa(0x15d)];if(typeof _0x16a0d1!==_0x5199fa(0x161))return null;try{let _0x522ec6=JSON[_0x5199fa(0x19f)](_0x16a0d1);return _0x522ec6?.[_0x5199fa(0x1b9)]||_0x522ec6?.[_0x5199fa(0x18d)]||_0x522ec6?.['id']||null;}catch{return null;}}async function X(_0x184542,_0x5a5a2d){const _0x208c13=a0_0x50df69;let _0x4d187a=_0x5a5a2d['now']??Date[_0x208c13(0x1d1)],_0x2df1b7=_0x4d187a(),_0x11e44f=(_0x40653f,_0x5d868a,_0x415f0b,_0x287a1c)=>{const _0x1f3b2a=_0x208c13;_0x5a5a2d[_0x1f3b2a(0x1cd)](O(U({'from_alias':_0x184542['fromAlias'],'to_alias':_0x184542[_0x1f3b2a(0x172)],'task_id':_0x5d868a,'parent_task_id':_0x184542[_0x1f3b2a(0x183)],'network_id':_0x184542['networkId'],'transport':_0x184542[_0x1f3b2a(0x1b7)],'status':_0x40653f,'duration_ms':_0x4d187a()-_0x2df1b7,'lifecycle_tracking':_0x184542[_0x1f3b2a(0x165)],..._0x415f0b!==void 0x0?{'error_code':_0x287a1c||_0x1f3b2a(0x164),'error_message':N(_0x415f0b)}:{}})));};_0x11e44f('sending',null);try{let _0x5b4f99=await _0x5a5a2d['send'](),_0x2e0ce8=j(_0x5b4f99);if(_0x2e0ce8)_0x11e44f(_0x208c13(0x199),_0x2e0ce8);else{if(_0x5b4f99?.['ok']===!0x1||_0x5b4f99?.[_0x208c13(0x1aa)])_0x11e44f('failed',_0x2e0ce8,_0x5b4f99?.[_0x208c13(0x1aa)]||'CommHub\x20rejected\x20task',_0x208c13(0x1d7));else _0x11e44f(_0x208c13(0x1bb),null,_0x208c13(0x19a),_0x208c13(0x1cb));}return _0x5b4f99;}catch(_0x43d20b){throw _0x11e44f(_0x208c13(0x1bb),null,_0x43d20b,_0x208c13(0x164)),_0x43d20b;}}async function Y(_0x37120d,_0x134c0c){const _0x1a2310=a0_0x50df69;return X({'fromAlias':_0x37120d[_0x1a2310(0x1b1)],'toAlias':_0x37120d[_0x1a2310(0x1c1)],'parentTaskId':_0x37120d[_0x1a2310(0x183)]||null,'networkId':_0x37120d[_0x1a2310(0x162)]||null,'transport':_0x1a2310(0x17c),'lifecycleTracking':_0x1a2310(0x1ad)},_0x134c0c);}class $ extends a0_0x522963{[a0_0x50df69(0x1a3)];['alias'];[a0_0x50df69(0x166)];[a0_0x50df69(0x176)];[a0_0x50df69(0x17f)];[a0_0x50df69(0x185)];[a0_0x50df69(0x194)];[a0_0x50df69(0x1cc)];[a0_0x50df69(0x1bc)];[a0_0x50df69(0x15f)]=!0x1;constructor(_0x1a8091){const _0x52b8ae=a0_0x50df69;super();if(this[_0x52b8ae(0x1a3)]=_0x1a8091[_0x52b8ae(0x1a3)][_0x52b8ae(0x1db)](/\/$/,''),this[_0x52b8ae(0x1c1)]=_0x1a8091[_0x52b8ae(0x1c1)],this[_0x52b8ae(0x166)]=_0x1a8091[_0x52b8ae(0x166)],this[_0x52b8ae(0x176)]=_0x1a8091['agent']||_0x52b8ae(0x1a7),this[_0x52b8ae(0x17f)]=_0x52b8ae(0x178)+_0x1a8091['alias']+'-'+Date['now']()['toString'](0x24),this[_0x52b8ae(0x185)]=_0x1a8091[_0x52b8ae(0x185)]??0x2bf20,this[_0x52b8ae(0x194)]=_0x1a8091[_0x52b8ae(0x194)]??0xbb8,_0x1a8091[_0x52b8ae(0x1d6)]!==!0x1)this[_0x52b8ae(0x1d5)]();}[a0_0x50df69(0x1cd)](_0x48a12b){const _0xc28632=a0_0x50df69;console[_0xc28632(0x1cd)]('['+new Date()[_0xc28632(0x1ca)]()[_0xc28632(0x1d3)](0x0,0x8)+_0xc28632(0x1ac)+this[_0xc28632(0x1c1)]+']\x20'+_0x48a12b);}async[a0_0x50df69(0x1c0)](_0x5e3876,_0x1bf066){const _0x16eec7=a0_0x50df69;let _0x4d30d6={'Content-Type':_0x16eec7(0x175),'Accept':_0x16eec7(0x191)};if(this['token'])_0x4d30d6[_0x16eec7(0x179)]=_0x16eec7(0x173)+this[_0x16eec7(0x166)];let _0x3daef6=await(await fetch(this[_0x16eec7(0x1a3)]+_0x16eec7(0x1c2),{'method':_0x16eec7(0x16d),'headers':_0x4d30d6,'body':JSON[_0x16eec7(0x19c)]({'jsonrpc':'2.0','id':Date[_0x16eec7(0x1d1)](),'method':_0x16eec7(0x1a6),'params':{'name':_0x5e3876,'arguments':_0x1bf066}})}))[_0x16eec7(0x15d)](),_0x5aabf2=_0x3daef6[_0x16eec7(0x181)](/data: (.+)/),_0xfd3606=_0x5aabf2?JSON[_0x16eec7(0x19f)](_0x5aabf2[0x1]):JSON[_0x16eec7(0x19f)](_0x3daef6),_0x49eec2=_0xfd3606?.['result']?.[_0x16eec7(0x1bf)]?.[0x0]?.['text'];return _0x49eec2?JSON[_0x16eec7(0x19f)](_0x49eec2):_0xfd3606;}async['connect'](){const _0x38a21f=a0_0x50df69;if(this[_0x38a21f(0x15f)])return;this[_0x38a21f(0x15f)]=!0x0,await this['status'](_0x38a21f(0x1d8)),this[_0x38a21f(0x1cd)]('registered'),this[_0x38a21f(0x1cc)]=setInterval(()=>{const _0x405b98=_0x38a21f;this[_0x405b98(0x1ce)](_0x405b98(0x1d8))[_0x405b98(0x1ba)](_0x58eb65=>this[_0x405b98(0x1cd)](_0x405b98(0x18e)+_0x58eb65[_0x405b98(0x19b)]));},this['heartbeatInterval']),this[_0x38a21f(0x163)]();}async[a0_0x50df69(0x1a5)](){const _0x58681b=a0_0x50df69;if(this['running']=!0x1,this['sseAbort']?.['abort'](),this[_0x58681b(0x1cc)])clearInterval(this[_0x58681b(0x1cc)]);await this[_0x58681b(0x1ce)](_0x58681b(0x1c5))[_0x58681b(0x1ba)](()=>{}),this[_0x58681b(0x1cd)]('disconnected');}async[a0_0x50df69(0x189)](_0x505321,_0x169084,_0x1b7eeb=a0_0x50df69(0x196)){const _0x1dbb6b=a0_0x50df69;return Y({'alias':_0x505321,'fromAlias':this[_0x1dbb6b(0x1c1)]},{'log':_0x22f647=>console[_0x1dbb6b(0x1cd)](_0x22f647),'send':()=>this[_0x1dbb6b(0x1c0)](_0x1dbb6b(0x195),{'alias':_0x505321,'task':_0x169084,'priority':_0x1b7eeb,'from_session':this[_0x1dbb6b(0x1c1)]})});}async[a0_0x50df69(0x19b)](_0x3e7b83,_0x3f59d9){const _0x2dadd6=a0_0x50df69;return this[_0x2dadd6(0x1c0)](_0x2dadd6(0x16f),{'alias':_0x3e7b83,'message':_0x3f59d9,'from_session':this[_0x2dadd6(0x1c1)]});}async[a0_0x50df69(0x168)](_0x31d5d0,_0x70a516,_0x2c415c=a0_0x50df69(0x186)){const _0x1c272a=a0_0x50df69;return this[_0x1c272a(0x1c0)](_0x1c272a(0x17d),{'in_reply_to':_0x31d5d0,'text':_0x70a516,'status':_0x2c415c});}async['status'](_0x2851b5,_0x5c729f){const _0x3cee08=a0_0x50df69;return this[_0x3cee08(0x1c0)]('report_status',{'resume_id':this[_0x3cee08(0x17f)],'alias':this[_0x3cee08(0x1c1)],'status':_0x2851b5,'server':a0_0x21b1e0(),'hostname':a0_0x21b1e0(),'agent':this[_0x3cee08(0x176)],'project_dir':process[_0x3cee08(0x169)](),..._0x5c729f});}async[a0_0x50df69(0x190)](){const _0x4f5444=a0_0x50df69;return this[_0x4f5444(0x1c0)](_0x4f5444(0x16e),{});}async['broadcast'](_0x3bdb2,_0x314cd5){const _0x39ee39=a0_0x50df69;return this['call']('broadcast',{'message':_0x3bdb2,'filter_server':_0x314cd5?.[_0x39ee39(0x198)],'filter_status':_0x314cd5?.['status']});}async[a0_0x50df69(0x163)](){const _0x1576f9=a0_0x50df69;let _0x4192de=encodeURIComponent(this[_0x1576f9(0x1c1)]),_0x1688c3=this[_0x1576f9(0x1a3)]+_0x1576f9(0x17b)+_0x4192de,_0x567e55=this[_0x1576f9(0x194)];while(this[_0x1576f9(0x15f)]){try{this[_0x1576f9(0x1bc)]=new AbortController();let _0x1ff880={'Accept':'text/event-stream'};if(this[_0x1576f9(0x166)])_0x1ff880[_0x1576f9(0x179)]=_0x1576f9(0x173)+this[_0x1576f9(0x166)];let _0x42c074=await fetch(_0x1688c3,{'headers':_0x1ff880,'signal':this['sseAbort']['signal']});if(!_0x42c074['ok']||!_0x42c074[_0x1576f9(0x18b)]){this[_0x1576f9(0x1cd)](_0x1576f9(0x188)+_0x42c074[_0x1576f9(0x1ce)]),await this[_0x1576f9(0x17a)](_0x567e55),_0x567e55=Math[_0x1576f9(0x1be)](_0x567e55*1.5,0xea60);continue;}_0x567e55=this[_0x1576f9(0x194)];let _0xf34c41=_0x42c074['body'][_0x1576f9(0x16c)](),_0xa47661=new TextDecoder(),_0x367c07='';while(this['running']){let {done:_0x9b584e,value:_0x4aab12}=await _0xf34c41['read']();if(_0x9b584e)break;_0x367c07+=_0xa47661['decode'](_0x4aab12,{'stream':!0x0});let _0x33faf6=_0x367c07[_0x1576f9(0x1cf)]('\x0a');_0x367c07=_0x33faf6[_0x1576f9(0x171)]()||'';for(let _0x3ae793 of _0x33faf6){if(!_0x3ae793[_0x1576f9(0x1c6)](_0x1576f9(0x1c8)))continue;try{let _0x27fc14=JSON['parse'](_0x3ae793[_0x1576f9(0x1d3)](0x6));if(_0x27fc14[_0x1576f9(0x1a2)]===_0x1576f9(0x192)){this[_0x1576f9(0x1cd)](_0x1576f9(0x1af)),this['emit'](_0x1576f9(0x192));continue;}if(_0x27fc14['type']===_0x1576f9(0x18a)||_0x27fc14[_0x1576f9(0x1a2)]==='new_message'||_0x27fc14[_0x1576f9(0x1a2)]==='broadcast')await this[_0x1576f9(0x1b2)]();}catch{}}}}catch(_0x2d2c44){if(_0x2d2c44['name']==='AbortError')break;this['emit']('error',_0x2d2c44),this[_0x1576f9(0x1cd)]('SSE\x20error:\x20'+_0x2d2c44[_0x1576f9(0x19b)]);}if(this[_0x1576f9(0x15f)])this[_0x1576f9(0x184)](_0x1576f9(0x18c)),this['log'](_0x1576f9(0x1b3)+_0x567e55/0x3e8+_0x1576f9(0x197)),await this[_0x1576f9(0x17a)](_0x567e55),_0x567e55=Math[_0x1576f9(0x1be)](_0x567e55*1.5,0xea60);}}async[a0_0x50df69(0x1b2)](){const _0xdcacf9=a0_0x50df69;try{let _0x3b2f6a=(await this[_0xdcacf9(0x1c0)](_0xdcacf9(0x1a1),{'alias':this['alias'],'limit':0xa}))?.[_0xdcacf9(0x174)]||[];for(let _0x3eff35 of _0x3b2f6a)await this[_0xdcacf9(0x1c0)]('ack_inbox',{'alias':this['alias'],'message_id':_0x3eff35['id']}),this[_0xdcacf9(0x1cd)]('←\x20'+_0x3eff35['from_session']+':\x20'+_0x3eff35[_0xdcacf9(0x1bf)][_0xdcacf9(0x1d3)](0x0,0x3c)),this[_0xdcacf9(0x184)](_0xdcacf9(0x15e),_0x3eff35),this[_0xdcacf9(0x184)](_0xdcacf9(0x19b),_0x3eff35);}catch(_0x280555){this[_0xdcacf9(0x1cd)]('inbox\x20error:\x20'+_0x280555[_0xdcacf9(0x19b)]);}}['sleep'](_0x1c9c72){return new Promise(_0x5675d8=>setTimeout(_0x5675d8,_0x1c9c72));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x3c4af8=a0_0x3789;(function(_0x92be0b,_0x19026d){const _0x23474f=a0_0x3789,_0x4c8888=_0x92be0b();while(!![]){try{const _0x2d096e=parseInt(_0x23474f(0x211))/0x1*(-parseInt(_0x23474f(0x1fe))/0x2)+-parseInt(_0x23474f(0x254))/0x3+-parseInt(_0x23474f(0x224))/0x4+parseInt(_0x23474f(0x1d5))/0x5+-parseInt(_0x23474f(0x230))/0x6+parseInt(_0x23474f(0x246))/0x7*(parseInt(_0x23474f(0x1db))/0x8)+parseInt(_0x23474f(0x252))/0x9;if(_0x2d096e===_0x19026d)break;else _0x4c8888['push'](_0x4c8888['shift']());}catch(_0x2048a9){_0x4c8888['push'](_0x4c8888['shift']());}}}(a0_0x2087,0xe4a2b));import{EventEmitter as a0_0x12baea}from'events';import{hostname as a0_0x57a71c}from'os';function a0_0x3789(_0x50668f,_0x1a1335){_0x50668f=_0x50668f-0x1d3;const _0x2087c7=a0_0x2087();let _0x378978=_0x2087c7[_0x50668f];return _0x378978;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x195155,_0x40650f)=>(_0x195155??_0x40650f)[a0_0x3c4af8(0x1e6)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x3c4af8(0x213)](0x0,0xf0);function N(_0x157e02){const _0x47ee24=a0_0x3c4af8;return(_0x157e02 instanceof Error?_0x157e02[_0x47ee24(0x1e2)]:String(_0x157e02??'unknown\x20error'))[_0x47ee24(0x1e6)](K,_0x47ee24(0x1e5))[_0x47ee24(0x1e6)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x451712,_0x526cfc=process.env.ANET_TASK_TRACE_FORMAT===a0_0x3c4af8(0x1d9)){const _0x3adcd8=a0_0x3c4af8;if(_0x526cfc)return JSON[_0x3adcd8(0x235)](_0x451712);let _0x1d3e1a=L(_0x451712[_0x3adcd8(0x201)],_0x3adcd8(0x240)),_0x448630=L(_0x451712['task_id'],_0x3adcd8(0x239)),_0x389b5c=_0x451712[_0x3adcd8(0x1f1)]?_0x3adcd8(0x24c)+_0x451712['error_code']+':'+(_0x451712[_0x3adcd8(0x1f3)]??''):'';return _0x3adcd8(0x1d8)+_0x451712[_0x3adcd8(0x256)]+_0x3adcd8(0x1ee)+L(_0x451712[_0x3adcd8(0x242)],_0x3adcd8(0x1fa))+_0x3adcd8(0x206)+L(_0x451712[_0x3adcd8(0x1f9)],_0x3adcd8(0x1fa))+_0x3adcd8(0x212)+_0x448630+'\x20parent_task_id='+_0x1d3e1a+'\x20network_id='+L(_0x451712['network_id'],_0x3adcd8(0x1fa))+_0x3adcd8(0x1d6)+_0x451712['transport']+_0x3adcd8(0x1f2)+_0x451712['duration_ms']+_0x3adcd8(0x23a)+_0x451712[_0x3adcd8(0x236)]+_0x389b5c;}function U(_0x34f605){const _0x208f82=a0_0x3c4af8;return{'event':{'sending':_0x208f82(0x223),'delivered':_0x208f82(0x1d4),'failed':_0x208f82(0x24e),'acked':_0x208f82(0x229),'started':_0x208f82(0x241),'replied':_0x208f82(0x245),'expired':_0x208f82(0x22a)}[_0x34f605[_0x208f82(0x256)]],..._0x34f605};}function j(_0x3a2dd4){const _0xd0d93e=a0_0x3c4af8;let _0x122059=_0x3a2dd4?.[_0xd0d93e(0x231)]||_0x3a2dd4?.[_0xd0d93e(0x22e)]||_0x3a2dd4?.['id'];if(_0x122059)return String(_0x122059);let _0x58280c=_0x3a2dd4?.['content']?.[0x0]?.[_0xd0d93e(0x21a)];if(typeof _0x58280c!==_0xd0d93e(0x249))return null;try{let _0x447d44=JSON['parse'](_0x58280c);return _0x447d44?.[_0xd0d93e(0x231)]||_0x447d44?.[_0xd0d93e(0x22e)]||_0x447d44?.['id']||null;}catch{return null;}}async function X(_0x34a2a2,_0x2bc429){const _0x284051=a0_0x3c4af8;let _0x4d7218=_0x2bc429['now']??Date['now'],_0xb3eac5=_0x4d7218(),_0x38197a=(_0x2775b7,_0x25b331,_0x14a6c4,_0x27c0cf)=>{const _0x2a13ff=a0_0x3789;_0x2bc429[_0x2a13ff(0x22d)](O(U({'from_alias':_0x34a2a2[_0x2a13ff(0x1f8)],'to_alias':_0x34a2a2[_0x2a13ff(0x1fc)],'task_id':_0x25b331,'parent_task_id':_0x34a2a2[_0x2a13ff(0x24d)],'network_id':_0x34a2a2[_0x2a13ff(0x244)],'transport':_0x34a2a2[_0x2a13ff(0x21e)],'status':_0x2775b7,'duration_ms':_0x4d7218()-_0xb3eac5,'lifecycle_tracking':_0x34a2a2[_0x2a13ff(0x227)],..._0x14a6c4!==void 0x0?{'error_code':_0x27c0cf||'send_failed','error_message':N(_0x14a6c4)}:{}})));};_0x38197a(_0x284051(0x1e9),null);try{let _0x23fc41=await _0x2bc429[_0x284051(0x23c)](),_0x753b0f=j(_0x23fc41);if(_0x753b0f)_0x38197a(_0x284051(0x243),_0x753b0f);else{if(_0x23fc41?.['ok']===!0x1||_0x23fc41?.[_0x284051(0x1e3)])_0x38197a(_0x284051(0x1ec),_0x753b0f,_0x23fc41?.[_0x284051(0x1e3)]||_0x284051(0x1dd),_0x284051(0x208));else _0x38197a(_0x284051(0x1ec),null,_0x284051(0x210),'missing_task_id');}return _0x23fc41;}catch(_0x31595c){throw _0x38197a('failed',null,_0x31595c,'send_failed'),_0x31595c;}}async function Y(_0x5c5059,_0x22be45){const _0x50abcc=a0_0x3c4af8;return X({'fromAlias':_0x5c5059[_0x50abcc(0x1f8)],'toAlias':_0x5c5059[_0x50abcc(0x22f)],'parentTaskId':_0x5c5059['parentTaskId']||null,'networkId':_0x5c5059['networkId']||null,'transport':_0x50abcc(0x20c),'lifecycleTracking':_0x50abcc(0x1d7)},_0x22be45);}class $ extends a0_0x12baea{[a0_0x3c4af8(0x1ff)];[a0_0x3c4af8(0x22f)];[a0_0x3c4af8(0x207)];[a0_0x3c4af8(0x203)];[a0_0x3c4af8(0x226)];[a0_0x3c4af8(0x247)];[a0_0x3c4af8(0x1df)];[a0_0x3c4af8(0x1f5)];['sseAbort'];[a0_0x3c4af8(0x215)]=!0x1;constructor(_0x562283){const _0x5aad4a=a0_0x3c4af8;super();if(this[_0x5aad4a(0x1ff)]=_0x562283[_0x5aad4a(0x1ff)]['replace'](/\/$/,''),this[_0x5aad4a(0x22f)]=_0x562283[_0x5aad4a(0x22f)],this[_0x5aad4a(0x207)]=_0x562283[_0x5aad4a(0x207)],this[_0x5aad4a(0x203)]=_0x562283[_0x5aad4a(0x203)]||_0x5aad4a(0x22c),this[_0x5aad4a(0x226)]=_0x5aad4a(0x1f7)+_0x562283[_0x5aad4a(0x22f)]+'-'+Date[_0x5aad4a(0x228)]()['toString'](0x24),this[_0x5aad4a(0x247)]=_0x562283[_0x5aad4a(0x247)]??0x2bf20,this[_0x5aad4a(0x1df)]=_0x562283[_0x5aad4a(0x1df)]??0xbb8,_0x562283[_0x5aad4a(0x200)]!==!0x1)this[_0x5aad4a(0x248)]();}[a0_0x3c4af8(0x22d)](_0xb58bae){const _0x1fffa9=a0_0x3c4af8;console[_0x1fffa9(0x22d)]('['+new Date()[_0x1fffa9(0x20f)]()['slice'](0x0,0x8)+']\x20[commhub:'+this[_0x1fffa9(0x22f)]+']\x20'+_0xb58bae);}async[a0_0x3c4af8(0x1e8)](_0x2f916a,_0x1ff14b){const _0x1ffead=a0_0x3c4af8;let _0x3e2692={'Content-Type':_0x1ffead(0x234),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x3e2692[_0x1ffead(0x21b)]=_0x1ffead(0x217)+this[_0x1ffead(0x207)];let _0xe0aa51=await(await fetch(this['url']+_0x1ffead(0x1ea),{'method':_0x1ffead(0x1e4),'headers':_0x3e2692,'body':JSON[_0x1ffead(0x235)]({'jsonrpc':_0x1ffead(0x1fb),'id':Date['now'](),'method':_0x1ffead(0x23b),'params':{'name':_0x2f916a,'arguments':_0x1ff14b}})}))['text'](),_0x471cc2=_0xe0aa51[_0x1ffead(0x21f)](/data: (.+)/),_0x4f5520=_0x471cc2?JSON[_0x1ffead(0x221)](_0x471cc2[0x1]):JSON['parse'](_0xe0aa51),_0x18da20=_0x4f5520?.[_0x1ffead(0x1ef)]?.[_0x1ffead(0x1f0)]?.[0x0]?.[_0x1ffead(0x21a)];return _0x18da20?JSON[_0x1ffead(0x221)](_0x18da20):_0x4f5520;}async[a0_0x3c4af8(0x248)](){const _0x256be5=a0_0x3c4af8;if(this[_0x256be5(0x215)])return;this['running']=!0x0,await this[_0x256be5(0x256)](_0x256be5(0x204)),this[_0x256be5(0x22d)](_0x256be5(0x237)),this[_0x256be5(0x1f5)]=setInterval(()=>{const _0xbf5778=_0x256be5;this[_0xbf5778(0x256)](_0xbf5778(0x204))['catch'](_0x5a44f1=>this['log'](_0xbf5778(0x209)+_0x5a44f1[_0xbf5778(0x1e2)]));},this[_0x256be5(0x247)]),this[_0x256be5(0x23f)]();}async[a0_0x3c4af8(0x255)](){const _0x3d17df=a0_0x3c4af8;if(this[_0x3d17df(0x215)]=!0x1,this[_0x3d17df(0x23d)]?.['abort'](),this['heartbeatTimer'])clearInterval(this[_0x3d17df(0x1f5)]);await this[_0x3d17df(0x256)](_0x3d17df(0x1de))[_0x3d17df(0x216)](()=>{}),this['log'](_0x3d17df(0x205));}async[a0_0x3c4af8(0x23c)](_0x1972cd,_0x167bbf,_0x5800d7=a0_0x3c4af8(0x20d)){const _0x4c0bb7=a0_0x3c4af8;return Y({'alias':_0x1972cd,'fromAlias':this[_0x4c0bb7(0x22f)]},{'log':_0x2bb9f7=>console[_0x4c0bb7(0x22d)](_0x2bb9f7),'send':()=>this[_0x4c0bb7(0x1e8)]('send_task',{'alias':_0x1972cd,'task':_0x167bbf,'priority':_0x5800d7,'from_session':this[_0x4c0bb7(0x22f)]})});}async['message'](_0x156aaa,_0x2260cf){const _0x371a2f=a0_0x3c4af8;return this['call'](_0x371a2f(0x1d3),{'alias':_0x156aaa,'message':_0x2260cf,'from_session':this[_0x371a2f(0x22f)]});}async['reply'](_0x49bfdc,_0x1fe905,_0x37f5de=a0_0x3c4af8(0x1e1)){const _0x291378=a0_0x3c4af8;return this[_0x291378(0x1e8)](_0x291378(0x214),{'in_reply_to':_0x49bfdc,'text':_0x1fe905,'status':_0x37f5de});}async[a0_0x3c4af8(0x256)](_0x5aa81f,_0x2ce057){const _0x2d1ebe=a0_0x3c4af8;return this[_0x2d1ebe(0x1e8)]('report_status',{'resume_id':this[_0x2d1ebe(0x226)],'alias':this[_0x2d1ebe(0x22f)],'status':_0x5aa81f,'server':a0_0x57a71c(),'hostname':a0_0x57a71c(),'agent':this[_0x2d1ebe(0x203)],'project_dir':process[_0x2d1ebe(0x22b)](),..._0x2ce057});}async[a0_0x3c4af8(0x1da)](){const _0x277e2e=a0_0x3c4af8;return this['call'](_0x277e2e(0x1eb),{});}async['broadcast'](_0x224fd6,_0x289481){const _0x1f1f48=a0_0x3c4af8;return this[_0x1f1f48(0x1e8)]('broadcast',{'message':_0x224fd6,'filter_server':_0x289481?.[_0x1f1f48(0x20e)],'filter_status':_0x289481?.[_0x1f1f48(0x256)]});}async['connectSSE'](){const _0x23030b=a0_0x3c4af8;let _0x2c5ea5=encodeURIComponent(this[_0x23030b(0x22f)]),_0x3c26d3=this[_0x23030b(0x1ff)]+_0x23030b(0x1fd)+_0x2c5ea5,_0x2e1b98=this[_0x23030b(0x1df)];while(this[_0x23030b(0x215)]){try{this[_0x23030b(0x23d)]=new AbortController();let _0x42aa37={'Accept':_0x23030b(0x202)};if(this[_0x23030b(0x207)])_0x42aa37[_0x23030b(0x21b)]='Bearer\x20'+this[_0x23030b(0x207)];let _0x5eefd7=await fetch(_0x3c26d3,{'headers':_0x42aa37,'signal':this['sseAbort'][_0x23030b(0x1f4)]});if(!_0x5eefd7['ok']||!_0x5eefd7[_0x23030b(0x1f6)]){this[_0x23030b(0x22d)](_0x23030b(0x225)+_0x5eefd7[_0x23030b(0x256)]),await this[_0x23030b(0x251)](_0x2e1b98),_0x2e1b98=Math[_0x23030b(0x219)](_0x2e1b98*1.5,0xea60);continue;}_0x2e1b98=this[_0x23030b(0x1df)];let _0x59994d=_0x5eefd7[_0x23030b(0x1f6)]['getReader'](),_0x9f493c=new TextDecoder(),_0x50c522='';while(this[_0x23030b(0x215)]){let {done:_0x36e3d1,value:_0x495045}=await _0x59994d[_0x23030b(0x20a)]();if(_0x36e3d1)break;_0x50c522+=_0x9f493c[_0x23030b(0x222)](_0x495045,{'stream':!0x0});let _0x38099c=_0x50c522[_0x23030b(0x218)]('\x0a');_0x50c522=_0x38099c['pop']()||'';for(let _0x11fd4f of _0x38099c){if(!_0x11fd4f[_0x23030b(0x232)](_0x23030b(0x1dc)))continue;try{let _0x536992=JSON[_0x23030b(0x221)](_0x11fd4f[_0x23030b(0x213)](0x6));if(_0x536992[_0x23030b(0x23e)]===_0x23030b(0x21c)){this[_0x23030b(0x22d)](_0x23030b(0x24b)),this[_0x23030b(0x21d)](_0x23030b(0x21c));continue;}if(_0x536992[_0x23030b(0x23e)]===_0x23030b(0x1e0)||_0x536992[_0x23030b(0x23e)]===_0x23030b(0x250)||_0x536992[_0x23030b(0x23e)]===_0x23030b(0x24a))await this[_0x23030b(0x20b)]();}catch{}}}}catch(_0x6475e2){if(_0x6475e2['name']==='AbortError')break;this[_0x23030b(0x21d)](_0x23030b(0x1e3),_0x6475e2),this[_0x23030b(0x22d)](_0x23030b(0x1ed)+_0x6475e2[_0x23030b(0x1e2)]);}if(this[_0x23030b(0x215)])this[_0x23030b(0x21d)](_0x23030b(0x205)),this[_0x23030b(0x22d)](_0x23030b(0x1e7)+_0x2e1b98/0x3e8+_0x23030b(0x238)),await this[_0x23030b(0x251)](_0x2e1b98),_0x2e1b98=Math[_0x23030b(0x219)](_0x2e1b98*1.5,0xea60);}}async['processInbox'](){const _0x1a707f=a0_0x3c4af8;try{let _0x421ec8=(await this[_0x1a707f(0x1e8)](_0x1a707f(0x253),{'alias':this[_0x1a707f(0x22f)],'limit':0xa}))?.[_0x1a707f(0x220)]||[];for(let _0x526670 of _0x421ec8)await this[_0x1a707f(0x1e8)](_0x1a707f(0x24f),{'alias':this[_0x1a707f(0x22f)],'message_id':_0x526670['id']}),this['log']('←\x20'+_0x526670['from_session']+':\x20'+_0x526670[_0x1a707f(0x1f0)][_0x1a707f(0x213)](0x0,0x3c)),this[_0x1a707f(0x21d)](_0x1a707f(0x233),_0x526670),this['emit']('message',_0x526670);}catch(_0x355b79){this['log']('inbox\x20error:\x20'+_0x355b79['message']);}}[a0_0x3c4af8(0x251)](_0x300b3f){return new Promise(_0x517085=>setTimeout(_0x517085,_0x300b3f));}}var F=$;export{F as default,$ as CommHub};function a0_0x2087(){const _0x23e6f0=['new_task','completed','message','error','POST','[REDACTED]','replace','SSE\x20reconnecting\x20in\x20','call','sending','/mcp','get_all_status','failed','SSE\x20error:\x20','\x20from=','result','content','error_code','\x20duration_ms=','error_message','signal','heartbeatTimer','body','sdk-','fromAlias','to_alias','<unknown>','2.0','toAlias','/events/','591574WuJWMi','url','autoConnect','parent_task_id','text/event-stream','agent','idle','disconnected','\x20to=','token','send_rejected','heartbeat\x20failed:\x20','read','processInbox','mcp_http','normal','server','toTimeString','CommHub\x20response\x20omitted\x20task_id','5QQqXAh','\x20task_id=','slice','send_reply','running','catch','Bearer\x20','split','min','text','Authorization','connected','emit','transport','match','messages','parse','decode','task.send.start','2489060akvgSU','SSE\x20failed:\x20','resumeId','lifecycleTracking','now','task.ack','task.expired','cwd','sdk','log','message_id','alias','3947994Htgohk','task_id','startsWith','task','application/json','stringify','lifecycle_tracking','registered','s...','<pending>','\x20lifecycle=','tools/call','send','sseAbort','type','connectSSE','<missing>','task.started','from_alias','delivered','networkId','task.replied','112623kLtdjV','heartbeatInterval','connect','string','broadcast','SSE\x20connected','\x20error=','parentTaskId','task.send.failed','ack_inbox','new_message','sleep','24972165lDjlyB','get_inbox','5509074UZoPmn','disconnect','status','send_message','task.send.delivered','7914330nqPSXV','\x20transport=','not_tracked','[commhub:task]\x20','json','getAllStatus','584yQqLhs','data:\x20','CommHub\x20rejected\x20task','offline','reconnectDelay'];a0_0x2087=function(){return _0x23e6f0;};return a0_0x2087();}
|
|
@@ -28,6 +28,9 @@ export interface ProcStat {
|
|
|
28
28
|
pgid: number;
|
|
29
29
|
starttime_jiffies: number;
|
|
30
30
|
ppid: number;
|
|
31
|
+
/** /proc/PID/stat 第 6 字段 session id。tmux 每个 pane 的 shell 是 session leader,pane 死后它的孤儿仍保留这个 sid ——
|
|
32
|
+
* 这是「进程属于本节点哪一段」最稳的证据(2026-09-14 事故:生产 hub 从 pm2 继承了 marker env,光看 env 会把 hub 当上一代杀掉)。 */
|
|
33
|
+
sid?: number;
|
|
31
34
|
}
|
|
32
35
|
/**
|
|
33
36
|
* Injectable primitive for /proc access. Real impl reads the filesystem;
|
|
@@ -255,6 +258,9 @@ export type ReapResult = {
|
|
|
255
258
|
};
|
|
256
259
|
export interface ReapOptions {
|
|
257
260
|
graceMs: number;
|
|
261
|
+
/** 本节点的 CODEX_HOME 真实路径。给了它,marker 命中的进程还要过一道「树成员」核验:sid/pgid 属于 marker 记录的三段 pane,
|
|
262
|
+
* 或其环境里 CODEX_HOME 就是这个目录;都不满足的是「外来携带者」(比如从共存 TUI 里重启过的 pm2 及其子进程),只报告、不杀、不算未回收。 */
|
|
263
|
+
nodeHome?: string;
|
|
258
264
|
logger: (msg: string) => void;
|
|
259
265
|
/**
|
|
260
266
|
* Sleep primitive (grace period). Real code uses setTimeout; tests inject
|
|
@@ -289,6 +295,14 @@ export interface ReapOptions {
|
|
|
289
295
|
* 7. Send SIGKILL to any group still alive.
|
|
290
296
|
* 8. Post-rescan: if any marker-carrying pid alive → preserve marker.
|
|
291
297
|
*/
|
|
298
|
+
/** 2026-09-14 事故的护栏:marker 命中 ≠ 本节点的进程。见 ReapOptions.nodeHome。 */
|
|
299
|
+
export declare function partitionMarkerHitsByTree(enumer: ProcessEnumerator, hits: number[], anchors: ScanAnchors | undefined, nodeHome: string | undefined): {
|
|
300
|
+
members: number[];
|
|
301
|
+
foreign: Array<{
|
|
302
|
+
pid: number;
|
|
303
|
+
reason: string;
|
|
304
|
+
}>;
|
|
305
|
+
};
|
|
292
306
|
export declare function reapMarkerGroups(enumer: ProcessEnumerator, killer: KillPrimitive, markerUuid: string, opts: ReapOptions): Promise<ReapResult>;
|
|
293
307
|
export interface PrepareStartDeps {
|
|
294
308
|
/** Usually () => readMarker(nodesDir, nodeId). */
|