Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID=
COMPOSIO_GOOGLE_SHEETS_AUTH_CONFIG_ID=
COMPOSIO_GOOGLE_DOCS_AUTH_CONFIG_ID=
COMPOSIO_GOOGLE_DRIVE_AUTH_CONFIG_ID=
COMPOSIO_TWITTER_AUTH_CONFIG_ID=
COMPOSIO_LINKEDIN_AUTH_CONFIG_ID=

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: .env.example is missing COMPOSIO_YOUTUBE_AUTH_CONFIG_ID despite code/tests already treating YouTube auth config as supported.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .env.example, line 38:

<comment>`.env.example` is missing `COMPOSIO_YOUTUBE_AUTH_CONFIG_ID` despite code/tests already treating YouTube auth config as supported.</comment>

<file context>
@@ -34,6 +34,8 @@ COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID=
 COMPOSIO_GOOGLE_DOCS_AUTH_CONFIG_ID=
 COMPOSIO_GOOGLE_DRIVE_AUTH_CONFIG_ID=
+COMPOSIO_TWITTER_AUTH_CONFIG_ID=
+COMPOSIO_LINKEDIN_AUTH_CONFIG_ID=
 
 # Slack (coding agent)
</file context>


# Slack (coding agent)
SLACK_BOT_TOKEN=
Expand Down
48 changes: 48 additions & 0 deletions lib/composio/connectors/__tests__/buildAuthConfigs.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { describe, it, expect, beforeEach, afterEach } from "vitest";
import { buildAuthConfigs } from "../buildAuthConfigs";

const AUTH_CONFIG_ENV_KEYS = [
"COMPOSIO_TIKTOK_AUTH_CONFIG_ID",
"COMPOSIO_INSTAGRAM_AUTH_CONFIG_ID",
"COMPOSIO_GOOGLE_SHEETS_AUTH_CONFIG_ID",
"COMPOSIO_GOOGLE_DOCS_AUTH_CONFIG_ID",
"COMPOSIO_GOOGLE_DRIVE_AUTH_CONFIG_ID",
"COMPOSIO_YOUTUBE_AUTH_CONFIG_ID",
"COMPOSIO_TWITTER_AUTH_CONFIG_ID",
"COMPOSIO_LINKEDIN_AUTH_CONFIG_ID",
];

describe("buildAuthConfigs", () => {
let saved: Record<string, string | undefined>;

beforeEach(() => {
// Snapshot then clear every auth-config env var so the test is isolated
// from whatever .env.local provides.
saved = {};
for (const key of AUTH_CONFIG_ENV_KEYS) {
saved[key] = process.env[key];
delete process.env[key];
}
});

afterEach(() => {
for (const key of AUTH_CONFIG_ENV_KEYS) {
if (saved[key] === undefined) delete process.env[key];
else process.env[key] = saved[key];
}
});

it("returns undefined when no auth-config env vars are set", () => {
expect(buildAuthConfigs()).toBeUndefined();
});

it("reads the Twitter and LinkedIn auth configs from env", () => {
process.env.COMPOSIO_TWITTER_AUTH_CONFIG_ID = "ac_twitter_123";
process.env.COMPOSIO_LINKEDIN_AUTH_CONFIG_ID = "ac_linkedin_456";

expect(buildAuthConfigs()).toEqual({
twitter: "ac_twitter_123",
linkedin: "ac_linkedin_456",
});
});
});
22 changes: 20 additions & 2 deletions lib/composio/connectors/__tests__/getConnectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ describe("getConnectors", () => {

expect(getComposioClient).toHaveBeenCalled();
expect(mockComposio.create).toHaveBeenCalledWith("account-123", {
toolkits: ["googlesheets", "googledrive", "googledocs", "tiktok", "instagram", "youtube"],
toolkits: [
"googlesheets",
"googledrive",
"googledocs",
"tiktok",
"instagram",
"youtube",
"twitter",
"linkedin",
],
});
expect(result).toEqual([
{
Expand Down Expand Up @@ -92,7 +101,16 @@ describe("getConnectors", () => {
await getConnectors("account-123");

expect(mockComposio.create).toHaveBeenCalledWith("account-123", {
toolkits: ["googlesheets", "googledrive", "googledocs", "tiktok", "instagram", "youtube"],
toolkits: [
"googlesheets",
"googledrive",
"googledocs",
"tiktok",
"instagram",
"youtube",
"twitter",
"linkedin",
],
authConfigs: {
tiktok: "ac_tiktok_123",
instagram: "ac_instagram_456",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ describe("getConnectorsHandler", () => {
googlesheets: "Google Sheets",
googledrive: "Google Drive",
googledocs: "Google Docs",
twitter: "X (Twitter)",
linkedin: "LinkedIn",
},
});
});
Expand Down
6 changes: 6 additions & 0 deletions lib/composio/connectors/buildAuthConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,11 @@ export function buildAuthConfigs(): Record<string, string> | undefined {
if (process.env.COMPOSIO_YOUTUBE_AUTH_CONFIG_ID) {
configs.youtube = process.env.COMPOSIO_YOUTUBE_AUTH_CONFIG_ID;
}
if (process.env.COMPOSIO_TWITTER_AUTH_CONFIG_ID) {
configs.twitter = process.env.COMPOSIO_TWITTER_AUTH_CONFIG_ID;
}
if (process.env.COMPOSIO_LINKEDIN_AUTH_CONFIG_ID) {
configs.linkedin = process.env.COMPOSIO_LINKEDIN_AUTH_CONFIG_ID;
}
return Object.keys(configs).length > 0 ? configs : undefined;
}
2 changes: 2 additions & 0 deletions lib/composio/connectors/getConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const SUPPORTED_TOOLKITS = [
"tiktok",
"instagram",
"youtube",
"twitter",
"linkedin",
];

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/composio/connectors/getConnectorsHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const CONNECTOR_DISPLAY_NAMES: Record<string, string> = {
googlesheets: "Google Sheets",
googledrive: "Google Drive",
googledocs: "Google Docs",
twitter: "X (Twitter)",
linkedin: "LinkedIn",
};

/**
Expand Down
9 changes: 8 additions & 1 deletion lib/composio/toolRouter/__tests__/getComposioTools.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
import { getComposioTools } from "../getComposioTools";
import { getComposioTools, ENABLED_TOOLKITS } from "../getComposioTools";

import { getComposioClient } from "../../client";
import { getCallbackUrl } from "../../getCallbackUrl";
Expand Down Expand Up @@ -235,3 +235,10 @@ describe("getComposioTools", () => {
expect(result).toHaveProperty("COMPOSIO_MULTI_EXECUTE_TOOL");
});
});

describe("ENABLED_TOOLKITS", () => {
it("includes twitter and linkedin", () => {
expect(ENABLED_TOOLKITS).toContain("twitter");
expect(ENABLED_TOOLKITS).toContain("linkedin");
});
});
2 changes: 2 additions & 0 deletions lib/composio/toolRouter/getComposioTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ export const ENABLED_TOOLKITS = [
"tiktok",
"instagram",
"youtube",
"twitter",
"linkedin",
];

const SHARED_ACCOUNT_ID = "recoup-shared-767f498e-e1e9-43c6-a152-a96ae3bd8d07";
Expand Down
Loading