@crowdedkingdoms/crowdy-dsh 0.4.10 → 0.4.11-test.1

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.
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "package": "@crowdedkingdoms/crowdy-dsh",
3
- "version": "0.4.10",
4
- "builtAt": "2026-10-20T07:21:16.944Z",
3
+ "version": "0.4.11",
4
+ "builtAt": "2026-10-20T23:16:32.836Z",
5
5
  "source": {
6
6
  "repository": "CrowdedKingdoms/crowdy-dsh",
7
- "commit": "15dc231ae43d7225a93a371e423615692ff8e652",
7
+ "commit": "782c76a15b1b25ae2d423aa1d969df8159409c17",
8
8
  "dirty": false
9
9
  },
10
10
  "upstream": {
@@ -15,7 +15,7 @@
15
15
  },
16
16
  "crowdyjs": {
17
17
  "name": "@crowdedkingdoms/crowdyjs",
18
- "version": "18.14.0",
18
+ "version": "18.15.0-test.1",
19
19
  "source": "node_modules"
20
20
  },
21
21
  "files": {
@@ -112,7 +112,7 @@
112
112
  "manifest.webmanifest": "sha256:9b54d57eea00f2fdd1affe6e7999a4209a515755f12ac1a3299da2d55e178d4c",
113
113
  "preview/bootstrap-CYECZNXt.js": "sha256:9f303a0485c0badfdd19fad0c357ef050c5b9a343744ab5bf0c70015e7d95092",
114
114
  "preview/crowdy-boot-Cklh1qNl.js": "sha256:b21e8eb126e1cd8a52159d2d577e610df6c8af36a436f9ed5028cfabd11a85ff",
115
- "preview/vfs-image.tar.gz": "sha256:2d55cb9c5b7edb9e801986cb5966f0a5538770b8a0dc9ff3b0be5a7d3257d2ec",
115
+ "preview/vfs-image.tar.gz": "sha256:a32228f6254f1f34443eb92bf8fd498c0c7054a0e966e4066eadd182e6094aee",
116
116
  "preview/worker-C8-_ANaz.js": "sha256:81099e5732dfe0c32bacd5897316b7956c5a0a22da01b4a0c6e21d0a3b9d9aa1"
117
117
  }
118
118
  }
