@askjo/camoufox-browser 1.0.6 → 1.0.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/plugin.ts +14 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askjo/camoufox-browser",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Headless browser automation server and OpenClaw plugin for AI agents - anti-detection, element refs, and session isolation",
5
5
  "main": "server-camoufox.js",
6
6
  "license": "MIT",
package/plugin.ts CHANGED
@@ -6,7 +6,19 @@
6
6
  */
7
7
 
8
8
  import { spawn, ChildProcess } from "child_process";
9
- import { join } from "path";
9
+ import { join, dirname } from "path";
10
+ import { fileURLToPath } from "url";
11
+
12
+ // Get plugin directory - works in both ESM and CJS contexts
13
+ const getPluginDir = (): string => {
14
+ try {
15
+ // ESM context
16
+ return dirname(fileURLToPath(import.meta.url));
17
+ } catch {
18
+ // CJS context
19
+ return __dirname;
20
+ }
21
+ };
10
22
 
11
23
  interface PluginConfig {
12
24
  url?: string;
@@ -133,7 +145,7 @@ export default function register(api: PluginApi) {
133
145
  const port = api.config.port || 9377;
134
146
  const baseUrl = api.config.url || `http://localhost:${port}`;
135
147
  const autoStart = api.config.autoStart !== false; // default true
136
- const pluginDir = __dirname;
148
+ const pluginDir = getPluginDir();
137
149
 
138
150
  // Auto-start server if configured (default: true)
139
151
  if (autoStart) {