@ynhcj/xiaoyi-channel 0.0.174-beta → 0.0.176-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/bot.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { updateSessionStoreEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
1
2
  import { getXYRuntime } from "./runtime.js";
2
3
  import { createXYReplyDispatcher } from "./reply-dispatcher.js";
3
4
  import { parseA2AMessage, extractTextFromParts, extractFileParts, extractPushId, extractDeviceType, extractModelName, extractTriggerData, extractRunCrossTaskContext } from "./parser.js";
@@ -173,6 +174,26 @@ export async function handleXYMessage(params) {
173
174
  modelName,
174
175
  runCrossTaskContext: runCrossTaskContext ?? undefined,
175
176
  });
177
+ // 🔑 Sync A2A modelName to OpenClaw session store so that session_status
178
+ // reports the correct model. Without this, session_status returns the
179
+ // configured default model instead of the A2A-specified one.
180
+ if (modelName && modelName.trim() !== "" && modelName.toLowerCase() !== "none") {
181
+ try {
182
+ await updateSessionStoreEntry({
183
+ storePath: resolveStorePath(),
184
+ sessionKey: route.sessionKey,
185
+ update: async () => ({
186
+ providerOverride: "xiaoyiprovider",
187
+ modelOverride: modelName,
188
+ modelOverrideSource: "user",
189
+ }),
190
+ });
191
+ log.log(`[BOT] Patched session store model override: xiaoyiprovider/${modelName}`);
192
+ }
193
+ catch (patchErr) {
194
+ log.error(`[BOT] Failed to patch session model override:`, patchErr);
195
+ }
196
+ }
176
197
  // 🔑 发送初始状态更新
177
198
  log.log(`[BOT] Sending initial status update`);
178
199
  void sendStatusUpdate({
@@ -93,7 +93,7 @@ export async function handleCronQueryEvent(context, cfg) {
93
93
  taskId,
94
94
  messageId,
95
95
  command,
96
- final: true,
96
+ final: false,
97
97
  });
98
98
  logger.log(`[CRON-QUERY] Sent response via sendCommand, action=${action}`);
99
99
  }
@@ -217,12 +217,11 @@ export async function sendCommand(params) {
217
217
  if (commands.length === 0) {
218
218
  throw new Error("sendCommand requires command or commands.");
219
219
  }
220
- // ── Cron mode: route through push channel ──────────────────────
221
- // Detected via: (a) sessionId "cron-" prefix from synthetic session, OR
222
- // (b) toolCallId marked by before_tool_call hook from openclaw's sessionKey.
220
+ // ── Cron mode: disabled ────────────────────────────────────────
221
+ // sendCommandViaPush is disabled in this version. Cron-triggered
222
+ // tool calls that try to send commands will be rejected.
223
223
  if (sessionId.startsWith("cron-") || isCronToolCall(toolCallId)) {
224
- const { sendCommandViaPush } = await import("./cron-command.js");
225
- return sendCommandViaPush({ config, command: commands[0] });
224
+ throw new Error("sendCommandViaPush is disabled in this version");
226
225
  }
227
226
  // ── Normal mode: WebSocket ─────────────────────────────────────
228
227
  // Dynamic lookup: use latest taskId/messageId from task-manager (handles steer/interrupt),
@@ -570,12 +570,6 @@ export const xiaoyiProvider = {
570
570
  const deviceSection = `\n\n## Current User Device Context\nThe current user is using the following device: ${displayDevice}\nYou need to be aware of the user's current device and provide guidance accordingly. If the response involves device-related tools or actions, you must tailor the reply based on the user's current device, using device-specific references such as "saved to the Notes/Calendar on your {deviceType}.\n"`;
571
571
  context.systemPrompt = (context.systemPrompt ?? "") + deviceSection;
572
572
  }
573
- // Append current LLM model to systemPrompt
574
- const currentModelName = getCurrentSessionContext()?.modelName;
575
- if (currentModelName && currentModelName.trim() !== "" && currentModelName.toLowerCase() !== "none") {
576
- const modelSection = `\n\n## Current LLM MODEL\n${currentModelName}`;
577
- context.systemPrompt = (context.systemPrompt ?? "") + modelSection;
578
- }
579
573
  // ── Trim user message metadata ──────────────────────
580
574
  if (context.messages) {
581
575
  for (const msg of context.messages) {
@@ -12,7 +12,7 @@ export function createSendHtmlCardTool(ctx) {
12
12
  return {
13
13
  name: "send_html_card",
14
14
  label: "Send HTML Card",
15
- description: `工具能力描述:当需要把生成的html文件发送给用户时,优先使用这个工具。以H5卡片的形式展示HTML页面内容,用户可以直接在卡片中查看。如果用户要求原始文件,才使用send_file_to_user发送html文件,否则html的文件回传均使用此工具。
15
+ description: `工具能力描述:支持以H5卡片的形式展示HTML页面内容,用户可以直接在卡片中查看。
16
16
 
17
17
  工具参数说明:
18
18
  a. htmlUrl 和 htmlLocal 至少填写一个
@@ -22,8 +22,7 @@ c. htmlLocal 是本地HTML文件路径,会先上传获取预览链接再以卡
22
22
  注意事项:
23
23
  a. 操作超时时间为2分钟(120秒),请勿重复调用此工具,如果超时或失败,最多重试一次
24
24
  b. 最后要把最终的html的公网地址作为工具执行结果返回回去,要以markdown超链接的形式返回给用户,必须严格保留完整的url,包含url的鉴权鉴权信息,返回给用户的url必须是完整的
25
- c. html类型的文件回传给用户优先用这个工具,当用户说“生成xxxxhtml然后发我”或者“生成网页游戏烦我”这种表述时使用send_html_card工具
26
- d. 如果使用这个工具把html文件回传,则生成的html要尽可能适配用户的设备,如果用户使用的是手机,则尽可能生成竖屏的html的预览效果`,
25
+ c. 仅当用户或者skill中显示说明使用send_html_card工具时才调用此工具`,
27
26
  parameters: {
28
27
  type: "object",
29
28
  properties: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.174-beta",
3
+ "version": "0.0.176-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",