Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Start fresh: reset a chat's context from its actions menu
milind-sonia1d805b25669
diff --git a/docs/verification/images/start-fresh/start-fresh.png b/docs/verification/images/start-fresh/start-fresh.pngnew file mode 100644index 0000000000..9815fffd83Binary files /dev/null and b/docs/verification/images/start-fresh/start-fresh.png differdiff --git a/server/cloud-chat-merge.test.ts b/server/cloud-chat-merge.test.tsindex d88546f4d0..40caa1fb15 100644--- a/server/cloud-chat-merge.test.ts+++ b/server/cloud-chat-merge.test.ts@@ -61,6 +61,13 @@ describe("one conversation both have", () => {expect(mergeThread(thread(desktop), thread(after, first.leaf))).toMatchObject({ added: [], relinked: [], leaf: first.leaf });});+ it("carries a Start fresh divider across, so the next turn on the other computer stops at it too", () => {+ const desktop = [...shared, line("d1", 10, "m2"), line("fresh", 11, "d1", "bot", { kind: "compaction", compaction: { summary: "", firstKeptId: "", foldedThroughId: "d1", tokensBefore: 0, by: "person", fresh: true } }), line("d2", 12, "fresh", "bot")];+ const merged = mergeThread(thread(desktop), thread(shared));+ expect(merged.added.map((row) => row.id)).toEqual(["d1", "fresh", "d2"]);+ expect(merged.added.find((row) => row.id === "d2")?.parentId).toBe("fresh");+ });+it("keeps an edit branch this computer made as a branch, and its context summary stays behind with its children re-linked", () => {const desktop = [...shared, line("d1", 10, "m2"), line("summary", 11, "d1", "bot", { kind: "compaction" }), line("d2", 12, "summary", "bot"),line("edit", 13, "m2")];diff --git a/server/cloud-chat-merge.ts b/server/cloud-chat-merge.tsindex f4eadc1c06..8a2c9d71d6 100644--- a/server/cloud-chat-merge.ts+++ b/server/cloud-chat-merge.ts@@ -59,7 +59,7 @@ export function activePath(rows: readonly Message[], leaf: string | null): Messa/** A conversation's own context summary describes the other computer's session, so it is not added to one both have. */function withoutSummaries(thread: ThreadRows, have: ReadonlySet<string>): ThreadRows {- const dropped = new Map(thread.rows.filter((row) => !have.has(row.id) && row.kind === "compaction").map((row) => [row.id, row.parentId ?? null]));+ const dropped = new Map(thread.rows.filter((row) => !have.has(row.id) && row.kind === "compaction" && !row.compaction?.fresh).map((row) => [row.id, row.parentId ?? null]));if (!dropped.size) return thread;const above = (id: string | null) => { for (let hops = 0; id !== null && dropped.has(id) && hops <= dropped.size; hops++) id = dropped.get(id)!; return id; };return {diff --git a/server/cloud-team-bot-access.e2e.test.ts b/server/cloud-team-bot-access.e2e.test.tsindex b9f1816213..38844efebc 100644--- a/server/cloud-team-bot-access.e2e.test.ts+++ b/server/cloud-team-bot-access.e2e.test.ts@@ -117,6 +117,7 @@ describe("a team bot shared with a level per person", () => {["POST", `/api/bots/${payroll.id}/tasks`, { title: "Mine" }],["POST", `/api/bots/${payroll.id}/interrupt`, { threadId: payroll.threadId }],["POST", `/api/bots/${payroll.id}/compact`, { threadId: payroll.threadId }],+ ["POST", `/api/bots/${payroll.id}/start-fresh`, { threadId: payroll.threadId }],["POST", `/api/bots/${payroll.id}/respond`, { requestId: "x", behavior: "deny", threadId: payroll.threadId }],["POST", `/api/bots/${payroll.id}/messages/${lastLine}/edit`, { text: "Edited", threadId: payroll.threadId }],["POST", `/api/bots/${payroll.id}/always-allow`, { threadId: payroll.threadId, requestId: "x" }],diff --git a/server/fresh-start.e2e.test.ts b/server/fresh-start.e2e.test.tsnew file mode 100644index 0000000000..a3953942d9--- /dev/null+++ b/server/fresh-start.e2e.test.ts@@ -0,0 +1,128 @@+import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { expect, it } from "vitest";++import { launchVerificationServer, runControlOmb } from "../scripts/control-omb.ts";+import { request } from "../scripts/mcp-server.ts";+import type { WireMessage } from "../shared/wire.ts";+import { withoutTurnClock } from "./testing/turn-clock-text.ts";++const OLD = /OLD_SECRET_ALPHA|OLD_BETA_REPLY|OLD_DELTA_REPLY|OLD_GAMMA_MORE|Earlier conversation summary/;++async function setup(extraEnv: NodeJS.ProcessEnv) {+ const fixture = await launchVerificationServer({ ...process.env, ...extraEnv }, undefined, undefined, undefined, undefined, undefined, ["codex"]);+ const control = async (...args: string[]) => runControlOmb([...args, "--url", fixture.info.url]) as Promise<any>;+ const bot = (await control("new-bot", "--name", "Fresh probe")).bot;+ const thread: string = bot.activeTaskId;+ const api = (path: string, options: RequestInit = {}) => request(path, options, fixture.info.url);+ const messages = async () => (await api(`/api/threads/${thread}/messages?limit=200`) as { messages: WireMessage[] }).messages;+ const settled = async () => expect((await control("wait", "--bot", bot.id, "--task", thread, "--timeout", "30")).status).toBe("settled");+ const dump = () => JSON.parse(readFileSync(fixture.fixtureDumpPath, "utf8"));+ /** Set by a test while its turn must carry nothing from before the divider. */+ let oldLines = /(?!)/;+ const send = async (text: string) => {+ await control("send", "--bot", bot.id, "--task", thread, "--text", text);+ await settled();+ const sent = dump();+ const full = withoutTurnClock(String(sent.prompt.message.content));+ // Everything the provider got is checked (`full`); `prompt` is the line itself, under the reminder a new process opens with.+ expect(full).not.toMatch(oldLines);+ return { prompt: full.replace(/^<system-reminder>[\s\S]*?<\/system-reminder>\s*/, ""), full, pid: sent.pid as number, argv: sent.argv as string[] };+ };+ const startFresh = () => api(`/api/bots/${bot.id}/start-fresh`, { method: "POST", body: JSON.stringify({ threadId: thread }) });+ const close = async () => { try { await fixture.close(); } finally { expect(existsSync(fixture.info.dataDir)).toBe(false); } };+ const guard = () => { oldLines = OLD; };+ return { fixture, control, bot, thread, api, messages, settled, send, startFresh, guard, close };+}++it("sends the provider nothing from before the divider, while a warm session and the turn before it stay untouched", async () => {+ // The reply state keeps the scripted replies in order across the new process, so "OLD" only ever marks the turns before the divider.+ const dir = mkdtempSync(join(tmpdir(), "omb-fresh-start-"));+ const f = await setup({ FAKE_CLAUDE_REPLIES: JSON.stringify(["OLD_BETA_REPLY", "OLD_DELTA_REPLY", "after one", "after two", "after three"]), FAKE_CLAUDE_REPLY_STATE: join(dir, "replies") });+ try {+ const first = await f.send("OLD_SECRET_ALPHA remember this");+ expect(first.prompt).toBe("OLD_SECRET_ALPHA remember this");+ expect(first.argv).not.toContain("--resume");++ // Before the divider nothing changes: the warm process takes the turn, sent only the new line.+ const second = await f.send("OLD_GAMMA_MORE and this");+ expect(second.prompt).toBe("OLD_GAMMA_MORE and this");+ expect(second.pid).toBe(first.pid);++ // A summary written before the divider must not cross it either.+ await f.api(`/api/bots/${f.bot.id}/compact`, { method: "POST", body: JSON.stringify({ threadId: f.thread }) });+ await f.settled();+ expect((await f.messages()).some((m) => m.kind === "compaction" && m.compaction && !m.compaction.fresh)).toBe(true);++ f.guard();+ const reset = await f.startFresh() as { message: WireMessage | null };+ expect(reset.message?.compaction?.fresh).toBe(true);+ const shown = await f.messages();+ expect(shown.at(-1)?.compaction?.fresh).toBe(true);+ expect(shown.some((m) => m.text?.includes("OLD_SECRET_ALPHA"))).toBe(true);++ // The next turn is a new provider session, carrying only its own words.+ const third = await f.send("after the divider");+ expect(third.prompt).toBe("after the divider");+ expect(third.argv).not.toContain("--resume");+ expect(third.pid).not.toBe(first.pid);++ // After it, the new session continues normally.+ const fourth = await f.send("still fresh");+ expect(fourth.prompt).toBe("still fresh");+ expect(fourth.pid).toBe(third.pid);++ // A switched-in engine replays only what follows the divider.+ const codex = (await f.control("models")).instances.find((item: any) => item.instanceId === "codex");+ await f.api(`/api/bots/${f.bot.id}/tasks/${f.thread}`, { method: "PATCH", body: JSON.stringify({ modelSelection: { instanceId: "codex", model: codex.models.options[0].id }, requireAvailableModel: true }) });+ await f.control("send", "--bot", f.bot.id, "--task", f.thread, "--text", "now on another engine");+ await f.settled();+ const sent = readFileSync(join(f.fixture.info.dataDir, "native", `${f.thread}.ndjson`), "utf8").trim().split("\n").map((line) => JSON.parse(line)).findLast((entry) => entry.dir === "out" && entry.msg?.method === "turn/start");+ const joined = withoutTurnClock((sent.msg.params.input as Array<{ text?: string }>).map((part) => part.text ?? "").join("\n"));+ expect(joined).toContain("User: after the divider");+ expect(joined).toContain("User: still fresh");+ expect(joined).not.toMatch(OLD);+ expect(joined.endsWith("now on another engine")).toBe(true);++ // A summary written after the divider covers only what follows it.+ await f.api(`/api/bots/${f.bot.id}/compact`, { method: "POST", body: JSON.stringify({ threadId: f.thread }) });+ await f.settled();+ const newest = (await f.messages()).findLast((m) => m.kind === "compaction" && !m.compaction?.fresh)!;+ expect(newest.compaction?.summary).toMatch(/after the divider|after one/);+ expect(newest.compaction?.summary).not.toMatch(OLD);+ } finally { await f.close(); rmSync(dir, { recursive: true, force: true }); }+}, 120_000);++it("does not resume the old session when the engine process has already exited", async () => {+ const f = await setup({ FAKE_CLAUDE_EXIT_AFTER_TURN: "1" });+ try {+ const first = await f.send("OLD_SECRET_ALPHA remember this");+ const second = await f.send("OLD_GAMMA_MORE and this");+ // Before the divider a cold turn resumes, as it always has.+ expect(second.argv).toContain("--resume");+ expect(second.prompt).toBe("OLD_GAMMA_MORE and this");+ expect(second.pid).not.toBe(first.pid);++ f.guard();+ await f.startFresh();+ const third = await f.send("after the divider");+ expect(third.prompt).toBe("after the divider");+ expect(third.argv).not.toContain("--resume");+ } finally { await f.close(); }+}, 120_000);++it("refuses while a turn is running, and a repeat press adds nothing", async () => {+ const f = await setup({ FAKE_CLAUDE_MODE: "hang" });+ try {+ await f.control("send", "--bot", f.bot.id, "--task", f.thread, "--text", "stuck turn");+ await expect.poll(async () => (await f.api(`/api/bots`) as { bots: Array<{ id: string; busy: boolean }> }).bots.find((b) => b.id === f.bot.id)?.busy, { timeout: 20_000 }).toBe(true);+ await expect(f.startFresh()).rejects.toThrow(/409|stop it before starting fresh/);+ await f.api(`/api/bots/${f.bot.id}/interrupt`, { method: "POST", body: JSON.stringify({ threadId: f.thread }) });+ await expect.poll(async () => (await f.api(`/api/bots`) as { bots: Array<{ id: string; busy: boolean }> }).bots.find((b) => b.id === f.bot.id)?.busy, { timeout: 20_000 }).toBe(false);++ await f.startFresh();+ expect(((await f.startFresh()) as { message: unknown }).message).toBeNull();+ expect((await f.messages()).filter((m) => m.compaction?.fresh)).toHaveLength(1);+ } finally { await f.close(); }+}, 90_000);diff --git a/server/fresh-start.test.ts b/server/fresh-start.test.tsnew file mode 100644index 0000000000..a0d5ae9738--- /dev/null+++ b/server/fresh-start.test.ts@@ -0,0 +1,68 @@+import { describe, expect, it } from "vitest";++import { isFreshStart, sinceFreshStart, startFresh } from "./fresh-start.ts";+import { Store, type Message } from "./store.ts";++const ids = (rows: readonly { id: string }[]) => rows.map((row) => row.id);+const row = (id: string, extra: Partial<Message> = {}): Message => ({ id, at: 1, parentId: null, role: "user", kind: "text", text: id, ...extra });+const divider = (id: string) => row(id, { role: "bot", kind: "compaction", compaction: { summary: "", firstKeptId: "", foldedThroughId: "x", tokensBefore: 0, by: "person", fresh: true } });+const summary = (id: string) => row(id, { role: "bot", kind: "compaction", compaction: { summary: "s", firstKeptId: "", foldedThroughId: "x", tokensBefore: 0, by: "harness" } });++describe("the divider's slice of a conversation", () => {+ it("is the whole path with no divider, and only what follows the newest one otherwise", () => {+ expect(ids(sinceFreshStart([row("a"), row("b")]))).toEqual(["a", "b"]);+ expect(ids(sinceFreshStart([row("a"), divider("d1"), row("b"), divider("d2"), row("c")]))).toEqual(["c"]);+ expect(ids(sinceFreshStart([row("a"), divider("d")]))).toEqual([]);+ });+ it("tells a divider from a context summary", () => {+ expect(isFreshStart(divider("d"))).toBe(true);+ expect(isFreshStart(summary("s"))).toBe(false);+ expect(ids(sinceFreshStart([row("a"), summary("s"), row("b")]))).toEqual(["a", "s", "b"]);+ });+});++describe("starting fresh", () => {+ const setup = () => {+ const store = new Store(() => ({ instanceId: "fixture", model: "fixture-model" }));+ const bot = store.createBot({ name: "Ava", description: "Kind words" }, { seedMessages: false });+ store.appendMessage(bot.threadId, { role: "user", kind: "text", text: "first", at: 1 });+ store.appendMessage(bot.threadId, { role: "bot", kind: "text", text: "second", at: 2 });+ return { store, bot };+ };++ it("clears what the next turn would resume, and leaves the bot's own setup alone", () => {+ const { store, bot } = setup();+ store.patchTask(bot.id, bot.threadId, { resumeCursors: { claude: "old-session" }, appliedCompactionId: "c", contextFloor: 9, lastContextModel: "claude:m",+ usage: { input: 5, output: 7, costUsd: 0.1, turns: 2, context: { tokens: 90_000, window: 100_000 } } });+ const setupBefore = JSON.stringify({ ...store.bot(bot.id)!, tasks: undefined, messages: undefined, threadId: undefined, activeLeafId: undefined, rewound: undefined, resumeCursors: undefined, unread: undefined, updatedAt: undefined, usage: undefined });++ const written = startFresh(store, bot.id, bot.threadId)!;+ expect(written).toMatchObject({ role: "bot", kind: "compaction", compaction: { summary: "", by: "person", fresh: true } });++ const task = store.taskByThread(bot.id, bot.threadId)!;+ expect(task).toMatchObject({ rewound: true, resumeCursors: {}, appliedCompactionId: undefined, contextFloor: undefined, lastContextModel: undefined });+ expect(task.usage).toMatchObject({ input: 5, output: 7, turns: 2 });+ expect(task.usage?.context).toBeUndefined();+ expect(sinceFreshStart(store.activePath(bot.threadId))).toEqual([]);+ expect(store.messagesFor(bot.threadId).map((m) => m.text ?? "")).toEqual(["first", "second", ""]);+ expect(JSON.stringify({ ...store.bot(bot.id)!, tasks: undefined, messages: undefined, threadId: undefined, activeLeafId: undefined, rewound: undefined, resumeCursors: undefined, unread: undefined, updatedAt: undefined, usage: undefined })).toBe(setupBefore);+ });++ it("adds one divider however many times it is pressed, and still clears the cursor", () => {+ const { store, bot } = setup();+ startFresh(store, bot.id, bot.threadId);+ store.patchTask(bot.id, bot.threadId, { resumeCursors: { claude: "stale" } });+ expect(startFresh(store, bot.id, bot.threadId)).toBeNull();+ expect(store.taskByThread(bot.id, bot.threadId)?.resumeCursors).toEqual({});+ expect(store.activePath(bot.threadId).filter(isFreshStart)).toHaveLength(1);+ });++ it("survives a restart", () => {+ const { store, bot } = setup();+ startFresh(store, bot.id, bot.threadId);+ const later = store.appendMessage(bot.threadId, { role: "user", kind: "text", text: "third", at: 3 });+ const reopened = new Store(() => ({ instanceId: "fixture", model: "fixture-model" }));+ expect(ids(sinceFreshStart(reopened.activePath(bot.threadId)))).toEqual([later.id]);+ expect(reopened.taskByThread(bot.id, bot.threadId)?.rewound).toBe(true);+ });+});diff --git a/server/fresh-start.ts b/server/fresh-start.tsnew file mode 100644index 0000000000..cbc0bc8b45--- /dev/null+++ b/server/fresh-start.ts@@ -0,0 +1,33 @@+// Start fresh: the next turn of a conversation opens a new engine session, with no earlier message. The messages stay on+// screen; a provider reads only what comes after the newest divider row, which lives on the active path so it survives a+// restart and an engine switch. The bot's instructions, skills, memory and settings are not touched.+import type { Message, Store } from "./store.ts";++export function isFreshStart(message: Pick<Message, "kind" | "compaction">): boolean {+ return message.kind === "compaction" && message.compaction?.fresh === true;+}++/** The part of a conversation path a provider may read: everything after the newest divider. */+export function sinceFreshStart<T extends Pick<Message, "kind" | "compaction">>(path: readonly T[]): T[] {+ return path.slice(path.findLastIndex(isFreshStart) + 1);+}++type FreshStartStore = Pick<Store, "activePath" | "appendMessage" | "patchTask" | "taskByThread">;++/** Writes the session state first: a divider with the old session still resumable would look fresh and not be. `rewound`+ * makes the next turn send sessionReset, so a process kept warm for this thread is closed rather than reused. */+export function startFresh(store: FreshStartStore, botId: string, threadId: string): Message | null {+ const task = store.taskByThread(botId, threadId);+ if (!task) return null;+ store.patchTask(botId, threadId, {+ rewound: true, resumeCursors: {}, appliedCompactionId: undefined, contextFloor: undefined, lastContextModel: undefined,+ ...(task.usage ? { usage: { ...task.usage, context: undefined } } : {}),+ });+ const path = store.activePath(threadId);+ const newest = path.at(-1);+ if (!newest || isFreshStart(newest)) return null;+ return store.appendMessage(threadId, {+ role: "bot", kind: "compaction",+ compaction: { summary: "", firstKeptId: "", foldedThroughId: newest.id, tokensBefore: 0, by: "person", fresh: true },+ });+}diff --git a/server/host/warm-summary-host.ts b/server/host/warm-summary-host.tsindex 0eb5545f89..4909719709 100644--- a/server/host/warm-summary-host.ts+++ b/server/host/warm-summary-host.ts@@ -12,6 +12,7 @@// OpenMausBot's fold.import type { IdleCompactResult } from "../contracts.ts";import { isContextMessage, type HandedState } from "../delta-context.ts";+import { sinceFreshStart } from "../fresh-start.ts";import { wakeHoldOf } from "../routine-due.ts";import type { Routine, RoutineRun } from "../routines.ts";import { serverLine } from "../server-lines.ts";@@ -99,14 +100,14 @@ export function createWarmSummaryHost(deps: WarmSummaryHostDeps) {const compact = deps.instance(instanceId)?.adapter.cacheKeepWarm?.compact;const session = store.taskByThread(botId, threadId)?.resumeCursors[instanceId];if (!compact || typeof session !== "string") return { ok: false, reason: "the conversation has no session to summarize" };- const result = await compact(threadId, { instructions: summaryInstructions(store.activePath(threadId)), session, signal: control.signal });+ const result = await compact(threadId, { instructions: summaryInstructions(sinceFreshStart(store.activePath(threadId))), session, signal: control.signal });if (!result.ok) return { ok: false, reason: result.reason, retry: result.busy === true && !control.signal.aborted };deps.book(target, result);// Applied only to the conversation as it was: on the same session, and with no turn begun since (but the one waiting).const task = store.taskByThread(botId, threadId);if (task?.resumeCursors[instanceId] !== result.sessionBefore) return { ok: false, reason: "the conversation moved to another session" };if (control.signal.aborted || (!control.awaited() && deps.busy(botId, threadId))) return { ok: false, reason: "a turn started while summarizing" };- const { state, exchanges } = keptAfterSummary(store.activePath(threadId), result.session, task.handedMessages?.[instanceId]);+ const { state, exchanges } = keptAfterSummary(sinceFreshStart(store.activePath(threadId)), result.session, task.handedMessages?.[instanceId]);store.setResumeCursor(botId, instanceId, result.session, threadId);store.setHandedMessages(botId, threadId, instanceId, state);store.appendMessage(threadId, { role: "bot", kind: "activity", tool: { name: serverLine(deps.language?.(threadId), "server.warmSummary.summarized"), ok: true } });diff --git a/server/index.ts b/server/index.tsindex adb892452a..11005656d5 100644--- a/server/index.ts+++ b/server/index.ts@@ -331,7 +331,7 @@ import { createTtsRoutes } from "./routes/tts.ts";import { turnStartLogLine } from "./turn-log.ts";import { TurnStops, outwardActions, stoppedTurnOutcome, turnEvidence } from "./turn-outcome.ts";import { buildRecoveryText, buildTurnContext, engineIsFresh, replaysNatively } from "./turn-context.ts";-import { Handoffs, handedStateUsable, isContextMessage, recordHanded, renderUnseen, sessionStart, unseenMessages, withUnseenMessages, type ContextMessage } from "./delta-context.ts";+import { Handoffs, handedStateUsable, isContextMessage, recordHanded, renderUnseen, sessionStart, unseenMessages, withUnseenMessages, type ContextMessage } from "./delta-context.ts"; import { isFreshStart, sinceFreshStart } from "./fresh-start.ts";import { extractReplayImages, extractTurnImages, videoFramesWithin } from "./turn-images.ts";import { callTitleExcerpt } from "./thread-title.ts";import { generateThreadTitle, llmThreadTitlesEnabled } from "./thread-title-generate.ts";@@ -5460,7 +5460,7 @@ function ingestEngineHook(capability: InternalCapability, body: unknown): { ok:if (name === "SessionStart") {if (payload.source !== "compact") return { ok: true, ignored: `SessionStart ${String(payload.source ?? "")}` };const bot = store.bot(capability.botId);- const digests = store.activePath(threadId).filter((m) => m.kind === "digest" && m.digest).slice(-DIGESTS_AFTER_COMPACTION);+ const digests = sinceFreshStart(store.activePath(threadId)).filter((m) => m.kind === "digest" && m.digest).slice(-DIGESTS_AFTER_COMPACTION);chip(`context compacted — re-sent the last ${digests.length} digest${digests.length === 1 ? "" : "s"}`);if (!digests.length) return { ok: true };const context = digests.map((m) => digestPromptLine(m.digest!, m.from?.name ?? store.bot(m.digest!.botId)?.name ?? bot?.name ?? "the bot")).join("\n");@@ -7000,7 +7000,7 @@ function markTaskContextExternallyUpdated(bot: BotRecord, threadId: string): voi}function latestCompaction(messages: readonly Message[]) {- const record = messages.findLast(message => message.kind === "compaction" && message.compaction);+ const record = messages.findLast(message => message.kind === "compaction" && message.compaction && !isFreshStart(message));return record?.compaction ? { ...record.compaction, id: record.id } : undefined;}@@ -7036,7 +7036,7 @@ async function compactConversation(input: {const { bot, threadId, generation, instance, model, excludedIds, manual, idle } = input;const task = store.taskByThread(bot.id, threadId);if (!task || (!manual && cfg.context?.autoCompact === false)) return;- const messages = store.activePath(threadId);+ const messages = sinceFreshStart(store.activePath(threadId));const context = directContext(bot, threadId, messages);const record = latestCompaction(messages);// A retry must apply the existing record before considering another fold.@@ -7072,7 +7072,7 @@ async function compactConversation(input: {const summary = await draftSummary(fold.folded, { signal: controller.signal, generateText: sideJobs.text("compaction", bot.id, { instance })?.generateText });if (!idle && !directTurnClaimIsCurrent(bot.id, generation, threadId)) throw new DirectTurnSetupCancelled("context summarization stopped");controller.signal.throwIfAborted();- if (prefix !== JSON.stringify(store.activePath(threadId).slice(0, messages.length))) {+ if (prefix !== JSON.stringify(sinceFreshStart(store.activePath(threadId)).slice(0, messages.length))) {if (manual) throw new Error("the conversation changed during summarization — please retry");return;}@@ -7087,7 +7087,7 @@ async function compactConversation(input: {}const handoffs = new Handoffs({- order: (threadId) => store.activePath(threadId).filter(isContextMessage).map((m) => m.id),+ order: (threadId) => sinceFreshStart(store.activePath(threadId)).filter(isContextMessage).map((m) => m.id),read: (botId, threadId, instanceId) => store.taskByThread(botId, threadId)?.handedMessages?.[instanceId],write: (botId, threadId, instanceId, state) => store.setHandedMessages(botId, threadId, instanceId, state),replies: (threadId, turnId) => store.activePath(threadId)@@ -7809,7 +7809,7 @@ async function beginTurn(return;}const skipTranscript = new Set<string>([userMessage.id, ...(opts?.excludeMessageIds ?? [])]);- const activeMessages = store.activePath(threadId);+ const activeMessages = sinceFreshStart(store.activePath(threadId));const coordinationChildren = opts?.coordination?.resumed? new Set(coordinator.children(opts.coordination.id).map((child) => child.id)) : undefined;for (const m of activeMessages) {@@ -12469,7 +12469,7 @@ function liveBotFor(botId: string): LiveBot {return { name: bot.name, title: bot.title, description: bot.description };}function liveHistoryFor(threadId: string): LiveHistoryMessage[] {- return liveHistoryFrom(store.activePath(threadId));+ return liveHistoryFrom(sinceFreshStart(store.activePath(threadId)));}/** A signed-out or removed person's call must not keep reaching the bot or spending the key. */function liveSignedIn(auth: RequestAuth): boolean {@@ -15469,7 +15469,7 @@ for (const row of chatFollowups()) {...(row.kind === "bot" ? spokenLineFields(row.payload.via, row.payload.callId) : {}),});const recoveredTask = row.kind !== "channel" ? store.taskByThread(row.ownerId, row.threadId) : undefined;- const order = store.activePath(row.threadId).filter(isContextMessage).map((m) => m.id);+ const order = sinceFreshStart(store.activePath(row.threadId)).filter(isContextMessage).map((m) => m.id);for (const [instanceId, state] of Object.entries(recoveredTask?.handedMessages ?? {})) {if (state.session !== undefined) store.setHandedMessages(row.ownerId, row.threadId, instanceId, recordHanded(state, order, [recovered.id]));}diff --git a/server/request-auth.ts b/server/request-auth.tsindex b4e677282d..b858979490 100644--- a/server/request-auth.ts+++ b/server/request-auth.ts@@ -348,6 +348,7 @@ export const CLIENT_ALLOW: ReadonlyArray<{ methods: readonly string[]; path: Reg{ 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$/ },{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/compact$/ },+ { methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/start-fresh$/ },{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/helper-followup$/ }, // MausBot's own person only: see mayFollowUp{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/interrupt$/ },{ methods: ["POST"], path: /^\/api\/bots\/[\w-]+\/read$/ },diff --git a/server/routes/bot-messages.ts b/server/routes/bot-messages.tsindex 12d48a16e0..d576f0eaf2 100644--- a/server/routes/bot-messages.ts+++ b/server/routes/bot-messages.ts@@ -35,6 +35,7 @@ import { extractSteerImages } from "../turn-images.ts";import { followupFacts, helperFollowup, helperFollowupBody, mayFollowUp } from "../helper-followup.ts";import type { UsageTrigger } from "../usage-ledger.ts";import { noteTypedSend } from "../typed-sends.ts";+import { startFresh } from "../fresh-start.ts";import { parseMentionPicks } from "../../shared/room-mentions.ts";import { pinnedClientThreadGuard } from "./pinned-client-thread.ts";import { refusalBody, userError } from "../user-errors.ts";@@ -53,7 +54,7 @@ type Behavior = "allow" | "deny" | "answer";export interface BotMessageRouteDeps {store: Pick<Store,- | "activeLeaf" | "appendMessage" | "bot" | "botByThread" | "bots" | "groupByThread" | "messagesFor"+ | "activeLeaf" | "activePath" | "appendMessage" | "bot" | "botByThread" | "bots" | "groupByThread" | "messagesFor"| "patchMessage" | "patchTask" | "projectBotForTask" | "setActiveLeaf" | "setTaskAskedAt" | "taskByThread" | "tasks">;registry: Pick<ProviderRegistry, "get">;/** On a team: the words for a turn with no AI to answer with, having told who can connect one. */@@ -468,6 +469,19 @@ export function createBotMessageRoutes(deps: BotMessageRouteDeps): RouteHandlerreturn json(res, 202, { ok: true, threadId: bot.threadId });}+ m = path.match(/^\/api\/bots\/([\w-]+)\/start-fresh$/);+ if (m && method === "POST") {+ const body = await readBody(req);+ requirePinnedClientThread(m[1], body?.threadId);+ const bot = requestedTaskBot(m[1], body?.threadId);+ const notYours = cloudThreadRefusal(auth, bot.threadId);+ if (notYours) return json(res, 403, { error: notYours });+ // Synchronous from here: startTurn flips busy before the next request, so a turn cannot slip past this check.+ if (threadBusy(bot.id, bot.threadId)) return json(res, 409, userError("serverError.chat.busyFresh"));+ if (phoneSecretSubmissions.hasThread(bot.threadId)) return json(res, 409, userError("serverError.chat.savingCredential"));+ return json(res, 200, { ok: true, message: startFresh(store, bot.id, bot.threadId), threadId: bot.threadId });+ }+m = path.match(/^\/api\/bots\/([\w-]+)\/messages\/([\w-]+)\/edit$/);if (m && method === "POST") {const messageId = m[2];diff --git a/server/store.ts b/server/store.tsindex 71601fd75c..90eb8f03ce 100644--- a/server/store.ts+++ b/server/store.ts@@ -106,7 +106,7 @@ const ASK_NOW = { approvalMode: "ask" as const, autoApprove: false, alwaysAllow:const TASK_PATCH_FIELDS = ["title", "projectId", "modelSelection", "approvalMode", "autoApprove", "alwaysAllow","unread", "lastReadMessageId", "rewound", "archivedAt", "pinned", "pinnedMessageId", "resumeCursors", "lastInstanceId", "cwd",- "routineRunId", "surface", "surfaceSource", "snoozedUntil", "link", "linkAuto", "appliedCompactionId", "contextFloor", "lastContextModel", "setupRequest", "botApi", "outside",+ "routineRunId", "surface", "surfaceSource", "snoozedUntil", "link", "linkAuto", "appliedCompactionId", "contextFloor", "lastContextModel", "usage", "setupRequest", "botApi", "outside",] as const satisfies readonly (keyof TaskRecord)[];export type TaskPatch = Partial<Pick<TaskRecord, typeof TASK_PATCH_FIELDS[number]>>;diff --git a/server/user-errors.ts b/server/user-errors.tsindex 8ba9da7fa1..42133311bb 100644--- a/server/user-errors.ts+++ b/server/user-errors.ts@@ -21,6 +21,7 @@ export const USER_ERROR = {"serverError.model.accountUpdating": "this provider account is being updated — try again shortly","serverError.chat.busyEdit": "the thread is working — stop it before editing","serverError.chat.busyVersion": "the thread is working — stop it before switching versions",+ "serverError.chat.busyFresh": "the thread is working — stop it before starting fresh","serverError.chat.questionGone": "this question is no longer available","serverError.chat.askerGone": "the bot that asked this question is no longer available","serverError.chat.routineElsewhere": "this bot is running a routine in another conversation",diff --git a/shared/wire.ts b/shared/wire.tsindex bffaf851be..46f21daebf 100644--- a/shared/wire.ts+++ b/shared/wire.ts@@ -463,7 +463,7 @@ export interface WireMessage extends ServerTextLine, HelperIntroField, SetupCardfirstKeptId: string;foldedThroughId: string;tokensBefore: number;- by: "person" | "harness";+ by: "person" | "harness"; /** The divider "Start fresh" leaves: no summary, and a provider reads nothing before it. */ fresh?: true;};/** Renderers receive only the allowlisted /api/attachments URL. `file` entries are opened through the message-scoped* file route, never by path. `source`: a bot attach-file copy's original path on the server, for Show in folder.diff --git a/src/components/BotSettingsDialog.simple.test.ts b/src/components/BotSettingsDialog.simple.test.tsindex 0a7f488448..a7e060d126 100644--- a/src/components/BotSettingsDialog.simple.test.ts+++ b/src/components/BotSettingsDialog.simple.test.ts@@ -657,7 +657,7 @@ describe("the Details tab", () => {it("lists Find, Activity and the Inspector for this conversation as rows that run them, leaving Copy and Download to Share", () => {const rendered = botTab(makeBot());- expect([...rendered.html.matchAll(/data-panel-item="(\w+)"/g)].map((match) => match[1])).toEqual(["find", "activity", "inspector"]);+ expect([...rendered.html.matchAll(/data-panel-item="([\w-]+)"/g)].map((match) => match[1])).toEqual(["find", "start-fresh", "activity", "inspector"]);expect(rendered.html).toContain(">Find in conversation<");const run = (key: string) => (rendered.nodes.find((node) => (node.props.item as { key?: string } | undefined)?.key === key)!.props.item as { onSelect: () => void }).onSelect();run("activity");diff --git a/src/components/ChatMoreMenu.test.ts b/src/components/ChatMoreMenu.test.tsindex 4a3bc84581..b52156130d 100644--- a/src/components/ChatMoreMenu.test.ts+++ b/src/components/ChatMoreMenu.test.ts@@ -11,6 +11,7 @@ const fixture = vi.hoisted(() => {threadsChosen: true,menus: [] as { ariaLabel: string; items: SidebarMenuItem[]; placement?: string; openOnHover?: boolean; trigger: string }[],dispatch: vi.fn(),+ run: vi.fn(),inspectorOpen: false,find: vi.fn(),};@@ -25,6 +26,7 @@ vi.mock("@/lib/chat-find", async (importOriginal) => ({...await importOriginal<typeof import("@/lib/chat-find")>(),requestChatFind: fixture.find,}));+vi.mock("./ContextWarning", () => ({ useContextAction: () => ({ pending: false, run: fixture.run }) }));vi.mock("./SidebarPopoverMenu", async (importOriginal) => ({...await importOriginal<typeof import("./SidebarPopoverMenu")>(),SidebarPopoverMenu: (props: { ariaLabel: string; items: SidebarMenuItem[]; placement?: string; openOnHover?: boolean; renderTrigger: (state: { open: boolean }) => React.ReactNode }) => {@@ -81,7 +83,7 @@ describe("ChatMoreMenu, the round ⋯ for the bot panel", () => {it("offers threads in Simple mode, and Usage and the Inspector unlocked", () => {const menu = menuOf(createElement(ChatMoreMenu, { bot }));- expect(keys(menu.items)).toEqual(["find", "new-thread", "threads", "copy", "download", "activity", "inspector"]);+ expect(keys(menu.items)).toEqual(["find", "new-thread", "threads", "start-fresh", "copy", "download", "activity", "inspector"]);for (const item of menu.items) {expect(item.disabled, item.key).toBeFalsy();expect(item.heading ?? "", item.key).not.toBe("In Advanced mode");@@ -90,6 +92,20 @@ describe("ChatMoreMenu, the round ⋯ for the bot panel", () => {expect(menu.items.find((item) => item.key === "inspector")?.separatorBefore).toBe(false);});+ it("starts the open conversation fresh with one press, and not while it is working or already fresh", () => {+ const item = menuOf(createElement(ChatMoreMenu, { bot })).items.find((one) => one.key === "start-fresh")!;+ expect(item.disabled).toBe(false);+ item.onSelect();+ expect(fixture.run).toHaveBeenCalledWith("/api/bots/pepper/start-fresh", { threadId: "side" });++ const busy = menuOf(createElement(ChatMoreMenu, { bot: { ...bot, tasks: bot.tasks!.map((one) => one.threadId === "side" ? { ...one, busy: true } : one) } })).items.find((one) => one.key === "start-fresh")!;+ expect(busy).toMatchObject({ disabled: true, title: "Stop this bot's turn first" });++ const fresh = { ...bot, messages: [...bot.messages!, { id: "d", role: "bot" as const, kind: "compaction" as const, at: 2, parentId: "hi",+ compaction: { summary: "", firstKeptId: "", foldedThroughId: "hi", tokensBefore: 0, by: "person" as const, fresh: true as const } }], activeLeafId: "d" };+ expect(menuOf(createElement(ChatMoreMenu, { bot: fresh })).items.find((one) => one.key === "start-fresh")!.disabled).toBe(true);+ });+it("starts a new thread with the bot", () => {const menu = menuOf(createElement(ChatMoreMenu, { bot }));menu.items.find((item) => item.key === "new-thread")!.onSelect();@@ -117,7 +133,7 @@ describe("ChatMoreMenu, the round ⋯ for the bot panel", () => {it("leaves All threads out while the bot has one thread", () => {const single = { ...bot, threadId: "main", tasks: [task("main", "Our chat", 1), task("routine", "Morning digest", 5, { routineRunId: "run-1" })] };- expect(keys(menuOf(createElement(ChatMoreMenu, { bot: single })).items)).toEqual(["find", "new-thread", "copy", "download", "activity", "inspector"]);+ expect(keys(menuOf(createElement(ChatMoreMenu, { bot: single })).items)).toEqual(["find", "new-thread", "start-fresh", "copy", "download", "activity", "inspector"]);expect(keys(menuOf(createElement(ChatMoreMenu, { bot: { ...bot, tasks: undefined } })).items)).not.toContain("threads");});@@ -155,7 +171,7 @@ describe("ChatHeaderMenu, Advanced mode's header ⋯", () => {it("keeps main's items, trigger and hover menu below the header", () => {fixture.advanced = true;const menu = menuOf(createElement(ChatHeaderMenu, { bot }));- expect(keys(menu.items)).toEqual(["find", "copy", "download", "activity", "inspector"]);+ expect(keys(menu.items)).toEqual(["find", "start-fresh", "copy", "download", "activity", "inspector"]);expect(menu.items.find((item) => item.key === "inspector")).toMatchObject({ separatorBefore: true });expect(menu.items.every((item) => !item.disabled && item.heading !== "In Advanced mode")).toBe(true);expect(menu).toMatchObject({ placement: "below", openOnHover: true });diff --git a/src/components/ChatMoreMenu.tsx b/src/components/ChatMoreMenu.tsxindex ddff1b154e..8f6af11c96 100644--- a/src/components/ChatMoreMenu.tsx+++ b/src/components/ChatMoreMenu.tsx@@ -1,5 +1,5 @@import { useMemo, useState, type JSX } from "react";-import { Bug, Copy, Cpu, Download, Gauge, ListChecks, MessagesSquare, Monitor, MoreHorizontal, Search, Share, SquarePen, UserRound } from "lucide-react";+import { Bug, Copy, Cpu, Download, Gauge, ListChecks, MessagesSquare, Monitor, MoreHorizontal, RotateCcw, Search, Share, SquarePen, UserRound } from "lucide-react";import { currentTaskBot, openBotThread, useStore, visibleMessages, type Bot } from "@/state/store";import { useAdvancedMode } from "@/lib/interface-mode";import { useShowThreads } from "@/lib/thread-preferences";@@ -14,6 +14,7 @@ import {import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";import { localizedTaskTitle } from "@/lib/task-title";+import { useContextAction } from "./ContextWarning";import { ELEVATED_CONTROL, ELEVATED_HOVER, ELEVATED_OPEN } from "./elevated";import { ShortcutHint } from "./ShortcutHint";import { SidebarPopoverMenu, type SidebarMenuItem } from "./SidebarPopoverMenu";@@ -35,6 +36,8 @@ export function useChatMoreItems(profile: Bot, phoneHeader = false): { items: Siconst remoteClient = window.ogb?.remoteClient?.active === true;const usage = usageSummary(bot, state.instances);const hasMessages = messages.length > 0;+ const contextAction = useContextAction();+ const atFreshStart = messages.at(-1)?.compaction?.fresh === true;const transcript = () => formatTranscriptMarkdown({ title: bot.name, messages, botName: bot.name, isGroup: false });const threads = showThreads ? [] : orderedThreadList((profile.tasks ?? []).filter((task) => !task.routineRunId));const selection = profile.modelSelection;@@ -100,6 +103,14 @@ export function useChatMoreItems(profile: Bot, phoneHeader = false): { items: Si})),onSelect: () => {},} satisfies SidebarMenuItem]),+ {+ key: "start-fresh",+ label: t("chat.startFresh"),+ icon: <RotateCcw size={16} />,+ disabled: bot.busy || contextAction.pending || !hasMessages || atFreshStart,+ title: t(bot.busy ? "contextWarning.busy" : "chat.startFresh.hint"),+ onSelect: () => contextAction.run(`/api/bots/${profile.id}/start-fresh`, { threadId: bot.threadId }),+ },{key: "copy",heading: t("chat.export.heading"),diff --git a/src/components/ContextWarning.tsx b/src/components/ContextWarning.tsxindex 100c29ab21..242e1c0790 100644--- a/src/components/ContextWarning.tsx+++ b/src/components/ContextWarning.tsx@@ -9,7 +9,7 @@ import { api, useStore, type Bot, type Group, type Message } from "@/state/storeconst pill = "flex items-center gap-1.5 rounded-full border border-warning/40 bg-warning/10 px-2.5 py-1 text-[13px] text-ink";const action = "rounded-full px-1.5 font-medium text-accent hover:underline disabled:cursor-not-allowed disabled:opacity-50 disabled:no-underline";-function useCompact() {+export function useContextAction() {const { dispatch } = useStore();const [pending, setPending] = useState(false);const run = (path: string, body: unknown) => {@@ -41,7 +41,7 @@ export function ThreadContextWarningView({ name, percent, busy, pending, onCompaexport function ThreadContextWarning({ bot, messages }: { bot: Bot; messages: readonly Message[] }) {const usage = bot.tasks?.find((task) => task.threadId === bot.threadId)?.usage;const warning = threadContextWarning(usage, messages);- const { pending, run } = useCompact();+ const { pending, run } = useContextAction();if (!warning) return null;return (<ThreadContextWarningView name={bot.name} percent={warning.percent} busy={Boolean(bot.busy)} pending={pending}@@ -82,7 +82,7 @@ export function RoomContextWarningsView({ warnings, pendingBotId, onCompact }: {export function RoomContextWarnings({ group, members }: { group: Group; members: readonly Bot[] }) {const warnings = roomContextWarnings(group, members);- const { pending, run } = useCompact();+ const { pending, run } = useContextAction();const [target, setTarget] = useState<string | null>(null);if (!warnings.length) return null;return (diff --git a/src/components/DigestChip.test.ts b/src/components/DigestChip.test.tsindex 8f623e13f3..a24b71354b 100644--- a/src/components/DigestChip.test.ts+++ b/src/components/DigestChip.test.ts@@ -52,6 +52,16 @@ describe("DigestChip", () => {expect(html).toContain("<script>");expect(html).not.toContain("<script>");});+ it("draws a Start fresh row as a divider, not a summary", () => {+ const html = renderToStaticMarkup(createElement(CompactionChip, { message: {+ id: "context", role: "bot", kind: "compaction", at: 1,+ compaction: { summary: "", firstKeptId: "", foldedThroughId: "old", tokensBefore: 0, by: "person", fresh: true },+ } }));+ expect(html).toContain('role="separator"');+ expect(html).toContain("Fresh start");+ expect(html).toContain("Messages above this line");+ expect(html).not.toContain("<details");+ });it("says one tool call and one file in the singular", () => {const one = { ...message.digest!, tools: [], toolsDropped: 0, toolCalls: 1, files: { changed: ["a.ts"], added: [], deleted: [] } };expect(renderToStaticMarkup(createElement(DigestChip, { message: { ...message, digest: one } }))).toContain("Did 1 tool call · 1 file changed");diff --git a/src/components/DigestChip.tsx b/src/components/DigestChip.tsxindex 368030fe92..6c88093eb3 100644--- a/src/components/DigestChip.tsx+++ b/src/components/DigestChip.tsx@@ -47,6 +47,15 @@ export function DigestChip({ message }: { message: Message }) {export function CompactionChip({ message }: { message: Message }) {if (!message.compaction) return null;+ if (message.compaction.fresh) {+ return (+ <div role="separator" data-testid="fresh-start-divider" className="flex w-full items-center gap-3 py-1 text-[12px] text-ink-secondary">+ <span aria-hidden="true" className="h-px flex-1 bg-hairline" />+ <span className="text-center"><span className="font-medium">{t("chat.startFresh.divider")}</span> · {t("chat.startFresh.dividerHint")}</span>+ <span aria-hidden="true" className="h-px flex-1 bg-hairline" />+ </div>+ );+ }const excerpts = message.compaction.summary.startsWith(EXCERPT_SUMMARY_HEADER);return (<details className="max-w-[600px] rounded-xl border border-hairline/40 bg-panel px-3 py-2 text-[12px] text-ink-secondary" data-testid="compaction-chip">diff --git a/src/components/bot-panel/DetailsTab.tsx b/src/components/bot-panel/DetailsTab.tsxindex 6436ef9b4d..67e22d38d7 100644--- a/src/components/bot-panel/DetailsTab.tsx+++ b/src/components/bot-panel/DetailsTab.tsx@@ -14,7 +14,7 @@ import { Card, CardLabel, LabelAction, panelActionCls, NavRow, RowIcon, rowCls,type Derived = ReturnType<typeof useBotSettingsDerived>;-export const CONVERSATION_ITEMS = ["find", "usage", "activity", "inspector"];+export const CONVERSATION_ITEMS = ["find", "start-fresh", "usage", "activity", "inspector"];/** A ⋯ menu item drawn as a panel row: the same label, icon, value and handler. */export function ItemRow({ item }: { item: SidebarMenuItem }) {@@ -25,6 +25,7 @@ export function ItemRow({ item }: { item: SidebarMenuItem }) {type="button"data-panel-item={item.key}disabled={item.disabled}+ title={item.title}aria-pressed={item.active || undefined}onClick={item.onSelect}className={cn(rowCls, "w-full rounded-[8px] text-left enabled:hover:bg-ink/[0.04] disabled:cursor-default disabled:opacity-45")}@@ -34,7 +35,7 @@ export function ItemRow({ item }: { item: SidebarMenuItem }) {</span><span className={cn("min-w-0 truncate text-[14px] font-medium", !wrapsValue && "flex-1", item.active ? "text-accent-text" : "text-ink")}>{item.label}</span>{item.trailing && <span className={cn("flex items-center", wrapsValue ? "min-w-0 flex-1 justify-end text-right" : "shrink-0")}>{item.trailing}</span>}- {item.key !== "find" && <ChevronRight size={15} aria-hidden="true" className="shrink-0 text-ink-tertiary rtl:-scale-x-100" />}+ {item.key !== "find" && item.key !== "start-fresh" && <ChevronRight size={15} aria-hidden="true" className="shrink-0 text-ink-tertiary rtl:-scale-x-100" />}</button>);}diff --git a/src/locales/en.json b/src/locales/en.jsonindex f08853dc6b..a0cfc2aeb5 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -2600,6 +2600,10 @@"chat.digestTitle": "What this turn did","chat.compactionTitle": "Earlier context summarized","chat.compactionHint": "Your full conversation is still here. The agent uses this summary and recent messages when continuing.",+ "chat.startFresh": "Start fresh",+ "chat.startFresh.hint": "Starts a new session for this chat. Every message stays visible, and the bot's instructions, skills and memory don't change.",+ "chat.startFresh.divider": "Fresh start",+ "chat.startFresh.dividerHint": "Messages above this line aren't sent to the bot","chat.compactionExcerptTitle": "Earlier context shortened to recent excerpts","chat.compactionExcerptHint": "A written summary wasn't available, so the agent continues from these excerpts and recent messages. Older details may be missing from its context. Your full conversation is still here.","contextWarning.short": "Context {percent}%",@@ -9008,6 +9012,7 @@"serverError.model.accountUpdating": "this provider account is being updated — try again shortly","serverError.chat.busyEdit": "the thread is working — stop it before editing","serverError.chat.busyVersion": "the thread is working — stop it before switching versions",+ "serverError.chat.busyFresh": "the thread is working — stop it before starting fresh","serverError.chat.questionGone": "this question is no longer available","serverError.chat.askerGone": "the bot that asked this question is no longer available","serverError.chat.routineElsewhere": "this bot is running a routine in another conversation",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 402186aabb..65f34f8b85 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -2471,6 +2471,10 @@"chat.digestTitle": "O que foi feito nesta sessão","chat.compactionTitle": "Contexto anterior resumido","chat.compactionHint": "Sua conversa completa continua aqui. O agente usa este resumo e as mensagens recentes ao continuar.",+ "chat.startFresh": "Começar do zero",+ "chat.startFresh.hint": "Inicia uma nova sessão para esta conversa. Todas as mensagens continuam visíveis, e as instruções, habilidades e memória do bot não mudam.",+ "chat.startFresh.divider": "Novo começo",+ "chat.startFresh.dividerHint": "As mensagens acima desta linha não são enviadas ao bot","chat.compactionExcerptTitle": "Contexto anterior reduzido a trechos recentes","chat.compactionExcerptHint": "Sem um resumo escrito disponível, o agente continua com estes trechos e as mensagens recentes. Detalhes mais antigos podem faltar no contexto dele. A conversa completa continua aqui.","contextWarning.short": "Contexto {percent}%",@@ -8980,6 +8984,7 @@"serverError.model.accountUpdating": "Esta conta de IA está sendo atualizada. Tente novamente em instantes.","serverError.chat.busyEdit": "O bot ainda está trabalhando nesta conversa. Pare o bot antes de editar.","serverError.chat.busyVersion": "O bot ainda está trabalhando nesta conversa. Pare o bot antes de trocar de versão.",+ "serverError.chat.busyFresh": "O bot ainda está trabalhando nesta conversa. Pare o bot antes de começar do zero.","serverError.chat.questionGone": "Esta pergunta não está mais disponível.","serverError.chat.askerGone": "O bot que fez esta pergunta não está mais disponível.","serverError.chat.routineElsewhere": "Este bot está rodando uma rotina em outra conversa.",