@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.
- package/LICENSE +202 -0
- package/README.md +37 -1
- package/dist/actions.d.ts +273 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +154 -0
- package/dist/actions.js.map +1 -0
- package/dist/artifact.d.ts +113 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +79 -0
- package/dist/artifact.js.map +1 -0
- package/dist/bridge.d.ts +295 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +343 -0
- package/dist/bridge.js.map +1 -0
- package/dist/browser.d.ts +195 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +156 -0
- package/dist/browser.js.map +1 -0
- package/dist/bundle.d.ts +155 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +130 -0
- package/dist/bundle.js.map +1 -0
- package/dist/canonical.d.ts +23 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +45 -0
- package/dist/canonical.js.map +1 -0
- package/dist/capability.d.ts +38 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +61 -0
- package/dist/capability.js.map +1 -0
- package/dist/diagnostics/codes/a11y.d.ts +8 -0
- package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
- package/dist/diagnostics/codes/a11y.js +30 -0
- package/dist/diagnostics/codes/a11y.js.map +1 -0
- package/dist/diagnostics/codes/action.d.ts +8 -0
- package/dist/diagnostics/codes/action.d.ts.map +1 -0
- package/dist/diagnostics/codes/action.js +110 -0
- package/dist/diagnostics/codes/action.js.map +1 -0
- package/dist/diagnostics/codes/artifact.d.ts +8 -0
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
- package/dist/diagnostics/codes/artifact.js +121 -0
- package/dist/diagnostics/codes/artifact.js.map +1 -0
- package/dist/diagnostics/codes/build.d.ts +8 -0
- package/dist/diagnostics/codes/build.d.ts.map +1 -0
- package/dist/diagnostics/codes/build.js +55 -0
- package/dist/diagnostics/codes/build.js.map +1 -0
- package/dist/diagnostics/codes/cli.d.ts +8 -0
- package/dist/diagnostics/codes/cli.d.ts.map +1 -0
- package/dist/diagnostics/codes/cli.js +44 -0
- package/dist/diagnostics/codes/cli.js.map +1 -0
- package/dist/diagnostics/codes/console.d.ts +8 -0
- package/dist/diagnostics/codes/console.d.ts.map +1 -0
- package/dist/diagnostics/codes/console.js +30 -0
- package/dist/diagnostics/codes/console.js.map +1 -0
- package/dist/diagnostics/codes/dep.d.ts +8 -0
- package/dist/diagnostics/codes/dep.d.ts.map +1 -0
- package/dist/diagnostics/codes/dep.js +88 -0
- package/dist/diagnostics/codes/dep.js.map +1 -0
- package/dist/diagnostics/codes/env.d.ts +8 -0
- package/dist/diagnostics/codes/env.d.ts.map +1 -0
- package/dist/diagnostics/codes/env.js +132 -0
- package/dist/diagnostics/codes/env.js.map +1 -0
- package/dist/diagnostics/codes/field.d.ts +8 -0
- package/dist/diagnostics/codes/field.d.ts.map +1 -0
- package/dist/diagnostics/codes/field.js +99 -0
- package/dist/diagnostics/codes/field.js.map +1 -0
- package/dist/diagnostics/codes/home.d.ts +8 -0
- package/dist/diagnostics/codes/home.d.ts.map +1 -0
- package/dist/diagnostics/codes/home.js +132 -0
- package/dist/diagnostics/codes/home.js.map +1 -0
- package/dist/diagnostics/codes/host.d.ts +8 -0
- package/dist/diagnostics/codes/host.d.ts.map +1 -0
- package/dist/diagnostics/codes/host.js +176 -0
- package/dist/diagnostics/codes/host.js.map +1 -0
- package/dist/diagnostics/codes/hygiene.d.ts +8 -0
- package/dist/diagnostics/codes/hygiene.d.ts.map +1 -0
- package/dist/diagnostics/codes/hygiene.js +154 -0
- package/dist/diagnostics/codes/hygiene.js.map +1 -0
- package/dist/diagnostics/codes/index.d.ts +51 -0
- package/dist/diagnostics/codes/index.d.ts.map +1 -0
- package/dist/diagnostics/codes/index.js +72 -0
- package/dist/diagnostics/codes/index.js.map +1 -0
- package/dist/diagnostics/codes/live.d.ts +8 -0
- package/dist/diagnostics/codes/live.d.ts.map +1 -0
- package/dist/diagnostics/codes/live.js +30 -0
- package/dist/diagnostics/codes/live.js.map +1 -0
- package/dist/diagnostics/codes/manifest.d.ts +8 -0
- package/dist/diagnostics/codes/manifest.d.ts.map +1 -0
- package/dist/diagnostics/codes/manifest.js +44 -0
- package/dist/diagnostics/codes/manifest.js.map +1 -0
- package/dist/diagnostics/codes/network.d.ts +8 -0
- package/dist/diagnostics/codes/network.d.ts.map +1 -0
- package/dist/diagnostics/codes/network.js +30 -0
- package/dist/diagnostics/codes/network.js.map +1 -0
- package/dist/diagnostics/codes/platform.d.ts +8 -0
- package/dist/diagnostics/codes/platform.d.ts.map +1 -0
- package/dist/diagnostics/codes/platform.js +18 -0
- package/dist/diagnostics/codes/platform.js.map +1 -0
- package/dist/diagnostics/codes/publish.d.ts +8 -0
- package/dist/diagnostics/codes/publish.d.ts.map +1 -0
- package/dist/diagnostics/codes/publish.js +44 -0
- package/dist/diagnostics/codes/publish.js.map +1 -0
- package/dist/diagnostics/codes/regression.d.ts +8 -0
- package/dist/diagnostics/codes/regression.d.ts.map +1 -0
- package/dist/diagnostics/codes/regression.js +77 -0
- package/dist/diagnostics/codes/regression.js.map +1 -0
- package/dist/diagnostics/codes/runtime.d.ts +8 -0
- package/dist/diagnostics/codes/runtime.d.ts.map +1 -0
- package/dist/diagnostics/codes/runtime.js +66 -0
- package/dist/diagnostics/codes/runtime.js.map +1 -0
- package/dist/diagnostics/codes/secret.d.ts +8 -0
- package/dist/diagnostics/codes/secret.d.ts.map +1 -0
- package/dist/diagnostics/codes/secret.js +18 -0
- package/dist/diagnostics/codes/secret.js.map +1 -0
- package/dist/diagnostics/codes/smoke.d.ts +8 -0
- package/dist/diagnostics/codes/smoke.d.ts.map +1 -0
- package/dist/diagnostics/codes/smoke.js +30 -0
- package/dist/diagnostics/codes/smoke.js.map +1 -0
- package/dist/diagnostics/codes/submit.d.ts +8 -0
- package/dist/diagnostics/codes/submit.d.ts.map +1 -0
- package/dist/diagnostics/codes/submit.js +99 -0
- package/dist/diagnostics/codes/submit.js.map +1 -0
- package/dist/diagnostics/codes/target.d.ts +8 -0
- package/dist/diagnostics/codes/target.d.ts.map +1 -0
- package/dist/diagnostics/codes/target.js +18 -0
- package/dist/diagnostics/codes/target.js.map +1 -0
- package/dist/diagnostics/codes/type.d.ts +8 -0
- package/dist/diagnostics/codes/type.d.ts.map +1 -0
- package/dist/diagnostics/codes/type.js +30 -0
- package/dist/diagnostics/codes/type.js.map +1 -0
- package/dist/diagnostics/codes/verify.d.ts +8 -0
- package/dist/diagnostics/codes/verify.d.ts.map +1 -0
- package/dist/diagnostics/codes/verify.js +99 -0
- package/dist/diagnostics/codes/verify.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +79 -0
- package/dist/diagnostics/diagnostic.d.ts.map +1 -0
- package/dist/diagnostics/diagnostic.js +131 -0
- package/dist/diagnostics/diagnostic.js.map +1 -0
- package/dist/diagnostics/spec.d.ts +49 -0
- package/dist/diagnostics/spec.d.ts.map +1 -0
- package/dist/diagnostics/spec.js +31 -0
- package/dist/diagnostics/spec.js.map +1 -0
- package/dist/hygiene.d.ts +66 -0
- package/dist/hygiene.d.ts.map +1 -0
- package/dist/hygiene.js +134 -0
- package/dist/hygiene.js.map +1 -0
- package/dist/ids.d.ts +119 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +135 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +86 -0
- package/dist/interaction.d.ts +391 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +306 -0
- package/dist/interaction.js.map +1 -0
- package/dist/manifest.d.ts +97 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +101 -0
- package/dist/manifest.js.map +1 -0
- package/dist/method.d.ts +26 -0
- package/dist/method.d.ts.map +1 -0
- package/dist/method.js +10 -0
- package/dist/method.js.map +1 -0
- package/dist/methods/artifact/create.d.ts +29 -0
- package/dist/methods/artifact/create.d.ts.map +1 -0
- package/dist/methods/artifact/create.js +31 -0
- package/dist/methods/artifact/create.js.map +1 -0
- package/dist/methods/artifact/get.d.ts +17 -0
- package/dist/methods/artifact/get.d.ts.map +1 -0
- package/dist/methods/artifact/get.js +21 -0
- package/dist/methods/artifact/get.js.map +1 -0
- package/dist/methods/artifact/list.d.ts +22 -0
- package/dist/methods/artifact/list.d.ts.map +1 -0
- package/dist/methods/artifact/list.js +19 -0
- package/dist/methods/artifact/list.js.map +1 -0
- package/dist/methods/artifact/publish.d.ts +28 -0
- package/dist/methods/artifact/publish.d.ts.map +1 -0
- package/dist/methods/artifact/publish.js +28 -0
- package/dist/methods/artifact/publish.js.map +1 -0
- package/dist/methods/artifact/verify.d.ts +29 -0
- package/dist/methods/artifact/verify.d.ts.map +1 -0
- package/dist/methods/artifact/verify.js +27 -0
- package/dist/methods/artifact/verify.js.map +1 -0
- package/dist/methods/deps/add.d.ts +43 -0
- package/dist/methods/deps/add.d.ts.map +1 -0
- package/dist/methods/deps/add.js +40 -0
- package/dist/methods/deps/add.js.map +1 -0
- package/dist/methods/dev/start.d.ts +52 -0
- package/dist/methods/dev/start.d.ts.map +1 -0
- package/dist/methods/dev/start.js +56 -0
- package/dist/methods/dev/start.js.map +1 -0
- package/dist/methods/dev/stop.d.ts +16 -0
- package/dist/methods/dev/stop.d.ts.map +1 -0
- package/dist/methods/dev/stop.js +21 -0
- package/dist/methods/dev/stop.js.map +1 -0
- package/dist/methods/events/ack.d.ts +20 -0
- package/dist/methods/events/ack.d.ts.map +1 -0
- package/dist/methods/events/ack.js +26 -0
- package/dist/methods/events/ack.js.map +1 -0
- package/dist/methods/events/read.d.ts +40 -0
- package/dist/methods/events/read.d.ts.map +1 -0
- package/dist/methods/events/read.js +35 -0
- package/dist/methods/events/read.js.map +1 -0
- package/dist/methods/events/subscribe.d.ts +54 -0
- package/dist/methods/events/subscribe.d.ts.map +1 -0
- package/dist/methods/events/subscribe.js +44 -0
- package/dist/methods/events/subscribe.js.map +1 -0
- package/dist/methods/events/unsubscribe.d.ts +16 -0
- package/dist/methods/events/unsubscribe.d.ts.map +1 -0
- package/dist/methods/events/unsubscribe.js +21 -0
- package/dist/methods/events/unsubscribe.js.map +1 -0
- package/dist/methods/gc/run.d.ts +76 -0
- package/dist/methods/gc/run.d.ts.map +1 -0
- package/dist/methods/gc/run.js +56 -0
- package/dist/methods/gc/run.js.map +1 -0
- package/dist/methods/index.d.ts +6 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +78 -0
- package/dist/methods/index.js.map +1 -0
- package/dist/methods/instance/check.d.ts +30 -0
- package/dist/methods/instance/check.d.ts.map +1 -0
- package/dist/methods/instance/check.js +34 -0
- package/dist/methods/instance/check.js.map +1 -0
- package/dist/methods/instance/status.d.ts +102 -0
- package/dist/methods/instance/status.d.ts.map +1 -0
- package/dist/methods/instance/status.js +83 -0
- package/dist/methods/instance/status.js.map +1 -0
- package/dist/methods/live/push.d.ts +28 -0
- package/dist/methods/live/push.d.ts.map +1 -0
- package/dist/methods/live/push.js +35 -0
- package/dist/methods/live/push.js.map +1 -0
- package/dist/methods/mostra/initialize.d.ts +143 -0
- package/dist/methods/mostra/initialize.d.ts.map +1 -0
- package/dist/methods/mostra/initialize.js +97 -0
- package/dist/methods/mostra/initialize.js.map +1 -0
- package/dist/methods/mostra/shutdown.d.ts +14 -0
- package/dist/methods/mostra/shutdown.d.ts.map +1 -0
- package/dist/methods/mostra/shutdown.js +22 -0
- package/dist/methods/mostra/shutdown.js.map +1 -0
- package/dist/methods/port/drafts-mirror.d.ts +30 -0
- package/dist/methods/port/drafts-mirror.d.ts.map +1 -0
- package/dist/methods/port/drafts-mirror.js +33 -0
- package/dist/methods/port/drafts-mirror.js.map +1 -0
- package/dist/methods/port/secrets-get.d.ts +19 -0
- package/dist/methods/port/secrets-get.d.ts.map +1 -0
- package/dist/methods/port/secrets-get.js +31 -0
- package/dist/methods/port/secrets-get.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +38 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
- package/dist/methods/port/submissions-deliver.js +38 -0
- package/dist/methods/port/submissions-deliver.js.map +1 -0
- package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
- package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-activated.js +33 -0
- package/dist/methods/port/trusted-controls-activated.js.map +1 -0
- package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
- package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-policy.js +27 -0
- package/dist/methods/port/trusted-controls-policy.js.map +1 -0
- package/dist/methods/results/get.d.ts +32 -0
- package/dist/methods/results/get.d.ts.map +1 -0
- package/dist/methods/results/get.js +36 -0
- package/dist/methods/results/get.js.map +1 -0
- package/dist/methods/secret/delete.d.ts +22 -0
- package/dist/methods/secret/delete.d.ts.map +1 -0
- package/dist/methods/secret/delete.js +32 -0
- package/dist/methods/secret/delete.js.map +1 -0
- package/dist/methods/secret/list.d.ts +21 -0
- package/dist/methods/secret/list.d.ts.map +1 -0
- package/dist/methods/secret/list.js +29 -0
- package/dist/methods/secret/list.js.map +1 -0
- package/dist/methods/secret/set.d.ts +37 -0
- package/dist/methods/secret/set.d.ts.map +1 -0
- package/dist/methods/secret/set.js +41 -0
- package/dist/methods/secret/set.js.map +1 -0
- package/dist/methods/state/get.d.ts +25 -0
- package/dist/methods/state/get.d.ts.map +1 -0
- package/dist/methods/state/get.js +29 -0
- package/dist/methods/state/get.js.map +1 -0
- package/dist/methods/state/patch.d.ts +32 -0
- package/dist/methods/state/patch.d.ts.map +1 -0
- package/dist/methods/state/patch.js +29 -0
- package/dist/methods/state/patch.js.map +1 -0
- package/dist/methods/view/default.d.ts +19 -0
- package/dist/methods/view/default.d.ts.map +1 -0
- package/dist/methods/view/default.js +23 -0
- package/dist/methods/view/default.js.map +1 -0
- package/dist/methods/view/launch.d.ts +27 -0
- package/dist/methods/view/launch.d.ts.map +1 -0
- package/dist/methods/view/launch.js +30 -0
- package/dist/methods/view/launch.js.map +1 -0
- package/dist/methods/view/revoke.d.ts +19 -0
- package/dist/methods/view/revoke.d.ts.map +1 -0
- package/dist/methods/view/revoke.js +26 -0
- package/dist/methods/view/revoke.js.map +1 -0
- package/dist/methods/view/rotate.d.ts +21 -0
- package/dist/methods/view/rotate.d.ts.map +1 -0
- package/dist/methods/view/rotate.js +27 -0
- package/dist/methods/view/rotate.js.map +1 -0
- package/dist/methods/view/url.d.ts +52 -0
- package/dist/methods/view/url.d.ts.map +1 -0
- package/dist/methods/view/url.js +43 -0
- package/dist/methods/view/url.js.map +1 -0
- package/dist/methods/wait/wait.d.ts +37 -0
- package/dist/methods/wait/wait.d.ts.map +1 -0
- package/dist/methods/wait/wait.js +39 -0
- package/dist/methods/wait/wait.js.map +1 -0
- package/dist/revision.d.ts +43 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +69 -0
- package/dist/revision.js.map +1 -0
- package/dist/rpc/error.d.ts +47 -0
- package/dist/rpc/error.d.ts.map +1 -0
- package/dist/rpc/error.js +77 -0
- package/dist/rpc/error.js.map +1 -0
- package/dist/rpc/lines.d.ts +30 -0
- package/dist/rpc/lines.d.ts.map +1 -0
- package/dist/rpc/lines.js +63 -0
- package/dist/rpc/lines.js.map +1 -0
- package/dist/rpc/messages.d.ts +92 -0
- package/dist/rpc/messages.d.ts.map +1 -0
- package/dist/rpc/messages.js +133 -0
- package/dist/rpc/messages.js.map +1 -0
- package/dist/rpc/peer.d.ts +81 -0
- package/dist/rpc/peer.d.ts.map +1 -0
- package/dist/rpc/peer.js +208 -0
- package/dist/rpc/peer.js.map +1 -0
- package/dist/serializer.d.ts +178 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +929 -0
- package/dist/serializer.js.map +1 -0
- package/dist/verify.d.ts +254 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +243 -0
- package/dist/verify.js.map +1 -0
- package/dist/view.d.ts +103 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +110 -0
- package/dist/view.js.map +1 -0
- package/dist/wire-registry.js +11 -0
- package/dist/wire-registry.js.map +1 -0
- package/dist/worker.d.ts +249 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +158 -0
- package/dist/worker.js.map +1 -0
- package/package.json +114 -4
- package/schemas/protocol.draft-07.json +5120 -0
- package/schemas/protocol.schema.json +4964 -0
- package/src/actions.ts +418 -0
- package/src/artifact.ts +187 -0
- package/src/bridge.ts +618 -0
- package/src/browser.ts +374 -0
- package/src/bundle.ts +264 -0
- package/src/canonical.ts +49 -0
- package/src/capability.ts +92 -0
- package/src/diagnostics/codes/a11y.ts +41 -0
- package/src/diagnostics/codes/action.ts +125 -0
- package/src/diagnostics/codes/artifact.ts +137 -0
- package/src/diagnostics/codes/build.ts +65 -0
- package/src/diagnostics/codes/cli.ts +53 -0
- package/src/diagnostics/codes/console.ts +41 -0
- package/src/diagnostics/codes/dep.ts +101 -0
- package/src/diagnostics/codes/env.ts +149 -0
- package/src/diagnostics/codes/field.ts +113 -0
- package/src/diagnostics/codes/home.ts +150 -0
- package/src/diagnostics/codes/host.ts +197 -0
- package/src/diagnostics/codes/hygiene.ts +175 -0
- package/src/diagnostics/codes/index.ts +142 -0
- package/src/diagnostics/codes/live.ts +41 -0
- package/src/diagnostics/codes/manifest.ts +53 -0
- package/src/diagnostics/codes/network.ts +41 -0
- package/src/diagnostics/codes/platform.ts +30 -0
- package/src/diagnostics/codes/publish.ts +53 -0
- package/src/diagnostics/codes/regression.ts +89 -0
- package/src/diagnostics/codes/runtime.ts +77 -0
- package/src/diagnostics/codes/secret.ts +29 -0
- package/src/diagnostics/codes/smoke.ts +41 -0
- package/src/diagnostics/codes/submit.ts +113 -0
- package/src/diagnostics/codes/target.ts +29 -0
- package/src/diagnostics/codes/type.ts +41 -0
- package/src/diagnostics/codes/verify.ts +113 -0
- package/src/diagnostics/diagnostic.ts +240 -0
- package/src/diagnostics/spec.ts +90 -0
- package/src/hygiene.ts +224 -0
- package/src/ids.ts +279 -0
- package/src/index.ts +576 -0
- package/src/interaction.ts +728 -0
- package/src/manifest.ts +206 -0
- package/src/method.ts +42 -0
- package/src/methods/artifact/create.ts +56 -0
- package/src/methods/artifact/get.ts +30 -0
- package/src/methods/artifact/list.ts +42 -0
- package/src/methods/artifact/publish.ts +46 -0
- package/src/methods/artifact/verify.ts +46 -0
- package/src/methods/deps/add.ts +72 -0
- package/src/methods/dev/start.ts +84 -0
- package/src/methods/dev/stop.ts +32 -0
- package/src/methods/events/ack.ts +41 -0
- package/src/methods/events/read.ts +67 -0
- package/src/methods/events/subscribe.ts +91 -0
- package/src/methods/events/unsubscribe.ts +35 -0
- package/src/methods/gc/run.ts +125 -0
- package/src/methods/index.ts +81 -0
- package/src/methods/instance/check.ts +61 -0
- package/src/methods/instance/status.ts +172 -0
- package/src/methods/live/push.ts +54 -0
- package/src/methods/mostra/initialize.ts +249 -0
- package/src/methods/mostra/shutdown.ts +31 -0
- package/src/methods/port/drafts-mirror.ts +52 -0
- package/src/methods/port/secrets-get.ts +40 -0
- package/src/methods/port/submissions-deliver.ts +70 -0
- package/src/methods/port/trusted-controls-activated.ts +51 -0
- package/src/methods/port/trusted-controls-policy.ts +38 -0
- package/src/methods/results/get.ts +59 -0
- package/src/methods/secret/delete.ts +43 -0
- package/src/methods/secret/list.ts +40 -0
- package/src/methods/secret/set.ts +69 -0
- package/src/methods/state/get.ts +44 -0
- package/src/methods/state/patch.ts +51 -0
- package/src/methods/view/default.ts +32 -0
- package/src/methods/view/launch.ts +47 -0
- package/src/methods/view/revoke.ts +39 -0
- package/src/methods/view/rotate.ts +37 -0
- package/src/methods/view/url.ts +84 -0
- package/src/methods/wait/wait.ts +58 -0
- package/src/revision.ts +101 -0
- package/src/rpc/error.ts +107 -0
- package/src/rpc/lines.ts +70 -0
- package/src/rpc/messages.ts +188 -0
- package/src/rpc/peer.ts +341 -0
- package/src/serializer.ts +1217 -0
- package/src/timers.d.ts +8 -0
- package/src/verify.ts +458 -0
- package/src/view.ts +200 -0
- package/src/web-crypto.d.ts +9 -0
- package/src/web-platform.d.ts +35 -0
- package/src/wire-registry.ts +14 -0
- package/src/worker.ts +374 -0
package/src/manifest.ts
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The artifact manifest (INTERFACES §2.2, D51): the metadata an artifact declares in its entry, as
|
|
3
|
+
* `export const artifact = defineArtifact({...})` in TSX or as YAML frontmatter in MDX. Mostra reads
|
|
4
|
+
* it statically, so every value is a literal. The same type checks `defineArtifact` for authors,
|
|
5
|
+
* validates the extracted literal in the supervisor and travels on the wire in `artifact/get`.
|
|
6
|
+
*
|
|
7
|
+
* ```ts
|
|
8
|
+
* const checked = ArtifactManifest.safeParse(extracted);
|
|
9
|
+
* ```
|
|
10
|
+
*/
|
|
11
|
+
import * as z from "zod";
|
|
12
|
+
import { ArtifactId } from "./ids.ts";
|
|
13
|
+
import { wireRegistry } from "./wire-registry.ts";
|
|
14
|
+
|
|
15
|
+
/** The families Mostra's templates and gallery know; any other string is allowed too. */
|
|
16
|
+
export type ArtifactFamily =
|
|
17
|
+
| "questionnaire"
|
|
18
|
+
| "proposal"
|
|
19
|
+
| "prototype"
|
|
20
|
+
| "review"
|
|
21
|
+
| "dashboard"
|
|
22
|
+
| "deck"
|
|
23
|
+
| "demo"
|
|
24
|
+
| "inbox"
|
|
25
|
+
| "tasks"
|
|
26
|
+
| (string & {});
|
|
27
|
+
|
|
28
|
+
/** A related artifact (PRODUCT J6): a later round, a follow-up, a replacement. */
|
|
29
|
+
export interface ArtifactLink {
|
|
30
|
+
/** How this artifact relates to the other one. */
|
|
31
|
+
readonly rel: "round-of" | "follows" | "replaces" | (string & {});
|
|
32
|
+
/** The other artifact's ID. */
|
|
33
|
+
readonly artifact: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The submission policy an artifact requests (D10, D39, D63). The host decides the policy in force;
|
|
38
|
+
* the manifest only asks for one.
|
|
39
|
+
*/
|
|
40
|
+
export type SubmissionPolicy =
|
|
41
|
+
| { readonly policy: "once"; readonly scope?: "per-artifact" | "per-viewer" }
|
|
42
|
+
| { readonly policy: "epochs" }
|
|
43
|
+
| { readonly policy: "none" };
|
|
44
|
+
|
|
45
|
+
/** A live terminal session the artifact declares (ROUND-3 §5.1, D65). */
|
|
46
|
+
export interface TerminalSpec {
|
|
47
|
+
/** The program and its arguments. */
|
|
48
|
+
readonly command: readonly string[];
|
|
49
|
+
/** Its working directory, relative to the artifact's source. */
|
|
50
|
+
readonly cwd?: string;
|
|
51
|
+
/** Extra environment variables. */
|
|
52
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
53
|
+
/** The terminal's width in cells. */
|
|
54
|
+
readonly cols?: number;
|
|
55
|
+
/** The terminal's height in cells. */
|
|
56
|
+
readonly rows?: number;
|
|
57
|
+
/** Whether viewers may type into it. Sessions are read-only by default. */
|
|
58
|
+
readonly input?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A web demo the artifact declares (ROUND-3 §5.4, TM-08): a command to run, or a port to attach to. */
|
|
62
|
+
export type DemoSpec =
|
|
63
|
+
| {
|
|
64
|
+
readonly command: readonly string[];
|
|
65
|
+
readonly cwd?: string;
|
|
66
|
+
readonly ready?: string;
|
|
67
|
+
readonly bridge?: boolean;
|
|
68
|
+
}
|
|
69
|
+
| { readonly attach: number; readonly bridge?: boolean };
|
|
70
|
+
|
|
71
|
+
/** The artifact manifest (INTERFACES §2.2). Every field except `title` is optional. */
|
|
72
|
+
export interface ArtifactManifest {
|
|
73
|
+
/** The artifact's ID. Written by `mostra new`; without one, the artifact is bound to its source path at first publish (D51). */
|
|
74
|
+
readonly id?: string;
|
|
75
|
+
/** The title people see. */
|
|
76
|
+
readonly title: string;
|
|
77
|
+
/** One or two sentences on what the artifact is for. */
|
|
78
|
+
readonly description?: string;
|
|
79
|
+
/** What kind of artifact it is; templates and the gallery group by it. */
|
|
80
|
+
readonly family?: ArtifactFamily;
|
|
81
|
+
/** Related artifacts. */
|
|
82
|
+
readonly links?: readonly ArtifactLink[];
|
|
83
|
+
/** How the artifact is built and served: `spa`, the default and the only mode in v1 (D19). */
|
|
84
|
+
readonly mode?: "spa";
|
|
85
|
+
/** The submission policy the artifact requests; the host decides (D39, D63). */
|
|
86
|
+
readonly submission?: SubmissionPolicy;
|
|
87
|
+
/** The kit's shadcn base (default `base`, D72) and theme. */
|
|
88
|
+
readonly kit?: { readonly base?: "base" | "radix"; readonly theme?: string };
|
|
89
|
+
/** Live terminal sessions by name (D65). */
|
|
90
|
+
readonly terminals?: Readonly<Record<string, TerminalSpec>>;
|
|
91
|
+
/** Web demos by name (D65). */
|
|
92
|
+
readonly demos?: Readonly<Record<string, DemoSpec>>;
|
|
93
|
+
/** Stability limits for the artifact's worker (D62). */
|
|
94
|
+
readonly limits?: {
|
|
95
|
+
readonly heapMb?: number;
|
|
96
|
+
readonly watchdogMs?: number;
|
|
97
|
+
readonly idleMinutes?: number;
|
|
98
|
+
};
|
|
99
|
+
/** `verify` settings (D65). */
|
|
100
|
+
readonly verify?: {
|
|
101
|
+
readonly viewports?: readonly string[];
|
|
102
|
+
readonly frames?: readonly string[];
|
|
103
|
+
readonly extraChecks?: readonly string[];
|
|
104
|
+
readonly smoke?: boolean;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */
|
|
109
|
+
export const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[] = [
|
|
110
|
+
"id",
|
|
111
|
+
"title",
|
|
112
|
+
"description",
|
|
113
|
+
"family",
|
|
114
|
+
"links",
|
|
115
|
+
"mode",
|
|
116
|
+
"submission",
|
|
117
|
+
"kit",
|
|
118
|
+
"terminals",
|
|
119
|
+
"demos",
|
|
120
|
+
"limits",
|
|
121
|
+
"verify",
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
const strings = z.array(z.string()).readonly();
|
|
125
|
+
|
|
126
|
+
/** The Zod schema of the `ArtifactLink` type. */
|
|
127
|
+
export const ArtifactLink: z.ZodType<ArtifactLink> = z
|
|
128
|
+
.object({ rel: z.string().min(1), artifact: z.string().min(1) })
|
|
129
|
+
.register(wireRegistry, {
|
|
130
|
+
id: "ArtifactLink",
|
|
131
|
+
description: "A related artifact: how this one relates (rel) and the other artifact's ID.",
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
/** The Zod schema of the `SubmissionPolicy` type. */
|
|
135
|
+
export const SubmissionPolicy: z.ZodType<SubmissionPolicy> = z
|
|
136
|
+
.discriminatedUnion("policy", [
|
|
137
|
+
z.object({
|
|
138
|
+
policy: z.literal("once"),
|
|
139
|
+
scope: z.enum(["per-artifact", "per-viewer"]).exactOptional(),
|
|
140
|
+
}),
|
|
141
|
+
z.object({ policy: z.literal("epochs") }),
|
|
142
|
+
z.object({ policy: z.literal("none") }),
|
|
143
|
+
])
|
|
144
|
+
.register(wireRegistry, {
|
|
145
|
+
id: "SubmissionPolicy",
|
|
146
|
+
description: "A submission policy: once (per-artifact or per-viewer), epochs, or none.",
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
const TerminalSpec: z.ZodType<TerminalSpec> = z.object({
|
|
150
|
+
command: z.array(z.string()).min(1).readonly(),
|
|
151
|
+
cwd: z.string().exactOptional(),
|
|
152
|
+
env: z.record(z.string(), z.string()).readonly().exactOptional(),
|
|
153
|
+
cols: z.int().min(1).exactOptional(),
|
|
154
|
+
rows: z.int().min(1).exactOptional(),
|
|
155
|
+
input: z.boolean().exactOptional(),
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const DemoSpec: z.ZodType<DemoSpec> = z.union([
|
|
159
|
+
z.object({
|
|
160
|
+
command: z.array(z.string()).min(1).readonly(),
|
|
161
|
+
cwd: z.string().exactOptional(),
|
|
162
|
+
ready: z.string().exactOptional(),
|
|
163
|
+
bridge: z.boolean().exactOptional(),
|
|
164
|
+
}),
|
|
165
|
+
z.object({ attach: z.int().min(1).max(65535), bridge: z.boolean().exactOptional() }),
|
|
166
|
+
]);
|
|
167
|
+
|
|
168
|
+
/** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */
|
|
169
|
+
export const ArtifactManifest: z.ZodType<ArtifactManifest> = z
|
|
170
|
+
.object({
|
|
171
|
+
id: ArtifactId.schema.exactOptional(),
|
|
172
|
+
title: z.string().min(1),
|
|
173
|
+
description: z.string().exactOptional(),
|
|
174
|
+
family: z.string().min(1).exactOptional(),
|
|
175
|
+
links: z.array(ArtifactLink).readonly().exactOptional(),
|
|
176
|
+
mode: z.literal("spa").exactOptional(),
|
|
177
|
+
submission: SubmissionPolicy.exactOptional(),
|
|
178
|
+
kit: z
|
|
179
|
+
.object({
|
|
180
|
+
base: z.enum(["base", "radix"]).exactOptional(),
|
|
181
|
+
theme: z.string().exactOptional(),
|
|
182
|
+
})
|
|
183
|
+
.exactOptional(),
|
|
184
|
+
terminals: z.record(z.string(), TerminalSpec).readonly().exactOptional(),
|
|
185
|
+
demos: z.record(z.string(), DemoSpec).readonly().exactOptional(),
|
|
186
|
+
limits: z
|
|
187
|
+
.object({
|
|
188
|
+
heapMb: z.int().min(1).exactOptional(),
|
|
189
|
+
watchdogMs: z.int().min(1).exactOptional(),
|
|
190
|
+
idleMinutes: z.number().min(0).exactOptional(),
|
|
191
|
+
})
|
|
192
|
+
.exactOptional(),
|
|
193
|
+
verify: z
|
|
194
|
+
.object({
|
|
195
|
+
viewports: strings.exactOptional(),
|
|
196
|
+
frames: strings.exactOptional(),
|
|
197
|
+
extraChecks: strings.exactOptional(),
|
|
198
|
+
smoke: z.boolean().exactOptional(),
|
|
199
|
+
})
|
|
200
|
+
.exactOptional(),
|
|
201
|
+
})
|
|
202
|
+
.register(wireRegistry, {
|
|
203
|
+
id: "ArtifactManifest",
|
|
204
|
+
description:
|
|
205
|
+
"The artifact manifest (INTERFACES §2.2): literal metadata from the entry's defineArtifact call or MDX frontmatter.",
|
|
206
|
+
});
|
package/src/method.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Host protocol methods (INTERFACES §6, D59): JSON-RPC 2.0 methods between clients and an
|
|
3
|
+
* instance, each defined once with Zod schemas for its params and result. `pnpm gen
|
|
4
|
+
* protocol-method <group>/<name>` adds one in the right shape; the method modules live in
|
|
5
|
+
* `methods/` and are listed in `methods/index.ts`.
|
|
6
|
+
*/
|
|
7
|
+
import type * as z from "zod";
|
|
8
|
+
|
|
9
|
+
/** Who sends the request: a client to the instance, or the instance to a registering host (ports). */
|
|
10
|
+
export type MethodDirection = "client-to-instance" | "instance-to-host";
|
|
11
|
+
|
|
12
|
+
/** One protocol method. */
|
|
13
|
+
export interface MethodDefinition<Params, Result> {
|
|
14
|
+
/** The JSON-RPC method name: `group/name` (`artifact/publish`) or a bare name (`wait`). */
|
|
15
|
+
readonly method: string;
|
|
16
|
+
/** Who sends the request. */
|
|
17
|
+
readonly direction: MethodDirection;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the method changes durable state. Mutating methods take an optional `requestId`, and a
|
|
20
|
+
* retry with the same ID returns the recorded result (H-03).
|
|
21
|
+
*/
|
|
22
|
+
readonly mutating: boolean;
|
|
23
|
+
/** The schema of the request's `params`. */
|
|
24
|
+
readonly params: z.ZodType<Params>;
|
|
25
|
+
/** The schema of a successful response's `result`. */
|
|
26
|
+
readonly result: z.ZodType<Result>;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** A method of any params and result type. */
|
|
30
|
+
export type AnyMethod = MethodDefinition<unknown, unknown>;
|
|
31
|
+
|
|
32
|
+
/** Defines a protocol method, checking its name has the `group/name` (or bare `name`) form. */
|
|
33
|
+
export function defineMethod<Params, Result>(
|
|
34
|
+
definition: MethodDefinition<Params, Result>,
|
|
35
|
+
): MethodDefinition<Params, Result> {
|
|
36
|
+
if (!/^([a-z][a-zA-Z]*\/)?[a-z][a-zA-Z.]*$/.test(definition.method)) {
|
|
37
|
+
throw new Error(
|
|
38
|
+
`Protocol method names have the form group/name or name, got "${definition.method}".`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
return definition;
|
|
42
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactId } from "../../ids.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `artifact/create` (INTERFACES §6). */
|
|
7
|
+
export interface ArtifactCreateParams {
|
|
8
|
+
/** The new artifact's directory, absolute. It must not exist yet, or be empty. */
|
|
9
|
+
readonly dir: string;
|
|
10
|
+
/** A template to start from. Templates arrive with `mostra new` (WP-26); none is the default. */
|
|
11
|
+
readonly template?: string;
|
|
12
|
+
/** The artifact's title. Default: the directory's name. */
|
|
13
|
+
readonly title?: string;
|
|
14
|
+
/** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
|
|
15
|
+
readonly requestId?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The result of `artifact/create`. */
|
|
19
|
+
export interface ArtifactCreateResult {
|
|
20
|
+
/** The generated artifact ID, written into the entry's manifest. */
|
|
21
|
+
readonly artifactId: string;
|
|
22
|
+
/** The artifact's directory (its real path). */
|
|
23
|
+
readonly dir: string;
|
|
24
|
+
/** The files written, relative to `dir`. */
|
|
25
|
+
readonly files: readonly string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const params: z.ZodType<ArtifactCreateParams> = z
|
|
29
|
+
.object({
|
|
30
|
+
dir: z.string().regex(/^\//),
|
|
31
|
+
template: z.string().min(1).exactOptional(),
|
|
32
|
+
title: z.string().min(1).exactOptional(),
|
|
33
|
+
requestId: z.string().min(1).exactOptional(),
|
|
34
|
+
})
|
|
35
|
+
.register(wireRegistry, { id: "ArtifactCreateParams" });
|
|
36
|
+
|
|
37
|
+
const result: z.ZodType<ArtifactCreateResult> = z
|
|
38
|
+
.object({
|
|
39
|
+
artifactId: ArtifactId.schema,
|
|
40
|
+
dir: z.string(),
|
|
41
|
+
files: z.array(z.string()).readonly(),
|
|
42
|
+
})
|
|
43
|
+
.register(wireRegistry, { id: "ArtifactCreateResult" });
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* `artifact/create`: writes a new artifact's entry, with a generated artifact ID in its manifest, into
|
|
47
|
+
* an empty directory. The artifact appears in `artifact/list` once it is published.
|
|
48
|
+
*/
|
|
49
|
+
export const artifactCreateMethod: MethodDefinition<ArtifactCreateParams, ArtifactCreateResult> =
|
|
50
|
+
defineMethod({
|
|
51
|
+
method: "artifact/create",
|
|
52
|
+
direction: "client-to-instance",
|
|
53
|
+
mutating: true,
|
|
54
|
+
params,
|
|
55
|
+
result,
|
|
56
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactDetail, ArtifactRef } from "../../artifact.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `artifact/get` (INTERFACES §6). */
|
|
7
|
+
export interface ArtifactGetParams {
|
|
8
|
+
/** The artifact, by ID or by a source path bound to it. */
|
|
9
|
+
readonly artifact: ArtifactRef;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The result of `artifact/get`. */
|
|
13
|
+
export type ArtifactGetResult = ArtifactDetail;
|
|
14
|
+
|
|
15
|
+
const params: z.ZodType<ArtifactGetParams> = z
|
|
16
|
+
.object({ artifact: ArtifactRef })
|
|
17
|
+
.register(wireRegistry, { id: "ArtifactGetParams" });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* `artifact/get`: one artifact with its metadata, policy, source and every version. An unknown
|
|
21
|
+
* artifact is `MOSTRA_ARTIFACT_NOT_FOUND`.
|
|
22
|
+
*/
|
|
23
|
+
export const artifactGetMethod: MethodDefinition<ArtifactGetParams, ArtifactGetResult> =
|
|
24
|
+
defineMethod({
|
|
25
|
+
method: "artifact/get",
|
|
26
|
+
direction: "client-to-instance",
|
|
27
|
+
mutating: false,
|
|
28
|
+
params,
|
|
29
|
+
result: ArtifactDetail,
|
|
30
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactSummary } from "../../artifact.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** Narrows `artifact/list`. */
|
|
7
|
+
export interface ArtifactListFilter {
|
|
8
|
+
/** Only artifacts of this family (INTERFACES §2.2). */
|
|
9
|
+
readonly family?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** The params of `artifact/list` (INTERFACES §6). */
|
|
13
|
+
export interface ArtifactListParams {
|
|
14
|
+
/** Narrows the list; all artifacts when absent. */
|
|
15
|
+
readonly filter?: ArtifactListFilter;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The result of `artifact/list`. */
|
|
19
|
+
export interface ArtifactListResult {
|
|
20
|
+
/** The home's published artifacts, most recently published first. */
|
|
21
|
+
readonly artifacts: readonly ArtifactSummary[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const params: z.ZodType<ArtifactListParams> = z
|
|
25
|
+
.object({
|
|
26
|
+
filter: z.object({ family: z.string().min(1).exactOptional() }).exactOptional(),
|
|
27
|
+
})
|
|
28
|
+
.register(wireRegistry, { id: "ArtifactListParams" });
|
|
29
|
+
|
|
30
|
+
const result: z.ZodType<ArtifactListResult> = z
|
|
31
|
+
.object({ artifacts: z.array(ArtifactSummary).readonly() })
|
|
32
|
+
.register(wireRegistry, { id: "ArtifactListResult" });
|
|
33
|
+
|
|
34
|
+
/** `artifact/list`: lists the home's published artifacts. */
|
|
35
|
+
export const artifactListMethod: MethodDefinition<ArtifactListParams, ArtifactListResult> =
|
|
36
|
+
defineMethod({
|
|
37
|
+
method: "artifact/list",
|
|
38
|
+
direction: "client-to-instance",
|
|
39
|
+
mutating: false,
|
|
40
|
+
params,
|
|
41
|
+
result,
|
|
42
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { PublishReceipt, SourceRef } from "../../artifact.ts";
|
|
3
|
+
import { SubmissionPolicy } from "../../manifest.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** The params of `artifact/publish` (INTERFACES §6). */
|
|
8
|
+
export interface ArtifactPublishParams {
|
|
9
|
+
/** What to publish: a source path, or an artifact ID meaning the path it was last published from. */
|
|
10
|
+
readonly source: SourceRef;
|
|
11
|
+
/**
|
|
12
|
+
* Publish even when `verify` reports errors, recording their codes in the version (D41). The
|
|
13
|
+
* verify gate arrives with WP-09; until then publish runs no verify and `force` changes nothing.
|
|
14
|
+
*/
|
|
15
|
+
readonly force?: boolean;
|
|
16
|
+
/** The submission policy the host decides on, overriding the manifest's request (D39). */
|
|
17
|
+
readonly policy?: SubmissionPolicy;
|
|
18
|
+
/** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
|
|
19
|
+
readonly requestId?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The result of `artifact/publish`: the receipt, durable before it is sent (H-07). */
|
|
23
|
+
export type ArtifactPublishResult = PublishReceipt;
|
|
24
|
+
|
|
25
|
+
const params: z.ZodType<ArtifactPublishParams> = z
|
|
26
|
+
.object({
|
|
27
|
+
source: SourceRef,
|
|
28
|
+
force: z.boolean().exactOptional(),
|
|
29
|
+
policy: SubmissionPolicy.exactOptional(),
|
|
30
|
+
requestId: z.string().min(1).exactOptional(),
|
|
31
|
+
})
|
|
32
|
+
.register(wireRegistry, { id: "ArtifactPublishParams" });
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* `artifact/publish`: freezes an artifact's source into an immutable, content-addressed version and
|
|
36
|
+
* returns its receipt. A failed publish leaves no version (VR-02); the same source and environment
|
|
37
|
+
* publish as the existing version (`reused`).
|
|
38
|
+
*/
|
|
39
|
+
export const artifactPublishMethod: MethodDefinition<ArtifactPublishParams, ArtifactPublishResult> =
|
|
40
|
+
defineMethod({
|
|
41
|
+
method: "artifact/publish",
|
|
42
|
+
direction: "client-to-instance",
|
|
43
|
+
mutating: true,
|
|
44
|
+
params,
|
|
45
|
+
result: PublishReceipt,
|
|
46
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { SourceRef } from "../../artifact.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { ScreenshotPolicy, VerifyVerdict } from "../../verify.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** The params of `artifact/verify` (INTERFACES §6). */
|
|
8
|
+
export interface ArtifactVerifyParams {
|
|
9
|
+
/** What to verify: a source path, or an artifact ID meaning the path it was last published from. */
|
|
10
|
+
readonly source: SourceRef;
|
|
11
|
+
/**
|
|
12
|
+
* When the verdict's screenshots are returned to the caller (AX-05): `on-failure` (the default),
|
|
13
|
+
* `always` or `never`. Screenshots are taken either way; this sets their `returned` flag.
|
|
14
|
+
*/
|
|
15
|
+
readonly screenshots?: ScreenshotPolicy;
|
|
16
|
+
/**
|
|
17
|
+
* Asks for `artifact/progress` notifications carrying this token as the stages run, when the
|
|
18
|
+
* client accepts them in `mostra/initialize`.
|
|
19
|
+
*/
|
|
20
|
+
readonly progressToken?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The result of `artifact/verify`: the verdict, also cached for the publish that follows (D41). */
|
|
24
|
+
export type ArtifactVerifyResult = VerifyVerdict;
|
|
25
|
+
|
|
26
|
+
const params: z.ZodType<ArtifactVerifyParams> = z
|
|
27
|
+
.object({
|
|
28
|
+
source: SourceRef,
|
|
29
|
+
screenshots: ScreenshotPolicy.exactOptional(),
|
|
30
|
+
progressToken: z.string().min(1).max(200).exactOptional(),
|
|
31
|
+
})
|
|
32
|
+
.register(wireRegistry, { id: "ArtifactVerifyParams" });
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* `artifact/verify`: builds, type-checks, renders and exercises an artifact's source headlessly,
|
|
36
|
+
* compares it with its last passing version, and returns one verdict (D29, D138). It never
|
|
37
|
+
* publishes and never touches the home's drafts, state, events or deliveries.
|
|
38
|
+
*/
|
|
39
|
+
export const artifactVerifyMethod: MethodDefinition<ArtifactVerifyParams, ArtifactVerifyResult> =
|
|
40
|
+
defineMethod({
|
|
41
|
+
method: "artifact/verify",
|
|
42
|
+
direction: "client-to-instance",
|
|
43
|
+
mutating: false,
|
|
44
|
+
params,
|
|
45
|
+
result: VerifyVerdict,
|
|
46
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { SourceRef } from "../../artifact.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `deps/add` (INTERFACES §6, D95). */
|
|
7
|
+
export interface DepsAddParams {
|
|
8
|
+
/** The artifact whose lockfile gains the packages: a source path, or an artifact ID. */
|
|
9
|
+
readonly artifact: SourceRef;
|
|
10
|
+
/**
|
|
11
|
+
* npm package specs: `name`, `name@version`, `name@range` or `name@tag`, scoped names included.
|
|
12
|
+
* A spec without an exact version takes the newest release at least a day old (D95).
|
|
13
|
+
*/
|
|
14
|
+
readonly packages: readonly string[];
|
|
15
|
+
/** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
|
|
16
|
+
readonly requestId?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** One package `deps/add` settled. */
|
|
20
|
+
export interface AddedPackage {
|
|
21
|
+
/** The package's name. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
/** The exact version the artifact's lockfile now holds. */
|
|
24
|
+
readonly version: string;
|
|
25
|
+
/** Whether it comes from the warm set, which every artifact resolves without an install. */
|
|
26
|
+
readonly warm: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The result of `deps/add`. */
|
|
30
|
+
export interface DepsAddResult {
|
|
31
|
+
/** Each requested package, in request order, with the version it resolved to. */
|
|
32
|
+
readonly packages: readonly AddedPackage[];
|
|
33
|
+
/** The SHA-256 of the artifact's lockfile after the change: the `lockDigest` its next publish uses. */
|
|
34
|
+
readonly lockDigest: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** The Zod schema of the `AddedPackage` type. */
|
|
38
|
+
export const AddedPackage: z.ZodType<AddedPackage> = z
|
|
39
|
+
.object({ name: z.string().min(1), version: z.string().min(1), warm: z.boolean() })
|
|
40
|
+
.register(wireRegistry, {
|
|
41
|
+
id: "AddedPackage",
|
|
42
|
+
description: "A package deps/add settled: its name, exact version and whether it is warm.",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const params: z.ZodType<DepsAddParams> = z
|
|
46
|
+
.object({
|
|
47
|
+
artifact: SourceRef,
|
|
48
|
+
packages: z.array(z.string().min(1)).min(1).readonly(),
|
|
49
|
+
requestId: z.string().min(1).exactOptional(),
|
|
50
|
+
})
|
|
51
|
+
.register(wireRegistry, { id: "DepsAddParams" });
|
|
52
|
+
|
|
53
|
+
const result: z.ZodType<DepsAddResult> = z
|
|
54
|
+
.object({
|
|
55
|
+
packages: z.array(AddedPackage).readonly(),
|
|
56
|
+
lockDigest: z.string().regex(/^[0-9a-f]{64}$/),
|
|
57
|
+
})
|
|
58
|
+
.register(wireRegistry, { id: "DepsAddResult" });
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* `deps/add`: installs npm packages into the home's shared store and records them, at exact
|
|
62
|
+
* versions, in the artifact's lockfile, so its next publish builds with them, offline too. The
|
|
63
|
+
* method behind `mostra add` (D43, D95), and the only way packages enter a lockfile under the
|
|
64
|
+
* `explicit` dependency policy.
|
|
65
|
+
*/
|
|
66
|
+
export const depsAddMethod: MethodDefinition<DepsAddParams, DepsAddResult> = defineMethod({
|
|
67
|
+
method: "deps/add",
|
|
68
|
+
direction: "client-to-instance",
|
|
69
|
+
mutating: true,
|
|
70
|
+
params,
|
|
71
|
+
result,
|
|
72
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { SourceRef } from "../../artifact.ts";
|
|
3
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** The params of `dev/start` (INTERFACES §6, D140 item 12, VR-08). */
|
|
8
|
+
export interface DevStartParams {
|
|
9
|
+
/** The artifact source to serve with hot reload. */
|
|
10
|
+
readonly source: SourceRef;
|
|
11
|
+
/** The loopback port for the dev page; one the operating system assigns when absent. */
|
|
12
|
+
readonly port?: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The result of `dev/start`. */
|
|
16
|
+
export interface DevStartResult {
|
|
17
|
+
/** The dev page, with the session's secret in its fragment (`#t=…`). Never a capability URL. */
|
|
18
|
+
readonly url: string;
|
|
19
|
+
/** The loopback port the dev page listens on. */
|
|
20
|
+
readonly port: number;
|
|
21
|
+
/** The session, for `dev/stop` and `dev/notify`. */
|
|
22
|
+
readonly sessionId: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const params: z.ZodType<DevStartParams> = z
|
|
26
|
+
.object({ source: SourceRef, port: z.int().min(1).max(65535).exactOptional() })
|
|
27
|
+
.register(wireRegistry, { id: "DevStartParams" });
|
|
28
|
+
|
|
29
|
+
const result: z.ZodType<DevStartResult> = z
|
|
30
|
+
.object({
|
|
31
|
+
url: z.string().min(1),
|
|
32
|
+
port: z.int().min(1).max(65535),
|
|
33
|
+
sessionId: z.string().min(1),
|
|
34
|
+
})
|
|
35
|
+
.register(wireRegistry, { id: "DevStartResult", description: "A running dev session." });
|
|
36
|
+
|
|
37
|
+
/** The notification a dev session sends the connection that started it (D140 item 12). */
|
|
38
|
+
export const DEV_NOTIFY = "dev/notify";
|
|
39
|
+
|
|
40
|
+
/** What happened in a dev session. */
|
|
41
|
+
export type DevEventKind = "built" | "reloaded" | "server-restarted" | "submission" | "diagnostics";
|
|
42
|
+
|
|
43
|
+
/** The params of `dev/notify`. */
|
|
44
|
+
export interface DevNotifyParams {
|
|
45
|
+
/** The session it happened in. */
|
|
46
|
+
readonly sessionId: string;
|
|
47
|
+
/** What happened. */
|
|
48
|
+
readonly kind: DevEventKind;
|
|
49
|
+
/** When it happened (RFC 3339, UTC). */
|
|
50
|
+
readonly at: string;
|
|
51
|
+
/** What the build or the server code reported (`built`, `diagnostics`, `server-restarted`). */
|
|
52
|
+
readonly diagnostics?: readonly Diagnostic[];
|
|
53
|
+
/** The changed files that caused it (`reloaded`, `server-restarted`), relative to the source. */
|
|
54
|
+
readonly files?: readonly string[];
|
|
55
|
+
/** A submission's Results JSON (INTERFACES §8), for `submission`; it was delivered nowhere. */
|
|
56
|
+
readonly results?: unknown;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The Zod schema of `dev/notify`'s params. */
|
|
60
|
+
export const DevNotifyParams: z.ZodType<DevNotifyParams> = z
|
|
61
|
+
.object({
|
|
62
|
+
sessionId: z.string().min(1),
|
|
63
|
+
kind: z.enum(["built", "reloaded", "server-restarted", "submission", "diagnostics"]),
|
|
64
|
+
at: z.iso.datetime(),
|
|
65
|
+
diagnostics: z.array(Diagnostic).readonly().exactOptional(),
|
|
66
|
+
files: z.array(z.string()).readonly().exactOptional(),
|
|
67
|
+
results: z.unknown().exactOptional(),
|
|
68
|
+
})
|
|
69
|
+
.register(wireRegistry, { id: "DevNotifyParams", description: "One event of a dev session." });
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* `dev/start`: serves an artifact's source with Vite's hot module reload on its own loopback
|
|
73
|
+
* port (VR-08, D140 item 12), with every server feature through a scratch sandbox like verify's:
|
|
74
|
+
* nothing reaches the home's drafts, state, events, hosts or deliveries, and no capability URL
|
|
75
|
+
* reaches it. The session belongs to this connection and ends when it closes or with `dev/stop`;
|
|
76
|
+
* a client that accepts `dev/notify` receives its events.
|
|
77
|
+
*/
|
|
78
|
+
export const devStartMethod: MethodDefinition<DevStartParams, DevStartResult> = defineMethod({
|
|
79
|
+
method: "dev/start",
|
|
80
|
+
direction: "client-to-instance",
|
|
81
|
+
mutating: true,
|
|
82
|
+
params,
|
|
83
|
+
result,
|
|
84
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
3
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
4
|
+
|
|
5
|
+
/** The params of `dev/stop` (INTERFACES §6, D140 item 12). */
|
|
6
|
+
export interface DevStopParams {
|
|
7
|
+
/** The session `dev/start` returned. */
|
|
8
|
+
readonly sessionId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** The result of `dev/stop`. */
|
|
12
|
+
export type DevStopResult = Record<string, never>;
|
|
13
|
+
|
|
14
|
+
const params: z.ZodType<DevStopParams> = z
|
|
15
|
+
.object({ sessionId: z.string().min(1) })
|
|
16
|
+
.register(wireRegistry, { id: "DevStopParams" });
|
|
17
|
+
|
|
18
|
+
const result: z.ZodType<DevStopResult> = z
|
|
19
|
+
.object({})
|
|
20
|
+
.register(wireRegistry, { id: "DevStopResult" });
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `dev/stop`: ends a dev session this connection started, stopping its Vite child and workers
|
|
24
|
+
* and deleting its scratch state. Stopping a session that already ended succeeds.
|
|
25
|
+
*/
|
|
26
|
+
export const devStopMethod: MethodDefinition<DevStopParams, DevStopResult> = defineMethod({
|
|
27
|
+
method: "dev/stop",
|
|
28
|
+
direction: "client-to-instance",
|
|
29
|
+
mutating: true,
|
|
30
|
+
params,
|
|
31
|
+
result,
|
|
32
|
+
});
|