@q9labsai/chalk-client 4.0.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.
- package/LICENSE +21 -0
- package/README.md +173 -0
- package/dist/access/base64-url.d.ts +2 -0
- package/dist/access/base64-url.d.ts.map +1 -0
- package/dist/access/episode-diagnostic-credential.d.ts +11 -0
- package/dist/access/episode-diagnostic-credential.d.ts.map +1 -0
- package/dist/access/grant.d.ts +53 -0
- package/dist/access/grant.d.ts.map +1 -0
- package/dist/access/grant.test.helpers.d.ts +10 -0
- package/dist/access/grant.test.helpers.d.ts.map +1 -0
- package/dist/access/manager.d.ts +36 -0
- package/dist/access/manager.d.ts.map +1 -0
- package/dist/chat-files/http-transport.d.ts +8 -0
- package/dist/chat-files/http-transport.d.ts.map +1 -0
- package/dist/chat-files/index.d.ts +3 -0
- package/dist/chat-files/index.d.ts.map +1 -0
- package/dist/chat-files/types.d.ts +37 -0
- package/dist/chat-files/types.d.ts.map +1 -0
- package/dist/chunk-5VXGLI3T.js +3385 -0
- package/dist/chunk-O22WFBKF.js +5161 -0
- package/dist/chunk-PBCGWE2V.js +811 -0
- package/dist/chunk-PBSYXPNJ.js +23 -0
- package/dist/chunk-QVHR3RMB.js +1229 -0
- package/dist/client.d.ts +6785 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/collaboration/index.d.ts +3 -0
- package/dist/collaboration/index.d.ts.map +1 -0
- package/dist/collaboration/types.d.ts +94 -0
- package/dist/collaboration/types.d.ts.map +1 -0
- package/dist/collaboration/wire.d.ts +19 -0
- package/dist/collaboration/wire.d.ts.map +1 -0
- package/dist/connection/dependencies.d.ts +112 -0
- package/dist/connection/dependencies.d.ts.map +1 -0
- package/dist/connection/diagnostics.d.ts +52 -0
- package/dist/connection/diagnostics.d.ts.map +1 -0
- package/dist/connection/index.d.ts +47 -0
- package/dist/connection/index.d.ts.map +1 -0
- package/dist/connection/lifecycle.d.ts +58 -0
- package/dist/connection/lifecycle.d.ts.map +1 -0
- package/dist/connection/media-devices.d.ts +6 -0
- package/dist/connection/media-devices.d.ts.map +1 -0
- package/dist/connection/production.d.ts +13 -0
- package/dist/connection/production.d.ts.map +1 -0
- package/dist/connection/snapshot.d.ts +23 -0
- package/dist/connection/snapshot.d.ts.map +1 -0
- package/dist/connection/types.d.ts +128 -0
- package/dist/connection/types.d.ts.map +1 -0
- package/dist/effect.d.ts +19 -0
- package/dist/effect.d.ts.map +1 -0
- package/dist/effect.js +7846 -0
- package/dist/episode-diagnostic-runtime.test.helpers.d.ts +3 -0
- package/dist/episode-diagnostic-runtime.test.helpers.d.ts.map +1 -0
- package/dist/generated/http-api.d.ts +6658 -0
- package/dist/generated/http-api.d.ts.map +1 -0
- package/dist/generated/schemas.d.ts +12076 -0
- package/dist/generated/schemas.d.ts.map +1 -0
- package/dist/generated/sync.d.ts +3947 -0
- package/dist/generated/sync.d.ts.map +1 -0
- package/dist/generated/whiteboard-v1.d.ts +334 -0
- package/dist/generated/whiteboard-v1.d.ts.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +152 -0
- package/dist/media/client.d.ts +18 -0
- package/dist/media/client.d.ts.map +1 -0
- package/dist/media/cloudflare-sfu.d.ts +5 -0
- package/dist/media/cloudflare-sfu.d.ts.map +1 -0
- package/dist/media/index.d.ts +3 -0
- package/dist/media/index.d.ts.map +1 -0
- package/dist/media/index.js +24 -0
- package/dist/media/plane.d.ts +24 -0
- package/dist/media/plane.d.ts.map +1 -0
- package/dist/media/tracks.d.ts +21 -0
- package/dist/media/tracks.d.ts.map +1 -0
- package/dist/media/transport.d.ts +3 -0
- package/dist/media/transport.d.ts.map +1 -0
- package/dist/media/types.d.ts +114 -0
- package/dist/media/types.d.ts.map +1 -0
- package/dist/server/chunk-A6YMG5FM.js +61 -0
- package/dist/server/client.d.cts +2 -0
- package/dist/server/client.d.ts +3 -0
- package/dist/server/client.d.ts.map +1 -0
- package/dist/server/errors.d.cts +18 -0
- package/dist/server/errors.d.ts +19 -0
- package/dist/server/errors.d.ts.map +1 -0
- package/dist/server/index.cjs +551 -0
- package/dist/server/index.d.cts +3 -0
- package/dist/server/index.d.ts +4 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +474 -0
- package/dist/server/server-only.cjs +40 -0
- package/dist/server/server-only.d.cts +1 -0
- package/dist/server/server-only.d.ts +2 -0
- package/dist/server/server-only.d.ts.map +1 -0
- package/dist/server/server-only.js +9 -0
- package/dist/server/transport.d.cts +12 -0
- package/dist/server/transport.d.ts +13 -0
- package/dist/server/transport.d.ts.map +1 -0
- package/dist/server/types.d.cts +201 -0
- package/dist/server/types.d.ts +202 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/space-client/chat-controller-helpers.d.ts +15 -0
- package/dist/space-client/chat-controller-helpers.d.ts.map +1 -0
- package/dist/space-client/chat-controller.d.ts +34 -0
- package/dist/space-client/chat-controller.d.ts.map +1 -0
- package/dist/space-client/controller-effects.d.ts +45 -0
- package/dist/space-client/controller-effects.d.ts.map +1 -0
- package/dist/space-client/controller-parity.test.helpers.d.ts +150 -0
- package/dist/space-client/controller-parity.test.helpers.d.ts.map +1 -0
- package/dist/space-client/core.d.ts +52 -0
- package/dist/space-client/core.d.ts.map +1 -0
- package/dist/space-client/core.test.helpers.d.ts +14 -0
- package/dist/space-client/core.test.helpers.d.ts.map +1 -0
- package/dist/space-client/effect.d.ts +44 -0
- package/dist/space-client/effect.d.ts.map +1 -0
- package/dist/space-client/episode-diagnostic-registry.d.ts +13 -0
- package/dist/space-client/episode-diagnostic-registry.d.ts.map +1 -0
- package/dist/space-client/episode-diagnostic-render-registry.d.ts +4 -0
- package/dist/space-client/episode-diagnostic-render-registry.d.ts.map +1 -0
- package/dist/space-client/episode-diagnostic-runtime.d.ts +102 -0
- package/dist/space-client/episode-diagnostic-runtime.d.ts.map +1 -0
- package/dist/space-client/errors.d.ts +11 -0
- package/dist/space-client/errors.d.ts.map +1 -0
- package/dist/space-client/index.d.ts +5 -0
- package/dist/space-client/index.d.ts.map +1 -0
- package/dist/space-client/media-controller.d.ts +30 -0
- package/dist/space-client/media-controller.d.ts.map +1 -0
- package/dist/space-client/media-controller.test.helpers.d.ts +105 -0
- package/dist/space-client/media-controller.test.helpers.d.ts.map +1 -0
- package/dist/space-client/media-device-selection.d.ts +13 -0
- package/dist/space-client/media-device-selection.d.ts.map +1 -0
- package/dist/space-client/participants-controller.d.ts +33 -0
- package/dist/space-client/participants-controller.d.ts.map +1 -0
- package/dist/space-client/promise-facade.d.ts +12 -0
- package/dist/space-client/promise-facade.d.ts.map +1 -0
- package/dist/space-client/reactions-controller.d.ts +19 -0
- package/dist/space-client/reactions-controller.d.ts.map +1 -0
- package/dist/space-client/space-client.d.ts +5 -0
- package/dist/space-client/space-client.d.ts.map +1 -0
- package/dist/space-client/store.d.ts +29 -0
- package/dist/space-client/store.d.ts.map +1 -0
- package/dist/space-client/types.d.ts +222 -0
- package/dist/space-client/types.d.ts.map +1 -0
- package/dist/space-client/whiteboard-controller.d.ts +17 -0
- package/dist/space-client/whiteboard-controller.d.ts.map +1 -0
- package/dist/sync/browser.d.ts +9 -0
- package/dist/sync/browser.d.ts.map +1 -0
- package/dist/sync/canonical.d.ts +7 -0
- package/dist/sync/canonical.d.ts.map +1 -0
- package/dist/sync/errors.d.ts +9 -0
- package/dist/sync/errors.d.ts.map +1 -0
- package/dist/sync/index.d.ts +13 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +51 -0
- package/dist/sync/react-native.d.ts +42 -0
- package/dist/sync/react-native.d.ts.map +1 -0
- package/dist/sync/types.d.ts +28 -0
- package/dist/sync/types.d.ts.map +1 -0
- package/dist/sync/v1-client.d.ts +59 -0
- package/dist/sync/v1-client.d.ts.map +1 -0
- package/dist/sync/v1-codec.d.ts +5 -0
- package/dist/sync/v1-codec.d.ts.map +1 -0
- package/dist/sync/v1-create.d.ts +12 -0
- package/dist/sync/v1-create.d.ts.map +1 -0
- package/dist/sync/v1-persistence.d.ts +10 -0
- package/dist/sync/v1-persistence.d.ts.map +1 -0
- package/dist/sync/v1-platform-persistence.d.ts +26 -0
- package/dist/sync/v1-platform-persistence.d.ts.map +1 -0
- package/dist/sync/v1-reducer.d.ts +17 -0
- package/dist/sync/v1-reducer.d.ts.map +1 -0
- package/dist/sync/v1-types.d.ts +197 -0
- package/dist/sync/v1-types.d.ts.map +1 -0
- package/dist/telemetry/attributes.d.ts +7 -0
- package/dist/telemetry/attributes.d.ts.map +1 -0
- package/dist/telemetry/client.d.ts +44 -0
- package/dist/telemetry/client.d.ts.map +1 -0
- package/dist/telemetry/delivery.d.ts +107 -0
- package/dist/telemetry/delivery.d.ts.map +1 -0
- package/dist/telemetry/exporter.d.ts +38 -0
- package/dist/telemetry/exporter.d.ts.map +1 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +48 -0
- package/dist/telemetry/journey.d.ts +52 -0
- package/dist/telemetry/journey.d.ts.map +1 -0
- package/dist/telemetry/random.d.ts +18 -0
- package/dist/telemetry/random.d.ts.map +1 -0
- package/dist/telemetry/rtc.d.ts +35 -0
- package/dist/telemetry/rtc.d.ts.map +1 -0
- package/dist/telemetry/storage.d.ts +22 -0
- package/dist/telemetry/storage.d.ts.map +1 -0
- package/dist/telemetry/sync.d.ts +10 -0
- package/dist/telemetry/sync.d.ts.map +1 -0
- package/dist/telemetry/test-support.d.ts +51 -0
- package/dist/telemetry/test-support.d.ts.map +1 -0
- package/dist/telemetry/trace.d.ts +18 -0
- package/dist/telemetry/trace.d.ts.map +1 -0
- package/dist/telemetry/types.d.ts +109 -0
- package/dist/telemetry/types.d.ts.map +1 -0
- package/dist/webhooks/chunk-UNMJZNTZ.js +31 -0
- package/dist/webhooks/errors.d.cts +8 -0
- package/dist/webhooks/errors.d.ts +9 -0
- package/dist/webhooks/errors.d.ts.map +1 -0
- package/dist/webhooks/generated/event-v1.d.cts +764 -0
- package/dist/webhooks/generated/event-v1.d.ts +765 -0
- package/dist/webhooks/generated/event-v1.d.ts.map +1 -0
- package/dist/webhooks/generated/fixtures-v1.d.cts +46 -0
- package/dist/webhooks/generated/fixtures-v1.d.ts +47 -0
- package/dist/webhooks/generated/fixtures-v1.d.ts.map +1 -0
- package/dist/webhooks/index.cjs +1242 -0
- package/dist/webhooks/index.d.cts +5 -0
- package/dist/webhooks/index.d.ts +6 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +1197 -0
- package/dist/webhooks/processor.d.cts +21 -0
- package/dist/webhooks/processor.d.ts +22 -0
- package/dist/webhooks/processor.d.ts.map +1 -0
- package/dist/webhooks/server-only.cjs +36 -0
- package/dist/webhooks/server-only.d.cts +1 -0
- package/dist/webhooks/server-only.d.ts +2 -0
- package/dist/webhooks/server-only.d.ts.map +1 -0
- package/dist/webhooks/server-only.js +9 -0
- package/dist/webhooks/test.cjs +160 -0
- package/dist/webhooks/test.d.cts +42 -0
- package/dist/webhooks/test.d.ts +43 -0
- package/dist/webhooks/test.d.ts.map +1 -0
- package/dist/webhooks/test.js +137 -0
- package/dist/webhooks/types.d.cts +55 -0
- package/dist/webhooks/types.d.ts +56 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/dist/webhooks/validate.d.cts +5 -0
- package/dist/webhooks/validate.d.ts +6 -0
- package/dist/webhooks/validate.d.ts.map +1 -0
- package/dist/webhooks/verify.d.cts +10 -0
- package/dist/webhooks/verify.d.ts +11 -0
- package/dist/webhooks/verify.d.ts.map +1 -0
- package/dist/whiteboard/file-http-transport.d.ts +9 -0
- package/dist/whiteboard/file-http-transport.d.ts.map +1 -0
- package/dist/whiteboard/index.d.ts +7 -0
- package/dist/whiteboard/index.d.ts.map +1 -0
- package/dist/whiteboard/types.d.ts +139 -0
- package/dist/whiteboard/types.d.ts.map +1 -0
- package/dist/whiteboard/v1-client.d.ts +18 -0
- package/dist/whiteboard/v1-client.d.ts.map +1 -0
- package/dist/whiteboard/v1-codec.d.ts +5 -0
- package/dist/whiteboard/v1-codec.d.ts.map +1 -0
- package/dist/whiteboard/v1-create.d.ts +8 -0
- package/dist/whiteboard/v1-create.d.ts.map +1 -0
- package/dist/whiteboard/v1-multipart.d.ts +30 -0
- package/dist/whiteboard/v1-multipart.d.ts.map +1 -0
- package/dist/whiteboard/v1-persistence.d.ts +9 -0
- package/dist/whiteboard/v1-persistence.d.ts.map +1 -0
- package/package.json +222 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Q9Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# @q9labsai/chalk-client
|
|
2
|
+
|
|
3
|
+
`@q9labsai/chalk-client` is Chalk's framework-agnostic `SpaceClient`. It
|
|
4
|
+
connects a person to a Space, maintains the live Episode, and exposes one
|
|
5
|
+
consistent `SpaceSnapshot` for any UI layer.
|
|
6
|
+
|
|
7
|
+
A Space is the durable place for collaboration: its identity, configuration,
|
|
8
|
+
members, and living content persist between Episodes. An Episode is one bounded
|
|
9
|
+
run of live activity in that Space. `join()` always targets the Space; an
|
|
10
|
+
Episode emerges when appropriate.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add @q9labsai/chalk-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Create and join a Space
|
|
19
|
+
|
|
20
|
+
Your backend mints an `AccessGrant` with the server SDK. Pass it through to the
|
|
21
|
+
client unchanged: it is an opaque signed envelope, so application code does
|
|
22
|
+
not construct or inspect it.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { createSpaceClient, type AccessGrant } from "@q9labsai/chalk-client";
|
|
26
|
+
|
|
27
|
+
const client = createSpaceClient({
|
|
28
|
+
space: "design-review",
|
|
29
|
+
getAccess: async ({ space, reason }): Promise<AccessGrant> => {
|
|
30
|
+
const response = await fetch(`/api/chalk/spaces/${space}/access?reason=${reason}`);
|
|
31
|
+
if (!response.ok) throw new Error("Could not get access");
|
|
32
|
+
return response.json() as Promise<AccessGrant>;
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
await client.join({
|
|
37
|
+
displayName: "Ari",
|
|
38
|
+
microphone: true,
|
|
39
|
+
camera: false,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`getAccess` receives `reason: "join" | "refresh" | "retry"`. `Connection`
|
|
44
|
+
uses it for Entrance freshness, scheduled refresh, wake revalidation, and one
|
|
45
|
+
refresh-and-retry after an access rejection. Keep the callback available for
|
|
46
|
+
the full lifetime of the client.
|
|
47
|
+
|
|
48
|
+
## Snapshot store
|
|
49
|
+
|
|
50
|
+
`subscribe` and `getSnapshot` form a framework-neutral external-store contract.
|
|
51
|
+
Each snapshot has referentially stable slices, so UI code can select only the
|
|
52
|
+
state it needs.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const unsubscribe = client.subscribe(() => {
|
|
56
|
+
const snapshot = client.getSnapshot();
|
|
57
|
+
renderConnection(snapshot.connection.status);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const snapshot = client.getSnapshot();
|
|
61
|
+
if (snapshot.self.can("sendChat")) {
|
|
62
|
+
await client.chat.send({ text: "Ready when you are." });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
unsubscribe();
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
`SpaceSnapshot` contains these slices:
|
|
69
|
+
|
|
70
|
+
- `connection`: status, live Episode summary, and the latest failure
|
|
71
|
+
- `self`: local Participant identity, role, capabilities, hand state, and `can(capability)`
|
|
72
|
+
- `participants`: roster and admission queue
|
|
73
|
+
- `media`: device selection, local and remote media, screen share, and requests
|
|
74
|
+
- `chat`: messages, pending sends, read receipts, unread count, and pagination
|
|
75
|
+
- `reactions`: active transient reactions
|
|
76
|
+
- `whiteboard`: availability and engine state
|
|
77
|
+
|
|
78
|
+
## Lifecycle and Episode controls
|
|
79
|
+
|
|
80
|
+
```ts
|
|
81
|
+
await client.leave();
|
|
82
|
+
await client.endEpisode();
|
|
83
|
+
await client.extendEpisode(15);
|
|
84
|
+
client.dispose();
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`endEpisode` and `extendEpisode` are capability-gated. Use `dispose()` when
|
|
88
|
+
the client will no longer be used; it releases the Connection and its resources.
|
|
89
|
+
|
|
90
|
+
## Feature controllers
|
|
91
|
+
|
|
92
|
+
Lifecycle stays flat on `SpaceClient`; feature commands are namespaced.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
await client.media.setMicrophoneEnabled(true);
|
|
96
|
+
await client.media.setCameraEnabled(true);
|
|
97
|
+
await client.media.setScreenShareEnabled(true);
|
|
98
|
+
await client.media.selectMicrophone("microphone-id");
|
|
99
|
+
await client.media.selectCamera("camera-id");
|
|
100
|
+
await client.media.selectSpeaker("speaker-id");
|
|
101
|
+
await client.media.acceptRequest("request-id");
|
|
102
|
+
await client.media.declineRequest("request-id");
|
|
103
|
+
|
|
104
|
+
await client.chat.send({ text: "Hello" });
|
|
105
|
+
await client.chat.loadOlder();
|
|
106
|
+
await client.chat.markRead("message-id");
|
|
107
|
+
const attachment = await client.chat.files.upload(file);
|
|
108
|
+
const url = client.chat.files.url(attachment);
|
|
109
|
+
|
|
110
|
+
await client.participants.assignRole("participant-id", "collaborator");
|
|
111
|
+
await client.participants.mute("participant-id");
|
|
112
|
+
await client.participants.stopVideo("participant-id");
|
|
113
|
+
await client.participants.stopScreenShare("participant-id");
|
|
114
|
+
await client.participants.requestMedia("participant-id", "microphone");
|
|
115
|
+
await client.participants.remove("participant-id");
|
|
116
|
+
await client.participants.admit("request-id");
|
|
117
|
+
await client.participants.deny("request-id");
|
|
118
|
+
await client.participants.raiseHand();
|
|
119
|
+
await client.participants.lowerHand();
|
|
120
|
+
await client.participants.renameSelf("Ari");
|
|
121
|
+
|
|
122
|
+
await client.reactions.send("🎉");
|
|
123
|
+
const transport = client.whiteboard.transport();
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Events and failures
|
|
127
|
+
|
|
128
|
+
Use `on` for discrete events and snapshots for current state.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
const stopListening = client.on("episodeEnded", ({ episode }) => {
|
|
132
|
+
showEpisodeHistory(episode?.id);
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
client.on("error", ({ error }) => {
|
|
136
|
+
reportSafeDiagnostic(error.code, error.recoverable);
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
stopListening();
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Events are `participantJoined`, `participantLeft`, `episodeEnded`,
|
|
143
|
+
`screenShareStarted`, `screenShareStopped`, and `error`. Public failures use
|
|
144
|
+
stable codes such as `access.invalid`, `episode.ended`, and
|
|
145
|
+
`chat.payload_invalid`.
|
|
146
|
+
|
|
147
|
+
## Journey telemetry
|
|
148
|
+
|
|
149
|
+
Client telemetry is opt-in. Start a `space.join` journey when a Participant
|
|
150
|
+
joins a Space, pass its `context` to HTTP or Sync boundaries, and flush the
|
|
151
|
+
bounded queue when the surface is ready to export:
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { createTelemetryClient } from "@q9labsai/chalk-client/telemetry";
|
|
155
|
+
|
|
156
|
+
const telemetry = createTelemetryClient({ enabled: true, baseUrl: "https://api.example.com" });
|
|
157
|
+
const journey = telemetry.startJourney({ kind: "space.join" });
|
|
158
|
+
const response = await fetch("/api/chalk/spaces/design-review", { headers: journey.headers });
|
|
159
|
+
journey.terminal(response.ok ? "succeeded" : "failed");
|
|
160
|
+
await telemetry.flush();
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Journey events carry `journey_id`, W3C `traceparent`, and optional
|
|
164
|
+
`tracestate`. Attributes and the in-memory timeline are bounded, and the
|
|
165
|
+
built-in client observations record aggregate RTC state only: access-grant
|
|
166
|
+
contents, Participant identity, Space or Episode identifiers, media payloads,
|
|
167
|
+
and request bodies stay out of telemetry.
|
|
168
|
+
|
|
169
|
+
## Effect entry
|
|
170
|
+
|
|
171
|
+
The default entry is Promise-based. Effect applications can use the
|
|
172
|
+
`@q9labsai/chalk-client/effect` entry for the same `SpaceClient` shape as an
|
|
173
|
+
Effect program.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base64-url.d.ts","sourceRoot":"","sources":["../../src/access/base64-url.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOrD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const INTAKE_PATH: "/_internal/episode-diagnostic-events";
|
|
2
|
+
export type EpisodeDiagnosticCredential = Readonly<{
|
|
3
|
+
token: string;
|
|
4
|
+
expiresAt: string;
|
|
5
|
+
generation: number;
|
|
6
|
+
intakePath: typeof INTAKE_PATH;
|
|
7
|
+
}>;
|
|
8
|
+
export declare function parseEpisodeDiagnosticCredential(value: unknown): EpisodeDiagnosticCredential | null;
|
|
9
|
+
export declare function validEpisodeDiagnosticCredential(credential: EpisodeDiagnosticCredential, now: number): boolean;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=episode-diagnostic-credential.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episode-diagnostic-credential.d.ts","sourceRoot":"","sources":["../../src/access/episode-diagnostic-credential.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,WAAW,EAAG,sCAA+C,CAAC;AAGpE,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,OAAO,WAAW,CAAC;CAChC,CAAC,CAAC;AAEH,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,OAAO,GAAG,2BAA2B,GAAG,IAAI,CAWnG;AAED,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,2BAA2B,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9G"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type EpisodeDiagnosticCredential } from "./episode-diagnostic-credential";
|
|
2
|
+
declare const syncCredentialBrand: unique symbol;
|
|
3
|
+
declare const mediaCredentialBrand: unique symbol;
|
|
4
|
+
declare const accessGrantBrand: unique symbol;
|
|
5
|
+
export type ParticipantSyncCredential = string & {
|
|
6
|
+
readonly [syncCredentialBrand]: "chalk-sync";
|
|
7
|
+
};
|
|
8
|
+
export type ParticipantMediaCredential = string & {
|
|
9
|
+
readonly [mediaCredentialBrand]: "chalk-media";
|
|
10
|
+
};
|
|
11
|
+
export type AccessSubject = {
|
|
12
|
+
readonly tenantId: string;
|
|
13
|
+
readonly spaceId: string;
|
|
14
|
+
readonly episodeId: string;
|
|
15
|
+
readonly participantId: string;
|
|
16
|
+
readonly participantGeneration: number;
|
|
17
|
+
};
|
|
18
|
+
export type ParticipantSyncAccess = {
|
|
19
|
+
readonly token: ParticipantSyncCredential;
|
|
20
|
+
readonly expiresAt: string;
|
|
21
|
+
};
|
|
22
|
+
export type ParticipantMediaAccess = {
|
|
23
|
+
readonly token: ParticipantMediaCredential;
|
|
24
|
+
readonly expiresAt: string;
|
|
25
|
+
readonly provider: "cloudflare_sfu";
|
|
26
|
+
readonly clientPayload: {
|
|
27
|
+
readonly connectionId: string;
|
|
28
|
+
readonly stunServer: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export type ParsedAccessGrant = {
|
|
32
|
+
readonly subject: AccessSubject;
|
|
33
|
+
readonly sync: ParticipantSyncAccess;
|
|
34
|
+
readonly media: ParticipantMediaAccess;
|
|
35
|
+
readonly diagnostics?: EpisodeDiagnosticCredential | null;
|
|
36
|
+
};
|
|
37
|
+
/** Opaque signed envelope minted by the server SDK and consumed by SpaceClient. */
|
|
38
|
+
export type AccessGrant = {
|
|
39
|
+
readonly [accessGrantBrand]: "AccessGrant";
|
|
40
|
+
};
|
|
41
|
+
export type AccessGrantProvider = () => ParsedAccessGrant | Promise<ParsedAccessGrant>;
|
|
42
|
+
export declare class AccessGrantError extends TypeError {
|
|
43
|
+
readonly code: "access.invalid";
|
|
44
|
+
constructor(message?: string);
|
|
45
|
+
}
|
|
46
|
+
export declare function parseParsedAccessGrant(value: unknown): ParsedAccessGrant;
|
|
47
|
+
export declare function parseAccessGrant(value: unknown): AccessGrant;
|
|
48
|
+
export declare function accessGrantFromParsed(value: ParsedAccessGrant): AccessGrant;
|
|
49
|
+
export declare function requireParsedAccessGrant(value: unknown): Promise<ParsedAccessGrant>;
|
|
50
|
+
export declare function requireAccessGrant(value: unknown): Promise<AccessGrant>;
|
|
51
|
+
export declare function isParsedAccessGrant(value: unknown): value is ParsedAccessGrant;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=grant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../../src/access/grant.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoC,KAAK,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAGrH,OAAO,CAAC,MAAM,mBAAmB,EAAE,OAAO,MAAM,CAAC;AACjD,OAAO,CAAC,MAAM,oBAAoB,EAAE,OAAO,MAAM,CAAC;AAClD,QAAA,MAAM,gBAAgB,EAAE,OAAO,MAA8B,CAAC;AAE9D,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,mBAAmB,CAAC,EAAE,YAAY,CAAA;CAAE,CAAC;AAClG,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,oBAAoB,CAAC,EAAE,aAAa,CAAA;CAAE,CAAC;AAErG,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,KAAK,EAAE,yBAAyB,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,KAAK,EAAE,0BAA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G,KAAK,IAAI,iBAAiB,CAO9E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ParsedAccessGrant } from "./grant";
|
|
2
|
+
export declare const ACCESS_SUBJECT: {
|
|
3
|
+
readonly tenantId: "tenant-1";
|
|
4
|
+
readonly spaceId: "space-1";
|
|
5
|
+
readonly episodeId: "episode-1";
|
|
6
|
+
readonly participantId: "participant-1";
|
|
7
|
+
readonly participantGeneration: 1;
|
|
8
|
+
};
|
|
9
|
+
export declare function accessGrant(expiresAt: number, suffix: string, connectionId?: string): ParsedAccessGrant;
|
|
10
|
+
//# sourceMappingURL=grant.test.helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grant.test.helpers.d.ts","sourceRoot":"","sources":["../../src/access/grant.test.helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,eAAO,MAAM,cAAc;aACzB,QAAQ,EAAE,UAAU;aACpB,OAAO,EAAE,SAAS;aAClB,SAAS,EAAE,WAAW;aACtB,aAAa,EAAE,eAAe;aAC9B,qBAAqB,EAAE,CAAC;CAChB,CAAC;AAEX,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,SAAiB,GAAG,iBAAiB,CAM/G"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Context, Effect, Layer } from "effect";
|
|
2
|
+
import type { ParsedAccessGrant, ParticipantMediaCredential, ParticipantSyncCredential } from "./grant";
|
|
3
|
+
import type { ConnectionAccessReason, ConnectionAccessRequest } from "../connection/dependencies";
|
|
4
|
+
declare const ConnectionAccessFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly _tag: "ConnectionAccessFailure";
|
|
6
|
+
} & Readonly<A>;
|
|
7
|
+
export declare class ConnectionAccessFailure extends ConnectionAccessFailure_base<{
|
|
8
|
+
readonly code: "access.invalid" | "access.unavailable";
|
|
9
|
+
readonly cause: unknown;
|
|
10
|
+
}> {
|
|
11
|
+
}
|
|
12
|
+
export type ConnectionAccessEffectProvider = (request: ConnectionAccessRequest) => Effect.Effect<ParsedAccessGrant, ConnectionAccessFailure>;
|
|
13
|
+
export type ConnectionAccessEffectService = {
|
|
14
|
+
readonly current: Effect.Effect<ParsedAccessGrant | null>;
|
|
15
|
+
readonly currentUnsafe: () => ParsedAccessGrant | null;
|
|
16
|
+
readonly initialize: (reason?: "join" | "access_retry") => Effect.Effect<ParsedAccessGrant, ConnectionAccessFailure>;
|
|
17
|
+
readonly ensureFresh: (reason?: ConnectionAccessReason) => Effect.Effect<ParsedAccessGrant, ConnectionAccessFailure>;
|
|
18
|
+
readonly refresh: (reason: Exclude<ConnectionAccessReason, "join">, replaceMediaConnection: boolean) => Effect.Effect<ParsedAccessGrant, ConnectionAccessFailure>;
|
|
19
|
+
readonly refreshAfterRejection: () => Effect.Effect<ParsedAccessGrant, ConnectionAccessFailure>;
|
|
20
|
+
readonly getSyncToken: (reason?: ConnectionAccessReason) => Effect.Effect<ParticipantSyncCredential, ConnectionAccessFailure>;
|
|
21
|
+
readonly getMediaToken: () => Effect.Effect<ParticipantMediaCredential, ConnectionAccessFailure>;
|
|
22
|
+
readonly requiresRefresh: Effect.Effect<boolean>;
|
|
23
|
+
readonly millisecondsUntilRefresh: Effect.Effect<number | null>;
|
|
24
|
+
readonly clear: Effect.Effect<void>;
|
|
25
|
+
};
|
|
26
|
+
declare const ConnectionAccessService_base: Context.ServiceClass<ConnectionAccessService, "@chalk/client/ConnectionAccess", ConnectionAccessEffectService>;
|
|
27
|
+
export declare class ConnectionAccessService extends ConnectionAccessService_base {
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The sole R1 owner. SynchronizedRef keeps a refresh and its state commit
|
|
31
|
+
* indivisible, while Clock keeps expiry decisions deterministic in tests.
|
|
32
|
+
*/
|
|
33
|
+
export declare const makeConnectionAccessLayer: (provider: ConnectionAccessEffectProvider, refreshWindowMs?: number) => Layer.Layer<ConnectionAccessService, never, never>;
|
|
34
|
+
export declare const makeFakeConnectionAccessLayer: (provider: ConnectionAccessEffectProvider, refreshWindowMs?: number) => Layer.Layer<ConnectionAccessService, never, never>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/access/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAQ,MAAM,EAAE,KAAK,EAAmB,MAAM,QAAQ,CAAC;AAC9E,OAAO,KAAK,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACxG,OAAO,KAAK,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;;;;AAIlG,qBAAa,uBAAwB,SAAQ,6BAA4C;IACvF,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,oBAAoB,CAAC;IACvD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;CAAG;AAEL,MAAM,MAAM,8BAA8B,GAAG,CAAC,OAAO,EAAE,uBAAuB,KAAK,MAAM,CAAC,MAAM,CAAC,iBAAiB,EAAE,uBAAuB,CAAC,CAAC;AAE7I,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC;IAC1D,QAAQ,CAAC,aAAa,EAAE,MAAM,iBAAiB,GAAG,IAAI,CAAC;IACvD,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,iBAAiB,E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promise<string>;
|
|
5
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
6
|
+
};
|
|
7
|
+
export declare function createChalkChatFileHttpTransport(options: ChalkChatFileHttpTransportOptions): ChalkChatFileTransport;
|
|
8
|
+
//# sourceMappingURL=http-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../src/chat-files/http-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAA8E,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAElI,MAAM,MAAM,iCAAiC,GAAG;IAC9C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CAC1C,CAAC;AAKF,wBAAgB,gCAAgC,CAAC,OAAO,EAAE,iCAAiC,GAAG,sBAAsB,CAmBnH"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { createChalkChatFileHttpTransport, type ChalkChatFileHttpTransportOptions } from "./http-transport";
|
|
2
|
+
export { ChalkChatFileError, type ChalkChatFileErrorCode, type ChalkChatFileFailure, type ChalkChatFileOperation, type ChalkChatFileTransport } from "./types";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/chat-files/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,KAAK,iCAAiC,EAAE,MAAM,kBAAkB,CAAC;AAC5G,OAAO,EAAE,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,KAAK,oBAAoB,EAAE,KAAK,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ChalkChatAttachment, ChalkChatAttachmentMimeType } from "../collaboration/types";
|
|
2
|
+
export type ChalkChatFileOperation = "initiate_upload" | "finalize_upload" | "get_download";
|
|
3
|
+
export type ChalkChatFileErrorCode = "access.invalid" | "unavailable" | "permission_denied" | "invalid_payload" | "conflict" | "not_found" | "expired" | "file_transfer_failed";
|
|
4
|
+
export type ChalkChatFileFailure = {
|
|
5
|
+
readonly operation: ChalkChatFileOperation;
|
|
6
|
+
readonly code: ChalkChatFileErrorCode;
|
|
7
|
+
readonly recoverable: boolean;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
};
|
|
10
|
+
export declare class ChalkChatFileError extends Error {
|
|
11
|
+
readonly operation: ChalkChatFileOperation;
|
|
12
|
+
readonly code: ChalkChatFileErrorCode;
|
|
13
|
+
readonly recoverable: boolean;
|
|
14
|
+
constructor(failure: ChalkChatFileFailure, options?: ErrorOptions);
|
|
15
|
+
}
|
|
16
|
+
export type ChalkChatFileTransport = {
|
|
17
|
+
readonly initiateUpload: (input: {
|
|
18
|
+
readonly clientAttachmentId: string;
|
|
19
|
+
readonly fileName: string;
|
|
20
|
+
readonly mimeType: ChalkChatAttachmentMimeType;
|
|
21
|
+
readonly byteLength: number;
|
|
22
|
+
readonly sha256: string;
|
|
23
|
+
}) => Promise<{
|
|
24
|
+
readonly attachmentId: string;
|
|
25
|
+
readonly uploadId: string;
|
|
26
|
+
readonly method: "PUT";
|
|
27
|
+
readonly uploadUrl: string;
|
|
28
|
+
readonly headers: Readonly<Record<string, string>>;
|
|
29
|
+
readonly expiresAt: string;
|
|
30
|
+
}>;
|
|
31
|
+
readonly finalizeUpload: (uploadId: string) => Promise<ChalkChatAttachment>;
|
|
32
|
+
readonly getDownloadUrl: (attachmentId: string) => Promise<{
|
|
33
|
+
readonly downloadUrl: string;
|
|
34
|
+
readonly expiresAt: string;
|
|
35
|
+
}>;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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