diff --git a/blocks/types.ts b/blocks/types.ts index a9957a088c..e3fb932d9f 100644 --- a/blocks/types.ts +++ b/blocks/types.ts @@ -2,6 +2,26 @@ import type { SVGProps } from 'react' import type { JSX } from 'react' import { ToolResponse } from '@/tools/types' +// Basic type definitions for block components +export type BlockIcon = (props: SVGProps) => JSX.Element +export type BlockCategory = 'blocks' | 'tools' +export type ParamType = 'string' | 'number' | 'boolean' | 'json' +export type PrimitiveValueType = 'string' | 'number' | 'boolean' | 'json' | 'any' + +// Sub-block configuration types +export type SubBlockType = + | 'short-input' + | 'long-input' + | 'dropdown' + | 'slider' + | 'table' + | 'code' + | 'switch' + | 'tool-input' + | 'checkbox-list' + +export type SubBlockLayout = 'full' | 'half' + // Tool output type utilities export type ExtractToolOutput = T extends ToolResponse ? T['output'] : never @@ -20,29 +40,11 @@ export type ToolOutputToValueType = } : never -export type BlockIcon = (props: SVGProps) => JSX.Element -export type BlockCategory = 'blocks' | 'tools' - -export type PrimitiveValueType = 'string' | 'number' | 'boolean' | 'json' | 'any' - +// Block configuration interfaces and types export type BlockOutput = | PrimitiveValueType | { [key: string]: PrimitiveValueType | Record } -export type ParamType = 'string' | 'number' | 'boolean' | 'json' - -export type SubBlockType = - | 'short-input' - | 'long-input' - | 'dropdown' - | 'slider' - | 'table' - | 'code' - | 'switch' - | 'tool-input' - | 'checkbox-list' -export type SubBlockLayout = 'full' | 'half' - export interface ParamConfig { type: ParamType required: boolean