Proxies approval mode to goose

This commit is contained in:
2026-05-09 16:37:33 -04:00
parent 8c098c56fc
commit 2d04e21e7a
+10
View File
@@ -308,6 +308,7 @@ class GooseConnection:
def __init__(self, cwd: str = ".", forward_thoughts: bool = False, auto_approve_tools: bool = False): def __init__(self, cwd: str = ".", forward_thoughts: bool = False, auto_approve_tools: bool = False):
self.cwd = cwd self.cwd = cwd
self._auto_approve_tools = auto_approve_tools
self.client = GooseClient( self.client = GooseClient(
forward_thoughts=forward_thoughts, forward_thoughts=forward_thoughts,
auto_approve_tools=auto_approve_tools, auto_approve_tools=auto_approve_tools,
@@ -358,6 +359,15 @@ class GooseConnection:
session_id = resp.session_id session_id = resp.session_id
self._sessions[key] = session_id self._sessions[key] = session_id
log.info("Created new Goose session for %s: %s", key, session_id[:8]) log.info("Created new Goose session for %s: %s", key, session_id[:8])
# Set the approval mode based on config
mode = "auto" if self._auto_approve_tools else "approve"
try:
await self._conn.set_session_mode(mode_id=mode, session_id=session_id)
log.info("Set session mode to '%s' for %s [%s]", mode, key, session_id[:8])
except Exception:
log.exception("Failed to set session mode for %s", session_id[:8])
return session_id return session_id
async def close_session(self, key: str) -> bool: async def close_session(self, key: str) -> bool: