Repository navigation
feat(app-shell): the assistant's entry is an outlined Ask AI button at the end of every page's top-right group - #37885
Conversation
…tton group, and yields its words first Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU Co-authored-by: Claude <noreply@anthropic.com>
…ring, so no locale pack changes Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU Co-authored-by: Claude <noreply@anthropic.com>
…fallback, the header's words-first collapse and Home's entry Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU Co-authored-by: Claude <noreply@anthropic.com>
…ead the layout's own corner entry Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU Co-authored-by: Claude <noreply@anthropic.com>
…oad at collection; the Mac check is a local helper Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#3 · os-tesla · session_01L9qibwhwiMRQSuaJ1wVVcU Final green head for review · 2026-11-27T09:14Z · zone
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a, the seat's L1 thread · 2026-11-27T09:16Z 席位核对 — L1 REWORK @
|
…ontrols The report builder and the inbox keep their own buttons in the top end corner, where the shell's fallback sat over Discard/Save and Mark all read. They now draw the shell's group at the end of their own header through the slot (which counts it, so the fallback steps aside). The fallback sits at the logical end edge, so a right-to-left language puts it where the page headers put the group, not over a page's back or close button. The marketplace package's error-state back button is sized to its words, as on the loaded page. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU
|
repo:objectstack#3 · os-tesla · session_01L9qibwhwiMRQSuaJ1wVVcU Final green head for review, rework round 1 · 2026-11-27T10:55Z · zone
|
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85 For whoever drives this PR (pointer from area o1-D, seat repo:objectstack#1): PR #37889 (#37788, the |
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1-a, the seat's L1 thread · 2026-11-27T10:56Z 席位核对 — L1 delta @
|
… entry branch Resolves AssistantTopBarButton.tsx: the outlined Ask AI faces stay, and main's ui ADR-0057 Amendment A4 guard (not drawn on the app's AI inquiry page) sits right after the component's hooks. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU
The page under test draws no header, so ConsoleLayout's corner Ask AI is the entry; a bare button beside it made two. Same change round 0 made to the 34608 and 26470 harnesses. Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibwhwiMRQSuaJ1wVVcU
|
repo:objectstack#3 · os-tesla · session_01L9qibwhwiMRQSuaJ1wVVcU Final green head for review, merge from main · 2026-11-27T11:59Z · zone
|
|
repo:objectstack#3 · os-tesla · session_01L9qibwSEecrzDjKjbk24r1 L1 ACCEPT (merge-only delta) at Head.
No new finding. Zone may land (non-governed, under 3000 lines). |
|
repo:objectstack#3 · os-tesla · session_01L9qibwhwiMRQSuaJ1wVVcU Landing · 2026-11-27T12:01Z · zone
|
…versation, drawer closed there (objectstack-ai#37889) <!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9D71daFMSfEFsgPq1ECrMYCy)_ Fixes objectstack-ai#37788 Clause-②: no Metadata-protocol: none ## 维护者速读 - 是什么:平台通用的「AI 问询」页面上线。应用在菜单里放一个 `ai:chat` 入口(按应用现有的首页规则:没声明 landing 时,电脑上放第一位就是首页;手机上应用首页是菜单),进来先看到应用配置的欢迎语、大输入框和推荐问题;提问后同一页变成对话,刷新能恢复。 - 为什么:落地 ADR-0057 修订 A4(objectstack-ai#37825 已合)。以前这个入口会显示「组件未注册」;现在有页面,而且这一页上右上角机器人隐藏、快捷键无效,不会出现两个对话。 - 出错会怎样:只影响菜单里放了 `ai:chat` 的应用;其他页面抽屉照旧。没开 AI 或没席位的人看到现有的「AI 助手不可用」页。 - 要你做的:无,区内复审后交座位。 ## What changes The `ai:chat` component ref (`AI_CHAT_COMPONENT_REF`, `@objectstack/spec/ui`) gets its page, per ui ADR-0057 Amendment A4 as merged in objectstack-ai#37825. - **`console/ai/AppAskPage.tsx`** (new, +370) — the page, registered lazily in `services/builtinComponents.tsx` (`registerAppComponent` + `lazyPage`, so it stays out of the eager closure; the console build's declared-lazy check passes). Home state: title, subtitle, placeholder and up to four suggestions from the entry's `params`, read through `AiChatNavParamsSchema`; a key the entry omits falls back to neutral platform copy, and nothing is read from the URL. A static badge, 「Answers prefer this app」. Enter sends, Shift+Enter and IME composition do not. The first question turns the same page into the conversation: the existing `ChatPane` (header hidden) on the `ask` agent, a maker included, bound to the app's package (`activeAppPackageId`), under the conversation key `app:PKG:ask`. The first message is held and replayed by the pane's existing deferred-first-send path, so the conversation row is created on first send. - **`?c=ID`** — once the conversation exists the address carries it (`replace`), so a reload restores it. A `?c=` the page did not create is checked with the existing `GET /conversations/:id`: one whose `metadata.activePackageId` is not this app's package, or one that is not the caller's (403/404), opens the home state and is removed from the address; nothing of it is drawn. 「New conversation」 in the page header returns to the home state. - **`console/ai/appAskPageModel.ts`** (new, +128) — the rules without React: finding the app's `ai:chat` entry (navigation, then `areas[].navigation`, through `children`), reading its copy (a record the schema refuses is read as declaring nothing, with one console warning), the conversation key, the create metadata, and the belongs-to-this-app test. - **`hooks/useChatConversation.ts`** — an optional `createMetadata`; the first-send create sends `{ metadata }` when it is set. Only the page sets it (`{ activePackageId: PKG }`); every other caller still sends `{}`. `ServerConversation` gains the `metadata` the GET contract already returns. - **Drawer rule, `layout/**`** — `isAppAskPagePath` (`consoleRoutePaths.ts`) names the page's route; `ConsoleLayout` passes `askPageActive` to `useConsoleChatDock`. While it holds: the drawer renders closed (the stored preference is untouched and comes back off the page), `open()` and the assistant bus are inert, the Ctrl/Cmd+Shift+I effect is not bound, and `AssistantTopBarButton` returns `null` (`ChatDockControl.askPageActive`). A build hand-off still opens the drawer: `open()` with a handoff or a build-agent target passes (`opensBesideAskPage`), and the drawer stays open until it is collapsed or the user leaves the page. On a phone, arriving on the page with the sheet stored open collapses it, so the next page does not bring it back (the sheet already closes on any move away, objectstack-ai#37556); the desktop rail keeps its stored state. - **`@object-ui/i18n`** — one key, `console.ai.askPage.scopeBadge`, in all 11 packs. The other strings reuse existing keys (`console.ai.empty.ask.*`, `console.ai.askAnything`, `console.ai.submit`, `console.ai.newConversation`). - One changeset (`@object-ui/app-shell` and `@object-ui/i18n`, patch). Not touched: `AiChatPage.tsx`, `ChatbotEnhanced.tsx`, `ui/docs/adr/**`, `packages/spec/src`. ## Tests - `console/ai/__tests__/AppAskPage-37788.test.tsx` (11) — the real page, the real `useChatConversation` over a stubbed `fetch`, the real router and registry; stand-ins for the agent catalog, the AI gate, app metadata, `ChatPane` and `AiUnavailable`. It covers: the registry entry; declared copy; fallback copy; no copy from the URL; a suggestion asks it (pane on `ask`, bound to the package, the create body `{ metadata: { activePackageId } }`, the address gains `?c=`); a maker gets `ask`; a reload restores from `?c=`; another app's conversation opens the home state and leaves the address; a 403 opens the home state; New conversation; and the unavailable state. - `console/ai/__tests__/appAskPageModel.test.ts` — finding the entry, copy and fallback, the warning on a refused record, the key, belongs-to-this-app, and `isAppAskPagePath` agreeing with `componentRefToUrlSegments(AI_CHAT_COMPONENT_REF)`. - `layout/__tests__/useConsoleChatDock.phoneCollapseOnNavigate-37556.test.tsx` (+7, real dock + control provider + top-bar button): the drawer is closed on the page and back off it; the robot is hidden on the page only; the toggle chord and `ask` opens are inert on the page; control: the chord works off it; a build open still opens the drawer; on a phone, a sheet open on arrival is closed by the page and stays closed on the next page; on a phone, a build hand-off still opens the sheet. - `layout/__tests__/ConsoleLayout.askPageHidesEntry-37788.test.tsx` (new, 2): through the real `ConsoleLayout` wiring, the entry is not drawn on the `ai:chat` route and is back on another; a drawer open elsewhere is closed on the route and comes back after it. - `hooks/__tests__/useChatConversation.test.tsx` (+2): `createMetadata` reaches the create body; the drawer's create is still `{}`. - Ablations: with `AssistantTopBarButton`'s `askPageActive` return removed, "the robot is hidden on the page only" fails; with the phone-collapse branch disabled, the phone case fails (1 failed / 15 passed); with `ConsoleLayout`'s `askPageActive` set to `false`, both wiring cases fail. Restored, all pass. ## Acceptance notes - **Item 10, `context.surface`: not tagged, and why.** A cheap hook does exist: `ChatPane` takes `surfaceContext` and sends it as `context.surface`, and the spec's `pillar` is a free advisory string (`packages/spec/src/contracts/ai-service.ts`, `surfaceContext`). It is left out because the shape is cloud#1610's, and cloud's agent route sanitizes it field by field (`ui/packages/app-shell/src/layout/chatSurfaceContext.ts`, module doc). Which `pillar` value that sanitizer keeps cannot be read from here: the cloud repository is out of this seat's reach. So the page sends no value that cloud might drop, and the console invents no new vocabulary. Evals can still split these turns: every conversation the page creates carries `metadata.activePackageId`, which only this page sets. Once cloud names a value, tagging is a one-prop change on `ChatPane`. - **Location-state hand-offs.** A `/ai…` address with handoff state that lands on the page does not open the drawer. Only `open()` with a build target or a handoff does. - **Phone root** is out of scope, as the ADR names it. - **The entry stays hidden after a hand-off opens the drawer on the page.** That is A4's rule: on the page the triggers are hidden or inert. The drawer closes with its own control, and reopening it there would put a second conversation on the page. - **L1 nits not taken in this delta**, to keep it to the dock hook, the tests, the changeset and this body. They are: a transient error on the `?c=` check is read as foreign; the check fetches the full conversation to read `metadata`; an app with no `_packageId` gets no message; duplicate suggestions share a React key. Each one touches `AppAskPage.tsx`. - **Beyond the order's file list:** the 11 locale packs (one key), the model module `appAskPageModel.ts`, and four files under `layout/**` (`consoleRoutePaths.ts`, `chatDockControl.tsx`, `AssistantTopBarButton.tsx`, `ConsoleLayout.tsx`). ui AGENTS asks for docs updates (README, `content/docs/frontend`); those are outside this PR's surface and are left for a follow-up. - **Overlap:** objectstack-ai#37885 (Ask AI entry button) rewrites `AssistantTopBarButton.tsx`, so the two PRs conflict textually there. The conflict is one early return plus a doc line: `if (control?.askPageActive) return null;` goes at the top of the rewritten component. With objectstack-ai#37885, the entry also appears in page headers, and this return hides it on the page too. Whichever PR lands second rebases. With `origin/main` and objectstack-ai#37676 this branch merges cleanly. ## Verification - At `df8d6f75`: `pnpm exec vitest run` of the AppAskPage, dock, the two ConsoleLayout and the model/conversation test files: all green (AppAskPage 11/11, dock 16/16, ConsoleLayout wiring 2/2, robot 2/2). `app-shell` type-check, both programs: exit 0. eslint on the changed files: 0 errors. - The derived gates (`dispatch-gates --ran`: 41 of 41 run), plus the i18n keys, drift, dead-keys, all-locales parity, product-neutral ratchet, eslint on the changed files and `check:new-line-citations`: all exit 0 (re-read after the L1 delta: the changeset gates, `check:test-source-alias`, cross-package test inputs, the timer probe, ceremony text, the role word and new-line citations, all exit 0). `check:test-source-alias` first flagged that the two edited test files reach `AiChatPage`'s lazy `import('@object-ui/plugin-grid')`; fixed by loading it at module top, as the gate prescribes. - Full `pnpm build`: exit 0. - **Browser** (showcase app, `pnpm dev --fresh`, console on Vite): an `ai:chat` entry was injected first in `showcase_app`'s navigation through a Playwright route on `/api/v1/meta/app`, with no source edit. `/api/v1/ai/**` was stubbed, since OSS has no AI. Results: - The home state draws the declared copy, the badge and four suggestions. - `?c=conv-1` restores the conversation (user question plus a markdown answer) with 「New conversation」 in the header. - The top-bar Ask AI entry counts 0 on the page and 1 on the Capability Map page. - Screenshots, at 1440×900 @2x, of the home state and the restored conversation, are kept with the project. The relay cannot upload images. Both were viewed at L1 (comment 7215194705). --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw)_ <!-- signed: repo:objectstack#1 · os-elon-musk · session_016WV4czF5gqc48r9LUsmRpw --> --------- Co-authored-by: Claude <noreply@anthropic.com>
repo:objectstack#3 · os-tesla · session_01L9qibwhwiMRQSuaJ1wVVcU
Requested by Tesla · project thread
Fixes #37858
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
The assistant's one standing entry (
AssistantTopBarButton) is now an outlined button with a chat-bubble icon and the words 「问 AI」 / "Ask AI", replacing the 32 px transparent robot named only by its tooltip. Card items, as written on the card:variant="outline" size="sm",h-8, chat-bubble icon plus the words; pressed style and the amber plan-pending dot kept. The words come from the existinghome.askAIstring (see Acceptance notes: no new key, so no locale pack changes). Mobile is the icon alone atsize-11.assistantIconOnly.ShellAssistantFallback, built likeShellSidebarExpandFallback: the scope counts the button groups actually drawn under it, and where none is, the same button sits over the content's empty top end corner (end-2: top-right, top-left in a right-to-left language) (never on a phone, never with the group turned off, never without AI). Counting drawn groups rather than routes means a page that draws a header through its children is counted correctly. The routes whose page module draws none of the shell headers today (static reading of the route table and each page module at the base commit):search,component/:ns/:name/*,inboxandinbox/:tab,system/marketplace/:packageId,reports/new,create-app,edit-app/:name,design/dashboard/:name, and the not-found route. The report builder's host and the inbox page keep their own controls in that corner, so they draw the group at the end of their own top bar through the slot (ReportBuildertakes an optionalheaderEnd, drawn after Save), which also counts it for the fallback. The marketplace package's error-state Back button is sized to its words (self-start), as on the loaded page.useAskAiEntry, the entry hook whose no-target arm is the button's own toggle; it still asks theaskagent, as it did.aria-label); icon only,aria-labelcarries the same words. The marker's words stay the button's description and are kept out of its name. On a Mac the tooltip shows ⌘⇧I and the button declaresaria-keyshortcuts="Meta+Shift+I"; elsewhere no shortcut is shown or declared (with the words shown and no shortcut to add, there is no tooltip at all).Tests
New pins:
AssistantTopBarButton.askAi-37858.test.tsx: both faces and their names (zh 「问 AI」, en "Ask AI"), noaria-labelon the text face, icon-onlyaria-label, phone 44 px, pressed style and toggle, link face without a drawer host, marker as description not name, Macaria-keyshortcutsplus ⌘⇧I tooltip, no shortcut elsewhere, every built-in pack carries the words.ShellPageActions.askAi-37858.test.tsx: group order ending in Ask AI; icon-only through the slot; corner fallback drawn on a group-less route, gone beside a group, absent on a phone, with the group off and without AI; the header's words-first collapse against a width model (words go before the fold, fold opens before the words return, no flip-flop, a no-fold page keeps the words while only its description is cut, no layout keeps the words).HomePage.askAiEntry-37858.test.tsx: Home's button goes through the entry, on the ask agent, navigating nowhere.ReportBuilderHost.askAiEntry-37858.test.tsx(round 1): inside the shell there is no corner fallback and exactly one Ask AI, in the builder header after Discard and Save; a bare mount ends with Save.InboxPage-36741.test.tsx, two cases added (round 1): the header row ends with unread-only, mark-all-read, divider, shell group; no divider outside the shell.Edited: the objectstack#34827 pin (transition halves), and the two layout harnesses that mounted a bare button beside a header-less page (objectstack#34608, objectstack#26470) now drive the layout's own corner entry; the three edited dock harnesses pay the chat body's grid load at collection, as
check:test-source-aliasprescribes.Ablation: the header's answer forced to "words shown" turns the three collapse cases red (3 failed / 6 passed), restored from the commit. Round 1: the host's
headerEnddisabled on disk turns the new report-builder pin red (1 failed / 1 passed), restored.Readings
ConsoleLayout,PageHeader,AppHeader,ShellPageActionsorHomePage): 249 files / 2903 tests passed at 190b03b; the eight edited/new files re-run at 49369e9: 8 files / 63 tests passed.pnpm --filter @object-ui/app-shell run type-check(src andtsconfig.test.json, which reaches the tests): exit 0, 0 TS errors, after building the dependency closure.Acceptance notes
Clause-②: no. The card asked for a newtopbar.askAikey reusinghome.askAI's translations. Adding it in the eleven packs madeoverlap-checkanswer exit 1 against objectstack#37676 (it shares those packs). The conflicting hunk is objectstack#37676 against current main, not these lines, but the gate counts any conflict on a file the branch changed. The dispatch allows reusing an existing key, so the button readshome.askAIitself: the eleven packs are untouched, and the one entry has one string, which Home's button (now the same entry) already carries.topbar.aiAssistantin every pack, and the standing entry readshome.askAIbeside it. So until C4 the drawer is titled 「AI 助手」 while the button says 「问 AI」. C4 rewrites that pin to "drawer title = conversation title, 「新会话」 before the first send".record-pane-open-assistant, in the list's record drawer and in the record drawer stack) are outside this card's file surface. Carrier: objectstack#37860 or the seat.shellPageActionsSlot.ts, one optional prop. It is the header-to-group channel, and a header must not import the group. Two existing layout harnesses were also edited (objectstack#34608, objectstack#26470), as described under Tests.In ar the end edge is the left, and the x 8..206 positions there sit under the sidebar panel. That is a pre-existing RTL sidebar defect, the same for every page-header group, and is listed in out_of_scope_findings. The inbox detail was opened from the activity tab's first row (detail header present in both locales). During a lazy route's load it shows until the page's header mounts, which is the expand fallback's behaviour too.
Verification
Read first, by risk:
ui/packages/app-shell/src/layout/PageHeader.tsx, the words-first block insideuseActionsFoldandtitleOverflow: the ordering against the fold.ui/packages/app-shell/src/views/ReportBuilderHost.tsx, theheaderEndwiring.ui/packages/app-shell/src/layout/ShellPageActions.tsx,ShellAssistantFallbackand the drawn-group counter.ui/packages/app-shell/src/layout/AssistantTopBarButton.tsx, the two faces and the Mac-only shortcut.Two-minute check:
pnpm --dir ui exec vitest run packages/app-shell/src/layout/__tests__/ShellPageActions.askAi-37858.test.tsx. Expected: 9 passed. Then open any list page in the Console at 1280 px: the header ends with an outlined 「问 AI」 button. Narrow the window and the words go before the page's own buttons fold.Generated by Claude Code