@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,728 @@
1
+ /**
2
+ * The interaction ledger's wire types (INTERFACES §4, §6, §7, §8; DATA_MODEL §3, §4): viewers,
3
+ * fields and their mutations, events and their filters, `wait` conditions, submissions, deliveries
4
+ * and results. The host protocol methods (`state/*`, `results/get`, `wait`, `events/*`), the
5
+ * submissions and drafts ports, and the browser protocol all speak these shapes.
6
+ */
7
+ import * as z from "zod";
8
+ import {
9
+ ArtifactId,
10
+ Cursor,
11
+ DeliveryId,
12
+ SubmissionId,
13
+ VersionId,
14
+ ViewerId,
15
+ ViewId,
16
+ } from "./ids.ts";
17
+ import { ArtifactLink, SubmissionPolicy } from "./manifest.ts";
18
+ import type { SubmitChannel } from "./view.ts";
19
+ import { wireRegistry } from "./wire-registry.ts";
20
+
21
+ export { ControlsPolicy, SubmitChannel, TrustedControl } from "./view.ts";
22
+
23
+ // ── Viewers and actors ────────────────────────────────────────────────────────────────────
24
+
25
+ /** How Mostra knows a viewer (DATA_MODEL §3 `viewer.kind`). */
26
+ export type ViewerKind = "local" | "tailnet" | "token" | "host";
27
+
28
+ /**
29
+ * A person who views an artifact (PRODUCT vocabulary). The home's local user is one viewer of kind
30
+ * `local`; a link minted with `viewer` acts as a viewer of kind `token` (D104).
31
+ */
32
+ export interface Viewer {
33
+ /** The viewer's ID. */
34
+ readonly id: string;
35
+ /** How Mostra knows the viewer. */
36
+ readonly kind: ViewerKind;
37
+ /** The display name, when one is known. */
38
+ readonly name?: string;
39
+ /** The host's own key for this person, as given to `view/url` (D104). */
40
+ readonly ref?: string;
41
+ }
42
+
43
+ /** The Zod schema of the `Viewer` type. */
44
+ export const Viewer: z.ZodType<Viewer> = z
45
+ .object({
46
+ id: ViewerId.schema,
47
+ kind: z.enum(["local", "tailnet", "token", "host"]),
48
+ name: z.string().exactOptional(),
49
+ ref: z.string().exactOptional(),
50
+ })
51
+ .register(wireRegistry, {
52
+ id: "Viewer",
53
+ description: "A person who views an artifact: ID, kind, display name and the host's own key.",
54
+ });
55
+
56
+ /**
57
+ * The person a capability link acts for (`view/url`'s `viewer`, D104): the host's stable key for
58
+ * them, such as an email or an account ID, and a display name.
59
+ */
60
+ export interface ViewerSpec {
61
+ /** The host's stable key for this person: the same `ref` always names the same viewer. */
62
+ readonly ref: string;
63
+ /** The name people see; updated when given again. */
64
+ readonly name?: string;
65
+ }
66
+
67
+ /** The Zod schema of the `ViewerSpec` type. */
68
+ export const ViewerSpec: z.ZodType<ViewerSpec> = z
69
+ .object({
70
+ ref: z.string().min(1).max(256),
71
+ name: z.string().min(1).max(256).exactOptional(),
72
+ })
73
+ .register(wireRegistry, {
74
+ id: "ViewerSpec",
75
+ description: "The person a capability link acts for: the host's stable key and a display name.",
76
+ });
77
+
78
+ /** Who caused an event or wrote a field (DATA_MODEL §4). */
79
+ export interface Actor {
80
+ /** Who: a viewer, an agent (a protocol client), a host, or Mostra itself. */
81
+ readonly kind: "viewer" | "agent" | "host" | "mostra";
82
+ /** A viewer's ID, or the protocol client's name for agents and hosts. */
83
+ readonly id?: string;
84
+ /** A display name, when one is known. */
85
+ readonly name?: string;
86
+ }
87
+
88
+ /** The Zod schema of the `Actor` type. */
89
+ export const Actor: z.ZodType<Actor> = z
90
+ .object({
91
+ kind: z.enum(["viewer", "agent", "host", "mostra"]),
92
+ id: z.string().exactOptional(),
93
+ name: z.string().exactOptional(),
94
+ })
95
+ .register(wireRegistry, {
96
+ id: "Actor",
97
+ description: "Who caused an event or wrote a field: a viewer, an agent, a host or Mostra.",
98
+ });
99
+
100
+ // ── Fields and mutations ──────────────────────────────────────────────────────────────────
101
+
102
+ /** The longest field ID, in UTF-16 code units. */
103
+ export const FIELD_ID_MAX_LENGTH = 256;
104
+
105
+ /**
106
+ * Whether `id` is a field ID (D52): 1 to 256 characters without control characters; dots separate
107
+ * the parts that nest in results, so none is empty.
108
+ */
109
+ export function isFieldId(id: unknown): id is string {
110
+ return (
111
+ typeof id === "string" &&
112
+ id.length >= 1 &&
113
+ id.length <= FIELD_ID_MAX_LENGTH &&
114
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.
115
+ !/[\u0000-\u001f\u007f]/.test(id) &&
116
+ !id.split(".").includes("")
117
+ );
118
+ }
119
+
120
+ /** Which document a field belongs to: the viewer's draft, or the artifact's shared state (D63). */
121
+ export type FieldScope = "viewer" | "artifact";
122
+
123
+ /**
124
+ * A document revision: the decimal string of a document's monotonic counter (DATA_MODEL §3).
125
+ * `"0"` is a document nothing has written yet.
126
+ */
127
+ export type DocumentRevision = string;
128
+
129
+ /** The Zod schema of the `DocumentRevision` type. */
130
+ export const DocumentRevision: z.ZodType<DocumentRevision> = z
131
+ .string()
132
+ .regex(/^(0|[1-9][0-9]{0,15})$/)
133
+ .register(wireRegistry, {
134
+ id: "DocumentRevision",
135
+ description: "A draft's or artifact state's revision: a non-negative decimal integer string.",
136
+ });
137
+
138
+ /**
139
+ * One change to one field. Exactly one of `value` and `delete` is given. The optional metadata
140
+ * travels with the field into results and decides what events redact (D52, D106).
141
+ */
142
+ export interface FieldOp {
143
+ /** The field ID (D52). */
144
+ readonly id: string;
145
+ /** The new value: any JSON value, `null` included. */
146
+ readonly value?: unknown;
147
+ /** Removes the field. */
148
+ readonly delete?: true;
149
+ /** The label people see in results and the shell's blocker list. */
150
+ readonly label?: string;
151
+ /** Whether the shell asks for it before submit. */
152
+ readonly required?: boolean;
153
+ /** Kept in submissions and results, redacted from events and logs (D52). */
154
+ readonly sensitive?: boolean;
155
+ }
156
+
157
+ /** The Zod schema of the `FieldOp` type. */
158
+ export const FieldOp: z.ZodType<FieldOp> = z
159
+ .object({
160
+ id: z.string().min(1).max(FIELD_ID_MAX_LENGTH),
161
+ value: z.unknown().exactOptional(),
162
+ delete: z.literal(true).exactOptional(),
163
+ label: z.string().max(1024).exactOptional(),
164
+ required: z.boolean().exactOptional(),
165
+ sensitive: z.boolean().exactOptional(),
166
+ })
167
+ .register(wireRegistry, {
168
+ id: "FieldOp",
169
+ description:
170
+ "One change to one field: a value or a delete, with optional label, required and sensitive.",
171
+ }) as z.ZodType<FieldOp>;
172
+
173
+ /** A field's current state. */
174
+ export interface FieldState {
175
+ /** The field's value: any JSON value. */
176
+ readonly value: unknown;
177
+ /** The document revision that last wrote it. */
178
+ readonly revision: DocumentRevision;
179
+ /** Who wrote it last. */
180
+ readonly updatedBy?: Actor;
181
+ /** When it was written last. */
182
+ readonly updatedAt: string;
183
+ /** The label people see. */
184
+ readonly label?: string;
185
+ /** Whether the shell asks for it before submit. */
186
+ readonly required?: boolean;
187
+ /** Whether events and logs redact its value (D52). */
188
+ readonly sensitive?: boolean;
189
+ }
190
+
191
+ /** The Zod schema of the `FieldState` type. */
192
+ export const FieldState: z.ZodType<FieldState> = z
193
+ .object({
194
+ value: z.unknown(),
195
+ revision: DocumentRevision,
196
+ updatedBy: Actor.exactOptional(),
197
+ updatedAt: z.iso.datetime(),
198
+ label: z.string().exactOptional(),
199
+ required: z.boolean().exactOptional(),
200
+ sensitive: z.boolean().exactOptional(),
201
+ })
202
+ .register(wireRegistry, {
203
+ id: "FieldState",
204
+ description: "A field's current value, the revision that wrote it, who wrote it and when.",
205
+ }) as z.ZodType<FieldState>;
206
+
207
+ /**
208
+ * A field op that wasn't applied because the field changed after the mutation's base revision
209
+ * (D22, FAILURE_MODEL §5): what the field holds now, so the writer can keep theirs or take it.
210
+ */
211
+ export interface FieldConflict {
212
+ /** The field's ID. */
213
+ readonly id: string;
214
+ /** The revision that last changed the field. */
215
+ readonly revision: DocumentRevision;
216
+ /** Its current value; absent when it was deleted. */
217
+ readonly value?: unknown;
218
+ /** `true` when the field was deleted. */
219
+ readonly deleted?: true;
220
+ /** Who changed it. */
221
+ readonly updatedBy?: Actor;
222
+ /** When it changed. */
223
+ readonly updatedAt?: string;
224
+ }
225
+
226
+ /** The Zod schema of the `FieldConflict` type. */
227
+ export const FieldConflict: z.ZodType<FieldConflict> = z
228
+ .object({
229
+ id: z.string(),
230
+ revision: DocumentRevision,
231
+ value: z.unknown().exactOptional(),
232
+ deleted: z.literal(true).exactOptional(),
233
+ updatedBy: Actor.exactOptional(),
234
+ updatedAt: z.iso.datetime().exactOptional(),
235
+ })
236
+ .register(wireRegistry, {
237
+ id: "FieldConflict",
238
+ description: "A field op not applied because the field changed after the base revision.",
239
+ }) as z.ZodType<FieldConflict>;
240
+
241
+ /** What a mutation did: the document's revision after it, the ops applied, and the conflicts. */
242
+ export interface MutationResult {
243
+ /** The document's revision after the mutation; unchanged when nothing applied. */
244
+ readonly revision: DocumentRevision;
245
+ /** The field IDs whose ops were applied. */
246
+ readonly applied: readonly string[];
247
+ /** The ops not applied, with what each field holds now. */
248
+ readonly conflicts: readonly FieldConflict[];
249
+ }
250
+
251
+ /** The Zod schema of the `MutationResult` type. */
252
+ export const MutationResult: z.ZodType<MutationResult> = z
253
+ .object({
254
+ revision: DocumentRevision,
255
+ applied: z.array(z.string()).readonly(),
256
+ conflicts: z.array(FieldConflict).readonly(),
257
+ })
258
+ .register(wireRegistry, {
259
+ id: "MutationResult",
260
+ description:
261
+ "A mutation's outcome: the revision after it, the applied field IDs, the conflicts.",
262
+ });
263
+
264
+ // ── Events ────────────────────────────────────────────────────────────────────────────────
265
+
266
+ /**
267
+ * One durable event (DATA_MODEL §4). Its cursor is its stable ID and its place in the home-wide
268
+ * order; `seq` orders an artifact's own events without gaps.
269
+ */
270
+ export interface EventRecord {
271
+ /** The event's stable ID and home-wide position. */
272
+ readonly cursor: Cursor;
273
+ /** The artifact, or `null` for a home-wide event. */
274
+ readonly artifactId: string | null;
275
+ /** The artifact's sequence number, or `null` for a home-wide event. */
276
+ readonly seq: number | null;
277
+ /** The type from DATA_MODEL §4's catalog. */
278
+ readonly type: string;
279
+ /** When it was appended. */
280
+ readonly at: string;
281
+ /** Who caused it. */
282
+ readonly actor: Actor;
283
+ /** What caused it: a run, a mutation, a submission. */
284
+ readonly causation?: Readonly<Record<string, string>>;
285
+ /** The event's data; sensitive field values are redacted (D52). */
286
+ readonly payload: Readonly<Record<string, unknown>>;
287
+ }
288
+
289
+ /** The Zod schema of the `EventRecord` type. */
290
+ export const EventRecord: z.ZodType<EventRecord> = z
291
+ .object({
292
+ cursor: Cursor.schema,
293
+ artifactId: ArtifactId.schema.nullable(),
294
+ seq: z.int().min(1).nullable(),
295
+ type: z.string(),
296
+ at: z.iso.datetime(),
297
+ actor: Actor,
298
+ causation: z.record(z.string(), z.string()).exactOptional(),
299
+ payload: z.record(z.string(), z.unknown()),
300
+ })
301
+ .register(wireRegistry, {
302
+ id: "EventRecord",
303
+ description:
304
+ "One durable event: cursor, artifact, per-artifact sequence, type, time, actor, payload.",
305
+ }) as z.ZodType<EventRecord>;
306
+
307
+ /**
308
+ * An event type, or a family of them: `submission.created`, or `submission.*` for every type that
309
+ * starts with `submission.`.
310
+ */
311
+ export type EventTypePattern = string;
312
+
313
+ /** The Zod schema of the `EventTypePattern` type. */
314
+ export const EventTypePattern: z.ZodType<EventTypePattern> = z
315
+ .string()
316
+ .regex(/^[a-z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9_-]+)*(\.\*)?$/)
317
+ .register(wireRegistry, {
318
+ id: "EventTypePattern",
319
+ description: "An event type (submission.created) or a family of them (submission.*).",
320
+ });
321
+
322
+ /**
323
+ * Which events a reader wants (IN-08, H-09). Both parts are optional, and an event must pass both.
324
+ * `artifact.compacted` always passes for a matching artifact, so a filtered reader still learns of
325
+ * a compaction (DATA_MODEL §4).
326
+ */
327
+ export interface EventFilter {
328
+ /** Only these artifacts' events; absent: every artifact's, and home-wide ones. */
329
+ readonly artifacts?: readonly string[];
330
+ /** Only these types; absent: every type. */
331
+ readonly types?: readonly EventTypePattern[];
332
+ }
333
+
334
+ /** The Zod schema of the `EventFilter` type. */
335
+ export const EventFilter: z.ZodType<EventFilter> = z
336
+ .object({
337
+ artifacts: z.array(ArtifactId.schema).max(1000).readonly().exactOptional(),
338
+ types: z.array(EventTypePattern).max(100).readonly().exactOptional(),
339
+ })
340
+ .register(wireRegistry, {
341
+ id: "EventFilter",
342
+ description:
343
+ "Which events a reader wants: these artifacts' and these types (patterns allowed).",
344
+ });
345
+
346
+ /**
347
+ * What `wait` waits for (ARCHITECTURE §6, D103): `submitted`, `signal:<name>`, `state:<fieldId>`
348
+ * or `event:<type pattern>`.
349
+ */
350
+ export type WaitCondition = string;
351
+
352
+ /** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */
353
+ export const SIGNAL_NAME_PATTERN: RegExp = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
354
+
355
+ /** The Zod schema of the `WaitCondition` type. */
356
+ export const WaitCondition: z.ZodType<WaitCondition> = z
357
+ .string()
358
+ .regex(
359
+ // biome-ignore lint/suspicious/noControlCharactersInRegex: field IDs exclude control characters.
360
+ /^(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\u0000-\u001f\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9_-]+)*(\.\*)?)$/,
361
+ )
362
+ .register(wireRegistry, {
363
+ id: "WaitCondition",
364
+ description: "What wait waits for: submitted, signal:<name>, state:<fieldId> or event:<type>.",
365
+ });
366
+
367
+ // ── Submissions, deliveries and results ──────────────────────────────────────────────────
368
+
369
+ /** A delivery's state (FAILURE_MODEL §4). */
370
+ export type DeliveryState = "pending" | "delivered" | "rejected" | "undeliverable";
371
+
372
+ /** One submission's delivery to one host (D105). */
373
+ export interface DeliveryStatus {
374
+ /** The delivery's stable ID (`dlv_`), repeated by every redelivery. */
375
+ readonly deliveryId: string;
376
+ /**
377
+ * The host: its client name. Empty for Mostra's built-in adapter, which takes submissions when no
378
+ * host does; client names are never empty, so no host can be mistaken for it (D105).
379
+ */
380
+ readonly owner: string;
381
+ /** Where the delivery stands. */
382
+ readonly state: DeliveryState;
383
+ /** How many times Mostra called the host for it. */
384
+ readonly attempts: number;
385
+ /** The host's reason, for a rejection. */
386
+ readonly reason?: string;
387
+ /**
388
+ * `true` while a pending delivery waits: its host isn't connected, or an attempt failed and it
389
+ * will be retried (D47's "Pending delivery"). Absent while the first attempt is under way.
390
+ */
391
+ readonly waiting?: true;
392
+ /** When its state last changed. */
393
+ readonly updatedAt: string;
394
+ }
395
+
396
+ /** The Zod schema of the `DeliveryStatus` type. */
397
+ export const DeliveryStatus: z.ZodType<DeliveryStatus> = z
398
+ .object({
399
+ deliveryId: DeliveryId.schema,
400
+ owner: z.string(),
401
+ state: z.enum(["pending", "delivered", "rejected", "undeliverable"]),
402
+ attempts: z.int().min(0),
403
+ reason: z.string().exactOptional(),
404
+ waiting: z.literal(true).exactOptional(),
405
+ updatedAt: z.iso.datetime(),
406
+ })
407
+ .register(wireRegistry, {
408
+ id: "DeliveryStatus",
409
+ description: "One submission's delivery to one host: owner, state, attempts and reason.",
410
+ });
411
+
412
+ /** A submission as a submit answers it (INTERFACES §4). */
413
+ export interface SubmissionSummary {
414
+ /** The submission's ID. */
415
+ readonly id: string;
416
+ /** When it was made. */
417
+ readonly at: string;
418
+ /** The draft epoch it closed (D103); 1 outside `epochs`. */
419
+ readonly epoch: number;
420
+ /** Where the submit came from (D40). */
421
+ readonly channel: SubmitChannel;
422
+ /** The version the view showed. */
423
+ readonly versionId: string;
424
+ /** That version's number. */
425
+ readonly version: number;
426
+ /** The view it was made from. */
427
+ readonly viewId: string;
428
+ /** Whether a newer version existed when the viewer submitted (H-10). */
429
+ readonly staleView: boolean;
430
+ /** The draft revision it was made from. */
431
+ readonly draftRevision: DocumentRevision;
432
+ /** SHA-256 of the snapshot's canonical JSON (RFC 8785), lowercase hex. */
433
+ readonly digest: string;
434
+ /** Every delivery's state, summed up: the worst of them. */
435
+ readonly delivery: DeliveryState;
436
+ /** Each host's delivery, so a viewer sees which host has it (IN-13). */
437
+ readonly deliveries?: readonly DeliveryStatus[];
438
+ /** `true` when this submit repeated an earlier one and got it back (D22). */
439
+ readonly duplicate?: true;
440
+ }
441
+
442
+ /** The Zod schema of the `SubmissionSummary` type. */
443
+ export const SubmissionSummary: z.ZodType<SubmissionSummary> = z
444
+ .object({
445
+ id: SubmissionId.schema,
446
+ at: z.iso.datetime(),
447
+ epoch: z.int().min(1),
448
+ channel: z.enum(["shell", "artifact"]),
449
+ versionId: VersionId.schema,
450
+ version: z.int().min(1),
451
+ viewId: ViewId.schema,
452
+ staleView: z.boolean(),
453
+ draftRevision: DocumentRevision,
454
+ digest: z.string().regex(/^[0-9a-f]{64}$/),
455
+ delivery: z.enum(["pending", "delivered", "rejected", "undeliverable"]),
456
+ deliveries: z.array(DeliveryStatus).readonly().exactOptional(),
457
+ duplicate: z.literal(true).exactOptional(),
458
+ })
459
+ .register(wireRegistry, {
460
+ id: "SubmissionSummary",
461
+ description:
462
+ "A submission as a submit answers it: ID, time, epoch, version, view, digest, delivery.",
463
+ });
464
+
465
+ /** A rectangle in CSS pixels, relative to its frame. */
466
+ export interface Rect {
467
+ /** Distance from the frame's left edge. */
468
+ readonly x: number;
469
+ /** Distance from the frame's top edge. */
470
+ readonly y: number;
471
+ /** Width. */
472
+ readonly width: number;
473
+ /** Height. */
474
+ readonly height: number;
475
+ }
476
+
477
+ /** A viewport: its size in CSS pixels and its device pixel ratio. */
478
+ export interface Viewport {
479
+ /** Width in CSS pixels. */
480
+ readonly width: number;
481
+ /** Height in CSS pixels. */
482
+ readonly height: number;
483
+ /** Device pixel ratio. */
484
+ readonly dpr: number;
485
+ }
486
+
487
+ /** One comment thread in results (INTERFACES §8; built by the review layer, WP-20). */
488
+ export interface ResultComment {
489
+ /** The thread's ID. */
490
+ readonly threadId: string;
491
+ /** Whether the thread is open or resolved. */
492
+ readonly status: "open" | "resolved";
493
+ /** The thread's messages, oldest first, each with its author. */
494
+ readonly messages: readonly {
495
+ readonly author: Viewer;
496
+ readonly at: string;
497
+ readonly text: string;
498
+ }[];
499
+ /** Every layer of the anchor that applies (D23). */
500
+ readonly anchor: {
501
+ readonly reviewId?: string;
502
+ /** W3C Web Annotation selectors. */
503
+ readonly selectors?: readonly unknown[];
504
+ readonly rect?: Rect;
505
+ readonly viewport?: Viewport;
506
+ readonly page?: string;
507
+ readonly candidateId?: string;
508
+ readonly terminal?: {
509
+ readonly rows: readonly [number, number];
510
+ readonly cols: readonly [number, number];
511
+ readonly t?: number;
512
+ };
513
+ readonly time?: number;
514
+ readonly slide?: { readonly index: number; readonly step: number };
515
+ };
516
+ /** The screenshot crop, always stored (D23). */
517
+ readonly crop: { readonly path: string; readonly width: number; readonly height: number };
518
+ }
519
+
520
+ /**
521
+ * The complete submission (INTERFACES §8): what `results/get`, `mostra results` and the
522
+ * submissions port carry. Everything in it comes from the immutable submission and the version it
523
+ * names, never from the live draft (IN-06).
524
+ */
525
+ export interface Results {
526
+ /** The artifact, with the metadata of the version the viewer saw. */
527
+ readonly artifact: {
528
+ readonly id: string;
529
+ readonly title: string;
530
+ readonly description?: string;
531
+ readonly family?: string;
532
+ readonly links: readonly ArtifactLink[];
533
+ };
534
+ /** The submission's facts: when, how, by whom, from which version and view, and its delivery. */
535
+ readonly submission: {
536
+ readonly id: string;
537
+ readonly at: string;
538
+ readonly epoch: number;
539
+ /** The same viewer's previous submission, under `epochs` (D103). */
540
+ readonly previous?: string;
541
+ readonly policy: SubmissionPolicy;
542
+ readonly channel: SubmitChannel;
543
+ readonly viewer: Viewer;
544
+ readonly versionId: string;
545
+ readonly version: number;
546
+ readonly viewId: string;
547
+ /** Whether a newer version existed when the viewer submitted (H-10). */
548
+ readonly staleView: boolean;
549
+ /** The newest version's number at the time, when the view was stale. */
550
+ readonly latestVersion?: number;
551
+ readonly draftRevision: DocumentRevision;
552
+ readonly stateRevision?: DocumentRevision;
553
+ readonly digest: string;
554
+ readonly delivery: DeliveryState;
555
+ readonly deliveries: readonly DeliveryStatus[];
556
+ };
557
+ /** The draft's fields by ID, dotted IDs nested (D52). */
558
+ readonly answers: Readonly<Record<string, unknown>>;
559
+ /** Every field in `answers` and `state`, with its label and scope. */
560
+ readonly fields: readonly {
561
+ readonly id: string;
562
+ readonly label?: string;
563
+ readonly required?: boolean;
564
+ readonly sensitive?: boolean;
565
+ readonly scope: FieldScope;
566
+ }[];
567
+ /** Artifact state at `stateRevision`, dotted IDs nested (D63). */
568
+ readonly state?: Readonly<Record<string, unknown>>;
569
+ /** The review sets' choices: the fields `review.<set>.choice` (D65). */
570
+ readonly choices: readonly {
571
+ readonly reviewSetId: string;
572
+ readonly candidateId: string;
573
+ readonly label?: string;
574
+ }[];
575
+ /** Comment threads with their anchors and crops (WP-20). */
576
+ readonly comments: readonly ResultComment[];
577
+ /** Answers a newer version couldn't map (D42). */
578
+ readonly orphaned: readonly {
579
+ readonly id: string;
580
+ readonly label?: string;
581
+ readonly value: unknown;
582
+ readonly fromVersion: number;
583
+ }[];
584
+ /** Action runs started in this view (WP-08). */
585
+ readonly actions: readonly {
586
+ readonly runId: string;
587
+ readonly action: string;
588
+ readonly status: string;
589
+ readonly at: string;
590
+ }[];
591
+ /** Signals raised in this view before the submission: the newest 100, within 1 MiB of payloads. */
592
+ readonly signals: readonly {
593
+ readonly name: string;
594
+ readonly at: string;
595
+ readonly payload?: unknown;
596
+ }[];
597
+ /** How many older signals of the view the limit left out; absent when none. */
598
+ readonly signalsOmitted?: number;
599
+ /** Set when compaction removed events of this view before it submitted, so signals may be missing. */
600
+ readonly signalsCompacted?: true;
601
+ }
602
+
603
+ const RectSchema = z.object({
604
+ x: z.number(),
605
+ y: z.number(),
606
+ width: z.number(),
607
+ height: z.number(),
608
+ });
609
+
610
+ /** The Zod schema of the `ResultComment` type. */
611
+ export const ResultComment: z.ZodType<ResultComment> = z
612
+ .object({
613
+ threadId: z.string(),
614
+ status: z.enum(["open", "resolved"]),
615
+ messages: z
616
+ .array(z.object({ author: Viewer, at: z.iso.datetime(), text: z.string() }))
617
+ .readonly(),
618
+ anchor: z.object({
619
+ reviewId: z.string().exactOptional(),
620
+ selectors: z.array(z.unknown()).readonly().exactOptional(),
621
+ rect: RectSchema.exactOptional(),
622
+ viewport: z
623
+ .object({ width: z.number(), height: z.number(), dpr: z.number() })
624
+ .exactOptional(),
625
+ page: z.string().exactOptional(),
626
+ candidateId: z.string().exactOptional(),
627
+ terminal: z
628
+ .object({
629
+ rows: z.tuple([z.int(), z.int()]).readonly(),
630
+ cols: z.tuple([z.int(), z.int()]).readonly(),
631
+ t: z.number().exactOptional(),
632
+ })
633
+ .exactOptional(),
634
+ time: z.number().exactOptional(),
635
+ slide: z.object({ index: z.int(), step: z.int() }).exactOptional(),
636
+ }),
637
+ crop: z.object({ path: z.string(), width: z.int(), height: z.int() }),
638
+ })
639
+ .register(wireRegistry, {
640
+ id: "ResultComment",
641
+ description: "One comment thread in results: messages, anchor layers and the screenshot crop.",
642
+ }) as z.ZodType<ResultComment>;
643
+
644
+ /** The Zod schema of the `Results` type. */
645
+ export const Results: z.ZodType<Results> = z
646
+ .object({
647
+ artifact: z.object({
648
+ id: ArtifactId.schema,
649
+ title: z.string(),
650
+ description: z.string().exactOptional(),
651
+ family: z.string().exactOptional(),
652
+ links: z.array(ArtifactLink).readonly(),
653
+ }),
654
+ submission: z.object({
655
+ id: SubmissionId.schema,
656
+ at: z.iso.datetime(),
657
+ epoch: z.int().min(1),
658
+ previous: SubmissionId.schema.exactOptional(),
659
+ policy: SubmissionPolicy,
660
+ channel: z.enum(["shell", "artifact"]),
661
+ viewer: Viewer,
662
+ versionId: VersionId.schema,
663
+ version: z.int().min(1),
664
+ viewId: ViewId.schema,
665
+ staleView: z.boolean(),
666
+ latestVersion: z.int().min(1).exactOptional(),
667
+ draftRevision: DocumentRevision,
668
+ stateRevision: DocumentRevision.exactOptional(),
669
+ digest: z.string().regex(/^[0-9a-f]{64}$/),
670
+ delivery: z.enum(["pending", "delivered", "rejected", "undeliverable"]),
671
+ deliveries: z.array(DeliveryStatus).readonly(),
672
+ }),
673
+ answers: z.record(z.string(), z.unknown()),
674
+ fields: z
675
+ .array(
676
+ z.object({
677
+ id: z.string(),
678
+ label: z.string().exactOptional(),
679
+ required: z.boolean().exactOptional(),
680
+ sensitive: z.boolean().exactOptional(),
681
+ scope: z.enum(["viewer", "artifact"]),
682
+ }),
683
+ )
684
+ .readonly(),
685
+ state: z.record(z.string(), z.unknown()).exactOptional(),
686
+ choices: z
687
+ .array(
688
+ z.object({
689
+ reviewSetId: z.string(),
690
+ candidateId: z.string(),
691
+ label: z.string().exactOptional(),
692
+ }),
693
+ )
694
+ .readonly(),
695
+ comments: z.array(ResultComment).readonly(),
696
+ orphaned: z
697
+ .array(
698
+ z.object({
699
+ id: z.string(),
700
+ label: z.string().exactOptional(),
701
+ value: z.unknown(),
702
+ fromVersion: z.int().min(1),
703
+ }),
704
+ )
705
+ .readonly(),
706
+ actions: z
707
+ .array(
708
+ z.object({
709
+ runId: z.string(),
710
+ action: z.string(),
711
+ status: z.string(),
712
+ at: z.iso.datetime(),
713
+ }),
714
+ )
715
+ .readonly(),
716
+ signals: z
717
+ .array(
718
+ z.object({ name: z.string(), at: z.iso.datetime(), payload: z.unknown().exactOptional() }),
719
+ )
720
+ .readonly(),
721
+ signalsOmitted: z.int().min(1).exactOptional(),
722
+ signalsCompacted: z.literal(true).exactOptional(),
723
+ })
724
+ .register(wireRegistry, {
725
+ id: "Results",
726
+ description:
727
+ "The complete submission: artifact, submission facts, answers, fields, state, choices, comments, orphans, actions, signals.",
728
+ }) as z.ZodType<Results>;