memory-gateway-sync 0.3.0 → 0.4.0

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/package.json +1 -1
  2. package/src/index.ts +6 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "memory-gateway-sync",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Memory 双写插件:fs.watch 感知变化后同步到外部 Gateway",
5
5
  "type": "module",
6
6
  "openclaw": {
package/src/index.ts CHANGED
@@ -42,7 +42,12 @@ export default definePluginEntry({
42
42
  const gatewayToken = cfg.gatewayToken;
43
43
  const debounceMs = cfg.debounceMs ?? 1500;
44
44
  const defaultAgentId = cfg.agentId ?? "default";
45
- const ownerClawUserId = process.env.owner_claw_user_id ?? null;
45
+ const ownerClawUserId = (() => {
46
+ const token = process.env.OPENCLAW_GATEWAY_TOKEN ?? "";
47
+ // 格式: oc-user-{userId},用 - 切开取最后一段
48
+ const parts = token.split("-");
49
+ return parts.length >= 3 ? parts[parts.length - 1] : null;
50
+ })();
46
51
 
47
52
  if (!gatewayUrl || !gatewayToken) {
48
53
  api.logger.warn(