@mostra/protocol 0.0.0-placeholder → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +37 -1
- package/dist/actions.d.ts +273 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +154 -0
- package/dist/actions.js.map +1 -0
- package/dist/artifact.d.ts +113 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +79 -0
- package/dist/artifact.js.map +1 -0
- package/dist/bridge.d.ts +295 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +343 -0
- package/dist/bridge.js.map +1 -0
- package/dist/browser.d.ts +195 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +156 -0
- package/dist/browser.js.map +1 -0
- package/dist/bundle.d.ts +155 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +130 -0
- package/dist/bundle.js.map +1 -0
- package/dist/canonical.d.ts +23 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +45 -0
- package/dist/canonical.js.map +1 -0
- package/dist/capability.d.ts +38 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +61 -0
- package/dist/capability.js.map +1 -0
- package/dist/diagnostics/codes/a11y.d.ts +8 -0
- package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
- package/dist/diagnostics/codes/a11y.js +30 -0
- package/dist/diagnostics/codes/a11y.js.map +1 -0
- package/dist/diagnostics/codes/action.d.ts +8 -0
- package/dist/diagnostics/codes/action.d.ts.map +1 -0
- package/dist/diagnostics/codes/action.js +110 -0
- package/dist/diagnostics/codes/action.js.map +1 -0
- package/dist/diagnostics/codes/artifact.d.ts +8 -0
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
- package/dist/diagnostics/codes/artifact.js +121 -0
- package/dist/diagnostics/codes/artifact.js.map +1 -0
- package/dist/diagnostics/codes/build.d.ts +8 -0
- package/dist/diagnostics/codes/build.d.ts.map +1 -0
- package/dist/diagnostics/codes/build.js +55 -0
- package/dist/diagnostics/codes/build.js.map +1 -0
- package/dist/diagnostics/codes/cli.d.ts +8 -0
- package/dist/diagnostics/codes/cli.d.ts.map +1 -0
- package/dist/diagnostics/codes/cli.js +44 -0
- package/dist/diagnostics/codes/cli.js.map +1 -0
- package/dist/diagnostics/codes/console.d.ts +8 -0
- package/dist/diagnostics/codes/console.d.ts.map +1 -0
- package/dist/diagnostics/codes/console.js +30 -0
- package/dist/diagnostics/codes/console.js.map +1 -0
- package/dist/diagnostics/codes/dep.d.ts +8 -0
- package/dist/diagnostics/codes/dep.d.ts.map +1 -0
- package/dist/diagnostics/codes/dep.js +88 -0
- package/dist/diagnostics/codes/dep.js.map +1 -0
- package/dist/diagnostics/codes/env.d.ts +8 -0
- package/dist/diagnostics/codes/env.d.ts.map +1 -0
- package/dist/diagnostics/codes/env.js +132 -0
- package/dist/diagnostics/codes/env.js.map +1 -0
- package/dist/diagnostics/codes/field.d.ts +8 -0
- package/dist/diagnostics/codes/field.d.ts.map +1 -0
- package/dist/diagnostics/codes/field.js +99 -0
- package/dist/diagnostics/codes/field.js.map +1 -0
- package/dist/diagnostics/codes/home.d.ts +8 -0
- package/dist/diagnostics/codes/home.d.ts.map +1 -0
- package/dist/diagnostics/codes/home.js +132 -0
- package/dist/diagnostics/codes/home.js.map +1 -0
- package/dist/diagnostics/codes/host.d.ts +8 -0
- package/dist/diagnostics/codes/host.d.ts.map +1 -0
- package/dist/diagnostics/codes/host.js +176 -0
- package/dist/diagnostics/codes/host.js.map +1 -0
- package/dist/diagnostics/codes/hygiene.d.ts +8 -0
- package/dist/diagnostics/codes/hygiene.d.ts.map +1 -0
- package/dist/diagnostics/codes/hygiene.js +154 -0
- package/dist/diagnostics/codes/hygiene.js.map +1 -0
- package/dist/diagnostics/codes/index.d.ts +51 -0
- package/dist/diagnostics/codes/index.d.ts.map +1 -0
- package/dist/diagnostics/codes/index.js +72 -0
- package/dist/diagnostics/codes/index.js.map +1 -0
- package/dist/diagnostics/codes/live.d.ts +8 -0
- package/dist/diagnostics/codes/live.d.ts.map +1 -0
- package/dist/diagnostics/codes/live.js +30 -0
- package/dist/diagnostics/codes/live.js.map +1 -0
- package/dist/diagnostics/codes/manifest.d.ts +8 -0
- package/dist/diagnostics/codes/manifest.d.ts.map +1 -0
- package/dist/diagnostics/codes/manifest.js +44 -0
- package/dist/diagnostics/codes/manifest.js.map +1 -0
- package/dist/diagnostics/codes/network.d.ts +8 -0
- package/dist/diagnostics/codes/network.d.ts.map +1 -0
- package/dist/diagnostics/codes/network.js +30 -0
- package/dist/diagnostics/codes/network.js.map +1 -0
- package/dist/diagnostics/codes/platform.d.ts +8 -0
- package/dist/diagnostics/codes/platform.d.ts.map +1 -0
- package/dist/diagnostics/codes/platform.js +18 -0
- package/dist/diagnostics/codes/platform.js.map +1 -0
- package/dist/diagnostics/codes/publish.d.ts +8 -0
- package/dist/diagnostics/codes/publish.d.ts.map +1 -0
- package/dist/diagnostics/codes/publish.js +44 -0
- package/dist/diagnostics/codes/publish.js.map +1 -0
- package/dist/diagnostics/codes/regression.d.ts +8 -0
- package/dist/diagnostics/codes/regression.d.ts.map +1 -0
- package/dist/diagnostics/codes/regression.js +77 -0
- package/dist/diagnostics/codes/regression.js.map +1 -0
- package/dist/diagnostics/codes/runtime.d.ts +8 -0
- package/dist/diagnostics/codes/runtime.d.ts.map +1 -0
- package/dist/diagnostics/codes/runtime.js +66 -0
- package/dist/diagnostics/codes/runtime.js.map +1 -0
- package/dist/diagnostics/codes/secret.d.ts +8 -0
- package/dist/diagnostics/codes/secret.d.ts.map +1 -0
- package/dist/diagnostics/codes/secret.js +18 -0
- package/dist/diagnostics/codes/secret.js.map +1 -0
- package/dist/diagnostics/codes/smoke.d.ts +8 -0
- package/dist/diagnostics/codes/smoke.d.ts.map +1 -0
- package/dist/diagnostics/codes/smoke.js +30 -0
- package/dist/diagnostics/codes/smoke.js.map +1 -0
- package/dist/diagnostics/codes/submit.d.ts +8 -0
- package/dist/diagnostics/codes/submit.d.ts.map +1 -0
- package/dist/diagnostics/codes/submit.js +99 -0
- package/dist/diagnostics/codes/submit.js.map +1 -0
- package/dist/diagnostics/codes/target.d.ts +8 -0
- package/dist/diagnostics/codes/target.d.ts.map +1 -0
- package/dist/diagnostics/codes/target.js +18 -0
- package/dist/diagnostics/codes/target.js.map +1 -0
- package/dist/diagnostics/codes/type.d.ts +8 -0
- package/dist/diagnostics/codes/type.d.ts.map +1 -0
- package/dist/diagnostics/codes/type.js +30 -0
- package/dist/diagnostics/codes/type.js.map +1 -0
- package/dist/diagnostics/codes/verify.d.ts +8 -0
- package/dist/diagnostics/codes/verify.d.ts.map +1 -0
- package/dist/diagnostics/codes/verify.js +99 -0
- package/dist/diagnostics/codes/verify.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +79 -0
- package/dist/diagnostics/diagnostic.d.ts.map +1 -0
- package/dist/diagnostics/diagnostic.js +131 -0
- package/dist/diagnostics/diagnostic.js.map +1 -0
- package/dist/diagnostics/spec.d.ts +49 -0
- package/dist/diagnostics/spec.d.ts.map +1 -0
- package/dist/diagnostics/spec.js +31 -0
- package/dist/diagnostics/spec.js.map +1 -0
- package/dist/hygiene.d.ts +66 -0
- package/dist/hygiene.d.ts.map +1 -0
- package/dist/hygiene.js +134 -0
- package/dist/hygiene.js.map +1 -0
- package/dist/ids.d.ts +119 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +135 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +86 -0
- package/dist/interaction.d.ts +391 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +306 -0
- package/dist/interaction.js.map +1 -0
- package/dist/manifest.d.ts +97 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +101 -0
- package/dist/manifest.js.map +1 -0
- package/dist/method.d.ts +26 -0
- package/dist/method.d.ts.map +1 -0
- package/dist/method.js +10 -0
- package/dist/method.js.map +1 -0
- package/dist/methods/artifact/create.d.ts +29 -0
- package/dist/methods/artifact/create.d.ts.map +1 -0
- package/dist/methods/artifact/create.js +31 -0
- package/dist/methods/artifact/create.js.map +1 -0
- package/dist/methods/artifact/get.d.ts +17 -0
- package/dist/methods/artifact/get.d.ts.map +1 -0
- package/dist/methods/artifact/get.js +21 -0
- package/dist/methods/artifact/get.js.map +1 -0
- package/dist/methods/artifact/list.d.ts +22 -0
- package/dist/methods/artifact/list.d.ts.map +1 -0
- package/dist/methods/artifact/list.js +19 -0
- package/dist/methods/artifact/list.js.map +1 -0
- package/dist/methods/artifact/publish.d.ts +28 -0
- package/dist/methods/artifact/publish.d.ts.map +1 -0
- package/dist/methods/artifact/publish.js +28 -0
- package/dist/methods/artifact/publish.js.map +1 -0
- package/dist/methods/artifact/verify.d.ts +29 -0
- package/dist/methods/artifact/verify.d.ts.map +1 -0
- package/dist/methods/artifact/verify.js +27 -0
- package/dist/methods/artifact/verify.js.map +1 -0
- package/dist/methods/deps/add.d.ts +43 -0
- package/dist/methods/deps/add.d.ts.map +1 -0
- package/dist/methods/deps/add.js +40 -0
- package/dist/methods/deps/add.js.map +1 -0
- package/dist/methods/dev/start.d.ts +52 -0
- package/dist/methods/dev/start.d.ts.map +1 -0
- package/dist/methods/dev/start.js +56 -0
- package/dist/methods/dev/start.js.map +1 -0
- package/dist/methods/dev/stop.d.ts +16 -0
- package/dist/methods/dev/stop.d.ts.map +1 -0
- package/dist/methods/dev/stop.js +21 -0
- package/dist/methods/dev/stop.js.map +1 -0
- package/dist/methods/events/ack.d.ts +20 -0
- package/dist/methods/events/ack.d.ts.map +1 -0
- package/dist/methods/events/ack.js +26 -0
- package/dist/methods/events/ack.js.map +1 -0
- package/dist/methods/events/read.d.ts +40 -0
- package/dist/methods/events/read.d.ts.map +1 -0
- package/dist/methods/events/read.js +35 -0
- package/dist/methods/events/read.js.map +1 -0
- package/dist/methods/events/subscribe.d.ts +54 -0
- package/dist/methods/events/subscribe.d.ts.map +1 -0
- package/dist/methods/events/subscribe.js +44 -0
- package/dist/methods/events/subscribe.js.map +1 -0
- package/dist/methods/events/unsubscribe.d.ts +16 -0
- package/dist/methods/events/unsubscribe.d.ts.map +1 -0
- package/dist/methods/events/unsubscribe.js +21 -0
- package/dist/methods/events/unsubscribe.js.map +1 -0
- package/dist/methods/gc/run.d.ts +76 -0
- package/dist/methods/gc/run.d.ts.map +1 -0
- package/dist/methods/gc/run.js +56 -0
- package/dist/methods/gc/run.js.map +1 -0
- package/dist/methods/index.d.ts +6 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +78 -0
- package/dist/methods/index.js.map +1 -0
- package/dist/methods/instance/check.d.ts +30 -0
- package/dist/methods/instance/check.d.ts.map +1 -0
- package/dist/methods/instance/check.js +34 -0
- package/dist/methods/instance/check.js.map +1 -0
- package/dist/methods/instance/status.d.ts +102 -0
- package/dist/methods/instance/status.d.ts.map +1 -0
- package/dist/methods/instance/status.js +83 -0
- package/dist/methods/instance/status.js.map +1 -0
- package/dist/methods/live/push.d.ts +28 -0
- package/dist/methods/live/push.d.ts.map +1 -0
- package/dist/methods/live/push.js +35 -0
- package/dist/methods/live/push.js.map +1 -0
- package/dist/methods/mostra/initialize.d.ts +143 -0
- package/dist/methods/mostra/initialize.d.ts.map +1 -0
- package/dist/methods/mostra/initialize.js +97 -0
- package/dist/methods/mostra/initialize.js.map +1 -0
- package/dist/methods/mostra/shutdown.d.ts +14 -0
- package/dist/methods/mostra/shutdown.d.ts.map +1 -0
- package/dist/methods/mostra/shutdown.js +22 -0
- package/dist/methods/mostra/shutdown.js.map +1 -0
- package/dist/methods/port/drafts-mirror.d.ts +30 -0
- package/dist/methods/port/drafts-mirror.d.ts.map +1 -0
- package/dist/methods/port/drafts-mirror.js +33 -0
- package/dist/methods/port/drafts-mirror.js.map +1 -0
- package/dist/methods/port/secrets-get.d.ts +19 -0
- package/dist/methods/port/secrets-get.d.ts.map +1 -0
- package/dist/methods/port/secrets-get.js +31 -0
- package/dist/methods/port/secrets-get.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +38 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
- package/dist/methods/port/submissions-deliver.js +38 -0
- package/dist/methods/port/submissions-deliver.js.map +1 -0
- package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
- package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-activated.js +33 -0
- package/dist/methods/port/trusted-controls-activated.js.map +1 -0
- package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
- package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-policy.js +27 -0
- package/dist/methods/port/trusted-controls-policy.js.map +1 -0
- package/dist/methods/results/get.d.ts +32 -0
- package/dist/methods/results/get.d.ts.map +1 -0
- package/dist/methods/results/get.js +36 -0
- package/dist/methods/results/get.js.map +1 -0
- package/dist/methods/secret/delete.d.ts +22 -0
- package/dist/methods/secret/delete.d.ts.map +1 -0
- package/dist/methods/secret/delete.js +32 -0
- package/dist/methods/secret/delete.js.map +1 -0
- package/dist/methods/secret/list.d.ts +21 -0
- package/dist/methods/secret/list.d.ts.map +1 -0
- package/dist/methods/secret/list.js +29 -0
- package/dist/methods/secret/list.js.map +1 -0
- package/dist/methods/secret/set.d.ts +37 -0
- package/dist/methods/secret/set.d.ts.map +1 -0
- package/dist/methods/secret/set.js +41 -0
- package/dist/methods/secret/set.js.map +1 -0
- package/dist/methods/state/get.d.ts +25 -0
- package/dist/methods/state/get.d.ts.map +1 -0
- package/dist/methods/state/get.js +29 -0
- package/dist/methods/state/get.js.map +1 -0
- package/dist/methods/state/patch.d.ts +32 -0
- package/dist/methods/state/patch.d.ts.map +1 -0
- package/dist/methods/state/patch.js +29 -0
- package/dist/methods/state/patch.js.map +1 -0
- package/dist/methods/view/default.d.ts +19 -0
- package/dist/methods/view/default.d.ts.map +1 -0
- package/dist/methods/view/default.js +23 -0
- package/dist/methods/view/default.js.map +1 -0
- package/dist/methods/view/launch.d.ts +27 -0
- package/dist/methods/view/launch.d.ts.map +1 -0
- package/dist/methods/view/launch.js +30 -0
- package/dist/methods/view/launch.js.map +1 -0
- package/dist/methods/view/revoke.d.ts +19 -0
- package/dist/methods/view/revoke.d.ts.map +1 -0
- package/dist/methods/view/revoke.js +26 -0
- package/dist/methods/view/revoke.js.map +1 -0
- package/dist/methods/view/rotate.d.ts +21 -0
- package/dist/methods/view/rotate.d.ts.map +1 -0
- package/dist/methods/view/rotate.js +27 -0
- package/dist/methods/view/rotate.js.map +1 -0
- package/dist/methods/view/url.d.ts +52 -0
- package/dist/methods/view/url.d.ts.map +1 -0
- package/dist/methods/view/url.js +43 -0
- package/dist/methods/view/url.js.map +1 -0
- package/dist/methods/wait/wait.d.ts +37 -0
- package/dist/methods/wait/wait.d.ts.map +1 -0
- package/dist/methods/wait/wait.js +39 -0
- package/dist/methods/wait/wait.js.map +1 -0
- package/dist/revision.d.ts +43 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +69 -0
- package/dist/revision.js.map +1 -0
- package/dist/rpc/error.d.ts +47 -0
- package/dist/rpc/error.d.ts.map +1 -0
- package/dist/rpc/error.js +77 -0
- package/dist/rpc/error.js.map +1 -0
- package/dist/rpc/lines.d.ts +30 -0
- package/dist/rpc/lines.d.ts.map +1 -0
- package/dist/rpc/lines.js +63 -0
- package/dist/rpc/lines.js.map +1 -0
- package/dist/rpc/messages.d.ts +92 -0
- package/dist/rpc/messages.d.ts.map +1 -0
- package/dist/rpc/messages.js +133 -0
- package/dist/rpc/messages.js.map +1 -0
- package/dist/rpc/peer.d.ts +81 -0
- package/dist/rpc/peer.d.ts.map +1 -0
- package/dist/rpc/peer.js +208 -0
- package/dist/rpc/peer.js.map +1 -0
- package/dist/serializer.d.ts +178 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +929 -0
- package/dist/serializer.js.map +1 -0
- package/dist/verify.d.ts +254 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +243 -0
- package/dist/verify.js.map +1 -0
- package/dist/view.d.ts +103 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +110 -0
- package/dist/view.js.map +1 -0
- package/dist/wire-registry.js +11 -0
- package/dist/wire-registry.js.map +1 -0
- package/dist/worker.d.ts +249 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +158 -0
- package/dist/worker.js.map +1 -0
- package/package.json +114 -4
- package/schemas/protocol.draft-07.json +5120 -0
- package/schemas/protocol.schema.json +4964 -0
- package/src/actions.ts +418 -0
- package/src/artifact.ts +187 -0
- package/src/bridge.ts +618 -0
- package/src/browser.ts +374 -0
- package/src/bundle.ts +264 -0
- package/src/canonical.ts +49 -0
- package/src/capability.ts +92 -0
- package/src/diagnostics/codes/a11y.ts +41 -0
- package/src/diagnostics/codes/action.ts +125 -0
- package/src/diagnostics/codes/artifact.ts +137 -0
- package/src/diagnostics/codes/build.ts +65 -0
- package/src/diagnostics/codes/cli.ts +53 -0
- package/src/diagnostics/codes/console.ts +41 -0
- package/src/diagnostics/codes/dep.ts +101 -0
- package/src/diagnostics/codes/env.ts +149 -0
- package/src/diagnostics/codes/field.ts +113 -0
- package/src/diagnostics/codes/home.ts +150 -0
- package/src/diagnostics/codes/host.ts +197 -0
- package/src/diagnostics/codes/hygiene.ts +175 -0
- package/src/diagnostics/codes/index.ts +142 -0
- package/src/diagnostics/codes/live.ts +41 -0
- package/src/diagnostics/codes/manifest.ts +53 -0
- package/src/diagnostics/codes/network.ts +41 -0
- package/src/diagnostics/codes/platform.ts +30 -0
- package/src/diagnostics/codes/publish.ts +53 -0
- package/src/diagnostics/codes/regression.ts +89 -0
- package/src/diagnostics/codes/runtime.ts +77 -0
- package/src/diagnostics/codes/secret.ts +29 -0
- package/src/diagnostics/codes/smoke.ts +41 -0
- package/src/diagnostics/codes/submit.ts +113 -0
- package/src/diagnostics/codes/target.ts +29 -0
- package/src/diagnostics/codes/type.ts +41 -0
- package/src/diagnostics/codes/verify.ts +113 -0
- package/src/diagnostics/diagnostic.ts +240 -0
- package/src/diagnostics/spec.ts +90 -0
- package/src/hygiene.ts +224 -0
- package/src/ids.ts +279 -0
- package/src/index.ts +576 -0
- package/src/interaction.ts +728 -0
- package/src/manifest.ts +206 -0
- package/src/method.ts +42 -0
- package/src/methods/artifact/create.ts +56 -0
- package/src/methods/artifact/get.ts +30 -0
- package/src/methods/artifact/list.ts +42 -0
- package/src/methods/artifact/publish.ts +46 -0
- package/src/methods/artifact/verify.ts +46 -0
- package/src/methods/deps/add.ts +72 -0
- package/src/methods/dev/start.ts +84 -0
- package/src/methods/dev/stop.ts +32 -0
- package/src/methods/events/ack.ts +41 -0
- package/src/methods/events/read.ts +67 -0
- package/src/methods/events/subscribe.ts +91 -0
- package/src/methods/events/unsubscribe.ts +35 -0
- package/src/methods/gc/run.ts +125 -0
- package/src/methods/index.ts +81 -0
- package/src/methods/instance/check.ts +61 -0
- package/src/methods/instance/status.ts +172 -0
- package/src/methods/live/push.ts +54 -0
- package/src/methods/mostra/initialize.ts +249 -0
- package/src/methods/mostra/shutdown.ts +31 -0
- package/src/methods/port/drafts-mirror.ts +52 -0
- package/src/methods/port/secrets-get.ts +40 -0
- package/src/methods/port/submissions-deliver.ts +70 -0
- package/src/methods/port/trusted-controls-activated.ts +51 -0
- package/src/methods/port/trusted-controls-policy.ts +38 -0
- package/src/methods/results/get.ts +59 -0
- package/src/methods/secret/delete.ts +43 -0
- package/src/methods/secret/list.ts +40 -0
- package/src/methods/secret/set.ts +69 -0
- package/src/methods/state/get.ts +44 -0
- package/src/methods/state/patch.ts +51 -0
- package/src/methods/view/default.ts +32 -0
- package/src/methods/view/launch.ts +47 -0
- package/src/methods/view/revoke.ts +39 -0
- package/src/methods/view/rotate.ts +37 -0
- package/src/methods/view/url.ts +84 -0
- package/src/methods/wait/wait.ts +58 -0
- package/src/revision.ts +101 -0
- package/src/rpc/error.ts +107 -0
- package/src/rpc/lines.ts +70 -0
- package/src/rpc/messages.ts +188 -0
- package/src/rpc/peer.ts +341 -0
- package/src/serializer.ts +1217 -0
- package/src/timers.d.ts +8 -0
- package/src/verify.ts +458 -0
- package/src/view.ts +200 -0
- package/src/web-crypto.d.ts +9 -0
- package/src/web-platform.d.ts +35 -0
- package/src/wire-registry.ts +14 -0
- package/src/worker.ts +374 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { LIVE_KEY_PATTERN } from "../../actions.ts";
|
|
3
|
+
import { ArtifactRef } from "../../artifact.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** The params of `live/push` (INTERFACES §6, D56). */
|
|
8
|
+
export interface LivePushParams {
|
|
9
|
+
/** The artifact. */
|
|
10
|
+
readonly artifact: ArtifactRef;
|
|
11
|
+
/** The live source's key; a key `live.ts` doesn't define is created by the push. */
|
|
12
|
+
readonly key: string;
|
|
13
|
+
/** Any JSON, at most 4 MiB. */
|
|
14
|
+
readonly value: unknown;
|
|
15
|
+
/** `replace` (default): the new latest value. `append`: also kept in the source's ring. */
|
|
16
|
+
readonly mode?: "replace" | "append";
|
|
17
|
+
/** Makes retries idempotent: a repeated `requestId` returns the recorded result (H-03). */
|
|
18
|
+
readonly requestId?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The result of `live/push`. */
|
|
22
|
+
export interface LivePushResult {
|
|
23
|
+
/** The value's revision. */
|
|
24
|
+
readonly revision: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const params: z.ZodType<LivePushParams> = z
|
|
28
|
+
.object({
|
|
29
|
+
artifact: ArtifactRef,
|
|
30
|
+
key: z.string().regex(LIVE_KEY_PATTERN),
|
|
31
|
+
value: z.unknown(),
|
|
32
|
+
mode: z.enum(["replace", "append"]).exactOptional(),
|
|
33
|
+
requestId: z.string().min(1).exactOptional(),
|
|
34
|
+
})
|
|
35
|
+
.register(wireRegistry, {
|
|
36
|
+
id: "LivePushParams",
|
|
37
|
+
description: "A value pushed into an artifact's live source.",
|
|
38
|
+
}) as z.ZodType<LivePushParams>;
|
|
39
|
+
|
|
40
|
+
const result: z.ZodType<LivePushResult> = z
|
|
41
|
+
.object({ revision: z.string() })
|
|
42
|
+
.register(wireRegistry, { id: "LivePushResult", description: "The pushed value's revision." });
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* `live/push`: writes a value into an artifact's live source (D56), which every open page reading
|
|
46
|
+
* it receives at once. The latest value persists; updates are never stored as events (D63).
|
|
47
|
+
*/
|
|
48
|
+
export const livePushMethod: MethodDefinition<LivePushParams, LivePushResult> = defineMethod({
|
|
49
|
+
method: "live/push",
|
|
50
|
+
direction: "client-to-instance",
|
|
51
|
+
mutating: true,
|
|
52
|
+
params,
|
|
53
|
+
result,
|
|
54
|
+
});
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { Diagnostic } from "../../diagnostics/diagnostic.ts";
|
|
3
|
+
import { SubmitChannel } from "../../interaction.ts";
|
|
4
|
+
import { SubmissionPolicy } from "../../manifest.ts";
|
|
5
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
6
|
+
import { Revision } from "../../revision.ts";
|
|
7
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
8
|
+
|
|
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 =
|
|
15
|
+
| "identity"
|
|
16
|
+
| "submissions"
|
|
17
|
+
| "drafts"
|
|
18
|
+
| "reviews"
|
|
19
|
+
| "addressing"
|
|
20
|
+
| "trustedControls"
|
|
21
|
+
| "capture"
|
|
22
|
+
| "secrets"
|
|
23
|
+
| "pty"
|
|
24
|
+
| "ai"
|
|
25
|
+
| (string & {});
|
|
26
|
+
|
|
27
|
+
/** The Zod schema of the `PortName` type. */
|
|
28
|
+
export const PortName: z.ZodType<PortName, string> = z
|
|
29
|
+
.string()
|
|
30
|
+
.regex(/^[a-z][a-zA-Z0-9]*$/)
|
|
31
|
+
.register(wireRegistry, {
|
|
32
|
+
id: "PortName",
|
|
33
|
+
description:
|
|
34
|
+
"A host port name: identity, submissions, drafts, reviews, addressing, trustedControls, capture, secrets, pty, or ai (reserved). Open for later ports.",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The standalone CLI's client name (D140 item 4). The supervisor marks a home as configured by a
|
|
39
|
+
* host when any other client sends `home` or `ports`, and the CLI never sends telemetry for such a
|
|
40
|
+
* home. A host that uses this name as its own is out of scope.
|
|
41
|
+
*/
|
|
42
|
+
export const CLI_CLIENT_NAME = "mostra-cli";
|
|
43
|
+
|
|
44
|
+
/** The client that opens a connection. */
|
|
45
|
+
export interface ClientInfo {
|
|
46
|
+
/** The client's name, for logs and status (`mostra-cli`, `jcode`). */
|
|
47
|
+
readonly name: string;
|
|
48
|
+
/** The client's own version. */
|
|
49
|
+
readonly version: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** What the client can handle (D84). */
|
|
53
|
+
export interface ClientCapabilities {
|
|
54
|
+
/** Notification methods the client accepts. The instance sends no others. */
|
|
55
|
+
readonly notifications?: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Home settings from a spawning host (INTERFACES §6). Each setting arrives with the package that
|
|
60
|
+
* implements it.
|
|
61
|
+
*/
|
|
62
|
+
export interface HomeConfig {
|
|
63
|
+
/**
|
|
64
|
+
* The home the client expects. A check, not a setting (D84): the instance chose and locked its
|
|
65
|
+
* home at start-up, and refuses the session with `MOSTRA_HOME_MISMATCH` when this names a
|
|
66
|
+
* different one.
|
|
67
|
+
*/
|
|
68
|
+
readonly path?: string;
|
|
69
|
+
/**
|
|
70
|
+
* The dependency policy (D43, D95), kept in the home's `config.json` for every later client:
|
|
71
|
+
* `auto` (the default) installs any package an artifact imports; `explicit` installs only what
|
|
72
|
+
* `deps/add` adds and reports other imports as `MOSTRA_DEP_MISSING`.
|
|
73
|
+
*/
|
|
74
|
+
readonly dependencies?: DependencyPolicy;
|
|
75
|
+
/**
|
|
76
|
+
* The home's submission policy (D102), kept in `config.json`: it applies to every artifact whose
|
|
77
|
+
* `artifact/publish` names no policy, before the manifest's request.
|
|
78
|
+
*/
|
|
79
|
+
readonly submission?: SubmissionPolicy;
|
|
80
|
+
/**
|
|
81
|
+
* The ports this client always provides, kept in `config.json` under its `client.name` (D105).
|
|
82
|
+
* Submissions made while it is away wait in the outbox for it; an empty list stops that.
|
|
83
|
+
*/
|
|
84
|
+
readonly ports?: readonly PortName[];
|
|
85
|
+
/**
|
|
86
|
+
* The submit channels the home accepts (D40, D108), kept in `config.json`: `["shell"]` lets only
|
|
87
|
+
* the shell's trusted Submit and Choose make submissions and choices; absent, both channels are
|
|
88
|
+
* allowed. A host's `trustedControls` port answers per view instead, when it is connected.
|
|
89
|
+
*/
|
|
90
|
+
readonly submitChannels?: readonly SubmitChannel[];
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** How packages enter an artifact's lockfile (D43). */
|
|
94
|
+
export type DependencyPolicy = "auto" | "explicit";
|
|
95
|
+
|
|
96
|
+
/** The Zod schema of the `DependencyPolicy` type. */
|
|
97
|
+
export const DependencyPolicy: z.ZodType<DependencyPolicy> = z
|
|
98
|
+
.enum(["auto", "explicit"])
|
|
99
|
+
.register(wireRegistry, {
|
|
100
|
+
id: "DependencyPolicy",
|
|
101
|
+
description:
|
|
102
|
+
"How packages enter an artifact's lockfile: auto installs what artifacts import; explicit only what deps/add adds (D43).",
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
/** The params of `mostra/initialize` (INTERFACES §6). */
|
|
106
|
+
export interface MostraInitializeParams {
|
|
107
|
+
/** Who is connecting. */
|
|
108
|
+
readonly client: ClientInfo;
|
|
109
|
+
/**
|
|
110
|
+
* The host protocol revisions the client speaks. The instance picks the newest one it also
|
|
111
|
+
* supports, or refuses with `MOSTRA_HOST_REVISION_UNSUPPORTED`. Entries that aren't revisions
|
|
112
|
+
* never match.
|
|
113
|
+
*/
|
|
114
|
+
readonly revisions: readonly string[];
|
|
115
|
+
/** What the client can handle. */
|
|
116
|
+
readonly capabilities: ClientCapabilities;
|
|
117
|
+
/**
|
|
118
|
+
* Ports the client implements. The instance calls a port only on the connection that registered
|
|
119
|
+
* it; ports it doesn't support get a `MOSTRA_HOST_PORT_UNSUPPORTED` warning.
|
|
120
|
+
*/
|
|
121
|
+
readonly ports: readonly PortName[];
|
|
122
|
+
/** Home settings and the home check. */
|
|
123
|
+
readonly home?: HomeConfig;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/** The instance a client is connected to. */
|
|
127
|
+
export interface InstanceInfo {
|
|
128
|
+
/** The runtime release (`@mostra/runtime` version). */
|
|
129
|
+
readonly version: string;
|
|
130
|
+
/** The home's real path. */
|
|
131
|
+
readonly home: string;
|
|
132
|
+
/** The platform as `<os>-<arch>`, for example `darwin-arm64`. */
|
|
133
|
+
readonly platform: string;
|
|
134
|
+
/** The supervisor's process ID. */
|
|
135
|
+
readonly pid: number;
|
|
136
|
+
/** `host` when spawned over stdio (`mostra-runtime host`), `daemon` when started as a daemon. */
|
|
137
|
+
readonly mode: "host" | "daemon";
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** What the instance offers (D84). */
|
|
141
|
+
export interface InstanceCapabilities {
|
|
142
|
+
/** Every method the instance serves. */
|
|
143
|
+
readonly methods: readonly string[];
|
|
144
|
+
/** Every notification the instance may send. */
|
|
145
|
+
readonly notifications: readonly string[];
|
|
146
|
+
/** The ports the instance calls when a client registers them. */
|
|
147
|
+
readonly ports: readonly PortName[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The result of `mostra/initialize`. */
|
|
151
|
+
export interface MostraInitializeResult {
|
|
152
|
+
/** The negotiated host protocol revision: the newest both sides support. */
|
|
153
|
+
readonly revision: Revision;
|
|
154
|
+
/** The instance the client is connected to. */
|
|
155
|
+
readonly instance: InstanceInfo;
|
|
156
|
+
/** What the instance offers. */
|
|
157
|
+
readonly capabilities: InstanceCapabilities;
|
|
158
|
+
/** Warnings about the session, such as ports the instance doesn't support. */
|
|
159
|
+
readonly warnings: readonly Diagnostic[];
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** The Zod schema of the `ClientInfo` type. */
|
|
163
|
+
export const ClientInfo: z.ZodType<ClientInfo> = z
|
|
164
|
+
.object({ name: z.string().min(1), version: z.string() })
|
|
165
|
+
.register(wireRegistry, { id: "ClientInfo", description: "The client that opens a connection." });
|
|
166
|
+
|
|
167
|
+
/** The Zod schema of the `ClientCapabilities` type. */
|
|
168
|
+
export const ClientCapabilities: z.ZodType<ClientCapabilities> = z
|
|
169
|
+
.object({ notifications: z.array(z.string()).readonly().exactOptional() })
|
|
170
|
+
.register(wireRegistry, {
|
|
171
|
+
id: "ClientCapabilities",
|
|
172
|
+
description: "What the client can handle: the notification methods it accepts.",
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
/** The Zod schema of the `HomeConfig` type. */
|
|
176
|
+
export const HomeConfig: z.ZodType<HomeConfig> = z
|
|
177
|
+
.object({
|
|
178
|
+
path: z.string().min(1).exactOptional(),
|
|
179
|
+
dependencies: DependencyPolicy.exactOptional(),
|
|
180
|
+
submission: SubmissionPolicy.exactOptional(),
|
|
181
|
+
ports: z.array(PortName).max(32).readonly().exactOptional(),
|
|
182
|
+
submitChannels: z.array(SubmitChannel).min(1).max(2).readonly().exactOptional(),
|
|
183
|
+
})
|
|
184
|
+
.register(wireRegistry, {
|
|
185
|
+
id: "HomeConfig",
|
|
186
|
+
description:
|
|
187
|
+
"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).",
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
/** The Zod schema of the `InstanceInfo` type. */
|
|
191
|
+
export const InstanceInfo: z.ZodType<InstanceInfo> = z
|
|
192
|
+
.object({
|
|
193
|
+
version: z.string(),
|
|
194
|
+
home: z.string(),
|
|
195
|
+
platform: z.string(),
|
|
196
|
+
pid: z.int().min(1),
|
|
197
|
+
mode: z.enum(["host", "daemon"]),
|
|
198
|
+
})
|
|
199
|
+
.register(wireRegistry, {
|
|
200
|
+
id: "InstanceInfo",
|
|
201
|
+
description: "The instance a client is connected to.",
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
/** The Zod schema of the `InstanceCapabilities` type. */
|
|
205
|
+
export const InstanceCapabilities: z.ZodType<InstanceCapabilities> = z
|
|
206
|
+
.object({
|
|
207
|
+
methods: z.array(z.string()).readonly(),
|
|
208
|
+
notifications: z.array(z.string()).readonly(),
|
|
209
|
+
ports: z.array(PortName).readonly(),
|
|
210
|
+
})
|
|
211
|
+
.register(wireRegistry, {
|
|
212
|
+
id: "InstanceCapabilities",
|
|
213
|
+
description: "What the instance offers: methods, notifications and supported ports.",
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const params: z.ZodType<MostraInitializeParams> = z
|
|
217
|
+
.object({
|
|
218
|
+
client: ClientInfo,
|
|
219
|
+
revisions: z.array(z.string()).readonly(),
|
|
220
|
+
capabilities: ClientCapabilities,
|
|
221
|
+
ports: z.array(PortName).readonly(),
|
|
222
|
+
home: HomeConfig.exactOptional(),
|
|
223
|
+
})
|
|
224
|
+
.register(wireRegistry, { id: "MostraInitializeParams" });
|
|
225
|
+
|
|
226
|
+
const result: z.ZodType<MostraInitializeResult> = z
|
|
227
|
+
.object({
|
|
228
|
+
revision: Revision.schema,
|
|
229
|
+
instance: InstanceInfo,
|
|
230
|
+
capabilities: InstanceCapabilities,
|
|
231
|
+
warnings: z.array(Diagnostic).readonly(),
|
|
232
|
+
})
|
|
233
|
+
.register(wireRegistry, { id: "MostraInitializeResult" });
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* `mostra/initialize`: opens a session. It must be the first request on a connection and is sent
|
|
237
|
+
* once. It negotiates the protocol revision, registers the client's ports on this connection and
|
|
238
|
+
* checks the home (D59, D84).
|
|
239
|
+
*/
|
|
240
|
+
export const mostraInitializeMethod: MethodDefinition<
|
|
241
|
+
MostraInitializeParams,
|
|
242
|
+
MostraInitializeResult
|
|
243
|
+
> = defineMethod({
|
|
244
|
+
method: "mostra/initialize",
|
|
245
|
+
direction: "client-to-instance",
|
|
246
|
+
mutating: false,
|
|
247
|
+
params,
|
|
248
|
+
result,
|
|
249
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
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 `mostra/shutdown` (INTERFACES §6): none. */
|
|
6
|
+
export type MostraShutdownParams = Record<string, never>;
|
|
7
|
+
|
|
8
|
+
/** The result of `mostra/shutdown`, sent before the instance stops: empty. */
|
|
9
|
+
export type MostraShutdownResult = Record<string, never>;
|
|
10
|
+
|
|
11
|
+
const params: z.ZodType<MostraShutdownParams> = z
|
|
12
|
+
.object({})
|
|
13
|
+
.register(wireRegistry, { id: "MostraShutdownParams" });
|
|
14
|
+
|
|
15
|
+
const result: z.ZodType<MostraShutdownResult> = z
|
|
16
|
+
.object({})
|
|
17
|
+
.register(wireRegistry, { id: "MostraShutdownResult" });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* `mostra/shutdown`: stops the instance cleanly. The instance answers first, then finishes its
|
|
21
|
+
* ledger work, stops its children, removes its socket and `instance.json`, and exits. Available to
|
|
22
|
+
* the spawning host and to every attached client of a daemon (D87).
|
|
23
|
+
*/
|
|
24
|
+
export const mostraShutdownMethod: MethodDefinition<MostraShutdownParams, MostraShutdownResult> =
|
|
25
|
+
defineMethod({
|
|
26
|
+
method: "mostra/shutdown",
|
|
27
|
+
direction: "client-to-instance",
|
|
28
|
+
mutating: false,
|
|
29
|
+
params,
|
|
30
|
+
result,
|
|
31
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactId, ViewerId } from "../../ids.ts";
|
|
3
|
+
import { DocumentRevision } from "../../interaction.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** A viewer's draft, mirrored to a host as it changes (INTERFACES §7, D105). */
|
|
8
|
+
export interface DraftMirror {
|
|
9
|
+
/** Always `draft`: a mirror is never a submission (IN-06). */
|
|
10
|
+
readonly kind: "draft";
|
|
11
|
+
/** The artifact. */
|
|
12
|
+
readonly artifactId: string;
|
|
13
|
+
/** Whose draft it is. */
|
|
14
|
+
readonly viewerId: string;
|
|
15
|
+
/** The draft's epoch (D103). */
|
|
16
|
+
readonly epoch: number;
|
|
17
|
+
/** The draft's revision; a later mirror has a higher one. */
|
|
18
|
+
readonly revision: DocumentRevision;
|
|
19
|
+
/** Every field of the draft by ID. */
|
|
20
|
+
readonly fields: Readonly<Record<string, unknown>>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The result of `port/drafts.mirror`. */
|
|
24
|
+
export type DraftsMirrorResult = unknown;
|
|
25
|
+
|
|
26
|
+
/** The Zod schema of the `DraftMirror` type. */
|
|
27
|
+
export const DraftMirror: z.ZodType<DraftMirror> = z
|
|
28
|
+
.object({
|
|
29
|
+
kind: z.literal("draft"),
|
|
30
|
+
artifactId: ArtifactId.schema,
|
|
31
|
+
viewerId: ViewerId.schema,
|
|
32
|
+
epoch: z.int().min(1),
|
|
33
|
+
revision: DocumentRevision,
|
|
34
|
+
fields: z.record(z.string(), z.unknown()),
|
|
35
|
+
})
|
|
36
|
+
.register(wireRegistry, {
|
|
37
|
+
id: "DraftMirror",
|
|
38
|
+
description: "A viewer's draft mirrored to a host: always kind draft, never a submission.",
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `port/drafts.mirror`: Mostra sends the latest revision of a viewer's draft to a host that
|
|
43
|
+
* registered the drafts port, best effort (D105). Mostra's ledger stays canonical (D58).
|
|
44
|
+
*/
|
|
45
|
+
export const portDraftsMirrorMethod: MethodDefinition<DraftMirror, DraftsMirrorResult> =
|
|
46
|
+
defineMethod({
|
|
47
|
+
method: "port/drafts.mirror",
|
|
48
|
+
direction: "instance-to-host",
|
|
49
|
+
mutating: false,
|
|
50
|
+
params: DraftMirror,
|
|
51
|
+
result: z.unknown(),
|
|
52
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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 `port/secrets.get` (INTERFACES §7, D44). */
|
|
6
|
+
export interface PortSecretsGetParams {
|
|
7
|
+
/** The artifact whose server code asks. */
|
|
8
|
+
readonly artifactId: string;
|
|
9
|
+
/** The secret's name. */
|
|
10
|
+
readonly name: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The result of `port/secrets.get`: the value, or `null` when the host has none. */
|
|
14
|
+
export type PortSecretsGetResult = string | null;
|
|
15
|
+
|
|
16
|
+
const params: z.ZodType<PortSecretsGetParams> = z
|
|
17
|
+
.object({ artifactId: z.string(), name: z.string() })
|
|
18
|
+
.register(wireRegistry, {
|
|
19
|
+
id: "PortSecretsGetParams",
|
|
20
|
+
description: "The artifact and the name of the secret its server code asks for.",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const result: z.ZodType<PortSecretsGetResult> = z.string().nullable().register(wireRegistry, {
|
|
24
|
+
id: "PortSecretsGetResult",
|
|
25
|
+
description: "The secret's value, or null when the host has none.",
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* `port/secrets.get`: Mostra asks the host that registered the `secrets` port for a secret its
|
|
30
|
+
* artifact's server code reads (D44), with 30 seconds to answer. `null` falls back to the home's
|
|
31
|
+
* own store; a failure or a timeout fails the read with `MOSTRA_SECRET_MISSING`.
|
|
32
|
+
*/
|
|
33
|
+
export const portSecretsGetMethod: MethodDefinition<PortSecretsGetParams, PortSecretsGetResult> =
|
|
34
|
+
defineMethod({
|
|
35
|
+
method: "port/secrets.get",
|
|
36
|
+
direction: "instance-to-host",
|
|
37
|
+
mutating: false,
|
|
38
|
+
params,
|
|
39
|
+
result,
|
|
40
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactId, DeliveryId, SubmissionId } from "../../ids.ts";
|
|
3
|
+
import { Results } from "../../interaction.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** One submission delivered to a host (INTERFACES §7, D105). */
|
|
8
|
+
export interface SubmissionEnvelope {
|
|
9
|
+
/** Always `submission`: a draft never arrives through this port (IN-06). */
|
|
10
|
+
readonly kind: "submission";
|
|
11
|
+
/** Stable across redeliveries: treat a repeated ID as the same delivery (H-03). */
|
|
12
|
+
readonly deliveryId: string;
|
|
13
|
+
/** The submission. */
|
|
14
|
+
readonly submissionId: string;
|
|
15
|
+
/** Its artifact. */
|
|
16
|
+
readonly artifactId: string;
|
|
17
|
+
/** 1 for the first attempt; more after retries and restarts. */
|
|
18
|
+
readonly attempt: number;
|
|
19
|
+
/** The complete submission (INTERFACES §8), built from the immutable submission alone. */
|
|
20
|
+
readonly results: Results;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** What a host answers a delivery. */
|
|
24
|
+
export type SubmissionsDeliverResult =
|
|
25
|
+
| { readonly accepted: true }
|
|
26
|
+
| {
|
|
27
|
+
readonly accepted: false;
|
|
28
|
+
/** `duplicate` (already held), `undeliverable` (terminal, shown to the viewer), or the host's own. */
|
|
29
|
+
readonly reason: string;
|
|
30
|
+
/** `true` keeps the delivery pending and retries it with backoff. */
|
|
31
|
+
readonly retry: boolean;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** The Zod schema of the `SubmissionEnvelope` type. */
|
|
35
|
+
export const SubmissionEnvelope: z.ZodType<SubmissionEnvelope> = z
|
|
36
|
+
.object({
|
|
37
|
+
kind: z.literal("submission"),
|
|
38
|
+
deliveryId: DeliveryId.schema,
|
|
39
|
+
submissionId: SubmissionId.schema,
|
|
40
|
+
artifactId: ArtifactId.schema,
|
|
41
|
+
attempt: z.int().min(1),
|
|
42
|
+
results: Results,
|
|
43
|
+
})
|
|
44
|
+
.register(wireRegistry, {
|
|
45
|
+
id: "SubmissionEnvelope",
|
|
46
|
+
description:
|
|
47
|
+
"One submission delivered to a host: delivery ID, attempt and the complete results.",
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const result: z.ZodType<SubmissionsDeliverResult> = z
|
|
51
|
+
.union([
|
|
52
|
+
z.object({ accepted: z.literal(true) }),
|
|
53
|
+
z.object({ accepted: z.literal(false), reason: z.string().min(1), retry: z.boolean() }),
|
|
54
|
+
])
|
|
55
|
+
.register(wireRegistry, { id: "PortSubmissionsDeliverResult" });
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* `port/submissions.deliver`: Mostra delivers one submission to the host that registered the
|
|
59
|
+
* submissions port, after the submission is durable (IN-12), one at a time in submission order.
|
|
60
|
+
*/
|
|
61
|
+
export const portSubmissionsDeliverMethod: MethodDefinition<
|
|
62
|
+
SubmissionEnvelope,
|
|
63
|
+
SubmissionsDeliverResult
|
|
64
|
+
> = defineMethod({
|
|
65
|
+
method: "port/submissions.deliver",
|
|
66
|
+
direction: "instance-to-host",
|
|
67
|
+
mutating: false,
|
|
68
|
+
params: SubmissionEnvelope,
|
|
69
|
+
result,
|
|
70
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactId, ViewId } from "../../ids.ts";
|
|
3
|
+
import { TrustedControl, Viewer } from "../../interaction.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** The params of `port/trustedControls.activated` (INTERFACES §7): a person used a trusted control. */
|
|
8
|
+
export interface PortTrustedControlsActivatedParams {
|
|
9
|
+
/** The artifact. */
|
|
10
|
+
readonly artifactId: string;
|
|
11
|
+
/** The control: `submit` or `choose`. */
|
|
12
|
+
readonly control: TrustedControl;
|
|
13
|
+
/** Who used it. */
|
|
14
|
+
readonly viewer: Viewer;
|
|
15
|
+
/** The view it was used in. */
|
|
16
|
+
readonly viewId: string;
|
|
17
|
+
/** What it did: the submission it made, or the review set and candidate it chose. */
|
|
18
|
+
readonly detail?: Readonly<Record<string, string>>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** The result of `port/trustedControls.activated`; its content is ignored. */
|
|
22
|
+
export type PortTrustedControlsActivatedResult = unknown;
|
|
23
|
+
|
|
24
|
+
const params: z.ZodType<PortTrustedControlsActivatedParams> = z
|
|
25
|
+
.object({
|
|
26
|
+
artifactId: ArtifactId.schema,
|
|
27
|
+
control: TrustedControl,
|
|
28
|
+
viewer: Viewer,
|
|
29
|
+
viewId: ViewId.schema,
|
|
30
|
+
detail: z.record(z.string(), z.string()).exactOptional(),
|
|
31
|
+
})
|
|
32
|
+
.register(wireRegistry, {
|
|
33
|
+
id: "PortTrustedControlsActivatedParams",
|
|
34
|
+
description: "A trusted control a person used: the artifact, control, viewer, view and detail.",
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* `port/trustedControls.activated`: after a trusted control's change commits, Mostra tells the
|
|
39
|
+
* host that registered the `trustedControls` port, best effort and never retried (D108). The
|
|
40
|
+
* change itself is durable already; this call only lets a host react at once.
|
|
41
|
+
*/
|
|
42
|
+
export const portTrustedControlsActivatedMethod: MethodDefinition<
|
|
43
|
+
PortTrustedControlsActivatedParams,
|
|
44
|
+
PortTrustedControlsActivatedResult
|
|
45
|
+
> = defineMethod({
|
|
46
|
+
method: "port/trustedControls.activated",
|
|
47
|
+
direction: "instance-to-host",
|
|
48
|
+
mutating: false,
|
|
49
|
+
params,
|
|
50
|
+
result: z.unknown(),
|
|
51
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactSummary } from "../../artifact.ts";
|
|
3
|
+
import { ControlsPolicy } from "../../interaction.ts";
|
|
4
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
5
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
6
|
+
|
|
7
|
+
/** The params of `port/trustedControls.policy` (INTERFACES §7). */
|
|
8
|
+
export interface PortTrustedControlsPolicyParams {
|
|
9
|
+
/** The artifact a frame is about to show, with the metadata of its latest version. */
|
|
10
|
+
readonly artifact: ArtifactSummary;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** The result of `port/trustedControls.policy`: the channels and controls for the view (D108). */
|
|
14
|
+
export type PortTrustedControlsPolicyResult = ControlsPolicy;
|
|
15
|
+
|
|
16
|
+
const params: z.ZodType<PortTrustedControlsPolicyParams> = z
|
|
17
|
+
.object({ artifact: ArtifactSummary })
|
|
18
|
+
.register(wireRegistry, {
|
|
19
|
+
id: "PortTrustedControlsPolicyParams",
|
|
20
|
+
description: "The artifact a frame is about to show, for its host's controls policy.",
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* `port/trustedControls.policy`: Mostra asks the host that registered the `trustedControls` port
|
|
25
|
+
* which submit channels a new view of an artifact accepts and which trusted controls its shell
|
|
26
|
+
* renders (D108). Asked once per frame load, with 5 seconds to answer; a failure narrows the view
|
|
27
|
+
* to the shell channel.
|
|
28
|
+
*/
|
|
29
|
+
export const portTrustedControlsPolicyMethod: MethodDefinition<
|
|
30
|
+
PortTrustedControlsPolicyParams,
|
|
31
|
+
PortTrustedControlsPolicyResult
|
|
32
|
+
> = defineMethod({
|
|
33
|
+
method: "port/trustedControls.policy",
|
|
34
|
+
direction: "instance-to-host",
|
|
35
|
+
mutating: false,
|
|
36
|
+
params,
|
|
37
|
+
result: ControlsPolicy,
|
|
38
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ArtifactRef } from "../../artifact.ts";
|
|
3
|
+
import { SubmissionId } from "../../ids.ts";
|
|
4
|
+
import { Results } from "../../interaction.ts";
|
|
5
|
+
import { defineMethod, type MethodDefinition } from "../../method.ts";
|
|
6
|
+
import { wireRegistry } from "../../wire-registry.ts";
|
|
7
|
+
|
|
8
|
+
/** The params of `results/get` (INTERFACES §6, §8). */
|
|
9
|
+
export interface ResultsGetParams {
|
|
10
|
+
/** The artifact whose submission to read. */
|
|
11
|
+
readonly artifact: ArtifactRef;
|
|
12
|
+
/** The submission to read; absent: the artifact's latest. */
|
|
13
|
+
readonly submission?: string;
|
|
14
|
+
/** `json` (the default): the Results structure; `md`: Markdown for agents to read. */
|
|
15
|
+
readonly format?: "json" | "md";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Results rendered as Markdown (ROUND-2 §1.1). */
|
|
19
|
+
export interface ResultsMarkdown {
|
|
20
|
+
/** The submission rendered. */
|
|
21
|
+
readonly submissionId: string;
|
|
22
|
+
/** The Markdown: a header with IDs, answers by label, choices, comments, actions, signals, orphans. */
|
|
23
|
+
readonly markdown: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** The result of `results/get`: the Results structure, or its Markdown for `format: "md"`. */
|
|
27
|
+
export type ResultsGetResult = Results | ResultsMarkdown;
|
|
28
|
+
|
|
29
|
+
const params: z.ZodType<ResultsGetParams> = z
|
|
30
|
+
.object({
|
|
31
|
+
artifact: ArtifactRef,
|
|
32
|
+
submission: SubmissionId.schema.exactOptional(),
|
|
33
|
+
format: z.enum(["json", "md"]).exactOptional(),
|
|
34
|
+
})
|
|
35
|
+
.register(wireRegistry, { id: "ResultsGetParams" });
|
|
36
|
+
|
|
37
|
+
/** The Zod schema of the `ResultsMarkdown` type. */
|
|
38
|
+
export const ResultsMarkdown: z.ZodType<ResultsMarkdown> = z
|
|
39
|
+
.object({ submissionId: SubmissionId.schema, markdown: z.string() })
|
|
40
|
+
.register(wireRegistry, {
|
|
41
|
+
id: "ResultsMarkdown",
|
|
42
|
+
description: "A submission's results as Markdown for agents.",
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const result: z.ZodType<ResultsGetResult> = z
|
|
46
|
+
.union([Results, ResultsMarkdown])
|
|
47
|
+
.register(wireRegistry, { id: "ResultsGetResult" });
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* `results/get`: the complete submission (INTERFACES §8), as JSON or as Markdown. Fails with
|
|
51
|
+
* `MOSTRA_SUBMIT_NOT_FOUND` when the artifact has no such submission yet.
|
|
52
|
+
*/
|
|
53
|
+
export const resultsGetMethod: MethodDefinition<ResultsGetParams, ResultsGetResult> = defineMethod({
|
|
54
|
+
method: "results/get",
|
|
55
|
+
direction: "client-to-instance",
|
|
56
|
+
mutating: false,
|
|
57
|
+
params,
|
|
58
|
+
result,
|
|
59
|
+
});
|