Compare commits

..

6 Commits

Author SHA1 Message Date
Siddharth Ganesan
cca3d2d900 Mapping from superagnet to actions 2026-01-13 21:28:36 -08:00
Siddharth Ganesan
edd0874326 Fix newlines 2026-01-13 21:26:20 -08:00
Siddharth Ganesan
50f84dffa7 Fix 2026-01-13 21:24:10 -08:00
Siddharth Ganesan
8af735b2e5 Litn 2026-01-13 21:20:17 -08:00
Siddharth Ganesan
a54d2ffb8a Cleanup options 2026-01-13 21:20:02 -08:00
Siddharth Ganesan
356aaf1a03 Clean up 2026-01-13 21:01:48 -08:00
44 changed files with 356 additions and 11310 deletions

View File

@@ -1897,19 +1897,6 @@ export function TelegramIcon(props: SVGProps<SVGSVGElement>) {
)
}
export function TinybirdIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg {...props} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'>
<rect x='0' y='0' width='24' height='24' fill='#2EF598' rx='6' />
<g transform='translate(2, 2) scale(0.833)'>
<path d='M25 2.64 17.195.5 14.45 6.635z' fill='#1E7F63' />
<path d='M17.535 17.77 10.39 15.215 6.195 25.5z' fill='#1E7F63' />
<path d='M0 11.495 17.535 17.77 20.41 4.36z' fill='#1F2437' />
</g>
</svg>
)
}
export function ClayIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg {...props} xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 400 400'>

View File

