@sleep2agi/agent-network 2.3.0-preview.43 → 2.3.0-preview.45
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/channel-meta.d.ts +10 -0
- package/dist/src/client.js +1 -1
- package/dist/src/codex-copresence-recovery.d.ts +43 -0
- package/dist/src/commhub-response.d.ts +1 -0
- package/dist/src/im/feishu/worker.js +1 -1
- package/dist/src/node-server.js +7 -7
- package/dist/src/opencode-agent-node-pair.d.ts +14 -3
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** One inbound inbox row → the meta Claude Code renders as `<channel …>` attrs.
|
|
2
|
+
*
|
|
3
|
+
* Pure so the attribute set is assertable; it used to be inline in the SSE
|
|
4
|
+
* handler, where nothing could see it. */
|
|
5
|
+
export declare function inboundChannelMeta(msg: {
|
|
6
|
+
id: string;
|
|
7
|
+
from_session?: string | null;
|
|
8
|
+
priority?: string | null;
|
|
9
|
+
created_at?: string | null;
|
|
10
|
+
}): Record<string, string>;
|
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x2f352f=a0_0x5124;(function(_0x5322a3,_0x2af4e8){const _0x598ce0=a0_0x5124,_0x5654cc=_0x5322a3();while(!![]){try{const _0x6cb459=-parseInt(_0x598ce0(0x169))/0x1+parseInt(_0x598ce0(0x18e))/0x2*(parseInt(_0x598ce0(0x18d))/0x3)+-parseInt(_0x598ce0(0x16e))/0x4+-parseInt(_0x598ce0(0x181))/0x5+parseInt(_0x598ce0(0x147))/0x6*(parseInt(_0x598ce0(0x13c))/0x7)+parseInt(_0x598ce0(0x12f))/0x8+parseInt(_0x598ce0(0x195))/0x9;if(_0x6cb459===_0x2af4e8)break;else _0x5654cc['push'](_0x5654cc['shift']());}catch(_0x21337b){_0x5654cc['push'](_0x5654cc['shift']());}}}(a0_0xab51,0x39e97));import{EventEmitter as a0_0x250d64}from'events';import{hostname as a0_0x5f39bf}from'os';function a0_0x5124(_0x304534,_0x4fb9e3){_0x304534=_0x304534-0x125;const _0xab51b0=a0_0xab51();let _0x512471=_0xab51b0[_0x304534];return _0x512471;}var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x2ba7d3,_0x60a6e2)=>(_0x2ba7d3??_0x60a6e2)[a0_0x2f352f(0x141)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x2f352f(0x179)](0x0,0xf0);function N(_0x2cba3a){const _0x32decb=a0_0x2f352f;return(_0x2cba3a instanceof Error?_0x2cba3a[_0x32decb(0x18f)]:String(_0x2cba3a??_0x32decb(0x13b)))['replace'](K,_0x32decb(0x12d))[_0x32decb(0x141)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x32decb(0x179)](0x0,0xf0);}function a0_0xab51(){const _0x3b9d02=['replace','toTimeString','task.send.start','processInbox','<unknown>','sending','24OwFUcn','\x20task_id=','lifecycle_tracking','log','catch','s...','network_id','connectSSE','type','failed','parse','error','text/event-stream','token','abort','send_task',']\x20[commhub:','CommHub\x20response\x20omitted\x20task_id','emit','call','send','read','server','SSE\x20failed:\x20','\x20from=','heartbeat\x20failed:\x20','parentTaskId','2.0','task.replied','autoConnect','disconnected','error_message','decode','completed','283405FRGtCh','broadcast','<pending>','mcp_http','missing_task_id','541068oJIoKH','/events/','normal','task.send.delivered','alias','startsWith','connect','AbortError','get_inbox','from_session','string','slice','new_task','report_status','SSE\x20error:\x20','send_reply','task','heartbeatTimer','sdk','2023595HaQdmL','connected','tools/call','agent','running','\x20network_id=','to_alias','parent_task_id','SSE\x20connected','signal','name','reconnectDelay','6QSltkM','110056CSspmM','message','not_tracked','stringify','send_message','application/json','reply','7974189uHlXZu','\x20to=','task_id','CommHub\x20rejected\x20task','status','Bearer\x20','sseAbort','body','task.ack','getAllStatus','result','get_all_status','[commhub:task]\x20','now','error_code','networkId','heartbeatInterval','pop','idle','registered','ack_inbox','send_failed','match','split','[REDACTED]','\x20lifecycle=','74120zQtgFu','transport','text','resumeId','content','sleep','\x20parent_task_id=','SSE\x20reconnecting\x20in\x20','data:\x20','cwd','task.started','/mcp','unknown\x20error','96698yuVdtY','url','fromAlias','min','\x20transport='];a0_0xab51=function(){return _0x3b9d02;};return a0_0xab51();}function O(_0x13c579,_0x11f28c=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x5c9387=a0_0x2f352f;if(_0x11f28c)return JSON['stringify'](_0x13c579);let _0x76accb=L(_0x13c579[_0x5c9387(0x188)],'<missing>'),_0x20da8b=L(_0x13c579['task_id'],_0x5c9387(0x16b)),_0x9c1fce=_0x13c579[_0x5c9387(0x1a3)]?'\x20error='+_0x13c579[_0x5c9387(0x1a3)]+':'+(_0x13c579[_0x5c9387(0x166)]??''):'';return _0x5c9387(0x1a1)+_0x13c579['status']+_0x5c9387(0x15f)+L(_0x13c579['from_alias'],_0x5c9387(0x145))+_0x5c9387(0x196)+L(_0x13c579[_0x5c9387(0x187)],_0x5c9387(0x145))+_0x5c9387(0x148)+_0x20da8b+_0x5c9387(0x135)+_0x76accb+_0x5c9387(0x186)+L(_0x13c579[_0x5c9387(0x14d)],_0x5c9387(0x145))+_0x5c9387(0x140)+_0x13c579[_0x5c9387(0x130)]+'\x20duration_ms='+_0x13c579['duration_ms']+_0x5c9387(0x12e)+_0x13c579[_0x5c9387(0x149)]+_0x9c1fce;}function U(_0x3f41f1){const _0x2536b8=a0_0x2f352f;return{'event':{'sending':_0x2536b8(0x143),'delivered':_0x2536b8(0x171),'failed':'task.send.failed','acked':_0x2536b8(0x19d),'started':_0x2536b8(0x139),'replied':_0x2536b8(0x163),'expired':'task.expired'}[_0x3f41f1[_0x2536b8(0x199)]],..._0x3f41f1};}function j(_0x1a0dc3){const _0x817e31=a0_0x2f352f;let _0x44fc44=_0x1a0dc3?.[_0x817e31(0x197)]||_0x1a0dc3?.['message_id']||_0x1a0dc3?.['id'];if(_0x44fc44)return String(_0x44fc44);let _0x190fbc=_0x1a0dc3?.['content']?.[0x0]?.[_0x817e31(0x131)];if(typeof _0x190fbc!==_0x817e31(0x178))return null;try{let _0x1dd041=JSON[_0x817e31(0x151)](_0x190fbc);return _0x1dd041?.[_0x817e31(0x197)]||_0x1dd041?.['message_id']||_0x1dd041?.['id']||null;}catch{return null;}}async function X(_0x599cbb,_0x549076){const _0x32f9fe=a0_0x2f352f;let _0x29f670=_0x549076[_0x32f9fe(0x1a2)]??Date[_0x32f9fe(0x1a2)],_0x423360=_0x29f670(),_0x288558=(_0x53841d,_0x1a021c,_0x30cad3,_0x2ec669)=>{const _0x42c272=_0x32f9fe;_0x549076[_0x42c272(0x14a)](O(U({'from_alias':_0x599cbb[_0x42c272(0x13e)],'to_alias':_0x599cbb['toAlias'],'task_id':_0x1a021c,'parent_task_id':_0x599cbb[_0x42c272(0x161)],'network_id':_0x599cbb[_0x42c272(0x1a4)],'transport':_0x599cbb[_0x42c272(0x130)],'status':_0x53841d,'duration_ms':_0x29f670()-_0x423360,'lifecycle_tracking':_0x599cbb['lifecycleTracking'],..._0x30cad3!==void 0x0?{'error_code':_0x2ec669||'send_failed','error_message':N(_0x30cad3)}:{}})));};_0x288558(_0x32f9fe(0x146),null);try{let _0x2fccbe=await _0x549076[_0x32f9fe(0x15b)](),_0x3b957f=j(_0x2fccbe);if(_0x3b957f)_0x288558('delivered',_0x3b957f);else{if(_0x2fccbe?.['ok']===!0x1||_0x2fccbe?.['error'])_0x288558(_0x32f9fe(0x150),_0x3b957f,_0x2fccbe?.[_0x32f9fe(0x152)]||_0x32f9fe(0x198),'send_rejected');else _0x288558('failed',null,_0x32f9fe(0x158),_0x32f9fe(0x16d));}return _0x2fccbe;}catch(_0x17ede5){throw _0x288558(_0x32f9fe(0x150),null,_0x17ede5,_0x32f9fe(0x12a)),_0x17ede5;}}async function Y(_0x32d69b,_0x39bd39){const _0x17f6d5=a0_0x2f352f;return X({'fromAlias':_0x32d69b[_0x17f6d5(0x13e)],'toAlias':_0x32d69b[_0x17f6d5(0x172)],'parentTaskId':_0x32d69b[_0x17f6d5(0x161)]||null,'networkId':_0x32d69b[_0x17f6d5(0x1a4)]||null,'transport':_0x17f6d5(0x16c),'lifecycleTracking':_0x17f6d5(0x190)},_0x39bd39);}class $ extends a0_0x250d64{[a0_0x2f352f(0x13d)];[a0_0x2f352f(0x172)];[a0_0x2f352f(0x154)];[a0_0x2f352f(0x184)];[a0_0x2f352f(0x132)];[a0_0x2f352f(0x125)];['reconnectDelay'];[a0_0x2f352f(0x17f)];['sseAbort'];[a0_0x2f352f(0x185)]=!0x1;constructor(_0x2f315d){const _0x1d4b1a=a0_0x2f352f;super();if(this[_0x1d4b1a(0x13d)]=_0x2f315d[_0x1d4b1a(0x13d)][_0x1d4b1a(0x141)](/\/$/,''),this[_0x1d4b1a(0x172)]=_0x2f315d[_0x1d4b1a(0x172)],this[_0x1d4b1a(0x154)]=_0x2f315d[_0x1d4b1a(0x154)],this['agent']=_0x2f315d[_0x1d4b1a(0x184)]||_0x1d4b1a(0x180),this['resumeId']='sdk-'+_0x2f315d[_0x1d4b1a(0x172)]+'-'+Date[_0x1d4b1a(0x1a2)]()['toString'](0x24),this[_0x1d4b1a(0x125)]=_0x2f315d[_0x1d4b1a(0x125)]??0x2bf20,this[_0x1d4b1a(0x18c)]=_0x2f315d[_0x1d4b1a(0x18c)]??0xbb8,_0x2f315d[_0x1d4b1a(0x164)]!==!0x1)this['connect']();}['log'](_0x4237c5){const _0x17fd54=a0_0x2f352f;console[_0x17fd54(0x14a)]('['+new Date()[_0x17fd54(0x142)]()[_0x17fd54(0x179)](0x0,0x8)+_0x17fd54(0x157)+this[_0x17fd54(0x172)]+']\x20'+_0x4237c5);}async['call'](_0x21c3d0,_0x5a243a){const _0x3eada9=a0_0x2f352f;let _0x292040={'Content-Type':_0x3eada9(0x193),'Accept':'application/json,\x20text/event-stream'};if(this[_0x3eada9(0x154)])_0x292040['Authorization']=_0x3eada9(0x19a)+this[_0x3eada9(0x154)];let _0xae887d=await(await fetch(this['url']+_0x3eada9(0x13a),{'method':'POST','headers':_0x292040,'body':JSON[_0x3eada9(0x191)]({'jsonrpc':_0x3eada9(0x162),'id':Date[_0x3eada9(0x1a2)](),'method':_0x3eada9(0x183),'params':{'name':_0x21c3d0,'arguments':_0x5a243a}})}))[_0x3eada9(0x131)](),_0x580008=_0xae887d[_0x3eada9(0x12b)](/data: (.+)/),_0x33806c=_0x580008?JSON[_0x3eada9(0x151)](_0x580008[0x1]):JSON['parse'](_0xae887d),_0x105b5f=_0x33806c?.[_0x3eada9(0x19f)]?.[_0x3eada9(0x133)]?.[0x0]?.[_0x3eada9(0x131)];return _0x105b5f?JSON[_0x3eada9(0x151)](_0x105b5f):_0x33806c;}async[a0_0x2f352f(0x174)](){const _0x1806d8=a0_0x2f352f;if(this['running'])return;this[_0x1806d8(0x185)]=!0x0,await this[_0x1806d8(0x199)]('idle'),this[_0x1806d8(0x14a)](_0x1806d8(0x128)),this[_0x1806d8(0x17f)]=setInterval(()=>{const _0x1854cc=_0x1806d8;this[_0x1854cc(0x199)](_0x1854cc(0x127))[_0x1854cc(0x14b)](_0x3fff56=>this[_0x1854cc(0x14a)](_0x1854cc(0x160)+_0x3fff56[_0x1854cc(0x18f)]));},this['heartbeatInterval']),this[_0x1806d8(0x14e)]();}async['disconnect'](){const _0x24b178=a0_0x2f352f;if(this[_0x24b178(0x185)]=!0x1,this[_0x24b178(0x19b)]?.[_0x24b178(0x155)](),this[_0x24b178(0x17f)])clearInterval(this[_0x24b178(0x17f)]);await this['status']('offline')[_0x24b178(0x14b)](()=>{}),this[_0x24b178(0x14a)](_0x24b178(0x165));}async[a0_0x2f352f(0x15b)](_0x56c25b,_0x5194f3,_0x1395c3=a0_0x2f352f(0x170)){const _0x579c7d=a0_0x2f352f;return Y({'alias':_0x56c25b,'fromAlias':this['alias']},{'log':_0xf88e9b=>console['log'](_0xf88e9b),'send':()=>this['call'](_0x579c7d(0x156),{'alias':_0x56c25b,'task':_0x5194f3,'priority':_0x1395c3,'from_session':this[_0x579c7d(0x172)]})});}async[a0_0x2f352f(0x18f)](_0x55a2f4,_0x1301b1){const _0x59ccb7=a0_0x2f352f;return this['call'](_0x59ccb7(0x192),{'alias':_0x55a2f4,'message':_0x1301b1,'from_session':this[_0x59ccb7(0x172)]});}async[a0_0x2f352f(0x194)](_0x26c9c3,_0x207af6,_0x181df0=a0_0x2f352f(0x168)){const _0x13acc2=a0_0x2f352f;return this['call'](_0x13acc2(0x17d),{'in_reply_to':_0x26c9c3,'text':_0x207af6,'status':_0x181df0});}async[a0_0x2f352f(0x199)](_0x3d0d26,_0x127868){const _0x59266b=a0_0x2f352f;return this['call'](_0x59266b(0x17b),{'resume_id':this[_0x59266b(0x132)],'alias':this[_0x59266b(0x172)],'status':_0x3d0d26,'server':a0_0x5f39bf(),'hostname':a0_0x5f39bf(),'agent':this['agent'],'project_dir':process[_0x59266b(0x138)](),..._0x127868});}async[a0_0x2f352f(0x19e)](){const _0x104267=a0_0x2f352f;return this[_0x104267(0x15a)](_0x104267(0x1a0),{});}async['broadcast'](_0x467140,_0xf53abf){const _0x5e5cc0=a0_0x2f352f;return this[_0x5e5cc0(0x15a)](_0x5e5cc0(0x16a),{'message':_0x467140,'filter_server':_0xf53abf?.[_0x5e5cc0(0x15d)],'filter_status':_0xf53abf?.['status']});}async[a0_0x2f352f(0x14e)](){const _0x2c33e2=a0_0x2f352f;let _0x16f188=encodeURIComponent(this['alias']),_0x989910=this[_0x2c33e2(0x13d)]+_0x2c33e2(0x16f)+_0x16f188,_0x525266=this[_0x2c33e2(0x18c)];while(this[_0x2c33e2(0x185)]){try{this[_0x2c33e2(0x19b)]=new AbortController();let _0x2332ba={'Accept':_0x2c33e2(0x153)};if(this[_0x2c33e2(0x154)])_0x2332ba['Authorization']=_0x2c33e2(0x19a)+this['token'];let _0x235351=await fetch(_0x989910,{'headers':_0x2332ba,'signal':this[_0x2c33e2(0x19b)][_0x2c33e2(0x18a)]});if(!_0x235351['ok']||!_0x235351['body']){this[_0x2c33e2(0x14a)](_0x2c33e2(0x15e)+_0x235351[_0x2c33e2(0x199)]),await this['sleep'](_0x525266),_0x525266=Math[_0x2c33e2(0x13f)](_0x525266*1.5,0xea60);continue;}_0x525266=this[_0x2c33e2(0x18c)];let _0x171bb3=_0x235351[_0x2c33e2(0x19c)]['getReader'](),_0x1823bb=new TextDecoder(),_0x4790b2='';while(this['running']){let {done:_0x193d14,value:_0x3ab86e}=await _0x171bb3[_0x2c33e2(0x15c)]();if(_0x193d14)break;_0x4790b2+=_0x1823bb[_0x2c33e2(0x167)](_0x3ab86e,{'stream':!0x0});let _0x385b33=_0x4790b2[_0x2c33e2(0x12c)]('\x0a');_0x4790b2=_0x385b33[_0x2c33e2(0x126)]()||'';for(let _0x296318 of _0x385b33){if(!_0x296318[_0x2c33e2(0x173)](_0x2c33e2(0x137)))continue;try{let _0x222815=JSON[_0x2c33e2(0x151)](_0x296318[_0x2c33e2(0x179)](0x6));if(_0x222815[_0x2c33e2(0x14f)]===_0x2c33e2(0x182)){this[_0x2c33e2(0x14a)](_0x2c33e2(0x189)),this[_0x2c33e2(0x159)](_0x2c33e2(0x182));continue;}if(_0x222815['type']===_0x2c33e2(0x17a)||_0x222815[_0x2c33e2(0x14f)]==='new_message'||_0x222815['type']==='broadcast')await this[_0x2c33e2(0x144)]();}catch{}}}}catch(_0x443c13){if(_0x443c13[_0x2c33e2(0x18b)]===_0x2c33e2(0x175))break;this['emit'](_0x2c33e2(0x152),_0x443c13),this['log'](_0x2c33e2(0x17c)+_0x443c13[_0x2c33e2(0x18f)]);}if(this[_0x2c33e2(0x185)])this[_0x2c33e2(0x159)](_0x2c33e2(0x165)),this[_0x2c33e2(0x14a)](_0x2c33e2(0x136)+_0x525266/0x3e8+_0x2c33e2(0x14c)),await this['sleep'](_0x525266),_0x525266=Math[_0x2c33e2(0x13f)](_0x525266*1.5,0xea60);}}async[a0_0x2f352f(0x144)](){const _0x3620a1=a0_0x2f352f;try{let _0x295ec4=(await this['call'](_0x3620a1(0x176),{'alias':this['alias'],'limit':0xa}))?.['messages']||[];for(let _0x1f380d of _0x295ec4)await this[_0x3620a1(0x15a)](_0x3620a1(0x129),{'alias':this[_0x3620a1(0x172)],'message_id':_0x1f380d['id']}),this[_0x3620a1(0x14a)]('←\x20'+_0x1f380d[_0x3620a1(0x177)]+':\x20'+_0x1f380d[_0x3620a1(0x133)][_0x3620a1(0x179)](0x0,0x3c)),this[_0x3620a1(0x159)](_0x3620a1(0x17e),_0x1f380d),this[_0x3620a1(0x159)]('message',_0x1f380d);}catch(_0x3bf28e){this[_0x3620a1(0x14a)]('inbox\x20error:\x20'+_0x3bf28e[_0x3620a1(0x18f)]);}}[a0_0x2f352f(0x134)](_0x4b61af){return new Promise(_0x560066=>setTimeout(_0x560066,_0x4b61af));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x457c52=a0_0x538a;function a0_0x538a(_0xc62142,_0x22af78){_0xc62142=_0xc62142-0x184;const _0x1b2050=a0_0x1b20();let _0x538a85=_0x1b2050[_0xc62142];return _0x538a85;}(function(_0x1b4f79,_0x4952c0){const _0x2bcf26=a0_0x538a,_0x463903=_0x1b4f79();while(!![]){try{const _0x49bdb5=parseInt(_0x2bcf26(0x1af))/0x1+-parseInt(_0x2bcf26(0x19a))/0x2+-parseInt(_0x2bcf26(0x1ad))/0x3+parseInt(_0x2bcf26(0x19d))/0x4+-parseInt(_0x2bcf26(0x1da))/0x5+parseInt(_0x2bcf26(0x18f))/0x6*(-parseInt(_0x2bcf26(0x1ec))/0x7)+parseInt(_0x2bcf26(0x1ea))/0x8;if(_0x49bdb5===_0x4952c0)break;else _0x463903['push'](_0x463903['shift']());}catch(_0xe7a56a){_0x463903['push'](_0x463903['shift']());}}}(a0_0x1b20,0xdad3e));import{EventEmitter as a0_0x1d8d91}from'events';import{hostname as a0_0x4fc7ca}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x3ae98f,_0x47ba03)=>(_0x3ae98f??_0x47ba03)[a0_0x457c52(0x1c4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function N(_0x243450){const _0x16ec74=a0_0x457c52;return(_0x243450 instanceof Error?_0x243450[_0x16ec74(0x1a2)]:String(_0x243450??_0x16ec74(0x1c8)))[_0x16ec74(0x1c4)](K,'[REDACTED]')[_0x16ec74(0x1c4)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function O(_0x37a47a,_0x16afdf=process.env.ANET_TASK_TRACE_FORMAT===a0_0x457c52(0x1eb)){const _0x2be35b=a0_0x457c52;if(_0x16afdf)return JSON[_0x2be35b(0x197)](_0x37a47a);let _0x6d764a=L(_0x37a47a[_0x2be35b(0x1d6)],_0x2be35b(0x205)),_0x401e97=L(_0x37a47a[_0x2be35b(0x1d8)],_0x2be35b(0x18c)),_0x35606b=_0x37a47a[_0x2be35b(0x1cb)]?_0x2be35b(0x1d9)+_0x37a47a[_0x2be35b(0x1cb)]+':'+(_0x37a47a[_0x2be35b(0x1ff)]??''):'';return _0x2be35b(0x1ca)+_0x37a47a[_0x2be35b(0x1dc)]+'\x20from='+L(_0x37a47a[_0x2be35b(0x1fe)],'<unknown>')+_0x2be35b(0x193)+L(_0x37a47a[_0x2be35b(0x196)],_0x2be35b(0x19b))+_0x2be35b(0x203)+_0x401e97+_0x2be35b(0x1fc)+_0x6d764a+_0x2be35b(0x1cf)+L(_0x37a47a[_0x2be35b(0x201)],_0x2be35b(0x19b))+_0x2be35b(0x1f8)+_0x37a47a['transport']+'\x20duration_ms='+_0x37a47a['duration_ms']+_0x2be35b(0x1ee)+_0x37a47a[_0x2be35b(0x1fa)]+_0x35606b;}function U(_0x3d580f){const _0x22b5ef=a0_0x457c52;return{'event':{'sending':_0x22b5ef(0x1f0),'delivered':_0x22b5ef(0x1cc),'failed':_0x22b5ef(0x1e9),'acked':_0x22b5ef(0x1de),'started':_0x22b5ef(0x1e3),'replied':_0x22b5ef(0x1a0),'expired':'task.expired'}[_0x3d580f['status']],..._0x3d580f};}function j(_0x393337){const _0x2af100=a0_0x457c52;let _0x1d0144=_0x393337?.['task_id']||_0x393337?.[_0x2af100(0x1c9)]||_0x393337?.['id'];if(_0x1d0144)return String(_0x1d0144);let _0x1df658=_0x393337?.['content']?.[0x0]?.[_0x2af100(0x1db)];if(typeof _0x1df658!=='string')return null;try{let _0x3001e2=JSON[_0x2af100(0x1f3)](_0x1df658);return _0x3001e2?.['task_id']||_0x3001e2?.[_0x2af100(0x1c9)]||_0x3001e2?.['id']||null;}catch{return null;}}async function X(_0x39113d,_0x410e7d){const _0x11d72a=a0_0x457c52;let _0x2973df=_0x410e7d['now']??Date[_0x11d72a(0x1e2)],_0x36fc11=_0x2973df(),_0x3cd884=(_0x122701,_0xf6c767,_0x4352c2,_0x3b2c4b)=>{const _0x466039=_0x11d72a;_0x410e7d['log'](O(U({'from_alias':_0x39113d['fromAlias'],'to_alias':_0x39113d[_0x466039(0x1f2)],'task_id':_0xf6c767,'parent_task_id':_0x39113d[_0x466039(0x1c3)],'network_id':_0x39113d[_0x466039(0x1e0)],'transport':_0x39113d[_0x466039(0x1f9)],'status':_0x122701,'duration_ms':_0x2973df()-_0x36fc11,'lifecycle_tracking':_0x39113d[_0x466039(0x1c1)],..._0x4352c2!==void 0x0?{'error_code':_0x3b2c4b||'send_failed','error_message':N(_0x4352c2)}:{}})));};_0x3cd884(_0x11d72a(0x188),null);try{let _0x2cc26f=await _0x410e7d[_0x11d72a(0x1c6)](),_0x19fb63=j(_0x2cc26f);if(_0x19fb63)_0x3cd884(_0x11d72a(0x1bc),_0x19fb63);else{if(_0x2cc26f?.['ok']===!0x1||_0x2cc26f?.['error'])_0x3cd884(_0x11d72a(0x1f7),_0x19fb63,_0x2cc26f?.[_0x11d72a(0x1e8)]||_0x11d72a(0x199),_0x11d72a(0x1bd));else _0x3cd884(_0x11d72a(0x1f7),null,'CommHub\x20response\x20omitted\x20task_id',_0x11d72a(0x1ce));}return _0x2cc26f;}catch(_0x290c21){throw _0x3cd884(_0x11d72a(0x1f7),null,_0x290c21,_0x11d72a(0x1bb)),_0x290c21;}}function a0_0x1b20(){const _0x56440b=['sdk','toAlias','parse','new_task','min','emit','failed','\x20transport=','transport','lifecycle_tracking','SSE\x20reconnecting\x20in\x20','\x20parent_task_id=','reply','from_alias','error_message','disconnect','network_id','slice','\x20task_id=','body','<missing>','running','get_inbox','name','send_task','content','cwd','registered','sleep','tools/call','alias','split','sending','log','read','task','<pending>','from_session','get_all_status','6aMuBmr','messages','pop','call','\x20to=','s...','/mcp','to_alias','stringify','mcp_http','CommHub\x20rejected\x20task','860580EPbFAm','<unknown>','agent','2638640NwIqsl','application/json','text/event-stream','task.replied','getReader','message','result','inbox\x20error:\x20','Bearer\x20','new_message','idle','heartbeatInterval','connect','POST','fromAlias','sdk-','3326874UleHBZ','heartbeatTimer','1390390QJNwgY','connected','processInbox','normal','2.0','signal','toString','connectSSE','sseAbort','ack_inbox','application/json,\x20text/event-stream','AbortError','send_failed','delivered','send_rejected','report_status','/events/','send_message','lifecycleTracking','abort','parentTaskId','replace','url','send','reconnectDelay','unknown\x20error','message_id','[commhub:task]\x20','error_code','task.send.delivered','heartbeat\x20failed:\x20','missing_task_id','\x20network_id=','offline','send_reply','autoConnect','decode','data:\x20','SSE\x20error:\x20','parent_task_id','token','task_id','\x20error=','6521610Dmqvzi','text','status','not_tracked','task.ack','startsWith','networkId','getAllStatus','now','task.started','disconnected','broadcast','catch','resumeId','error','task.send.failed','15628912YxtPWE','json','1846432uVqaiU','type','\x20lifecycle=','toTimeString','task.send.start'];a0_0x1b20=function(){return _0x56440b;};return a0_0x1b20();}async function Y(_0x3b3a0c,_0x462a60){const _0x3a518b=a0_0x457c52;return X({'fromAlias':_0x3b3a0c[_0x3a518b(0x1ab)],'toAlias':_0x3b3a0c['alias'],'parentTaskId':_0x3b3a0c[_0x3a518b(0x1c3)]||null,'networkId':_0x3b3a0c['networkId']||null,'transport':_0x3a518b(0x198),'lifecycleTracking':_0x3a518b(0x1dd)},_0x462a60);}class $ extends a0_0x1d8d91{[a0_0x457c52(0x1c5)];[a0_0x457c52(0x186)];[a0_0x457c52(0x1d7)];[a0_0x457c52(0x19c)];[a0_0x457c52(0x1e7)];[a0_0x457c52(0x1a8)];[a0_0x457c52(0x1c7)];[a0_0x457c52(0x1ae)];[a0_0x457c52(0x1b7)];[a0_0x457c52(0x206)]=!0x1;constructor(_0x42893a){const _0x3edb1b=a0_0x457c52;super();if(this['url']=_0x42893a[_0x3edb1b(0x1c5)][_0x3edb1b(0x1c4)](/\/$/,''),this['alias']=_0x42893a['alias'],this['token']=_0x42893a[_0x3edb1b(0x1d7)],this[_0x3edb1b(0x19c)]=_0x42893a[_0x3edb1b(0x19c)]||_0x3edb1b(0x1f1),this[_0x3edb1b(0x1e7)]=_0x3edb1b(0x1ac)+_0x42893a['alias']+'-'+Date[_0x3edb1b(0x1e2)]()[_0x3edb1b(0x1b5)](0x24),this[_0x3edb1b(0x1a8)]=_0x42893a[_0x3edb1b(0x1a8)]??0x2bf20,this[_0x3edb1b(0x1c7)]=_0x42893a[_0x3edb1b(0x1c7)]??0xbb8,_0x42893a[_0x3edb1b(0x1d2)]!==!0x1)this[_0x3edb1b(0x1a9)]();}[a0_0x457c52(0x189)](_0x563faa){const _0xf6369f=a0_0x457c52;console[_0xf6369f(0x189)]('['+new Date()[_0xf6369f(0x1ef)]()[_0xf6369f(0x202)](0x0,0x8)+']\x20[commhub:'+this[_0xf6369f(0x186)]+']\x20'+_0x563faa);}async[a0_0x457c52(0x192)](_0x22b29c,_0x47aaf0){const _0x1f252b=a0_0x457c52;let _0x442df3={'Content-Type':_0x1f252b(0x19e),'Accept':_0x1f252b(0x1b9)};if(this[_0x1f252b(0x1d7)])_0x442df3['Authorization']=_0x1f252b(0x1a5)+this[_0x1f252b(0x1d7)];let _0x5951b8=await(await fetch(this[_0x1f252b(0x1c5)]+_0x1f252b(0x195),{'method':_0x1f252b(0x1aa),'headers':_0x442df3,'body':JSON[_0x1f252b(0x197)]({'jsonrpc':_0x1f252b(0x1b3),'id':Date['now'](),'method':_0x1f252b(0x185),'params':{'name':_0x22b29c,'arguments':_0x47aaf0}})}))['text'](),_0x1e093e=_0x5951b8['match'](/data: (.+)/),_0x5383b6=_0x1e093e?JSON[_0x1f252b(0x1f3)](_0x1e093e[0x1]):JSON[_0x1f252b(0x1f3)](_0x5951b8),_0x252d8b=_0x5383b6?.[_0x1f252b(0x1a3)]?.[_0x1f252b(0x20a)]?.[0x0]?.['text'];return _0x252d8b?JSON[_0x1f252b(0x1f3)](_0x252d8b):_0x5383b6;}async[a0_0x457c52(0x1a9)](){const _0x101020=a0_0x457c52;if(this[_0x101020(0x206)])return;this['running']=!0x0,await this[_0x101020(0x1dc)](_0x101020(0x1a7)),this['log'](_0x101020(0x20c)),this[_0x101020(0x1ae)]=setInterval(()=>{const _0x7ce214=_0x101020;this[_0x7ce214(0x1dc)](_0x7ce214(0x1a7))[_0x7ce214(0x1e6)](_0x4038a5=>this['log'](_0x7ce214(0x1cd)+_0x4038a5[_0x7ce214(0x1a2)]));},this['heartbeatInterval']),this[_0x101020(0x1b6)]();}async[a0_0x457c52(0x200)](){const _0x3f15e4=a0_0x457c52;if(this['running']=!0x1,this[_0x3f15e4(0x1b7)]?.[_0x3f15e4(0x1c2)](),this[_0x3f15e4(0x1ae)])clearInterval(this[_0x3f15e4(0x1ae)]);await this[_0x3f15e4(0x1dc)](_0x3f15e4(0x1d0))[_0x3f15e4(0x1e6)](()=>{}),this[_0x3f15e4(0x189)](_0x3f15e4(0x1e4));}async[a0_0x457c52(0x1c6)](_0x4b4b37,_0x20c265,_0x22720a=a0_0x457c52(0x1b2)){const _0x2568ee=a0_0x457c52;return Y({'alias':_0x4b4b37,'fromAlias':this[_0x2568ee(0x186)]},{'log':_0x65ca50=>console[_0x2568ee(0x189)](_0x65ca50),'send':()=>this['call'](_0x2568ee(0x209),{'alias':_0x4b4b37,'task':_0x20c265,'priority':_0x22720a,'from_session':this[_0x2568ee(0x186)]})});}async[a0_0x457c52(0x1a2)](_0xd04ec4,_0x38ca2d){const _0x58e75e=a0_0x457c52;return this[_0x58e75e(0x192)](_0x58e75e(0x1c0),{'alias':_0xd04ec4,'message':_0x38ca2d,'from_session':this['alias']});}async[a0_0x457c52(0x1fd)](_0x250b0a,_0x3f93d8,_0x2009a1='completed'){const _0x19db09=a0_0x457c52;return this[_0x19db09(0x192)](_0x19db09(0x1d1),{'in_reply_to':_0x250b0a,'text':_0x3f93d8,'status':_0x2009a1});}async[a0_0x457c52(0x1dc)](_0x5ae54d,_0x59b4d4){const _0xa3a624=a0_0x457c52;return this[_0xa3a624(0x192)](_0xa3a624(0x1be),{'resume_id':this['resumeId'],'alias':this[_0xa3a624(0x186)],'status':_0x5ae54d,'server':a0_0x4fc7ca(),'hostname':a0_0x4fc7ca(),'agent':this['agent'],'project_dir':process[_0xa3a624(0x20b)](),..._0x59b4d4});}async[a0_0x457c52(0x1e1)](){const _0x4d3768=a0_0x457c52;return this[_0x4d3768(0x192)](_0x4d3768(0x18e),{});}async[a0_0x457c52(0x1e5)](_0xde63af,_0x5da94b){const _0x5efd02=a0_0x457c52;return this['call'](_0x5efd02(0x1e5),{'message':_0xde63af,'filter_server':_0x5da94b?.['server'],'filter_status':_0x5da94b?.['status']});}async[a0_0x457c52(0x1b6)](){const _0x5482fa=a0_0x457c52;let _0x5205e7=encodeURIComponent(this[_0x5482fa(0x186)]),_0xf999f1=this[_0x5482fa(0x1c5)]+_0x5482fa(0x1bf)+_0x5205e7,_0x944d32=this['reconnectDelay'];while(this[_0x5482fa(0x206)]){try{this[_0x5482fa(0x1b7)]=new AbortController();let _0x436e88={'Accept':_0x5482fa(0x19f)};if(this[_0x5482fa(0x1d7)])_0x436e88['Authorization']=_0x5482fa(0x1a5)+this[_0x5482fa(0x1d7)];let _0x381db2=await fetch(_0xf999f1,{'headers':_0x436e88,'signal':this[_0x5482fa(0x1b7)][_0x5482fa(0x1b4)]});if(!_0x381db2['ok']||!_0x381db2[_0x5482fa(0x204)]){this[_0x5482fa(0x189)]('SSE\x20failed:\x20'+_0x381db2[_0x5482fa(0x1dc)]),await this['sleep'](_0x944d32),_0x944d32=Math['min'](_0x944d32*1.5,0xea60);continue;}_0x944d32=this[_0x5482fa(0x1c7)];let _0x1d6331=_0x381db2['body'][_0x5482fa(0x1a1)](),_0x464c42=new TextDecoder(),_0x36590c='';while(this[_0x5482fa(0x206)]){let {done:_0x52e501,value:_0x5319b2}=await _0x1d6331[_0x5482fa(0x18a)]();if(_0x52e501)break;_0x36590c+=_0x464c42[_0x5482fa(0x1d3)](_0x5319b2,{'stream':!0x0});let _0x113b18=_0x36590c[_0x5482fa(0x187)]('\x0a');_0x36590c=_0x113b18[_0x5482fa(0x191)]()||'';for(let _0x4649f5 of _0x113b18){if(!_0x4649f5[_0x5482fa(0x1df)](_0x5482fa(0x1d4)))continue;try{let _0x419f9d=JSON[_0x5482fa(0x1f3)](_0x4649f5[_0x5482fa(0x202)](0x6));if(_0x419f9d[_0x5482fa(0x1ed)]===_0x5482fa(0x1b0)){this[_0x5482fa(0x189)]('SSE\x20connected'),this['emit'](_0x5482fa(0x1b0));continue;}if(_0x419f9d[_0x5482fa(0x1ed)]===_0x5482fa(0x1f4)||_0x419f9d[_0x5482fa(0x1ed)]===_0x5482fa(0x1a6)||_0x419f9d['type']==='broadcast')await this[_0x5482fa(0x1b1)]();}catch{}}}}catch(_0x182b04){if(_0x182b04[_0x5482fa(0x208)]===_0x5482fa(0x1ba))break;this[_0x5482fa(0x1f6)](_0x5482fa(0x1e8),_0x182b04),this[_0x5482fa(0x189)](_0x5482fa(0x1d5)+_0x182b04[_0x5482fa(0x1a2)]);}if(this[_0x5482fa(0x206)])this[_0x5482fa(0x1f6)](_0x5482fa(0x1e4)),this[_0x5482fa(0x189)](_0x5482fa(0x1fb)+_0x944d32/0x3e8+_0x5482fa(0x194)),await this['sleep'](_0x944d32),_0x944d32=Math[_0x5482fa(0x1f5)](_0x944d32*1.5,0xea60);}}async['processInbox'](){const _0xac3a73=a0_0x457c52;try{let _0x140a7e=(await this['call'](_0xac3a73(0x207),{'alias':this[_0xac3a73(0x186)],'limit':0xa}))?.[_0xac3a73(0x190)]||[];for(let _0x1379a3 of _0x140a7e)await this[_0xac3a73(0x192)](_0xac3a73(0x1b8),{'alias':this[_0xac3a73(0x186)],'message_id':_0x1379a3['id']}),this[_0xac3a73(0x189)]('←\x20'+_0x1379a3[_0xac3a73(0x18d)]+':\x20'+_0x1379a3['content'][_0xac3a73(0x202)](0x0,0x3c)),this[_0xac3a73(0x1f6)](_0xac3a73(0x18b),_0x1379a3),this[_0xac3a73(0x1f6)]('message',_0x1379a3);}catch(_0x1e8469){this[_0xac3a73(0x189)](_0xac3a73(0x1a4)+_0x1e8469['message']);}}[a0_0x457c52(0x184)](_0x5caa2a){return new Promise(_0x1213fd=>setTimeout(_0x1213fd,_0x5caa2a));}}var F=$;export{F as default,$ as CommHub};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export interface CodexRecoveryVerification {
|
|
2
|
+
method: "thread/start" | "thread/resume";
|
|
3
|
+
threadId: string;
|
|
4
|
+
verifiedAt: string;
|
|
5
|
+
historyTurnCount: number;
|
|
6
|
+
historyFingerprint: string;
|
|
7
|
+
}
|
|
8
|
+
export interface CodexRecoveryBackup {
|
|
9
|
+
backupDir: string;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
stateFiles: string[];
|
|
12
|
+
}
|
|
13
|
+
/** Transaction boundary shared by Windows and POSIX cutovers: the snapshot
|
|
14
|
+
* cannot begin until every authoritative state writer has quiesced. */
|
|
15
|
+
export declare function quiesceThenSnapshot<T>(quiesce: () => Promise<void>, snapshot: () => T): Promise<T>;
|
|
16
|
+
/** A stored thread is never considered resumed until app-server reads the
|
|
17
|
+
* exact thread back with persisted history. This is deliberately stricter
|
|
18
|
+
* than accepting a successful thread/resume RPC response. */
|
|
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>;
|
|
21
|
+
/** Private, node-local recovery point. config-recovery.json is deliberately
|
|
22
|
+
* redacted non-credential audit/recovery metadata, not an identity backup.
|
|
23
|
+
* Identity recovery relies on leaving the original node config and CODEX_HOME
|
|
24
|
+
* in place. Credentials are never copied into this snapshot. */
|
|
25
|
+
export declare function backupCodexRecoveryState(opts: {
|
|
26
|
+
nodeDir: string;
|
|
27
|
+
codexHome: string;
|
|
28
|
+
now?: Date;
|
|
29
|
+
}): CodexRecoveryBackup;
|
|
30
|
+
export declare function codexTopologyAudit(profile: Record<string, any>, nodeDir: string, cwd: string): {
|
|
31
|
+
launchMode: string;
|
|
32
|
+
cwd: string;
|
|
33
|
+
codexHome: string;
|
|
34
|
+
remote: any;
|
|
35
|
+
threadId: any;
|
|
36
|
+
model: any;
|
|
37
|
+
flags: any;
|
|
38
|
+
lastRecoveryVerification: any;
|
|
39
|
+
lastRecoveryBackup: {
|
|
40
|
+
createdAt: any;
|
|
41
|
+
stateFiles: any;
|
|
42
|
+
} | null;
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function parseCommhubToolResult(json: any): any;
|