Skip to content

Commit 0da2d5d

Browse files
committed
Add server-side Composio managed auth
1 parent 6758b72 commit 0da2d5d

23 files changed

Lines changed: 5010 additions & 12 deletions

File tree

agents/base2/base2.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { buildArray } from '@codebuff/common/util/array'
2+
import { COMPOSIO_META_TOOL_NAMES } from '@codebuff/common/constants/composio'
23
import {
34
FREEBUFF_GEMINI_THINKER_AGENT_ID,
45
FREEBUFF_GEMINI_THINKER_INSTRUCTIONS_PROMPT,
@@ -113,6 +114,7 @@ export function createBase2(
113114
'set_output',
114115
'list_directory',
115116
'glob',
117+
...COMPOSIO_META_TOOL_NAMES,
116118
),
117119
spawnableAgents: buildArray(
118120
!isMax && 'file-picker',
@@ -157,6 +159,7 @@ Current date: ${formatCurrentDate(new Date())}.
157159
- **Be careful about terminal commands:** Be careful about instructing subagents to run terminal commands that could be destructive or have effects that are hard to undo (e.g. git push, git commit, running any scripts -- especially ones that could alter production environments (!), installing packages globally, etc). Don't run any of these effectful commands unless the user explicitly asks you to.
158160
- **Do what the user asks:** If the user asks you to do something, even running a risky terminal command, do it.
159161
- **Don't use set_output:** The set_output tool is for spawned subagents to report results. Don't use it yourself.
162+
- **External apps:** When Composio tools are available and the user asks to work with connected apps or services like Gmail, Google Calendar, GitHub, Slack, Linear, or Notion, use them to search for the right app tools, help the user connect their account, and execute the requested action.
160163
161164
# Code Editing Mandates
162165

agents/types/secret-agent-definition.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { AgentDefinition } from './agent-definition'
22
import type * as Tools from './tools'
3+
import type { ComposioMetaToolName } from '@codebuff/common/constants/composio'
34
export type { Tools }
45

56
export type AllToolNames =
@@ -9,9 +10,12 @@ export type AllToolNames =
910
| 'create_plan'
1011
| 'spawn_agent_inline'
1112
| 'update_subgoal'
13+
| ComposioMetaToolName
1214

13-
export interface SecretAgentDefinition
14-
extends Omit<AgentDefinition, 'toolNames'> {
15+
export interface SecretAgentDefinition extends Omit<
16+
AgentDefinition,
17+
'toolNames'
18+
> {
1519
/** Tools this agent can use. */
1620
toolNames?: AllToolNames[]
1721
}

bun.lock

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common/src/constants/composio.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export const COMPOSIO_API_KEY_ENV_VAR = 'COMPOSIO_API_KEY'
2+
3+
export const COMPOSIO_META_TOOL_NAMES = [
4+
'COMPOSIO_MANAGE_CONNECTIONS',
5+
'COMPOSIO_MULTI_EXECUTE_TOOL',
6+
'COMPOSIO_REMOTE_BASH_TOOL',
7+
'COMPOSIO_REMOTE_WORKBENCH',
8+
'COMPOSIO_SEARCH_TOOLS',
9+
'COMPOSIO_GET_TOOL_SCHEMAS',
10+
] as const
11+
12+
export type ComposioMetaToolName = (typeof COMPOSIO_META_TOOL_NAMES)[number]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CREATE TABLE "composio_session" (
2+
"user_id" text PRIMARY KEY NOT NULL,
3+
"session_id" text NOT NULL,
4+
"created_at" timestamp with time zone DEFAULT now() NOT NULL,
5+
"updated_at" timestamp with time zone DEFAULT now() NOT NULL,
6+
CONSTRAINT "composio_session_session_id_unique" UNIQUE("session_id")
7+
);
8+
--> statement-breakpoint
9+
ALTER TABLE "composio_session" ADD CONSTRAINT "composio_session_user_id_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."user"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
10+
CREATE INDEX "idx_composio_session_session_id" ON "composio_session" USING btree ("session_id");

0 commit comments

Comments
 (0)