@@ -107,7 +107,6 @@ import {
SupabaseIcon,
TavilyIcon,
TelegramIcon,
TinybirdIcon,
TranslateIcon,
TrelloIcon,
TTSIcon,
@@ -231,8 +230,6 @@ export const blockTypeToIconMap: Record<string, IconComponent> = {
supabase: SupabaseIcon,
tavily: TavilyIcon,
telegram: TelegramIcon,
thinking: BrainIcon,
tinybird: TinybirdIcon,
translate: TranslateIcon,
trello: TrelloIcon,
tts: TTSIcon,

View File

@@ -12,7 +12,7 @@ Sim automatically calculates costs for all workflow executions, providing transp
Every workflow execution includes two cost components:
**Base Execution Charge**: $0.005 per execution
**Base Execution Charge**: $0.001 per execution
**AI Model Usage**: Variable cost based on token consumption
```javascript
@@ -48,40 +48,40 @@ The model breakdown shows:
<Tabs items={['Hosted Models', 'Bring Your Own API Key']}>
<Tab>
**Hosted Models** - Sim provides API keys with a 1.1x pricing multiplier for Agent blocks:
**Hosted Models** - Sim provides API keys with a 1.4x pricing multiplier for Agent blocks:
**OpenAI**
| Model | Base Price (Input/Output) | Hosted Price (Input/Output) |
|-------|---------------------------|----------------------------|
| GPT-5.1 | $1.25 / $10.00 | $1.38 / $11.00 |
| GPT-5 | $1.25 / $10.00 | $1.38 / $11.00 |
| GPT-5 Mini | $0.25 / $2.00 | $0.28 / $2.20 |
| GPT-5 Nano | $0.05 / $0.40 | $0.06 / $0.44 |
| GPT-4o | $2.50 / $10.00 | $2.75 / $11.00 |
| GPT-4.1 | $2.00 / $8.00 | $2.20 / $8.80 |
| GPT-4.1 Mini | $0.40 / $1.60 | $0.44 / $1.76 |
| GPT-4.1 Nano | $0.10 / $0.40 | $0.11 / $0.44 |
| o1 | $15.00 / $60.00 | $16.50 / $66.00 |
| o3 | $2.00 / $8.00 | $2.20 / $8.80 |
| o4 Mini | $1.10 / $4.40 | $1.21 / $4.84 |
| GPT-5.1 | $1.25 / $10.00 | $1.75 / $14.00 |
| GPT-5 | $1.25 / $10.00 | $1.75 / $14.00 |
| GPT-5 Mini | $0.25 / $2.00 | $0.35 / $2.80 |
| GPT-5 Nano | $0.05 / $0.40 | $0.07 / $0.56 |
| GPT-4o | $2.50 / $10.00 | $3.50 / $14.00 |
| GPT-4.1 | $2.00 / $8.00 | $2.80 / $11.20 |
| GPT-4.1 Mini | $0.40 / $1.60 | $0.56 / $2.24 |
| GPT-4.1 Nano | $0.10 / $0.40 | $0.14 / $0.56 |
| o1 | $15.00 / $60.00 | $21.00 / $84.00 |
| o3 | $2.00 / $8.00 | $2.80 / $11.20 |
| o4 Mini | $1.10 / $4.40 | $1.54 / $6.16 |
**Anthropic**
| Model | Base Price (Input/Output) | Hosted Price (Input/Output) |
|-------|---------------------------|----------------------------|
| Claude Opus 4.5 | $5.00 / $25.00 | $5.50 / $27.50 |
| Claude Opus 4.1 | $15.00 / $75.00 | $16.50 / $82.50 |
| Claude Sonnet 4.5 | $3.00 / $15.00 | $3.30 / $16.50 |
| Claude Sonnet 4.0 | $3.00 / $15.00 | $3.30 / $16.50 |
| Claude Haiku 4.5 | $1.00 / $5.00 | $1.10 / $5.50 |
| Claude Opus 4.5 | $5.00 / $25.00 | $7.00 / $35.00 |
| Claude Opus 4.1 | $15.00 / $75.00 | $21.00 / $105.00 |
| Claude Sonnet 4.5 | $3.00 / $15.00 | $4.20 / $21.00 |
| Claude Sonnet 4.0 | $3.00 / $15.00 | $4.20 / $21.00 |
| Claude Haiku 4.5 | $1.00 / $5.00 | $1.40 / $7.00 |
**Google**
| Model | Base Price (Input/Output) | Hosted Price (Input/Output) |
|-------|---------------------------|----------------------------|
| Gemini 3 Pro Preview | $2.00 / $12.00 | $2.20 / $13.20 |
| Gemini 2.5 Pro | $1.25 / $10.00 | $1.38 / $11.00 |
| Gemini 2.5 Flash | $0.30 / $2.50 | $0.33 / $2.75 |
| Gemini 3 Pro Preview | $2.00 / $12.00 | $2.80 / $16.80 |
| Gemini 2.5 Pro | $1.25 / $10.00 | $1.75 / $14.00 |
| Gemini 2.5 Flash | $0.30 / $2.50 | $0.42 / $3.50 |
*The 1.1x multiplier covers infrastructure and API management costs.*
*The 1.4x multiplier covers infrastructure and API management costs.*
</Tab>
<Tab>

View File

@@ -44,8 +44,6 @@ Send a message to an external A2A-compatible agent.
| `message` | string | Yes | Message to send to the agent |
| `taskId` | string | No | Task ID for continuing an existing task |
| `contextId` | string | No | Context ID for conversation continuity |
| `data` | string | No | Structured data to include with the message \(JSON string\) |
| `files` | array | No | Files to include with the message |
| `apiKey` | string | No | API key for authentication |
#### Output

View File

@@ -103,8 +103,6 @@
"supabase",
"tavily",
"telegram",
"thinking",
"tinybird",
"translate",
"trello",
"tts",

View File

@@ -1,70 +0,0 @@
---
title: Tinybird
description: Send events and query data with Tinybird
---
import { BlockInfoCard } from "@/components/ui/block-info-card"
<BlockInfoCard
type="tinybird"
color="#2EF598"
/>
## Usage Instructions
Interact with Tinybird using the Events API to stream JSON or NDJSON events, or use the Query API to execute SQL queries against Pipes and Data Sources.
## Tools
### `tinybird_events`
Send events to a Tinybird Data Source using the Events API. Supports JSON and NDJSON formats with optional gzip compression.
#### Input
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `base_url` | string | Yes | Tinybird API base URL \(e.g., https://api.tinybird.co or https://api.us-east.tinybird.co\) |
| `datasource` | string | Yes | Name of the Tinybird Data Source to send events to |
| `data` | string | Yes | Data to send as NDJSON \(newline-delimited JSON\) or JSON string. Each event should be a valid JSON object. |
| `wait` | boolean | No | Wait for database acknowledgment before responding. Enables safer retries but introduces latency. Defaults to false. |
| `format` | string | No | Format of the events data: "ndjson" \(default\) or "json" |
| `compression` | string | No | Compression format: "none" \(default\) or "gzip" |
| `token` | string | Yes | Tinybird API Token with DATASOURCE:APPEND or DATASOURCE:CREATE scope |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `successful_rows` | number | Number of rows successfully ingested |
| `quarantined_rows` | number | Number of rows quarantined \(failed validation\) |
### `tinybird_query`
Execute SQL queries against Tinybird Pipes and Data Sources using the Query API.
#### Input
| Parameter | Type | Required | Description |
| --------- | ---- | -------- | ----------- |
| `base_url` | string | Yes | Tinybird API base URL \(e.g., https://api.tinybird.co\) |
| `query` | string | Yes | SQL query to execute. Specify your desired output format \(e.g., FORMAT JSON, FORMAT CSV, FORMAT TSV\). JSON format provides structured data, while other formats return raw text. |
| `pipeline` | string | No | Optional pipe name. When provided, enables SELECT * FROM _ syntax |
| `token` | string | Yes | Tinybird API Token with PIPE:READ scope |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `data` | json | Query result data. For FORMAT JSON: array of objects. For other formats \(CSV, TSV, etc.\): raw text string. |
| `rows` | number | Number of rows returned \(only available with FORMAT JSON\) |
| `statistics` | json | Query execution statistics - elapsed time, rows read, bytes read \(only available with FORMAT JSON\) |
## Notes
- Category: `tools`
- Type: `tinybird`

View File

@@ -0,0 +1,150 @@
import type {
Artifact,
Message,
Task,
TaskArtifactUpdateEvent,
TaskState,
TaskStatusUpdateEvent,
} from '@a2a-js/sdk'
import { createLogger } from '@sim/logger'
import { type NextRequest, NextResponse } from 'next/server'
import { z } from 'zod'
import { createA2AClient, extractTextContent, isTerminalState } from '@/lib/a2a/utils'
import { checkHybridAuth } from '@/lib/auth/hybrid'
import { generateRequestId } from '@/lib/core/utils/request'
export const dynamic = 'force-dynamic'
const logger = createLogger('A2ASendMessageStreamAPI')
const A2ASendMessageStreamSchema = z.object({
agentUrl: z.string().min(1, 'Agent URL is required'),
message: z.string().min(1, 'Message is required'),
taskId: z.string().optional(),
contextId: z.string().optional(),
apiKey: z.string().optional(),
})
export async function POST(request: NextRequest) {
const requestId = generateRequestId()
try {
const authResult = await checkHybridAuth(request, { requireWorkflowId: false })
if (!authResult.success) {
logger.warn(
`[${requestId}] Unauthorized A2A send message stream attempt: ${authResult.error}`
)
return NextResponse.json(
{
success: false,
error: authResult.error || 'Authentication required',
},
{ status: 401 }
)
}
logger.info(
`[${requestId}] Authenticated A2A send message stream request via ${authResult.authType}`,
{
userId: authResult.userId,
}
)
const body = await request.json()
const validatedData = A2ASendMessageStreamSchema.parse(body)
logger.info(`[${requestId}] Sending A2A streaming message`, {
agentUrl: validatedData.agentUrl,
hasTaskId: !!validatedData.taskId,
hasContextId: !!validatedData.contextId,
})
const client = await createA2AClient(validatedData.agentUrl, validatedData.apiKey)
const message: Message = {
kind: 'message',
messageId: crypto.randomUUID(),
role: 'user',
parts: [{ kind: 'text', text: validatedData.message }],
...(validatedData.taskId && { taskId: validatedData.taskId }),
...(validatedData.contextId && { contextId: validatedData.contextId }),
}
const stream = client.sendMessageStream({ message })
let taskId = ''
let contextId: string | undefined
let state: TaskState = 'working'
let content = ''
let artifacts: Artifact[] = []
let history: Message[] = []
for await (const event of stream) {
if (event.kind === 'message') {
const msg = event as Message
content = extractTextContent(msg)
taskId = msg.taskId || taskId
contextId = msg.contextId || contextId
state = 'completed'
} else if (event.kind === 'task') {
const task = event as Task
taskId = task.id
contextId = task.contextId
state = task.status.state
artifacts = task.artifacts || []
history = task.history || []
const lastAgentMessage = history.filter((m) => m.role === 'agent').pop()
if (lastAgentMessage) {
content = extractTextContent(lastAgentMessage)
}
} else if ('status' in event) {
const statusEvent = event as TaskStatusUpdateEvent
state = statusEvent.status.state
} else if ('artifact' in event) {
const artifactEvent = event as TaskArtifactUpdateEvent
artifacts.push(artifactEvent.artifact)
}
}
logger.info(`[${requestId}] A2A streaming message completed`, {
taskId,
state,
artifactCount: artifacts.length,
})
return NextResponse.json({
success: isTerminalState(state) && state !== 'failed',
output: {
content,
taskId,
contextId,
state,
artifacts,
history,
},
})
} catch (error) {
if (error instanceof z.ZodError) {
logger.warn(`[${requestId}] Invalid request data`, { errors: error.errors })
return NextResponse.json(
{
success: false,
error: 'Invalid request data',
details: error.errors,
},
{ status: 400 }
)
}
logger.error(`[${requestId}] Error in A2A streaming:`, error)
return NextResponse.json(
{
success: false,
error: error instanceof Error ? error.message : 'Streaming failed',
},
{ status: 500 }
)
}
}

View File

@@ -1,4 +1,4 @@
import type { DataPart, FilePart, Message, Part, Task, TextPart } from '@a2a-js/sdk'
import type { Message, Task } from '@a2a-js/sdk'
import { createLogger } from '@sim/logger'
import { type NextRequest, NextResponse } from 'next/server'
import { z } from 'zod'
@@ -10,20 +10,11 @@ export const dynamic = 'force-dynamic'
const logger = createLogger('A2ASendMessageAPI')
const FileInputSchema = z.object({
type: z.enum(['file', 'url']),
data: z.string(),
name: z.string(),
mime: z.string().optional(),
})
const A2ASendMessageSchema = z.object({
agentUrl: z.string().min(1, 'Agent URL is required'),
message: z.string().min(1, 'Message is required'),
taskId: z.string().optional(),
contextId: z.string().optional(),
data: z.string().optional(),
files: z.array(FileInputSchema).optional(),
apiKey: z.string().optional(),
})
@@ -60,100 +51,18 @@ export async function POST(request: NextRequest) {
hasContextId: !!validatedData.contextId,
})
let client
try {
client = await createA2AClient(validatedData.agentUrl, validatedData.apiKey)
logger.info(`[${requestId}] A2A client created successfully`)
} catch (clientError) {
logger.error(`[${requestId}] Failed to create A2A client:`, clientError)
return NextResponse.json(
{
success: false,
error: `Failed to connect to agent: ${clientError instanceof Error ? clientError.message : 'Unknown error'}`,
},
{ status: 502 }
)
}
const parts: Part[] = []
const textPart: TextPart = { kind: 'text', text: validatedData.message }
parts.push(textPart)
if (validatedData.data) {
try {
const parsedData = JSON.parse(validatedData.data)
const dataPart: DataPart = { kind: 'data', data: parsedData }
parts.push(dataPart)
} catch (parseError) {
logger.warn(`[${requestId}] Failed to parse data as JSON, skipping DataPart`, {
error: parseError instanceof Error ? parseError.message : String(parseError),
})
}
}
if (validatedData.files && validatedData.files.length > 0) {
for (const file of validatedData.files) {
if (file.type === 'url') {
const filePart: FilePart = {
kind: 'file',
file: {
name: file.name,
mimeType: file.mime,
uri: file.data,
},
}
parts.push(filePart)
} else if (file.type === 'file') {
let bytes = file.data
let mimeType = file.mime
if (file.data.startsWith('data:')) {
const match = file.data.match(/^data:([^;]+);base64,(.+)$/)
if (match) {
mimeType = mimeType || match[1]
bytes = match[2]
} else {
bytes = file.data
}
}
const filePart: FilePart = {
kind: 'file',
file: {
name: file.name,
mimeType: mimeType || 'application/octet-stream',
bytes,
},
}
parts.push(filePart)
}
}
}
const client = await createA2AClient(validatedData.agentUrl, validatedData.apiKey)
const message: Message = {
kind: 'message',
messageId: crypto.randomUUID(),
role: 'user',
parts,
parts: [{ kind: 'text', text: validatedData.message }],
...(validatedData.taskId && { taskId: validatedData.taskId }),
...(validatedData.contextId && { contextId: validatedData.contextId }),
}
let result
try {
result = await client.sendMessage({ message })
logger.info(`[${requestId}] A2A sendMessage completed`, { resultKind: result?.kind })
} catch (sendError) {
logger.error(`[${requestId}] Failed to send A2A message:`, sendError)
return NextResponse.json(
{
success: false,
error: `Failed to send message: ${sendError instanceof Error ? sendError.message : 'Unknown error'}`,
},
{ status: 502 }
)
}
const result = await client.sendMessage({ message })
if (result.kind === 'message') {
const responseMessage = result as Message

View File

@@ -221,9 +221,7 @@ export function Chat() {
exportChatCSV,
} = useChatStore()
const hasConsoleHydrated = useTerminalConsoleStore((state) => state._hasHydrated)
const entriesFromStore = useTerminalConsoleStore((state) => state.entries)
const entries = hasConsoleHydrated ? entriesFromStore : []
const { entries } = useTerminalConsoleStore()
const { isExecuting } = useExecutionStore()
const { handleRunWorkflow, handleCancelExecution } = useWorkflowExecution()
const { data: session } = useSession()

View File

@@ -320,14 +320,12 @@ export function Terminal() {
} = useTerminalStore()
const isExpanded = useTerminalStore((state) => state.terminalHeight > NEAR_MIN_THRESHOLD)
const { activeWorkflowId } = useWorkflowRegistry()
const hasConsoleHydrated = useTerminalConsoleStore((state) => state._hasHydrated)
const workflowEntriesSelector = useCallback(
(state: { entries: ConsoleEntry[] }) =>
state.entries.filter((entry) => entry.workflowId === activeWorkflowId),
[activeWorkflowId]
)
const entriesFromStore = useTerminalConsoleStore(useShallow(workflowEntriesSelector))
const entries = hasConsoleHydrated ? entriesFromStore : []
const entries = useTerminalConsoleStore(useShallow(workflowEntriesSelector))
const clearWorkflowConsole = useTerminalConsoleStore((state) => state.clearWorkflowConsole)
const exportConsoleCSV = useTerminalConsoleStore((state) => state.exportConsoleCSV)
const [selectedEntry, setSelectedEntry] = useState<ConsoleEntry | null>(null)

View File

@@ -98,23 +98,6 @@ export const A2ABlock: BlockConfig<A2AResponse> = {
condition: { field: 'operation', value: 'a2a_send_message' },
required: true,
},
{
id: 'data',
title: 'Data (JSON)',
type: 'code',
placeholder: '{\n "key": "value"\n}',
description: 'Structured data to include with the message (DataPart)',
condition: { field: 'operation', value: 'a2a_send_message' },
},
{
id: 'files',
title: 'Files',
type: 'file-upload',
placeholder: 'Upload files to send',
description: 'Files to include with the message (FilePart)',
condition: { field: 'operation', value: 'a2a_send_message' },
multiple: true,
},
{
id: 'taskId',
title: 'Task ID',
@@ -225,14 +208,6 @@ export const A2ABlock: BlockConfig<A2AResponse> = {
type: 'string',
description: 'Context ID for conversation continuity',
},
data: {
type: 'json',
description: 'Structured data to include with the message',
},
files: {
type: 'array',
description: 'Files to include with the message',
},
historyLength: {
type: 'number',
description: 'Number of history messages to include',

View File

@@ -1,207 +0,0 @@
import { TinybirdIcon } from '@/components/icons'
import type { BlockConfig } from '@/blocks/types'
import { AuthMode } from '@/blocks/types'
import type { TinybirdResponse } from '@/tools/tinybird/types'
export const TinybirdBlock: BlockConfig<TinybirdResponse> = {
type: 'tinybird',
name: 'Tinybird',
description: 'Send events and query data with Tinybird',
authMode: AuthMode.ApiKey,
longDescription:
'Interact with Tinybird using the Events API to stream JSON or NDJSON events, or use the Query API to execute SQL queries against Pipes and Data Sources.',
docsLink: 'https://www.tinybird.co/docs/api-reference',
category: 'tools',
bgColor: '#2EF598',
icon: TinybirdIcon,
subBlocks: [
{
id: 'operation',
title: 'Operation',
type: 'dropdown',
options: [
{ label: 'Send Events', id: 'tinybird_events' },
{ label: 'Query', id: 'tinybird_query' },
],
value: () => 'tinybird_events',
},
{
id: 'base_url',
title: 'Base URL',
type: 'short-input',
placeholder: 'https://api.tinybird.co',
required: true,
},
{
id: 'token',
title: 'API Token',
type: 'short-input',
placeholder: 'Enter your Tinybird API token',
password: true,
required: true,
},
// Send Events operation inputs
{
id: 'datasource',
title: 'Data Source',
type: 'short-input',
placeholder: 'my_events_datasource',
condition: { field: 'operation', value: 'tinybird_events' },
required: true,
},
{
id: 'data',
title: 'Data',
type: 'code',
placeholder:
'{"event": "click", "timestamp": "2024-01-01T12:00:00Z"}\n{"event": "view", "timestamp": "2024-01-01T12:00:01Z"}',
condition: { field: 'operation', value: 'tinybird_events' },
required: true,
},
{
id: 'format',
title: 'Format',
type: 'dropdown',
options: [
{ label: 'NDJSON (Newline-delimited JSON)', id: 'ndjson' },
{ label: 'JSON', id: 'json' },
],
value: () => 'ndjson',
condition: { field: 'operation', value: 'tinybird_events' },
},
{
id: 'compression',
title: 'Compression',
type: 'dropdown',
options: [
{ label: 'None', id: 'none' },
{ label: 'Gzip', id: 'gzip' },
],
value: () => 'none',
mode: 'advanced',
condition: { field: 'operation', value: 'tinybird_events' },
},
{
id: 'wait',
title: 'Wait for Acknowledgment',
type: 'switch',
value: () => 'false',
mode: 'advanced',
condition: { field: 'operation', value: 'tinybird_events' },
},
// Query operation inputs
{
id: 'query',
title: 'SQL Query',
type: 'code',
placeholder: 'SELECT * FROM my_pipe FORMAT JSON\nOR\nSELECT * FROM my_pipe FORMAT CSV',
condition: { field: 'operation', value: 'tinybird_query' },
required: true,
},
{
id: 'pipeline',
title: 'Pipeline Name',
type: 'short-input',
placeholder: 'my_pipe (optional)',
condition: { field: 'operation', value: 'tinybird_query' },
},
],
tools: {
access: ['tinybird_events', 'tinybird_query'],
config: {
tool: (params) => params.operation || 'tinybird_events',
params: (params) => {
const operation = params.operation || 'tinybird_events'
const result: Record<string, any> = {
base_url: params.base_url,
token: params.token,
}
if (operation === 'tinybird_events') {
// Send Events operation
if (!params.datasource) {
throw new Error('Data Source is required for Send Events operation')
}
if (!params.data) {
throw new Error('Data is required for Send Events operation')
}
result.datasource = params.datasource
result.data = params.data
result.format = params.format || 'ndjson'
result.compression = params.compression || 'none'
// Convert wait from string to boolean
// Convert wait from string to boolean
if (params.wait !== undefined) {
const waitValue =
typeof params.wait === 'string' ? params.wait.toLowerCase() : params.wait
result.wait = waitValue === 'true' || waitValue === true
}
} else if (operation === 'tinybird_query') {
// Query operation
if (!params.query) {
throw new Error('SQL Query is required for Query operation')
}
result.query = params.query
if (params.pipeline) {
result.pipeline = params.pipeline
}
}
return result
},
},
},
inputs: {
operation: { type: 'string', description: 'Operation to perform' },
base_url: { type: 'string', description: 'Tinybird API base URL' },
// Send Events inputs
datasource: {
type: 'string',
description: 'Name of the Tinybird Data Source',
},
data: {
type: 'string',
description: 'Data to send as JSON or NDJSON string',
},
wait: { type: 'boolean', description: 'Wait for database acknowledgment' },
format: {
type: 'string',
description: 'Format of the events (ndjson or json)',
},
compression: {
type: 'string',
description: 'Compression format (none or gzip)',
},
// Query inputs
query: { type: 'string', description: 'SQL query to execute' },
pipeline: { type: 'string', description: 'Optional pipeline name' },
// Common
token: { type: 'string', description: 'Tinybird API Token' },
},
outputs: {
// Send Events outputs
successful_rows: {
type: 'number',
description: 'Number of rows successfully ingested',
},
quarantined_rows: {
type: 'number',
description: 'Number of rows quarantined (failed validation)',
},
// Query outputs
data: {
type: 'json',
description:
'Query result data. FORMAT JSON: array of objects. Other formats (CSV, TSV, etc.): raw text string.',
},
rows: { type: 'number', description: 'Number of rows returned (only with FORMAT JSON)' },
statistics: {
type: 'json',
description:
'Query execution statistics - elapsed time, rows read, bytes read (only with FORMAT JSON)',
},
},
}

View File

@@ -121,7 +121,6 @@ import { SupabaseBlock } from '@/blocks/blocks/supabase'
import { TavilyBlock } from '@/blocks/blocks/tavily'
import { TelegramBlock } from '@/blocks/blocks/telegram'
import { ThinkingBlock } from '@/blocks/blocks/thinking'
import { TinybirdBlock } from '@/blocks/blocks/tinybird'
import { TranslateBlock } from '@/blocks/blocks/translate'
import { TrelloBlock } from '@/blocks/blocks/trello'
import { TtsBlock } from '@/blocks/blocks/tts'
@@ -282,7 +281,6 @@ export const registry: Record<string, BlockConfig> = {
tavily: TavilyBlock,
telegram: TelegramBlock,
thinking: ThinkingBlock,
tinybird: TinybirdBlock,
translate: TranslateBlock,
trello: TrelloBlock,
twilio_sms: TwilioSMSBlock,

View File

@@ -1897,19 +1897,6 @@ export function TelegramIcon(props: SVGProps<SVGSVGElement>) {
)
}
export function TinybirdIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg {...props} xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'>
<rect x='0' y='0' width='24' height='24' fill='#2EF598' rx='6' />
<g transform='translate(2, 2) scale(0.833)'>
<path d='M25 2.64 17.195.5 14.45 6.635z' fill='#1E7F63' />
<path d='M17.535 17.77 10.39 15.215 6.195 25.5z' fill='#1E7F63' />
<path d='M0 11.495 17.535 17.77 20.41 4.36z' fill='#1F2437' />
</g>
</svg>
)
}
export function ClayIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg {...props} xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 400 400'>

View File

@@ -36,10 +36,9 @@ class ApiKeyInterceptor implements CallInterceptor {
/**
* Create an A2A client from an agent URL with optional API key authentication
*
* Supports both standard A2A agents (agent card at /.well-known/agent.json)
* and Sim Studio agents (agent card at root URL via GET).
*
* Tries standard path first, falls back to root URL for compatibility.
* The agent URL should be the full endpoint URL (e.g., /api/a2a/serve/{agentId}).
* We pass an empty path to createFromUrl so it uses the URL directly for agent card
* discovery (GET on the URL) instead of appending .well-known/agent-card.json.
*/
export async function createA2AClient(agentUrl: string, apiKey?: string): Promise<Client> {
const factoryOptions = apiKey
@@ -50,18 +49,6 @@ export async function createA2AClient(agentUrl: string, apiKey?: string): Promis
})
: ClientFactoryOptions.default
const factory = new ClientFactory(factoryOptions)
// Try standard A2A path first (/.well-known/agent.json)
try {
return await factory.createFromUrl(agentUrl, '/.well-known/agent.json')
} catch (standardError) {
logger.debug('Standard agent card path failed, trying root URL', {
agentUrl,
error: standardError instanceof Error ? standardError.message : String(standardError),
})
}
// Fall back to root URL (Sim Studio compatibility)
return factory.createFromUrl(agentUrl, '')
}

View File

@@ -656,7 +656,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${profile.id.toString()}-${crypto.randomUUID()}`,
id: profile.id.toString(),
name: profile.name || profile.login,
email: profile.email,
image: profile.avatar_url,
@@ -962,7 +962,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${uniqueId}-${crypto.randomUUID()}`,
id: uniqueId,
name: 'Wealthbox User',
email: `${uniqueId}@wealthbox.user`,
emailVerified: false,
@@ -1016,7 +1016,7 @@ export const auth = betterAuth({
const user = data.data
return {
id: `${user.id.toString()}-${crypto.randomUUID()}`,
id: user.id.toString(),
name: user.name,
email: user.email,
emailVerified: user.activated,
@@ -1108,7 +1108,7 @@ export const auth = betterAuth({
})
return {
id: `${data.user_id || data.hub_id.toString()}-${crypto.randomUUID()}`,
id: data.user_id || data.hub_id.toString(),
name: data.user || 'HubSpot User',
email: data.user || `hubspot-${data.hub_id}@hubspot.com`,
emailVerified: true,
@@ -1162,7 +1162,7 @@ export const auth = betterAuth({
const data = await response.json()
return {
id: `${data.user_id || data.sub}-${crypto.randomUUID()}`,
id: data.user_id || data.sub,
name: data.name || 'Salesforce User',
email: data.email || `salesforce-${data.user_id}@salesforce.com`,
emailVerified: data.email_verified || true,
@@ -1221,7 +1221,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${profile.data.id}-${crypto.randomUUID()}`,
id: profile.data.id,
name: profile.data.name || 'X User',
email: `${profile.data.username}@x.com`,
image: profile.data.profile_image_url,
@@ -1295,7 +1295,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${profile.account_id}-${crypto.randomUUID()}`,
id: profile.account_id,
name: profile.name || profile.display_name || 'Confluence User',
email: profile.email || `${profile.account_id}@atlassian.com`,
image: profile.picture || undefined,
@@ -1406,7 +1406,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${profile.account_id}-${crypto.randomUUID()}`,
id: profile.account_id,
name: profile.name || profile.display_name || 'Jira User',
email: profile.email || `${profile.account_id}@atlassian.com`,
image: profile.picture || undefined,
@@ -1456,7 +1456,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${data.id}-${crypto.randomUUID()}`,
id: data.id,
name: data.email ? data.email.split('@')[0] : 'Airtable User',
email: data.email || `${data.id}@airtable.user`,
emailVerified: !!data.email,
@@ -1505,7 +1505,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${profile.bot?.owner?.user?.id || profile.id}-${crypto.randomUUID()}`,
id: profile.bot?.owner?.user?.id || profile.id,
name: profile.name || profile.bot?.owner?.user?.name || 'Notion User',
email: profile.person?.email || `${profile.id}@notion.user`,
emailVerified: !!profile.person?.email,
@@ -1572,7 +1572,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${data.id}-${crypto.randomUUID()}`,
id: data.id,
name: data.name || 'Reddit User',
email: `${data.name}@reddit.user`,
image: data.icon_img || undefined,
@@ -1644,7 +1644,7 @@ export const auth = betterAuth({
const viewer = data.viewer
return {
id: `${viewer.id}-${crypto.randomUUID()}`,
id: viewer.id,
email: viewer.email,
name: viewer.name,
emailVerified: true,
@@ -1707,7 +1707,7 @@ export const auth = betterAuth({
const data = await response.json()
return {
id: `${data.account_id}-${crypto.randomUUID()}`,
id: data.account_id,
email: data.email,
name: data.name?.display_name || data.email,
emailVerified: data.email_verified || false,
@@ -1758,7 +1758,7 @@ export const auth = betterAuth({
const now = new Date()
return {
id: `${profile.gid}-${crypto.randomUUID()}`,
id: profile.gid,
name: profile.name || 'Asana User',
email: profile.email || `${profile.gid}@asana.user`,
image: profile.photo?.image_128x128 || undefined,
@@ -1834,7 +1834,7 @@ export const auth = betterAuth({
logger.info('Slack credential identifier', { teamId, userId, uniqueId, teamName })
return {
id: `${uniqueId}-${crypto.randomUUID()}`,
id: uniqueId,
name: teamName,
email: `${teamId}-${userId}@slack.bot`,
emailVerified: false,
@@ -1884,7 +1884,7 @@ export const auth = betterAuth({
const uniqueId = `webflow-${userId}`
return {
id: `${uniqueId}-${crypto.randomUUID()}`,
id: uniqueId,
name: data.user_name || 'Webflow User',
email: `${uniqueId.replace(/[^a-zA-Z0-9]/g, '')}@webflow.user`,
emailVerified: false,
@@ -1931,7 +1931,7 @@ export const auth = betterAuth({
const profile = await response.json()
return {
id: `${profile.sub}-${crypto.randomUUID()}`,
id: profile.sub,
name: profile.name || 'LinkedIn User',
email: profile.email || `${profile.sub}@linkedin.user`,
emailVerified: profile.email_verified || true,
@@ -1993,7 +1993,7 @@ export const auth = betterAuth({
const profile = await response.json()
return {
id: `${profile.id}-${crypto.randomUUID()}`,
id: profile.id,
name:
`${profile.first_name || ''} ${profile.last_name || ''}`.trim() || 'Zoom User',
email: profile.email || `${profile.id}@zoom.user`,
@@ -2060,7 +2060,7 @@ export const auth = betterAuth({
const profile = await response.json()
return {
id: `${profile.id}-${crypto.randomUUID()}`,
id: profile.id,
name: profile.display_name || 'Spotify User',
email: profile.email || `${profile.id}@spotify.user`,
emailVerified: true,
@@ -2108,7 +2108,7 @@ export const auth = betterAuth({
const profile = await response.json()
return {
id: `${profile.ID?.toString() || profile.id?.toString()}-${crypto.randomUUID()}`,
id: profile.ID?.toString() || profile.id?.toString(),
name: profile.display_name || profile.username || 'WordPress User',
email: profile.email || `${profile.username}@wordpress.com`,
emailVerified: profile.email_verified || false,

View File

@@ -18,7 +18,7 @@ export const DEFAULT_ENTERPRISE_TIER_COST_LIMIT = 200
* Base charge applied to every workflow execution
* This charge is applied regardless of whether the workflow uses AI models
*/
export const BASE_EXECUTION_CHARGE = 0.005
export const BASE_EXECUTION_CHARGE = 0.001
/**
* Fixed cost for search tool invocation (in dollars)

View File

@@ -8,7 +8,7 @@ import {
// Mock the billing constants
vi.mock('@/lib/billing/constants', () => ({
BASE_EXECUTION_CHARGE: 0.005,
BASE_EXECUTION_CHARGE: 0.001,
}))
vi.mock('@sim/logger', () => loggerMock)
@@ -148,7 +148,7 @@ describe('createEnvironmentObject', () => {
})
describe('calculateCostSummary', () => {
const BASE_EXECUTION_CHARGE = 0.005
const BASE_EXECUTION_CHARGE = 0.001
test('should return base execution charge for empty trace spans', () => {
const result = calculateCostSummary([])

View File

@@ -104,7 +104,6 @@
"groq-sdk": "^0.15.0",
"html-to-image": "1.11.13",
"html-to-text": "^9.0.5",
"idb-keyval": "6.2.2",
"imapflow": "1.2.4",
"input-otp": "^1.4.2",
"ioredis": "^5.6.0",

View File

@@ -1,3 +1,2 @@
export { indexedDBStorage } from './storage'
export { useTerminalConsoleStore } from './store'
export type { ConsoleEntry, ConsoleStore, ConsoleUpdate } from './types'

View File

@@ -1,81 +0,0 @@
import { createLogger } from '@sim/logger'
import { del, get, set } from 'idb-keyval'
import type { StateStorage } from 'zustand/middleware'
const logger = createLogger('ConsoleStorage')
const STORE_KEY = 'terminal-console-store'
const MIGRATION_KEY = 'terminal-console-store-migrated'
/**
* Promise that resolves when migration is complete.
* Used to ensure getItem waits for migration before reading.
*/
let migrationPromise: Promise<void> | null = null
/**
* Migrates existing console data from localStorage to IndexedDB.
* Runs once on first load, then marks migration as complete.
*/
async function migrateFromLocalStorage(): Promise<void> {
if (typeof window === 'undefined') return
try {
const migrated = await get<boolean>(MIGRATION_KEY)
if (migrated) return
const localData = localStorage.getItem(STORE_KEY)
if (localData) {
await set(STORE_KEY, localData)
localStorage.removeItem(STORE_KEY)
logger.info('Migrated console store to IndexedDB')
}
await set(MIGRATION_KEY, true)
} catch (error) {
logger.warn('Migration from localStorage failed', { error })
}
}
if (typeof window !== 'undefined') {
migrationPromise = migrateFromLocalStorage().finally(() => {
migrationPromise = null
})
}
export const indexedDBStorage: StateStorage = {
getItem: async (name: string): Promise<string | null> => {
if (typeof window === 'undefined') return null
// Ensure migration completes before reading
if (migrationPromise) {
await migrationPromise
}
try {
const value = await get<string>(name)
return value ?? null
} catch (error) {
logger.warn('IndexedDB read failed', { name, error })
return null
}
},
setItem: async (name: string, value: string): Promise<void> => {
if (typeof window === 'undefined') return
try {
await set(name, value)
} catch (error) {
logger.warn('IndexedDB write failed', { name, error })
}
},
removeItem: async (name: string): Promise<void> => {
if (typeof window === 'undefined') return
try {
await del(name)
} catch (error) {
logger.warn('IndexedDB delete failed', { name, error })
}
},
}

View File

@@ -1,22 +1,18 @@
import { createLogger } from '@sim/logger'
import { create } from 'zustand'
import { createJSONStorage, devtools, persist } from 'zustand/middleware'
import { devtools, persist } from 'zustand/middleware'
import { redactApiKeys } from '@/lib/core/security/redaction'
import type { NormalizedBlockOutput } from '@/executor/types'
import { useExecutionStore } from '@/stores/execution'
import { useNotificationStore } from '@/stores/notifications'
import { useGeneralStore } from '@/stores/settings/general'
import { indexedDBStorage } from '@/stores/terminal/console/storage'
import type { ConsoleEntry, ConsoleStore, ConsoleUpdate } from '@/stores/terminal/console/types'
const logger = createLogger('TerminalConsoleStore')
/**
* Maximum number of console entries to keep per workflow.
* Keeps the stored data size reasonable and improves performance.
* Updates a NormalizedBlockOutput with new content
*/
const MAX_ENTRIES_PER_WORKFLOW = 500
const updateBlockOutput = (
existingOutput: NormalizedBlockOutput | undefined,
contentUpdate: string
@@ -27,6 +23,9 @@ const updateBlockOutput = (
}
}
/**
* Checks if output represents a streaming object that should be skipped
*/
const isStreamingOutput = (output: any): boolean => {
if (typeof ReadableStream !== 'undefined' && output instanceof ReadableStream) {
return true
@@ -45,6 +44,9 @@ const isStreamingOutput = (output: any): boolean => {
)
}
/**
* Checks if entry should be skipped to prevent duplicates
*/
const shouldSkipEntry = (output: any): boolean => {
if (typeof output !== 'object' || !output) {
return false
@@ -67,9 +69,6 @@ export const useTerminalConsoleStore = create<ConsoleStore>()(
(set, get) => ({
entries: [],
isOpen: false,
_hasHydrated: false,
setHasHydrated: (hasHydrated) => set({ _hasHydrated: hasHydrated }),
addConsole: (entry: Omit<ConsoleEntry, 'id' | 'timestamp'>) => {
set((state) => {
@@ -95,15 +94,7 @@ export const useTerminalConsoleStore = create<ConsoleStore>()(
timestamp: new Date().toISOString(),
}
const newEntries = [newEntry, ...state.entries]
const workflowCounts = new Map<string, number>()
const trimmedEntries = newEntries.filter((entry) => {
const count = workflowCounts.get(entry.workflowId) || 0
if (count >= MAX_ENTRIES_PER_WORKFLOW) return false
workflowCounts.set(entry.workflowId, count + 1)
return true
})
return { entries: trimmedEntries }
return { entries: [newEntry, ...state.entries] }
})
const newEntry = get().entries[0]
@@ -139,6 +130,10 @@ export const useTerminalConsoleStore = create<ConsoleStore>()(
return newEntry
},
/**
* Clears console entries for a specific workflow and clears the run path
* @param workflowId - The workflow ID to clear entries for
*/
clearWorkflowConsole: (workflowId: string) => {
set((state) => ({
entries: state.entries.filter((entry) => entry.workflowId !== workflowId),
@@ -153,6 +148,9 @@ export const useTerminalConsoleStore = create<ConsoleStore>()(
return
}
/**
* Formats a value for CSV export
*/
const formatCSVValue = (value: any): string => {
if (value === null || value === undefined) {
return ''
@@ -299,35 +297,7 @@ export const useTerminalConsoleStore = create<ConsoleStore>()(
}),
{
name: 'terminal-console-store',
storage: createJSONStorage(() => indexedDBStorage),
partialize: (state) => ({
entries: state.entries,
isOpen: state.isOpen,
}),
onRehydrateStorage: () => (_state, error) => {
if (error) {
logger.error('Failed to rehydrate console store', { error })
}
},
merge: (persistedState, currentState) => {
const persisted = persistedState as Partial<ConsoleStore> | undefined
return {
...currentState,
entries: persisted?.entries ?? currentState.entries,
isOpen: persisted?.isOpen ?? currentState.isOpen,
}
},
}
)
)
)
if (typeof window !== 'undefined') {
useTerminalConsoleStore.persist.onFinishHydration(() => {
useTerminalConsoleStore.setState({ _hasHydrated: true })
})
if (useTerminalConsoleStore.persist.hasHydrated()) {
useTerminalConsoleStore.setState({ _hasHydrated: true })
}
}

View File

@@ -1,6 +1,9 @@
import type { NormalizedBlockOutput } from '@/executor/types'
import type { SubflowType } from '@/stores/workflows/workflow/types'
/**
* Console entry for terminal logs
*/
export interface ConsoleEntry {
id: string
timestamp: string
@@ -22,6 +25,9 @@ export interface ConsoleEntry {
iterationType?: SubflowType
}
/**
* Console update payload for partial updates
*/
export interface ConsoleUpdate {
content?: string
output?: Partial<NormalizedBlockOutput>
@@ -34,6 +40,9 @@ export interface ConsoleUpdate {
input?: any
}
/**
* Console store state and actions
*/
export interface ConsoleStore {
entries: ConsoleEntry[]
isOpen: boolean
@@ -43,6 +52,4 @@ export interface ConsoleStore {
getWorkflowEntries: (workflowId: string) => ConsoleEntry[]
toggleConsole: () => void
updateConsole: (blockId: string, update: string | ConsoleUpdate, executionId?: string) => void
_hasHydrated: boolean
setHasHydrated: (hasHydrated: boolean) => void
}

View File

@@ -30,14 +30,11 @@ export const a2aCancelTaskTool: ToolConfig<A2ACancelTaskParams, A2ACancelTaskRes
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: A2ACancelTaskParams) => {
const body: Record<string, string> = {
agentUrl: params.agentUrl,
taskId: params.taskId,
}
if (params.apiKey) body.apiKey = params.apiKey
return body
},
body: (params: A2ACancelTaskParams) => ({
agentUrl: params.agentUrl,
taskId: params.taskId,
apiKey: params.apiKey,
}),
},
transformResponse: async (response: Response) => {

View File

@@ -38,16 +38,12 @@ export const a2aDeletePushNotificationTool: ToolConfig<
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, string> = {
agentUrl: params.agentUrl,
taskId: params.taskId,
}
if (params.pushNotificationConfigId)
body.pushNotificationConfigId = params.pushNotificationConfigId
if (params.apiKey) body.apiKey = params.apiKey
return body
},
body: (params) => ({
agentUrl: params.agentUrl,
taskId: params.taskId,
pushNotificationConfigId: params.pushNotificationConfigId,
apiKey: params.apiKey,
}),
},
transformResponse: async (response: Response) => {

View File

@@ -25,13 +25,10 @@ export const a2aGetAgentCardTool: ToolConfig<A2AGetAgentCardParams, A2AGetAgentC
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, string> = {
agentUrl: params.agentUrl,
}
if (params.apiKey) body.apiKey = params.apiKey
return body
},
body: (params) => ({
agentUrl: params.agentUrl,
apiKey: params.apiKey,
}),
},
transformResponse: async (response: Response) => {

View File

@@ -33,14 +33,11 @@ export const a2aGetPushNotificationTool: ToolConfig<
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, string> = {
agentUrl: params.agentUrl,
taskId: params.taskId,
}
if (params.apiKey) body.apiKey = params.apiKey
return body
},
body: (params) => ({
agentUrl: params.agentUrl,
taskId: params.taskId,
apiKey: params.apiKey,
}),
},
transformResponse: async (response: Response) => {

View File

@@ -34,15 +34,12 @@ export const a2aGetTaskTool: ToolConfig<A2AGetTaskParams, A2AGetTaskResponse> =
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: A2AGetTaskParams) => {
const body: Record<string, string | number> = {
agentUrl: params.agentUrl,
taskId: params.taskId,
}
if (params.apiKey) body.apiKey = params.apiKey
if (params.historyLength) body.historyLength = params.historyLength
return body
},
body: (params: A2AGetTaskParams) => ({
agentUrl: params.agentUrl,
taskId: params.taskId,
apiKey: params.apiKey,
historyLength: params.historyLength,
}),
},
transformResponse: async (response: Response) => {

View File

@@ -5,6 +5,7 @@ import { a2aGetPushNotificationTool } from './get_push_notification'
import { a2aGetTaskTool } from './get_task'
import { a2aResubscribeTool } from './resubscribe'
import { a2aSendMessageTool } from './send_message'
import { a2aSendMessageStreamTool } from './send_message_stream'
import { a2aSetPushNotificationTool } from './set_push_notification'
export {
@@ -15,5 +16,6 @@ export {
a2aGetTaskTool,
a2aResubscribeTool,
a2aSendMessageTool,
a2aSendMessageStreamTool,
a2aSetPushNotificationTool,
}

View File

@@ -30,14 +30,11 @@ export const a2aResubscribeTool: ToolConfig<A2AResubscribeParams, A2AResubscribe
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: A2AResubscribeParams) => {
const body: Record<string, string> = {
agentUrl: params.agentUrl,
taskId: params.taskId,
}
if (params.apiKey) body.apiKey = params.apiKey
return body
},
body: (params: A2AResubscribeParams) => ({
agentUrl: params.agentUrl,
taskId: params.taskId,
apiKey: params.apiKey,
}),
},
transformResponse: async (response) => {

View File

@@ -26,14 +26,6 @@ export const a2aSendMessageTool: ToolConfig<A2ASendMessageParams, A2ASendMessage
type: 'string',
description: 'Context ID for conversation continuity',
},
data: {
type: 'string',
description: 'Structured data to include with the message (JSON string)',
},
files: {
type: 'array',
description: 'Files to include with the message',
},
apiKey: {
type: 'string',
description: 'API key for authentication',
@@ -43,21 +35,7 @@ export const a2aSendMessageTool: ToolConfig<A2ASendMessageParams, A2ASendMessage
request: {
url: '/api/tools/a2a/send-message',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => {
const body: Record<string, unknown> = {
agentUrl: params.agentUrl,
message: params.message,
}
if (params.taskId) body.taskId = params.taskId
if (params.contextId) body.contextId = params.contextId
if (params.data) body.data = params.data
if (params.files && params.files.length > 0) body.files = params.files
if (params.apiKey) body.apiKey = params.apiKey
return body
},
headers: () => ({}),
},
transformResponse: async (response: Response) => {

View File

@@ -0,0 +1,81 @@
import type { ToolConfig } from '@/tools/types'
import type { A2ASendMessageParams, A2ASendMessageResponse } from './types'
export const a2aSendMessageStreamTool: ToolConfig<A2ASendMessageParams, A2ASendMessageResponse> = {
id: 'a2a_send_message_stream',
name: 'A2A Send Message (Streaming)',
description: 'Send a message to an external A2A-compatible agent with real-time streaming.',
version: '1.0.0',
params: {
agentUrl: {
type: 'string',
required: true,
description: 'The A2A agent endpoint URL',
},
message: {
type: 'string',
required: true,
description: 'Message to send to the agent',
},
taskId: {
type: 'string',
description: 'Task ID for continuing an existing task',
},
contextId: {
type: 'string',
description: 'Context ID for conversation continuity',
},
apiKey: {
type: 'string',
description: 'API key for authentication',
},
},
request: {
url: '/api/tools/a2a/send-message-stream',
method: 'POST',
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params) => ({
agentUrl: params.agentUrl,
message: params.message,
taskId: params.taskId,
contextId: params.contextId,
apiKey: params.apiKey,
}),
},
transformResponse: async (response: Response) => {
const data = await response.json()
return data
},
outputs: {
content: {
type: 'string',
description: 'The text response from the agent',
},
taskId: {
type: 'string',
description: 'Task ID for follow-up interactions',
},
contextId: {
type: 'string',
description: 'Context ID for conversation continuity',
},
state: {
type: 'string',
description: 'Task state',
},
artifacts: {
type: 'array',
description: 'Structured output artifacts',
},
history: {
type: 'array',
description: 'Full message history',
},
},
}

View File

@@ -42,16 +42,13 @@ export const a2aSetPushNotificationTool: ToolConfig<
headers: () => ({
'Content-Type': 'application/json',
}),
body: (params: A2ASetPushNotificationParams) => {
const body: Record<string, string> = {
agentUrl: params.agentUrl,
taskId: params.taskId,
webhookUrl: params.webhookUrl,
}
if (params.token) body.token = params.token
if (params.apiKey) body.apiKey = params.apiKey
return body
},
body: (params: A2ASetPushNotificationParams) => ({
agentUrl: params.agentUrl,
taskId: params.taskId,
webhookUrl: params.webhookUrl,
token: params.token,
apiKey: params.apiKey,
}),
},
transformResponse: async (response: Response) => {

View File

@@ -25,20 +25,11 @@ export interface A2AGetAgentCardResponse extends ToolResponse {
}
}
export interface A2ASendMessageFileInput {
type: 'file' | 'url'
data: string
name: string
mime?: string
}
export interface A2ASendMessageParams {
agentUrl: string
message: string
taskId?: string
contextId?: string
data?: string
files?: A2ASendMessageFileInput[]
apiKey?: string
}

View File

@@ -5,6 +5,7 @@ import {
a2aGetPushNotificationTool,
a2aGetTaskTool,
a2aResubscribeTool,
a2aSendMessageStreamTool,
a2aSendMessageTool,
a2aSetPushNotificationTool,
} from '@/tools/a2a'
@@ -1381,7 +1382,6 @@ import {
telegramSendVideoTool,
} from '@/tools/telegram'
import { thinkingTool } from '@/tools/thinking'
import { tinybirdEventsTool, tinybirdQueryTool } from '@/tools/tinybird'
import {
trelloAddCommentTool,
trelloCreateCardTool,
@@ -1543,6 +1543,7 @@ export const tools: Record<string, ToolConfig> = {
a2a_get_task: a2aGetTaskTool,
a2a_resubscribe: a2aResubscribeTool,
a2a_send_message: a2aSendMessageTool,
a2a_send_message_stream: a2aSendMessageStreamTool,
a2a_set_push_notification: a2aSetPushNotificationTool,
arxiv_search: arxivSearchTool,
arxiv_get_paper: arxivGetPaperTool,
@@ -2238,8 +2239,6 @@ export const tools: Record<string, ToolConfig> = {
apollo_email_accounts: apolloEmailAccountsTool,
mistral_parser: mistralParserTool,
thinking_tool: thinkingTool,
tinybird_events: tinybirdEventsTool,
tinybird_query: tinybirdQueryTool,
stagehand_extract: stagehandExtractTool,
stagehand_agent: stagehandAgentTool,
mem0_add_memories: mem0AddMemoriesTool,

View File

@@ -1,128 +0,0 @@
import { gzipSync } from 'zlib'
import { createLogger } from '@sim/logger'
import type { TinybirdEventsParams, TinybirdEventsResponse } from '@/tools/tinybird/types'
import type { ToolConfig } from '@/tools/types'
const logger = createLogger('tinybird-events')
export const eventsTool: ToolConfig<TinybirdEventsParams, TinybirdEventsResponse> = {
id: 'tinybird_events',
name: 'Tinybird Events',
description:
'Send events to a Tinybird Data Source using the Events API. Supports JSON and NDJSON formats with optional gzip compression.',
version: '1.0.0',
errorExtractor: 'nested-error-object',
params: {
base_url: {
type: 'string',
required: true,
visibility: 'user-only',
description:
'Tinybird API base URL (e.g., https://api.tinybird.co or https://api.us-east.tinybird.co)',
},
datasource: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description: 'Name of the Tinybird Data Source to send events to',
},
data: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'Data to send as NDJSON (newline-delimited JSON) or JSON string. Each event should be a valid JSON object.',
},
wait: {
type: 'boolean',
required: false,
visibility: 'user-only',
description:
'Wait for database acknowledgment before responding. Enables safer retries but introduces latency. Defaults to false.',
},
format: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Format of the events data: "ndjson" (default) or "json"',
},
compression: {
type: 'string',
required: false,
visibility: 'user-only',
description: 'Compression format: "none" (default) or "gzip"',
},
token: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Tinybird API Token with DATASOURCE:APPEND or DATASOURCE:CREATE scope',
},
},
request: {
url: (params) => {
const baseUrl = params.base_url.endsWith('/') ? params.base_url.slice(0, -1) : params.base_url
const url = new URL(`${baseUrl}/v0/events`)
url.searchParams.set('name', params.datasource)
if (params.wait) {
url.searchParams.set('wait', 'true')
}
return url.toString()
},
method: 'POST',
headers: (params) => {
const headers: Record<string, string> = {
Authorization: `Bearer ${params.token}`,
}
if (params.compression === 'gzip') {
headers['Content-Encoding'] = 'gzip'
}
if (params.format === 'json') {
headers['Content-Type'] = 'application/json'
} else {
headers['Content-Type'] = 'application/x-ndjson'
}
return headers
},
body: (params) => {
const data = params.data
if (params.compression === 'gzip') {
return gzipSync(Buffer.from(data, 'utf-8'))
}
return data
},
},
transformResponse: async (response: Response) => {
const data = await response.json()
logger.info('Successfully sent events to Tinybird', {
successful: data.successful_rows,
quarantined: data.quarantined_rows,
})
return {
success: true,
output: {
successful_rows: data.successful_rows ?? 0,
quarantined_rows: data.quarantined_rows ?? 0,
},
}
},
outputs: {
successful_rows: {
type: 'number',
description: 'Number of rows successfully ingested',
},
quarantined_rows: {
type: 'number',
description: 'Number of rows quarantined (failed validation)',
},
},
}

View File

@@ -1,5 +0,0 @@
import { eventsTool } from '@/tools/tinybird/events'
import { queryTool } from '@/tools/tinybird/query'
export const tinybirdEventsTool = eventsTool
export const tinybirdQueryTool = queryTool

View File

@@ -1,139 +0,0 @@
import { createLogger } from '@sim/logger'
import type { TinybirdQueryParams, TinybirdQueryResponse } from '@/tools/tinybird/types'
import type { ToolConfig } from '@/tools/types'
const logger = createLogger('tinybird-query')
/**
* Tinybird Query Tool
*
* Executes SQL queries against Tinybird and returns results in the format specified in the query.
* - FORMAT JSON: Returns structured data with rows/statistics metadata
* - FORMAT CSV/TSV/etc: Returns raw text string
*
* The tool automatically detects the response format based on Content-Type headers.
*/
export const queryTool: ToolConfig<TinybirdQueryParams, TinybirdQueryResponse> = {
id: 'tinybird_query',
name: 'Tinybird Query',
description: 'Execute SQL queries against Tinybird Pipes and Data Sources using the Query API.',
version: '1.0.0',
errorExtractor: 'nested-error-object',
params: {
base_url: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Tinybird API base URL (e.g., https://api.tinybird.co)',
},
query: {
type: 'string',
required: true,
visibility: 'user-or-llm',
description:
'SQL query to execute. Specify your desired output format (e.g., FORMAT JSON, FORMAT CSV, FORMAT TSV). JSON format provides structured data, while other formats return raw text.',
},
pipeline: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'Optional pipe name. When provided, enables SELECT * FROM _ syntax',
},
token: {
type: 'string',
required: true,
visibility: 'user-only',
description: 'Tinybird API Token with PIPE:READ scope',
},
},
request: {
url: (params) => {
const baseUrl = params.base_url.endsWith('/') ? params.base_url.slice(0, -1) : params.base_url
return `${baseUrl}/v0/sql`
},
method: 'POST',
headers: (params) => ({
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: `Bearer ${params.token}`,
}),
body: (params) => {
const searchParams = new URLSearchParams()
searchParams.set('q', params.query)
if (params.pipeline) {
searchParams.set('pipeline', params.pipeline)
}
return searchParams.toString()
},
},
transformResponse: async (response: Response) => {
const responseText = await response.text()
const contentType = response.headers.get('content-type') || ''
// Check if response is JSON based on content-type or try parsing
const isJson = contentType.includes('application/json') || contentType.includes('text/json')
if (isJson) {
try {
const data = JSON.parse(responseText)
logger.info('Successfully executed Tinybird query (JSON)', {
rows: data.rows,
elapsed: data.statistics?.elapsed,
})
return {
success: true,
output: {
data: data.data || [],
rows: data.rows || 0,
statistics: data.statistics
? {
elapsed: data.statistics.elapsed,
rows_read: data.statistics.rows_read,
bytes_read: data.statistics.bytes_read,
}
: undefined,
},
}
} catch (parseError) {
logger.error('Failed to parse JSON response', {
contentType,
parseError: parseError instanceof Error ? parseError.message : String(parseError),
})
throw new Error(
`Invalid JSON response: ${parseError instanceof Error ? parseError.message : 'Parse error'}`
)
}
}
// For non-JSON formats (CSV, TSV, etc.), return as raw text
logger.info('Successfully executed Tinybird query (non-JSON)', { contentType })
return {
success: true,
output: {
data: responseText,
rows: undefined,
statistics: undefined,
},
}
},
outputs: {
data: {
type: 'json',
description:
'Query result data. For FORMAT JSON: array of objects. For other formats (CSV, TSV, etc.): raw text string.',
},
rows: {
type: 'number',
description: 'Number of rows returned (only available with FORMAT JSON)',
},
statistics: {
type: 'json',
description:
'Query execution statistics - elapsed time, rows read, bytes read (only available with FORMAT JSON)',
},
},
}

View File

@@ -1,59 +0,0 @@
import type { ToolResponse } from '@/tools/types'
/**
* Base parameters for Tinybird API tools
*/
export interface TinybirdBaseParams {
token: string
}
/**
* Parameters for sending events to Tinybird
*/
export interface TinybirdEventsParams extends TinybirdBaseParams {
base_url: string
datasource: string
data: string
wait?: boolean
format?: 'ndjson' | 'json'
compression?: 'none' | 'gzip'
}
/**
* Response from sending events to Tinybird
*/
export interface TinybirdEventsResponse extends ToolResponse {
output: {
successful_rows: number
quarantined_rows: number
}
}
/**
* Parameters for querying Tinybird
*/
export interface TinybirdQueryParams extends TinybirdBaseParams {
base_url: string
query: string
pipeline?: string
}
/**
* Response from querying Tinybird
*/
export interface TinybirdQueryResponse extends ToolResponse {
output: {
data: unknown[] | string
rows?: number
statistics?: {
elapsed: number
rows_read: number
bytes_read: number
}
}
}
/**
* Union type for all possible Tinybird responses
*/
export type TinybirdResponse = TinybirdEventsResponse | TinybirdQueryResponse

View File

@@ -1,6 +1,5 @@
{
"lockfileVersion": 1,
"configVersion": 0,
"workspaces": {
"": {
"name": "simstudio",
@@ -134,7 +133,6 @@
"groq-sdk": "^0.15.0",
"html-to-image": "1.11.13",
"html-to-text": "^9.0.5",
"idb-keyval": "6.2.2",
"imapflow": "1.2.4",
"input-otp": "^1.4.2",
"ioredis": "^5.6.0",
@@ -2312,8 +2310,6 @@
"iconv-lite": ["iconv-lite@0.6.3", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" } }, "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw=="],
"idb-keyval": ["idb-keyval@6.2.2", "", {}, "sha512-yjD9nARJ/jb1g+CvD0tlhUHOrJ9Sy0P8T9MF3YaLlHnSRpwPfpTX0XIvpmw3gAJUmEu3FiICLBDPXVwyEvrleg=="],
"ieee754": ["ieee754@1.2.1", "", {}, "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA=="],
"image-size": ["image-size@2.0.2", "", { "bin": { "image-size": "bin/image-size.js" } }, "sha512-IRqXKlaXwgSMAMtpNzZa1ZAe8m+Sa1770Dhk8VkSsP9LS+iHD62Zd8FQKs8fbPiagBE7BzoFX23cxFnwshpV6w=="],

View File

@@ -1,2 +0,0 @@
DROP INDEX "account_user_provider_account_unique";--> statement-breakpoint
CREATE UNIQUE INDEX "account_user_provider_unique" ON "account" USING btree ("user_id","provider_id");

File diff suppressed because it is too large Load Diff

View File

@@ -974,13 +974,6 @@
"when": 1768260112533,
"tag": "0139_late_cargill",
"breakpoints": true
},
{
"idx": 140,
"version": "7",
"when": 1768366574848,
"tag": "0140_fuzzy_the_twelve",
"breakpoints": true
}
]
}

View File

@@ -89,9 +89,10 @@ export const account = pgTable(
table.accountId,
table.providerId
),
uniqueUserProvider: uniqueIndex('account_user_provider_unique').on(
uniqueUserProviderAccount: uniqueIndex('account_user_provider_account_unique').on(
table.userId,
table.providerId
table.providerId,
table.accountId
),
})
)