@sleep2agi/agent-network 2.3.0-preview.46 → 2.3.0-preview.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +2 -2
- package/dist/src/client.js +1 -1
- package/dist/src/copresence-deps.d.ts +4 -2
- package/dist/src/grok-attach-client.d.ts +15 -1
- package/dist/src/grok-copresence-orchestration.d.ts +70 -0
- package/dist/src/im/correlation-store.d.ts +34 -0
- package/dist/src/im/feishu/worker.js +206 -206
- package/dist/src/node-server-payload.d.ts +66 -0
- package/dist/src/node-server.js +7 -7
- package/dist/src/opencode-agent-node-pair.d.ts +2 -2
- package/package.json +1 -1
package/dist/src/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const a0_0x4980fc=a0_0x23bc;(function(_0xb4a6ad,_0x398198){const _0x333aae=a0_0x23bc,_0x3c9e65=_0xb4a6ad();while(!![]){try{const _0x14d4b2=parseInt(_0x333aae(0x1aa))/0x1+parseInt(_0x333aae(0x19b))/0x2*(-parseInt(_0x333aae(0x1b4))/0x3)+parseInt(_0x333aae(0x1e9))/0x4+-parseInt(_0x333aae(0x18c))/0x5*(-parseInt(_0x333aae(0x1b5))/0x6)+-parseInt(_0x333aae(0x198))/0x7+parseInt(_0x333aae(0x1bf))/0x8+-parseInt(_0x333aae(0x1e5))/0x9*(parseInt(_0x333aae(0x1e7))/0xa);if(_0x14d4b2===_0x398198)break;else _0x3c9e65['push'](_0x3c9e65['shift']());}catch(_0x1232e0){_0x3c9e65['push'](_0x3c9e65['shift']());}}}(a0_0x6acc,0xc812a));import{EventEmitter as a0_0x17aad3}from'events';import{hostname as a0_0x13ecf0}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x43a7dd,_0x32cea0)=>(_0x43a7dd??_0x32cea0)[a0_0x4980fc(0x1a3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x4980fc(0x1fc)](0x0,0xf0);function N(_0x29a5f0){const _0x2f1c8b=a0_0x4980fc;return(_0x29a5f0 instanceof Error?_0x29a5f0['message']:String(_0x29a5f0??_0x2f1c8b(0x207)))[_0x2f1c8b(0x1a3)](K,_0x2f1c8b(0x1e1))[_0x2f1c8b(0x1a3)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x2f1c8b(0x1fc)](0x0,0xf0);}function a0_0x6acc(){const _0x210a42=['report_status','\x20from=','s...','task.send.start','offline','SSE\x20error:\x20','send_message','now','660807TNEvaT','log','name','2qwaUlP','networkId','result','call','tools/call','get_inbox','\x20task_id=','\x20to=','replace','emit','content','fromAlias','/mcp','reconnectDelay','connected','106484YKXTrk','alias','AbortError','toAlias','error','message','\x20lifecycle=','\x20parent_task_id=','text/event-stream','parentTaskId','1438941QaHQPH','14154DHgGdH','parse','pop','send_reply','toTimeString','POST','disconnected','task.send.failed','task','message_id','7188472vRYgSk','url','ack_inbox','signal','send','error_code','transport','text','from_session','stringify','catch','registered','send_failed','failed','idle','lifecycle_tracking','status','<unknown>','processInbox','connectSSE','task.send.delivered','application/json','Authorization',']\x20[commhub:','agent','getAllStatus','toString','match','read','application/json,\x20text/event-stream','CommHub\x20response\x20omitted\x20task_id','startsWith','body','autoConnect','[REDACTED]','task.expired','[commhub:task]\x20','SSE\x20failed:\x20','2989962VZEDHx','Bearer\x20','10pCaJqv','task.ack','33212dFVbpP','send_rejected','type','\x20transport=','heartbeatTimer','/events/','messages','new_task','data:\x20','task.replied','resumeId','token','task_id','server','missing_task_id','abort','<missing>','decode','reply','slice','get_all_status','connect','heartbeatInterval','normal','cwd','\x20duration_ms=','min','sseAbort','running','sleep','unknown\x20error','lifecycleTracking','\x20network_id=','1510DrYwwz','from_alias','broadcast','SSE\x20connected'];a0_0x6acc=function(){return _0x210a42;};return a0_0x6acc();}function O(_0x5e812f,_0x591cff=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x3b0153=a0_0x4980fc;if(_0x591cff)return JSON['stringify'](_0x5e812f);let _0x7d671b=L(_0x5e812f['parent_task_id'],_0x3b0153(0x1f9)),_0x330964=L(_0x5e812f[_0x3b0153(0x1f5)],'<pending>'),_0x33b7db=_0x5e812f[_0x3b0153(0x1c4)]?'\x20error='+_0x5e812f[_0x3b0153(0x1c4)]+':'+(_0x5e812f['error_message']??''):'';return _0x3b0153(0x1e3)+_0x5e812f[_0x3b0153(0x1cf)]+_0x3b0153(0x191)+L(_0x5e812f[_0x3b0153(0x18d)],_0x3b0153(0x1d0))+_0x3b0153(0x1a2)+L(_0x5e812f['to_alias'],_0x3b0153(0x1d0))+_0x3b0153(0x1a1)+_0x330964+_0x3b0153(0x1b1)+_0x7d671b+_0x3b0153(0x18b)+L(_0x5e812f['network_id'],_0x3b0153(0x1d0))+_0x3b0153(0x1ec)+_0x5e812f[_0x3b0153(0x1c5)]+_0x3b0153(0x202)+_0x5e812f['duration_ms']+_0x3b0153(0x1b0)+_0x5e812f[_0x3b0153(0x1ce)]+_0x33b7db;}function U(_0x213cd9){const _0xc5ab79=a0_0x4980fc;return{'event':{'sending':_0xc5ab79(0x193),'delivered':_0xc5ab79(0x1d3),'failed':_0xc5ab79(0x1bc),'acked':_0xc5ab79(0x1e8),'started':'task.started','replied':_0xc5ab79(0x1f2),'expired':_0xc5ab79(0x1e2)}[_0x213cd9[_0xc5ab79(0x1cf)]],..._0x213cd9};}function a0_0x23bc(_0x12e802,_0x5b6362){_0x12e802=_0x12e802-0x18a;const _0x6acc37=a0_0x6acc();let _0x23bcb3=_0x6acc37[_0x12e802];return _0x23bcb3;}function j(_0x108a63){const _0x55ef0b=a0_0x4980fc;let _0x595d2d=_0x108a63?.['task_id']||_0x108a63?.[_0x55ef0b(0x1be)]||_0x108a63?.['id'];if(_0x595d2d)return String(_0x595d2d);let _0x262448=_0x108a63?.[_0x55ef0b(0x1a5)]?.[0x0]?.['text'];if(typeof _0x262448!=='string')return null;try{let _0x33c072=JSON[_0x55ef0b(0x1b6)](_0x262448);return _0x33c072?.[_0x55ef0b(0x1f5)]||_0x33c072?.['message_id']||_0x33c072?.['id']||null;}catch{return null;}}async function X(_0x1735a6,_0x5ae9e0){const _0x4719ea=a0_0x4980fc;let _0x2d832e=_0x5ae9e0['now']??Date[_0x4719ea(0x197)],_0x427b42=_0x2d832e(),_0xea66a3=(_0x584d04,_0x588d7c,_0x449923,_0x324465)=>{const _0x24ddfe=_0x4719ea;_0x5ae9e0[_0x24ddfe(0x199)](O(U({'from_alias':_0x1735a6[_0x24ddfe(0x1a6)],'to_alias':_0x1735a6[_0x24ddfe(0x1ad)],'task_id':_0x588d7c,'parent_task_id':_0x1735a6[_0x24ddfe(0x1b3)],'network_id':_0x1735a6['networkId'],'transport':_0x1735a6['transport'],'status':_0x584d04,'duration_ms':_0x2d832e()-_0x427b42,'lifecycle_tracking':_0x1735a6[_0x24ddfe(0x18a)],..._0x449923!==void 0x0?{'error_code':_0x324465||_0x24ddfe(0x1cb),'error_message':N(_0x449923)}:{}})));};_0xea66a3('sending',null);try{let _0x2b84ad=await _0x5ae9e0[_0x4719ea(0x1c3)](),_0x252d7a=j(_0x2b84ad);if(_0x252d7a)_0xea66a3('delivered',_0x252d7a);else{if(_0x2b84ad?.['ok']===!0x1||_0x2b84ad?.[_0x4719ea(0x1ae)])_0xea66a3(_0x4719ea(0x1cc),_0x252d7a,_0x2b84ad?.['error']||'CommHub\x20rejected\x20task',_0x4719ea(0x1ea));else _0xea66a3(_0x4719ea(0x1cc),null,_0x4719ea(0x1dd),_0x4719ea(0x1f7));}return _0x2b84ad;}catch(_0x72d42c){throw _0xea66a3(_0x4719ea(0x1cc),null,_0x72d42c,_0x4719ea(0x1cb)),_0x72d42c;}}async function Y(_0x24eb91,_0x2a958b){const _0x5290ef=a0_0x4980fc;return X({'fromAlias':_0x24eb91['fromAlias'],'toAlias':_0x24eb91[_0x5290ef(0x1ab)],'parentTaskId':_0x24eb91[_0x5290ef(0x1b3)]||null,'networkId':_0x24eb91[_0x5290ef(0x19c)]||null,'transport':'mcp_http','lifecycleTracking':'not_tracked'},_0x2a958b);}class $ extends a0_0x17aad3{[a0_0x4980fc(0x1c0)];['alias'];[a0_0x4980fc(0x1f4)];['agent'];[a0_0x4980fc(0x1f3)];[a0_0x4980fc(0x1ff)];[a0_0x4980fc(0x1a8)];['heartbeatTimer'];[a0_0x4980fc(0x204)];[a0_0x4980fc(0x205)]=!0x1;constructor(_0x5a1b73){const _0x45f9f5=a0_0x4980fc;super();if(this['url']=_0x5a1b73[_0x45f9f5(0x1c0)][_0x45f9f5(0x1a3)](/\/$/,''),this[_0x45f9f5(0x1ab)]=_0x5a1b73[_0x45f9f5(0x1ab)],this[_0x45f9f5(0x1f4)]=_0x5a1b73[_0x45f9f5(0x1f4)],this[_0x45f9f5(0x1d7)]=_0x5a1b73[_0x45f9f5(0x1d7)]||'sdk',this[_0x45f9f5(0x1f3)]='sdk-'+_0x5a1b73[_0x45f9f5(0x1ab)]+'-'+Date[_0x45f9f5(0x197)]()[_0x45f9f5(0x1d9)](0x24),this[_0x45f9f5(0x1ff)]=_0x5a1b73[_0x45f9f5(0x1ff)]??0x2bf20,this[_0x45f9f5(0x1a8)]=_0x5a1b73[_0x45f9f5(0x1a8)]??0xbb8,_0x5a1b73[_0x45f9f5(0x1e0)]!==!0x1)this[_0x45f9f5(0x1fe)]();}[a0_0x4980fc(0x199)](_0x55f344){const _0x32016d=a0_0x4980fc;console[_0x32016d(0x199)]('['+new Date()[_0x32016d(0x1b9)]()['slice'](0x0,0x8)+_0x32016d(0x1d6)+this[_0x32016d(0x1ab)]+']\x20'+_0x55f344);}async['call'](_0x1d2d6b,_0x476cb4){const _0x2dd211=a0_0x4980fc;let _0x5b5fb9={'Content-Type':_0x2dd211(0x1d4),'Accept':_0x2dd211(0x1dc)};if(this[_0x2dd211(0x1f4)])_0x5b5fb9['Authorization']=_0x2dd211(0x1e6)+this[_0x2dd211(0x1f4)];let _0x277617=await(await fetch(this['url']+_0x2dd211(0x1a7),{'method':_0x2dd211(0x1ba),'headers':_0x5b5fb9,'body':JSON[_0x2dd211(0x1c8)]({'jsonrpc':'2.0','id':Date[_0x2dd211(0x197)](),'method':_0x2dd211(0x19f),'params':{'name':_0x1d2d6b,'arguments':_0x476cb4}})}))[_0x2dd211(0x1c6)](),_0x16e663=_0x277617[_0x2dd211(0x1da)](/data: (.+)/),_0x3c3efd=_0x16e663?JSON[_0x2dd211(0x1b6)](_0x16e663[0x1]):JSON[_0x2dd211(0x1b6)](_0x277617),_0x3455d7=_0x3c3efd?.[_0x2dd211(0x19d)]?.['content']?.[0x0]?.[_0x2dd211(0x1c6)];return _0x3455d7?JSON[_0x2dd211(0x1b6)](_0x3455d7):_0x3c3efd;}async[a0_0x4980fc(0x1fe)](){const _0x213024=a0_0x4980fc;if(this[_0x213024(0x205)])return;this[_0x213024(0x205)]=!0x0,await this[_0x213024(0x1cf)](_0x213024(0x1cd)),this['log'](_0x213024(0x1ca)),this[_0x213024(0x1ed)]=setInterval(()=>{const _0x4e6899=_0x213024;this[_0x4e6899(0x1cf)](_0x4e6899(0x1cd))[_0x4e6899(0x1c9)](_0x27e858=>this[_0x4e6899(0x199)]('heartbeat\x20failed:\x20'+_0x27e858['message']));},this[_0x213024(0x1ff)]),this[_0x213024(0x1d2)]();}async['disconnect'](){const _0x1caa9a=a0_0x4980fc;if(this[_0x1caa9a(0x205)]=!0x1,this['sseAbort']?.[_0x1caa9a(0x1f8)](),this[_0x1caa9a(0x1ed)])clearInterval(this['heartbeatTimer']);await this[_0x1caa9a(0x1cf)](_0x1caa9a(0x194))[_0x1caa9a(0x1c9)](()=>{}),this[_0x1caa9a(0x199)](_0x1caa9a(0x1bb));}async[a0_0x4980fc(0x1c3)](_0x304445,_0x573085,_0x4d928e=a0_0x4980fc(0x200)){const _0x502322=a0_0x4980fc;return Y({'alias':_0x304445,'fromAlias':this['alias']},{'log':_0x17b3de=>console[_0x502322(0x199)](_0x17b3de),'send':()=>this[_0x502322(0x19e)]('send_task',{'alias':_0x304445,'task':_0x573085,'priority':_0x4d928e,'from_session':this[_0x502322(0x1ab)]})});}async[a0_0x4980fc(0x1af)](_0x3264f1,_0x2e73f5){const _0x5ab58c=a0_0x4980fc;return this[_0x5ab58c(0x19e)](_0x5ab58c(0x196),{'alias':_0x3264f1,'message':_0x2e73f5,'from_session':this[_0x5ab58c(0x1ab)]});}async[a0_0x4980fc(0x1fb)](_0x418dd8,_0x55a95b,_0x2b581e='completed'){const _0x5199b1=a0_0x4980fc;return this[_0x5199b1(0x19e)](_0x5199b1(0x1b8),{'in_reply_to':_0x418dd8,'text':_0x55a95b,'status':_0x2b581e});}async[a0_0x4980fc(0x1cf)](_0x51c360,_0x7cebf0){const _0x418e80=a0_0x4980fc;return this[_0x418e80(0x19e)](_0x418e80(0x190),{'resume_id':this[_0x418e80(0x1f3)],'alias':this[_0x418e80(0x1ab)],'status':_0x51c360,'server':a0_0x13ecf0(),'hostname':a0_0x13ecf0(),'agent':this[_0x418e80(0x1d7)],'project_dir':process[_0x418e80(0x201)](),..._0x7cebf0});}async[a0_0x4980fc(0x1d8)](){const _0x32b82e=a0_0x4980fc;return this[_0x32b82e(0x19e)](_0x32b82e(0x1fd),{});}async[a0_0x4980fc(0x18e)](_0x2e86a3,_0x3b860b){const _0x366513=a0_0x4980fc;return this['call'](_0x366513(0x18e),{'message':_0x2e86a3,'filter_server':_0x3b860b?.[_0x366513(0x1f6)],'filter_status':_0x3b860b?.[_0x366513(0x1cf)]});}async[a0_0x4980fc(0x1d2)](){const _0x8ecaf9=a0_0x4980fc;let _0x3e335d=encodeURIComponent(this['alias']),_0x57cb80=this['url']+_0x8ecaf9(0x1ee)+_0x3e335d,_0x5ced82=this[_0x8ecaf9(0x1a8)];while(this[_0x8ecaf9(0x205)]){try{this[_0x8ecaf9(0x204)]=new AbortController();let _0x2c8470={'Accept':_0x8ecaf9(0x1b2)};if(this['token'])_0x2c8470[_0x8ecaf9(0x1d5)]=_0x8ecaf9(0x1e6)+this[_0x8ecaf9(0x1f4)];let _0x32a70c=await fetch(_0x57cb80,{'headers':_0x2c8470,'signal':this[_0x8ecaf9(0x204)][_0x8ecaf9(0x1c2)]});if(!_0x32a70c['ok']||!_0x32a70c[_0x8ecaf9(0x1df)]){this[_0x8ecaf9(0x199)](_0x8ecaf9(0x1e4)+_0x32a70c[_0x8ecaf9(0x1cf)]),await this[_0x8ecaf9(0x206)](_0x5ced82),_0x5ced82=Math['min'](_0x5ced82*1.5,0xea60);continue;}_0x5ced82=this['reconnectDelay'];let _0x319530=_0x32a70c[_0x8ecaf9(0x1df)]['getReader'](),_0x5362d9=new TextDecoder(),_0xf9e69b='';while(this[_0x8ecaf9(0x205)]){let {done:_0x386c67,value:_0x1c35b5}=await _0x319530[_0x8ecaf9(0x1db)]();if(_0x386c67)break;_0xf9e69b+=_0x5362d9[_0x8ecaf9(0x1fa)](_0x1c35b5,{'stream':!0x0});let _0x30c332=_0xf9e69b['split']('\x0a');_0xf9e69b=_0x30c332[_0x8ecaf9(0x1b7)]()||'';for(let _0xa566f4 of _0x30c332){if(!_0xa566f4[_0x8ecaf9(0x1de)](_0x8ecaf9(0x1f1)))continue;try{let _0x210fd3=JSON['parse'](_0xa566f4[_0x8ecaf9(0x1fc)](0x6));if(_0x210fd3[_0x8ecaf9(0x1eb)]===_0x8ecaf9(0x1a9)){this[_0x8ecaf9(0x199)](_0x8ecaf9(0x18f)),this['emit'](_0x8ecaf9(0x1a9));continue;}if(_0x210fd3[_0x8ecaf9(0x1eb)]===_0x8ecaf9(0x1f0)||_0x210fd3[_0x8ecaf9(0x1eb)]==='new_message'||_0x210fd3[_0x8ecaf9(0x1eb)]==='broadcast')await this[_0x8ecaf9(0x1d1)]();}catch{}}}}catch(_0x4d6508){if(_0x4d6508[_0x8ecaf9(0x19a)]===_0x8ecaf9(0x1ac))break;this[_0x8ecaf9(0x1a4)](_0x8ecaf9(0x1ae),_0x4d6508),this[_0x8ecaf9(0x199)](_0x8ecaf9(0x195)+_0x4d6508['message']);}if(this[_0x8ecaf9(0x205)])this[_0x8ecaf9(0x1a4)](_0x8ecaf9(0x1bb)),this[_0x8ecaf9(0x199)]('SSE\x20reconnecting\x20in\x20'+_0x5ced82/0x3e8+_0x8ecaf9(0x192)),await this[_0x8ecaf9(0x206)](_0x5ced82),_0x5ced82=Math[_0x8ecaf9(0x203)](_0x5ced82*1.5,0xea60);}}async['processInbox'](){const _0x1b050c=a0_0x4980fc;try{let _0x3e398a=(await this[_0x1b050c(0x19e)](_0x1b050c(0x1a0),{'alias':this[_0x1b050c(0x1ab)],'limit':0xa}))?.[_0x1b050c(0x1ef)]||[];for(let _0x261f64 of _0x3e398a)await this['call'](_0x1b050c(0x1c1),{'alias':this[_0x1b050c(0x1ab)],'message_id':_0x261f64['id']}),this['log']('←\x20'+_0x261f64[_0x1b050c(0x1c7)]+':\x20'+_0x261f64[_0x1b050c(0x1a5)][_0x1b050c(0x1fc)](0x0,0x3c)),this['emit'](_0x1b050c(0x1bd),_0x261f64),this[_0x1b050c(0x1a4)](_0x1b050c(0x1af),_0x261f64);}catch(_0x41dfe5){this[_0x1b050c(0x199)]('inbox\x20error:\x20'+_0x41dfe5[_0x1b050c(0x1af)]);}}['sleep'](_0x1c0039){return new Promise(_0x2d0f19=>setTimeout(_0x2d0f19,_0x1c0039));}}var F=$;export{F as default,$ as CommHub};
|
|
1
|
+
const a0_0x240860=a0_0xfa02;(function(_0x1d8ce7,_0x619d2b){const _0x491374=a0_0xfa02,_0x2d1699=_0x1d8ce7();while(!![]){try{const _0x259bd5=parseInt(_0x491374(0x10b))/0x1+-parseInt(_0x491374(0x155))/0x2*(-parseInt(_0x491374(0x103))/0x3)+parseInt(_0x491374(0xee))/0x4+-parseInt(_0x491374(0x156))/0x5*(-parseInt(_0x491374(0x14b))/0x6)+parseInt(_0x491374(0xfb))/0x7+parseInt(_0x491374(0xef))/0x8*(-parseInt(_0x491374(0xfa))/0x9)+-parseInt(_0x491374(0x141))/0xa;if(_0x259bd5===_0x619d2b)break;else _0x2d1699['push'](_0x2d1699['shift']());}catch(_0x496f67){_0x2d1699['push'](_0x2d1699['shift']());}}}(a0_0x3927,0xd672b));import{EventEmitter as a0_0x59ad8d}from'events';import{hostname as a0_0x11444b}from'os';var _=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,c=(_0x461794,_0x2c070c)=>(_0x461794??_0x2c070c)[a0_0x240860(0x11a)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x240860(0xeb)](0x0,0xf0);function T(_0x110129){const _0x45541f=a0_0x240860;return(_0x110129 instanceof Error?_0x110129['message']:String(_0x110129??_0x45541f(0x153)))[_0x45541f(0x11a)](_,'[REDACTED]')[_0x45541f(0x11a)](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);}function a0_0x3927(){const _0x50f72f=['fromAlias','delivered','network_id','<missing>','stringify','type','body','decode','CommHub\x20rejected\x20task','min','s...','name','application/json,\x20text/event-stream','parentTaskId','Authorization','getAllStatus','/events/','task.send.start','AbortError','send_rejected','task.ack','sdk-','status','task.replied','send_reply','sseAbort','SSE\x20connected','data:\x20','agent','url','\x20duration_ms=','mcp_http','53074740PLeqkJ','send','error','emit','running','connect','text/event-stream','<pending>','\x20lifecycle=','error_code','10462998TnCzyK','connectSSE','\x20from=','task_id','2.0','string','cwd','disconnected','unknown\x20error','from_alias','2780714bjthvK','5GkBhPn','broadcast','SSE\x20failed:\x20','failed','\x20to=','text','task.send.delivered','toAlias','abort','pop','send_message','split','task.send.failed','heartbeatInterval','SSE\x20reconnecting\x20in\x20','message','content','slice','new_message','transport','6488752vsdIXR','12248LvlAOU','signal','match','disconnect','completed',']\x20[commhub:','token','\x20task_id=','task.expired','sleep','alias','5562JvyHjd','9424828JFssXf','now','parse','getReader','messages','networkId','lifecycle_tracking','sdk','3izNcEU','duration_ms','send_failed','CommHub\x20response\x20omitted\x20task_id','missing_task_id','get_inbox','lifecycleTracking','[commhub:task]\x20','1029229CfQMas','to_alias','message_id','get_all_status','heartbeat\x20failed:\x20','call','inbox\x20error:\x20','<unknown>','log','Bearer\x20','heartbeatTimer','read','\x20network_id=','toTimeString','reconnectDelay','replace','SSE\x20error:\x20','task','new_task','resumeId','registered','sending'];a0_0x3927=function(){return _0x50f72f;};return a0_0x3927();}function y(_0x50dd5b,_0x26c289=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x46a26e=a0_0x240860;if(_0x26c289)return JSON[_0x46a26e(0x125)](_0x50dd5b);let _0x156ad9=c(_0x50dd5b['parent_task_id'],_0x46a26e(0x124)),_0x136b5b=c(_0x50dd5b['task_id'],_0x46a26e(0x148)),_0x5bf3ba=_0x50dd5b[_0x46a26e(0x14a)]?'\x20error='+_0x50dd5b[_0x46a26e(0x14a)]+':'+(_0x50dd5b['error_message']??''):'';return _0x46a26e(0x10a)+_0x50dd5b['status']+_0x46a26e(0x14d)+c(_0x50dd5b[_0x46a26e(0x154)],_0x46a26e(0x112))+_0x46a26e(0x15a)+c(_0x50dd5b[_0x46a26e(0x10c)],'<unknown>')+_0x46a26e(0xf6)+_0x136b5b+'\x20parent_task_id='+_0x156ad9+_0x46a26e(0x117)+c(_0x50dd5b[_0x46a26e(0x123)],_0x46a26e(0x112))+'\x20transport='+_0x50dd5b[_0x46a26e(0xed)]+_0x46a26e(0x13f)+_0x50dd5b[_0x46a26e(0x104)]+_0x46a26e(0x149)+_0x50dd5b[_0x46a26e(0x101)]+_0x5bf3ba;}function b(_0x309e22){const _0x3e8a2e=a0_0x240860;return{'event':{'sending':_0x3e8a2e(0x132),'delivered':_0x3e8a2e(0x15c),'failed':_0x3e8a2e(0x162),'acked':_0x3e8a2e(0x135),'started':'task.started','replied':_0x3e8a2e(0x138),'expired':_0x3e8a2e(0xf7)}[_0x309e22[_0x3e8a2e(0x137)]],..._0x309e22};}function w(_0x485425){const _0x24dc5a=a0_0x240860;let _0x55ef2b=_0x485425?.[_0x24dc5a(0x14e)]||_0x485425?.['message_id']||_0x485425?.['id'];if(_0x55ef2b)return String(_0x55ef2b);let _0x30b2b4=_0x485425?.[_0x24dc5a(0xea)]?.[0x0]?.['text'];if(typeof _0x30b2b4!==_0x24dc5a(0x150))return null;try{let _0x1798c=JSON[_0x24dc5a(0xfd)](_0x30b2b4);return _0x1798c?.[_0x24dc5a(0x14e)]||_0x1798c?.[_0x24dc5a(0x10d)]||_0x1798c?.['id']||null;}catch{return null;}}async function h(_0x45f05f,_0x524841){const _0x5ae68a=a0_0x240860;let _0x5ea059=_0x524841[_0x5ae68a(0xfc)]??Date[_0x5ae68a(0xfc)],_0x133027=_0x5ea059(),_0x4936d7=(_0x33de68,_0x5a571c,_0x41691c,_0xf327e9)=>{const _0x291d1f=_0x5ae68a;_0x524841['log'](y(b({'from_alias':_0x45f05f[_0x291d1f(0x121)],'to_alias':_0x45f05f[_0x291d1f(0x15d)],'task_id':_0x5a571c,'parent_task_id':_0x45f05f[_0x291d1f(0x12e)],'network_id':_0x45f05f[_0x291d1f(0x100)],'transport':_0x45f05f['transport'],'status':_0x33de68,'duration_ms':_0x5ea059()-_0x133027,'lifecycle_tracking':_0x45f05f[_0x291d1f(0x109)],..._0x41691c!==void 0x0?{'error_code':_0xf327e9||_0x291d1f(0x105),'error_message':T(_0x41691c)}:{}})));};_0x4936d7(_0x5ae68a(0x120),null);try{let _0x532c49=await _0x524841['send'](),_0x271066=w(_0x532c49);if(_0x271066)_0x4936d7(_0x5ae68a(0x122),_0x271066);else{if(_0x532c49?.['ok']===!0x1||_0x532c49?.[_0x5ae68a(0x143)])_0x4936d7('failed',_0x271066,_0x532c49?.[_0x5ae68a(0x143)]||_0x5ae68a(0x129),_0x5ae68a(0x134));else _0x4936d7(_0x5ae68a(0x159),null,_0x5ae68a(0x106),_0x5ae68a(0x107));}return _0x532c49;}catch(_0x54d25c){throw _0x4936d7(_0x5ae68a(0x159),null,_0x54d25c,_0x5ae68a(0x105)),_0x54d25c;}}function a0_0xfa02(_0x5ea432,_0x4d7ff6){_0x5ea432=_0x5ea432-0xe8;const _0x392711=a0_0x3927();let _0xfa0231=_0x392711[_0x5ea432];return _0xfa0231;}async function u(_0x58ded2,_0x4e8d76){const _0x46835b=a0_0x240860;return h({'fromAlias':_0x58ded2[_0x46835b(0x121)],'toAlias':_0x58ded2[_0x46835b(0xf9)],'parentTaskId':_0x58ded2[_0x46835b(0x12e)]||null,'networkId':_0x58ded2['networkId']||null,'transport':_0x46835b(0x140),'lifecycleTracking':'not_tracked'},_0x4e8d76);}class k extends a0_0x59ad8d{['url'];[a0_0x240860(0xf9)];[a0_0x240860(0xf5)];[a0_0x240860(0x13d)];['resumeId'];[a0_0x240860(0x163)];[a0_0x240860(0x119)];[a0_0x240860(0x115)];['sseAbort'];[a0_0x240860(0x145)]=!0x1;constructor(_0x550012){const _0x565047=a0_0x240860;super();if(this[_0x565047(0x13e)]=_0x550012[_0x565047(0x13e)][_0x565047(0x11a)](/\/$/,''),this['alias']=_0x550012['alias'],this[_0x565047(0xf5)]=_0x550012['token'],this[_0x565047(0x13d)]=_0x550012[_0x565047(0x13d)]||_0x565047(0x102),this[_0x565047(0x11e)]=_0x565047(0x136)+_0x550012['alias']+'-'+Date[_0x565047(0xfc)]()['toString'](0x24),this[_0x565047(0x163)]=_0x550012['heartbeatInterval']??0x2bf20,this[_0x565047(0x119)]=_0x550012[_0x565047(0x119)]??0xbb8,_0x550012['autoConnect']!==!0x1)this['connect']();}[a0_0x240860(0x113)](_0x4b788e){const _0x5428ea=a0_0x240860;console[_0x5428ea(0x113)]('['+new Date()[_0x5428ea(0x118)]()['slice'](0x0,0x8)+_0x5428ea(0xf4)+this[_0x5428ea(0xf9)]+']\x20'+_0x4b788e);}async[a0_0x240860(0x110)](_0x1e3ef4,_0x5d3248){const _0xe8bd55=a0_0x240860;let _0x5154b4={'Content-Type':'application/json','Accept':_0xe8bd55(0x12d)};if(this[_0xe8bd55(0xf5)])_0x5154b4[_0xe8bd55(0x12f)]=_0xe8bd55(0x114)+this[_0xe8bd55(0xf5)];let _0x5e1651=await(await fetch(this[_0xe8bd55(0x13e)]+'/mcp',{'method':'POST','headers':_0x5154b4,'body':JSON['stringify']({'jsonrpc':_0xe8bd55(0x14f),'id':Date[_0xe8bd55(0xfc)](),'method':'tools/call','params':{'name':_0x1e3ef4,'arguments':_0x5d3248}})}))[_0xe8bd55(0x15b)](),_0x2a9e3e=_0x5e1651[_0xe8bd55(0xf1)](/data: (.+)/),_0x2a46f7=_0x2a9e3e?JSON[_0xe8bd55(0xfd)](_0x2a9e3e[0x1]):JSON[_0xe8bd55(0xfd)](_0x5e1651),_0x1b5d6e=_0x2a46f7?.['result']?.[_0xe8bd55(0xea)]?.[0x0]?.['text'];return _0x1b5d6e?JSON[_0xe8bd55(0xfd)](_0x1b5d6e):_0x2a46f7;}async[a0_0x240860(0x146)](){const _0x53d85d=a0_0x240860;if(this[_0x53d85d(0x145)])return;this[_0x53d85d(0x145)]=!0x0,await this[_0x53d85d(0x137)]('idle'),this['log'](_0x53d85d(0x11f)),this[_0x53d85d(0x115)]=setInterval(()=>{const _0x18ced7=_0x53d85d;this['status']('idle')['catch'](_0x5a727d=>this[_0x18ced7(0x113)](_0x18ced7(0x10f)+_0x5a727d[_0x18ced7(0xe9)]));},this[_0x53d85d(0x163)]),this[_0x53d85d(0x14c)]();}async[a0_0x240860(0xf2)](){const _0xa20671=a0_0x240860;if(this[_0xa20671(0x145)]=!0x1,this['sseAbort']?.[_0xa20671(0x15e)](),this['heartbeatTimer'])clearInterval(this[_0xa20671(0x115)]);await this[_0xa20671(0x137)]('offline')['catch'](()=>{}),this['log'](_0xa20671(0x152));}async[a0_0x240860(0x142)](_0x1df799,_0x2f4ba3,_0x35e566='normal'){const _0x583976=a0_0x240860;return u({'alias':_0x1df799,'fromAlias':this[_0x583976(0xf9)]},{'log':_0x4be846=>console[_0x583976(0x113)](_0x4be846),'send':()=>this[_0x583976(0x110)]('send_task',{'alias':_0x1df799,'task':_0x2f4ba3,'priority':_0x35e566,'from_session':this[_0x583976(0xf9)]})});}async[a0_0x240860(0xe9)](_0x47dfc0,_0x974a6c){const _0x34ed86=a0_0x240860;return this[_0x34ed86(0x110)](_0x34ed86(0x160),{'alias':_0x47dfc0,'message':_0x974a6c,'from_session':this[_0x34ed86(0xf9)]});}async['reply'](_0x153e61,_0x4ca25c,_0x3d1304=a0_0x240860(0xf3)){const _0x44489e=a0_0x240860;return this[_0x44489e(0x110)](_0x44489e(0x139),{'in_reply_to':_0x153e61,'text':_0x4ca25c,'status':_0x3d1304});}async[a0_0x240860(0x137)](_0x5e13a5,_0x5ebc83){const _0xf8a758=a0_0x240860;return this['call']('report_status',{'resume_id':this[_0xf8a758(0x11e)],'alias':this[_0xf8a758(0xf9)],'status':_0x5e13a5,'server':a0_0x11444b(),'hostname':a0_0x11444b(),'agent':this[_0xf8a758(0x13d)],'project_dir':process[_0xf8a758(0x151)](),..._0x5ebc83});}async[a0_0x240860(0x130)](){const _0x14c30d=a0_0x240860;return this[_0x14c30d(0x110)](_0x14c30d(0x10e),{});}async[a0_0x240860(0x157)](_0x36d094,_0x2e3e57){const _0x149bb8=a0_0x240860;return this[_0x149bb8(0x110)](_0x149bb8(0x157),{'message':_0x36d094,'filter_server':_0x2e3e57?.['server'],'filter_status':_0x2e3e57?.[_0x149bb8(0x137)]});}async['connectSSE'](){const _0x26ff5c=a0_0x240860;let _0x15c140=encodeURIComponent(this[_0x26ff5c(0xf9)]),_0x58c2b5=this['url']+_0x26ff5c(0x131)+_0x15c140,_0x30a412=this[_0x26ff5c(0x119)];while(this[_0x26ff5c(0x145)]){try{this[_0x26ff5c(0x13a)]=new AbortController();let _0x4e5ea9={'Accept':_0x26ff5c(0x147)};if(this[_0x26ff5c(0xf5)])_0x4e5ea9[_0x26ff5c(0x12f)]=_0x26ff5c(0x114)+this[_0x26ff5c(0xf5)];let _0x511bf7=await fetch(_0x58c2b5,{'headers':_0x4e5ea9,'signal':this[_0x26ff5c(0x13a)][_0x26ff5c(0xf0)]});if(!_0x511bf7['ok']||!_0x511bf7[_0x26ff5c(0x127)]){this[_0x26ff5c(0x113)](_0x26ff5c(0x158)+_0x511bf7[_0x26ff5c(0x137)]),await this['sleep'](_0x30a412),_0x30a412=Math[_0x26ff5c(0x12a)](_0x30a412*1.5,0xea60);continue;}_0x30a412=this['reconnectDelay'];let _0x38fecf=_0x511bf7[_0x26ff5c(0x127)][_0x26ff5c(0xfe)](),_0x2f9bfb=new TextDecoder(),_0x24607d='';while(this[_0x26ff5c(0x145)]){let {done:_0x1d6c6c,value:_0x26bf96}=await _0x38fecf[_0x26ff5c(0x116)]();if(_0x1d6c6c)break;_0x24607d+=_0x2f9bfb[_0x26ff5c(0x128)](_0x26bf96,{'stream':!0x0});let _0x37a360=_0x24607d[_0x26ff5c(0x161)]('\x0a');_0x24607d=_0x37a360[_0x26ff5c(0x15f)]()||'';for(let _0x48fdad of _0x37a360){if(!_0x48fdad['startsWith'](_0x26ff5c(0x13c)))continue;try{let _0x3cd990=JSON[_0x26ff5c(0xfd)](_0x48fdad[_0x26ff5c(0xeb)](0x6));if(_0x3cd990[_0x26ff5c(0x126)]==='connected'){this['log'](_0x26ff5c(0x13b)),this[_0x26ff5c(0x144)]('connected');continue;}if(_0x3cd990[_0x26ff5c(0x126)]===_0x26ff5c(0x11d)||_0x3cd990[_0x26ff5c(0x126)]===_0x26ff5c(0xec)||_0x3cd990[_0x26ff5c(0x126)]===_0x26ff5c(0x157))await this['processInbox']();}catch{}}}}catch(_0x4b0e70){if(_0x4b0e70[_0x26ff5c(0x12c)]===_0x26ff5c(0x133))break;this[_0x26ff5c(0x144)](_0x26ff5c(0x143),_0x4b0e70),this[_0x26ff5c(0x113)](_0x26ff5c(0x11b)+_0x4b0e70['message']);}if(this[_0x26ff5c(0x145)])this['emit'](_0x26ff5c(0x152)),this[_0x26ff5c(0x113)](_0x26ff5c(0xe8)+_0x30a412/0x3e8+_0x26ff5c(0x12b)),await this[_0x26ff5c(0xf8)](_0x30a412),_0x30a412=Math[_0x26ff5c(0x12a)](_0x30a412*1.5,0xea60);}}async['processInbox'](){const _0xae381d=a0_0x240860;try{let _0x12eb26=(await this['call'](_0xae381d(0x108),{'alias':this[_0xae381d(0xf9)],'limit':0xa}))?.[_0xae381d(0xff)]||[];for(let _0x12e458 of _0x12eb26)await this[_0xae381d(0x110)]('ack_inbox',{'alias':this[_0xae381d(0xf9)],'message_id':_0x12e458['id']}),this['log']('←\x20'+_0x12e458['from_session']+':\x20'+_0x12e458['content'][_0xae381d(0xeb)](0x0,0x3c)),this[_0xae381d(0x144)](_0xae381d(0x11c),_0x12e458),this[_0xae381d(0x144)]('message',_0x12e458);}catch(_0x4ab21f){this[_0xae381d(0x113)](_0xae381d(0x111)+_0x4ab21f[_0xae381d(0xe9)]);}}[a0_0x240860(0xf8)](_0x3f5ab1){return new Promise(_0x4560de=>setTimeout(_0x4560de,_0x3f5ab1));}}var O=k;export{k as CommHub,O as default};
|
|
@@ -6,8 +6,10 @@ export interface CopresenceDep {
|
|
|
6
6
|
readonly why: string;
|
|
7
7
|
}
|
|
8
8
|
export type CommandProbe = (cmd: string) => boolean;
|
|
9
|
-
|
|
10
|
-
export
|
|
9
|
+
/** Which agent binary this co-presence lane is built on. */
|
|
10
|
+
export type CopresenceAgent = "codex" | "grok";
|
|
11
|
+
export declare function copresenceDeps(probe: CommandProbe, platform?: NodeJS.Platform, agent?: CopresenceAgent): CopresenceDep[];
|
|
12
|
+
export declare function missingCopresenceDeps(probe: CommandProbe, platform?: NodeJS.Platform, agent?: CopresenceAgent): CopresenceDep[];
|
|
11
13
|
/** One block naming every gap and how to close it — never one gap at a time. */
|
|
12
14
|
export declare function describeMissingDeps(missing: readonly CopresenceDep[], displayName: string): string;
|
|
13
15
|
/**
|
|
@@ -45,7 +45,12 @@ export interface GrokAttachResizeFrame {
|
|
|
45
45
|
cols: number;
|
|
46
46
|
rows: number;
|
|
47
47
|
}
|
|
48
|
-
|
|
48
|
+
/** Asks the node to switch models (issue #879); allowed on control connections. */
|
|
49
|
+
export interface GrokAttachSetModelFrame {
|
|
50
|
+
type: "set-model";
|
|
51
|
+
model: string;
|
|
52
|
+
}
|
|
53
|
+
export type GrokAttachClientFrame = GrokAttachInputFrame | GrokAttachResizeFrame | GrokAttachSetModelFrame | GrokAttachDetachFrame;
|
|
49
54
|
export interface GrokAttachInputSource {
|
|
50
55
|
on(event: "data", listener: (chunk: unknown) => void): unknown;
|
|
51
56
|
on(event: "end", listener: () => void): unknown;
|
|
@@ -105,6 +110,15 @@ export interface GrokAttachSession {
|
|
|
105
110
|
readonly closed: Promise<GrokAttachCloseInfo>;
|
|
106
111
|
detach(): void;
|
|
107
112
|
resize(cols?: number, rows?: number): void;
|
|
113
|
+
/**
|
|
114
|
+
* Ask the node to switch models (issue #879).
|
|
115
|
+
*
|
|
116
|
+
* The outcome does not come back from this call — it arrives as a `status`
|
|
117
|
+
* frame carrying `modelSwitch`, because the node may accept, refuse
|
|
118
|
+
* (busy / unchanged / invalid), or fail while re-spawning. Callers read it
|
|
119
|
+
* through `onStatus`.
|
|
120
|
+
*/
|
|
121
|
+
setModel(model: string): void;
|
|
108
122
|
}
|
|
109
123
|
export declare class GrokAttachRemoteError extends Error {
|
|
110
124
|
readonly code: string;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** tmux session names. The attachable TUI owns the bare alias so that
|
|
2
|
+
* `tmux attach -t '=<alias>'` lands a human on the TUI, matching the codex
|
|
3
|
+
* lane exactly — an operator should not have to remember which runtime a node
|
|
4
|
+
* uses in order to know where to attach. */
|
|
5
|
+
export declare function grokCopresenceSessions(displayName: string): {
|
|
6
|
+
node: string;
|
|
7
|
+
tui: string;
|
|
8
|
+
};
|
|
9
|
+
export type GrokAttachSocketState = "missing" | "not_a_socket" | "ready";
|
|
10
|
+
/** Readiness is "the attach socket exists AND is a socket", never "the child
|
|
11
|
+
* process started". A grok leader that dies during startup leaves either no
|
|
12
|
+
* socket at all or a stale regular file from an aborted run; both used to read
|
|
13
|
+
* as ready because nothing looked. */
|
|
14
|
+
export declare function grokAttachSocketState(entry: {
|
|
15
|
+
isSocket(): boolean;
|
|
16
|
+
} | null | undefined): GrokAttachSocketState;
|
|
17
|
+
/** Set on the node child so that `anet node start` inside the tmux session does
|
|
18
|
+
* not re-enter this orchestration and fork bomb. The codex lane guards on the
|
|
19
|
+
* same variable (cli.ts: `process.env.ANET_COPRESENCE_BRIDGE !== "1"`); using a
|
|
20
|
+
* second name would leave two guards that must be kept in sync by hand. */
|
|
21
|
+
export declare const GROK_COPRESENCE_CHILD_ENV = "ANET_COPRESENCE_BRIDGE";
|
|
22
|
+
export interface GrokCopresenceDiagnosis {
|
|
23
|
+
readonly ok: boolean;
|
|
24
|
+
readonly lines: readonly string[];
|
|
25
|
+
}
|
|
26
|
+
/** One block naming every reason this node cannot run the shared TUI, not one
|
|
27
|
+
* exit per reason. A node that is both the wrong runtime AND missing its
|
|
28
|
+
* attach socket should learn both in one run. */
|
|
29
|
+
/** Platforms whose PTY / IPC / isolation primitives the grok co-presence lane
|
|
30
|
+
* has actually been validated on. agent-node refuses anywhere else, and it does
|
|
31
|
+
* so only after the node has been created and started once:
|
|
32
|
+
*
|
|
33
|
+
* [agent-node] grok-build-cli co-presence 无法在 darwin 上运行,缺少:
|
|
34
|
+
* 平台 darwin 尚未验证过共存所需的 PTY / IPC / 隔离原语
|
|
35
|
+
*
|
|
36
|
+
* Learned the expensive way on a Mac mini: install anet, install agent-node,
|
|
37
|
+
* create the node, start it — and only then find out the platform is refused.
|
|
38
|
+
* A one-command launcher that lets someone get that far has not saved them
|
|
39
|
+
* anything, so say it in the same breath as every other gap. */
|
|
40
|
+
export declare const GROK_COPRESENCE_PLATFORMS: readonly NodeJS.Platform[];
|
|
41
|
+
export declare function diagnoseGrokCopresence(input: {
|
|
42
|
+
runtime: string;
|
|
43
|
+
displayName: string;
|
|
44
|
+
grokCopresence?: boolean;
|
|
45
|
+
grokAttachSocket?: string;
|
|
46
|
+
platform?: NodeJS.Platform;
|
|
47
|
+
}): GrokCopresenceDiagnosis;
|
|
48
|
+
/** True when a plain `anet node start <name>` (no flag) should bring the shared
|
|
49
|
+
* TUI up by itself.
|
|
50
|
+
*
|
|
51
|
+
* 🔴 Deliberately NOT keyed on `grokCopresence`. That field is set to true at
|
|
52
|
+
* CREATE time for every grok-build-cli node, so reading it here would silently
|
|
53
|
+
* change what `anet node start` does for every grok node that already exists —
|
|
54
|
+
* they would stop running in the foreground and fork into tmux, unasked. Caught
|
|
55
|
+
* exactly that way: a start without the flag entered the orchestration.
|
|
56
|
+
*
|
|
57
|
+
* The codex lane looks the same but is not: `codexCopresence` is written only
|
|
58
|
+
* when the operator passes the flag. So grok needs its own record of the
|
|
59
|
+
* operator's choice, and `grokCopresenceAuto` is it. */
|
|
60
|
+
export declare function grokCopresenceRequested(flagPassed: boolean, profile: {
|
|
61
|
+
runtime?: unknown;
|
|
62
|
+
grokCopresence?: unknown;
|
|
63
|
+
grokCopresenceAuto?: unknown;
|
|
64
|
+
}): boolean;
|
|
65
|
+
/** Record the operator's opt-in so the NEXT start needs no flag — and only then.
|
|
66
|
+
* Never infer it from `grokCopresence`, which create sets by default. */
|
|
67
|
+
export declare function shouldPersistGrokCopresence(flagPassed: boolean, profile: {
|
|
68
|
+
runtime?: unknown;
|
|
69
|
+
grokCopresenceAuto?: unknown;
|
|
70
|
+
}): boolean;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { IMCorrelationStore, IMTaskCorrelation } from "./types";
|
|
2
|
+
export interface JsonIMCorrelationStoreOptions {
|
|
3
|
+
now?: () => number;
|
|
4
|
+
/** How long idempotency keys remain valid. Defaults to 24h. */
|
|
5
|
+
seenTtlMs?: number;
|
|
6
|
+
/** How long terminal correlations remain queryable. Defaults to 24h. */
|
|
7
|
+
terminalTtlMs?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Small durable store for RFC-020 §2.9④ / §4.4 correlation state.
|
|
11
|
+
*
|
|
12
|
+
* The first gateway PR needs this as a standalone data structure before the
|
|
13
|
+
* bridge is rewired: idempotency keys survive process restart, and task replies
|
|
14
|
+
* can be routed back to their originating IM conversation.
|
|
15
|
+
*/
|
|
16
|
+
export declare class JsonIMCorrelationStore implements IMCorrelationStore {
|
|
17
|
+
private readonly path;
|
|
18
|
+
private readonly now;
|
|
19
|
+
private readonly seenTtlMs;
|
|
20
|
+
private readonly terminalTtlMs;
|
|
21
|
+
constructor(path: string, options?: JsonIMCorrelationStoreOptions);
|
|
22
|
+
hasSeen(idempotencyKey: string): Promise<string | null>;
|
|
23
|
+
recordSeen(idempotencyKey: string, taskId: string): Promise<void>;
|
|
24
|
+
getCorrelation(taskId: string): Promise<IMTaskCorrelation | null>;
|
|
25
|
+
putCorrelation(taskId: string, correlation: IMTaskCorrelation): Promise<void>;
|
|
26
|
+
updateStatus(taskId: string, status: IMTaskCorrelation["status"]): Promise<void>;
|
|
27
|
+
gc(now: number): Promise<{
|
|
28
|
+
removed: number;
|
|
29
|
+
}>;
|
|
30
|
+
private isExpired;
|
|
31
|
+
private load;
|
|
32
|
+
private save;
|
|
33
|
+
}
|
|
34
|
+
export declare function createJsonIMCorrelationStore(path: string, options?: JsonIMCorrelationStoreOptions): IMCorrelationStore;
|