Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Keep first-message thread titles valid when clipped
focuspointsb28464d8cd4a
diff --git a/server/store.ts b/server/store.tsindex 6f92dec00d..c6a908c874 100644--- a/server/store.ts+++ b/server/store.ts@@ -41,7 +41,8 @@ import { sameModelSelection } from "../shared/thread-model.ts";import { initialGreetingMessage } from "./initial-greeting.ts"; import { createDefaultBot, defaultBotRefusal, type DefaultBotIntro } from "./default-bot.ts";import { appsFromCreator } from "./inherited-apps.ts";import { ThreadCache, type ThreadState } from "./thread-cache.ts";-import { toolResultPrefix } from "./tool-results.ts";+import { titleFromMessage, UNTITLED_TASK } from "./thread-title.ts";+export { titleFromMessage, UNTITLED_TASK } from "./thread-title.ts";export type {BotActivity, GroupDefaultResponder, OptionCardData,SecretRequestCardData, Surface, TaskClosedBy, TaskOpenedBy, TaskUsage,@@ -137,7 +138,6 @@ export type StoreChange =| { type: "group"; groupId: string }| { type: "group.deleted"; groupId: string };-export const UNTITLED_TASK = "New task";export const UNTITLED_THREAD = "New thread";/** Every title (a bot's or a person's) passes through here, so equality tells a machine-made title from a rename. */@@ -146,11 +146,6 @@ export function threadTitleFrom(title?: string): string {return title?.trim().slice(0, TASK_TITLE_MAX) || UNTITLED_THREAD;}-export function titleFromMessage(text: string): string {- const line = text.trim().split("\n")[0]!.trim();- return line.length > 48 ? `${toolResultPrefix(line, 47)}…` : line || UNTITLED_TASK;-}-export function titleFromLlm(raw: string): string | null {const line = raw.trim()diff --git a/server/thread-title.ts b/server/thread-title.tsindex f0e343188f..5d8e2a3eb2 100644--- a/server/thread-title.ts+++ b/server/thread-title.ts@@ -1,5 +1,13 @@import { redactSecretsInText } from "./redact.ts";import type { Message } from "./store.ts";+import { toolResultPrefix } from "./tool-results.ts";++export const UNTITLED_TASK = "New task";++export function titleFromMessage(text: string): string {+ const line = text.trim().split("\n")[0]!.trim();+ return line.length > 48 ? `${toolResultPrefix(line, 47)}…` : line || UNTITLED_TASK;+}export const TITLE_INPUT_MAX_CHARS = 1_500;const EXCERPT_MAX_MESSAGES = 12;