From 1d32eab7e36ea25474e16408ef34e7129965edff Mon Sep 17 00:00:00 2001 From: oqyude Date: Tue, 3 Nov 2026 12:37:51 +0300 Subject: [PATCH] =?UTF-8?q?opencode:=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=BE=D0=B5=20=D0=BE?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D1=80=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=B0=D0=B2=20(permissions)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Владелец: «нужно, чтобы разрешения выдавались автоматически, без открытых вкладок и auto-accept». Причина: любой путь вне рабочей папки сессии поднимает `external_directory`, и ход стоит, пока человек не нажмёт кнопку — агент, который работает с хостом (~/.local/share/metaagent, /etc/nixos, другой репозиторий), без присмотра работать не может. Форма — v2 `permissions`, упорядоченный набор {action, resource, effect} (устаревший `permission` с ask|allow|deny не используется). Разрешены external_directory, read, edit, bash, webfetch, websearch. Это заменяет человеческий клик, а не правила безопасности агента: secrets/, *.env, *.pem и .ssh остаются закрытыми политикой, а не запросом. --- home/modules/opencode.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/home/modules/opencode.nix b/home/modules/opencode.nix index 839a435..702e933 100644 --- a/home/modules/opencode.nix +++ b/home/modules/opencode.nix @@ -181,6 +181,32 @@ in ]; }; }; + + # Auto-approval of tool permissions (owner, 2026-11-03: "разрешать всё + # будет автоматически, при этом не нужно оставлять ПК с открытыми + # вкладками и auto-accept"). + # + # WHY: every path outside the session's working directory raises the + # `external_directory` permission and the turn sits waiting for a human + # click. An agent that works on the host (`~/.local/share/metaagent`, + # `/etc/nixos`, another repo) therefore cannot run unattended. + # + # SHAPE: v2 `permissions` is an ORDERED ruleset of + # {action, resource, effect}; the deprecated `permission` object with + # per-tool ask|allow|deny still works but is not used here. + # + # SCOPE, stated plainly: this allows every path and every shell command + # (bash included) without asking. It replaces a human click, not the + # safety rules of the agent itself — `secrets/`, `*.env`, `*.pem` and + # `.ssh/` stay off-limits by policy, not by prompt. + permissions = [ + { action = "external_directory"; resource = "*"; effect = "allow"; } + { action = "read"; resource = "*"; effect = "allow"; } + { action = "edit"; resource = "*"; effect = "allow"; } + { action = "bash"; resource = "*"; effect = "allow"; } + { action = "webfetch"; resource = "*"; effect = "allow"; } + { action = "websearch"; resource = "*"; effect = "allow"; } + ]; }; # ~/.config/opencode/tui.json is a v1 concept. v2 reads CLI/TUI prefs from