@q9labsai/chalk-client 5.3.0 → 5.4.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 (36) hide show
  1. package/dist/access/grant.d.ts +2 -0
  2. package/dist/{chunk-GOSWSXTH.js → chunk-MHJ4UPM3.js} +162 -5
  3. package/dist/chunk-N4IPKRS6.js +76 -0
  4. package/dist/{chunk-DHUHTIU7.js → chunk-TA2BJXI7.js} +243 -45
  5. package/dist/{chunk-3TGVTP6Z.js → chunk-UVWRTXNO.js} +894 -72
  6. package/dist/{chunk-O26BHHMI.js → chunk-VAJ6XNAA.js} +1 -1
  7. package/dist/{chunk-XSB2GDRW.js → chunk-XF567GPH.js} +198 -26
  8. package/dist/client.d.ts +180 -0
  9. package/dist/connection/dependencies.d.ts +5 -0
  10. package/dist/connection/production.d.ts +1 -1
  11. package/dist/effect.js +29 -4
  12. package/dist/generated/http-api.d.ts +178 -0
  13. package/dist/generated/schemas.d.ts +287 -0
  14. package/dist/generated/sync.d.ts +53 -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 +1 -0
  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 +1 -0
  23. package/dist/media/receive-stall.d.ts +11 -2
  24. package/dist/media/types.d.ts +19 -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 +18 -4
  29. package/dist/server/index.js +18 -4
  30. package/dist/session/index.d.ts +18 -0
  31. package/dist/sync/index.js +2 -1
  32. package/dist/sync/link-watch.d.ts +67 -0
  33. package/dist/sync/v1-client.d.ts +5 -0
  34. package/dist/sync/v1-command-scheduler.d.ts +4 -0
  35. package/dist/sync/v1-types.d.ts +12 -1
  36. package/package.json +2 -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;
@@ -1321,6 +1333,7 @@ export declare const WelcomeSnapshotFrameSchema: Schema.Struct<{
1321
1333
  readonly state_digest: Schema.String;
1322
1334
  }>;
1323
1335
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1336
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1324
1337
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1325
1338
  readonly mode: Schema.Literal<"snapshot">;
1326
1339
  readonly snapshot: Schema.Struct<{
@@ -1370,6 +1383,7 @@ export declare const WelcomeReplayFrameSchema: Schema.Struct<{
1370
1383
  readonly state_digest: Schema.String;
1371
1384
  }>;
1372
1385
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1386
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1373
1387
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1374
1388
  readonly mode: Schema.Literal<"replay">;
1375
1389
  }>;
@@ -1389,6 +1403,7 @@ export declare const WelcomeUpToDateFrameSchema: Schema.Struct<{
1389
1403
  readonly state_digest: Schema.String;
1390
1404
  }>;
1391
1405
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1406
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1392
1407
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1393
1408
  readonly mode: Schema.Literal<"up_to_date">;
1394
1409
  }>;
@@ -1408,6 +1423,7 @@ export declare const WelcomeTerminalFrameSchema: Schema.Struct<{
1408
1423
  readonly state_digest: Schema.String;
1409
1424
  }>;
1410
1425
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1426
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1411
1427
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1412
1428
  readonly mode: Schema.Literal<"terminal">;
1413
1429
  readonly reason: Schema.Union<readonly [Schema.Literal<"episode_ended">, Schema.Literal<"participant_inactive">, Schema.Literal<"stale_participant_generation">]>;
@@ -1428,6 +1444,7 @@ export declare const ExtendedWelcomeSnapshotFrameSchema: Schema.Struct<{
1428
1444
  readonly state_digest: Schema.String;
1429
1445
  }>;
1430
1446
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1447
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1431
1448
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1432
1449
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1433
1450
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1490,6 +1507,7 @@ export declare const ExtendedWelcomeReplayFrameSchema: Schema.Struct<{
1490
1507
  readonly state_digest: Schema.String;
1491
1508
  }>;
1492
1509
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1510
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1493
1511
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1494
1512
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1495
1513
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1522,6 +1540,7 @@ export declare const ExtendedWelcomeUpToDateFrameSchema: Schema.Struct<{
1522
1540
  readonly state_digest: Schema.String;
1523
1541
  }>;
