adp-openclaw 0.0.18 → 0.0.20

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/package.json +1 -1
  2. package/src/monitor.ts +14 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adp-openclaw",
3
- "version": "0.0.18",
3
+ "version": "0.0.20",
4
4
  "description": "ADP-OpenClaw demo channel plugin (Go WebSocket backend)",
5
5
  "type": "module",
6
6
  "dependencies": {
package/src/monitor.ts CHANGED
@@ -239,7 +239,15 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
239
239
  // This ensures session history is correctly associated
240
240
  const peerId = inMsg.conversationId;
241
241
  const route = runtime.channel.routing.resolveAgentRoute({
242
- cfg: cfg ?? {},
242
+ cfg: {
243
+ ...(cfg ?? {}),
244
+ session: {
245
+ ...(cfg?.session ?? {}),
246
+ // Override dmScope to "per-peer" so each user gets their own session
247
+ // This prevents all DM users from sharing the same "main" session
248
+ dmScope: "per-peer",
249
+ },
250
+ },
243
251
  channel: "adp-openclaw",
244
252
  accountId: "default",
245
253
  peer: {
@@ -379,28 +387,11 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
379
387
  // Debug log for all deliver calls - log the actual info object
380
388
  log?.info(`[adp-openclaw] deliver called: kind=${kind}, text.length=${text.length}, info=${JSON.stringify(info)}`);
381
389
 
382
- // Handle streaming block - send chunk via WebSocket
383
- if (kind === "block" && text) {
384
- log?.debug?.(`[adp-openclaw] Streaming block[${chunkIndex}] to ${displayName}: ${text.slice(0, 30)}...`);
385
-
386
- const chunkMsg: WSMessage = {
387
- type: MsgType.OutboundChunk,
388
- requestId: generateRequestId(),
389
- payload: {
390
- to: inMsg.from,
391
- chunk: text,
392
- conversationId: inMsg.conversationId,
393
- recordId: inMsg.recordId, // Pass recordId back to server
394
- streamId: streamId,
395
- index: chunkIndex,
396
- isPartial: true, // Mark as partial chunk, final data will be in outbound_end
397
- user: inMsg.user,
398
- },
399
- timestamp: Date.now(),
400
- };
401
-
402
- ws.send(JSON.stringify(chunkMsg));
403
- chunkIndex++;
390
+ // Handle streaming block - IGNORE because handlePartial already sent deltas
391
+ // The "block" callback contains cumulative text (same as final), not incremental delta
392
+ // Sending it would cause duplicate data on the server side
393
+ if (kind === "block") {
394
+ log?.debug?.(`[adp-openclaw] Ignoring block callback (handlePartial already sent deltas), text.length=${text.length}`);
404
395
  return;
405
396
  }
406
397