@principal-ai/control-tower-core 0.2.2 → 0.3.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/dist/adapters/websocket/WebSocketTransportAdapter.d.ts +60 -0
- package/dist/adapters/websocket/WebSocketTransportAdapter.d.ts.map +1 -0
- package/dist/adapters/websocket/WebSocketTransportAdapter.js +386 -0
- package/dist/client/BaseClient.d.ts +23 -0
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.js +60 -0
- package/dist/client/PresenceClient.d.ts +43 -8
- package/dist/client/PresenceClient.d.ts.map +1 -1
- package/dist/client/PresenceClient.js +72 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +6 -6
- package/dist/index.mjs +99 -45
- package/dist/index.mjs.map +6 -6
- package/dist/server/BaseServer.d.ts +20 -23
- package/dist/server/BaseServer.d.ts.map +1 -1
- package/dist/server/BaseServer.js +23 -64
- package/dist/server/ServerBuilder.d.ts +22 -1
- package/dist/server/ServerBuilder.d.ts.map +1 -1
- package/dist/server/ServerBuilder.js +24 -0
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/presence.d.ts +69 -0
- package/dist/types/presence.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -8,8 +8,20 @@ import type { PresenceManager } from "../abstractions/PresenceManager.js";
|
|
|
8
8
|
import type { RoomManager } from "../abstractions/RoomManager.js";
|
|
9
9
|
import type { IStorageAdapter } from "../abstractions/StorageAdapter.js";
|
|
10
10
|
import type { ITransportAdapter } from "../abstractions/TransportAdapter.js";
|
|
11
|
-
import type { Event, ExperimentalFeatureConfig, ExperimentalUsageEvent, Lock, Room, RoomConfig } from "../types/index.js";
|
|
11
|
+
import type { Event, ExperimentalFeatureConfig, ExperimentalUsageEvent, Lock, Message, Room, RoomConfig } from "../types/index.js";
|
|
12
12
|
import { ExperimentalAPI } from "./ExperimentalAPI.js";
|
|
13
|
+
/**
|
|
14
|
+
* Custom message handler for application-specific message types.
|
|
15
|
+
*
|
|
16
|
+
* Called when a message type is not recognized by the built-in handler.
|
|
17
|
+
* Return true if the message was handled, false to fall through to the default error response.
|
|
18
|
+
*
|
|
19
|
+
* @param clientId - The ID of the client that sent the message
|
|
20
|
+
* @param message - The message received
|
|
21
|
+
* @param sendResponse - Function to send a response back to the client (preserves message.id for correlation)
|
|
22
|
+
* @returns Promise<boolean> - true if handled, false otherwise
|
|
23
|
+
*/
|
|
24
|
+
export type CustomMessageHandler = (clientId: string, message: Message, sendResponse: (response: Record<string, unknown>) => Promise<void>) => Promise<boolean>;
|
|
13
25
|
export interface ServerConfig {
|
|
14
26
|
transport: ITransportAdapter;
|
|
15
27
|
auth?: IAuthAdapter;
|
|
@@ -22,16 +34,15 @@ export interface ServerConfig {
|
|
|
22
34
|
webSocketPath?: string;
|
|
23
35
|
webSocketServer?: WebSocketServer;
|
|
24
36
|
experimental?: ExperimentalFeatureConfig;
|
|
37
|
+
/**
|
|
38
|
+
* Custom message handler for application-specific message types.
|
|
39
|
+
* Called when a message type is not recognized by the built-in handler.
|
|
40
|
+
*/
|
|
41
|
+
customMessageHandler?: CustomMessageHandler;
|
|
25
42
|
}
|
|
26
43
|
export interface ConnectedClient {
|
|
27
44
|
id: string;
|
|
28
45
|
userId: string;
|
|
29
|
-
/**
|
|
30
|
-
* Device ID for presence tracking.
|
|
31
|
-
* By default equals clientId, but can be overridden via setClientDeviceId()
|
|
32
|
-
* to support multi-window scenarios where multiple clients share a device.
|
|
33
|
-
*/
|
|
34
|
-
deviceId: string;
|
|
35
46
|
/**
|
|
36
47
|
* Set of room IDs the client is currently in
|
|
37
48
|
*
|
|
@@ -221,25 +232,11 @@ export declare class BaseServer extends TypedEventEmitter<ServerEvents> {
|
|
|
221
232
|
/**
|
|
222
233
|
* Get device ID from client ID
|
|
223
234
|
*
|
|
224
|
-
*
|
|
225
|
-
* for multi-window scenarios where multiple clients share a device.
|
|
235
|
+
* In Control Tower architecture, clientId === deviceId
|
|
226
236
|
*
|
|
227
237
|
* @param clientId - Client identifier
|
|
228
|
-
* @returns Device ID
|
|
238
|
+
* @returns Device ID (same as clientId)
|
|
229
239
|
*/
|
|
230
240
|
getDeviceIdFromClientId(clientId: string): string;
|
|
231
|
-
/**
|
|
232
|
-
* Set the device ID for a client
|
|
233
|
-
*
|
|
234
|
-
* Use this to associate a custom deviceId with a client, e.g., when
|
|
235
|
-
* the deviceId comes from a JWT token and differs from the WebSocket clientId.
|
|
236
|
-
* This is useful for multi-window scenarios where multiple WebSocket clients
|
|
237
|
-
* share the same device/user session.
|
|
238
|
-
*
|
|
239
|
-
* @param clientId - Client identifier
|
|
240
|
-
* @param deviceId - Device identifier to associate with this client
|
|
241
|
-
* @returns true if the client was found and updated, false otherwise
|
|
242
|
-
*/
|
|
243
|
-
setClientDeviceId(clientId: string, deviceId: string): boolean;
|
|
244
241
|
}
|
|
245
242
|
//# sourceMappingURL=BaseServer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseServer.d.ts","sourceRoot":"","sources":["../../src/server/BaseServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE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B,YAAY;IAc1B,OAAO,CAAC,UAAU;IAKZ,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7D,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK/C,mBAAmB,IAAI,eAAe,EAAE;IAIxC,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI;IAInD,SAAS,IAAI,OAAO;IAIpB,OAAO,IAAI,YAAY,GAAG,aAAa;IAIvC,aAAa,IAAI,OAAO;IAIxB;;;;;;OAMG;YACW,sBAAsB;IA+BpC;;OAEG;IACH,kBAAkB,IAAI,eAAe,GAAG,SAAS;IAIjD;;;;;OAKG;IACH,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI3D;;;;;;;OAOG;IACH,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAI7C;;;;;;OAMG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAQ5D;;;;;;;OAOG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;CAGjD"}
|
|
@@ -254,7 +254,6 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
254
254
|
const client = {
|
|
255
255
|
id: payload.clientId,
|
|
256
256
|
userId: payload.userId || "",
|
|
257
|
-
deviceId: payload.clientId, // Default to clientId, can be overridden via setClientDeviceId()
|
|
258
257
|
roomIds,
|
|
259
258
|
get roomId() {
|
|
260
259
|
return roomIds.size > 0 ? roomIds.values().next().value || null : null;
|
|
@@ -341,7 +340,6 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
341
340
|
const client = {
|
|
342
341
|
id: clientId,
|
|
343
342
|
userId: "",
|
|
344
|
-
deviceId: clientId, // Default to clientId, can be overridden via setClientDeviceId()
|
|
345
343
|
roomIds,
|
|
346
344
|
get roomId() {
|
|
347
345
|
return roomIds.size > 0 ? roomIds.values().next().value || null : null;
|
|
@@ -373,10 +371,10 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
373
371
|
// Unregister from presence manager
|
|
374
372
|
if (this.presenceManager?.isEnabled() && client.userId) {
|
|
375
373
|
try {
|
|
376
|
-
const presence = await this.presenceManager.disconnectDevice(client.userId,
|
|
374
|
+
const presence = await this.presenceManager.disconnectDevice(client.userId, clientId);
|
|
377
375
|
await this.emit("presence_device_disconnected", {
|
|
378
376
|
userId: client.userId,
|
|
379
|
-
deviceId:
|
|
377
|
+
deviceId: clientId,
|
|
380
378
|
timestamp: Date.now(),
|
|
381
379
|
});
|
|
382
380
|
// Broadcast presence update if user went offline or into grace period
|
|
@@ -387,7 +385,7 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
387
385
|
type: "presence:user_offline",
|
|
388
386
|
payload: {
|
|
389
387
|
userId: client.userId,
|
|
390
|
-
deviceId:
|
|
388
|
+
deviceId: clientId,
|
|
391
389
|
status: presence?.status || "offline",
|
|
392
390
|
gracePeriod: presenceConfig.gracePeriod,
|
|
393
391
|
},
|
|
@@ -401,23 +399,8 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
401
399
|
});
|
|
402
400
|
}
|
|
403
401
|
}
|
|
404
|
-
// Leave all rooms the client is in
|
|
402
|
+
// Leave all rooms the client is in
|
|
405
403
|
for (const roomId of client.roomIds) {
|
|
406
|
-
// Broadcast member_left to other room members
|
|
407
|
-
try {
|
|
408
|
-
await this.experimental.broadcastWhere((c) => c.roomIds.has(roomId) && c.id !== clientId, {
|
|
409
|
-
type: "member_left",
|
|
410
|
-
payload: {
|
|
411
|
-
roomId,
|
|
412
|
-
userId: client.userId,
|
|
413
|
-
clientId,
|
|
414
|
-
timestamp: Date.now(),
|
|
415
|
-
},
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
catch {
|
|
419
|
-
// Experimental broadcast not enabled, skip silently
|
|
420
|
-
}
|
|
421
404
|
await this.roomManager.leaveRoom(roomId, client.userId);
|
|
422
405
|
await this.emit("client_left_room", { clientId, roomId });
|
|
423
406
|
}
|
|
@@ -439,7 +422,7 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
439
422
|
if (this.presenceManager?.isEnabled() &&
|
|
440
423
|
client.userId &&
|
|
441
424
|
client.authenticated) {
|
|
442
|
-
await this.updatePresenceActivity(client.userId,
|
|
425
|
+
await this.updatePresenceActivity(client.userId, clientId, "message");
|
|
443
426
|
}
|
|
444
427
|
switch (message.type) {
|
|
445
428
|
case "authenticate":
|
|
@@ -475,11 +458,25 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
475
458
|
timestamp: Date.now(),
|
|
476
459
|
});
|
|
477
460
|
break;
|
|
478
|
-
default:
|
|
461
|
+
default: {
|
|
462
|
+
// Try custom message handler if configured
|
|
463
|
+
if (this.config.customMessageHandler) {
|
|
464
|
+
const sendResponse = async (response) => {
|
|
465
|
+
await this.sendToClient(clientId, {
|
|
466
|
+
id: message.id,
|
|
467
|
+
...response,
|
|
468
|
+
});
|
|
469
|
+
};
|
|
470
|
+
const handled = await this.config.customMessageHandler(clientId, message, sendResponse);
|
|
471
|
+
if (handled)
|
|
472
|
+
break;
|
|
473
|
+
}
|
|
474
|
+
// Fall through to error if not handled
|
|
479
475
|
await this.sendToClient(clientId, {
|
|
480
476
|
type: "error",
|
|
481
477
|
error: `Unknown message type: ${message.type}`,
|
|
482
478
|
});
|
|
479
|
+
}
|
|
483
480
|
}
|
|
484
481
|
}
|
|
485
482
|
catch (error) {
|
|
@@ -636,22 +633,6 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
636
633
|
if (!client.roomIds.has(roomId)) {
|
|
637
634
|
continue;
|
|
638
635
|
}
|
|
639
|
-
// Broadcast to other room members BEFORE removing this client
|
|
640
|
-
// Use experimental broadcast if enabled, otherwise silently skip
|
|
641
|
-
try {
|
|
642
|
-
await this.experimental.broadcastWhere((c) => c.roomIds.has(roomId) && c.id !== clientId, {
|
|
643
|
-
type: "member_left",
|
|
644
|
-
payload: {
|
|
645
|
-
roomId,
|
|
646
|
-
userId: client.userId,
|
|
647
|
-
clientId,
|
|
648
|
-
timestamp: Date.now(),
|
|
649
|
-
},
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
catch {
|
|
653
|
-
// Experimental broadcast not enabled, skip silently
|
|
654
|
-
}
|
|
655
636
|
await this.roomManager.leaveRoom(roomId, client.userId);
|
|
656
637
|
client.roomIds.delete(roomId);
|
|
657
638
|
await this.emit("client_left_room", { clientId, roomId });
|
|
@@ -868,35 +849,13 @@ class BaseServer extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
868
849
|
/**
|
|
869
850
|
* Get device ID from client ID
|
|
870
851
|
*
|
|
871
|
-
*
|
|
872
|
-
* for multi-window scenarios where multiple clients share a device.
|
|
852
|
+
* In Control Tower architecture, clientId === deviceId
|
|
873
853
|
*
|
|
874
854
|
* @param clientId - Client identifier
|
|
875
|
-
* @returns Device ID
|
|
855
|
+
* @returns Device ID (same as clientId)
|
|
876
856
|
*/
|
|
877
857
|
getDeviceIdFromClientId(clientId) {
|
|
878
|
-
|
|
879
|
-
return client?.deviceId ?? clientId;
|
|
880
|
-
}
|
|
881
|
-
/**
|
|
882
|
-
* Set the device ID for a client
|
|
883
|
-
*
|
|
884
|
-
* Use this to associate a custom deviceId with a client, e.g., when
|
|
885
|
-
* the deviceId comes from a JWT token and differs from the WebSocket clientId.
|
|
886
|
-
* This is useful for multi-window scenarios where multiple WebSocket clients
|
|
887
|
-
* share the same device/user session.
|
|
888
|
-
*
|
|
889
|
-
* @param clientId - Client identifier
|
|
890
|
-
* @param deviceId - Device identifier to associate with this client
|
|
891
|
-
* @returns true if the client was found and updated, false otherwise
|
|
892
|
-
*/
|
|
893
|
-
setClientDeviceId(clientId, deviceId) {
|
|
894
|
-
const client = this.clients.get(clientId);
|
|
895
|
-
if (client) {
|
|
896
|
-
client.deviceId = deviceId;
|
|
897
|
-
return true;
|
|
898
|
-
}
|
|
899
|
-
return false;
|
|
858
|
+
return clientId;
|
|
900
859
|
}
|
|
901
860
|
}
|
|
902
861
|
exports.BaseServer = BaseServer;
|
|
@@ -8,7 +8,7 @@ import type { RoomManager } from "../abstractions/RoomManager.js";
|
|
|
8
8
|
import type { IStorageAdapter } from "../abstractions/StorageAdapter.js";
|
|
9
9
|
import type { ITransportAdapter } from "../abstractions/TransportAdapter.js";
|
|
10
10
|
import type { ExperimentalFeatureConfig, RoomConfig } from "../types/index.js";
|
|
11
|
-
import { BaseServer } from "./BaseServer.js";
|
|
11
|
+
import { BaseServer, type CustomMessageHandler } from "./BaseServer.js";
|
|
12
12
|
export declare class ServerBuilder {
|
|
13
13
|
private transport?;
|
|
14
14
|
private auth?;
|
|
@@ -21,6 +21,7 @@ export declare class ServerBuilder {
|
|
|
21
21
|
private webSocketPath?;
|
|
22
22
|
private webSocketServer?;
|
|
23
23
|
private experimentalFeatures?;
|
|
24
|
+
private customMessageHandler?;
|
|
24
25
|
withTransport(transport: ITransportAdapter): this;
|
|
25
26
|
withAuth(auth: IAuthAdapter): this;
|
|
26
27
|
withStorage(storage: IStorageAdapter): this;
|
|
@@ -48,6 +49,26 @@ export declare class ServerBuilder {
|
|
|
48
49
|
* @see docs/EXPERIMENTAL_BROADCAST.md
|
|
49
50
|
*/
|
|
50
51
|
withExperimentalFeatures(features: ExperimentalFeatureConfig): this;
|
|
52
|
+
/**
|
|
53
|
+
* Set a custom message handler for application-specific message types.
|
|
54
|
+
*
|
|
55
|
+
* The handler is called when a message type is not recognized by the built-in handlers.
|
|
56
|
+
* Return true from the handler if the message was handled, false to fall through
|
|
57
|
+
* to the default error response.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* builder.withCustomMessageHandler(async (clientId, message, sendResponse) => {
|
|
62
|
+
* if (message.type === 'presence:get_users') {
|
|
63
|
+
* const users = await getPresenceUsers();
|
|
64
|
+
* await sendResponse({ type: 'presence:users', payload: { users } });
|
|
65
|
+
* return true;
|
|
66
|
+
* }
|
|
67
|
+
* return false;
|
|
68
|
+
* });
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
withCustomMessageHandler(handler: CustomMessageHandler): this;
|
|
51
72
|
build(): BaseServer;
|
|
52
73
|
/**
|
|
53
74
|
* Wire presence extension hooks to server events
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerBuilder.d.ts","sourceRoot":"","sources":["../../src/server/ServerBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,IAAI,WAAW,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,IAAI,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,KAAK,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"ServerBuilder.d.ts","sourceRoot":"","sources":["../../src/server/ServerBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,MAAM,CAAC;AACjD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IAK3C,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAK/C,eAAe,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAK/C;;;;;;;OAOG;IACH,mBAAmB,CAAC,eAAe,EAAE,eAAe,GAAG,IAAI;IAK3D,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI;IAKxD,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI;IAKtD,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKrC,mBAAmB,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAK/C;;;;;;;OAOG;IACH,wBAAwB,CAAC,QAAQ,EAAE,yBAAyB,GAAG,IAAI;IAKnE;;;;;;;;;;;;;;;;;;OAkBG;IACH,wBAAwB,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAK7D,KAAK,IAAI,UAAU;IAqEnB;;;OAGG;IACH,OAAO,CAAC,0BAA0B;CAyClC"}
|
|
@@ -65,6 +65,29 @@ class ServerBuilder {
|
|
|
65
65
|
this.experimentalFeatures = features;
|
|
66
66
|
return this;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Set a custom message handler for application-specific message types.
|
|
70
|
+
*
|
|
71
|
+
* The handler is called when a message type is not recognized by the built-in handlers.
|
|
72
|
+
* Return true from the handler if the message was handled, false to fall through
|
|
73
|
+
* to the default error response.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```typescript
|
|
77
|
+
* builder.withCustomMessageHandler(async (clientId, message, sendResponse) => {
|
|
78
|
+
* if (message.type === 'presence:get_users') {
|
|
79
|
+
* const users = await getPresenceUsers();
|
|
80
|
+
* await sendResponse({ type: 'presence:users', payload: { users } });
|
|
81
|
+
* return true;
|
|
82
|
+
* }
|
|
83
|
+
* return false;
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
withCustomMessageHandler(handler) {
|
|
88
|
+
this.customMessageHandler = handler;
|
|
89
|
+
return this;
|
|
90
|
+
}
|
|
68
91
|
build() {
|
|
69
92
|
if (!this.transport) {
|
|
70
93
|
throw new Error("Transport adapter is required");
|
|
@@ -95,6 +118,7 @@ class ServerBuilder {
|
|
|
95
118
|
warnOnExperimentalUse: true,
|
|
96
119
|
trackUsageMetrics: false,
|
|
97
120
|
},
|
|
121
|
+
customMessageHandler: this.customMessageHandler,
|
|
98
122
|
};
|
|
99
123
|
const server = new BaseServer_js_1.BaseServer(config);
|
|
100
124
|
// Auto-enhance DefaultRoomManager with broadcasting capabilities
|
package/dist/server/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { BaseServer, type ConnectedClient, type ServerConfig, type ServerEvents, } from "./BaseServer.js";
|
|
1
|
+
export { BaseServer, type ConnectedClient, type CustomMessageHandler, type ServerConfig, type ServerEvents, } from "./BaseServer.js";
|
|
2
2
|
export { ExperimentalAPI } from "./ExperimentalAPI.js";
|
|
3
3
|
export { ServerBuilder } from "./ServerBuilder.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,YAAY,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -21,5 +21,5 @@ export type MessageHandler = (message: Message) => void | Promise<void>;
|
|
|
21
21
|
export type ErrorHandler = (error: Error) => void;
|
|
22
22
|
export type CloseHandler = (code: number, reason: string) => void;
|
|
23
23
|
export { BroadcastOptions, BroadcastResult, ClientPredicate, ExperimentalFeatureConfig, ExperimentalFeatureError, ExperimentalUsageEvent, } from "./experimental.js";
|
|
24
|
-
export { ActivityUpdate, DeviceInfo, PresenceChangeEvent, PresenceConfig, PresenceStatus, UserPresence, } from "./presence.js";
|
|
24
|
+
export { ActivityUpdate, DeviceInfo, PresenceActionResponse, PresenceChangeEvent, PresenceConfig, PresenceGetRepoUsersResponse, PresenceGetUserResponse, PresenceGetUsersResponse, PresenceStats, PresenceStatus, RepositorySession, SerializableUserPresence, UserPresence, } from "./presence.js";
|
|
25
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,YAAY,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,KAAK,EACL,SAAS,EACT,UAAU,EACV,eAAe,EACf,cAAc,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EACT,QAAQ,GACR,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,oBAAoB,EACpB,IAAI,EACJ,UAAU,EACV,cAAc,EACd,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,kBAAkB,EAClB,UAAU,GACV,MAAM,WAAW,CAAC;AAEnB,MAAM,MAAM,eAAe,GACxB,YAAY,GACZ,WAAW,GACX,eAAe,GACf,cAAc,CAAC;AAElB,MAAM,WAAW,iBAAiB;IACjC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,OAAO;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAClD,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAElE,OAAO,EACN,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,YAAY,GACZ,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,YAAY,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,SAAS,EACT,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,KAAK,EACL,SAAS,EACT,UAAU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ACd,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,wBAAwB,EACxB,YAAY,GACZ,MAAM,eAAe,CAAC"}
|
package/dist/types/presence.d.ts
CHANGED
|
@@ -160,4 +160,73 @@ export interface ActivityUpdate {
|
|
|
160
160
|
*/
|
|
161
161
|
metadata?: Record<string, unknown>;
|
|
162
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* Repository session information (from RepositoryPresenceExtension)
|
|
165
|
+
*/
|
|
166
|
+
export interface RepositorySession {
|
|
167
|
+
repoId: string;
|
|
168
|
+
branch: string;
|
|
169
|
+
openedAt: number;
|
|
170
|
+
lastActivity: number;
|
|
171
|
+
currentFile?: string;
|
|
172
|
+
hasUnsavedChanges?: boolean;
|
|
173
|
+
permissions: {
|
|
174
|
+
canRead: boolean;
|
|
175
|
+
canWrite: boolean;
|
|
176
|
+
canAdmin: boolean;
|
|
177
|
+
};
|
|
178
|
+
agentId: string;
|
|
179
|
+
clientType?: "desktop" | "web";
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Serializable user presence (Maps converted to plain objects for JSON transport)
|
|
183
|
+
*/
|
|
184
|
+
export interface SerializableUserPresence {
|
|
185
|
+
userId: string;
|
|
186
|
+
status: PresenceStatus;
|
|
187
|
+
devices: Record<string, DeviceInfo>;
|
|
188
|
+
firstConnectedAt: number;
|
|
189
|
+
lastActivity: number;
|
|
190
|
+
metadata?: Record<string, unknown>;
|
|
191
|
+
openRepositories?: RepositorySession[];
|
|
192
|
+
activeRepository?: string;
|
|
193
|
+
visible?: boolean;
|
|
194
|
+
statusMessage?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Presence statistics
|
|
198
|
+
*/
|
|
199
|
+
export interface PresenceStats {
|
|
200
|
+
totalOnline: number;
|
|
201
|
+
totalRepositories: number;
|
|
202
|
+
activeCollaborations: number;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Response for presence:get_users request
|
|
206
|
+
*/
|
|
207
|
+
export interface PresenceGetUsersResponse {
|
|
208
|
+
users: SerializableUserPresence[];
|
|
209
|
+
stats: PresenceStats;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Response for presence:get_user request
|
|
213
|
+
*/
|
|
214
|
+
export interface PresenceGetUserResponse {
|
|
215
|
+
user: SerializableUserPresence | null;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Response for presence:get_repo_users request
|
|
219
|
+
*/
|
|
220
|
+
export interface PresenceGetRepoUsersResponse {
|
|
221
|
+
repoId: string;
|
|
222
|
+
users: SerializableUserPresence[];
|
|
223
|
+
totalUsers: number;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Generic response for presence action requests
|
|
227
|
+
*/
|
|
228
|
+
export interface PresenceActionResponse {
|
|
229
|
+
success: boolean;
|
|
230
|
+
error?: string;
|
|
231
|
+
}
|
|
163
232
|
//# sourceMappingURL=presence.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presence.d.ts","sourceRoot":"","sources":["../../src/types/presence.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;;;OAKG;IACH,MAAM,EAAE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