diff --git a/.changeset/37455-studio-top-bar-tenants-rehome.md b/.changeset/37455-studio-top-bar-tenants-rehome.md
new file mode 100644
index 00000000000..5cc6f379fde
--- /dev/null
+++ b/.changeset/37455-studio-top-bar-tenants-rehome.md
@@ -0,0 +1,15 @@
+---
+'@object-ui/app-shell': patch
+---
+
+feat(studio): Save and Cancel sit in the page's item header, the AI assistant ends every title row, and all of Studio draws graphite
+
+Clause-②: no
+Metadata-protocol: none
+
+The Studio top bar's page controls move to the open page's own title row, as the first step of removing the bar. They work exactly as before; only their place changes.
+
+- **Cancel and Save** end the item header's actions (an object, a flow, a permission set, any item page), after the page's own buttons. A page that saves with no item header ends its own title row with them. They are drawn only while the page holds unsaved edits, as before.
+- **The AI assistant** (or, with no assistant served, the right panel's show / hide button) ends every page's title row, the list page's and the item header's, behind a hairline, as the app's page header ends with its button group. `⌘.` still switches the right panel.
+- Only the page's own title row draws them, so a page never shows two Saves. Outside Studio (Setup's metadata pages) nothing changes.
+- **Studio draws in its own graphite everywhere**, never the app's theme colour: buttons, links, hovers and focus rings on every Studio page, and also the dialogs, menus, popovers, sheets, tooltips, toasts and command palette that Studio opens. Leaving Studio gives the app's pages their own colour back.
diff --git a/ui/packages/app-shell/src/views/metadata-admin/DiagnosticsPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/DiagnosticsPage.tsx
index 5008f1633b7..c6d3dccd79f 100644
--- a/ui/packages/app-shell/src/views/metadata-admin/DiagnosticsPage.tsx
+++ b/ui/packages/app-shell/src/views/metadata-admin/DiagnosticsPage.tsx
@@ -34,6 +34,7 @@ import {
import { useMetadataAreaHost } from './metadataAreaHost.js';
import { t, tFormat, translateMetadataType, useMetadataLocale } from './i18n.js';
import { diagnosticsHeaderTone, type DiagnosticsHeaderTone } from './diagnostics-tone.js';
+import { StudioTitleRowEnd } from '../studio-design/studioTitleRow.js';
type Severity = 'error' | 'warning';
@@ -173,6 +174,8 @@ export function MetadataDiagnosticsPage() {
{t('engine.diagnostics.refresh', locale)}
+ {/* objectstack#37455 — under Studio, the page's Save and the AI assistant end the title row. */}
+
{t('engine.diagnostics.description', locale)}
diff --git a/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx b/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx
index d98cc96df79..525a04c13f3 100644
--- a/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx
+++ b/ui/packages/app-shell/src/views/metadata-admin/DirectoryPage.tsx
@@ -58,6 +58,7 @@ import { ENVIRONMENT_SCOPE_QUERY } from './catalog-scope.js';
import { usePackageCustomizations } from '../studio-design/CustomizationMark.js';
import { customizationCountsByType, customizationTotal } from '../studio-design/customizationMarks.js';
import { STUDIO_MENU_GROUPS } from '../studio-design/studioMenuModel.js';
+import { StudioTitleRowEnd } from '../studio-design/studioTitleRow.js';
/**
* objectstack#37360 — on a package under Studio's area, the types this page
@@ -280,7 +281,13 @@ export function MetadataDirectoryPage() {
{/* Header */}
-
{t('engine.directory.title', locale)}
+ {/* objectstack#37455 — under Studio, the page's Save and the AI assistant end the title row. */}
+
+
{t('engine.directory.title', locale)}
+
+
+
+
{t('engine.directory.description', locale)}
diff --git a/ui/packages/app-shell/src/views/metadata-admin/PageShell.tsx b/ui/packages/app-shell/src/views/metadata-admin/PageShell.tsx
index 6370e795c60..153da831eaa 100644
--- a/ui/packages/app-shell/src/views/metadata-admin/PageShell.tsx
+++ b/ui/packages/app-shell/src/views/metadata-admin/PageShell.tsx
@@ -26,6 +26,7 @@ import { environmentScopeSuffix } from './catalog-scope.js';
import { useMetadataAreaHost } from './metadataAreaHost.js';
import { isStudioCustomizeType } from '../studio-design/StudioCustomizeControls.js';
import { AREA_CUSTOMIZE_EDITOR_TYPES, AREA_FORM_EDITOR_TYPES } from '../studio-design/metadataArea.js';
+import { StudioTitleRowEnd } from '../studio-design/studioTitleRow.js';
export interface PageShellProps {
/** The type entry from `/meta/types` (or a synthesized stub). */
@@ -321,6 +322,10 @@ export function PageShell({
))}
{actions}
+ {/* objectstack#37455 — under Studio, the page's Save and the AI
+ assistant end the title row (nothing elsewhere, nor embedded
+ in another page). */}
+ {!embedded && }
@@ -376,6 +381,8 @@ export function PageShell({
))}
{actions}
+ {/* objectstack#37455 — under Studio, the page's Save and the AI assistant end the title row. */}
+ {!embedded && }
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx
new file mode 100644
index 00000000000..613d34bb141
--- /dev/null
+++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.graphite-37455.test.tsx
@@ -0,0 +1,193 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#37455 (decision 4 of epic objectstack#37424) — under a
+ * non-default app theme, nothing Studio draws takes the app's colour:
+ *
+ * - the surface's root carries Studio's accent (`STUDIO_ACCENT`), so every
+ * button, link and hover inside it reads graphite;
+ * - a surface Studio draws in a portal on `body` (here the command palette's
+ * dialog) sits under the same accent, which `body` carries while Studio is
+ * mounted;
+ * - the accent comes off `body` when Studio unmounts, and the app's own
+ * branding on the page root is left as the app wrote it.
+ *
+ * The app's theme is written by the app shell's own hook
+ * (`useAppShellBranding`, a rose primary and an amber accent), not by hand.
+ * jsdom computes no Tailwind, so the pins read the class scope a node sits in,
+ * as the menu's own graphite pin (`StudioMenu.test.tsx`) does.
+ */
+
+import '@testing-library/jest-dom/vitest';
+import * as React from 'react';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { cleanup, render, screen, waitFor } from '@testing-library/react';
+import { MemoryRouter, Route, Routes } from 'react-router-dom';
+import { useAppShellBranding } from '@object-ui/layout';
+
+const PACKAGE_ID = 'com.acme.app';
+
+vi.mock('sonner', () => ({
+ toast: { error: vi.fn(), success: vi.fn(), info: vi.fn(), warning: vi.fn(), dismiss: vi.fn() },
+ Toaster: () => null,
+}));
+
+const mockClient = {
+ save: vi.fn(async () => ({})),
+ list: vi.fn(async () => []),
+ listDrafts: vi.fn(async () => []),
+ listTypes: vi.fn(async () => ({ entries: [] })),
+ layered: vi.fn(async (_type: string, name: string) => ({ effective: { name } })),
+ getDraft: vi.fn(async () => null),
+ get: vi.fn(async () => undefined),
+ references: vi.fn(async () => []),
+ withPreviewDrafts() {
+ return this;
+ },
+};
+
+vi.mock('../metadata-admin/useMetadata', async (importOriginal) => {
+ const actual = await importOriginal>();
+ return {
+ ...actual,
+ useMetadataClient: () => mockClient,
+ useMetadataTypes: () => ({ loading: false, error: null, entries: [] }),
+ };
+});
+vi.mock('@object-ui/react', async (importOriginal) => {
+ const actual = await importOriginal>();
+ return { ...actual, useAdapter: () => ({}) };
+});
+vi.mock('../../components/SuggestedBindingsPanel', () => ({ SuggestedBindingsPanel: () => null }));
+vi.mock('../metadata-admin/AccessExplainPanel', () => ({ AccessExplainPanel: () => null }));
+vi.mock('../../preview/DraftChangesPanel', () => ({ DraftChangesPanel: () => null }));
+vi.mock('./StudioAiCopilot', () => ({
+ StudioChatDock: ({ onStatusChange }: { onStatusChange?: (s: { available: boolean; planPendingCount: number }) => void }) => {
+ React.useEffect(() => {
+ onStatusChange?.({ available: true, planPendingCount: 0 });
+ }, [onStatusChange]);
+ return
conversation
;
+ },
+}));
+
+// The source loads `@objectstack/lint` lazily; paid here, at collection, not
+// inside a case's clock (check:test-source-alias).
+import '@objectstack/lint';
+// The surface mounts the command palette, which reaches the record preview's
+// `lazy()` detail entry: its first load is paid at collection too.
+import '@object-ui/plugin-detail';
+import { StudioDesignSurface } from './StudioDesignSurface';
+import { STUDIO_ACCENT, STUDIO_ACCENT_HSL } from './studio-tokens';
+import { COMMAND_PALETTE_TESTID } from '../../context/CommandPaletteProvider';
+
+const answer = (body: unknown) => ({ ok: true, status: 200, json: async () => body });
+const ACCENT_CLASSES = STUDIO_ACCENT.split(/\s+/).filter(Boolean);
+/** One of the accent's classes, as a selector for the scope a node sits in. */
+const ACCENT_SCOPE = `[class~="${ACCENT_CLASSES[0]}"]`;
+const BRAND_TOKENS = [
+ '--primary',
+ '--primary-foreground',
+ '--ring',
+ '--sidebar-primary',
+ '--sidebar-ring',
+ '--accent',
+ '--accent-foreground',
+ '--brand-primary',
+ '--brand-primary-hsl',
+ '--brand-accent',
+ '--brand-accent-hsl',
+];
+
+beforeEach(() => {
+ window.sessionStorage.clear();
+ vi.stubGlobal(
+ 'fetch',
+ vi.fn(async (input: unknown) =>
+ String(input) === '/api/v1/packages'
+ ? answer({ success: true, data: { packages: [{ manifest: { id: PACKAGE_ID, name: 'Acme' }, writable: true }] } })
+ : answer([]),
+ ),
+ );
+ vi.stubGlobal('matchMedia', (query: string) => ({
+ matches: false,
+ media: query,
+ onchange: null,
+ addEventListener: () => {},
+ removeEventListener: () => {},
+ addListener: () => {},
+ removeListener: () => {},
+ dispatchEvent: () => false,
+ }));
+});
+
+afterEach(() => {
+ cleanup();
+ vi.unstubAllGlobals();
+ for (const token of BRAND_TOKENS) document.documentElement.style.removeProperty(token);
+});
+
+/** An app with a non-default theme, written on the page root by the app shell's own hook. */
+function BrandedApp({ studio }: { studio: boolean }): React.ReactElement {
+ useAppShellBranding({ primaryColor: '#e11d48', accentColor: '#f59e0b' });
+ return (
+
+
+ :
app
} />
+
+
+ );
+}
+
+/** The accent scope's every class is on `el`. */
+function carriesAccent(el: Element): boolean {
+ return ACCENT_CLASSES.every((cls) => el.classList.contains(cls));
+}
+
+describe('a non-default app theme does not tint Studio (objectstack#37455)', () => {
+ it('CONTROL: the app\'s colour is on the page root, and it is not graphite', async () => {
+ render();
+ await screen.findByTestId('studio-shell-header');
+ const root = document.documentElement.style;
+ expect(root.getPropertyValue('--primary').trim()).not.toBe('');
+ expect(root.getPropertyValue('--accent').trim()).not.toBe('');
+ expect(root.getPropertyValue('--primary').trim()).not.toBe(STUDIO_ACCENT_HSL.light);
+ });
+
+ it('the surface\'s root carries Studio\'s accent: its header, the page and its buttons sit under it', async () => {
+ render();
+ const header = await screen.findByTestId('studio-shell-header');
+ const scope = header.closest(ACCENT_SCOPE);
+ expect(scope).not.toBeNull();
+ expect(scope).not.toBe(document.body);
+ expect(carriesAccent(scope as Element)).toBe(true);
+ expect(scope).toContainElement(screen.getByTestId('studio-pillars-host'));
+ expect(scope).toContainElement(await screen.findByTestId('topbar-ai-assistant'));
+ });
+
+ it('a portalled surface (the command palette) is outside the root and still under the accent, on body', async () => {
+ render();
+ const header = await screen.findByTestId('studio-shell-header');
+ const palette = await waitFor(() => {
+ const el = document.querySelector(`[data-testid="${COMMAND_PALETTE_TESTID}"]`);
+ expect(el).not.toBeNull();
+ return el as HTMLElement;
+ });
+ const studioRoot = header.closest(ACCENT_SCOPE) as Element;
+ expect(studioRoot.contains(palette)).toBe(false);
+ expect(palette.closest(ACCENT_SCOPE)).toBe(document.body);
+ expect(carriesAccent(document.body)).toBe(true);
+ });
+
+ it('Studio unmounted: the accent leaves body, and the app\'s branding on the page root is as the app wrote it', async () => {
+ const { rerender } = render();
+ await screen.findByTestId('studio-shell-header');
+ const primary = document.documentElement.style.getPropertyValue('--primary');
+ expect(carriesAccent(document.body)).toBe(true);
+
+ rerender();
+ await screen.findByTestId('app-page');
+ for (const cls of ACCENT_CLASSES) expect(document.body).not.toHaveClass(cls);
+ expect(document.body).not.toHaveAttribute('data-studio-accent');
+ expect(document.documentElement.style.getPropertyValue('--primary')).toBe(primary);
+ });
+});
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx
index e01eb0b7829..91c14c7d9b6 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.rightSlot-12725.test.tsx
@@ -9,8 +9,9 @@
* - Selecting a canvas element switches it to that element's properties, the
* copilot folded to a strip at the slot's foot; Esc, or a click on empty
* canvas, returns to the item's own properties.
- * - `⌘.` / `Ctrl+.` switches the two; the top bar's right-most icon hides the
- * slot, remembered under the Studio key, never the console's.
+ * - `⌘.` / `Ctrl+.` switches the two; the right-most icon of the page's title
+ * row (the top bar's, before objectstack#37455) hides the slot, remembered
+ * under the Studio key, never the console's.
* - The canvas has no 画布 / 源码 / 属性 tabs: one status line, and the item's
* definition opens from its ⋯ menu.
* - The pillar names are visible from 1024 px (`lg`), icons below.
@@ -194,6 +195,42 @@ describe('Studio right slot — controls (objectui#12725)', () => {
});
+// objectstack#37455 — the slot's control left the top bar for the end of the
+// open page's title row: the item header's, and the list page's.
+describe('Studio right slot — its control ends the page\'s title row (objectstack#37455)', () => {
+ it('the sharing overview: the AI assistant ends its item header behind a hairline, not the top bar, and hides and shows the slot', async () => {
+ renderAt('owd');
+ await waitFor(() => expect(slot()).toHaveAttribute('data-mode', 'copilot'));
+ const itemHeader = screen.getByTestId('owd-item-header');
+ const ai = await within(itemHeader).findByTestId('topbar-ai-assistant');
+ expect(within(screen.getByTestId('studio-shell-header')).queryByTestId('topbar-ai-assistant')).toBeNull();
+ expect(screen.getAllByTestId('topbar-ai-assistant')).toHaveLength(1);
+ // The last control of the header's action slot, the hairline right before it.
+ const actionSlot = ai.parentElement as HTMLElement;
+ expect(actionSlot.lastElementChild).toBe(ai);
+ expect(ai.previousElementSibling).toHaveAttribute('data-testid', 'studio-title-row-divider');
+ expect(within(actionSlot).getByTestId('access-explain')).toBeInTheDocument();
+
+ expect(slot()).toBeVisible();
+ expect(ai).toHaveAttribute('aria-pressed', 'true');
+ fireEvent.click(ai);
+ expect(slot()).not.toBeVisible();
+ expect(within(itemHeader).getByTestId('topbar-ai-assistant')).toHaveAttribute('aria-pressed', 'false');
+ fireEvent.click(within(itemHeader).getByTestId('topbar-ai-assistant'));
+ expect(slot()).toBeVisible();
+ expect(slot()).toHaveAttribute('data-mode', 'copilot');
+ });
+
+ it('a list page: the AI assistant ends the list\'s title row, inside the page, not the top bar', async () => {
+ renderAt('data');
+ const ai = await screen.findByTestId('topbar-ai-assistant', undefined, { timeout: 4000 });
+ expect(within(screen.getByTestId('studio-shell-header')).queryByTestId('topbar-ai-assistant')).toBeNull();
+ expect(screen.getByTestId('studio-pillars-host')).toContainElement(ai);
+ expect(ai.closest('[data-slot="studio-title-row-end"]')).not.toBeNull();
+ expect(screen.getAllByTestId('topbar-ai-assistant')).toHaveLength(1);
+ });
+});
+
// objectstack#35061 item 1 — the pillars' host is what every rail's narrow form
// measures, and it says whether the slot squeezes it.
describe('Studio right slot — the rails read whether it squeezes the pillars (objectstack#35061)', () => {
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx
index 23c739df421..309215de204 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.saveBar-36511.test.tsx
@@ -1,15 +1,17 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
/**
- * objectstack#36511 — the top bar of the Studio surface: Cancel and Save
- * where Publish was, Changes and Publish only for drafts.
+ * objectstack#36511 — the Studio surface's Cancel and Save, Changes and
+ * Publish only for drafts. objectstack#37455 — Cancel and Save moved from the
+ * top bar to the page's item header, behaviour unchanged.
*
* - With no draft pending, the top bar draws neither Changes nor Publish.
- * - An edit on the object page draws Cancel and Save in the top bar's right
- * column; Save is its last action.
- * - With a draft pending (the copilot's), Changes and Publish are drawn, at the
- * left of Cancel and Save, and a publish is refused while the page holds
- * edits Save has not sent: the publish re-reads the page and would drop them.
+ * - An edit on the object page draws Cancel and Save at the end of the item
+ * header's actions, not in the top bar; Save is the last action, and only
+ * the assistant (behind its hairline) follows it.
+ * - With a draft pending (the copilot's), Changes and Publish are drawn in the
+ * top bar, and a publish is refused while the page holds edits Save has not
+ * sent: the publish re-reads the page and would drop them.
*
* Real: the surface, the Data pillar, the coordinator and `usePendingDrafts`.
* Doubles: the metadata client's reads and transport, the `_drafts` ledger
@@ -130,7 +132,7 @@ afterEach(() => {
const CHANGES = new RegExp(`^${t('engine.studio.changes', 'en')}`);
const PUBLISH = new RegExp(`^${t('engine.studio.publish', 'en')}$`);
-async function mountAndEdit(): Promise {
+async function mountAndEdit(): Promise<{ header: HTMLElement; itemHeader: HTMLElement }> {
render(
@@ -141,43 +143,49 @@ async function mountAndEdit(): Promise {
);
fireEvent.click(await screen.findByRole('button', { name: 'Field layout' }, { timeout: 4000 }));
await addFieldFromFormToolbar(undefined, { label: 'Due' });
- return screen.getByTestId('studio-shell-header');
+ return { header: screen.getByTestId('studio-shell-header'), itemHeader: screen.getByTestId('data-object-header') };
}
-describe('the Studio top bar: Save where Publish was, Changes and Publish for drafts (objectstack#36511)', () => {
- it('with no draft pending: no Changes, no Publish; an edit draws Cancel and Save at the right', async () => {
- const header = await mountAndEdit();
- const save = await within(header).findByTestId('studio-save');
- const cancel = within(header).getByTestId('studio-cancel');
+/** The item header's action slot: the right-aligned box of its title row. */
+const actionSlot = (save: HTMLElement): HTMLElement => save.parentElement as HTMLElement;
+
+describe('the Studio page\'s Save and Cancel, Changes and Publish for drafts (objectstack#36511, objectstack#37455)', () => {
+ it('with no draft pending: no Changes, no Publish; an edit draws Cancel and Save at the end of the item header', async () => {
+ const { header, itemHeader } = await mountAndEdit();
+ const save = await within(itemHeader).findByTestId('studio-save');
+ const cancel = within(itemHeader).getByTestId('studio-cancel');
+ // objectstack#37455 — nothing of the pair is left in the top bar.
+ expect(within(header).queryByTestId('studio-save')).toBeNull();
+ expect(within(header).queryByTestId('studio-cancel')).toBeNull();
+ expect(screen.getAllByTestId('studio-save')).toHaveLength(1);
expect(within(header).queryByRole('button', { name: CHANGES })).toBeNull();
expect(within(header).queryByRole('button', { name: PUBLISH })).toBeNull();
- // Cancel, then Save: the last of the right column's actions, where Publish
- // was; only the slot's show/hide icon follows it, as it followed Publish.
+ // Cancel, then Save: the last of the item header's actions; only the
+ // assistant follows it, behind the hairline.
expect(cancel.compareDocumentPosition(save) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- const column = save.parentElement as HTMLElement;
- const actions = within(column)
+ const actions = within(actionSlot(save))
.getAllByRole('button')
- .filter((b) => b.getAttribute('data-testid') !== 'studio-slot-toggle');
+ .filter((b) => !['studio-slot-toggle', 'topbar-ai-assistant'].includes(b.getAttribute('data-testid') ?? ''));
expect(actions[actions.length - 1]).toBe(save);
expect(writes).toEqual([]);
});
- it('with a draft pending: Changes and Publish at the left of Cancel and Save; Publish waits for Save', async () => {
+ it('with a draft pending: Changes and Publish in the top bar, Cancel and Save in the item header; Publish waits for Save', async () => {
ledger.drafts = [{ type: 'flow', name: 'a_notify', packageId: PACKAGE_ID }];
- const header = await mountAndEdit();
+ const { header, itemHeader } = await mountAndEdit();
const changes = await within(header).findByRole('button', { name: CHANGES }, { timeout: 4000 });
const publish = within(header).getByRole('button', { name: PUBLISH });
- const cancel = await within(header).findByTestId('studio-cancel');
- const save = within(header).getByTestId('studio-save');
+ const cancel = await within(itemHeader).findByTestId('studio-cancel');
+ const save = within(itemHeader).getByTestId('studio-save');
expect(changes.compareDocumentPosition(publish) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
- expect(publish.compareDocumentPosition(cancel) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
expect(cancel.compareDocumentPosition(save) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ expect(within(header).queryByTestId('studio-save')).toBeNull();
await act(async () => {
fireEvent.click(screen.getByTestId('sheet-publish-all'));
});
expect(toast.error).toHaveBeenCalledWith(t('engine.studio.save.publishFirst', 'en'));
expect(writes.filter((w) => w.includes('publish'))).toEqual([]);
- await waitFor(() => expect(within(header).getByTestId('studio-save')).toBeInTheDocument());
+ await waitFor(() => expect(within(itemHeader).getByTestId('studio-save')).toBeInTheDocument());
});
});
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx
index da3b6c68301..99c7f9a62eb 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.tsx
@@ -31,6 +31,8 @@ import { canonicalMetaUrlType } from '@objectstack/spec/shared';
import { resolveI18nLabel, type I18nLabel } from '@objectstack/spec/ui';
import { StudioChatDock, type StudioCopilotStatus, type StudioSurfaceLabel } from './StudioAiCopilot.js';
import { StudioRightSlot } from './StudioRightSlot.js';
+import { StudioTitleRowProvider } from './studioTitleRow.js';
+import { useStudioAccentOnBody } from './studioAccent.js';
import { AssistantTopBarButton } from '../../layout/AssistantTopBarButton.js';
import { ChatDockControlProvider, type ChatDockControl } from '../../layout/chatDockControl.js';
import {
@@ -47,6 +49,7 @@ import {
} from '../../layout/chatDockState.js';
import type { AppMarkApp } from '../../layout/AppMark.js';
import {
+ STUDIO_ACCENT,
STUDIO_HEADER,
STUDIO_HEADER_ICON_BUTTON,
STUDIO_HEADER_PACKAGE_COLUMN,
@@ -435,7 +438,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
// objectstack#26705 — a held edit lives only in the pillar's buffer, so a
// departure drops it exactly as it drops a dirty pillar's edits: both are
// unsaved work, and every guard below reads this one bit. objectstack#36511
- // — so does an edit waiting for the top bar's Save.
+ // — so does an edit waiting for the page's Save.
const unsavedPillarWork = pillarDirty || heldEdit !== null || saveBar.dirty;
// objectstack#36900 — every departure this surface starts asks the shell's
// unsaved-edits seam, not only this surface's own bit: the seam holds this
@@ -1289,7 +1292,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
className={cn(
// The border is on both states so the swap never shifts the bar.
'inline-flex h-8 items-center gap-1.5 rounded-md border px-3 text-[13px] font-medium',
- // objectstack#36511 — beside the top bar's Save, Save is the primary action.
+ // objectstack#36511 — while the page holds unsaved edits, its Save is the primary action.
publishing || (!publishReadOnly && !saveBar.dirty)
? 'border-transparent bg-primary text-primary-foreground disabled:opacity-50'
: 'text-muted-foreground',
@@ -1302,14 +1305,53 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
);
+ // objectstack#37455 — the top bar's page controls, placed by the open
+ // page's title row (`studioTitleRow.tsx`). objectstack#36511 — the page's
+ // Cancel and Save: drawn only while the open page holds unsaved edits,
+ // never in a package that is not there nor on the cross-package leg.
+ const titleRowSave =
+ !pkgMissing && !allScope && (saveBar.dirty || saveBar.saving) ? (
+
+ ) : null;
+ // objectui#12725 — the title row's right-most icon shows or hides the right
+ // slot; `⌘.` switches what it shows. objectstack#34725 — with a copilot
+ // served, that icon is the console top bar's robot (the same component),
+ // and it opens the slot on the AI assistant. Without one, the panel icon
+ // stays for the properties.
+ const titleRowAssistant =
+ !slotHost || !slotHasContent ? null : copilotAvailable ? (
+
+
+
+ ) : (
+
+ );
+
+ // objectstack#37455 — and on what Studio draws in a portal on `body`
+ // (dialogs, menus, sheets, tooltips, toasts, the palette), while mounted.
+ useStudioAccentOnBody();
+
const page = (
+
{/* objectstack#36899 — the left menu's provider is the frame: the app
sidebar's, under Studio's own collapse cookie (`StudioMenu.tsx`). */}
-
+ {/* objectstack#37455 — Studio's graphite on its root: nothing Studio
+ draws takes the app's theme colour (decision 4 of #37424). */}
+
{/* The ADR-0080 `aiSlot` seam — a cloud edition may still inject its own
* left copilot panel; the built-in copilot is the RIGHT dock below. */}
{/* objectstack#32615 — not beside a package that is not there. */}
@@ -1323,7 +1365,8 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
package actions at the right. objectstack#36899 — the pillars
that sat between them are gone: the left menu is Studio's one
navigation, and its show / hide control leads the bar. Changes
- and Publish stay at the right end, beside Cancel and Save. */}
+ and Publish stay at the right end; objectstack#37455 — Cancel
+ and Save moved to the page's item header. */}
{showMenu && }
{/* objectstack#36501 — 「‹ Back to app」, the app's name and the
@@ -1391,7 +1434,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
{/* objectstack#36511 — Changes and Publish are for drafts, which
the copilot and the editors still on drafts (the Interfaces
pillar, the Metadata area) leave: drawn only while one is
- pending, at the left of Cancel and Save. */}
+ pending. */}
{hasPending && (
<>
{/* objectui#12459 — the pending count is a pill, not "· N" text. */}
@@ -1451,40 +1494,10 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
)}
>
)}
- {/* objectstack#36511 — the page's Cancel and Save, where Publish
- was: drawn only while the open page holds unsaved edits. */}
-
+ {/* objectstack#37455 — the page's Cancel and Save moved to its
+ item header, and the AI assistant to the end of its title
+ row (`titleRowSave`, `titleRowAssistant` above). */}
>)}
- {/* objectui#12725 — the top bar's right-most icon shows or hides
- the right slot; `⌘.` switches what it shows.
- objectstack#34725 — with a copilot served, that icon is the
- console top bar's robot (the same component, in the same
- place), and it opens the slot on the AI assistant. Without
- one, the panel icon stays for the properties. */}
- {slotHost && slotHasContent && copilotAvailable && (
- <>
-
-
-
-
- >
- )}
- {slotHost && slotHasContent && !copilotAvailable && (
- <>
-
-
- >
- )}
@@ -1709,6 +1722,7 @@ function StudioDesignSurfaceBody({ aiSlot, area }: StudioDesignSurfaceProps): Re
{/* objectstack#36900 — the command palette, in its `studio` scope, with this page's groups. */}
{!paletteHosted && }
+
diff --git a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx
index 32d98603285..71cbacc7339 100644
--- a/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/StudioItemHeader.tsx
@@ -58,6 +58,13 @@
* its icon says a draft is there). Folded, the row's boxes fit the row, so
* the ⋯ trigger stays inside the column, not under the right panel. Like
* every rule here, it measures the header's own row, never the viewport.
+ *
+ * objectstack#37455 — the page's Cancel and Save and the AI assistant, which
+ * sat in the Studio top bar, end the actions slot: Cancel and Save after the
+ * pillar's own actions, then, behind a hairline, the assistant (the front
+ * end's page-header group, objectstack#36111). The surface hands them in
+ * (`studioTitleRow.tsx`); outside it, and in a header nested under the page's
+ * own, the slot holds the pillar's actions alone.
*/
import * as React from 'react';
@@ -90,6 +97,7 @@ import {
STUDIO_TAB_IDLE,
STUDIO_TAB_ROW,
} from './studio-tokens.js';
+import { StudioTitleRowDivider, useStudioTitleRowControls } from './studioTitleRow.js';
/** The item's status, drawn by the header as one amber chip (objectui#12524). */
export interface StudioItemStatus {
@@ -674,6 +682,10 @@ export function StudioItemHeader({
);
const ownMenu = typeof foldMenu === 'object' ? foldMenu : null;
const hasFolded = folded && (!!apiName || !!chips || tools.length > 0);
+ // objectstack#37455 — the surface's Save and assistant, on the page's first title row.
+ const titleRowControls = useStudioTitleRowControls(titleRowRef);
+ const save = titleRowControls?.save ?? null;
+ const assistant = titleRowControls?.assistant ?? null;
return (
diff --git a/ui/packages/app-shell/src/views/studio-design/studioAccent.ts b/ui/packages/app-shell/src/views/studio-design/studioAccent.ts
new file mode 100644
index 00000000000..3c8ec64d9b9
--- /dev/null
+++ b/ui/packages/app-shell/src/views/studio-design/studioAccent.ts
@@ -0,0 +1,45 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * Studio's graphite on what Studio draws outside its own root
+ * (objectstack#37455, decision 4 of epic objectstack#37424): every Studio
+ * surface draws graphite, never the app's theme colour.
+ *
+ * The surface mounts {@link STUDIO_ACCENT} on its root (`StudioDesignSurface`),
+ * which reaches everything drawn inside it. A dialog, a popover, a dropdown, a
+ * sheet, a tooltip, a toast and the command palette are drawn in a portal on
+ * `document.body`, outside that root, where they would read the app's colour
+ * the app's branding wrote on the page root (`useAppShellBranding`). The
+ * portal primitives (`@object-ui/components`) take no container, so while a
+ * Studio surface is mounted the same class sits on `body` too, and comes off
+ * when the last one unmounts: the app's pages after Studio draw their own
+ * colour again. The page root's inline branding is never touched, so the
+ * app's branding needs no repair when Studio leaves.
+ */
+
+import * as React from 'react';
+import { STUDIO_ACCENT } from './studio-tokens.js';
+
+/** The accent's classes, one by one, for `classList`. */
+const STUDIO_ACCENT_CLASSES = STUDIO_ACCENT.split(/\s+/).filter(Boolean);
+
+/** How many Studio surfaces are mounted: the class comes off `body` with the last. */
+let mountedSurfaces = 0;
+
+/** Puts Studio's accent on `body` while the calling surface is mounted. */
+export function useStudioAccentOnBody(): void {
+ React.useLayoutEffect(() => {
+ const body = document.body;
+ mountedSurfaces += 1;
+ if (mountedSurfaces === 1) {
+ body.classList.add(...STUDIO_ACCENT_CLASSES);
+ body.setAttribute('data-studio-accent', '');
+ }
+ return () => {
+ mountedSurfaces -= 1;
+ if (mountedSurfaces > 0) return;
+ body.classList.remove(...STUDIO_ACCENT_CLASSES);
+ body.removeAttribute('data-studio-accent');
+ };
+ }, []);
+}
diff --git a/ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx b/ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx
index ae5d95e8474..5575b4597cd 100644
--- a/ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx
+++ b/ui/packages/app-shell/src/views/studio-design/studioSaveBar.tsx
@@ -1,9 +1,10 @@
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
/**
- * The Studio top bar's Save and Cancel: one pair for every editor on the open
- * page, at the right of the top bar where Publish used to be (objectstack#36511,
- * the maintainer's placement ruling on that card).
+ * The Studio page's Save and Cancel: one pair for every editor on the open
+ * page (objectstack#36511). They sat at the right of the top bar where Publish
+ * used to be; objectstack#37455 moved them to the page's item header, at the
+ * end of its actions (`studioTitleRow.tsx`), unchanged.
*
* An editor that saves explicitly holds its edits on the page and sends
* nothing until Save is pressed. It registers one {@link StudioSaveEntry} per
@@ -406,7 +407,7 @@ export async function publishSavedItem(
return { ok: true };
}
-/** The top bar's Cancel and Save, drawn while the page holds unsaved edits. */
+/** The page's Cancel and Save, drawn while it holds unsaved edits (in its item header, objectstack#37455). */
export function StudioSaveControls({
coordinator,
locale,
diff --git a/ui/packages/app-shell/src/views/studio-design/studioTitleRow.test.tsx b/ui/packages/app-shell/src/views/studio-design/studioTitleRow.test.tsx
new file mode 100644
index 00000000000..89795737ef6
--- /dev/null
+++ b/ui/packages/app-shell/src/views/studio-design/studioTitleRow.test.tsx
@@ -0,0 +1,169 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * objectstack#37455 — the surface's page controls (Cancel and Save, the AI
+ * assistant) are drawn by the page's first title row, once:
+ *
+ * - an item header ends its action slot with Save, then the assistant behind
+ * a hairline, after the pillar's own actions; a page that saves with no
+ * item header ends its own title row the same way;
+ * - a header nested under the page's own, or a list row further down, draws
+ * neither: one page, one Save;
+ * - when the first row goes, the next one takes them;
+ * - outside the surface's provider nothing is drawn, so Setup's pages are
+ * unchanged.
+ */
+
+import '@testing-library/jest-dom/vitest';
+import * as React from 'react';
+import { afterEach, describe, expect, it } from 'vitest';
+import { cleanup, render, screen, within } from '@testing-library/react';
+import { StudioItemHeader } from './StudioItemHeader';
+import { StudioTitleRowEnd, StudioTitleRowProvider } from './studioTitleRow';
+
+afterEach(cleanup);
+
+const SAVE = (
+
+);
+const ASSISTANT = (
+
+);
+
+function Surface({ children, save = SAVE }: { children: React.ReactNode; save?: React.ReactNode }) {
+ return (
+
+ {children}
+
+ );
+}
+
+const pillarAction = (
+
+);
+
+describe('the page controls end the page\'s first title row (objectstack#37455)', () => {
+ it('an item header: the pillar\'s actions, then Save, then the hairline and the assistant', () => {
+ render(
+
+
+ ,
+ );
+ const header = screen.getByTestId('item');
+ const save = within(header).getByTestId('studio-save');
+ const slot = save.parentElement as HTMLElement;
+ const order = Array.from(slot.children).map((el) => el.getAttribute('data-testid'));
+ expect(order).toEqual(['pillar-action', 'studio-save', 'studio-title-row-divider', 'topbar-ai-assistant']);
+ });
+
+ it('with nothing unsaved, the assistant alone; with no pillar actions, no hairline before it', () => {
+ render(
+
+
+ ,
+ );
+ const header = screen.getByTestId('item');
+ expect(within(header).queryByTestId('studio-save')).toBeNull();
+ expect(within(header).queryByTestId('studio-title-row-divider')).toBeNull();
+ expect(within(header).getByTestId('topbar-ai-assistant')).toBeInTheDocument();
+ });
+
+ it('a header nested under the page\'s own and a list row below it draw nothing: one Save, one assistant', () => {
+ render(
+
+
+
+ } />
+
+
+
+
+ ,
+ );
+ expect(screen.getAllByTestId('studio-save')).toHaveLength(1);
+ expect(screen.getAllByTestId('topbar-ai-assistant')).toHaveLength(1);
+ expect(within(screen.getByTestId('outer')).getByTestId('studio-save')).toBeInTheDocument();
+ expect(within(screen.getByTestId('list-row')).queryByTestId('topbar-ai-assistant')).toBeNull();
+ });
+
+ it('the outer header of a nested pair is the page\'s, whichever mounts first', () => {
+ render(
+
+ } />
+ ,
+ );
+ expect(screen.getAllByTestId('studio-save')).toHaveLength(1);
+ const save = screen.getByTestId('studio-save');
+ expect(within(screen.getByTestId('nested')).queryByTestId('studio-save')).toBeNull();
+ expect(screen.getByTestId('outer').contains(save)).toBe(true);
+ });
+
+ it('when the first row goes, the next one takes the controls', () => {
+ function Page({ withHeader }: { withHeader: boolean }) {
+ return (
+
+ {withHeader && }
+
+
+
+
+ );
+ }
+ const { rerender } = render();
+ expect(within(screen.getByTestId('list-row')).queryByTestId('topbar-ai-assistant')).toBeNull();
+ rerender();
+ const row = screen.getByTestId('list-row');
+ expect(within(row).getByTestId('topbar-ai-assistant')).toBeInTheDocument();
+ expect(screen.getAllByTestId('studio-save')).toHaveLength(1);
+ });
+
+ it('a page that saves with no item header: Save, then the hairline and the assistant, at the end of its own title row', () => {
+ render(
+
+
+
Sharing
+ {pillarAction}
+
+
+ ,
+ );
+ const row = screen.getByTestId('page-row');
+ const order = Array.from(row.querySelectorAll('[data-testid]')).map((el) => el.getAttribute('data-testid'));
+ expect(order).toEqual(['pillar-action', 'studio-save', 'studio-title-row-divider', 'topbar-ai-assistant']);
+ });
+
+ it('a row with no actions of its own and nothing unsaved: the assistant with no hairline before it', () => {
+ render(
+
+
+
+
+ ,
+ );
+ const row = screen.getByTestId('page-row');
+ expect(within(row).getByTestId('topbar-ai-assistant')).toBeInTheDocument();
+ expect(within(row).queryByTestId('studio-title-row-divider')).toBeNull();
+ expect(within(row).queryByTestId('studio-save')).toBeNull();
+ });
+
+ it('CONTROL: outside the surface a title row draws its own actions only', () => {
+ render(
+ <>
+
+
+
+
+ >,
+ );
+ expect(screen.queryByTestId('studio-save')).toBeNull();
+ expect(screen.queryByTestId('topbar-ai-assistant')).toBeNull();
+ expect(screen.queryByTestId('studio-title-row-divider')).toBeNull();
+ expect(screen.getByTestId('list-row')).toBeEmptyDOMElement();
+ });
+});
diff --git a/ui/packages/app-shell/src/views/studio-design/studioTitleRow.tsx b/ui/packages/app-shell/src/views/studio-design/studioTitleRow.tsx
new file mode 100644
index 00000000000..d44481f9147
--- /dev/null
+++ b/ui/packages/app-shell/src/views/studio-design/studioTitleRow.tsx
@@ -0,0 +1,152 @@
+// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
+
+/**
+ * The controls the Studio top bar used to hold for the open page, at the
+ * right end of that page's own title row (objectstack#37455, phase 1 of the
+ * top-bar removal, epic objectstack#37424; the maintainer's 「按推荐启动」):
+ *
+ * - Cancel and Save, in the item header's right-aligned action slot
+ * (`StudioItemHeader`): the page's Save, after the page's own actions; on
+ * a page that saves with no item header, at the right end of its own
+ * title row ({@link StudioTitleRowEnd});
+ * - the AI assistant button (or, with no copilot served, the right slot's
+ * show / hide icon) at the very end of every title row, the list page's
+ * and the item header's, behind a hairline, as the front end's page
+ * header ends with the shell's button group (`PageHeader`,
+ * objectstack#36111).
+ *
+ * The surface still OWNS them (`StudioDesignSurface`): it runs the save
+ * coordinator and the right slot, and hands the rendered controls down
+ * through {@link StudioTitleRowProvider}. A title row places them; it never
+ * builds them, so they work exactly as they did in the top bar.
+ *
+ * One page, one place: every title row under the surface registers its row,
+ * and only the first in document order draws the controls (the page's own
+ * header, never a header nested in it or a compact row embedded further
+ * down), so a page never draws two Saves. Outside the surface (Setup, a
+ * suite that mounts a page bare) nothing is drawn.
+ */
+
+import * as React from 'react';
+
+/** What the surface hands its title rows. */
+export interface StudioTitleRowControls {
+ /** Cancel and Save, while the page holds unsaved edits; `null` otherwise. */
+ save: React.ReactNode;
+ /** The AI assistant button or the slot's show / hide icon; `null` when the slot is not there. */
+ assistant: React.ReactNode;
+}
+
+/** One title row's identity in the registry: an object of its own, for its life. */
+type TitleRowToken = object;
+
+/** The rows that registered, and which of them draws the controls. */
+interface TitleRowRegistry {
+ add: (token: TitleRowToken, row: Element) => () => void;
+ subscribe: (listener: () => void) => () => void;
+ owner: () => TitleRowToken | null;
+}
+
+function createTitleRowRegistry(): TitleRowRegistry {
+ const rows = new Map();
+ const listeners = new Set<() => void>();
+ let owner: TitleRowToken | null = null;
+ const settle = () => {
+ let first: [TitleRowToken, Element] | null = null;
+ for (const entry of rows) {
+ // `DOCUMENT_POSITION_PRECEDING`: this row comes before `first`.
+ if (!first || first[1].compareDocumentPosition(entry[1]) & Node.DOCUMENT_POSITION_PRECEDING) first = entry;
+ }
+ const next = first?.[0] ?? null;
+ if (next === owner) return;
+ owner = next;
+ listeners.forEach((listener) => listener());
+ };
+ return {
+ add: (token, row) => {
+ rows.set(token, row);
+ settle();
+ return () => {
+ rows.delete(token);
+ settle();
+ };
+ },
+ subscribe: (listener) => {
+ listeners.add(listener);
+ return () => listeners.delete(listener);
+ },
+ owner: () => owner,
+ };
+}
+
+interface StudioTitleRowValue extends StudioTitleRowControls {
+ registry: TitleRowRegistry;
+}
+
+const StudioTitleRowContext = React.createContext(null);
+
+/** The surface's side: the controls its pages' title rows place. */
+export function StudioTitleRowProvider({
+ save,
+ assistant,
+ children,
+}: StudioTitleRowControls & { children: React.ReactNode }): React.ReactElement {
+ // One registry for the surface's life (state, not a memo: ui AGENTS.md #10).
+ const [registry] = React.useState(createTitleRowRegistry);
+ const value = React.useMemo(() => ({ registry, save, assistant }), [registry, save, assistant]);
+ return {children};
+}
+
+const noSubscription = () => () => {};
+const noOwner = () => null;
+
+/**
+ * A title row's side: the controls this row draws, given the row's element.
+ * `null` outside the surface, and for every row but the page's first.
+ */
+export function useStudioTitleRowControls(row: React.RefObject): StudioTitleRowControls | null {
+ const value = React.useContext(StudioTitleRowContext);
+ const registry = value?.registry ?? null;
+ const [token] = React.useState(() => ({}));
+ React.useLayoutEffect(() => {
+ const el = row.current;
+ if (!registry || !el) return;
+ return registry.add(token, el);
+ }, [registry, row, token]);
+ const owner = React.useSyncExternalStore(registry?.subscribe ?? noSubscription, registry?.owner ?? noOwner, noOwner);
+ if (!value || owner !== token) return null;
+ return { save: value.save, assistant: value.assistant };
+}
+
+/** The hairline before the assistant, as the front end's page header draws it before the shell's group. */
+export function StudioTitleRowDivider(): React.ReactElement {
+ return ;
+}
+
+/**
+ * The end of a title row that is not an item header (the list page's, the
+ * directory's, a page that saves with no item header): drop it after the
+ * row's last action. It draws the page's Cancel and Save while the page holds
+ * unsaved edits, then the assistant behind a hairline (`divider`: the row has
+ * actions of its own before it; Save always counts as one). Draws nothing
+ * outside the surface.
+ */
+export function StudioTitleRowEnd({ divider = true }: { divider?: boolean }): React.ReactElement | null {
+ const inSurface = React.useContext(StudioTitleRowContext) !== null;
+ const anchor = React.useRef(null);
+ const controls = useStudioTitleRowControls(anchor);
+ if (!inSurface) return null;
+ const save = controls?.save ?? null;
+ const assistant = controls?.assistant ?? null;
+ return (
+
+ {save}
+ {assistant ? (
+ <>
+ {(divider || save) && }
+ {assistant}
+ >
+ ) : null}
+
+ );
+}