@mostra/protocol 0.0.0-stage → 0.1.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 (439) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +38 -2
  3. package/dist/actions.d.ts +273 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +154 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/artifact.d.ts +113 -0
  8. package/dist/artifact.d.ts.map +1 -0
  9. package/dist/artifact.js +79 -0
  10. package/dist/artifact.js.map +1 -0
  11. package/dist/bridge.d.ts +295 -0
  12. package/dist/bridge.d.ts.map +1 -0
  13. package/dist/bridge.js +343 -0
  14. package/dist/bridge.js.map +1 -0
  15. package/dist/browser.d.ts +195 -0
  16. package/dist/browser.d.ts.map +1 -0
  17. package/dist/browser.js +156 -0
  18. package/dist/browser.js.map +1 -0
  19. package/dist/bundle.d.ts +155 -0
  20. package/dist/bundle.d.ts.map +1 -0
  21. package/dist/bundle.js +130 -0
  22. package/dist/bundle.js.map +1 -0
  23. package/dist/canonical.d.ts +23 -0
  24. package/dist/canonical.d.ts.map +1 -0
  25. package/dist/canonical.js +45 -0
  26. package/dist/canonical.js.map +1 -0
  27. package/dist/capability.d.ts +38 -0
  28. package/dist/capability.d.ts.map +1 -0
  29. package/dist/capability.js +61 -0
  30. package/dist/capability.js.map +1 -0
  31. package/dist/diagnostics/codes/a11y.d.ts +8 -0
  32. package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
  33. package/dist/diagnostics/codes/a11y.js +30 -0
  34. package/dist/diagnostics/codes/a11y.js.map +1 -0
  35. package/dist/diagnostics/codes/action.d.ts +8 -0
  36. package/dist/diagnostics/codes/action.d.ts.map +1 -0
  37. package/dist/diagnostics/codes/action.js +110 -0
  38. package/dist/diagnostics/codes/action.js.map +1 -0
  39. package/dist/diagnostics/codes/artifact.d.ts +8 -0
  40. package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
  41. package/dist/diagnostics/codes/artifact.js +121 -0
  42. package/dist/diagnostics/codes/artifact.js.map +1 -0
  43. package/dist/diagnostics/codes/build.d.ts +8 -0
  44. package/dist/diagnostics/codes/build.d.ts.map +1 -0
  45. package/dist/diagnostics/codes/build.js +55 -0
  46. package/dist/diagnostics/codes/build.js.map +1 -0
  47. package/dist/diagnostics/codes/cli.d.ts +8 -0
  48. package/dist/diagnostics/codes/cli.d.ts.map +1 -0
  49. package/dist/diagnostics/codes/cli.js +44 -0
  50. package/dist/diagnostics/codes/cli.js.map +1 -0
  51. package/dist/diagnostics/codes/console.d.ts +8 -0
  52. package/dist/diagnostics/codes/console.d.ts.map +1 -0
  53. package/dist/diagnostics/codes/console.js +30 -0
  54. package/dist/diagnostics/codes/console.js.map +1 -0
  55. package/dist/diagnostics/codes/dep.d.ts +8 -0
  56. package/dist/diagnostics/codes/dep.d.ts.map +1 -0
  57. package/dist/diagnostics/codes/dep.js +88 -0
  58. package/dist/diagnostics/codes/dep.js.map +1 -0
  59. package/dist/diagnostics/codes/env.d.ts +8 -0
  60. package/dist/diagnostics/codes/env.d.ts.map +1 -0
  61. package/dist/diagnostics/codes/env.js +132 -0
  62. package/dist/diagnostics/codes/env.js.map +1 -0
  63. package/dist/diagnostics/codes/field.d.ts +8 -0
  64. package/dist/diagnostics/codes/field.d.ts.map +1 -0
  65. package/dist/diagnostics/codes/field.js +99 -0
  66. package/dist/diagnostics/codes/field.js.map +1 -0
  67. package/dist/diagnostics/codes/home.d.ts +8 -0
  68. package/dist/diagnostics/codes/home.d.ts.map +1 -0
  69. package/dist/diagnostics/codes/home.js +132 -0
  70. package/dist/diagnostics/codes/home.js.map +1 -0
  71. package/dist/diagnostics/codes/host.d.ts +8 -0
  72. package/dist/diagnostics/codes/host.d.ts.map +1 -0
  73. package/dist/diagnostics/codes/host.js +176 -0
  74. package/dist/diagnostics/codes/host.js.map +1 -0
  75. package/dist/diagnostics/codes/hygiene.d.ts +8 -0
  76. package/dist/diagnostics/codes/hygiene.d.ts.map +1 -0
  77. package/dist/diagnostics/codes/hygiene.js +154 -0
  78. package/dist/diagnostics/codes/hygiene.js.map +1 -0
  79. package/dist/diagnostics/codes/index.d.ts +51 -0
  80. package/dist/diagnostics/codes/index.d.ts.map +1 -0
  81. package/dist/diagnostics/codes/index.js +72 -0
  82. package/dist/diagnostics/codes/index.js.map +1 -0
  83. package/dist/diagnostics/codes/live.d.ts +8 -0
  84. package/dist/diagnostics/codes/live.d.ts.map +1 -0
  85. package/dist/diagnostics/codes/live.js +30 -0
  86. package/dist/diagnostics/codes/live.js.map +1 -0
  87. package/dist/diagnostics/codes/manifest.d.ts +8 -0
  88. package/dist/diagnostics/codes/manifest.d.ts.map +1 -0
  89. package/dist/diagnostics/codes/manifest.js +44 -0
  90. package/dist/diagnostics/codes/manifest.js.map +1 -0
  91. package/dist/diagnostics/codes/network.d.ts +8 -0
  92. package/dist/diagnostics/codes/network.d.ts.map +1 -0
  93. package/dist/diagnostics/codes/network.js +30 -0
  94. package/dist/diagnostics/codes/network.js.map +1 -0
  95. package/dist/diagnostics/codes/platform.d.ts +8 -0
  96. package/dist/diagnostics/codes/platform.d.ts.map +1 -0
  97. package/dist/diagnostics/codes/platform.js +18 -0
  98. package/dist/diagnostics/codes/platform.js.map +1 -0
  99. package/dist/diagnostics/codes/publish.d.ts +8 -0
  100. package/dist/diagnostics/codes/publish.d.ts.map +1 -0
  101. package/dist/diagnostics/codes/publish.js +44 -0
  102. package/dist/diagnostics/codes/publish.js.map +1 -0
  103. package/dist/diagnostics/codes/regression.d.ts +8 -0
  104. package/dist/diagnostics/codes/regression.d.ts.map +1 -0
  105. package/dist/diagnostics/codes/regression.js +77 -0
  106. package/dist/diagnostics/codes/regression.js.map +1 -0
  107. package/dist/diagnostics/codes/runtime.d.ts +8 -0
  108. package/dist/diagnostics/codes/runtime.d.ts.map +1 -0
  109. package/dist/diagnostics/codes/runtime.js +66 -0
  110. package/dist/diagnostics/codes/runtime.js.map +1 -0
  111. package/dist/diagnostics/codes/secret.d.ts +8 -0
  112. package/dist/diagnostics/codes/secret.d.ts.map +1 -0
  113. package/dist/diagnostics/codes/secret.js +18 -0
  114. package/dist/diagnostics/codes/secret.js.map +1 -0
  115. package/dist/diagnostics/codes/smoke.d.ts +8 -0
  116. package/dist/diagnostics/codes/smoke.d.ts.map +1 -0
  117. package/dist/diagnostics/codes/smoke.js +30 -0
  118. package/dist/diagnostics/codes/smoke.js.map +1 -0
  119. package/dist/diagnostics/codes/submit.d.ts +8 -0
  120. package/dist/diagnostics/codes/submit.d.ts.map +1 -0
  121. package/dist/diagnostics/codes/submit.js +99 -0
  122. package/dist/diagnostics/codes/submit.js.map +1 -0
  123. package/dist/diagnostics/codes/target.d.ts +8 -0
  124. package/dist/diagnostics/codes/target.d.ts.map +1 -0
  125. package/dist/diagnostics/codes/target.js +18 -0
  126. package/dist/diagnostics/codes/target.js.map +1 -0
  127. package/dist/diagnostics/codes/type.d.ts +8 -0
  128. package/dist/diagnostics/codes/type.d.ts.map +1 -0
  129. package/dist/diagnostics/codes/type.js +30 -0
  130. package/dist/diagnostics/codes/type.js.map +1 -0
  131. package/dist/diagnostics/codes/verify.d.ts +8 -0
  132. package/dist/diagnostics/codes/verify.d.ts.map +1 -0
  133. package/dist/diagnostics/codes/verify.js +99 -0
  134. package/dist/diagnostics/codes/verify.js.map +1 -0
  135. package/dist/diagnostics/diagnostic.d.ts +79 -0
  136. package/dist/diagnostics/diagnostic.d.ts.map +1 -0
  137. package/dist/diagnostics/diagnostic.js +131 -0
  138. package/dist/diagnostics/diagnostic.js.map +1 -0
  139. package/dist/diagnostics/spec.d.ts +49 -0
  140. package/dist/diagnostics/spec.d.ts.map +1 -0
  141. package/dist/diagnostics/spec.js +31 -0
  142. package/dist/diagnostics/spec.js.map +1 -0
  143. package/dist/hygiene.d.ts +66 -0
  144. package/dist/hygiene.d.ts.map +1 -0
  145. package/dist/hygiene.js +134 -0
  146. package/dist/hygiene.js.map +1 -0
  147. package/dist/ids.d.ts +119 -0
  148. package/dist/ids.d.ts.map +1 -0
  149. package/dist/ids.js +135 -0
  150. package/dist/ids.js.map +1 -0
  151. package/dist/index.d.ts +86 -0
  152. package/dist/index.js +86 -0
  153. package/dist/interaction.d.ts +391 -0
  154. package/dist/interaction.d.ts.map +1 -0
  155. package/dist/interaction.js +306 -0
  156. package/dist/interaction.js.map +1 -0
  157. package/dist/manifest.d.ts +97 -0
  158. package/dist/manifest.d.ts.map +1 -0
  159. package/dist/manifest.js +101 -0
  160. package/dist/manifest.js.map +1 -0
  161. package/dist/method.d.ts +26 -0
  162. package/dist/method.d.ts.map +1 -0
  163. package/dist/method.js +10 -0
  164. package/dist/method.js.map +1 -0
  165. package/dist/methods/artifact/create.d.ts +29 -0
  166. package/dist/methods/artifact/create.d.ts.map +1 -0
  167. package/dist/methods/artifact/create.js +31 -0
  168. package/dist/methods/artifact/create.js.map +1 -0
  169. package/dist/methods/artifact/get.d.ts +17 -0
  170. package/dist/methods/artifact/get.d.ts.map +1 -0
  171. package/dist/methods/artifact/get.js +21 -0
  172. package/dist/methods/artifact/get.js.map +1 -0
  173. package/dist/methods/artifact/list.d.ts +22 -0
  174. package/dist/methods/artifact/list.d.ts.map +1 -0
  175. package/dist/methods/artifact/list.js +19 -0
  176. package/dist/methods/artifact/list.js.map +1 -0
  177. package/dist/methods/artifact/publish.d.ts +28 -0
  178. package/dist/methods/artifact/publish.d.ts.map +1 -0
  179. package/dist/methods/artifact/publish.js +28 -0
  180. package/dist/methods/artifact/publish.js.map +1 -0
  181. package/dist/methods/artifact/verify.d.ts +29 -0
  182. package/dist/methods/artifact/verify.d.ts.map +1 -0
  183. package/dist/methods/artifact/verify.js +27 -0
  184. package/dist/methods/artifact/verify.js.map +1 -0
  185. package/dist/methods/deps/add.d.ts +43 -0
  186. package/dist/methods/deps/add.d.ts.map +1 -0
  187. package/dist/methods/deps/add.js +40 -0
  188. package/dist/methods/deps/add.js.map +1 -0
  189. package/dist/methods/dev/start.d.ts +52 -0
  190. package/dist/methods/dev/start.d.ts.map +1 -0
  191. package/dist/methods/dev/start.js +56 -0
  192. package/dist/methods/dev/start.js.map +1 -0
  193. package/dist/methods/dev/stop.d.ts +16 -0
  194. package/dist/methods/dev/stop.d.ts.map +1 -0
  195. package/dist/methods/dev/stop.js +21 -0
  196. package/dist/methods/dev/stop.js.map +1 -0
  197. package/dist/methods/events/ack.d.ts +20 -0
  198. package/dist/methods/events/ack.d.ts.map +1 -0
  199. package/dist/methods/events/ack.js +26 -0
  200. package/dist/methods/events/ack.js.map +1 -0
  201. package/dist/methods/events/read.d.ts +40 -0
  202. package/dist/methods/events/read.d.ts.map +1 -0
  203. package/dist/methods/events/read.js +35 -0
  204. package/dist/methods/events/read.js.map +1 -0
  205. package/dist/methods/events/subscribe.d.ts +54 -0
  206. package/dist/methods/events/subscribe.d.ts.map +1 -0
  207. package/dist/methods/events/subscribe.js +44 -0
  208. package/dist/methods/events/subscribe.js.map +1 -0
  209. package/dist/methods/events/unsubscribe.d.ts +16 -0
  210. package/dist/methods/events/unsubscribe.d.ts.map +1 -0
  211. package/dist/methods/events/unsubscribe.js +21 -0
  212. package/dist/methods/events/unsubscribe.js.map +1 -0
  213. package/dist/methods/gc/run.d.ts +76 -0
  214. package/dist/methods/gc/run.d.ts.map +1 -0
  215. package/dist/methods/gc/run.js +56 -0
  216. package/dist/methods/gc/run.js.map +1 -0
  217. package/dist/methods/index.d.ts +6 -0
  218. package/dist/methods/index.d.ts.map +1 -0
  219. package/dist/methods/index.js +78 -0
  220. package/dist/methods/index.js.map +1 -0
  221. package/dist/methods/instance/check.d.ts +30 -0
  222. package/dist/methods/instance/check.d.ts.map +1 -0
  223. package/dist/methods/instance/check.js +34 -0
  224. package/dist/methods/instance/check.js.map +1 -0
  225. package/dist/methods/instance/status.d.ts +102 -0
  226. package/dist/methods/instance/status.d.ts.map +1 -0
  227. package/dist/methods/instance/status.js +83 -0
  228. package/dist/methods/instance/status.js.map +1 -0
  229. package/dist/methods/live/push.d.ts +28 -0
  230. package/dist/methods/live/push.d.ts.map +1 -0
  231. package/dist/methods/live/push.js +35 -0
  232. package/dist/methods/live/push.js.map +1 -0
  233. package/dist/methods/mostra/initialize.d.ts +143 -0
  234. package/dist/methods/mostra/initialize.d.ts.map +1 -0
  235. package/dist/methods/mostra/initialize.js +97 -0
  236. package/dist/methods/mostra/initialize.js.map +1 -0
  237. package/dist/methods/mostra/shutdown.d.ts +14 -0
  238. package/dist/methods/mostra/shutdown.d.ts.map +1 -0
  239. package/dist/methods/mostra/shutdown.js +22 -0
  240. package/dist/methods/mostra/shutdown.js.map +1 -0
  241. package/dist/methods/port/drafts-mirror.d.ts +30 -0
  242. package/dist/methods/port/drafts-mirror.d.ts.map +1 -0
  243. package/dist/methods/port/drafts-mirror.js +33 -0
  244. package/dist/methods/port/drafts-mirror.js.map +1 -0
  245. package/dist/methods/port/secrets-get.d.ts +19 -0
  246. package/dist/methods/port/secrets-get.d.ts.map +1 -0
  247. package/dist/methods/port/secrets-get.js +31 -0
  248. package/dist/methods/port/secrets-get.js.map +1 -0
  249. package/dist/methods/port/submissions-deliver.d.ts +38 -0
  250. package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
  251. package/dist/methods/port/submissions-deliver.js +38 -0
  252. package/dist/methods/port/submissions-deliver.js.map +1 -0
  253. package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
  254. package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
  255. package/dist/methods/port/trusted-controls-activated.js +33 -0
  256. package/dist/methods/port/trusted-controls-activated.js.map +1 -0
  257. package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
  258. package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
  259. package/dist/methods/port/trusted-controls-policy.js +27 -0
  260. package/dist/methods/port/trusted-controls-policy.js.map +1 -0
  261. package/dist/methods/results/get.d.ts +32 -0
  262. package/dist/methods/results/get.d.ts.map +1 -0
  263. package/dist/methods/results/get.js +36 -0
  264. package/dist/methods/results/get.js.map +1 -0
  265. package/dist/methods/secret/delete.d.ts +22 -0
  266. package/dist/methods/secret/delete.d.ts.map +1 -0
  267. package/dist/methods/secret/delete.js +32 -0
  268. package/dist/methods/secret/delete.js.map +1 -0
  269. package/dist/methods/secret/list.d.ts +21 -0
  270. package/dist/methods/secret/list.d.ts.map +1 -0
  271. package/dist/methods/secret/list.js +29 -0
  272. package/dist/methods/secret/list.js.map +1 -0
  273. package/dist/methods/secret/set.d.ts +37 -0
  274. package/dist/methods/secret/set.d.ts.map +1 -0
  275. package/dist/methods/secret/set.js +41 -0
  276. package/dist/methods/secret/set.js.map +1 -0
  277. package/dist/methods/state/get.d.ts +25 -0
  278. package/dist/methods/state/get.d.ts.map +1 -0
  279. package/dist/methods/state/get.js +29 -0
  280. package/dist/methods/state/get.js.map +1 -0
  281. package/dist/methods/state/patch.d.ts +32 -0
  282. package/dist/methods/state/patch.d.ts.map +1 -0
  283. package/dist/methods/state/patch.js +29 -0
  284. package/dist/methods/state/patch.js.map +1 -0
  285. package/dist/methods/view/default.d.ts +19 -0
  286. package/dist/methods/view/default.d.ts.map +1 -0
  287. package/dist/methods/view/default.js +23 -0
  288. package/dist/methods/view/default.js.map +1 -0
  289. package/dist/methods/view/launch.d.ts +27 -0
  290. package/dist/methods/view/launch.d.ts.map +1 -0
  291. package/dist/methods/view/launch.js +30 -0
  292. package/dist/methods/view/launch.js.map +1 -0
  293. package/dist/methods/view/revoke.d.ts +19 -0
  294. package/dist/methods/view/revoke.d.ts.map +1 -0
  295. package/dist/methods/view/revoke.js +26 -0
  296. package/dist/methods/view/revoke.js.map +1 -0
  297. package/dist/methods/view/rotate.d.ts +21 -0
  298. package/dist/methods/view/rotate.d.ts.map +1 -0
  299. package/dist/methods/view/rotate.js +27 -0
  300. package/dist/methods/view/rotate.js.map +1 -0
  301. package/dist/methods/view/url.d.ts +52 -0
  302. package/dist/methods/view/url.d.ts.map +1 -0
  303. package/dist/methods/view/url.js +43 -0
  304. package/dist/methods/view/url.js.map +1 -0
  305. package/dist/methods/wait/wait.d.ts +37 -0
  306. package/dist/methods/wait/wait.d.ts.map +1 -0
  307. package/dist/methods/wait/wait.js +39 -0
  308. package/dist/methods/wait/wait.js.map +1 -0
  309. package/dist/revision.d.ts +43 -0
  310. package/dist/revision.d.ts.map +1 -0
  311. package/dist/revision.js +69 -0
  312. package/dist/revision.js.map +1 -0
  313. package/dist/rpc/error.d.ts +47 -0
  314. package/dist/rpc/error.d.ts.map +1 -0
  315. package/dist/rpc/error.js +77 -0
  316. package/dist/rpc/error.js.map +1 -0
  317. package/dist/rpc/lines.d.ts +30 -0
  318. package/dist/rpc/lines.d.ts.map +1 -0
  319. package/dist/rpc/lines.js +63 -0
  320. package/dist/rpc/lines.js.map +1 -0
  321. package/dist/rpc/messages.d.ts +92 -0
  322. package/dist/rpc/messages.d.ts.map +1 -0
  323. package/dist/rpc/messages.js +133 -0
  324. package/dist/rpc/messages.js.map +1 -0
  325. package/dist/rpc/peer.d.ts +81 -0
  326. package/dist/rpc/peer.d.ts.map +1 -0
  327. package/dist/rpc/peer.js +208 -0
  328. package/dist/rpc/peer.js.map +1 -0
  329. package/dist/serializer.d.ts +178 -0
  330. package/dist/serializer.d.ts.map +1 -0
  331. package/dist/serializer.js +929 -0
  332. package/dist/serializer.js.map +1 -0
  333. package/dist/verify.d.ts +254 -0
  334. package/dist/verify.d.ts.map +1 -0
  335. package/dist/verify.js +243 -0
  336. package/dist/verify.js.map +1 -0
  337. package/dist/view.d.ts +103 -0
  338. package/dist/view.d.ts.map +1 -0
  339. package/dist/view.js +110 -0
  340. package/dist/view.js.map +1 -0
  341. package/dist/wire-registry.js +11 -0
  342. package/dist/wire-registry.js.map +1 -0
  343. package/dist/worker.d.ts +249 -0
  344. package/dist/worker.d.ts.map +1 -0
  345. package/dist/worker.js +158 -0
  346. package/dist/worker.js.map +1 -0
  347. package/package.json +114 -3
  348. package/schemas/protocol.draft-07.json +5120 -0
  349. package/schemas/protocol.schema.json +4964 -0
  350. package/src/actions.ts +418 -0
  351. package/src/artifact.ts +187 -0
  352. package/src/bridge.ts +618 -0
  353. package/src/browser.ts +374 -0
  354. package/src/bundle.ts +264 -0
  355. package/src/canonical.ts +49 -0
  356. package/src/capability.ts +92 -0
  357. package/src/diagnostics/codes/a11y.ts +41 -0
  358. package/src/diagnostics/codes/action.ts +125 -0
  359. package/src/diagnostics/codes/artifact.ts +137 -0
  360. package/src/diagnostics/codes/build.ts +65 -0
  361. package/src/diagnostics/codes/cli.ts +53 -0
  362. package/src/diagnostics/codes/console.ts +41 -0
  363. package/src/diagnostics/codes/dep.ts +101 -0
  364. package/src/diagnostics/codes/env.ts +149 -0
  365. package/src/diagnostics/codes/field.ts +113 -0
  366. package/src/diagnostics/codes/home.ts +150 -0
  367. package/src/diagnostics/codes/host.ts +197 -0
  368. package/src/diagnostics/codes/hygiene.ts +175 -0
  369. package/src/diagnostics/codes/index.ts +142 -0
  370. package/src/diagnostics/codes/live.ts +41 -0
  371. package/src/diagnostics/codes/manifest.ts +53 -0
  372. package/src/diagnostics/codes/network.ts +41 -0
  373. package/src/diagnostics/codes/platform.ts +30 -0
  374. package/src/diagnostics/codes/publish.ts +53 -0
  375. package/src/diagnostics/codes/regression.ts +89 -0
  376. package/src/diagnostics/codes/runtime.ts +77 -0
  377. package/src/diagnostics/codes/secret.ts +29 -0
  378. package/src/diagnostics/codes/smoke.ts +41 -0
  379. package/src/diagnostics/codes/submit.ts +113 -0
  380. package/src/diagnostics/codes/target.ts +29 -0
  381. package/src/diagnostics/codes/type.ts +41 -0
  382. package/src/diagnostics/codes/verify.ts +113 -0
  383. package/src/diagnostics/diagnostic.ts +240 -0
  384. package/src/diagnostics/spec.ts +90 -0
  385. package/src/hygiene.ts +224 -0
  386. package/src/ids.ts +279 -0
  387. package/src/index.ts +576 -0
  388. package/src/interaction.ts +728 -0
  389. package/src/manifest.ts +206 -0
  390. package/src/method.ts +42 -0
  391. package/src/methods/artifact/create.ts +56 -0
  392. package/src/methods/artifact/get.ts +30 -0
  393. package/src/methods/artifact/list.ts +42 -0
  394. package/src/methods/artifact/publish.ts +46 -0
  395. package/src/methods/artifact/verify.ts +46 -0
  396. package/src/methods/deps/add.ts +72 -0
  397. package/src/methods/dev/start.ts +84 -0
  398. package/src/methods/dev/stop.ts +32 -0
  399. package/src/methods/events/ack.ts +41 -0
  400. package/src/methods/events/read.ts +67 -0
  401. package/src/methods/events/subscribe.ts +91 -0
  402. package/src/methods/events/unsubscribe.ts +35 -0
  403. package/src/methods/gc/run.ts +125 -0
  404. package/src/methods/index.ts +81 -0
  405. package/src/methods/instance/check.ts +61 -0
  406. package/src/methods/instance/status.ts +172 -0
  407. package/src/methods/live/push.ts +54 -0
  408. package/src/methods/mostra/initialize.ts +249 -0
  409. package/src/methods/mostra/shutdown.ts +31 -0
  410. package/src/methods/port/drafts-mirror.ts +52 -0
  411. package/src/methods/port/secrets-get.ts +40 -0
  412. package/src/methods/port/submissions-deliver.ts +70 -0
  413. package/src/methods/port/trusted-controls-activated.ts +51 -0
  414. package/src/methods/port/trusted-controls-policy.ts +38 -0
  415. package/src/methods/results/get.ts +59 -0
  416. package/src/methods/secret/delete.ts +43 -0
  417. package/src/methods/secret/list.ts +40 -0
  418. package/src/methods/secret/set.ts +69 -0
  419. package/src/methods/state/get.ts +44 -0
  420. package/src/methods/state/patch.ts +51 -0
  421. package/src/methods/view/default.ts +32 -0
  422. package/src/methods/view/launch.ts +47 -0
  423. package/src/methods/view/revoke.ts +39 -0
  424. package/src/methods/view/rotate.ts +37 -0
  425. package/src/methods/view/url.ts +84 -0
  426. package/src/methods/wait/wait.ts +58 -0
  427. package/src/revision.ts +101 -0
  428. package/src/rpc/error.ts +107 -0
  429. package/src/rpc/lines.ts +70 -0
  430. package/src/rpc/messages.ts +188 -0
  431. package/src/rpc/peer.ts +341 -0
  432. package/src/serializer.ts +1217 -0
  433. package/src/timers.d.ts +8 -0
  434. package/src/verify.ts +458 -0
  435. package/src/view.ts +200 -0
  436. package/src/web-crypto.d.ts +9 -0
  437. package/src/web-platform.d.ts +35 -0
  438. package/src/wire-registry.ts +14 -0
  439. package/src/worker.ts +374 -0
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Diagnostic codes of the HYGIENE area: requests the gateway refuses because they don't come from
3
+ * the holder of an artifact's capability URL (D06, HY-01). None of them limits what an artifact
4
+ * or an agent may do; each keeps strangers out.
5
+ */
6
+ import type { AreaCatalog } from "../spec.ts";
7
+
8
+ /** The codes of the HYGIENE area, in the order they were added. */
9
+ export const hygieneDiagnosticCodes = [
10
+ "MOSTRA_HYGIENE_HOST_REFUSED",
11
+ "MOSTRA_HYGIENE_ORIGIN_REFUSED",
12
+ "MOSTRA_HYGIENE_CSRF_MISSING",
13
+ "MOSTRA_HYGIENE_CONTENT_TYPE",
14
+ "MOSTRA_HYGIENE_REQUEST_MALFORMED",
15
+ "MOSTRA_HYGIENE_SESSION_MISSING",
16
+ "MOSTRA_HYGIENE_TOKEN_INVALID",
17
+ "MOSTRA_HYGIENE_TOKEN_REVOKED",
18
+ "MOSTRA_HYGIENE_SCOPE_DENIED",
19
+ "MOSTRA_HYGIENE_RATE_LIMITED",
20
+ "MOSTRA_HYGIENE_NOT_SERVED",
21
+ "MOSTRA_HYGIENE_SESSION_CONFLICT",
22
+ "MOSTRA_HYGIENE_HEADERS_TOO_LARGE",
23
+ // gen:codes
24
+ ] as const;
25
+
26
+ /** The codes of the HYGIENE area. */
27
+ export type HygieneDiagnosticCode = (typeof hygieneDiagnosticCodes)[number];
28
+
29
+ /** The HYGIENE area's catalog entries. */
30
+ export const hygieneDiagnostics: AreaCatalog<HygieneDiagnosticCode> = {
31
+ MOSTRA_HYGIENE_HOST_REFUSED: {
32
+ severity: "error",
33
+ phase: "hygiene",
34
+ title: "Host not served",
35
+ hint: "Open the artifact through the exact link Mostra gave you.",
36
+ docs: {
37
+ explanation:
38
+ "The request's `Host` header named a host this gateway doesn't serve. Each gateway listener accepts exactly the host and port its capability URLs use, so a page that rebinds its own DNS name to the loopback address can't reach an artifact (DNS rebinding). The gateway answers 421.",
39
+ fix: "Use the URL from `view/url` or the publish receipt as it is, without replacing `127.0.0.1` by `localhost` or another name. A gateway started with `--bind` and `--url-host` accepts the URL host it was given.",
40
+ },
41
+ },
42
+ MOSTRA_HYGIENE_ORIGIN_REFUSED: {
43
+ severity: "error",
44
+ phase: "hygiene",
45
+ title: "Origin refused",
46
+ hint: "Send the request from the page's own origin.",
47
+ docs: {
48
+ explanation:
49
+ "A request that changes state, opens a stream or upgrades to a WebSocket must carry an `Origin` header equal to the origin it is sent to. The gateway compares the strings exactly and answers 403 otherwise, so another website, or another artifact on a different port, can't drive this one.",
50
+ fix: "Call the gateway from the page it serves: the shell from the shell, the artifact from its own frame. Tools outside a browser send the listener's own origin.",
51
+ },
52
+ },
53
+ MOSTRA_HYGIENE_CSRF_MISSING: {
54
+ severity: "error",
55
+ phase: "hygiene",
56
+ title: "CSRF token missing or wrong",
57
+ hint: "Send the session's CSRF token from `GET /_mostra/session` in the `X-Mostra-CSRF` header.",
58
+ docs: {
59
+ explanation:
60
+ "Every request that changes state through a session carries the session's CSRF token in the `X-Mostra-CSRF` header. The token comes only from the session endpoint of the same origin, which no other page can read. A missing or different token is answered with 403.",
61
+ fix: "Read `csrf` from `GET /_mostra/session` (on the shell, `GET /a/<artifactId>/_mostra/session`) and send it with every POST. Mostra's client runtime and shell do this for you.",
62
+ },
63
+ },
64
+ MOSTRA_HYGIENE_CONTENT_TYPE: {
65
+ severity: "error",
66
+ phase: "hygiene",
67
+ title: "JSON content type required",
68
+ hint: "Send the body as JSON with `Content-Type: application/json`.",
69
+ docs: {
70
+ explanation:
71
+ "Requests that change state must have a JSON body. A form or plain-text body is something any website can send without asking the browser first, so the gateway refuses it with 415.",
72
+ fix: "Send `Content-Type: application/json` and a JSON body.",
73
+ },
74
+ },
75
+ MOSTRA_HYGIENE_REQUEST_MALFORMED: {
76
+ severity: "error",
77
+ phase: "hygiene",
78
+ title: "Malformed request",
79
+ hint: "Send one well-formed HTTP request with a path that starts with `/`.",
80
+ docs: {
81
+ explanation:
82
+ "The gateway refused a request it can't interpret safely: a repeated `Host` or `Origin` header, a request target that isn't a path, an encoded `/` or `..` that would leave the served tree, a body that isn't valid JSON, or a header with control characters. It answers 400 rather than guess.",
83
+ fix: "Send a single request with one `Host` header and a plain path. Browsers always do; this usually means a hand-written client or a probe.",
84
+ },
85
+ },
86
+ MOSTRA_HYGIENE_SESSION_MISSING: {
87
+ severity: "error",
88
+ phase: "hygiene",
89
+ title: "No session",
90
+ hint: "Open the artifact's capability link again to start a session.",
91
+ docs: {
92
+ explanation:
93
+ "The request carried no valid session for this origin. Sessions start when a capability link is opened: the shell exchanges the link's token for a session cookie, and gives the artifact frame a single-use ticket for its own. A session issued for another origin never counts, because every port of the host shares the browser's cookies. The gateway answers 401.",
94
+ fix: "Open the full capability link, including the part after `#`. A bookmark of the page without it works while the browser keeps the session cookie (400 days).",
95
+ },
96
+ },
97
+ MOSTRA_HYGIENE_TOKEN_INVALID: {
98
+ severity: "error",
99
+ phase: "hygiene",
100
+ title: "Unknown capability token",
101
+ hint: "Use the complete capability link Mostra gave you, or mint a new one with `view/url`.",
102
+ docs: {
103
+ explanation:
104
+ "The capability token or frame ticket matched nothing in this home: it was mistyped, cut short, belongs to another home or artifact, or the ticket was already used or expired (tickets last 60 seconds and work once). Over the host protocol, the token ID named in `view/revoke` or `view/rotate` doesn't exist. The gateway answers 401, and failed attempts count towards the rate limit.",
105
+ fix: "Copy the whole link again. An agent or host mints a fresh one with `view/url`; the shell gets a new frame ticket by reloading.",
106
+ },
107
+ },
108
+ MOSTRA_HYGIENE_TOKEN_REVOKED: {
109
+ severity: "error",
110
+ phase: "hygiene",
111
+ title: "Link revoked or expired",
112
+ hint: "Ask for a new link: `view/url` mints one, or `view/rotate` replaces this one.",
113
+ docs: {
114
+ explanation:
115
+ "The capability link was revoked (`view/revoke`), replaced (`view/rotate`), or reached the end of its `ttl`. Every session started from it ends too. The gateway answers 410. Local links have no expiry unless one was asked for.",
116
+ fix: "Get a new link from whoever shared this one. An agent mints it with `view/url`, or rotates the old one with `view/rotate`, and shares the new URL.",
117
+ },
118
+ },
119
+ MOSTRA_HYGIENE_SCOPE_DENIED: {
120
+ severity: "error",
121
+ phase: "hygiene",
122
+ title: "Not allowed by this link",
123
+ hint: "Open a link minted with this scope (`view/url` with `scopes`).",
124
+ docs: {
125
+ explanation:
126
+ "The session's link doesn't carry the scope this request needs: `draft` to save answers, `submit` to submit, `review` to comment, and `action:*`, `action:<export>` or `action:<module path>#<export>` to run a server function. A view-and-comment link, for example, can't submit or run an action. The gateway answers 403.",
127
+ fix: 'Mint a link with the scopes the viewer needs, such as `view/url` with `scopes: ["view", "draft", "submit"]`. Without `scopes`, a link carries every scope.',
128
+ },
129
+ },
130
+ MOSTRA_HYGIENE_RATE_LIMITED: {
131
+ severity: "error",
132
+ phase: "hygiene",
133
+ title: "Too many failed attempts",
134
+ hint: "Wait for the time in `Retry-After`, then open the link again.",
135
+ docs: {
136
+ explanation:
137
+ "More than 30 capability tokens failed for this artifact within a minute, so the gateway refuses every token for it, valid ones included, until the minute has passed. A guess can't succeed while the limit holds, and only this artifact's links wait. The gateway answers 429 with `Retry-After`.",
138
+ fix: "Wait, then open the link again. Repeated failures usually come from a mistyped link or a script retrying an old one.",
139
+ },
140
+ },
141
+ MOSTRA_HYGIENE_NOT_SERVED: {
142
+ severity: "error",
143
+ phase: "hygiene",
144
+ title: "Nothing served here",
145
+ hint: "Request a published version's files or a documented `/_mostra/` path.",
146
+ docs: {
147
+ explanation:
148
+ "The gateway serves only published versions' client files and the browser-protocol paths under `/_mostra/`. Everything else in the home, such as sources, server bundles, staging and unpublished builds, has no URL. A path or method nothing answers gets 404 or 405.",
149
+ fix: "Check the path. Server code runs through the browser protocol, never as a file, and an artifact becomes viewable only once it is published.",
150
+ },
151
+ },
152
+ MOSTRA_HYGIENE_SESSION_CONFLICT: {
153
+ severity: "warning",
154
+ phase: "hygiene",
155
+ title: "Another link is already open for this artifact",
156
+ hint: "Choose which link to keep; send `replace: true` to use the new one.",
157
+ docs: {
158
+ explanation:
159
+ "This browser already has a live session for the artifact from a different link. Opening a link never silently replaces it, because a page elsewhere could send the viewer to its own, narrower link and take over their tabs (D98). The shell shows both links' access and lets the viewer choose; the answer is 409 with `current` and `offered`.",
160
+ fix: "In the shell, choose the link to keep. A client exchanging tokens itself sends `replace: true` to replace the session.",
161
+ },
162
+ },
163
+ MOSTRA_HYGIENE_HEADERS_TOO_LARGE: {
164
+ severity: "error",
165
+ phase: "hygiene",
166
+ title: "The request's headers are too large",
167
+ hint: "Open the link again: this page cleared the cookies that made the request too large.",
168
+ docs: {
169
+ explanation:
170
+ "The request's headers passed the gateway's limit of 1 MiB, more than any browser sends for one host's cookies. Every port of the loopback host shares one cookie jar, so a page on any of them can fill it. The gateway answers 431 with `Clear-Site-Data: \"cookies\"`, which empties the host's cookies, so the next request works. Mostra's sessions go with them and come back when a link is opened again.",
171
+ fix: "Open the artifact's link again. If it keeps happening, find the page that sets the cookies: it runs on this host.",
172
+ },
173
+ },
174
+ // gen:entries
175
+ };
@@ -0,0 +1,142 @@
1
+ /**
2
+ * The diagnostic catalog, assembled from one source file per area. `pnpm gen diagnostic` keeps
3
+ * the lists below in step with the area files; edit the area files, not these lists.
4
+ */
5
+ import type { Diagnostic } from "../diagnostic.ts";
6
+ import { buildDiagnostic, type DiagnosticDetails, type DiagnosticSpec } from "../spec.ts";
7
+ import { type A11yDiagnosticCode, a11yDiagnostics } from "./a11y.ts";
8
+ import { type ActionDiagnosticCode, actionDiagnostics } from "./action.ts";
9
+ import { type ArtifactDiagnosticCode, artifactDiagnostics } from "./artifact.ts";
10
+ import { type BuildDiagnosticCode, buildDiagnostics } from "./build.ts";
11
+ // gen:area-imports
12
+ import { type CliDiagnosticCode, cliDiagnostics } from "./cli.ts";
13
+ import { type ConsoleDiagnosticCode, consoleDiagnostics } from "./console.ts";
14
+ import { type DepDiagnosticCode, depDiagnostics } from "./dep.ts";
15
+ import { type EnvDiagnosticCode, envDiagnostics } from "./env.ts";
16
+ import { type FieldDiagnosticCode, fieldDiagnostics } from "./field.ts";
17
+ import { type HomeDiagnosticCode, homeDiagnostics } from "./home.ts";
18
+ import { type HostDiagnosticCode, hostDiagnostics } from "./host.ts";
19
+ import { type HygieneDiagnosticCode, hygieneDiagnostics } from "./hygiene.ts";
20
+ import { type LiveDiagnosticCode, liveDiagnostics } from "./live.ts";
21
+ import { type ManifestDiagnosticCode, manifestDiagnostics } from "./manifest.ts";
22
+ import { type NetworkDiagnosticCode, networkDiagnostics } from "./network.ts";
23
+ import { type PlatformDiagnosticCode, platformDiagnostics } from "./platform.ts";
24
+ import { type PublishDiagnosticCode, publishDiagnostics } from "./publish.ts";
25
+ import { type RegressionDiagnosticCode, regressionDiagnostics } from "./regression.ts";
26
+ import { type RuntimeDiagnosticCode, runtimeDiagnostics } from "./runtime.ts";
27
+ import { type SecretDiagnosticCode, secretDiagnostics } from "./secret.ts";
28
+ import { type SmokeDiagnosticCode, smokeDiagnostics } from "./smoke.ts";
29
+ import { type SubmitDiagnosticCode, submitDiagnostics } from "./submit.ts";
30
+ import { type TargetDiagnosticCode, targetDiagnostics } from "./target.ts";
31
+ import { type TypeDiagnosticCode, typeDiagnostics } from "./type.ts";
32
+ import { type VerifyDiagnosticCode, verifyDiagnostics } from "./verify.ts";
33
+
34
+ export { type A11yDiagnosticCode, a11yDiagnosticCodes } from "./a11y.ts";
35
+ export { type ActionDiagnosticCode, actionDiagnosticCodes } from "./action.ts";
36
+ export { type ArtifactDiagnosticCode, artifactDiagnosticCodes } from "./artifact.ts";
37
+ export { type BuildDiagnosticCode, buildDiagnosticCodes } from "./build.ts";
38
+ // gen:area-exports
39
+ export { type CliDiagnosticCode, cliDiagnosticCodes } from "./cli.ts";
40
+ export { type ConsoleDiagnosticCode, consoleDiagnosticCodes } from "./console.ts";
41
+ export { type DepDiagnosticCode, depDiagnosticCodes } from "./dep.ts";
42
+ export { type EnvDiagnosticCode, envDiagnosticCodes } from "./env.ts";
43
+ export { type FieldDiagnosticCode, fieldDiagnosticCodes } from "./field.ts";
44
+ export { type HomeDiagnosticCode, homeDiagnosticCodes } from "./home.ts";
45
+ export { type HostDiagnosticCode, hostDiagnosticCodes } from "./host.ts";
46
+ export { type HygieneDiagnosticCode, hygieneDiagnosticCodes } from "./hygiene.ts";
47
+ export { type LiveDiagnosticCode, liveDiagnosticCodes } from "./live.ts";
48
+ export { type ManifestDiagnosticCode, manifestDiagnosticCodes } from "./manifest.ts";
49
+ export { type NetworkDiagnosticCode, networkDiagnosticCodes } from "./network.ts";
50
+ export { type PlatformDiagnosticCode, platformDiagnosticCodes } from "./platform.ts";
51
+ export { type PublishDiagnosticCode, publishDiagnosticCodes } from "./publish.ts";
52
+ export { type RegressionDiagnosticCode, regressionDiagnosticCodes } from "./regression.ts";
53
+ export { type RuntimeDiagnosticCode, runtimeDiagnosticCodes } from "./runtime.ts";
54
+ export { type SecretDiagnosticCode, secretDiagnosticCodes } from "./secret.ts";
55
+ export { type SmokeDiagnosticCode, smokeDiagnosticCodes } from "./smoke.ts";
56
+ export { type SubmitDiagnosticCode, submitDiagnosticCodes } from "./submit.ts";
57
+ export { type TargetDiagnosticCode, targetDiagnosticCodes } from "./target.ts";
58
+ export { type TypeDiagnosticCode, typeDiagnosticCodes } from "./type.ts";
59
+ export { type VerifyDiagnosticCode, verifyDiagnosticCodes } from "./verify.ts";
60
+
61
+ /** Every code in the catalog. Codes are semver surface and are never removed (AX-03). */
62
+ export type KnownDiagnosticCode =
63
+ // gen:area-codes
64
+ | CliDiagnosticCode
65
+ | RegressionDiagnosticCode
66
+ | SmokeDiagnosticCode
67
+ | A11yDiagnosticCode
68
+ | NetworkDiagnosticCode
69
+ | ConsoleDiagnosticCode
70
+ | TypeDiagnosticCode
71
+ | VerifyDiagnosticCode
72
+ | LiveDiagnosticCode
73
+ | SecretDiagnosticCode
74
+ | RuntimeDiagnosticCode
75
+ | FieldDiagnosticCode
76
+ | SubmitDiagnosticCode
77
+ | HygieneDiagnosticCode
78
+ | DepDiagnosticCode
79
+ | EnvDiagnosticCode
80
+ | TargetDiagnosticCode
81
+ | ArtifactDiagnosticCode
82
+ | PublishDiagnosticCode
83
+ | ActionDiagnosticCode
84
+ | BuildDiagnosticCode
85
+ | ManifestDiagnosticCode
86
+ | HomeDiagnosticCode
87
+ | PlatformDiagnosticCode
88
+ | HostDiagnosticCode;
89
+
90
+ /** Every cataloged code with its severity, phase, title, default hint and docs text. */
91
+ export const diagnosticCatalog: Readonly<Record<KnownDiagnosticCode, DiagnosticSpec>> = {
92
+ // gen:area-spreads
93
+ ...cliDiagnostics,
94
+ ...regressionDiagnostics,
95
+ ...smokeDiagnostics,
96
+ ...a11yDiagnostics,
97
+ ...networkDiagnostics,
98
+ ...consoleDiagnostics,
99
+ ...typeDiagnostics,
100
+ ...verifyDiagnostics,
101
+ ...liveDiagnostics,
102
+ ...secretDiagnostics,
103
+ ...runtimeDiagnostics,
104
+ ...fieldDiagnostics,
105
+ ...submitDiagnostics,
106
+ ...hygieneDiagnostics,
107
+ ...depDiagnostics,
108
+ ...envDiagnostics,
109
+ ...targetDiagnostics,
110
+ ...artifactDiagnostics,
111
+ ...publishDiagnostics,
112
+ ...actionDiagnostics,
113
+ ...buildDiagnostics,
114
+ ...manifestDiagnostics,
115
+ ...homeDiagnostics,
116
+ ...platformDiagnostics,
117
+ ...hostDiagnostics,
118
+ };
119
+
120
+ /** Options for {@link createDiagnostic}. */
121
+ export interface CreateDiagnosticOptions {
122
+ /** The docs site base URL. Defaults to `DEFAULT_DOCS_BASE`. */
123
+ readonly docsBase?: string;
124
+ }
125
+
126
+ /**
127
+ * Creates the diagnostic for one occurrence of a cataloged code. Severity, phase, the default hint
128
+ * and the docs link come from the catalog.
129
+ *
130
+ * ```ts
131
+ * createDiagnostic("MOSTRA_HOST_REVISION_UNSUPPORTED", {
132
+ * message: "The client offered 2026-01-01; this instance supports 2026-10-10.",
133
+ * });
134
+ * ```
135
+ */
136
+ export function createDiagnostic(
137
+ code: KnownDiagnosticCode,
138
+ details: DiagnosticDetails,
139
+ options: CreateDiagnosticOptions = {},
140
+ ): Diagnostic {
141
+ return buildDiagnostic(code, diagnosticCatalog[code], details, options.docsBase);
142
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Diagnostic codes of the LIVE area.
3
+ */
4
+ import type { AreaCatalog } from "../spec.ts";
5
+
6
+ /** The codes of the LIVE area, in the order they were added. */
7
+ export const liveDiagnosticCodes = [
8
+ "MOSTRA_LIVE_TOO_LARGE",
9
+ "MOSTRA_LIVE_SOURCE_FAILED",
10
+ // gen:codes
11
+ ] as const;
12
+
13
+ /** The codes of the LIVE area. */
14
+ export type LiveDiagnosticCode = (typeof liveDiagnosticCodes)[number];
15
+
16
+ /** The LIVE area's catalog entries. */
17
+ export const liveDiagnostics: AreaCatalog<LiveDiagnosticCode> = {
18
+ MOSTRA_LIVE_TOO_LARGE: {
19
+ severity: "error",
20
+ phase: "runtime",
21
+ title: "Live value too large",
22
+ hint: "Push or produce a smaller value: at most 4 MiB serialized.",
23
+ docs: {
24
+ explanation:
25
+ "A live value, pushed or produced, is over 4 MiB once serialized (DATA_MODEL \u00a75). It is refused and the last good value stays.",
26
+ fix: "Send a smaller window of the data, or split it across several live sources. For high-rate series, push single points in append mode and let the page keep the window.",
27
+ },
28
+ },
29
+ MOSTRA_LIVE_SOURCE_FAILED: {
30
+ severity: "error",
31
+ phase: "runtime",
32
+ title: "Live source failed",
33
+ hint: "Read the message, fix the live source's loader or stream, and publish again; the last good value stays meanwhile.",
34
+ docs: {
35
+ explanation:
36
+ "A live source's `load` or `stream` threw, or its value was outside the serializable types. Pages keep showing the last good value with `useLive`'s `error` set, and the producer tries again on its schedule (FAILURE_MODEL \u00a76).",
37
+ fix: "Fix the producer in `live.ts`, or catch transient failures there and return the previous value.",
38
+ },
39
+ },
40
+ // gen:entries
41
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Diagnostic codes of the MANIFEST area.
3
+ */
4
+ import type { AreaCatalog } from "../spec.ts";
5
+
6
+ /** The codes of the MANIFEST area, in the order they were added. */
7
+ export const manifestDiagnosticCodes = [
8
+ "MOSTRA_MANIFEST_NOT_LITERAL",
9
+ "MOSTRA_MANIFEST_INVALID",
10
+ "MOSTRA_MANIFEST_UNKNOWN_KEY",
11
+ // gen:codes
12
+ ] as const;
13
+
14
+ /** The codes of the MANIFEST area. */
15
+ export type ManifestDiagnosticCode = (typeof manifestDiagnosticCodes)[number];
16
+
17
+ /** The MANIFEST area's catalog entries. */
18
+ export const manifestDiagnostics: AreaCatalog<ManifestDiagnosticCode> = {
19
+ MOSTRA_MANIFEST_NOT_LITERAL: {
20
+ severity: "error",
21
+ phase: "manifest",
22
+ title: "Manifest isn't a literal",
23
+ hint: "Write the manifest as plain values: strings, numbers, booleans, null, arrays and objects, with no variables, calls, spreads or computed keys.",
24
+ docs: {
25
+ explanation:
26
+ "Mostra reads an artifact's manifest without running its code: the `export const artifact = defineArtifact({...})` in a TSX entry, or the frontmatter of an MDX entry. It reports this code when the exported `artifact` isn't a `defineArtifact(...)` call with one object literal, or when a value inside it needs evaluation (an identifier, a function call, a spread, a computed key, a template literal with a placeholder). The location points at the first such value.",
27
+ fix: 'Replace the value with the literal it stands for, for example `title: "Q3 review"` instead of `title: TITLE`. Keep computed values in the page code, where they can use anything. `as const` and `satisfies` on the object are fine.',
28
+ },
29
+ },
30
+ MOSTRA_MANIFEST_INVALID: {
31
+ severity: "error",
32
+ phase: "manifest",
33
+ title: "Manifest value is invalid",
34
+ hint: "Fix the manifest field named in the message so it matches the manifest's documented shape.",
35
+ docs: {
36
+ explanation:
37
+ "The manifest was read, but a field has a value the manifest doesn't allow: a missing `title`, a wrong type, an `id` that isn't an artifact ID (`art_` followed by a ULID), a `mode` this runtime doesn't build (`spa` is the only one), or frontmatter that isn't valid YAML. The message names the field and what was expected.",
38
+ fix: "Correct the field the message names. Leave `id` out to let Mostra bind the artifact to its source path at first publish, or keep the `id` that `mostra new` wrote. Every field except `title` is optional.",
39
+ },
40
+ },
41
+ MOSTRA_MANIFEST_UNKNOWN_KEY: {
42
+ severity: "warning",
43
+ phase: "manifest",
44
+ title: "Unknown manifest key",
45
+ hint: "Remove the key or correct its spelling; a newer Mostra may support it.",
46
+ docs: {
47
+ explanation:
48
+ "The manifest has a key this runtime doesn't know. Mostra ignores it, so manifests written for a newer release still publish, but a misspelled key (`familly`, `decription`) silently has no effect.",
49
+ fix: "Check the key against the manifest fields (`id`, `title`, `description`, `family`, `links`, `mode`, `submission`, `kit`, `terminals`, `demos`, `limits`, `verify`) and fix the spelling, or remove it.",
50
+ },
51
+ },
52
+ // gen:entries
53
+ };
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Diagnostic codes of the NETWORK area.
3
+ */
4
+ import type { AreaCatalog } from "../spec.ts";
5
+
6
+ /** The codes of the NETWORK area, in the order they were added. */
7
+ export const networkDiagnosticCodes = [
8
+ "MOSTRA_NETWORK_REQUEST_FAILED",
9
+ "MOSTRA_NETWORK_EXTERNAL_FAILED",
10
+ // gen:codes
11
+ ] as const;
12
+
13
+ /** The codes of the NETWORK area. */
14
+ export type NetworkDiagnosticCode = (typeof networkDiagnosticCodes)[number];
15
+
16
+ /** The NETWORK area's catalog entries. */
17
+ export const networkDiagnostics: AreaCatalog<NetworkDiagnosticCode> = {
18
+ MOSTRA_NETWORK_REQUEST_FAILED: {
19
+ severity: "error",
20
+ phase: "network",
21
+ title: "Request for the page's own resource failed",
22
+ hint: "Check the path: a file the page loads from the artifact itself failed to load.",
23
+ docs: {
24
+ explanation:
25
+ "A resource the page loaded from the artifact's own origin (the document, a script, a style, an image, a font, or a fetch by artifact code) failed or answered 4xx or 5xx. Requests the browser makes on its own, such as `/favicon.ico`, and Mostra's own protocol aren't counted.",
26
+ fix: "Put the file in `public/` (served at the root) or import it from the code so the build includes it, and check the path's spelling.",
27
+ },
28
+ },
29
+ MOSTRA_NETWORK_EXTERNAL_FAILED: {
30
+ severity: "warning",
31
+ phase: "network",
32
+ title: "Request to another origin failed",
33
+ hint: "A request to another origin failed while verify ran; check the URL and whether that service was reachable.",
34
+ docs: {
35
+ explanation:
36
+ "A request the page made to another origin failed or answered 4xx or 5xx. It may be the environment (no network, a service that is down, a request the service refuses from this origin) rather than the code, so it is a warning.",
37
+ fix: "Check the URL and the service. If the page depends on it, show a fallback when it fails.",
38
+ },
39
+ },
40
+ // gen:entries
41
+ };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Diagnostic codes of the PLATFORM area: the operating systems and architectures Mostra runs on
3
+ * (D35, RT-07).
4
+ */
5
+ import type { AreaCatalog } from "../spec.ts";
6
+
7
+ /** The codes of the PLATFORM area, in the order they were added. */
8
+ export const platformDiagnosticCodes = [
9
+ "MOSTRA_PLATFORM_UNSUPPORTED",
10
+ // gen:codes
11
+ ] as const;
12
+
13
+ /** The codes of the PLATFORM area. */
14
+ export type PlatformDiagnosticCode = (typeof platformDiagnosticCodes)[number];
15
+
16
+ /** The PLATFORM area's catalog entries. */
17
+ export const platformDiagnostics: AreaCatalog<PlatformDiagnosticCode> = {
18
+ MOSTRA_PLATFORM_UNSUPPORTED: {
19
+ severity: "error",
20
+ phase: "platform",
21
+ title: "Unsupported platform",
22
+ hint: "Run Mostra on macOS or Linux, on an x64 or arm64 machine.",
23
+ docs: {
24
+ explanation:
25
+ "Mostra 1.0 runs on macOS and Linux, on x64 and arm64. On any other operating system or architecture, Windows included, every entry point stops with this code before it creates or changes anything, because the process model, sockets and storage are built and tested only on those platforms. The message names the platform that was detected.",
26
+ fix: "Run Mostra on a macOS or Linux machine with an x64 or arm64 processor. Windows support is planned for a release after 1.0.",
27
+ },
28
+ },
29
+ // gen:entries
30
+ };
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Diagnostic codes of the PUBLISH area.
3
+ */
4
+ import type { AreaCatalog } from "../spec.ts";
5
+
6
+ /** The codes of the PUBLISH area, in the order they were added. */
7
+ export const publishDiagnosticCodes = [
8
+ "MOSTRA_PUBLISH_ID_CONFLICT",
9
+ "MOSTRA_PUBLISH_SOURCE_CHANGED",
10
+ "MOSTRA_PUBLISH_VERIFY_FAILED",
11
+ // gen:codes
12
+ ] as const;
13
+
14
+ /** The codes of the PUBLISH area. */
15
+ export type PublishDiagnosticCode = (typeof publishDiagnosticCodes)[number];
16
+
17
+ /** The PUBLISH area's catalog entries. */
18
+ export const publishDiagnostics: AreaCatalog<PublishDiagnosticCode> = {
19
+ MOSTRA_PUBLISH_ID_CONFLICT: {
20
+ severity: "error",
21
+ phase: "publish",
22
+ title: "Artifact ID claimed by two sources",
23
+ hint: "Give one of the two sources a different `id`, or delete the `id` line from the copy so it becomes a new artifact.",
24
+ docs: {
25
+ explanation:
26
+ "An artifact's `id` names exactly one source. Mostra reports this code when a manifest claims an `id` that is already bound to another source path whose entry still claims it, which usually means a directory was copied. A source that moved, so that the old path no longer claims the `id`, is rebound instead. The message names both paths.",
27
+ fix: "Decide which source is the artifact. In the other one, remove the `id` from the manifest (it is then bound to its own path at its first publish) or replace it with a new ID from `mostra new`.",
28
+ },
29
+ },
30
+ MOSTRA_PUBLISH_SOURCE_CHANGED: {
31
+ severity: "error",
32
+ phase: "publish",
33
+ title: "Source changed during the publish",
34
+ hint: "Publish again once the artifact's files have stopped changing.",
35
+ docs: {
36
+ explanation:
37
+ "Publishing reads the entry's manifest twice: once to find the artifact, and again from the snapshot it builds. Mostra reports this code when the two disagree about which artifact the source is, because the manifest `id` or the source's binding changed while the publish ran, for example when an editor saved the entry mid-publish or another publish rebound the path. Nothing was published.",
38
+ fix: "Wait until the files are saved and nothing else is publishing the same source, then publish again. If the manifest `id` was changed on purpose, the next publish uses the new one.",
39
+ },
40
+ },
41
+ MOSTRA_PUBLISH_VERIFY_FAILED: {
42
+ severity: "error",
43
+ phase: "publish",
44
+ title: "Verify found errors",
45
+ hint: "Run `mostra verify` to see the errors and fix them, or publish with `--force` to record them in the version.",
46
+ docs: {
47
+ explanation:
48
+ "Publish runs verify (or reuses the verdict it cached for the same source and environment) and refuses when the verdict has errors (D41). The message lists their codes. Nothing was published. With `--force`, publish goes ahead and records the codes in the version, where hosts read them; a source that doesn't build can't be published either way.",
49
+ fix: "Fix the errors `mostra verify` reports and publish again, or publish with `--force` if the version must ship as it is.",
50
+ },
51
+ },
52
+ // gen:entries
53
+ };
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Diagnostic codes of the REGRESSION area.
3
+ */
4
+ import type { AreaCatalog } from "../spec.ts";
5
+
6
+ /** The codes of the REGRESSION area, in the order they were added. */
7
+ export const regressionDiagnosticCodes = [
8
+ "MOSTRA_REGRESSION_ARIA",
9
+ "MOSTRA_REGRESSION_PIXELS",
10
+ "MOSTRA_REGRESSION_FIELD_REMOVED",
11
+ "MOSTRA_REGRESSION_ACTION_REMOVED",
12
+ "MOSTRA_REGRESSION_LIVE_REMOVED",
13
+ "MOSTRA_REGRESSION_PAGE_REMOVED",
14
+ // gen:codes
15
+ ] as const;
16
+
17
+ /** The codes of the REGRESSION area. */
18
+ export type RegressionDiagnosticCode = (typeof regressionDiagnosticCodes)[number];
19
+
20
+ /** The REGRESSION area's catalog entries. */
21
+ export const regressionDiagnostics: AreaCatalog<RegressionDiagnosticCode> = {
22
+ MOSTRA_REGRESSION_ARIA: {
23
+ severity: "warning",
24
+ phase: "regression",
25
+ title: "Controls or landmarks gone since the last passing version",
26
+ hint: "Observed only: the last passing version had these controls or landmarks and this source doesn't; a change that removed them on purpose needs nothing more.",
27
+ docs: {
28
+ explanation:
29
+ "Verify compared this source's accessibility snapshot with the newest version whose verdict passed, rendered in the same run with the same data. The controls or landmarks the message lists (by role and name) were there and aren't now. A redesign may remove them on purpose.",
30
+ fix: "If they should be gone, nothing needs to change. If not, look at what removed them.",
31
+ },
32
+ },
33
+ MOSTRA_REGRESSION_PIXELS: {
34
+ severity: "warning",
35
+ phase: "regression",
36
+ title: "Page looks different from the last passing version",
37
+ hint: "Observed only: this share of the viewport's pixels differs from the last passing version; an intended visual change shows here too and needs nothing more.",
38
+ docs: {
39
+ explanation:
40
+ "Verify rendered the newest version whose verdict passed and this source at the same viewport, clock and data, and the share of pixels the message gives differs between them. Any intended visual change shows here too.",
41
+ fix: "If the change is one you made on purpose, nothing needs to change. To see where it is, read the ARIA snapshots, or look at the diff image the message names if you can view images.",
42
+ },
43
+ },
44
+ MOSTRA_REGRESSION_FIELD_REMOVED: {
45
+ severity: "warning",
46
+ phase: "contract",
47
+ title: "Field gone since the last passing version",
48
+ hint: "Observed only: answers saved under this field ID won't carry over to this version; a field removed on purpose needs nothing more.",
49
+ docs: {
50
+ explanation:
51
+ "A field ID the last passing version used is gone from this source. Viewers' answers under it become orphans when they switch (D42): kept, shown read-only and delivered, but not editable. The message gives how many saved answers it affects.",
52
+ fix: "If the field was renamed by mistake, keep its old ID. If it was removed on purpose, nothing needs to change.",
53
+ },
54
+ },
55
+ MOSTRA_REGRESSION_ACTION_REMOVED: {
56
+ severity: "warning",
57
+ phase: "contract",
58
+ title: "Server function gone since the last passing version",
59
+ hint: "Observed only: the last passing version had this server function and this source doesn't; one removed on purpose needs nothing more.",
60
+ docs: {
61
+ explanation:
62
+ 'A `"use server"` export the last passing version had is gone. Pages of the older version still call it while they are open, and keyed runs started by it can\'t be started again.',
63
+ fix: "If it was renamed by mistake, keep its name. If it was removed on purpose, nothing needs to change.",
64
+ },
65
+ },
66
+ MOSTRA_REGRESSION_LIVE_REMOVED: {
67
+ severity: "warning",
68
+ phase: "contract",
69
+ title: "Live source gone since the last passing version",
70
+ hint: "Observed only: the last passing version had this live source and this source doesn't; one removed on purpose needs nothing more.",
71
+ docs: {
72
+ explanation:
73
+ "A live source (`live.ts` export) the last passing version had is gone, so its producer stops and hosts that push to it push to a key no page reads.",
74
+ fix: "If it was renamed by mistake, keep its name. If it was removed on purpose, nothing needs to change.",
75
+ },
76
+ },
77
+ MOSTRA_REGRESSION_PAGE_REMOVED: {
78
+ severity: "warning",
79
+ phase: "contract",
80
+ title: "Page route gone since the last passing version",
81
+ hint: "Observed only: the last passing version had this page route and this source doesn't; one removed on purpose needs nothing more.",
82
+ docs: {
83
+ explanation:
84
+ "A route of `pages/` the last passing version had is gone, so links and bookmarks to it now open the artifact's fallback page.",
85
+ fix: "If it was renamed by mistake, keep its path. If it was removed on purpose, nothing needs to change.",
86
+ },
87
+ },
88
+ // gen:entries
89
+ };