@sleep2agi/agent-network 2.3.0-preview.128 → 2.3.0-preview.129

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.
@@ -0,0 +1,47 @@
1
+ export type RevokeOutcome =
2
+ /** 服务端已撤销 */
3
+ {
4
+ kind: "revoked";
5
+ tokenId: string;
6
+ }
7
+ /** Hub 回 401:这个 token 在服务端本来就无效了(过期/已撤/改过密码),没东西可撤 */
8
+ | {
9
+ kind: "already_invalid";
10
+ }
11
+ /** 不是登录会话(显式 API 令牌 / 节点令牌):按设计不撤,仍有效 */
12
+ | {
13
+ kind: "not_a_session";
14
+ tokenId?: string;
15
+ }
16
+ /** Hub 没有 /api/auth/sessions(早于 #2114 的旧版本 → 404) */
17
+ | {
18
+ kind: "unsupported";
19
+ status: number;
20
+ }
21
+ /** 连不上 Hub(DNS / 拒绝连接 / 超时) */
22
+ | {
23
+ kind: "unreachable";
24
+ error: string;
25
+ }
26
+ /** 其他意外响应 */
27
+ | {
28
+ kind: "failed";
29
+ status?: number;
30
+ error: string;
31
+ };
32
+ export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
33
+ export declare function normalizeHubUrl(url: string): string;
34
+ export declare function sameHub(a?: string | null, b?: string | null): boolean;
35
+ /** 本地登录态字段。hub 不在里面:退出登录不等于忘掉 Hub 地址。 */
36
+ export declare const LOCAL_CREDENTIAL_KEYS: readonly ["token", "user", "network_id", "network_name"];
37
+ export declare function clearLocalCredentials(gc: Record<string, any>): Record<string, any>;
38
+ /** 在 `hub` 上撤销 `token` 所代表的登录会话。只把 token 发给 `hub` 本身。 */
39
+ export declare function revokeCurrentLoginSession(hub: string, token: string, opts?: {
40
+ fetchImpl?: FetchLike;
41
+ timeoutMs?: number;
42
+ }): Promise<RevokeOutcome>;
43
+ /** 把撤销结果翻成给人看的行。`ok=false` 表示服务端令牌**仍然有效**,调用方按警告打印。 */
44
+ export declare function describeRevokeOutcome(o: RevokeOutcome, hub: string): {
45
+ ok: boolean;
46
+ lines: string[];
47
+ };
@@ -0,0 +1,11 @@
1
+ export declare const ANET_EXIT: {
2
+ readonly OK: 0;
3
+ readonly FAILURE: 1;
4
+ readonly USAGE: 2;
5
+ };
6
+ /** 命令打印了错误、不再继续 —— 记下失败码,让 main() 的终结器用它退出。 */
7
+ export declare function markFailed(): void;
8
+ /** 用法错误(缺参数 / 未知子命令 / 非法取值)。 */
9
+ export declare function markUsageError(): void;
10
+ /** main() 正常返回后的退出码:命令记下过的码,没记过就是 0。 */
11
+ export declare function finalExitCode(): number;
@@ -1 +1 @@
1
- const a0_0x4d923d=a0_0x246c;(function(_0x3f30f1,_0x1319e6){const _0x5d2b9f=a0_0x246c,_0x507146=_0x3f30f1();while(!![]){try{const _0x50408a=-parseInt(_0x5d2b9f(0x16a))/0x1+-parseInt(_0x5d2b9f(0x142))/0x2*(parseInt(_0x5d2b9f(0x164))/0x3)+parseInt(_0x5d2b9f(0x144))/0x4+-parseInt(_0x5d2b9f(0x111))/0x5*(-parseInt(_0x5d2b9f(0x15d))/0x6)+-parseInt(_0x5d2b9f(0x130))/0x7+-parseInt(_0x5d2b9f(0x13c))/0x8*(parseInt(_0x5d2b9f(0x174))/0x9)+-parseInt(_0x5d2b9f(0x158))/0xa*(-parseInt(_0x5d2b9f(0x105))/0xb);if(_0x50408a===_0x1319e6)break;else _0x507146['push'](_0x507146['shift']());}catch(_0x220aa0){_0x507146['push'](_0x507146['shift']());}}}(a0_0x45ff,0x1af1e));import{EventEmitter as a0_0x181c5d}from'events';import{hostname as a0_0x5e6f43}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x435ee7,_0x2e27b9)=>(_0x435ee7??_0x2e27b9)[a0_0x4d923d(0x123)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x46fdfc){const _0x2e0599=a0_0x4d923d;return(_0x46fdfc instanceof Error?_0x46fdfc[_0x2e0599(0x16b)]:String(_0x46fdfc??_0x2e0599(0x15b)))[_0x2e0599(0x123)](K,_0x2e0599(0x13d))[_0x2e0599(0x123)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2e0599(0x10c)](0x0,0xf0);}function a0_0x246c(_0xc5e41a,_0x1db933){_0xc5e41a=_0xc5e41a-0x100;const _0x45ff35=a0_0x45ff();let _0x246c4b=_0x45ff35[_0xc5e41a];return _0x246c4b;}function O(_0x316eb7,_0x249ae8=process.env.ANET_TASK_TRACE_FORMAT===a0_0x4d923d(0x11c)){const _0x401911=a0_0x4d923d;if(_0x249ae8)return JSON[_0x401911(0x160)](_0x316eb7);let _0x1a3ed4=L(_0x316eb7[_0x401911(0x11e)],_0x401911(0x177)),_0x3b5e3b=L(_0x316eb7[_0x401911(0x176)],_0x401911(0x117)),_0x478849=_0x316eb7[_0x401911(0x16f)]?_0x401911(0x167)+_0x316eb7[_0x401911(0x16f)]+':'+(_0x316eb7[_0x401911(0x171)]??''):'';return'[commhub:task]\x20'+_0x316eb7['status']+_0x401911(0x124)+L(_0x316eb7[_0x401911(0x13e)],'<unknown>')+_0x401911(0x106)+L(_0x316eb7['to_alias'],_0x401911(0x15f))+_0x401911(0x141)+_0x3b5e3b+_0x401911(0x146)+_0x1a3ed4+_0x401911(0x131)+L(_0x316eb7[_0x401911(0x12a)],_0x401911(0x15f))+_0x401911(0x12d)+_0x316eb7[_0x401911(0x163)]+'\x20duration_ms='+_0x316eb7[_0x401911(0x16c)]+_0x401911(0x10a)+_0x316eb7[_0x401911(0x157)]+_0x478849;}function a0_0x45ff(){const _0x10cbaa=['emit','call','SSE\x20error:\x20','lifecycle_tracking','10CgDSes','reconnectDelay','parse','unknown\x20error','application/json,\x20text/event-stream','20136WfoVWd','registered','<unknown>','stringify','getReader','catch','transport','246SpERGh','send_failed','sleep','\x20error=','ack_inbox','running','86775ojpBAN','message','duration_ms','/mcp','cwd','error_code','Bearer\x20','error_message','tools/call',']\x20[commhub:','1134CiJMpo','now','task_id','<missing>','result','CommHub\x20response\x20omitted\x20task_id','connect','parentTaskId','disconnect','get_all_status','read','SSE\x20connected','connectSSE','from_session','disconnected','text/event-stream','4610771GQCrvN','\x20to=','task.ack','min','match','\x20lifecycle=','data:\x20','slice','log','heartbeatInterval','send','fromAlias','50hsZTPA','task.send.start','error','missing_task_id','task.started','send_task','<pending>','networkId','completed','task.replied','send_reply','json','s...','parent_task_id','sseAbort','broadcast','failed','text','replace','\x20from=','report_status','normal','connected','idle','string','network_id','CommHub\x20rejected\x20task','delivered','\x20transport=','message_id','pop','1214374sjgTKY','\x20network_id=','mcp_http','server','content','processInbox','heartbeatTimer','sdk-','alias','sending','new_message','task.expired','7608OCcypW','[REDACTED]','from_alias','lifecycleTracking','toString','\x20task_id=','1514OORlCK','agent','399208VURyZY','Authorization','\x20parent_task_id=','body','get_inbox','SSE\x20failed:\x20','type','task.send.delivered','token','signal','task','url','status','decode','resumeId','task.send.failed'];a0_0x45ff=function(){return _0x10cbaa;};return a0_0x45ff();}function U(_0x1d9460){const _0x4bafc1=a0_0x4d923d;return{'event':{'sending':_0x4bafc1(0x112),'delivered':_0x4bafc1(0x14b),'failed':_0x4bafc1(0x153),'acked':_0x4bafc1(0x107),'started':_0x4bafc1(0x115),'replied':_0x4bafc1(0x11a),'expired':_0x4bafc1(0x13b)}[_0x1d9460['status']],..._0x1d9460};}function j(_0x252aac){const _0x5ada2c=a0_0x4d923d;let _0x4263cb=_0x252aac?.[_0x5ada2c(0x176)]||_0x252aac?.[_0x5ada2c(0x12e)]||_0x252aac?.['id'];if(_0x4263cb)return String(_0x4263cb);let _0x54295c=_0x252aac?.['content']?.[0x0]?.['text'];if(typeof _0x54295c!==_0x5ada2c(0x129))return null;try{let _0x5b974e=JSON['parse'](_0x54295c);return _0x5b974e?.[_0x5ada2c(0x176)]||_0x5b974e?.[_0x5ada2c(0x12e)]||_0x5b974e?.['id']||null;}catch{return null;}}async function X(_0x21e694,_0x373bb4){const _0x476c42=a0_0x4d923d;let _0x5a0cb8=_0x373bb4[_0x476c42(0x175)]??Date['now'],_0x442c3b=_0x5a0cb8(),_0x2f4862=(_0x1d687e,_0x2ab5d5,_0x458c7a,_0x258dba)=>{const _0x2b3e72=_0x476c42;_0x373bb4[_0x2b3e72(0x10d)](O(U({'from_alias':_0x21e694[_0x2b3e72(0x110)],'to_alias':_0x21e694['toAlias'],'task_id':_0x2ab5d5,'parent_task_id':_0x21e694[_0x2b3e72(0x17b)],'network_id':_0x21e694[_0x2b3e72(0x118)],'transport':_0x21e694[_0x2b3e72(0x163)],'status':_0x1d687e,'duration_ms':_0x5a0cb8()-_0x442c3b,'lifecycle_tracking':_0x21e694[_0x2b3e72(0x13f)],..._0x458c7a!==void 0x0?{'error_code':_0x258dba||_0x2b3e72(0x165),'error_message':N(_0x458c7a)}:{}})));};_0x2f4862(_0x476c42(0x139),null);try{let _0x1f545d=await _0x373bb4[_0x476c42(0x10f)](),_0xb05e83=j(_0x1f545d);if(_0xb05e83)_0x2f4862(_0x476c42(0x12c),_0xb05e83);else{if(_0x1f545d?.['ok']===!0x1||_0x1f545d?.[_0x476c42(0x113)])_0x2f4862('failed',_0xb05e83,_0x1f545d?.[_0x476c42(0x113)]||_0x476c42(0x12b),'send_rejected');else _0x2f4862(_0x476c42(0x121),null,_0x476c42(0x179),_0x476c42(0x114));}return _0x1f545d;}catch(_0x4a70f3){throw _0x2f4862(_0x476c42(0x121),null,_0x4a70f3,'send_failed'),_0x4a70f3;}}async function Y(_0x39812d,_0xd7f1af){const _0x4e25ea=a0_0x4d923d;return X({'fromAlias':_0x39812d[_0x4e25ea(0x110)],'toAlias':_0x39812d['alias'],'parentTaskId':_0x39812d['parentTaskId']||null,'networkId':_0x39812d[_0x4e25ea(0x118)]||null,'transport':_0x4e25ea(0x132),'lifecycleTracking':'not_tracked'},_0xd7f1af);}class $ extends a0_0x181c5d{[a0_0x4d923d(0x14f)];[a0_0x4d923d(0x138)];[a0_0x4d923d(0x14c)];[a0_0x4d923d(0x143)];[a0_0x4d923d(0x152)];[a0_0x4d923d(0x10e)];[a0_0x4d923d(0x159)];[a0_0x4d923d(0x136)];[a0_0x4d923d(0x11f)];['running']=!0x1;constructor(_0x575998){const _0x2f2e1d=a0_0x4d923d;super();if(this[_0x2f2e1d(0x14f)]=_0x575998[_0x2f2e1d(0x14f)]['replace'](/\/$/,''),this[_0x2f2e1d(0x138)]=_0x575998[_0x2f2e1d(0x138)],this[_0x2f2e1d(0x14c)]=_0x575998[_0x2f2e1d(0x14c)],this['agent']=_0x575998['agent']||'sdk',this[_0x2f2e1d(0x152)]=_0x2f2e1d(0x137)+_0x575998[_0x2f2e1d(0x138)]+'-'+Date[_0x2f2e1d(0x175)]()[_0x2f2e1d(0x140)](0x24),this[_0x2f2e1d(0x10e)]=_0x575998[_0x2f2e1d(0x10e)]??0x2bf20,this[_0x2f2e1d(0x159)]=_0x575998[_0x2f2e1d(0x159)]??0xbb8,_0x575998['autoConnect']!==!0x1)this[_0x2f2e1d(0x17a)]();}[a0_0x4d923d(0x10d)](_0x666dba){const _0x49648c=a0_0x4d923d;console[_0x49648c(0x10d)]('['+new Date()['toTimeString']()[_0x49648c(0x10c)](0x0,0x8)+_0x49648c(0x173)+this[_0x49648c(0x138)]+']\x20'+_0x666dba);}async[a0_0x4d923d(0x155)](_0x90acdb,_0x44a63a){const _0x30769a=a0_0x4d923d;let _0x4de6a5={'Content-Type':'application/json','Accept':_0x30769a(0x15c)};if(this[_0x30769a(0x14c)])_0x4de6a5[_0x30769a(0x145)]=_0x30769a(0x170)+this[_0x30769a(0x14c)];let _0x4d4bbb=await(await fetch(this['url']+_0x30769a(0x16d),{'method':'POST','headers':_0x4de6a5,'body':JSON[_0x30769a(0x160)]({'jsonrpc':'2.0','id':Date['now'](),'method':_0x30769a(0x172),'params':{'name':_0x90acdb,'arguments':_0x44a63a}})}))[_0x30769a(0x122)](),_0x95d3f4=_0x4d4bbb[_0x30769a(0x109)](/data: (.+)/),_0x51e80e=_0x95d3f4?JSON['parse'](_0x95d3f4[0x1]):JSON['parse'](_0x4d4bbb),_0x52d7e9=_0x51e80e?.[_0x30769a(0x178)]?.['content']?.[0x0]?.['text'];return _0x52d7e9?JSON[_0x30769a(0x15a)](_0x52d7e9):_0x51e80e;}async[a0_0x4d923d(0x17a)](){const _0x2bd646=a0_0x4d923d;if(this['running'])return;this['running']=!0x0,await this[_0x2bd646(0x150)](_0x2bd646(0x128)),this[_0x2bd646(0x10d)](_0x2bd646(0x15e)),this[_0x2bd646(0x136)]=setInterval(()=>{const _0x1acc16=_0x2bd646;this[_0x1acc16(0x150)](_0x1acc16(0x128))[_0x1acc16(0x162)](_0x53f144=>this[_0x1acc16(0x10d)]('heartbeat\x20failed:\x20'+_0x53f144[_0x1acc16(0x16b)]));},this['heartbeatInterval']),this[_0x2bd646(0x101)]();}async[a0_0x4d923d(0x17c)](){const _0x217aa8=a0_0x4d923d;if(this[_0x217aa8(0x169)]=!0x1,this['sseAbort']?.['abort'](),this['heartbeatTimer'])clearInterval(this['heartbeatTimer']);await this[_0x217aa8(0x150)]('offline')[_0x217aa8(0x162)](()=>{}),this[_0x217aa8(0x10d)](_0x217aa8(0x103));}async[a0_0x4d923d(0x10f)](_0x1fe87e,_0x71af51,_0x490b60=a0_0x4d923d(0x126)){const _0x382a34=a0_0x4d923d;return Y({'alias':_0x1fe87e,'fromAlias':this[_0x382a34(0x138)]},{'log':_0x5e8454=>console[_0x382a34(0x10d)](_0x5e8454),'send':()=>this['call'](_0x382a34(0x116),{'alias':_0x1fe87e,'task':_0x71af51,'priority':_0x490b60,'from_session':this[_0x382a34(0x138)]})});}async[a0_0x4d923d(0x16b)](_0x272507,_0x426cf2){const _0x33316e=a0_0x4d923d;return this[_0x33316e(0x155)]('send_message',{'alias':_0x272507,'message':_0x426cf2,'from_session':this[_0x33316e(0x138)]});}async['reply'](_0x5f11b6,_0xda7e32,_0x2b272c=a0_0x4d923d(0x119)){const _0x2840a1=a0_0x4d923d;return this[_0x2840a1(0x155)](_0x2840a1(0x11b),{'in_reply_to':_0x5f11b6,'text':_0xda7e32,'status':_0x2b272c});}async[a0_0x4d923d(0x150)](_0x238012,_0x3d98ce){const _0x4c762e=a0_0x4d923d;return this[_0x4c762e(0x155)](_0x4c762e(0x125),{'resume_id':this[_0x4c762e(0x152)],'alias':this[_0x4c762e(0x138)],'status':_0x238012,'server':a0_0x5e6f43(),'hostname':a0_0x5e6f43(),'agent':this[_0x4c762e(0x143)],'project_dir':process[_0x4c762e(0x16e)](),..._0x3d98ce});}async['getAllStatus'](){const _0x4fe525=a0_0x4d923d;return this[_0x4fe525(0x155)](_0x4fe525(0x17d),{});}async[a0_0x4d923d(0x120)](_0x10b13b,_0x4d3c87){const _0xafb106=a0_0x4d923d;return this[_0xafb106(0x155)](_0xafb106(0x120),{'message':_0x10b13b,'filter_server':_0x4d3c87?.[_0xafb106(0x133)],'filter_status':_0x4d3c87?.[_0xafb106(0x150)]});}async[a0_0x4d923d(0x101)](){const _0x1e65e2=a0_0x4d923d;let _0x16b6f8=encodeURIComponent(this[_0x1e65e2(0x138)]),_0x3bf5f1=this[_0x1e65e2(0x14f)]+'/events/'+_0x16b6f8,_0x101429=this[_0x1e65e2(0x159)];while(this[_0x1e65e2(0x169)]){try{this[_0x1e65e2(0x11f)]=new AbortController();let _0x4dc67d={'Accept':_0x1e65e2(0x104)};if(this[_0x1e65e2(0x14c)])_0x4dc67d[_0x1e65e2(0x145)]=_0x1e65e2(0x170)+this[_0x1e65e2(0x14c)];let _0x20cf33=await fetch(_0x3bf5f1,{'headers':_0x4dc67d,'signal':this[_0x1e65e2(0x11f)][_0x1e65e2(0x14d)]});if(!_0x20cf33['ok']||!_0x20cf33[_0x1e65e2(0x147)]){this[_0x1e65e2(0x10d)](_0x1e65e2(0x149)+_0x20cf33[_0x1e65e2(0x150)]),await this['sleep'](_0x101429),_0x101429=Math[_0x1e65e2(0x108)](_0x101429*1.5,0xea60);continue;}_0x101429=this[_0x1e65e2(0x159)];let _0x28bb6c=_0x20cf33[_0x1e65e2(0x147)][_0x1e65e2(0x161)](),_0x2d26ca=new TextDecoder(),_0x5c00aa='';while(this[_0x1e65e2(0x169)]){let {done:_0x248bc9,value:_0x5d61b5}=await _0x28bb6c[_0x1e65e2(0x17e)]();if(_0x248bc9)break;_0x5c00aa+=_0x2d26ca[_0x1e65e2(0x151)](_0x5d61b5,{'stream':!0x0});let _0x2246c8=_0x5c00aa['split']('\x0a');_0x5c00aa=_0x2246c8[_0x1e65e2(0x12f)]()||'';for(let _0x3d4c16 of _0x2246c8){if(!_0x3d4c16['startsWith'](_0x1e65e2(0x10b)))continue;try{let _0x18ce3d=JSON['parse'](_0x3d4c16[_0x1e65e2(0x10c)](0x6));if(_0x18ce3d[_0x1e65e2(0x14a)]===_0x1e65e2(0x127)){this['log'](_0x1e65e2(0x100)),this[_0x1e65e2(0x154)](_0x1e65e2(0x127));continue;}if(_0x18ce3d[_0x1e65e2(0x14a)]==='new_task'||_0x18ce3d[_0x1e65e2(0x14a)]===_0x1e65e2(0x13a)||_0x18ce3d[_0x1e65e2(0x14a)]===_0x1e65e2(0x120))await this['processInbox']();}catch{}}}}catch(_0x28fc97){if(_0x28fc97['name']==='AbortError')break;this['emit'](_0x1e65e2(0x113),_0x28fc97),this[_0x1e65e2(0x10d)](_0x1e65e2(0x156)+_0x28fc97[_0x1e65e2(0x16b)]);}if(this[_0x1e65e2(0x169)])this['emit'](_0x1e65e2(0x103)),this[_0x1e65e2(0x10d)]('SSE\x20reconnecting\x20in\x20'+_0x101429/0x3e8+_0x1e65e2(0x11d)),await this[_0x1e65e2(0x166)](_0x101429),_0x101429=Math[_0x1e65e2(0x108)](_0x101429*1.5,0xea60);}}async[a0_0x4d923d(0x135)](){const _0xfffd27=a0_0x4d923d;try{let _0x4285fd=(await this[_0xfffd27(0x155)](_0xfffd27(0x148),{'alias':this[_0xfffd27(0x138)],'limit':0xa}))?.['messages']||[];for(let _0xc76a8f of _0x4285fd)await this[_0xfffd27(0x155)](_0xfffd27(0x168),{'alias':this[_0xfffd27(0x138)],'message_id':_0xc76a8f['id']}),this['log']('←\x20'+_0xc76a8f[_0xfffd27(0x102)]+':\x20'+_0xc76a8f[_0xfffd27(0x134)][_0xfffd27(0x10c)](0x0,0x3c)),this[_0xfffd27(0x154)](_0xfffd27(0x14e),_0xc76a8f),this[_0xfffd27(0x154)](_0xfffd27(0x16b),_0xc76a8f);}catch(_0x41efe0){this[_0xfffd27(0x10d)]('inbox\x20error:\x20'+_0x41efe0[_0xfffd27(0x16b)]);}}[a0_0x4d923d(0x166)](_0x86f481){return new Promise(_0x2313fb=>setTimeout(_0x2313fb,_0x86f481));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x5d395c=a0_0x5553;(function(_0x2049ca,_0x45eabd){const _0x5edff4=a0_0x5553,_0x2471e0=_0x2049ca();while(!![]){try{const _0x18c5b8=-parseInt(_0x5edff4(0x1b0))/0x1+parseInt(_0x5edff4(0x169))/0x2+parseInt(_0x5edff4(0x199))/0x3*(-parseInt(_0x5edff4(0x1b2))/0x4)+-parseInt(_0x5edff4(0x1ab))/0x5+-parseInt(_0x5edff4(0x17b))/0x6+parseInt(_0x5edff4(0x1ba))/0x7*(parseInt(_0x5edff4(0x187))/0x8)+-parseInt(_0x5edff4(0x1b1))/0x9*(-parseInt(_0x5edff4(0x19e))/0xa);if(_0x18c5b8===_0x45eabd)break;else _0x2471e0['push'](_0x2471e0['shift']());}catch(_0x148236){_0x2471e0['push'](_0x2471e0['shift']());}}}(a0_0x38f4,0xe213f));import{EventEmitter as a0_0x196e24}from'events';import{hostname as a0_0x5b7e5c}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x54381c,_0x6b108)=>(_0x54381c??_0x6b108)[a0_0x5d395c(0x192)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x5d395c(0x18f)](0x0,0xf0);function N(_0x2204ec){const _0x1642f2=a0_0x5d395c;return(_0x2204ec instanceof Error?_0x2204ec['message']:String(_0x2204ec??_0x1642f2(0x1aa)))[_0x1642f2(0x192)](K,'[REDACTED]')[_0x1642f2(0x192)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x1642f2(0x18f)](0x0,0xf0);}function O(_0x21bbe4,_0x33c7b2=process.env.ANET_TASK_TRACE_FORMAT===a0_0x5d395c(0x196)){const _0x1a3ab8=a0_0x5d395c;if(_0x33c7b2)return JSON[_0x1a3ab8(0x195)](_0x21bbe4);let _0xc75d90=L(_0x21bbe4[_0x1a3ab8(0x1d8)],'<missing>'),_0x56665e=L(_0x21bbe4[_0x1a3ab8(0x1ce)],_0x1a3ab8(0x17e)),_0xf61e8d=_0x21bbe4['error_code']?_0x1a3ab8(0x185)+_0x21bbe4[_0x1a3ab8(0x18e)]+':'+(_0x21bbe4[_0x1a3ab8(0x1d9)]??''):'';return _0x1a3ab8(0x190)+_0x21bbe4[_0x1a3ab8(0x17d)]+_0x1a3ab8(0x179)+L(_0x21bbe4[_0x1a3ab8(0x16c)],'<unknown>')+_0x1a3ab8(0x1b3)+L(_0x21bbe4[_0x1a3ab8(0x163)],'<unknown>')+_0x1a3ab8(0x186)+_0x56665e+_0x1a3ab8(0x1df)+_0xc75d90+_0x1a3ab8(0x181)+L(_0x21bbe4[_0x1a3ab8(0x1cc)],_0x1a3ab8(0x1c3))+_0x1a3ab8(0x1cf)+_0x21bbe4[_0x1a3ab8(0x171)]+_0x1a3ab8(0x17c)+_0x21bbe4[_0x1a3ab8(0x1a4)]+'\x20lifecycle='+_0x21bbe4[_0x1a3ab8(0x176)]+_0xf61e8d;}function a0_0x5553(_0x28fb70,_0x5144cc){_0x28fb70=_0x28fb70-0x163;const _0x38f4d2=a0_0x38f4();let _0x55531b=_0x38f4d2[_0x28fb70];return _0x55531b;}function U(_0x1f7330){const _0x324411=a0_0x5d395c;return{'event':{'sending':_0x324411(0x174),'delivered':_0x324411(0x188),'failed':_0x324411(0x1da),'acked':'task.ack','started':_0x324411(0x18d),'replied':'task.replied','expired':_0x324411(0x1c2)}[_0x1f7330[_0x324411(0x17d)]],..._0x1f7330};}function j(_0x564ff4){const _0x5208d0=a0_0x5d395c;let _0x14e6f6=_0x564ff4?.[_0x5208d0(0x1ce)]||_0x564ff4?.[_0x5208d0(0x16a)]||_0x564ff4?.['id'];if(_0x14e6f6)return String(_0x14e6f6);let _0x304575=_0x564ff4?.['content']?.[0x0]?.[_0x5208d0(0x1e1)];if(typeof _0x304575!==_0x5208d0(0x1e3))return null;try{let _0x8ad82=JSON['parse'](_0x304575);return _0x8ad82?.[_0x5208d0(0x1ce)]||_0x8ad82?.[_0x5208d0(0x16a)]||_0x8ad82?.['id']||null;}catch{return null;}}function a0_0x38f4(){const _0x361af7=['parse','startsWith','heartbeatInterval','application/json','duration_ms','send','2.0','min','autoConnect','tools/call','unknown\x20error','3541230QDcQyA','resumeId','mcp_http','toString','running','974262jYDCvE','5382TjTgOX','4xlNYrn','\x20to=','content','emit','catch','alias','message','send_message','7pfAgSh','text/event-stream','sdk-','not_tracked','new_message','type','processInbox','heartbeatTimer','task.expired','<unknown>','SSE\x20reconnecting\x20in\x20','token','fromAlias','name','new_task','broadcast','CommHub\x20response\x20omitted\x20task_id','registered','network_id','networkId','task_id','\x20transport=','connectSSE','reply','url','lifecycleTracking','server','sleep','signal','normal','parent_task_id','error_message','task.send.failed','report_status','idle','decode','body','\x20parent_task_id=','pop','text','read','string','Authorization','match','to_alias','reconnectDelay','send_failed','offline','disconnect','sending','50194yPEaKY','message_id','POST','from_alias','log','SSE\x20error:\x20','AbortError','connected','transport','cwd','abort','task.send.start','data:\x20','lifecycle_tracking','call','application/json,\x20text/event-stream','\x20from=','agent','256128nShGLQ','\x20duration_ms=','status','<pending>','now','SSE\x20connected','\x20network_id=','getReader','heartbeat\x20failed:\x20','get_all_status','\x20error=','\x20task_id=','12239320xOiFiK','task.send.delivered','s...','parentTaskId','error','ack_inbox','task.started','error_code','slice','[commhub:task]\x20','disconnected','replace','SSE\x20failed:\x20','sseAbort','stringify','json','from_session','connect','4897425SLXthQ','/mcp','result','Bearer\x20','completed','45630EFmfdp','send_reply'];a0_0x38f4=function(){return _0x361af7;};return a0_0x38f4();}async function X(_0x227264,_0x542aa6){const _0x1104a9=a0_0x5d395c;let _0x33c353=_0x542aa6[_0x1104a9(0x17f)]??Date['now'],_0x44ce08=_0x33c353(),_0x3816d3=(_0xb09f31,_0x5d10bd,_0xdabd1a,_0x403648)=>{const _0xd96912=_0x1104a9;_0x542aa6[_0xd96912(0x16d)](O(U({'from_alias':_0x227264[_0xd96912(0x1c6)],'to_alias':_0x227264['toAlias'],'task_id':_0x5d10bd,'parent_task_id':_0x227264['parentTaskId'],'network_id':_0x227264[_0xd96912(0x1cd)],'transport':_0x227264[_0xd96912(0x171)],'status':_0xb09f31,'duration_ms':_0x33c353()-_0x44ce08,'lifecycle_tracking':_0x227264[_0xd96912(0x1d3)],..._0xdabd1a!==void 0x0?{'error_code':_0x403648||'send_failed','error_message':N(_0xdabd1a)}:{}})));};_0x3816d3(_0x1104a9(0x168),null);try{let _0x3d7961=await _0x542aa6[_0x1104a9(0x1a5)](),_0x5aa0a2=j(_0x3d7961);if(_0x5aa0a2)_0x3816d3('delivered',_0x5aa0a2);else{if(_0x3d7961?.['ok']===!0x1||_0x3d7961?.[_0x1104a9(0x18b)])_0x3816d3('failed',_0x5aa0a2,_0x3d7961?.[_0x1104a9(0x18b)]||'CommHub\x20rejected\x20task','send_rejected');else _0x3816d3('failed',null,_0x1104a9(0x1ca),'missing_task_id');}return _0x3d7961;}catch(_0x4b74a5){throw _0x3816d3('failed',null,_0x4b74a5,_0x1104a9(0x165)),_0x4b74a5;}}async function Y(_0x157924,_0x25771c){const _0x13f564=a0_0x5d395c;return X({'fromAlias':_0x157924['fromAlias'],'toAlias':_0x157924['alias'],'parentTaskId':_0x157924[_0x13f564(0x18a)]||null,'networkId':_0x157924[_0x13f564(0x1cd)]||null,'transport':_0x13f564(0x1ad),'lifecycleTracking':_0x13f564(0x1bd)},_0x25771c);}class $ extends a0_0x196e24{['url'];[a0_0x5d395c(0x1b7)];[a0_0x5d395c(0x1c5)];['agent'];[a0_0x5d395c(0x1ac)];[a0_0x5d395c(0x1a2)];[a0_0x5d395c(0x164)];[a0_0x5d395c(0x1c1)];[a0_0x5d395c(0x194)];[a0_0x5d395c(0x1af)]=!0x1;constructor(_0x5e6142){const _0xc215d=a0_0x5d395c;super();if(this['url']=_0x5e6142[_0xc215d(0x1d2)][_0xc215d(0x192)](/\/$/,''),this['alias']=_0x5e6142[_0xc215d(0x1b7)],this[_0xc215d(0x1c5)]=_0x5e6142[_0xc215d(0x1c5)],this[_0xc215d(0x17a)]=_0x5e6142[_0xc215d(0x17a)]||'sdk',this[_0xc215d(0x1ac)]=_0xc215d(0x1bc)+_0x5e6142['alias']+'-'+Date[_0xc215d(0x17f)]()[_0xc215d(0x1ae)](0x24),this['heartbeatInterval']=_0x5e6142[_0xc215d(0x1a2)]??0x2bf20,this['reconnectDelay']=_0x5e6142[_0xc215d(0x164)]??0xbb8,_0x5e6142[_0xc215d(0x1a8)]!==!0x1)this['connect']();}['log'](_0x1d34cb){const _0x45bdee=a0_0x5d395c;console[_0x45bdee(0x16d)]('['+new Date()['toTimeString']()[_0x45bdee(0x18f)](0x0,0x8)+']\x20[commhub:'+this[_0x45bdee(0x1b7)]+']\x20'+_0x1d34cb);}async[a0_0x5d395c(0x177)](_0x1a0154,_0x3b160d){const _0x4d2c71=a0_0x5d395c;let _0xf4fc88={'Content-Type':_0x4d2c71(0x1a3),'Accept':_0x4d2c71(0x178)};if(this[_0x4d2c71(0x1c5)])_0xf4fc88[_0x4d2c71(0x1e4)]=_0x4d2c71(0x19c)+this['token'];let _0x42ebbe=await(await fetch(this[_0x4d2c71(0x1d2)]+_0x4d2c71(0x19a),{'method':_0x4d2c71(0x16b),'headers':_0xf4fc88,'body':JSON[_0x4d2c71(0x195)]({'jsonrpc':_0x4d2c71(0x1a6),'id':Date[_0x4d2c71(0x17f)](),'method':_0x4d2c71(0x1a9),'params':{'name':_0x1a0154,'arguments':_0x3b160d}})}))[_0x4d2c71(0x1e1)](),_0x5caac1=_0x42ebbe[_0x4d2c71(0x1e5)](/data: (.+)/),_0x14b072=_0x5caac1?JSON[_0x4d2c71(0x1a0)](_0x5caac1[0x1]):JSON[_0x4d2c71(0x1a0)](_0x42ebbe),_0x3af791=_0x14b072?.[_0x4d2c71(0x19b)]?.[_0x4d2c71(0x1b4)]?.[0x0]?.['text'];return _0x3af791?JSON[_0x4d2c71(0x1a0)](_0x3af791):_0x14b072;}async[a0_0x5d395c(0x198)](){const _0x899f13=a0_0x5d395c;if(this['running'])return;this['running']=!0x0,await this[_0x899f13(0x17d)]('idle'),this[_0x899f13(0x16d)](_0x899f13(0x1cb)),this[_0x899f13(0x1c1)]=setInterval(()=>{const _0x4436a8=_0x899f13;this[_0x4436a8(0x17d)](_0x4436a8(0x1dc))['catch'](_0x2f87ed=>this['log'](_0x4436a8(0x183)+_0x2f87ed[_0x4436a8(0x1b8)]));},this[_0x899f13(0x1a2)]),this[_0x899f13(0x1d0)]();}async[a0_0x5d395c(0x167)](){const _0x18c883=a0_0x5d395c;if(this[_0x18c883(0x1af)]=!0x1,this[_0x18c883(0x194)]?.[_0x18c883(0x173)](),this[_0x18c883(0x1c1)])clearInterval(this[_0x18c883(0x1c1)]);await this[_0x18c883(0x17d)](_0x18c883(0x166))[_0x18c883(0x1b6)](()=>{}),this[_0x18c883(0x16d)](_0x18c883(0x191));}async[a0_0x5d395c(0x1a5)](_0x53e91e,_0xd68458,_0x48fc90=a0_0x5d395c(0x1d7)){const _0xa50331=a0_0x5d395c;return Y({'alias':_0x53e91e,'fromAlias':this[_0xa50331(0x1b7)]},{'log':_0x4839ab=>console[_0xa50331(0x16d)](_0x4839ab),'send':()=>this['call']('send_task',{'alias':_0x53e91e,'task':_0xd68458,'priority':_0x48fc90,'from_session':this[_0xa50331(0x1b7)]})});}async[a0_0x5d395c(0x1b8)](_0x172e70,_0x505ebd){const _0x4b7164=a0_0x5d395c;return this['call'](_0x4b7164(0x1b9),{'alias':_0x172e70,'message':_0x505ebd,'from_session':this[_0x4b7164(0x1b7)]});}async[a0_0x5d395c(0x1d1)](_0x44b682,_0x5bf4ec,_0x3e3ce6=a0_0x5d395c(0x19d)){const _0x911d70=a0_0x5d395c;return this[_0x911d70(0x177)](_0x911d70(0x19f),{'in_reply_to':_0x44b682,'text':_0x5bf4ec,'status':_0x3e3ce6});}async[a0_0x5d395c(0x17d)](_0x3338bf,_0x259bd1){const _0x682eba=a0_0x5d395c;return this[_0x682eba(0x177)](_0x682eba(0x1db),{'resume_id':this['resumeId'],'alias':this[_0x682eba(0x1b7)],'status':_0x3338bf,'server':a0_0x5b7e5c(),'hostname':a0_0x5b7e5c(),'agent':this['agent'],'project_dir':process[_0x682eba(0x172)](),..._0x259bd1});}async['getAllStatus'](){const _0x58c547=a0_0x5d395c;return this['call'](_0x58c547(0x184),{});}async[a0_0x5d395c(0x1c9)](_0x2ed343,_0x25013a){const _0xed2a02=a0_0x5d395c;return this[_0xed2a02(0x177)](_0xed2a02(0x1c9),{'message':_0x2ed343,'filter_server':_0x25013a?.[_0xed2a02(0x1d4)],'filter_status':_0x25013a?.[_0xed2a02(0x17d)]});}async[a0_0x5d395c(0x1d0)](){const _0x98b085=a0_0x5d395c;let _0x47bf8c=encodeURIComponent(this[_0x98b085(0x1b7)]),_0x52d331=this[_0x98b085(0x1d2)]+'/events/'+_0x47bf8c,_0x32c263=this['reconnectDelay'];while(this[_0x98b085(0x1af)]){try{this[_0x98b085(0x194)]=new AbortController();let _0xd60ecb={'Accept':_0x98b085(0x1bb)};if(this[_0x98b085(0x1c5)])_0xd60ecb['Authorization']=_0x98b085(0x19c)+this[_0x98b085(0x1c5)];let _0x1dc686=await fetch(_0x52d331,{'headers':_0xd60ecb,'signal':this['sseAbort'][_0x98b085(0x1d6)]});if(!_0x1dc686['ok']||!_0x1dc686[_0x98b085(0x1de)]){this[_0x98b085(0x16d)](_0x98b085(0x193)+_0x1dc686[_0x98b085(0x17d)]),await this['sleep'](_0x32c263),_0x32c263=Math[_0x98b085(0x1a7)](_0x32c263*1.5,0xea60);continue;}_0x32c263=this[_0x98b085(0x164)];let _0x5bcd85=_0x1dc686[_0x98b085(0x1de)][_0x98b085(0x182)](),_0x46969d=new TextDecoder(),_0x3ca111='';while(this[_0x98b085(0x1af)]){let {done:_0x5ce54d,value:_0xa65cee}=await _0x5bcd85[_0x98b085(0x1e2)]();if(_0x5ce54d)break;_0x3ca111+=_0x46969d[_0x98b085(0x1dd)](_0xa65cee,{'stream':!0x0});let _0x48a351=_0x3ca111['split']('\x0a');_0x3ca111=_0x48a351[_0x98b085(0x1e0)]()||'';for(let _0x27fb53 of _0x48a351){if(!_0x27fb53[_0x98b085(0x1a1)](_0x98b085(0x175)))continue;try{let _0x854c9e=JSON[_0x98b085(0x1a0)](_0x27fb53[_0x98b085(0x18f)](0x6));if(_0x854c9e[_0x98b085(0x1bf)]===_0x98b085(0x170)){this[_0x98b085(0x16d)](_0x98b085(0x180)),this[_0x98b085(0x1b5)](_0x98b085(0x170));continue;}if(_0x854c9e['type']===_0x98b085(0x1c8)||_0x854c9e[_0x98b085(0x1bf)]===_0x98b085(0x1be)||_0x854c9e[_0x98b085(0x1bf)]==='broadcast')await this[_0x98b085(0x1c0)]();}catch{}}}}catch(_0x3a1159){if(_0x3a1159[_0x98b085(0x1c7)]===_0x98b085(0x16f))break;this['emit']('error',_0x3a1159),this[_0x98b085(0x16d)](_0x98b085(0x16e)+_0x3a1159[_0x98b085(0x1b8)]);}if(this['running'])this['emit'](_0x98b085(0x191)),this['log'](_0x98b085(0x1c4)+_0x32c263/0x3e8+_0x98b085(0x189)),await this[_0x98b085(0x1d5)](_0x32c263),_0x32c263=Math['min'](_0x32c263*1.5,0xea60);}}async[a0_0x5d395c(0x1c0)](){const _0x5db871=a0_0x5d395c;try{let _0x5dc358=(await this[_0x5db871(0x177)]('get_inbox',{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x2f6677 of _0x5dc358)await this['call'](_0x5db871(0x18c),{'alias':this['alias'],'message_id':_0x2f6677['id']}),this[_0x5db871(0x16d)]('←\x20'+_0x2f6677[_0x5db871(0x197)]+':\x20'+_0x2f6677[_0x5db871(0x1b4)][_0x5db871(0x18f)](0x0,0x3c)),this[_0x5db871(0x1b5)]('task',_0x2f6677),this[_0x5db871(0x1b5)](_0x5db871(0x1b8),_0x2f6677);}catch(_0x23305c){this[_0x5db871(0x16d)]('inbox\x20error:\x20'+_0x23305c[_0x5db871(0x1b8)]);}}[a0_0x5d395c(0x1d5)](_0x1bcda6){return new Promise(_0x1e628f=>setTimeout(_0x1e628f,_0x1bcda6));}}var F=$;export{F as default,$ as CommHub};
@@ -0,0 +1,23 @@
1
+ /**
2
+ * #512 — which model a codex co-presence start runs on, and why.
3
+ *
4
+ * Order: explicit `--model` flag > the node's own config (`model` in
5
+ * .anet/nodes/<id>/config.json, written by `anet node create --model` /
6
+ * `anet node edit --model`) > DEFAULT_CODEX_MODEL.
7
+ *
8
+ * The bug this replaces: the start path computed `opts.model || DEFAULT`
9
+ * where `opts.model` was ONLY the CLI flag, so every start that did not
10
+ * repeat `--model` — the plain `anet node start <name>`, the boot sweep, and
11
+ * `anet node codex start|restart|resume` (which re-invoke `node start`
12
+ * without `--model`) — silently put the node on the default.
13
+ *
14
+ * One resolved value feeds all three pieces (app-server `-c model=`, the
15
+ * thread/resume `model` override, TUI `-m`), so they cannot disagree.
16
+ */
17
+ export type CodexModelSource = "flag" | "node-config" | "default";
18
+ export interface ResolvedCodexModel {
19
+ model: string;
20
+ source: CodexModelSource;
21
+ }
22
+ export declare function resolveCodexCopresenceModel(flagModel: unknown, nodeConfigModel: unknown, fallback?: string): ResolvedCodexModel;
23
+ export declare function describeCodexModelSource(r: ResolvedCodexModel): string;
@@ -17,7 +17,22 @@ export declare function quiesceThenSnapshot<T>(quiesce: () => Promise<void>, sna
17
17
  * exact thread back with persisted history. This is deliberately stricter
18
18
  * than accepting a successful thread/resume RPC response. */
19
19
  export declare function verifyCodexThreadHistory(method: "thread/start" | "thread/resume", expectedThreadId: string, readResult: unknown, now?: Date): CodexRecoveryVerification;
20
- export declare function resumeAndVerifyCodexThread(threadId: string, request: (method: string, params: Record<string, unknown>) => Promise<unknown>): Promise<CodexRecoveryVerification>;
20
+ /**
21
+ * #512 — `model` is the node's resolved model. It MUST ride on thread/resume:
22
+ * measured on codex 0.155 (Docker), a resume without it puts the thread back on
23
+ * the model recorded in the rollout's last turn_context and ignores the
24
+ * app-server's `-c model=`. This launcher is the first client to load the
25
+ * thread, and once loaded, later resumes without a model (the bridge's) keep
26
+ * whatever the first one set — so this is the request that decides the model
27
+ * for every subsequent turn: the configured model wins over the thread's
28
+ * recorded one.
29
+ *
30
+ * Returns the model the app-server reports for the resumed thread (if any) so
31
+ * the caller can say which model the session is actually on.
32
+ */
33
+ export declare function resumeAndVerifyCodexThread(threadId: string, request: (method: string, params: Record<string, unknown>) => Promise<unknown>, model?: string): Promise<CodexRecoveryVerification & {
34
+ resumedModel?: string;
35
+ }>;
21
36
  /** Private, node-local recovery point. config-recovery.json is deliberately
22
37
  * redacted non-credential audit/recovery metadata, not an identity backup.
23
38
  * Identity recovery relies on leaving the original node config and CODEX_HOME
@@ -0,0 +1,74 @@
1
+ export type ProbeName = "proc" | "ss" | "lsof" | "netstat";
2
+ /** null = 这条探针在本机跑不了(没有 /proc、没装 ss …);数组 = 跑了,这些 PID 在监听。 */
3
+ export interface SocketProbeResult {
4
+ pids: number[];
5
+ /** 端口确实被监听、但属主 PID 读不到(别的用户的进程)。 */
6
+ unresolved?: number;
7
+ }
8
+ export interface HubPidRecord {
9
+ pid: number;
10
+ port: number;
11
+ launcher_pid?: number;
12
+ started_at?: string;
13
+ }
14
+ export interface HubStopProbes {
15
+ platform: NodeJS.Platform;
16
+ socket: Partial<Record<ProbeName, (port: number) => SocketProbeResult | null>>;
17
+ readPidFile: (port: number) => HubPidRecord | null;
18
+ cmdline: (pid: number) => string | null;
19
+ alive: (pid: number) => boolean;
20
+ }
21
+ export type CandidateVerdict = "commhub" | "not-commhub" | "cmdline-unreadable";
22
+ export interface Candidate {
23
+ pid: number;
24
+ source: ProbeName | "pidfile";
25
+ cmdline: string | null;
26
+ verdict: CandidateVerdict;
27
+ }
28
+ export interface HubListenerResolution {
29
+ port: number;
30
+ /** 每条探针的结果,按尝试顺序。 */
31
+ tried: {
32
+ probe: ProbeName | "pidfile";
33
+ outcome: string;
34
+ }[];
35
+ /** 给出端口归属的那条探针;null = 本机没有一条能跑。 */
36
+ authority: ProbeName | null;
37
+ /** 端口被监听但读不到属主 PID 的个数。 */
38
+ unresolved: number;
39
+ /** 核实过是 commhub-server 的 PID —— 只有这些会被停。 */
40
+ hubPids: Candidate[];
41
+ /** 端口上的其他进程 / cmdline 读不到的进程 —— 拒绝动手。 */
42
+ refused: Candidate[];
43
+ }
44
+ export declare function probeOrder(platform: NodeJS.Platform): ProbeName[];
45
+ /** cmdline 是不是 commhub-server。只做核实,不用来挑选进程。 */
46
+ export declare function isCommhubServerCmdline(cmdline: string | null | undefined): boolean;
47
+ /** /proc/net/tcp 或 tcp6 文本 → 在 port 上 LISTEN(st=0A)的 socket inode。 */
48
+ export declare function parseProcNetTcp(text: string, port: number): string[];
49
+ /** `ss -Hltnp 'sport = :PORT'` → pids;有行却没有 users:(…) 的算 unresolved。 */
50
+ export declare function parseSsOutput(text: string, port: number): SocketProbeResult;
51
+ /** Windows `netstat -ano`:`TCP 127.0.0.1:9200 0.0.0.0:0 LISTENING 1234`。 */
52
+ export declare function parseNetstatWindows(text: string, port: number): SocketProbeResult;
53
+ /** macOS `netstat -anv -p tcp`:按表头找 pid 列;本地地址形如 `127.0.0.1.9200` / `*.9200`。 */
54
+ export declare function parseNetstatDarwin(text: string, port: number): SocketProbeResult;
55
+ export declare function resolveHubListener(port: number, probes: HubStopProbes): HubListenerResolution;
56
+ export interface StopHubDeps {
57
+ probes: HubStopProbes;
58
+ kill: (pid: number, signal: "SIGTERM" | "SIGKILL") => void;
59
+ sleep: (ms: number) => Promise<void>;
60
+ /** /health 是否 ok —— 与探针无关的独立判据。 */
61
+ healthy: () => Promise<boolean>;
62
+ log: (line: string) => void;
63
+ error: (line: string) => void;
64
+ graceMs?: number;
65
+ }
66
+ export interface StopHubResult {
67
+ code: 0 | 1;
68
+ killed: number[];
69
+ refused: Candidate[];
70
+ }
71
+ export declare function stopHub(port: number, d: StopHubDeps): Promise<StopHubResult>;
72
+ export declare function procNetListeners(port: number, procRoot?: string): SocketProbeResult | null;
73
+ export declare function defaultHubStopProbes(readPidFile: (port: number) => HubPidRecord | null, platform?: NodeJS.Platform): HubStopProbes;
74
+ export declare function readCmdline(pid: number, platform?: NodeJS.Platform): string | null;