@pulsefield/protocol 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,123 @@
1
+ # Protocol Guidelines
2
+
3
+ ## Intent
4
+
5
+ This package defines the shared protobuf contract for Pulsefield clients and model services. The goal is to keep the protocol easy to evolve while avoiding accidental wire-format breakage.
6
+
7
+ ## Change Policy
8
+
9
+ During early `0.x` development, breaking changes are allowed when all known consumers are updated in the same release.
10
+
11
+ Once the protocol is used by independently updated clients, prefer additive changes:
12
+
13
+ - Add new fields with fresh numbers.
14
+ - Add new enum values with fresh numbers.
15
+ - Add new `Envelope.payload` variants with fresh numbers.
16
+
17
+ Avoid reusing field numbers from published schemas. If a field was removed after publication, reserve its old number and name when practical.
18
+
19
+ Moving a message to another `.proto` file can preserve its fully qualified protobuf type name and binary wire compatibility, but it changes generated module/file boundaries in languages such as Python. Treat those moves as generated API breaks during `0.x`, document the import migration, and update known consumers in the same release.
20
+
21
+ ## Source Of Truth
22
+
23
+ - `.proto` files under `proto/` are the source of truth.
24
+ - Keep transport, graph/core vocabulary, inference, and opaque mapper token events in separate source files when the concepts can evolve independently.
25
+ - Breaking-change checks use package-level compatibility so source files can be reorganized without treating stable fully qualified type moves as wire breaks.
26
+ - Generated code under `gen/` is committed for Swift/Python consumers.
27
+ - WebSocket payloads should use binary protobuf `Envelope`.
28
+
29
+ ## Responsibility Boundary
30
+
31
+ This package should contain stable, cross-process protocol contracts:
32
+
33
+ - Node graph identity, roles, and capability announcements for host, player client, model service, hardware, and debug-tool processes.
34
+ - Inference endpoint messages and lifecycle states.
35
+ - Machine-readable enums and error codes shared by Swift, Python, and npm consumers.
36
+ - Opaque token-stream events tagged with the token-contract version needed by Swift/model-side decoders.
37
+ - Generated artifacts that prove those contracts are stable.
38
+
39
+ Keep implementation details in their owning repositories:
40
+
41
+ - Model training, Torch runtime, checkpoint loading, mel/control features, grammar decoding, and timing fitting algorithms stay in `Pulsefield-model`.
42
+ - Token decoding, decoded Mania4K/domain state, SwiftUI view state, AVFoundation clocks, input routing, rendering, judgement, scoring, and local-library/recognition integrations stay in `Pulsefield`.
43
+ - Full `.osu` import/export behavior stays outside this protocol.
44
+
45
+ ## Inference Lifecycle
46
+
47
+ The v1 endpoint lifecycle is:
48
+
49
+ ```text
50
+ ready -> audio_preparing -> audio_ready -> streaming -> stopped
51
+ \-> failed
52
+ ```
53
+
54
+ Use `StatusEvent` when a service sends lifecycle transitions over the protocol. The current model endpoint logs `ws_status`; new protobuf consumers should prefer `StatusEvent`.
55
+
56
+ ## Token Contract
57
+
58
+ The protobuf layer treats mapper tokens as opaque ids plus `token_contract_version`. Token decoding tables, lane actions, quantization rules, and reducer/domain state belong in the Swift and model repositories that share the token-stream transport definitions.
59
+
60
+ ## Comments
61
+
62
+ Comments should explain protocol meaning, not restate the field name.
63
+
64
+ Add comments when:
65
+
66
+ - A message represents a wire-level event or request.
67
+ - A field has units, clock source, ordering semantics, or lifecycle assumptions.
68
+ - A field is optional and absence has a distinct meaning.
69
+ - An enum value is non-obvious.
70
+ - A value is experimental or temporary.
71
+ - A field exists for compatibility with a specific consumer.
72
+
73
+ Prefer comments like:
74
+
75
+ ```proto
76
+ // Sent by the client to request beatmap inference for an audio source.
77
+ message AudioRequest {
78
+ // Local or sandbox-relative path understood by the receiving model service.
79
+ string audio_path = 1;
80
+
81
+ // Duration of the selected audio in milliseconds, when known by the client.
82
+ optional uint32 audio_length_ms = 2;
83
+ }
84
+ ```
85
+
86
+ Avoid comments like:
87
+
88
+ ```proto
89
+ // The audio path.
90
+ string audio_path = 1;
91
+ ```
92
+
93
+ ## Naming And Units
94
+
95
+ - Use `snake_case` field names.
96
+ - Include units in names when they clarify meaning, such as `_ms`, `_unix_ms`, `_count`, or `_id`.
97
+ - Use `*_UNSPECIFIED = 0` for enum defaults.
98
+ - Prefer enums for machine-readable state.
99
+ - Use strings for human-facing or debug messages.
100
+
101
+ ## Validation
102
+
103
+ The schema defines shape. Runtime code still validates behavior:
104
+
105
+ - Payload is present.
106
+ - `session_id` is known.
107
+ - `sequence` ordering is acceptable.
108
+ - Time values are in expected ranges.
109
+ - State transitions make sense.
110
+
111
+ ## Workflow
112
+
113
+ Use local npm scripts:
114
+
115
+ ```sh
116
+ npm run generate
117
+ npm run proto:format
118
+ npm run proto:lint
119
+ npm run generated:check
120
+ npm run check
121
+ ```
122
+
123
+ Generated Swift/Python files must be updated in the same change as proto edits. `npm run generated:check` compares committed outputs with fresh Buf generation and checks that Python stubs and Swift generated code expose the same proto surface.
package/Package.swift ADDED
@@ -0,0 +1,34 @@
1
+ // swift-tools-version: 6.0
2
+
3
+ import PackageDescription
4
+
5
+ let package = Package(
6
+ name: "PulsefieldProtocol",
7
+ products: [
8
+ .library(
9
+ name: "PulsefieldProtocol",
10
+ targets: ["PulsefieldProtocol"]
11
+ )
12
+ ],
13
+ dependencies: [
14
+ .package(
15
+ url: "https://github.com/apple/swift-protobuf.git",
16
+ from: "1.38.0"
17
+ )
18
+ ],
19
+ targets: [
20
+ .target(
21
+ name: "PulsefieldProtocol",
22
+ dependencies: [
23
+ .product(name: "SwiftProtobuf", package: "swift-protobuf")
24
+ ],
25
+ path: "gen/swift",
26
+ sources: [
27
+ "pulsefield/protocol/v1/core.pb.swift",
28
+ "pulsefield/protocol/v1/envelope.pb.swift",
29
+ "pulsefield/protocol/v1/inference.pb.swift",
30
+ "pulsefield/protocol/v1/mapper.pb.swift",
31
+ ]
32
+ )
33
+ ]
34
+ )
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # Pulsefield Protocol
2
+
3
+ Shared protocol package for projects under [github.com/Pulsefield](https://github.com/Pulsefield).
4
+
5
+ ## Repository Layout
6
+
7
+ ```text
8
+ proto/ Protocol Buffers source of truth.
9
+ gen/swift/ Generated SwiftProtobuf code, committed and shipped.
10
+ gen/python/ Generated Python protobuf code and type stubs, committed and shipped.
11
+ docs/ Protocol notes shipped with the npm package.
12
+ tools/ Local generation and drift-check scripts.
13
+ Package.swift SwiftPM manifest for Swift/Xcode consumers.
14
+ pyproject.toml Python package metadata for wheel/sdist consumers.
15
+ buf.yaml Proto lint and breaking-change configuration.
16
+ buf.gen.yaml Swift and Python generation configuration.
17
+ ```
18
+
19
+ 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.
20
+
21
+ See [Protocol Guidelines](./PROTOCOL_GUIDELINES.md) for schema evolution, naming, and comment conventions. See [Session Scope](./docs/session-scope.md) for `Envelope.session_id` requirements by payload.
22
+
23
+ The v1 protobuf source is split by responsibility:
24
+
25
+ ```text
26
+ proto/pulsefield/protocol/v1/core.proto
27
+ Node identity, roles, and advertised capabilities.
28
+
29
+ proto/pulsefield/protocol/v1/envelope.proto
30
+ Transport envelope, routing metadata, correlation ids, and payload union.
31
+
32
+ proto/pulsefield/protocol/v1/inference.proto
33
+ Inference requests, lifecycle status, errors, and end-of-stream events.
34
+
35
+ proto/pulsefield/protocol/v1/mapper.proto
36
+ Opaque mapper token events.
37
+ ```
38
+
39
+ ## Current Scope
40
+
41
+ This package owns the stable cross-language contract between Pulsefield clients, the Python model endpoint, and npm consumers:
42
+
43
+ - Node graph identity for host, player client, model service, hardware, and debug-tool processes.
44
+ - Inference WebSocket envelopes: ready, audio, reference time, stop, status, error, hitobject token, and end-of-stream.
45
+ - Opaque mapper token stream events tagged with a token-contract version.
46
+
47
+ 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.
48
+
49
+ ## Distribution Surfaces
50
+
51
+ This repository publishes the same protocol contract through multiple language-native surfaces. Downstream Swift and Python projects do not need their own `package.json`.
52
+
53
+ ### npm
54
+
55
+ The npm package remains useful for Node tooling, registry-backed tarballs, and consumers that want direct access to `proto/` and `gen/`:
56
+
57
+ ```sh
58
+ npm install @pulsefield/protocol
59
+ ```
60
+
61
+ ### SwiftPM
62
+
63
+ Swift/Xcode consumers should depend on this Git repository directly:
64
+
65
+ ```swift
66
+ .package(
67
+ url: "https://github.com/Pulsefield/protocol.git",
68
+ from: "0.0.3"
69
+ )
70
+ ```
71
+
72
+ Then add the product to a target:
73
+
74
+ ```swift
75
+ .product(name: "PulsefieldProtocol", package: "protocol")
76
+ ```
77
+
78
+ 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.
79
+
80
+ ### Python
81
+
82
+ Python consumers should eventually use the PyPI package:
83
+
84
+ ```sh
85
+ pip install pulsefield-protocol==0.0.3
86
+ ```
87
+
88
+ The local bootstrap build is:
89
+
90
+ ```sh
91
+ python3 -m pip install build
92
+ python3 -m build --sdist --wheel --outdir dist/
93
+ python3 -m pip install dist/*.whl
94
+ python3 -c "from pulsefield.protocol.v1 import envelope_pb2; envelope_pb2.Envelope()"
95
+ ```
96
+
97
+ 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`.
98
+
99
+ The `Publish Python package` GitHub workflow is manual and expects PyPI trusted publishing to be configured for the repository/environment before it is run.
100
+
101
+ ## Development Tools
102
+
103
+ - Node.js package manager: `npm@11.12.1`, recorded in `package.json`.
104
+ - Runtime floor: Node.js `>=22.0.0`.
105
+ - Protobuf workflow: local npm binaries, not global installs.
106
+ - Proto lint/generation: `@bufbuild/buf`.
107
+ - Swift generation: Buf remote plugin `buf.build/apple/swift`.
108
+ - Python generation: Buf remote plugins `buf.build/protocolbuffers/python` and `buf.build/protocolbuffers/pyi`.
109
+ - Formatting: `prettier`.
110
+
111
+ ## Commands
112
+
113
+ ```sh
114
+ npm run generate
115
+ npm run proto:lint
116
+ npm run proto:generate
117
+ npm run generated:check
118
+ npm run check
119
+ npm run python:check
120
+ npm run swift:build
121
+ npm run bootstrap:check
122
+ ```
123
+
124
+ `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.
125
+
126
+ ## License
127
+
128
+ Licensed under the Apache License, Version 2.0. See [LICENSE](./LICENSE).
package/buf.gen.yaml ADDED
@@ -0,0 +1,13 @@
1
+ version: v2
2
+ clean: true
3
+ inputs:
4
+ - directory: proto
5
+ plugins:
6
+ - remote: buf.build/apple/swift:v1.38.0
7
+ out: gen/swift
8
+ opt:
9
+ - Visibility=Public
10
+ - remote: buf.build/protocolbuffers/python:v26.1
11
+ out: gen/python
12
+ - remote: buf.build/protocolbuffers/pyi:v26.1
13
+ out: gen/python
package/buf.yaml ADDED
@@ -0,0 +1,9 @@
1
+ version: v2
2
+ modules:
3
+ - path: proto
4
+ lint:
5
+ use:
6
+ - STANDARD
7
+ breaking:
8
+ use:
9
+ - PACKAGE
@@ -0,0 +1,27 @@
1
+ # Session Scope
2
+
3
+ `Envelope.session_id` defines the session scope for the envelope payload. Payload
4
+ messages do not duplicate `session_id`; receivers validate the payload against the
5
+ session id carried by the envelope.
6
+
7
+ ## Rules
8
+
9
+ | Payload | `Envelope.session_id` |
10
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
11
+ | `NodeHello` | MUST be empty |
12
+ | `ReadyRequest` | SHOULD be empty |
13
+ | `AudioRequest` | MUST be non-empty |
14
+ | `ReferenceTimeRequest` | MUST be non-empty |
15
+ | `HitObjectTokenEvent` | MUST be non-empty |
16
+ | `StopSessionRequest` | MUST be non-empty |
17
+ | `StatusEvent` | MAY be empty for endpoint/node-scoped status; MUST be non-empty for session-scoped status |
18
+
19
+ `StopSessionRequest` intentionally has no `session_id` field. It targets the
20
+ active session identified by `Envelope.session_id`; therefore an envelope with
21
+ `payload.stop_session` and an empty `Envelope.session_id` is invalid.
22
+
23
+ `StatusEvent` is the only payload in this list that can validly cross the
24
+ session boundary. Endpoint-level statuses such as cold startup or readiness can
25
+ use an empty `Envelope.session_id`. Statuses describing an active session, a
26
+ missing session, or a session transition use the relevant non-empty
27
+ `Envelope.session_id`.
@@ -0,0 +1,34 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: pulsefield/protocol/v1/core.proto
4
+ # Protobuf Python Version: 5.26.1
5
+ """Generated protocol buffer code."""
6
+ from google.protobuf import descriptor as _descriptor
7
+ from google.protobuf import descriptor_pool as _descriptor_pool
8
+ from google.protobuf import symbol_database as _symbol_database
9
+ from google.protobuf.internal import builder as _builder
10
+ # @@protoc_insertion_point(imports)
11
+
12
+ _sym_db = _symbol_database.Default()
13
+
14
+
15
+
16
+
17
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n!pulsefield/protocol/v1/core.proto\x12\x16pulsefield.protocol.v1\"\xcd\x01\n\x0eNodeCapability\x12>\n\x04kind\x18\x01 \x01(\x0e\x32*.pulsefield.protocol.v1.NodeCapabilityKindR\x04kind\x12\x12\n\x04name\x18\x02 \x01(\tR\x04name\x12\x18\n\x07version\x18\x03 \x01(\tR\x07version\x12M\n\tdirection\x18\x04 \x01(\x0e\x32/.pulsefield.protocol.v1.NodeCapabilityDirectionR\tdirection\"\xe8\x01\n\tNodeHello\x12\x17\n\x07node_id\x18\x01 \x01(\tR\x06nodeId\x12\x34\n\x04role\x18\x02 \x01(\x0e\x32 .pulsefield.protocol.v1.NodeRoleR\x04role\x12J\n\x0c\x63\x61pabilities\x18\x03 \x03(\x0b\x32&.pulsefield.protocol.v1.NodeCapabilityR\x0c\x63\x61pabilities\x12)\n\x10protocol_version\x18\x04 \x01(\tR\x0fprotocolVersion\x12\x15\n\x06\x61pp_id\x18\x05 \x01(\tR\x05\x61ppId*\xa5\x01\n\x08NodeRole\x12\x19\n\x15NODE_ROLE_UNSPECIFIED\x10\x00\x12\x12\n\x0eNODE_ROLE_HOST\x10\x01\x12\x1b\n\x17NODE_ROLE_PLAYER_CLIENT\x10\x02\x12\x1b\n\x17NODE_ROLE_MODEL_SERVICE\x10\x03\x12\x16\n\x12NODE_ROLE_HARDWARE\x10\x04\x12\x18\n\x14NODE_ROLE_DEBUG_TOOL\x10\x05*\x8d\x02\n\x12NodeCapabilityKind\x12$\n NODE_CAPABILITY_KIND_UNSPECIFIED\x10\x00\x12$\n NODE_CAPABILITY_KIND_RECOGNITION\x10\x01\x12\x1f\n\x1bNODE_CAPABILITY_KIND_TIMING\x10\x02\x12\x1f\n\x1bNODE_CAPABILITY_KIND_MAPPER\x10\x03\x12&\n\"NODE_CAPABILITY_KIND_PLAYER_STREAM\x10\x04\x12!\n\x1dNODE_CAPABILITY_KIND_HARDWARE\x10\x05\x12\x1e\n\x1aNODE_CAPABILITY_KIND_DEBUG\x10\x06*\xc1\x01\n\x17NodeCapabilityDirection\x12)\n%NODE_CAPABILITY_DIRECTION_UNSPECIFIED\x10\x00\x12&\n\"NODE_CAPABILITY_DIRECTION_PRODUCER\x10\x01\x12&\n\"NODE_CAPABILITY_DIRECTION_CONSUMER\x10\x02\x12+\n\'NODE_CAPABILITY_DIRECTION_BIDIRECTIONAL\x10\x03\x62\x06proto3')
18
+
19
+ _globals = globals()
20
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
21
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'pulsefield.protocol.v1.core_pb2', _globals)
22
+ if not _descriptor._USE_C_DESCRIPTORS:
23
+ DESCRIPTOR._loaded_options = None
24
+ _globals['_NODEROLE']._serialized_start=505
25
+ _globals['_NODEROLE']._serialized_end=670
26
+ _globals['_NODECAPABILITYKIND']._serialized_start=673
27
+ _globals['_NODECAPABILITYKIND']._serialized_end=942
28
+ _globals['_NODECAPABILITYDIRECTION']._serialized_start=945
29
+ _globals['_NODECAPABILITYDIRECTION']._serialized_end=1138
30
+ _globals['_NODECAPABILITY']._serialized_start=62
31
+ _globals['_NODECAPABILITY']._serialized_end=267
32
+ _globals['_NODEHELLO']._serialized_start=270
33
+ _globals['_NODEHELLO']._serialized_end=502
34
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,76 @@
1
+ from google.protobuf.internal import containers as _containers
2
+ from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
3
+ from google.protobuf import descriptor as _descriptor
4
+ from google.protobuf import message as _message
5
+ from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
6
+
7
+ DESCRIPTOR: _descriptor.FileDescriptor
8
+
9
+ class NodeRole(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
10
+ __slots__ = ()
11
+ NODE_ROLE_UNSPECIFIED: _ClassVar[NodeRole]
12
+ NODE_ROLE_HOST: _ClassVar[NodeRole]
13
+ NODE_ROLE_PLAYER_CLIENT: _ClassVar[NodeRole]
14
+ NODE_ROLE_MODEL_SERVICE: _ClassVar[NodeRole]
15
+ NODE_ROLE_HARDWARE: _ClassVar[NodeRole]
16
+ NODE_ROLE_DEBUG_TOOL: _ClassVar[NodeRole]
17
+
18
+ class NodeCapabilityKind(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
19
+ __slots__ = ()
20
+ NODE_CAPABILITY_KIND_UNSPECIFIED: _ClassVar[NodeCapabilityKind]
21
+ NODE_CAPABILITY_KIND_RECOGNITION: _ClassVar[NodeCapabilityKind]
22
+ NODE_CAPABILITY_KIND_TIMING: _ClassVar[NodeCapabilityKind]
23
+ NODE_CAPABILITY_KIND_MAPPER: _ClassVar[NodeCapabilityKind]
24
+ NODE_CAPABILITY_KIND_PLAYER_STREAM: _ClassVar[NodeCapabilityKind]
25
+ NODE_CAPABILITY_KIND_HARDWARE: _ClassVar[NodeCapabilityKind]
26
+ NODE_CAPABILITY_KIND_DEBUG: _ClassVar[NodeCapabilityKind]
27
+
28
+ class NodeCapabilityDirection(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
29
+ __slots__ = ()
30
+ NODE_CAPABILITY_DIRECTION_UNSPECIFIED: _ClassVar[NodeCapabilityDirection]
31
+ NODE_CAPABILITY_DIRECTION_PRODUCER: _ClassVar[NodeCapabilityDirection]
32
+ NODE_CAPABILITY_DIRECTION_CONSUMER: _ClassVar[NodeCapabilityDirection]
33
+ NODE_CAPABILITY_DIRECTION_BIDIRECTIONAL: _ClassVar[NodeCapabilityDirection]
34
+ NODE_ROLE_UNSPECIFIED: NodeRole
35
+ NODE_ROLE_HOST: NodeRole
36
+ NODE_ROLE_PLAYER_CLIENT: NodeRole
37
+ NODE_ROLE_MODEL_SERVICE: NodeRole
38
+ NODE_ROLE_HARDWARE: NodeRole
39
+ NODE_ROLE_DEBUG_TOOL: NodeRole
40
+ NODE_CAPABILITY_KIND_UNSPECIFIED: NodeCapabilityKind
41
+ NODE_CAPABILITY_KIND_RECOGNITION: NodeCapabilityKind
42
+ NODE_CAPABILITY_KIND_TIMING: NodeCapabilityKind
43
+ NODE_CAPABILITY_KIND_MAPPER: NodeCapabilityKind
44
+ NODE_CAPABILITY_KIND_PLAYER_STREAM: NodeCapabilityKind
45
+ NODE_CAPABILITY_KIND_HARDWARE: NodeCapabilityKind
46
+ NODE_CAPABILITY_KIND_DEBUG: NodeCapabilityKind
47
+ NODE_CAPABILITY_DIRECTION_UNSPECIFIED: NodeCapabilityDirection
48
+ NODE_CAPABILITY_DIRECTION_PRODUCER: NodeCapabilityDirection
49
+ NODE_CAPABILITY_DIRECTION_CONSUMER: NodeCapabilityDirection
50
+ NODE_CAPABILITY_DIRECTION_BIDIRECTIONAL: NodeCapabilityDirection
51
+
52
+ class NodeCapability(_message.Message):
53
+ __slots__ = ("kind", "name", "version", "direction")
54
+ KIND_FIELD_NUMBER: _ClassVar[int]
55
+ NAME_FIELD_NUMBER: _ClassVar[int]
56
+ VERSION_FIELD_NUMBER: _ClassVar[int]
57
+ DIRECTION_FIELD_NUMBER: _ClassVar[int]
58
+ kind: NodeCapabilityKind
59
+ name: str
60
+ version: str
61
+ direction: NodeCapabilityDirection
62
+ def __init__(self, kind: _Optional[_Union[NodeCapabilityKind, str]] = ..., name: _Optional[str] = ..., version: _Optional[str] = ..., direction: _Optional[_Union[NodeCapabilityDirection, str]] = ...) -> None: ...
63
+
64
+ class NodeHello(_message.Message):
65
+ __slots__ = ("node_id", "role", "capabilities", "protocol_version", "app_id")
66
+ NODE_ID_FIELD_NUMBER: _ClassVar[int]
67
+ ROLE_FIELD_NUMBER: _ClassVar[int]
68
+ CAPABILITIES_FIELD_NUMBER: _ClassVar[int]
69
+ PROTOCOL_VERSION_FIELD_NUMBER: _ClassVar[int]
70
+ APP_ID_FIELD_NUMBER: _ClassVar[int]
71
+ node_id: str
72
+ role: NodeRole
73
+ capabilities: _containers.RepeatedCompositeFieldContainer[NodeCapability]
74
+ protocol_version: str
75
+ app_id: str
76
+ def __init__(self, node_id: _Optional[str] = ..., role: _Optional[_Union[NodeRole, str]] = ..., capabilities: _Optional[_Iterable[_Union[NodeCapability, _Mapping]]] = ..., protocol_version: _Optional[str] = ..., app_id: _Optional[str] = ...) -> None: ...