1524
1542
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1543
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1525
1544
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1526
1545
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1527
1546
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1554,6 +1573,7 @@ export declare const ExtendedWelcomeTerminalFrameSchema: Schema.Struct<{
1554
1573
  readonly state_digest: Schema.String;
1555
1574
  }>;
1556
1575
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1576
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1557
1577
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1558
1578
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1559
1579
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1587,6 +1607,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1587
1607
  readonly state_digest: Schema.String;
1588
1608
  }>;
1589
1609
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1610
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1590
1611
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1591
1612
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1592
1613
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1648,6 +1669,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1648
1669
  readonly state_digest: Schema.String;
1649
1670
  }>;
1650
1671
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1672
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1651
1673
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1652
1674
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1653
1675
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1679,6 +1701,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1679
1701
  readonly state_digest: Schema.String;
1680
1702
  }>;
1681
1703
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1704
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1682
1705
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1683
1706
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1684
1707
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1710,6 +1733,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1710
1733
  readonly state_digest: Schema.String;
1711
1734
  }>;
1712
1735
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1736
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1713
1737
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1714
1738
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
1715
1739
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -1742,6 +1766,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1742
1766
  readonly state_digest: Schema.String;
1743
1767
  }>;
1744
1768
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1769
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1745
1770
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1746
1771
  readonly mode: Schema.Literal<"snapshot">;
1747
1772
  readonly snapshot: Schema.Struct<{
@@ -1790,6 +1815,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1790
1815
  readonly state_digest: Schema.String;
1791
1816
  }>;
1792
1817
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1818
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1793
1819
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1794
1820
  readonly mode: Schema.Literal<"replay">;
1795
1821
  }>, Schema.Struct<{
@@ -1808,6 +1834,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1808
1834
  readonly state_digest: Schema.String;
1809
1835
  }>;
1810
1836
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1837
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1811
1838
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1812
1839
  readonly mode: Schema.Literal<"up_to_date">;
