Skip to content

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

One list: a My Cloud bot open in place keeps to its conversation

milind-soni4c5378d92d78
diff --git a/electron/places-together.node-test.mjs b/electron/places-together.node-test.mjs
index f8cafcbd3f..3629819f97 100644
--- a/electron/places-together.node-test.mjs
+++ b/electron/places-together.node-test.mjs
@@ -489,7 +489,7 @@ test("only this computer's page and My Cloud's own page are answered", async ()
const handlers = new Map();
const f = setup();
installPlacesTogether({ ipcMain: { handle: (channel, handler) => handlers.set(channel, handler) }, asking: (event) => event.page, together: f.together });
- assert.deepEqual([...handlers.keys()], ["places-together:state", "places-together:set", "places-together:open", "places-together:arrange", "places-together:new-bot-choice", "places-together:new-bot", "places-together:new-bot-heard",
+ assert.deepEqual([...handlers.keys()], ["places-together:state", "places-together:set", "places-together:open", "places-together:open-in-place", "places-together:arrange", "places-together:new-bot-choice", "places-together:new-bot", "places-together:new-bot-heard",
"places-together:notice-shown", "places-together:notice-done", "places-together:commands", "places-together:rail-set"]);
for (const [channel, handler] of handlers) assert.throws(() => handler({ page: null }, "nova"), channel === "places-together:rail-set" ? /Only the window's rail/ : /Only this computer's page and My Cloud's page/);
assert.equal(handlers.get("places-together:state")({ page: "local" }).here, "computer");
@@ -520,7 +520,7 @@ test("main wires it to the one rule for this app's own pages, and the preload of
const preload = readFileSync(join(HERE, "preload.cjs"), "utf8");
assert.match(preload.match(/const REMOTE_SAFE = new Set\(\[([^\]]*)\]\)/)[1], /"placesTogether"/);
const bridge = preload.slice(preload.indexOf(" placesTogether: "), preload.indexOf(" twoPlaces: {"));
- assert.deepEqual(bridge.match(/"places-together:[a-z-]+"/g), ['"places-together:state"', '"places-together:set"', '"places-together:open"', '"places-together:arrange"', '"places-together:changed"', '"places-together:changed"',
+ assert.deepEqual(bridge.match(/"places-together:[a-z-]+"/g), ['"places-together:state"', '"places-together:set"', '"places-together:open"', '"places-together:open-in-place"', '"places-together:arrange"', '"places-together:changed"', '"places-together:changed"',
'"places-together:notice-shown"', '"places-together:notice-done"', '"places-together:commands"', '"places-together:new-bot-choice"', '"places-together:new-bot"']);
});
diff --git a/scripts/ci-scope.mjs b/scripts/ci-scope.mjs
index 86596ee973..40f9165101 100644
--- a/scripts/ci-scope.mjs
+++ b/scripts/ci-scope.mjs
@@ -142,6 +142,7 @@ export const VITEST_SUBSETS = {
"server/one-home-two-desks.e2e.test.ts",
"server/one-home.e2e.test.ts",
"server/parked-cards.e2e.test.ts",
+ "server/places/place-proxy.e2e.test.ts",
"server/question-cards.e2e.test.ts",
"server/shared-computers.e2e.test.ts",
"server/shared-computers.gate.test.ts",
diff --git a/scripts/ci-scope.test.ts b/scripts/ci-scope.test.ts
index b37403d52a..632f3487a4 100644
--- a/scripts/ci-scope.test.ts
+++ b/scripts/ci-scope.test.ts
@@ -282,6 +282,7 @@ describe("CI outputs", () => {
"server/one-home-two-desks.e2e.test.ts",
"server/one-home.e2e.test.ts",
"server/parked-cards.e2e.test.ts",
+ "server/places/place-proxy.e2e.test.ts",
"server/question-cards.e2e.test.ts",
"server/shared-computers.e2e.test.ts",
"server/shared-computers.gate.test.ts",
diff --git a/server/places/place-proxy.e2e.test.ts b/server/places/place-proxy.e2e.test.ts
index 062dcb85b8..c562794a72 100644
--- a/server/places/place-proxy.e2e.test.ts
+++ b/server/places/place-proxy.e2e.test.ts
@@ -9,6 +9,7 @@ import { afterAll, beforeAll, expect, it } from "vitest";
import { launchCloudSendFixture, type CloudSendFixture } from "../../scripts/testing/cloud-send-fixture.ts";
import { hostTimeout } from "../testing/host-timeout.ts";
+const codeOf = async (response: Response) => ((await response.json()) as { code?: string }).code;
let fx: CloudSendFixture, edge: Server, edgeBase: string, token: string;
beforeAll(async () => {
@@ -52,7 +53,7 @@ it("reads, streams and sends a My Cloud bot's conversation through this computer
// Before main tells it a session, this computer's server forwards nothing.
const { body: listed } = await fx.onCloud("GET", "/api/bots?messages=0");
const bot = (listed.bots as Array<{ id: string; threadId: string; name: string }>)[0]!;
- expect((await (await page(`/api/bots/cloud:${bot.id}`)).json()).code).toBe("place_closed");
+ expect(await codeOf(await page(`/api/bots/cloud:${bot.id}`))).toBe("place_closed");
fx.tellDesktop({ type: "openmausbot:place-session", place: "cloud", origin: edgeBase, token });
let opened: Response | null = null;
@@ -95,9 +96,17 @@ it("reads, streams and sends a My Cloud bot's conversation through this computer
// Stopping is forwarded too, in the Cloud's ids.
expect((await page(`/api/bots/${encodeURIComponent(shown.id)}/interrupt`, { method: "POST", body: JSON.stringify({ threadId: shown.threadId }) })).status).toBeLessThan(500);
+ // A new conversation is made there and named here in the page's ids.
+ const made = await page(`/api/bots/${encodeURIComponent(shown.id)}/tasks`, { method: "POST", body: "{}" });
+ expect(made.status, await made.clone().text()).toBeLessThan(300);
+ const { bot: fresh } = (await made.json()) as { bot: { id: string; threadId: string; tasks: Array<{ threadId: string }> } };
+ expect(fresh.id).toBe(shown.id);
+ expect(fresh.threadId).toMatch(/^cloud:/);
+ expect(fresh.threadId).not.toBe(shown.threadId);
+ expect(fresh.tasks.every((task) => task.threadId.startsWith("cloud:"))).toBe(true);
stop.abort();
// Nobody but the app's window gets anything through, and a bot's settings stay on its own page.
expect((await fetch(`${fx.desktopBase}/api/bots/cloud:${bot.id}`)).status).toBeGreaterThanOrEqual(400);
- expect((await (await page(`/api/bots/cloud:${bot.id}/soul`)).json()).code).toBe("place_unsupported");
+ expect(await codeOf(await page(`/api/bots/cloud:${bot.id}/soul`))).toBe("place_unsupported");
}, hostTimeout(120_000));
diff --git a/server/places/place-proxy.test.ts b/server/places/place-proxy.test.ts
index c8f9abb6ce..f8560cc1c1 100644
--- a/server/places/place-proxy.test.ts
+++ b/server/places/place-proxy.test.ts
@@ -13,6 +13,7 @@ const OWNER = "o".repeat(43);
interface Seen { method: string; url: string; authorization: string | undefined; body: string }
+const codeOf = async (response: Response) => ((await response.json()) as { code?: string }).code;
let cloud: Server, local: Server, cloudUrl: string, localUrl: string, proxy: PlaceProxy;
const seen: Seen[] = [];
/** The stand-in Cloud's answer to each request; the live stream is handled apart. */
@@ -119,7 +120,7 @@ describe("the conversation of a My Cloud bot, through this computer's server", (
for (const [method, path] of [["PATCH", "/api/bots/cloud:scout"], ["DELETE", "/api/bots/cloud:scout"], ["GET", "/api/bots/cloud:scout/soul"], ["PATCH", "/api/bots/cloud:scout/tasks/cloud:t1"]] as const) {
const answer = await ask(path, { method, ...(method === "PATCH" ? { body: "{}" } : {}) });
expect(answer.status).toBe(404);
- expect((await answer.json()).code).toBe("place_unsupported");
+ expect(await codeOf(answer)).toBe("place_unsupported");
}
expect(seen).toEqual([]);
});
@@ -135,18 +136,18 @@ describe("the conversation of a My Cloud bot, through this computer's server", (
let answer = await ask("/api/bots/cloud:scout/messages", { method: "POST", body: "{}" });
expect(answer.status).toBe(503);
expect(answer.headers.get("x-omb-cloud-power")).toBeNull();
- expect((await answer.json()).code).toBe("place_asleep");
+ expect(await codeOf(answer)).toBe("place_asleep");
answerWith = (_req, res) => void res.writeHead(401, { "content-type": "application/json" }).end(JSON.stringify({ error: "unauthorized" }));
answer = await ask("/api/bots/cloud:scout");
expect(answer.status).toBe(502);
- expect((await answer.json()).code).toBe("place_signin");
+ expect(await codeOf(answer)).toBe("place_signin");
// An older My Cloud: no such route, answered by whatever serves unknown paths there.
answerWith = (_req, res) => void res.writeHead(404, { "content-type": "text/html" }).end("<h1>Not found</h1>");
answer = await ask("/api/bots/cloud:scout/read", { method: "POST", body: "{}" });
expect(answer.status).toBe(404);
- expect((await answer.json()).code).toBe("place_unsupported");
+ expect(await codeOf(answer)).toBe("place_unsupported");
// My Cloud's own refusal keeps its words, never its code: this page must not read it as its own bot limit.
answerWith = (_req, res) => void res.writeHead(409, { "content-type": "application/json" }).end(JSON.stringify({ error: "Too many bots", code: "bot_limit" }));
@@ -157,11 +158,11 @@ describe("the conversation of a My Cloud bot, through this computer's server", (
it("says My Cloud can't be reached, and that nothing is open before main opened a session", async () => {
proxy.setSession({ origin: "http://127.0.0.1:9", token: TOKEN });
- expect((await (await ask("/api/bots/cloud:scout")).json()).code).toBe("place_offline");
+ expect(await codeOf(await ask("/api/bots/cloud:scout"))).toBe("place_offline");
proxy.setSession(null);
const answer = await ask("/api/bots/cloud:scout");
expect(answer.status).toBe(503);
- expect((await answer.json()).code).toBe("place_closed");
+ expect(await codeOf(answer)).toBe("place_closed");
});
});
@@ -209,7 +210,7 @@ describe("the bot's live stream", () => {
streamTo = (res) => void res.writeHead(200, { "content-type": "text/html" }).end("old");
const answer = await ask("/api/places/cloud/events?bot=cloud:scout");
expect(answer.status).toBe(502);
- expect((await answer.json()).code).toBe("place_unsupported");
+ expect(await codeOf(answer)).toBe("place_unsupported");
});
});
diff --git a/src/App.tsx b/src/App.tsx
index f09cdafaa0..234896cf59 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -87,7 +87,7 @@ import { usePhoneBack } from "@/hooks/use-phone-back";
import { useRememberedSidePanel } from "@/hooks/use-remembered-side-panel";
import { closeSidePanels } from "@/lib/page-open";
import { phoneBackStep, phoneBackSteps } from "@/lib/phone-back";
-import { useDesktopNotificationOpens, useExternalChatLinks } from "@/hooks/use-external-chat-links"; import { useNewBotFromOtherPlace } from "@/lib/places-together";
+import { useDesktopNotificationOpens, useExternalChatLinks } from "@/hooks/use-external-chat-links"; import { useNewBotFromOtherPlace } from "@/lib/places-together"; import { isPlaceId } from "@/lib/place-chat"; import { PlacedBotPanel } from "@/components/PlacedBotMenu";
import { useUsageSnapshot } from "@/hooks/use-usage-snapshot";
import { useReadShownChatOnFocus } from "@/hooks/use-read-shown-chat";
import { usePresence } from "@/hooks/use-presence"; import { useFeature } from "@/lib/use-feature";
@@ -490,12 +490,12 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {
</main>
)}
{/* Sibling panels need distinct keys: two keyed `bot.id` collide in React's keyed reconciliation. */}
- {state.settingsOpen && bot && (
+ {(state.settingsOpen || state.computerOpen) && bot && isPlaceId(bot.id) && <PlacedBotPanel key={`placed:${bot.id}`} bot={bot} />}{state.settingsOpen && bot && !isPlaceId(bot.id) && (
remoteClient
? <RemoteAgentSettingsPanel bot={bot} overlay={state.computerOpen && !twoSidePanelsFit} />
: <BotSettingsDialog key={`settings:${bot.id}`} bot={bot} overlay={((state.inspectorOpen || state.computerOpen || (notificationFeed && state.notificationsOpen)) && !twoSidePanelsFit) || botPanelFloats(sidePanels, sidebarAndBotPanelFit)} />
)}
- {state.computerOpen && bot && (
+ {state.computerOpen && bot && !isPlaceId(bot.id) && (
remoteClient ? (
<RemoteDesktopPanel key={`computer:${bot.id}`} bot={bot} />
) : (
@@ -512,8 +512,8 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {
{!state.forkPanel && roomPanelOpen && group && (
<RoomPanel key={`room:${group.id}`} group={group} overlay={notificationFeed && state.notificationsOpen && !twoSidePanelsFit} />
)}
- {!remoteClient && !state.forkPanel && state.inspectorOpen && bot && <InspectorPanel key={bot.threadId} bot={bot} />}
- {!remoteClient && state.activityOpen && bot && <ActivityPanel key={`activity:${bot.id}`} bot={bot} />}
+ {!remoteClient && !state.forkPanel && state.inspectorOpen && bot && !isPlaceId(bot.id) && <InspectorPanel key={bot.threadId} bot={bot} />}
+ {!remoteClient && state.activityOpen && bot && !isPlaceId(bot.id) && <ActivityPanel key={`activity:${bot.id}`} bot={bot} />}
{inboxShown && <InboxPanel />}
{notificationTray && state.notificationsOpen && <NotificationsPanel />}
{notificationTray && !framed && <NotificationRail />}
diff --git a/src/components/ChatView.tsx b/src/components/ChatView.tsx
index 3c999a3e58..5dd308d024 100644
--- a/src/components/ChatView.tsx
+++ b/src/components/ChatView.tsx
@@ -88,7 +88,7 @@ import { AttachmentGallery, collectMessageFiles, replyAttachmentGroup, splitMess
import { ScreenFrame } from "./ScreenFrame";
import { CompactionChip, DigestChip } from "./DigestChip";
import { RenameTitle } from "./RenameTitle"; import { ChatHeadRole, chiefOfStaffBadge } from "./BotRole";
-import { BotActivityPicker } from "./TaskPicker"; import { ChatHeadPill } from "./ChatHeadPill"; import { HeaderShare } from "./bot-access/HeaderShare"; import { ThreadPresenceFaces } from "./TeamPresence"; import { useStoreRef } from "@/state/store-ref"; import { sameFields, useStoreDispatch, useStoreSelector } from "@/state/store-select"; import { sameDrawnBots } from "@/lib/drawn-bots"; import { ChatActivityControls, chatActivityMessages, useChatActivity } from "./ChatActivity";
+import { BotActivityPicker } from "./TaskPicker"; import { ChatHeadPill } from "./ChatHeadPill"; import { HeaderShare } from "./bot-access/HeaderShare"; import { isPlaceId } from "@/lib/place-chat"; import { ThreadPresenceFaces } from "./TeamPresence"; import { useStoreRef } from "@/state/store-ref"; import { sameFields, useStoreDispatch, useStoreSelector } from "@/state/store-select"; import { sameDrawnBots } from "@/lib/drawn-bots"; import { ChatActivityControls, chatActivityMessages, useChatActivity } from "./ChatActivity";
import { ELEVATED_FLOAT, ELEVATED_HOVER } from "./elevated"; import { NewThreadHeaderButton } from "./NewThreadHeaderButton"; import { HeaderThreadTabs, useThreadTabsShown } from "./HeaderThreadTabs";
import { ModelPicker } from "./ModelPicker"; import { useFailedTurnFix } from "./FailedTurnFix";
import { ChatHeaderMenu, ChatMoreMenu } from "./ChatMoreMenu"; import { TeamOwnHelperHeader, TeamPrivateFirstLine, TeamPrivateHeader, TeamSharedHeader } from "./TeamPrivateChatsLine"; import { ownChatStarted } from "@/state/team-chats"; import { isNewChatThread } from "@/state/new-chat";
@@ -1013,9 +1013,9 @@ export const ChatView = memo(function ChatView({ bot: profile, inForkPanel = fal
pins={pinnedPreview(messages, bot.pinnedMessageId, bot.name)}
triggerClassName={cn(ELEVATED_FLOAT, ELEVATED_HOVER)}
onJump={(messageId) => dispatch({ type: "focusMessage", threadId: bot.threadId, messageId })}
- onUnpin={remoteClient ? undefined : () => dispatch({ type: "updateTask", botId: bot.id, threadId: bot.threadId, patch: { pinnedMessageId: "" } })}
+ onUnpin={remoteClient || isPlaceId(bot.id) ? undefined : () => dispatch({ type: "updateTask", botId: bot.id, threadId: bot.threadId, patch: { pinnedMessageId: "" } })}
/>
- {!phoneMenu && <button
+ {!phoneMenu && !isPlaceId(bot.id) && <button
data-tour="computer"
onClick={(event) => { if (!state.computerOpen) rememberComputerPanelOpen({ botId: bot.id, opener: event.currentTarget, tabs: event.detail === 0 }); dispatch({ type: "toggleComputer" }); }}
className={cn(
@@ -1027,7 +1027,7 @@ export const ChatView = memo(function ChatView({ bot: profile, inForkPanel = fal
>
<Monitor size={16} />{busy && place === "browser" && <span aria-hidden="true" className="absolute right-1 top-1 size-1.5 animate-pulse rounded-full bg-success" data-testid="computer-button-live" />}
</button>}
- <HeaderShare bot={bot} />{!inForkPanel && <NewThreadHeaderButton botId={bot.id} />}{phoneMenu ? <ChatMoreMenu bot={bot} phoneHeader /> : (advanced || remoteClient) && <ChatHeaderMenu key={`menu:${bot.threadId}`} bot={bot} />}
+ {!isPlaceId(bot.id) && <HeaderShare bot={bot} />}{!inForkPanel && <NewThreadHeaderButton botId={bot.id} />}{isPlaceId(bot.id) ? null : phoneMenu ? <ChatMoreMenu bot={bot} phoneHeader /> : (advanced || remoteClient) && <ChatHeaderMenu key={`menu:${bot.threadId}`} bot={bot} />}
</div>
</div>
</div>
diff --git a/src/components/Composer.simple.test.ts b/src/components/Composer.simple.test.ts
index 9eec28c5c8..9bbc731f68 100644
--- a/src/components/Composer.simple.test.ts
+++ b/src/components/Composer.simple.test.ts
@@ -345,3 +345,19 @@ it.each([false, true])("keeps Call for a shared viewer without Stop permission (
expect(container.querySelector('[aria-label="Stop this turn"]')).toBeNull();
expect(fixture.call).toMatchObject({ bot: { id: "atlas" }, placement: "composer" });
});
+
+it("a My Cloud bot open in place has no call here, and a file dropped on it says where files go instead of uploading", async () => {
+ const placed: Bot = { ...bot, id: "cloud:atlas", threadId: "cloud:atlas-thread" };
+ restoreComposerDraft(`bot:${placed.id}:${placed.threadId}`, { text: "", attachments: [] });
+ const uploads = vi.fn(async () => new Response("{}"));
+ vi.stubGlobal("fetch", uploads);
+ render({ bot: placed });
+ expect(fixture.call).toBeNull();
+ const field = container.querySelector("textarea")!;
+ const file = new File(["png"], "flat.png", { type: "image/png" });
+ const paste = new Event("paste", { bubbles: true, cancelable: true });
+ Object.defineProperty(paste, "clipboardData", { value: { files: [file], items: [{ kind: "file", type: "image/png", getAsFile: () => file }], types: ["Files"], getData: () => "" } });
+ flushSync(() => field.dispatchEvent(paste));
+ await vi.waitFor(() => expect(container.textContent).toContain("To send files to a My Cloud bot, open it on My Cloud's page"));
+ expect(uploads).not.toHaveBeenCalled();
+});
diff --git a/src/components/Composer.tsx b/src/components/Composer.tsx
index 2e620f9fdd..a53897e13f 100644
--- a/src/components/Composer.tsx
+++ b/src/components/Composer.tsx
@@ -1,6 +1,6 @@
import { directMessageSent, roomMessageSent } from "@/lib/product-events";
import { TeamAudienceLabel } from "./TeamSideSwitch";
-import { useComposerDictation } from "@/lib/use-composer-dictation";
+import { useComposerDictation } from "@/lib/use-composer-dictation"; import { isPlaceId } from "@/lib/place-chat";
import { ComposerForkError, useComposerFork } from "./ComposerFork";
import { isNewChatThread } from "@/state/new-chat";
import { useCallback, useEffect, useMemo, useRef, useState, type SetStateAction } from "react";
@@ -501,14 +501,14 @@ export function Composer({
return () => window.clearTimeout(timeout);
}, [busy, pendingCount, steering]);
const fileInput = useRef<HTMLInputElement>(null);
- const [attachmentNotice, setAttachmentNotice] = useState<string | null>(null);
+ const [attachmentNotice, setAttachmentNotice] = useState<string | null>(null), placed = isPlaceId(bot?.id), filesThere = () => setAttachmentNotice(t("together.inPlace.files")); // a My Cloud bot open in place takes no files here
const modeBot = group ? undefined : bot;
const pinPlace = (surface: Place | null) => modeBot && dispatch({ type: "updateTask", botId: modeBot.id, threadId: modeBot.threadId, patch: { surface } });
const place = modeBot && !remoteClient && advanced ? { bot: modeBot, task: composerTask, disabled: Boolean(modeBot.busy), onPin: pinPlace } : undefined;
const { choice: approvalChoice, dialogs: approvalDialogs } = useThreadApproval(modeBot);
- const uploadImage = useCallback((file: File) => uploadDraftImage(draftId, file), [draftId]);
+ const uploadImage = useCallback((file: File) => (placed ? Promise.resolve(null) : uploadDraftImage(draftId, file)), [draftId, placed]);
const pickFiles = async (picked: FileList | readonly File[] | null) => {
- if (!picked?.length) return;
+ if (!picked?.length) return; if (placed) return filesThere();
const escapesBefore = escapeBlurs.current;
changeDraftAttachmentPending(draftId, true);
try {
@@ -637,7 +637,7 @@ export function Composer({
};
const handlePaste = (e: React.ClipboardEvent<HTMLTextAreaElement>) => {
- const pastedFiles = clipboardFilesToAttach(e.clipboardData);
+ const pastedFiles = clipboardFilesToAttach(e.clipboardData); if (placed && (pastedFiles.length || clipboardHasImages(e.clipboardData))) { e.preventDefault(); filesThere(); return; }
if (pastedFiles.length > 0) {
e.preventDefault();
void pickFiles(pastedFiles);
@@ -752,7 +752,7 @@ export function Composer({
<PointedChips threadId={threadId} />{!group && bot && <SetupRequestChip bot={bot} threadId={threadId} />}
<ComposerAttachments
items={attachments}
- onAdd={addAttachments}
+ onAdd={placed ? filesThere : addAttachments}
onRemove={removeAttachment}
onChangeCitation={(citation: CitationAttachment) => editAttachments((current) => current.map((attachment) => attachment.id === citation.id ? citation : attachment))}
onDisplayInChatBox={displayPasteInChatBox}
@@ -937,7 +937,7 @@ export function Composer({
{stacked && (
<ComposerAdvancedTools profile={profile} bot={modeBot} task={composerTask} locked={locked} remoteClient={remoteClient}
onAttach={() => fileInput.current?.click()} goal={goal} teach={canLearn ? teachTask : undefined} approval={approvalChoice}
- callBotId={callShown && bot && !group ? bot.id : undefined}
+ callBotId={callShown && bot && !group && !placed ? bot.id : undefined}
onPin={pinPlace} />
)}
<div data-composer-actions className={cn("flex items-center", simpleDock ? "gap-2" : "gap-1", stacked && "ms-auto")}>
@@ -975,7 +975,7 @@ export function Composer({
<Mic size={16} className="[&_rect]:fill-current" />
</button>
)}
- {callShown && bot && !group && <CallButton bot={bot} placement="composer" fill={advanced || singleRow ? undefined : slot.fill} ink={slot.ink} inverse={singleRow} modeMenu={!stacked} />}
+ {callShown && bot && !group && !placed && <CallButton bot={bot} placement="composer" fill={advanced || singleRow ? undefined : slot.fill} ink={slot.ink} inverse={singleRow} modeMenu={!stacked} />}
{callShown && group && !advanced && <GroupCallButton group={group} members={members ?? []} placement="composer" fill={slot.fill} ink={slot.ink} />}
{hasContent && !locked && (
<ComposerSendButton compact={simpleDock} waits={!fork.command && busy && !steersNow} label={sendNames.label} title={sendNames.title} look={slot.button}
diff --git a/src/components/ModelPicker.tsx b/src/components/ModelPicker.tsx
index 6bc7f512a9..e7b2845b2f 100644
--- a/src/components/ModelPicker.tsx
+++ b/src/components/ModelPicker.tsx
@@ -26,7 +26,7 @@ import { SimpleModelMenu, type SimpleThinking } from "./SimpleModelMenu";
import { apiKeysLabel, ClaudeAccountSelect, engineStatus, FollowBotModelRow, ModelEngineRail, ModelRow, ModelSearch } from "./ModelPickerFull";
import { MENU_LABEL, MENU_LINE, MENU_ROW, MENU_SEPARATOR, MENU_TRAILING } from "./menu-recipe";
import { modelMenuKey, modelMenuPointerMove } from "./model-menu-keys";
-import { lockedWhileBusy, offersReasoning, useRefocusAfterPick, variantChoices, variantLabel } from "./model-picker-reasoning";
+import { lockedWhileBusy, offersReasoning, useRefocusAfterPick, variantChoices, variantLabel } from "./model-picker-reasoning"; import { isPlaceId } from "@/lib/place-chat";
import { BusyModelMenu } from "./ModelPickerBusyMenu";
import { useAdvancedMode } from "@/lib/interface-mode";
import { useOwnerOrAdmin } from "@/lib/use-owner-or-admin";
@@ -218,7 +218,7 @@ export function ModelPicker({
const { dispatch: storeDispatch, refreshInstances, refreshModels: refreshInstanceModels } = useStoreActions(), state = useStoreSelector((s) => ({ instances: s.instances, modelVariantSessions: s.modelVariantSessions, profile: s.bots.find((candidate) => candidate.id === shown.id) }), sameFields);
const [open, setOpen] = useState(false);
const { bot, dispatch } = useAiSwitch({ bot: shown, threadId, contained, dispatch: storeDispatch, setOpen: (next) => (next ? openMenu() : setOpen(false)) });
- const locked = lockedWhileBusy(state, bot, contained, threadId);
+ const locked = lockedWhileBusy(state, bot, contained, threadId) || isPlaceId(shown.id); // a My Cloud bot open in place: its model is chosen on its own page
const motion = useMenuMotion(open && !locked);
const [railId, setRailId] = useState<string | null>(null);
const [query, setQuery] = useState("");
@@ -566,7 +566,7 @@ export function ModelPicker({
};
const currentOption = active?.models.options.find((option) => option.id === selection.model);
- const attention = !active ? undefined
+ const attention = !active || isPlaceId(shown.id) ? undefined
: active.policy ? t("policy.managedBy", { organization: active.policy.organizationName })
: needsCli(active) ? t("model.setupRequired")
: needsSignIn(active) && !isCustomOnly(active) && !currentOption?.custom ? t("model.signInRequired") : currentOption?.orgBlocked ? t("model.orgBlocked") : currentOption?.needsCliUpdate ? t("engines.updateClaude") : undefined;
diff --git a/src/components/PlacedBotMenu.tsx b/src/components/PlacedBotMenu.tsx
index 1d15477e37..be6079c81a 100644
--- a/src/components/PlacedBotMenu.tsx
+++ b/src/components/PlacedBotMenu.tsx
@@ -4,13 +4,15 @@
// PlaceChatKeeper lets the bot open in place go once the person chooses anything else.
import { useEffect, useLayoutEffect, useRef, useSyncExternalStore } from "react";
import { createPortal } from "react-dom";
-import { ExternalLink, MoreHorizontal } from "lucide-react";
+import { ExternalLink, MoreHorizontal, X } from "lucide-react";
import { cn } from "@/lib/cn";
import { t } from "@/lib/i18n";
-import { closePlaceBot, isPlaceId, noteChosen } from "@/lib/place-chat";
+import { closePlaceBot, isPlaceId, noteChosen, placeOwnId } from "@/lib/place-chat";
import { openOtherPlaceBot } from "@/lib/places-together";
import { isPlacedBot, type PlacedBot } from "@/lib/place-rows";
-import { useStoreSelector } from "@/state/store-select";
+import { useStoreDispatch, useStoreSelector } from "@/state/store-select";
+import { useAdvancedMode } from "@/lib/interface-mode";
+import { sidePanelCls } from "./bot-panel/side-panel";
import type { Bot } from "@/state/store";
import { MENU_ITEM, MENU_SHEET } from "./menu-recipe";
import type { MenuState } from "./Sidebar";
@@ -88,3 +90,23 @@ export function PlaceChatKeeper() {
}, [chosen]);
return null;
}
+
+/** The side panel of a My Cloud bot open in place: its settings, files, computer and everything else not in its
+ * conversation are on My Cloud's own page, which this opens at that bot. Said once, plainly, where its panel would be. */
+export function PlacedBotPanel({ bot }: { bot: Bot }) {
+ const dispatch = useStoreDispatch(), simple = !useAdvancedMode();
+ const close = () => { dispatch({ type: "toggleSettings", open: false }); dispatch({ type: "toggleComputer", open: false }); };
+ return <aside role="dialog" aria-labelledby="placed-bot-title" data-placed-panel="" className={sidePanelCls(false, simple)}>
+ <div className="flex shrink-0 items-center justify-between px-4 py-3">
+ <span id="placed-bot-title" className="truncate text-[15px] font-semibold text-ink">{bot.name}</span>
+ <button type="button" onClick={close} aria-label={t("botSettings.simple.close")} className="rounded-md p-1 text-ink-secondary hover:bg-control hover:text-ink"><X size={18} className="pointer-events-none" /></button>
+ </div>
+ <div className="flex flex-col gap-3 px-4 pb-4 text-[13px] leading-[18px] text-ink-secondary">
+ <p>{t("together.inPlace.panel", { name: bot.name })}</p>
+ <button type="button" onClick={() => { close(); openOtherPlaceBot(placeOwnId(bot.id)); }}
+ className="flex h-9 items-center justify-center gap-2 self-start rounded-full bg-raised px-3.5 text-[13px] font-medium text-ink hover:bg-raised-hover">
+ <ExternalLink size={14} aria-hidden="true" />{t("together.openThere")}
+ </button>
+ </div>
+ </aside>;
+}
diff --git a/src/components/Sidebar.in-place.dom.test.ts b/src/components/Sidebar.in-place.dom.test.ts
index 4734035465..5a57c00298 100644
--- a/src/components/Sidebar.in-place.dom.test.ts
+++ b/src/components/Sidebar.in-place.dom.test.ts
@@ -3,7 +3,6 @@
// conversation in this page's own store (src/lib/place-chat.ts), never moving the window; when that can't be done it
// opens on My Cloud's page as before. Its row's menu keeps a way to My Cloud's own page.
import { act, createElement } from "react";
-import { flushSync } from "react-dom";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { Bot } from "@/state/store";
@@ -40,12 +39,12 @@ const said = (over: Partial<PlacesTogetherState> = {}): PlacesTogetherState => (
const OWN = [bot("mausbot", { chiefOfStaff: true }), bot("git"), bot("ledger")];
const dispatch = vi.fn();
-let host: HTMLDivElement, root: Root, answer: () => Promise<PlacesTogetherState>, changed: () => void;
+let host: HTMLDivElement, root: Root, answer: () => Promise<PlacesTogetherState>;
const page = {
state: vi.fn(() => answer()),
set: vi.fn(async () => said()),
open: vi.fn(async () => true),
- onChanged: vi.fn((callback: () => void) => { changed = callback; return () => {}; }),
+ onChanged: vi.fn((_callback: () => void) => () => {}),
arrange: vi.fn(async (entries: ArrangedBot[]) => entries),
openInPlace: vi.fn(async (_id: string) => ({ ok: true })),
};
diff --git a/src/locales/en.json b/src/locales/en.json
index aeda640bdd..3a2dad4605 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -11618,6 +11618,8 @@
"together.state.asleep": "My Cloud is asleep. Open a bot to wake it.",
"together.state.waking": "My Cloud is waking up…",
"together.openThere": "Open on My Cloud's page",
+ "together.inPlace.files": "To send files to a My Cloud bot, open it on My Cloud's page: its ⋯ menu in the list.",
+ "together.inPlace.panel": "{name}'s settings, files, computer and everything else besides this conversation are on My Cloud's own page.",
"together.state.offlineCloud": "My Cloud can't be reached right now.",
"together.state.offlineComputer": "This computer's bots can't be read right now.",
"together.switch.title": "This computer and My Cloud together",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index eef85c96ed..374687344f 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -11591,6 +11591,8 @@
"together.state.asleep": "O My Cloud está em repouso. Abra um bot para ativá-lo.",
"together.state.waking": "O My Cloud está sendo ativado…",
"together.openThere": "Abrir na página do My Cloud",
+ "together.inPlace.files": "Para enviar arquivos a um bot do My Cloud, abra-o na página do My Cloud: no menu ⋯ dele na lista.",
+ "together.inPlace.panel": "As configurações, os arquivos, o computador e tudo o mais de {name}, além desta conversa, ficam na própria página do My Cloud.",
"together.state.offlineCloud": "Não é possível acessar o My Cloud agora.",
"together.state.offlineComputer": "Não é possível ler os bots deste computador agora.",
"together.switch.title": "Este computador e o My Cloud juntos",