@mostra/runtime 0.10.0 → 0.12.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 (257) hide show
  1. package/dist/bin.js +4178 -310
  2. package/dist/bin.js.map +1 -1
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/{instance-FExcyENK.js → instance-CBUlOmzG.js} +1892 -85
  6. package/dist/instance-CBUlOmzG.js.map +1 -0
  7. package/dist/reference/cli.md +1432 -0
  8. package/dist/reference/diagnostics.json +1579 -0
  9. package/dist/reference/errors/MOSTRA_A11Y_MINOR.md +23 -0
  10. package/dist/reference/errors/MOSTRA_A11Y_SERIOUS.md +23 -0
  11. package/dist/reference/errors/MOSTRA_ACTION_CANCELLED.md +23 -0
  12. package/dist/reference/errors/MOSTRA_ACTION_EVENT_INVALID.md +23 -0
  13. package/dist/reference/errors/MOSTRA_ACTION_EXPORT_INVALID.md +23 -0
  14. package/dist/reference/errors/MOSTRA_ACTION_INTERRUPTED.md +23 -0
  15. package/dist/reference/errors/MOSTRA_ACTION_PAUSED.md +23 -0
  16. package/dist/reference/errors/MOSTRA_ACTION_RUN_NOT_FOUND.md +23 -0
  17. package/dist/reference/errors/MOSTRA_ACTION_THREW.md +23 -0
  18. package/dist/reference/errors/MOSTRA_ACTION_TOO_LARGE.md +23 -0
  19. package/dist/reference/errors/MOSTRA_ACTION_UNKNOWN_FUNCTION.md +23 -0
  20. package/dist/reference/errors/MOSTRA_ACTION_UNSERIALIZABLE.md +23 -0
  21. package/dist/reference/errors/MOSTRA_ARTIFACT_BUNDLE_INVALID.md +23 -0
  22. package/dist/reference/errors/MOSTRA_ARTIFACT_DIR_NOT_EMPTY.md +23 -0
  23. package/dist/reference/errors/MOSTRA_ARTIFACT_ENTRY_AMBIGUOUS.md +23 -0
  24. package/dist/reference/errors/MOSTRA_ARTIFACT_ID_DROPPED.md +23 -0
  25. package/dist/reference/errors/MOSTRA_ARTIFACT_NOT_FOUND.md +23 -0
  26. package/dist/reference/errors/MOSTRA_ARTIFACT_NO_ENTRY.md +23 -0
  27. package/dist/reference/errors/MOSTRA_ARTIFACT_NO_PAGE.md +23 -0
  28. package/dist/reference/errors/MOSTRA_ARTIFACT_PATCH_REJECTED.md +23 -0
  29. package/dist/reference/errors/MOSTRA_ARTIFACT_PATH_INVALID.md +23 -0
  30. package/dist/reference/errors/MOSTRA_ARTIFACT_SOURCE_MISSING.md +23 -0
  31. package/dist/reference/errors/MOSTRA_ARTIFACT_SOURCE_UNREADABLE.md +23 -0
  32. package/dist/reference/errors/MOSTRA_ARTIFACT_TEMPLATE_UNKNOWN.md +23 -0
  33. package/dist/reference/errors/MOSTRA_ARTIFACT_VERSION_COLLECTED.md +23 -0
  34. package/dist/reference/errors/MOSTRA_ARTIFACT_VERSION_NOT_FOUND.md +23 -0
  35. package/dist/reference/errors/MOSTRA_BUILD_CRASHED.md +23 -0
  36. package/dist/reference/errors/MOSTRA_BUILD_FAILED.md +23 -0
  37. package/dist/reference/errors/MOSTRA_BUILD_TIMEOUT.md +23 -0
  38. package/dist/reference/errors/MOSTRA_BUILD_UNRESOLVED.md +23 -0
  39. package/dist/reference/errors/MOSTRA_CLI_CONFIG_UNWRITABLE.md +23 -0
  40. package/dist/reference/errors/MOSTRA_CLI_UNKNOWN_COMMAND.md +23 -0
  41. package/dist/reference/errors/MOSTRA_CLI_USAGE.md +23 -0
  42. package/dist/reference/errors/MOSTRA_CONSOLE_ERROR.md +23 -0
  43. package/dist/reference/errors/MOSTRA_CONSOLE_WARNING.md +23 -0
  44. package/dist/reference/errors/MOSTRA_DEP_INSTALL_FAILED.md +23 -0
  45. package/dist/reference/errors/MOSTRA_DEP_MISSING.md +23 -0
  46. package/dist/reference/errors/MOSTRA_DEP_NOT_FOUND.md +23 -0
  47. package/dist/reference/errors/MOSTRA_DEP_OFFLINE.md +23 -0
  48. package/dist/reference/errors/MOSTRA_DEP_SPEC_INVALID.md +23 -0
  49. package/dist/reference/errors/MOSTRA_DEP_TIMEOUT.md +23 -0
  50. package/dist/reference/errors/MOSTRA_DEP_WARM_CONFLICT.md +23 -0
  51. package/dist/reference/errors/MOSTRA_ENV_BIND_FAILED.md +23 -0
  52. package/dist/reference/errors/MOSTRA_ENV_BROWSER_MISSING.md +23 -0
  53. package/dist/reference/errors/MOSTRA_ENV_BUNDLE_DOWNLOAD_FAILED.md +23 -0
  54. package/dist/reference/errors/MOSTRA_ENV_BUNDLE_INVALID.md +23 -0
  55. package/dist/reference/errors/MOSTRA_ENV_BUNDLE_UNAVAILABLE.md +23 -0
  56. package/dist/reference/errors/MOSTRA_ENV_HELPER_MISSING.md +23 -0
  57. package/dist/reference/errors/MOSTRA_ENV_NODE_UNSUPPORTED.md +23 -0
  58. package/dist/reference/errors/MOSTRA_ENV_PORT_TAKEN.md +23 -0
  59. package/dist/reference/errors/MOSTRA_ENV_RUNTIME_INSTALLING.md +23 -0
  60. package/dist/reference/errors/MOSTRA_ENV_RUNTIME_MISSING.md +23 -0
  61. package/dist/reference/errors/MOSTRA_ENV_SERVICE_FAILED.md +23 -0
  62. package/dist/reference/errors/MOSTRA_ENV_SHELL_MISSING.md +23 -0
  63. package/dist/reference/errors/MOSTRA_ENV_WARM_MISSING.md +23 -0
  64. package/dist/reference/errors/MOSTRA_FIELD_CONFLICT.md +23 -0
  65. package/dist/reference/errors/MOSTRA_FIELD_DUPLICATE_ID.md +23 -0
  66. package/dist/reference/errors/MOSTRA_FIELD_ID_INVALID.md +23 -0
  67. package/dist/reference/errors/MOSTRA_FIELD_ID_UNSTABLE.md +23 -0
  68. package/dist/reference/errors/MOSTRA_FIELD_MUTATION_ID_REUSED.md +23 -0
  69. package/dist/reference/errors/MOSTRA_FIELD_SHARED.md +23 -0
  70. package/dist/reference/errors/MOSTRA_FIELD_TOO_LARGE.md +23 -0
  71. package/dist/reference/errors/MOSTRA_FIELD_UNBOUND.md +23 -0
  72. package/dist/reference/errors/MOSTRA_HOME_DISK_FULL.md +23 -0
  73. package/dist/reference/errors/MOSTRA_HOME_GC_INCOMPLETE.md +23 -0
  74. package/dist/reference/errors/MOSTRA_HOME_GONE.md +23 -0
  75. package/dist/reference/errors/MOSTRA_HOME_INTEGRITY.md +23 -0
  76. package/dist/reference/errors/MOSTRA_HOME_LEDGER_UNREADABLE.md +23 -0
  77. package/dist/reference/errors/MOSTRA_HOME_LOCKED.md +23 -0
  78. package/dist/reference/errors/MOSTRA_HOME_MISMATCH.md +23 -0
  79. package/dist/reference/errors/MOSTRA_HOME_NETWORK_FILESYSTEM.md +23 -0
  80. package/dist/reference/errors/MOSTRA_HOME_NOT_ALWAYS_ON.md +23 -0
  81. package/dist/reference/errors/MOSTRA_HOME_NOT_OWNED.md +23 -0
  82. package/dist/reference/errors/MOSTRA_HOME_SOCKET_TOO_LONG.md +23 -0
  83. package/dist/reference/errors/MOSTRA_HOME_TOO_NEW.md +23 -0
  84. package/dist/reference/errors/MOSTRA_HOST_CONNECTION_CLOSED.md +23 -0
  85. package/dist/reference/errors/MOSTRA_HOST_CURSOR_COMPACTED.md +23 -0
  86. package/dist/reference/errors/MOSTRA_HOST_IDENTITY_UNAVAILABLE.md +23 -0
  87. package/dist/reference/errors/MOSTRA_HOST_INITIALIZE_ORDER.md +23 -0
  88. package/dist/reference/errors/MOSTRA_HOST_INTERNAL_ERROR.md +23 -0
  89. package/dist/reference/errors/MOSTRA_HOST_INVALID_PARAMS.md +23 -0
  90. package/dist/reference/errors/MOSTRA_HOST_MALFORMED.md +23 -0
  91. package/dist/reference/errors/MOSTRA_HOST_MESSAGE_TOO_LARGE.md +23 -0
  92. package/dist/reference/errors/MOSTRA_HOST_METHOD_UNKNOWN.md +23 -0
  93. package/dist/reference/errors/MOSTRA_HOST_NOTIFICATION_UNSUPPORTED.md +23 -0
  94. package/dist/reference/errors/MOSTRA_HOST_PORT_UNSUPPORTED.md +23 -0
  95. package/dist/reference/errors/MOSTRA_HOST_REQUEST_ID_REUSED.md +23 -0
  96. package/dist/reference/errors/MOSTRA_HOST_REVISION_UNSUPPORTED.md +23 -0
  97. package/dist/reference/errors/MOSTRA_HOST_SHUTDOWN_REFUSED.md +23 -0
  98. package/dist/reference/errors/MOSTRA_HOST_SUBSCRIPTION_UNKNOWN.md +23 -0
  99. package/dist/reference/errors/MOSTRA_HOST_TIMEOUT.md +23 -0
  100. package/dist/reference/errors/MOSTRA_HYGIENE_CONTENT_TYPE.md +23 -0
  101. package/dist/reference/errors/MOSTRA_HYGIENE_CSRF_MISSING.md +23 -0
  102. package/dist/reference/errors/MOSTRA_HYGIENE_FRAME_SESSION.md +23 -0
  103. package/dist/reference/errors/MOSTRA_HYGIENE_HEADERS_TOO_LARGE.md +23 -0
  104. package/dist/reference/errors/MOSTRA_HYGIENE_HOST_REFUSED.md +23 -0
  105. package/dist/reference/errors/MOSTRA_HYGIENE_NOT_SERVED.md +23 -0
  106. package/dist/reference/errors/MOSTRA_HYGIENE_ORIGIN_REFUSED.md +23 -0
  107. package/dist/reference/errors/MOSTRA_HYGIENE_RATE_LIMITED.md +23 -0
  108. package/dist/reference/errors/MOSTRA_HYGIENE_REQUEST_MALFORMED.md +23 -0
  109. package/dist/reference/errors/MOSTRA_HYGIENE_SCOPE_DENIED.md +23 -0
  110. package/dist/reference/errors/MOSTRA_HYGIENE_SESSION_CONFLICT.md +23 -0
  111. package/dist/reference/errors/MOSTRA_HYGIENE_SESSION_MISSING.md +23 -0
  112. package/dist/reference/errors/MOSTRA_HYGIENE_TOKEN_INVALID.md +23 -0
  113. package/dist/reference/errors/MOSTRA_HYGIENE_TOKEN_REVOKED.md +23 -0
  114. package/dist/reference/errors/MOSTRA_LIVE_SOURCE_FAILED.md +23 -0
  115. package/dist/reference/errors/MOSTRA_LIVE_TOO_LARGE.md +23 -0
  116. package/dist/reference/errors/MOSTRA_MANIFEST_INVALID.md +23 -0
  117. package/dist/reference/errors/MOSTRA_MANIFEST_NOT_LITERAL.md +23 -0
  118. package/dist/reference/errors/MOSTRA_MANIFEST_UNKNOWN_KEY.md +23 -0
  119. package/dist/reference/errors/MOSTRA_NETWORK_EXTERNAL_FAILED.md +23 -0
  120. package/dist/reference/errors/MOSTRA_NETWORK_REQUEST_FAILED.md +23 -0
  121. package/dist/reference/errors/MOSTRA_PLATFORM_UNSUPPORTED.md +23 -0
  122. package/dist/reference/errors/MOSTRA_PUBLISH_ID_CONFLICT.md +23 -0
  123. package/dist/reference/errors/MOSTRA_PUBLISH_SOURCE_CHANGED.md +23 -0
  124. package/dist/reference/errors/MOSTRA_PUBLISH_VERIFY_FAILED.md +23 -0
  125. package/dist/reference/errors/MOSTRA_REGRESSION_ACTION_REMOVED.md +23 -0
  126. package/dist/reference/errors/MOSTRA_REGRESSION_ARIA.md +23 -0
  127. package/dist/reference/errors/MOSTRA_REGRESSION_FIELD_REMOVED.md +23 -0
  128. package/dist/reference/errors/MOSTRA_REGRESSION_LIVE_REMOVED.md +23 -0
  129. package/dist/reference/errors/MOSTRA_REGRESSION_PAGE_REMOVED.md +23 -0
  130. package/dist/reference/errors/MOSTRA_REGRESSION_PIXELS.md +23 -0
  131. package/dist/reference/errors/MOSTRA_REMOTE_CONFIG_INVALID.md +23 -0
  132. package/dist/reference/errors/MOSTRA_REMOTE_HOME_MOVING.md +23 -0
  133. package/dist/reference/errors/MOSTRA_REMOTE_HOME_SUSPENDED.md +23 -0
  134. package/dist/reference/errors/MOSTRA_REMOTE_LIMIT_REACHED.md +23 -0
  135. package/dist/reference/errors/MOSTRA_REMOTE_LOGIN_FAILED.md +23 -0
  136. package/dist/reference/errors/MOSTRA_REMOTE_NOT_OWNER_INSTANCE.md +23 -0
  137. package/dist/reference/errors/MOSTRA_REMOTE_NO_INSTANCE.md +23 -0
  138. package/dist/reference/errors/MOSTRA_REMOTE_OPERATOR_UNAVAILABLE.md +23 -0
  139. package/dist/reference/errors/MOSTRA_REMOTE_OWNER_OFFLINE.md +23 -0
  140. package/dist/reference/errors/MOSTRA_REMOTE_PAUSED_BY_OPERATOR.md +23 -0
  141. package/dist/reference/errors/MOSTRA_REMOTE_QUEUE_FULL.md +23 -0
  142. package/dist/reference/errors/MOSTRA_REMOTE_RATE_LIMITED.md +23 -0
  143. package/dist/reference/errors/MOSTRA_REMOTE_SIGN_IN_REQUIRED.md +23 -0
  144. package/dist/reference/errors/MOSTRA_REMOTE_UNDER_REVIEW.md +23 -0
  145. package/dist/reference/errors/MOSTRA_REMOTE_UNREACHABLE.md +23 -0
  146. package/dist/reference/errors/MOSTRA_RUNTIME_BLANK.md +23 -0
  147. package/dist/reference/errors/MOSTRA_RUNTIME_NOT_READY.md +23 -0
  148. package/dist/reference/errors/MOSTRA_RUNTIME_PAGE_ERROR.md +23 -0
  149. package/dist/reference/errors/MOSTRA_RUNTIME_WORKER_CRASHED.md +23 -0
  150. package/dist/reference/errors/MOSTRA_RUNTIME_WORKER_PARKED.md +23 -0
  151. package/dist/reference/errors/MOSTRA_SECRET_MISSING.md +23 -0
  152. package/dist/reference/errors/MOSTRA_SHARE_NOT_ENABLED.md +23 -0
  153. package/dist/reference/errors/MOSTRA_SHARE_NOT_FOUND.md +23 -0
  154. package/dist/reference/errors/MOSTRA_SHARE_PORTS_EXHAUSTED.md +23 -0
  155. package/dist/reference/errors/MOSTRA_SHARE_TOOL_MISSING.md +23 -0
  156. package/dist/reference/errors/MOSTRA_SHARE_TOOL_NOT_READY.md +23 -0
  157. package/dist/reference/errors/MOSTRA_SHARE_TTL_INVALID.md +23 -0
  158. package/dist/reference/errors/MOSTRA_SHARE_TUNNEL_FAILED.md +23 -0
  159. package/dist/reference/errors/MOSTRA_SMOKE_BUDGET.md +23 -0
  160. package/dist/reference/errors/MOSTRA_SMOKE_NO_EFFECT.md +23 -0
  161. package/dist/reference/errors/MOSTRA_SUBMIT_ALREADY.md +23 -0
  162. package/dist/reference/errors/MOSTRA_SUBMIT_BLOCKED.md +23 -0
  163. package/dist/reference/errors/MOSTRA_SUBMIT_CHANNEL_DENIED.md +23 -0
  164. package/dist/reference/errors/MOSTRA_SUBMIT_NOT_FOUND.md +23 -0
  165. package/dist/reference/errors/MOSTRA_SUBMIT_PAUSED.md +23 -0
  166. package/dist/reference/errors/MOSTRA_SUBMIT_POLICY_NONE.md +23 -0
  167. package/dist/reference/errors/MOSTRA_SUBMIT_REVISION_MOVED.md +23 -0
  168. package/dist/reference/errors/MOSTRA_SUBMIT_SIGNAL_INVALID.md +23 -0
  169. package/dist/reference/errors/MOSTRA_SUBMIT_VIEW_INVALID.md +23 -0
  170. package/dist/reference/errors/MOSTRA_TARGET_UNAVAILABLE.md +23 -0
  171. package/dist/reference/errors/MOSTRA_TEAM_PRESENCE_RATE_LIMITED.md +23 -0
  172. package/dist/reference/errors/MOSTRA_TEAM_ROSTER_POLICY.md +23 -0
  173. package/dist/reference/errors/MOSTRA_TEAM_ROSTER_TOO_LARGE.md +23 -0
  174. package/dist/reference/errors/MOSTRA_TYPE_ERROR.md +23 -0
  175. package/dist/reference/errors/MOSTRA_TYPE_UNTYPED_PACKAGE.md +23 -0
  176. package/dist/reference/errors/MOSTRA_VERIFY_ACTION_SKIPPED.md +23 -0
  177. package/dist/reference/errors/MOSTRA_VERIFY_BASELINE_MISSING.md +23 -0
  178. package/dist/reference/errors/MOSTRA_VERIFY_CRASHED.md +23 -0
  179. package/dist/reference/errors/MOSTRA_VERIFY_LIVE_FAILED.md +23 -0
  180. package/dist/reference/errors/MOSTRA_VERIFY_NO_BASELINE.md +23 -0
  181. package/dist/reference/errors/MOSTRA_VERIFY_SECRET_MISSING.md +23 -0
  182. package/dist/reference/errors/MOSTRA_VERIFY_SKIP_CONSEQUENCE.md +23 -0
  183. package/dist/reference/errors/MOSTRA_VERIFY_TIMEOUT.md +23 -0
  184. package/dist/reference/self-hosting.md +130 -0
  185. package/dist/reference/telemetry.md +84 -0
  186. package/dist/skill/SKILL.md +124 -0
  187. package/dist/skill/assets/examples/dashboard/index.tsx +161 -0
  188. package/dist/skill/assets/examples/dashboard/live.ts +25 -0
  189. package/dist/skill/assets/examples/dashboard/styles.css +125 -0
  190. package/dist/skill/assets/examples/decision/index.tsx +95 -0
  191. package/dist/skill/assets/examples/decision/styles.css +125 -0
  192. package/dist/skill/assets/examples/inbox/actions.ts +23 -0
  193. package/dist/skill/assets/examples/inbox/index.tsx +109 -0
  194. package/dist/skill/assets/examples/inbox/styles.css +125 -0
  195. package/dist/skill/assets/studio.css +125 -0
  196. package/dist/skill/references/answers.md +219 -0
  197. package/dist/skill/references/design.md +154 -0
  198. package/dist/skill/references/libraries.md +167 -0
  199. package/dist/skill/references/long-lived.md +148 -0
  200. package/dist/skill/references/mcp.md +68 -0
  201. package/dist/skill/references/page.md +131 -0
  202. package/dist/skill/references/server.md +146 -0
  203. package/dist/skill/references/sharing.md +123 -0
  204. package/dist/skill/references/teams.md +78 -0
  205. package/dist/skill/references/verify.md +71 -0
  206. package/package.json +10 -5
  207. package/src/gateway/actions.ts +20 -0
  208. package/src/gateway/browser.ts +128 -1
  209. package/src/gateway/capabilities.ts +8 -0
  210. package/src/gateway/http.ts +12 -1
  211. package/src/gateway/index.ts +210 -6
  212. package/src/gateway/listener.ts +31 -6
  213. package/src/gateway/routes.ts +8 -0
  214. package/src/gateway/team.ts +181 -0
  215. package/src/gc/index.ts +5 -0
  216. package/src/instance/index.ts +22 -2
  217. package/src/interaction/ephemeral.ts +21 -0
  218. package/src/interaction/events.ts +17 -0
  219. package/src/interaction/index.ts +325 -20
  220. package/src/interaction/pause.ts +106 -0
  221. package/src/interaction/roster.ts +585 -0
  222. package/src/interaction/submissions.ts +42 -1
  223. package/src/interaction/team.ts +426 -0
  224. package/src/interaction/viewers.ts +34 -1
  225. package/src/interaction/wait.ts +150 -0
  226. package/src/ledger/index.ts +20 -1
  227. package/src/ledger/migrations.ts +86 -0
  228. package/src/link/author.ts +215 -0
  229. package/src/link/hosted.ts +51 -4
  230. package/src/link/http.ts +6 -1
  231. package/src/link/index.ts +3 -1
  232. package/src/link/manager.ts +169 -35
  233. package/src/protocol-server/client.ts +53 -0
  234. package/src/protocol-server/index.ts +1 -1
  235. package/src/server/api.ts +514 -72
  236. package/src/server/auth.ts +600 -74
  237. package/src/server/authorize.ts +816 -0
  238. package/src/server/clients.ts +235 -0
  239. package/src/server/config.ts +7 -0
  240. package/src/server/data.ts +59 -1
  241. package/src/server/directory.ts +91 -0
  242. package/src/server/feed.ts +277 -0
  243. package/src/server/handle.ts +172 -0
  244. package/src/server/hosted-pages.ts +532 -0
  245. package/src/server/hosted.ts +551 -18
  246. package/src/server/index.ts +353 -61
  247. package/src/server/mcp.ts +330 -0
  248. package/src/server/metering.ts +156 -0
  249. package/src/server/oauth-clients.ts +510 -0
  250. package/src/server/operator.ts +557 -0
  251. package/src/server/providers.ts +284 -0
  252. package/src/server/remove.ts +148 -0
  253. package/src/server/routing.ts +275 -0
  254. package/src/share/index.ts +50 -2
  255. package/src/verify/index.ts +7 -0
  256. package/src/verify/runner.ts +27 -2
  257. package/dist/instance-FExcyENK.js.map +0 -1
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: mostra
3
+ description: Communicate visually with the user through Mostra. Use whenever showing or asking works better as a page than as chat text, such as questions to answer, options to choose between, a plan to approve, work to review, a report, a dashboard, a demo, or a page kept up to date. You write an ordinary React page, Mostra verifies it, publishes it behind a private link, and returns the person's answers to you.
4
+ license: Apache-2.0
5
+ compatibility: Needs a shell that runs `mostra` (or `npx` with Node.js 22.19 or later) on macOS, Linux or Windows, x64 or arm64.
6
+ metadata:
7
+ version: "0.12.0"
8
+ ---
9
+
10
+ # Mostra
11
+
12
+ Mostra turns a React page you write into an **artifact**: a web page a person opens from a private link, reads, answers, and acts on. Their answers are saved as they type, submitted once they're done, and come back to you as **results**. You check every page with `verify` before anyone sees it, so you never send a page you haven't looked at.
13
+
14
+ ## Running Mostra
15
+
16
+ Run `mostra <command>`. When `mostra` isn't on the `PATH`, run `npx -y @mostra/cli@0.12.0 <command>` everywhere this Skill says `mostra`; the first run downloads Mostra's own runtime (no global Node.js needed beyond `npx`). Every command takes `--json` (one JSON envelope on stdout, logs on stderr) and `--help`. `mostra docs <topic>` prints the reference, including every diagnostic code's page (`mostra docs MOSTRA_FIELD_DUPLICATE_ID`). `mostra list` lists the artifacts you've published, and `mostra status` shows the running instance.
17
+
18
+ When Mostra's tools are in your tool list (`artifact_create`, `artifact_verify` and the rest), use them instead: each step below has its tool, and everything else here holds unchanged. See [references/mcp.md](references/mcp.md).
19
+
20
+ A link that starts with `http://127.0.0.1` opens only on the computer Mostra runs on. When you run in a cloud sandbox (a chat app's code execution, a remote container), the person can't open it: use Mostra's tools from a connector when you have them, and otherwise say so and offer to share the page ([references/sharing.md](references/sharing.md)).
21
+
22
+ ## Words
23
+
24
+ | Word | Meaning |
25
+ |---|---|
26
+ | artifact | One page (or a few, under `pages/`) in its own directory, with a stable `art_…` ID |
27
+ | version | One published, immutable build of an artifact. People only ever see versions |
28
+ | field | One saved answer with a stable string ID: `useField("budget", 0)` |
29
+ | submission | The immutable snapshot of a person's answers, made when they submit |
30
+ | capability URL | The private link. Whoever holds it can use the artifact; treat it like a password |
31
+ | trusted control | The Submit (and Choose) button Mostra draws outside your page, so the person knows it's real |
32
+ | results | The submission as Markdown or JSON: answers by label, choices, comments, actions |
33
+
34
+ ## The loop
35
+
36
+ Each step ends when its check holds. Don't hand a link out before step 4 passes.
37
+
38
+ 1. **Decide what the person does.** Write one sentence: who it's for, what they do, what comes back to you. Pick the submission policy: `once` (the default: one submission, then it's closed), `epochs` (they can submit again, each round kept), or `none` (a long-lived page that never submits, such as a dashboard or task list: see [references/long-lived.md](references/long-lived.md)). *Done when* the sentence names the answers you need.
39
+ 2. **Create it.** `mostra new <dir> --title "<title>"` writes `index.tsx` (with the artifact's `id`; keep it) and an `AGENTS.md` for whoever edits it next. *Done when* the directory exists.
40
+ 3. **Write the page.** Ordinary React 19 and TypeScript with Tailwind CSS 4, no `package.json`, no build config. Every answer is a field with a stable ID:
41
+
42
+ ```tsx
43
+ import { defineArtifact, useField, useSubmitControl } from "@mostra/react";
44
+
45
+ export const artifact = defineArtifact({
46
+ title: "Sidebar redesign: your call",
47
+ description: "Pick a direction and say why.",
48
+ submission: { policy: "once" },
49
+ });
50
+
51
+ export default function Page() {
52
+ const [direction, setDirection] = useField("direction", "", { label: "Direction", required: true });
53
+ const [why, setWhy] = useField("why", "", { label: "Why" });
54
+ useSubmitControl({ label: "Send my choice" });
55
+ // …render radios bound to direction, a textarea bound to why
56
+ }
57
+ ```
58
+
59
+ Mostra draws the Submit button in its own frame around your page; `useSubmitControl` names it, and `required` fields block it until they're answered. Make it look considered: [references/design.md](references/design.md) has a baseline stylesheet and the rules for pages people answer. *Done when* every answer you need is a field with a label.
60
+ 4. **Verify until it passes.** `mostra verify <dir> --screenshots always`. It type-checks, builds, renders the page headlessly, clicks through it, runs an accessibility check and screenshots it at 1280×800 and 390×844. Fix every error, then **open both screenshots and look at them** (about 1,300 and 450 image tokens). Warnings that start with "Observed only" describe what verify saw; judge them, and leave working code alone. *Done when* the status is `pass` and the screenshots show what you meant at both sizes. More in [references/verify.md](references/verify.md).
61
+ 5. **Publish.** `mostra publish <dir>` prints the version and the capability URL. Publishing again after an edit makes a new version; open pages offer the person the new one, and answers carry over by field ID. *Done when* you have the link.
62
+ 6. **Hand the link over.** Say who is asking and why, what the page is for, and roughly how long it takes. For the person at this machine, `mostra open <dir> --browser` opens it in their browser, and its output says when none could be opened. For a phone or another person, see [references/sharing.md](references/sharing.md): one link is one person's draft, so give each person their own link. For several people, name them with `mostra roster add` and wait for all of them: [references/teams.md](references/teams.md). *Done when* the person has the link and knows what to do.
63
+ 7. **Wait for the answer.** `mostra wait <dir> --until submitted --timeout 10m`. Exit code 0 means submitted; 5 means still waiting, with nothing lost: wait again, or continue other work and check later. *Done when* it exits 0.
64
+ 8. **Read the results.** `mostra results <dir>` prints the submission as Markdown (`--format json` for JSON). Act on it. *Done when* you've used every answer.
65
+
66
+ ## What a page can do
67
+
68
+ | Need | Use | Reference |
69
+ |---|---|---|
70
+ | Save an answer, a choice, a note | `useField(id, initial, { label, required, validate })` | [answers.md](references/answers.md) |
71
+ | A form with validation | `useForm` from `@mostra/react/form` (react-hook-form) | [answers.md](references/answers.md) |
72
+ | Name or confirm the trusted Submit | `useSubmitControl({ label, confirm })` | [answers.md](references/answers.md) |
73
+ | Let the person ping you without submitting | `useSignal(name).send(payload)`, then `mostra wait <dir> --until signal:<name>` | [answers.md](references/answers.md) |
74
+ | Choose one of several candidates | `useChoice(reviewSetId, { candidates })` | [answers.md](references/answers.md) |
75
+ | A button that does something real (send, file, deploy) | a `"use server"` function, run with `useAction(fn, { key })` | [server.md](references/server.md) |
76
+ | Secrets for that code | `mostra secret set NAME`, then `secret("NAME")` in server code | [server.md](references/server.md) |
77
+ | Data that updates by itself | `defineLive` in `live.ts`, `useLive(key)` in the page, `mostra push` from you | [long-lived.md](references/long-lived.md) |
78
+ | State everyone shares and you can edit | `useField(id, initial, { scope: "artifact" })`, `mostra state set` | [long-lived.md](references/long-lived.md) |
79
+ | Show who answered, who is here, who changed what | `useRespondents()`, `usePresence({ cursor })`, a shared field's `meta.updatedBy` | [teams.md](references/teams.md) |
80
+ | Several pages, packages, MDX, images | `pages/`, any npm import, `index.mdx`, `public/` | [page.md](references/page.md) |
81
+ | Charts, tables, animation, UI primitives | the preinstalled libraries | [libraries.md](references/libraries.md) |
82
+
83
+ ## Rules verify enforces
84
+
85
+ - **Field IDs are stable.** A literal string (`useField("budget", …)`), or a template keyed by your data's own ID for a list (`` useField(`reply.${email.id}`, …) ``); never an array index or a random value. Changing an ID between versions leaves the old answer behind ("Not carried over"). An ID used twice with different types is an error.
86
+ - **The manifest is a literal.** `defineArtifact({...})` holds only literal values; Mostra reads it without running your code.
87
+ - **Imports stay inside the artifact directory.** Packages install on demand; `@/…` imports from the artifact's root.
88
+ - **Server code is opt-in for verify.** Verify never runs a `"use server"` function unless it checks `dryRun()` and skips its side effects. The others are reported as skipped, which is fine.
89
+ - **No browser errors.** Uncaught errors, console errors and failed requests to your own origin are errors; a blank page is an error.
90
+
91
+ ## Codes you'll meet most
92
+
93
+ | Code | What to do |
94
+ |---|---|
95
+ | `MOSTRA_TYPE_ERROR` | Fix the TypeScript error at the location given |
96
+ | `MOSTRA_BUILD_UNRESOLVED` | Import from inside the artifact, or a package by its name |
97
+ | `MOSTRA_MANIFEST_NOT_LITERAL` | Write the manifest's values as literals |
98
+ | `MOSTRA_FIELD_DUPLICATE_ID`, `MOSTRA_FIELD_ID_UNSTABLE` | Give each field one stable ID |
99
+ | `MOSTRA_RUNTIME_PAGE_ERROR`, `MOSTRA_CONSOLE_ERROR`, `MOSTRA_RUNTIME_BLANK` | Fix the page's runtime error; look at the screenshot |
100
+ | `MOSTRA_VERIFY_ACTION_SKIPPED` | A hint: that action didn't run in verify. Add a `dryRun()` branch if you want it exercised |
101
+ | `MOSTRA_SMOKE_NO_EFFECT`, `MOSTRA_REGRESSION_*` | Observed only: check the screenshot, change nothing that works |
102
+ | `MOSTRA_PUBLISH_VERIFY_FAILED` | Publish refused because verify failed: run verify and fix its errors |
103
+ | `MOSTRA_SUBMIT_NOT_FOUND` | Nothing submitted yet: wait for it |
104
+
105
+ Every code's page: `mostra docs <CODE>`.
106
+
107
+ ## References
108
+
109
+ Read the one you need when you need it.
110
+
111
+ | File | Read it when |
112
+ |---|---|
113
+ | [references/page.md](references/page.md) | Structuring the artifact: files, manifest, pages, packages, MDX, links out, `window.storage` |
114
+ | [references/answers.md](references/answers.md) | Collecting answers: fields, forms, submission policies, signals, choices, `wait` and `results` |
115
+ | [references/design.md](references/design.md) | Before writing the page's markup: the baseline stylesheet and the design rules |
116
+ | [references/verify.md](references/verify.md) | Verify fails, or you want to understand a verdict, screenshots or `mostra dev` |
117
+ | [references/server.md](references/server.md) | The page must do something real: actions, secrets, idempotency |
118
+ | [references/long-lived.md](references/long-lived.md) | A page that lives for days: shared state, live data, `none` policy, always-on |
119
+ | [references/sharing.md](references/sharing.md) | Someone other than the person at this machine opens it, or on another device |
120
+ | [references/teams.md](references/teams.md) | Several people answer it or work on it together: personal links, waiting for everyone, who is here |
121
+ | [references/libraries.md](references/libraries.md) | Using charts, tables, motion or UI primitives, or an import fails |
122
+ | [references/mcp.md](references/mcp.md) | You work through Mostra's tools (`artifact_create` and the rest) instead of the `mostra` command |
123
+
124
+ Three complete artifacts that pass verify, to copy from: [assets/examples/decision/](assets/examples/decision/) (a choice with a reason), [assets/examples/inbox/](assets/examples/inbox/) (drafted replies with real Send actions) and [assets/examples/dashboard/](assets/examples/dashboard/) (live data and a shared list). The same guide is `mostra docs guide`, and each reference `mostra docs guide/<name>`.
@@ -0,0 +1,161 @@
1
+ import "./styles.css";
2
+ import { defineArtifact, useField, useLive } from "@mostra/react";
3
+ import { useState } from "react";
4
+ import { Bar, BarChart, CartesianGrid, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
5
+
6
+ export const artifact = defineArtifact({
7
+ title: "Deploys this week",
8
+ description: "Updated every minute. Tick off priorities as they land; I read the list too.",
9
+ family: "dashboard",
10
+ submission: { policy: "none" },
11
+ });
12
+
13
+ interface Priority {
14
+ readonly id: string;
15
+ readonly title: string;
16
+ readonly done: boolean;
17
+ }
18
+
19
+ function Figure({ label, value, note }: { label: string; value: string; note: string }) {
20
+ return (
21
+ <div className="px-5 py-4">
22
+ <dt className="text-sm text-muted-foreground">{label}</dt>
23
+ <dd className="mt-1 text-2xl font-semibold tabular-nums">{value}</dd>
24
+ <dd className="mt-1 text-sm text-muted-foreground">{note}</dd>
25
+ </div>
26
+ );
27
+ }
28
+
29
+ export default function Page() {
30
+ const live = useLive("deploys");
31
+ const [priorities, setPriorities] = useField("priorities", [] as Priority[], {
32
+ label: "Priorities",
33
+ scope: "artifact",
34
+ });
35
+ const [draft, setDraft] = useState("");
36
+ const data = live.data;
37
+
38
+ const add = () => {
39
+ const title = draft.trim();
40
+ if (title === "") return;
41
+ setPriorities((list) => [...list, { id: crypto.randomUUID(), title, done: false }]);
42
+ setDraft("");
43
+ };
44
+
45
+ return (
46
+ <main className="mx-auto max-w-5xl px-6 py-12">
47
+ <header className="flex flex-wrap items-baseline justify-between gap-2">
48
+ <h1 className="text-2xl font-semibold tracking-tight">{artifact.title}</h1>
49
+ <p className="text-sm text-muted-foreground" aria-live="polite">
50
+ {live.error
51
+ ? "Couldn't refresh; showing the last good numbers."
52
+ : live.at
53
+ ? `Updated ${new Date(live.at).toLocaleTimeString()}`
54
+ : "Loading…"}
55
+ </p>
56
+ </header>
57
+
58
+ <dl className="mt-8 grid divide-y rounded-lg border bg-card sm:grid-cols-3 sm:divide-x sm:divide-y-0">
59
+ <Figure
60
+ label="Deploys today"
61
+ value={data ? String(data.today) : "–"}
62
+ note="since midnight"
63
+ />
64
+ <Figure
65
+ label="Failed today"
66
+ value={data ? String(data.failed) : "–"}
67
+ note="rolled back automatically"
68
+ />
69
+ <Figure
70
+ label="Median deploy time"
71
+ value={data ? `${data.medianMinutes.toFixed(1)} min` : "–"}
72
+ note="last 50 deploys"
73
+ />
74
+ </dl>
75
+
76
+ <div className="mt-6 grid gap-6 lg:grid-cols-[1fr_20rem]">
77
+ <section className="rounded-lg border bg-card p-5">
78
+ <h2 className="font-medium">Deploys per day</h2>
79
+ <div className="mt-4 h-56">
80
+ {data ? (
81
+ <ResponsiveContainer width="100%" height="100%">
82
+ <BarChart
83
+ data={[...data.lastDays]}
84
+ margin={{ top: 4, right: 4, bottom: 0, left: -20 }}
85
+ >
86
+ <CartesianGrid vertical={false} stroke="var(--border)" />
87
+ <XAxis dataKey="day" tickLine={false} axisLine={false} fontSize={12} />
88
+ <YAxis allowDecimals={false} tickLine={false} axisLine={false} fontSize={12} />
89
+ <Tooltip cursor={{ fill: "var(--muted)" }} />
90
+ <Bar
91
+ dataKey="deploys"
92
+ name="Deploys"
93
+ fill="var(--chart-1)"
94
+ radius={[4, 4, 0, 0]}
95
+ />
96
+ </BarChart>
97
+ </ResponsiveContainer>
98
+ ) : (
99
+ <div className="h-full rounded-md bg-muted" />
100
+ )}
101
+ </div>
102
+ </section>
103
+
104
+ <section className="rounded-lg border bg-card p-5">
105
+ <h2 className="font-medium">Priorities</h2>
106
+ {priorities.length === 0 ? (
107
+ <p className="mt-3 text-sm text-muted-foreground">
108
+ Nothing yet. Add the first one below.
109
+ </p>
110
+ ) : (
111
+ <ul className="mt-3 space-y-2">
112
+ {priorities.map((item) => (
113
+ <li key={item.id}>
114
+ <label className="flex items-start gap-3 text-sm">
115
+ <input
116
+ type="checkbox"
117
+ checked={item.done}
118
+ onChange={() =>
119
+ setPriorities((list) =>
120
+ list.map((p) => (p.id === item.id ? { ...p, done: !p.done } : p)),
121
+ )
122
+ }
123
+ className="mt-0.5 size-4 accent-primary"
124
+ />
125
+ <span className={item.done ? "text-muted-foreground line-through" : ""}>
126
+ {item.title}
127
+ </span>
128
+ </label>
129
+ </li>
130
+ ))}
131
+ </ul>
132
+ )}
133
+ <form
134
+ className="mt-4 flex gap-2"
135
+ onSubmit={(event) => {
136
+ event.preventDefault();
137
+ add();
138
+ }}
139
+ >
140
+ <label className="sr-only" htmlFor="new-priority">
141
+ New priority
142
+ </label>
143
+ <input
144
+ id="new-priority"
145
+ value={draft}
146
+ onChange={(event) => setDraft(event.target.value)}
147
+ placeholder="Add a priority…"
148
+ className="min-w-0 flex-1 rounded-md border border-input bg-background px-3 py-1.5 text-sm"
149
+ />
150
+ <button
151
+ type="submit"
152
+ className="rounded-md border px-3 py-1.5 text-sm font-medium hover:bg-muted"
153
+ >
154
+ Add
155
+ </button>
156
+ </form>
157
+ </section>
158
+ </div>
159
+ </main>
160
+ );
161
+ }
@@ -0,0 +1,25 @@
1
+ import { defineLive } from "@mostra/server";
2
+
3
+ export interface Deploys {
4
+ readonly today: number;
5
+ readonly failed: number;
6
+ readonly medianMinutes: number;
7
+ readonly lastDays: readonly { readonly day: string; readonly deploys: number }[];
8
+ }
9
+
10
+ /** Reloads every minute while someone looks. Replace the body with a call to your CI's API. */
11
+ export const deploys = defineLive({
12
+ refresh: "1m",
13
+ load: async (): Promise<Deploys> => ({
14
+ today: 14,
15
+ failed: 1,
16
+ medianMinutes: 6.4,
17
+ lastDays: [
18
+ { day: "Mon", deploys: 11 },
19
+ { day: "Tue", deploys: 17 },
20
+ { day: "Wed", deploys: 9 },
21
+ { day: "Thu", deploys: 15 },
22
+ { day: "Fri", deploys: 14 },
23
+ ],
24
+ }),
25
+ });
@@ -0,0 +1,125 @@
1
+ @import "tailwindcss";
2
+
3
+ /*
4
+ * Studio: Mostra's quiet baseline theme. White and warm grey surfaces, near-black text, one blue
5
+ * for the main action and focus, and a yellow `answer` reserved for what the person answered or
6
+ * chose. Change any value; nothing depends on it.
7
+ */
8
+ :root {
9
+ --background: oklch(1 0 0);
10
+ --foreground: oklch(0.191 0 0);
11
+ --card: oklch(1 0 0);
12
+ --card-foreground: oklch(0.191 0 0);
13
+ --muted: oklch(0.972 0.004 106.5);
14
+ --muted-foreground: oklch(0.466 0.008 106.7);
15
+ --border: oklch(0.917 0.008 106.6);
16
+ --input: oklch(0.88 0.009 106.6);
17
+ --primary: oklch(0.45 0.212 267);
18
+ --primary-foreground: oklch(1 0 0);
19
+ --secondary: oklch(0.957 0.004 106.5);
20
+ --secondary-foreground: oklch(0.191 0 0);
21
+ --accent: oklch(0.959 0.015 273.9);
22
+ --accent-foreground: oklch(0.37 0.173 267.5);
23
+ --destructive: oklch(0.541 0.198 32);
24
+ --success: oklch(0.513 0.111 161.3);
25
+ --warning: oklch(0.528 0.109 82.4);
26
+ --answer: oklch(0.814 0.167 83.9);
27
+ --ring: oklch(0.45 0.212 267);
28
+ --chart-1: oklch(0.45 0.212 267);
29
+ --chart-2: oklch(0.627 0.201 33);
30
+ --chart-3: oklch(0.559 0.192 301.5);
31
+ --chart-4: oklch(0.561 0.121 160.3);
32
+ --chart-5: oklch(0.651 0.135 80.9);
33
+ --chart-6: oklch(0.586 0.176 358.8);
34
+ --radius: 0.625rem;
35
+ }
36
+
37
+ @media (prefers-color-scheme: dark) {
38
+ :root {
39
+ --background: oklch(0.178 0.006 271);
40
+ --foreground: oklch(0.96 0.004 106.5);
41
+ --card: oklch(0.205 0.008 274.5);
42
+ --card-foreground: oklch(0.96 0.004 106.5);
43
+ --muted: oklch(0.223 0.01 276.6);
44
+ --muted-foreground: oklch(0.717 0.007 286.2);
45
+ --border: oklch(0.29 0.011 278.2);
46
+ --input: oklch(0.331 0.012 279.2);
47
+ --primary: oklch(0.662 0.18 272.8);
48
+ --primary-foreground: oklch(0.165 0.009 274.3);
49
+ --secondary: oklch(0.258 0.013 279);
50
+ --secondary-foreground: oklch(0.96 0.004 106.5);
51
+ --accent: oklch(0.265 0.055 271.9);
52
+ --accent-foreground: oklch(0.855 0.072 277);
53
+ --destructive: oklch(0.706 0.188 32.9);
54
+ --success: oklch(0.797 0.164 159.7);
55
+ --warning: oklch(0.861 0.163 87.1);
56
+ --answer: oklch(0.861 0.163 87.1);
57
+ --ring: oklch(0.662 0.18 272.8);
58
+ --chart-1: oklch(0.657 0.182 273.1);
59
+ --chart-2: oklch(0.636 0.186 35.5);
60
+ --chart-3: oklch(0.63 0.182 299);
61
+ --chart-4: oklch(0.627 0.133 159.6);
62
+ --chart-5: oklch(0.645 0.131 81.9);
63
+ --chart-6: oklch(0.63 0.169 355.6);
64
+ }
65
+ }
66
+
67
+ @theme inline {
68
+ --color-background: var(--background);
69
+ --color-foreground: var(--foreground);
70
+ --color-card: var(--card);
71
+ --color-card-foreground: var(--card-foreground);
72
+ --color-muted: var(--muted);
73
+ --color-muted-foreground: var(--muted-foreground);
74
+ --color-border: var(--border);
75
+ --color-input: var(--input);
76
+ --color-primary: var(--primary);
77
+ --color-primary-foreground: var(--primary-foreground);
78
+ --color-secondary: var(--secondary);
79
+ --color-secondary-foreground: var(--secondary-foreground);
80
+ --color-accent: var(--accent);
81
+ --color-accent-foreground: var(--accent-foreground);
82
+ --color-destructive: var(--destructive);
83
+ --color-success: var(--success);
84
+ --color-warning: var(--warning);
85
+ --color-answer: var(--answer);
86
+ --color-ring: var(--ring);
87
+ --color-chart-1: var(--chart-1);
88
+ --color-chart-2: var(--chart-2);
89
+ --color-chart-3: var(--chart-3);
90
+ --color-chart-4: var(--chart-4);
91
+ --color-chart-5: var(--chart-5);
92
+ --color-chart-6: var(--chart-6);
93
+ --radius-sm: calc(var(--radius) - 4px);
94
+ --radius-md: calc(var(--radius) - 2px);
95
+ --radius-lg: var(--radius);
96
+ --radius-xl: calc(var(--radius) + 4px);
97
+ }
98
+
99
+ @layer base {
100
+ * {
101
+ border-color: var(--border);
102
+ }
103
+ html {
104
+ color-scheme: light dark;
105
+ background: var(--background);
106
+ color: var(--foreground);
107
+ -webkit-font-smoothing: antialiased;
108
+ text-rendering: optimizeLegibility;
109
+ }
110
+ h1,
111
+ h2,
112
+ h3 {
113
+ text-wrap: balance;
114
+ }
115
+ p {
116
+ text-wrap: pretty;
117
+ }
118
+ :focus-visible {
119
+ outline: 2px solid var(--ring);
120
+ outline-offset: 2px;
121
+ }
122
+ ::selection {
123
+ background: color-mix(in oklch, var(--answer) 45%, transparent);
124
+ }
125
+ }
@@ -0,0 +1,95 @@
1
+ import "./styles.css";
2
+ import { defineArtifact, useField, useSubmitControl } from "@mostra/react";
3
+
4
+ export const artifact = defineArtifact({
5
+ title: "Checkout: which layout ships?",
6
+ description:
7
+ "Two layouts passed review. Pick the one to ship on Monday and tell me what to change; I need your answer by Friday.",
8
+ family: "proposal",
9
+ submission: { policy: "once" },
10
+ });
11
+
12
+ const LAYOUTS = [
13
+ {
14
+ id: "single-page",
15
+ name: "Single page",
16
+ summary: "Address, delivery and payment on one scrolling page.",
17
+ facts: [
18
+ ["Steps", "1"],
19
+ ["Median time in test", "1 min 48 s"],
20
+ ["Abandoned in test", "9 of 40"],
21
+ ],
22
+ },
23
+ {
24
+ id: "three-steps",
25
+ name: "Three steps",
26
+ summary: "One screen each for address, delivery and payment, with a summary at the side.",
27
+ facts: [
28
+ ["Steps", "3"],
29
+ ["Median time in test", "2 min 05 s"],
30
+ ["Abandoned in test", "5 of 40"],
31
+ ],
32
+ },
33
+ ] as const;
34
+
35
+ export default function Page() {
36
+ const [layout, setLayout] = useField("layout", "", { label: "Layout to ship", required: true });
37
+ const [changes, setChanges] = useField("changes", "", { label: "Changes before shipping" });
38
+ useSubmitControl({ label: "Send my decision" });
39
+
40
+ return (
41
+ <main className="mx-auto max-w-3xl px-6 py-12 sm:py-16">
42
+ <header className="max-w-prose">
43
+ <h1 className="text-3xl font-semibold tracking-tight">{artifact.title}</h1>
44
+ <p className="mt-3 text-base text-muted-foreground">{artifact.description}</p>
45
+ </header>
46
+
47
+ <fieldset className="mt-10">
48
+ <legend className="text-sm font-medium">Layout to ship</legend>
49
+ <div className="mt-3 grid gap-4 sm:grid-cols-2">
50
+ {LAYOUTS.map((option) => (
51
+ <label
52
+ key={option.id}
53
+ className="group relative flex cursor-pointer flex-col rounded-lg border bg-card p-5 transition-colors hover:border-input has-checked:border-primary has-checked:ring-1 has-checked:ring-primary"
54
+ >
55
+ <span className="flex items-center gap-3">
56
+ <input
57
+ type="radio"
58
+ name="layout"
59
+ value={option.id}
60
+ checked={layout === option.id}
61
+ onChange={() => setLayout(option.id)}
62
+ className="size-4 accent-primary"
63
+ />
64
+ <span className="font-medium">{option.name}</span>
65
+ </span>
66
+ <span className="mt-2 text-sm text-muted-foreground">{option.summary}</span>
67
+ <dl className="mt-4 space-y-1.5 border-t pt-4 text-sm">
68
+ {option.facts.map(([term, value]) => (
69
+ <div key={term} className="flex justify-between gap-4">
70
+ <dt className="text-muted-foreground">{term}</dt>
71
+ <dd className="font-medium tabular-nums">{value}</dd>
72
+ </div>
73
+ ))}
74
+ </dl>
75
+ </label>
76
+ ))}
77
+ </div>
78
+ </fieldset>
79
+
80
+ <label className="mt-8 block">
81
+ <span className="text-sm font-medium">Changes before shipping</span>
82
+ <span className="mt-1 block text-sm text-muted-foreground">
83
+ Optional. Anything you want different in the layout you picked.
84
+ </span>
85
+ <textarea
86
+ value={changes}
87
+ onChange={(event) => setChanges(event.target.value)}
88
+ rows={4}
89
+ className="mt-2 block w-full rounded-md border border-input bg-background px-3 py-2 text-base shadow-xs placeholder:text-muted-foreground"
90
+ placeholder="For example: keep the order summary visible on phones…"
91
+ />
92
+ </label>
93
+ </main>
94
+ );
95
+ }
@@ -0,0 +1,125 @@
1
+ @import "tailwindcss";
2
+
3
+ /*
4
+ * Studio: Mostra's quiet baseline theme. White and warm grey surfaces, near-black text, one blue
5
+ * for the main action and focus, and a yellow `answer` reserved for what the person answered or
6
+ * chose. Change any value; nothing depends on it.
7
+ */
8
+ :root {
9
+ --background: oklch(1 0 0);
10
+ --foreground: oklch(0.191 0 0);
11
+ --card: oklch(1 0 0);
12
+ --card-foreground: oklch(0.191 0 0);
13
+ --muted: oklch(0.972 0.004 106.5);
14
+ --muted-foreground: oklch(0.466 0.008 106.7);
15
+ --border: oklch(0.917 0.008 106.6);
16
+ --input: oklch(0.88 0.009 106.6);
17
+ --primary: oklch(0.45 0.212 267);
18
+ --primary-foreground: oklch(1 0 0);
19
+ --secondary: oklch(0.957 0.004 106.5);
20
+ --secondary-foreground: oklch(0.191 0 0);
21
+ --accent: oklch(0.959 0.015 273.9);
22
+ --accent-foreground: oklch(0.37 0.173 267.5);
23
+ --destructive: oklch(0.541 0.198 32);
24
+ --success: oklch(0.513 0.111 161.3);
25
+ --warning: oklch(0.528 0.109 82.4);
26
+ --answer: oklch(0.814 0.167 83.9);
27
+ --ring: oklch(0.45 0.212 267);
28
+ --chart-1: oklch(0.45 0.212 267);
29
+ --chart-2: oklch(0.627 0.201 33);
30
+ --chart-3: oklch(0.559 0.192 301.5);
31
+ --chart-4: oklch(0.561 0.121 160.3);
32
+ --chart-5: oklch(0.651 0.135 80.9);
33
+ --chart-6: oklch(0.586 0.176 358.8);
34
+ --radius: 0.625rem;
35
+ }
36
+
37
+ @media (prefers-color-scheme: dark) {
38
+ :root {
39
+ --background: oklch(0.178 0.006 271);
40
+ --foreground: oklch(0.96 0.004 106.5);
41
+ --card: oklch(0.205 0.008 274.5);
42
+ --card-foreground: oklch(0.96 0.004 106.5);
43
+ --muted: oklch(0.223 0.01 276.6);
44
+ --muted-foreground: oklch(0.717 0.007 286.2);
45
+ --border: oklch(0.29 0.011 278.2);
46
+ --input: oklch(0.331 0.012 279.2);
47
+ --primary: oklch(0.662 0.18 272.8);
48
+ --primary-foreground: oklch(0.165 0.009 274.3);
49
+ --secondary: oklch(0.258 0.013 279);
50
+ --secondary-foreground: oklch(0.96 0.004 106.5);
51
+ --accent: oklch(0.265 0.055 271.9);
52
+ --accent-foreground: oklch(0.855 0.072 277);
53
+ --destructive: oklch(0.706 0.188 32.9);
54
+ --success: oklch(0.797 0.164 159.7);
55
+ --warning: oklch(0.861 0.163 87.1);
56
+ --answer: oklch(0.861 0.163 87.1);
57
+ --ring: oklch(0.662 0.18 272.8);
58
+ --chart-1: oklch(0.657 0.182 273.1);
59
+ --chart-2: oklch(0.636 0.186 35.5);
60
+ --chart-3: oklch(0.63 0.182 299);
61
+ --chart-4: oklch(0.627 0.133 159.6);
62
+ --chart-5: oklch(0.645 0.131 81.9);
63
+ --chart-6: oklch(0.63 0.169 355.6);
64
+ }
65
+ }
66
+
67
+ @theme inline {
68
+ --color-background: var(--background);
69
+ --color-foreground: var(--foreground);
70
+ --color-card: var(--card);
71
+ --color-card-foreground: var(--card-foreground);
72
+ --color-muted: var(--muted);
73
+ --color-muted-foreground: var(--muted-foreground);
74
+ --color-border: var(--border);
75
+ --color-input: var(--input);
76
+ --color-primary: var(--primary);
77
+ --color-primary-foreground: var(--primary-foreground);
78
+ --color-secondary: var(--secondary);
79
+ --color-secondary-foreground: var(--secondary-foreground);
80
+ --color-accent: var(--accent);
81
+ --color-accent-foreground: var(--accent-foreground);
82
+ --color-destructive: var(--destructive);
83
+ --color-success: var(--success);
84
+ --color-warning: var(--warning);
85
+ --color-answer: var(--answer);
86
+ --color-ring: var(--ring);
87
+ --color-chart-1: var(--chart-1);
88
+ --color-chart-2: var(--chart-2);
89
+ --color-chart-3: var(--chart-3);
90
+ --color-chart-4: var(--chart-4);
91
+ --color-chart-5: var(--chart-5);
92
+ --color-chart-6: var(--chart-6);
93
+ --radius-sm: calc(var(--radius) - 4px);
94
+ --radius-md: calc(var(--radius) - 2px);
95
+ --radius-lg: var(--radius);
96
+ --radius-xl: calc(var(--radius) + 4px);
97
+ }
98
+
99
+ @layer base {
100
+ * {
101
+ border-color: var(--border);
102
+ }
103
+ html {
104
+ color-scheme: light dark;
105
+ background: var(--background);
106
+ color: var(--foreground);
107
+ -webkit-font-smoothing: antialiased;
108
+ text-rendering: optimizeLegibility;
109
+ }
110
+ h1,
111
+ h2,
112
+ h3 {
113
+ text-wrap: balance;
114
+ }
115
+ p {
116
+ text-wrap: pretty;
117
+ }
118
+ :focus-visible {
119
+ outline: 2px solid var(--ring);
120
+ outline-offset: 2px;
121
+ }
122
+ ::selection {
123
+ background: color-mix(in oklch, var(--answer) 45%, transparent);
124
+ }
125
+ }