@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,102 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
import { InstanceInfo } from "../mostra/initialize.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/methods/instance/status.d.ts
|
|
5
|
+
/** The params of `instance/status` (INTERFACES §6): none. */
|
|
6
|
+
export type InstanceStatusParams = Record<string, never>;
|
|
7
|
+
/** One child process the instance supervises. */
|
|
8
|
+
export interface ChildProcessStatus {
|
|
9
|
+
/** The process ID. The child leads its own process group, so this is also its group ID. */
|
|
10
|
+
readonly pid: number;
|
|
11
|
+
/** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */
|
|
12
|
+
readonly kind: string;
|
|
13
|
+
/** What the child serves, such as an artifact or version ID. */
|
|
14
|
+
readonly ownerRef: string;
|
|
15
|
+
/** When the instance started it (RFC 3339, UTC). */
|
|
16
|
+
readonly startedAt: string;
|
|
17
|
+
}
|
|
18
|
+
/** Where the gateway listens (D99, WP-05). */
|
|
19
|
+
export interface GatewayStatus {
|
|
20
|
+
/** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */
|
|
21
|
+
readonly bind: string;
|
|
22
|
+
/** The shell's origin, where every capability link points. */
|
|
23
|
+
readonly shell: string;
|
|
24
|
+
/** The artifact origins it is serving now, one per opened artifact. */
|
|
25
|
+
readonly artifacts: readonly {
|
|
26
|
+
readonly artifactId: string;
|
|
27
|
+
readonly origin: string;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The result of `instance/status`. The packages that add ports, deliveries, shares and versions
|
|
32
|
+
* add their fields here (INTERFACES §6).
|
|
33
|
+
*/
|
|
34
|
+
export interface InstanceStatusResult {
|
|
35
|
+
/** The instance itself. */
|
|
36
|
+
readonly instance: InstanceInfo;
|
|
37
|
+
/** When the instance took ownership of its home (RFC 3339, UTC). */
|
|
38
|
+
readonly startedAt: string;
|
|
39
|
+
/** The control socket clients attach to. */
|
|
40
|
+
readonly socket: string;
|
|
41
|
+
/** How many protocol connections are open, this one included. */
|
|
42
|
+
readonly connections: number;
|
|
43
|
+
/** The child processes the instance supervises. */
|
|
44
|
+
readonly processes: readonly ChildProcessStatus[];
|
|
45
|
+
/** Where the gateway listens, once it has started (WP-05). */
|
|
46
|
+
readonly gateway?: GatewayStatus;
|
|
47
|
+
/** The outbox per host (WP-06, D105): how many deliveries are in each state. */
|
|
48
|
+
readonly deliveries?: readonly DeliveryCounts[];
|
|
49
|
+
/** The artifact workers, one per active version with server code (WP-08, RT-03). */
|
|
50
|
+
readonly workers?: readonly WorkerStatus[];
|
|
51
|
+
/** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */
|
|
52
|
+
readonly idleExitAt?: string;
|
|
53
|
+
}
|
|
54
|
+
/** One artifact version's worker (RT-03, D62). */
|
|
55
|
+
export interface WorkerStatus {
|
|
56
|
+
/** The artifact. */
|
|
57
|
+
readonly artifactId: string;
|
|
58
|
+
/** The version. */
|
|
59
|
+
readonly versionId: string;
|
|
60
|
+
/**
|
|
61
|
+
* `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),
|
|
62
|
+
* `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.
|
|
63
|
+
*/
|
|
64
|
+
readonly state: "starting" | "ready" | "backoff" | "parked" | "stopped";
|
|
65
|
+
/** The worker's process, while it runs locally. */
|
|
66
|
+
readonly pid?: number;
|
|
67
|
+
/** Crashes in the last 10 minutes. */
|
|
68
|
+
readonly crashes: number;
|
|
69
|
+
/** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */
|
|
70
|
+
readonly lastCause?: string;
|
|
71
|
+
/** When a worker in `backoff` may start again. */
|
|
72
|
+
readonly retryAt?: string;
|
|
73
|
+
/** Calls, runs and live producers it serves now. */
|
|
74
|
+
readonly active: number;
|
|
75
|
+
}
|
|
76
|
+
/** The Zod schema of the `WorkerStatus` type. */
|
|
77
|
+
export declare const WorkerStatus: z.ZodType<WorkerStatus>;
|
|
78
|
+
/** One host's deliveries by state (D105). */
|
|
79
|
+
export interface DeliveryCounts {
|
|
80
|
+
/** The host's client name; empty for Mostra's built-in adapter (D105). */
|
|
81
|
+
readonly owner: string;
|
|
82
|
+
/** Whether a connection of this host has the submissions port registered now. */
|
|
83
|
+
readonly connected: boolean;
|
|
84
|
+
/** Deliveries not yet answered terminally. */
|
|
85
|
+
readonly pending: number;
|
|
86
|
+
/** Deliveries the host accepted. */
|
|
87
|
+
readonly delivered: number;
|
|
88
|
+
/** Deliveries the host rejected terminally. */
|
|
89
|
+
readonly rejected: number;
|
|
90
|
+
/** Deliveries the host declared undeliverable. */
|
|
91
|
+
readonly undeliverable: number;
|
|
92
|
+
}
|
|
93
|
+
/** The Zod schema of the `DeliveryCounts` type. */
|
|
94
|
+
export declare const DeliveryCounts: z.ZodType<DeliveryCounts>;
|
|
95
|
+
/** The Zod schema of the `GatewayStatus` type. */
|
|
96
|
+
export declare const GatewayStatus: z.ZodType<GatewayStatus>;
|
|
97
|
+
/** The Zod schema of the `ChildProcessStatus` type. */
|
|
98
|
+
export declare const ChildProcessStatus: z.ZodType<ChildProcessStatus>;
|
|
99
|
+
/** `instance/status`: reports the instance, its socket, its connections and its child processes. */
|
|
100
|
+
export declare const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult>;
|
|
101
|
+
//#endregion
|
|
102
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","names":[],"sources":["../../../src/methods/instance/status.ts"],"mappings":";;;;;YAMY,uBAAuB;;iBAGlB;;WAEN;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA;aAA+B;aAA6B;;;;;;;iBAOtD;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA,oBAAoB;;WAEpB,UAAU;;WAEV,sBAAsB;;WAEtB,mBAAmB;;WAEnB;;;iBAIM;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,cAAc,EAAE,QAAQ;;iBAcpB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,gBAAgB,EAAE,QAAQ;;qBAe1B,eAAe,EAAE,QAAQ;;qBASzB,oBAAoB,EAAE,QAAQ;;qBA+B9B,sBAAsB,iBAAiB,sBAAsB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import { InstanceInfo } from "../mostra/initialize.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/methods/instance/status.ts
|
|
6
|
+
/** The Zod schema of the `WorkerStatus` type. */
|
|
7
|
+
const WorkerStatus = z.object({
|
|
8
|
+
artifactId: z.string(),
|
|
9
|
+
versionId: z.string(),
|
|
10
|
+
state: z.enum([
|
|
11
|
+
"starting",
|
|
12
|
+
"ready",
|
|
13
|
+
"backoff",
|
|
14
|
+
"parked",
|
|
15
|
+
"stopped"
|
|
16
|
+
]),
|
|
17
|
+
pid: z.int().min(1).exactOptional(),
|
|
18
|
+
crashes: z.int().min(0),
|
|
19
|
+
lastCause: z.string().exactOptional(),
|
|
20
|
+
retryAt: z.string().exactOptional(),
|
|
21
|
+
active: z.int().min(0)
|
|
22
|
+
}).register(wireRegistry, {
|
|
23
|
+
id: "WorkerStatus",
|
|
24
|
+
description: "One artifact version's worker."
|
|
25
|
+
});
|
|
26
|
+
/** The Zod schema of the `DeliveryCounts` type. */
|
|
27
|
+
const DeliveryCounts = z.object({
|
|
28
|
+
owner: z.string(),
|
|
29
|
+
connected: z.boolean(),
|
|
30
|
+
pending: z.int().min(0),
|
|
31
|
+
delivered: z.int().min(0),
|
|
32
|
+
rejected: z.int().min(0),
|
|
33
|
+
undeliverable: z.int().min(0)
|
|
34
|
+
}).register(wireRegistry, {
|
|
35
|
+
id: "DeliveryCounts",
|
|
36
|
+
description: "One host's deliveries by state, and whether it is connected."
|
|
37
|
+
});
|
|
38
|
+
/** The Zod schema of the `GatewayStatus` type. */
|
|
39
|
+
const GatewayStatus = z.object({
|
|
40
|
+
bind: z.string(),
|
|
41
|
+
shell: z.string(),
|
|
42
|
+
artifacts: z.array(z.object({
|
|
43
|
+
artifactId: z.string(),
|
|
44
|
+
origin: z.string()
|
|
45
|
+
})).readonly()
|
|
46
|
+
}).register(wireRegistry, {
|
|
47
|
+
id: "GatewayStatus",
|
|
48
|
+
description: "Where the gateway listens."
|
|
49
|
+
});
|
|
50
|
+
/** The Zod schema of the `ChildProcessStatus` type. */
|
|
51
|
+
const ChildProcessStatus = z.object({
|
|
52
|
+
pid: z.int().min(1),
|
|
53
|
+
kind: z.string(),
|
|
54
|
+
ownerRef: z.string(),
|
|
55
|
+
startedAt: z.iso.datetime()
|
|
56
|
+
}).register(wireRegistry, {
|
|
57
|
+
id: "ChildProcessStatus",
|
|
58
|
+
description: "One child process the instance supervises."
|
|
59
|
+
});
|
|
60
|
+
const params = z.object({}).register(wireRegistry, { id: "InstanceStatusParams" });
|
|
61
|
+
const result = z.object({
|
|
62
|
+
instance: InstanceInfo,
|
|
63
|
+
startedAt: z.iso.datetime(),
|
|
64
|
+
socket: z.string(),
|
|
65
|
+
connections: z.int().min(0),
|
|
66
|
+
processes: z.array(ChildProcessStatus).readonly(),
|
|
67
|
+
gateway: GatewayStatus.exactOptional(),
|
|
68
|
+
deliveries: z.array(DeliveryCounts).readonly().exactOptional(),
|
|
69
|
+
workers: z.array(WorkerStatus).readonly().exactOptional(),
|
|
70
|
+
idleExitAt: z.string().exactOptional()
|
|
71
|
+
}).register(wireRegistry, { id: "InstanceStatusResult" });
|
|
72
|
+
/** `instance/status`: reports the instance, its socket, its connections and its child processes. */
|
|
73
|
+
const instanceStatusMethod = defineMethod({
|
|
74
|
+
method: "instance/status",
|
|
75
|
+
direction: "client-to-instance",
|
|
76
|
+
mutating: false,
|
|
77
|
+
params,
|
|
78
|
+
result
|
|
79
|
+
});
|
|
80
|
+
//#endregion
|
|
81
|
+
export { ChildProcessStatus, DeliveryCounts, GatewayStatus, WorkerStatus, instanceStatusMethod };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.js","names":[],"sources":["../../../src/methods/instance/status.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\nimport { InstanceInfo } from \"../mostra/initialize.ts\";\n\n/** The params of `instance/status` (INTERFACES §6): none. */\nexport type InstanceStatusParams = Record<string, never>;\n\n/** One child process the instance supervises. */\nexport interface ChildProcessStatus {\n /** The process ID. The child leads its own process group, so this is also its group ID. */\n readonly pid: number;\n /** What the child is: `builder`, `verify`, `worker`, `pty-host`, `demo`, `install` and so on. */\n readonly kind: string;\n /** What the child serves, such as an artifact or version ID. */\n readonly ownerRef: string;\n /** When the instance started it (RFC 3339, UTC). */\n readonly startedAt: string;\n}\n\n/** Where the gateway listens (D99, WP-05). */\nexport interface GatewayStatus {\n /** The address its listeners bind: `127.0.0.1` unless the instance started with `--bind`. */\n readonly bind: string;\n /** The shell's origin, where every capability link points. */\n readonly shell: string;\n /** The artifact origins it is serving now, one per opened artifact. */\n readonly artifacts: readonly { readonly artifactId: string; readonly origin: string }[];\n}\n\n/**\n * The result of `instance/status`. The packages that add ports, deliveries, shares and versions\n * add their fields here (INTERFACES §6).\n */\nexport interface InstanceStatusResult {\n /** The instance itself. */\n readonly instance: InstanceInfo;\n /** When the instance took ownership of its home (RFC 3339, UTC). */\n readonly startedAt: string;\n /** The control socket clients attach to. */\n readonly socket: string;\n /** How many protocol connections are open, this one included. */\n readonly connections: number;\n /** The child processes the instance supervises. */\n readonly processes: readonly ChildProcessStatus[];\n /** Where the gateway listens, once it has started (WP-05). */\n readonly gateway?: GatewayStatus;\n /** The outbox per host (WP-06, D105): how many deliveries are in each state. */\n readonly deliveries?: readonly DeliveryCounts[];\n /** The artifact workers, one per active version with server code (WP-08, RT-03). */\n readonly workers?: readonly WorkerStatus[];\n /** When the daemon exits for lack of work, if it will (WP-08, RT-08); absent: it won't. */\n readonly idleExitAt?: string;\n}\n\n/** One artifact version's worker (RT-03, D62). */\nexport interface WorkerStatus {\n /** The artifact. */\n readonly artifactId: string;\n /** The version. */\n readonly versionId: string;\n /**\n * `starting`, `ready`, `backoff` (it crashed and restarts on the next request after `retryAt`),\n * `parked` (it crashed more than 5 times in 10 minutes, FAILURE_MODEL §2), `stopped`.\n */\n readonly state: \"starting\" | \"ready\" | \"backoff\" | \"parked\" | \"stopped\";\n /** The worker's process, while it runs locally. */\n readonly pid?: number;\n /** Crashes in the last 10 minutes. */\n readonly crashes: number;\n /** The last crash's cause, such as `out of memory` or `event loop blocked for 10 s`. */\n readonly lastCause?: string;\n /** When a worker in `backoff` may start again. */\n readonly retryAt?: string;\n /** Calls, runs and live producers it serves now. */\n readonly active: number;\n}\n\n/** The Zod schema of the `WorkerStatus` type. */\nexport const WorkerStatus: z.ZodType<WorkerStatus> = z\n .object({\n artifactId: z.string(),\n versionId: z.string(),\n state: z.enum([\"starting\", \"ready\", \"backoff\", \"parked\", \"stopped\"]),\n pid: z.int().min(1).exactOptional(),\n crashes: z.int().min(0),\n lastCause: z.string().exactOptional(),\n retryAt: z.string().exactOptional(),\n active: z.int().min(0),\n })\n .register(wireRegistry, { id: \"WorkerStatus\", description: \"One artifact version's worker.\" });\n\n/** One host's deliveries by state (D105). */\nexport interface DeliveryCounts {\n /** The host's client name; empty for Mostra's built-in adapter (D105). */\n readonly owner: string;\n /** Whether a connection of this host has the submissions port registered now. */\n readonly connected: boolean;\n /** Deliveries not yet answered terminally. */\n readonly pending: number;\n /** Deliveries the host accepted. */\n readonly delivered: number;\n /** Deliveries the host rejected terminally. */\n readonly rejected: number;\n /** Deliveries the host declared undeliverable. */\n readonly undeliverable: number;\n}\n\n/** The Zod schema of the `DeliveryCounts` type. */\nexport const DeliveryCounts: z.ZodType<DeliveryCounts> = z\n .object({\n owner: z.string(),\n connected: z.boolean(),\n pending: z.int().min(0),\n delivered: z.int().min(0),\n rejected: z.int().min(0),\n undeliverable: z.int().min(0),\n })\n .register(wireRegistry, {\n id: \"DeliveryCounts\",\n description: \"One host's deliveries by state, and whether it is connected.\",\n });\n\n/** The Zod schema of the `GatewayStatus` type. */\nexport const GatewayStatus: z.ZodType<GatewayStatus> = z\n .object({\n bind: z.string(),\n shell: z.string(),\n artifacts: z.array(z.object({ artifactId: z.string(), origin: z.string() })).readonly(),\n })\n .register(wireRegistry, { id: \"GatewayStatus\", description: \"Where the gateway listens.\" });\n\n/** The Zod schema of the `ChildProcessStatus` type. */\nexport const ChildProcessStatus: z.ZodType<ChildProcessStatus> = z\n .object({\n pid: z.int().min(1),\n kind: z.string(),\n ownerRef: z.string(),\n startedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"ChildProcessStatus\",\n description: \"One child process the instance supervises.\",\n });\n\nconst params: z.ZodType<InstanceStatusParams> = z\n .object({})\n .register(wireRegistry, { id: \"InstanceStatusParams\" });\n\nconst result: z.ZodType<InstanceStatusResult> = z\n .object({\n instance: InstanceInfo,\n startedAt: z.iso.datetime(),\n socket: z.string(),\n connections: z.int().min(0),\n processes: z.array(ChildProcessStatus).readonly(),\n gateway: GatewayStatus.exactOptional(),\n deliveries: z.array(DeliveryCounts).readonly().exactOptional(),\n workers: z.array(WorkerStatus).readonly().exactOptional(),\n idleExitAt: z.string().exactOptional(),\n })\n .register(wireRegistry, { id: \"InstanceStatusResult\" });\n\n/** `instance/status`: reports the instance, its socket, its connections and its child processes. */\nexport const instanceStatusMethod: MethodDefinition<InstanceStatusParams, InstanceStatusResult> =\n defineMethod({\n method: \"instance/status\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;;;AA+EA,MAAa,eAAwC,EAClD,OAAO;CACN,YAAY,EAAE,OAAO;CACrB,WAAW,EAAE,OAAO;CACpB,OAAO,EAAE,KAAK;EAAC;EAAY;EAAS;EAAW;EAAU;CAAS,CAAC;CACnE,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAClC,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,OAAO,CAAC,CAAC,cAAc;CACpC,SAAS,EAAE,OAAO,CAAC,CAAC,cAAc;CAClC,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACvB,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAgB,aAAa;AAAiC,CAAC;;AAmB/F,MAAa,iBAA4C,EACtD,OAAO;CACN,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,QAAQ;CACrB,SAAS,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACtB,WAAW,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACxB,UAAU,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CACvB,eAAe,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAC9B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,gBAA0C,EACpD,OAAO;CACN,MAAM,EAAE,OAAO;CACf,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,MAAM,EAAE,OAAO;EAAE,YAAY,EAAE,OAAO;EAAG,QAAQ,EAAE,OAAO;CAAE,CAAC,CAAC,CAAC,CAAC,SAAS;AACxF,CAAC,CAAC,CACD,SAAS,cAAc;CAAE,IAAI;CAAiB,aAAa;AAA6B,CAAC;;AAG5F,MAAa,qBAAoD,EAC9D,OAAO;CACN,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,WAAW,EAAE,IAAI,SAAS;AAC5B,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO;CACN,UAAU;CACV,WAAW,EAAE,IAAI,SAAS;CAC1B,QAAQ,EAAE,OAAO;CACjB,aAAa,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAC1B,WAAW,EAAE,MAAM,kBAAkB,CAAC,CAAC,SAAS;CAChD,SAAS,cAAc,cAAc;CACrC,YAAY,EAAE,MAAM,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC7D,SAAS,EAAE,MAAM,YAAY,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CACxD,YAAY,EAAE,OAAO,CAAC,CAAC,cAAc;AACvC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;AAGxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ArtifactRef } from "../../artifact.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
//#region src/methods/live/push.d.ts
|
|
4
|
+
/** The params of `live/push` (INTERFACES §6, D56). */
|
|
5
|
+
export interface LivePushParams {
|
|
6
|
+
/** The artifact. */
|
|
7
|
+
readonly artifact: ArtifactRef;
|
|
8
|
+
/** The live source's key; a key `live.ts` doesn't define is created by the push. */
|
|
9
|
+
readonly key: string;
|
|
10
|
+
/** Any JSON, at most 4 MiB. */
|
|
11
|
+
readonly value: unknown;
|
|
12
|
+
/** `replace` (default): the new latest value. `append`: also kept in the source's ring. */
|
|
13
|
+
readonly mode?: "replace" | "append";
|
|
14
|
+
/** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
|
|
15
|
+
readonly requestId?: string;
|
|
16
|
+
}
|
|
17
|
+
/** The result of `live/push`. */
|
|
18
|
+
export interface LivePushResult {
|
|
19
|
+
/** The value's revision. */
|
|
20
|
+
readonly revision: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* `live/push`: writes a value into an artifact's live source (D56), which every open page reading
|
|
24
|
+
* it receives at once. The latest value persists; updates are never stored as events (D63).
|
|
25
|
+
*/
|
|
26
|
+
export declare const livePushMethod: MethodDefinition<LivePushParams, LivePushResult>;
|
|
27
|
+
//#endregion
|
|
28
|
+
//# sourceMappingURL=push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.d.ts","names":[],"sources":["../../../src/methods/live/push.ts"],"mappings":";;;;iBAOiB;;WAEN,UAAU;;WAEV;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;;;;;qBAwBE,gBAAgB,iBAAiB,gBAAgB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { LIVE_KEY_PATTERN } from "../../actions.js";
|
|
3
|
+
import { ArtifactRef } from "../../artifact.js";
|
|
4
|
+
import { defineMethod } from "../../method.js";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/methods/live/push.ts
|
|
7
|
+
const params = z.object({
|
|
8
|
+
artifact: ArtifactRef,
|
|
9
|
+
key: z.string().regex(LIVE_KEY_PATTERN),
|
|
10
|
+
value: z.unknown(),
|
|
11
|
+
mode: z.enum(["replace", "append"]).exactOptional(),
|
|
12
|
+
requestId: z.string().min(1).exactOptional()
|
|
13
|
+
}).register(wireRegistry, {
|
|
14
|
+
id: "LivePushParams",
|
|
15
|
+
description: "A value pushed into an artifact's live source."
|
|
16
|
+
});
|
|
17
|
+
const result = z.object({ revision: z.string() }).register(wireRegistry, {
|
|
18
|
+
id: "LivePushResult",
|
|
19
|
+
description: "The pushed value's revision."
|
|
20
|
+
});
|
|
21
|
+
/**
|
|
22
|
+
* `live/push`: writes a value into an artifact's live source (D56), which every open page reading
|
|
23
|
+
* it receives at once. The latest value persists; updates are never stored as events (D63).
|
|
24
|
+
*/
|
|
25
|
+
const livePushMethod = defineMethod({
|
|
26
|
+
method: "live/push",
|
|
27
|
+
direction: "client-to-instance",
|
|
28
|
+
mutating: true,
|
|
29
|
+
params,
|
|
30
|
+
result
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { livePushMethod };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=push.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push.js","names":[],"sources":["../../../src/methods/live/push.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { LIVE_KEY_PATTERN } from \"../../actions.ts\";\nimport { ArtifactRef } from \"../../artifact.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `live/push` (INTERFACES §6, D56). */\nexport interface LivePushParams {\n /** The artifact. */\n readonly artifact: ArtifactRef;\n /** The live source's key; a key `live.ts` doesn't define is created by the push. */\n readonly key: string;\n /** Any JSON, at most 4 MiB. */\n readonly value: unknown;\n /** `replace` (default): the new latest value. `append`: also kept in the source's ring. */\n readonly mode?: \"replace\" | \"append\";\n /** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */\n readonly requestId?: string;\n}\n\n/** The result of `live/push`. */\nexport interface LivePushResult {\n /** The value's revision. */\n readonly revision: string;\n}\n\nconst params: z.ZodType<LivePushParams> = z\n .object({\n artifact: ArtifactRef,\n key: z.string().regex(LIVE_KEY_PATTERN),\n value: z.unknown(),\n mode: z.enum([\"replace\", \"append\"]).exactOptional(),\n requestId: z.string().min(1).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"LivePushParams\",\n description: \"A value pushed into an artifact's live source.\",\n }) as z.ZodType<LivePushParams>;\n\nconst result: z.ZodType<LivePushResult> = z\n .object({ revision: z.string() })\n .register(wireRegistry, { id: \"LivePushResult\", description: \"The pushed value's revision.\" });\n\n/**\n * `live/push`: writes a value into an artifact's live source (D56), which every open page reading\n * it receives at once. The latest value persists; updates are never stored as events (D63).\n */\nexport const livePushMethod: MethodDefinition<LivePushParams, LivePushResult> = defineMethod({\n method: \"live/push\",\n direction: \"client-to-instance\",\n mutating: true,\n params,\n result,\n});\n"],"mappings":";;;;;;AA0BA,MAAM,SAAoC,EACvC,OAAO;CACN,UAAU;CACV,KAAK,EAAE,OAAO,CAAC,CAAC,MAAM,gBAAgB;CACtC,OAAO,EAAE,QAAQ;CACjB,MAAM,EAAE,KAAK,CAAC,WAAW,QAAQ,CAAC,CAAC,CAAC,cAAc;CAClD,WAAW,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;AAC7C,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAAoC,EACvC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC,CAChC,SAAS,cAAc;CAAE,IAAI;CAAkB,aAAa;AAA+B,CAAC;;;;;AAM/F,MAAa,iBAAmE,aAAa;CAC3F,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { SubmissionPolicy } from "../../manifest.js";
|
|
2
|
+
import { SubmitChannel } from "../../view.js";
|
|
3
|
+
import "../../interaction.js";
|
|
4
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.js";
|
|
5
|
+
import { MethodDefinition } from "../../method.js";
|
|
6
|
+
import { Revision } from "../../revision.js";
|
|
7
|
+
import * as z from "zod";
|
|
8
|
+
//#region src/methods/mostra/initialize.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* A host port name (INTERFACES §7). Port names are open strings on the wire, so an older instance
|
|
11
|
+
* answers a newer port with a warning instead of refusing the session (D84). `ai` is reserved for
|
|
12
|
+
* the AI port, which is not part of v1 (D46).
|
|
13
|
+
*/
|
|
14
|
+
export type PortName = "identity" | "submissions" | "drafts" | "reviews" | "addressing" | "trustedControls" | "capture" | "secrets" | "pty" | "ai" | (string & {});
|
|
15
|
+
/** The Zod schema of the `PortName` type. */
|
|
16
|
+
export declare const PortName: z.ZodType<PortName, string>;
|
|
17
|
+
/**
|
|
18
|
+
* The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a
|
|
19
|
+
* host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a
|
|
20
|
+
* home. A host that uses this name as its own is out of scope.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CLI_CLIENT_NAME = "mostra-cli";
|
|
23
|
+
/** The client that opens a connection. */
|
|
24
|
+
export interface ClientInfo {
|
|
25
|
+
/** The client's name, for logs and status (`mostra-cli`, `jcode`). */
|
|
26
|
+
readonly name: string;
|
|
27
|
+
/** The client's own version. */
|
|
28
|
+
readonly version: string;
|
|
29
|
+
}
|
|
30
|
+
/** What the client can handle (D84). */
|
|
31
|
+
export interface ClientCapabilities {
|
|
32
|
+
/** Notification methods the client accepts. The instance sends no others. */
|
|
33
|
+
readonly notifications?: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that
|
|
37
|
+
* implements it.
|
|
38
|
+
*/
|
|
39
|
+
export interface HomeConfig {
|
|
40
|
+
/**
|
|
41
|
+
* The home the client expects. A check, not a setting (D84): the instance chose and locked its
|
|
42
|
+
* home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a
|
|
43
|
+
* different one.
|
|
44
|
+
*/
|
|
45
|
+
readonly path?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The dependency policy (D43, D95), kept in the home's `config.json` for every later client:
|
|
48
|
+
* `auto` (the default) installs any package an artifact imports; `explicit` installs only what
|
|
49
|
+
* `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.
|
|
50
|
+
*/
|
|
51
|
+
readonly dependencies?: DependencyPolicy;
|
|
52
|
+
/**
|
|
53
|
+
* The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose
|
|
54
|
+
* `artifact/publish` names no policy, before the manifest's request.
|
|
55
|
+
*/
|
|
56
|
+
readonly submission?: SubmissionPolicy;
|
|
57
|
+
/**
|
|
58
|
+
* The ports this client always provides, kept in `config.json` under its `client.name` (D105).
|
|
59
|
+
* Submissions made while it is away wait in the outbox for it; an empty list stops that.
|
|
60
|
+
*/
|
|
61
|
+
readonly ports?: readonly PortName[];
|
|
62
|
+
/**
|
|
63
|
+
* The submit channels the home accepts (D40, D108), kept in `config.json`: `["shell"]` lets only
|
|
64
|
+
* the shell's trusted Submit and Choose make submissions and choices; absent, both channels are
|
|
65
|
+
* allowed. A host's `trustedControls` port answers per view instead, when it is connected.
|
|
66
|
+
*/
|
|
67
|
+
readonly submitChannels?: readonly SubmitChannel[];
|
|
68
|
+
}
|
|
69
|
+
/** How packages enter an artifact's lockfile (D43). */
|
|
70
|
+
export type DependencyPolicy = "auto" | "explicit";
|
|
71
|
+
/** The Zod schema of the `DependencyPolicy` type. */
|
|
72
|
+
export declare const DependencyPolicy: z.ZodType<DependencyPolicy>;
|
|
73
|
+
/** The params of `mostra/initialize` (INTERFACES §6). */
|
|
74
|
+
export interface MostraInitializeParams {
|
|
75
|
+
/** Who is connecting. */
|
|
76
|
+
readonly client: ClientInfo;
|
|
77
|
+
/**
|
|
78
|
+
* The host protocol revisions the client speaks. The instance picks the newest one it also
|
|
79
|
+
* supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions
|
|
80
|
+
* never match.
|
|
81
|
+
*/
|
|
82
|
+
readonly revisions: readonly string[];
|
|
83
|
+
/** What the client can handle. */
|
|
84
|
+
readonly capabilities: ClientCapabilities;
|
|
85
|
+
/**
|
|
86
|
+
* Ports the client implements. The instance calls a port only on the connection that registered
|
|
87
|
+
* it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.
|
|
88
|
+
*/
|
|
89
|
+
readonly ports: readonly PortName[];
|
|
90
|
+
/** Home settings and the home check. */
|
|
91
|
+
readonly home?: HomeConfig;
|
|
92
|
+
}
|
|
93
|
+
/** The instance a client is connected to. */
|
|
94
|
+
export interface InstanceInfo {
|
|
95
|
+
/** The runtime release (`@mostra/runtime` version). */
|
|
96
|
+
readonly version: string;
|
|
97
|
+
/** The home's real path. */
|
|
98
|
+
readonly home: string;
|
|
99
|
+
/** The platform as `<os>-<arch>`, for example `darwin-arm64`. */
|
|
100
|
+
readonly platform: string;
|
|
101
|
+
/** The supervisor's process ID. */
|
|
102
|
+
readonly pid: number;
|
|
103
|
+
/** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */
|
|
104
|
+
readonly mode: "host" | "daemon";
|
|
105
|
+
}
|
|
106
|
+
/** What the instance offers (D84). */
|
|
107
|
+
export interface InstanceCapabilities {
|
|
108
|
+
/** Every method the instance serves. */
|
|
109
|
+
readonly methods: readonly string[];
|
|
110
|
+
/** Every notification the instance may send. */
|
|
111
|
+
readonly notifications: readonly string[];
|
|
112
|
+
/** The ports the instance calls when a client registers them. */
|
|
113
|
+
readonly ports: readonly PortName[];
|
|
114
|
+
}
|
|
115
|
+
/** The result of `mostra/initialize`. */
|
|
116
|
+
export interface MostraInitializeResult {
|
|
117
|
+
/** The negotiated host protocol revision: the newest both sides support. */
|
|
118
|
+
readonly revision: Revision;
|
|
119
|
+
/** The instance the client is connected to. */
|
|
120
|
+
readonly instance: InstanceInfo;
|
|
121
|
+
/** What the instance offers. */
|
|
122
|
+
readonly capabilities: InstanceCapabilities;
|
|
123
|
+
/** Warnings about the session, such as ports the instance doesn't support. */
|
|
124
|
+
readonly warnings: readonly Diagnostic[];
|
|
125
|
+
}
|
|
126
|
+
/** The Zod schema of the `ClientInfo` type. */
|
|
127
|
+
export declare const ClientInfo: z.ZodType<ClientInfo>;
|
|
128
|
+
/** The Zod schema of the `ClientCapabilities` type. */
|
|
129
|
+
export declare const ClientCapabilities: z.ZodType<ClientCapabilities>;
|
|
130
|
+
/** The Zod schema of the `HomeConfig` type. */
|
|
131
|
+
export declare const HomeConfig: z.ZodType<HomeConfig>;
|
|
132
|
+
/** The Zod schema of the `InstanceInfo` type. */
|
|
133
|
+
export declare const InstanceInfo: z.ZodType<InstanceInfo>;
|
|
134
|
+
/** The Zod schema of the `InstanceCapabilities` type. */
|
|
135
|
+
export declare const InstanceCapabilities: z.ZodType<InstanceCapabilities>;
|
|
136
|
+
/**
|
|
137
|
+
* `mostra/initialize`: opens a session. It must be the first request on a connection and is sent
|
|
138
|
+
* once. It negotiates the protocol revision, registers the client's ports on this connection and
|
|
139
|
+
* checks the home (D59, D84).
|
|
140
|
+
*/
|
|
141
|
+
export declare const mostraInitializeMethod: MethodDefinition<MostraInitializeParams, MostraInitializeResult>;
|
|
142
|
+
//#endregion
|
|
143
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"mappings":";;;;;;;;;;;;;YAaY;;qBAcC,UAAU,EAAE,QAAQ;;;;;;qBAcpB;;iBAGI;;WAEN;;WAEA;;;iBAIM;;WAEN;;;;;;iBAOM;;;;;;WAMN;;;;;;WAMA,eAAe;;;;;WAKf,aAAa;;;;;WAKb,iBAAiB;;;;;;WAMjB,0BAA0B;;;YAIzB;;qBAGC,kBAAkB,EAAE,QAAQ;;iBASxB;;WAEN,QAAQ;;;;;;WAMR;;WAEA,cAAc;;;;;WAKd,gBAAgB;;WAEhB,OAAO;;;iBAID;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;iBAIM;;WAEN;;WAEA;;WAEA,gBAAgB;;;iBAIV;;WAEN,UAAU;;WAEV,UAAU;;WAEV,cAAc;;WAEd,mBAAmB;;;qBAIjB,YAAY,EAAE,QAAQ;;qBAKtB,oBAAoB,EAAE,QAAQ;;qBAQ9B,YAAY,EAAE,QAAQ;;qBAetB,cAAc,EAAE,QAAQ;;qBAcxB,sBAAsB,EAAE,QAAQ;;;;;;qBAmChC,wBAAwB,iBACnC,wBACA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { SubmissionPolicy } from "../../manifest.js";
|
|
3
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.js";
|
|
4
|
+
import { SubmitChannel } from "../../view.js";
|
|
5
|
+
import { defineMethod } from "../../method.js";
|
|
6
|
+
import { Revision } from "../../revision.js";
|
|
7
|
+
import * as z from "zod";
|
|
8
|
+
//#region src/methods/mostra/initialize.ts
|
|
9
|
+
/** The Zod schema of the `PortName` type. */
|
|
10
|
+
const PortName = z.string().regex(/^[a-z][a-zA-Z0-9]*$/).register(wireRegistry, {
|
|
11
|
+
id: "PortName",
|
|
12
|
+
description: "A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports."
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a
|
|
16
|
+
* host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a
|
|
17
|
+
* home. A host that uses this name as its own is out of scope.
|
|
18
|
+
*/
|
|
19
|
+
const CLI_CLIENT_NAME = "mostra-cli";
|
|
20
|
+
/** The Zod schema of the `DependencyPolicy` type. */
|
|
21
|
+
const DependencyPolicy = z.enum(["auto", "explicit"]).register(wireRegistry, {
|
|
22
|
+
id: "DependencyPolicy",
|
|
23
|
+
description: "How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43)."
|
|
24
|
+
});
|
|
25
|
+
/** The Zod schema of the `ClientInfo` type. */
|
|
26
|
+
const ClientInfo = z.object({
|
|
27
|
+
name: z.string().min(1),
|
|
28
|
+
version: z.string()
|
|
29
|
+
}).register(wireRegistry, {
|
|
30
|
+
id: "ClientInfo",
|
|
31
|
+
description: "The client that opens a connection."
|
|
32
|
+
});
|
|
33
|
+
/** The Zod schema of the `ClientCapabilities` type. */
|
|
34
|
+
const ClientCapabilities = z.object({ notifications: z.array(z.string()).readonly().exactOptional() }).register(wireRegistry, {
|
|
35
|
+
id: "ClientCapabilities",
|
|
36
|
+
description: "What the client can handle: the notification methods it accepts."
|
|
37
|
+
});
|
|
38
|
+
/** The Zod schema of the `HomeConfig` type. */
|
|
39
|
+
const HomeConfig = z.object({
|
|
40
|
+
path: z.string().min(1).exactOptional(),
|
|
41
|
+
dependencies: DependencyPolicy.exactOptional(),
|
|
42
|
+
submission: SubmissionPolicy.exactOptional(),
|
|
43
|
+
ports: z.array(PortName).max(32).readonly().exactOptional(),
|
|
44
|
+
submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional()
|
|
45
|
+
}).register(wireRegistry, {
|
|
46
|
+
id: "HomeConfig",
|
|
47
|
+
description: "Home settings from a spawning host; path is a check against the instance's home (D84), dependencies the dependency policy (D43), submission the home's policy (D102), ports those the host always provides (D105)."
|
|
48
|
+
});
|
|
49
|
+
/** The Zod schema of the `InstanceInfo` type. */
|
|
50
|
+
const InstanceInfo = z.object({
|
|
51
|
+
version: z.string(),
|
|
52
|
+
home: z.string(),
|
|
53
|
+
platform: z.string(),
|
|
54
|
+
pid: z.int().min(1),
|
|
55
|
+
mode: z.enum(["host", "daemon"])
|
|
56
|
+
}).register(wireRegistry, {
|
|
57
|
+
id: "InstanceInfo",
|
|
58
|
+
description: "The instance a client is connected to."
|
|
59
|
+
});
|
|
60
|
+
/** The Zod schema of the `InstanceCapabilities` type. */
|
|
61
|
+
const InstanceCapabilities = z.object({
|
|
62
|
+
methods: z.array(z.string()).readonly(),
|
|
63
|
+
notifications: z.array(z.string()).readonly(),
|
|
64
|
+
ports: z.array(PortName).readonly()
|
|
65
|
+
}).register(wireRegistry, {
|
|
66
|
+
id: "InstanceCapabilities",
|
|
67
|
+
description: "What the instance offers: methods, notifications and supported ports."
|
|
68
|
+
});
|
|
69
|
+
const params = z.object({
|
|
70
|
+
client: ClientInfo,
|
|
71
|
+
revisions: z.array(z.string()).readonly(),
|
|
72
|
+
capabilities: ClientCapabilities,
|
|
73
|
+
ports: z.array(PortName).readonly(),
|
|
74
|
+
home: HomeConfig.exactOptional()
|
|
75
|
+
}).register(wireRegistry, { id: "MostraInitializeParams" });
|
|
76
|
+
const result = z.object({
|
|
77
|
+
revision: Revision.schema,
|
|
78
|
+
instance: InstanceInfo,
|
|
79
|
+
capabilities: InstanceCapabilities,
|
|
80
|
+
warnings: z.array(Diagnostic).readonly()
|
|
81
|
+
}).register(wireRegistry, { id: "MostraInitializeResult" });
|
|
82
|
+
/**
|
|
83
|
+
* `mostra/initialize`: opens a session. It must be the first request on a connection and is sent
|
|
84
|
+
* once. It negotiates the protocol revision, registers the client's ports on this connection and
|
|
85
|
+
* checks the home (D59, D84).
|
|
86
|
+
*/
|
|
87
|
+
const mostraInitializeMethod = defineMethod({
|
|
88
|
+
method: "mostra/initialize",
|
|
89
|
+
direction: "client-to-instance",
|
|
90
|
+
mutating: false,
|
|
91
|
+
params,
|
|
92
|
+
result
|
|
93
|
+
});
|
|
94
|
+
//#endregion
|
|
95
|
+
export { CLI_CLIENT_NAME, ClientCapabilities, ClientInfo, DependencyPolicy, HomeConfig, InstanceCapabilities, InstanceInfo, PortName, mostraInitializeMethod };
|
|
96
|
+
|
|
97
|
+
//# sourceMappingURL=initialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.js","names":[],"sources":["../../../src/methods/mostra/initialize.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { Diagnostic } from \"../../diagnostics/diagnostic.ts\";\nimport { SubmitChannel } from \"../../interaction.ts\";\nimport { SubmissionPolicy } from \"../../manifest.ts\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { Revision } from \"../../revision.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/**\n * A host port name (INTERFACES §7). Port names are open strings on the wire, so an older instance\n * answers a newer port with a warning instead of refusing the session (D84). `ai` is reserved for\n * the AI port, which is not part of v1 (D46).\n */\nexport type PortName =\n | \"identity\"\n | \"submissions\"\n | \"drafts\"\n | \"reviews\"\n | \"addressing\"\n | \"trustedControls\"\n | \"capture\"\n | \"secrets\"\n | \"pty\"\n | \"ai\"\n | (string & {});\n\n/** The Zod schema of the `PortName` type. */\nexport const PortName: z.ZodType<PortName, string> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9]*$/)\n .register(wireRegistry, {\n id: \"PortName\",\n description:\n \"A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports.\",\n });\n\n/**\n * The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a\n * host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a\n * home. A host that uses this name as its own is out of scope.\n */\nexport const CLI_CLIENT_NAME = \"mostra-cli\";\n\n/** The client that opens a connection. */\nexport interface ClientInfo {\n /** The client's name, for logs and status (`mostra-cli`, `jcode`). */\n readonly name: string;\n /** The client's own version. */\n readonly version: string;\n}\n\n/** What the client can handle (D84). */\nexport interface ClientCapabilities {\n /** Notification methods the client accepts. The instance sends no others. */\n readonly notifications?: readonly string[];\n}\n\n/**\n * Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that\n * implements it.\n */\nexport interface HomeConfig {\n /**\n * The home the client expects. A check, not a setting (D84): the instance chose and locked its\n * home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a\n * different one.\n */\n readonly path?: string;\n /**\n * The dependency policy (D43, D95), kept in the home's `config.json` for every later client:\n * `auto` (the default) installs any package an artifact imports; `explicit` installs only what\n * `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.\n */\n readonly dependencies?: DependencyPolicy;\n /**\n * The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose\n * `artifact/publish` names no policy, before the manifest's request.\n */\n readonly submission?: SubmissionPolicy;\n /**\n * The ports this client always provides, kept in `config.json` under its `client.name` (D105).\n * Submissions made while it is away wait in the outbox for it; an empty list stops that.\n */\n readonly ports?: readonly PortName[];\n /**\n * The submit channels the home accepts (D40, D108), kept in `config.json`: `[\"shell\"]` lets only\n * the shell's trusted Submit and Choose make submissions and choices; absent, both channels are\n * allowed. A host's `trustedControls` port answers per view instead, when it is connected.\n */\n readonly submitChannels?: readonly SubmitChannel[];\n}\n\n/** How packages enter an artifact's lockfile (D43). */\nexport type DependencyPolicy = \"auto\" | \"explicit\";\n\n/** The Zod schema of the `DependencyPolicy` type. */\nexport const DependencyPolicy: z.ZodType<DependencyPolicy> = z\n .enum([\"auto\", \"explicit\"])\n .register(wireRegistry, {\n id: \"DependencyPolicy\",\n description:\n \"How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43).\",\n });\n\n/** The params of `mostra/initialize` (INTERFACES §6). */\nexport interface MostraInitializeParams {\n /** Who is connecting. */\n readonly client: ClientInfo;\n /**\n * The host protocol revisions the client speaks. The instance picks the newest one it also\n * supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions\n * never match.\n */\n readonly revisions: readonly string[];\n /** What the client can handle. */\n readonly capabilities: ClientCapabilities;\n /**\n * Ports the client implements. The instance calls a port only on the connection that registered\n * it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.\n */\n readonly ports: readonly PortName[];\n /** Home settings and the home check. */\n readonly home?: HomeConfig;\n}\n\n/** The instance a client is connected to. */\nexport interface InstanceInfo {\n /** The runtime release (`@mostra/runtime` version). */\n readonly version: string;\n /** The home's real path. */\n readonly home: string;\n /** The platform as `<os>-<arch>`, for example `darwin-arm64`. */\n readonly platform: string;\n /** The supervisor's process ID. */\n readonly pid: number;\n /** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */\n readonly mode: \"host\" | \"daemon\";\n}\n\n/** What the instance offers (D84). */\nexport interface InstanceCapabilities {\n /** Every method the instance serves. */\n readonly methods: readonly string[];\n /** Every notification the instance may send. */\n readonly notifications: readonly string[];\n /** The ports the instance calls when a client registers them. */\n readonly ports: readonly PortName[];\n}\n\n/** The result of `mostra/initialize`. */\nexport interface MostraInitializeResult {\n /** The negotiated host protocol revision: the newest both sides support. */\n readonly revision: Revision;\n /** The instance the client is connected to. */\n readonly instance: InstanceInfo;\n /** What the instance offers. */\n readonly capabilities: InstanceCapabilities;\n /** Warnings about the session, such as ports the instance doesn't support. */\n readonly warnings: readonly Diagnostic[];\n}\n\n/** The Zod schema of the `ClientInfo` type. */\nexport const ClientInfo: z.ZodType<ClientInfo> = z\n .object({ name: z.string().min(1), version: z.string() })\n .register(wireRegistry, { id: \"ClientInfo\", description: \"The client that opens a connection.\" });\n\n/** The Zod schema of the `ClientCapabilities` type. */\nexport const ClientCapabilities: z.ZodType<ClientCapabilities> = z\n .object({ notifications: z.array(z.string()).readonly().exactOptional() })\n .register(wireRegistry, {\n id: \"ClientCapabilities\",\n description: \"What the client can handle: the notification methods it accepts.\",\n });\n\n/** The Zod schema of the `HomeConfig` type. */\nexport const HomeConfig: z.ZodType<HomeConfig> = z\n .object({\n path: z.string().min(1).exactOptional(),\n dependencies: DependencyPolicy.exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n ports: z.array(PortName).max(32).readonly().exactOptional(),\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"HomeConfig\",\n description:\n \"Home settings from a spawning host; path is a check against the instance's home (D84), dependencies the dependency policy (D43), submission the home's policy (D102), ports those the host always provides (D105).\",\n });\n\n/** The Zod schema of the `InstanceInfo` type. */\nexport const InstanceInfo: z.ZodType<InstanceInfo> = z\n .object({\n version: z.string(),\n home: z.string(),\n platform: z.string(),\n pid: z.int().min(1),\n mode: z.enum([\"host\", \"daemon\"]),\n })\n .register(wireRegistry, {\n id: \"InstanceInfo\",\n description: \"The instance a client is connected to.\",\n });\n\n/** The Zod schema of the `InstanceCapabilities` type. */\nexport const InstanceCapabilities: z.ZodType<InstanceCapabilities> = z\n .object({\n methods: z.array(z.string()).readonly(),\n notifications: z.array(z.string()).readonly(),\n ports: z.array(PortName).readonly(),\n })\n .register(wireRegistry, {\n id: \"InstanceCapabilities\",\n description: \"What the instance offers: methods, notifications and supported ports.\",\n });\n\nconst params: z.ZodType<MostraInitializeParams> = z\n .object({\n client: ClientInfo,\n revisions: z.array(z.string()).readonly(),\n capabilities: ClientCapabilities,\n ports: z.array(PortName).readonly(),\n home: HomeConfig.exactOptional(),\n })\n .register(wireRegistry, { id: \"MostraInitializeParams\" });\n\nconst result: z.ZodType<MostraInitializeResult> = z\n .object({\n revision: Revision.schema,\n instance: InstanceInfo,\n capabilities: InstanceCapabilities,\n warnings: z.array(Diagnostic).readonly(),\n })\n .register(wireRegistry, { id: \"MostraInitializeResult\" });\n\n/**\n * `mostra/initialize`: opens a session. It must be the first request on a connection and is sent\n * once. It negotiates the protocol revision, registers the client's ports on this connection and\n * checks the home (D59, D84).\n */\nexport const mostraInitializeMethod: MethodDefinition<\n MostraInitializeParams,\n MostraInitializeResult\n> = defineMethod({\n method: \"mostra/initialize\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n});\n"],"mappings":";;;;;;;;;AA2BA,MAAa,WAAwC,EAClD,OAAO,CAAC,CACR,MAAM,qBAAqB,CAAC,CAC5B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;;;;;AAOH,MAAa,kBAAkB;;AAuD/B,MAAa,mBAAgD,EAC1D,KAAK,CAAC,QAAQ,UAAU,CAAC,CAAC,CAC1B,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AA4DH,MAAa,aAAoC,EAC9C,OAAO;CAAE,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;CAAG,SAAS,EAAE,OAAO;AAAE,CAAC,CAAC,CACxD,SAAS,cAAc;CAAE,IAAI;CAAc,aAAa;AAAsC,CAAC;;AAGlG,MAAa,qBAAoD,EAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,CACzE,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,aAAoC,EAC9C,OAAO;CACN,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CACtC,cAAc,iBAAiB,cAAc;CAC7C,YAAY,iBAAiB,cAAc;CAC3C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;CAC1D,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AAChF,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,eAAwC,EAClD,OAAO;CACN,SAAS,EAAE,OAAO;CAClB,MAAM,EAAE,OAAO;CACf,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;CAClB,MAAM,EAAE,KAAK,CAAC,QAAQ,QAAQ,CAAC;AACjC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAGH,MAAa,uBAAwD,EAClE,OAAO;CACN,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACtC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CAC5C,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;AACpC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;AAEH,MAAM,SAA4C,EAC/C,OAAO;CACN,QAAQ;CACR,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS;CACxC,cAAc;CACd,OAAO,EAAE,MAAM,QAAQ,CAAC,CAAC,SAAS;CAClC,MAAM,WAAW,cAAc;AACjC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;AAE1D,MAAM,SAA4C,EAC/C,OAAO;CACN,UAAU,SAAS;CACnB,UAAU;CACV,cAAc;CACd,UAAU,EAAE,MAAM,UAAU,CAAC,CAAC,SAAS;AACzC,CAAC,CAAC,CACD,SAAS,cAAc,EAAE,IAAI,yBAAyB,CAAC;;;;;;AAO1D,MAAa,yBAGT,aAAa;CACf,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { MethodDefinition } from "../../method.js";
|
|
2
|
+
//#region src/methods/mostra/shutdown.d.ts
|
|
3
|
+
/** The params of `mostra/shutdown` (INTERFACES §6): none. */
|
|
4
|
+
export type MostraShutdownParams = Record<string, never>;
|
|
5
|
+
/** The result of `mostra/shutdown`, sent before the instance stops: empty. */
|
|
6
|
+
export type MostraShutdownResult = Record<string, never>;
|
|
7
|
+
/**
|
|
8
|
+
* `mostra/shutdown`: stops the instance cleanly. The instance answers first, then finishes its
|
|
9
|
+
* ledger work, stops its children, removes its socket and `instance.json`, and exits. Available to
|
|
10
|
+
* the spawning host and to every attached client of a daemon (D87).
|
|
11
|
+
*/
|
|
12
|
+
export declare const mostraShutdownMethod: MethodDefinition<MostraShutdownParams, MostraShutdownResult>;
|
|
13
|
+
//#endregion
|
|
14
|
+
//# sourceMappingURL=shutdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shutdown.d.ts","names":[],"sources":["../../../src/methods/mostra/shutdown.ts"],"mappings":";;;YAKY,uBAAuB;;YAGvB,uBAAuB;;;;;;qBAetB,sBAAsB,iBAAiB,sBAAsB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { wireRegistry } from "../../wire-registry.js";
|
|
2
|
+
import { defineMethod } from "../../method.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/methods/mostra/shutdown.ts
|
|
5
|
+
const params = z.object({}).register(wireRegistry, { id: "MostraShutdownParams" });
|
|
6
|
+
const result = z.object({}).register(wireRegistry, { id: "MostraShutdownResult" });
|
|
7
|
+
/**
|
|
8
|
+
* `mostra/shutdown`: stops the instance cleanly. The instance answers first, then finishes its
|
|
9
|
+
* ledger work, stops its children, removes its socket and `instance.json`, and exits. Available to
|
|
10
|
+
* the spawning host and to every attached client of a daemon (D87).
|
|
11
|
+
*/
|
|
12
|
+
const mostraShutdownMethod = defineMethod({
|
|
13
|
+
method: "mostra/shutdown",
|
|
14
|
+
direction: "client-to-instance",
|
|
15
|
+
mutating: false,
|
|
16
|
+
params,
|
|
17
|
+
result
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { mostraShutdownMethod };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=shutdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shutdown.js","names":[],"sources":["../../../src/methods/mostra/shutdown.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { defineMethod, type MethodDefinition } from \"../../method.ts\";\nimport { wireRegistry } from \"../../wire-registry.ts\";\n\n/** The params of `mostra/shutdown` (INTERFACES §6): none. */\nexport type MostraShutdownParams = Record<string, never>;\n\n/** The result of `mostra/shutdown`, sent before the instance stops: empty. */\nexport type MostraShutdownResult = Record<string, never>;\n\nconst params: z.ZodType<MostraShutdownParams> = z\n .object({})\n .register(wireRegistry, { id: \"MostraShutdownParams\" });\n\nconst result: z.ZodType<MostraShutdownResult> = z\n .object({})\n .register(wireRegistry, { id: \"MostraShutdownResult\" });\n\n/**\n * `mostra/shutdown`: stops the instance cleanly. The instance answers first, then finishes its\n * ledger work, stops its children, removes its socket and `instance.json`, and exits. Available to\n * the spawning host and to every attached client of a daemon (D87).\n */\nexport const mostraShutdownMethod: MethodDefinition<MostraShutdownParams, MostraShutdownResult> =\n defineMethod({\n method: \"mostra/shutdown\",\n direction: \"client-to-instance\",\n mutating: false,\n params,\n result,\n });\n"],"mappings":";;;;AAUA,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;AAExD,MAAM,SAA0C,EAC7C,OAAO,CAAC,CAAC,CAAC,CACV,SAAS,cAAc,EAAE,IAAI,uBAAuB,CAAC;;;;;;AAOxD,MAAa,uBACX,aAAa;CACX,QAAQ;CACR,WAAW;CACX,UAAU;CACV;CACA;AACF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { DocumentRevision } from "../../interaction.js";
|
|
2
|
+
import { MethodDefinition } from "../../method.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/methods/port/drafts-mirror.d.ts
|
|
5
|
+
/** A viewer's draft, mirrored to a host as it changes (INTERFACES §7, D105). */
|
|
6
|
+
export interface DraftMirror {
|
|
7
|
+
/** Always `draft`: a mirror is never a submission (IN-06). */
|
|
8
|
+
readonly kind: "draft";
|
|
9
|
+
/** The artifact. */
|
|
10
|
+
readonly artifactId: string;
|
|
11
|
+
/** Whose draft it is. */
|
|
12
|
+
readonly viewerId: string;
|
|
13
|
+
/** The draft's epoch (D103). */
|
|
14
|
+
readonly epoch: number;
|
|
15
|
+
/** The draft's revision; a later mirror has a higher one. */
|
|
16
|
+
readonly revision: DocumentRevision;
|
|
17
|
+
/** Every field of the draft by ID. */
|
|
18
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
19
|
+
}
|
|
20
|
+
/** The result of `port/drafts.mirror`. */
|
|
21
|
+
export type DraftsMirrorResult = unknown;
|
|
22
|
+
/** The Zod schema of the `DraftMirror` type. */
|
|
23
|
+
export declare const DraftMirror: z.ZodType<DraftMirror>;
|
|
24
|
+
/**
|
|
25
|
+
* `port/drafts.mirror`: Mostra sends the latest revision of a viewer's draft to a host that
|
|
26
|
+
* registered the drafts port, best effort (D105). Mostra's ledger stays canonical (D58).
|
|
27
|
+
*/
|
|
28
|
+
export declare const portDraftsMirrorMethod: MethodDefinition<DraftMirror, DraftsMirrorResult>;
|
|
29
|
+
//#endregion
|
|
30
|
+
//# sourceMappingURL=drafts-mirror.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drafts-mirror.d.ts","names":[],"sources":["../../../src/methods/port/drafts-mirror.ts"],"mappings":";;;;;iBAOiB;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA,UAAU;;WAEV,QAAQ,SAAS;;;YAIhB;;qBAGC,aAAa,EAAE,QAAQ;;;;;qBAkBvB,wBAAwB,iBAAiB,aAAa"}
|