Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge #5152: Start fresh: reset a chat's context from its actions menu

milind-soni3c114333053c
diff --cc shared/wire.ts
index 040adb47ea,46f21daebf..6b8806d072
--- a/shared/wire.ts
+++ b/shared/wire.ts
@@@ -456,9 -458,13 +456,10 @@@ export interface WireMessage extends Se
kind: "text" | "options" | "activity" | "screen" | "connector" | "secret" | "signin" | "routine.run" | "goal.run" | "digest" | "compaction" | "call" | "widget" | "app";
text?: string;
digest?: TurnDigest;
- compaction?: {
- summary: string;
- firstKeptId: string;
- foldedThroughId: string;
- tokensBefore: number;
- by: "person" | "harness"; /** The divider "Start fresh" leaves: no summary, and a provider reads nothing before it. */ fresh?: true;
- };
+ /** kind "compaction" with no `compaction` record: the engine condensed its own session. A marker for people, never context. */
+ engineCompaction?: true;
- compaction?: { summary: string; firstKeptId: string; foldedThroughId: string; tokensBefore: number; by: "person" | "harness" };
++ compaction?: { summary: string; firstKeptId: string; foldedThroughId: string; tokensBefore: number; 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.
* `fromTool`: an image a tool's result returned while the bot worked, which it did not make or send. */
diff --cc src/components/DigestChip.tsx
index 92a1a2d163,6c88093eb3..086161746d
--- a/src/components/DigestChip.tsx
+++ b/src/components/DigestChip.tsx
@@@ -45,18 -45,20 +45,27 @@@ export function DigestChip({ message }
);
}
+const COMPACTION_CHIP = "max-w-[600px] rounded-xl border border-hairline/40 bg-panel px-3 py-2 text-[12px] text-ink-secondary";
+
export function CompactionChip({ message }: { message: Message }) {
- if (!message.compaction) return null;
+ if (!message.compaction) return message.engineCompaction ? (
+ <div className={COMPACTION_CHIP} data-testid="engine-compaction-chip">
+ <p className="font-medium">{t("chat.engineCompactionTitle")}</p>
+ <p className="mt-1">{t("chat.engineCompactionHint")}</p>
+ </div>
+ ) : 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">
+ <details className={COMPACTION_CHIP} data-testid="compaction-chip">
<summary className="cursor-pointer font-medium">{t(excerpts ? "chat.compactionExcerptTitle" : "chat.compactionTitle")}</summary>
<p className="mt-2">{t(excerpts ? "chat.compactionExcerptHint" : "chat.compactionHint")}</p>
<p className="mt-2 whitespace-pre-wrap break-words">{message.compaction.summary}</p>
diff --cc src/locales/en.json
index 8151cf1103,a0cfc2aeb5..a6470cb274
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@@ -2632,9 -2599,11 +2632,13 @@@
"chat.digestChipNoFiles": "Did {tools} tool calls",
"chat.digestTitle": "What this turn did",
"chat.compactionTitle": "Earlier context summarized",
+ "chat.engineCompactionTitle": "Chat condensed into a summary",
+ "chat.engineCompactionHint": "The AI summarized earlier messages to make room. Your full conversation is still here, but the agent may not recall older details exactly.",
"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}%",
diff --cc src/locales/pt-br.json
index 8f43d81138,65f34f8b85..94b4fd0fd2
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@@ -2497,9 -2470,11 +2497,13 @@@
"chat.digestChipNoFiles": "Fez {tools} chamadas de ferramenta",
"chat.digestTitle": "O que foi feito nesta sessão",
"chat.compactionTitle": "Contexto anterior resumido",
+ "chat.engineCompactionTitle": "Conversa condensada em um resumo",
+ "chat.engineCompactionHint": "A IA resumiu as mensagens anteriores para abrir espaço. Sua conversa completa continua aqui, mas o agente pode não lembrar exatamente de detalhes mais antigos.",
"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}%",