Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.
Merged
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
24 changes: 24 additions & 0 deletions .changeset/adr-0057-p3c-maximized-dock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@object-ui/app-shell": patch
---

feat(console-ai): /ai = the ChatDock maximized + Studio right-dock reflow (ADR-0057 P3c)

The final P3 slice, all behind the default-off `features.chatDock` flag:

- **/ai ⇄ rail continuity**: the dock header gains a maximize button that opens
the full-page `/ai` surface, and the `/ai` page gains a collapse-to-dock button
that returns to the console with the rail expanded — same thread both ways
(the P1 `(user, app, product)` conversation key). Deep links
(`/ai/:agent/:conversationId`, ADR-0013) are untouched and keep working.
- **Studio reflow** (the ADR's decided grid `[left: nav/tree] [center: canvas +
properties] [right: chat]`): the AI copilot leaves the left `w-96` panel and
renders as the shared right dock (`ChatDockPanel` + `ChatDockLauncher`), same
package-scoped build thread; the Interfaces pillar's right inspector folds
into center `[Canvas | Properties]` tabs with select-a-block auto-switch. An
injected `aiSlot` (cloud seam, ADR-0080) keeps the legacy left panel.
- **Live Canvas** (ADR-0037): in the rail, the dock auto-maximizes while the
canvas is open and tucks back on close (manual resize wins); maximized (`/ai`)
keeps the existing beside-the-chat split.

With the flag OFF, `/ai` and Studio are pixel-identical to before.
21 changes: 15 additions & 6 deletions docs/adr/0057-console-ai-chat-one-conversation-docked.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

**Status**: Accepted (2026-07-13) — P1+P2 shipped (#2414), P4 shipped
(#2439 / #2444 + cloud#818/#819; reliability follow-ups #2449 + cloud#820);
P3 planned (implementation plan on epic #2409). Console-layer realization of the two-agent,
P3 shipped behind the default-off `features.chatDock` rollout flag (P3a #2464,
P3b #2465, P3c #2467 — epic #2409; flag default-on + overlay retirement are the
remaining cleanup, tracked on the epic). Console-layer realization of the two-agent,
surface-bound model (cloud ADR-0063). **No agent, boundary, or commercial-model
change** — this ADR only rearranges how the objectui console *renders and wires*
chat surfaces.
Expand Down Expand Up @@ -242,7 +244,10 @@ inert; AI is reached only via MCP.
Studio copilot moves to the shared right dock (properties reflow); `/ai` =
maximized dock, same thread; runtime SDUI unchanged (bubble). *Proof: chat
location is identical across console pages; expand/collapse preserves the
thread.*
thread.* **Shipped behind `features.chatDock` (default OFF): P3a #2464 (rail),
P3b #2465 (FAB → launcher), P3c #2467 (maximized `/ai` ⇄ rail + Studio reflow
+ canvas auto-maximize). Flag default-on + floating-overlay retirement are the
remaining cleanup (epic #2409).**
- **P4 — ask→build handoff (explicit).** In `ask`, a build-shaped request
surfaces an explicit **"Open in Builder →"** that carries the conversation
context through the generalized `assistantBus` — ADR-0063's *decline-and-
Expand Down Expand Up @@ -339,7 +344,9 @@ product-scoped threads; a deleted bound package needs a terminal chip state

1. **Dock side under Studio (P3).** ~~Chat right vs properties right.~~
**DECIDED (2026-07-13): chat right**; properties fold into a center tab —
`[left: nav/tree] [center: canvas + properties] [right: chat]`.
`[left: nav/tree] [center: canvas + properties] [right: chat]`. **Shipped in
P3c** (Interfaces pillar `[Canvas | Properties]` center tabs; Data/Automations
keep their in-center inspectors).
2. **FAB retirement path (P3).** ~~Hard-retire, or keep the FAB as the collapsed
affordance?~~ **DECIDED (2026-07-13): the FAB becomes the dock's collapsed
affordance** — the bottom-right button stays and expands the right rail
Expand All @@ -352,9 +359,11 @@ product-scoped threads; a deleted bound package needs a terminal chip state
4. **`app.defaultAgent` post-ADR-0063.** Now bounded to `ask` / `build` (tenant
custom agents withdrawn). Confirm the resolver **rejects** anything else rather
than silently falling through.
5. **Focus-mode routing.** Does `/ai/build/:conversationId` stay a deep-linkable,
shareable URL (ADR-0013) once the dock is canonical? Proposed: **yes** — the
URL opens the dock maximized on that thread.
5. **Focus-mode routing.** ~~Does `/ai/build/:conversationId` stay a deep-linkable,
shareable URL (ADR-0013) once the dock is canonical?~~ **DECIDED & SHIPPED
(P3c): yes** — the routes are untouched; the full page IS the dock maximized
(same P1 thread), with a maximize button on the rail and a collapse-to-dock
button on the page bridging the two presentations.

## Alternatives considered

Expand Down
44 changes: 43 additions & 1 deletion packages/app-shell/src/console/ai/AiChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
EmptyDescription,
cn,
} from '@object-ui/components';
import { Bug, PanelLeft, PanelLeftClose, PanelLeftOpen, Share2 } from 'lucide-react';
import { Bug, PanelLeft, PanelLeftClose, PanelLeftOpen, PanelRightOpen, Share2 } from 'lucide-react';
import {
ChatbotEnhanced,
useAgents,
Expand All @@ -69,6 +69,7 @@ import {
} from '@object-ui/plugin-chatbot';

import { AppHeader } from '../../layout/AppHeader';
import { armChatDockExpanded } from '../../layout/chatDockState';
import { fetchPendingDraftCount } from '../../preview/draftStatus';
import { emitMetadataRefresh } from '../../assistant/assistantBus';
import { getRuntimeConfig } from '../../runtime-config';
Expand Down Expand Up @@ -509,6 +510,19 @@ export function matchAiChatShortcut(e: {
}
}

/**
* ADR-0057 P3c — where the "collapse to dock" affordance navigates: back
* through history when react-router has an in-app entry to return to
* (`window.history.state.idx > 0` — the router stamps a monotonically
* increasing `idx` on entries it creates), else `/home` (the page was the
* entry point: a deep link, a fresh tab). The dock itself is armed to open
* expanded separately ({@link armChatDockExpanded}); this only picks the
* landing. Pure + exported for tests.
*/
export function resolveCollapseToDockTarget(historyIdx: unknown): -1 | '/home' {
return typeof historyIdx === 'number' && historyIdx > 0 ? -1 : '/home';
}

/** A composer submission held until the conversation id that will carry it exists. */
/** Stable empty array for the stale-scope window (#2450) — a fresh `[]` per
* render would churn the pane's `initialMessages` identity for no reason. */
Expand Down Expand Up @@ -994,6 +1008,34 @@ export function AiChatPage({ apiBase: apiBaseProp, defaultAgent: defaultAgentPro
<div className="min-w-0 flex-1">
<AppHeader variant="home" />
</div>
{/* ADR-0057 P3c — "/ai = the ChatDock maximized": tuck this full-page
surface back into the console's right rail. Arms the dock to mount
expanded, then returns to the page the user came from (or /home on
a cold deep link) — the rail resolves the same (user, product)
conversation scope, so it shows THE SAME THREAD. Desktop-only
(the dock itself is `hidden md:flex`) and flag-gated: with
`features.chatDock` off this button does not exist and the page is
pixel-identical to pre-P3c. */}
{!noAgents && getRuntimeConfig().features.chatDock === true && (
<Button
variant="ghost"
size="icon"
className="hidden h-8 w-8 shrink-0 md:inline-flex"
data-testid="ai-chat-collapse-to-dock"
aria-label={t('console.ai.collapseToDock', { defaultValue: 'Collapse to side panel' })}
title={t('console.ai.collapseToDock', { defaultValue: 'Collapse to side panel' })}
onClick={() => {
armChatDockExpanded();
const target = resolveCollapseToDockTarget(
(window.history.state as { idx?: unknown } | null)?.idx,
);
if (target === -1) navigate(-1);
else navigate(target);
}}
>
<PanelRightOpen className="h-4 w-4" />
</Button>
)}
</header>
{noAgents ? (
<AiUnavailable
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* ObjectUI
* Copyright (c) 2024-present ObjectStack Inc.
*
* ADR-0057 P3c — the `/ai` page's "collapse to dock" landing: back through
* history when react-router has an in-app entry to return to, else /home
* (deep link / fresh tab — nothing behind us worth going "back" to).
*/
import { describe, it, expect } from 'vitest';
import { resolveCollapseToDockTarget } from '../AiChatPage';

describe('resolveCollapseToDockTarget', () => {
it('goes back when react-router stamped a positive history index', () => {
expect(resolveCollapseToDockTarget(1)).toBe(-1);
expect(resolveCollapseToDockTarget(7)).toBe(-1);
});

it('lands on /home when this page is the entry point (idx 0)', () => {
expect(resolveCollapseToDockTarget(0)).toBe('/home');
});

it('lands on /home when the index is missing or not a number', () => {
expect(resolveCollapseToDockTarget(undefined)).toBe('/home');
expect(resolveCollapseToDockTarget(null)).toBe('/home');
expect(resolveCollapseToDockTarget('2')).toBe('/home');
expect(resolveCollapseToDockTarget(NaN)).toBe('/home');
});
});
Loading
Loading