"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { TextareaHTMLAttributes } from "react"; import { useAi } from "@/hooks/useAi"; export default function OmniConsole() { const [instruction, setInstruction] = useState(""); const [context, setContext] = useState("/frontend\n /src\n /components\n/backend\n /routes\n /controllers\n"); const [out, setOut] = useState(null); const { model, provider } = useAi(); const [loading, setLoading] = useState(false); const [space, setSpace] = useState(""); const [commitTitle, setCommitTitle] = useState("OmniDev: Apply changes"); const run = async () => { setLoading(true); setOut(null); try { const res = await fetch('/api/augment', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ context, instruction, language: 'javascript', framework: 'express-react', response_type: 'file_updates', model, provider }), }); const data = await res.json(); setOut(data); } finally { setLoading(false); } }; const apply = async () => { if (!out?.files || !Array.isArray(out.files) || out.files.length === 0) return; if (!space.includes('/')) { alert('Specify target space as namespace/repoId'); return; } const [namespace, repoId] = space.split('/'); setLoading(true); try { const res = await fetch(`/api/me/projects/${namespace}/${repoId}/apply`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ files: out.files, commitTitle }), }); const data = await res.json(); setOut((prev: any) => ({ ...prev, apply: data })); } finally { setLoading(false); } } return (

Omni Console

Type engineering instructions; the engine returns structured file updates.