@ynhcj/xiaoyi-channel 0.0.158-next → 0.0.159-next
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/bot.js
CHANGED
|
@@ -198,7 +198,10 @@ export async function handleXYMessage(params) {
|
|
|
198
198
|
await updateSessionStore(storePath, (store) => {
|
|
199
199
|
if (!store[route.sessionKey]) {
|
|
200
200
|
store[route.sessionKey] = {
|
|
201
|
-
sessionId
|
|
201
|
+
// sessionId must pass validateSessionId regex /^[a-z0-9][a-z0-9._-]{0,127}$/i
|
|
202
|
+
// route.sessionKey like "agent:main:direct:xxx" contains colons which are invalid.
|
|
203
|
+
// Use parsed.sessionId (raw UUID from A2A) which is always safe.
|
|
204
|
+
sessionId: parsed.sessionId,
|
|
202
205
|
updatedAt: Date.now(),
|
|
203
206
|
providerOverride: "xiaoyiprovider",
|
|
204
207
|
modelOverride: modelName,
|
|
@@ -118,8 +118,6 @@ export function createXYReplyDispatcher(params) {
|
|
|
118
118
|
let accumulatedText = "";
|
|
119
119
|
let accumulatedReasoningHistory = "";
|
|
120
120
|
let lastReasoningText = "";
|
|
121
|
-
let accumulatedReplyHistory = "";
|
|
122
|
-
let lastReplyText = "";
|
|
123
121
|
const initialRunCrossTaskContext = getCurrentSessionContext()?.runCrossTaskContext;
|
|
124
122
|
const getRunCrossTaskContext = () => {
|
|
125
123
|
return getCurrentSessionContext()?.runCrossTaskContext ?? initialRunCrossTaskContext;
|
|
@@ -443,31 +441,17 @@ export function createXYReplyDispatcher(params) {
|
|
|
443
441
|
}
|
|
444
442
|
const currentTaskId = getActiveTaskId();
|
|
445
443
|
const currentMessageId = getActiveMessageId();
|
|
446
|
-
|
|
444
|
+
const text = payload.text ?? "";
|
|
447
445
|
try {
|
|
448
446
|
if (text.length > 0) {
|
|
449
|
-
// 🔑 检测是否是新一轮回复:当前text比上一次短,或不以上次内容开头
|
|
450
|
-
const isNewRound = lastReplyText.length > 0 &&
|
|
451
|
-
(text.length < lastReplyText.length || !text.startsWith(lastReplyText));
|
|
452
|
-
if (isNewRound) {
|
|
453
|
-
// 将上一轮回复追加到历史
|
|
454
|
-
accumulatedReplyHistory += (accumulatedReplyHistory ? "\n\n" : "") + lastReplyText;
|
|
455
|
-
}
|
|
456
|
-
// 更新当前轮最后一次text
|
|
457
|
-
lastReplyText = text;
|
|
458
|
-
// 🔑 拼接历史 + 当前轮内容
|
|
459
|
-
const fullText = accumulatedReplyHistory
|
|
460
|
-
? accumulatedReplyHistory + "\n\n" + text
|
|
461
|
-
: text;
|
|
462
447
|
accumulatedText += text;
|
|
463
448
|
hasSentResponse = true;
|
|
464
|
-
// 🔑 流式文本通过 A2A text 通道发送(而非 reasoningText)
|
|
465
449
|
await sendA2AResponse({
|
|
466
450
|
config,
|
|
467
451
|
sessionId,
|
|
468
452
|
taskId: currentTaskId,
|
|
469
453
|
messageId: currentMessageId,
|
|
470
|
-
text
|
|
454
|
+
text,
|
|
471
455
|
append: false,
|
|
472
456
|
final: false,
|
|
473
457
|
log: false,
|
|
@@ -17,10 +17,6 @@ import { createGetCollectionToolSchemaTool } from "./get-collection-tool-schema.
|
|
|
17
17
|
// import { createGetEmailToolSchemaTool } from "./get-email-tool-schema.js";
|
|
18
18
|
import { createLoginTokenTool } from "./login-token-tool.js";
|
|
19
19
|
import { createAgentAsSkillTool } from "./agent-as-skill-tool.js";
|
|
20
|
-
import { createDiscoverCrossDevicesTool } from "./discover-cross-devices-tool.js";
|
|
21
|
-
import { createSendCrossDeviceTaskTool } from "./send-cross-device-task-tool.js";
|
|
22
|
-
import { createDisplayA2UICardTool } from "./display-a2ui-card-tool.js";
|
|
23
|
-
import { createCheckPluginPrivilegeTool } from "./check-plugin-privilege-tool.js";
|
|
24
20
|
import { logger } from "../utils/logger.js";
|
|
25
21
|
/**
|
|
26
22
|
* Create all XY channel tools for the given session context.
|
|
@@ -36,9 +32,9 @@ export function createAllTools(ctx) {
|
|
|
36
32
|
logger.log(`[CREATE-ALL-TOOLS] creating tools`);
|
|
37
33
|
return [
|
|
38
34
|
createLocationTool(ctx),
|
|
39
|
-
createDiscoverCrossDevicesTool(ctx),
|
|
40
|
-
createSendCrossDeviceTaskTool(ctx),
|
|
41
|
-
createDisplayA2UICardTool(ctx),
|
|
35
|
+
// createDiscoverCrossDevicesTool(ctx),
|
|
36
|
+
// createSendCrossDeviceTaskTool(ctx),
|
|
37
|
+
// createDisplayA2UICardTool(ctx),
|
|
42
38
|
createCallDeviceTool(ctx),
|
|
43
39
|
createGetNoteToolSchemaTool(ctx),
|
|
44
40
|
createGetCalendarToolSchemaTool(ctx),
|
|
@@ -57,6 +53,6 @@ export function createAllTools(ctx) {
|
|
|
57
53
|
createSaveSelfEvolutionSkillTool(ctx),
|
|
58
54
|
createLoginTokenTool(ctx),
|
|
59
55
|
createAgentAsSkillTool(ctx),
|
|
60
|
-
createCheckPluginPrivilegeTool(ctx),
|
|
56
|
+
// createCheckPluginPrivilegeTool(ctx),
|
|
61
57
|
];
|
|
62
58
|
}
|