HEX
Server: LiteSpeed
System: Linux server318.web-hosting.com 4.18.0-513.18.1.lve.el8.x86_64 #1 SMP Thu Feb 22 12:55:50 UTC 2024 x86_64
User: sahadove (2893)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /home/sahadove/wp-content/plugins/extendify/src/Agent/workflows/content/tools/generate-page.js
import { generatePage } from '@agent/workflows/content/components/PageContentShell';

export default async ({ pageDescription }) => {
	// Input validation
	if (!pageDescription || pageDescription.trim().length === 0) {
		throw new Error('Page description cannot be empty');
	}
	// this should return the page data
	const data = await generatePage(pageDescription);

	if (!data?.id) {
		throw new Error('Page creation failed');
	}

	return { post_id: Number(data.id) };
};