@alfe.ai/openclaw 0.0.33 → 0.0.34
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 +66 -50
- package/dist/plugin2.js +66 -50
- 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
|
@@ -3194,68 +3194,84 @@ const plugin = {
|
|
|
3194
3194
|
for (const tool of tools) api.registerTool(tool);
|
|
3195
3195
|
log.info(`Registered ${String(tools.length)} integration tools: ${tools.map((t) => t.name).join(", ")}`);
|
|
3196
3196
|
}
|
|
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);
|
|
3197
|
+
const startDaemonIpc = () => {
|
|
3198
|
+
if (globalThis.__alfeOpenclawPluginActivated === true) {
|
|
3199
|
+
log.debug("Alfe OpenClaw Plugin already activated — skipping duplicate");
|
|
3200
|
+
return;
|
|
3222
3201
|
}
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
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);
|
|
3231
3222
|
}
|
|
3232
3223
|
});
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3224
|
+
ipcClient.on("request", (method, _params, respond) => {
|
|
3225
|
+
log.info(`Daemon request: ${method}`);
|
|
3226
|
+
respond({
|
|
3227
|
+
ok: false,
|
|
3228
|
+
error: {
|
|
3229
|
+
code: "UNKNOWN_METHOD",
|
|
3230
|
+
message: `Plugin does not handle method: ${method}`
|
|
3231
|
+
}
|
|
3232
|
+
});
|
|
3239
3233
|
});
|
|
3234
|
+
const ipc = ipcClient;
|
|
3235
|
+
ipcClient.on("connected", () => {
|
|
3236
|
+
log.info("Connected to Alfe daemon — registering capabilities...");
|
|
3237
|
+
registerWithDaemon(ipc, log, plugin.id).then((result) => {
|
|
3238
|
+
if (!result) log.error("Failed to register with daemon — commands may not be routed");
|
|
3239
|
+
});
|
|
3240
|
+
});
|
|
3241
|
+
ipcClient.on("disconnected", (reason) => {
|
|
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})`);
|
|
3249
|
+
};
|
|
3250
|
+
const stopDaemonIpc = () => {
|
|
3251
|
+
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3252
|
+
if (ipcClient) {
|
|
3253
|
+
ipcClient.stop();
|
|
3254
|
+
ipcClient = null;
|
|
3255
|
+
}
|
|
3256
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3257
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3258
|
+
};
|
|
3259
|
+
if (api.registerService) api.registerService({
|
|
3260
|
+
id: "alfe-daemon-ipc",
|
|
3261
|
+
start: () => startDaemonIpc(),
|
|
3262
|
+
stop: () => stopDaemonIpc()
|
|
3240
3263
|
});
|
|
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})`);
|
|
3264
|
+
else startDaemonIpc();
|
|
3249
3265
|
},
|
|
3250
3266
|
deactivate(api) {
|
|
3251
3267
|
const log = api.logger;
|
|
3252
|
-
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3253
3268
|
if (ipcClient) {
|
|
3269
|
+
log.info("Alfe OpenClaw Plugin deactivating (legacy)...");
|
|
3254
3270
|
ipcClient.stop();
|
|
3255
3271
|
ipcClient = null;
|
|
3272
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3273
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3256
3274
|
}
|
|
3257
|
-
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3258
|
-
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3259
3275
|
}
|
|
3260
3276
|
};
|
|
3261
3277
|
//#endregion
|
package/dist/plugin2.js
CHANGED
|
@@ -3196,68 +3196,84 @@ const plugin = {
|
|
|
3196
3196
|
for (const tool of tools) api.registerTool(tool);
|
|
3197
3197
|
log.info(`Registered ${String(tools.length)} integration tools: ${tools.map((t) => t.name).join(", ")}`);
|
|
3198
3198
|
}
|
|
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);
|
|
3199
|
+
const startDaemonIpc = () => {
|
|
3200
|
+
if (globalThis.__alfeOpenclawPluginActivated === true) {
|
|
3201
|
+
log.debug("Alfe OpenClaw Plugin already activated — skipping duplicate");
|
|
3202
|
+
return;
|
|
3224
3203
|
}
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
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);
|
|
3233
3224
|
}
|
|
3234
3225
|
});
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
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
|
+
});
|
|
3241
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: () => startDaemonIpc(),
|
|
3264
|
+
stop: () => stopDaemonIpc()
|
|
3242
3265
|
});
|
|
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})`);
|
|
3266
|
+
else startDaemonIpc();
|
|
3251
3267
|
},
|
|
3252
3268
|
deactivate(api) {
|
|
3253
3269
|
const log = api.logger;
|
|
3254
|
-
log.info("Alfe OpenClaw Plugin deactivating...");
|
|
3255
3270
|
if (ipcClient) {
|
|
3271
|
+
log.info("Alfe OpenClaw Plugin deactivating (legacy)...");
|
|
3256
3272
|
ipcClient.stop();
|
|
3257
3273
|
ipcClient = null;
|
|
3274
|
+
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3275
|
+
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3258
3276
|
}
|
|
3259
|
-
globalThis.__alfeOpenclawPluginActivated = false;
|
|
3260
|
-
log.info("Alfe OpenClaw Plugin deactivated");
|
|
3261
3277
|
}
|
|
3262
3278
|
};
|
|
3263
3279
|
//#endregion
|
package/package.json
CHANGED