@ynhcj/xiaoyi-channel 0.0.193-beta → 0.0.194-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.
@@ -42,6 +42,9 @@ export async function handleMemoryQueryEvent(context, cfg) {
42
42
  case "MemoryStateSet":
43
43
  result = handleMemoryStateSet(params);
44
44
  break;
45
+ case "MemoryStateGet":
46
+ result = handleMemoryStateGet();
47
+ break;
45
48
  case "UserMdQuery":
46
49
  result = handleUserMdQuery();
47
50
  break;
@@ -135,6 +138,35 @@ function handleMemoryStateSet(params) {
135
138
  logger.log(`[MEMORY-QUERY] updated ${MEMORY_STATE_KEY}=${value} in ${filePath}`);
136
139
  return { code: 0 };
137
140
  }
141
+ /**
142
+ * Read MEMORYSTATE from .xiaoyiruntime and return its boolean value.
143
+ * Missing file or key defaults to false.
144
+ */
145
+ function handleMemoryStateGet() {
146
+ const filePath = resolveXiaoyiRuntimePath();
147
+ let content;
148
+ try {
149
+ content = readFileSync(filePath, "utf-8");
150
+ }
151
+ catch (err) {
152
+ if (err.code === "ENOENT") {
153
+ logger.log(`[MEMORY-QUERY] ${filePath} not found`);
154
+ }
155
+ else {
156
+ logger.error(`[MEMORY-QUERY] Failed to read ${filePath}:`, err);
157
+ }
158
+ return { memoryState: false };
159
+ }
160
+ for (const line of content.split("\n")) {
161
+ if (line.startsWith(`${MEMORY_STATE_KEY}=`)) {
162
+ const value = line.slice(`${MEMORY_STATE_KEY}=`.length).trim();
163
+ logger.log(`[MEMORY-QUERY] read ${MEMORY_STATE_KEY}=${value} from ${filePath}`);
164
+ return { memoryState: value === "true" };
165
+ }
166
+ }
167
+ logger.log(`[MEMORY-QUERY] ${MEMORY_STATE_KEY} not found in ${filePath}`);
168
+ return { memoryState: false };
169
+ }
138
170
  /**
139
171
  * Read ~/.openclaw/workspace/USER.md and return content in fileDetail.
140
172
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ynhcj/xiaoyi-channel",
3
- "version": "0.0.193-beta",
3
+ "version": "0.0.194-beta",
4
4
  "description": "OpenClaw Xiaoyi Channel plugin - Xiaoyi A2A protocol integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",