@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,306 @@
|
|
|
1
|
+
import { wireRegistry } from "./wire-registry.js";
|
|
2
|
+
import { ArtifactId, Cursor, DeliveryId, SubmissionId, VersionId, ViewId, ViewerId } from "./ids.js";
|
|
3
|
+
import { ArtifactLink, SubmissionPolicy } from "./manifest.js";
|
|
4
|
+
import { ControlsPolicy, SubmitChannel, TrustedControl } from "./view.js";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
//#region src/interaction.ts
|
|
7
|
+
/**
|
|
8
|
+
* The interaction ledger's wire types (INTERFACES §4, §6, §7, §8; DATA_MODEL §3, §4): viewers,
|
|
9
|
+
* fields and their mutations, events and their filters, `wait` conditions, submissions, deliveries
|
|
10
|
+
* and results. The host protocol methods (`state/*`, `results/get`, `wait`, `events/*`), the
|
|
11
|
+
* submissions and drafts ports, and the browser protocol all speak these shapes.
|
|
12
|
+
*/
|
|
13
|
+
/** The Zod schema of the `Viewer` type. */
|
|
14
|
+
const Viewer = z.object({
|
|
15
|
+
id: ViewerId.schema,
|
|
16
|
+
kind: z.enum([
|
|
17
|
+
"local",
|
|
18
|
+
"tailnet",
|
|
19
|
+
"token",
|
|
20
|
+
"host"
|
|
21
|
+
]),
|
|
22
|
+
name: z.string().exactOptional(),
|
|
23
|
+
ref: z.string().exactOptional()
|
|
24
|
+
}).register(wireRegistry, {
|
|
25
|
+
id: "Viewer",
|
|
26
|
+
description: "A person who views an artifact: ID, kind, display name and the host's own key."
|
|
27
|
+
});
|
|
28
|
+
/** The Zod schema of the `ViewerSpec` type. */
|
|
29
|
+
const ViewerSpec = z.object({
|
|
30
|
+
ref: z.string().min(1).max(256),
|
|
31
|
+
name: z.string().min(1).max(256).exactOptional()
|
|
32
|
+
}).register(wireRegistry, {
|
|
33
|
+
id: "ViewerSpec",
|
|
34
|
+
description: "The person a capability link acts for: the host's stable key and a display name."
|
|
35
|
+
});
|
|
36
|
+
/** The Zod schema of the `Actor` type. */
|
|
37
|
+
const Actor = z.object({
|
|
38
|
+
kind: z.enum([
|
|
39
|
+
"viewer",
|
|
40
|
+
"agent",
|
|
41
|
+
"host",
|
|
42
|
+
"mostra"
|
|
43
|
+
]),
|
|
44
|
+
id: z.string().exactOptional(),
|
|
45
|
+
name: z.string().exactOptional()
|
|
46
|
+
}).register(wireRegistry, {
|
|
47
|
+
id: "Actor",
|
|
48
|
+
description: "Who caused an event or wrote a field: a viewer, an agent, a host or Mostra."
|
|
49
|
+
});
|
|
50
|
+
/** The longest field ID, in UTF-16 code units. */
|
|
51
|
+
const FIELD_ID_MAX_LENGTH = 256;
|
|
52
|
+
/**
|
|
53
|
+
* Whether `id` is a field ID (D52): 1 to 256 characters without control characters; dots separate
|
|
54
|
+
* the parts that nest in results, so none is empty.
|
|
55
|
+
*/
|
|
56
|
+
function isFieldId(id) {
|
|
57
|
+
return typeof id === "string" && id.length >= 1 && id.length <= 256 && !/[\u0000-\u001f\u007f]/.test(id) && !id.split(".").includes("");
|
|
58
|
+
}
|
|
59
|
+
/** The Zod schema of the `DocumentRevision` type. */
|
|
60
|
+
const DocumentRevision = z.string().regex(/^(0|[1-9][0-9]{0,15})$/).register(wireRegistry, {
|
|
61
|
+
id: "DocumentRevision",
|
|
62
|
+
description: "A draft's or artifact state's revision: a non-negative decimal integer string."
|
|
63
|
+
});
|
|
64
|
+
/** The Zod schema of the `FieldOp` type. */
|
|
65
|
+
const FieldOp = z.object({
|
|
66
|
+
id: z.string().min(1).max(256),
|
|
67
|
+
value: z.unknown().exactOptional(),
|
|
68
|
+
delete: z.literal(true).exactOptional(),
|
|
69
|
+
label: z.string().max(1024).exactOptional(),
|
|
70
|
+
required: z.boolean().exactOptional(),
|
|
71
|
+
sensitive: z.boolean().exactOptional()
|
|
72
|
+
}).register(wireRegistry, {
|
|
73
|
+
id: "FieldOp",
|
|
74
|
+
description: "One change to one field: a value or a delete, with optional label, required and sensitive."
|
|
75
|
+
});
|
|
76
|
+
/** The Zod schema of the `FieldState` type. */
|
|
77
|
+
const FieldState = z.object({
|
|
78
|
+
value: z.unknown(),
|
|
79
|
+
revision: DocumentRevision,
|
|
80
|
+
updatedBy: Actor.exactOptional(),
|
|
81
|
+
updatedAt: z.iso.datetime(),
|
|
82
|
+
label: z.string().exactOptional(),
|
|
83
|
+
required: z.boolean().exactOptional(),
|
|
84
|
+
sensitive: z.boolean().exactOptional()
|
|
85
|
+
}).register(wireRegistry, {
|
|
86
|
+
id: "FieldState",
|
|
87
|
+
description: "A field's current value, the revision that wrote it, who wrote it and when."
|
|
88
|
+
});
|
|
89
|
+
/** The Zod schema of the `FieldConflict` type. */
|
|
90
|
+
const FieldConflict = z.object({
|
|
91
|
+
id: z.string(),
|
|
92
|
+
revision: DocumentRevision,
|
|
93
|
+
value: z.unknown().exactOptional(),
|
|
94
|
+
deleted: z.literal(true).exactOptional(),
|
|
95
|
+
updatedBy: Actor.exactOptional(),
|
|
96
|
+
updatedAt: z.iso.datetime().exactOptional()
|
|
97
|
+
}).register(wireRegistry, {
|
|
98
|
+
id: "FieldConflict",
|
|
99
|
+
description: "A field op not applied because the field changed after the base revision."
|
|
100
|
+
});
|
|
101
|
+
/** The Zod schema of the `MutationResult` type. */
|
|
102
|
+
const MutationResult = z.object({
|
|
103
|
+
revision: DocumentRevision,
|
|
104
|
+
applied: z.array(z.string()).readonly(),
|
|
105
|
+
conflicts: z.array(FieldConflict).readonly()
|
|
106
|
+
}).register(wireRegistry, {
|
|
107
|
+
id: "MutationResult",
|
|
108
|
+
description: "A mutation's outcome: the revision after it, the applied field IDs, the conflicts."
|
|
109
|
+
});
|
|
110
|
+
/** The Zod schema of the `EventRecord` type. */
|
|
111
|
+
const EventRecord = z.object({
|
|
112
|
+
cursor: Cursor.schema,
|
|
113
|
+
artifactId: ArtifactId.schema.nullable(),
|
|
114
|
+
seq: z.int().min(1).nullable(),
|
|
115
|
+
type: z.string(),
|
|
116
|
+
at: z.iso.datetime(),
|
|
117
|
+
actor: Actor,
|
|
118
|
+
causation: z.record(z.string(), z.string()).exactOptional(),
|
|
119
|
+
payload: z.record(z.string(), z.unknown())
|
|
120
|
+
}).register(wireRegistry, {
|
|
121
|
+
id: "EventRecord",
|
|
122
|
+
description: "One durable event: cursor, artifact, per-artifact sequence, type, time, actor, payload."
|
|
123
|
+
});
|
|
124
|
+
/** The Zod schema of the `EventTypePattern` type. */
|
|
125
|
+
const EventTypePattern = z.string().regex(/^[a-z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9_-]+)*(\.\*)?$/).register(wireRegistry, {
|
|
126
|
+
id: "EventTypePattern",
|
|
127
|
+
description: "An event type (submission.created) or a family of them (submission.*)."
|
|
128
|
+
});
|
|
129
|
+
/** The Zod schema of the `EventFilter` type. */
|
|
130
|
+
const EventFilter = z.object({
|
|
131
|
+
artifacts: z.array(ArtifactId.schema).max(1e3).readonly().exactOptional(),
|
|
132
|
+
types: z.array(EventTypePattern).max(100).readonly().exactOptional()
|
|
133
|
+
}).register(wireRegistry, {
|
|
134
|
+
id: "EventFilter",
|
|
135
|
+
description: "Which events a reader wants: these artifacts' and these types (patterns allowed)."
|
|
136
|
+
});
|
|
137
|
+
/** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */
|
|
138
|
+
const SIGNAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
139
|
+
/** The Zod schema of the `WaitCondition` type. */
|
|
140
|
+
const WaitCondition = z.string().regex(/^(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\u0000-\u001f\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\.[a-zA-Z0-9_-]+)*(\.\*)?)$/).register(wireRegistry, {
|
|
141
|
+
id: "WaitCondition",
|
|
142
|
+
description: "What wait waits for: submitted, signal:<name>, state:<fieldId> or event:<type>."
|
|
143
|
+
});
|
|
144
|
+
/** The Zod schema of the `DeliveryStatus` type. */
|
|
145
|
+
const DeliveryStatus = z.object({
|
|
146
|
+
deliveryId: DeliveryId.schema,
|
|
147
|
+
owner: z.string(),
|
|
148
|
+
state: z.enum([
|
|
149
|
+
"pending",
|
|
150
|
+
"delivered",
|
|
151
|
+
"rejected",
|
|
152
|
+
"undeliverable"
|
|
153
|
+
]),
|
|
154
|
+
attempts: z.int().min(0),
|
|
155
|
+
reason: z.string().exactOptional(),
|
|
156
|
+
waiting: z.literal(true).exactOptional(),
|
|
157
|
+
updatedAt: z.iso.datetime()
|
|
158
|
+
}).register(wireRegistry, {
|
|
159
|
+
id: "DeliveryStatus",
|
|
160
|
+
description: "One submission's delivery to one host: owner, state, attempts and reason."
|
|
161
|
+
});
|
|
162
|
+
/** The Zod schema of the `SubmissionSummary` type. */
|
|
163
|
+
const SubmissionSummary = z.object({
|
|
164
|
+
id: SubmissionId.schema,
|
|
165
|
+
at: z.iso.datetime(),
|
|
166
|
+
epoch: z.int().min(1),
|
|
167
|
+
channel: z.enum(["shell", "artifact"]),
|
|
168
|
+
versionId: VersionId.schema,
|
|
169
|
+
version: z.int().min(1),
|
|
170
|
+
viewId: ViewId.schema,
|
|
171
|
+
staleView: z.boolean(),
|
|
172
|
+
draftRevision: DocumentRevision,
|
|
173
|
+
digest: z.string().regex(/^[0-9a-f]{64}$/),
|
|
174
|
+
delivery: z.enum([
|
|
175
|
+
"pending",
|
|
176
|
+
"delivered",
|
|
177
|
+
"rejected",
|
|
178
|
+
"undeliverable"
|
|
179
|
+
]),
|
|
180
|
+
deliveries: z.array(DeliveryStatus).readonly().exactOptional(),
|
|
181
|
+
duplicate: z.literal(true).exactOptional()
|
|
182
|
+
}).register(wireRegistry, {
|
|
183
|
+
id: "SubmissionSummary",
|
|
184
|
+
description: "A submission as a submit answers it: ID, time, epoch, version, view, digest, delivery."
|
|
185
|
+
});
|
|
186
|
+
const RectSchema = z.object({
|
|
187
|
+
x: z.number(),
|
|
188
|
+
y: z.number(),
|
|
189
|
+
width: z.number(),
|
|
190
|
+
height: z.number()
|
|
191
|
+
});
|
|
192
|
+
/** The Zod schema of the `ResultComment` type. */
|
|
193
|
+
const ResultComment = z.object({
|
|
194
|
+
threadId: z.string(),
|
|
195
|
+
status: z.enum(["open", "resolved"]),
|
|
196
|
+
messages: z.array(z.object({
|
|
197
|
+
author: Viewer,
|
|
198
|
+
at: z.iso.datetime(),
|
|
199
|
+
text: z.string()
|
|
200
|
+
})).readonly(),
|
|
201
|
+
anchor: z.object({
|
|
202
|
+
reviewId: z.string().exactOptional(),
|
|
203
|
+
selectors: z.array(z.unknown()).readonly().exactOptional(),
|
|
204
|
+
rect: RectSchema.exactOptional(),
|
|
205
|
+
viewport: z.object({
|
|
206
|
+
width: z.number(),
|
|
207
|
+
height: z.number(),
|
|
208
|
+
dpr: z.number()
|
|
209
|
+
}).exactOptional(),
|
|
210
|
+
page: z.string().exactOptional(),
|
|
211
|
+
candidateId: z.string().exactOptional(),
|
|
212
|
+
terminal: z.object({
|
|
213
|
+
rows: z.tuple([z.int(), z.int()]).readonly(),
|
|
214
|
+
cols: z.tuple([z.int(), z.int()]).readonly(),
|
|
215
|
+
t: z.number().exactOptional()
|
|
216
|
+
}).exactOptional(),
|
|
217
|
+
time: z.number().exactOptional(),
|
|
218
|
+
slide: z.object({
|
|
219
|
+
index: z.int(),
|
|
220
|
+
step: z.int()
|
|
221
|
+
}).exactOptional()
|
|
222
|
+
}),
|
|
223
|
+
crop: z.object({
|
|
224
|
+
path: z.string(),
|
|
225
|
+
width: z.int(),
|
|
226
|
+
height: z.int()
|
|
227
|
+
})
|
|
228
|
+
}).register(wireRegistry, {
|
|
229
|
+
id: "ResultComment",
|
|
230
|
+
description: "One comment thread in results: messages, anchor layers and the screenshot crop."
|
|
231
|
+
});
|
|
232
|
+
/** The Zod schema of the `Results` type. */
|
|
233
|
+
const Results = z.object({
|
|
234
|
+
artifact: z.object({
|
|
235
|
+
id: ArtifactId.schema,
|
|
236
|
+
title: z.string(),
|
|
237
|
+
description: z.string().exactOptional(),
|
|
238
|
+
family: z.string().exactOptional(),
|
|
239
|
+
links: z.array(ArtifactLink).readonly()
|
|
240
|
+
}),
|
|
241
|
+
submission: z.object({
|
|
242
|
+
id: SubmissionId.schema,
|
|
243
|
+
at: z.iso.datetime(),
|
|
244
|
+
epoch: z.int().min(1),
|
|
245
|
+
previous: SubmissionId.schema.exactOptional(),
|
|
246
|
+
policy: SubmissionPolicy,
|
|
247
|
+
channel: z.enum(["shell", "artifact"]),
|
|
248
|
+
viewer: Viewer,
|
|
249
|
+
versionId: VersionId.schema,
|
|
250
|
+
version: z.int().min(1),
|
|
251
|
+
viewId: ViewId.schema,
|
|
252
|
+
staleView: z.boolean(),
|
|
253
|
+
latestVersion: z.int().min(1).exactOptional(),
|
|
254
|
+
draftRevision: DocumentRevision,
|
|
255
|
+
stateRevision: DocumentRevision.exactOptional(),
|
|
256
|
+
digest: z.string().regex(/^[0-9a-f]{64}$/),
|
|
257
|
+
delivery: z.enum([
|
|
258
|
+
"pending",
|
|
259
|
+
"delivered",
|
|
260
|
+
"rejected",
|
|
261
|
+
"undeliverable"
|
|
262
|
+
]),
|
|
263
|
+
deliveries: z.array(DeliveryStatus).readonly()
|
|
264
|
+
}),
|
|
265
|
+
answers: z.record(z.string(), z.unknown()),
|
|
266
|
+
fields: z.array(z.object({
|
|
267
|
+
id: z.string(),
|
|
268
|
+
label: z.string().exactOptional(),
|
|
269
|
+
required: z.boolean().exactOptional(),
|
|
270
|
+
sensitive: z.boolean().exactOptional(),
|
|
271
|
+
scope: z.enum(["viewer", "artifact"])
|
|
272
|
+
})).readonly(),
|
|
273
|
+
state: z.record(z.string(), z.unknown()).exactOptional(),
|
|
274
|
+
choices: z.array(z.object({
|
|
275
|
+
reviewSetId: z.string(),
|
|
276
|
+
candidateId: z.string(),
|
|
277
|
+
label: z.string().exactOptional()
|
|
278
|
+
})).readonly(),
|
|
279
|
+
comments: z.array(ResultComment).readonly(),
|
|
280
|
+
orphaned: z.array(z.object({
|
|
281
|
+
id: z.string(),
|
|
282
|
+
label: z.string().exactOptional(),
|
|
283
|
+
value: z.unknown(),
|
|
284
|
+
fromVersion: z.int().min(1)
|
|
285
|
+
})).readonly(),
|
|
286
|
+
actions: z.array(z.object({
|
|
287
|
+
runId: z.string(),
|
|
288
|
+
action: z.string(),
|
|
289
|
+
status: z.string(),
|
|
290
|
+
at: z.iso.datetime()
|
|
291
|
+
})).readonly(),
|
|
292
|
+
signals: z.array(z.object({
|
|
293
|
+
name: z.string(),
|
|
294
|
+
at: z.iso.datetime(),
|
|
295
|
+
payload: z.unknown().exactOptional()
|
|
296
|
+
})).readonly(),
|
|
297
|
+
signalsOmitted: z.int().min(1).exactOptional(),
|
|
298
|
+
signalsCompacted: z.literal(true).exactOptional()
|
|
299
|
+
}).register(wireRegistry, {
|
|
300
|
+
id: "Results",
|
|
301
|
+
description: "The complete submission: artifact, submission facts, answers, fields, state, choices, comments, orphans, actions, signals."
|
|
302
|
+
});
|
|
303
|
+
//#endregion
|
|
304
|
+
export { Actor, ControlsPolicy, DeliveryStatus, DocumentRevision, EventFilter, EventRecord, EventTypePattern, FIELD_ID_MAX_LENGTH, FieldConflict, FieldOp, FieldState, MutationResult, ResultComment, Results, SIGNAL_NAME_PATTERN, SubmissionSummary, SubmitChannel, TrustedControl, Viewer, ViewerSpec, WaitCondition, isFieldId };
|
|
305
|
+
|
|
306
|
+
//# sourceMappingURL=interaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interaction.js","names":[],"sources":["../src/interaction.ts"],"sourcesContent":["/**\n * The interaction ledger's wire types (INTERFACES §4, §6, §7, §8; DATA_MODEL §3, §4): viewers,\n * fields and their mutations, events and their filters, `wait` conditions, submissions, deliveries\n * and results. The host protocol methods (`state/*`, `results/get`, `wait`, `events/*`), the\n * submissions and drafts ports, and the browser protocol all speak these shapes.\n */\nimport * as z from \"zod\";\nimport {\n ArtifactId,\n Cursor,\n DeliveryId,\n SubmissionId,\n VersionId,\n ViewerId,\n ViewId,\n} from \"./ids.ts\";\nimport { ArtifactLink, SubmissionPolicy } from \"./manifest.ts\";\nimport type { SubmitChannel } from \"./view.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\nexport { ControlsPolicy, SubmitChannel, TrustedControl } from \"./view.ts\";\n\n// ── Viewers and actors ────────────────────────────────────────────────────────────────────\n\n/** How Mostra knows a viewer (DATA_MODEL §3 `viewer.kind`). */\nexport type ViewerKind = \"local\" | \"tailnet\" | \"token\" | \"host\";\n\n/**\n * A person who views an artifact (PRODUCT vocabulary). The home's local user is one viewer of kind\n * `local`; a link minted with `viewer` acts as a viewer of kind `token` (D104).\n */\nexport interface Viewer {\n /** The viewer's ID. */\n readonly id: string;\n /** How Mostra knows the viewer. */\n readonly kind: ViewerKind;\n /** The display name, when one is known. */\n readonly name?: string;\n /** The host's own key for this person, as given to `view/url` (D104). */\n readonly ref?: string;\n}\n\n/** The Zod schema of the `Viewer` type. */\nexport const Viewer: z.ZodType<Viewer> = z\n .object({\n id: ViewerId.schema,\n kind: z.enum([\"local\", \"tailnet\", \"token\", \"host\"]),\n name: z.string().exactOptional(),\n ref: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Viewer\",\n description: \"A person who views an artifact: ID, kind, display name and the host's own key.\",\n });\n\n/**\n * The person a capability link acts for (`view/url`'s `viewer`, D104): the host's stable key for\n * them, such as an email or an account ID, and a display name.\n */\nexport interface ViewerSpec {\n /** The host's stable key for this person: the same `ref` always names the same viewer. */\n readonly ref: string;\n /** The name people see; updated when given again. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `ViewerSpec` type. */\nexport const ViewerSpec: z.ZodType<ViewerSpec> = z\n .object({\n ref: z.string().min(1).max(256),\n name: z.string().min(1).max(256).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ViewerSpec\",\n description: \"The person a capability link acts for: the host's stable key and a display name.\",\n });\n\n/** Who caused an event or wrote a field (DATA_MODEL §4). */\nexport interface Actor {\n /** Who: a viewer, an agent (a protocol client), a host, or Mostra itself. */\n readonly kind: \"viewer\" | \"agent\" | \"host\" | \"mostra\";\n /** A viewer's ID, or the protocol client's name for agents and hosts. */\n readonly id?: string;\n /** A display name, when one is known. */\n readonly name?: string;\n}\n\n/** The Zod schema of the `Actor` type. */\nexport const Actor: z.ZodType<Actor> = z\n .object({\n kind: z.enum([\"viewer\", \"agent\", \"host\", \"mostra\"]),\n id: z.string().exactOptional(),\n name: z.string().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Actor\",\n description: \"Who caused an event or wrote a field: a viewer, an agent, a host or Mostra.\",\n });\n\n// ── Fields and mutations ──────────────────────────────────────────────────────────────────\n\n/** The longest field ID, in UTF-16 code units. */\nexport const FIELD_ID_MAX_LENGTH = 256;\n\n/**\n * Whether `id` is a field ID (D52): 1 to 256 characters without control characters; dots separate\n * the parts that nest in results, so none is empty.\n */\nexport function isFieldId(id: unknown): id is string {\n return (\n typeof id === \"string\" &&\n id.length >= 1 &&\n id.length <= FIELD_ID_MAX_LENGTH &&\n // biome-ignore lint/suspicious/noControlCharactersInRegex: control characters are what it refuses.\n !/[\\u0000-\\u001f\\u007f]/.test(id) &&\n !id.split(\".\").includes(\"\")\n );\n}\n\n/** Which document a field belongs to: the viewer's draft, or the artifact's shared state (D63). */\nexport type FieldScope = \"viewer\" | \"artifact\";\n\n/**\n * A document revision: the decimal string of a document's monotonic counter (DATA_MODEL §3).\n * `\"0\"` is a document nothing has written yet.\n */\nexport type DocumentRevision = string;\n\n/** The Zod schema of the `DocumentRevision` type. */\nexport const DocumentRevision: z.ZodType<DocumentRevision> = z\n .string()\n .regex(/^(0|[1-9][0-9]{0,15})$/)\n .register(wireRegistry, {\n id: \"DocumentRevision\",\n description: \"A draft's or artifact state's revision: a non-negative decimal integer string.\",\n });\n\n/**\n * One change to one field. Exactly one of `value` and `delete` is given. The optional metadata\n * travels with the field into results and decides what events redact (D52, D106).\n */\nexport interface FieldOp {\n /** The field ID (D52). */\n readonly id: string;\n /** The new value: any JSON value, `null` included. */\n readonly value?: unknown;\n /** Removes the field. */\n readonly delete?: true;\n /** The label people see in results and the shell's blocker list. */\n readonly label?: string;\n /** Whether the shell asks for it before submit. */\n readonly required?: boolean;\n /** Kept in submissions and results, redacted from events and logs (D52). */\n readonly sensitive?: boolean;\n}\n\n/** The Zod schema of the `FieldOp` type. */\nexport const FieldOp: z.ZodType<FieldOp> = z\n .object({\n id: z.string().min(1).max(FIELD_ID_MAX_LENGTH),\n value: z.unknown().exactOptional(),\n delete: z.literal(true).exactOptional(),\n label: z.string().max(1024).exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldOp\",\n description:\n \"One change to one field: a value or a delete, with optional label, required and sensitive.\",\n }) as z.ZodType<FieldOp>;\n\n/** A field's current state. */\nexport interface FieldState {\n /** The field's value: any JSON value. */\n readonly value: unknown;\n /** The document revision that last wrote it. */\n readonly revision: DocumentRevision;\n /** Who wrote it last. */\n readonly updatedBy?: Actor;\n /** When it was written last. */\n readonly updatedAt: string;\n /** The label people see. */\n readonly label?: string;\n /** Whether the shell asks for it before submit. */\n readonly required?: boolean;\n /** Whether events and logs redact its value (D52). */\n readonly sensitive?: boolean;\n}\n\n/** The Zod schema of the `FieldState` type. */\nexport const FieldState: z.ZodType<FieldState> = z\n .object({\n value: z.unknown(),\n revision: DocumentRevision,\n updatedBy: Actor.exactOptional(),\n updatedAt: z.iso.datetime(),\n label: z.string().exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldState\",\n description: \"A field's current value, the revision that wrote it, who wrote it and when.\",\n }) as z.ZodType<FieldState>;\n\n/**\n * A field op that wasn't applied because the field changed after the mutation's base revision\n * (D22, FAILURE_MODEL §5): what the field holds now, so the writer can keep theirs or take it.\n */\nexport interface FieldConflict {\n /** The field's ID. */\n readonly id: string;\n /** The revision that last changed the field. */\n readonly revision: DocumentRevision;\n /** Its current value; absent when it was deleted. */\n readonly value?: unknown;\n /** `true` when the field was deleted. */\n readonly deleted?: true;\n /** Who changed it. */\n readonly updatedBy?: Actor;\n /** When it changed. */\n readonly updatedAt?: string;\n}\n\n/** The Zod schema of the `FieldConflict` type. */\nexport const FieldConflict: z.ZodType<FieldConflict> = z\n .object({\n id: z.string(),\n revision: DocumentRevision,\n value: z.unknown().exactOptional(),\n deleted: z.literal(true).exactOptional(),\n updatedBy: Actor.exactOptional(),\n updatedAt: z.iso.datetime().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"FieldConflict\",\n description: \"A field op not applied because the field changed after the base revision.\",\n }) as z.ZodType<FieldConflict>;\n\n/** What a mutation did: the document's revision after it, the ops applied, and the conflicts. */\nexport interface MutationResult {\n /** The document's revision after the mutation; unchanged when nothing applied. */\n readonly revision: DocumentRevision;\n /** The field IDs whose ops were applied. */\n readonly applied: readonly string[];\n /** The ops not applied, with what each field holds now. */\n readonly conflicts: readonly FieldConflict[];\n}\n\n/** The Zod schema of the `MutationResult` type. */\nexport const MutationResult: z.ZodType<MutationResult> = z\n .object({\n revision: DocumentRevision,\n applied: z.array(z.string()).readonly(),\n conflicts: z.array(FieldConflict).readonly(),\n })\n .register(wireRegistry, {\n id: \"MutationResult\",\n description:\n \"A mutation's outcome: the revision after it, the applied field IDs, the conflicts.\",\n });\n\n// ── Events ────────────────────────────────────────────────────────────────────────────────\n\n/**\n * One durable event (DATA_MODEL §4). Its cursor is its stable ID and its place in the home-wide\n * order; `seq` orders an artifact's own events without gaps.\n */\nexport interface EventRecord {\n /** The event's stable ID and home-wide position. */\n readonly cursor: Cursor;\n /** The artifact, or `null` for a home-wide event. */\n readonly artifactId: string | null;\n /** The artifact's sequence number, or `null` for a home-wide event. */\n readonly seq: number | null;\n /** The type from DATA_MODEL §4's catalog. */\n readonly type: string;\n /** When it was appended. */\n readonly at: string;\n /** Who caused it. */\n readonly actor: Actor;\n /** What caused it: a run, a mutation, a submission. */\n readonly causation?: Readonly<Record<string, string>>;\n /** The event's data; sensitive field values are redacted (D52). */\n readonly payload: Readonly<Record<string, unknown>>;\n}\n\n/** The Zod schema of the `EventRecord` type. */\nexport const EventRecord: z.ZodType<EventRecord> = z\n .object({\n cursor: Cursor.schema,\n artifactId: ArtifactId.schema.nullable(),\n seq: z.int().min(1).nullable(),\n type: z.string(),\n at: z.iso.datetime(),\n actor: Actor,\n causation: z.record(z.string(), z.string()).exactOptional(),\n payload: z.record(z.string(), z.unknown()),\n })\n .register(wireRegistry, {\n id: \"EventRecord\",\n description:\n \"One durable event: cursor, artifact, per-artifact sequence, type, time, actor, payload.\",\n }) as z.ZodType<EventRecord>;\n\n/**\n * An event type, or a family of them: `submission.created`, or `submission.*` for every type that\n * starts with `submission.`.\n */\nexport type EventTypePattern = string;\n\n/** The Zod schema of the `EventTypePattern` type. */\nexport const EventTypePattern: z.ZodType<EventTypePattern> = z\n .string()\n .regex(/^[a-z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?$/)\n .register(wireRegistry, {\n id: \"EventTypePattern\",\n description: \"An event type (submission.created) or a family of them (submission.*).\",\n });\n\n/**\n * Which events a reader wants (IN-08, H-09). Both parts are optional, and an event must pass both.\n * `artifact.compacted` always passes for a matching artifact, so a filtered reader still learns of\n * a compaction (DATA_MODEL §4).\n */\nexport interface EventFilter {\n /** Only these artifacts' events; absent: every artifact's, and home-wide ones. */\n readonly artifacts?: readonly string[];\n /** Only these types; absent: every type. */\n readonly types?: readonly EventTypePattern[];\n}\n\n/** The Zod schema of the `EventFilter` type. */\nexport const EventFilter: z.ZodType<EventFilter> = z\n .object({\n artifacts: z.array(ArtifactId.schema).max(1000).readonly().exactOptional(),\n types: z.array(EventTypePattern).max(100).readonly().exactOptional(),\n })\n .register(wireRegistry, {\n id: \"EventFilter\",\n description:\n \"Which events a reader wants: these artifacts' and these types (patterns allowed).\",\n });\n\n/**\n * What `wait` waits for (ARCHITECTURE §6, D103): `submitted`, `signal:<name>`, `state:<fieldId>`\n * or `event:<type pattern>`.\n */\nexport type WaitCondition = string;\n\n/** A signal's name: letters, digits, `.`, `_` and `-`, starting with a letter or digit (D106). */\nexport const SIGNAL_NAME_PATTERN: RegExp = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;\n\n/** The Zod schema of the `WaitCondition` type. */\nexport const WaitCondition: z.ZodType<WaitCondition> = z\n .string()\n .regex(\n // biome-ignore lint/suspicious/noControlCharactersInRegex: field IDs exclude control characters.\n /^(submitted|signal:[A-Za-z0-9][A-Za-z0-9._-]{0,63}|state:[^\\u0000-\\u001f\\u007f]{1,256}|event:[a-z][a-zA-Z0-9_-]*(\\.[a-zA-Z0-9_-]+)*(\\.\\*)?)$/,\n )\n .register(wireRegistry, {\n id: \"WaitCondition\",\n description: \"What wait waits for: submitted, signal:<name>, state:<fieldId> or event:<type>.\",\n });\n\n// ── Submissions, deliveries and results ──────────────────────────────────────────────────\n\n/** A delivery's state (FAILURE_MODEL §4). */\nexport type DeliveryState = \"pending\" | \"delivered\" | \"rejected\" | \"undeliverable\";\n\n/** One submission's delivery to one host (D105). */\nexport interface DeliveryStatus {\n /** The delivery's stable ID (`dlv_`), repeated by every redelivery. */\n readonly deliveryId: string;\n /**\n * The host: its client name. Empty for Mostra's built-in adapter, which takes submissions when no\n * host does; client names are never empty, so no host can be mistaken for it (D105).\n */\n readonly owner: string;\n /** Where the delivery stands. */\n readonly state: DeliveryState;\n /** How many times Mostra called the host for it. */\n readonly attempts: number;\n /** The host's reason, for a rejection. */\n readonly reason?: string;\n /**\n * `true` while a pending delivery waits: its host isn't connected, or an attempt failed and it\n * will be retried (D47's \"Pending delivery\"). Absent while the first attempt is under way.\n */\n readonly waiting?: true;\n /** When its state last changed. */\n readonly updatedAt: string;\n}\n\n/** The Zod schema of the `DeliveryStatus` type. */\nexport const DeliveryStatus: z.ZodType<DeliveryStatus> = z\n .object({\n deliveryId: DeliveryId.schema,\n owner: z.string(),\n state: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n attempts: z.int().min(0),\n reason: z.string().exactOptional(),\n waiting: z.literal(true).exactOptional(),\n updatedAt: z.iso.datetime(),\n })\n .register(wireRegistry, {\n id: \"DeliveryStatus\",\n description: \"One submission's delivery to one host: owner, state, attempts and reason.\",\n });\n\n/** A submission as a submit answers it (INTERFACES §4). */\nexport interface SubmissionSummary {\n /** The submission's ID. */\n readonly id: string;\n /** When it was made. */\n readonly at: string;\n /** The draft epoch it closed (D103); 1 outside `epochs`. */\n readonly epoch: number;\n /** Where the submit came from (D40). */\n readonly channel: SubmitChannel;\n /** The version the view showed. */\n readonly versionId: string;\n /** That version's number. */\n readonly version: number;\n /** The view it was made from. */\n readonly viewId: string;\n /** Whether a newer version existed when the viewer submitted (H-10). */\n readonly staleView: boolean;\n /** The draft revision it was made from. */\n readonly draftRevision: DocumentRevision;\n /** SHA-256 of the snapshot's canonical JSON (RFC 8785), lowercase hex. */\n readonly digest: string;\n /** Every delivery's state, summed up: the worst of them. */\n readonly delivery: DeliveryState;\n /** Each host's delivery, so a viewer sees which host has it (IN-13). */\n readonly deliveries?: readonly DeliveryStatus[];\n /** `true` when this submit repeated an earlier one and got it back (D22). */\n readonly duplicate?: true;\n}\n\n/** The Zod schema of the `SubmissionSummary` type. */\nexport const SubmissionSummary: z.ZodType<SubmissionSummary> = z\n .object({\n id: SubmissionId.schema,\n at: z.iso.datetime(),\n epoch: z.int().min(1),\n channel: z.enum([\"shell\", \"artifact\"]),\n versionId: VersionId.schema,\n version: z.int().min(1),\n viewId: ViewId.schema,\n staleView: z.boolean(),\n draftRevision: DocumentRevision,\n digest: z.string().regex(/^[0-9a-f]{64}$/),\n delivery: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n deliveries: z.array(DeliveryStatus).readonly().exactOptional(),\n duplicate: z.literal(true).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"SubmissionSummary\",\n description:\n \"A submission as a submit answers it: ID, time, epoch, version, view, digest, delivery.\",\n });\n\n/** A rectangle in CSS pixels, relative to its frame. */\nexport interface Rect {\n /** Distance from the frame's left edge. */\n readonly x: number;\n /** Distance from the frame's top edge. */\n readonly y: number;\n /** Width. */\n readonly width: number;\n /** Height. */\n readonly height: number;\n}\n\n/** A viewport: its size in CSS pixels and its device pixel ratio. */\nexport interface Viewport {\n /** Width in CSS pixels. */\n readonly width: number;\n /** Height in CSS pixels. */\n readonly height: number;\n /** Device pixel ratio. */\n readonly dpr: number;\n}\n\n/** One comment thread in results (INTERFACES §8; built by the review layer, WP-20). */\nexport interface ResultComment {\n /** The thread's ID. */\n readonly threadId: string;\n /** Whether the thread is open or resolved. */\n readonly status: \"open\" | \"resolved\";\n /** The thread's messages, oldest first, each with its author. */\n readonly messages: readonly {\n readonly author: Viewer;\n readonly at: string;\n readonly text: string;\n }[];\n /** Every layer of the anchor that applies (D23). */\n readonly anchor: {\n readonly reviewId?: string;\n /** W3C Web Annotation selectors. */\n readonly selectors?: readonly unknown[];\n readonly rect?: Rect;\n readonly viewport?: Viewport;\n readonly page?: string;\n readonly candidateId?: string;\n readonly terminal?: {\n readonly rows: readonly [number, number];\n readonly cols: readonly [number, number];\n readonly t?: number;\n };\n readonly time?: number;\n readonly slide?: { readonly index: number; readonly step: number };\n };\n /** The screenshot crop, always stored (D23). */\n readonly crop: { readonly path: string; readonly width: number; readonly height: number };\n}\n\n/**\n * The complete submission (INTERFACES §8): what `results/get`, `mostra results` and the\n * submissions port carry. Everything in it comes from the immutable submission and the version it\n * names, never from the live draft (IN-06).\n */\nexport interface Results {\n /** The artifact, with the metadata of the version the viewer saw. */\n readonly artifact: {\n readonly id: string;\n readonly title: string;\n readonly description?: string;\n readonly family?: string;\n readonly links: readonly ArtifactLink[];\n };\n /** The submission's facts: when, how, by whom, from which version and view, and its delivery. */\n readonly submission: {\n readonly id: string;\n readonly at: string;\n readonly epoch: number;\n /** The same viewer's previous submission, under `epochs` (D103). */\n readonly previous?: string;\n readonly policy: SubmissionPolicy;\n readonly channel: SubmitChannel;\n readonly viewer: Viewer;\n readonly versionId: string;\n readonly version: number;\n readonly viewId: string;\n /** Whether a newer version existed when the viewer submitted (H-10). */\n readonly staleView: boolean;\n /** The newest version's number at the time, when the view was stale. */\n readonly latestVersion?: number;\n readonly draftRevision: DocumentRevision;\n readonly stateRevision?: DocumentRevision;\n readonly digest: string;\n readonly delivery: DeliveryState;\n readonly deliveries: readonly DeliveryStatus[];\n };\n /** The draft's fields by ID, dotted IDs nested (D52). */\n readonly answers: Readonly<Record<string, unknown>>;\n /** Every field in `answers` and `state`, with its label and scope. */\n readonly fields: readonly {\n readonly id: string;\n readonly label?: string;\n readonly required?: boolean;\n readonly sensitive?: boolean;\n readonly scope: FieldScope;\n }[];\n /** Artifact state at `stateRevision`, dotted IDs nested (D63). */\n readonly state?: Readonly<Record<string, unknown>>;\n /** The review sets' choices: the fields `review.<set>.choice` (D65). */\n readonly choices: readonly {\n readonly reviewSetId: string;\n readonly candidateId: string;\n readonly label?: string;\n }[];\n /** Comment threads with their anchors and crops (WP-20). */\n readonly comments: readonly ResultComment[];\n /** Answers a newer version couldn't map (D42). */\n readonly orphaned: readonly {\n readonly id: string;\n readonly label?: string;\n readonly value: unknown;\n readonly fromVersion: number;\n }[];\n /** Action runs started in this view (WP-08). */\n readonly actions: readonly {\n readonly runId: string;\n readonly action: string;\n readonly status: string;\n readonly at: string;\n }[];\n /** Signals raised in this view before the submission: the newest 100, within 1 MiB of payloads. */\n readonly signals: readonly {\n readonly name: string;\n readonly at: string;\n readonly payload?: unknown;\n }[];\n /** How many older signals of the view the limit left out; absent when none. */\n readonly signalsOmitted?: number;\n /** Set when compaction removed events of this view before it submitted, so signals may be missing. */\n readonly signalsCompacted?: true;\n}\n\nconst RectSchema = z.object({\n x: z.number(),\n y: z.number(),\n width: z.number(),\n height: z.number(),\n});\n\n/** The Zod schema of the `ResultComment` type. */\nexport const ResultComment: z.ZodType<ResultComment> = z\n .object({\n threadId: z.string(),\n status: z.enum([\"open\", \"resolved\"]),\n messages: z\n .array(z.object({ author: Viewer, at: z.iso.datetime(), text: z.string() }))\n .readonly(),\n anchor: z.object({\n reviewId: z.string().exactOptional(),\n selectors: z.array(z.unknown()).readonly().exactOptional(),\n rect: RectSchema.exactOptional(),\n viewport: z\n .object({ width: z.number(), height: z.number(), dpr: z.number() })\n .exactOptional(),\n page: z.string().exactOptional(),\n candidateId: z.string().exactOptional(),\n terminal: z\n .object({\n rows: z.tuple([z.int(), z.int()]).readonly(),\n cols: z.tuple([z.int(), z.int()]).readonly(),\n t: z.number().exactOptional(),\n })\n .exactOptional(),\n time: z.number().exactOptional(),\n slide: z.object({ index: z.int(), step: z.int() }).exactOptional(),\n }),\n crop: z.object({ path: z.string(), width: z.int(), height: z.int() }),\n })\n .register(wireRegistry, {\n id: \"ResultComment\",\n description: \"One comment thread in results: messages, anchor layers and the screenshot crop.\",\n }) as z.ZodType<ResultComment>;\n\n/** The Zod schema of the `Results` type. */\nexport const Results: z.ZodType<Results> = z\n .object({\n artifact: z.object({\n id: ArtifactId.schema,\n title: z.string(),\n description: z.string().exactOptional(),\n family: z.string().exactOptional(),\n links: z.array(ArtifactLink).readonly(),\n }),\n submission: z.object({\n id: SubmissionId.schema,\n at: z.iso.datetime(),\n epoch: z.int().min(1),\n previous: SubmissionId.schema.exactOptional(),\n policy: SubmissionPolicy,\n channel: z.enum([\"shell\", \"artifact\"]),\n viewer: Viewer,\n versionId: VersionId.schema,\n version: z.int().min(1),\n viewId: ViewId.schema,\n staleView: z.boolean(),\n latestVersion: z.int().min(1).exactOptional(),\n draftRevision: DocumentRevision,\n stateRevision: DocumentRevision.exactOptional(),\n digest: z.string().regex(/^[0-9a-f]{64}$/),\n delivery: z.enum([\"pending\", \"delivered\", \"rejected\", \"undeliverable\"]),\n deliveries: z.array(DeliveryStatus).readonly(),\n }),\n answers: z.record(z.string(), z.unknown()),\n fields: z\n .array(\n z.object({\n id: z.string(),\n label: z.string().exactOptional(),\n required: z.boolean().exactOptional(),\n sensitive: z.boolean().exactOptional(),\n scope: z.enum([\"viewer\", \"artifact\"]),\n }),\n )\n .readonly(),\n state: z.record(z.string(), z.unknown()).exactOptional(),\n choices: z\n .array(\n z.object({\n reviewSetId: z.string(),\n candidateId: z.string(),\n label: z.string().exactOptional(),\n }),\n )\n .readonly(),\n comments: z.array(ResultComment).readonly(),\n orphaned: z\n .array(\n z.object({\n id: z.string(),\n label: z.string().exactOptional(),\n value: z.unknown(),\n fromVersion: z.int().min(1),\n }),\n )\n .readonly(),\n actions: z\n .array(\n z.object({\n runId: z.string(),\n action: z.string(),\n status: z.string(),\n at: z.iso.datetime(),\n }),\n )\n .readonly(),\n signals: z\n .array(\n z.object({ name: z.string(), at: z.iso.datetime(), payload: z.unknown().exactOptional() }),\n )\n .readonly(),\n signalsOmitted: z.int().min(1).exactOptional(),\n signalsCompacted: z.literal(true).exactOptional(),\n })\n .register(wireRegistry, {\n id: \"Results\",\n description:\n \"The complete submission: artifact, submission facts, answers, fields, state, choices, comments, orphans, actions, signals.\",\n }) as z.ZodType<Results>;\n"],"mappings":";;;;;;;;;;;;;AA2CA,MAAa,SAA4B,EACtC,OAAO;CACN,IAAI,SAAS;CACb,MAAM,EAAE,KAAK;EAAC;EAAS;EAAW;EAAS;CAAM,CAAC;CAClD,MAAM,EAAE,OAAO,CAAC,CAAC,cAAc;CAC/B,KAAK,EAAE,OAAO,CAAC,CAAC,cAAc;AAChC,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aAAa;AACf,CAAC;;AAcH,MAAa,aAAoC,EAC9C,OAAO;CACN,KAAK,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG;CAC9B,MAAM,EA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AAC,cAAc;CAC7C,kBAAkB,EAAE,QAAQ,IAAI,CAAC,CAAC,cAAc;AAClD,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
//#region src/manifest.d.ts
|
|
3
|
+
/** The families Mostra's templates and gallery know; any other string is allowed too. */
|
|
4
|
+
export type ArtifactFamily = "questionnaire" | "proposal" | "prototype" | "review" | "dashboard" | "deck" | "demo" | "inbox" | "tasks" | (string & {});
|
|
5
|
+
/** A related artifact (PRODUCT J6): a later round, a follow-up, a replacement. */
|
|
6
|
+
export interface ArtifactLink {
|
|
7
|
+
/** How this artifact relates to the other one. */
|
|
8
|
+
readonly rel: "round-of" | "follows" | "replaces" | (string & {});
|
|
9
|
+
/** The other artifact's ID. */
|
|
10
|
+
readonly artifact: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The submission policy an artifact requests (D10, D39, D63). The host decides the policy in force;
|
|
14
|
+
* the manifest only asks for one.
|
|
15
|
+
*/
|
|
16
|
+
export type SubmissionPolicy = {
|
|
17
|
+
readonly policy: "once";
|
|
18
|
+
readonly scope?: "per-artifact" | "per-viewer";
|
|
19
|
+
} | {
|
|
20
|
+
readonly policy: "epochs";
|
|
21
|
+
} | {
|
|
22
|
+
readonly policy: "none";
|
|
23
|
+
};
|
|
24
|
+
/** A live terminal session the artifact declares (ROUND-3 §5.1, D65). */
|
|
25
|
+
export interface TerminalSpec {
|
|
26
|
+
/** The program and its arguments. */
|
|
27
|
+
readonly command: readonly string[];
|
|
28
|
+
/** Its working directory, relative to the artifact's source. */
|
|
29
|
+
readonly cwd?: string;
|
|
30
|
+
/** Extra environment variables. */
|
|
31
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
32
|
+
/** The terminal's width in cells. */
|
|
33
|
+
readonly cols?: number;
|
|
34
|
+
/** The terminal's height in cells. */
|
|
35
|
+
readonly rows?: number;
|
|
36
|
+
/** Whether viewers may type into it. Sessions are read-only by default. */
|
|
37
|
+
readonly input?: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** A web demo the artifact declares (ROUND-3 §5.4, TM-08): a command to run, or a port to attach to. */
|
|
40
|
+
export type DemoSpec = {
|
|
41
|
+
readonly command: readonly string[];
|
|
42
|
+
readonly cwd?: string;
|
|
43
|
+
readonly ready?: string;
|
|
44
|
+
readonly bridge?: boolean;
|
|
45
|
+
} | {
|
|
46
|
+
readonly attach: number;
|
|
47
|
+
readonly bridge?: boolean;
|
|
48
|
+
};
|
|
49
|
+
/** The artifact manifest (INTERFACES §2.2). Every field except `title` is optional. */
|
|
50
|
+
export interface ArtifactManifest {
|
|
51
|
+
/** The artifact's ID. Written by `mostra new`; without one, the artifact is bound to its source path at first publish (D51). */
|
|
52
|
+
readonly id?: string;
|
|
53
|
+
/** The title people see. */
|
|
54
|
+
readonly title: string;
|
|
55
|
+
/** One or two sentences on what the artifact is for. */
|
|
56
|
+
readonly description?: string;
|
|
57
|
+
/** What kind of artifact it is; templates and the gallery group by it. */
|
|
58
|
+
readonly family?: ArtifactFamily;
|
|
59
|
+
/** Related artifacts. */
|
|
60
|
+
readonly links?: readonly ArtifactLink[];
|
|
61
|
+
/** How the artifact is built and served: `spa`, the default and the only mode in v1 (D19). */
|
|
62
|
+
readonly mode?: "spa";
|
|
63
|
+
/** The submission policy the artifact requests; the host decides (D39, D63). */
|
|
64
|
+
readonly submission?: SubmissionPolicy;
|
|
65
|
+
/** The kit's shadcn base (default `base`, D72) and theme. */
|
|
66
|
+
readonly kit?: {
|
|
67
|
+
readonly base?: "base" | "radix";
|
|
68
|
+
readonly theme?: string;
|
|
69
|
+
};
|
|
70
|
+
/** Live terminal sessions by name (D65). */
|
|
71
|
+
readonly terminals?: Readonly<Record<string, TerminalSpec>>;
|
|
72
|
+
/** Web demos by name (D65). */
|
|
73
|
+
readonly demos?: Readonly<Record<string, DemoSpec>>;
|
|
74
|
+
/** Stability limits for the artifact's worker (D62). */
|
|
75
|
+
readonly limits?: {
|
|
76
|
+
readonly heapMb?: number;
|
|
77
|
+
readonly watchdogMs?: number;
|
|
78
|
+
readonly idleMinutes?: number;
|
|
79
|
+
};
|
|
80
|
+
/** `verify` settings (D65). */
|
|
81
|
+
readonly verify?: {
|
|
82
|
+
readonly viewports?: readonly string[];
|
|
83
|
+
readonly frames?: readonly string[];
|
|
84
|
+
readonly extraChecks?: readonly string[];
|
|
85
|
+
readonly smoke?: boolean;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */
|
|
89
|
+
export declare const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[];
|
|
90
|
+
/** The Zod schema of the `ArtifactLink` type. */
|
|
91
|
+
export declare const ArtifactLink: z.ZodType<ArtifactLink>;
|
|
92
|
+
/** The Zod schema of the `SubmissionPolicy` type. */
|
|
93
|
+
export declare const SubmissionPolicy: z.ZodType<SubmissionPolicy>;
|
|
94
|
+
/** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */
|
|
95
|
+
export declare const ArtifactManifest: z.ZodType<ArtifactManifest>;
|
|
96
|
+
//#endregion
|
|
97
|
+
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","names":[],"sources":["../src/manifest.ts"],"mappings":";;;YAeY;;iBAaK;;WAEN;;WAEA;;;;;;YAOC;WACG;WAAyB;;WACzB;;WACA;;;iBAGE;;WAEN;;WAEA;;WAEA,MAAM,SAAS;;WAEf;;WAEA;;WAEA;;;YAIC;WAEG;WACA;WACA;WACA;;WAEA;WAAyB;;;iBAGvB;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;WAET,iBAAiB;;WAEjB;;WAEA,aAAa;;WAEb;aAAiB;aAAkC;;;WAEnD,YAAY,SAAS,eAAe;;WAEpC,QAAQ,SAAS,eAAe;;WAEhC;aACE;aACA;aACA;;;WAGF;aACE;aACA;aACA;aACA;;;;qBAKA,wCAAwC;;qBAkBxC,cAAc,EAAE,QAAQ;;qBAQxB,kBAAkB,EAAE,QAAQ;;qBAkC5B,kBAAkB,EAAE,QAAQ"}
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { wireRegistry } from "./wire-registry.js";
|
|
2
|
+
import { ArtifactId } from "./ids.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/manifest.ts
|
|
5
|
+
/**
|
|
6
|
+
* The artifact manifest (INTERFACES §2.2, D51): the metadata an artifact declares in its entry, as
|
|
7
|
+
* `export const artifact = defineArtifact({...})` in TSX or as YAML frontmatter in MDX. Mostra reads
|
|
8
|
+
* it statically, so every value is a literal. The same type checks `defineArtifact` for authors,
|
|
9
|
+
* validates the extracted literal in the supervisor and travels on the wire in `artifact/get`.
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const checked = ArtifactManifest.safeParse(extracted);
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
/** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */
|
|
16
|
+
const ARTIFACT_MANIFEST_KEYS = [
|
|
17
|
+
"id",
|
|
18
|
+
"title",
|
|
19
|
+
"description",
|
|
20
|
+
"family",
|
|
21
|
+
"links",
|
|
22
|
+
"mode",
|
|
23
|
+
"submission",
|
|
24
|
+
"kit",
|
|
25
|
+
"terminals",
|
|
26
|
+
"demos",
|
|
27
|
+
"limits",
|
|
28
|
+
"verify"
|
|
29
|
+
];
|
|
30
|
+
const strings = z.array(z.string()).readonly();
|
|
31
|
+
/** The Zod schema of the `ArtifactLink` type. */
|
|
32
|
+
const ArtifactLink = z.object({
|
|
33
|
+
rel: z.string().min(1),
|
|
34
|
+
artifact: z.string().min(1)
|
|
35
|
+
}).register(wireRegistry, {
|
|
36
|
+
id: "ArtifactLink",
|
|
37
|
+
description: "A related artifact: how this one relates (rel) and the other artifact's ID."
|
|
38
|
+
});
|
|
39
|
+
/** The Zod schema of the `SubmissionPolicy` type. */
|
|
40
|
+
const SubmissionPolicy = z.discriminatedUnion("policy", [
|
|
41
|
+
z.object({
|
|
42
|
+
policy: z.literal("once"),
|
|
43
|
+
scope: z.enum(["per-artifact", "per-viewer"]).exactOptional()
|
|
44
|
+
}),
|
|
45
|
+
z.object({ policy: z.literal("epochs") }),
|
|
46
|
+
z.object({ policy: z.literal("none") })
|
|
47
|
+
]).register(wireRegistry, {
|
|
48
|
+
id: "SubmissionPolicy",
|
|
49
|
+
description: "A submission policy: once (per-artifact or per-viewer), epochs, or none."
|
|
50
|
+
});
|
|
51
|
+
const TerminalSpec = z.object({
|
|
52
|
+
command: z.array(z.string()).min(1).readonly(),
|
|
53
|
+
cwd: z.string().exactOptional(),
|
|
54
|
+
env: z.record(z.string(), z.string()).readonly().exactOptional(),
|
|
55
|
+
cols: z.int().min(1).exactOptional(),
|
|
56
|
+
rows: z.int().min(1).exactOptional(),
|
|
57
|
+
input: z.boolean().exactOptional()
|
|
58
|
+
});
|
|
59
|
+
const DemoSpec = z.union([z.object({
|
|
60
|
+
command: z.array(z.string()).min(1).readonly(),
|
|
61
|
+
cwd: z.string().exactOptional(),
|
|
62
|
+
ready: z.string().exactOptional(),
|
|
63
|
+
bridge: z.boolean().exactOptional()
|
|
64
|
+
}), z.object({
|
|
65
|
+
attach: z.int().min(1).max(65535),
|
|
66
|
+
bridge: z.boolean().exactOptional()
|
|
67
|
+
})]);
|
|
68
|
+
/** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */
|
|
69
|
+
const ArtifactManifest = z.object({
|
|
70
|
+
id: ArtifactId.schema.exactOptional(),
|
|
71
|
+
title: z.string().min(1),
|
|
72
|
+
description: z.string().exactOptional(),
|
|
73
|
+
family: z.string().min(1).exactOptional(),
|
|
74
|
+
links: z.array(ArtifactLink).readonly().exactOptional(),
|
|
75
|
+
mode: z.literal("spa").exactOptional(),
|
|
76
|
+
submission: SubmissionPolicy.exactOptional(),
|
|
77
|
+
kit: z.object({
|
|
78
|
+
base: z.enum(["base", "radix"]).exactOptional(),
|
|
79
|
+
theme: z.string().exactOptional()
|
|
80
|
+
}).exactOptional(),
|
|
81
|
+
terminals: z.record(z.string(), TerminalSpec).readonly().exactOptional(),
|
|
82
|
+
demos: z.record(z.string(), DemoSpec).readonly().exactOptional(),
|
|
83
|
+
limits: z.object({
|
|
84
|
+
heapMb: z.int().min(1).exactOptional(),
|
|
85
|
+
watchdogMs: z.int().min(1).exactOptional(),
|
|
86
|
+
idleMinutes: z.number().min(0).exactOptional()
|
|
87
|
+
}).exactOptional(),
|
|
88
|
+
verify: z.object({
|
|
89
|
+
viewports: strings.exactOptional(),
|
|
90
|
+
frames: strings.exactOptional(),
|
|
91
|
+
extraChecks: strings.exactOptional(),
|
|
92
|
+
smoke: z.boolean().exactOptional()
|
|
93
|
+
}).exactOptional()
|
|
94
|
+
}).register(wireRegistry, {
|
|
95
|
+
id: "ArtifactManifest",
|
|
96
|
+
description: "The artifact manifest (INTERFACES §2.2): literal metadata from the entry's defineArtifact call or MDX frontmatter."
|
|
97
|
+
});
|
|
98
|
+
//#endregion
|
|
99
|
+
export { ARTIFACT_MANIFEST_KEYS, ArtifactLink, ArtifactManifest, SubmissionPolicy };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","names":[],"sources":["../src/manifest.ts"],"sourcesContent":["/**\n * The artifact manifest (INTERFACES §2.2, D51): the metadata an artifact declares in its entry, as\n * `export const artifact = defineArtifact({...})` in TSX or as YAML frontmatter in MDX. Mostra reads\n * it statically, so every value is a literal. The same type checks `defineArtifact` for authors,\n * validates the extracted literal in the supervisor and travels on the wire in `artifact/get`.\n *\n * ```ts\n * const checked = ArtifactManifest.safeParse(extracted);\n * ```\n */\nimport * as z from \"zod\";\nimport { ArtifactId } from \"./ids.ts\";\nimport { wireRegistry } from \"./wire-registry.ts\";\n\n/** The families Mostra's templates and gallery know; any other string is allowed too. */\nexport type ArtifactFamily =\n | \"questionnaire\"\n | \"proposal\"\n | \"prototype\"\n | \"review\"\n | \"dashboard\"\n | \"deck\"\n | \"demo\"\n | \"inbox\"\n | \"tasks\"\n | (string & {});\n\n/** A related artifact (PRODUCT J6): a later round, a follow-up, a replacement. */\nexport interface ArtifactLink {\n /** How this artifact relates to the other one. */\n readonly rel: \"round-of\" | \"follows\" | \"replaces\" | (string & {});\n /** The other artifact's ID. */\n readonly artifact: string;\n}\n\n/**\n * The submission policy an artifact requests (D10, D39, D63). The host decides the policy in force;\n * the manifest only asks for one.\n */\nexport type SubmissionPolicy =\n | { readonly policy: \"once\"; readonly scope?: \"per-artifact\" | \"per-viewer\" }\n | { readonly policy: \"epochs\" }\n | { readonly policy: \"none\" };\n\n/** A live terminal session the artifact declares (ROUND-3 §5.1, D65). */\nexport interface TerminalSpec {\n /** The program and its arguments. */\n readonly command: readonly string[];\n /** Its working directory, relative to the artifact's source. */\n readonly cwd?: string;\n /** Extra environment variables. */\n readonly env?: Readonly<Record<string, string>>;\n /** The terminal's width in cells. */\n readonly cols?: number;\n /** The terminal's height in cells. */\n readonly rows?: number;\n /** Whether viewers may type into it. Sessions are read-only by default. */\n readonly input?: boolean;\n}\n\n/** A web demo the artifact declares (ROUND-3 §5.4, TM-08): a command to run, or a port to attach to. */\nexport type DemoSpec =\n | {\n readonly command: readonly string[];\n readonly cwd?: string;\n readonly ready?: string;\n readonly bridge?: boolean;\n }\n | { readonly attach: number; readonly bridge?: boolean };\n\n/** The artifact manifest (INTERFACES §2.2). Every field except `title` is optional. */\nexport interface ArtifactManifest {\n /** The artifact's ID. Written by `mostra new`; without one, the artifact is bound to its source path at first publish (D51). */\n readonly id?: string;\n /** The title people see. */\n readonly title: string;\n /** One or two sentences on what the artifact is for. */\n readonly description?: string;\n /** What kind of artifact it is; templates and the gallery group by it. */\n readonly family?: ArtifactFamily;\n /** Related artifacts. */\n readonly links?: readonly ArtifactLink[];\n /** How the artifact is built and served: `spa`, the default and the only mode in v1 (D19). */\n readonly mode?: \"spa\";\n /** The submission policy the artifact requests; the host decides (D39, D63). */\n readonly submission?: SubmissionPolicy;\n /** The kit's shadcn base (default `base`, D72) and theme. */\n readonly kit?: { readonly base?: \"base\" | \"radix\"; readonly theme?: string };\n /** Live terminal sessions by name (D65). */\n readonly terminals?: Readonly<Record<string, TerminalSpec>>;\n /** Web demos by name (D65). */\n readonly demos?: Readonly<Record<string, DemoSpec>>;\n /** Stability limits for the artifact's worker (D62). */\n readonly limits?: {\n readonly heapMb?: number;\n readonly watchdogMs?: number;\n readonly idleMinutes?: number;\n };\n /** `verify` settings (D65). */\n readonly verify?: {\n readonly viewports?: readonly string[];\n readonly frames?: readonly string[];\n readonly extraChecks?: readonly string[];\n readonly smoke?: boolean;\n };\n}\n\n/** The keys of the artifact manifest, in INTERFACES §2.2 order. Other keys are warnings (FAILURE_MODEL §10). */\nexport const ARTIFACT_MANIFEST_KEYS: readonly (keyof ArtifactManifest)[] = [\n \"id\",\n \"title\",\n \"description\",\n \"family\",\n \"links\",\n \"mode\",\n \"submission\",\n \"kit\",\n \"terminals\",\n \"demos\",\n \"limits\",\n \"verify\",\n];\n\nconst strings = z.array(z.string()).readonly();\n\n/** The Zod schema of the `ArtifactLink` type. */\nexport const ArtifactLink: z.ZodType<ArtifactLink> = z\n .object({ rel: z.string().min(1), artifact: z.string().min(1) })\n .register(wireRegistry, {\n id: \"ArtifactLink\",\n description: \"A related artifact: how this one relates (rel) and the other artifact's ID.\",\n });\n\n/** The Zod schema of the `SubmissionPolicy` type. */\nexport const SubmissionPolicy: z.ZodType<SubmissionPolicy> = z\n .discriminatedUnion(\"policy\", [\n z.object({\n policy: z.literal(\"once\"),\n scope: z.enum([\"per-artifact\", \"per-viewer\"]).exactOptional(),\n }),\n z.object({ policy: z.literal(\"epochs\") }),\n z.object({ policy: z.literal(\"none\") }),\n ])\n .register(wireRegistry, {\n id: \"SubmissionPolicy\",\n description: \"A submission policy: once (per-artifact or per-viewer), epochs, or none.\",\n });\n\nconst TerminalSpec: z.ZodType<TerminalSpec> = z.object({\n command: z.array(z.string()).min(1).readonly(),\n cwd: z.string().exactOptional(),\n env: z.record(z.string(), z.string()).readonly().exactOptional(),\n cols: z.int().min(1).exactOptional(),\n rows: z.int().min(1).exactOptional(),\n input: z.boolean().exactOptional(),\n});\n\nconst DemoSpec: z.ZodType<DemoSpec> = z.union([\n z.object({\n command: z.array(z.string()).min(1).readonly(),\n cwd: z.string().exactOptional(),\n ready: z.string().exactOptional(),\n bridge: z.boolean().exactOptional(),\n }),\n z.object({ attach: z.int().min(1).max(65535), bridge: z.boolean().exactOptional() }),\n]);\n\n/** The Zod schema of the `ArtifactManifest` type. Objects stay open, so newer keys pass through. */\nexport const ArtifactManifest: z.ZodType<ArtifactManifest> = z\n .object({\n id: ArtifactId.schema.exactOptional(),\n title: z.string().min(1),\n description: z.string().exactOptional(),\n family: z.string().min(1).exactOptional(),\n links: z.array(ArtifactLink).readonly().exactOptional(),\n mode: z.literal(\"spa\").exactOptional(),\n submission: SubmissionPolicy.exactOptional(),\n kit: z\n .object({\n base: z.enum([\"base\", \"radix\"]).exactOptional(),\n theme: z.string().exactOptional(),\n })\n .exactOptional(),\n terminals: z.record(z.string(), TerminalSpec).readonly().exactOptional(),\n demos: z.record(z.string(), DemoSpec).readonly().exactOptional(),\n limits: z\n .object({\n heapMb: z.int().min(1).exactOptional(),\n watchdogMs: z.int().min(1).exactOptional(),\n idleMinutes: z.number().min(0).exactOptional(),\n })\n .exactOptional(),\n verify: z\n .object({\n viewports: strings.exactOptional(),\n frames: strings.exactOptional(),\n extraChecks: strings.exactOptional(),\n smoke: z.boolean().exactOptional(),\n })\n .exactOptional(),\n })\n .register(wireRegistry, {\n id: \"ArtifactManifest\",\n description:\n \"The artifact manifest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C,cAAc;EACrC,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;EACzC,aAAa,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc;CAC/C,CAAC,CAAC,CACD,cAAc;CACjB,QAAQ,EACL,OAAO;EACN,WAAW,QAAQ,cAAc;EACjC,QAAQ,QAAQ,cAAc;EAC9B,aAAa,QAAQ,cAAc;EACnC,OAAO,EAAE,QAAQ,CAAC,CAAC,cAAc;CACnC,CAAC,CAAC,CACD,cAAc;AACnB,CAAC,CAAC,CACD,SAAS,cAAc;CACtB,IAAI;CACJ,aACE;AACJ,CAAC"}
|
package/dist/method.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
//#region src/method.d.ts
|
|
3
|
+
/** Who sends the request: a client to the instance, or the instance to a registering host (ports). */
|
|
4
|
+
export type MethodDirection = "client-to-instance" | "instance-to-host";
|
|
5
|
+
/** One protocol method. */
|
|
6
|
+
export interface MethodDefinition<Params, Result> {
|
|
7
|
+
/** The JSON-RPC method name: `group/name` (`artifact/publish`) or a bare name (`wait`). */
|
|
8
|
+
readonly method: string;
|
|
9
|
+
/** Who sends the request. */
|
|
10
|
+
readonly direction: MethodDirection;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the method changes durable state. Mutating methods take an optional `requestId`, and a
|
|
13
|
+
* retry with the same ID returns the recorded result (H-03).
|
|
14
|
+
*/
|
|
15
|
+
readonly mutating: boolean;
|
|
16
|
+
/** The schema of the request's `params`. */
|
|
17
|
+
readonly params: z.ZodType<Params>;
|
|
18
|
+
/** The schema of a successful response's `result`. */
|
|
19
|
+
readonly result: z.ZodType<Result>;
|
|
20
|
+
}
|
|
21
|
+
/** A method of any params and result type. */
|
|
22
|
+
export type AnyMethod = MethodDefinition<unknown, unknown>;
|
|
23
|
+
/** Defines a protocol method, checking its name has the `group/name` (or bare `name`) form. */
|
|
24
|
+
export declare function defineMethod<Params, Result>(definition: MethodDefinition<Params, Result>): MethodDefinition<Params, Result>;
|
|
25
|
+
//#endregion
|
|
26
|
+
//# sourceMappingURL=method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"method.d.ts","names":[],"sources":["../src/method.ts"],"mappings":";;;YASY;;iBAGK,iBAAiB,QAAQ;;WAE/B;;WAEA,WAAW;;;;;WAKX;;WAEA,QAAQ,EAAE,QAAQ;;WAElB,QAAQ,EAAE,QAAQ;;;YAIjB,YAAY;;wBAGR,aAAa,QAAQ,QACnC,YAAY,iBAAiB,QAAQ,UACpC,iBAAiB,QAAQ"}
|
package/dist/method.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/method.ts
|
|
2
|
+
/** Defines a protocol method, checking its name has the `group/name` (or bare `name`) form. */
|
|
3
|
+
function defineMethod(definition) {
|
|
4
|
+
if (!/^([a-z][a-zA-Z]*\/)?[a-z][a-zA-Z.]*$/.test(definition.method)) throw new Error(`Protocol method names have the form group/name or name, got "${definition.method}".`);
|
|
5
|
+
return definition;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { defineMethod };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=method.js.map
|