# @scrapitos/runner

<p align="center">
  <img src="https://unpkg.com/@scrapitos/runner@1.0.9/docs/logo.png" width="150" alt="Scrapit OS Logo">
</p>

> The high-performance, local-first automation engine for Scrapit OS.

The **Scrapit Runner** is the core execution engine that powers both the Scrapit OS cloud and local workstation environments. It leverages Playwright to execute complex web automations, record interactions, and stream logs in real-time.

![Scrapit Runner Screenshot](https://unpkg.com/@scrapitos/runner@1.0.9/docs/runner_screenshot.png)

---

## 🚀 Installation

Install the runner globally to use the `scrapit-agent` CLI:

```bash
npm install -g @scrapitos/runner
```

---

## 🌐 Chrome Extension

To record and automate directly from your browser, download the **Scrapit OS Recorder Extension** from our control panel:
👉 **[Download Extension @ scrapit.zdesk.in](https://scrapit.zdesk.in/downloads)**

---

## 🛠️ Usage

### 1. Starting the Local Agent

The local agent acts as a bridge between your browser recorder and the execution engine. It allows you to preview automations on your own machine before deploying them.

```bash
scrapit-agent
```

**Options:**

- `-p, --port <number>`: Port to run the agent on (default: 4001)
- `-u, --auth-uri <uri>`: Cloud authentication URI for syncing
- `-d, --daemon`: Run the agent in the background

### 2. Integration with Chrome Extension

To use the local runner with the **Scrapit OS Recorder**:

1.  Start the agent: `scrapit-agent`.
2.  Open the Scrapit Chrome Extension.
3.  Go to **Settings** in the extension.
4.  Set the **Local Agent URI** to `http://localhost:4001`.
5.  Now, when you click **Preview** in the recorder, the automation will execute on your local machine via the agent.

---

## 🏗️ Architecture

- **Playwright Core**: Native browser automation with stealth capabilities.
- **SSE Streaming**: Real-time log and screenshot streaming to the recorder.
- **Local Persistence**: Results can be stored in a local MongoDB or exported as JSON/CSV.
- **Cloud Sync**: Securely authenticates with Scrapit OS cloud for shared selectors and flow definitions.

---

## 🔒 Security

The local agent requires authentication with your Scrapit OS account. When started, it will securely prompt for your credentials to establish a session with the cloud registry.

---

## 📄 License

ISC © 2026 Scrapit OS Team
