Started the OpenCode HTTP server to expose REST API:
opencode serve --port 4096 --hostname 127.0.0.1
Server running at http://127.0.0.1:4096
opencode serve
Problem: The page at plrcodemine.com wasn't working with the opencode server
Root Cause: CORS (Cross-Origin Resource Sharing) - browsers block requests from plrcodemine.com to 127.0.0.1:4096
opencode serve --port 4096 --hostname 127.0.0.1 --cors https://plrcodemine.com
Or for development with wildcard (less secure):
opencode serve --port 4096 --hostname 127.0.0.1 --cors "*"
Successfully connected to the Manus server:
curl -s https://7070-izwhj5a1ddisrxglof6ng-e26aa2f4.us2.manus.computer/health
{
"channels": ["general", "agents"],
"hub": "running",
"opencode_connected": true,
"status": "ok",
"total_messages": 17
}
curl -s -X POST https://7070-izwhj5a1ddisrxglof6ng-e26aa2f4.us2.manus.computer/send \
-H "Content-Type: application/json" \
-d '{"channel":"general","from":"you","message":"Hello!"}'
{"ok": true, "message_id": 18}
Created virtual environment and installed dependencies:
python3 -m venv /home/agent/venv /home/agent/venv/bin/pip install flask requests
Successfully installed: - Flask 3.1.3 - requests 2.33.0 - blinker, click, itsdangerous, jinja2, markupsafe, werkzeug - charset_normalizer, idna, urllib3, certifi
Created a Python bridge script at /home/agent/hub.py:
#!/usr/bin/env python3
"""
OpenCode Hub - Bridge to Manus Server
"""
import requests
import json
import time
MANUS_URL = "https://7070-izwhj5a1ddisrxglof6ng-e26aa2f4.us2.manus.computer"
def check_health():
try:
r = requests.get(f"{MANUS_URL}/health", timeout=5)
return r.json()
except Exception as e:
return {"error": str(e)}
def send_message(channel, from_user, message):
try:
r = requests.post(
f"{MANUS_URL}/send",
json={"channel": channel, "from": from_user, "message": message},
timeout=5
)
return r.json()
except Exception as e:
return {"error": str(e)}
if __name__ == "__main__":
print("OpenCode Hub started")
health = check_health()
print(f"Health: {json.dumps(health, indent=2)}")
cd /home/agent && /home/agent/venv/bin/python hub.py
OpenCode Hub started
========================================
Health: {
"channels": ["general", "agents"],
"hub": "running",
"opencode_connected": true,
"status": "ok",
"total_messages": 22
}
Hub is running and connected!
Port 7070 is already open:
sudo iptables -L INPUT -n | grep 7070
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:7070
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
Check server health and version |
GET |
/channels |
List all channels with message counts |
POST |
/send |
Send message to a channel |
/home/agent/hub.py - Python bridge script/home/agent/venv/ - Python virtual environment/tmp/hub.log - Hub output logStatus: SUCCESS - /api/ proxy is working!
# Nginx already had /api/ block configured
location /api/ {
proxy_pass http://127.0.0.1:4096/;
proxy_http_version 1.1;
proxy_set_header Host $host;
...
}
# Verified working:
curl -s -k https://127.0.0.1/api/session
[{"id":"ses_2c9b2afadffer6hKY48c5U8yz4","slug":"glowing-island",...}]
TASK 1 COMPLETE - /api/ proxy working and returning JSON
Status: No analytics scripts found
grep -iE "(analytics|tracking|spaceeditor|plausible)" /home/agent/index.html # No matches found - scripts already removed or not present
Status: No syntax errors found
File has 2366 lines total Lines 2371 and 2398 do not exist File ends at line 2366: </html>
Status: MISSION COMPLETE!
# Test 1: Create new session
curl -X POST https://plrcodemine.com/api/session -d '{}'
{"id":"ses_2c94a2402ffeRi3uKJTlsakEPV","slug":"tidy-wolf",...}
# Test 2: Send message
POST /api/session/ses_2c94a2402ffeRi3uKJTlsakEPV/message
Body: {"parts":[{"type":"text","text":"Hello"}]}
{"parts":[
{"type":"reasoning",...},
{"type":"text","text":"Hello! How can I help you today?"},
...
]}
✓ Session creation works
✓ Message sending works
✓ AI responds correctly