import { SmartKvmTerminal } from './smartkvm.classes.kvmterminal.js'; import type { IKvmTerminalCommandResult } from './smartkvm.interfaces.js'; export interface ISmartKvmTool { name: string; description: string; parameters: unknown; execute: (input: TInput) => Promise; } export interface ISmartKvmToolOptions { terminal: SmartKvmTerminal; } export interface ISmartKvmTerminalRunCommandInput { command: string; } export type TSmartKvmTerminalObserveInput = Record; export const createSmartKvmTools = (options: ISmartKvmToolOptions): ISmartKvmTool[] => { return [ { name: 'kvm_terminal_run_command', description: 'Run a command through the visual KVM terminal transport and return OCR-parsed output.', parameters: { type: 'object', properties: { command: { type: 'string', description: 'The terminal command to run.', }, }, required: ['command'], additionalProperties: false, }, execute: async (input: unknown): Promise => { const typedInput = input as Partial; if (!typedInput || typeof typedInput.command !== 'string') { throw new Error('kvm_terminal_run_command requires a string command.'); } return options.terminal.runCommand(typedInput.command); }, }, { name: 'kvm_terminal_observe', description: 'Observe the current visual KVM terminal text through the configured OCR engine.', parameters: { type: 'object', properties: {}, additionalProperties: false, }, execute: async (): Promise => { return options.terminal.observeText(); }, }, ]; };