feat(apps): add Composio and Gmail connectors (#12342)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work.
> - App connections need both direct providers and managed provider
hubs.
> - The grant layer now defines safe credential ownership.
> - Composio needs parent and child connection lifecycle rules, and
Gmail needs governed setup.
> - This pull request adds both connector families on the grant
foundation.
> - The benefit is broader app access without weakening credential
isolation.

## Linked Issues or Issue Description

Refs #11965

This is stack 4 of 11. It depends on stack 3 and replaces another
reviewable part of #11965.

## What Changed

- Add Composio parent and child connection support.
- Add Gmail connection setup and governance.
- Preserve credential paths and remove duplicate binding declarations.
- Cascade Composio pause and restore actions to child connections.

## Verification

- `pnpm --filter @paperclipai/server typecheck`
- `pnpm --filter @paperclipai/server exec vitest run
src/__tests__/tool-access-service.test.ts`
- Result: 164 tests passed.
- `pnpm build`

## Risks

- Parent lifecycle changes can affect every Composio child.
- The service restores only children whose provider accounts remain
active.
- Credential binding paths are normalized before secret resolution.

> I checked `ROADMAP.md`. This stack continues the existing app
connection work from #11965 and does not duplicate another planned item.

## Model Used

OpenAI Codex, GPT-5. The runtime model ID and context window were not
exposed. The model used reasoning, tool use, and code execution.

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links
- [x] My branch name describes the change and contains no internal
Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [x] All Paperclip CI gates are green
- [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

---------

Co-authored-by: Paperclip <noreply@paperclip.ing>
This commit is contained in:
DottaandPaperclip authored and GitHub committed 2026-08-29 12:08:33 -05:00
1 parent 20ccf3f476
commit 6244e4cf32
54 files changed
+5110 -91

No files matched your search

+26 -2
View File
@@ -1,3 +1,9 @@
import type {
ComposioConnectLinkResponse,
ComposioDisconnectResponse,
ComposioServiceStatusResponse,
ComposioServicesResponse,
} from "@/pages/apps/composio-services";
import type {
ToolApplication,
ToolConnection,
@@ -359,9 +365,9 @@ export const toolsApi = {
api.patch<ToolConnection>(`/tool-connections/${connectionId}`, input),
// Removal is a credential-revoking teardown (PAP-17119), so the response
// carries the cleanup receipt alongside the archived connection.
archiveConnection: (connectionId: string) =>
archiveConnection: (connectionId: string, options: { confirmComposioChildren?: boolean } = {}) =>
api.delete<ToolConnection & { removal: ToolConnectionRemovalSummary }>(
`/tool-connections/${connectionId}`,
`/tool-connections/${connectionId}${options.confirmComposioChildren ? "?confirmComposioChildren=true" : ""}`,
),
checkConnectionHealth: (connectionId: string) =>
api.post<ToolConnectionHealthCheckResult>(`/tool-connections/${connectionId}/health-check`, {}),
@@ -393,6 +399,24 @@ export const toolsApi = {
api.get<ToolConnectionTestCallStatus>(
`/tool-connections/${connectionId}/test-calls/${actionRequestId}`,
),
// --- Composio services (PAP-17865) ---
// A Composio connection brokers many toolkits; these four read and change the
// per-toolkit state the Services tab renders.
listComposioServices: (connectionId: string) =>
api.get<ComposioServicesResponse>(`/tool-connections/${connectionId}/services`),
startComposioServiceConnect: (connectionId: string, toolkitSlug: string) =>
api.post<ComposioConnectLinkResponse>(
`/tool-connections/${connectionId}/services/${encodeURIComponent(toolkitSlug)}/connect`,
{},
),
getComposioServiceStatus: (connectionId: string, toolkitSlug: string) =>
api.get<ComposioServiceStatusResponse>(
`/tool-connections/${connectionId}/services/${encodeURIComponent(toolkitSlug)}/status`,
),
disconnectComposioService: (connectionId: string, toolkitSlug: string) =>
api.delete<ComposioDisconnectResponse>(
`/tool-connections/${connectionId}/services/${encodeURIComponent(toolkitSlug)}`,
),
importMcpJson: (companyId: string, body: { mcpJson: unknown }) =>
api.post<McpJsonImportPreview>(`/companies/${companyId}/tools/mcp/import-json`, body),
listStdioTemplates: (companyId: string) =>