@mostra/protocol 0.0.0-placeholder → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +37 -1
- package/dist/actions.d.ts +273 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +154 -0
- package/dist/actions.js.map +1 -0
- package/dist/artifact.d.ts +113 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +79 -0
- package/dist/artifact.js.map +1 -0
- package/dist/bridge.d.ts +295 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +343 -0
- package/dist/bridge.js.map +1 -0
- package/dist/browser.d.ts +195 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +156 -0
- package/dist/browser.js.map +1 -0
- package/dist/bundle.d.ts +155 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +130 -0
- package/dist/bundle.js.map +1 -0
- package/dist/canonical.d.ts +23 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +45 -0
- package/dist/canonical.js.map +1 -0
- package/dist/capability.d.ts +38 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +61 -0
- package/dist/capability.js.map +1 -0
- package/dist/diagnostics/codes/a11y.d.ts +8 -0
- package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
- package/dist/diagnostics/codes/a11y.js +30 -0
- package/dist/diagnostics/codes/a11y.js.map +1 -0
- package/dist/diagnostics/codes/action.d.ts +8 -0
- package/dist/diagnostics/codes/action.d.ts.map +1 -0
- package/dist/diagnostics/codes/action.js +110 -0
- package/dist/diagnostics/codes/action.js.map +1 -0
- package/dist/diagnostics/codes/artifact.d.ts +8 -0
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
- package/dist/diagnostics/codes/artifact.js +121 -0
- package/dist/diagnostics/codes/artifact.js.map +1 -0
- package/dist/diagnostics/codes/build.d.ts +8 -0
- package/dist/diagnostics/codes/build.d.ts.map +1 -0
- package/dist/diagnostics/codes/build.js +55 -0
- package/dist/diagnostics/codes/build.js.map +1 -0
- package/dist/diagnostics/codes/cli.d.ts +8 -0
- package/dist/diagnostics/codes/cli.d.ts.map +1 -0
- package/dist/diagnostics/codes/cli.js +44 -0
- package/dist/diagnostics/codes/cli.js.map +1 -0
- package/dist/diagnostics/codes/console.d.ts +8 -0
- package/dist/diagnostics/codes/console.d.ts.map +1 -0
- package/dist/diagnostics/codes/console.js +30 -0
- package/dist/diagnostics/codes/console.js.map +1 -0
- package/dist/diagnostics/codes/dep.d.ts +8 -0
- package/dist/diagnostics/codes/dep.d.ts.map +1 -0
- package/dist/diagnostics/codes/dep.js +88 -0
- package/dist/diagnostics/codes/dep.js.map +1 -0
- package/dist/diagnostics/codes/env.d.ts +8 -0
- package/dist/diagnostics/codes/env.d.ts.map +1 -0
- package/dist/diagnostics/codes/env.js +132 -0
- package/dist/diagnostics/codes/env.js.map +1 -0
- package/dist/diagnostics/codes/field.d.ts +8 -0
- package/dist/diagnostics/codes/field.d.ts.map +1 -0
- package/dist/diagnostics/codes/field.js +99 -0
- package/dist/diagnostics/codes/field.js.map +1 -0
- package/dist/diagnostics/codes/home.d.ts +8 -0
- package/dist/diagnostics/codes/home.d.ts.map +1 -0
- package/dist/diagnostics/codes/home.js +132 -0
- package/dist/diagnostics/codes/home.js.map +1 -0
- package/dist/diagnostics/codes/host.d.ts +8 -0
- package/dist/diagnostics/codes/host.d.ts.map +1 -0
- package/dist/diagnostics/codes/host.js +176 -0
- package/dist/diagnostics/codes/host.js.map +1 -0
- package/dist/diagnostics/codes/hygiene.d.ts +8 -0
- package/dist/diagnostics/codes/hygiene.d.ts.map +1 -0
- package/dist/diagnostics/codes/hygiene.js +154 -0
- package/dist/diagnostics/codes/hygiene.js.map +1 -0
- package/dist/diagnostics/codes/index.d.ts +51 -0
- package/dist/diagnostics/codes/index.d.ts.map +1 -0
- package/dist/diagnostics/codes/index.js +72 -0
- package/dist/diagnostics/codes/index.js.map +1 -0
- package/dist/diagnostics/codes/live.d.ts +8 -0
- package/dist/diagnostics/codes/live.d.ts.map +1 -0
- package/dist/diagnostics/codes/live.js +30 -0
- package/dist/diagnostics/codes/live.js.map +1 -0
- package/dist/diagnostics/codes/manifest.d.ts +8 -0
- package/dist/diagnostics/codes/manifest.d.ts.map +1 -0
- package/dist/diagnostics/codes/manifest.js +44 -0
- package/dist/diagnostics/codes/manifest.js.map +1 -0
- package/dist/diagnostics/codes/network.d.ts +8 -0
- package/dist/diagnostics/codes/network.d.ts.map +1 -0
- package/dist/diagnostics/codes/network.js +30 -0
- package/dist/diagnostics/codes/network.js.map +1 -0
- package/dist/diagnostics/codes/platform.d.ts +8 -0
- package/dist/diagnostics/codes/platform.d.ts.map +1 -0
- package/dist/diagnostics/codes/platform.js +18 -0
- package/dist/diagnostics/codes/platform.js.map +1 -0
- package/dist/diagnostics/codes/publish.d.ts +8 -0
- package/dist/diagnostics/codes/publish.d.ts.map +1 -0
- package/dist/diagnostics/codes/publish.js +44 -0
- package/dist/diagnostics/codes/publish.js.map +1 -0
- package/dist/diagnostics/codes/regression.d.ts +8 -0
- package/dist/diagnostics/codes/regression.d.ts.map +1 -0
- package/dist/diagnostics/codes/regression.js +77 -0
- package/dist/diagnostics/codes/regression.js.map +1 -0
- package/dist/diagnostics/codes/runtime.d.ts +8 -0
- package/dist/diagnostics/codes/runtime.d.ts.map +1 -0
- package/dist/diagnostics/codes/runtime.js +66 -0
- package/dist/diagnostics/codes/runtime.js.map +1 -0
- package/dist/diagnostics/codes/secret.d.ts +8 -0
- package/dist/diagnostics/codes/secret.d.ts.map +1 -0
- package/dist/diagnostics/codes/secret.js +18 -0
- package/dist/diagnostics/codes/secret.js.map +1 -0
- package/dist/diagnostics/codes/smoke.d.ts +8 -0
- package/dist/diagnostics/codes/smoke.d.ts.map +1 -0
- package/dist/diagnostics/codes/smoke.js +30 -0
- package/dist/diagnostics/codes/smoke.js.map +1 -0
- package/dist/diagnostics/codes/submit.d.ts +8 -0
- package/dist/diagnostics/codes/submit.d.ts.map +1 -0
- package/dist/diagnostics/codes/submit.js +99 -0
- package/dist/diagnostics/codes/submit.js.map +1 -0
- package/dist/diagnostics/codes/target.d.ts +8 -0
- package/dist/diagnostics/codes/target.d.ts.map +1 -0
- package/dist/diagnostics/codes/target.js +18 -0
- package/dist/diagnostics/codes/target.js.map +1 -0
- package/dist/diagnostics/codes/type.d.ts +8 -0
- package/dist/diagnostics/codes/type.d.ts.map +1 -0
- package/dist/diagnostics/codes/type.js +30 -0
- package/dist/diagnostics/codes/type.js.map +1 -0
- package/dist/diagnostics/codes/verify.d.ts +8 -0
- package/dist/diagnostics/codes/verify.d.ts.map +1 -0
- package/dist/diagnostics/codes/verify.js +99 -0
- package/dist/diagnostics/codes/verify.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +79 -0
- package/dist/diagnostics/diagnostic.d.ts.map +1 -0
- package/dist/diagnostics/diagnostic.js +131 -0
- package/dist/diagnostics/diagnostic.js.map +1 -0
- package/dist/diagnostics/spec.d.ts +49 -0
- package/dist/diagnostics/spec.d.ts.map +1 -0
- package/dist/diagnostics/spec.js +31 -0
- package/dist/diagnostics/spec.js.map +1 -0
- package/dist/hygiene.d.ts +66 -0
- package/dist/hygiene.d.ts.map +1 -0
- package/dist/hygiene.js +134 -0
- package/dist/hygiene.js.map +1 -0
- package/dist/ids.d.ts +119 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +135 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +86 -0
- package/dist/interaction.d.ts +391 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +306 -0
- package/dist/interaction.js.map +1 -0
- package/dist/manifest.d.ts +97 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +101 -0
- package/dist/manifest.js.map +1 -0
- package/dist/method.d.ts +26 -0
- package/dist/method.d.ts.map +1 -0
- package/dist/method.js +10 -0
- package/dist/method.js.map +1 -0
- package/dist/methods/artifact/create.d.ts +29 -0
- package/dist/methods/artifact/create.d.ts.map +1 -0
- package/dist/methods/artifact/create.js +31 -0
- package/dist/methods/artifact/create.js.map +1 -0
- package/dist/methods/artifact/get.d.ts +17 -0
- package/dist/methods/artifact/get.d.ts.map +1 -0
- package/dist/methods/artifact/get.js +21 -0
- package/dist/methods/artifact/get.js.map +1 -0
- package/dist/methods/artifact/list.d.ts +22 -0
- package/dist/methods/artifact/list.d.ts.map +1 -0
- package/dist/methods/artifact/list.js +19 -0
- package/dist/methods/artifact/list.js.map +1 -0
- package/dist/methods/artifact/publish.d.ts +28 -0
- package/dist/methods/artifact/publish.d.ts.map +1 -0
- package/dist/methods/artifact/publish.js +28 -0
- package/dist/methods/artifact/publish.js.map +1 -0
- package/dist/methods/artifact/verify.d.ts +29 -0
- package/dist/methods/artifact/verify.d.ts.map +1 -0
- package/dist/methods/artifact/verify.js +27 -0
- package/dist/methods/artifact/verify.js.map +1 -0
- package/dist/methods/deps/add.d.ts +43 -0
- package/dist/methods/deps/add.d.ts.map +1 -0
- package/dist/methods/deps/add.js +40 -0
- package/dist/methods/deps/add.js.map +1 -0
- package/dist/methods/dev/start.d.ts +52 -0
- package/dist/methods/dev/start.d.ts.map +1 -0
- package/dist/methods/dev/start.js +56 -0
- package/dist/methods/dev/start.js.map +1 -0
- package/dist/methods/dev/stop.d.ts +16 -0
- package/dist/methods/dev/stop.d.ts.map +1 -0
- package/dist/methods/dev/stop.js +21 -0
- package/dist/methods/dev/stop.js.map +1 -0
- package/dist/methods/events/ack.d.ts +20 -0
- package/dist/methods/events/ack.d.ts.map +1 -0
- package/dist/methods/events/ack.js +26 -0
- package/dist/methods/events/ack.js.map +1 -0
- package/dist/methods/events/read.d.ts +40 -0
- package/dist/methods/events/read.d.ts.map +1 -0
- package/dist/methods/events/read.js +35 -0
- package/dist/methods/events/read.js.map +1 -0
- package/dist/methods/events/subscribe.d.ts +54 -0
- package/dist/methods/events/subscribe.d.ts.map +1 -0
- package/dist/methods/events/subscribe.js +44 -0
- package/dist/methods/events/subscribe.js.map +1 -0
- package/dist/methods/events/unsubscribe.d.ts +16 -0
- package/dist/methods/events/unsubscribe.d.ts.map +1 -0
- package/dist/methods/events/unsubscribe.js +21 -0
- package/dist/methods/events/unsubscribe.js.map +1 -0
- package/dist/methods/gc/run.d.ts +76 -0
- package/dist/methods/gc/run.d.ts.map +1 -0
- package/dist/methods/gc/run.js +56 -0
- package/dist/methods/gc/run.js.map +1 -0
- package/dist/methods/index.d.ts +6 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +78 -0
- package/dist/methods/index.js.map +1 -0
- package/dist/methods/instance/check.d.ts +30 -0
- package/dist/methods/instance/check.d.ts.map +1 -0
- package/dist/methods/instance/check.js +34 -0
- package/dist/methods/instance/check.js.map +1 -0
- package/dist/methods/instance/status.d.ts +102 -0
- package/dist/methods/instance/status.d.ts.map +1 -0
- package/dist/methods/instance/status.js +83 -0
- package/dist/methods/instance/status.js.map +1 -0
- package/dist/methods/live/push.d.ts +28 -0
- package/dist/methods/live/push.d.ts.map +1 -0
- package/dist/methods/live/push.js +35 -0
- package/dist/methods/live/push.js.map +1 -0
- package/dist/methods/mostra/initialize.d.ts +143 -0
- package/dist/methods/mostra/initialize.d.ts.map +1 -0
- package/dist/methods/mostra/initialize.js +97 -0
- package/dist/methods/mostra/initialize.js.map +1 -0
- package/dist/methods/mostra/shutdown.d.ts +14 -0
- package/dist/methods/mostra/shutdown.d.ts.map +1 -0
- package/dist/methods/mostra/shutdown.js +22 -0
- package/dist/methods/mostra/shutdown.js.map +1 -0
- package/dist/methods/port/drafts-mirror.d.ts +30 -0
- package/dist/methods/port/drafts-mirror.d.ts.map +1 -0
- package/dist/methods/port/drafts-mirror.js +33 -0
- package/dist/methods/port/drafts-mirror.js.map +1 -0
- package/dist/methods/port/secrets-get.d.ts +19 -0
- package/dist/methods/port/secrets-get.d.ts.map +1 -0
- package/dist/methods/port/secrets-get.js +31 -0
- package/dist/methods/port/secrets-get.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +38 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
- package/dist/methods/port/submissions-deliver.js +38 -0
- package/dist/methods/port/submissions-deliver.js.map +1 -0
- package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
- package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-activated.js +33 -0
- package/dist/methods/port/trusted-controls-activated.js.map +1 -0
- package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
- package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-policy.js +27 -0
- package/dist/methods/port/trusted-controls-policy.js.map +1 -0
- package/dist/methods/results/get.d.ts +32 -0
- package/dist/methods/results/get.d.ts.map +1 -0
- package/dist/methods/results/get.js +36 -0
- package/dist/methods/results/get.js.map +1 -0
- package/dist/methods/secret/delete.d.ts +22 -0
- package/dist/methods/secret/delete.d.ts.map +1 -0
- package/dist/methods/secret/delete.js +32 -0
- package/dist/methods/secret/delete.js.map +1 -0
- package/dist/methods/secret/list.d.ts +21 -0
- package/dist/methods/secret/list.d.ts.map +1 -0
- package/dist/methods/secret/list.js +29 -0
- package/dist/methods/secret/list.js.map +1 -0
- package/dist/methods/secret/set.d.ts +37 -0
- package/dist/methods/secret/set.d.ts.map +1 -0
- package/dist/methods/secret/set.js +41 -0
- package/dist/methods/secret/set.js.map +1 -0
- package/dist/methods/state/get.d.ts +25 -0
- package/dist/methods/state/get.d.ts.map +1 -0
- package/dist/methods/state/get.js +29 -0
- package/dist/methods/state/get.js.map +1 -0
- package/dist/methods/state/patch.d.ts +32 -0
- package/dist/methods/state/patch.d.ts.map +1 -0
- package/dist/methods/state/patch.js +29 -0
- package/dist/methods/state/patch.js.map +1 -0
- package/dist/methods/view/default.d.ts +19 -0
- package/dist/methods/view/default.d.ts.map +1 -0
- package/dist/methods/view/default.js +23 -0
- package/dist/methods/view/default.js.map +1 -0
- package/dist/methods/view/launch.d.ts +27 -0
- package/dist/methods/view/launch.d.ts.map +1 -0
- package/dist/methods/view/launch.js +30 -0
- package/dist/methods/view/launch.js.map +1 -0
- package/dist/methods/view/revoke.d.ts +19 -0
- package/dist/methods/view/revoke.d.ts.map +1 -0
- package/dist/methods/view/revoke.js +26 -0
- package/dist/methods/view/revoke.js.map +1 -0
- package/dist/methods/view/rotate.d.ts +21 -0
- package/dist/methods/view/rotate.d.ts.map +1 -0
- package/dist/methods/view/rotate.js +27 -0
- package/dist/methods/view/rotate.js.map +1 -0
- package/dist/methods/view/url.d.ts +52 -0
- package/dist/methods/view/url.d.ts.map +1 -0
- package/dist/methods/view/url.js +43 -0
- package/dist/methods/view/url.js.map +1 -0
- package/dist/methods/wait/wait.d.ts +37 -0
- package/dist/methods/wait/wait.d.ts.map +1 -0
- package/dist/methods/wait/wait.js +39 -0
- package/dist/methods/wait/wait.js.map +1 -0
- package/dist/revision.d.ts +43 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +69 -0
- package/dist/revision.js.map +1 -0
- package/dist/rpc/error.d.ts +47 -0
- package/dist/rpc/error.d.ts.map +1 -0
- package/dist/rpc/error.js +77 -0
- package/dist/rpc/error.js.map +1 -0
- package/dist/rpc/lines.d.ts +30 -0
- package/dist/rpc/lines.d.ts.map +1 -0
- package/dist/rpc/lines.js +63 -0
- package/dist/rpc/lines.js.map +1 -0
- package/dist/rpc/messages.d.ts +92 -0
- package/dist/rpc/messages.d.ts.map +1 -0
- package/dist/rpc/messages.js +133 -0
- package/dist/rpc/messages.js.map +1 -0
- package/dist/rpc/peer.d.ts +81 -0
- package/dist/rpc/peer.d.ts.map +1 -0
- package/dist/rpc/peer.js +208 -0
- package/dist/rpc/peer.js.map +1 -0
- package/dist/serializer.d.ts +178 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +929 -0
- package/dist/serializer.js.map +1 -0
- package/dist/verify.d.ts +254 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +243 -0
- package/dist/verify.js.map +1 -0
- package/dist/view.d.ts +103 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +110 -0
- package/dist/view.js.map +1 -0
- package/dist/wire-registry.js +11 -0
- package/dist/wire-registry.js.map +1 -0
- package/dist/worker.d.ts +249 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +158 -0
- package/dist/worker.js.map +1 -0
- package/package.json +114 -4
- package/schemas/protocol.draft-07.json +5120 -0
- package/schemas/protocol.schema.json +4964 -0
- package/src/actions.ts +418 -0
- package/src/artifact.ts +187 -0
- package/src/bridge.ts +618 -0
- package/src/browser.ts +374 -0
- package/src/bundle.ts +264 -0
- package/src/canonical.ts +49 -0
- package/src/capability.ts +92 -0
- package/src/diagnostics/codes/a11y.ts +41 -0
- package/src/diagnostics/codes/action.ts +125 -0
- package/src/diagnostics/codes/artifact.ts +137 -0
- package/src/diagnostics/codes/build.ts +65 -0
- package/src/diagnostics/codes/cli.ts +53 -0
- package/src/diagnostics/codes/console.ts +41 -0
- package/src/diagnostics/codes/dep.ts +101 -0
- package/src/diagnostics/codes/env.ts +149 -0
- package/src/diagnostics/codes/field.ts +113 -0
- package/src/diagnostics/codes/home.ts +150 -0
- package/src/diagnostics/codes/host.ts +197 -0
- package/src/diagnostics/codes/hygiene.ts +175 -0
- package/src/diagnostics/codes/index.ts +142 -0
- package/src/diagnostics/codes/live.ts +41 -0
- package/src/diagnostics/codes/manifest.ts +53 -0
- package/src/diagnostics/codes/network.ts +41 -0
- package/src/diagnostics/codes/platform.ts +30 -0
- package/src/diagnostics/codes/publish.ts +53 -0
- package/src/diagnostics/codes/regression.ts +89 -0
- package/src/diagnostics/codes/runtime.ts +77 -0
- package/src/diagnostics/codes/secret.ts +29 -0
- package/src/diagnostics/codes/smoke.ts +41 -0
- package/src/diagnostics/codes/submit.ts +113 -0
- package/src/diagnostics/codes/target.ts +29 -0
- package/src/diagnostics/codes/type.ts +41 -0
- package/src/diagnostics/codes/verify.ts +113 -0
- package/src/diagnostics/diagnostic.ts +240 -0
- package/src/diagnostics/spec.ts +90 -0
- package/src/hygiene.ts +224 -0
- package/src/ids.ts +279 -0
- package/src/index.ts +576 -0
- package/src/interaction.ts +728 -0
- package/src/manifest.ts +206 -0
- package/src/method.ts +42 -0
- package/src/methods/artifact/create.ts +56 -0
- package/src/methods/artifact/get.ts +30 -0
- package/src/methods/artifact/list.ts +42 -0
- package/src/methods/artifact/publish.ts +46 -0
- package/src/methods/artifact/verify.ts +46 -0
- package/src/methods/deps/add.ts +72 -0
- package/src/methods/dev/start.ts +84 -0
- package/src/methods/dev/stop.ts +32 -0
- package/src/methods/events/ack.ts +41 -0
- package/src/methods/events/read.ts +67 -0
- package/src/methods/events/subscribe.ts +91 -0
- package/src/methods/events/unsubscribe.ts +35 -0
- package/src/methods/gc/run.ts +125 -0
- package/src/methods/index.ts +81 -0
- package/src/methods/instance/check.ts +61 -0
- package/src/methods/instance/status.ts +172 -0
- package/src/methods/live/push.ts +54 -0
- package/src/methods/mostra/initialize.ts +249 -0
- package/src/methods/mostra/shutdown.ts +31 -0
- package/src/methods/port/drafts-mirror.ts +52 -0
- package/src/methods/port/secrets-get.ts +40 -0
- package/src/methods/port/submissions-deliver.ts +70 -0
- package/src/methods/port/trusted-controls-activated.ts +51 -0
- package/src/methods/port/trusted-controls-policy.ts +38 -0
- package/src/methods/results/get.ts +59 -0
- package/src/methods/secret/delete.ts +43 -0
- package/src/methods/secret/list.ts +40 -0
- package/src/methods/secret/set.ts +69 -0
- package/src/methods/state/get.ts +44 -0
- package/src/methods/state/patch.ts +51 -0
- package/src/methods/view/default.ts +32 -0
- package/src/methods/view/launch.ts +47 -0
- package/src/methods/view/revoke.ts +39 -0
- package/src/methods/view/rotate.ts +37 -0
- package/src/methods/view/url.ts +84 -0
- package/src/methods/wait/wait.ts +58 -0
- package/src/revision.ts +101 -0
- package/src/rpc/error.ts +107 -0
- package/src/rpc/lines.ts +70 -0
- package/src/rpc/messages.ts +188 -0
- package/src/rpc/peer.ts +341 -0
- package/src/serializer.ts +1217 -0
- package/src/timers.d.ts +8 -0
- package/src/verify.ts +458 -0
- package/src/view.ts +200 -0
- package/src/web-crypto.d.ts +9 -0
- package/src/web-platform.d.ts +35 -0
- package/src/wire-registry.ts +14 -0
- package/src/worker.ts +374 -0
package/dist/verify.js
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { wireRegistry } from "./wire-registry.js";
|
|
2
|
+
import { Diagnostic } from "./diagnostics/diagnostic.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/verify.ts
|
|
5
|
+
/**
|
|
6
|
+
* `verify` (D29, D41, D55, D72, D138; INTERFACES §13): the verdict it returns, the viewports it
|
|
7
|
+
* renders, and the image-token estimates every screenshot carries. Pure and free of I/O, so the
|
|
8
|
+
* runtime, the verify runner, the CLI and the MCP server share one definition.
|
|
9
|
+
*/
|
|
10
|
+
/** The Zod schema of the `ScreenshotPolicy` type. */
|
|
11
|
+
const ScreenshotPolicy = z.enum([
|
|
12
|
+
"on-failure",
|
|
13
|
+
"always",
|
|
14
|
+
"never"
|
|
15
|
+
]).register(wireRegistry, {
|
|
16
|
+
id: "ScreenshotPolicy",
|
|
17
|
+
description: "When screenshots are returned: on failure (the default), always or never."
|
|
18
|
+
});
|
|
19
|
+
/** The viewports verify renders when the manifest names none (ROUND-3 §9): desktop and mobile. */
|
|
20
|
+
const DEFAULT_VIEWPORTS = [{
|
|
21
|
+
name: "desktop",
|
|
22
|
+
width: 1280,
|
|
23
|
+
height: 800
|
|
24
|
+
}, {
|
|
25
|
+
name: "mobile",
|
|
26
|
+
width: 390,
|
|
27
|
+
height: 844
|
|
28
|
+
}];
|
|
29
|
+
const NAMED_VIEWPORTS = {
|
|
30
|
+
desktop: {
|
|
31
|
+
name: "desktop",
|
|
32
|
+
width: 1280,
|
|
33
|
+
height: 800
|
|
34
|
+
},
|
|
35
|
+
mobile: {
|
|
36
|
+
name: "mobile",
|
|
37
|
+
width: 390,
|
|
38
|
+
height: 844
|
|
39
|
+
},
|
|
40
|
+
tablet: {
|
|
41
|
+
name: "tablet",
|
|
42
|
+
width: 768,
|
|
43
|
+
height: 1024
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* The viewports a manifest's `verify.viewports` names (`desktop`, `mobile`, `tablet`, or
|
|
48
|
+
* `<width>x<height>` from 200 to 4000 px), in its order and without repeats; the defaults when it
|
|
49
|
+
* names none. Returns the names it couldn't read beside them.
|
|
50
|
+
*/
|
|
51
|
+
function viewportsFor(names) {
|
|
52
|
+
if (names === void 0 || names.length === 0) return {
|
|
53
|
+
viewports: DEFAULT_VIEWPORTS,
|
|
54
|
+
unknown: []
|
|
55
|
+
};
|
|
56
|
+
const viewports = [];
|
|
57
|
+
const unknown = [];
|
|
58
|
+
for (const raw of names) {
|
|
59
|
+
const name = raw.trim().toLowerCase();
|
|
60
|
+
const sized = /^(\d{3,4})x(\d{3,4})$/.exec(name);
|
|
61
|
+
const viewport = NAMED_VIEWPORTS[name] ?? (sized ? {
|
|
62
|
+
name,
|
|
63
|
+
width: Number(sized[1]),
|
|
64
|
+
height: Number(sized[2])
|
|
65
|
+
} : void 0);
|
|
66
|
+
if (!viewport || viewport.width < 200 || viewport.height < 200 || viewport.width > 4e3 || viewport.height > 4e3) {
|
|
67
|
+
unknown.push(raw);
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!viewports.some((known) => known.name === viewport.name)) viewports.push(viewport);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
viewports: viewports.length > 0 ? viewports : DEFAULT_VIEWPORTS,
|
|
74
|
+
unknown
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Claude: tokens of an image already within its tier's limits. */
|
|
78
|
+
const claudeTokens = (width, height) => Math.ceil(width / 28) * Math.ceil(height / 28);
|
|
79
|
+
/**
|
|
80
|
+
* The size Claude resizes an image to (its documented reference implementation): the largest
|
|
81
|
+
* aspect-preserving size whose 28-px-rounded sides fit `maxEdge` and whose tokens fit `maxTokens`.
|
|
82
|
+
*/
|
|
83
|
+
function claudeSize(width, height, maxEdge, maxTokens) {
|
|
84
|
+
const fits = (w, h) => Math.ceil(w / 28) * 28 <= maxEdge && Math.ceil(h / 28) * 28 <= maxEdge && claudeTokens(w, h) <= maxTokens;
|
|
85
|
+
if (fits(width, height)) return [width, height];
|
|
86
|
+
if (height > width) {
|
|
87
|
+
const [h, w] = claudeSize(height, width, maxEdge, maxTokens);
|
|
88
|
+
return [w, h];
|
|
89
|
+
}
|
|
90
|
+
const aspect = width / height;
|
|
91
|
+
let lo = 1;
|
|
92
|
+
let hi = width;
|
|
93
|
+
while (lo + 1 < hi) {
|
|
94
|
+
const mid = Math.floor((lo + hi) / 2);
|
|
95
|
+
if (fits(mid, Math.max(Math.round(mid / aspect), 1))) lo = mid;
|
|
96
|
+
else hi = mid;
|
|
97
|
+
}
|
|
98
|
+
return [lo, Math.max(Math.round(lo / aspect), 1)];
|
|
99
|
+
}
|
|
100
|
+
/** GPT at `detail: "high"`: fit 2048 × 2048, then a 2,500-patch budget, then the 1.2 multiplier. */
|
|
101
|
+
function gptTokens(width, height) {
|
|
102
|
+
let w = width;
|
|
103
|
+
let h = height;
|
|
104
|
+
const edge = Math.min(1, 2048 / Math.max(w, h));
|
|
105
|
+
if (edge < 1) {
|
|
106
|
+
w = Math.max(1, Math.round(w * edge));
|
|
107
|
+
h = Math.max(1, Math.round(h * edge));
|
|
108
|
+
}
|
|
109
|
+
let patches = Math.ceil(w / 32) * Math.ceil(h / 32);
|
|
110
|
+
const budget = 2500;
|
|
111
|
+
if (patches > budget) {
|
|
112
|
+
const shrink = Math.sqrt(1024 * budget / (w * h));
|
|
113
|
+
const adjusted = shrink * Math.min(Math.floor(w * shrink / 32) / (w * shrink / 32), Math.floor(h * shrink / 32) / (h * shrink / 32));
|
|
114
|
+
patches = Math.ceil(Math.floor(w * adjusted) / 32) * Math.ceil(Math.floor(h * adjusted) / 32);
|
|
115
|
+
}
|
|
116
|
+
return Math.ceil(patches * 1.2);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* What an image of `width` × `height` pixels costs Claude, GPT and Gemini to read, by each
|
|
120
|
+
* provider's published rule as verified on 2026-10-17 (VERIFIED_FACTS, WP-09). Estimates: harnesses
|
|
121
|
+
* use them to budget, and each provider may round differently by a token.
|
|
122
|
+
*/
|
|
123
|
+
function estimateImageTokens(width, height) {
|
|
124
|
+
const [cw, ch] = claudeSize(width, height, 2576, 4784);
|
|
125
|
+
return {
|
|
126
|
+
claude: claudeTokens(cw, ch),
|
|
127
|
+
gpt: gptTokens(width, height),
|
|
128
|
+
gemini: 1120
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
const tokenEstimate = z.object({
|
|
132
|
+
claude: z.int().min(0),
|
|
133
|
+
gpt: z.int().min(0),
|
|
134
|
+
gemini: z.int().min(0)
|
|
135
|
+
});
|
|
136
|
+
/** The Zod schema of the `VerifyVerdict` type. */
|
|
137
|
+
const VerifyVerdict = z.object({
|
|
138
|
+
status: z.enum(["pass", "fail"]),
|
|
139
|
+
artifact: z.object({
|
|
140
|
+
id: z.string().exactOptional(),
|
|
141
|
+
path: z.string(),
|
|
142
|
+
sourceDigest: z.string(),
|
|
143
|
+
envDigest: z.string(),
|
|
144
|
+
versionId: z.string().exactOptional()
|
|
145
|
+
}),
|
|
146
|
+
diagnostics: z.array(Diagnostic).readonly(),
|
|
147
|
+
screenshots: z.array(z.object({
|
|
148
|
+
viewport: z.string(),
|
|
149
|
+
path: z.string(),
|
|
150
|
+
width: z.int().min(1),
|
|
151
|
+
height: z.int().min(1),
|
|
152
|
+
tokensEstimate: tokenEstimate,
|
|
153
|
+
returned: z.boolean()
|
|
154
|
+
})).readonly(),
|
|
155
|
+
aria: z.array(z.object({
|
|
156
|
+
viewport: z.string(),
|
|
157
|
+
path: z.string(),
|
|
158
|
+
summary: z.string()
|
|
159
|
+
})).readonly(),
|
|
160
|
+
smoke: z.object({
|
|
161
|
+
interactions: z.int().min(0),
|
|
162
|
+
skippedActions: z.array(z.string()).readonly(),
|
|
163
|
+
stateChanges: z.int().min(0)
|
|
164
|
+
}),
|
|
165
|
+
regressions: z.object({
|
|
166
|
+
against: z.string().exactOptional(),
|
|
167
|
+
aria: z.string().exactOptional(),
|
|
168
|
+
pixels: z.array(z.object({
|
|
169
|
+
viewport: z.string(),
|
|
170
|
+
ratio: z.number().min(0).max(1)
|
|
171
|
+
})).readonly().exactOptional(),
|
|
172
|
+
contracts: z.array(z.string()).readonly().exactOptional()
|
|
173
|
+
}),
|
|
174
|
+
timingsMs: z.record(z.string(), z.number().min(0))
|
|
175
|
+
}).register(wireRegistry, {
|
|
176
|
+
id: "VerifyVerdict",
|
|
177
|
+
description: "The verdict of artifact/verify: pass or fail, diagnostics, screenshots with token estimates, ARIA snapshots, the smoke test, regressions and timings."
|
|
178
|
+
});
|
|
179
|
+
/** The notification `artifact/verify` sends while it runs, when the client accepts it. */
|
|
180
|
+
const ARTIFACT_PROGRESS = "artifact/progress";
|
|
181
|
+
/** The Zod schema of the `ArtifactProgressParams` type. */
|
|
182
|
+
const ArtifactProgressParams = z.object({
|
|
183
|
+
progressToken: z.string().min(1),
|
|
184
|
+
stage: z.string().min(1),
|
|
185
|
+
fraction: z.number().min(0).max(1).exactOptional()
|
|
186
|
+
}).register(wireRegistry, {
|
|
187
|
+
id: "ArtifactProgressParams",
|
|
188
|
+
description: "One stage of a long request (artifact/verify) started."
|
|
189
|
+
});
|
|
190
|
+
/**
|
|
191
|
+
* The global the verify runner's recorder installs in every frame of a render: a page in the
|
|
192
|
+
* `verify` target reports errors its React error boundaries caught through it, with their
|
|
193
|
+
* `cause` chains, so the runner judges each by its cause (D138 items 2 and 3, Opus review finding
|
|
194
|
+
* 3). Viewers' pages never have it.
|
|
195
|
+
*/
|
|
196
|
+
const VERIFY_REPORT = "__mostraVerifyReport";
|
|
197
|
+
/**
|
|
198
|
+
* What a verify run's page tells the runner about its fields (D138 item 3), on
|
|
199
|
+
* `globalThis[VERIFY_PROBE]` in the `verify` target only: every field it mounted, how, and with
|
|
200
|
+
* which initial value's type; internal to Mostra.
|
|
201
|
+
*/
|
|
202
|
+
const VERIFY_PROBE = "__mostraVerify";
|
|
203
|
+
/** The verify runner's methods (ARCHITECTURE §1): the supervisor asks, the runner answers; internal to Mostra. */
|
|
204
|
+
const VERIFY_RUNNER_METHODS = {
|
|
205
|
+
/** Opens one capability link in a fresh browser context and reports what the page did. */
|
|
206
|
+
render: "verify/render",
|
|
207
|
+
/** Compares two screenshots and writes their difference. */
|
|
208
|
+
compare: "verify/compare"
|
|
209
|
+
};
|
|
210
|
+
/** A one-line count of an ARIA snapshot: headings, controls and landmarks. */
|
|
211
|
+
function ariaSummary(text) {
|
|
212
|
+
const counts = /* @__PURE__ */ new Map();
|
|
213
|
+
for (const match of text.matchAll(/^\s*- ([a-z]+)\b/gm)) {
|
|
214
|
+
const role = match[1];
|
|
215
|
+
counts.set(role, (counts.get(role) ?? 0) + 1);
|
|
216
|
+
}
|
|
217
|
+
const parts = [
|
|
218
|
+
["heading", "headings"],
|
|
219
|
+
["button", "buttons"],
|
|
220
|
+
["link", "links"],
|
|
221
|
+
["textbox", "text fields"],
|
|
222
|
+
["checkbox", "checkboxes"],
|
|
223
|
+
["combobox", "comboboxes"],
|
|
224
|
+
["tab", "tabs"],
|
|
225
|
+
["img", "images"],
|
|
226
|
+
["table", "tables"]
|
|
227
|
+
].filter(([role]) => counts.has(role)).map(([role, plural]) => `${counts.get(role)} ${counts.get(role) === 1 ? role : plural}`);
|
|
228
|
+
const landmarks = [
|
|
229
|
+
"main",
|
|
230
|
+
"navigation",
|
|
231
|
+
"banner",
|
|
232
|
+
"contentinfo",
|
|
233
|
+
"form",
|
|
234
|
+
"region",
|
|
235
|
+
"dialog"
|
|
236
|
+
].filter((role) => counts.has(role));
|
|
237
|
+
if (landmarks.length > 0) parts.push(`landmarks: ${landmarks.join(", ")}`);
|
|
238
|
+
return parts.length > 0 ? parts.join(", ") : "no headings, controls or landmarks";
|
|
239
|
+
}
|
|
240
|
+
//#endregion
|
|
241
|
+
export { ARTIFACT_PROGRESS, ArtifactProgressParams, DEFAULT_VIEWPORTS, ScreenshotPolicy, VERIFY_PROBE, VERIFY_REPORT, VERIFY_RUNNER_METHODS, VerifyVerdict, ariaSummary, estimateImageTokens, viewportsFor };
|
|
242
|
+
|
|
243
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","names":[],"sources":["../src/verify.ts"],"sourcesContent":["/**\n * `verify` (D29, D41, D55, D72, D138; INTERFACES §13): the verdict it returns, the viewports it\n * renders, and the image-token estimates every screenshot carries. Pure and free of I/O, so the\n * runtime, the verify runner, the CLI and the MCP server share one definition.\n */\nimport * as z from \"zod\";\nimport { Diagnostic } from \"./diagnostics/diagnostic.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** When a verdict's screenshots are handed to the caller (AX-05): images cost tokens. */\nexport type ScreenshotPolicy = \"on-failure\" | \"always\" | \"never\";\n\n/** The Zod schema of the `ScreenshotPolicy` type. */\nexport const ScreenshotPolicy: z.ZodType<ScreenshotPolicy, string> = z\n .enum([\"on-failure\", \"always\", \"never\"])\n .register(wireRegistry, {\n id: \"ScreenshotPolicy\",\n description: \"When screenshots are returned: on failure (the default), always or never.\",\n });\n\n/** One viewport verify renders at device pixel ratio 1. */\nexport interface VerifyViewport {\n /** Its name in the verdict: `desktop`, `mobile`, `tablet`, or `<width>x<height>`. */\n readonly name: string;\n /** Its width in CSS pixels, which at DPR 1 are the screenshot's pixels. */\n readonly width: number;\n /** Its height in CSS pixels. */\n readonly height: number;\n}\n\n/** The viewports verify renders when the manifest names none (ROUND-3 §9): desktop and mobile. */\nexport const DEFAULT_VIEWPORTS: readonly VerifyViewport[] = [\n { name: \"desktop\", width: 1280, height: 800 },\n { name: \"mobile\", width: 390, height: 844 },\n];\n\nconst NAMED_VIEWPORTS: Readonly<Record<string, VerifyViewport>> = {\n desktop: { name: \"desktop\", width: 1280, height: 800 },\n mobile: { name: \"mobile\", width: 390, height: 844 },\n tablet: { name: \"tablet\", width: 768, height: 1024 },\n};\n\n/**\n * The viewports a manifest's `verify.viewports` names (`desktop`, `mobile`, `tablet`, or\n * `<width>x<height>` from 200 to 4000 px), in its order and without repeats; the defaults when it\n * names none. Returns the names it couldn't read beside them.\n */\nexport function viewportsFor(names: readonly string[] | undefined): {\n readonly viewports: readonly VerifyViewport[];\n readonly unknown: readonly string[];\n} {\n if (names === undefined || names.length === 0)\n return { viewports: DEFAULT_VIEWPORTS, unknown: [] };\n const viewports: VerifyViewport[] = [];\n const unknown: string[] = [];\n for (const raw of names) {\n const name = raw.trim().toLowerCase();\n const sized = /^(\\d{3,4})x(\\d{3,4})$/.exec(name);\n const viewport =\n NAMED_VIEWPORTS[name] ??\n (sized ? { name, width: Number(sized[1]), height: Number(sized[2]) } : undefined);\n if (\n !viewport ||\n viewport.width < 200 ||\n viewport.height < 200 ||\n viewport.width > 4000 ||\n viewport.height > 4000\n ) {\n unknown.push(raw);\n continue;\n }\n if (!viewports.some((known) => known.name === viewport.name)) viewports.push(viewport);\n }\n return { viewports: viewports.length > 0 ? viewports : DEFAULT_VIEWPORTS, unknown };\n}\n\n/** What one image costs each model family to read (D138 item 9). */\nexport interface TokenEstimate {\n /** Claude's high-resolution tier (Claude 4.7 and later). */\n readonly claude: number;\n /** GPT at `detail: \"high\"` (gpt-5.5, gpt-5.6, gpt-6-astra). */\n readonly gpt: number;\n /** Gemini 3 and 4 at the default media resolution. */\n readonly gemini: number;\n}\n\n/** Claude: tokens of an image already within its tier's limits. */\nconst claudeTokens = (width: number, height: number): number =>\n Math.ceil(width / 28) * Math.ceil(height / 28);\n\n/**\n * The size Claude resizes an image to (its documented reference implementation): the largest\n * aspect-preserving size whose 28-px-rounded sides fit `maxEdge` and whose tokens fit `maxTokens`.\n */\nfunction claudeSize(\n width: number,\n height: number,\n maxEdge: number,\n maxTokens: number,\n): readonly [number, number] {\n const fits = (w: number, h: number): boolean =>\n Math.ceil(w / 28) * 28 <= maxEdge &&\n Math.ceil(h / 28) * 28 <= maxEdge &&\n claudeTokens(w, h) <= maxTokens;\n if (fits(width, height)) return [width, height];\n if (height > width) {\n const [h, w] = claudeSize(height, width, maxEdge, maxTokens);\n return [w, h];\n }\n const aspect = width / height;\n let lo = 1;\n let hi = width;\n while (lo + 1 < hi) {\n const mid = Math.floor((lo + hi) / 2);\n if (fits(mid, Math.max(Math.round(mid / aspect), 1))) lo = mid;\n else hi = mid;\n }\n return [lo, Math.max(Math.round(lo / aspect), 1)];\n}\n\n/** GPT at `detail: \"high\"`: fit 2048 × 2048, then a 2,500-patch budget, then the 1.2 multiplier. */\nfunction gptTokens(width: number, height: number): number {\n let w = width;\n let h = height;\n const edge = Math.min(1, 2048 / Math.max(w, h));\n if (edge < 1) {\n w = Math.max(1, Math.round(w * edge));\n h = Math.max(1, Math.round(h * edge));\n }\n let patches = Math.ceil(w / 32) * Math.ceil(h / 32);\n const budget = 2500;\n if (patches > budget) {\n const shrink = Math.sqrt((32 ** 2 * budget) / (w * h));\n const adjusted =\n shrink *\n Math.min(\n Math.floor((w * shrink) / 32) / ((w * shrink) / 32),\n Math.floor((h * shrink) / 32) / ((h * shrink) / 32),\n );\n patches = Math.ceil(Math.floor(w * adjusted) / 32) * Math.ceil(Math.floor(h * adjusted) / 32);\n }\n return Math.ceil(patches * 1.2);\n}\n\n/**\n * What an image of `width` × `height` pixels costs Claude, GPT and Gemini to read, by each\n * provider's published rule as verified on 2026-10-17 (VERIFIED_FACTS, WP-09). Estimates: harnesses\n * use them to budget, and each provider may round differently by a token.\n */\nexport function estimateImageTokens(width: number, height: number): TokenEstimate {\n const [cw, ch] = claudeSize(width, height, 2576, 4784);\n return { claude: claudeTokens(cw, ch), gpt: gptTokens(width, height), gemini: 1120 };\n}\n\n/** One screenshot in a verdict (AX-05). */\nexport interface VerdictScreenshot {\n /** The viewport's name. */\n readonly viewport: string;\n /** The PNG, at device pixel ratio 1. */\n readonly path: string;\n /** The image's width in pixels. */\n readonly width: number;\n /** The image's height in pixels. */\n readonly height: number;\n /** What reading the image costs each model family ({@link estimateImageTokens}). */\n readonly tokensEstimate: TokenEstimate;\n /** Whether the caller is handed the image: on failure, or when asked (`screenshots`). */\n readonly returned: boolean;\n}\n\n/** One ARIA snapshot in a verdict: the text-only picture of what a viewport shows. */\nexport interface VerdictAria {\n /** The viewport's name. */\n readonly viewport: string;\n /** The snapshot's YAML. */\n readonly path: string;\n /** A one-line count of what it holds: headings, controls, landmarks. */\n readonly summary: string;\n}\n\n/** The verdict of one `verify` run (INTERFACES §13). `status` is `fail` exactly when an error exists. */\nexport interface VerifyVerdict {\n /** `fail` when any diagnostic is an error, else `pass`. */\n readonly status: \"pass\" | \"fail\";\n /** What was verified. */\n readonly artifact: {\n /** The artifact, when it has one already: a manifest `id` or a published path. */\n readonly id?: string;\n /** The source path as the request named it. */\n readonly path: string;\n /** The snapshot's digest (DATA_MODEL §2); empty when verify couldn't read the source. */\n readonly sourceDigest: string;\n /** The environment's digest, `lockDigest` included (DATA_MODEL §2); empty likewise. */\n readonly envDigest: string;\n /** The version this source would publish as, when the artifact is known (D89). */\n readonly versionId?: string;\n };\n /** Every finding, errors first, identical ones folded with a `count`. */\n readonly diagnostics: readonly Diagnostic[];\n /** One per viewport rendered. */\n readonly screenshots: readonly VerdictScreenshot[];\n /** One per viewport rendered. */\n readonly aria: readonly VerdictAria[];\n /** What the smoke test did. */\n readonly smoke: {\n /** Controls the smoke test used. */\n readonly interactions: number;\n /** Server functions that don't check `dryRun()` and were refused instead of run (D55). */\n readonly skippedActions: readonly string[];\n /** Field writes the interactions caused. */\n readonly stateChanges: number;\n };\n /** What changed since the last passing version; empty when there is none. */\n readonly regressions: {\n /**\n * The last passing version: the newest whose recorded verdict passed (D138 item 4). When it is\n * this very source, nothing needed comparing.\n */\n readonly against?: string;\n /** Controls and landmarks the baseline had and this source doesn't, in brief. */\n readonly aria?: string;\n /** The share of pixels that differ from the baseline, per viewport. */\n readonly pixels?: readonly { readonly viewport: string; readonly ratio: number }[];\n /** Contracts the baseline had that this source drops: fields, actions, live sources, pages. */\n readonly contracts?: readonly string[];\n };\n /** How long each stage took, in milliseconds, and `total`. */\n readonly timingsMs: Readonly<Record<string, number>>;\n}\n\nconst tokenEstimate: z.ZodType<TokenEstimate> = z.object({\n claude: z.int().min(0),\n gpt: z.int().min(0),\n gemini: z.int().min(0),\n});\n\n/** The Zod schema of the `VerifyVerdict` type. */\nexport const VerifyVerdict: z.ZodType<VerifyVerdict> = z\n .object({\n status: z.enum([\"pass\", \"fail\"]),\n artifact: z.object({\n id: z.string().exactOptional(),\n path: z.string(),\n sourceDigest: z.string(),\n envDigest: z.string(),\n versionId: z.string().exactOptional(),\n }),\n diagnostics: z.array(Diagnostic).readonly(),\n screenshots: z\n .array(\n z.object({\n viewport: z.string(),\n path: z.string(),\n width: z.int().min(1),\n height: z.int().min(1),\n tokensEstimate: tokenEstimate,\n returned: z.boolean(),\n }),\n )\n .readonly(),\n aria: z\n .array(z.object({ viewport: z.string(), path: z.string(), summary: z.string() }))\n .readonly(),\n smoke: z.object({\n interactions: z.int().min(0),\n skippedActions: z.array(z.string()).readonly(),\n stateChanges: z.int().min(0),\n }),\n regressions: z.object({\n against: z.string().exactOptional(),\n aria: z.string().exactOptional(),\n pixels: z\n .array(z.object({ viewport: z.string(), ratio: z.number().min(0).max(1) }))\n .readonly()\n .exactOptional(),\n contracts: z.array(z.string()).readonly().exactOptional(),\n }),\n timingsMs: z.record(z.string(), z.number().min(0)),\n })\n .register(wireRegistry, {\n id: \"VerifyVerdict\",\n description:\n \"The verdict of artifact/verify: pass or fail, diagnostics, screenshots with token estimates, ARIA snapshots, the smoke test, regressions and timings.\",\n });\n\n/** The notification `artifact/verify` sends while it runs, when the client accepts it. */\nexport const ARTIFACT_PROGRESS = \"artifact/progress\";\n\n/** `artifact/progress`: one stage of a long request started or ended. */\nexport interface ArtifactProgressParams {\n /** The `progressToken` the request carried. */\n readonly progressToken: string;\n /** The stage that started: `prepare`, `compile`, `boot`, `render`, `smoke`, `regression`. */\n readonly stage: string;\n /** How much of the request is done, from 0 to 1, when known. */\n readonly fraction?: number;\n}\n\n/** The Zod schema of the `ArtifactProgressParams` type. */\nexport const ArtifactProgressParams: z.ZodType<ArtifactProgressParams> = z\n .object({\n progressToken: z.string().min(1),\n stage: z.string().min(1),\n fraction: z.number().min(0).max(1).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ArtifactProgressParams\",\n description: \"One stage of a long request (artifact/verify) started.\",\n });\n\n/**\n * The global the verify runner's recorder installs in every frame of a render: a page in the\n * `verify` target reports errors its React error boundaries caught through it, with their\n * `cause` chains, so the runner judges each by its cause (D138 items 2 and 3, Opus review finding\n * 3). Viewers' pages never have it.\n */\nexport const VERIFY_REPORT = \"__mostraVerifyReport\";\n\n/**\n * What a verify run's page tells the runner about its fields (D138 item 3), on\n * `globalThis[VERIFY_PROBE]` in the `verify` target only: every field it mounted, how, and with\n * which initial value's type; internal to Mostra.\n */\nexport const VERIFY_PROBE = \"__mostraVerify\";\n\n/** One mounted field, as the probe reports it; internal to Mostra. */\nexport interface ProbedField {\n /** The field ID. */\n readonly id: string;\n /** Its scope, as first mounted. */\n readonly scope: \"viewer\" | \"artifact\";\n /** The hook that named it: `useField`, `useChoice`, `useForm` or `storage`. */\n readonly hook: string;\n /** `typeof` its initial value, `array` or `null`. */\n readonly initialType: string;\n /** How many components have it mounted now. */\n readonly mounts: number;\n /** Other hook kinds, scopes or initial types it was mounted with, if any. */\n readonly conflicts: readonly string[];\n}\n\n/** The verify runner's methods (ARCHITECTURE §1): the supervisor asks, the runner answers; internal to Mostra. */\nexport const VERIFY_RUNNER_METHODS = {\n /** Opens one capability link in a fresh browser context and reports what the page did. */\n render: \"verify/render\",\n /** Compares two screenshots and writes their difference. */\n compare: \"verify/compare\",\n} as const;\n\n/** `verify/render`'s params; internal to Mostra. */\nexport interface RenderRequest {\n /** The capability link to open, as a viewer would (D138 item 1). */\n readonly url: string;\n /** The viewport to render at, DPR 1. */\n readonly viewport: VerifyViewport;\n /** The fixed time `Date` reports, in ms since the epoch: the same for every render of a run. */\n readonly clockMs: number;\n /** Where the screenshot and the ARIA snapshot are written, named after `name`. */\n readonly outDir: string;\n /** The render's name: its files are `<name>.png` and `<name>.aria.yml`. */\n readonly name: string;\n /** What to collect besides readiness and the page's own errors. */\n readonly collect: {\n /** A screenshot of the viewport. */\n readonly screenshot: boolean;\n /** The ARIA snapshot. */\n readonly aria: boolean;\n /** axe-core's violations. */\n readonly axe: boolean;\n /** The page's mounted fields, from the field probe. */\n readonly fields: boolean;\n /** Run the smoke test after rendering, within this budget. */\n readonly smoke?: { readonly maxInteractions: number; readonly maxMs: number };\n };\n /** When this render must have ended, in ms since the epoch. */\n readonly deadline: number;\n}\n\n/** `verify/render`'s answer; internal to Mostra. */\nexport interface RenderResult {\n /** Whether the page reported `mostra/ready`. */\n readonly ready: boolean;\n /** What the runner found: page errors, console output, failed requests, axe, smoke, blank. */\n readonly findings: readonly Diagnostic[];\n /** The screenshot written, when asked for. */\n readonly screenshot?: { readonly path: string; readonly width: number; readonly height: number };\n /** The ARIA snapshot written, and its text, when asked for. */\n readonly aria?: { readonly path: string; readonly text: string };\n /** The mounted fields the probe reported, when asked for. */\n readonly fields?: readonly ProbedField[];\n /** What the smoke test did, when asked for. */\n readonly smoke?: {\n /** Controls used. */\n readonly interactions: number;\n /** Field writes they caused. */\n readonly stateChanges: number;\n /** Server functions the sandbox refused during the smoke test. */\n readonly skipped: readonly string[];\n /** Whether it stopped at its budget. */\n readonly budget: boolean;\n };\n /** Whether the render ran past its deadline and stopped where it was. */\n readonly timedOut: boolean;\n /** When each step ended, in ms after the render started. */\n readonly timingsMs: Readonly<Record<string, number>>;\n}\n\n/** `verify/compare`'s params; internal to Mostra. */\nexport interface CompareRequest {\n /** The baseline's screenshot. */\n readonly a: string;\n /** The source's screenshot. */\n readonly b: string;\n /** Where to write the difference image. */\n readonly diff: string;\n}\n\n/** `verify/compare`'s answer; internal to Mostra. */\nexport interface CompareResult {\n /** The share of pixels that differ beyond pixelmatch's perceptual threshold. */\n readonly ratio: number;\n /** Whether the two images had different sizes (then `ratio` is 1). */\n readonly sizeChanged: boolean;\n}\n\n/** A one-line count of an ARIA snapshot: headings, controls and landmarks. */\nexport function ariaSummary(text: string): string {\n const counts = new Map<string, number>();\n for (const match of text.matchAll(/^\\s*- ([a-z]+)\\b/gm)) {\n const role = match[1] as string;\n counts.set(role, (counts.get(role) ?? 0) + 1);\n }\n const named: [string, string][] = [\n [\"heading\", \"headings\"],\n [\"button\", \"buttons\"],\n [\"link\", \"links\"],\n [\"textbox\", \"text fields\"],\n [\"checkbox\", \"checkboxes\"],\n [\"combobox\", \"comboboxes\"],\n [\"tab\", \"tabs\"],\n [\"img\", \"images\"],\n [\"table\", \"tables\"],\n ];\n const parts = named\n .filter(([role]) => counts.has(role))\n .map(([role, plural]) => `${counts.get(role)} ${counts.get(role) === 1 ? role : plural}`);\n const landmarks = [\n \"main\",\n \"navigation\",\n \"banner\",\n \"contentinfo\",\n \"form\",\n \"region\",\n \"dialog\",\n ].filter((role) => counts.has(role));\n if (landmarks.length > 0) parts.push(`landmarks: ${landmarks.join(\", \")}`);\n return parts.length > 0 ? parts.join(\", \") : \"no headings, controls or landmarks\";\n}\n"],"mappings":";;;;;;;;;;AAaA,MAAa,mBAAwD,EAClE,KAAK;CAAC;CAAc;CAAU;AAAO,CAAC,CAAC,CACvC,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAaH,MAAa,oBAA+C,CAC1D;CAAE,MAAM;CAAW,OAAO;CAAM,QAAQ;AAAI,GAC5C;CAAE,MAAM;CAAU,OAAO;CAAK,QAAQ;AAAI,CAC5C;AAEA,MAAM,kBAA4D;CAChE,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C,WAAW,UAAU;EACtB,CAAC,UAAU,SAAS;EACpB,CAAC,QAAQ,OAAO;EAChB,CAAC,WAAW,aAAa;EACzB,CAAC,YAAY,YAAY;EACzB,CAAC,YAAY,YAAY;EACzB,CAAC,OAAO,MAAM;EACd,CAAC,OAAO,QAAQ;EAChB,CAAC,SAAS,QAAQ;CAEF,CAAC,CAChB,QAAQ,CAAC,UAAU,OAAO,IAAI,IAAI,CAAC,CAAC,CACpC,KAAK,CAAC,MAAM,YAAY,GAAG,OAAO,IAAI,IAAI,EAAE,GAAG,OAAO,IAAI,IAAI,MAAM,IAAI,OAAO,QAAQ;CAC1F,MAAM,YAAY;EAChB;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,QAAQ,SAAS,OAAO,IAAI,IAAI,CAAC;CACnC,IAAI,UAAU,SAAS,GAAG,MAAM,KAAK,cAAc,UAAU,KAAK,IAAI,GAAG;CACzE,OAAO,MAAM,SAAS,IAAI,MAAM,KAAK,IAAI,IAAI;AAC/C"}
|
package/dist/view.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { SubmissionPolicy } from "./manifest.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
//#region src/view.d.ts
|
|
4
|
+
/** Where a submit came from (D40). */
|
|
5
|
+
export type SubmitChannel = "shell" | "artifact";
|
|
6
|
+
/** The Zod schema of the `SubmitChannel` type. */
|
|
7
|
+
export declare const SubmitChannel: z.ZodType<SubmitChannel>;
|
|
8
|
+
/**
|
|
9
|
+
* A trusted control the shell renders outside the artifact's frame (D06, PRODUCT vocabulary):
|
|
10
|
+
* Submit, Choose (review sets) and Approve. Open for later controls on the wire.
|
|
11
|
+
*/
|
|
12
|
+
export type TrustedControl = "submit" | "choose" | "approve" | (string & {});
|
|
13
|
+
/** The Zod schema of the `TrustedControl` type. */
|
|
14
|
+
export declare const TrustedControl: z.ZodType<TrustedControl>;
|
|
15
|
+
/**
|
|
16
|
+
* Which submit channels a view accepts and which trusted controls its shell renders (D40, D108):
|
|
17
|
+
* the `trustedControls` port's answer, or the home's `HomeConfig.submitChannels`.
|
|
18
|
+
*/
|
|
19
|
+
export interface ControlsPolicy {
|
|
20
|
+
/** The channels submissions may come through; at least one. */
|
|
21
|
+
readonly submitChannels: readonly SubmitChannel[];
|
|
22
|
+
/** The trusted controls the shell may render; absent: every control the artifact asks for. */
|
|
23
|
+
readonly controls?: readonly TrustedControl[];
|
|
24
|
+
}
|
|
25
|
+
/** The Zod schema of the `ControlsPolicy` type. */
|
|
26
|
+
export declare const ControlsPolicy: z.ZodType<ControlsPolicy>;
|
|
27
|
+
/** A review set's ID: letters, digits, `_` and `-` (its choice is the field `review.<id>.choice`). */
|
|
28
|
+
export declare const REVIEW_SET_ID_PATTERN: RegExp;
|
|
29
|
+
/** Where a client runtime runs (D111): Mostra's gateway, a static export, an MCP App, or `verify`. */
|
|
30
|
+
export type DeliveryTarget = "live" | "static" | "mcp-app" | "verify";
|
|
31
|
+
/** A version by ID and number. */
|
|
32
|
+
export interface VersionRef {
|
|
33
|
+
/** The version's ID. */
|
|
34
|
+
readonly id: string;
|
|
35
|
+
/** Its number, for people. */
|
|
36
|
+
readonly number: number;
|
|
37
|
+
}
|
|
38
|
+
/** The Zod schema of the `VersionRef` type. */
|
|
39
|
+
export declare const VersionRef: z.ZodType<VersionRef>;
|
|
40
|
+
/**
|
|
41
|
+
* What one view is (D104, D108): the shell learns it from its frame ticket and hands it to the
|
|
42
|
+
* frame in `ui/initialize`'s result, so the client runtime names the view in every request and
|
|
43
|
+
* knows what the host allows.
|
|
44
|
+
*/
|
|
45
|
+
export interface ViewContext {
|
|
46
|
+
/** The artifact. */
|
|
47
|
+
readonly artifactId: string;
|
|
48
|
+
/** The view this frame load is; every mutation and submit names it (D104). */
|
|
49
|
+
readonly viewId: string;
|
|
50
|
+
/** The version the view shows. */
|
|
51
|
+
readonly version: VersionRef;
|
|
52
|
+
/** The artifact's latest version when the view opened. */
|
|
53
|
+
readonly latest: VersionRef;
|
|
54
|
+
/** The submission policy in force (D102). */
|
|
55
|
+
readonly policy: SubmissionPolicy;
|
|
56
|
+
/** The submit channels this view accepts (D108). */
|
|
57
|
+
readonly submitChannels: readonly SubmitChannel[];
|
|
58
|
+
/** The trusted controls the shell renders for this view (D108). */
|
|
59
|
+
readonly controls: readonly TrustedControl[];
|
|
60
|
+
/** Always `live` in a frame Mostra's shell hosts. */
|
|
61
|
+
readonly target: DeliveryTarget;
|
|
62
|
+
}
|
|
63
|
+
/** The Zod schema of the `ViewContext` type. */
|
|
64
|
+
export declare const ViewContext: z.ZodType<ViewContext>;
|
|
65
|
+
/**
|
|
66
|
+
* A view as a page reads it from `ui/initialize` (Claude review finding 5): every published
|
|
67
|
+
* version embeds the page's reader, so it takes values a later Mostra may add (a channel, a
|
|
68
|
+
* policy, a target) without refusing the whole view; {@link readViewContext} reads them safely.
|
|
69
|
+
*/
|
|
70
|
+
export interface ViewContextWire {
|
|
71
|
+
/** The artifact. */
|
|
72
|
+
readonly artifactId: string;
|
|
73
|
+
/** The view this frame load is (D104). */
|
|
74
|
+
readonly viewId: string;
|
|
75
|
+
/** The version the view shows. */
|
|
76
|
+
readonly version: VersionRef;
|
|
77
|
+
/** The artifact's latest version when the view opened. */
|
|
78
|
+
readonly latest: VersionRef;
|
|
79
|
+
/** The submission policy in force (D102); a later policy or scope is read as `once` per viewer. */
|
|
80
|
+
readonly policy: {
|
|
81
|
+
/** `once`, `epochs`, `none`, or one a later release adds. */
|
|
82
|
+
readonly policy: string;
|
|
83
|
+
/** `per-artifact` or `per-viewer` under `once`, or one a later release adds. */
|
|
84
|
+
readonly scope?: string;
|
|
85
|
+
};
|
|
86
|
+
/** The submit channels the view accepts (D108); channels this release doesn't know are not allowed. */
|
|
87
|
+
readonly submitChannels: readonly string[];
|
|
88
|
+
/** The trusted controls the shell renders for the view (D108). */
|
|
89
|
+
readonly controls: readonly string[];
|
|
90
|
+
/** Where the page runs (D111); a target this release doesn't know is read as `live`. */
|
|
91
|
+
readonly target: string;
|
|
92
|
+
}
|
|
93
|
+
/** The Zod schema of the `ViewContextWire` type: open where later revisions may add values. */
|
|
94
|
+
export declare const ViewContextWire: z.ZodType<ViewContextWire>;
|
|
95
|
+
/**
|
|
96
|
+
* The view a page acts on, with every value this release doesn't know read the safe way: an
|
|
97
|
+
* unknown channel isn't allowed (the shell's stays), an unknown policy or `once` scope is read as
|
|
98
|
+
* `once` per viewer (the page may submit and the server decides; it closes on its own submission
|
|
99
|
+
* only), and an unknown target as `live`.
|
|
100
|
+
*/
|
|
101
|
+
export declare function readViewContext(wire: ViewContextWire): ViewContext;
|
|
102
|
+
//#endregion
|
|
103
|
+
//# sourceMappingURL=view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.d.ts","names":[],"sources":["../src/view.ts"],"mappings":";;;;YAYY;;qBAGC,eAAe,EAAE,QAAQ;;;;;YAW1B;;qBAGC,gBAAgB,EAAE,QAAQ;;;;;iBAYtB;;WAEN,yBAAyB;;WAEzB,oBAAoB;;;qBAIlB,gBAAgB,EAAE,QAAQ;;qBAY1B,uBAAuB;;YAGxB;;iBAGK;;WAEN;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;;;;;iBAYlB;;WAEN;;WAEA;;WAEA,SAAS;;WAET,QAAQ;;WAER,QAAQ;;WAER,yBAAyB;;WAEzB,mBAAmB;;WAEnB,QAAQ;;;qBAIN,aAAa,EAAE,QAAQ;;;;;;iBAsBnB;;WAEN;;WAEA;;WAEA,SAAS;;WAET,QAAQ;;WAER;;aAEE;;aAEA;;;WAGF;;WAEA;;WAEA;;;qBAIE,iBAAiB,EAAE,QAAQ;;;;;;;wBAmBxB,gBAAgB,MAAM,kBAAkB"}
|
package/dist/view.js
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { wireRegistry } from "./wire-registry.js";
|
|
2
|
+
import { ArtifactId, VersionId, ViewId } from "./ids.js";
|
|
3
|
+
import { SubmissionPolicy } from "./manifest.js";
|
|
4
|
+
import * as z from "zod";
|
|
5
|
+
//#region src/view.ts
|
|
6
|
+
/**
|
|
7
|
+
* What one view is (D104, D108): its artifact, version, policy, submit channels and trusted
|
|
8
|
+
* controls. The browser protocol's frame ticket, the bridge's `ui/initialize` result and the
|
|
9
|
+
* interaction core's channel policy share these shapes, so they live in a module of their own:
|
|
10
|
+
* the bridge, which every version embeds, imports them without the interaction schemas.
|
|
11
|
+
*/
|
|
12
|
+
/** The Zod schema of the `SubmitChannel` type. */
|
|
13
|
+
const SubmitChannel = z.enum(["shell", "artifact"]).register(wireRegistry, {
|
|
14
|
+
id: "SubmitChannel",
|
|
15
|
+
description: "Where a submit comes from: the shell's trusted Submit, or the artifact's code."
|
|
16
|
+
});
|
|
17
|
+
/** The Zod schema of the `TrustedControl` type. */
|
|
18
|
+
const TrustedControl = z.string().regex(/^[a-z][a-z0-9-]{0,31}$/).register(wireRegistry, {
|
|
19
|
+
id: "TrustedControl",
|
|
20
|
+
description: "A trusted control the shell renders: submit, choose, approve; open for more."
|
|
21
|
+
});
|
|
22
|
+
/** The Zod schema of the `ControlsPolicy` type. */
|
|
23
|
+
const ControlsPolicy = z.object({
|
|
24
|
+
submitChannels: z.array(SubmitChannel).min(1).max(2).readonly(),
|
|
25
|
+
controls: z.array(TrustedControl).max(32).readonly().exactOptional()
|
|
26
|
+
}).register(wireRegistry, {
|
|
27
|
+
id: "ControlsPolicy",
|
|
28
|
+
description: "Which submit channels a view accepts and which trusted controls its shell renders (D108)."
|
|
29
|
+
});
|
|
30
|
+
/** A review set's ID: letters, digits, `_` and `-` (its choice is the field `review.<id>.choice`). */
|
|
31
|
+
const REVIEW_SET_ID_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
|
|
32
|
+
/** The Zod schema of the `VersionRef` type. */
|
|
33
|
+
const VersionRef = z.object({
|
|
34
|
+
id: VersionId.schema,
|
|
35
|
+
number: z.int().min(1)
|
|
36
|
+
}).register(wireRegistry, {
|
|
37
|
+
id: "VersionRef",
|
|
38
|
+
description: "A version by ID and number."
|
|
39
|
+
});
|
|
40
|
+
/** The Zod schema of the `ViewContext` type. */
|
|
41
|
+
const ViewContext = z.object({
|
|
42
|
+
artifactId: ArtifactId.schema,
|
|
43
|
+
viewId: ViewId.schema,
|
|
44
|
+
version: VersionRef,
|
|
45
|
+
latest: VersionRef,
|
|
46
|
+
policy: SubmissionPolicy,
|
|
47
|
+
submitChannels: z.array(SubmitChannel).min(1).max(2).readonly(),
|
|
48
|
+
controls: z.array(TrustedControl).max(32).readonly(),
|
|
49
|
+
target: z.enum([
|
|
50
|
+
"live",
|
|
51
|
+
"static",
|
|
52
|
+
"mcp-app",
|
|
53
|
+
"verify"
|
|
54
|
+
])
|
|
55
|
+
}).register(wireRegistry, {
|
|
56
|
+
id: "ViewContext",
|
|
57
|
+
description: "What one view is: its artifact, view ID, version, latest version, policy, channels and controls."
|
|
58
|
+
});
|
|
59
|
+
/** The Zod schema of the `ViewContextWire` type: open where later revisions may add values. */
|
|
60
|
+
const ViewContextWire = z.looseObject({
|
|
61
|
+
artifactId: ArtifactId.schema,
|
|
62
|
+
viewId: ViewId.schema,
|
|
63
|
+
version: VersionRef,
|
|
64
|
+
latest: VersionRef,
|
|
65
|
+
policy: z.looseObject({
|
|
66
|
+
policy: z.string(),
|
|
67
|
+
scope: z.string().exactOptional()
|
|
68
|
+
}),
|
|
69
|
+
submitChannels: z.array(z.string()).max(16).readonly(),
|
|
70
|
+
controls: z.array(z.string()).max(32).readonly(),
|
|
71
|
+
target: z.string()
|
|
72
|
+
});
|
|
73
|
+
const CONTROL_NAME = /^[a-z][a-z0-9-]{0,31}$/;
|
|
74
|
+
/**
|
|
75
|
+
* The view a page acts on, with every value this release doesn't know read the safe way: an
|
|
76
|
+
* unknown channel isn't allowed (the shell's stays), an unknown policy or `once` scope is read as
|
|
77
|
+
* `once` per viewer (the page may submit and the server decides; it closes on its own submission
|
|
78
|
+
* only), and an unknown target as `live`.
|
|
79
|
+
*/
|
|
80
|
+
function readViewContext(wire) {
|
|
81
|
+
const channels = ["shell", "artifact"].filter((channel) => wire.submitChannels.includes(channel));
|
|
82
|
+
const { policy: name, scope } = wire.policy;
|
|
83
|
+
const policy = name === "none" ? { policy: "none" } : name === "epochs" ? { policy: "epochs" } : name === "once" && (scope === void 0 || scope === "per-artifact") ? {
|
|
84
|
+
policy: "once",
|
|
85
|
+
scope: "per-artifact"
|
|
86
|
+
} : {
|
|
87
|
+
policy: "once",
|
|
88
|
+
scope: "per-viewer"
|
|
89
|
+
};
|
|
90
|
+
const target = [
|
|
91
|
+
"live",
|
|
92
|
+
"static",
|
|
93
|
+
"mcp-app",
|
|
94
|
+
"verify"
|
|
95
|
+
].find((known) => known === wire.target);
|
|
96
|
+
return {
|
|
97
|
+
artifactId: wire.artifactId,
|
|
98
|
+
viewId: wire.viewId,
|
|
99
|
+
version: wire.version,
|
|
100
|
+
latest: wire.latest,
|
|
101
|
+
policy,
|
|
102
|
+
submitChannels: channels.length > 0 ? channels : ["shell"],
|
|
103
|
+
controls: wire.controls.filter((control) => CONTROL_NAME.test(control)),
|
|
104
|
+
target: target ?? "live"
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { ControlsPolicy, REVIEW_SET_ID_PATTERN, SubmitChannel, TrustedControl, VersionRef, ViewContext, ViewContextWire, readViewContext };
|
|
109
|
+
|
|
110
|
+
//# sourceMappingURL=view.js.map
|
package/dist/view.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view.js","names":[],"sources":["../src/view.ts"],"sourcesContent":["/**\n * What one view is (D104, D108): its artifact, version, policy, submit channels and trusted\n * controls. The browser protocol's frame ticket, the bridge's `ui/initialize` result and the\n * interaction core's channel policy share these shapes, so they live in a module of their own:\n * the bridge, which every version embeds, imports them without the interaction schemas.\n */\nimport * as z from \"zod\";\nimport { ArtifactId, VersionId, ViewId } from \"./ids.ts\";\nimport { SubmissionPolicy } from \"./manifest.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** Where a submit came from (D40). */\nexport type SubmitChannel = \"shell\" | \"artifact\";\n\n/** The Zod schema of the `SubmitChannel` type. */\nexport const SubmitChannel: z.ZodType<SubmitChannel> = z\n .enum([\"shell\", \"artifact\"])\n .register(wireRegistry, {\n id: \"SubmitChannel\",\n description: \"Where a submit comes from: the shell's trusted Submit, or the artifact's code.\",\n });\n\n/**\n * A trusted control the shell renders outside the artifact's frame (D06, PRODUCT vocabulary):\n * Submit, Choose (review sets) and Approve. Open for later controls on the wire.\n */\nexport type TrustedControl = \"submit\" | \"choose\" | \"approve\" | (string & {});\n\n/** The Zod schema of the `TrustedControl` type. */\nexport const TrustedControl: z.ZodType<TrustedControl> = z\n .string()\n .regex(/^[a-z][a-z0-9-]{0,31}$/)\n .register(wireRegistry, {\n id: \"TrustedControl\",\n description: \"A trusted control the shell renders: submit, choose, approve; open for more.\",\n });\n\n/**\n * Which submit channels a view accepts and which trusted controls its shell renders (D40, D108):\n * the `trustedControls` port's answer, or the home's `HomeConfig.submitChannels`.\n */\nexport interface ControlsPolicy {\n /** The channels submissions may come through; at least one. */\n readonly submitChannels: readonly SubmitChannel[];\n /** The trusted controls the shell may render; absent: every control the artifact asks for. */\n readonly controls?: readonly TrustedControl[];\n}\n\n/** The Zod schema of the `ControlsPolicy` type. */\nexport const ControlsPolicy: z.ZodType<ControlsPolicy> = z\n .object({\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly(),\n controls: z.array(TrustedControl).max(32).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ControlsPolicy\",\n description:\n \"Which submit channels a view accepts and which trusted controls its shell renders (D108).\",\n });\n\n/** A review set's ID: letters, digits, `_` and `-` (its choice is the field `review.<id>.choice`). */\nexport const REVIEW_SET_ID_PATTERN: RegExp = /^[A-Za-z0-9_-]{1,64}$/;\n\n/** Where a client runtime runs (D111): Mostra's gateway, a static export, an MCP App, or `verify`. */\nexport type DeliveryTarget = \"live\" | \"static\" | \"mcp-app\" | \"verify\";\n\n/** A version by ID and number. */\nexport interface VersionRef {\n /** The version's ID. */\n readonly id: string;\n /** Its number, for people. */\n readonly number: number;\n}\n\n/** The Zod schema of the `VersionRef` type. */\nexport const VersionRef: z.ZodType<VersionRef> = z\n .object({ id: VersionId.schema, number: z.int().min(1) })\n .register(wireRegistry, {\n id: \"VersionRef\",\n description: \"A version by ID and number.\",\n });\n\n/**\n * What one view is (D104, D108): the shell learns it from its frame ticket and hands it to the\n * frame in `ui/initialize`'s result, so the client runtime names the view in every request and\n * knows what the host allows.\n */\nexport interface ViewContext {\n /** The artifact. */\n readonly artifactId: string;\n /** The view this frame load is; every mutation and submit names it (D104). */\n readonly viewId: string;\n /** The version the view shows. */\n readonly version: VersionRef;\n /** The artifact's latest version when the view opened. */\n readonly latest: VersionRef;\n /** The submission policy in force (D102). */\n readonly policy: SubmissionPolicy;\n /** The submit channels this view accepts (D108). */\n readonly submitChannels: readonly SubmitChannel[];\n /** The trusted controls the shell renders for this view (D108). */\n readonly controls: readonly TrustedControl[];\n /** Always `live` in a frame Mostra's shell hosts. */\n readonly target: DeliveryTarget;\n}\n\n/** The Zod schema of the `ViewContext` type. */\nexport const ViewContext: z.ZodType<ViewContext> = z\n .object({\n artifactId: ArtifactId.schema,\n viewId: ViewId.schema,\n version: VersionRef,\n latest: VersionRef,\n policy: SubmissionPolicy,\n submitChannels: z.array(SubmitChannel).min(1).max(2).readonly(),\n controls: z.array(TrustedControl).max(32).readonly(),\n target: z.enum([\"live\", \"static\", \"mcp-app\", \"verify\"]),\n })\n .register(wireRegistry, {\n id: \"ViewContext\",\n description:\n \"What one view is: its artifact, view ID, version, latest version, policy, channels and controls.\",\n });\n\n/**\n * A view as a page reads it from `ui/initialize` (Claude review finding 5): every published\n * version embeds the page's reader, so it takes values a later Mostra may add (a channel, a\n * policy, a target) without refusing the whole view; {@link readViewContext} reads them safely.\n */\nexport interface ViewContextWire {\n /** The artifact. */\n readonly artifactId: string;\n /** The view this frame load is (D104). */\n readonly viewId: string;\n /** The version the view shows. */\n readonly version: VersionRef;\n /** The artifact's latest version when the view opened. */\n readonly latest: VersionRef;\n /** The submission policy in force (D102); a later policy or scope is read as `once` per viewer. */\n readonly policy: {\n /** `once`, `epochs`, `none`, or one a later release adds. */\n readonly policy: string;\n /** `per-artifact` or `per-viewer` under `once`, or one a later release adds. */\n readonly scope?: string;\n };\n /** The submit channels the view accepts (D108); channels this release doesn't know are not allowed. */\n readonly submitChannels: readonly string[];\n /** The trusted controls the shell renders for the view (D108). */\n readonly controls: readonly string[];\n /** Where the page runs (D111); a target this release doesn't know is read as `live`. */\n readonly target: string;\n}\n\n/** The Zod schema of the `ViewContextWire` type: open where later revisions may add values. */\nexport const ViewContextWire: z.ZodType<ViewContextWire> = z.looseObject({\n artifactId: ArtifactId.schema,\n viewId: ViewId.schema,\n version: VersionRef,\n latest: VersionRef,\n policy: z.looseObject({ policy: z.string(), scope: z.string().exactOptional() }),\n submitChannels: z.array(z.string()).max(16).readonly(),\n controls: z.array(z.string()).max(32).readonly(),\n target: z.string(),\n}) as z.ZodType<ViewContextWire>;\n\nconst CONTROL_NAME = /^[a-z][a-z0-9-]{0,31}$/;\n\n/**\n * The view a page acts on, with every value this release doesn't know read the safe way: an\n * unknown channel isn't allowed (the shell's stays), an unknown policy or `once` scope is read as\n * `once` per viewer (the page may submit and the server decides; it closes on its own submission\n * only), and an unknown target as `live`.\n */\nexport function readViewContext(wire: ViewContextWire): ViewContext {\n const channels = ([\"shell\", \"artifact\"] as const).filter((channel) =>\n wire.submitChannels.includes(channel),\n );\n const { policy: name, scope } = wire.policy;\n const policy: SubmissionPolicy =\n name === \"none\"\n ? { policy: \"none\" }\n : name === \"epochs\"\n ? { policy: \"epochs\" }\n : name === \"once\" && (scope === undefined || scope === \"per-artifact\")\n ? { policy: \"once\", scope: \"per-artifact\" }\n : { policy: \"once\", scope: \"per-viewer\" };\n const target = ([\"live\", \"static\", \"mcp-app\", \"verify\"] as const).find(\n (known) => known === wire.target,\n );\n return {\n artifactId: wire.artifactId,\n viewId: wire.viewId,\n version: wire.version,\n latest: wire.latest,\n policy,\n submitChannels: channels.length > 0 ? channels : [\"shell\"],\n controls: wire.controls.filter((control) => CONTROL_NAME.test(control)),\n target: target ?? \"live\",\n };\n}\n"],"mappings":";;;;;;;;;;;;AAeA,MAAa,gBAA0C,EACpD,KAAK,CAAC,SAAS,UAAU,CAAC,CAAC,CAC3B,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AASH,MAAa,iBAA4C,EACtD,OAAO,CAAC,CACR,MAAM,wBAAwB,CAAC,CAC/B,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAcH,MAAa,iBAA4C,EACtD,OAAO;CACN,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC9D,UAAU,EAAE,MAAM,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,cAAc;AACrE,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC;;AAGH,MAAa,wBAAgC;;AAc7C,MAAa,aAAoC,EAC9C,OAAO;CAAE,IAAI,UAAU;CAAQ,QAAQ,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AAAE,CAAC,CAAC,CACxD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AA2BH,MAAa,cAAsC,EAChD,OAAO;CACN,YAAY,WAAW;CACvB,QAAQ,OAAO;CACf,SAAS;CACT,QAAQ;CACR,QAAQ;CACR,gBAAgB,EAAE,MAAM,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;CAC9D,UAAU,EAAE,MAAM,cAAc,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,SAAS;CACnD,QAAQ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U;CACpB;AACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
//#region src/wire-registry.ts
|
|
3
|
+
/**
|
|
4
|
+
* The registry of named wire schemas. It is private to this package (not Zod's global registry), so
|
|
5
|
+
* two copies of the package in one process never collide.
|
|
6
|
+
*/
|
|
7
|
+
const wireRegistry = z.registry();
|
|
8
|
+
//#endregion
|
|
9
|
+
export { wireRegistry };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=wire-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire-registry.js","names":[],"sources":["../src/wire-registry.ts"],"sourcesContent":["import * as z from \"zod\";\n\n/** Metadata for a wire schema that has a stable name in the published JSON Schema. */\nexport interface WireSchemaMeta {\n /** The definition name in the published JSON Schema (`$defs`). Stable once released. */\n readonly id: string;\n readonly description?: string;\n}\n\n/**\n * The registry of named wire schemas. It is private to this package (not Zod's global registry), so\n * two copies of the package in one process never collide.\n */\nexport const wireRegistry: z.core.$ZodRegistry<WireSchemaMeta> = z.registry<WireSchemaMeta>();\n"],"mappings":";;;;;;AAaA,MAAa,eAAoD,EAAE,SAAyB"}
|