Skip to content

feat: Artist TikTok Connections via Composio - #170

Merged
sweetmantech merged 47 commits into
testfrom
feat/artist-composio-connections
Feb 12, 2026
Merged

feat: Artist TikTok Connections via Composio#170
sweetmantech merged 47 commits into
testfrom
feat/artist-composio-connections

Conversation

@sidneyswift

@sidneyswiftsidneyswift commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add API endpoints for artist connector management (GET, POST authorize, DELETE, POST complete)
  • Add callback URL handling for artist-connectors OAuth flow
  • Enable TikTok in Tool Router with artist-specific connections
  • Wire up artistId in chat tool setup for per-artist Composio connections

Stories Implemented

  • US-003: GET /api/artist-connectors endpoint
  • US-004: POST /api/artist-connectors/authorize endpoint
  • US-005: DELETE /api/artist-connectors endpoint
  • US-006: Add artist-connectors callback URL destination
  • US-007: Add TikTok to enabled toolkits
  • US-008: Modify createSession to accept connectedAccounts
  • US-009: Wire up artistId in chat tool setup
  • US-014: POST /api/artist-connectors/complete endpoint

Test plan

  • Connect TikTok for artist via Artist Settings > Connections
  • Send chat message "What are my TikTok stats?" with artist selected
  • Verify AI uses TikTok tools with artist's connection
  • Switch to different artist without TikTok and verify appropriate response

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Entity-specific connector management: optional account selection for authorize, list, and disconnect flows.
    • TikTok artist connector support with artist-only rules and artist connection mapping.
    • Configurable connector authorization: custom callback URLs and auth-specific configs.
    • Ownership verification on disconnects and expanded access checks across account/artist/workspace/organization.
    • Tool sessions can include artist connections to enable artist-specific tools.

sidneyswiftand others added 9 commits January 28, 2026 20:51
- Add artist_composio_connections type to database.types.ts
- Create selectArtistComposioConnection.ts (single lookup by artist+toolkit)
- Create selectArtistComposioConnections.ts (all connections for artist)
- Create insertArtistComposioConnection.ts (upsert on unique constraint)
- Create deleteArtistComposioConnection.ts (delete by id)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ALLOWED_ARTIST_CONNECTORS constant with 'tiktok' as first connector
- Create checkAccountArtistAccess function in Recoup-API (migrated from Recoup-Chat)
- Create getArtistConnectors function to return connector status for artists
- Create GET /api/artist-connectors endpoint with:
- Bearer token and API key auth via validateAuthContext
- Artist access validation via checkAccountArtistAccess
- Returns list of allowed connectors with connection status
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add validateAuthorizeArtistConnectorBody.ts with Zod schema for request validation
- Add authorizeArtistConnector.ts to generate OAuth URLs via Composio
- Add POST /api/artist-connectors/authorize route with auth and access control
- Callback URL redirects to /chat?artist_connected={artistId}&toolkit={slug}
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add DELETE handler to disconnect an artist's connector from Composio
- Create validateDisconnectArtistConnectorBody.ts with Zod schema
- Create verifyArtistConnectorOwnership.ts to check connection ownership
- Create disconnectArtistConnector.ts to remove from Composio and DB
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add 'artist-connectors' to CallbackDestination type in getCallbackUrl.ts
- Add artistId and toolkit to CallbackOptions interface
- Handle artist-connectors destination returning /chat?artist_connected={artistId}&toolkit={toolkit}
- Update authorizeArtistConnector.ts to use getCallbackUrl instead of local function
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add 'tiktok' to the ENABLED_TOOLKITS array so TikTok tools are available
in Tool Router sessions, enabling the LLM to access TikTok data.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add artistConnections parameter to createToolRouterSession (Record<string, string> | undefined)
- Pass connectedAccounts option to composio.create() call
- Update getComposioTools to accept and pass artistConnections parameter
- Add JSDoc documentation for the new parameter
This enables artist-specific Composio connections to be used when creating
Tool Router sessions, allowing the LLM to use the correct TikTok account
for the selected artist.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Modified getComposioTools to accept artistId parameter
- If artistId provided, fetches artist_composio_connections from DB
- Transforms connections to Record<string, string> format
- Passes artistConnections to createToolRouterSession
- Modified setupToolsForRequest to extract artistId from body
- Passes artistId through to getComposioTools
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add POST /api/artist-connectors/complete endpoint to finalize OAuth flow:
- Query Composio for the user's connected account after OAuth redirect
- Store the connection mapping in artist_composio_connections table
- Add Zod validation for request body (artist_id, toolkit_slug)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel

vercelBot commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
recoup-apiReadyReadyPreviewFeb 12, 2026 2:56pm

Request Review

