@alfe.ai/openclaw-identity 0.0.18 → 0.0.19
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.
- package/dist/plugin2.cjs +16 -21
- package/dist/plugin2.js +16 -21
- package/package.json +1 -1
package/dist/plugin2.cjs
CHANGED
|
@@ -180,8 +180,16 @@ function defineTool(def) {
|
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
let cachedClient = null;
|
|
184
|
+
function getClient() {
|
|
185
|
+
if (cachedClient) return cachedClient;
|
|
186
|
+
const config = (0, _alfe_ai_config.resolveConfig)();
|
|
187
|
+
cachedClient = new _alfe_ai_agent_api_client.AgentApiClient({
|
|
188
|
+
apiKey: config.apiKey,
|
|
189
|
+
apiUrl: config.apiUrl
|
|
190
|
+
});
|
|
191
|
+
return cachedClient;
|
|
192
|
+
}
|
|
185
193
|
const plugin = {
|
|
186
194
|
id: "@alfe.ai/openclaw-identity",
|
|
187
195
|
name: "Alfe Identity",
|
|
@@ -189,24 +197,11 @@ const plugin = {
|
|
|
189
197
|
version: pkg.version,
|
|
190
198
|
activate(api) {
|
|
191
199
|
const log = api.logger;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
log.info("Alfe Identity plugin activating...");
|
|
198
|
-
let client;
|
|
199
|
-
try {
|
|
200
|
-
const config = (0, _alfe_ai_config.resolveConfig)();
|
|
201
|
-
client = new _alfe_ai_agent_api_client.AgentApiClient({
|
|
202
|
-
apiKey: config.apiKey,
|
|
203
|
-
apiUrl: config.apiUrl
|
|
204
|
-
});
|
|
205
|
-
} catch (err) {
|
|
206
|
-
g[ACTIVATED_KEY] = false;
|
|
207
|
-
log.error(`Identity plugin: failed to resolve config — ${err instanceof Error ? err.message : String(err)}`);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
200
|
+
const client = new Proxy({}, { get(_t, prop) {
|
|
201
|
+
const c = getClient();
|
|
202
|
+
const v = c[prop];
|
|
203
|
+
return typeof v === "function" ? v.bind(c) : v;
|
|
204
|
+
} });
|
|
210
205
|
const tools = [
|
|
211
206
|
defineTool({
|
|
212
207
|
name: "who_is_this",
|
|
@@ -475,7 +470,7 @@ const plugin = {
|
|
|
475
470
|
log.info("Alfe Identity plugin activated");
|
|
476
471
|
},
|
|
477
472
|
deactivate(api) {
|
|
478
|
-
|
|
473
|
+
cachedClient = null;
|
|
479
474
|
api.logger.info("Alfe Identity plugin deactivated");
|
|
480
475
|
}
|
|
481
476
|
};
|
package/dist/plugin2.js
CHANGED
|
@@ -180,8 +180,16 @@ function defineTool(def) {
|
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
}
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
let cachedClient = null;
|
|
184
|
+
function getClient() {
|
|
185
|
+
if (cachedClient) return cachedClient;
|
|
186
|
+
const config = resolveConfig();
|
|
187
|
+
cachedClient = new AgentApiClient({
|
|
188
|
+
apiKey: config.apiKey,
|
|
189
|
+
apiUrl: config.apiUrl
|
|
190
|
+
});
|
|
191
|
+
return cachedClient;
|
|
192
|
+
}
|
|
185
193
|
const plugin = {
|
|
186
194
|
id: "@alfe.ai/openclaw-identity",
|
|
187
195
|
name: "Alfe Identity",
|
|
@@ -189,24 +197,11 @@ const plugin = {
|
|
|
189
197
|
version: pkg.version,
|
|
190
198
|
activate(api) {
|
|
191
199
|
const log = api.logger;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
log.info("Alfe Identity plugin activating...");
|
|
198
|
-
let client;
|
|
199
|
-
try {
|
|
200
|
-
const config = resolveConfig();
|
|
201
|
-
client = new AgentApiClient({
|
|
202
|
-
apiKey: config.apiKey,
|
|
203
|
-
apiUrl: config.apiUrl
|
|
204
|
-
});
|
|
205
|
-
} catch (err) {
|
|
206
|
-
g[ACTIVATED_KEY] = false;
|
|
207
|
-
log.error(`Identity plugin: failed to resolve config — ${err instanceof Error ? err.message : String(err)}`);
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
200
|
+
const client = new Proxy({}, { get(_t, prop) {
|
|
201
|
+
const c = getClient();
|
|
202
|
+
const v = c[prop];
|
|
203
|
+
return typeof v === "function" ? v.bind(c) : v;
|
|
204
|
+
} });
|
|
210
205
|
const tools = [
|
|
211
206
|
defineTool({
|
|
212
207
|
name: "who_is_this",
|
|
@@ -475,7 +470,7 @@ const plugin = {
|
|
|
475
470
|
log.info("Alfe Identity plugin activated");
|
|
476
471
|
},
|
|
477
472
|
deactivate(api) {
|
|
478
|
-
|
|
473
|
+
cachedClient = null;
|
|
479
474
|
api.logger.info("Alfe Identity plugin deactivated");
|
|
480
475
|
}
|
|
481
476
|
};
|
package/package.json
CHANGED