@noodleseed/one 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/LICENSE +27 -1
  2. package/NOTICE +4 -0
  3. package/dist/assistant-embed-scaffold-template.d.ts +10 -0
  4. package/dist/assistant-embed-scaffold-template.d.ts.map +1 -0
  5. package/dist/assistant-embed-scaffold-template.js +74 -0
  6. package/dist/assistant-embed-scaffold-template.js.map +1 -0
  7. package/dist/commands/assistant-embed-ops.d.ts +2 -0
  8. package/dist/commands/assistant-embed-ops.d.ts.map +1 -0
  9. package/dist/commands/assistant-embed-ops.js +87 -0
  10. package/dist/commands/assistant-embed-ops.js.map +1 -0
  11. package/dist/commands/assistant-ops.d.ts.map +1 -1
  12. package/dist/commands/assistant-ops.js +32 -1
  13. package/dist/commands/assistant-ops.js.map +1 -1
  14. package/dist/commands/catalog-data-resources.d.ts.map +1 -1
  15. package/dist/commands/catalog-data-resources.js +11 -0
  16. package/dist/commands/catalog-data-resources.js.map +1 -1
  17. package/dist/commands/deploy-ops.d.ts +2 -0
  18. package/dist/commands/deploy-ops.d.ts.map +1 -1
  19. package/dist/commands/deploy-ops.js +18 -0
  20. package/dist/commands/deploy-ops.js.map +1 -1
  21. package/dist/commands/mcp-apps.js +20 -0
  22. package/dist/commands/mcp-apps.js.map +1 -1
  23. package/dist/commands/project-setup.d.ts +2 -2
  24. package/dist/commands/project-setup.d.ts.map +1 -1
  25. package/dist/commands/project-setup.js +5 -4
  26. package/dist/commands/project-setup.js.map +1 -1
  27. package/dist/control-plane.d.ts.map +1 -1
  28. package/dist/control-plane.js +2 -0
  29. package/dist/control-plane.js.map +1 -1
  30. package/dist/deploy.d.ts +2 -1
  31. package/dist/deploy.d.ts.map +1 -1
  32. package/dist/deploy.js +56 -39
  33. package/dist/deploy.js.map +1 -1
  34. package/dist/first-run.js +1 -1
  35. package/dist/first-run.js.map +1 -1
  36. package/dist/openapi-import.d.ts.map +1 -1
  37. package/dist/openapi-import.js +6 -1
  38. package/dist/openapi-import.js.map +1 -1
  39. package/dist/project-scaffold-templates.d.ts.map +1 -1
  40. package/dist/project-scaffold-templates.js +6 -2
  41. package/dist/project-scaffold-templates.js.map +1 -1
  42. package/dist/project.d.ts.map +1 -1
  43. package/dist/project.js +3 -1
  44. package/dist/project.js.map +1 -1
  45. package/dist/widget-focused-template.d.ts +4 -0
  46. package/dist/widget-focused-template.d.ts.map +1 -0
  47. package/dist/widget-focused-template.js +75 -0
  48. package/dist/widget-focused-template.js.map +1 -0
  49. package/dist/widget-scaffold-template.d.ts +1 -1
  50. package/dist/widget-scaffold-template.d.ts.map +1 -1
  51. package/dist/widget-scaffold-template.js +129 -41
  52. package/dist/widget-scaffold-template.js.map +1 -1
  53. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.d.ts.map +1 -1
  54. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js +1 -0
  55. package/node_modules/@noodle-borg/agent-kit/dist/curated/error-fixes.js.map +1 -1
  56. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +7 -7
  57. package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
  58. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
  59. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
  60. package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
  61. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.d.ts.map +1 -1
  62. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +32 -22
  63. package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
  64. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.d.ts.map +1 -1
  65. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js +6 -3
  66. package/node_modules/@noodle-borg/agent-kit/dist/skill-content.js.map +1 -1
  67. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts +3 -0
  68. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.d.ts.map +1 -0
  69. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +166 -0
  70. package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -0
  71. package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.d.ts.map +1 -1
  72. package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js +5 -0
  73. package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js.map +1 -1
  74. package/node_modules/@noodle-borg/agent-kit/package.json +2 -1
  75. package/node_modules/@noodle-borg/auth/package.json +1 -0
  76. package/node_modules/@noodle-borg/authoring/dist/customer-auth.d.ts +5 -5
  77. package/node_modules/@noodle-borg/authoring/dist/customer-auth.d.ts.map +1 -1
  78. package/node_modules/@noodle-borg/authoring/dist/customer-auth.js +11 -5
  79. package/node_modules/@noodle-borg/authoring/dist/customer-auth.js.map +1 -1
  80. package/node_modules/@noodle-borg/authoring/dist/react/components.d.ts +1 -1
  81. package/node_modules/@noodle-borg/authoring/dist/react/components.d.ts.map +1 -1
  82. package/node_modules/@noodle-borg/authoring/dist/react/components.js +1 -1
  83. package/node_modules/@noodle-borg/authoring/dist/react/components.js.map +1 -1
  84. package/node_modules/@noodle-borg/authoring/dist/server.d.ts +0 -1
  85. package/node_modules/@noodle-borg/authoring/dist/server.d.ts.map +1 -1
  86. package/node_modules/@noodle-borg/authoring/dist/server.js +4 -2
  87. package/node_modules/@noodle-borg/authoring/dist/server.js.map +1 -1
  88. package/node_modules/@noodle-borg/authoring/package.json +1 -0
  89. package/node_modules/@noodle-borg/capabilities/package.json +1 -0
  90. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts +3 -1
  91. package/node_modules/@noodle-borg/compiler/dist/artifact/types.d.ts.map +1 -1
  92. package/node_modules/@noodle-borg/compiler/dist/compile.d.ts.map +1 -1
  93. package/node_modules/@noodle-borg/compiler/dist/compile.js +48 -3
  94. package/node_modules/@noodle-borg/compiler/dist/compile.js.map +1 -1
  95. package/node_modules/@noodle-borg/compiler/dist/errors.d.ts +1 -1
  96. package/node_modules/@noodle-borg/compiler/dist/errors.d.ts.map +1 -1
  97. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.d.ts.map +1 -1
  98. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.js +1 -4
  99. package/node_modules/@noodle-borg/compiler/dist/fulfilment-emit.js.map +1 -1
  100. package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.d.ts +7 -9
  101. package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.d.ts.map +1 -1
  102. package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.js +8 -18
  103. package/node_modules/@noodle-borg/compiler/dist/fulfilment-structural.js.map +1 -1
  104. package/node_modules/@noodle-borg/compiler/dist/index.d.ts +1 -1
  105. package/node_modules/@noodle-borg/compiler/dist/index.d.ts.map +1 -1
  106. package/node_modules/@noodle-borg/compiler/dist/index.js +1 -1
  107. package/node_modules/@noodle-borg/compiler/dist/index.js.map +1 -1
  108. package/node_modules/@noodle-borg/compiler/dist/manifest/csp-origins.js +2 -2
  109. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts +1 -5
  110. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.d.ts.map +1 -1
  111. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js +19 -8
  112. package/node_modules/@noodle-borg/compiler/dist/manifest/schema.js.map +1 -1
  113. package/node_modules/@noodle-borg/compiler/dist/schema-validation.d.ts +9 -0
  114. package/node_modules/@noodle-borg/compiler/dist/schema-validation.d.ts.map +1 -1
  115. package/node_modules/@noodle-borg/compiler/dist/schema-validation.js +42 -0
  116. package/node_modules/@noodle-borg/compiler/dist/schema-validation.js.map +1 -1
  117. package/node_modules/@noodle-borg/compiler/package.json +1 -0
  118. package/node_modules/@noodle-borg/compute/package.json +1 -0
  119. package/node_modules/@noodle-borg/connector-defs/package.json +1 -0
  120. package/node_modules/@noodle-borg/connector-http/package.json +1 -0
  121. package/node_modules/@noodle-borg/module/package.json +1 -0
  122. package/node_modules/@noodle-borg/module-audit/package.json +1 -0
  123. package/node_modules/@noodle-borg/openapi-import/dist/index.js +1 -1
  124. package/node_modules/@noodle-borg/openapi-import/dist/index.js.map +1 -1
  125. package/node_modules/@noodle-borg/openapi-import/package.json +1 -0
  126. package/node_modules/@noodle-borg/protocol/dist/input-validation.d.ts +9 -0
  127. package/node_modules/@noodle-borg/protocol/dist/input-validation.d.ts.map +1 -1
  128. package/node_modules/@noodle-borg/protocol/dist/input-validation.js +13 -1
  129. package/node_modules/@noodle-borg/protocol/dist/input-validation.js.map +1 -1
  130. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js +8 -5
  131. package/node_modules/@noodle-borg/protocol/dist/sdk-server.js.map +1 -1
  132. package/node_modules/@noodle-borg/protocol/package.json +1 -0
  133. package/node_modules/@noodle-borg/runtime/package.json +1 -0
  134. package/node_modules/@noodle-borg/service/dist/assistant-model-stream.d.ts +19 -0
  135. package/node_modules/@noodle-borg/service/dist/assistant-model-stream.d.ts.map +1 -0
  136. package/node_modules/@noodle-borg/service/dist/assistant-model-stream.js +84 -0
  137. package/node_modules/@noodle-borg/service/dist/assistant-model-stream.js.map +1 -0
  138. package/node_modules/@noodle-borg/service/dist/assistant-store.d.ts +2 -0
  139. package/node_modules/@noodle-borg/service/dist/assistant-store.d.ts.map +1 -1
  140. package/node_modules/@noodle-borg/service/dist/assistant-store.js +11 -0
  141. package/node_modules/@noodle-borg/service/dist/assistant-store.js.map +1 -1
  142. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts +4 -0
  143. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts.map +1 -1
  144. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js +10 -1
  145. package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js.map +1 -1
  146. package/node_modules/@noodle-borg/service/dist/build-info.d.ts +9 -0
  147. package/node_modules/@noodle-borg/service/dist/build-info.d.ts.map +1 -1
  148. package/node_modules/@noodle-borg/service/dist/build-info.js +50 -0
  149. package/node_modules/@noodle-borg/service/dist/build-info.js.map +1 -1
  150. package/node_modules/@noodle-borg/service/dist/client-compatibility.d.ts +5 -0
  151. package/node_modules/@noodle-borg/service/dist/client-compatibility.d.ts.map +1 -0
  152. package/node_modules/@noodle-borg/service/dist/client-compatibility.js +12 -0
  153. package/node_modules/@noodle-borg/service/dist/client-compatibility.js.map +1 -0
  154. package/node_modules/@noodle-borg/service/dist/index.d.ts +3 -1
  155. package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
  156. package/node_modules/@noodle-borg/service/dist/index.js +2 -0
  157. package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
  158. package/node_modules/@noodle-borg/service/dist/main.js +8 -0
  159. package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
  160. package/node_modules/@noodle-borg/service/dist/manifest-normalize.d.ts.map +1 -1
  161. package/node_modules/@noodle-borg/service/dist/manifest-normalize.js +13 -0
  162. package/node_modules/@noodle-borg/service/dist/manifest-normalize.js.map +1 -1
  163. package/node_modules/@noodle-borg/service/dist/options.d.ts +7 -0
  164. package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
  165. package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts +1 -0
  166. package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts.map +1 -1
  167. package/node_modules/@noodle-borg/service/dist/personal-workspace.js +4 -5
  168. package/node_modules/@noodle-borg/service/dist/personal-workspace.js.map +1 -1
  169. package/node_modules/@noodle-borg/service/dist/routes/access-mode.d.ts.map +1 -1
  170. package/node_modules/@noodle-borg/service/dist/routes/access-mode.js +2 -6
  171. package/node_modules/@noodle-borg/service/dist/routes/access-mode.js.map +1 -1
  172. package/node_modules/@noodle-borg/service/dist/routes/assets.d.ts +6 -2
  173. package/node_modules/@noodle-borg/service/dist/routes/assets.d.ts.map +1 -1
  174. package/node_modules/@noodle-borg/service/dist/routes/assets.js +12 -52
  175. package/node_modules/@noodle-borg/service/dist/routes/assets.js.map +1 -1
  176. package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.d.ts.map +1 -1
  177. package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.js +7 -2
  178. package/node_modules/@noodle-borg/service/dist/routes/assistant-dispatch.js.map +1 -1
  179. package/node_modules/@noodle-borg/service/dist/routes/assistant.d.ts +1 -0
  180. package/node_modules/@noodle-borg/service/dist/routes/assistant.d.ts.map +1 -1
  181. package/node_modules/@noodle-borg/service/dist/routes/assistant.js +103 -35
  182. package/node_modules/@noodle-borg/service/dist/routes/assistant.js.map +1 -1
  183. package/node_modules/@noodle-borg/service/dist/routes/control-plane.d.ts.map +1 -1
  184. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js +22 -27
  185. package/node_modules/@noodle-borg/service/dist/routes/control-plane.js.map +1 -1
  186. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.d.ts +3 -0
  187. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.d.ts.map +1 -1
  188. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.js +6 -1
  189. package/node_modules/@noodle-borg/service/dist/routes/org-admin-dispatch.js.map +1 -1
  190. package/node_modules/@noodle-borg/service/dist/routes/org-admin.d.ts +5 -1
  191. package/node_modules/@noodle-borg/service/dist/routes/org-admin.d.ts.map +1 -1
  192. package/node_modules/@noodle-borg/service/dist/routes/org-admin.js +31 -3
  193. package/node_modules/@noodle-borg/service/dist/routes/org-admin.js.map +1 -1
  194. package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
  195. package/node_modules/@noodle-borg/service/dist/serve.js +12 -0
  196. package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
  197. package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
  198. package/node_modules/@noodle-borg/service/dist/service.js +6 -3
  199. package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
  200. package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts +15 -1
  201. package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts.map +1 -1
  202. package/node_modules/@noodle-borg/service/dist/store/control-plane.js +81 -0
  203. package/node_modules/@noodle-borg/service/dist/store/control-plane.js.map +1 -1
  204. package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.d.ts +1 -0
  205. package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.d.ts.map +1 -1
  206. package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.js +18 -0
  207. package/node_modules/@noodle-borg/service/dist/store/postgres-assistant.js.map +1 -1
  208. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts +15 -1
  209. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts.map +1 -1
  210. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js +83 -0
  211. package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js.map +1 -1
  212. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
  213. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +21 -0
  214. package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
  215. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.d.ts +22 -0
  216. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.d.ts.map +1 -0
  217. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js +26 -0
  218. package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js.map +1 -0
  219. package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts +2 -1
  220. package/node_modules/@noodle-borg/service/dist/store/postgres.d.ts.map +1 -1
  221. package/node_modules/@noodle-borg/service/dist/store/postgres.js +10 -9
  222. package/node_modules/@noodle-borg/service/dist/store/postgres.js.map +1 -1
  223. package/node_modules/@noodle-borg/service/dist/store.d.ts +40 -0
  224. package/node_modules/@noodle-borg/service/dist/store.d.ts.map +1 -1
  225. package/node_modules/@noodle-borg/service/dist/store.js.map +1 -1
  226. package/node_modules/@noodle-borg/service/dist/welcome-email.d.ts +65 -0
  227. package/node_modules/@noodle-borg/service/dist/welcome-email.d.ts.map +1 -0
  228. package/node_modules/@noodle-borg/service/dist/welcome-email.js +243 -0
  229. package/node_modules/@noodle-borg/service/dist/welcome-email.js.map +1 -0
  230. package/node_modules/@noodle-borg/service/package.json +2 -0
  231. package/node_modules/@noodle-borg/transport-http/dist/examples/serve-demo.js +1 -1
  232. package/node_modules/@noodle-borg/transport-http/package.json +1 -0
  233. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +26 -0
  234. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts.map +1 -0
  235. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +31 -0
  236. package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js.map +1 -0
  237. package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts +261 -0
  238. package/node_modules/@noodle-borg/wire-contracts/dist/index.d.ts.map +1 -0
  239. package/node_modules/@noodle-borg/wire-contracts/dist/index.js +150 -0
  240. package/node_modules/@noodle-borg/wire-contracts/dist/index.js.map +1 -0
  241. package/node_modules/@noodle-borg/wire-contracts/package.json +31 -0
  242. package/package.json +7 -5
@@ -12,7 +12,7 @@ export const BUNDLED_EXAMPLE_NAMES = [
12
12
  ];
13
13
  /** Real example sources vendored from `examples/<name>`, written under `examples/` in the skill tree. */
