@dolusoft/claude-collab 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/LICENSE +21 -0
- package/README.md +236 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +2064 -0
- package/dist/cli.js.map +1 -0
- package/dist/hub-main.d.ts +1 -0
- package/dist/hub-main.js +1497 -0
- package/dist/hub-main.js.map +1 -0
- package/dist/mcp-main.d.ts +1 -0
- package/dist/mcp-main.js +684 -0
- package/dist/mcp-main.js.map +1 -0
- package/package.json +80 -0
package/dist/hub-main.js
ADDED
|
@@ -0,0 +1,1497 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { WebSocketServer, WebSocket } from 'ws';
|
|
3
|
+
import { v4 } from 'uuid';
|
|
4
|
+
|
|
5
|
+
// src/domain/entities/member.entity.ts
|
|
6
|
+
var Member = class _Member {
|
|
7
|
+
_id;
|
|
8
|
+
_teamId;
|
|
9
|
+
_displayName;
|
|
10
|
+
_connectedAt;
|
|
11
|
+
_status;
|
|
12
|
+
_lastActivityAt;
|
|
13
|
+
constructor(props) {
|
|
14
|
+
this._id = props.id;
|
|
15
|
+
this._teamId = props.teamId;
|
|
16
|
+
this._displayName = props.displayName;
|
|
17
|
+
this._connectedAt = props.connectedAt;
|
|
18
|
+
this._status = props.status;
|
|
19
|
+
this._lastActivityAt = props.connectedAt;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates a new Member instance
|
|
23
|
+
*/
|
|
24
|
+
static create(props) {
|
|
25
|
+
if (!props.displayName.trim()) {
|
|
26
|
+
throw new Error("Display name cannot be empty");
|
|
27
|
+
}
|
|
28
|
+
return new _Member(props);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reconstitutes a Member from persistence
|
|
32
|
+
*/
|
|
33
|
+
static reconstitute(props) {
|
|
34
|
+
const member = new _Member(props);
|
|
35
|
+
member._lastActivityAt = props.lastActivityAt;
|
|
36
|
+
return member;
|
|
37
|
+
}
|
|
38
|
+
// Getters
|
|
39
|
+
get id() {
|
|
40
|
+
return this._id;
|
|
41
|
+
}
|
|
42
|
+
get teamId() {
|
|
43
|
+
return this._teamId;
|
|
44
|
+
}
|
|
45
|
+
get displayName() {
|
|
46
|
+
return this._displayName;
|
|
47
|
+
}
|
|
48
|
+
get connectedAt() {
|
|
49
|
+
return this._connectedAt;
|
|
50
|
+
}
|
|
51
|
+
get status() {
|
|
52
|
+
return this._status;
|
|
53
|
+
}
|
|
54
|
+
get lastActivityAt() {
|
|
55
|
+
return this._lastActivityAt;
|
|
56
|
+
}
|
|
57
|
+
get isOnline() {
|
|
58
|
+
return this._status === "ONLINE" /* ONLINE */ || this._status === "IDLE" /* IDLE */;
|
|
59
|
+
}
|
|
60
|
+
// Behaviors
|
|
61
|
+
/**
|
|
62
|
+
* Marks the member as online
|
|
63
|
+
*/
|
|
64
|
+
goOnline() {
|
|
65
|
+
this._status = "ONLINE" /* ONLINE */;
|
|
66
|
+
this._lastActivityAt = /* @__PURE__ */ new Date();
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Marks the member as idle
|
|
70
|
+
*/
|
|
71
|
+
goIdle() {
|
|
72
|
+
this._status = "IDLE" /* IDLE */;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Marks the member as offline
|
|
76
|
+
*/
|
|
77
|
+
goOffline() {
|
|
78
|
+
this._status = "OFFLINE" /* OFFLINE */;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Records activity from this member
|
|
82
|
+
*/
|
|
83
|
+
recordActivity() {
|
|
84
|
+
this._lastActivityAt = /* @__PURE__ */ new Date();
|
|
85
|
+
if (this._status === "IDLE" /* IDLE */) {
|
|
86
|
+
this._status = "ONLINE" /* ONLINE */;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Converts entity to plain object for serialization
|
|
91
|
+
*/
|
|
92
|
+
toJSON() {
|
|
93
|
+
return {
|
|
94
|
+
id: this._id,
|
|
95
|
+
teamId: this._teamId,
|
|
96
|
+
displayName: this._displayName,
|
|
97
|
+
connectedAt: this._connectedAt,
|
|
98
|
+
status: this._status,
|
|
99
|
+
lastActivityAt: this._lastActivityAt
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var BaseDomainEvent = class {
|
|
104
|
+
eventId;
|
|
105
|
+
timestamp;
|
|
106
|
+
constructor() {
|
|
107
|
+
this.eventId = v4();
|
|
108
|
+
this.timestamp = /* @__PURE__ */ new Date();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Converts event to JSON
|
|
112
|
+
*/
|
|
113
|
+
toJSON() {
|
|
114
|
+
return {
|
|
115
|
+
eventId: this.eventId,
|
|
116
|
+
eventType: this.eventType,
|
|
117
|
+
timestamp: this.timestamp,
|
|
118
|
+
payload: this.payload
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// src/domain/events/member-joined.event.ts
|
|
124
|
+
var MemberJoinedEvent = class _MemberJoinedEvent extends BaseDomainEvent {
|
|
125
|
+
constructor(memberId, teamId, displayName) {
|
|
126
|
+
super();
|
|
127
|
+
this.memberId = memberId;
|
|
128
|
+
this.teamId = teamId;
|
|
129
|
+
this.displayName = displayName;
|
|
130
|
+
}
|
|
131
|
+
static EVENT_TYPE = "MEMBER_JOINED";
|
|
132
|
+
get eventType() {
|
|
133
|
+
return _MemberJoinedEvent.EVENT_TYPE;
|
|
134
|
+
}
|
|
135
|
+
get payload() {
|
|
136
|
+
return {
|
|
137
|
+
memberId: this.memberId,
|
|
138
|
+
teamId: this.teamId,
|
|
139
|
+
displayName: this.displayName
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// src/shared/types/branded-types.ts
|
|
145
|
+
var MemberId = {
|
|
146
|
+
create: (id) => id,
|
|
147
|
+
isValid: (id) => id.length > 0
|
|
148
|
+
};
|
|
149
|
+
var TeamId = {
|
|
150
|
+
create: (id) => id.toLowerCase().trim(),
|
|
151
|
+
isValid: (id) => /^[a-z][a-z0-9-]*$/.test(id.toLowerCase().trim())
|
|
152
|
+
};
|
|
153
|
+
var QuestionId = {
|
|
154
|
+
create: (id) => id,
|
|
155
|
+
isValid: (id) => id.length > 0
|
|
156
|
+
};
|
|
157
|
+
var AnswerId = {
|
|
158
|
+
create: (id) => id,
|
|
159
|
+
isValid: (id) => id.length > 0
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
// src/shared/utils/id-generator.ts
|
|
163
|
+
function generateMemberId() {
|
|
164
|
+
return MemberId.create(v4());
|
|
165
|
+
}
|
|
166
|
+
function createTeamId(name) {
|
|
167
|
+
return TeamId.create(name);
|
|
168
|
+
}
|
|
169
|
+
function generateQuestionId() {
|
|
170
|
+
return QuestionId.create(`q_${v4()}`);
|
|
171
|
+
}
|
|
172
|
+
function generateAnswerId() {
|
|
173
|
+
return AnswerId.create(`a_${v4()}`);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/shared/errors/domain-errors.ts
|
|
177
|
+
var DomainError = class extends Error {
|
|
178
|
+
code;
|
|
179
|
+
timestamp;
|
|
180
|
+
constructor(message, code) {
|
|
181
|
+
super(message);
|
|
182
|
+
this.name = this.constructor.name;
|
|
183
|
+
this.code = code;
|
|
184
|
+
this.timestamp = /* @__PURE__ */ new Date();
|
|
185
|
+
Error.captureStackTrace(this, this.constructor);
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
var TeamNotFoundError = class extends DomainError {
|
|
189
|
+
constructor(teamId) {
|
|
190
|
+
super(`Team '${teamId}' not found`, "TEAM_NOT_FOUND");
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
var MemberNotFoundError = class extends DomainError {
|
|
194
|
+
constructor(memberId) {
|
|
195
|
+
super(`Member '${memberId}' not found`, "MEMBER_NOT_FOUND");
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
var QuestionNotFoundError = class extends DomainError {
|
|
199
|
+
constructor(questionId) {
|
|
200
|
+
super(`Question '${questionId}' not found`, "QUESTION_NOT_FOUND");
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
var QuestionAlreadyAnsweredError = class extends DomainError {
|
|
204
|
+
constructor(questionId) {
|
|
205
|
+
super(`Question '${questionId}' has already been answered`, "QUESTION_ALREADY_ANSWERED");
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var ValidationError = class extends DomainError {
|
|
209
|
+
field;
|
|
210
|
+
constructor(field, message) {
|
|
211
|
+
super(message, "VALIDATION_ERROR");
|
|
212
|
+
this.field = field;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
// src/application/use-cases/join-team.use-case.ts
|
|
217
|
+
var JoinTeamUseCase = class {
|
|
218
|
+
constructor(deps) {
|
|
219
|
+
this.deps = deps;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Executes the use case
|
|
223
|
+
*/
|
|
224
|
+
async execute(input) {
|
|
225
|
+
if (!input.teamName.trim()) {
|
|
226
|
+
throw new ValidationError("teamName", "Team name cannot be empty");
|
|
227
|
+
}
|
|
228
|
+
if (!input.displayName.trim()) {
|
|
229
|
+
throw new ValidationError("displayName", "Display name cannot be empty");
|
|
230
|
+
}
|
|
231
|
+
const team = await this.deps.teamRepository.getOrCreate(input.teamName);
|
|
232
|
+
const memberId = generateMemberId();
|
|
233
|
+
const member = Member.create({
|
|
234
|
+
id: memberId,
|
|
235
|
+
teamId: team.id,
|
|
236
|
+
displayName: input.displayName.trim(),
|
|
237
|
+
connectedAt: /* @__PURE__ */ new Date(),
|
|
238
|
+
status: "ONLINE" /* ONLINE */
|
|
239
|
+
});
|
|
240
|
+
await this.deps.memberRepository.save(member);
|
|
241
|
+
team.addMember(memberId);
|
|
242
|
+
await this.deps.teamRepository.save(team);
|
|
243
|
+
if (this.deps.onMemberJoined) {
|
|
244
|
+
const event = new MemberJoinedEvent(memberId, team.id, member.displayName);
|
|
245
|
+
await this.deps.onMemberJoined(event);
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
memberId,
|
|
249
|
+
teamId: team.id,
|
|
250
|
+
teamName: team.name,
|
|
251
|
+
displayName: member.displayName,
|
|
252
|
+
status: member.status,
|
|
253
|
+
memberCount: team.memberCount
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// src/domain/entities/question.entity.ts
|
|
259
|
+
var Question = class _Question {
|
|
260
|
+
_id;
|
|
261
|
+
_fromMemberId;
|
|
262
|
+
_toTeamId;
|
|
263
|
+
_content;
|
|
264
|
+
_createdAt;
|
|
265
|
+
_status;
|
|
266
|
+
_answeredAt;
|
|
267
|
+
_answeredByMemberId;
|
|
268
|
+
constructor(props) {
|
|
269
|
+
this._id = props.id;
|
|
270
|
+
this._fromMemberId = props.fromMemberId;
|
|
271
|
+
this._toTeamId = props.toTeamId;
|
|
272
|
+
this._content = props.content;
|
|
273
|
+
this._createdAt = props.createdAt;
|
|
274
|
+
this._status = props.status;
|
|
275
|
+
this._answeredAt = props.answeredAt;
|
|
276
|
+
this._answeredByMemberId = props.answeredByMemberId;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Creates a new Question instance
|
|
280
|
+
*/
|
|
281
|
+
static create(props) {
|
|
282
|
+
return new _Question({
|
|
283
|
+
...props,
|
|
284
|
+
status: "PENDING" /* PENDING */
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Reconstitutes a Question from persistence
|
|
289
|
+
*/
|
|
290
|
+
static reconstitute(props) {
|
|
291
|
+
return new _Question(props);
|
|
292
|
+
}
|
|
293
|
+
// Getters
|
|
294
|
+
get id() {
|
|
295
|
+
return this._id;
|
|
296
|
+
}
|
|
297
|
+
get fromMemberId() {
|
|
298
|
+
return this._fromMemberId;
|
|
299
|
+
}
|
|
300
|
+
get toTeamId() {
|
|
301
|
+
return this._toTeamId;
|
|
302
|
+
}
|
|
303
|
+
get content() {
|
|
304
|
+
return this._content;
|
|
305
|
+
}
|
|
306
|
+
get createdAt() {
|
|
307
|
+
return this._createdAt;
|
|
308
|
+
}
|
|
309
|
+
get status() {
|
|
310
|
+
return this._status;
|
|
311
|
+
}
|
|
312
|
+
get answeredAt() {
|
|
313
|
+
return this._answeredAt;
|
|
314
|
+
}
|
|
315
|
+
get answeredByMemberId() {
|
|
316
|
+
return this._answeredByMemberId;
|
|
317
|
+
}
|
|
318
|
+
get isPending() {
|
|
319
|
+
return this._status === "PENDING" /* PENDING */;
|
|
320
|
+
}
|
|
321
|
+
get isAnswered() {
|
|
322
|
+
return this._status === "ANSWERED" /* ANSWERED */;
|
|
323
|
+
}
|
|
324
|
+
get isTimedOut() {
|
|
325
|
+
return this._status === "TIMEOUT" /* TIMEOUT */;
|
|
326
|
+
}
|
|
327
|
+
get isCancelled() {
|
|
328
|
+
return this._status === "CANCELLED" /* CANCELLED */;
|
|
329
|
+
}
|
|
330
|
+
get canBeAnswered() {
|
|
331
|
+
return this._status === "PENDING" /* PENDING */;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Calculates the age of the question in milliseconds
|
|
335
|
+
*/
|
|
336
|
+
get ageMs() {
|
|
337
|
+
return Date.now() - this._createdAt.getTime();
|
|
338
|
+
}
|
|
339
|
+
// Behaviors
|
|
340
|
+
/**
|
|
341
|
+
* Marks the question as answered
|
|
342
|
+
* @throws QuestionAlreadyAnsweredError if already answered
|
|
343
|
+
*/
|
|
344
|
+
markAsAnswered(answeredByMemberId) {
|
|
345
|
+
if (!this.canBeAnswered) {
|
|
346
|
+
throw new QuestionAlreadyAnsweredError(this._id);
|
|
347
|
+
}
|
|
348
|
+
this._status = "ANSWERED" /* ANSWERED */;
|
|
349
|
+
this._answeredAt = /* @__PURE__ */ new Date();
|
|
350
|
+
this._answeredByMemberId = answeredByMemberId;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Marks the question as timed out
|
|
354
|
+
*/
|
|
355
|
+
markAsTimedOut() {
|
|
356
|
+
if (this._status === "PENDING" /* PENDING */) {
|
|
357
|
+
this._status = "TIMEOUT" /* TIMEOUT */;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Marks the question as cancelled
|
|
362
|
+
*/
|
|
363
|
+
markAsCancelled() {
|
|
364
|
+
if (this._status === "PENDING" /* PENDING */) {
|
|
365
|
+
this._status = "CANCELLED" /* CANCELLED */;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Converts entity to plain object for serialization
|
|
370
|
+
*/
|
|
371
|
+
toJSON() {
|
|
372
|
+
return {
|
|
373
|
+
id: this._id,
|
|
374
|
+
fromMemberId: this._fromMemberId,
|
|
375
|
+
toTeamId: this._toTeamId,
|
|
376
|
+
content: this._content,
|
|
377
|
+
createdAt: this._createdAt,
|
|
378
|
+
status: this._status,
|
|
379
|
+
answeredAt: this._answeredAt,
|
|
380
|
+
answeredByMemberId: this._answeredByMemberId
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
// src/config/index.ts
|
|
386
|
+
var config = {
|
|
387
|
+
/**
|
|
388
|
+
* WebSocket Hub configuration
|
|
389
|
+
*/
|
|
390
|
+
hub: {
|
|
391
|
+
/**
|
|
392
|
+
* Default port for the Hub server
|
|
393
|
+
*/
|
|
394
|
+
port: parseInt(process.env["CLAUDE_COLLAB_PORT"] ?? "9999", 10),
|
|
395
|
+
/**
|
|
396
|
+
* Host to bind the Hub server to
|
|
397
|
+
*/
|
|
398
|
+
host: process.env["CLAUDE_COLLAB_HOST"] ?? "localhost",
|
|
399
|
+
/**
|
|
400
|
+
* Heartbeat interval in milliseconds
|
|
401
|
+
*/
|
|
402
|
+
heartbeatInterval: 3e4,
|
|
403
|
+
/**
|
|
404
|
+
* Client timeout in milliseconds (no heartbeat received)
|
|
405
|
+
*/
|
|
406
|
+
clientTimeout: 6e4
|
|
407
|
+
},
|
|
408
|
+
/**
|
|
409
|
+
* Communication configuration
|
|
410
|
+
*/
|
|
411
|
+
communication: {
|
|
412
|
+
/**
|
|
413
|
+
* Default timeout for waiting for an answer (in milliseconds)
|
|
414
|
+
*/
|
|
415
|
+
defaultTimeout: 3e4,
|
|
416
|
+
/**
|
|
417
|
+
* Maximum message content length
|
|
418
|
+
*/
|
|
419
|
+
maxMessageLength: 5e4
|
|
420
|
+
}};
|
|
421
|
+
|
|
422
|
+
// src/domain/value-objects/message-content.vo.ts
|
|
423
|
+
var MessageContent = class _MessageContent {
|
|
424
|
+
_text;
|
|
425
|
+
_format;
|
|
426
|
+
constructor(text, format) {
|
|
427
|
+
this._text = text;
|
|
428
|
+
this._format = format;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Creates a new MessageContent
|
|
432
|
+
* @throws ValidationError if content is invalid
|
|
433
|
+
*/
|
|
434
|
+
static create(text, format = "markdown") {
|
|
435
|
+
const trimmedText = text.trim();
|
|
436
|
+
if (!trimmedText) {
|
|
437
|
+
throw new ValidationError("text", "Message content cannot be empty");
|
|
438
|
+
}
|
|
439
|
+
if (trimmedText.length > config.communication.maxMessageLength) {
|
|
440
|
+
throw new ValidationError(
|
|
441
|
+
"text",
|
|
442
|
+
`Message content exceeds maximum length of ${config.communication.maxMessageLength} characters`
|
|
443
|
+
);
|
|
444
|
+
}
|
|
445
|
+
return new _MessageContent(trimmedText, format);
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Creates a plain text message
|
|
449
|
+
*/
|
|
450
|
+
static plain(text) {
|
|
451
|
+
return _MessageContent.create(text, "plain");
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Creates a markdown message
|
|
455
|
+
*/
|
|
456
|
+
static markdown(text) {
|
|
457
|
+
return _MessageContent.create(text, "markdown");
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Reconstitutes from persistence
|
|
461
|
+
*/
|
|
462
|
+
static reconstitute(props) {
|
|
463
|
+
return new _MessageContent(props.text, props.format);
|
|
464
|
+
}
|
|
465
|
+
// Getters
|
|
466
|
+
get text() {
|
|
467
|
+
return this._text;
|
|
468
|
+
}
|
|
469
|
+
get format() {
|
|
470
|
+
return this._format;
|
|
471
|
+
}
|
|
472
|
+
get length() {
|
|
473
|
+
return this._text.length;
|
|
474
|
+
}
|
|
475
|
+
get isMarkdown() {
|
|
476
|
+
return this._format === "markdown";
|
|
477
|
+
}
|
|
478
|
+
get isPlain() {
|
|
479
|
+
return this._format === "plain";
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Returns a preview of the content (first 100 chars)
|
|
483
|
+
*/
|
|
484
|
+
get preview() {
|
|
485
|
+
if (this._text.length <= 100) {
|
|
486
|
+
return this._text;
|
|
487
|
+
}
|
|
488
|
+
return `${this._text.substring(0, 97)}...`;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Checks equality with another MessageContent
|
|
492
|
+
*/
|
|
493
|
+
equals(other) {
|
|
494
|
+
return this._text === other._text && this._format === other._format;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Converts to plain object for serialization
|
|
498
|
+
*/
|
|
499
|
+
toJSON() {
|
|
500
|
+
return {
|
|
501
|
+
text: this._text,
|
|
502
|
+
format: this._format
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* String representation
|
|
507
|
+
*/
|
|
508
|
+
toString() {
|
|
509
|
+
return this._text;
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
// src/domain/events/question-asked.event.ts
|
|
514
|
+
var QuestionAskedEvent = class _QuestionAskedEvent extends BaseDomainEvent {
|
|
515
|
+
constructor(questionId, fromMemberId, toTeamId, contentPreview) {
|
|
516
|
+
super();
|
|
517
|
+
this.questionId = questionId;
|
|
518
|
+
this.fromMemberId = fromMemberId;
|
|
519
|
+
this.toTeamId = toTeamId;
|
|
520
|
+
this.contentPreview = contentPreview;
|
|
521
|
+
}
|
|
522
|
+
static EVENT_TYPE = "QUESTION_ASKED";
|
|
523
|
+
get eventType() {
|
|
524
|
+
return _QuestionAskedEvent.EVENT_TYPE;
|
|
525
|
+
}
|
|
526
|
+
get payload() {
|
|
527
|
+
return {
|
|
528
|
+
questionId: this.questionId,
|
|
529
|
+
fromMemberId: this.fromMemberId,
|
|
530
|
+
toTeamId: this.toTeamId,
|
|
531
|
+
contentPreview: this.contentPreview
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
// src/application/use-cases/ask-question.use-case.ts
|
|
537
|
+
var AskQuestionUseCase = class {
|
|
538
|
+
constructor(deps) {
|
|
539
|
+
this.deps = deps;
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Executes the use case
|
|
543
|
+
*/
|
|
544
|
+
async execute(input) {
|
|
545
|
+
const member = await this.deps.memberRepository.findById(input.fromMemberId);
|
|
546
|
+
if (!member) {
|
|
547
|
+
throw new MemberNotFoundError(input.fromMemberId);
|
|
548
|
+
}
|
|
549
|
+
const targetTeamId = createTeamId(input.toTeamName);
|
|
550
|
+
const targetTeam = await this.deps.teamRepository.findById(targetTeamId);
|
|
551
|
+
if (!targetTeam) {
|
|
552
|
+
throw new TeamNotFoundError(input.toTeamName);
|
|
553
|
+
}
|
|
554
|
+
if (member.teamId === targetTeamId) {
|
|
555
|
+
throw new ValidationError("toTeamName", "Cannot ask question to your own team");
|
|
556
|
+
}
|
|
557
|
+
const content = MessageContent.create(input.content, input.format ?? "markdown");
|
|
558
|
+
const questionId = generateQuestionId();
|
|
559
|
+
const question = Question.create({
|
|
560
|
+
id: questionId,
|
|
561
|
+
fromMemberId: input.fromMemberId,
|
|
562
|
+
toTeamId: targetTeamId,
|
|
563
|
+
content,
|
|
564
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
565
|
+
});
|
|
566
|
+
await this.deps.questionRepository.save(question);
|
|
567
|
+
member.recordActivity();
|
|
568
|
+
await this.deps.memberRepository.save(member);
|
|
569
|
+
if (this.deps.onQuestionAsked) {
|
|
570
|
+
const event = new QuestionAskedEvent(
|
|
571
|
+
questionId,
|
|
572
|
+
input.fromMemberId,
|
|
573
|
+
targetTeamId,
|
|
574
|
+
content.preview
|
|
575
|
+
);
|
|
576
|
+
await this.deps.onQuestionAsked(event);
|
|
577
|
+
}
|
|
578
|
+
return {
|
|
579
|
+
questionId,
|
|
580
|
+
toTeamId: targetTeamId,
|
|
581
|
+
status: question.status,
|
|
582
|
+
createdAt: question.createdAt
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
// src/application/use-cases/get-inbox.use-case.ts
|
|
588
|
+
var GetInboxUseCase = class {
|
|
589
|
+
constructor(deps) {
|
|
590
|
+
this.deps = deps;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Executes the use case
|
|
594
|
+
*/
|
|
595
|
+
async execute(input) {
|
|
596
|
+
const member = await this.deps.memberRepository.findById(input.memberId);
|
|
597
|
+
if (!member) {
|
|
598
|
+
throw new MemberNotFoundError(input.memberId);
|
|
599
|
+
}
|
|
600
|
+
const team = await this.deps.teamRepository.findById(input.teamId);
|
|
601
|
+
if (!team) {
|
|
602
|
+
throw new TeamNotFoundError(input.teamId);
|
|
603
|
+
}
|
|
604
|
+
const allQuestions = await this.deps.questionRepository.findPendingByTeamId(input.teamId);
|
|
605
|
+
const questions = input.includeAnswered ? allQuestions : allQuestions.filter((q) => q.isPending);
|
|
606
|
+
const questionItems = [];
|
|
607
|
+
for (const question of questions) {
|
|
608
|
+
const fromMember = await this.deps.memberRepository.findById(question.fromMemberId);
|
|
609
|
+
const fromTeam = fromMember ? await this.deps.teamRepository.findById(fromMember.teamId) : null;
|
|
610
|
+
questionItems.push({
|
|
611
|
+
questionId: question.id,
|
|
612
|
+
fromMemberId: question.fromMemberId,
|
|
613
|
+
fromDisplayName: fromMember?.displayName ?? "Unknown",
|
|
614
|
+
fromTeamName: fromTeam?.name ?? "Unknown",
|
|
615
|
+
content: question.content.text,
|
|
616
|
+
format: question.content.format,
|
|
617
|
+
status: question.status,
|
|
618
|
+
createdAt: question.createdAt,
|
|
619
|
+
ageMs: question.ageMs
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
questionItems.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime());
|
|
623
|
+
const pendingCount = questionItems.filter((q) => q.status === "PENDING" /* PENDING */).length;
|
|
624
|
+
return {
|
|
625
|
+
teamId: team.id,
|
|
626
|
+
teamName: team.name,
|
|
627
|
+
questions: questionItems,
|
|
628
|
+
totalCount: questionItems.length,
|
|
629
|
+
pendingCount
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
};
|
|
633
|
+
|
|
634
|
+
// src/domain/entities/answer.entity.ts
|
|
635
|
+
var Answer = class _Answer {
|
|
636
|
+
_id;
|
|
637
|
+
_questionId;
|
|
638
|
+
_fromMemberId;
|
|
639
|
+
_content;
|
|
640
|
+
_createdAt;
|
|
641
|
+
constructor(props) {
|
|
642
|
+
this._id = props.id;
|
|
643
|
+
this._questionId = props.questionId;
|
|
644
|
+
this._fromMemberId = props.fromMemberId;
|
|
645
|
+
this._content = props.content;
|
|
646
|
+
this._createdAt = props.createdAt;
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* Creates a new Answer instance
|
|
650
|
+
*/
|
|
651
|
+
static create(props) {
|
|
652
|
+
return new _Answer(props);
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Reconstitutes an Answer from persistence
|
|
656
|
+
*/
|
|
657
|
+
static reconstitute(props) {
|
|
658
|
+
return new _Answer(props);
|
|
659
|
+
}
|
|
660
|
+
// Getters
|
|
661
|
+
get id() {
|
|
662
|
+
return this._id;
|
|
663
|
+
}
|
|
664
|
+
get questionId() {
|
|
665
|
+
return this._questionId;
|
|
666
|
+
}
|
|
667
|
+
get fromMemberId() {
|
|
668
|
+
return this._fromMemberId;
|
|
669
|
+
}
|
|
670
|
+
get content() {
|
|
671
|
+
return this._content;
|
|
672
|
+
}
|
|
673
|
+
get createdAt() {
|
|
674
|
+
return this._createdAt;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Converts entity to plain object for serialization
|
|
678
|
+
*/
|
|
679
|
+
toJSON() {
|
|
680
|
+
return {
|
|
681
|
+
id: this._id,
|
|
682
|
+
questionId: this._questionId,
|
|
683
|
+
fromMemberId: this._fromMemberId,
|
|
684
|
+
content: this._content,
|
|
685
|
+
createdAt: this._createdAt
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
};
|
|
689
|
+
|
|
690
|
+
// src/domain/events/question-answered.event.ts
|
|
691
|
+
var QuestionAnsweredEvent = class _QuestionAnsweredEvent extends BaseDomainEvent {
|
|
692
|
+
constructor(questionId, answerId, answeredByMemberId, contentPreview) {
|
|
693
|
+
super();
|
|
694
|
+
this.questionId = questionId;
|
|
695
|
+
this.answerId = answerId;
|
|
696
|
+
this.answeredByMemberId = answeredByMemberId;
|
|
697
|
+
this.contentPreview = contentPreview;
|
|
698
|
+
}
|
|
699
|
+
static EVENT_TYPE = "QUESTION_ANSWERED";
|
|
700
|
+
get eventType() {
|
|
701
|
+
return _QuestionAnsweredEvent.EVENT_TYPE;
|
|
702
|
+
}
|
|
703
|
+
get payload() {
|
|
704
|
+
return {
|
|
705
|
+
questionId: this.questionId,
|
|
706
|
+
answerId: this.answerId,
|
|
707
|
+
answeredByMemberId: this.answeredByMemberId,
|
|
708
|
+
contentPreview: this.contentPreview
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
// src/application/use-cases/reply-question.use-case.ts
|
|
714
|
+
var ReplyQuestionUseCase = class {
|
|
715
|
+
constructor(deps) {
|
|
716
|
+
this.deps = deps;
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Executes the use case
|
|
720
|
+
*/
|
|
721
|
+
async execute(input) {
|
|
722
|
+
const member = await this.deps.memberRepository.findById(input.fromMemberId);
|
|
723
|
+
if (!member) {
|
|
724
|
+
throw new MemberNotFoundError(input.fromMemberId);
|
|
725
|
+
}
|
|
726
|
+
const question = await this.deps.questionRepository.findById(input.questionId);
|
|
727
|
+
if (!question) {
|
|
728
|
+
throw new QuestionNotFoundError(input.questionId);
|
|
729
|
+
}
|
|
730
|
+
if (!question.canBeAnswered) {
|
|
731
|
+
throw new QuestionAlreadyAnsweredError(input.questionId);
|
|
732
|
+
}
|
|
733
|
+
const content = MessageContent.create(input.content, input.format ?? "markdown");
|
|
734
|
+
const answerId = generateAnswerId();
|
|
735
|
+
const answer = Answer.create({
|
|
736
|
+
id: answerId,
|
|
737
|
+
questionId: input.questionId,
|
|
738
|
+
fromMemberId: input.fromMemberId,
|
|
739
|
+
content,
|
|
740
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
741
|
+
});
|
|
742
|
+
question.markAsAnswered(input.fromMemberId);
|
|
743
|
+
await this.deps.answerRepository.save(answer);
|
|
744
|
+
await this.deps.questionRepository.save(question);
|
|
745
|
+
member.recordActivity();
|
|
746
|
+
await this.deps.memberRepository.save(member);
|
|
747
|
+
if (this.deps.onQuestionAnswered) {
|
|
748
|
+
const event = new QuestionAnsweredEvent(
|
|
749
|
+
input.questionId,
|
|
750
|
+
answerId,
|
|
751
|
+
input.fromMemberId,
|
|
752
|
+
content.preview
|
|
753
|
+
);
|
|
754
|
+
await this.deps.onQuestionAnswered(event);
|
|
755
|
+
}
|
|
756
|
+
return {
|
|
757
|
+
answerId,
|
|
758
|
+
questionId: input.questionId,
|
|
759
|
+
deliveredToMemberId: question.fromMemberId,
|
|
760
|
+
createdAt: answer.createdAt
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
|
|
765
|
+
// src/infrastructure/repositories/in-memory-member.repository.ts
|
|
766
|
+
var InMemoryMemberRepository = class {
|
|
767
|
+
members = /* @__PURE__ */ new Map();
|
|
768
|
+
async save(member) {
|
|
769
|
+
this.members.set(member.id, member);
|
|
770
|
+
}
|
|
771
|
+
async findById(id) {
|
|
772
|
+
return this.members.get(id) ?? null;
|
|
773
|
+
}
|
|
774
|
+
async findByTeamId(teamId) {
|
|
775
|
+
return [...this.members.values()].filter((m) => m.teamId === teamId);
|
|
776
|
+
}
|
|
777
|
+
async findOnlineByTeamId(teamId) {
|
|
778
|
+
return [...this.members.values()].filter((m) => m.teamId === teamId && m.isOnline);
|
|
779
|
+
}
|
|
780
|
+
async delete(id) {
|
|
781
|
+
return this.members.delete(id);
|
|
782
|
+
}
|
|
783
|
+
async exists(id) {
|
|
784
|
+
return this.members.has(id);
|
|
785
|
+
}
|
|
786
|
+
async findAll() {
|
|
787
|
+
return [...this.members.values()];
|
|
788
|
+
}
|
|
789
|
+
/**
|
|
790
|
+
* Clears all data (useful for testing)
|
|
791
|
+
*/
|
|
792
|
+
clear() {
|
|
793
|
+
this.members.clear();
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Gets the count of members
|
|
797
|
+
*/
|
|
798
|
+
get count() {
|
|
799
|
+
return this.members.size;
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// src/domain/entities/team.entity.ts
|
|
804
|
+
var Team = class _Team {
|
|
805
|
+
_id;
|
|
806
|
+
_name;
|
|
807
|
+
_createdAt;
|
|
808
|
+
_memberIds;
|
|
809
|
+
constructor(props) {
|
|
810
|
+
this._id = props.id;
|
|
811
|
+
this._name = props.name;
|
|
812
|
+
this._createdAt = props.createdAt;
|
|
813
|
+
this._memberIds = /* @__PURE__ */ new Set();
|
|
814
|
+
}
|
|
815
|
+
/**
|
|
816
|
+
* Creates a new Team instance
|
|
817
|
+
*/
|
|
818
|
+
static create(props) {
|
|
819
|
+
if (!props.name.trim()) {
|
|
820
|
+
throw new Error("Team name cannot be empty");
|
|
821
|
+
}
|
|
822
|
+
return new _Team(props);
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Reconstitutes a Team from persistence
|
|
826
|
+
*/
|
|
827
|
+
static reconstitute(props) {
|
|
828
|
+
const team = new _Team(props);
|
|
829
|
+
for (const memberId of props.memberIds) {
|
|
830
|
+
team._memberIds.add(memberId);
|
|
831
|
+
}
|
|
832
|
+
return team;
|
|
833
|
+
}
|
|
834
|
+
// Getters
|
|
835
|
+
get id() {
|
|
836
|
+
return this._id;
|
|
837
|
+
}
|
|
838
|
+
get name() {
|
|
839
|
+
return this._name;
|
|
840
|
+
}
|
|
841
|
+
get createdAt() {
|
|
842
|
+
return this._createdAt;
|
|
843
|
+
}
|
|
844
|
+
get memberIds() {
|
|
845
|
+
return this._memberIds;
|
|
846
|
+
}
|
|
847
|
+
get memberCount() {
|
|
848
|
+
return this._memberIds.size;
|
|
849
|
+
}
|
|
850
|
+
get isEmpty() {
|
|
851
|
+
return this._memberIds.size === 0;
|
|
852
|
+
}
|
|
853
|
+
// Behaviors
|
|
854
|
+
/**
|
|
855
|
+
* Adds a member to the team
|
|
856
|
+
* @returns true if the member was added, false if already present
|
|
857
|
+
*/
|
|
858
|
+
addMember(memberId) {
|
|
859
|
+
if (this._memberIds.has(memberId)) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
this._memberIds.add(memberId);
|
|
863
|
+
return true;
|
|
864
|
+
}
|
|
865
|
+
/**
|
|
866
|
+
* Removes a member from the team
|
|
867
|
+
* @returns true if the member was removed, false if not present
|
|
868
|
+
*/
|
|
869
|
+
removeMember(memberId) {
|
|
870
|
+
return this._memberIds.delete(memberId);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Checks if a member is in the team
|
|
874
|
+
*/
|
|
875
|
+
hasMember(memberId) {
|
|
876
|
+
return this._memberIds.has(memberId);
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Gets all member IDs except the specified one
|
|
880
|
+
* Useful for broadcasting to other team members
|
|
881
|
+
*/
|
|
882
|
+
getOtherMemberIds(excludeMemberId) {
|
|
883
|
+
return [...this._memberIds].filter((id) => id !== excludeMemberId);
|
|
884
|
+
}
|
|
885
|
+
/**
|
|
886
|
+
* Converts entity to plain object for serialization
|
|
887
|
+
*/
|
|
888
|
+
toJSON() {
|
|
889
|
+
return {
|
|
890
|
+
id: this._id,
|
|
891
|
+
name: this._name,
|
|
892
|
+
createdAt: this._createdAt,
|
|
893
|
+
memberIds: [...this._memberIds]
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
};
|
|
897
|
+
|
|
898
|
+
// src/infrastructure/repositories/in-memory-team.repository.ts
|
|
899
|
+
var InMemoryTeamRepository = class {
|
|
900
|
+
teams = /* @__PURE__ */ new Map();
|
|
901
|
+
async save(team) {
|
|
902
|
+
this.teams.set(team.id, team);
|
|
903
|
+
}
|
|
904
|
+
async findById(id) {
|
|
905
|
+
return this.teams.get(id) ?? null;
|
|
906
|
+
}
|
|
907
|
+
async findByName(name) {
|
|
908
|
+
const teamId = createTeamId(name);
|
|
909
|
+
return this.teams.get(teamId) ?? null;
|
|
910
|
+
}
|
|
911
|
+
async getOrCreate(name) {
|
|
912
|
+
const existing = await this.findByName(name);
|
|
913
|
+
if (existing) {
|
|
914
|
+
return existing;
|
|
915
|
+
}
|
|
916
|
+
const teamId = createTeamId(name);
|
|
917
|
+
const team = Team.create({
|
|
918
|
+
id: teamId,
|
|
919
|
+
name: name.trim(),
|
|
920
|
+
createdAt: /* @__PURE__ */ new Date()
|
|
921
|
+
});
|
|
922
|
+
await this.save(team);
|
|
923
|
+
return team;
|
|
924
|
+
}
|
|
925
|
+
async delete(id) {
|
|
926
|
+
return this.teams.delete(id);
|
|
927
|
+
}
|
|
928
|
+
async exists(id) {
|
|
929
|
+
return this.teams.has(id);
|
|
930
|
+
}
|
|
931
|
+
async findAll() {
|
|
932
|
+
return [...this.teams.values()];
|
|
933
|
+
}
|
|
934
|
+
async findNonEmpty() {
|
|
935
|
+
return [...this.teams.values()].filter((t) => !t.isEmpty);
|
|
936
|
+
}
|
|
937
|
+
/**
|
|
938
|
+
* Clears all data (useful for testing)
|
|
939
|
+
*/
|
|
940
|
+
clear() {
|
|
941
|
+
this.teams.clear();
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Gets the count of teams
|
|
945
|
+
*/
|
|
946
|
+
get count() {
|
|
947
|
+
return this.teams.size;
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
|
|
951
|
+
// src/infrastructure/repositories/in-memory-question.repository.ts
|
|
952
|
+
var InMemoryQuestionRepository = class {
|
|
953
|
+
questions = /* @__PURE__ */ new Map();
|
|
954
|
+
async save(question) {
|
|
955
|
+
this.questions.set(question.id, question);
|
|
956
|
+
}
|
|
957
|
+
async findById(id) {
|
|
958
|
+
return this.questions.get(id) ?? null;
|
|
959
|
+
}
|
|
960
|
+
async findPendingByTeamId(teamId) {
|
|
961
|
+
return [...this.questions.values()].filter((q) => q.toTeamId === teamId && q.isPending);
|
|
962
|
+
}
|
|
963
|
+
async findByFromMemberId(memberId) {
|
|
964
|
+
return [...this.questions.values()].filter((q) => q.fromMemberId === memberId);
|
|
965
|
+
}
|
|
966
|
+
async findPendingByFromMemberId(memberId) {
|
|
967
|
+
return [...this.questions.values()].filter(
|
|
968
|
+
(q) => q.fromMemberId === memberId && q.isPending
|
|
969
|
+
);
|
|
970
|
+
}
|
|
971
|
+
async delete(id) {
|
|
972
|
+
return this.questions.delete(id);
|
|
973
|
+
}
|
|
974
|
+
async exists(id) {
|
|
975
|
+
return this.questions.has(id);
|
|
976
|
+
}
|
|
977
|
+
async findAll() {
|
|
978
|
+
return [...this.questions.values()];
|
|
979
|
+
}
|
|
980
|
+
async markTimedOut(olderThanMs) {
|
|
981
|
+
let count = 0;
|
|
982
|
+
const now = Date.now();
|
|
983
|
+
for (const question of this.questions.values()) {
|
|
984
|
+
if (question.isPending && now - question.createdAt.getTime() > olderThanMs) {
|
|
985
|
+
question.markAsTimedOut();
|
|
986
|
+
count++;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
return count;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Clears all data (useful for testing)
|
|
993
|
+
*/
|
|
994
|
+
clear() {
|
|
995
|
+
this.questions.clear();
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Gets the count of questions
|
|
999
|
+
*/
|
|
1000
|
+
get count() {
|
|
1001
|
+
return this.questions.size;
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
|
|
1005
|
+
// src/infrastructure/repositories/in-memory-answer.repository.ts
|
|
1006
|
+
var InMemoryAnswerRepository = class {
|
|
1007
|
+
answers = /* @__PURE__ */ new Map();
|
|
1008
|
+
async save(answer) {
|
|
1009
|
+
this.answers.set(answer.id, answer);
|
|
1010
|
+
}
|
|
1011
|
+
async findById(id) {
|
|
1012
|
+
return this.answers.get(id) ?? null;
|
|
1013
|
+
}
|
|
1014
|
+
async findByQuestionId(questionId) {
|
|
1015
|
+
for (const answer of this.answers.values()) {
|
|
1016
|
+
if (answer.questionId === questionId) {
|
|
1017
|
+
return answer;
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
return null;
|
|
1021
|
+
}
|
|
1022
|
+
async findAll() {
|
|
1023
|
+
return [...this.answers.values()];
|
|
1024
|
+
}
|
|
1025
|
+
/**
|
|
1026
|
+
* Clears all data (useful for testing)
|
|
1027
|
+
*/
|
|
1028
|
+
clear() {
|
|
1029
|
+
this.answers.clear();
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* Gets the count of answers
|
|
1033
|
+
*/
|
|
1034
|
+
get count() {
|
|
1035
|
+
return this.answers.size;
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
// src/infrastructure/websocket/message-protocol.ts
|
|
1040
|
+
function serializeMessage(message) {
|
|
1041
|
+
return JSON.stringify(message);
|
|
1042
|
+
}
|
|
1043
|
+
function parseClientMessage(data) {
|
|
1044
|
+
const parsed = JSON.parse(data);
|
|
1045
|
+
validateClientMessage(parsed);
|
|
1046
|
+
return parsed;
|
|
1047
|
+
}
|
|
1048
|
+
function validateClientMessage(message) {
|
|
1049
|
+
if (!message.type) {
|
|
1050
|
+
throw new Error("Message must have a type");
|
|
1051
|
+
}
|
|
1052
|
+
const validTypes = ["JOIN", "LEAVE", "ASK", "REPLY", "PING", "GET_INBOX"];
|
|
1053
|
+
if (!validTypes.includes(message.type)) {
|
|
1054
|
+
throw new Error(`Invalid message type: ${message.type}`);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
function createErrorMessage(code, message, requestId) {
|
|
1058
|
+
return {
|
|
1059
|
+
type: "ERROR",
|
|
1060
|
+
code,
|
|
1061
|
+
message,
|
|
1062
|
+
requestId
|
|
1063
|
+
};
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
// src/infrastructure/websocket/hub-server.ts
|
|
1067
|
+
var HubServer = class {
|
|
1068
|
+
constructor(options = {}) {
|
|
1069
|
+
this.options = options;
|
|
1070
|
+
this.initializeUseCases();
|
|
1071
|
+
}
|
|
1072
|
+
wss = null;
|
|
1073
|
+
clients = /* @__PURE__ */ new Map();
|
|
1074
|
+
memberToWs = /* @__PURE__ */ new Map();
|
|
1075
|
+
// Repositories
|
|
1076
|
+
memberRepository = new InMemoryMemberRepository();
|
|
1077
|
+
teamRepository = new InMemoryTeamRepository();
|
|
1078
|
+
questionRepository = new InMemoryQuestionRepository();
|
|
1079
|
+
answerRepository = new InMemoryAnswerRepository();
|
|
1080
|
+
// Use cases
|
|
1081
|
+
joinTeamUseCase;
|
|
1082
|
+
askQuestionUseCase;
|
|
1083
|
+
getInboxUseCase;
|
|
1084
|
+
replyQuestionUseCase;
|
|
1085
|
+
heartbeatInterval = null;
|
|
1086
|
+
timeoutCheckInterval = null;
|
|
1087
|
+
initializeUseCases() {
|
|
1088
|
+
this.joinTeamUseCase = new JoinTeamUseCase({
|
|
1089
|
+
memberRepository: this.memberRepository,
|
|
1090
|
+
teamRepository: this.teamRepository,
|
|
1091
|
+
onMemberJoined: async (event) => {
|
|
1092
|
+
await this.broadcastToTeam(event.teamId, event.memberId, {
|
|
1093
|
+
type: "MEMBER_JOINED",
|
|
1094
|
+
member: await this.getMemberInfo(event.memberId)
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
this.askQuestionUseCase = new AskQuestionUseCase({
|
|
1099
|
+
memberRepository: this.memberRepository,
|
|
1100
|
+
teamRepository: this.teamRepository,
|
|
1101
|
+
questionRepository: this.questionRepository,
|
|
1102
|
+
onQuestionAsked: async (event) => {
|
|
1103
|
+
const question = await this.questionRepository.findById(event.questionId);
|
|
1104
|
+
if (question) {
|
|
1105
|
+
await this.deliverQuestion(question);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
});
|
|
1109
|
+
this.getInboxUseCase = new GetInboxUseCase({
|
|
1110
|
+
memberRepository: this.memberRepository,
|
|
1111
|
+
teamRepository: this.teamRepository,
|
|
1112
|
+
questionRepository: this.questionRepository
|
|
1113
|
+
});
|
|
1114
|
+
this.replyQuestionUseCase = new ReplyQuestionUseCase({
|
|
1115
|
+
memberRepository: this.memberRepository,
|
|
1116
|
+
questionRepository: this.questionRepository,
|
|
1117
|
+
answerRepository: this.answerRepository,
|
|
1118
|
+
onQuestionAnswered: async (event) => {
|
|
1119
|
+
const question = await this.questionRepository.findById(event.questionId);
|
|
1120
|
+
const answer = await this.answerRepository.findByQuestionId(event.questionId);
|
|
1121
|
+
if (question && answer) {
|
|
1122
|
+
await this.deliverAnswer(question, answer, event.answeredByMemberId);
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Starts the hub server
|
|
1129
|
+
*/
|
|
1130
|
+
async start() {
|
|
1131
|
+
const port = this.options.port ?? config.hub.port;
|
|
1132
|
+
const host = this.options.host ?? config.hub.host;
|
|
1133
|
+
return new Promise((resolve, reject) => {
|
|
1134
|
+
try {
|
|
1135
|
+
this.wss = new WebSocketServer({ port, host });
|
|
1136
|
+
this.wss.on("connection", (ws) => {
|
|
1137
|
+
this.handleConnection(ws);
|
|
1138
|
+
});
|
|
1139
|
+
this.wss.on("error", (error) => {
|
|
1140
|
+
console.error("Hub server error:", error);
|
|
1141
|
+
reject(error);
|
|
1142
|
+
});
|
|
1143
|
+
this.wss.on("listening", () => {
|
|
1144
|
+
console.log(`Hub server listening on ${host}:${port}`);
|
|
1145
|
+
this.startHeartbeat();
|
|
1146
|
+
this.startTimeoutCheck();
|
|
1147
|
+
resolve();
|
|
1148
|
+
});
|
|
1149
|
+
} catch (error) {
|
|
1150
|
+
reject(error);
|
|
1151
|
+
}
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Stops the hub server
|
|
1156
|
+
*/
|
|
1157
|
+
async stop() {
|
|
1158
|
+
if (this.heartbeatInterval) {
|
|
1159
|
+
clearInterval(this.heartbeatInterval);
|
|
1160
|
+
this.heartbeatInterval = null;
|
|
1161
|
+
}
|
|
1162
|
+
if (this.timeoutCheckInterval) {
|
|
1163
|
+
clearInterval(this.timeoutCheckInterval);
|
|
1164
|
+
this.timeoutCheckInterval = null;
|
|
1165
|
+
}
|
|
1166
|
+
return new Promise((resolve) => {
|
|
1167
|
+
if (this.wss) {
|
|
1168
|
+
for (const [ws] of this.clients) {
|
|
1169
|
+
ws.close();
|
|
1170
|
+
}
|
|
1171
|
+
this.clients.clear();
|
|
1172
|
+
this.memberToWs.clear();
|
|
1173
|
+
this.wss.close(() => {
|
|
1174
|
+
this.wss = null;
|
|
1175
|
+
console.log("Hub server stopped");
|
|
1176
|
+
resolve();
|
|
1177
|
+
});
|
|
1178
|
+
} else {
|
|
1179
|
+
resolve();
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
}
|
|
1183
|
+
handleConnection(ws) {
|
|
1184
|
+
const connection = {
|
|
1185
|
+
ws,
|
|
1186
|
+
lastPing: /* @__PURE__ */ new Date()
|
|
1187
|
+
};
|
|
1188
|
+
this.clients.set(ws, connection);
|
|
1189
|
+
ws.on("message", async (data) => {
|
|
1190
|
+
await this.handleMessage(ws, data.toString());
|
|
1191
|
+
});
|
|
1192
|
+
ws.on("close", async () => {
|
|
1193
|
+
await this.handleDisconnect(ws);
|
|
1194
|
+
});
|
|
1195
|
+
ws.on("error", (error) => {
|
|
1196
|
+
console.error("Client connection error:", error);
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
async handleMessage(ws, data) {
|
|
1200
|
+
const connection = this.clients.get(ws);
|
|
1201
|
+
if (!connection) return;
|
|
1202
|
+
try {
|
|
1203
|
+
const message = parseClientMessage(data);
|
|
1204
|
+
connection.lastPing = /* @__PURE__ */ new Date();
|
|
1205
|
+
switch (message.type) {
|
|
1206
|
+
case "JOIN":
|
|
1207
|
+
await this.handleJoin(ws, connection, message.teamName, message.displayName);
|
|
1208
|
+
break;
|
|
1209
|
+
case "LEAVE":
|
|
1210
|
+
await this.handleLeave(ws, connection);
|
|
1211
|
+
break;
|
|
1212
|
+
case "ASK":
|
|
1213
|
+
await this.handleAsk(ws, connection, message);
|
|
1214
|
+
break;
|
|
1215
|
+
case "REPLY":
|
|
1216
|
+
await this.handleReply(ws, connection, message);
|
|
1217
|
+
break;
|
|
1218
|
+
case "GET_INBOX":
|
|
1219
|
+
await this.handleGetInbox(ws, connection, message.requestId);
|
|
1220
|
+
break;
|
|
1221
|
+
case "PING":
|
|
1222
|
+
this.send(ws, { type: "PONG", timestamp: (/* @__PURE__ */ new Date()).toISOString() });
|
|
1223
|
+
break;
|
|
1224
|
+
}
|
|
1225
|
+
} catch (error) {
|
|
1226
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
1227
|
+
this.send(ws, createErrorMessage("INVALID_MESSAGE", errorMessage));
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
async handleJoin(ws, connection, teamName, displayName) {
|
|
1231
|
+
try {
|
|
1232
|
+
const result = await this.joinTeamUseCase.execute({ teamName, displayName });
|
|
1233
|
+
connection.memberId = result.memberId;
|
|
1234
|
+
connection.teamId = result.teamId;
|
|
1235
|
+
this.memberToWs.set(result.memberId, ws);
|
|
1236
|
+
const memberInfo = await this.getMemberInfo(result.memberId);
|
|
1237
|
+
this.send(ws, {
|
|
1238
|
+
type: "JOINED",
|
|
1239
|
+
member: memberInfo,
|
|
1240
|
+
memberCount: result.memberCount
|
|
1241
|
+
});
|
|
1242
|
+
} catch (error) {
|
|
1243
|
+
const errorMessage = error instanceof Error ? error.message : "Join failed";
|
|
1244
|
+
this.send(ws, createErrorMessage("JOIN_FAILED", errorMessage));
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
async handleLeave(ws, connection) {
|
|
1248
|
+
if (connection.memberId && connection.teamId) {
|
|
1249
|
+
await this.removeMember(connection.memberId, connection.teamId);
|
|
1250
|
+
connection.memberId = void 0;
|
|
1251
|
+
connection.teamId = void 0;
|
|
1252
|
+
}
|
|
1253
|
+
this.send(ws, { type: "LEFT", memberId: connection.memberId });
|
|
1254
|
+
}
|
|
1255
|
+
async handleAsk(ws, connection, message) {
|
|
1256
|
+
if (!connection.memberId) {
|
|
1257
|
+
this.send(ws, createErrorMessage("NOT_JOINED", "Must join a team first", message.requestId));
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
try {
|
|
1261
|
+
const result = await this.askQuestionUseCase.execute({
|
|
1262
|
+
fromMemberId: connection.memberId,
|
|
1263
|
+
toTeamName: message.toTeam,
|
|
1264
|
+
content: message.content,
|
|
1265
|
+
format: message.format
|
|
1266
|
+
});
|
|
1267
|
+
this.send(ws, {
|
|
1268
|
+
type: "QUESTION_SENT",
|
|
1269
|
+
questionId: result.questionId,
|
|
1270
|
+
toTeamId: result.toTeamId,
|
|
1271
|
+
status: result.status,
|
|
1272
|
+
requestId: message.requestId
|
|
1273
|
+
});
|
|
1274
|
+
} catch (error) {
|
|
1275
|
+
const errorMessage = error instanceof Error ? error.message : "Ask failed";
|
|
1276
|
+
this.send(ws, createErrorMessage("ASK_FAILED", errorMessage, message.requestId));
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
async handleReply(ws, connection, message) {
|
|
1280
|
+
if (!connection.memberId) {
|
|
1281
|
+
this.send(ws, createErrorMessage("NOT_JOINED", "Must join a team first"));
|
|
1282
|
+
return;
|
|
1283
|
+
}
|
|
1284
|
+
try {
|
|
1285
|
+
await this.replyQuestionUseCase.execute({
|
|
1286
|
+
fromMemberId: connection.memberId,
|
|
1287
|
+
questionId: message.questionId,
|
|
1288
|
+
content: message.content,
|
|
1289
|
+
format: message.format
|
|
1290
|
+
});
|
|
1291
|
+
} catch (error) {
|
|
1292
|
+
const errorMessage = error instanceof Error ? error.message : "Reply failed";
|
|
1293
|
+
this.send(ws, createErrorMessage("REPLY_FAILED", errorMessage));
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
async handleGetInbox(ws, connection, requestId) {
|
|
1297
|
+
if (!connection.memberId || !connection.teamId) {
|
|
1298
|
+
this.send(ws, createErrorMessage("NOT_JOINED", "Must join a team first", requestId));
|
|
1299
|
+
return;
|
|
1300
|
+
}
|
|
1301
|
+
try {
|
|
1302
|
+
const result = await this.getInboxUseCase.execute({
|
|
1303
|
+
memberId: connection.memberId,
|
|
1304
|
+
teamId: connection.teamId
|
|
1305
|
+
});
|
|
1306
|
+
const questions = await Promise.all(
|
|
1307
|
+
result.questions.map(async (q) => ({
|
|
1308
|
+
questionId: q.questionId,
|
|
1309
|
+
from: await this.getMemberInfo(q.fromMemberId),
|
|
1310
|
+
content: q.content,
|
|
1311
|
+
format: q.format,
|
|
1312
|
+
status: q.status,
|
|
1313
|
+
createdAt: q.createdAt.toISOString(),
|
|
1314
|
+
ageMs: q.ageMs
|
|
1315
|
+
}))
|
|
1316
|
+
);
|
|
1317
|
+
this.send(ws, {
|
|
1318
|
+
type: "INBOX",
|
|
1319
|
+
questions,
|
|
1320
|
+
totalCount: result.totalCount,
|
|
1321
|
+
pendingCount: result.pendingCount,
|
|
1322
|
+
requestId
|
|
1323
|
+
});
|
|
1324
|
+
} catch (error) {
|
|
1325
|
+
const errorMessage = error instanceof Error ? error.message : "Get inbox failed";
|
|
1326
|
+
this.send(ws, createErrorMessage("INBOX_FAILED", errorMessage, requestId));
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
async handleDisconnect(ws) {
|
|
1330
|
+
const connection = this.clients.get(ws);
|
|
1331
|
+
if (connection?.memberId && connection.teamId) {
|
|
1332
|
+
await this.removeMember(connection.memberId, connection.teamId);
|
|
1333
|
+
this.memberToWs.delete(connection.memberId);
|
|
1334
|
+
}
|
|
1335
|
+
this.clients.delete(ws);
|
|
1336
|
+
}
|
|
1337
|
+
async removeMember(memberId, teamId) {
|
|
1338
|
+
const member = await this.memberRepository.findById(memberId);
|
|
1339
|
+
if (member) {
|
|
1340
|
+
member.goOffline();
|
|
1341
|
+
await this.memberRepository.save(member);
|
|
1342
|
+
}
|
|
1343
|
+
const team = await this.teamRepository.findById(teamId);
|
|
1344
|
+
if (team) {
|
|
1345
|
+
team.removeMember(memberId);
|
|
1346
|
+
await this.teamRepository.save(team);
|
|
1347
|
+
await this.broadcastToTeam(teamId, memberId, {
|
|
1348
|
+
type: "MEMBER_LEFT",
|
|
1349
|
+
memberId,
|
|
1350
|
+
teamId
|
|
1351
|
+
});
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
async deliverQuestion(question) {
|
|
1355
|
+
const team = await this.teamRepository.findById(question.toTeamId);
|
|
1356
|
+
if (!team) return;
|
|
1357
|
+
const fromMember = await this.memberRepository.findById(question.fromMemberId);
|
|
1358
|
+
if (!fromMember) return;
|
|
1359
|
+
const memberInfo = await this.getMemberInfo(question.fromMemberId);
|
|
1360
|
+
for (const memberId of team.memberIds) {
|
|
1361
|
+
const ws = this.memberToWs.get(memberId);
|
|
1362
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
1363
|
+
this.send(ws, {
|
|
1364
|
+
type: "QUESTION",
|
|
1365
|
+
questionId: question.id,
|
|
1366
|
+
from: memberInfo,
|
|
1367
|
+
content: question.content.text,
|
|
1368
|
+
format: question.content.format,
|
|
1369
|
+
createdAt: question.createdAt.toISOString()
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
async deliverAnswer(question, answer, answeredByMemberId) {
|
|
1375
|
+
const ws = this.memberToWs.get(question.fromMemberId);
|
|
1376
|
+
if (!ws || ws.readyState !== WebSocket.OPEN) return;
|
|
1377
|
+
const memberInfo = await this.getMemberInfo(answeredByMemberId);
|
|
1378
|
+
this.send(ws, {
|
|
1379
|
+
type: "ANSWER",
|
|
1380
|
+
questionId: question.id,
|
|
1381
|
+
from: memberInfo,
|
|
1382
|
+
content: answer.content.text,
|
|
1383
|
+
format: answer.content.format,
|
|
1384
|
+
answeredAt: answer.createdAt.toISOString()
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
async broadcastToTeam(teamId, excludeMemberId, message) {
|
|
1388
|
+
const team = await this.teamRepository.findById(teamId);
|
|
1389
|
+
if (!team) return;
|
|
1390
|
+
for (const memberId of team.getOtherMemberIds(excludeMemberId)) {
|
|
1391
|
+
const ws = this.memberToWs.get(memberId);
|
|
1392
|
+
if (ws && ws.readyState === WebSocket.OPEN) {
|
|
1393
|
+
this.send(ws, message);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
async getMemberInfo(memberId) {
|
|
1398
|
+
const member = await this.memberRepository.findById(memberId);
|
|
1399
|
+
const team = member ? await this.teamRepository.findById(member.teamId) : null;
|
|
1400
|
+
return {
|
|
1401
|
+
memberId,
|
|
1402
|
+
teamId: member?.teamId ?? "",
|
|
1403
|
+
teamName: team?.name ?? "Unknown",
|
|
1404
|
+
displayName: member?.displayName ?? "Unknown",
|
|
1405
|
+
status: member?.status ?? "OFFLINE" /* OFFLINE */
|
|
1406
|
+
};
|
|
1407
|
+
}
|
|
1408
|
+
send(ws, message) {
|
|
1409
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
1410
|
+
ws.send(serializeMessage(message));
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
startHeartbeat() {
|
|
1414
|
+
this.heartbeatInterval = setInterval(() => {
|
|
1415
|
+
const now = /* @__PURE__ */ new Date();
|
|
1416
|
+
for (const [ws, connection] of this.clients) {
|
|
1417
|
+
const timeSinceLastPing = now.getTime() - connection.lastPing.getTime();
|
|
1418
|
+
if (timeSinceLastPing > config.hub.clientTimeout) {
|
|
1419
|
+
ws.terminate();
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
}, config.hub.heartbeatInterval);
|
|
1423
|
+
}
|
|
1424
|
+
startTimeoutCheck() {
|
|
1425
|
+
this.timeoutCheckInterval = setInterval(async () => {
|
|
1426
|
+
await this.questionRepository.markTimedOut(config.communication.defaultTimeout);
|
|
1427
|
+
}, 5e3);
|
|
1428
|
+
}
|
|
1429
|
+
/**
|
|
1430
|
+
* Gets the number of connected clients
|
|
1431
|
+
*/
|
|
1432
|
+
get clientCount() {
|
|
1433
|
+
return this.clients.size;
|
|
1434
|
+
}
|
|
1435
|
+
/**
|
|
1436
|
+
* Checks if the server is running
|
|
1437
|
+
*/
|
|
1438
|
+
get isRunning() {
|
|
1439
|
+
return this.wss !== null;
|
|
1440
|
+
}
|
|
1441
|
+
};
|
|
1442
|
+
|
|
1443
|
+
// src/hub-main.ts
|
|
1444
|
+
var args = process.argv.slice(2);
|
|
1445
|
+
function parseArgs() {
|
|
1446
|
+
let host = config.hub.host;
|
|
1447
|
+
let port = config.hub.port;
|
|
1448
|
+
for (let i = 0; i < args.length; i++) {
|
|
1449
|
+
const arg = args[i];
|
|
1450
|
+
const nextArg = args[i + 1];
|
|
1451
|
+
if (arg === "--host" && nextArg) {
|
|
1452
|
+
host = nextArg;
|
|
1453
|
+
i++;
|
|
1454
|
+
} else if (arg === "--port" && nextArg) {
|
|
1455
|
+
port = parseInt(nextArg, 10);
|
|
1456
|
+
i++;
|
|
1457
|
+
} else if (arg === "-h" || arg === "--help") {
|
|
1458
|
+
console.log(`
|
|
1459
|
+
Claude Collab Hub Server
|
|
1460
|
+
|
|
1461
|
+
Usage:
|
|
1462
|
+
hub-main [options]
|
|
1463
|
+
|
|
1464
|
+
Options:
|
|
1465
|
+
--host <host> Host to bind to (default: ${config.hub.host})
|
|
1466
|
+
--port <port> Port to listen on (default: ${config.hub.port})
|
|
1467
|
+
-h, --help Show this help message
|
|
1468
|
+
`);
|
|
1469
|
+
process.exit(0);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
return { host, port };
|
|
1473
|
+
}
|
|
1474
|
+
async function main() {
|
|
1475
|
+
const { host, port } = parseArgs();
|
|
1476
|
+
const server = new HubServer({ host, port });
|
|
1477
|
+
const shutdown = async () => {
|
|
1478
|
+
console.log("\nShutting down hub server...");
|
|
1479
|
+
await server.stop();
|
|
1480
|
+
process.exit(0);
|
|
1481
|
+
};
|
|
1482
|
+
process.on("SIGINT", shutdown);
|
|
1483
|
+
process.on("SIGTERM", shutdown);
|
|
1484
|
+
try {
|
|
1485
|
+
await server.start();
|
|
1486
|
+
console.log(`Claude Collab Hub Server running on ${host}:${port}`);
|
|
1487
|
+
} catch (error) {
|
|
1488
|
+
console.error("Failed to start hub server:", error);
|
|
1489
|
+
process.exit(1);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
main().catch((error) => {
|
|
1493
|
+
console.error("Unexpected error:", error);
|
|
1494
|
+
process.exit(1);
|
|
1495
|
+
});
|
|
1496
|
+
//# sourceMappingURL=hub-main.js.map
|
|
1497
|
+
//# sourceMappingURL=hub-main.js.map
|