@mostra/runtime 0.10.0 → 0.11.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 (245) hide show
  1. package/dist/bin.js +4058 -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-DCiUHvgZ.js} +682 -47
  6. package/dist/instance-DCiUHvgZ.js.map +1 -0
  7. package/dist/reference/cli.md +1322 -0
  8. package/dist/reference/diagnostics.json +1552 -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_TYPE_ERROR.md +23 -0
  172. package/dist/reference/errors/MOSTRA_TYPE_UNTYPED_PACKAGE.md +23 -0
  173. package/dist/reference/errors/MOSTRA_VERIFY_ACTION_SKIPPED.md +23 -0
  174. package/dist/reference/errors/MOSTRA_VERIFY_BASELINE_MISSING.md +23 -0
  175. package/dist/reference/errors/MOSTRA_VERIFY_CRASHED.md +23 -0
  176. package/dist/reference/errors/MOSTRA_VERIFY_LIVE_FAILED.md +23 -0
  177. package/dist/reference/errors/MOSTRA_VERIFY_NO_BASELINE.md +23 -0
  178. package/dist/reference/errors/MOSTRA_VERIFY_SECRET_MISSING.md +23 -0
  179. package/dist/reference/errors/MOSTRA_VERIFY_SKIP_CONSEQUENCE.md +23 -0
  180. package/dist/reference/errors/MOSTRA_VERIFY_TIMEOUT.md +23 -0
  181. package/dist/reference/self-hosting.md +130 -0
  182. package/dist/reference/telemetry.md +84 -0
  183. package/dist/skill/SKILL.md +122 -0
  184. package/dist/skill/assets/examples/dashboard/index.tsx +161 -0
  185. package/dist/skill/assets/examples/dashboard/live.ts +25 -0
  186. package/dist/skill/assets/examples/dashboard/styles.css +125 -0
  187. package/dist/skill/assets/examples/decision/index.tsx +95 -0
  188. package/dist/skill/assets/examples/decision/styles.css +125 -0
  189. package/dist/skill/assets/examples/inbox/actions.ts +23 -0
  190. package/dist/skill/assets/examples/inbox/index.tsx +109 -0
  191. package/dist/skill/assets/examples/inbox/styles.css +125 -0
  192. package/dist/skill/assets/studio.css +125 -0
  193. package/dist/skill/references/answers.md +217 -0
  194. package/dist/skill/references/design.md +154 -0
  195. package/dist/skill/references/libraries.md +167 -0
  196. package/dist/skill/references/long-lived.md +148 -0
  197. package/dist/skill/references/mcp.md +68 -0
  198. package/dist/skill/references/page.md +131 -0
  199. package/dist/skill/references/server.md +146 -0
  200. package/dist/skill/references/sharing.md +123 -0
  201. package/dist/skill/references/verify.md +71 -0
  202. package/package.json +10 -5
  203. package/src/gateway/actions.ts +20 -0
  204. package/src/gateway/browser.ts +44 -0
  205. package/src/gateway/capabilities.ts +8 -0
  206. package/src/gateway/http.ts +12 -1
  207. package/src/gateway/index.ts +170 -5
  208. package/src/gateway/listener.ts +31 -6
  209. package/src/gateway/routes.ts +8 -0
  210. package/src/gc/index.ts +5 -0
  211. package/src/instance/index.ts +20 -1
  212. package/src/interaction/index.ts +60 -0
  213. package/src/interaction/pause.ts +106 -0
  214. package/src/interaction/submissions.ts +42 -1
  215. package/src/interaction/viewers.ts +34 -1
  216. package/src/ledger/index.ts +20 -1
  217. package/src/ledger/migrations.ts +51 -0
  218. package/src/link/author.ts +215 -0
  219. package/src/link/hosted.ts +37 -1
  220. package/src/link/http.ts +6 -1
  221. package/src/link/index.ts +3 -1
  222. package/src/link/manager.ts +138 -34
  223. package/src/protocol-server/client.ts +53 -0
  224. package/src/protocol-server/index.ts +1 -1
  225. package/src/server/api.ts +514 -72
  226. package/src/server/auth.ts +600 -74
  227. package/src/server/authorize.ts +816 -0
  228. package/src/server/clients.ts +235 -0
  229. package/src/server/config.ts +7 -0
  230. package/src/server/data.ts +59 -1
  231. package/src/server/directory.ts +69 -0
  232. package/src/server/feed.ts +191 -0
  233. package/src/server/handle.ts +172 -0
  234. package/src/server/hosted-pages.ts +532 -0
  235. package/src/server/hosted.ts +519 -18
  236. package/src/server/index.ts +343 -61
  237. package/src/server/mcp.ts +330 -0
  238. package/src/server/metering.ts +156 -0
  239. package/src/server/oauth-clients.ts +510 -0
  240. package/src/server/operator.ts +498 -0
  241. package/src/server/providers.ts +284 -0
  242. package/src/server/remove.ts +148 -0
  243. package/src/server/routing.ts +275 -0
  244. package/src/verify/runner.ts +23 -2
  245. package/dist/instance-FExcyENK.js.map +0 -1
