@ynhcj/xiaoyi 1.9.5 → 1.9.6

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/runtime.js +6 -5
  2. package/package.json +1 -1
package/dist/runtime.js CHANGED
@@ -127,13 +127,14 @@ class XiaoYiRuntime {
127
127
  }
128
128
  }
129
129
  exports.XiaoYiRuntime = XiaoYiRuntime;
130
- // Global runtime instance
131
- let globalRuntime = null;
130
+ // Global runtime instance - use global object to survive module reloads
131
+ const GLOBAL_KEY = Symbol.for('__xiaoyi_runtime_instance__');
132
132
  function getXiaoYiRuntime() {
133
- if (!globalRuntime) {
134
- globalRuntime = new XiaoYiRuntime();
133
+ const g = global;
134
+ if (!g[GLOBAL_KEY]) {
135
+ g[GLOBAL_KEY] = new XiaoYiRuntime();
135
136
  }
136
- return globalRuntime;
137
+ return g[GLOBAL_KEY];
137
138
  }
138
139
  function setXiaoYiRuntime(runtime) {
139
140
  getXiaoYiRuntime().setRuntime(runtime);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi",
3
- "version": "1.9.5",
3
+ "version": "1.9.6",
4
4
  "description": "XiaoYi channel plugin for OpenClaw",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",