@ynhcj/xiaoyi-channel 0.0.206-beta → 0.0.208-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
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: {
|
package/dist/src/cspl/config.js
CHANGED
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import fs from 'fs';
|
|
5
5
|
import path from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
6
9
|
import { CONFIG_FILE_NAME, ENV_FILE_PATH, REQUIRED_ENV_VARS } from './constants.js';
|
|
7
10
|
import { logger } from '../utils/logger.js';
|
|
8
11
|
let cachedConfig = null;
|
|
@@ -430,15 +430,16 @@ export function createXYReplyDispatcher(params) {
|
|
|
430
430
|
}
|
|
431
431
|
else {
|
|
432
432
|
// 新文本不以已累积内容为前缀(如工具调用后模型重新开始生成),
|
|
433
|
-
//
|
|
433
|
+
// 重置 accumulatedText 为当前文本,后续基于此新前缀做去重
|
|
434
434
|
const wasFirstRound = accumulatedText.length === 0;
|
|
435
|
-
accumulatedText = "";
|
|
436
435
|
// 新一轮输出前加换行分隔(第一轮除外)
|
|
437
436
|
if (sendText.length > 0 && !wasFirstRound) {
|
|
438
437
|
sendText = "\n" + sendText;
|
|
439
438
|
}
|
|
440
439
|
}
|
|
441
|
-
|
|
440
|
+
// 始终追踪模型的原始输出文本,避免注入的 "\n" 前缀污染 accumulatedText
|
|
441
|
+
// 导致下一轮 startsWith 永久匹配失败
|
|
442
|
+
accumulatedText = text;
|
|
442
443
|
hasSentResponse = true;
|
|
443
444
|
if (sendText.length > 0) {
|
|
444
445
|
await sendA2AResponse({
|