68 lines
1.4 KiB
Markdown
68 lines
1.4 KiB
Markdown
# @push.rocks/smartkvm
|
|
|
|
Programmable browser-based visual KVM automation with frame capture and keyboard transport.
|
|
|
|
## Install
|
|
|
|
```sh
|
|
pnpm add @push.rocks/smartkvm
|
|
```
|
|
|
|
## Usage
|
|
|
|
```typescript
|
|
import {
|
|
SmartBrowserKvm,
|
|
SmartKvmTerminal,
|
|
type IOcrEngine,
|
|
} from '@push.rocks/smartkvm';
|
|
|
|
const ocrEngine: IOcrEngine = {
|
|
async recognize(frame) {
|
|
// Plug in an OCR implementation here.
|
|
return {
|
|
text: '',
|
|
confidence: 0,
|
|
};
|
|
},
|
|
};
|
|
|
|
const kvm = new SmartBrowserKvm({
|
|
url: 'https://jetkvm.local',
|
|
kind: 'jetkvm',
|
|
username: 'admin',
|
|
password: 'admin',
|
|
headless: false,
|
|
ignoreHttpsErrors: true,
|
|
});
|
|
|
|
await kvm.connect();
|
|
|
|
const terminal = new SmartKvmTerminal({
|
|
kvm,
|
|
ocrEngine,
|
|
osHint: 'linux',
|
|
shellHint: 'bash',
|
|
});
|
|
|
|
await terminal.bootstrap();
|
|
const result = await terminal.runCommand('uname -a');
|
|
console.log(result);
|
|
|
|
await kvm.disconnect();
|
|
```
|
|
|
|
## Scope
|
|
|
|
This package is transport-focused and AI-agnostic. It automates browser-based visual KVM devices by opening the KVM web UI, focusing the viewer, capturing frames, and sending keyboard input. OCR and AI/model integrations are intentionally pluggable and external.
|
|
|
|
## Manual Browser Test
|
|
|
|
Automated tests do not require real KVM hardware. To run the manual browser smoke test, set:
|
|
|
|
```sh
|
|
SMARTKVM_TEST_URL=https://your-kvm.local pnpm test
|
|
```
|
|
|
|
Optional variables are `SMARTKVM_TEST_USERNAME`, `SMARTKVM_TEST_PASSWORD`, and `SMARTKVM_TEST_HEADLESS=false`.
|