-- name: ListAgents :many SELECT * FROM agent WHERE workspace_id = $1 ORDER BY created_at ASC; -- name: GetAgent :one SELECT * FROM agent WHERE id = $1; -- name: CreateAgent :one INSERT INTO agent ( workspace_id, name, avatar_url, runtime_mode, runtime_config, visibility, max_concurrent_tasks, owner_id ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *; -- name: UpdateAgent :one UPDATE agent SET name = COALESCE(sqlc.narg('name'), name), avatar_url = COALESCE(sqlc.narg('avatar_url'), avatar_url), runtime_config = COALESCE(sqlc.narg('runtime_config'), runtime_config), visibility = COALESCE(sqlc.narg('visibility'), visibility), status = COALESCE(sqlc.narg('status'), status), max_concurrent_tasks = COALESCE(sqlc.narg('max_concurrent_tasks'), max_concurrent_tasks), updated_at = now() WHERE id = $1 RETURNING *; -- name: DeleteAgent :exec DELETE FROM agent WHERE id = $1;