You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a conventional shared layout module for server routes #312
Framework mode has no layout.tsx-style convention for a shared route wrapper. Each route must import and render the wrapper manually.
In examples/audiobook-curator, more than 15 generated MCP routes import CuratorDocument directly. This repeats framework plumbing across tools, resources, and prompts and makes it easy for a new route to omit the server's standard document structure.
The conventions table in docs/entry-conventions.md discovers individual MCP route modules, but it offers no conventional composition point around all routes for one server.
Proposal
Add a conventional per-server layout module, such as:
src/mcp/<server>/layout.tsx
The generated Flight worker would compose each route's rendered component inside that layout. The layout should receive the route children and stable route metadata while preserving the route's existing result value and protocol projection.
Projects that do not define a layout should keep today's behavior unchanged. A custom generated-server mode should be able to opt out explicitly.
Why
Centralizes a server's shared Agent Document structure.
Removes repetitive wrapper imports from every route.
Makes wrapper application consistent for newly added routes.
Keeps framework-mode composition convention-driven rather than dependent on route-by-route discipline.
Acceptance criteria
A conventional per-server layout is discovered and compiled for generated MCP routes.
Tools, resources, and prompts can share it without changing their protocol result shapes.
Route-unit rendering exercises the same layout composition as generated workers.
Existing projects without a layout remain source- and behavior-compatible.
Landed in #396 — squash-merged to main as 43a39ad1a (72 files, +2118/−188). Evidence against each acceptance item:
Conventional per-server layout discovered and compiled for generated MCP routes.packages/agent-bundle/src/routes/graph.ts discovers src/layout.{ts,tsx} (root scope) and src/mcp/<server>/layout.{ts,tsx} (server scope) into CompiledRouteGraph.layouts; packages/agent-bundle/src/build/entry-shell.ts composes the chain (root, then server) in the generated MCP Flight worker, the rendered-route worker behind dist/bin/<name>.js and artifact-hosted <target>/bin/<name>.mjs, and rendered scripts. Validation fails closed with AB4830 (layout contract), AB4831 (duplicate scope), AB4832 (orphaned server layout); documented in docs/diagnostics.md. Servers pinned to custom/command/remote via routes.servers.<server> skip their layout (the explicit opt-out the proposal asked for). Tests: packages/agent-bundle/tests/route-graph.test.ts, entry-shell.test.ts, layout-build.test.ts.
Tools, resources, and prompts share it without changing protocol result shapes.@agent-bundle/runtimedecodeAgentDocument treats a valueless Agent.Result as a container that adopts the value of the valued result it directly holds and merges plain-JSON object metadata (container wins), so structuredContent, content, and the CLI Markdown are the route's own; layout metadata surfaces as CallToolResult._meta. Tests: packages/rsc-runtime/tests/dispatcher.test.ts (merge semantics, budgets charged at authored depth, discarded bytes), packages/agent-bundle/tests/projection/mcp-in-memory.test.ts, cli-dispatch-mcp.test.ts.
Route-unit rendering exercises the same composition as generated workers.agent-bundle/test (renderRoute, renderRouteEvents, invokeCli, in-memory MCP) loads manifest.layouts through the generated registry (AGENT_TEST_REGISTRY_VERSION 5) and composes via packages/agent-bundle/src/test/layouts.ts, mirroring the worker template. Tests: packages/agent-bundle/tests/route-unit/render-route.test.ts, test-harness-manifest.test.ts.
Projects without a layout stay source- and behavior-compatible. Layout-free builds render byte-identical MCP, CLI, and script output with an unchanged route-graph digest (layout-build.test.ts "ships byte-identical surfaces when no layout exists", route-graph.test.ts digest pin).
Applied to examples/audiobook-curator: src/layout.tsx replaced the CuratorDocument wrapper across 21 routes; tests/route-unit/routes.test.ts pins the merged provenance metadata and that invokeMcpTool('audit_library') returns the receipt as structuredContent with _meta.curator. Docs: docs/entry-conventions.md (Shared layouts), docs/framework-mode.md, docs/diagnostics.md; changeset .changeset/shared-route-layouts.md (agent-bundle and @agent-bundle/runtime minor). Public types: AgentLayoutProps, AgentLayoutRoute, AgentLayoutRouteKind from @agent-bundle/runtime.
CI on the merged head was green (Verify, Release gates, Examples check, Host install proofs, RSC runtime micro-eval); Codex reviewed every push — 21 review threads, all fixed or answered and resolved.
Activity
feat(routes): add the conventional shared layout module for rendered …
feat(routes): add the conventional shared layout module for rendered …
feat(routes): add the conventional shared layout module for rendered …
feat(routes): add the conventional shared layout module for rendered …
feat(routes): add the conventional shared layout module for rendered …
feat(routes): add the conventional shared layout module for rendered …
feat(routes): conventional shared layout module for rendered routes (#…
ScriptedAlchemy commentedon Sep 3, 2026
Landed in #396 — squash-merged to
mainas43a39ad1a(72 files, +2118/−188). Evidence against each acceptance item:packages/agent-bundle/src/routes/graph.tsdiscoverssrc/layout.{ts,tsx}(root scope) andsrc/mcp/<server>/layout.{ts,tsx}(server scope) intoCompiledRouteGraph.layouts;packages/agent-bundle/src/build/entry-shell.tscomposes the chain (root, then server) in the generated MCP Flight worker, the rendered-route worker behinddist/bin/<name>.jsand artifact-hosted<target>/bin/<name>.mjs, and rendered scripts. Validation fails closed withAB4830(layout contract),AB4831(duplicate scope),AB4832(orphaned server layout); documented indocs/diagnostics.md. Servers pinned tocustom/command/remoteviaroutes.servers.<server>skip their layout (the explicit opt-out the proposal asked for). Tests:packages/agent-bundle/tests/route-graph.test.ts,entry-shell.test.ts,layout-build.test.ts.@agent-bundle/runtimedecodeAgentDocumenttreats a valuelessAgent.Resultas a container that adopts the value of the valued result it directly holds and merges plain-JSON object metadata (container wins), sostructuredContent, content, and the CLI Markdown are the route's own; layout metadata surfaces asCallToolResult._meta. Tests:packages/rsc-runtime/tests/dispatcher.test.ts(merge semantics, budgets charged at authored depth, discarded bytes),packages/agent-bundle/tests/projection/mcp-in-memory.test.ts,cli-dispatch-mcp.test.ts.agent-bundle/test(renderRoute,renderRouteEvents,invokeCli, in-memory MCP) loadsmanifest.layoutsthrough the generated registry (AGENT_TEST_REGISTRY_VERSION5) and composes viapackages/agent-bundle/src/test/layouts.ts, mirroring the worker template. Tests:packages/agent-bundle/tests/route-unit/render-route.test.ts,test-harness-manifest.test.ts.layout-build.test.ts"ships byte-identical surfaces when no layout exists",route-graph.test.tsdigest pin).Applied to
examples/audiobook-curator:src/layout.tsxreplaced theCuratorDocumentwrapper across 21 routes;tests/route-unit/routes.test.tspins the merged provenance metadata and thatinvokeMcpTool('audit_library')returns the receipt asstructuredContentwith_meta.curator. Docs:docs/entry-conventions.md(Shared layouts),docs/framework-mode.md,docs/diagnostics.md; changeset.changeset/shared-route-layouts.md(agent-bundleand@agent-bundle/runtimeminor). Public types:AgentLayoutProps,AgentLayoutRoute,AgentLayoutRouteKindfrom@agent-bundle/runtime.CI on the merged head was green (Verify, Release gates, Examples check, Host install proofs, RSC runtime micro-eval); Codex reviewed every push — 21 review threads, all fixed or answered and resolved.
fix(test): compose the root layout around rendered scripts after the #…
feat(test): script-dispatch and workbench-surface proof levels; route…