feat(core): global forms support#35106
Merged
Merged
Conversation
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
Builds on the merged form service/routes (#35094, #35099) to support the temporary
"global"form owner needed by MCP elicitation (which lands separately in #35108). The goal is to minimize public surface area: no new endpoints, no wire contract changes — the hack is hidden in a type loosening and a middleware branch.Form.Info.sessionIDis temporarily a plain string. It should be typed asSessionID, and the schema comment says exactly that: the only reason it is a string is the"global"sentinel owner for MCP elicitation, which is not a real session. Revert toSessionIDonce elicitations can be attributed to real sessions. Same for theform.replied/form.cancelledevent payloads.FormLocationMiddlewarereplacesSessionLocationMiddlewareon the existing session-scoped form routes (same paths, same shapes). It treats real session IDs exactly likeSessionLocationMiddleware(decode, session-row lookup, session's location services) and has one undocumented branch:sessionID === "global"bypasses the row lookup and resolves location services from the request, likeLocationMiddleware. This mirrors the approach from the original (reverted) form service commit.InvalidRequestError/SessionNotFoundErroras before.Zero generated churn in client/plugin/SDK surfaces — verified via
check:generatedand a full SDK regeneration producing byte-identical output.Also fixes
packages/client/test/promise.test.ts, which was already failing onv2(#35099 forgot to addformto the expected client group list).Verification
bun typecheckinpackages/schema,packages/core,packages/protocol,packages/server,packages/client,packages/sdk/js,packages/opencodebun test test/form.test.tsinpackages/corebun test test/event-manifest.test.tsinpackages/schemabun test test/promise.test.ts+bun run check:generatedinpackages/client--include v2.session.form: 6/6)