@sleep2agi/agent-network 2.3.0-preview.161 → 2.3.0-preview.164

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.
@@ -1 +1 @@
1
- const a0_0x48433c=a0_0x25c5;(function(_0x46ea15,_0xf86193){const _0x3e2f9a=a0_0x25c5,_0x48b355=_0x46ea15();while(!![]){try{const _0x1e6afa=-parseInt(_0x3e2f9a(0x19c))/0x1+-parseInt(_0x3e2f9a(0x184))/0x2+-parseInt(_0x3e2f9a(0x1a0))/0x3+-parseInt(_0x3e2f9a(0x17f))/0x4*(-parseInt(_0x3e2f9a(0x1a3))/0x5)+-parseInt(_0x3e2f9a(0x196))/0x6*(-parseInt(_0x3e2f9a(0x1b2))/0x7)+-parseInt(_0x3e2f9a(0x1dc))/0x8*(-parseInt(_0x3e2f9a(0x199))/0x9)+-parseInt(_0x3e2f9a(0x1f2))/0xa*(-parseInt(_0x3e2f9a(0x1b1))/0xb);if(_0x1e6afa===_0xf86193)break;else _0x48b355['push'](_0x48b355['shift']());}catch(_0x283aa6){_0x48b355['push'](_0x48b355['shift']());}}}(a0_0xbe4d,0x3f44f));import{EventEmitter as a0_0x380af2}from'events';import{hostname as a0_0x106efe}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x1f4861,_0x55d04d)=>(_0x1f4861??_0x55d04d)[a0_0x48433c(0x1eb)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[a0_0x48433c(0x1db)](0x0,0xf0);function N(_0x4d9f15){const _0x3edcc6=a0_0x48433c;return(_0x4d9f15 instanceof Error?_0x4d9f15[_0x3edcc6(0x1da)]:String(_0x4d9f15??'unknown\x20error'))[_0x3edcc6(0x1eb)](K,_0x3edcc6(0x18b))[_0x3edcc6(0x1eb)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x3edcc6(0x1db)](0x0,0xf0);}function O(_0x5112e6,_0x4ebefc=process.env.ANET_TASK_TRACE_FORMAT==='json'){const _0x2cecd0=a0_0x48433c;if(_0x4ebefc)return JSON[_0x2cecd0(0x19f)](_0x5112e6);let _0x1e83df=L(_0x5112e6['parent_task_id'],'<missing>'),_0x1e1b52=L(_0x5112e6['task_id'],_0x2cecd0(0x1ac)),_0x1b33ca=_0x5112e6[_0x2cecd0(0x1e1)]?'\x20error='+_0x5112e6[_0x2cecd0(0x1e1)]+':'+(_0x5112e6['error_message']??''):'';return _0x2cecd0(0x1be)+_0x5112e6[_0x2cecd0(0x19a)]+_0x2cecd0(0x1ae)+L(_0x5112e6[_0x2cecd0(0x1cd)],_0x2cecd0(0x194))+_0x2cecd0(0x1cb)+L(_0x5112e6['to_alias'],'<unknown>')+_0x2cecd0(0x1ca)+_0x1e1b52+_0x2cecd0(0x1d3)+_0x1e83df+_0x2cecd0(0x18f)+L(_0x5112e6[_0x2cecd0(0x1b0)],_0x2cecd0(0x194))+'\x20transport='+_0x5112e6[_0x2cecd0(0x1ba)]+'\x20duration_ms='+_0x5112e6[_0x2cecd0(0x1f5)]+_0x2cecd0(0x1ea)+_0x5112e6[_0x2cecd0(0x1d0)]+_0x1b33ca;}function a0_0xbe4d(){const _0x18b3ad=['application/json,\x20text/event-stream','result','293594XJfJpR','parentTaskId','startsWith','delivered','parse','report_status','now','[REDACTED]','cwd','signal','new_task','\x20network_id=','heartbeatTimer','reconnectDelay','heartbeatInterval','disconnect','<unknown>','error','220818NCEcyU','split','sending','72999AFTSCh','status','sleep','328649gIhkRV','toString','/events/','stringify','695559rteRBQ','call','offline','854020VveXXY','send_failed','data:\x20','min','task.started','token','name','failed','connectSSE','<pending>','sdk','\x20from=',']\x20[commhub:','network_id','165ayXvtG','14OvMOow','content','autoConnect','SSE\x20connected','get_inbox','running','send_rejected','task','transport','Authorization','sseAbort','agent','[commhub:task]\x20','connected','new_message','from_session','AbortError','fromAlias','emit','send','inbox\x20error:\x20','match','decode','POST','\x20task_id=','\x20to=','task.ack','from_alias','catch','Bearer\x20','lifecycle_tracking','networkId','broadcast','\x20parent_task_id=','log','task.send.failed','text','messages','SSE\x20error:\x20','SSE\x20reconnecting\x20in\x20','message','slice','88aLxMBb','CommHub\x20response\x20omitted\x20task_id','alias','connect','/mcp','error_code','resumeId','not_tracked','type','disconnected','text/event-stream','reply','send_message','processInbox','\x20lifecycle=','replace','read','normal','missing_task_id','ack_inbox','idle','SSE\x20failed:\x20','308010RkKMuC','task.replied','message_id','duration_ms','toAlias','8nMwYOd','url','getAllStatus'];a0_0xbe4d=function(){return _0x18b3ad;};return a0_0xbe4d();}function U(_0x443d5a){const _0x5f2337=a0_0x48433c;return{'event':{'sending':'task.send.start','delivered':'task.send.delivered','failed':_0x5f2337(0x1d5),'acked':_0x5f2337(0x1cc),'started':_0x5f2337(0x1a7),'replied':_0x5f2337(0x1f3),'expired':'task.expired'}[_0x443d5a['status']],..._0x443d5a};}function j(_0x2d5dcc){const _0xd8436b=a0_0x48433c;let _0x548b7d=_0x2d5dcc?.['task_id']||_0x2d5dcc?.[_0xd8436b(0x1f4)]||_0x2d5dcc?.['id'];if(_0x548b7d)return String(_0x548b7d);let _0x1e5f66=_0x2d5dcc?.[_0xd8436b(0x1b3)]?.[0x0]?.[_0xd8436b(0x1d6)];if(typeof _0x1e5f66!=='string')return null;try{let _0x3a88b6=JSON['parse'](_0x1e5f66);return _0x3a88b6?.['task_id']||_0x3a88b6?.[_0xd8436b(0x1f4)]||_0x3a88b6?.['id']||null;}catch{return null;}}async function X(_0x4c70b6,_0xe12a0f){const _0x6fc10d=a0_0x48433c;let _0xc9fad1=_0xe12a0f[_0x6fc10d(0x18a)]??Date[_0x6fc10d(0x18a)],_0x27ca03=_0xc9fad1(),_0x128507=(_0x4531d6,_0x3de46c,_0xe9eb4f,_0x2cef04)=>{const _0x462bab=_0x6fc10d;_0xe12a0f['log'](O(U({'from_alias':_0x4c70b6[_0x462bab(0x1c3)],'to_alias':_0x4c70b6[_0x462bab(0x1f6)],'task_id':_0x3de46c,'parent_task_id':_0x4c70b6[_0x462bab(0x185)],'network_id':_0x4c70b6[_0x462bab(0x1d1)],'transport':_0x4c70b6['transport'],'status':_0x4531d6,'duration_ms':_0xc9fad1()-_0x27ca03,'lifecycle_tracking':_0x4c70b6['lifecycleTracking'],..._0xe9eb4f!==void 0x0?{'error_code':_0x2cef04||_0x462bab(0x1a4),'error_message':N(_0xe9eb4f)}:{}})));};_0x128507(_0x6fc10d(0x198),null);try{let _0x1ecd39=await _0xe12a0f['send'](),_0x1b32de=j(_0x1ecd39);if(_0x1b32de)_0x128507(_0x6fc10d(0x187),_0x1b32de);else{if(_0x1ecd39?.['ok']===!0x1||_0x1ecd39?.[_0x6fc10d(0x195)])_0x128507(_0x6fc10d(0x1aa),_0x1b32de,_0x1ecd39?.[_0x6fc10d(0x195)]||'CommHub\x20rejected\x20task',_0x6fc10d(0x1b8));else _0x128507(_0x6fc10d(0x1aa),null,_0x6fc10d(0x1dd),_0x6fc10d(0x1ee));}return _0x1ecd39;}catch(_0x13b6cd){throw _0x128507(_0x6fc10d(0x1aa),null,_0x13b6cd,_0x6fc10d(0x1a4)),_0x13b6cd;}}function a0_0x25c5(_0x3eccf3,_0x49d5ba){_0x3eccf3=_0x3eccf3-0x17f;const _0xbe4da1=a0_0xbe4d();let _0x25c58d=_0xbe4da1[_0x3eccf3];return _0x25c58d;}async function Y(_0x1fcaa8,_0x1d0a6c){const _0x44c82f=a0_0x48433c;return X({'fromAlias':_0x1fcaa8[_0x44c82f(0x1c3)],'toAlias':_0x1fcaa8[_0x44c82f(0x1de)],'parentTaskId':_0x1fcaa8[_0x44c82f(0x185)]||null,'networkId':_0x1fcaa8[_0x44c82f(0x1d1)]||null,'transport':'mcp_http','lifecycleTracking':_0x44c82f(0x1e3)},_0x1d0a6c);}class $ extends a0_0x380af2{[a0_0x48433c(0x180)];[a0_0x48433c(0x1de)];[a0_0x48433c(0x1a8)];[a0_0x48433c(0x1bd)];[a0_0x48433c(0x1e2)];[a0_0x48433c(0x192)];[a0_0x48433c(0x191)];[a0_0x48433c(0x190)];[a0_0x48433c(0x1bc)];[a0_0x48433c(0x1b7)]=!0x1;constructor(_0x14f07d){const _0x1ee3a1=a0_0x48433c;super();if(this[_0x1ee3a1(0x180)]=_0x14f07d[_0x1ee3a1(0x180)][_0x1ee3a1(0x1eb)](/\/$/,''),this[_0x1ee3a1(0x1de)]=_0x14f07d[_0x1ee3a1(0x1de)],this[_0x1ee3a1(0x1a8)]=_0x14f07d[_0x1ee3a1(0x1a8)],this[_0x1ee3a1(0x1bd)]=_0x14f07d[_0x1ee3a1(0x1bd)]||_0x1ee3a1(0x1ad),this[_0x1ee3a1(0x1e2)]='sdk-'+_0x14f07d['alias']+'-'+Date[_0x1ee3a1(0x18a)]()[_0x1ee3a1(0x19d)](0x24),this['heartbeatInterval']=_0x14f07d['heartbeatInterval']??0x2bf20,this[_0x1ee3a1(0x191)]=_0x14f07d[_0x1ee3a1(0x191)]??0xbb8,_0x14f07d[_0x1ee3a1(0x1b4)]!==!0x1)this[_0x1ee3a1(0x1df)]();}[a0_0x48433c(0x1d4)](_0x26730f){const _0xf9f10b=a0_0x48433c;console[_0xf9f10b(0x1d4)]('['+new Date()['toTimeString']()[_0xf9f10b(0x1db)](0x0,0x8)+_0xf9f10b(0x1af)+this[_0xf9f10b(0x1de)]+']\x20'+_0x26730f);}async[a0_0x48433c(0x1a1)](_0x38469f,_0x8003aa){const _0x21c350=a0_0x48433c;let _0x184cbb={'Content-Type':'application/json','Accept':_0x21c350(0x182)};if(this[_0x21c350(0x1a8)])_0x184cbb['Authorization']=_0x21c350(0x1cf)+this[_0x21c350(0x1a8)];let _0x1aa8a8=await(await fetch(this[_0x21c350(0x180)]+_0x21c350(0x1e0),{'method':_0x21c350(0x1c9),'headers':_0x184cbb,'body':JSON[_0x21c350(0x19f)]({'jsonrpc':'2.0','id':Date['now'](),'method':'tools/call','params':{'name':_0x38469f,'arguments':_0x8003aa}})}))[_0x21c350(0x1d6)](),_0x1e6d03=_0x1aa8a8[_0x21c350(0x1c7)](/data: (.+)/),_0x4d9cdc=_0x1e6d03?JSON[_0x21c350(0x188)](_0x1e6d03[0x1]):JSON[_0x21c350(0x188)](_0x1aa8a8),_0x168189=_0x4d9cdc?.[_0x21c350(0x183)]?.[_0x21c350(0x1b3)]?.[0x0]?.['text'];return _0x168189?JSON[_0x21c350(0x188)](_0x168189):_0x4d9cdc;}async[a0_0x48433c(0x1df)](){const _0x5ef9d2=a0_0x48433c;if(this['running'])return;this[_0x5ef9d2(0x1b7)]=!0x0,await this['status']('idle'),this[_0x5ef9d2(0x1d4)]('registered'),this['heartbeatTimer']=setInterval(()=>{const _0x1a596e=_0x5ef9d2;this[_0x1a596e(0x19a)](_0x1a596e(0x1f0))['catch'](_0x2c4857=>this['log']('heartbeat\x20failed:\x20'+_0x2c4857[_0x1a596e(0x1da)]));},this[_0x5ef9d2(0x192)]),this[_0x5ef9d2(0x1ab)]();}async[a0_0x48433c(0x193)](){const _0x117d6f=a0_0x48433c;if(this['running']=!0x1,this[_0x117d6f(0x1bc)]?.['abort'](),this[_0x117d6f(0x190)])clearInterval(this[_0x117d6f(0x190)]);await this[_0x117d6f(0x19a)](_0x117d6f(0x1a2))[_0x117d6f(0x1ce)](()=>{}),this[_0x117d6f(0x1d4)](_0x117d6f(0x1e5));}async[a0_0x48433c(0x1c5)](_0x507688,_0x4d2652,_0x1d9aa9=a0_0x48433c(0x1ed)){const _0x18b33b=a0_0x48433c;return Y({'alias':_0x507688,'fromAlias':this['alias']},{'log':_0x53e914=>console[_0x18b33b(0x1d4)](_0x53e914),'send':()=>this[_0x18b33b(0x1a1)]('send_task',{'alias':_0x507688,'task':_0x4d2652,'priority':_0x1d9aa9,'from_session':this['alias']})});}async[a0_0x48433c(0x1da)](_0x222f0e,_0x2443ac){const _0xd27eb=a0_0x48433c;return this[_0xd27eb(0x1a1)](_0xd27eb(0x1e8),{'alias':_0x222f0e,'message':_0x2443ac,'from_session':this['alias']});}async[a0_0x48433c(0x1e7)](_0x3ee7ff,_0x3b5a09,_0x348637='completed'){return this['call']('send_reply',{'in_reply_to':_0x3ee7ff,'text':_0x3b5a09,'status':_0x348637});}async[a0_0x48433c(0x19a)](_0x19c6f1,_0x3ac224){const _0x39e811=a0_0x48433c;return this[_0x39e811(0x1a1)](_0x39e811(0x189),{'resume_id':this[_0x39e811(0x1e2)],'alias':this['alias'],'status':_0x19c6f1,'server':a0_0x106efe(),'hostname':a0_0x106efe(),'agent':this[_0x39e811(0x1bd)],'project_dir':process[_0x39e811(0x18c)](),..._0x3ac224});}async[a0_0x48433c(0x181)](){return this['call']('get_all_status',{});}async[a0_0x48433c(0x1d2)](_0x415ea4,_0x2a7b72){const _0x88ef61=a0_0x48433c;return this[_0x88ef61(0x1a1)](_0x88ef61(0x1d2),{'message':_0x415ea4,'filter_server':_0x2a7b72?.['server'],'filter_status':_0x2a7b72?.[_0x88ef61(0x19a)]});}async[a0_0x48433c(0x1ab)](){const _0x77362f=a0_0x48433c;let _0x285b8b=encodeURIComponent(this[_0x77362f(0x1de)]),_0x393a6b=this['url']+_0x77362f(0x19e)+_0x285b8b,_0x51c2c8=this[_0x77362f(0x191)];while(this['running']){try{this[_0x77362f(0x1bc)]=new AbortController();let _0x22fca9={'Accept':_0x77362f(0x1e6)};if(this['token'])_0x22fca9[_0x77362f(0x1bb)]='Bearer\x20'+this[_0x77362f(0x1a8)];let _0x31343f=await fetch(_0x393a6b,{'headers':_0x22fca9,'signal':this[_0x77362f(0x1bc)][_0x77362f(0x18d)]});if(!_0x31343f['ok']||!_0x31343f['body']){this['log'](_0x77362f(0x1f1)+_0x31343f['status']),await this[_0x77362f(0x19b)](_0x51c2c8),_0x51c2c8=Math[_0x77362f(0x1a6)](_0x51c2c8*1.5,0xea60);continue;}_0x51c2c8=this[_0x77362f(0x191)];let _0x5a6963=_0x31343f['body']['getReader'](),_0x109d8c=new TextDecoder(),_0x32f459='';while(this[_0x77362f(0x1b7)]){let {done:_0xf4de4e,value:_0x3dd999}=await _0x5a6963[_0x77362f(0x1ec)]();if(_0xf4de4e)break;_0x32f459+=_0x109d8c[_0x77362f(0x1c8)](_0x3dd999,{'stream':!0x0});let _0x296e81=_0x32f459[_0x77362f(0x197)]('\x0a');_0x32f459=_0x296e81['pop']()||'';for(let _0x2ae7a6 of _0x296e81){if(!_0x2ae7a6[_0x77362f(0x186)](_0x77362f(0x1a5)))continue;try{let _0x572285=JSON[_0x77362f(0x188)](_0x2ae7a6[_0x77362f(0x1db)](0x6));if(_0x572285['type']===_0x77362f(0x1bf)){this['log'](_0x77362f(0x1b5)),this[_0x77362f(0x1c4)](_0x77362f(0x1bf));continue;}if(_0x572285[_0x77362f(0x1e4)]===_0x77362f(0x18e)||_0x572285[_0x77362f(0x1e4)]===_0x77362f(0x1c0)||_0x572285[_0x77362f(0x1e4)]===_0x77362f(0x1d2))await this[_0x77362f(0x1e9)]();}catch{}}}}catch(_0x2a2b85){if(_0x2a2b85[_0x77362f(0x1a9)]===_0x77362f(0x1c2))break;this[_0x77362f(0x1c4)]('error',_0x2a2b85),this[_0x77362f(0x1d4)](_0x77362f(0x1d8)+_0x2a2b85[_0x77362f(0x1da)]);}if(this[_0x77362f(0x1b7)])this[_0x77362f(0x1c4)]('disconnected'),this[_0x77362f(0x1d4)](_0x77362f(0x1d9)+_0x51c2c8/0x3e8+'s...'),await this[_0x77362f(0x19b)](_0x51c2c8),_0x51c2c8=Math[_0x77362f(0x1a6)](_0x51c2c8*1.5,0xea60);}}async[a0_0x48433c(0x1e9)](){const _0x4c7a09=a0_0x48433c;try{let _0x21f5e2=(await this[_0x4c7a09(0x1a1)](_0x4c7a09(0x1b6),{'alias':this[_0x4c7a09(0x1de)],'limit':0xa}))?.[_0x4c7a09(0x1d7)]||[];for(let _0x36fefa of _0x21f5e2)await this[_0x4c7a09(0x1a1)](_0x4c7a09(0x1ef),{'alias':this[_0x4c7a09(0x1de)],'message_id':_0x36fefa['id']}),this[_0x4c7a09(0x1d4)]('←\x20'+_0x36fefa[_0x4c7a09(0x1c1)]+':\x20'+_0x36fefa['content'][_0x4c7a09(0x1db)](0x0,0x3c)),this[_0x4c7a09(0x1c4)](_0x4c7a09(0x1b9),_0x36fefa),this[_0x4c7a09(0x1c4)]('message',_0x36fefa);}catch(_0x369a2a){this[_0x4c7a09(0x1d4)](_0x4c7a09(0x1c6)+_0x369a2a[_0x4c7a09(0x1da)]);}}[a0_0x48433c(0x19b)](_0x59db37){return new Promise(_0x4088ea=>setTimeout(_0x4088ea,_0x59db37));}}var F=$;export{F as default,$ as CommHub};
1
+ const a0_0x6aaf68=a0_0x1bd3;(function(_0x2a7878,_0xd6883c){const _0x3d0bb4=a0_0x1bd3,_0x5f550b=_0x2a7878();while(!![]){try{const _0x48a204=-parseInt(_0x3d0bb4(0x175))/0x1*(parseInt(_0x3d0bb4(0x138))/0x2)+parseInt(_0x3d0bb4(0x14d))/0x3+-parseInt(_0x3d0bb4(0x161))/0x4+-parseInt(_0x3d0bb4(0x10c))/0x5+-parseInt(_0x3d0bb4(0x143))/0x6+-parseInt(_0x3d0bb4(0x169))/0x7*(-parseInt(_0x3d0bb4(0x185))/0x8)+-parseInt(_0x3d0bb4(0x13b))/0x9*(-parseInt(_0x3d0bb4(0x155))/0xa);if(_0x48a204===_0xd6883c)break;else _0x5f550b['push'](_0x5f550b['shift']());}catch(_0x319fab){_0x5f550b['push'](_0x5f550b['shift']());}}}(a0_0x44a7,0x76af7));function a0_0x1bd3(_0x4ee2bf,_0x5511bc){_0x4ee2bf=_0x4ee2bf-0x103;const _0x44a7ff=a0_0x44a7();let _0x1bd37c=_0x44a7ff[_0x4ee2bf];return _0x1bd37c;}import{EventEmitter as a0_0x6a1d46}from'events';import{hostname as a0_0x42f55e}from'os';var K=/(?:atok|ntok|utok|ghp|github_pat)_[A-Za-z0-9_-]+|Bearer\s+\S+/gi,L=(_0x21797b,_0x4bb4bd)=>(_0x21797b??_0x4bb4bd)['replace'](/[\r\n\x00-\x1f\x7f]/g,'\x20')['slice'](0x0,0xf0);function a0_0x44a7(){const _0x21db26=['sending','delivered','88144wknKmU','missing_task_id','agent','7520427azPWWN','SSE\x20failed:\x20','2.0','task_id','ack_inbox','task','call','reply','5823180qGQAmK','application/json','offline','catch','send_rejected','inbox\x20error:\x20','\x20to=','<missing>','now','\x20from=','140778vbOwtZ','s...','alias','SSE\x20reconnecting\x20in\x20','to_alias','connect','reconnectDelay','new_task','20wvlxVM','running','parentTaskId',']\x20[commhub:','messages','error_code','SSE\x20error:\x20','text','networkId','error','/mcp','processInbox','592116vUfOkf','normal','heartbeatInterval','\x20error=','CommHub\x20response\x20omitted\x20task_id','text/event-stream','task.replied','split','357ZRJeCv','disconnected','getReader','connectSSE','string','name','[REDACTED]','send_reply','task.send.failed','\x20task_id=','json','task.ack','3xPmEXN','network_id','registered','duration_ms','message_id','stringify','replace','parent_task_id','failed','broadcast','lifecycle_tracking','get_all_status','[commhub:task]\x20','\x20transport=','body','/events/','75224uFOHqg','pop','heartbeatTimer','lifecycleTracking','signal','send','status','message','cwd','send_message','2303875jOIktg','task.expired','toAlias','send_task','token','from_alias','slice','application/json,\x20text/event-stream','resumeId','task.send.delivered','server','content','result','fromAlias','emit','<unknown>','getAllStatus','send_failed','sleep','completed','toTimeString','sseAbort','transport','task.send.start','parse','log','mcp_http','url','sdk','idle','Authorization','decode','connected','type','min','abort','data:\x20','\x20duration_ms=','task.started','Bearer\x20','new_message','\x20lifecycle='];a0_0x44a7=function(){return _0x21db26;};return a0_0x44a7();}function N(_0x55776b){const _0x25a538=a0_0x1bd3;return(_0x55776b instanceof Error?_0x55776b[_0x25a538(0x109)]:String(_0x55776b??'unknown\x20error'))[_0x25a538(0x17b)](K,_0x25a538(0x16f))[_0x25a538(0x17b)](/[\r\n\x00-\x1f\x7f]/g,'\x20')[_0x25a538(0x112)](0x0,0xf0);}function O(_0x30c9a6,_0x224bcc=process.env.ANET_TASK_TRACE_FORMAT===a0_0x6aaf68(0x173)){const _0x24a34f=a0_0x6aaf68;if(_0x224bcc)return JSON[_0x24a34f(0x17a)](_0x30c9a6);let _0x421439=L(_0x30c9a6[_0x24a34f(0x17c)],_0x24a34f(0x14a)),_0x407db8=L(_0x30c9a6[_0x24a34f(0x13e)],'<pending>'),_0xba3503=_0x30c9a6[_0x24a34f(0x15a)]?_0x24a34f(0x164)+_0x30c9a6['error_code']+':'+(_0x30c9a6['error_message']??''):'';return _0x24a34f(0x181)+_0x30c9a6[_0x24a34f(0x108)]+_0x24a34f(0x14c)+L(_0x30c9a6[_0x24a34f(0x111)],_0x24a34f(0x11b))+_0x24a34f(0x149)+L(_0x30c9a6[_0x24a34f(0x151)],_0x24a34f(0x11b))+_0x24a34f(0x172)+_0x407db8+'\x20parent_task_id='+_0x421439+'\x20network_id='+L(_0x30c9a6[_0x24a34f(0x176)],'<unknown>')+_0x24a34f(0x182)+_0x30c9a6[_0x24a34f(0x122)]+_0x24a34f(0x131)+_0x30c9a6[_0x24a34f(0x178)]+_0x24a34f(0x135)+_0x30c9a6[_0x24a34f(0x17f)]+_0xba3503;}function U(_0x335cc3){const _0x2da320=a0_0x6aaf68;return{'event':{'sending':_0x2da320(0x123),'delivered':_0x2da320(0x115),'failed':_0x2da320(0x171),'acked':_0x2da320(0x174),'started':_0x2da320(0x132),'replied':_0x2da320(0x167),'expired':_0x2da320(0x10d)}[_0x335cc3[_0x2da320(0x108)]],..._0x335cc3};}function j(_0x5b10a1){const _0x478729=a0_0x6aaf68;let _0x33760e=_0x5b10a1?.[_0x478729(0x13e)]||_0x5b10a1?.[_0x478729(0x179)]||_0x5b10a1?.['id'];if(_0x33760e)return String(_0x33760e);let _0x2cb5eb=_0x5b10a1?.['content']?.[0x0]?.[_0x478729(0x15c)];if(typeof _0x2cb5eb!==_0x478729(0x16d))return null;try{let _0x420b6e=JSON[_0x478729(0x124)](_0x2cb5eb);return _0x420b6e?.[_0x478729(0x13e)]||_0x420b6e?.[_0x478729(0x179)]||_0x420b6e?.['id']||null;}catch{return null;}}async function X(_0x225cc3,_0xf982f3){const _0x5bf3c5=a0_0x6aaf68;let _0x230771=_0xf982f3[_0x5bf3c5(0x14b)]??Date[_0x5bf3c5(0x14b)],_0x3bf6a7=_0x230771(),_0x3898ce=(_0x117969,_0x418d39,_0x5d0ee4,_0x5910a4)=>{const _0x12afed=_0x5bf3c5;_0xf982f3[_0x12afed(0x125)](O(U({'from_alias':_0x225cc3[_0x12afed(0x119)],'to_alias':_0x225cc3[_0x12afed(0x10e)],'task_id':_0x418d39,'parent_task_id':_0x225cc3[_0x12afed(0x157)],'network_id':_0x225cc3[_0x12afed(0x15d)],'transport':_0x225cc3['transport'],'status':_0x117969,'duration_ms':_0x230771()-_0x3bf6a7,'lifecycle_tracking':_0x225cc3[_0x12afed(0x105)],..._0x5d0ee4!==void 0x0?{'error_code':_0x5910a4||_0x12afed(0x11d),'error_message':N(_0x5d0ee4)}:{}})));};_0x3898ce(_0x5bf3c5(0x136),null);try{let _0x11ff63=await _0xf982f3[_0x5bf3c5(0x107)](),_0x5eef82=j(_0x11ff63);if(_0x5eef82)_0x3898ce(_0x5bf3c5(0x137),_0x5eef82);else{if(_0x11ff63?.['ok']===!0x1||_0x11ff63?.['error'])_0x3898ce(_0x5bf3c5(0x17d),_0x5eef82,_0x11ff63?.['error']||'CommHub\x20rejected\x20task',_0x5bf3c5(0x147));else _0x3898ce(_0x5bf3c5(0x17d),null,_0x5bf3c5(0x165),_0x5bf3c5(0x139));}return _0x11ff63;}catch(_0x3e5a7b){throw _0x3898ce('failed',null,_0x3e5a7b,_0x5bf3c5(0x11d)),_0x3e5a7b;}}async function Y(_0x2cc011,_0x477893){const _0x43db6f=a0_0x6aaf68;return X({'fromAlias':_0x2cc011[_0x43db6f(0x119)],'toAlias':_0x2cc011['alias'],'parentTaskId':_0x2cc011['parentTaskId']||null,'networkId':_0x2cc011['networkId']||null,'transport':_0x43db6f(0x126),'lifecycleTracking':'not_tracked'},_0x477893);}class $ extends a0_0x6a1d46{[a0_0x6aaf68(0x127)];['alias'];[a0_0x6aaf68(0x110)];[a0_0x6aaf68(0x13a)];[a0_0x6aaf68(0x114)];['heartbeatInterval'];[a0_0x6aaf68(0x153)];[a0_0x6aaf68(0x104)];[a0_0x6aaf68(0x121)];['running']=!0x1;constructor(_0x18b114){const _0x5b03c3=a0_0x6aaf68;super();if(this[_0x5b03c3(0x127)]=_0x18b114['url'][_0x5b03c3(0x17b)](/\/$/,''),this[_0x5b03c3(0x14f)]=_0x18b114[_0x5b03c3(0x14f)],this[_0x5b03c3(0x110)]=_0x18b114[_0x5b03c3(0x110)],this[_0x5b03c3(0x13a)]=_0x18b114[_0x5b03c3(0x13a)]||_0x5b03c3(0x128),this['resumeId']='sdk-'+_0x18b114[_0x5b03c3(0x14f)]+'-'+Date[_0x5b03c3(0x14b)]()['toString'](0x24),this[_0x5b03c3(0x163)]=_0x18b114[_0x5b03c3(0x163)]??0x2bf20,this[_0x5b03c3(0x153)]=_0x18b114[_0x5b03c3(0x153)]??0xbb8,_0x18b114['autoConnect']!==!0x1)this[_0x5b03c3(0x152)]();}['log'](_0x265353){const _0x4e7127=a0_0x6aaf68;console[_0x4e7127(0x125)]('['+new Date()[_0x4e7127(0x120)]()['slice'](0x0,0x8)+_0x4e7127(0x158)+this[_0x4e7127(0x14f)]+']\x20'+_0x265353);}async[a0_0x6aaf68(0x141)](_0x54aca4,_0x13658e){const _0x11210d=a0_0x6aaf68;let _0x12d13c={'Content-Type':_0x11210d(0x144),'Accept':_0x11210d(0x113)};if(this[_0x11210d(0x110)])_0x12d13c[_0x11210d(0x12a)]='Bearer\x20'+this[_0x11210d(0x110)];let _0x463339=await(await fetch(this[_0x11210d(0x127)]+_0x11210d(0x15f),{'method':'POST','headers':_0x12d13c,'body':JSON['stringify']({'jsonrpc':_0x11210d(0x13d),'id':Date[_0x11210d(0x14b)](),'method':'tools/call','params':{'name':_0x54aca4,'arguments':_0x13658e}})}))[_0x11210d(0x15c)](),_0x190b49=_0x463339['match'](/data: (.+)/),_0x208803=_0x190b49?JSON[_0x11210d(0x124)](_0x190b49[0x1]):JSON['parse'](_0x463339),_0x3d1769=_0x208803?.[_0x11210d(0x118)]?.[_0x11210d(0x117)]?.[0x0]?.[_0x11210d(0x15c)];return _0x3d1769?JSON['parse'](_0x3d1769):_0x208803;}async[a0_0x6aaf68(0x152)](){const _0x137959=a0_0x6aaf68;if(this[_0x137959(0x156)])return;this[_0x137959(0x156)]=!0x0,await this[_0x137959(0x108)](_0x137959(0x129)),this[_0x137959(0x125)](_0x137959(0x177)),this[_0x137959(0x104)]=setInterval(()=>{const _0x543dba=_0x137959;this[_0x543dba(0x108)](_0x543dba(0x129))[_0x543dba(0x146)](_0x3d2770=>this[_0x543dba(0x125)]('heartbeat\x20failed:\x20'+_0x3d2770[_0x543dba(0x109)]));},this[_0x137959(0x163)]),this[_0x137959(0x16c)]();}async['disconnect'](){const _0x52a3b3=a0_0x6aaf68;if(this[_0x52a3b3(0x156)]=!0x1,this[_0x52a3b3(0x121)]?.[_0x52a3b3(0x12f)](),this['heartbeatTimer'])clearInterval(this[_0x52a3b3(0x104)]);await this[_0x52a3b3(0x108)](_0x52a3b3(0x145))[_0x52a3b3(0x146)](()=>{}),this['log']('disconnected');}async[a0_0x6aaf68(0x107)](_0x28d9c6,_0x357ef3,_0x1bd9a0=a0_0x6aaf68(0x162)){const _0x56f280=a0_0x6aaf68;return Y({'alias':_0x28d9c6,'fromAlias':this[_0x56f280(0x14f)]},{'log':_0x45b1f3=>console[_0x56f280(0x125)](_0x45b1f3),'send':()=>this[_0x56f280(0x141)](_0x56f280(0x10f),{'alias':_0x28d9c6,'task':_0x357ef3,'priority':_0x1bd9a0,'from_session':this[_0x56f280(0x14f)]})});}async[a0_0x6aaf68(0x109)](_0x4f7a02,_0x59b68a){const _0x58203d=a0_0x6aaf68;return this['call'](_0x58203d(0x10b),{'alias':_0x4f7a02,'message':_0x59b68a,'from_session':this[_0x58203d(0x14f)]});}async[a0_0x6aaf68(0x142)](_0x116279,_0xa08a94,_0x27c540=a0_0x6aaf68(0x11f)){const _0x2fa480=a0_0x6aaf68;return this['call'](_0x2fa480(0x170),{'in_reply_to':_0x116279,'text':_0xa08a94,'status':_0x27c540});}async[a0_0x6aaf68(0x108)](_0x36d68d,_0x40205d){const _0x4c1eb0=a0_0x6aaf68;return this[_0x4c1eb0(0x141)]('report_status',{'resume_id':this['resumeId'],'alias':this[_0x4c1eb0(0x14f)],'status':_0x36d68d,'server':a0_0x42f55e(),'hostname':a0_0x42f55e(),'agent':this[_0x4c1eb0(0x13a)],'project_dir':process[_0x4c1eb0(0x10a)](),..._0x40205d});}async[a0_0x6aaf68(0x11c)](){const _0x31a75a=a0_0x6aaf68;return this['call'](_0x31a75a(0x180),{});}async['broadcast'](_0x19b07c,_0x3a47cf){const _0x8e2774=a0_0x6aaf68;return this[_0x8e2774(0x141)]('broadcast',{'message':_0x19b07c,'filter_server':_0x3a47cf?.[_0x8e2774(0x116)],'filter_status':_0x3a47cf?.[_0x8e2774(0x108)]});}async[a0_0x6aaf68(0x16c)](){const _0x4e00d4=a0_0x6aaf68;let _0x1c43e3=encodeURIComponent(this[_0x4e00d4(0x14f)]),_0x2d600d=this[_0x4e00d4(0x127)]+_0x4e00d4(0x184)+_0x1c43e3,_0x274a4a=this[_0x4e00d4(0x153)];while(this['running']){try{this['sseAbort']=new AbortController();let _0x2e75f2={'Accept':_0x4e00d4(0x166)};if(this[_0x4e00d4(0x110)])_0x2e75f2[_0x4e00d4(0x12a)]=_0x4e00d4(0x133)+this['token'];let _0x506102=await fetch(_0x2d600d,{'headers':_0x2e75f2,'signal':this[_0x4e00d4(0x121)][_0x4e00d4(0x106)]});if(!_0x506102['ok']||!_0x506102[_0x4e00d4(0x183)]){this['log'](_0x4e00d4(0x13c)+_0x506102[_0x4e00d4(0x108)]),await this[_0x4e00d4(0x11e)](_0x274a4a),_0x274a4a=Math['min'](_0x274a4a*1.5,0xea60);continue;}_0x274a4a=this[_0x4e00d4(0x153)];let _0x1110b9=_0x506102['body'][_0x4e00d4(0x16b)](),_0x2a1b55=new TextDecoder(),_0xef553f='';while(this[_0x4e00d4(0x156)]){let {done:_0x118aba,value:_0x146099}=await _0x1110b9['read']();if(_0x118aba)break;_0xef553f+=_0x2a1b55[_0x4e00d4(0x12b)](_0x146099,{'stream':!0x0});let _0x36af02=_0xef553f[_0x4e00d4(0x168)]('\x0a');_0xef553f=_0x36af02[_0x4e00d4(0x103)]()||'';for(let _0x2738c4 of _0x36af02){if(!_0x2738c4['startsWith'](_0x4e00d4(0x130)))continue;try{let _0x1b9fcf=JSON[_0x4e00d4(0x124)](_0x2738c4[_0x4e00d4(0x112)](0x6));if(_0x1b9fcf['type']===_0x4e00d4(0x12c)){this[_0x4e00d4(0x125)]('SSE\x20connected'),this[_0x4e00d4(0x11a)](_0x4e00d4(0x12c));continue;}if(_0x1b9fcf[_0x4e00d4(0x12d)]===_0x4e00d4(0x154)||_0x1b9fcf[_0x4e00d4(0x12d)]===_0x4e00d4(0x134)||_0x1b9fcf['type']===_0x4e00d4(0x17e))await this[_0x4e00d4(0x160)]();}catch{}}}}catch(_0x20be01){if(_0x20be01[_0x4e00d4(0x16e)]==='AbortError')break;this[_0x4e00d4(0x11a)](_0x4e00d4(0x15e),_0x20be01),this[_0x4e00d4(0x125)](_0x4e00d4(0x15b)+_0x20be01[_0x4e00d4(0x109)]);}if(this[_0x4e00d4(0x156)])this[_0x4e00d4(0x11a)](_0x4e00d4(0x16a)),this['log'](_0x4e00d4(0x150)+_0x274a4a/0x3e8+_0x4e00d4(0x14e)),await this[_0x4e00d4(0x11e)](_0x274a4a),_0x274a4a=Math[_0x4e00d4(0x12e)](_0x274a4a*1.5,0xea60);}}async['processInbox'](){const _0x328800=a0_0x6aaf68;try{let _0x595f07=(await this[_0x328800(0x141)]('get_inbox',{'alias':this[_0x328800(0x14f)],'limit':0xa}))?.[_0x328800(0x159)]||[];for(let _0x3d9882 of _0x595f07)await this['call'](_0x328800(0x13f),{'alias':this[_0x328800(0x14f)],'message_id':_0x3d9882['id']}),this['log']('←\x20'+_0x3d9882['from_session']+':\x20'+_0x3d9882[_0x328800(0x117)][_0x328800(0x112)](0x0,0x3c)),this['emit'](_0x328800(0x140),_0x3d9882),this[_0x328800(0x11a)](_0x328800(0x109),_0x3d9882);}catch(_0xb5667d){this[_0x328800(0x125)](_0x328800(0x148)+_0xb5667d['message']);}}[a0_0x6aaf68(0x11e)](_0x353c33){return new Promise(_0x5a34f4=>setTimeout(_0x5a34f4,_0x353c33));}}var F=$;export{F as default,$ as CommHub};
@@ -4,6 +4,8 @@ export interface CodexHomeLoginVerdict {
4
4
  /** One phrase for the operator: why this state. No secrets. */
5
5
  readonly reason: string;
6
6
  }
7
+ /** Selected custom provider only. A field name is returned, never a key value. */
8
+ export declare function codexProviderEnvKey(configToml: string): string | null;
7
9
  /** The node's verdict. auth.json is judged by the #529 helper; see the header for the two fail-open cases. */
8
10
  export declare function codexHomeLoginState(codexHome: string, env?: Record<string, string | undefined>): CodexHomeLoginVerdict;
9
11
  /** Exit code for `needs-login`: distinct from 1 (failed) so scripts can tell "do something" from "broken". */
@@ -112,6 +112,7 @@ export declare function shouldPersistCodexFullAccess(dangerFlagPassed: boolean,
112
112
  */
113
113
  export declare function codexCopresenceCreateFields(normalizedRuntime: string | undefined, copresenceOpt: string | boolean | undefined): {
114
114
  codexCopresence?: true;
115
+ codexCopresenceFullAccess?: true;
115
116
  };
116
117
  /**
117
118
  * One line at create time for a node that will start headless.
@@ -6,6 +6,9 @@ export interface CodexRecoveryVerification {
6
6
  historyFingerprint: string;
7
7
  /** Metadata-only thread/read proof that Codex resolved this exact rollout. */
8
8
  persistedPath?: string;
9
+ /** Present only when an explicitly selected Provider was read back from the runtime. */
10
+ modelProvider?: string;
11
+ model?: string;
9
12
  }
10
13
  export interface CodexRecoveryBackup {
11
14
  backupDir: string;
@@ -39,7 +42,7 @@ export declare function verifyCodexThreadHistory(method: "thread/start" | "threa
39
42
  * Returns the model the app-server reports for the resumed thread (if any) so
40
43
  * the caller can say which model the session is actually on.
41
44
  */
42
- export declare function resumeAndVerifyCodexThread(threadId: string, request: (method: string, params: Record<string, unknown>) => Promise<unknown>, model?: string): Promise<CodexRecoveryVerification & {
45
+ export declare function resumeAndVerifyCodexThread(threadId: string, request: (method: string, params: Record<string, unknown>) => Promise<unknown>, model?: string, modelProvider?: string): Promise<CodexRecoveryVerification & {
43
46
  resumedModel?: string;
44
47
  }>;
45
48
  /** Private, node-local recovery point. config-recovery.json is deliberately
@@ -1,5 +1,6 @@
1
1
  import { type CodexRecoveryVerification } from "./codex-copresence-recovery";
2
2
  export declare const SAFE_CODEX_THREAD_ID: RegExp;
3
+ export declare function defaultWebSocketCtor(maxPayload: number): Promise<any>;
3
4
  /** Minimal JSON-RPC client used only while bringing up a co-presence app-server. */
4
5
  export declare function createCodexCopresenceThread(ws: string, timeoutMs: number, resumeThreadId?: string, model?: string,
5
6
  /** forkFirst (board #738): `thread/fork` the recorded thread, then resume the NEW thread. */
@@ -7,6 +8,7 @@ options?: {
7
8
  webSocketCtor?: any;
8
9
  rolloutBytes?: number | null;
9
10
  forkFirst?: boolean;
11
+ modelProvider?: string;
10
12
  }): Promise<{
11
13
  threadId: string;
12
14
  verification?: CodexRecoveryVerification;
@@ -0,0 +1,16 @@
1
+ /** API `flags.*` shape (client #815 / codexSdkYoloFlags). */
2
+ export declare const CODEX_COPRESENCE_YOLO_FLAGS: Readonly<{
3
+ approvalPolicy: "never";
4
+ sandboxMode: "danger-full-access";
5
+ skipGitRepoCheck: true;
6
+ }>;
7
+ /** Top-level Codex `config.toml` keys for the same posture. */
8
+ export declare const CODEX_COPRESENCE_YOLO_TOML: Readonly<{
9
+ approval_policy: "never";
10
+ sandbox_mode: "danger-full-access";
11
+ }>;
12
+ /** Fill missing yolo flags when a co-presence codex-app-server node is created. */
13
+ export declare function applyCodexCopresenceFlagDefaults(flags: Record<string, unknown>): void;
14
+ export declare function mergeCopresenceYoloIntoToml(existing: string): string;
15
+ /** Persist co-presence yolo posture under `<nodeDir>/codex-home/config.toml`. */
16
+ export declare function writeCopresenceYoloToCodexHome(codexHome: string): void;
@@ -26,6 +26,8 @@ export interface PreflightFacts {
26
26
  readonly dirMode: number | null;
27
27
  readonly authMode: number | null;
28
28
  readonly authBytes: number | null;
29
+ /** Selected custom env_key observed identically in owned Codex TUI/app-server. */
30
+ readonly providerEnvAttested?: boolean;
29
31
  readonly configTokenFingerprint: string | null;
30
32
  readonly envFileTokenFingerprint: string | null;
31
33
  };
@@ -0,0 +1,17 @@
1
+ /** Codex `config.toml` + `-c` override for thinking / reasoning effort.
2
+ * Wire name matches app-server JSON (`reasoningEffort`) and client patch field. */
3
+ export declare const CODEX_MODEL_REASONING_EFFORT_KEY = "model_reasoning_effort";
4
+ /** Matches agent-node `types/codex/ReasoningEffort.ts` and models_cache gate. */
5
+ export declare const REASONING_EFFORT_VALUES: readonly ["none", "minimal", "low", "medium", "high", "xhigh"];
6
+ export type ReasoningEffortValue = (typeof REASONING_EFFORT_VALUES)[number];
7
+ export declare function isReasoningEffortValue(v: unknown): v is ReasoningEffortValue;
8
+ export declare function reasoningEffortValidationReason(): string;
9
+ /** `-c` fragment value (no shell quoting). */
10
+ export declare function codexReasoningEffortConfigOverride(effort: ReasoningEffortValue): string;
11
+ /**
12
+ * Idempotent merge of top-level `model_reasoning_effort` in codex config.toml.
13
+ * Other tables and keys are preserved byte-for-byte except the managed line.
14
+ */
15
+ export declare function mergeModelReasoningEffortIntoToml(existing: string, effort: ReasoningEffortValue): string;
16
+ /** Persist `model_reasoning_effort` under a node's `codex-home/`. */
17
+ export declare function writeReasoningEffortToCodexHome(codexHome: string, effort: ReasoningEffortValue): void;
@@ -0,0 +1,35 @@
1
+ /** Local registry resolution shared by discovery/application; no remote path. */
2
+ export declare function resolveDaemonProviderTarget(nodesDir: string, target: {
3
+ node_id: string;
4
+ alias: string;
5
+ }, networkId: string): {
6
+ dir: string;
7
+ config: Record<string, any>;
8
+ };
9
+ export declare function scanDaemonCodex(nodesDir: string, targets: unknown, networkId: string, hostHome?: string): {
10
+ observed_at: number;
11
+ scope: string;
12
+ rows: ({
13
+ status: string;
14
+ node_id: any;
15
+ alias: any;
16
+ } | {
17
+ node_configured_model: string | null;
18
+ config_revision: string | null;
19
+ config_status: string;
20
+ configured_provider: string | null;
21
+ configured_model: string | null;
22
+ provider_ids: string[];
23
+ auth_kind: string;
24
+ credential_status: string;
25
+ account_fingerprint: string | null;
26
+ verification: string;
27
+ effective_state: string;
28
+ status: string;
29
+ runtime: string | null;
30
+ home_ref: string;
31
+ home_source: string;
32
+ node_id: any;
33
+ alias: any;
34
+ })[];
35
+ };
@@ -0,0 +1,28 @@
1
+ import { DaemonProviderStore } from './daemon-provider-store';
2
+ export declare function chatgptCredentialFingerprint(raw: string): string;
3
+ export declare class ProviderAccountCustody {
4
+ private nodeId;
5
+ private authPath;
6
+ private readAuth;
7
+ private previous?;
8
+ private selected?;
9
+ private before;
10
+ private next;
11
+ private installed;
12
+ private prepared;
13
+ constructor(store: DaemonProviderStore, nodeId: string, authPath: string, previousId: string | undefined, selectedId: string | undefined, readAuth: () => string | null);
14
+ get fingerprint(): string | undefined;
15
+ get previousFingerprint(): string | undefined;
16
+ get accountId(): string | undefined;
17
+ /** Capture AFTER verified stop: Codex may have refreshed auth since preflight. */
18
+ prepare(): {
19
+ previous_id: string | null;
20
+ selected_id: string | null;
21
+ before_auth: string | null;
22
+ };
23
+ private park;
24
+ install(): void;
25
+ /** No saved copy is used for an active account. Preserve refreshed credentials
26
+ * before restoring the old login, including a failed same-account model edit. */
27
+ rollback(): void;
28
+ }
@@ -0,0 +1,3 @@
1
+ /** Read only the exact owned node's loopback app-server. No logout/login or
2
+ * token refresh request, and no account details are returned to the Hub. */
3
+ export declare function verifyChatgptAppserver(endpoint: string, timeoutMs?: number, webSocketCtor?: any): Promise<void>;
@@ -0,0 +1,34 @@
1
+ import { DaemonProviderStore } from './daemon-provider-store';
2
+ export declare function providerNodeRevision(nodeDir: string): string;
3
+ export declare function readProviderNodeConfig(nodeDir: string): Record<string, any>;
4
+ export declare function readProviderNodeToml(nodeDir: string): import("smol-toml").TomlTable;
5
+ export type ProviderApplicationRequest = {
6
+ requestId: string;
7
+ networkId: string;
8
+ daemonId: string;
9
+ nodeId: string;
10
+ alias: string;
11
+ nodeRevision: string;
12
+ revision: number;
13
+ providerId: string;
14
+ authId: string;
15
+ model: string;
16
+ accountId?: string;
17
+ confirmRestart: true;
18
+ };
19
+ export type ProviderActivation = {
20
+ nodeId: string;
21
+ model: string;
22
+ runtimeProvider: string;
23
+ nodeRevision: string;
24
+ };
25
+ export type ProviderApplicationLifecycle = {
26
+ preflight?: () => Promise<void>;
27
+ stopVerified: () => Promise<void>;
28
+ activate: (expected: ProviderActivation) => Promise<ProviderActivation>;
29
+ verifyChatgpt?: () => Promise<void>;
30
+ restore: () => Promise<void>;
31
+ };
32
+ /** Stop → private writes → verified activation. A crash leaves an explicit
33
+ * private recovery journal; reconnect must NOT blindly replay the mutation. */
34
+ export declare function applyDaemonProvider(nodeDir: string, store: DaemonProviderStore, request: ProviderApplicationRequest, lifecycle: ProviderApplicationLifecycle): Promise<any>;
@@ -0,0 +1,9 @@
1
+ import { type ProviderApplicationRequest } from './daemon-provider-application';
2
+ import { type ProviderCliRunner } from './daemon-provider-lifecycle';
3
+ export declare function runDaemonProviderApply(args: string[], deps: {
4
+ nodesDir: string;
5
+ readInput: () => string;
6
+ print: (text: string) => void;
7
+ run?: ProviderCliRunner;
8
+ authorizeIdle?: (daemonDir: string, request: ProviderApplicationRequest) => Promise<void>;
9
+ }): Promise<number>;
@@ -0,0 +1,7 @@
1
+ export declare const DAEMON_PROVIDER_USAGE = "anet daemon provider <list|scan|put|apply> <daemon> [--revision N] [--request dps_UUID] (put/scan/apply read private JSON from stdin; no key in argv)";
2
+ export declare function readProviderInput(fd?: number): string;
3
+ export declare function runDaemonProvider(args: string[], deps: {
4
+ nodesDir: string;
5
+ readInput: () => string;
6
+ print: (text: string) => void;
7
+ }): number;
@@ -0,0 +1,4 @@
1
+ import { type ProviderApplicationLifecycle, type ProviderApplicationRequest } from './daemon-provider-application';
2
+ export type ProviderCliRunner = (argv: string[], cwd: string, timeout: number) => Promise<string>;
3
+ export declare function providerCliRunner(binary: string, script: string, env: NodeJS.ProcessEnv): ProviderCliRunner;
4
+ export declare function providerApplicationLifecycle(nodeDir: string, request: ProviderApplicationRequest, run: ProviderCliRunner, authorizeIdle: () => Promise<void>): ProviderApplicationLifecycle;
@@ -0,0 +1,104 @@
1
+ export type ProviderAuthKind = "chatgpt" | "api_key";
2
+ export type ApplicationProfile = {
3
+ providerId: string;
4
+ authId: string;
5
+ model: string;
6
+ } & ({
7
+ kind: 'api_key';
8
+ baseUrl: string;
9
+ key: string;
10
+ } | {
11
+ kind: 'chatgpt';
12
+ accountId: string;
13
+ });
14
+ export declare class DaemonProviderError extends Error {
15
+ readonly code: string;
16
+ constructor(code: string);
17
+ }
18
+ export declare function readPrivateJson(path: string): unknown;
19
+ export declare class DaemonProviderStore {
20
+ private readonly root;
21
+ private readonly scope;
22
+ constructor(daemonDir: string);
23
+ private checkRoot;
24
+ private read;
25
+ private publicState;
26
+ list(): {
27
+ revision: number;
28
+ source: "daemon";
29
+ providers: {
30
+ id: string;
31
+ label: string;
32
+ enabled: boolean;
33
+ runtimes: {
34
+ runtime: "codex-tui";
35
+ auth: {
36
+ credential_present: boolean;
37
+ verification: "not_checked";
38
+ application: "not_applied";
39
+ account_id?: string | undefined;
40
+ baseUrl?: string | undefined;
41
+ id: string;
42
+ kind: ProviderAuthKind;
43
+ models: string[];
44
+ }[];
45
+ }[];
46
+ }[];
47
+ network_id: string;
48
+ daemon_node_id: string;
49
+ };
50
+ /** Presence only, never entitlement. Resolve an opaque saved-login ID solely
51
+ * inside this daemon's owned directory; callers cannot supply a credential path. */
52
+ private savedAccountPresent;
53
+ /** Local-only resolver. Never serialize this credential directory into a receipt. */
54
+ savedAccountHome(id: string): string | null;
55
+ /** Internal daemon bootstrap; this private path must never enter Hub replies. */
56
+ prepareLoginDirectory(): {
57
+ root: string;
58
+ network_id: string;
59
+ daemon_node_id: string;
60
+ };
61
+ /** Local application lease. Secrets stay inside the daemon callback, never in list/scan. */
62
+ withApiKey<T>(selection: {
63
+ revision: number;
64
+ providerId: string;
65
+ authId: string;
66
+ model: string;
67
+ }, apply: (profile: {
68
+ providerId: string;
69
+ authId: string;
70
+ model: string;
71
+ baseUrl: string;
72
+ key: string;
73
+ }) => Promise<T>): Promise<T>;
74
+ withApplicationProfile<T>(selection: {
75
+ revision: number;
76
+ providerId: string;
77
+ authId: string;
78
+ model: string;
79
+ }, apply: (profile: ApplicationProfile) => Promise<T>): Promise<T>;
80
+ upsert(value: unknown, expectedRevision: number, requestId?: string): {
81
+ revision: number;
82
+ source: "daemon";
83
+ providers: {
84
+ id: string;
85
+ label: string;
86
+ enabled: boolean;
87
+ runtimes: {
88
+ runtime: "codex-tui";
89
+ auth: {
90
+ credential_present: boolean;
91
+ verification: "not_checked";
92
+ application: "not_applied";
93
+ account_id?: string | undefined;
94
+ baseUrl?: string | undefined;
95
+ id: string;
96
+ kind: ProviderAuthKind;
97
+ models: string[];
98
+ }[];
99
+ }[];
100
+ }[];
101
+ network_id: string;
102
+ daemon_node_id: string;
103
+ };
104
+ }