@sleep2agi/agent-network 2.3.0-preview.26 → 2.3.0-preview.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -9
- package/dist/bin/cli.d.ts +1 -1
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/grok-attach-client.d.ts +115 -0
- package/dist/src/grok-copresence-profile.d.ts +44 -0
- package/dist/src/im/feishu/worker.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/dist/src/normalize-runtime.d.ts +1 -9
- package/dist/src/opencode-agent-node-pair.d.ts +14 -0
- package/dist/src/opencode-auth-login.d.ts +43 -0
- package/dist/src/opencode-launch-env.d.ts +13 -0
- package/dist/src/opencode-owner-mode.d.ts +6 -0
- package/dist/src/opencode-package-binary.d.ts +21 -0
- package/dist/src/opencode-pin.d.ts +6 -1
- package/dist/src/opencode-preset.d.ts +37 -8
- package/dist/src/opencode-safe-root.d.ts +27 -0
- package/dist/src/opencode-smoke-env.d.ts +1 -0
- package/dist/src/runtime-choices.d.ts +15 -0
- package/package.json +7 -3
package/dist/src/node-server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
const a0_0x495e06=a0_0x4a96;(function(_0x1e013b,_0x1e0976){const _0x5d769d=a0_0x4a96,_0x1752e4=_0x1e013b();while(!![]){try{const _0x45fcd0=-parseInt(_0x5d769d(0xb0))/0x1+-parseInt(_0x5d769d(0x86))/0x2*(parseInt(_0x5d769d(0xac))/0x3)+-parseInt(_0x5d769d(0x99))/0x4+-parseInt(_0x5d769d(0xba))/0x5+-parseInt(_0x5d769d(0x9b))/0x6*(-parseInt(_0x5d769d(0xec))/0x7)+-parseInt(_0x5d769d(0xf4))/0x8+-parseInt(_0x5d769d(0x117))/0x9*(-parseInt(_0x5d769d(0xd8))/0xa);if(_0x45fcd0===_0x1e0976)break;else _0x1752e4['push'](_0x1752e4['shift']());}catch(_0x317ec1){_0x1752e4['push'](_0x1752e4['shift']());}}}(a0_0x4896,0xdedbc));import{readFileSync as a0_0x5ac577,existsSync as a0_0x1e080e}from'fs';import{randomUUID as a0_0x5e37c1}from'crypto';function a0_0x4a96(_0x18dae0,_0x1c2b9e){_0x18dae0=_0x18dae0-0x7e;const _0x489648=a0_0x4896();let _0x4a962a=_0x489648[_0x18dae0];return _0x4a962a;}function a0_0x4896(){const _0x4956e8=['Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','tmux\x20display-message\x20-p\x20\x27#S\x27','length','messages','commhub_report_status','result',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','indexOf','high','initialize','task','now','replied','2.0','object','172312Rkuirk','Reply\x20text\x20/\x20result\x20summary','type','parent\x20claude\x20pid=','join','startsWith','Bearer\x20','heartbeat\x20failed:\x20','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','unknown\x20tool','config.json','claude-code','\x20CWD=','Message\x20content','get_inbox','setRequestHandler','Priority\x20(default:\x20normal)','new_message','idle','6669380XsCTEH','connecting\x20to\x20','6078CULIwX','connect','unref','\x20from\x20','priority','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','completed',']\x20[commhub]\x20','data:\x20','SIGTERM','.claude/channels/commhub','re-register\x20failed:\x20','set','MCP\x20stdio\x20connected','find','Progress\x200-100','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','24DCOwyf','parse','\x20PROJECT_ENV=','body','1705992kVEXUS','message','status','delete','cwd','alias','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','failed','getReader','Current\x20task\x20description','4740845aGgDXN','\x22\x20(','replace','.env','ENV:\x20URL=','blocked','notifications/claude/channel','commhub-channel','offline','ready\x20—\x20waiting\x20for\x20events','error','pid','end','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','exit','SSE\x20stream\x20ended,\x20reconnecting...','stdin','\x20priority=','SIGINT','from','POST','cancelled','write','\x20ALIAS=','number','application/json,\x20text/event-stream','Authorization','←\x20message\x20from\x20','warning:\x20could\x20not\x20register:\x20','read','20FlzVUn','normal','split','Task\x20content','then','content','catch','SSE\x20fatal:\x20','(none)','commhub','from_session','message_id','re-registered\x20as\x20\x22','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','SSE\x20connection\x20error:\x20','hub','utf-8','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','no\x20response','commhub_send_message','2569quxnwK','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','min','session\x20disconnected','commhub_reply','unknown','9301896nCAfOf','trim','stderr','slice','SSE\x20error:\x20','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','0.3.0','decode','ESRCH','.anet','\x20RESUME_ID=','/mcp','code','report_status','Target\x20session\x20alias','notification','function','string','working','\x20/\x20hostname=','commhub_get_all_status','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','token','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','text','toTimeString','application/json','registered\x20as\x20\x22','ppid','params','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','parse\x20error:\x20','inbox_count','commhub_send_task','stringify','30215466wkMBAg'];a0_0x4896=function(){return _0x4956e8;};return a0_0x4896();}import{join as a0_0x1cc441}from'path';import{hostname as a0_0x503554}from'os';import{execSync as a0_0x4a4f5f}from'child_process';function B(_0x3e81c2){const _0x5ef63f=a0_0x4a96;let _0x537cce=_0x3e81c2[_0x5ef63f(0xbc)](/[^a-zA-Z0-9\-_]/g,'-');return _0x537cce===''?_0x5ef63f(0xf3):_0x537cce;}import{Server as a0_0x2795f7}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x5490ae}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0x383eac,CallToolRequestSchema as a0_0xc0ab6c}from'@modelcontextprotocol/sdk/types.js';function T(_0x3ce578){const _0x5eaf68=a0_0x4a96;if(!a0_0x1e080e(_0x3ce578))return;for(let _0x3e25fc of a0_0x5ac577(_0x3ce578,_0x5eaf68(0xe8))[_0x5eaf68(0xda)]('\x0a')){let _0x306de0=_0x3e25fc['trim']();if(!_0x306de0||_0x306de0[_0x5eaf68(0x8b)]('#'))continue;let _0x58a501=_0x306de0[_0x5eaf68(0x7e)]('=');if(_0x58a501<0x0)continue;let _0x4ed5ea=_0x306de0[_0x5eaf68(0xf7)](0x0,_0x58a501)[_0x5eaf68(0xf5)](),_0x4c4bb5=_0x306de0['slice'](_0x58a501+0x1)[_0x5eaf68(0xf5)]()[_0x5eaf68(0xbc)](/^["']|["']$/g,'');if(!process.env[_0x4ed5ea])process.env[_0x4ed5ea]=_0x4c4bb5;}}var C=process.env.HOME||'~',r=a0_0x1cc441(C,a0_0x495e06(0xa5));T(a0_0x1cc441(r,a0_0x495e06(0xbd)));var H=B(process[a0_0x495e06(0xb4)]());T(a0_0x1cc441(r,H,'.env'));function E(){const _0x35b67f=a0_0x495e06;try{return a0_0x4a4f5f(_0x35b67f(0x119),{'encoding':'utf-8','timeout':0x7d0})['trim']();}catch{return'';}}function _(){const _0x41bc99=a0_0x495e06;try{let _0x465a98=a0_0x1cc441(C,_0x41bc99(0xfd),_0x41bc99(0x90));if(a0_0x1e080e(_0x465a98))return JSON['parse'](a0_0x5ac577(_0x465a98,_0x41bc99(0xe8)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x495e06(0xe7)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||E();function S(){const _0x33372d=a0_0x495e06;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x33372d(0xf5)]())return process.env.COMMHUB_ALIAS['trim']();return process[_0x33372d(0xf6)][_0x33372d(0xd0)](_0x33372d(0xab)+('would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME='+(j||_0x33372d(0xe0))+_0x33372d(0x107)+a0_0x503554()+_0x33372d(0x8e))),'unattributed-'+process[_0x33372d(0xc5)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x5e37c1(),k=process.env.COMMHUB_TOKEN||R[a0_0x495e06(0x10a)]||'';function z(_0x2c5d22){const _0x5ac8d6=a0_0x495e06;let _0x2c5fec=new Date()[_0x5ac8d6(0x10d)]()['slice'](0x0,0x8);process[_0x5ac8d6(0xf6)]['write']('['+_0x2c5fec+_0x5ac8d6(0xa2)+_0x2c5d22+'\x0a');}function i(_0x3f656b){return new Promise(_0x3e6622=>setTimeout(_0x3e6622,_0x3f656b));}z(a0_0x495e06(0xbe)+Y+a0_0x495e06(0xd1)+p+a0_0x495e06(0xfe)+V['slice'](0x0,0x8)+'...\x20TMUX='+(j||'none')+a0_0x495e06(0x92)+process[a0_0x495e06(0xb4)]()+a0_0x495e06(0xae)+H);var G=new Map(),K=new a0_0x2795f7({'name':a0_0x495e06(0xc1),'version':a0_0x495e06(0xfa)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x495e06(0x112),a0_0x495e06(0xf9),a0_0x495e06(0xc7),a0_0x495e06(0xa0),'Session\x20alias:\x20'+p][a0_0x495e06(0x8a)]('\x0a')});K[a0_0x495e06(0x95)](a0_0x383eac,async()=>({'tools':[{'name':a0_0x495e06(0xf2),'description':a0_0x495e06(0xe5),'inputSchema':{'type':a0_0x495e06(0x85),'properties':{'task_id':{'type':'string','description':a0_0x495e06(0xe9)},'text':{'type':a0_0x495e06(0x105),'description':a0_0x495e06(0x87)},'status':{'type':a0_0x495e06(0x105),'enum':['completed',a0_0x495e06(0xb7),a0_0x495e06(0xcf),'blocked',a0_0x495e06(0xc4),'in_progress'],'description':a0_0x495e06(0xef)}},'required':[a0_0x495e06(0x10c)]}},{'name':a0_0x495e06(0x11c),'description':a0_0x495e06(0x118),'inputSchema':{'type':a0_0x495e06(0x85),'properties':{'status':{'type':'string','enum':[a0_0x495e06(0x106),a0_0x495e06(0x98),a0_0x495e06(0xbf),a0_0x495e06(0xc4)]},'task':{'type':a0_0x495e06(0x105),'description':a0_0x495e06(0xb9)},'progress':{'type':a0_0x495e06(0xd2),'description':a0_0x495e06(0xaa)}},'required':[a0_0x495e06(0xb2)]}},{'name':a0_0x495e06(0x115),'description':'Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','inputSchema':{'type':a0_0x495e06(0x85),'properties':{'alias':{'type':a0_0x495e06(0x105),'description':a0_0x495e06(0x102)},'task':{'type':a0_0x495e06(0x105),'description':a0_0x495e06(0xdb)},'priority':{'type':'string','enum':[a0_0x495e06(0x7f),a0_0x495e06(0xd9),'low'],'description':a0_0x495e06(0x96)}},'required':[a0_0x495e06(0xb5),a0_0x495e06(0x81)]}},{'name':'commhub_send_message','description':a0_0x495e06(0x109),'inputSchema':{'type':a0_0x495e06(0x85),'properties':{'alias':{'type':a0_0x495e06(0x105),'description':a0_0x495e06(0x102)},'message':{'type':'string','description':a0_0x495e06(0x93)}},'required':[a0_0x495e06(0xb5),a0_0x495e06(0xb1)]}},{'name':'commhub_get_all_status','description':a0_0x495e06(0x10b),'inputSchema':{'type':'object','properties':{}}}]}));async function Q(_0x5385d8,_0x11fbf7){const _0x3bae27=a0_0x495e06;let _0x59afde=await fetch(Y+'/mcp',{'method':_0x3bae27(0xce),'headers':{'Content-Type':_0x3bae27(0x10e),'Accept':_0x3bae27(0xd3),...k?{'Authorization':_0x3bae27(0x8c)+k}:{}},'body':JSON[_0x3bae27(0x116)]({'jsonrpc':_0x3bae27(0x84),'id':0x1,'method':_0x3bae27(0x80),'params':{'protocolVersion':'2025-03-26','capabilities':{},'clientInfo':{'name':_0x3bae27(0xc1),'version':'0.3.0'}}})});if(!_0x59afde['ok']){let _0x48eef1=await _0x59afde['text']();return z('CommHub\x20init\x20failed:\x20'+_0x59afde[_0x3bae27(0xb2)]+'\x20'+_0x48eef1[_0x3bae27(0xf7)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0x59afde[_0x3bae27(0xb2)]};}await _0x59afde['text']();let _0xd9c15b=(await(await fetch(Y+_0x3bae27(0xff),{'method':_0x3bae27(0xce),'headers':{'Content-Type':'application/json','Accept':_0x3bae27(0xd3),...k?{'Authorization':_0x3bae27(0x8c)+k}:{}},'body':JSON[_0x3bae27(0x116)]({'jsonrpc':_0x3bae27(0x84),'id':0x2,'method':'tools/call','params':{'name':_0x5385d8,'arguments':_0x11fbf7}})}))[_0x3bae27(0x10c)]())['split']('\x0a')[_0x3bae27(0xa9)](_0x17eba2=>_0x17eba2[_0x3bae27(0x8b)](_0x3bae27(0xa3)));if(_0xd9c15b){let _0x140d1d=JSON[_0x3bae27(0xad)](_0xd9c15b[_0x3bae27(0xf7)](0x6));return _0x140d1d?.[_0x3bae27(0x11d)]?.[_0x3bae27(0xdd)]?.[0x0]?.[_0x3bae27(0x10c)]?JSON[_0x3bae27(0xad)](_0x140d1d[_0x3bae27(0x11d)][_0x3bae27(0xdd)][0x0][_0x3bae27(0x10c)]):_0x140d1d;}return{'ok':!0x1,'error':_0x3bae27(0xea)};}K['setRequestHandler'](a0_0xc0ab6c,async _0x5994a2=>{const _0x42a335=a0_0x495e06;let {name:_0x371a8b,arguments:_0x1ab95a}=_0x5994a2[_0x42a335(0x111)];if(_0x371a8b===_0x42a335(0xf2)){let {task_id:_0x231f2e,text:_0x29e08b,status:_0x53019d}=_0x1ab95a;if(_0x53019d===_0x42a335(0xa1)||_0x53019d==='failed'||_0x53019d===_0x42a335(0xcf)){let _0x32c35e=_0x53019d==='completed'?_0x42a335(0x83):_0x53019d,_0x5be268=_0x231f2e?G['get'](_0x231f2e)||_0x42a335(0xe7):_0x42a335(0xe7),_0x122cc1=await Q('send_reply',{'alias':_0x5be268,'text':_0x29e08b,'in_reply_to':_0x231f2e||void 0x0,'status':_0x32c35e,'from_session':p});if(_0x231f2e)G[_0x42a335(0xb3)](_0x231f2e);return{'content':[{'type':'text','text':JSON['stringify'](_0x122cc1)}]};}let _0x1b83f9=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x53019d==='blocked'?_0x42a335(0xbf):_0x53019d===_0x42a335(0xc4)?_0x42a335(0xc4):_0x42a335(0x106),'task':_0x29e08b[_0x42a335(0xf7)](0x0,0xc8),'output':_0x29e08b});return{'content':[{'type':'text','text':JSON[_0x42a335(0x116)](_0x1b83f9)}]};}if(_0x371a8b===_0x42a335(0x11c)){let {status:_0x3f5fa0,task:_0x38e9a6,progress:_0x1e3261}=_0x1ab95a,_0xc80cfe=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x3f5fa0,'task':_0x38e9a6,'progress':_0x1e3261});return{'content':[{'type':_0x42a335(0x10c),'text':JSON[_0x42a335(0x116)](_0xc80cfe)}]};}if(_0x371a8b===_0x42a335(0x115)){let {alias:_0x76365c,task:_0xbd8635,priority:_0x525d67}=_0x1ab95a,_0x2b971e=await Q('send_task',{'alias':_0x76365c,'task':_0xbd8635,'priority':_0x525d67||_0x42a335(0xd9),'from_session':p});return{'content':[{'type':'text','text':JSON['stringify'](_0x2b971e)}]};}if(_0x371a8b===_0x42a335(0xeb)){let {alias:_0x26a4dd,message:_0x1b2eef}=_0x1ab95a,_0x577adb=await Q('send_message',{'alias':_0x26a4dd,'message':_0x1b2eef,'from_session':p});return{'content':[{'type':_0x42a335(0x10c),'text':JSON[_0x42a335(0x116)](_0x577adb)}]};}if(_0x371a8b===_0x42a335(0x108)){let _0x1b2456=await Q('get_all_status',{});return{'content':[{'type':'text','text':JSON[_0x42a335(0x116)](_0x1b2456)}]};}return{'content':[{'type':_0x42a335(0x10c),'text':JSON['stringify']({'error':_0x42a335(0x8f)})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0xe1bac3=a0_0x495e06;try{await Q('report_status',{'resume_id':V,'alias':p,'status':_0xe1bac3(0x98),'server':a0_0x503554(),'hostname':a0_0x503554(),'agent':_0xe1bac3(0x91),'project_dir':process['cwd'](),'tmux_name':j||void 0x0}),z(_0xe1bac3(0xe4)+p+'\x22\x20after\x20SSE\x20reconnect');}catch(_0x248998){z(_0xe1bac3(0xa6)+_0x248998);}}async function l(){const _0x31ef1b=a0_0x495e06;let _0xd716ca=Y+'/events/'+encodeURIComponent(p),_0x34b3ba={};if(k)_0x34b3ba[_0x31ef1b(0xd4)]=_0x31ef1b(0x8c)+k;z(_0x31ef1b(0x9a)+_0xd716ca);let _0x361ea5=D,_0x2b049a=!0x0,_0x45445d=null;while(!0x0){try{let _0x40cf03=await fetch(_0xd716ca,{'headers':_0x34b3ba});if(!_0x40cf03['ok']){if(z(_0x31ef1b(0xf8)+_0x40cf03[_0x31ef1b(0xb2)]+'\x20'+_0x40cf03['statusText']),_0x45445d=_0x45445d??Date[_0x31ef1b(0x82)](),Date[_0x31ef1b(0x82)]()-_0x45445d>O){z(_0x31ef1b(0xed)+Y+_0x31ef1b(0x11e));return;}await i(_0x361ea5),_0x361ea5=Math[_0x31ef1b(0xf0)](_0x361ea5*0x2,v);continue;}let _0x2cbc27=_0x40cf03[_0x31ef1b(0xaf)][_0x31ef1b(0xb8)](),_0x3414ad=new TextDecoder(),_0x360e2d='';_0x361ea5=D;while(!0x0){let {done:_0x5d87a9,value:_0x4201f2}=await _0x2cbc27[_0x31ef1b(0xd7)]();if(_0x5d87a9)break;_0x360e2d+=_0x3414ad[_0x31ef1b(0xfb)](_0x4201f2,{'stream':!0x0});let _0x555f2e=_0x360e2d['split']('\x0a\x0a');_0x360e2d=_0x555f2e['pop']()||'';for(let _0x2e6e52 of _0x555f2e){let _0xc94afa=_0x2e6e52[_0x31ef1b(0xda)]('\x0a')[_0x31ef1b(0xa9)](_0x1a61fd=>_0x1a61fd[_0x31ef1b(0x8b)]('data:\x20'));if(!_0xc94afa)continue;try{let _0x4e6d3d=JSON[_0x31ef1b(0xad)](_0xc94afa[_0x31ef1b(0xf7)](0x6));if(await A(_0x4e6d3d),_0x4e6d3d[_0x31ef1b(0x88)]==='connected'){if(_0x45445d=null,!_0x2b049a)await m();_0x2b049a=!0x1;}}catch(_0xa3bed0){z(_0x31ef1b(0x113)+_0xa3bed0);}}}z(_0x31ef1b(0xc9));}catch(_0x520192){z(_0x31ef1b(0xe6)+_0x520192);}if(_0x45445d=_0x45445d??Date[_0x31ef1b(0x82)](),Date[_0x31ef1b(0x82)]()-_0x45445d>O){z(_0x31ef1b(0xed)+Y+_0x31ef1b(0x11e));return;}await i(_0x361ea5),_0x361ea5=Math[_0x31ef1b(0xf0)](_0x361ea5*0x2,v);}}async function A(_0x42b582){const _0x45e28a=a0_0x495e06;if(_0x42b582[_0x45e28a(0x88)]==='connected'){z('SSE\x20connected\x20as\x20\x22'+p+'\x22');return;}if(_0x42b582[_0x45e28a(0x88)]===_0x45e28a(0x97)){if(z(_0x45e28a(0xd5)+_0x42b582['from']+':\x20'+_0x42b582[_0x45e28a(0xb1)][_0x45e28a(0xf7)](0x0,0x3c)),await K[_0x45e28a(0x103)]({'method':'notifications/claude/channel','params':{'content':_0x42b582['message'],'meta':{'sender':_0x42b582[_0x45e28a(0xcd)]||_0x45e28a(0xe7),'sender_id':'commhub','user':_0x42b582[_0x45e28a(0xcd)]||_0x45e28a(0xe7),'priority':_0x45e28a(0xd9)}}}),_0x42b582[_0x45e28a(0xe3)])await Q('ack_inbox',{'alias':p,'message_id':_0x42b582[_0x45e28a(0xe3)]});return;}if(_0x42b582['type']==='new_task'||_0x42b582[_0x45e28a(0x88)]==='broadcast'){z('←\x20'+_0x42b582['type']+':\x20inbox_count='+_0x42b582[_0x45e28a(0x114)]+_0x45e28a(0xcb)+(_0x42b582[_0x45e28a(0x9f)]||_0x45e28a(0xd9)));let _0x37b66b=await Q(_0x45e28a(0x94),{'alias':p,'limit':0x5});if(_0x37b66b?.['ok']&&_0x37b66b['messages']?.[_0x45e28a(0x11a)]>0x0)for(let _0x1cd58f of _0x37b66b[_0x45e28a(0x11b)]){let _0x2e0be6={'sender':_0x1cd58f[_0x45e28a(0xe2)]||_0x45e28a(0xe7),'sender_id':_0x45e28a(0xe1),'user':_0x1cd58f[_0x45e28a(0xe2)]||_0x45e28a(0xe7),'task_id':_0x1cd58f['id'],'priority':_0x1cd58f[_0x45e28a(0x9f)]||_0x45e28a(0xd9)};G[_0x45e28a(0xa7)](_0x1cd58f['id'],_0x1cd58f[_0x45e28a(0xe2)]||_0x45e28a(0xe7)),await K[_0x45e28a(0x103)]({'method':_0x45e28a(0xc0),'params':{'content':_0x1cd58f[_0x45e28a(0xdd)],'meta':_0x2e0be6}}),z('→\x20injected\x20task\x20'+_0x1cd58f['id'][_0x45e28a(0xf7)](0x0,0x8)+_0x45e28a(0x9e)+_0x1cd58f[_0x45e28a(0xe2)]+':\x20'+_0x1cd58f[_0x45e28a(0xdd)][_0x45e28a(0xf7)](0x0,0x3c)),await Q('ack_inbox',{'alias':p,'message_id':_0x1cd58f['id']});}}}async function t(){const _0x265203=a0_0x495e06;let _0x5f1c55=new a0_0x5490ae();await K[_0x265203(0x9c)](_0x5f1c55),z(_0x265203(0xa8)),z('starting\x20SSE\x20listener...'),l()['catch'](_0x5aabd8=>z(_0x265203(0xdf)+_0x5aabd8)),Q('report_status',{'resume_id':V,'alias':p,'status':_0x265203(0x98),'server':a0_0x503554(),'hostname':a0_0x503554(),'agent':_0x265203(0x91),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})[_0x265203(0xdc)](()=>z(_0x265203(0x10f)+p+_0x265203(0xbb)+V[_0x265203(0xf7)](0x0,0x8)+')'))[_0x265203(0xde)](_0x4abe0a=>z(_0x265203(0xd6)+_0x4abe0a)),setInterval(()=>{const _0xa6404c=_0x265203;Q(_0xa6404c(0x101),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x503554(),'hostname':a0_0x503554(),'agent':'claude-code','project_dir':process[_0xa6404c(0xb4)](),'tmux_name':j||void 0x0})[_0xa6404c(0xde)](_0x23e569=>z(_0xa6404c(0x8d)+_0x23e569));},0x2bf20),z(_0x265203(0xc3));}t()[a0_0x495e06(0xde)](_0x43922f=>{const _0x2431fb=a0_0x495e06;z('fatal:\x20'+_0x43922f),process[_0x2431fb(0xc8)](0x1);});async function b(){const _0x451cb3=a0_0x495e06;z('shutting\x20down,\x20reporting\x20offline...'),await Q('report_status',{'resume_id':V,'alias':p,'status':_0x451cb3(0xc2),'task':_0x451cb3(0xf1)})[_0x451cb3(0xde)](()=>{}),process['exit'](0x0);}process[a0_0x495e06(0xca)]['on'](a0_0x495e06(0xc6),()=>b()),process['on'](a0_0x495e06(0xa4),()=>b()),process['on'](a0_0x495e06(0xcc),()=>b());var d=process[a0_0x495e06(0x110)];if(d&&d>0x1){let h=setInterval(()=>{const _0x4b229e=a0_0x495e06;if(process[_0x4b229e(0x110)]===0x1&&d!==0x1){z('parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20'+d+_0x4b229e(0xee)),b();return;}try{process['kill'](d,0x0);}catch(_0x54ee5f){if(_0x54ee5f?.[_0x4b229e(0x100)]===_0x4b229e(0xfc))z(_0x4b229e(0x89)+d+_0x4b229e(0xb6)),b();}},0x7530);if(typeof h[a0_0x495e06(0x9d)]===a0_0x495e06(0x104))h[a0_0x495e06(0x9d)]();}
|
|
2
|
+
const a0_0x53cab8=a0_0x56c5;(function(_0x44c8c0,_0x3e595d){const _0x814fea=a0_0x56c5,_0x2e16d2=_0x44c8c0();while(!![]){try{const _0x437f8a=-parseInt(_0x814fea(0x107))/0x1*(-parseInt(_0x814fea(0x106))/0x2)+parseInt(_0x814fea(0x124))/0x3+-parseInt(_0x814fea(0x174))/0x4+parseInt(_0x814fea(0x10a))/0x5+parseInt(_0x814fea(0x142))/0x6+-parseInt(_0x814fea(0xf8))/0x7*(-parseInt(_0x814fea(0x10d))/0x8)+-parseInt(_0x814fea(0x156))/0x9;if(_0x437f8a===_0x3e595d)break;else _0x2e16d2['push'](_0x2e16d2['shift']());}catch(_0x58502f){_0x2e16d2['push'](_0x2e16d2['shift']());}}}(a0_0x2481,0xd3ae3));import{readFileSync as a0_0x4429aa,existsSync as a0_0x1cefb3}from'fs';import{randomUUID as a0_0x19a542}from'crypto';import{join as a0_0xd5ed86}from'path';import{hostname as a0_0x16a31b}from'os';import{execSync as a0_0x4cfe2a}from'child_process';function a0_0x56c5(_0xe1292f,_0x2f110f){_0xe1292f=_0xe1292f-0xeb;const _0x24819a=a0_0x2481();let _0x56c53c=_0x24819a[_0xe1292f];return _0x56c53c;}function B(_0x122956){let _0xf684e7=_0x122956['replace'](/[^a-zA-Z0-9\-_]/g,'-');return _0xf684e7===''?'unknown':_0xf684e7;}import{Server as a0_0x3a585f}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x52ce92}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xd1d407,CallToolRequestSchema as a0_0x2c9c1d}from'@modelcontextprotocol/sdk/types.js';function T(_0x56cb20){const _0x467cb9=a0_0x56c5;if(!a0_0x1cefb3(_0x56cb20))return;for(let _0x2dd8f9 of a0_0x4429aa(_0x56cb20,'utf-8')['split']('\x0a')){let _0x53f76f=_0x2dd8f9[_0x467cb9(0xed)]();if(!_0x53f76f||_0x53f76f[_0x467cb9(0x17e)]('#'))continue;let _0x343f00=_0x53f76f['indexOf']('=');if(_0x343f00<0x0)continue;let _0x1dd33c=_0x53f76f[_0x467cb9(0x182)](0x0,_0x343f00)[_0x467cb9(0xed)](),_0x328260=_0x53f76f[_0x467cb9(0x182)](_0x343f00+0x1)[_0x467cb9(0xed)]()['replace'](/^["']|["']$/g,'');if(!process.env[_0x1dd33c])process.env[_0x1dd33c]=_0x328260;}}function a0_0x2481(){const _0x5b948f=['startsWith','failed','connected','utf-8','slice','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','send_reply','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','error','application/json','toTimeString','completed','ESRCH','parse','0.3.0','trim','warning:\x20could\x20not\x20register:\x20','length','get_all_status','\x20/\x20hostname=','type',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','Progress\x200-100','read','broadcast','object','467397Ktrwxv','end','MCP\x20stdio\x20connected','min','/events/','ready\x20—\x20waiting\x20for\x20events','SSE\x20fatal:\x20','Messages\x20from\x20CommHub\x20arrive\x20as\x20<channel\x20source=\x22commhub\x22\x20task_id=\x22...\x22\x20priority=\x22...\x22\x20from=\x22...\x22>','messages','.env','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','none','Target\x20session\x20alias','\x20CWD=','502954DGhsBO','4wWQZeV','Reply\x20text\x20/\x20result\x20summary','priority','3321965qlnBEb','from','result','192zXzMjG','commhub_reply','data:\x20','application/json,\x20text/event-stream','stringify','params','hub','in_progress','task','unknown\x20tool',':\x20inbox_count=','tools/call','status','registered\x20as\x20\x22','decode','ppid','Priority\x20(default:\x20normal)','Current\x20task\x20description','Authorization','get_inbox','SSE\x20connected\x20as\x20\x22','write','blocked','3721278yhykTc','token','message','pop','2025-03-26','unref','split','config.json','The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','now','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','no\x20response','low','connect','function','cancelled','content','inbox_count','claude-code','working','\x20from\x20','commhub_report_status','heartbeat\x20failed:\x20','set','Task\x20content','re-register\x20failed:\x20','SSE\x20connection\x20error:\x20','8183946ZchHue','number','\x22\x20after\x20SSE\x20reconnect','idle','commhub_send_task','report_status','send_message','commhub','statusText','parent\x20claude\x20pid=','getReader','body','delete','normal','text','new_task','Message\x20content','init\x20failed:\x20','stdin','SIGINT','43684893EdnmBr','Session\x20alias:\x20','setRequestHandler','SSE\x20error:\x20','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','from_session','(none)','session\x20disconnected','commhub_send_message','new_message','then','connecting\x20to\x20','message_id','get','string','unattributed-','CommHub\x20init\x20failed:\x20','\x20priority=','commhub-channel','catch','POST','SSE\x20stream\x20ended,\x20reconnecting...','notifications/claude/channel','find','2.0','.claude/channels/commhub','cwd',']\x20[commhub]\x20','high','code','625208vByHRA','alias','exit','SIGTERM','http://127.0.0.1:9200','commhub_get_all_status','starting\x20SSE\x20listener...','←\x20message\x20from\x20','.anet','notification'];a0_0x2481=function(){return _0x5b948f;};return a0_0x2481();}var C=process.env.HOME||'~',r=a0_0xd5ed86(C,a0_0x53cab8(0x16f));T(a0_0xd5ed86(r,'.env'));var H=B(process[a0_0x53cab8(0x170)]());T(a0_0xd5ed86(r,H,a0_0x53cab8(0x101)));function E(){const _0x406752=a0_0x53cab8;try{return a0_0x4cfe2a('tmux\x20display-message\x20-p\x20\x27#S\x27',{'encoding':_0x406752(0x181),'timeout':0x7d0})['trim']();}catch{return'';}}function _(){const _0x310b2c=a0_0x53cab8;try{let _0x7eaa8e=a0_0xd5ed86(C,_0x310b2c(0x17c),_0x310b2c(0x12b));if(a0_0x1cefb3(_0x7eaa8e))return JSON[_0x310b2c(0xeb)](a0_0x4429aa(_0x7eaa8e,_0x310b2c(0x181)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x53cab8(0x113)]||a0_0x53cab8(0x178),j=process.env.COMMHUB_TMUX||E();function S(){const _0x321ef9=a0_0x53cab8;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x321ef9(0xed)]())return process.env.COMMHUB_ALIAS[_0x321ef9(0xed)]();return process['stderr']['write']('[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20'+(_0x321ef9(0x12e)+(j||_0x321ef9(0x15c))+_0x321ef9(0xf1)+a0_0x16a31b()+_0x321ef9(0x12f))),_0x321ef9(0x165)+process['pid'];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x19a542(),k=process.env.COMMHUB_TOKEN||R[a0_0x53cab8(0x125)]||'';function z(_0x4b3b12){const _0x55e715=a0_0x53cab8;let _0x43e8d8=new Date()[_0x55e715(0x189)]()[_0x55e715(0x182)](0x0,0x8);process['stderr'][_0x55e715(0x122)]('['+_0x43e8d8+_0x55e715(0x171)+_0x4b3b12+'\x0a');}function i(_0x5edcd1){return new Promise(_0x48cecb=>setTimeout(_0x48cecb,_0x5edcd1));}z('ENV:\x20URL='+Y+'\x20ALIAS='+p+'\x20RESUME_ID='+V['slice'](0x0,0x8)+'...\x20TMUX='+(j||a0_0x53cab8(0x103))+a0_0x53cab8(0x105)+process[a0_0x53cab8(0x170)]()+'\x20PROJECT_ENV='+H);var G=new Map(),K=new a0_0x3a585f({'name':a0_0x53cab8(0x168),'version':a0_0x53cab8(0xec)},{'capabilities':{'experimental':{'claude/channel':{}},'tools':{}},'instructions':[a0_0x53cab8(0xff),'These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.',a0_0x53cab8(0x184),a0_0x53cab8(0x102),a0_0x53cab8(0x157)+p]['join']('\x0a')});K[a0_0x53cab8(0x158)](a0_0xd1d407,async()=>({'tools':[{'name':a0_0x53cab8(0x10e),'description':'Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','inputSchema':{'type':a0_0x53cab8(0xf7),'properties':{'task_id':{'type':a0_0x53cab8(0x164),'description':a0_0x53cab8(0x12c)},'text':{'type':a0_0x53cab8(0x164),'description':a0_0x53cab8(0x108)},'status':{'type':a0_0x53cab8(0x164),'enum':[a0_0x53cab8(0x18a),a0_0x53cab8(0x17f),a0_0x53cab8(0x136),'blocked',a0_0x53cab8(0x187),a0_0x53cab8(0x114)],'description':a0_0x53cab8(0x15a)}},'required':[a0_0x53cab8(0x150)]}},{'name':a0_0x53cab8(0x13c),'description':a0_0x53cab8(0x186),'inputSchema':{'type':'object','properties':{'status':{'type':a0_0x53cab8(0x164),'enum':[a0_0x53cab8(0x13a),a0_0x53cab8(0x145),a0_0x53cab8(0x123),a0_0x53cab8(0x187)]},'task':{'type':'string','description':a0_0x53cab8(0x11e)},'progress':{'type':a0_0x53cab8(0x143),'description':a0_0x53cab8(0xf4)}},'required':[a0_0x53cab8(0x119)]}},{'name':a0_0x53cab8(0x146),'description':a0_0x53cab8(0x12d),'inputSchema':{'type':a0_0x53cab8(0xf7),'properties':{'alias':{'type':a0_0x53cab8(0x164),'description':a0_0x53cab8(0x104)},'task':{'type':a0_0x53cab8(0x164),'description':a0_0x53cab8(0x13f)},'priority':{'type':a0_0x53cab8(0x164),'enum':[a0_0x53cab8(0x172),a0_0x53cab8(0x14f),a0_0x53cab8(0x133)],'description':a0_0x53cab8(0x11d)}},'required':['alias',a0_0x53cab8(0x115)]}},{'name':a0_0x53cab8(0x15e),'description':'Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','inputSchema':{'type':a0_0x53cab8(0xf7),'properties':{'alias':{'type':a0_0x53cab8(0x164),'description':a0_0x53cab8(0x104)},'message':{'type':a0_0x53cab8(0x164),'description':a0_0x53cab8(0x152)}},'required':[a0_0x53cab8(0x175),a0_0x53cab8(0x126)]}},{'name':a0_0x53cab8(0x179),'description':a0_0x53cab8(0x131),'inputSchema':{'type':a0_0x53cab8(0xf7),'properties':{}}}]}));async function Q(_0x1a9e77,_0x99f2b1){const _0xc5d447=a0_0x53cab8;let _0x1be83a=await fetch(Y+'/mcp',{'method':_0xc5d447(0x16a),'headers':{'Content-Type':_0xc5d447(0x188),'Accept':_0xc5d447(0x110),...k?{'Authorization':'Bearer\x20'+k}:{}},'body':JSON[_0xc5d447(0x111)]({'jsonrpc':_0xc5d447(0x16e),'id':0x1,'method':'initialize','params':{'protocolVersion':_0xc5d447(0x128),'capabilities':{},'clientInfo':{'name':_0xc5d447(0x168),'version':'0.3.0'}}})});if(!_0x1be83a['ok']){let _0x18d8fb=await _0x1be83a[_0xc5d447(0x150)]();return z(_0xc5d447(0x166)+_0x1be83a[_0xc5d447(0x119)]+'\x20'+_0x18d8fb[_0xc5d447(0x182)](0x0,0x64)),{'ok':!0x1,'error':_0xc5d447(0x153)+_0x1be83a[_0xc5d447(0x119)]};}await _0x1be83a[_0xc5d447(0x150)]();let _0x15398c=(await(await fetch(Y+'/mcp',{'method':_0xc5d447(0x16a),'headers':{'Content-Type':_0xc5d447(0x188),'Accept':_0xc5d447(0x110),...k?{'Authorization':'Bearer\x20'+k}:{}},'body':JSON[_0xc5d447(0x111)]({'jsonrpc':_0xc5d447(0x16e),'id':0x2,'method':_0xc5d447(0x118),'params':{'name':_0x1a9e77,'arguments':_0x99f2b1}})}))[_0xc5d447(0x150)]())[_0xc5d447(0x12a)]('\x0a')[_0xc5d447(0x16d)](_0x5dd473=>_0x5dd473['startsWith'](_0xc5d447(0x10f)));if(_0x15398c){let _0x46e998=JSON[_0xc5d447(0xeb)](_0x15398c[_0xc5d447(0x182)](0x6));return _0x46e998?.[_0xc5d447(0x10c)]?.[_0xc5d447(0x137)]?.[0x0]?.[_0xc5d447(0x150)]?JSON[_0xc5d447(0xeb)](_0x46e998['result']['content'][0x0][_0xc5d447(0x150)]):_0x46e998;}return{'ok':!0x1,'error':_0xc5d447(0x132)};}K[a0_0x53cab8(0x158)](a0_0x2c9c1d,async _0x47c5ab=>{const _0x5ab68b=a0_0x53cab8;let {name:_0x3a3a4c,arguments:_0x5eff6d}=_0x47c5ab[_0x5ab68b(0x112)];if(_0x3a3a4c===_0x5ab68b(0x10e)){let {task_id:_0x25359a,text:_0x22ae0c,status:_0x422d18}=_0x5eff6d;if(_0x422d18==='completed'||_0x422d18===_0x5ab68b(0x17f)||_0x422d18==='cancelled'){let _0xf3083b=_0x422d18===_0x5ab68b(0x18a)?'replied':_0x422d18,_0x4dd758=_0x25359a?G[_0x5ab68b(0x163)](_0x25359a)||_0x5ab68b(0x113):_0x5ab68b(0x113),_0x45b097=await Q(_0x5ab68b(0x185),{'alias':_0x4dd758,'text':_0x22ae0c,'in_reply_to':_0x25359a||void 0x0,'status':_0xf3083b,'from_session':p});if(_0x25359a)G[_0x5ab68b(0x14e)](_0x25359a);return{'content':[{'type':_0x5ab68b(0x150),'text':JSON[_0x5ab68b(0x111)](_0x45b097)}]};}let _0x3a666c=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x422d18==='blocked'?_0x5ab68b(0x123):_0x422d18===_0x5ab68b(0x187)?'error':_0x5ab68b(0x13a),'task':_0x22ae0c[_0x5ab68b(0x182)](0x0,0xc8),'output':_0x22ae0c});return{'content':[{'type':'text','text':JSON[_0x5ab68b(0x111)](_0x3a666c)}]};}if(_0x3a3a4c===_0x5ab68b(0x13c)){let {status:_0x4cd566,task:_0x1fb2ad,progress:_0x2f632e}=_0x5eff6d,_0xd28ba9=await Q(_0x5ab68b(0x147),{'resume_id':V,'alias':p,'status':_0x4cd566,'task':_0x1fb2ad,'progress':_0x2f632e});return{'content':[{'type':'text','text':JSON['stringify'](_0xd28ba9)}]};}if(_0x3a3a4c===_0x5ab68b(0x146)){let {alias:_0x10c417,task:_0x3ba73f,priority:_0x35dc23}=_0x5eff6d,_0x1c4c1c=await Q('send_task',{'alias':_0x10c417,'task':_0x3ba73f,'priority':_0x35dc23||'normal','from_session':p});return{'content':[{'type':_0x5ab68b(0x150),'text':JSON[_0x5ab68b(0x111)](_0x1c4c1c)}]};}if(_0x3a3a4c===_0x5ab68b(0x15e)){let {alias:_0x5a2b26,message:_0x2168ea}=_0x5eff6d,_0x414eb4=await Q(_0x5ab68b(0x148),{'alias':_0x5a2b26,'message':_0x2168ea,'from_session':p});return{'content':[{'type':_0x5ab68b(0x150),'text':JSON['stringify'](_0x414eb4)}]};}if(_0x3a3a4c==='commhub_get_all_status'){let _0x377a59=await Q(_0x5ab68b(0xf0),{});return{'content':[{'type':'text','text':JSON['stringify'](_0x377a59)}]};}return{'content':[{'type':'text','text':JSON[_0x5ab68b(0x111)]({'error':_0x5ab68b(0x116)})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0xda9c05=a0_0x53cab8;try{await Q(_0xda9c05(0x147),{'resume_id':V,'alias':p,'status':_0xda9c05(0x145),'server':a0_0x16a31b(),'hostname':a0_0x16a31b(),'agent':_0xda9c05(0x139),'project_dir':process[_0xda9c05(0x170)](),'tmux_name':j||void 0x0}),z('re-registered\x20as\x20\x22'+p+_0xda9c05(0x144));}catch(_0x49c2ba){z(_0xda9c05(0x140)+_0x49c2ba);}}async function l(){const _0x2b35b5=a0_0x53cab8;let _0x5e83dd=Y+_0x2b35b5(0xfc)+encodeURIComponent(p),_0x3b8dba={};if(k)_0x3b8dba[_0x2b35b5(0x11f)]='Bearer\x20'+k;z(_0x2b35b5(0x161)+_0x5e83dd);let _0x545750=D,_0x27f339=!0x0,_0x2370d3=null;while(!0x0){try{let _0x2c5e75=await fetch(_0x5e83dd,{'headers':_0x3b8dba});if(!_0x2c5e75['ok']){if(z(_0x2b35b5(0x159)+_0x2c5e75[_0x2b35b5(0x119)]+'\x20'+_0x2c5e75[_0x2b35b5(0x14a)]),_0x2370d3=_0x2370d3??Date[_0x2b35b5(0x130)](),Date['now']()-_0x2370d3>O){z(_0x2b35b5(0x183)+Y+_0x2b35b5(0xf3));return;}await i(_0x545750),_0x545750=Math[_0x2b35b5(0xfb)](_0x545750*0x2,v);continue;}let _0x35a63d=_0x2c5e75[_0x2b35b5(0x14d)][_0x2b35b5(0x14c)](),_0x5bff21=new TextDecoder(),_0x4df713='';_0x545750=D;while(!0x0){let {done:_0xfd2f1,value:_0x57d1ae}=await _0x35a63d[_0x2b35b5(0xf5)]();if(_0xfd2f1)break;_0x4df713+=_0x5bff21[_0x2b35b5(0x11b)](_0x57d1ae,{'stream':!0x0});let _0xa8f5d9=_0x4df713[_0x2b35b5(0x12a)]('\x0a\x0a');_0x4df713=_0xa8f5d9[_0x2b35b5(0x127)]()||'';for(let _0x1d6081 of _0xa8f5d9){let _0x2d24a5=_0x1d6081['split']('\x0a')[_0x2b35b5(0x16d)](_0x18de99=>_0x18de99[_0x2b35b5(0x17e)]('data:\x20'));if(!_0x2d24a5)continue;try{let _0x1f417d=JSON['parse'](_0x2d24a5['slice'](0x6));if(await A(_0x1f417d),_0x1f417d['type']===_0x2b35b5(0x180)){if(_0x2370d3=null,!_0x27f339)await m();_0x27f339=!0x1;}}catch(_0x98112b){z('parse\x20error:\x20'+_0x98112b);}}}z(_0x2b35b5(0x16b));}catch(_0x1acf2a){z(_0x2b35b5(0x141)+_0x1acf2a);}if(_0x2370d3=_0x2370d3??Date[_0x2b35b5(0x130)](),Date[_0x2b35b5(0x130)]()-_0x2370d3>O){z(_0x2b35b5(0x183)+Y+_0x2b35b5(0xf3));return;}await i(_0x545750),_0x545750=Math[_0x2b35b5(0xfb)](_0x545750*0x2,v);}}async function A(_0x5c5f58){const _0x43d6ae=a0_0x53cab8;if(_0x5c5f58[_0x43d6ae(0xf2)]===_0x43d6ae(0x180)){z(_0x43d6ae(0x121)+p+'\x22');return;}if(_0x5c5f58[_0x43d6ae(0xf2)]===_0x43d6ae(0x15f)){if(z(_0x43d6ae(0x17b)+_0x5c5f58[_0x43d6ae(0x10b)]+':\x20'+_0x5c5f58[_0x43d6ae(0x126)][_0x43d6ae(0x182)](0x0,0x3c)),await K[_0x43d6ae(0x17d)]({'method':_0x43d6ae(0x16c),'params':{'content':_0x5c5f58[_0x43d6ae(0x126)],'meta':{'sender':_0x5c5f58[_0x43d6ae(0x10b)]||_0x43d6ae(0x113),'sender_id':'commhub','user':_0x5c5f58['from']||_0x43d6ae(0x113),'priority':_0x43d6ae(0x14f)}}}),_0x5c5f58[_0x43d6ae(0x162)])await Q('ack_inbox',{'alias':p,'message_id':_0x5c5f58[_0x43d6ae(0x162)]});return;}if(_0x5c5f58[_0x43d6ae(0xf2)]===_0x43d6ae(0x151)||_0x5c5f58[_0x43d6ae(0xf2)]===_0x43d6ae(0xf6)){z('←\x20'+_0x5c5f58[_0x43d6ae(0xf2)]+_0x43d6ae(0x117)+_0x5c5f58[_0x43d6ae(0x138)]+_0x43d6ae(0x167)+(_0x5c5f58[_0x43d6ae(0x109)]||_0x43d6ae(0x14f)));let _0x46221e=await Q(_0x43d6ae(0x120),{'alias':p,'limit':0x5});if(_0x46221e?.['ok']&&_0x46221e[_0x43d6ae(0x100)]?.[_0x43d6ae(0xef)]>0x0)for(let _0x36d79f of _0x46221e[_0x43d6ae(0x100)]){let _0x41bd13={'sender':_0x36d79f[_0x43d6ae(0x15b)]||_0x43d6ae(0x113),'sender_id':_0x43d6ae(0x149),'user':_0x36d79f['from_session']||_0x43d6ae(0x113),'task_id':_0x36d79f['id'],'priority':_0x36d79f[_0x43d6ae(0x109)]||'normal'};G[_0x43d6ae(0x13e)](_0x36d79f['id'],_0x36d79f[_0x43d6ae(0x15b)]||_0x43d6ae(0x113)),await K[_0x43d6ae(0x17d)]({'method':'notifications/claude/channel','params':{'content':_0x36d79f[_0x43d6ae(0x137)],'meta':_0x41bd13}}),z('→\x20injected\x20task\x20'+_0x36d79f['id'][_0x43d6ae(0x182)](0x0,0x8)+_0x43d6ae(0x13b)+_0x36d79f[_0x43d6ae(0x15b)]+':\x20'+_0x36d79f['content'][_0x43d6ae(0x182)](0x0,0x3c)),await Q('ack_inbox',{'alias':p,'message_id':_0x36d79f['id']});}}}async function t(){const _0x344229=a0_0x53cab8;let _0x50a8db=new a0_0x52ce92();await K[_0x344229(0x134)](_0x50a8db),z(_0x344229(0xfa)),z(_0x344229(0x17a)),l()[_0x344229(0x169)](_0x17aa74=>z(_0x344229(0xfe)+_0x17aa74)),Q(_0x344229(0x147),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x16a31b(),'hostname':a0_0x16a31b(),'agent':_0x344229(0x139),'project_dir':process[_0x344229(0x170)](),'tmux_name':j||void 0x0})[_0x344229(0x160)](()=>z(_0x344229(0x11a)+p+'\x22\x20('+V[_0x344229(0x182)](0x0,0x8)+')'))[_0x344229(0x169)](_0x3e42b3=>z(_0x344229(0xee)+_0x3e42b3)),setInterval(()=>{const _0x56718e=_0x344229;Q(_0x56718e(0x147),{'resume_id':V,'alias':p,'status':'idle','server':a0_0x16a31b(),'hostname':a0_0x16a31b(),'agent':_0x56718e(0x139),'project_dir':process['cwd'](),'tmux_name':j||void 0x0})['catch'](_0x1e8e89=>z(_0x56718e(0x13d)+_0x1e8e89));},0x2bf20),z(_0x344229(0xfd));}t()[a0_0x53cab8(0x169)](_0x215b98=>{const _0x59b512=a0_0x53cab8;z('fatal:\x20'+_0x215b98),process[_0x59b512(0x176)](0x1);});async function b(){const _0x12edcd=a0_0x53cab8;z('shutting\x20down,\x20reporting\x20offline...'),await Q(_0x12edcd(0x147),{'resume_id':V,'alias':p,'status':'offline','task':_0x12edcd(0x15d)})['catch'](()=>{}),process['exit'](0x0);}process[a0_0x53cab8(0x154)]['on'](a0_0x53cab8(0xf9),()=>b()),process['on'](a0_0x53cab8(0x177),()=>b()),process['on'](a0_0x53cab8(0x155),()=>b());var d=process[a0_0x53cab8(0x11c)];if(d&&d>0x1){let h=setInterval(()=>{const _0x869c16=a0_0x53cab8;if(process[_0x869c16(0x11c)]===0x1&&d!==0x1){z('parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20'+d+')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat'),b();return;}try{process['kill'](d,0x0);}catch(_0x51f5f7){if(_0x51f5f7?.[_0x869c16(0x173)]===_0x869c16(0x18b))z(_0x869c16(0x14b)+d+'\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat'),b();}},0x7530);if(typeof h[a0_0x53cab8(0x129)]===a0_0x53cab8(0x135))h[a0_0x53cab8(0x129)]();}
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "opencode-cli" | "codex-app-server";
|
|
1
|
+
export type RuntimeName = "claude-code-cli" | "codex-sdk" | "claude-agent-sdk" | "grok-build-acp" | "grok-build-cli" | "opencode-cli" | "codex-app-server";
|
|
2
2
|
/** Operator-facing default for any runtime slot that comes in empty / missing / unrecognized. */
|
|
3
3
|
export declare const DEFAULT_RUNTIME: RuntimeName;
|
|
4
|
-
/**
|
|
5
|
-
* Runtimes launched through the agent-node supervisor rather than by spawning
|
|
6
|
-
* the Claude Code CLI directly. Keep this predicate exhaustive so adding a
|
|
7
|
-
* runtime cannot silently fall into the Claude launcher branch.
|
|
8
|
-
*/
|
|
9
|
-
export declare function runtimeUsesAgentNode(runtime: RuntimeName): boolean;
|
|
10
|
-
/** Runtimes whose explicit CLI choice must bypass the API-vendor picker. */
|
|
11
|
-
export declare function runtimeSkipsCreateVendorPicker(runtime: RuntimeName): boolean;
|
|
12
4
|
type ProfileLike = {
|
|
13
5
|
runtime?: string;
|
|
14
6
|
codexRuntime?: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const OPENCODE_AGENT_NETWORK_VERSION = "2.3.0-preview.27";
|
|
2
|
+
export declare const OPENCODE_AGENT_NODE_VERSION = "2.5.0-preview.23";
|
|
3
|
+
export declare const OPENCODE_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.23";
|
|
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;
|
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
* PR② e2e in a fresh checkout. `readEffectivePin()` still returns
|
|
5
5
|
* this when no override file exists.
|
|
6
6
|
*/
|
|
7
|
-
export declare const OPENCODE_BUILTIN_PIN = "1.
|
|
7
|
+
export declare const OPENCODE_BUILTIN_PIN = "1.18.1";
|
|
8
|
+
/** Exact upstream remediation shared by every CLI failure path. */
|
|
9
|
+
export declare function opencodeExactInstallCommand(version?: string): string;
|
|
10
|
+
/** Preserve package-identity diagnostics while always leaving a missing or
|
|
11
|
+
* untrusted install with an actionable exact-pin command. */
|
|
12
|
+
export declare function formatOpencodePackageIdentityFailure(expectedVersion: string, detail: string): string;
|
|
8
13
|
/** Where the per-machine override lives. Kept under `~/.anet/` so
|
|
9
14
|
* it sits next to the other anet-local state. */
|
|
10
15
|
export declare function opencodePinFilePath(homeDirOverride?: string): string;
|
|
@@ -10,6 +10,16 @@ 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", "question"];
|
|
22
|
+
export declare function buildOpencodeDefaultToolsPolicy(): Record<string, false>;
|
|
13
23
|
export declare function findOpencodePreset(id: string): OpencodePreset | null;
|
|
14
24
|
/**
|
|
15
25
|
* Look up the API key for a preset from the current process env.
|
|
@@ -22,22 +32,41 @@ export declare function readPresetKeyFromEnv(preset: OpencodePreset, env?: NodeJ
|
|
|
22
32
|
/**
|
|
23
33
|
* opencode.ai's auth.json shape:
|
|
24
34
|
* { "<providerId>": { "type": "api", "key": "..." } }
|
|
25
|
-
* Same shape
|
|
35
|
+
* Same shape verified against the release pin opencode-ai@1.18.1.
|
|
26
36
|
*/
|
|
27
37
|
export declare function buildAuthJsonBody(preset: OpencodePreset, apiKey: string): string;
|
|
38
|
+
export type OpencodePrivateProfileFilename = "config.json" | ".env";
|
|
39
|
+
/**
|
|
40
|
+
* Establish the boundary before saveProfile/rewritePlainSecrets writes the
|
|
41
|
+
* node token or dotenv key. The expected shape is exactly
|
|
42
|
+
* `<project>/.anet/nodes/<node>`. Every existing path is inspected with
|
|
43
|
+
* lstat + O_NOFOLLOW and inode checks; absent private directories are created
|
|
44
|
+
* one component at a time. A pre-planted node-root/config/.env symlink is a
|
|
45
|
+
* hard error before any secret-bearing write.
|
|
46
|
+
*/
|
|
47
|
+
export declare function prepareOpencodeNodeForProfileWrite(nodeWorkDir: string): string;
|
|
48
|
+
export declare function readOpencodePrivateProfileFile(nodeWorkDir: string, filename: OpencodePrivateProfileFilename): string | undefined;
|
|
49
|
+
export declare function writeOpencodePrivateProfileFile(nodeWorkDir: string, filename: OpencodePrivateProfileFilename, body: string): string;
|
|
28
50
|
/**
|
|
29
51
|
* Write auth.json into the opencode config root that lives under
|
|
30
|
-
* `nodeWorkDir` (
|
|
31
|
-
*
|
|
32
|
-
*
|
|
52
|
+
* `nodeWorkDir` (the per-node OpenCode data root). mode 0o600 limits
|
|
53
|
+
* filesystem access to the owning OS account; it does not prevent a
|
|
54
|
+
* same-uid OpenCode child from opening the file directly. Directory is
|
|
55
|
+
* created if missing.
|
|
33
56
|
*
|
|
34
57
|
* Returns the absolute path we wrote for logging.
|
|
35
58
|
*/
|
|
36
59
|
export declare function writeOpencodeAuthJson(nodeWorkDir: string, preset: OpencodePreset, apiKey: string): string;
|
|
37
60
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
61
|
+
* New keyless nodes must not inherit a private-but-preplanted credential.
|
|
62
|
+
* Keep the file present as an explicit empty object so the creation log's
|
|
63
|
+
* "auth not configured" statement matches the state OpenCode will consume.
|
|
64
|
+
*/
|
|
65
|
+
export declare function clearOpencodeAuthJson(nodeWorkDir: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* Companion opencode.json: records only the selected blessed provider
|
|
68
|
+
* identity and safe-by-default tool policy. Pre-existing model routing and
|
|
69
|
+
* arbitrary OpenCode integrations are stripped; operators may explicitly set
|
|
70
|
+
* a model after creation, which the runtime's separate safe renderer retains.
|
|
42
71
|
*/
|
|
43
72
|
export declare function writeOpencodeConfigJson(nodeWorkDir: string, preset: OpencodePreset): string;
|
|
@@ -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;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RuntimeName } from "./normalize-runtime";
|
|
2
|
+
export interface RuntimeChoice {
|
|
3
|
+
value: RuntimeName;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Single source of truth for every `anet node create` runtime picker.
|
|
8
|
+
*
|
|
9
|
+
* Keep this exact and ordered: the release gate imports this pure module to
|
|
10
|
+
* prove that the rendered seven-way preview picker has neither a missing
|
|
11
|
+
* OpenCode entry nor an unreviewed eighth choice.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RUNTIME_CHOICES: readonly RuntimeChoice[];
|
|
14
|
+
/** Inquirer mutates choice objects in some prompt paths; return fresh rows. */
|
|
15
|
+
export declare function createRuntimeChoices(): RuntimeChoice[];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/agent-network",
|
|
3
|
-
"version": "2.3.0-preview.
|
|
4
|
-
"description": "AI Agent Network CLI — Local-first multi-agent orchestration across
|
|
3
|
+
"version": "2.3.0-preview.27",
|
|
4
|
+
"description": "AI Agent Network CLI — Local-first multi-agent orchestration across Claude, Codex, Grok (ACP plus experimental co-presence TUI), and OpenCode runtimes. Apache 2.0.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/client.js",
|
|
7
7
|
"types": "dist/client.d.ts",
|
|
@@ -36,6 +36,9 @@
|
|
|
36
36
|
"grok",
|
|
37
37
|
"xai",
|
|
38
38
|
"grok-build-acp",
|
|
39
|
+
"grok-build-cli",
|
|
40
|
+
"grok-tui",
|
|
41
|
+
"copresence",
|
|
39
42
|
"acp",
|
|
40
43
|
"minimax",
|
|
41
44
|
"mimo",
|
|
@@ -54,7 +57,8 @@
|
|
|
54
57
|
"directory": "agent-network"
|
|
55
58
|
},
|
|
56
59
|
"publishConfig": {
|
|
57
|
-
"access": "public"
|
|
60
|
+
"access": "public",
|
|
61
|
+
"tag": "preview"
|
|
58
62
|
},
|
|
59
63
|
"bugs": {
|
|
60
64
|
"url": "https://github.com/sleep2agi/agent-network/issues"
|