CREATE TABLE `browserSessions` (
	`id` int AUTO_INCREMENT NOT NULL,
	`sessionId` varchar(64) NOT NULL,
	`agentId` int NOT NULL,
	`currentUrl` text,
	`title` text,
	`status` enum('active','idle','closed','error') DEFAULT 'idle',
	`screenshotUrl` text,
	`lastActionAt` timestamp DEFAULT (now()),
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`closedAt` timestamp,
	CONSTRAINT `browserSessions_id` PRIMARY KEY(`id`),
	CONSTRAINT `browserSessions_sessionId_unique` UNIQUE(`sessionId`)
);
--> statement-breakpoint
CREATE TABLE `toolDefinitions` (
	`id` int AUTO_INCREMENT NOT NULL,
	`toolId` varchar(100) NOT NULL,
	`name` varchar(255) NOT NULL,
	`description` text NOT NULL,
	`category` varchar(50) NOT NULL DEFAULT 'custom',
	`dangerous` boolean DEFAULT false,
	`parameters` json,
	`implementation` text NOT NULL,
	`isActive` boolean DEFAULT true,
	`createdBy` int,
	`createdAt` timestamp NOT NULL DEFAULT (now()),
	`updatedAt` timestamp NOT NULL DEFAULT (now()) ON UPDATE CURRENT_TIMESTAMP,
	CONSTRAINT `toolDefinitions_id` PRIMARY KEY(`id`),
	CONSTRAINT `toolDefinitions_toolId_unique` UNIQUE(`toolId`)
);
