Skip to content

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

Back to green: Composer under its size limit, and a comment that names no PR (#4298)

Milind Soni99b70934937f
diff --git a/server/surface.test.ts b/server/surface.test.ts
index 06cc604cd3..7574bdccaa 100644
--- a/server/surface.test.ts
+++ b/server/surface.test.ts
@@ -234,7 +234,7 @@ describe("surfacePrompt", () => {
const text = surfacePrompt({ computer: null, browser: true });
expect(text).toMatch(/happens in the built-in browser tab/);
expect(text).toMatch(/no desktop computer this turn/);
- // The browser is only the screen: a coding engine's own shell and file tools still work (#4291).
+ // The browser is only the screen: a coding engine's own shell and file tools still work.
expect(text).not.toMatch(/file or shell computer/);
expect(text).toContain("your own shell and file tools still work for ordinary code and file tasks");
expect(text).toMatch(/Browser tab of the Screen panel/);
diff --git a/src/components/Composer.tsx b/src/components/Composer.tsx
index d0408f8930..4cd18a8d85 100644
--- a/src/components/Composer.tsx
+++ b/src/components/Composer.tsx
@@ -1,7 +1,7 @@
import { directMessageSent, roomMessageSent } from "@/lib/product-events";
import { useComposerDictation } from "@/lib/use-composer-dictation";
import { useCallback, useEffect, useMemo, useRef, useState, type SetStateAction } from "react";
-import { GraduationCap, Mic, Paperclip, Square, X } from "lucide-react";
+import { Mic, Paperclip, Square, X } from "lucide-react";
import { useStore, visibleMessages, currentTaskBot, type Bot, type Group, type InstanceInfo, type Message } from "@/state/store";
import { cn } from "@/lib/cn";
import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";
@@ -69,7 +69,7 @@ import { composerPlaceholder, sendLabels, SIMPLE_COMPOSER, SIMPLE_CONTROL, slotC
import { PendingApprovalActions, PendingApprovalPanel, pendingApprovals } from "./PendingApproval";
import { CallButton } from "./CallView";
import { GroupCallButton } from "./GroupCallView";
-import { ApprovalChip, ComposerPlusMenu, GoalToggle } from "./ComposerPlusMenu";
+import { ApprovalChip, ComposerPlusMenu, GoalToggle, TeachTaskButton } from "./ComposerPlusMenu";
import { PhonePlus } from "./PhonePlus";
import { useThreadApproval } from "./thread-approval";
import { useStackedField, useTallPill } from "./composer-wrap";
@@ -402,10 +402,7 @@ export function Composer({
editText(learn + text.replace(/^\/learn\s*/, "").trimStart());
setCaret(learn.length);
setChannelMode("chat");
- requestAnimationFrame(() => {
- inputRef.current?.focus();
- inputRef.current?.setSelectionRange(learn.length, learn.length);
- });
+ requestAnimationFrame(() => { inputRef.current?.focus(); inputRef.current?.setSelectionRange(learn.length, learn.length); });
};
const pendingCount = (state.pendingQueued[threadId] ?? []).length;
@@ -830,15 +827,7 @@ export function Composer({
>
<Paperclip size={16} strokeWidth={1.75} absoluteStrokeWidth />
</button>}
- {advanced && canLearn && <button
- type="button"
- onClick={teachTask}
- aria-label={t("composer.teachTask")}
- title={t("composer.teachTask")}
- className="flex size-8 shrink-0 items-center justify-center rounded-full text-ink-secondary hover:bg-control hover:text-ink"
- >
- <GraduationCap size={16} strokeWidth={1.75} absoluteStrokeWidth />
- </button>}
+ {advanced && canLearn && <TeachTaskButton onClick={teachTask} />}
{/* Simple mode shows a mode's chip only while it is on, so a choice made in the + menu or the bot panel stays in view. */}
{goal && (advanced || goal.on) && <GoalToggle {...goal} compact={simpleDock} />}
{advanced && approvalChoice && <ApprovalModeSelector {...approvalChoice} />}
diff --git a/src/components/ComposerPlusMenu.tsx b/src/components/ComposerPlusMenu.tsx
index b0879a67d7..0f6b88a74b 100644
--- a/src/components/ComposerPlusMenu.tsx
+++ b/src/components/ComposerPlusMenu.tsx
@@ -123,6 +123,20 @@ function approvalItem(name: string, choice: ApprovalChoice, simple: boolean): Si
/** The thread's approval level as a small pill that opens its choices: in the Simple composer while it is not the
* default, and on the bot panel's Details. */
+export function TeachTaskButton({ onClick }: { onClick: () => void }) {
+ return (
+ <button
+ type="button"
+ onClick={onClick}
+ aria-label={t("composer.teachTask")}
+ title={t("composer.teachTask")}
+ className="flex size-8 shrink-0 items-center justify-center rounded-full text-ink-secondary hover:bg-control hover:text-ink"
+ >
+ <GraduationCap size={16} strokeWidth={1.75} absoluteStrokeWidth />
+ </button>
+ );
+}
+
export function ApprovalChip({ choice, quiet = false }: { choice: ApprovalChoice; quiet?: boolean }) {
const { current, note, items } = approvalMenu(choice, !useAdvancedMode());
const CurrentIcon = current.Icon;