Repository navigation
refactor(desktop): extract the chat surface from app-shell - #1169
Merged
Merged
Conversation
Step 3c (seam 1) of the #1043 plan. The inline empty-state JSX wired into ChatView's emptyOverride - the OnboardingHero plus the conditional FirstRunChecklist inside the maka-onboarding-stack wrapper - moves into a presentational <OnboardingEmptyState> component. The orchestration callbacks (skip milestone + toast, quick-chat submit, open settings / sidebar module / plan-reminder form) stay with AppShell and are passed in; OnboardingEmptyState only owns the JSX structure and the ready_empty conditional. This is the first seam of the ChatWorkspace extraction: the empty state is a distinct, unblocked slice that the workspace component will render. Pure code motion - no behavior change. onboarding-empty-state.tsx is registered in renderer-shell-source-helpers so the combined-source contract keeps covering it; the first-run-task-suggestions contract now pins the openPlanReminderForm -> OnboardingEmptyState -> FirstRunChecklist wiring chain instead of the old direct FirstRunChecklist prop.
Astro-Han
marked this pull request as draft
July 17, 2026 08:44
Step 3c (seam 2a) of the #1043 plan. The sessions-section message surface - ChatView plus the session-health notice that sits above the composer - moves into a presentational <ChatMessageSurface> component. ChatView's props are forwarded via ComponentProps spread; the empty-state stack (OnboardingEmptyState) and the health notice are constructed inside the component from the onboarding snapshot and the sessionHealthNotice view. AppShell renders this as the sessions branch of the section switch, so it is conditionally mounted - the always-mounted Composer is unaffected and stays in AppShell for now. This is the message-view half of the chat-surface extraction; the composer region (interaction slot + Composer) is the next seam. Pure code motion - no behavior change. chat-message-surface.tsx is registered in the source-helper so combined-source contracts keep covering it; the streaming-timeline-render, session-health-notice-layout, and first-run-task-suggestions contracts now pin the new wiring (ChatMessageSurface liveTurn prop, the ChatMessageSurface -> OnboardingEmptyState -> FirstRunChecklist reminder chain, and the health notice living inside the message surface) instead of the inline app-shell JSX.
Step 3c (seam 2b) of the #1043 plan. The composer interaction slot (PermissionPrompt / UserQuestionPrompt) plus the always-mounted Composer move into a <ChatComposerRegion> component. AppShell renders this as a stable sibling of the section switch, so it is NEVER conditionally mounted - the Composer keeps its uncontrolled textarea and draft across section switches and permission takeovers (#646 draft preservation, permission-composer-takeover contract). The structure is identical to the previous inline JSX: Composer stays mounted and uses the native hidden state, so there is zero behavior change. Composer props are forwarded via ComponentProps spread; hidden, draftKey, and stopPending are derived inside the region from the active-session state (hidden keeps the Boolean(activeInteraction) gate the takeover contract pins). The workspace/branch picker and permission-mode-disabled-reason objects stay constructed at the AppShell call site for now. Pure code motion - no behavior change. chat-composer-region.tsx is registered in the source helper; the permission-composer-takeover, permission-response-ipc-boundary, and session-health-notice-layout contracts now point at the new region for the Composer/interaction-slot patterns while the hasModalOpen and activeQuestion derivation assertions stay on app-shell.
Step 3c (seam 2c) of the #1043 plan. The workbar region of the sessions surface - the resize handle plus the lazy-mounted SessionWorkbar (task ledger, embedded browser, artifact pane) - moves into a <ChatWorkbar> component, along with the SessionWorkbarFallback and the lazy import. AppShell renders this conditionally (only beside an active session inside the sessions module), so it is the artifacts-column counterpart to the chat surface components. The lazy chunk boundary and fallback are preserved exactly inside ChatWorkbar, so first-paint behavior is unchanged. Pure code motion - no behavior change. chat-workbar.tsx is registered in the source helper; the session-workbar and renderer-lazy-fallback contracts now point at the new component for the SessionWorkbar / fallback / Suspense patterns while the active-session gating condition stays asserted on app-shell. With this, the mainColumn chat surface and the artifacts workbar are all extracted: app-shell renders ChatMessageSurface, ChatComposerRegion, and ChatWorkbar instead of owning their JSX inline.
Astro-Han
marked this pull request as ready for review
July 17, 2026 09:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #1043 (step 3c). Extracts the entire chat surface out of
app-shell.tsxso the shell orchestrates rather than owns the chat JSX. Four seams, four commits, pure code motion - no behavior change.OnboardingEmptyStateOnboardingHero+ conditionalFirstRunChecklist) wired into ChatView'semptyOverrideChatMessageSurfaceChatViewplus the session-health notice (the sessions-section message view)ChatComposerRegionPermissionPrompt/UserQuestionPrompt) plus the always-mountedComposerChatWorkbarSessionWorkbarand its fallbackAppShell now renders
<ChatMessageSurface>,<ChatComposerRegion>, and<ChatWorkbar>instead of owning ~250 lines of inline chat JSX. The shell shrinks from ~1655 to ~1562 lines; the mainColumn chat surface and the artifacts workbar are all component boundaries.Invariants preserved
ChatComposerRegionis rendered as a stable sibling of the section switch, never conditionally mounted.hiddendrives the native hidden state, exactly as before. The permission-takeover E2E and contract verify this.lazy()boundary,SessionWorkbarFallback, andSuspensemove intoChatWorkbarunchanged, so first-paint behavior is identical.navSelection.sectionswitch; only the chat-surface JSX moved.Contract updates
Each new file is registered in
renderer-shell-source-helpersso combined-source contracts keep covering it. Direct-read contracts now point at the new files for the relocated patterns:streaming-timeline-render:<ChatView liveTurn={activeLiveTurn}>-><ChatMessageSurface liveTurn={activeLiveTurn}>.session-health-notice-layout: the health notice now lives insideChatMessageSurface; the layout contract checks the message-surface sits above the composer region.first-run-task-suggestions: pins theopenPlanReminderForm->ChatMessageSurface->OnboardingEmptyState->FirstRunChecklistwiring chain.permission-composer-takeover/permission-response-ipc-boundary: the Composer block, interaction slot, andPermissionPrompt/UserQuestionPromptpatterns now read fromchat-composer-region.tsx; thehasModalOpenandactiveQuestionderivation assertions stay on app-shell.session-workbar/renderer-lazy-fallback: the<SessionWorkbar>,SessionWorkbarFallback, andSuspensepatterns read fromchat-workbar.tsx; the active-session gating condition stays asserted on app-shell.Verification
tsc -p tsconfig.main.jsonandtsconfig.renderer.json- clean.biome lint(the repo's CI lint command; the formatter is deliberately disabled perbiome.jsonc/ chore: introduce linter/formatter (Biome or ESLint) #415) - clean.node --test dist/main/**/*.test.js- 2661/2661, 0 failures.npm run build:renderer- clean.e2e/permission-takeover.spec.ts,e2e/send-message.spec.ts,e2e/attachment.spec.ts,e2e/session-health-notice.spec.ts- all pass.Review focus
This is the largest seam of the #1043 arc. The riskiest invariant is the always-mounted Composer (draft preservation across section switches and permission takeovers); it has no dedicated E2E, so the extraction preserves the exact render structure (Composer stays mounted,
hiddenprop controls visibility) and relies on thepermission-composer-takeovercontract plus the permission-takeover/attachment/send-message E2E to catch regressions. TheChatComposerRegionprops use aComponentProps<typeof Composer>spread for type safety;hidden,draftKey, andstopPendingare derived inside the region to keep theBoolean(activeInteraction)gate the takeover contract pins.The shell's orchestration logic (hooks, handlers,
closeSettingscross-slice orchestration) stays in AppShell by design - this PR is scoped to the chat-surface JSX extraction, which is the core of "app-shell orchestrates rather than owns".