Proxies approval mode to goose
This commit is contained in:
@@ -308,6 +308,7 @@ class GooseConnection:
|
||||
|
||||
def __init__(self, cwd: str = ".", forward_thoughts: bool = False, auto_approve_tools: bool = False):
|
||||
self.cwd = cwd
|
||||
self._auto_approve_tools = auto_approve_tools
|
||||
self.client = GooseClient(
|
||||
forward_thoughts=forward_thoughts,
|
||||
auto_approve_tools=auto_approve_tools,
|
||||
@@ -358,6 +359,15 @@ class GooseConnection:
|
||||
session_id = resp.session_id
|
||||
self._sessions[key] = session_id
|
||||
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
|
||||
|
||||
async def close_session(self, key: str) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user