@ynhcj/xiaoyi-channel 0.0.207-next → 0.0.208-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/index.js +11 -8
- package/dist/src/bot.js +5 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -235,23 +235,26 @@ 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(`
|
|
238
|
+
touchHookMarker(`hook_fired_sessionKey=${ctx.sessionKey || "undefined"}`);
|
|
239
239
|
// Run skill-retriever first
|
|
240
240
|
const baseResult = await baseBeforePromptBuildHandler(event, ctx);
|
|
241
|
-
// Check for pending steer messages queued by bot.ts
|
|
242
|
-
|
|
243
|
-
|
|
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
|
+
const sessionKey = ctx.sessionKey;
|
|
246
|
+
if (!sessionKey)
|
|
244
247
|
return baseResult;
|
|
245
248
|
const queue = getSteerQueue();
|
|
246
|
-
const pending = queue.get(
|
|
249
|
+
const pending = queue.get(sessionKey);
|
|
247
250
|
if (!pending || pending.length === 0)
|
|
248
251
|
return baseResult;
|
|
249
252
|
// Drain pending steer messages
|
|
250
|
-
queue.delete(
|
|
253
|
+
queue.delete(sessionKey);
|
|
251
254
|
const steerText = pending.splice(0).join("\n\n");
|
|
252
255
|
const steerAppend = `\n用户追加诉求:${steerText}`;
|
|
253
|
-
logger.log(`[STEER-HOOK] Injecting steer:
|
|
254
|
-
touchHookMarker(`
|
|
256
|
+
logger.log(`[STEER-HOOK] Injecting steer: sessionKey=${sessionKey} textLen=${steerText.length}`);
|
|
257
|
+
touchHookMarker(`steer_injected_sessionKey=${sessionKey}_len=${steerText.length}`);
|
|
255
258
|
// Merge steer appendContext with skill-retriever's result
|
|
256
259
|
const merged = { ...(baseResult ?? {}) };
|
|
257
260
|
if (merged.appendContext) {
|
package/dist/src/bot.js
CHANGED
|
@@ -357,12 +357,11 @@ export async function handleXYMessage(params) {
|
|
|
357
357
|
// the model on the next turn without blocking.
|
|
358
358
|
if (isUpdate) {
|
|
359
359
|
const steerQueue = getSteerQueue();
|
|
360
|
-
// Use
|
|
361
|
-
//
|
|
362
|
-
//
|
|
363
|
-
//
|
|
364
|
-
|
|
365
|
-
const queueKey = parsed.sessionId;
|
|
360
|
+
// Use route.sessionKey as the queue key. The hook looks up by
|
|
361
|
+
// ctx.sessionKey which is the same value (agent:main:direct:<peerId>).
|
|
362
|
+
// Do NOT use parsed.sessionId because ctx.sessionId in the hook
|
|
363
|
+
// context is OpenClaw's internal random UUID, not the A2A sessionId.
|
|
364
|
+
const queueKey = route.sessionKey;
|
|
366
365
|
const pending = steerQueue.get(queueKey) ?? [];
|
|
367
366
|
pending.push(textForAgent);
|
|
368
367
|
steerQueue.set(queueKey, pending);
|