claude-ws 0.1.24 → 0.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -266
- package/drizzle/0000_low_gressill.sql +164 -0
- package/drizzle/0001_calm_thunderbolt_ross.sql +33 -0
- package/drizzle/meta/0000_snapshot.json +1168 -0
- package/drizzle/meta/0001_snapshot.json +1200 -0
- package/drizzle/meta/_journal.json +20 -0
- package/drizzle.config.ts +2 -3
- package/package.json +5 -16
- package/scripts/check-dependencies.sh +64 -0
- package/scripts/db-fix-columns.ts +59 -0
- package/scripts/test-package.sh +82 -0
- package/server.ts +92 -16
- package/src/app/api/attempts/route.ts +1 -1
- package/src/components/task/prompt-input.tsx +32 -0
- package/src/components/task/task-shell-indicator.tsx +1 -1
- package/src/lib/agent-manager.ts +34 -3
- package/src/lib/db/index.ts +25 -3
- package/src/lib/sdk-event-adapter.ts +6 -0
- package/src/lib/session-manager.ts +7 -5
- package/src/lib/shell-manager.ts +105 -9
- package/src/lib/system-prompt.ts +12 -0
package/README.md
CHANGED
|
@@ -1,321 +1,88 @@
|
|
|
1
1
|
# Claude Workspace
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> **DISCLAIMER:** This software is provided "AS IS" without warranty. [Read full disclaimer](./DISCLAIMER.md).
|
|
4
4
|
|
|
5
|
-
**Visual workspace for Claude Code
|
|
5
|
+
**Visual workspace for Claude Code** — Kanban board, code editor, Git integration, local-first SQLite.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## Why Claude Workspace?
|
|
12
|
-
|
|
13
|
-
| Feature | Benefit |
|
|
14
|
-
|---------|---------|
|
|
15
|
-
| 🌍 **Work Everywhere** | SQLite-based local storage—no cloud dependency, works offline anywhere |
|
|
16
|
-
| ⚡ **Consistent Performance** | Lightweight footprint, instant startup, responsive UI on any connection |
|
|
17
|
-
| 🎯 **Unique Workflow** | Conversation checkpoints—rewind, branch, and continue at any point |
|
|
18
|
-
| ✨ **Intuitive Management** | Drag-and-drop Kanban, live streaming, file browser with Git status |
|
|
19
|
-
| 🔌 **Flexible Plugins** | Agent Factory—install only the skills and agents your project needs |
|
|
20
|
-
| 🔋 **Claude Code Native** | Full CLI integration with real-time streaming and file attachments |
|
|
7
|
+

