stoops 0.2.0 → 0.2.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/cli/index.js CHANGED
@@ -4,22 +4,22 @@ import {
4
4
  Room,
5
5
  randomName,
6
6
  randomRoomName
7
- } from "../chunk-LC5WPWR2.js";
7
+ } from "../chunk-HKFCJO7V.js";
8
8
  import {
9
9
  EventProcessor,
10
10
  RemoteRoomDataSource,
11
11
  SseMultiplexer
12
- } from "../chunk-SS5NGUJM.js";
12
+ } from "../chunk-OA3CODNP.js";
13
13
  import "../chunk-5ADJGMXQ.js";
14
14
  import {
15
15
  buildCatchUpLines,
16
16
  contentPartsToString,
17
17
  createRuntimeMcpServer,
18
18
  formatTimestamp
19
- } from "../chunk-BLGV3QN4.js";
19
+ } from "../chunk-66EFQ2XO.js";
20
20
  import {
21
21
  createEvent
22
- } from "../chunk-HQS7HBZR.js";
22
+ } from "../chunk-EPLQQF6S.js";
23
23
 
24
24
  // src/cli/serve.ts
25
25
  import { createServer } from "http";
@@ -375,15 +375,17 @@ async function serve(options) {
375
375
  target.authority = newAuthority;
376
376
  tokens.updateSessionAuthority(targetSession, newAuthority);
377
377
  room.setParticipantAuthority(targetId, newAuthority);
378
- const p = participants.get(sessionToken);
379
- if (p) {
380
- await p.channel.emit(createEvent({
381
- type: "Activity",
382
- category: "ACTIVITY",
378
+ const adminP = participants.get(sessionToken);
379
+ const targetParticipant = room.listParticipants().find((p) => p.id === targetId);
380
+ if (adminP && targetParticipant) {
381
+ await adminP.channel.emit(createEvent({
382
+ type: "AuthorityChanged",
383
+ category: "PRESENCE",
383
384
  room_id: room.roomId,
384
385
  participant_id: targetId,
385
- action: "authority_changed",
386
- detail: { authority: newAuthority }
386
+ participant: targetParticipant,
387
+ new_authority: newAuthority,
388
+ changed_by: adminP.name
387
389
  }));
388
390
  }
389
391
  log(`${target.name} authority \u2192 ${newAuthority}`);
@@ -399,7 +401,19 @@ async function serve(options) {
399
401
  if (targetSession) {
400
402
  const target = participants.get(targetSession) ?? observers.get(targetSession);
401
403
  if (target) {
402
- await target.channel.disconnect();
404
+ const adminP = participants.get(sessionToken);
405
+ const targetParticipant = room.listParticipants().find((p) => p.id === targetId);
406
+ if (adminP && targetParticipant) {
407
+ await adminP.channel.emit(createEvent({
408
+ type: "ParticipantKicked",
409
+ category: "PRESENCE",
410
+ room_id: room.roomId,
411
+ participant_id: targetId,
412
+ participant: targetParticipant,
413
+ kicked_by: adminP.name
414
+ }));
415
+ }
416
+ await target.channel.disconnect(true);
403
417
  participants.delete(targetSession);
404
418
  observers.delete(targetSession);
405
419
  idToSession.delete(targetId);
@@ -1525,6 +1539,23 @@ function toDisplayEvent(event, selfId, participantTypes) {
1525
1539
  name: event.participant.name,
1526
1540
  participantType: event.participant.type
1527
1541
  };
1542
+ case "ParticipantKicked":
1543
+ return {
1544
+ id: randomUUID2(),
1545
+ ts,
1546
+ kind: "system",
1547
+ content: `${event.participant.name} was kicked`
1548
+ };
1549
+ case "AuthorityChanged": {
1550
+ const name = event.participant.name;
1551
+ if (event.new_authority === "observer") {
1552
+ return { id: randomUUID2(), ts, kind: "system", content: `${name} was muted` };
1553
+ }
1554
+ if (event.new_authority === "participant") {
1555
+ return { id: randomUUID2(), ts, kind: "system", content: `${name} was unmuted` };
1556
+ }
1557
+ return { id: randomUUID2(), ts, kind: "system", content: `${name} \u2192 ${event.new_authority}` };
1558
+ }
1528
1559
  case "Activity":
1529
1560
  if (event.action === "mode_changed") {
1530
1561
  return {
@@ -1534,15 +1565,6 @@ function toDisplayEvent(event, selfId, participantTypes) {
1534
1565
  mode: String(event.detail?.mode ?? "")
1535
1566
  };
1536
1567
  }
1537
- if (event.action === "authority_changed") {
1538
- const newAuth = String(event.detail?.authority ?? "");
1539
- return {
1540
- id: randomUUID2(),
1541
- ts,
1542
- kind: "system",
1543
- content: `authority \u2192 ${newAuth}`
1544
- };
1545
- }
1546
1568
  return null;
1547
1569
  default:
1548
1570
  return null;