Skip to content

feat(integrations): Adding Integrations button via OpenInt #6

Open
pellicceama wants to merge 6 commits intofreestyle-sh:mainfrom
openintegrations:openint
Open

feat(integrations): Adding Integrations button via OpenInt #6
pellicceama wants to merge 6 commits intofreestyle-sh:mainfrom
openintegrations:openint

Conversation

@pellicceama
Copy link

@pellicceama pellicceama commented Jun 3, 2025

This adds an integrations button powered by OpenInt. It's an example implementation meant for feedback.

How it works:

  • If there's an OPENINT_API_KEY a Manage Integrations button is rendered. Skipped if not.
  • The System message instructs the LLM to use the /integrations directory to get clients with managed auth for the integration
  • When an end user adds an integration via the button, the onEvent handler ads a system prompt to the history. It contains already tested code with securely managed auth for said integration.

Demo one-shotting a github integration with auth: https://www.loom.com/share/2486d9e2b8ab424b8a462e05ba7df200?sid=78bd2e1d-01cb-4f45-bbcc-80085e1bd6f6

Copy link

@mesa-dot-dev mesa-dot-dev bot left a comment

Choose a reason for hiding this comment

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

What Changed

This PR introduces an "Integrations" button powered by OpenInt. Key changes include:

  • Adding the @openint/connect dependency.
  • Creating a new API endpoint src/app/api/integration/route.ts to generate OpenInt tokens for users, requiring an OPENINT_API_KEY.
  • Implementing a new src/components/IntegrationButton.tsx component that fetches this token and renders the OpenInt ConnectButton. This component also includes an onEvent handler that triggers an onPrompt callback when an integration is connected.
  • Integrating this IntegrationButton into the src/components/chat.tsx interface.
  • Updating src/lib/system.ts to modify the system message. It now instructs the LLM to check the /integrations directory for available clients and guides users to connect integrations if they aren't already set up. When an integration is added, a system prompt with pre-tested code and managed authentication is added to the chat history.

Risks / Concerns

The review identified a couple of minor risks in src/components/IntegrationButton.tsx:

  1. Lack of response status checking before parsing JSON on line 21, which could lead to errors if the API returns a non-2xx status.
  2. Potential for className to be undefined on line 63, which could result in an invalid class string "undefined mb-2".

Additionally, the new /api/integration endpoint and the integration button functionality depend on the OPENINT_API_KEY environment variable being set.

6 files reviewed | 2 comments | Review on Mesa | Edit Reviewer Settings

Sign up for free to 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.

1 participant