@q9labsai/chalk-client 5.2.6 → 5.3.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.
Files changed (38) hide show
  1. package/README.md +1 -1
  2. package/dist/access/grant.d.ts +2 -0
  3. package/dist/{chunk-I7Y4HR2P.js → chunk-2CEMOTZF.js} +333 -64
  4. package/dist/{chunk-5YPQNMJE.js → chunk-FD7ZSDTM.js} +103 -26
  5. package/dist/{chunk-CJVLTSIO.js → chunk-MHJ4UPM3.js} +165 -6
  6. package/dist/chunk-N4IPKRS6.js +76 -0
  7. package/dist/{chunk-YIDKETOX.js → chunk-O5JB5XVX.js} +840 -38
  8. package/dist/{chunk-WFRTUBN6.js → chunk-VAJ6XNAA.js} +1 -1
  9. package/dist/client.d.ts +182 -1
  10. package/dist/connection/dependencies.d.ts +2 -1
  11. package/dist/effect.js +29 -4
  12. package/dist/generated/http-api.d.ts +180 -1
  13. package/dist/generated/schemas.d.ts +290 -1
  14. package/dist/generated/sync.d.ts +60 -1
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.js +33 -15
  17. package/dist/media/call-stats.d.ts +27 -0
  18. package/dist/media/client.d.ts +2 -2
  19. package/dist/media/ice-servers.d.ts +3 -0
  20. package/dist/media/index.d.ts +2 -0
  21. package/dist/media/index.js +4 -1
  22. package/dist/media/plane.d.ts +4 -2
  23. package/dist/media/receive-stall.d.ts +52 -0
  24. package/dist/media/types.d.ts +21 -0
  25. package/dist/media/video-render-size.d.ts +7 -0
  26. package/dist/media/viewer-layer.d.ts +48 -0
  27. package/dist/public-invites/index.js +3 -2
  28. package/dist/server/index.cjs +19 -4
  29. package/dist/server/index.js +19 -4
  30. package/dist/server/types.d.cts +2 -0
  31. package/dist/server/types.d.ts +2 -0
  32. package/dist/session/index.d.ts +18 -0
  33. package/dist/space-client/same-identity.d.ts +6 -0
  34. package/dist/space-client/types.d.ts +6 -0
  35. package/dist/sync/index.js +2 -1
  36. package/dist/sync/v1-command-scheduler.d.ts +4 -0
  37. package/dist/sync/v1-types.d.ts +6 -0
  38. package/package.json +3 -1
@@ -100,11 +100,20 @@ export declare const SyncProtocolMetadata: {
100
100
  readonly pattern: "^[a-z][a-z0-9_*\\-/]{0,255}=[\\x21-\\x2b\\x2d-\\x3c\\x3e-\\x7e]{1,256}(,[a-z][a-z0-9_*\\-/]{0,255}=[\\x21-\\x2b\\x2d-\\x3c\\x3e-\\x7e]{1,256})*$";
101
101
  };
102
102
  };
103
+ readonly helloOnlyFields: {
104
+ readonly baggage: {
105
+ readonly kind: "string";
106
+ readonly minBytes: 47;
107
+ readonly maxBytes: 47;
108
+ readonly format: "w3c-baggage-session-id";
109
+ readonly pattern: "^session\\.id=[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
110
+ };
111
+ };
103
112
  readonly acceptedOn: {
104
113
  readonly hello: "client-to-server";
105
114
  readonly serverFrames: "server-to-client";
106
115
  };
107
- readonly upgradeHeaders: readonly ["x-chalk-journey-id", "traceparent", "tracestate"];
116
+ readonly upgradeHeaders: readonly ["x-chalk-journey-id", "traceparent", "tracestate", "baggage"];
108
117
  readonly rule: "propagate_from_first_observed_layer_to_every_downstream_frame";
109
118
  };
110
119
  readonly externalIntents: readonly ["admit_participant", "deny_admission", "admission_request_expired", "mute_participant", "stop_participant_camera", "stop_participant_screen_share", "remove_participant", "start_recording", "stop_recording", "participant_leave", "start_episode", "extend_episode", "end_episode", "tenant_set_deadline", "tenant_end_episode", "maximum_duration_expired"];
@@ -353,6 +362,7 @@ export declare const UuidSchema: Schema.String;
353
362
  export declare const JourneyIdSchema: Schema.String;
354
363
  export declare const TraceparentSchema: Schema.String;
355
364
  export declare const TracestateSchema: Schema.String;
