Repository navigation
feat(chat-core): mount the shared composer root and atoms in ChatEmbed - #20102
Conversation
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing to check. What this change shipsInventory (8 items) — 8 justifiedIntent: let app embeds use the same chat composer as the dashboard, so composer fixes reach apps too, and show when a message typed during a running turn will wait in the queue. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] f77a568 Description read[DESCRIPTION-READ] ed01a6701b93258b4224383d4b3ac2d8618997ed29f36d9322f7e467fea4ebf1 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Check that a send pressed during a running turn really waits in the server queue, so the new "Queue message" label matches what happens to the message. [DESIGN-REVIEWED] f77a568 Description read[DESCRIPTION-READ] cf84798febe3a6dba17f0cc14bb8d3be4d94d69ce564fad187e43ccd884b75a7 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of UX-Verdict: CONCERNS The blind reader only guessed what the new Queue button does. They read its arrow-into-a-line icon as "upload", and the yellow fill as a warning. Watch
Suggestions
[UX-REVIEWED] f77a568 Description read[DESCRIPTION-READ] cb8a91ee260fbd61c7db2fa0dd5715d4a3e2caa928c9ada4c2305c9aa06cf6ba That sha256 names everything this verdict read: the PR description, plus the 10 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
ChatEmbed drew its own textarea and Send button, so composer fixes made
in chat-core never reached it. It now mounts the chat-core Composer
root with the first store-free Editor and Send atoms
(chat-core/composer/atoms.tsx). Send draws three states: idle, queue
(a turn is running and there is text, matching the main chat's Queue
message control) and a host-supplied stop control.
The root gains its first capabilities writer: the embed passes
{ voice: false }, because the Voice atom reads STT config through the
dashboard api client, which would bypass the host app's
allowedApiPaths, and its setup modal needs the dashboard router.
A static import-graph test pins the composer modules as store-free,
and a runtime test renders, queues and sends from the embed with no
Redux Provider and no router, through the app's scoped api.
f438e13 to
f77a568
Compare
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19994]: Dispositions for the findings on f438e13, fixed in f77a568:
|
|
🤖 Kiro Crew Auto-Pipeline [operator: buluoray#19994]: Dispositions for the UX CONCERNS on f77a568 (advisory, no push: a push restarts every lane, and none of the three is a defect in code this PR adds):
CI on this head after the one allowed re-run of the three infrastructure reds (Publish readiness signal and Sensitive Change Review: "API rate limit exceeded for installation"; Dependency License Gate: "Dependency review is not supported"): 88 success, 10 skipped, 0 failure. PR Readiness is pending only on "pull request is a draft". |
Route ChatInput and ChatEmbed file selection through one store-free Attach atom. Keep real host staging writers and leave dashboard draft persistence, mentions, cancellation and chrome in their current hosts. Move embed staging, file gestures and upload lifecycle into chat-core; retain only permission checks and scoped upload transport at the SDK edge. Keep existing send recovery and host onSend metadata contracts. Refs #19994 (P-c) Dependency review draft only: based on temporary integration commit 1994c94, which preserves pinned #20102 and #19917. This commit does not claim their implementation. Rebuild on then-current main after those prerequisites merge; no auto-merge. Validation: 94 targeted tests pass with shuffled seed 19994; tsc passes. Five real-component fake-data captures rechecked at desktop and 390px.
Route ChatInput and ChatEmbed file selection through one store-free Attach atom. Keep real host staging writers and leave dashboard draft persistence, mentions, cancellation and chrome in their current hosts. Move embed staging, file gestures and upload lifecycle into chat-core; retain only permission checks and scoped upload transport at the SDK edge. Keep existing send recovery and host onSend metadata contracts. Refs #19994 (P-c) Dependency review draft only: based on temporary integration commit 1994c94, which preserves pinned #20102 and #19917. This commit does not claim their implementation. Rebuild on then-current main after those prerequisites merge; no auto-merge. Validation: 94 targeted tests pass with shuffled seed 19994; tsc passes. Five real-component fake-data captures rechecked at desktop and 390px.
* refactor(chat-core): share attachment picker and staging behavior Route ChatInput and ChatEmbed file selection through one store-free Attach atom. Keep real host staging writers and leave dashboard draft persistence, mentions, cancellation and chrome in their current hosts. Move embed staging, file gestures and upload lifecycle into chat-core; retain only permission checks and scoped upload transport at the SDK edge. Keep existing send recovery and host onSend metadata contracts. Refs #19994 (P-c) Dependency review draft only: based on temporary integration commit 1994c94, which preserves pinned #20102 and #19917. This commit does not claim their implementation. Rebuild on then-current main after those prerequisites merge; no auto-merge. Validation: 94 targeted tests pass with shuffled seed 19994; tsc passes. Five real-component fake-data captures rechecked at desktop and 390px. * refactor(chat-core): share only the Attach picker; keep embed upload state in the SDK Per the owner's scope choice on #20178, the embed's staging, upload holds, cancellation and failed-send recovery return to useEmbedAttachments unchanged from #19917. Sharing that lifecycle stays open under #19994. Refs #19994 (P-c)
Problem / Motivation
Goal: ChatEmbed's composer is the shared chat-core composer (the
Composerroot with Editor and Send atoms), so composer fixes reach the app embed, and a message typed while the agent works is shown as one that will wait in the queue.website/src/app-sdk/ChatEmbed.tsxdrew its own<textarea>and Send button. The main chat and the panes build their composer onchat-core/composer/(Composer.tsx), so a composer change made there never reached the embed, and the embed was patched separately (#19994 lists the open PRs doing that). The embed's button also looked the same whether the message would run now or wait behind a running turn; the main chat shows Queue message for the second case.Why it matters
ChatEmbed is the chat every app (Spec Builder, Ops Mission Control, third-party apps) mounts. While it keeps a private composer, each composer behaviour has to be re-implemented and re-reviewed for it, and the next phases of #19994 (Stop in the Send atom, attachments as a shared Attach atom) have no shared home to land in. It also has to stay store-free and keep every request inside the host app's
allowedApiPaths, which is why it could not simply mountChatInput.Not a goal
useEmbedAttachments/ feat(app-sdk): attach files in the chat embed composer #19917 are untouched.ChatInputon the new atoms, or giving the embed mentions, slash commands, pickers or voice.What changed (motivation → approach → change)
website/src/chat-core/composer/atoms.tsx(new):ComposerEditor(the textarea; text and writer come from the root) andComposerSendwith two states decided bycomposerSendState:idle, andqueue(a turn runs and there is something to send). The queue state carries a visible Queue label beside its icon, in the warn colour, with the Queue message accessible name and the "Run after the current work finishes" tooltip — the existing catalog keys the main chat's busy-send menu uses, so no new strings. It usesSendBtnand imports nothing fromstore/. Send's stop state and its attachment inputs are not shipped ahead of their writers (feat(app-sdk): give ChatEmbed a stop button for a running turn #19898, P-c); each lands as one prop when that PR rebases.Composer.tsx:useComposerEditor()gives an atom the editor text (subscribing to adraftstore when the host passed one) andonChange. The root gains its firstcapabilitieswriter, as the RFC planned:{ voice: false }keeps the Voice atom unmounted. The embed must turn it off: the Voice atom reads STT config through the dashboardapiclient (outside the app's scoped api, so outsideallowedApiPaths) and its setup modal callsuseNavigate, which throws in an app with no router.<Composer slotKey value={draft} onChange={setDraft} capabilities={{ voice: false }}>aroundComposerEditor+ComposerSend. The draft still lives inuseComposerDraft(auto-grow, IME-safe Enter, follow-up picks), so the send path, the receipt handling, draft restore on a failed send and the error/notice rows from feat(chat-core): route ChatEmbed, SideChat and app sends through the transport wire #20018 are unchanged. The send still goessendTurn→appApiSendWire(useAppApi()).docs/app-kit/api-reference.md(Queue message label; no voice input in the embed), RFC progress row + thecapabilitiesnote.How the other open embed PRs land on this
send(), not the composer markup.showStop ? <StopControls/> : <button>branch wrapsComposerSendinstead (or adds astopprop to it, the atom's third state); its placeholder edit moves ontoComposerEditor.useEmbedStop,StopControlsand the backendstop_statestay as they are.onPaste/onDragOver/onDroppass throughComposerEditor(it forwards every textarea prop) and its enable rule (uploading, staged files count as content) becomes twoComposerSendprops it adds. P-c then turns it into the Attach atom.Backwards compatibility
Compatible:
ChatEmbed's props and its "Chat message" / "Send message" accessible names are unchanged;Composeronly gains an optional prop, and every existing host passes none, so its Voice atom still mounts.Removes nothing: the embed never had voice; the textarea and button are replaced by atoms that render the same element types with the same names, and the only new state is the Queue label while a turn runs.
Tests
website/src/test/ChatEmbed.composerStoreFree.test.tsx(new)chat-core/composer/Composer.tsxandatoms.tsxand asserts no file undersrc/store/and no Redux package is reachable (a failure prints the chain); asserts ChatEmbed mounts the root and both atoms and has no<textarea>of its own.QueryClientProvider(no ReduxProvider, no router), checks the atoms render with no mic, a send goes through the app's scopedpost('/api/chat…'), and a running turn turns Send into Queue.website/src/chat-core/composer/Composer.test.tsx:voice: falseunmounts the Voice atom (ChatInput gets no mic) and the root then mounts without a router; Editor/Send idle → queue, with the visible Queue word and tooltip asserted; atoms read adraftstore; an atom outside a root throws;composerSendStatetable.website/src/test/ChatEmbed.queue.test.tsx: the busy send is pressed as Queue message.Mutations (each run alone, restored with
git checkout HEAD -- <file>, clean tree between):ChatEmbed.tsxreverted to mainthe embed mounts the chat-core composer root and its atoms,draws the Editor and Send atoms…, both…turns Send into Queue…,shows a send made while busy…{}(voice on)draws the Editor and Send atoms and offers no microphone,sends through the app scoped api(useNavigate() may be used only in the context of a <Router>)capabilities.voice === falsegate inVoiceAtomvoice: false keeps the Voice atom unmounted…,voice: false needs no router…and the atom testsatoms.tsximportscomponents/chat-input/busySendnothing chat-core/composer/atoms.tsx imports reaches the Redux store(printsatoms.tsx -> busySend.tsx -> store/chatSlice.ts)composerSendStatereturnsidlefor running+contentqueuetable rowQueuespana running turn turns Send into Queue once there is text, with the word shownGate:
npx tsc --noEmit -p tsconfig.app.jsonclean; eslint clean on touched files; jscpd 0 clones; vitest 168 related files / 2054 tests pass.scripts/local-gate.pybackend: 80 failures, 79 of which also fail on a cleanorigin/mainworktree in this sandbox (subprocess timeouts,git initblocked); this diff has no backend code.Manual verification
Real
ChatEmbedunder the realAppApiProvider, no ReduxProvider, no router, fake slot data (website/capture/chat-embed-composer.html,website/scripts/capture-chat-embed-composer.mjs), base vs this branch, dark and light. The script asserts the button's accessible name per scene and that a refused send hands the text back; it fails on base for the queue scene (no Queue state there) and passes here, with no page errors.Layout of the Queue state measured in the page after transitions settle (both themes): 81×36 px, one line, no overflow, warn background with black text, inside the 526 px composer row.
Not exercised: a real gateway, or an app hosted in an iframe.
Screenshots / video
Idle — unchanged (base, then this branch):
A turn is running and a message is typed — base keeps the plain send; this branch shows a Queue button:
Light theme, and a refused send (error row + draft restored, unchanged)
Related Issues
Refs #19994 (phase P-b). Builds on #20018 (P-a).
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.