refactor(agents): colocate gmail + calendar connector tools into subagent slices

Gmail and Calendar are handled together because both Google connectors share
the _build_credentials helper that lived in shared/tools/gmail.

- relocate the gmail helpers (_get_token_encryption, _build_credentials,
  _gmail_headers, _format_gmail_summary) into the gmail subagent slice
  (tools/_helpers.py); repoint gmail search_emails/read_email to it.
- calendar search_events now imports _build_credentials from the gmail slice
  (preserving the existing cross-connector Google-auth dependency).
- repoint both dead tools/__init__ shims at the live local impls.
- fix tests/e2e native_google fake: it patched the dead shared
  google_calendar.*.build paths; point it at the live subagent calendar
  modules (which actually import googleapiclient build).
- delete dead shared/tools/{gmail,google_calendar} twins.

shared/tools now has zero connector dirs. agents unit suite green (942).
This commit is contained in:
CREDO23 2026-06-04 20:09:37 +02:00
parent 70fb19890b
commit 64512c604d
20 changed files with 112 additions and 3456 deletions

View file

@ -429,9 +429,18 @@ def install(active_patches: list[Any]) -> None:
("app.connectors.google_drive.client.build", _fake_build),
("app.connectors.google_gmail_connector.build", _fake_build),
("app.connectors.google_calendar_connector.build", _fake_build),
("app.agents.shared.tools.google_calendar.create_event.build", _fake_build),
("app.agents.shared.tools.google_calendar.update_event.build", _fake_build),
("app.agents.shared.tools.google_calendar.delete_event.build", _fake_build),
(
"app.agents.multi_agent_chat.subagents.connectors.calendar.tools.create_event.build",
_fake_build,
),
(
"app.agents.multi_agent_chat.subagents.connectors.calendar.tools.update_event.build",
_fake_build,
),
(
"app.agents.multi_agent_chat.subagents.connectors.calendar.tools.delete_event.build",
_fake_build,
),
("googleapiclient.http.MediaIoBaseDownload", _FakeMediaIoBaseDownload),
(
"app.connectors.google_drive.client._build_thread_http",