@alfe.ai/openclaw 0.0.33 → 0.0.35
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/plugin.d.cts +11 -0
- package/dist/plugin.d.ts +11 -0
- package/dist/plugin2.cjs +73 -51
- package/dist/plugin2.js +72 -51
- package/openclaw.plugin.json +0 -1
- package/package.json +1 -1
package/dist/plugin.d.cts
CHANGED
|
@@ -15,6 +15,12 @@ interface PluginLogger {
|
|
|
15
15
|
error(msg: string, ...args: unknown[]): void;
|
|
16
16
|
debug(msg: string, ...args: unknown[]): void;
|
|
17
17
|
}
|
|
18
|
+
interface PluginServiceContext {
|
|
19
|
+
config: Record<string, unknown>;
|
|
20
|
+
workspaceDir?: string;
|
|
21
|
+
stateDir: string;
|
|
22
|
+
logger: PluginLogger;
|
|
23
|
+
}
|
|
18
24
|
interface PluginApi {
|
|
19
25
|
logger: PluginLogger;
|
|
20
26
|
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
@@ -26,6 +32,11 @@ interface PluginApi {
|
|
|
26
32
|
};
|
|
27
33
|
};
|
|
28
34
|
registerTool(tool: ToolDef): void;
|
|
35
|
+
registerService?(service: {
|
|
36
|
+
id: string;
|
|
37
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
38
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
39
|
+
}): void;
|
|
29
40
|
}
|
|
30
41
|
declare const plugin: {
|
|
31
42
|
id: string;
|
package/dist/plugin.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ interface PluginLogger {
|
|
|
15
15
|
error(msg: string, ...args: unknown[]): void;
|
|
16
16
|
debug(msg: string, ...args: unknown[]): void;
|
|
17
17
|
}
|
|
18
|
+
interface PluginServiceContext {
|
|
19
|
+
config: Record<string, unknown>;
|
|
20
|
+
workspaceDir?: string;
|
|
21
|
+
stateDir: string;
|
|
22
|
+
logger: PluginLogger;
|
|
23
|
+
}
|
|
18
24
|
interface PluginApi {
|
|
19
25
|
logger: PluginLogger;
|
|
20
26
|
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
@@ -26,6 +32,11 @@ interface PluginApi {
|
|
|
26
32
|
};
|
|
27
33
|
};
|
|
28
34
|
registerTool(tool: ToolDef): void;
|
|
35
|
+
registerService?(service: {
|
|
36
|
+
id: string;
|
|
37
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
38
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
39
|
+
}): void;
|
|
29
40
|
}
|
|
30
41
|
declare const plugin: {
|
|
31
42
|
id: string;
|
package/dist/plugin2.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
32
32
|
//#endregion
|
|
33
33
|
let node_path = require("node:path");
|
|
34
34
|
let node_os = require("node:os");
|
|
35
|
+
let node_module = require("node:module");
|
|
35
36
|
let _alfe_ai_config = require("@alfe.ai/config");
|
|
36
37
|
let _alfe_ai_agent_api_client = require("@alfe.ai/agent-api-client");
|
|
37
38
|
let node_net = require("node:net");
|
|
@@ -3079,6 +3080,7 @@ async function registerWithDaemon(client, log, pluginName = "@alfe.ai/openclaw")
|
|
|
3079
3080
|
*
|
|
3080
3081
|
* Follows the same plugin pattern as @alfe.ai/openclaw-voice.
|
|
3081
3082
|
*/
|
|
3083
|
+
const pkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("../package.json");
|
|
3082
3084
|
const DEFAULT_SOCKET_PATH = (0, node_path.join)((0, node_os.homedir)(), ".alfe", "gateway.sock");
|
|
3083
3085
|
let ipcClient = null;
|
|
3084
3086
|
function ok(result) {
|
|
@@ -3177,7 +3179,7 @@ const plugin = {
|
|
|
3177
3179
|
id: "@alfe.ai/openclaw",
|
|
3178
3180
|
name: "Alfe OpenClaw Plugin",
|
|
3179
3181
|
description: "Connects OpenClaw to the local Alfe gateway daemon",
|
|
3180
|
-
version:
|
|
3182
|
+
version: pkg.version,
|
|
3181
3183
|
activate(api) {
|
|
3182
3184
|
const log = api.logger;
|
|
3183
3185
|
let cfg = null;
|
|
@@ -3194,68 +3196,88 @@ const plugin = {
|
|
|
3194
3196
|
for (const tool of tools) api.registerTool(tool);
|
|
3195
3197
|
log.info(`Registered ${String(tools.length)} integration tools: ${tools.map((t) => t.name).join(", ")}`);
|
|
3196
3198
|
}
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
}
|
|
3202
|
-
globalThis.__alfeOpenclawPluginActivated = true;
|
|
3203
|
-
if (ipcClient) {
|
|
3204
|
-
log.warn("Stopping stale IPC client from prior activation");
|
|
3205
|
-
ipcClient.stop();
|
|
3206
|
-
ipcClient = null;
|
|
3207
|
-
}
|
|
3208
|
-
log.info("Alfe OpenClaw Plugin activating...");
|
|
3209
|
-
const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
|
|
3210
|
-
ipcClient = new IPCClient(socketPath);
|
|
3211
|
-
ipcClient.on("event", (event, payload) => {
|
|
3212
|
-
switch (event) {
|
|
3213
|
-
case "cloud.status": {
|
|
3214
|
-
const status = payload;
|
|
3215
|
-
log.info(`Alfe cloud: ${status.connected ? "connected" : "disconnected"}`);
|
|
3216
|
-
break;
|
|
3217
|
-
}
|
|
3218
|
-
case "daemon.shutdown":
|
|
3219
|
-
log.info("Daemon shutting down — will reconnect when available");
|
|
3220
|
-
break;
|
|
3221
|
-
default: log.debug(`Daemon event: ${event}`, payload);
|
|
3199
|
+
const startDaemonIpc = () => {
|
|
3200
|
+
if (globalThis.__alfeOpenclawPluginActivated === true) {
|
|
3201
|
+
log.debug("Alfe OpenClaw Plugin already activated — skipping duplicate");
|
|
3202
|
+
return;
|
|
3222
3203
|
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3204
|
+
globalThis.__alfeOpenclawPluginActivated = true;
|
|
3205
|
+
if (ipcClient) {
|
|
3206
|
+
log.warn("Stopping stale IPC client from prior activation");
|
|
3207
|
+
ipcClient.stop();
|
|
3208
|
+
ipcClient = null;
|
|
3209
|
+
}
|
|
3210
|
+
log.info("Alfe OpenClaw Plugin activating...");
|
|
3211
|
+
const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
|
|
3212
|
+
ipcClient = new IPCClient(socketPath);
|
|
3213
|
+
ipcClient.on("event", (event, payload) => {
|
|
3214
|
+
switch (event) {
|
|
3215
|
+
case "cloud.status": {
|
|
3216
|
+
const status = payload;
|
|
3217
|
+
log.info(`Alfe cloud: ${status.connected ? "connected" : "disconnected"}`);
|
|
3218
|
+
break;
|
|
3219
|
+
}
|
|
3220
|
+
case "daemon.shutdown":
|
|
3221
|
+
log.info("Daemon shutting down — will reconnect when available");
|
|
3222
|
+
break;
|
|
3223
|
+
default: log.debug(`Daemon event: ${event}`, payload);
|
|
3231
3224
|
}
|
|
3232
3225
|
});
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3226
|
+
ipcClient.on("request", (method, _params, respond) => {
|
|
3227
|
+
log.info(`Daemon request: ${method}`);
|
|
3228
|
+
respond({
|
|
3229
|
+
ok: false,
|
|
3230
|
+
error: {
|
|
3231
|
+
code: "UNKNOWN_METHOD",
|
|
3232
|
+
message: `Plugin does not handle method: ${method}`
|
|
3233
|
+
}
|
|
3234
|
+
});
|
|
3239
3235
|
});
|
|
3236
|
+
const ipc = ipcClient;
|
|
3237
|
+
ipcClient.on("connected", () => {
|
|
3238
|
+
log.info("Connected to Alfe daemon — registering capabilities...");
|
|
3239
|
+
registerWithDaemon(ipc, log, plugin.id).then((result) => {
|
|
3240
|
+
if (!result) log.error("Failed to register with daemon — commands may not be routed");
|
|
3241
|
+
});
|
|
3242
|
+
});
|
|
3243
|
+
ipcClient.on("disconnected", (reason) => {
|
|
3244
|
+
log.warn(`Disconnected from Alfe daemon: ${reason}`);
|
|
3245
|
+
});
|
|
3246
|
+
ipcClient.on("error", (err) => {
|
|
3247
|
+
log.error(`IPC error: ${err.message}`);
|
|
3248
|
+
});
|
|
3249
|
+
ipcClient.start();
|
|
3250
|
+
log.info(`Alfe OpenClaw Plugin activated (socket: ${socketPath})`);
|
|
3251
|
+
};
|
|
3252
|
+
const stopDaemonIpc = () => {
|
|
3253
|
+
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3254
|
+
if (ipcClient) {
|
|
3255
|
+
ipcClient.stop();
|
|
3256
|
+
ipcClient = null;
|
|
3257
|
+
}
|
|
3258
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3259
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3260
|
+
};
|
|
3261
|
+
if (api.registerService) api.registerService({
|
|
3262
|
+
id: "alfe-daemon-ipc",
|
|
3263
|
+
start: () => {
|
|
3264
|
+
startDaemonIpc();
|
|
3265
|
+
},
|
|
3266
|
+
stop: () => {
|
|
3267
|
+
stopDaemonIpc();
|
|
3268
|
+
}
|
|
3240
3269
|
});
|
|
3241
|
-
|
|
3242
|
-
log.warn(`Disconnected from Alfe daemon: ${reason}`);
|
|
3243
|
-
});
|
|
3244
|
-
ipcClient.on("error", (err) => {
|
|
3245
|
-
log.error(`IPC error: ${err.message}`);
|
|
3246
|
-
});
|
|
3247
|
-
ipcClient.start();
|
|
3248
|
-
log.info(`Alfe OpenClaw Plugin activated (socket: ${socketPath})`);
|
|
3270
|
+
else startDaemonIpc();
|
|
3249
3271
|
},
|
|
3250
3272
|
deactivate(api) {
|
|
3251
3273
|
const log = api.logger;
|
|
3252
|
-
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3253
3274
|
if (ipcClient) {
|
|
3275
|
+
log.info("Alfe OpenClaw Plugin deactivating (legacy)...");
|
|
3254
3276
|
ipcClient.stop();
|
|
3255
3277
|
ipcClient = null;
|
|
3278
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3279
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3256
3280
|
}
|
|
3257
|
-
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3258
|
-
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3259
3281
|
}
|
|
3260
3282
|
};
|
|
3261
3283
|
//#endregion
|
package/dist/plugin2.js
CHANGED
|
@@ -3081,6 +3081,7 @@ async function registerWithDaemon(client, log, pluginName = "@alfe.ai/openclaw")
|
|
|
3081
3081
|
*
|
|
3082
3082
|
* Follows the same plugin pattern as @alfe.ai/openclaw-voice.
|
|
3083
3083
|
*/
|
|
3084
|
+
const pkg = createRequire(import.meta.url)("../package.json");
|
|
3084
3085
|
const DEFAULT_SOCKET_PATH = join(homedir(), ".alfe", "gateway.sock");
|
|
3085
3086
|
let ipcClient = null;
|
|
3086
3087
|
function ok(result) {
|
|
@@ -3179,7 +3180,7 @@ const plugin = {
|
|
|
3179
3180
|
id: "@alfe.ai/openclaw",
|
|
3180
3181
|
name: "Alfe OpenClaw Plugin",
|
|
3181
3182
|
description: "Connects OpenClaw to the local Alfe gateway daemon",
|
|
3182
|
-
version:
|
|
3183
|
+
version: pkg.version,
|
|
3183
3184
|
activate(api) {
|
|
3184
3185
|
const log = api.logger;
|
|
3185
3186
|
let cfg = null;
|
|
@@ -3196,68 +3197,88 @@ const plugin = {
|
|
|
3196
3197
|
for (const tool of tools) api.registerTool(tool);
|
|
3197
3198
|
log.info(`Registered ${String(tools.length)} integration tools: ${tools.map((t) => t.name).join(", ")}`);
|
|
3198
3199
|
}
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
}
|
|
3204
|
-
globalThis.__alfeOpenclawPluginActivated = true;
|
|
3205
|
-
if (ipcClient) {
|
|
3206
|
-
log.warn("Stopping stale IPC client from prior activation");
|
|
3207
|
-
ipcClient.stop();
|
|
3208
|
-
ipcClient = null;
|
|
3209
|
-
}
|
|
3210
|
-
log.info("Alfe OpenClaw Plugin activating...");
|
|
3211
|
-
const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
|
|
3212
|
-
ipcClient = new IPCClient(socketPath);
|
|
3213
|
-
ipcClient.on("event", (event, payload) => {
|
|
3214
|
-
switch (event) {
|
|
3215
|
-
case "cloud.status": {
|
|
3216
|
-
const status = payload;
|
|
3217
|
-
log.info(`Alfe cloud: ${status.connected ? "connected" : "disconnected"}`);
|
|
3218
|
-
break;
|
|
3219
|
-
}
|
|
3220
|
-
case "daemon.shutdown":
|
|
3221
|
-
log.info("Daemon shutting down — will reconnect when available");
|
|
3222
|
-
break;
|
|
3223
|
-
default: log.debug(`Daemon event: ${event}`, payload);
|
|
3200
|
+
const startDaemonIpc = () => {
|
|
3201
|
+
if (globalThis.__alfeOpenclawPluginActivated === true) {
|
|
3202
|
+
log.debug("Alfe OpenClaw Plugin already activated — skipping duplicate");
|
|
3203
|
+
return;
|
|
3224
3204
|
}
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3205
|
+
globalThis.__alfeOpenclawPluginActivated = true;
|
|
3206
|
+
if (ipcClient) {
|
|
3207
|
+
log.warn("Stopping stale IPC client from prior activation");
|
|
3208
|
+
ipcClient.stop();
|
|
3209
|
+
ipcClient = null;
|
|
3210
|
+
}
|
|
3211
|
+
log.info("Alfe OpenClaw Plugin activating...");
|
|
3212
|
+
const socketPath = ((api.config ?? {}).plugins?.entries?.["@alfe.ai/openclaw"]?.config ?? {}).socketPath ?? process.env.ALFE_GATEWAY_SOCKET ?? DEFAULT_SOCKET_PATH;
|
|
3213
|
+
ipcClient = new IPCClient(socketPath);
|
|
3214
|
+
ipcClient.on("event", (event, payload) => {
|
|
3215
|
+
switch (event) {
|
|
3216
|
+
case "cloud.status": {
|
|
3217
|
+
const status = payload;
|
|
3218
|
+
log.info(`Alfe cloud: ${status.connected ? "connected" : "disconnected"}`);
|
|
3219
|
+
break;
|
|
3220
|
+
}
|
|
3221
|
+
case "daemon.shutdown":
|
|
3222
|
+
log.info("Daemon shutting down — will reconnect when available");
|
|
3223
|
+
break;
|
|
3224
|
+
default: log.debug(`Daemon event: ${event}`, payload);
|
|
3233
3225
|
}
|
|
3234
3226
|
});
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3227
|
+
ipcClient.on("request", (method, _params, respond) => {
|
|
3228
|
+
log.info(`Daemon request: ${method}`);
|
|
3229
|
+
respond({
|
|
3230
|
+
ok: false,
|
|
3231
|
+
error: {
|
|
3232
|
+
code: "UNKNOWN_METHOD",
|
|
3233
|
+
message: `Plugin does not handle method: ${method}`
|
|
3234
|
+
}
|
|
3235
|
+
});
|
|
3241
3236
|
});
|
|
3237
|
+
const ipc = ipcClient;
|
|
3238
|
+
ipcClient.on("connected", () => {
|
|
3239
|
+
log.info("Connected to Alfe daemon — registering capabilities...");
|
|
3240
|
+
registerWithDaemon(ipc, log, plugin.id).then((result) => {
|
|
3241
|
+
if (!result) log.error("Failed to register with daemon — commands may not be routed");
|
|
3242
|
+
});
|
|
3243
|
+
});
|
|
3244
|
+
ipcClient.on("disconnected", (reason) => {
|
|
3245
|
+
log.warn(`Disconnected from Alfe daemon: ${reason}`);
|
|
3246
|
+
});
|
|
3247
|
+
ipcClient.on("error", (err) => {
|
|
3248
|
+
log.error(`IPC error: ${err.message}`);
|
|
3249
|
+
});
|
|
3250
|
+
ipcClient.start();
|
|
3251
|
+
log.info(`Alfe OpenClaw Plugin activated (socket: ${socketPath})`);
|
|
3252
|
+
};
|
|
3253
|
+
const stopDaemonIpc = () => {
|
|
3254
|
+
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3255
|
+
if (ipcClient) {
|
|
3256
|
+
ipcClient.stop();
|
|
3257
|
+
ipcClient = null;
|
|
3258
|
+
}
|
|
3259
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3260
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3261
|
+
};
|
|
3262
|
+
if (api.registerService) api.registerService({
|
|
3263
|
+
id: "alfe-daemon-ipc",
|
|
3264
|
+
start: () => {
|
|
3265
|
+
startDaemonIpc();
|
|
3266
|
+
},
|
|
3267
|
+
stop: () => {
|
|
3268
|
+
stopDaemonIpc();
|
|
3269
|
+
}
|
|
3242
3270
|
});
|
|
3243
|
-
|
|
3244
|
-
log.warn(`Disconnected from Alfe daemon: ${reason}`);
|
|
3245
|
-
});
|
|
3246
|
-
ipcClient.on("error", (err) => {
|
|
3247
|
-
log.error(`IPC error: ${err.message}`);
|
|
3248
|
-
});
|
|
3249
|
-
ipcClient.start();
|
|
3250
|
-
log.info(`Alfe OpenClaw Plugin activated (socket: ${socketPath})`);
|
|
3271
|
+
else startDaemonIpc();
|
|
3251
3272
|
},
|
|
3252
3273
|
deactivate(api) {
|
|
3253
3274
|
const log = api.logger;
|
|
3254
|
-
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3255
3275
|
if (ipcClient) {
|
|
3276
|
+
log.info("Alfe OpenClaw Plugin deactivating (legacy)...");
|
|
3256
3277
|
ipcClient.stop();
|
|
3257
3278
|
ipcClient = null;
|
|
3279
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3280
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3258
3281
|
}
|
|
3259
|
-
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3260
|
-
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3261
3282
|
}
|
|
3262
3283
|
};
|
|
3263
3284
|
//#endregion
|
package/openclaw.plugin.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "@alfe.ai/openclaw",
|
|
3
3
|
"name": "Alfe Integration Plugin",
|
|
4
|
-
"version": "0.1.0",
|
|
5
4
|
"description": "Connects OpenClaw to the local Alfe gateway daemon for remote integration management via the Alfe dashboard.",
|
|
6
5
|
"entry": "./dist/plugin.js",
|
|
7
6
|
"configSchema": {
|
package/package.json
CHANGED