@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.
- package/LICENSE +202 -0
- package/README.md +38 -2
- 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 -3
- 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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Cursor } from "../../ids.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `events/ack` (INTERFACES §6). */
|
|
7
|
+
export interface EventsAckParams {
|
|
8
|
+
/** The subscription, as `events/subscribe` returned it. */
|
|
9
|
+
readonly subscriptionId: string;
|
|
10
|
+
/** Every event up to this cursor is handled. An earlier cursor than the last ack changes nothing. */
|
|
11
|
+
readonly cursor: string;
|
|
12
|
+
/** Accepted for uniformity (H-03); acknowledging is idempotent by itself. */
|
|
13
|
+
readonly requestId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** The result of `events/ack`. */
|
|
17
|
+
export type EventsAckResult = Record<string, never>;
|
|
18
|
+
|
|
19
|
+
const params: z.ZodType<EventsAckParams> = z
|
|
20
|
+
.object({
|
|
21
|
+
subscriptionId: z.string().min(1),
|
|
22
|
+
cursor: Cursor.schema,
|
|
23
|
+
requestId: z.string().min(1).exactOptional(),
|
|
24
|
+
})
|
|
25
|
+
.register(wireRegistry, { id: "EventsAckParams" });
|
|
26
|
+
|
|
27
|
+
const result: z.ZodType<EventsAckResult> = z
|
|
28
|
+
.object({})
|
|
29
|
+
.register(wireRegistry, { id: "EventsAckResult" });
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* `events/ack`: records that a subscriber handled every event up to a cursor. For a named
|
|
33
|
+
* subscription it is durable: the next subscription with that name resumes after it (IN-08).
|
|
34
|
+
*/
|
|
35
|
+
export const eventsAckMethod: MethodDefinition<EventsAckParams, EventsAckResult> = defineMethod({
|
|
36
|
+
method: "events/ack",
|
|
37
|
+
direction: "client-to-instance",
|
|
38
|
+
mutating: true,
|
|
39
|
+
params,
|
|
40
|
+
result,
|
|
41
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.ts";
|
|
3
|
+
import { Cursor } from "../../ids.ts";
|
|
4
|
+
import { EventFilter, EventRecord } from "../../interaction.ts";
|
|
5
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
6
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
7
|
+
|
|
8
|
+
/** The most events one `events/read` returns. */
|
|
9
|
+
export const EVENTS_READ_MAX = 1000;
|
|
10
|
+
|
|
11
|
+
/** The params of `events/read` (INTERFACES §6). */
|
|
12
|
+
export interface EventsReadParams {
|
|
13
|
+
/** Which events; absent: every event. */
|
|
14
|
+
readonly filter?: EventFilter;
|
|
15
|
+
/** Events after this cursor; absent: from the start. */
|
|
16
|
+
readonly after?: string;
|
|
17
|
+
/** At most this many events (default 100, at most 1000), and about 8 MiB. */
|
|
18
|
+
readonly limit?: number;
|
|
19
|
+
/**
|
|
20
|
+
* When `after` lies inside a compacted range, read on through it instead of being refused with
|
|
21
|
+
* `MOSTRA_HOST_CURSOR_COMPACTED`: the `artifact.compacted` summary arrives in cursor order among
|
|
22
|
+
* the other events, and `compacted` says that events after `after` were lost (DATA_MODEL §4).
|
|
23
|
+
*/
|
|
24
|
+
readonly acceptCompacted?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The result of `events/read`. */
|
|
28
|
+
export interface EventsReadResult {
|
|
29
|
+
/** Matching events in cursor order. */
|
|
30
|
+
readonly events: readonly EventRecord[];
|
|
31
|
+
/** Where the next read continues: everything up to it was examined. */
|
|
32
|
+
readonly cursor: string;
|
|
33
|
+
/**
|
|
34
|
+
* `MOSTRA_HOST_CURSOR_COMPACTED`, when `acceptCompacted` let the read pass a summary of events
|
|
35
|
+
* this reader had partly seen: some events after `after` are gone, and `events` holds the summary.
|
|
36
|
+
*/
|
|
37
|
+
readonly compacted?: Diagnostic;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const params: z.ZodType<EventsReadParams> = z
|
|
41
|
+
.object({
|
|
42
|
+
filter: EventFilter.exactOptional(),
|
|
43
|
+
after: Cursor.schema.exactOptional(),
|
|
44
|
+
limit: z.int().min(1).max(EVENTS_READ_MAX).exactOptional(),
|
|
45
|
+
acceptCompacted: z.boolean().exactOptional(),
|
|
46
|
+
})
|
|
47
|
+
.register(wireRegistry, { id: "EventsReadParams" });
|
|
48
|
+
|
|
49
|
+
const result: z.ZodType<EventsReadResult> = z
|
|
50
|
+
.object({
|
|
51
|
+
events: z.array(EventRecord).readonly(),
|
|
52
|
+
cursor: Cursor.schema,
|
|
53
|
+
compacted: Diagnostic.exactOptional(),
|
|
54
|
+
})
|
|
55
|
+
.register(wireRegistry, { id: "EventsReadResult" });
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* `events/read`: reads durable events after a cursor, in order, without gaps (IN-08). Pass the
|
|
59
|
+
* returned cursor to continue.
|
|
60
|
+
*/
|
|
61
|
+
export const eventsReadMethod: MethodDefinition<EventsReadParams, EventsReadResult> = defineMethod({
|
|
62
|
+
method: "events/read",
|
|
63
|
+
direction: "client-to-instance",
|
|
64
|
+
mutating: false,
|
|
65
|
+
params,
|
|
66
|
+
result,
|
|
67
|
+
});
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.ts";
|
|
3
|
+
import { Cursor } from "../../ids.ts";
|
|
4
|
+
import { EventFilter, EventRecord } from "../../interaction.ts";
|
|
5
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
6
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
7
|
+
|
|
8
|
+
/** The notification that carries a subscription's events. */
|
|
9
|
+
export const EVENTS_NOTIFY = "events/notify";
|
|
10
|
+
|
|
11
|
+
/** The params of `events/subscribe` (INTERFACES §6). */
|
|
12
|
+
export interface EventsSubscribeParams {
|
|
13
|
+
/** Which events; absent: every event. */
|
|
14
|
+
readonly filter?: EventFilter;
|
|
15
|
+
/**
|
|
16
|
+
* Deliver events after this cursor. Absent: after the named subscriber's acknowledged cursor
|
|
17
|
+
* (from the start for a new name), or from now on without a name.
|
|
18
|
+
*/
|
|
19
|
+
readonly after?: string;
|
|
20
|
+
/**
|
|
21
|
+
* A durable subscriber name: `events/ack` keeps its cursor across connections and restarts,
|
|
22
|
+
* and a later subscription with the same name resumes there.
|
|
23
|
+
*/
|
|
24
|
+
readonly name?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** The result of `events/subscribe`. */
|
|
28
|
+
export interface EventsSubscribeResult {
|
|
29
|
+
/** The subscription's ID on this connection, for `events/ack` and `events/unsubscribe`. */
|
|
30
|
+
readonly subscriptionId: string;
|
|
31
|
+
/** Where delivery starts: events after this cursor follow as `events/notify`. */
|
|
32
|
+
readonly cursor: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The params of the `events/notify` notification. */
|
|
36
|
+
export interface EventsNotifyParams {
|
|
37
|
+
/** The subscription the events belong to. */
|
|
38
|
+
readonly subscriptionId: string;
|
|
39
|
+
/** The next matching events, in cursor order. */
|
|
40
|
+
readonly events: readonly EventRecord[];
|
|
41
|
+
/** Everything up to this cursor was examined; acknowledge it once the events are handled. */
|
|
42
|
+
readonly cursor: string;
|
|
43
|
+
/**
|
|
44
|
+
* Set when compaction removed events after this subscription's cursor (DATA_MODEL §4):
|
|
45
|
+
* `MOSTRA_HOST_CURSOR_COMPACTED`, never a silent gap. `events` then holds the `artifact.compacted`
|
|
46
|
+
* summary, and the subscription continues after it.
|
|
47
|
+
*/
|
|
48
|
+
readonly compacted?: Diagnostic;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const params: z.ZodType<EventsSubscribeParams> = z
|
|
52
|
+
.object({
|
|
53
|
+
filter: EventFilter.exactOptional(),
|
|
54
|
+
after: Cursor.schema.exactOptional(),
|
|
55
|
+
name: z
|
|
56
|
+
.string()
|
|
57
|
+
.regex(/^[A-Za-z0-9][A-Za-z0-9._:@-]{0,127}$/)
|
|
58
|
+
.exactOptional(),
|
|
59
|
+
})
|
|
60
|
+
.register(wireRegistry, { id: "EventsSubscribeParams" });
|
|
61
|
+
|
|
62
|
+
const result: z.ZodType<EventsSubscribeResult> = z
|
|
63
|
+
.object({ subscriptionId: z.string().min(1), cursor: Cursor.schema })
|
|
64
|
+
.register(wireRegistry, { id: "EventsSubscribeResult" });
|
|
65
|
+
|
|
66
|
+
/** The Zod schema of the `events/notify` notification's params. */
|
|
67
|
+
export const EventsNotifyParams: z.ZodType<EventsNotifyParams> = z
|
|
68
|
+
.object({
|
|
69
|
+
subscriptionId: z.string().min(1),
|
|
70
|
+
events: z.array(EventRecord).readonly(),
|
|
71
|
+
cursor: Cursor.schema,
|
|
72
|
+
compacted: Diagnostic.exactOptional(),
|
|
73
|
+
})
|
|
74
|
+
.register(wireRegistry, {
|
|
75
|
+
id: "EventsNotifyParams",
|
|
76
|
+
description: "A subscription's next events, in cursor order, and the cursor examined up to.",
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* `events/subscribe`: delivers matching events to this connection as `events/notify`
|
|
81
|
+
* notifications, in cursor order and without gaps (IN-08, H-09). The client must accept
|
|
82
|
+
* `events/notify` in `mostra/initialize`.
|
|
83
|
+
*/
|
|
84
|
+
export const eventsSubscribeMethod: MethodDefinition<EventsSubscribeParams, EventsSubscribeResult> =
|
|
85
|
+
defineMethod({
|
|
86
|
+
method: "events/subscribe",
|
|
87
|
+
direction: "client-to-instance",
|
|
88
|
+
mutating: false,
|
|
89
|
+
params,
|
|
90
|
+
result,
|
|
91
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
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 `events/unsubscribe`. */
|
|
6
|
+
export interface EventsUnsubscribeParams {
|
|
7
|
+
/** The subscription, as `events/subscribe` returned it. */
|
|
8
|
+
readonly subscriptionId: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/** The result of `events/unsubscribe`. */
|
|
12
|
+
export type EventsUnsubscribeResult = Record<string, never>;
|
|
13
|
+
|
|
14
|
+
const params: z.ZodType<EventsUnsubscribeParams> = z
|
|
15
|
+
.object({ subscriptionId: z.string().min(1) })
|
|
16
|
+
.register(wireRegistry, { id: "EventsUnsubscribeParams" });
|
|
17
|
+
|
|
18
|
+
const result: z.ZodType<EventsUnsubscribeResult> = z
|
|
19
|
+
.object({})
|
|
20
|
+
.register(wireRegistry, { id: "EventsUnsubscribeResult" });
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* `events/unsubscribe`: ends a subscription on this connection. A named subscriber's acknowledged
|
|
24
|
+
* cursor stays.
|
|
25
|
+
*/
|
|
26
|
+
export const eventsUnsubscribeMethod: MethodDefinition<
|
|
27
|
+
EventsUnsubscribeParams,
|
|
28
|
+
EventsUnsubscribeResult
|
|
29
|
+
> = defineMethod({
|
|
30
|
+
method: "events/unsubscribe",
|
|
31
|
+
direction: "client-to-instance",
|
|
32
|
+
mutating: false,
|
|
33
|
+
params,
|
|
34
|
+
result,
|
|
35
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.ts";
|
|
3
|
+
import { ArtifactId, VersionId } from "../../ids.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** Event compaction, which `gc/run` does only when asked (D47, DATA_MODEL §4). */
|
|
8
|
+
export interface GcCompactEvents {
|
|
9
|
+
/** Compact every artifact's events before this cursor. */
|
|
10
|
+
readonly before: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The params of `gc/run` (INTERFACES §6, D140 item 18). */
|
|
14
|
+
export interface GcRunParams {
|
|
15
|
+
/** List what a run would remove, and remove nothing. */
|
|
16
|
+
readonly dryRun?: boolean;
|
|
17
|
+
/** Also compact events before a cursor (`mostra gc --compact-events --before <cursor>`). */
|
|
18
|
+
readonly compactEvents?: GcCompactEvents;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** One version gc collects, or would: its files go, its row, ID and number stay (D140). */
|
|
22
|
+
export interface GcVersion {
|
|
23
|
+
/** Its artifact. */
|
|
24
|
+
readonly artifactId: string;
|
|
25
|
+
/** Its ID, which stays in the ledger. */
|
|
26
|
+
readonly versionId: string;
|
|
27
|
+
/** Its number, which stays too. */
|
|
28
|
+
readonly number: number;
|
|
29
|
+
/** The bytes its directory holds. */
|
|
30
|
+
readonly bytes: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** What one kind of collection reclaims. */
|
|
34
|
+
export interface GcCount {
|
|
35
|
+
/** How many items. */
|
|
36
|
+
readonly count: number;
|
|
37
|
+
/** How many bytes. */
|
|
38
|
+
readonly bytes: number;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** What event compaction did, per artifact. */
|
|
42
|
+
export interface GcCompacted {
|
|
43
|
+
/** The artifacts whose events were compacted, with how many events each lost. */
|
|
44
|
+
readonly artifacts: readonly { readonly artifactId: string; readonly removed: number }[];
|
|
45
|
+
/** Every event removed. */
|
|
46
|
+
readonly removed: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** The result of `gc/run`: what it removed, or with `dryRun` what it would remove. */
|
|
50
|
+
export interface GcRunResult {
|
|
51
|
+
/** Whether this was a dry run: then nothing was removed. */
|
|
52
|
+
readonly dryRun: boolean;
|
|
53
|
+
/** The unreferenced versions whose files go. */
|
|
54
|
+
readonly versions: readonly GcVersion[];
|
|
55
|
+
/** Source snapshots no kept version uses. */
|
|
56
|
+
readonly snapshots: GcCount;
|
|
57
|
+
/** Lock layouts in `deps/locks` no working lockfile and no kept version names (D95, D135). */
|
|
58
|
+
readonly lockLayouts: GcCount;
|
|
59
|
+
/** Packages `pnpm store prune` removes from the shared store. */
|
|
60
|
+
readonly storePackages: GcCount;
|
|
61
|
+
/** Build caches past the 5 GB cap, and verify's files no cached verdict names. */
|
|
62
|
+
readonly caches: GcCount;
|
|
63
|
+
/** Every byte reclaimed. */
|
|
64
|
+
readonly bytes: number;
|
|
65
|
+
/** Present when `compactEvents` was given. */
|
|
66
|
+
readonly compacted?: GcCompacted;
|
|
67
|
+
/**
|
|
68
|
+
* A step that couldn't finish (`MOSTRA_HOME_GC_INCOMPLETE`): it left its files in place, and
|
|
69
|
+
* the counts above say what this run did remove. Absent when every step finished.
|
|
70
|
+
*/
|
|
71
|
+
readonly warnings?: readonly Diagnostic[];
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const count = z.object({ count: z.int().min(0), bytes: z.int().min(0) });
|
|
75
|
+
|
|
76
|
+
const params: z.ZodType<GcRunParams> = z
|
|
77
|
+
.object({
|
|
78
|
+
dryRun: z.boolean().exactOptional(),
|
|
79
|
+
compactEvents: z.object({ before: z.string().regex(/^[0-9]+$/) }).exactOptional(),
|
|
80
|
+
})
|
|
81
|
+
.register(wireRegistry, { id: "GcRunParams" });
|
|
82
|
+
|
|
83
|
+
const result: z.ZodType<GcRunResult> = z
|
|
84
|
+
.object({
|
|
85
|
+
dryRun: z.boolean(),
|
|
86
|
+
versions: z
|
|
87
|
+
.array(
|
|
88
|
+
z.object({
|
|
89
|
+
artifactId: ArtifactId.schema,
|
|
90
|
+
versionId: VersionId.schema,
|
|
91
|
+
number: z.int().min(1),
|
|
92
|
+
bytes: z.int().min(0),
|
|
93
|
+
}),
|
|
94
|
+
)
|
|
95
|
+
.readonly(),
|
|
96
|
+
snapshots: count,
|
|
97
|
+
lockLayouts: count,
|
|
98
|
+
storePackages: count,
|
|
99
|
+
caches: count,
|
|
100
|
+
bytes: z.int().min(0),
|
|
101
|
+
compacted: z
|
|
102
|
+
.object({
|
|
103
|
+
artifacts: z
|
|
104
|
+
.array(z.object({ artifactId: ArtifactId.schema, removed: z.int().min(0) }))
|
|
105
|
+
.readonly(),
|
|
106
|
+
removed: z.int().min(0),
|
|
107
|
+
})
|
|
108
|
+
.exactOptional(),
|
|
109
|
+
warnings: z.array(Diagnostic).readonly().exactOptional(),
|
|
110
|
+
})
|
|
111
|
+
.register(wireRegistry, { id: "GcRunResult", description: "What gc reclaimed." });
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* `gc/run`: collects what nothing references (VR-06, D47, D140): versions' files (each keeps its
|
|
115
|
+
* ledger row as a tombstone), unused source snapshots, lock layouts, the shared store's unused
|
|
116
|
+
* packages and caches; with `compactEvents`, it also compacts events before a cursor. A dry run
|
|
117
|
+
* lists exactly what a real run removes. It runs one at a time with publish, verify and installs.
|
|
118
|
+
*/
|
|
119
|
+
export const gcRunMethod: MethodDefinition<GcRunParams, GcRunResult> = defineMethod({
|
|
120
|
+
method: "gc/run",
|
|
121
|
+
direction: "client-to-instance",
|
|
122
|
+
mutating: true,
|
|
123
|
+
params,
|
|
124
|
+
result,
|
|
125
|
+
});
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every host protocol method this package defines. `pnpm gen protocol-method` adds entries at the
|
|
3
|
+
* markers; the method itself lives in its own module under `methods/<group>/`.
|
|
4
|
+
*/
|
|
5
|
+
import type { AnyMethod } from "../method.ts";
|
|
6
|
+
import { artifactCreateMethod } from "./artifact/create.ts";
|
|
7
|
+
import { artifactGetMethod } from "./artifact/get.ts";
|
|
8
|
+
import { artifactListMethod } from "./artifact/list.ts";
|
|
9
|
+
import { artifactPublishMethod } from "./artifact/publish.ts";
|
|
10
|
+
import { artifactVerifyMethod } from "./artifact/verify.ts";
|
|
11
|
+
import { depsAddMethod } from "./deps/add.ts";
|
|
12
|
+
import { devStartMethod } from "./dev/start.ts";
|
|
13
|
+
import { devStopMethod } from "./dev/stop.ts";
|
|
14
|
+
import { eventsAckMethod } from "./events/ack.ts";
|
|
15
|
+
import { eventsReadMethod } from "./events/read.ts";
|
|
16
|
+
import { eventsSubscribeMethod } from "./events/subscribe.ts";
|
|
17
|
+
import { eventsUnsubscribeMethod } from "./events/unsubscribe.ts";
|
|
18
|
+
import { gcRunMethod } from "./gc/run.ts";
|
|
19
|
+
import { instanceCheckMethod } from "./instance/check.ts";
|
|
20
|
+
import { instanceStatusMethod } from "./instance/status.ts";
|
|
21
|
+
import { livePushMethod } from "./live/push.ts";
|
|
22
|
+
import { mostraInitializeMethod } from "./mostra/initialize.ts";
|
|
23
|
+
import { mostraShutdownMethod } from "./mostra/shutdown.ts";
|
|
24
|
+
import { portDraftsMirrorMethod } from "./port/drafts-mirror.ts";
|
|
25
|
+
import { portSecretsGetMethod } from "./port/secrets-get.ts";
|
|
26
|
+
import { portSubmissionsDeliverMethod } from "./port/submissions-deliver.ts";
|
|
27
|
+
import { portTrustedControlsActivatedMethod } from "./port/trusted-controls-activated.ts";
|
|
28
|
+
import { portTrustedControlsPolicyMethod } from "./port/trusted-controls-policy.ts";
|
|
29
|
+
import { resultsGetMethod } from "./results/get.ts";
|
|
30
|
+
import { secretDeleteMethod } from "./secret/delete.ts";
|
|
31
|
+
import { secretListMethod } from "./secret/list.ts";
|
|
32
|
+
import { secretSetMethod } from "./secret/set.ts";
|
|
33
|
+
import { stateGetMethod } from "./state/get.ts";
|
|
34
|
+
import { statePatchMethod } from "./state/patch.ts";
|
|
35
|
+
import { viewDefaultMethod } from "./view/default.ts";
|
|
36
|
+
import { viewLaunchMethod } from "./view/launch.ts";
|
|
37
|
+
import { viewRevokeMethod } from "./view/revoke.ts";
|
|
38
|
+
import { viewRotateMethod } from "./view/rotate.ts";
|
|
39
|
+
import { viewUrlMethod } from "./view/url.ts";
|
|
40
|
+
import { waitMethod } from "./wait/wait.ts";
|
|
41
|
+
// gen:method-imports
|
|
42
|
+
|
|
43
|
+
/** Every host protocol method, in the order they were added. */
|
|
44
|
+
export const hostMethods: readonly AnyMethod[] = [
|
|
45
|
+
mostraInitializeMethod,
|
|
46
|
+
mostraShutdownMethod,
|
|
47
|
+
instanceStatusMethod,
|
|
48
|
+
artifactCreateMethod,
|
|
49
|
+
artifactPublishMethod,
|
|
50
|
+
artifactListMethod,
|
|
51
|
+
artifactGetMethod,
|
|
52
|
+
depsAddMethod,
|
|
53
|
+
viewUrlMethod,
|
|
54
|
+
viewRevokeMethod,
|
|
55
|
+
viewRotateMethod,
|
|
56
|
+
stateGetMethod,
|
|
57
|
+
resultsGetMethod,
|
|
58
|
+
waitMethod,
|
|
59
|
+
eventsReadMethod,
|
|
60
|
+
eventsSubscribeMethod,
|
|
61
|
+
eventsUnsubscribeMethod,
|
|
62
|
+
statePatchMethod,
|
|
63
|
+
eventsAckMethod,
|
|
64
|
+
portSubmissionsDeliverMethod,
|
|
65
|
+
portDraftsMirrorMethod,
|
|
66
|
+
portTrustedControlsPolicyMethod,
|
|
67
|
+
portTrustedControlsActivatedMethod,
|
|
68
|
+
secretSetMethod,
|
|
69
|
+
secretListMethod,
|
|
70
|
+
secretDeleteMethod,
|
|
71
|
+
livePushMethod,
|
|
72
|
+
portSecretsGetMethod,
|
|
73
|
+
artifactVerifyMethod,
|
|
74
|
+
viewDefaultMethod,
|
|
75
|
+
viewLaunchMethod,
|
|
76
|
+
gcRunMethod,
|
|
77
|
+
instanceCheckMethod,
|
|
78
|
+
devStartMethod,
|
|
79
|
+
devStopMethod,
|
|
80
|
+
// gen:methods
|
|
81
|
+
];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.ts";
|
|
3
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
4
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `instance/check` (INTERFACES §6, D140 item 18). */
|
|
7
|
+
export interface InstanceCheckParams {
|
|
8
|
+
/** Also hash every version directory against its `outputDigest` (`mostra doctor --deep`). */
|
|
9
|
+
readonly deep?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** One check's outcome. */
|
|
13
|
+
export interface InstanceCheck {
|
|
14
|
+
/** What was checked: `ledger`, `versions`, `ports`, `browser`, `shell`, `warm` and so on. */
|
|
15
|
+
readonly name: string;
|
|
16
|
+
/** `ok`, or how serious what it found is. */
|
|
17
|
+
readonly status: "ok" | "warning" | "error";
|
|
18
|
+
/** What is wrong and what to do, for a warning or an error. */
|
|
19
|
+
readonly diagnostic?: Diagnostic;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The result of `instance/check`. */
|
|
23
|
+
export interface InstanceCheckResult {
|
|
24
|
+
/** Every check, in the order it ran. */
|
|
25
|
+
readonly checks: readonly InstanceCheck[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const params: z.ZodType<InstanceCheckParams> = z
|
|
29
|
+
.object({ deep: z.boolean().exactOptional() })
|
|
30
|
+
.register(wireRegistry, { id: "InstanceCheckParams" });
|
|
31
|
+
|
|
32
|
+
const result: z.ZodType<InstanceCheckResult> = z
|
|
33
|
+
.object({
|
|
34
|
+
checks: z
|
|
35
|
+
.array(
|
|
36
|
+
z.object({
|
|
37
|
+
name: z.string().min(1),
|
|
38
|
+
status: z.enum(["ok", "warning", "error"]),
|
|
39
|
+
diagnostic: Diagnostic.exactOptional(),
|
|
40
|
+
}),
|
|
41
|
+
)
|
|
42
|
+
.readonly(),
|
|
43
|
+
})
|
|
44
|
+
.register(wireRegistry, {
|
|
45
|
+
id: "InstanceCheckResult",
|
|
46
|
+
description: "The supervisor's own checks of its home.",
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `instance/check`: the checks only the supervisor can run, because it holds the ledger's lock
|
|
51
|
+
* (D81): the ledger's integrity, the version store, leased ports another program holds, and the
|
|
52
|
+
* runtime's browser, shell and warm set. `mostra doctor` adds the checks a client runs itself.
|
|
53
|
+
*/
|
|
54
|
+
export const instanceCheckMethod: MethodDefinition<InstanceCheckParams, InstanceCheckResult> =
|
|
55
|
+
defineMethod({
|
|
56
|
+
method: "instance/check",
|
|
57
|
+
direction: "client-to-instance",
|
|
58
|
+
mutating: false,
|
|
59
|
+
params,
|
|
60
|
+
result,
|
|
61
|
+
});
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
3
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
4
|
+
import { InstanceInfo } from "../mostra/initialize.ts";
|
|
5
|
+
|
|
6
|
+
/** The params of `instance/status` (INTERFACES §6): none. */
|
|
7
|
+
export type InstanceStatusParams = Record<string, never>;
|
|
8
|
+
|
|
9
|
+
/** One child process the instance supervises. */
|
|
10
|
+
export interface ChildProcessStatus {
|
|
11
|
+
/** The process ID. The child leads its own process group, so this is also its group ID. */
|
|
12
|
+
readonly pid: number;
|
|
13
|
+
/** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */
|
|
14
|
+
readonly kind: string;
|
|
15
|
+
/** What the child serves, such as an artifact or version ID. */
|
|
16
|
+
readonly ownerRef: string;
|
|
17
|
+
/** When the instance started it (RFC 3339, UTC). */
|
|
18
|
+
readonly startedAt: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Where the gateway listens (D99, WP-05). */
|
|
22
|
+
export interface GatewayStatus {
|
|
23
|
+
/** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */
|
|
24
|
+
readonly bind: string;
|
|
25
|
+
/** The shell's origin, where every capability link points. */
|
|
26
|
+
readonly shell: string;
|
|
27
|
+
/** The artifact origins it is serving now, one per opened artifact. */
|
|
28
|
+
readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The result of `instance/status`. The packages that add ports, deliveries, shares and versions
|
|
33
|
+
* add their fields here (INTERFACES §6).
|
|
34
|
+
*/
|
|
35
|
+
export interface InstanceStatusResult {
|
|
36
|
+
/** The instance itself. */
|
|
37
|
+
readonly instance: InstanceInfo;
|
|
38
|
+
/** When the instance took ownership of its home (RFC 3339, UTC). */
|
|
39
|
+
readonly startedAt: string;
|
|
40
|
+
/** The control socket clients attach to. */
|
|
41
|
+
readonly socket: string;
|
|
42
|
+
/** How many protocol connections are open, this one included. */
|
|
43
|
+
readonly connections: number;
|
|
44
|
+
/** The child processes the instance supervises. */
|
|
45
|
+
readonly processes: readonly ChildProcessStatus[];
|
|
46
|
+
/** Where the gateway listens, once it has started (WP-05). */
|
|
47
|
+
readonly gateway?: GatewayStatus;
|
|
48
|
+
/** The outbox per host (WP-06, D105): how many deliveries are in each state. */
|
|
49
|
+
readonly deliveries?: readonly DeliveryCounts[];
|
|
50
|
+
/** The artifact workers, one per active version with server code (WP-08, RT-03). */
|
|
51
|
+
readonly workers?: readonly WorkerStatus[];
|
|
52
|
+
/** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */
|
|
53
|
+
readonly idleExitAt?: string;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** One artifact version's worker (RT-03, D62). */
|
|
57
|
+
export interface WorkerStatus {
|
|
58
|
+
/** The artifact. */
|
|
59
|
+
readonly artifactId: string;
|
|
60
|
+
/** The version. */
|
|
61
|
+
readonly versionId: string;
|
|
62
|
+
/**
|
|
63
|
+
* `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),
|
|
64
|
+
* `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.
|
|
65
|
+
*/
|
|
66
|
+
readonly state: "starting" | "ready" | "backoff" | "parked" | "stopped";
|
|
67
|
+
/** The worker's process, while it runs locally. */
|
|
68
|
+
readonly pid?: number;
|
|
69
|
+
/** Crashes in the last 10 minutes. */
|
|
70
|
+
readonly crashes: number;
|
|
71
|
+
/** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */
|
|
72
|
+
readonly lastCause?: string;
|
|
73
|
+
/** When a worker in `backoff` may start again. */
|
|
74
|
+
readonly retryAt?: string;
|
|
75
|
+
/** Calls, runs and live producers it serves now. */
|
|
76
|
+
readonly active: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** The Zod schema of the `WorkerStatus` type. */
|
|
80
|
+
export const WorkerStatus: z.ZodType<WorkerStatus> = z
|
|
81
|
+
.object({
|
|
82
|
+
artifactId: z.string(),
|
|
83
|
+
versionId: z.string(),
|
|
84
|
+
state: z.enum(["starting", "ready", "backoff", "parked", "stopped"]),
|
|
85
|
+
pid: z.int().min(1).exactOptional(),
|
|
86
|
+
crashes: z.int().min(0),
|
|
87
|
+
lastCause: z.string().exactOptional(),
|
|
88
|
+
retryAt: z.string().exactOptional(),
|
|
89
|
+
active: z.int().min(0),
|
|
90
|
+
})
|
|
91
|
+
.register(wireRegistry, { id: "WorkerStatus", description: "One artifact version's worker." });
|
|
92
|
+
|
|
93
|
+
/** One host's deliveries by state (D105). */
|
|
94
|
+
export interface DeliveryCounts {
|
|
95
|
+
/** The host's client name; empty for Mostra's built-in adapter (D105). */
|
|
96
|
+
readonly owner: string;
|
|
97
|
+
/** Whether a connection of this host has the submissions port registered now. */
|
|
98
|
+
readonly connected: boolean;
|
|
99
|
+
/** Deliveries not yet answered terminally. */
|
|
100
|
+
readonly pending: number;
|
|
101
|
+
/** Deliveries the host accepted. */
|
|
102
|
+
readonly delivered: number;
|
|
103
|
+
/** Deliveries the host rejected terminally. */
|
|
104
|
+
readonly rejected: number;
|
|
105
|
+
/** Deliveries the host declared undeliverable. */
|
|
106
|
+
readonly undeliverable: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The Zod schema of the `DeliveryCounts` type. */
|
|
110
|
+
export const DeliveryCounts: z.ZodType<DeliveryCounts> = z
|
|
111
|
+
.object({
|
|
112
|
+
owner: z.string(),
|
|
113
|
+
connected: z.boolean(),
|
|
114
|
+
pending: z.int().min(0),
|
|
115
|
+
delivered: z.int().min(0),
|
|
116
|
+
rejected: z.int().min(0),
|
|
117
|
+
undeliverable: z.int().min(0),
|
|
118
|
+
})
|
|
119
|
+
.register(wireRegistry, {
|
|
120
|
+
id: "DeliveryCounts",
|
|
121
|
+
description: "One host's deliveries by state, and whether it is connected.",
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
/** The Zod schema of the `GatewayStatus` type. */
|
|
125
|
+
export const GatewayStatus: z.ZodType<GatewayStatus> = z
|
|
126
|
+
.object({
|
|
127
|
+
bind: z.string(),
|
|
128
|
+
shell: z.string(),
|
|
129
|
+
artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),
|
|
130
|
+
})
|
|
131
|
+
.register(wireRegistry, { id: "GatewayStatus", description: "Where the gateway listens." });
|
|
132
|
+
|
|
133
|
+
/** The Zod schema of the `ChildProcessStatus` type. */
|
|
134
|
+
export const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z
|
|
135
|
+
.object({
|
|
136
|
+
pid: z.int().min(1),
|
|
137
|
+
kind: z.string(),
|
|
138
|
+
ownerRef: z.string(),
|
|
139
|
+
startedAt: z.iso.datetime(),
|
|
140
|
+
})
|
|
141
|
+
.register(wireRegistry, {
|
|
142
|
+
id: "ChildProcessStatus",
|
|
143
|
+
description: "One child process the instance supervises.",
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
const params: z.ZodType<InstanceStatusParams> = z
|
|
147
|
+
.object({})
|
|
148
|
+
.register(wireRegistry, { id: "InstanceStatusParams" });
|
|
149
|
+
|
|
150
|
+
const result: z.ZodType<InstanceStatusResult> = z
|
|
151
|
+
.object({
|
|
152
|
+
instance: InstanceInfo,
|
|
153
|
+
startedAt: z.iso.datetime(),
|
|
154
|
+
socket: z.string(),
|
|
155
|
+
connections: z.int().min(0),
|
|
156
|
+
processes: z.array(ChildProcessStatus).readonly(),
|
|
157
|
+
gateway: GatewayStatus.exactOptional(),
|
|
158
|
+
deliveries: z.array(DeliveryCounts).readonly().exactOptional(),
|
|
159
|
+
workers: z.array(WorkerStatus).readonly().exactOptional(),
|
|
160
|
+
idleExitAt: z.string().exactOptional(),
|
|
161
|
+
})
|
|
162
|
+
.register(wireRegistry, { id: "InstanceStatusResult" });
|
|
163
|
+
|
|
164
|
+
/** `instance/status`: reports the instance, its socket, its connections and its child processes. */
|
|
165
|
+
export const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =
|
|
166
|
+
defineMethod({
|
|
167
|
+
method: "instance/status",
|
|
168
|
+
direction: "client-to-instance",
|
|
169
|
+
mutating: false,
|
|
170
|
+
params,
|
|
171
|
+
result,
|
|
172
|
+
});
|