mirror of
https://github.com/hasso5703/alzeo.git
synced 2026-12-06 12:54:19 +01:00
dashboard/install-agent.sh installs opencode-web.service (opencode serve as the user on 127.0.0.1:4096, Basic credentials generated once, 0600) and re-installs the cockpit with a relay on one address, the tailnet address by default. The relay (dashboard/agent_relay.py, stdlib) is the only thing that reaches opencode: cockpit session cookie required, foreign Origin refused, cookie stripped, credentials added, plain answers, event stream and the terminal's WebSocket streamed back, frame-ancestors set to the cockpit. One host for the cockpit and the relay, so the tab needs no second login and no Basic prompt. The tab reports the server, the relay and the served version, with Open in a tab, Reload and Restart server (three more exact sudoers lines); the Logs tab reads the server's journal. install-dashboard.sh now keeps the bind, port and relay settings it finds in the installed unit when re-run without variables. Tests: 25 offline relay tests (fake opencode with SSE and WebSocket), a headless check of the tab against the live cockpit, eleven relay checks in the HTTP smoke, the monkey check covers the new tab (a deep link to #agent crashed the first build at parse time; fixed), CI renders both cockpit unit templates and cross-checks every unit action against the sudoers allowlist. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
32 lines
1.2 KiB
Plaintext
32 lines
1.2 KiB
Plaintext
[Unit]
|
|
Description=opencode web server for the Spark Cockpit Agent tab (loopback :__OPENCODE_PORT__)
|
|
Documentation=https://github.com/hasso5703/dgx-spark-qwen38
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=__USER__
|
|
Group=__GROUP__
|
|
WorkingDirectory=__HOME__
|
|
Environment=HOME=__HOME__
|
|
# Your PATH at install time, so the agent's tools (git, node, uvx for the MCP
|
|
# servers, opencode itself) resolve the way they do in your terminal.
|
|
Environment=PATH=__PATH__
|
|
# The Basic credentials the cockpit relay presents (OPENCODE_SERVER_USERNAME and
|
|
# OPENCODE_SERVER_PASSWORD), generated once by install-agent.sh, mode 0600.
|
|
EnvironmentFile=__HOME__/.config/qwen38/opencode-web.env
|
|
# Same cap as the oc launcher: without it long thinking is cut at 32000 tokens
|
|
# and the turn ends silently.
|
|
Environment=OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX=__OUTPUT_TOKEN_MAX__
|
|
# Loopback only: the cockpit relay is the one thing that reaches this server.
|
|
ExecStart=__OPENCODE_BIN__ serve --hostname 127.0.0.1 --port __OPENCODE_PORT__ --print-logs --log-level INFO
|
|
Restart=always
|
|
RestartSec=3
|
|
# A stop takes the MCP servers and any tool the agent still runs down with it.
|
|
KillMode=control-group
|
|
TimeoutStopSec=20
|
|
LimitNOFILE=65536
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|