@workspace-platform/ui 0.1.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/admin.d.mts +2 -0
- package/dist/admin.d.ts +2 -0
- package/dist/admin.js +19 -0
- package/dist/admin.js.map +1 -0
- package/dist/admin.mjs +1 -0
- package/dist/admin.mjs.map +1 -0
- package/dist/index.d.mts +784 -0
- package/dist/index.d.ts +784 -0
- package/dist/index.js +1881 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1841 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +49 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,784 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Socket } from 'socket.io-client';
|
|
3
|
+
import { UseBoundStore, StoreApi } from 'zustand';
|
|
4
|
+
import { ClassValue } from 'clsx';
|
|
5
|
+
|
|
6
|
+
interface WorkspaceClient {
|
|
7
|
+
get: <T>(path: string) => Promise<T>;
|
|
8
|
+
post: <T>(path: string, body: unknown) => Promise<T>;
|
|
9
|
+
patch: <T>(path: string, body: unknown) => Promise<T>;
|
|
10
|
+
delete: <T>(path: string) => Promise<T>;
|
|
11
|
+
upload: <T>(path: string, formData: FormData) => Promise<T>;
|
|
12
|
+
getBlob: (path: string) => Promise<Blob>;
|
|
13
|
+
}
|
|
14
|
+
declare function createWorkspaceClient(config: WorkspaceConfig): WorkspaceClient;
|
|
15
|
+
|
|
16
|
+
interface WorkspaceSocketManager {
|
|
17
|
+
getSocket: () => Socket;
|
|
18
|
+
connect: (userId?: string) => Socket;
|
|
19
|
+
disconnect: () => void;
|
|
20
|
+
}
|
|
21
|
+
declare function createWorkspaceSocket(config: WorkspaceConfig): WorkspaceSocketManager;
|
|
22
|
+
|
|
23
|
+
interface UserSearchResult {
|
|
24
|
+
id: string;
|
|
25
|
+
email: string;
|
|
26
|
+
displayName: string;
|
|
27
|
+
avatarUrl?: string;
|
|
28
|
+
}
|
|
29
|
+
interface WorkspaceConfig {
|
|
30
|
+
/** Base URL of the workspace-platform server (e.g. http://localhost:3100) */
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
/** Function that returns the current Bearer token (JWT) */
|
|
33
|
+
getAuthToken: () => string | null;
|
|
34
|
+
/** Current user identifier (email or ID) — used for socket auth & UI */
|
|
35
|
+
currentUserId: string | null;
|
|
36
|
+
/** Current user display name */
|
|
37
|
+
currentUserName?: string | null;
|
|
38
|
+
/** Optional: additional headers for API requests (e.g. { 'x-auth-mode': 'keycloak' }) */
|
|
39
|
+
extraHeaders?: Record<string, string>;
|
|
40
|
+
/** Optional: function to search users for member invitation */
|
|
41
|
+
searchUsers?: (query: string) => Promise<UserSearchResult[]>;
|
|
42
|
+
/** Optional: function to resolve user avatar URLs by email */
|
|
43
|
+
resolveAvatars?: (memberIds: string[]) => Promise<Record<string, string>>;
|
|
44
|
+
/** Optional: callback when navigating to a workspace */
|
|
45
|
+
onNavigateToWorkspace?: (workspaceId: string) => void;
|
|
46
|
+
}
|
|
47
|
+
interface WorkspaceContextValue {
|
|
48
|
+
config: WorkspaceConfig;
|
|
49
|
+
apiClient: WorkspaceClient;
|
|
50
|
+
socket: WorkspaceSocketManager;
|
|
51
|
+
}
|
|
52
|
+
declare function WorkspaceProvider({ config, children, }: {
|
|
53
|
+
config: WorkspaceConfig;
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
}): React.JSX.Element;
|
|
56
|
+
declare function useWorkspaceContext(): WorkspaceContextValue;
|
|
57
|
+
|
|
58
|
+
type WorkspaceStatus = 'ACTIVE' | 'CLOSED' | 'ARCHIVED';
|
|
59
|
+
type ArtefactType = 'NOTE' | 'EXPORT' | 'DECISION' | 'FILE' | 'TASK';
|
|
60
|
+
type MemberType = 'user' | 'agent';
|
|
61
|
+
type MemberRole = 'owner' | 'participant' | 'viewer';
|
|
62
|
+
declare enum WorkspaceEvent {
|
|
63
|
+
WORKSPACE_CREATED = "workspace.created",
|
|
64
|
+
WORKSPACE_UPDATED = "workspace.updated",
|
|
65
|
+
WORKSPACE_DELETED = "workspace.deleted",
|
|
66
|
+
WORKSPACE_STATUS_CHANGED = "workspace.statusChanged",
|
|
67
|
+
/** Sent to user's personal room when they are added as a member */
|
|
68
|
+
WORKSPACE_ADDED = "workspace.added",
|
|
69
|
+
/** Sent to user's personal room when they are removed as a member */
|
|
70
|
+
WORKSPACE_REMOVED = "workspace.removed",
|
|
71
|
+
WORKSPACE_MEMBER_ADDED = "workspace.member.added",
|
|
72
|
+
WORKSPACE_MEMBER_UPDATED = "workspace.member.updated",
|
|
73
|
+
WORKSPACE_MEMBER_REMOVED = "workspace.member.removed",
|
|
74
|
+
WORKSPACE_MESSAGE_CREATED = "workspace.message.created",
|
|
75
|
+
WORKSPACE_MESSAGE_UPDATED = "workspace.message.updated",
|
|
76
|
+
WORKSPACE_MESSAGE_DELETED = "workspace.message.deleted",
|
|
77
|
+
WORKSPACE_MEMBER_USER_MENTIONED = "workspace.member.user.mentioned",
|
|
78
|
+
WORKSPACE_MEMBER_AGENT_MENTIONED = "workspace.member.agent.mentioned",
|
|
79
|
+
WORKSPACE_ARTEFACT_CREATED = "workspace.artefact.created",
|
|
80
|
+
WORKSPACE_TYPING_STARTED = "workspace.typing.started",
|
|
81
|
+
WORKSPACE_TYPING_STOPPED = "workspace.typing.stopped",
|
|
82
|
+
WORKSPACE_MESSAGE_REACTION_CREATED = "workspace.message.reaction.created",
|
|
83
|
+
WORKSPACE_MESSAGE_REACTION_DELETED = "workspace.message.reaction.deleted",
|
|
84
|
+
WORKSPACE_MESSAGE_PINNED = "workspace.message.pinned",
|
|
85
|
+
PRIVATE_WORKSPACE_CREATED = "private.workspace.created",
|
|
86
|
+
PRIVATE_WORKSPACE_MESSAGE_CREATED = "private.workspace.message.created",
|
|
87
|
+
PRIVATE_WORKSPACE_MEMBER_ADDED = "private.workspace.member.added"
|
|
88
|
+
}
|
|
89
|
+
interface PaginatedResponse<T> {
|
|
90
|
+
data: T[];
|
|
91
|
+
total: number;
|
|
92
|
+
offset: number;
|
|
93
|
+
limit: number;
|
|
94
|
+
}
|
|
95
|
+
interface EntityWithSecret {
|
|
96
|
+
key: string;
|
|
97
|
+
value: string;
|
|
98
|
+
isSecret: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface WorkspaceType {
|
|
101
|
+
_id: string;
|
|
102
|
+
name: string;
|
|
103
|
+
entitiesWithSecrets?: EntityWithSecret[];
|
|
104
|
+
createdBy?: string;
|
|
105
|
+
updatedBy?: string;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
}
|
|
109
|
+
interface Workspace {
|
|
110
|
+
_id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
isPrivate?: boolean;
|
|
113
|
+
type?: WorkspaceType | string;
|
|
114
|
+
scope?: string;
|
|
115
|
+
entitiesWithSecrets?: EntityWithSecret[];
|
|
116
|
+
status: WorkspaceStatus;
|
|
117
|
+
syncWithSlack?: boolean;
|
|
118
|
+
createdBy?: string;
|
|
119
|
+
updatedBy?: string;
|
|
120
|
+
createdAt: string;
|
|
121
|
+
updatedAt: string;
|
|
122
|
+
}
|
|
123
|
+
interface WorkspaceMember {
|
|
124
|
+
_id: string;
|
|
125
|
+
workspace: string;
|
|
126
|
+
memberId: string;
|
|
127
|
+
memberName: string;
|
|
128
|
+
memberType: MemberType;
|
|
129
|
+
role: MemberRole;
|
|
130
|
+
createdBy?: string;
|
|
131
|
+
updatedBy?: string;
|
|
132
|
+
joinedAt: string;
|
|
133
|
+
createdAt?: string;
|
|
134
|
+
}
|
|
135
|
+
/** Subset of WorkspaceMessage returned when populated as a reply reference */
|
|
136
|
+
interface ReplyMessage {
|
|
137
|
+
_id: string;
|
|
138
|
+
senderId: string;
|
|
139
|
+
senderName: string;
|
|
140
|
+
senderType: MemberType;
|
|
141
|
+
content: string;
|
|
142
|
+
createdAt: string;
|
|
143
|
+
/** Set locally when the replied-to message is soft-deleted */
|
|
144
|
+
deleted?: boolean;
|
|
145
|
+
}
|
|
146
|
+
interface WorkspaceMessage {
|
|
147
|
+
_id: string;
|
|
148
|
+
workspace: string;
|
|
149
|
+
senderId: string;
|
|
150
|
+
senderName: string;
|
|
151
|
+
senderType: MemberType;
|
|
152
|
+
sender?: WorkspaceMessageSender;
|
|
153
|
+
content: string;
|
|
154
|
+
mentionedUsers?: string[];
|
|
155
|
+
mentionedAgents?: string[];
|
|
156
|
+
replyToMessage?: ReplyMessage | null;
|
|
157
|
+
metadata?: Record<string, unknown>;
|
|
158
|
+
deleted?: boolean;
|
|
159
|
+
editedAt?: string;
|
|
160
|
+
pinned?: boolean;
|
|
161
|
+
pinnedAt?: string;
|
|
162
|
+
pinnedBy?: string;
|
|
163
|
+
createdBy?: string;
|
|
164
|
+
createdAt: string;
|
|
165
|
+
}
|
|
166
|
+
interface WorkspaceMessageSender {
|
|
167
|
+
_id: string;
|
|
168
|
+
memberId: string;
|
|
169
|
+
memberName: string;
|
|
170
|
+
memberType: MemberType;
|
|
171
|
+
role: MemberRole;
|
|
172
|
+
}
|
|
173
|
+
interface FileRecord {
|
|
174
|
+
_id: string;
|
|
175
|
+
filename: string;
|
|
176
|
+
originalName: string;
|
|
177
|
+
mimetype: string;
|
|
178
|
+
size: number;
|
|
179
|
+
bucket: string;
|
|
180
|
+
key: string;
|
|
181
|
+
storageProvider: string;
|
|
182
|
+
createdBy?: string;
|
|
183
|
+
updatedBy?: string;
|
|
184
|
+
createdAt: string;
|
|
185
|
+
updatedAt: string;
|
|
186
|
+
}
|
|
187
|
+
interface WorkspaceArtefact {
|
|
188
|
+
_id: string;
|
|
189
|
+
workspace: string;
|
|
190
|
+
message?: string;
|
|
191
|
+
file: FileRecord;
|
|
192
|
+
type: ArtefactType;
|
|
193
|
+
createdBy?: string;
|
|
194
|
+
updatedBy?: string;
|
|
195
|
+
createdAt: string;
|
|
196
|
+
updatedAt: string;
|
|
197
|
+
}
|
|
198
|
+
interface WorkspaceMessageReaction {
|
|
199
|
+
_id: string;
|
|
200
|
+
reaction: string;
|
|
201
|
+
message: string;
|
|
202
|
+
member?: string;
|
|
203
|
+
memberId?: string;
|
|
204
|
+
memberName?: string;
|
|
205
|
+
createdAt: string;
|
|
206
|
+
updatedAt: string;
|
|
207
|
+
}
|
|
208
|
+
interface MessageWithArtefacts extends WorkspaceMessage {
|
|
209
|
+
artefacts: WorkspaceArtefact[];
|
|
210
|
+
reactions: WorkspaceMessageReaction[];
|
|
211
|
+
}
|
|
212
|
+
interface WorkspaceAgent {
|
|
213
|
+
_id: string;
|
|
214
|
+
agentId: string;
|
|
215
|
+
agentName: string;
|
|
216
|
+
webhookCount: number;
|
|
217
|
+
createdBy?: string;
|
|
218
|
+
updatedBy?: string;
|
|
219
|
+
createdAt: string;
|
|
220
|
+
updatedAt: string;
|
|
221
|
+
}
|
|
222
|
+
interface AgentDeleteInfo {
|
|
223
|
+
webhookCount: number;
|
|
224
|
+
memberCount: number;
|
|
225
|
+
}
|
|
226
|
+
interface WebhookSubscription {
|
|
227
|
+
_id: string;
|
|
228
|
+
name: string;
|
|
229
|
+
targetUrl: string;
|
|
230
|
+
secretKey: string;
|
|
231
|
+
secretValue: string;
|
|
232
|
+
eventTypes: string[];
|
|
233
|
+
active: boolean;
|
|
234
|
+
isAgent: boolean;
|
|
235
|
+
agentId?: string;
|
|
236
|
+
metadata?: Record<string, unknown>;
|
|
237
|
+
createdBy?: string;
|
|
238
|
+
updatedBy?: string;
|
|
239
|
+
createdAt: string;
|
|
240
|
+
updatedAt: string;
|
|
241
|
+
}
|
|
242
|
+
interface WorkspaceSummary {
|
|
243
|
+
_id: string;
|
|
244
|
+
workspace: string;
|
|
245
|
+
keyPoints: string[];
|
|
246
|
+
keyTasks: string[];
|
|
247
|
+
keyDecisions: string[];
|
|
248
|
+
messageCount: number;
|
|
249
|
+
lastMessage?: {
|
|
250
|
+
_id: string;
|
|
251
|
+
senderId: string;
|
|
252
|
+
senderName: string;
|
|
253
|
+
senderType: MemberType;
|
|
254
|
+
content: string;
|
|
255
|
+
createdAt: string;
|
|
256
|
+
} | null;
|
|
257
|
+
wasTruncated: boolean;
|
|
258
|
+
generatedAt: string;
|
|
259
|
+
threadId?: string;
|
|
260
|
+
threadState?: 'queued' | 'running' | 'succeeded' | 'failed';
|
|
261
|
+
createdBy?: string;
|
|
262
|
+
updatedBy?: string;
|
|
263
|
+
createdAt: string;
|
|
264
|
+
updatedAt: string;
|
|
265
|
+
}
|
|
266
|
+
interface LatestSummaryResponse {
|
|
267
|
+
summary: WorkspaceSummary | null;
|
|
268
|
+
messagesAfterCount: number;
|
|
269
|
+
}
|
|
270
|
+
interface CreateWorkspacePayload {
|
|
271
|
+
name: string;
|
|
272
|
+
isPrivate?: boolean;
|
|
273
|
+
type?: string;
|
|
274
|
+
scope?: string;
|
|
275
|
+
entitiesWithSecrets?: EntityWithSecret[];
|
|
276
|
+
members?: {
|
|
277
|
+
memberId: string;
|
|
278
|
+
memberName: string;
|
|
279
|
+
memberType?: MemberType;
|
|
280
|
+
role?: string;
|
|
281
|
+
}[];
|
|
282
|
+
syncWithSlack?: boolean;
|
|
283
|
+
}
|
|
284
|
+
interface SendMessagePayload {
|
|
285
|
+
senderType?: MemberType;
|
|
286
|
+
content: string;
|
|
287
|
+
metadata?: Record<string, unknown>;
|
|
288
|
+
replyToMessageId?: string;
|
|
289
|
+
}
|
|
290
|
+
interface UpdateMessagePayload {
|
|
291
|
+
content: string;
|
|
292
|
+
}
|
|
293
|
+
/** workspace.created → emitted to each member's personal room */
|
|
294
|
+
interface WsPayloadWorkspaceCreated {
|
|
295
|
+
workspace: Workspace;
|
|
296
|
+
}
|
|
297
|
+
/** workspace.added → emitted to the new member's personal room */
|
|
298
|
+
interface WsPayloadWorkspaceAdded {
|
|
299
|
+
workspaceId: string;
|
|
300
|
+
workspace?: Workspace;
|
|
301
|
+
}
|
|
302
|
+
/** workspace.removed → emitted to the removed member's personal room */
|
|
303
|
+
interface WsPayloadWorkspaceRemoved {
|
|
304
|
+
workspaceId: string;
|
|
305
|
+
}
|
|
306
|
+
/** workspace.updated → emitted to workspace room */
|
|
307
|
+
interface WsPayloadWorkspaceUpdated {
|
|
308
|
+
workspace: Workspace;
|
|
309
|
+
}
|
|
310
|
+
/** workspace.statusChanged → emitted to workspace room */
|
|
311
|
+
interface WsPayloadWorkspaceStatusChanged {
|
|
312
|
+
workspace: Workspace;
|
|
313
|
+
}
|
|
314
|
+
/** workspace.member.added → emitted to workspace room */
|
|
315
|
+
interface WsPayloadMemberAdded {
|
|
316
|
+
workspaceId: string;
|
|
317
|
+
member: WorkspaceMember;
|
|
318
|
+
}
|
|
319
|
+
/** workspace.member.updated → emitted to workspace room */
|
|
320
|
+
interface WsPayloadMemberUpdated {
|
|
321
|
+
workspaceId: string;
|
|
322
|
+
member: WorkspaceMember;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* workspace.member.removed → emitted to workspace room.
|
|
326
|
+
* `memberId` = the WorkspaceMember document _id (ObjectId string)
|
|
327
|
+
* `memberId_field` = the actual userId/email of the removed member
|
|
328
|
+
*/
|
|
329
|
+
interface WsPayloadMemberRemoved {
|
|
330
|
+
workspaceId: string;
|
|
331
|
+
memberId: string;
|
|
332
|
+
memberId_field: string;
|
|
333
|
+
}
|
|
334
|
+
/** workspace.message.created → emitted to workspace room */
|
|
335
|
+
interface WsPayloadMessageCreated {
|
|
336
|
+
workspaceId: string;
|
|
337
|
+
message: WorkspaceMessage;
|
|
338
|
+
}
|
|
339
|
+
/** workspace.artefact.created → emitted to workspace room */
|
|
340
|
+
interface WsPayloadArtefactCreated {
|
|
341
|
+
workspaceId: string;
|
|
342
|
+
artefacts: WorkspaceArtefact[];
|
|
343
|
+
}
|
|
344
|
+
/** workspace.typing.started / workspace.typing.stopped */
|
|
345
|
+
interface WsPayloadTyping {
|
|
346
|
+
workspaceId: string;
|
|
347
|
+
member: {
|
|
348
|
+
memberId: string;
|
|
349
|
+
memberName: string;
|
|
350
|
+
memberType?: 'user' | 'agent' | string;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
/** workspace.message.updated → emitted to workspace room */
|
|
354
|
+
interface WsPayloadMessageUpdated {
|
|
355
|
+
workspaceId: string;
|
|
356
|
+
message: WorkspaceMessage;
|
|
357
|
+
}
|
|
358
|
+
/** workspace.message.deleted → emitted to workspace room */
|
|
359
|
+
interface WsPayloadMessageDeleted {
|
|
360
|
+
workspaceId: string;
|
|
361
|
+
messageId: string;
|
|
362
|
+
}
|
|
363
|
+
/** workspace.message.reaction.created → emitted to workspace room */
|
|
364
|
+
interface WsPayloadReactionCreated {
|
|
365
|
+
workspaceId: string;
|
|
366
|
+
messageId: string;
|
|
367
|
+
reaction: WorkspaceMessageReaction;
|
|
368
|
+
}
|
|
369
|
+
/** workspace.message.reaction.deleted → emitted to workspace room */
|
|
370
|
+
interface WsPayloadReactionDeleted {
|
|
371
|
+
workspaceId: string;
|
|
372
|
+
messageId: string;
|
|
373
|
+
reaction: string;
|
|
374
|
+
memberId: string;
|
|
375
|
+
memberName: string;
|
|
376
|
+
}
|
|
377
|
+
/** workspace.message.pinned → emitted to workspace room */
|
|
378
|
+
interface WsPayloadMessagePinned {
|
|
379
|
+
workspaceId: string;
|
|
380
|
+
message: WorkspaceMessage;
|
|
381
|
+
action: 'pinned' | 'unpinned';
|
|
382
|
+
author: string;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
interface SyncLink {
|
|
386
|
+
provider: string;
|
|
387
|
+
externalId: string;
|
|
388
|
+
externalName?: string;
|
|
389
|
+
externalTeamId?: string;
|
|
390
|
+
active: boolean;
|
|
391
|
+
createdAt: string;
|
|
392
|
+
updatedAt: string;
|
|
393
|
+
}
|
|
394
|
+
interface SyncStatus {
|
|
395
|
+
syncWithSlack: boolean;
|
|
396
|
+
syncProviders?: string[];
|
|
397
|
+
links: SyncLink[];
|
|
398
|
+
}
|
|
399
|
+
interface SyncProviderInfo {
|
|
400
|
+
id: string;
|
|
401
|
+
enabled: boolean;
|
|
402
|
+
}
|
|
403
|
+
interface ToggleReactionResponse {
|
|
404
|
+
action: 'created' | 'deleted';
|
|
405
|
+
reaction: WorkspaceMessageReaction | null;
|
|
406
|
+
}
|
|
407
|
+
declare function createWorkspaceApis(client: WorkspaceClient): {
|
|
408
|
+
workspaceTypeApi: {
|
|
409
|
+
list: () => Promise<WorkspaceType[]>;
|
|
410
|
+
get: (id: string) => Promise<WorkspaceType>;
|
|
411
|
+
create: (payload: {
|
|
412
|
+
name: string;
|
|
413
|
+
entitiesWithSecrets?: EntityWithSecret[];
|
|
414
|
+
}) => Promise<WorkspaceType>;
|
|
415
|
+
update: (id: string, payload: {
|
|
416
|
+
name?: string;
|
|
417
|
+
entitiesWithSecrets?: EntityWithSecret[];
|
|
418
|
+
}) => Promise<WorkspaceType>;
|
|
419
|
+
delete: (id: string) => Promise<void>;
|
|
420
|
+
};
|
|
421
|
+
workspaceApi: {
|
|
422
|
+
list: (params?: {
|
|
423
|
+
search?: string;
|
|
424
|
+
status?: string;
|
|
425
|
+
type?: string;
|
|
426
|
+
isPrivate?: boolean;
|
|
427
|
+
limit?: number;
|
|
428
|
+
skip?: number;
|
|
429
|
+
}) => Promise<PaginatedResponse<Workspace>>;
|
|
430
|
+
get: (id: string) => Promise<Workspace>;
|
|
431
|
+
create: (payload: CreateWorkspacePayload) => Promise<Workspace>;
|
|
432
|
+
update: (id: string, payload: Partial<Omit<CreateWorkspacePayload, "members">>) => Promise<Workspace>;
|
|
433
|
+
updateStatus: (id: string, status: WorkspaceStatus) => Promise<Workspace>;
|
|
434
|
+
delete: (id: string) => Promise<void>;
|
|
435
|
+
startTyping: (id: string) => Promise<void>;
|
|
436
|
+
stopTyping: (id: string) => Promise<void>;
|
|
437
|
+
timeline: (workspaceId: string, params?: {
|
|
438
|
+
limit?: number;
|
|
439
|
+
offset?: number;
|
|
440
|
+
entityType?: string;
|
|
441
|
+
}) => Promise<PaginatedResponse<any>>;
|
|
442
|
+
};
|
|
443
|
+
memberApi: {
|
|
444
|
+
list: (workspaceId: string) => Promise<WorkspaceMember[]>;
|
|
445
|
+
add: (workspaceId: string, payload: {
|
|
446
|
+
memberId: string;
|
|
447
|
+
memberName: string;
|
|
448
|
+
memberType?: MemberType;
|
|
449
|
+
role?: MemberRole;
|
|
450
|
+
}) => Promise<WorkspaceMember>;
|
|
451
|
+
updateRole: (workspaceId: string, memberId: string, role: MemberRole) => Promise<WorkspaceMember>;
|
|
452
|
+
remove: (workspaceId: string, memberId: string) => Promise<void>;
|
|
453
|
+
};
|
|
454
|
+
messageApi: {
|
|
455
|
+
list: (workspaceId: string, params?: {
|
|
456
|
+
limit?: number;
|
|
457
|
+
offset?: number;
|
|
458
|
+
sort?: "asc" | "desc";
|
|
459
|
+
}) => Promise<PaginatedResponse<WorkspaceMessage>>;
|
|
460
|
+
send: (workspaceId: string, payload: SendMessagePayload) => Promise<WorkspaceMessage>;
|
|
461
|
+
update: (workspaceId: string, messageId: string, payload: UpdateMessagePayload) => Promise<WorkspaceMessage>;
|
|
462
|
+
delete: (workspaceId: string, messageId: string) => Promise<WorkspaceMessage>;
|
|
463
|
+
togglePin: (workspaceId: string, messageId: string) => Promise<WorkspaceMessage>;
|
|
464
|
+
};
|
|
465
|
+
artefactApi: {
|
|
466
|
+
upload: (workspaceId: string, files: File[], messageId?: string, artefactType?: string) => Promise<{
|
|
467
|
+
success: boolean;
|
|
468
|
+
count: number;
|
|
469
|
+
results: WorkspaceArtefact[];
|
|
470
|
+
}>;
|
|
471
|
+
list: (workspaceId: string, artefactType?: ArtefactType) => Promise<{
|
|
472
|
+
data: WorkspaceArtefact[];
|
|
473
|
+
total: number;
|
|
474
|
+
}>;
|
|
475
|
+
listPaginated: (workspaceId: string, params?: {
|
|
476
|
+
type?: ArtefactType;
|
|
477
|
+
limit?: number;
|
|
478
|
+
offset?: number;
|
|
479
|
+
}) => Promise<PaginatedResponse<WorkspaceArtefact>>;
|
|
480
|
+
delete: (workspaceId: string, artefactId: string) => Promise<unknown>;
|
|
481
|
+
getSignedUrl: (fileId: string) => Promise<{
|
|
482
|
+
url: string;
|
|
483
|
+
}>;
|
|
484
|
+
getDownloadBlob: (fileId: string) => Promise<Blob>;
|
|
485
|
+
messagesWithArtefacts: (workspaceId: string, params?: {
|
|
486
|
+
limit?: number;
|
|
487
|
+
offset?: number;
|
|
488
|
+
sort?: "asc" | "desc";
|
|
489
|
+
members?: string[];
|
|
490
|
+
concernsMe?: boolean;
|
|
491
|
+
pinned?: boolean;
|
|
492
|
+
}) => Promise<PaginatedResponse<MessageWithArtefacts>>;
|
|
493
|
+
};
|
|
494
|
+
reactionApi: {
|
|
495
|
+
toggle: (workspaceId: string, messageId: string, reaction: string) => Promise<ToggleReactionResponse>;
|
|
496
|
+
};
|
|
497
|
+
agentApi: {
|
|
498
|
+
list: (search?: string) => Promise<WorkspaceAgent[]>;
|
|
499
|
+
create: (body: {
|
|
500
|
+
agentId: string;
|
|
501
|
+
agentName: string;
|
|
502
|
+
}) => Promise<WorkspaceAgent>;
|
|
503
|
+
update: (id: string, body: {
|
|
504
|
+
agentName: string;
|
|
505
|
+
}) => Promise<WorkspaceAgent>;
|
|
506
|
+
delete: (id: string) => Promise<void>;
|
|
507
|
+
getDeleteInfo: (id: string) => Promise<AgentDeleteInfo>;
|
|
508
|
+
};
|
|
509
|
+
summaryApi: {
|
|
510
|
+
generate: (workspaceId: string) => Promise<WorkspaceSummary>;
|
|
511
|
+
getLatest: (workspaceId: string) => Promise<LatestSummaryResponse>;
|
|
512
|
+
getHistory: (workspaceId: string) => Promise<WorkspaceSummary[]>;
|
|
513
|
+
create: (workspaceId: string, payload: {
|
|
514
|
+
keyPoints: string[];
|
|
515
|
+
keyTasks: string[];
|
|
516
|
+
keyDecisions: string[];
|
|
517
|
+
messageCount: number;
|
|
518
|
+
lastMessage?: string;
|
|
519
|
+
wasTruncated?: boolean;
|
|
520
|
+
generatedAt?: string;
|
|
521
|
+
}) => Promise<WorkspaceSummary>;
|
|
522
|
+
update: (workspaceId: string, summaryId: string, payload: Partial<{
|
|
523
|
+
keyPoints: string[];
|
|
524
|
+
keyTasks: string[];
|
|
525
|
+
keyDecisions: string[];
|
|
526
|
+
messageCount: number;
|
|
527
|
+
wasTruncated: boolean;
|
|
528
|
+
}>) => Promise<WorkspaceSummary>;
|
|
529
|
+
};
|
|
530
|
+
webhookApi: {
|
|
531
|
+
list: (params?: {
|
|
532
|
+
search?: string;
|
|
533
|
+
isAgent?: string;
|
|
534
|
+
agentId?: string;
|
|
535
|
+
}) => Promise<WebhookSubscription[]>;
|
|
536
|
+
create: (data: {
|
|
537
|
+
name: string;
|
|
538
|
+
targetUrl: string;
|
|
539
|
+
secretKey: string;
|
|
540
|
+
secretValue: string;
|
|
541
|
+
eventTypes?: string[];
|
|
542
|
+
active?: boolean;
|
|
543
|
+
isAgent?: boolean;
|
|
544
|
+
agentId?: string;
|
|
545
|
+
metadata?: Record<string, unknown>;
|
|
546
|
+
}) => Promise<WebhookSubscription>;
|
|
547
|
+
update: (id: string, data: Partial<{
|
|
548
|
+
name: string;
|
|
549
|
+
targetUrl: string;
|
|
550
|
+
secretKey: string;
|
|
551
|
+
secretValue: string;
|
|
552
|
+
eventTypes: string[];
|
|
553
|
+
active: boolean;
|
|
554
|
+
isAgent: boolean;
|
|
555
|
+
agentId: string;
|
|
556
|
+
metadata: Record<string, unknown>;
|
|
557
|
+
}>) => Promise<WebhookSubscription>;
|
|
558
|
+
delete: (id: string) => Promise<unknown>;
|
|
559
|
+
};
|
|
560
|
+
syncApi: {
|
|
561
|
+
getAvailableProviders: () => Promise<SyncProviderInfo[]>;
|
|
562
|
+
getStatus: (workspaceId: string) => Promise<SyncStatus>;
|
|
563
|
+
toggleSync: (workspaceId: string, provider: string, enabled: boolean) => Promise<Workspace>;
|
|
564
|
+
};
|
|
565
|
+
};
|
|
566
|
+
type WorkspaceApis = ReturnType<typeof createWorkspaceApis>;
|
|
567
|
+
|
|
568
|
+
/** Payload shape sent by the backend Atlas Change Stream trigger */
|
|
569
|
+
interface ChangeLogData {
|
|
570
|
+
/** Full document snapshot (insert / replace events) */
|
|
571
|
+
fullDocument?: Record<string, unknown>;
|
|
572
|
+
/** Flat fields sent directly on data (legacy / simplified events) */
|
|
573
|
+
updatedFields?: Record<string, unknown>;
|
|
574
|
+
name?: string;
|
|
575
|
+
memberName?: string;
|
|
576
|
+
role?: string;
|
|
577
|
+
originalName?: string;
|
|
578
|
+
filename?: string;
|
|
579
|
+
/** MongoDB update description (update events) */
|
|
580
|
+
updateDescription?: {
|
|
581
|
+
updatedFields?: Record<string, unknown>;
|
|
582
|
+
removedFields?: string[];
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
/** Matches the backend ChangeLog schema */
|
|
586
|
+
interface ChangeLog {
|
|
587
|
+
_id: string;
|
|
588
|
+
event: string;
|
|
589
|
+
timestamp: number;
|
|
590
|
+
type: string;
|
|
591
|
+
entityId: string;
|
|
592
|
+
data?: ChangeLogData;
|
|
593
|
+
createdBy?: string;
|
|
594
|
+
updatedBy?: string;
|
|
595
|
+
}
|
|
596
|
+
type ActivityIcon = 'created' | 'updated' | 'deleted' | 'member_added' | 'member_removed' | 'member_role' | 'artefact_added' | 'artefact_deleted' | 'archived' | 'generic';
|
|
597
|
+
type EntityCategory = 'context' | 'members' | 'artefacts' | 'other';
|
|
598
|
+
interface ActivityEntry {
|
|
599
|
+
_id: string;
|
|
600
|
+
title: string;
|
|
601
|
+
description: string;
|
|
602
|
+
date: string;
|
|
603
|
+
author: string;
|
|
604
|
+
icon: ActivityIcon;
|
|
605
|
+
category: EntityCategory;
|
|
606
|
+
}
|
|
607
|
+
interface FilterPill {
|
|
608
|
+
label: string;
|
|
609
|
+
value: string | undefined;
|
|
610
|
+
entityType: string | undefined;
|
|
611
|
+
category: EntityCategory | undefined;
|
|
612
|
+
}
|
|
613
|
+
declare const FILTER_PILLS: FilterPill[];
|
|
614
|
+
declare const WORKSPACE_FIELD_LABELS: Record<string, string>;
|
|
615
|
+
declare const WORKSPACE_STATUS_LABELS: Record<string, string>;
|
|
616
|
+
declare const MEMBER_ROLE_LABELS: Record<string, string>;
|
|
617
|
+
declare const IGNORED_FIELDS: string[];
|
|
618
|
+
declare const CATEGORY_STYLES: Record<EntityCategory, {
|
|
619
|
+
dot: string;
|
|
620
|
+
badge: string;
|
|
621
|
+
label: string;
|
|
622
|
+
}>;
|
|
623
|
+
declare const ICON_COLOR: Record<ActivityIcon, string>;
|
|
624
|
+
|
|
625
|
+
type WorkspaceTab = 'group' | 'private';
|
|
626
|
+
interface WorkspaceListFilters {
|
|
627
|
+
search: string;
|
|
628
|
+
status: string;
|
|
629
|
+
type: string;
|
|
630
|
+
}
|
|
631
|
+
interface WorkspaceListState {
|
|
632
|
+
workspaces: Workspace[];
|
|
633
|
+
total: number;
|
|
634
|
+
membersMap: Record<string, WorkspaceMember[]>;
|
|
635
|
+
types: WorkspaceType[];
|
|
636
|
+
tab: WorkspaceTab;
|
|
637
|
+
page: number;
|
|
638
|
+
pageSize: number;
|
|
639
|
+
totalPages: number;
|
|
640
|
+
filters: WorkspaceListFilters;
|
|
641
|
+
initialLoading: boolean;
|
|
642
|
+
fetching: boolean;
|
|
643
|
+
hydrated: boolean;
|
|
644
|
+
setTab: (tab: WorkspaceTab) => void;
|
|
645
|
+
setFilters: (filters: WorkspaceListFilters) => void;
|
|
646
|
+
setPage: (page: number) => void;
|
|
647
|
+
fetchWorkspaces: () => Promise<void>;
|
|
648
|
+
fetchTypes: () => Promise<void>;
|
|
649
|
+
prependWorkspace: (ws: Workspace, members?: WorkspaceMember[]) => void;
|
|
650
|
+
removeWorkspace: (workspaceId: string) => void;
|
|
651
|
+
refresh: () => Promise<void>;
|
|
652
|
+
}
|
|
653
|
+
/**
|
|
654
|
+
* Factory that creates a Zustand store bound to the injected API client.
|
|
655
|
+
* Call this inside your WorkspaceProvider or in a hook.
|
|
656
|
+
*/
|
|
657
|
+
declare function createWorkspaceListStore(apis: WorkspaceApis): UseBoundStore<StoreApi<WorkspaceListState>>;
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* Hook to access all workspace API modules within a WorkspaceProvider.
|
|
661
|
+
* The APIs are memoized and only recreated when the client changes.
|
|
662
|
+
*/
|
|
663
|
+
declare function useWorkspaceApi(): WorkspaceApis;
|
|
664
|
+
|
|
665
|
+
declare const AVAILABLE_AGENTS: {
|
|
666
|
+
memberId: string;
|
|
667
|
+
memberName: string;
|
|
668
|
+
memberType: MemberType;
|
|
669
|
+
}[];
|
|
670
|
+
declare const ROLE_LABELS: Record<string, string>;
|
|
671
|
+
declare const STATUS_LABELS: Record<string, string>;
|
|
672
|
+
declare function getInitials(name: string): string;
|
|
673
|
+
|
|
674
|
+
interface WorkspaceExportData {
|
|
675
|
+
workspace: Workspace;
|
|
676
|
+
members: WorkspaceMember[];
|
|
677
|
+
messages: MessageWithArtefacts[];
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Generates a formatted Markdown string representing the full workspace export.
|
|
681
|
+
* Includes context, members, and the complete discussion thread.
|
|
682
|
+
*/
|
|
683
|
+
declare function formatWorkspaceExport(data: WorkspaceExportData): string;
|
|
684
|
+
|
|
685
|
+
/** Preset width for the centered panel */
|
|
686
|
+
type ModalSize = 'sm' | 'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl' | '5xl' | '6xl' | '7xl' | 'full';
|
|
687
|
+
type ModalHeaderVariant = 'strip' | 'plain';
|
|
688
|
+
interface ModalProps {
|
|
689
|
+
open: boolean;
|
|
690
|
+
onClose: () => void;
|
|
691
|
+
children: React.ReactNode;
|
|
692
|
+
zIndexClass?: string;
|
|
693
|
+
backdropClassName?: string;
|
|
694
|
+
size?: ModalSize;
|
|
695
|
+
panelClassName?: string;
|
|
696
|
+
className?: string;
|
|
697
|
+
closeOnBackdropClick?: boolean;
|
|
698
|
+
closeOnEscape?: boolean;
|
|
699
|
+
ariaLabelledBy?: string;
|
|
700
|
+
ariaDescribedBy?: string;
|
|
701
|
+
title?: React.ReactNode;
|
|
702
|
+
description?: React.ReactNode;
|
|
703
|
+
titleIcon?: React.ReactNode;
|
|
704
|
+
headingId?: string;
|
|
705
|
+
modalHeaderVariant?: ModalHeaderVariant;
|
|
706
|
+
hideCloseButton?: boolean;
|
|
707
|
+
headerTrailing?: React.ReactNode;
|
|
708
|
+
closeButtonAriaLabel?: string;
|
|
709
|
+
closeButtonDisabled?: boolean;
|
|
710
|
+
closeButtonClassName?: string;
|
|
711
|
+
closeIconSize?: number;
|
|
712
|
+
headerClassName?: string;
|
|
713
|
+
titleClassName?: string;
|
|
714
|
+
descriptionClassName?: string;
|
|
715
|
+
}
|
|
716
|
+
declare function Modal({ open, onClose, children, zIndexClass, backdropClassName, size, panelClassName, className, closeOnBackdropClick, closeOnEscape, ariaLabelledBy: ariaLabelledByProp, ariaDescribedBy: ariaDescribedByProp, title, description, titleIcon, headingId, modalHeaderVariant, hideCloseButton, headerTrailing, closeButtonAriaLabel, closeButtonDisabled, closeButtonClassName, closeIconSize, headerClassName, titleClassName, descriptionClassName, }: ModalProps): React.ReactPortal | null;
|
|
717
|
+
|
|
718
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
719
|
+
|
|
720
|
+
type AvatarSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
721
|
+
interface MemberAvatarProps {
|
|
722
|
+
memberName: string;
|
|
723
|
+
memberType: 'user' | 'agent';
|
|
724
|
+
avatarUrl?: string | null;
|
|
725
|
+
size?: AvatarSize;
|
|
726
|
+
className?: string;
|
|
727
|
+
variant?: 'primary' | 'owner' | 'currentUser';
|
|
728
|
+
}
|
|
729
|
+
declare const MemberAvatar: React.FC<MemberAvatarProps>;
|
|
730
|
+
|
|
731
|
+
interface AvatarUser {
|
|
732
|
+
email: string;
|
|
733
|
+
avatarUrl?: string;
|
|
734
|
+
}
|
|
735
|
+
interface MembersPanelProps {
|
|
736
|
+
members: WorkspaceMember[];
|
|
737
|
+
avatarUsers?: AvatarUser[];
|
|
738
|
+
onAddMember?: (payload: {
|
|
739
|
+
memberId: string;
|
|
740
|
+
memberName: string;
|
|
741
|
+
memberType: MemberType;
|
|
742
|
+
role?: MemberRole;
|
|
743
|
+
}) => void;
|
|
744
|
+
onRemoveMember?: (memberId: string) => void;
|
|
745
|
+
onUpdateRole?: (memberId: string, role: MemberRole) => void;
|
|
746
|
+
readonly?: boolean;
|
|
747
|
+
}
|
|
748
|
+
declare const MembersPanel: React.FC<MembersPanelProps>;
|
|
749
|
+
|
|
750
|
+
interface CreateWorkspaceModalProps {
|
|
751
|
+
open: boolean;
|
|
752
|
+
onClose: () => void;
|
|
753
|
+
onCreated?: (workspace: unknown) => void;
|
|
754
|
+
}
|
|
755
|
+
declare const CreateWorkspaceModal: React.FC<CreateWorkspaceModalProps>;
|
|
756
|
+
|
|
757
|
+
interface CreatePrivateWorkspaceModalProps {
|
|
758
|
+
open: boolean;
|
|
759
|
+
onClose: () => void;
|
|
760
|
+
onCreated?: (workspace: unknown) => void;
|
|
761
|
+
}
|
|
762
|
+
declare const CreatePrivateWorkspaceModal: React.FC<CreatePrivateWorkspaceModalProps>;
|
|
763
|
+
|
|
764
|
+
interface SyncPanelProps {
|
|
765
|
+
workspaceId: string;
|
|
766
|
+
syncWithSlack?: boolean;
|
|
767
|
+
isOwner: boolean;
|
|
768
|
+
/** Whether Slack sync is configured and enabled on the server */
|
|
769
|
+
slackConfigured?: boolean;
|
|
770
|
+
/** Called after a sync toggle — the parent page will get the updated workspace via real-time. */
|
|
771
|
+
onToggleSync?: (provider: string, enabled: boolean) => Promise<void>;
|
|
772
|
+
}
|
|
773
|
+
declare const SyncPanel: React.FC<SyncPanelProps>;
|
|
774
|
+
|
|
775
|
+
interface PaginationProps {
|
|
776
|
+
currentPage: number;
|
|
777
|
+
totalPages: number;
|
|
778
|
+
onPageChange: (page: number) => void;
|
|
779
|
+
/** Show a subtle loading indicator when fetching */
|
|
780
|
+
loading?: boolean;
|
|
781
|
+
}
|
|
782
|
+
declare const Pagination: React.FC<PaginationProps>;
|
|
783
|
+
|
|
784
|
+
export { AVAILABLE_AGENTS, type ActivityEntry, type ActivityIcon, type AgentDeleteInfo, type ArtefactType, type AvatarUser, CATEGORY_STYLES, type ChangeLog, type ChangeLogData, CreatePrivateWorkspaceModal, CreateWorkspaceModal, type CreateWorkspacePayload, type EntityCategory, type EntityWithSecret, FILTER_PILLS, type FileRecord, type FilterPill, ICON_COLOR, IGNORED_FIELDS, type LatestSummaryResponse, MEMBER_ROLE_LABELS, MemberAvatar, type MemberAvatarProps, type MemberRole, type MemberType, MembersPanel, type MessageWithArtefacts, Modal, type ModalProps, type ModalSize, type PaginatedResponse, Pagination, ROLE_LABELS, type ReplyMessage, STATUS_LABELS, type SendMessagePayload, type SyncLink, SyncPanel, type SyncProviderInfo, type SyncStatus, type ToggleReactionResponse, type UpdateMessagePayload, type UserSearchResult, WORKSPACE_FIELD_LABELS, WORKSPACE_STATUS_LABELS, type WebhookSubscription, type Workspace, type WorkspaceAgent, type WorkspaceApis, type WorkspaceArtefact, type WorkspaceClient, type WorkspaceConfig, type WorkspaceContextValue, WorkspaceEvent, type WorkspaceExportData, type WorkspaceListFilters, type WorkspaceListState, type WorkspaceMember, type WorkspaceMessage, type WorkspaceMessageReaction, type WorkspaceMessageSender, WorkspaceProvider, type WorkspaceSocketManager, type WorkspaceStatus, type WorkspaceSummary, type WorkspaceTab, type WorkspaceType, type WsPayloadArtefactCreated, type WsPayloadMemberAdded, type WsPayloadMemberRemoved, type WsPayloadMemberUpdated, type WsPayloadMessageCreated, type WsPayloadMessageDeleted, type WsPayloadMessagePinned, type WsPayloadMessageUpdated, type WsPayloadReactionCreated, type WsPayloadReactionDeleted, type WsPayloadTyping, type WsPayloadWorkspaceAdded, type WsPayloadWorkspaceCreated, type WsPayloadWorkspaceRemoved, type WsPayloadWorkspaceStatusChanged, type WsPayloadWorkspaceUpdated, cn, createWorkspaceApis, createWorkspaceClient, createWorkspaceListStore, createWorkspaceSocket, formatWorkspaceExport, getInitials, useWorkspaceApi, useWorkspaceContext };
|