diff --git a/apps/api/src/app.ts b/apps/api/src/app.ts
index ea051302..c17b21e8 100644
--- a/apps/api/src/app.ts
+++ b/apps/api/src/app.ts
@@ -430,6 +430,7 @@ export async function createApp(
sandbox,
memory,
home,
+ runtime,
secrets,
oauthLogins,
integrationSettings,
diff --git a/apps/api/src/bot-refine.test.ts b/apps/api/src/bot-refine.test.ts
new file mode 100644
index 00000000..2c88c3ae
--- /dev/null
+++ b/apps/api/src/bot-refine.test.ts
@@ -0,0 +1,44 @@
+import { ScriptedAgentRuntime } from "@milo/adapters";
+import { describe, expect, it } from "vitest";
+import {
+ buildRefinePrompt,
+ fallbackRefine,
+ parseRefineReply,
+ refineBotProfile,
+} from "./bot-refine.js";
+
+describe("bot refine", () => {
+ it("builds a prompt the scripted runtime can match", () => {
+ expect(buildRefinePrompt("Scout", "Find travel deals")).toContain("milo refine bot profile");
+ expect(buildRefinePrompt("Scout", "Find travel deals")).toContain("Name: Scout");
+ });
+
+ it("falls back when the reply is not JSON", () => {
+ expect(parseRefineReply("sorry", "Scout", "Find travel deals.")).toEqual(
+ fallbackRefine("Scout", "Find travel deals."),
+ );
+ });
+
+ it("parses a JSON reply", () => {
+ expect(
+ parseRefineReply(
+ 'Here you go:\n{"title":"Travel finder","instructions":"Hunt deals daily."}\n',
+ "Scout",
+ "Find travel deals",
+ ),
+ ).toEqual({
+ title: "Travel finder",
+ instructions: "Hunt deals daily.",
+ });
+ });
+
+ it("runs through the scripted runtime", async () => {
+ const refined = await refineBotProfile(
+ new ScriptedAgentRuntime(),
+ { name: "Scout", description: "Find travel deals every morning." },
+ { provider: "scripted", id: "scripted" },
+ );
+ expect(refined.title.length).toBeGreaterThan(0);
+ expect(refined.instructions).toContain("Find travel deals");
+ });
+});
diff --git a/apps/api/src/bot-refine.ts b/apps/api/src/bot-refine.ts
new file mode 100644
index 00000000..19bbd4b1
--- /dev/null
+++ b/apps/api/src/bot-refine.ts
@@ -0,0 +1,77 @@
+import { randomUUID } from "node:crypto";
+import type { AgentRuntime } from "@milo/adapter-kit";
+import {
+ BOT_INSTRUCTIONS_MAX_LENGTH,
+ BOT_TITLE_MAX_LENGTH,
+ type RefineBotOutput,
+} from "@milo/contracts";
+
+/** Marker the scripted runtime matches so offline tests stay deterministic. */
+export const REFINE_PROMPT_MARKER = "milo refine bot profile";
+
+/**
+ * One place for the refine prompt. The model returns JSON only:
+ * `{"title":"…","instructions":"…"}`.
+ */
+export function buildRefinePrompt(name: string, description: string): string {
+ return `${REFINE_PROMPT_MARKER}
+Name: ${name}
+Description: ${description || "(none)"}
+---
+Reply with JSON only, no markdown: {"title":"","instructions":""}.
+Keep title under 80 characters. Instructions should be concrete and actionable.`;
+}
+
+export function fallbackRefine(name: string, description: string): RefineBotOutput {
+ const trimmed = description.trim();
+ const title = (trimmed.split(/[.!\n]/)[0] ?? "").trim().slice(0, 80) || name;
+ return {
+ title: title.slice(0, BOT_TITLE_MAX_LENGTH),
+ instructions: (trimmed || `You are ${name}. Help with whatever is asked.`).slice(
+ 0,
+ BOT_INSTRUCTIONS_MAX_LENGTH,
+ ),
+ };
+}
+
+export function parseRefineReply(text: string, name: string, description: string): RefineBotOutput {
+ const match = text.match(/\{[\s\S]*\}/);
+ if (!match) return fallbackRefine(name, description);
+ try {
+ const parsed = JSON.parse(match[0]) as { title?: unknown; instructions?: unknown };
+ const title =
+ typeof parsed.title === "string" ? parsed.title.trim().slice(0, BOT_TITLE_MAX_LENGTH) : "";
+ const instructions =
+ typeof parsed.instructions === "string"
+ ? parsed.instructions.trim().slice(0, BOT_INSTRUCTIONS_MAX_LENGTH)
+ : "";
+ if (!title || !instructions) return fallbackRefine(name, description);
+ return { title, instructions };
+ } catch {
+ return fallbackRefine(name, description);
+ }
+}
+
+/** Run the refine prompt through the agent runtime and parse the reply. */
+export async function refineBotProfile(
+ runtime: AgentRuntime,
+ input: { name: string; description: string },
+ model: { provider: string; id: string },
+): Promise {
+ const prompt = buildRefinePrompt(input.name, input.description);
+ let text = "";
+ for await (const event of runtime.run({
+ botId: "refine",
+ threadId: "refine",
+ runId: randomUUID(),
+ prompt,
+ instructions: "You refine bot profiles. Reply with JSON only.",
+ history: [],
+ tools: [],
+ model,
+ })) {
+ if (event.type === "text" && event.text) text += event.text;
+ if (event.type === "done" && event.text) text = event.text;
+ }
+ return parseRefineReply(text, input.name, input.description);
+}
diff --git a/apps/api/src/router.ts b/apps/api/src/router.ts
index 62df81ea..eb55bc20 100644
--- a/apps/api/src/router.ts
+++ b/apps/api/src/router.ts
@@ -2,6 +2,7 @@ import { createHash, randomBytes, randomUUID } from "node:crypto";
import type {
AdapterContext,
AgentHomeStore,
+ AgentRuntime,
ArtifactStore,
ConnectorCatalogItem,
JobPublisher,
@@ -210,6 +211,7 @@ import {
listArtifactVersions,
listSpaceArtifacts,
} from "./artifacts.js";
+import { refineBotProfile } from "./bot-refine.js";
import { botProfileLabelsChanged, commitBotUpdate } from "./bot-update.js";
import {
executionBlocksUserTakeover,
@@ -542,6 +544,8 @@ export interface RouterDeps {
sandbox: SandboxProvider;
memory: MemoryStore;
home: AgentHomeStore;
+ /** Used by bots.refine for a short profile pass before create. */
+ runtime: AgentRuntime;
secrets: EncryptedSecretStore;
oauthLogins: PiOAuthLogins;
/** Live Codex catalog seam; defaults to the shared per-process cache. */
@@ -1406,11 +1410,27 @@ export function createRouter(deps: RouterDeps) {
} catch (error) {
throw mapSpaceLifecycleError(error);
}
- await enqueueBotIntroRun(deps, context.actor, bot).catch((error) => {
- getLogger().error("bot intro run enqueue", error);
+ // Fixed intro with idea chips; the model-driven intro run is unused since v0.
+ await introduce(onboardingDeps, context.actor, bot.id).catch((error) => {
+ getLogger().error("bot intro", error);
});
return bot;
}),
+ refine: authed.bots.refine.handler(async ({ context, input }) => {
+ const managed = await selectRuntimeModel(
+ deps.prisma,
+ context.actor,
+ runtimeModel(deps.env.agentRuntime),
+ );
+ const model = managed
+ ? { provider: managed.provider, id: managed.id }
+ : { provider: "scripted", id: "scripted" };
+ return refineBotProfile(
+ deps.runtime,
+ { name: input.name, description: input.description },
+ model,
+ );
+ }),
duplicate: authed.bots.duplicate.handler(async ({ context, input }) => {
const source = await repos.getBot(context.actor, input.botId);
const duplicate = await repos
diff --git a/apps/mobile/app/new.tsx b/apps/mobile/app/new.tsx
index 44973066..c5633b61 100644
--- a/apps/mobile/app/new.tsx
+++ b/apps/mobile/app/new.tsx
@@ -1,28 +1,36 @@
-import {
- BOT_DESCRIPTION_MAX_LENGTH,
- BOT_NAME_MAX_LENGTH,
- BOT_TITLE_MAX_LENGTH,
- type ComputerMode,
- normalizeCreateBotProfile,
-} from "@milo/contracts";
+import { type AgentStatus, BOT_DESCRIPTION_MAX_LENGTH, BOT_NAME_MAX_LENGTH } from "@milo/contracts";
+import { BOT_PALETTE_COLORS } from "@milo/core";
import { Stack, useRouter } from "expo-router";
-import { useState } from "react";
-import { Pressable, ScrollView, Text, TextInput } from "react-native";
-import { ComputerModePicker } from "../components/computer-mode-picker";
+import { useEffect, useState } from "react";
+import { Pressable, ScrollView, Text, TextInput, View } from "react-native";
import { type MobileBot, rpc } from "../lib/api";
import { useI18n } from "../lib/i18n";
import { useMobileTokens } from "../lib/native";
+type RunsOn = "chatgpt" | "claude";
+
+function claudeReady(status: AgentStatus | null): boolean {
+ return Boolean(status?.installed && status.loggedIn);
+}
+
export default function NewBot() {
const { t } = useI18n();
const tokens = useMobileTokens();
const router = useRouter();
const [name, setName] = useState("");
- const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
- const [computerMode, setComputerMode] = useState("team");
+ const [color, setColor] = useState(BOT_PALETTE_COLORS[0]!);
+ const [provider, setProvider] = useState("chatgpt");
+ const [agentStatus, setAgentStatus] = useState(null);
const [error, setError] = useState(null);
const [pending, setPending] = useState(false);
+ const showRunsOn = claudeReady(agentStatus);
+
+ useEffect(() => {
+ void rpc("agent/status")
+ .then(setAgentStatus)
+ .catch(() => setAgentStatus(null));
+ }, []);
function close() {
if (router.canDismiss()) {
@@ -40,11 +48,30 @@ export default function NewBot() {
if (!name.trim() || pending) return;
setPending(true);
setError(null);
+ const trimmedName = name.trim();
+ const trimmedDescription = description.trim();
try {
+ let title = "";
+ let instructions = trimmedDescription;
+ try {
+ const refined = await rpc<{ title: string; instructions: string }>("bots/refine", {
+ name: trimmedName,
+ description: trimmedDescription,
+ });
+ title = refined.title;
+ instructions = refined.instructions;
+ } catch {
+ // Create still works with the raw description when refine fails.
+ }
+ const usesClaude = showRunsOn && provider === "claude";
const bot = await rpc("bots/create", {
- ...normalizeCreateBotProfile({ name, title, description }),
+ name: trimmedName,
+ title,
+ description: trimmedDescription,
+ instructions,
notifyOnFinish: true,
- computerMode,
+ color: `${color}::shape_0`,
+ ...(usesClaude ? { modelProvider: "claude-code", modelId: "sonnet" } : {}),
});
router.replace({ pathname: "/thread", params: { botId: bot.id, name: bot.name } });
} catch (err) {
@@ -93,30 +120,13 @@ export default function NewBot() {
}}
/>
- {t("Title")}
-
-
-
- {t("Description")}
+ {t("What should it do?")}
-
+
+ {t("Color")}
+
+
+ {BOT_PALETTE_COLORS.map((swatch) => {
+ const selected = color.toLowerCase() === swatch.toLowerCase();
+ return (
+ setColor(swatch)}
+ accessibilityRole="button"
+ accessibilityState={{ selected }}
+ accessibilityLabel={swatch}
+ style={{
+ width: 32,
+ height: 32,
+ borderRadius: 16,
+ backgroundColor: swatch,
+ borderWidth: selected ? 2 : 1,
+ borderColor: selected ? tokens.foreground : tokens.border,
+ }}
+ />
+ );
+ })}
+
+ {showRunsOn ? (
+ <>
+
+ {t("Runs on")}
+
+
+ {(
+ [
+ { id: "chatgpt", label: t("ChatGPT") },
+ { id: "claude", label: t("Claude") },
+ ] as const
+ ).map((option) => {
+ const selected = provider === option.id;
+ return (
+ setProvider(option.id)}
+ accessibilityRole="button"
+ accessibilityState={{ selected }}
+ style={{
+ flex: 1,
+ padding: 12,
+ borderRadius: 11,
+ borderWidth: 1,
+ borderColor: selected ? tokens.foreground : tokens.border,
+ backgroundColor: selected ? tokens.muted : tokens.card,
+ alignItems: "center",
+ }}
+ >
+ {option.label}
+
+ );
+ })}
+
+ >
+ ) : null}
{error ? {error} : null}
void create()}
diff --git a/apps/mobile/lib/locales/de.ts b/apps/mobile/lib/locales/de.ts
index 7dc2929c..b7fbc762 100644
--- a/apps/mobile/lib/locales/de.ts
+++ b/apps/mobile/lib/locales/de.ts
@@ -24,7 +24,9 @@ export const DE_MESSAGES: Record = {
// app/_layout.tsx
Account: "Konto",
"Change password": "Passwort ändern",
+ ChatGPT: "ChatGPT",
"Chat settings": "Chat-Einstellungen",
+ Claude: "Claude",
Computer: "Computer",
Group: "Gruppe",
"Group settings": "Gruppeneinstellungen",
@@ -34,6 +36,7 @@ export const DE_MESSAGES: Record = {
"New group": "Neue Gruppe",
"New space": "Neuer Space",
Routine: "Routine",
+ "Runs on": "Läuft auf",
"Server integrations": "Server-Integrationen",
Thread: "Thread",
Voice: "Stimme",
@@ -215,6 +218,7 @@ export const DE_MESSAGES: Record = {
"Space default": "Space-Standard",
Thinking: "Denkmodus",
Title: "Titel",
+ "What should it do?": "Was soll er tun?",
"What this bot is for": "Wofür dieser Bot gedacht ist",
// app/group-settings.tsx
"Could not delete group": "Gruppe konnte nicht gelöscht werden",
@@ -675,7 +679,6 @@ export const DE_MESSAGES: Record = {
"Allow list": "Freigabeliste",
Apps: "Apps",
"Ask first": "Erst fragen",
- ChatGPT: "ChatGPT",
"Could not load approval rules": "Bestätigungsregeln konnten nicht geladen werden",
"Could not save rule": "Regel konnte nicht gespeichert werden",
General: "Allgemein",
diff --git a/apps/mobile/lib/locales/ru.ts b/apps/mobile/lib/locales/ru.ts
index aba024d8..3b4d756a 100644
--- a/apps/mobile/lib/locales/ru.ts
+++ b/apps/mobile/lib/locales/ru.ts
@@ -148,7 +148,9 @@ export const RU_MESSAGES: Record = {
"Cancel reply": "Отменить ответ",
Cancelled: "Отменено",
"Change password": "Изменить пароль",
+ ChatGPT: "ChatGPT",
"Chat settings": "Настройки чата",
+ Claude: "Claude",
Checking: "Проверка",
"Checking…": "Проверка…",
"Check your email": "Проверьте свою электронную почту",
@@ -442,6 +444,7 @@ export const RU_MESSAGES: Record = {
Robot: "Робот",
Routine: "Задача",
"Routine link is incomplete": "Ссылка на задачу неполная",
+ "Runs on": "Работает на",
Running: "Выполняется",
Save: "Сохранить",
"Saved.": "Сохранено.",
@@ -523,6 +526,7 @@ export const RU_MESSAGES: Record = {
"Waiting for sign-in…": "Ожидание входа в систему…",
"Waiting for this bot’s response.": "Ожидание ответа этого бота.",
"Waiting…": "Ожидание…",
+ "What should it do?": "Что он должен делать?",
"What this bot is for": "Для чего нужен этот бот",
"While agents are working": "Пока агенты работают",
Working: "Выполняется",
@@ -677,7 +681,6 @@ export const RU_MESSAGES: Record = {
"Allow list": "Список разрешений",
Apps: "Приложения",
"Ask first": "Сначала спросить",
- ChatGPT: "ChatGPT",
"Could not load approval rules": "Не удалось загрузить правила одобрения.",
"Could not save rule": "Не удалось сохранить правило.",
General: "Общие",
diff --git a/apps/mobile/lib/locales/zh.ts b/apps/mobile/lib/locales/zh.ts
index 2f94de30..8b084749 100644
--- a/apps/mobile/lib/locales/zh.ts
+++ b/apps/mobile/lib/locales/zh.ts
@@ -135,7 +135,9 @@ export const ZH_MESSAGES: Record = {
"Cancel reply": "取消回复",
Cancelled: "已取消",
"Change password": "更改密码",
+ ChatGPT: "ChatGPT",
"Chat settings": "聊天设置",
+ Claude: "Claude",
Checking: "检查中",
"Checking…": "正在检查…",
"Check your email": "请查看邮箱",
@@ -421,6 +423,7 @@ export const ZH_MESSAGES: Record = {
Robot: "机器人",
Routine: "例行任务",
"Routine link is incomplete": "例行任务链接不完整",
+ "Runs on": "运行于",
Running: "运行中",
Save: "保存",
"Saved.": "已保存。",
@@ -504,6 +507,7 @@ export const ZH_MESSAGES: Record = {
"Waiting for sign-in…": "正在等待登录…",
"Waiting for this bot’s response.": "正在等待这个 Bot 的回复。",
"Waiting…": "等待中…",
+ "What should it do?": "它应该做什么?",
"What this bot is for": "这个 Bot 的用途",
"While agents are working": "智能体工作时",
Working: "工作中",
@@ -657,7 +661,6 @@ export const ZH_MESSAGES: Record = {
"Allow list": "允许列表",
Apps: "应用",
"Ask first": "先询问",
- ChatGPT: "ChatGPT",
"Could not load approval rules": "无法加载审批规则",
"Could not save rule": "无法保存规则",
General: "通用",
diff --git a/apps/web/e2e/helpers.ts b/apps/web/e2e/helpers.ts
index 1dd8201c..93f23826 100644
--- a/apps/web/e2e/helpers.ts
+++ b/apps/web/e2e/helpers.ts
@@ -123,25 +123,15 @@ export async function createBotFromPicker(
page: Page,
options: {
name?: string;
- title?: string;
description?: string;
- computerMode?: "team" | "dedicated";
} = {},
) {
const name = options.name ?? "New Bot";
await openNewBot(page);
const form = page.getByTestId("create-bot-form");
await form.locator("label:has-text('Name') input").fill(name);
- if (options.title != null) {
- await form.locator("label:has-text('Title') input").fill(options.title);
- }
if (options.description != null) {
- await form.locator("label:has-text('What this bot is for') textarea").fill(options.description);
- }
- if (options.computerMode === "dedicated") {
- await form.getByTestId("create-bot-private").click();
- } else if (options.computerMode === "team") {
- await form.getByTestId("create-bot-team").click();
+ await form.locator("label:has-text('What should it do?') textarea").fill(options.description);
}
await form.getByRole("button", { name: "Create", exact: true }).click();
await page.waitForURL(/\/app\/[^/]+$/);
diff --git a/apps/web/e2e/new-bot-ux.spec.ts b/apps/web/e2e/new-bot-ux.spec.ts
index 1920b07b..58e700ed 100644
--- a/apps/web/e2e/new-bot-ux.spec.ts
+++ b/apps/web/e2e/new-bot-ux.spec.ts
@@ -4,11 +4,10 @@ import {
completeOnboarding,
createBotFromPicker,
openNewBot,
- rpc,
signup,
} from "./helpers";
-test("+ opens the form, then an empty chat; sidebar collapses", async ({ page }, testInfo) => {
+test("+ opens the form, then an intro chat; sidebar collapses", async ({ page }, testInfo) => {
const stamp = Date.now();
await signup(page, `new-bot-ux-${stamp}@rakazo.test`, "password12", "New Bot UX");
await completeOnboarding(page);
@@ -21,8 +20,10 @@ test("+ opens the form, then an empty chat; sidebar collapses", async ({ page },
await expect(form).toBeVisible();
await expect(page.getByTestId("side-panel")).toHaveAttribute("data-panel", "closed");
await expect(form.locator("label:has-text('Name') input")).toBeVisible();
- await expect(form.locator("label:has-text('Title') input")).toBeVisible();
- await expect(form.locator("label:has-text('What this bot is for') textarea")).toBeVisible();
+ await expect(form.locator("label:has-text('What should it do?') textarea")).toBeVisible();
+ await expect(form.locator("label:has-text('Title')")).toHaveCount(0);
+ await expect(form.getByTestId("create-bot-computer")).toHaveCount(0);
+ await expect(form.getByTestId("create-bot-runs-on")).toHaveCount(0);
for (const starter of ["Inbox", "Research", "Design", "Expenses"]) {
await expect(form.getByRole("button", { name: starter, exact: true })).toBeVisible();
}
@@ -35,18 +36,26 @@ test("+ opens the form, then an empty chat; sidebar collapses", async ({ page },
await expect(
page.getByRole("dialog").locator('.rakazo-bot-avatar[data-shape="squircle"]'),
).toBeVisible();
- await expect(form.getByTestId("create-bot-computer")).toBeVisible();
- await expect(form.getByTestId("create-bot-team")).toBeVisible();
- await expect(form.getByTestId("create-bot-private")).toBeVisible();
await captureScreenshot(page, testInfo, "create-bot-form");
await form.locator("label:has-text('Name') input").fill("New Bot");
+ await form
+ .locator("label:has-text('What should it do?') textarea")
+ .fill("Help with research briefs.");
await form.getByRole("button", { name: "Create", exact: true }).click();
await page.waitForURL(/\/app\/[^/]+$/);
await expect(page.getByPlaceholder("Message New Bot")).toBeVisible();
await expect(page.getByTestId("side-panel")).toHaveAttribute("data-panel", "closed");
+ // Sidebar preview repeats the intro, so match the transcript bubble only.
+ await expect(
+ page
+ .getByTestId("transcript")
+ .getByTestId("message-bot-bubble")
+ .getByText(/Hi, I'm New Bot\. I run on your own subscription/),
+ ).toBeVisible();
+ await expect(page.getByTestId("suggestion-chips")).toBeVisible();
await expect(page.getByText("What do you want me on first?", { exact: true })).toHaveCount(0);
- await captureScreenshot(page, testInfo, "create-chat-sidepanel-closed");
+ await captureScreenshot(page, testInfo, "create-chat-intro");
await page.getByTestId("minimize-bots-sidebar").click();
await expect(page.getByTestId("bots-sidebar")).toHaveAttribute("data-collapsed", "true");
@@ -62,7 +71,6 @@ test("+ opens the form, then an empty chat; sidebar collapses", async ({ page },
await page.getByTestId("minimize-bots-sidebar").click();
await expect(page.getByTestId("bots-sidebar")).toHaveAttribute("data-collapsed", "true");
- // The edge slides to the window edge; grab it only once it has settled there.
await expect.poll(async () => (await edge.boundingBox())?.x).toBe(0);
const box = await edge.boundingBox();
@@ -75,20 +83,47 @@ test("+ opens the form, then an empty chat; sidebar collapses", async ({ page },
await captureScreenshot(page, testInfo, "bots-sidebar-expanded");
});
-test("plus picker can create a Private computer bot", async ({ page }, testInfo) => {
+test("new bot skips the old focus card", async ({ page }) => {
+ const stamp = Date.now();
+ await signup(page, `focus-gone-${stamp}@rakazo.test`, "password12", "Focus Gone");
+ await completeOnboarding(page);
+
+ await createBotFromPicker(page, { description: "Keep my calendar clear." });
+ await expect(page.getByPlaceholder("Message New Bot")).toBeVisible();
+ await expect(page.getByText("What do you want me on first?", { exact: true })).toHaveCount(0);
+ await expect(page.getByTestId("suggestion-chips")).toBeVisible();
+});
+
+test("Runs on appears only when Claude Code is ready", async ({ page }) => {
const stamp = Date.now();
- await signup(page, `new-bot-private-${stamp}@rakazo.test`, "password12", "New Bot Private");
+ await signup(page, `runs-on-${stamp}@rakazo.test`, "password12", "Runs On");
await completeOnboarding(page);
await page.goto("/app");
await page.waitForURL(/\/app\/[^/]+$/);
- await createBotFromPicker(page, { computerMode: "dedicated" });
- await expect(page.getByPlaceholder("Message New Bot")).toBeVisible();
- await captureScreenshot(page, testInfo, "create-private-computer-bot");
+ await openNewBot(page);
+ await expect(page.getByTestId("create-bot-runs-on")).toHaveCount(0);
+ await page.getByRole("button", { name: "Cancel new bot" }).click();
- const botId = page.url().split("/").pop()!;
- const bots = await rpc>(page, "bots/list", {});
- expect(bots.find((bot) => bot.id === botId)?.computerMode).toBe("dedicated");
+ await page.route("**/rpc/agent/status", (route) =>
+ route.fulfill({
+ json: {
+ json: {
+ agent: "claude-code",
+ installed: true,
+ version: "1.0.0",
+ loggedIn: true,
+ platform: "darwin",
+ chatgpt: true,
+ },
+ },
+ }),
+ );
+ await openNewBot(page);
+ const form = page.getByTestId("create-bot-form");
+ await expect(form.getByTestId("create-bot-runs-on")).toBeVisible();
+ await expect(form.getByTestId("create-bot-chatgpt")).toBeVisible();
+ await expect(form.getByTestId("create-bot-claude")).toBeVisible();
});
test("second bot from plus opens create form before persist", async ({ page }, testInfo) => {
@@ -102,10 +137,7 @@ test("second bot from plus opens create form before persist", async ({ page }, t
const form = page.getByTestId("create-bot-form");
await expect(form).toBeVisible();
await form.locator("label:has-text('Name') input").fill("Researcher");
- await form.locator("label:has-text('Title') input").fill("Finds sources");
- await form
- .locator("label:has-text('What this bot is for') textarea")
- .fill("Briefs from the web.");
+ await form.locator("label:has-text('What should it do?') textarea").fill("Briefs from the web.");
await captureScreenshot(page, testInfo, "second-bot-create-form");
const create = page.waitForResponse(
diff --git a/apps/web/src/pages/Shell.tsx b/apps/web/src/pages/Shell.tsx
index eb5e9fd4..6114f0a3 100644
--- a/apps/web/src/pages/Shell.tsx
+++ b/apps/web/src/pages/Shell.tsx
@@ -28,7 +28,6 @@ import {
canReactToThreadMessage,
MESSAGE_REACTIONS,
type MessageReaction,
- normalizeCreateBotProfile,
} from "@milo/contracts";
import {
attachmentsForThread,
@@ -2390,11 +2389,16 @@ export function ShellPage({ view }: { view?: ShellView } = {}) {
}
async function createBot(input: CreateBotInputDraft) {
+ const usesClaude = input.modelProvider === "claude";
const bot = await rpc.bots.create({
- ...normalizeCreateBotProfile(input),
+ name: input.name,
+ title: input.title,
+ description: input.description,
+ instructions: input.instructions || input.description,
notifyOnFinish: true,
color: input.color,
- computerMode: input.computerMode,
+ // ChatGPT is the default runtime path; only Claude needs an explicit override.
+ ...(usesClaude ? { modelProvider: "claude-code", modelId: "sonnet" } : {}),
});
setBots((current) =>
current.some((item) => item.id === bot.id) ? current : [bot, ...current],
diff --git a/apps/web/src/pages/shell/create-bot-dialog.tsx b/apps/web/src/pages/shell/create-bot-dialog.tsx
index 3b59d8f9..d19983e9 100644
--- a/apps/web/src/pages/shell/create-bot-dialog.tsx
+++ b/apps/web/src/pages/shell/create-bot-dialog.tsx
@@ -1,10 +1,7 @@
import { Trans, useLingui } from "@lingui/react/macro";
-import type { ComputerMode } from "@milo/contracts";
-import {
- BOT_DESCRIPTION_MAX_LENGTH,
- BOT_NAME_MAX_LENGTH,
- BOT_TITLE_MAX_LENGTH,
-} from "@milo/contracts";
+import type { AgentStatus } from "@milo/contracts";
+import { BOT_DESCRIPTION_MAX_LENGTH, BOT_NAME_MAX_LENGTH } from "@milo/contracts";
+import { BOT_PALETTE_COLORS } from "@milo/core";
import {
BotAvatar,
Button,
@@ -17,24 +14,33 @@ import {
Textarea,
} from "@milo/ui-web";
import { X } from "lucide-react";
-import { useId, useState } from "react";
+import { useEffect, useId, useState } from "react";
+import { Shimmer } from "../../components/ai/primitives";
import { BotColorChoices, BotShapeChoices } from "../../components/BotAvatarChoices";
import { SegmentedControl } from "../../components/SegmentedControl";
import { createBotStarters } from "../../lib/create-bot-starters";
+import { rpc } from "../../lib/rpc";
+
+export type CreateBotProvider = "chatgpt" | "claude";
export type CreateBotInputDraft = {
name: string;
title: string;
description: string;
+ instructions: string;
color: string;
- computerMode: ComputerMode;
+ modelProvider: CreateBotProvider;
};
const labelClass = "flex flex-col gap-1.5 text-small font-medium text-muted-foreground";
+function claudeReady(status: AgentStatus | null): boolean {
+ return Boolean(status?.installed && status.loggedIn);
+}
+
/**
- * New bot: a live avatar preview beside the form. Starter chips fill the form with
- * client-side presets; nothing about them is stored.
+ * New bot: name, look, optional Runs on, and what it should do. Starter chips
+ * prefill the form; Create refines then persists.
*/
export function CreateBotDialog({
open,
@@ -50,26 +56,58 @@ export function CreateBotDialog({
const starters = createBotStarters();
const [starter, setStarter] = useState(null);
const [name, setName] = useState("");
- const [title, setTitle] = useState("");
const [description, setDescription] = useState("");
const [shapeIndex, setShapeIndex] = useState(0);
- const [color, setColor] = useState(starters[0]!.color);
- const [computerMode, setComputerMode] = useState("team");
+ const [color, setColor] = useState(BOT_PALETTE_COLORS[0] ?? starters[0]!.color);
+ const [provider, setProvider] = useState("chatgpt");
+ const [agentStatus, setAgentStatus] = useState(null);
const [submitting, setSubmitting] = useState(false);
const [error, setError] = useState(null);
const avatar = `${color}::shape_${shapeIndex}`;
+ const showRunsOn = claudeReady(agentStatus);
+
+ useEffect(() => {
+ if (!open) return;
+ let active = true;
+ void rpc.agent
+ .status()
+ .then((status) => {
+ if (active) setAgentStatus(status);
+ })
+ .catch(() => {
+ if (active) setAgentStatus(null);
+ });
+ return () => {
+ active = false;
+ };
+ }, [open]);
async function handleSubmit() {
if (!name.trim() || submitting) return;
setError(null);
setSubmitting(true);
+ const trimmedName = name.trim();
+ const trimmedDescription = description.trim();
try {
+ let title = "";
+ let instructions = trimmedDescription;
+ try {
+ const refined = await rpc.bots.refine({
+ name: trimmedName,
+ description: trimmedDescription,
+ });
+ title = refined.title;
+ instructions = refined.instructions;
+ } catch {
+ // Create still works with the raw description when refine fails.
+ }
await onCreate({
- name: name.trim(),
- title: title.trim(),
- description: description.trim(),
+ name: trimmedName,
+ title,
+ description: trimmedDescription,
+ instructions,
color: avatar,
- computerMode,
+ modelProvider: showRunsOn ? provider : "chatgpt",
});
} catch (err) {
setError(err instanceof Error ? err.message : t`Could not create bot`);
@@ -92,9 +130,6 @@ export function CreateBotDialog({
{name.trim() || t`New bot`}
- {title.trim() ? (
- {title}
- ) : null}
) : null}
-
-
-
-
+