@@ -0,0 +1,123 @@
1
+ # Sharing: links, people and devices
2
+
3
+ ## Contents
4
+
5
+ - The link
6
+ - One person, one link
7
+ - The four setups: local, tailnet share, public share, hosted
8
+ - Hosted on a server
9
+ - Behind a public quick tunnel
10
+ - Managing links and shares
11
+ - Moving a version to another machine
12
+ - Asking people well
13
+
14
+ ## The link
15
+
16
+ `mostra publish` prints the artifact's **default link**; `mostra open <dir>` prints it again; `--browser` also opens it in this machine's browser (without it, only a terminal opens one), and stderr says when no browser opened. The link is a capability URL: whoever holds it can view, answer, submit and run the page's actions. The secret is after the `#`, so it never reaches a server log, but treat the whole link like a password.
17
+
18
+ The default link doesn't expire and stays the same across versions. It opens on this machine only (`http://127.0.0.1:…`).
19
+
20
+ ## One person, one link
21
+
22
+ A link without a named person acts as one person: everyone who holds the default link shares one draft and one `once` submission. When several people should answer, mint one link per person:
23
+
24
+ ```sh
25
+ mostra open ./retro --new --viewer ada@example.com --viewer-name "Ada Lovelace" --no-browser
26
+ mostra open ./retro --new --viewer grace@example.com --viewer-name "Grace Hopper" --no-browser
27
+ ```
28
+
29
+ `--viewer` is your own stable key for the person (an email, a user ID); the same key always means the same person, and results name them. Use `{ policy: "once", scope: "per-viewer" }` so each of them submits once.
30
+
31
+ Other options of `mostra open <dir> --new`: `--ttl 24h` (the link expires), `--scope view` (look but not answer; also `draft`, `submit`, `review`, `signal`, `action:*`), `--version 3` (only that version).
32
+
33
+ ## The four setups
34
+
35
+ | Setup | Who can open it | Command |
36
+ |---|---|---|
37
+ | **Local** | Only this machine's browser | `mostra open <dir> --browser` |
38
+ | **Tailnet share** | People and devices in your Tailscale network, such as your phone | `mostra share <dir> --tailnet` |
39
+ | **Public share** | Anyone with the link, on any device | `mostra share <dir> --public` |
40
+ | **Hosted** | Anyone with the link, even while this machine sleeps | `mostra share <dir> --cloud` |
41
+
42
+ - **Tailnet share** uses Tailscale Serve. Each person is their tailnet identity, so results name them without `--viewer`. The link doesn't expire unless you give `--ttl`. The output names the two ports the tailnet's access policy must allow, and the viewer's device must run Tailscale.
43
+ - **Public share** uses a Cloudflare quick tunnel by default (no account needed), or Tailscale Funnel with `--via funnel` (the URL shows your device's tailnet name). The link lasts 1 hour unless `--ttl` says otherwise, 7 days at most. Each public link is a visitor of its own: their answers never mix with yours or anyone else's, and results show them as "Shared link" unless you pass `--viewer`.
44
+ - Both drive tools installed on this machine (`tailscale`, `cloudflared`); when one is missing or signed out, the command says how to install or enable it (`MOSTRA_SHARE_TOOL_MISSING`, `MOSTRA_SHARE_TOOL_NOT_READY`, `MOSTRA_SHARE_NOT_ENABLED`).
45
+ - A share keeps Mostra running while it lasts. A quick tunnel can't keep its address across a restart, so a public Cloudflare share ends when Mostra restarts; tailnet and Funnel shares come back.
46
+
47
+ ## Hosted on a server
48
+
49
+ `mostra share <dir> --cloud` puts the latest version on a remote server this machine signed in to, and prints a link there. The page keeps taking answers while this machine is off: they wait on the server and reach `mostra wait` and `mostra results` here when Mostra runs again, the same as local answers. Every later `mostra publish` of the artifact goes to the server too.
50
+
51
+ ```sh
52
+ mostra login https://api.example.com # once per machine: open the address it prints and approve the code
53
+ mostra share ./x --cloud # host it there; prints the hosted link
54
+ mostra status # the servers this machine is linked to, and whether they're connected
55
+ mostra logout # sign out; hosted pages keep working, answers wait for the next login
56
+ ```
57
+
58
+ - The person answering sees "Your answer was sent." once the server has it, and nothing about this machine. You see the delivery states.
59
+ - Only the source, its versions and its secrets stay on this machine; the server holds the built page and what people enter.
60
+ - Several machines can sign in to one account. The one that shared a page receives its answers. `mostra login <server> --default` makes this machine the one pages created from a chat app go to.
61
+ - `mostra share stop` and `mostra share list` include hosted shares.
62
+ - `mostra pause ./x --reason "Closed until Monday"` stops a page taking answers and running actions, here and on every server it's hosted on; it stays viewable, its links keep working, and the draft people typed is kept. `mostra resume ./x` opens it again. A pause the server's operator made can only be lifted by the operator.
63
+
64
+ ### Actions on a hosted page
65
+
66
+ A hosted page's actions run on this machine, with its secrets, while it is connected. The manifest's `hosted` key says how they behave on the server:
67
+
68
+ ```tsx
69
+ export const artifact = defineArtifact({
70
+ title: "Proposal",
71
+ hosted: {
72
+ actions: "link", // who may press them: "signed-in" (default) or anyone with the link
73
+ offline: { actions: "queue", limit: "24h" }, // while this machine is off: wait ("queue", default) or fail at once ("fail")
74
+ },
75
+ });
76
+ ```
77
+
78
+ - By default only people the link names (`--viewer`) or who signed in may run actions; `actions: "link"` lets anyone with the link run them.
79
+ - While this machine is off, a pressed action waits: `useAction`'s `status` is `"waiting"`, and it runs once, in order, when Mostra runs here again. Past `limit` (at most `7d`) a run that never started fails. Under `"fail"` it fails at once.
80
+ - If the connection drops while an action runs and this machine never reports how it ended within the limit, its `status` becomes `"unknown"`: it may have happened, so show that rather than "failed". `run()` rejects with `MOSTRA_REMOTE_OWNER_OFFLINE`; the real end replaces `unknown` if it arrives later.
81
+ - A plain server function (called directly, not through `useAction`) answers `MOSTRA_REMOTE_OWNER_OFFLINE` while this machine is off.
82
+ - Live values show the last value, with `ownerOffline` set, while this machine is off.
83
+
84
+ ## Behind a public quick tunnel
85
+
86
+ Over a Cloudflare quick tunnel the page runs in a slightly different mode, and nothing in your code needs to change for it:
87
+
88
+ - updates arrive by polling rather than streaming, so other people's edits and live values show up a second or two later;
89
+ - a streamed result (an async iterable) arrives in one piece at the end;
90
+ - the page can't register a service worker of its own (`MOSTRA_HYGIENE_FRAME_SESSION`).
91
+
92
+ ## Managing links and shares
93
+
94
+ ```sh
95
+ mostra share list # active shares, with their links
96
+ mostra share list --all # ended ones too, and why
97
+ mostra share stop <shareId> # or the artifact, for all of its shares; the link stops working
98
+ mostra open ./x --rotate <tokenId> # replace a link that leaked; the old one stops working
99
+ mostra open ./x --revoke <tokenId> # stop a link
100
+ ```
101
+
102
+ `--json` output carries each link's `tokenId`.
103
+
104
+ ## Moving a version to another machine
105
+
106
+ A published version can move whole to another Mostra home, where it is the same version with the same IDs, and its actions run there:
107
+
108
+ ```sh
109
+ mostra export ./x --out ./x.tar.zst # the latest version; --version 2 for another
110
+ mostra run ./x.tar.zst # on the other machine: imports it and prints its link
111
+ ```
112
+
113
+ The bundle holds the version's builds, manifest, lockfile and source, never secrets: set the secrets its actions read on the other machine with `mostra secret set`. Answers stay in the home where people gave them.
114
+
115
+ ## Asking people well
116
+
117
+ The link arrives as a message from you, so write it like one:
118
+
119
+ - Say who is asking and why ("I'm the coding agent working on the checkout redesign; I need your call between two layouts").
120
+ - Say what the page asks of them and how long it takes.
121
+ - Give a real deadline only if there is one.
122
+ - Ask for no passwords, keys or codes on a page; collect secrets through `mostra secret set` instead.
123
+ - Post a link somewhere public only if the page is meant for anyone.
@@ -0,0 +1,71 @@
1
+ # Verify: the verdict, screenshots and the dev preview
2
+
3
+ ## Contents
4
+
5
+ - What verify does
6
+ - Reading the verdict
7
+ - Errors, warnings and hints
8
+ - Screenshots and the ARIA snapshot
9
+ - Regressions between versions
10
+ - Publish and verify
11
+ - The dev preview: `mostra dev`
12
+
13
+ ## What verify does
14
+
15
+ `mostra verify <dir>` checks the artifact's current source without publishing it, in a sandbox that touches no one's answers and calls no host:
16
+
17
+ 1. **prepare** and **compile**: reads the manifest, resolves and installs packages, type-checks (TypeScript in strict mode, or with the artifact's own `tsconfig.json` settings), builds.
18
+ 2. **boot** and **render**: opens the page in a headless Chromium at 1280 × 800 and 390 × 844, with a fixed clock and reduced motion, waits until it's still (and until the calls, runs and live values it loads at mount have arrived), records page errors, console errors and failed requests, runs axe, takes an ARIA snapshot and a screenshot per size.
19
+ 3. **smoke**: clicks and types through the page's controls (up to 200 interactions or 60 s), checking that each does something and that nothing breaks. Server functions run only when they opt in through `dryRun()` ([server.md](server.md)); live sources run for real, and secrets resolve as they would.
20
+ 4. **regression**: compares with the last published version that passed ([below](#regressions-between-versions)).
21
+
22
+ It takes 10 to 30 s.
23
+
24
+ ## Reading the verdict
25
+
26
+ The human output prints `verify: pass` or `verify: fail`, each diagnostic with its hint, and the screenshots worth looking at. Exit code 0 is pass, 1 is fail. With `--json`, the result is:
27
+
28
+ ```json
29
+ {
30
+ "status": "pass",
31
+ "artifact": { "id": "art_…", "path": "…", "sourceDigest": "…", "envDigest": "…", "versionId": "ver_…" },
32
+ "diagnostics": [{ "code": "MOSTRA_…", "severity": "error", "message": "…", "hint": "…", "location": { "file": "index.tsx", "line": 12, "column": 7 }, "docs": "…" }],
33
+ "screenshots": [{ "viewport": "desktop", "path": "…/desktop.png", "width": 1280, "height": 800, "tokensEstimate": { "claude": 1334, "gpt": 1200, "gemini": 1120 }, "returned": false }],
34
+ "aria": [{ "viewport": "desktop", "path": "…/desktop.aria.yml", "summary": "3 headings, 1 button, 1 textbox, landmarks: main" }],
35
+ "smoke": { "interactions": 3, "skippedActions": [], "stateChanges": 3 },
36
+ "regressions": {},
37
+ "timingsMs": { "build": 36, "typecheck": 538, "render": 9548, "smoke": 2492, "total": 13898 }
38
+ }
39
+ ```
40
+
41
+ `status` is `fail` exactly when there is an error. Diagnostics come errors first; identical ones fold into one with a `count`. `mostra docs <CODE>` prints any code's page with an example fix.
42
+
43
+ ## Errors, warnings and hints
44
+
45
+ | Severity | Means | Examples |
46
+ |---|---|---|
47
+ | error | Something is definitely broken; publish refuses it | type and build errors, uncaught page errors, console errors, failed requests to the page's own origin, a blank page, a page that never gets ready, duplicate or unstable field IDs, a manifest that can't be read |
48
+ | warning | Worth checking; publish allows it | axe's serious findings, failed requests to other sites, a failing live source, a package without types, a secret the page needed that isn't set, every regression, a control with no visible effect |
49
+ | hint | Information | an input not bound to a field (`MOSTRA_FIELD_UNBOUND`, fine for a search box or a draft you don't want saved), an action skipped in verify, axe's minor findings, the smoke test's budget, no baseline yet |
50
+
51
+ Warnings that begin with **"Observed only"** (`MOSTRA_SMOKE_NO_EFFECT`, `MOSTRA_REGRESSION_*`) report what verify saw, such as a button whose click changed nothing visible or a page that changed since the last version. Look at the screenshot and decide; when the behavior is what you intended, change nothing.
52
+
53
+ Fix errors at their location, run verify again, and repeat until it passes. Fix the first error first: later ones are often its consequences.
54
+
55
+ ## Screenshots and the ARIA snapshot
56
+
57
+ Screenshots are always taken. `--screenshots on-failure` (the default) marks them `returned` only when verify fails; `always` marks them every time; `never` never does. The human output lists the returned ones. **Look at them before you publish**, on every round: verify can't tell you that the page looks wrong, only that it works. The design checks in [design.md](design.md#reading-your-screenshots) say what to look for.
58
+
59
+ The ARIA snapshot (`.aria.yml`) is the page as a screen reader sees it: headings, buttons, inputs and their names. Read it when you can't look at images: it shows what text and controls the page actually rendered.
60
+
61
+ ## Regressions between versions
62
+
63
+ From the second version on, verify renders the last published version that passed, in the same run, and compares: the ARIA snapshot, the pixels at each size, and the contract (fields, actions, live sources and pages that disappeared). A field you removed leaves people's answers behind, so `MOSTRA_REGRESSION_FIELD_REMOVED` is worth a second look; a layout change you made on purpose is expected.
64
+
65
+ ## Publish and verify
66
+
67
+ `mostra publish` reuses the verdict of the same source, or runs verify itself. It refuses a source whose verdict has errors (`MOSTRA_PUBLISH_VERIFY_FAILED`). `--force` publishes anyway and records the failing codes on the version; it never publishes a source that didn't build. Use it only when you know why the error doesn't matter. When the headless browser isn't available (`MOSTRA_ENV_BROWSER_MISSING`), verify still type-checks and builds, and the code's page says how to install the browser.
68
+
69
+ ## The dev preview: `mostra dev`
70
+
71
+ `mostra dev <dir>` serves the unpublished source with hot reload on this machine until Ctrl-C, and prints a link. Edits appear in the browser as you save; changed server code restarts its worker. Answers and submissions there go to a scratch store that's thrown away, and actions run for real with the real secrets. Nobody but you sees it: use it while building, then verify and publish.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostra/runtime",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "The Mostra runtime: the supervisor that owns a home, its ledger, its child processes and the host protocol server (mostra-runtime host|daemon).",
5
5
  "license": "Apache-2.0",
6
6
  "author": "The Mostra Authors",
@@ -36,12 +36,14 @@
36
36
  "dependencies": {
37
37
  "@hono/node-server": "2.1.5",
38
38
  "@mdx-js/mdx": "3.1.1",
39
- "@mostra/protocol": "0.10.0",
39
+ "@mostra/mcp": "0.11.0",
40
+ "@mostra/protocol": "0.11.0",
40
41
  "@tailwindcss/vite": "4.3.3",
41
42
  "@vitejs/plugin-react": "6.1.2",
42
43
  "better-sqlite3": "13.0.3",
43
44
  "hono": "4.13.13",
44
45
  "ignore": "7.0.13",
46
+ "openid-client": "6.8.8",
45
47
  "oxc-parser": "0.155.0",
46
48
  "pnpm": "10.34.7",
47
49
  "remark-frontmatter": "5.0.0",
@@ -55,11 +57,14 @@
55
57
  "zod": "4.6.7"
56
58
  },
57
59
  "devDependencies": {
58
- "@mostra/shell": "0.10.0",
60
+ "@modelcontextprotocol/client": "2.4.0",
61
+ "@modelcontextprotocol/conformance": "0.1.16",
62
+ "@modelcontextprotocol/conformance-next": "npm:@modelcontextprotocol/conformance@0.2.0-alpha.12",
63
+ "@mostra/shell": "0.11.0",
59
64
  "@mostra/tools": "0.0.0",
60
- "@mostra/verify": "0.10.0",
65
+ "@mostra/verify": "0.11.0",
61
66
  "@mostra/warm": "0.0.0",
62
- "@mostra/worker": "0.10.0",
67
+ "@mostra/worker": "0.11.0",
63
68
  "@types/better-sqlite3": "9.6.0",
64
69
  "@types/node": "24.19.2",
65
70
  "@types/semver": "7.8.0",
@@ -10,6 +10,7 @@
10
10
  import {
11
11
  CallRequest,
12
12
  type CapabilityScope,
13
+ createDiagnostic,
13
14
  type Diagnostic,
14
15
  LiveRequest,
15
16
  RpcError,
@@ -152,6 +153,21 @@ export function actionRoutes(options: ActionRoutesOptions): ActionRoutes {
152
153
  const may = (page: PageIdentity, fnId: string): boolean =>
153
154
  scopeAllows(page.scopes ?? [], `action:${fnId}` as CapabilityScope);
154
155
 
156
+ /**
157
+ * A paused artifact runs no actions (D165 item 14): a call or a new run is refused before
158
+ * anything is recorded, started or relayed to the owner.
159
+ */
160
+ const paused = (page: PageIdentity): Response | undefined => {
161
+ const pause = interaction.pauseOf(page.artifactId);
162
+ if (!pause) return undefined;
163
+ return answer(
164
+ createDiagnostic("MOSTRA_ACTION_PAUSED", {
165
+ message: `This page is paused${pause.by === "operator" ? " by its server's operator" : ""}: its actions don't run until it is resumed.`,
166
+ }),
167
+ 423,
168
+ );
169
+ };
170
+
155
171
  return {
156
172
  async call(context) {
157
173
  const refused = served(context);
@@ -162,6 +178,8 @@ export function actionRoutes(options: ActionRoutesOptions): ActionRoutes {
162
178
  const page = pageOf(context);
163
179
  // The route checked `action:<fnId>` already (D97 item 4); this keeps the rule in one place.
164
180
  if (!may(page, fnId)) return denied(fnId);
181
+ const pausedNow = paused(page);
182
+ if (pausedNow) return pausedNow;
165
183
  let lines: AsyncIterable<unknown>;
166
184
  const abort = new AbortController();
167
185
  context.request.signal.addEventListener("abort", () => abort.abort(), { once: true });
@@ -215,6 +233,8 @@ export function actionRoutes(options: ActionRoutesOptions): ActionRoutes {
215
233
  if (request instanceof Response) return request;
216
234
  const page = pageOf(context);
217
235
  if (!may(page, request.fnId)) return denied(request.fnId);
236
+ const pausedNow = paused(page);
237
+ if (pausedNow) return pausedNow;
218
238
  try {
219
239
  return jsonResponse(
220
240
  actions.startRun(page, {
@@ -12,6 +12,7 @@ import {
12
12
  type EventRecord,
13
13
  FieldsRequest,
14
14
  FollowRequest,
15
+ type Refusal,
15
16
  RpcError,
16
17
  refusal,
17
18
  ShellSubmitRequest,
@@ -64,6 +65,8 @@ const STATUS: Readonly<Record<string, number>> = {
64
65
  MOSTRA_HOME_DISK_FULL: 507,
65
66
  MOSTRA_HOME_GONE: 503,
66
67
  MOSTRA_HYGIENE_SCOPE_DENIED: 403,
68
+ // A paused artifact takes no answers (D165 item 14).
69
+ MOSTRA_SUBMIT_PAUSED: 423,
67
70
  };
68
71
 
69
72
  /** Options for {@link browserRoutes}. */
@@ -86,6 +89,14 @@ export interface BrowserRoutesOptions {
86
89
  * without an `id`, a poll as its `ephemeral` (LL-04). Absent: neither carries any.
87
90
  */
88
91
  readonly bus?: EphemeralBus;
92
+ /**
93
+ * Before a submit, from the frame or the shell (a remote server's, D165 item 13): a refusal (with
94
+ * when to try again) keeps the draft; nothing is recorded. Absent: every submit goes on.
95
+ */
96
+ readonly admitSubmit?: (
97
+ page: PageIdentity,
98
+ context: RouteContext,
99
+ ) => Promise<(Refusal & { readonly retryAfter?: number }) | undefined>;
89
100
  /** Tells a host with a `trustedControls` port that a trusted control was used (D108). */
90
101
  readonly activated: (event: {
91
102
  readonly artifactId: string;
@@ -208,6 +219,35 @@ export function browserRoutes(options: BrowserRoutesOptions): BrowserRoutes {
208
219
  };
209
220
  };
210
221
 
222
+ /** The answer to a submit the server's rules refused before it reached the ledger. */
223
+ const admit = async (
224
+ context: RouteContext,
225
+ request: { readonly viewId: string; readonly expectedRevision: unknown },
226
+ ): Promise<Response | undefined> => {
227
+ if (!options.admitSubmit) return undefined;
228
+ // A repeat of a recorded submit answers that submission, and one a paused page or a view not
229
+ // the page's refuses is refused before anything is recorded: neither spends the submission
230
+ // rates or asks the operator (Fable review of WP-30, 8). The server's per-IP request rate
231
+ // still bounds them, as it bounds every request (`rateLimits.perIp.requests`).
232
+ const page = pageOf(context);
233
+ if (
234
+ !interaction.wouldRecord(page, {
235
+ viewId: request.viewId,
236
+ expectedRevision: Number(request.expectedRevision),
237
+ })
238
+ ) {
239
+ return undefined;
240
+ }
241
+ const refused = await options.admitSubmit(page, context);
242
+ if (!refused) return undefined;
243
+ return jsonResponse(refused.diagnostic, {
244
+ status: refused.status,
245
+ ...(refused.retryAfter !== undefined
246
+ ? { headers: { "retry-after": String(refused.retryAfter) } }
247
+ : {}),
248
+ });
249
+ };
250
+
211
251
  /** The view a stream or poll is for, checked against the page (D104). */
212
252
  const viewOf = (context: RouteContext, page: PageIdentity): Response | undefined => {
213
253
  const view = new URL(context.request.url).searchParams.get("view");
@@ -252,6 +292,8 @@ export function browserRoutes(options: BrowserRoutesOptions): BrowserRoutes {
252
292
  if (refused) return refused;
253
293
  const request = await body(context, SubmitRequest);
254
294
  if (request instanceof Response) return request;
295
+ const admitted = await admit(context, request);
296
+ if (admitted) return admitted;
255
297
  try {
256
298
  return jsonResponse(
257
299
  interaction.submit(pageOf(context), {
@@ -562,6 +604,8 @@ export function browserRoutes(options: BrowserRoutesOptions): BrowserRoutes {
562
604
  if (refused) return refused;
563
605
  const request = await body(context, ShellSubmitRequest);
564
606
  if (request instanceof Response) return request;
607
+ const admitted = await admit(context, request);
608
+ if (admitted) return admitted;
565
609
  const page = pageOf(context);
566
610
  let submission: SubmissionSummary & { readonly duplicate?: true };
567
611
  try {
@@ -261,6 +261,11 @@ export interface CapabilitiesOptions {
261
261
  * face, a host's): a launch ticket is only minted for a link whose address is served.
262
262
  */
263
263
  readonly servesShell?: (origin: string) => boolean;
264
+ /**
265
+ * Told each token minted, after its row is written (a remote server indexes its hosted homes'
266
+ * links, so its operator's `revokeLink` finds a link's home, WP-30).
267
+ */
268
+ readonly onMinted?: (token: { readonly tokenId: string; readonly artifactId: string }) => void;
264
269
  }
265
270
 
266
271
  /** What a stream ticket opens (D158 item 5). */
@@ -274,6 +279,7 @@ export class Capabilities {
274
279
  readonly #now: () => number;
275
280
  readonly #shellOrigin: () => string;
276
281
  readonly #servesShell: (origin: string) => boolean;
282
+ readonly #onMinted: CapabilitiesOptions["onMinted"];
277
283
  /** Single-use stream and socket tickets (D158 item 5), by the SHA-256 of their secret. */
278
284
  readonly #streamTickets = new Map<
279
285
  string,
@@ -304,6 +310,7 @@ export class Capabilities {
304
310
  this.#now = options.now;
305
311
  this.#shellOrigin = options.shellOrigin;
306
312
  this.#servesShell = options.servesShell ?? ((origin) => origin === this.#shellOrigin());
313
+ this.#onMinted = options.onMinted;
307
314
  }
308
315
 
309
316
  /** Runs `fn` in the caller's transaction, or in a new one. */
@@ -359,6 +366,7 @@ export class Capabilities {
359
366
  input.pinnedVersion ?? null,
360
367
  shellOrigin,
361
368
  );
369
+ this.#onMinted?.({ tokenId, artifactId: input.artifactId });
362
370
  return {
363
371
  tokenId,
364
372
  secret,
@@ -29,6 +29,11 @@ export interface ListenerKind {
29
29
  readonly origin: string;
30
30
  /** The shell's origin: the only page that may frame an artifact (D98 item 4). */
31
31
  readonly shellOrigin: string;
32
+ /**
33
+ * The framers an artifact's documents name, when they are more than its shell: a hosted
34
+ * label's are the shells of its domain an operator also serves it under (INTERFACES §18.6).
35
+ */
36
+ readonly frameAncestors?: string;
32
37
  }
33
38
 
34
39
  /**
@@ -53,6 +58,10 @@ export function documentHeaders(
53
58
  "base-uri 'none'",
54
59
  "form-action 'none'",
55
60
  "object-src 'none'",
61
+ // No string reaches a script sink on the shell: every text a tenant or operator supplies
62
+ // renders as text, and a DOM-injection attempt throws (Trusted Types, HY-09).
63
+ "require-trusted-types-for 'script'",
64
+ "trusted-types 'none'",
56
65
  ].join("; "),
57
66
  "x-frame-options": "DENY",
58
67
  // Popups the artifact frame opens get no opener, so none can navigate this page (D98
@@ -60,7 +69,9 @@ export function documentHeaders(
60
69
  "cross-origin-opener-policy": "same-origin",
61
70
  };
62
71
  }
63
- return { "content-security-policy": `frame-ancestors ${listener.shellOrigin}` };
72
+ return {
73
+ "content-security-policy": `frame-ancestors ${listener.frameAncestors ?? listener.shellOrigin}`,
74
+ };
64
75
  }
65
76
 
66
77
  /** Every header of a request as `[name, value]` pairs, repeats kept. */