flockbay 0.10.52 → 0.10.53
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-IntvnrmZ.cjs → index-CG7Ouk31.cjs} +5 -5
- package/dist/{index-wkeSi0iC.mjs → index-ZZAd2VNk.mjs} +4 -4
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{migratePlugin-D1XjjWFq.cjs → migratePlugin-CZ3rEkKy.cjs} +1 -1
- package/dist/{migratePlugin-C71hAoc5.mjs → migratePlugin-_Voh9wUv.mjs} +1 -1
- package/dist/{runCodex-BSx-hCu6.mjs → runCodex-CBPYccVV.mjs} +2 -2
- package/dist/{runCodex-B7i_ICoQ.cjs → runCodex-DFG80IBU.cjs} +2 -2
- package/dist/{runGemini-gBKR3rdL.cjs → runGemini-B6k0JjNw.cjs} +2 -2
- package/dist/{runGemini-Dwyh7_WI.mjs → runGemini-ibnNbOeF.mjs} +2 -2
- package/dist/{types-5z8UADAi.cjs → types-DQ4IqofE.cjs} +191 -88
- package/dist/{types-Bgzap7qR.mjs → types-Dsn3eNAB.mjs} +191 -88
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var chalk = require('chalk');
|
|
4
4
|
var os = require('node:os');
|
|
5
5
|
var node_crypto = require('node:crypto');
|
|
6
|
-
var types = require('./types-
|
|
6
|
+
var types = require('./types-DQ4IqofE.cjs');
|
|
7
7
|
var node_child_process = require('node:child_process');
|
|
8
8
|
var path = require('node:path');
|
|
9
9
|
var node_readline = require('node:readline');
|
|
@@ -1323,7 +1323,7 @@ function buildDaemonSafeEnv(baseEnv, binPath) {
|
|
|
1323
1323
|
env[pathKey] = [...prepend, ...existingParts].join(pathSep);
|
|
1324
1324
|
return env;
|
|
1325
1325
|
}
|
|
1326
|
-
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-
|
|
1326
|
+
const __filename$1 = node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index-CG7Ouk31.cjs', document.baseURI).href)));
|
|
1327
1327
|
const __dirname$1 = path.join(__filename$1, "..");
|
|
1328
1328
|
function getGlobalClaudeVersion(claudeExecutable) {
|
|
1329
1329
|
try {
|
|
@@ -15269,7 +15269,7 @@ async function authAndSetupMachineIfNeeded() {
|
|
|
15269
15269
|
process.exit(1);
|
|
15270
15270
|
}
|
|
15271
15271
|
try {
|
|
15272
|
-
const { migrateUnrealMcpToFlockbayMcp } = await Promise.resolve().then(function () { return require('./migratePlugin-
|
|
15272
|
+
const { migrateUnrealMcpToFlockbayMcp } = await Promise.resolve().then(function () { return require('./migratePlugin-CZ3rEkKy.cjs'); });
|
|
15273
15273
|
const result = migrateUnrealMcpToFlockbayMcp({
|
|
15274
15274
|
engineRoot,
|
|
15275
15275
|
projectUprojectPath: project || void 0,
|
|
@@ -15425,7 +15425,7 @@ ${engineRoot}`;
|
|
|
15425
15425
|
} else if (subcommand === "codex") {
|
|
15426
15426
|
try {
|
|
15427
15427
|
await chdirToNearestUprojectRootIfPresent();
|
|
15428
|
-
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-
|
|
15428
|
+
const { runCodex } = await Promise.resolve().then(function () { return require('./runCodex-DFG80IBU.cjs'); });
|
|
15429
15429
|
let startedBy = void 0;
|
|
15430
15430
|
let sessionId = void 0;
|
|
15431
15431
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -15527,7 +15527,7 @@ ${engineRoot}`;
|
|
|
15527
15527
|
}
|
|
15528
15528
|
try {
|
|
15529
15529
|
await chdirToNearestUprojectRootIfPresent();
|
|
15530
|
-
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-
|
|
15530
|
+
const { runGemini } = await Promise.resolve().then(function () { return require('./runGemini-B6k0JjNw.cjs'); });
|
|
15531
15531
|
let startedBy = void 0;
|
|
15532
15532
|
let sessionId = void 0;
|
|
15533
15533
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -2,7 +2,7 @@ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(im
|
|
|
2
2
|
import * as os from 'node:os';
|
|
3
3
|
import os__default, { homedir } from 'node:os';
|
|
4
4
|
import { randomUUID, createCipheriv, randomBytes, createHash as createHash$1 } from 'node:crypto';
|
|
5
|
-
import { l as logger, e as projectPath, f as backoff, g as delay, R as RawJSONLinesSchema, c as configuration, h as readDaemonState, j as clearDaemonState, p as packageJson, r as readSettings, k as readCredentials, u as updateSettings, o as openBrowser, w as writeCredentials, m as unrealMcpPythonDir, n as acquireDaemonLock, s as writeDaemonState, t as ApiMachineClient, v as releaseDaemonLock, x as sendUnrealMcpTcpCommand, A as ApiClient, y as validatePath, z as run, B as run$1, C as buildShellInvocation, D as clearCredentials, E as clearMachineId, F as authenticateCodex, G as syncCodexCliAuth, H as authenticateClaude, I as authenticateGemini, d as installUnrealMcpPluginToEngine, J as buildAndInstallUnrealMcpPlugin, i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, K as getLatestDaemonLog, L as normalizeServerUrlForNode } from './types-
|
|
5
|
+
import { l as logger, e as projectPath, f as backoff, g as delay, R as RawJSONLinesSchema, c as configuration, h as readDaemonState, j as clearDaemonState, p as packageJson, r as readSettings, k as readCredentials, u as updateSettings, o as openBrowser, w as writeCredentials, m as unrealMcpPythonDir, n as acquireDaemonLock, s as writeDaemonState, t as ApiMachineClient, v as releaseDaemonLock, x as sendUnrealMcpTcpCommand, A as ApiClient, y as validatePath, z as run, B as run$1, C as buildShellInvocation, D as clearCredentials, E as clearMachineId, F as authenticateCodex, G as syncCodexCliAuth, H as authenticateClaude, I as authenticateGemini, d as installUnrealMcpPluginToEngine, J as buildAndInstallUnrealMcpPlugin, i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, K as getLatestDaemonLog, L as normalizeServerUrlForNode } from './types-Dsn3eNAB.mjs';
|
|
6
6
|
import { spawn, execFileSync, execSync } from 'node:child_process';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import path__default, { resolve, join, dirname } from 'node:path';
|
|
@@ -15247,7 +15247,7 @@ async function authAndSetupMachineIfNeeded() {
|
|
|
15247
15247
|
process.exit(1);
|
|
15248
15248
|
}
|
|
15249
15249
|
try {
|
|
15250
|
-
const { migrateUnrealMcpToFlockbayMcp } = await import('./migratePlugin-
|
|
15250
|
+
const { migrateUnrealMcpToFlockbayMcp } = await import('./migratePlugin-_Voh9wUv.mjs');
|
|
15251
15251
|
const result = migrateUnrealMcpToFlockbayMcp({
|
|
15252
15252
|
engineRoot,
|
|
15253
15253
|
projectUprojectPath: project || void 0,
|
|
@@ -15403,7 +15403,7 @@ ${engineRoot}`;
|
|
|
15403
15403
|
} else if (subcommand === "codex") {
|
|
15404
15404
|
try {
|
|
15405
15405
|
await chdirToNearestUprojectRootIfPresent();
|
|
15406
|
-
const { runCodex } = await import('./runCodex-
|
|
15406
|
+
const { runCodex } = await import('./runCodex-CBPYccVV.mjs');
|
|
15407
15407
|
let startedBy = void 0;
|
|
15408
15408
|
let sessionId = void 0;
|
|
15409
15409
|
for (let i = 1; i < args.length; i++) {
|
|
@@ -15505,7 +15505,7 @@ ${engineRoot}`;
|
|
|
15505
15505
|
}
|
|
15506
15506
|
try {
|
|
15507
15507
|
await chdirToNearestUprojectRootIfPresent();
|
|
15508
|
-
const { runGemini } = await import('./runGemini-
|
|
15508
|
+
const { runGemini } = await import('./runGemini-ibnNbOeF.mjs');
|
|
15509
15509
|
let startedBy = void 0;
|
|
15510
15510
|
let sessionId = void 0;
|
|
15511
15511
|
for (let i = 1; i < args.length; i++) {
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
package/dist/lib.cjs
CHANGED
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, R as RawJSONLinesSchema, c as configuration, l as logger } from './types-Dsn3eNAB.mjs';
|
|
2
2
|
import 'axios';
|
|
3
3
|
import 'node:fs';
|
|
4
4
|
import 'node:os';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs__default from 'node:fs';
|
|
2
2
|
import path__default from 'node:path';
|
|
3
|
-
import { i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, q as quarantineLegacyEnginePlugins, d as installUnrealMcpPluginToEngine } from './types-
|
|
3
|
+
import { i as installUnrealMcpPluginToProject, b as isInstalledEngineRoot, q as quarantineLegacyEnginePlugins, d as installUnrealMcpPluginToEngine } from './types-Dsn3eNAB.mjs';
|
|
4
4
|
import 'axios';
|
|
5
5
|
import 'node:os';
|
|
6
6
|
import 'node:events';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
2
2
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
3
|
-
import { l as logger, A as ApiClient, p as packageJson, c as configuration, r as readSettings, e as projectPath } from './types-
|
|
3
|
+
import { l as logger, A as ApiClient, p as packageJson, c as configuration, r as readSettings, e as projectPath } from './types-Dsn3eNAB.mjs';
|
|
4
4
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { ElicitRequestSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
@@ -14,7 +14,7 @@ import process$1 from 'node:process';
|
|
|
14
14
|
import { PassThrough } from 'node:stream';
|
|
15
15
|
import { getDefaultEnvironment } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
16
16
|
import { ReadBuffer, serializeMessage } from '@modelcontextprotocol/sdk/shared/stdio.js';
|
|
17
|
-
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, E as ElicitationHub, n as notifyDaemonSessionStarted, M as MessageQueue2, P as PLATFORM_SYSTEM_PROMPT, a as setLatestUserImages, w as withUserImagesMarker, r as registerKillSessionHandler, b as MessageBuffer, d as startFlockbayServer, g as buildProjectCapsule, t as trimIdent, j as autoFinalizeCoordinationWorkItem, k as detectScreenshotsForGate, l as applyCoordinationSideEffectsFromMcpToolResult, m as stopCaffeinate } from './index-
|
|
17
|
+
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, E as ElicitationHub, n as notifyDaemonSessionStarted, M as MessageQueue2, P as PLATFORM_SYSTEM_PROMPT, a as setLatestUserImages, w as withUserImagesMarker, r as registerKillSessionHandler, b as MessageBuffer, d as startFlockbayServer, g as buildProjectCapsule, t as trimIdent, j as autoFinalizeCoordinationWorkItem, k as detectScreenshotsForGate, l as applyCoordinationSideEffectsFromMcpToolResult, m as stopCaffeinate } from './index-ZZAd2VNk.mjs';
|
|
18
18
|
import 'axios';
|
|
19
19
|
import 'node:events';
|
|
20
20
|
import 'socket.io-client';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ink = require('ink');
|
|
4
4
|
var React = require('react');
|
|
5
|
-
var types = require('./types-
|
|
5
|
+
var types = require('./types-DQ4IqofE.cjs');
|
|
6
6
|
var index_js = require('@modelcontextprotocol/sdk/client/index.js');
|
|
7
7
|
var z = require('zod');
|
|
8
8
|
var types_js = require('@modelcontextprotocol/sdk/types.js');
|
|
@@ -16,7 +16,7 @@ var process$1 = require('node:process');
|
|
|
16
16
|
var node_stream = require('node:stream');
|
|
17
17
|
var stdio_js$1 = require('@modelcontextprotocol/sdk/client/stdio.js');
|
|
18
18
|
var stdio_js = require('@modelcontextprotocol/sdk/shared/stdio.js');
|
|
19
|
-
var index = require('./index-
|
|
19
|
+
var index = require('./index-CG7Ouk31.cjs');
|
|
20
20
|
require('axios');
|
|
21
21
|
require('node:events');
|
|
22
22
|
require('socket.io-client');
|
|
@@ -6,8 +6,8 @@ var node_crypto = require('node:crypto');
|
|
|
6
6
|
var os = require('node:os');
|
|
7
7
|
var path = require('node:path');
|
|
8
8
|
var fs$2 = require('node:fs/promises');
|
|
9
|
-
var types = require('./types-
|
|
10
|
-
var index = require('./index-
|
|
9
|
+
var types = require('./types-DQ4IqofE.cjs');
|
|
10
|
+
var index = require('./index-CG7Ouk31.cjs');
|
|
11
11
|
var node_child_process = require('node:child_process');
|
|
12
12
|
var sdk = require('@agentclientprotocol/sdk');
|
|
13
13
|
var fs = require('fs');
|
|
@@ -4,8 +4,8 @@ import { randomUUID, createHash } from 'node:crypto';
|
|
|
4
4
|
import os__default from 'node:os';
|
|
5
5
|
import path__default, { resolve, join as join$1, basename } from 'node:path';
|
|
6
6
|
import { mkdir, writeFile, readFile } from 'node:fs/promises';
|
|
7
|
-
import { l as logger, p as packageJson, A as ApiClient, c as configuration, r as readSettings, e as projectPath } from './types-
|
|
8
|
-
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, g as buildProjectCapsule, a as setLatestUserImages, b as MessageBuffer, w as withUserImagesMarker, r as registerKillSessionHandler, d as startFlockbayServer, o as extractUserImagesMarker, p as getLatestUserImages, P as PLATFORM_SYSTEM_PROMPT, j as autoFinalizeCoordinationWorkItem, E as ElicitationHub, k as detectScreenshotsForGate, m as stopCaffeinate } from './index-
|
|
7
|
+
import { l as logger, p as packageJson, A as ApiClient, c as configuration, r as readSettings, e as projectPath } from './types-Dsn3eNAB.mjs';
|
|
8
|
+
import { s as shouldCountToolCall, c as consumeToolQuota, f as formatQuotaDeniedReason, h as hashObject, e as enforceCliVersionPolicy, i as initialMachineMetadata, n as notifyDaemonSessionStarted, M as MessageQueue2, g as buildProjectCapsule, a as setLatestUserImages, b as MessageBuffer, w as withUserImagesMarker, r as registerKillSessionHandler, d as startFlockbayServer, o as extractUserImagesMarker, p as getLatestUserImages, P as PLATFORM_SYSTEM_PROMPT, j as autoFinalizeCoordinationWorkItem, E as ElicitationHub, k as detectScreenshotsForGate, m as stopCaffeinate } from './index-ZZAd2VNk.mjs';
|
|
9
9
|
import { spawn, spawnSync } from 'node:child_process';
|
|
10
10
|
import { ndJsonStream, ClientSideConnection } from '@agentclientprotocol/sdk';
|
|
11
11
|
import { existsSync, readFileSync, mkdirSync, writeFileSync } from 'fs';
|
|
@@ -44,7 +44,7 @@ function _interopNamespaceDefault(e) {
|
|
|
44
44
|
var z__namespace = /*#__PURE__*/_interopNamespaceDefault(z);
|
|
45
45
|
|
|
46
46
|
var name = "flockbay";
|
|
47
|
-
var version = "0.10.
|
|
47
|
+
var version = "0.10.53";
|
|
48
48
|
var description = "Flockbay CLI (local agent + daemon)";
|
|
49
49
|
var author = "Eduardo Orellana";
|
|
50
50
|
var license = "UNLICENSED";
|
|
@@ -832,7 +832,7 @@ class RpcHandlerManager {
|
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
|
|
835
|
-
const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-
|
|
835
|
+
const __dirname$1 = path$1.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('types-DQ4IqofE.cjs', document.baseURI).href))));
|
|
836
836
|
function projectPath() {
|
|
837
837
|
const path = path$1.resolve(__dirname$1, "..");
|
|
838
838
|
return path;
|
|
@@ -1053,6 +1053,185 @@ ${hints.join("\n\n")}` : "";
|
|
|
1053
1053
|
return response;
|
|
1054
1054
|
}
|
|
1055
1055
|
|
|
1056
|
+
function normalizeWindowsPath(value) {
|
|
1057
|
+
return path.win32.normalize(String(value || "").trim()).replace(/[\\/]+$/, "");
|
|
1058
|
+
}
|
|
1059
|
+
function equalsIgnoreCaseWindows(a, b) {
|
|
1060
|
+
return normalizeWindowsPath(a || "").toLowerCase() === normalizeWindowsPath(b || "").toLowerCase();
|
|
1061
|
+
}
|
|
1062
|
+
function extractUprojectPathFromCommandLine(commandLine) {
|
|
1063
|
+
const raw = String(commandLine || "").trim();
|
|
1064
|
+
if (!raw) return null;
|
|
1065
|
+
const matches = Array.from(raw.matchAll(/"([^"\r\n]+?\.uproject)"|([^\s"]+?\.uproject)/gi));
|
|
1066
|
+
for (const match of matches) {
|
|
1067
|
+
const candidate = String(match[1] || match[2] || "").trim();
|
|
1068
|
+
if (!candidate) continue;
|
|
1069
|
+
return normalizeWindowsPath(candidate);
|
|
1070
|
+
}
|
|
1071
|
+
return null;
|
|
1072
|
+
}
|
|
1073
|
+
function inferEngineRootFromExecutablePath(executablePath) {
|
|
1074
|
+
const normalized = normalizeWindowsPath(executablePath);
|
|
1075
|
+
if (!normalized) return null;
|
|
1076
|
+
const marker = `${path.win32.sep}Engine${path.win32.sep}Binaries${path.win32.sep}`;
|
|
1077
|
+
const idx = normalized.toLowerCase().indexOf(marker.toLowerCase());
|
|
1078
|
+
if (idx === -1) return null;
|
|
1079
|
+
return normalized.slice(0, idx);
|
|
1080
|
+
}
|
|
1081
|
+
function compareCreationDateDesc(a, b) {
|
|
1082
|
+
const aa = String(a || "").trim();
|
|
1083
|
+
const bb = String(b || "").trim();
|
|
1084
|
+
return bb.localeCompare(aa);
|
|
1085
|
+
}
|
|
1086
|
+
function parseRunningUnrealEditorProcessesFromWindowsJson(input) {
|
|
1087
|
+
const engineRoot = String(input.engineRoot || "").trim();
|
|
1088
|
+
const wantedEngineRoot = engineRoot ? normalizeWindowsPath(engineRoot) : "";
|
|
1089
|
+
const raw = String(input.raw || "").trim();
|
|
1090
|
+
if (!raw) return [];
|
|
1091
|
+
let parsed;
|
|
1092
|
+
try {
|
|
1093
|
+
parsed = JSON.parse(raw);
|
|
1094
|
+
} catch {
|
|
1095
|
+
return [];
|
|
1096
|
+
}
|
|
1097
|
+
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
1098
|
+
const out = [];
|
|
1099
|
+
for (const record of records) {
|
|
1100
|
+
const uprojectPath = extractUprojectPathFromCommandLine(String(record?.CommandLine || ""));
|
|
1101
|
+
const executablePath = record?.ExecutablePath ? normalizeWindowsPath(record.ExecutablePath) : null;
|
|
1102
|
+
const inferredEngineRoot = executablePath ? inferEngineRootFromExecutablePath(executablePath) : null;
|
|
1103
|
+
if (wantedEngineRoot && !equalsIgnoreCaseWindows(inferredEngineRoot, wantedEngineRoot)) continue;
|
|
1104
|
+
const processIdNumber = Number(record?.ProcessId);
|
|
1105
|
+
out.push({
|
|
1106
|
+
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
1107
|
+
executablePath,
|
|
1108
|
+
engineRoot: inferredEngineRoot,
|
|
1109
|
+
uprojectPath,
|
|
1110
|
+
commandLine: record?.CommandLine ? String(record.CommandLine) : null,
|
|
1111
|
+
creationDate: record?.CreationDate ? String(record.CreationDate) : null
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
1115
|
+
return out;
|
|
1116
|
+
}
|
|
1117
|
+
function parseRunningUnrealEditorProcessesFromGetProcessJson(input) {
|
|
1118
|
+
const engineRoot = String(input.engineRoot || "").trim();
|
|
1119
|
+
const wantedEngineRoot = engineRoot ? normalizeWindowsPath(engineRoot) : "";
|
|
1120
|
+
const raw = String(input.raw || "").trim();
|
|
1121
|
+
if (!raw) return [];
|
|
1122
|
+
let parsed;
|
|
1123
|
+
try {
|
|
1124
|
+
parsed = JSON.parse(raw);
|
|
1125
|
+
} catch {
|
|
1126
|
+
return [];
|
|
1127
|
+
}
|
|
1128
|
+
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
1129
|
+
const out = [];
|
|
1130
|
+
for (const record of records) {
|
|
1131
|
+
const executablePath = record?.Path ? normalizeWindowsPath(record.Path) : null;
|
|
1132
|
+
const inferredEngineRoot = executablePath ? inferEngineRootFromExecutablePath(executablePath) : null;
|
|
1133
|
+
if (wantedEngineRoot && !equalsIgnoreCaseWindows(inferredEngineRoot, wantedEngineRoot)) continue;
|
|
1134
|
+
const processIdNumber = Number(record?.Id);
|
|
1135
|
+
out.push({
|
|
1136
|
+
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
1137
|
+
executablePath,
|
|
1138
|
+
engineRoot: inferredEngineRoot,
|
|
1139
|
+
uprojectPath: null,
|
|
1140
|
+
commandLine: null,
|
|
1141
|
+
creationDate: record?.StartTime ? String(record.StartTime) : null
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
1145
|
+
return out;
|
|
1146
|
+
}
|
|
1147
|
+
function parseRunningUnrealEditorProcessesFromGetProcessMinimalJson(input) {
|
|
1148
|
+
const raw = String(input.raw || "").trim();
|
|
1149
|
+
if (!raw) return [];
|
|
1150
|
+
let parsed;
|
|
1151
|
+
try {
|
|
1152
|
+
parsed = JSON.parse(raw);
|
|
1153
|
+
} catch {
|
|
1154
|
+
return [];
|
|
1155
|
+
}
|
|
1156
|
+
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
1157
|
+
const out = [];
|
|
1158
|
+
for (const record of records) {
|
|
1159
|
+
const processIdNumber = Number(record?.Id);
|
|
1160
|
+
out.push({
|
|
1161
|
+
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
1162
|
+
executablePath: null,
|
|
1163
|
+
engineRoot: null,
|
|
1164
|
+
uprojectPath: null,
|
|
1165
|
+
commandLine: null,
|
|
1166
|
+
creationDate: record?.StartTime ? String(record.StartTime) : null
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
1170
|
+
return out;
|
|
1171
|
+
}
|
|
1172
|
+
function detectRunningUnrealEditorProcess(options) {
|
|
1173
|
+
if (process.platform !== "win32") return null;
|
|
1174
|
+
const execFileSyncImpl = options?.execFileSyncImpl || node_child_process.execFileSync;
|
|
1175
|
+
const win32Script = [
|
|
1176
|
+
'$ErrorActionPreference = "Stop"',
|
|
1177
|
+
`$procs = Get-CimInstance Win32_Process -Filter "Name = 'UnrealEditor.exe'" | Select-Object ProcessId, ExecutablePath, CommandLine, CreationDate`,
|
|
1178
|
+
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
1179
|
+
].join("; ");
|
|
1180
|
+
try {
|
|
1181
|
+
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", win32Script], {
|
|
1182
|
+
encoding: "utf8",
|
|
1183
|
+
windowsHide: true,
|
|
1184
|
+
timeout: 1500
|
|
1185
|
+
});
|
|
1186
|
+
const matches = parseRunningUnrealEditorProcessesFromWindowsJson({
|
|
1187
|
+
raw: typeof raw === "string" ? raw : String(raw || ""),
|
|
1188
|
+
engineRoot: options?.engineRoot
|
|
1189
|
+
});
|
|
1190
|
+
return matches[0] || null;
|
|
1191
|
+
} catch {
|
|
1192
|
+
const getProcessScript = [
|
|
1193
|
+
'$ErrorActionPreference = "Stop"',
|
|
1194
|
+
"$procs = Get-Process UnrealEditor -ErrorAction SilentlyContinue | Select-Object Id, Path, StartTime",
|
|
1195
|
+
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
1196
|
+
].join("; ");
|
|
1197
|
+
try {
|
|
1198
|
+
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", getProcessScript], {
|
|
1199
|
+
encoding: "utf8",
|
|
1200
|
+
windowsHide: true,
|
|
1201
|
+
timeout: 1e3
|
|
1202
|
+
});
|
|
1203
|
+
const matches = parseRunningUnrealEditorProcessesFromGetProcessJson({
|
|
1204
|
+
raw: typeof raw === "string" ? raw : String(raw || ""),
|
|
1205
|
+
engineRoot: options?.engineRoot
|
|
1206
|
+
});
|
|
1207
|
+
return matches[0] || null;
|
|
1208
|
+
} catch {
|
|
1209
|
+
const getProcessMinimalScript = [
|
|
1210
|
+
'$ErrorActionPreference = "Stop"',
|
|
1211
|
+
"$procs = Get-Process UnrealEditor -ErrorAction SilentlyContinue | Select-Object Id, StartTime",
|
|
1212
|
+
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
1213
|
+
].join("; ");
|
|
1214
|
+
try {
|
|
1215
|
+
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", getProcessMinimalScript], {
|
|
1216
|
+
encoding: "utf8",
|
|
1217
|
+
windowsHide: true,
|
|
1218
|
+
timeout: 1e3
|
|
1219
|
+
});
|
|
1220
|
+
const matches = parseRunningUnrealEditorProcessesFromGetProcessMinimalJson({
|
|
1221
|
+
raw: typeof raw === "string" ? raw : String(raw || "")
|
|
1222
|
+
});
|
|
1223
|
+
return matches[0] || null;
|
|
1224
|
+
} catch {
|
|
1225
|
+
return null;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
function detectRunningUnrealEditorProject(options) {
|
|
1231
|
+
const match = detectRunningUnrealEditorProcess(options);
|
|
1232
|
+
return match?.uprojectPath ? match : null;
|
|
1233
|
+
}
|
|
1234
|
+
|
|
1056
1235
|
function getPathApiForPlatform(platform) {
|
|
1057
1236
|
return platform === "win32" ? path$1.win32 : path$1.posix;
|
|
1058
1237
|
}
|
|
@@ -1935,13 +2114,20 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory, coordinatio
|
|
|
1935
2114
|
requiredCommands
|
|
1936
2115
|
}
|
|
1937
2116
|
};
|
|
2117
|
+
const detectedEditorProcess = detectRunningUnrealEditorProcess();
|
|
2118
|
+
if (detectedEditorProcess?.uprojectPath) {
|
|
2119
|
+
baseResponse.runningProjectUprojectPath = detectedEditorProcess.uprojectPath;
|
|
2120
|
+
}
|
|
2121
|
+
if (detectedEditorProcess?.engineRoot) {
|
|
2122
|
+
baseResponse.inferredEngineRoot = detectedEditorProcess.engineRoot ?? null;
|
|
2123
|
+
}
|
|
1938
2124
|
try {
|
|
1939
2125
|
await sendUnrealMcpTcpCommand({ type: "ping", host, port, timeoutMs });
|
|
1940
2126
|
} catch (err) {
|
|
1941
2127
|
const message = err instanceof Error ? err.message : String(err);
|
|
1942
2128
|
return {
|
|
1943
2129
|
...baseResponse,
|
|
1944
|
-
status: "not_running",
|
|
2130
|
+
status: detectedEditorProcess ? "editor_open_unreachable" : "not_running",
|
|
1945
2131
|
reachable: false,
|
|
1946
2132
|
error: message
|
|
1947
2133
|
};
|
|
@@ -1973,6 +2159,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory, coordinatio
|
|
|
1973
2159
|
const commands = Array.isArray(running?.commands) ? running.commands.filter((c) => typeof c === "string").map((c) => c.trim()).filter(Boolean) : [];
|
|
1974
2160
|
const missingCommands = requiredCommands.filter((c) => !commands.includes(c));
|
|
1975
2161
|
const inferredEngineRoot = baseDir ? inferEngineRootFromPluginBaseDir(baseDir) : null;
|
|
2162
|
+
const runningProject = detectRunningUnrealEditorProject(inferredEngineRoot ? { engineRoot: inferredEngineRoot } : {});
|
|
1976
2163
|
let play = null;
|
|
1977
2164
|
if (commands.includes("get_play_in_editor_status")) {
|
|
1978
2165
|
try {
|
|
@@ -1991,6 +2178,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory, coordinatio
|
|
|
1991
2178
|
...baseResponse,
|
|
1992
2179
|
status,
|
|
1993
2180
|
inferredEngineRoot,
|
|
2181
|
+
runningProjectUprojectPath: runningProject?.uprojectPath ?? null,
|
|
1994
2182
|
running: {
|
|
1995
2183
|
baseDir,
|
|
1996
2184
|
versionName,
|
|
@@ -4017,91 +4205,6 @@ Log: ${buildLogPath}`
|
|
|
4017
4205
|
return { ok: true, buildLogPath };
|
|
4018
4206
|
}
|
|
4019
4207
|
|
|
4020
|
-
function normalizeWindowsPath(value) {
|
|
4021
|
-
return path.win32.normalize(String(value || "").trim()).replace(/[\\/]+$/, "");
|
|
4022
|
-
}
|
|
4023
|
-
function equalsIgnoreCaseWindows(a, b) {
|
|
4024
|
-
return normalizeWindowsPath(a || "").toLowerCase() === normalizeWindowsPath(b || "").toLowerCase();
|
|
4025
|
-
}
|
|
4026
|
-
function extractUprojectPathFromCommandLine(commandLine) {
|
|
4027
|
-
const raw = String(commandLine || "").trim();
|
|
4028
|
-
if (!raw) return null;
|
|
4029
|
-
const matches = Array.from(raw.matchAll(/"([^"\r\n]+?\.uproject)"|([^\s"]+?\.uproject)/gi));
|
|
4030
|
-
for (const match of matches) {
|
|
4031
|
-
const candidate = String(match[1] || match[2] || "").trim();
|
|
4032
|
-
if (!candidate) continue;
|
|
4033
|
-
return normalizeWindowsPath(candidate);
|
|
4034
|
-
}
|
|
4035
|
-
return null;
|
|
4036
|
-
}
|
|
4037
|
-
function inferEngineRootFromExecutablePath(executablePath) {
|
|
4038
|
-
const normalized = normalizeWindowsPath(executablePath);
|
|
4039
|
-
if (!normalized) return null;
|
|
4040
|
-
const marker = `${path.win32.sep}Engine${path.win32.sep}Binaries${path.win32.sep}`;
|
|
4041
|
-
const idx = normalized.toLowerCase().indexOf(marker.toLowerCase());
|
|
4042
|
-
if (idx === -1) return null;
|
|
4043
|
-
return normalized.slice(0, idx);
|
|
4044
|
-
}
|
|
4045
|
-
function compareCreationDateDesc(a, b) {
|
|
4046
|
-
const aa = String(a || "").trim();
|
|
4047
|
-
const bb = String(b || "").trim();
|
|
4048
|
-
return bb.localeCompare(aa);
|
|
4049
|
-
}
|
|
4050
|
-
function parseRunningUnrealEditorProjectsFromWindowsJson(input) {
|
|
4051
|
-
const engineRoot = String(input.engineRoot || "").trim();
|
|
4052
|
-
const wantedEngineRoot = engineRoot ? normalizeWindowsPath(engineRoot) : "";
|
|
4053
|
-
const raw = String(input.raw || "").trim();
|
|
4054
|
-
if (!raw) return [];
|
|
4055
|
-
let parsed;
|
|
4056
|
-
try {
|
|
4057
|
-
parsed = JSON.parse(raw);
|
|
4058
|
-
} catch {
|
|
4059
|
-
return [];
|
|
4060
|
-
}
|
|
4061
|
-
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
4062
|
-
const out = [];
|
|
4063
|
-
for (const record of records) {
|
|
4064
|
-
const uprojectPath = extractUprojectPathFromCommandLine(String(record?.CommandLine || ""));
|
|
4065
|
-
if (!uprojectPath) continue;
|
|
4066
|
-
const executablePath = record?.ExecutablePath ? normalizeWindowsPath(record.ExecutablePath) : null;
|
|
4067
|
-
const inferredEngineRoot = executablePath ? inferEngineRootFromExecutablePath(executablePath) : null;
|
|
4068
|
-
if (wantedEngineRoot && !equalsIgnoreCaseWindows(inferredEngineRoot, wantedEngineRoot)) continue;
|
|
4069
|
-
const processIdNumber = Number(record?.ProcessId);
|
|
4070
|
-
out.push({
|
|
4071
|
-
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
4072
|
-
executablePath,
|
|
4073
|
-
engineRoot: inferredEngineRoot,
|
|
4074
|
-
uprojectPath,
|
|
4075
|
-
commandLine: record?.CommandLine ? String(record.CommandLine) : null,
|
|
4076
|
-
creationDate: record?.CreationDate ? String(record.CreationDate) : null
|
|
4077
|
-
});
|
|
4078
|
-
}
|
|
4079
|
-
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
4080
|
-
return out;
|
|
4081
|
-
}
|
|
4082
|
-
function detectRunningUnrealEditorProject(options) {
|
|
4083
|
-
if (process.platform !== "win32") return null;
|
|
4084
|
-
const execFileSyncImpl = options?.execFileSyncImpl || node_child_process.execFileSync;
|
|
4085
|
-
const script = [
|
|
4086
|
-
'$ErrorActionPreference = "Stop"',
|
|
4087
|
-
`$procs = Get-CimInstance Win32_Process -Filter "Name = 'UnrealEditor.exe'" | Select-Object ProcessId, ExecutablePath, CommandLine, CreationDate`,
|
|
4088
|
-
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
4089
|
-
].join("; ");
|
|
4090
|
-
try {
|
|
4091
|
-
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", script], {
|
|
4092
|
-
encoding: "utf8",
|
|
4093
|
-
windowsHide: true
|
|
4094
|
-
});
|
|
4095
|
-
const matches = parseRunningUnrealEditorProjectsFromWindowsJson({
|
|
4096
|
-
raw: typeof raw === "string" ? raw : String(raw || ""),
|
|
4097
|
-
engineRoot: options?.engineRoot
|
|
4098
|
-
});
|
|
4099
|
-
return matches[0] || null;
|
|
4100
|
-
} catch {
|
|
4101
|
-
return null;
|
|
4102
|
-
}
|
|
4103
|
-
}
|
|
4104
|
-
|
|
4105
4208
|
function canWriteDir$1(dir) {
|
|
4106
4209
|
const root = String(dir || "").trim();
|
|
4107
4210
|
if (!root) return false;
|
|
@@ -18,12 +18,12 @@ import { fileURLToPath } from 'url';
|
|
|
18
18
|
import process$1 from 'node:process';
|
|
19
19
|
import { platform } from 'os';
|
|
20
20
|
import net from 'node:net';
|
|
21
|
-
import { spawn as spawn$1
|
|
21
|
+
import { execFileSync, spawn as spawn$1 } from 'node:child_process';
|
|
22
22
|
import { createServer } from 'http';
|
|
23
23
|
import open$2 from 'open';
|
|
24
24
|
|
|
25
25
|
var name = "flockbay";
|
|
26
|
-
var version = "0.10.
|
|
26
|
+
var version = "0.10.53";
|
|
27
27
|
var description = "Flockbay CLI (local agent + daemon)";
|
|
28
28
|
var author = "Eduardo Orellana";
|
|
29
29
|
var license = "UNLICENSED";
|
|
@@ -1032,6 +1032,185 @@ ${hints.join("\n\n")}` : "";
|
|
|
1032
1032
|
return response;
|
|
1033
1033
|
}
|
|
1034
1034
|
|
|
1035
|
+
function normalizeWindowsPath(value) {
|
|
1036
|
+
return path__default.win32.normalize(String(value || "").trim()).replace(/[\\/]+$/, "");
|
|
1037
|
+
}
|
|
1038
|
+
function equalsIgnoreCaseWindows(a, b) {
|
|
1039
|
+
return normalizeWindowsPath(a || "").toLowerCase() === normalizeWindowsPath(b || "").toLowerCase();
|
|
1040
|
+
}
|
|
1041
|
+
function extractUprojectPathFromCommandLine(commandLine) {
|
|
1042
|
+
const raw = String(commandLine || "").trim();
|
|
1043
|
+
if (!raw) return null;
|
|
1044
|
+
const matches = Array.from(raw.matchAll(/"([^"\r\n]+?\.uproject)"|([^\s"]+?\.uproject)/gi));
|
|
1045
|
+
for (const match of matches) {
|
|
1046
|
+
const candidate = String(match[1] || match[2] || "").trim();
|
|
1047
|
+
if (!candidate) continue;
|
|
1048
|
+
return normalizeWindowsPath(candidate);
|
|
1049
|
+
}
|
|
1050
|
+
return null;
|
|
1051
|
+
}
|
|
1052
|
+
function inferEngineRootFromExecutablePath(executablePath) {
|
|
1053
|
+
const normalized = normalizeWindowsPath(executablePath);
|
|
1054
|
+
if (!normalized) return null;
|
|
1055
|
+
const marker = `${path__default.win32.sep}Engine${path__default.win32.sep}Binaries${path__default.win32.sep}`;
|
|
1056
|
+
const idx = normalized.toLowerCase().indexOf(marker.toLowerCase());
|
|
1057
|
+
if (idx === -1) return null;
|
|
1058
|
+
return normalized.slice(0, idx);
|
|
1059
|
+
}
|
|
1060
|
+
function compareCreationDateDesc(a, b) {
|
|
1061
|
+
const aa = String(a || "").trim();
|
|
1062
|
+
const bb = String(b || "").trim();
|
|
1063
|
+
return bb.localeCompare(aa);
|
|
1064
|
+
}
|
|
1065
|
+
function parseRunningUnrealEditorProcessesFromWindowsJson(input) {
|
|
1066
|
+
const engineRoot = String(input.engineRoot || "").trim();
|
|
1067
|
+
const wantedEngineRoot = engineRoot ? normalizeWindowsPath(engineRoot) : "";
|
|
1068
|
+
const raw = String(input.raw || "").trim();
|
|
1069
|
+
if (!raw) return [];
|
|
1070
|
+
let parsed;
|
|
1071
|
+
try {
|
|
1072
|
+
parsed = JSON.parse(raw);
|
|
1073
|
+
} catch {
|
|
1074
|
+
return [];
|
|
1075
|
+
}
|
|
1076
|
+
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
1077
|
+
const out = [];
|
|
1078
|
+
for (const record of records) {
|
|
1079
|
+
const uprojectPath = extractUprojectPathFromCommandLine(String(record?.CommandLine || ""));
|
|
1080
|
+
const executablePath = record?.ExecutablePath ? normalizeWindowsPath(record.ExecutablePath) : null;
|
|
1081
|
+
const inferredEngineRoot = executablePath ? inferEngineRootFromExecutablePath(executablePath) : null;
|
|
1082
|
+
if (wantedEngineRoot && !equalsIgnoreCaseWindows(inferredEngineRoot, wantedEngineRoot)) continue;
|
|
1083
|
+
const processIdNumber = Number(record?.ProcessId);
|
|
1084
|
+
out.push({
|
|
1085
|
+
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
1086
|
+
executablePath,
|
|
1087
|
+
engineRoot: inferredEngineRoot,
|
|
1088
|
+
uprojectPath,
|
|
1089
|
+
commandLine: record?.CommandLine ? String(record.CommandLine) : null,
|
|
1090
|
+
creationDate: record?.CreationDate ? String(record.CreationDate) : null
|
|
1091
|
+
});
|
|
1092
|
+
}
|
|
1093
|
+
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
1094
|
+
return out;
|
|
1095
|
+
}
|
|
1096
|
+
function parseRunningUnrealEditorProcessesFromGetProcessJson(input) {
|
|
1097
|
+
const engineRoot = String(input.engineRoot || "").trim();
|
|
1098
|
+
const wantedEngineRoot = engineRoot ? normalizeWindowsPath(engineRoot) : "";
|
|
1099
|
+
const raw = String(input.raw || "").trim();
|
|
1100
|
+
if (!raw) return [];
|
|
1101
|
+
let parsed;
|
|
1102
|
+
try {
|
|
1103
|
+
parsed = JSON.parse(raw);
|
|
1104
|
+
} catch {
|
|
1105
|
+
return [];
|
|
1106
|
+
}
|
|
1107
|
+
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
1108
|
+
const out = [];
|
|
1109
|
+
for (const record of records) {
|
|
1110
|
+
const executablePath = record?.Path ? normalizeWindowsPath(record.Path) : null;
|
|
1111
|
+
const inferredEngineRoot = executablePath ? inferEngineRootFromExecutablePath(executablePath) : null;
|
|
1112
|
+
if (wantedEngineRoot && !equalsIgnoreCaseWindows(inferredEngineRoot, wantedEngineRoot)) continue;
|
|
1113
|
+
const processIdNumber = Number(record?.Id);
|
|
1114
|
+
out.push({
|
|
1115
|
+
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
1116
|
+
executablePath,
|
|
1117
|
+
engineRoot: inferredEngineRoot,
|
|
1118
|
+
uprojectPath: null,
|
|
1119
|
+
commandLine: null,
|
|
1120
|
+
creationDate: record?.StartTime ? String(record.StartTime) : null
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
1124
|
+
return out;
|
|
1125
|
+
}
|
|
1126
|
+
function parseRunningUnrealEditorProcessesFromGetProcessMinimalJson(input) {
|
|
1127
|
+
const raw = String(input.raw || "").trim();
|
|
1128
|
+
if (!raw) return [];
|
|
1129
|
+
let parsed;
|
|
1130
|
+
try {
|
|
1131
|
+
parsed = JSON.parse(raw);
|
|
1132
|
+
} catch {
|
|
1133
|
+
return [];
|
|
1134
|
+
}
|
|
1135
|
+
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
1136
|
+
const out = [];
|
|
1137
|
+
for (const record of records) {
|
|
1138
|
+
const processIdNumber = Number(record?.Id);
|
|
1139
|
+
out.push({
|
|
1140
|
+
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
1141
|
+
executablePath: null,
|
|
1142
|
+
engineRoot: null,
|
|
1143
|
+
uprojectPath: null,
|
|
1144
|
+
commandLine: null,
|
|
1145
|
+
creationDate: record?.StartTime ? String(record.StartTime) : null
|
|
1146
|
+
});
|
|
1147
|
+
}
|
|
1148
|
+
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
1149
|
+
return out;
|
|
1150
|
+
}
|
|
1151
|
+
function detectRunningUnrealEditorProcess(options) {
|
|
1152
|
+
if (process.platform !== "win32") return null;
|
|
1153
|
+
const execFileSyncImpl = options?.execFileSyncImpl || execFileSync;
|
|
1154
|
+
const win32Script = [
|
|
1155
|
+
'$ErrorActionPreference = "Stop"',
|
|
1156
|
+
`$procs = Get-CimInstance Win32_Process -Filter "Name = 'UnrealEditor.exe'" | Select-Object ProcessId, ExecutablePath, CommandLine, CreationDate`,
|
|
1157
|
+
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
1158
|
+
].join("; ");
|
|
1159
|
+
try {
|
|
1160
|
+
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", win32Script], {
|
|
1161
|
+
encoding: "utf8",
|
|
1162
|
+
windowsHide: true,
|
|
1163
|
+
timeout: 1500
|
|
1164
|
+
});
|
|
1165
|
+
const matches = parseRunningUnrealEditorProcessesFromWindowsJson({
|
|
1166
|
+
raw: typeof raw === "string" ? raw : String(raw || ""),
|
|
1167
|
+
engineRoot: options?.engineRoot
|
|
1168
|
+
});
|
|
1169
|
+
return matches[0] || null;
|
|
1170
|
+
} catch {
|
|
1171
|
+
const getProcessScript = [
|
|
1172
|
+
'$ErrorActionPreference = "Stop"',
|
|
1173
|
+
"$procs = Get-Process UnrealEditor -ErrorAction SilentlyContinue | Select-Object Id, Path, StartTime",
|
|
1174
|
+
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
1175
|
+
].join("; ");
|
|
1176
|
+
try {
|
|
1177
|
+
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", getProcessScript], {
|
|
1178
|
+
encoding: "utf8",
|
|
1179
|
+
windowsHide: true,
|
|
1180
|
+
timeout: 1e3
|
|
1181
|
+
});
|
|
1182
|
+
const matches = parseRunningUnrealEditorProcessesFromGetProcessJson({
|
|
1183
|
+
raw: typeof raw === "string" ? raw : String(raw || ""),
|
|
1184
|
+
engineRoot: options?.engineRoot
|
|
1185
|
+
});
|
|
1186
|
+
return matches[0] || null;
|
|
1187
|
+
} catch {
|
|
1188
|
+
const getProcessMinimalScript = [
|
|
1189
|
+
'$ErrorActionPreference = "Stop"',
|
|
1190
|
+
"$procs = Get-Process UnrealEditor -ErrorAction SilentlyContinue | Select-Object Id, StartTime",
|
|
1191
|
+
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
1192
|
+
].join("; ");
|
|
1193
|
+
try {
|
|
1194
|
+
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", getProcessMinimalScript], {
|
|
1195
|
+
encoding: "utf8",
|
|
1196
|
+
windowsHide: true,
|
|
1197
|
+
timeout: 1e3
|
|
1198
|
+
});
|
|
1199
|
+
const matches = parseRunningUnrealEditorProcessesFromGetProcessMinimalJson({
|
|
1200
|
+
raw: typeof raw === "string" ? raw : String(raw || "")
|
|
1201
|
+
});
|
|
1202
|
+
return matches[0] || null;
|
|
1203
|
+
} catch {
|
|
1204
|
+
return null;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1209
|
+
function detectRunningUnrealEditorProject(options) {
|
|
1210
|
+
const match = detectRunningUnrealEditorProcess(options);
|
|
1211
|
+
return match?.uprojectPath ? match : null;
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1035
1214
|
function getPathApiForPlatform(platform) {
|
|
1036
1215
|
return platform === "win32" ? path.win32 : path.posix;
|
|
1037
1216
|
}
|
|
@@ -1914,13 +2093,20 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory, coordinatio
|
|
|
1914
2093
|
requiredCommands
|
|
1915
2094
|
}
|
|
1916
2095
|
};
|
|
2096
|
+
const detectedEditorProcess = detectRunningUnrealEditorProcess();
|
|
2097
|
+
if (detectedEditorProcess?.uprojectPath) {
|
|
2098
|
+
baseResponse.runningProjectUprojectPath = detectedEditorProcess.uprojectPath;
|
|
2099
|
+
}
|
|
2100
|
+
if (detectedEditorProcess?.engineRoot) {
|
|
2101
|
+
baseResponse.inferredEngineRoot = detectedEditorProcess.engineRoot ?? null;
|
|
2102
|
+
}
|
|
1917
2103
|
try {
|
|
1918
2104
|
await sendUnrealMcpTcpCommand({ type: "ping", host, port, timeoutMs });
|
|
1919
2105
|
} catch (err) {
|
|
1920
2106
|
const message = err instanceof Error ? err.message : String(err);
|
|
1921
2107
|
return {
|
|
1922
2108
|
...baseResponse,
|
|
1923
|
-
status: "not_running",
|
|
2109
|
+
status: detectedEditorProcess ? "editor_open_unreachable" : "not_running",
|
|
1924
2110
|
reachable: false,
|
|
1925
2111
|
error: message
|
|
1926
2112
|
};
|
|
@@ -1952,6 +2138,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory, coordinatio
|
|
|
1952
2138
|
const commands = Array.isArray(running?.commands) ? running.commands.filter((c) => typeof c === "string").map((c) => c.trim()).filter(Boolean) : [];
|
|
1953
2139
|
const missingCommands = requiredCommands.filter((c) => !commands.includes(c));
|
|
1954
2140
|
const inferredEngineRoot = baseDir ? inferEngineRootFromPluginBaseDir(baseDir) : null;
|
|
2141
|
+
const runningProject = detectRunningUnrealEditorProject(inferredEngineRoot ? { engineRoot: inferredEngineRoot } : {});
|
|
1955
2142
|
let play = null;
|
|
1956
2143
|
if (commands.includes("get_play_in_editor_status")) {
|
|
1957
2144
|
try {
|
|
@@ -1970,6 +2157,7 @@ function registerCommonHandlers(rpcHandlerManager, workingDirectory, coordinatio
|
|
|
1970
2157
|
...baseResponse,
|
|
1971
2158
|
status,
|
|
1972
2159
|
inferredEngineRoot,
|
|
2160
|
+
runningProjectUprojectPath: runningProject?.uprojectPath ?? null,
|
|
1973
2161
|
running: {
|
|
1974
2162
|
baseDir,
|
|
1975
2163
|
versionName,
|
|
@@ -3996,91 +4184,6 @@ Log: ${buildLogPath}`
|
|
|
3996
4184
|
return { ok: true, buildLogPath };
|
|
3997
4185
|
}
|
|
3998
4186
|
|
|
3999
|
-
function normalizeWindowsPath(value) {
|
|
4000
|
-
return path__default.win32.normalize(String(value || "").trim()).replace(/[\\/]+$/, "");
|
|
4001
|
-
}
|
|
4002
|
-
function equalsIgnoreCaseWindows(a, b) {
|
|
4003
|
-
return normalizeWindowsPath(a || "").toLowerCase() === normalizeWindowsPath(b || "").toLowerCase();
|
|
4004
|
-
}
|
|
4005
|
-
function extractUprojectPathFromCommandLine(commandLine) {
|
|
4006
|
-
const raw = String(commandLine || "").trim();
|
|
4007
|
-
if (!raw) return null;
|
|
4008
|
-
const matches = Array.from(raw.matchAll(/"([^"\r\n]+?\.uproject)"|([^\s"]+?\.uproject)/gi));
|
|
4009
|
-
for (const match of matches) {
|
|
4010
|
-
const candidate = String(match[1] || match[2] || "").trim();
|
|
4011
|
-
if (!candidate) continue;
|
|
4012
|
-
return normalizeWindowsPath(candidate);
|
|
4013
|
-
}
|
|
4014
|
-
return null;
|
|
4015
|
-
}
|
|
4016
|
-
function inferEngineRootFromExecutablePath(executablePath) {
|
|
4017
|
-
const normalized = normalizeWindowsPath(executablePath);
|
|
4018
|
-
if (!normalized) return null;
|
|
4019
|
-
const marker = `${path__default.win32.sep}Engine${path__default.win32.sep}Binaries${path__default.win32.sep}`;
|
|
4020
|
-
const idx = normalized.toLowerCase().indexOf(marker.toLowerCase());
|
|
4021
|
-
if (idx === -1) return null;
|
|
4022
|
-
return normalized.slice(0, idx);
|
|
4023
|
-
}
|
|
4024
|
-
function compareCreationDateDesc(a, b) {
|
|
4025
|
-
const aa = String(a || "").trim();
|
|
4026
|
-
const bb = String(b || "").trim();
|
|
4027
|
-
return bb.localeCompare(aa);
|
|
4028
|
-
}
|
|
4029
|
-
function parseRunningUnrealEditorProjectsFromWindowsJson(input) {
|
|
4030
|
-
const engineRoot = String(input.engineRoot || "").trim();
|
|
4031
|
-
const wantedEngineRoot = engineRoot ? normalizeWindowsPath(engineRoot) : "";
|
|
4032
|
-
const raw = String(input.raw || "").trim();
|
|
4033
|
-
if (!raw) return [];
|
|
4034
|
-
let parsed;
|
|
4035
|
-
try {
|
|
4036
|
-
parsed = JSON.parse(raw);
|
|
4037
|
-
} catch {
|
|
4038
|
-
return [];
|
|
4039
|
-
}
|
|
4040
|
-
const records = (Array.isArray(parsed) ? parsed : [parsed]).filter(Boolean);
|
|
4041
|
-
const out = [];
|
|
4042
|
-
for (const record of records) {
|
|
4043
|
-
const uprojectPath = extractUprojectPathFromCommandLine(String(record?.CommandLine || ""));
|
|
4044
|
-
if (!uprojectPath) continue;
|
|
4045
|
-
const executablePath = record?.ExecutablePath ? normalizeWindowsPath(record.ExecutablePath) : null;
|
|
4046
|
-
const inferredEngineRoot = executablePath ? inferEngineRootFromExecutablePath(executablePath) : null;
|
|
4047
|
-
if (wantedEngineRoot && !equalsIgnoreCaseWindows(inferredEngineRoot, wantedEngineRoot)) continue;
|
|
4048
|
-
const processIdNumber = Number(record?.ProcessId);
|
|
4049
|
-
out.push({
|
|
4050
|
-
processId: Number.isFinite(processIdNumber) && processIdNumber > 0 ? processIdNumber : null,
|
|
4051
|
-
executablePath,
|
|
4052
|
-
engineRoot: inferredEngineRoot,
|
|
4053
|
-
uprojectPath,
|
|
4054
|
-
commandLine: record?.CommandLine ? String(record.CommandLine) : null,
|
|
4055
|
-
creationDate: record?.CreationDate ? String(record.CreationDate) : null
|
|
4056
|
-
});
|
|
4057
|
-
}
|
|
4058
|
-
out.sort((a, b) => compareCreationDateDesc(a.creationDate, b.creationDate));
|
|
4059
|
-
return out;
|
|
4060
|
-
}
|
|
4061
|
-
function detectRunningUnrealEditorProject(options) {
|
|
4062
|
-
if (process.platform !== "win32") return null;
|
|
4063
|
-
const execFileSyncImpl = options?.execFileSyncImpl || execFileSync;
|
|
4064
|
-
const script = [
|
|
4065
|
-
'$ErrorActionPreference = "Stop"',
|
|
4066
|
-
`$procs = Get-CimInstance Win32_Process -Filter "Name = 'UnrealEditor.exe'" | Select-Object ProcessId, ExecutablePath, CommandLine, CreationDate`,
|
|
4067
|
-
'if ($null -eq $procs) { "[]" } else { $procs | ConvertTo-Json -Compress -Depth 3 }'
|
|
4068
|
-
].join("; ");
|
|
4069
|
-
try {
|
|
4070
|
-
const raw = execFileSyncImpl("powershell.exe", ["-NoProfile", "-Command", script], {
|
|
4071
|
-
encoding: "utf8",
|
|
4072
|
-
windowsHide: true
|
|
4073
|
-
});
|
|
4074
|
-
const matches = parseRunningUnrealEditorProjectsFromWindowsJson({
|
|
4075
|
-
raw: typeof raw === "string" ? raw : String(raw || ""),
|
|
4076
|
-
engineRoot: options?.engineRoot
|
|
4077
|
-
});
|
|
4078
|
-
return matches[0] || null;
|
|
4079
|
-
} catch {
|
|
4080
|
-
return null;
|
|
4081
|
-
}
|
|
4082
|
-
}
|
|
4083
|
-
|
|
4084
4187
|
function canWriteDir$1(dir) {
|
|
4085
4188
|
const root = String(dir || "").trim();
|
|
4086
4189
|
if (!root) return false;
|