@coderabbitai

coderabbitaiBot commented Jan 29, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Routes were refactored to delegate connector operations to centralized handlers; connector APIs were made entity-scoped (account/artist), with new validators, access checks, artist-connector restrictions, and tooling to surface and pass artist connections to the tool router.

Changes

Cohort / File(s)Summary
API Routes
app/api/connectors/authorize/route.ts, app/api/connectors/route.ts
Route implementations simplified to delegate to new handler functions; in-route validation, parsing, and response construction removed; function signatures shortened.
Handlers
lib/composio/connectors/authorizeConnectorHandler.ts, lib/composio/connectors/getConnectorsHandler.ts, lib/composio/connectors/disconnectConnectorHandler.ts
New Next.js handlers perform request validation, CORS/auth checks, call core connector functions, and return standardized JSON responses with error handling.
Validators / Request Parsing
lib/composio/connectors/validateAuthorizeConnectorRequest.ts, .../validateGetConnectorsRequest.ts, .../validateDisconnectConnectorRequest.ts, .../validateGetConnectorsQuery.ts, .../validateAuthorizeConnectorBody.ts, .../validateDisconnectConnectorBody.ts
New/updated validators validate body/query, enforce optional account_id flows, perform access/ownership checks, and return NextResponse on validation/auth failures.
Core Connector APIs
lib/composio/connectors/authorizeConnector.ts, getConnectors.ts, disconnectConnector.ts, verifyConnectorOwnership.ts
Core APIs changed to entity-centric signatures with options (authConfigs, customCallbackUrl, verifyOwnershipFor, allowedToolkits/displayNames); getConnectors ensures requested toolkits appear in results.
Public Exports
lib/composio/connectors/index.ts
Public API expanded to export new option types and utilities (GetConnectorsOptions, AuthorizeConnectorOptions, DisconnectConnectorOptions, ALLOWED_ARTIST_CONNECTORS, AllowedArtistConnector, verifyConnectorOwnership).
Artist Connector Utilities
lib/composio/connectors/isAllowedArtistConnector.ts
New constant/type and type-guard for allowed artist connectors (e.g., tiktok).
Tool Router
lib/composio/toolRouter/createToolRouterSession.ts, .../getArtistConnectionsFromComposio.ts, .../getTools.ts, lib/composio/toolRouter/index.ts
Tool router accepts/persists artistConnections; new helper fetches artist connections; getComposioTools gains optional artistId flow with access checks.
Access Control Helpers
lib/auth/checkAccountAccess.ts, lib/supabase/account_artist_ids/checkAccountArtistAccess.ts, lib/supabase/account_workspace_ids/checkAccountWorkspaceAccess.ts
New centralized account-access checks and Supabase-backed helpers for artist/workspace access used by validators.
Chat Integration
lib/chat/setupToolsForRequest.ts
Flow updated to pass artistId into tool retrieval so artist-specific connections can be applied.

Sequence Diagram(s)

sequenceDiagram
participant Client
participant Route as /api/connectors/authorize
participant Handler as authorizeConnectorHandler
participant Validator as validateAuthorizeConnectorRequest
participant Auth as validateAuthContext
participant Access as checkAccountArtistAccess
participant Core as authorizeConnector
participant Composio as Composio API
Client->>Route: POST
Route->>Handler: delegate request
Handler->>Validator: validate + auth
Validator->>Auth: validateAuthContext
Auth-->>Validator: accountId
alt account_id provided
Validator->>Access: checkAccountArtistAccess
alt denied
Access-->>Validator: false
Validator-->>Handler: NextResponse(403)
Handler-->>Client: 403
else granted
Validator-->>Handler: params{composioEntityId, connector, authConfigs?, callbackUrl?}
end
else no account_id
Validator-->>Handler: params{composioEntityId, connector, callbackUrl?}
end
Handler->>Core: authorizeConnector(composioEntityId, connector, options)
Core->>Composio: create session
Composio-->>Core: session+redirectUrl
Core-->>Handler: result
Handler-->>Client: 200 {success:true, data}
Loading
sequenceDiagram
participant Client
participant Route as /api/connectors
participant Handler as getConnectorsHandler
participant Validator as validateGetConnectorsRequest
participant Auth as validateAuthContext
participant Access as checkAccountArtistAccess
participant Core as getConnectors
participant Composio as Composio API
Client->>Route: GET?account_id=...
Route->>Handler: delegate request
Handler->>Validator: validate + auth + query
Validator->>Auth: validateAuthContext
Auth-->>Validator: accountId
alt account_id provided
Validator->>Access: checkAccountArtistAccess
alt denied
Access-->>Validator: false
Validator-->>Handler: NextResponse(403)
Handler-->>Client: 403
else granted
Validator-->>Handler: params{composioEntityId, allowedToolkits?}
end
else no account_id
Validator-->>Handler: params{composioEntityId: accountId}
end
Handler->>Core: getConnectors(composioEntityId, options)
Core->>Composio: fetch connectors
Composio-->>Core: connectors[]
Core-->>Handler: connectors[]
Handler-->>Client: 200 {success:true, connectors}
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