14
14
  export const BUNDLED_EXAMPLE_FILES = [
15
- { relPath: "examples/acme-bistro/README.md", content: "# Acme Bistro — end-to-end ordering with payment-only handoff\n\nA Noodle MCP App for **Acme Bistro**, a fictional restaurant. It is the flagship for the **end-to-end\ntransaction** pattern: the customer browses the menu and builds the order *in chat*, and the order\ncompletes in chat — only **payment** hands off, via a signed checkout deep link (the card never touches\nthe app). It pairs a view-backed `tool` menu/cart with app-only `tool` cart helpers and a model-visible\n`create_checkout` tool backed by `handoff.allowedDomains`.\n\nCapability slot: **end-to-end in-chat transaction + payment-only handoff**, plus a worked **design-first**\ndeliverable set (`design/` — a UX Document, a single-file HTML wireframe with an embedded OpenAI Apps SDK\ncompliance audit, and a Recommended API contract). It sets the quality bar the `noodle-seed` skill's\n`references/experience-design.md` and `references/chatgpt-compliance.md` teach. (Distinct from\n`food-ordering`, which is the broad widget-composition proof; this one owns the design-first end-to-end +\ncompliance exemplar.)\n\n## Design deliverables (the standard to match)\n\n- [`design/UX-Document.md`](design/UX-Document.md) — the house-style UX Document.\n- [`design/wireframe.html`](design/wireframe.html) — the single-file wireframe (open in a browser) with the\n embedded OpenAI Apps SDK compliance audit.\n- [`design/api-contract.md`](design/api-contract.md) — the Recommended API shapes for the partner's kitchen/\n ordering backend.\n\n## Local author loop\n\n```sh\nnoodle validate\nnoodle test\nnoodle dev\n```\n\nIn another terminal:\n\n```sh\nnoodle tools list\nnoodle tools call show_menu --args '{\"customer\":\"Asha\"}'\nnoodle tools call create_checkout --args '{\"customer\":\"Asha\",\"cartToken\":\"stone_pizzax2-lemon_tartx1\",\"total\":36}'\nnoodle check --target chatgpt\n```\n\n## Deploy\n\n```sh\nnoodle link --org demo --app acme-bistro\nnoodle deploy --access owner-only\nnoodle open\n```\n\nThis example has no connector secrets and does not include tokens, caller-key mechanisms, or\n`.env.noodle` values. The menu, prices, and URLs are fictional; payment is handled off-app on\n`acme.example`, never in chat.\n" },
15
+ { relPath: "examples/acme-bistro/README.md", content: "# Acme Bistro — end-to-end ordering with payment-only handoff\n\nA Noodle MCP App for **Acme Bistro**, a fictional restaurant. It is the flagship for the **end-to-end\ntransaction** pattern: the customer browses the menu and builds the order *in chat*, and the order\ncompletes in chat — only **payment** hands off, via a signed checkout deep link (the card never touches\nthe app). It pairs a view-backed `tool` menu/cart with app-only `tool` cart helpers and a model-visible\n`create_checkout` tool backed by `handoff.allowedDomains`.\n\nCapability slot: **end-to-end in-chat transaction + payment-only handoff**, plus a worked **design-first**\ndeliverable set (`design/` — a UX Document, a single-file HTML wireframe with an embedded OpenAI Apps SDK\ncompliance audit, and a Recommended API contract). It sets the quality bar the `noodle-seed` skill's\n`references/experience-design.md` and `references/chatgpt-compliance.md` teach. (Distinct from\n`food-ordering`, which is the broad widget-composition proof; this one owns the design-first end-to-end +\ncompliance exemplar.)\n\n## Design deliverables (the standard to match)\n\n- [`design/UX-Document.md`](design/UX-Document.md) — the house-style UX Document.\n- [`design/wireframe.html`](design/wireframe.html) — the single-file wireframe (open in a browser) with the\n embedded OpenAI Apps SDK compliance audit.\n- [`design/api-contract.md`](design/api-contract.md) — the Recommended API shapes for the partner's kitchen/\n ordering backend.\n\n## Local author loop\n\n```sh\nnoodle validate\nnoodle test\nnoodle dev\n```\n\nIn another terminal:\n\n```sh\nnoodle tools list\nnoodle tools call show_menu --args '{\"customer\":\"Asha\"}'\nnoodle tools call create_checkout --args '{\"customer\":\"Asha\",\"cartToken\":\"cart_1\",\"total\":36}'\nnoodle check --target chatgpt\n```\n\n## Deploy\n\n```sh\nnoodle link --org demo --app acme-bistro\nnoodle deploy --access owner-only\nnoodle open\n```\n\nThis example has no connector secrets and does not include tokens, caller-key mechanisms, or\n`.env.noodle` values. The menu, prices, and URLs are fictional; payment is handled off-app on\n`acme.example`, never in chat.\n" },
16
16
  { relPath: "examples/acme-bistro/design/UX-Document.md", content: "# Acme Bistro ChatGPT App — User Flow & Experience Document\n\n**Prepared by:** Noodle Seed\n**Scope:** Diners browse the Acme Bistro menu, build and confirm an order inside ChatGPT, then hand off once to a signed checkout link to pay — the card never touches the app.\n**Status:** Design specification (v1)\n**Funnel boundary:** IN the app — menu, order building, order confirmation, and the checkout hand-off, all in-chat. OFF-app — **payment only**, on Acme Bistro's PCI-scoped checkout at `pay.acme.example`. **No per-user OAuth in this app**; the connector runs on Acme's own service credentials, and the diner authenticates (if at all) only on the payment page.\n\n---\n\n## 0. The One-Paragraph Thesis\n\nA hungry diner opens ChatGPT and types *\"order me two margheritas and a lemon tart from Acme Bistro.\"* Today that intent scatters across a search, a delivery-app download, a menu scroll, and a checkout form. Acme Bistro collapses it into one conversation: the model reads the live menu, parses the order out of plain language, renders a running cart the diner can nudge with a tap or a sentence, and — only when the order is right — mints a **signed, expiring payment link** that opens Acme's own checkout. We own the entire pre-payment experience; Acme owns the money. That split is deliberate and it is the product: the app never sees a card number, so Acme's PCI scope never grows, yet the diner completes a real, paid-intent order without leaving the chat. For a single restaurant, this is the cheapest possible storefront on the fastest-growing surface — one `server.ts`, no app to install, and every order arrives at Acme's checkout already built. If you can convincingly finish this order in a sentence, you have out-competed every tap-driven ordering app on the one axis they cannot copy: language.\n\n---\n\n## 1. Acme Bistro Product Overview (Knowledge Base)\n\n**Acme Bistro is a single fictional neighbourhood restaurant** offering a short, curated menu for pickup ordering. Unlike a marketplace aggregator, there is one kitchen, one menu, and one checkout — which makes the conversational surface tight and the guardrails simple. The ChatGPT App is Acme's storefront on ChatGPT: it shows the menu, builds the order, and passes a ready cart to Acme's payment page.\n\n### 1.1 The Menu (authoritative — the app must know this exactly)\n\n| Item | ID | Price (USD) | Course |\n|------|-----|-------------|--------|\n| Stone-baked Margherita | `stone_pizza` | $14 | Mains |\n| Harvest Roast Bowl | `roast_bowl` | $13 | Mains |\n| House Garden Salad | `house_salad` | $11 | Starters |\n| Lemon Tart | `lemon_tart` | $8 | Desserts |\n| Sparkling Water | `sparkling` | $4 | Drinks |\n\nPrices are whole-dollar and fixed for v1. The **backend owns pricing** — the widget sums line items for display, but the amount that reaches checkout is recomputed and re-validated by Acme at `pay.acme.example`. The menu is small enough to render in a single inline widget with no pagination.\n\n### 1.2 The End-to-End Model (the defining choice)\n\nEvery other decision follows from one line: **the order is built and confirmed in chat; only payment hands off.** There is no in-chat card capture, no wallet, no stored payment method. When the diner is ready, the app calls `create_checkout`, which returns a **signed deep link** carrying a url-safe cart token and the numeric total; ChatGPT opens it, and Acme's checkout takes the card. The MCP server is never in the payment path.\n\n### 1.3 Business Model & Why Acme Wants This\n\nAcme's bottleneck is reach, not kitchen capacity: a neighbourhood restaurant has no realistic way onto a conversational surface without building an app. The ChatGPT App removes that bottleneck for the cost of one authored server. **Attribution is built in** — every checkout link carries `src=chatgpt`, so Acme can measure exactly how much revenue the conversational storefront drives against their existing web orders.\n\n---\n\n## 2. Competitive Landscape — Food Ordering on ChatGPT\n\n| Pattern | Examples | Strength | Gap Acme fills |\n|---------|----------|----------|----------------|\n| **Marketplace aggregators** | Large delivery apps | Vast networks, delivery logistics | Menu markups, no single-restaurant intimacy, heavy handoff to a separate app |\n| **Reservation / discovery** | Booking + reviews apps | Strong discovery inventory | No ordering, no checkout |\n| **Acme Bistro (this app)** | — | One kitchen, honest single-menu pricing, full order built in chat, payment on Acme's own PCI checkout | — |\n\n**Acme's position:** Acme is not trying to be a marketplace. Its advantage inside ChatGPT is **directness** — a diner who already wants Acme's food gets from craving to a paid-ready cart in one conversation, with the restaurant's own prices and the restaurant's own checkout. The single-restaurant scope is a feature: no ranking to game, no cross-restaurant carts, no ambiguity about whose menu the model is grounding on.\n\n---\n\n## 3. Target User Personas\n\n### Persona A — \"The Regular\"\nOrders from Acme every week and knows the menu. Wants the shortest possible path: *\"the usual — two margheritas and a sparkling water.\"* Values speed and an accurate cart over discovery.\n\n### Persona B — \"The Craver\"\nArrives with an appetite, not a specific dish: *\"something light from Acme\"* or *\"what mains do you have?\"* Needs the menu surfaced fast and an opinionated nudge toward the roast bowl or the salad.\n\n### Persona C — \"The Careful Orderer\"\nHas a dietary constraint and asks before adding: *\"is the garden salad vegetarian?\"* Needs honest, non-guessing answers grounded only in what the menu data actually states — and a clear defer-to-restaurant when it doesn't.\n\n### Persona D — \"The Group Coordinator\"\nOrdering for two or three people with a running budget: *\"add a margherita, a roast bowl, a salad, and a lemon tart — what's the total?\"* Needs a live, legible cart total and easy quantity edits before committing to pay.\n\n---\n\n## 4. Conversational User Flow\n\n### 4.1 Entry Points\n\nNatural phrases that should trigger the app:\n\n```\n\"Show me the Acme Bistro menu\"\n\"Order two margheritas and a lemon tart from Acme\"\n\"I want something light from Acme Bistro\"\n\"What mains does Acme have?\"\n\"Add a sparkling water to my Acme order\"\n\"What's my Acme total?\"\n\"Check out and pay for my Acme order\"\n```\n\n### 4.2 Flow Architecture\n\n```\n┌──────────────────────────────────────────────┐\n│ USER ENTERS CHAT │\n│ (natural-language prompt) │\n└───────────────────────┬────────────────────────┘\n │\n ▼\n ┌─────────────────────────────┐\n │ show_menu (widget) │\n │ MenuCart renders: 5 items, │\n │ steppers, live total, CTA │\n └──────────────┬───────────────┘\n │\n ┌───────────────┼────────────────┐\n ▼ ▼ ▼\n┌──────────────┐ ┌──────────────┐ ┌──────────────┐\n│ add_to_cart │ │remove_from_ │ │ taps in │\n│ (NL: \"two │ │cart (NL or │ │ the widget │\n│ margheritas\")│ │ − button) │ │ (+ / −) │\n└──────┬───────┘ └──────┬───────┘ └──────┬───────┘\n └────────────────┼────────────────┘\n ▼\n ┌─────────────────────────────┐\n │ Live cart + running total │\n │ (summed in the widget) │\n └──────────────┬───────────────┘\n │ \"check out & pay\"\n ▼\n ┌─────────────────────────────┐\n │ create_checkout │\n │ → signed, expiring link to │\n │ pay.acme.example │\n └──────────────┬───────────────┘\n ▼ (OFF-APP)\n ┌─────────────────────────────┐\n │ Acme PCI checkout · card │\n │ entered here, never in chat │\n └─────────────────────────────┘\n```\n\n### 4.3 Detailed Conversational Scenarios\n\n#### Scenario 1 — Natural-language order (Persona A/D)\n\n```\nUSER: Order me two margheritas and a lemon tart from Acme Bistro.\n\nAPP: [tool: show_menu {customer:\"Guest\"}] → renders MenuCart\n [tool: add_to_cart {item:\"stone_pizza\", quantity:2}]\n [tool: add_to_cart {item:\"lemon_tart\", quantity:1}]\n\n Here's your Acme Bistro order — two Stone-baked Margheritas\n and a Lemon Tart. That's $36 so far. Want a drink or a side,\n or shall I take you to checkout to pay?\n\n [MenuCart widget]\n ┌────────────────────────────────────────────┐\n │ 🍽 Acme Bistro 2 in cart │\n │ Stone-baked Margherita Mains $14 [−]2[+]│\n │ Harvest Roast Bowl Mains $13 [−]0[+]│\n │ House Garden Salad Starters$11 [−]0[+]│\n │ Lemon Tart Desserts $8 [−]1[+]│\n │ Sparkling Water Drinks $4 [−]0[+]│\n │ ────────────────────────────────────────── │\n │ Total $36 [ 💳 Check out & pay ] │\n │ Payment happens on acme.example — your card │\n │ is never entered in chat. │\n └────────────────────────────────────────────┘\n```\n\n#### Scenario 2 — Add and edit (Persona D)\n\n```\nUSER: Add a sparkling water too.\n\nAPP: [tool: add_to_cart {item:\"sparkling\", quantity:1}]\n Added a Sparkling Water — your total is $40 for four items.\n\nUSER: Actually drop one margherita.\n\nAPP: [tool: remove_from_cart {item:\"stone_pizza\"}]\n Done — one Margherita, one Lemon Tart, one Sparkling Water.\n New total $26. Ready to pay whenever you are.\n```\n\n#### Scenario 3 — Dietary question, honest answer (Persona C)\n\n```\nUSER: Is the garden salad vegetarian?\n\nAPP: The House Garden Salad is on our Starters menu at $11. I can\n tell you what's on the menu, but I can't confirm ingredient-\n level details like preparation or cross-contact — for\n allergy or dietary certainty, please check with Acme Bistro\n directly before ordering. Want me to add it anyway, or show\n you the other starters and mains?\n```\n\n#### Scenario 4 — Checkout handoff (all personas)\n\n```\nUSER: Check out and pay.\n\nAPP: [tool: create_checkout {customer:\"Guest\",\n cartToken:\"stone_pizzax2-lemon_tartx1-sparklingx1\", total:40}]\n\n Your order's ready — two Margheritas, a Lemon Tart, and a\n Sparkling Water, $40 total. I've opened Acme's secure\n checkout to take payment. Your card is entered on\n acme.example, never here in chat.\n\n [opens https://pay.acme.example/checkout?cart=\n stone_pizzax2-lemon_tartx1-sparklingx1&total=40&src=chatgpt]\n```\n\n---\n\n## 5. UI Widget Specifications\n\n> The widget is authored as a Noodle Seed React `view` (`tool` → `MenuCart`), styled with **vanilla CSS cascade layers** so it inherits the host's light/dark theme and adapts to ChatGPT's surface. Compliance is verified with `noodle check --target chatgpt`.\n\n### 5.1 Design System Compliance\n\nAcme authors **one** brand surface through the server `branding` tokens; everything else defers to host-provided semantic tokens (text, background, border, success/warning), so the widget looks native in ChatGPT.\n\n| Category | Source | Value |\n|----------|--------|-------|\n| Text / background / border | Host semantic tokens (via cascade layers) | Host-provided, theme-aware |\n| Brand accent | `branding.accent` | `#B91C1C` (Acme red) — **primary CTA + logo mark only** |\n| Surface (light) | `branding.surface` | `#FEF3F2` |\n| Surface (dark) | `branding.surfaceDark` | `#1A1211` |\n| Radius / density | `branding.radius` / `branding.density` | `lg` / `comfortable` |\n\n**Enforced rules:** system font stack; monochromatic outlined icons (the plate mark, the card glyph); WCAG AA contrast on all text/surface pairs (Acme red is used only as a fill behind light text or as a 1px mark, never as body text on white); no nested scroll (the 5-item menu fits without an inner scroller); brand accent restricted to the primary **Check out & pay** button and the header mark.\n\n### 5.2 Display Mode Strategy\n\n| User intent | Display mode | Rationale |\n|-------------|--------------|-----------|\n| Browse the menu / build an order | **Inline Card** (`MenuCart`) | Five items + steppers + total fit an inline card; no drill-in, no pagination |\n| Confirm total & pay | **Inline Card** (same widget, primary CTA) | The CTA opens the off-app checkout; no in-chat payment surface |\n| Payment | **None (off-app browser)** | Deliberately not a widget — card capture stays on Acme's PCI page |\n\nModes deliberately **not** used: no Carousel (a single flat menu doesn't need one), no Fullscreen (five items don't warrant it), no Picture-in-Picture (there is no live-tracking phase in v1 — fulfilment happens after payment on Acme's side).\n\n### 5.3 Widget Specifications\n\n#### ★ `MenuCart` — Inline Card\n**Purpose:** the entire in-chat experience — menu, order building, live total, and the checkout hand-off — in one widget.\n\n| Spec | Value |\n|------|-------|\n| Header | Plate mark, \"Acme Bistro\" title, status subtitle, cart chip (`N in cart` / `Fullscreen`) |\n| Menu rows | One per item: name, course, price, and a `[− qty +]` stepper |\n| Total | Live subtotal summed in React from the session-local cart |\n| Primary action | **Check out & pay** (brand red) — disabled while the cart is empty or checkout is pending; opens the signed link via `openExternal` |\n| Reassurance | Fine-print note: \"Payment happens on acme.example — your card is never entered in chat.\" |\n| Edge states | Empty cart (CTA disabled), pending checkout (\"Opening checkout…\"), dark theme variant |\n\n**Two-users note:** every row is model-fillable — the model reflects *\"two margheritas\"* into `add_to_cart {item:\"stone_pizza\", quantity:2}`, and the same widget a human taps updates identically.\n\n---\n\n## 6. Tool Definitions (App Backend)\n\n### ★ Tool 1: `show_menu` — `tool`\n**Input:** `{ customer?: string = \"Guest\" }`\n**Output:** `{ status, customer, items[] }` where each item is `{ id, name, price, kind }`.\n**Renders:** the `MenuCart` widget.\n**Annotations:** read-only.\n**Triggers:** any menu / ordering intent (\"show me Acme's menu\", \"order from Acme\").\n\n### Tool 2: `add_to_cart` — `tool`\n**Input:** `{ customer?, item: <menu id> = \"stone_pizza\", quantity?: int ≥1 = 1, notes?: string }`\n**Output:** `{ status, item, quantity, notes }`.\n**Annotations:** local write (non-destructive).\n**Triggers:** natural-language additions (\"add two margheritas\", \"and a lemon tart\"). Widget-facing helper — reflects NL selections into the visible cart.\n\n### Tool 3: `remove_from_cart` — `tool`\n**Input:** `{ customer?, item: <menu id> = \"stone_pizza\" }`\n**Output:** `{ status, item }`.\n**Annotations:** local write (non-destructive).\n**Triggers:** \"drop one margherita\", \"remove the salad\", or the widget's `−` button.\n\n### ★ Tool 4: `create_checkout` — model-visible `tool`\n**Input:** `{ customer?, cartToken: string = \"cart\", total: number ≥0 = 0 }`\n**Output:** `{ status, summary, checkoutUrl }`.\n**Annotations:** open-link (external action).\n**Behaviour:** returns a signed deep link — `https://pay.acme.example/checkout?cart=<cartToken>&total=<total>&src=chatgpt`. The card never reaches this app. `handoff.allowedDomains` includes `pay.acme.example`, so the compiler derives the ChatGPT redirect domain and the link opens without a safe-link warning.\n**Triggers:** \"check out\", \"pay\", \"I'm done\".\n\nTools are atomic and model-friendly: `show_menu` reads, the two cart tools write locally, `create_checkout` opens the one external link. There is no `submit_order` or `capture_payment` tool by design — order fulfilment and payment are Acme's, past the boundary.\n\n---\n\n## 7. Conversation Design Principles\n\n### 7.1 Tone of Voice\nWarm, concise, and restaurant-first — like a counter host who knows the menu. State prices and totals as plain facts (\"that's $36 so far\"), recommend when it helps (\"the roast bowl is the heartier main\"), and never oversell.\n\n### 7.2 Guardrails (non-negotiable)\n- **Never invent menu items or prices.** Ground every dish and amount in the `show_menu` data — only the five items, only their listed prices.\n- **Never confirm allergen or dietary safety.** State what the menu says (course, name, price); for ingredient-level or cross-contact questions, defer to Acme Bistro directly. Never assert \"this is vegetarian/gluten-free\" without a menu flag that says so.\n- **Never take payment in chat.** No card numbers, no CVV, no wallet. Payment is the one off-app step; if a user pastes card details, decline and point them to the checkout link.\n- **Never promise fulfilment the app can't see.** The app builds and hands off the order; pickup timing and order status live on Acme's side after payment.\n- **Always show the honest total before checkout**, and restate that payment happens on `acme.example`.\n\n### 7.3 Memory Strategy\nRemember the diner's in-session cart and name. There is no cross-session account (no per-user auth) — a returning diner starts a fresh order, though the model may recall a prior order *within the same conversation* to speed a reorder.\n\n### 7.4 Multi-Turn Intelligence\nThe model infers item + quantity from language (\"a couple of margheritas\" → `quantity:2`), keeps a running total in view, and asks only when genuinely ambiguous (\"did you mean the margherita or the roast bowl?\"). It never asks for a field it can default.\n\n---\n\n## 8. End-to-End User Journey Map\n\n**Phase 1 — Menu (first 5–10s):** user names Acme or asks for the menu → `show_menu` renders `MenuCart`.\n**Phase 2 — Build (10–40s):** natural-language adds/removes (`add_to_cart` / `remove_from_cart`) and/or widget steppers; the total updates live.\n**Phase 3 — Confirm (5–10s):** the app restates the cart and total in plain language; user says \"pay\".\n**Phase 4 — Hand off (2–5s):** `create_checkout` mints the signed link; ChatGPT opens it.\n**Phase 5 — Pay (off-app):** the diner enters their card on `pay.acme.example`; the app's job is done. Fulfilment is Acme's.\n\n---\n\n## 9. Handoff Architecture (Deep Dive)\n\n**What must be true of the handoff:**\n1. **Context survives the jump.** The cart token encodes every line (`stone_pizzax2-lemon_tartx1-sparklingx1`) plus the total, so Acme's checkout rehydrates the exact order without a second round-trip.\n2. **The link is signed and attributable.** Acme signs the checkout URL server-side and carries `src=chatgpt` for attribution. `handoff.allowedDomains: ['https://pay.acme.example', 'https://acme.example']` lets the compiler emit the redirect domain so the link opens cleanly.\n3. **State is re-validated past the boundary.** Acme recomputes pricing, checks inventory, and enforces the total at checkout — the widget's sum is display-only and never authoritative.\n4. **The link expires.** Checkout URLs carry an `expires_at`; a stale link lands on a \"cart expired — start again\" page rather than charging an out-of-date total.\n\n**URL pattern:** `https://pay.acme.example/checkout?cart={cartToken}&total={total}&src=chatgpt`\n\n**Why payment is the only handoff:** keeping card capture on Acme's PCI-scoped checkout means the MCP server never enters payment scope — no card data, no stored methods, no compliance burden added by the ChatGPT surface. The app is the storefront; Acme is the register.\n\n**Open questions for Acme engineering:**\n- Signing scheme + default expiry window (proposed: 15 minutes)?\n- Should the cart token be opaque (server-minted) instead of the human-readable `idxN-idxN` form, to prevent client-side total tampering before re-validation?\n- Post-payment visibility (webhook / polling) so a later chat turn can confirm \"your order is ready\" — out of scope for v1?\n\n---\n\n## 10. Demo Scope Recommendation\n\n**MVP (build in this order):**\n1. `show_menu` + `MenuCart` — menu renders, steppers work, total sums live.\n2. `add_to_cart` / `remove_from_cart` — natural-language and button edits both reflect in the cart.\n3. `create_checkout` — signed link opens Acme's checkout with the cart pre-loaded.\n\n**2-minute demo script:**\n```\nNARRATOR: \"A diner wants dinner from their neighbourhood spot,\nAcme Bistro, without leaving ChatGPT.\"\n\nUSER: \"Order two margheritas and a lemon tart from Acme Bistro.\"\n[show_menu renders MenuCart; add_to_cart ×2 fills the cart — $36]\n\nUSER: \"Add a sparkling water.\"\n[add_to_cart — total ticks to $40]\n\nUSER: \"What's my total?\"\n[MenuCart shows Total $40, four items]\n\nUSER: \"Check out and pay.\"\n[create_checkout mints the signed link; ChatGPT opens\n pay.acme.example — card entered there, never in chat]\n\nNARRATOR: \"Built and confirmed in one conversation; paid on Acme's\nown secure checkout. The app never saw a card number.\"\n```\n\n---\n\n## 11. Technical Architecture (High Level)\n\n```\n┌───────────────────────────────────────────────┐\n│ ChatGPT Client │\n│ MenuCart widget (Noodle Seed React view) │\n│ cascade-layer CSS · host theme tokens │\n└───────────────────────┬─────────────────────────┘\n │ tool calls\n ▼\n┌───────────────────────────────────────────────┐\n│ Acme Bistro MCP server (Noodle Seed) │\n│ show_menu · add_to_cart · remove_from_cart │\n│ create_checkout │\n│ branding tokens · handoff.allowedDomains │\n│ (static menu data; no per-user auth) │\n└───────────────────────┬─────────────────────────┘\n │ signed checkout link (no card data)\n ▼\n┌───────────────────────────────────────────────┐\n│ Acme Bistro checkout — pay.acme.example │\n│ PCI-scoped card capture · pricing/inventory │\n│ validation · order fulfilment │\n└───────────────────────────────────────────────┘\n```\n\nMenu data is static in v1 (authored in `server.ts`). Session cart state lives in the widget (React). No database, no per-user credentials, no card data in the MCP server — the smallest possible surface for a single-restaurant storefront.\n\n---\n\n## 12. Success Metrics\n\n| Metric | Target | Measurement |\n|--------|--------|-------------|\n| Menu render → first add | 55%+ of `show_menu` sessions add ≥1 item | `add_to_cart` call rate |\n| Cart with ≥1 item → `create_checkout` | 60%+ | Tool-call funnel |\n| Checkout link opened → paid (on Acme) | Acme-side; joined via `src=chatgpt` | Acme checkout analytics |\n| End-to-end (entry → paid order) | 15%+ | Funnel + Acme attribution |\n| Average order value | $30+ | Cart totals at `create_checkout` |\n| Time to checkout hand-off | Under 60s | Session duration |\n\n**Attribution mechanics:** every `create_checkout` link carries `src=chatgpt`, so Acme can attribute paid revenue to the ChatGPT storefront and compare it against their existing web channel.\n\n---\n\n## 13. Future Enhancements (Post-Launch)\n\n- **Item notes at scale** — surface the `notes` field in the widget for per-item requests (\"no basil\").\n- **Modifier groups** — sizes / add-ons if the menu grows beyond flat items (would introduce an item-detail widget).\n- **Live inventory** — mark sold-out items unavailable from Acme's kitchen system.\n- **Post-payment confirmation** — an Acme webhook so a later chat turn can confirm \"your order is ready for pickup.\"\n- **Returning-diner reorder** — opt-in, if Acme later adds per-user accounts (would move this app off the no-auth model deliberately).\n- **Scheduled pickup** — choose a pickup window before the checkout hand-off.\n- **Second location** — a lightweight location picker if Acme opens another kitchen (keeps single-menu simplicity per location).\n\n---\n\n### Appendix A — Funnel Boundary Cheat-Sheet\n\n| User request | Handled in the app? | Where it lands |\n|--------------|---------------------|----------------|\n| \"Show me the menu\" | ✅ In-chat | `show_menu` → `MenuCart` |\n| \"Add two margheritas\" | ✅ In-chat | `add_to_cart` |\n| \"Drop the salad\" | ✅ In-chat | `remove_from_cart` |\n| \"What's my total?\" | ✅ In-chat | Live widget total |\n| \"Check out / pay\" | ✅ In-chat → hand-off | `create_checkout` mints signed link |\n| Enter card & pay | ❌ OFF-APP | `pay.acme.example` (Acme PCI checkout) |\n| Pickup timing / order status | ❌ OFF-APP | Acme's side, post-payment |\n| Account / saved cards | ❌ Not in v1 | No per-user auth by design |\n\n---\n\n*This document is the master spec for the Acme Bistro ChatGPT App. Acme Bistro, its menu, and its domains are illustrative. All tool names, widget names, menu items, and prices match the runnable Noodle Seed app exactly; the checkout link shape and pricing/inventory validation are owned by Acme's backend past the funnel boundary.*\n" },
17
17
  { relPath: "examples/acme-bistro/design/api-contract.md", content: "# Acme Bistro — Recommended API Shapes\n\n**For Acme Bistro Engineering.** Concrete request/response JSON for each tool the ChatGPT App calls, so your backend can implement exactly what the app needs. These are a starting point for the contract, not a final spec — field names and envelopes can shift to match Acme's platform conventions, as long as the semantics below are preserved.\n\n> **The backend owns pricing, inventory, and payment.** The widget sums line items for *display only*; the amount that reaches checkout is recomputed and enforced by Acme at `pay.acme.example`. The MCP server never sees a card number, a CVV, or a stored payment method — payment is the single off-app step. Keep pricing, availability, and the signed checkout link server-side.\n\nThe app maps to four tools:\n\n| Tool | Kind | Job |\n|------|------|-----|\n| `show_menu` | `tool` (read-only) | Return the menu + render the `MenuCart` widget |\n| `add_to_cart` | `tool` (local write) | Reflect a natural-language addition into the visible cart |\n| `remove_from_cart` | `tool` (local write) | Remove one unit of an item |\n| `create_checkout` | model-visible `tool` (open-link) | Mint the signed, expiring payment link |\n\nMenu item IDs are the stable enum: `stone_pizza`, `roast_bowl`, `house_salad`, `lemon_tart`, `sparkling`.\n\n---\n\n## 1. `show_menu` — menu + widget\n\nThe one read. Returns the full menu (small enough to render without pagination) plus a status line the model can speak.\n\n**Request**\n```json\n{\n \"customer\": \"Guest\"\n}\n```\n\n**Response**\n```json\n{\n \"status\": \"Acme Bistro menu is ready for Guest. Build the order here; pay at checkout.\",\n \"customer\": \"Guest\",\n \"items\": [\n { \"id\": \"stone_pizza\", \"name\": \"Stone-baked Margherita\", \"price\": 14, \"kind\": \"Mains\" },\n { \"id\": \"roast_bowl\", \"name\": \"Harvest Roast Bowl\", \"price\": 13, \"kind\": \"Mains\" },\n { \"id\": \"house_salad\", \"name\": \"House Garden Salad\", \"price\": 11, \"kind\": \"Starters\" },\n { \"id\": \"lemon_tart\", \"name\": \"Lemon Tart\", \"price\": 8, \"kind\": \"Desserts\" },\n { \"id\": \"sparkling\", \"name\": \"Sparkling Water\", \"price\": 4, \"kind\": \"Drinks\" }\n ]\n}\n```\n\n**Notes.**\n- `price` is a whole-dollar USD number in v1. If Acme moves to cents or a currency field, keep one canonical numeric price per item so the widget's sum and the checkout total agree.\n- `items[]` is the authoritative menu — the model must not invent dishes or prices outside this list.\n- **Extensibility:** Acme may add fields (`description`, `available`, `dietary_tags`, `image_url`) without breaking the app, as long as `id`, `name`, `price`, and `kind` remain. If `available: false` is added, the widget should disable that row's `+` button.\n\n---\n\n## 2. `add_to_cart` — reflect a natural-language addition\n\nCalled when the diner says *\"add two margheritas\"* — the model fills `item` and `quantity` from language. The cart is session-local in the widget; this tool echoes the resolved selection so the model can speak it back.\n\n**Request**\n```json\n{\n \"customer\": \"Guest\",\n \"item\": \"stone_pizza\",\n \"quantity\": 2,\n \"notes\": \"\"\n}\n```\n\n**Response**\n```json\n{\n \"status\": \"Added 2 × stone_pizza for Guest.\",\n \"item\": \"stone_pizza\",\n \"quantity\": 2,\n \"notes\": \"\"\n}\n```\n\n**Notes.**\n- `quantity` is an integer ≥ 1 (defaults to 1). `item` must be one of the five menu IDs; reject unknown IDs.\n- `notes` is a free-text per-item request (\"no basil\"); optional, defaults to empty.\n- **If Acme makes this server-authoritative** (rather than widget-local), return the updated line and a running subtotal so the frontend can render without a second call — e.g. add `line_total` and `cart_subtotal`. For v1 the widget owns the running total, so the minimal echo above is sufficient.\n\n---\n\n## 3. `remove_from_cart` — remove one unit\n\nCalled by the widget's `−` button or by language (\"drop a margherita\"). Removes one unit of the item.\n\n**Request**\n```json\n{\n \"customer\": \"Guest\",\n \"item\": \"stone_pizza\"\n}\n```\n\n**Response**\n```json\n{\n \"status\": \"Removed stone_pizza for Guest.\",\n \"item\": \"stone_pizza\"\n}\n```\n\n**Notes.**\n- Removing decrements by one; the widget deletes the line when its quantity reaches zero.\n- No error if the item isn't in the cart — the operation is idempotent from the model's view (the widget guards the `−` button when quantity is 0).\n\n---\n\n## 4. `create_checkout` — mint the signed payment link\n\nThe one handoff. The widget computes the total (live React) and passes a url-safe cart token plus the numeric total; the tool returns a **signed, expiring** deep link to Acme's PCI-scoped checkout. **No card data is exchanged here** — the diner enters their card on `pay.acme.example`.\n\n**Request**\n```json\n{\n \"customer\": \"Guest\",\n \"cartToken\": \"stone_pizzax2-lemon_tartx1-sparklingx1\",\n \"total\": 40\n}\n```\n\n**Response**\n```json\n{\n \"status\": \"Ready to pay for Guest's order.\",\n \"summary\": \"Guest's Acme Bistro order · 40 USD\",\n \"checkoutUrl\": \"https://pay.acme.example/checkout?cart=stone_pizzax2-lemon_tartx1-sparklingx1&total=40&src=chatgpt\",\n \"expires_at\": \"2026-07-09T18:15:00-07:00\"\n}\n```\n\n**Notes.**\n- **`checkoutUrl` must be signed server-side.** The `cart` and `total` query params are a convenience for rehydration and display — Acme's checkout must **recompute pricing from the cart token and enforce its own total**, never trusting the client-supplied `total`. Treat the incoming `total` as a display hint to reconcile, not as the charge amount.\n- **`expires_at`** bounds the link (proposed 15-minute window). An expired link should land on a \"cart expired — start again\" page, not charge a stale total. The runnable app returns `status`, `summary`, and `checkoutUrl`; adding `expires_at` is the recommended production extension so the model can tell the diner how long the link is good for.\n- **`src=chatgpt`** is the attribution parameter — carry it through to Acme's order record so ChatGPT-sourced revenue is measurable against the web channel.\n- **Cart token format.** The app emits a human-readable `<id>x<qty>-<id>x<qty>` token. For production, consider an **opaque server-minted token** (the client passes a cart handle; Acme resolves it to the authoritative lines) to remove any incentive to tamper with the token or `total` before re-validation.\n- **`handoff.allowedDomains`** in the server (`https://pay.acme.example`, `https://acme.example`) is what lets the compiler derive the ChatGPT redirect domain, so the link opens without a safe-link warning. Any new payment domain must be added there.\n\n---\n\n## Validation & ownership summary\n\nThe backend must own and enforce:\n\n1. **Pricing** — the authoritative per-item price and the order total; the widget sum is display-only.\n2. **Inventory** — item availability at menu-read and at checkout; a sold-out item should not reach a paid order.\n3. **Payment** — all card capture on `pay.acme.example`, inside Acme's PCI scope. The MCP server is never in the payment path.\n4. **Link integrity** — server-side signing of `checkoutUrl`, an enforced `expires_at`, and recomputation of the total from the cart token before charging.\n\nEverything before payment — menu, cart, total, and minting the link — is the ChatGPT App's job. Everything at and after payment is Acme's.\n\n---\n\n## Open questions for Acme engineering\n\n1. **Cart token shape** — keep the readable `idxN-idxN` form, or move to an opaque server handle to prevent client-side tampering?\n2. **Signing scheme & expiry** — HMAC, JWT, or signed query params, and what default expiry window (proposed 15 min)?\n3. **Currency & precision** — stay whole-dollar USD, or introduce cents / a `currency` field? The widget and checkout total must agree.\n4. **Server-authoritative cart** — should `add_to_cart` / `remove_from_cart` become backend-owned (returning subtotals), or stay widget-local for v1?\n5. **Post-payment visibility** — expose a webhook or polling endpoint so a later chat turn can confirm order status? Out of scope for v1.\n" },
18
18
  { relPath: "examples/acme-bistro/design/wireframe.html", content: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Acme Bistro × ChatGPT — End-to-End Wireframes</title>\n<style>\n @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');\n * { margin: 0; padding: 0; box-sizing: border-box; }\n body { font-family: 'Inter', -apple-system, sans-serif; background: #f4f5f7; color: #1a1211; line-height: 1.55; }\n\n /* ── Acme Bistro brand tokens (from server branding) ── */\n :root {\n --acme-red: #B91C1C;\n --acme-red-deep: #991B1B;\n --acme-red-soft: #FEF3F2;\n --acme-red-border: #FBD5D2;\n --acme-dark: #1A1211;\n --green: #15803D; --green-soft: #F0FDF4; --green-border: #BBF7D0;\n --amber: #B45309; --amber-soft: #FFFBEB; --amber-border: #FDE68A;\n }\n\n /* ── Page Header ── */\n .page-header { background: #fff; border-bottom: 1px solid #e0dddb; padding: 30px 48px; position: sticky; top: 0; z-index: 100; }\n .page-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }\n .page-header h1 .brand { color: var(--acme-red); }\n .page-header p { font-size: 13px; color: #8a8580; margin-top: 4px; }\n .page-header .scope { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 5px 13px; background: var(--acme-dark); color: #fff; border-radius: 5px; }\n .page-header .scope b { color: var(--acme-red-border); }\n\n /* ── Section Nav ── */\n .section-nav { background: #fff; border-bottom: 1px solid #eee; padding: 11px 48px; display: flex; gap: 22px; font-size: 12px; font-weight: 600; position: sticky; top: 92px; z-index: 99; }\n .section-nav a { color: #8a8580; text-decoration: none; }\n .section-nav a:hover { color: var(--acme-red); }\n\n .container { max-width: 1440px; margin: 0 auto; padding: 36px 48px 80px; }\n\n /* ── Legend ── */\n .vocab { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 20px; padding: 14px 18px; background: #fff; border: 1px solid #e6e3e0; border-radius: 12px; font-size: 12px; color: #555; }\n .vocab-item { display: flex; align-items: center; gap: 8px; }\n .vocab-sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.08); }\n .sw-red { background: var(--acme-red); } .sw-green { background: var(--green); }\n .sw-amber { background: var(--amber); } .sw-dark { background: var(--acme-dark); }\n .sw-grey { background: #cfcac5; } .sw-dash { background: repeating-linear-gradient(45deg,#fff,#fff 3px,#cfcac5 3px,#cfcac5 5px); }\n\n /* ── Section ── */\n .section { margin-bottom: 56px; }\n .section-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #a39d97; margin-bottom: 8px; display: block; }\n .section-title { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }\n .section-subtitle { font-size: 14px; color: #6b655f; margin-bottom: 22px; max-width: 820px; }\n\n /* ── Rationale Block ── */\n .rationale { background: #fff; border: 1px solid #e6e3e0; border-left: 3px solid var(--acme-red); border-radius: 10px; padding: 16px 20px; margin-bottom: 22px; max-width: 960px; }\n .rationale h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: #a39d97; margin-bottom: 9px; }\n .rationale p { font-size: 13px; color: #46413c; line-height: 1.65; margin-bottom: 8px; }\n .rationale p:last-child { margin-bottom: 0; }\n .r-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-right: 4px; letter-spacing: 0.3px; }\n .r-tag.ux { background: #EEF2FF; color: #4338CA; }\n .r-tag.ui { background: #ECFEFF; color: #0E7490; }\n .r-tag.acme { background: var(--acme-red-soft); color: var(--acme-red-deep); }\n .r-tag.trust { background: var(--green-soft); color: var(--green); }\n code { background: #f1efec; padding: 1px 5px; border-radius: 3px; font-size: 11px; font-family: 'JetBrains Mono', monospace; }\n\n /* ── Phone Row ── */\n .phones-row { display: flex; gap: 24px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }\n .phone-step { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }\n .step-label { font-size: 11px; font-weight: 700; color: #8a8580; text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; text-align: center; max-width: 300px; }\n .step-label small { display: block; font-weight: 400; letter-spacing: 0; text-transform: none; color: #b0aaa4; margin-top: 3px; }\n .phone { width: 300px; min-height: 600px; background: #fff; border: 2px solid var(--acme-dark); border-radius: 30px; overflow: hidden; display: flex; flex-direction: column; }\n .phone.offapp { border: 2px dashed #b0aaa4; }\n .phone-notch { width: 90px; height: 22px; background: var(--acme-dark); border-radius: 0 0 12px 12px; margin: 0 auto; flex-shrink: 0; }\n .phone.offapp .phone-notch { background: #b0aaa4; }\n .phone-screen { padding: 14px; display: flex; flex-direction: column; gap: 10px; flex: 1; }\n .step-arrow { display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: center; width: 32px; font-size: 22px; color: #cfcac5; padding-top: 260px; }\n\n /* ── Chrome ── */\n .chatgpt-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 9px; border-bottom: 1px solid #eee; }\n .chatgpt-header .model-name { font-size: 13px; font-weight: 600; }\n .chatgpt-header .dots { font-size: 17px; color: #b0aaa4; letter-spacing: 2px; }\n .browser-header { display: flex; align-items: center; gap: 7px; padding: 7px 9px; background: #f1efec; border-radius: 8px; font-size: 10px; color: #6b655f; }\n .browser-header .lock { font-size: 10px; }\n .browser-header .url { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: #46413c; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n /* ── Messages ── */\n .msg { max-width: 92%; font-size: 12.5px; line-height: 1.55; }\n .msg.user { align-self: flex-end; background: var(--acme-dark); color: #fff; padding: 9px 13px; border-radius: 16px 16px 4px 16px; margin-left: auto; }\n .msg.assistant { color: #1a1211; padding: 2px 0; }\n .msg.assistant strong { font-weight: 600; }\n\n /* ── Tool Call ── */\n .tool-call { display: flex; align-items: center; gap: 8px; padding: 7px 11px; background: #faf8f6; border: 1px solid #e6e3e0; border-radius: 9px; font-size: 10.5px; color: #6b655f; }\n .tool-call .icon { width: 19px; height: 19px; background: var(--acme-red); border-radius: 5px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }\n .tool-call .icon svg { width: 12px; height: 12px; stroke: #fff; fill: none; stroke-width: 2; }\n .tool-call .label { font-weight: 700; color: var(--acme-dark); font-family: 'JetBrains Mono', monospace; font-size: 10px; }\n .tool-call .mono-tool { font-family: 'JetBrains Mono', monospace; font-size: 9.5px; color: #8a8580; }\n\n /* ── MenuCart widget ── */\n .wcard { border: 1.5px solid var(--acme-red-border); border-radius: 14px; overflow: hidden; background: #fff; }\n .wcard-head { display: flex; align-items: center; gap: 9px; padding: 11px 13px; background: var(--acme-red-soft); border-bottom: 1px solid var(--acme-red-border); }\n .wcard-head .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--acme-red); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }\n .wcard-head .logo svg { width: 15px; height: 15px; stroke: #fff; fill: none; stroke-width: 1.7; }\n .wc-title { font-size: 13px; font-weight: 800; }\n .wc-status { font-size: 10px; color: #8a8580; margin-top: 1px; line-height: 1.35; }\n .wc-chip { margin-left: auto; font-size: 9.5px; font-weight: 700; padding: 3px 8px; background: #fff; border: 1px solid var(--acme-red-border); color: var(--acme-red-deep); border-radius: 20px; white-space: nowrap; }\n .menu-row { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-bottom: 1px solid #f4f2ef; }\n .mr-main { flex: 1; }\n .mr-name { font-size: 12px; font-weight: 600; }\n .mr-kind { font-size: 9.5px; color: #a39d97; text-transform: uppercase; letter-spacing: 0.4px; }\n .mr-price { font-size: 12px; font-weight: 700; color: #46413c; }\n .mr-qty { display: flex; align-items: center; gap: 7px; }\n .step-btn { width: 20px; height: 20px; border: 1px solid #d8d3ce; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #46413c; background: #fff; }\n .step-btn.on { border-color: var(--acme-red); color: var(--acme-red); }\n .step-btn.dis { opacity: 0.3; }\n .mr-count { font-size: 12px; font-weight: 700; min-width: 12px; text-align: center; }\n .wc-foot { display: flex; align-items: center; gap: 10px; padding: 12px 13px 8px; }\n .wc-total { font-size: 13px; color: #46413c; }\n .wc-total strong { font-size: 16px; font-weight: 800; color: var(--acme-dark); margin-left: 4px; }\n .wc-cta { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; background: var(--acme-red); color: #fff; border: none; border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; }\n .wc-cta svg { width: 14px; height: 14px; stroke: #fff; fill: none; stroke-width: 2; }\n .wc-cta.dis { opacity: 0.4; }\n .wc-note { padding: 0 13px 12px; font-size: 9.5px; color: #a39d97; line-height: 1.45; }\n .wc-note b { color: var(--green); }\n\n /* ── Handoff card ── */\n .handoff-card { border: 1.5px solid var(--acme-red-border); border-radius: 14px; background: #fff; text-align: center; padding: 16px 15px 13px; }\n .handoff-card .glyph { width: 42px; height: 42px; margin: 0 auto 8px; border-radius: 11px; background: var(--acme-red-soft); display: flex; align-items: center; justify-content: center; }\n .handoff-card .glyph svg { width: 22px; height: 22px; stroke: var(--acme-red); fill: none; stroke-width: 1.6; }\n .handoff-card h4 { font-size: 13.5px; font-weight: 800; margin-bottom: 4px; }\n .handoff-card p { font-size: 11px; color: #6b655f; margin-bottom: 11px; line-height: 1.5; }\n .mini-sum { background: #faf8f6; border: 1px solid #eae7e3; border-radius: 9px; padding: 9px 11px; margin: 0 0 11px; text-align: left; }\n .mini-sum .row { display: flex; justify-content: space-between; font-size: 11px; color: #6b655f; padding: 2px 0; }\n .mini-sum .row.total { font-size: 12.5px; font-weight: 800; color: var(--acme-dark); border-top: 1px solid #eae7e3; margin-top: 4px; padding-top: 5px; }\n .pay-link { font-size: 9px; color: #a39d97; margin-top: 10px; line-height: 1.55; }\n .pay-link code { font-size: 8.5px; }\n .pay-link b { color: var(--acme-dark); }\n\n .cta-primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 10px; background: var(--acme-red); color: #fff; border: none; border-radius: 10px; font-size: 12.5px; font-weight: 700; cursor: pointer; margin-bottom: 6px; }\n .cta-ghost { display: block; width: 100%; padding: 9px; background: transparent; color: var(--acme-dark); border: 1.5px solid #d8d3ce; border-radius: 10px; font-size: 12px; font-weight: 600; cursor: pointer; }\n\n /* ── Off-app checkout body ── */\n .checkout-body { flex: 1; display: flex; flex-direction: column; gap: 9px; padding-top: 4px; }\n .co-brand { font-size: 14px; font-weight: 800; color: var(--acme-red); }\n .co-sub { font-size: 10px; color: #8a8580; }\n .co-field { border: 1px solid #e6e3e0; border-radius: 9px; padding: 9px 11px; }\n .co-field .lbl { font-size: 9px; color: #a39d97; text-transform: uppercase; letter-spacing: 0.5px; }\n .co-field .val { font-size: 12px; color: #46413c; margin-top: 3px; font-family: 'JetBrains Mono', monospace; }\n .co-field.card { background: var(--amber-soft); border-color: var(--amber-border); }\n .co-line { display: flex; justify-content: space-between; font-size: 11px; color: #6b655f; padding: 2px 0; }\n .co-line.total { font-weight: 800; color: var(--acme-dark); font-size: 13px; border-top: 1px solid #eee; padding-top: 5px; margin-top: 3px; }\n .co-pay { padding: 11px; background: var(--acme-red); color: #fff; border: none; border-radius: 10px; font-size: 13px; font-weight: 700; text-align: center; margin-top: auto; }\n .co-secure { font-size: 9.5px; color: #a39d97; text-align: center; margin-top: 7px; }\n\n /* ── Composer ── */\n .composer { margin-top: auto; padding: 9px 0 2px; border-top: 1px solid #eee; }\n .composer-bar { display: flex; align-items: center; background: #f1efec; border-radius: 20px; padding: 8px 12px; font-size: 11.5px; color: #a39d97; }\n .composer-bar .send { width: 24px; height: 24px; background: var(--acme-dark); border-radius: 50%; margin-left: auto; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }\n\n /* ── Widget Gallery ── */\n .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px,1fr)); gap: 22px; }\n .sf { }\n .sf-name { font-size: 12px; font-weight: 700; margin-bottom: 8px; color: #46413c; }\n .sf-name span { font-weight: 400; color: #a39d97; }\n\n /* ── API appendix ── */\n .api-panel { background: #fff; border: 1px solid #e6e3e0; border-radius: 12px; overflow: hidden; margin-bottom: 18px; }\n .api-panel-header { background: var(--acme-dark); color: #fff; padding: 12px 18px; font-size: 13px; font-weight: 700; }\n .api-step { padding: 14px 18px; border-bottom: 1px solid #f1efec; }\n .api-step:last-child { border-bottom: none; }\n .api-step-label { font-size: 10.5px; font-weight: 700; color: #a39d97; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 7px; }\n .api-endpoint { background: #faf8f6; border: 1px solid #eae7e3; border-radius: 8px; padding: 9px 12px; margin-bottom: 7px; }\n .api-endpoint .kind { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px; margin-right: 6px; letter-spacing: 0.4px; font-family: 'JetBrains Mono', monospace; }\n .kind.read { background: var(--green-soft); color: var(--green); }\n .kind.write { background: #ECFEFF; color: #0E7490; }\n .kind.link { background: var(--acme-red-soft); color: var(--acme-red-deep); }\n .api-endpoint .path { font-size: 12.5px; font-weight: 700; color: var(--acme-dark); font-family: 'JetBrains Mono', monospace; }\n .api-endpoint .desc { font-size: 11px; color: #8a8580; margin-top: 3px; }\n .api-note { font-size: 11px; color: #5f594f; background: var(--amber-soft); border-left: 3px solid var(--amber-border); padding: 8px 12px; border-radius: 0 6px 6px 0; margin-top: 6px; }\n .api-note strong { color: #46413c; }\n\n /* ── Audit table ── */\n .audit-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 14px; }\n .audit-table th { text-align: left; padding: 9px 13px; background: #faf8f6; font-weight: 700; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px; color: #a39d97; border-bottom: 1px solid #e6e3e0; }\n .audit-table td { padding: 9px 13px; border-bottom: 1px solid #f1efec; vertical-align: top; color: #46413c; }\n .audit-table td:first-child { font-weight: 600; color: #2d2825; }\n .audit-pass { color: var(--green); font-weight: 700; white-space: nowrap; }\n .audit-guard td:first-child { color: var(--acme-red-deep); }\n\n .page-divider { border: none; border-top: 2px solid #e6e3e0; margin: 48px 0; }\n .footer { text-align: center; font-size: 11px; color: #b0aaa4; padding: 24px 0 8px; }\n</style>\n</head>\n<body>\n\n<div class=\"page-header\">\n <h1><span class=\"brand\">Acme Bistro</span> × ChatGPT App — End-to-End Wireframes</h1>\n <p>Prepared by Noodle Seed · Browse → Build order → Confirm → Hand off to pay · Single-restaurant storefront</p>\n <span class=\"scope\">FUNNEL BOUNDARY: menu, order &amp; confirmation IN CHATGPT · <b>PAYMENT ONLY OFF-APP</b> (pay.acme.example) · no per-user auth</span>\n</div>\n\n<div class=\"section-nav\">\n <a href=\"#legend\">Legend</a>\n <a href=\"#flow\">End-to-End Flow</a>\n <a href=\"#build\">Build &amp; Total</a>\n <a href=\"#handoff\">Payment Handoff</a>\n <a href=\"#gallery\">Widget Gallery</a>\n <a href=\"#api\">MCP Tools</a>\n <a href=\"#compliance\">Compliance Audit</a>\n</div>\n\n<div class=\"container\">\n\n <!-- ── LEGEND ── -->\n <div class=\"section\" id=\"legend\">\n <div class=\"vocab\">\n <div class=\"vocab-item\"><div class=\"vocab-sw sw-red\"></div><strong>Acme Red</strong> — primary CTA + logo mark only</div>\n <div class=\"vocab-item\"><div class=\"vocab-sw sw-green\"></div><strong>Green</strong> — trust / \"card never in chat\"</div>\n <div class=\"vocab-item\"><div class=\"vocab-sw sw-amber\"></div><strong>Amber</strong> — off-app payment surface</div>\n <div class=\"vocab-item\"><div class=\"vocab-sw sw-dark\"></div><strong>Dark</strong> — text, user bubbles</div>\n <div class=\"vocab-item\"><div class=\"vocab-sw sw-grey\"></div><strong>Grey</strong> — neutral / host UI</div>\n <div class=\"vocab-item\"><div class=\"vocab-sw sw-dash\"></div><strong>Dashed frame</strong> — off-app destination</div>\n </div>\n <div class=\"rationale\">\n <h4>How to read these wireframes</h4>\n <p><span class=\"r-tag ui\">UI</span> <strong>Solid-border phones are the ChatGPT App</strong> (the Noodle Seed <code>MenuCart</code> widget rendered inline). <strong>Dashed-border phones are off-app</strong> — reached only after the payment hand-off, on Acme's own checkout. Every widget is preceded by its <code>tool-call</code> chip so you can see exactly which tool the model invoked.</p>\n <p><span class=\"r-tag trust\">TRUST</span> <strong>The app never guesses and never touches a card.</strong> Menu, prices, and totals are grounded in the <code>show_menu</code> data; the diner's card is entered only on the amber off-app checkout. This is the whole safety story of the app, and it is visible in the pixels.</p>\n </div>\n </div>\n\n <!-- ═══ SECTION 1: END-TO-END FLOW ═══ -->\n <div class=\"section\" id=\"flow\">\n <span class=\"section-label\">The whole journey</span>\n <div class=\"section-title\">One conversation, from craving to a paid-ready cart</div>\n <div class=\"section-subtitle\">A diner names Acme and their order in plain language; the model renders the menu, reflects the order into a live cart, confirms the total, and mints a signed payment link. Only the final step — entering a card — leaves ChatGPT.</div>\n\n <div class=\"phones-row\">\n\n <!-- Step 1: Menu -->\n <div class=\"phone-step\">\n <div class=\"step-label\">1 · Show the menu<small>show_menu → MenuCart</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Order me two margheritas and a lemon tart from Acme Bistro.</div>\n <div class=\"tool-call\"><span class=\"icon\"><svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"4\"/></svg></span><span><span class=\"label\">show_menu</span> <span class=\"mono-tool\">{customer:\"Guest\"}</span></span></div>\n <div class=\"msg assistant\">Here's your Acme Bistro order — building it now:</div>\n <div class=\"wcard\">\n <div class=\"wcard-head\">\n <span class=\"logo\"><svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"4\"/></svg></span>\n <div><div class=\"wc-title\">Acme Bistro</div><div class=\"wc-status\">Menu ready. Build the order here; pay at checkout.</div></div>\n <span class=\"wc-chip\">0 in cart</span>\n </div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Stone-baked Margherita</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$14</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Harvest Roast Bowl</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$13</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">House Garden Salad</span> <span class=\"mr-kind\">Starters</span></span><span class=\"mr-price\">$11</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Lemon Tart</span> <span class=\"mr-kind\">Desserts</span></span><span class=\"mr-price\">$8</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Sparkling Water</span> <span class=\"mr-kind\">Drinks</span></span><span class=\"mr-price\">$4</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"wc-foot\"><span class=\"wc-total\">Total <strong>$0</strong></span><button class=\"wc-cta dis\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg>Check out &amp; pay</button></div>\n <div class=\"wc-note\">Payment happens on acme.example — <b>your card is never entered in chat.</b></div>\n </div>\n <div class=\"composer\"><div class=\"composer-bar\">Message<span class=\"send\">↑</span></div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 2: NL order reflected -->\n <div class=\"phone-step\">\n <div class=\"step-label\">2 · Parse the order<small>add_to_cart ×2 from language</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT</span><span class=\"dots\">···</span></div>\n <div class=\"tool-call\"><span class=\"icon\"><svg viewBox=\"0 0 24 24\"><path d=\"M12 5v14M5 12h14\"/></svg></span><span><span class=\"label\">add_to_cart</span> <span class=\"mono-tool\">{item:\"stone_pizza\", quantity:2}</span></span></div>\n <div class=\"tool-call\"><span class=\"icon\"><svg viewBox=\"0 0 24 24\"><path d=\"M12 5v14M5 12h14\"/></svg></span><span><span class=\"label\">add_to_cart</span> <span class=\"mono-tool\">{item:\"lemon_tart\", quantity:1}</span></span></div>\n <div class=\"msg assistant\">Two Stone-baked Margheritas and a Lemon Tart — <strong>$36</strong> so far. Want a drink or a side, or shall I take you to checkout?</div>\n <div class=\"wcard\">\n <div class=\"wcard-head\">\n <span class=\"logo\"><svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"4\"/></svg></span>\n <div><div class=\"wc-title\">Acme Bistro</div><div class=\"wc-status\">Added 2 × Stone-baked Margherita.</div></div>\n <span class=\"wc-chip\">3 in cart</span>\n </div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Stone-baked Margherita</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$14</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">2</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Harvest Roast Bowl</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$13</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">House Garden Salad</span> <span class=\"mr-kind\">Starters</span></span><span class=\"mr-price\">$11</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Lemon Tart</span> <span class=\"mr-kind\">Desserts</span></span><span class=\"mr-price\">$8</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">1</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Sparkling Water</span> <span class=\"mr-kind\">Drinks</span></span><span class=\"mr-price\">$4</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"wc-foot\"><span class=\"wc-total\">Total <strong>$36</strong></span><button class=\"wc-cta\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg>Check out &amp; pay</button></div>\n <div class=\"wc-note\">Payment happens on acme.example — <b>your card is never entered in chat.</b></div>\n </div>\n <div class=\"composer\"><div class=\"composer-bar\">\"add a sparkling water\"<span class=\"send\">↑</span></div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 3: Edit + confirm total -->\n <div class=\"phone-step\">\n <div class=\"step-label\">3 · Edit &amp; confirm total<small>add / remove · live sum</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Add a sparkling water too.</div>\n <div class=\"tool-call\"><span class=\"icon\"><svg viewBox=\"0 0 24 24\"><path d=\"M12 5v14M5 12h14\"/></svg></span><span><span class=\"label\">add_to_cart</span> <span class=\"mono-tool\">{item:\"sparkling\", quantity:1}</span></span></div>\n <div class=\"msg assistant\">Added a Sparkling Water — your total is <strong>$40</strong> for four items. Ready to pay whenever you are.</div>\n <div class=\"wcard\">\n <div class=\"wcard-head\">\n <span class=\"logo\"><svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"4\"/></svg></span>\n <div><div class=\"wc-title\">Acme Bistro</div><div class=\"wc-status\">Added Sparkling Water.</div></div>\n <span class=\"wc-chip\">4 in cart</span>\n </div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Stone-baked Margherita</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$14</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">2</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Lemon Tart</span> <span class=\"mr-kind\">Desserts</span></span><span class=\"mr-price\">$8</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">1</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Sparkling Water</span> <span class=\"mr-kind\">Drinks</span></span><span class=\"mr-price\">$4</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">1</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"wc-foot\"><span class=\"wc-total\">Total <strong>$40</strong></span><button class=\"wc-cta\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg>Check out &amp; pay</button></div>\n <div class=\"wc-note\">Payment happens on acme.example — <b>your card is never entered in chat.</b></div>\n </div>\n <div class=\"composer\"><div class=\"composer-bar\">\"check out and pay\"<span class=\"send\">↑</span></div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 4: Checkout handoff card -->\n <div class=\"phone-step\">\n <div class=\"step-label\">4 · Mint the payment link<small>create_checkout (in-chat)</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Check out and pay.</div>\n <div class=\"tool-call\"><span class=\"icon\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg></span><span><span class=\"label\">create_checkout</span> <span class=\"mono-tool\">{total:40, cartToken:\"…\"}</span></span></div>\n <div class=\"msg assistant\">Your order's ready — I've opened Acme's secure checkout to take payment:</div>\n <div class=\"handoff-card\">\n <div class=\"glyph\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg></div>\n <h4>Pay on Acme Bistro checkout</h4>\n <p>Your order is staged and ready. Enter your card on <strong>acme.example</strong> — it's never typed in chat.</p>\n <div class=\"mini-sum\">\n <div class=\"row\"><span>2 × Stone-baked Margherita</span><span>$28</span></div>\n <div class=\"row\"><span>1 × Lemon Tart</span><span>$8</span></div>\n <div class=\"row\"><span>1 × Sparkling Water</span><span>$4</span></div>\n <div class=\"row total\"><span>Total</span><span>$40</span></div>\n </div>\n <button class=\"cta-primary\"><svg viewBox=\"0 0 24 24\" style=\"width:14px;height:14px;stroke:#fff;fill:none;stroke-width:2\"><path d=\"M5 12h14M13 6l6 6-6 6\"/></svg>Pay $40 on acme.example ↗</button>\n <button class=\"cta-ghost\">Keep editing</button>\n <div class=\"pay-link\">Opens <code>pay.acme.example/checkout?cart=…&amp;total=40&amp;src=chatgpt</code><br>Signed link · expires in <b>15 min</b> · 🔒 payment handled by Acme</div>\n </div>\n <div class=\"composer\"><div class=\"composer-bar\">Message<span class=\"send\">↑</span></div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 5: OFF-APP checkout -->\n <div class=\"phone-step\">\n <div class=\"step-label\">5 · Pay (OFF-APP)<small>pay.acme.example · Acme PCI checkout</small></div>\n <div class=\"phone offapp\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"browser-header\"><span class=\"lock\">🔒</span><span class=\"url\">pay.acme.example/checkout?cart=…&amp;total=40&amp;src=chatgpt</span></div>\n <div class=\"checkout-body\">\n <div><div class=\"co-brand\">Acme Bistro</div><div class=\"co-sub\">Secure checkout · order from ChatGPT</div></div>\n <div class=\"co-field\"><div class=\"lbl\">Order</div><div class=\"val\" style=\"font-family:'Inter'\">2 Margherita · 1 Lemon Tart · 1 Sparkling</div></div>\n <div class=\"co-field card\"><div class=\"lbl\">Card number</div><div class=\"val\">•••• •••• •••• ____</div></div>\n <div class=\"co-field\"><div class=\"lbl\">Contact (optional)</div><div class=\"val\" style=\"font-family:'Inter'\">name@example.com</div></div>\n <div style=\"padding:2px 2px 0\">\n <div class=\"co-line\"><span>Subtotal</span><span>$40.00</span></div>\n <div class=\"co-line\"><span>Tax (recomputed by Acme)</span><span>$3.30</span></div>\n <div class=\"co-line total\"><span>Total</span><span>$43.30</span></div>\n </div>\n <button class=\"co-pay\">Pay $43.30</button>\n <div class=\"co-secure\">🔒 PCI-scoped · card stays on acme.example · the ChatGPT App never sees it</div>\n </div>\n </div></div>\n </div>\n\n </div>\n </div>\n\n <hr class=\"page-divider\">\n\n <!-- ═══ SECTION 2: BUILD & TOTAL (deep dive) ═══ -->\n <div class=\"section\" id=\"build\">\n <span class=\"section-label\">Capability · Order building</span>\n <div class=\"section-title\">Build the order in language, confirm it in pixels</div>\n <div class=\"section-subtitle\">The whole menu, the cart, the running total, and the pay button live in one inline widget. The diner drives it two ways — by talking to the model or by tapping the steppers — and both land in the same place.</div>\n\n <div class=\"rationale\">\n <h4>Why this approach</h4>\n <p><span class=\"r-tag acme\">ACME</span> <strong>One kitchen, one widget.</strong> A single restaurant with five items doesn't need discovery, carousels, or a fullscreen menu — it needs the fastest path from craving to a confirmed cart. <code>MenuCart</code> collapses menu, cart, and checkout into one card the diner never scrolls out of.</p>\n <p><span class=\"r-tag ux\">UX</span> <strong>Language is the input; the widget is the receipt.</strong> \"Two margheritas and a lemon tart\" parses into two <code>add_to_cart</code> calls — no tapping required — and the widget instantly shows the result so the diner can trust what the model heard. Editing works the same in both directions.</p>\n <p><span class=\"r-tag ui\">UI</span> <strong>Inline Card, brand accent on the CTA only.</strong> Acme red (<code>#B91C1C</code>) appears only on the header mark and the <strong>Check out &amp; pay</strong> button; everything else uses host theme tokens via cascade layers, so the widget is native in ChatGPT light or dark. No nested scroll — five rows fit.</p>\n <p><span class=\"r-tag trust\">TRUST</span> <strong>The total is honest and display-only.</strong> The widget sums line items live, but the amount that charges is recomputed by Acme at checkout. The reassurance line (\"your card is never entered in chat\") is present in every frame, not just the last one.</p>\n </div>\n </div>\n\n <hr class=\"page-divider\">\n\n <!-- ═══ SECTION 3: PAYMENT HANDOFF ═══ -->\n <div class=\"section\" id=\"handoff\">\n <span class=\"section-label\">Capability · The one handoff</span>\n <div class=\"section-title\">Payment is the only step that leaves ChatGPT</div>\n <div class=\"section-subtitle\">When the order is right, <code>create_checkout</code> mints a signed, expiring link carrying the cart token, the total, and an attribution tag. ChatGPT opens Acme's own PCI checkout. The MCP server is never in the payment path.</div>\n\n <div class=\"rationale\">\n <h4>Why this approach</h4>\n <p><span class=\"r-tag trust\">TRUST</span> <strong>The card never touches the app.</strong> No in-chat card field, no wallet, no stored payment method. Keeping capture on <code>pay.acme.example</code> means the ChatGPT surface adds zero PCI scope — the single most important safety property of the design.</p>\n <p><span class=\"r-tag acme\">ACME</span> <strong>The link is signed, expiring, and attributable.</strong> Acme signs the URL server-side, sets an <code>expires_at</code> (proposed 15 min), and carries <code>src=chatgpt</code> so ChatGPT-sourced revenue is measurable. <code>handoff.allowedDomains</code> lists <code>pay.acme.example</code> and <code>acme.example</code> so the compiler derives the redirect domain and the link opens without a safe-link warning.</p>\n <p><span class=\"r-tag ux\">UX</span> <strong>Context survives the jump.</strong> The cart token (<code>stone_pizzax2-lemon_tartx1-sparklingx1</code>) rehydrates the exact order on Acme's checkout — the diner never re-enters what they already told the model. State is re-validated past the boundary: Acme recomputes pricing and tax and enforces its own total.</p>\n </div>\n\n <div class=\"phones-row\">\n <div class=\"phone-step\">\n <div class=\"step-label\">In-chat: the hand-off card<small>CheckoutHandoff · create_checkout</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT</span><span class=\"dots\">···</span></div>\n <div class=\"msg assistant\">Your $40 order is staged. Tap to pay on Acme's checkout:</div>\n <div class=\"handoff-card\">\n <div class=\"glyph\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg></div>\n <h4>Pay on Acme Bistro checkout</h4>\n <p>Sign in (if you like) and pay with your card on <strong>acme.example</strong>.</p>\n <div class=\"mini-sum\">\n <div class=\"row\"><span>4 items</span><span>$40</span></div>\n <div class=\"row total\"><span>Pay on acme.example</span><span>$40+tax</span></div>\n </div>\n <button class=\"cta-primary\">Pay $40 on acme.example ↗</button>\n <div class=\"pay-link\">Signed · <b>expires 15 min</b> · <code>src=chatgpt</code></div>\n </div>\n <div class=\"composer\"><div class=\"composer-bar\">Message<span class=\"send\">↑</span></div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n <div class=\"phone-step\">\n <div class=\"step-label\">Off-app: Acme checkout<small>dashed = not our app</small></div>\n <div class=\"phone offapp\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"browser-header\"><span class=\"lock\">🔒</span><span class=\"url\">pay.acme.example/checkout?cart=stone_pizzax2-lemon_tartx1-sparklingx1&amp;total=40&amp;src=chatgpt</span></div>\n <div class=\"checkout-body\">\n <div><div class=\"co-brand\">Acme Bistro</div><div class=\"co-sub\">Secure checkout</div></div>\n <div class=\"co-field\"><div class=\"lbl\">Order (rehydrated from token)</div><div class=\"val\" style=\"font-family:'Inter'\">2 Margherita · 1 Lemon Tart · 1 Sparkling</div></div>\n <div class=\"co-field card\"><div class=\"lbl\">Card number · PCI-scoped</div><div class=\"val\">•••• •••• •••• ____</div></div>\n <div style=\"padding:2px 2px 0\">\n <div class=\"co-line\"><span>Subtotal (re-validated)</span><span>$40.00</span></div>\n <div class=\"co-line\"><span>Tax</span><span>$3.30</span></div>\n <div class=\"co-line total\"><span>Total</span><span>$43.30</span></div>\n </div>\n <button class=\"co-pay\">Pay $43.30</button>\n <div class=\"co-secure\">🔒 card never leaves acme.example · app has no post-handoff visibility in v1</div>\n </div>\n </div></div>\n </div>\n </div>\n </div>\n\n <hr class=\"page-divider\">\n\n <!-- ═══ WIDGET GALLERY ═══ -->\n <div class=\"section\" id=\"gallery\">\n <span class=\"section-label\">Specimen grid</span>\n <div class=\"section-title\">Widget Gallery</div>\n <div class=\"section-subtitle\">Every widget state rendered once at rest. One widget ships: <code>MenuCart</code>. This is what engineers screenshot against the build.</div>\n\n <div class=\"gallery\">\n <div class=\"sf\">\n <div class=\"sf-name\">MenuCart <span>· empty (CTA disabled)</span></div>\n <div class=\"wcard\">\n <div class=\"wcard-head\"><span class=\"logo\"><svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"4\"/></svg></span><div><div class=\"wc-title\">Acme Bistro</div><div class=\"wc-status\">Build your order, then check out to pay.</div></div><span class=\"wc-chip\">0 in cart</span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Stone-baked Margherita</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$14</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">House Garden Salad</span> <span class=\"mr-kind\">Starters</span></span><span class=\"mr-price\">$11</span><span class=\"mr-qty\"><span class=\"step-btn dis\">−</span><span class=\"mr-count\">0</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"wc-foot\"><span class=\"wc-total\">Total <strong>$0</strong></span><button class=\"wc-cta dis\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg>Check out &amp; pay</button></div>\n <div class=\"wc-note\">Payment happens on acme.example — <b>your card is never entered in chat.</b></div>\n </div>\n </div>\n\n <div class=\"sf\">\n <div class=\"sf-name\">MenuCart <span>· filled ($40, 4 items)</span></div>\n <div class=\"wcard\">\n <div class=\"wcard-head\"><span class=\"logo\"><svg viewBox=\"0 0 24 24\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><circle cx=\"12\" cy=\"12\" r=\"4\"/></svg></span><div><div class=\"wc-title\">Acme Bistro</div><div class=\"wc-status\">Added Sparkling Water.</div></div><span class=\"wc-chip\">4 in cart</span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Stone-baked Margherita</span> <span class=\"mr-kind\">Mains</span></span><span class=\"mr-price\">$14</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">2</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Lemon Tart</span> <span class=\"mr-kind\">Desserts</span></span><span class=\"mr-price\">$8</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">1</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"menu-row\"><span class=\"mr-main\"><span class=\"mr-name\">Sparkling Water</span> <span class=\"mr-kind\">Drinks</span></span><span class=\"mr-price\">$4</span><span class=\"mr-qty\"><span class=\"step-btn on\">−</span><span class=\"mr-count\">1</span><span class=\"step-btn\">+</span></span></div>\n <div class=\"wc-foot\"><span class=\"wc-total\">Total <strong>$40</strong></span><button class=\"wc-cta\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg>Check out &amp; pay</button></div>\n <div class=\"wc-note\">Payment happens on acme.example — <b>your card is never entered in chat.</b></div>\n </div>\n </div>\n\n <div class=\"sf\">\n <div class=\"sf-name\">CheckoutHandoff <span>· signed link (create_checkout)</span></div>\n <div class=\"handoff-card\">\n <div class=\"glyph\"><svg viewBox=\"0 0 24 24\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M3 10h18\"/></svg></div>\n <h4>Pay on Acme Bistro checkout</h4>\n <p>Your order is staged and ready. Card entered on <strong>acme.example</strong>, never in chat.</p>\n <div class=\"mini-sum\"><div class=\"row\"><span>4 items</span><span>$40</span></div><div class=\"row total\"><span>Total</span><span>$40+tax</span></div></div>\n <button class=\"cta-primary\">Pay $40 on acme.example ↗</button>\n <div class=\"pay-link\">Signed · expires 15 min · <code>src=chatgpt</code></div>\n </div>\n </div>\n </div>\n </div>\n\n <hr class=\"page-divider\">\n\n <!-- ═══ MCP TOOLS APPENDIX ═══ -->\n <div class=\"section\" id=\"api\">\n <span class=\"section-label\">Technical appendix</span>\n <div class=\"section-title\">MCP Tools &amp; Call Sequence</div>\n <div class=\"section-subtitle\">Tool mapping for each wireframe step. Four tools, served by the Noodle Seed–authored <code>acme_bistro</code> server. Concrete request/response JSON lives in <code>api-contract.md</code>.</div>\n\n <div class=\"api-panel\">\n <div class=\"api-panel-header\">Browse &amp; Build (Steps 1–3)</div>\n <div class=\"api-step\">\n <div class=\"api-step-label\">Step 1 — Show the menu</div>\n <div class=\"api-endpoint\"><span class=\"kind read\">READ</span><span class=\"path\">show_menu</span><span class=\"desc\">— tool + view. Returns the 5-item menu and renders MenuCart.</span></div>\n <div class=\"api-note\"><strong>Design intent:</strong> the menu is small and static, so it ships in one read — no pagination, no follow-up call. The <code>items[]</code> array is the model's only source of dish names and prices.</div>\n </div>\n <div class=\"api-step\">\n <div class=\"api-step-label\">Steps 2–3 — Build &amp; edit the cart</div>\n <div class=\"api-endpoint\"><span class=\"kind write\">WRITE</span><span class=\"path\">add_to_cart</span><span class=\"desc\">— tool + app visibility. Reflects a natural-language addition (item + quantity) into the visible cart.</span></div>\n <div class=\"api-endpoint\"><span class=\"kind write\">WRITE</span><span class=\"path\">remove_from_cart</span><span class=\"desc\">— tool + app visibility. Removes one unit; the widget's − button calls the same tool.</span></div>\n <div class=\"api-note\"><strong>Natural-language parsing:</strong> \"two margheritas and a lemon tart\" becomes <code>add_to_cart{item:\"stone_pizza\",quantity:2}</code> + <code>add_to_cart{item:\"lemon_tart\",quantity:1}</code> — the model fills the fields; no UI round-trip. The running total is summed live in the widget (React), not in a tool.</div>\n </div>\n </div>\n\n <div class=\"api-panel\">\n <div class=\"api-panel-header\">Confirm &amp; Hand off (Step 4 → off-app)</div>\n <div class=\"api-step\">\n <div class=\"api-step-label\">Step 4 — Mint the payment link</div>\n <div class=\"api-endpoint\"><span class=\"kind link\">OPEN-LINK</span><span class=\"path\">create_checkout</span><span class=\"desc\">— model-visible tool. Returns a signed deep link + summary; ChatGPT opens it.</span></div>\n <div class=\"api-note\"><strong>No payment in-chat.</strong> The widget passes a url-safe cart token and the numeric total; <code>create_checkout</code> returns <code>checkoutUrl = https://pay.acme.example/checkout?cart=…&amp;total=…&amp;src=chatgpt</code> (production adds a signed <code>expires_at</code>). The app never sees card data. Acme recomputes pricing/tax and enforces the total past the boundary. No <code>submit_order</code> tool exists by design — fulfilment is Acme's.</div>\n </div>\n </div>\n </div>\n\n <hr class=\"page-divider\">\n\n <!-- ═══ COMPLIANCE AUDIT ═══ -->\n <div class=\"section\" id=\"compliance\">\n <span class=\"section-label\">Compliance</span>\n <div class=\"section-title\">OpenAI Apps SDK Compliance Audit</div>\n <div class=\"section-subtitle\">How Acme Bistro maps to OpenAI's published ChatGPT Apps UX Principles and UI Guidelines. Verified in the build with <code>noodle check --target chatgpt</code>.</div>\n\n <div class=\"rationale\" style=\"max-width:100%\">\n <h4>Pre-publishing checklist</h4>\n <table class=\"audit-table\">\n <tr><th style=\"width:32%\">Requirement</th><th>How Acme Bistro addresses it</th><th style=\"width:70px\">Status</th></tr>\n <tr><td>Conversational value — relies on ChatGPT's strengths</td><td>Natural-language ordering (\"two margheritas and a lemon tart\") parses into <code>add_to_cart</code> calls with item + quantity — no tap-driven menu can do this. Editing by sentence (\"drop a margherita\") works the same way.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Beyond base ChatGPT — new knowledge/actions</td><td>Live single-restaurant menu, a running cart, and a signed checkout hand-off to Acme's real payment page. None available in base ChatGPT.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Atomic, model-friendly actions</td><td>Four tools with explicit Zod-typed input/output: <code>show_menu</code> (read), <code>add_to_cart</code>/<code>remove_from_cart</code> (local write), <code>create_checkout</code> (open-link). No ambiguity.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Helpful UI only — would plain text degrade UX?</td><td>Yes for the menu/cart — price rows and steppers are faster to scan than prose, and the running total needs a layout. <strong>No payment widget is built</strong> — card capture is off-platform, so a widget there would be wrong.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Meaningful task completion in-chat</td><td>The full order — browse, build, edit, confirm total — completes in ChatGPT. The one intentional hand-off is payment, on Acme's checkout.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Performance &amp; responsiveness</td><td>One read on entry; cart edits are local to the widget; one link mint at checkout. Static menu keeps <code>show_menu</code> well under target latency.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Discoverability</td><td>Broad natural triggers: \"show me the Acme Bistro menu\", \"order two margheritas from Acme\", \"what's my Acme total?\", \"check out and pay\".</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Platform fit</td><td>Rich prompts (order + quantity in one sentence), multi-turn cart building, in-session memory of the cart. No per-user auth needed for the pre-payment surface.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n </table>\n </div>\n\n <div class=\"rationale\" style=\"max-width:100%;margin-top:18px\">\n <h4>UI guidelines compliance</h4>\n <table class=\"audit-table\">\n <tr><th style=\"width:32%\">Guideline</th><th>Implementation</th><th style=\"width:70px\">Status</th></tr>\n <tr><td>Colour — system tokens; brand only on accents/CTA</td><td>Text, borders, and surfaces use host semantic tokens via cascade layers. Acme red <code>#B91C1C</code> appears only on the header mark and the primary <strong>Check out &amp; pay</strong> button.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Typography — inherit system fonts</td><td>System font stack; no custom Acme typeface inside the widget.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Inline Card — ≤2 actions, no nested scroll, no deep nav</td><td>MenuCart has one primary action (Check out &amp; pay) plus in-card steppers; five rows fit with no inner scroller and no drill-in.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Icons — monochromatic, outlined</td><td>Outlined plate mark and card glyph; no filled brand logo rendered in the response body.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Accessibility — WCAG AA, theme-aware</td><td>Acme red used only as a fill behind light text or as a 1px mark, never as body text on white. Widget adapts to host light/dark via <code>branding.surface</code> / <code>surfaceDark</code>.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr><td>Display mode — correct per intent</td><td>Inline Card only. No Carousel/Fullscreen/PiP — a flat 5-item menu doesn't warrant them.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n </table>\n </div>\n\n <div class=\"rationale\" style=\"max-width:100%;margin-top:18px\">\n <h4>Domain guardrails (Acme-specific trust rows)</h4>\n <table class=\"audit-table\">\n <tr><th style=\"width:32%\">Guardrail</th><th>How Acme Bistro enforces it</th><th style=\"width:70px\">Status</th></tr>\n <tr class=\"audit-guard\"><td>No payment in chat</td><td>No card field, wallet, or stored method anywhere in the app. Card capture happens only on <code>pay.acme.example</code> after the hand-off. The MCP server never enters PCI scope. The \"your card is never entered in chat\" note is in every widget frame.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr class=\"audit-guard\"><td>Allergen / dietary honesty</td><td>The model states only what the menu data holds (name, course, price). Ingredient-level or cross-contact questions are deferred to Acme directly — never \"this is vegetarian/gluten-free\" without a menu flag.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr class=\"audit-guard\"><td>No invented items or prices</td><td>Grounded strictly in the <code>show_menu</code> <code>items[]</code> — only the five dishes, only their listed prices. The total is display-only; Acme recomputes the charge.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr class=\"audit-guard\"><td>Signed, expiring, attributable hand-off</td><td>Checkout link is signed server-side, carries <code>src=chatgpt</code>, and expires (proposed 15 min). <code>handoff.allowedDomains</code> whitelists the redirect domains so the link opens without a safe-link warning.</td><td class=\"audit-pass\">✓ Pass</td></tr>\n <tr class=\"audit-guard\"><td>No unseen fulfilment claims</td><td>The app builds and hands off the order; it makes no pickup-time or order-status promise it can't verify (no post-handoff visibility in v1).</td><td class=\"audit-pass\">✓ Pass</td></tr>\n </table>\n </div>\n </div>\n\n <div class=\"footer\">Acme Bistro (illustrative) · Prepared by Noodle Seed · End-to-end wireframes · matches the runnable <code>acme_bistro</code> server</div>\n\n</div>\n</body>\n</html>\n" },
@@ -35,7 +35,7 @@ export const BUNDLED_EXAMPLE_FILES = [
35
35
  { relPath: "examples/acme-discovery/src/views/widget-style.css", content: ":root {\n color-scheme: light dark;\n font-family:\n Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n --nw-bg: #ffffff;\n --nw-surface: #f4fbfa;\n --nw-text: #10201f;\n --nw-muted: #5b6b6a;\n --nw-border: #d4e6e4;\n --nw-accent: #0ea5a4;\n --nw-accent-strong: #0f766e;\n --nw-accent-soft: #e6faf8;\n --nw-radius: 10px;\n --nw-shadow: 0 18px 50px rgb(15 40 40 / 12%);\n}\n\n.dark,\n[data-theme=\"dark\"] {\n --nw-bg: #0b1b1b;\n --nw-surface: #102624;\n --nw-text: #eafaf8;\n --nw-muted: #9fb6b3;\n --nw-border: #244341;\n --nw-accent: #2dd4bf;\n --nw-accent-strong: #14b8a6;\n --nw-accent-soft: #0f3835;\n --nw-shadow: 0 18px 50px rgb(0 0 0 / 30%);\n}\n\n* {\n box-sizing: border-box;\n}\n\nbody {\n margin: 0;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\nbutton {\n font: inherit;\n}\n\n.nw-shell {\n min-height: 100vh;\n padding: 14px;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\n.nw-card {\n max-width: 720px;\n margin: 0 auto;\n background: var(--nw-surface);\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n box-shadow: var(--nw-shadow);\n overflow: hidden;\n}\n\n.nw-header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 16px;\n border-bottom: 1px solid var(--nw-border);\n}\n\n.nw-icon svg {\n width: 26px;\n height: 26px;\n fill: none;\n stroke: var(--nw-accent);\n stroke-width: 1.7;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.nw-title-block {\n flex: 1;\n min-width: 0;\n}\n\n.nw-title {\n margin: 0;\n font-size: 17px;\n font-weight: 700;\n}\n\n.nw-subtitle {\n margin: 2px 0 0;\n font-size: 13px;\n color: var(--nw-muted);\n}\n\n.nw-chip {\n padding: 4px 10px;\n border-radius: 999px;\n background: var(--nw-accent-soft);\n color: var(--nw-accent-strong);\n font-size: 12px;\n font-weight: 600;\n}\n\n.nw-carousel {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));\n gap: 12px;\n padding: 16px;\n}\n\n.nw-dest {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 12px;\n border: 1px solid var(--nw-border);\n border-radius: 12px;\n background: var(--nw-bg);\n}\n\n.nw-dest-active {\n border-color: var(--nw-accent);\n box-shadow: 0 0 0 1px var(--nw-accent);\n}\n\n.nw-dest-head {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n gap: 8px;\n}\n\n.nw-dest-name {\n font-weight: 700;\n}\n\n.nw-price {\n color: var(--nw-accent-strong);\n font-size: 12px;\n font-weight: 600;\n}\n\n.nw-dest-region {\n margin: 0;\n font-size: 12px;\n color: var(--nw-muted);\n}\n\n.nw-dest-why {\n margin: 0;\n font-size: 13px;\n flex: 1;\n}\n\n.nw-actions {\n display: flex;\n gap: 8px;\n padding: 0 16px 12px;\n}\n\n.nw-button {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 9px 14px;\n border: 1px solid var(--nw-border);\n border-radius: 10px;\n background: var(--nw-bg);\n color: var(--nw-text);\n cursor: pointer;\n}\n\n.nw-button svg {\n width: 16px;\n height: 16px;\n fill: none;\n stroke: currentColor;\n stroke-width: 1.7;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.nw-button-ghost {\n align-self: flex-start;\n padding: 6px 12px;\n font-size: 13px;\n}\n\n.nw-button-primary {\n background: var(--nw-accent);\n border-color: var(--nw-accent);\n color: #ffffff;\n font-weight: 600;\n}\n\n.nw-button-primary:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n.nw-note {\n margin: 0;\n padding: 0 16px 16px;\n font-size: 12px;\n color: var(--nw-muted);\n}\n" },
36
36
  { relPath: "examples/acme-discovery/test/server.test.ts", content: "import { describe, expect, it } from 'vitest';\nimport app from '../src/server.js';\n\ndescribe('acme-discovery example', () => {\n it('exports a Noodle server definition', () => {\n expect(typeof app.toManifest).toBe('function');\n });\n\n it('declares the off-app handoff domain the deep link lands on', async () => {\n // Top-of-funnel: the only external target is Acme's booking site, declared once at the server.\n const manifest = await app.toManifest();\n expect(JSON.stringify(manifest)).toContain('https://book.acme.example');\n });\n\n it('exposes the discovery tool and the handoff tool', async () => {\n const manifest = await app.toManifest();\n const text = JSON.stringify(manifest);\n // The discovery tool renders the carousel; the handoff tool emits the deep link; the widget-only\n // helper records a shortlist.\n expect(text).toContain('discover_getaways');\n expect(text).toContain('create_handoff');\n expect(text).toContain('shortlist_getaway');\n });\n});\n" },
37
37
  { relPath: "examples/acme-discovery/vitest.config.ts", content: "import { defineConfig } from 'vitest/config';\n\n// Local config so `npm test` (vitest run) discovers this example's own tests instead of inheriting a\n// parent monorepo config's include globs.\nexport default defineConfig({\n test: { include: ['test/**/*.test.ts'] },\n});\n" },
38
- { relPath: "examples/acme-tasks/README.md", content: "# Acme Tasks — designed around its top-3 prioritized user flows\n\nA Noodle MCP App for **Acme Tasks**, a fictional productivity tool. It is the flagship for\n**designing an app around its prioritized user flows**: a two-way (read + write) experience where the\ntop-3 flows — **Capture, Prioritize, Complete** — all happen in chat, each mapped to a tool and surfaced\nin one `TaskList` widget. It shows the \"identify and prioritize the flows first, then build\" discipline\nthe `noodle-seed` skill's `references/experience-design.md` teaches.\n\nCapability slots: prioritized multi-flow app design, a two-way (read + write) in-chat pattern, a task-list\nwidget with `tool` helpers, and a worked **design-first** artifact (the flow spec + wireframe\nbelow). A real deployment would connect the user's account with the end-user auth pattern — see\n[`../customer-auth/README.md`](../customer-auth/README.md); this example seeds a list so the focus stays\non the flows.\n\n## Design spec (write this before the code)\n\n- **What it is** — an in-chat task manager. Unlike a top-of-funnel app, there is **no handoff**: the value\n is doing the work in place (read the list, add, re-prioritize, complete).\n- **Personas** — the quick capturer (\"remind me to email the vendor\"), the morning triager (re-orders the\n day), the closer (marks things done without leaving chat).\n- **Top-3 prioritized user flows** (the heart of this example — build these, defer the rest)\n 1. **Capture** (`add_task`) — \"add: book flights for the offsite, high priority\" → task captured.\n 2. **Prioritize** (`list_today` renders the widget; `set_priority` re-orders) — triage today's list.\n 3. **Complete** (`complete_task`) — check a task off; the model can also complete on request.\n- **Tools** — `list_today` (model-visible, renders the widget), `add_task` and `complete_task`\n (model-visible), `set_priority` (widget-only helper hidden from the model).\n- **Widgets + display modes** — `TaskList` as an inline card that expands to fullscreen for a long list.\n No carousel or picture-in-picture — a single list is the right surface.\n- **Grounding** — the seeded list in `src/server.ts` stands in for the user's real list; the app never\n invents a task.\n- **Two users** — tools are atomic and model-fillable (\"high priority\" → `priority: \"high\"`), and each\n returns a spoken-ready status so the model can confirm in one turn.\n\n## Wireframe (one screen: the three flows in place)\n\n```html\n<div class=\"phone\"> <!-- in-app: solid frame -->\n <div class=\"chatgpt-header\">ChatGPT · Acme Tasks</div>\n <div class=\"msg user\">what's on my list today?</div>\n <div class=\"tool-call\">list_today { focus: \"today\" }</div>\n <div class=\"wcard\">\n <div class=\"wcard-head\">TaskList</div> <!-- component name = code + spec -->\n <div class=\"wcard-body\">\n <input placeholder=\"Add a task…\" /> <!-- Flow 1: Capture -->\n <div class=\"task\">◻ Email the vendor about the Q3 quote [high ▾]</div> <!-- Flow 2 -->\n <div class=\"task\">◻ Review the analytics pull request [medium ▾]</div>\n <div class=\"task done\">✓ Book flights for the team offsite [low ▾]</div> <!-- Flow 3 -->\n </div>\n </div>\n</div>\n```\n\n## Local author loop\n\n```sh\nnoodle validate\nnoodle test\nnoodle dev\n```\n\nIn another terminal:\n\n```sh\nnoodle tools list\nnoodle tools call list_today --args '{\"focus\":\"today\"}'\nnoodle tools call add_task --args '{\"title\":\"Book flights for the offsite\",\"priority\":\"high\"}'\nnoodle tools call complete_task --args '{\"task\":\"review_pr\",\"title\":\"Review the analytics pull request\"}'\nnoodle check --target chatgpt\n```\n\n## Deploy\n\n```sh\nnoodle link --org demo --app acme-tasks\nnoodle deploy --access owner-only\nnoodle open\n```\n\n## Optional in-product assistant\n\nThe same task tools can also sit inside Acme's authenticated web app. Add an `assistant` option to this\nserver without creating a second tool set:\n\n```ts\nassistant: embeddedAssistant({\n model: openAICompatible({\n baseUrl: variable('ASSISTANT_MODEL_BASE_URL'),\n model: variable('ASSISTANT_MODEL'),\n apiKey: secret('ASSISTANT_MODEL_API_KEY'),\n }),\n allowedOrigins: ['https://tasks.example.com'],\n layout: { mode: 'floating', position: 'bottom-right' },\n labels: { welcomeHeading: 'How can I help with Acme Tasks?' },\n}),\n```\n\nThe assistant automatically inherits this server's existing `branding` block, so its name, accent,\nlight/dark surfaces, density, and radius match the `TaskList` widget without a second brand declaration.\n\nThe customer backend exchanges its authenticated user through `@noodleseed/assistant/server`; the browser\nuses the Web Component or React wrapper and never receives the embed client or model secret. Validate with\n`noodle check --target embedded-assistant`, then create the backend credential with\n`noodle assistant clients create` after deployment.\n\nInstall the independently versioned embed SDK in the customer web application with\n`pnpm add @noodleseed/assistant`.\n\nThis example has no connector secrets and does not include tokens, caller-key mechanisms, or\n`.env.noodle` values. All tasks are fictional seed data.\n" },
38
+ { relPath: "examples/acme-tasks/README.md", content: "# Acme Tasks — designed around its top-3 prioritized user flows\n\nA Noodle MCP App for **Acme Tasks**, a fictional productivity tool. It is the flagship for\n**designing an app around its prioritized user flows**: a two-way (read + write) experience where the\ntop-3 flows — **Capture, Prioritize, Complete** — all happen in chat, each mapped to a tool and surfaced\nin one `TaskList` widget. It shows the \"identify and prioritize the flows first, then build\" discipline\nthe `noodle-seed` skill's `references/experience-design.md` teaches.\n\nCapability slots: prioritized multi-flow app design, a two-way (read + write) in-chat pattern, a task-list\nwidget with `tool` helpers, and a worked **design-first** artifact (the flow spec + wireframe\nbelow). A real deployment would connect the user's account with the end-user auth pattern — see\n[`../customer-auth/README.md`](../customer-auth/README.md); this example seeds a list so the focus stays\non the flows.\n\n## Design spec (write this before the code)\n\n- **What it is** — an in-chat task manager. Unlike a top-of-funnel app, there is **no handoff**: the value\n is doing the work in place (read the list, add, re-prioritize, complete).\n- **Personas** — the quick capturer (\"remind me to email the vendor\"), the morning triager (re-orders the\n day), the closer (marks things done without leaving chat).\n- **Top-3 prioritized user flows** (the heart of this example — build these, defer the rest)\n 1. **Capture** (`add_task`) — \"add: book flights for the offsite, high priority\" → task captured.\n 2. **Prioritize** (`list_today` renders the widget; `set_priority` re-orders) — triage today's list.\n 3. **Complete** (`complete_task`) — check a task off; the model can also complete on request.\n- **Tools** — `list_today` (model-visible, renders the widget), `add_task` and `complete_task`\n (model-visible), `set_priority` (widget-only helper hidden from the model).\n- **Widgets + display modes** — `TaskList` as an inline card that expands to fullscreen for a long list.\n No carousel or picture-in-picture — a single list is the right surface.\n- **Grounding** — the seeded list in `src/server.ts` stands in for the user's real list; the app never\n invents a task.\n- **Two users** — tools are atomic and model-fillable (\"high priority\" → `priority: \"high\"`), and each\n returns a spoken-ready status so the model can confirm in one turn.\n\n## Wireframe (one screen: the three flows in place)\n\n```html\n<div class=\"phone\"> <!-- in-app: solid frame -->\n <div class=\"chatgpt-header\">ChatGPT · Acme Tasks</div>\n <div class=\"msg user\">what's on my list today?</div>\n <div class=\"tool-call\">list_today { focus: \"today\" }</div>\n <div class=\"wcard\">\n <div class=\"wcard-head\">TaskList</div> <!-- component name = code + spec -->\n <div class=\"wcard-body\">\n <input placeholder=\"Add a task…\" /> <!-- Flow 1: Capture -->\n <div class=\"task\">◻ Email the vendor about the Q3 quote [high ▾]</div> <!-- Flow 2 -->\n <div class=\"task\">◻ Review the analytics pull request [medium ▾]</div>\n <div class=\"task done\">✓ Book flights for the team offsite [low ▾]</div> <!-- Flow 3 -->\n </div>\n </div>\n</div>\n```\n\n## Local author loop\n\n```sh\nnoodle validate\nnoodle test\nnoodle dev\n```\n\nIn another terminal:\n\n```sh\nnoodle tools list\nnoodle tools call list_today --args '{\"focus\":\"today\"}'\nnoodle tools call add_task --args '{\"title\":\"Book flights for the offsite\",\"priority\":\"high\"}'\nnoodle tools call complete_task --args '{\"task\":\"review_pr\",\"title\":\"Review the analytics pull request\"}'\nnoodle check --target chatgpt\n```\n\n## Deploy\n\n```sh\nnoodle link --org demo --app acme-tasks\nnoodle deploy --access owner-only\nnoodle open\n```\n\n## Optional in-product assistant\n\nThe same task tools can also sit inside Acme's authenticated web app. Add an `assistant` option to this\nserver without creating a second tool set:\n\n```ts\nassistant: embeddedAssistant({\n model: openAICompatible({\n baseUrl: variable('ASSISTANT_MODEL_BASE_URL'),\n model: variable('ASSISTANT_MODEL'),\n apiKey: secret('ASSISTANT_MODEL_API_KEY'),\n }),\n allowedOrigins: ['https://tasks.example.com'],\n layout: { mode: 'floating', position: 'bottom-right' },\n labels: { welcomeHeading: 'How can I help with Acme Tasks?' },\n}),\n```\n\nThe assistant automatically inherits this server's existing `branding` block, so its name, accent,\nlight/dark surfaces, density, and radius match the `TaskList` widget without a second brand declaration.\n\nEvery assistant origin is exact and HTTPS-only. If the customer web app needs local browser testing, it\nmust serve itself over development HTTPS and add its `https://localhost:<port>` origin; `noodle dev` does\nnot provide TLS for that separate SaaS app.\n\nThe customer backend exchanges its authenticated user through `@noodleseed/assistant/server`; the browser\nuses the Web Component or React wrapper and never receives the embed client or model secret. Validate with\n`noodle check --target embedded-assistant`, then create the backend credential with\n`noodle assistant clients create` after deployment. Model URL/name/key values stay in Noodle managed config;\nonly the Noodle service URL and assistant client ID/secret belong in the authenticated customer backend.\n\nInstall the independently versioned embed SDK with the customer web application's existing package manager;\ndo not introduce a second lockfile.\n\nThis example has no connector secrets and does not include tokens, caller-key mechanisms, or\n`.env.noodle` values. All tasks are fictional seed data.\n" },
39
39
  { relPath: "examples/acme-tasks/design/UX-Document.md", content: "# Acme Tasks ChatGPT App — User Flow & Experience Document\n\n**Prepared by:** Noodle Seed\n**Scope:** Capture, prioritize, and complete today's tasks entirely inside ChatGPT — a two-way (read + write) task manager. There is no handoff; the value is doing the work in place.\n**Status:** Design specification (v1)\n**Two-way scope & auth stance:** IN-APP (in chat) — read today's list, capture new tasks, re-prioritize, and complete them, each write confirmed in-chat. OFF-APP — nothing transactional; the only boundary crossing is a **one-time scoped account connection** (`customerAuth` end-user OAuth: read + write, connected once). Every scope debate resolves here: if a request is \"see, add, re-order, or finish a task,\" it stays in chat; the account link is the single, revocable off-app moment.\n\n> This document is the master spec. The wireframes (`wireframe.html`), the widget code (`src/views/task-list.tsx`), and the server (`src/server.ts`) are all derivable from it. Acme Tasks is a fictional productivity app; all data below is sample content.\n\n---\n\n## Section 0 — The One-Paragraph Thesis\n\nA person mid-conversation in ChatGPT says *\"remind me to email the vendor about the Q3 quote\"* — and today that intent evaporates, because acting on it means leaving the conversation for a separate app. Acme Tasks closes that gap: the moment a task is spoken it is **captured, prioritized, and completed without ever leaving chat**. This is deliberately **not** a top-of-funnel handoff app — there is no cart to check out, no site to open, no \"continue in the app.\" The task manager *is* the conversation. We own the in-chat experience end to end (read the live list, add by natural language, re-prioritize, complete); the user owns their account, connected once through a scoped, revocable link. The strategic kicker: a to-do app is the highest-frequency surface a person touches, and the app that lets them clear their list *in the same window where the work is being discussed* becomes the one they never close. **In-chat completion is the product.**\n\n---\n\n## 1. Acme Tasks Product Overview (Knowledge Base)\n\n**What the company is.** Acme Tasks is a personal + small-team task manager: a single prioritized list per user, each task carrying a **title**, a **priority** (`high` / `medium` / `low`), and a **done** state. It is intentionally minimal — no projects, no assignees, no sub-tasks in v1 — so the model can reason about the whole list in one turn.\n\n**The data domain the app must know.** The user's *today* list. In this flagship the list is **seeded** so the design can focus on the flows; the three seed items are the canonical fixtures every downstream artifact reuses:\n\n| id | title | priority |\n| :--- | :--- | :--- |\n| `email_vendor` | Email the vendor about the Q3 quote | `high` |\n| `review_pr` | Review the analytics pull request | `medium` |\n| `book_offsite` | Book flights for the team offsite | `low` |\n\n**The highest-value / highest-risk domain** is the account write. Because the app can *complete* and *re-prioritize* real tasks, every mutation must be legible and confirmed — a silently-checked-off task is the worst possible failure.\n\n**What lives after any boundary crossing.** Nothing transactional. Unlike a discovery funnel, Acme Tasks has no off-app destination it hands users to; the only off-app step is the one-time `customerAuth` consent screen (§9). After that, everything is in chat.\n\n**Business model / why this matters.** Frequency and retention. A task app is opened many times a day; the version that removes the app-switch tax — \"I thought of it, I said it, it's on my list, it's done\" — wins the habit. The bottleneck the app removes is **context-switching**, not data entry.\n\n---\n\n## 2. Competitive Landscape — Task Managers on ChatGPT\n\nMost task integrations on assistant platforms are **read-only or one-way**: they can list what's due but push the user to a separate app to actually change anything, or they capture a task into a black box with no confirmation. The generic model can *talk about* a to-do list but has no grounded state — it will happily invent tasks that don't exist.\n\n**Acme Tasks' unique position** is the *closed two-way loop in one surface*: a grounded read (the real list, never guessed), natural-language writes (capture, re-prioritize, complete), and an in-chat confirmation for every mutation. The differentiator is not the widget — it is that the widget's actions **commit** and the user **sees what changed** without a tab switch.\n\n---\n\n## 3. Target User Personas\n\n- **The Quick Capturer** — *\"add: book flights for the offsite, low priority.\"* Thinks of a task mid-conversation and wants it on the list before the thought is gone. Values zero-friction capture.\n- **The Morning Triager** — *\"what's on my plate today?\"* Opens the day, scans the list, and re-orders priorities before starting. Values a fast, grounded read plus one-tap re-prioritize.\n- **The Closer** — *\"mark the vendor email done.\"* Finishes work and wants the satisfaction of checking it off without leaving the thread. Values instant, confirmed completion.\n\nAll three are the **same user at different moments of the day** — capture in the morning stand-up, triage before lunch, close out at end of day. The app is designed so one connected session serves all three.\n\n---\n\n## 4. Conversational User Flow\n\n### 4.1 Entry points (natural triggers)\n\n- **Capture:** \"remind me to…\", \"add a task…\", \"put X on my list\", \"I need to email the vendor.\"\n- **Prioritize / read:** \"what's on my list today?\", \"what's due?\", \"show my tasks\", \"make the PR review high priority.\"\n- **Complete:** \"mark X done\", \"I finished the vendor email\", \"check off the offsite booking.\"\n\n### 4.2 Flow architecture\n\n```\n ┌─────────────────────────────┐\n first run ─────────▶│ Connect Acme Tasks (once) │ §9 · customerAuth, scoped R/W\n └──────────────┬──────────────┘\n │ connection live thereafter\n ┌─────────────────────────────┼─────────────────────────────┐\n ▼ ▼ ▼\n ① CAPTURE ② PRIORITIZE ③ COMPLETE\n add_task list_today → TaskList complete_task\n \"add X, high\" (render widget) \"mark X done\"\n │ set_priority (in widget) │\n └──────────────▶ TaskList reflects the change ◀───────────┘\n (grounded read, always current)\n```\n\n`list_today` is the hub — it renders the `TaskList` widget the other two flows write into. Every flow returns a spoken-ready status so the model confirms in one turn.\n\n### 4.3 Detailed conversational scenarios (playscripts)\n\n**Scenario A — Capture (The Quick Capturer)**\n\n```\nUser: Add \"book flights for the team offsite\", low priority.\nTool call: add_task { title: \"Book flights for the team offsite\", priority: \"low\" }\nReturns: { status: \"Added “Book flights for the team offsite” (low).\", title, priority }\nAssistant: Added \"Book flights for the team offsite\" at low priority. Want to see the full list?\n```\n\n**Scenario B — Prioritize / read + re-order (The Morning Triager)**\n\n```\nUser: What's on my plate today?\nTool call: list_today { focus: \"today\" } ← renders TaskList widget\nReturns: { status: \"Acme Tasks for today: 3 open items, highest priority first.\", focus, tasks:[…] }\nWidget: TaskList — Email the vendor (high) · Review the analytics PR (medium) · Book offsite (low)\n\nUser: Bump the PR review to high.\nTool call: set_priority { task: \"review_pr\", priority: \"high\" } ← widget-only helper\nReturns: { status: \"Set review_pr to high priority.\", task, priority }\nWidget: TaskList re-orders — Review the analytics PR now sits with the high group.\n```\n\n**Scenario C — Complete (The Closer)**\n\n```\nUser: I finished the vendor email — mark it done.\nTool call: complete_task { task: \"email_vendor\", title: \"Email the vendor about the Q3 quote\" }\nReturns: { status: \"Completed “Email the vendor about the Q3 quote”.\", task }\nWidget: TaskList strikes the row through; open count drops from 3 → 2.\nAssistant: Done — \"Email the vendor about the Q3 quote\" is checked off. Two left today.\n```\n\n---\n\n## 5. UI Widget Specifications (Noodle Seed Apps Compliant)\n\n### 5.1 Design system compliance\n\nWidgets render inside the host (ChatGPT) via Noodle Seed's `view` component model and **CSS Cascade Layers**, so they inherit the host's light/dark surface and typography rather than shipping an app theme. Compliance rules, all enforceable via `noodle check --target chatgpt`:\n\n- **Tokens, not hard-coded chrome.** Text, surface, and border come from host/Noodle Seed semantic tokens. The **brand accent is declared once** in the server `branding` block — `accent: #7C3AED`, `surface: #F5F3FF`, `surfaceDark: #161228`, `radius: lg`, `density: comfortable` — and is restricted to the **primary CTA, the logo/check mark, and the \"high\" priority emphasis only**. It is never a background wash.\n- **Priority palette (semantic, fixed):** `high` = red `#DC2626`, `medium` = amber `#D97706`, `low` = slate `#6B7280`. These map 1:1 to the `priority` enum so the widget and the model share one vocabulary.\n- **System fonts, outlined monochrome icons, WCAG AA contrast, no nested scroll**, and every mutation shows a confirmable result. The widget exposes a single flat `data-llm` summary line (\"N open of M; K completed this session\") so the model can narrate state without re-reading the DOM.\n\n### 5.2 Display mode strategy\n\n| User intent | Display mode | Why |\n| :--- | :--- | :--- |\n| \"What's on my list?\" | **Inline card** | The whole list fits; the answer is the list. |\n| Triage a long list | **Fullscreen** (expand) | Density without nested scroll when items exceed the card. |\n| Capture / complete / re-prioritize | **Inline card (in place)** | The write updates the same card; no new surface. |\n\n**Deliberately NOT used:** *Carousel* (there is one list, not a set of peers) and *Picture-in-Picture* (nothing runs in the background). Stating the omissions is part of the compliance story.\n\n### 5.3 Widget specifications\n\n**★ `TaskList`** — the single widget; the hub all three flows read and write.\n- **Purpose:** show today's prioritized list and let the user capture, re-prioritize, and complete in place.\n- **Content fields:** header (logo, \"Acme Tasks\", status subtitle, open-count chip); a **capture input** (\"Add a task…\"); a **task row** per item = complete check + title + priority `<select>`; a footer note (\"Two-way in chat: read, capture, re-prioritize, complete\").\n- **Actions (≤2 primary):** **Add** (capture) and the per-row **complete check**; re-prioritize is a lightweight inline `<select>`, not a primary CTA.\n- **States:** *default* (seeded list), *captured* (new row appears immediately, then `add_task` records it), *re-prioritized* (row moves priority group), *completed* (row struck through, check filled, count decremented), *all-clear* (empty-state celebration + nudge to capture the next thing).\n- **Grounding flag:** the list only ever shows tasks that exist in state — the app never invents a task.\n\n---\n\n## 6. Tool Definitions (App Backend)\n\nAll tools are atomic, model-fillable from natural language, and each returns a spoken-ready `status`.\n\n**★ `list_today`** *(read-only · renders `TaskList`)*\n- **Input:** `{ focus: string = \"today\" }`\n- **Output:** `{ status, focus, tasks: [{ id, title, priority, done }] }`\n- **Notes:** `tool` — the one tool that opens the widget. Host status copy: invoking \"Loading your tasks…\", invoked \"Tasks ready\".\n\n**★ `add_task`** *(local write, non-destructive · model-visible)*\n- **Input:** `{ title: string, priority: \"high\"|\"medium\"|\"low\" = \"medium\" }`\n- **Output:** `{ status, title, priority }`\n- **Notes:** capture from natural language; \"high priority\" fills `priority: \"high\"`.\n\n**`complete_task`** *(local write, non-destructive · model-visible)*\n- **Input:** `{ task: string (id), title: string = \"\" }`\n- **Output:** `{ status, task }`\n- **Notes:** model-visible so the user can complete by voice (\"mark the vendor email done\") without touching the widget.\n\n**`set_priority`** *(local write, non-destructive · widget-only)*\n- **Input:** `{ task: string (id), priority: \"high\"|\"medium\"|\"low\" }`\n- **Output:** `{ status, task, priority }`\n- **Notes:** `tool` — hidden from the model; the `<select>` in `TaskList` is its only caller, keeping the model's tool surface to the three it should reason about.\n\n---\n\n## 7. Conversation Design Principles\n\n**Tone.** Brisk, confirming, never chatty. A task app earns trust by getting out of the way; every reply names *what changed* and offers the obvious next move.\n\n**Guardrails (non-negotiable):**\n- **Never invent a task.** The list is grounded in `list_today`'s returned state; if the app hasn't read a list, it says so rather than guessing.\n- **Never mutate silently.** Capture, re-prioritize, and complete each return a visible confirmation and update the widget — the user always sees the new state.\n- **Confirm completion explicitly.** \"Done — *X* is checked off\" plus the remaining count; completion is irreversible-feeling, so it is always narrated.\n- **Priority is the user's, not the model's.** The model may *suggest* a priority when capturing (\"this sounds high?\") but sets what the user says; it does not silently re-rank the list.\n\n**Memory strategy.** Session-scoped: captured tasks and completions persist across turns within the conversation (`added`/`done`/`priority` state layered over the seeded read). A production deployment persists to the connected account (§9).\n\n**Multi-turn intelligence.** The model **infers** structured fields from prose (\"book flights for the offsite, low\" → title + `priority: low`) and **asks** only when a title is genuinely missing. It never asks the user to restate a task it can already see in `TaskList`.\n\n---\n\n## 8. End-to-End User Journey Map\n\n| Phase | Time budget | What happens |\n| :--- | :--- | :--- |\n| **First run — Connect** | one-time, ~10s | Scoped `customerAuth` consent (read + write); dismissed forever after (§9). |\n| **Read (grounded)** | first 3–5s | \"What's on my plate?\" → `list_today` renders `TaskList` with the real list. |\n| **Capture** | ~2s per task | \"Add X, high\" → row appears instantly, `add_task` records it. |\n| **Prioritize** | ~2s per change | Inline `<select>` or \"bump the PR to high\" → `set_priority`, list re-orders. |\n| **Complete** | ~2s per task | Check the row or \"mark X done\" → `complete_task`, struck through, count drops. |\n| **Close-out** | end of day | All-clear empty state; nudge to capture tomorrow's first task. |\n\n---\n\n## 9. Account-Connection / Auth Architecture (Deep Dive)\n\nBecause Acme Tasks **writes** to the user's tasks, the first interaction is a **scoped, one-time connection** — Noodle Seed's `customerAuth` end-user OAuth pattern (see the `customer-auth` example). This replaces the \"handoff\" a top-of-funnel app would have: there is no destination to send the user to, only an account to link.\n\n**What must be true of the connection:**\n- **Plain-language scope.** The consent card names *read* (your tasks and priorities) and *write* (add, re-prioritize, complete tasks you ask me to) in the user's words — not buried in an OAuth redirect.\n- **Held by the connector, never the model.** The delegated credential is exchanged and stored by the credential broker; it is never surfaced in tool payloads, the widget, logs, or the model's context.\n- **Connected once, revocable anytime.** One connection powers all three flows; the consent card links the revoke path.\n- **The request resumes automatically.** After the user approves, the original ask (\"what's on my plate?\") continues without re-typing.\n\n**Flagship simplification (honest note):** this example ships with a **seeded** `today` list rather than a live account, so the design can stay focused on the three flows. The connect screen is wireframed as step 1 because it is the production pattern; the seed list stands in for the connected account's read. A real deployment swaps the seed for `customerAuth`-brokered account reads/writes — the tool signatures and widget do not change.\n\n**Edge cases at the boundary:** connection declined (app degrades to a read-only explanation, no writes attempted); token revoked mid-session (next write returns a re-connect prompt, never a silent failure); scope mismatch (write attempted without write scope → explicit \"reconnect to allow changes\").\n\n---\n\n## 10. Demo Scope Recommendation\n\n**MVP (build these, defer the rest):** the three flows against the seeded list, in one `TaskList` widget — Capture (`add_task`), Prioritize (`list_today` + `set_priority`), Complete (`complete_task`).\n\n**2-minute demo script:**\n1. **0:00** — \"What's on my plate today?\" → `TaskList` renders the three seed tasks, highest priority first. *(grounded read)*\n2. **0:25** — \"Add 'draft the board update', high priority.\" → new row appears at the top instantly. *(capture)*\n3. **0:50** — Open the PR review's priority `<select>`, set **high** → list re-orders. *(prioritize, in-widget)*\n4. **1:15** — \"I finished the vendor email — mark it done.\" → row strikes through, count 4 → 3. *(complete by voice)*\n5. **1:40** — Check the last row in the widget → all-clear empty state + \"capture tomorrow's first task?\" *(close the loop)*\n\n---\n\n## 11. Technical Architecture (High Level)\n\n- **Server:** one `server('acme_tasks', …)` in `src/server.ts` (Noodle Seed authoring SDK), four tools, `branding` tokens, per-tool CSP allowlist.\n- **Widget:** `TaskList` (`src/views/task-list.tsx`), a React `view` using `useCallTool` / `useToolInfo` / `useLayout` / `useViewState`; local session state (`added` / `done` / `priority`) layered over the `list_today` read, each change recorded through a tool call.\n- **State:** session-scoped in the flagship (seed list + local overlay). Production: `customerAuth`-brokered reads/writes to the account.\n- **Validation loop:** `noodle validate` → `noodle test` → `noodle dev`; compliance via `noodle check --target chatgpt`.\n\n---\n\n## 12. Success Metrics\n\n| Metric | Maps to |\n| :--- | :--- |\n| **Connect completion rate** | % of first-runs that finish the `customerAuth` consent (§9). |\n| **In-chat write rate** | writes (`add_task` + `set_priority` + `complete_task`) per session — the core \"work done in chat\" signal. |\n| **Capture-to-list latency** | time from utterance to the row appearing in `TaskList` (target < 1s optimistic). |\n| **Completion rate** | % of read sessions that end with at least one `complete_task` — the retention-driving \"closed the loop\" event. |\n| **Return frequency** | sessions per user per day — the habit metric a task app lives or dies on. |\n\n**Attribution:** each tool call carries the connected account identity (server identity + tenant), so writes are traceable to the session without exposing the credential.\n\n---\n\n## 13. Future Enhancements (Post-Launch)\n\n- **Live account** via `customerAuth` replacing the seed list (the natural first step out of the flagship).\n- **Due dates & scheduling** (\"email the vendor by Friday\") once the model can be trusted to parse relative dates.\n- **Bulk triage** (\"move everything low to tomorrow\") — a batched, previewed, reversible write.\n- **Projects / grouping** beyond a single flat list, once the single-list flows are proven.\n- **Undo** as a first-class in-chat verb for every write.\n\n---\n\n## Appendix — Two-Way Scope Cheat-Sheet\n\n| User request | In chat (in-app) | Off-app |\n| :--- | :---: | :---: |\n| \"What's on my list?\" | ✓ `list_today` → `TaskList` | — |\n| \"Add a task…\" | ✓ `add_task` | — |\n| \"Make X high priority\" | ✓ `set_priority` | — |\n| \"Mark X done\" | ✓ `complete_task` | — |\n| First-run account link | — | ✓ `customerAuth` consent (once, scoped, revocable) |\n| Anything transactional | — | *(none — the app has no transactional off-app step)* |\n" },
40
40
  { relPath: "examples/acme-tasks/design/wireframe.html", content: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"UTF-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n<title>Acme Tasks × ChatGPT — Two-Way App Wireframes</title>\n<style>\n @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');\n * { margin: 0; padding: 0; box-sizing: border-box; }\n body { font-family: 'Inter', -apple-system, sans-serif; background: #f4f5f7; color: #1f1f1f; line-height: 1.55; }\n .mono { font-family: 'JetBrains Mono', monospace; }\n\n /* ── Acme Tasks branding + host-compliant tokens ── */\n :root {\n --accent: #7C3AED; /* branding.accent — CTAs, logo, high-priority emphasis only */\n --accent-soft: #EDE9FE;\n --accent-border: #DDD6FE;\n --ink: #161228; /* branding.surfaceDark — ChatGPT / system surface */\n --hi: #DC2626; /* priority: high */\n --med: #D97706; /* priority: medium */\n --low: #6B7280; /* priority: low */\n --green: #059669;\n --green-soft: #E7F6EF;\n --green-border: #A7E0C6;\n --amber: #B45309;\n --amber-soft: #FBF1E2;\n --amber-border: #EBD7A8;\n --blue-soft: #E8EEFB;\n --line: #ececeb;\n }\n\n .page-header { background: var(--ink); color: #fff; border-bottom: 3px solid var(--accent); padding: 30px 48px; position: sticky; top: 0; z-index: 100; }\n .page-header h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }\n .page-header h1 .brand { color: #b79bff; }\n .page-header p { font-size: 13px; color: #b3b3c2; margin-top: 4px; }\n .page-header .scope { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.4px; padding: 4px 12px; background: var(--accent); color: #fff; border-radius: 4px; }\n\n .section-nav { background: #fff; border-bottom: 1px solid #e6e8ec; padding: 12px 48px; display: flex; gap: 22px; font-size: 12px; font-weight: 600; position: sticky; top: 100px; z-index: 99; overflow-x: auto; }\n .section-nav a { color: #8a929c; text-decoration: none; white-space: nowrap; }\n .section-nav a:hover { color: var(--accent); }\n\n .container { max-width: 1480px; margin: 0 auto; padding: 40px 48px 90px; }\n\n /* ── Legend ── */\n .vocab { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 24px; padding: 14px 18px; background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; font-size: 12px; color: #555; }\n .vocab-item { display: flex; align-items: center; gap: 8px; }\n .vocab-sw { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,0.1); }\n .vocab-sw.accent { background: var(--accent); }\n .vocab-sw.hi { background: var(--hi); } .vocab-sw.med { background: var(--med); } .vocab-sw.low { background: var(--low); }\n .vocab-sw.green { background: var(--green); }\n .vocab-sw.ink { background: var(--ink); }\n .vocab-sw.grey { background: #cdd2d8; }\n\n .section { margin-bottom: 72px; }\n .section-label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; display: block; }\n .section-title { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; color: var(--ink); }\n .section-subtitle { font-size: 14px; color: #5c6570; margin-bottom: 24px; max-width: 880px; }\n\n /* ── Rationale block ── */\n .rationale { background: #fff; border: 1px solid #e6e8ec; border-left: 3px solid var(--accent); border-radius: 10px; padding: 16px 20px; margin-bottom: 24px; max-width: 960px; }\n .rationale h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: #8a929c; margin-bottom: 8px; }\n .rationale p { font-size: 13px; color: #3d454e; line-height: 1.6; margin-bottom: 8px; }\n .rationale p:last-child { margin-bottom: 0; }\n .r-tag { display: inline-block; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 4px; margin-right: 4px; }\n .r-tag.ux { background: var(--green-soft); color: #15734d; }\n .r-tag.ui { background: var(--blue-soft); color: #1d4fa0; }\n .r-tag.acme { background: var(--accent-soft); color: #5b21b6; }\n .r-tag.trust { background: var(--amber-soft); color: #8a5a0a; }\n\n /* ── Phones ── */\n .phones-row { display: flex; gap: 26px; overflow-x: auto; padding-bottom: 16px; align-items: stretch; }\n .phone-step { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; }\n .step-label { font-size: 11px; font-weight: 600; color: #99a1ab; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; text-align: center; max-width: 320px; }\n .step-label small { font-weight: 400; letter-spacing: 0; text-transform: none; color: #b3bac2; display: block; margin-top: 2px; }\n .phone { width: 322px; min-height: 660px; background: #fff; border: 2px solid var(--ink); border-radius: 32px; overflow: hidden; display: flex; flex-direction: column; }\n .phone.offapp { border-color: #b9c0c8; border-style: dashed; }\n .phone-notch { width: 100px; height: 24px; background: var(--ink); border-radius: 0 0 14px 14px; margin: 0 auto; flex-shrink: 0; }\n .phone.offapp .phone-notch { background: #b9c0c8; }\n .phone-screen { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }\n .step-arrow { display: flex; align-items: center; justify-content: center; flex-shrink: 0; align-self: center; width: 34px; font-size: 24px; color: #c6ccd3; }\n\n .chatgpt-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 0 10px; border-bottom: 1px solid #eef0f2; }\n .chatgpt-header .model-name { font-size: 14px; font-weight: 600; }\n .chatgpt-header .dots { font-size: 18px; color: #aab; letter-spacing: 2px; }\n .browser-header { display: flex; align-items: center; gap: 8px; padding: 8px 0 10px; border-bottom: 1px solid #eef0f2; }\n .browser-header .url { flex: 1; font-size: 9.5px; color: #8a929c; background: #f1f3f5; border-radius: 12px; padding: 6px 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }\n .browser-header .lock { color: var(--green); font-size: 11px; }\n\n .msg { max-width: 94%; font-size: 13px; line-height: 1.55; }\n .msg.user { align-self: flex-end; background: #ece9e3; color: #1f1f1f; padding: 10px 14px; border-radius: 18px 18px 4px 18px; margin-left: auto; }\n .msg.assistant { color: #1f1f1f; padding: 2px 0; }\n .msg.assistant strong { font-weight: 600; }\n .msg.assistant .ok { color: var(--green); font-weight: 600; }\n\n .tool-call { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #f7f8f9; border: 1px solid #e6e8ec; border-radius: 10px; font-size: 11px; color: #5c6570; }\n .tool-call .icon { width: 20px; height: 20px; background: var(--accent); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; font-weight: 800; color: #fff; }\n .tool-call .label { font-weight: 700; color: #3d454e; }\n .mono-tool { font-family: 'JetBrains Mono', monospace; color: #8a929c; }\n\n /* ── Widget card (TaskList) ── */\n .wcard { border: 1.5px solid #e0e3e7; border-radius: 14px; background: #fff; overflow: hidden; }\n .wcard-head { padding: 11px 14px; background: #fbfbfa; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }\n .wcard-head .wc-logo { width: 18px; height: 18px; background: var(--accent); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; }\n .wcard-head .wc-title { font-size: 12.5px; font-weight: 700; letter-spacing: 0.2px; color: #1f1f1f; }\n .wcard-head .wc-sub { font-size: 10px; color: #a0a4a8; margin-left: auto; font-family: 'JetBrains Mono', monospace; }\n .wcard-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }\n\n /* ── Capture input ── */\n .capture { display: flex; gap: 8px; }\n .capture .cinput { flex: 1; font-size: 12px; color: #6b7280; background: #f6f7f9; border: 1px solid #e3e6ea; border-radius: 8px; padding: 8px 10px; }\n .capture .cinput.typed { color: #1f1f1f; }\n .capture .cadd { font-size: 12px; font-weight: 700; color: #fff; background: var(--accent); border-radius: 8px; padding: 8px 14px; }\n\n /* ── Task rows ── */\n .task { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f2f2f0; }\n .task:last-child { border-bottom: none; }\n .tcheck { width: 18px; height: 18px; border-radius: 50%; border: 1.6px solid #c6ccd3; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; }\n .tcheck.done { background: var(--green); border-color: var(--green); color: #fff; }\n .ttitle { flex: 1; font-size: 12.5px; color: #202020; line-height: 1.35; min-width: 0; }\n .ttitle.done { text-decoration: line-through; color: #a8adb2; }\n .pri { font-size: 9.5px; font-weight: 700; padding: 2px 8px; border-radius: 5px; flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px; }\n .pri.hi { background: rgba(220,38,38,0.10); color: var(--hi); }\n .pri.med { background: rgba(217,119,6,0.10); color: var(--med); }\n .pri.low { background: rgba(107,114,128,0.12); color: var(--low); }\n .pri .caret { font-size: 8px; opacity: 0.7; }\n\n .note { font-size: 11px; color: #5c6570; background: #f7f8f9; border-radius: 8px; padding: 8px 10px; line-height: 1.5; }\n .note.why { border-left: 3px solid var(--accent); }\n .note.ok { background: var(--green-soft); color: #146b32; border-left: 3px solid var(--green); }\n .caution { display: flex; gap: 6px; font-size: 10.5px; font-weight: 600; padding: 7px 9px; background: var(--amber-soft); color: #8a5a0a; border: 1px solid var(--amber-border); border-radius: 8px; line-height: 1.45; }\n .disclaimer { font-size: 9.5px; color: #a0a4a8; font-style: italic; line-height: 1.45; padding-top: 2px; }\n .footnote { font-size: 10px; color: #8a929c; text-align: center; padding-top: 4px; }\n\n .cta { padding: 9px 10px; background: var(--accent); border-radius: 9px; text-align: center; font-size: 12px; font-weight: 700; color: #fff; }\n .cta.ghost { background: #fff; border: 1.5px solid #d4d8dd; color: #4a525c; }\n .cta-row { display: flex; gap: 8px; }\n .cta-row .cta { flex: 1; }\n\n /* ── Connect / customerAuth ── */\n .connect { text-align: center; padding: 6px 4px; }\n .connect .ci { width: 46px; height: 46px; background: var(--accent); border-radius: 12px; margin: 6px auto 12px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 22px; font-weight: 800; }\n .connect .ctitle { font-size: 14px; font-weight: 800; color: var(--ink); }\n .scopes { text-align: left; font-size: 10.5px; color: #4a525c; display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }\n .scopes .sc { display: flex; gap: 7px; align-items: flex-start; }\n .scopes .sc .k { color: var(--green); font-weight: 800; min-width: 34px; }\n\n .dest { border: 1.5px solid #e0e3e7; border-radius: 10px; padding: 11px; }\n .dest .dh { font-size: 12px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }\n .dest .dl { font-size: 11px; color: #5c6570; line-height: 1.5; }\n\n .empty { text-align: center; padding: 8px 4px; }\n .empty .ei { width: 44px; height: 44px; background: var(--green); border-radius: 12px; margin: 4px auto 10px; display: flex; align-items: center; justify-content: center; font-size: 22px; }\n .empty .et { font-size: 13px; font-weight: 800; color: var(--ink); }\n\n /* ── Gallery ── */\n .gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }\n .spec-frame { display: flex; flex-direction: column; gap: 8px; }\n .spec-frame .sf-name { font-size: 12px; font-weight: 700; color: var(--ink); }\n .spec-frame .sf-name span { font-weight: 400; color: #8a929c; }\n\n /* ── API appendix ── */\n .api-panel { background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; padding: 18px 22px; margin-bottom: 18px; max-width: 1040px; }\n .api-panel h4 { font-size: 13px; font-weight: 800; color: var(--ink); margin-bottom: 10px; }\n .api-step { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px dashed #eceef1; font-size: 12.5px; }\n .api-step:last-child { border-bottom: none; }\n .api-step .verb { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 7px; border-radius: 4px; flex-shrink: 0; }\n .api-step .verb.read { background: #64748b; }\n .api-step .tname { font-family: 'JetBrains Mono', monospace; font-weight: 700; color: #3d454e; }\n .api-note { font-size: 11px; color: #6b7280; padding: 4px 0 2px 0; line-height: 1.5; }\n\n /* ── Audit table ── */\n .audit-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e6e8ec; border-radius: 12px; overflow: hidden; font-size: 12.5px; }\n .audit-table th { text-align: left; background: #fafbfc; color: #5c6570; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px; padding: 11px 14px; border-bottom: 1px solid #e6e8ec; }\n .audit-table td { padding: 11px 14px; border-bottom: 1px solid #f0f1f3; vertical-align: top; color: #3d454e; line-height: 1.5; }\n .audit-table tr:last-child td { border-bottom: none; }\n .audit-table .req { font-weight: 700; color: var(--ink); width: 22%; }\n .verdict { font-weight: 800; font-size: 11px; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }\n .verdict.pass { background: var(--green-soft); color: #146b32; }\n .verdict.flag { background: var(--amber-soft); color: #8a5a0a; }\n\n .footer { text-align: center; font-size: 11px; color: #99a1ab; padding: 30px; border-top: 1px solid #e6e8ec; }\n</style>\n</head>\n<body>\n\n<div class=\"page-header\">\n <h1><span class=\"brand\">Acme Tasks</span> × ChatGPT — Two-Way App Wireframes</h1>\n <p>Prepared by Noodle Seed · a two-way (read + write) task manager — capture, prioritize &amp; complete, all in chat · three core flows</p>\n <span class=\"scope\">SCOPE: two-way in chat — Capture · Prioritize · Complete · OFF-APP: one-time scoped account link (customerAuth) only</span>\n</div>\n\n<div class=\"section-nav\">\n <a href=\"#legend\">Legend</a>\n <a href=\"#connect\">First-run · Connect</a>\n <a href=\"#flow\">End-to-End Flow</a>\n <a href=\"#capture\">1 · Capture</a>\n <a href=\"#prioritize\">2 · Prioritize</a>\n <a href=\"#complete\">3 · Complete</a>\n <a href=\"#gallery\">Widget Gallery</a>\n <a href=\"#api\">MCP Tools</a>\n <a href=\"#audit\">Compliance Audit</a>\n</div>\n\n<div class=\"container\">\n\n <!-- LEGEND -->\n <div class=\"section\" id=\"legend\">\n <div class=\"vocab\">\n <div class=\"vocab-item\"><span class=\"vocab-sw accent\"></span> Acme accent — primary CTAs, logo &amp; checks only</div>\n <div class=\"vocab-item\"><span class=\"vocab-sw hi\"></span> high</div>\n <div class=\"vocab-item\"><span class=\"vocab-sw med\"></span> medium</div>\n <div class=\"vocab-item\"><span class=\"vocab-sw low\"></span> low</div>\n <div class=\"vocab-item\"><span class=\"vocab-sw green\"></span> Completed / success</div>\n <div class=\"vocab-item\"><span class=\"vocab-sw ink\"></span> ChatGPT system surface</div>\n <div class=\"vocab-item\"><span class=\"vocab-sw grey\"></span> Off-app (dashed phone → account link only)</div>\n </div>\n <div class=\"rationale\">\n <h4>How to read these wireframes</h4>\n <p>Solid-border phones are the <strong>in-ChatGPT app</strong>. Acme Tasks is a <strong>two-way (read + write) app</strong>, not a discovery funnel: every widget reflects the user's real list, and each action — capture, re-prioritize, complete — is <strong>recorded through a tool call</strong> and confirmed in-chat. The single dashed phone is the <strong>one-time account link</strong> (<span class=\"mono\">customerAuth</span>); there is no transactional off-app step.</p>\n <p>Widgets are built with the Noodle Seed authoring SDK — <span class=\"mono\">tool + view</span> renders <span class=\"mono\">TaskList</span>; <span class=\"mono\">tool + app visibility</span> powers the in-widget re-prioritize. Styling uses host/Noodle Seed semantic tokens via CSS cascade layers; the brand accent (<span class=\"mono\">#7C3AED</span>) is reserved for the logo, checks, primary CTA and <em>high</em> emphasis. Priority uses fixed semantic colors: high red · medium amber · low slate.</p>\n <p><span class=\"r-tag ux\">UX</span> flow rationale &nbsp; <span class=\"r-tag ui\">UI</span> interface rationale &nbsp; <span class=\"r-tag acme\">ACME</span> product-model fit &nbsp; <span class=\"r-tag trust\">TRUST</span> write-safety / grounding guardrail</p>\n </div>\n </div>\n\n <!-- CONNECT -->\n <div class=\"section\" id=\"connect\">\n <span class=\"section-label\">First-run</span>\n <h2 class=\"section-title\">Connect Acme Tasks — scoped, once</h2>\n <p class=\"section-subtitle\">Because the app writes to the user's tasks, the very first interaction is a scoped account connection. It names exactly what the app can read and change, is dismissed forever after, and the original request resumes automatically. <em>(This flagship seeds the list so the flows stay in focus; the connect screen is the production pattern — see <span class=\"mono\">customer-auth</span>.)</em></p>\n <div class=\"rationale\">\n <h4>Why it's built this way</h4>\n <p><span class=\"r-tag trust\">TRUST</span> An app that can complete and re-prioritize your tasks needs unambiguous, plain-language consent — the scope card names read vs. write in the user's words and links the revoke path, rather than burying it in an OAuth redirect.</p>\n <p><span class=\"r-tag acme\">ACME</span> Uses Noodle Seed's <span class=\"mono\">customerAuth</span> end-user OAuth. One connection powers all three flows; the delegated credential is held by the credential broker, never surfaced to the model, the widget, or logs.</p>\n </div>\n <div class=\"phones-row\">\n <div class=\"phone-step\">\n <div class=\"step-label\">Connect prompt</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">What's on my plate today?</div>\n <div class=\"msg assistant\">I can pull your live Acme Tasks list — let's connect it first (takes a few seconds).</div>\n <div class=\"wcard\"><div class=\"wcard-body\">\n <div class=\"connect\">\n <div class=\"ci\">✓</div>\n <div class=\"ctitle\">Connect Acme Tasks</div>\n </div>\n <div class=\"scopes\">\n <div class=\"sc\"><span class=\"k\">Read</span><span>your tasks and their priorities</span></div>\n <div class=\"sc\"><span class=\"k\">Write</span><span>add, re-prioritize &amp; complete tasks you ask me to</span></div>\n </div>\n <div class=\"cta\">Connect Acme Tasks</div>\n <div class=\"disclaimer\">Scoped end-user OAuth (customerAuth) · read + write · revoke anytime in Acme Tasks → Settings → Connections.</div>\n </div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n <div class=\"phone-step\">\n <div class=\"step-label\">Authorize (off-app)</div>\n <div class=\"phone offapp\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"browser-header\"><span class=\"lock\">🔒</span><span class=\"url\">tasks.acme.example/oauth/authorize?scope=tasks.read+tasks.write</span></div>\n <div class=\"dest\">\n <div class=\"dh\">Acme Tasks authorization</div>\n <div class=\"dl\">User signs in and approves read + write. Acme redirects back with a token held by the connector, not the model. <strong>Happens once.</strong></div>\n </div>\n <div class=\"note\" style=\"margin-top:8px;\">↩ On return, the original request (\"what's on my plate today?\") resumes automatically — no re-typing.</div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n <div class=\"phone-step\">\n <div class=\"step-label\">Connected → request resumes</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"note ok\">✓ Acme Tasks connected — I'll keep it linked for next time.</div>\n <div class=\"tool-call\"><span class=\"icon read\">✓</span><span><span class=\"label\">list_today</span> <span class=\"mono-tool\">{ focus: \"today\" }</span></span></div>\n <div class=\"msg assistant\">Here's today 👇 <span style=\"color:#8a929c;\">(see Flow 2)</span></div>\n </div></div>\n </div>\n </div>\n </div>\n\n <!-- END TO END FLOW -->\n <div class=\"section\" id=\"flow\">\n <span class=\"section-label\">The whole loop</span>\n <h2 class=\"section-title\">End-to-end: read today → capture → re-prioritize → complete</h2>\n <p class=\"section-subtitle\">One connected session touching all three flows. The user reads the grounded list, captures a new task, bumps a priority, and checks work off — never leaving the conversation, every change recorded and confirmed in place.</p>\n <div class=\"phones-row\">\n\n <!-- Step 1 · read -->\n <div class=\"phone-step\">\n <div class=\"step-label\">1 · Read today<small>grounded list</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">What's on my plate today?</div>\n <div class=\"tool-call\"><span class=\"icon read\">✓</span><span><span class=\"label\">list_today</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 3 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"capture\"><span class=\"cinput\">Add a task…</span><span class=\"cadd\">Add</span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri med\">medium <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Book flights for the team offsite</div><span class=\"pri low\">low <span class=\"caret\">▾</span></span></div>\n <div class=\"footnote\">Two-way in chat: read, capture, re-prioritize, complete.</div>\n </div></div>\n </div></div>\n </div>\n\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 2 · capture -->\n <div class=\"phone-step\">\n <div class=\"step-label\">2 · Capture<small>natural language</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Add \"draft the board update\", high priority.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">add_task</span> <span class=\"mono-tool\">{ title:\"Draft the board update\", priority:\"high\" }</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 4 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Draft the board update</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri med\">medium <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Added \"Draft the board update\" (high).</div>\n </div></div>\n </div></div>\n </div>\n\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 3 · prioritize -->\n <div class=\"phone-step\">\n <div class=\"step-label\">3 · Prioritize<small>in-widget re-order</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Bump the PR review to high.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">set_priority</span> <span class=\"mono-tool\">{ task:\"review_pr\", priority:\"high\" }</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 4 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Draft the board update</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Set review_pr to high priority.</div>\n </div></div>\n </div></div>\n </div>\n\n <div class=\"step-arrow\">→</div>\n\n <!-- Step 4 · complete -->\n <div class=\"phone-step\">\n <div class=\"step-label\">4 · Complete<small>checked &amp; confirmed</small></div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">I finished the vendor email — mark it done.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">complete_task</span> <span class=\"mono-tool\">{ task:\"email_vendor\", title:\"Email the vendor…\" }</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 3 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck done\">✓</div><div class=\"ttitle done\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high</span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Draft the board update</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Completed \"Email the vendor about the Q3 quote\". 3 left today.</div>\n </div></div>\n </div></div>\n </div>\n\n </div>\n </div>\n\n <!-- FLOW 1 : CAPTURE -->\n <div class=\"section\" id=\"capture\">\n <span class=\"section-label\">Flow 1 · lowest friction</span>\n <h2 class=\"section-title\">Capture — a spoken thought becomes a task, instantly</h2>\n <p class=\"section-subtitle\">The moment a task is mentioned it lands on the list. The model parses the prose into a title and priority, the row appears optimistically, and <span class=\"mono\">add_task</span> records it — no form, no app-switch.</p>\n <div class=\"rationale\">\n <h4>Why it's built this way</h4>\n <p><span class=\"r-tag ux\">UX</span> Capture must be the fastest path in the app — the thought is fragile. \"Add X, high\" is one turn: the model fills <span class=\"mono\">{ title, priority }</span> from natural language, so the user never fills a field by hand.</p>\n <p><span class=\"r-tag ui\">UI</span> The new row renders immediately (optimistic), then the tool call confirms with a spoken-ready status. The capture input lives at the top of <span class=\"mono\">TaskList</span> so keyboard capture and voice capture converge on the same widget.</p>\n <p><span class=\"r-tag trust\">TRUST</span> Priority is the user's: the model may <em>suggest</em> (\"sounds high?\") but sets what the user says, and defaults to <span class=\"mono\">medium</span> when unstated — it never silently ranks work.</p>\n </div>\n <div class=\"phones-row\">\n <div class=\"phone-step\">\n <div class=\"step-label\">Say it</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Remind me to book flights for the team offsite — low priority.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">add_task</span> <span class=\"mono-tool\">{ title:\"Book flights for the team offsite\", priority:\"low\" }</span></span></div>\n <div class=\"msg assistant\">Added it to today's list at low priority.</div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n <div class=\"phone-step\">\n <div class=\"step-label\">Row appears (optimistic + recorded)</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 3 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"capture\"><span class=\"cinput typed\">Book flights for the team offsite</span><span class=\"cadd\">Add</span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri med\">medium <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Book flights for the team offsite</div><span class=\"pri low\">low <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Added \"Book flights for the team offsite\" (low).</div>\n </div></div>\n </div></div>\n </div>\n </div>\n </div>\n\n <!-- FLOW 2 : PRIORITIZE -->\n <div class=\"section\" id=\"prioritize\">\n <span class=\"section-label\">Flow 2 · the hub</span>\n <h2 class=\"section-title\">Prioritize — read the day, then re-order it in place</h2>\n <p class=\"section-subtitle\"><span class=\"mono\">list_today</span> renders the grounded list, highest priority first; the per-row priority control (a <span class=\"mono\">tool + app visibility</span> helper hidden from the model) lets the user re-rank without describing the task twice. This is the widget the other two flows write into.</p>\n <div class=\"rationale\">\n <h4>Why it's built this way</h4>\n <p><span class=\"r-tag ux\">UX</span> \"What's on my plate?\" wants an answer <em>and</em> a next move. The list is grouped high → low so the triager sees the real order at a glance and adjusts with one tap.</p>\n <p><span class=\"r-tag acme\">ACME</span> Re-prioritize is <span class=\"mono\">set_priority</span> as <span class=\"mono\">tool + app visibility</span> — <strong>widget-only</strong>, hidden from the model's tool surface. The model reasons about three tools (list, add, complete); the fourth is pure UI plumbing, keeping the model's choices clean.</p>\n <p><span class=\"r-tag trust\">TRUST</span> The list only ever shows tasks that exist — the app never invents a task or a priority. Every re-rank echoes a confirmation (\"Set review_pr to high priority\").</p>\n </div>\n <div class=\"phones-row\">\n <div class=\"phone-step\">\n <div class=\"step-label\">Grounded read</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">What's due today?</div>\n <div class=\"tool-call\"><span class=\"icon read\">✓</span><span><span class=\"label\">list_today</span> <span class=\"mono-tool\">{ focus:\"today\" }</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 3 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri med\">medium <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Book flights for the team offsite</div><span class=\"pri low\">low <span class=\"caret\">▾</span></span></div>\n </div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n <div class=\"phone-step\">\n <div class=\"step-label\">Re-prioritize (widget-only write)</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"note why\"><strong>Tapping the priority ▾</strong> on \"Review the analytics pull request\" → <span class=\"mono\">high</span>. The list re-orders in place.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">set_priority</span> <span class=\"mono-tool\">{ task:\"review_pr\", priority:\"high\" }</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 3 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Book flights for the team offsite</div><span class=\"pri low\">low <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Set review_pr to high priority.</div>\n </div></div>\n </div></div>\n </div>\n </div>\n </div>\n\n <!-- FLOW 3 : COMPLETE -->\n <div class=\"section\" id=\"complete\">\n <span class=\"section-label\">Flow 3 · the payoff</span>\n <h2 class=\"section-title\">Complete — check it off by voice or tap, confirmed every time</h2>\n <p class=\"section-subtitle\">The satisfaction loop. The user finishes work and closes it out — either by tapping the row's check or by saying \"mark X done\" (<span class=\"mono\">complete_task</span> is model-visible). The row strikes through, the open count drops, and the model narrates what changed.</p>\n <div class=\"rationale\">\n <h4>Why it's built this way</h4>\n <p><span class=\"r-tag ux\">UX</span> Completion is the reward that drives return visits, so it is friction-free two ways: the check in <span class=\"mono\">TaskList</span> and the spoken \"mark X done\". Ending on an all-clear empty state nudges the next capture instead of a dead end.</p>\n <p><span class=\"r-tag trust\">TRUST</span> Completion is never silent: <span class=\"mono\">complete_task</span> returns \"Completed '…'\" plus the remaining count, and the struck-through row is the visible receipt. The model confirms in the same turn.</p>\n <p><span class=\"r-tag acme\">ACME</span> <span class=\"mono\">complete_task</span> is model-visible (unlike re-prioritize) precisely because \"I finished X\" is a natural sentence the user will say — the model must be able to act on it directly.</p>\n </div>\n <div class=\"phones-row\">\n <div class=\"phone-step\">\n <div class=\"step-label\">Complete by voice (write + confirm)</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Done with the vendor email and the PR review.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">complete_task ×2</span> <span class=\"mono-tool\">email_vendor · review_pr</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 1 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck done\">✓</div><div class=\"ttitle done\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high</span></div>\n <div class=\"task\"><div class=\"tcheck done\">✓</div><div class=\"ttitle done\">Review the analytics pull request</div><span class=\"pri med\">medium</span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Book flights for the team offsite</div><span class=\"pri low\">low <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Completed 2 tasks. 1 left today.</div>\n </div></div>\n </div></div>\n </div>\n <div class=\"step-arrow\">→</div>\n <div class=\"phone-step\">\n <div class=\"step-label\">All clear (close the loop)</div>\n <div class=\"phone\"><div class=\"phone-notch\"></div><div class=\"phone-screen\">\n <div class=\"chatgpt-header\"><span class=\"model-name\">ChatGPT · Acme Tasks</span><span class=\"dots\">···</span></div>\n <div class=\"msg user\">Booked the flights too — check it off.</div>\n <div class=\"tool-call\"><span class=\"icon\">✓</span><span><span class=\"label\">complete_task · list_today</span></span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · all clear</span><span class=\"wc-sub\">TaskList · empty</span></div><div class=\"wcard-body\">\n <div class=\"empty\"><div class=\"ei\">🎉</div><div class=\"et\">All clear for today</div></div>\n <div class=\"note ok\">Everything on today's list is done — 3/3 completed this session.</div>\n <div class=\"cta-row\"><div class=\"cta\">Capture tomorrow's first task</div></div>\n <div class=\"disclaimer\">Nudges to the next capture instead of leaving the user at a dead end.</div>\n </div></div>\n </div></div>\n </div>\n </div>\n </div>\n\n <!-- WIDGET GALLERY -->\n <div class=\"section\" id=\"gallery\">\n <span class=\"section-label\">Reference</span>\n <h2 class=\"section-title\">Widget gallery</h2>\n <p class=\"section-subtitle\">One widget, <span class=\"mono\">TaskList</span>, across its states. Compliant: system fonts, neutral surfaces, accent reserved for logo/checks/primary CTA/high emphasis; priority in fixed semantic colors (high red · medium amber · low slate).</p>\n <div class=\"gallery\">\n\n <div class=\"spec-frame\">\n <div class=\"sf-name\">TaskList ★ <span>· grounded read (default)</span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 3 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"capture\"><span class=\"cinput\">Add a task…</span><span class=\"cadd\">Add</span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri med\">medium <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Book flights for the team offsite</div><span class=\"pri low\">low <span class=\"caret\">▾</span></span></div>\n </div></div>\n </div>\n\n <div class=\"spec-frame\">\n <div class=\"sf-name\">TaskList <span>· captured (optimistic + recorded)</span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 4 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Draft the board update</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Added \"Draft the board update\" (high).</div>\n </div></div>\n </div>\n\n <div class=\"spec-frame\">\n <div class=\"sf-name\">TaskList <span>· completed (write + confirm)</span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · 2 open</span><span class=\"wc-sub\">TaskList</span></div><div class=\"wcard-body\">\n <div class=\"task\"><div class=\"tcheck done\">✓</div><div class=\"ttitle done\">Email the vendor about the Q3 quote</div><span class=\"pri hi\">high</span></div>\n <div class=\"task\"><div class=\"tcheck\"></div><div class=\"ttitle\">Review the analytics pull request</div><span class=\"pri med\">medium <span class=\"caret\">▾</span></span></div>\n <div class=\"note ok\">✓ Completed \"Email the vendor…\". 2 left.</div>\n </div></div>\n </div>\n\n <div class=\"spec-frame\">\n <div class=\"sf-name\">TaskList <span>· all-clear empty state</span></div>\n <div class=\"wcard\"><div class=\"wcard-head\"><span class=\"wc-logo\">✓</span><span class=\"wc-title\">Today's tasks · all clear</span><span class=\"wc-sub\">TaskList · empty</span></div><div class=\"wcard-body\">\n <div class=\"empty\"><div class=\"ei\">🎉</div><div class=\"et\">All clear for today</div></div>\n <div class=\"cta\">Capture tomorrow's first task</div>\n </div></div>\n </div>\n\n <div class=\"spec-frame\">\n <div class=\"sf-name\">Connect / customerAuth <span>· scoped consent</span></div>\n <div class=\"wcard\"><div class=\"wcard-body\">\n <div class=\"connect\"><div class=\"ci\">✓</div><div class=\"ctitle\">Connect Acme Tasks</div></div>\n <div class=\"scopes\"><div class=\"sc\"><span class=\"k\">R/W</span><span>read tasks &amp; priorities · add, re-prioritize, complete</span></div></div>\n <div class=\"cta\">Connect Acme Tasks</div>\n </div></div>\n </div>\n\n </div>\n </div>\n\n <!-- MCP TOOLS APPENDIX -->\n <div class=\"section\" id=\"api\">\n <span class=\"section-label\">Technical appendix</span>\n <h2 class=\"section-title\">MCP tools &amp; call sequence</h2>\n <p class=\"section-subtitle\">The four tools behind the flows. <span class=\"mono\">list_today</span> is the only widget-opening tool (<span class=\"mono\">tool + view</span>); <span class=\"mono\">set_priority</span> is widget-only (<span class=\"mono\">tool + app visibility</span>, hidden from the model); <span class=\"mono\">add_task</span> and <span class=\"mono\">complete_task</span> are model-visible.</p>\n\n <div class=\"api-panel\">\n <h4>Read &amp; render (Flow 2 · the hub)</h4>\n <div class=\"api-step\"><span class=\"verb read\">READ</span><span><span class=\"tname\">list_today</span> — returns { status, focus, tasks:[{ id, title, priority, done }] } and renders TaskList</span></div>\n <div class=\"api-note\">Input <span class=\"mono\">{ focus:\"today\" }</span>. Read-only annotation; host status copy: invoking \"Loading your tasks…\", invoked \"Tasks ready\". This is the single widget-opening tool — the other flows write into the card it renders.</div>\n </div>\n\n <div class=\"api-panel\">\n <h4>Capture (Flow 1)</h4>\n <div class=\"api-step\"><span class=\"verb\">WRITE</span><span><span class=\"tname\">add_task</span> — returns { status, title, priority }</span></div>\n <div class=\"api-note\">Input <span class=\"mono\">{ title, priority: \"high\"|\"medium\"|\"low\" = \"medium\" }</span>. Model-fillable from prose (\"book flights, low\" → { title, priority:\"low\" }); local non-destructive write. Status is spoken-ready so the model confirms in one turn.</div>\n </div>\n\n <div class=\"api-panel\">\n <h4>Prioritize (Flow 2 helper) &amp; Complete (Flow 3)</h4>\n <div class=\"api-step\"><span class=\"verb\">WRITE</span><span><span class=\"tname\">set_priority</span> — returns { status, task, priority } · tool + app visibility, hidden from the model</span></div>\n <div class=\"api-note\">Input <span class=\"mono\">{ task:id, priority }</span>. Called only by the priority ▾ in TaskList — keeps the model's tool surface to the three it should reason about.</div>\n <div class=\"api-step\"><span class=\"verb\">WRITE</span><span><span class=\"tname\">complete_task</span> — returns { status, task } · model-visible</span></div>\n <div class=\"api-note\">Input <span class=\"mono\">{ task:id, title:\"\" }</span>. Model-visible so \"I finished X\" completes directly; local non-destructive write, confirmed with the remaining count.</div>\n </div>\n </div>\n\n <!-- COMPLIANCE AUDIT -->\n <div class=\"section\" id=\"audit\">\n <span class=\"section-label\">Submission-ready</span>\n <h2 class=\"section-title\">OpenAI Apps SDK Compliance Audit</h2>\n <p class=\"section-subtitle\">Every row cites concrete app behavior. Built with the Noodle Seed authoring SDK and verified with <span class=\"mono\">noodle check --target chatgpt</span>.</p>\n\n <table class=\"audit-table\">\n <thead><tr><th class=\"req\">Requirement</th><th>How Acme Tasks addresses it</th><th>Verdict</th></tr></thead>\n <tbody>\n <tr><td class=\"req\">Conversational value</td><td>Capture parses prose into structured fields (\"book flights for the offsite, low\" → { title, priority:\"low\" }); complete-by-voice (\"I finished the vendor email\") acts directly — actions no tap-only app affords.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Beyond base ChatGPT</td><td>Grounded read of the user's real list (never guessed) plus committed writes to the connected account — state the base model cannot hold.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Atomic, model-friendly tools</td><td>Four tools, explicit Zod input/output schemas, each returning a spoken-ready status. <span class=\"mono\">list_today</span> / <span class=\"mono\">add_task</span> / <span class=\"mono\">complete_task</span> model-visible; <span class=\"mono\">set_priority</span> widget-only.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Helpful UI only</td><td>One widget, <span class=\"mono\">TaskList</span> — visual scanning of a prioritized list plus in-place capture/complete/re-prioritize. No carousel (one list) and no PiP (nothing backgrounded); omissions are deliberate.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">In-chat task completion</td><td>The whole loop — read, capture, re-prioritize, complete — finishes in chat; there is no handoff. The only off-app step is the one-time account link.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Performance &amp; responsiveness</td><td>Optimistic render on capture/complete, then the tool call records; one tool call per user step. Host status copy shown while <span class=\"mono\">list_today</span> loads.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Discoverability</td><td>Broad natural triggers: \"remind me to…\", \"what's on my list?\", \"make X high priority\", \"mark X done\". Golden-prompt set &amp; description keywords are a launch workstream.</td><td><span class=\"verdict flag\">PLAN</span></td></tr>\n <tr><td class=\"req\">Design tokens &amp; theming</td><td>Host/Noodle Seed semantic tokens via CSS cascade layers; brand accent (<span class=\"mono\">#7C3AED</span>) restricted to logo, checks, primary CTA &amp; high emphasis. Adapts to host light/dark.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">System fonts, icons, WCAG AA</td><td>System font stack; single outlined monochrome check icon; contrast on priority chips and CTAs meets AA; no nested scroll (inline card → fullscreen for long lists).</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">≤2 primary actions on inline card</td><td>Two primaries — capture <strong>Add</strong> and the per-row <strong>complete</strong> check; re-prioritize is a lightweight inline control, not a CTA.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Write safety (domain guardrail)</td><td>No silent mutation: capture, re-prioritize &amp; complete each return a confirmation and update the widget. Completion always states the remaining count. Priority is the user's — the model suggests, never silently re-ranks.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Grounding (domain guardrail)</td><td>The list only shows tasks that exist in state; the app never invents a task. A production deployment reads from the connected account, not the model's memory.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n <tr><td class=\"req\">Scoped account auth &amp; secrets</td><td>Scoped <span class=\"mono\">customerAuth</span> (read + write), connected once, revocable. Delegated credential held by the credential broker — never in tool payloads, the widget, or logs.</td><td><span class=\"verdict pass\">PASS</span></td></tr>\n </tbody>\n </table>\n </div>\n\n</div>\n\n<div class=\"footer\">\n Acme Tasks × ChatGPT — Two-Way App Wireframes · Noodle Seed · v1 · July 2026<br>\n Illustrative wireframes for a fictional app. Built with the Noodle Seed authoring SDK (tool + view / tool + app visibility · customerAuth). This flagship seeds the task list; a production deployment connects the user's account. Task data shown is sample content.\n</div>\n\n</body>\n</html>\n" },
41
41
  { relPath: "examples/acme-tasks/noodle.json", content: "{\n \"entrypoint\": \"src/server.ts\",\n \"name\": \"acme-tasks\",\n \"template\": \"widget\"\n}\n" },
@@ -46,21 +46,21 @@ export const BUNDLED_EXAMPLE_FILES = [
46
46
  { relPath: "examples/acme-tasks/src/views/widget-style.css", content: ":root {\n color-scheme: light dark;\n font-family:\n Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n --nw-bg: #ffffff;\n --nw-surface: #f7f5ff;\n --nw-text: #1c1830;\n --nw-muted: #635d80;\n --nw-border: #e2ddf5;\n --nw-accent: #7c3aed;\n --nw-accent-strong: #6d28d9;\n --nw-accent-soft: #efe9ff;\n --nw-high: #dc2626;\n --nw-medium: #b45309;\n --nw-low: #2563eb;\n --nw-radius: 10px;\n --nw-shadow: 0 18px 50px rgb(30 20 60 / 12%);\n}\n\n.dark,\n[data-theme=\"dark\"] {\n --nw-bg: #161228;\n --nw-surface: #1d1735;\n --nw-text: #f2eeff;\n --nw-muted: #a99fce;\n --nw-border: #342a54;\n --nw-accent: #a78bfa;\n --nw-accent-strong: #8b5cf6;\n --nw-accent-soft: #2a2148;\n --nw-high: #f87171;\n --nw-medium: #fbbf24;\n --nw-low: #60a5fa;\n --nw-shadow: 0 18px 50px rgb(0 0 0 / 32%);\n}\n\n* {\n box-sizing: border-box;\n}\n\nbody {\n margin: 0;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\nbutton,\ninput,\nselect {\n font: inherit;\n}\n\n.nw-shell {\n min-height: 100vh;\n padding: 14px;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\n.nw-card {\n max-width: 620px;\n margin: 0 auto;\n background: var(--nw-surface);\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n box-shadow: var(--nw-shadow);\n overflow: hidden;\n}\n\n.nw-header {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 16px;\n border-bottom: 1px solid var(--nw-border);\n}\n\n.nw-icon svg {\n width: 24px;\n height: 24px;\n fill: none;\n stroke: var(--nw-accent);\n stroke-width: 2;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.nw-title-block {\n flex: 1;\n min-width: 0;\n}\n\n.nw-title {\n margin: 0;\n font-size: 17px;\n font-weight: 700;\n}\n\n.nw-subtitle {\n margin: 2px 0 0;\n font-size: 13px;\n color: var(--nw-muted);\n}\n\n.nw-chip {\n padding: 4px 10px;\n border-radius: 999px;\n background: var(--nw-accent-soft);\n color: var(--nw-accent-strong);\n font-size: 12px;\n font-weight: 600;\n}\n\n.nw-capture {\n display: flex;\n gap: 8px;\n padding: 14px 16px 4px;\n}\n\n.nw-input {\n flex: 1;\n padding: 9px 12px;\n border: 1px solid var(--nw-border);\n border-radius: 10px;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\n.nw-button {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n padding: 9px 14px;\n border: 1px solid var(--nw-border);\n border-radius: 10px;\n background: var(--nw-bg);\n color: var(--nw-text);\n cursor: pointer;\n}\n\n.nw-button-primary {\n background: var(--nw-accent);\n border-color: var(--nw-accent);\n color: #ffffff;\n font-weight: 600;\n}\n\n.nw-button-primary:disabled {\n opacity: 0.6;\n cursor: default;\n}\n\n.nw-list {\n list-style: none;\n margin: 0;\n padding: 8px 16px 4px;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.nw-task {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 10px 12px;\n border: 1px solid var(--nw-border);\n border-radius: 12px;\n background: var(--nw-bg);\n}\n\n.nw-task-title {\n flex: 1;\n min-width: 0;\n}\n\n.nw-task-done {\n opacity: 0.55;\n}\n\n.nw-task-done .nw-task-title {\n text-decoration: line-through;\n}\n\n.nw-check {\n width: 22px;\n height: 22px;\n border: 1.5px solid var(--nw-border);\n border-radius: 999px;\n background: transparent;\n color: #ffffff;\n cursor: pointer;\n flex: none;\n}\n\n.nw-check-on {\n background: var(--nw-accent);\n border-color: var(--nw-accent);\n}\n\n.nw-priority {\n padding: 5px 8px;\n border: 1px solid var(--nw-border);\n border-radius: 8px;\n background: var(--nw-bg);\n color: var(--nw-text);\n font-size: 12px;\n font-weight: 600;\n}\n\n.nw-priority-high {\n color: var(--nw-high);\n}\n\n.nw-priority-medium {\n color: var(--nw-medium);\n}\n\n.nw-priority-low {\n color: var(--nw-low);\n}\n\n.nw-note {\n margin: 0;\n padding: 8px 16px 16px;\n font-size: 12px;\n color: var(--nw-muted);\n}\n" },
47
47
  { relPath: "examples/acme-tasks/test/server.test.ts", content: "import { describe, expect, it } from 'vitest';\nimport app from '../src/server.js';\n\ndescribe('acme-tasks example', () => {\n it('exports a Noodle server definition', () => {\n expect(typeof app.toManifest).toBe('function');\n });\n\n it('exposes a tool for each of the top-3 prioritized flows', async () => {\n // Capture → add_task, Prioritize → list_today (+ set_priority helper), Complete → complete_task.\n const text = JSON.stringify(await app.toManifest());\n expect(text).toContain('add_task');\n expect(text).toContain('list_today');\n expect(text).toContain('complete_task');\n expect(text).toContain('set_priority');\n });\n\n it('seeds today’s list highest-priority first', async () => {\n const text = JSON.stringify(await app.toManifest());\n expect(text).toMatch(/\"tasks\":\\[\\{\"id\":\"email_vendor\".*\"priority\":\"high\"/);\n });\n});\n" },
48
48
  { relPath: "examples/acme-tasks/vitest.config.ts", content: "import { defineConfig } from 'vitest/config';\n\n// Local config so `npm test` (vitest run) discovers this example's own tests instead of inheriting a\n// parent monorepo config's include globs.\nexport default defineConfig({\n test: { include: ['test/**/*.test.ts'] },\n});\n" },
49
- { relPath: "examples/food-ordering/README.md", content: "# Food Ordering\n\n**Owns:** The flagship consumer ordering MCP App example: React view authoring, app-only helper tools,\ncaller-scoped cart state handles, packaged image assets, checkout handoff policy, host actions,\nCSP/permissions metadata, and widget preview coverage.\n\nFood Ordering is a generic, synthetic version of a live marketplace ordering app. It lets a user search\nstores, browse menus, customize an item, build a multi-line cart, review the order, and hand off checkout to\nan allowlisted example domain. It does not use real restaurant APIs, real checkout, customer credentials, or\nprivate customer data.\n\n## What It Shows\n\n| Capability | Example |\n| :--- | :--- |\n| Public entry tool | `open_ordering` returns structured fallback content and renders the React widget |\n| App-only helper tools | `search_stores`, `load_menu`, `load_item`, `read_cart`, `sync_cart`, `prepare_checkout` |\n| Durable cart state | `server(..., { state: { handles: { cart } }, use: { state } })` with caller scope and revision checks |\n| React app runtime kit | `@noodleseed/one/react` supplies app flow, shell/nav/view, async state, form, quantity, choice, and handoff primitives |\n| Multi-step widget flow | One React shell navigates stores, menu, item customization, cart, review, and handoff views through `useAppFlow` |\n| Handoff | `handoff.allowedDomains` allows only `https://orders.example.com` checkout URLs |\n| Progressive enhancement | Non-Apps hosts still receive stores, featured items, and a readable fallback summary |\n\n## Local Author Loop\n\n```sh\nnoodle validate\nnoodle test\nnoodle dev\n```\n\nIn another terminal:\n\n```sh\nnoodle tools list\nnoodle tools call open_ordering --args '{\"customer\":\"Asha\",\"query\":\"noodles\"}'\nnoodle tools call summarize_ordering_options --args '{}'\n```\n\nFor Apps metadata conformance, start `noodle dev`, copy the loopback MCP endpoint, then run:\n\n```sh\nnpx @mcpjam/cli@latest apps conformance --url http://127.0.0.1:<port>/o/demo/food-ordering/mcp --quiet --format json\n```\n\n## Client Setup\n\nUse the CLI to print the exact setup flow for your MCP client:\n\n```sh\nnoodle connect claude\nnoodle connect chatgpt\nnoodle connect inspector\n```\n\n## Deploy\n\n```sh\nnoodle link --org demo --app food-ordering\nnoodle deploy --access owner-only\nnoodle open\n```\n\nUse `--access org-members` for an org-wide internal demo. This example has no connector secrets and does not\ninclude tokens, caller-key mechanisms, or `.env.noodle` values.\n\n## Demo Assets\n\nThe packaged demo images live under `assets/` and are public web assets when deployed. The current app uses\n`assets/noodle-bowl.jpg` as the server branding image.\n\nImage sources:\n\n- `assets/noodle-bowl.jpg` — Unsplash photo\n [`IRv8V9Hb8gI`](https://unsplash.com/photos/IRv8V9Hb8gI), downloaded from Unsplash.\n- `assets/lentil-soup.jpg` — Unsplash image\n [`photo-1510431198580-7727c9fa1e3a`](https://images.unsplash.com/photo-1510431198580-7727c9fa1e3a), downloaded from Unsplash.\n- `assets/mint-lemonade.jpg` — Unsplash photo\n [`X7Nx327NtuA`](https://unsplash.com/photos/X7Nx327NtuA) by Imad 786.\n\nUnsplash photos are free to use under the [Unsplash License](https://unsplash.com/license); attribution is\nnot required, but source notes are kept here for provenance.\n" },
49
+ { relPath: "examples/food-ordering/README.md", content: "# Food Ordering\n\n**Owns:** The flagship consumer ordering MCP App example: React view authoring, app-only helper tools,\ncaller-scoped cart state handles, packaged image assets, checkout handoff policy, host actions,\nCSP/permissions metadata, and widget preview coverage.\n\nFood Ordering is a generic, synthetic version of a live marketplace ordering app. It lets a user search\nstores, browse menus, customize an item, build a multi-line cart, review the order, and hand off checkout to\nan allowlisted example domain. It does not use real restaurant APIs, real checkout, customer credentials, or\nprivate customer data.\n\n## What It Shows\n\n| Capability | Example |\n| :--- | :--- |\n| Public entry tool | `open_ordering` returns structured fallback content and renders the React widget |\n| App-only helper tools | `search_stores`, `load_menu`, `load_item`, `read_cart`, `sync_cart`, `prepare_checkout` |\n| Durable cart state | `server(..., { state: { handles: { cart } }, use: { state } })` with caller scope and revision checks |\n| React app runtime kit | `@noodleseed/one/react` supplies app flow, shell/nav/view, async state, form, quantity, choice, and handoff primitives |\n| Multi-step widget flow | One React shell navigates stores, menu, item customization, cart, review, and handoff views through `useAppFlow` |\n| Handoff | `handoff.allowedDomains` allows only `https://orders.example.com` checkout URLs |\n| Progressive enhancement | Non-Apps hosts still receive stores, featured items, and a readable fallback summary |\n\nThe example is intentionally richer than the generated starter, but each inline view still follows the\nsame default: one immediate purpose, one primary action, at most one subordinate action, and progressive\ndisclosure for the rest. Preview it at 280px before adding navigation or local CSS; loading, empty, stale,\nerror/retry, and success states must remain readable without nested vertical scrolling.\n\nLike the comprehensive default `noodle init my-app` scaffold, this flagship keeps the server feature-rich\nwhile making each individual widget view focused; server capability breadth and screen density are separate.\n\n## Local Author Loop\n\n```sh\nnoodle validate\nnoodle test\nnoodle dev\n```\n\nIn another terminal:\n\n```sh\nnoodle tools list\nnoodle tools call open_ordering --args '{\"customer\":\"Asha\",\"query\":\"noodles\"}'\nnoodle tools call summarize_ordering_options --args '{}'\n```\n\nFor Apps metadata conformance, start `noodle dev`, copy the loopback MCP endpoint, then run:\n\n```sh\nnpx @mcpjam/cli@latest apps conformance --url http://127.0.0.1:<port>/o/demo/food-ordering/mcp --quiet --format json\n```\n\n## Client Setup\n\nUse the CLI to print the exact setup flow for your MCP client:\n\n```sh\nnoodle connect claude\nnoodle connect chatgpt\nnoodle connect inspector\n```\n\n## Deploy\n\n```sh\nnoodle link --org demo --app food-ordering\nnoodle deploy --access owner-only\nnoodle open\n```\n\nUse `--access org-members` for an org-wide internal demo. This example has no connector secrets and does not\ninclude tokens, caller-key mechanisms, or `.env.noodle` values.\n\n## Demo Assets\n\nThe packaged demo images live under `assets/` and are public web assets when deployed. The current app uses\n`assets/noodle-bowl.jpg` as the server branding image.\n\nImage sources:\n\n- `assets/noodle-bowl.jpg` — Unsplash photo\n [`IRv8V9Hb8gI`](https://unsplash.com/photos/IRv8V9Hb8gI), downloaded from Unsplash.\n- `assets/lentil-soup.jpg` — Unsplash image\n [`photo-1510431198580-7727c9fa1e3a`](https://images.unsplash.com/photo-1510431198580-7727c9fa1e3a), downloaded from Unsplash.\n- `assets/mint-lemonade.jpg` — Unsplash photo\n [`X7Nx327NtuA`](https://unsplash.com/photos/X7Nx327NtuA) by Imad 786.\n\nUnsplash photos are free to use under the [Unsplash License](https://unsplash.com/license); attribution is\nnot required, but source notes are kept here for provenance.\n" },
50
50
  { relPath: "examples/food-ordering/noodle.json", content: "{\n \"entrypoint\": \"src/server.ts\",\n \"name\": \"food-ordering\",\n \"template\": \"widget\"\n}\n" },
51
51
  { relPath: "examples/food-ordering/package.json", content: "{\n \"name\": \"food-ordering\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"test\": \"vitest run test/server.test.ts\",\n \"validate\": \"noodle validate\",\n \"dev\": \"noodle dev\",\n \"deploy\": \"noodle deploy\"\n },\n \"devDependencies\": {\n \"@vitejs/plugin-react\": \"latest\",\n \"@noodleseed/one\": \"latest\",\n \"@types/react\": \"latest\",\n \"@types/react-dom\": \"latest\",\n \"react\": \"latest\",\n \"react-dom\": \"latest\",\n \"vite\": \"latest\",\n \"vitest\": \"latest\"\n }\n}\n" },
52
52
  { relPath: "examples/food-ordering/src/helpers.ts", content: "import type { ServerDefinition } from '@noodleseed/one';\n\nexport {\n ActionBar,\n AppShell,\n AsyncBoundary,\n ChoiceGroup,\n createViewStore,\n DataCard,\n DataList,\n Field,\n HandoffButton,\n QuantityStepper,\n ShellNav,\n StatusBadge,\n SubmitButton,\n View,\n ViewStack,\n} from '@noodleseed/one/react';\n\nimport { generateHelpers } from '@noodleseed/one/react';\n\nexport type AppType = ServerDefinition;\n\nexport const {\n useCallTool,\n useAppFlow,\n useHandoff,\n useLayout,\n useOpenExternal,\n useSendFollowUpMessage,\n useToolInfo,\n useViewState,\n} = generateHelpers<AppType>();\n" },
53
- { relPath: "examples/food-ordering/src/server.ts", content: "import { annotations, asset, connector, resource, server, tool, z } from '@noodleseed/one';\n\nconst heroImage = asset('assets/noodle-bowl.jpg');\n\nconst state = connector('noodle_state')\n .version('1.0.0')\n .operation('read_state', {\n type: 'read',\n input: z.object({\n handle: z.string(),\n key: z.string().optional(),\n }),\n output: z.object({\n value: z.record(z.string(), z.unknown()),\n revision: z.number().int(),\n status: z.string(),\n }),\n })\n .operation('patch_state', {\n type: 'action',\n input: z.object({\n handle: z.string(),\n expectedRevision: z.number().int(),\n value: z.record(z.string(), z.unknown()),\n }),\n output: z.object({\n value: z.record(z.string(), z.unknown()),\n revision: z.number().int(),\n status: z.string(),\n }),\n });\n\nconst stores = [\n {\n id: 'harbor-noodles',\n name: 'Harbor Noodles',\n cuisine: 'Noodles',\n address: '18 Pier Lane',\n open: true,\n etaMinutes: 24,\n rating: 4.8,\n },\n {\n id: 'garden-wraps',\n name: 'Garden Wraps',\n cuisine: 'Vegetarian',\n address: '44 Market Street',\n open: true,\n etaMinutes: 18,\n rating: 4.6,\n },\n {\n id: 'midnight-tacos',\n name: 'Midnight Tacos',\n cuisine: 'Mexican',\n address: '7 Station Road',\n open: false,\n etaMinutes: 35,\n rating: 4.7,\n },\n] as const;\n\nconst menu = [\n {\n id: 'spicy_miso',\n storeId: 'harbor-noodles',\n category: 'Bowls',\n name: 'Spicy Miso Bowl',\n price: 16,\n description: 'Miso broth, wheat noodles, chili crisp, egg, and greens.',\n modifiers: ['extra_noodles', 'soft_egg', 'chili_crisp'],\n },\n {\n id: 'ginger_tofu',\n storeId: 'harbor-noodles',\n category: 'Bowls',\n name: 'Ginger Tofu Bowl',\n price: 15,\n description: 'Tofu, ginger broth, mushrooms, and scallions.',\n modifiers: ['extra_tofu', 'brown_rice', 'no_mushroom'],\n },\n {\n id: 'green_falafel',\n storeId: 'garden-wraps',\n category: 'Wraps',\n name: 'Green Falafel Wrap',\n price: 13,\n description: 'Falafel, herbs, pickles, tahini, and crisp vegetables.',\n modifiers: ['extra_tahini', 'add_fries', 'gluten_free_wrap'],\n },\n {\n id: 'sweet_potato',\n storeId: 'garden-wraps',\n category: 'Plates',\n name: 'Sweet Potato Plate',\n price: 14,\n description: 'Roasted sweet potato, grains, greens, and lemon yogurt.',\n modifiers: ['vegan_yogurt', 'extra_greens', 'hot_sauce'],\n },\n] as const;\n\nconst cartLine = z.object({\n itemId: z.string(),\n quantity: z.number().int().min(1),\n modifiers: z.array(z.string()).default([]),\n note: z.string().optional(),\n});\n\nconst cartInput = z.object({\n selectedStoreId: z.string().optional(),\n lines: z.array(cartLine).default([]),\n customer: z.string().default('Guest'),\n notes: z.string().optional(),\n subtotal: z.number().default(0),\n expectedRevision: z.number().int().min(0).default(0),\n});\n\nconst storeShape = z.object({\n id: z.string(),\n name: z.string(),\n cuisine: z.string(),\n address: z.string(),\n open: z.boolean(),\n etaMinutes: z.number(),\n rating: z.number(),\n});\n\nconst menuItemShape = z.object({\n id: z.string(),\n storeId: z.string(),\n category: z.string(),\n name: z.string(),\n price: z.number(),\n description: z.string(),\n modifiers: z.array(z.string()),\n});\n\nconst cartOutput = z.object({\n selectedStoreId: z.string().optional(),\n lines: z.array(cartLine),\n customer: z.string(),\n notes: z.string().optional(),\n subtotal: z.number(),\n status: z.enum(['draft', 'review', 'handoff']),\n checkoutUrl: z.string().optional(),\n});\n\nconst cartStateSchema = z.object({\n selectedStoreId: z.string().optional(),\n lines: z.array(cartLine),\n customer: z.string(),\n notes: z.string().optional(),\n subtotal: z.number(),\n status: z.enum(['draft', 'review', 'handoff']),\n checkoutUrl: z.string().optional(),\n});\n\ntype CartLine = {\n readonly itemId: string;\n readonly quantity: number;\n readonly modifiers: readonly string[];\n readonly note?: string;\n};\n\ntype CartInput = {\n readonly selectedStoreId?: string;\n readonly lines: readonly CartLine[];\n readonly customer: string;\n readonly notes?: string;\n readonly subtotal: number;\n readonly expectedRevision: number;\n};\n\nconst readOnly = annotations.readOnly();\nconst action = annotations.openAction({ destructive: false });\n\nfunction checkoutUrl(customer: string): string {\n return `https://orders.example.com/checkout?customer=${encodeURIComponent(customer)}`;\n}\n\nfunction cartValue(input: CartInput, status: 'draft' | 'review' | 'handoff') {\n return {\n selectedStoreId: input.selectedStoreId,\n lines: input.lines,\n customer: input.customer,\n notes: input.notes,\n subtotal: input.subtotal,\n status,\n ...(status === 'handoff' ? { checkoutUrl: 'https://orders.example.com/checkout' } : {}),\n };\n}\n\nexport default server(\n 'food_ordering',\n {\n title: 'Food Ordering',\n version: '1.0.0',\n use: { state },\n state: {\n handles: {\n cart: {\n kind: 'cart',\n version: 'v1',\n scope: 'caller',\n ttlSeconds: 7200,\n schema: cartStateSchema,\n },\n },\n },\n branding: {\n name: 'Food Ordering',\n accent: '#0F8F5F',\n surface: '#F7F7F5',\n surfaceDark: '#111820',\n logo: {\n uri: heroImage,\n alt: 'Food Ordering noodle bowl',\n },\n radius: 'lg',\n density: 'comfortable',\n },\n handoff: {\n allowedDomains: ['https://orders.example.com'],\n },\n },\n [\n tool('open_ordering', {\n description:\n 'Open a complete food-ordering widget with store discovery, menu browsing, cart review, and checkout handoff.',\n annotations: readOnly,\n input: z.object({\n query: z.string().optional(),\n customer: z.string().default('Guest'),\n }),\n output: z.object({\n status: z.string(),\n customer: z.string(),\n stores: z.array(storeShape),\n featuredItems: z.array(menuItemShape),\n fallback: z.string(),\n }),\n fulfil: ({ input }) => ({\n status: 'Ready to build a food order.',\n customer: input.customer,\n stores,\n featuredItems: menu,\n fallback: 'Open stores: Harbor Noodles (Noodles), Garden Wraps (Vegetarian).',\n }),\n viewTitle: 'Food ordering',\n domain: 'https://orders.example.com',\n view: {\n component: 'ordering-flow',\n entry: './views/ordering-flow.tsx',\n },\n viewDescription:\n 'A complete consumer ordering surface with app-only helper tools, cart state, and checkout handoff.',\n csp: {\n connectDomains: ['https://orders.example.com'],\n resourceDomains: ['https://orders.example.com'],\n frameDomains: ['https://orders.example.com'],\n },\n permissions: { clipboardWrite: {} },\n }),\n tool('search_stores', {\n visibility: ['app'],\n description: 'Filter synthetic restaurants for the ordering widget.',\n annotations: readOnly,\n input: z.object({\n query: z.string().optional(),\n openOnly: z.boolean().default(false),\n }),\n output: z.object({ stores: z.array(storeShape) }),\n fulfil: () => ({ stores }),\n }),\n tool('load_menu', {\n visibility: ['app'],\n description: 'Load synthetic menu categories and items for one store.',\n annotations: readOnly,\n input: z.object({ storeId: z.string() }),\n output: z.object({\n storeId: z.string(),\n stores: z.array(storeShape),\n items: z.array(menuItemShape),\n }),\n fulfil: ({ input }) => ({ storeId: input.storeId, stores, items: menu }),\n }),\n tool('load_item', {\n visibility: ['app'],\n description: 'Load item details and modifier options for the ordering widget.',\n annotations: readOnly,\n input: z.object({ itemId: z.string() }),\n output: z.object({ itemId: z.string(), items: z.array(menuItemShape) }),\n fulfil: ({ input }) => ({ itemId: input.itemId, items: menu }),\n }),\n tool('read_cart', {\n visibility: ['app'],\n description: 'Read the caller-scoped ordering cart state.',\n annotations: readOnly,\n input: z.object({}),\n output: z.object({\n value: z.unknown(),\n revision: z.number(),\n status: z.string(),\n }),\n fulfil: ({ connectors }) => {\n const state = connectors.state.readState({ handle: 'cart' });\n return { value: state.value, revision: state.revision, status: state.status };\n },\n }),\n tool('sync_cart', {\n visibility: ['app'],\n description: 'Patch the caller-scoped ordering cart with the widget cart mirror.',\n annotations: action,\n input: cartInput,\n output: z.object({\n cart: cartOutput,\n revision: z.number(),\n status: z.string(),\n }),\n fulfil: ({ input, connectors }) => {\n const cart = cartValue(input, 'draft');\n const state = connectors.state.patchState({\n handle: 'cart',\n expectedRevision: input.expectedRevision,\n value: cart,\n });\n return { cart, revision: state.revision, status: state.status };\n },\n }),\n tool('prepare_checkout', {\n visibility: ['app'],\n description: 'Prepare the caller-scoped cart for checkout handoff.',\n annotations: action,\n input: cartInput,\n output: z.object({\n cart: cartOutput,\n revision: z.number(),\n checkoutUrl: z.string(),\n }),\n fulfil: ({ input, connectors }) => {\n const cart = cartValue(input, 'handoff');\n const state = connectors.state.patchState({\n handle: 'cart',\n expectedRevision: input.expectedRevision,\n value: cart,\n });\n return {\n cart,\n revision: state.revision,\n checkoutUrl: cart.checkoutUrl ?? checkoutUrl(input.customer),\n };\n },\n }),\n tool('summarize_ordering_options', {\n description: 'Summarize available stores and menu examples without opening the widget.',\n annotations: readOnly,\n input: z.object({}),\n output: z.object({\n stores: z.array(storeShape),\n featuredItems: z.array(menuItemShape),\n }),\n fulfil: () => ({ stores, featuredItems: menu }),\n }),\n tool('show_capabilities', {\n description: 'Return a concise summary for the standalone widget capability preview.',\n annotations: readOnly,\n input: z.object({}),\n output: z.object({ status: z.string(), note: z.string() }),\n fulfil: () => ({\n status: 'Food Ordering widget capabilities are ready.',\n note: 'Standalone preview covers React views, helper tools, cart state, handoff, CSP, and permissions.',\n }),\n viewName: 'capabilities_card',\n viewTitle: 'Food Ordering capabilities',\n viewDescription: 'Standalone widget resource for previewing the ordering capability surface.',\n domain: 'https://orders.example.com',\n view: { component: 'capabilities-card', entry: './views/capabilities-card.tsx' },\n csp: {\n connectDomains: ['https://orders.example.com'],\n resourceDomains: ['https://orders.example.com'],\n frameDomains: ['https://orders.example.com'],\n },\n permissions: { clipboardWrite: {} },\n }),\n resource('food_ordering_guide', {\n uri: 'docs://food-ordering',\n title: 'Food Ordering widget guide',\n description: 'Synthetic guide resource for the consumer ordering flagship.',\n mimeType: 'text/markdown',\n // Return the resource body directly; the runtime maps it into MCP `contents` using the\n // resource's own uri + mimeType. Do not return a `{ contents: [...] }` wrapper — that double-wraps.\n fulfil: () =>\n [\n '# Food Ordering Widget Guide',\n '',\n '- Demonstrates a multi-step ordering widget, app-only helper tools, typed cart state, and handoff.',\n '- Store, menu, and checkout data are synthetic and contain no customer credentials.',\n '- Checkout opens an allowlisted example URL; payment and final ordering remain out of scope.',\n ].join('\\n'),\n }),\n ],\n);\n" },
53
+ { relPath: "examples/food-ordering/src/server.ts", content: "import { annotations, asset, connector, resource, server, tool, z } from '@noodleseed/one';\n\nconst heroImage = asset('assets/noodle-bowl.jpg');\n\nconst state = connector('noodle_state')\n .version('1.0.0')\n .operation('read_state', {\n type: 'read',\n input: z.object({\n handle: z.string(),\n key: z.string().optional(),\n }),\n output: z.object({\n value: z.record(z.string(), z.unknown()),\n revision: z.number().int(),\n status: z.string(),\n }),\n })\n .operation('patch_state', {\n type: 'action',\n input: z.object({\n handle: z.string(),\n expectedRevision: z.number().int(),\n value: z.record(z.string(), z.unknown()),\n }),\n output: z.object({\n value: z.record(z.string(), z.unknown()),\n revision: z.number().int(),\n status: z.string(),\n }),\n });\n\nconst stores = [\n {\n id: 'harbor-noodles',\n name: 'Harbor Noodles',\n cuisine: 'Noodles',\n address: '18 Pier Lane',\n open: true,\n etaMinutes: 24,\n rating: 4.8,\n },\n {\n id: 'garden-wraps',\n name: 'Garden Wraps',\n cuisine: 'Vegetarian',\n address: '44 Market Street',\n open: true,\n etaMinutes: 18,\n rating: 4.6,\n },\n {\n id: 'midnight-tacos',\n name: 'Midnight Tacos',\n cuisine: 'Mexican',\n address: '7 Station Road',\n open: false,\n etaMinutes: 35,\n rating: 4.7,\n },\n] as const;\n\nconst menu = [\n {\n id: 'spicy_miso',\n storeId: 'harbor-noodles',\n category: 'Bowls',\n name: 'Spicy Miso Bowl',\n price: 16,\n description: 'Miso broth, wheat noodles, chili crisp, egg, and greens.',\n modifiers: ['extra_noodles', 'soft_egg', 'chili_crisp'],\n },\n {\n id: 'ginger_tofu',\n storeId: 'harbor-noodles',\n category: 'Bowls',\n name: 'Ginger Tofu Bowl',\n price: 15,\n description: 'Tofu, ginger broth, mushrooms, and scallions.',\n modifiers: ['extra_tofu', 'brown_rice', 'no_mushroom'],\n },\n {\n id: 'green_falafel',\n storeId: 'garden-wraps',\n category: 'Wraps',\n name: 'Green Falafel Wrap',\n price: 13,\n description: 'Falafel, herbs, pickles, tahini, and crisp vegetables.',\n modifiers: ['extra_tahini', 'add_fries', 'gluten_free_wrap'],\n },\n {\n id: 'sweet_potato',\n storeId: 'garden-wraps',\n category: 'Plates',\n name: 'Sweet Potato Plate',\n price: 14,\n description: 'Roasted sweet potato, grains, greens, and lemon yogurt.',\n modifiers: ['vegan_yogurt', 'extra_greens', 'hot_sauce'],\n },\n] as const;\n\nconst cartLine = z.object({\n itemId: z.string(),\n quantity: z.number().int().min(1),\n modifiers: z.array(z.string()).default([]),\n note: z.string().optional(),\n});\n\nconst cartInput = z.object({\n selectedStoreId: z.string().optional(),\n lines: z.array(cartLine).default([]),\n customer: z.string().default('Guest'),\n notes: z.string().optional(),\n subtotal: z.number().default(0),\n expectedRevision: z.number().int().min(0).default(0),\n});\n\nconst storeShape = z.object({\n id: z.string(),\n name: z.string(),\n cuisine: z.string(),\n address: z.string(),\n open: z.boolean(),\n etaMinutes: z.number(),\n rating: z.number(),\n});\n\nconst menuItemShape = z.object({\n id: z.string(),\n storeId: z.string(),\n category: z.string(),\n name: z.string(),\n price: z.number(),\n description: z.string(),\n modifiers: z.array(z.string()),\n});\n\nconst cartOutput = z.object({\n selectedStoreId: z.string().optional(),\n lines: z.array(cartLine),\n customer: z.string(),\n notes: z.string().optional(),\n subtotal: z.number(),\n status: z.enum(['draft', 'review', 'handoff']),\n checkoutUrl: z.string().optional(),\n});\n\nconst cartStateSchema = z.object({\n selectedStoreId: z.string().optional(),\n lines: z.array(cartLine),\n customer: z.string(),\n notes: z.string().optional(),\n subtotal: z.number(),\n // `.default()`/`.optional()` state fields are optional on write: a cart save that omits\n // `status` still validates, and a fresh cart starts in `draft`.\n status: z.enum(['draft', 'review', 'handoff']).default('draft'),\n checkoutUrl: z.string().optional(),\n});\n\ntype CartLine = {\n readonly itemId: string;\n readonly quantity: number;\n readonly modifiers: readonly string[];\n readonly note?: string;\n};\n\ntype CartInput = {\n readonly selectedStoreId?: string;\n readonly lines: readonly CartLine[];\n readonly customer: string;\n readonly notes?: string;\n readonly subtotal: number;\n readonly expectedRevision: number;\n};\n\nconst readOnly = annotations.readOnly();\nconst action = annotations.openAction({ destructive: false });\n\nfunction checkoutUrl(customer: string): string {\n return `https://orders.example.com/checkout?customer=${encodeURIComponent(customer)}`;\n}\n\nfunction cartValue(input: CartInput, status: 'draft' | 'review' | 'handoff') {\n return {\n selectedStoreId: input.selectedStoreId,\n lines: input.lines,\n customer: input.customer,\n notes: input.notes,\n subtotal: input.subtotal,\n status,\n ...(status === 'handoff' ? { checkoutUrl: 'https://orders.example.com/checkout' } : {}),\n };\n}\n\nexport default server(\n 'food_ordering',\n {\n title: 'Food Ordering',\n version: '1.0.0',\n use: { state },\n state: {\n handles: {\n cart: {\n kind: 'cart',\n version: 'v1',\n scope: 'caller',\n ttlSeconds: 7200,\n schema: cartStateSchema,\n },\n },\n },\n branding: {\n name: 'Food Ordering',\n accent: '#0F8F5F',\n surface: '#F7F7F5',\n surfaceDark: '#111820',\n logo: {\n uri: heroImage,\n alt: 'Food Ordering noodle bowl',\n },\n radius: 'lg',\n density: 'comfortable',\n },\n handoff: {\n allowedDomains: ['https://orders.example.com'],\n },\n },\n [\n tool('open_ordering', {\n description:\n 'Open a complete food-ordering widget with store discovery, menu browsing, cart review, and checkout handoff.',\n annotations: readOnly,\n input: z.object({\n query: z.string().optional(),\n customer: z.string().default('Guest'),\n }),\n output: z.object({\n status: z.string(),\n customer: z.string(),\n stores: z.array(storeShape),\n featuredItems: z.array(menuItemShape),\n fallback: z.string(),\n }),\n fulfil: ({ input }) => ({\n status: 'Ready to build a food order.',\n customer: input.customer,\n stores,\n featuredItems: menu,\n fallback: 'Open stores: Harbor Noodles (Noodles), Garden Wraps (Vegetarian).',\n }),\n viewTitle: 'Food ordering',\n domain: 'https://orders.example.com',\n view: {\n component: 'ordering-flow',\n entry: './views/ordering-flow.tsx',\n },\n viewDescription:\n 'A complete consumer ordering surface with app-only helper tools, cart state, and checkout handoff.',\n csp: {\n connectDomains: ['https://orders.example.com'],\n resourceDomains: ['https://orders.example.com'],\n frameDomains: ['https://orders.example.com'],\n },\n permissions: { clipboardWrite: {} },\n }),\n tool('search_stores', {\n visibility: ['app'],\n description: 'Filter synthetic restaurants for the ordering widget.',\n annotations: readOnly,\n input: z.object({\n query: z.string().optional(),\n openOnly: z.boolean().default(false),\n }),\n output: z.object({ stores: z.array(storeShape) }),\n fulfil: () => ({ stores }),\n }),\n tool('load_menu', {\n visibility: ['app'],\n description: 'Load synthetic menu categories and items for one store.',\n annotations: readOnly,\n input: z.object({ storeId: z.string() }),\n output: z.object({\n storeId: z.string(),\n stores: z.array(storeShape),\n items: z.array(menuItemShape),\n }),\n fulfil: ({ input }) => ({ storeId: input.storeId, stores, items: menu }),\n }),\n tool('load_item', {\n visibility: ['app'],\n description: 'Load item details and modifier options for the ordering widget.',\n annotations: readOnly,\n input: z.object({ itemId: z.string() }),\n output: z.object({ itemId: z.string(), items: z.array(menuItemShape) }),\n fulfil: ({ input }) => ({ itemId: input.itemId, items: menu }),\n }),\n tool('read_cart', {\n visibility: ['app'],\n description: 'Read the caller-scoped ordering cart state.',\n annotations: readOnly,\n input: z.object({}),\n output: z.object({\n value: z.unknown(),\n revision: z.number(),\n status: z.string(),\n }),\n fulfil: ({ connectors }) => {\n const state = connectors.state.readState({ handle: 'cart' });\n return { value: state.value, revision: state.revision, status: state.status };\n },\n }),\n tool('sync_cart', {\n visibility: ['app'],\n description: 'Patch the caller-scoped ordering cart with the widget cart mirror.',\n annotations: action,\n input: cartInput,\n output: z.object({\n cart: cartOutput,\n revision: z.number(),\n status: z.string(),\n }),\n fulfil: ({ input, connectors }) => {\n const cart = cartValue(input, 'draft');\n const state = connectors.state.patchState({\n handle: 'cart',\n expectedRevision: input.expectedRevision,\n value: cart,\n });\n return { cart, revision: state.revision, status: state.status };\n },\n }),\n tool('prepare_checkout', {\n visibility: ['app'],\n description: 'Prepare the caller-scoped cart for checkout handoff.',\n annotations: action,\n input: cartInput,\n output: z.object({\n cart: cartOutput,\n revision: z.number(),\n checkoutUrl: z.string(),\n }),\n fulfil: ({ input, connectors }) => {\n const cart = cartValue(input, 'handoff');\n const state = connectors.state.patchState({\n handle: 'cart',\n expectedRevision: input.expectedRevision,\n value: cart,\n });\n return {\n cart,\n revision: state.revision,\n checkoutUrl: cart.checkoutUrl ?? checkoutUrl(input.customer),\n };\n },\n }),\n tool('summarize_ordering_options', {\n description: 'Summarize available stores and menu examples without opening the widget.',\n annotations: readOnly,\n input: z.object({}),\n output: z.object({\n stores: z.array(storeShape),\n featuredItems: z.array(menuItemShape),\n }),\n fulfil: () => ({ stores, featuredItems: menu }),\n }),\n tool('show_capabilities', {\n description: 'Return a concise summary for the standalone widget capability preview.',\n annotations: readOnly,\n input: z.object({}),\n output: z.object({ status: z.string(), note: z.string() }),\n fulfil: () => ({\n status: 'Food Ordering widget capabilities are ready.',\n note: 'Standalone preview covers React views, helper tools, cart state, handoff, CSP, and permissions.',\n }),\n viewName: 'capabilities_card',\n viewTitle: 'Food Ordering capabilities',\n viewDescription: 'Standalone widget resource for previewing the ordering capability surface.',\n domain: 'https://orders.example.com',\n view: { component: 'capabilities-card', entry: './views/capabilities-card.tsx' },\n csp: {\n connectDomains: ['https://orders.example.com'],\n resourceDomains: ['https://orders.example.com'],\n frameDomains: ['https://orders.example.com'],\n },\n permissions: { clipboardWrite: {} },\n }),\n resource('food_ordering_guide', {\n uri: 'docs://food-ordering',\n title: 'Food Ordering widget guide',\n description: 'Synthetic guide resource for the consumer ordering flagship.',\n mimeType: 'text/markdown',\n // Return the resource body directly; the runtime maps it into MCP `contents` using the\n // resource's own uri + mimeType. Do not return a `{ contents: [...] }` wrapper — that double-wraps.\n fulfil: () =>\n [\n '# Food Ordering Widget Guide',\n '',\n '- Demonstrates a multi-step ordering widget, app-only helper tools, typed cart state, and handoff.',\n '- Store, menu, and checkout data are synthetic and contain no customer credentials.',\n '- Checkout opens an allowlisted example URL; payment and final ordering remain out of scope.',\n ].join('\\n'),\n }),\n ],\n);\n" },
54
54
  { relPath: "examples/food-ordering/src/views/capabilities-card.tsx", content: "import { useLayout, useOpenExternal, useSendFollowUpMessage, useToolInfo } from '../helpers.js';\nimport './widget-style.css';\n\nconst capabilities: readonly {\n readonly name: string;\n readonly description: string;\n}[] = [\n {\n name: 'React view resource',\n description: 'Compiled widget HTML with a hydrated React entrypoint.',\n },\n {\n name: 'Widget helper calls',\n description: 'App-only tools route through the same host-mediated path.',\n },\n {\n name: 'Durable cart state',\n description: 'Caller-scoped cart records use Noodle state handles with revisions.',\n },\n {\n name: 'External handoff',\n description: 'Checkout opens through declared allowlisted domains.',\n },\n {\n name: 'Model context',\n description: 'Relevant UI state is mirrored through data-llm.',\n },\n {\n name: 'CSP and permissions',\n description: 'Resource metadata declares network and clipboard needs.',\n },\n] as const;\n\nexport default function CapabilitiesCard() {\n const { theme } = useLayout();\n const toolInfo = useToolInfo('show_capabilities');\n const openExternal = useOpenExternal();\n const sendFollowUpMessage = useSendFollowUpMessage();\n const structured = toolInfo.structuredContent as\n | { readonly status?: string; readonly note?: string }\n | undefined;\n\n return (\n <main\n className={`nw-shell${theme === 'dark' ? ' dark' : ''}`}\n data-llm={`Food Ordering capabilities: ${capabilities.map((item) => item.name).join(', ')}`}\n >\n <section className=\"nw-card\">\n <header className=\"nw-header\">\n <span className=\"nw-icon\" aria-hidden=\"true\">\n <PuzzleIcon />\n </span>\n <div className=\"nw-title-block\">\n <h1 className=\"nw-title\">MCP capabilities</h1>\n <p className=\"nw-subtitle\">\n {structured?.status ?? 'Food Ordering widget capabilities are ready.'}\n </p>\n </div>\n <span className=\"nw-chip\">Connected</span>\n </header>\n <div className=\"nw-body\">\n <p className=\"nw-section-title\">Available features</p>\n <ul className=\"nw-feature-list\">\n {capabilities.map((capability) => (\n <li className=\"nw-feature\" key={capability.name}>\n <span className=\"nw-check\" aria-hidden=\"true\">\n <CheckIcon />\n </span>\n <span>\n <span className=\"nw-feature-name\">{capability.name}</span>\n <span className=\"nw-feature-desc\">{capability.description}</span>\n </span>\n </li>\n ))}\n </ul>\n <div className=\"nw-actions\">\n <button\n className=\"nw-button nw-button-primary\"\n type=\"button\"\n onClick={() =>\n sendFollowUpMessage({\n prompt: 'Summarize what the Food Ordering MCP App widget demonstrates.',\n })\n }\n >\n <SparkIcon />\n Ask assistant\n </button>\n <button\n className=\"nw-button\"\n type=\"button\"\n onClick={() => openExternal('https://example.com/noodle-widget-docs')}\n >\n <ExternalIcon />\n Open docs\n </button>\n </div>\n {structured?.note ? <p className=\"nw-note\">{structured.note}</p> : null}\n </div>\n <footer className=\"nw-footer\">\n <span className=\"nw-meta\">\n <ShieldIcon />\n Secure widget surface\n </span>\n <span>v1.0.0</span>\n </footer>\n </section>\n </main>\n );\n}\n\nfunction PuzzleIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M8 4h5v4h3a2 2 0 0 1 0 4h-3v3H9v-3H6a2 2 0 0 1 0-4h2V4Z\" />\n <path d=\"M13 15v5H4v-5\" />\n <path d=\"M13 20h7v-8\" />\n </svg>\n );\n}\n\nfunction CheckIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"m6 12 4 4 8-8\" />\n </svg>\n );\n}\n\nfunction SparkIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"m12 3 1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3Z\" />\n </svg>\n );\n}\n\nfunction ExternalIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M14 4h6v6\" />\n <path d=\"m20 4-9 9\" />\n <path d=\"M20 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h5\" />\n </svg>\n );\n}\n\nfunction ShieldIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M12 3 5 6v5c0 4.4 2.8 8.3 7 10 4.2-1.7 7-5.6 7-10V6l-7-3Z\" />\n <path d=\"m9 12 2 2 4-4\" />\n </svg>\n );\n}\n" },
55
55
  { relPath: "examples/food-ordering/src/views/ordering-flow.tsx", content: "import { useMemo, useState } from 'react';\nimport {\n ActionBar,\n AppShell,\n AsyncBoundary,\n ChoiceGroup,\n createViewStore,\n DataCard,\n DataList,\n Field,\n HandoffButton,\n QuantityStepper,\n ShellNav,\n StatusBadge,\n SubmitButton,\n useAppFlow,\n useCallTool,\n useHandoff,\n useLayout,\n useSendFollowUpMessage,\n useToolInfo,\n useViewState,\n View,\n ViewStack,\n} from '../helpers.js';\nimport './widget-style.css';\n\ntype ViewName = 'stores' | 'menu' | 'item' | 'cart' | 'review' | 'handoff';\n\ntype Store = {\n readonly id: string;\n readonly name: string;\n readonly cuisine: string;\n readonly address: string;\n readonly open: boolean;\n readonly etaMinutes: number;\n readonly rating: number;\n};\n\ntype MenuItem = {\n readonly id: string;\n readonly storeId: string;\n readonly category: string;\n readonly name: string;\n readonly price: number;\n readonly description: string;\n readonly modifiers: readonly string[];\n};\n\ntype CartLine = {\n readonly itemId: string;\n readonly quantity: number;\n readonly modifiers: readonly string[];\n readonly note?: string;\n};\n\ntype CartState = {\n readonly selectedStoreId?: string;\n readonly lines: readonly CartLine[];\n readonly customer: string;\n readonly notes?: string;\n readonly subtotal: number;\n readonly status: 'draft' | 'review' | 'handoff';\n readonly checkoutUrl?: string;\n};\n\nconst zeroCart: CartState = {\n lines: [],\n customer: 'Guest',\n subtotal: 0,\n status: 'draft',\n};\n\nconst useCartStore = createViewStore<CartState>('cart', zeroCart);\nconst useCartRevisionStore = createViewStore('cart_revision', { value: 0 });\n\nfunction structured<T>(value: unknown): T | undefined {\n return (value as { structuredContent?: T } | undefined)?.structuredContent;\n}\n\nfunction currency(value: number): string {\n return `$${value.toFixed(2)}`;\n}\n\nfunction modifierLabel(value: string): string {\n return value\n .split('_')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join(' ');\n}\n\nexport default function OrderingFlow() {\n const { displayMode, theme } = useLayout();\n const entry = structured<{\n readonly customer?: string;\n readonly stores?: readonly Store[];\n readonly featuredItems?: readonly MenuItem[];\n readonly status?: string;\n }>(useToolInfo('open_ordering'));\n const flow = useAppFlow<ViewName>({\n key: 'ordering_flow',\n initialView: 'stores',\n views: ['stores', 'menu', 'item', 'cart', 'review', 'handoff'],\n });\n const view = flow.activeView;\n const setView = flow.navigate;\n const handoff = useHandoff();\n const sendFollowUpMessage = useSendFollowUpMessage();\n const searchStores = useCallTool('search_stores');\n const loadMenu = useCallTool('load_menu');\n const loadItem = useCallTool('load_item');\n const readCart = useCallTool('read_cart');\n const syncCart = useCallTool('sync_cart');\n const prepareCheckout = useCallTool('prepare_checkout');\n\n const [query, setQuery] = useViewState('query', '');\n const [customer, setCustomer] = useViewState('customer', entry?.customer ?? 'Guest');\n const [selectedStoreId, setSelectedStoreId] = useViewState<string | undefined>(\n 'selected_store',\n entry?.stores?.[0]?.id,\n );\n const [selectedItemId, setSelectedItemId] = useViewState<string | undefined>(\n 'selected_item',\n entry?.featuredItems?.[0]?.id,\n );\n const cartStore = useCartStore();\n const revisionStore = useCartRevisionStore((state) => state.value);\n const cart =\n cartStore.state.customer === 'Guest' && entry?.customer\n ? { ...cartStore.state, customer: entry.customer }\n : cartStore.state;\n const revision = revisionStore.selected;\n const setCart = cartStore.setState;\n const setRevision = (value: number) => revisionStore.setState({ value });\n const [quantity, setQuantity] = useState(1);\n const [selectedModifiers, setSelectedModifiers] = useState<readonly string[]>([]);\n\n const storeData = structured<{ readonly stores?: readonly Store[] }>(searchStores.data);\n const menuData = structured<{\n readonly stores?: readonly Store[];\n readonly items?: readonly MenuItem[];\n }>(loadMenu.data);\n const itemData = structured<{ readonly items?: readonly MenuItem[] }>(loadItem.data);\n const checkoutData = structured<{ readonly checkoutUrl?: string; readonly cart?: CartState }>(\n prepareCheckout.data,\n );\n const stores = storeData?.stores ?? entry?.stores ?? [];\n const queryText = query.trim().toLowerCase();\n const displayedStores = stores.filter(\n (store) =>\n queryText.length === 0 ||\n store.name.toLowerCase().includes(queryText) ||\n store.cuisine.toLowerCase().includes(queryText),\n );\n const allItems = menuData?.items ?? itemData?.items ?? entry?.featuredItems ?? [];\n const items = allItems.filter((item) => item.storeId === selectedStoreId);\n const currentStore =\n stores.find((store) => store.id === selectedStoreId) ?? menuData?.stores?.[0] ?? stores[0];\n const currentItem = allItems.find((item) => item.id === selectedItemId) ?? items[0];\n const lineItems = useMemo(\n () =>\n cart.lines.map((line) => ({\n ...line,\n item: [...(entry?.featuredItems ?? []), ...allItems].find(\n (item) => item.id === line.itemId,\n ),\n })),\n [cart.lines, entry?.featuredItems, allItems],\n );\n const llmSummary = `${view} view for ${customer}; ${cart.lines.length} cart lines; subtotal ${currency(\n cart.subtotal,\n )}`;\n\n async function chooseStore(store: Store) {\n setSelectedStoreId(store.id);\n setView('menu');\n const result = await loadMenu.callTool({ storeId: store.id });\n const loaded = structured<{ readonly items?: readonly MenuItem[] }>(result);\n setSelectedItemId(loaded?.items?.find((item) => item.storeId === store.id)?.id);\n }\n\n async function chooseItem(item: MenuItem) {\n setSelectedItemId(item.id);\n setSelectedModifiers([]);\n setQuantity(1);\n setView('item');\n await loadItem.callTool({ itemId: item.id });\n }\n\n async function persistCart(nextCart: CartState, nextView: ViewName) {\n const result = await syncCart.callTool({\n selectedStoreId: nextCart.selectedStoreId,\n lines: nextCart.lines,\n customer: nextCart.customer,\n notes: nextCart.notes,\n subtotal: nextCart.subtotal,\n expectedRevision: revision,\n });\n const synced = structured<{ readonly cart?: CartState; readonly revision?: number }>(result);\n setCart(synced?.cart ?? nextCart);\n setRevision(synced?.revision ?? revision + 1);\n setView(nextView);\n }\n\n async function addCurrentItem() {\n if (!currentItem) return;\n const nextLines = [\n ...cart.lines,\n {\n itemId: currentItem.id,\n quantity,\n modifiers: selectedModifiers,\n },\n ];\n await persistCart(\n {\n ...cart,\n selectedStoreId: currentStore?.id ?? selectedStoreId,\n lines: nextLines,\n customer,\n subtotal: nextLines.reduce(\n (sum, line) =>\n sum +\n ([...(entry?.featuredItems ?? []), ...allItems].find((item) => item.id === line.itemId)\n ?.price ?? 0) *\n line.quantity,\n 0,\n ),\n status: 'draft',\n },\n 'cart',\n );\n }\n\n async function prepareHandoff() {\n const result = await prepareCheckout.callTool({\n selectedStoreId: cart.selectedStoreId,\n lines: cart.lines,\n customer,\n notes: cart.notes,\n subtotal: cart.subtotal,\n expectedRevision: revision,\n });\n const prepared = structured<{\n readonly cart?: CartState;\n readonly revision?: number;\n readonly checkoutUrl?: string;\n }>(result);\n setCart(prepared?.cart ?? cart);\n setRevision(prepared?.revision ?? revision + 1);\n setView('handoff');\n }\n\n return (\n <AppShell\n className={`nw-shell${theme === 'dark' ? ' dark' : ''}`}\n data-llm={llmSummary}\n title=\"Food Ordering\"\n subtitle={entry?.status ?? 'Find a store, build a cart, and hand off checkout.'}\n icon={<BowlIcon />}\n badge={displayMode === 'fullscreen' ? 'Fullscreen' : view}\n footer={\n <>\n <span className=\"nw-meta\">\n <BagIcon />\n {cart.lines.length} items\n </span>\n <span className=\"nw-meta\">Revision {revision}</span>\n </>\n }\n >\n <ShellNav\n activeView={view}\n aria-label=\"Ordering steps\"\n items={(['stores', 'menu', 'cart', 'review', 'handoff'] as const).map((step) => ({\n view: step,\n label: step,\n }))}\n onNavigate={setView}\n />\n <div className=\"nw-body\">\n <ViewStack flow={flow}>\n <View name=\"stores\">\n <div className=\"nw-field-grid\">\n <Field className=\"nw-field\" label=\"Customer\">\n <input\n className=\"nw-input\"\n value={customer}\n onChange={(event) => setCustomer(event.currentTarget.value)}\n />\n </Field>\n <Field className=\"nw-field\" label=\"Search\">\n <input\n className=\"nw-input\"\n value={query}\n placeholder=\"Noodles\"\n onChange={(event) => setQuery(event.currentTarget.value)}\n />\n </Field>\n </div>\n <ActionBar className=\"nw-actions\">\n <SubmitButton\n className=\"nw-button nw-button-primary\"\n pending={searchStores.isPending}\n pendingLabel=\"Searching...\"\n onClick={() => searchStores.callTool({ query, openOnly: false })}\n >\n <SearchIcon />\n Search stores\n </SubmitButton>\n <SubmitButton\n className=\"nw-button\"\n pending={readCart.isPending}\n pendingLabel=\"Loading...\"\n onClick={async () => {\n const result = await readCart.callTool({});\n const stored = structured<{\n readonly value?: CartState;\n readonly revision?: number;\n }>(result);\n if (stored?.value?.lines) setCart(stored.value);\n setRevision(stored?.revision ?? revision);\n }}\n >\n <RefreshIcon />\n Load cart\n </SubmitButton>\n </ActionBar>\n <AsyncBoundary\n state={searchStores}\n isEmpty={displayedStores.length === 0}\n empty=\"No matching stores\"\n >\n <StoreList stores={displayedStores} onChoose={chooseStore} />\n </AsyncBoundary>\n </View>\n\n <View name=\"menu\">\n <SectionHeader title={currentStore?.name ?? 'Menu'} detail={currentStore?.address} />\n <AsyncBoundary\n state={loadMenu}\n isEmpty={items.length === 0}\n empty=\"No menu items loaded\"\n >\n <ItemList items={items} onChoose={chooseItem} />\n </AsyncBoundary>\n </View>\n\n <View name=\"item\">\n {currentItem ? (\n <>\n <SectionHeader title={currentItem.name} detail={currentItem.description} />\n <div className=\"nw-field-grid\">\n <Field className=\"nw-field\" label=\"Quantity\">\n <QuantityStepper value={quantity} min={1} onChange={setQuantity} />\n </Field>\n <div className=\"nw-summary nw-summary-compact\">\n <div className=\"nw-summary-row\">\n <dt>Price</dt>\n <dd>{currency(currentItem.price)}</dd>\n </div>\n </div>\n </div>\n <ChoiceGroup\n className=\"nw-modifier-grid\"\n values={currentItem.modifiers}\n selected={selectedModifiers}\n onChange={setSelectedModifiers}\n labelFor={modifierLabel}\n />\n <ActionBar className=\"nw-actions\">\n <SubmitButton\n className=\"nw-button nw-button-primary\"\n pending={syncCart.isPending}\n pendingLabel=\"Adding...\"\n onClick={addCurrentItem}\n >\n <BagIcon />\n Add to cart\n </SubmitButton>\n <button className=\"nw-button\" type=\"button\" onClick={() => setView('menu')}>\n Back to menu\n </button>\n </ActionBar>\n </>\n ) : null}\n </View>\n\n <View name=\"cart\">\n <SectionHeader\n title=\"Cart\"\n detail={`${cart.lines.length} line${cart.lines.length === 1 ? '' : 's'}`}\n />\n <CartSummary lineItems={lineItems} subtotal={cart.subtotal} />\n <Field className=\"nw-field\" label=\"Notes\">\n <input\n className=\"nw-input\"\n value={cart.notes ?? ''}\n placeholder=\"Utensils, pickup name, or allergies\"\n onChange={(event) => setCart({ ...cart, notes: event.currentTarget.value })}\n />\n </Field>\n <ActionBar className=\"nw-actions\">\n <SubmitButton\n className=\"nw-button\"\n pending={syncCart.isPending}\n pendingLabel=\"Saving...\"\n onClick={() => persistCart({ ...cart, customer, status: 'draft' }, 'review')}\n >\n <SaveIcon />\n Save cart\n </SubmitButton>\n <SubmitButton\n className=\"nw-button nw-button-primary\"\n disabled={cart.lines.length === 0}\n pending={prepareCheckout.isPending}\n pendingLabel=\"Preparing...\"\n onClick={prepareHandoff}\n >\n <ExternalIcon />\n Prepare checkout\n </SubmitButton>\n </ActionBar>\n </View>\n\n <View name=\"review\">\n <SectionHeader\n title=\"Review order\"\n detail={`${cart.lines.length} line${cart.lines.length === 1 ? '' : 's'}`}\n />\n <CartSummary lineItems={lineItems} subtotal={cart.subtotal} />\n <ActionBar className=\"nw-actions\">\n <button className=\"nw-button\" type=\"button\" onClick={() => setView('cart')}>\n Edit cart\n </button>\n <SubmitButton\n className=\"nw-button nw-button-primary\"\n disabled={cart.lines.length === 0}\n pending={prepareCheckout.isPending}\n pendingLabel=\"Preparing...\"\n onClick={prepareHandoff}\n >\n <ExternalIcon />\n Prepare checkout\n </SubmitButton>\n </ActionBar>\n </View>\n\n <View name=\"handoff\">\n <SectionHeader\n title=\"Checkout handoff\"\n detail=\"Payment stays with the ordering site.\"\n />\n <CartSummary lineItems={lineItems} subtotal={cart.subtotal} />\n <p className=\"nw-note\">\n The MCP App prepared a synthetic checkout URL and will open only the allowlisted\n example domain.\n </p>\n <ActionBar className=\"nw-actions\">\n <HandoffButton\n handoff={handoff}\n target={checkoutData?.checkoutUrl ?? cart.checkoutUrl ?? ''}\n className=\"nw-button nw-button-primary\"\n type=\"button\"\n pendingLabel=\"Opening...\"\n >\n <ExternalIcon />\n Continue checkout\n </HandoffButton>\n <button\n className=\"nw-button\"\n type=\"button\"\n onClick={() =>\n sendFollowUpMessage({\n prompt: `Summarize my food order for ${customer} before checkout.`,\n })\n }\n >\n <SparkIcon />\n Ask assistant\n </button>\n </ActionBar>\n </View>\n </ViewStack>\n </div>\n </AppShell>\n );\n}\n\nfunction SectionHeader({ title, detail }: { readonly title: string; readonly detail?: string }) {\n return (\n <div className=\"nw-section-head\">\n <p className=\"nw-section-title\">{title}</p>\n {detail ? <p className=\"nw-section-detail\">{detail}</p> : null}\n </div>\n );\n}\n\nfunction StoreList({\n stores,\n onChoose,\n}: {\n readonly stores: readonly Store[];\n readonly onChoose: (store: Store) => void;\n}) {\n return (\n <DataList className=\"nw-menu-list\">\n {stores.map((store) => (\n <DataCard\n as=\"button\"\n className=\"nw-menu-item\"\n key={store.id}\n type=\"button\"\n onClick={() => onChoose(store)}\n >\n <span>\n <span className=\"nw-menu-name\">{store.name}</span>\n <span className=\"nw-menu-desc\">\n {store.cuisine} · {store.address}\n </span>\n </span>\n <StatusBadge className=\"nw-status\" tone={store.open ? 'success' : 'neutral'}>\n {store.open ? `${store.etaMinutes}m` : 'Closed'}\n </StatusBadge>\n </DataCard>\n ))}\n </DataList>\n );\n}\n\nfunction ItemList({\n items,\n onChoose,\n}: {\n readonly items: readonly MenuItem[];\n readonly onChoose: (item: MenuItem) => void;\n}) {\n return (\n <DataList className=\"nw-menu-list\">\n {items.map((item) => (\n <DataCard\n as=\"button\"\n className=\"nw-menu-item\"\n key={item.id}\n type=\"button\"\n onClick={() => onChoose(item)}\n >\n <span>\n <span className=\"nw-menu-name\">{item.name}</span>\n <span className=\"nw-menu-desc\">{item.description}</span>\n </span>\n <span className=\"nw-price\">{currency(item.price)}</span>\n </DataCard>\n ))}\n </DataList>\n );\n}\n\nfunction CartSummary({\n lineItems,\n subtotal,\n}: {\n readonly lineItems: readonly (CartLine & { readonly item?: MenuItem })[];\n readonly subtotal: number;\n}) {\n return (\n <dl className=\"nw-summary\">\n {lineItems.length === 0 ? (\n <div className=\"nw-summary-row\">\n <dt>No items yet</dt>\n <dd>{currency(0)}</dd>\n </div>\n ) : (\n lineItems.map((line, index) => (\n <div className=\"nw-summary-row\" key={`${line.itemId}-${index}`}>\n <dt>\n {line.quantity} x {line.item?.name ?? line.itemId}\n {line.modifiers.length > 0 ? (\n <span className=\"nw-line-note\">{line.modifiers.map(modifierLabel).join(', ')}</span>\n ) : null}\n </dt>\n <dd>{currency((line.item?.price ?? 0) * line.quantity)}</dd>\n </div>\n ))\n )}\n <div className=\"nw-summary-row nw-total\">\n <dt>Subtotal</dt>\n <dd>{currency(subtotal)}</dd>\n </div>\n </dl>\n );\n}\n\nfunction BowlIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M4 11h16a7 7 0 0 1-7 7h-2a7 7 0 0 1-7-7Z\" />\n <path d=\"M7 21h10\" />\n <path d=\"M8 6c0-1 1-1 1-2\" />\n <path d=\"M12 6c0-1 1-1 1-2\" />\n <path d=\"M16 6c0-1 1-1 1-2\" />\n </svg>\n );\n}\n\nfunction SearchIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"7\" />\n <path d=\"m20 20-4-4\" />\n </svg>\n );\n}\n\nfunction RefreshIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M20 12a8 8 0 1 1-2.3-5.6\" />\n <path d=\"M20 4v5h-5\" />\n </svg>\n );\n}\n\nfunction BagIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M6 8h12l-1 12H7L6 8Z\" />\n <path d=\"M9 8a3 3 0 0 1 6 0\" />\n </svg>\n );\n}\n\nfunction SaveIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M5 4h12l2 2v14H5V4Z\" />\n <path d=\"M8 4v6h8\" />\n <path d=\"M8 20v-5h8v5\" />\n </svg>\n );\n}\n\nfunction ExternalIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"M14 4h6v6\" />\n <path d=\"m20 4-9 9\" />\n <path d=\"M20 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h5\" />\n </svg>\n );\n}\n\nfunction SparkIcon() {\n return (\n <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\">\n <path d=\"m12 3 1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3Z\" />\n </svg>\n );\n}\n" },
56
56
  { relPath: "examples/food-ordering/src/views/widget-style.css", content: ":root {\n color-scheme: light dark;\n font-family:\n Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n --nw-bg: #ffffff;\n --nw-surface: #f7f7f5;\n --nw-surface-strong: #ffffff;\n --nw-text: #1f2328;\n --nw-muted: #677079;\n --nw-border: #d9dee3;\n --nw-accent: #0f8f5f;\n --nw-accent-strong: #047857;\n --nw-accent-soft: #e8f7ef;\n --nw-info: #1d6feb;\n --nw-info-soft: #eaf2ff;\n --nw-warn: #b7791f;\n --nw-danger: #c2410c;\n --nw-shadow: 0 18px 50px rgb(15 23 42 / 12%);\n --nw-radius: 8px;\n}\n\n.dark,\n[data-theme=\"dark\"] {\n --nw-bg: #111820;\n --nw-surface: #16212a;\n --nw-surface-strong: #101820;\n --nw-text: #f4f7f8;\n --nw-muted: #a4b0ba;\n --nw-border: #33414c;\n --nw-accent: #25c385;\n --nw-accent-strong: #19a974;\n --nw-accent-soft: #123a2b;\n --nw-info: #4c9aff;\n --nw-info-soft: #132b4d;\n --nw-warn: #f0b35b;\n --nw-danger: #fb7b54;\n --nw-shadow: 0 18px 50px rgb(0 0 0 / 28%);\n}\n\n* {\n box-sizing: border-box;\n}\n\nbody {\n margin: 0;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\nbutton,\ninput,\nselect {\n font: inherit;\n}\n\n.nw-shell {\n min-height: 100vh;\n padding: 14px;\n background: var(--nw-bg);\n color: var(--nw-text);\n}\n\n.nw-card {\n width: min(100%, 560px);\n margin: 0 auto;\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n background: var(--nw-surface-strong);\n box-shadow: var(--nw-shadow);\n overflow: hidden;\n}\n\n.nw-card-wide {\n width: min(100%, 720px);\n}\n\n.nsr-card {\n width: min(100%, 560px);\n margin: 0 auto;\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n background: var(--nw-surface-strong);\n box-shadow: var(--nw-shadow);\n overflow: hidden;\n}\n\n.nsr-card-wide {\n width: min(100%, 720px);\n}\n\n.nw-header {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 14px;\n border-bottom: 1px solid var(--nw-border);\n}\n\n.nsr-header {\n display: flex;\n align-items: center;\n gap: 10px;\n padding: 14px;\n border-bottom: 1px solid var(--nw-border);\n}\n\n.nw-icon {\n display: inline-grid;\n width: 32px;\n height: 32px;\n flex: 0 0 auto;\n place-items: center;\n border-radius: 8px;\n background: linear-gradient(145deg, var(--nw-accent), var(--nw-accent-strong));\n color: white;\n}\n\n.nsr-icon {\n display: inline-grid;\n width: 32px;\n height: 32px;\n flex: 0 0 auto;\n place-items: center;\n border-radius: 8px;\n background: linear-gradient(145deg, var(--nw-accent), var(--nw-accent-strong));\n color: white;\n}\n\n.nw-icon svg,\n.nsr-icon svg,\n.nw-button svg,\n.nw-meta svg {\n width: 16px;\n height: 16px;\n stroke: currentColor;\n stroke-width: 2;\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n.nw-title-block {\n min-width: 0;\n flex: 1;\n}\n\n.nsr-title-block {\n min-width: 0;\n flex: 1;\n}\n\n.nw-title {\n margin: 0;\n font-size: 16px;\n line-height: 1.2;\n font-weight: 700;\n letter-spacing: 0;\n}\n\n.nsr-title {\n margin: 0;\n font-size: 16px;\n line-height: 1.2;\n font-weight: 700;\n letter-spacing: 0;\n}\n\n.nw-subtitle {\n margin: 4px 0 0;\n color: var(--nw-muted);\n font-size: 12px;\n line-height: 1.35;\n}\n\n.nsr-subtitle {\n margin: 4px 0 0;\n color: var(--nw-muted);\n font-size: 12px;\n line-height: 1.35;\n}\n\n.nw-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n min-height: 24px;\n padding: 3px 9px;\n border: 1px solid var(--nw-border);\n border-radius: 999px;\n background: var(--nw-surface);\n color: var(--nw-text);\n font-size: 12px;\n font-weight: 600;\n white-space: nowrap;\n}\n\n.nsr-chip {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n min-height: 24px;\n padding: 3px 9px;\n border: 1px solid var(--nw-border);\n border-radius: 999px;\n background: var(--nw-surface);\n color: var(--nw-text);\n font-size: 12px;\n font-weight: 600;\n white-space: nowrap;\n}\n\n.nw-chip::before {\n width: 7px;\n height: 7px;\n border-radius: 99px;\n background: var(--nw-accent);\n content: \"\";\n}\n\n.nsr-chip::before {\n width: 7px;\n height: 7px;\n border-radius: 99px;\n background: var(--nw-accent);\n content: \"\";\n}\n\n.nw-tabs {\n display: grid;\n grid-template-columns: repeat(5, minmax(0, 1fr));\n gap: 1px;\n border-bottom: 1px solid var(--nw-border);\n background: var(--nw-border);\n}\n\n.nsr-tabs {\n display: grid;\n grid-template-columns: repeat(5, minmax(0, 1fr));\n gap: 1px;\n border-bottom: 1px solid var(--nw-border);\n background: var(--nw-border);\n}\n\n.nw-tab {\n min-width: 0;\n min-height: 34px;\n border: 0;\n background: var(--nw-surface-strong);\n color: var(--nw-muted);\n font-size: 12px;\n font-weight: 700;\n text-transform: capitalize;\n cursor: pointer;\n}\n\n.nsr-tab {\n min-width: 0;\n min-height: 34px;\n border: 0;\n background: var(--nw-surface-strong);\n color: var(--nw-muted);\n font-size: 12px;\n font-weight: 700;\n text-transform: capitalize;\n cursor: pointer;\n}\n\n.nw-tab[aria-current=\"step\"] {\n color: var(--nw-text);\n background: var(--nw-accent-soft);\n}\n\n.nsr-tab[aria-current=\"step\"] {\n color: var(--nw-text);\n background: var(--nw-accent-soft);\n}\n\n.nw-body {\n display: grid;\n gap: 14px;\n padding: 14px;\n}\n\n.nw-grid {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(180px, 0.75fr);\n gap: 14px;\n}\n\n.nw-section-title {\n margin: 0 0 8px;\n font-size: 12px;\n font-weight: 700;\n}\n\n.nw-section-head {\n display: grid;\n gap: 2px;\n}\n\n.nw-section-detail {\n margin: 0;\n color: var(--nw-muted);\n font-size: 12px;\n}\n\n.nw-menu-list,\n.nw-summary-list,\n.nw-feature-list {\n display: grid;\n gap: 8px;\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\n.nw-menu-item {\n display: grid;\n grid-template-columns: minmax(0, 1fr) auto;\n gap: 10px;\n width: 100%;\n padding: 10px;\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n background: var(--nw-bg);\n color: var(--nw-text);\n text-align: left;\n cursor: pointer;\n}\n\n.nw-menu-item[aria-pressed=\"true\"] {\n border-color: var(--nw-accent);\n background: var(--nw-accent-soft);\n}\n\n.nw-menu-name,\n.nw-feature-name {\n display: block;\n font-size: 13px;\n font-weight: 700;\n}\n\n.nw-menu-desc,\n.nw-feature-desc {\n display: block;\n margin-top: 3px;\n color: var(--nw-muted);\n font-size: 12px;\n line-height: 1.35;\n}\n\n.nw-price {\n align-self: center;\n color: var(--nw-text);\n font-size: 13px;\n font-weight: 700;\n}\n\n.nw-status {\n align-self: center;\n color: var(--nw-muted);\n font-size: 12px;\n font-weight: 800;\n white-space: nowrap;\n}\n\n.nw-status-ok {\n color: var(--nw-accent-strong);\n}\n\n.nw-field-grid {\n display: grid;\n grid-template-columns: 1fr 120px;\n gap: 10px;\n}\n\n.nw-field {\n display: grid;\n gap: 5px;\n color: var(--nw-muted);\n font-size: 12px;\n font-weight: 650;\n}\n\n.nsr-field-label {\n color: var(--nw-muted);\n}\n\n.nsr-stepper {\n display: grid;\n grid-template-columns: 34px minmax(42px, 1fr) 34px;\n width: 100%;\n min-height: 34px;\n border: 1px solid var(--nw-border);\n border-radius: 7px;\n overflow: hidden;\n background: var(--nw-bg);\n}\n\n.nsr-stepper button {\n border: 0;\n background: var(--nw-surface);\n color: var(--nw-text);\n cursor: pointer;\n}\n\n.nsr-stepper button:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n\n.nsr-stepper-value {\n display: grid;\n place-items: center;\n color: var(--nw-text);\n font-size: 13px;\n font-weight: 800;\n}\n\n.nw-input,\n.nw-select {\n min-width: 0;\n width: 100%;\n min-height: 34px;\n padding: 7px 9px;\n border: 1px solid var(--nw-border);\n border-radius: 7px;\n background: var(--nw-bg);\n color: var(--nw-text);\n outline: none;\n}\n\n.nw-input:focus,\n.nw-select:focus,\n.nw-button:focus-visible,\n.nw-menu-item:focus-visible {\n border-color: var(--nw-info);\n box-shadow: 0 0 0 3px color-mix(in srgb, var(--nw-info) 24%, transparent);\n}\n\n.nw-modifier-grid {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 8px;\n}\n\n.nw-option {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 9px;\n border: 1px solid var(--nw-border);\n border-radius: 7px;\n background: var(--nw-bg);\n color: var(--nw-text);\n font-size: 12px;\n font-weight: 650;\n}\n\n.nsr-choice {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 9px;\n border: 1px solid var(--nw-border);\n border-radius: 7px;\n background: var(--nw-bg);\n color: var(--nw-text);\n font-size: 12px;\n font-weight: 650;\n}\n\n.nw-summary {\n display: grid;\n gap: 8px;\n padding: 10px;\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n background: var(--nw-surface);\n}\n\n.nw-summary-compact {\n align-self: end;\n}\n\n.nw-summary-row {\n display: flex;\n justify-content: space-between;\n gap: 12px;\n padding-bottom: 8px;\n border-bottom: 1px solid color-mix(in srgb, var(--nw-border) 70%, transparent);\n}\n\n.nw-summary-row:last-child {\n padding-bottom: 0;\n border-bottom: 0;\n}\n\n.nw-summary-row dt {\n color: var(--nw-muted);\n font-size: 12px;\n}\n\n.nw-line-note {\n display: block;\n margin-top: 2px;\n font-size: 11px;\n font-weight: 500;\n}\n\n.nw-summary-row dd {\n margin: 0;\n text-align: right;\n font-size: 13px;\n font-weight: 700;\n}\n\n.nw-total dd {\n font-size: 18px;\n}\n\n.nw-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.nsr-actions {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n\n.nw-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n min-height: 36px;\n padding: 8px 12px;\n border: 1px solid var(--nw-border);\n border-radius: 7px;\n background: var(--nw-bg);\n color: var(--nw-text);\n font-size: 13px;\n font-weight: 700;\n cursor: pointer;\n}\n\n.nw-button-primary {\n border-color: var(--nw-accent-strong);\n background: linear-gradient(145deg, var(--nw-accent), var(--nw-accent-strong));\n color: white;\n}\n\n.nw-button-info {\n border-color: var(--nw-info);\n background: var(--nw-info);\n color: white;\n}\n\n.nw-button:disabled {\n cursor: wait;\n opacity: 0.65;\n}\n\n.nw-note {\n margin: 0;\n padding: 10px;\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n background: var(--nw-surface);\n color: var(--nw-muted);\n font-size: 12px;\n line-height: 1.45;\n}\n\n.nw-footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 10px 14px;\n border-top: 1px solid var(--nw-border);\n color: var(--nw-muted);\n font-size: 12px;\n}\n\n.nsr-footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n padding: 10px 14px;\n border-top: 1px solid var(--nw-border);\n color: var(--nw-muted);\n font-size: 12px;\n}\n\n.nw-meta {\n display: inline-flex;\n align-items: center;\n gap: 6px;\n}\n\n.nw-feature {\n display: grid;\n grid-template-columns: 24px minmax(0, 1fr);\n gap: 10px;\n padding: 10px;\n border: 1px solid var(--nw-border);\n border-radius: var(--nw-radius);\n background: var(--nw-bg);\n}\n\n.nw-check {\n display: inline-grid;\n width: 22px;\n height: 22px;\n place-items: center;\n border-radius: 6px;\n background: var(--nw-accent);\n color: white;\n font-size: 13px;\n font-weight: 800;\n}\n\n.nw-check svg {\n width: 14px;\n height: 14px;\n stroke: currentColor;\n stroke-width: 3;\n fill: none;\n stroke-linecap: round;\n stroke-linejoin: round;\n}\n\n@media (max-width: 560px) {\n .nw-shell {\n padding: 10px;\n }\n\n .nw-grid,\n .nw-field-grid,\n .nw-modifier-grid {\n grid-template-columns: 1fr;\n }\n\n .nw-tabs {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n\n .nsr-tabs {\n grid-template-columns: repeat(3, minmax(0, 1fr));\n }\n\n .nw-header {\n align-items: flex-start;\n }\n\n .nsr-header {\n align-items: flex-start;\n }\n\n .nw-chip {\n max-width: 120px;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .nsr-chip {\n max-width: 120px;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .nw-button {\n flex: 1 1 140px;\n }\n}\n" },
57
57
  { relPath: "examples/food-ordering/test/server.test.ts", content: "import { describe, expect, it } from 'vitest';\nimport app from '../src/server.js';\n\ndescribe('food-ordering example', () => {\n it('exports a Noodle server definition', () => {\n expect(typeof app.toManifest).toBe('function');\n });\n\n it('emits a complete ordering app manifest with cart state and app-only helpers', async () => {\n const manifest = (await app.toManifest()) as {\n server: {\n name: string;\n };\n handoff?: { allowedDomains?: string[] };\n state?: { handles?: Record<string, { kind: string; scope: string }> };\n connectors?: Record<string, { id: string; version: string }>;\n tools: Array<{\n name: string;\n visibility?: string[];\n output?: unknown;\n }>;\n widgets?: Array<{\n name: string;\n tool: string;\n view?: { component?: string; entry?: string };\n }>;\n };\n\n expect(manifest.server.name).toBe('food_ordering');\n expect(manifest.state?.handles?.cart).toMatchObject({\n kind: 'cart',\n scope: 'caller',\n });\n expect(manifest.handoff?.allowedDomains).toEqual(['https://orders.example.com']);\n expect(manifest.connectors?.state).toEqual({ id: 'noodle_state', version: '1.0.0' });\n\n const tools = new Map(manifest.tools.map((tool) => [tool.name, tool]));\n expect(manifest.widgets?.find((widget) => widget.tool === 'open_ordering')?.view).toMatchObject(\n {\n component: 'ordering-flow',\n entry: './views/ordering-flow.tsx',\n },\n );\n for (const helper of [\n 'search_stores',\n 'load_menu',\n 'load_item',\n 'read_cart',\n 'sync_cart',\n 'prepare_checkout',\n ]) {\n expect(tools.get(helper)?.visibility).toEqual(['app']);\n }\n expect(JSON.stringify(tools.get('open_ordering'))).toContain('featuredItems');\n expect(JSON.stringify(tools.get('sync_cart'))).toContain('revision');\n expect(manifest.widgets?.map((widget) => widget.name)).toContain('capabilities_card');\n });\n});\n" },
58
58
  { relPath: "examples/food-ordering/vitest.config.ts", content: "import { defineConfig } from 'vitest/config';\n\nexport default defineConfig({\n resolve: {\n alias: {\n '@noodleseed/one': new URL('../../packages/authoring/src/index.ts', import.meta.url).pathname,\n '@noodle-borg/capabilities': new URL(\n '../../packages/capabilities/src/index.ts',\n import.meta.url,\n ).pathname,\n '@noodle-borg/compiler': new URL('../../packages/compiler/src/index.ts', import.meta.url)\n .pathname,\n '@noodle-borg/compute': new URL('../../packages/compute/src/index.ts', import.meta.url)\n .pathname,\n '@noodle-borg/connector-defs': new URL(\n '../../packages/connector-defs/src/index.ts',\n import.meta.url,\n ).pathname,\n '@noodle-borg/connector-http': new URL(\n '../../packages/connector-http/src/index.ts',\n import.meta.url,\n ).pathname,\n '@noodle-borg/runtime': new URL('../../packages/runtime/src/index.ts', import.meta.url)\n .pathname,\n },\n },\n test: {\n include: ['test/**/*.test.ts'],\n },\n});\n" },
59
- { relPath: "examples/hello/README.md", content: "# hello — minimal TypeScript quickstart\n\nThe smallest deployable Noodle app: a single `greet` tool authored in TypeScript with no\nconnectors, secrets, flows, widgets, or handoff policy. It still uses the current server options form\nso new authors see where server-level branding belongs. Use it to smoke the author loop\n(`noodle validate` / `noodle dev`) or a first deploy.\n\n```sh\nnoodle dev examples/hello/src/server.ts --app hello\nnoodle deploy examples/hello/src/server.ts --org acme --app hello\n```\n\nIt is also the fixture for `pnpm smoke:dev` and the e2e harness, so keep its tool surface stable.\n" },
59
+ { relPath: "examples/hello/README.md", content: "# hello — minimal TypeScript quickstart\n\nThe smallest deployable Noodle app: a single `greet` tool authored in TypeScript with no\nconnectors, secrets, flows, widgets, or handoff policy. It still uses the current server options form\nso new authors see where server-level branding belongs. Use it to smoke the author loop\n(`noodle validate` / `noodle dev`) or a first deploy.\n\n```sh\nnoodle dev examples/hello/src/server.ts --app hello\nnoodle deploy examples/hello/src/server.ts --org acme --app hello\n```\n\n`noodle export manifest examples/hello/src/server.ts` compiles the same entrypoint locally and prints\nthe portable, vendor-neutral manifest JSON — the eject path: your `server.ts` plus this manifest is\nthe whole app, yours to read, diff, and keep.\n\nIt is also the fixture for `pnpm smoke:dev` and the e2e harness, so keep its tool surface stable.\n" },
60
60
  { relPath: "examples/hello/noodle.json", content: "{\n \"entrypoint\": \"src/server.ts\",\n \"name\": \"hello\",\n \"template\": \"hello\"\n}\n" },
61
61
  { relPath: "examples/hello/package.json", content: "{\n \"name\": \"hello\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"test\": \"vitest run\",\n \"validate\": \"noodle validate\",\n \"dev\": \"noodle dev\",\n \"deploy\": \"noodle deploy\"\n },\n \"devDependencies\": {\n \"@noodleseed/one\": \"latest\",\n \"vitest\": \"latest\"\n }\n}\n" },
62
- { relPath: "examples/hello/src/server.ts", content: "import { server, tool, z } from '@noodleseed/one';\n\nexport default server(\n 'hello',\n {\n title: 'Hello',\n version: '1.0.0',\n branding: {\n name: 'Hello',\n accent: '#1D9E75',\n radius: 'md',\n density: 'comfortable',\n },\n },\n [\n tool('greet', {\n description: 'Greet someone by name.',\n input: z.object({\n name: z.string(),\n }),\n output: z.object({\n message: z.string(),\n }),\n fulfil: ({ input }) => {\n return { message: `Hello, ${input.name}!` };\n },\n }),\n ],\n);\n" },
63
- { relPath: "examples/hello/test/server.test.ts", content: "import { describe, expect, it } from 'vitest';\nimport app from '../src/server.js';\n\ndescribe('hello example', () => {\n it('exports a Noodle server definition', () => {\n expect(typeof app.toManifest).toBe('function');\n });\n});\n" },
62
+ { relPath: "examples/hello/src/server.ts", content: "import { server, tool, z } from '@noodleseed/one';\n\nexport default server(\n 'hello',\n {\n title: 'Hello',\n version: '1.0.0',\n branding: {\n name: 'Hello',\n accent: '#1D9E75',\n radius: 'md',\n density: 'comfortable',\n },\n },\n [\n tool('greet', {\n description: 'Greet someone by name.',\n input: z.object({\n // Defaults are advertised to the model and applied at runtime when the argument is omitted.\n name: z.string().default('world'),\n }),\n output: z.object({\n message: z.string(),\n }),\n fulfil: ({ input }) => {\n return { message: `Hello, ${input.name}!` };\n },\n }),\n ],\n);\n" },
63
+ { relPath: "examples/hello/test/server.test.ts", content: "import { describe, expect, it } from 'vitest';\nimport app from '../src/server.js';\n\ndescribe('hello example', () => {\n it('exports a Noodle server definition', () => {\n expect(typeof app.toManifest).toBe('function');\n });\n\n it('advertises the greet default and keeps the argument optional', async () => {\n const manifest = await app.toManifest();\n const greet = manifest.tools?.find((tool) => tool.name === 'greet');\n const schema = greet?.inputSchema as {\n properties?: { name?: { default?: unknown } };\n required?: string[];\n };\n expect(schema.properties?.name?.default).toBe('world');\n expect(schema.required ?? []).not.toContain('name');\n });\n});\n" },
64
64
  { relPath: "examples/weather/README.md", content: "# Weather Briefing\n\nTwo declarative tools that show the runtime's breadth working together, with **no auth and no API\nkeys**. The `weather_briefing` tool takes a city name and runs a **three-step flow**:\n\nCapability slots: HTTP connector authoring, ordered fulfilment flows, query/response mapping,\n**list-returning connector output** (a connector that returns a live, variable-length array), and\nsandboxed compute.\n\n1. **`geo.search`** → geocode the city to coordinates (Open-Meteo Geocoding API)\n2. **`forecast.current`** → fetch current weather for those coordinates (Open-Meteo Forecast API)\n3. **`brief.summarize`** → derive a human-readable briefing in a **WASM/QuickJS compute sandbox**\n\nThe second tool, `search_places`, shows a connector returning a **live, variable-length list**: it binds\nthe whole Open-Meteo geocoding `results` array with `${response.results}`, then narrows each match to\n`{ id, label }` in a compute connector — the \"search → a list of options the model can pick from\"\npattern. Narrowing lives in compute because a `${...}` response mapping cannot iterate an array and a\ntool's Zod output does not strip fields at runtime.\n\nIt exercises, in one TypeScript-authored app:\n\n- **Server-level branding** with semantic tokens carried through the runtime artifact for any generated\n app surface.\n- **Ordered flow execution** with outputs threaded between steps (`${steps.geo.latitude}` → next step).\n- **Two HTTP connectors on two different hosts**, each with its own egress allowlist.\n- **Query parameters** (`query: [...]`) and a constant query baked into the path (`?current_weather=true`).\n- **Deep response mapping** with the `${...}` language — single-element indexing\n (`${response.results[0].latitude}`, `${response.current_weather.temperature}`) **and** whole-array\n binding (`${response.results}` returns the entire list verbatim).\n- **A list-returning connector + compute narrowing** — `geo.search_list` binds the whole `results`\n array; `places.narrow` reduces each element to `{ id, label }` and normalizes the no-results case\n to `[]`.\n- **Sandboxed compute** (no network/fs/env/clock) turning raw numbers into conditions + advice.\n- **Typed input/output schemas** emitted as JSON Schema 2020-12.\n\n## Run it locally\n\nFrom the repo root, with the workspace built (`pnpm build`):\n\n```bash\n: # 1. boot the local loopback dev server\nnode packages/cli/dist/cli.js dev examples/weather/src/server.ts --app weather\n\n: # 2. in another shell, call the printed local endpoint\nURL=http://127.0.0.1:<port>/o/local/weather/dev/mcp\ncurl -s \"$URL\" \\\n -H 'content-type: application/json' \\\n -H 'accept: application/json, text/event-stream' \\\n -H 'mcp-protocol-version: 2025-11-25' \\\n -d '{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"tools/call\",\"params\":{\"name\":\"weather_briefing\",\"arguments\":{\"city\":\"Paris\"}}}'\n```\n\nExample result (live data, abbreviated):\n\n```json\n{\n \"place\": \"Paris\", \"country\": \"France\",\n \"temperature_c\": 25.1, \"windspeed_kmh\": 8.3,\n \"conditions\": \"overcast\",\n \"headline\": \"Paris, France: 25°C, overcast.\",\n \"advice\": \"Comfortable conditions — no special prep needed.\"\n}\n```\n\nTry other cities (`Reykjavik`, `Singapore`, `Denver`) to see the conditions and advice change.\n\nCall `search_places` to see the **list-returning** tool — one query, many matches:\n\n```bash\ncurl -s \"$URL\" \\\n -H 'content-type: application/json' \\\n -H 'accept: application/json, text/event-stream' \\\n -H 'mcp-protocol-version: 2025-11-25' \\\n -d '{\"jsonrpc\":\"2.0\",\"id\":2,\"method\":\"tools/call\",\"params\":{\"name\":\"search_places\",\"arguments\":{\"query\":\"Springfield\"}}}'\n```\n\n```json\n{\n \"places\": [\n { \"id\": \"4951788\", \"label\": \"Springfield, Massachusetts, United States\" },\n { \"id\": \"4250542\", \"label\": \"Springfield, Illinois, United States\" },\n { \"id\": \"4508722\", \"label\": \"Springfield, Ohio, United States\" }\n ]\n}\n```\n" },
65
65
  { relPath: "examples/weather/noodle.json", content: "{\n \"entrypoint\": \"src/server.ts\",\n \"name\": \"weather\"\n}\n" },
66
66
  { relPath: "examples/weather/package.json", content: "{\n \"name\": \"weather\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"type\": \"module\",\n \"scripts\": {\n \"test\": \"vitest run\",\n \"validate\": \"noodle validate\",\n \"dev\": \"noodle dev\",\n \"deploy\": \"noodle deploy\"\n },\n \"devDependencies\": {\n \"@noodleseed/one\": \"latest\",\n \"vitest\": \"latest\"\n }\n}\n" },