@imagelab/protocol (0.29.0)

Published 2026-10-22 13:23:41 -07:00 by donny

Installation

@imagelab:registry=https://gitea.dev.blueoceanswim.com/api/packages/donny/npm/
npm install @imagelab/protocol@0.29.0
"@imagelab/protocol": "0.29.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

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)

  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-22 13:23:41 -07:00
16
UNLICENSED
72 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