@mostra/protocol 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +38 -2
- package/dist/actions.d.ts +273 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +154 -0
- package/dist/actions.js.map +1 -0
- package/dist/artifact.d.ts +113 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +79 -0
- package/dist/artifact.js.map +1 -0
- package/dist/bridge.d.ts +295 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +343 -0
- package/dist/bridge.js.map +1 -0
- package/dist/browser.d.ts +195 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +156 -0
- package/dist/browser.js.map +1 -0
- package/dist/bundle.d.ts +155 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +130 -0
- package/dist/bundle.js.map +1 -0
- package/dist/canonical.d.ts +23 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +45 -0
- package/dist/canonical.js.map +1 -0
- package/dist/capability.d.ts +38 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +61 -0
- package/dist/capability.js.map +1 -0
- package/dist/diagnostics/codes/a11y.d.ts +8 -0
- package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
- package/dist/diagnostics/codes/a11y.js +30 -0
- package/dist/diagnostics/codes/a11y.js.map +1 -0
- package/dist/diagnostics/codes/action.d.ts +8 -0
- package/dist/diagnostics/codes/action.d.ts.map +1 -0
- package/dist/diagnostics/codes/action.js +110 -0
- package/dist/diagnostics/codes/action.js.map +1 -0
- package/dist/diagnostics/codes/artifact.d.ts +8 -0
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
- package/dist/diagnostics/codes/artifact.js +121 -0
- package/dist/diagnostics/codes/artifact.js.map +1 -0
- package/dist/diagnostics/codes/build.d.ts +8 -0
- package/dist/diagnostics/codes/build.d.ts.map +1 -0
- package/dist/diagnostics/codes/build.js +55 -0
- package/dist/diagnostics/codes/build.js.map +1 -0
- package/dist/diagnostics/codes/cli.d.ts +8 -0
- package/dist/diagnostics/codes/cli.d.ts.map +1 -0
- package/dist/diagnostics/codes/cli.js +44 -0
- package/dist/diagnostics/codes/cli.js.map +1 -0
- package/dist/diagnostics/codes/console.d.ts +8 -0
- package/dist/diagnostics/codes/console.d.ts.map +1 -0
- package/dist/diagnostics/codes/console.js +30 -0
- package/dist/diagnostics/codes/console.js.map +1 -0
- package/dist/diagnostics/codes/dep.d.ts +8 -0
- package/dist/diagnostics/codes/dep.d.ts.map +1 -0
- package/dist/diagnostics/codes/dep.js +88 -0
- package/dist/diagnostics/codes/dep.js.map +1 -0
- package/dist/diagnostics/codes/env.d.ts +8 -0
- package/dist/diagnostics/codes/env.d.ts.map +1 -0
- package/dist/diagnostics/codes/env.js +132 -0
- package/dist/diagnostics/codes/env.js.map +1 -0
- package/dist/diagnostics/codes/field.d.ts +8 -0
- package/dist/diagnostics/codes/field.d.ts.map +1 -0
- package/dist/diagnostics/codes/field.js +99 -0
- package/dist/diagnostics/codes/field.js.map +1 -0
- package/dist/diagnostics/codes/home.d.ts +8 -0
- package/dist/diagnostics/codes/home.d.ts.map +1 -0
- package/dist/diagnostics/codes/home.js +132 -0
- package/dist/diagnostics/codes/home.js.map +1 -0
- package/dist/diagnostics/codes/host.d.ts +8 -0
- package/dist/diagnostics/codes/host.d.ts.map +1 -0
- package/dist/diagnostics/codes/host.js +187 -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 +87 -0
- package/dist/index.js +87 -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 +38 -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 +8 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +96 -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/identity-resolve.d.ts +36 -0
- package/dist/methods/port/identity-resolve.d.ts.map +1 -0
- package/dist/methods/port/identity-resolve.js +35 -0
- package/dist/methods/port/identity-resolve.js.map +1 -0
- package/dist/methods/port/secrets-get.d.ts +19 -0
- package/dist/methods/port/secrets-get.d.ts.map +1 -0
- package/dist/methods/port/secrets-get.js +31 -0
- package/dist/methods/port/secrets-get.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +38 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
- package/dist/methods/port/submissions-deliver.js +38 -0
- package/dist/methods/port/submissions-deliver.js.map +1 -0
- package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
- package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-activated.js +33 -0
- package/dist/methods/port/trusted-controls-activated.js.map +1 -0
- package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
- package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-policy.js +27 -0
- package/dist/methods/port/trusted-controls-policy.js.map +1 -0
- package/dist/methods/results/get.d.ts +32 -0
- package/dist/methods/results/get.d.ts.map +1 -0
- package/dist/methods/results/get.js +36 -0
- package/dist/methods/results/get.js.map +1 -0
- package/dist/methods/secret/delete.d.ts +22 -0
- package/dist/methods/secret/delete.d.ts.map +1 -0
- package/dist/methods/secret/delete.js +32 -0
- package/dist/methods/secret/delete.js.map +1 -0
- package/dist/methods/secret/list.d.ts +21 -0
- package/dist/methods/secret/list.d.ts.map +1 -0
- package/dist/methods/secret/list.js +29 -0
- package/dist/methods/secret/list.js.map +1 -0
- package/dist/methods/secret/set.d.ts +37 -0
- package/dist/methods/secret/set.d.ts.map +1 -0
- package/dist/methods/secret/set.js +41 -0
- package/dist/methods/secret/set.js.map +1 -0
- package/dist/methods/state/get.d.ts +25 -0
- package/dist/methods/state/get.d.ts.map +1 -0
- package/dist/methods/state/get.js +29 -0
- package/dist/methods/state/get.js.map +1 -0
- package/dist/methods/state/patch.d.ts +32 -0
- package/dist/methods/state/patch.d.ts.map +1 -0
- package/dist/methods/state/patch.js +29 -0
- package/dist/methods/state/patch.js.map +1 -0
- package/dist/methods/view/default.d.ts +19 -0
- package/dist/methods/view/default.d.ts.map +1 -0
- package/dist/methods/view/default.js +23 -0
- package/dist/methods/view/default.js.map +1 -0
- package/dist/methods/view/launch.d.ts +27 -0
- package/dist/methods/view/launch.d.ts.map +1 -0
- package/dist/methods/view/launch.js +30 -0
- package/dist/methods/view/launch.js.map +1 -0
- package/dist/methods/view/revoke.d.ts +19 -0
- package/dist/methods/view/revoke.d.ts.map +1 -0
- package/dist/methods/view/revoke.js +26 -0
- package/dist/methods/view/revoke.js.map +1 -0
- package/dist/methods/view/rotate.d.ts +21 -0
- package/dist/methods/view/rotate.d.ts.map +1 -0
- package/dist/methods/view/rotate.js +27 -0
- package/dist/methods/view/rotate.js.map +1 -0
- package/dist/methods/view/url.d.ts +52 -0
- package/dist/methods/view/url.d.ts.map +1 -0
- package/dist/methods/view/url.js +43 -0
- package/dist/methods/view/url.js.map +1 -0
- package/dist/methods/wait/wait.d.ts +37 -0
- package/dist/methods/wait/wait.d.ts.map +1 -0
- package/dist/methods/wait/wait.js +39 -0
- package/dist/methods/wait/wait.js.map +1 -0
- package/dist/revision.d.ts +43 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +69 -0
- package/dist/revision.js.map +1 -0
- package/dist/rpc/error.d.ts +47 -0
- package/dist/rpc/error.d.ts.map +1 -0
- package/dist/rpc/error.js +77 -0
- package/dist/rpc/error.js.map +1 -0
- package/dist/rpc/lines.d.ts +30 -0
- package/dist/rpc/lines.d.ts.map +1 -0
- package/dist/rpc/lines.js +63 -0
- package/dist/rpc/lines.js.map +1 -0
- package/dist/rpc/messages.d.ts +92 -0
- package/dist/rpc/messages.d.ts.map +1 -0
- package/dist/rpc/messages.js +133 -0
- package/dist/rpc/messages.js.map +1 -0
- package/dist/rpc/peer.d.ts +81 -0
- package/dist/rpc/peer.d.ts.map +1 -0
- package/dist/rpc/peer.js +208 -0
- package/dist/rpc/peer.js.map +1 -0
- package/dist/serializer.d.ts +178 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +929 -0
- package/dist/serializer.js.map +1 -0
- package/dist/verify.d.ts +254 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +243 -0
- package/dist/verify.js.map +1 -0
- package/dist/view.d.ts +103 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +110 -0
- package/dist/view.js.map +1 -0
- package/dist/wire-registry.js +11 -0
- package/dist/wire-registry.js.map +1 -0
- package/dist/worker.d.ts +249 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +158 -0
- package/dist/worker.js.map +1 -0
- package/package.json +114 -3
- package/schemas/protocol.draft-07.json +5533 -0
- package/schemas/protocol.schema.json +5377 -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 +209 -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 +584 -0
- package/src/interaction.ts +728 -0
- package/src/manifest.ts +206 -0
- package/src/method.ts +56 -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 +91 -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/identity-resolve.ts +67 -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,133 @@
|
|
|
1
|
+
import { wireRegistry } from "../wire-registry.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
//#region src/rpc/messages.ts
|
|
4
|
+
/**
|
|
5
|
+
* JSON-RPC 2.0 message shapes (D59, D83). Every Mostra connection carries these: the host protocol
|
|
6
|
+
* over stdio or the home socket, child-process messaging and the shell bridge. Revision
|
|
7
|
+
* `2026-10-10` has no batches.
|
|
8
|
+
*/
|
|
9
|
+
const version = z.literal("2.0");
|
|
10
|
+
const id = z.union([z.string(), z.number()]);
|
|
11
|
+
const params = z.union([z.record(z.string(), z.unknown()), z.array(z.unknown()).readonly()]);
|
|
12
|
+
/** The Zod schema of the `JsonRpcRequest` type. */
|
|
13
|
+
const JsonRpcRequest = z.object({
|
|
14
|
+
jsonrpc: version,
|
|
15
|
+
id,
|
|
16
|
+
method: z.string(),
|
|
17
|
+
params: params.exactOptional()
|
|
18
|
+
}).register(wireRegistry, {
|
|
19
|
+
id: "JsonRpcRequest",
|
|
20
|
+
description: "A JSON-RPC 2.0 request: answered by a response with the same id."
|
|
21
|
+
});
|
|
22
|
+
/** The Zod schema of the `JsonRpcNotification` type. */
|
|
23
|
+
const JsonRpcNotification = z.object({
|
|
24
|
+
jsonrpc: version,
|
|
25
|
+
method: z.string(),
|
|
26
|
+
params: params.exactOptional()
|
|
27
|
+
}).register(wireRegistry, {
|
|
28
|
+
id: "JsonRpcNotification",
|
|
29
|
+
description: "A JSON-RPC 2.0 notification: a request without an id, never answered."
|
|
30
|
+
});
|
|
31
|
+
/** The Zod schema of the `JsonRpcErrorObject` type. */
|
|
32
|
+
const JsonRpcErrorObject = z.object({
|
|
33
|
+
code: z.int(),
|
|
34
|
+
message: z.string(),
|
|
35
|
+
data: z.unknown().exactOptional()
|
|
36
|
+
}).register(wireRegistry, {
|
|
37
|
+
id: "JsonRpcErrorObject",
|
|
38
|
+
description: "The error of a failed JSON-RPC 2.0 response; Mostra puts the diagnostic in data."
|
|
39
|
+
});
|
|
40
|
+
/** The Zod schema of the `JsonRpcSuccess` type. */
|
|
41
|
+
const JsonRpcSuccess = z.object({
|
|
42
|
+
jsonrpc: version,
|
|
43
|
+
id,
|
|
44
|
+
result: z.unknown()
|
|
45
|
+
}).register(wireRegistry, {
|
|
46
|
+
id: "JsonRpcSuccess",
|
|
47
|
+
description: "A successful JSON-RPC 2.0 response."
|
|
48
|
+
});
|
|
49
|
+
/** The Zod schema of the `JsonRpcFailure` type. */
|
|
50
|
+
const JsonRpcFailure = z.object({
|
|
51
|
+
jsonrpc: version,
|
|
52
|
+
id: id.nullable(),
|
|
53
|
+
error: JsonRpcErrorObject
|
|
54
|
+
}).register(wireRegistry, {
|
|
55
|
+
id: "JsonRpcFailure",
|
|
56
|
+
description: "A failed JSON-RPC 2.0 response; id is null when the request's id was unreadable."
|
|
57
|
+
});
|
|
58
|
+
const isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
59
|
+
/**
|
|
60
|
+
* Sorts a parsed JSON value into a request, notification, success or failure, or explains why it
|
|
61
|
+
* is none of them. A JSON array (a batch) is invalid in revision `2026-10-10` (D83).
|
|
62
|
+
*/
|
|
63
|
+
function classifyMessage(value) {
|
|
64
|
+
if (Array.isArray(value)) return {
|
|
65
|
+
kind: "invalid",
|
|
66
|
+
reason: "Batches (JSON arrays) aren't supported in host protocol revision 2026-10-10.",
|
|
67
|
+
id: null
|
|
68
|
+
};
|
|
69
|
+
if (!isObject(value)) return {
|
|
70
|
+
kind: "invalid",
|
|
71
|
+
reason: "A message must be a JSON object.",
|
|
72
|
+
id: null
|
|
73
|
+
};
|
|
74
|
+
const rawId = value["id"];
|
|
75
|
+
const readableId = typeof rawId === "string" || typeof rawId === "number" ? rawId : null;
|
|
76
|
+
if (value["jsonrpc"] !== "2.0") return {
|
|
77
|
+
kind: "invalid",
|
|
78
|
+
reason: "A message must have \"jsonrpc\": \"2.0\".",
|
|
79
|
+
id: readableId
|
|
80
|
+
};
|
|
81
|
+
if ("method" in value) {
|
|
82
|
+
if ("id" in value) {
|
|
83
|
+
const parsed = JsonRpcRequest.safeParse(value);
|
|
84
|
+
return parsed.success ? {
|
|
85
|
+
kind: "request",
|
|
86
|
+
message: parsed.data
|
|
87
|
+
} : {
|
|
88
|
+
kind: "invalid",
|
|
89
|
+
reason: describeRequestProblem(value),
|
|
90
|
+
id: readableId
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const parsed = JsonRpcNotification.safeParse(value);
|
|
94
|
+
return parsed.success ? {
|
|
95
|
+
kind: "notification",
|
|
96
|
+
message: parsed.data
|
|
97
|
+
} : {
|
|
98
|
+
kind: "invalid",
|
|
99
|
+
reason: describeRequestProblem(value),
|
|
100
|
+
id: null
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const hasResult = "result" in value;
|
|
104
|
+
if (hasResult !== "error" in value && "id" in value) {
|
|
105
|
+
if (hasResult) {
|
|
106
|
+
const parsed = JsonRpcSuccess.safeParse(value);
|
|
107
|
+
if (parsed.success) return {
|
|
108
|
+
kind: "success",
|
|
109
|
+
message: parsed.data
|
|
110
|
+
};
|
|
111
|
+
} else {
|
|
112
|
+
const parsed = JsonRpcFailure.safeParse(value);
|
|
113
|
+
if (parsed.success) return {
|
|
114
|
+
kind: "failure",
|
|
115
|
+
message: parsed.data
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
kind: "invalid",
|
|
121
|
+
reason: "A message must be a request (with \"method\") or a response (with \"id\" and exactly one of \"result\" and \"error\").",
|
|
122
|
+
id: readableId
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
function describeRequestProblem(value) {
|
|
126
|
+
if (typeof value["method"] !== "string") return "A request's \"method\" must be a string.";
|
|
127
|
+
if ("id" in value && typeof value["id"] !== "string" && typeof value["id"] !== "number") return "A request's \"id\" must be a string or a number.";
|
|
128
|
+
return "A request's \"params\" must be an object or an array.";
|
|
129
|
+
}
|
|
130
|
+
//#endregion
|
|
131
|
+
export { JsonRpcErrorObject, JsonRpcFailure, JsonRpcNotification, JsonRpcRequest, JsonRpcSuccess, classifyMessage };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.js","names":[],"sources":["../../src/rpc/messages.ts"],"sourcesContent":["/**\n * JSON-RPC 2.0 message shapes (D59, D83). Every Mostra connection carries these: the host protocol\n * over stdio or the home socket, child-process messaging and the shell bridge. Revision\n * `2026-10-10` has no batches.\n */\nimport * as z from \"zod\";\nimport { wireRegistry } from \"../wire-registry.ts\";\n\n/** A request ID: a string or a number, chosen by the sender and echoed in the response. */\nexport type JsonRpcId = string | number;\n\n/** Request params: a JSON object (Mostra always uses objects) or an array. */\nexport type JsonRpcParams = Readonly<Record<string, unknown>> | readonly unknown[];\n\n/** A request: the receiver answers with a response carrying the same `id`. */\nexport interface JsonRpcRequest {\n /** Always `\"2.0\"`. */\n readonly jsonrpc: \"2.0\";\n /** Chosen by the sender; the response carries the same ID. */\n readonly id: JsonRpcId;\n /** The method name, `group/name` or a bare name. */\n readonly method: string;\n /** The method's params. */\n readonly params?: JsonRpcParams;\n}\n\n/** A notification: a request without an `id`, which is never answered. */\nexport interface JsonRpcNotification {\n /** Always `\"2.0\"`. */\n readonly jsonrpc: \"2.0\";\n /** The notification's method name. */\n readonly method: string;\n /** The notification's params. */\n readonly params?: JsonRpcParams;\n}\n\n/** The error member of a failed response. Mostra puts the diagnostic in `data`. */\nexport interface JsonRpcErrorObject {\n /** The JSON-RPC error code (INTERFACES §6). */\n readonly code: number;\n /** A short description; clients switch on `data.code`, never on this text. */\n readonly message: string;\n /** The diagnostic (INTERFACES §13). */\n readonly data?: unknown;\n}\n\n/** A successful response. */\nexport interface JsonRpcSuccess {\n /** Always `\"2.0\"`. */\n readonly jsonrpc: \"2.0\";\n /** The ID of the request this answers. */\n readonly id: JsonRpcId;\n /** The method's result. */\n readonly result: unknown;\n}\n\n/** A failed response. `id` is `null` when the request's ID couldn't be read. */\nexport interface JsonRpcFailure {\n /** Always `\"2.0\"`. */\n readonly jsonrpc: \"2.0\";\n /** The ID of the request this answers, or `null` when it couldn't be read. */\n readonly id: JsonRpcId | null;\n /** What went wrong. */\n readonly error: JsonRpcErrorObject;\n}\n\n/** A response to a request. */\nexport type JsonRpcResponse = JsonRpcSuccess | JsonRpcFailure;\n\n/** Any message on a Mostra connection. */\nexport type JsonRpcMessage = JsonRpcRequest | JsonRpcNotification | JsonRpcResponse;\n\nconst version = z.literal(\"2.0\");\nconst id: z.ZodType<JsonRpcId> = z.union([z.string(), z.number()]);\nconst params: z.ZodType<JsonRpcParams> = z.union([\n z.record(z.string(), z.unknown()),\n z.array(z.unknown()).readonly(),\n]);\n\n/** The Zod schema of the `JsonRpcRequest` type. */\nexport const JsonRpcRequest: z.ZodType<JsonRpcRequest> = z\n .object({ jsonrpc: version, id, method: z.string(), params: params.exactOptional() })\n .register(wireRegistry, {\n id: \"JsonRpcRequest\",\n description: \"A JSON-RPC 2.0 request: answered by a response with the same id.\",\n });\n\n/** The Zod schema of the `JsonRpcNotification` type. */\nexport const JsonRpcNotification: z.ZodType<JsonRpcNotification> = z\n .object({ jsonrpc: version, method: z.string(), params: params.exactOptional() })\n .register(wireRegistry, {\n id: \"JsonRpcNotification\",\n description: \"A JSON-RPC 2.0 notification: a request without an id, never answered.\",\n });\n\n/** The Zod schema of the `JsonRpcErrorObject` type. */\nexport const JsonRpcErrorObject: z.ZodType<JsonRpcErrorObject> = z\n .object({ code: z.int(), message: z.string(), data: z.unknown().exactOptional() })\n .register(wireRegistry, {\n id: \"JsonRpcErrorObject\",\n description: \"The error of a failed JSON-RPC 2.0 response; Mostra puts the diagnostic in data.\",\n });\n\n/** The Zod schema of the `JsonRpcSuccess` type. */\nexport const JsonRpcSuccess: z.ZodType<JsonRpcSuccess> = z\n .object({ jsonrpc: version, id, result: z.unknown() })\n .register(wireRegistry, {\n id: \"JsonRpcSuccess\",\n description: \"A successful JSON-RPC 2.0 response.\",\n });\n\n/** The Zod schema of the `JsonRpcFailure` type. */\nexport const JsonRpcFailure: z.ZodType<JsonRpcFailure> = z\n .object({ jsonrpc: version, id: id.nullable(), error: JsonRpcErrorObject })\n .register(wireRegistry, {\n id: \"JsonRpcFailure\",\n description: \"A failed JSON-RPC 2.0 response; id is null when the request's id was unreadable.\",\n });\n\n/** A message sorted by kind, or the reason it isn't a valid message. */\nexport type ClassifiedMessage =\n | { readonly kind: \"request\"; readonly message: JsonRpcRequest }\n | { readonly kind: \"notification\"; readonly message: JsonRpcNotification }\n | { readonly kind: \"success\"; readonly message: JsonRpcSuccess }\n | { readonly kind: \"failure\"; readonly message: JsonRpcFailure }\n | { readonly kind: \"invalid\"; readonly reason: string; readonly id: JsonRpcId | null };\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null && !Array.isArray(value);\n\n/**\n * Sorts a parsed JSON value into a request, notification, success or failure, or explains why it\n * is none of them. A JSON array (a batch) is invalid in revision `2026-10-10` (D83).\n */\nexport function classifyMessage(value: unknown): ClassifiedMessage {\n if (Array.isArray(value)) {\n return {\n kind: \"invalid\",\n reason: \"Batches (JSON arrays) aren't supported in host protocol revision 2026-10-10.\",\n id: null,\n };\n }\n if (!isObject(value)) {\n return { kind: \"invalid\", reason: \"A message must be a JSON object.\", id: null };\n }\n const rawId = value[\"id\"];\n const readableId = typeof rawId === \"string\" || typeof rawId === \"number\" ? rawId : null;\n if (value[\"jsonrpc\"] !== \"2.0\") {\n return { kind: \"invalid\", reason: 'A message must have \"jsonrpc\": \"2.0\".', id: readableId };\n }\n if (\"method\" in value) {\n if (\"id\" in value) {\n const parsed = JsonRpcRequest.safeParse(value);\n return parsed.success\n ? { kind: \"request\", message: parsed.data }\n : { kind: \"invalid\", reason: describeRequestProblem(value), id: readableId };\n }\n const parsed = JsonRpcNotification.safeParse(value);\n return parsed.success\n ? { kind: \"notification\", message: parsed.data }\n : { kind: \"invalid\", reason: describeRequestProblem(value), id: null };\n }\n const hasResult = \"result\" in value;\n const hasError = \"error\" in value;\n if (hasResult !== hasError && \"id\" in value) {\n if (hasResult) {\n const parsed = JsonRpcSuccess.safeParse(value);\n if (parsed.success) return { kind: \"success\", message: parsed.data };\n } else {\n const parsed = JsonRpcFailure.safeParse(value);\n if (parsed.success) return { kind: \"failure\", message: parsed.data };\n }\n }\n return {\n kind: \"invalid\",\n reason:\n 'A message must be a request (with \"method\") or a response (with \"id\" and exactly one of \"result\" and \"error\").',\n id: readableId,\n };\n}\n\nfunction describeRequestProblem(value: Record<string, unknown>): string {\n if (typeof value[\"method\"] !== \"string\") return 'A request\\'s \"method\" must be a string.';\n if (\"id\" in value && typeof value[\"id\"] !== \"string\" && typeof value[\"id\"] !== \"number\") {\n return 'A request\\'s \"id\" must be a string or a number.';\n }\n return 'A request\\'s \"params\" must be an object or an array.';\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Diagnostic } from "../diagnostics/diagnostic.js";
|
|
2
|
+
import { MethodDefinition } from "../method.js";
|
|
3
|
+
import { JsonRpcId, JsonRpcMessage, JsonRpcParams } from "./messages.js";
|
|
4
|
+
//#region src/rpc/peer.d.ts
|
|
5
|
+
/** What a request handler learns about the request besides its params. */
|
|
6
|
+
export interface RpcRequestContext {
|
|
7
|
+
/** The request's ID. */
|
|
8
|
+
readonly id: JsonRpcId;
|
|
9
|
+
/** The method name. */
|
|
10
|
+
readonly method: string;
|
|
11
|
+
}
|
|
12
|
+
/** Options for {@link RpcPeer}. */
|
|
13
|
+
export interface RpcPeerOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Sends one message. The transport serializes it (`encodeLine` for newline-delimited streams).
|
|
16
|
+
* Throwing means the transport is gone: the peer closes.
|
|
17
|
+
*/
|
|
18
|
+
send(message: JsonRpcMessage): void;
|
|
19
|
+
/**
|
|
20
|
+
* Answers an incoming request. Return the result, or throw an {@link RpcError} to answer with
|
|
21
|
+
* its diagnostic. Any other exception is answered with `MOSTRA_HOST_INTERNAL_ERROR`, without
|
|
22
|
+
* its details, and reported to `onInternalError`. Without a handler, every request is answered
|
|
23
|
+
* with `MOSTRA_HOST_METHOD_UNKNOWN`.
|
|
24
|
+
*/
|
|
25
|
+
onRequest?(method: string, params: unknown, context: RpcRequestContext): unknown;
|
|
26
|
+
/** Receives an incoming notification. Exceptions are reported to `onInternalError`. */
|
|
27
|
+
onNotification?(method: string, params: unknown): void;
|
|
28
|
+
/** Reports an unexpected exception from a handler, for logging. */
|
|
29
|
+
onInternalError?(error: unknown, method: string): void;
|
|
30
|
+
/** The docs base URL for diagnostics the peer creates. Default `DEFAULT_DOCS_BASE`. */
|
|
31
|
+
readonly docsBase?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Options for one outgoing request. */
|
|
34
|
+
export interface RpcRequestOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Gives up after this many milliseconds with `MOSTRA_HOST_TIMEOUT`. A late response is
|
|
37
|
+
* ignored. Default: no timeout (FAILURE_MODEL §9).
|
|
38
|
+
*/
|
|
39
|
+
readonly timeoutMs?: number;
|
|
40
|
+
}
|
|
41
|
+
/** One end of a JSON-RPC 2.0 connection. */
|
|
42
|
+
export declare class RpcPeer {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(options: RpcPeerOptions);
|
|
45
|
+
/** Whether the peer has closed. A closed peer sends nothing and rejects new requests. */
|
|
46
|
+
get closed(): boolean;
|
|
47
|
+
/** How many outgoing requests are waiting for a response. */
|
|
48
|
+
get pendingRequests(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Receives one line of a newline-delimited stream. Blank lines are skipped; a line that isn't
|
|
51
|
+
* JSON is answered with a parse error (-32700).
|
|
52
|
+
*/
|
|
53
|
+
receiveLine(line: string): void;
|
|
54
|
+
/** Receives one parsed message. */
|
|
55
|
+
receive(value: unknown): void;
|
|
56
|
+
/**
|
|
57
|
+
* Sends a request and resolves with its result, or rejects with an {@link RpcError}: the
|
|
58
|
+
* other side's diagnostic, `MOSTRA_HOST_TIMEOUT` or `MOSTRA_HOST_CONNECTION_CLOSED`.
|
|
59
|
+
*/
|
|
60
|
+
request(method: string, params?: JsonRpcParams, options?: RpcRequestOptions): Promise<unknown>;
|
|
61
|
+
/**
|
|
62
|
+
* Calls a protocol method: validates the params before sending and the result on arrival. A
|
|
63
|
+
* result that fails the method's schema rejects with `MOSTRA_HOST_MALFORMED`.
|
|
64
|
+
*/
|
|
65
|
+
call<P, R>(definition: MethodDefinition<P, R>, params: P, options?: RpcRequestOptions): Promise<R>;
|
|
66
|
+
/** Sends a notification. Does nothing once the peer is closed. */
|
|
67
|
+
notify(method: string, params?: JsonRpcParams): void;
|
|
68
|
+
/**
|
|
69
|
+
* Closes the peer: every waiting request rejects with `diagnostic` (by default
|
|
70
|
+
* `MOSTRA_HOST_CONNECTION_CLOSED`), and later messages are ignored. Idempotent.
|
|
71
|
+
*/
|
|
72
|
+
close(diagnostic?: Diagnostic): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates a method's params against its schema and returns the parsed value. Throws an
|
|
76
|
+
* {@link RpcError} with `MOSTRA_HOST_INVALID_PARAMS` naming the first problem; the message
|
|
77
|
+
* describes types and paths, never the values sent.
|
|
78
|
+
*/
|
|
79
|
+
export declare function parseParams<P, R>(definition: MethodDefinition<P, R>, params: unknown, docsBase?: string): P;
|
|
80
|
+
//#endregion
|
|
81
|
+
//# sourceMappingURL=peer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer.d.ts","names":[],"sources":["../../src/rpc/peer.ts"],"mappings":";;;;;iBA0BiB;;WAEN,IAAI;;WAEJ;;;iBAIM;;;;;EAKf,KAAK,SAAS;;;;;;;EAOd,WAAW,gBAAgB,iBAAiB,SAAS;;EAErD,gBAAgB,gBAAgB;;EAEhC,iBAAiB,gBAAgB;;WAExB;;;iBAIM;;;;;WAKN;;;qBAWE;;EAMX,YAAY,SAAS;;MAKjB;;MAKA;;;;;EAQJ,YAAY;;EAkBZ,QAAQ;;;;;EAwCR,QACE,gBACA,SAAS,eACT,UAAS,oBACR;;;;;EA+BH,KAAW,GAAG,GACZ,YAAY,iBAAiB,GAAG,IAChC,QAAQ,GACR,UAAS,oBACR,QAAQ;;EAcX,OAAO,gBAAgB,SAAS;;;;;EAWhC,MAAM,aAAa;;;;;;;wBA4GL,YAAY,GAAG,GAC7B,YAAY,iBAAiB,GAAG,IAChC,iBACA,oBACC"}
|
package/dist/rpc/peer.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { JSON_RPC_ERROR_CODES, RpcError, hostDiagnostic } from "./error.js";
|
|
2
|
+
import { classifyMessage } from "./messages.js";
|
|
3
|
+
//#region src/rpc/peer.ts
|
|
4
|
+
/** One end of a JSON-RPC 2.0 connection. */
|
|
5
|
+
var RpcPeer = class {
|
|
6
|
+
#options;
|
|
7
|
+
#pending = /* @__PURE__ */ new Map();
|
|
8
|
+
#nextId = 1;
|
|
9
|
+
#closed;
|
|
10
|
+
constructor(options) {
|
|
11
|
+
this.#options = options;
|
|
12
|
+
}
|
|
13
|
+
/** Whether the peer has closed. A closed peer sends nothing and rejects new requests. */
|
|
14
|
+
get closed() {
|
|
15
|
+
return this.#closed !== void 0;
|
|
16
|
+
}
|
|
17
|
+
/** How many outgoing requests are waiting for a response. */
|
|
18
|
+
get pendingRequests() {
|
|
19
|
+
return this.#pending.size;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Receives one line of a newline-delimited stream. Blank lines are skipped; a line that isn't
|
|
23
|
+
* JSON is answered with a parse error (-32700).
|
|
24
|
+
*/
|
|
25
|
+
receiveLine(line) {
|
|
26
|
+
if (line.trim() === "") return;
|
|
27
|
+
let value;
|
|
28
|
+
try {
|
|
29
|
+
value = JSON.parse(line);
|
|
30
|
+
} catch {
|
|
31
|
+
this.#reply(null, { rpc: new RpcError(this.#diagnostic("MOSTRA_HOST_MALFORMED", "A line wasn't valid JSON."), JSON_RPC_ERROR_CODES.parseError) });
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
this.receive(value);
|
|
35
|
+
}
|
|
36
|
+
/** Receives one parsed message. */
|
|
37
|
+
receive(value) {
|
|
38
|
+
if (this.#closed) return;
|
|
39
|
+
const classified = classifyMessage(value);
|
|
40
|
+
switch (classified.kind) {
|
|
41
|
+
case "request":
|
|
42
|
+
this.#handleRequest(classified.message.id, classified.message.method, classified.message.params);
|
|
43
|
+
return;
|
|
44
|
+
case "notification":
|
|
45
|
+
this.#handleNotification(classified.message.method, classified.message.params);
|
|
46
|
+
return;
|
|
47
|
+
case "success":
|
|
48
|
+
this.#settle(classified.message.id, (pending) => pending.resolve(classified.message.result));
|
|
49
|
+
return;
|
|
50
|
+
case "failure": {
|
|
51
|
+
const { id, error } = classified.message;
|
|
52
|
+
if (id !== null) this.#settle(id, (pending) => pending.reject(RpcError.fromErrorObject(error, this.#options.docsBase)));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
case "invalid":
|
|
56
|
+
this.#reply(classified.id, { rpc: new RpcError(this.#diagnostic("MOSTRA_HOST_MALFORMED", classified.reason)) });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sends a request and resolves with its result, or rejects with an {@link RpcError}: the
|
|
62
|
+
* other side's diagnostic, `MOSTRA_HOST_TIMEOUT` or `MOSTRA_HOST_CONNECTION_CLOSED`.
|
|
63
|
+
*/
|
|
64
|
+
request(method, params, options = {}) {
|
|
65
|
+
if (this.#closed) return Promise.reject(new RpcError(this.#closed));
|
|
66
|
+
const id = this.#nextId++;
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
const pending = {
|
|
69
|
+
method,
|
|
70
|
+
resolve,
|
|
71
|
+
reject
|
|
72
|
+
};
|
|
73
|
+
if (options.timeoutMs !== void 0) pending.timer = setTimeout(() => {
|
|
74
|
+
this.#pending.delete(id);
|
|
75
|
+
reject(new RpcError(this.#diagnostic("MOSTRA_HOST_TIMEOUT", `No response to ${method} within ${options.timeoutMs} ms.`)));
|
|
76
|
+
}, options.timeoutMs);
|
|
77
|
+
this.#pending.set(id, pending);
|
|
78
|
+
this.#send(params === void 0 ? {
|
|
79
|
+
jsonrpc: "2.0",
|
|
80
|
+
id,
|
|
81
|
+
method
|
|
82
|
+
} : {
|
|
83
|
+
jsonrpc: "2.0",
|
|
84
|
+
id,
|
|
85
|
+
method,
|
|
86
|
+
params
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Calls a protocol method: validates the params before sending and the result on arrival. A
|
|
92
|
+
* result that fails the method's schema rejects with `MOSTRA_HOST_MALFORMED`.
|
|
93
|
+
*/
|
|
94
|
+
async call(definition, params, options = {}) {
|
|
95
|
+
const checked = parseParams(definition, params, this.#options.docsBase);
|
|
96
|
+
const raw = await this.request(definition.method, checked, options);
|
|
97
|
+
const parsed = definition.result.safeParse(raw);
|
|
98
|
+
if (parsed.success) return parsed.data;
|
|
99
|
+
throw new RpcError(this.#diagnostic("MOSTRA_HOST_MALFORMED", `The result of ${definition.method} doesn't match its schema: ${describeIssue(parsed.error.issues)}`));
|
|
100
|
+
}
|
|
101
|
+
/** Sends a notification. Does nothing once the peer is closed. */
|
|
102
|
+
notify(method, params) {
|
|
103
|
+
if (this.#closed) return;
|
|
104
|
+
this.#send(params === void 0 ? {
|
|
105
|
+
jsonrpc: "2.0",
|
|
106
|
+
method
|
|
107
|
+
} : {
|
|
108
|
+
jsonrpc: "2.0",
|
|
109
|
+
method,
|
|
110
|
+
params
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Closes the peer: every waiting request rejects with `diagnostic` (by default
|
|
115
|
+
* `MOSTRA_HOST_CONNECTION_CLOSED`), and later messages are ignored. Idempotent.
|
|
116
|
+
*/
|
|
117
|
+
close(diagnostic) {
|
|
118
|
+
if (this.#closed) return;
|
|
119
|
+
const reason = diagnostic ?? this.#diagnostic("MOSTRA_HOST_CONNECTION_CLOSED", "The connection closed before a response arrived.");
|
|
120
|
+
this.#closed = reason;
|
|
121
|
+
const pending = [...this.#pending.values()];
|
|
122
|
+
this.#pending.clear();
|
|
123
|
+
for (const entry of pending) {
|
|
124
|
+
if (entry.timer !== void 0) clearTimeout(entry.timer);
|
|
125
|
+
entry.reject(new RpcError(reason));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
#handleRequest(id, method, params) {
|
|
129
|
+
const handler = this.#options.onRequest;
|
|
130
|
+
if (!handler) {
|
|
131
|
+
this.#reply(id, { rpc: new RpcError(this.#diagnostic("MOSTRA_HOST_METHOD_UNKNOWN", `This side serves no method ${method}.`)) });
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
let outcome;
|
|
135
|
+
try {
|
|
136
|
+
outcome = handler(method, params, {
|
|
137
|
+
id,
|
|
138
|
+
method
|
|
139
|
+
});
|
|
140
|
+
} catch (error) {
|
|
141
|
+
this.#reply(id, { rpc: this.#asRpcError(error, method) });
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
Promise.resolve(outcome).then((result) => this.#reply(id, { result: result === void 0 ? null : result }), (error) => this.#reply(id, { rpc: this.#asRpcError(error, method) }));
|
|
145
|
+
}
|
|
146
|
+
#handleNotification(method, params) {
|
|
147
|
+
try {
|
|
148
|
+
this.#options.onNotification?.(method, params);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
this.#options.onInternalError?.(error, method);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
#asRpcError(error, method) {
|
|
154
|
+
if (error instanceof RpcError) return error;
|
|
155
|
+
this.#options.onInternalError?.(error, method);
|
|
156
|
+
return new RpcError(this.#diagnostic("MOSTRA_HOST_INTERNAL_ERROR", `${method} failed unexpectedly.`));
|
|
157
|
+
}
|
|
158
|
+
#settle(id, action) {
|
|
159
|
+
const pending = this.#pending.get(id);
|
|
160
|
+
if (!pending) return;
|
|
161
|
+
this.#pending.delete(id);
|
|
162
|
+
if (pending.timer !== void 0) clearTimeout(pending.timer);
|
|
163
|
+
action(pending);
|
|
164
|
+
}
|
|
165
|
+
#reply(id, outcome) {
|
|
166
|
+
if (this.#closed) return;
|
|
167
|
+
if ("rpc" in outcome) this.#send({
|
|
168
|
+
jsonrpc: "2.0",
|
|
169
|
+
id,
|
|
170
|
+
error: outcome.rpc.toErrorObject()
|
|
171
|
+
});
|
|
172
|
+
else if (id !== null) this.#send({
|
|
173
|
+
jsonrpc: "2.0",
|
|
174
|
+
id,
|
|
175
|
+
result: outcome.result
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
#send(message) {
|
|
179
|
+
try {
|
|
180
|
+
this.#options.send(message);
|
|
181
|
+
} catch {
|
|
182
|
+
this.close();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
#diagnostic(code, message) {
|
|
186
|
+
return hostDiagnostic(code, { message }, this.#options.docsBase);
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
function describeIssue(issues) {
|
|
190
|
+
const [first] = issues;
|
|
191
|
+
if (!first) return "unknown problem";
|
|
192
|
+
const path = first.path.map(String).join(".");
|
|
193
|
+
return `${path === "" ? "(root)" : path}: ${first.message}`;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Validates a method's params against its schema and returns the parsed value. Throws an
|
|
197
|
+
* {@link RpcError} with `MOSTRA_HOST_INVALID_PARAMS` naming the first problem; the message
|
|
198
|
+
* describes types and paths, never the values sent.
|
|
199
|
+
*/
|
|
200
|
+
function parseParams(definition, params, docsBase) {
|
|
201
|
+
const parsed = definition.params.safeParse(params ?? {});
|
|
202
|
+
if (parsed.success) return parsed.data;
|
|
203
|
+
throw new RpcError(hostDiagnostic("MOSTRA_HOST_INVALID_PARAMS", { message: `Invalid params for ${definition.method}: ${describeIssue(parsed.error.issues)}` }, docsBase));
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
export { RpcPeer, parseParams };
|
|
207
|
+
|
|
208
|
+
//# sourceMappingURL=peer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"peer.js","names":[],"sources":["../../src/rpc/peer.ts"],"sourcesContent":["/**\n * One end of a JSON-RPC 2.0 connection (D83): it matches responses to requests, dispatches\n * incoming requests and notifications, and turns every failure into a diagnostic. It has no I/O.\n * The transport hands it parsed messages (or raw lines) and sends what it gives back, so the same\n * peer serves stdio, Unix sockets, Node IPC and `postMessage`.\n *\n * ```ts\n * const peer = new RpcPeer({\n * send: (message) => socket.write(encodeLine(message)),\n * onRequest: (method, params) => handlers[method](params),\n * });\n * splitter.push(chunk).forEach((line) => peer.receiveLine(line));\n * const result = await peer.call(mostraInitializeMethod, params);\n * ```\n */\nimport type { Diagnostic } from \"../diagnostics/diagnostic.ts\";\nimport type { MethodDefinition } from \"../method.ts\";\nimport { hostDiagnostic, JSON_RPC_ERROR_CODES, RpcError } from \"./error.ts\";\nimport {\n classifyMessage,\n type JsonRpcId,\n type JsonRpcMessage,\n type JsonRpcParams,\n} from \"./messages.ts\";\n\n/** What a request handler learns about the request besides its params. */\nexport interface RpcRequestContext {\n /** The request's ID. */\n readonly id: JsonRpcId;\n /** The method name. */\n readonly method: string;\n}\n\n/** Options for {@link RpcPeer}. */\nexport interface RpcPeerOptions {\n /**\n * Sends one message. The transport serializes it (`encodeLine` for newline-delimited streams).\n * Throwing means the transport is gone: the peer closes.\n */\n send(message: JsonRpcMessage): void;\n /**\n * Answers an incoming request. Return the result, or throw an {@link RpcError} to answer with\n * its diagnostic. Any other exception is answered with `MOSTRA_HOST_INTERNAL_ERROR`, without\n * its details, and reported to `onInternalError`. Without a handler, every request is answered\n * with `MOSTRA_HOST_METHOD_UNKNOWN`.\n */\n onRequest?(method: string, params: unknown, context: RpcRequestContext): unknown;\n /** Receives an incoming notification. Exceptions are reported to `onInternalError`. */\n onNotification?(method: string, params: unknown): void;\n /** Reports an unexpected exception from a handler, for logging. */\n onInternalError?(error: unknown, method: string): void;\n /** The docs base URL for diagnostics the peer creates. Default `DEFAULT_DOCS_BASE`. */\n readonly docsBase?: string;\n}\n\n/** Options for one outgoing request. */\nexport interface RpcRequestOptions {\n /**\n * Gives up after this many milliseconds with `MOSTRA_HOST_TIMEOUT`. A late response is\n * ignored. Default: no timeout (FAILURE_MODEL §9).\n */\n readonly timeoutMs?: number;\n}\n\ninterface Pending {\n readonly method: string;\n resolve(result: unknown): void;\n reject(error: RpcError): void;\n timer?: ReturnType<typeof setTimeout>;\n}\n\n/** One end of a JSON-RPC 2.0 connection. */\nexport class RpcPeer {\n readonly #options: RpcPeerOptions;\n readonly #pending = new Map<JsonRpcId, Pending>();\n #nextId = 1;\n #closed: Diagnostic | undefined;\n\n constructor(options: RpcPeerOptions) {\n this.#options = options;\n }\n\n /** Whether the peer has closed. A closed peer sends nothing and rejects new requests. */\n get closed(): boolean {\n return this.#closed !== undefined;\n }\n\n /** How many outgoing requests are waiting for a response. */\n get pendingRequests(): number {\n return this.#pending.size;\n }\n\n /**\n * Receives one line of a newline-delimited stream. Blank lines are skipped; a line that isn't\n * JSON is answered with a parse error (-32700).\n */\n receiveLine(line: string): void {\n if (line.trim() === \"\") return;\n let value: unknown;\n try {\n value = JSON.parse(line);\n } catch {\n this.#reply(null, {\n rpc: new RpcError(\n this.#diagnostic(\"MOSTRA_HOST_MALFORMED\", \"A line wasn't valid JSON.\"),\n JSON_RPC_ERROR_CODES.parseError,\n ),\n });\n return;\n }\n this.receive(value);\n }\n\n /** Receives one parsed message. */\n receive(value: unknown): void {\n if (this.#closed) return;\n const classified = classifyMessage(value);\n switch (classified.kind) {\n case \"request\":\n this.#handleRequest(\n classified.message.id,\n classified.message.method,\n classified.message.params,\n );\n return;\n case \"notification\":\n this.#handleNotification(classified.message.method, classified.message.params);\n return;\n case \"success\":\n this.#settle(classified.message.id, (pending) =>\n pending.resolve(classified.message.result),\n );\n return;\n case \"failure\": {\n const { id, error } = classified.message;\n if (id !== null) {\n this.#settle(id, (pending) =>\n pending.reject(RpcError.fromErrorObject(error, this.#options.docsBase)),\n );\n }\n return;\n }\n case \"invalid\":\n this.#reply(classified.id, {\n rpc: new RpcError(this.#diagnostic(\"MOSTRA_HOST_MALFORMED\", classified.reason)),\n });\n return;\n }\n }\n\n /**\n * Sends a request and resolves with its result, or rejects with an {@link RpcError}: the\n * other side's diagnostic, `MOSTRA_HOST_TIMEOUT` or `MOSTRA_HOST_CONNECTION_CLOSED`.\n */\n request(\n method: string,\n params?: JsonRpcParams,\n options: RpcRequestOptions = {},\n ): Promise<unknown> {\n if (this.#closed) return Promise.reject(new RpcError(this.#closed));\n const id = this.#nextId++;\n return new Promise<unknown>((resolve, reject) => {\n const pending: Pending = { method, resolve, reject };\n if (options.timeoutMs !== undefined) {\n pending.timer = setTimeout(() => {\n this.#pending.delete(id);\n reject(\n new RpcError(\n this.#diagnostic(\n \"MOSTRA_HOST_TIMEOUT\",\n `No response to ${method} within ${options.timeoutMs} ms.`,\n ),\n ),\n );\n }, options.timeoutMs);\n }\n this.#pending.set(id, pending);\n this.#send(\n params === undefined\n ? { jsonrpc: \"2.0\", id, method }\n : { jsonrpc: \"2.0\", id, method, params },\n );\n });\n }\n\n /**\n * Calls a protocol method: validates the params before sending and the result on arrival. A\n * result that fails the method's schema rejects with `MOSTRA_HOST_MALFORMED`.\n */\n async call<P, R>(\n definition: MethodDefinition<P, R>,\n params: P,\n options: RpcRequestOptions = {},\n ): Promise<R> {\n const checked = parseParams(definition, params, this.#options.docsBase);\n const raw = await this.request(definition.method, checked as JsonRpcParams, options);\n const parsed = definition.result.safeParse(raw);\n if (parsed.success) return parsed.data;\n throw new RpcError(\n this.#diagnostic(\n \"MOSTRA_HOST_MALFORMED\",\n `The result of ${definition.method} doesn't match its schema: ${describeIssue(parsed.error.issues)}`,\n ),\n );\n }\n\n /** Sends a notification. Does nothing once the peer is closed. */\n notify(method: string, params?: JsonRpcParams): void {\n if (this.#closed) return;\n this.#send(\n params === undefined ? { jsonrpc: \"2.0\", method } : { jsonrpc: \"2.0\", method, params },\n );\n }\n\n /**\n * Closes the peer: every waiting request rejects with `diagnostic` (by default\n * `MOSTRA_HOST_CONNECTION_CLOSED`), and later messages are ignored. Idempotent.\n */\n close(diagnostic?: Diagnostic): void {\n if (this.#closed) return;\n const reason =\n diagnostic ??\n this.#diagnostic(\n \"MOSTRA_HOST_CONNECTION_CLOSED\",\n \"The connection closed before a response arrived.\",\n );\n this.#closed = reason;\n const pending = [...this.#pending.values()];\n this.#pending.clear();\n for (const entry of pending) {\n if (entry.timer !== undefined) clearTimeout(entry.timer);\n entry.reject(new RpcError(reason));\n }\n }\n\n #handleRequest(id: JsonRpcId, method: string, params: unknown): void {\n const handler = this.#options.onRequest;\n if (!handler) {\n this.#reply(id, {\n rpc: new RpcError(\n this.#diagnostic(\"MOSTRA_HOST_METHOD_UNKNOWN\", `This side serves no method ${method}.`),\n ),\n });\n return;\n }\n let outcome: unknown;\n try {\n outcome = handler(method, params, { id, method });\n } catch (error) {\n this.#reply(id, { rpc: this.#asRpcError(error, method) });\n return;\n }\n Promise.resolve(outcome).then(\n (result) => this.#reply(id, { result: result === undefined ? null : result }),\n (error: unknown) => this.#reply(id, { rpc: this.#asRpcError(error, method) }),\n );\n }\n\n #handleNotification(method: string, params: unknown): void {\n try {\n this.#options.onNotification?.(method, params);\n } catch (error) {\n this.#options.onInternalError?.(error, method);\n }\n }\n\n #asRpcError(error: unknown, method: string): RpcError {\n if (error instanceof RpcError) return error;\n this.#options.onInternalError?.(error, method);\n return new RpcError(\n this.#diagnostic(\"MOSTRA_HOST_INTERNAL_ERROR\", `${method} failed unexpectedly.`),\n );\n }\n\n #settle(id: JsonRpcId, action: (pending: Pending) => void): void {\n const pending = this.#pending.get(id);\n if (!pending) return;\n this.#pending.delete(id);\n if (pending.timer !== undefined) clearTimeout(pending.timer);\n action(pending);\n }\n\n #reply(id: JsonRpcId | null, outcome: { result: unknown } | { rpc: RpcError }): void {\n if (this.#closed) return;\n if (\"rpc\" in outcome) {\n this.#send({ jsonrpc: \"2.0\", id, error: outcome.rpc.toErrorObject() });\n } else if (id !== null) {\n this.#send({ jsonrpc: \"2.0\", id, result: outcome.result });\n }\n }\n\n #send(message: JsonRpcMessage): void {\n try {\n this.#options.send(message);\n } catch {\n this.close();\n }\n }\n\n #diagnostic(\n code:\n | \"MOSTRA_HOST_MALFORMED\"\n | \"MOSTRA_HOST_METHOD_UNKNOWN\"\n | \"MOSTRA_HOST_INTERNAL_ERROR\"\n | \"MOSTRA_HOST_TIMEOUT\"\n | \"MOSTRA_HOST_CONNECTION_CLOSED\",\n message: string,\n ): Diagnostic {\n return hostDiagnostic(code, { message }, this.#options.docsBase);\n }\n}\n\nfunction describeIssue(\n issues: readonly { readonly path: readonly PropertyKey[]; readonly message: string }[],\n): string {\n const [first] = issues;\n if (!first) return \"unknown problem\";\n const path = first.path.map(String).join(\".\");\n return `${path === \"\" ? \"(root)\" : path}: ${first.message}`;\n}\n\n/**\n * Validates a method's params against its schema and returns the parsed value. Throws an\n * {@link RpcError} with `MOSTRA_HOST_INVALID_PARAMS` naming the first problem; the message\n * describes types and paths, never the values sent.\n */\nexport function parseParams<P, R>(\n definition: MethodDefinition<P, R>,\n params: unknown,\n docsBase?: string,\n): P {\n const parsed = definition.params.safeParse(params ?? {});\n if (parsed.success) return parsed.data;\n throw new RpcError(\n hostDiagnostic(\n \"MOSTRA_HOST_INVALID_PARAMS\",\n { message: `Invalid params for ${definition.method}: ${describeIssue(parsed.error.issues)}` },\n docsBase,\n ),\n );\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
//#region src/serializer.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The serializer of server-function arguments and results (D19 seam 2, D54): exactly the type set
|
|
4
|
+
* React documents for Server Functions, plus `AsyncIterable` results, in one JSON wire form the
|
|
5
|
+
* browser, the gateway and the worker share. It has no I/O and no Node built-ins.
|
|
6
|
+
*
|
|
7
|
+
* A value is written as a series of **batches**, each a JSON array of {@link Frame}s. The first
|
|
8
|
+
* batch holds the value's root (chunk 0); a promise or an async iterable in it is a reference whose
|
|
9
|
+
* settlement or items arrive in later batches, so a result streams as it settles. Shared objects
|
|
10
|
+
* and cycles are kept: an object met twice is written once, in a chunk of its own.
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* const batches: Frame[][] = [];
|
|
14
|
+
* const writer = new ValueWriter({ mode: "result", onBatch: (batch) => batches.push(batch) });
|
|
15
|
+
* await writer.write({ when: new Date(), items: new Map([["a", 1]]) });
|
|
16
|
+
* await writer.done;
|
|
17
|
+
* const reader = new ValueReader();
|
|
18
|
+
* for (const batch of batches) reader.push(batch);
|
|
19
|
+
* const value = await reader.root;
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* What it accepts (react.dev, `'use server'`, "Serializable arguments and return values"):
|
|
23
|
+
* strings, numbers (`NaN`, infinities and `-0` too), bigints, booleans, `undefined`, `null`,
|
|
24
|
+
* symbols registered with `Symbol.for`, arrays, `Map`, `Set`, typed arrays, `DataView`,
|
|
25
|
+
* `ArrayBuffer`, `Date`, `FormData` (with string and file values), plain objects, Server Functions
|
|
26
|
+
* and promises; results may also be async iterables. Anything else (class instances, objects with
|
|
27
|
+
* a null prototype, other functions, unregistered symbols, React elements) is refused with a
|
|
28
|
+
* {@link SerializationError} naming where it is.
|
|
29
|
+
*/
|
|
30
|
+
/** One step of a written value. */
|
|
31
|
+
export type Frame = {
|
|
32
|
+
readonly c: number;
|
|
33
|
+
readonly v: unknown;
|
|
34
|
+
} | {
|
|
35
|
+
readonly p: number;
|
|
36
|
+
readonly v: unknown;
|
|
37
|
+
} | {
|
|
38
|
+
readonly p: number;
|
|
39
|
+
readonly e: WireError;
|
|
40
|
+
} | {
|
|
41
|
+
readonly i: number;
|
|
42
|
+
readonly v: unknown;
|
|
43
|
+
} | {
|
|
44
|
+
readonly i: number;
|
|
45
|
+
readonly end: true;
|
|
46
|
+
} | {
|
|
47
|
+
readonly i: number;
|
|
48
|
+
readonly e: WireError;
|
|
49
|
+
};
|
|
50
|
+
/** An error as the wire carries it: a rejected promise, a failed iteration. */
|
|
51
|
+
export interface WireError {
|
|
52
|
+
/** The error's message. */
|
|
53
|
+
readonly message: string;
|
|
54
|
+
/** Its diagnostic code, when it carried one (`MOSTRA_SECRET_MISSING`, say). */
|
|
55
|
+
readonly code?: string;
|
|
56
|
+
}
|
|
57
|
+
/** Any function: a Server Function as the serializer sees it. */
|
|
58
|
+
export type AnyFunction = (...args: never) => unknown;
|
|
59
|
+
/** Whether a value is written as a call's arguments or as its result. */
|
|
60
|
+
export type SerializeMode = "argument" | "result";
|
|
61
|
+
/**
|
|
62
|
+
* The most digits a bigint argument may have. A page's arguments are decoded before the action
|
|
63
|
+
* runs, and parsing a bigint takes time that grows faster than its length: 16 M digits held a
|
|
64
|
+
* worker's event loop for seconds. Results aren't limited; server code writes them.
|
|
65
|
+
*/
|
|
66
|
+
export declare const ARGUMENT_BIGINT_DIGITS_MAX = 1e4;
|
|
67
|
+
/** The diagnostic code of a value outside the type set (INTERFACES §2.4). */
|
|
68
|
+
export declare const UNSERIALIZABLE_CODE = "MOSTRA_ACTION_UNSERIALIZABLE";
|
|
69
|
+
/** A value outside the type set, or a malformed written value. */
|
|
70
|
+
export declare class SerializationError extends Error {
|
|
71
|
+
/** Always `MOSTRA_ACTION_UNSERIALIZABLE`. */
|
|
72
|
+
readonly code: string;
|
|
73
|
+
/** Where in the value: `.items[2].when`, or empty for the value itself. */
|
|
74
|
+
readonly path: string;
|
|
75
|
+
constructor(message: string, path?: string);
|
|
76
|
+
}
|
|
77
|
+
/** The error a rejected promise or a failed iteration carries on the wire. */
|
|
78
|
+
export declare function wireError(error: unknown): WireError;
|
|
79
|
+
/** An error read back from the wire, as the reader's promises and iterables reject with it. */
|
|
80
|
+
export declare class RemoteError extends Error {
|
|
81
|
+
/** The diagnostic code the error carried, if any. */
|
|
82
|
+
readonly code: string | undefined;
|
|
83
|
+
constructor(error: WireError);
|
|
84
|
+
}
|
|
85
|
+
/** Standard base64 of `bytes`, with padding. */
|
|
86
|
+
export declare function toBase64(bytes: Uint8Array): string;
|
|
87
|
+
/** The bytes of standard base64 text; throws a {@link SerializationError} on anything else. */
|
|
88
|
+
export declare function fromBase64(text: string): Uint8Array;
|
|
89
|
+
/** Options for {@link ValueWriter}. */
|
|
90
|
+
export interface ValueWriterOptions {
|
|
91
|
+
/** `argument`: no async iterables. `result`: everything. */
|
|
92
|
+
readonly mode: SerializeMode;
|
|
93
|
+
/** Receives each batch, in order. */
|
|
94
|
+
readonly onBatch: (batch: Frame[]) => void;
|
|
95
|
+
/**
|
|
96
|
+
* The ID of a function that is a Server Function, or `undefined` for any other function. The
|
|
97
|
+
* client's stubs carry their ID; the worker knows its registry.
|
|
98
|
+
*/
|
|
99
|
+
readonly serverFunctionId?: (fn: AnyFunction) => string | undefined;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Writes one value as batches. `write` throws a {@link SerializationError} when the value, or
|
|
103
|
+
* anything it holds synchronously, is outside the type set; a promise that later settles with such
|
|
104
|
+
* a value is written as rejected with that error. `done` settles once every promise and iterable
|
|
105
|
+
* in the value has settled or ended; `abort` stops iterables early (the reader went away).
|
|
106
|
+
*/
|
|
107
|
+
export declare class ValueWriter {
|
|
108
|
+
#private;
|
|
109
|
+
/** Settles once every async part of the value has been written. */
|
|
110
|
+
readonly done: Promise<void>;
|
|
111
|
+
constructor(options: ValueWriterOptions);
|
|
112
|
+
/** Writes the value's first batch; async parts follow in later batches. */
|
|
113
|
+
write(value: unknown): Promise<void>;
|
|
114
|
+
/**
|
|
115
|
+
* Whether {@link ValueWriter.abort} stopped the value before all of it was written: a promise
|
|
116
|
+
* still unsettled, an iterable not yet ended.
|
|
117
|
+
*/
|
|
118
|
+
get cutShort(): boolean;
|
|
119
|
+
/** Stops every iterable still being read, and settles `done`. */
|
|
120
|
+
abort(): void;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Writes `value` completely: every promise settled, so the batches can be sent at once. For
|
|
124
|
+
* arguments, which a browser sends in one request.
|
|
125
|
+
*/
|
|
126
|
+
export declare function serializeAll(value: unknown, options: Omit<ValueWriterOptions, "onBatch">): Promise<Frame[][]>;
|
|
127
|
+
/** Options for {@link ValueReader}. */
|
|
128
|
+
export interface ValueReaderOptions {
|
|
129
|
+
/** The function a Server Function ID stands for; absent: a reference is refused. */
|
|
130
|
+
readonly serverFunction?: (id: string) => AnyFunction;
|
|
131
|
+
/**
|
|
132
|
+
* `argument`: what a page sent, read where server code runs: no symbols, no async iterables,
|
|
133
|
+
* bigints of at most {@link ARGUMENT_BIGINT_DIGITS_MAX} digits, the writer's own limits. Default
|
|
134
|
+
* `result`: everything the writer writes.
|
|
135
|
+
*/
|
|
136
|
+
readonly mode?: SerializeMode;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Reads batches back into a value. `root` resolves once the first batch arrived; promises and
|
|
140
|
+
* async iterables in it settle and yield as later batches arrive. A malformed batch throws a
|
|
141
|
+
* {@link SerializationError} from `push`; `fail` rejects everything still open, for a stream that
|
|
142
|
+
* broke before its end.
|
|
143
|
+
*/
|
|
144
|
+
export declare class ValueReader {
|
|
145
|
+
#private;
|
|
146
|
+
/** The value, once the first batch arrived. */
|
|
147
|
+
readonly root: Promise<unknown>;
|
|
148
|
+
constructor(options?: ValueReaderOptions);
|
|
149
|
+
/** Whether every promise and iterable read so far has settled or ended. */
|
|
150
|
+
get complete(): boolean;
|
|
151
|
+
/** Takes one batch. */
|
|
152
|
+
push(batch: unknown): void;
|
|
153
|
+
/**
|
|
154
|
+
* Ends the value: every frame taken so far is applied, and the value must be complete. Throws a
|
|
155
|
+
* {@link SerializationError} when a promise or iterable it holds is still open or a frame names
|
|
156
|
+
* one the value never refers to, so a reader that has all the batches (a page's arguments)
|
|
157
|
+
* never hands on a promise that can't settle.
|
|
158
|
+
*/
|
|
159
|
+
finish(): void;
|
|
160
|
+
/** Rejects every promise and iterable still open: the stream broke. */
|
|
161
|
+
fail(error: unknown): void;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Reads complete batches back into a value: every promise in it settled from the batches, every
|
|
165
|
+
* async iterable replaying its items. For arguments and stored results.
|
|
166
|
+
*/
|
|
167
|
+
export declare function deserializeAll(batches: readonly unknown[], options?: ValueReaderOptions): Promise<unknown>;
|
|
168
|
+
/**
|
|
169
|
+
* Checks a page's argument batches without decoding them, before they reach server code: no
|
|
170
|
+
* symbol (`$S`), no async iterable (`$x`), no bigint of more than
|
|
171
|
+
* {@link ARGUMENT_BIGINT_DIGITS_MAX} digits. The supervisor runs it so such arguments are refused
|
|
172
|
+
* before any worker sees them (Opus review 1); the worker's reader refuses them again.
|
|
173
|
+
*
|
|
174
|
+
* @throws SerializationError naming what was found.
|
|
175
|
+
*/
|
|
176
|
+
export declare function checkArgumentFrames(batches: readonly unknown[]): void;
|
|
177
|
+
//#endregion
|
|
178
|
+
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","names":[],"sources":["../src/serializer.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA8BY;WAEG;WAAoB;;WAEpB;WAAoB;;WACpB;WAAoB,GAAG;;WAEvB;WAAoB;;WACpB;WAAoB;;WACpB;WAAoB,GAAG;;;iBAMrB;;WAEN;;WAEA;;;YAIC,kBAAkB;;YAGlB;;;;;;qBAOC;;qBAGA;;qBAGA,2BAA2B;;WAE7B;;WAEA;EACT,YAAY,iBAAiB;;;wBAkBf,UAAU,iBAAiB;;qBAS9B,oBAAoB;;WAEtB;EACT,YAAY,OAAO;;;wBAcL,SAAS,OAAO;;wBAwBhB,WAAW,eAAe;;iBA6GzB;;WAEN,MAAM;;WAEN,UAAU,OAAO;;;;;WAKjB,oBAAoB,IAAI;;;;;;;;qBAStB;;;WAaF,MAAM;EAEf,YAAY,SAAS;;EAYrB,MAAY,iBAAiB;;;;;MA8BzB;;EAKJ;;;;;;wBA0WoB,aACpB,gBACA,SAAS,KAAK,iCACb,QAAQ;;iBAWM;;WAEN,kBAAkB,eAAe;;;;;;WAMjC,OAAO;;;;;;;;qBAiGL;;;WAYF,MAAM;EAEf,YAAY,UAAS;;MAKjB;;EASJ,KAAK;;;;;;;EAiCL;;EAaA,KAAK;;;;;;wBAyQe,eACpB,6BACA,UAAS,qBACR;;;;;;;;;wBAoBa,oBAAoB"}
|