@clawos-dev/clawd 0.2.11-beta.8.3707c2b → 0.2.12-beta.9.1f3b33f

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +30 -0
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -16475,11 +16475,22 @@ var LocalWsServer = class {
16475
16475
  this.frameHandler = handler;
16476
16476
  }
16477
16477
  broadcastToSession(sessionId, frame) {
16478
+ let delivered = 0;
16478
16479
  for (const c of this.clients.values()) {
16479
16480
  if (c.handle.subscribedSessions.has(sessionId)) {
16480
16481
  this.safeSend(c.ws, frame);
16482
+ delivered++;
16481
16483
  }
16482
16484
  }
16485
+ const f = frame;
16486
+ this.logger?.info("[bcast]", {
16487
+ sid: sessionId,
16488
+ type: f.type,
16489
+ kind: f.event?.kind,
16490
+ seq: f.event?.seq,
16491
+ delivered,
16492
+ totalClients: this.clients.size
16493
+ });
16483
16494
  }
16484
16495
  /** 测试 / 内部探针:返回某 client 对某 session 的当前 refCount(0 表示未订阅) */
16485
16496
  getSubscriptionRefCount(clientId, sessionId) {
@@ -16597,6 +16608,11 @@ var LocalWsServer = class {
16597
16608
  }
16598
16609
  if (frame.type === "session:subscribe" && typeof frame.sessionId === "string") {
16599
16610
  addSubscription(client, frame.sessionId);
16611
+ this.logger?.info("[sub]", {
16612
+ clientId: client.id,
16613
+ sid: frame.sessionId,
16614
+ refCount: client.subscribedSessions.get(frame.sessionId) ?? 0
16615
+ });
16600
16616
  if (typeof frame.requestId === "string") {
16601
16617
  this.safeSend(this.clients.get(client.id).ws, { type: "subscribed", requestId: frame.requestId, sessionId: frame.sessionId });
16602
16618
  }
@@ -16604,6 +16620,11 @@ var LocalWsServer = class {
16604
16620
  }
16605
16621
  if (frame.type === "session:unsubscribe" && typeof frame.sessionId === "string") {
16606
16622
  removeSubscription(client, frame.sessionId);
16623
+ this.logger?.info("[unsub]", {
16624
+ clientId: client.id,
16625
+ sid: frame.sessionId,
16626
+ refCount: client.subscribedSessions.get(frame.sessionId) ?? 0
16627
+ });
16607
16628
  if (typeof frame.requestId === "string") {
16608
16629
  this.safeSend(this.clients.get(client.id).ws, { type: "unsubscribed", requestId: frame.requestId, sessionId: frame.sessionId });
16609
16630
  }
@@ -18035,8 +18056,17 @@ async function startDaemon(config) {
18035
18056
  broadcastFrame: (frame, target) => {
18036
18057
  const sid = frame.sessionId;
18037
18058
  if (!sid) return;
18059
+ const f = frame;
18060
+ logger.info("[push]", {
18061
+ sid,
18062
+ type: f.type,
18063
+ kind: f.event?.kind,
18064
+ seq: f.event?.seq,
18065
+ target: target ?? "broadcast"
18066
+ });
18038
18067
  if (target === "first-subscriber") {
18039
18068
  const handle = transport?.firstSubscriber(sid);
18069
+ logger.info("[push.fs]", { sid, type: f.type, hit: !!handle });
18040
18070
  if (handle) handle.send(frame);
18041
18071
  return;
18042
18072
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.11-beta.8.3707c2b",
3
+ "version": "0.2.12-beta.9.1f3b33f",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",