@mostra/protocol 0.0.0-placeholder → 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 +37 -1
  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 -4
  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 @@
1
+ {"version":3,"file":"actions.js","names":[],"sources":["../src/actions.ts"],"sourcesContent":["/**\n * Actions, live data and secrets (INTERFACES §2.4, §4, §6; D24, D44, D54, D56): the shapes the\n * browser protocol, the host protocol and the worker channel share. Server-function arguments and\n * results travel as the serializer's batches (`Batches`).\n *\n * ```ts\n * const run: RunState = await post(\"runs\", { viewId, fnId: \"actions.ts#sendReply\", args, clientKey });\n * if (run.status === \"succeeded\") show(await deserializeAll(run.batches));\n * ```\n */\nimport * as z from \"zod\";\nimport { ViewId } from \"./ids.ts\";\nimport type { Frame, WireError } from \"./serializer.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** A value written by the serializer: its batches, in order (`serializeAll`). */\nexport type Batches = readonly (readonly Frame[])[];\n\n/**\n * The Zod schema of the `Batches` type: a list of batches, each a list of frames. The frames\n * themselves are checked by the reader (`ValueReader`), which refuses anything malformed.\n */\nexport const Batches: z.ZodType<Batches> = z\n .array(z.array(z.record(z.string(), z.unknown())).readonly())\n .readonly()\n .register(wireRegistry, {\n id: \"Batches\",\n description: \"A serialized server-function value: its batches of frames, in order.\",\n }) as unknown as z.ZodType<Batches>;\n\n/** An error as runs, calls and live sources report it. */\nexport interface ActionError extends WireError {\n /** The stack of the thrown error, kept in the run log and never sent to a page. */\n readonly stack?: string;\n}\n\n/** The Zod schema of the `ActionError` type. */\nexport const ActionError: z.ZodType<ActionError> = z\n .object({\n message: z.string(),\n code: z.string().exactOptional(),\n stack: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ActionError\",\n description: \"An error from server code: its message and diagnostic code.\",\n });\n\n/** The largest serialized arguments a call or run takes, in characters of JSON. */\nexport const ACTION_ARGS_MAX: number = 16 * 1024 * 1024;\n\n/** The largest serialized result a run keeps, in characters of JSON (larger fails the run). */\nexport const ACTION_RESULT_MAX: number = 16 * 1024 * 1024;\n\n/** The cap of a run's log, in UTF-16 code units of its lines (D47's 1 MB). */\nexport const RUN_LOG_MAX: number = 1024 * 1024;\n\n/** The line a capped log ends with. */\nexport const RUN_LOG_TRUNCATED = \"[log truncated at 1 MB]\";\n\n/** The longest run key, in characters. */\nexport const RUN_KEY_MAX = 256;\n\n/**\n * A run's state (D24, ARCHITECTURE §7). `queued`: recorded, not yet started in a worker.\n * `running`: started. `waiting` is reserved for a remote server's run that waits for its owner's\n * instance (WP-28, D117); a page that doesn't know it treats it like `queued`. The others are\n * final.\n */\nexport type RunStatus = \"queued\" | \"running\" | \"waiting\" | \"succeeded\" | \"failed\" | \"cancelled\";\n\n/** Every run status. */\nexport const RUN_STATUSES: readonly RunStatus[] = [\n \"queued\",\n \"running\",\n \"waiting\",\n \"succeeded\",\n \"failed\",\n \"cancelled\",\n];\n\n/** Whether a run in `status` has ended. */\nexport function isFinalRunStatus(status: RunStatus): boolean {\n return status === \"succeeded\" || status === \"failed\" || status === \"cancelled\";\n}\n\n/**\n * Why a run ended the way it did, beside its status: `interrupted` (its worker or the instance\n * stopped while it ran, D24), `threw` (the action threw), `unserializable` (its result is outside\n * the type set), `too-large`, `parked` (its artifact's worker keeps crashing), `cancelled` (by a\n * viewer), `unknown-function`. Later releases add reasons.\n */\nexport type RunReason = string;\n\n/** A run's progress, as the action last reported it. */\nexport interface RunProgress {\n /** From 0 to 1. */\n readonly fraction?: number;\n /** One short line for people. */\n readonly message?: string;\n}\n\n/** The Zod schema of the `RunProgress` type. */\nexport const RunProgress: z.ZodType<RunProgress> = z\n .object({\n fraction: z.number().min(0).max(1).exactOptional(),\n message: z.string().max(1000).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunProgress\",\n description: \"A run's progress: fraction and message.\",\n });\n\n/**\n * One action run as a page reads it (D54): its state, progress, log and the result written so far.\n * A result that is an async iterable grows item by item while the run is `running`.\n */\nexport interface RunState {\n /** The run's `run_` ID. */\n readonly runId: string;\n /** The server function it runs: `<module path>#<export>`. */\n readonly fnId: string;\n /** The idempotency key it was started with, if any. */\n readonly key?: string;\n /** The run's state. */\n readonly status: RunStatus;\n /** Why it ended, for `failed` and `cancelled`. */\n readonly reason?: RunReason;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** The log lines, capped at 1 MB with a marker line. */\n readonly log: readonly string[];\n /** The result's batches so far. */\n readonly batches: Batches;\n /** For `failed`: what went wrong, without the stack. */\n readonly error?: WireError;\n /** When it was recorded. */\n readonly startedAt: string;\n /** When it ended. */\n readonly finishedAt?: string;\n /** Whether this request joined a run that already existed (a key or a retried `clientKey`). */\n readonly joined?: boolean;\n /**\n * The index of the first line in `log`, when the request said which lines the page holds\n * (`RunAttachRequest.held`); absent: 0, the whole log.\n */\n readonly logFrom?: number;\n /** The index of the first batch in `batches`, as `logFrom`; absent: 0. */\n readonly batchFrom?: number;\n}\n\n/** The Zod schema of the `RunState` type. */\nexport const RunState: z.ZodType<RunState> = z\n .object({\n runId: z.string(),\n fnId: z.string(),\n key: z.string().exactOptional(),\n status: z.enum(RUN_STATUSES as [RunStatus, ...RunStatus[]]),\n reason: z.string().exactOptional(),\n progress: RunProgress.exactOptional(),\n log: z.array(z.string()).readonly(),\n batches: Batches,\n error: z.object({ message: z.string(), code: z.string().exactOptional() }).exactOptional(),\n startedAt: z.string(),\n finishedAt: z.string().exactOptional(),\n joined: z.boolean().exactOptional(),\n logFrom: z.number().int().nonnegative().exactOptional(),\n batchFrom: z.number().int().nonnegative().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunState\",\n description: \"An action run: status, progress, log and the result written so far.\",\n });\n\n/**\n * What changed in a run since a page last heard: a lossy notification on the event stream. Lines\n * start at `logFrom` and batches at `batchFrom`; a page that holds fewer reads the run again\n * (`runs/attach`).\n */\nexport interface RunDelta {\n /** The run's `run_` ID. */\n readonly runId: string;\n /** The run's state. */\n readonly status: RunStatus;\n /** Why it ended so, for `failed` and `cancelled`. */\n readonly reason?: RunReason;\n /** Its latest progress. */\n readonly progress?: RunProgress;\n /** The index of the first line in `log`. */\n readonly logFrom: number;\n /** Log lines, starting at `logFrom`. */\n readonly log: readonly string[];\n /** The index of the first batch in `batches`. */\n readonly batchFrom: number;\n /** Result batches, starting at `batchFrom`. */\n readonly batches: Batches;\n /** What went wrong. */\n readonly error?: WireError;\n /** When it ended. */\n readonly finishedAt?: string;\n}\n\n/** A live source's value as a page reads it (D56). */\nexport interface LiveState {\n /** The idempotency key it was started with, if any. */\n readonly key: string;\n /** The value's revision, a decimal string that only grows; absent before any value. */\n readonly revision?: string;\n /** When the value was produced. */\n readonly at?: string;\n /** The latest value, serialized. */\n readonly value?: Batches;\n /**\n * Append mode (`useLive(key, { mode: \"append\" })`): the values kept in the source's ring, oldest\n * first, at most the window the page asked for.\n */\n readonly ring?: readonly {\n readonly revision: string;\n readonly at: string;\n readonly value: Batches;\n }[];\n /** The producer's last failure, while the last good value stays (FAILURE_MODEL §6). */\n readonly error?: WireError;\n}\n\n/** One live update on the event stream: never stored as an event (D63, LL-04). */\nexport interface LiveUpdate {\n /** The live source's key. */\n readonly key: string;\n /** The value's revision. */\n readonly revision?: string;\n /** When the value was produced. */\n readonly at?: string;\n /** The value, serialized. */\n readonly value?: Batches;\n /** What went wrong. */\n readonly error?: WireError;\n}\n\n/**\n * An ephemeral message on a page's event stream (SSE `event: run` or `event: live`, without an\n * `id`, so a reconnect's cursor is untouched) or in a poll's `ephemeral`: lossy, coalesced, and\n * never stored as an event.\n */\nexport type EphemeralMessage =\n | { readonly kind: \"run\"; readonly run: RunDelta }\n | { readonly kind: \"live\"; readonly live: LiveUpdate };\n\n/** `POST …/call/{fnId}`: a plain server-function call, no durable record (D54). */\nexport interface CallRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** The arguments, serialized as one array value. */\n readonly args: Batches;\n}\n\n/** The Zod schema of the `CallRequest` type. */\nexport const CallRequest: z.ZodType<CallRequest> = z\n .object({ viewId: ViewId.schema, args: Batches })\n .register(wireRegistry, {\n id: \"CallRequest\",\n description: \"A plain server-function call: the view and the serialized arguments.\",\n });\n\n/**\n * One line of a plain call's answer (`application/x-ndjson`): a batch of the result, then the end.\n */\nexport type CallLine =\n | { readonly batch: readonly Frame[] }\n | { readonly end: { readonly status: \"succeeded\" } }\n | { readonly end: { readonly status: \"failed\"; readonly error: WireError } };\n\n/** `POST …/runs`: start a durable action run, or join one (D54, AC-02, AC-03). */\nexport interface RunRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** `<module path>#<export>`. */\n readonly fnId: string;\n /** The arguments, serialized as one array value. */\n readonly args: Batches;\n /** The author's idempotency key: one run per artifact, function and key, ever. */\n readonly key?: string;\n /** A fresh ID per invocation, so a retried request joins the run it already started. */\n readonly clientKey: string;\n}\n\n/** The Zod schema of the `RunRequest` type. */\nexport const RunRequest: z.ZodType<RunRequest> = z\n .object({\n viewId: ViewId.schema,\n fnId: z.string().min(3).max(1024),\n args: Batches,\n key: z.string().min(1).max(RUN_KEY_MAX).exactOptional(),\n clientKey: z.string().min(8).max(64),\n })\n .register(wireRegistry, {\n id: \"RunRequest\",\n description: \"Start or join an action run: the function, its arguments and keys.\",\n });\n\n/**\n * `POST …/runs/attach`: read runs and hear their changes on the event stream for the next minute\n * (re-attach after a reload, AC-02). By ID, or by function and key.\n */\nexport interface RunAttachRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /** Runs by ID. */\n readonly runIds?: readonly string[];\n /** Runs by function and key. */\n readonly keyed?: readonly { readonly fnId: string; readonly key: string }[];\n /**\n * What the page already holds of runs it names by ID: so many log lines and batches. Each such\n * run's answer starts there (`RunState.logFrom`, `batchFrom`), so a page renewing its interest\n * doesn't read the whole run again (Opus review 14).\n */\n readonly held?: readonly {\n readonly runId: string;\n readonly log: number;\n readonly batches: number;\n }[];\n}\n\n/** The Zod schema of the `RunAttachRequest` type. */\nexport const RunAttachRequest: z.ZodType<RunAttachRequest> = z\n .object({\n viewId: ViewId.schema,\n runIds: z.array(z.string().max(64)).max(100).readonly().exactOptional(),\n keyed: z\n .array(\n z.object({ fnId: z.string().min(3).max(1024), key: z.string().min(1).max(RUN_KEY_MAX) }),\n )\n .max(100)\n .readonly()\n .exactOptional(),\n held: z\n .array(\n z.object({\n runId: z.string().max(64),\n log: z.number().int().nonnegative(),\n batches: z.number().int().nonnegative(),\n }),\n )\n .max(100)\n .readonly()\n .exactOptional(),\n })\n .register(wireRegistry, {\n id: \"RunAttachRequest\",\n description: \"Runs a page reads and follows: by ID, or by function and key.\",\n });\n\n/** `POST …/runs/{id}/cancel`. */\nexport interface RunCancelRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n}\n\n/** The Zod schema of the `RunCancelRequest` type. */\nexport const RunCancelRequest: z.ZodType<RunCancelRequest> = z\n .object({ viewId: ViewId.schema })\n .register(wireRegistry, { id: \"RunCancelRequest\", description: \"Cancel a run, from a view.\" });\n\n/** The keys of live sources: like JavaScript export names, which is what `live.ts` declares. */\nexport const LIVE_KEY_PATTERN: RegExp = /^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/;\n\n/** The largest live value, in characters of serialized JSON (DATA_MODEL §5's 4 MiB). */\nexport const LIVE_VALUE_MAX: number = 4 * 1024 * 1024;\n\n/** The ring size of a pushed source in append mode that no `defineLive` sized. */\nexport const LIVE_RING_DEFAULT = 1024;\n\n/** The largest ring a source may keep. */\nexport const LIVE_RING_MAX = 100_000;\n\n/**\n * `POST …/live`: read live sources and keep their producers running for this view for the next\n * minute (D56, LL-04); a page asks again while it shows them.\n */\nexport interface LiveRequest {\n /** The view the page was opened as (D104). */\n readonly viewId: string;\n /**\n * The sources, each with its append window; `refresh` asks the source's producer to load again\n * now (`useLive`'s `refresh()`).\n */\n readonly keys: readonly {\n readonly key: string;\n readonly window?: number;\n readonly refresh?: boolean;\n }[];\n}\n\n/** The Zod schema of the `LiveRequest` type. */\nexport const LiveRequest: z.ZodType<LiveRequest> = z\n .object({\n viewId: ViewId.schema,\n keys: z\n .array(\n z.object({\n key: z.string().regex(LIVE_KEY_PATTERN),\n window: z.int().min(1).max(LIVE_RING_MAX).exactOptional(),\n refresh: z.boolean().exactOptional(),\n }),\n )\n .max(256)\n .readonly(),\n })\n .register(wireRegistry, {\n id: \"LiveRequest\",\n description: \"Live sources a page reads and keeps running: keys and append windows.\",\n });\n\n/** Secret names: letters, digits, `_`, `.` and `-`, starting with a letter or `_` (D44). */\nexport const SECRET_NAME_PATTERN: RegExp = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;\n\n/** The largest secret value, in UTF-8 bytes. */\nexport const SECRET_VALUE_MAX: number = 64 * 1024;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAa,UAA8B,EACxC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAC5D,SAAS,CAAC,CACV,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AASH,MAAa,cAAsC,EAChD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,OAAO,EAAE,OAAO,CAAC,CAAC,cAAc;AAClC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,kBAA0B;;AAGvC,MAAa,oBAA4B;;AAGzC,MAAa,cAAsB;;AAGnC,MAAa,oBAAoB;;AAGjC,MAAa,cAAc;;AAW3B,MAAa,eAAqC;CAChD;CACA;CACA;CACA;CACA;CACA;AACF;;AAGA,SAAgB,iBAAiB,QAA4B;CAC3D,OAAO,WAAW,eAAe,WAAW,YAAY,WAAW;AACrE;;AAmBA,MAAa,cAAsC,EAChD,OAAO;CACN,UAAU,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACjD,SAAS,EAAE,OAAO,CAAC,CAAC,I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,CAAC,CAAC,MAAM,gBAAgB;EACtC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,cAAc;EACxD,SAAS,EAAE,QAAQ,CAAC,CAAC,cAAc;CACrC,CAAC,CACH,CAAC,CACA,IAAI,GAAG,CAAC,CACR,SAAS;AACd,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,sBAA8B;;AAG3C,MAAa,mBAA2B"}
@@ -0,0 +1,113 @@
1
+ import { ArtifactLink, ArtifactManifest, SubmissionPolicy } from "./manifest.js";
2
+ import * as z from "zod";
3
+ //#region src/artifact.d.ts
4
+ /**
5
+ * Where to build an artifact from: a source path (a `.tsx`, `.jsx` or `.mdx` file, or a directory
6
+ * with an `index` entry), or an artifact ID, meaning the path it was last published from.
7
+ */
8
+ export type SourceRef = {
9
+ readonly path: string;
10
+ } | {
11
+ readonly artifactId: string;
12
+ };
13
+ /** Names an artifact: by its ID, or by a source path bound to it. */
14
+ export type ArtifactRef = {
15
+ readonly artifactId: string;
16
+ } | {
17
+ readonly path: string;
18
+ };
19
+ /** The Zod schema of the `SourceRef` type. */
20
+ export declare const SourceRef: z.ZodType<SourceRef>;
21
+ /** The Zod schema of the `ArtifactRef` type. */
22
+ export declare const ArtifactRef: z.ZodType<ArtifactRef>;
23
+ /** One published version. */
24
+ export interface VersionSummary {
25
+ /** The content-addressed version ID (D89). */
26
+ readonly id: string;
27
+ /** The per-artifact version number, for people: 1, 2, 3 … */
28
+ readonly number: number;
29
+ /** When it was published (RFC 3339, UTC). */
30
+ readonly publishedAt: string;
31
+ /** SHA-256 of the source tree's canonical listing, lowercase hex (DATA_MODEL §2). */
32
+ readonly sourceDigest: string;
33
+ /** SHA-256 of the build environment's canonical JSON, lowercase hex (DATA_MODEL §2). */
34
+ readonly envDigest: string;
35
+ /** SHA-256 of the build output's canonical listing: recorded, never identity (VR-01). */
36
+ readonly outputDigest: string;
37
+ /** Diagnostic codes a forced publish recorded (D41); absent when none. */
38
+ readonly forcedDiagnostics?: readonly string[];
39
+ /**
40
+ * When `mostra gc` removed the version's files (D140): its ID and number stay, but it can't be
41
+ * opened until its exact source is published again. Absent for a version whose files exist.
42
+ */
43
+ readonly collected?: string;
44
+ }
45
+ /** One artifact, as `artifact/list` returns it. Metadata comes from the latest version's manifest. */
46
+ export interface ArtifactSummary {
47
+ /** The artifact ID. */
48
+ readonly id: string;
49
+ /** The title people see. */
50
+ readonly title: string;
51
+ /** What the artifact is for. */
52
+ readonly description?: string;
53
+ /** What kind of artifact it is. */
54
+ readonly family?: string;
55
+ /** Related artifacts. */
56
+ readonly links: readonly ArtifactLink[];
57
+ /** The render mode of the latest version. */
58
+ readonly mode: "spa";
59
+ /** The submission policy requested at publish or in the manifest; the host decides (D39). */
60
+ readonly policy?: SubmissionPolicy;
61
+ /** The source path the artifact was last published from. */
62
+ readonly source?: string;
63
+ /** When the artifact was first published (RFC 3339, UTC). */
64
+ readonly createdAt: string;
65
+ /** The version viewers are offered. */
66
+ readonly latestVersion?: VersionSummary;
67
+ }
68
+ /** One artifact in full, as `artifact/get` returns it. */
69
+ export interface ArtifactDetail extends ArtifactSummary {
70
+ /** The latest version's manifest. */
71
+ readonly manifest: ArtifactManifest;
72
+ /** Every version, newest number first. */
73
+ readonly versions: readonly VersionSummary[];
74
+ }
75
+ /**
76
+ * The receipt of `artifact/publish` (INTERFACES §6, H-07). Everything it names is durable before the
77
+ * response is sent.
78
+ */
79
+ export interface PublishReceipt {
80
+ /** The artifact the version belongs to. */
81
+ readonly artifactId: string;
82
+ /** The content-addressed version ID (D89). */
83
+ readonly versionId: string;
84
+ /** The version number. */
85
+ readonly version: number;
86
+ /**
87
+ * The capability URL: the artifact's default link (D97), the same for every publish until it is
88
+ * rotated or revoked. Instances with the gateway (WP-05 on) always set it; optional on
89
+ * the wire so instances without it can publish (D90).
90
+ */
91
+ readonly url?: string;
92
+ /**
93
+ * The ID of the token behind `url`, the artifact's default link (D97), for `view/rotate` and
94
+ * `view/revoke`. Present whenever `url` is.
95
+ */
96
+ readonly tokenId?: string;
97
+ /** The event cursor of the version's `version.published` event; `wait` and events read after it. */
98
+ readonly cursor: string;
99
+ /** `true` when this artifact already had this exact source and environment as a version. */
100
+ readonly reused: boolean;
101
+ /** The error codes a forced publish recorded (D41). */
102
+ readonly forcedDiagnostics?: readonly string[];
103
+ }
104
+ /** The Zod schema of the `VersionSummary` type. */
105
+ export declare const VersionSummary: z.ZodType<VersionSummary>;
106
+ /** The Zod schema of the `ArtifactSummary` type. */
107
+ export declare const ArtifactSummary: z.ZodType<ArtifactSummary>;
108
+ /** The Zod schema of the `ArtifactDetail` type. */
109
+ export declare const ArtifactDetail: z.ZodType<ArtifactDetail>;
110
+ /** The Zod schema of the `PublishReceipt` type. */
111
+ export declare const PublishReceipt: z.ZodType<PublishReceipt>;
112
+ //#endregion
113
+ //# sourceMappingURL=artifact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact.d.ts","names":[],"sources":["../src/artifact.ts"],"mappings":";;;;;;;YAgBY;WAAuB;;WAA4B;;;YAGnD;WAAyB;;WAAkC;;;qBAG1D,WAAW,EAAE,QAAQ;;qBASrB,aAAa,EAAE,QAAQ;;iBAQnB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;WAKA;;;iBAIM;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,gBAAgB;;WAEhB;;WAEA,SAAS;;WAET;;WAEA;;WAEA,gBAAgB;;;iBAIV,uBAAuB;;WAE7B,UAAU;;WAEV,mBAAmB;;;;;;iBAOb;;WAEN;;WAEA;;WAEA;;;;;;WAMA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBA2B1B,iBAAiB,EAAE,QAAQ;;qBAQ3B,gBAAgB,EAAE,QAAQ;;qBAY1B,gBAAgB,EAAE,QAAQ"}
@@ -0,0 +1,79 @@
1
+ import { wireRegistry } from "./wire-registry.js";
2
+ import { ArtifactId, Cursor, TokenId, VersionId } from "./ids.js";
3
+ import { ArtifactLink, ArtifactManifest, SubmissionPolicy } from "./manifest.js";
4
+ import * as z from "zod";
5
+ //#region src/artifact.ts
6
+ /**
7
+ * Artifacts and versions as clients see them (INTERFACES §6): how a client names an artifact or its
8
+ * source, and the summaries `artifact/list`, `artifact/get` and `artifact/publish` return.
9
+ */
10
+ /** An absolute file system path: the client resolves relative paths against its own directory. */
11
+ const AbsolutePath = z.string().regex(/^\//);
12
+ /** The Zod schema of the `SourceRef` type. */
13
+ const SourceRef = z.union([z.object({ path: AbsolutePath }), z.object({ artifactId: ArtifactId.schema })]).register(wireRegistry, {
14
+ id: "SourceRef",
15
+ description: "Where to build an artifact from: an absolute source path, or an artifact ID (its last published source path)."
16
+ });
17
+ /** The Zod schema of the `ArtifactRef` type. */
18
+ const ArtifactRef = z.union([z.object({ artifactId: ArtifactId.schema }), z.object({ path: AbsolutePath })]).register(wireRegistry, {
19
+ id: "ArtifactRef",
20
+ description: "Names an artifact by its ID or by an absolute source path bound to it."
21
+ });
22
+ /** The Zod schema of the `VersionSummary` type. */
23
+ const VersionSummary = z.object({
24
+ id: VersionId.schema,
25
+ number: z.int().min(1),
26
+ publishedAt: z.iso.datetime(),
27
+ sourceDigest: z.string().regex(/^[0-9a-f]{64}$/),
28
+ envDigest: z.string().regex(/^[0-9a-f]{64}$/),
29
+ outputDigest: z.string().regex(/^[0-9a-f]{64}$/),
30
+ forcedDiagnostics: z.array(z.string()).readonly().exactOptional(),
31
+ collected: z.iso.datetime().exactOptional()
32
+ }).register(wireRegistry, {
33
+ id: "VersionSummary",
34
+ description: "One published version."
35
+ });
36
+ const summaryShape = {
37
+ id: ArtifactId.schema,
38
+ title: z.string(),
39
+ description: z.string().exactOptional(),
40
+ family: z.string().exactOptional(),
41
+ links: z.array(ArtifactLink).readonly(),
42
+ mode: z.literal("spa"),
43
+ policy: SubmissionPolicy.exactOptional(),
44
+ source: z.string().exactOptional(),
45
+ createdAt: z.iso.datetime(),
46
+ latestVersion: VersionSummary.exactOptional()
47
+ };
48
+ /** The Zod schema of the `ArtifactSummary` type. */
49
+ const ArtifactSummary = z.object(summaryShape).register(wireRegistry, {
50
+ id: "ArtifactSummary",
51
+ description: "One artifact: metadata from its latest version, its source and latest version."
52
+ });
53
+ /** The Zod schema of the `ArtifactDetail` type. */
54
+ const ArtifactDetail = z.object({
55
+ ...summaryShape,
56
+ manifest: ArtifactManifest,
57
+ versions: z.array(VersionSummary).readonly()
58
+ }).register(wireRegistry, {
59
+ id: "ArtifactDetail",
60
+ description: "One artifact in full: its summary, the latest manifest and every version."
61
+ });
62
+ /** The Zod schema of the `PublishReceipt` type. */
63
+ const PublishReceipt = z.object({
64
+ artifactId: ArtifactId.schema,
65
+ versionId: VersionId.schema,
66
+ version: z.int().min(1),
67
+ url: z.string().exactOptional(),
68
+ tokenId: TokenId.schema.exactOptional(),
69
+ cursor: Cursor.schema,
70
+ reused: z.boolean(),
71
+ forcedDiagnostics: z.array(z.string()).readonly().exactOptional()
72
+ }).register(wireRegistry, {
73
+ id: "PublishReceipt",
74
+ description: "The receipt of artifact/publish: artifact, version, number, capability URL when served, event cursor, reuse."
75
+ });
76
+ //#endregion
77
+ export { ArtifactDetail, ArtifactRef, ArtifactSummary, PublishReceipt, SourceRef, VersionSummary };
78
+
79
+ //# sourceMappingURL=artifact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"artifact.js","names":[],"sources":["../src/artifact.ts"],"sourcesContent":["/**\n * Artifacts and versions as clients see them (INTERFACES §6): how a client names an artifact or its\n * source, and the summaries `artifact/list`, `artifact/get` and `artifact/publish` return.\n */\nimport * as z from \"zod\";\nimport { ArtifactId, Cursor, TokenId, VersionId } from \"./ids.ts\";\nimport { ArtifactLink, ArtifactManifest, SubmissionPolicy } from \"./manifest.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** An absolute file system path: the client resolves relative paths against its own directory. */\nconst AbsolutePath = z.string().regex(/^\\//);\n\n/**\n * Where to build an artifact from: a source path (a `.tsx`, `.jsx` or `.mdx` file, or a directory\n * with an `index` entry), or an artifact ID, meaning the path it was last published from.\n */\nexport type SourceRef = { readonly path: string } | { readonly artifactId: string };\n\n/** Names an artifact: by its ID, or by a source path bound to it. */\nexport type ArtifactRef = { readonly artifactId: string } | { readonly path: string };\n\n/** The Zod schema of the `SourceRef` type. */\nexport const SourceRef: z.ZodType<SourceRef> = z\n .union([z.object({ path: AbsolutePath }), z.object({ artifactId: ArtifactId.schema })])\n .register(wireRegistry, {\n id: \"SourceRef\",\n description:\n \"Where to build an artifact from: an absolute source path, or an artifact ID (its last published source path).\",\n });\n\n/** The Zod schema of the `ArtifactRef` type. */\nexport const ArtifactRef: z.ZodType<ArtifactRef> = z\n .union([z.object({ artifactId: ArtifactId.schema }), z.object({ path: AbsolutePath })])\n .register(wireRegistry, {\n id: \"ArtifactRef\",\n description: \"Names an artifact by its ID or by an absolute source path bound to it.\",\n });\n\n/** One published version. */\nexport interface VersionSummary {\n /** The content-addressed version ID (D89). */\n readonly id: string;\n /** The per-artifact version number, for people: 1, 2, 3 … */\n readonly number: number;\n /** When it was published (RFC 3339, UTC). */\n readonly publishedAt: string;\n /** SHA-256 of the source tree's canonical listing, lowercase hex (DATA_MODEL §2). */\n readonly sourceDigest: string;\n /** SHA-256 of the build environment's canonical JSON, lowercase hex (DATA_MODEL §2). */\n readonly envDigest: string;\n /** SHA-256 of the build output's canonical listing: recorded, never identity (VR-01). */\n readonly outputDigest: string;\n /** Diagnostic codes a forced publish recorded (D41); absent when none. */\n readonly forcedDiagnostics?: readonly string[];\n /**\n * When `mostra gc` removed the version's files (D140): its ID and number stay, but it can't be\n * opened until its exact source is published again. Absent for a version whose files exist.\n */\n readonly collected?: string;\n}\n\n/** One artifact, as `artifact/list` returns it. Metadata comes from the latest version's manifest. */\nexport interface ArtifactSummary {\n /** The artifact ID. */\n readonly id: string;\n /** The title people see. */\n readonly title: string;\n /** What the artifact is for. */\n readonly description?: string;\n /** What kind of artifact it is. */\n readonly family?: string;\n /** Related artifacts. */\n readonly links: readonly ArtifactLink[];\n /** The render mode of the latest version. */\n readonly mode: \"spa\";\n /** The submission policy requested at publish or in the manifest; the host decides (D39). */\n readonly policy?: SubmissionPolicy;\n /** The source path the artifact was last published from. */\n readonly source?: string;\n /** When the artifact was first published (RFC 3339, UTC). */\n readonly createdAt: string;\n /** The version viewers are offered. */\n readonly latestVersion?: VersionSummary;\n}\n\n/** One artifact in full, as `artifact/get` returns it. */\nexport interface ArtifactDetail extends ArtifactSummary {\n /** The latest version's manifest. */\n readonly manifest: ArtifactManifest;\n /** Every version, newest number first. */\n readonly versions: readonly VersionSummary[];\n}\n\n/**\n * The receipt of `artifact/publish` (INTERFACES §6, H-07). Everything it names is durable before the\n * response is sent.\n */\nexport interface PublishReceipt {\n /** The artifact the version belongs to. */\n readonly artifactId: string;\n /** The content-addressed version ID (D89). */\n readonly versionId: string;\n /** The version number. */\n readonly version: number;\n /**\n * The capability URL: the artifact's default link (D97), the same for every publish until it is\n * rotated or revoked. Instances with the gateway (WP-05 on) always set it; optional on\n * the wire so instances without it can publish (D90).\n */\n readonly url?: string;\n /**\n * The ID of the token behind `url`, the artifact's default link (D97), for `view/rotate` and\n * `view/revoke`. Present whenever `url` is.\n */\n readonly tokenId?: string;\n /** The event cursor of the version's `version.published` event; `wait` and events read after it. */\n readonly cursor: string;\n /** `true` when this artifact already had this exact source and environment as a version. */\n readonly reused: boolean;\n /** The error codes a forced publish recorded (D41). */\n readonly forcedDiagnostics?: readonly string[];\n}\n\n/** The Zod schema of the `VersionSummary` type. */\nexport const VersionSummary: z.ZodType<VersionSummary> = z\n .object({\n id: VersionId.schema,\n number: z.int().min(1),\n publishedAt: z.iso.datetime(),\n sourceDigest: z.string().regex(/^[0-9a-f]{64}$/),\n envDigest: z.string().regex(/^[0-9a-f]{64}$/),\n outputDigest: z.string().regex(/^[0-9a-f]{64}$/),\n forcedDiagnostics: z.array(z.string()).readonly().exactOptional(),\n collected: z.iso.datetime().exactOptional(),\n })\n .register(wireRegistry, { id: \"VersionSummary\", description: \"One published version.\" });\n\nconst summaryShape = {\n id: ArtifactId.schema,\n title: z.string(),\n description: z.string().exactOptional(),\n family: z.string().exactOptional(),\n links: z.array(ArtifactLink).readonly(),\n mode: z.literal(\"spa\"),\n policy: SubmissionPolicy.exactOptional(),\n source: z.string().exactOptional(),\n createdAt: z.iso.datetime(),\n latestVersion: VersionSummary.exactOptional(),\n};\n\n/** The Zod schema of the `ArtifactSummary` type. */\nexport const ArtifactSummary: z.ZodType<ArtifactSummary> = z\n .object(summaryShape)\n .register(wireRegistry, {\n id: \"ArtifactSummary\",\n description: \"One artifact: metadata from its latest version, its source and latest version.\",\n });\n\n/** The Zod schema of the `ArtifactDetail` type. */\nexport const ArtifactDetail: z.ZodType<ArtifactDetail> = z\n .object({\n ...summaryShape,\n manifest: ArtifactManifest,\n versions: z.array(VersionSummary).readonly(),\n })\n .register(wireRegistry, {\n id: \"ArtifactDetail\",\n description: \"One artifact in full: its summary, the latest manifest and every version.\",\n });\n\n/** The Zod schema of the `PublishReceipt` type. */\nexport const PublishReceipt: z.ZodType<PublishReceipt> = z\n .object({\n artifactId: ArtifactId.schema,\n versionId: VersionId.schema,\n version: z.int().min(1),\n url: z.string().exactOptional(),\n tokenId: TokenId.schema.exactOptional(),\n cursor: Cursor.schema,\n reused: z.boolean(),\n forcedDiagnostics: z.array(z.string()).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"PublishReceipt\",\n description:\n \"The receipt of artifact/publish: artifact, version, number, capability URL when served, event cursor, reuse.\",\n });\n"],"mappings":";;;;;;;;;;AAUA,MAAM,eAAe,EAAE,OAAO,CAAC,CAAC,MAAM,KAAK;;AAY3C,MAAa,YAAkC,EAC5C,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,YAA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;AAGH,MAAa,iBAA4C,EACtD,OAAO;CACN,GAAG;CACH,UAAU;CACV,UAAU,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,iBAA4C,EACtD,OAAO;CACN,YAAY,WAAW;CACvB,WAAW,UAAU;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc;CAC9B,SAAS,QAAQ,OAAO,cAAc;CACtC,QAAQ,OAAO;CACf,QAAQ,EAAE,QAAQ;CAClB,mBAAmB,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAClE,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC"}
@@ -0,0 +1,295 @@
1
+ import { ViewContextWire } from "./view.js";
2
+ import * as z from "zod";
3
+ //#region src/bridge.d.ts
4
+ /** Which end of the bridge: the trusted shell, or the artifact's frame. */
5
+ export type BridgeSide = "shell" | "artifact";
6
+ /** One message of the bridge's set. */
7
+ export interface BridgeMessage<P, R> {
8
+ /** The JSON-RPC method name; MCP Apps' name where the concept exists. */
9
+ readonly method: string;
10
+ /** The side that sends it. */
11
+ readonly from: BridgeSide;
12
+ /** A request is answered; a notification isn't. */
13
+ readonly kind: "request" | "notification";
14
+ /** The schema of its params. */
15
+ readonly params: z.ZodType<P>;
16
+ /** The schema of a request's result (`z.undefined()` for notifications). */
17
+ readonly result: z.ZodType<R>;
18
+ }
19
+ /** A bridge message of any params and result type. */
20
+ export type AnyBridgeMessage = BridgeMessage<unknown, unknown>;
21
+ /** The version of MCP Apps whose message shapes the bridge follows (VERIFIED_FACTS, MCP). */
22
+ export declare const MCP_APPS_PROTOCOL_VERSION = "2026-01-26";
23
+ /** An application's name and version (MCP's `Implementation`). */
24
+ export interface BridgeImplementation {
25
+ /** A stable machine name, such as `mostra-shell`. */
26
+ readonly name: string;
27
+ /** Its release. */
28
+ readonly version: string;
29
+ /** A name for people. */
30
+ readonly title?: string;
31
+ }
32
+ /** The params of `ui/initialize`: the artifact introduces itself (MCP Apps). */
33
+ export interface UiInitializeParams {
34
+ /** The artifact's client runtime. */
35
+ readonly appInfo: BridgeImplementation;
36
+ /** What the artifact offers (MCP Apps' `McpUiAppCapabilities`). */
37
+ readonly appCapabilities: Readonly<Record<string, unknown>>;
38
+ /** The MCP Apps revision the artifact speaks, {@link MCP_APPS_PROTOCOL_VERSION}. */
39
+ readonly protocolVersion: string;
40
+ /**
41
+ * What the page is (WP-07): the version whose build the frame loaded. An artifact origin serves
42
+ * the version its frame session last entered (D98 item 5), so a frame reloaded after another
43
+ * tab switched versions may hold another version than its view; the shell re-enters its own.
44
+ */
45
+ readonly mostra?: {
46
+ readonly versionId: string;
47
+ };
48
+ }
49
+ /** What the shell tells the artifact about where it is shown (MCP Apps' `HostContext`). */
50
+ export interface BridgeHostContext {
51
+ /** The viewer's color scheme. */
52
+ readonly theme?: "light" | "dark";
53
+ /** How the artifact is shown: the shell shows it `fullscreen`. */
54
+ readonly displayMode?: "inline" | "fullscreen" | "pip";
55
+ /** The display modes the shell offers. */
56
+ readonly availableDisplayModes?: readonly string[];
57
+ /** The viewer's language (BCP 47). */
58
+ readonly locale?: string;
59
+ /** The viewer's time zone (IANA). */
60
+ readonly timeZone?: string;
61
+ /** The kind of device. */
62
+ readonly platform?: "web" | "desktop" | "mobile";
63
+ /** Further MCP Apps context, passed through. */
64
+ readonly [key: string]: unknown;
65
+ }
66
+ /** The result of `ui/initialize`: the shell introduces itself (MCP Apps). */
67
+ export interface UiInitializeResult {
68
+ /** The MCP Apps revision both ends speak. */
69
+ readonly protocolVersion: string;
70
+ /** The shell. */
71
+ readonly hostInfo: BridgeImplementation;
72
+ /** What the shell offers (MCP Apps' `McpUiHostCapabilities`). */
73
+ readonly hostCapabilities: Readonly<Record<string, unknown>>;
74
+ /** Where and how the artifact is shown. */
75
+ readonly hostContext: BridgeHostContext;
76
+ /** Mostra's shell: the view this frame load is, and what the host allows in it (WP-07). */
77
+ readonly mostra?: ViewContextWire;
78
+ }
79
+ /** `ui/initialize`: the artifact's first request, answered with the shell's context. */
80
+ export declare const uiInitialize: BridgeMessage<UiInitializeParams, UiInitializeResult>;
81
+ /** `ui/notifications/initialized`: the artifact finished initializing; the shell may now send. */
82
+ export declare const uiInitialized: BridgeMessage<Readonly<Record<string, unknown>>, undefined>;
83
+ /** `ui/notifications/size-changed`: the artifact's rendered size (MCP Apps). */
84
+ export declare const uiSizeChanged: BridgeMessage<{
85
+ readonly width?: number;
86
+ readonly height?: number;
87
+ }, undefined>;
88
+ /**
89
+ * The URL schemes `ui/open-link` opens: the web, mail and phone numbers. Anything else, such as
90
+ * `javascript:` or `data:`, would run or show content in the shell's own context.
91
+ */
92
+ export declare const OPEN_LINK_SCHEMES: readonly string[];
93
+ /**
94
+ * `ui/open-link`: the artifact asks the shell to open a URL in a new tab (MCP Apps). The frame
95
+ * can't navigate the viewer's tab itself (D98 item 7), so this is how an artifact sends the
96
+ * viewer anywhere. `isError` is `true` when the shell couldn't open it.
97
+ */
98
+ export declare const uiOpenLink: BridgeMessage<{
99
+ readonly url: string;
100
+ }, {
101
+ readonly isError?: boolean;
102
+ readonly [key: string]: unknown;
103
+ }>;
104
+ /** `mostra/ready`: the artifact's page has rendered; `verify` waits for it (ROUND-3 §8). */
105
+ export declare const mostraReady: BridgeMessage<Readonly<Record<string, unknown>>, undefined>;
106
+ /** The page's save state, as the shell's rail shows it (D47). */
107
+ export type SaveState = "saved" | "saving" | "offline" | "conflict";
108
+ /** Why a field blocks a submit (INTERFACES §2.3). */
109
+ export interface SubmitBlocker {
110
+ /** The field's ID. */
111
+ readonly fieldId: string;
112
+ /** Its label, when it has one. */
113
+ readonly label?: string;
114
+ /** `required` without a value, `invalid` by its `validate`, or a `conflict` not yet resolved. */
115
+ readonly reason: "required" | "invalid" | "conflict";
116
+ }
117
+ /**
118
+ * The longest label, validation message or other text a field carries over the bridge; a page
119
+ * shortens longer ones before it sends them (Claude review finding 11).
120
+ */
121
+ export declare const BRIDGE_TEXT_MAX = 1024;
122
+ /** The most fields or blockers one bridge message lists; a page sends those that matter first. */
123
+ export declare const BRIDGE_FIELDS_MAX = 1e4;
124
+ /**
125
+ * A field the page has mounted, with what the shell needs to list blockers by label (D52, D106).
126
+ * The page reports it; the shell checks `required` against the draft it reads itself.
127
+ */
128
+ export interface FieldRegistration {
129
+ /** The field's ID. */
130
+ readonly id: string;
131
+ /** The label people see. */
132
+ readonly label?: string;
133
+ /** Whether a submit needs a value. */
134
+ readonly required?: boolean;
135
+ /** The viewer's draft or the artifact's shared state. */
136
+ readonly scope: "viewer" | "artifact";
137
+ /** Whether its value is kept out of events and logs. */
138
+ readonly sensitive?: boolean;
139
+ /** Its `validate` message for the current value, if any. */
140
+ readonly error?: string;
141
+ /** Whether it has a conflict the viewer hasn't resolved. */
142
+ readonly conflict?: boolean;
143
+ }
144
+ /** The params of `mostra/fields`. */
145
+ export interface FieldsParams {
146
+ /** Every mounted field, once per ID. */
147
+ readonly fields: readonly FieldRegistration[];
148
+ /** The page's save state. */
149
+ readonly save: SaveState;
150
+ /** Whether edits are waiting to be saved (typed, offline, or in the journal). */
151
+ readonly unsaved: boolean;
152
+ }
153
+ /**
154
+ * `mostra/fields`: the page's mounted fields and save state, sent whenever they change, so the
155
+ * shell lists blockers by label and its rail shows "Saving" and "Saved" (INTERFACES §5).
156
+ */
157
+ export declare const mostraFields: BridgeMessage<FieldsParams, undefined>;
158
+ /**
159
+ * `mostra/page`: the page the viewer is on, inside a `pages/` artifact (D57), so comments record
160
+ * it (WP-20). `path` is the route's path with its search and hash, whatever the history mode.
161
+ */
162
+ export declare const mostraPage: BridgeMessage<{
163
+ readonly path: string;
164
+ readonly title?: string;
165
+ }, undefined>;
166
+ /** A trusted control the artifact asks the shell for (INTERFACES §5): the artifact asks, the shell decides. */
167
+ export type ControlRequest = {
168
+ /** Relabel the shell's trusted Submit, with an optional confirmation text. */
169
+ readonly control: "submit";
170
+ readonly label?: string;
171
+ readonly confirm?: string;
172
+ } | {
173
+ /** Render a trusted Choose for a review set's candidates (D113). */
174
+ readonly control: "choose";
175
+ readonly reviewSetId: string;
176
+ readonly candidates: readonly {
177
+ readonly id: string;
178
+ readonly label?: string;
179
+ }[];
180
+ /** The candidate the page shows now, which Choose names. */
181
+ readonly current?: string;
182
+ } | {
183
+ /** Withdraw an earlier request: the Submit label, or a review set's Choose. */
184
+ readonly control: "release";
185
+ readonly submit?: true;
186
+ readonly reviewSetId?: string;
187
+ };
188
+ /** The longest Submit label the shell renders: one short line. */
189
+ export declare const CONTROL_LABEL_MAX = 48;
190
+ /**
191
+ * `mostra/controls.request`: the artifact asks the shell for a trusted control (D06, SH-02). The
192
+ * shell renders it in its own origin, where the artifact can neither click nor reach it, and
193
+ * answers whether it is shown: a control the host's policy leaves out is not (D108).
194
+ */
195
+ export declare const mostraControlsRequest: BridgeMessage<ControlRequest, {
196
+ readonly shown: boolean;
197
+ }>;
198
+ /** What the page answers `mostra/flush`. */
199
+ export interface FlushResult {
200
+ /** The viewer's draft revision once every save landed. */
201
+ readonly revision: string;
202
+ /** Whether edits still wait (offline, or a save failed). */
203
+ readonly unsaved: boolean;
204
+ /** What blocks a submit now: invalid values and open conflicts, and required fields the page sees empty. */
205
+ readonly blockers: readonly SubmitBlocker[];
206
+ }
207
+ /**
208
+ * `mostra/flush`: the shell asks the page to save everything now, before its trusted Submit or a
209
+ * switch to a newer version (IN-02, D110). For a submit, the page first writes the defaults the
210
+ * viewer saw. The shell checks the answer against the draft it reads itself.
211
+ */
212
+ export declare const mostraFlush: BridgeMessage<{
213
+ readonly reason: "submit" | "switch";
214
+ }, FlushResult>;
215
+ /** The params of `mostra/version.available`. */
216
+ export interface VersionAvailableParams {
217
+ /** The newer version's ID. */
218
+ readonly versionId: string;
219
+ /** Its number. */
220
+ readonly version: number;
221
+ /** How many of the viewer's answers it doesn't carry over (D42). */
222
+ readonly orphans: number;
223
+ }
224
+ /**
225
+ * `mostra/version.available`: a newer version was published while the page is open (VR-04). The
226
+ * shell always shows its own trusted banner; the page may show a notice too.
227
+ */
228
+ export declare const mostraVersionAvailable: BridgeMessage<VersionAvailableParams, undefined>;
229
+ /** `mostra/field.focus`: the viewer picked a blocker in the shell; the page focuses that field. */
230
+ export declare const mostraFieldFocus: BridgeMessage<{
231
+ readonly id: string;
232
+ }, undefined>;
233
+ /**
234
+ * Every message of the bridge in this release. WP-20 adds review messages; a message never
235
+ * changes meaning once released (D32).
236
+ */
237
+ export declare const BRIDGE_MESSAGES: readonly AnyBridgeMessage[];
238
+ /** The window events arrive on (`window` itself). */
239
+ export interface BridgeReceiver {
240
+ /** Starts delivering `message` events to `listener`. */
241
+ addEventListener(type: "message", listener: (event: BridgeEvent) => void): void;
242
+ /** Stops delivering them. */
243
+ removeEventListener(type: "message", listener: (event: BridgeEvent) => void): void;
244
+ }
245
+ /** The parts of a `MessageEvent` the bridge reads. */
246
+ export interface BridgeEvent {
247
+ /** The message. */
248
+ readonly data: unknown;
249
+ /** The sender's origin, as the browser reports it. */
250
+ readonly origin: string;
251
+ /** The sending window. */
252
+ readonly source: unknown;
253
+ }
254
+ /** The window messages go to: the frame's `contentWindow`, or the shell (`window.parent`). */
255
+ export interface BridgePeer {
256
+ /** Posts `message` to the window, delivered only if its origin is `targetOrigin`. */
257
+ postMessage(message: unknown, targetOrigin: string): void;
258
+ }
259
+ /** Why the bridge dropped a message, for logs and tests. */
260
+ export type BridgeRejection = "wrong-source" | "wrong-origin" | "not-json-rpc" | "unknown-method" | "wrong-direction" | "invalid-params";
261
+ /** Options for {@link connectBridge}. */
262
+ export interface BridgeOptions {
263
+ /** This end. It accepts only messages the other side sends. */
264
+ readonly side: BridgeSide;
265
+ /** Where messages arrive. */
266
+ readonly receiver: BridgeReceiver;
267
+ /** The window this end talks to, looked up on every message (a frame's window changes on reload). */
268
+ readonly peer: () => BridgePeer | null | undefined;
269
+ /** The peer's exact origin. Messages from any other origin are dropped. */
270
+ readonly peerOrigin: string;
271
+ /** Answers a request from the peer; throw an {@link RpcError} to answer with an error. */
272
+ readonly onRequest?: (message: AnyBridgeMessage, params: unknown) => unknown;
273
+ /** Receives a notification from the peer. */
274
+ readonly onNotification?: (message: AnyBridgeMessage, params: unknown) => void;
275
+ /** Hears about every dropped message. */
276
+ readonly onRejected?: (reason: BridgeRejection, event: BridgeEvent) => void;
277
+ }
278
+ /** One end of a connected bridge. */
279
+ export interface Bridge {
280
+ /** Sends a request this side may send and resolves with its validated result. */
281
+ call<P, R>(message: BridgeMessage<P, R>, params: P, options?: {
282
+ timeoutMs?: number;
283
+ }): Promise<R>;
284
+ /** Sends a notification this side may send. */
285
+ notify<P>(message: BridgeMessage<P, undefined>, params: P): void;
286
+ /** Stops listening; waiting calls reject. */
287
+ close(): void;
288
+ }
289
+ /**
290
+ * Connects one end of the bridge. Every incoming message must come from `peer()` at exactly
291
+ * `peerOrigin`, be a JSON-RPC message, name a message the other side sends, and carry valid params.
292
+ */
293
+ export declare function connectBridge(options: BridgeOptions): Bridge;
294
+ //#endregion
295
+ //# sourceMappingURL=bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridge.d.ts","names":[],"sources":["../src/bridge.ts"],"mappings":";;;;YA2BY;;iBAGK,cAAc,GAAG;;WAEvB;;WAEA,MAAM;;WAEN;;WAEA,QAAQ,EAAE,QAAQ;;WAElB,QAAQ,EAAE,QAAQ;;;YAIjB,mBAAmB;;qBAGlB;;iBAGI;;WAEN;;WAEA;;WAEA;;;iBAUM;;WAEN,SAAS;;WAET,iBAAiB,SAAS;;WAE1B;;;;;;WAMA;aAAoB;;;;iBAId;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;iBAMM;;WAEN;;WAEA,UAAU;;WAEV,kBAAkB,SAAS;;WAE3B,aAAa;;WAEb,SAAS;;;qBAIP,cAAc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