@principal-ai/control-tower-core 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +94 -7
- package/dist/index.mjs.map +6 -6
- package/dist/server/BaseServer.d.ts +18 -1
- package/dist/server/BaseServer.d.ts.map +1 -1
- package/dist/server/BaseServer.js +15 -1
- 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
|
@@ -92,37 +92,91 @@ class PresenceClient extends EventEmitter_js_1.TypedEventEmitter {
|
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
|
-
* Get all online users
|
|
95
|
+
* Get all online users with their presence data
|
|
96
96
|
*
|
|
97
|
-
*
|
|
97
|
+
* @returns Array of user presence objects
|
|
98
98
|
*/
|
|
99
99
|
async getOnlineUsers() {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
const response = await this.client.request("presence:get_users", {});
|
|
101
|
+
return response.users;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Get presence information for a specific user
|
|
105
|
+
*
|
|
106
|
+
* @param userId The user ID to look up
|
|
107
|
+
* @returns User presence or null if not found
|
|
108
|
+
*/
|
|
109
|
+
async getUserPresence(userId) {
|
|
110
|
+
const response = await this.client.request("presence:get_user", { userId });
|
|
111
|
+
return response.user;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Get all users in a specific repository
|
|
115
|
+
*
|
|
116
|
+
* @param owner Repository owner
|
|
117
|
+
* @param repo Repository name
|
|
118
|
+
* @returns Array of user presence objects
|
|
119
|
+
*/
|
|
120
|
+
async getRepoUsers(owner, repo) {
|
|
121
|
+
const response = await this.client.request("presence:get_repo_users", { owner, repo });
|
|
122
|
+
return response.users;
|
|
104
123
|
}
|
|
105
124
|
/**
|
|
106
125
|
* Set user status
|
|
107
126
|
*
|
|
108
|
-
*
|
|
127
|
+
* @param status The status to set ('online' or 'away')
|
|
128
|
+
* @param statusMessage Optional status message
|
|
109
129
|
*/
|
|
110
|
-
async setStatus(status,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
130
|
+
async setStatus(status, statusMessage) {
|
|
131
|
+
const response = await this.client.request("presence:set_status", { status, statusMessage });
|
|
132
|
+
if (!response.success) {
|
|
133
|
+
throw new Error(response.error || "Failed to set status");
|
|
134
|
+
}
|
|
115
135
|
}
|
|
116
136
|
/**
|
|
117
|
-
* Set visibility
|
|
137
|
+
* Set visibility (invisible/lurker mode)
|
|
118
138
|
*
|
|
119
|
-
*
|
|
139
|
+
* @param visible Whether the user should be visible to others
|
|
120
140
|
*/
|
|
121
141
|
async setVisibility(visible) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
142
|
+
const response = await this.client.request("presence:set_visibility", { visible });
|
|
143
|
+
if (!response.success) {
|
|
144
|
+
throw new Error(response.error || "Failed to set visibility");
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Report that a repository was opened
|
|
149
|
+
*
|
|
150
|
+
* @param repoId Repository ID (format: "owner/repo")
|
|
151
|
+
* @param branch Branch name
|
|
152
|
+
*/
|
|
153
|
+
async reportRepoOpened(repoId, branch) {
|
|
154
|
+
const response = await this.client.request("presence:repo_open", { repoId, branch });
|
|
155
|
+
if (!response.success) {
|
|
156
|
+
throw new Error(response.error || "Failed to report repo opened");
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Report that a repository was closed
|
|
161
|
+
*
|
|
162
|
+
* @param repoId Repository ID (format: "owner/repo")
|
|
163
|
+
*/
|
|
164
|
+
async reportRepoClosed(repoId) {
|
|
165
|
+
const response = await this.client.request("presence:repo_close", { repoId });
|
|
166
|
+
if (!response.success) {
|
|
167
|
+
throw new Error(response.error || "Failed to report repo closed");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Report that a repository is now focused/active
|
|
172
|
+
*
|
|
173
|
+
* @param repoId Repository ID (format: "owner/repo")
|
|
174
|
+
*/
|
|
175
|
+
async reportRepoFocused(repoId) {
|
|
176
|
+
const response = await this.client.request("presence:repo_focus", { repoId });
|
|
177
|
+
if (!response.success) {
|
|
178
|
+
throw new Error(response.error || "Failed to report repo focused");
|
|
179
|
+
}
|
|
126
180
|
}
|
|
127
181
|
/**
|
|
128
182
|
* Get the underlying BaseClient
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { MockAuthAdapter, type MockICECandidate, MockRTCDataChannel, type MockRT
|
|
|
3
3
|
export { type PeerConnection, type PeerConnectionState, WebRTCSignalingAdapter, type WebRTCSignalingConfig, type WebRTCSignalingEvents, } from "./adapters/webrtc/index.js";
|
|
4
4
|
export { BrowserWebSocketTransportAdapter, type BrowserWebSocketConfig, type WebSocketClientConfig, WebSocketClientTransportAdapter, WebSocketServerTransportAdapter, type WebSocketServerTransportConfig, } from "./adapters/websocket/index.js";
|
|
5
5
|
export { BaseClient, ClientBuilder, type ClientConfig, type ClientEvents, PresenceClient, type PresenceClientConfig, type PresenceClientEvents, } from "./client/index.js";
|
|
6
|
-
export { BaseServer, type ConnectedClient, ExperimentalAPI, ServerBuilder, type ServerConfig, type ServerEvents, } from "./server/index.js";
|
|
7
|
-
export { ActivityUpdate, AuthenticatePayload, AuthenticateResult, AuthResult, BaseEvent, BranchChangeEvent, BroadcastOptions, BroadcastResult, ClientPredicate, CloseHandler, CommitEvent, ConnectionOptions, ConnectionState, CursorPositionEvent, DeviceInfo, ErrorHandler, Event, EventType, ExperimentalFeatureConfig, ExperimentalFeatureError, ExperimentalUsageEvent, FileAction, FileChangeEvent, GitStatusEvent, JWTConfig, Lock, LockPriority, LockQueueItem, LockRequest, LockState, LockType, Message, MessageHandler, PresenceChangeEvent, PresenceConfig, PresenceStatus, Room, RoomConfig, RoomPermission, RoomState, RoomUser, TokenPayload, UserPresence, UserStatus, } from "./types/index.js";
|
|
6
|
+
export { BaseServer, type ConnectedClient, type CustomMessageHandler, ExperimentalAPI, ServerBuilder, type ServerConfig, type ServerEvents, } from "./server/index.js";
|
|
7
|
+
export { ActivityUpdate, AuthenticatePayload, AuthenticateResult, AuthResult, BaseEvent, BranchChangeEvent, BroadcastOptions, BroadcastResult, ClientPredicate, CloseHandler, CommitEvent, ConnectionOptions, ConnectionState, CursorPositionEvent, DeviceInfo, ErrorHandler, Event, EventType, ExperimentalFeatureConfig, ExperimentalFeatureError, ExperimentalUsageEvent, FileAction, FileChangeEvent, GitStatusEvent, JWTConfig, Lock, LockPriority, LockQueueItem, LockRequest, LockState, LockType, Message, MessageHandler, PresenceActionResponse, PresenceChangeEvent, PresenceConfig, PresenceGetRepoUsersResponse, PresenceGetUserResponse, PresenceGetUsersResponse, PresenceStats, PresenceStatus, RepositorySession, Room, RoomConfig, RoomPermission, RoomState, RoomUser, SerializableUserPresence, TokenPayload, UserPresence, UserStatus, } from "./types/index.js";
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,eAAe,EACf,KAAK,gBAAgB,EAErB,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACN,gCAAgC,EAChC,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,+BAA+B,EAC/B,+BAA+B,EAC/B,KAAK,8BAA8B,GACnC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACN,UAAU,EACV,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,GACzB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACN,UAAU,EACV,KAAK,eAAe,EACpB,eAAe,EACf,aAAa,EACb,KAAK,YAAY,EACjB,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,UAAU,EACV,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,YAAY,EACZ,WAAW,EACX,iBAAiB,EAEjB,eAAe,EACf,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,KAAK,EAEL,SAAS,EAET,yBAAyB,EACzB,wBAAwB,EACxB,sBAAsB,EACtB,UAAU,EACV,eAAe,EACf,cAAc,EACd,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,aAAa,EACb,WAAW,EACX,SAAS,EAET,QAAQ,EACR,OAAO,EACP,cAAc,EACd,mBAAmB,EACnB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,oBAAoB,EACpB,kBAAkB,EAClB,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,oBAAoB,EACpB,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,GACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACN,eAAe,EACf,KAAK,gBAAgB,EAErB,kBAAkB,EAClB,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,GACtB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,sBAAsB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,qBAAqB,GAC1B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACN,gCAAgC,EAChC,KAAK,sBAAsB,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