Prepare persistent REA MCP and skill for OpenCode without restart
This commit is contained in:
1 parent
bdb43c91f4
commit
6e145e3d3d
5 files changed
+2233
No files matched your search
@@ -0,0 +1,67 @@
|
||||
# REA for OpenCode — prepared 2026-10-15
|
||||
|
||||
REA 6.5.0 is installed inside the existing Unraid OpenCode container's persistent
|
||||
home. No additional container, host Docker socket, SSH identity or published port.
|
||||
OpenCode/Deck/LLM were not restarted or explicitly reloaded. REA's official
|
||||
OpenCode setup registers an MCP and installs its investigation skill; client-side
|
||||
activation after restart/new session is not claimed by this preparation.
|
||||
|
||||
## Installed paths and dependencies
|
||||
|
||||
- Existing Node 24.18.1: `/usr/bin/node`.
|
||||
- Private npm 11.16.0: `/root/.local/share/rea/npm`; bootstrapped from the public
|
||||
npm registry tarball with its published SHA-512 integrity checked before unpacking.
|
||||
- REA: `/root/.local/share/rea/runtime/node_modules/rea-agents/scripts/rea.mjs`.
|
||||
- Official installer: `node .../scripts/rea.mjs setup --client opencode --yes --format json`.
|
||||
- Registration: `/root/.config/opencode/opencode.jsonc`, `mcp.rea`, local stdio,
|
||||
command `["/root/.local/share/rea/runtime/node_modules/rea-agents/scripts/rea.mjs", "mcp"]`.
|
||||
- Skill: `/root/.agents/skills/reverse-engineer-anything`.
|
||||
- No optional Frida dependency installed; Java/Ghidra/Hopper/IDA not installed.
|
||||
Native executable decompilation requires a separate compatible provider.
|
||||
|
||||
The existing Alpine BusyBox `ps` does not support REA's process-ownership query.
|
||||
Fetched procps-ng 4.0.6-r0 and dependencies with `apk fetch --recursive`, unpacked
|
||||
under `/root/.local/share/rea/sysroot`, without changing system packages. Archives
|
||||
are in the adjacent `apk` directory; exact checksums are recorded here.
|
||||
Only `mcp.rea.environment` prepends this private sysroot's `bin`/`usr/bin` to PATH
|
||||
and its `usr/lib`/`lib` to LD_LIBRARY_PATH. Existing inherited paths follow them.
|
||||
The same environment is saved privately as `private-env.json` for the smoke test.
|
||||
Other MCP settings and all model settings were compared internally using SHA-256
|
||||
before and after setup; unchanged. No config values or secrets were emitted.
|
||||
|
||||
## Verified
|
||||
|
||||
Separate temporary stdio MCP connection initialized REA 6.5.0 and listed 207
|
||||
tools. A real `analyze_javascript_application` call succeeded on a generated
|
||||
two-file CommonJS fixture with summary output; fixture and temporary server were
|
||||
removed afterward. No user app, private input, GPU inference, or host program was
|
||||
used. Run `node verify.mjs` inside OpenCode to repeat this synthetic check.
|
||||
This establishes static JavaScript analysis, not all 207 tools or native providers.
|
||||
|
||||
## Restore and update
|
||||
|
||||
The existing OpenCode `/root` mount retains runtime, npm, skill, configuration,
|
||||
and private procps binaries across container recreation. Protect that entire home
|
||||
through the Unraid appdata backup; it is not automatically covered by Athena
|
||||
Deck's separate host backup. REA setup's configuration backup may contain existing
|
||||
credentials: keep it private, never put it in Git.
|
||||
|
||||
For reconstruction, use Node 24.11+ or another REA-supported Node version; install
|
||||
private npm 11.16.0 from its registry tarball with integrity verification. Copy
|
||||
the public package.json/package-lock.json from this directory into a runtime
|
||||
directory, then run `npm ci --prefix RUNTIME --omit=optional --no-audit --no-fund`.
|
||||
Run the pinned REA script's setup for OpenCode; preserve existing config and then
|
||||
restore the REA-only environment overrides above. Reacquire the listed signed
|
||||
Alpine packages matching apk-sha256.txt and extract into the private sysroot.
|
||||
If the Alpine base changes, revalidate its ABI and REA smoke test before use.
|
||||
Do not restart a busy coding agent merely to activate a connector.
|
||||
|
||||
For a future native Debian deployment, Node plus the locked npm tree remain
|
||||
required; install the distribution's procps rather than using Alpine's musl
|
||||
sysroot and remove the private musl library override. Configure the actual service
|
||||
user's home and executable path, then repeat the smoke test. A fresh-host native
|
||||
restore, browser-runtime inspection and executable-decompiler integration have
|
||||
not been tested here.
|
||||
|
||||
Official references: https://rea.tools/get-started/ and
|
||||
https://github.com/morluto/rea/blob/main/docs/client-configuration.md.
|
||||
@@ -0,0 +1,8 @@
|
||||
cb03919cba5624b5e8759d04f3b31913b02585355988b914bc31de4746ff5ef6 libintl-1.0-r0.apk
|
||||
cf8caa8a88bc4ce9d9e395567fefaf9ef7fbd55c50ae6155b35c1b58f3755023 libncursesw-6.6_p20260516-r0.apk
|
||||
b879846fa616ed27c64c5bd15ef3647f59005cab2c95c1fc2738b64ddbcfb9e6 libproc2-4.0.6-r0.apk
|
||||
573712e2f49c15bfc20a2699f204acdfc74c772722b15e7353d768057fae0e71 musl-1.2.6-r2.apk
|
||||
ce83be6d0bd10584a53c3a5868cc1595ce5f0f8e0b621f8f7f70b6144e521fc9 ncurses-terminfo-base-6.6_p20260516-r0.apk
|
||||
2510d07b3c029e7cdba1a6981fa17ac5a7b6c31e1e36df4327f46dd3aa8822eb procps-ng-4.0.6-r0.apk
|
||||
3301f6ccbeaea49cdd966c7e636898a8612fb8fe964a15f24f6d204b3944c3f3 skalibs-libs-2.15.0.0-r0.apk
|
||||
497f0f1cb51f0e6c1acc338fded0dc7722b1d43ea17bdb749f0d556794f8b2d8 utmps-libs-0.1.3.3-r0.apk
|
||||
+2148
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"rea-agents": "6.5.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import cp from 'node:child_process';import fs from 'node:fs';import os from 'node:os';
|
||||
const root=process.env.REA_INSTALL_ROOT||os.homedir()+'/.local/share/rea';const dir=fs.mkdtempSync(root+'/smoke-');fs.writeFileSync(dir+'/package.json',JSON.stringify({name:'rea-smoke',version:'1.0.0',main:'main.js'}));fs.writeFileSync(dir+'/main.js','exports.percent = function(base, rate) { return base * rate / 100; };\n');
|
||||
const child=cp.spawn(root+'/runtime/node_modules/rea-agents/scripts/rea.mjs',['mcp'],{stdio:['pipe','pipe','pipe'],env:{...process.env,...JSON.parse(fs.readFileSync(root+'/private-env.json','utf8'))}});let buf='';const pending=new Map;child.stdout.on('data',data=>{buf+=data;let n;while((n=buf.indexOf('\n'))>=0){const line=buf.slice(0,n);buf=buf.slice(n+1);try{const j=JSON.parse(line);if(j.id&&pending.has(j.id)){pending.get(j.id)(j);pending.delete(j.id)}}catch{}}});child.stderr.resume();let seq=0;
|
||||
const request=(method,params={})=>new Promise((resolve,reject)=>{const id=++seq;const timer=setTimeout(()=>reject(new Error('MCP timeout: '+method)),60000);pending.set(id,j=>{clearTimeout(timer);j.error?reject(new Error('MCP error '+j.error.code)):resolve(j.result)});child.stdin.write(JSON.stringify({jsonrpc:'2.0',id,method,params})+'\n')});
|
||||
try{await request('initialize',{protocolVersion:'2025-11-25',capabilities:{},clientInfo:{name:'athena-rea-smoke',version:'1'}});child.stdin.write(JSON.stringify({jsonrpc:'2.0',method:'notifications/initialized'})+'\n');const r=await request('tools/call',{name:'analyze_javascript_application',arguments:{input_path:dir,format:'directory',detail:'summary',max_heap_mb:128,analysis_timeout_ms:30000}});console.log(JSON.stringify({isError:r.isError??false,summary:r.content?.filter(c=>c.type==='text').map(c=>c.text.slice(0,1400))}));if(r.isError)process.exitCode=1;}finally{child.kill('SIGTERM');fs.rmSync(dir,{recursive:true,force:true})}
|
||||
Reference in new issue
Block a user