@imagelab/protocol (0.37.0)
Installation
@imagelab:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/npm install @imagelab/protocol@0.37.0"@imagelab/protocol": "0.37.0"About this package
@imagelab/protocol
The ImageLab wire protocol: zod schemas (and their TypeScript types) for every
message between the browser, the server and the worker agents, plus the binary
frame helpers. The only dependency is zod. Source of truth:
packages/protocol in donny/imagelab-server; it is published to the Gitea npm
registry so imagelab-web installs it instead of copying it.
Install
Anonymous reads work on this Gitea: the donny account is public, and Gitea
grants package read access by the owner's visibility, not the repo's. Checked
with 0.1.0: a scratch Bun project with only the line below and no token
installed it and parsed a message. So the consumer's .npmrc (project root)
needs just the scope line:
@imagelab:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/
then
bun add @imagelab/protocol
No token is needed, in CI either. Do not add an _authToken line whose
variable may be unset: with
//gitea.dev.blueoceanswim.com/api/packages/donny/npm/:_authToken=${GITEA_NPM_READ_TOKEN}
and GITEA_NPM_READ_TOKEN empty, Bun sends an empty token and the install fails
with GET .../@imagelab%2fprotocol - 401. Add that line (with a Gitea personal
access token whose package scope is read, stored as a CI secret) only if
the donny account or its packages ever become private.
Use
import { rtSubscribeSchema, newEnvelope, type RtSubscribe } from "@imagelab/protocol";
const msg: RtSubscribe = rtSubscribeSchema.parse({ ...newEnvelope(), type: "subscribe", lastEventId: 41 });
The package is ESM only (dist/index.js + .d.ts).
Release (in imagelab-server)
- Bump
versioninpackages/protocol/package.json(semver; the wire protocol version isPROTOCOL_VERSION, separate from the package version) and commit tomain. git tag protocol-v<version> && git push origin protocol-v<version>.
.gitea/workflows/publish-protocol.yml then checks that the tag matches the
version and that the version is not published yet (scripts/release-check.ts;
Gitea never overwrites a published version), runs typecheck and the protocol
tests, builds dist/, smoke-tests it with Node and runs npm publish. It needs
the repo Actions secret NPM_PUBLISH_TOKEN (a personal access token with
package read and write). Run bun run build here to inspect dist/ locally.
Inside imagelab-server, other workspaces import the source directly
(tsconfig.base.json maps @imagelab/protocol to src/index.ts), so no build
is needed for development.
Dependencies
Dependencies
| ID | Version |
|---|---|
| zod | ^4.6.7 |