@sleep2agi/agent-network 2.3.0-preview.69 → 2.3.0-preview.70
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/codex-copresence-profile.d.ts +57 -0
- package/dist/src/daemon-capability-display.d.ts +58 -0
- package/dist/src/daemon-capability-display.js +5 -0
- package/dist/src/node-server.js +7 -7
- package/dist/src/opencode-agent-node-pair.d.ts +2 -2
- package/package.json +6 -2
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0xe4e73=a0_0x1482;(function(_0x5af11c,_0xde6ae8){const _0x28c537=a0_0x1482,_0x5435a4=_0x5af11c();while(!![]){try{const _0x19af82=parseInt(_0x28c537(0x22e))/0x1+parseInt(_0x28c537(0x24c))/0x2+parseInt(_0x28c537(0x1e3))/0x3*(parseInt(_0x28c537(0x246))/0x4)+parseInt(_0x28c537(0x1e8))/0x5*(-parseInt(_0x28c537(0x1d8))/0x6)+parseInt(_0x28c537(0x248))/0x7*(-parseInt(_0x28c537(0x24a))/0x8)+parseInt(_0x28c537(0x20b))/0x9*(parseInt(_0x28c537(0x219))/0xa)+-parseInt(_0x28c537(0x205))/0xb;if(_0x19af82===_0xde6ae8)break;else _0x5435a4['push'](_0x5435a4['shift']());}catch(_0x15e046){_0x5435a4['push'](_0x5435a4['shift']());}}}(a0_0x4e6f,0x237a9));import{EventEmitter as a0_0x4cacaf}from'events';import{hostname as a0_0x18d20d}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x20a474,_0x23fc26)=>(_0x20a474??_0x23fc26)[a0_0xe4e73(0x21b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0xe4e73(0x1df)](0x0,0xf0);function N(_0x1fb060){const _0x5aa644=a0_0xe4e73;return(_0x1fb060 instanceof Error?_0x1fb060['message']:String(_0x1fb060??_0x5aa644(0x231)))[_0x5aa644(0x21b)](K,_0x5aa644(0x1cd))[_0x5aa644(0x21b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x5aa644(0x1df)](0x0,0xf0);}function O(_0x1dafd8,_0x18be3c=process.env.ANET_TASK_TRACE_FORMAT===a0_0xe4e73(0x1fd)){const _0x59ec0d=a0_0xe4e73;if(_0x18be3c)return JSON[_0x59ec0d(0x1fb)](_0x1dafd8);let _0x46bbcf=L(_0x1dafd8['parent_task_id'],'<missing>'),_0x4075e3=L(_0x1dafd8[_0x59ec0d(0x22a)],'<pending>'),_0x57d970=_0x1dafd8['error_code']?_0x59ec0d(0x1db)+_0x1dafd8[_0x59ec0d(0x1d9)]+':'+(_0x1dafd8[_0x59ec0d(0x215)]??''):'';return _0x59ec0d(0x1dd)+_0x1dafd8[_0x59ec0d(0x1cb)]+_0x59ec0d(0x21e)+L(_0x1dafd8[_0x59ec0d(0x22c)],_0x59ec0d(0x1d6))+_0x59ec0d(0x226)+L(_0x1dafd8[_0x59ec0d(0x1d0)],_0x59ec0d(0x1d6))+_0x59ec0d(0x212)+_0x4075e3+_0x59ec0d(0x1d1)+_0x46bbcf+_0x59ec0d(0x222)+L(_0x1dafd8[_0x59ec0d(0x241)],_0x59ec0d(0x1d6))+'\x20transport='+_0x1dafd8[_0x59ec0d(0x242)]+_0x59ec0d(0x237)+_0x1dafd8[_0x59ec0d(0x1f2)]+_0x59ec0d(0x1ec)+_0x1dafd8[_0x59ec0d(0x1d2)]+_0x57d970;}function U(_0x1e2bd7){const _0x2a4f40=a0_0xe4e73;return{'event':{'sending':_0x2a4f40(0x216),'delivered':'task.send.delivered','failed':_0x2a4f40(0x1d5),'acked':_0x2a4f40(0x211),'started':_0x2a4f40(0x1fe),'replied':_0x2a4f40(0x1e1),'expired':_0x2a4f40(0x1cc)}[_0x1e2bd7[_0x2a4f40(0x1cb)]],..._0x1e2bd7};}function j(_0x26888b){const _0x2c1159=a0_0xe4e73;let _0x4c162d=_0x26888b?.[_0x2c1159(0x22a)]||_0x26888b?.[_0x2c1159(0x20e)]||_0x26888b?.['id'];if(_0x4c162d)return String(_0x4c162d);let _0x2e734b=_0x26888b?.[_0x2c1159(0x217)]?.[0x0]?.['text'];if(typeof _0x2e734b!==_0x2c1159(0x243))return null;try{let _0x137f3e=JSON['parse'](_0x2e734b);return _0x137f3e?.[_0x2c1159(0x22a)]||_0x137f3e?.[_0x2c1159(0x20e)]||_0x137f3e?.['id']||null;}catch{return null;}}async function X(_0x2ded0e,_0x4cec62){const _0x1e46d3=a0_0xe4e73;let _0x4c49a6=_0x4cec62[_0x1e46d3(0x24b)]??Date['now'],_0x16cb83=_0x4c49a6(),_0x29de88=(_0xfe69fd,_0x5e419a,_0x21e70f,_0x2064e1)=>{const _0x2ed202=_0x1e46d3;_0x4cec62[_0x2ed202(0x1de)](O(U({'from_alias':_0x2ded0e[_0x2ed202(0x1f6)],'to_alias':_0x2ded0e[_0x2ed202(0x1f8)],'task_id':_0x5e419a,'parent_task_id':_0x2ded0e['parentTaskId'],'network_id':_0x2ded0e[_0x2ed202(0x1fc)],'transport':_0x2ded0e['transport'],'status':_0xfe69fd,'duration_ms':_0x4c49a6()-_0x16cb83,'lifecycle_tracking':_0x2ded0e['lifecycleTracking'],..._0x21e70f!==void 0x0?{'error_code':_0x2064e1||'send_failed','error_message':N(_0x21e70f)}:{}})));};_0x29de88(_0x1e46d3(0x220),null);try{let _0x517079=await _0x4cec62[_0x1e46d3(0x250)](),_0xdb8daa=j(_0x517079);if(_0xdb8daa)_0x29de88(_0x1e46d3(0x207),_0xdb8daa);else{if(_0x517079?.['ok']===!0x1||_0x517079?.[_0x1e46d3(0x1dc)])_0x29de88(_0x1e46d3(0x1f7),_0xdb8daa,_0x517079?.['error']||_0x1e46d3(0x247),_0x1e46d3(0x221));else _0x29de88('failed',null,_0x1e46d3(0x1e2),_0x1e46d3(0x1ca));}return _0x517079;}catch(_0x4d9725){throw _0x29de88(_0x1e46d3(0x1f7),null,_0x4d9725,_0x1e46d3(0x227)),_0x4d9725;}}async function Y(_0x4a67a2,_0x2e7d2a){const _0x410e3b=a0_0xe4e73;return X({'fromAlias':_0x4a67a2[_0x410e3b(0x1f6)],'toAlias':_0x4a67a2[_0x410e3b(0x202)],'parentTaskId':_0x4a67a2[_0x410e3b(0x1cf)]||null,'networkId':_0x4a67a2[_0x410e3b(0x1fc)]||null,'transport':_0x410e3b(0x23c),'lifecycleTracking':_0x410e3b(0x244)},_0x2e7d2a);}function a0_0x4e6f(){const _0x3486f4=['agent','2.0','call','\x20to=','send_failed','connected','catch','task_id','application/json,\x20text/event-stream','from_alias','application/json','131479dNrMMK','token','heartbeatInterval','unknown\x20error','sdk','data:\x20','processInbox','/events/','read','\x20duration_ms=','broadcast','getAllStatus','connect','disconnect','mcp_http','pop','parse','from_session','min','network_id','transport','string','not_tracked','match','120372PnlSjp','CommHub\x20rejected\x20task','7NsibdF','sseAbort','156072rTtQNJ','now','108756HmSUPT','decode','s...','SSE\x20reconnecting\x20in\x20','send','body','missing_task_id','status','task.expired','[REDACTED]','running','parentTaskId','to_alias','\x20parent_task_id=','lifecycle_tracking','text',']\x20[commhub:','task.send.failed','<unknown>','task','2658TTOHxV','error_code','inbox\x20error:\x20','\x20error=','error','[commhub:task]\x20','log','slice','type','task.replied','CommHub\x20response\x20omitted\x20task_id','6brHWpA','signal','split','tools/call','abort','50nEDipL','send_message','sdk-','heartbeatTimer','\x20lifecycle=','name','new_task','SSE\x20failed:\x20','SSE\x20error:\x20','disconnected','duration_ms','SSE\x20connected','get_inbox','send_task','fromAlias','failed','toAlias','registered','cwd','stringify','networkId','json','task.started','messages','sleep','reconnectDelay','alias','idle','url','2921325HYURoz','Authorization','delivered','result','resumeId','completed','424782qwmRmH','server','message','message_id','text/event-stream','new_message','task.ack','\x20task_id=','connectSSE','emit','error_message','task.send.start','content','AbortError','40KfGBsq','toString','replace','autoConnect','ack_inbox','\x20from=','toTimeString','sending','send_rejected','\x20network_id='];a0_0x4e6f=function(){return _0x3486f4;};return a0_0x4e6f();}function a0_0x1482(_0x4ae13b,_0x4f1534){_0x4ae13b=_0x4ae13b-0x1ca;const _0x4e6fb0=a0_0x4e6f();let _0x1482f8=_0x4e6fb0[_0x4ae13b];return _0x1482f8;}class $ extends a0_0x4cacaf{[a0_0xe4e73(0x204)];[a0_0xe4e73(0x202)];['token'];[a0_0xe4e73(0x223)];[a0_0xe4e73(0x209)];[a0_0xe4e73(0x230)];[a0_0xe4e73(0x201)];[a0_0xe4e73(0x1eb)];[a0_0xe4e73(0x249)];[a0_0xe4e73(0x1ce)]=!0x1;constructor(_0x425b49){const _0x318748=a0_0xe4e73;super();if(this[_0x318748(0x204)]=_0x425b49[_0x318748(0x204)]['replace'](/\/$/,''),this[_0x318748(0x202)]=_0x425b49[_0x318748(0x202)],this[_0x318748(0x22f)]=_0x425b49[_0x318748(0x22f)],this['agent']=_0x425b49['agent']||_0x318748(0x232),this[_0x318748(0x209)]=_0x318748(0x1ea)+_0x425b49[_0x318748(0x202)]+'-'+Date[_0x318748(0x24b)]()[_0x318748(0x21a)](0x24),this[_0x318748(0x230)]=_0x425b49[_0x318748(0x230)]??0x2bf20,this[_0x318748(0x201)]=_0x425b49[_0x318748(0x201)]??0xbb8,_0x425b49[_0x318748(0x21c)]!==!0x1)this[_0x318748(0x23a)]();}[a0_0xe4e73(0x1de)](_0x1d36f0){const _0x5e4502=a0_0xe4e73;console[_0x5e4502(0x1de)]('['+new Date()[_0x5e4502(0x21f)]()['slice'](0x0,0x8)+_0x5e4502(0x1d4)+this[_0x5e4502(0x202)]+']\x20'+_0x1d36f0);}async[a0_0xe4e73(0x225)](_0x4abd69,_0x3e52a5){const _0x4c3e8a=a0_0xe4e73;let _0x3b3437={'Content-Type':_0x4c3e8a(0x22d),'Accept':_0x4c3e8a(0x22b)};if(this[_0x4c3e8a(0x22f)])_0x3b3437[_0x4c3e8a(0x206)]='Bearer\x20'+this[_0x4c3e8a(0x22f)];let _0x3031b7=await(await fetch(this[_0x4c3e8a(0x204)]+'/mcp',{'method':'POST','headers':_0x3b3437,'body':JSON['stringify']({'jsonrpc':_0x4c3e8a(0x224),'id':Date[_0x4c3e8a(0x24b)](),'method':_0x4c3e8a(0x1e6),'params':{'name':_0x4abd69,'arguments':_0x3e52a5}})}))['text'](),_0x11bf18=_0x3031b7[_0x4c3e8a(0x245)](/data: (.+)/),_0x276f61=_0x11bf18?JSON[_0x4c3e8a(0x23e)](_0x11bf18[0x1]):JSON[_0x4c3e8a(0x23e)](_0x3031b7),_0x423b84=_0x276f61?.[_0x4c3e8a(0x208)]?.['content']?.[0x0]?.[_0x4c3e8a(0x1d3)];return _0x423b84?JSON['parse'](_0x423b84):_0x276f61;}async[a0_0xe4e73(0x23a)](){const _0x5c9c4e=a0_0xe4e73;if(this[_0x5c9c4e(0x1ce)])return;this[_0x5c9c4e(0x1ce)]=!0x0,await this['status'](_0x5c9c4e(0x203)),this['log'](_0x5c9c4e(0x1f9)),this[_0x5c9c4e(0x1eb)]=setInterval(()=>{const _0xb25cee=_0x5c9c4e;this[_0xb25cee(0x1cb)](_0xb25cee(0x203))[_0xb25cee(0x229)](_0x14a1a3=>this[_0xb25cee(0x1de)]('heartbeat\x20failed:\x20'+_0x14a1a3['message']));},this[_0x5c9c4e(0x230)]),this[_0x5c9c4e(0x213)]();}async[a0_0xe4e73(0x23b)](){const _0x1b8b57=a0_0xe4e73;if(this[_0x1b8b57(0x1ce)]=!0x1,this[_0x1b8b57(0x249)]?.[_0x1b8b57(0x1e7)](),this[_0x1b8b57(0x1eb)])clearInterval(this[_0x1b8b57(0x1eb)]);await this[_0x1b8b57(0x1cb)]('offline')[_0x1b8b57(0x229)](()=>{}),this[_0x1b8b57(0x1de)](_0x1b8b57(0x1f1));}async[a0_0xe4e73(0x250)](_0x379365,_0x2eeef7,_0x24a40d='normal'){const _0x156675=a0_0xe4e73;return Y({'alias':_0x379365,'fromAlias':this[_0x156675(0x202)]},{'log':_0x2ecc50=>console[_0x156675(0x1de)](_0x2ecc50),'send':()=>this['call'](_0x156675(0x1f5),{'alias':_0x379365,'task':_0x2eeef7,'priority':_0x24a40d,'from_session':this['alias']})});}async['message'](_0xe6cabc,_0x58df9f){const _0x2d6ea8=a0_0xe4e73;return this[_0x2d6ea8(0x225)](_0x2d6ea8(0x1e9),{'alias':_0xe6cabc,'message':_0x58df9f,'from_session':this[_0x2d6ea8(0x202)]});}async['reply'](_0xbe960d,_0x847766,_0x229e7f=a0_0xe4e73(0x20a)){const _0x292f8f=a0_0xe4e73;return this[_0x292f8f(0x225)]('send_reply',{'in_reply_to':_0xbe960d,'text':_0x847766,'status':_0x229e7f});}async['status'](_0x58affa,_0x576a91){const _0x395c36=a0_0xe4e73;return this[_0x395c36(0x225)]('report_status',{'resume_id':this['resumeId'],'alias':this['alias'],'status':_0x58affa,'server':a0_0x18d20d(),'hostname':a0_0x18d20d(),'agent':this[_0x395c36(0x223)],'project_dir':process[_0x395c36(0x1fa)](),..._0x576a91});}async[a0_0xe4e73(0x239)](){const _0x2a9afe=a0_0xe4e73;return this[_0x2a9afe(0x225)]('get_all_status',{});}async[a0_0xe4e73(0x238)](_0x59a783,_0x794079){const _0x136bf5=a0_0xe4e73;return this['call']('broadcast',{'message':_0x59a783,'filter_server':_0x794079?.[_0x136bf5(0x20c)],'filter_status':_0x794079?.[_0x136bf5(0x1cb)]});}async[a0_0xe4e73(0x213)](){const _0x535ccb=a0_0xe4e73;let _0x52554b=encodeURIComponent(this[_0x535ccb(0x202)]),_0x5e57b2=this[_0x535ccb(0x204)]+_0x535ccb(0x235)+_0x52554b,_0xc79717=this[_0x535ccb(0x201)];while(this[_0x535ccb(0x1ce)]){try{this['sseAbort']=new AbortController();let _0x4445f8={'Accept':_0x535ccb(0x20f)};if(this[_0x535ccb(0x22f)])_0x4445f8[_0x535ccb(0x206)]='Bearer\x20'+this[_0x535ccb(0x22f)];let _0x16a335=await fetch(_0x5e57b2,{'headers':_0x4445f8,'signal':this[_0x535ccb(0x249)][_0x535ccb(0x1e4)]});if(!_0x16a335['ok']||!_0x16a335['body']){this['log'](_0x535ccb(0x1ef)+_0x16a335[_0x535ccb(0x1cb)]),await this[_0x535ccb(0x200)](_0xc79717),_0xc79717=Math['min'](_0xc79717*1.5,0xea60);continue;}_0xc79717=this[_0x535ccb(0x201)];let _0x166507=_0x16a335[_0x535ccb(0x251)]['getReader'](),_0x57b80d=new TextDecoder(),_0x2a8c79='';while(this[_0x535ccb(0x1ce)]){let {done:_0x3d261f,value:_0x77462b}=await _0x166507[_0x535ccb(0x236)]();if(_0x3d261f)break;_0x2a8c79+=_0x57b80d[_0x535ccb(0x24d)](_0x77462b,{'stream':!0x0});let _0xf93531=_0x2a8c79[_0x535ccb(0x1e5)]('\x0a');_0x2a8c79=_0xf93531[_0x535ccb(0x23d)]()||'';for(let _0x2acea1 of _0xf93531){if(!_0x2acea1['startsWith'](_0x535ccb(0x233)))continue;try{let _0x4a8820=JSON[_0x535ccb(0x23e)](_0x2acea1[_0x535ccb(0x1df)](0x6));if(_0x4a8820[_0x535ccb(0x1e0)]===_0x535ccb(0x228)){this[_0x535ccb(0x1de)](_0x535ccb(0x1f3)),this[_0x535ccb(0x214)](_0x535ccb(0x228));continue;}if(_0x4a8820[_0x535ccb(0x1e0)]===_0x535ccb(0x1ee)||_0x4a8820['type']===_0x535ccb(0x210)||_0x4a8820['type']===_0x535ccb(0x238))await this[_0x535ccb(0x234)]();}catch{}}}}catch(_0x1373fd){if(_0x1373fd[_0x535ccb(0x1ed)]===_0x535ccb(0x218))break;this[_0x535ccb(0x214)](_0x535ccb(0x1dc),_0x1373fd),this[_0x535ccb(0x1de)](_0x535ccb(0x1f0)+_0x1373fd[_0x535ccb(0x20d)]);}if(this[_0x535ccb(0x1ce)])this[_0x535ccb(0x214)](_0x535ccb(0x1f1)),this[_0x535ccb(0x1de)](_0x535ccb(0x24f)+_0xc79717/0x3e8+_0x535ccb(0x24e)),await this['sleep'](_0xc79717),_0xc79717=Math[_0x535ccb(0x240)](_0xc79717*1.5,0xea60);}}async[a0_0xe4e73(0x234)](){const _0x359bb6=a0_0xe4e73;try{let _0x84073a=(await this[_0x359bb6(0x225)](_0x359bb6(0x1f4),{'alias':this[_0x359bb6(0x202)],'limit':0xa}))?.[_0x359bb6(0x1ff)]||[];for(let _0x31ef80 of _0x84073a)await this['call'](_0x359bb6(0x21d),{'alias':this['alias'],'message_id':_0x31ef80['id']}),this[_0x359bb6(0x1de)]('←\x20'+_0x31ef80[_0x359bb6(0x23f)]+':\x20'+_0x31ef80[_0x359bb6(0x217)][_0x359bb6(0x1df)](0x0,0x3c)),this[_0x359bb6(0x214)](_0x359bb6(0x1d7),_0x31ef80),this[_0x359bb6(0x214)](_0x359bb6(0x20d),_0x31ef80);}catch(_0x59cd38){this[_0x359bb6(0x1de)](_0x359bb6(0x1da)+_0x59cd38[_0x359bb6(0x20d)]);}}[a0_0xe4e73(0x200)](_0xcf328e){return new Promise(_0x3e9f25=>setTimeout(_0x3e9f25,_0xcf328e));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x2b4667=a0_0x3544;function a0_0x3544(_0x4457c7,_0x1a17ca){_0x4457c7=_0x4457c7-0xba;const _0x54b653=a0_0x54b6();let _0x3544c5=_0x54b653[_0x4457c7];return _0x3544c5;}(function(_0x17732e,_0x3ab4bb){const _0x269eb9=a0_0x3544,_0x53073c=_0x17732e();while(!![]){try{const _0x2f71b2=-parseInt(_0x269eb9(0xc4))/0x1+-parseInt(_0x269eb9(0x12a))/0x2+parseInt(_0x269eb9(0xfd))/0x3+parseInt(_0x269eb9(0x11b))/0x4*(parseInt(_0x269eb9(0xd3))/0x5)+parseInt(_0x269eb9(0xe2))/0x6*(parseInt(_0x269eb9(0xf5))/0x7)+-parseInt(_0x269eb9(0xc3))/0x8+parseInt(_0x269eb9(0xda))/0x9;if(_0x2f71b2===_0x3ab4bb)break;else _0x53073c['push'](_0x53073c['shift']());}catch(_0x1c9b5e){_0x53073c['push'](_0x53073c['shift']());}}}(a0_0x54b6,0x6eee3));import{EventEmitter as a0_0x2dfb31}from'events';import{hostname as a0_0x10acf7}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x4e8f9,_0x1dafd4)=>(_0x4e8f9??_0x1dafd4)[a0_0x2b4667(0xd9)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2b4667(0x10f)](0x0,0xf0);function N(_0x1d1193){const _0x27a759=a0_0x2b4667;return(_0x1d1193 instanceof Error?_0x1d1193['message']:String(_0x1d1193??_0x27a759(0x139)))[_0x27a759(0xd9)](K,_0x27a759(0xf2))[_0x27a759(0xd9)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x27a759(0x10f)](0x0,0xf0);}function O(_0x2d7f24,_0x67262d=process.env.ANET_TASK_TRACE_FORMAT===a0_0x2b4667(0xea)){const _0x347e4e=a0_0x2b4667;if(_0x67262d)return JSON[_0x347e4e(0x11f)](_0x2d7f24);let _0x3caf55=L(_0x2d7f24[_0x347e4e(0xc6)],_0x347e4e(0xeb)),_0x1f2df1=L(_0x2d7f24[_0x347e4e(0x10a)],_0x347e4e(0x128)),_0x4628ea=_0x2d7f24[_0x347e4e(0xca)]?'\x20error='+_0x2d7f24['error_code']+':'+(_0x2d7f24[_0x347e4e(0xe5)]??''):'';return'[commhub:task]\x20'+_0x2d7f24[_0x347e4e(0xc5)]+'\x20from='+L(_0x2d7f24[_0x347e4e(0x122)],_0x347e4e(0xd7))+_0x347e4e(0xd0)+L(_0x2d7f24[_0x347e4e(0x114)],_0x347e4e(0xd7))+_0x347e4e(0x100)+_0x1f2df1+_0x347e4e(0x13a)+_0x3caf55+_0x347e4e(0xd8)+L(_0x2d7f24[_0x347e4e(0x126)],_0x347e4e(0xd7))+_0x347e4e(0x133)+_0x2d7f24[_0x347e4e(0xdd)]+_0x347e4e(0xfe)+_0x2d7f24[_0x347e4e(0x106)]+_0x347e4e(0xf6)+_0x2d7f24['lifecycle_tracking']+_0x4628ea;}function U(_0x48cb8c){const _0xadbd9c=a0_0x2b4667;return{'event':{'sending':_0xadbd9c(0xed),'delivered':_0xadbd9c(0xc8),'failed':_0xadbd9c(0xf1),'acked':_0xadbd9c(0xd6),'started':_0xadbd9c(0x10b),'replied':_0xadbd9c(0x103),'expired':'task.expired'}[_0x48cb8c[_0xadbd9c(0xc5)]],..._0x48cb8c};}function j(_0x24bc89){const _0x100450=a0_0x2b4667;let _0x5dc550=_0x24bc89?.[_0x100450(0x10a)]||_0x24bc89?.[_0x100450(0xfb)]||_0x24bc89?.['id'];if(_0x5dc550)return String(_0x5dc550);let _0xb141c5=_0x24bc89?.['content']?.[0x0]?.[_0x100450(0x12e)];if(typeof _0xb141c5!==_0x100450(0x123))return null;try{let _0x508ba7=JSON[_0x100450(0x109)](_0xb141c5);return _0x508ba7?.['task_id']||_0x508ba7?.[_0x100450(0xfb)]||_0x508ba7?.['id']||null;}catch{return null;}}async function X(_0x1c6f0a,_0x4a44ad){const _0x27e6be=a0_0x2b4667;let _0x59b767=_0x4a44ad[_0x27e6be(0xe8)]??Date[_0x27e6be(0xe8)],_0x4f1e7a=_0x59b767(),_0x5c98af=(_0x214e87,_0x5af6be,_0x233477,_0x3dc598)=>{const _0x22d346=_0x27e6be;_0x4a44ad['log'](O(U({'from_alias':_0x1c6f0a[_0x22d346(0xf0)],'to_alias':_0x1c6f0a[_0x22d346(0xd2)],'task_id':_0x5af6be,'parent_task_id':_0x1c6f0a[_0x22d346(0x132)],'network_id':_0x1c6f0a[_0x22d346(0x11c)],'transport':_0x1c6f0a[_0x22d346(0xdd)],'status':_0x214e87,'duration_ms':_0x59b767()-_0x4f1e7a,'lifecycle_tracking':_0x1c6f0a[_0x22d346(0x129)],..._0x233477!==void 0x0?{'error_code':_0x3dc598||_0x22d346(0x10d),'error_message':N(_0x233477)}:{}})));};_0x5c98af('sending',null);try{let _0x4c960d=await _0x4a44ad[_0x27e6be(0x117)](),_0xc85dc8=j(_0x4c960d);if(_0xc85dc8)_0x5c98af('delivered',_0xc85dc8);else{if(_0x4c960d?.['ok']===!0x1||_0x4c960d?.[_0x27e6be(0x111)])_0x5c98af(_0x27e6be(0x127),_0xc85dc8,_0x4c960d?.[_0x27e6be(0x111)]||_0x27e6be(0xcc),_0x27e6be(0x113));else _0x5c98af('failed',null,_0x27e6be(0xef),_0x27e6be(0x105));}return _0x4c960d;}catch(_0x3d2491){throw _0x5c98af(_0x27e6be(0x127),null,_0x3d2491,_0x27e6be(0x10d)),_0x3d2491;}}async function Y(_0x42b534,_0x221594){const _0x21b8a1=a0_0x2b4667;return X({'fromAlias':_0x42b534['fromAlias'],'toAlias':_0x42b534[_0x21b8a1(0x131)],'parentTaskId':_0x42b534[_0x21b8a1(0x132)]||null,'networkId':_0x42b534[_0x21b8a1(0x11c)]||null,'transport':'mcp_http','lifecycleTracking':_0x21b8a1(0xc2)},_0x221594);}class $ extends a0_0x2dfb31{[a0_0x2b4667(0xf8)];['alias'];[a0_0x2b4667(0x10c)];[a0_0x2b4667(0xd5)];[a0_0x2b4667(0xcf)];[a0_0x2b4667(0xde)];[a0_0x2b4667(0xdc)];[a0_0x2b4667(0x125)];[a0_0x2b4667(0xce)];[a0_0x2b4667(0xbc)]=!0x1;constructor(_0x4d0237){const _0x305694=a0_0x2b4667;super();if(this[_0x305694(0xf8)]=_0x4d0237[_0x305694(0xf8)][_0x305694(0xd9)](/\/$/,''),this[_0x305694(0x131)]=_0x4d0237['alias'],this['token']=_0x4d0237[_0x305694(0x10c)],this['agent']=_0x4d0237[_0x305694(0xd5)]||_0x305694(0xc9),this[_0x305694(0xcf)]=_0x305694(0x119)+_0x4d0237[_0x305694(0x131)]+'-'+Date[_0x305694(0xe8)]()[_0x305694(0x108)](0x24),this[_0x305694(0xde)]=_0x4d0237[_0x305694(0xde)]??0x2bf20,this[_0x305694(0xdc)]=_0x4d0237[_0x305694(0xdc)]??0xbb8,_0x4d0237[_0x305694(0x102)]!==!0x1)this['connect']();}[a0_0x2b4667(0xdf)](_0x4a8835){const _0x1e6a12=a0_0x2b4667;console[_0x1e6a12(0xdf)]('['+new Date()[_0x1e6a12(0x116)]()[_0x1e6a12(0x10f)](0x0,0x8)+_0x1e6a12(0x13b)+this[_0x1e6a12(0x131)]+']\x20'+_0x4a8835);}async[a0_0x2b4667(0x135)](_0x383540,_0x271f6c){const _0x421165=a0_0x2b4667;let _0x53662b={'Content-Type':'application/json','Accept':'application/json,\x20text/event-stream'};if(this['token'])_0x53662b[_0x421165(0x11d)]='Bearer\x20'+this['token'];let _0x13cfd7=await(await fetch(this[_0x421165(0xf8)]+_0x421165(0xff),{'method':_0x421165(0x12b),'headers':_0x53662b,'body':JSON[_0x421165(0x11f)]({'jsonrpc':_0x421165(0x130),'id':Date[_0x421165(0xe8)](),'method':_0x421165(0xfa),'params':{'name':_0x383540,'arguments':_0x271f6c}})}))[_0x421165(0x12e)](),_0x3a11f7=_0x13cfd7['match'](/data: (.+)/),_0x112073=_0x3a11f7?JSON[_0x421165(0x109)](_0x3a11f7[0x1]):JSON['parse'](_0x13cfd7),_0x5cdf90=_0x112073?.[_0x421165(0xba)]?.[_0x421165(0x110)]?.[0x0]?.[_0x421165(0x12e)];return _0x5cdf90?JSON[_0x421165(0x109)](_0x5cdf90):_0x112073;}async[a0_0x2b4667(0xdb)](){const _0x281715=a0_0x2b4667;if(this[_0x281715(0xbc)])return;this[_0x281715(0xbc)]=!0x0,await this[_0x281715(0xc5)](_0x281715(0x134)),this[_0x281715(0xdf)]('registered'),this[_0x281715(0x125)]=setInterval(()=>{const _0x2ab521=_0x281715;this['status'](_0x2ab521(0x134))[_0x2ab521(0x107)](_0x31266f=>this[_0x2ab521(0xdf)](_0x2ab521(0xe3)+_0x31266f['message']));},this[_0x281715(0xde)]),this[_0x281715(0x12c)]();}async[a0_0x2b4667(0xe1)](){const _0x53014b=a0_0x2b4667;if(this['running']=!0x1,this[_0x53014b(0xce)]?.['abort'](),this[_0x53014b(0x125)])clearInterval(this[_0x53014b(0x125)]);await this[_0x53014b(0xc5)](_0x53014b(0xec))[_0x53014b(0x107)](()=>{}),this[_0x53014b(0xdf)](_0x53014b(0xe6));}async[a0_0x2b4667(0x117)](_0x428c90,_0x183259,_0xd33d03=a0_0x2b4667(0x121)){const _0x24a7c0=a0_0x2b4667;return Y({'alias':_0x428c90,'fromAlias':this[_0x24a7c0(0x131)]},{'log':_0x29c2a6=>console[_0x24a7c0(0xdf)](_0x29c2a6),'send':()=>this['call'](_0x24a7c0(0xbd),{'alias':_0x428c90,'task':_0x183259,'priority':_0xd33d03,'from_session':this[_0x24a7c0(0x131)]})});}async[a0_0x2b4667(0x120)](_0x1d2f64,_0x2a5afe){const _0x546c02=a0_0x2b4667;return this[_0x546c02(0x135)](_0x546c02(0x112),{'alias':_0x1d2f64,'message':_0x2a5afe,'from_session':this[_0x546c02(0x131)]});}async[a0_0x2b4667(0x101)](_0xe1c92d,_0x3c928f,_0x3e245e=a0_0x2b4667(0xf3)){const _0x26e87f=a0_0x2b4667;return this[_0x26e87f(0x135)](_0x26e87f(0x136),{'in_reply_to':_0xe1c92d,'text':_0x3c928f,'status':_0x3e245e});}async[a0_0x2b4667(0xc5)](_0x56cd81,_0x4a84d2){const _0x5eff87=a0_0x2b4667;return this[_0x5eff87(0x135)](_0x5eff87(0xbb),{'resume_id':this['resumeId'],'alias':this[_0x5eff87(0x131)],'status':_0x56cd81,'server':a0_0x10acf7(),'hostname':a0_0x10acf7(),'agent':this['agent'],'project_dir':process['cwd'](),..._0x4a84d2});}async[a0_0x2b4667(0xbe)](){const _0x4ceb76=a0_0x2b4667;return this[_0x4ceb76(0x135)](_0x4ceb76(0x115),{});}async['broadcast'](_0x346c07,_0x58e48f){const _0x4447bc=a0_0x2b4667;return this['call'](_0x4447bc(0x118),{'message':_0x346c07,'filter_server':_0x58e48f?.['server'],'filter_status':_0x58e48f?.[_0x4447bc(0xc5)]});}async[a0_0x2b4667(0x12c)](){const _0x140660=a0_0x2b4667;let _0x91af80=encodeURIComponent(this[_0x140660(0x131)]),_0xec7f36=this['url']+'/events/'+_0x91af80,_0x20f615=this[_0x140660(0xdc)];while(this[_0x140660(0xbc)]){try{this[_0x140660(0xce)]=new AbortController();let _0x1f91d6={'Accept':_0x140660(0x11a)};if(this[_0x140660(0x10c)])_0x1f91d6[_0x140660(0x11d)]='Bearer\x20'+this[_0x140660(0x10c)];let _0x1e84fa=await fetch(_0xec7f36,{'headers':_0x1f91d6,'signal':this[_0x140660(0xce)]['signal']});if(!_0x1e84fa['ok']||!_0x1e84fa[_0x140660(0xf7)]){this[_0x140660(0xdf)]('SSE\x20failed:\x20'+_0x1e84fa[_0x140660(0xc5)]),await this[_0x140660(0x10e)](_0x20f615),_0x20f615=Math[_0x140660(0x104)](_0x20f615*1.5,0xea60);continue;}_0x20f615=this['reconnectDelay'];let _0x110cda=_0x1e84fa['body'][_0x140660(0x137)](),_0x38e757=new TextDecoder(),_0x50c4c5='';while(this[_0x140660(0xbc)]){let {done:_0xd65249,value:_0x48d4fd}=await _0x110cda['read']();if(_0xd65249)break;_0x50c4c5+=_0x38e757[_0x140660(0xe9)](_0x48d4fd,{'stream':!0x0});let _0x33ce16=_0x50c4c5[_0x140660(0xc0)]('\x0a');_0x50c4c5=_0x33ce16[_0x140660(0xc7)]()||'';for(let _0x40ace3 of _0x33ce16){if(!_0x40ace3[_0x140660(0xd1)](_0x140660(0x12d)))continue;try{let _0x5e978f=JSON['parse'](_0x40ace3[_0x140660(0x10f)](0x6));if(_0x5e978f[_0x140660(0xee)]===_0x140660(0x124)){this[_0x140660(0xdf)](_0x140660(0xf9)),this[_0x140660(0xcd)](_0x140660(0x124));continue;}if(_0x5e978f[_0x140660(0xee)]===_0x140660(0xcb)||_0x5e978f['type']==='new_message'||_0x5e978f[_0x140660(0xee)]===_0x140660(0x118))await this[_0x140660(0xe7)]();}catch{}}}}catch(_0x2ba21b){if(_0x2ba21b[_0x140660(0x11e)]===_0x140660(0xfc))break;this[_0x140660(0xcd)](_0x140660(0x111),_0x2ba21b),this['log'](_0x140660(0xc1)+_0x2ba21b['message']);}if(this[_0x140660(0xbc)])this[_0x140660(0xcd)](_0x140660(0xe6)),this[_0x140660(0xdf)](_0x140660(0x138)+_0x20f615/0x3e8+_0x140660(0xbf)),await this['sleep'](_0x20f615),_0x20f615=Math[_0x140660(0x104)](_0x20f615*1.5,0xea60);}}async['processInbox'](){const _0x2e9632=a0_0x2b4667;try{let _0x4a8a95=(await this['call'](_0x2e9632(0xd4),{'alias':this[_0x2e9632(0x131)],'limit':0xa}))?.['messages']||[];for(let _0x47c9c1 of _0x4a8a95)await this['call'](_0x2e9632(0x12f),{'alias':this[_0x2e9632(0x131)],'message_id':_0x47c9c1['id']}),this[_0x2e9632(0xdf)]('←\x20'+_0x47c9c1[_0x2e9632(0xf4)]+':\x20'+_0x47c9c1['content'][_0x2e9632(0x10f)](0x0,0x3c)),this['emit'](_0x2e9632(0xe0),_0x47c9c1),this[_0x2e9632(0xcd)](_0x2e9632(0x120),_0x47c9c1);}catch(_0x219806){this[_0x2e9632(0xdf)](_0x2e9632(0xe4)+_0x219806['message']);}}[a0_0x2b4667(0x10e)](_0x1c81a2){return new Promise(_0x1e572d=>setTimeout(_0x1e572d,_0x1c81a2));}}var F=$;export{F as default,$ as CommHub};function a0_0x54b6(){const _0x11ed58=['startsWith','toAlias','1892615QYgPWy','get_inbox','agent','task.ack','<unknown>','\x20network_id=','replace','12066372xTcWHd','connect','reconnectDelay','transport','heartbeatInterval','log','task','disconnect','78XFnEaW','heartbeat\x20failed:\x20','inbox\x20error:\x20','error_message','disconnected','processInbox','now','decode','json','<missing>','offline','task.send.start','type','CommHub\x20response\x20omitted\x20task_id','fromAlias','task.send.failed','[REDACTED]','completed','from_session','16457QoWVXx','\x20lifecycle=','body','url','SSE\x20connected','tools/call','message_id','AbortError','1404675WQgPAU','\x20duration_ms=','/mcp','\x20task_id=','reply','autoConnect','task.replied','min','missing_task_id','duration_ms','catch','toString','parse','task_id','task.started','token','send_failed','sleep','slice','content','error','send_message','send_rejected','to_alias','get_all_status','toTimeString','send','broadcast','sdk-','text/event-stream','4Umzxtc','networkId','Authorization','name','stringify','message','normal','from_alias','string','connected','heartbeatTimer','network_id','failed','<pending>','lifecycleTracking','1756376WUCfxS','POST','connectSSE','data:\x20','text','ack_inbox','2.0','alias','parentTaskId','\x20transport=','idle','call','send_reply','getReader','SSE\x20reconnecting\x20in\x20','unknown\x20error','\x20parent_task_id=',']\x20[commhub:','result','report_status','running','send_task','getAllStatus','s...','split','SSE\x20error:\x20','not_tracked','652280kbqGIm','803925sUnTkh','status','parent_task_id','pop','task.send.delivered','sdk','error_code','new_task','CommHub\x20rejected\x20task','emit','sseAbort','resumeId','\x20to='];a0_0x54b6=function(){return _0x11ed58;};return a0_0x54b6();}
|
|
@@ -3,7 +3,64 @@ export interface CodexCopresenceProfileFields {
|
|
|
3
3
|
readonly codexCopresence?: boolean;
|
|
4
4
|
readonly codexCopresenceFullAccess?: boolean;
|
|
5
5
|
readonly flags?: Record<string, unknown>;
|
|
6
|
+
/** Absolute project directory to launch the codex TUI in. Passed as
|
|
7
|
+
* `-C <dir>` to `codex resume`. Also cross-checked against hub-reported
|
|
8
|
+
* `session.project_dir` in Phase 4.3. */
|
|
9
|
+
readonly codexProjectDir?: string;
|
|
10
|
+
/** Which launch adapter to use in Phase 3.2. `"codex-standard"` = stock
|
|
11
|
+
* `codex app-server` + `codex resume`; `"codex-custom-wrapper"` = TMHR狗-class
|
|
12
|
+
* custom LLM API wrapper (hosted tool / compaction / image-output compat).
|
|
13
|
+
* Unknown / absent → Phase 0 fail-closed (unknown adapters must not fall
|
|
14
|
+
* through to a default that might not fit the node's real topology). */
|
|
15
|
+
readonly codexLaunchAdapter?: "codex-standard" | "codex-custom-wrapper";
|
|
16
|
+
/** Alias of the peer that will verify this node's identity in Phase 6.
|
|
17
|
+
* Peer MUST be (a) registered in the same network, (b) online at resume
|
|
18
|
+
* time, (c) not this node itself. Identity attestation uses a fresh
|
|
19
|
+
* Hub outbound `send_task` from THIS node's Bridge to <codexProbePeer>
|
|
20
|
+
* carrying a nonce; peer echoes the nonce back; CLI cross-checks Hub's
|
|
21
|
+
* recorded `from_name / from_node_id / to_name / to_node_id`.
|
|
22
|
+
*
|
|
23
|
+
* 🔴 self-loop is deliberately not accepted here — it cannot prove
|
|
24
|
+
* cross-node routing closure (design v7 Phase 6 = D, per TMHR
|
|
25
|
+
* 06cfb29a). Single-node users cannot run `anet node resume` in
|
|
26
|
+
* this initial cut; tracked at #1527. */
|
|
27
|
+
readonly codexProbePeer?: string;
|
|
6
28
|
}
|
|
29
|
+
/** #1521 — the three fields `anet node resume <alias>` will require on a
|
|
30
|
+
* codex-copresence node once the resume dispatcher lands (#1528, Draft).
|
|
31
|
+
* In this PR, only shape-level enumeration exists (see
|
|
32
|
+
* `missingCodexResumeFields` below); no CLI code reads that enumeration
|
|
33
|
+
* and the operator-facing remediation flow is deliberately deferred
|
|
34
|
+
* along with its real caller. */
|
|
35
|
+
export type CodexResumeRequiredField = "codexProjectDir" | "codexLaunchAdapter" | "codexProbePeer";
|
|
36
|
+
export declare const CODEX_RESUME_REQUIRED_FIELDS: readonly CodexResumeRequiredField[];
|
|
37
|
+
/** Enumerate which of the three resume-required fields are absent /
|
|
38
|
+
* wrong-shaped on this profile. Returns [] when all three are present
|
|
39
|
+
* and well-shaped.
|
|
40
|
+
*
|
|
41
|
+
* 🔴 SHAPE-ONLY validation:
|
|
42
|
+
* - codexProjectDir : string starting with `/`. This is a CHEAP typo
|
|
43
|
+
* filter, NOT the security gate. Phase 0 (in #1528) MUST additionally
|
|
44
|
+
* `realpath`/canonicalize + reject NUL, `/`, and any untrusted target
|
|
45
|
+
* before passing this value to `codex resume -C <dir>` (per TMHR
|
|
46
|
+
* 4bab8196: "startsWith('/') 不是最终安全门").
|
|
47
|
+
* - codexLaunchAdapter : enum membership.
|
|
48
|
+
* - codexProbePeer : Hub exact-alias lookup, so value MUST equal its own
|
|
49
|
+
* trim. Values with leading/trailing whitespace would fail Hub lookup
|
|
50
|
+
* 100% of the time; rejecting them at the shape layer is a witnessed-red
|
|
51
|
+
* canary rather than a permissive pass-through (per TMHR 048d0061 R2:
|
|
52
|
+
* "不要 pin 一个必然在 Hub exact lookup 阶段失败的 well-shaped 值").
|
|
53
|
+
* Liveness (registered + online + non-self) is a separate hub-side
|
|
54
|
+
* check in Phase 0.
|
|
55
|
+
*
|
|
56
|
+
* Deliberately NOT included: an operator-facing diagnostic helper. An
|
|
57
|
+
* earlier draft included `codexResumeMissingConfigHint` that referenced
|
|
58
|
+
* a `anet node config apply` verb which does not exist in the tree —
|
|
59
|
+
* TMHR 4bab8196 blocked it as the exact "存在 ≠ 会执行" antipattern.
|
|
60
|
+
* The diagnostic lands with its real caller in a later PR that either
|
|
61
|
+
* (a) implements `anet node config apply` first, or (b) reworks the
|
|
62
|
+
* diagnostic to reference existing commands only. */
|
|
63
|
+
export declare function missingCodexResumeFields(profile: CodexCopresenceProfileFields): CodexResumeRequiredField[];
|
|
7
64
|
export declare const CODEX_COPRESENCE_RUNTIME = "codex-app-server";
|
|
8
65
|
/**
|
|
9
66
|
* Should this `anet node start` bring up the co-presence stack?
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/** hub `/api/host-supervisors` 里与本主题相关的那几格。全部可缺席。 */
|
|
2
|
+
export type DaemonCapabilityRow = {
|
|
3
|
+
readonly alias?: string;
|
|
4
|
+
readonly online?: boolean;
|
|
5
|
+
/** hub 侧的最后一次心跳(ISO 串或 epoch ms)。缺席则年龄无法计算。 */
|
|
6
|
+
readonly last_seen_at?: string | number | null;
|
|
7
|
+
readonly can_create_nodes?: boolean;
|
|
8
|
+
readonly create_nodes_blocked_reason?: string;
|
|
9
|
+
/** #1545 —— 上面那一格是**这份 report 发出前多少毫秒**测的。 */
|
|
10
|
+
readonly create_capability_observed_ms_ago?: number;
|
|
11
|
+
};
|
|
12
|
+
export type CapabilityView =
|
|
13
|
+
/** hub 上根本没有这一格 —— 旧 daemon(preview.55 之前)不上报。 */
|
|
14
|
+
{
|
|
15
|
+
readonly kind: "never-reported";
|
|
16
|
+
readonly line: string;
|
|
17
|
+
}
|
|
18
|
+
/** 报了 ready/blocked,且知道是多久以前测的。 */
|
|
19
|
+
| {
|
|
20
|
+
readonly kind: "ready" | "blocked";
|
|
21
|
+
readonly ageMs: number;
|
|
22
|
+
readonly line: string;
|
|
23
|
+
readonly fix?: CapabilityFix;
|
|
24
|
+
}
|
|
25
|
+
/** 报了 ready/blocked,但**不知道是什么时候测的**(旧 daemon 开机只算一次)。 */
|
|
26
|
+
| {
|
|
27
|
+
readonly kind: "ready-age-unknown" | "blocked-age-unknown";
|
|
28
|
+
readonly line: string;
|
|
29
|
+
readonly fix?: CapabilityFix;
|
|
30
|
+
};
|
|
31
|
+
/** 🔴 修法**按 code 给,不按上游的 detail 给**。
|
|
32
|
+
*
|
|
33
|
+
* 上游 `unsafePathHelp()` 生成的 `Fix:` 那半带完整机器路径,而它**按设计不上报**
|
|
34
|
+
* (那条会一路走到 Dashboard,「哪台机器的哪个路径缺什么」本身就是一张地图)。
|
|
35
|
+
* 所以跨机器读到的只有 code,这里给的必然是**不含机器路径的通用修法**。
|
|
36
|
+
*
|
|
37
|
+
* 🔴 四类的修法完全不同,混成一句会让人修错方向 —— 2026-08-28 有人一天里撞到
|
|
38
|
+
* 其中两类,看到的是同一条错误,第一反应跑去建 /etc/anet-daemon/path.conf,
|
|
39
|
+
* 而那次实际只要 chmod。
|
|
40
|
+
*
|
|
41
|
+
* 想要**带真实路径的那一份**,只能在那台机器上看它自己的 daemon 日志 ——
|
|
42
|
+
* 下面每条都会把人指过去。 */
|
|
43
|
+
export type CapabilityFix = {
|
|
44
|
+
/** 人读的一句话:这一类是什么、为什么会这样。 */
|
|
45
|
+
readonly explain: string;
|
|
46
|
+
/** 🔴 **可以整行粘进终端**的命令,或 null(这一类没有单条命令能修)。
|
|
47
|
+
*
|
|
48
|
+
* 分成两格而不是拼成一句,是因为拼起来之后**没有一条能通过 `bash -n`** ——
|
|
49
|
+
* 中文说明和括号注释会被 shell 当成语法。#1521 修过完全同一个形状:
|
|
50
|
+
* 当时 anet_bin_source 的 Fix 串 `bash -n` rc=2(`$( )` 里的 `\"` 是语法错),
|
|
51
|
+
* 用户粘进去只看到 `syntax error near unexpected token '('`。
|
|
52
|
+
* **一条"看起来是命令"的说明,比没有命令更糟。** */
|
|
53
|
+
readonly command: string | null;
|
|
54
|
+
};
|
|
55
|
+
/** 把毫秒渲染成人读的相对时间。**不做四舍五入到"刚刚"** ——
|
|
56
|
+
* 这一格存在的意义就是分辨新鲜和陈旧,含糊化等于把它的功能删掉。 */
|
|
57
|
+
export declare function formatAge(ms: number): string;
|
|
58
|
+
export declare function describeCapability(row: DaemonCapabilityRow, nowMs: number): CapabilityView;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var J=Object.freeze({anet_bin_identity:{explain:"该路径不是 anet 的包内 bin(若设过 ANET_BIN_ABS,先 unset 再重装)",command:"npm i -g @sleep2agi/agent-network"},anet_bin_source:{explain:"pin 没有可信来源。在该机器上写信任根 —— 两段都要 sudo,少一个 && 就会断链",command:`sudo install -d -m 755 /etc/anet-daemon && printf 'ANET_BIN_ABS=%s
|
|
2
|
+
' "$(command -v anet)" | sudo tee /etc/anet-daemon/path.conf`},anet_bin_permission:{explain:"该二进制 group/other 可写。一行就能修",command:'chmod go-w "$(command -v anet)"'},anet_bin_shape:{explain:"pin 的路径形态不合法(相对路径,或路径里含软链)。取它的 realpath 重新写进 path.conf",command:'readlink -f "$(command -v anet)"'},anet_bin_unknown:{explain:"daemon 没能给出类别(例如安装后二进制被换过、校验和不符)。只能看该机器的 daemon 日志取原文",command:null},anet_bin_pin_unresolved:{explain:"旧版 daemon(preview.40 及更早)只报这一个笼统原因。升级该机器的 agent-node 后才能拿到具体类别",command:null}});function G(c){if(!Number.isFinite(c)||c<0)return"?";if(c<1000)return`${Math.round(c)}ms 前`;let j=Math.floor(c/1000);if(j<60)return`${j}s 前`;let q=Math.floor(j/60);if(q<60)return`${q}m 前`;let k=Math.floor(q/60);if(k<24)return`${k}h 前`;return`${Math.floor(k/24)}d 前`}function K(c){if(typeof c==="number"&&Number.isFinite(c))return c;if(typeof c==="string"){let j=Date.parse(c);if(Number.isFinite(j))return j}return}function Q(c,j){if(typeof c.can_create_nodes!=="boolean")return{kind:"never-reported",line:"创建能力:未知 —— 这台 daemon 没报过这一格(agent-node 版本早于 preview.55)。升级它才能看到。"};let q=K(c.last_seen_at),k=c.create_capability_observed_ms_ago,u=q!==void 0&&typeof k==="number"&&Number.isFinite(k)?Math.max(0,j-q)+k:void 0;if(c.can_create_nodes){if(u===void 0)return{kind:"ready-age-unknown",line:"创建能力:可用,但**不知道是什么时候测的** —— 该 daemon 版本在开机时算一次就不再重测。重启它、或升级到会带年龄的版本。"};return{kind:"ready",ageMs:u,line:`创建能力:可用(${G(u)}测)`}}let C=c.create_nodes_blocked_reason||"anet_bin_unknown",z=J[C]??{explain:`未知原因代码 ${C} —— 本 CLI 可能比那台机器的 anet 旧,升级本机 anet 或看它的 daemon 日志`,command:null},H="完整原文(含真实路径)只在那台机器的 daemon 日志里 —— 它带机器路径,按设计不上报。",D=[` 原因:${z.explain}`,z.command?` 修法(可整行粘贴):${z.command}`:" 修法:没有单条命令能修,见上。",` ${H}`].join(`
|
|
3
|
+
`);if(u===void 0)return{kind:"blocked-age-unknown",line:`创建能力:**不可用**(${C}),但**不知道是什么时候测的** —— 该 daemon 版本开机只算一次。
|
|
4
|
+
${D}`,fix:z};return{kind:"blocked",ageMs:u,line:`创建能力:**不可用**(${C},${G(u)}测)
|
|
5
|
+
${D}`,fix:z}}export{G as formatAge,Q as describeCapability};
|