@sleep2agi/agent-network 2.3.0-preview.32 → 2.3.0-preview.34

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,2 +1,2 @@
1
1
  #!/usr/bin/env bun
2
- const a0_0x24b8d2=a0_0x1421;(function(_0x5878c9,_0x47e1a3){const _0x38c4e8=a0_0x1421,_0x31061b=_0x5878c9();while(!![]){try{const _0x4b6b23=-parseInt(_0x38c4e8(0x1b8))/0x1*(parseInt(_0x38c4e8(0x1ce))/0x2)+-parseInt(_0x38c4e8(0x194))/0x3+parseInt(_0x38c4e8(0x17b))/0x4+-parseInt(_0x38c4e8(0x172))/0x5+parseInt(_0x38c4e8(0x16a))/0x6+-parseInt(_0x38c4e8(0x1ad))/0x7+-parseInt(_0x38c4e8(0x15a))/0x8*(-parseInt(_0x38c4e8(0x188))/0x9);if(_0x4b6b23===_0x47e1a3)break;else _0x31061b['push'](_0x31061b['shift']());}catch(_0x525ad2){_0x31061b['push'](_0x31061b['shift']());}}}(a0_0x1c45,0x6cd19));import{readFileSync as a0_0x253642,existsSync as a0_0x58bf15}from'fs';import{randomUUID as a0_0x196c4b}from'crypto';import{join as a0_0x4084f1}from'path';import{hostname as a0_0x3c6840}from'os';import{execSync as a0_0x5e12e7}from'child_process';function B(_0x476ba9){const _0x5c954a=a0_0x1421;let _0x2ab572=_0x476ba9[_0x5c954a(0x19e)](/[^a-zA-Z0-9\-_]/g,'-');return _0x2ab572===''?_0x5c954a(0x195):_0x2ab572;}function a0_0x1421(_0x3507ba,_0x5c0f19){_0x3507ba=_0x3507ba-0x148;const _0x1c450a=a0_0x1c45();let _0x1421a4=_0x1c450a[_0x3507ba];return _0x1421a4;}import{Server as a0_0x34b4b9}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x1f93af}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x40f659,CallToolRequestSchema as a0_0x318355}from'@modelcontextprotocol/sdk/types.js';function T(_0x181b8b){const _0x4dc1e3=a0_0x1421;if(!a0_0x58bf15(_0x181b8b))return;for(let _0x104633 of a0_0x253642(_0x181b8b,_0x4dc1e3(0x199))[_0x4dc1e3(0x1d0)]('\x0a')){let _0x5c480f=_0x104633[_0x4dc1e3(0x16d)]();if(!_0x5c480f||_0x5c480f[_0x4dc1e3(0x1c8)]('#'))continue;let _0x256bd7=_0x5c480f[_0x4dc1e3(0x1af)]('=');if(_0x256bd7<0x0)continue;let _0x571bf8=_0x5c480f[_0x4dc1e3(0x1bb)](0x0,_0x256bd7)[_0x4dc1e3(0x16d)](),_0x49a8ed=_0x5c480f['slice'](_0x256bd7+0x1)[_0x4dc1e3(0x16d)]()[_0x4dc1e3(0x19e)](/^["']|["']$/g,'');if(!process.env[_0x571bf8])process.env[_0x571bf8]=_0x49a8ed;}}var C=process.env.HOME||'~',r=a0_0x4084f1(C,'.claude/channels/commhub');T(a0_0x4084f1(r,a0_0x24b8d2(0x155)));var H=B(process[a0_0x24b8d2(0x178)]());T(a0_0x4084f1(r,H,a0_0x24b8d2(0x155)));function E(){const _0x204d9d=a0_0x24b8d2;try{return a0_0x5e12e7(_0x204d9d(0x1aa),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function _(){const _0x6bb1fd=a0_0x24b8d2;try{let _0x40b26c=a0_0x4084f1(C,_0x6bb1fd(0x169),_0x6bb1fd(0x1e6));if(a0_0x58bf15(_0x40b26c))return JSON['parse'](a0_0x253642(_0x40b26c,'utf-8'));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x24b8d2(0x1b4)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||E();function S(){const _0x12081c=a0_0x24b8d2;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x12081c(0x16d)]())return process.env.COMMHUB_ALIAS[_0x12081c(0x16d)]();return process[_0x12081c(0x15e)][_0x12081c(0x1d5)](_0x12081c(0x19d)+(_0x12081c(0x1db)+(j||'(none)')+_0x12081c(0x1c5)+a0_0x3c6840()+_0x12081c(0x1e5))),'unattributed-'+process[_0x12081c(0x161)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x196c4b(),k=process.env.COMMHUB_TOKEN||R[a0_0x24b8d2(0x150)]||'';function z(_0xa66984){const _0x43f624=a0_0x24b8d2;let _0x4cc164=new Date()['toTimeString']()[_0x43f624(0x1bb)](0x0,0x8);process[_0x43f624(0x15e)][_0x43f624(0x1d5)]('['+_0x4cc164+_0x43f624(0x18c)+_0xa66984+'\x0a');}function i(_0x21e041){return new Promise(_0x51a954=>setTimeout(_0x51a954,_0x21e041));}z(a0_0x24b8d2(0x1d8)+Y+a0_0x24b8d2(0x179)+p+a0_0x24b8d2(0x14f)+V[a0_0x24b8d2(0x1bb)](0x0,0x8)+a0_0x24b8d2(0x14d)+(j||'none')+a0_0x24b8d2(0x1d9)+process[a0_0x24b8d2(0x178)]()+a0_0x24b8d2(0x185)+H);var G=new Map(),K=new a0_0x34b4b9({'name':a0_0x24b8d2(0x151),'version':a0_0x24b8d2(0x154)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':['Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>',a0_0x24b8d2(0x15f),a0_0x24b8d2(0x1b1),a0_0x24b8d2(0x173),'Session\x20alias:\x20'+p]['join']('\x0a')});K[a0_0x24b8d2(0x168)](a0_0x40f659,async()=>({'tools':[{'name':a0_0x24b8d2(0x177),'description':a0_0x24b8d2(0x18a),'inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{'task_id':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x15d)},'text':{'type':'string','description':a0_0x24b8d2(0x1a2)},'status':{'type':a0_0x24b8d2(0x1c4),'enum':['completed',a0_0x24b8d2(0x148),a0_0x24b8d2(0x198),a0_0x24b8d2(0x15b),a0_0x24b8d2(0x1d2),a0_0x24b8d2(0x196)],'description':a0_0x24b8d2(0x170)}},'required':[a0_0x24b8d2(0x171)]}},{'name':'commhub_report_status','description':'Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{'status':{'type':a0_0x24b8d2(0x1c4),'enum':['working',a0_0x24b8d2(0x184),a0_0x24b8d2(0x15b),'error']},'task':{'type':'string','description':a0_0x24b8d2(0x1a1)},'progress':{'type':a0_0x24b8d2(0x18e),'description':a0_0x24b8d2(0x14e)}},'required':[a0_0x24b8d2(0x1ac)]}},{'name':a0_0x24b8d2(0x176),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{'alias':{'type':a0_0x24b8d2(0x1c4),'description':'Target\x20session\x20alias'},'task':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x1e2)},'priority':{'type':a0_0x24b8d2(0x1c4),'enum':[a0_0x24b8d2(0x191),a0_0x24b8d2(0x166),a0_0x24b8d2(0x1c0)],'description':a0_0x24b8d2(0x189)}},'required':['alias',a0_0x24b8d2(0x18f)]}},{'name':a0_0x24b8d2(0x1a4),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x17e)},'message':{'type':a0_0x24b8d2(0x1c4),'description':a0_0x24b8d2(0x1d7)}},'required':[a0_0x24b8d2(0x158),a0_0x24b8d2(0x19c)]}},{'name':a0_0x24b8d2(0x153),'description':a0_0x24b8d2(0x1a5),'inputSchema':{'type':a0_0x24b8d2(0x1ba),'properties':{}}}]}));async function Q(_0x375412,_0x14fe9b){const _0x145b4e=a0_0x24b8d2;let _0x4802ed=await fetch(Y+_0x145b4e(0x1b0),{'method':_0x145b4e(0x1a0),'headers':{'Content-Type':'application/json','Accept':_0x145b4e(0x1c2),...k?{'Authorization':'Bearer\x20'+k}:{}},'body':JSON[_0x145b4e(0x1cb)]({'jsonrpc':'2.0','id':0x1,'method':_0x145b4e(0x1c6),'params':{'protocolVersion':_0x145b4e(0x16f),'capabilities':{},'clientInfo':{'name':_0x145b4e(0x151),'version':_0x145b4e(0x154)}}})});if(!_0x4802ed['ok']){let _0x324dd8=await _0x4802ed[_0x145b4e(0x171)]();return z(_0x145b4e(0x1a7)+_0x4802ed[_0x145b4e(0x1ac)]+'\x20'+_0x324dd8[_0x145b4e(0x1bb)](0x0,0x64)),{'ok':!0x1,'error':_0x145b4e(0x1d1)+_0x4802ed[_0x145b4e(0x1ac)]};}await _0x4802ed[_0x145b4e(0x171)]();let _0x33726c=(await(await fetch(Y+'/mcp',{'method':'POST','headers':{'Content-Type':_0x145b4e(0x190),'Accept':_0x145b4e(0x1c2),...k?{'Authorization':_0x145b4e(0x162)+k}:{}},'body':JSON[_0x145b4e(0x1cb)]({'jsonrpc':_0x145b4e(0x19b),'id':0x2,'method':_0x145b4e(0x1d4),'params':{'name':_0x375412,'arguments':_0x14fe9b}})}))[_0x145b4e(0x171)]())['split']('\x0a')[_0x145b4e(0x1bf)](_0x3df66b=>_0x3df66b[_0x145b4e(0x1c8)](_0x145b4e(0x17d)));if(_0x33726c){let _0x3b6c94=JSON['parse'](_0x33726c['slice'](0x6));return _0x3b6c94?.[_0x145b4e(0x180)]?.[_0x145b4e(0x14c)]?.[0x0]?.['text']?JSON[_0x145b4e(0x1c7)](_0x3b6c94[_0x145b4e(0x180)]['content'][0x0]['text']):_0x3b6c94;}return{'ok':!0x1,'error':_0x145b4e(0x1d6)};}K[a0_0x24b8d2(0x168)](a0_0x318355,async _0x157ece=>{const _0x4effc4=a0_0x24b8d2;let {name:_0x3eb2e7,arguments:_0x1d973b}=_0x157ece[_0x4effc4(0x152)];if(_0x3eb2e7===_0x4effc4(0x177)){let {task_id:_0x5871f0,text:_0x374796,status:_0x102d0c}=_0x1d973b;if(_0x102d0c===_0x4effc4(0x1a9)||_0x102d0c===_0x4effc4(0x148)||_0x102d0c==='cancelled'){let _0x1d5a87=_0x102d0c==='completed'?_0x4effc4(0x192):_0x102d0c,_0x2f9d82=_0x5871f0?G[_0x4effc4(0x163)](_0x5871f0)||'hub':_0x4effc4(0x1b4),_0x5e8114=await Q(_0x4effc4(0x186),{'alias':_0x2f9d82,'text':_0x374796,'in_reply_to':_0x5871f0||void 0x0,'status':_0x1d5a87,'from_session':p});if(_0x5871f0)G['delete'](_0x5871f0);return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x5e8114)}]};}let _0x31a1e8=await Q(_0x4effc4(0x1dd),{'resume_id':V,'alias':p,'status':_0x102d0c===_0x4effc4(0x15b)?'blocked':_0x102d0c===_0x4effc4(0x1d2)?'error':_0x4effc4(0x1ae),'task':_0x374796[_0x4effc4(0x1bb)](0x0,0xc8),'output':_0x374796});return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x31a1e8)}]};}if(_0x3eb2e7===_0x4effc4(0x17c)){let {status:_0x19e967,task:_0x284bf9,progress:_0x35e5ce}=_0x1d973b,_0x43c6c2=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x19e967,'task':_0x284bf9,'progress':_0x35e5ce});return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x43c6c2)}]};}if(_0x3eb2e7===_0x4effc4(0x176)){let {alias:_0x2fab07,task:_0x950301,priority:_0xf0c9cc}=_0x1d973b,_0x2e3244=await Q(_0x4effc4(0x1e8),{'alias':_0x2fab07,'task':_0x950301,'priority':_0xf0c9cc||_0x4effc4(0x166),'from_session':p});return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)](_0x2e3244)}]};}if(_0x3eb2e7===_0x4effc4(0x1a4)){let {alias:_0x31dcbd,message:_0xa94ef5}=_0x1d973b,_0x386b5f=await Q(_0x4effc4(0x1c3),{'alias':_0x31dcbd,'message':_0xa94ef5,'from_session':p});return{'content':[{'type':'text','text':JSON[_0x4effc4(0x1cb)](_0x386b5f)}]};}if(_0x3eb2e7==='commhub_get_all_status'){let _0xa822cc=await Q(_0x4effc4(0x1da),{});return{'content':[{'type':_0x4effc4(0x171),'text':JSON['stringify'](_0xa822cc)}]};}return{'content':[{'type':_0x4effc4(0x171),'text':JSON[_0x4effc4(0x1cb)]({'error':'unknown\x20tool'})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x96c59b=a0_0x24b8d2;try{await Q(_0x96c59b(0x1dd),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x3c6840(),'hostname':a0_0x3c6840(),'agent':_0x96c59b(0x175),'project_dir':process['cwd'](),'tmux_name':j||void 0x0}),z(_0x96c59b(0x19a)+p+_0x96c59b(0x167));}catch(_0x2a8da6){z('re-register\x20failed:\x20'+_0x2a8da6);}}async function l(){const _0x5f022b=a0_0x24b8d2;let _0x5b45e2=Y+_0x5f022b(0x17a)+encodeURIComponent(p),_0x424691={};if(k)_0x424691[_0x5f022b(0x1e1)]=_0x5f022b(0x162)+k;z(_0x5f022b(0x1e4)+_0x5b45e2);let _0x4d7f60=D,_0x3a52d6=!0x0,_0x55e6c5=null;while(!0x0){try{let _0x4c7bfe=await fetch(_0x5b45e2,{'headers':_0x424691});if(!_0x4c7bfe['ok']){if(z(_0x5f022b(0x183)+_0x4c7bfe['status']+'\x20'+_0x4c7bfe[_0x5f022b(0x14b)]),_0x55e6c5=_0x55e6c5??Date['now'](),Date[_0x5f022b(0x1c1)]()-_0x55e6c5>O){z(_0x5f022b(0x156)+Y+_0x5f022b(0x1be));return;}await i(_0x4d7f60),_0x4d7f60=Math[_0x5f022b(0x160)](_0x4d7f60*0x2,v);continue;}let _0x50f29f=_0x4c7bfe['body'][_0x5f022b(0x1a8)](),_0xf695dd=new TextDecoder(),_0x3e7592='';_0x4d7f60=D;while(!0x0){let {done:_0x3574f2,value:_0xd0c89e}=await _0x50f29f['read']();if(_0x3574f2)break;_0x3e7592+=_0xf695dd[_0x5f022b(0x159)](_0xd0c89e,{'stream':!0x0});let _0x396550=_0x3e7592[_0x5f022b(0x1d0)]('\x0a\x0a');_0x3e7592=_0x396550[_0x5f022b(0x19f)]()||'';for(let _0x1f28b3 of _0x396550){let _0x30c2fb=_0x1f28b3[_0x5f022b(0x1d0)]('\x0a')[_0x5f022b(0x1bf)](_0x2674bb=>_0x2674bb[_0x5f022b(0x1c8)]('data:\x20'));if(!_0x30c2fb)continue;try{let _0x1e74ca=JSON['parse'](_0x30c2fb['slice'](0x6));if(await A(_0x1e74ca),_0x1e74ca[_0x5f022b(0x1e7)]===_0x5f022b(0x1cd)){if(_0x55e6c5=null,!_0x3a52d6)await m();_0x3a52d6=!0x1;}}catch(_0x51abc1){z(_0x5f022b(0x1e0)+_0x51abc1);}}}z('SSE\x20stream\x20ended,\x20reconnecting...');}catch(_0x431502){z(_0x5f022b(0x18b)+_0x431502);}if(_0x55e6c5=_0x55e6c5??Date[_0x5f022b(0x1c1)](),Date[_0x5f022b(0x1c1)]()-_0x55e6c5>O){z('SSE\x20连续\x20>1h\x20连不上\x20hub\x20('+Y+_0x5f022b(0x1be));return;}await i(_0x4d7f60),_0x4d7f60=Math[_0x5f022b(0x160)](_0x4d7f60*0x2,v);}}function a0_0x1c45(){const _0x1f1655=['session\x20disconnected','status','3012254msTPPg','working','indexOf','/mcp','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','ack_inbox','broadcast','hub','SIGTERM','messages','unref','14902rDxujv','offline','object','slice','\x22\x20(','SIGINT',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','find','low','now','application/json,\x20text/event-stream','send_message','string','\x20/\x20hostname=','initialize','parse','startsWith','message_id','from','stringify','kill','connected','10MgcYjb',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','split','init\x20failed:\x20','error','set','tools/call','write','no\x20response','Message\x20content','ENV:\x20URL=','\x20CWD=','get_all_status','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','end','report_status','get_inbox','catch','parse\x20error:\x20','Authorization','Task\x20content','new_task','connecting\x20to\x20','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','config.json','type','send_task','failed','warning:\x20could\x20not\x20register:\x20','then','statusText','content','...\x20TMUX=','Progress\x200-100','\x20RESUME_ID=','token','commhub-channel','params','commhub_get_all_status','0.3.0','.env','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','from_session','alias','decode','222544RLftth','blocked','heartbeat\x20failed:\x20','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','stderr','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','min','pid','Bearer\x20','get','notifications/claude/channel','SSE\x20connected\x20as\x20\x22','normal','\x22\x20after\x20SSE\x20reconnect','setRequestHandler','.anet','761100VObXLJ','ESRCH','code','trim','inbox_count','2025-03-26','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','text','1949585kPTsrN','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','notification','claude-code','commhub_send_task','commhub_reply','cwd','\x20ALIAS=','/events/','2698888zoHQcx','commhub_report_status','data:\x20','Target\x20session\x20alias','parent\x20claude\x20pid=','result','MCP\x20stdio\x20connected','exit','SSE\x20error:\x20','idle','\x20PROJECT_ENV=','send_reply','commhub','441iVSCPb','Priority\x20(default:\x20normal)','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connection\x20error:\x20',']\x20[commhub]\x20','→\x20injected\x20task\x20','number','task','application/json','high','replied','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','2472552gDwuRD','unknown','in_progress','SSE\x20fatal:\x20','cancelled','utf-8','re-registered\x20as\x20\x22','2.0','message','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','replace','pop','POST','Current\x20task\x20description','Reply\x20text\x20/\x20result\x20summary','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','commhub_send_message','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','shutting\x20down,\x20reporting\x20offline...','CommHub\x20init\x20failed:\x20','getReader','completed','tmux\x20display-message\x20-p\x20\x27#S\x27'];a0_0x1c45=function(){return _0x1f1655;};return a0_0x1c45();}async function A(_0x3983e3){const _0x58db9f=a0_0x24b8d2;if(_0x3983e3[_0x58db9f(0x1e7)]===_0x58db9f(0x1cd)){z(_0x58db9f(0x165)+p+'\x22');return;}if(_0x3983e3[_0x58db9f(0x1e7)]==='new_message'){if(z('←\x20message\x20from\x20'+_0x3983e3['from']+':\x20'+_0x3983e3['message']['slice'](0x0,0x3c)),await K[_0x58db9f(0x174)]({'method':_0x58db9f(0x164),'params':{'content':_0x3983e3[_0x58db9f(0x19c)],'meta':{'sender':_0x3983e3[_0x58db9f(0x1ca)]||_0x58db9f(0x1b4),'sender_id':'commhub','user':_0x3983e3['from']||_0x58db9f(0x1b4),'priority':_0x58db9f(0x166)}}}),_0x3983e3[_0x58db9f(0x1c9)])await Q(_0x58db9f(0x1b2),{'alias':p,'message_id':_0x3983e3[_0x58db9f(0x1c9)]});return;}if(_0x3983e3[_0x58db9f(0x1e7)]===_0x58db9f(0x1e3)||_0x3983e3[_0x58db9f(0x1e7)]===_0x58db9f(0x1b3)){z('←\x20'+_0x3983e3['type']+':\x20inbox_count='+_0x3983e3[_0x58db9f(0x16e)]+'\x20priority='+(_0x3983e3['priority']||_0x58db9f(0x166)));let _0x464e9=await Q(_0x58db9f(0x1de),{'alias':p,'limit':0x5});if(_0x464e9?.['ok']&&_0x464e9[_0x58db9f(0x1b6)]?.['length']>0x0)for(let _0xcfeafe of _0x464e9[_0x58db9f(0x1b6)]){let _0x37838f={'sender':_0xcfeafe[_0x58db9f(0x157)]||_0x58db9f(0x1b4),'sender_id':_0x58db9f(0x187),'user':_0xcfeafe[_0x58db9f(0x157)]||'hub','task_id':_0xcfeafe['id'],'priority':_0xcfeafe['priority']||_0x58db9f(0x166)};G[_0x58db9f(0x1d3)](_0xcfeafe['id'],_0xcfeafe[_0x58db9f(0x157)]||'hub'),await K[_0x58db9f(0x174)]({'method':_0x58db9f(0x164),'params':{'content':_0xcfeafe[_0x58db9f(0x14c)],'meta':_0x37838f}}),z(_0x58db9f(0x18d)+_0xcfeafe['id'][_0x58db9f(0x1bb)](0x0,0x8)+'\x20from\x20'+_0xcfeafe[_0x58db9f(0x157)]+':\x20'+_0xcfeafe[_0x58db9f(0x14c)]['slice'](0x0,0x3c)),await Q(_0x58db9f(0x1b2),{'alias':p,'message_id':_0xcfeafe['id']});}}}async function t(){const _0x55f85d=a0_0x24b8d2;let _0x49c9c9=new a0_0x1f93af();await K['connect'](_0x49c9c9),z(_0x55f85d(0x181)),z('starting\x20SSE\x20listener...'),l()[_0x55f85d(0x1df)](_0x7eadeb=>z(_0x55f85d(0x197)+_0x7eadeb)),Q(_0x55f85d(0x1dd),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x3c6840(),'hostname':a0_0x3c6840(),'agent':'claude-code','project_dir':process[_0x55f85d(0x178)](),'tmux_name':j||void 0x0})[_0x55f85d(0x14a)](()=>z('registered\x20as\x20\x22'+p+_0x55f85d(0x1bc)+V[_0x55f85d(0x1bb)](0x0,0x8)+')'))['catch'](_0x3f0665=>z(_0x55f85d(0x149)+_0x3f0665)),setInterval(()=>{const _0x56fc60=_0x55f85d;Q(_0x56fc60(0x1dd),{'resume_id':V,'alias':p,'status':_0x56fc60(0x184),'server':a0_0x3c6840(),'hostname':a0_0x3c6840(),'agent':_0x56fc60(0x175),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x56fc60(0x1df)](_0x39ff5d=>z(_0x56fc60(0x15c)+_0x39ff5d));},0x2bf20),z('ready\x20—\x20waiting\x20for\x20events');}t()[a0_0x24b8d2(0x1df)](_0x254c13=>{z('fatal:\x20'+_0x254c13),process['exit'](0x1);});async function b(){const _0x4bebd1=a0_0x24b8d2;z(_0x4bebd1(0x1a6)),await Q(_0x4bebd1(0x1dd),{'resume_id':V,'alias':p,'status':_0x4bebd1(0x1b9),'task':_0x4bebd1(0x1ab)})[_0x4bebd1(0x1df)](()=>{}),process[_0x4bebd1(0x182)](0x0);}process['stdin']['on'](a0_0x24b8d2(0x1dc),()=>b()),process['on'](a0_0x24b8d2(0x1b5),()=>b()),process['on'](a0_0x24b8d2(0x1bd),()=>b());var d=process['ppid'];if(d&&d>0x1){let h=setInterval(()=>{const _0x4de6e5=a0_0x24b8d2;if(process['ppid']===0x1&&d!==0x1){z(_0x4de6e5(0x193)+d+_0x4de6e5(0x1cf)),b();return;}try{process[_0x4de6e5(0x1cc)](d,0x0);}catch(_0x217bc5){if(_0x217bc5?.[_0x4de6e5(0x16c)]===_0x4de6e5(0x16b))z(_0x4de6e5(0x17f)+d+_0x4de6e5(0x1a3)),b();}},0x7530);if(typeof h[a0_0x24b8d2(0x1b7)]==='function')h[a0_0x24b8d2(0x1b7)]();}
2
+ const a0_0x385446=a0_0x2865;(function(_0x4c39e6,_0x3e7668){const _0x1c572e=a0_0x2865,_0x4df4f2=_0x4c39e6();while(!![]){try{const _0x30dee0=-parseInt(_0x1c572e(0xdb))/0x1*(-parseInt(_0x1c572e(0x162))/0x2)+-parseInt(_0x1c572e(0x144))/0x3+-parseInt(_0x1c572e(0x129))/0x4+-parseInt(_0x1c572e(0x159))/0x5*(-parseInt(_0x1c572e(0x14e))/0x6)+-parseInt(_0x1c572e(0x107))/0x7+-parseInt(_0x1c572e(0x11b))/0x8+-parseInt(_0x1c572e(0xe3))/0x9*(-parseInt(_0x1c572e(0x155))/0xa);if(_0x30dee0===_0x3e7668)break;else _0x4df4f2['push'](_0x4df4f2['shift']());}catch(_0x1c7ae5){_0x4df4f2['push'](_0x4df4f2['shift']());}}}(a0_0x4b3d,0x72fea));import{readFileSync as a0_0x32d519,existsSync as a0_0x2317d3}from'fs';import{randomUUID as a0_0x5a2575}from'crypto';import{join as a0_0x41c091}from'path';import{hostname as a0_0x163ae3}from'os';import{execSync as a0_0x1719e1}from'child_process';function B(_0x41caf9){const _0x221235=a0_0x2865;let _0x3c20d1=_0x41caf9[_0x221235(0x125)](/[^a-zA-Z0-9\-_]/g,'-');return _0x3c20d1===''?'unknown':_0x3c20d1;}import{Server as a0_0x38f832}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x216f86}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x42b373,CallToolRequestSchema as a0_0x308c43}from'@modelcontextprotocol/sdk/types.js';function T(_0xf0968d){const _0x3f65d2=a0_0x2865;if(!a0_0x2317d3(_0xf0968d))return;for(let _0x182214 of a0_0x32d519(_0xf0968d,'utf-8')[_0x3f65d2(0x12b)]('\x0a')){let _0x4146c0=_0x182214[_0x3f65d2(0x16c)]();if(!_0x4146c0||_0x4146c0['startsWith']('#'))continue;let _0x48f663=_0x4146c0[_0x3f65d2(0xe7)]('=');if(_0x48f663<0x0)continue;let _0x56f4fb=_0x4146c0['slice'](0x0,_0x48f663)['trim'](),_0x2eee96=_0x4146c0['slice'](_0x48f663+0x1)[_0x3f65d2(0x16c)]()[_0x3f65d2(0x125)](/^["']|["']$/g,'');if(!process.env[_0x56f4fb])process.env[_0x56f4fb]=_0x2eee96;}}var C=process.env.HOME||'~',r=a0_0x41c091(C,'.claude/channels/commhub');T(a0_0x41c091(r,a0_0x385446(0x173)));var H=B(process[a0_0x385446(0x161)]());T(a0_0x41c091(r,H,a0_0x385446(0x173)));function E(){const _0x3b4a9b=a0_0x385446;try{return a0_0x1719e1(_0x3b4a9b(0x10c),{'encoding':_0x3b4a9b(0x174),'timeout':0x7d0})['trim']();}catch{return'';}}function _(){const _0x17931d=a0_0x385446;try{let _0x5f29af=a0_0x41c091(C,'.anet',_0x17931d(0x119));if(a0_0x2317d3(_0x5f29af))return JSON[_0x17931d(0x137)](a0_0x32d519(_0x5f29af,_0x17931d(0x174)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x385446(0x12c)]||a0_0x385446(0x170),j=process.env.COMMHUB_TMUX||E();function S(){const _0x48ab19=a0_0x385446;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x48ab19(0x16c)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x48ab19(0x168)][_0x48ab19(0x10d)]('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+(_0x48ab19(0xee)+(j||_0x48ab19(0xf5))+_0x48ab19(0xd4)+a0_0x163ae3()+_0x48ab19(0xcf))),_0x48ab19(0x11f)+process[_0x48ab19(0x108)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5a2575(),k=process.env.COMMHUB_TOKEN||R[a0_0x385446(0xdd)]||'';function z(_0xe9c706){const _0x731702=a0_0x385446;let _0x44f7ca=new Date()['toTimeString']()[_0x731702(0x15e)](0x0,0x8);process['stderr'][_0x731702(0x10d)]('['+_0x44f7ca+_0x731702(0x150)+_0xe9c706+'\x0a');}function i(_0x1a5312){return new Promise(_0x51757b=>setTimeout(_0x51757b,_0x1a5312));}function a0_0x2865(_0x488a2b,_0x55a275){_0x488a2b=_0x488a2b-0xcb;const _0x4b3d3d=a0_0x4b3d();let _0x28657b=_0x4b3d3d[_0x488a2b];return _0x28657b;}z('ENV:\x20URL='+Y+a0_0x385446(0xf1)+p+a0_0x385446(0x148)+V[a0_0x385446(0x15e)](0x0,0x8)+a0_0x385446(0xeb)+(j||a0_0x385446(0x157))+a0_0x385446(0x13e)+process[a0_0x385446(0x161)]()+a0_0x385446(0x16e)+H);var G=new Map(),K=new a0_0x38f832({'name':a0_0x385446(0x12a),'version':a0_0x385446(0x175)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x385446(0xe9),a0_0x385446(0xea),a0_0x385446(0x112),a0_0x385446(0xfa),a0_0x385446(0x143)+p][a0_0x385446(0xd7)]('\x0a')});K['setRequestHandler'](a0_0x42b373,async()=>({'tools':[{'name':'commhub_reply','description':a0_0x385446(0x118),'inputSchema':{'type':'object','properties':{'task_id':{'type':'string','description':a0_0x385446(0x113)},'text':{'type':a0_0x385446(0x106),'description':a0_0x385446(0x121)},'status':{'type':a0_0x385446(0x106),'enum':['completed',a0_0x385446(0xfe),a0_0x385446(0x171),a0_0x385446(0x152),a0_0x385446(0x163),a0_0x385446(0x104)],'description':a0_0x385446(0x12f)}},'required':[a0_0x385446(0x101)]}},{'name':a0_0x385446(0x13b),'description':a0_0x385446(0x136),'inputSchema':{'type':a0_0x385446(0x138),'properties':{'status':{'type':a0_0x385446(0x106),'enum':[a0_0x385446(0x111),a0_0x385446(0x16f),a0_0x385446(0x152),'error']},'task':{'type':a0_0x385446(0x106),'description':a0_0x385446(0x11d)},'progress':{'type':a0_0x385446(0x133),'description':a0_0x385446(0xce)}},'required':[a0_0x385446(0xd9)]}},{'name':'commhub_send_task','description':a0_0x385446(0x13f),'inputSchema':{'type':a0_0x385446(0x138),'properties':{'alias':{'type':a0_0x385446(0x106),'description':a0_0x385446(0x167)},'task':{'type':a0_0x385446(0x106),'description':'Task\x20content'},'priority':{'type':a0_0x385446(0x106),'enum':[a0_0x385446(0xd5),a0_0x385446(0x10a),'low'],'description':a0_0x385446(0xff)}},'required':[a0_0x385446(0x12d),a0_0x385446(0xdf)]}},{'name':a0_0x385446(0x15f),'description':a0_0x385446(0xef),'inputSchema':{'type':a0_0x385446(0x138),'properties':{'alias':{'type':'string','description':a0_0x385446(0x167)},'message':{'type':a0_0x385446(0x106),'description':a0_0x385446(0x151)}},'required':[a0_0x385446(0x12d),a0_0x385446(0x123)]}},{'name':'commhub_get_all_status','description':a0_0x385446(0x16b),'inputSchema':{'type':a0_0x385446(0x138),'properties':{}}}]}));async function Q(_0x50552d,_0xddabe6){const _0x2599cb=a0_0x385446;let _0x73a358=await fetch(Y+_0x2599cb(0x146),{'method':_0x2599cb(0xcc),'headers':{'Content-Type':_0x2599cb(0x110),'Accept':_0x2599cb(0x141),...k?{'Authorization':'Bearer\x20'+k}:{}},'body':JSON['stringify']({'jsonrpc':_0x2599cb(0x122),'id':0x1,'method':_0x2599cb(0xe0),'params':{'protocolVersion':_0x2599cb(0xf8),'capabilities':{},'clientInfo':{'name':_0x2599cb(0x12a),'version':'0.3.0'}}})});if(!_0x73a358['ok']){let _0x21750e=await _0x73a358[_0x2599cb(0x101)]();return z('CommHub\x20init\x20failed:\x20'+_0x73a358[_0x2599cb(0xd9)]+'\x20'+_0x21750e[_0x2599cb(0x15e)](0x0,0x64)),{'ok':!0x1,'error':_0x2599cb(0x169)+_0x73a358[_0x2599cb(0xd9)]};}await _0x73a358[_0x2599cb(0x101)]();let _0x5d27c9=(await(await fetch(Y+_0x2599cb(0x146),{'method':_0x2599cb(0xcc),'headers':{'Content-Type':_0x2599cb(0x110),'Accept':'application/json,\x20text/event-stream',...k?{'Authorization':_0x2599cb(0x114)+k}:{}},'body':JSON[_0x2599cb(0x158)]({'jsonrpc':'2.0','id':0x2,'method':_0x2599cb(0x14d),'params':{'name':_0x50552d,'arguments':_0xddabe6}})}))[_0x2599cb(0x101)]())['split']('\x0a')[_0x2599cb(0x115)](_0x204983=>_0x204983[_0x2599cb(0xe4)](_0x2599cb(0xd1)));if(_0x5d27c9){let _0x294c7c=JSON[_0x2599cb(0x137)](_0x5d27c9['slice'](0x6));return _0x294c7c?.[_0x2599cb(0x164)]?.[_0x2599cb(0x10f)]?.[0x0]?.['text']?JSON[_0x2599cb(0x137)](_0x294c7c[_0x2599cb(0x164)][_0x2599cb(0x10f)][0x0]['text']):_0x294c7c;}return{'ok':!0x1,'error':'no\x20response'};}K[a0_0x385446(0x14c)](a0_0x308c43,async _0x200fbc=>{const _0x286a08=a0_0x385446;let {name:_0x46e25e,arguments:_0xfea5aa}=_0x200fbc[_0x286a08(0x16d)];if(_0x46e25e===_0x286a08(0xf7)){let {task_id:_0x5c30c1,text:_0x284fa1,status:_0x3d8b0b}=_0xfea5aa;if(_0x3d8b0b==='completed'||_0x3d8b0b===_0x286a08(0xfe)||_0x3d8b0b==='cancelled'){let _0x43b5c1=_0x3d8b0b===_0x286a08(0x139)?_0x286a08(0x126):_0x3d8b0b,_0x415ebc=_0x5c30c1?G['get'](_0x5c30c1)||_0x286a08(0x12c):_0x286a08(0x12c),_0x4ef21a=await Q(_0x286a08(0x142),{'alias':_0x415ebc,'text':_0x284fa1,'in_reply_to':_0x5c30c1||void 0x0,'status':_0x43b5c1,'from_session':p});if(_0x5c30c1)G[_0x286a08(0x10b)](_0x5c30c1);return{'content':[{'type':'text','text':JSON[_0x286a08(0x158)](_0x4ef21a)}]};}let _0x1e6111=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x3d8b0b===_0x286a08(0x152)?_0x286a08(0x152):_0x3d8b0b===_0x286a08(0x163)?'error':'working','task':_0x284fa1[_0x286a08(0x15e)](0x0,0xc8),'output':_0x284fa1});return{'content':[{'type':'text','text':JSON['stringify'](_0x1e6111)}]};}if(_0x46e25e===_0x286a08(0x13b)){let {status:_0x3d6ef1,task:_0x3fbc68,progress:_0x280826}=_0xfea5aa,_0x38ccd8=await Q(_0x286a08(0xe5),{'resume_id':V,'alias':p,'status':_0x3d6ef1,'task':_0x3fbc68,'progress':_0x280826});return{'content':[{'type':_0x286a08(0x101),'text':JSON[_0x286a08(0x158)](_0x38ccd8)}]};}if(_0x46e25e===_0x286a08(0xd6)){let {alias:_0x464759,task:_0x21d34b,priority:_0x2b51f5}=_0xfea5aa,_0x1c90bb=await Q(_0x286a08(0x130),{'alias':_0x464759,'task':_0x21d34b,'priority':_0x2b51f5||'normal','from_session':p});return{'content':[{'type':_0x286a08(0x101),'text':JSON[_0x286a08(0x158)](_0x1c90bb)}]};}if(_0x46e25e===_0x286a08(0x15f)){let {alias:_0xfa0ba3,message:_0x51b36d}=_0xfea5aa,_0x43fa1f=await Q(_0x286a08(0xe1),{'alias':_0xfa0ba3,'message':_0x51b36d,'from_session':p});return{'content':[{'type':'text','text':JSON['stringify'](_0x43fa1f)}]};}if(_0x46e25e===_0x286a08(0xd2)){let _0x2c7db4=await Q('get_all_status',{});return{'content':[{'type':'text','text':JSON[_0x286a08(0x158)](_0x2c7db4)}]};}return{'content':[{'type':_0x286a08(0x101),'text':JSON[_0x286a08(0x158)]({'error':_0x286a08(0x109)})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x3271c8=a0_0x385446;try{await Q(_0x3271c8(0xe5),{'resume_id':V,'alias':p,'status':_0x3271c8(0x16f),'server':a0_0x163ae3(),'hostname':a0_0x163ae3(),'agent':_0x3271c8(0xd8),'project_dir':process[_0x3271c8(0x161)](),'tmux_name':j||void 0x0}),z(_0x3271c8(0xde)+p+_0x3271c8(0x15d));}catch(_0x5dfdf9){z(_0x3271c8(0xf9)+_0x5dfdf9);}}async function l(){const _0x352cb7=a0_0x385446;let _0x22b46c=Y+_0x352cb7(0xf0)+encodeURIComponent(p),_0x33a419={};if(k)_0x33a419['Authorization']=_0x352cb7(0x114)+k;z(_0x352cb7(0x11a)+_0x22b46c);let _0x1fc32b=D,_0x515759=!0x0,_0xdc3ff4=null;while(!0x0){try{let _0xc7b0e5=await fetch(_0x22b46c,{'headers':_0x33a419});if(!_0xc7b0e5['ok']){if(z(_0x352cb7(0xf4)+_0xc7b0e5['status']+'\x20'+_0xc7b0e5[_0x352cb7(0x131)]),_0xdc3ff4=_0xdc3ff4??Date['now'](),Date[_0x352cb7(0xf6)]()-_0xdc3ff4>O){z(_0x352cb7(0x140)+Y+_0x352cb7(0x160));return;}await i(_0x1fc32b),_0x1fc32b=Math[_0x352cb7(0xe8)](_0x1fc32b*0x2,v);continue;}let _0x28ea80=_0xc7b0e5[_0x352cb7(0xfc)][_0x352cb7(0xdc)](),_0x369f46=new TextDecoder(),_0xaf27b1='';_0x1fc32b=D;while(!0x0){let {done:_0x956aaa,value:_0x49f823}=await _0x28ea80[_0x352cb7(0xcd)]();if(_0x956aaa)break;_0xaf27b1+=_0x369f46[_0x352cb7(0x135)](_0x49f823,{'stream':!0x0});let _0x173552=_0xaf27b1[_0x352cb7(0x12b)]('\x0a\x0a');_0xaf27b1=_0x173552[_0x352cb7(0xcb)]()||'';for(let _0x2def7f of _0x173552){let _0x486b0b=_0x2def7f[_0x352cb7(0x12b)]('\x0a')['find'](_0x4ae041=>_0x4ae041['startsWith'](_0x352cb7(0xd1)));if(!_0x486b0b)continue;try{let _0x134839=JSON['parse'](_0x486b0b[_0x352cb7(0x15e)](0x6));if(await A(_0x134839),_0x134839[_0x352cb7(0x10e)]===_0x352cb7(0x105)){if(_0xdc3ff4=null,!_0x515759)await m();_0x515759=!0x1;}}catch(_0x443220){z(_0x352cb7(0x165)+_0x443220);}}}z(_0x352cb7(0x172));}catch(_0x5e5d50){z('SSE\x20connection\x20error:\x20'+_0x5e5d50);}if(_0xdc3ff4=_0xdc3ff4??Date[_0x352cb7(0xf6)](),Date[_0x352cb7(0xf6)]()-_0xdc3ff4>O){z(_0x352cb7(0x140)+Y+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await i(_0x1fc32b),_0x1fc32b=Math['min'](_0x1fc32b*0x2,v);}}async function A(_0x1d081c){const _0x4f8819=a0_0x385446;if(_0x1d081c['type']==='connected'){z(_0x4f8819(0x13a)+p+'\x22');return;}if(_0x1d081c[_0x4f8819(0x10e)]==='new_message'){if(z('←\x20message\x20from\x20'+_0x1d081c['from']+':\x20'+_0x1d081c['message']['slice'](0x0,0x3c)),await K[_0x4f8819(0xda)]({'method':_0x4f8819(0x166),'params':{'content':_0x1d081c['message'],'meta':{'sender':_0x1d081c[_0x4f8819(0x154)]||_0x4f8819(0x12c),'sender_id':'commhub','user':_0x1d081c[_0x4f8819(0x154)]||_0x4f8819(0x12c),'priority':_0x4f8819(0x10a)}}}),_0x1d081c['message_id'])await Q(_0x4f8819(0x117),{'alias':p,'message_id':_0x1d081c[_0x4f8819(0x147)]});return;}if(_0x1d081c[_0x4f8819(0x10e)]==='new_task'||_0x1d081c[_0x4f8819(0x10e)]===_0x4f8819(0xec)){z('←\x20'+_0x1d081c[_0x4f8819(0x10e)]+_0x4f8819(0x13d)+_0x1d081c[_0x4f8819(0xf2)]+'\x20priority='+(_0x1d081c[_0x4f8819(0x128)]||_0x4f8819(0x10a)));let _0x50fd7e=await Q(_0x4f8819(0x145),{'alias':p,'limit':0x5});if(_0x50fd7e?.['ok']&&_0x50fd7e['messages']?.[_0x4f8819(0xf3)]>0x0)for(let _0x3455d8 of _0x50fd7e[_0x4f8819(0xe6)]){let _0x496e12={'sender':_0x3455d8[_0x4f8819(0x132)]||_0x4f8819(0x12c),'sender_id':_0x4f8819(0x124),'user':_0x3455d8[_0x4f8819(0x132)]||'hub','task_id':_0x3455d8['id'],'priority':_0x3455d8[_0x4f8819(0x128)]||_0x4f8819(0x10a)};G['set'](_0x3455d8['id'],_0x3455d8[_0x4f8819(0x132)]||_0x4f8819(0x12c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0x3455d8['content'],'meta':_0x496e12}}),z(_0x4f8819(0x15a)+_0x3455d8['id'][_0x4f8819(0x15e)](0x0,0x8)+_0x4f8819(0x15c)+_0x3455d8[_0x4f8819(0x132)]+':\x20'+_0x3455d8[_0x4f8819(0x10f)]['slice'](0x0,0x3c)),await Q(_0x4f8819(0x117),{'alias':p,'message_id':_0x3455d8['id']});}}}async function t(){const _0x522ab3=a0_0x385446;let _0x2cba0a=new a0_0x216f86();await K['connect'](_0x2cba0a),z(_0x522ab3(0xd3)),z(_0x522ab3(0x16a)),l()[_0x522ab3(0x103)](_0x13b9f4=>z(_0x522ab3(0x11c)+_0x13b9f4)),Q(_0x522ab3(0xe5),{'resume_id':V,'alias':p,'status':_0x522ab3(0x16f),'server':a0_0x163ae3(),'hostname':a0_0x163ae3(),'agent':'claude-code','project_dir':process[_0x522ab3(0x161)](),'tmux_name':j||void 0x0})[_0x522ab3(0xed)](()=>z(_0x522ab3(0xfb)+p+'\x22\x20('+V['slice'](0x0,0x8)+')'))[_0x522ab3(0x103)](_0x323d5c=>z('warning:\x20could\x20not\x20register:\x20'+_0x323d5c)),setInterval(()=>{const _0x58526e=_0x522ab3;Q(_0x58526e(0xe5),{'resume_id':V,'alias':p,'status':_0x58526e(0x16f),'server':a0_0x163ae3(),'hostname':a0_0x163ae3(),'agent':'claude-code','project_dir':process[_0x58526e(0x161)](),'tmux_name':j||void 0x0})[_0x58526e(0x103)](_0x414a11=>z('heartbeat\x20failed:\x20'+_0x414a11));},0x2bf20),z(_0x522ab3(0x116));}t()[a0_0x385446(0x103)](_0x101f63=>{const _0x25ce4c=a0_0x385446;z(_0x25ce4c(0x12e)+_0x101f63),process[_0x25ce4c(0x120)](0x1);});function a0_0x4b3d(){const _0x1df802=['in_progress','connected','string','6590577jTOMCs','pid','unknown\x20tool','normal','delete','tmux\x20display-message\x20-p\x20\x27#S\x27','write','type','content','application/json','working','Reply\x20using\x20the\x20commhub_reply\x20tool.\x20IMPORTANT:\x20to\x20make\x20your\x20reply\x20appear\x20in\x20the\x20Dashboard\x20chat\x20and\x20reach\x20the\x20sender\x20in\x20real\x20time,\x20use\x20status=\x22completed\x22\x20(a\x20terminal\x20status:\x20completed/failed/cancelled)\x20—\x20that\x20routes\x20to\x20send_reply\x20and\x20emits\x20the\x20new_reply\x20SSE\x20event\x20the\x20Dashboard\x20listens\x20for.\x20A\x20non-terminal\x20status\x20(in_progress/blocked/error)\x20only\x20updates\x20your\x20session\x20status\x20via\x20report_status\x20and\x20does\x20NOT\x20show\x20in\x20the\x20Dashboard,\x20even\x20though\x20the\x20call\x20returns\x20ok.','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','Bearer\x20','find','ready\x20—\x20waiting\x20for\x20events','ack_inbox','Reply\x20to\x20a\x20CommHub\x20task.\x20Use\x20status=\x22completed\x22\x20(terminal)\x20to\x20push\x20the\x20reply\x20to\x20the\x20Dashboard/sender\x20in\x20real\x20time\x20(send_reply\x20→\x20new_reply\x20SSE);\x20non-terminal\x20status\x20(in_progress/blocked/error)\x20only\x20updates\x20session\x20status\x20(report_status)\x20and\x20does\x20NOT\x20reach\x20the\x20Dashboard.','config.json','connecting\x20to\x20','2725848iDDoxV','SSE\x20fatal:\x20','Current\x20task\x20description','function','unattributed-','exit','Reply\x20text\x20/\x20result\x20summary','2.0','message','commhub','replace','replied','offline','priority','3343184bCraRT','commhub-channel','split','hub','alias','fatal:\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','send_task','statusText','from_session','number','shutting\x20down,\x20reporting\x20offline...','decode','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','parse','object','completed','SSE\x20connected\x20as\x20\x22','commhub_report_status','ppid',':\x20inbox_count=','\x20CWD=','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','application/json,\x20text/event-stream','send_reply','Session\x20alias:\x20','2437395oQRKEf','get_inbox','/mcp','message_id','\x20RESUME_ID=','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','session\x20disconnected','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','setRequestHandler','tools/call','246WZRqKi','unref',']\x20[commhub]\x20','Message\x20content','blocked','code','from','17870pfyeMQ',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','none','stringify','102010ZFkOkh','→\x20injected\x20task\x20','end','\x20from\x20','\x22\x20after\x20SSE\x20reconnect','slice','commhub_send_message',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','cwd','786974fnbSqe','error','result','parse\x20error:\x20','notifications/claude/channel','Target\x20session\x20alias','stderr','init\x20failed:\x20','starting\x20SSE\x20listener...','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','trim','params','\x20PROJECT_ENV=','idle','http://127.0.0.1:9200','cancelled','SSE\x20stream\x20ended,\x20reconnecting...','.env','utf-8','0.3.0','pop','POST','read','Progress\x200-100','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','ESRCH','data:\x20','commhub_get_all_status','MCP\x20stdio\x20connected','\x20/\x20hostname=','high','commhub_send_task','join','claude-code','status','notification','2JBjLqt','getReader','token','re-registered\x20as\x20\x22','task','initialize','send_message','kill','8955yJefmy','startsWith','report_status','messages','indexOf','min','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','...\x20TMUX=','broadcast','then','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','/events/','\x20ALIAS=','inbox_count','length','SSE\x20error:\x20','(none)','now','commhub_reply','2025-03-26','re-register\x20failed:\x20','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','registered\x20as\x20\x22','body','SIGTERM','failed','Priority\x20(default:\x20normal)','parent\x20claude\x20pid=','text','stdin','catch'];a0_0x4b3d=function(){return _0x1df802;};return a0_0x4b3d();}async function b(){const _0x40438e=a0_0x385446;z(_0x40438e(0x134)),await Q(_0x40438e(0xe5),{'resume_id':V,'alias':p,'status':_0x40438e(0x127),'task':_0x40438e(0x14a)})['catch'](()=>{}),process[_0x40438e(0x120)](0x0);}process[a0_0x385446(0x102)]['on'](a0_0x385446(0x15b),()=>b()),process['on'](a0_0x385446(0xfd),()=>b()),process['on']('SIGINT',()=>b());var d=process[a0_0x385446(0x13c)];if(d&&d>0x1){let h=setInterval(()=>{const _0x342bd1=a0_0x385446;if(process[_0x342bd1(0x13c)]===0x1&&d!==0x1){z(_0x342bd1(0x14b)+d+_0x342bd1(0x156)),b();return;}try{process[_0x342bd1(0xe2)](d,0x0);}catch(_0x2f0c37){if(_0x2f0c37?.[_0x342bd1(0x153)]===_0x342bd1(0xd0))z(_0x342bd1(0x100)+d+_0x342bd1(0x149)),b();}},0x7530);if(typeof h[a0_0x385446(0x14f)]===a0_0x385446(0x11e))h[a0_0x385446(0x14f)]();}
@@ -1,9 +1,21 @@
1
1
  export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "opencode-cli" | "codex-app-server";
2
- /** Operator-facing default for any runtime slot that comes in empty / missing / unrecognized. */
2
+ /** Operator-facing default for a runtime slot that is empty or missing. */
3
3
  export declare const DEFAULT_RUNTIME: RuntimeName;
4
+ export declare const SUPPORTED_RUNTIME_NAMES: readonly RuntimeName[];
4
5
  type ProfileLike = {
5
6
  runtime?: string;
6
7
  codexRuntime?: string;
7
8
  };
9
+ /**
10
+ * Legacy normalization used by display and migration code. Missing, empty,
11
+ * and unknown values all use the safe default for backward compatibility.
12
+ * Security-sensitive create/start paths must call `normalizeRuntimeStrict`.
13
+ */
8
14
  export declare function normalizeRuntime(profileOrRuntime?: ProfileLike | string): RuntimeName;
15
+ /**
16
+ * Canonicalize a runtime at an execution boundary. Missing/empty still means
17
+ * the documented default, but any non-empty unknown value is rejected so a
18
+ * typo or future runtime cannot silently execute as Claude.
19
+ */
20
+ export declare function normalizeRuntimeStrict(profileOrRuntime?: ProfileLike | string): RuntimeName;
9
21
  export {};
@@ -0,0 +1,14 @@
1
+ export declare const OPENCODE_AGENT_NETWORK_VERSION = "2.3.0-preview.34";
2
+ export declare const OPENCODE_AGENT_NODE_VERSION = "2.5.0-preview.26";
3
+ export declare const OPENCODE_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.26";
4
+ export declare function opencodeExactPairInstallCommand(): string;
5
+ /** Runtime capability advertised by agent-node's operator-facing help. */
6
+ export declare function agentNodeHelpSupportsOpencode(help: string): boolean;
7
+ /**
8
+ * Resolve a package-owned agent-node entrypoint and verify its immutable
9
+ * release identity before it can receive `opencode-cli`. Capability text is
10
+ * not a security boundary: an older preview already advertised the runtime.
11
+ */
12
+ export declare function validateAgentNodePackageEntrypoint(rawEntrypoint: string, packageSpec: string, expectedVersion?: string, forbiddenRoots?: readonly string[]): string;
13
+ /** Skip invalid/local PATH shims and return the first exact trusted package. */
14
+ export declare function resolveAgentNodePackageEntrypointFromPath(searchPath: string, packageSpec: string, expectedVersion: string, forbiddenRoots?: readonly string[]): string;
@@ -0,0 +1,43 @@
1
+ import type { OpencodePresetId } from "./opencode-preset";
2
+ export declare const OPENCODE_AUTH_LOGIN_ROOT_PREFIX = "opencode-auth-login-";
3
+ export declare const OPENCODE_AUTH_LOGIN_OWNER_FILE = ".owner.json";
4
+ export declare const OPENCODE_AUTH_LOGIN_CLEANUP_PREFIX = ".anet-opencode-auth-cleanup-";
5
+ export interface OpencodeAuthLoginSandbox {
6
+ readonly nodeWorkDir: string;
7
+ readonly provider: OpencodePresetId;
8
+ readonly root: string;
9
+ readonly cwd: string;
10
+ readonly authPath: string;
11
+ readonly env: Readonly<NodeJS.ProcessEnv>;
12
+ }
13
+ export interface CreateOpencodeAuthLoginSandboxOptions {
14
+ nodeWorkDir: string;
15
+ provider: OpencodePresetId | string;
16
+ parentEnv?: NodeJS.ProcessEnv;
17
+ /** Internal/test-only trusted external base override. */
18
+ launchBase?: string;
19
+ }
20
+ export interface OpencodeAuthLoginCredential {
21
+ provider: OpencodePresetId;
22
+ type: "api";
23
+ key: string;
24
+ }
25
+ /** Deterministic exact-1.18.1 login argv for the selected API-key flow. */
26
+ export declare function buildOpencodeAuthLoginArgs(provider: OpencodePresetId | string): string[];
27
+ /** Prepare a fresh, node-scoped environment for one interactive login. */
28
+ export declare function createOpencodeAuthLoginSandbox(options: CreateOpencodeAuthLoginSandboxOptions): OpencodeAuthLoginSandbox;
29
+ /** Repeat external-root ancestor and inode validation immediately before the
30
+ * vetted upstream binary is spawned. */
31
+ export declare function revalidateOpencodeAuthLoginSandbox(sandbox: OpencodeAuthLoginSandbox): void;
32
+ /**
33
+ * Read only the selected provider's exact API-key shape from the fresh root.
34
+ * OAuth/browser-login records and mixed/multi-provider documents are refused.
35
+ */
36
+ export declare function readOpencodeAuthLoginCredential(sandbox: OpencodeAuthLoginSandbox): OpencodeAuthLoginCredential;
37
+ /** Safely remove a sandbox created by this process. Idempotent after removal. */
38
+ export declare function cleanupOpencodeAuthLoginSandbox(sandbox: OpencodeAuthLoginSandbox): void;
39
+ /**
40
+ * Lifecycle helper for CLI integration. Spawn/wait/read the credential inside
41
+ * `action`; the fresh tree is cleaned on success, child failure, or throw.
42
+ */
43
+ export declare function withOpencodeAuthLoginSandbox<T>(options: CreateOpencodeAuthLoginSandboxOptions, action: (sandbox: OpencodeAuthLoginSandbox) => T | Promise<T>): Promise<T>;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Process-loader hooks that must never cross the opencode-cli launcher
3
+ * boundary. The exact agent-node package/entrypoint check happens before the
4
+ * node profile env is merged; allowing that profile to supply one of these
5
+ * variables would let code run before the verified entrypoint's first line.
6
+ */
7
+ export declare const OPENCODE_AGENT_NODE_LOADER_ENV_KEYS: readonly ["NODE_OPTIONS", "NODE_PATH", "NODE_V8_COVERAGE", "NODE_REDIRECT_WARNINGS", "NODE_COMPILE_CACHE", "BUN_OPTIONS", "BUN_PRELOAD", "LD_PRELOAD", "LD_LIBRARY_PATH", "LD_AUDIT", "LD_DEBUG_OUTPUT", "DYLD_INSERT_LIBRARIES", "DYLD_LIBRARY_PATH", "DYLD_FRAMEWORK_PATH", "DYLD_FALLBACK_LIBRARY_PATH", "OPENSSL_CONF", "OPENSSL_ENGINES", "OPENSSL_MODULES"];
8
+ /**
9
+ * Return a child env that preserves the launcher's original executable search
10
+ * path and removes pre-entrypoint loader/write hooks. Other operator settings
11
+ * (locale, proxy, custom CA, channel integration) remain backward-compatible.
12
+ */
13
+ export declare function hardenOpencodeAgentNodeEnv(source: NodeJS.ProcessEnv, launcherPath: string | undefined): NodeJS.ProcessEnv;
@@ -0,0 +1,6 @@
1
+ /** Linux user-private-group compatibility for ordinary umask 0002 installs. */
2
+ export declare function opencodeOwnedPathModeIsSafe(stat: {
3
+ uid: number;
4
+ gid: number;
5
+ mode: number | bigint;
6
+ }, runtimeUid?: number | undefined, runtimeGid?: number | undefined): boolean;
@@ -0,0 +1,21 @@
1
+ export interface ValidateOpencodePackageBinaryOptions {
2
+ expectedVersion: string;
3
+ /** A package payload may not be inside, or contain, the current project or
4
+ * node state tree. This rejects project-local same-version impersonators. */
5
+ forbiddenRoots?: readonly string[];
6
+ }
7
+ /** Current cwd plus every enclosing source-workspace boundary. This catches a
8
+ * monorepo root's node_modules when anet is invoked from packages/app. */
9
+ export declare function discoverOpencodeForbiddenRoots(cwd?: string): string[];
10
+ /**
11
+ * Bind an executable to the exact npm `opencode-ai` payload identity.
12
+ *
13
+ * `--version` output alone is not an identity boundary: a checkout can put a
14
+ * same-version credential-stealing shim first on PATH. Only the canonical
15
+ * package entrypoint with matching package metadata and trusted path modes is
16
+ * admitted. The returned path is the one callers must spawn verbatim.
17
+ */
18
+ export declare function validateOpencodePackageBinary(rawBinary: string, options: ValidateOpencodePackageBinaryOptions): string;
19
+ /** Resolve the first *valid package-owned* OpenCode entry on PATH. Invalid
20
+ * project-local shims are skipped so a later trusted global install can win. */
21
+ export declare function resolveOpencodePackageBinaryFromPath(searchPath: string, options: ValidateOpencodePackageBinaryOptions): string;
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * Version this branch was validated against by the maintainers.
3
- * Bumped when a new opencode-ai release passes the manual smoke +
4
- * PR② e2e in a fresh checkout. `readEffectivePin()` still returns
5
- * this when no override file exists.
3
+ * Bumped when a new opencode-ai release passes the full Docker/E2E gate.
6
4
  */
7
- export declare const OPENCODE_BUILTIN_PIN = "1.17.13";
5
+ export declare const OPENCODE_BUILTIN_PIN = "1.18.1";
6
+ /** Exact upstream remediation shared by every CLI failure path. */
7
+ export declare function opencodeExactInstallCommand(version?: string): string;
8
+ /** Preserve package-identity diagnostics while always leaving a missing or
9
+ * untrusted install with an actionable exact-pin command. */
10
+ export declare function formatOpencodePackageIdentityFailure(expectedVersion: string, detail: string): string;
8
11
  /** Where the per-machine override lives. Kept under `~/.anet/` so
9
12
  * it sits next to the other anet-local state. */
10
13
  export declare function opencodePinFilePath(homeDirOverride?: string): string;
@@ -26,10 +29,10 @@ export interface EffectivePin {
26
29
  smokePassedAt?: string;
27
30
  }
28
31
  /**
29
- * Prefer a validated override file when present; otherwise fall
30
- * back to the built-in constant. A malformed override file is
31
- * ignored (built-in wins) we don't want a partially-written
32
- * override to wedge every start.
32
+ * Recognize a validated override only when it records the exact built-in
33
+ * release pin. A different locally-smoked version is deliberately ignored:
34
+ * the lightweight ACP smoke does not replace the maintainer's full security
35
+ * and reply-path gate. Malformed/stale files also fall back to the built-in.
33
36
  */
34
37
  export declare function readEffectivePin(homeDirOverride?: string): EffectivePin;
35
38
  /**
@@ -10,6 +10,17 @@ export interface OpencodePreset {
10
10
  configProviderId: "anthropic" | "openai";
11
11
  }
12
12
  export declare const OPENCODE_PRESETS: OpencodePreset[];
13
+ /**
14
+ * OpenCode tools disabled for the default `opencode-cli` profile.
15
+ *
16
+ * This policy reduces the model's ambient filesystem/shell surface. It is
17
+ * deliberately represented in the generated opencode.json so operators can
18
+ * inspect the default, but it is not an OS security boundary: a same-uid
19
+ * OpenCode process can still read files allowed by normal filesystem ACLs.
20
+ */
21
+ export declare const OPENCODE_DEFAULT_DISABLED_TOOLS: readonly ["bash", "read", "glob", "grep", "edit", "write", "list", "task", "skill", "webfetch", "websearch", "question"];
22
+ export declare function buildOpencodeDefaultToolsPolicy(): Record<string, false>;
23
+ export declare function buildOpencodeDefaultPermissionPolicy(): Record<string, "deny">;
13
24
  export declare function findOpencodePreset(id: string): OpencodePreset | null;
14
25
  /**
15
26
  * Look up the API key for a preset from the current process env.
@@ -22,22 +33,41 @@ export declare function readPresetKeyFromEnv(preset: OpencodePreset, env?: NodeJ
22
33
  /**
23
34
  * opencode.ai's auth.json shape:
24
35
  * { "<providerId>": { "type": "api", "key": "..." } }
25
- * Same shape Phase 0b probes verified against opencode-ai@1.17.13.
36
+ * Same shape verified against the release pin opencode-ai@1.18.1.
26
37
  */
27
38
  export declare function buildAuthJsonBody(preset: OpencodePreset, apiKey: string): string;
39
+ export type OpencodePrivateProfileFilename = "config.json" | ".env";
40
+ /**
41
+ * Establish the boundary before saveProfile/rewritePlainSecrets writes the
42
+ * node token or dotenv key. The expected shape is exactly
43
+ * `<project>/.anet/nodes/<node>`. Every existing path is inspected with
44
+ * lstat + O_NOFOLLOW and inode checks; absent private directories are created
45
+ * one component at a time. A pre-planted node-root/config/.env symlink is a
46
+ * hard error before any secret-bearing write.
47
+ */
48
+ export declare function prepareOpencodeNodeForProfileWrite(nodeWorkDir: string): string;
49
+ export declare function readOpencodePrivateProfileFile(nodeWorkDir: string, filename: OpencodePrivateProfileFilename): string | undefined;
50
+ export declare function writeOpencodePrivateProfileFile(nodeWorkDir: string, filename: OpencodePrivateProfileFilename, body: string): string;
28
51
  /**
29
52
  * Write auth.json into the opencode config root that lives under
30
- * `nodeWorkDir` (which becomes the child's HOME per PR② §8 D5).
31
- * mode 0o600 keeps it operator-only. Directory is created if
32
- * missing.
53
+ * `nodeWorkDir` (the per-node OpenCode data root). mode 0o600 limits
54
+ * filesystem access to the owning OS account; it does not prevent a
55
+ * same-uid OpenCode child from opening the file directly. Directory is
56
+ * created if missing.
33
57
  *
34
58
  * Returns the absolute path we wrote for logging.
35
59
  */
36
60
  export declare function writeOpencodeAuthJson(nodeWorkDir: string, preset: OpencodePreset, apiKey: string): string;
37
61
  /**
38
- * Companion opencode.json: pins the vendor's baseUrl (defaults for
39
- * Anthropic / OpenAI are fine, so this is minimal for now). A
40
- * placeholder so later PRs can push per-node overrides without
41
- * needing to invent the file.
62
+ * New keyless nodes must not inherit a private-but-preplanted credential.
63
+ * Keep the file present as an explicit empty object so the creation log's
64
+ * "auth not configured" statement matches the state OpenCode will consume.
65
+ */
66
+ export declare function clearOpencodeAuthJson(nodeWorkDir: string): string;
67
+ /**
68
+ * Companion opencode.json: records only the selected blessed provider
69
+ * identity and safe-by-default tool policy. Pre-existing model routing and
70
+ * arbitrary OpenCode integrations are stripped; operators may explicitly set
71
+ * a model after creation, which the runtime's separate safe renderer retains.
42
72
  */
43
73
  export declare function writeOpencodeConfigJson(nodeWorkDir: string, preset: OpencodePreset): string;
@@ -0,0 +1,30 @@
1
+ export declare const OPENCODE_RUNTIME_BINDING_SCHEMA_VERSION: 1;
2
+ export declare const OPENCODE_RUNTIME_BINDING_RUNTIME: "opencode-cli";
3
+ export declare const OPENCODE_RUNTIME_BINDINGS_DIRECTORY = "opencode-runtime-bindings";
4
+ export interface OpencodeRuntimeBinding {
5
+ schemaVersion: typeof OPENCODE_RUNTIME_BINDING_SCHEMA_VERSION;
6
+ runtime: typeof OPENCODE_RUNTIME_BINDING_RUNTIME;
7
+ projectRoot: string;
8
+ nodeId: string;
9
+ }
10
+ /** Windows reports synthetic POSIX permission bits; retain all other checks there. */
11
+ export declare function isOpencodeRuntimeBindingModeSecure(mode: number, exactMode?: number, platform?: NodeJS.Platform): boolean;
12
+ /** Resolve the deterministic binding path without creating HOME state. */
13
+ export declare function opencodeRuntimeBindingPath(nodeWorkDir: string, homeDirectory?: string): string;
14
+ /** Persist an external, immutable-by-config record that this node was created as OpenCode. */
15
+ export declare function writeOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): string;
16
+ /** Read and validate a binding. Missing bindings return undefined; unsafe or tampered state throws. */
17
+ export declare function readOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): OpencodeRuntimeBinding | undefined;
18
+ /**
19
+ * Remove only the exact, validated binding for this node. Missing exact state is
20
+ * idempotent; malformed, replaced, or unsafe state always fails closed.
21
+ */
22
+ export declare function removeOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): boolean;
23
+ /** Assert that the external record exists and exactly identifies this node as opencode-cli. */
24
+ export declare function assertExactOpencodeRuntimeBinding(nodeWorkDir: string, homeDirectory?: string): OpencodeRuntimeBinding;
25
+ /**
26
+ * Refuse OpenCode node state committed to a surrounding Git index. A normal
27
+ * non-Git project is allowed. Git is always invoked directly with argv and a
28
+ * literal pathspec; no shell or command interpolation is used.
29
+ */
30
+ export declare function assertOpencodeNodeStateUntracked(nodeWorkDir: string): void;
@@ -0,0 +1,27 @@
1
+ /** Exact 1.18.1 project/instruction discovery surface plus project-root
2
+ * redirects. Any existing entry, including a broken symlink, is a refusal. */
3
+ export declare const OPENCODE_SAFE_ANCESTOR_CANDIDATES: readonly ["opencode.jsonc", "opencode.json", ".opencode", "AGENTS.md", "CLAUDE.md", "CONTEXT.md", ".claude", ".agents", ".git"];
4
+ interface PathIdentity {
5
+ path: string;
6
+ dev: number | bigint;
7
+ ino: number | bigint;
8
+ }
9
+ export interface OpencodeSafeExternalRoot {
10
+ readonly base: string;
11
+ readonly root: string;
12
+ readonly cwd: string;
13
+ readonly dev: number | bigint;
14
+ readonly ino: number | bigint;
15
+ readonly baseDev: number | bigint;
16
+ readonly baseIno: number | bigint;
17
+ readonly ancestors: readonly PathIdentity[];
18
+ }
19
+ export declare function resolveOpencodeTrustedRuntimeBase(explicit?: string): PathIdentity;
20
+ export declare function createOpencodeSafeExternalRoot(options: {
21
+ prefix: string;
22
+ boundaries?: readonly string[];
23
+ base?: string;
24
+ }): OpencodeSafeExternalRoot;
25
+ export declare function revalidateOpencodeSafeExternalRoot(context: OpencodeSafeExternalRoot): void;
26
+ export declare function cleanupOpencodeSafeExternalRoot(context: OpencodeSafeExternalRoot): void;
27
+ export {};
@@ -0,0 +1 @@
1
+ export declare function buildOpencodeSmokeEnv(parentEnv: NodeJS.ProcessEnv, smokeRoot: string, cwd?: string): NodeJS.ProcessEnv;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sleep2agi/agent-network",
3
- "version": "2.3.0-preview.32",
4
- "description": "AI Agent Network CLI — Local-first multi-agent orchestration across 4 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Grok Build ACP) and 8+ LLM providers (Anthropic / OpenAI / xAI Grok / MiniMax / DeepSeek / GLM / Kimi / InternLM / Xiaomi MiMo / OpenRouter). Apache 2.0.",
3
+ "version": "2.3.0-preview.34",
4
+ "description": "AI Agent Network CLI — Local-first multi-agent orchestration across 6 runtimes (Claude Code CLI / Claude Agent SDK / Codex SDK / Codex app-server / Grok Build ACP / OpenCode CLI) and 8+ LLM providers. Apache 2.0.",
5
5
  "type": "module",
6
6
  "main": "dist/src/client.js",
7
7
  "types": "dist/client.d.ts",
@@ -54,7 +54,8 @@
54
54
  "directory": "agent-network"
55
55
  },
56
56
  "publishConfig": {
57
- "access": "public"
57
+ "access": "public",
58
+ "tag": "preview"
58
59
  },
59
60
  "bugs": {
60
61
  "url": "https://github.com/sleep2agi/agent-network/issues"