mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
syncing with og sim
This commit is contained in:
Generated
+1829
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"@radix-ui/react-accordion": "^1.2.3",
|
||||
"@radix-ui/react-alert-dialog": "^1.1.6",
|
||||
"@radix-ui/react-avatar": "^1.1.3",
|
||||
"@radix-ui/react-checkbox": "^1.1.4",
|
||||
"@radix-ui/react-dialog": "^1.1.6",
|
||||
"@radix-ui/react-dropdown-menu": "^2.1.6",
|
||||
"@radix-ui/react-hover-card": "^1.1.6",
|
||||
"@radix-ui/react-label": "^2.1.2",
|
||||
"@radix-ui/react-popover": "^1.1.6",
|
||||
"@radix-ui/react-progress": "^1.1.2",
|
||||
"@radix-ui/react-scroll-area": "^1.2.3",
|
||||
"@radix-ui/react-select": "^2.1.6",
|
||||
"@radix-ui/react-separator": "^1.1.2",
|
||||
"@radix-ui/react-slot": "^1.1.2",
|
||||
"@radix-ui/react-tabs": "^1.1.3",
|
||||
"@radix-ui/react-tooltip": "^1.1.8",
|
||||
"@react-email/components": "^0.0.34",
|
||||
"@react-email/html": "^0.0.11",
|
||||
"@react-email/render": "^1.0.5",
|
||||
"@react-email/tailwind": "^1.0.4",
|
||||
"framer-motion": "^12.5.0",
|
||||
"radix": "^0.0.0",
|
||||
"react-progress": "^0.0.12"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import { ConfluenceIcon } from '@/components/icons'
|
||||
import { ConfluenceRetrieveResponse } from '@/tools/confluence/retrieve'
|
||||
import { BlockConfig } from '../types'
|
||||
|
||||
export const ConfluenceBlock: BlockConfig<ConfluenceRetrieveResponse> = {
|
||||
type: 'confluence',
|
||||
name: 'Confluence',
|
||||
description: 'Use content from Confluence',
|
||||
longDescription:
|
||||
'Connect to Confluence workspaces to retrieve and search documentation. Access page content, metadata, and integrate Confluence documentation into your workflows.',
|
||||
category: 'tools',
|
||||
bgColor: '#E0E0E0',
|
||||
icon: ConfluenceIcon,
|
||||
subBlocks: [
|
||||
{
|
||||
id: 'domain',
|
||||
title: 'Domain',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter Confluence domain (e.g., yourcompany.atlassian.net)',
|
||||
},
|
||||
{
|
||||
id: 'email',
|
||||
title: 'Email',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter your Atlassian email address',
|
||||
},
|
||||
{
|
||||
id: 'pageId',
|
||||
title: 'Page ID',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter the confluence page ID (e.g., 12340)',
|
||||
},
|
||||
{
|
||||
id: 'apiKey',
|
||||
title: 'OAuth Token',
|
||||
type: 'short-input',
|
||||
layout: 'full',
|
||||
placeholder: 'Enter your Confluence OAuth token',
|
||||
password: true,
|
||||
connectionDroppable: false,
|
||||
},
|
||||
],
|
||||
tools: {
|
||||
access: ['confluence_retrieve'],
|
||||
},
|
||||
inputs: {
|
||||
apiKey: { type: 'string', required: true },
|
||||
pageId: { type: 'string', required: true },
|
||||
domain: { type: 'string', required: true },
|
||||
email: { type: 'string', required: true },
|
||||
},
|
||||
outputs: {
|
||||
response: {
|
||||
type: {
|
||||
ts: 'string',
|
||||
pageId: 'string',
|
||||
content: 'string',
|
||||
title: 'string',
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -30,6 +30,7 @@ import { WhatsAppBlock } from './blocks/whatsapp'
|
||||
import { XBlock } from './blocks/x'
|
||||
import { YouTubeBlock } from './blocks/youtube'
|
||||
import { BlockConfig } from './types'
|
||||
import { ConfluenceBlock } from './blocks/confluence'
|
||||
|
||||
// Export blocks for ease of use
|
||||
export {
|
||||
@@ -63,6 +64,7 @@ export {
|
||||
WhatsAppBlock,
|
||||
GoogleSheetsBlock,
|
||||
PerplexityBlock,
|
||||
ConfluenceBlock,
|
||||
}
|
||||
|
||||
// Registry of all block configurations, alphabetically sorted
|
||||
@@ -97,6 +99,7 @@ const blocks: Record<string, BlockConfig> = {
|
||||
whatsapp: WhatsAppBlock,
|
||||
x: XBlock,
|
||||
youtube: YouTubeBlock,
|
||||
confluence: ConfluenceBlock,
|
||||
}
|
||||
|
||||
// Helper functions
|
||||
|
||||
@@ -1715,3 +1715,24 @@ export function EyeIcon(props: SVGProps<SVGSVGElement>) {
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
export function ConfluenceIcon(props: SVGProps<SVGSVGElement>) {
|
||||
return (
|
||||
<svg
|
||||
{...props}
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 3 21 24"
|
||||
focusable="false"
|
||||
fill="none"
|
||||
aria-hidden="true"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
>
|
||||
<path
|
||||
fill="#1868DB"
|
||||
d="M20.602 20.234c-6.584-3.183-8.507-3.66-11.281-3.66-3.255 0-6.03 1.355-8.507 5.16l-.407.622c-.333.513-.407.696-.407.915s.111.403.518.659l4.18 2.598c.221.146.406.22.591.22.222 0 .37-.11.592-.44l.666-1.024c1.035-1.574 1.96-2.086 3.144-2.086 1.035 0 2.256.293 3.772 1.025l4.365 2.049c.444.22.925.11 1.146-.403l2.072-4.537c.222-.512.074-.842-.444-1.098M1.406 12.22c6.583 3.184 8.507 3.66 11.28 3.66 3.256 0 6.03-1.354 8.508-5.16l.407-.622c.332-.512.406-.695.406-.915s-.11-.402-.518-.658L17.31 5.927c-.222-.147-.407-.22-.592-.22-.222 0-.37.11-.592.44l-.665 1.024c-1.036 1.573-1.96 2.086-3.144 2.086-1.036 0-2.257-.293-3.773-1.025L4.18 6.183c-.444-.22-.925-.11-1.147.402L.962 11.123c-.222.512-.074.841.444 1.098"
|
||||
/>
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import { ToolConfig, ToolResponse } from '../types'
|
||||
|
||||
export interface ConfluenceRetrieveParams {
|
||||
apiKey: string
|
||||
pageId: string
|
||||
domain: string
|
||||
email: string
|
||||
}
|
||||
|
||||
export interface ConfluenceRetrieveResponse extends ToolResponse {
|
||||
output: {
|
||||
ts: string
|
||||
pageId: string
|
||||
content: string
|
||||
title: string
|
||||
}
|
||||
}
|
||||
|
||||
export const confluenceRetrieveTool: ToolConfig<ConfluenceRetrieveParams, ConfluenceRetrieveResponse> = {
|
||||
id: 'confluence_retrieve',
|
||||
name: 'Confluence Retrieve',
|
||||
description: 'Retrieve content from Confluence pages using the Confluence API.',
|
||||
version: '1.0.0',
|
||||
|
||||
params: {
|
||||
apiKey: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
requiredForToolCall: true,
|
||||
description: 'Your Confluence API token',
|
||||
},
|
||||
domain: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
requiredForToolCall: true,
|
||||
description: 'Your Confluence domain (e.g., yourcompany.atlassian.net)',
|
||||
},
|
||||
email: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
requiredForToolCall: true,
|
||||
description: 'Your Atlassian email address',
|
||||
},
|
||||
pageId: {
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Confluence page ID to retrieve',
|
||||
}
|
||||
},
|
||||
|
||||
request: {
|
||||
url: (params: ConfluenceRetrieveParams) => {
|
||||
return `https://${params.domain}/wiki/rest/api/content/${params.pageId}?expand=body.view`;
|
||||
},
|
||||
method: 'GET',
|
||||
headers: (params: ConfluenceRetrieveParams) => {
|
||||
return {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Basic ${Buffer.from(`${params.email}:${params.apiKey}`).toString('base64')}`,
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
transformResponse: async (response: Response) => {
|
||||
const data = await response.json()
|
||||
if (!response.ok) {
|
||||
throw new Error(data.message || 'Confluence API error')
|
||||
}
|
||||
|
||||
const cleanContent = data.body.view.value
|
||||
.replace(/<[^>]*>/g, '')
|
||||
.replace(/ /g, ' ')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
output: {
|
||||
ts: new Date().toISOString(),
|
||||
pageId: data.id,
|
||||
content: cleanContent,
|
||||
title: data.title,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
transformError: (error: any) => {
|
||||
const message = error.message || 'Confluence retrieve failed'
|
||||
return message
|
||||
}
|
||||
}
|
||||
@@ -40,6 +40,7 @@ import { visionTool } from './vision/vision'
|
||||
import { whatsappSendMessageTool } from './whatsapp'
|
||||
import { xReadTool, xSearchTool, xUserTool, xWriteTool } from './x'
|
||||
import { youtubeSearchTool } from './youtube/search'
|
||||
import { confluenceRetrieveTool } from './confluence/retrieve'
|
||||
|
||||
const logger = createLogger('Tools')
|
||||
|
||||
@@ -98,6 +99,7 @@ export const tools: Record<string, ToolConfig> = {
|
||||
guesty_reservation: guestyReservationTool,
|
||||
guesty_guest: guestyGuestTool,
|
||||
perplexity_chat: perplexityChatTool,
|
||||
confluence_retrieve: confluenceRetrieveTool,
|
||||
}
|
||||
|
||||
// Get a tool by its ID
|
||||
|
||||
Reference in New Issue
Block a user