1813
1840
  }>, Schema.Struct<{
@@ -1826,6 +1853,7 @@ export declare const WelcomeFrameSchema: Schema.Union<readonly [Schema.Struct<{
1826
1853
  readonly state_digest: Schema.String;
1827
1854
  }>;
1828
1855
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
1856
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
1829
1857
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
1830
1858
  readonly mode: Schema.Literal<"terminal">;
1831
1859
  readonly reason: Schema.Union<readonly [Schema.Literal<"episode_ended">, Schema.Literal<"participant_inactive">, Schema.Literal<"stale_participant_generation">]>;
@@ -2186,6 +2214,8 @@ export declare const MediaProjectionItemSchema: Schema.Struct<{
2186
2214
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
2187
2215
  readonly enabled: Schema.Boolean;
2188
2216
  readonly publication_id: Schema.NullOr<Schema.String>;
2217
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
2218
+ readonly off_revision: Schema.optional<Schema.Number>;
2189
2219
  }>;
2190
2220
  export declare const PresenceProjectionItemSchema: Schema.Struct<{
2191
2221
  readonly participant_id: Schema.String;
@@ -2209,6 +2239,8 @@ export declare const MediaProjectionSnapshotFrameSchema: Schema.Struct<{
2209
2239
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
2210
2240
  readonly enabled: Schema.Boolean;
2211
2241
  readonly publication_id: Schema.NullOr<Schema.String>;
2242
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
2243
+ readonly off_revision: Schema.optional<Schema.Number>;
2212
2244
  }>>;
2213
2245
  }>;
2214
2246
  export declare const PresenceProjectionSnapshotFrameSchema: Schema.Struct<{
@@ -2242,6 +2274,8 @@ export declare const MediaProjectionEventFrameSchema: Schema.Struct<{
2242
2274
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
2243
2275
  readonly enabled: Schema.Boolean;
2244
2276
  readonly publication_id: Schema.NullOr<Schema.String>;
2277
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
2278
+ readonly off_revision: Schema.optional<Schema.Number>;
2245
2279
  }>;
2246
2280
  }>;
2247
2281
  export declare const PresenceProjectionEventFrameSchema: Schema.Struct<{
@@ -2275,6 +2309,8 @@ export declare const ProjectionFrameSchema: Schema.Union<readonly [Schema.Struct
2275
2309
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
2276
2310
  readonly enabled: Schema.Boolean;
2277
2311
  readonly publication_id: Schema.NullOr<Schema.String>;
2312
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
2313
+ readonly off_revision: Schema.optional<Schema.Number>;
2278
2314
  }>>;
2279
2315
  }>, Schema.Struct<{
2280
2316
  readonly journey_id: Schema.optional<Schema.String>;
@@ -2306,6 +2342,8 @@ export declare const ProjectionFrameSchema: Schema.Union<readonly [Schema.Struct
2306
2342
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
2307
2343
  readonly enabled: Schema.Boolean;
2308
2344
  readonly publication_id: Schema.NullOr<Schema.String>;
2345
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
2346
+ readonly off_revision: Schema.optional<Schema.Number>;
2309
2347
  }>;
2310
2348
  }>, Schema.Struct<{
2311
2349
  readonly journey_id: Schema.optional<Schema.String>;
@@ -2793,6 +2831,7 @@ export declare const SyncV1ClientFrameSchema: Schema.decodeTo<Schema.Union<reado
2793
2831
  readonly journey_id: Schema.optional<Schema.String>;
2794
2832
  readonly traceparent: Schema.optional<Schema.String>;
2795
2833
  readonly tracestate: Schema.optional<Schema.String>;
2834
+ readonly baggage: Schema.optional<Schema.String>;
2796
2835
  readonly type: Schema.Literal<"hello">;
2797
2836
  readonly protocol: Schema.Literal<1>;
2798
2837
  readonly token: Schema.String;
@@ -2825,6 +2864,7 @@ export declare const SyncV1ClientFrameSchema: Schema.decodeTo<Schema.Union<reado
2825
2864
  readonly journey_id: Schema.optional<Schema.String>;
2826
2865
  readonly traceparent: Schema.optional<Schema.String>;
2827
2866
  readonly tracestate: Schema.optional<Schema.String>;
2867
+ readonly baggage: Schema.optional<Schema.String>;
2828
2868
  readonly type: Schema.Literal<"hello">;
2829
2869
  readonly protocol: Schema.Literal<1>;
2830
2870
  readonly token: Schema.String;
@@ -3023,6 +3063,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3023
3063
  readonly state_digest: Schema.String;
3024
3064
  }>;
3025
3065
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3066
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3026
3067
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3027
3068
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
3028
3069
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -3084,6 +3125,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3084
3125
  readonly state_digest: Schema.String;
3085
3126
  }>;
3086
3127
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3128
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3087
3129
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3088
3130
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
3089
3131
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -3115,6 +3157,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3115
3157
  readonly state_digest: Schema.String;
3116
3158
  }>;
3117
3159
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3160
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3118
3161
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3119
3162
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
3120
3163
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -3146,6 +3189,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3146
3189
  readonly state_digest: Schema.String;
3147
3190
  }>;
3148
3191
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3192
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3149
3193
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3150
3194
  readonly extensions: Schema.Tuple<readonly [Schema.Struct<{
3151
3195
  readonly name: Schema.Literals<readonly ["collaboration_v1", "collaboration_v2"]>;
@@ -3178,6 +3222,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3178
3222
  readonly state_digest: Schema.String;
3179
3223
  }>;
3180
3224
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3225
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3181
3226
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3182
3227
  readonly mode: Schema.Literal<"snapshot">;
3183
3228
  readonly snapshot: Schema.Struct<{
@@ -3226,6 +3271,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3226
3271
  readonly state_digest: Schema.String;
3227
3272
  }>;
3228
3273
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3274
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3229
3275
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3230
3276
  readonly mode: Schema.Literal<"replay">;
3231
3277
  }>, Schema.Struct<{
@@ -3244,6 +3290,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3244
3290
  readonly state_digest: Schema.String;
3245
3291
  }>;
3246
3292
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3293
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3247
3294
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3248
3295
  readonly mode: Schema.Literal<"up_to_date">;
3249
3296
  }>, Schema.Struct<{
@@ -3262,6 +3309,7 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3262
3309
  readonly state_digest: Schema.String;
3263
3310
  }>;
