Skip to content
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
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Docs

on:
push:
branches: [main]
paths:
- 'docs/**'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest

- name: Install dependencies
run: bun install

- name: Build docs
run: bun run docs:build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/build

deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@
}
},
"files": {
"includes": ["**", "!**/node_modules", "!**/dist", "!**/*.json"]
"includes": ["**", "!**/node_modules", "!**/dist", "!**/*.json", "!docs/.docusaurus"]
}
}
2,551 changes: 2,523 additions & 28 deletions bun.lock

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

## Installation

```bash
yarn
```

## Local Development

```bash
yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Build

```bash
yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

Using SSH:

```bash
USE_SSH=true yarn deploy
```

Not using SSH:

```bash
GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
191 changes: 191 additions & 0 deletions docs/docs/api-reference/classes/droid.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
---
title: Droid
description: Main entry point for the Droid SDK
---

# Droid

The `Droid` class is the main entry point for the SDK. It provides methods for executing prompts and managing conversation threads.

## Import

```typescript
import { Droid, MODELS } from '@activade/droid-sdk';
```

## Constructor

```typescript
new Droid(config?: DroidConfig)
```

Creates a new Droid instance with the specified configuration.

### Parameters

| Parameter | Type | Required | Default | Description |
|-----------|------|----------|---------|-------------|
| `config` | `DroidConfig` | No | `{}` | Configuration options |

#### DroidConfig Properties

| Property | Type | Default | Description |
|----------|------|---------|-------------|
| `cwd` | `string` | `process.cwd()` | Working directory for CLI operations |
| `model` | `ModelId \| string` | - | AI model to use for generation |
| `autonomyLevel` | `AutonomyLevel` | `'default'` | Level: `'default'`, `'low'`, `'medium'`, `'high'` |
| `reasoningEffort` | `ReasoningEffort` | - | Intensity: `'off'`, `'none'`, `'low'`, `'medium'`, `'high'` |
| `droidPath` | `string` | `'droid'` | Path to the Droid CLI binary |
| `timeout` | `number` | `600000` | Maximum execution time in milliseconds |

### Example

```typescript
const droid = new Droid({
model: MODELS.CLAUDE_SONNET,
autonomyLevel: 'high',
reasoningEffort: 'medium',
cwd: '/path/to/project',
timeout: 300000
});
```

## Properties

### config

```typescript
get config(): Readonly<DroidConfig>
```

Returns the current configuration as a readonly object.

```typescript
const droid = new Droid({ model: MODELS.CLAUDE_SONNET });
console.log(droid.config.model); // 'claude-sonnet-4-5-20250929'
```

## Methods

### startThread()

```typescript
startThread(options?: ThreadOptions): Thread
```

Creates a new conversation thread for multi-turn interactions.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `options` | `ThreadOptions` | No | Thread-specific configuration |

**Returns:** A new `Thread` instance.

```typescript
const thread = droid.startThread({
autonomyLevel: 'high',
enabledTools: ['file_read', 'file_write']
});

await thread.run('Create a REST API');
await thread.run('Add authentication');

console.log('Session ID:', thread.id);
```

### resumeThread()

```typescript
resumeThread(sessionId: string, options?: ThreadOptions): Thread
```

Resumes a previously created conversation thread.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sessionId` | `string` | Yes | Session ID from a previous thread |
| `options` | `ThreadOptions` | No | Thread-specific configuration |

**Returns:** A `Thread` instance connected to the existing session.

```typescript
const thread = droid.resumeThread('session_abc123...');
await thread.run('What did we work on last time?');
```

### exec()

```typescript
exec(prompt: string, options?: ExecOptions): Promise<TurnResult>
```

Executes a single prompt without maintaining conversation state.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `prompt` | `string` | Yes | The natural language prompt |
| `options` | `ExecOptions` | No | Execution options |

**Returns:** A promise resolving to the execution result.

**Throws:**
- `ExecutionError` - If the CLI execution fails
- `TimeoutError` - If the operation exceeds the configured timeout
- `CliNotFoundError` - If the Droid CLI is not installed

```typescript
const result = await droid.exec('Generate a UUID');
console.log(result.finalResponse);
```

### listTools()

```typescript
listTools(model?: string): Promise<string[]>
```

Lists all available tools for the configured or specified model.

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `model` | `string` | No | Model ID (defaults to instance model) |

**Returns:** A promise resolving to an array of tool names.

```typescript
const tools = await droid.listTools();
console.log('Available tools:', tools);
// ['file_read', 'file_write', 'shell_exec', ...]
```

## Full Example

```typescript
import { Droid, MODELS } from '@activade/droid-sdk';
import { z } from 'zod';

const droid = new Droid({
model: MODELS.CLAUDE_SONNET,
autonomyLevel: 'high',
cwd: './my-project'
});

// One-shot execution
const result = await droid.exec('Create a hello world function');
console.log(result.finalResponse);

// Multi-turn conversation
const thread = droid.startThread();
await thread.run('Create a React component');
await thread.run('Add unit tests for it');

// Structured output
const schema = z.object({
name: z.string(),
version: z.string()
});

const pkgResult = await droid.exec('Get package info as JSON');
const pkg = pkgResult.parse(schema);
console.log(pkg.name, pkg.version);
```
Loading