@mostra/protocol 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (439) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +38 -2
  3. package/dist/actions.d.ts +273 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +154 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/artifact.d.ts +113 -0
  8. package/dist/artifact.d.ts.map +1 -0
  9. package/dist/artifact.js +79 -0
  10. package/dist/artifact.js.map +1 -0
  11. package/dist/bridge.d.ts +295 -0
  12. package/dist/bridge.d.ts.map +1 -0
  13. package/dist/bridge.js +343 -0
  14. package/dist/bridge.js.map +1 -0
  15. package/dist/browser.d.ts +195 -0
  16. package/dist/browser.d.ts.map +1 -0
  17. package/dist/browser.js +156 -0
  18. package/dist/browser.js.map +1 -0
  19. package/dist/bundle.d.ts +155 -0
  20. package/dist/bundle.d.ts.map +1 -0
  21. package/dist/bundle.js +130 -0
  22. package/dist/bundle.js.map +1 -0
  23. package/dist/canonical.d.ts +23 -0
  24. package/dist/canonical.d.ts.map +1 -0
  25. package/dist/canonical.js +45 -0
  26. package/dist/canonical.js.map +1 -0
  27. package/dist/capability.d.ts +38 -0
  28. package/dist/capability.d.ts.map +1 -0
  29. package/dist/capability.js +61 -0
  30. package/dist/capability.js.map +1 -0
  31. package/dist/diagnostics/codes/a11y.d.ts +8 -0
  32. package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
  33. package/dist/diagnostics/codes/a11y.js +30 -0
  34. package/dist/diagnostics/codes/a11y.js.map +1 -0
  35. package/dist/diagnostics/codes/action.d.ts +8 -0
  36. package/dist/diagnostics/codes/action.d.ts.map +1 -0
  37. package/dist/diagnostics/codes/action.js +110 -0
  38. package/dist/diagnostics/codes/action.js.map +1 -0
  39. package/dist/diagnostics/codes/artifact.d.ts +8 -0
  40. package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
  41. package/dist/diagnostics/codes/artifact.js +121 -0
  42. package/dist/diagnostics/codes/artifact.js.map +1 -0
  43. package/dist/diagnostics/codes/build.d.ts +8 -0
  44. package/dist/diagnostics/codes/build.d.ts.map +1 -0
  45. package/dist/diagnostics/codes/build.js +55 -0
  46. package/dist/diagnostics/codes/build.js.map +1 -0
  47. package/dist/diagnostics/codes/cli.d.ts +8 -0
  48. package/dist/diagnostics/codes/cli.d.ts.map +1 -0
  49. package/dist/diagnostics/codes/cli.js +44 -0
  50. package/dist/diagnostics/codes/cli.js.map +1 -0
  51. package/dist/diagnostics/codes/console.d.ts +8 -0
  52. package/dist/diagnostics/codes/console.d.ts.map +1 -0
  53. package/dist/diagnostics/codes/console.js +30 -0
  54. package/dist/diagnostics/codes/console.js.map +1 -0
  55. package/dist/diagnostics/codes/dep.d.ts +8 -0
  56. package/dist/diagnostics/codes/dep.d.ts.map +1 -0
  57. package/dist/diagnostics/codes/dep.js +88 -0
  58. package/dist/diagnostics/codes/dep.js.map +1 -0
  59. package/dist/diagnostics/codes/env.d.ts +8 -0
  60. package/dist/diagnostics/codes/env.d.ts.map +1 -0
  61. package/dist/diagnostics/codes/env.js +132 -0
  62. package/dist/diagnostics/codes/env.js.map +1 -0
  63. package/dist/diagnostics/codes/field.d.ts +8 -0
  64. package/dist/diagnostics/codes/field.d.ts.map +1 -0
  65. package/dist/diagnostics/codes/field.js +99 -0
  66. package/dist/diagnostics/codes/field.js.map +1 -0
  67. package/dist/diagnostics/codes/home.d.ts +8 -0
  68. package/dist/diagnostics/codes/home.d.ts.map +1 -0
  69. package/dist/diagnostics/codes/home.js +132 -0
  70. package/dist/diagnostics/codes/home.js.map +1 -0
  71. package/dist/diagnostics/codes/host.d.ts +8 -0
  72. package/dist/diagnostics/codes/host.d.ts.map +1 -0
  73. package/dist/diagnostics/codes/host.js +176 -0
  74. package/dist/diagnostics/codes/host.js.map +1 -0
  75. package/dist/diagnostics/codes/hygiene.d.ts +8 -0
  76. package/dist/diagnostics/codes/hygiene.d.ts.map +1 -0
  77. package/dist/diagnostics/codes/hygiene.js +154 -0
  78. package/dist/diagnostics/codes/hygiene.js.map +1 -0
  79. package/dist/diagnostics/codes/index.d.ts +51 -0
  80. package/dist/diagnostics/codes/index.d.ts.map +1 -0
  81. package/dist/diagnostics/codes/index.js +72 -0
  82. package/dist/diagnostics/codes/index.js.map +1 -0
  83. package/dist/diagnostics/codes/live.d.ts +8 -0
  84. package/dist/diagnostics/codes/live.d.ts.map +1 -0
  85. package/dist/diagnostics/codes/live.js +30 -0
  86. package/dist/diagnostics/codes/live.js.map +1 -0
  87. package/dist/diagnostics/codes/manifest.d.ts +8 -0
  88. package/dist/diagnostics/codes/manifest.d.ts.map +1 -0
  89. package/dist/diagnostics/codes/manifest.js +44 -0
  90. package/dist/diagnostics/codes/manifest.js.map +1 -0
  91. package/dist/diagnostics/codes/network.d.ts +8 -0
  92. package/dist/diagnostics/codes/network.d.ts.map +1 -0
  93. package/dist/diagnostics/codes/network.js +30 -0
  94. package/dist/diagnostics/codes/network.js.map +1 -0
  95. package/dist/diagnostics/codes/platform.d.ts +8 -0
  96. package/dist/diagnostics/codes/platform.d.ts.map +1 -0
  97. package/dist/diagnostics/codes/platform.js +18 -0
  98. package/dist/diagnostics/codes/platform.js.map +1 -0
  99. package/dist/diagnostics/codes/publish.d.ts +8 -0
  100. package/dist/diagnostics/codes/publish.d.ts.map +1 -0
  101. package/dist/diagnostics/codes/publish.js +44 -0
  102. package/dist/diagnostics/codes/publish.js.map +1 -0
  103. package/dist/diagnostics/codes/regression.d.ts +8 -0
  104. package/dist/diagnostics/codes/regression.d.ts.map +1 -0
  105. package/dist/diagnostics/codes/regression.js +77 -0
  106. package/dist/diagnostics/codes/regression.js.map +1 -0
  107. package/dist/diagnostics/codes/runtime.d.ts +8 -0
  108. package/dist/diagnostics/codes/runtime.d.ts.map +1 -0
  109. package/dist/diagnostics/codes/runtime.js +66 -0
  110. package/dist/diagnostics/codes/runtime.js.map +1 -0
  111. package/dist/diagnostics/codes/secret.d.ts +8 -0
  112. package/dist/diagnostics/codes/secret.d.ts.map +1 -0
  113. package/dist/diagnostics/codes/secret.js +18 -0
  114. package/dist/diagnostics/codes/secret.js.map +1 -0
  115. package/dist/diagnostics/codes/smoke.d.ts +8 -0
  116. package/dist/diagnostics/codes/smoke.d.ts.map +1 -0
  117. package/dist/diagnostics/codes/smoke.js +30 -0
  118. package/dist/diagnostics/codes/smoke.js.map +1 -0
  119. package/dist/diagnostics/codes/submit.d.ts +8 -0
  120. package/dist/diagnostics/codes/submit.d.ts.map +1 -0
  121. package/dist/diagnostics/codes/submit.js +99 -0
  122. package/dist/diagnostics/codes/submit.js.map +1 -0
  123. package/dist/diagnostics/codes/target.d.ts +8 -0
  124. package/dist/diagnostics/codes/target.d.ts.map +1 -0
  125. package/dist/diagnostics/codes/target.js +18 -0
  126. package/dist/diagnostics/codes/target.js.map +1 -0
  127. package/dist/diagnostics/codes/type.d.ts +8 -0
  128. package/dist/diagnostics/codes/type.d.ts.map +1 -0
  129. package/dist/diagnostics/codes/type.js +30 -0
  130. package/dist/diagnostics/codes/type.js.map +1 -0
  131. package/dist/diagnostics/codes/verify.d.ts +8 -0
  132. package/dist/diagnostics/codes/verify.d.ts.map +1 -0
  133. package/dist/diagnostics/codes/verify.js +99 -0
  134. package/dist/diagnostics/codes/verify.js.map +1 -0
  135. package/dist/diagnostics/diagnostic.d.ts +79 -0
  136. package/dist/diagnostics/diagnostic.d.ts.map +1 -0
  137. package/dist/diagnostics/diagnostic.js +131 -0
  138. package/dist/diagnostics/diagnostic.js.map +1 -0
  139. package/dist/diagnostics/spec.d.ts +49 -0
  140. package/dist/diagnostics/spec.d.ts.map +1 -0
  141. package/dist/diagnostics/spec.js +31 -0
  142. package/dist/diagnostics/spec.js.map +1 -0
  143. package/dist/hygiene.d.ts +66 -0
  144. package/dist/hygiene.d.ts.map +1 -0
  145. package/dist/hygiene.js +134 -0
  146. package/dist/hygiene.js.map +1 -0
  147. package/dist/ids.d.ts +119 -0
  148. package/dist/ids.d.ts.map +1 -0
  149. package/dist/ids.js +135 -0
  150. package/dist/ids.js.map +1 -0
  151. package/dist/index.d.ts +86 -0
  152. package/dist/index.js +86 -0
  153. package/dist/interaction.d.ts +391 -0
  154. package/dist/interaction.d.ts.map +1 -0
  155. package/dist/interaction.js +306 -0
  156. package/dist/interaction.js.map +1 -0
  157. package/dist/manifest.d.ts +97 -0
  158. package/dist/manifest.d.ts.map +1 -0
  159. package/dist/manifest.js +101 -0
  160. package/dist/manifest.js.map +1 -0
  161. package/dist/method.d.ts +26 -0
  162. package/dist/method.d.ts.map +1 -0
  163. package/dist/method.js +10 -0
  164. package/dist/method.js.map +1 -0
  165. package/dist/methods/artifact/create.d.ts +29 -0
  166. package/dist/methods/artifact/create.d.ts.map +1 -0
  167. package/dist/methods/artifact/create.js +31 -0
  168. package/dist/methods/artifact/create.js.map +1 -0
  169. package/dist/methods/artifact/get.d.ts +17 -0
  170. package/dist/methods/artifact/get.d.ts.map +1 -0
  171. package/dist/methods/artifact/get.js +21 -0
  172. package/dist/methods/artifact/get.js.map +1 -0
  173. package/dist/methods/artifact/list.d.ts +22 -0
  174. package/dist/methods/artifact/list.d.ts.map +1 -0
  175. package/dist/methods/artifact/list.js +19 -0
  176. package/dist/methods/artifact/list.js.map +1 -0
  177. package/dist/methods/artifact/publish.d.ts +28 -0
  178. package/dist/methods/artifact/publish.d.ts.map +1 -0
  179. package/dist/methods/artifact/publish.js +28 -0
  180. package/dist/methods/artifact/publish.js.map +1 -0
  181. package/dist/methods/artifact/verify.d.ts +29 -0
  182. package/dist/methods/artifact/verify.d.ts.map +1 -0
  183. package/dist/methods/artifact/verify.js +27 -0
  184. package/dist/methods/artifact/verify.js.map +1 -0
  185. package/dist/methods/deps/add.d.ts +43 -0
  186. package/dist/methods/deps/add.d.ts.map +1 -0
  187. package/dist/methods/deps/add.js +40 -0
  188. package/dist/methods/deps/add.js.map +1 -0
  189. package/dist/methods/dev/start.d.ts +52 -0
  190. package/dist/methods/dev/start.d.ts.map +1 -0
  191. package/dist/methods/dev/start.js +56 -0
  192. package/dist/methods/dev/start.js.map +1 -0
  193. package/dist/methods/dev/stop.d.ts +16 -0
  194. package/dist/methods/dev/stop.d.ts.map +1 -0
  195. package/dist/methods/dev/stop.js +21 -0
  196. package/dist/methods/dev/stop.js.map +1 -0
  197. package/dist/methods/events/ack.d.ts +20 -0
  198. package/dist/methods/events/ack.d.ts.map +1 -0
  199. package/dist/methods/events/ack.js +26 -0
  200. package/dist/methods/events/ack.js.map +1 -0
  201. package/dist/methods/events/read.d.ts +40 -0
  202. package/dist/methods/events/read.d.ts.map +1 -0
  203. package/dist/methods/events/read.js +35 -0
  204. package/dist/methods/events/read.js.map +1 -0
  205. package/dist/methods/events/subscribe.d.ts +54 -0
  206. package/dist/methods/events/subscribe.d.ts.map +1 -0
  207. package/dist/methods/events/subscribe.js +44 -0
  208. package/dist/methods/events/subscribe.js.map +1 -0
  209. package/dist/methods/events/unsubscribe.d.ts +16 -0
  210. package/dist/methods/events/unsubscribe.d.ts.map +1 -0
  211. package/dist/methods/events/unsubscribe.js +21 -0
  212. package/dist/methods/events/unsubscribe.js.map +1 -0
  213. package/dist/methods/gc/run.d.ts +76 -0
  214. package/dist/methods/gc/run.d.ts.map +1 -0
  215. package/dist/methods/gc/run.js +56 -0
  216. package/dist/methods/gc/run.js.map +1 -0
  217. package/dist/methods/index.d.ts +6 -0
  218. package/dist/methods/index.d.ts.map +1 -0
  219. package/dist/methods/index.js +78 -0
  220. package/dist/methods/index.js.map +1 -0
  221. package/dist/methods/instance/check.d.ts +30 -0
  222. package/dist/methods/instance/check.d.ts.map +1 -0
  223. package/dist/methods/instance/check.js +34 -0
  224. package/dist/methods/instance/check.js.map +1 -0
  225. package/dist/methods/instance/status.d.ts +102 -0
  226. package/dist/methods/instance/status.d.ts.map +1 -0
  227. package/dist/methods/instance/status.js +83 -0
  228. package/dist/methods/instance/status.js.map +1 -0
  229. package/dist/methods/live/push.d.ts +28 -0
  230. package/dist/methods/live/push.d.ts.map +1 -0
  231. package/dist/methods/live/push.js +35 -0
  232. package/dist/methods/live/push.js.map +1 -0
  233. package/dist/methods/mostra/initialize.d.ts +143 -0
  234. package/dist/methods/mostra/initialize.d.ts.map +1 -0
  235. package/dist/methods/mostra/initialize.js +97 -0
  236. package/dist/methods/mostra/initialize.js.map +1 -0
  237. package/dist/methods/mostra/shutdown.d.ts +14 -0
  238. package/dist/methods/mostra/shutdown.d.ts.map +1 -0
  239. package/dist/methods/mostra/shutdown.js +22 -0
  240. package/dist/methods/mostra/shutdown.js.map +1 -0
  241. package/dist/methods/port/drafts-mirror.d.ts +30 -0
  242. package/dist/methods/port/drafts-mirror.d.ts.map +1 -0
  243. package/dist/methods/port/drafts-mirror.js +33 -0
  244. package/dist/methods/port/drafts-mirror.js.map +1 -0
  245. package/dist/methods/port/secrets-get.d.ts +19 -0
  246. package/dist/methods/port/secrets-get.d.ts.map +1 -0
  247. package/dist/methods/port/secrets-get.js +31 -0
  248. package/dist/methods/port/secrets-get.js.map +1 -0
  249. package/dist/methods/port/submissions-deliver.d.ts +38 -0
  250. package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
  251. package/dist/methods/port/submissions-deliver.js +38 -0
  252. package/dist/methods/port/submissions-deliver.js.map +1 -0
  253. package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
  254. package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
  255. package/dist/methods/port/trusted-controls-activated.js +33 -0
  256. package/dist/methods/port/trusted-controls-activated.js.map +1 -0
  257. package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
  258. package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
  259. package/dist/methods/port/trusted-controls-policy.js +27 -0
  260. package/dist/methods/port/trusted-controls-policy.js.map +1 -0
  261. package/dist/methods/results/get.d.ts +32 -0
  262. package/dist/methods/results/get.d.ts.map +1 -0
  263. package/dist/methods/results/get.js +36 -0
  264. package/dist/methods/results/get.js.map +1 -0
  265. package/dist/methods/secret/delete.d.ts +22 -0
  266. package/dist/methods/secret/delete.d.ts.map +1 -0
  267. package/dist/methods/secret/delete.js +32 -0
  268. package/dist/methods/secret/delete.js.map +1 -0
  269. package/dist/methods/secret/list.d.ts +21 -0
  270. package/dist/methods/secret/list.d.ts.map +1 -0
  271. package/dist/methods/secret/list.js +29 -0
  272. package/dist/methods/secret/list.js.map +1 -0
  273. package/dist/methods/secret/set.d.ts +37 -0
  274. package/dist/methods/secret/set.d.ts.map +1 -0
  275. package/dist/methods/secret/set.js +41 -0
  276. package/dist/methods/secret/set.js.map +1 -0
  277. package/dist/methods/state/get.d.ts +25 -0
  278. package/dist/methods/state/get.d.ts.map +1 -0
  279. package/dist/methods/state/get.js +29 -0
  280. package/dist/methods/state/get.js.map +1 -0
  281. package/dist/methods/state/patch.d.ts +32 -0
  282. package/dist/methods/state/patch.d.ts.map +1 -0
  283. package/dist/methods/state/patch.js +29 -0
  284. package/dist/methods/state/patch.js.map +1 -0
  285. package/dist/methods/view/default.d.ts +19 -0
  286. package/dist/methods/view/default.d.ts.map +1 -0
  287. package/dist/methods/view/default.js +23 -0
  288. package/dist/methods/view/default.js.map +1 -0
  289. package/dist/methods/view/launch.d.ts +27 -0
  290. package/dist/methods/view/launch.d.ts.map +1 -0
  291. package/dist/methods/view/launch.js +30 -0
  292. package/dist/methods/view/launch.js.map +1 -0
  293. package/dist/methods/view/revoke.d.ts +19 -0
  294. package/dist/methods/view/revoke.d.ts.map +1 -0
  295. package/dist/methods/view/revoke.js +26 -0
  296. package/dist/methods/view/revoke.js.map +1 -0
  297. package/dist/methods/view/rotate.d.ts +21 -0
  298. package/dist/methods/view/rotate.d.ts.map +1 -0
  299. package/dist/methods/view/rotate.js +27 -0
  300. package/dist/methods/view/rotate.js.map +1 -0
  301. package/dist/methods/view/url.d.ts +52 -0
  302. package/dist/methods/view/url.d.ts.map +1 -0
  303. package/dist/methods/view/url.js +43 -0
  304. package/dist/methods/view/url.js.map +1 -0
  305. package/dist/methods/wait/wait.d.ts +37 -0
  306. package/dist/methods/wait/wait.d.ts.map +1 -0
  307. package/dist/methods/wait/wait.js +39 -0
  308. package/dist/methods/wait/wait.js.map +1 -0
  309. package/dist/revision.d.ts +43 -0
  310. package/dist/revision.d.ts.map +1 -0
  311. package/dist/revision.js +69 -0
  312. package/dist/revision.js.map +1 -0
  313. package/dist/rpc/error.d.ts +47 -0
  314. package/dist/rpc/error.d.ts.map +1 -0
  315. package/dist/rpc/error.js +77 -0
  316. package/dist/rpc/error.js.map +1 -0
  317. package/dist/rpc/lines.d.ts +30 -0
  318. package/dist/rpc/lines.d.ts.map +1 -0
  319. package/dist/rpc/lines.js +63 -0
  320. package/dist/rpc/lines.js.map +1 -0
  321. package/dist/rpc/messages.d.ts +92 -0
  322. package/dist/rpc/messages.d.ts.map +1 -0
  323. package/dist/rpc/messages.js +133 -0
  324. package/dist/rpc/messages.js.map +1 -0
  325. package/dist/rpc/peer.d.ts +81 -0
  326. package/dist/rpc/peer.d.ts.map +1 -0
  327. package/dist/rpc/peer.js +208 -0
  328. package/dist/rpc/peer.js.map +1 -0
  329. package/dist/serializer.d.ts +178 -0
  330. package/dist/serializer.d.ts.map +1 -0
  331. package/dist/serializer.js +929 -0
  332. package/dist/serializer.js.map +1 -0
  333. package/dist/verify.d.ts +254 -0
  334. package/dist/verify.d.ts.map +1 -0
  335. package/dist/verify.js +243 -0
  336. package/dist/verify.js.map +1 -0
  337. package/dist/view.d.ts +103 -0
  338. package/dist/view.d.ts.map +1 -0
  339. package/dist/view.js +110 -0
  340. package/dist/view.js.map +1 -0
  341. package/dist/wire-registry.js +11 -0
  342. package/dist/wire-registry.js.map +1 -0
  343. package/dist/worker.d.ts +249 -0
  344. package/dist/worker.d.ts.map +1 -0
  345. package/dist/worker.js +158 -0
  346. package/dist/worker.js.map +1 -0
  347. package/package.json +114 -3
  348. package/schemas/protocol.draft-07.json +5120 -0
  349. package/schemas/protocol.schema.json +4964 -0
  350. package/src/actions.ts +418 -0
  351. package/src/artifact.ts +187 -0
  352. package/src/bridge.ts +618 -0
  353. package/src/browser.ts +374 -0
  354. package/src/bundle.ts +264 -0
  355. package/src/canonical.ts +49 -0
  356. package/src/capability.ts +92 -0
  357. package/src/diagnostics/codes/a11y.ts +41 -0
  358. package/src/diagnostics/codes/action.ts +125 -0
  359. package/src/diagnostics/codes/artifact.ts +137 -0
  360. package/src/diagnostics/codes/build.ts +65 -0
  361. package/src/diagnostics/codes/cli.ts +53 -0
  362. package/src/diagnostics/codes/console.ts +41 -0
  363. package/src/diagnostics/codes/dep.ts +101 -0
  364. package/src/diagnostics/codes/env.ts +149 -0
  365. package/src/diagnostics/codes/field.ts +113 -0
  366. package/src/diagnostics/codes/home.ts +150 -0
  367. package/src/diagnostics/codes/host.ts +197 -0
  368. package/src/diagnostics/codes/hygiene.ts +175 -0
  369. package/src/diagnostics/codes/index.ts +142 -0
  370. package/src/diagnostics/codes/live.ts +41 -0
  371. package/src/diagnostics/codes/manifest.ts +53 -0
  372. package/src/diagnostics/codes/network.ts +41 -0
  373. package/src/diagnostics/codes/platform.ts +30 -0
  374. package/src/diagnostics/codes/publish.ts +53 -0
  375. package/src/diagnostics/codes/regression.ts +89 -0
  376. package/src/diagnostics/codes/runtime.ts +77 -0
  377. package/src/diagnostics/codes/secret.ts +29 -0
  378. package/src/diagnostics/codes/smoke.ts +41 -0
  379. package/src/diagnostics/codes/submit.ts +113 -0
  380. package/src/diagnostics/codes/target.ts +29 -0
  381. package/src/diagnostics/codes/type.ts +41 -0
  382. package/src/diagnostics/codes/verify.ts +113 -0
  383. package/src/diagnostics/diagnostic.ts +240 -0
  384. package/src/diagnostics/spec.ts +90 -0
  385. package/src/hygiene.ts +224 -0
  386. package/src/ids.ts +279 -0
  387. package/src/index.ts +576 -0
  388. package/src/interaction.ts +728 -0
  389. package/src/manifest.ts +206 -0
  390. package/src/method.ts +42 -0
  391. package/src/methods/artifact/create.ts +56 -0
  392. package/src/methods/artifact/get.ts +30 -0
  393. package/src/methods/artifact/list.ts +42 -0
  394. package/src/methods/artifact/publish.ts +46 -0
  395. package/src/methods/artifact/verify.ts +46 -0
  396. package/src/methods/deps/add.ts +72 -0
  397. package/src/methods/dev/start.ts +84 -0
  398. package/src/methods/dev/stop.ts +32 -0
  399. package/src/methods/events/ack.ts +41 -0
  400. package/src/methods/events/read.ts +67 -0
  401. package/src/methods/events/subscribe.ts +91 -0
  402. package/src/methods/events/unsubscribe.ts +35 -0
  403. package/src/methods/gc/run.ts +125 -0
  404. package/src/methods/index.ts +81 -0
  405. package/src/methods/instance/check.ts +61 -0
  406. package/src/methods/instance/status.ts +172 -0
  407. package/src/methods/live/push.ts +54 -0
  408. package/src/methods/mostra/initialize.ts +249 -0
  409. package/src/methods/mostra/shutdown.ts +31 -0
  410. package/src/methods/port/drafts-mirror.ts +52 -0
  411. package/src/methods/port/secrets-get.ts +40 -0
  412. package/src/methods/port/submissions-deliver.ts +70 -0
  413. package/src/methods/port/trusted-controls-activated.ts +51 -0
  414. package/src/methods/port/trusted-controls-policy.ts +38 -0
  415. package/src/methods/results/get.ts +59 -0
  416. package/src/methods/secret/delete.ts +43 -0
  417. package/src/methods/secret/list.ts +40 -0
  418. package/src/methods/secret/set.ts +69 -0
  419. package/src/methods/state/get.ts +44 -0
  420. package/src/methods/state/patch.ts +51 -0
  421. package/src/methods/view/default.ts +32 -0
  422. package/src/methods/view/launch.ts +47 -0
  423. package/src/methods/view/revoke.ts +39 -0
  424. package/src/methods/view/rotate.ts +37 -0
  425. package/src/methods/view/url.ts +84 -0
  426. package/src/methods/wait/wait.ts +58 -0
  427. package/src/revision.ts +101 -0
  428. package/src/rpc/error.ts +107 -0
  429. package/src/rpc/lines.ts +70 -0
  430. package/src/rpc/messages.ts +188 -0
  431. package/src/rpc/peer.ts +341 -0
  432. package/src/serializer.ts +1217 -0
  433. package/src/timers.d.ts +8 -0
  434. package/src/verify.ts +458 -0
  435. package/src/view.ts +200 -0
  436. package/src/web-crypto.d.ts +9 -0
  437. package/src/web-platform.d.ts +35 -0
  438. package/src/wire-registry.ts +14 -0
  439. package/src/worker.ts +374 -0
