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