@crowdedkingdoms/crowdyjs 8.0.0 → 8.1.0

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.
Files changed (59) hide show
  1. package/README.md +92 -15
  2. package/dist/client.d.ts +8 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +5 -0
  5. package/dist/crowdy-client.d.ts +22 -0
  6. package/dist/crowdy-client.d.ts.map +1 -1
  7. package/dist/crowdy-client.js +21 -0
  8. package/dist/domains/gameModel.d.ts +54 -3
  9. package/dist/domains/gameModel.d.ts.map +1 -1
  10. package/dist/domains/gameModel.js +67 -4
  11. package/dist/domains/host.d.ts +14 -3
  12. package/dist/domains/host.d.ts.map +1 -1
  13. package/dist/domains/host.js +17 -3
  14. package/dist/domains/organizations.d.ts +3 -3
  15. package/dist/domains/organizations.js +3 -3
  16. package/dist/domains/quotas.d.ts +1 -1
  17. package/dist/domains/quotas.js +1 -1
  18. package/dist/domains/udp.d.ts +28 -17
  19. package/dist/domains/udp.d.ts.map +1 -1
  20. package/dist/domains/udp.js +28 -17
  21. package/dist/generated/graphql.d.ts +366 -6
  22. package/dist/generated/graphql.d.ts.map +1 -1
  23. package/dist/generated/graphql.js +13 -8
  24. package/dist/index.d.ts +3 -1
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +3 -1
  27. package/dist/kit/blueprints.d.ts +259 -0
  28. package/dist/kit/blueprints.d.ts.map +1 -0
  29. package/dist/kit/blueprints.js +480 -0
  30. package/dist/kit/index.d.ts +7 -0
  31. package/dist/kit/index.d.ts.map +1 -0
  32. package/dist/kit/index.js +6 -0
  33. package/dist/kit/inventory.d.ts +111 -0
  34. package/dist/kit/inventory.d.ts.map +1 -0
  35. package/dist/kit/inventory.js +158 -0
  36. package/dist/kit/kit.d.ts +96 -0
  37. package/dist/kit/kit.d.ts.map +1 -0
  38. package/dist/kit/kit.js +98 -0
  39. package/dist/kit/npcs.d.ts +182 -0
  40. package/dist/kit/npcs.d.ts.map +1 -0
  41. package/dist/kit/npcs.js +106 -0
  42. package/dist/kit/objects.d.ts +108 -0
  43. package/dist/kit/objects.d.ts.map +1 -0
  44. package/dist/kit/objects.js +110 -0
  45. package/dist/kit/shared.d.ts +32 -0
  46. package/dist/kit/shared.d.ts.map +1 -0
  47. package/dist/kit/shared.js +39 -0
  48. package/dist/lb-cookie-store.d.ts +20 -0
  49. package/dist/lb-cookie-store.d.ts.map +1 -0
  50. package/dist/lb-cookie-store.js +73 -0
  51. package/dist/realtime.d.ts +20 -5
  52. package/dist/realtime.d.ts.map +1 -1
  53. package/dist/realtime.js +38 -0
  54. package/dist/types.d.ts +22 -6
  55. package/dist/types.d.ts.map +1 -1
  56. package/dist/world.d.ts +13 -8
  57. package/dist/world.d.ts.map +1 -1
  58. package/dist/world.js +13 -8
  59. package/package.json +6 -4
@@ -1,5 +1,5 @@
1
1
  import type { GraphQLClient } from '../client.js';
