@alfe.ai/openclaw-chat 0.0.16 → 0.0.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.
- package/dist/plugin2.cjs +30 -0
- package/dist/plugin2.js +30 -0
- package/package.json +1 -1
package/dist/plugin2.cjs
CHANGED
|
@@ -144,6 +144,9 @@ function createAlfeChannelPlugin() {
|
|
|
144
144
|
* alfe:{mode}:{identity} — single-threaded (SMS, WhatsApp)
|
|
145
145
|
* alfe:{mode}:{identity}:{convId} — multi-threaded (web chat)
|
|
146
146
|
*
|
|
147
|
+
* Wrapped standardized format (from chat inject via callAgent):
|
|
148
|
+
* agent:{ocAgentId}:alfe:{mode}:{identity}
|
|
149
|
+
*
|
|
147
150
|
* OpenClaw canonical format (from resolveAgentRoute):
|
|
148
151
|
* agent:{ocAgentId}:alfe:[default:]direct:{senderId}[:thread:{conversationId}]
|
|
149
152
|
*
|
|
@@ -202,6 +205,33 @@ function parseAlfeSessionKey(key) {
|
|
|
202
205
|
mode
|
|
203
206
|
};
|
|
204
207
|
}
|
|
208
|
+
const wrappedStandardMatch = /^agent:([^:]+):alfe:(?!default:|direct:)(\w+):(.+)$/.exec(key);
|
|
209
|
+
if (wrappedStandardMatch) {
|
|
210
|
+
const [, matchAgentId, wrappedMode, rest] = wrappedStandardMatch;
|
|
211
|
+
const standardKey = `alfe:${wrappedMode}:${rest}`;
|
|
212
|
+
if (SINGLE_THREADED_MODES.has(wrappedMode)) return {
|
|
213
|
+
agentId: matchAgentId,
|
|
214
|
+
userId: rest,
|
|
215
|
+
conversationId: standardKey,
|
|
216
|
+
tenantId: "",
|
|
217
|
+
mode: wrappedMode
|
|
218
|
+
};
|
|
219
|
+
const lastColon = rest.lastIndexOf(":");
|
|
220
|
+
if (lastColon > 0) return {
|
|
221
|
+
agentId: matchAgentId,
|
|
222
|
+
userId: rest.slice(0, lastColon),
|
|
223
|
+
conversationId: standardKey,
|
|
224
|
+
tenantId: "",
|
|
225
|
+
mode: wrappedMode
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
agentId: matchAgentId,
|
|
229
|
+
userId: rest,
|
|
230
|
+
conversationId: standardKey,
|
|
231
|
+
tenantId: "",
|
|
232
|
+
mode: wrappedMode
|
|
233
|
+
};
|
|
234
|
+
}
|
|
205
235
|
const canonicalMatch = /^agent:([^:]+):alfe:(?:default:)?direct:(.+?)(?::thread:(.+))?$/.exec(key);
|
|
206
236
|
if (canonicalMatch) {
|
|
207
237
|
const [, matchAgentId, matchUserId, matchConvId] = canonicalMatch;
|
package/dist/plugin2.js
CHANGED
|
@@ -144,6 +144,9 @@ function createAlfeChannelPlugin() {
|
|
|
144
144
|
* alfe:{mode}:{identity} — single-threaded (SMS, WhatsApp)
|
|
145
145
|
* alfe:{mode}:{identity}:{convId} — multi-threaded (web chat)
|
|
146
146
|
*
|
|
147
|
+
* Wrapped standardized format (from chat inject via callAgent):
|
|
148
|
+
* agent:{ocAgentId}:alfe:{mode}:{identity}
|
|
149
|
+
*
|
|
147
150
|
* OpenClaw canonical format (from resolveAgentRoute):
|
|
148
151
|
* agent:{ocAgentId}:alfe:[default:]direct:{senderId}[:thread:{conversationId}]
|
|
149
152
|
*
|
|
@@ -202,6 +205,33 @@ function parseAlfeSessionKey(key) {
|
|
|
202
205
|
mode
|
|
203
206
|
};
|
|
204
207
|
}
|
|
208
|
+
const wrappedStandardMatch = /^agent:([^:]+):alfe:(?!default:|direct:)(\w+):(.+)$/.exec(key);
|
|
209
|
+
if (wrappedStandardMatch) {
|
|
210
|
+
const [, matchAgentId, wrappedMode, rest] = wrappedStandardMatch;
|
|
211
|
+
const standardKey = `alfe:${wrappedMode}:${rest}`;
|
|
212
|
+
if (SINGLE_THREADED_MODES.has(wrappedMode)) return {
|
|
213
|
+
agentId: matchAgentId,
|
|
214
|
+
userId: rest,
|
|
215
|
+
conversationId: standardKey,
|
|
216
|
+
tenantId: "",
|
|
217
|
+
mode: wrappedMode
|
|
218
|
+
};
|
|
219
|
+
const lastColon = rest.lastIndexOf(":");
|
|
220
|
+
if (lastColon > 0) return {
|
|
221
|
+
agentId: matchAgentId,
|
|
222
|
+
userId: rest.slice(0, lastColon),
|
|
223
|
+
conversationId: standardKey,
|
|
224
|
+
tenantId: "",
|
|
225
|
+
mode: wrappedMode
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
agentId: matchAgentId,
|
|
229
|
+
userId: rest,
|
|
230
|
+
conversationId: standardKey,
|
|
231
|
+
tenantId: "",
|
|
232
|
+
mode: wrappedMode
|
|
233
|
+
};
|
|
234
|
+
}
|
|
205
235
|
const canonicalMatch = /^agent:([^:]+):alfe:(?:default:)?direct:(.+?)(?::thread:(.+))?$/.exec(key);
|
|
206
236
|
if (canonicalMatch) {
|
|
207
237
|
const [, matchAgentId, matchUserId, matchConvId] = canonicalMatch;
|