@mostra/protocol 0.0.0-placeholder → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +37 -1
- package/dist/actions.d.ts +273 -0
- package/dist/actions.d.ts.map +1 -0
- package/dist/actions.js +154 -0
- package/dist/actions.js.map +1 -0
- package/dist/artifact.d.ts +113 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +79 -0
- package/dist/artifact.js.map +1 -0
- package/dist/bridge.d.ts +295 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +343 -0
- package/dist/bridge.js.map +1 -0
- package/dist/browser.d.ts +195 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +156 -0
- package/dist/browser.js.map +1 -0
- package/dist/bundle.d.ts +155 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +130 -0
- package/dist/bundle.js.map +1 -0
- package/dist/canonical.d.ts +23 -0
- package/dist/canonical.d.ts.map +1 -0
- package/dist/canonical.js +45 -0
- package/dist/canonical.js.map +1 -0
- package/dist/capability.d.ts +38 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/capability.js +61 -0
- package/dist/capability.js.map +1 -0
- package/dist/diagnostics/codes/a11y.d.ts +8 -0
- package/dist/diagnostics/codes/a11y.d.ts.map +1 -0
- package/dist/diagnostics/codes/a11y.js +30 -0
- package/dist/diagnostics/codes/a11y.js.map +1 -0
- package/dist/diagnostics/codes/action.d.ts +8 -0
- package/dist/diagnostics/codes/action.d.ts.map +1 -0
- package/dist/diagnostics/codes/action.js +110 -0
- package/dist/diagnostics/codes/action.js.map +1 -0
- package/dist/diagnostics/codes/artifact.d.ts +8 -0
- package/dist/diagnostics/codes/artifact.d.ts.map +1 -0
- package/dist/diagnostics/codes/artifact.js +121 -0
- package/dist/diagnostics/codes/artifact.js.map +1 -0
- package/dist/diagnostics/codes/build.d.ts +8 -0
- package/dist/diagnostics/codes/build.d.ts.map +1 -0
- package/dist/diagnostics/codes/build.js +55 -0
- package/dist/diagnostics/codes/build.js.map +1 -0
- package/dist/diagnostics/codes/cli.d.ts +8 -0
- package/dist/diagnostics/codes/cli.d.ts.map +1 -0
- package/dist/diagnostics/codes/cli.js +44 -0
- package/dist/diagnostics/codes/cli.js.map +1 -0
- package/dist/diagnostics/codes/console.d.ts +8 -0
- package/dist/diagnostics/codes/console.d.ts.map +1 -0
- package/dist/diagnostics/codes/console.js +30 -0
- package/dist/diagnostics/codes/console.js.map +1 -0
- package/dist/diagnostics/codes/dep.d.ts +8 -0
- package/dist/diagnostics/codes/dep.d.ts.map +1 -0
- package/dist/diagnostics/codes/dep.js +88 -0
- package/dist/diagnostics/codes/dep.js.map +1 -0
- package/dist/diagnostics/codes/env.d.ts +8 -0
- package/dist/diagnostics/codes/env.d.ts.map +1 -0
- package/dist/diagnostics/codes/env.js +132 -0
- package/dist/diagnostics/codes/env.js.map +1 -0
- package/dist/diagnostics/codes/field.d.ts +8 -0
- package/dist/diagnostics/codes/field.d.ts.map +1 -0
- package/dist/diagnostics/codes/field.js +99 -0
- package/dist/diagnostics/codes/field.js.map +1 -0
- package/dist/diagnostics/codes/home.d.ts +8 -0
- package/dist/diagnostics/codes/home.d.ts.map +1 -0
- package/dist/diagnostics/codes/home.js +132 -0
- package/dist/diagnostics/codes/home.js.map +1 -0
- package/dist/diagnostics/codes/host.d.ts +8 -0
- package/dist/diagnostics/codes/host.d.ts.map +1 -0
- package/dist/diagnostics/codes/host.js +176 -0
- package/dist/diagnostics/codes/host.js.map +1 -0
- package/dist/diagnostics/codes/hygiene.d.ts +8 -0
- package/dist/diagnostics/codes/hygiene.d.ts.map +1 -0
- package/dist/diagnostics/codes/hygiene.js +154 -0
- package/dist/diagnostics/codes/hygiene.js.map +1 -0
- package/dist/diagnostics/codes/index.d.ts +51 -0
- package/dist/diagnostics/codes/index.d.ts.map +1 -0
- package/dist/diagnostics/codes/index.js +72 -0
- package/dist/diagnostics/codes/index.js.map +1 -0
- package/dist/diagnostics/codes/live.d.ts +8 -0
- package/dist/diagnostics/codes/live.d.ts.map +1 -0
- package/dist/diagnostics/codes/live.js +30 -0
- package/dist/diagnostics/codes/live.js.map +1 -0
- package/dist/diagnostics/codes/manifest.d.ts +8 -0
- package/dist/diagnostics/codes/manifest.d.ts.map +1 -0
- package/dist/diagnostics/codes/manifest.js +44 -0
- package/dist/diagnostics/codes/manifest.js.map +1 -0
- package/dist/diagnostics/codes/network.d.ts +8 -0
- package/dist/diagnostics/codes/network.d.ts.map +1 -0
- package/dist/diagnostics/codes/network.js +30 -0
- package/dist/diagnostics/codes/network.js.map +1 -0
- package/dist/diagnostics/codes/platform.d.ts +8 -0
- package/dist/diagnostics/codes/platform.d.ts.map +1 -0
- package/dist/diagnostics/codes/platform.js +18 -0
- package/dist/diagnostics/codes/platform.js.map +1 -0
- package/dist/diagnostics/codes/publish.d.ts +8 -0
- package/dist/diagnostics/codes/publish.d.ts.map +1 -0
- package/dist/diagnostics/codes/publish.js +44 -0
- package/dist/diagnostics/codes/publish.js.map +1 -0
- package/dist/diagnostics/codes/regression.d.ts +8 -0
- package/dist/diagnostics/codes/regression.d.ts.map +1 -0
- package/dist/diagnostics/codes/regression.js +77 -0
- package/dist/diagnostics/codes/regression.js.map +1 -0
- package/dist/diagnostics/codes/runtime.d.ts +8 -0
- package/dist/diagnostics/codes/runtime.d.ts.map +1 -0
- package/dist/diagnostics/codes/runtime.js +66 -0
- package/dist/diagnostics/codes/runtime.js.map +1 -0
- package/dist/diagnostics/codes/secret.d.ts +8 -0
- package/dist/diagnostics/codes/secret.d.ts.map +1 -0
- package/dist/diagnostics/codes/secret.js +18 -0
- package/dist/diagnostics/codes/secret.js.map +1 -0
- package/dist/diagnostics/codes/smoke.d.ts +8 -0
- package/dist/diagnostics/codes/smoke.d.ts.map +1 -0
- package/dist/diagnostics/codes/smoke.js +30 -0
- package/dist/diagnostics/codes/smoke.js.map +1 -0
- package/dist/diagnostics/codes/submit.d.ts +8 -0
- package/dist/diagnostics/codes/submit.d.ts.map +1 -0
- package/dist/diagnostics/codes/submit.js +99 -0
- package/dist/diagnostics/codes/submit.js.map +1 -0
- package/dist/diagnostics/codes/target.d.ts +8 -0
- package/dist/diagnostics/codes/target.d.ts.map +1 -0
- package/dist/diagnostics/codes/target.js +18 -0
- package/dist/diagnostics/codes/target.js.map +1 -0
- package/dist/diagnostics/codes/type.d.ts +8 -0
- package/dist/diagnostics/codes/type.d.ts.map +1 -0
- package/dist/diagnostics/codes/type.js +30 -0
- package/dist/diagnostics/codes/type.js.map +1 -0
- package/dist/diagnostics/codes/verify.d.ts +8 -0
- package/dist/diagnostics/codes/verify.d.ts.map +1 -0
- package/dist/diagnostics/codes/verify.js +99 -0
- package/dist/diagnostics/codes/verify.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +79 -0
- package/dist/diagnostics/diagnostic.d.ts.map +1 -0
- package/dist/diagnostics/diagnostic.js +131 -0
- package/dist/diagnostics/diagnostic.js.map +1 -0
- package/dist/diagnostics/spec.d.ts +49 -0
- package/dist/diagnostics/spec.d.ts.map +1 -0
- package/dist/diagnostics/spec.js +31 -0
- package/dist/diagnostics/spec.js.map +1 -0
- package/dist/hygiene.d.ts +66 -0
- package/dist/hygiene.d.ts.map +1 -0
- package/dist/hygiene.js +134 -0
- package/dist/hygiene.js.map +1 -0
- package/dist/ids.d.ts +119 -0
- package/dist/ids.d.ts.map +1 -0
- package/dist/ids.js +135 -0
- package/dist/ids.js.map +1 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +86 -0
- package/dist/interaction.d.ts +391 -0
- package/dist/interaction.d.ts.map +1 -0
- package/dist/interaction.js +306 -0
- package/dist/interaction.js.map +1 -0
- package/dist/manifest.d.ts +97 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +101 -0
- package/dist/manifest.js.map +1 -0
- package/dist/method.d.ts +26 -0
- package/dist/method.d.ts.map +1 -0
- package/dist/method.js +10 -0
- package/dist/method.js.map +1 -0
- package/dist/methods/artifact/create.d.ts +29 -0
- package/dist/methods/artifact/create.d.ts.map +1 -0
- package/dist/methods/artifact/create.js +31 -0
- package/dist/methods/artifact/create.js.map +1 -0
- package/dist/methods/artifact/get.d.ts +17 -0
- package/dist/methods/artifact/get.d.ts.map +1 -0
- package/dist/methods/artifact/get.js +21 -0
- package/dist/methods/artifact/get.js.map +1 -0
- package/dist/methods/artifact/list.d.ts +22 -0
- package/dist/methods/artifact/list.d.ts.map +1 -0
- package/dist/methods/artifact/list.js +19 -0
- package/dist/methods/artifact/list.js.map +1 -0
- package/dist/methods/artifact/publish.d.ts +28 -0
- package/dist/methods/artifact/publish.d.ts.map +1 -0
- package/dist/methods/artifact/publish.js +28 -0
- package/dist/methods/artifact/publish.js.map +1 -0
- package/dist/methods/artifact/verify.d.ts +29 -0
- package/dist/methods/artifact/verify.d.ts.map +1 -0
- package/dist/methods/artifact/verify.js +27 -0
- package/dist/methods/artifact/verify.js.map +1 -0
- package/dist/methods/deps/add.d.ts +43 -0
- package/dist/methods/deps/add.d.ts.map +1 -0
- package/dist/methods/deps/add.js +40 -0
- package/dist/methods/deps/add.js.map +1 -0
- package/dist/methods/dev/start.d.ts +52 -0
- package/dist/methods/dev/start.d.ts.map +1 -0
- package/dist/methods/dev/start.js +56 -0
- package/dist/methods/dev/start.js.map +1 -0
- package/dist/methods/dev/stop.d.ts +16 -0
- package/dist/methods/dev/stop.d.ts.map +1 -0
- package/dist/methods/dev/stop.js +21 -0
- package/dist/methods/dev/stop.js.map +1 -0
- package/dist/methods/events/ack.d.ts +20 -0
- package/dist/methods/events/ack.d.ts.map +1 -0
- package/dist/methods/events/ack.js +26 -0
- package/dist/methods/events/ack.js.map +1 -0
- package/dist/methods/events/read.d.ts +40 -0
- package/dist/methods/events/read.d.ts.map +1 -0
- package/dist/methods/events/read.js +35 -0
- package/dist/methods/events/read.js.map +1 -0
- package/dist/methods/events/subscribe.d.ts +54 -0
- package/dist/methods/events/subscribe.d.ts.map +1 -0
- package/dist/methods/events/subscribe.js +44 -0
- package/dist/methods/events/subscribe.js.map +1 -0
- package/dist/methods/events/unsubscribe.d.ts +16 -0
- package/dist/methods/events/unsubscribe.d.ts.map +1 -0
- package/dist/methods/events/unsubscribe.js +21 -0
- package/dist/methods/events/unsubscribe.js.map +1 -0
- package/dist/methods/gc/run.d.ts +76 -0
- package/dist/methods/gc/run.d.ts.map +1 -0
- package/dist/methods/gc/run.js +56 -0
- package/dist/methods/gc/run.js.map +1 -0
- package/dist/methods/index.d.ts +6 -0
- package/dist/methods/index.d.ts.map +1 -0
- package/dist/methods/index.js +78 -0
- package/dist/methods/index.js.map +1 -0
- package/dist/methods/instance/check.d.ts +30 -0
- package/dist/methods/instance/check.d.ts.map +1 -0
- package/dist/methods/instance/check.js +34 -0
- package/dist/methods/instance/check.js.map +1 -0
- package/dist/methods/instance/status.d.ts +102 -0
- package/dist/methods/instance/status.d.ts.map +1 -0
- package/dist/methods/instance/status.js +83 -0
- package/dist/methods/instance/status.js.map +1 -0
- package/dist/methods/live/push.d.ts +28 -0
- package/dist/methods/live/push.d.ts.map +1 -0
- package/dist/methods/live/push.js +35 -0
- package/dist/methods/live/push.js.map +1 -0
- package/dist/methods/mostra/initialize.d.ts +143 -0
- package/dist/methods/mostra/initialize.d.ts.map +1 -0
- package/dist/methods/mostra/initialize.js +97 -0
- package/dist/methods/mostra/initialize.js.map +1 -0
- package/dist/methods/mostra/shutdown.d.ts +14 -0
- package/dist/methods/mostra/shutdown.d.ts.map +1 -0
- package/dist/methods/mostra/shutdown.js +22 -0
- package/dist/methods/mostra/shutdown.js.map +1 -0
- package/dist/methods/port/drafts-mirror.d.ts +30 -0
- package/dist/methods/port/drafts-mirror.d.ts.map +1 -0
- package/dist/methods/port/drafts-mirror.js +33 -0
- package/dist/methods/port/drafts-mirror.js.map +1 -0
- package/dist/methods/port/secrets-get.d.ts +19 -0
- package/dist/methods/port/secrets-get.d.ts.map +1 -0
- package/dist/methods/port/secrets-get.js +31 -0
- package/dist/methods/port/secrets-get.js.map +1 -0
- package/dist/methods/port/submissions-deliver.d.ts +38 -0
- package/dist/methods/port/submissions-deliver.d.ts.map +1 -0
- package/dist/methods/port/submissions-deliver.js +38 -0
- package/dist/methods/port/submissions-deliver.js.map +1 -0
- package/dist/methods/port/trusted-controls-activated.d.ts +27 -0
- package/dist/methods/port/trusted-controls-activated.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-activated.js +33 -0
- package/dist/methods/port/trusted-controls-activated.js.map +1 -0
- package/dist/methods/port/trusted-controls-policy.d.ts +21 -0
- package/dist/methods/port/trusted-controls-policy.d.ts.map +1 -0
- package/dist/methods/port/trusted-controls-policy.js +27 -0
- package/dist/methods/port/trusted-controls-policy.js.map +1 -0
- package/dist/methods/results/get.d.ts +32 -0
- package/dist/methods/results/get.d.ts.map +1 -0
- package/dist/methods/results/get.js +36 -0
- package/dist/methods/results/get.js.map +1 -0
- package/dist/methods/secret/delete.d.ts +22 -0
- package/dist/methods/secret/delete.d.ts.map +1 -0
- package/dist/methods/secret/delete.js +32 -0
- package/dist/methods/secret/delete.js.map +1 -0
- package/dist/methods/secret/list.d.ts +21 -0
- package/dist/methods/secret/list.d.ts.map +1 -0
- package/dist/methods/secret/list.js +29 -0
- package/dist/methods/secret/list.js.map +1 -0
- package/dist/methods/secret/set.d.ts +37 -0
- package/dist/methods/secret/set.d.ts.map +1 -0
- package/dist/methods/secret/set.js +41 -0
- package/dist/methods/secret/set.js.map +1 -0
- package/dist/methods/state/get.d.ts +25 -0
- package/dist/methods/state/get.d.ts.map +1 -0
- package/dist/methods/state/get.js +29 -0
- package/dist/methods/state/get.js.map +1 -0
- package/dist/methods/state/patch.d.ts +32 -0
- package/dist/methods/state/patch.d.ts.map +1 -0
- package/dist/methods/state/patch.js +29 -0
- package/dist/methods/state/patch.js.map +1 -0
- package/dist/methods/view/default.d.ts +19 -0
- package/dist/methods/view/default.d.ts.map +1 -0
- package/dist/methods/view/default.js +23 -0
- package/dist/methods/view/default.js.map +1 -0
- package/dist/methods/view/launch.d.ts +27 -0
- package/dist/methods/view/launch.d.ts.map +1 -0
- package/dist/methods/view/launch.js +30 -0
- package/dist/methods/view/launch.js.map +1 -0
- package/dist/methods/view/revoke.d.ts +19 -0
- package/dist/methods/view/revoke.d.ts.map +1 -0
- package/dist/methods/view/revoke.js +26 -0
- package/dist/methods/view/revoke.js.map +1 -0
- package/dist/methods/view/rotate.d.ts +21 -0
- package/dist/methods/view/rotate.d.ts.map +1 -0
- package/dist/methods/view/rotate.js +27 -0
- package/dist/methods/view/rotate.js.map +1 -0
- package/dist/methods/view/url.d.ts +52 -0
- package/dist/methods/view/url.d.ts.map +1 -0
- package/dist/methods/view/url.js +43 -0
- package/dist/methods/view/url.js.map +1 -0
- package/dist/methods/wait/wait.d.ts +37 -0
- package/dist/methods/wait/wait.d.ts.map +1 -0
- package/dist/methods/wait/wait.js +39 -0
- package/dist/methods/wait/wait.js.map +1 -0
- package/dist/revision.d.ts +43 -0
- package/dist/revision.d.ts.map +1 -0
- package/dist/revision.js +69 -0
- package/dist/revision.js.map +1 -0
- package/dist/rpc/error.d.ts +47 -0
- package/dist/rpc/error.d.ts.map +1 -0
- package/dist/rpc/error.js +77 -0
- package/dist/rpc/error.js.map +1 -0
- package/dist/rpc/lines.d.ts +30 -0
- package/dist/rpc/lines.d.ts.map +1 -0
- package/dist/rpc/lines.js +63 -0
- package/dist/rpc/lines.js.map +1 -0
- package/dist/rpc/messages.d.ts +92 -0
- package/dist/rpc/messages.d.ts.map +1 -0
- package/dist/rpc/messages.js +133 -0
- package/dist/rpc/messages.js.map +1 -0
- package/dist/rpc/peer.d.ts +81 -0
- package/dist/rpc/peer.d.ts.map +1 -0
- package/dist/rpc/peer.js +208 -0
- package/dist/rpc/peer.js.map +1 -0
- package/dist/serializer.d.ts +178 -0
- package/dist/serializer.d.ts.map +1 -0
- package/dist/serializer.js +929 -0
- package/dist/serializer.js.map +1 -0
- package/dist/verify.d.ts +254 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +243 -0
- package/dist/verify.js.map +1 -0
- package/dist/view.d.ts +103 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +110 -0
- package/dist/view.js.map +1 -0
- package/dist/wire-registry.js +11 -0
- package/dist/wire-registry.js.map +1 -0
- package/dist/worker.d.ts +249 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +158 -0
- package/dist/worker.js.map +1 -0
- package/package.json +114 -4
- package/schemas/protocol.draft-07.json +5120 -0
- package/schemas/protocol.schema.json +4964 -0
- package/src/actions.ts +418 -0
- package/src/artifact.ts +187 -0
- package/src/bridge.ts +618 -0
- package/src/browser.ts +374 -0
- package/src/bundle.ts +264 -0
- package/src/canonical.ts +49 -0
- package/src/capability.ts +92 -0
- package/src/diagnostics/codes/a11y.ts +41 -0
- package/src/diagnostics/codes/action.ts +125 -0
- package/src/diagnostics/codes/artifact.ts +137 -0
- package/src/diagnostics/codes/build.ts +65 -0
- package/src/diagnostics/codes/cli.ts +53 -0
- package/src/diagnostics/codes/console.ts +41 -0
- package/src/diagnostics/codes/dep.ts +101 -0
- package/src/diagnostics/codes/env.ts +149 -0
- package/src/diagnostics/codes/field.ts +113 -0
- package/src/diagnostics/codes/home.ts +150 -0
- package/src/diagnostics/codes/host.ts +197 -0
- package/src/diagnostics/codes/hygiene.ts +175 -0
- package/src/diagnostics/codes/index.ts +142 -0
- package/src/diagnostics/codes/live.ts +41 -0
- package/src/diagnostics/codes/manifest.ts +53 -0
- package/src/diagnostics/codes/network.ts +41 -0
- package/src/diagnostics/codes/platform.ts +30 -0
- package/src/diagnostics/codes/publish.ts +53 -0
- package/src/diagnostics/codes/regression.ts +89 -0
- package/src/diagnostics/codes/runtime.ts +77 -0
- package/src/diagnostics/codes/secret.ts +29 -0
- package/src/diagnostics/codes/smoke.ts +41 -0
- package/src/diagnostics/codes/submit.ts +113 -0
- package/src/diagnostics/codes/target.ts +29 -0
- package/src/diagnostics/codes/type.ts +41 -0
- package/src/diagnostics/codes/verify.ts +113 -0
- package/src/diagnostics/diagnostic.ts +240 -0
- package/src/diagnostics/spec.ts +90 -0
- package/src/hygiene.ts +224 -0
- package/src/ids.ts +279 -0
- package/src/index.ts +576 -0
- package/src/interaction.ts +728 -0
- package/src/manifest.ts +206 -0
- package/src/method.ts +42 -0
- package/src/methods/artifact/create.ts +56 -0
- package/src/methods/artifact/get.ts +30 -0
- package/src/methods/artifact/list.ts +42 -0
- package/src/methods/artifact/publish.ts +46 -0
- package/src/methods/artifact/verify.ts +46 -0
- package/src/methods/deps/add.ts +72 -0
- package/src/methods/dev/start.ts +84 -0
- package/src/methods/dev/stop.ts +32 -0
- package/src/methods/events/ack.ts +41 -0
- package/src/methods/events/read.ts +67 -0
- package/src/methods/events/subscribe.ts +91 -0
- package/src/methods/events/unsubscribe.ts +35 -0
- package/src/methods/gc/run.ts +125 -0
- package/src/methods/index.ts +81 -0
- package/src/methods/instance/check.ts +61 -0
- package/src/methods/instance/status.ts +172 -0
- package/src/methods/live/push.ts +54 -0
- package/src/methods/mostra/initialize.ts +249 -0
- package/src/methods/mostra/shutdown.ts +31 -0
- package/src/methods/port/drafts-mirror.ts +52 -0
- package/src/methods/port/secrets-get.ts +40 -0
- package/src/methods/port/submissions-deliver.ts +70 -0
- package/src/methods/port/trusted-controls-activated.ts +51 -0
- package/src/methods/port/trusted-controls-policy.ts +38 -0
- package/src/methods/results/get.ts +59 -0
- package/src/methods/secret/delete.ts +43 -0
- package/src/methods/secret/list.ts +40 -0
- package/src/methods/secret/set.ts +69 -0
- package/src/methods/state/get.ts +44 -0
- package/src/methods/state/patch.ts +51 -0
- package/src/methods/view/default.ts +32 -0
- package/src/methods/view/launch.ts +47 -0
- package/src/methods/view/revoke.ts +39 -0
- package/src/methods/view/rotate.ts +37 -0
- package/src/methods/view/url.ts +84 -0
- package/src/methods/wait/wait.ts +58 -0
- package/src/revision.ts +101 -0
- package/src/rpc/error.ts +107 -0
- package/src/rpc/lines.ts +70 -0
- package/src/rpc/messages.ts +188 -0
- package/src/rpc/peer.ts +341 -0
- package/src/serializer.ts +1217 -0
- package/src/timers.d.ts +8 -0
- package/src/verify.ts +458 -0
- package/src/view.ts +200 -0
- package/src/web-crypto.d.ts +9 -0
- package/src/web-platform.d.ts +35 -0
- package/src/wire-registry.ts +14 -0
- package/src/worker.ts +374 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
1
|
# @mostra/protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The shared vocabulary of [Mostra](https://github.com/mostra-dev/mostra), the agent artifact
|
|
4
|
+
runtime: the types every Mostra client, host and process agree on, as TypeScript types with Zod
|
|
5
|
+
schemas and published JSON Schema. It has no I/O and runs in browsers, workers and Node alike.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @mostra/protocol
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What it contains
|
|
12
|
+
|
|
13
|
+
- **IDs.** One kind per entity (`ArtifactId`, `VersionId`, `ViewId`, `SubmissionId` and so on),
|
|
14
|
+
each a type and a value: `ArtifactId.parse(input)`, `MutationId.create()`, `ArtifactId.schema`
|
|
15
|
+
inside a Zod object. Version IDs are content-addressed: `VersionId.fromSha256(digest)`. Event
|
|
16
|
+
cursors are decimal strings (`Cursor`).
|
|
17
|
+
- **Protocol revisions.** Dated revisions (`2026-10-10`) and `negotiateRevision(offered,
|
|
18
|
+
supported)`, which picks the newest common revision or returns the
|
|
19
|
+
`MOSTRA_HOST_REVISION_UNSUPPORTED` diagnostic.
|
|
20
|
+
- **Diagnostics.** The one error shape of every Mostra interface (`Diagnostic`), the catalog of
|
|
21
|
+
stable codes with their docs (`diagnosticCatalog`) and `createDiagnostic(code, details)`.
|
|
22
|
+
- **Protocol methods.** `defineMethod` and the registry of host protocol methods.
|
|
23
|
+
- **JSON Schema.** `schemas/protocol.schema.json` (2020-12) and `schemas/protocol.draft-07.json`,
|
|
24
|
+
exported as `@mostra/protocol/schemas/*`.
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { ArtifactId, negotiateRevision } from "@mostra/protocol";
|
|
28
|
+
|
|
29
|
+
const id = ArtifactId.parse("art_01J9ZQ3W4X5Y6Z7A8B9C0D1E2F");
|
|
30
|
+
const outcome = negotiateRevision(["2026-10-10"]);
|
|
31
|
+
if (!outcome.ok) console.error(outcome.diagnostic.message);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Interfaces change additively within a protocol revision; a breaking change needs a new revision.
|
|
35
|
+
The package stays at 0.x until the host protocol freezes.
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
Apache-2.0.
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { Frame, WireError } from "./serializer.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
|
+
//#region src/actions.d.ts
|
|
4
|
+
/** A value written by the serializer: its batches, in order (`serializeAll`). */
|
|
5
|
+
export type Batches = readonly (readonly Frame[])[];
|
|
6
|
+
/**
|
|
7
|
+
* The Zod schema of the `Batches` type: a list of batches, each a list of frames. The frames
|
|
8
|
+
* themselves are checked by the reader (`ValueReader`), which refuses anything malformed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const Batches: z.ZodType<Batches>;
|
|
11
|
+
/** An error as runs, calls and live sources report it. */
|
|
12
|
+
export interface ActionError extends WireError {
|
|
13
|
+
/** The stack of the thrown error, kept in the run log and never sent to a page. */
|
|
14
|
+
readonly stack?: string;
|
|
15
|
+
}
|
|
16
|
+
/** The Zod schema of the `ActionError` type. */
|
|
17
|
+
export declare const ActionError: z.ZodType<ActionError>;
|
|
18
|
+
/** The largest serialized arguments a call or run takes, in characters of JSON. */
|
|
19
|
+
export declare const ACTION_ARGS_MAX: number;
|
|
20
|
+
/** The largest serialized result a run keeps, in characters of JSON (larger fails the run). */
|
|
21
|
+
export declare const ACTION_RESULT_MAX: number;
|
|
22
|
+
/** The cap of a run's log, in UTF-16 code units of its lines (D47's 1 MB). */
|
|
23
|
+
export declare const RUN_LOG_MAX: number;
|
|
24
|
+
/** The line a capped log ends with. */
|
|
25
|
+
export declare const RUN_LOG_TRUNCATED = "[log truncated at 1 MB]";
|
|
26
|
+
/** The longest run key, in characters. */
|
|
27
|
+
export declare const RUN_KEY_MAX = 256;
|
|
28
|
+
/**
|
|
29
|
+
* A run's state (D24, ARCHITECTURE §7). `queued`: recorded, not yet started in a worker.
|
|
30
|
+
* `running`: started. `waiting` is reserved for a remote server's run that waits for its owner's
|
|
31
|
+
* instance (WP-28, D117); a page that doesn't know it treats it like `queued`. The others are
|
|
32
|
+
* final.
|
|
33
|
+
*/
|
|
34
|
+
export type RunStatus = "queued" | "running" | "waiting" | "succeeded" | "failed" | "cancelled";
|
|
35
|
+
/** Every run status. */
|
|
36
|
+
export declare const RUN_STATUSES: readonly RunStatus[];
|
|
37
|
+
/** Whether a run in `status` has ended. */
|
|
38
|
+
export declare function isFinalRunStatus(status: RunStatus): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Why a run ended the way it did, beside its status: `interrupted` (its worker or the instance
|
|
41
|
+
* stopped while it ran, D24), `threw` (the action threw), `unserializable` (its result is outside
|
|
42
|
+
* the type set), `too-large`, `parked` (its artifact's worker keeps crashing), `cancelled` (by a
|
|
43
|
+
* viewer), `unknown-function`. Later releases add reasons.
|
|
44
|
+
*/
|
|
45
|
+
export type RunReason = string;
|
|
46
|
+
/** A run's progress, as the action last reported it. */
|
|
47
|
+
export interface RunProgress {
|
|
48
|
+
/** From 0 to 1. */
|
|
49
|
+
readonly fraction?: number;
|
|
50
|
+
/** One short line for people. */
|
|
51
|
+
readonly message?: string;
|
|
52
|
+
}
|
|
53
|
+
/** The Zod schema of the `RunProgress` type. */
|
|
54
|
+
export declare const RunProgress: z.ZodType<RunProgress>;
|
|
55
|
+
/**
|
|
56
|
+
* One action run as a page reads it (D54): its state, progress, log and the result written so far.
|
|
57
|
+
* A result that is an async iterable grows item by item while the run is `running`.
|
|
58
|
+
*/
|
|
59
|
+
export interface RunState {
|
|
60
|
+
/** The run's `run_` ID. */
|
|
61
|
+
readonly runId: string;
|
|
62
|
+
/** The server function it runs: `<module path>#<export>`. */
|
|
63
|
+
readonly fnId: string;
|
|
64
|
+
/** The idempotency key it was started with, if any. */
|
|
65
|
+
readonly key?: string;
|
|
66
|
+
/** The run's state. */
|
|
67
|
+
readonly status: RunStatus;
|
|
68
|
+
/** Why it ended, for `failed` and `cancelled`. */
|
|
69
|
+
readonly reason?: RunReason;
|
|
70
|
+
/** Its latest progress. */
|
|
71
|
+
readonly progress?: RunProgress;
|
|
72
|
+
/** The log lines, capped at 1 MB with a marker line. */
|
|
73
|
+
readonly log: readonly string[];
|
|
74
|
+
/** The result's batches so far. */
|
|
75
|
+
readonly batches: Batches;
|
|
76
|
+
/** For `failed`: what went wrong, without the stack. */
|
|
77
|
+
readonly error?: WireError;
|
|
78
|
+
/** When it was recorded. */
|
|
79
|
+
readonly startedAt: string;
|
|
80
|
+
/** When it ended. */
|
|
81
|
+
readonly finishedAt?: string;
|
|
82
|
+
/** Whether this request joined a run that already existed (a key or a retried `clientKey`). */
|
|
83
|
+
readonly joined?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* The index of the first line in `log`, when the request said which lines the page holds
|
|
86
|
+
* (`RunAttachRequest.held`); absent: 0, the whole log.
|
|
87
|
+
*/
|
|
88
|
+
readonly logFrom?: number;
|
|
89
|
+
/** The index of the first batch in `batches`, as `logFrom`; absent: 0. */
|
|
90
|
+
readonly batchFrom?: number;
|
|
91
|
+
}
|
|
92
|
+
/** The Zod schema of the `RunState` type. */
|
|
93
|
+
export declare const RunState: z.ZodType<RunState>;
|
|
94
|
+
/**
|
|
95
|
+
* What changed in a run since a page last heard: a lossy notification on the event stream. Lines
|
|
96
|
+
* start at `logFrom` and batches at `batchFrom`; a page that holds fewer reads the run again
|
|
97
|
+
* (`runs/attach`).
|
|
98
|
+
*/
|
|
99
|
+
export interface RunDelta {
|
|
100
|
+
/** The run's `run_` ID. */
|
|
101
|
+
readonly runId: string;
|
|
102
|
+
/** The run's state. */
|
|
103
|
+
readonly status: RunStatus;
|
|
104
|
+
/** Why it ended so, for `failed` and `cancelled`. */
|
|
105
|
+
readonly reason?: RunReason;
|
|
106
|
+
/** Its latest progress. */
|
|
107
|
+
readonly progress?: RunProgress;
|
|
108
|
+
/** The index of the first line in `log`. */
|
|
109
|
+
readonly logFrom: number;
|
|
110
|
+
/** Log lines, starting at `logFrom`. */
|
|
111
|
+
readonly log: readonly string[];
|
|
112
|
+
/** The index of the first batch in `batches`. */
|
|
113
|
+
readonly batchFrom: number;
|
|
114
|
+
/** Result batches, starting at `batchFrom`. */
|
|
115
|
+
readonly batches: Batches;
|
|
116
|
+
/** What went wrong. */
|
|
117
|
+
readonly error?: WireError;
|
|
118
|
+
/** When it ended. */
|
|
119
|
+
readonly finishedAt?: string;
|
|
120
|
+
}
|
|
121
|
+
/** A live source's value as a page reads it (D56). */
|
|
122
|
+
export interface LiveState {
|
|
123
|
+
/** The idempotency key it was started with, if any. */
|
|
124
|
+
readonly key: string;
|
|
125
|
+
/** The value's revision, a decimal string that only grows; absent before any value. */
|
|
126
|
+
readonly revision?: string;
|
|
127
|
+
/** When the value was produced. */
|
|
128
|
+
readonly at?: string;
|
|
129
|
+
/** The latest value, serialized. */
|
|
130
|
+
readonly value?: Batches;
|
|
131
|
+
/**
|
|
132
|
+
* Append mode (`useLive(key, { mode: "append" })`): the values kept in the source's ring, oldest
|
|
133
|
+
* first, at most the window the page asked for.
|
|
134
|
+
*/
|
|
135
|
+
readonly ring?: readonly {
|
|
136
|
+
readonly revision: string;
|
|
137
|
+
readonly at: string;
|
|
138
|
+
readonly value: Batches;
|
|
139
|
+
}[];
|
|
140
|
+
/** The producer's last failure, while the last good value stays (FAILURE_MODEL §6). */
|
|
141
|
+
readonly error?: WireError;
|
|
142
|
+
}
|
|
143
|
+
/** One live update on the event stream: never stored as an event (D63, LL-04). */
|
|
144
|
+
export interface LiveUpdate {
|
|
145
|
+
/** The live source's key. */
|
|
146
|
+
readonly key: string;
|
|
147
|
+
/** The value's revision. */
|
|
148
|
+
readonly revision?: string;
|
|
149
|
+
/** When the value was produced. */
|
|
150
|
+
readonly at?: string;
|
|
151
|
+
/** The value, serialized. */
|
|
152
|
+
readonly value?: Batches;
|
|
153
|
+
/** What went wrong. */
|
|
154
|
+
readonly error?: WireError;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* An ephemeral message on a page's event stream (SSE `event: run` or `event: live`, without an
|
|
158
|
+
* `id`, so a reconnect's cursor is untouched) or in a poll's `ephemeral`: lossy, coalesced, and
|
|
159
|
+
* never stored as an event.
|
|
160
|
+
*/
|
|
161
|
+
export type EphemeralMessage = {
|
|
162
|
+
readonly kind: "run";
|
|
163
|
+
readonly run: RunDelta;
|
|
164
|
+
} | {
|
|
165
|
+
readonly kind: "live";
|
|
166
|
+
readonly live: LiveUpdate;
|
|
167
|
+
};
|
|
168
|
+
/** `POST …/call/{fnId}`: a plain server-function call, no durable record (D54). */
|
|
169
|
+
export interface CallRequest {
|
|
170
|
+
/** The view the page was opened as (D104). */
|
|
171
|
+
readonly viewId: string;
|
|
172
|
+
/** The arguments, serialized as one array value. */
|
|
173
|
+
readonly args: Batches;
|
|
174
|
+
}
|
|
175
|
+
/** The Zod schema of the `CallRequest` type. */
|
|
176
|
+
export declare const CallRequest: z.ZodType<CallRequest>;
|
|
177
|
+
/**
|
|
178
|
+
* One line of a plain call's answer (`application/x-ndjson`): a batch of the result, then the end.
|
|
179
|
+
*/
|
|
180
|
+
export type CallLine = {
|
|
181
|
+
readonly batch: readonly Frame[];
|
|
182
|
+
} | {
|
|
183
|
+
readonly end: {
|
|
184
|
+
readonly status: "succeeded";
|
|
185
|
+
};
|
|
186
|
+
} | {
|
|
187
|
+
readonly end: {
|
|
188
|
+
readonly status: "failed";
|
|
189
|
+
readonly error: WireError;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
/** `POST …/runs`: start a durable action run, or join one (D54, AC-02, AC-03). */
|
|
193
|
+
export interface RunRequest {
|
|
194
|
+
/** The view the page was opened as (D104). */
|
|
195
|
+
readonly viewId: string;
|
|
196
|
+
/** `<module path>#<export>`. */
|
|
197
|
+
readonly fnId: string;
|
|
198
|
+
/** The arguments, serialized as one array value. */
|
|
199
|
+
readonly args: Batches;
|
|
200
|
+
/** The author's idempotency key: one run per artifact, function and key, ever. */
|
|
201
|
+
readonly key?: string;
|
|
202
|
+
/** A fresh ID per invocation, so a retried request joins the run it already started. */
|
|
203
|
+
readonly clientKey: string;
|
|
204
|
+
}
|
|
205
|
+
/** The Zod schema of the `RunRequest` type. */
|
|
206
|
+
export declare const RunRequest: z.ZodType<RunRequest>;
|
|
207
|
+
/**
|
|
208
|
+
* `POST …/runs/attach`: read runs and hear their changes on the event stream for the next minute
|
|
209
|
+
* (re-attach after a reload, AC-02). By ID, or by function and key.
|
|
210
|
+
*/
|
|
211
|
+
export interface RunAttachRequest {
|
|
212
|
+
/** The view the page was opened as (D104). */
|
|
213
|
+
readonly viewId: string;
|
|
214
|
+
/** Runs by ID. */
|
|
215
|
+
readonly runIds?: readonly string[];
|
|
216
|
+
/** Runs by function and key. */
|
|
217
|
+
readonly keyed?: readonly {
|
|
218
|
+
readonly fnId: string;
|
|
219
|
+
readonly key: string;
|
|
220
|
+
}[];
|
|
221
|
+
/**
|
|
222
|
+
* What the page already holds of runs it names by ID: so many log lines and batches. Each such
|
|
223
|
+
* run's answer starts there (`RunState.logFrom`, `batchFrom`), so a page renewing its interest
|
|
224
|
+
* doesn't read the whole run again (Opus review 14).
|
|
225
|
+
*/
|
|
226
|
+
readonly held?: readonly {
|
|
227
|
+
readonly runId: string;
|
|
228
|
+
readonly log: number;
|
|
229
|
+
readonly batches: number;
|
|
230
|
+
}[];
|
|
231
|
+
}
|
|
232
|
+
/** The Zod schema of the `RunAttachRequest` type. */
|
|
233
|
+
export declare const RunAttachRequest: z.ZodType<RunAttachRequest>;
|
|
234
|
+
/** `POST …/runs/{id}/cancel`. */
|
|
235
|
+
export interface RunCancelRequest {
|
|
236
|
+
/** The view the page was opened as (D104). */
|
|
237
|
+
readonly viewId: string;
|
|
238
|
+
}
|
|
239
|
+
/** The Zod schema of the `RunCancelRequest` type. */
|
|
240
|
+
export declare const RunCancelRequest: z.ZodType<RunCancelRequest>;
|
|
241
|
+
/** The keys of live sources: like JavaScript export names, which is what `live.ts` declares. */
|
|
242
|
+
export declare const LIVE_KEY_PATTERN: RegExp;
|
|
243
|
+
/** The largest live value, in characters of serialized JSON (DATA_MODEL §5's 4 MiB). */
|
|
244
|
+
export declare const LIVE_VALUE_MAX: number;
|
|
245
|
+
/** The ring size of a pushed source in append mode that no `defineLive` sized. */
|
|
246
|
+
export declare const LIVE_RING_DEFAULT = 1024;
|
|
247
|
+
/** The largest ring a source may keep. */
|
|
248
|
+
export declare const LIVE_RING_MAX = 1e5;
|
|
249
|
+
/**
|
|
250
|
+
* `POST …/live`: read live sources and keep their producers running for this view for the next
|
|
251
|
+
* minute (D56, LL-04); a page asks again while it shows them.
|
|
252
|
+
*/
|
|
253
|
+
export interface LiveRequest {
|
|
254
|
+
/** The view the page was opened as (D104). */
|
|
255
|
+
readonly viewId: string;
|
|
256
|
+
/**
|
|
257
|
+
* The sources, each with its append window; `refresh` asks the source's producer to load again
|
|
258
|
+
* now (`useLive`'s `refresh()`).
|
|
259
|
+
*/
|
|
260
|
+
readonly keys: readonly {
|
|
261
|
+
readonly key: string;
|
|
262
|
+
readonly window?: number;
|
|
263
|
+
readonly refresh?: boolean;
|
|
264
|
+
}[];
|
|
265
|
+
}
|
|
266
|
+
/** The Zod schema of the `LiveRequest` type. */
|
|
267
|
+
export declare const LiveRequest: z.ZodType<LiveRequest>;
|
|
268
|
+
/** Secret names: letters, digits, `_`, `.` and `-`, starting with a letter or `_` (D44). */
|
|
269
|
+
export declare const SECRET_NAME_PATTERN: RegExp;
|
|
270
|
+
/** The largest secret value, in UTF-8 bytes. */
|
|
271
|
+
export declare const SECRET_VALUE_MAX: number;
|
|
272
|
+
//#endregion
|
|
273
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","names":[],"sources":["../src/actions.ts"],"mappings":";;;;YAgBY,6BAA6B;;;;;qBAM5B,SAAS,EAAE,QAAQ;;iBASf,oBAAoB;;WAE1B;;;qBAIE,aAAa,EAAE,QAAQ;;qBAYvB;;qBAGA;;qBAGA;;qBAGA;;qBAGA;;;;;;;YAQD;;qBAGC,uBAAuB;;wBAUpB,iBAAiB,QAAQ;;;;;;;YAU7B;;iBAGK;;WAEN;;WAEA;;;qBAIE,aAAa,EAAE,QAAQ;;;;;iBAcnB;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;WAER,SAAS;;WAET,WAAW;;WAEX;;WAEA,SAAS;;WAET,QAAQ;;WAER;;WAEA;;WAEA;;;;;WAKA;;WAEA;;;qBAIE,UAAU,EAAE,QAAQ;;;;;;iBA2BhB;;WAEN;;WAEA,QAAQ;;WAER,SAAS;;WAET,WAAW;;WAEX;;WAEA;;WAEA;;WAEA,SAAS;;WAET,QAAQ;;WAER;;;iBAIM;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;;;;WAKR;aACE;aACA;aACA,OAAO;;;WAGT,QAAQ;;;iBAIF;;WAEN;;WAEA;;WAEA;;WAEA,QAAQ;;WAER,QAAQ;;;;;;;YAQP;WACG;WAAsB,KAAK;;WAC3B;WAAuB,MAAM;;;iBAG3B;;WAEN;;WAEA,MAAM;;;qBAIJ,aAAa,EAAE,QAAQ;;;;YAUxB;WACG,gBAAgB;;WAChB;aAAgB;;;WAChB;aAAgB;aAA2B,OAAO;;;;iBAGhD;;WAEN;;WAEA;;WAEA,MAAM;;WAEN;;WAEA;;;qBAIE,YAAY,EAAE,QAAQ;;;;;iBAiBlB;;WAEN;;WAEA;;WAEA;aAA4B;aAAuB;;;;;;;WAMnD;aACE;aACA;aACA;;;;qBAKA,kBAAkB,EAAE,QAAQ;;iBA6BxB;;WAEN;;;qBAIE,kBAAkB,EAAE,QAAQ;;qBAK5B,kBAAkB;;qBAGlB;;qBAGA;;qBAGA;;;;;iBAMI;;WAEN;;;;;WAKA;aACE;aACA;aACA;;;;qBAKA,aAAa,EAAE,QAAQ;;qBAoBvB,qBAAqB;;qBAGrB"}
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { wireRegistry } from "./wire-registry.js";
|
|
2
|
+
import { ViewId } from "./ids.js";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
//#region src/actions.ts
|
|
5
|
+
/**
|
|
6
|
+
* Actions, live data and secrets (INTERFACES §2.4, §4, §6; D24, D44, D54, D56): the shapes the
|
|
7
|
+
* browser protocol, the host protocol and the worker channel share. Server-function arguments and
|
|
8
|
+
* results travel as the serializer's batches (`Batches`).
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* const run: RunState = await post("runs", { viewId, fnId: "actions.ts#sendReply", args, clientKey });
|
|
12
|
+
* if (run.status === "succeeded") show(await deserializeAll(run.batches));
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* The Zod schema of the `Batches` type: a list of batches, each a list of frames. The frames
|
|
17
|
+
* themselves are checked by the reader (`ValueReader`), which refuses anything malformed.
|
|
18
|
+
*/
|
|
19
|
+
const Batches = z.array(z.array(z.record(z.string(), z.unknown())).readonly()).readonly().register(wireRegistry, {
|
|
20
|
+
id: "Batches",
|
|
21
|
+
description: "A serialized server-function value: its batches of frames, in order."
|
|
22
|
+
});
|
|
23
|
+
/** The Zod schema of the `ActionError` type. */
|
|
24
|
+
const ActionError = z.object({
|
|
25
|
+
message: z.string(),
|
|
26
|
+
code: z.string().exactOptional(),
|
|
27
|
+
stack: z.string().exactOptional()
|
|
28
|
+
}).register(wireRegistry, {
|
|
29
|
+
id: "ActionError",
|
|
30
|
+
description: "An error from server code: its message and diagnostic code."
|
|
31
|
+
});
|
|
32
|
+
/** The largest serialized arguments a call or run takes, in characters of JSON. */
|
|
33
|
+
const ACTION_ARGS_MAX = 16777216;
|
|
34
|
+
/** The largest serialized result a run keeps, in characters of JSON (larger fails the run). */
|
|
35
|
+
const ACTION_RESULT_MAX = 16777216;
|
|
36
|
+
/** The cap of a run's log, in UTF-16 code units of its lines (D47's 1 MB). */
|
|
37
|
+
const RUN_LOG_MAX = 1048576;
|
|
38
|
+
/** The line a capped log ends with. */
|
|
39
|
+
const RUN_LOG_TRUNCATED = "[log truncated at 1 MB]";
|
|
40
|
+
/** The longest run key, in characters. */
|
|
41
|
+
const RUN_KEY_MAX = 256;
|
|
42
|
+
/** Every run status. */
|
|
43
|
+
const RUN_STATUSES = [
|
|
44
|
+
"queued",
|
|
45
|
+
"running",
|
|
46
|
+
"waiting",
|
|
47
|
+
"succeeded",
|
|
48
|
+
"failed",
|
|
49
|
+
"cancelled"
|
|
50
|
+
];
|
|
51
|
+
/** Whether a run in `status` has ended. */
|
|
52
|
+
function isFinalRunStatus(status) {
|
|
53
|
+
return status === "succeeded" || status === "failed" || status === "cancelled";
|
|
54
|
+
}
|
|
55
|
+
/** The Zod schema of the `RunProgress` type. */
|
|
56
|
+
const RunProgress = z.object({
|
|
57
|
+
fraction: z.number().min(0).max(1).exactOptional(),
|
|
58
|
+
message: z.string().max(1e3).exactOptional()
|
|
59
|
+
}).register(wireRegistry, {
|
|
60
|
+
id: "RunProgress",
|
|
61
|
+
description: "A run's progress: fraction and message."
|
|
62
|
+
});
|
|
63
|
+
/** The Zod schema of the `RunState` type. */
|
|
64
|
+
const RunState = z.object({
|
|
65
|
+
runId: z.string(),
|
|
66
|
+
fnId: z.string(),
|
|
67
|
+
key: z.string().exactOptional(),
|
|
68
|
+
status: z.enum(RUN_STATUSES),
|
|
69
|
+
reason: z.string().exactOptional(),
|
|
70
|
+
progress: RunProgress.exactOptional(),
|
|
71
|
+
log: z.array(z.string()).readonly(),
|
|
72
|
+
batches: Batches,
|
|
73
|
+
error: z.object({
|
|
74
|
+
message: z.string(),
|
|
75
|
+
code: z.string().exactOptional()
|
|
76
|
+
}).exactOptional(),
|
|
77
|
+
startedAt: z.string(),
|
|
78
|
+
finishedAt: z.string().exactOptional(),
|
|
79
|
+
joined: z.boolean().exactOptional(),
|
|
80
|
+
logFrom: z.number().int().nonnegative().exactOptional(),
|
|
81
|
+
batchFrom: z.number().int().nonnegative().exactOptional()
|
|
82
|
+
}).register(wireRegistry, {
|
|
83
|
+
id: "RunState",
|
|
84
|
+
description: "An action run: status, progress, log and the result written so far."
|
|
85
|
+
});
|
|
86
|
+
/** The Zod schema of the `CallRequest` type. */
|
|
87
|
+
const CallRequest = z.object({
|
|
88
|
+
viewId: ViewId.schema,
|
|
89
|
+
args: Batches
|
|
90
|
+
}).register(wireRegistry, {
|
|
91
|
+
id: "CallRequest",
|
|
92
|
+
description: "A plain server-function call: the view and the serialized arguments."
|
|
93
|
+
});
|
|
94
|
+
/** The Zod schema of the `RunRequest` type. */
|
|
95
|
+
const RunRequest = z.object({
|
|
96
|
+
viewId: ViewId.schema,
|
|
97
|
+
fnId: z.string().min(3).max(1024),
|
|
98
|
+
args: Batches,
|
|
99
|
+
key: z.string().min(1).max(256).exactOptional(),
|
|
100
|
+
clientKey: z.string().min(8).max(64)
|
|
101
|
+
}).register(wireRegistry, {
|
|
102
|
+
id: "RunRequest",
|
|
103
|
+
description: "Start or join an action run: the function, its arguments and keys."
|
|
104
|
+
});
|
|
105
|
+
/** The Zod schema of the `RunAttachRequest` type. */
|
|
106
|
+
const RunAttachRequest = z.object({
|
|
107
|
+
viewId: ViewId.schema,
|
|
108
|
+
runIds: z.array(z.string().max(64)).max(100).readonly().exactOptional(),
|
|
109
|
+
keyed: z.array(z.object({
|
|
110
|
+
fnId: z.string().min(3).max(1024),
|
|
111
|
+
key: z.string().min(1).max(256)
|
|
112
|
+
})).max(100).readonly().exactOptional(),
|
|
113
|
+
held: z.array(z.object({
|
|
114
|
+
runId: z.string().max(64),
|
|
115
|
+
log: z.number().int().nonnegative(),
|
|
116
|
+
batches: z.number().int().nonnegative()
|
|
117
|
+
})).max(100).readonly().exactOptional()
|
|
118
|
+
}).register(wireRegistry, {
|
|
119
|
+
id: "RunAttachRequest",
|
|
120
|
+
description: "Runs a page reads and follows: by ID, or by function and key."
|
|
121
|
+
});
|
|
122
|
+
/** The Zod schema of the `RunCancelRequest` type. */
|
|
123
|
+
const RunCancelRequest = z.object({ viewId: ViewId.schema }).register(wireRegistry, {
|
|
124
|
+
id: "RunCancelRequest",
|
|
125
|
+
description: "Cancel a run, from a view."
|
|
126
|
+
});
|
|
127
|
+
/** The keys of live sources: like JavaScript export names, which is what `live.ts` declares. */
|
|
128
|
+
const LIVE_KEY_PATTERN = /^[A-Za-z_$][A-Za-z0-9_$]{0,127}$/;
|
|
129
|
+
/** The largest live value, in characters of serialized JSON (DATA_MODEL §5's 4 MiB). */
|
|
130
|
+
const LIVE_VALUE_MAX = 4194304;
|
|
131
|
+
/** The ring size of a pushed source in append mode that no `defineLive` sized. */
|
|
132
|
+
const LIVE_RING_DEFAULT = 1024;
|
|
133
|
+
/** The largest ring a source may keep. */
|
|
134
|
+
const LIVE_RING_MAX = 1e5;
|
|
135
|
+
/** The Zod schema of the `LiveRequest` type. */
|
|
136
|
+
const LiveRequest = z.object({
|
|
137
|
+
viewId: ViewId.schema,
|
|
138
|
+
keys: z.array(z.object({
|
|
139
|
+
key: z.string().regex(LIVE_KEY_PATTERN),
|
|
140
|
+
window: z.int().min(1).max(LIVE_RING_MAX).exactOptional(),
|
|
141
|
+
refresh: z.boolean().exactOptional()
|
|
142
|
+
})).max(256).readonly()
|
|
143
|
+
}).register(wireRegistry, {
|
|
144
|
+
id: "LiveRequest",
|
|
145
|
+
description: "Live sources a page reads and keeps running: keys and append windows."
|
|
146
|
+
});
|
|
147
|
+
/** Secret names: letters, digits, `_`, `.` and `-`, starting with a letter or `_` (D44). */
|
|
148
|
+
const SECRET_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_.-]{0,127}$/;
|
|
149
|
+
/** The largest secret value, in UTF-8 bytes. */
|
|
150
|
+
const SECRET_VALUE_MAX = 65536;
|
|
151
|
+
//#endregion
|
|
152
|
+
export { ACTION_ARGS_MAX, ACTION_RESULT_MAX, ActionError, Batches, CallRequest, LIVE_KEY_PATTERN, LIVE_RING_DEFAULT, LIVE_RING_MAX, LIVE_VALUE_MAX, LiveRequest, RUN_KEY_MAX, RUN_LOG_MAX, RUN_LOG_TRUNCATED, RUN_STATUSES, RunAttachRequest, RunCancelRequest, RunProgress, RunRequest, RunState, SECRET_NAME_PATTERN, SECRET_VALUE_MAX, isFinalRunStatus };
|
|
153
|
+
|
|
154
|
+
//# sourceMappingURL=actions.js.map
|