@ynhcj/xiaoyi-channel 0.0.77-next → 0.0.78-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.
@@ -1,14 +1,13 @@
1
1
  // Session manager for XY tool context
2
2
  // Stores active session contexts that tools can access
3
3
  import { AsyncLocalStorage } from "async_hooks";
4
- import { logger } from "../utils/logger.js";
5
4
  import { configManager } from "../utils/config-manager.js";
6
5
  import { toolCallNudgeManager } from "../utils/tool-call-nudge-manager.js";
7
6
  import { getCurrentTaskId, getCurrentMessageId } from "../task-manager.js";
8
7
  // Map of sessionKey -> SessionContextWithRef
9
8
  const activeSessions = new Map();
10
9
  activeSessions.__debugId = `map-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
11
- logger.log(`[SESSION-MGR] activeSessions Map created: ${activeSessions.__debugId}`);
10
+ console.log(`[SESSION-MGR] activeSessions Map created: ${activeSessions.__debugId}`);
12
11
  // AsyncLocalStorage for thread-safe session context isolation
13
12
  const asyncLocalStorage = new AsyncLocalStorage();
14
13
  /**
@@ -16,7 +15,7 @@ const asyncLocalStorage = new AsyncLocalStorage();
16
15
  * Should be called when starting to process a message.
17
16
  */
18
17
  export function registerSession(sessionKey, context) {
19
- logger.log(`[SESSION-MGR] registerSession: key=${sessionKey}, Map instance=${activeSessions.__debugId ?? "unknown"}, current size=${activeSessions.size}`);
18
+ console.log(`[SESSION-MGR] registerSession: key=${sessionKey}, Map instance=${activeSessions.__debugId ?? "unknown"}, current size=${activeSessions.size}`);
20
19
  const existing = activeSessions.get(sessionKey);
21
20
  if (existing) {
22
21
  // 更新上下文,增加引用计数
@@ -99,7 +98,7 @@ export function getCurrentSessionContext() {
99
98
  }
100
99
  // 2. Fallback: look up from global activeSessions Map
101
100
  if (activeSessions.size === 0) {
102
- logger.log(`[SESSION-MGR] ⚠️ getCurrentSessionContext: ALS lost, activeSessions.size=0 (Map instance=${activeSessions.__debugId ?? "unknown"})`);
101
+ console.log(`[SESSION-MGR] ⚠️ getCurrentSessionContext: ALS lost, activeSessions.size=0 (Map instance=${activeSessions.__debugId ?? "unknown"})`);
103
102
  return null;
104
103
  }
105
104
  // 2a. Single active session — return it directly
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.77-next",
3
+ "version": "0.0.78-next",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",