adp-openclaw 0.0.23 → 0.0.25

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adp-openclaw",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "ADP-OpenClaw demo channel plugin (Go WebSocket backend)",
5
5
  "type": "module",
6
6
  "dependencies": {
package/src/monitor.ts CHANGED
@@ -6,7 +6,7 @@ import { getAdpOpenclawRuntime } from "./runtime.js";
6
6
  import crypto from "crypto";
7
7
 
8
8
  // Plugin version from package.json
9
- const PLUGIN_VERSION = "0.0.23";
9
+ const PLUGIN_VERSION = "0.0.25";
10
10
 
11
11
  // WebSocket reconnect delay (fixed at 1 second)
12
12
  const RECONNECT_DELAY_MS = 1000;
@@ -256,8 +256,26 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
256
256
  },
257
257
  });
258
258
 
259
+ // Get envelope format options and messages config (like QQBot does)
260
+ const envelopeOptions = runtime.channel.reply.resolveEnvelopeFormatOptions(cfg ?? {});
261
+ const messagesConfig = runtime.channel.reply.resolveEffectiveMessagesConfig(cfg ?? {}, route.agentId);
262
+
263
+ // Use formatInboundEnvelope to format the message body (like QQBot does)
264
+ const formattedBody = runtime.channel.reply.formatInboundEnvelope({
265
+ channel: "ADP-OpenClaw",
266
+ from: inMsg.user?.username ?? inMsg.from,
267
+ timestamp: inMsg.timestamp || Date.now(),
268
+ body: inMsg.text,
269
+ chatType: "direct",
270
+ sender: {
271
+ id: userIdentifier,
272
+ name: inMsg.user?.username,
273
+ },
274
+ envelope: envelopeOptions,
275
+ });
276
+
259
277
  const ctx = runtime.channel.reply.finalizeInboundContext({
260
- Body: inMsg.text,
278
+ Body: formattedBody,
261
279
  RawBody: inMsg.text,
262
280
  CommandBody: inMsg.text,
263
281
  // User identity: format as "adp-openclaw:{tenantId}:{userId}" for multi-tenant support
@@ -269,10 +287,12 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
269
287
  ChatType: "direct",
270
288
  // SenderId carries the raw user ID for identification
271
289
  SenderId: userIdentifier,
290
+ SenderName: inMsg.user?.username,
272
291
  Provider: "adp-openclaw",
273
292
  Surface: inMsg.user?.source || "adp-openclaw",
274
293
  MessageSid: inMsg.id,
275
294
  MessageSidFull: inMsg.id,
295
+ Timestamp: inMsg.timestamp || Date.now(),
276
296
  OriginatingChannel: "adp-openclaw",
277
297
  OriginatingTo: "adp-openclaw:bot",
278
298
  // Pass user metadata through context (like Feishu does)
@@ -378,6 +398,9 @@ async function connectAndHandle(params: ConnectParams): Promise<void> {
378
398
  },
379
399
  },
380
400
  dispatcherOptions: {
401
+ // ⭐ Add responsePrefix from messagesConfig (like QQBot does)
402
+ // This tells the AI what tools are available
403
+ responsePrefix: messagesConfig.responsePrefix,
381
404
  // Unified deliver callback - handles both streaming blocks and final reply
382
405
  // SDK calls this with info.kind = "block" for streaming chunks, "final" for complete response
383
406
  deliver: async (payload: { text?: string }, info?: { kind?: string }) => {
package/src/onboarding.ts CHANGED
@@ -48,7 +48,6 @@ async function noteAdpOpenclawSetup(prompter: WizardPrompter): Promise<void> {
48
48
  "ADP OpenClaw connects to a WebSocket server for real-time messaging.",
49
49
  "You need a clientToken to authenticate with the server.",
50
50
  "The signKey is used for HMAC signature generation (default: ADPOpenClaw).",
51
- "WebSocket URL defaults to: wss://wss.lke.cloud.tencent.com/bot/gateway/conn",
52
51
  ].join("\n"),
53
52
  "ADP OpenClaw setup",
54
53
  );
@@ -75,14 +74,12 @@ export const adpOpenclawOnboardingAdapter: ChannelOnboardingAdapter = {
75
74
  await noteAdpOpenclawSetup(prompter);
76
75
 
77
76
  const channelCfg = getChannelConfig(next);
78
- const existingWsUrl = channelCfg?.wsUrl?.trim();
79
77
  const existingClientToken = channelCfg?.clientToken?.trim();
80
78
  const existingSignKey = channelCfg?.signKey?.trim();
81
79
 
82
80
  // Check for env vars
83
81
  const envClientToken = process.env.ADP_OPENCLAW_CLIENT_TOKEN?.trim();
84
82
  const envSignKey = process.env.ADP_OPENCLAW_SIGN_KEY?.trim();
85
- const envWsUrl = process.env.ADP_OPENCLAW_WS_URL?.trim();
86
83
 
87
84
  if (envClientToken) {
88
85
  const useEnv = await prompter.confirm({
@@ -95,14 +92,6 @@ export const adpOpenclawOnboardingAdapter: ChannelOnboardingAdapter = {
95
92
  }
96
93
  }
97
94
 
98
- // Prompt for WebSocket URL (optional, has default)
99
- const wsUrlInput = await prompter.text({
100
- message: "WebSocket URL (press Enter for default)",
101
- placeholder: "wss://wss.lke.cloud.tencent.com/bot/gateway/conn",
102
- initialValue: existingWsUrl || envWsUrl || undefined,
103
- });
104
- const wsUrl = String(wsUrlInput ?? "").trim() || undefined;
105
-
106
95
  // Prompt for clientToken (required)
107
96
  const clientTokenInput = await prompter.text({
108
97
  message: "Client Token",
@@ -121,7 +110,6 @@ export const adpOpenclawOnboardingAdapter: ChannelOnboardingAdapter = {
121
110
  const signKey = String(signKeyInput ?? "").trim() || undefined;
122
111
 
123
112
  next = updateAdpOpenclawConfig(next, {
124
- ...(wsUrl ? { wsUrl } : {}),
125
113
  clientToken,
126
114
  ...(signKey ? { signKey } : {}),
127
115
  enabled: true,