Skip to content

Enable input tracking toggle #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/rest-api/input-tracking.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
title: "Input Tracking"
openapi: "POST /input-tracking/start"
description: "Start and stop input tracking on the Bytebot desktop"
---

The Bytebot daemon can monitor mouse and keyboard events through the
`InputTracking` module. Tracking is disabled by default and can be toggled
via the REST API. Tracked actions are streamed over WebSockets so that the
agent can store them as messages.

## Start Tracking

`POST /input-tracking/start`

Begins capturing input events. The endpoint returns a simple status object:

```json
{
"status": "started"
}
```

## Stop Tracking

`POST /input-tracking/stop`

Stops capturing events and clears any internal buffers. The response is
similar to the start endpoint:

```json
{
"status": "stopped"
}
```

## WebSocket Stream

When tracking is active, actions are emitted on the `input_action` channel of
the WebSocket server running on the daemon. Clients can connect to the daemon
and listen for these events to persist them as needed.
3 changes: 3 additions & 0 deletions docs/rest-api/introduction.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ Common HTTP status codes:
Execute desktop automation actions like mouse movements, clicks, keyboard
input, and screenshots
</Card>
<Card title="Input Tracking" icon="eye" href="/rest-api/input-tracking">
Control and stream keyboard and mouse events from the desktop
</Card>
<Card title="Usage Examples" icon="code" href="/rest-api/examples">
Code examples and snippets for common automation scenarios
</Card>
Expand Down
93 changes: 92 additions & 1 deletion packages/bytebot-agent/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion packages/bytebot-agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@nestjs/common": "^11.0.1",
"@nestjs/config": "^4.0.2",
"@nestjs/core": "^11.0.1",
"@nestjs/event-emitter": "^3.0.1",
"@nestjs/platform-express": "^11.1.2",
"@nestjs/platform-socket.io": "^11.1.1",
"@nestjs/schedule": "^6.0.0",
Expand All @@ -35,7 +36,8 @@
"class-validator": "^0.14.2",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1",
"socket.io": "^4.8.1"
"socket.io": "^4.8.1",
"socket.io-client": "^4.8.1"
},
"devDependencies": {
"@eslint/eslintrc": "^3.2.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/bytebot-agent/src/agent/agent.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { AnthropicModule } from '../anthropic/anthropic.module';
import { AgentProcessor } from './agent.processor';
import { ConfigModule } from '@nestjs/config';
import { AgentScheduler } from './agent.scheduler';
import { InputCaptureService } from './input-capture.service';

@Module({
imports: [ConfigModule, TasksModule, MessagesModule, AnthropicModule],
providers: [AgentProcessor, AgentScheduler],
providers: [AgentProcessor, AgentScheduler, InputCaptureService],
exports: [AgentProcessor],
})
export class AgentModule {}
Loading