SurfSense/surfsense_backend/app/agents
CREDO23 6671c91841 multi_agent_chat/permissions: persist 'always' decisions to trusted-tools list
Until now an "Always Allow" reply only updated the in-memory runtime
ruleset, evaporating after the session ended. Persist it to the
existing connector.config['trusted_tools'] list so the next session's
fetch_user_allowlist_rulesets picks it up and the user is never asked
again for the same (connector, tool) pair.

- TrustedToolSaver + make_trusted_tool_saver(user_id) in
  user_tool_allowlist: opens its own session via async_session_maker
  per call, logs and swallows failures (in-memory promotion is the
  canonical "always" path, durable persistence is opportunistic).

- PermissionMiddleware._process is now pure: returns
  (state_update, list[_AlwaysPromotion]). aafter_model awaits the
  saver for each promotion; after_model discards them. Promotions are
  only emitted for tools whose metadata exposes mcp_connector_id, so
  native tools and KB FS ops are correctly skipped.

- main_agent factory builds the saver once per turn and stashes it in
  dependencies["trusted_tool_saver"]; pack_subagent and the KB
  middleware stack forward it through build_permission_mw.

- Renamed pm._process(state, None) call sites in two existing tests to
  pm.after_model(state, None) so they exercise the public hook
  contract instead of the now-tuple-returning private method.
2026-05-15 14:07:08 +02:00
..
autocomplete Merge commit '61f4d05cd1' into dev_mod 2026-04-28 09:25:41 -07:00
multi_agent_chat multi_agent_chat/permissions: persist 'always' decisions to trusted-tools list 2026-05-15 14:07:08 +02:00
new_chat multi_agent_chat/permissions: surface MCP tool metadata into ask interrupts 2026-05-15 11:28:06 +02:00
podcaster cloud: added openrouter integration with global configs 2026-04-15 23:46:29 -07:00
video_presentation cloud: added openrouter integration with global configs 2026-04-15 23:46:29 -07:00
__init__.py feat: Added chat_history to researcher agent 2025-05-10 20:06:19 -07:00