@@ -5792,8 +5792,9 @@ var WireMessageType = {
5792
5792
  CLIENT_TEXT_NOTIFICATION_2: 137,
5793
5793
  CLIENT_EVENT_NOTIFICATION_2: 138,
5794
5794
  SERVER_EVENT_NOTIFICATION_2: 139,
5795
- // An app-defined spatial payload (CrowdyCPP `Connection::sendGenericSpatial`, a hub's
5796
- // emit). Parsed on the binary relay only: the GraphQL union has no member for it.
5795
+ // An app-defined spatial payload (`udp.sendGenericSpatial`, CrowdyCPP
5796
+ // `Connection::sendGenericSpatial`, a hub's emit). Sent and parsed on the binary relay
5797
+ // only: the GraphQL API has no mutation and no union member for it.
5797
5798
  GENERIC_SPATIAL_1: 140,
5798
5799
  SINGLE_ACTOR_MESSAGE: 142,
5799
5800
  // Buddy v0.25.0: webcam video pair (audio's shape, payload = one SDK
@@ -5968,6 +5969,14 @@ function serializeClientEvent(ctx, input) {
5968
5969
  function serializeSingleActorMessage(ctx, input) {
5969
5970
  return serializeSpatial(ctx, WireMessageType.SINGLE_ACTOR_MESSAGE, input.appId, input.chunk, 0, 0, input.targetUuid, input.payload ? decodeBase64(input.payload) : new Uint8Array(0), input.sequenceNumber ?? 0);
5970
5971
  }
5972
+ var GENERIC_SPATIAL_MAX_PAYLOAD_BYTES = RELAY_MAX_DATAGRAM_BYTES - SPATIAL_HEADER_SIZE - TAIL_AUTH_BYTES;
5973
+ async function serializeGenericSpatial(ctx, input) {
5974
+ const payload = input.payload ? decodeBase64(input.payload) : new Uint8Array(0);
5975
+ if (payload.length > GENERIC_SPATIAL_MAX_PAYLOAD_BYTES) {
5976
+ throw new RangeError(`payload is ${payload.length} bytes; at most ${GENERIC_SPATIAL_MAX_PAYLOAD_BYTES}`);
5977
+ }
5978
+ return serializeSpatial(ctx, WireMessageType.GENERIC_SPATIAL_1, input.appId, input.chunk, input.distance ?? 8, input.decayRate ?? 0, input.uuid, payload, input.sequenceNumber ?? 0);
5979
+ }
5971
5980
  function serializeChannelMessage(ctx, input) {
5972
5981
  return serializeChannelFrame(ctx, WireMessageType.CHANNEL_MESSAGE_REQUEST, input);
5973
5982
  }
@@ -17475,6 +17484,41 @@ var UdpAPI = class {
17475
17484
  this.record("singleActorMessage", input);
17476
17485
  return data.sendSingleActorMessage;
17477
17486
  }
17487
+ /**
17488
+ * Send an app-defined spatial message (`GENERIC_SPATIAL_1`, opcode 140): the server fans it
17489
+ * out to the actors near `chunk` without reading `payload`, and they receive it on their
17490
+ * `genericSpatial` handler. The counterpart of CrowdyCPP's `Connection::sendGenericSpatial`.
17491
+ * **Binary relay only:** the GraphQL API has no mutation for it, so the client needs
17492
+ * `realtime: { binaryTransport: true }` and an active {@link subscribe} (the relay session is
17493
+ * app-scoped). Fire-and-forget; a refusal arrives as a `genericError` correlated by
17494
+ * `sequenceNumber`.
17495
+ *
17496
+ * @param input - {@link GenericSpatialInput}:
17497
+ * - `appId` — owning app id (`BigInt` as a decimal string).
17498
+ * - `chunk` — `{ x, y, z }` chunk address (signed int64 decimal strings).
17499
+ * - `uuid` — 32-ASCII-character id of the sending actor (not RFC-4122).
17500
+ * - `payload` — base64, opaque to the server, at most
17501
+ * `GENERIC_SPATIAL_MAX_PAYLOAD_BYTES` (1,123) bytes decoded.
17502
+ * - `distance` — replication radius in chunk units, 0-8 (clamped); defaults to 8.
17503
+ * - `decayRate` — decay algorithm 0-5 (see {@link sendActorUpdate}); defaults to 0.
17504
+ * - `sequenceNumber` — optional uint8 (0-255) correlation id.
17505
+ * @returns `true` when accepted for sending — **not** confirmation of delivery.
17506
+ * @throws {RangeError} when the payload is too large; nothing is sent.
17507
+ * @throws {CrowdyRealtimeError} `code === 'BINARY_RELAY_UNAVAILABLE'`: `retryable: false`
17508
+ * when the client is not on the binary relay, `true` when the relay is not connected
17509
+ * (yet); nothing is sent.
17510
+ */
17511
+ async sendGenericSpatial(input) {
17512
+ await this.awaitGameplayTokenReady();
17513
+ if (!this.subs.usingBinaryTransport()) {
17514
+ throw new CrowdyRealtimeError("sendGenericSpatial needs the binary relay (realtime.binaryTransport): the GraphQL API has no mutation for opcode 140", { code: "BINARY_RELAY_UNAVAILABLE", retryable: false });
17515
+ }
17516
+ if (!this.subs.binarySendReady())
17517
+ await this.subs.ensureBinaryReady(2e3);
17518
+ const sent = await this.subs.sendBinaryFrame((ctx) => serializeGenericSpatial(ctx, input));
17519
+ this.record("genericSpatial", input);
17520
+ return sent;
17521
+ }
17478
17522
  /**
17479
17523
  * Publish a message to a channel. Delivered to every active member of the
17480
17524
  * channel (regardless of location) as a `ChannelMessageNotification` on their
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@crowdedkingdoms/crowdyjs",
3
- "version": "18.14.0",
3
+ "version": "18.15.0-test.1",
4
4
  "source": "node_modules"
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crowdedkingdoms/crowdy-dsh",
3
- "version": "0.4.10",
3
+ "version": "0.4.11-test.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -94,11 +94,11 @@
94
94
  "crowdyDsh": {
95
95
  "build": {
96
96
  "package": "@crowdedkingdoms/crowdy-dsh",
97
- "version": "0.4.10",
98
- "builtAt": "2026-10-20T07:21:16.944Z",
97
+ "version": "0.4.11",
98
+ "builtAt": "2026-10-20T23:16:32.836Z",
99
99
  "source": {
100
100
  "repository": "CrowdedKingdoms/crowdy-dsh",
101
- "commit": "15dc231ae43d7225a93a371e423615692ff8e652",
101
+ "commit": "782c76a15b1b25ae2d423aa1d969df8159409c17",
102
102
  "dirty": false
103
103
  },
104
104
  "upstream": {
@@ -109,7 +109,7 @@
109
109
  },
110
110
  "crowdyjs": {
111
111
  "name": "@crowdedkingdoms/crowdyjs",
112
- "version": "18.14.0",
112
+ "version": "18.15.0-test.1",
113
113
  "source": "node_modules"
114
114
  },
115
115
  "files": {
@@ -206,7 +206,7 @@
206
206
  "manifest.webmanifest": "sha256:9b54d57eea00f2fdd1affe6e7999a4209a515755f12ac1a3299da2d55e178d4c",
207
207
  "preview/bootstrap-CYECZNXt.js": "sha256:9f303a0485c0badfdd19fad0c357ef050c5b9a343744ab5bf0c70015e7d95092",
208
208
  "preview/crowdy-boot-Cklh1qNl.js": "sha256:b21e8eb126e1cd8a52159d2d577e610df6c8af36a436f9ed5028cfabd11a85ff",
209
- "preview/vfs-image.tar.gz": "sha256:2d55cb9c5b7edb9e801986cb5966f0a5538770b8a0dc9ff3b0be5a7d3257d2ec",
209
+ "preview/vfs-image.tar.gz": "sha256:a32228f6254f1f34443eb92bf8fd498c0c7054a0e966e4066eadd182e6094aee",
210
210
  "preview/worker-C8-_ANaz.js": "sha256:81099e5732dfe0c32bacd5897316b7956c5a0a22da01b4a0c6e21d0a3b9d9aa1"
211
211
  }
212
212
  }