@principal-ai/control-tower-core 0.5.0 → 0.6.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/abstractions/DefaultPresenceManager.d.ts.map +1 -1
- package/dist/abstractions/DefaultPresenceManager.js +63 -0
- package/dist/abstractions/PresenceExtension.d.ts +23 -0
- package/dist/abstractions/PresenceExtension.d.ts.map +1 -1
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +58 -29
- package/dist/index.mjs.map +4 -4
- package/dist/server/ServerBuilder.d.ts.map +1 -1
- package/dist/server/ServerBuilder.js +0 -39
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3599,6 +3599,63 @@ class DefaultPresenceManager extends PresenceManager {
|
|
|
3599
3599
|
await sendResponse({ type: "presence:repo_status_update", payload: response });
|
|
3600
3600
|
return true;
|
|
3601
3601
|
}
|
|
3602
|
+
case "presence:repo_open": {
|
|
3603
|
+
const { repoId, branch } = message.payload;
|
|
3604
|
+
for (const ext of this.extensions) {
|
|
3605
|
+
await ext.onRepoOpened?.(userId, repoId, branch, deviceId);
|
|
3606
|
+
}
|
|
3607
|
+
if (this.config.broadcastPresenceUpdates && this.server) {
|
|
3608
|
+
let visible = true;
|
|
3609
|
+
for (const ext of this.extensions) {
|
|
3610
|
+
const shouldShow = await ext.shouldBeVisible?.(userId);
|
|
3611
|
+
if (shouldShow === false) {
|
|
3612
|
+
visible = false;
|
|
3613
|
+
break;
|
|
3614
|
+
}
|
|
3615
|
+
}
|
|
3616
|
+
if (visible) {
|
|
3617
|
+
const experimental = this.server.experimental;
|
|
3618
|
+
await experimental?.broadcastAuthenticated({
|
|
3619
|
+
type: "presence:repo_opened",
|
|
3620
|
+
payload: {
|
|
3621
|
+
userId,
|
|
3622
|
+
repoId,
|
|
3623
|
+
branch,
|
|
3624
|
+
openedAt: Date.now()
|
|
3625
|
+
}
|
|
3626
|
+
});
|
|
3627
|
+
}
|
|
3628
|
+
}
|
|
3629
|
+
const response = { success: true };
|
|
3630
|
+
await sendResponse({ type: "presence:repo_open", payload: response });
|
|
3631
|
+
return true;
|
|
3632
|
+
}
|
|
3633
|
+
case "presence:repo_close": {
|
|
3634
|
+
const { repoId } = message.payload;
|
|
3635
|
+
for (const ext of this.extensions) {
|
|
3636
|
+
await ext.onRepoClosed?.(userId, repoId, deviceId);
|
|
3637
|
+
}
|
|
3638
|
+
if (this.config.broadcastPresenceUpdates && this.server) {
|
|
3639
|
+
let visible = true;
|
|
3640
|
+
for (const ext of this.extensions) {
|
|
3641
|
+
const shouldShow = await ext.shouldBeVisible?.(userId);
|
|
3642
|
+
if (shouldShow === false) {
|
|
3643
|
+
visible = false;
|
|
3644
|
+
break;
|
|
3645
|
+
}
|
|
3646
|
+
}
|
|
3647
|
+
if (visible) {
|
|
3648
|
+
const experimental = this.server.experimental;
|
|
3649
|
+
await experimental?.broadcastAuthenticated({
|
|
3650
|
+
type: "presence:repo_closed",
|
|
3651
|
+
payload: { userId, repoId }
|
|
3652
|
+
});
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3655
|
+
const response = { success: true };
|
|
3656
|
+
await sendResponse({ type: "presence:repo_close", payload: response });
|
|
3657
|
+
return true;
|
|
3658
|
+
}
|
|
3602
3659
|
default: {
|
|
3603
3660
|
for (const ext of this.extensions) {
|
|
3604
3661
|
if (ext.handleMessage) {
|
|
@@ -7191,21 +7248,6 @@ class ServerBuilder {
|
|
|
7191
7248
|
await ext.onRoomJoined?.(userId, roomId, deviceId);
|
|
7192
7249
|
}
|
|
7193
7250
|
}
|
|
7194
|
-
const presenceConfig = presenceManager.getConfig();
|
|
7195
|
-
if (presenceConfig.broadcastPresenceUpdates && roomId !== "__global_presence__") {
|
|
7196
|
-
try {
|
|
7197
|
-
const experimental = server.experimental;
|
|
7198
|
-
await experimental?.broadcastAuthenticated({
|
|
7199
|
-
type: "presence:repo_opened",
|
|
7200
|
-
payload: {
|
|
7201
|
-
userId,
|
|
7202
|
-
repoId: roomId,
|
|
7203
|
-
branch: "main",
|
|
7204
|
-
openedAt: Date.now()
|
|
7205
|
-
}
|
|
7206
|
-
});
|
|
7207
|
-
} catch (error) {}
|
|
7208
|
-
}
|
|
7209
7251
|
}
|
|
7210
7252
|
});
|
|
7211
7253
|
server.on("client_left_room", async ({ clientId, roomId }) => {
|
|
@@ -7219,19 +7261,6 @@ class ServerBuilder {
|
|
|
7219
7261
|
await ext.onRoomLeft?.(userId, roomId, deviceId);
|
|
7220
7262
|
}
|
|
7221
7263
|
}
|
|
7222
|
-
const presenceConfig = presenceManager.getConfig();
|
|
7223
|
-
if (presenceConfig.broadcastPresenceUpdates && roomId !== "__global_presence__") {
|
|
7224
|
-
try {
|
|
7225
|
-
const experimental = server.experimental;
|
|
7226
|
-
await experimental?.broadcastAuthenticated({
|
|
7227
|
-
type: "presence:repo_closed",
|
|
7228
|
-
payload: {
|
|
7229
|
-
userId,
|
|
7230
|
-
repoId: roomId
|
|
7231
|
-
}
|
|
7232
|
-
});
|
|
7233
|
-
} catch (error) {}
|
|
7234
|
-
}
|
|
7235
7264
|
}
|
|
7236
7265
|
});
|
|
7237
7266
|
server.on("stopped", async () => {
|
|
@@ -7266,4 +7295,4 @@ export {
|
|
|
7266
7295
|
BaseClient
|
|
7267
7296
|
};
|
|
7268
7297
|
|
|
7269
|
-
//# debugId=
|
|
7298
|
+
//# debugId=99723E81722980AB64756E2164756E21
|