@alfe.ai/openclaw-console 0.0.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.
- package/dist/index.cjs +2 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/plugin.cjs +79 -0
- package/dist/plugin.d.cts +45 -0
- package/dist/plugin.d.ts +45 -0
- package/dist/plugin.js +79 -0
- package/openclaw.plugin.json +16 -0
- package/package.json +49 -0
package/dist/index.cjs
ADDED
package/dist/index.d.cts
ADDED
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
let node_module = require("node:module");
|
|
2
|
+
let _alfe_ai_console_client = require("@alfe.ai/console-client");
|
|
3
|
+
//#region src/plugin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Alfe Console plugin for OpenClaw.
|
|
6
|
+
*
|
|
7
|
+
* On activate, opens an outbound WS to the Alfe console service via
|
|
8
|
+
* `@alfe.ai/console-client`. The console service multiplexes browser
|
|
9
|
+
* sessions over that WS using the binary tunnel protocol; the client
|
|
10
|
+
* proxies each tunneled request to the local OpenClaw gateway on
|
|
11
|
+
* `localhost:18789` and streams responses back.
|
|
12
|
+
*
|
|
13
|
+
* The gateway token never leaves the agent host — the client reads it
|
|
14
|
+
* from `~/.openclaw/openclaw.json` on demand.
|
|
15
|
+
*/
|
|
16
|
+
const pkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("../package.json");
|
|
17
|
+
let consoleClient = null;
|
|
18
|
+
const plugin = {
|
|
19
|
+
id: "@alfe.ai/openclaw-console",
|
|
20
|
+
name: "Alfe Console Plugin",
|
|
21
|
+
description: "Bridges the Alfe console service to the local OpenClaw control gateway",
|
|
22
|
+
version: pkg.version,
|
|
23
|
+
activate(api) {
|
|
24
|
+
const log = api.logger;
|
|
25
|
+
const pluginConfig = (((api.config ?? {}).plugins?.entries)?.["@alfe.ai/openclaw-console"] ?? {}).config ?? {};
|
|
26
|
+
const startConsoleClient = () => {
|
|
27
|
+
if (globalThis.__alfeConsolePluginActivated === true) {
|
|
28
|
+
log.debug("Console plugin already activated — skipping duplicate");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
globalThis.__alfeConsolePluginActivated = true;
|
|
32
|
+
const { apiKey, consoleWsUrl } = (0, _alfe_ai_console_client.resolveAlfeConsole)({ consoleWsUrl: pluginConfig.consoleWsUrl });
|
|
33
|
+
if (!consoleWsUrl || !apiKey) {
|
|
34
|
+
log.info("Console service URL or API key not configured — console plugin idle");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
log.info(`Connecting to console service: ${consoleWsUrl}`);
|
|
38
|
+
consoleClient = new _alfe_ai_console_client.ConsoleServiceClient({
|
|
39
|
+
wsUrl: consoleWsUrl,
|
|
40
|
+
apiKey,
|
|
41
|
+
onConnectionChange: (connected) => {
|
|
42
|
+
log.info(`Console service connection: ${connected ? "connected" : "disconnected"}`);
|
|
43
|
+
},
|
|
44
|
+
logger: log
|
|
45
|
+
});
|
|
46
|
+
consoleClient.start();
|
|
47
|
+
};
|
|
48
|
+
const stopConsoleClient = () => {
|
|
49
|
+
globalThis.__alfeConsolePluginActivated = false;
|
|
50
|
+
if (consoleClient) {
|
|
51
|
+
consoleClient.stop();
|
|
52
|
+
consoleClient = null;
|
|
53
|
+
}
|
|
54
|
+
log.info("Console plugin deactivated");
|
|
55
|
+
};
|
|
56
|
+
if (api.registerService) api.registerService({
|
|
57
|
+
id: "alfe-console-relay",
|
|
58
|
+
start: () => {
|
|
59
|
+
startConsoleClient();
|
|
60
|
+
},
|
|
61
|
+
stop: () => {
|
|
62
|
+
stopConsoleClient();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
else startConsoleClient();
|
|
66
|
+
log.info("Console plugin registered");
|
|
67
|
+
},
|
|
68
|
+
deactivate(api) {
|
|
69
|
+
const log = api.logger;
|
|
70
|
+
if (consoleClient) {
|
|
71
|
+
consoleClient.stop();
|
|
72
|
+
consoleClient = null;
|
|
73
|
+
}
|
|
74
|
+
globalThis.__alfeConsolePluginActivated = false;
|
|
75
|
+
log.info("Console plugin deactivated (fallback path)");
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
module.exports = plugin;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/plugin.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Alfe Console plugin for OpenClaw.
|
|
4
|
+
*
|
|
5
|
+
* On activate, opens an outbound WS to the Alfe console service via
|
|
6
|
+
* `@alfe.ai/console-client`. The console service multiplexes browser
|
|
7
|
+
* sessions over that WS using the binary tunnel protocol; the client
|
|
8
|
+
* proxies each tunneled request to the local OpenClaw gateway on
|
|
9
|
+
* `localhost:18789` and streams responses back.
|
|
10
|
+
*
|
|
11
|
+
* The gateway token never leaves the agent host — the client reads it
|
|
12
|
+
* from `~/.openclaw/openclaw.json` on demand.
|
|
13
|
+
*/
|
|
14
|
+
interface PluginLogger {
|
|
15
|
+
info(msg: string, ...args: unknown[]): void;
|
|
16
|
+
warn(msg: string, ...args: unknown[]): void;
|
|
17
|
+
error(msg: string, ...args: unknown[]): void;
|
|
18
|
+
debug(msg: string, ...args: unknown[]): void;
|
|
19
|
+
}
|
|
20
|
+
interface PluginServiceContext {
|
|
21
|
+
config: Record<string, unknown>;
|
|
22
|
+
workspaceDir?: string;
|
|
23
|
+
stateDir: string;
|
|
24
|
+
logger: PluginLogger;
|
|
25
|
+
}
|
|
26
|
+
interface PluginApi {
|
|
27
|
+
logger: PluginLogger;
|
|
28
|
+
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
29
|
+
config?: Record<string, unknown>;
|
|
30
|
+
registerService?(service: {
|
|
31
|
+
id: string;
|
|
32
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
33
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
34
|
+
}): void;
|
|
35
|
+
}
|
|
36
|
+
declare const plugin: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
version: string;
|
|
41
|
+
activate(api: PluginApi): void;
|
|
42
|
+
deactivate(api: PluginApi): void;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { plugin as default };
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/plugin.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Alfe Console plugin for OpenClaw.
|
|
4
|
+
*
|
|
5
|
+
* On activate, opens an outbound WS to the Alfe console service via
|
|
6
|
+
* `@alfe.ai/console-client`. The console service multiplexes browser
|
|
7
|
+
* sessions over that WS using the binary tunnel protocol; the client
|
|
8
|
+
* proxies each tunneled request to the local OpenClaw gateway on
|
|
9
|
+
* `localhost:18789` and streams responses back.
|
|
10
|
+
*
|
|
11
|
+
* The gateway token never leaves the agent host — the client reads it
|
|
12
|
+
* from `~/.openclaw/openclaw.json` on demand.
|
|
13
|
+
*/
|
|
14
|
+
interface PluginLogger {
|
|
15
|
+
info(msg: string, ...args: unknown[]): void;
|
|
16
|
+
warn(msg: string, ...args: unknown[]): void;
|
|
17
|
+
error(msg: string, ...args: unknown[]): void;
|
|
18
|
+
debug(msg: string, ...args: unknown[]): void;
|
|
19
|
+
}
|
|
20
|
+
interface PluginServiceContext {
|
|
21
|
+
config: Record<string, unknown>;
|
|
22
|
+
workspaceDir?: string;
|
|
23
|
+
stateDir: string;
|
|
24
|
+
logger: PluginLogger;
|
|
25
|
+
}
|
|
26
|
+
interface PluginApi {
|
|
27
|
+
logger: PluginLogger;
|
|
28
|
+
registrationMode?: 'full' | 'setup-only' | 'setup-runtime' | 'cli-metadata';
|
|
29
|
+
config?: Record<string, unknown>;
|
|
30
|
+
registerService?(service: {
|
|
31
|
+
id: string;
|
|
32
|
+
start: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
33
|
+
stop?: (ctx: PluginServiceContext) => void | Promise<void>;
|
|
34
|
+
}): void;
|
|
35
|
+
}
|
|
36
|
+
declare const plugin: {
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
description: string;
|
|
40
|
+
version: string;
|
|
41
|
+
activate(api: PluginApi): void;
|
|
42
|
+
deactivate(api: PluginApi): void;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { plugin as default };
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { ConsoleServiceClient, resolveAlfeConsole } from "@alfe.ai/console-client";
|
|
3
|
+
//#region src/plugin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Alfe Console plugin for OpenClaw.
|
|
6
|
+
*
|
|
7
|
+
* On activate, opens an outbound WS to the Alfe console service via
|
|
8
|
+
* `@alfe.ai/console-client`. The console service multiplexes browser
|
|
9
|
+
* sessions over that WS using the binary tunnel protocol; the client
|
|
10
|
+
* proxies each tunneled request to the local OpenClaw gateway on
|
|
11
|
+
* `localhost:18789` and streams responses back.
|
|
12
|
+
*
|
|
13
|
+
* The gateway token never leaves the agent host — the client reads it
|
|
14
|
+
* from `~/.openclaw/openclaw.json` on demand.
|
|
15
|
+
*/
|
|
16
|
+
const pkg = createRequire(import.meta.url)("../package.json");
|
|
17
|
+
let consoleClient = null;
|
|
18
|
+
const plugin = {
|
|
19
|
+
id: "@alfe.ai/openclaw-console",
|
|
20
|
+
name: "Alfe Console Plugin",
|
|
21
|
+
description: "Bridges the Alfe console service to the local OpenClaw control gateway",
|
|
22
|
+
version: pkg.version,
|
|
23
|
+
activate(api) {
|
|
24
|
+
const log = api.logger;
|
|
25
|
+
const pluginConfig = (((api.config ?? {}).plugins?.entries)?.["@alfe.ai/openclaw-console"] ?? {}).config ?? {};
|
|
26
|
+
const startConsoleClient = () => {
|
|
27
|
+
if (globalThis.__alfeConsolePluginActivated === true) {
|
|
28
|
+
log.debug("Console plugin already activated — skipping duplicate");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
globalThis.__alfeConsolePluginActivated = true;
|
|
32
|
+
const { apiKey, consoleWsUrl } = resolveAlfeConsole({ consoleWsUrl: pluginConfig.consoleWsUrl });
|
|
33
|
+
if (!consoleWsUrl || !apiKey) {
|
|
34
|
+
log.info("Console service URL or API key not configured — console plugin idle");
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
log.info(`Connecting to console service: ${consoleWsUrl}`);
|
|
38
|
+
consoleClient = new ConsoleServiceClient({
|
|
39
|
+
wsUrl: consoleWsUrl,
|
|
40
|
+
apiKey,
|
|
41
|
+
onConnectionChange: (connected) => {
|
|
42
|
+
log.info(`Console service connection: ${connected ? "connected" : "disconnected"}`);
|
|
43
|
+
},
|
|
44
|
+
logger: log
|
|
45
|
+
});
|
|
46
|
+
consoleClient.start();
|
|
47
|
+
};
|
|
48
|
+
const stopConsoleClient = () => {
|
|
49
|
+
globalThis.__alfeConsolePluginActivated = false;
|
|
50
|
+
if (consoleClient) {
|
|
51
|
+
consoleClient.stop();
|
|
52
|
+
consoleClient = null;
|
|
53
|
+
}
|
|
54
|
+
log.info("Console plugin deactivated");
|
|
55
|
+
};
|
|
56
|
+
if (api.registerService) api.registerService({
|
|
57
|
+
id: "alfe-console-relay",
|
|
58
|
+
start: () => {
|
|
59
|
+
startConsoleClient();
|
|
60
|
+
},
|
|
61
|
+
stop: () => {
|
|
62
|
+
stopConsoleClient();
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
else startConsoleClient();
|
|
66
|
+
log.info("Console plugin registered");
|
|
67
|
+
},
|
|
68
|
+
deactivate(api) {
|
|
69
|
+
const log = api.logger;
|
|
70
|
+
if (consoleClient) {
|
|
71
|
+
consoleClient.stop();
|
|
72
|
+
consoleClient = null;
|
|
73
|
+
}
|
|
74
|
+
globalThis.__alfeConsolePluginActivated = false;
|
|
75
|
+
log.info("Console plugin deactivated (fallback path)");
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { plugin as default };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "@alfe.ai/openclaw-console",
|
|
3
|
+
"name": "Alfe Console Plugin",
|
|
4
|
+
"description": "Bridges the Alfe console service to the local OpenClaw control gateway over an outbound WS",
|
|
5
|
+
"entry": "./dist/plugin.js",
|
|
6
|
+
"configSchema": {
|
|
7
|
+
"type": "object",
|
|
8
|
+
"additionalProperties": false,
|
|
9
|
+
"properties": {
|
|
10
|
+
"consoleWsUrl": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Override console service WebSocket URL (otherwise derived from API key)"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alfe.ai/openclaw-console",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "OpenClaw plugin: bridges browser console traffic from the Alfe console service to the local OpenClaw control gateway",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/plugin.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"require": "./dist/index.cjs",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./plugin": {
|
|
15
|
+
"types": "./dist/plugin.d.ts",
|
|
16
|
+
"require": "./dist/plugin.cjs",
|
|
17
|
+
"import": "./dist/plugin.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"openclaw": {
|
|
21
|
+
"extensions": [
|
|
22
|
+
"./dist/plugin.js"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"openclaw.plugin.json"
|
|
28
|
+
],
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@alfe.ai/config": "^0.0.8",
|
|
31
|
+
"@alfe.ai/console-client": "^0.0.1"
|
|
32
|
+
},
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"openclaw": ">=2026.3.0"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"openclaw": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"license": "UNLICENSED",
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "tsdown",
|
|
44
|
+
"dev": "tsdown --watch",
|
|
45
|
+
"test": "vitest run --passWithNoTests",
|
|
46
|
+
"typecheck": "tsc --noEmit",
|
|
47
|
+
"lint": "eslint ."
|
|
48
|
+
}
|
|
49
|
+
}
|