a2a-xmtp 1.4.4 → 1.4.5

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 +3 -5
  2. package/src/index.ts +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a2a-xmtp",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "type": "module",
5
5
  "main": "src/index.ts",
6
6
  "description": "Decentralized Agent-to-Agent E2EE messaging for OpenClaw via XMTP",
@@ -18,7 +18,8 @@
18
18
  "build": "tsc",
19
19
  "test": "vitest run",
20
20
  "test:watch": "vitest",
21
- "lint": "tsc --noEmit"
21
+ "lint": "tsc --noEmit",
22
+ "server": "node --import tsx src/server/index.ts"
22
23
  },
23
24
  "dependencies": {
24
25
  "@xmtp/agent-sdk": "^2.3.0",
@@ -29,9 +30,6 @@
29
30
  "vitest": "^3.0.0",
30
31
  "@types/node": "^22.0.0"
31
32
  },
32
- "peerDependencies": {
33
- "openclaw": "*"
34
- },
35
33
  "openclaw": {
36
34
  "extensions": [
37
35
  "./src/index.ts"
package/src/index.ts CHANGED
@@ -20,15 +20,19 @@ import { DEFAULT_PLUGIN_CONFIG, type PluginConfig } from "./types.js";
20
20
 
21
21
  const AGENT_ID = "main"; // OpenClaw 默认 agent
22
22
 
23
+ // Module-level singletons: OpenClaw may call register() multiple times from different
24
+ // subsystems (gateway, plugins) within the same process. Shared state must live at
25
+ // module scope so all closures (tools, HTTP routes, service) reference the same instances.
26
+ const bridges = new Map<string, XmtpBridge>();
27
+ let registry: IdentityRegistry;
28
+ let policyEngine: PolicyEngine;
29
+
23
30
  export default definePluginEntry({
24
31
  id: "a2a-xmtp",
25
32
  name: "Agent-to-Agent IM (XMTP)",
26
33
  description: "Decentralized Agent-to-Agent E2EE messaging powered by XMTP protocol",
27
34
 
28
35
  register(api) {
29
- const bridges = new Map<string, XmtpBridge>();
30
- let registry: IdentityRegistry;
31
- let policyEngine: PolicyEngine;
32
36
 
33
37
  // ── 1. 注册 Tools ──
34
38