Shared Protocol Buffers contracts for Pulsefield clients and model services.
Project description
Pulsefield Protocol
Shared protocol package for projects under github.com/Pulsefield.
Repository Layout
proto/ Protocol Buffers source of truth.
gen/swift/ Generated SwiftProtobuf code, committed and shipped.
gen/python/ Generated Python protobuf code and type stubs, committed and shipped.
docs/ Protocol notes shipped with the npm package.
tools/ Local generation and drift-check scripts.
Package.swift SwiftPM manifest for Swift/Xcode consumers.
pyproject.toml Python package metadata for wheel/sdist consumers.
buf.yaml Proto lint and breaking-change configuration.
buf.gen.yaml Swift and Python generation configuration.
The Swift app and Python model consume generated code from gen/. The .proto files remain the protocol source of truth. WebSocket payloads should be binary protobuf Envelope messages. JSON is reserved for debug and logs.
See Protocol Guidelines for schema evolution, naming, and comment conventions. See Session Scope for Envelope.session_id requirements by payload.
The v1 protobuf source is split by responsibility:
proto/pulsefield/protocol/v1/core.proto
Node identity, roles, and advertised capabilities.
proto/pulsefield/protocol/v1/envelope.proto
Transport envelope, routing metadata, correlation ids, and payload union.
proto/pulsefield/protocol/v1/inference.proto
Inference requests, lifecycle status, errors, and end-of-stream events.
proto/pulsefield/protocol/v1/mapper.proto
Opaque mapper token events.
Current Scope
This package owns the stable cross-language contract between Pulsefield clients, the Python model endpoint, and npm consumers:
- Node graph identity for host, player client, model service, hardware, and debug-tool processes.
- Inference WebSocket envelopes: ready, audio, reference time, stop, status, error, hitobject token, and end-of-stream.
- Opaque mapper token stream events tagged with a token-contract version.
This package does not own token decoding, decoded Mania4K/domain state, model inference internals, Torch checkpoints, timing fitting algorithms, SwiftUI state, rendering, judgement, input routing, audio clock implementations, or full .osu parsing/export.
Distribution Surfaces
This repository publishes the same protocol contract through multiple language-native surfaces. Downstream Swift and Python projects do not need their own package.json.
npm
The npm package remains useful for Node tooling, registry-backed tarballs, and consumers that want direct access to proto/ and gen/:
npm install @pulsefield/protocol
SwiftPM
Swift/Xcode consumers should depend on this Git repository directly:
.package(
url: "https://github.com/Pulsefield/protocol.git",
from: "0.0.3"
)
Then add the product to a target:
.product(name: "PulsefieldProtocol", package: "protocol")
SwiftPM publication is Git-tag based. Create and push a semver tag such as 0.0.3; no central Swift registry is required for this bootstrap path.
Python
Python consumers should eventually use the PyPI package:
pip install pulsefield-protocol==0.0.3
The local bootstrap build is:
python3 -m pip install build
python3 -m build --sdist --wheel --outdir dist/
python3 -m pip install dist/*.whl
python3 -c "from pulsefield.protocol.v1 import envelope_pb2; envelope_pb2.Envelope()"
Generated Python classes live in the module for their source .proto file. For example, import Envelope from envelope_pb2, inference messages from inference_pb2, mapper token messages from mapper_pb2, and node graph messages from core_pb2.
The Publish Python package GitHub workflow is manual and expects PyPI trusted publishing to be configured for the repository/environment before it is run.
Development Tools
- Node.js package manager:
npm@11.12.1, recorded inpackage.json. - Runtime floor: Node.js
>=22.0.0. - Protobuf workflow: local npm binaries, not global installs.
- Proto lint/generation:
@bufbuild/buf. - Swift generation: Buf remote plugin
buf.build/apple/swift. - Python generation: Buf remote plugins
buf.build/protocolbuffers/pythonandbuf.build/protocolbuffers/pyi. - Formatting:
prettier.
Commands
npm run generate
npm run proto:lint
npm run proto:generate
npm run generated:check
npm run check
npm run python:check
npm run swift:build
npm run bootstrap:check
npm run generated:check regenerates Swift and Python outputs in a temporary directory and compares them byte-for-byte with gen/. It also verifies that the generated Python stubs and Swift file expose the same message, enum, and field surface declared by the proto.
License
Licensed under the Apache License, Version 2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pulsefield_protocol-0.0.3.tar.gz.
File metadata
- Download URL: pulsefield_protocol-0.0.3.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f285547a5cde056814dfc46b1e0be672edd8a1b9626542dffbee50dd45e4a0d
|
|
| MD5 |
a24e2b9afa9ded11f2fa606b7191787c
|
|
| BLAKE2b-256 |
904c9f67b0af2de4e232e12944a96a10ffe7c90087305a21184ae0cf680d7a42
|
Provenance
The following attestation bundles were made for pulsefield_protocol-0.0.3.tar.gz:
Publisher:
publish-python.yml on Pulsefield/protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pulsefield_protocol-0.0.3.tar.gz -
Subject digest:
1f285547a5cde056814dfc46b1e0be672edd8a1b9626542dffbee50dd45e4a0d - Sigstore transparency entry: 1817701566
- Sigstore integration time:
-
Permalink:
Pulsefield/protocol@0bfe1456f5d6706802b2d1721b383c0b23d4a689 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Pulsefield
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@0bfe1456f5d6706802b2d1721b383c0b23d4a689 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file pulsefield_protocol-0.0.3-py3-none-any.whl.
File metadata
- Download URL: pulsefield_protocol-0.0.3-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c45aea1961672be5a2eed9ba3d5d9ca40ebbd9b6f39736467a43df7df69571d
|
|
| MD5 |
2a5cff0cd05e84a7160ed4eb6e9c7d78
|
|
| BLAKE2b-256 |
234518d32f278cfb93607fefd1455174a055d6b388d3053e4ff4fd6ef2150500
|
Provenance
The following attestation bundles were made for pulsefield_protocol-0.0.3-py3-none-any.whl:
Publisher:
publish-python.yml on Pulsefield/protocol
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pulsefield_protocol-0.0.3-py3-none-any.whl -
Subject digest:
2c45aea1961672be5a2eed9ba3d5d9ca40ebbd9b6f39736467a43df7df69571d - Sigstore transparency entry: 1817701703
- Sigstore integration time:
-
Permalink:
Pulsefield/protocol@0bfe1456f5d6706802b2d1721b383c0b23d4a689 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Pulsefield
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-python.yml@0bfe1456f5d6706802b2d1721b383c0b23d4a689 -
Trigger Event:
workflow_dispatch
-
Statement type: