@openagents-org/agent-launcher 0.2.32 → 0.2.33
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 +1 -1
- package/src/adapters/base.js +5 -1
- package/src/adapters/openclaw.js +15 -4
package/package.json
CHANGED
package/src/adapters/base.js
CHANGED
|
@@ -232,7 +232,11 @@ class BaseAdapter {
|
|
|
232
232
|
// ------------------------------------------------------------------
|
|
233
233
|
|
|
234
234
|
async _dispatchMessage(msg) {
|
|
235
|
-
|
|
235
|
+
// Use sessionId only if it looks like a channel, not an agent target
|
|
236
|
+
let channel = this.channelName || 'general';
|
|
237
|
+
if (msg.sessionId && !msg.sessionId.startsWith('openagents:') && !msg.sessionId.startsWith('agent:')) {
|
|
238
|
+
channel = msg.sessionId;
|
|
239
|
+
}
|
|
236
240
|
|
|
237
241
|
if (this._channelBusy.has(channel)) {
|
|
238
242
|
if (!this._channelQueues[channel]) this._channelQueues[channel] = [];
|
package/src/adapters/openclaw.js
CHANGED
|
@@ -144,7 +144,12 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
144
144
|
|
|
145
145
|
if (!content) return;
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
// msg.sessionId may be a channel name (from workspace UI) or an agent target
|
|
148
|
+
// (from API). Only use it if it looks like a channel, otherwise use channelName.
|
|
149
|
+
let msgChannel = this.channelName || 'general';
|
|
150
|
+
if (msg.sessionId && !msg.sessionId.startsWith('openagents:') && !msg.sessionId.startsWith('agent:')) {
|
|
151
|
+
msgChannel = msg.sessionId;
|
|
152
|
+
}
|
|
148
153
|
const sender = msg.senderName || msg.senderType || 'user';
|
|
149
154
|
this._log(`Processing message from ${sender} in ${msgChannel}: ${content.slice(0, 80)}...`);
|
|
150
155
|
|
|
@@ -177,7 +182,8 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
177
182
|
return;
|
|
178
183
|
}
|
|
179
184
|
|
|
180
|
-
const
|
|
185
|
+
const channelSuffix = (channel || 'general').replace(/[^a-zA-Z0-9-]/g, '').slice(-8) || 'general';
|
|
186
|
+
const sessionKey = `openagents-${this.workspaceId.slice(0, 8)}-${channelSuffix}`;
|
|
181
187
|
|
|
182
188
|
const args = [
|
|
183
189
|
'--log-level', 'trace',
|
|
@@ -324,8 +330,13 @@ class OpenClawAdapter extends BaseAdapter {
|
|
|
324
330
|
// Find the JSON by looking for '{"payloads"' or the last complete JSON object.
|
|
325
331
|
let jsonStr = null;
|
|
326
332
|
|
|
327
|
-
// Strategy 1: find {"payloads"
|
|
328
|
-
|
|
333
|
+
// Strategy 1: find {"payloads" or { "payloads" (with whitespace)
|
|
334
|
+
let payloadsIdx = text.indexOf('{"payloads"');
|
|
335
|
+
if (payloadsIdx < 0) {
|
|
336
|
+
// Try with whitespace after {
|
|
337
|
+
const match = text.match(/\{\s*"payloads"/);
|
|
338
|
+
if (match) payloadsIdx = match.index;
|
|
339
|
+
}
|
|
329
340
|
if (payloadsIdx >= 0) {
|
|
330
341
|
// Find the matching closing brace by counting braces
|
|
331
342
|
let depth = 0;
|