3264
3311
  readonly entry_confirmation: Schema.optionalKey<Schema.Literal<true>>;
3312
+ readonly media_off_reason: Schema.optionalKey<Schema.Literal<true>>;
3265
3313
  readonly entry_generation: Schema.optionalKey<Schema.Number>;
3266
3314
  readonly mode: Schema.Literal<"terminal">;
3267
3315
  readonly reason: Schema.Union<readonly [Schema.Literal<"episode_ended">, Schema.Literal<"participant_inactive">, Schema.Literal<"stale_participant_generation">]>;
@@ -3907,6 +3955,8 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3907
3955
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
3908
3956
  readonly enabled: Schema.Boolean;
3909
3957
  readonly publication_id: Schema.NullOr<Schema.String>;
3958
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
3959
+ readonly off_revision: Schema.optional<Schema.Number>;
3910
3960
  }>>;
3911
3961
  }>, Schema.Struct<{
3912
3962
  readonly journey_id: Schema.optional<Schema.String>;
@@ -3938,6 +3988,8 @@ export declare const SyncV1ServerFrameSchema: Schema.decodeTo<Schema.Union<reado
3938
3988
  readonly source: Schema.Union<readonly [Schema.Literal<"microphone">, Schema.Literal<"camera">, Schema.Literal<"screen">]>;
3939
3989
  readonly enabled: Schema.Boolean;
3940
3990
  readonly publication_id: Schema.NullOr<Schema.String>;
3991
+ readonly off_reason: Schema.optional<Schema.Literals<readonly ["host", "self", "dead"]>>;
3992
+ readonly off_revision: Schema.optional<Schema.Number>;
3941
3993
  }>;
3942
3994
  }>, Schema.Struct<{
3943
3995
  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-DHUHTIU7.js";
18
+ } from "./chunk-TA2BJXI7.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-3TGVTP6Z.js";
32
- import {
33
- createChalkPublicClient,
34
- createChalkPublicInviteClient,
35
- parseInviteCode
36
- } from "./chunk-O26BHHMI.js";
37
- import {
38
- ArrivalInvalidHandleError,
39
- ArrivalUnavailableError,
40
- SpacePublicInviteUnavailableError,
41
- parseParsedAccessGrant,
42
- requireAccessGrant
43
- } from "./chunk-GOSWSXTH.js";
44
+ } from "./chunk-UVWRTXNO.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-XSB2GDRW.js";
73
+ } from "./chunk-XF567GPH.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 {};
@@ -6,6 +6,7 @@ export declare class CloudflareSFUClient implements ClientMediaPlane {
6
6
  getSnapshot(): CloudflareSFUSnapshot;
7
7
  subscribe(listener: () => void): () => void;
8
8
  remotePublicationResumed(publicationId: string): void;
9
+ localPublicationWithdrawn(publicationId: string): void;
9
10
  remoteParticipantsChanged(participantIds: readonly string[]): void;
10
11
  remotePublicationsChanged(publications?: readonly MediaPublication[], projectionState?: "available" | "unavailable"): void;
11
12
  prepareLocalTrack(source: MediaPublicationSource, track: MediaStreamTrack): 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-3TGVTP6Z.js";
14
+ } from "../chunk-UVWRTXNO.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
  };
@@ -67,4 +67,5 @@ export type ClientMediaPlane = {
67
67
  readonly remotePublicationsChanged?: (publications?: readonly MediaPublication[], projectionState?: "available" | "unavailable") => void;
68
68
  readonly remoteParticipantsChanged?: (participantIds: readonly string[]) => void;
69
69
  readonly remotePublicationResumed?: (publicationId: string) => void;
70
+ readonly localPublicationWithdrawn?: (publicationId: string) => void;
70
71
  };
@@ -25,15 +25,24 @@ export type ReceiveStallObservation = {
25
25
  readonly expectedTracks: number;
26
26
  readonly stalledTracks: number;
27
27
  };