✨ Routes hand off, validators stand guard,
Accounts and artists chart maps unmarred,
TikTok slips in with a friendly nod,
Handlers hum tidy, options applaud,
Small pieces align—clean, steady, and starred.

🚥 Pre-merge checks | ❌ 1
❌ Failed checks (1 warning)
Check nameStatusExplanationResolution
Solid & Clean Code⚠️ WarningPR contains DRY violations with 222+ lines of duplicated validator orchestration patterns and OCP violations with hardcoded connector-specific configuration scattered throughout.Extract common validator orchestration into reusable helper functions and consolidate connector metadata into a central configuration object to enable extension without code modification.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/artist-composio-connections

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actionsBot commented Jan 29, 2026

Copy link
Copy Markdown

Braintrust eval report

Catalog Opportunity Analysis Evaluation (HEAD-1770003038)

ScoreAverageImprovementsRegressions
Catalog_availability44.3% (+22pp)3 🟢-
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration40.1s (-2.18s)3 🟢2 🔴

Catalog Songs Count Evaluation (HEAD-1770003038)

ScoreAverageImprovementsRegressions
AnswerCorrectness18.8% (0pp)1 🟢2 🔴
Factuality66.7% (-33pp)-1 🔴
Llm_calls4 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration13.8s (+2.95s)-3 🔴

First Week Album Sales Evaluation (HEAD-1770003038)

ScoreAverageImprovementsRegressions
Factuality35% (-20pp)-2 🔴
Llm_calls1 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration14.58s (-0.85s)1 🟢3 🔴

Memory & Storage Tools Evaluation (HEAD-1770003038)

ScoreAverageImprovementsRegressions
Tools_called0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration11.43s (-5.71s)1 🟢-

Monthly Listeners Tracking Evaluation (HEAD-1770003038)

ScoreAverageImprovementsRegressions
AnswerSimilarity79.1%--
Llm_calls2--
Tool_calls0--
Errors0--
Llm_errors0--
Tool_errors0--
Prompt_tokens0tok--
Prompt_cached_tokens0tok--
Prompt_cache_creation_tokens0tok--
Completion_tokens0tok--
Completion_reasoning_tokens0tok--
Total_tokens0tok--
Duration13.87s--

Search Web Tool Evaluation (HEAD-1770003038)

ScoreAverageImprovementsRegressions
AnswerCorrectness28.4% (+0pp)5 🟢6 🔴
Llm_calls3 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration22.75s (+1.26s)6 🟢5 🔴

Social Scraping Evaluation (HEAD-1770003037)

ScoreAverageImprovementsRegressions
Tools_called0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration22.92s (+0.34s)2 🟢4 🔴

Spotify Followers Evaluation (HEAD-1770003037)

ScoreAverageImprovementsRegressions
AnswerCorrectness20.6% (0pp)2 🟢3 🔴
Llm_calls3 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Completion_accepted_prediction_tokens0tok (+0tok)--
Completion_rejected_prediction_tokens0tok (+0tok)--
Completion_audio_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration13.35s (+1.11s)2 🟢3 🔴

Spotify Tools Evaluation (HEAD-1770003037)

ScoreAverageImprovementsRegressions
Tools_called0% (+0pp)--
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration26.63s (-3.43s)1 🟢1 🔴

TikTok Analytics Questions Evaluation (HEAD-1770003037)

ScoreAverageImprovementsRegressions
Question_answered0% (-5pp)-1 🔴
Llm_calls0 (+0)--
Tool_calls0 (+0)--
Errors0 (+0)--
Llm_errors0 (+0)--
Tool_errors0 (+0)--
Prompt_tokens0tok (+0tok)--
Prompt_cached_tokens0tok (+0tok)--
Prompt_cache_creation_tokens0tok (+0tok)--
Completion_tokens0tok (+0tok)--
Completion_reasoning_tokens0tok (+0tok)--
Total_tokens0tok (+0tok)--
Duration14.3s (-3.27s)1 🟢1 🔴

