@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,99 @@
1
+ //#region src/diagnostics/codes/submit.ts
2
+ /** The codes of the SUBMIT area, in the order they were added. */
3
+ const submitDiagnosticCodes = [
4
+ "MOSTRA_SUBMIT_ALREADY",
5
+ "MOSTRA_SUBMIT_REVISION_MOVED",
6
+ "MOSTRA_SUBMIT_POLICY_NONE",
7
+ "MOSTRA_SUBMIT_NOT_FOUND",
8
+ "MOSTRA_SUBMIT_VIEW_INVALID",
9
+ "MOSTRA_SUBMIT_SIGNAL_INVALID",
10
+ "MOSTRA_SUBMIT_CHANNEL_DENIED",
11
+ "MOSTRA_SUBMIT_BLOCKED"
12
+ ];
13
+ /** The SUBMIT area's catalog entries. */
14
+ const submitDiagnostics = {
15
+ MOSTRA_SUBMIT_ALREADY: {
16
+ severity: "error",
17
+ phase: "runtime",
18
+ title: "Already submitted",
19
+ hint: "This artifact takes one submission, and it was made; read it with `mostra results`.",
20
+ docs: {
21
+ explanation: "The artifact's submission policy is `once`, and a submission already closed this draft: for scope `per-artifact` any viewer's submission closes every draft, for `per-viewer` the viewer's own. A submission is immutable and final, so Mostra refuses a second one and further edits to the closed draft. The refusal carries the existing submission. A repeated submit of the same view at the same draft revision is not refused: it returns the original submission.",
22
+ fix: "Read the existing submission with `mostra results <artifact>`. When another round of answers is wanted, publish a new artifact linked to this one (`links: [{ rel: \"round-of\", artifact }]`), or have the host publish with the `epochs` policy."
23
+ }
24
+ },
25
+ MOSTRA_SUBMIT_REVISION_MOVED: {
26
+ severity: "error",
27
+ phase: "runtime",
28
+ title: "Draft changed before submit",
29
+ hint: "Reload the draft, check what changed, and submit again with its current revision.",
30
+ docs: {
31
+ explanation: "A submit names the draft revision the viewer saw (`expectedRevision`), and the draft has changed since: another tab, device or writer saved an edit. Mostra never makes a submission from content the viewer didn't see (FAILURE_MODEL §4), so it refuses. The message names the draft's current revision.",
32
+ fix: "Let the page reload the draft so the viewer sees exactly what will be sent, then submit with the new revision. The shell and the client runtime flush pending saves before they submit, which makes this rare."
33
+ }
34
+ },
35
+ MOSTRA_SUBMIT_POLICY_NONE: {
36
+ severity: "error",
37
+ phase: "runtime",
38
+ title: "Artifact takes no submissions",
39
+ hint: "Exchange data through artifact state, actions and signals; this artifact has no submissions.",
40
+ docs: {
41
+ explanation: "The artifact's submission policy is `none` (D63): long-lived artifacts such as dashboards and task managers talk to agents through artifact state, actions, signals and events, and the shell shows no Submit control. Mostra refuses a submit, and a `wait --until submitted`, on such an artifact.",
42
+ fix: "Wait for a signal (`--until signal:<name>`), a state change (`--until state:<field>`) or an event instead, and read state with `mostra state get`. To collect submissions, publish with policy `once` or `epochs`."
43
+ }
44
+ },
45
+ MOSTRA_SUBMIT_NOT_FOUND: {
46
+ severity: "error",
47
+ phase: "runtime",
48
+ title: "No such submission",
49
+ hint: "Wait for a submission with `mostra wait <artifact> --until submitted`, or name one that exists.",
50
+ docs: {
51
+ explanation: "The artifact has no submission yet, or none with the ID asked for. Submissions are durable once made, so this means none was made (or the ID belongs to another artifact or home).",
52
+ fix: "Run `mostra wait <artifact> --until submitted` to block until the viewer submits, then read the results. List the artifact's submissions through `submission.created` events."
53
+ }
54
+ },
55
+ MOSTRA_SUBMIT_VIEW_INVALID: {
56
+ severity: "error",
57
+ phase: "runtime",
58
+ title: "Unknown view",
59
+ hint: "Send the view ID this page was opened with.",
60
+ docs: {
61
+ explanation: "Mutations and submits name the view they come from, the one the shell created when it opened this frame. The view named doesn't exist, belongs to another artifact, or belongs to another viewer. Mostra binds every submission to the exact version its view showed, so it refuses a view it can't place.",
62
+ fix: "Use the `viewId` the shell handed this frame. A page opened outside Mostra's shell has no view and can't submit."
63
+ }
64
+ },
65
+ MOSTRA_SUBMIT_SIGNAL_INVALID: {
66
+ severity: "error",
67
+ phase: "runtime",
68
+ title: "Invalid signal",
69
+ hint: "Name signals with letters, digits, `.`, `_` and `-`, and keep their payload under 64 KiB of JSON.",
70
+ docs: {
71
+ explanation: "A signal names something the artifact wants a host's attention for, such as `ping-agent`. Its name is 1 to 64 characters of letters, digits, `.`, `_` and `-`, starting with a letter or digit, and its payload is JSON of at most 64 KiB. This one broke one of those rules. The name `submit` is reserved for submissions.",
72
+ fix: "Rename the signal or shrink its payload; put large data into a field or artifact state and send its ID in the payload."
73
+ }
74
+ },
75
+ MOSTRA_SUBMIT_CHANNEL_DENIED: {
76
+ severity: "error",
77
+ phase: "runtime",
78
+ title: "Submit channel not allowed",
79
+ hint: "Let the viewer submit with the shell's trusted Submit; this host doesn't take submissions from artifact code.",
80
+ docs: {
81
+ explanation: "A submission comes through one of two channels (D40): the shell's trusted Submit (`shell`), which only a person can press, or the artifact's own code (`artifact`, `useSubmit().submit()` and `useChoice().choose()`). The host decides which it accepts (D108): through `HomeConfig.submitChannels` for the home, or its `trustedControls` port for each artifact. This view allows only the other channel, so Mostra refused the submit or the choice. `useSubmit().allowed` is `false` in such a view.",
82
+ fix: "Ask the viewer to press the shell's Submit (relabel it with `useSubmitControl`), and use `useChoice(id, { candidates })` to have the shell render a trusted Choose. Check `allowed` before showing an in-page submit button."
83
+ }
84
+ },
85
+ MOSTRA_SUBMIT_BLOCKED: {
86
+ severity: "error",
87
+ phase: "runtime",
88
+ title: "Answers missing before submit",
89
+ hint: "Fill in the fields this diagnostic lists, fix their errors or resolve their conflicts, then submit again.",
90
+ docs: {
91
+ explanation: "Before a submit, the shell and the client runtime check every mounted field (D106): a `required` field without a value, a value its `validate` rejects, or a conflict the viewer hasn't resolved blocks the submit. The diagnostic lists the blockers with their field IDs and labels; `useSubmit().blockers` lists them before anyone submits. Nothing was submitted.",
92
+ fix: "Show `useSubmit().blockers` next to your submit button, or let the shell list them by label. Answer the required fields, fix the invalid values, and keep or take the conflicting values, then submit again."
93
+ }
94
+ }
95
+ };
96
+ //#endregion
97
+ export { submitDiagnosticCodes, submitDiagnostics };
98
+
99
+ //# sourceMappingURL=submit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"submit.js","names":[],"sources":["../../../src/diagnostics/codes/submit.ts"],"sourcesContent":["/**\n * Diagnostic codes of the SUBMIT area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the SUBMIT area, in the order they were added. */\nexport const submitDiagnosticCodes = [\n \"MOSTRA_SUBMIT_ALREADY\",\n \"MOSTRA_SUBMIT_REVISION_MOVED\",\n \"MOSTRA_SUBMIT_POLICY_NONE\",\n \"MOSTRA_SUBMIT_NOT_FOUND\",\n \"MOSTRA_SUBMIT_VIEW_INVALID\",\n \"MOSTRA_SUBMIT_SIGNAL_INVALID\",\n \"MOSTRA_SUBMIT_CHANNEL_DENIED\",\n \"MOSTRA_SUBMIT_BLOCKED\",\n // gen:codes\n] as const;\n\n/** The codes of the SUBMIT area. */\nexport type SubmitDiagnosticCode = (typeof submitDiagnosticCodes)[number];\n\n/** The SUBMIT area's catalog entries. */\nexport const submitDiagnostics: AreaCatalog<SubmitDiagnosticCode> = {\n MOSTRA_SUBMIT_ALREADY: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Already submitted\",\n hint: \"This artifact takes one submission, and it was made; read it with `mostra results`.\",\n docs: {\n explanation:\n \"The artifact's submission policy is `once`, and a submission already closed this draft: for scope `per-artifact` any viewer's submission closes every draft, for `per-viewer` the viewer's own. A submission is immutable and final, so Mostra refuses a second one and further edits to the closed draft. The refusal carries the existing submission. A repeated submit of the same view at the same draft revision is not refused: it returns the original submission.\",\n fix: 'Read the existing submission with `mostra results <artifact>`. When another round of answers is wanted, publish a new artifact linked to this one (`links: [{ rel: \"round-of\", artifact }]`), or have the host publish with the `epochs` policy.',\n },\n },\n MOSTRA_SUBMIT_REVISION_MOVED: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Draft changed before submit\",\n hint: \"Reload the draft, check what changed, and submit again with its current revision.\",\n docs: {\n explanation:\n \"A submit names the draft revision the viewer saw (`expectedRevision`), and the draft has changed since: another tab, device or writer saved an edit. Mostra never makes a submission from content the viewer didn't see (FAILURE_MODEL §4), so it refuses. The message names the draft's current revision.\",\n fix: \"Let the page reload the draft so the viewer sees exactly what will be sent, then submit with the new revision. The shell and the client runtime flush pending saves before they submit, which makes this rare.\",\n },\n },\n MOSTRA_SUBMIT_POLICY_NONE: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Artifact takes no submissions\",\n hint: \"Exchange data through artifact state, actions and signals; this artifact has no submissions.\",\n docs: {\n explanation:\n \"The artifact's submission policy is `none` (D63): long-lived artifacts such as dashboards and task managers talk to agents through artifact state, actions, signals and events, and the shell shows no Submit control. Mostra refuses a submit, and a `wait --until submitted`, on such an artifact.\",\n fix: \"Wait for a signal (`--until signal:<name>`), a state change (`--until state:<field>`) or an event instead, and read state with `mostra state get`. To collect submissions, publish with policy `once` or `epochs`.\",\n },\n },\n MOSTRA_SUBMIT_NOT_FOUND: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"No such submission\",\n hint: \"Wait for a submission with `mostra wait <artifact> --until submitted`, or name one that exists.\",\n docs: {\n explanation:\n \"The artifact has no submission yet, or none with the ID asked for. Submissions are durable once made, so this means none was made (or the ID belongs to another artifact or home).\",\n fix: \"Run `mostra wait <artifact> --until submitted` to block until the viewer submits, then read the results. List the artifact's submissions through `submission.created` events.\",\n },\n },\n MOSTRA_SUBMIT_VIEW_INVALID: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Unknown view\",\n hint: \"Send the view ID this page was opened with.\",\n docs: {\n explanation:\n \"Mutations and submits name the view they come from, the one the shell created when it opened this frame. The view named doesn't exist, belongs to another artifact, or belongs to another viewer. Mostra binds every submission to the exact version its view showed, so it refuses a view it can't place.\",\n fix: \"Use the `viewId` the shell handed this frame. A page opened outside Mostra's shell has no view and can't submit.\",\n },\n },\n MOSTRA_SUBMIT_SIGNAL_INVALID: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Invalid signal\",\n hint: \"Name signals with letters, digits, `.`, `_` and `-`, and keep their payload under 64 KiB of JSON.\",\n docs: {\n explanation:\n \"A signal names something the artifact wants a host's attention for, such as `ping-agent`. Its name is 1 to 64 characters of letters, digits, `.`, `_` and `-`, starting with a letter or digit, and its payload is JSON of at most 64 KiB. This one broke one of those rules. The name `submit` is reserved for submissions.\",\n fix: \"Rename the signal or shrink its payload; put large data into a field or artifact state and send its ID in the payload.\",\n },\n },\n MOSTRA_SUBMIT_CHANNEL_DENIED: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Submit channel not allowed\",\n hint: \"Let the viewer submit with the shell's trusted Submit; this host doesn't take submissions from artifact code.\",\n docs: {\n explanation:\n \"A submission comes through one of two channels (D40): the shell's trusted Submit (`shell`), which only a person can press, or the artifact's own code (`artifact`, `useSubmit().submit()` and `useChoice().choose()`). The host decides which it accepts (D108): through `HomeConfig.submitChannels` for the home, or its `trustedControls` port for each artifact. This view allows only the other channel, so Mostra refused the submit or the choice. `useSubmit().allowed` is `false` in such a view.\",\n fix: \"Ask the viewer to press the shell's Submit (relabel it with `useSubmitControl`), and use `useChoice(id, { candidates })` to have the shell render a trusted Choose. Check `allowed` before showing an in-page submit button.\",\n },\n },\n MOSTRA_SUBMIT_BLOCKED: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Answers missing before submit\",\n hint: \"Fill in the fields this diagnostic lists, fix their errors or resolve their conflicts, then submit again.\",\n docs: {\n explanation:\n \"Before a submit, the shell and the client runtime check every mounted field (D106): a `required` field without a value, a value its `validate` rejects, or a conflict the viewer hasn't resolved blocks the submit. The diagnostic lists the blockers with their field IDs and labels; `useSubmit().blockers` lists them before anyone submits. Nothing was submitted.\",\n fix: \"Show `useSubmit().blockers` next to your submit button, or let the shell list them by label. Answer the required fields, fix the invalid values, and keep or take the conflicting values, then submit again.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,oBAAuD;CAClE,uBAAuB;EACrB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,yBAAyB;EACvB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,4BAA4B;EAC1B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,uBAAuB;EACrB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
@@ -0,0 +1,8 @@
1
+ import "../spec.js";
2
+ //#region src/diagnostics/codes/target.d.ts
3
+ /** The codes of the TARGET area, in the order they were added. */
4
+ export declare const targetDiagnosticCodes: readonly ["MOSTRA_TARGET_UNAVAILABLE"];
5
+ /** The codes of the TARGET area. */
6
+ export type TargetDiagnosticCode = (typeof targetDiagnosticCodes)[number];
7
+ //#endregion
8
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","names":[],"sources":["../../../src/diagnostics/codes/target.ts"],"mappings":";;;qBAMa;;YAMD,+BAA+B"}
@@ -0,0 +1,18 @@
1
+ //#region src/diagnostics/codes/target.ts
2
+ /** The codes of the TARGET area, in the order they were added. */
3
+ const targetDiagnosticCodes = ["MOSTRA_TARGET_UNAVAILABLE"];
4
+ /** The TARGET area's catalog entries. */
5
+ const targetDiagnostics = { MOSTRA_TARGET_UNAVAILABLE: {
6
+ severity: "error",
7
+ phase: "runtime",
8
+ title: "Not available in this delivery target",
9
+ hint: "Open the published version through Mostra to use this feature.",
10
+ docs: {
11
+ explanation: "The page called something that needs Mostra's server, such as a server function, and this delivery target doesn't provide it: a static export, a file opened from disk, or a runtime without server support. The page keeps working without it.",
12
+ fix: "Open the artifact through its Mostra link, where server functions, submissions and live data are available. In a static export, handle the error so the page explains what isn't available."
13
+ }
14
+ } };
15
+ //#endregion
16
+ export { targetDiagnosticCodes, targetDiagnostics };
17
+
18
+ //# sourceMappingURL=target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.js","names":[],"sources":["../../../src/diagnostics/codes/target.ts"],"sourcesContent":["/**\n * Diagnostic codes of the TARGET area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the TARGET area, in the order they were added. */\nexport const targetDiagnosticCodes = [\n \"MOSTRA_TARGET_UNAVAILABLE\",\n // gen:codes\n] as const;\n\n/** The codes of the TARGET area. */\nexport type TargetDiagnosticCode = (typeof targetDiagnosticCodes)[number];\n\n/** The TARGET area's catalog entries. */\nexport const targetDiagnostics: AreaCatalog<TargetDiagnosticCode> = {\n MOSTRA_TARGET_UNAVAILABLE: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Not available in this delivery target\",\n hint: \"Open the published version through Mostra to use this feature.\",\n docs: {\n explanation:\n \"The page called something that needs Mostra's server, such as a server function, and this delivery target doesn't provide it: a static export, a file opened from disk, or a runtime without server support. The page keeps working without it.\",\n fix: \"Open the artifact through its Mostra link, where server functions, submissions and live data are available. In a static export, handle the error so the page explains what isn't available.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,wBAAwB,CACnC,2BAEF;;AAMA,MAAa,oBAAuD,EAClE,2BAA2B;CACzB,UAAU;CACV,OAAO;CACP,OAAO;CACP,MAAM;CACN,MAAM;EACJ,aACE;EACF,KAAK;CACP;AACF,EAEF"}
@@ -0,0 +1,8 @@
1
+ import "../spec.js";
2
+ //#region src/diagnostics/codes/type.d.ts
3
+ /** The codes of the TYPE area, in the order they were added. */
4
+ export declare const typeDiagnosticCodes: readonly ["MOSTRA_TYPE_ERROR", "MOSTRA_TYPE_UNTYPED_PACKAGE"];
5
+ /** The codes of the TYPE area. */
6
+ export type TypeDiagnosticCode = (typeof typeDiagnosticCodes)[number];
7
+ //#endregion
8
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","names":[],"sources":["../../../src/diagnostics/codes/type.ts"],"mappings":";;;qBAMa;;YAOD,6BAA6B"}
@@ -0,0 +1,30 @@
1
+ //#region src/diagnostics/codes/type.ts
2
+ /** The codes of the TYPE area, in the order they were added. */
3
+ const typeDiagnosticCodes = ["MOSTRA_TYPE_ERROR", "MOSTRA_TYPE_UNTYPED_PACKAGE"];
4
+ /** The TYPE area's catalog entries. */
5
+ const typeDiagnostics = {
6
+ MOSTRA_TYPE_ERROR: {
7
+ severity: "error",
8
+ phase: "compile",
9
+ title: "Type error",
10
+ hint: "Fix the type error at the reported location; the message carries TypeScript's code and text.",
11
+ docs: {
12
+ explanation: "TypeScript's checker (`tsc --noEmit`, TypeScript 7) found an error in the artifact's code. Verify checks with the artifact's own `tsconfig.json` when it has one, else in strict mode without the unused-variable rules, and resolves imports exactly as the build does. MDX isn't checked.",
13
+ fix: "Open the file at the reported line and fix the code, for example a missing property, a wrong argument type or a misspelled import."
14
+ }
15
+ },
16
+ MOSTRA_TYPE_UNTYPED_PACKAGE: {
17
+ severity: "warning",
18
+ phase: "compile",
19
+ title: "Package without type declarations",
20
+ hint: "Nothing breaks: the package works without types; declare a module for it if you want them checked.",
21
+ docs: {
22
+ explanation: "The artifact imports a package that ships no type declarations (TypeScript's TS7016). The package still builds and runs, so this is a warning: its values are typed `any`.",
23
+ fix: "Optionally add a declaration file such as `declare module \"<package>\";`, or a typed wrapper, to the artifact."
24
+ }
25
+ }
26
+ };
27
+ //#endregion
28
+ export { typeDiagnosticCodes, typeDiagnostics };
29
+
30
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","names":[],"sources":["../../../src/diagnostics/codes/type.ts"],"sourcesContent":["/**\n * Diagnostic codes of the TYPE area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the TYPE area, in the order they were added. */\nexport const typeDiagnosticCodes = [\n \"MOSTRA_TYPE_ERROR\",\n \"MOSTRA_TYPE_UNTYPED_PACKAGE\",\n // gen:codes\n] as const;\n\n/** The codes of the TYPE area. */\nexport type TypeDiagnosticCode = (typeof typeDiagnosticCodes)[number];\n\n/** The TYPE area's catalog entries. */\nexport const typeDiagnostics: AreaCatalog<TypeDiagnosticCode> = {\n MOSTRA_TYPE_ERROR: {\n severity: \"error\",\n phase: \"compile\",\n title: \"Type error\",\n hint: \"Fix the type error at the reported location; the message carries TypeScript's code and text.\",\n docs: {\n explanation:\n \"TypeScript's checker (`tsc --noEmit`, TypeScript 7) found an error in the artifact's code. Verify checks with the artifact's own `tsconfig.json` when it has one, else in strict mode without the unused-variable rules, and resolves imports exactly as the build does. MDX isn't checked.\",\n fix: \"Open the file at the reported line and fix the code, for example a missing property, a wrong argument type or a misspelled import.\",\n },\n },\n MOSTRA_TYPE_UNTYPED_PACKAGE: {\n severity: \"warning\",\n phase: \"compile\",\n title: \"Package without type declarations\",\n hint: \"Nothing breaks: the package works without types; declare a module for it if you want them checked.\",\n docs: {\n explanation:\n \"The artifact imports a package that ships no type declarations (TypeScript's TS7016). The package still builds and runs, so this is a warning: its values are typed `any`.\",\n fix: 'Optionally add a declaration file such as `declare module \"<package>\";`, or a typed wrapper, to the artifact.',\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,sBAAsB,CACjC,qBACA,6BAEF;;AAMA,MAAa,kBAAmD;CAC9D,mBAAmB;EACjB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,6BAA6B;EAC3B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
@@ -0,0 +1,8 @@
1
+ import "../spec.js";
2
+ //#region src/diagnostics/codes/verify.d.ts
3
+ /** The codes of the VERIFY area, in the order they were added. */
4
+ export declare const verifyDiagnosticCodes: readonly ["MOSTRA_VERIFY_ACTION_SKIPPED", "MOSTRA_VERIFY_SKIP_CONSEQUENCE", "MOSTRA_VERIFY_TIMEOUT", "MOSTRA_VERIFY_CRASHED", "MOSTRA_VERIFY_NO_BASELINE", "MOSTRA_VERIFY_BASELINE_MISSING", "MOSTRA_VERIFY_LIVE_FAILED", "MOSTRA_VERIFY_SECRET_MISSING"];
5
+ /** The codes of the VERIFY area. */
6
+ export type VerifyDiagnosticCode = (typeof verifyDiagnosticCodes)[number];
7
+ //#endregion
8
+ //# sourceMappingURL=verify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.d.ts","names":[],"sources":["../../../src/diagnostics/codes/verify.ts"],"mappings":";;;qBAMa;;YAaD,+BAA+B"}
@@ -0,0 +1,99 @@
1
+ //#region src/diagnostics/codes/verify.ts
2
+ /** The codes of the VERIFY area, in the order they were added. */
3
+ const verifyDiagnosticCodes = [
4
+ "MOSTRA_VERIFY_ACTION_SKIPPED",
5
+ "MOSTRA_VERIFY_SKIP_CONSEQUENCE",
6
+ "MOSTRA_VERIFY_TIMEOUT",
7
+ "MOSTRA_VERIFY_CRASHED",
8
+ "MOSTRA_VERIFY_NO_BASELINE",
9
+ "MOSTRA_VERIFY_BASELINE_MISSING",
10
+ "MOSTRA_VERIFY_LIVE_FAILED",
11
+ "MOSTRA_VERIFY_SECRET_MISSING"
12
+ ];
13
+ /** The VERIFY area's catalog entries. */
14
+ const verifyDiagnostics = {
15
+ MOSTRA_VERIFY_ACTION_SKIPPED: {
16
+ severity: "hint",
17
+ phase: "smoke",
18
+ title: "Action skipped in verify",
19
+ hint: "To have verify run this action, check `dryRun()` from `@mostra/server` in it and return early without its side effects when it is true.",
20
+ docs: {
21
+ explanation: "Verify's smoke test never runs a server function that doesn't check `dryRun()` (D55). When the page called one, verify refused the call instead: the page's `run()` or server reference rejected with a `MostraError` carrying this code, as it would for any failed action. The verdict lists every such function in `smoke.skippedActions`. Nothing was sent, written or charged.",
22
+ fix: "Nothing is wrong. To have verify exercise the action, add `if (dryRun()) return <a representative result>;` before its side effects; verify then runs it with `dryRun()` true."
23
+ }
24
+ },
25
+ MOSTRA_VERIFY_SKIP_CONSEQUENCE: {
26
+ severity: "hint",
27
+ phase: "smoke",
28
+ title: "Page reaction to a skipped action",
29
+ hint: "Nothing to fix: this followed from verify skipping an action, which a viewer's page never meets.",
30
+ docs: {
31
+ explanation: "After verify refused a server function that doesn't check `dryRun()`, the page reported an error: an unhandled rejection, an error a boundary caught, or a console error while it settled. It follows from verify's synthetic refusal, not from a defect a viewer would meet, so it is reported as a hint naming the skipped action.",
32
+ fix: "Nothing is required. To let verify see the action's real result, opt it into the smoke test with `dryRun()`."
33
+ }
34
+ },
35
+ MOSTRA_VERIFY_TIMEOUT: {
36
+ severity: "error",
37
+ phase: "runtime",
38
+ title: "Verify ran out of time",
39
+ hint: "Make the page render without waiting on slow work at load, then verify again.",
40
+ docs: {
41
+ explanation: "Verify allows 120 s for everything after the build: booting the sandbox, rendering each viewport, the smoke test and the regression stage. This run went past it, so its verdict is partial: the message names the stage it reached. A partial run can't vouch for the page, so this is an error, and the verdict isn't cached.",
42
+ fix: "Look for work the page does at load that takes long (large data, long animations, requests that never answer) and defer it, then verify again. On a heavily loaded machine, verifying again may be enough."
43
+ }
44
+ },
45
+ MOSTRA_VERIFY_CRASHED: {
46
+ severity: "error",
47
+ phase: "runtime",
48
+ title: "Verify runner crashed",
49
+ hint: "Verify again; if it keeps crashing, report the message with `mostra doctor`'s output.",
50
+ docs: {
51
+ explanation: "The verify runner, the child process that drives the browser, stopped before it finished (FAILURE_MODEL §2). The message carries its last lines of output. Nothing was published, and the next verify starts a fresh runner.",
52
+ fix: "Verify again. A crash that repeats for the same artifact can come from a page that exhausts the browser's memory; one that repeats for every artifact means the runtime's browser is damaged."
53
+ }
54
+ },
55
+ MOSTRA_VERIFY_NO_BASELINE: {
56
+ severity: "hint",
57
+ phase: "regression",
58
+ title: "No earlier passing version",
59
+ hint: "Nothing to fix: the next version will be compared with this one once it is published.",
60
+ docs: {
61
+ explanation: "Verify compares a source with the newest published version of its artifact whose verdict passed. This artifact has none yet (it is new, or every earlier version was published with `--force`), so no regression stage ran.",
62
+ fix: "Nothing is required."
63
+ }
64
+ },
65
+ MOSTRA_VERIFY_BASELINE_MISSING: {
66
+ severity: "hint",
67
+ phase: "regression",
68
+ title: "Baseline version's build is missing",
69
+ hint: "Nothing to fix here; publish again to give later versions a baseline.",
70
+ docs: {
71
+ explanation: "The newest version that passed verify is recorded in the ledger, but its stored build isn't in the home any more, so verify couldn't render it and ran no regression stage.",
72
+ fix: "Nothing is required. A version published from this source becomes the next baseline."
73
+ }
74
+ },
75
+ MOSTRA_VERIFY_LIVE_FAILED: {
76
+ severity: "warning",
77
+ phase: "runtime",
78
+ title: "Live source failed during verify",
79
+ hint: "Check the live source's message: it failed while verify rendered the page, which may be the environment rather than the code.",
80
+ docs: {
81
+ explanation: "A live source's producer (`live.ts`) threw or couldn't reach its data while verify rendered the page. Verify runs producers for real, since they only read, so a failure can come from the environment (no network, a service that is down) as well as from the code. The page shows `useLive`'s `error` meanwhile.",
82
+ fix: "Read the message. If the producer itself is wrong, fix it; if the data source was unreachable, verify again when it is back."
83
+ }
84
+ },
85
+ MOSTRA_VERIFY_SECRET_MISSING: {
86
+ severity: "warning",
87
+ phase: "runtime",
88
+ title: "Secret missing during verify",
89
+ hint: "Set the secret with `mostra secret set <NAME>` if the artifact needs it; verify reports it as the environment, not the code.",
90
+ docs: {
91
+ explanation: "Server code asked for a secret (`secret()`) that neither the host, the artifact's secrets nor the home's hold, while verify ran it. Secrets are part of the environment, so verify reports this as a warning rather than an error.",
92
+ fix: "Run `mostra secret set <NAME>` (for the artifact or the home) with the value the code needs, then verify again."
93
+ }
94
+ }
95
+ };
96
+ //#endregion
97
+ export { verifyDiagnosticCodes, verifyDiagnostics };
98
+
99
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","names":[],"sources":["../../../src/diagnostics/codes/verify.ts"],"sourcesContent":["/**\n * Diagnostic codes of the VERIFY area.\n */\nimport type { AreaCatalog } from \"../spec.ts\";\n\n/** The codes of the VERIFY area, in the order they were added. */\nexport const verifyDiagnosticCodes = [\n \"MOSTRA_VERIFY_ACTION_SKIPPED\",\n \"MOSTRA_VERIFY_SKIP_CONSEQUENCE\",\n \"MOSTRA_VERIFY_TIMEOUT\",\n \"MOSTRA_VERIFY_CRASHED\",\n \"MOSTRA_VERIFY_NO_BASELINE\",\n \"MOSTRA_VERIFY_BASELINE_MISSING\",\n \"MOSTRA_VERIFY_LIVE_FAILED\",\n \"MOSTRA_VERIFY_SECRET_MISSING\",\n // gen:codes\n] as const;\n\n/** The codes of the VERIFY area. */\nexport type VerifyDiagnosticCode = (typeof verifyDiagnosticCodes)[number];\n\n/** The VERIFY area's catalog entries. */\nexport const verifyDiagnostics: AreaCatalog<VerifyDiagnosticCode> = {\n MOSTRA_VERIFY_ACTION_SKIPPED: {\n severity: \"hint\",\n phase: \"smoke\",\n title: \"Action skipped in verify\",\n hint: \"To have verify run this action, check `dryRun()` from `@mostra/server` in it and return early without its side effects when it is true.\",\n docs: {\n explanation:\n \"Verify's smoke test never runs a server function that doesn't check `dryRun()` (D55). When the page called one, verify refused the call instead: the page's `run()` or server reference rejected with a `MostraError` carrying this code, as it would for any failed action. The verdict lists every such function in `smoke.skippedActions`. Nothing was sent, written or charged.\",\n fix: \"Nothing is wrong. To have verify exercise the action, add `if (dryRun()) return <a representative result>;` before its side effects; verify then runs it with `dryRun()` true.\",\n },\n },\n MOSTRA_VERIFY_SKIP_CONSEQUENCE: {\n severity: \"hint\",\n phase: \"smoke\",\n title: \"Page reaction to a skipped action\",\n hint: \"Nothing to fix: this followed from verify skipping an action, which a viewer's page never meets.\",\n docs: {\n explanation:\n \"After verify refused a server function that doesn't check `dryRun()`, the page reported an error: an unhandled rejection, an error a boundary caught, or a console error while it settled. It follows from verify's synthetic refusal, not from a defect a viewer would meet, so it is reported as a hint naming the skipped action.\",\n fix: \"Nothing is required. To let verify see the action's real result, opt it into the smoke test with `dryRun()`.\",\n },\n },\n MOSTRA_VERIFY_TIMEOUT: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Verify ran out of time\",\n hint: \"Make the page render without waiting on slow work at load, then verify again.\",\n docs: {\n explanation:\n \"Verify allows 120 s for everything after the build: booting the sandbox, rendering each viewport, the smoke test and the regression stage. This run went past it, so its verdict is partial: the message names the stage it reached. A partial run can't vouch for the page, so this is an error, and the verdict isn't cached.\",\n fix: \"Look for work the page does at load that takes long (large data, long animations, requests that never answer) and defer it, then verify again. On a heavily loaded machine, verifying again may be enough.\",\n },\n },\n MOSTRA_VERIFY_CRASHED: {\n severity: \"error\",\n phase: \"runtime\",\n title: \"Verify runner crashed\",\n hint: \"Verify again; if it keeps crashing, report the message with `mostra doctor`'s output.\",\n docs: {\n explanation:\n \"The verify runner, the child process that drives the browser, stopped before it finished (FAILURE_MODEL §2). The message carries its last lines of output. Nothing was published, and the next verify starts a fresh runner.\",\n fix: \"Verify again. A crash that repeats for the same artifact can come from a page that exhausts the browser's memory; one that repeats for every artifact means the runtime's browser is damaged.\",\n },\n },\n MOSTRA_VERIFY_NO_BASELINE: {\n severity: \"hint\",\n phase: \"regression\",\n title: \"No earlier passing version\",\n hint: \"Nothing to fix: the next version will be compared with this one once it is published.\",\n docs: {\n explanation:\n \"Verify compares a source with the newest published version of its artifact whose verdict passed. This artifact has none yet (it is new, or every earlier version was published with `--force`), so no regression stage ran.\",\n fix: \"Nothing is required.\",\n },\n },\n MOSTRA_VERIFY_BASELINE_MISSING: {\n severity: \"hint\",\n phase: \"regression\",\n title: \"Baseline version's build is missing\",\n hint: \"Nothing to fix here; publish again to give later versions a baseline.\",\n docs: {\n explanation:\n \"The newest version that passed verify is recorded in the ledger, but its stored build isn't in the home any more, so verify couldn't render it and ran no regression stage.\",\n fix: \"Nothing is required. A version published from this source becomes the next baseline.\",\n },\n },\n MOSTRA_VERIFY_LIVE_FAILED: {\n severity: \"warning\",\n phase: \"runtime\",\n title: \"Live source failed during verify\",\n hint: \"Check the live source's message: it failed while verify rendered the page, which may be the environment rather than the code.\",\n docs: {\n explanation:\n \"A live source's producer (`live.ts`) threw or couldn't reach its data while verify rendered the page. Verify runs producers for real, since they only read, so a failure can come from the environment (no network, a service that is down) as well as from the code. The page shows `useLive`'s `error` meanwhile.\",\n fix: \"Read the message. If the producer itself is wrong, fix it; if the data source was unreachable, verify again when it is back.\",\n },\n },\n MOSTRA_VERIFY_SECRET_MISSING: {\n severity: \"warning\",\n phase: \"runtime\",\n title: \"Secret missing during verify\",\n hint: \"Set the secret with `mostra secret set <NAME>` if the artifact needs it; verify reports it as the environment, not the code.\",\n docs: {\n explanation:\n \"Server code asked for a secret (`secret()`) that neither the host, the artifact's secrets nor the home's hold, while verify ran it. Secrets are part of the environment, so verify reports this as a warning rather than an error.\",\n fix: \"Run `mostra secret set <NAME>` (for the artifact or the home) with the value the code needs, then verify again.\",\n },\n },\n // gen:entries\n};\n"],"mappings":";;AAMA,MAAa,wBAAwB;CACnC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAEF;;AAMA,MAAa,oBAAuD;CAClE,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,gCAAgC;EAC9B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,uBAAuB;EACrB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,uBAAuB;EACrB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,gCAAgC;EAC9B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,2BAA2B;EACzB,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;CACA,8BAA8B;EAC5B,UAAU;EACV,OAAO;EACP,OAAO;EACP,MAAM;EACN,MAAM;GACJ,aACE;GACF,KAAK;EACP;CACF;AAEF"}
@@ -0,0 +1,79 @@
1
+ import * as z from "zod";
2
+ //#region src/diagnostics/diagnostic.d.ts
3
+ /**
4
+ * Diagnostic areas. A code is `MOSTRA_<AREA>_<NAME>`. INTERFACES §13 holds the authoritative list,
5
+ * which only grows.
6
+ */
7
+ export type DiagnosticArea = "MANIFEST" | "BUILD" | "TYPE" | "LINT" | "DEP" | "KIT" | "FIELD" | "ACTION" | "LIVE" | "RUNTIME" | "CONSOLE" | "NETWORK" | "A11Y" | "VISUAL" | "SMOKE" | "REGRESSION" | "TERM" | "PUBLISH" | "SUBMIT" | "HOST" | "HOME" | "HYGIENE" | "SECRET" | "SHARE" | "VERIFY" | "TARGET" | "ENV" | "PLATFORM" | "ARTIFACT" | "CLI";
8
+ /** Every diagnostic area, in INTERFACES §13 order. */
9
+ export declare const DIAGNOSTIC_AREAS: readonly DiagnosticArea[];
10
+ /**
11
+ * A diagnostic code. Codes are semver surface: once released, a code keeps its meaning and is
12
+ * never removed (AX-03).
13
+ */
14
+ export type DiagnosticCode = `MOSTRA_${DiagnosticArea}_${string}`;
15
+ /**
16
+ * How bad it is. `error` is only for definite failures; observations that might be fine are
17
+ * warnings (D72).
18
+ */
19
+ export type DiagnosticSeverity = "error" | "warning" | "hint";
20
+ /** The stage of work that produced the diagnostic. */
21
+ export type DiagnosticPhase = "manifest" | "compile" | "lint" | "runtime" | "console" | "network" | "a11y" | "visual" | "smoke" | "regression" | "contract" | "publish" | "host" | "hygiene" | "platform";
22
+ /**
23
+ * A machine-applicable fix. `range` is `[startLine, startColumn, endLine, endColumn]`, 1-based,
24
+ * with the end exclusive.
25
+ */
26
+ export interface DiagnosticFix {
27
+ /** Replace, insert or delete text in `file`, or run `command`. */
28
+ readonly kind: "replace" | "insert" | "delete" | "command";
29
+ /** The file to edit, relative to the artifact or project root. */
30
+ readonly file?: string;
31
+ /** The span to edit. */
32
+ readonly range?: readonly [number, number, number, number];
33
+ /** The replacement or inserted text. */
34
+ readonly text?: string;
35
+ /** The command to run, for `kind: "command"`. */
36
+ readonly command?: string;
37
+ }
38
+ /** Where the problem is: a source position (1-based) or a place in a rendered viewport. */
39
+ export type DiagnosticLocation = {
40
+ readonly file: string;
41
+ readonly line: number;
42
+ readonly column: number;
43
+ } | {
44
+ readonly viewport: string;
45
+ readonly selector?: string;
46
+ };
47
+ /** One diagnostic (INTERFACES §13). */
48
+ export interface Diagnostic {
49
+ /** The stable code, `MOSTRA_<AREA>_<NAME>`. */
50
+ readonly code: DiagnosticCode;
51
+ /** How bad it is. */
52
+ readonly severity: DiagnosticSeverity;
53
+ /** What is wrong, for this occurrence. */
54
+ readonly message: string;
55
+ /** What to do: one imperative sentence. */
56
+ readonly hint?: string;
57
+ /** A machine-applicable fix, when one exists. */
58
+ readonly fix?: DiagnosticFix;
59
+ /** Where the problem is, when it has a place. */
60
+ readonly location?: DiagnosticLocation;
61
+ /** The stage of work that produced it. */
62
+ readonly phase: DiagnosticPhase;
63
+ /** The code's documentation page: `${docsBase}/errors/${code}` (D37). */
64
+ readonly docs: string;
65
+ /** How many identical occurrences this one stands for, when deduplicated. */
66
+ readonly count?: number;
67
+ }
68
+ /** The Zod schema of the `DiagnosticSeverity` type. */
69
+ export declare const DiagnosticSeverity: z.ZodType<DiagnosticSeverity, string>;
70
+ /** The Zod schema of the `DiagnosticPhase` type. */
71
+ export declare const DiagnosticPhase: z.ZodType<DiagnosticPhase, string>;
72
+ /** The Zod schema of the `DiagnosticFix` type. */
73
+ export declare const DiagnosticFix: z.ZodType<DiagnosticFix>;
74
+ /** The Zod schema of the `DiagnosticLocation` type. */
75
+ export declare const DiagnosticLocation: z.ZodType<DiagnosticLocation>;
76
+ /** The Zod schema of the `Diagnostic` type. */
77
+ export declare const Diagnostic: z.ZodType<Diagnostic>;
78
+ //#endregion
79
+ //# sourceMappingURL=diagnostic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic.d.ts","names":[],"sources":["../../src/diagnostics/diagnostic.ts"],"mappings":";;;;;;YAWY;;qBAiCC,2BAA2B;;;;;YAqC5B,2BAA2B;;;;;YAM3B;;YAGA;;;;;iBAqBK;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;YAIC;WACG;WAAuB;WAAuB;;WAC9C;WAA2B;;;iBAGzB;;WAEN,MAAM;;WAEN,UAAU;;WAEV;;WAEA;;WAEA,MAAM;;WAEN,WAAW;;WAEX,OAAO;;WAEP;;WAEA;;;qBAkBE,oBAAoB,EAAE,QAAQ;;qBAQ9B,iBAAiB,EAAE,QAAQ;;qBAwB3B,eAAe,EAAE,QAAQ;;qBAezB,oBAAoB,EAAE,QAAQ;;qBAW9B,YAAY,EAAE,QAAQ"}
@@ -0,0 +1,131 @@
1
+ import { wireRegistry } from "../wire-registry.js";
2
+ import * as z from "zod";
3
+ //#region src/diagnostics/diagnostic.ts
4
+ /**
5
+ * The one diagnostic object every Mostra interface uses for errors, warnings and hints
6
+ * (INTERFACES §1 and §13, AX-03).
7
+ */
8
+ /** Every diagnostic area, in INTERFACES §13 order. */
9
+ const DIAGNOSTIC_AREAS = [
10
+ "MANIFEST",
11
+ "BUILD",
12
+ "TYPE",
13
+ "LINT",
14
+ "DEP",
15
+ "KIT",
16
+ "FIELD",
17
+ "ACTION",
18
+ "LIVE",
19
+ "RUNTIME",
20
+ "CONSOLE",
21
+ "NETWORK",
22
+ "A11Y",
23
+ "VISUAL",
24
+ "SMOKE",
25
+ "REGRESSION",
26
+ "TERM",
27
+ "PUBLISH",
28
+ "SUBMIT",
29
+ "HOST",
30
+ "HOME",
31
+ "HYGIENE",
32
+ "SECRET",
33
+ "SHARE",
34
+ "VERIFY",
35
+ "TARGET",
36
+ "ENV",
37
+ "PLATFORM",
38
+ "ARTIFACT",
39
+ "CLI"
40
+ ];
41
+ const positiveInt = z.int().min(1);
42
+ /**
43
+ * Codes on the wire accept any area, so a client keeps working when a newer Mostra reports a code
44
+ * from an area it doesn't know yet. Producers are typed against {@link DiagnosticArea}.
45
+ */
46
+ const codeSchema = z.string().regex(/^MOSTRA_[A-Z0-9]+_[A-Z0-9_]+$/).register(wireRegistry, {
47
+ id: "DiagnosticCode",
48
+ description: "Stable diagnostic code: MOSTRA_<AREA>_<NAME>."
49
+ });
50
+ /** The Zod schema of the `DiagnosticSeverity` type. */
51
+ const DiagnosticSeverity = z.enum([
52
+ "error",
53
+ "warning",
54
+ "hint"
55
+ ]).register(wireRegistry, {
56
+ id: "DiagnosticSeverity",
57
+ description: "How bad it is: error only for definite failures."
58
+ });
59
+ /** The Zod schema of the `DiagnosticPhase` type. */
60
+ const DiagnosticPhase = z.enum([
61
+ "manifest",
62
+ "compile",
63
+ "lint",
64
+ "runtime",
65
+ "console",
66
+ "network",
67
+ "a11y",
68
+ "visual",
69
+ "smoke",
70
+ "regression",
71
+ "contract",
72
+ "publish",
73
+ "host",
74
+ "hygiene",
75
+ "platform"
76
+ ]).register(wireRegistry, {
77
+ id: "DiagnosticPhase",
78
+ description: "The stage of work that produced the diagnostic."
79
+ });
80
+ /** The Zod schema of the `DiagnosticFix` type. */
81
+ const DiagnosticFix = z.object({
82
+ kind: z.enum([
83
+ "replace",
84
+ "insert",
85
+ "delete",
86
+ "command"
87
+ ]),
88
+ file: z.string().exactOptional(),
89
+ range: z.tuple([
90
+ positiveInt,
91
+ positiveInt,
92
+ positiveInt,
93
+ positiveInt
94
+ ]).readonly().exactOptional(),
95
+ text: z.string().exactOptional(),
96
+ command: z.string().exactOptional()
97
+ }).register(wireRegistry, {
98
+ id: "DiagnosticFix",
99
+ description: "A machine-applicable fix; range is [startLine, startColumn, endLine, endColumn], 1-based, end exclusive."
100
+ });
101
+ /** The Zod schema of the `DiagnosticLocation` type. */
102
+ const DiagnosticLocation = z.union([z.object({
103
+ file: z.string(),
104
+ line: positiveInt,
105
+ column: positiveInt
106
+ }), z.object({
107
+ viewport: z.string(),
108
+ selector: z.string().exactOptional()
109
+ })]).register(wireRegistry, {
110
+ id: "DiagnosticLocation",
111
+ description: "A 1-based source position, or a place in a rendered viewport."
112
+ });
113
+ /** The Zod schema of the `Diagnostic` type. */
114
+ const Diagnostic = z.object({
115
+ code: codeSchema,
116
+ severity: DiagnosticSeverity,
117
+ message: z.string(),
118
+ hint: z.string().exactOptional(),
119
+ fix: DiagnosticFix.exactOptional(),
120
+ location: DiagnosticLocation.exactOptional(),
121
+ phase: DiagnosticPhase,
122
+ docs: z.url(),
123
+ count: positiveInt.exactOptional()
124
+ }).register(wireRegistry, {
125
+ id: "Diagnostic",
126
+ description: "One diagnostic: a stable code, severity, message, hint, fix and docs link."
127
+ });
128
+ //#endregion
129
+ export { DIAGNOSTIC_AREAS, Diagnostic, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity };
130
+
131
+ //# sourceMappingURL=diagnostic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic.js","names":[],"sources":["../../src/diagnostics/diagnostic.ts"],"sourcesContent":["/**\n * The one diagnostic object every Mostra interface uses for errors, warnings and hints\n * (INTERFACES §1 and §13, AX-03).\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"../wire-registry.ts\";\n\n/**\n * Diagnostic areas. A code is `MOSTRA_<AREA>_<NAME>`. INTERFACES §13 holds the authoritative list,\n * which only grows.\n */\nexport type DiagnosticArea =\n | \"MANIFEST\"\n | \"BUILD\"\n | \"TYPE\"\n | \"LINT\"\n | \"DEP\"\n | \"KIT\"\n | \"FIELD\"\n | \"ACTION\"\n | \"LIVE\"\n | \"RUNTIME\"\n | \"CONSOLE\"\n | \"NETWORK\"\n | \"A11Y\"\n | \"VISUAL\"\n | \"SMOKE\"\n | \"REGRESSION\"\n | \"TERM\"\n | \"PUBLISH\"\n | \"SUBMIT\"\n | \"HOST\"\n | \"HOME\"\n | \"HYGIENE\"\n | \"SECRET\"\n | \"SHARE\"\n | \"VERIFY\"\n | \"TARGET\"\n | \"ENV\"\n | \"PLATFORM\"\n | \"ARTIFACT\"\n | \"CLI\";\n\n/** Every diagnostic area, in INTERFACES §13 order. */\nexport const DIAGNOSTIC_AREAS: readonly DiagnosticArea[] = [\n \"MANIFEST\",\n \"BUILD\",\n \"TYPE\",\n \"LINT\",\n \"DEP\",\n \"KIT\",\n \"FIELD\",\n \"ACTION\",\n \"LIVE\",\n \"RUNTIME\",\n \"CONSOLE\",\n \"NETWORK\",\n \"A11Y\",\n \"VISUAL\",\n \"SMOKE\",\n \"REGRESSION\",\n \"TERM\",\n \"PUBLISH\",\n \"SUBMIT\",\n \"HOST\",\n \"HOME\",\n \"HYGIENE\",\n \"SECRET\",\n \"SHARE\",\n \"VERIFY\",\n \"TARGET\",\n \"ENV\",\n \"PLATFORM\",\n \"ARTIFACT\",\n \"CLI\",\n];\n\n/**\n * A diagnostic code. Codes are semver surface: once released, a code keeps its meaning and is\n * never removed (AX-03).\n */\nexport type DiagnosticCode = `MOSTRA_${DiagnosticArea}_${string}`;\n\n/**\n * How bad it is. `error` is only for definite failures; observations that might be fine are\n * warnings (D72).\n */\nexport type DiagnosticSeverity = \"error\" | \"warning\" | \"hint\";\n\n/** The stage of work that produced the diagnostic. */\nexport type DiagnosticPhase =\n | \"manifest\"\n | \"compile\"\n | \"lint\"\n | \"runtime\"\n | \"console\"\n | \"network\"\n | \"a11y\"\n | \"visual\"\n | \"smoke\"\n | \"regression\"\n | \"contract\"\n | \"publish\"\n | \"host\"\n | \"hygiene\"\n | \"platform\";\n\n/**\n * A machine-applicable fix. `range` is `[startLine, startColumn, endLine, endColumn]`, 1-based,\n * with the end exclusive.\n */\nexport interface DiagnosticFix {\n /** Replace, insert or delete text in `file`, or run `command`. */\n readonly kind: \"replace\" | \"insert\" | \"delete\" | \"command\";\n /** The file to edit, relative to the artifact or project root. */\n readonly file?: string;\n /** The span to edit. */\n readonly range?: readonly [number, number, number, number];\n /** The replacement or inserted text. */\n readonly text?: string;\n /** The command to run, for `kind: \"command\"`. */\n readonly command?: string;\n}\n\n/** Where the problem is: a source position (1-based) or a place in a rendered viewport. */\nexport type DiagnosticLocation =\n | { readonly file: string; readonly line: number; readonly column: number }\n | { readonly viewport: string; readonly selector?: string };\n\n/** One diagnostic (INTERFACES §13). */\nexport interface Diagnostic {\n /** The stable code, `MOSTRA_<AREA>_<NAME>`. */\n readonly code: DiagnosticCode;\n /** How bad it is. */\n readonly severity: DiagnosticSeverity;\n /** What is wrong, for this occurrence. */\n readonly message: string;\n /** What to do: one imperative sentence. */\n readonly hint?: string;\n /** A machine-applicable fix, when one exists. */\n readonly fix?: DiagnosticFix;\n /** Where the problem is, when it has a place. */\n readonly location?: DiagnosticLocation;\n /** The stage of work that produced it. */\n readonly phase: DiagnosticPhase;\n /** The code's documentation page: `${docsBase}/errors/${code}` (D37). */\n readonly docs: string;\n /** How many identical occurrences this one stands for, when deduplicated. */\n readonly count?: number;\n}\n\nconst positiveInt = z.int().min(1);\n\n/**\n * Codes on the wire accept any area, so a client keeps working when a newer Mostra reports a code\n * from an area it doesn't know yet. Producers are typed against {@link DiagnosticArea}.\n */\nconst codeSchema = z\n .string()\n .regex(/^MOSTRA_[A-Z0-9]+_[A-Z0-9_]+$/)\n .register(wireRegistry, {\n id: \"DiagnosticCode\",\n description: \"Stable diagnostic code: MOSTRA_<AREA>_<NAME>.\",\n }) as unknown as z.ZodType<DiagnosticCode, string>;\n\n/** The Zod schema of the `DiagnosticSeverity` type. */\nexport const DiagnosticSeverity: z.ZodType<DiagnosticSeverity, string> = z\n .enum([\"error\", \"warning\", \"hint\"])\n .register(wireRegistry, {\n id: \"DiagnosticSeverity\",\n description: \"How bad it is: error only for definite failures.\",\n });\n\n/** The Zod schema of the `DiagnosticPhase` type. */\nexport const DiagnosticPhase: z.ZodType<DiagnosticPhase, string> = z\n .enum([\n \"manifest\",\n \"compile\",\n \"lint\",\n \"runtime\",\n \"console\",\n \"network\",\n \"a11y\",\n \"visual\",\n \"smoke\",\n \"regression\",\n \"contract\",\n \"publish\",\n \"host\",\n \"hygiene\",\n \"platform\",\n ])\n .register(wireRegistry, {\n id: \"DiagnosticPhase\",\n description: \"The stage of work that produced the diagnostic.\",\n });\n\n/** The Zod schema of the `DiagnosticFix` type. */\nexport const DiagnosticFix: z.ZodType<DiagnosticFix> = z\n .object({\n kind: z.enum([\"replace\", \"insert\", \"delete\", \"command\"]),\n file: z.string().exactOptional(),\n range: z.tuple([positiveInt, positiveInt, positiveInt, positiveInt]).readonly().exactOptional(),\n text: z.string().exactOptional(),\n command: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"DiagnosticFix\",\n description:\n \"A machine-applicable fix; range is [startLine, startColumn, endLine, endColumn], 1-based, end exclusive.\",\n });\n\n/** The Zod schema of the `DiagnosticLocation` type. */\nexport const DiagnosticLocation: z.ZodType<DiagnosticLocation> = z\n .union([\n z.object({ file: z.string(), line: positiveInt, column: positiveInt }),\n z.object({ viewport: z.string(), selector: z.string().exactOptional() }),\n ])\n .register(wireRegistry, {\n id: \"DiagnosticLocation\",\n description: \"A 1-based source position, or a place in a rendered viewport.\",\n });\n\n/** The Zod schema of the `Diagnostic` type. */\nexport const Diagnostic: z.ZodType<Diagnostic> = z\n .object({\n code: codeSchema,\n severity: DiagnosticSeverity,\n message: z.string(),\n hint: z.string().exactOptional(),\n fix: DiagnosticFix.exactOptional(),\n location: DiagnosticLocation.exactOptional(),\n phase: DiagnosticPhase,\n docs: z.url(),\n count: positiveInt.exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Diagnostic\",\n description: \"One diagnostic: a stable code, severity, message, hint, fix and docs link.\",\n });\n"],"mappings":";;;;;;;;AA4CA,MAAa,mBAA8C;CACzD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AA4EA,MAAM,cAAc,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;;;;;AAMjC,MAAM,aAAa,EAChB,OAAO,CAAC,CACR,MAAM,+BAA+B,CAAC,CACtC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,qBAA4D,EACtE,KAAK;CAAC;CAAS;CAAW;AAAM,CAAC,CAAC,CAClC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,kBAAsD,EAChE,KAAK;CACJ;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,KAAK;EAAC;EAAW;EAAU;EAAU;CAAS,CAAC;CACvD,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,OAAO,EAAE,MAAM;EAAC;EAAa;EAAa;EAAa;CAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC9F,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;AACpC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,qBAAoD,EAC9D,MAAM,CACL,EAAE,OAAO;CAAE,MAAM,EAAE,OAAO;CAAG,MAAM;CAAa,QAAQ;AAAY,CAAC,GACrE,EAAE,OAAO;CAAE,UAAU,EAAE,OAAO;CAAG,UAAU,EAAE,OAAO,CAAC,CAAC,cAAc;AAAE,CAAC,CACzE,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,aAAoC,EAC9C,OAAO;CACN,MAAM;CACN,UAAU;CACV,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,KAAK,cAAc,cAAc;CACjC,UAAU,mBAAmB,cAAc;CAC3C,OAAO;CACP,MAAM,EAAE,IAAI;CACZ,OAAO,YAAY,cAAc;AACnC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { DiagnosticArea, DiagnosticFix, DiagnosticLocation, DiagnosticPhase, DiagnosticSeverity } from "./diagnostic.js";
2
+ //#region src/diagnostics/spec.d.ts
3
+ /** Everything Mostra knows about one code, besides the code itself. */
4
+ export interface DiagnosticSpec {
5
+ /** The severity of every occurrence. */
6
+ readonly severity: DiagnosticSeverity;
7
+ /** The stage of work that reports it. */
8
+ readonly phase: DiagnosticPhase;
9
+ /** One line naming the condition. It is the docs page's title. */
10
+ readonly title: string;
11
+ /** The default hint: one imperative sentence. An occurrence may give a more specific one. */
12
+ readonly hint: string;
13
+ /** The docs page body. */
14
+ readonly docs: {
15
+ /** What the code means and when Mostra reports it. */
16
+ readonly explanation: string;
17
+ /** The minimal fix. */
18
+ readonly fix: string;
19
+ };
20
+ /**
21
+ * Set when Mostra no longer reports the code, saying what replaced it. Codes are never
22
+ * removed (AX-03).
23
+ */
24
+ readonly deprecated?: string;
25
+ }
26
+ /** The catalog of one area: exactly the codes `C`, each with its spec. */
27
+ export type AreaCatalog<C extends `MOSTRA_${DiagnosticArea}_${string}`> = { readonly [K in C]: DiagnosticSpec; };
28
+ /**
29
+ * Where diagnostics link by default: the GitHub Pages docs site (D37). Hosts and the runtime pass
30
+ * their own base when the docs move.
31
+ */
32
+ export declare const DEFAULT_DOCS_BASE: string;
33
+ /** The docs page for `code` under `docsBase`: `${docsBase}/errors/${code}`. */
34
+ export declare function docsUrl(code: string, docsBase?: string): string;
35
+ /** The parts of a diagnostic that belong to one occurrence rather than to its code. */
36
+ export interface DiagnosticDetails {
37
+ /** What is wrong, for this occurrence. Never include secrets or capability tokens. */
38
+ readonly message: string;
39
+ /** Replaces the catalog's default hint when the occurrence allows a more specific one. */
40
+ readonly hint?: string;
41
+ /** A machine-applicable fix. */
42
+ readonly fix?: DiagnosticFix;
43
+ /** Where the problem is. */
44
+ readonly location?: DiagnosticLocation;
45
+ /** How many identical occurrences this one stands for. */
46
+ readonly count?: number;
47
+ }
48
+ //#endregion
49
+ //# sourceMappingURL=spec.d.ts.map