add cline

This commit is contained in:
2026-10-28 06:26:57 -06:00
parent 28a6e43e07
commit 7c22510eee
8 changed files with 89 additions and 5 deletions
+16 -2
View File
@@ -57,6 +57,19 @@ case "$agent" in
*) profile="$agent" ;;
esac
# Cline Desktop is a window, usually opened from the app menu in your home
# directory, so it always starts in ~/Projects and can change projects there.
# Its profile hides /run/user, where your session's D-Bus and keyring sockets
# are, except the Wayland socket it draws through. The sandbox has no GPU, and
# WebKit can't start its own sandbox (bubblewrap) inside this one.
gui_socket=""
case "$profile" in
cline-desktop)
mkdir -p "$HOME/Projects" && cd "$HOME/Projects" || exit 1
gui_socket="$XDG_RUNTIME_DIR/${WAYLAND_DISPLAY:-wayland-0}"
export GDK_BACKEND=wayland WEBKIT_DISABLE_DMABUF_RENDERER=1 WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS=1 ;;
esac
srt="$(command -v srt || echo "$HOME/.local/bin/srt")"
if [ ! -x "$srt" ]; then
echo "The sandbox (srt) isn't installed; run update. To run $agent without it: unsandboxed $agent"
@@ -101,8 +114,9 @@ done
# Outside the sandbox's writable paths, so the agent can't change its own rules
settings="$SETTINGS_DIR/$agent.$$.json"
if ! jq -s --arg domains "$COREDESKTOP_SANDBOX_DOMAINS" \
"$MERGE"' | .network.allowedDomains += ($domains | split(" ") | map(select(. != "")))' \
if ! jq -s --arg domains "$COREDESKTOP_SANDBOX_DOMAINS" --arg socket "$gui_socket" \
"$MERGE"' | .network.allowedDomains += ($domains | split(" ") | map(select(. != "")))
| if $socket != "" then .filesystem.allowRead += [$socket] else . end' \
"${configs[@]}" > "$settings"; then
echo "Couldn't read the sandbox config: ${configs[*]}"
exit 1
+1
View File
@@ -0,0 +1 @@
../agent
+4 -1
View File
@@ -67,7 +67,10 @@
"~/.claude.json",
"~/.hermes",
"~/.config/opencode",
"~/.local/share/opencode"
"~/.local/share/opencode",
"~/.cline",
"~/.config/bot.cline.app",
"~/.local/share/bot.cline.app"
],
"allowRead": [],
"allowWrite": [
+35
View File
@@ -0,0 +1,35 @@
{
"network": {
"allowedDomains": [
"cline.bot",
"*.cline.bot"
],
"allowAllUnixSockets": true
},
"filesystem": {
"denyRead": [
"/run/user",
"/run/dbus",
"/run/docker.sock",
"/run/podman",
"/run/tailscale",
"/run/ssh-unix-local",
"/tmp/.X11-unix",
"/tmp/tmux-*",
"/tmp/ssh-*",
"/tmp/*/SingletonSocket"
],
"allowRead": [
"~/.cline",
"~/.config/bot.cline.app",
"~/.local/share/bot.cline.app",
"~/.cache/bot.cline.app"
],
"allowWrite": [
"~/.cline",
"~/.config/bot.cline.app",
"~/.local/share/bot.cline.app",
"~/.cache/bot.cline.app"
]
}
}
+18
View File
@@ -43,6 +43,24 @@ if [ -f "$CLAUDE_SETTINGS" ]; then
fi
fi
# Cline Desktop is opened from the app menu, so an entry of the same name in
# ~/.local/share/applications, which wins over the package's, runs it in the
# sandbox. It's removed when the package is.
CLINE_DESKTOP="/usr/share/applications/cline-desktop.desktop"
CLINE_ENTRY="$HOME/.local/share/applications/cline-desktop.desktop"
if [ -f "$CLINE_DESKTOP" ]; then
tmp="$(mktemp)"
sed "s#^Exec=.*#Exec=$COREDESKTOP/sandbox/bin/cline-desktop %U#" "$CLINE_DESKTOP" > "$tmp"
if cmp -s "$tmp" "$CLINE_ENTRY"; then
rm -f "$tmp"
else
echo "Running Cline Desktop in the sandbox..."
mkdir -p "$(dirname "$CLINE_ENTRY")" && mv -f "$tmp" "$CLINE_ENTRY" && chmod 644 "$CLINE_ENTRY" || STATUS=1
fi
elif [ -f "$CLINE_ENTRY" ]; then
rm -f "$CLINE_ENTRY"
fi
# Hermes' gateway acts on messages from outside this machine, so it runs in
# the sandbox too: a systemd drop-in starts it through sandbox/bin/hermes. It
# also needs to reach the Matrix server in Hermes' settings, which differs on