|
|
21
8
|
|
|
22
9
|
---
|
|
23
10
|
|
|
24
11
|
## Features
|
|
25
12
|
|
|
26
|
-
**
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
**
|
|
32
|
-
-
|
|
33
|
-
- Checkpoints: Save and rewind to any conversation state
|
|
34
|
-
- File attachments for context
|
|
35
|
-
- Custom commands: `/cook`, `/plan`, `/fix`, `/brainstorm`
|
|
36
|
-
- Detachable chat window
|
|
37
|
-
|
|
38
|
-
**Code Editor**
|
|
39
|
-
- Tabbed CodeMirror editor with syntax highlighting
|
|
40
|
-
- AI-powered inline code suggestions
|
|
41
|
-
- Go-to-definition navigation
|
|
42
|
-
- Multi-file editing
|
|
43
|
-
|
|
44
|
-
**File System**
|
|
45
|
-
- Interactive file tree browser
|
|
46
|
-
- Unified search (files + content)
|
|
47
|
-
- File preview
|
|
48
|
-
|
|
49
|
-
**Git Integration**
|
|
50
|
-
- Full Git workflow: status, stage, commit, diff
|
|
51
|
-
- Visual Git graph
|
|
52
|
-
- Checkpoint Git snapshots for time-travel debugging
|
|
53
|
-
|
|
54
|
-
**Agent Factory**
|
|
55
|
-
- Plugin system for Claude skills, commands, agents
|
|
56
|
-
- Dependency management
|
|
57
|
-
- Per-project plugin installation
|
|
58
|
-
|
|
59
|
-
**Developer Tools**
|
|
60
|
-
- Background shell process manager
|
|
61
|
-
- Terminal output streaming
|
|
62
|
-
- Multi-project workspace support
|
|
63
|
-
- Themes: Light, Dark, VS Code variants, Dracula
|
|
13
|
+
- **Kanban Board** — Drag-and-drop task management with full conversation history
|
|
14
|
+
- **Real-time Streaming** — Live Claude responses via Socket.io
|
|
15
|
+
- **Checkpoints** — Save and rewind to any conversation state
|
|
16
|
+
- **Code Editor** — Tabbed CodeMirror with syntax highlighting and AI suggestions
|
|
17
|
+
- **Git Integration** — Status, stage, commit, diff, visual graph
|
|
18
|
+
- **Agent Factory** — Plugin system for custom skills, commands, agents
|
|
19
|
+
- **Themes** — Light, Dark, VS Code variants, Dracula
|
|
64
20
|
|
|
65
21
|
---
|
|
66
22
|
|
|
67
23
|
## Quick Start
|
|
68
24
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
**Prerequisites:** Node.js 20+, pnpm 9+, [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code)
|
|
25
|
+
**Prerequisites:** Node.js 20+, [Claude Code CLI](https://docs.anthropic.com/en/docs/claude-code)
|
|
72
26
|
|
|
73
27
|
```bash
|
|
28
|
+
# Option 1: npx (quick try)
|
|
74
29
|
npx -y claude-ws
|
|
75
|
-
```
|
|
76
30
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
The first run will:
|
|
80
|
-
- Auto-create SQLite database in `~/.claude-ws/`
|
|
81
|
-
- Install dependencies and build automatically
|
|
82
|
-
- Start the server on http://localhost:8556
|
|
83
|
-
|
|
84
|
-
### Option 2: Install globally (Recommended)
|
|
85
|
-
|
|
86
|
-
```bash
|
|
31
|
+
# Option 2: Global install (recommended)
|
|
87
32
|
npm install -g claude-ws
|
|
88
33
|
claude-ws
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Global installation avoids npx prompts and rebuilding on every run.
|
|
92
34
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
```bash
|
|
35
|
+
# Option 3: From source
|
|
96
36
|
git clone https://github.com/Claude-Workspace/claude-ws.git
|
|
97
37
|
cd claude-ws
|
|
98
|
-
pnpm install
|
|
99
|
-
pnpm db:migrate
|
|
100
|
-
pnpm dev
|
|
38
|
+
pnpm install && pnpm dev
|
|
101
39
|
```
|
|
102
40
|
|
|
103
|
-
Open
|
|
41
|
+
Open http://localhost:8556
|
|
104
42
|
|
|
105
43
|
---
|
|
106
44
|
|
|
107
45
|
## Configuration
|
|
108
46
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
For secure deployments, you can enable API authentication by setting an `API_ACCESS_KEY`:
|
|
112
|
-
|
|
113
|
-
1. Create a `.env` file in your project directory (or use the global one in `~/.claude-ws/.env`)
|
|
114
|
-
2. Add your API access key:
|
|
47
|
+
Create `.env` file (or use `~/.claude-ws/.env`):
|
|
115
48
|
|
|
116
49
|
```bash
|
|
117
|
-
#
|
|
118
|
-
API_ACCESS_KEY=your-secret-key
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
3. All API requests must include the key in the `x-api-key` header:
|
|
50
|
+
# Optional: API authentication for remote access
|
|
51
|
+
API_ACCESS_KEY=your-secret-key
|
|
122
52
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**Note:** Leave `API_ACCESS_KEY` empty to disable authentication (default for local development).
|
|
128
|
-
|
|
129
|
-
### Claude Code CLI Path
|
|
130
|
-
|
|
131
|
-
Claude Workspace requires the Claude Code CLI to be installed. Set the `CLAUDE_PATH` environment variable to point to your Claude executable:
|
|
132
|
-
|
|
133
|
-
**Linux/Ubuntu:**
|
|
134
|
-
```bash
|
|
135
|
-
CLAUDE_PATH=/home/$(whoami)/.local/bin/claude
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**macOS (Homebrew):**
|
|
139
|
-
```bash
|
|
140
|
-
CLAUDE_PATH=/opt/homebrew/bin/claude
|
|
53
|
+
# Optional: Custom Claude CLI path
|
|
54
|
+
CLAUDE_PATH=/path/to/claude
|
|
141
55
|
```
|
|
142
56
|
|
|
143
|
-
**Windows:**
|
|
144
|
-
```bash
|
|
145
|
-
CLAUDE_PATH=%USERPROFILE%\.local\bin\claude.exe
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
Add this to your `.env` file in the project directory, or the global `.env` at `~/.claude-ws/.env`.
|
|
149
|
-
|
|
150
|
-
### Environment Variables
|
|
151
|
-
|
|
152
57
|
| Variable | Description | Default |
|
|
153
58
|
|----------|-------------|---------|
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `API_ACCESS_KEY` | API authentication key | (empty, no auth) |
|
|
158
|
-
| `DATABASE_URL` | SQLite database path | `./data.db` |
|
|
159
|
-
| `AGENT_FACTORY_DIR` | Agent Factory plugins directory | `~/.claude/agentfactory` |
|
|
59
|
+
| `PORT` | Server port | `8556` |
|
|
60
|
+
| `API_ACCESS_KEY` | API authentication key | (empty) |
|
|
61
|
+
| `CLAUDE_PATH` | Claude CLI path | Auto-detected |
|
|
160
62
|
|
|
161
63
|
---
|
|
162
64
|
|
|
163
|
-
##
|
|
164
|
-
|
|
165
|
-
Access Claude Workspace securely from anywhere using Cloudflare Tunnel + Access.
|
|
166
|
-
|
|
167
|
-
### 1. Install cloudflared
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
# macOS
|
|
171
|
-
brew install cloudflared
|
|
172
|
-
|
|
173
|
-
# Linux
|
|
174
|
-
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -o cloudflared
|
|
175
|
-
chmod +x cloudflared && sudo mv cloudflared /usr/local/bin/
|
|
176
|
-
|
|
177
|
-
# Windows
|
|
178
|
-
winget install Cloudflare.cloudflared
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### 2. Authenticate with Cloudflare
|
|
65
|
+
## Production (PM2)
|
|
182
66
|
|
|
183
67
|
```bash
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
```bash
|
|
190
|
-
cloudflared tunnel create claude-workspace
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### 4. Configure Tunnel
|
|
194
|
-
|
|
195
|
-
Create `~/.cloudflared/config.yml`:
|
|
196
|
-
|
|
197
|
-
```yaml
|
|
198
|
-
tunnel: claude-workspace
|
|
199
|
-
credentials-file: ~/.cloudflared/<TUNNEL_ID>.json
|
|
200
|
-
|
|
201
|
-
ingress:
|
|
202
|
-
- hostname: claude-ws.yourdomain.com
|
|
203
|
-
service: http://localhost:8556
|
|
204
|
-
- service: http_status:404
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### 5. Add DNS Record
|
|
208
|
-
|
|
209
|
-
```bash
|
|
210
|
-
cloudflared tunnel route dns claude-workspace claude-ws.yourdomain.com
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### 6. Run Tunnel
|
|
214
|
-
|
|
215
|
-
```bash
|
|
216
|
-
# Foreground
|
|
217
|
-
cloudflared tunnel run claude-workspace
|
|
218
|
-
|
|
219
|
-
# Or as service (recommended)
|
|
220
|
-
sudo cloudflared service install
|
|
221
|
-
sudo systemctl enable cloudflared
|
|
222
|
-
sudo systemctl start cloudflared
|
|
68
|
+
npm install -g pm2
|
|
69
|
+
pnpm pm2:start # Start server (auto-builds)
|
|
70
|
+
pnpm pm2:logs # View logs
|
|
71
|
+
pnpm pm2:restart # Restart
|
|
72
|
+
pnpm pm2:stop # Stop
|
|
223
73
|
```
|
|
224
74
|
|
|
225
|
-
### 7. Setup Cloudflare Access (Authentication)
|
|
226
|
-
|
|
227
|
-
1. Go to [Cloudflare Zero Trust Dashboard](https://one.dash.cloudflare.com/)
|
|
228
|
-
2. Navigate to **Access** → **Applications** → **Add an application**
|
|
229
|
-
3. Select **Self-hosted**
|
|
230
|
-
4. Configure:
|
|
231
|
-
- **Application name**: Claude Workspace
|
|
232
|
-
- **Session duration**: 24 hours (or your preference)
|
|
233
|
-
- **Application domain**: `claude-ws.yourdomain.com`
|
|
234
|
-
5. Add **Access Policy**:
|
|
235
|
-
- **Policy name**: Allowed Users
|
|
236
|
-
- **Action**: Allow
|
|
237
|
-
- **Include**: Emails ending in `@yourdomain.com` or specific email addresses
|
|
238
|
-
6. Save and deploy
|
|
239
|
-
|
|
240
|
-
Now access `https://claude-ws.yourdomain.com` from anywhere with Cloudflare authentication.
|
|
241
|
-
|
|
242
75
|
---
|
|
243
76
|
|
|
244
|
-
##
|
|
245
|
-
|
|
246
|
-
### Check current version
|
|
247
|
-
```bash
|
|
248
|
-
claude-ws --version
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
### Update to latest version
|
|
252
|
-
```bash
|
|
253
|
-
npm update -g claude-ws
|
|
254
|
-
```
|
|
77
|
+
## Remote Access
|
|
255
78
|
|
|
256
|
-
|
|
257
|
-
```bash
|
|
258
|
-
npm install -g claude-ws@latest
|
|
259
|
-
```
|
|
79
|
+
For secure remote access, see [Cloudflare Tunnel Setup](./docs/cloudflare-tunnel.md).
|
|
260
80
|
|
|
261
81
|
---
|
|
262
82
|
|
|
263
83
|
## Tech Stack
|
|
264
84
|
|
|
265
|
-
|
|
266
|
-
- **Database**: SQLite + Drizzle ORM
|
|
267
|
-
- **Real-time**: Socket.io
|
|
268
|
-
- **Styling**: Tailwind CSS 4
|
|
269
|
-
- **UI**: Radix UI primitives
|
|
270
|
-
- **State**: Zustand
|
|
271
|
-
- **Drag & Drop**: dnd-kit
|
|
272
|
-
|
|
273
|
-
---
|
|
274
|
-
|
|
275
|
-
## Scripts
|
|
276
|
-
|
|
277
|
-
| Command | Description |
|
|
278
|
-
|---------|-------------|
|
|
279
|
-
| `pnpm dev` | Start development server |
|
|
280
|
-
| `pnpm build` | Build for production |
|
|
281
|
-
| `pnpm start` | Start production server |
|
|
282
|
-
| `pnpm lint` | Run ESLint |
|
|
283
|
-
| `pnpm db:migrate` | Run database migrations |
|
|
284
|
-
| `pnpm pm2:start` | Start with PM2 process manager |
|
|
285
|
-
| `pnpm pm2:stop` | Stop PM2 process |
|
|
286
|
-
| `pnpm pm2:restart` | Restart PM2 process |
|
|
287
|
-
| `pnpm pm2:logs` | View PM2 logs |
|
|
288
|
-
| `pnpm pm2:monit` | Monitor PM2 process |
|
|
289
|
-
|
|
290
|
-
### Running with PM2
|
|
291
|
-
|
|
292
|
-
For production deployments with auto-restart and process management:
|
|
293
|
-
|
|
294
|
-
```bash
|
|
295
|
-
# Install PM2 globally (if not already installed)
|
|
296
|
-
npm install -g pm2
|
|
297
|
-
|
|
298
|
-
# Start the server
|
|
299
|
-
pnpm pm2:start
|
|
300
|
-
|
|
301
|
-
# View logs
|
|
302
|
-
pnpm pm2:logs
|
|
303
|
-
|
|
304
|
-
# Monitor process
|
|
305
|
-
pnpm pm2:monit
|
|
306
|
-
|
|
307
|
-
# Restart
|
|
308
|
-
pnpm pm2:restart
|
|
309
|
-
|
|
310
|
-
# Stop
|
|
311
|
-
pnpm pm2:stop
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
PM2 Features:
|
|
315
|
-
- Auto-restart on crash (max 10 attempts)
|
|
316
|
-
- Memory limit monitoring (500MB)
|
|
317
|
-
- Log rotation and management
|
|
318
|
-
- Process status tracking
|
|
85
|
+
Next.js 16, React 19, SQLite + Drizzle ORM, Socket.io, Tailwind CSS 4, Radix UI, Zustand
|
|
319
86
|
|
|
320
87
|
---
|
|
321
88
|
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
CREATE TABLE `agent_factory_plugins` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`type` text NOT NULL,
|
|
4
|
+
`name` text NOT NULL,
|
|
5
|
+
`description` text,
|
|
6
|
+
`source_path` text,
|
|
7
|
+
`storage_type` text DEFAULT 'local' NOT NULL,
|
|
8
|
+
`agent_set_path` text,
|
|
9
|
+
`metadata` text,
|
|
10
|
+
`created_at` integer NOT NULL,
|
|
11
|
+
`updated_at` integer NOT NULL
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE TABLE `attempt_files` (
|
|
15
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
16
|
+
`attempt_id` text NOT NULL,
|
|
17
|
+
`filename` text NOT NULL,
|
|
18
|
+
`original_name` text NOT NULL,
|
|
19
|
+
`mime_type` text NOT NULL,
|
|
20
|
+
`size` integer NOT NULL,
|
|
21
|
+
`created_at` integer NOT NULL,
|
|
22
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE cascade
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE INDEX `idx_attempt_files_attempt` ON `attempt_files` (`attempt_id`);--> statement-breakpoint
|
|
26
|
+
CREATE TABLE `attempt_logs` (
|
|
27
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
28
|
+
`attempt_id` text NOT NULL,
|
|
29
|
+
`type` text NOT NULL,
|
|
30
|
+
`content` text NOT NULL,
|
|
31
|
+
`created_at` integer NOT NULL,
|
|
32
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE cascade
|
|
33
|
+
);
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
CREATE INDEX `idx_logs_attempt` ON `attempt_logs` (`attempt_id`,`created_at`);--> statement-breakpoint
|
|
36
|
+
CREATE TABLE `attempts` (
|
|
37
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
38
|
+
`task_id` text NOT NULL,
|
|
39
|
+
`prompt` text NOT NULL,
|
|
40
|
+
`display_prompt` text,
|
|
41
|
+
`status` text DEFAULT 'running' NOT NULL,
|
|
42
|
+
`session_id` text,
|
|
43
|
+
`branch` text,
|
|
44
|
+
`diff_additions` integer DEFAULT 0 NOT NULL,
|
|
45
|
+
`diff_deletions` integer DEFAULT 0 NOT NULL,
|
|
46
|
+
`total_tokens` integer DEFAULT 0 NOT NULL,
|
|
47
|
+
`input_tokens` integer DEFAULT 0 NOT NULL,
|
|
48
|
+
`output_tokens` integer DEFAULT 0 NOT NULL,
|
|
49
|
+
`cache_creation_tokens` integer DEFAULT 0 NOT NULL,
|
|
50
|
+
`cache_read_tokens` integer DEFAULT 0 NOT NULL,
|
|
51
|
+
`total_cost_usd` integer DEFAULT 0 NOT NULL,
|
|
52
|
+
`num_turns` integer DEFAULT 0 NOT NULL,
|
|
53
|
+
`duration_ms` integer DEFAULT 0 NOT NULL,
|
|
54
|
+
`created_at` integer NOT NULL,
|
|
55
|
+
`completed_at` integer,
|
|
56
|
+
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade
|
|
57
|
+
);
|
|
58
|
+
--> statement-breakpoint
|
|
59
|
+
CREATE INDEX `idx_attempts_task` ON `attempts` (`task_id`,`created_at`);--> statement-breakpoint
|
|
60
|
+
CREATE TABLE `checkpoints` (
|
|
61
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
62
|
+
`task_id` text NOT NULL,
|
|
63
|
+
`attempt_id` text NOT NULL,
|
|
64
|
+
`session_id` text NOT NULL,
|
|
65
|
+
`git_commit_hash` text,
|
|
66
|
+
`message_count` integer NOT NULL,
|
|
67
|
+
`summary` text,
|
|
68
|
+
`created_at` integer NOT NULL,
|
|
69
|
+
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
70
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE cascade
|
|
71
|
+
);
|
|
72
|
+
--> statement-breakpoint
|
|
73
|
+
CREATE INDEX `idx_checkpoints_task` ON `checkpoints` (`task_id`,`created_at`);--> statement-breakpoint
|
|
74
|
+
CREATE TABLE `plugin_dependencies` (
|
|
75
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
76
|
+
`plugin_id` text NOT NULL,
|
|
77
|
+
`dependency_type` text NOT NULL,
|
|
78
|
+
`spec` text NOT NULL,
|
|
79
|
+
`plugin_dependency_id` text,
|
|
80
|
+
`installed` integer DEFAULT false NOT NULL,
|
|
81
|
+
`created_at` integer NOT NULL,
|
|
82
|
+
FOREIGN KEY (`plugin_id`) REFERENCES `agent_factory_plugins`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
83
|
+
FOREIGN KEY (`plugin_dependency_id`) REFERENCES `agent_factory_plugins`(`id`) ON UPDATE no action ON DELETE set null
|
|
84
|
+
);
|
|
85
|
+
--> statement-breakpoint
|
|
86
|
+
CREATE INDEX `idx_plugin_deps` ON `plugin_dependencies` (`plugin_id`);--> statement-breakpoint
|
|
87
|
+
CREATE INDEX `idx_plugin_depends_on` ON `plugin_dependencies` (`plugin_dependency_id`);--> statement-breakpoint
|
|
88
|
+
CREATE TABLE `plugin_dependency_cache` (
|
|
89
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
90
|
+
`plugin_id` text,
|
|
91
|
+
`source_path` text,
|
|
92
|
+
`source_hash` text,
|
|
93
|
+
`type` text NOT NULL,
|
|
94
|
+
`library_deps` text,
|
|
95
|
+
`plugin_deps` text,
|
|
96
|
+
`install_script_npm` text,
|
|
97
|
+
`install_script_pnpm` text,
|
|
98
|
+
`install_script_yarn` text,
|
|
99
|
+
`install_script_pip` text,
|
|
100
|
+
`install_script_poetry` text,
|
|
101
|
+
`install_script_cargo` text,
|
|
102
|
+
`install_script_go` text,
|
|
103
|
+
`dockerfile` text,
|
|
104
|
+
`depth` integer DEFAULT 0 NOT NULL,
|
|
105
|
+
`has_cycles` integer DEFAULT false NOT NULL,
|
|
106
|
+
`resolved_at` integer NOT NULL,
|
|
107
|
+
`created_at` integer NOT NULL,
|
|
108
|
+
FOREIGN KEY (`plugin_id`) REFERENCES `agent_factory_plugins`(`id`) ON UPDATE no action ON DELETE cascade
|
|
109
|
+
);
|
|
110
|
+
--> statement-breakpoint
|
|
111
|
+
CREATE INDEX `idx_cache_plugin` ON `plugin_dependency_cache` (`plugin_id`);--> statement-breakpoint
|
|
112
|
+
CREATE INDEX `idx_cache_source` ON `plugin_dependency_cache` (`source_path`);--> statement-breakpoint
|
|
113
|
+
CREATE TABLE `project_plugins` (
|
|
114
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
115
|
+
`project_id` text NOT NULL,
|
|
116
|
+
`plugin_id` text NOT NULL,
|
|
117
|
+
`enabled` integer DEFAULT true NOT NULL,
|
|
118
|
+
`created_at` integer NOT NULL,
|
|
119
|
+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
120
|
+
FOREIGN KEY (`plugin_id`) REFERENCES `agent_factory_plugins`(`id`) ON UPDATE no action ON DELETE cascade
|
|
121
|
+
);
|
|
122
|
+
--> statement-breakpoint
|
|
123
|
+
CREATE INDEX `idx_project_plugins` ON `project_plugins` (`project_id`,`plugin_id`);--> statement-breakpoint
|
|
124
|
+
CREATE TABLE `projects` (
|
|
125
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
126
|
+
`name` text NOT NULL,
|
|
127
|
+
`path` text NOT NULL,
|
|
128
|
+
`created_at` integer NOT NULL
|
|
129
|
+
);
|
|
130
|
+
--> statement-breakpoint
|
|
131
|
+
CREATE UNIQUE INDEX `projects_path_unique` ON `projects` (`path`);--> statement-breakpoint
|
|
132
|
+
CREATE TABLE `shells` (
|
|
133
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
134
|
+
`project_id` text NOT NULL,
|
|
135
|
+
`attempt_id` text,
|
|
136
|
+
`command` text NOT NULL,
|
|
137
|
+
`cwd` text NOT NULL,
|
|
138
|
+
`pid` integer,
|
|
139
|
+
`status` text DEFAULT 'running' NOT NULL,
|
|
140
|
+
`exit_code` integer,
|
|
141
|
+
`exit_signal` text,
|
|
142
|
+
`created_at` integer NOT NULL,
|
|
143
|
+
`stopped_at` integer,
|
|
144
|
+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
145
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE set null
|
|
146
|
+
);
|
|
147
|
+
--> statement-breakpoint
|
|
148
|
+
CREATE INDEX `idx_shells_project` ON `shells` (`project_id`,`status`);--> statement-breakpoint
|
|
149
|
+
CREATE TABLE `tasks` (
|
|
150
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
151
|
+
`project_id` text NOT NULL,
|
|
152
|
+
`title` text NOT NULL,
|
|
153
|
+
`description` text,
|
|
154
|
+
`status` text DEFAULT 'todo' NOT NULL,
|
|
155
|
+
`position` integer NOT NULL,
|
|
156
|
+
`chat_init` integer DEFAULT false NOT NULL,
|
|
157
|
+
`rewind_session_id` text,
|
|
158
|
+
`rewind_message_uuid` text,
|
|
159
|
+
`created_at` integer NOT NULL,
|
|
160
|
+
`updated_at` integer NOT NULL,
|
|
161
|
+
FOREIGN KEY (`project_id`) REFERENCES `projects`(`id`) ON UPDATE no action ON DELETE cascade
|
|
162
|
+
);
|
|
163
|
+
--> statement-breakpoint
|
|
164
|
+
CREATE INDEX `idx_tasks_project` ON `tasks` (`project_id`,`status`,`position`);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
PRAGMA foreign_keys=OFF;--> statement-breakpoint
|
|
2
|
+
CREATE TABLE `__new_attempts` (
|
|
3
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
4
|
+
`task_id` text NOT NULL,
|
|
5
|
+
`prompt` text NOT NULL,
|
|
6
|
+
`display_prompt` text,
|
|
7
|
+
`status` text DEFAULT 'running' NOT NULL,
|
|
8
|
+
`session_id` text,
|
|
9
|
+
`branch` text,
|
|
10
|
+
`diff_additions` integer DEFAULT 0 NOT NULL,
|
|
11
|
+
`diff_deletions` integer DEFAULT 0 NOT NULL,
|
|
12
|
+
`total_tokens` integer DEFAULT 0 NOT NULL,
|
|
13
|
+
`input_tokens` integer DEFAULT 0 NOT NULL,
|
|
14
|
+
`output_tokens` integer DEFAULT 0 NOT NULL,
|
|
15
|
+
`cache_creation_tokens` integer DEFAULT 0 NOT NULL,
|
|
16
|
+
`cache_read_tokens` integer DEFAULT 0 NOT NULL,
|
|
17
|
+
`total_cost_usd` text DEFAULT '0' NOT NULL,
|
|
18
|
+
`num_turns` integer DEFAULT 0 NOT NULL,
|
|
19
|
+
`duration_ms` integer DEFAULT 0 NOT NULL,
|
|
20
|
+
`context_used` integer DEFAULT 0 NOT NULL,
|
|
21
|
+
`context_limit` integer DEFAULT 200000 NOT NULL,
|
|
22
|
+
`context_percentage` integer DEFAULT 0 NOT NULL,
|
|
23
|
+
`baseline_context` integer DEFAULT 0 NOT NULL,
|
|
24
|
+
`created_at` integer NOT NULL,
|
|
25
|
+
`completed_at` integer,
|
|
26
|
+
FOREIGN KEY (`task_id`) REFERENCES `tasks`(`id`) ON UPDATE no action ON DELETE cascade
|
|
27
|
+
);
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
INSERT INTO `__new_attempts`("id", "task_id", "prompt", "display_prompt", "status", "session_id", "branch", "diff_additions", "diff_deletions", "total_tokens", "input_tokens", "output_tokens", "cache_creation_tokens", "cache_read_tokens", "total_cost_usd", "num_turns", "duration_ms", "context_used", "context_limit", "context_percentage", "baseline_context", "created_at", "completed_at") SELECT "id", "task_id", "prompt", "display_prompt", "status", "session_id", "branch", "diff_additions", "diff_deletions", "total_tokens", "input_tokens", "output_tokens", "cache_creation_tokens", "cache_read_tokens", "total_cost_usd", "num_turns", "duration_ms", "context_used", "context_limit", "context_percentage", "baseline_context", "created_at", "completed_at" FROM `attempts`;--> statement-breakpoint
|
|
30
|
+
DROP TABLE `attempts`;--> statement-breakpoint
|
|
31
|
+
ALTER TABLE `__new_attempts` RENAME TO `attempts`;--> statement-breakpoint
|
|
32
|
+
PRAGMA foreign_keys=ON;--> statement-breakpoint
|
|
33
|
+
CREATE INDEX `idx_attempts_task` ON `attempts` (`task_id`,`created_at`);
|