register method

  1. @override
void register(
  1. PluginContext context
)
override

Called once when the CLI starts. Use context to register tools, hooks, slash commands, and read plugin-specific context.config.

Implementation

@override
void register(PluginContext context) {
  final config = context.config;
  final apiKey = config['apiKey'] as String?;
  if (apiKey == null) {
    // Not configured: skip registration silently.
    return;
  }
  final transcribeConfig = TranscribeAudioConfig(
    modelId: config['model'] as String? ?? 'whisper-1',
    apiKey: apiKey,
    baseUrl: config['baseUrl'] as String?,
    language: config['language'] as String?,
    httpClient: httpClient,
  );
  context.registerTool(transcribeAudioTool(context.env, transcribeConfig));
}