28
- /** Owns eligibility, pending stalls and the budget across replacement peers. */
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
+ */
29
33
  export declare class ReceiveStallRecovery {
30
34
  #private;
31
35
  get observations(): readonly ReceiveStallObservation[];
32
36
  expect(publications: readonly MediaPublication[], participantId: string): void;
33
37
  suspend(): void;
34
38
  isStalled(publicationId: string): boolean;
35
- canRebuild(): boolean;
39
+ canRepull(id: string): boolean;
40
+ reserveRepull(id: string): boolean;
41
+ restarted(id: string): void;
42
+ canRebuild(id?: string): boolean;
36
43
  reserveRebuild(): boolean;
44
+ /** The media connection was replaced: its receivers are gone, so nothing is awaiting a restore. */
45
+ replaced(): void;
37
46
  clear(): void;
38
47
  sample(now: number, connection: RTCPeerConnection, report: RTCStatsReport, tracks: Iterable<CloudflareSFURemoteTrack>): {
39
48
  readonly stalled: readonly string[];
@@ -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;
@@ -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;
@@ -0,0 +1,48 @@
1
+ export type ViewerLayer = "h" | "l";
2
+ export type ViewerLayerSample = {
3
+ /** Fraction of packets lost since the last sample; undefined when no packet arrived or was lost. */
4
+ readonly lossFraction: number | undefined;
5
+ readonly framesPerSecond: number | undefined;
6
+ readonly newFreezes: number;
7
+ readonly freezeSeconds: number;
8
+ /** Rendered tile height in device pixels, when the UI reports it. */
9
+ readonly tileHeight: number | undefined;
10
+ };
11
+ export declare class ViewerLayerPolicy {
12
+ #private;
13
+ get layer(): ViewerLayer;
14
+ /** Drops fast, rises slowly: a failed attempt at h doubles the wait before the next one. */
15
+ sample(sample: ViewerLayerSample): ViewerLayer;
16
+ }
17
+ type ViewerStatsRow = {
18
+ readonly type?: string;
19
+ readonly kind?: string;
20
+ readonly trackIdentifier?: string;
21
+ readonly timestamp?: number;
22
+ readonly packetsReceived?: number;
23
+ readonly packetsLost?: number;
24
+ readonly framesDecoded?: number;
25
+ readonly freezeCount?: number;
26
+ readonly totalFreezesDuration?: number;
27
+ };
28
+ /** Turns cumulative inbound-rtp counters into per-interval rates for one video track. */
29
+ export declare class ViewerStatsReader {
30
+ #private;
31
+ read(stats: Iterable<ViewerStatsRow>, trackId: string): Pick<ViewerLayerSample, "lossFraction" | "framesPerSecond" | "newFreezes" | "freezeSeconds"> | undefined;
32
+ forget(trackId: string): void;
33
+ }
34
+ export type ViewerLayerCamera = {
35
+ readonly publicationId: string;
36
+ readonly track: MediaStreamTrack;
37
+ };
38
+ export type ViewerLayerChange = ViewerLayerCamera & {
39
+ readonly layer: ViewerLayer;
40
+ };
41
+ /** One per peer connection: owns a policy for each remote camera and reports the switches still to apply. */
42
+ export declare class ViewerLayerSelector {
43
+ #private;
44
+ sample(now: number, report: RTCStatsReport, cameras: readonly ViewerLayerCamera[]): readonly ViewerLayerChange[];
45
+ applied({ publicationId, track, layer }: ViewerLayerChange): void;
46
+ failed({ publicationId, track }: ViewerLayerChange, now: number): void;
47
+ }
48
+ export {};
@@ -2,12 +2,13 @@ import {
2
2
  createChalkPublicClient,
3
3
  createChalkPublicInviteClient,
4
4
  parseInviteCode
5
- } from "../chunk-O26BHHMI.js";
5
+ } from "../chunk-VAJ6XNAA.js";
6
6
  import {
7
7
  ArrivalInvalidHandleError,
8
8
  ArrivalUnavailableError,
9
9
  SpacePublicInviteUnavailableError
10
- } from "../chunk-GOSWSXTH.js";
10
+ } from "../chunk-MHJ4UPM3.js";
11
+ import "../chunk-N4IPKRS6.js";
11
12
  export {
12
13
  ArrivalInvalidHandleError,
13
14
  ArrivalUnavailableError,