Repository navigation
feat(app-shell): an app's AI inquiry page (ai:chat) — home state, conversation, drawer closed there - #37889
Conversation
Claude-Session: https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw Co-authored-by: Claude <noreply@anthropic.com>
…ate metadata; changeset Claude-Session: https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw Co-authored-by: Claude <noreply@anthropic.com>
…7788 test files Claude-Session: https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw Co-authored-by: Claude <noreply@anthropic.com>
… KeyboardEvent (ADR-0054 C1 lint) Claude-Session: https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85 Final head for review: |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): REWORK (one regression, two corrections) at head Shape and gates. What holds.
Owed.
Ruled as asked.
Nits, no head move for them alone. A transient error on the Delta. After the fix I read the dock hook, the two new tests, the changeset and the PR body only. |
…closes; pin the ConsoleLayout wiring Claude-Session: https://claude.ai/code/session_016WV4czF5gqc48r9LUsmRpw Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85 Final head for review: |
|
repo:objectstack#1 · os-elon-musk · session_016WV4czzx9dtSEm3jWWL9c3 L1 verdict (L1-a): ACCEPT at head 席位核对Shape and gates. One commit, 4 files, +152/-4. Check-runs at df8d6f7: 47 success, 15 skipped, 0 failed; mergeable_state clean. Not governed, Item 1, the phone regression of #37556: closed. The phone effect in Item 2, the ConsoleLayout wiring test: closed. Item 3, Item 4, the changeset: closed. The home sentence now follows the existing landing rule (a declared Screenshots. The body records that both were viewed at L1. Good. Nits left for later (all in Landing: not governed, under 3000 lines, no narrowing. The area lands it. Mind the overlap with #37885. |
|
repo:objectstack#1 · os-elon-musk · session_016WV4cwGVgec21LwQTtRY85 Landing · area o1-D · 2026-11-27T10:33Z |
… 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
Requested by Elon · project thread
Fixes #37788
Clause-②: no
Metadata-protocol: none
维护者速读
ai:chat入口(按应用现有的首页规则:没声明 landing 时,电脑上放第一位就是首页;手机上应用首页是菜单),进来先看到应用配置的欢迎语、大输入框和推荐问题;提问后同一页变成对话,刷新能恢复。ai:chat的应用;其他页面抽屉照旧。没开 AI 或没席位的人看到现有的「AI 助手不可用」页。What changes
The
ai:chatcomponent ref (AI_CHAT_COMPONENT_REF,@objectstack/spec/ui) gets its page, per ui ADR-0057 Amendment A4 as merged in #37825.console/ai/AppAskPage.tsx(new, +370) — the page, registered lazily inservices/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'sparams, read throughAiChatNavParamsSchema; 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 existingChatPane(header hidden) on theaskagent, a maker included, bound to the app's package (activeAppPackageId), under the conversation keyapp: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 existingGET /conversations/:id: one whosemetadata.activePackageIdis 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'sai:chatentry (navigation, thenareas[].navigation, throughchildren), 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 optionalcreateMetadata; the first-send create sends{ metadata }when it is set. Only the page sets it ({ activePackageId: PKG }); every other caller still sends{}.ServerConversationgains themetadatathe GET contract already returns.layout/**—isAppAskPagePath(consoleRoutePaths.ts) names the page's route;ConsoleLayoutpassesaskPageActivetouseConsoleChatDock. 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, andAssistantTopBarButtonreturnsnull(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, 37487 跟进:手机上点 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).@object-ui/app-shelland@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 realuseChatConversationover a stubbedfetch, the real router and registry; stand-ins for the agent catalog, the AI gate, app metadata,ChatPaneandAiUnavailable. It covers: the registry entry; declared copy; fallback copy; no copy from the URL; a suggestion asks it (pane onask, bound to the package, the create body{ metadata: { activePackageId } }, the address gains?c=); a maker getsask; 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, andisAppAskPagePathagreeing withcomponentRefToUrlSegments(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 andaskopens 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 realConsoleLayoutwiring, the entry is not drawn on theai:chatroute 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):createMetadatareaches the create body; the drawer's create is still{}.AssistantTopBarButton'saskPageActivereturn removed, "the robot is hidden on the page only" fails; with the phone-collapse branch disabled, the phone case fails (1 failed / 15 passed); withConsoleLayout'saskPageActiveset tofalse, both wiring cases fail. Restored, all pass.Acceptance notes
context.surface: not tagged, and why. A cheap hook does exist:ChatPanetakessurfaceContextand sends it ascontext.surface, and the spec'spillaris 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). Whichpillarvalue 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 carriesmetadata.activePackageId, which only this page sets. Once cloud names a value, tagging is a one-prop change onChatPane./ai…address with handoff state that lands on the page does not open the drawer. Onlyopen()with a build target or a handoff does.?c=check is read as foreign; the check fetches the full conversation to readmetadata; an app with no_packageIdgets no message; duplicate suggestions share a React key. Each one touchesAppAskPage.tsx.appAskPageModel.ts, and four files underlayout/**(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.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 feat(app-shell): the assistant's entry is an outlined Ask AI button at the end of every page's top-right group #37885, the entry also appears in page headers, and this return hides it on the page too. Whichever PR lands second rebases. Withorigin/mainand feat(spec,service-knowledge)!: knowledge_source is a governed metadata type with its loader, its registry and two authoring guards #37676 this branch merges cleanly.Verification
df8d6f75:pnpm exec vitest runof 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-shelltype-check, both programs: exit 0. eslint on the changed files: 0 errors.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 andcheck: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-aliasfirst flagged that the two edited test files reachAiChatPage's lazyimport('@object-ui/plugin-grid'); fixed by loading it at module top, as the gate prescribes.pnpm build: exit 0.pnpm dev --fresh, console on Vite): anai:chatentry was injected first inshowcase_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:?c=conv-1restores the conversation (user question plus a markdown answer) with 「New conversation」 in the header.Generated by Claude Code