2
- import { type GameHostQuery, type ActorHeartbeatMutation } from '../generated/graphql.js';
2
+ import { type GameHostQuery, type AmIGameHostQuery, type ActorHeartbeatMutation } from '../generated/graphql.js';
3
3
  /**
4
4
  * Game-host election + actor liveness heartbeat — exposed as `client.host`.
5
5
  *
@@ -7,8 +7,10 @@ import { type GameHostQuery, type ActorHeartbeatMutation } from '../generated/gr
7
7
  * game-api replicas (the user whose earliest still-connected actor was created
8
8
  * first wins). {@link heartbeat} refreshes the caller's actor freshness (keeping
9
9
  * them host-eligible) and returns the freshly-elected host in one round-trip —
10
- * call it on an interval shorter than the server's freshness window. Both
11
- * require a valid session; `appId` is a `BigInt` decimal string.
10
+ * call it on an interval shorter than the server's freshness window.
11
+ * {@link amIHost} is a UI convenience (not authoritative for mutations use
12
+ * `gameModelInvoke`'s `is_host` policy for that). All require a valid session;
13
+ * `appId` is a `BigInt` decimal string.
12
14
  *
13
15
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session.
14
16
  */
@@ -23,6 +25,15 @@ export declare class HostAPI {
23
25
  * @returns The elected {@link GameHost}, or `null`.
24
26
  */
25
27
  get(appId: string): Promise<GameHostQuery['gameHost']>;
28
+ /**
29
+ * Return whether the authenticated caller is the currently elected host for
30
+ * the app. Convenience for UI only — not authoritative for server mutations
31
+ * (use `gameModelInvoke`'s `is_host` policy for that).
32
+ *
33
+ * @param appId - The app to check host election for.
34
+ * @returns `true` if the caller is the elected host; otherwise `false`.
35
+ */
36
+ amIHost(appId: string): Promise<AmIGameHostQuery['amIGameHost']>;
26
37
  /**
27
38
  * Refresh the caller's actor freshness in an app and return the freshly
28
39
  * elected host. Returns `null` when no fresh actors exist for the app.
@@ -1 +1 @@
1
- {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/domains/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD;;;;;;OAMG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAK5D;;;;;;OAMG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CAIlF"}
1
+ {"version":3,"file":"host.d.ts","sourceRoot":"","sources":["../../src/domains/host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC5B,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;GAaG;AACH,qBAAa,OAAO;IACN,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD;;;;;;OAMG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAK5D;;;;;;;OAOG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAKtE;;;;;;OAMG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,CAAC;CAIlF"}
@@ -1,4 +1,4 @@
1
- import { GameHostDocument, ActorHeartbeatDocument, } from '../generated/graphql.js';
1
+ import { GameHostDocument, AmIGameHostDocument, ActorHeartbeatDocument, } from '../generated/graphql.js';
2
2
  /**
3
3
  * Game-host election + actor liveness heartbeat — exposed as `client.host`.
4
4
  *
@@ -6,8 +6,10 @@ import { GameHostDocument, ActorHeartbeatDocument, } from '../generated/graphql.
6
6
  * game-api replicas (the user whose earliest still-connected actor was created
7
7
  * first wins). {@link heartbeat} refreshes the caller's actor freshness (keeping
8
8
  * them host-eligible) and returns the freshly-elected host in one round-trip —
9
- * call it on an interval shorter than the server's freshness window. Both
10
- * require a valid session; `appId` is a `BigInt` decimal string.
9
+ * call it on an interval shorter than the server's freshness window.
10
+ * {@link amIHost} is a UI convenience (not authoritative for mutations use
11
+ * `gameModelInvoke`'s `is_host` policy for that). All require a valid session;
12
+ * `appId` is a `BigInt` decimal string.
11
13
  *
12
14
  * @throws {CrowdyGraphQLError} `UNAUTHENTICATED` without a session.
13
15
  */
@@ -26,6 +28,18 @@ export class HostAPI {
26
28
  const data = await this.graphql.request(GameHostDocument, { appId });
27
29
  return data.gameHost;
28
30
  }
31
+ /**
32
+ * Return whether the authenticated caller is the currently elected host for
33
+ * the app. Convenience for UI only — not authoritative for server mutations
34
+ * (use `gameModelInvoke`'s `is_host` policy for that).
35
+ *
36
+ * @param appId - The app to check host election for.
37
+ * @returns `true` if the caller is the elected host; otherwise `false`.
38
+ */
39
+ async amIHost(appId) {
40
+ const data = await this.graphql.request(AmIGameHostDocument, { appId });
41
+ return data.amIGameHost;
42
+ }
29
43
  /**
30
44
  * Refresh the caller's actor freshness in an app and return the freshly
31
45
  * elected host. Returns `null` when no fresh actors exist for the app.
@@ -101,13 +101,13 @@ export declare class OrganizationsAPI {
101
101
  * Mint a new org API token (for server-side studio backends). Requires the
102
102
  * `manage_tokens` org permission. The plaintext secret is returned **once**.
103
103
  *
104
- * @param input - {@link CreateOrgTokenInput}: `orgId`, `name`, optional
105
- * `permissions` and `expiresAt`.
104
+ * @param input - {@link CreateOrgTokenInput}: `orgId`, optional `label` and
105
+ * `expiresAt`.
106
106
  * @returns The created token including its one-time plaintext secret.
107
107
  */
108
108
  createToken(input: CreateOrgTokenInput): Promise<CreateOrgTokenMutation['createOrgToken']>;
109
109
  /**
110
- * Update an org token's metadata (name / permissions / expiry). Requires the
110
+ * Update an org token's metadata (label / active flag / expiry). Requires the
111
111
  * `manage_tokens` org permission.
112
112
  *
113
113
  * @param orgTokenId - Numeric token id.
@@ -142,8 +142,8 @@ export class OrganizationsAPI {
142
142
  * Mint a new org API token (for server-side studio backends). Requires the
143
143
  * `manage_tokens` org permission. The plaintext secret is returned **once**.
144
144
  *
145
- * @param input - {@link CreateOrgTokenInput}: `orgId`, `name`, optional
146
- * `permissions` and `expiresAt`.
145
+ * @param input - {@link CreateOrgTokenInput}: `orgId`, optional `label` and
146
+ * `expiresAt`.
147
147
  * @returns The created token including its one-time plaintext secret.
148
148
  */
149
149
  async createToken(input) {
@@ -153,7 +153,7 @@ export class OrganizationsAPI {
153
153
  return data.createOrgToken;
154
154
  }
155
155
  /**
156
- * Update an org token's metadata (name / permissions / expiry). Requires the
156
+ * Update an org token's metadata (label / active flag / expiry). Requires the
157
157
  * `manage_tokens` org permission.
158
158
  *
159
159
  * @param orgTokenId - Numeric token id.
@@ -47,7 +47,7 @@ export declare class QuotasAPI {
47
47
  * Create or update a quota at an org or app scope. Requires `manage_quotas`
48
48
  * (super-admin for platform-global quotas).
49
49
  *
50
- * @param input - {@link SetQuotaInput}: scope ids, `metric`, and `limit`.
50
+ * @param input - {@link SetQuotaInput}: scope ids, `metric`, and `limitValue`.
51
51
  * @returns The created/updated quota.
52
52
  */
53
53
  set(input: SetQuotaInput): Promise<SetQuotaMutation['setQuota']>;
@@ -57,7 +57,7 @@ export class QuotasAPI {
57
57
  * Create or update a quota at an org or app scope. Requires `manage_quotas`
58
58
  * (super-admin for platform-global quotas).
59
59
  *
60
- * @param input - {@link SetQuotaInput}: scope ids, `metric`, and `limit`.
60
+ * @param input - {@link SetQuotaInput}: scope ids, `metric`, and `limitValue`.
61
61
  * @returns The created/updated quota.
62
62
  */
63
63
  async set(input) {
@@ -77,10 +77,13 @@ export declare class UdpAPI {
77
77
  /**
78
78
  * Send an actor (player/NPC) state update for spatial replication to nearby
79
79
  * chunks. Fire-and-forget; opens a UDP proxy session automatically if none
80
- * exists. The applied echo (`ActorUpdateResponse`) and any failure
81
- * (`GenericErrorResponse`) arrive asynchronously on {@link subscribe},
82
- * correlated by `sequenceNumber`; use {@link sendActorUpdateAndWait} to await
83
- * that echo inline.
80
+ * exists. There is no separate per-request response: the server fans the
81
+ * update out to every client in the target chunk **including the sender**, so
82
+ * your own applied update comes back as an `ActorUpdateNotification` carrying
83
+ * the same `sequenceNumber` (the legacy `ActorUpdateResponse` type is never
84
+ * emitted). Failures arrive as a `GenericErrorResponse`; both are delivered
85
+ * asynchronously on {@link subscribe} and correlated by `sequenceNumber`. Use
86
+ * {@link sendActorUpdateAndWait} to await that self-notification inline.
84
87
  *
85
88
  * @param input - {@link ActorUpdateRequestInput}:
86
89
  * - `appId` — owning app id (`BigInt` as a decimal string).
@@ -106,17 +109,19 @@ export declare class UdpAPI {
106
109
  /**
107
110
  * Send an actor update and wait for the server's applied echo. Allocates a
108
111
  * `sequenceNumber` when `input.sequenceNumber` is omitted, registers the wait
109
- * *before* sending, then resolves with the matching `ActorUpdateResponse`.
110
- * Requires an active {@link subscribe} so the echo can be delivered over the
111
- * shared WebSocket.
112
+ * *before* sending, then resolves with the matching notification. Because the
113
+ * server includes the sender in the chunk fan-out, the echo is your own
114
+ * `ActorUpdateNotification` with the same `sequenceNumber` (there is no
115
+ * `ActorUpdateResponse` on the wire). Requires an active {@link subscribe} so
116
+ * the self-notification can be delivered over the shared WebSocket.
112
117
  *
113
118
  * @param input - {@link ActorUpdateRequestInput} (see {@link sendActorUpdate}
114
119
  * for field units/encoding). Omit `sequenceNumber` to let the SDK allocate
115
120
  * one.
116
121
  * @param options - `timeoutMs`: how long to wait for the echo, in
117
122
  * milliseconds; defaults to the client's realtime `waitTimeoutMs` (5000).
118
- * @returns The correlated {@link SpatialNotification} (the `ActorUpdateResponse`
119
- * echo).
123
+ * @returns The correlated {@link SpatialNotification} (your own
124
+ * `ActorUpdateNotification` self-echo).
120
125
  * @throws {CrowdyGraphQLError} if the underlying send is rejected.
121
126
  * @throws {CrowdyTimeoutError} if the HTTP send leg exceeds the client's
122
127
  * request timeout.
@@ -141,10 +146,13 @@ export declare class UdpAPI {
141
146
  }): Promise<SpatialNotification>;
142
147
  /**
143
148
  * Send a single voxel (block) update for spatial replication to nearby
144
- * chunks. Fire-and-forget; opens a UDP proxy session automatically. The
145
- * applied echo (`VoxelUpdateResponse`) and failures (`GenericErrorResponse`)
146
- * arrive asynchronously on {@link subscribe}; use
147
- * {@link sendVoxelUpdateAndWait} to await the echo inline.
149
+ * chunks. Fire-and-forget; opens a UDP proxy session automatically. There is
150
+ * no separate per-request response: the change fans out to nearby clients
151
+ * **including the sender** as a `VoxelUpdateNotification` carrying the same
152
+ * `sequenceNumber` (the legacy `VoxelUpdateResponse` type is never emitted).
153
+ * Failures arrive as a `GenericErrorResponse`; both are delivered
154
+ * asynchronously on {@link subscribe}. Use {@link sendVoxelUpdateAndWait} to
155
+ * await the self-notification inline.
148
156
  *
149
157
  * @param input - {@link VoxelUpdateRequestInput}:
150
158
  * - `appId` — owning app id (`BigInt` as a decimal string).
@@ -166,15 +174,18 @@ export declare class UdpAPI {
166
174
  */
167
175
  sendVoxelUpdate(input: SendVoxelUpdateMutationVariables['input']): Promise<boolean>;
168
176
  /**
169
- * Send a voxel update and wait for the server's applied `VoxelUpdateResponse`
170
- * echo. Allocates a `sequenceNumber` when omitted and requires an active
171
- * {@link subscribe}.
177
+ * Send a voxel update and wait for the server's applied echo. Allocates a
178
+ * `sequenceNumber` when omitted and requires an active {@link subscribe}.
179
+ * Because the server includes the sender in the chunk fan-out, the echo is
180
+ * your own `VoxelUpdateNotification` with the same `sequenceNumber` (there is
181
+ * no `VoxelUpdateResponse` on the wire).
172
182
  *
173
183
  * @param input - {@link VoxelUpdateRequestInput} (see {@link sendVoxelUpdate}
174
184
  * for field units/encoding).
175
185
  * @param options - `timeoutMs`: echo wait in milliseconds; defaults to the
176
186
  * client's realtime `waitTimeoutMs` (5000).
177
- * @returns The correlated {@link SpatialNotification} (`VoxelUpdateResponse`).
187
+ * @returns The correlated {@link SpatialNotification} (your own
188
+ * `VoxelUpdateNotification` self-echo).
178
189
  * @throws {CrowdyGraphQLError} if the underlying send is rejected.
179
190
  * @throws {CrowdyTimeoutError} if the HTTP send leg times out.
180
191
  * @throws {CrowdyRealtimeError} on echo timeout
@@ -1 +1 @@
1
- {"version":3,"file":"udp.d.ts","sourceRoot":"","sources":["../../src/domains/udp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,mBAAmB,EACnB,uBAAuB,EACxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAEL,KAAK,uBAAuB,EAG5B,KAAK,6BAA6B,EAElC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,gCAAgC,EAErC,KAAK,+BAA+B,EAEpC,KAAK,gCAAgC,EAErC,KAAK,uCAAuC,EAE5C,KAAK,mCAAmC,EACzC,MAAM,yBAAyB,CA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AK,EAAE,gCAAgC,CAAC,OAAO,CAAC,EAChD,OAAO,GAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAO,GACnC,OAAO,CAAC,mBAAmB,CAAC;IAO/B;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,sBAAsB,CAC1B,KAAK,EAAE,uCAAuC,CAAC,OAAO,CAAC,GACtD,OAAO,CAAC,OAAO,CAAC;IAOnB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,kBAAkB,CACtB,KAAK,EAAE,mCAAmC,CAAC,OAAO,CAAC,GAClD,OAAO,CAAC,OAAO,CAAC;IAKnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,SAAS,CAAC,QAAQ,EAAE,uBAAuB,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,IAAI;IAIvE,OAAO,CAAC,YAAY;CAQrB"}
@@ -85,10 +85,13 @@ export class UdpAPI {
85
85
  /**
86
86
  * Send an actor (player/NPC) state update for spatial replication to nearby
87
87
  * chunks. Fire-and-forget; opens a UDP proxy session automatically if none
88
- * exists. The applied echo (`ActorUpdateResponse`) and any failure
89
- * (`GenericErrorResponse`) arrive asynchronously on {@link subscribe},
90
- * correlated by `sequenceNumber`; use {@link sendActorUpdateAndWait} to await
91
- * that echo inline.
88
+ * exists. There is no separate per-request response: the server fans the
89
+ * update out to every client in the target chunk **including the sender**, so
90
+ * your own applied update comes back as an `ActorUpdateNotification` carrying
91
+ * the same `sequenceNumber` (the legacy `ActorUpdateResponse` type is never
92
+ * emitted). Failures arrive as a `GenericErrorResponse`; both are delivered
93
+ * asynchronously on {@link subscribe} and correlated by `sequenceNumber`. Use
94
+ * {@link sendActorUpdateAndWait} to await that self-notification inline.
92
95
  *
93
96
  * @param input - {@link ActorUpdateRequestInput}:
94
97
  * - `appId` — owning app id (`BigInt` as a decimal string).
@@ -117,17 +120,19 @@ export class UdpAPI {
117
120
  /**
118
121
  * Send an actor update and wait for the server's applied echo. Allocates a
119
122
  * `sequenceNumber` when `input.sequenceNumber` is omitted, registers the wait
120
- * *before* sending, then resolves with the matching `ActorUpdateResponse`.
121
- * Requires an active {@link subscribe} so the echo can be delivered over the
122
- * shared WebSocket.
123
+ * *before* sending, then resolves with the matching notification. Because the
124
+ * server includes the sender in the chunk fan-out, the echo is your own
125
+ * `ActorUpdateNotification` with the same `sequenceNumber` (there is no
126
+ * `ActorUpdateResponse` on the wire). Requires an active {@link subscribe} so
127
+ * the self-notification can be delivered over the shared WebSocket.
123
128
  *
124
129
  * @param input - {@link ActorUpdateRequestInput} (see {@link sendActorUpdate}
125
130
  * for field units/encoding). Omit `sequenceNumber` to let the SDK allocate
126
131
  * one.
127
132
  * @param options - `timeoutMs`: how long to wait for the echo, in
128
133
  * milliseconds; defaults to the client's realtime `waitTimeoutMs` (5000).
129
- * @returns The correlated {@link SpatialNotification} (the `ActorUpdateResponse`
130
- * echo).
134
+ * @returns The correlated {@link SpatialNotification} (your own
135
+ * `ActorUpdateNotification` self-echo).
131
136
  * @throws {CrowdyGraphQLError} if the underlying send is rejected.
132
137
  * @throws {CrowdyTimeoutError} if the HTTP send leg exceeds the client's
133
138
  * request timeout.
@@ -155,10 +160,13 @@ export class UdpAPI {
155
160
  }
156
161
  /**
157
162
  * Send a single voxel (block) update for spatial replication to nearby
158
- * chunks. Fire-and-forget; opens a UDP proxy session automatically. The
159
- * applied echo (`VoxelUpdateResponse`) and failures (`GenericErrorResponse`)
160
- * arrive asynchronously on {@link subscribe}; use
161
- * {@link sendVoxelUpdateAndWait} to await the echo inline.
163
+ * chunks. Fire-and-forget; opens a UDP proxy session automatically. There is
164
+ * no separate per-request response: the change fans out to nearby clients
165
+ * **including the sender** as a `VoxelUpdateNotification` carrying the same
166
+ * `sequenceNumber` (the legacy `VoxelUpdateResponse` type is never emitted).
167
+ * Failures arrive as a `GenericErrorResponse`; both are delivered
168
+ * asynchronously on {@link subscribe}. Use {@link sendVoxelUpdateAndWait} to
169
+ * await the self-notification inline.
162
170
  *
163
171
  * @param input - {@link VoxelUpdateRequestInput}:
164
172
  * - `appId` — owning app id (`BigInt` as a decimal string).
@@ -183,15 +191,18 @@ export class UdpAPI {
183
191
  return data.sendVoxelUpdate;
184
192
  }
185
193
  /**
186
- * Send a voxel update and wait for the server's applied `VoxelUpdateResponse`
187
- * echo. Allocates a `sequenceNumber` when omitted and requires an active
188
- * {@link subscribe}.
194
+ * Send a voxel update and wait for the server's applied echo. Allocates a
195
+ * `sequenceNumber` when omitted and requires an active {@link subscribe}.
196
+ * Because the server includes the sender in the chunk fan-out, the echo is
197
+ * your own `VoxelUpdateNotification` with the same `sequenceNumber` (there is
198
+ * no `VoxelUpdateResponse` on the wire).
189
199
  *
190
200
  * @param input - {@link VoxelUpdateRequestInput} (see {@link sendVoxelUpdate}
191
201
  * for field units/encoding).
192
202
  * @param options - `timeoutMs`: echo wait in milliseconds; defaults to the
193
203
  * client's realtime `waitTimeoutMs` (5000).
194
- * @returns The correlated {@link SpatialNotification} (`VoxelUpdateResponse`).
204
+ * @returns The correlated {@link SpatialNotification} (your own
205
+ * `VoxelUpdateNotification` self-echo).
195
206
  * @throws {CrowdyGraphQLError} if the underlying send is rejected.
196
207
  * @throws {CrowdyTimeoutError} if the HTTP send leg times out.
197
208
  * @throws {CrowdyRealtimeError} on echo timeout