Skip to content

@graphty/graphty-element / ai / CommandRegistry

Class: CommandRegistry ​

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:13

Registry for graph commands that can be executed via AI. Follows the same pattern as LayoutEngine.register() and Algorithm.register().

Constructors ​

Constructor ​

new CommandRegistry(): CommandRegistry

Returns ​

CommandRegistry

Methods ​

clear() ​

clear(): void

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:74

Remove all registered commands.

Returns ​

void


get() ​

get(name): GraphCommand | undefined

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:34

Get a command by name.

Parameters ​

name ​

string

Name of the command

Returns ​

GraphCommand | undefined

The command or undefined if not found


getAll() ​

getAll(): GraphCommand[]

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:51

Get all registered commands.

Returns ​

GraphCommand[]

Array of all registered commands


getNames() ​

getNames(): string[]

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:59

Get names of all registered commands.

Returns ​

string[]

Array of command names


has() ​

has(name): boolean

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:43

Check if a command is registered.

Parameters ​

name ​

string

Name of the command

Returns ​

boolean

True if the command is registered


register() ​

register(command): void

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:21

Register a new command.

Parameters ​

command ​

GraphCommand

The command to register

Returns ​

void

Throws ​

Error if a command with the same name is already registered


toToolDefinitions() ​

toToolDefinitions(): ToolDefinition[]

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:82

Convert all registered commands to Vercel AI SDK tool definitions.

Returns ​

ToolDefinition[]

Array of tool definitions for use with LLM providers


unregister() ​

unregister(name): void

Defined in: graphty-element/src/ai/commands/CommandRegistry.ts:67

Unregister a command by name.

Parameters ​

name ​

string

Name of the command to remove

Returns ​

void