Skip to content

Commit 9a55f64

Browse files
committed
fix(skills): add database storage for skills on serverless (Vercel)
- Add skills table to Postgres and SQLite schemas - Create PgSkillStore for database-backed skill storage - Update /api/skills/catalog to use DB storage on serverless - Update /api/skills to load skills from DB on serverless - Generate database migrations for both Postgres and SQLite Fixes #19
1 parent 2015b77 commit 9a55f64

11 files changed

Lines changed: 2491 additions & 25 deletions

File tree

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
CREATE TABLE `acp_sessions` (
2+
`id` text PRIMARY KEY NOT NULL,
3+
`name` text,
4+
`cwd` text NOT NULL,
5+
`workspace_id` text NOT NULL,
6+
`routa_agent_id` text,
7+
`provider` text,
8+
`role` text,
9+
`mode_id` text,
10+
`first_prompt_sent` integer DEFAULT false,
11+
`message_history` text DEFAULT '[]',
12+
`created_at` integer NOT NULL,
13+
`updated_at` integer NOT NULL
14+
);
15+
--> statement-breakpoint
16+
CREATE TABLE `agents` (
17+
`id` text PRIMARY KEY NOT NULL,
18+
`name` text NOT NULL,
19+
`role` text NOT NULL,
20+
`model_tier` text DEFAULT 'SMART' NOT NULL,
21+
`workspace_id` text NOT NULL,
22+
`parent_id` text,
23+
`status` text DEFAULT 'PENDING' NOT NULL,
24+
`metadata` text DEFAULT '{}',
25+
`created_at` integer NOT NULL,
26+
`updated_at` integer NOT NULL,
27+
FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE cascade
28+
);
29+
--> statement-breakpoint
30+
CREATE TABLE `event_subscriptions` (
31+
`id` text PRIMARY KEY NOT NULL,
32+
`agent_id` text NOT NULL,
33+
`agent_name` text NOT NULL,
34+
`event_types` text NOT NULL,
35+
`exclude_self` integer DEFAULT true NOT NULL,
36+
`one_shot` integer DEFAULT false NOT NULL,
37+
`wait_group_id` text,
38+
`priority` integer DEFAULT 0 NOT NULL,
39+
`created_at` integer NOT NULL
40+
);
41+
--> statement-breakpoint
42+
CREATE TABLE `messages` (
43+
`id` text PRIMARY KEY NOT NULL,
44+
`agent_id` text NOT NULL,
45+
`role` text NOT NULL,
46+
`content` text NOT NULL,
47+
`timestamp` integer NOT NULL,
48+
`tool_name` text,
49+
`tool_args` text,
50+
`turn` integer
51+
);
52+
--> statement-breakpoint
53+
CREATE TABLE `notes` (
54+
`id` text NOT NULL,
55+
`workspace_id` text NOT NULL,
56+
`title` text NOT NULL,
57+
`content` text DEFAULT '' NOT NULL,
58+
`type` text DEFAULT 'general' NOT NULL,
59+
`task_status` text,
60+
`assigned_agent_ids` text,
61+
`parent_note_id` text,
62+
`linked_task_id` text,
63+
`custom_metadata` text,
64+
`created_at` integer NOT NULL,
65+
`updated_at` integer NOT NULL,
66+
FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE cascade
67+
);
68+
--> statement-breakpoint
69+
CREATE TABLE `pending_events` (
70+
`id` text PRIMARY KEY NOT NULL,
71+
`agent_id` text NOT NULL,
72+
`event_type` text NOT NULL,
73+
`source_agent_id` text NOT NULL,
74+
`workspace_id` text NOT NULL,
75+
`data` text DEFAULT '{}',
76+
`timestamp` integer NOT NULL
77+
);
78+
--> statement-breakpoint
79+
CREATE TABLE `skills` (
80+
`id` text PRIMARY KEY NOT NULL,
81+
`name` text NOT NULL,
82+
`description` text DEFAULT '' NOT NULL,
83+
`source` text NOT NULL,
84+
`catalog_type` text DEFAULT 'skillssh' NOT NULL,
85+
`files` text DEFAULT '[]' NOT NULL,
86+
`license` text,
87+
`metadata` text DEFAULT '{}',
88+
`installs` integer DEFAULT 0 NOT NULL,
89+
`created_at` integer NOT NULL,
90+
`updated_at` integer NOT NULL
91+
);
92+
--> statement-breakpoint
93+
CREATE TABLE `tasks` (
94+
`id` text PRIMARY KEY NOT NULL,
95+
`title` text NOT NULL,
96+
`objective` text NOT NULL,
97+
`scope` text,
98+
`acceptance_criteria` text,
99+
`verification_commands` text,
100+
`assigned_to` text,
101+
`status` text DEFAULT 'PENDING' NOT NULL,
102+
`dependencies` text DEFAULT '[]',
103+
`parallel_group` text,
104+
`workspace_id` text NOT NULL,
105+
`completion_summary` text,
106+
`verification_verdict` text,
107+
`verification_report` text,
108+
`version` integer DEFAULT 1 NOT NULL,
109+
`created_at` integer NOT NULL,
110+
`updated_at` integer NOT NULL,
111+
FOREIGN KEY (`workspace_id`) REFERENCES `workspaces`(`id`) ON UPDATE no action ON DELETE cascade
112+
);
113+
--> statement-breakpoint
114+
CREATE TABLE `workspaces` (
115+
`id` text PRIMARY KEY NOT NULL,
116+
`title` text NOT NULL,
117+
`repo_path` text,
118+
`branch` text,
119+
`status` text DEFAULT 'active' NOT NULL,
120+
`metadata` text DEFAULT '{}',
121+
`created_at` integer NOT NULL,
122+
`updated_at` integer NOT NULL
123+
);

0 commit comments

Comments
 (0)