@imagelab/protocol (0.1.0)

Published 2026-10-21 18:40:16 -07:00 by donny

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 wire protocol: zod schemas for browser<->server and server<->agent messages, and the binary frame helpers.

@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)

  1. Bump version in packages/protocol/package.json (semver; the wire protocol version is PROTOCOL_VERSION, separate from the package version) and commit to main.
  2. 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
Details
npm
2026-10-21 18:40:16 -07:00
19
UNLICENSED
15 KiB
Assets (1)
Versions (64) View all
0.79.0 2026-12-02
0.78.0 2026-11-26
0.77.0 2026-11-26
0.76.0 2026-11-22
0.74.0 2026-11-22