Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Suggested replies: one faded next line in the empty composer after a bot replies (#7620)
Milind Sonicc9130badec7
diff --git a/server/config.ts b/server/config.tsindex df2e892684..d19315ff5d 100644--- a/server/config.ts+++ b/server/config.ts@@ -226,7 +226,7 @@ const featureConfigSchema = z.object({/** Room jobs to several members run side by side, each in a thread of its own. On unless false. */parallelRoomJobs: z.boolean().optional(),acpPlanLines: z.boolean().optional(), // An ACP agent's plan as activity lines. Off unless true.-}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional(), skillBurger: z.boolean().optional(), threadTabs: z.boolean().optional(), teamBoard: z.boolean().optional() }); // skillBurger: Skill Burgers in chat, the side menu and the bot panel, and the tools that run them, on unless false; threadTabs: a bot's threads as tabs above its chat, off unless true; teamBoard: the Team Board on a Team Cloud (docs/team-board.md), off unless true; cloudComputerAutoReplace: set a dead or silent cloud computer aside (kept seven days with its files) and give its bot a new one by itself, on unless false (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, on unless false (OMB_PHONE_PUSH=0 or 1 wins)+}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional(), skillBurger: z.boolean().optional(), threadTabs: z.boolean().optional(), teamBoard: z.boolean().optional(), suggestedReplies: z.boolean().optional() }); // suggestedReplies: a faded next-line suggestion in an empty composer after a bot replies, written by the bot's own engine's smallest model, on unless false; skillBurger: Skill Burgers in chat, the side menu and the bot panel, and the tools that run them, on unless false; threadTabs: a bot's threads as tabs above its chat, off unless true; teamBoard: the Team Board on a Team Cloud (docs/team-board.md), off unless true; cloudComputerAutoReplace: set a dead or silent cloud computer aside (kept seven days with its files) and give its bot a new one by itself, on unless false (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, on unless false (OMB_PHONE_PUSH=0 or 1 wins)const onboardingConfigSchema = z.object({completedAt: z.string().trim().max(40).optional(),version: z.number().int().min(0).max(1000).optional(),@@ -467,7 +467,7 @@ export interface AppConfig extends HelperConfig {context?: { rebuildBytes?: number; compactAt?: number; autoCompact?: boolean; roomCompactAt?: number; roomSessions?: boolean; replayToolHistory?: boolean };memory?: { captureQuietMs?: number; tidyHour?: number };vpsIdle?: z.infer<typeof vpsIdleConfigSchema>; localVm?: { mode?: "shared" | "per-bot" | "pool"; maxInstances?: number; idleTimeoutMinutes?: number; preserveInstalledApps?: boolean; memoryGb?: number; cpus?: number };- features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; llmThreadTitles?: boolean; smartSetupChoices?: boolean; autoRecall?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; parallelRoomJobs?: boolean; acpPlanLines?: boolean; agentsToolBridge?: boolean; savedSteps?: boolean; usbPhoneTakeover?: boolean; cloudComputerAutoReplace?: boolean; phonePush?: boolean; skillBurger?: boolean; threadTabs?: boolean; teamBoard?: boolean };+ features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; llmThreadTitles?: boolean; smartSetupChoices?: boolean; autoRecall?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; parallelRoomJobs?: boolean; acpPlanLines?: boolean; agentsToolBridge?: boolean; savedSteps?: boolean; usbPhoneTakeover?: boolean; cloudComputerAutoReplace?: boolean; phonePush?: boolean; skillBurger?: boolean; threadTabs?: boolean; teamBoard?: boolean; suggestedReplies?: boolean };onboarding?: { completedAt?: string; version?: number; reelSeen?: boolean; hintsSeen?: string[]; firstTurnAt?: string };browserProfiles?: BrowserProfile[];browserEngine?: BrowserEngineConfig;diff --git a/server/index.test.ts b/server/index.test.tsindex daee729aba..c4cf126bb0 100644--- a/server/index.test.ts+++ b/server/index.test.ts@@ -9962,7 +9962,7 @@ describe("harness HTTP API", () => {it("keeps skill authoring on by default and persists an explicit opt-out", async () => {const before = await api("GET", "/api/config");expect(before.status).toBe(200);- expect(before.body.features).toEqual({ browser: false, skillAuthoring: true, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, roomFeed: true, roomFeedSince: expect.any(Number), usbPhoneTakeover: false });+ expect(before.body.features).toEqual({ browser: false, skillAuthoring: true, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, suggestedReplies: true, roomFeed: true, roomFeedSince: expect.any(Number), usbPhoneTakeover: false });const untouched = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8"));expect(untouched.features?.skillAuthoring).toBeUndefined();expect(untouched.features?.skillReview).toBeUndefined();@@ -9972,7 +9972,7 @@ describe("harness HTTP API", () => {features: { skillAuthoring: false },});expect(saved.status).toBe(200);- expect(saved.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, roomFeed: true, roomFeedSince: expect.any(Number), usbPhoneTakeover: false });+ expect(saved.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, suggestedReplies: true, roomFeed: true, roomFeedSince: expect.any(Number), usbPhoneTakeover: false });const disk = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8"));// Earlier browser coverage may have persisted its own toggle: opting out must preserve sibling settings.@@ -9984,11 +9984,13 @@ describe("harness HTTP API", () => {const kept = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8")).features;expect(kept).toMatchObject({ skillBurger: false, threadTabs: true });expect(kept.roomFeed).toBeUndefined();- await api("PATCH", "/api/config", { features: { skillBurger: true, threadTabs: false } });+ const quiet = await api("PATCH", "/api/config", { features: { suggestedReplies: false } });+ expect(quiet.body.features).toMatchObject({ suggestedReplies: false });+ await api("PATCH", "/api/config", { features: { skillBurger: true, threadTabs: false, suggestedReplies: true } });const tools = await api("PATCH", "/api/config", { features: { showToolCalls: true } });expect(tools.status).toBe(200);- expect(tools.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: true, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, roomFeed: true, roomFeedSince: expect.any(Number), usbPhoneTakeover: false });+ expect(tools.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: true, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, suggestedReplies: true, roomFeed: true, roomFeedSince: expect.any(Number), usbPhoneTakeover: false });const bot = (await api("POST", "/api/bots", {})).body.bot;try {diff --git a/server/index.ts b/server/index.tsindex 0491148f53..c08a610ce3 100644--- a/server/index.ts+++ b/server/index.ts@@ -319,7 +319,7 @@ import {import * as tts from "./tts/index.ts";import { voiceNoteFailure } from "./tts/errors.ts";import { createDecider, deciderReady, describeDecider } from "./decider/index.ts"; import { createExtractor, describeHelpers } from "./extractor/index.ts";-import { createStopLineRoutes } from "./routes/stop-line.ts"; import { createSkillBurgerRoutes } from "./skill-burger/routes.ts"; import { migrateBotBurgers, skillBurgerEnabled } from "./skill-burger/store.ts"; import { createSkillBurgerRuns } from "./skill-burger/runs.ts"; import { decideRoomResponder } from "./decider/room-routing.ts"; import { roomRoutingInput } from "./host/room-routing-input.ts";+import { createStopLineRoutes } from "./routes/stop-line.ts"; import { createSuggestedReplyRoutes } from "./routes/suggested-reply.ts"; import { lightModelFor } from "./suggested-reply/light-model.ts"; import { createSkillBurgerRoutes } from "./skill-burger/routes.ts"; import { migrateBotBurgers, skillBurgerEnabled } from "./skill-burger/store.ts"; import { createSkillBurgerRuns } from "./skill-burger/runs.ts"; import { decideRoomResponder } from "./decider/room-routing.ts"; import { roomRoutingInput } from "./host/room-routing-input.ts";import { autoRoomDefault, roomTurnMembers } from "./room-routing-members.ts";import { liveHistoryFrom, LiveSessionError, type LiveBot, type LiveHistoryMessage } from "./live-call.ts";import { LiveCallController, LiveCallSignedOutError } from "./live-call-controller.ts"; import { liveSessionWiring } from "./live-session-wiring.ts";@@ -5051,7 +5051,7 @@ const sideJobs = createSideJobs({helper: cacheUntilConfigChanges((config) => helperSelection(config)),...(hostedModels ? { modelAllowed: (selection: ModelSelection) => hostedModels.allows(selection) } : {}),assertWithinBudget: () => { assertWithinBudget(cfg, DATA_DIR); usageCapGate.assertTurn(undefined, true); },- book: bookTurnUsage,+ book: bookTurnUsage, lightModel: lightModelFor,log: (line) => console.log(line),});@@ -11616,7 +11616,7 @@ function configStatus() {autoRecall: autoRecallEnabled(cfg),roomMemoryCapture: roomMemoryCaptureEnabled(cfg),parallelRoomJobs: parallelRoomJobsEnabled(cfg),- savedSteps: savedStepsEnabled(cfg), savedStepsHere: savedSteps.here(), skillBurger: skillBurgerEnabled(cfg), threadTabs: cfg.features?.threadTabs === true, roomFeed: true, roomFeedSince: roomFeedSince(DATA_DIR), teamBoard: CLOUD_TEAM ? cfg.features?.teamBoard === true : undefined,+ savedSteps: savedStepsEnabled(cfg), savedStepsHere: savedSteps.here(), skillBurger: skillBurgerEnabled(cfg), threadTabs: cfg.features?.threadTabs === true, suggestedReplies: cfg.features?.suggestedReplies !== false, roomFeed: true, roomFeedSince: roomFeedSince(DATA_DIR), teamBoard: CLOUD_TEAM ? cfg.features?.teamBoard === true : undefined,usbPhoneTakeover: HAS_USB_PORT ? usbPhoneTakeoverEnabled(cfg) : undefined,},onboarding: {@@ -11914,7 +11914,7 @@ let restartRequested = false;const cloudMoveRoutes = createCloudMoveRoutes();// `workspaceAccess` is assigned at boot, after this line: read it per request.-ROUTES.push(createHostedSlackRoutes({ bot: (id) => store.bot(id), hostedReady: () => Boolean(workspaceAccess) && entitled("admin") })); ROUTES.push(createStopLineRoutes()); const skillBurgerRuns = createSkillBurgerRuns({ dataDir: DATA_DIR, host: { port: PORT, cwd: (botId, threadId) => store.taskByThread(botId, threadId)?.cwd || store.bot(botId)?.cwd || workspaceDir(botId), mint: (turn, kind) => mintInternalCapability({ ...(turn as unknown as InternalCapability), kind, depth: 0, skillAuthoring: false, createdBots: 0, openedThreads: 0 }), browser: async (turn) => { const bot = store.bot(turn.botId); return bot ? ((await browserIntegration(bot.id, bot.browserProfile, { threadId: turn.threadId, generation: turn.generation }))?.integration as { env?: Record<string, string | undefined> } | undefined) ?? null : null; }, publish: (threadId, event) => { const engine = runningTurnEngines.get(threadId); bus.publish({ ...event, provider: engine?.driverKind, providerInstanceId: engine?.instanceId } as unknown as RuntimeEvent); }, mayEditBurgers: () => !CLOUD_TEAM, connectedApps: async (turn) => { const bot = store.bot(turn.botId); if (!bot || bot.composio === false || !composio.configured(cfg)) return []; const actor = teamConnections.relayActor(turn as unknown as { threadId: string; generation: string; connectorsFor?: string }); return actor.refusal ? null : composio.connectedServiceSlugs(...teamConnections.via(actor.access)); } } }); try { const moved = migrateBotBurgers(store.bots.map((bot) => bot.id)); if (moved.length) console.log(`skill burgers: moved ${moved.length} saved by one bot into every chat`); } catch (error) { console.warn("skill burgers: could not move bots' own burgers into every chat", error); } ROUTES.push(createSkillBurgerRoutes({ messages: (threadId) => store.activePath(threadId), botIds: () => store.bots.map((bot) => bot.id), owns: (botId, threadId) => store.bot(botId)?.threadId === threadId || Boolean(store.taskByThread(botId, threadId)), sees: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), summarize: (botId, prompt) => sideJobs.text("skill-burger", botId)?.generateText(prompt, { timeoutMs: 10_000 }) ?? Promise.resolve(null), levelOf, actorOf: (auth) => (auth.kind === "session" ? actorKey(auth) : null), teammate: (idOrName) => { const bot = store.bot(idOrName) ?? store.bots.find((one) => one.name.toLowerCase() === idOrName.toLowerCase()); return bot ? { id: bot.id, name: bot.name, ...(bot.title ? { role: bot.title } : {}) } : undefined; }, history: skillBurgerRuns.history }));+ROUTES.push(createHostedSlackRoutes({ bot: (id) => store.bot(id), hostedReady: () => Boolean(workspaceAccess) && entitled("admin") })); ROUTES.push(createStopLineRoutes()); ROUTES.push(createSuggestedReplyRoutes({ enabled: () => cfg.features?.suggestedReplies !== false, owns: (botId, threadId) => store.bot(botId)?.threadId === threadId || Boolean(store.taskByThread(botId, threadId)), sees: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), mayChat: (auth, botId) => ["chat", "edit"].includes(levelOf(auth, botId)), messages: (threadId) => store.activePath(threadId), busy: threadBusy, writer: (botId) => sideJobs.text("suggested-reply", botId) })); const skillBurgerRuns = createSkillBurgerRuns({ dataDir: DATA_DIR, host: { port: PORT, cwd: (botId, threadId) => store.taskByThread(botId, threadId)?.cwd || store.bot(botId)?.cwd || workspaceDir(botId), mint: (turn, kind) => mintInternalCapability({ ...(turn as unknown as InternalCapability), kind, depth: 0, skillAuthoring: false, createdBots: 0, openedThreads: 0 }), browser: async (turn) => { const bot = store.bot(turn.botId); return bot ? ((await browserIntegration(bot.id, bot.browserProfile, { threadId: turn.threadId, generation: turn.generation }))?.integration as { env?: Record<string, string | undefined> } | undefined) ?? null : null; }, publish: (threadId, event) => { const engine = runningTurnEngines.get(threadId); bus.publish({ ...event, provider: engine?.driverKind, providerInstanceId: engine?.instanceId } as unknown as RuntimeEvent); }, mayEditBurgers: () => !CLOUD_TEAM, connectedApps: async (turn) => { const bot = store.bot(turn.botId); if (!bot || bot.composio === false || !composio.configured(cfg)) return []; const actor = teamConnections.relayActor(turn as unknown as { threadId: string; generation: string; connectorsFor?: string }); return actor.refusal ? null : composio.connectedServiceSlugs(...teamConnections.via(actor.access)); } } }); try { const moved = migrateBotBurgers(store.bots.map((bot) => bot.id)); if (moved.length) console.log(`skill burgers: moved ${moved.length} saved by one bot into every chat`); } catch (error) { console.warn("skill burgers: could not move bots' own burgers into every chat", error); } ROUTES.push(createSkillBurgerRoutes({ messages: (threadId) => store.activePath(threadId), botIds: () => store.bots.map((bot) => bot.id), owns: (botId, threadId) => store.bot(botId)?.threadId === threadId || Boolean(store.taskByThread(botId, threadId)), sees: (auth, threadId) => visibleTo(viewerFor(auth)).thread(threadId), summarize: (botId, prompt) => sideJobs.text("skill-burger", botId)?.generateText(prompt, { timeoutMs: 10_000 }) ?? Promise.resolve(null), levelOf, actorOf: (auth) => (auth.kind === "session" ? actorKey(auth) : null), teammate: (idOrName) => { const bot = store.bot(idOrName) ?? store.bots.find((one) => one.name.toLowerCase() === idOrName.toLowerCase()); return bot ? { id: bot.id, name: bot.name, ...(bot.title ? { role: bot.title } : {}) } : undefined; }, history: skillBurgerRuns.history }));const orgInstallStatuses = () => orgLibrary?.installStatuses() ?? new Map();ROUTES.push(createBotPresetRoutes({ presets: presetStore, orgStatuses: orgInstallStatuses })); ROUTES.push(createBotHoldRoutes({ holds: botHolds, named: (kind, id) => (kind === "bot" ? store.bot(id)?.name ?? null : store.sections.includes(id.trim()) ? id.trim() : null), stop: async (botIds) => { let stopped = 0; for (const botId of botIds) { for (const { threadId } of store.tasks(botId)) if (threadBusy(botId, threadId) || coordinator.activeDirect(threadId)) { await stopThreadForPerson(botId, threadId); stopped++; } for (const group of store.groups) if (roomThreadIds(group).some((threadId) => groupSpeakers.get(threadId)?.botId === botId)) { await interruptHeldMember(group.id, botId); stopped++; } } return stopped; }, audit: (entry, auth, req) => { if (!DESKTOP_MANAGED && adminActivityRecording()) appendAdminAction(DATA_DIR, { category: "bot", action: `${entry.kind}.${entry.paused ? "pause" : "resume"}`, target: { kind: entry.kind, id: entry.id, name: entry.name }, actor: adminActorFor(auth, req) }); }, bots: () => store.bots.map((bot) => bot.id) })); const cliLogin = createCliLogin({ sessions, refusal: () => (HOSTED_WORKSPACE ? "Sign in through the workspace portal." : null), loopbackRefusal: () => (LOOPBACK.trust === "service" ? "on this shared server a program here may not ask to sign in: run openmausbot login on your own computer" : null), environment: () => environmentDescriptor({ environmentId: ENVIRONMENT_ID, ...TEAM_LABEL, desktopManaged: DESKTOP_MANAGED, emailSignIn: !CLOUD_HOME && emailSignIn.enabled(), sharedComputers: lendingEnabled(), cloudHome: Boolean(CLOUD_HOME), cloudTeam: CLOUD_TEAM !== null, ownHome: ownHome.takesMove() }), changed: () => broadcast({ kind: "cli-login" }, { adminOnly: true }), ...(CLOUD_TEAM ? { opened: (session) => teamHost.met(session) } : {}) }); ROUTES.push(cliLogin.routes); ROUTES.push(createWorkspaceBannerRoutes({ changed: () => broadcast({ kind: "config", ...configStatus() }) })); ROUTES.unshift(createUsageCapRoutes({ view: () => usageCapGate.view(), botExists: (botId) => Boolean(store.bot(botId)), save: (usageCaps) => { saveConfig({ usageCaps }); Object.assign(cfg, loadConfig()); } })); const starterAwakeRoutes = createStarterAwakeRoutes({ awake: starterAwake }); ROUTES.push(starterAwakeRoutes);ROUTES.push(createSharedComputerRoutes({ enabled: (auth) => lendingEnabled() || (ownerLends() && ownHome.owner(auth)), computers: sharedComputers, sessionLive: (id) => sessions.isLive(id), environmentId: ENVIRONMENT_ID,diff --git a/server/request-auth.ts b/server/request-auth.tsindex d74eb5a8dc..333e5be2d6 100644--- a/server/request-auth.ts+++ b/server/request-auth.ts@@ -364,6 +364,8 @@ export const CLIENT_ALLOW: ReadonlyArray<{ methods: readonly string[]; path: Reg{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/messages$/ },// Only says whether a line is a stop, so the Team map knows where an @everyone line goes (routes/stop-line.ts).{ methods: ["POST"], path: /^\/api\/stop-line$/ },+ // One suggested next line for a conversation the caller reads and may write in (routes/suggested-reply.ts).+ { methods: ["POST"], path: /^\/api\/suggested-reply$/ },{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/messages\/[\w-]+\/edit$/ },{ methods: ["POST", "DELETE"], path: /^\/api\/bots\/[\w-]+\/setup-request$/ }, // Set me up: what a typed /setup could do{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/active-branch$/ },diff --git a/server/routes/suggested-reply.test.ts b/server/routes/suggested-reply.test.tsnew file mode 100644index 0000000000..4625e07dc5--- /dev/null+++ b/server/routes/suggested-reply.test.ts@@ -0,0 +1,165 @@+import { EventEmitter } from "node:events";+import { describe, expect, it } from "vitest";++import type { SuggestionRow } from "../../shared/suggested-reply.ts";+import type { ModelCatalog, TextGenerationOptions } from "../contracts.ts";+import { createJobSlots } from "../job-slots.ts";+import type { RequestAuth } from "../request-auth.ts";+import { createSideJobs, type SideJobBot, type SideJobInstance, type SideJobsDeps } from "../side-jobs.ts";+import { lightModelFor } from "../suggested-reply/light-model.ts";+import { createSuggestedReplyRoutes, type SuggestedReplyDeps } from "./suggested-reply.ts";+import { PASS, type RouteContext } from "./table.ts";++const auth = { kind: "loopback", scopes: ["admin", "client"] } as RequestAuth;+const REPLY = "I drafted the launch email and saved it in your drafts folder for review.";+const rows: SuggestionRow[] = [+ { id: "u0", role: "user", kind: "text", text: "SECRET-OLDER-QUESTION" },+ { id: "b0", role: "bot", kind: "text", text: "SECRET-OLDER-ANSWER that is long enough to count" },+ { id: "u1", role: "user", kind: "text", text: "Draft the launch email" },+ { id: "s1", role: "bot", kind: "activity" },+ { id: "b1", role: "bot", kind: "text", text: REPLY },+];++function request(body: unknown, path = "/api/suggested-reply", method = "POST") {+ const sent: { status?: number; body?: unknown } = {};+ const res = Object.assign(new EventEmitter(), { writableFinished: false, writableEnded: false, destroyed: false });+ const context = { req: {} as RouteContext["req"], res: res as unknown as RouteContext["res"], url: new URL(`http://x${path}`), path, method, auth,+ json: ((_res: unknown, status: number, value: unknown) => { sent.status = status; sent.body = value; res.writableEnded = true; res.writableFinished = true; }) as unknown as RouteContext["json"],+ readBody: (async () => body) as unknown as RouteContext["readBody"] } as RouteContext;+ return { context, sent, res };+}++type Call = { prompt: string; options?: TextGenerationOptions; via: "text" | "background" };++function engine(instanceId: string, driverKind: string, models: ModelCatalog, answer = "Send it to Priya too") {+ const calls: Call[] = [];+ const instance: SideJobInstance = {+ instanceId, driverKind, enabled: true, models, adapter: { capabilities: { agentsMcp: true } },+ generateText: async (prompt, options) => { calls.push({ prompt, options, via: "text" }); return answer; },+ generateMemoryText: async (prompt, options) => { calls.push({ prompt, options, via: "background" }); return answer; },+ };+ return { instance, calls };+}++function sideJobs(instances: SideJobInstance[], over: Partial<SideJobsDeps> = {}) {+ const booked: Array<Parameters<SideJobsDeps["book"]>[0]> = [];+ const bots = new Map<string, SideJobBot>(instances.map((one) => [one.instanceId, { id: one.instanceId, name: one.instanceId, threadId: "t", modelSelection: { instanceId: one.instanceId, model: one.models.default } }]));+ const jobs = createSideJobs({+ bot: (id) => bots.get(id), instance: (id) => instances.find((one) => one.instanceId === id), refusal: () => undefined,+ helper: () => ({ instanceId: "helper" }), smallModels: { refused: () => new Set(), remember: () => {} },+ assertWithinBudget: () => {}, book: (row) => { booked.push(row); }, slots: createJobSlots(2), lightModel: lightModelFor, ...over,+ });+ return { jobs, booked };+}++function deps(jobs: ReturnType<typeof sideJobs>["jobs"], over: Partial<SuggestedReplyDeps> = {}): SuggestedReplyDeps {+ return { enabled: () => true, owns: () => true, sees: () => true, mayChat: () => true, messages: () => rows, busy: () => false, writer: (botId) => jobs.text("suggested-reply", botId), ...over };+}++describe("POST /api/suggested-reply", () => {+ it("asks the bot's own engine on its smallest model, with only the last exchange", async () => {+ const claude = engine("claude", "claudeAgent", { default: "claude-opus-5-5", options: [{ id: "claude-opus-5-5", label: "Opus" }, { id: "claude-haiku-5-5", label: "Haiku" }] });+ const { jobs } = sideJobs([claude.instance]);+ const { context, sent } = request({ botId: "claude", threadId: "t", after: "b1" });+ await createSuggestedReplyRoutes(deps(jobs))(context);+ expect(sent).toEqual({ status: 200, body: { text: "Send it to Priya too" } });+ expect(claude.calls).toHaveLength(1);+ const [call] = claude.calls;+ expect(call!.via).toBe("text");+ expect(call!.options?.model).toBe("claude-haiku-5-5");+ expect(call!.prompt).toContain("Draft the launch email");+ expect(call!.prompt).toContain(REPLY);+ expect(call!.prompt).not.toContain("SECRET-OLDER");+ });++ it("runs Codex's background call pinned to its small model, never the bot's own", async () => {+ const codex = engine("codex", "codex", { default: "gpt-6", options: [{ id: "gpt-6", label: "GPT-6" }, { id: "gpt-6-luna", label: "Luna" }] });+ const { jobs } = sideJobs([codex.instance]);+ const { context, sent } = request({ botId: "codex", threadId: "t", after: "b1" });+ await createSuggestedReplyRoutes(deps(jobs))(context);+ expect(sent.body).toEqual({ text: "Send it to Priya too" });+ expect(codex.calls[0]).toMatchObject({ via: "background", options: { model: "gpt-6-luna", fallback: { model: "gpt-6-luna" } } });+ });++ it("is off, with no call and no helper, for an engine without a small model", async () => {+ const big = engine("claude", "claudeAgent", { default: "claude-opus-5-5", options: [{ id: "claude-opus-5-5", label: "Opus" }] });+ const helper = engine("helper", "claudeAgent", { default: "claude-haiku-5-5", options: [{ id: "claude-haiku-5-5", label: "Haiku" }] });+ const { jobs } = sideJobs([big.instance, helper.instance]);+ const { context, sent } = request({ botId: "claude", threadId: "t", after: "b1" });+ await createSuggestedReplyRoutes(deps(jobs))(context);+ expect(sent.body).toEqual({ text: null });+ expect(big.calls).toHaveLength(0);+ expect(helper.calls).toHaveLength(0);+ });++ it("asks nothing when switched off, while the bot works, or for a reply that is no longer the last", async () => {+ const claude = engine("claude", "claudeAgent", { default: "claude-haiku-5-5", options: [{ id: "claude-haiku-5-5", label: "Haiku" }] });+ const { jobs } = sideJobs([claude.instance]);+ for (const [over, after] of [[{ enabled: () => false }, "b1"], [{ busy: () => true }, "b1"], [{}, "b0"]] as const) {+ const { context, sent } = request({ botId: "claude", threadId: "t", after });+ await createSuggestedReplyRoutes(deps(jobs, over))(context);+ expect(sent.body).toEqual({ text: null });+ }+ expect(claude.calls).toHaveLength(0);+ });++ it("answers 404 to someone who can't read or write in the conversation", async () => {+ const { jobs } = sideJobs([]);+ for (const over of [{ sees: () => false }, { owns: () => false }, { mayChat: () => false }]) {+ const { context, sent } = request({ botId: "claude", threadId: "t", after: "b1" });+ await createSuggestedReplyRoutes(deps(jobs, over))(context);+ expect(sent.status).toBe(404);+ }+ });++ it("drops a suggestion when a new turn started while it was written, and fails silently", async () => {+ let messages = rows;+ const claude = engine("claude", "claudeAgent", { default: "claude-haiku-5-5", options: [{ id: "claude-haiku-5-5", label: "Haiku" }] });+ claude.instance.generateText = async () => { messages = [...rows, { id: "u2", role: "user", kind: "text", text: "one more thing" }]; return "Send it"; };+ const { jobs } = sideJobs([claude.instance]);+ const first = request({ botId: "claude", threadId: "t", after: "b1" });+ await createSuggestedReplyRoutes(deps(jobs, { messages: () => messages }))(first.context);+ expect(first.sent.body).toEqual({ text: null });++ claude.instance.generateText = async () => { throw new Error("rate limited"); };+ messages = rows;+ const second = request({ botId: "claude", threadId: "t", after: "b1" });+ await createSuggestedReplyRoutes(deps(jobs, { messages: () => messages }))(second.context);+ expect(second.sent.body).toEqual({ text: null });+ });++ it("cancels the call when the composer goes away, and keeps one in flight per thread", async () => {+ const signals: AbortSignal[] = [];+ const claude = engine("claude", "claudeAgent", { default: "claude-haiku-5-5", options: [{ id: "claude-haiku-5-5", label: "Haiku" }] });+ claude.instance.generateText = (_prompt, options) => new Promise((_resolve, reject) => {+ signals.push(options!.signal!);+ options!.signal!.addEventListener("abort", () => reject(new Error("aborted")));+ });+ const { jobs } = sideJobs([claude.instance]);+ const routes = createSuggestedReplyRoutes(deps(jobs));+ const first = request({ botId: "claude", threadId: "t", after: "b1" });+ const firstDone = routes(first.context);+ await waitUntil(() => signals.length === 1);+ const second = request({ botId: "claude", threadId: "t", after: "b1" });+ const secondDone = routes(second.context);+ await waitUntil(() => signals.length === 2);+ expect(signals[0]!.aborted).toBe(true);+ await firstDone;+ expect(first.sent.body).toEqual({ text: null });+ second.res.destroyed = true;+ second.res.emit("close");+ await secondDone;+ expect(signals[1]!.aborted).toBe(true);+ expect(second.sent.status).toBeUndefined();+ });++ it("passes other paths", async () => {+ const { jobs } = sideJobs([]);+ expect(await createSuggestedReplyRoutes(deps(jobs))(request({}, "/api/bots", "GET").context)).toBe(PASS);+ });+});++async function waitUntil(done: () => boolean): Promise<void> {+ for (let i = 0; i < 100 && !done(); i++) await new Promise((resolve) => setTimeout(resolve, 5));+ expect(done()).toBe(true);+}diff --git a/server/routes/suggested-reply.ts b/server/routes/suggested-reply.tsnew file mode 100644index 0000000000..e62a7183a1--- /dev/null+++ b/server/routes/suggested-reply.ts@@ -0,0 +1,79 @@+// POST /api/suggested-reply {botId, threadId, after} → {text}+// `after` is the reply the composer saw; `text` is null whenever there is nothing to offer. Nothing is stored: the answer+// goes back to the asking composer only.+import { z } from "zod";++import { cleanSuggestion, lastExchange, SUGGESTION_MAX_WORDS, type LastExchange, type SuggestionRow } from "../../shared/suggested-reply.ts";+import type { RequestAuth } from "../request-auth.ts";+import { PASS, type RouteHandler } from "./table.ts";++export const SUGGESTED_REPLY_PATH = "/api/suggested-reply";+export const SUGGESTED_REPLY_TIMEOUT_MS = 20_000;++export interface SuggestedReplyDeps {+ /** Settings → Features → Suggested replies. */+ enabled(): boolean;+ /** True when this thread is one of the bot's own conversations. */+ owns(botId: string, threadId: string): boolean;+ sees(auth: RequestAuth, threadId: string): boolean;+ /** The person may write to this bot. */+ mayChat(auth: RequestAuth, botId: string): boolean;+ /** The conversation's messages on its active branch. */+ messages(threadId: string): readonly SuggestionRow[];+ busy(botId: string, threadId: string): boolean;+ /** The bot's own engine on its smallest model, or null when it has none. */+ writer(botId: string): { generateText(prompt: string, options?: { signal?: AbortSignal; timeoutMs?: number }): Promise<string> } | null;+}++const body = z.object({ botId: z.string().min(1).max(200), threadId: z.string().min(1).max(200), after: z.string().min(1).max(200) }).strict();++export function suggestionPrompt(exchange: Pick<LastExchange, "ask" | "reply">): string {+ return [+ "Suggest the next message the person might send in this chat with their assistant.",+ `Write one short line in the person's own voice and language, at most ${SUGGESTION_MAX_WORDS} words: no quotes, no explanation, no emoji.`,+ "If no natural next message fits, answer NONE.",+ "",+ "<person>", exchange.ask, "</person>",+ "<assistant>", exchange.reply, "</assistant>",+ ].join("\n");+}++export function createSuggestedReplyRoutes(deps: SuggestedReplyDeps): RouteHandler {+ const running = new Map<string, AbortController>();+ return async ({ req, res, path, method, auth, json, readBody }) => {+ if (path !== SUGGESTED_REPLY_PATH) return PASS;+ if (method !== "POST") return json(res, 405, { error: "Use POST." });+ let raw: unknown;+ try { raw = await readBody(req, 4_096); } catch { return json(res, 400, { error: "Send botId, threadId and after." }); }+ const parsed = body.safeParse(raw);+ if (!parsed.success) return json(res, 400, { error: "Send botId, threadId and after." });+ const { botId, threadId, after } = parsed.data;+ if (!deps.owns(botId, threadId) || !deps.sees(auth, threadId) || !deps.mayChat(auth, botId)) return json(res, 404, { error: "No such conversation." });+ const current = () => {+ const exchange = lastExchange(deps.messages(threadId));+ return exchange?.replyId === after && !deps.busy(botId, threadId) ? exchange : null;+ };+ const exchange = deps.enabled() ? current() : null;+ const writer = exchange ? deps.writer(botId) : null;+ if (!exchange || !writer) return json(res, 200, { text: null });+ running.get(threadId)?.abort();+ const stop = new AbortController();+ running.set(threadId, stop);+ const gone = () => { if (!res.writableFinished) stop.abort(); };+ res.once("close", gone);+ let text: string | null = null;+ try {+ text = cleanSuggestion(await writer.generateText(suggestionPrompt(exchange), {+ signal: AbortSignal.any([stop.signal, AbortSignal.timeout(SUGGESTED_REPLY_TIMEOUT_MS)]),+ timeoutMs: SUGGESTED_REPLY_TIMEOUT_MS,+ }));+ } catch {+ text = null;+ } finally {+ res.off("close", gone);+ if (running.get(threadId) === stop) running.delete(threadId);+ }+ if (res.writableEnded || res.destroyed) return;+ return json(res, 200, { text: !stop.signal.aborted && text && current() ? text : null });+ };+}diff --git a/server/side-jobs.ts b/server/side-jobs.tsindex b45b9b3eed..054d7faaa5 100644--- a/server/side-jobs.ts+++ b/server/side-jobs.ts@@ -10,6 +10,7 @@ import { openRouterModelUnavailable } from "./drivers/openrouter-free.ts";import { backgroundTextSlots, type JobSlots } from "./job-slots.ts";import type { ProviderAdapter, ProviderInstance, SmallModelFallback, TextGenerationOptions } from "./contracts.ts";import { refusesModel } from "./quick-model-fallback.ts";+import type { LightModel, LightModelEngine } from "./suggested-reply/light-model.ts";import { fastModelFor } from "./turn-route.ts";import type { UsageRow, UsageTrigger } from "./usage-ledger.ts";@@ -39,7 +40,8 @@ export function helperSelection(cfg: HelperConfig, env: Record<string, string |}/** "representative": a person's assistant answering a teammate's question for them, which must never get tools. */-export type SideJob = "compaction" | "memory" | "skill-review" | "setup-suggestions" | "representative" | "status-reply" | "skill-burger";+/** "suggested-reply": the composer's next-line suggestion, only ever on the bot's own engine's smallest model. */+export type SideJob = "compaction" | "memory" | "skill-review" | "setup-suggestions" | "representative" | "status-reply" | "skill-burger" | "suggested-reply";export type SideJobInstance = Pick<ProviderInstance, "instanceId" | "driverKind" | "enabled" | "generateText" | "generateMemoryText" | "models" | "quickModelsUsable" | "openRouter"> & {adapter: { capabilities: Pick<ProviderAdapter["capabilities"], "agentsMcp"> };@@ -83,6 +85,8 @@ export interface SideJobsDeps {log?: (line: string) => void;/** How many background jobs run at once, across bots. */slots?: JobSlots;+ /** The smallest model of an engine a suggested reply may run on; without it, or when it answers null, there is none. */+ lightModel?: (engine: LightModelEngine, refused: ReadonlySet<string>) => LightModel | null;}export interface SideJobs {@@ -104,7 +108,7 @@ function ownCall(job: SideJob, instance: SideJobInstance): TextCall | undefined/** A turn or a person is waiting on these, so they start at once. */const NEVER_QUEUED: ReadonlySet<SideJob> = new Set(["compaction", "representative", "status-reply"]);/** A person sees these soon (a new bot's suggestions card): they wait ahead of memory upkeep and skill review. */-const SEEN_SOON: ReadonlySet<SideJob> = new Set(["setup-suggestions", "skill-burger"]);+const SEEN_SOON: ReadonlySet<SideJob> = new Set(["setup-suggestions", "skill-burger", "suggested-reply"]);function memoryModelFailure(error: unknown): MemoryModelFailure {if (error instanceof DOMException && error.name === "TimeoutError") return "timeout";@@ -190,6 +194,17 @@ export function createSideJobs(deps: SideJobsDeps): SideJobs {});};+ /** Pinned to the light model: its refusal fails the call rather than running on the bot's own model. */+ const lightText = (bot: SideJobBot, own: SideJobInstance): SideJobText | null => {+ const refused = deps.smallModels.refused(own.instanceId);+ const light = deps.lightModel?.(own, refused);+ if (!light || (deps.modelAllowed && !deps.modelAllowed({ instanceId: own.instanceId, model: light.model }))) return null;+ const call = (light.call === "text" ? own.generateText : own.generateMemoryText)?.bind(own);+ if (!call) return null;+ const pinned: TextGenerationOptions = { model: light.model, fallback: { model: light.model, refused, onRefused: (model) => deps.smallModels.remember(own.instanceId, model) } };+ return { via: "engine", generateText: rememberRefusal(booked("suggested-reply", bot, own, call, { kind: "bot", botId: bot.id }, () => pinned), own, light.model) };+ };+const writeMemory = (bot: SideJobBot, own: SideJobInstance, call: TextCall, selected: MemoryModelSelection): SideJobText["generateText"] =>async (prompt, { onMemoryModel, ...options } = {}) => {const report = (result: MemoryModelOutcome) => onMemoryModel?.({ ...selected, ...result });@@ -282,6 +297,7 @@ export function createSideJobs(deps: SideJobsDeps): SideJobs {const bot = deps.bot(botId);const own = at.instance ?? (bot ? deps.instance(bot.modelSelection.instanceId) : null);if (!bot || !own || deps.refusal(own)) return null;+ if (job === "suggested-reply") return lightText(bot, own);const selectedMemory = job === "memory" && bot.memoryModel?.instanceId === own.instanceId ? bot.memoryModel : undefined;if (selectedMemory && (!own.openRouter || !own.enabled || !own.generateText)) return null;// The review's changes are written with the bot's own skill tools, whoever read the conversation.diff --git a/server/suggested-reply/light-model.test.ts b/server/suggested-reply/light-model.test.tsnew file mode 100644index 0000000000..555e6acab0--- /dev/null+++ b/server/suggested-reply/light-model.test.ts@@ -0,0 +1,76 @@+import { describe, expect, it } from "vitest";++import type { ModelCatalog } from "../contracts.ts";+import { codexBackgroundRoute } from "../drivers/codex-background-text.ts";+import { lightModelFor, type LightModelEngine } from "./light-model.ts";++const catalog = (...ids: string[]): ModelCatalog => ({ default: ids[0] ?? "", options: ids.map((id) => ({ id, label: id })) });+const call = async () => "";+const textEngine = (driverKind: string, models: ModelCatalog, extra: Partial<LightModelEngine> = {}): LightModelEngine => ({ driverKind, models, generateText: call, ...extra });+const backgroundEngine = (driverKind: string, models: ModelCatalog, extra: Partial<LightModelEngine> = {}): LightModelEngine => ({ driverKind, models, generateMemoryText: call, ...extra });++describe("lightModelFor", () => {+ it("picks Haiku for Claude", () => {+ expect(lightModelFor(textEngine("claudeAgent", catalog("claude-opus-5-5", "claude-sonnet-5", "claude-haiku-5-5", "claude-haiku-4-5"))))+ .toEqual({ model: "claude-haiku-5-5", call: "text" });+ });++ it("picks the small model for Codex on an API key", () => {+ expect(lightModelFor(backgroundEngine("codex", catalog("gpt-6", "gpt-6-luna", "gpt-5.4-mini"), { quickModelsUsable: () => true })))+ .toEqual({ model: "gpt-6-luna", call: "background" });+ expect(lightModelFor(backgroundEngine("codex", catalog("gpt-6", "gpt-5.4-mini"))))+ .toEqual({ model: "gpt-5.4-mini", call: "background" });+ });++ it("keeps Codex's background call on the small model it was pinned to, with no retry on a bigger one", () => {+ const models = catalog("gpt-6", "gpt-6-luna", "gpt-5.4-mini");+ const light = lightModelFor(backgroundEngine("codex", models))!.model;+ const pinned = { model: light, refused: new Set<string>(), onRefused: () => {} };+ expect(codexBackgroundRoute(models, true, pinned)).toEqual({ model: "gpt-6-luna" });+ expect(codexBackgroundRoute(models, true, pinned, true)).toEqual({ model: "gpt-6-luna" });+ });++ it("picks Grok's mini model, then its fast one", () => {+ expect(lightModelFor(textEngine("grok", catalog("grok-4.7", "grok-4", "grok-4-fast", "grok-3-mini")))).toEqual({ model: "grok-3-mini", call: "text" });+ expect(lightModelFor(backgroundEngine("grokAgent", catalog("grok-4.7", "grok-4-fast")))).toEqual({ model: "grok-4-fast", call: "background" });+ });++ it("picks Flash-Lite for Antigravity, else Flash", () => {+ expect(lightModelFor(backgroundEngine("antigravityAgent", catalog("gemini-4-argon", "gemini-3.8-flash", "gemini-3.8-flash-lite"))))+ .toEqual({ model: "gemini-3.8-flash-lite", call: "background" });+ expect(lightModelFor(backgroundEngine("antigravityAgent", catalog("gemini-4-argon", "gemini-3.8-flash"))))+ .toEqual({ model: "gemini-3.8-flash", call: "background" });+ });++ it("is off when the provider lists no small model", () => {+ expect(lightModelFor(textEngine("claudeAgent", catalog("claude-opus-5-5", "claude-sonnet-5")))).toBeNull();+ expect(lightModelFor(backgroundEngine("grokAgent", catalog("grok-4.7", "grok-4.6")))).toBeNull();+ expect(lightModelFor(backgroundEngine("codex", catalog("gpt-6", "gpt-6-codex")))).toBeNull();+ });++ it("is off when the sign-in refuses small models (Codex on a ChatGPT plan)", () => {+ expect(lightModelFor(backgroundEngine("codex", catalog("gpt-6", "gpt-6-luna"), { quickModelsUsable: () => false }))).toBeNull();+ });++ it("is off when the engine's one-shot call can't name the model", () => {+ expect(lightModelFor(backgroundEngine("claudeAgent", catalog("claude-haiku-5-5")))).toBeNull();+ expect(lightModelFor(backgroundEngine("geminiAgent", catalog("gemini-2.5-pro", "gemini-2.5-flash", "gemini-2.5-flash-lite")))).toBeNull();+ });++ it("is off for local models, custom endpoints and other agents", () => {+ expect(lightModelFor(textEngine("openai-compat", catalog("gpt-4o", "gpt-4o-mini")))).toBeNull();+ expect(lightModelFor(textEngine("ollama", catalog("llama3.2:1b", "qwen-mini")))).toBeNull();+ expect(lightModelFor(backgroundEngine("customAcp", catalog("tiny-mini")))).toBeNull();+ expect(lightModelFor(textEngine("mistral", catalog("mistral-large", "mistral-small")))).toBeNull();+ const local: ModelCatalog = { default: "claude-sonnet-5", options: [{ id: "claude-sonnet-5", label: "Sonnet" }, { id: "local/haiku-ish", label: "local", local: {} as never }] };+ expect(lightModelFor(textEngine("claudeAgent", local))).toBeNull();+ const custom: ModelCatalog = { default: "x", options: [{ id: "claude-haiku-5-5", label: "mine", custom: true }] };+ expect(lightModelFor(textEngine("claudeAgent", custom))).toBeNull();+ });++ it("skips a small model this engine refused before", () => {+ expect(lightModelFor(textEngine("claudeAgent", catalog("claude-haiku-5-5", "claude-haiku-4-5")), new Set(["claude-haiku-5-5"])))+ .toEqual({ model: "claude-haiku-4-5", call: "text" });+ expect(lightModelFor(textEngine("claudeAgent", catalog("claude-haiku-5-5")), new Set(["claude-haiku-5-5"]))).toBeNull();+ });+});diff --git a/server/suggested-reply/light-model.ts b/server/suggested-reply/light-model.tsnew file mode 100644index 0000000000..e29faabffe--- /dev/null+++ b/server/suggested-reply/light-model.ts@@ -0,0 +1,60 @@+import type { ModelCatalog } from "../contracts.ts";+import { codexBackgroundModel } from "../drivers/codex-background-text.ts";+import { decodeCodexSelection, OFFICIAL_CODEX_PROVIDER } from "../drivers/codex-catalog.ts";++/** The smallest model of the bot's own engine that a suggested reply runs on, and which of the engine's one-shot calls+ * takes it: `text` (a direct request) or `background` (a fresh tool-free engine process). */+export interface LightModel {+ model: string;+ call: "text" | "background";+}++export interface LightModelEngine {+ driverKind: string;+ models: ModelCatalog;+ quickModelsUsable?: () => boolean;+ generateText?: unknown;+ generateMemoryText?: unknown;+}++type Option = ModelCatalog["options"][number];++const named = (pattern: RegExp) => (option: Option) => pattern.test(option.id);+const HAIKU = named(/(?:^|[-_./])haiku(?:$|[-_.])/i);+const MINI = named(/(?:^|[-_./])mini(?:$|[-_.])/i);+const FAST = named(/(?:^|[-_./])fast(?:$|[-_.])/i);+const FLASH_LITE = named(/(?:^|[-_./])flash-lite(?:$|[-_.])/i);+const FLASH = named(/(?:^|[-_./])flash(?:$|[-_.])/i);+const CODEX_SMALL = /(?:^|[-.])(?:luna|mini|nano)(?:$|[-.])/i;++/** First option the first matching rule picks; the engines list their newest first. */+function first(models: ModelCatalog, refused: ReadonlySet<string>, ...rules: Array<(option: Option) => boolean>): string | null {+ const usable = models.options.filter((option) => !option.custom && !option.local && !option.orgBlocked && !option.needsCliUpdate && !refused.has(option.id));+ for (const rule of rules) {+ const hit = usable.find(rule);+ if (hit) return hit.id;+ }+ return null;+}++function codexLight(engine: LightModelEngine, refused: ReadonlySet<string>): string | null {+ // A ChatGPT sign-in refuses the small models its catalog lists.+ if (engine.quickModelsUsable?.() === false) return null;+ const id = codexBackgroundModel(engine.models, refused, OFFICIAL_CODEX_PROVIDER);+ return id && CODEX_SMALL.test(decodeCodexSelection(id).model ?? id) ? id : null;+}++/** Null keeps suggested replies off for this engine: it has no small model of its own, or none its one-shot call can name.+ * Never another provider's model and never a local one. */+export function lightModelFor(engine: LightModelEngine, refused: ReadonlySet<string> = new Set()): LightModel | null {+ const text = (model: string | null): LightModel | null => model && engine.generateText ? { model, call: "text" } : null;+ const background = (model: string | null): LightModel | null => model && engine.generateMemoryText ? { model, call: "background" } : null;+ switch (engine.driverKind) {+ case "claudeAgent": return text(first(engine.models, refused, HAIKU));+ case "grok": return text(first(engine.models, refused, MINI, FAST));+ case "codex": return background(codexLight(engine, refused));+ case "antigravityAgent": return background(first(engine.models, refused, FLASH_LITE, FLASH));+ case "grokAgent": return background(first(engine.models, refused, MINI, FAST));+ default: return null;+ }+}diff --git a/shared/settings-places.ts b/shared/settings-places.tsindex f2b7300a3b..b5897b7921 100644--- a/shared/settings-places.ts+++ b/shared/settings-places.ts@@ -101,6 +101,7 @@ export const SETTINGS_PLACES = [{"id":"layout","path":"Settings → Appearance → Layout","words":["show your computers","rail","window frame","title bar","threads","tools layout","pinned","circles","universal pins","pinned panels"],"advanced":true},{"id":"skill-burger-switch","path":"Settings → Features → Skill Burger","words":["skill burger","skill burgers","burger","saved runs","workflows"]},{"id":"thread-tabs","path":"Settings → Features → Thread tabs","words":["tabs","threads"]},+ {"id":"suggested-replies","path":"Settings → Features → Suggested replies","words":["suggestions","autocomplete","next reply","tab"]},{"id":"apps","path":"the Apps panel (Connect apps, at the bottom of the sidebar)","words":["apps","gmail","slack","calendar","notion","connect app","integrations"]},{"id":"bot-settings","path":"a bot's own Settings (click the bot's name at the top of its chat)","words":["a bot's own settings","approvals","safety","routines","memory","bot's notifications"]},{"id":"shortcuts","path":"the keyboard shortcut list (the menu under the person's name → Keyboard shortcuts)","words":["keyboard shortcuts","hotkeys","cheat sheet"]},diff --git a/shared/suggested-reply.test.ts b/shared/suggested-reply.test.tsnew file mode 100644index 0000000000..63322d1c06--- /dev/null+++ b/shared/suggested-reply.test.ts@@ -0,0 +1,58 @@+import { describe, expect, it } from "vitest";++import { cleanSuggestion, lastExchange, type SuggestionRow } from "./suggested-reply.ts";++const ask = (id: string, text: string, extra: Partial<SuggestionRow> & Record<string, unknown> = {}): SuggestionRow => ({ id, role: "user", kind: "text", text, ...extra });+const reply = (id: string, text: string, extra: Record<string, unknown> = {}): SuggestionRow => ({ id, role: "bot", kind: "text", text, ...extra });+const step = (id: string): SuggestionRow => ({ id, role: "bot", kind: "activity" });+const LONG = "I drafted the email to the team and saved it in your drafts folder.";++describe("lastExchange", () => {+ it("is the person's last message and the bot's finished reply, ignoring older turns and the work in between", () => {+ const rows = [ask("u0", "older question"), reply("b0", "an older answer that is long enough"), ask("u1", "Draft the email"), step("s1"), reply("b1", LONG), step("s2")];+ expect(lastExchange(rows)).toEqual({ ask: "Draft the email", askId: "u1", reply: LONG, replyId: "b1" });+ });++ it("has nothing while the bot has not answered the newest message", () => {+ expect(lastExchange([ask("u0", "hi"), reply("b0", LONG), ask("u1", "and then?")])).toBeNull();+ expect(lastExchange([ask("u1", "and then?"), step("s1")])).toBeNull();+ expect(lastExchange([])).toBeNull();+ });++ it("has nothing when the reply ends in a card, choice or approval", () => {+ expect(lastExchange([ask("u", "go"), reply("b", LONG), { id: "o", role: "bot", kind: "options" }])).toBeNull();+ expect(lastExchange([ask("u", "go"), reply("b", LONG, { card: { requestId: "r" } })])).toBeNull();+ expect(lastExchange([ask("u", "go"), reply("b", LONG, { setupChoices: ["a", "b"] })])).toBeNull();+ expect(lastExchange([ask("u", "go"), reply("b", LONG), { id: "w", role: "bot", kind: "widget" }])).toBeNull();+ });++ it("has nothing after a trivial reply or an automated ask", () => {+ expect(lastExchange([ask("u", "send it"), reply("b", "Done.")])).toBeNull();+ expect(lastExchange([ask("u", "daily brief", { automated: { kind: "routine" } }), reply("b", LONG)])).toBeNull();+ expect(lastExchange([ask("u", "check this", { peerAsk: { botId: "b2", name: "Rex" } }), reply("b", LONG)])).toBeNull();+ expect(lastExchange([ask("u", "go"), reply("b", LONG, { stoppedBy: "person" })])).toBeNull();+ });++ it("keeps the end of a very long reply", () => {+ const long = `${"start ".repeat(1_000)}the end`;+ const found = lastExchange([ask("u", "write a lot"), reply("b", long)]);+ expect(found?.reply.endsWith("the end")).toBe(true);+ expect(found!.reply.length).toBeLessThanOrEqual(3_001);+ });+});++describe("cleanSuggestion", () => {+ it("keeps one short plain line", () => {+ expect(cleanSuggestion("Send it to Priya too")).toBe("Send it to Priya too");+ expect(cleanSuggestion("\"Send it to Priya too\"\n\nThis is a good next step.")).toBe("Send it to Priya too");+ expect(cleanSuggestion("Suggestion: Make it shorter")).toBe("Make it shorter");+ expect(cleanSuggestion("- Make it shorter")).toBe("Make it shorter");+ });++ it("drops NONE, empty and long answers", () => {+ expect(cleanSuggestion("NONE")).toBeNull();+ expect(cleanSuggestion(" \n ")).toBeNull();+ expect(cleanSuggestion(null)).toBeNull();+ expect(cleanSuggestion("word ".repeat(20))).toBeNull();+ });+});diff --git a/shared/suggested-reply.ts b/shared/suggested-reply.tsnew file mode 100644index 0000000000..408fe1c26f--- /dev/null+++ b/shared/suggested-reply.ts@@ -0,0 +1,79 @@+// Suggested replies: the one short line a person might send next, offered in an empty composer after a bot's reply.++/** The fields of a transcript row the suggestion reads; the server's stored rows and the client's both fit. */+export interface SuggestionRow {+ id: string;+ role: "bot" | "user";+ kind: string;+ text?: string;+ automated?: unknown;+ aside?: unknown;+ /** Another bot's ask, not the person's. */+ peerAsk?: unknown;+ from?: unknown;+ stoppedBy?: unknown;+}++export interface LastExchange {+ /** The person's last message. */+ ask: string;+ askId: string;+ reply: string;+ /** The reply's row: a suggestion is for this reply only. */+ replyId: string;+}++/** Rows a finished turn may leave after its reply that ask nothing of the person. */+const QUIET_KINDS: ReadonlySet<string> = new Set(["activity", "digest", "screen"]);++/** Fields that make a row something the person answers in place (a card, a choice, a wait) rather than by typing. */+const INTERACTIVE_FIELDS = [+ "card", "widget", "app", "connector", "secret", "signIn", "routineRun", "goalRun", "burst", "call", "setupOffer", "setupChoices",+ "setupChoicesPending", "setupRequest", "settingsCard", "setupSuggestion", "helperIntro", "helperFollowup", "savedSteps",+ "waitId", "waitRequest", "checkBack", "handoff", "bugReport", "serverCard", "webhookPost",+] as const;++const ASK_MAX = 1_500;+const REPLY_MAX = 3_000;+const TRIVIAL_CHARS = 20;+const TRIVIAL_WORDS = 4;+export const SUGGESTION_MAX_WORDS = 12;+const SUGGESTION_MAX_CHARS = 120;++const words = (text: string) => text.trim().split(/\s+/).filter(Boolean).length;++function interactive(row: SuggestionRow): boolean {+ const fields = row as unknown as Record<string, unknown>;+ return !(row.kind === "text" || QUIET_KINDS.has(row.kind)) || INTERACTIVE_FIELDS.some((field) => fields[field] !== undefined && fields[field] !== false);+}++/** The person's last message and the bot's finished plain reply to it, or null when there is nothing to suggest after:+ * no reply yet, a card or choice to answer, an automated or another bot's ask, a stopped reply, or one too short to+ * answer ("Done."). */+export function lastExchange(rows: readonly SuggestionRow[]): LastExchange | null {+ const askAt = rows.findLastIndex((row) => row.role === "user" && row.kind === "text" && !row.aside);+ if (askAt < 0) return null;+ const ask = rows[askAt]!;+ if (ask.automated || ask.peerAsk || ask.from || !ask.text?.trim()) return null;+ const after = rows.slice(askAt + 1);+ if (!after.length || after.some((row) => row.role !== "bot" || interactive(row))) return null;+ const reply = after.findLast((row) => row.kind === "text");+ const text = reply?.text?.trim();+ if (!reply || reply.stoppedBy || !text || text.length < TRIVIAL_CHARS || words(text) < TRIVIAL_WORDS) return null;+ return { ask: ask.text.trim().slice(0, ASK_MAX), askId: ask.id, reply: text.length > REPLY_MAX ? `…${text.slice(-REPLY_MAX)}` : text, replyId: reply.id };+}++/** The model's answer as one short line, or null when it gave none that fits. */+export function cleanSuggestion(raw: string | null | undefined): string | null {+ const line = (raw ?? "").split("\n").map((one) => one.trim()).find(Boolean);+ if (!line) return null;+ const text = line+ .replace(/^(?:[-*•>]\s*|\d+[.)]\s*)/, "")+ .replace(/^(?:suggestion|reply|next)\s*:\s*/i, "")+ .replace(/^["'“”‘’«»「『]+|["'“”‘’«»」』]+$/g, "")+ .replace(/\s+/g, " ")+ .trim();+ if (!text || /^none\.?$/i.test(text)) return null;+ if (text.length > SUGGESTION_MAX_CHARS || words(text) > SUGGESTION_MAX_WORDS + 2) return null;+ return text;+}diff --git a/src/components/Composer.tsx b/src/components/Composer.tsxindex 2db4a4b564..2e620f9fdd 100644--- a/src/components/Composer.tsx+++ b/src/components/Composer.tsx@@ -38,7 +38,7 @@ import {} from "@/lib/drafts";import { DEVS_CHOICE, MentionMenu, teammateChoices, type MentionChoice } from "./MentionMenu"; import { useTeammates } from "@/state/team-people"; import { hiddenFromSidebar, useViewerEmail } from "@/lib/default-bot"; import { useMayAct } from "./SharedQueueLine";import { SlashCommandMenu } from "./SlashCommandMenu"; import { ComposerFailedSends } from "./ComposerFailedSends";-import { MentionTextarea } from "./MentionTextarea";+import { MentionTextarea } from "./MentionTextarea"; import { useSuggestedReply } from "./use-suggested-reply"; import { SUGGESTION_HINT_ID, SuggestedReplyGhost } from "./SuggestedReplyGhost";import { ComposerAttachments, pathForFile } from "./ComposerAttachments";import { PointedChips } from "./app/PointedChips"; import { SetupRequestChip, setupRequestPlaceholder } from "./SetupOffer";import { takePointedChips } from "@/lib/pointed-chips";@@ -528,6 +528,7 @@ export function Composer({};const hasContent = Boolean(effectiveText.trim()) || attachments.length > 0;+ const suggestion = useSuggestedReply({ botId: group ? undefined : bot?.id, threadId, messages: !group && bot ? visibleMessages(bot) : [], working: busy || Boolean(bot?.waitingForTeammates), held: locked || blocking || pendingCount > 0 || Boolean(replyTo) || recording, draft: text, attached: attachments.length > 0, inputRef, fill: (value) => { editText(value); setCaret(value.length); } });const onCall = useOnCall();const media = useLiveMedia();const callTarget = group?.id ?? bot?.id;@@ -821,7 +822,7 @@ export function Composer({</div>)}<MentionTextarea- wrapperClassName={stacked ? "basis-full" : undefined}+ wrapperClassName={stacked ? "basis-full" : undefined} ghost={suggestion.text ? <SuggestedReplyGhost text={suggestion.text} onUse={suggestion.accept} /> : undefined}inputRef={inputRef}peers={[...(group ? members ?? [] : bots.filter((member) => member.id !== bot?.id)), ...teammates.peers]}everyone={Boolean(group && !group.dm)}@@ -840,7 +841,7 @@ export function Composer({onClick={(e) => setCaret((e.target as HTMLTextAreaElement).selectionStart ?? 0)}onKeyDown={(e) => {// An input method's confirming Enter and arrows pick its own candidates, not a mention or command.- if (imeComposing(e.nativeEvent)) return;+ if (imeComposing(e.nativeEvent) || suggestion.onKeyDown(e)) return;const submitsFork = fork.command && commandCandidates[highlight]?.id === "fork" && sendsMessage(e.nativeEvent, sendKey);// A complete /archive or /delete is its own action: Enter runs it instead of only completing the word.const submitsThreadCommand = Boolean(threadCommand) && commandCandidates[highlight]?.id === threadCommand && sendsMessage(e.nativeEvent, sendKey);@@ -919,8 +920,8 @@ export function Composer({// Not disabled during an upload: a disabled element drops keyboard focus for good. send() refuses while one// is pending.disabled={blocking || locked}- aria-busy={bot?.awaitingThreadSnapshot || undefined}- placeholder={composerPlaceholder({+ aria-busy={bot?.awaitingThreadSnapshot || undefined} aria-describedby={suggestion.text ? SUGGESTION_HINT_ID : undefined}+ placeholder={suggestion.text ?? composerPlaceholder({simple: !advanced, approval: blocking, attaching: attachmentPending, listening: recording,replying: Boolean(replyTo), busy, canSteer: steersNow, queued: pendingCount > 0, busyName, sendLabel, group, members: members ?? [],jevOn: jevRoomRoutingOn(state.config), goal: channelMode === "goal", botName: bot?.name ?? "",diff --git a/src/components/MentionTextarea.tsx b/src/components/MentionTextarea.tsxindex b79430e014..030fed451d 100644--- a/src/components/MentionTextarea.tsx+++ b/src/components/MentionTextarea.tsx@@ -1,26 +1,33 @@import { cn } from "@/lib/cn";-import { useCallback, useLayoutEffect, useRef, useState, type RefObject, type TextareaHTMLAttributes } from "react";+import { useCallback, useLayoutEffect, useRef, useState, type ReactNode, type RefObject, type TextareaHTMLAttributes } from "react";import { type MentionPeer } from "@/lib/mentions";import { MentionText } from "./MentionText";const TEXT_LAYOUT = ["font-family", "font-size", "font-weight", "font-style", "font-stretch", "font-feature-settings", "font-variation-settings","letter-spacing", "word-spacing", "line-height", "text-indent", "tab-size", "padding-top", "padding-right", "padding-bottom", "padding-left"] as const;-export function MentionTextarea({ inputRef, peers, everyone = false, wrapperClassName, ...props }: TextareaHTMLAttributes<HTMLTextAreaElement> & {+export function MentionTextarea({ inputRef, peers, everyone = false, wrapperClassName, ghost, ...props }: TextareaHTMLAttributes<HTMLTextAreaElement> & {wrapperClassName?: string;+ /** Drawn over the empty field in its own text layout, in place of the placeholder. */+ ghost?: ReactNode;inputRef: RefObject<HTMLTextAreaElement | null>;peers: readonly MentionPeer[];everyone?: boolean;}) {const [composing, setComposing] = useState(false);const mirrorRef = useRef<HTMLDivElement>(null);+ const ghostRef = useRef<HTMLDivElement>(null);const sync = useCallback(() => {const input = inputRef.current;- const mirror = mirrorRef.current;- if (!input || !mirror) return;+ if (!input) return;const style = getComputedStyle(input);- for (const property of TEXT_LAYOUT) mirror.style.setProperty(property, style.getPropertyValue(property));- mirror.style.width = `${input.clientWidth}px`;+ for (const layer of [mirrorRef.current, ghostRef.current]) {+ if (!layer) continue;+ for (const property of TEXT_LAYOUT) layer.style.setProperty(property, style.getPropertyValue(property));+ layer.style.width = `${input.clientWidth}px`;+ }+ const mirror = mirrorRef.current;+ if (!mirror) return;mirror.scrollTop = input.scrollTop;mirror.scrollLeft = input.scrollLeft;}, [inputRef]);@@ -35,6 +42,8 @@ export function MentionTextarea({ inputRef, peers, everyone = false, wrapperClassync();}, [inputRef, sync]);useLayoutEffect(resize, [props.value, props.className, resize]);+ const ghostShown = Boolean(ghost);+ useLayoutEffect(sync, [ghostShown, sync]);useLayoutEffect(() => {let width = inputRef.current?.clientWidth;const observer = new ResizeObserver(() => {@@ -46,10 +55,11 @@ export function MentionTextarea({ inputRef, peers, everyone = false, wrapperClasif (inputRef.current) observer.observe(inputRef.current);return () => observer.disconnect();}, [inputRef, resize, sync]);- return <div data-composing={composing || undefined} className={cn("mention-editor relative min-w-0 flex-1 self-center", wrapperClassName)}>+ return <div data-composing={composing || undefined} data-ghost={ghostShown ? "" : undefined} className={cn("mention-editor relative min-w-0 flex-1 self-center", wrapperClassName)}><div ref={mirrorRef} dir={props.dir} aria-hidden="true" className="mention-editor-mirror pointer-events-none absolute inset-0 overflow-hidden"><MentionText text={String(props.value ?? "")} peers={peers} everyone={everyone} />{"\n"}</div>+ {ghostShown ? <div ref={ghostRef} dir={props.dir} className="mention-editor-ghost pointer-events-none absolute inset-0 overflow-hidden">{ghost}</div> : null}<textarea {...props} ref={inputRef}onCompositionStart={(event) => { setComposing(true); props.onCompositionStart?.(event); }}onCompositionEnd={(event) => { setComposing(false); props.onCompositionEnd?.(event); }}diff --git a/src/components/SuggestedReplyGhost.tsx b/src/components/SuggestedReplyGhost.tsxnew file mode 100644index 0000000000..fc0a6dd368--- /dev/null+++ b/src/components/SuggestedReplyGhost.tsx@@ -0,0 +1,27 @@+import { t } from "@/lib/i18n";+import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";++export const SUGGESTION_HINT_ID = "composer-suggested-reply-hint";+const TAPPED = `(hover: none) and (pointer: coarse), ${PHONE_LAYOUT}`;++/** The faded suggestion drawn where the empty field's placeholder sits: a Tab keycap after it, or on a touch screen a+ * small button that fills the field, also in the phone layout. */+export function SuggestedReplyGhost({ text, onUse }: { text: string; onUse(): void }) {+ const touch = useMediaQuery(TAPPED);+ return (+ <div data-suggested-reply className="flex min-w-0 items-center gap-2 text-ink-tertiary">+ <span aria-hidden="true" className="min-w-0 truncate">{text}</span>+ {touch ? (+ <button type="button" onClick={onUse} aria-label={t("composer.suggestion.use")}+ className="pointer-events-auto relative z-[1] shrink-0 rounded-full border border-hairline px-2 text-[12px] leading-5 text-ink-secondary transition-colors duration-[120ms] hover:bg-raised-hover motion-reduce:transition-none">+ {t("composer.suggestion.useShort")}+ </button>+ ) : (+ <kbd aria-hidden="true" className="shrink-0 rounded border border-hairline/50 px-1.5 py-0.5 font-sans text-[11px] leading-none text-ink-tertiary">+ {t("composer.suggestion.key")}+ </kbd>+ )}+ <span id={SUGGESTION_HINT_ID} className="sr-only">{touch ? t("composer.suggestion.hintTouch") : t("composer.suggestion.hint")}</span>+ </div>+ );+}diff --git a/src/components/settings/SettingsWindow.test.ts b/src/components/settings/SettingsWindow.test.tsindex 56231b3c26..faa2a35e5f 100644--- a/src/components/settings/SettingsWindow.test.ts+++ b/src/components/settings/SettingsWindow.test.ts@@ -303,6 +303,20 @@ describe("Settings → Features", () => {expect(api).toHaveBeenCalledWith("/api/config", { method: "PATCH", body: JSON.stringify({ features: { skillBurger: false } }) });});+ it("shows Suggested replies on by default, says it uses a little of the plan, and saves it off", async () => {+ const { api } = await import("@/state/store");+ fixture.config = { features: { skillBurger: true, threadTabs: false, suggestedReplies: true } };+ const html = render("features");+ expect(html).toContain("Suggested replies");+ expect(html).toContain("uses a little of your plan or API credit");+ expect(featureSwitches()).toEqual({ skillBurger: true, threadTabs: false, suggestedReplies: true });+ fixture.switches.find((props) => (props as { "data-feature-switch"?: string })["data-feature-switch"] === "suggestedReplies")!.onClick!({} as never);+ expect(api).toHaveBeenCalledWith("/api/config", { method: "PATCH", body: JSON.stringify({ features: { suggestedReplies: false } }) });+ fixture.config = { features: { skillBurger: true, threadTabs: false, suggestedReplies: false } };+ render("features");+ expect(featureSwitches()).toEqual({ skillBurger: true, threadTabs: false, suggestedReplies: false });+ });+it("shows the Board switch only where the server reports it (a Team Cloud)", () => {fixture.config = { cloudHome: true, team: { name: "Acme" }, features: { skillBurger: true, threadTabs: false, teamBoard: false } };expect(render("features")).toContain("Board");diff --git a/src/components/settings/pages/FeaturesPage.tsx b/src/components/settings/pages/FeaturesPage.tsxindex afa7524fc9..69161214f0 100644--- a/src/components/settings/pages/FeaturesPage.tsx+++ b/src/components/settings/pages/FeaturesPage.tsx@@ -10,6 +10,7 @@ const COPY: Record<Feature, { title: LocaleKey; line: LocaleKey }> = {skillBurger: { title: "settings.features.skillBurger", line: "settings.features.skillBurgerLine" },threadTabs: { title: "settings.features.threadTabs", line: "settings.features.threadTabsLine" },teamBoard: { title: "settings.features.teamBoard", line: "settings.features.teamBoardLine" },+ suggestedReplies: { title: "settings.features.suggestedReplies", line: "settings.features.suggestedRepliesLine" },};/** One switch kept in this place's config.json; shown once its server says it knows the switch (the board: only a Team Cloud's). */@@ -48,6 +49,7 @@ export function FeaturesPage() {<SettingsRows><FeatureRow name="skillBurger" /><FeatureRow name="threadTabs" />+ <FeatureRow name="suggestedReplies" /><FeatureRow name="teamBoard" /></SettingsRows></SettingsGroup>diff --git a/src/components/settings/settings-index.ts b/src/components/settings/settings-index.tsindex c97ca9bfd9..56baa81e7e 100644--- a/src/components/settings/settings-index.ts+++ b/src/components/settings/settings-index.ts@@ -261,6 +261,7 @@ export const SETTINGS_INDEX: readonly SettingsIndexEntry[] = [{ id: "layout", page: "appearance", anchor: "appearance", labelKey: "settings.appearance.layout", advanced: true, synonyms: ["show your computers", "rail", "window frame", "title bar", "threads", "tools layout", "pinned", "circles", "universal pins", "pinned panels"] },{ id: "skill-burger-switch", page: "features", anchor: "features", labelKey: "settings.features.skillBurger", topFor: ["skill burger", "skill burgers"], synonyms: ["burger", "saved runs", "workflows"] },{ id: "thread-tabs", page: "features", anchor: "features", labelKey: "settings.features.threadTabs", synonyms: ["tabs", "threads"] },+ { id: "suggested-replies", page: "features", anchor: "features", labelKey: "settings.features.suggestedReplies", synonyms: ["suggestions", "autocomplete", "next reply", "tab"] },{ id: "apps", page: "overview", labelKey: "settings.search.apps", jump: "apps", synonyms: ["apps", "gmail", "slack", "calendar", "notion", "connect app", "integrations"] },{ id: "bot-settings", page: "overview", labelKey: "settings.search.bot", jump: "bot", synonyms: ["approvals", "safety", "routines", "memory", "bot's notifications"] },{ id: "shortcuts", page: "app", labelKey: "sidebar.menu.shortcuts", jump: "shortcuts", synonyms: ["keyboard shortcuts", "hotkeys", "cheat sheet"] },diff --git a/src/components/use-suggested-reply.dom.test.ts b/src/components/use-suggested-reply.dom.test.tsnew file mode 100644index 0000000000..14dba88322--- /dev/null+++ b/src/components/use-suggested-reply.dom.test.ts@@ -0,0 +1,223 @@+// @vitest-environment happy-dom+import { act, createElement, createRef } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import type { SuggestionRow } from "../../shared/suggested-reply";++const fixture = vi.hoisted(() => ({+ on: true,+ calls: [] as Array<{ body: { botId: string; threadId: string; after: string }; signal?: AbortSignal }>,+ answer: "Send it to Priya too" as string | null,+ pending: [] as Array<() => void>,+}));+vi.mock("@/lib/use-feature", () => ({ useFeature: (name: string) => name === "suggestedReplies" && fixture.on }));+vi.mock("@/state/store", () => ({+ api: (_path: string, init: { body: string; signal?: AbortSignal }) => {+ fixture.calls.push({ body: JSON.parse(init.body), signal: init.signal });+ return new Promise((resolve, reject) => {+ init.signal?.addEventListener("abort", () => reject(new Error("aborted")));+ fixture.pending.push(() => resolve({ text: fixture.answer }));+ });+ },+}));++import { forgetSuggestedReplies, SUGGESTION_DELAY_MS, useSuggestedReply, type SuggestedReply, type SuggestedReplyInput } from "./use-suggested-reply";++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;++const REPLY = "I drafted the launch email and saved it in your drafts folder.";+const ask = (id: string, text = "Draft the launch email"): SuggestionRow => ({ id, role: "user", kind: "text", text });+const reply = (id: string, text = REPLY): SuggestionRow => ({ id, role: "bot", kind: "text", text });+const TURN = [ask("u1"), reply("b1")];++let root: Root;+let host: HTMLDivElement;+let latest: SuggestedReply;+const filled: string[] = [];+const inputRef = createRef<HTMLTextAreaElement>();+let props: Omit<SuggestedReplyInput, "inputRef" | "fill">;++function Harness(input: Omit<SuggestedReplyInput, "inputRef" | "fill">) {+ latest = useSuggestedReply({ ...input, inputRef, fill: (text) => filled.push(text) });+ return null;+}++function render(next: Partial<typeof props> = {}) {+ props = { ...props, ...next };+ act(() => root.render(createElement(Harness, props)));+}++async function settle() {+ await act(async () => { vi.advanceTimersByTime(SUGGESTION_DELAY_MS + 10); });+}++async function answer() {+ await act(async () => { fixture.pending.splice(0).forEach((resolve) => resolve()); });+}++/** A turn that runs and finishes while the composer is open. */+async function finishTurn(messages: SuggestionRow[] = TURN) {+ render({ working: true, messages: [messages[0]!] });+ render({ working: false, messages });+ await settle();+}++const key = (name: string, extra: Partial<KeyboardEvent> = {}) => ({ key: name, shiftKey: false, ctrlKey: false, altKey: false, metaKey: false, preventDefault: vi.fn(), ...extra });++beforeEach(() => {+ vi.useFakeTimers();+ forgetSuggestedReplies();+ fixture.on = true;+ fixture.calls.length = 0;+ fixture.pending.length = 0;+ fixture.answer = "Send it to Priya too";+ filled.length = 0;+ props = { botId: "bot", threadId: "t1", messages: [], working: false, held: false, draft: "", attached: false };+ host = document.createElement("div");+ root = createRoot(host);+});++afterEach(() => {+ act(() => root.unmount());+ vi.useRealTimers();+});++describe("useSuggestedReply", () => {+ it("asks once after a reply finishes, then shows the suggestion", async () => {+ render();+ await finishTurn();+ expect(fixture.calls.map((call) => call.body)).toEqual([{ botId: "bot", threadId: "t1", after: "b1" }]);+ expect(latest.text).toBeNull();+ await answer();+ expect(latest.text).toBe("Send it to Priya too");+ render({});+ await settle();+ expect(fixture.calls).toHaveLength(1);+ });++ it("asks after a quick reply to a message sent here, even if the bot was never seen working", async () => {+ render({ messages: TURN });+ render({ messages: [...TURN, ask("u2", "Make it friendlier"), reply("b2")] });+ await settle();+ expect(fixture.calls.map((call) => call.body.after)).toEqual(["b2"]);+ });++ it("asks nothing when an older page or an aside arrives after opening", async () => {+ render({ messages: [ask("u2"), reply("b2")] });+ render({ messages: [ask("u1"), reply("b1"), ask("u2"), reply("b2")] });+ render({ messages: [ask("u1"), reply("b1"), ask("u2"), reply("b2"), { id: "a1", role: "user", kind: "text", text: "peer note", aside: true }] });+ await settle();+ expect(fixture.calls).toHaveLength(0);+ });++ it("asks nothing for a conversation that was already finished when it opened", async () => {+ render({ messages: TURN });+ await settle();+ render({ threadId: "t2", messages: [] });+ render({ threadId: "t2", messages: [ask("x1"), reply("y1")] });+ await settle();+ expect(fixture.calls).toHaveLength(0);+ });++ it("clears at the first keystroke and stays gone after the field is emptied", async () => {+ render();+ await finishTurn();+ await answer();+ render({ draft: "S" });+ expect(latest.text).toBeNull();+ render({ draft: "" });+ expect(latest.text).toBeNull();+ });++ it("cancels the request when the person starts typing", async () => {+ render();+ await finishTurn();+ render({ draft: "n" });+ expect(fixture.calls[0]!.signal?.aborted).toBe(true);+ render({ draft: "" });+ await answer();+ expect(latest.text).toBeNull();+ });++ it("fills the field on Tab, and leaves Tab alone when there is nothing to take", async () => {+ render();+ expect(latest.onKeyDown(key("Tab"))).toBe(false);+ await finishTurn();+ await answer();+ expect(latest.onKeyDown(key("Tab", { shiftKey: true }))).toBe(false);+ expect(latest.onKeyDown(key("Tab", { ctrlKey: true }))).toBe(false);+ const tab = key("Tab");+ act(() => { expect(latest.onKeyDown(tab)).toBe(true); });+ expect(tab.preventDefault).toHaveBeenCalled();+ expect(filled).toEqual(["Send it to Priya too"]);+ expect(latest.text).toBeNull();+ });++ it("turns the suggestion down on Escape", async () => {+ render();+ await finishTurn();+ await answer();+ act(() => { expect(latest.onKeyDown(key("Escape"))).toBe(true); });+ expect(latest.text).toBeNull();+ expect(filled).toEqual([]);+ expect(latest.onKeyDown(key("Escape"))).toBe(false);+ });++ it("drops a pending request and the suggestion when a new turn starts", async () => {+ render();+ await finishTurn();+ render({ working: true, messages: [...TURN, ask("u2", "one more thing")] });+ expect(fixture.calls[0]!.signal?.aborted).toBe(true);+ await answer();+ expect(latest.text).toBeNull();+ });++ it("hides while the bot works or something else holds the field", async () => {+ render();+ await finishTurn();+ await answer();+ render({ held: true });+ expect(latest.text).toBeNull();+ render({ held: false, attached: true });+ expect(latest.text).toBeNull();+ render({ attached: false });+ expect(latest.text).toBe("Send it to Priya too");+ });++ it("asks nothing after a reply that ends in a card or choice, or a trivial one", async () => {+ render();+ await finishTurn([ask("u1"), reply("b1"), { id: "o1", role: "bot", kind: "options" }]);+ await finishTurn([ask("u2"), reply("b2", "Done.")]);+ expect(fixture.calls).toHaveLength(0);+ });++ it("asks nothing with the setting off or in a room", async () => {+ fixture.on = false;+ render();+ await finishTurn();+ fixture.on = true;+ render({ botId: undefined, threadId: "room" });+ await finishTurn();+ expect(fixture.calls).toHaveLength(0);+ });++ it("shows each thread's own suggestion when switching threads", async () => {+ render();+ await finishTurn();+ await answer();+ render({ threadId: "t2", messages: [ask("x1"), reply("y1")] });+ expect(latest.text).toBeNull();+ await settle();+ expect(fixture.calls).toHaveLength(1);+ render({ threadId: "t1", messages: TURN });+ expect(latest.text).toBe("Send it to Priya too");+ });++ it("stays quiet when the answer is empty", async () => {+ fixture.answer = null;+ render();+ await finishTurn();+ await answer();+ expect(latest.text).toBeNull();+ });+});diff --git a/src/components/use-suggested-reply.ts b/src/components/use-suggested-reply.tsnew file mode 100644index 0000000000..cc146f703a--- /dev/null+++ b/src/components/use-suggested-reply.ts@@ -0,0 +1,114 @@+import { useEffect, useMemo, useRef, useState, type RefObject } from "react";+import { lastExchange, type SuggestionRow } from "../../shared/suggested-reply";+import { useFeature } from "@/lib/use-feature";+import { api } from "@/state/store";++/** In memory only, per thread: the suggestion for one reply, and the replies already asked about or turned down. */+const offered = new Map<string, { after: string; text: string }>();+const asked = new Map<string, string>();+const declined = new Map<string, string>();++export const SUGGESTION_DELAY_MS = 400;++export interface SuggestedReplyInput {+ /** The bot whose own conversation this composer writes to; none in a room. */+ botId?: string;+ threadId: string;+ messages: readonly SuggestionRow[];+ /** The bot is working on this thread. */+ working: boolean;+ /** Something else comes first: an approval waits, a message is queued, a reply is being quoted, or the field is locked. */+ held: boolean;+ /** Whatever the field holds, typed or attached. */+ draft: string;+ attached: boolean;+ inputRef: RefObject<HTMLTextAreaElement | null>;+ fill(text: string): void;+}++export interface SuggestedReply {+ /** The suggestion now showing, or null. */+ text: string | null;+ accept(): void;+ dismiss(): void;+ /** Tab takes the suggestion and Escape turns it down; true when the key was used. */+ onKeyDown(event: Pick<KeyboardEvent, "key" | "shiftKey" | "ctrlKey" | "altKey" | "metaKey" | "preventDefault">): boolean;+}++/** One faded next line after a reply that finished while this composer was open: the bot was seen working, or the person+ * sent a message here (a quick reply can start and end between two renders). Asked for once per reply, after a short+ * pause, and cancelled the moment anything else happens in the thread or the field. */+export function useSuggestedReply(input: SuggestedReplyInput): SuggestedReply {+ const on = useFeature("suggestedReplies");+ const { botId, threadId, working, draft, attached, inputRef, fill } = input;+ const held = input.held || working;+ const exchange = useMemo(() => lastExchange(input.messages), [input.messages]);+ const replyId = exchange?.replyId ?? null;+ const [, redraw] = useState(0);+ const lastRowId = input.messages.at(-1)?.id;+ const [watched, setWatched] = useState({ threadId, worked: working, lastAtOpen: lastRowId });+ if (watched.threadId !== threadId) setWatched({ threadId, worked: working, lastAtOpen: lastRowId });+ else if (working && !watched.worked) setWatched({ ...watched, worked: true });+ else if (watched.lastAtOpen === undefined && lastRowId !== undefined) setWatched({ ...watched, lastAtOpen: lastRowId });+ const sent = useMemo(() => {+ if (watched.threadId !== threadId || watched.lastAtOpen === undefined || !exchange) return false;+ const openedAt = input.messages.findIndex((row) => row.id === watched.lastAtOpen);+ return openedAt >= 0 && input.messages.findIndex((row) => row.id === exchange.askId) > openedAt;+ }, [watched, threadId, exchange, input.messages]);+ const lastThread = useRef(threadId);++ useEffect(() => {+ const sameThread = lastThread.current === threadId;+ lastThread.current = threadId;+ if (sameThread && draft && replyId && (offered.get(threadId)?.after === replyId || asked.get(threadId) === replyId)) declined.set(threadId, replyId);+ }, [threadId, draft, replyId]);++ const live = on && Boolean(botId) && ((watched.threadId === threadId && watched.worked) || sent) && !held && !draft && !attached;+ useEffect(() => {+ if (!live || !replyId || asked.get(threadId) === replyId) return;+ const stop = new AbortController();+ const timer = setTimeout(() => {+ asked.set(threadId, replyId);+ api<{ text?: string | null }>("/api/suggested-reply", { method: "POST", body: JSON.stringify({ botId, threadId, after: replyId }), signal: stop.signal })+ .then((answer) => {+ if (stop.signal.aborted || !answer?.text) return;+ offered.set(threadId, { after: replyId, text: answer.text });+ redraw((n) => n + 1);+ })+ .catch(() => {});+ }, SUGGESTION_DELAY_MS);+ return () => { clearTimeout(timer); stop.abort(); };+ }, [live, botId, threadId, replyId]);++ const current = offered.get(threadId);+ const text = on && botId && !held && !draft && !attached && replyId && current?.after === replyId && declined.get(threadId) !== replyId ? current.text : null;++ const dismiss = () => {+ if (!replyId) return;+ declined.set(threadId, replyId);+ redraw((n) => n + 1);+ };+ const accept = () => {+ if (!text) return;+ dismiss();+ fill(text);+ inputRef.current?.focus();+ requestAnimationFrame(() => inputRef.current?.setSelectionRange(text.length, text.length));+ };+ const onKeyDown: SuggestedReply["onKeyDown"] = (event) => {+ if (!text || event.shiftKey || event.ctrlKey || event.altKey || event.metaKey) return false;+ if (event.key !== "Tab" && event.key !== "Escape") return false;+ event.preventDefault();+ if (event.key === "Tab") accept();+ else dismiss();+ return true;+ };+ return { text, accept, dismiss, onKeyDown };+}++/** Clears every remembered suggestion; tests only. */+export function forgetSuggestedReplies(): void {+ offered.clear();+ asked.clear();+ declined.clear();+}diff --git a/src/lib/feature-flags.test.ts b/src/lib/feature-flags.test.tsindex e1b585875d..594c32f920 100644--- a/src/lib/feature-flags.test.ts+++ b/src/lib/feature-flags.test.ts@@ -1,6 +1,6 @@import { describe, expect, it } from "vitest";-import { builtInBrowserEnabled, parseSkillReviewSteps, roomMemoryCaptureEnabled, savedStepsEnabled, shareLearnedSkillsMode, sharedComputersEnabled, showToolCallsEnabled, skillAuthoringEnabled, skillReviewEnabled, skillReviewSteps, skillReviewUnavailableEngines, usbPhoneTakeoverEnabled } from "./feature-flags";+import { builtInBrowserEnabled, parseSkillReviewSteps, roomMemoryCaptureEnabled, savedStepsEnabled, shareLearnedSkillsMode, sharedComputersEnabled, showToolCallsEnabled, skillAuthoringEnabled, skillReviewEnabled, skillReviewSteps, skillReviewUnavailableEngines, suggestedRepliesEnabled, usbPhoneTakeoverEnabled } from "./feature-flags";describe("experimental feature flags", () => {it("keeps skill authoring on by default, before and after the config arrives", () => {@@ -97,4 +97,11 @@ describe("saved steps flag", () => {expect(savedStepsEnabled({ features: {} })).toBe(true);expect(savedStepsEnabled({ features: { savedSteps: false } })).toBe(false);});++ it("follows the server's suggested replies switch, and stays off with a server that doesn't report one", () => {+ expect(suggestedRepliesEnabled(null)).toBe(false);+ expect(suggestedRepliesEnabled({ features: {} })).toBe(false);+ expect(suggestedRepliesEnabled({ features: { suggestedReplies: true } })).toBe(true);+ expect(suggestedRepliesEnabled({ features: { suggestedReplies: false } })).toBe(false);+ });});diff --git a/src/lib/feature-flags.ts b/src/lib/feature-flags.tsindex 9d0366f82b..ad01aa078b 100644--- a/src/lib/feature-flags.ts+++ b/src/lib/feature-flags.ts@@ -1,7 +1,7 @@import { t } from "./i18n";export interface FeatureFlagConfig {- features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean; roomFeedSince?: number; teamBoard?: boolean };+ features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean; roomFeedSince?: number; teamBoard?: boolean; suggestedReplies?: boolean };browserEngine?: { kind: "engine" | "unavailable"; reason?: string; installable?: boolean; installing?: boolean; installError?: string };}@@ -102,6 +102,12 @@ export function skillBurgerEnabled(config: FeatureFlagConfig | null | undefined)return config?.features?.skillBurger !== false;}+/** A faded next-line suggestion in an empty composer after a bot replies. The server reports it on unless switched off; a+ * server that doesn't report it has no suggestions to give. */+export function suggestedRepliesEnabled(config: FeatureFlagConfig | null | undefined): boolean {+ return config?.features?.suggestedReplies === true;+}+export function threadTabsEnabled(config: FeatureFlagConfig | null | undefined): boolean {return config?.features?.threadTabs === true;}diff --git a/src/lib/use-feature.ts b/src/lib/use-feature.tsindex 18f5852b7a..02fada5c29 100644--- a/src/lib/use-feature.ts+++ b/src/lib/use-feature.ts@@ -1,14 +1,15 @@-import { skillBurgerEnabled, teamBoardEnabled, threadTabsEnabled } from "@/lib/feature-flags";+import { skillBurgerEnabled, suggestedRepliesEnabled, teamBoardEnabled, threadTabsEnabled } from "@/lib/feature-flags";import type { ConfigStatus } from "@/state/store";import { useStoreSelector } from "@/state/store-select";/** Switches on Settings → Features, kept in the place's config.json (`features.<name>`), so its server reads them too. */-export type Feature = "skillBurger" | "threadTabs" | "teamBoard";+export type Feature = "skillBurger" | "threadTabs" | "teamBoard" | "suggestedReplies";const FEATURES: Record<Feature, (config: ConfigStatus | null | undefined) => boolean> = {skillBurger: skillBurgerEnabled,threadTabs: threadTabsEnabled,teamBoard: teamBoardEnabled,+ suggestedReplies: suggestedRepliesEnabled,};/** Whether a switch on Settings → Features is on. */diff --git a/src/locales/de.json b/src/locales/de.jsonindex 45d879af22..fbf9c863e0 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -1243,6 +1243,11 @@"composer.placeholder.goalSolo": "Beschreib, was {name} fertigstellen soll","composer.placeholder.group": "Nachricht an {name} — {hint}","composer.placeholder.bot": "Nachricht an {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Vorgeschlagene Antwort übernehmen",+ "composer.suggestion.useShort": "Übernehmen",+ "composer.suggestion.hint": "Vorgeschlagene Antwort. Mit Tab übernehmen, mit Escape verwerfen.",+ "composer.suggestion.hintTouch": "Vorgeschlagene Antwort. Tippe auf Übernehmen, um sie einzufügen.","composer.hint.dm": "die Unterhaltung fortsetzen","composer.hint.everyone": "alle antworten","composer.hint.mentions": "@ holt einen Bot dazu",@@ -4450,6 +4455,8 @@"settings.features.skillBurgerLine": "Speichert den Lauf eines Bots als Schritte, die du erneut ausführen kannst","settings.features.threadTabs": "Thread-Tabs","settings.features.threadTabsLine": "Zeigt die Threads eines Bots als Tabs über dem Chat",+ "settings.features.suggestedReplies": "Antwortvorschläge",+ "settings.features.suggestedRepliesLine": "Schlägt nach einer Bot-Antwort vor, was du als Nächstes schreiben könntest. Die KI des Bots schreibt ihn mit ihrem kleinsten Modell, das verbraucht etwas von deinem Abo oder API-Guthaben.","composer.placeholder.newThread": "Einen Thread in {name} beginnen","room.feed.aria": "Threads in {name}","room.feed.replyOne": "1 Antwort",diff --git a/src/locales/en.json b/src/locales/en.jsonindex bcb44e53c5..8c71e40018 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -3188,6 +3188,11 @@"composer.placeholder.goalSolo": "Describe what {name} should finish","composer.placeholder.group": "Message {name} ({hint})","composer.placeholder.bot": "Message {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Use suggested reply",+ "composer.suggestion.useShort": "Use",+ "composer.suggestion.hint": "Suggested reply. Press Tab to use it or Escape to dismiss it.",+ "composer.suggestion.hintTouch": "Suggested reply. Tap Use to fill it in.","composer.hint.dm": "continue the conversation","composer.hint.everyone": "everyone responds","composer.hint.mentions": "@ to bring a bot in",@@ -12090,6 +12095,8 @@"settings.features.skillBurgerLine": "Save a bot's run as steps you can run again","settings.features.threadTabs": "Thread tabs","settings.features.threadTabsLine": "Show a bot's threads as tabs above the chat",+ "settings.features.suggestedReplies": "Suggested replies",+ "settings.features.suggestedRepliesLine": "After a bot replies, suggest what you might say next. The bot's own AI writes it with its smallest model, which uses a little of your plan or API credit.","composer.placeholder.newThread": "Start a thread in {name}","room.feed.aria": "Threads in {name}","room.feed.replyOne": "1 reply",diff --git a/src/locales/es.json b/src/locales/es.jsonindex 09d935a731..d65515e7c4 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -2139,6 +2139,11 @@"composer.placeholder.goalSolo": "Describe qué debe completar {name}","composer.placeholder.group": "Mensaje para {name}: {hint}","composer.placeholder.bot": "Mensaje para {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Usar respuesta sugerida",+ "composer.suggestion.useShort": "Usar",+ "composer.suggestion.hint": "Respuesta sugerida. Pulsa Tab para usarla o Escape para descartarla.",+ "composer.suggestion.hintTouch": "Respuesta sugerida. Toca Usar para escribirla.","composer.hint.dm": "continuar la conversación","composer.hint.everyone": "responden todos","composer.hint.mentions": "@ para traer a un bot",@@ -6634,6 +6639,8 @@"settings.features.skillBurgerLine": "Guarda la ejecución de un bot como pasos que puedes volver a ejecutar","settings.features.threadTabs": "Pestañas de hilos","settings.features.threadTabsLine": "Muestra los hilos de un bot como pestañas sobre el chat",+ "settings.features.suggestedReplies": "Respuestas sugeridas",+ "settings.features.suggestedRepliesLine": "Cuando un bot responde, sugiere lo que podrías decir después. La propia IA del bot la escribe con su modelo más pequeño, que consume un poco de tu plan o crédito de API.","settings.features.error": "No se pudo guardar. Revisa tu conexión e inténtalo de nuevo.","chat.botExchange.open": "Abrir el intercambio entre {asker} y {helper}","chat.botExchange.teammate": "Un compañero",diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex 78ed3bfae0..fd561b3d3f 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -1016,6 +1016,11 @@"composer.placeholder.goalSolo": "Décrivez ce que {name} doit terminer","composer.placeholder.group": "Message à {name} — {hint}","composer.placeholder.bot": "Message à {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Utiliser la réponse suggérée",+ "composer.suggestion.useShort": "Utiliser",+ "composer.suggestion.hint": "Réponse suggérée. Appuyez sur Tab pour l'utiliser ou sur Échap pour l'ignorer.",+ "composer.suggestion.hintTouch": "Réponse suggérée. Touchez Utiliser pour la saisir.","composer.hint.dm": "poursuivre la conversation","composer.hint.everyone": "tout le monde répond","composer.hint.mentions": "@ pour faire venir un bot",@@ -4047,6 +4052,8 @@"settings.features.skillBurgerLine": "Enregistre l'exécution d'un bot en étapes que tu peux relancer","settings.features.threadTabs": "Onglets de fils","settings.features.threadTabsLine": "Affiche les fils d'un bot en onglets au-dessus du chat",+ "settings.features.suggestedReplies": "Réponses suggérées",+ "settings.features.suggestedRepliesLine": "Après la réponse d'un bot, suggère ce que vous pourriez dire ensuite. L'IA du bot l'écrit avec son plus petit modèle, ce qui utilise un peu de votre forfait ou de votre crédit API.","settings.features.error": "Impossible d'enregistrer. Vérifie ta connexion et réessaie.","chat.botExchange.open": "Ouvrir l’échange entre {asker} et {helper}","chat.botExchange.teammate": "Un coéquipier",diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex 58b6142ec2..e79d63fcaf 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -1014,6 +1014,11 @@"composer.placeholder.goalSolo": "बताइए कि {name} को क्या पूरा करना है","composer.placeholder.group": "{name} को संदेश — {hint}","composer.placeholder.bot": "{name} को संदेश",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "सुझाया गया जवाब इस्तेमाल करें",+ "composer.suggestion.useShort": "इस्तेमाल करें",+ "composer.suggestion.hint": "सुझाया गया जवाब। इस्तेमाल करने के लिए Tab दबाएँ, हटाने के लिए Escape।",+ "composer.suggestion.hintTouch": "सुझाया गया जवाब। भरने के लिए इस्तेमाल करें पर टैप करें।","composer.hint.dm": "बातचीत जारी रखें","composer.hint.everyone": "सभी जवाब देते हैं","composer.hint.mentions": "किसी बॉट को बुलाने के लिए @",@@ -3899,6 +3904,8 @@"settings.features.skillBurgerLine": "किसी बॉट के रन को ऐसे चरणों के रूप में सहेजें जिन्हें आप फिर से चला सकें","settings.features.threadTabs": "थ्रेड टैब","settings.features.threadTabsLine": "चैट के ऊपर बॉट के थ्रेड टैब के रूप में दिखाएँ",+ "settings.features.suggestedReplies": "सुझाए गए जवाब",+ "settings.features.suggestedRepliesLine": "बॉट के जवाब के बाद सुझाता है कि आप आगे क्या कह सकते हैं। बॉट का अपना AI इसे अपने सबसे छोटे मॉडल से लिखता है, जिससे आपके प्लान या API क्रेडिट का थोड़ा हिस्सा खर्च होता है।","settings.features.error": "इसे सहेजा नहीं जा सका। अपना कनेक्शन जाँचें और फिर से कोशिश करें।","chat.botExchange.open": "{asker} और {helper} की बातचीत खोलें","chat.botExchange.teammate": "एक साथी",diff --git a/src/locales/it.json b/src/locales/it.jsonindex ffa0b2fcd3..66aae3e672 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -3151,6 +3151,11 @@"composer.placeholder.goalSolo": "Descrivi cosa {name} deve finire","composer.placeholder.group": "Messaggio a {name} — {hint}","composer.placeholder.bot": "Messaggio a {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Usa la risposta suggerita",+ "composer.suggestion.useShort": "Usa",+ "composer.suggestion.hint": "Risposta suggerita. Premi Tab per usarla o Esc per ignorarla.",+ "composer.suggestion.hintTouch": "Risposta suggerita. Tocca Usa per inserirla.","composer.hint.dm": "continua la conversazione","composer.hint.everyone": "rispondono tutti","composer.hint.mentions": "@ per far entrare un bot",@@ -11799,6 +11804,8 @@"settings.features.skillBurgerLine": "Salva l'esecuzione di un bot come passaggi da rieseguire","settings.features.threadTabs": "Schede dei thread","settings.features.threadTabsLine": "Mostra i thread di un bot come schede sopra la chat",+ "settings.features.suggestedReplies": "Risposte suggerite",+ "settings.features.suggestedRepliesLine": "Dopo la risposta di un bot, suggerisce cosa potresti dire dopo. La scrive l'IA del bot con il suo modello più piccolo, che usa un po' del tuo piano o credito API.","settings.features.error": "Impossibile salvare. Controlla la connessione e riprova.","chat.botExchange.open": "Apri lo scambio tra {asker} e {helper}","chat.botExchange.teammate": "Un collega",diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex f13627cbc4..50448b8b05 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -2593,6 +2593,11 @@"composer.placeholder.goalSolo": "{name} が仕上げる内容を書いてください","composer.placeholder.group": "{name} へのメッセージ — {hint}","composer.placeholder.bot": "{name} へのメッセージ",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "提案された返信を使う",+ "composer.suggestion.useShort": "使う",+ "composer.suggestion.hint": "提案された返信です。Tab で使い、Esc で閉じます。",+ "composer.suggestion.hintTouch": "提案された返信です。「使う」をタップすると入力されます。","composer.hint.dm": "会話を続けます","composer.hint.everyone": "全員が応答します","composer.hint.mentions": "@ でボットを呼びます",@@ -8170,6 +8175,8 @@"settings.features.skillBurgerLine": "ボットの実行を、もう一度実行できる手順として保存します","settings.features.threadTabs": "スレッドのタブ","settings.features.threadTabsLine": "ボットのスレッドをチャットの上にタブで表示します",+ "settings.features.suggestedReplies": "返信の提案",+ "settings.features.suggestedRepliesLine": "ボットの返信のあとに、次に送りそうな一言を提案します。ボット自身の AI がいちばん小さいモデルで書くため、プランや API クレジットを少し使います。","settings.features.error": "保存できませんでした。接続を確認して、もう一度お試しください。","chat.botExchange.open": "{asker} と {helper} のやり取りを開く","chat.botExchange.teammate": "チームメイト",diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex 651dae5d04..6e24f4d4c1 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -2482,6 +2482,11 @@"composer.placeholder.goalSolo": "{name}이(가) 끝낼 일을 설명하세요","composer.placeholder.group": "{name}에게 메시지 — {hint}","composer.placeholder.bot": "{name}에게 메시지",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "제안된 답장 사용",+ "composer.suggestion.useShort": "사용",+ "composer.suggestion.hint": "제안된 답장입니다. Tab을 눌러 사용하고 Esc를 눌러 닫습니다.",+ "composer.suggestion.hintTouch": "제안된 답장입니다. 사용을 탭하면 입력됩니다.","composer.hint.dm": "대화 이어 가기","composer.hint.everyone": "모두가 응답해요","composer.hint.mentions": "@로 봇 부르기",@@ -7861,6 +7866,8 @@"settings.features.skillBurgerLine": "봇의 실행을 다시 실행할 수 있는 단계로 저장해요","settings.features.threadTabs": "스레드 탭","settings.features.threadTabsLine": "봇의 스레드를 채팅 위에 탭으로 보여줘요",+ "settings.features.suggestedReplies": "답장 제안",+ "settings.features.suggestedRepliesLine": "봇이 답한 뒤 다음에 할 말을 제안합니다. 봇의 AI가 가장 작은 모델로 작성하므로 요금제나 API 크레딧을 조금 사용합니다.","settings.features.error": "저장하지 못했어요. 연결을 확인하고 다시 시도해 주세요.","chat.botExchange.open": "{asker}와 {helper}의 대화 열기","chat.botExchange.teammate": "팀원",diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex 66fd3a1339..99aa43a77c 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -2301,6 +2301,11 @@"composer.placeholder.goalSolo": "Opisz, co {name} ma zakończyć","composer.placeholder.group": "Wiadomość do bota {name} — {hint}","composer.placeholder.bot": "Wiadomość do bota {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Użyj proponowanej odpowiedzi",+ "composer.suggestion.useShort": "Użyj",+ "composer.suggestion.hint": "Proponowana odpowiedź. Naciśnij Tab, aby jej użyć, lub Escape, aby ją odrzucić.",+ "composer.suggestion.hintTouch": "Proponowana odpowiedź. Stuknij Użyj, aby ją wpisać.","composer.hint.dm": "kontynuuj rozmowę","composer.hint.everyone": "wszyscy odpowiadają","composer.hint.mentions": "@, aby dodać bota",@@ -7330,6 +7335,8 @@"settings.features.skillBurgerLine": "Zapisuje przebieg pracy bota jako kroki, które można uruchomić ponownie","settings.features.threadTabs": "Karty wątków","settings.features.threadTabsLine": "Pokazuje wątki bota jako karty nad czatem",+ "settings.features.suggestedReplies": "Proponowane odpowiedzi",+ "settings.features.suggestedRepliesLine": "Po odpowiedzi bota proponuje, co możesz napisać dalej. Pisze ją AI bota najmniejszym modelem, co zużywa trochę Twojego planu lub środków API.","settings.features.error": "Nie udało się zapisać. Sprawdź połączenie i spróbuj ponownie.","chat.botExchange.open": "Otwórz wymianę między {asker} a {helper}","chat.botExchange.teammate": "Członek zespołu",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 7bd9f57117..1d0f3fb71f 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -2970,6 +2970,11 @@"composer.placeholder.goalSolo": "Descreva o que {name} deve concluir","composer.placeholder.group": "Mensagem para {name} ({hint})","composer.placeholder.bot": "Mensagem para {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Usar resposta sugerida",+ "composer.suggestion.useShort": "Usar",+ "composer.suggestion.hint": "Resposta sugerida. Pressione Tab para usar ou Esc para descartar.",+ "composer.suggestion.hintTouch": "Resposta sugerida. Toque em Usar para preenchê-la.","composer.hint.dm": "continuar a conversa","composer.hint.everyone": "todos respondem","composer.hint.mentions": "@ para chamar um bot",@@ -12090,6 +12095,8 @@"settings.features.skillBurgerLine": "Salva a execução de um bot como etapas que você pode executar de novo","settings.features.threadTabs": "Abas de conversas","settings.features.threadTabsLine": "Mostra as conversas de um bot como abas acima do chat",+ "settings.features.suggestedReplies": "Respostas sugeridas",+ "settings.features.suggestedRepliesLine": "Depois que um bot responde, sugere o que você pode dizer em seguida. A própria IA do bot escreve com o menor modelo dela, o que usa um pouco do seu plano ou crédito de API.","composer.placeholder.newThread": "Comece uma conversa em {name}","room.feed.aria": "Conversas em {name}","room.feed.replyOne": "1 resposta",diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex 2d7d3d3a44..87b83ab71b 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -2334,6 +2334,11 @@"composer.placeholder.goalSolo": "Опишите, что {name} должен завершить","composer.placeholder.group": "Сообщение {name} — {hint}","composer.placeholder.bot": "Сообщение {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Использовать предложенный ответ",+ "composer.suggestion.useShort": "Использовать",+ "composer.suggestion.hint": "Предложенный ответ. Нажмите Tab, чтобы использовать, или Escape, чтобы скрыть.",+ "composer.suggestion.hintTouch": "Предложенный ответ. Нажмите «Использовать», чтобы вставить его.","composer.hint.dm": "продолжить переписку","composer.hint.everyone": "отвечают все","composer.hint.mentions": "@ чтобы подключить бота",@@ -7384,6 +7389,8 @@"settings.features.skillBurgerLine": "Сохраняет работу бота как шаги, которые можно запустить снова","settings.features.threadTabs": "Вкладки веток","settings.features.threadTabsLine": "Показывает ветки бота вкладками над чатом",+ "settings.features.suggestedReplies": "Предложенные ответы",+ "settings.features.suggestedRepliesLine": "После ответа бота предлагает, что вы можете написать дальше. Его пишет ИИ самого бота на самой маленькой модели, это немного расходует ваш тариф или кредит API.","settings.features.error": "Не удалось сохранить. Проверьте подключение и попробуйте ещё раз.","chat.botExchange.open": "Открыть обмен между {asker} и {helper}","chat.botExchange.teammate": "Коллега",diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex fbf32c2a8e..cd1fe48616 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -1845,6 +1845,11 @@"composer.placeholder.goalSolo": "{name} botunun neyi tamamlaması gerektiğini açıklayın","composer.placeholder.group": "{name} grubuna mesaj gönder — {hint}","composer.placeholder.bot": "{name} adlı bota mesaj gönder",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Önerilen yanıtı kullan",+ "composer.suggestion.useShort": "Kullan",+ "composer.suggestion.hint": "Önerilen yanıt. Kullanmak için Tab, kapatmak için Escape tuşuna basın.",+ "composer.suggestion.hintTouch": "Önerilen yanıt. Doldurmak için Kullan'a dokunun.","composer.hint.dm": "sohbete devam et","composer.hint.everyone": "herkes yanıt verir","composer.hint.mentions": "bir botu dahil etmek için @",@@ -6129,6 +6134,8 @@"settings.features.skillBurgerLine": "Bir botun çalışmasını yeniden çalıştırabileceğin adımlar olarak kaydeder","settings.features.threadTabs": "Konuşma sekmeleri","settings.features.threadTabsLine": "Bir botun konuşmalarını sohbetin üstünde sekmeler olarak gösterir",+ "settings.features.suggestedReplies": "Önerilen yanıtlar",+ "settings.features.suggestedRepliesLine": "Bir bot yanıt verdikten sonra sıradaki mesajınızı önerir. Botun kendi yapay zekâsı bunu en küçük modeliyle yazar; bu, planınızdan veya API kredinizden biraz kullanır.","settings.features.error": "Kaydedilemedi. Bağlantını kontrol edip tekrar dene.","chat.botExchange.open": "{asker} ile {helper} arasındaki konuşmayı aç","chat.botExchange.teammate": "Bir ekip arkadaşı",diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex 2472311001..43a49cdd79 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -1174,6 +1174,11 @@"composer.placeholder.goalSolo": "Опишіть, що {name} має завершити","composer.placeholder.group": "Повідомлення для {name} — {hint}","composer.placeholder.bot": "Повідомлення для {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Використати запропоновану відповідь",+ "composer.suggestion.useShort": "Використати",+ "composer.suggestion.hint": "Запропонована відповідь. Натисніть Tab, щоб використати, або Escape, щоб приховати.",+ "composer.suggestion.hintTouch": "Запропонована відповідь. Торкніться «Використати», щоб вставити її.","composer.hint.dm": "продовжити розмову","composer.hint.everyone": "відповідають усі","composer.hint.mentions": "@ щоб запросити бота",@@ -4316,6 +4321,8 @@"settings.features.skillBurgerLine": "Зберігає роботу бота як кроки, які можна запустити знову","settings.features.threadTabs": "Вкладки гілок","settings.features.threadTabsLine": "Показує гілки бота вкладками над чатом",+ "settings.features.suggestedReplies": "Запропоновані відповіді",+ "settings.features.suggestedRepliesLine": "Після відповіді бота пропонує, що ви можете написати далі. Її пише ШІ самого бота найменшою моделлю, це трохи витрачає ваш тариф або кредит API.","settings.features.error": "Не вдалося зберегти. Перевірте з'єднання і спробуйте ще раз.","chat.botExchange.open": "Відкрити обмін між {asker} і {helper}","chat.botExchange.teammate": "Колега",diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex 062f5b8daf..d61d01e84b 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -1845,6 +1845,11 @@"composer.placeholder.goalSolo": "Mô tả mục tiêu {name} cần hoàn thành","composer.placeholder.group": "Nhắn tin cho {name} — {hint}","composer.placeholder.bot": "Nhắn tin cho {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "Dùng câu trả lời gợi ý",+ "composer.suggestion.useShort": "Dùng",+ "composer.suggestion.hint": "Câu trả lời gợi ý. Nhấn Tab để dùng hoặc Escape để bỏ qua.",+ "composer.suggestion.hintTouch": "Câu trả lời gợi ý. Chạm Dùng để điền vào.","composer.hint.dm": "tiếp tục cuộc trò chuyện","composer.hint.everyone": "mọi người đều phản hồi","composer.hint.mentions": "@ để đưa bot vào",@@ -6129,6 +6134,8 @@"settings.features.skillBurgerLine": "Lưu một lần chạy của bot thành các bước bạn có thể chạy lại","settings.features.threadTabs": "Thẻ luồng","settings.features.threadTabsLine": "Hiển thị các luồng của bot thành thẻ phía trên khung chat",+ "settings.features.suggestedReplies": "Câu trả lời gợi ý",+ "settings.features.suggestedRepliesLine": "Sau khi bot trả lời, gợi ý điều bạn có thể nói tiếp. AI của chính bot viết nó bằng mô hình nhỏ nhất, dùng một ít gói hoặc tín dụng API của bạn.","settings.features.error": "Không thể lưu. Hãy kiểm tra kết nối rồi thử lại.","chat.botExchange.open": "Mở cuộc trao đổi giữa {asker} và {helper}","chat.botExchange.teammate": "Một đồng đội",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 8a4088f494..5de5a281b9 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -2759,6 +2759,11 @@"composer.placeholder.goalSolo": "描述 {name} 該完成什麼","composer.placeholder.group": "傳訊息給 {name}——{hint}","composer.placeholder.bot": "傳訊息給 {name}",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "使用建議回覆",+ "composer.suggestion.useShort": "使用",+ "composer.suggestion.hint": "建議回覆。按 Tab 使用,按 Esc 關閉。",+ "composer.suggestion.hintTouch": "建議回覆。輕點「使用」即可填入。","composer.hint.dm": "繼續對話","composer.hint.everyone": "所有人都會回應","composer.hint.mentions": "用 @ 邀請機器人加入",@@ -10463,6 +10468,8 @@"settings.features.skillBurgerLine": "把機器人的一次執行儲存為可再次執行的步驟","settings.features.threadTabs": "對話分頁","settings.features.threadTabsLine": "在聊天上方以分頁顯示機器人的對話",+ "settings.features.suggestedReplies": "建議回覆",+ "settings.features.suggestedRepliesLine": "機器人回覆後,建議你接下來可能要說的話。由機器人自己的 AI 用其最小的模型撰寫,會用掉少量方案或 API 額度。","settings.features.error": "無法儲存。請檢查連線後再試一次。","chat.botExchange.open": "開啟 {asker} 與 {helper} 的交流","chat.botExchange.teammate": "一位隊友",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex be6dd4189d..d7d800aab6 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -2852,6 +2852,11 @@"composer.placeholder.goalSolo": "描述 {name} 要完成什么","composer.placeholder.group": "给 {name} 发消息——{hint}","composer.placeholder.bot": "给 {name} 发消息",+ "composer.suggestion.key": "Tab",+ "composer.suggestion.use": "使用建议回复",+ "composer.suggestion.useShort": "使用",+ "composer.suggestion.hint": "建议回复。按 Tab 使用,按 Esc 关闭。",+ "composer.suggestion.hintTouch": "建议回复。轻点“使用”即可填入。","composer.hint.dm": "继续对话","composer.hint.everyone": "所有人都会回复","composer.hint.mentions": "用 @ 叫机器人加入",@@ -10375,6 +10380,8 @@"settings.features.skillBurgerLine": "把机器人的一次运行保存为可再次运行的步骤","settings.features.threadTabs": "对话标签页","settings.features.threadTabsLine": "在聊天上方以标签页显示机器人的对话",+ "settings.features.suggestedReplies": "建议回复",+ "settings.features.suggestedRepliesLine": "机器人回复后,建议你接下来可能要说的话。由机器人自己的 AI 用其最小的模型生成,会消耗少量套餐或 API 额度。","settings.features.error": "无法保存。请检查网络连接后重试。","chat.botExchange.open": "打开 {asker} 与 {helper} 的交流","chat.botExchange.teammate": "一位队友",diff --git a/src/state/config-status.ts b/src/state/config-status.tsindex 1c9dfd3c62..e0b88f5c49 100644--- a/src/state/config-status.ts+++ b/src/state/config-status.ts@@ -169,7 +169,7 @@ export interface ConfigStatus {/** What a paired phone calls this computer; "" uses the default. */computerName?: string;/** Opt-in flags. Absent means off. */- features?: { skillAuthoring: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean; roomFeedSince?: number; teamBoard?: boolean };+ features?: { skillAuthoring: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean; roomFeedSince?: number; teamBoard?: boolean; suggestedReplies?: boolean };/** First-run progress: whether the welcome tour was finished and which* one-time hints were dismissed. Server-owned so it follows the workspace. */onboarding?: OnboardingStatus;diff --git a/src/styles.css b/src/styles.cssindex 671d5c662b..51ffa1f8fa 100644--- a/src/styles.css+++ b/src/styles.css@@ -62,6 +62,9 @@.mention-editor[data-composing] textarea {color: var(--color-ink);}+.mention-editor[data-ghost] textarea::placeholder {+ color: transparent;+}.mention-editor textarea::selection {color: var(--color-ink);background: var(--color-raised-hover);@@ -73,7 +76,8 @@.mention-editor textarea { font-size: 16px; }}@media (forced-colors: active) {- .mention-editor-mirror { display: none; }+ .mention-editor-mirror, .mention-editor-ghost { display: none; }+ .mention-editor[data-ghost] textarea::placeholder { color: GrayText; }.mention-editor textarea, .mention-editor[data-composing] textarea { color: CanvasText; caret-color: CanvasText; }}