feat(chat): per-chat permission modes for Claude, Codex and OpenCode

This commit is contained in:
2026-10-24 18:16:10 +01:00
parent ef575898f2
commit 6d430948a6
29 changed files with 1512 additions and 3 deletions
+8 -1
View File
@@ -2,7 +2,8 @@
"""Deterministic stand-in for the Claude Code CLI's SDK stdio protocol.
It implements only what Pipelines' adapter uses: initialize, stream-json turns,
can_use_tool approvals, AskUserQuestion, set_model, interrupt, usage queries and
can_use_tool approvals, AskUserQuestion, set_model, set_permission_mode,
interrupt, usage queries and
a session transcript. It never contacts a provider.
"""
import json
@@ -157,6 +158,12 @@ def handle(line):
elif subtype == "set_model":
state["model"] = request.get("model")
respond(value.get("request_id"), {"model": request.get("model")})
elif subtype == "set_permission_mode":
mode_log = os.environ.get("FAKE_CLAUDE_MODE_LOG")
if mode_log:
with open(mode_log, "a", encoding="utf-8") as log:
log.write(request.get("mode", "") + "\n")
respond(value.get("request_id"), {"mode": request.get("mode")})
elif subtype == "interrupt":
respond(value.get("request_id"), {"still_queued": [], "cancelled": []})
if state["pending"]: