feat(ui): implement explicit chat modes for collaborate, delegate, and vibe coding
This commit is contained in:
@@ -788,6 +788,7 @@ export function ChatPanel({
|
||||
const [activeThread, setActiveThread] = useState<string | null>(null);
|
||||
const [messages, setMessages] = useState<Message[]>([]);
|
||||
const [input, setInput] = useState("");
|
||||
const [chatMode, setChatMode] = useState<"collaborate" | "vibe" | "delegate">("collaborate");
|
||||
const [sending, setSending] = useState(false);
|
||||
const [showThreads, setShowThreads] = useState(false);
|
||||
const [mcpToken, setMcpToken] = useState<string | null>(null);
|
||||
@@ -1029,6 +1030,33 @@ export function ChatPanel({
|
||||
abortRef.current = controller;
|
||||
|
||||
try {
|
||||
// If Delegate mode is selected, route to the background runner instead of streaming chat!
|
||||
if (chatMode === "delegate") {
|
||||
const r = await fetch(
|
||||
`/api/projects/${projectId}/agent/sessions`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
appName: "frontend",
|
||||
appPath: ".",
|
||||
task: text,
|
||||
}),
|
||||
},
|
||||
);
|
||||
if (!r.ok) {
|
||||
const err = await r.json().catch(() => ({}));
|
||||
throw new Error(err.error || `HTTP ${r.status}`);
|
||||
}
|
||||
|
||||
setMessages((prev) => [
|
||||
...prev,
|
||||
{ role: "assistant", content: "I have started a background runner for this task. You can safely close this browser or work on something else. I will commit and ship the code when I am finished!" },
|
||||
]);
|
||||
setSending(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await fetch("/api/chat", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@@ -1037,6 +1065,7 @@ export function ChatPanel({
|
||||
message: text,
|
||||
workspace,
|
||||
mcp_token: mcpToken,
|
||||
chatMode,
|
||||
}),
|
||||
signal: controller.signal,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user