@trigger_mesh/desktop-driver-schemas
v1.0.1
Published
Type-safe schemas for desktop automation driver capabilities
Maintainers
Readme
Desktop Driver Schemas
Type-safe schemas for desktop automation driver capabilities. This package provides shared schema definitions for both TypeScript and Python projects.
Features
- 🎯 Type Safety: Full TypeScript and Python type definitions
- 🔄 Auto-generated: Schemas generated from central
capabilities.json - 📦 Multi-language: Works with TypeScript, Python, and Node.js
- ✅ Validation: Built-in validation with Zod (TS) and Pydantic (Python)
- 🚀 Easy to use: Simple imports and clear API
Installation
TypeScript/Node.js
npm install @trigger_mesh/desktop-driver-schemas
# or
yarn add @trigger_mesh/desktop-driver-schemasPython
pip install trigger-mesh-desktop-driver-schemasUsage
TypeScript
import { ActionSchema, ClickAtAction } from '@trigger_mesh/desktop-driver-schemas';
import { z } from 'zod';
// Validate action
const action: ClickAtAction = {
type: 'click_at',
x: 100,
y: 200
};
const validated = ActionSchema.parse(action);
console.log(validated); // { type: 'click_at', x: 100, y: 200 }Python
from trigger_mesh_desktop_driver_schemas import Action, ClickAtAction, CAPABILITIES
# Validate action
action = ClickAtAction(
type="click_at",
x=100,
y=200
)
print(action) # type='click_at' x=100 y=200
# Access capabilities
print(CAPABILITIES.keys())Raw JSON
import capabilities from '@trigger_mesh/desktop-driver-schemas/capabilities';
console.log(capabilities.focus_window);
// { description: "Focus a window by title substring", args: {...} }Available Capabilities
The package includes schemas for 29+ desktop automation capabilities:
- Mouse Actions:
click_at,double_click,right_click,drag,scroll - Keyboard Actions:
type_text,key_press,key_combination,xdo_sequence - Window Management:
focus_window,wait_for_window,launch_app - Screenshots:
screenshot,screenshot_base64,screenshot_region_base64 - Image Detection:
find_image,wait_for_image,click_image - File System:
fs_list,fs_read,fs_write - OCR:
ocr_read_region,ocr_find_text,ocr_wait_text - Accessibility:
ax_wait,ax_click - System:
shell_exec,wait
Development
Prerequisites
- Node.js 18+
- Python 3.8+
- npm or yarn
Setup
# Install dependencies
npm install
# Generate schemas
npm run generate
# Build packages
npm run build
# Validate driver implementation
npm run validateScripts
npm run generate- Generate all schemas from capabilities.jsonnpm run build- Build TypeScript and prepare for publishingnpm run validate- Validate driver implementationnpm run test- Run tests
Publishing
NPM (TypeScript/Node.js)
# Login to npm
npm login
# Publish
npm publishPyPI (Python)
# Install build tools
pip install build twine
# Build Python package
python -m build
# Upload to PyPI
twine upload dist/*API Reference
TypeScript Exports
ActionSchema- Zod schema for validating actionsResultSchema- Zod schema for validating resultsClickAtAction,ScreenshotAction, etc. - Individual action typescapabilities- Raw capabilities JSON
Python Exports
Action- Pydantic base model for actionsClickAtAction,ScreenshotAction, etc. - Individual action modelsCAPABILITIES- Raw capabilities dictionaryget_capability(name)- Get specific capability definitionvalidate_capability(name, args)- Validate capability arguments
Contributing
- Update
capabilities.jsonwith new capabilities - Run
npm run generateto update schemas - Run
npm run validateto ensure driver compatibility - Test with both TypeScript and Python
- Submit a pull request
License
MIT License - see LICENSE file for details.