365
+ export declare const BaggageSchema: Schema.String;
356
366
  export declare const SyncCorrelationFieldsSchema: Schema.Struct<{
357
367
  readonly journey_id: Schema.optional<Schema.String>;
358
368
  readonly traceparent: Schema.optional<Schema.String>;
@@ -424,6 +434,7 @@ export declare const HelloFrameSchema: Schema.Struct<{
424
434
  readonly journey_id: Schema.optional<Schema.String>;
425
435
  readonly traceparent: Schema.optional<Schema.String>;
426
436
  readonly tracestate: Schema.optional<Schema.String>;
437
+ readonly baggage: Schema.optional<Schema.String>;
427
438
  readonly type: Schema.Literal<"hello">;
428
439
  readonly protocol: Schema.Literal<1>;
429
440
  readonly token: Schema.String;
@@ -461,6 +472,7 @@ export declare const ExtendedHelloFrameSchema: Schema.Struct<{
461
472
  readonly journey_id: Schema.optional<Schema.String>;
462
473
  readonly traceparent: Schema.optional<Schema.String>;
463
474
  readonly tracestate: Schema.optional<Schema.String>;
475
+ readonly baggage: Schema.optional<Schema.String>;
464
476
  readonly type: Schema.Literal<"hello">;
465
477
  readonly protocol: Schema.Literal<1>;
466
478
  readonly token: Schema.String;
@@ -1313,6 +1325,7 @@ export declare const WelcomeSnapshotFrameSchema: Schema.Struct<{
1313
1325
  readonly protocol: Schema.Literal<1>;
1314
1326
  readonly participant_id: Schema.String;
1315
1327
  readonly participant_generation: Schema.Number;
1328
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1316
1329
  readonly recovery_id: Schema.String;
1317
1330
  readonly head: Schema.Struct<{
1318
1331
  readonly revision: Schema.Number;
@@ -1361,6 +1374,7 @@ export declare const WelcomeReplayFrameSchema: Schema.Struct<{
1361
1374
  readonly protocol: Schema.Literal<1>;
1362
1375
  readonly participant_id: Schema.String;
1363
1376
  readonly participant_generation: Schema.Number;
1377
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1364
1378
  readonly recovery_id: Schema.String;
1365
1379
  readonly head: Schema.Struct<{
1366
1380
  readonly revision: Schema.Number;
@@ -1379,6 +1393,7 @@ export declare const WelcomeUpToDateFrameSchema: Schema.Struct<{
1379
1393
  readonly protocol: Schema.Literal<1>;
1380
1394
  readonly participant_id: Schema.String;
1381
1395
  readonly participant_generation: Schema.Number;
1396
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1382
1397
  readonly recovery_id: Schema.String;
1383
1398
  readonly head: Schema.Struct<{
1384
1399
  readonly revision: Schema.Number;
@@ -1397,6 +1412,7 @@ export declare const WelcomeTerminalFrameSchema: Schema.Struct<{
1397
1412
  readonly protocol: Schema.Literal<1>;
1398
1413
  readonly participant_id: Schema.String;
1399
1414
  readonly participant_generation: Schema.Number;
1415
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1400
1416
  readonly recovery_id: Schema.String;
1401
1417
  readonly head: Schema.Struct<{
1402
1418
  readonly revision: Schema.Number;
@@ -1416,6 +1432,7 @@ export declare const ExtendedWelcomeSnapshotFrameSchema: Schema.Struct<{
1416
1432
  readonly protocol: Schema.Literal<1>;
1417
1433
  readonly participant_id: Schema.String;
1418
1434
  readonly participant_generation: Schema.Number;
1435
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1419
1436
  readonly recovery_id: Schema.String;
1420
1437
  readonly head: Schema.Struct<{
1421
1438
  readonly revision: Schema.Number;
@@ -1477,6 +1494,7 @@ export declare const ExtendedWelcomeReplayFrameSchema: Schema.Struct<{
1477
1494
  readonly protocol: Schema.Literal<1>;
1478
1495
  readonly participant_id: Schema.String;
1479
1496
  readonly participant_generation: Schema.Number;
1497
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1480
1498
  readonly recovery_id: Schema.String;
1481
1499
  readonly head: Schema.Struct<{
1482
1500
  readonly revision: Schema.Number;
@@ -1508,6 +1526,7 @@ export declare const ExtendedWelcomeUpToDateFrameSchema: Schema.Struct<{
1508
1526
  readonly protocol: Schema.Literal<1>;
1509
1527
  readonly participant_id: Schema.String;
1510
1528
  readonly participant_generation: Schema.Number;
1529
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1511
1530
  readonly recovery_id: Schema.String;
1512
1531
  readonly head: Schema.Struct<{
1513
1532
  readonly revision: Schema.Number;
@@ -1539,6 +1558,7 @@ export declare const ExtendedWelcomeTerminalFrameSchema: Schema.Struct<{
1539
1558
  readonly protocol: Schema.Literal<1>;
1540
1559
  readonly participant_id: Schema.String;
1541
1560
  readonly participant_generation: Schema.Number;
1561
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1542
1562
  readonly recovery_id: Schema.String;
1543
1563
  readonly head: Schema.Struct<{
1544
1564
  readonly revision: Schema.Number;
@@ -1571,6 +1591,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1571
1591
  readonly protocol: Schema.Literal<1>;
1572
1592
  readonly participant_id: Schema.String;
1573
1593
  readonly participant_generation: Schema.Number;
1594
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1574
1595
  readonly recovery_id: Schema.String;
1575
1596
  readonly head: Schema.Struct<{
1576
1597
  readonly revision: Schema.Number;
@@ -1631,6 +1652,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1631
1652
  readonly protocol: Schema.Literal<1>;
1632
1653
  readonly participant_id: Schema.String;
1633
1654
  readonly participant_generation: Schema.Number;
1655
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1634
1656
  readonly recovery_id: Schema.String;
1635
1657
  readonly head: Schema.Struct<{
1636
1658
  readonly revision: Schema.Number;
@@ -1661,6 +1683,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1661
1683
  readonly protocol: Schema.Literal<1>;
1662
1684
  readonly participant_id: Schema.String;
1663
1685
  readonly participant_generation: Schema.Number;
1686
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1664
1687
  readonly recovery_id: Schema.String;
1665
1688
  readonly head: Schema.Struct<{
1666
1689
  readonly revision: Schema.Number;
@@ -1691,6 +1714,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1691
1714
  readonly protocol: Schema.Literal<1>;
1692
1715
  readonly participant_id: Schema.String;
1693
1716
  readonly participant_generation: Schema.Number;
1717
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1694
1718
  readonly recovery_id: Schema.String;
1695
1719
  readonly head: Schema.Struct<{
1696
1720
  readonly revision: Schema.Number;
@@ -1722,6 +1746,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1722
1746
  readonly protocol: Schema.Literal<1>;
1723
1747
  readonly participant_id: Schema.String;
1724
1748
  readonly participant_generation: Schema.Number;
1749
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1725
1750
  readonly recovery_id: Schema.String;
1726
1751
  readonly head: Schema.Struct<{
1727
1752
  readonly revision: Schema.Number;
@@ -1769,6 +1794,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1769
1794
  readonly protocol: Schema.Literal<1>;
1770
1795
  readonly participant_id: Schema.String;
1771
1796
  readonly participant_generation: Schema.Number;
1797
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1772
1798
  readonly recovery_id: Schema.String;
1773
1799
  readonly head: Schema.Struct<{
1774
1800
  readonly revision: Schema.Number;
@@ -1786,6 +1812,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1786
1812
  readonly protocol: Schema.Literal<1>;
1787
1813
  readonly participant_id: Schema.String;
1788
1814
  readonly participant_generation: Schema.Number;
1815
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1789
1816
  readonly recovery_id: Schema.String;
1790
1817
  readonly head: Schema.Struct<{
1791
1818
  readonly revision: Schema.Number;
@@ -1803,6 +1830,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1803
1830
  readonly protocol: Schema.Literal<1>;
1804
1831
  readonly participant_id: Schema.String;
1805
1832
  readonly participant_generation: Schema.Number;
1833
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
1806
1834
  readonly recovery_id: Schema.String;
1807
1835
  readonly head: Schema.Struct<{
1808
1836
  readonly revision: Schema.Number;
@@ -2176,6 +2204,9 @@ export declare const PresenceProjectionItemSchema: Schema.Struct<{
2176
2204
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
2177
2205
  readonly speaking: Schema.Boolean;
2178
2206
  readonly active_speaker: Schema.Boolean;
2207
+ readonly identity_id: Schema.optional<Schema.String>;
2208
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
2209
+ readonly admission_revision: Schema.optional<Schema.Number>;
2179
2210
  }>;
2180
2211
  export declare const MediaProjectionSnapshotFrameSchema: Schema.Struct<{
2181
2212
  readonly journey_id: Schema.optional<Schema.String>;
@@ -2205,6 +2236,9 @@ export declare const PresenceProjectionSnapshotFrameSchema: Schema.Struct<{
2205
2236
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
2206
2237
  readonly speaking: Schema.Boolean;
2207
2238
  readonly active_speaker: Schema.Boolean;
2239
+ readonly identity_id: Schema.optional<Schema.String>;
2240
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
2241
+ readonly admission_revision: Schema.optional<Schema.Number>;
2208
2242
  }>>;
2209
2243
  }>;
2210
2244
  export declare const MediaProjectionEventFrameSchema: Schema.Struct<{
@@ -2235,6 +2269,9 @@ export declare const PresenceProjectionEventFrameSchema: Schema.Struct<{
2235
2269
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
2236
2270
  readonly speaking: Schema.Boolean;
2237
2271
  readonly active_speaker: Schema.Boolean;
2272
+ readonly identity_id: Schema.optional<Schema.String>;
2273
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
2274
+ readonly admission_revision: Schema.optional<Schema.Number>;
2238
2275
  }>;
2239
2276
  }>;
2240
2277
  export declare const ProjectionFrameSchema: Schema.Union<readonly [Schema.Struct<{
@@ -2264,6 +2301,9 @@ export declare const ProjectionFrameSchema: Schema.Union<readonly [Schema.Struct
2264
2301
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
2265
2302
  readonly speaking: Schema.Boolean;
2266
2303
  readonly active_speaker: Schema.Boolean;
2304
+ readonly identity_id: Schema.optional<Schema.String>;
2305
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
2306
+ readonly admission_revision: Schema.optional<Schema.Number>;
2267
2307
  }>>;
2268
2308
  }>, Schema.Struct<{
2269
2309
  readonly journey_id: Schema.optional<Schema.String>;
@@ -2292,6 +2332,9 @@ export declare const ProjectionFrameSchema: Schema.Union<readonly [Schema.Struct
2292
2332
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
2293
2333
  readonly speaking: Schema.Boolean;
2294
2334
  readonly active_speaker: Schema.Boolean;
2335
+ readonly identity_id: Schema.optional<Schema.String>;
2336
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
2337
+ readonly admission_revision: Schema.optional<Schema.Number>;
2295
2338
  }>;
2296
2339
  }>]>;
2297
2340
  export declare const LiveTargetOutcomeSchema: Schema.Union<readonly [Schema.Literal<"confirmed">, Schema.Literal<"satisfied">, Schema.Literal<"retryable_failure">, Schema.Literal<"terminal_failure">, Schema.Literal<"ambiguous">]>;
@@ -2762,6 +2805,7 @@ export declare const SyncV1ClientFrameSchema: Schema.decodeTo<Schema.Union<reado
2762
2805
  readonly journey_id: Schema.optional<Schema.String>;
2763
2806
  readonly traceparent: Schema.optional<Schema.String>;
2764
2807
  readonly tracestate: Schema.optional<Schema.String>;
2808
+ readonly baggage: Schema.optional<Schema.String>;
2765
2809
  readonly type: Schema.Literal<"hello">;
2766
2810
  readonly protocol: Schema.Literal<1>;
2767
2811
  readonly token: Schema.String;
@@ -2794,6 +2838,7 @@ export declare const SyncV1ClientFrameSchema: Schema.decodeTo<Schema.Union<reado
2794
2838
  readonly journey_id: Schema.optional<Schema.String>;
2795
2839
  readonly traceparent: Schema.optional<Schema.String>;
2796
2840
  readonly tracestate: Schema.optional<Schema.String>;
2841
+ readonly baggage: Schema.optional<Schema.String>;
2797
2842
  readonly type: Schema.Literal<"hello">;
2798
2843
  readonly protocol: Schema.Literal<1>;
2799
2844
  readonly token: Schema.String;
@@ -2984,6 +3029,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
2984
3029
  readonly protocol: Schema.Literal<1>;
2985
3030
  readonly participant_id: Schema.String;
2986
3031
  readonly participant_generation: Schema.Number;
3032
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
2987
3033
  readonly recovery_id: Schema.String;
2988
3034
  readonly head: Schema.Struct<{
2989
3035
  readonly revision: Schema.Number;
@@ -3044,6 +3090,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3044
3090
  readonly protocol: Schema.Literal<1>;
3045
3091
  readonly participant_id: Schema.String;
3046
3092
  readonly participant_generation: Schema.Number;
3093
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3047
3094
  readonly recovery_id: Schema.String;
3048
3095
  readonly head: Schema.Struct<{
3049
3096
  readonly revision: Schema.Number;
@@ -3074,6 +3121,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3074
3121
  readonly protocol: Schema.Literal<1>;
3075
3122
  readonly participant_id: Schema.String;
3076
3123
  readonly participant_generation: Schema.Number;
3124
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3077
3125
  readonly recovery_id: Schema.String;
3078
3126
  readonly head: Schema.Struct<{
3079
3127
  readonly revision: Schema.Number;
@@ -3104,6 +3152,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3104
3152
  readonly protocol: Schema.Literal<1>;
3105
3153
  readonly participant_id: Schema.String;
3106
3154
  readonly participant_generation: Schema.Number;
3155
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3107
3156
  readonly recovery_id: Schema.String;
3108
3157
  readonly head: Schema.Struct<{
3109
3158
  readonly revision: Schema.Number;
@@ -3135,6 +3184,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3135
3184
  readonly protocol: Schema.Literal<1>;
3136
3185
  readonly participant_id: Schema.String;
3137
3186
  readonly participant_generation: Schema.Number;
3187
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3138
3188
  readonly recovery_id: Schema.String;
3139
3189
  readonly head: Schema.Struct<{
3140
3190
  readonly revision: Schema.Number;
@@ -3182,6 +3232,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3182
3232
  readonly protocol: Schema.Literal<1>;
3183
3233
  readonly participant_id: Schema.String;
3184
3234
  readonly participant_generation: Schema.Number;
3235
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3185
3236
  readonly recovery_id: Schema.String;
3186
3237
  readonly head: Schema.Struct<{
3187
3238
  readonly revision: Schema.Number;
@@ -3199,6 +3250,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3199
3250
  readonly protocol: Schema.Literal<1>;
3200
3251
  readonly participant_id: Schema.String;
3201
3252
  readonly participant_generation: Schema.Number;
3253
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3202
3254
  readonly recovery_id: Schema.String;
3203
3255
  readonly head: Schema.Struct<{
3204
3256
  readonly revision: Schema.Number;
@@ -3216,6 +3268,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3216
3268
  readonly protocol: Schema.Literal<1>;
3217
3269
  readonly participant_id: Schema.String;
3218
3270
  readonly participant_generation: Schema.Number;
3271
+ readonly participant_identity_id: Schema.optionalKey<Schema.String>;
3219
3272
  readonly recovery_id: Schema.String;
3220
3273
  readonly head: Schema.Struct<{
3221
3274
  readonly revision: Schema.Number;
@@ -3882,6 +3935,9 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3882
3935
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
3883
3936
  readonly speaking: Schema.Boolean;
3884
3937
  readonly active_speaker: Schema.Boolean;
3938
+ readonly identity_id: Schema.optional<Schema.String>;
3939
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
3940
+ readonly admission_revision: Schema.optional<Schema.Number>;
3885
3941
  }>>;
3886
3942
  }>, Schema.Struct<{
3887
3943
  readonly journey_id: Schema.optional<Schema.String>;
@@ -3910,6 +3966,9 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3910
3966
  readonly state: Schema.Union<readonly [Schema.Literal<"connected">, Schema.Literal<"disconnected">]>;
3911
3967
  readonly speaking: Schema.Boolean;
3912
3968
  readonly active_speaker: Schema.Boolean;
3969
+ readonly identity_id: Schema.optional<Schema.String>;
3970
+ readonly device_type: Schema.optional<Schema.Literals<readonly ["phone", "tablet", "computer"]>>;
3971
+ readonly admission_revision: Schema.optional<Schema.Number>;
3913
3972
  }>;
3914
3973
  }>]>, Schema.Struct<{
3915
3974
  readonly journey_id: Schema.optional<Schema.String>;
package/dist/index.d.ts CHANGED
@@ -5,5 +5,6 @@ export * from "./space-client";
5
5
  export * from "./sync";
6
6
  export * from "./whiteboard";
7
7
  export * from "./public-invites";
8
+ export { currentSessionId, newSessionId, requestContextHeaders, SESSION_ID_KEY, sessionBaggage, setSessionSource, withRequestContext, type SessionSource } from "./session";
8
9
  export { formatSyncConnectDiagnostic } from "./sync/connect-diagnostics";
9
10
  export { getConnectionFailureDetail } from "./space-client/failure-detail";
package/dist/index.js CHANGED
@@ -15,7 +15,19 @@ import {
15
15
  createSpaceClient,
16
16
  decodeWhiteboardV1ServerFrame,
17
17
  encodeWhiteboardV1ClientFrame
18
- } from "./chunk-I7Y4HR2P.js";
18
+ } from "./chunk-2CEMOTZF.js";
19
+ import {
20
+ createChalkPublicClient,
21
+ createChalkPublicInviteClient,
22
+ parseInviteCode
23
+ } from "./chunk-VAJ6XNAA.js";
24
+ import {
25
+ ArrivalInvalidHandleError,
26
+ ArrivalUnavailableError,
27
+ SpacePublicInviteUnavailableError,
28
+ parseParsedAccessGrant,
29
+ requireAccessGrant
30
+ } from "./chunk-MHJ4UPM3.js";
19
31
  import {
20
32
  CloudflareSFUClient,
21
33
  CloudflareSFUError,
@@ -26,21 +38,10 @@ import {
26
38
  publicationKey,
27
39
  requireDescription,
28
40
  requireSFUDescription,
41
+ setVideoRenderSize,
29
42
  validatePublicationSnapshot,
30
43
  waitFor
31
- } from "./chunk-YIDKETOX.js";
32
- import {
33
- createChalkPublicClient,
34
- createChalkPublicInviteClient,
35
- parseInviteCode
36
- } from "./chunk-WFRTUBN6.js";
37
- import {
38
- ArrivalInvalidHandleError,
39
- ArrivalUnavailableError,
40
- SpacePublicInviteUnavailableError,
41
- parseParsedAccessGrant,
42
- requireAccessGrant
43
- } from "./chunk-CJVLTSIO.js";
44
+ } from "./chunk-O5JB5XVX.js";
44
45
  import {
45
46
  AsyncStorageV1PendingTargetStore,
46
47
  InMemoryV1PendingTargetStore,
@@ -69,7 +70,16 @@ import {
69
70
  optimisticV1Control,
70
71
  reactionFromFrame,
71
72
  restoreV1Snapshot
72
- } from "./chunk-5YPQNMJE.js";
73
+ } from "./chunk-FD7ZSDTM.js";
74
+ import {
75
+ SESSION_ID_KEY,
76
+ currentSessionId,
77
+ newSessionId,
78
+ requestContextHeaders,
79
+ sessionBaggage,
80
+ setSessionSource,
81
+ withRequestContext
82
+ } from "./chunk-N4IPKRS6.js";
73
83
 
74
84
  // src/space-client/reload-rejoin.ts
75
85
  import { Schema } from "effect";
@@ -149,6 +159,7 @@ export {
149
159
  InMemoryChalkWhiteboardV1PendingOperationStore,
150
160
  InMemoryV1PendingTargetStore,
151
161
  IndexedDbV1PendingTargetStore,
162
+ SESSION_ID_KEY,
152
163
  SpaceClientError,
153
164
  SpacePublicInviteUnavailableError,
154
165
  SyncBrowserCapabilityError,
@@ -176,6 +187,7 @@ export {
176
187
  createReactNativeWebSocketFactory,
177
188
  createSpaceClient,
178
189
  createV1SyncClient,
190
+ currentSessionId,
179
191
  decodeV1ClientFrame,
180
192
  decodeV1ServerFrame,
181
193
  decodeWhiteboardV1ServerFrame,
@@ -184,6 +196,7 @@ export {
184
196
  encodeWhiteboardV1ClientFrame,
185
197
  formatSyncConnectDiagnostic,
186
198
  getConnectionFailureDetail,
199
+ newSessionId,
187
200
  optimisticV1Control,
188
201
  parseCloudflareSFUPublicationID,
189
202
  parseInviteCode,
@@ -192,11 +205,16 @@ export {
192
205
  readReloadRejoin,
193
206
  reloadRejoinAccess,
194
207
  reloadRejoinStorageKey,
208
+ requestContextHeaders,
195
209
  requireDescription,
196
210
  requireSFUDescription,
197
211
  restoreV1Snapshot,
198
212
  resumeReloadRejoin,
213
+ sessionBaggage,
214
+ setSessionSource,
215
+ setVideoRenderSize,
199
216
  validatePublicationSnapshot,
200
217
  waitFor,
218
+ withRequestContext,
201
219
  writeReloadRejoin
202
220
  };
@@ -0,0 +1,27 @@
1
+ import type { components } from "../generated/openapi-types";
2
+ export type CallStatsRequest = components["schemas"]["CallStatsRequest"];
3
+ export type CallStatsSample = CallStatsRequest["samples"][number];
4
+ /** One summary covers this long, so a call makes about six per minute. */
5
+ export declare const CALL_STATS_WINDOW_MS = 10000;
6
+ /** A batch uploads once it holds this many samples (about a minute of call). */
7
+ export declare const CALL_STATS_UPLOAD_SAMPLES = 6;
8
+ /** The API rejects larger batches. */
9
+ export declare const CALL_STATS_MAX_BATCH = 30;
10
+ /** The API rejects a window longer than this and drops the whole batch, so a longer gap (a stalled tab, a sleeping device) is skipped. */
11
+ export declare const CALL_STATS_MAX_WINDOW_MS = 60000;
12
+ /** Per-call cap: about an hour of samples. Later windows are dropped. */
13
+ export declare const CALL_STATS_CALL_CAP = 360;
14
+ export type CallStatsCollector = {
15
+ /** Feed one `getStats()` report. Cheap; summarises once a window has elapsed. */
16
+ readonly observe: (report: RTCStatsReport) => void;
17
+ /** Close the open window (if long enough) and upload what is buffered with `upload`, once any upload in flight ends. */
18
+ readonly flush: (upload: Upload) => Promise<void>;
19
+ /** A new peer connection starts new counters: drop the open window and its baseline, keep what is already buffered. */
20
+ readonly reset: () => void;
21
+ };
22
+ type Upload = (request: CallStatsRequest) => Promise<void>;
23
+ export declare function createCallStatsCollector(options: {
24
+ readonly upload: Upload;
25
+ readonly now?: () => number;
26
+ }): CallStatsCollector;
27
+ export {};
@@ -7,12 +7,12 @@ export declare class CloudflareSFUClient implements ClientMediaPlane {
7
7
  subscribe(listener: () => void): () => void;
8
8
  remotePublicationResumed(publicationId: string): void;
9
9
  remoteParticipantsChanged(participantIds: readonly string[]): void;
10
- remotePublicationsChanged(): void;
10
+ remotePublicationsChanged(publications?: readonly MediaPublication[], projectionState?: "available" | "unavailable"): void;
11
11
  prepareLocalTrack(source: MediaPublicationSource, track: MediaStreamTrack): void;
12
12
  clearPreparedLocalTrack(source: MediaPublicationSource, options?: {
13
13
  readonly stopTrack?: boolean;
14
14
  }): Promise<void>;
15
- start(localMedia: MediaStream): Promise<void>;
15
+ start(localMedia: MediaStream, beforePublish?: () => Promise<MediaStream>): Promise<void>;
16
16
  refreshRemotePublications(): Promise<void>;
17
17
  setLocalPublicationTarget(target: MediaPlaneTarget): Promise<MediaPlaneResult>;
18
18
  pauseLocalCapture(source: "microphone" | "camera"): Promise<void>;
@@ -0,0 +1,3 @@
1
+ import type { CloudflareSFUBootstrap } from "./types";
2
+ /** The server sends TURN with its STUN entry; an older server sends only `stunServer`. */
3
+ export declare function iceServersFor(bootstrap: CloudflareSFUBootstrap): RTCIceServer[];
@@ -1,3 +1,5 @@
1
1
  export * from "./cloudflare-sfu";
2
2
  export type { ClientMediaPlane, ConnectionMediaLocalTrack, ConnectionMediaPhase, ConnectionMediaRemoteTrack, ConnectionMediaSnapshot, MediaPlaneOutcome, MediaPlaneResult, MediaPlaneTarget, MediaPublication, MediaPublicationSource, MediaSource } from "./plane";
3
3
  export { describeMediaCaptureError } from "./capture-error";
4
+ export { setVideoRenderSize } from "./video-render-size";
5
+ export type { VideoRenderSize } from "./video-render-size";
@@ -8,9 +8,11 @@ import {
8
8
  publicationKey,
9
9
  requireDescription,
10
10
  requireSFUDescription,
11
+ setVideoRenderSize,
11
12
  validatePublicationSnapshot,
12
13
  waitFor
13
- } from "../chunk-YIDKETOX.js";
14
+ } from "../chunk-O5JB5XVX.js";
15
+ import "../chunk-N4IPKRS6.js";
14
16
  export {
15
17
  CloudflareSFUClient,
16
18
  CloudflareSFUError,
@@ -21,6 +23,7 @@ export {
21
23
  publicationKey,
22
24
  requireDescription,
23
25
  requireSFUDescription,
26
+ setVideoRenderSize,
24
27
  validatePublicationSnapshot,
25
28
  waitFor
26
29
  };
@@ -1,6 +1,6 @@
1
1
  import type { operations } from "../generated/openapi-types";
2
2
  export type MediaConnectionReplacementCause = NonNullable<NonNullable<operations["addCloudflareSFUTracks"]["parameters"]["query"]>["replacement_cause"]>;
3
- export type LocalPublicationRetirementCause = Exclude<MediaConnectionReplacementCause, "local_signaling_failure" | "remote_signaling_failure" | "dormant_connection" | "access_refresh">;
3
+ export type LocalPublicationRetirementCause = Exclude<MediaConnectionReplacementCause, "local_signaling_failure" | "remote_signaling_failure" | "dormant_connection" | "access_refresh" | "receive_stalled">;
4
4
  export type ScreenShareSurface = "monitor" | "window" | "browser";
5
5
  export type ScreenShareOptions = {
6
6
  readonly surface?: ScreenShareSurface;
@@ -27,6 +27,7 @@ export type ConnectionMediaRemoteTrack = Pick<MediaPublication, "participantId"
27
27
  readonly track: MediaStreamTrack;
28
28
  };
29
29
  export type ConnectionMediaSnapshot = {
30
+ readonly receiveStalls?: readonly import("./receive-stall").ReceiveStallObservation[];
30
31
  readonly connection: {
31
32
  readonly phase: ConnectionMediaPhase;
32
33
  readonly peerConnectionState: RTCPeerConnectionState | null;
@@ -62,7 +63,8 @@ export type ClientMediaPlane = {
62
63
  readonly closeForcedLocalPublication?: (source: MediaSource, cause?: LocalPublicationRetirementCause) => Promise<void>;
63
64
  readonly observeLocalPublications: (listener: (publications: readonly MediaPublication[]) => void) => () => void;
64
65
  readonly observeRemotePublications: (listener: (publications: readonly MediaPublication[]) => void) => () => void;
65
- readonly remotePublicationsChanged?: () => void;
66
+ /** Unavailable suspends receive eligibility without withdrawing publication identities. */
67
+ readonly remotePublicationsChanged?: (publications?: readonly MediaPublication[], projectionState?: "available" | "unavailable") => void;
66
68
  readonly remoteParticipantsChanged?: (participantIds: readonly string[]) => void;
67
69
  readonly remotePublicationResumed?: (publicationId: string) => void;
68
70
  };
@@ -0,0 +1,52 @@
1
+ import type { MediaPublication } from "./plane";
2
+ import type { CloudflareSFURemoteTrack } from "./types";
3
+ export declare const RECEIVE_STALL_WINDOW_MS = 7000;
4
+ export declare const RECEIVE_STARTUP_GRACE_MS = 20000;
5
+ export type ReceivePacketSample = {
6
+ readonly publicationId: string;
7
+ readonly trackId: string;
8
+ readonly packets: number;
9
+ };
10
+ /** Only consecutive, timely observations of expected media establish a stall. */
11
+ export declare class ReceiveStallDetector {
12
+ #private;
13
+ forget(publicationId: string): void;
14
+ clear(): void;
15
+ sample(now: number, tracks: readonly ReceivePacketSample[]): {
16
+ readonly stalled: readonly string[];
17
+ readonly advanced: readonly string[];
18
+ readonly resumed: readonly string[];
19
+ };
20
+ }
21
+ export type ReceiveStallObservation = {
22
+ readonly event: "receive_stalled";
23
+ readonly scope: "partial" | "all";
24
+ readonly observedAtMs: number;
25
+ readonly expectedTracks: number;
26
+ readonly stalledTracks: number;
27
+ };
28
+ /**
29
+ * Owns eligibility, pending stalls and the budget across replacement peers.
30
+ * Rebuild budgets belong to a remote participant's source, not to one publication id:
31
+ * a rebuild republishes every local track, and the peers' replacement publications must not renew them.
32
+ */
33
+ export declare class ReceiveStallRecovery {
34
+ #private;
35
+ get observations(): readonly ReceiveStallObservation[];
36
+ expect(publications: readonly MediaPublication[], participantId: string): void;
37
+ suspend(): void;
38
+ isStalled(publicationId: string): boolean;
39
+ canRepull(id: string): boolean;
40
+ reserveRepull(id: string): boolean;
41
+ restarted(id: string): void;
42
+ canRebuild(id?: string): boolean;
43
+ reserveRebuild(): boolean;
44
+ /** The media connection was replaced: its receivers are gone, so nothing is awaiting a restore. */
45
+ replaced(): void;
46
+ clear(): void;
47
+ sample(now: number, connection: RTCPeerConnection, report: RTCStatsReport, tracks: Iterable<CloudflareSFURemoteTrack>): {
48
+ readonly stalled: readonly string[];
49
+ readonly advanced: readonly string[];
50
+ readonly newlyStalled: readonly string[];
51
+ };
52
+ }
@@ -1,8 +1,15 @@
1
1
  import type { ConnectionReportTransportEvent } from "../transport-diagnostics";
2
2
  import type { MediaConnectionReplacementCause, MediaPublication, MediaPublicationSource } from "./plane";
3
+ export type CloudflareSFUIceServer = {
4
+ readonly urls: readonly string[];
5
+ readonly username?: string;
6
+ readonly credential?: string;
7
+ };
3
8
  export type CloudflareSFUBootstrap = {
4
9
  readonly connectionId: string;
5
10
  readonly stunServer: string;
11
+ /** STUN and TURN servers from the API. Absent on older servers, which means STUN only. */
12
+ readonly iceServers?: readonly CloudflareSFUIceServer[];
6
13
  };
7
14
  export type CloudflareSFUSessionDescription = {
8
15
  readonly type: "offer" | "answer";
@@ -59,12 +66,24 @@ export type CloudflareSFUSignalingTransport = {
59
66
  readonly sessionDescription?: CloudflareSFUSessionDescription;
60
67
  readonly tracks: readonly CloudflareSFUCloseTrackRequest[];
61
68
  readonly force: boolean;
69
+ readonly receiveOnly?: boolean;
70
+ }) => Promise<CloudflareSFUTracksResponse>;
71
+ /** Changes the simulcast layer of tracks already pulled, without renegotiating. Transports without it keep the layer chosen at pull time. */
72
+ readonly updateTracks?: (input: {
73
+ readonly connectionId: string;
74
+ readonly tracks: readonly CloudflareSFUTrackRequest[];
62
75
  }) => Promise<CloudflareSFUTracksResponse>;
63
76
  readonly renegotiate: (input: {
64
77
  readonly connectionId: string;
65
78
  readonly sessionDescription: CloudflareSFUSessionDescription;
66
79
  }) => Promise<void>;
67
80
  readonly listPublications: () => Promise<CloudflareSFUPublicationSnapshot>;
81
+ /**
82
+ * Best-effort per-call stats upload; transports without it simply report nothing. The `closing`
83
+ * batch reuses the last token and never asks the credential provider, which could refresh access
84
+ * for a participant who just left or was evicted.
85
+ */
86
+ readonly uploadCallStats?: (stats: import("./call-stats").CallStatsRequest, closing: boolean) => Promise<void>;
68
87
  };
69
88
  export type CloudflareSFURemoteTrack = CloudflareSFUPublication & {
70
89
  readonly track: MediaStreamTrack;
@@ -77,6 +96,8 @@ export type CloudflareSFUFailureCode = CloudflareSFUErrorCode;
77
96
  export type CloudflareSFUConnectionPhase = "idle" | "connecting" | "live" | "recovering" | "failed" | "stopped";
78
97
  export type CloudflareSFUPhase = CloudflareSFUConnectionPhase;
79
98
  export type CloudflareSFUSnapshot = {
99
+ /** Omitted by media adapters without receive diagnostics; treat as empty. */
100
+ readonly receiveStalls?: readonly import("./receive-stall").ReceiveStallObservation[];
80
101
  readonly connection: {
81
102
  readonly phase: CloudflareSFUConnectionPhase;
82
103
  readonly peerConnectionState: RTCPeerConnectionState | null;
@@ -0,0 +1,7 @@
1
+ export type VideoRenderSize = {
2
+ readonly width: number;
3
+ readonly height: number;
4
+ };
5
+ /** Tells the media client how large the UI draws a remote video, in device pixels. Pass null when the track leaves the screen. */
6
+ export declare function setVideoRenderSize(track: MediaStreamTrack, size: VideoRenderSize | null): void;
7
+ export declare function videoRenderSize(track: MediaStreamTrack): VideoRenderSize | undefined;