@ynhcj/xiaoyi-channel 0.0.206-beta → 0.0.207-beta
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/src/channel.js +19 -6
- package/package.json +1 -1
package/dist/src/channel.js
CHANGED
|
@@ -126,14 +126,27 @@ export const xyPlugin = {
|
|
|
126
126
|
? { conversationId, matchPriority: 2 }
|
|
127
127
|
: null;
|
|
128
128
|
},
|
|
129
|
-
resolveCommandConversation: ({ accountId }) => {
|
|
129
|
+
resolveCommandConversation: ({ accountId, sessionKey }) => {
|
|
130
130
|
// xiaoyi-channel: the A2A sessionId IS the conversationId.
|
|
131
|
-
//
|
|
131
|
+
// 1. Prefer the current ALS session context (works when the command
|
|
132
|
+
// is processed inside an active A2A message-handling turn).
|
|
132
133
|
const ctx = getCurrentSessionContext();
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
return
|
|
136
|
-
|
|
134
|
+
const alsSessionId = ctx?.sessionId?.trim();
|
|
135
|
+
if (alsSessionId)
|
|
136
|
+
return { conversationId: alsSessionId };
|
|
137
|
+
// 2. Fall back to parsing the session key. For xiaoyi-channel the
|
|
138
|
+
// session key has the form:
|
|
139
|
+
// agent:<agentId>:xiaoyi-channel:<accountId>:<sessionId>
|
|
140
|
+
// The last `:`-delimited segment is the A2A sessionId.
|
|
141
|
+
if (sessionKey) {
|
|
142
|
+
const lastColon = sessionKey.lastIndexOf(":");
|
|
143
|
+
if (lastColon >= 0) {
|
|
144
|
+
const sessionId = sessionKey.slice(lastColon + 1).trim();
|
|
145
|
+
if (sessionId)
|
|
146
|
+
return { conversationId: sessionId };
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
137
150
|
},
|
|
138
151
|
},
|
|
139
152
|
reload: {
|