as('build_template') ->for('Erzeugt eine fertige HTML-Seite und gibt die URL zurück. Nutze das, wenn der User eine Seite, ein Dashboard oder Layout sehen will.') ->withStringParameter('title', 'Titel der Seite') ->withStringParameter('html_body', 'Vollständiges
-HTML inkl. Tailwind-Klassen') ->using(fn (string $title, string $html_body) => $this->execute($title, $html_body)); } public function execute(string $title, string $htmlBody): string { $slug = Str::slug($title) ?: 'page-'.Str::random(6); $filename = 'templates/'.$slug.'-'.Str::random(4).'.html'; $page = $this->wrap($title, $htmlBody); Storage::disk('public')->put($filename, $page); $url = rtrim(config('app.url'), '/').'/storage/'.$filename; // Push im Chat-Stream als Tool-Use Notiz $message = Message::create([ 'role' => Message::ROLE_TOOL, 'content' => "Template erstellt: {$title}", 'type' => Message::TYPE_TOOL_USE, 'metadata' => ['url' => $url, 'tool' => 'build_template'], ]); broadcast(new FoxMessage($message)); return $url; } protected function wrap(string $title, string $body): string { $title = e($title); return <<