YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
docs: desktop-use
Louis Beaumontc693d08ff4a2
diff --git a/content/docs-mintlify-mig-tmp/docs.json b/content/docs-mintlify-mig-tmp/docs.jsonindex 827f252f1..3eab8c700 100644--- a/content/docs-mintlify-mig-tmp/docs.json+++ b/content/docs-mintlify-mig-tmp/docs.json@@ -13,10 +13,31 @@},"logo": "favicon.ico","navigation": {- "tabs": [+ "anchors": [{- "tab": "Documentation",- "icon": "book",+ "anchor": "Terminator",+ "icon": "robot",+ "pages": [+ {+ "group": "Getting Started",+ "icon": "rocket",+ "pages": [+ "terminator/introduction",+ "terminator/getting-started"+ ]+ },+ {+ "group": "Reference",+ "icon": "code",+ "pages": [+ "terminator/sdk-reference"+ ]+ }+ ]+ },+ {+ "anchor": "Screenpipe",+ "icon": "monitor-recorder","pages": [{"group": "Getting Started",@@ -55,7 +76,7 @@]},{- "tab": "API Reference",+ "anchor": "API Reference","icon": "terminal","openapi": "openapi.yaml"}diff --git a/content/docs-mintlify-mig-tmp/terminator/getting-started.mdx b/content/docs-mintlify-mig-tmp/terminator/getting-started.mdxnew file mode 100644index 000000000..8b28c2e06--- /dev/null+++ b/content/docs-mintlify-mig-tmp/terminator/getting-started.mdx@@ -0,0 +1,55 @@+---+title: 'Terminator: Getting Started'+---++## installation++first, you need the rust development environment installed.++```bash+# install rust if you don't have it+curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh+source $home/.cargo/env # or restart your terminal+```++then, clone the terminator repository:++```bash+git clone https://github.com/mediar-ai/terminator+cd terminator+```++## running the server++**terminator** works with a client-server architecture. you need to run the rust server first. this server listens for commands from the sdk (typescript, python coming soon) and interacts with the operating system's accessibility apis.++```bash+cargo run --example server -- --debug+```++the `--debug` flag enables verbose logging, which is helpful when starting out.++## using the typescript sdk (quick start)++once the server is running, you can use the typescript sdk to automate ui interactions.++1. **navigate to the examples directory:**+ ```bash+ cd examples+ ```+2. **install dependencies:**+ ```bash+ bun install # or npm install / yarn install+ ```+3. **run the example script:**+ ```bash+ npx tsx client_example.ts+ ```++this example script typically performs a simple automation task, like opening the calculator application (on windows/macos), clicking buttons, and retrieving the result. check the `client_example.ts` file to see the specific actions.++## next steps++* explore the [[terminator/sdk-reference|TypeScript SDK Reference]] to understand all available commands.+* look at the `examples/` directory for more usage patterns.+* start building your own automation scripts!diff --git a/content/docs-mintlify-mig-tmp/terminator/introduction.mdx b/content/docs-mintlify-mig-tmp/terminator/introduction.mdxnew file mode 100644index 000000000..f652c29a7--- /dev/null+++ b/content/docs-mintlify-mig-tmp/terminator/introduction.mdx@@ -0,0 +1,81 @@+---+title: 'Terminator: Introduction'+---++import { Card, CardGroup } from '@mintlify/components';++## overview++**terminator** is an ai-first cross-platform ui automation library for rust, designed to interact with native gui applications on windows and macos using a playwright-like api.++it provides a unified api to find and control ui elements like buttons, text fields, windows, and more, enabling the creation of automation scripts, testing tools, and assistive technologies.++because it's using os level apis, it is **100x faster and more reliable** for ai computer use than vision-based approaches like openai operator or anthropic computer use. acting at a lower level than a browser, it can easily drop-in replace browser automation tools like playwright for native application tasks.++> **Note:** while we support macos and windows, we are currently focusing development efforts on windows. macos support is functional but may require more investigation for complex scenarios.++## features++<CardGroup cols={2}>+ <Card title="Cross-Platform">+ Experimentally supports **Windows** and **macOS** with a consistent api.+ </Card>+ <Card title="Application Control">+ Find running applications (by name, pid), open new applications, open URLs.+ </Card>+ <Card title="Element Discovery">+ Locate UI elements using various strategies (`Selector` enum):+ - Role (e.g., "button", "textfield", "AXButton")+ - Name (accessibility label/title)+ - Value+ - Description+ - AutomationId (Windows)+ - Id (internal unique id)+ - Text content (partial matches)+ </Card>+ <Card title="Element Interaction">+ - Click, double-click, right-click+ - Type text, set value, press keys (e.g., `{Enter}`, `{Cmd}`, `{Alt}`)+ - Focus, hover+ - Scroll (up, down, left, right)+ - Retrieve text content, attributes (value, role, description, bounds, properties)+ - Check state (enabled, visible, focused)+ </Card>+ <Card title="Element Hierarchy">+ Traverse the accessibility tree (children, parent).+ </Card>+ <Card title="Debugging">+ Optional verbose logging and accessibility inspector integration (like [Accessibility Insights](https://accessibilityinsights.io/downloads/)) for easier debugging.+ </Card>+</CardGroup>++## platform support++* ✅ **windows** (using ui automation)+* ✅ **macos** (using accessibility api)+* 🐧 **linux** (planned/experimental)++## use cases & potential experiments++* **ai-driven automation loop:** an ai agent observes an application's state using terminator, generates sdk code to interact, executes it, and observes the result, enabling complex, adaptive automation (e.g., data entry, testing, user support).+* **pdf to legacy form filler:** extract data from pdfs and use terminator to fill it into legacy applications lacking modern apis.+* **javascript/typescript integration:** integrate terminator into web tools or electron apps. imagine browser extensions interacting with native desktop apps or node.js scripts automating cross-application workflows.+* **replacing vision models:** achieve significantly faster and more reliable ui automation compared to slower, error-prone vision-based models for tasks where accessibility apis are available.++## demos++high level demo:++<video controls src="https://github.com/user-attachments/assets/024c06fa-19f2-4fc9-b52d-329768ee52d0"></video>++dev demo 1:++<video controls src="https://github.com/user-attachments/assets/890d6842-782c-4b2b-8920-224bd63c4545"></video>++dev demo 2:++<video controls src="https://github.com/user-attachments/assets/c9f472f7-79ed-49c6-a4d0-93608fa1ce55"></video>++## next steps++ready to start? head over to the [[terminator/getting-started|Getting Started]] guide.diff --git a/content/docs-mintlify-mig-tmp/terminator/sdk-reference.mdx b/content/docs-mintlify-mig-tmp/terminator/sdk-reference.mdxnew file mode 100644index 000000000..a3a5aa929--- /dev/null+++ b/content/docs-mintlify-mig-tmp/terminator/sdk-reference.mdx@@ -0,0 +1,262 @@+---+title: 'Desktop Use: SDK Reference (TypeScript)'+---++this page details the typescript sdk for interacting with the **terminator** server. it provides examples for common ui automation tasks, primarily focusing on windows applications.++## setup++first, ensure the terminator server is running (see [[terminator/getting-started|Getting Started]]). then, install the necessary dependencies if you haven't already:++```bash+bun install # or npm install / yarn install+```++import the client and locator:++```typescript+import { DesktopUseClient, Locator, ApiError } from 'desktop-use'; // Adjust the path as needed++const client = new DesktopUseClient(); // Connects to default 127.0.0.1:3000+// const client = new DesktopUseClient('127.0.0.1:3001'); // Or specify host:port+```++## basic operations++### opening applications and urls++you can open applications by their name or path, and open urls in the default (or specified) browser.++```typescript+async function launchApps() {+ try {+ // open windows calculator+ console.log('opening calculator...');+ await client.openApplication('calc');+ console.log('calculator opened.');++ // wait a bit for the app to load (optional)+ await sleep(1000);++ // open notepad+ console.log('opening notepad...');+ await client.openApplication('notepad');+ console.log('notepad opened.');++ // open a url+ console.log('opening url...');+ await client.openUrl('https://github.com/mediar-ai/terminator');+ console.log('url opened.');++ } catch (error) {+ if (error instanceof ApiError) {+ console.error(`api error (${error.status}): ${error.message}`);+ } else {+ console.error('an unexpected error occurred:', error);+ }+ }+}++launchApps();++// Utility function for delays+function sleep(ms: number): Promise<void> {+ return new Promise(resolve => setTimeout(resolve, ms));+}+```++### locating elements++the `locator` method starts a chain to find elements. you can chain multiple locators to narrow down the search.++selectors use the format `Strategy:Value`, e.g., `name:Calc`, `role:button`, `id:myButtonId`.++```typescript+// --- basic locators ---++// locate the calculator window (windows 11 example)+const calcWindow = client.locator('name:Calc');++// locate the 'seven' button within the calculator window+const sevenButton = calcWindow.locator('name:Seven');++// locate the main text area in notepad+const notepadWindow = client.locator('window:Notepad'); // might differ+const editor = notepadWindow.locator('name:RichEditD2DPT'); // use accessibility insights tool to find correct class/id++// --- chaining locators ---++// directly locate the 'eight' button+const eightButton = client.locator('name:Calc').locator('name:Eight');++// locate the file menu item within notepad+const fileMenu = client.locator('window:Notepad').locator('name:File');+```++### interacting with elements++once you have a `Locator`, you can perform actions like clicking, typing, or getting text.++```typescript+async function interactWithCalc() {+ try {+ console.log('opening calculator...');+ await client.openApplication('calc');+ await sleep(1500); // give calc time to open++ // locate buttons by name (windows 11 calculator)+ const seven = client.locator('name:Calc').locator('name:Seven');+ const plus = client.locator('name:Calc').locator('name:Plus');+ const eight = client.locator('name:Calc').locator('name:Eight');+ const equals = client.locator('name:Calc').locator('name:Equals');+ const display = client.locator('name:Calc').locator('name:CalculatorResults'); // find result display++ console.log('clicking 7...');+ await seven.click();+ await sleep(200);++ console.log('clicking +...');+ await plus.click();+ await sleep(200);++ console.log('clicking 8...');+ await eight.click();+ await sleep(200);++ console.log('clicking =...');+ await equals.click();+ await sleep(500);++ // get the result+ const result = await display.getText();+ console.log(`calculation result: ${result.text}`); // should output something like "display is 15"++ } catch (error) {+ console.error('error interacting with calculator:', error);+ }+}++interactWithCalc();++async function interactWithNotepad() {+ try {+ console.log('opening notepad...');+ await client.openApplication('notepad');+ await sleep(1000);++ const notepadWindow = client.locator('window:Notepad');+ const editor = notepadWindow.locator('name:RichEditD2DPT'); // adjust if necessary++ console.log('typing text...');+ await editor.typeText('hello from terminator!\nthis is a test.');+ await sleep(500);++ // press enter+ console.log('pressing enter...');+ await editor.pressKey('{enter}');+ await sleep(200);++ await editor.typeText('done.');++ const content = await editor.getText();+ console.log('notepad content retrieved:', content.text);++ } catch (error) {+ console.error('error interacting with notepad:', error);+ }+}++// interactWithNotepad(); // uncomment to run+```++*note: element selectors (like `name`, `id`, `role`) can vary between os versions and application updates. use tools like windows' accessibility insights to find the correct selectors for your target application or let AI figure it out.*++### getting element state and attributes++you can check properties like visibility or retrieve detailed attributes.++```typescript+async function checkElementState() {+ try {+ await client.openApplication('calc');+ await sleep(1000);+ const equalsButton = client.locator('button:Calculator').locator('name:Equals');++ const visible = await equalsButton.isVisible();+ console.log(`is equals button visible? ${visible}`);++ const attributes = await equalsButton.getAttributes();+ console.log('equals button attributes:', JSON.stringify(attributes, null, 2));++ const bounds = await equalsButton.getBounds();+ console.log(`equals button bounds: x=${bounds.x}, y=${bounds.y}, width=${bounds.width}, height=${bounds.height}`);++ } catch (error) {+ console.error('error checking element state:', error);+ }+}++// checkElementState(); // uncomment to run+```++## expectations++**terminator** can wait for certain conditions to be met before proceeding or timing out.++```typescript+async function useExpectations() {+ try {+ console.log('opening notepad...');+ await client.openApplication('notepad.exe');++ const editorLocator = client.locator('window:Notepad').locator('name:RichEditD2DPT');++ // wait for the editor element to be visible (default timeout)+ console.log('waiting for editor to be visible...');+ const editorElement = await editorLocator.expectVisible();+ console.log(`editor is visible! id: ${editorElement.id}`);++ // wait for it to be enabled (with a 5-second timeout)+ console.log('waiting for editor to be enabled...');+ await editorLocator.expectEnabled(5000);+ console.log('editor is enabled!');++ await editorLocator.typeText('initial text.');+ await sleep(1000);++ // wait for the text to exactly match 'initial text.'+ console.log('waiting for text to match...');+ await editorLocator.expectTextEquals('initial text.', { timeout: 3000 });+ console.log('text matched!');++ // this would likely fail and throw an error after the timeout+ // console.log('waiting for incorrect text (will timeout)...');+ // await editorLocator.expectTextEquals('wrong text', { timeout: 2000 });++ } catch (error) {+ console.error('expectation error:', error);+ }+}++// useExpectations(); // uncomment to run+```++## error handling++the sdk methods return promises that reject on failure. use `try...catch` blocks and check for `ApiError` instances.++```typescript+try {+ // attempt to find a non-existent element+ const nonExistent = client.locator('Name:DoesNotExist');+ await nonExistent.click();+} catch (error) {+ if (error instanceof ApiError) {+ // handle specific api errors (e.g., element not found, timeout)+ console.error(`terminator api error (status: ${error.status}): ${error.message}`);+ } else {+ // handle other unexpected errors+ console.error('an unexpected javascript error occurred:', error);+ }+}+```