@sleep2agi/agent-network 2.3.0-preview.26 → 2.3.0-preview.28
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/codex-app-server-release.d.ts +17 -0
- 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 -3
- 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_0x6498e1=a0_0x12a8;(function(_0x244026,_0x4b000b){const _0x1e3187=a0_0x12a8,_0x36596e=_0x244026();while(!![]){try{const _0x243d7b=-parseInt(_0x1e3187(0x1da))/0x1*(-parseInt(_0x1e3187(0x24d))/0x2)+-parseInt(_0x1e3187(0x21c))/0x3+parseInt(_0x1e3187(0x231))/0x4*(parseInt(_0x1e3187(0x22e))/0x5)+parseInt(_0x1e3187(0x1d5))/0x6+-parseInt(_0x1e3187(0x1c7))/0x7*(-parseInt(_0x1e3187(0x252))/0x8)+-parseInt(_0x1e3187(0x1d1))/0x9*(-parseInt(_0x1e3187(0x210))/0xa)+-parseInt(_0x1e3187(0x1d8))/0xb;if(_0x243d7b===_0x4b000b)break;else _0x36596e['push'](_0x36596e['shift']());}catch(_0x2aee3d){_0x36596e['push'](_0x36596e['shift']());}}}(a0_0x53f1,0xc5d48));import{readFileSync as a0_0x3142f2,existsSync as a0_0x5942ba}from'fs';import{randomUUID as a0_0x4dbfec}from'crypto';import{join as a0_0x2f0246}from'path';import{hostname as a0_0x1a2197}from'os';import{execSync as a0_0x5ceba6}from'child_process';function B(_0x3959b2){const _0x5d9373=a0_0x12a8;let _0x1f4ad=_0x3959b2[_0x5d9373(0x24f)](/[^a-zA-Z0-9\-_]/g,'-');return _0x1f4ad===''?_0x5d9373(0x202):_0x1f4ad;}import{Server as a0_0x5309a2}from'@modelcontextprotocol/sdk/server/index.js';import{StdioServerTransport as a0_0x5852f2}from'@modelcontextprotocol/sdk/server/stdio.js';import{ListToolsRequestSchema as a0_0xf8f288,CallToolRequestSchema as a0_0x32ca40}from'@modelcontextprotocol/sdk/types.js';function T(_0x46458a){const _0x462a9a=a0_0x12a8;if(!a0_0x5942ba(_0x46458a))return;for(let _0x5c230a of a0_0x3142f2(_0x46458a,_0x462a9a(0x1c3))[_0x462a9a(0x257)]('\x0a')){let _0x2cb8bd=_0x5c230a[_0x462a9a(0x226)]();if(!_0x2cb8bd||_0x2cb8bd[_0x462a9a(0x1f7)]('#'))continue;let _0x3e9534=_0x2cb8bd[_0x462a9a(0x266)]('=');if(_0x3e9534<0x0)continue;let _0x300125=_0x2cb8bd['slice'](0x0,_0x3e9534)['trim'](),_0x5938df=_0x2cb8bd[_0x462a9a(0x1d4)](_0x3e9534+0x1)[_0x462a9a(0x226)]()[_0x462a9a(0x24f)](/^["']|["']$/g,'');if(!process.env[_0x300125])process.env[_0x300125]=_0x5938df;}}var C=process.env.HOME||'~',r=a0_0x2f0246(C,a0_0x6498e1(0x20a));T(a0_0x2f0246(r,a0_0x6498e1(0x1dc)));var H=B(process[a0_0x6498e1(0x211)]());T(a0_0x2f0246(r,H,'.env'));function E(){const _0x52b40c=a0_0x6498e1;try{return a0_0x5ceba6(_0x52b40c(0x1ed),{'encoding':_0x52b40c(0x1c3),'timeout':0x7d0})['trim']();}catch{return'';}}function a0_0x53f1(){const _0xeed2d4=['error','set','stdin','blocked','working','These\x20are\x20tasks\x20dispatched\x20by\x20the\x20hub\x20or\x20other\x20sessions\x20via\x20the\x20CommHub\x20Server.','unknown','Task\x20outcome:\x20completed/failed/cancelled\x20for\x20final\x20results,\x20blocked/error/in_progress\x20for\x20status\x20updates','normal','SSE\x20stream\x20ended,\x20reconnecting...','initialize','stringify','SIGINT','alias','.claude/channels/commhub','low','parent\x20claude\x20died\x20(reparented\x20to\x20PID\x201\x20from\x20','unref','pop','setRequestHandler','50Ctymru','cwd','Reply\x20text\x20/\x20result\x20summary','Target\x20session\x20alias','failed','get_all_status','then','string','[commhub]\x20WARN:\x20COMMHUB_ALIAS\x20env\x20var\x20is\x20unset\x20—\x20outbound\x20from_session\x20','connected','unattributed-','\x20no\x20longer\x20exists\x20(kill-0\x20ESRCH)\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','1221624luWVXO','result','.\x20Restart\x20node\x20via\x20`anet\x20node\x20start\x20<alias>`\x20so\x20the\x20env\x20is\x20set\x20explicitly\x20(#203).\x0a','status','Send\x20a\x20message\x20to\x20another\x20session\x20(no\x20task\x20lifecycle,\x20just\x20chat).\x20Use\x20for\x20replies\x20and\x20status\x20updates.','decode','read','POST','data:\x20','commhub_send_task','trim','text','\x20ALIAS=','high','now','Authorization','application/json,\x20text/event-stream','config.json','10kdyvHw','find','MCP\x20stdio\x20connected','312844pGGcDy','number','body','Progress\x200-100','2025-03-26','\x20priority=','unknown\x20tool','send_task','2.0','connect','would\x20mis-attribute.\x20Refusing\x20to\x20guess\x20from\x20TMUX_NAME=','Task\x20content','notification','kill',']\x20[commhub]\x20','get_inbox','no\x20response','ack_inbox','Send\x20a\x20task\x20to\x20another\x20session\x20via\x20CommHub.','exit','SIGTERM','←\x20message\x20from\x20','SSE\x20fatal:\x20','broadcast','0.3.0','priority',':\x20inbox_count=','session\x20disconnected','1710746VnojtZ','catch','replace','commhub-channel',')\x20—\x20self-exit\x20to\x20avoid\x20ghost\x20heart-beat','6421688SsHKdT','application/json','ppid','\x22\x20after\x20SSE\x20reconnect','Current\x20task\x20description','split','messages','Reply\x20to\x20a\x20CommHub\x20task\x20—\x20report\x20completion\x20or\x20send\x20a\x20message\x20back\x20to\x20the\x20hub.','CommHub\x20init\x20failed:\x20','task','Priority\x20(default:\x20normal)','token','ESRCH','re-register\x20failed:\x20','SSE\x20connected\x20as\x20\x22','commhub_send_message','content','SSE\x20连续\x20>1h\x20连不上\x20hub\x20(','\x20/\x20hostname=','\x20RESUME_ID=','indexOf','Message\x20content','join','completed','report_status','hub','utf-8','.anet','parent\x20claude\x20pid=','code','14kDZzqc','min','connecting\x20to\x20','object','send_message','You\x20can\x20also\x20use\x20commhub_report_status\x20to\x20update\x20your\x20session\x20status.','toTimeString','\x20PROJECT_ENV=','fatal:\x20','ENV:\x20URL=','2638206XcefbA','offline','statusText','slice','212784AsyGnN','pid','commhub_reply','31909141PJwLmA','\x20CWD=','1suwBDk','from','.env','Reply\x20using\x20the\x20commhub_reply\x20tool\x20to\x20report\x20status\x20or\x20results\x20back.','delete','get','idle',')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。','claude-code','SSE\x20error:\x20','Update\x20this\x20session\x27s\x20status\x20in\x20CommHub\x20(working/idle/blocked/error).\x20Returns\x20inbox_count.','type','Session\x20alias:\x20','\x20from\x20','(none)','parse','stderr','→\x20injected\x20task\x20','tools/call','tmux\x20display-message\x20-p\x20\x27#S\x27','Bearer\x20','from_session','Get\x20status\x20of\x20all\x20sessions\x20from\x20CommHub.','commhub_get_all_status','SSE\x20connection\x20error:\x20','commhub','ready\x20—\x20waiting\x20for\x20events','write','registered\x20as\x20\x22','startsWith','message','message_id','\x22\x20(','new_task'];a0_0x53f1=function(){return _0xeed2d4;};return a0_0x53f1();}function _(){const _0x1dd500=a0_0x6498e1;try{let _0x8420f8=a0_0x2f0246(C,_0x1dd500(0x1c4),_0x1dd500(0x22d));if(a0_0x5942ba(_0x8420f8))return JSON['parse'](a0_0x3142f2(_0x8420f8,_0x1dd500(0x1c3)));}catch{}return{};}var R=_(),Y=process.env.COMMHUB_URL||R[a0_0x6498e1(0x1c2)]||'http://127.0.0.1:9200',j=process.env.COMMHUB_TMUX||E();function S(){const _0x3a076e=a0_0x6498e1;if(process.env.COMMHUB_ALIAS&&process.env.COMMHUB_ALIAS[_0x3a076e(0x226)]())return process.env.COMMHUB_ALIAS[_0x3a076e(0x226)]();return process[_0x3a076e(0x1ea)][_0x3a076e(0x1f5)](_0x3a076e(0x218)+(_0x3a076e(0x23b)+(j||_0x3a076e(0x1e8))+_0x3a076e(0x264)+a0_0x1a2197()+_0x3a076e(0x21e))),_0x3a076e(0x21a)+process[_0x3a076e(0x1d6)];}var p=S(),V=process.env.COMMHUB_RESUME_ID||process.env.CLAUDE_RESUME_ID||a0_0x4dbfec(),k=process.env.COMMHUB_TOKEN||R[a0_0x6498e1(0x25d)]||'';function z(_0x2c5ae9){const _0x57a4a3=a0_0x6498e1;let _0x3d1a51=new Date()[_0x57a4a3(0x1cd)]()[_0x57a4a3(0x1d4)](0x0,0x8);process[_0x57a4a3(0x1ea)][_0x57a4a3(0x1f5)]('['+_0x3d1a51+_0x57a4a3(0x23f)+_0x2c5ae9+'\x0a');}function i(_0x7acbf4){return new Promise(_0x918c4d=>setTimeout(_0x918c4d,_0x7acbf4));}z(a0_0x6498e1(0x1d0)+Y+a0_0x6498e1(0x228)+p+a0_0x6498e1(0x265)+V['slice'](0x0,0x8)+'...\x20TMUX='+(j||'none')+a0_0x6498e1(0x1d9)+process['cwd']()+a0_0x6498e1(0x1ce)+H);function a0_0x12a8(_0x42932b,_0x168bc2){_0x42932b=_0x42932b-0x1c2;const _0x53f185=a0_0x53f1();let _0x12a8f5=_0x53f185[_0x42932b];return _0x12a8f5;}var G=new Map(),K=new a0_0x5309a2({'name':a0_0x6498e1(0x250),'version':a0_0x6498e1(0x249)},{'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_0x6498e1(0x201),a0_0x6498e1(0x1dd),a0_0x6498e1(0x1cc),a0_0x6498e1(0x1e6)+p][a0_0x6498e1(0x268)]('\x0a')});K[a0_0x6498e1(0x20f)](a0_0xf8f288,async()=>({'tools':[{'name':a0_0x6498e1(0x1d7),'description':a0_0x6498e1(0x259),'inputSchema':{'type':a0_0x6498e1(0x1ca),'properties':{'task_id':{'type':a0_0x6498e1(0x217),'description':'The\x20task_id\x20from\x20the\x20channel\x20message\x20(or\x20\x27hub\x27\x20for\x20general)'},'text':{'type':a0_0x6498e1(0x217),'description':a0_0x6498e1(0x212)},'status':{'type':a0_0x6498e1(0x217),'enum':[a0_0x6498e1(0x269),'failed','cancelled','blocked',a0_0x6498e1(0x1fc),'in_progress'],'description':a0_0x6498e1(0x203)}},'required':[a0_0x6498e1(0x227)]}},{'name':'commhub_report_status','description':a0_0x6498e1(0x1e4),'inputSchema':{'type':a0_0x6498e1(0x1ca),'properties':{'status':{'type':a0_0x6498e1(0x217),'enum':[a0_0x6498e1(0x200),a0_0x6498e1(0x1e0),a0_0x6498e1(0x1ff),a0_0x6498e1(0x1fc)]},'task':{'type':a0_0x6498e1(0x217),'description':a0_0x6498e1(0x256)},'progress':{'type':a0_0x6498e1(0x232),'description':a0_0x6498e1(0x234)}},'required':[a0_0x6498e1(0x21f)]}},{'name':a0_0x6498e1(0x225),'description':a0_0x6498e1(0x243),'inputSchema':{'type':'object','properties':{'alias':{'type':a0_0x6498e1(0x217),'description':a0_0x6498e1(0x213)},'task':{'type':a0_0x6498e1(0x217),'description':a0_0x6498e1(0x23c)},'priority':{'type':a0_0x6498e1(0x217),'enum':[a0_0x6498e1(0x229),'normal',a0_0x6498e1(0x20b)],'description':a0_0x6498e1(0x25c)}},'required':[a0_0x6498e1(0x209),a0_0x6498e1(0x25b)]}},{'name':'commhub_send_message','description':a0_0x6498e1(0x220),'inputSchema':{'type':a0_0x6498e1(0x1ca),'properties':{'alias':{'type':a0_0x6498e1(0x217),'description':a0_0x6498e1(0x213)},'message':{'type':'string','description':a0_0x6498e1(0x267)}},'required':[a0_0x6498e1(0x209),a0_0x6498e1(0x1f8)]}},{'name':'commhub_get_all_status','description':a0_0x6498e1(0x1f0),'inputSchema':{'type':a0_0x6498e1(0x1ca),'properties':{}}}]}));async function Q(_0x4e0162,_0x2255aa){const _0x30caa0=a0_0x6498e1;let _0xaa0c0f=await fetch(Y+'/mcp',{'method':_0x30caa0(0x223),'headers':{'Content-Type':_0x30caa0(0x253),'Accept':_0x30caa0(0x22c),...k?{'Authorization':_0x30caa0(0x1ee)+k}:{}},'body':JSON['stringify']({'jsonrpc':_0x30caa0(0x239),'id':0x1,'method':_0x30caa0(0x206),'params':{'protocolVersion':_0x30caa0(0x235),'capabilities':{},'clientInfo':{'name':'commhub-channel','version':_0x30caa0(0x249)}}})});if(!_0xaa0c0f['ok']){let _0x7422ca=await _0xaa0c0f[_0x30caa0(0x227)]();return z(_0x30caa0(0x25a)+_0xaa0c0f['status']+'\x20'+_0x7422ca[_0x30caa0(0x1d4)](0x0,0x64)),{'ok':!0x1,'error':'init\x20failed:\x20'+_0xaa0c0f[_0x30caa0(0x21f)]};}await _0xaa0c0f['text']();let _0x449b1f=(await(await fetch(Y+'/mcp',{'method':_0x30caa0(0x223),'headers':{'Content-Type':'application/json','Accept':_0x30caa0(0x22c),...k?{'Authorization':_0x30caa0(0x1ee)+k}:{}},'body':JSON[_0x30caa0(0x207)]({'jsonrpc':'2.0','id':0x2,'method':_0x30caa0(0x1ec),'params':{'name':_0x4e0162,'arguments':_0x2255aa}})}))[_0x30caa0(0x227)]())[_0x30caa0(0x257)]('\x0a')[_0x30caa0(0x22f)](_0x1f716d=>_0x1f716d[_0x30caa0(0x1f7)](_0x30caa0(0x224)));if(_0x449b1f){let _0x414ea9=JSON[_0x30caa0(0x1e9)](_0x449b1f['slice'](0x6));return _0x414ea9?.[_0x30caa0(0x21d)]?.['content']?.[0x0]?.[_0x30caa0(0x227)]?JSON[_0x30caa0(0x1e9)](_0x414ea9[_0x30caa0(0x21d)]['content'][0x0][_0x30caa0(0x227)]):_0x414ea9;}return{'ok':!0x1,'error':_0x30caa0(0x241)};}K[a0_0x6498e1(0x20f)](a0_0x32ca40,async _0x466126=>{const _0x3a4aa8=a0_0x6498e1;let {name:_0x50c34b,arguments:_0x1b3012}=_0x466126['params'];if(_0x50c34b===_0x3a4aa8(0x1d7)){let {task_id:_0x147a32,text:_0x171793,status:_0x5130bc}=_0x1b3012;if(_0x5130bc===_0x3a4aa8(0x269)||_0x5130bc===_0x3a4aa8(0x214)||_0x5130bc==='cancelled'){let _0x47123b=_0x5130bc==='completed'?'replied':_0x5130bc,_0x542e2c=_0x147a32?G[_0x3a4aa8(0x1df)](_0x147a32)||_0x3a4aa8(0x1c2):'hub',_0x5c7460=await Q('send_reply',{'alias':_0x542e2c,'text':_0x171793,'in_reply_to':_0x147a32||void 0x0,'status':_0x47123b,'from_session':p});if(_0x147a32)G[_0x3a4aa8(0x1de)](_0x147a32);return{'content':[{'type':_0x3a4aa8(0x227),'text':JSON[_0x3a4aa8(0x207)](_0x5c7460)}]};}let _0x491898=await Q('report_status',{'resume_id':V,'alias':p,'status':_0x5130bc===_0x3a4aa8(0x1ff)?_0x3a4aa8(0x1ff):_0x5130bc===_0x3a4aa8(0x1fc)?_0x3a4aa8(0x1fc):'working','task':_0x171793[_0x3a4aa8(0x1d4)](0x0,0xc8),'output':_0x171793});return{'content':[{'type':_0x3a4aa8(0x227),'text':JSON[_0x3a4aa8(0x207)](_0x491898)}]};}if(_0x50c34b==='commhub_report_status'){let {status:_0x427df2,task:_0x36a16d,progress:_0x476ce0}=_0x1b3012,_0x419e82=await Q(_0x3a4aa8(0x26a),{'resume_id':V,'alias':p,'status':_0x427df2,'task':_0x36a16d,'progress':_0x476ce0});return{'content':[{'type':'text','text':JSON[_0x3a4aa8(0x207)](_0x419e82)}]};}if(_0x50c34b==='commhub_send_task'){let {alias:_0x2c34a9,task:_0x46b1bd,priority:_0x5daa19}=_0x1b3012,_0x36f1ba=await Q(_0x3a4aa8(0x238),{'alias':_0x2c34a9,'task':_0x46b1bd,'priority':_0x5daa19||_0x3a4aa8(0x204),'from_session':p});return{'content':[{'type':_0x3a4aa8(0x227),'text':JSON['stringify'](_0x36f1ba)}]};}if(_0x50c34b===_0x3a4aa8(0x261)){let {alias:_0x1f601c,message:_0xbb1133}=_0x1b3012,_0x58fe62=await Q(_0x3a4aa8(0x1cb),{'alias':_0x1f601c,'message':_0xbb1133,'from_session':p});return{'content':[{'type':'text','text':JSON[_0x3a4aa8(0x207)](_0x58fe62)}]};}if(_0x50c34b===_0x3a4aa8(0x1f1)){let _0x36109c=await Q(_0x3a4aa8(0x215),{});return{'content':[{'type':_0x3a4aa8(0x227),'text':JSON['stringify'](_0x36109c)}]};}return{'content':[{'type':_0x3a4aa8(0x227),'text':JSON[_0x3a4aa8(0x207)]({'error':_0x3a4aa8(0x237)})}]};});var D=0x3e8,v=0x7530,O=0x36ee80;async function m(){const _0x3fd6d5=a0_0x6498e1;try{await Q('report_status',{'resume_id':V,'alias':p,'status':_0x3fd6d5(0x1e0),'server':a0_0x1a2197(),'hostname':a0_0x1a2197(),'agent':_0x3fd6d5(0x1e2),'project_dir':process[_0x3fd6d5(0x211)](),'tmux_name':j||void 0x0}),z('re-registered\x20as\x20\x22'+p+_0x3fd6d5(0x255));}catch(_0x2fac46){z(_0x3fd6d5(0x25f)+_0x2fac46);}}async function l(){const _0x5e0fcd=a0_0x6498e1;let _0x6987c7=Y+'/events/'+encodeURIComponent(p),_0x4f6bb4={};if(k)_0x4f6bb4[_0x5e0fcd(0x22b)]=_0x5e0fcd(0x1ee)+k;z(_0x5e0fcd(0x1c9)+_0x6987c7);let _0xc318e1=D,_0x457bba=!0x0,_0x43a182=null;while(!0x0){try{let _0x2679b0=await fetch(_0x6987c7,{'headers':_0x4f6bb4});if(!_0x2679b0['ok']){if(z(_0x5e0fcd(0x1e3)+_0x2679b0[_0x5e0fcd(0x21f)]+'\x20'+_0x2679b0[_0x5e0fcd(0x1d3)]),_0x43a182=_0x43a182??Date[_0x5e0fcd(0x22a)](),Date['now']()-_0x43a182>O){z(_0x5e0fcd(0x263)+Y+_0x5e0fcd(0x1e1));return;}await i(_0xc318e1),_0xc318e1=Math[_0x5e0fcd(0x1c8)](_0xc318e1*0x2,v);continue;}let _0x3923c7=_0x2679b0[_0x5e0fcd(0x233)]['getReader'](),_0x2d73e6=new TextDecoder(),_0x1f50a8='';_0xc318e1=D;while(!0x0){let {done:_0x195078,value:_0x3228b4}=await _0x3923c7[_0x5e0fcd(0x222)]();if(_0x195078)break;_0x1f50a8+=_0x2d73e6[_0x5e0fcd(0x221)](_0x3228b4,{'stream':!0x0});let _0x1cb17d=_0x1f50a8[_0x5e0fcd(0x257)]('\x0a\x0a');_0x1f50a8=_0x1cb17d[_0x5e0fcd(0x20e)]()||'';for(let _0x390013 of _0x1cb17d){let _0x5ec830=_0x390013['split']('\x0a')[_0x5e0fcd(0x22f)](_0xa2fbdd=>_0xa2fbdd[_0x5e0fcd(0x1f7)](_0x5e0fcd(0x224)));if(!_0x5ec830)continue;try{let _0x1567f0=JSON[_0x5e0fcd(0x1e9)](_0x5ec830[_0x5e0fcd(0x1d4)](0x6));if(await A(_0x1567f0),_0x1567f0[_0x5e0fcd(0x1e5)]===_0x5e0fcd(0x219)){if(_0x43a182=null,!_0x457bba)await m();_0x457bba=!0x1;}}catch(_0x1f40e0){z('parse\x20error:\x20'+_0x1f40e0);}}}z(_0x5e0fcd(0x205));}catch(_0xda38da){z(_0x5e0fcd(0x1f2)+_0xda38da);}if(_0x43a182=_0x43a182??Date[_0x5e0fcd(0x22a)](),Date[_0x5e0fcd(0x22a)]()-_0x43a182>O){z(_0x5e0fcd(0x263)+Y+')\x20—\x20放弃自动重连。手动\x20anet\x20node\x20start\x20恢复。');return;}await i(_0xc318e1),_0xc318e1=Math[_0x5e0fcd(0x1c8)](_0xc318e1*0x2,v);}}async function A(_0xefe6ed){const _0x57ce02=a0_0x6498e1;if(_0xefe6ed[_0x57ce02(0x1e5)]==='connected'){z(_0x57ce02(0x260)+p+'\x22');return;}if(_0xefe6ed[_0x57ce02(0x1e5)]==='new_message'){if(z(_0x57ce02(0x246)+_0xefe6ed[_0x57ce02(0x1db)]+':\x20'+_0xefe6ed[_0x57ce02(0x1f8)][_0x57ce02(0x1d4)](0x0,0x3c)),await K['notification']({'method':'notifications/claude/channel','params':{'content':_0xefe6ed[_0x57ce02(0x1f8)],'meta':{'sender':_0xefe6ed[_0x57ce02(0x1db)]||_0x57ce02(0x1c2),'sender_id':_0x57ce02(0x1f3),'user':_0xefe6ed[_0x57ce02(0x1db)]||'hub','priority':_0x57ce02(0x204)}}}),_0xefe6ed[_0x57ce02(0x1f9)])await Q(_0x57ce02(0x242),{'alias':p,'message_id':_0xefe6ed[_0x57ce02(0x1f9)]});return;}if(_0xefe6ed['type']===_0x57ce02(0x1fb)||_0xefe6ed[_0x57ce02(0x1e5)]===_0x57ce02(0x248)){z('←\x20'+_0xefe6ed[_0x57ce02(0x1e5)]+_0x57ce02(0x24b)+_0xefe6ed['inbox_count']+_0x57ce02(0x236)+(_0xefe6ed[_0x57ce02(0x24a)]||'normal'));let _0x44d95c=await Q(_0x57ce02(0x240),{'alias':p,'limit':0x5});if(_0x44d95c?.['ok']&&_0x44d95c[_0x57ce02(0x258)]?.['length']>0x0)for(let _0x24ef1f of _0x44d95c[_0x57ce02(0x258)]){let _0xd3095f={'sender':_0x24ef1f[_0x57ce02(0x1ef)]||_0x57ce02(0x1c2),'sender_id':_0x57ce02(0x1f3),'user':_0x24ef1f[_0x57ce02(0x1ef)]||'hub','task_id':_0x24ef1f['id'],'priority':_0x24ef1f[_0x57ce02(0x24a)]||_0x57ce02(0x204)};G[_0x57ce02(0x1fd)](_0x24ef1f['id'],_0x24ef1f[_0x57ce02(0x1ef)]||_0x57ce02(0x1c2)),await K[_0x57ce02(0x23d)]({'method':'notifications/claude/channel','params':{'content':_0x24ef1f[_0x57ce02(0x262)],'meta':_0xd3095f}}),z(_0x57ce02(0x1eb)+_0x24ef1f['id'][_0x57ce02(0x1d4)](0x0,0x8)+_0x57ce02(0x1e7)+_0x24ef1f[_0x57ce02(0x1ef)]+':\x20'+_0x24ef1f[_0x57ce02(0x262)][_0x57ce02(0x1d4)](0x0,0x3c)),await Q(_0x57ce02(0x242),{'alias':p,'message_id':_0x24ef1f['id']});}}}async function t(){const _0x45229e=a0_0x6498e1;let _0x21b46a=new a0_0x5852f2();await K[_0x45229e(0x23a)](_0x21b46a),z(_0x45229e(0x230)),z('starting\x20SSE\x20listener...'),l()['catch'](_0x253586=>z(_0x45229e(0x247)+_0x253586)),Q(_0x45229e(0x26a),{'resume_id':V,'alias':p,'status':_0x45229e(0x1e0),'server':a0_0x1a2197(),'hostname':a0_0x1a2197(),'agent':_0x45229e(0x1e2),'project_dir':process[_0x45229e(0x211)](),'tmux_name':j||void 0x0})[_0x45229e(0x216)](()=>z(_0x45229e(0x1f6)+p+_0x45229e(0x1fa)+V['slice'](0x0,0x8)+')'))['catch'](_0x16071d=>z('warning:\x20could\x20not\x20register:\x20'+_0x16071d)),setInterval(()=>{const _0x5c3775=_0x45229e;Q(_0x5c3775(0x26a),{'resume_id':V,'alias':p,'status':_0x5c3775(0x1e0),'server':a0_0x1a2197(),'hostname':a0_0x1a2197(),'agent':_0x5c3775(0x1e2),'project_dir':process[_0x5c3775(0x211)](),'tmux_name':j||void 0x0})[_0x5c3775(0x24e)](_0x337921=>z('heartbeat\x20failed:\x20'+_0x337921));},0x2bf20),z(_0x45229e(0x1f4));}t()['catch'](_0x34b6de=>{const _0x2e4da7=a0_0x6498e1;z(_0x2e4da7(0x1cf)+_0x34b6de),process[_0x2e4da7(0x244)](0x1);});async function b(){const _0x256fdc=a0_0x6498e1;z('shutting\x20down,\x20reporting\x20offline...'),await Q(_0x256fdc(0x26a),{'resume_id':V,'alias':p,'status':_0x256fdc(0x1d2),'task':_0x256fdc(0x24c)})[_0x256fdc(0x24e)](()=>{}),process[_0x256fdc(0x244)](0x0);}process[a0_0x6498e1(0x1fe)]['on']('end',()=>b()),process['on'](a0_0x6498e1(0x245),()=>b()),process['on'](a0_0x6498e1(0x208),()=>b());var d=process[a0_0x6498e1(0x254)];if(d&&d>0x1){let h=setInterval(()=>{const _0x2915d1=a0_0x6498e1;if(process[_0x2915d1(0x254)]===0x1&&d!==0x1){z(_0x2915d1(0x20c)+d+_0x2915d1(0x251)),b();return;}try{process[_0x2915d1(0x23e)](d,0x0);}catch(_0x373226){if(_0x373226?.[_0x2915d1(0x1c6)]===_0x2915d1(0x25e))z(_0x2915d1(0x1c5)+d+_0x2915d1(0x21b)),b();}},0x7530);if(typeof h[a0_0x6498e1(0x20d)]==='function')h[a0_0x6498e1(0x20d)]();}
|
|
@@ -1,4 +1,4 @@
|
|
|
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
4
|
/**
|
|
@@ -7,8 +7,6 @@ export declare const DEFAULT_RUNTIME: RuntimeName;
|
|
|
7
7
|
* runtime cannot silently fall into the Claude launcher branch.
|
|
8
8
|
*/
|
|
9
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
10
|
type ProfileLike = {
|
|
13
11
|
runtime?: string;
|
|
14
12
|
codexRuntime?: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const OPENCODE_AGENT_NETWORK_VERSION = "2.3.0-preview.28";
|
|
2
|
+
export declare const OPENCODE_AGENT_NODE_VERSION = "2.5.0-preview.24";
|
|
3
|
+
export declare const OPENCODE_AGENT_NODE_SPEC = "@sleep2agi/agent-node@2.5.0-preview.24";
|
|
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.28",
|
|
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"
|