@@ -0,0 +1,35 @@
1
+ // The web-platform classes the serializer reads and writes (`FormData`, `Blob`, `File`) and
2
+ // `queueMicrotask`, present in browsers, workers and Node.js. Declared here, as far as the
3
+ // serializer uses them, so the package compiles without DOM or Node types.
4
+ declare global {
5
+ interface Blob {
6
+ readonly size: number;
7
+ readonly type: string;
8
+ arrayBuffer(): Promise<ArrayBuffer>;
9
+ }
10
+ var Blob: {
11
+ prototype: Blob;
12
+ new (parts?: readonly unknown[], options?: { type?: string }): Blob;
13
+ };
14
+ interface File extends Blob {
15
+ readonly name: string;
16
+ readonly lastModified: number;
17
+ }
18
+ var File: {
19
+ prototype: File;
20
+ new (
21
+ parts: readonly unknown[],
22
+ name: string,
23
+ options?: { type?: string; lastModified?: number },
24
+ ): File;
25
+ };
26
+ interface FormData {
27
+ append(name: string, value: string | Blob, filename?: string): void;
28
+ entries(): IterableIterator<[string, string | File]>;
29
+ }
30
+ var FormData: { prototype: FormData; new (): FormData };
31
+ var TextEncoder: { new (): { encode(text: string): Uint8Array } };
32
+ function queueMicrotask(callback: () => void): void;
33
+ }
34
+
35
+ export {};
@@ -0,0 +1,14 @@
1
+ import * as z from "zod";
2
+
3
+ /** Metadata for a wire schema that has a stable name in the published JSON Schema. */
4
+ export interface WireSchemaMeta {
5
+ /** The definition name in the published JSON Schema (`$defs`). Stable once released. */
6
+ readonly id: string;
7
+ readonly description?: string;
8
+ }
9
+
10
+ /**
11
+ * The registry of named wire schemas. It is private to this package (not Zod's global registry), so
12
+ * two copies of the package in one process never collide.
13
+ */
14
+ export const wireRegistry: z.core.$ZodRegistry<WireSchemaMeta> = z.registry<WireSchemaMeta>();
package/src/worker.ts ADDED
@@ -0,0 +1,374 @@
1
+ /**
2
+ * The worker channel (D124, ARCHITECTURE §7): JSON-RPC 2.0 between the supervisor and an artifact
3
+ * version's worker, over whatever the `WorkerLauncher` connects (a pipe for the local launcher, a
4
+ * socket for a launcher whose worker runs elsewhere). Every message is serializable, so a worker
5
+ * that runs as a separate process, or on another machine, fits without a change. Secrets reach a
6
+ * worker only as answers to its own `server/secret` requests, never through its environment.
7
+ *
8
+ * The supervisor validates everything a worker sends: a worker runs agent-authored code with full
9
+ * capability (D05), and a malformed message must never take the supervisor down.
10
+ */
11
+ import * as z from "zod";
12
+ import { ActionError, Batches, LIVE_KEY_PATTERN, type RunProgress } from "./actions.ts";
13
+ import type { MutationResult } from "./interaction.ts";
14
+ import { DocumentRevision, FieldOp } from "./interaction.ts";
15
+ import type { Frame, WireError } from "./serializer.ts";
16
+
17
+ /** The worker channel's revision, which a worker states in its `worker/start` answer. */
18
+ export const WORKER_CHANNEL_REVISION = "2026-10-16";
19
+
20
+ /** The limits a worker runs under (D62): stability, never security. */
21
+ export interface WorkerLimits {
22
+ /** The V8 old-space heap, in MiB (default 1024). */
23
+ readonly heapMb: number;
24
+ /** How long the event loop may be blocked before the worker is stopped, in ms (default 10 000). */
25
+ readonly watchdogMs: number;
26
+ /** Idle minutes before the worker is evicted (default 10). */
27
+ readonly idleMinutes: number;
28
+ }
29
+
30
+ /** The default limits (D62). */
31
+ export const DEFAULT_WORKER_LIMITS: WorkerLimits = {
32
+ heapMb: 1024,
33
+ watchdogMs: 10_000,
34
+ idleMinutes: 10,
35
+ };
36
+
37
+ /**
38
+ * Names a version for a launcher (D124): its ID, the digest of its build output, and where its
39
+ * portable bundle is. A local launcher resolves a `home:` locator to the version's directory in
40
+ * its home; a remote one fetches the bundle and checks the digest. Never a directory path.
41
+ */
42
+ export interface WorkerVersionRef {
43
+ /** The version. */
44
+ readonly versionId: string;
45
+ /** The SHA-256 of the version's build output (DATA_MODEL §2). */
46
+ readonly outputDigest: string;
47
+ /** `home:versions/<versionId>` for the home's own store; other schemes for other launchers. */
48
+ readonly locator: string;
49
+ }
50
+
51
+ /** The Zod schema of the `WorkerVersionRef` type. */
52
+ export const WorkerVersionRef: z.ZodType<WorkerVersionRef> = z.object({
53
+ versionId: z.string(),
54
+ outputDigest: z.string().regex(/^[0-9a-f]{64}$/),
55
+ locator: z.string().min(1),
56
+ });
57
+
58
+ /** Who a call runs for, as `@mostra/server` exposes it (`viewer()`, `dryRun()`). */
59
+ export interface CallContext {
60
+ /** `call`: a plain call. `run`: an action run. */
61
+ readonly kind: "call" | "run";
62
+ /** The run's `run_` ID. */
63
+ readonly runId?: string;
64
+ /** The view the page was opened as (D104). */
65
+ readonly viewId?: string;
66
+ /** The viewer, when there is one. */
67
+ readonly viewer?: { readonly id: string; readonly name?: string };
68
+ /** True only during `verify`'s smoke test (D55). */
69
+ readonly dryRun: boolean;
70
+ }
71
+
72
+ const CallContextSchema: z.ZodType<CallContext> = z.object({
73
+ kind: z.enum(["call", "run"]),
74
+ runId: z.string().exactOptional(),
75
+ viewId: z.string().exactOptional(),
76
+ viewer: z.object({ id: z.string(), name: z.string().exactOptional() }).exactOptional(),
77
+ dryRun: z.boolean(),
78
+ });
79
+
80
+ /** How a live source produces values, as the worker found it in `live.ts`. */
81
+ export interface LiveSourceInfo {
82
+ /** The live source's key. */
83
+ readonly key: string;
84
+ /** Whether it has a `load` function. */
85
+ readonly load: boolean;
86
+ /** The refresh interval, in ms. */
87
+ readonly refreshMs?: number;
88
+ /** The globs it watches. */
89
+ readonly watch?: readonly string[];
90
+ /** Whether it has a `stream` function. */
91
+ readonly stream: boolean;
92
+ /** Whether it runs without viewers (D63). */
93
+ readonly always: boolean;
94
+ /** How many values it keeps for append mode. */
95
+ readonly ring?: number;
96
+ }
97
+
98
+ const LiveSourceInfoSchema: z.ZodType<LiveSourceInfo> = z.object({
99
+ key: z.string().regex(LIVE_KEY_PATTERN),
100
+ load: z.boolean(),
101
+ refreshMs: z.int().min(1).exactOptional(),
102
+ watch: z.array(z.string()).readonly().exactOptional(),
103
+ stream: z.boolean(),
104
+ always: z.boolean(),
105
+ ring: z.int().min(1).exactOptional(),
106
+ });
107
+
108
+ // ── Supervisor → worker ────────────────────────────────────────────────────────────────────
109
+
110
+ /** `worker/start`: the first request; the worker loads the version's server bundle. */
111
+ export interface WorkerStartParams {
112
+ /** The artifact. */
113
+ readonly artifactId: string;
114
+ /** The version to load. */
115
+ readonly version: WorkerVersionRef;
116
+ /** The server bundle to load, relative to the version (the render mode's `serverEntry`, D19). */
117
+ readonly entry: string;
118
+ /** The limits it runs under. */
119
+ readonly limits: WorkerLimits;
120
+ }
121
+
122
+ /** What a started worker serves. */
123
+ export interface WorkerStartResult {
124
+ /** The value's revision. */
125
+ readonly revision: string;
126
+ /** The server function IDs of the version. */
127
+ readonly functions: readonly string[];
128
+ /** The live sources of `live.ts`. */
129
+ readonly live: readonly LiveSourceInfo[];
130
+ }
131
+
132
+ /** The Zod schema of the `WorkerStartResult` type (the supervisor checks the worker's answer). */
133
+ export const WorkerStartResult: z.ZodType<WorkerStartResult> = z.object({
134
+ revision: z.string(),
135
+ functions: z.array(z.string()).readonly(),
136
+ live: z.array(LiveSourceInfoSchema).readonly(),
137
+ });
138
+
139
+ /** The Zod schema of the `WorkerStartParams` type. */
140
+ export const WorkerStartParams: z.ZodType<WorkerStartParams> = z.object({
141
+ artifactId: z.string(),
142
+ version: WorkerVersionRef,
143
+ entry: z.string().min(1),
144
+ limits: z.object({
145
+ heapMb: z.int().min(16),
146
+ watchdogMs: z.int().min(100),
147
+ idleMinutes: z.number().min(0),
148
+ }),
149
+ });
150
+
151
+ /**
152
+ * `worker/call`: runs a server function. Its result streams as `worker/batch` notifications
153
+ * before the answer, which says how it ended.
154
+ */
155
+ export interface WorkerCallParams {
156
+ /** Unique on this channel; batches, cancellation and server requests name it. */
157
+ readonly callId: string;
158
+ /** The server function: `<module path>#<export>`. */
159
+ readonly fnId: string;
160
+ /** The arguments, serialized as one array value. */
161
+ readonly args: Batches;
162
+ /** Who the call runs for. */
163
+ readonly context: CallContext;
164
+ }
165
+
166
+ /** The Zod schema of the `WorkerCallParams` type. */
167
+ export const WorkerCallParams: z.ZodType<WorkerCallParams> = z.object({
168
+ callId: z.string().min(1).max(64),
169
+ fnId: z.string().min(1),
170
+ args: Batches,
171
+ context: CallContextSchema,
172
+ });
173
+
174
+ /** How a call ended. */
175
+ export type WorkerCallOutcome =
176
+ | { readonly status: "succeeded" }
177
+ | { readonly status: "cancelled" }
178
+ | { readonly status: "failed"; readonly error: ActionError };
179
+
180
+ /** The Zod schema of the `WorkerCallOutcome` type. */
181
+ export const WorkerCallOutcome: z.ZodType<WorkerCallOutcome> = z.union([
182
+ z.object({ status: z.literal("succeeded") }),
183
+ z.object({ status: z.literal("cancelled") }),
184
+ z.object({ status: z.literal("failed"), error: ActionError }),
185
+ ]);
186
+
187
+ /** `worker/cancel` (notification): aborts a call's `abortSignal`. */
188
+ export interface WorkerCancelParams {
189
+ /** The call to cancel. */
190
+ readonly callId: string;
191
+ /** Why, for the run's log. */
192
+ readonly reason?: string;
193
+ }
194
+
195
+ /** `worker/ping`: the watchdog's question. */
196
+ export interface WorkerPingResult {
197
+ /** How long the worker's event loop has gone without a turn, in ms. */
198
+ readonly blockedMs: number;
199
+ /** Whether it is blocked on purpose, waiting for a secret (`secret()` is synchronous). */
200
+ readonly waitingForSecret: boolean;
201
+ /** The V8 heap in use, in bytes. */
202
+ readonly heapUsed: number;
203
+ }
204
+
205
+ /** The Zod schema of the `WorkerPingResult` type. */
206
+ export const WorkerPingResult: z.ZodType<WorkerPingResult> = z.object({
207
+ blockedMs: z.number().min(0),
208
+ waitingForSecret: z.boolean(),
209
+ heapUsed: z.number().min(0),
210
+ });
211
+
212
+ /** `worker/live.start` and `worker/live.stop` (requests), `worker/live.refresh` (notification). */
213
+ export interface WorkerLiveParams {
214
+ /** The live source's key. */
215
+ readonly key: string;
216
+ }
217
+
218
+ // ── Worker → supervisor ────────────────────────────────────────────────────────────────────
219
+
220
+ /** `worker/batch` (notification): a batch of a call's result. */
221
+ export interface WorkerBatchParams {
222
+ /** The call it belongs to. */
223
+ readonly callId: string;
224
+ /** One batch of the result. */
225
+ readonly batch: readonly Frame[];
226
+ }
227
+
228
+ /** The Zod schema of the `WorkerBatchParams` type. */
229
+ export const WorkerBatchParams: z.ZodType<WorkerBatchParams> = z.object({
230
+ callId: z.string(),
231
+ batch: z.array(z.record(z.string(), z.unknown())).readonly(),
232
+ }) as unknown as z.ZodType<WorkerBatchParams>;
233
+
234
+ /** `server/progress` (notification). */
235
+ export interface ServerProgressParams extends RunProgress {
236
+ /** The call it belongs to. */
237
+ readonly callId: string;
238
+ }
239
+
240
+ /** The Zod schema of the `ServerProgressParams` type. */
241
+ export const ServerProgressParams: z.ZodType<ServerProgressParams> = z.object({
242
+ callId: z.string(),
243
+ fraction: z.number().min(0).max(1).exactOptional(),
244
+ message: z.string().max(1000).exactOptional(),
245
+ });
246
+
247
+ /** `server/log` (notification): a line of a run's log, or of the worker's own log. */
248
+ export interface ServerLogParams {
249
+ /** The call it belongs to. */
250
+ readonly callId?: string;
251
+ /** One line. */
252
+ readonly line: string;
253
+ }
254
+
255
+ /** The Zod schema of the `ServerLogParams` type. */
256
+ export const ServerLogParams: z.ZodType<ServerLogParams> = z.object({
257
+ callId: z.string().exactOptional(),
258
+ line: z.string(),
259
+ });
260
+
261
+ /** `server/secret`: a secret by name (D44); `MOSTRA_SECRET_MISSING` when no store has it. */
262
+ export interface ServerSecretParams {
263
+ /** The secret's name. */
264
+ readonly name: string;
265
+ }
266
+
267
+ /** The Zod schema of the `ServerSecretParams` type. */
268
+ export const ServerSecretParams: z.ZodType<ServerSecretParams> = z.object({ name: z.string() });
269
+
270
+ /** `server/signal`: raises `signal.raised` with `source: "action"` (AC-05). */
271
+ export interface ServerSignalParams {
272
+ /** The call it belongs to. */
273
+ readonly callId?: string;
274
+ /** The signal's name. */
275
+ readonly name: string;
276
+ /** Any JSON, at most 64 KiB. */
277
+ readonly payload?: unknown;
278
+ }
279
+
280
+ /** The Zod schema of the `ServerSignalParams` type. */
281
+ export const ServerSignalParams: z.ZodType<ServerSignalParams> = z.object({
282
+ callId: z.string().exactOptional(),
283
+ name: z.string(),
284
+ payload: z.unknown().exactOptional(),
285
+ }) as z.ZodType<ServerSignalParams>;
286
+
287
+ /** `server/emit`: appends a `host.<name>` event (AC-05). */
288
+ export interface ServerEmitParams {
289
+ /** The call it belongs to. */
290
+ readonly callId?: string;
291
+ /** `host.<name>`. */
292
+ readonly type: string;
293
+ /** Any JSON, at most 64 KiB. */
294
+ readonly payload?: unknown;
295
+ }
296
+
297
+ /** The Zod schema of the `ServerEmitParams` type. */
298
+ export const ServerEmitParams: z.ZodType<ServerEmitParams> = z.object({
299
+ callId: z.string().exactOptional(),
300
+ type: z.string(),
301
+ payload: z.unknown().exactOptional(),
302
+ }) as z.ZodType<ServerEmitParams>;
303
+
304
+ /** `server/state.get`: reads the artifact's shared state. */
305
+ export interface ServerStateGetParams {
306
+ /** The fields to read; absent: all. */
307
+ readonly ids?: readonly string[];
308
+ }
309
+
310
+ /** The Zod schema of the `ServerStateGetParams` type. */
311
+ export const ServerStateGetParams: z.ZodType<ServerStateGetParams> = z.object({
312
+ ids: z.array(z.string()).readonly().exactOptional(),
313
+ });
314
+
315
+ /** `server/state.patch`: writes the artifact's shared state as the agent (D63). */
316
+ export interface ServerStatePatchParams {
317
+ /** The call it belongs to. */
318
+ readonly callId?: string;
319
+ /** The field changes. */
320
+ readonly ops: readonly FieldOp[];
321
+ /** The change's ID, for idempotent retries. */
322
+ readonly mutationId?: string;
323
+ /** The state revision read; fields changed after it conflict. */
324
+ readonly baseRevision?: DocumentRevision;
325
+ }
326
+
327
+ /** The Zod schema of the `ServerStatePatchParams` type. */
328
+ export const ServerStatePatchParams: z.ZodType<ServerStatePatchParams> = z.object({
329
+ callId: z.string().exactOptional(),
330
+ ops: z.array(FieldOp).min(1).max(1000).readonly(),
331
+ mutationId: z.string().exactOptional(),
332
+ baseRevision: DocumentRevision.exactOptional(),
333
+ });
334
+
335
+ /** The answer of `server/state.patch`. */
336
+ export type ServerStatePatchResult = MutationResult;
337
+
338
+ /** `server/live.value` (notification): a producer's new value, or its failure. */
339
+ export interface ServerLiveValueParams {
340
+ /** The live source's key. */
341
+ readonly key: string;
342
+ /** The value, serialized. */
343
+ readonly value?: Batches;
344
+ /** What went wrong. */
345
+ readonly error?: WireError;
346
+ }
347
+
348
+ /** The Zod schema of the `ServerLiveValueParams` type. */
349
+ export const ServerLiveValueParams: z.ZodType<ServerLiveValueParams> = z.object({
350
+ key: z.string().regex(LIVE_KEY_PATTERN),
351
+ value: Batches.exactOptional(),
352
+ error: z.object({ message: z.string(), code: z.string().exactOptional() }).exactOptional(),
353
+ });
354
+
355
+ /** The channel's method names. */
356
+ export const WORKER_METHODS = {
357
+ start: "worker/start",
358
+ call: "worker/call",
359
+ cancel: "worker/cancel",
360
+ ping: "worker/ping",
361
+ liveStart: "worker/live.start",
362
+ liveStop: "worker/live.stop",
363
+ liveRefresh: "worker/live.refresh",
364
+ stop: "worker/stop",
365
+ batch: "worker/batch",
366
+ progress: "server/progress",
367
+ log: "server/log",
368
+ secret: "server/secret",
369
+ signal: "server/signal",
370
+ emit: "server/emit",
371
+ stateGet: "server/state.get",
372
+ statePatch: "server/state.patch",
373
+ liveValue: "server/live.value",
374
+ } as const;