Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(editor): give the agent a door you can see

esengine54c647c40398
diff --git a/desktop/src/layout/ActivityBar.tsx b/desktop/src/layout/ActivityBar.tsx
index 510d9937a..53de1cf5b 100644
--- a/desktop/src/layout/ActivityBar.tsx
+++ b/desktop/src/layout/ActivityBar.tsx
@@ -3,10 +3,11 @@
// Far-left icon rail (activity bar). Switches the editing mode, reveals docked
// panels, and toggles the Content Drawer — the summoned quick-access surface.
import { useSyncExternalStore } from 'react';
-import { ListTree, SlidersHorizontal, SlidersVertical, FolderOpen, Terminal, Clapperboard, Gauge, Settings } from 'lucide-react';
+import { ListTree, SlidersHorizontal, SlidersVertical, FolderOpen, Terminal, Clapperboard, Gauge, Settings, Sparkles } from 'lucide-react';
import { useEditorStore } from '@/store/editorStore';
import { useEditorMode } from '@/store/editorModeStore';
import { useSelection } from '@/store/selectionStore';
+import { useAgent } from '@/store/AgentStore';
import { editorModes, editorModeRegistry } from '@/mode/editorModes';
import { activeMode } from '@/mode/activeMode';
import { dockApi } from '@/layout/dockApi';
@@ -16,6 +17,11 @@ import { t } from '@/i18n';
export function ActivityBar() {
const contentDrawer = useEditorStore((s) => s.contentDrawer);
const toggleContentDrawer = useEditorStore((s) => s.toggleContentDrawer);
+ const agentDrawer = useEditorStore((s) => s.agentDrawer);
+ const toggleAgentDrawer = useEditorStore((s) => s.toggleAgentDrawer);
+ // Working, or waiting on you — the rail is visible with the drawer closed, so
+ // it is where "it still needs something from me" has to be legible.
+ const agentPhase = useAgent((s) => s.status.phase);
// The active mode is derived from the pin + selection; subscribe to both so the
// highlighted mode button tracks selection-driven changes, not just explicit pins.
useEditorMode((s) => s.pinned);
@@ -103,6 +109,17 @@ export function ActivityBar() {
<span className="act-spacer" />
+ {/* Above Settings, below the panels: the agent is a thing you summon, not
+ a panel you dock. The palette also takes a sentence — this is the entry
+ for people who have not learned that yet, which is everyone at first. */}
+ <button
+ type="button"
+ className={`act act-agent${agentDrawer ? ' active' : ''}${agentPhase !== 'idle' ? ' busy' : ''}${agentPhase === 'awaiting_confirm' ? ' asking' : ''}`}
+ title={t('agent.open')}
+ onClick={toggleAgentDrawer}
+ >
+ <Sparkles size={19} strokeWidth={1.7} />
+ </button>
<button
type="button"
className="act"
diff --git a/desktop/src/layout/menus.ts b/desktop/src/layout/menus.ts
index 6e473222f..6b171f116 100644
--- a/desktop/src/layout/menus.ts
+++ b/desktop/src/layout/menus.ts
@@ -119,6 +119,7 @@ const BUILTIN_ITEMS: MenuContribution[] = [
// Resets only the dock layout, rebuilt in place (keeps scene/engine/undo), and
// guarded so a wedged dirty asset-editor tab can't vanish unwarned.
+ cmd('window', 'layout', 'agent.open'),
cmd('window', 'layout', 'view.resetLayout'),
cmd('window', 'layout', 'plugins.open'),
{
diff --git a/desktop/src/theme/agent.css b/desktop/src/theme/agent.css
index e1e21990e..6faf0eed6 100644
--- a/desktop/src/theme/agent.css
+++ b/desktop/src/theme/agent.css
@@ -421,3 +421,22 @@
vertical-align: middle;
}
.row.agent-peek { box-shadow: inset 2px 0 0 var(--nebula); }
+
+/* ── The rail button ────────────────────────────────────────────────────────
+ A dot, because the rail is visible with the drawer closed and "it is still
+ working" / "it is waiting on me" have to be legible from across the window.
+ Amber outranks the neutral working dot: one of the two states blocks. */
+.act-agent { position: relative; }
+.act-agent.busy::after {
+ content: '';
+ position: absolute;
+ top: 5px; right: 4px;
+ width: 5px; height: 5px;
+ border-radius: 50%;
+ background: var(--nebula);
+}
+.act-agent.asking::after { background: var(--warn); }
+@media (prefers-reduced-motion: no-preference) {
+ .act-agent.asking::after { animation: ag-pulse 1.6s ease-in-out infinite; }
+}
+@keyframes ag-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
diff --git a/desktop/tests/menu-registry.test.ts b/desktop/tests/menu-registry.test.ts
index 47c4530b9..77d894c4a 100644
--- a/desktop/tests/menu-registry.test.ts
+++ b/desktop/tests/menu-registry.test.ts
@@ -48,8 +48,10 @@ describe('menu registry', () => {
]);
expect(layout('build')).toEqual(['project.export', null, 'build.scripts', 'project.extractSchemas']);
// `plugins.open` joined the layout group after the migration — the Plugins panel
- // is opened on demand, so a menu row is how it's reached.
- expect(layout('window')).toEqual(['view.resetLayout', 'plugins.open', null, 'project.close']);
+ // is opened on demand, so a menu row is how it's reached. `agent.open` is
+ // there for the same reason, and leads: it is the one surface here with no
+ // dock tab and no chord of its own.
+ expect(layout('window')).toEqual(['agent.open', 'view.resetLayout', 'plugins.open', null, 'project.close']);
expect(layout('help')).toEqual([
'help.about', 'help.checkUpdates', null, 'palette.open', 'help.shortcuts', null, 'help.openLogs',
]);