@agentchatme/openclaw 0.6.16 → 0.6.18

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
 
@@ -823,19 +825,16 @@ var agentchatSetupWizard = {
823
825
  },
824
826
  completionNote: {
825
827
  title: "AgentChat is ready",
826
- lines: [
827
- // Why this line exists: after our wizard returns, OpenClaw's
828
- // setupChannels loops back to "Select a channel" so the user can
829
- // wire up additional channels in the same session. From the user's
830
- // vantage point this looks like the wizard restarted; tell them
831
- // the loop is intentional and how to exit.
832
- 'On the next prompt, choose "Finished" to exit \u2014 or pick another channel to keep configuring.',
833
- "",
834
- "Next steps:",
835
- " \u2022 Start OpenClaw \u2014 the AgentChat channel auto-connects via WebSocket.",
836
- " \u2022 DM another agent: @<handle> <message>",
837
- " \u2022 Docs: https://agentchat.me/docs"
838
- ]
828
+ // After our wizard returns, OpenClaw's setupChannels keeps running
829
+ // its own outer flow (a Select-a-channel loop, then optional
830
+ // follow-up prompts for display names and channel→agent binding).
831
+ // None of that is suppressible from a channel plugin there's no
832
+ // field on ChannelSetupWizard that hides those prompts. So this
833
+ // note keeps to the only thing the user actually needs to know:
834
+ // pick Finished. The earlier "or pick another channel" copy read
835
+ // as a vague alt-branch and produced the "did this break?"
836
+ // reaction; one direct sentence is the cure.
837
+ lines: ['On the next prompt, choose "Finished" to exit.']
839
838
  },
840
839
  // `disable` fires on `openclaw channels remove agentchat`. We strip
841
840
  // the persistent AGENTS.md anchor here so the agent stops being told
@@ -1855,7 +1854,7 @@ var CircuitBreaker = class {
1855
1854
  };
1856
1855
 
1857
1856
  // src/version.ts
1858
- var PACKAGE_VERSION = "0.6.16";
1857
+ var PACKAGE_VERSION = "0.6.18";
1859
1858
 
1860
1859
  // src/outbound.ts
1861
1860
  var DEFAULT_RETRY_POLICY = {
@@ -2487,31 +2486,70 @@ async function handleMessage(deps, event) {
2487
2486
  }
2488
2487
  });
2489
2488
  } else {
2490
- const dispatcher = channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher;
2491
- const sessionKey = `agentchat:${deps.accountId}:group:${event.conversationId}`;
2492
- await dispatcher({
2489
+ const ts = typeof event.createdAt === "number" ? event.createdAt : Date.parse(event.createdAt);
2490
+ const runtime = channelRuntime;
2491
+ const { route, buildEnvelope } = inboundEnvelope.resolveInboundRouteEnvelopeBuilderWithRuntime({
2493
2492
  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}`
2493
+ channel: "agentchat",
2494
+ accountId: deps.accountId,
2495
+ peer: { kind: "group", id: event.conversationId },
2496
+ runtime
2497
+ });
2498
+ const { storePath, body: envelopeBody } = buildEnvelope({
2499
+ channel: "AgentChat",
2500
+ from: conversationLabel,
2501
+ body,
2502
+ timestamp: ts
2503
+ });
2504
+ const finalize = channelRuntime.reply.finalizeInboundContext;
2505
+ const ctxPayload = finalize({
2506
+ Body: envelopeBody,
2507
+ BodyForAgent: body,
2508
+ RawBody: body,
2509
+ CommandBody: body,
2510
+ From: `@${senderHandle}`,
2511
+ To: `@${recipientHandle}`,
2512
+ SessionKey: route.sessionKey,
2513
+ AccountId: deps.accountId,
2514
+ ChatType: "group",
2515
+ ConversationLabel: conversationLabel,
2516
+ SenderId: senderHandle,
2517
+ Provider: "agentchat",
2518
+ Surface: "agentchat",
2519
+ MessageSid: event.messageId,
2520
+ MessageSidFull: event.messageId,
2521
+ Timestamp: ts,
2522
+ OriginatingChannel: "agentchat",
2523
+ OriginatingTo: `@${recipientHandle}`
2524
+ });
2525
+ const session = channelRuntime.session;
2526
+ await inboundReplyDispatch.recordInboundSessionAndDispatchReply({
2527
+ cfg: deps.gatewayCfg,
2528
+ channel: "agentchat",
2529
+ accountId: deps.accountId,
2530
+ agentId: route.agentId,
2531
+ routeSessionKey: route.sessionKey,
2532
+ storePath,
2533
+ ctxPayload,
2534
+ recordInboundSession: session.recordInboundSession,
2535
+ dispatchReplyWithBufferedBlockDispatcher: channelRuntime.reply.dispatchReplyWithBufferedBlockDispatcher,
2536
+ deliver: deliver2,
2537
+ onRecordError: (err3) => {
2538
+ deps.logger.error(
2539
+ { err: err3 instanceof Error ? err3.message : String(err3), messageId: event.messageId },
2540
+ "recordInboundSession failed (group)"
2541
+ );
2513
2542
  },
2514
- dispatcherOptions: { deliver: deliver2 }
2543
+ onDispatchError: (err3, info) => {
2544
+ deps.logger.error(
2545
+ {
2546
+ err: err3 instanceof Error ? err3.message : String(err3),
2547
+ messageId: event.messageId,
2548
+ kind: info.kind
2549
+ },
2550
+ "inbound dispatch failed (group)"
2551
+ );
2552
+ }
2515
2553
  });
2516
2554
  }
2517
2555
  } catch (err3) {