- Remove artist_composio_connections table and related code
- Remove /complete endpoint (no longer needed)
- Use artistId directly as Composio entity when connecting
- Query Composio at chat time for artist connections
- Pass connections to user session via connectedAccounts
Composio is now the source of truth for artist connections.
- Add TDD to code principles
- Document thin route files pattern (follow /api/pulses)
- Document handler functions pattern
- Document combined request validators (validateXxxRequest)
- Add DRY guidance for entity types (use options, not duplicate files)
- Add file naming convention (name after function, not constant)
- Add testing requirements for API changes
- Merge test branch to sync with base
- Update test to expect (accountId, artistId, roomId) signature
- Add test case for when artistId is provided
sweetmantechand others added 3 commits February 11, 2026 23:40
Consolidates the authorize endpoint into the main connectors route
to match the updated API docs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…Access
SRP: each query is now its own file with dedicated tests:
- selectAccountArtistId (account_artist_ids)
- selectArtistOrganizationIds (artist_organization_ids)
- selectAccountOrganizationIds (account_organization_ids)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
const { artist_id, connector } = validated;

// Verify connector is allowed
if (!isAllowedArtistConnector(connector)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRP

  • actual: multiple validations happening in the API endpoint definition file.
  • required: move any verification of input params into the validateAuthorizeArtistConnectorBody function.


// Verify user has access to this artist
const hasAccess = await checkAccountArtistAccess(accountId, artist_id);
if (!hasAccess) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRP

  • actual: multiple validations happening in the API endpoint definition file.
  • required: move any verification of input params into the validateAuthorizeArtistConnectorBody function.
  • Check out other example endpoints like /api/pulses to see a cleaner implementation.

Comment threadapp/api/artist-connectors/route.ts Outdated
* @param request - The incoming request
* @returns List of connectors with connection status
*/
export async function GET(request: NextRequest): Promise<NextResponse> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRP

  • actual: endpoint file also defines the handler
  • required: standalone handler function similar to /api/pulses

Comment threadapp/api/artist-connectors/route.ts Outdated
const { searchParams } = new URL(request.url);
const artistId = searchParams.get("artist_id");

if (!artistId) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRP

  • actual: multiple validations happening in the API endpoint definition file.
  • required: move any verification of input params into a verify function.
  • Check out other example endpoints like /api/pulses to see a cleaner implementation.

Comment threadapp/api/artist-connectors/route.ts Outdated

// Verify user has access to this artist
const hasAccess = await checkAccountArtistAccess(accountId, artistId);
if (!hasAccess) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SRP

  • actual: multiple validations happening in the API endpoint definition file.
  • required: move any verification of input params into a verify function.
  • Check out other example endpoints like /api/pulses to see a cleaner implementation.

});
vi.mocked(checkAccountArtistAccess).mockResolvedValue(true);

const request = new NextRequest(`http://localhost/api/connectors?entity_id=${mockEntityId}`);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we using entity_id instead of account_id?

* Custom auth configs for toolkits that require custom OAuth credentials.
* e.g., { tiktok: "ac_xxxxx" }
*/
authConfigs?: Record<string, string>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is authConfigs a generic Record<string, string> type instead of a more explicit typing?

*
* Why: Used by the /api/connectors/authorize endpoint to let users
* connect from the settings page (not in-chat).
* The entityId is an account ID - either the caller's own account or

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using entityId instead of accountId?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are any changes needed to this file?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/supabase/account_workspace_ids/checkAccountWorkspaceAccess.ts -
refactor to selectAccountWorkspaces

…Access
SRP: standalone supabase query with dedicated tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use "account" terminology consistently per codebase conventions.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
No caller uses this option — YAGNI.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The comment claimed ownership verification that the function doesn't do.
Updated to reflect it only validates request shape.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Not a direct Supabase query — it aggregates supabase calls, so it
belongs in the domain layer.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntWorkspaceId directly
YAGNI — the wrapper was just !!data. The sole consumer now calls
the supabase query directly.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
*/
export async function authorizeConnector(
userId: string,
entityId: string,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lib/composio/connectors/authorizeConnector.ts is there any reason
this needs to be called entityId? We prefer accountId

Comment on lines +60 to +78

// If filtering, ensure we return all allowed toolkits (even if not in Composio response)
if (allowedToolkits) {
const existingSlugs = new Set(connectors.map(c => c.slug));
for (const slug of allowedToolkits) {
if (!existingSlugs.has(slug)) {
connectors.push({
slug,
name: displayNames[slug] || slug,
isConnected: false,
connectedAccountId: undefined,
});
}
}
// Filter to only allowed and maintain order
return allowedToolkits.map(slug => connectors.find(c => c.slug === slug)!);
}

return connectors;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are the bottom filtering doing in
lib/composio/connectors/getConnectors.ts

Image

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds custom Zod messages and missing_fields/status fields to error
responses for both POST and DELETE /api/connectors validation, matching
the standard pattern used across other API endpoints.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@sidneyswift@sweetmantech