doer-agent 0.1.2 → 0.1.4
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/agent.js
CHANGED
|
@@ -178,11 +178,23 @@ function resolvePlaywrightMcpProxyPath() {
|
|
|
178
178
|
return "";
|
|
179
179
|
}
|
|
180
180
|
const PLAYWRIGHT_MCP_PROXY_LAUNCHER_PATH = path.join(AGENT_PROJECT_DIR, "runtime/bin/playwright-mcp-proxy-launcher.sh");
|
|
181
|
+
function resolvePlaywrightMcpDaemonSocketPath(stateDir) {
|
|
182
|
+
if (process.platform === "win32") {
|
|
183
|
+
const suffix = stateDir
|
|
184
|
+
.toLowerCase()
|
|
185
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
186
|
+
.replace(/^-+|-+$/g, "")
|
|
187
|
+
.slice(-48) || "default";
|
|
188
|
+
return `\\\\.\\pipe\\doer-playwright-mcp-${suffix}`;
|
|
189
|
+
}
|
|
190
|
+
return path.join(stateDir, "playwright-mcp-daemon", "playwright-mcp.sock");
|
|
191
|
+
}
|
|
181
192
|
function resolvePlaywrightMcpDaemonStatePaths() {
|
|
182
|
-
const
|
|
193
|
+
const stateDir = resolveAgentStateDir();
|
|
194
|
+
const daemonDir = path.join(stateDir, "playwright-mcp-daemon");
|
|
183
195
|
return {
|
|
184
196
|
daemonDir,
|
|
185
|
-
socketPath:
|
|
197
|
+
socketPath: resolvePlaywrightMcpDaemonSocketPath(stateDir),
|
|
186
198
|
pidPath: path.join(daemonDir, "daemon.pid"),
|
|
187
199
|
metaPath: path.join(daemonDir, "daemon-meta.json"),
|
|
188
200
|
};
|
|
@@ -38,6 +38,14 @@ function resolveSocketPath() {
|
|
|
38
38
|
return explicit;
|
|
39
39
|
}
|
|
40
40
|
const stateDir = (process.env.DOER_AGENT_STATE_DIR || "").trim() || path.join(homedir(), ".doer-agent");
|
|
41
|
+
if (process.platform === "win32") {
|
|
42
|
+
const suffix = stateDir
|
|
43
|
+
.toLowerCase()
|
|
44
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
45
|
+
.replace(/^-+|-+$/g, "")
|
|
46
|
+
.slice(-48) || "default";
|
|
47
|
+
return `\\\\.\\pipe\\doer-playwright-mcp-${suffix}`;
|
|
48
|
+
}
|
|
41
49
|
return path.join(stateDir, "playwright-mcp-daemon", "playwright-mcp.sock");
|
|
42
50
|
}
|
|
43
51
|
function decodeToolArgs(argsBase64) {
|
|
@@ -14,6 +14,9 @@ function parseInteger(value, fallback) {
|
|
|
14
14
|
const socketPath = process.env.DOER_PLAYWRIGHT_MCP_DAEMON_SOCKET?.trim() || "";
|
|
15
15
|
const targetCommand = process.env.DOER_PLAYWRIGHT_MCP_TARGET_COMMAND?.trim() || "";
|
|
16
16
|
const idleTtlSeconds = parseInteger(process.env.DOER_PLAYWRIGHT_MCP_DAEMON_IDLE_TTL_SECONDS, 10800);
|
|
17
|
+
function isWindowsNamedPipePath(value) {
|
|
18
|
+
return process.platform === "win32" && value.startsWith("\\\\.\\pipe\\");
|
|
19
|
+
}
|
|
17
20
|
let targetArgs = [];
|
|
18
21
|
try {
|
|
19
22
|
const parsed = JSON.parse(process.env.DOER_PLAYWRIGHT_MCP_TARGET_ARGS_JSON || "[]");
|
|
@@ -103,15 +106,17 @@ async function shutdown(server) {
|
|
|
103
106
|
child = null;
|
|
104
107
|
}
|
|
105
108
|
await new Promise((resolve) => server.close(() => resolve()));
|
|
106
|
-
if (existsSync(socketPath)) {
|
|
109
|
+
if (!isWindowsNamedPipePath(socketPath) && existsSync(socketPath)) {
|
|
107
110
|
await rm(socketPath, { force: true });
|
|
108
111
|
}
|
|
109
112
|
process.exit(0);
|
|
110
113
|
}
|
|
111
114
|
async function main() {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
if (!isWindowsNamedPipePath(socketPath)) {
|
|
116
|
+
await mkdir(path.dirname(socketPath), { recursive: true });
|
|
117
|
+
if (existsSync(socketPath)) {
|
|
118
|
+
await rm(socketPath, { force: true });
|
|
119
|
+
}
|
|
115
120
|
}
|
|
116
121
|
const server = net.createServer((socket) => {
|
|
117
122
|
if (activeClient && !activeClient.destroyed) {
|