Files
sim/blocks/blocks/function.ts
T
2025-01-30 17:47:13 -08:00

39 lines
821 B
TypeScript

import { CodeIcon } from '@/components/icons'
import { BlockConfig } from '../types'
import { CodeExecutionOutput } from '@/tools/function/execute'
export const FunctionBlock: BlockConfig<CodeExecutionOutput> = {
type: 'function',
toolbar: {
title: 'Function',
description: 'Add custom logic',
bgColor: '#FF8D2F',
icon: CodeIcon,
category: 'advanced',
},
tools: {
access: ['function.execute']
},
workflow: {
inputs: {
code: { type: 'string', required: true }
},
outputs: {
response: {
type: {
result: 'any',
stdout: 'string'
}
}
},
subBlocks: [
{
id: 'code',
title: 'Code',
type: 'code',
layout: 'full',
placeholder: 'Enter your code here...'
}
],
},
}