@alfe.ai/openclaw-remote 0.0.13 → 0.0.15

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 CHANGED
@@ -3,6 +3,7 @@ let _alfe_ai_agent_api_client = require("@alfe.ai/agent-api-client");
3
3
  let _alfe_ai_remote = require("@alfe.ai/remote");
4
4
  let _alfe_ai_browser = require("@alfe.ai/browser");
5
5
  let _alfe_ai_terminal = require("@alfe.ai/terminal");
6
+ let _alfe_ai_openclaw_plugin_kit = require("@alfe.ai/openclaw-plugin-kit");
6
7
  let node_module = require("node:module");
7
8
  //#region src/ssrf.ts
8
9
  /** Hostnames blocked outright (case-insensitive, exact match). */
@@ -106,7 +107,7 @@ function buildIsNavigationAllowed(policy, log) {
106
107
  * created inside registerService.start.
107
108
  */
108
109
  const pkg = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("../package.json");
109
- const ACTIVATED_KEY = "__alfeRemotePluginActivated";
110
+ const ACTIVATED_KEY = (0, _alfe_ai_openclaw_plugin_kit.getActivationKey)("remote");
110
111
  const DEFAULT_HANDOFF_TIMEOUT_MS = 600 * 1e3;
111
112
  const DEFAULT_CHROME_PATH = "/usr/bin/google-chrome-stable";
112
113
  /**
@@ -162,9 +163,6 @@ let handoffTimeoutMs = DEFAULT_HANDOFF_TIMEOUT_MS;
162
163
  let dashboardBaseUrl;
163
164
  let selfAgentId;
164
165
  const sessionSurfaces = /* @__PURE__ */ new Map();
165
- function g() {
166
- return globalThis;
167
- }
168
166
  /** Coerce an unknown tool param to a string (empty if not a string). */
169
167
  function asStr(v) {
170
168
  return typeof v === "string" ? v : "";
@@ -200,11 +198,11 @@ function dispatchFrame(frame, log) {
200
198
  handler.handleFrame(frame);
201
199
  }
202
200
  function startService(pluginConfig, ssrfPolicy, workspaceDir, log) {
203
- if (g()[ACTIVATED_KEY] === true) {
204
- log.debug("Alfe Remote plugin already activated — skipping duplicate");
205
- return;
206
- }
207
- g()[ACTIVATED_KEY] = true;
201
+ (0, _alfe_ai_openclaw_plugin_kit.guardedStart)(ACTIVATED_KEY, log, () => {
202
+ startServiceInner(pluginConfig, ssrfPolicy, workspaceDir, log);
203
+ });
204
+ }
205
+ function startServiceInner(pluginConfig, ssrfPolicy, workspaceDir, log) {
208
206
  let alfeConfig = null;
209
207
  try {
210
208
  alfeConfig = (0, _alfe_ai_config.resolveConfig)();
@@ -216,7 +214,7 @@ function startService(pluginConfig, ssrfPolicy, workspaceDir, log) {
216
214
  const wsUrl = pluginConfig.remoteWsUrl ?? (apiUrl ? deriveRemoteWsUrl(apiUrl) : void 0);
217
215
  if (!wsUrl || !apiKey || !apiUrl) {
218
216
  log.info("Remote relay URL or credentials not configured — plugin running without relay");
219
- g()[ACTIVATED_KEY] = false;
217
+ (0, _alfe_ai_openclaw_plugin_kit.resetActivation)(ACTIVATED_KEY);
220
218
  return;
221
219
  }
222
220
  handoffTimeoutMs = pluginConfig.handoffTimeoutMs ?? DEFAULT_HANDOFF_TIMEOUT_MS;
@@ -260,7 +258,6 @@ function startService(pluginConfig, ssrfPolicy, workspaceDir, log) {
260
258
  log.info(`Remote plugin started — relay ${wsUrl}`);
261
259
  }
262
260
  function stopService(log) {
263
- g()[ACTIVATED_KEY] = false;
264
261
  remoteClient?.stop();
265
262
  remoteClient = null;
266
263
  browserSurface?.shutdown();
@@ -271,6 +268,7 @@ function stopService(log) {
271
268
  dashboardBaseUrl = void 0;
272
269
  selfAgentId = void 0;
273
270
  sessionSurfaces.clear();
271
+ (0, _alfe_ai_openclaw_plugin_kit.resetActivation)(ACTIVATED_KEY);
274
272
  log.info("Remote plugin stopped");
275
273
  }
276
274
  function registerTools(api) {
package/dist/plugin2.js CHANGED
@@ -4,6 +4,7 @@ import { AgentApiClient, installToolErrorCapture } from "@alfe.ai/agent-api-clie
4
4
  import { RemoteFrameType, RemoteServiceClient, decodeJson } from "@alfe.ai/remote";
5
5
  import { BrowserSurface } from "@alfe.ai/browser";
6
6
  import { TerminalSurface } from "@alfe.ai/terminal";
7
+ import { getActivationKey, guardedStart, resetActivation } from "@alfe.ai/openclaw-plugin-kit";
7
8
  //#region src/ssrf.ts
8
9
  /** Hostnames blocked outright (case-insensitive, exact match). */
9
10
  const BLOCKED_HOSTNAMES = new Set(["localhost"]);
@@ -106,7 +107,7 @@ function buildIsNavigationAllowed(policy, log) {
106
107
  * created inside registerService.start.
107
108
  */
108
109
  const pkg = createRequire(import.meta.url)("../package.json");
109
- const ACTIVATED_KEY = "__alfeRemotePluginActivated";
110
+ const ACTIVATED_KEY = getActivationKey("remote");
110
111
  const DEFAULT_HANDOFF_TIMEOUT_MS = 600 * 1e3;
111
112
  const DEFAULT_CHROME_PATH = "/usr/bin/google-chrome-stable";
112
113
  /**
@@ -162,9 +163,6 @@ let handoffTimeoutMs = DEFAULT_HANDOFF_TIMEOUT_MS;
162
163
  let dashboardBaseUrl;
163
164
  let selfAgentId;
164
165
  const sessionSurfaces = /* @__PURE__ */ new Map();
165
- function g() {
166
- return globalThis;
167
- }
168
166
  /** Coerce an unknown tool param to a string (empty if not a string). */
169
167
  function asStr(v) {
170
168
  return typeof v === "string" ? v : "";
@@ -200,11 +198,11 @@ function dispatchFrame(frame, log) {
200
198
  handler.handleFrame(frame);
201
199
  }
202
200
  function startService(pluginConfig, ssrfPolicy, workspaceDir, log) {
203
- if (g()[ACTIVATED_KEY] === true) {
204
- log.debug("Alfe Remote plugin already activated — skipping duplicate");
205
- return;
206
- }
207
- g()[ACTIVATED_KEY] = true;
201
+ guardedStart(ACTIVATED_KEY, log, () => {
202
+ startServiceInner(pluginConfig, ssrfPolicy, workspaceDir, log);
203
+ });
204
+ }
205
+ function startServiceInner(pluginConfig, ssrfPolicy, workspaceDir, log) {
208
206
  let alfeConfig = null;
209
207
  try {
210
208
  alfeConfig = resolveConfig();
@@ -216,7 +214,7 @@ function startService(pluginConfig, ssrfPolicy, workspaceDir, log) {
216
214
  const wsUrl = pluginConfig.remoteWsUrl ?? (apiUrl ? deriveRemoteWsUrl(apiUrl) : void 0);
217
215
  if (!wsUrl || !apiKey || !apiUrl) {
218
216
  log.info("Remote relay URL or credentials not configured — plugin running without relay");
219
- g()[ACTIVATED_KEY] = false;
217
+ resetActivation(ACTIVATED_KEY);
220
218
  return;
221
219
  }
222
220
  handoffTimeoutMs = pluginConfig.handoffTimeoutMs ?? DEFAULT_HANDOFF_TIMEOUT_MS;
@@ -260,7 +258,6 @@ function startService(pluginConfig, ssrfPolicy, workspaceDir, log) {
260
258
  log.info(`Remote plugin started — relay ${wsUrl}`);
261
259
  }
262
260
  function stopService(log) {
263
- g()[ACTIVATED_KEY] = false;
264
261
  remoteClient?.stop();
265
262
  remoteClient = null;
266
263
  browserSurface?.shutdown();
@@ -271,6 +268,7 @@ function stopService(log) {
271
268
  dashboardBaseUrl = void 0;
272
269
  selfAgentId = void 0;
273
270
  sessionSurfaces.clear();
271
+ resetActivation(ACTIVATED_KEY);
274
272
  log.info("Remote plugin stopped");
275
273
  }
276
274
  function registerTools(api) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/openclaw-remote",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "OpenClaw plugin for Alfe's interactive remote-control relay — browser co-browse + web terminal surfaces over one outbound WS",
5
5
  "type": "module",
6
6
  "main": "./dist/plugin.js",
@@ -27,11 +27,12 @@
27
27
  "openclaw.plugin.json"
28
28
  ],
29
29
  "dependencies": {
30
- "@alfe.ai/agent-api-client": "^0.12.0",
30
+ "@alfe.ai/agent-api-client": "^0.14.0",
31
+ "@alfe.ai/openclaw-plugin-kit": "0.1.0",
31
32
  "@alfe.ai/browser": "^0.2.0",
32
- "@alfe.ai/config": "0.3.0",
33
+ "@alfe.ai/config": "0.4.0",
33
34
  "@alfe.ai/remote": "^0.1.0",
34
- "@alfe.ai/terminal": "^0.1.1"
35
+ "@alfe.ai/terminal": "^0.1.2"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "openclaw": ">=2026.3.0"