@agentchatme/openclaw 0.6.15 → 0.6.17

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.
@@ -11,6 +11,8 @@ var channelLifecycle = require('openclaw/plugin-sdk/channel-lifecycle');
11
11
  var pino = require('pino');
12
12
  var ws = require('ws');
13
13
  var directDm = require('openclaw/plugin-sdk/direct-dm');
14
+ var inboundEnvelope = require('openclaw/plugin-sdk/inbound-envelope');
15
+ var inboundReplyDispatch = require('openclaw/plugin-sdk/inbound-reply-dispatch');
14
16
  var agentchat = require('@agentchatme/agentchat');
15
17
  var typebox = require('@sinclair/typebox');
16
18
 
@@ -860,8 +862,8 @@ var reconnectConfigSchema = zod.z.object({
860
862
  jitterRatio: zod.z.number().min(0).max(1).default(0.2)
861
863
  }).strict();
862
864
  var pingConfigSchema = zod.z.object({
863
- intervalMs: zod.z.number().int().min(5e3).max(12e4).default(3e4),
864
- timeoutMs: zod.z.number().int().min(1e3).max(3e4).default(1e4)
865
+ intervalMs: zod.z.number().int().min(5e3).max(12e4).default(45e3),
866
+ timeoutMs: zod.z.number().int().min(1e3).max(6e4).default(3e4)
865
867
  }).strict();
866
868
  var outboundConfigSchema = zod.z.object({
867
869
  maxInFlight: zod.z.number().int().min(1).max(1e4).default(256),
@@ -1855,7 +1857,7 @@ var CircuitBreaker = class {
1855
1857
  };
1856
1858
 
1857
1859
  // src/version.ts
1858
- var PACKAGE_VERSION = "0.6.15";
1860
+ var PACKAGE_VERSION = "0.6.17";
1859
1861
 
1860
1862
  // src/outbound.ts
1861
1863
  var DEFAULT_RETRY_POLICY = {
@@ -2487,31 +2489,70 @@ async function handleMessage(deps, event) {
2487
2489
  }
2488
2490
  });
2489
2491
  } else {
2490
- const dispatcher = channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher;
2491
- const sessionKey = `agentchat:${deps.accountId}:group:${event.conversationId}`;
2492
- await dispatcher({
2492
+ const ts = typeof event.createdAt === "number" ? event.createdAt : Date.parse(event.createdAt);
2493
+ const runtime = channelRuntime;
2494
+ const { route, buildEnvelope } = inboundEnvelope.resolveInboundRouteEnvelopeBuilderWithRuntime({
2493
2495
  cfg: deps.gatewayCfg,
2494
- ctx: {
2495
- Body: body,
2496
- BodyForAgent: body,
2497
- RawBody: body,
2498
- CommandBody: body,
2499
- From: `@${senderHandle}`,
2500
- To: `@${recipientHandle}`,
2501
- SessionKey: sessionKey,
2502
- AccountId: deps.accountId,
2503
- ChatType: "group",
2504
- ConversationLabel: conversationLabel,
2505
- SenderId: senderHandle,
2506
- Provider: "agentchat",
2507
- Surface: "agentchat",
2508
- MessageSid: event.messageId,
2509
- MessageSidFull: event.messageId,
2510
- Timestamp: event.createdAt,
2511
- OriginatingChannel: "agentchat",
2512
- OriginatingTo: `@${recipientHandle}`
2496
+ channel: "agentchat",
2497
+ accountId: deps.accountId,
2498
+ peer: { kind: "group", id: event.conversationId },
2499
+ runtime
2500
+ });
2501
+ const { storePath, body: envelopeBody } = buildEnvelope({
2502
+ channel: "AgentChat",
2503
+ from: conversationLabel,
2504
+ body,
2505
+ timestamp: ts
2506
+ });
2507
+ const finalize = channelRuntime.reply.finalizeInboundContext;
2508
+ const ctxPayload = finalize({
2509
+ Body: envelopeBody,
2510
+ BodyForAgent: body,
2511
+ RawBody: body,
2512
+ CommandBody: body,
2513
+ From: `@${senderHandle}`,
2514
+ To: `@${recipientHandle}`,
2515
+ SessionKey: route.sessionKey,
2516
+ AccountId: deps.accountId,
2517
+ ChatType: "group",
2518
+ ConversationLabel: conversationLabel,
2519
+ SenderId: senderHandle,
2520
+ Provider: "agentchat",
2521
+ Surface: "agentchat",
2522
+ MessageSid: event.messageId,
2523
+ MessageSidFull: event.messageId,
2524
+ Timestamp: ts,
2525
+ OriginatingChannel: "agentchat",
2526
+ OriginatingTo: `@${recipientHandle}`
2527
+ });
2528
+ const session = channelRuntime.session;
2529
+ await inboundReplyDispatch.recordInboundSessionAndDispatchReply({
2530
+ cfg: deps.gatewayCfg,
2531
+ channel: "agentchat",
2532
+ accountId: deps.accountId,
2533
+ agentId: route.agentId,
2534
+ routeSessionKey: route.sessionKey,
2535
+ storePath,
2536
+ ctxPayload,
2537
+ recordInboundSession: session.recordInboundSession,
2538
+ dispatchReplyWithBufferedBlockDispatcher: channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher,
2539
+ deliver: deliver2,
2540
+ onRecordError: (err3) => {
2541
+ deps.logger.error(
2542
+ { err: err3 instanceof Error ? err3.message : String(err3), messageId: event.messageId },
2543
+ "recordInboundSession failed (group)"
2544
+ );
2513
2545
  },
2514
- dispatcherOptions: { deliver: deliver2 }
2546
+ onDispatchError: (err3, info) => {
2547
+ deps.logger.error(
2548
+ {
2549
+ err: err3 instanceof Error ? err3.message : String(err3),
2550
+ messageId: event.messageId,
2551
+ kind: info.kind
2552
+ },
2553
+ "inbound dispatch failed (group)"
2554
+ );
2555
+ }
2515
2556
  });
2516
2557
  }
2517
2558
  } catch (err3) {