@ynhcj/xiaoyi-channel 0.0.176-next → 0.0.177-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/formatter.js
CHANGED
|
@@ -141,6 +141,8 @@ export async function sendReasoningTextUpdate(params) {
|
|
|
141
141
|
id: messageId,
|
|
142
142
|
result: artifact,
|
|
143
143
|
};
|
|
144
|
+
const redactedText = redactSensitiveText(bridgedText);
|
|
145
|
+
log.log(`[A2A_REASONING] Sending reasoning update, append=${append}, taskId=${taskId}, messageId=${messageId}, text=${buildTextPreview(redactedText)}, sensitive=${containsSensitiveInfo(bridgedText)}`);
|
|
144
146
|
const wsManager = getXYWebSocketManager(config);
|
|
145
147
|
const outboundMessage = {
|
|
146
148
|
msgType: "agent_response",
|
|
@@ -150,6 +152,7 @@ export async function sendReasoningTextUpdate(params) {
|
|
|
150
152
|
msgDetail: JSON.stringify(jsonRpcResponse),
|
|
151
153
|
};
|
|
152
154
|
await wsManager.sendMessage(sessionId, outboundMessage);
|
|
155
|
+
log.log(`[A2A_REASONING] Reasoning update sent successfully`);
|
|
153
156
|
}
|
|
154
157
|
/**
|
|
155
158
|
* Send an A2A task status update.
|
|
@@ -42,6 +42,9 @@ export async function handleMemoryQueryEvent(context, cfg) {
|
|
|
42
42
|
case "MemoryStateSet":
|
|
43
43
|
result = handleMemoryStateSet(params);
|
|
44
44
|
break;
|
|
45
|
+
case "MemoryStateGet":
|
|
46
|
+
result = handleMemoryStateGet();
|
|
47
|
+
break;
|
|
45
48
|
case "UserMdQuery":
|
|
46
49
|
result = handleUserMdQuery();
|
|
47
50
|
break;
|
|
@@ -135,6 +138,35 @@ function handleMemoryStateSet(params) {
|
|
|
135
138
|
logger.log(`[MEMORY-QUERY] updated ${MEMORY_STATE_KEY}=${value} in ${filePath}`);
|
|
136
139
|
return { code: 0 };
|
|
137
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* Read MEMORYSTATE from .xiaoyiruntime and return its boolean value.
|
|
143
|
+
* Missing file or key defaults to false.
|
|
144
|
+
*/
|
|
145
|
+
function handleMemoryStateGet() {
|
|
146
|
+
const filePath = resolveXiaoyiRuntimePath();
|
|
147
|
+
let content;
|
|
148
|
+
try {
|
|
149
|
+
content = readFileSync(filePath, "utf-8");
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
if (err.code === "ENOENT") {
|
|
153
|
+
logger.log(`[MEMORY-QUERY] ${filePath} not found`);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
logger.error(`[MEMORY-QUERY] Failed to read ${filePath}:`, err);
|
|
157
|
+
}
|
|
158
|
+
return { memoryState: false };
|
|
159
|
+
}
|
|
160
|
+
for (const line of content.split("\n")) {
|
|
161
|
+
if (line.startsWith(`${MEMORY_STATE_KEY}=`)) {
|
|
162
|
+
const value = line.slice(`${MEMORY_STATE_KEY}=`.length).trim();
|
|
163
|
+
logger.log(`[MEMORY-QUERY] read ${MEMORY_STATE_KEY}=${value} from ${filePath}`);
|
|
164
|
+
return { memoryState: value === "true" };
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
logger.log(`[MEMORY-QUERY] ${MEMORY_STATE_KEY} not found in ${filePath}`);
|
|
168
|
+
return { memoryState: false };
|
|
169
|
+
}
|
|
138
170
|
/**
|
|
139
171
|
* Read ~/.openclaw/workspace/USER.md and return content in fileDetail.
|
|
140
172
|
*/
|
|
@@ -414,13 +414,16 @@ export function createXYReplyDispatcher(params) {
|
|
|
414
414
|
onReasoningStream: async (payload) => {
|
|
415
415
|
// 🔑 steered dispatch不发送reasoning stream
|
|
416
416
|
if (steerState.steered) {
|
|
417
|
+
scopedLog().log(`[REASONING-STREAM] Skipped (steered dispatch)`);
|
|
417
418
|
return;
|
|
418
419
|
}
|
|
419
420
|
let text = payload.text ?? "";
|
|
421
|
+
scopedLog().log(`[REASONING-STREAM] Received reasoning chunk, rawText.length=${text.length}, steered=${steerState.steered}`);
|
|
420
422
|
// Strip "Reasoning:" prefix that some reasoning models add to their thinking output
|
|
421
423
|
const lines = text.split(/\r?\n/);
|
|
422
424
|
if (lines[0]?.trim() === "Reasoning:") {
|
|
423
425
|
text = lines.slice(1).join("\n").trim();
|
|
426
|
+
scopedLog().log(`[REASONING-STREAM] Stripped "Reasoning:" prefix, text.length=${text.length}`);
|
|
424
427
|
}
|
|
425
428
|
try {
|
|
426
429
|
if (text.length > 0) {
|
|
@@ -433,6 +436,9 @@ export function createXYReplyDispatcher(params) {
|
|
|
433
436
|
append: false,
|
|
434
437
|
});
|
|
435
438
|
}
|
|
439
|
+
else {
|
|
440
|
+
scopedLog().log(`[REASONING-STREAM] Skipped (empty text after stripping)`);
|
|
441
|
+
}
|
|
436
442
|
}
|
|
437
443
|
catch (err) {
|
|
438
444
|
scopedLog().error(`[REASONING-STREAM] Failed to send reasoning text:`, err);
|