@sleep2agi/agent-network 2.3.0-preview.152 → 2.3.0-preview.154

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.
@@ -16,6 +16,8 @@ export declare function errorText(x: unknown): string;
16
16
  * 直接 `${res.error}` 就是 `[object Object]`。
17
17
  */
18
18
  export declare function hubErrorText(res: unknown): string;
19
+ /** Doctor must not suggest retrying an implicit ownership claim. */
20
+ export declare function nodeTokenReissueError(res: unknown): string;
19
21
  export interface CliErrorReport {
20
22
  /** 第一行:出了什么事。 */
21
23
  summary: string;
@@ -1 +1 @@
1
- const a0_0x1f0cac=a0_0x3c99;function a0_0x13cd(){const _0x404dac=['POST','application/json,\x20text/event-stream','parent_task_id','\x20network_id=','[REDACTED]','2.0','token','task.send.delivered','170876MiqAts','new_task','send_rejected','delivered','/events/','missing_task_id','min','stringify','inbox\x20error:\x20','[commhub:task]\x20','sseAbort','catch','failed','task.send.failed','send_task','transport','SSE\x20failed:\x20','json','get_inbox','abort','processInbox','parse','send_failed','log','completed','SSE\x20connected','heartbeat\x20failed:\x20','from_alias','send','resumeId','autoConnect','connectSSE','3631404BWFSok','new_message','reconnectDelay','messages','1935qAfwZR','body','result','send_reply','\x20to=','mcp_http','startsWith','status','task_id','name','string','report_status','call','\x20error=','CommHub\x20response\x20omitted\x20task_id','running','task.replied','heartbeatInterval','slice','message','idle','\x20lifecycle=','67059NYAHrf','parentTaskId','send_message','18ERjHdH','\x20duration_ms=','lifecycleTracking','2724066emLAMC','cwd','normal','networkId','disconnect','message_id','error_code','fromAlias','task.send.start','decode','connected','\x20transport=','connect','\x20parent_task_id=','s...','ack_inbox','read','getReader','emit','sending','url','error_message','text/event-stream','to_alias','5ShmdTx','<unknown>','2416068ODqNiK','match','split','<pending>','error','not_tracked','broadcast','6476504MTbswA','sdk-','toAlias',']\x20[commhub:','get_all_status','heartbeatTimer','61190IHigsz','type','task.started','task.ack','72pQvZwu','disconnected','task.expired','replace','11LZwQSH','unknown\x20error','text','agent','AbortError','alias','server','application/json','content','signal','registered','now','sleep','getAllStatus','data:\x20','duration_ms','toString','reply'];a0_0x13cd=function(){return _0x404dac;};return a0_0x13cd();}(function(_0x1e45c3,_0x4c2317){const _0x22f6a8=a0_0x3c99,_0x447d43=_0x1e45c3();while(!![]){try{const _0xbe184b=-parseInt(_0x22f6a8(0x1f8))/0x1*(parseInt(_0x22f6a8(0x1fb))/0x2)+parseInt(_0x22f6a8(0x229))/0x3*(parseInt(_0x22f6a8(0x247))/0x4)+-parseInt(_0x22f6a8(0x216))/0x5*(-parseInt(_0x22f6a8(0x1fe))/0x6)+-parseInt(_0x22f6a8(0x267))/0x7+-parseInt(_0x22f6a8(0x21f))/0x8+parseInt(_0x22f6a8(0x1e2))/0x9*(parseInt(_0x22f6a8(0x225))/0xa)+-parseInt(_0x22f6a8(0x22d))/0xb*(parseInt(_0x22f6a8(0x218))/0xc);if(_0xbe184b===_0x4c2317)break;else _0x447d43['push'](_0x447d43['shift']());}catch(_0x3df5ac){_0x447d43['push'](_0x447d43['shift']());}}}(a0_0x13cd,0xa188f));import{EventEmitter as a0_0xb41e03}from'events';import{hostname as a0_0x11d39e}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x573804,_0x5d36ad)=>(_0x573804??_0x5d36ad)[a0_0x1f0cac(0x22c)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x384a5f){const _0x4c5e4b=a0_0x1f0cac;return(_0x384a5f instanceof Error?_0x384a5f[_0x4c5e4b(0x1f5)]:String(_0x384a5f??_0x4c5e4b(0x22e)))[_0x4c5e4b(0x22c)](K,_0x4c5e4b(0x243))['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x4c5e4b(0x1f4)](0x0,0xf0);}function O(_0x166466,_0x27d55c=process.env.ANET_TASK_TRACE_FORMAT===a0_0x1f0cac(0x258)){const _0x4a65d2=a0_0x1f0cac;if(_0x27d55c)return JSON['stringify'](_0x166466);let _0x5ea47d=L(_0x166466[_0x4a65d2(0x241)],'<missing>'),_0x12263c=L(_0x166466[_0x4a65d2(0x1ea)],_0x4a65d2(0x21b)),_0x357d02=_0x166466['error_code']?_0x4a65d2(0x1ef)+_0x166466[_0x4a65d2(0x204)]+':'+(_0x166466[_0x4a65d2(0x213)]??''):'';return _0x4a65d2(0x250)+_0x166466[_0x4a65d2(0x1e9)]+'\x20from='+L(_0x166466[_0x4a65d2(0x262)],'<unknown>')+_0x4a65d2(0x1e6)+L(_0x166466[_0x4a65d2(0x215)],'<unknown>')+'\x20task_id='+_0x12263c+_0x4a65d2(0x20b)+_0x5ea47d+_0x4a65d2(0x242)+L(_0x166466['network_id'],_0x4a65d2(0x217))+_0x4a65d2(0x209)+_0x166466[_0x4a65d2(0x256)]+_0x4a65d2(0x1fc)+_0x166466[_0x4a65d2(0x23c)]+_0x4a65d2(0x1f7)+_0x166466['lifecycle_tracking']+_0x357d02;}function U(_0xe49481){const _0x5f2d43=a0_0x1f0cac;return{'event':{'sending':_0x5f2d43(0x206),'delivered':_0x5f2d43(0x246),'failed':_0x5f2d43(0x254),'acked':_0x5f2d43(0x228),'started':_0x5f2d43(0x227),'replied':_0x5f2d43(0x1f2),'expired':_0x5f2d43(0x22b)}[_0xe49481['status']],..._0xe49481};}function j(_0x416e7b){const _0x3102c0=a0_0x1f0cac;let _0x3251a8=_0x416e7b?.[_0x3102c0(0x1ea)]||_0x416e7b?.['message_id']||_0x416e7b?.['id'];if(_0x3251a8)return String(_0x3251a8);let _0x4e4915=_0x416e7b?.['content']?.[0x0]?.[_0x3102c0(0x22f)];if(typeof _0x4e4915!==_0x3102c0(0x1ec))return null;try{let _0x138ac5=JSON[_0x3102c0(0x25c)](_0x4e4915);return _0x138ac5?.[_0x3102c0(0x1ea)]||_0x138ac5?.[_0x3102c0(0x203)]||_0x138ac5?.['id']||null;}catch{return null;}}async function X(_0xbbdb3d,_0x29b90b){const _0x5437f4=a0_0x1f0cac;let _0x2bbdb7=_0x29b90b[_0x5437f4(0x238)]??Date['now'],_0x57e3a1=_0x2bbdb7(),_0x3ac019=(_0x4a194d,_0x4277f2,_0x1f3491,_0x3555a3)=>{const _0x4ca29e=_0x5437f4;_0x29b90b[_0x4ca29e(0x25e)](O(U({'from_alias':_0xbbdb3d[_0x4ca29e(0x205)],'to_alias':_0xbbdb3d[_0x4ca29e(0x221)],'task_id':_0x4277f2,'parent_task_id':_0xbbdb3d['parentTaskId'],'network_id':_0xbbdb3d[_0x4ca29e(0x201)],'transport':_0xbbdb3d[_0x4ca29e(0x256)],'status':_0x4a194d,'duration_ms':_0x2bbdb7()-_0x57e3a1,'lifecycle_tracking':_0xbbdb3d[_0x4ca29e(0x1fd)],..._0x1f3491!==void 0x0?{'error_code':_0x3555a3||_0x4ca29e(0x25d),'error_message':N(_0x1f3491)}:{}})));};_0x3ac019(_0x5437f4(0x211),null);try{let _0x178cf4=await _0x29b90b[_0x5437f4(0x263)](),_0x30d92f=j(_0x178cf4);if(_0x30d92f)_0x3ac019(_0x5437f4(0x24a),_0x30d92f);else{if(_0x178cf4?.['ok']===!0x1||_0x178cf4?.[_0x5437f4(0x21c)])_0x3ac019('failed',_0x30d92f,_0x178cf4?.[_0x5437f4(0x21c)]||'CommHub\x20rejected\x20task',_0x5437f4(0x249));else _0x3ac019(_0x5437f4(0x253),null,_0x5437f4(0x1f0),_0x5437f4(0x24c));}return _0x178cf4;}catch(_0x4f1127){throw _0x3ac019(_0x5437f4(0x253),null,_0x4f1127,_0x5437f4(0x25d)),_0x4f1127;}}async function Y(_0x2d1972,_0x3da9e4){const _0x24f3fb=a0_0x1f0cac;return X({'fromAlias':_0x2d1972[_0x24f3fb(0x205)],'toAlias':_0x2d1972[_0x24f3fb(0x232)],'parentTaskId':_0x2d1972[_0x24f3fb(0x1f9)]||null,'networkId':_0x2d1972['networkId']||null,'transport':_0x24f3fb(0x1e7),'lifecycleTracking':_0x24f3fb(0x21d)},_0x3da9e4);}class $ extends a0_0xb41e03{['url'];[a0_0x1f0cac(0x232)];[a0_0x1f0cac(0x245)];[a0_0x1f0cac(0x230)];[a0_0x1f0cac(0x264)];[a0_0x1f0cac(0x1f3)];[a0_0x1f0cac(0x269)];[a0_0x1f0cac(0x224)];[a0_0x1f0cac(0x251)];[a0_0x1f0cac(0x1f1)]=!0x1;constructor(_0x27d40c){const _0x45801c=a0_0x1f0cac;super();if(this[_0x45801c(0x212)]=_0x27d40c[_0x45801c(0x212)][_0x45801c(0x22c)](/\/$/,''),this[_0x45801c(0x232)]=_0x27d40c['alias'],this[_0x45801c(0x245)]=_0x27d40c[_0x45801c(0x245)],this['agent']=_0x27d40c['agent']||'sdk',this[_0x45801c(0x264)]=_0x45801c(0x220)+_0x27d40c[_0x45801c(0x232)]+'-'+Date[_0x45801c(0x238)]()[_0x45801c(0x23d)](0x24),this['heartbeatInterval']=_0x27d40c[_0x45801c(0x1f3)]??0x2bf20,this['reconnectDelay']=_0x27d40c['reconnectDelay']??0xbb8,_0x27d40c[_0x45801c(0x265)]!==!0x1)this[_0x45801c(0x20a)]();}[a0_0x1f0cac(0x25e)](_0x585c4f){const _0x8de8be=a0_0x1f0cac;console['log']('['+new Date()['toTimeString']()[_0x8de8be(0x1f4)](0x0,0x8)+_0x8de8be(0x222)+this[_0x8de8be(0x232)]+']\x20'+_0x585c4f);}async[a0_0x1f0cac(0x1ee)](_0x5b38de,_0x3db108){const _0x5c4c31=a0_0x1f0cac;let _0x41d53a={'Content-Type':_0x5c4c31(0x234),'Accept':_0x5c4c31(0x240)};if(this['token'])_0x41d53a['Authorization']='Bearer\x20'+this[_0x5c4c31(0x245)];let _0x4ef12d=await(await fetch(this[_0x5c4c31(0x212)]+'/mcp',{'method':_0x5c4c31(0x23f),'headers':_0x41d53a,'body':JSON[_0x5c4c31(0x24e)]({'jsonrpc':_0x5c4c31(0x244),'id':Date['now'](),'method':'tools/call','params':{'name':_0x5b38de,'arguments':_0x3db108}})}))['text'](),_0x4adda6=_0x4ef12d[_0x5c4c31(0x219)](/data: (.+)/),_0x27c6a7=_0x4adda6?JSON[_0x5c4c31(0x25c)](_0x4adda6[0x1]):JSON['parse'](_0x4ef12d),_0x105270=_0x27c6a7?.[_0x5c4c31(0x1e4)]?.['content']?.[0x0]?.[_0x5c4c31(0x22f)];return _0x105270?JSON[_0x5c4c31(0x25c)](_0x105270):_0x27c6a7;}async['connect'](){const _0x1d4da2=a0_0x1f0cac;if(this[_0x1d4da2(0x1f1)])return;this[_0x1d4da2(0x1f1)]=!0x0,await this[_0x1d4da2(0x1e9)](_0x1d4da2(0x1f6)),this[_0x1d4da2(0x25e)](_0x1d4da2(0x237)),this[_0x1d4da2(0x224)]=setInterval(()=>{const _0x3b6961=_0x1d4da2;this[_0x3b6961(0x1e9)]('idle')[_0x3b6961(0x252)](_0x4e18a1=>this['log'](_0x3b6961(0x261)+_0x4e18a1[_0x3b6961(0x1f5)]));},this['heartbeatInterval']),this[_0x1d4da2(0x266)]();}async[a0_0x1f0cac(0x202)](){const _0xc9984b=a0_0x1f0cac;if(this[_0xc9984b(0x1f1)]=!0x1,this['sseAbort']?.[_0xc9984b(0x25a)](),this[_0xc9984b(0x224)])clearInterval(this[_0xc9984b(0x224)]);await this[_0xc9984b(0x1e9)]('offline')[_0xc9984b(0x252)](()=>{}),this['log'](_0xc9984b(0x22a));}async[a0_0x1f0cac(0x263)](_0x30aa9e,_0x424786,_0x2413ad=a0_0x1f0cac(0x200)){const _0xa27d90=a0_0x1f0cac;return Y({'alias':_0x30aa9e,'fromAlias':this[_0xa27d90(0x232)]},{'log':_0x5104aa=>console[_0xa27d90(0x25e)](_0x5104aa),'send':()=>this[_0xa27d90(0x1ee)](_0xa27d90(0x255),{'alias':_0x30aa9e,'task':_0x424786,'priority':_0x2413ad,'from_session':this['alias']})});}async[a0_0x1f0cac(0x1f5)](_0x3be848,_0x394481){const _0x4ec8af=a0_0x1f0cac;return this['call'](_0x4ec8af(0x1fa),{'alias':_0x3be848,'message':_0x394481,'from_session':this['alias']});}async[a0_0x1f0cac(0x23e)](_0x273410,_0x2b871b,_0xffc06f=a0_0x1f0cac(0x25f)){const _0x2680e7=a0_0x1f0cac;return this[_0x2680e7(0x1ee)](_0x2680e7(0x1e5),{'in_reply_to':_0x273410,'text':_0x2b871b,'status':_0xffc06f});}async[a0_0x1f0cac(0x1e9)](_0x90d4a2,_0x45f69f){const _0x117b8d=a0_0x1f0cac;return this['call'](_0x117b8d(0x1ed),{'resume_id':this[_0x117b8d(0x264)],'alias':this[_0x117b8d(0x232)],'status':_0x90d4a2,'server':a0_0x11d39e(),'hostname':a0_0x11d39e(),'agent':this[_0x117b8d(0x230)],'project_dir':process[_0x117b8d(0x1ff)](),..._0x45f69f});}async[a0_0x1f0cac(0x23a)](){const _0x4c6677=a0_0x1f0cac;return this['call'](_0x4c6677(0x223),{});}async[a0_0x1f0cac(0x21e)](_0x97696d,_0x4e1412){const _0x1d4c43=a0_0x1f0cac;return this[_0x1d4c43(0x1ee)](_0x1d4c43(0x21e),{'message':_0x97696d,'filter_server':_0x4e1412?.[_0x1d4c43(0x233)],'filter_status':_0x4e1412?.['status']});}async[a0_0x1f0cac(0x266)](){const _0x1f2977=a0_0x1f0cac;let _0x1a5896=encodeURIComponent(this['alias']),_0x3be288=this[_0x1f2977(0x212)]+_0x1f2977(0x24b)+_0x1a5896,_0x153705=this[_0x1f2977(0x269)];while(this[_0x1f2977(0x1f1)]){try{this[_0x1f2977(0x251)]=new AbortController();let _0x43737d={'Accept':_0x1f2977(0x214)};if(this[_0x1f2977(0x245)])_0x43737d['Authorization']='Bearer\x20'+this[_0x1f2977(0x245)];let _0x3dcb97=await fetch(_0x3be288,{'headers':_0x43737d,'signal':this['sseAbort'][_0x1f2977(0x236)]});if(!_0x3dcb97['ok']||!_0x3dcb97['body']){this[_0x1f2977(0x25e)](_0x1f2977(0x257)+_0x3dcb97[_0x1f2977(0x1e9)]),await this['sleep'](_0x153705),_0x153705=Math['min'](_0x153705*1.5,0xea60);continue;}_0x153705=this[_0x1f2977(0x269)];let _0x42e7a2=_0x3dcb97[_0x1f2977(0x1e3)][_0x1f2977(0x20f)](),_0xc53597=new TextDecoder(),_0x516a76='';while(this[_0x1f2977(0x1f1)]){let {done:_0x33d1d4,value:_0x13ca53}=await _0x42e7a2[_0x1f2977(0x20e)]();if(_0x33d1d4)break;_0x516a76+=_0xc53597[_0x1f2977(0x207)](_0x13ca53,{'stream':!0x0});let _0x4c15be=_0x516a76[_0x1f2977(0x21a)]('\x0a');_0x516a76=_0x4c15be['pop']()||'';for(let _0x107865 of _0x4c15be){if(!_0x107865[_0x1f2977(0x1e8)](_0x1f2977(0x23b)))continue;try{let _0x5f1e86=JSON[_0x1f2977(0x25c)](_0x107865[_0x1f2977(0x1f4)](0x6));if(_0x5f1e86[_0x1f2977(0x226)]===_0x1f2977(0x208)){this[_0x1f2977(0x25e)](_0x1f2977(0x260)),this[_0x1f2977(0x210)](_0x1f2977(0x208));continue;}if(_0x5f1e86[_0x1f2977(0x226)]===_0x1f2977(0x248)||_0x5f1e86[_0x1f2977(0x226)]===_0x1f2977(0x268)||_0x5f1e86[_0x1f2977(0x226)]===_0x1f2977(0x21e))await this['processInbox']();}catch{}}}}catch(_0x6c6e85){if(_0x6c6e85[_0x1f2977(0x1eb)]===_0x1f2977(0x231))break;this[_0x1f2977(0x210)](_0x1f2977(0x21c),_0x6c6e85),this[_0x1f2977(0x25e)]('SSE\x20error:\x20'+_0x6c6e85[_0x1f2977(0x1f5)]);}if(this[_0x1f2977(0x1f1)])this[_0x1f2977(0x210)]('disconnected'),this['log']('SSE\x20reconnecting\x20in\x20'+_0x153705/0x3e8+_0x1f2977(0x20c)),await this[_0x1f2977(0x239)](_0x153705),_0x153705=Math[_0x1f2977(0x24d)](_0x153705*1.5,0xea60);}}async[a0_0x1f0cac(0x25b)](){const _0x2d9aef=a0_0x1f0cac;try{let _0x765cc7=(await this[_0x2d9aef(0x1ee)](_0x2d9aef(0x259),{'alias':this[_0x2d9aef(0x232)],'limit':0xa}))?.[_0x2d9aef(0x1e1)]||[];for(let _0x1a2dbb of _0x765cc7)await this[_0x2d9aef(0x1ee)](_0x2d9aef(0x20d),{'alias':this[_0x2d9aef(0x232)],'message_id':_0x1a2dbb['id']}),this['log']('←\x20'+_0x1a2dbb['from_session']+':\x20'+_0x1a2dbb[_0x2d9aef(0x235)]['slice'](0x0,0x3c)),this[_0x2d9aef(0x210)]('task',_0x1a2dbb),this[_0x2d9aef(0x210)](_0x2d9aef(0x1f5),_0x1a2dbb);}catch(_0x5cdbf0){this['log'](_0x2d9aef(0x24f)+_0x5cdbf0[_0x2d9aef(0x1f5)]);}}[a0_0x1f0cac(0x239)](_0xe7b516){return new Promise(_0x272e5e=>setTimeout(_0x272e5e,_0xe7b516));}}var F=$;function a0_0x3c99(_0x22aa1b,_0x5f5ce6){_0x22aa1b=_0x22aa1b-0x1e1;const _0x13cd75=a0_0x13cd();let _0x3c996b=_0x13cd75[_0x22aa1b];return _0x3c996b;}export{F as default,$ as CommHub};
1
+ const a0_0x4f87e1=a0_0x3e7d;(function(_0x14fa06,_0x1a57d1){const _0x3a65fa=a0_0x3e7d,_0x3c65d4=_0x14fa06();while(!![]){try{const _0x252101=-parseInt(_0x3a65fa(0x12b))/0x1+-parseInt(_0x3a65fa(0x128))/0x2+parseInt(_0x3a65fa(0xdb))/0x3+-parseInt(_0x3a65fa(0x144))/0x4*(-parseInt(_0x3a65fa(0xf5))/0x5)+-parseInt(_0x3a65fa(0xee))/0x6+-parseInt(_0x3a65fa(0x102))/0x7*(parseInt(_0x3a65fa(0xf6))/0x8)+parseInt(_0x3a65fa(0xec))/0x9;if(_0x252101===_0x1a57d1)break;else _0x3c65d4['push'](_0x3c65d4['shift']());}catch(_0x5ea017){_0x3c65d4['push'](_0x3c65d4['shift']());}}}(a0_0x3c14,0xec19a));import{EventEmitter as a0_0x2b8e50}from'events';import{hostname as a0_0x239c8f}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2db46e,_0x299d7b)=>(_0x2db46e??_0x299d7b)[a0_0x4f87e1(0x132)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x4f87e1(0xdf)](0x0,0xf0);function N(_0x391dac){const _0x46ad77=a0_0x4f87e1;return(_0x391dac instanceof Error?_0x391dac[_0x46ad77(0x100)]:String(_0x391dac??_0x46ad77(0x151)))[_0x46ad77(0x132)](K,'[REDACTED]')['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0xd1a0f6,_0x2c8b93=process.env.ANET_TASK_TRACE_FORMAT===a0_0x4f87e1(0xe0)){const _0x82af2e=a0_0x4f87e1;if(_0x2c8b93)return JSON[_0x82af2e(0x118)](_0xd1a0f6);let _0x3680f5=L(_0xd1a0f6[_0x82af2e(0x11c)],_0x82af2e(0x153)),_0x4eb205=L(_0xd1a0f6['task_id'],_0x82af2e(0x15a)),_0x376246=_0xd1a0f6[_0x82af2e(0xea)]?_0x82af2e(0x12d)+_0xd1a0f6[_0x82af2e(0xea)]+':'+(_0xd1a0f6['error_message']??''):'';return'[commhub:task]\x20'+_0xd1a0f6[_0x82af2e(0xe4)]+_0x82af2e(0x13d)+L(_0xd1a0f6[_0x82af2e(0x117)],_0x82af2e(0x147))+_0x82af2e(0x121)+L(_0xd1a0f6[_0x82af2e(0x155)],_0x82af2e(0x147))+_0x82af2e(0x148)+_0x4eb205+'\x20parent_task_id='+_0x3680f5+_0x82af2e(0xe2)+L(_0xd1a0f6['network_id'],'<unknown>')+_0x82af2e(0x11e)+_0xd1a0f6[_0x82af2e(0x115)]+_0x82af2e(0xda)+_0xd1a0f6[_0x82af2e(0x123)]+_0x82af2e(0xf7)+_0xd1a0f6[_0x82af2e(0xf1)]+_0x376246;}function U(_0x4e2f64){const _0x1a697c=a0_0x4f87e1;return{'event':{'sending':_0x1a697c(0x116),'delivered':'task.send.delivered','failed':_0x1a697c(0x134),'acked':'task.ack','started':_0x1a697c(0x137),'replied':_0x1a697c(0x14f),'expired':_0x1a697c(0x12a)}[_0x4e2f64['status']],..._0x4e2f64};}function a0_0x3c14(){const _0x3770c2=['body','startsWith','1086508vupNGE','server','task.expired','1070856qQKPHX','running','\x20error=','sdk-','cwd','error','Authorization','replace','2.0','task.send.failed','getAllStatus',']\x20[commhub:','task.started','networkId','toString','heartbeatInterval','delivered','data:\x20','\x20from=','disconnect','lifecycleTracking','completed','sdk','resumeId','signal','43312RWaKCN','connect','parse','<unknown>','\x20task_id=','mcp_http','fromAlias','SSE\x20connected','toAlias','disconnected','registered','task.replied','min','unknown\x20error','name','<missing>','agent','to_alias','normal','/events/','token','SSE\x20error:\x20','<pending>','send_reply','\x20duration_ms=','2160741HnzPKs','inbox\x20error:\x20','send_task','alias','slice','json','type','\x20network_id=','emit','status','SSE\x20failed:\x20','get_all_status','decode','abort','new_task','error_code','reply','28531476JFsLMM','message_id','7515192sfOURv','processInbox','heartbeatTimer','lifecycle_tracking','toTimeString','AbortError','messages','355ysDLhv','8FRpSzB','\x20lifecycle=','parentTaskId','sleep','new_message','task_id','s...','send_failed','idle','CommHub\x20response\x20omitted\x20task_id','message','log','5778437CrtmMT','result','broadcast','CommHub\x20rejected\x20task','offline','content','failed','not_tracked','catch','send_rejected','url','now','getReader','Bearer\x20','POST','call','SSE\x20reconnecting\x20in\x20','connectSSE','reconnectDelay','transport','task.send.start','from_alias','stringify','/mcp','read','tools/call','parent_task_id','autoConnect','\x20transport=','connected','application/json','\x20to=','send','duration_ms','text','sseAbort'];a0_0x3c14=function(){return _0x3770c2;};return a0_0x3c14();}function a0_0x3e7d(_0x26a58d,_0x4aa013){_0x26a58d=_0x26a58d-0xd9;const _0x3c1414=a0_0x3c14();let _0x3e7da5=_0x3c1414[_0x26a58d];return _0x3e7da5;}function j(_0x318c90){const _0x3a5855=a0_0x4f87e1;let _0x5c144e=_0x318c90?.[_0x3a5855(0xfb)]||_0x318c90?.[_0x3a5855(0xed)]||_0x318c90?.['id'];if(_0x5c144e)return String(_0x5c144e);let _0x8fce69=_0x318c90?.[_0x3a5855(0x107)]?.[0x0]?.['text'];if(typeof _0x8fce69!=='string')return null;try{let _0x370ef8=JSON[_0x3a5855(0x146)](_0x8fce69);return _0x370ef8?.['task_id']||_0x370ef8?.[_0x3a5855(0xed)]||_0x370ef8?.['id']||null;}catch{return null;}}async function X(_0x2e8c70,_0x2dc5c6){const _0x9fe68e=a0_0x4f87e1;let _0x1a0fd6=_0x2dc5c6[_0x9fe68e(0x10d)]??Date[_0x9fe68e(0x10d)],_0x54e9ee=_0x1a0fd6(),_0x22e5b2=(_0x367a48,_0x478402,_0x3c0a24,_0x54ea49)=>{const _0x13a7ae=_0x9fe68e;_0x2dc5c6[_0x13a7ae(0x101)](O(U({'from_alias':_0x2e8c70[_0x13a7ae(0x14a)],'to_alias':_0x2e8c70[_0x13a7ae(0x14c)],'task_id':_0x478402,'parent_task_id':_0x2e8c70[_0x13a7ae(0xf8)],'network_id':_0x2e8c70[_0x13a7ae(0x138)],'transport':_0x2e8c70[_0x13a7ae(0x115)],'status':_0x367a48,'duration_ms':_0x1a0fd6()-_0x54e9ee,'lifecycle_tracking':_0x2e8c70[_0x13a7ae(0x13f)],..._0x3c0a24!==void 0x0?{'error_code':_0x54ea49||'send_failed','error_message':N(_0x3c0a24)}:{}})));};_0x22e5b2('sending',null);try{let _0x50d573=await _0x2dc5c6['send'](),_0x2e2b09=j(_0x50d573);if(_0x2e2b09)_0x22e5b2(_0x9fe68e(0x13b),_0x2e2b09);else{if(_0x50d573?.['ok']===!0x1||_0x50d573?.[_0x9fe68e(0x130)])_0x22e5b2(_0x9fe68e(0x108),_0x2e2b09,_0x50d573?.[_0x9fe68e(0x130)]||_0x9fe68e(0x105),_0x9fe68e(0x10b));else _0x22e5b2(_0x9fe68e(0x108),null,_0x9fe68e(0xff),'missing_task_id');}return _0x50d573;}catch(_0x5a31c3){throw _0x22e5b2(_0x9fe68e(0x108),null,_0x5a31c3,_0x9fe68e(0xfd)),_0x5a31c3;}}async function Y(_0x5d9fce,_0x48c8b2){const _0xee0f57=a0_0x4f87e1;return X({'fromAlias':_0x5d9fce['fromAlias'],'toAlias':_0x5d9fce[_0xee0f57(0xde)],'parentTaskId':_0x5d9fce[_0xee0f57(0xf8)]||null,'networkId':_0x5d9fce[_0xee0f57(0x138)]||null,'transport':_0xee0f57(0x149),'lifecycleTracking':_0xee0f57(0x109)},_0x48c8b2);}class $ extends a0_0x2b8e50{[a0_0x4f87e1(0x10c)];[a0_0x4f87e1(0xde)];[a0_0x4f87e1(0x158)];[a0_0x4f87e1(0x154)];['resumeId'];[a0_0x4f87e1(0x13a)];['reconnectDelay'];['heartbeatTimer'];[a0_0x4f87e1(0x125)];[a0_0x4f87e1(0x12c)]=!0x1;constructor(_0xce7027){const _0x14fe42=a0_0x4f87e1;super();if(this[_0x14fe42(0x10c)]=_0xce7027[_0x14fe42(0x10c)][_0x14fe42(0x132)](/\/$/,''),this[_0x14fe42(0xde)]=_0xce7027[_0x14fe42(0xde)],this[_0x14fe42(0x158)]=_0xce7027[_0x14fe42(0x158)],this['agent']=_0xce7027[_0x14fe42(0x154)]||_0x14fe42(0x141),this[_0x14fe42(0x142)]=_0x14fe42(0x12e)+_0xce7027['alias']+'-'+Date[_0x14fe42(0x10d)]()[_0x14fe42(0x139)](0x24),this['heartbeatInterval']=_0xce7027[_0x14fe42(0x13a)]??0x2bf20,this[_0x14fe42(0x114)]=_0xce7027['reconnectDelay']??0xbb8,_0xce7027[_0x14fe42(0x11d)]!==!0x1)this[_0x14fe42(0x145)]();}[a0_0x4f87e1(0x101)](_0x212f71){const _0x19554b=a0_0x4f87e1;console[_0x19554b(0x101)]('['+new Date()[_0x19554b(0xf2)]()['slice'](0x0,0x8)+_0x19554b(0x136)+this['alias']+']\x20'+_0x212f71);}async['call'](_0x3b0a7a,_0xad26c9){const _0x325335=a0_0x4f87e1;let _0x2a0109={'Content-Type':_0x325335(0x120),'Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x2a0109[_0x325335(0x131)]='Bearer\x20'+this[_0x325335(0x158)];let _0x28239d=await(await fetch(this['url']+_0x325335(0x119),{'method':_0x325335(0x110),'headers':_0x2a0109,'body':JSON[_0x325335(0x118)]({'jsonrpc':_0x325335(0x133),'id':Date[_0x325335(0x10d)](),'method':_0x325335(0x11b),'params':{'name':_0x3b0a7a,'arguments':_0xad26c9}})}))[_0x325335(0x124)](),_0xf728b=_0x28239d['match'](/data: (.+)/),_0x2c1d7c=_0xf728b?JSON[_0x325335(0x146)](_0xf728b[0x1]):JSON[_0x325335(0x146)](_0x28239d),_0x317416=_0x2c1d7c?.[_0x325335(0x103)]?.[_0x325335(0x107)]?.[0x0]?.[_0x325335(0x124)];return _0x317416?JSON[_0x325335(0x146)](_0x317416):_0x2c1d7c;}async['connect'](){const _0x34d026=a0_0x4f87e1;if(this['running'])return;this[_0x34d026(0x12c)]=!0x0,await this[_0x34d026(0xe4)](_0x34d026(0xfe)),this['log'](_0x34d026(0x14e)),this[_0x34d026(0xf0)]=setInterval(()=>{const _0x2e5faa=_0x34d026;this[_0x2e5faa(0xe4)](_0x2e5faa(0xfe))[_0x2e5faa(0x10a)](_0x5a25b1=>this[_0x2e5faa(0x101)]('heartbeat\x20failed:\x20'+_0x5a25b1[_0x2e5faa(0x100)]));},this[_0x34d026(0x13a)]),this[_0x34d026(0x113)]();}async[a0_0x4f87e1(0x13e)](){const _0x33a1c9=a0_0x4f87e1;if(this[_0x33a1c9(0x12c)]=!0x1,this[_0x33a1c9(0x125)]?.[_0x33a1c9(0xe8)](),this[_0x33a1c9(0xf0)])clearInterval(this[_0x33a1c9(0xf0)]);await this['status'](_0x33a1c9(0x106))[_0x33a1c9(0x10a)](()=>{}),this[_0x33a1c9(0x101)](_0x33a1c9(0x14d));}async[a0_0x4f87e1(0x122)](_0x13ec63,_0x587ca4,_0x133e22=a0_0x4f87e1(0x156)){const _0x238d15=a0_0x4f87e1;return Y({'alias':_0x13ec63,'fromAlias':this['alias']},{'log':_0xef12ed=>console[_0x238d15(0x101)](_0xef12ed),'send':()=>this['call'](_0x238d15(0xdd),{'alias':_0x13ec63,'task':_0x587ca4,'priority':_0x133e22,'from_session':this[_0x238d15(0xde)]})});}async[a0_0x4f87e1(0x100)](_0x2615b1,_0x4a7adb){const _0x3877b9=a0_0x4f87e1;return this[_0x3877b9(0x111)]('send_message',{'alias':_0x2615b1,'message':_0x4a7adb,'from_session':this[_0x3877b9(0xde)]});}async[a0_0x4f87e1(0xeb)](_0x226f51,_0x414f28,_0x3bb4bf=a0_0x4f87e1(0x140)){const _0x534d42=a0_0x4f87e1;return this[_0x534d42(0x111)](_0x534d42(0xd9),{'in_reply_to':_0x226f51,'text':_0x414f28,'status':_0x3bb4bf});}async[a0_0x4f87e1(0xe4)](_0x6c1282,_0x7a9d55){const _0x4e4234=a0_0x4f87e1;return this[_0x4e4234(0x111)]('report_status',{'resume_id':this[_0x4e4234(0x142)],'alias':this[_0x4e4234(0xde)],'status':_0x6c1282,'server':a0_0x239c8f(),'hostname':a0_0x239c8f(),'agent':this[_0x4e4234(0x154)],'project_dir':process[_0x4e4234(0x12f)](),..._0x7a9d55});}async[a0_0x4f87e1(0x135)](){const _0x447707=a0_0x4f87e1;return this[_0x447707(0x111)](_0x447707(0xe6),{});}async[a0_0x4f87e1(0x104)](_0x3d5f35,_0x1084bf){const _0x5494b4=a0_0x4f87e1;return this[_0x5494b4(0x111)](_0x5494b4(0x104),{'message':_0x3d5f35,'filter_server':_0x1084bf?.[_0x5494b4(0x129)],'filter_status':_0x1084bf?.[_0x5494b4(0xe4)]});}async[a0_0x4f87e1(0x113)](){const _0x57fe66=a0_0x4f87e1;let _0x4b1cd5=encodeURIComponent(this[_0x57fe66(0xde)]),_0x349401=this['url']+_0x57fe66(0x157)+_0x4b1cd5,_0xe9deb5=this[_0x57fe66(0x114)];while(this[_0x57fe66(0x12c)]){try{this[_0x57fe66(0x125)]=new AbortController();let _0x39faa1={'Accept':'text/event-stream'};if(this[_0x57fe66(0x158)])_0x39faa1[_0x57fe66(0x131)]=_0x57fe66(0x10f)+this[_0x57fe66(0x158)];let _0x34308f=await fetch(_0x349401,{'headers':_0x39faa1,'signal':this[_0x57fe66(0x125)][_0x57fe66(0x143)]});if(!_0x34308f['ok']||!_0x34308f[_0x57fe66(0x126)]){this[_0x57fe66(0x101)](_0x57fe66(0xe5)+_0x34308f[_0x57fe66(0xe4)]),await this[_0x57fe66(0xf9)](_0xe9deb5),_0xe9deb5=Math[_0x57fe66(0x150)](_0xe9deb5*1.5,0xea60);continue;}_0xe9deb5=this[_0x57fe66(0x114)];let _0x11125b=_0x34308f[_0x57fe66(0x126)][_0x57fe66(0x10e)](),_0x5171d9=new TextDecoder(),_0x30eb51='';while(this[_0x57fe66(0x12c)]){let {done:_0x6c96f7,value:_0x17838d}=await _0x11125b[_0x57fe66(0x11a)]();if(_0x6c96f7)break;_0x30eb51+=_0x5171d9[_0x57fe66(0xe7)](_0x17838d,{'stream':!0x0});let _0xa865a3=_0x30eb51['split']('\x0a');_0x30eb51=_0xa865a3['pop']()||'';for(let _0x527887 of _0xa865a3){if(!_0x527887[_0x57fe66(0x127)](_0x57fe66(0x13c)))continue;try{let _0xcadac=JSON[_0x57fe66(0x146)](_0x527887[_0x57fe66(0xdf)](0x6));if(_0xcadac['type']===_0x57fe66(0x11f)){this[_0x57fe66(0x101)](_0x57fe66(0x14b)),this['emit'](_0x57fe66(0x11f));continue;}if(_0xcadac[_0x57fe66(0xe1)]===_0x57fe66(0xe9)||_0xcadac[_0x57fe66(0xe1)]===_0x57fe66(0xfa)||_0xcadac[_0x57fe66(0xe1)]==='broadcast')await this[_0x57fe66(0xef)]();}catch{}}}}catch(_0x434518){if(_0x434518[_0x57fe66(0x152)]===_0x57fe66(0xf3))break;this['emit'](_0x57fe66(0x130),_0x434518),this[_0x57fe66(0x101)](_0x57fe66(0x159)+_0x434518[_0x57fe66(0x100)]);}if(this[_0x57fe66(0x12c)])this[_0x57fe66(0xe3)]('disconnected'),this[_0x57fe66(0x101)](_0x57fe66(0x112)+_0xe9deb5/0x3e8+_0x57fe66(0xfc)),await this[_0x57fe66(0xf9)](_0xe9deb5),_0xe9deb5=Math[_0x57fe66(0x150)](_0xe9deb5*1.5,0xea60);}}async[a0_0x4f87e1(0xef)](){const _0x17d04e=a0_0x4f87e1;try{let _0x2b17b4=(await this['call']('get_inbox',{'alias':this['alias'],'limit':0xa}))?.[_0x17d04e(0xf4)]||[];for(let _0x51374f of _0x2b17b4)await this[_0x17d04e(0x111)]('ack_inbox',{'alias':this[_0x17d04e(0xde)],'message_id':_0x51374f['id']}),this['log']('←\x20'+_0x51374f['from_session']+':\x20'+_0x51374f[_0x17d04e(0x107)][_0x17d04e(0xdf)](0x0,0x3c)),this[_0x17d04e(0xe3)]('task',_0x51374f),this[_0x17d04e(0xe3)](_0x17d04e(0x100),_0x51374f);}catch(_0x4a20a0){this['log'](_0x17d04e(0xdc)+_0x4a20a0['message']);}}[a0_0x4f87e1(0xf9)](_0x24a743){return new Promise(_0x5c3fff=>setTimeout(_0x5c3fff,_0x24a743));}}var F=$;export{F as default,$ as CommHub};
@@ -1,6 +1,4 @@
1
1
  export declare const EXTERNAL_APPSERVER_LAYOUT = "external-appserver";
2
- /** Each node (app-server + TUI) measured at 1.5–2 GB; refuse below two nodes' worth. */
3
- export declare const MIN_MEM_AVAILABLE_BYTES: number;
4
2
  export declare const READYZ_TIMEOUT_MS = 30000;
5
3
  export interface ExternalAppserverProfile {
6
4
  runtime?: string;
@@ -69,11 +67,6 @@ export declare function exactSessionRows(rows: readonly {
69
67
  id: string;
70
68
  name: string;
71
69
  }[];
72
- export declare function parseMemAvailableBytes(meminfo: string): number | null;
73
- export declare function memoryVerdict(availableBytes: number | null, force: boolean): {
74
- ok: boolean;
75
- message: string;
76
- };
77
70
  /**
78
71
  * Read the node token from config.json INSIDE the session shell, into the env.
79
72
  * The value never appears in tmux's argv, the pane's start command, or any
@@ -89,6 +82,15 @@ export declare function bridgeShellCommand(plan: ExternalAppserverPlan, launch:
89
82
  export declare function bridgeLogPath(plan: {
90
83
  nodeDir: string;
91
84
  }): string;
85
+ /**
86
+ * tmux `-c` for the product-started bridge (`anet node start` and
87
+ * `restart --bridge-only`). The node directory arrives as `--config` and
88
+ * `--log-dir`; agent-node derives NODE_DIR from that absolute config.
89
+ * Codex's app-server and TUI are separate sessions and pin the project
90
+ * with `-C` plus `CODEX_HOME`, so this directory is not their project.
91
+ * A hand-started agent-node never calls this and keeps the person's cwd.
92
+ */
93
+ export declare function externalAppserverBridgeCwd(plan: Pick<ExternalAppserverPlan, "workspaceDir" | "nodeDir">): string;
92
94
  export type ResumedVerdict = {
93
95
  state: "match";
94
96
  seen: string;