@imagelab/protocol (0.1.0)
Installation
@imagelab:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/npm install @imagelab/protocol@0.1.0"@imagelab/protocol": "0.1.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
Add to the consumer's .npmrc (project root):
@imagelab:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/
//gitea.dev.blueoceanswim.com/api/packages/donny/npm/:_authToken=${GITEA_NPM_READ_TOKEN}
then
bun add @imagelab/protocol
Bun and npm both expand ${GITEA_NPM_READ_TOKEN} from the environment, so the
token never goes into the file. It is a Gitea personal access token with the
package scope set to read (Gitea → Settings → Applications → Generate New
Token). In CI, store it as an Actions secret and expose it as
GITEA_NPM_READ_TOKEN on the install step.
Anonymous reads: the donny account and its packages are public on this
Gitea (anonymously, https://gitea.dev.blueoceanswim.com/donny/-/packages and
its package pages answer 200, while the private repo answers 404), and Gitea
gives package read access by the owner's visibility, not the repo's. So the
_authToken line should be optional for installs. This is confirmed by the
first published version: if an install without the line gets a 401, keep the
read token above.
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 |