Repository navigation
feat: let a view add a message to the conversation and let operations omit a view - #326
Conversation
… omit a view A view's actions receive host.conversation in both stacks. appendMessage sends an optional context update and then the message through MCP Apps, never in parallel, only for capabilities the host advertises, and reports where it stopped. A context that cannot be delivered blocks the message unless it is best effort. Operation declarations may omit view. The operation keeps its contracts, annotations, budgets, cancellation and safe failures, and carries no UI association. Both stack server entries re-export registerProtectedOperation beside registerPublicOperation.
timeleft--
left a comment
There was a problem hiding this comment.
Reviewed exact head e453895 against the approved view-conversation design at 6c3638b and the getting-started design's viewless-operation slice. The delivery coordinator will record actual landed SHAs in the owning Blueprint Status sections after merge. Package publication and real-host behavior remain unverified.
Independent validation: Node/npm on macOS; discovered and ran the core conversation, MCP conversation and Streamable HTTP viewless tests: 40 passed. I also exercised a real App/AppBridge with a held message response and an independent lifetime AbortController. After the host received the request, aborting the signal left appendMessage pending (a 100 ms observation returned 'still pending'); it resolved unavailable only after the held host answer was released. The existing late-answer tests release the answer before asserting, so they miss the required abort-settlement behavior.
One blocking finding below. Please add behavioral coverage for abort during a held context and held message, including best-effort context, without requiring release to settle the append. Keep no-retry behavior and ignore late outcomes. No broader reliability mechanism is requested. Other inspected changes preserve operation execution and keep conversation delivery in MCP. Historical test-first chronology has not been independently established by these later checks.
An aborted view now resolves appendMessage as unavailable while the host still holds its answer to a context update or a message, instead of waiting for the host. The request is not retried, no further message is sent, and a late outcome is ignored. The abort listener is removed once a request settles.
timeleft--
left a comment
There was a problem hiding this comment.
Independent re-review of exact head 6a16780 against the approved view-conversation Blueprint at 6c3638b and the viewless-operation slice of getting-started tracks. The only repair changes are the bounded lifetime wait and behavioral tests. The original abort-settlement finding is resolved: the reviewer regression that failed at e453895 now passes before the held host reply is released. New held-context, best-effort-context and held-message cases exercise the same required settlement; late answers cannot send a subsequent message or change the result. No retry or remote rollback is implied.
Observed locally on macOS arm64 / Node v26.12.1: 242 focused tests pass across conversation, viewless HTTP operations, both stack lifetimes, package exports and consumer boundaries; 28 Chromium conversation cases pass (14 through each stack). Typechecks pass for core, MCP and both stacks. npm run test:pnpm-react passes all strict packed-consumer installations and typechecks, including both stack conversation surfaces and public/protected viewless server registrations. Version policy and diff hygiene pass. Reused initial review evidence for unchanged operation execution and the remaining unchanged diff. A reviewer-only untracked regression file was present; tracked source at this exact head was unchanged.
No remaining material finding in the reviewed scope. The required Application types, builds, tests and release qualification check was still in progress at the last GitHub read; this review does not report it passed and merge must wait for the exact-head required checks. The delivery coordinator will land the actual merge SHA mappings in both owning Blueprint Status sections, retaining partial getting-started scope. Local browser/packed-consumer results do not establish Claude, ChatGPT or Alexa+ behavior, package publication, or deployment. Historical test-first chronology remains unverified; these are observed later regressions.
timeleft--
left a comment
There was a problem hiding this comment.
The previously reviewed runtime change remains clean, but main has now advanced through the independently approved React/Hono starter merge (#325, landed 0ad4acb). Before merging this PR I fetched current main and ran python3 scripts/mw-version.py check --base origin/main --title 'feat: let a view add a message to the conversation and let operations omit a view' at exact head 6a16780. It fails: branch is behind current base; update the branch and rerun the updater.
Please merge current main into this same branch (no force push), preserve the starter and conversation changes together, run the version updater/check against that main and resolve any guide/manifest conflicts without losing either change. Reuse valid prior runtime evidence; run affected checks for the integrated paths and current-head CI. No feature expansion or new PR is requested. This is the repository's required current-base/version reconciliation after a sibling merge, not a new runtime defect or a reversal of the earlier behavior review.
|
Merged current main (0ad4acb, the React/Hono starter) into this branch with a normal merge, 544eb47, and pushed 3f80f63. No force push or rebase.
|
|
Main advanced again while this repair ran (8516565, a docs-only change to two Blueprints). I merged it with a normal merge, 6df6a44, so the branch is current again. The version updater changed nothing further and |
timeleft--
left a comment
There was a problem hiding this comment.
Independent integration re-review at exact head 6df6a44. Current main 8516565 is now an ancestor. The current-base version check passes: the merged starter baseline 0.7.8-rc.1 advances to 0.8.0-rc.1 for this feature. Inspected the integration commits and documentation resolutions; the library sources and package manifests/lockfile are unchanged from the previously approved 6a16780 head. Both the React/Hono starter documentation and the conversation/viewless API documentation remain present.
Observed on macOS arm64 / Node v26.12.1: 262 affected checks pass across the original independent abort regression, conversation, viewless HTTP operations, generated React/Hono and Lit/Hono qualification, all offered CLI outputs, documentation and consumer boundaries. Reused the unchanged library's previously observed 242 package/lifetime/export checks, 28 two-stack Chromium cases, affected typechecks and strict packed-consumer qualification; no unchanged browser matrix was repeated.
The integration request is resolved and no material finding remains. The approved design revision remains 6c3638b for view conversation and the getting-started viewless-operation slice. The delivery coordinator retains post-merge actual-SHA status reconciliation in both designs and the connector amendment. Current-head CI must finish successfully before merge; this review does not report pending CI as passed. No publication, deployment or real-host behavior is claimed.
What this changes
Two additive SDK features, released together:
ViewHost.conversation.appendMessage(text, {role?, context?})is available to theactionscallback ofstartA2uiViewin both@saga-a2ui/react-mcp-stackand@saga-a2ui/lit-mcp-stack.view.registerPublicOperationandregisterProtectedOperationaccept a declaration with noview. The operation keeps every execution guarantee and carries no UI association.Designs (approved): view conversation and the "Operations without a view" section of getting-started tracks.
Conversation
@saga-a2ui/core/conversation:Conversation,AppendResult,RequestOutcomeandNO_CONVERSATION, following the@saga-a2ui/core/host-linkspattern (types plus one frozen value, no imports).@saga-a2ui/mcp/view:conversationFromApp(app, signal)besidehostLinksFromApp.context,ui/update-model-contextis sent first (textas a content block,dataasstructuredContent) and only whenupdateModelContextis advertised. Thenui/messagewith roleuser, only whenmessageis advertised. The two requests are never in parallel.stage: 'context'unlesscontext.bestEffortis set; then the message is still attempted and an accepted one resolves{outcome: 'appended', context: <why it was skipped>}.unavailable, sends nothing further and ignores the late answer. Nothing is retried.ViewHost.conversation, built from the sameAppand lifetime signal as the other members, and re-export the three types.One difference from the design text, found while testing. The pinned bridge (
@modelcontextprotocol/ext-apps2.0.3) givesui/update-model-contextan empty result and rejects any other key, so a host cannot refuse a context update withisError. A refused context update is therefore a rejected request and readsfailed.deniedat the context stage is kept for a bridge that allowsisErrorand is covered against a stub.ui/messageanswersisError, which readsdenied, as designed.Operations without a view
viewis optional onPublicOperationandProtectedOperation. An omitted orundefinedview is a viewless operation; a declared view must still be complete.registerinpackages/mcp/src/server/operation.tsdiffers. Without a view it callsMcpServer.registerToolwith the same title, description, contracts, annotations and callback. It registers no resource and adds no_meta.execute()is untouched./serverentries now also re-exportregisterProtectedOperation, so a stack consumer reaches the viewless registration without naming an MCP Apps server API. Previously onlyregisterPublicOperationwas re-exported.Fixture, documentation, version
conversation: {context, message}inmountView: each isaccept,refuse,fail,withhold(capability not advertised) orhold(recorded, unanswered untilreleaseConversation). It records every request in order.docs/react-consumers.mdand the development reference describe both features.exports.test.tsis updated incore,mcpand both stacks.0.7.7-rc.1→0.8.0-rc.1throughscripts/mw-version.py(afeatbefore 1.0). Nothing is published.Evidence
Run from this head in a fresh worktree:
packages/mcp/src/server/operation-viewless.test.ts: the same declaration registered with and withoutview, over Streamable HTTP, giving identical results for invalid input, refusal, an absent record, an over-budget handler, a throwing handler, disconnect cancellation, an asynchronous projection, a malformed projection and invalid output. The viewless tool definition and every result carry no_meta.ui, no resource is listed, and a protected declaration still refuses a missing identity.packages/mcp/src/view/conversation.test.ts(a realAppandAppBridge),packages/core/src/conversation.test.ts, and aViewHost.conversationcase in each stack'sstart-a2ui-view.test.ts.apps/lit-host/e2e/view-conversation.spec.ts: 28 Chromium cases, 14 per stack, against the local host fixture. They cover message only, context then message in order, a held context, a withheld, refused and failed context with and withoutbestEffort, a refused, failing and unavailable message, an ended view, and a late answer after the view ended.vitest run(headless): all pass exceptapps/lynx-fixture(not installed),scripts/candidate-identity.test.ts(needs the builtdist/view; passes afternpm run build), and two timing-dependent tests that pass when re-run alone.npm run buildbuilds the answer, notes, starter, demo, tour and card consumers from packed tarballs, except the Lynx fixture.npm run test:pnpm-react: the packed React stack, Lit stack and server-only consumers install with strict peers and typecheck, including the new stack fixtures and a server-only viewless public and protected registration.scripts/mw-version.py check,test:docs, formatting of the changed files andconsumer-boundary/consumer-stack-importspass.Local checks only: whether Claude, ChatGPT or Alexa+ show the message, or how their assistants respond, is not established here.