Files
alzeo/dashboard/opencode-web.service.template
T
Hasan BasbunarandClaude Fable 5.1 48e8e043ca agent tab: AGENT_AUTO=1 approves every tool call (v1.7.1)
opencode serve rejects the TUI's --yolo and --auto flags, so the installer
renders OPENCODE_PERMISSION={"*":"allow"} into opencode-web.service when asked
(single-quoted assignment so the JSON survives systemd's parser), which opencode
honours: the served config reads {"*": "allow"}. Verified on the reference box:
a bash call reading a path outside the session's project ran with no permission
request. Explicit deny rules still apply, the user's opencode.json is untouched,
a re-run remembers the choice (AGENT_AUTO=0 turns it off).

The collector reports the mode the unit declares and the mode the running
server applies (GET /config through the credentials); the tab line says which,
and says when a restart is pending. Tests: relay helpers (26 tests), CI renders
the auto line, the HTTP smoke checks unit and server agree.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-03 23:55:11 +02:00

37 lines
1.5 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__
# Tool permissions. opencode's own defaults ask before a tool touches a path outside
# the session's project and on a repeated identical call; AGENT_AUTO=1 at install
# approves every tool call instead (explicit deny rules of your opencode config
# still apply), the same autonomy as the oc launcher's --yolo.
__AUTO_LINE__
# 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