@ynhcj/xiaoyi-channel 0.0.127-next → 0.0.128-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.
Files changed (2) hide show
  1. package/dist/src/bot.js +30 -26
  2. package/package.json +1 -1
package/dist/src/bot.js CHANGED
@@ -110,32 +110,32 @@ export async function handleXYMessage(params) {
110
110
  // Steer injections skip taskId registration to avoid overwriting the active taskId
111
111
  if (!skipReg) {
112
112
  registerTaskId(parsed.sessionId, parsed.taskId, parsed.messageId);
113
- }
114
- // Extract and update push_id if present
115
- const pushId = extractPushId(parsed.parts);
116
- if (pushId) {
117
- logger.log(`[BOT] 📌 Extracted push_id from user message`);
118
- configManager.updatePushId(parsed.sessionId, pushId);
119
- // 持久化 pushId 到本地文件(异步,不阻塞主流程)
120
- addPushId(pushId).catch((err) => {
121
- logger.error(`[BOT] Failed to persist pushId:`, err);
113
+ // Extract and update push_id if present
114
+ const pushId = extractPushId(parsed.parts);
115
+ if (pushId) {
116
+ logger.log(`[BOT] 📌 Extracted push_id from user message`);
117
+ configManager.updatePushId(parsed.sessionId, pushId);
118
+ // 持久化 pushId 到本地文件(异步,不阻塞主流程)
119
+ addPushId(pushId).catch((err) => {
120
+ logger.error(`[BOT] Failed to persist pushId:`, err);
121
+ });
122
+ }
123
+ else {
124
+ logger.log(`[BOT] ℹ️ No push_id found in message, will use config default`);
125
+ }
126
+ // 保存 runtime 信息到 .xiaoyiruntime 文件(异步,不阻塞主流程)
127
+ saveRuntimeInfo(webSocketSessionId || parsed.sessionId, // SESSION_ID (WebSocket 层级,如果没有则 fallback)
128
+ parsed.sessionId, // CONVERSATION_ID (param 里的 sessionId)
129
+ parsed.taskId // TASK_ID (param.id)
130
+ ).catch((err) => {
131
+ logger.error(`[BOT] Failed to save runtime info:`, err);
122
132
  });
123
133
  }
124
- else {
125
- logger.log(`[BOT] ℹ️ No push_id found in message, will use config default`);
126
- }
127
- // Extract deviceType if present (same level as push_id in systemVariables)
134
+ // Extract deviceType if present (always parse — used in ctxPayload.MessageSid)
128
135
  const deviceType = extractDeviceType(parsed.parts);
129
136
  if (deviceType) {
130
137
  logger.log(`[BOT] 📱 Extracted deviceType from user message: ${deviceType}`);
131
138
  }
132
- // 保存 runtime 信息到 .xiaoyiruntime 文件(异步,不阻塞主流程)
133
- saveRuntimeInfo(webSocketSessionId || parsed.sessionId, // SESSION_ID (WebSocket 层级,如果没有则 fallback)
134
- parsed.sessionId, // CONVERSATION_ID (param 里的 sessionId)
135
- parsed.taskId // TASK_ID (param.id)
136
- ).catch((err) => {
137
- logger.error(`[BOT] Failed to save runtime info:`, err);
138
- });
139
139
  // Resolve configuration (needed for status updates)
140
140
  const config = resolveXYConfig(cfg);
141
141
  // ✅ Resolve agent route (following feishu pattern)
@@ -177,7 +177,8 @@ export async function handleXYMessage(params) {
177
177
  // Extract text and files from parts
178
178
  const text = extractTextFromParts(parsed.parts);
179
179
  let textForAgent = text || "";
180
- if (route.sessionKey && textForAgent) {
180
+ // Self-evolution keyword nudge — only for real user messages, not steer injections
181
+ if (!skipReg && route.sessionKey && textForAgent) {
181
182
  try {
182
183
  const selfEvolutionEnabled = await selfEvolutionManager.isEnabled();
183
184
  if (selfEvolutionEnabled && shouldNudgeForSelfEvolutionKeyword(textForAgent)) {
@@ -201,11 +202,14 @@ export async function handleXYMessage(params) {
201
202
  textForAgent = `/steer ${textForAgent}`;
202
203
  logger.log(`[BOT] 🔄 Prepended /steer for steer injection`);
203
204
  }
204
- const fileParts = extractFileParts(parsed.parts);
205
- // Download files to local disk
206
- const downloadedFiles = await downloadFilesFromParts(fileParts);
207
- logger.log("Downloaded files:", JSON.stringify(downloadedFiles, null, 2));
208
- const mediaPayload = buildXYMediaPayload(downloadedFiles);
205
+ // File download — only for real user messages, steer injections have no files
206
+ let mediaPayload = {};
207
+ if (!skipReg) {
208
+ const fileParts = extractFileParts(parsed.parts);
209
+ const downloadedFiles = await downloadFilesFromParts(fileParts);
210
+ logger.log("Downloaded files:", JSON.stringify(downloadedFiles, null, 2));
211
+ mediaPayload = buildXYMediaPayload(downloadedFiles);
212
+ }
209
213
  // Resolve envelope format options (following feishu pattern)
210
214
  const envelopeOptions = core.channel.reply.resolveEnvelopeFormatOptions(cfg);
211
215
  // Build message body with speaker prefix (following feishu pattern)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.127-next",
3
+ "version": "0.0.128-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",