Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: migrate Notion to LobeHub Market (#14578)

AmAzing-b180c03e040b
diff --git a/locales/en-US/setting.json b/locales/en-US/setting.json
index 5858d0b028d..aec753c8800 100644
--- a/locales/en-US/setting.json
+++ b/locales/en-US/setting.json
@@ -1062,6 +1062,8 @@
"tools.lobehubSkill.providers.linear.readme": "Bring the power of Linear directly into your AI assistant. Create and update issues, manage sprints, track project progress, and streamline your development workflow—all through natural conversation.",
"tools.lobehubSkill.providers.microsoft.description": "Outlook Calendar is an integrated scheduling tool within Microsoft Outlook that enables users to create appointments, organize meetings with others, and manage their time and events effectively.",
"tools.lobehubSkill.providers.microsoft.readme": "Integrate with Outlook Calendar to view, create, and manage your events seamlessly. Schedule meetings, check availability, set reminders, and coordinate your time—all through natural language commands.",
+ "tools.lobehubSkill.providers.notion.description": "Notion is a collaborative productivity and note-taking application.",
+ "tools.lobehubSkill.providers.notion.readme": "Connect to Notion to access and manage your workspace. Create pages, search content, update databases, and organize your knowledge base—all through natural conversation with your AI assistant.",
"tools.lobehubSkill.providers.twitter.description": "X (Twitter) is a social media platform for sharing real-time updates, news, and engaging with your audience through posts, replies, and direct messages.",
"tools.lobehubSkill.providers.twitter.readme": "Connect to X (Twitter) to post tweets, manage your timeline, and engage with your audience. Create content, schedule posts, monitor mentions, and build your social media presence through conversational AI.",
"tools.lobehubSkill.providers.vercel.description": "Vercel is a cloud platform for frontend developers, providing hosting and serverless functions to deploy web applications with ease.",
diff --git a/locales/zh-CN/setting.json b/locales/zh-CN/setting.json
index b4d9ce5b5b3..2965533c30f 100644
--- a/locales/zh-CN/setting.json
+++ b/locales/zh-CN/setting.json
@@ -1062,6 +1062,8 @@
"tools.lobehubSkill.providers.linear.readme": "将 Linear 的强大功能引入您的 AI 助手。创建和更新问题、管理冲刺、跟踪项目进度,并通过自然对话优化开发流程。",
"tools.lobehubSkill.providers.microsoft.description": "Outlook 日历是 Microsoft Outlook 中集成的日程安排工具,用户可创建约会、组织会议并高效管理时间和事件。",
"tools.lobehubSkill.providers.microsoft.readme": "集成 Outlook 日历以无缝查看、创建和管理事件。安排会议、查看可用时间、设置提醒,并通过自然语言指令协调时间。",
+ "tools.lobehubSkill.providers.notion.description": "Notion 是一款协作型效率与笔记应用。",
+ "tools.lobehubSkill.providers.notion.readme": "连接 Notion 以访问和管理您的工作区。创建页面、搜索内容、更新数据库,并通过与 AI 助手的自然对话组织知识库。",
"tools.lobehubSkill.providers.twitter.description": "X(原 Twitter)是一个社交媒体平台,用于分享实时动态、新闻,并通过推文、回复和私信与受众互动。",
"tools.lobehubSkill.providers.twitter.readme": "连接 X(原 Twitter)以发布推文、管理时间线并与受众互动。创建内容、安排发布、监控提及,并通过对话式 AI 构建社交媒体影响力。",
"tools.lobehubSkill.providers.vercel.description": "Vercel 是一个面向前端开发者的云平台,提供托管服务和无服务器函数,可轻松部署 Web 应用。",
diff --git a/packages/builtin-tool-activator/src/systemRole.ts b/packages/builtin-tool-activator/src/systemRole.ts
index ea617de0032..4e3a19b8ec9 100644
--- a/packages/builtin-tool-activator/src/systemRole.ts
+++ b/packages/builtin-tool-activator/src/systemRole.ts
@@ -58,21 +58,21 @@ export const systemPrompt = `You have access to a Tools Activator that allows yo
- Task requires environment variables (e.g., \`OPENAI_API_KEY\`, \`GITHUB_TOKEN\`)
- User wants to store or manage sensitive information securely
- Sandbox code execution requires credentials/secrets to be injected
-- User asks to connect to services like GitHub, Linear, Twitter, Microsoft, etc.
+- User asks to connect to services like GitHub, Linear, Microsoft, Notion, Twitter, etc.
- User wants to use, open, connect, or interact with a third-party integration service
(e.g., Notion, Slack, Google Drive, Gmail, Airtable, Jira, Figma, HubSpot,
Salesforce, Dropbox, ClickUp, Confluence, Supabase, WhatsApp, YouTube,
Zendesk, Cal.com, OneDrive, Outlook Mail, Google Sheets, Google Docs)
- User says things like "help me use Notion", "connect my Slack", "open Google Drive",
- "I want to use Jira", "set up Airtable" — these are Klavis-managed OAuth services
+ "I want to use Jira", "set up Airtable" — these are third-party OAuth services
**Decision flow:**
1. **If ANY trigger condition above is met** → Immediately activate \`lobe-creds\`
2. Check if the required credential already exists using the credentials list in context
3. If credential exists → use \`getPlaintextCred\` or \`injectCredsToSandbox\` (for sandbox execution)
4. If credential doesn't exist:
- - For OAuth services (GitHub, Linear, Microsoft, Twitter) → use \`initiateOAuthConnect\`
- - For Klavis-managed services (Notion, Slack, Google Drive, Airtable, Jira, etc.)
+ - For LobeHub OAuth services (GitHub, Linear, Microsoft, Notion, Twitter) → use \`initiateOAuthConnect\`
+ - For Klavis-managed services (Slack, Google Drive, Airtable, Jira, etc.)
→ use \`connectKlavisService\` after activating \`lobe-creds\`. The full list of
available Klavis services is shown in \`<klavis_integrations>\` inside the
lobe-creds system prompt.
diff --git a/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts b/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts
index bc0d7896d71..83766176792 100644
--- a/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts
+++ b/packages/builtin-tool-creds/src/ExecutionRuntime/index.ts
@@ -8,6 +8,7 @@ import type {
InjectCredsToSandboxParams,
SaveCredsParams,
} from '../types';
+import { LOBEHUB_OAUTH_PROVIDER_LIST } from '../types';
/**
* Service interface for Credentials operations
@@ -154,7 +155,7 @@ export class CredsExecutionRuntime {
const providerConfig = getLobehubSkillProviderById(provider);
if (!providerConfig) {
return {
- content: `Unknown OAuth provider: ${provider}. Available providers: github, linear, microsoft, twitter, vercel`,
+ content: `Unknown OAuth provider: ${provider}. Available providers: ${LOBEHUB_OAUTH_PROVIDER_LIST}`,
error: {
message: `Unknown OAuth provider: ${provider}`,
type: 'UnknownProvider',
diff --git a/packages/builtin-tool-creds/src/executor/index.ts b/packages/builtin-tool-creds/src/executor/index.ts
index 184accbe930..83e33037497 100644
--- a/packages/builtin-tool-creds/src/executor/index.ts
+++ b/packages/builtin-tool-creds/src/executor/index.ts
@@ -11,14 +11,14 @@ import { useUserStore } from '@/store/user';
import { userProfileSelectors } from '@/store/user/slices/auth/selectors';
import { CredsIdentifier } from '../manifest';
-import {
- type ConnectKlavisServiceParams,
- CredsApiName,
- type GetPlaintextCredParams,
- type InitiateOAuthConnectParams,
- type InjectCredsToSandboxParams,
- type SaveCredsParams,
+import type {
+ ConnectKlavisServiceParams,
+ GetPlaintextCredParams,
+ InitiateOAuthConnectParams,
+ InjectCredsToSandboxParams,
+ SaveCredsParams,
} from '../types';
+import { CredsApiName, LOBEHUB_OAUTH_PROVIDER_LIST } from '../types';
const log = debug('lobe-creds:executor');
@@ -170,7 +170,7 @@ class CredsExecutor extends BaseExecutor<typeof CredsApiName> {
if (!providerConfig) {
return {
error: {
- message: `Unknown OAuth provider: ${provider}. Available providers: github, linear, microsoft, twitter`,
+ message: `Unknown OAuth provider: ${provider}. Available providers: ${LOBEHUB_OAUTH_PROVIDER_LIST}`,
type: 'UnknownProvider',
},
success: false,
diff --git a/packages/builtin-tool-creds/src/manifest.ts b/packages/builtin-tool-creds/src/manifest.ts
index 55ee30bef1a..07c014c466d 100644
--- a/packages/builtin-tool-creds/src/manifest.ts
+++ b/packages/builtin-tool-creds/src/manifest.ts
@@ -2,7 +2,7 @@ import type { BuiltinToolManifest } from '@lobechat/types';
import type { JSONSchema7 } from 'json-schema';
import { systemPrompt } from './systemRole';
-import { CredsApiName } from './types';
+import { CredsApiName, LOBEHUB_OAUTH_PROVIDER_IDS, LOBEHUB_OAUTH_PROVIDER_LIST } from './types';
export const CredsIdentifier = 'lobe-creds';
@@ -10,14 +10,14 @@ export const CredsManifest: BuiltinToolManifest = {
api: [
{
description:
- 'Connect a Klavis integration service via OAuth. Use this to authorize access to third-party services managed by the Klavis platform (e.g., Notion, Gmail, Google Calendar, Slack). Check the available Klavis services in the credentials context before calling this.',
+ 'Connect a Klavis integration service via OAuth. Use this to authorize access to third-party services managed by the Klavis platform (e.g., Gmail, Google Calendar, Slack). Check the available Klavis services in the credentials context before calling this.',
name: CredsApiName.connectKlavisService,
parameters: {
additionalProperties: false,
properties: {
service: {
description:
- 'The Klavis service identifier to connect (e.g., "notion", "gmail", "google-calendar"). See the available Klavis services list in the credentials context.',
+ 'The Klavis service identifier to connect (e.g., "gmail", "google-calendar"). See the available Klavis services list in the credentials context.',
type: 'string',
},
},
@@ -27,15 +27,14 @@ export const CredsManifest: BuiltinToolManifest = {
},
{
description:
- 'Initiate OAuth connection flow for a third-party service (e.g., Linear, Microsoft Outlook, Twitter/X). Returns an authorization URL that the user must click to authorize. After authorization, the credential will be automatically saved.',
+ 'Initiate OAuth connection flow for a LobeHub Skill provider (e.g., GitHub, Linear, Microsoft Outlook, Notion, Twitter/X). Returns an authorization URL that the user must click to authorize. After authorization, the credential will be automatically saved.',
name: CredsApiName.initiateOAuthConnect,
parameters: {
additionalProperties: false,
properties: {
provider: {
- description:
- 'The OAuth provider ID. Available providers: "linear" (issue tracking), "microsoft" (Outlook Calendar), "twitter" (X/Twitter)',
- enum: ['linear', 'microsoft', 'twitter', 'github'],
+ description: `The OAuth provider ID. Available providers: ${LOBEHUB_OAUTH_PROVIDER_LIST}`,
+ enum: [...LOBEHUB_OAUTH_PROVIDER_IDS],
type: 'string',
},
},
diff --git a/packages/builtin-tool-creds/src/systemRole.ts b/packages/builtin-tool-creds/src/systemRole.ts
index 76567067610..0c4fca2ecc0 100644
--- a/packages/builtin-tool-creds/src/systemRole.ts
+++ b/packages/builtin-tool-creds/src/systemRole.ts
@@ -40,6 +40,7 @@ LobeHub provides built-in OAuth integrations for the following services:
- **github**: GitHub repository and code management. Connect to access repositories, create issues, manage pull requests.
- **linear**: Linear issue tracking and project management. Connect to create/manage issues, track projects.
- **microsoft**: Microsoft Outlook Calendar. Connect to view/create calendar events, manage meetings.
+- **notion**: Notion workspace and knowledge management. Connect to create pages, search content, update databases, and organize workspace knowledge.
- **twitter**: X (Twitter) social media. Connect to post tweets, manage timeline, engage with audience.
When a user mentions they want to use one of these services, use \`initiateOAuthConnect\` to provide them with an authorization link. After they authorize, the credential will be automatically saved and available for use.
@@ -136,7 +137,7 @@ runCommand({
</klavis_integrations>
<klavis_guidelines>
-- **Klavis integrations** are OAuth connections managed by the Klavis platform for third-party services (e.g., Notion, Gmail, Google Calendar, Slack).
+- **Klavis integrations** are OAuth connections managed by the Klavis platform for third-party services (e.g., Gmail, Google Calendar, Slack).
- For **connected** Klavis services: Use the corresponding tools directly. Do NOT ask users for API keys, tokens, or credentials — the authorization is already handled by Klavis.
- For **available but not connected** services: Use \`connectKlavisService\` to initiate the OAuth connection flow via Klavis.
- Klavis credentials **CANNOT** be retrieved via \`getPlaintextCred\` or injected via \`injectCredsToSandbox\` — they are tool-only authorizations managed externally by Klavis.
diff --git a/packages/builtin-tool-creds/src/types.ts b/packages/builtin-tool-creds/src/types.ts
index 7590e53d5e8..50a75753cd5 100644
--- a/packages/builtin-tool-creds/src/types.ts
+++ b/packages/builtin-tool-creds/src/types.ts
@@ -3,7 +3,7 @@ import type { CredType } from '@lobechat/types';
export const CredsApiName = {
/**
* Connect a Klavis integration service via OAuth
- * Initiates Klavis OAuth flow for third-party services like Notion, Gmail, etc.
+ * Initiates Klavis OAuth flow for third-party services like Gmail, Google Calendar, etc.
*/
connectKlavisService: 'connectKlavisService',
@@ -34,6 +34,18 @@ export const CredsApiName = {
export type CredsApiNameType = (typeof CredsApiName)[keyof typeof CredsApiName];
+export const LOBEHUB_OAUTH_PROVIDER_IDS = [
+ 'github',
+ 'linear',
+ 'microsoft',
+ 'notion',
+ 'twitter',
+] as const;
+
+export const LOBEHUB_OAUTH_PROVIDER_LIST = LOBEHUB_OAUTH_PROVIDER_IDS.join(', ');
+
+export type LobehubOAuthProviderId = (typeof LOBEHUB_OAUTH_PROVIDER_IDS)[number];
+
// ==================== Tool Parameter Types ====================
export interface GetPlaintextCredParams {
@@ -49,9 +61,9 @@ export interface GetPlaintextCredParams {
export interface InitiateOAuthConnectParams {
/**
- * The OAuth provider ID (e.g., 'linear', 'microsoft', 'twitter')
+ * The OAuth provider ID (e.g., 'linear', 'microsoft', 'notion', 'twitter')
*/
- provider: string;
+ provider: LobehubOAuthProviderId;
}
export interface InitiateOAuthConnectState {
@@ -148,7 +160,7 @@ export interface SaveCredsState {
export interface ConnectKlavisServiceParams {
/**
- * The Klavis service identifier to connect (e.g., 'notion', 'gmail', 'google-calendar')
+ * The Klavis service identifier to connect (e.g., 'gmail', 'google-calendar')
*/
service: string;
}
diff --git a/packages/const/src/klavis.ts b/packages/const/src/klavis.ts
index b928d8fabfd..c9f964e4229 100644
--- a/packages/const/src/klavis.ts
+++ b/packages/const/src/klavis.ts
@@ -49,17 +49,6 @@ export const KLAVIS_SERVER_TYPES: KlavisServerType[] = [
label: 'Google Calendar',
serverName: Klavis.McpServerName.GoogleCalendar,
},
- {
- author: 'Klavis',
- authorUrl: 'https://klavis.io',
- description: 'Notion is a collaborative productivity and note-taking application',
- icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/notion.svg',
- identifier: 'notion',
- readme:
- 'Connect to Notion to access and manage your workspace. Create pages, search content, update databases, and organize your knowledge base—all through natural conversation with your AI assistant.',
- label: 'Notion',
- serverName: Klavis.McpServerName.Notion,
- },
{
author: 'Klavis',
authorUrl: 'https://klavis.io',
diff --git a/packages/const/src/lobehubSkill.ts b/packages/const/src/lobehubSkill.ts
index 85972010266..64304170656 100644
--- a/packages/const/src/lobehubSkill.ts
+++ b/packages/const/src/lobehubSkill.ts
@@ -81,6 +81,17 @@ export const LOBEHUB_SKILL_PROVIDERS: LobehubSkillProviderType[] = [
'Integrate with Outlook Calendar to view, create, and manage your events seamlessly. Schedule meetings, check availability, set reminders, and coordinate your time—all through natural language commands.',
label: 'Outlook Calendar',
},
+ {
+ author: 'LobeHub',
+ authorUrl: 'https://lobehub.com',
+ defaultVisible: true,
+ description: 'Notion is a collaborative productivity and note-taking application.',
+ icon: 'https://hub-apac-1.lobeobjects.space/assets/logos/notion.svg',
+ id: 'notion',
+ readme:
+ 'Connect to Notion to access and manage your workspace. Create pages, search content, update databases, and organize your knowledge base—all through natural conversation with your AI assistant.',
+ label: 'Notion',
+ },
{
author: 'LobeHub',
authorUrl: 'https://lobehub.com',
diff --git a/packages/const/src/recommendedSkill.ts b/packages/const/src/recommendedSkill.ts
index 6e4fcb09bcd..8352803f414 100644
--- a/packages/const/src/recommendedSkill.ts
+++ b/packages/const/src/recommendedSkill.ts
@@ -18,10 +18,10 @@ export const RECOMMENDED_SKILLS: RecommendedSkillItem[] = [
{ id: 'lobe-agent-documents', type: RecommendedSkillType.Builtin },
{ id: 'lobe-message', type: RecommendedSkillType.Builtin },
// LobeHub skills
+ { id: 'notion', type: RecommendedSkillType.Lobehub },
{ id: 'twitter', type: RecommendedSkillType.Lobehub },
// Klavis skills
{ id: 'gmail', type: RecommendedSkillType.Klavis },
- { id: 'notion', type: RecommendedSkillType.Klavis },
{ id: 'google-drive', type: RecommendedSkillType.Klavis },
{ id: 'google-calendar', type: RecommendedSkillType.Klavis },
{ id: 'slack', type: RecommendedSkillType.Klavis },
diff --git a/packages/const/src/taskTemplate.ts b/packages/const/src/taskTemplate.ts
index 491c58704c1..b08cc8351a5 100644
--- a/packages/const/src/taskTemplate.ts
+++ b/packages/const/src/taskTemplate.ts
@@ -121,7 +121,7 @@ export const taskTemplates: TaskTemplate[] = [
category: 'content-creation',
cronPattern: '0 20 * * 0',
interests: ['writing', 'creator'],
- optionalSkills: [{ provider: 'notion', source: 'klavis' }],
+ optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
},
// engineering
@@ -363,7 +363,7 @@ export const taskTemplates: TaskTemplate[] = [
category: 'product',
cronPattern: '0 15 * * 5',
interests: ['product'],
- requiresSkills: [{ provider: 'notion', source: 'klavis' }],
+ requiresSkills: [{ provider: 'notion', source: 'lobehub' }],
},
// sales-customer
@@ -445,7 +445,7 @@ export const taskTemplates: TaskTemplate[] = [
category: 'hr',
cronPattern: '0 9 * * 1',
interests: ['hr'],
- requiresSkills: [{ provider: 'notion', source: 'klavis' }],
+ requiresSkills: [{ provider: 'notion', source: 'lobehub' }],
},
{
id: 'team-status-weekly',
@@ -480,7 +480,7 @@ export const taskTemplates: TaskTemplate[] = [
category: 'finance-legal',
cronPattern: '0 9 * * 1',
interests: ['finance-legal'],
- requiresSkills: [{ provider: 'notion', source: 'klavis' }],
+ requiresSkills: [{ provider: 'notion', source: 'lobehub' }],
},
{
id: 'regulation-watch-weekly',
@@ -645,7 +645,7 @@ export const taskTemplates: TaskTemplate[] = [
category: 'personal-life',
cronPattern: '0 22 * * *',
interests: ['personal'],
- optionalSkills: [{ provider: 'notion', source: 'klavis' }],
+ optionalSkills: [{ provider: 'notion', source: 'lobehub' }],
},
];
diff --git a/src/features/RecommendTaskTemplates/analytics.test.ts b/src/features/RecommendTaskTemplates/analytics.test.ts
index 27174fa1e53..742cc1e340b 100644
--- a/src/features/RecommendTaskTemplates/analytics.test.ts
+++ b/src/features/RecommendTaskTemplates/analytics.test.ts
@@ -51,7 +51,7 @@ describe('task template analytics helpers', () => {
recommendationBatchId: 'batch-1',
template: makeTemplate({
fallbackPool: 'all_candidates',
- optionalSkills: [{ provider: 'notion', source: 'klavis' }],
+ optionalSkills: [{ provider: 'google-calendar', source: 'klavis' }],
requiresSkills: [{ provider: 'github', source: 'lobehub' }],
source: 'fallback',
}),
diff --git a/src/features/RecommendTaskTemplates/providerMeta.test.ts b/src/features/RecommendTaskTemplates/providerMeta.test.ts
index fef465d910b..5bb334c5981 100644
--- a/src/features/RecommendTaskTemplates/providerMeta.test.ts
+++ b/src/features/RecommendTaskTemplates/providerMeta.test.ts
@@ -10,9 +10,15 @@ describe('getProviderMeta', () => {
expect(meta?.icon).toBeDefined();
});
+ it('resolves notion as a lobehub source provider', () => {
+ const meta = getProviderMeta({ provider: 'notion', source: 'lobehub' });
+ expect(meta).toMatchObject({ label: 'Notion', provider: 'notion', source: 'lobehub' });
+ expect(meta?.icon).toBeDefined();
+ });
+
it('resolves klavis source via KLAVIS_SERVER_TYPES', () => {
- const meta = getProviderMeta({ provider: 'notion', source: 'klavis' });
- expect(meta).toMatchObject({ label: 'Notion', provider: 'notion', source: 'klavis' });
+ const meta = getProviderMeta({ provider: 'gmail', source: 'klavis' });
+ expect(meta).toMatchObject({ label: 'Gmail', provider: 'gmail', source: 'klavis' });
expect(meta?.icon).toBeDefined();
});
@@ -39,7 +45,7 @@ describe('findNextUnconnectedSpec', () => {
it('returns undefined when all specs are connected', () => {
const specs: TaskTemplateSkillRequirement[] = [
{ provider: 'github', source: 'lobehub' },
- { provider: 'notion', source: 'klavis' },
+ { provider: 'notion', source: 'lobehub' },
];
expect(findNextUnconnectedSpec(specs, allConnected)).toBeUndefined();
});
@@ -47,7 +53,7 @@ describe('findNextUnconnectedSpec', () => {
it('returns the first spec when none are connected', () => {
const specs: TaskTemplateSkillRequirement[] = [
{ provider: 'github', source: 'lobehub' },
- { provider: 'notion', source: 'klavis' },
+ { provider: 'notion', source: 'lobehub' },
];
const result = findNextUnconnectedSpec(specs, noneConnected);
expect(result?.provider).toBe('github');
@@ -58,19 +64,19 @@ describe('findNextUnconnectedSpec', () => {
const specs: TaskTemplateSkillRequirement[] = [
{ provider: 'github', source: 'lobehub' },
{ provider: 'linear', source: 'lobehub' },
- { provider: 'notion', source: 'klavis' },
+ { provider: 'notion', source: 'lobehub' },
];
const isConnected = (s: TaskTemplateSkillRequirement) =>
s.provider === 'github' || s.provider === 'linear';
const result = findNextUnconnectedSpec(specs, isConnected);
expect(result?.provider).toBe('notion');
- expect(result?.source).toBe('klavis');
+ expect(result?.source).toBe('lobehub');
});
it('skips specs with unknown providers (no meta) and continues searching', () => {
const specs: TaskTemplateSkillRequirement[] = [
{ provider: 'nonexistent-x', source: 'lobehub' },
- { provider: 'notion', source: 'klavis' },
+ { provider: 'notion', source: 'lobehub' },
];
const result = findNextUnconnectedSpec(specs, noneConnected);
expect(result?.provider).toBe('notion');
diff --git a/src/locales/default/setting.ts b/src/locales/default/setting.ts
index 0ac19db171d..f3a1628c0d1 100644
--- a/src/locales/default/setting.ts
+++ b/src/locales/default/setting.ts
@@ -1343,6 +1343,10 @@ When I am ___, I need ___
'Outlook Calendar is an integrated scheduling tool within Microsoft Outlook that enables users to create appointments, organize meetings with others, and manage their time and events effectively.',
'tools.lobehubSkill.providers.microsoft.readme':
'Integrate with Outlook Calendar to view, create, and manage your events seamlessly. Schedule meetings, check availability, set reminders, and coordinate your time—all through natural language commands.',
+ 'tools.lobehubSkill.providers.notion.description':
+ 'Notion is a collaborative productivity and note-taking application.',
+ 'tools.lobehubSkill.providers.notion.readme':
+ 'Connect to Notion to access and manage your workspace. Create pages, search content, update databases, and organize your knowledge base—all through natural conversation with your AI assistant.',
'tools.lobehubSkill.providers.twitter.description':
'X (Twitter) is a social media platform for sharing real-time updates, news, and engaging with your audience through posts, replies, and direct messages.',
'tools.lobehubSkill.providers.twitter.readme':
diff --git a/src/routes/(main)/home/features/InputArea/SkillInstallBanner.tsx b/src/routes/(main)/home/features/InputArea/SkillInstallBanner.tsx
index c646bb34d77..6162c18f7b8 100644
--- a/src/routes/(main)/home/features/InputArea/SkillInstallBanner.tsx
+++ b/src/routes/(main)/home/features/InputArea/SkillInstallBanner.tsx
@@ -14,7 +14,7 @@ import { useToolStore } from '@/store/tool';
// Bump this id when the banner content changes so dismissing the old
// variant does not hide the new one.
-export const SKILL_INSTALL_BANNER_ID = 'skill-install-v1';
+export const SKILL_INSTALL_BANNER_ID = 'skill-install-v2';
const ICON_SIZE = 16;
const AVATAR_SIZE = 24;
@@ -74,9 +74,9 @@ const BANNER_SKILL_IDS = [
{ id: 'google-drive', type: 'klavis' },
{ id: 'google-calendar', type: 'klavis' },
{ id: 'slack', type: 'klavis' },
- { id: 'notion', type: 'klavis' },
+ { id: 'notion', type: 'lobehub' },
{ id: 'twitter', type: 'lobehub' },
- { id: 'github', type: 'klavis' },
+ { id: 'github', type: 'lobehub' },
] as const;
const SkillInstallBanner = memo(() => {
diff --git a/src/server/services/klavis/index.test.ts b/src/server/services/klavis/index.test.ts
new file mode 100644
index 00000000000..0e10ce62e0d
--- /dev/null
+++ b/src/server/services/klavis/index.test.ts
@@ -0,0 +1,68 @@
+// @vitest-environment node
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { KlavisService } from './index';
+
+const mocks = vi.hoisted(() => ({
+ PluginModel: vi.fn(),
+ pluginQuery: vi.fn(),
+}));
+
+vi.mock('@/database/models/plugin', () => ({
+ PluginModel: mocks.PluginModel,
+}));
+
+vi.mock('@/libs/klavis', () => ({
+ getKlavisClient: vi.fn(),
+ isKlavisClientAvailable: vi.fn(() => true),
+}));
+
+vi.mock('debug', () => ({
+ default: vi.fn(() => vi.fn()),
+}));
+
+describe('KlavisService', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mocks.PluginModel.mockImplementation(() => ({
+ query: mocks.pluginQuery,
+ }));
+ });
+
+ describe('getKlavisManifests', () => {
+ it('filters deprecated Klavis providers from server manifests', async () => {
+ mocks.pluginQuery.mockResolvedValue([
+ {
+ customParams: { klavis: { isAuthenticated: true, serverName: 'Gmail' } },
+ identifier: 'gmail',
+ manifest: {
+ api: [{ name: 'sendEmail', parameters: { type: 'object' } }],
+ meta: { title: 'Gmail' },
+ },
+ },
+ {
+ customParams: { klavis: { isAuthenticated: true, serverName: 'Notion' } },
+ identifier: 'notion',
+ manifest: {
+ api: [{ name: 'notion-search', parameters: { type: 'object' } }],
+ meta: { title: 'Notion' },
+ },
+ },
+ {
+ customParams: { klavis: { isAuthenticated: false, serverName: 'Google Calendar' } },
+ identifier: 'google-calendar',
+ manifest: {
+ api: [{ name: 'listEvents', parameters: { type: 'object' } }],
+ meta: { title: 'Google Calendar' },
+ },
+ },
+ ]);
+
+ const service = new KlavisService({ db: {} as any, userId: 'user-1' });
+
+ const manifests = await service.getKlavisManifests();
+
+ expect(manifests.map((manifest) => manifest.identifier)).toEqual(['gmail']);
+ });
+ });
+});
diff --git a/src/server/services/klavis/index.ts b/src/server/services/klavis/index.ts
index c0081c9eafd..6851da1c270 100644
--- a/src/server/services/klavis/index.ts
+++ b/src/server/services/klavis/index.ts
@@ -1,5 +1,6 @@
-import { type LobeToolManifest } from '@lobechat/context-engine';
-import { type LobeChatDatabase } from '@lobechat/database';
+import { KLAVIS_SERVER_TYPES } from '@lobechat/const';
+import type { LobeToolManifest } from '@lobechat/context-engine';
+import type { LobeChatDatabase } from '@lobechat/database';
import debug from 'debug';
import { PluginModel } from '@/database/models/plugin';
@@ -8,6 +9,8 @@ import { type ToolExecutionResult } from '@/server/services/toolExecution/types'
const log = debug('lobe-server:klavis-service');
+const VALID_KLAVIS_IDENTIFIERS = new Set(KLAVIS_SERVER_TYPES.map((type) => type.identifier));
+
export interface KlavisToolExecuteParams {
args: Record<string, any>;
/** Tool identifier (same as Klavis server identifier, e.g., 'google-calendar') */
@@ -188,9 +191,11 @@ export class KlavisService {
// Get all plugins from database
const allPlugins = await this.pluginModel.query();
- // Filter plugins that have klavis customParams and are authenticated
+ // Filter plugins that have klavis customParams, are still supported, and are authenticated.
const klavisPlugins = allPlugins.filter(
- (plugin) => plugin.customParams?.klavis?.isAuthenticated === true,
+ (plugin) =>
+ VALID_KLAVIS_IDENTIFIERS.has(plugin.identifier) &&
+ plugin.customParams?.klavis?.isAuthenticated === true,
);
log('getKlavisManifests: found %d authenticated Klavis plugins', klavisPlugins.length);
diff --git a/src/server/services/market/index.test.ts b/src/server/services/market/index.test.ts
index 8e6f27bf814..ee92125803e 100644
--- a/src/server/services/market/index.test.ts
+++ b/src/server/services/market/index.test.ts
@@ -395,6 +395,25 @@ describe('MarketService', () => {
expect(manifests[0].identifier).toBe('linear');
});
+ it('should use the static Notion provider label for manifests', async () => {
+ const service = new MarketService();
+ (service as any).market.connect.listConnections = vi.fn().mockResolvedValue({
+ connections: [
+ { icon: 'notion-icon', providerId: 'notion', providerName: 'User Workspace' },
+ ],
+ });
+ (service as any).market.skills.listTools = vi.fn().mockResolvedValue({
+ tools: [{ description: 'Search workspace', inputSchema: {}, name: 'notion-search' }],
+ });
+
+ const manifests = await service.getLobehubSkillManifests();
+ expect(manifests).toHaveLength(1);
+ expect(manifests[0].meta).toMatchObject({
+ description: 'LobeHub Skill: Notion',
+ title: 'Notion',
+ });
+ });
+
it('should skip connections where listTools returns empty', async () => {
const service = new MarketService();
(service as any).market.connect.listConnections = vi.fn().mockResolvedValue({
diff --git a/src/server/services/market/index.ts b/src/server/services/market/index.ts
index 516e618cef1..0366b19a151 100644
--- a/src/server/services/market/index.ts
+++ b/src/server/services/market/index.ts
@@ -542,6 +542,7 @@ export class MarketService {
github: 'GitHub',
linear: 'Linear',
microsoft: 'Outlook Calendar',
+ notion: 'Notion',
twitter: 'X (Twitter)',
vercel: 'Vercel',
};
diff --git a/src/server/services/taskTemplate/index.test.ts b/src/server/services/taskTemplate/index.test.ts
index e720c56e950..79499a6d84c 100644
--- a/src/server/services/taskTemplate/index.test.ts
+++ b/src/server/services/taskTemplate/index.test.ts
@@ -154,20 +154,20 @@ describe('isTemplateSkillSourceEligible', () => {
});
it('keeps templates whose only source is enabled', () => {
- const t = makeTemplate({ requiresSkills: [{ provider: 'notion', source: 'klavis' }] });
- expect(isTemplateSkillSourceEligible(t, new Set(['klavis']))).toBe(true);
+ const t = makeTemplate({ requiresSkills: [{ provider: 'notion', source: 'lobehub' }] });
+ expect(isTemplateSkillSourceEligible(t, new Set(['lobehub']))).toBe(true);
});
it('drops templates whose source is not in enabledSkillSources', () => {
- const t = makeTemplate({ requiresSkills: [{ provider: 'notion', source: 'klavis' }] });
- expect(isTemplateSkillSourceEligible(t, new Set(['lobehub']))).toBe(false);
+ const t = makeTemplate({ requiresSkills: [{ provider: 'notion', source: 'lobehub' }] });
+ expect(isTemplateSkillSourceEligible(t, new Set(['klavis']))).toBe(false);
});
it('requires every source for multi-skill templates', () => {
const t = makeTemplate({
requiresSkills: [
- { provider: 'github', source: 'lobehub' },
- { provider: 'notion', source: 'klavis' },
+ { provider: 'notion', source: 'lobehub' },
+ { provider: 'google-calendar', source: 'klavis' },
],
});
expect(isTemplateSkillSourceEligible(t, new Set(['lobehub']))).toBe(false);