@agether/openclaw-plugin 1.5.0 → 1.5.1

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 +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agether/openclaw-plugin",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "description": "OpenClaw plugin for Agether — on-chain credit for AI agents",
5
5
  "main": "src/index.ts",
6
6
  "openclaw": {
package/src/index.ts CHANGED
@@ -62,11 +62,15 @@ async function getBackendStatus(cfg: PluginConfig) {
62
62
  return data;
63
63
  }
64
64
 
65
+ // Module-level cache: survives across tool calls within the same process
66
+ let cachedAgentId: string | undefined;
67
+
65
68
  function createClient(cfg: PluginConfig, status: any): MorphoCreditClient {
69
+ const agentId = cachedAgentId || cfg.agentId;
66
70
  return new MorphoCreditClient({
67
71
  privateKey: cfg.privateKey,
68
72
  rpcUrl: cfg.rpcUrl,
69
- agentId: cfg.agentId,
73
+ agentId,
70
74
  contracts: {
71
75
  morphoCredit: status.contracts.morphoCredit,
72
76
  accountFactory: status.contracts.accountFactory,
@@ -118,6 +122,8 @@ export default function register(api: any) {
118
122
  const status = await getBackendStatus(cfg);
119
123
  const client = createClient(cfg, status);
120
124
  const result = await client.register(params.name);
125
+ // Cache agentId for subsequent tool calls
126
+ cachedAgentId = result.agentId;
121
127
  return ok(JSON.stringify({
122
128
  status: result.alreadyRegistered ? "already_registered" : "registered",
123
129
  agentId: result.agentId,