Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 4 additions & 45 deletions packages/app-core/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import {
AppsPageView,
BrowserWorkspaceView,
BugReportModal,
CharacterEditor,
ChatView,
CompanionShell,
CompanionView,
Expand All @@ -45,7 +44,6 @@ import {
} from "./app-shell-components";
import { TasksEventsPanel } from "./components/chat/TasksEventsPanel";
import { DeferredSetupChecklist } from "./components/cloud/FlaminaGuide";
import { CompanionHeader } from "./components/companion/CompanionHeader";
import { MusicPlayerGlobal } from "./components/music/MusicPlayerGlobal";
import {
BugReportProvider,
Expand Down Expand Up @@ -136,11 +134,7 @@ function ViewRouter({
);
case "character":
case "character-select":
return (
<TabScrollView>
<CharacterEditor sceneOverlay={characterSceneVisible} />
</TabScrollView>
);
return <ChatView />;
case "wallets":
return (
<TabScrollView>
Expand Down Expand Up @@ -206,35 +200,23 @@ export function App() {
startupCoordinator,
tab,
setTab,
setState,
actionNotice,
uiShellMode,
switchShellView,
uiLanguage,
setUiLanguage,
uiTheme,
setUiTheme,
chatAgentVoiceMuted,
unreadConversations,
activeGameViewerUrl,
gameOverlayEnabled,
t,
} = useApp();

const isPopout = useIsPopout();
const shellMode =
tab === "character" || tab === "character-select"
? "native"
: (uiShellMode ?? "companion");
const shellMode = uiShellMode ?? "companion";
const effectiveTab: Tab =
shellMode === "companion"
? "companion"
: tab === "companion"
: tab === "companion" || isCharacterTab(tab)
? "chat"
: tab;
const characterSceneVisible =
shellMode === "native" &&
(isCharacterTab(effectiveTab) || isCharacterTab(tab));
const characterSceneVisible = false;
const companionShellVisible = shellMode === "companion";
// Don't initialize the 3D scene while the system is still booting — this
// prevents VrmEngine's Three.js setup from blocking the JS thread and
Expand Down Expand Up @@ -653,29 +635,6 @@ export function App() {
<AdvancedPageView />
</div>
</div>
) : characterSceneVisible ? (
<div
key="character-shell"
className="relative flex flex-col flex-1 min-h-0 w-full font-body text-txt bg-transparent"
>
<CompanionHeader
activeShellView="character"
onShellViewChange={(view) => switchShellView(view)}
uiLanguage={uiLanguage}
setUiLanguage={setUiLanguage}
uiTheme={uiTheme}
setUiTheme={setUiTheme}
t={t}
showCompanionControls
chatAgentVoiceMuted={chatAgentVoiceMuted}
onToggleVoiceMute={() =>
setState("chatAgentVoiceMuted", !chatAgentVoiceMuted)
}
/>
<main className="flex flex-1 min-h-0 min-w-0 overflow-hidden px-3 xl:px-5 pb-4 pt-2 xl:pb-6">
<ViewRouter characterSceneVisible />
</main>
</div>
) : (
<div
key={`tab-shell-${tab}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface CompanionHeaderProps {
/** Shown in the shell header right cluster (e.g. inference / cloud alert). */
rightExtras?: ReactNode;
rightTrailingExtras?: ReactNode;
companionActionExtras?: ReactNode;
}

export const CompanionHeader = memo(function CompanionHeader(
Expand All @@ -45,6 +46,7 @@ export const CompanionHeader = memo(function CompanionHeader(
saveSuccess,
rightExtras,
rightTrailingExtras,
companionActionExtras,
} = props;

return (
Expand Down Expand Up @@ -82,6 +84,7 @@ export const CompanionHeader = memo(function CompanionHeader(
saveSuccess={saveSuccess}
rightExtras={rightExtras}
rightTrailingExtras={rightTrailingExtras}
companionActionExtras={companionActionExtras}
>
{children}
</ShellHeaderControls>
Expand Down

This file was deleted.

3 changes: 3 additions & 0 deletions packages/app-core/src/components/pages/CompanionView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useApp } from "@miladyai/app-core/state";
import { Button } from "@miladyai/ui";
import { PanelLeftOpen } from "lucide-react";
import { memo, useCallback, useEffect, useMemo, useState } from "react";
import { createPortal } from "react-dom";
import { ChatModalView } from "./ChatModalView";
import { useCompanionSceneStatus } from "../companion/companion-scene-status-context";
import { CompanionHeader } from "../companion/CompanionHeader";
Expand All @@ -11,6 +12,7 @@ import { useSharedCompanionScene } from "../companion/shared-companion-scene-con
import { InferenceCloudAlertButton } from "../companion/InferenceCloudAlertButton";
import { resolveCompanionInferenceNotice } from "../companion/resolve-companion-inference-notice";
import { PtyConsoleSidePanel } from "../coding/PtyConsoleSidePanel";
import { ProfilesDialog } from "../shell/ProfilesDialog";

const COMPANION_UI_REVEAL_FALLBACK_MS = 1400;
const COMPANION_DOCK_HEIGHT = "min(42vh, 24rem)";
Expand Down Expand Up @@ -158,6 +160,7 @@ const CompanionViewOverlay = memo(function CompanionViewOverlay() {
setState("chatAgentVoiceMuted", !chatAgentVoiceMuted)
}
onNewChat={() => void handleNewConversation()}
companionActionExtras={<ProfilesDialog />}
rightExtras={companionHeaderRightExtras}
/>
</div>
Expand Down
55 changes: 40 additions & 15 deletions packages/app-core/src/components/shell/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ vi.mock("lucide-react", () => ({
CircleUserRound: () => React.createElement("span", null, "👤"),
Bug: () => React.createElement("span", null, "🐛"),
CircleDollarSign: () => React.createElement("span", null, "💰"),
Loader2: () => React.createElement("span", null, "⏳"),
MessageCirclePlus: () => React.createElement("span", null, "💬"),
Menu: () => React.createElement("span", null, "☰"),
Monitor: () => React.createElement("span", null, "🖥"),
PencilLine: () => React.createElement("span", null, ""),
Sparkles: () => React.createElement("span", null, ""),
Smartphone: () => React.createElement("span", null, "📱"),
UserRound: () => React.createElement("span", null, "👤"),
Users: () => React.createElement("span", null, "👥"),
Expand Down Expand Up @@ -114,6 +115,15 @@ describe("Header", () => {
setUiTheme: vi.fn(),
uiShellMode: "native",
switchShellView: vi.fn(),
characterData: null,
characterDraft: {},
selectedVrmIndex: 1,
loadCharacter: vi.fn(),
chatAgentVoiceMuted: false,
handleNewConversation: vi.fn(),
conversationMessages: [],
chatLastUsage: null,
setActionNotice: vi.fn(),
};

// @ts-expect-error - test uses a narrowed subset of the full app context type.
Expand All @@ -133,9 +143,6 @@ describe("Header", () => {
const _activeDesktopToggle = root.findByProps({
"data-testid": "ui-shell-toggle-desktop",
});
const _inactiveCharacterToggle = root.findByProps({
"data-testid": "ui-shell-toggle-character",
});
const _inactiveCompanionToggle = root.findByProps({
"data-testid": "ui-shell-toggle-companion",
});
Expand Down Expand Up @@ -177,6 +184,11 @@ describe("Header", () => {
characterSaveSuccess: false,
conversationMessages: [],
chatLastUsage: null,
characterData: null,
characterDraft: {},
selectedVrmIndex: 1,
loadCharacter: vi.fn(),
setActionNotice: vi.fn(),
};

// @ts-expect-error - test uses a narrowed subset of the full app context type.
Expand Down Expand Up @@ -214,7 +226,7 @@ describe("Header", () => {
).toBeDefined();
});

it("uses minimal chrome for the character view and hides cloud pricing", async () => {
it("shows the Profiles trigger in companion mode", async () => {
const mockUseApp = {
t: (k: string) => k,
agentStatus: { state: "running", agentName: "Eliza" },
Expand All @@ -231,16 +243,25 @@ describe("Header", () => {
handleRestart: vi.fn(),
handleStart: vi.fn(),
loadDropStatus: vi.fn().mockResolvedValue(undefined),
tab: "character",
tab: "chat",
setTab: vi.fn(),
setState: vi.fn(),
plugins: [],
uiLanguage: "en",
setUiLanguage: vi.fn(),
uiTheme: "dark",
setUiTheme: vi.fn(),
uiShellMode: "native",
uiShellMode: "companion",
switchShellView: vi.fn(),
chatAgentVoiceMuted: false,
handleNewConversation: vi.fn(),
conversationMessages: [],
chatLastUsage: null,
characterData: null,
characterDraft: {},
selectedVrmIndex: 1,
loadCharacter: vi.fn(),
setActionNotice: vi.fn(),
};

// @ts-expect-error - test uses a narrowed subset of the full app context type.
Expand Down Expand Up @@ -269,14 +290,9 @@ describe("Header", () => {
).toHaveLength(0);
expect(
(testRenderer as ReactTestRenderer).root.findAllByProps({
"data-testid": "header-cloud-status",
"data-testid": "profiles-dialog-trigger",
}),
).toHaveLength(0);
expect(
(testRenderer as ReactTestRenderer).root.findAll(
(node) => node.props["aria-label"] === "charactereditor.Save",
),
).toHaveLength(0);
).toHaveLength(2);
});

it("uses minimal chrome in companion mode", async () => {
Expand All @@ -296,7 +312,7 @@ describe("Header", () => {
handleRestart: vi.fn(),
handleStart: vi.fn(),
loadDropStatus: vi.fn().mockResolvedValue(undefined),
tab: "character",
tab: "chat",
setTab: vi.fn(),
setState: vi.fn(),
plugins: [],
Expand All @@ -306,6 +322,15 @@ describe("Header", () => {
setUiTheme: vi.fn(),
uiShellMode: "companion",
switchShellView: vi.fn(),
chatAgentVoiceMuted: false,
handleNewConversation: vi.fn(),
conversationMessages: [],
chatLastUsage: null,
characterData: null,
characterDraft: {},
selectedVrmIndex: 1,
loadCharacter: vi.fn(),
setActionNotice: vi.fn(),
};

// @ts-expect-error - test uses a narrowed subset of the full app context type.
Expand Down
22 changes: 6 additions & 16 deletions packages/app-core/src/components/shell/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
import { CloudStatusBadge } from "../cloud/CloudStatusBadge";
import { InferenceCloudAlertButton } from "../companion/InferenceCloudAlertButton";
import { resolveCompanionInferenceNotice } from "../companion/resolve-companion-inference-notice";
import { ProfilesDialog } from "./ProfilesDialog";
import {
HEADER_BUTTON_STYLE,
HEADER_ICON_BUTTON_CLASSNAME,
Expand Down Expand Up @@ -130,16 +131,9 @@ export function Header({
[tab, tabGroups],
);

const shellMode =
tab === "character" || tab === "character-select"
? "native"
: (uiShellMode ?? "companion");
const shellMode = uiShellMode ?? "companion";
const activeShellView =
shellMode === "companion"
? "companion"
: tab === "character" || tab === "character-select"
? "character"
: "desktop";
shellMode === "companion" ? "companion" : "desktop";
const isDesktopShell = activeShellView === "desktop";
const showNavigationMenu = isDesktopShell;
const showCloudStatus = isDesktopShell && !hideCloudCredits;
Expand Down Expand Up @@ -317,18 +311,14 @@ export function Header({
</>
}
showCompanionControls={
activeShellView === "companion" ||
activeShellView === "character"
activeShellView === "companion"
}
chatAgentVoiceMuted={chatAgentVoiceMuted}
onToggleVoiceMute={() =>
setState("chatAgentVoiceMuted", !chatAgentVoiceMuted)
}
onNewChat={
activeShellView === "character"
? undefined
: () => void handleNewConversation()
}
onNewChat={() => void handleNewConversation()}
companionActionExtras={<ProfilesDialog />}
trailingExtras={
showNavigationMenu ? (
<Button
Expand Down
Loading
Loading