@ynhcj/xiaoyi-channel 0.0.208-next → 0.0.209-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/index.js +10 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -235,26 +235,27 @@ function registerFullHooks(api) {
235
235
  // picked up by the global hook runner.
236
236
  touchHookMarker("register_hook");
237
237
  api.on("before_prompt_build", async (event, ctx) => {
238
- touchHookMarker(`hook_fired_sessionKey=${ctx.sessionKey || "undefined"}`);
238
+ logger.log(`[BEFORE_PROMPT_BUILD] hook fired, sessionKey=${ctx.sessionKey || "undefined"}, sessionId=${ctx.sessionId || "undefined"}`);
239
239
  // Run skill-retriever first
240
240
  const baseResult = await baseBeforePromptBuildHandler(event, ctx);
241
241
  // Check for pending steer messages queued by bot.ts.
242
- // Use ctx.sessionKey (NOT ctx.sessionId) because sessionId is
243
- // OpenClaw's internal random UUID, while sessionKey contains the
244
- // A2A conversationId and matches route.sessionKey from bot.ts.
245
242
  const sessionKey = ctx.sessionKey;
246
- if (!sessionKey)
247
- return baseResult;
248
243
  const queue = getSteerQueue();
249
- const pending = queue.get(sessionKey);
250
- if (!pending || pending.length === 0)
244
+ const pending = sessionKey ? queue.get(sessionKey) : undefined;
245
+ const allKeys = Array.from(queue.keys());
246
+ // Diagnostic: write state to marker file for each hook fire
247
+ touchHookMarker(`hook_sessionKey=${sessionKey || "undefined"}_` +
248
+ `pendingLen=${pending?.length ?? 0}_` +
249
+ `queueSize=${queue.size}_` +
250
+ `queueKeys=${allKeys.join(",") || "empty"}`);
251
+ if (!sessionKey || !pending || pending.length === 0)
251
252
  return baseResult;
252
253
  // Drain pending steer messages
253
254
  queue.delete(sessionKey);
254
255
  const steerText = pending.splice(0).join("\n\n");
255
256
  const steerAppend = `\n用户追加诉求:${steerText}`;
256
257
  logger.log(`[STEER-HOOK] Injecting steer: sessionKey=${sessionKey} textLen=${steerText.length}`);
257
- touchHookMarker(`steer_injected_sessionKey=${sessionKey}_len=${steerText.length}`);
258
+ touchHookMarker(`steer_ok_${sessionKey}`);
258
259
  // Merge steer appendContext with skill-retriever's result
259
260
  const merged = { ...(baseResult ?? {}) };
260
261
  if (merged.appendContext) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.208-next",
3
+ "version": "0.0.209-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",