@luaward/mcp 0.2.5 → 0.2.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.
- package/README.md +15 -5
- package/dist/cli.js +647 -111
- package/dist/cli.js.map +2 -2
- package/dist/index.js +652 -111
- package/dist/index.js.map +2 -2
- package/package.json +4 -2
- package/server.json +28 -0
package/dist/index.js
CHANGED
|
@@ -233,7 +233,7 @@ var PotassiumClient = class {
|
|
|
233
233
|
params: {
|
|
234
234
|
protocolVersion: "2025-03-26",
|
|
235
235
|
capabilities: {},
|
|
236
|
-
clientInfo: { name: "@luaward/mcp", version: "0.2.
|
|
236
|
+
clientInfo: { name: "@luaward/mcp", version: "0.2.7" }
|
|
237
237
|
}
|
|
238
238
|
})
|
|
239
239
|
});
|
|
@@ -748,7 +748,7 @@ var RobloxStudioMcpClient = class {
|
|
|
748
748
|
await this.sendRawRpc("initialize", {
|
|
749
749
|
protocolVersion: "2025-03-26",
|
|
750
750
|
capabilities: {},
|
|
751
|
-
clientInfo: { name: "@luaward/mcp", version: "0.2.
|
|
751
|
+
clientInfo: { name: "@luaward/mcp", version: "0.2.7" }
|
|
752
752
|
});
|
|
753
753
|
if (this.child && !this.child.killed) {
|
|
754
754
|
this.child.stdin.write(
|
|
@@ -1373,6 +1373,10 @@ namespace Luaward {
|
|
|
1373
1373
|
[DllImport("user32.dll")] public static extern bool IsIconic(IntPtr hWnd);
|
|
1374
1374
|
[DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();
|
|
1375
1375
|
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
1376
|
+
[DllImport("user32.dll")] public static extern bool BringWindowToTop(IntPtr hWnd);
|
|
1377
|
+
[DllImport("user32.dll")] public static extern bool AttachThreadInput(uint idAttach, uint idAttachTo, bool fAttach);
|
|
1378
|
+
[DllImport("user32.dll")] public static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
|
|
1379
|
+
[DllImport("kernel32.dll")] public static extern uint GetCurrentThreadId();
|
|
1376
1380
|
[DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
|
1377
1381
|
[DllImport("user32.dll")] public static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
|
|
1378
1382
|
[DllImport("user32.dll")] public static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
|
|
@@ -1392,6 +1396,52 @@ namespace Luaward {
|
|
|
1392
1396
|
|
|
1393
1397
|
public const uint GA_ROOT = 2;
|
|
1394
1398
|
public const uint PW_RENDERFULLCONTENT = 0x00000002;
|
|
1399
|
+
public const byte VK_MENU = 0x12;
|
|
1400
|
+
|
|
1401
|
+
public static bool ForceForegroundWindow(IntPtr targetHwnd) {
|
|
1402
|
+
if (targetHwnd == IntPtr.Zero) return false;
|
|
1403
|
+
if (IsIconic(targetHwnd)) {
|
|
1404
|
+
ShowWindow(targetHwnd, 9);
|
|
1405
|
+
}
|
|
1406
|
+
SetForegroundWindow(targetHwnd);
|
|
1407
|
+
if (GetForegroundWindow() == targetHwnd) {
|
|
1408
|
+
return true;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
IntPtr fg = GetForegroundWindow();
|
|
1412
|
+
uint dummyPid = 0;
|
|
1413
|
+
uint curTid = GetCurrentThreadId();
|
|
1414
|
+
uint targetTid = GetWindowThreadProcessId(targetHwnd, out dummyPid);
|
|
1415
|
+
uint fgTid = fg != IntPtr.Zero ? GetWindowThreadProcessId(fg, out dummyPid) : 0;
|
|
1416
|
+
|
|
1417
|
+
bool attachedCurToFg = false;
|
|
1418
|
+
bool attachedCurToTarget = false;
|
|
1419
|
+
bool attachedFgToTarget = false;
|
|
1420
|
+
try {
|
|
1421
|
+
if (fgTid != 0 && fgTid != curTid) {
|
|
1422
|
+
attachedCurToFg = AttachThreadInput(curTid, fgTid, true);
|
|
1423
|
+
}
|
|
1424
|
+
if (targetTid != 0 && targetTid != curTid) {
|
|
1425
|
+
attachedCurToTarget = AttachThreadInput(curTid, targetTid, true);
|
|
1426
|
+
}
|
|
1427
|
+
if (fgTid != 0 && targetTid != 0 && fgTid != targetTid) {
|
|
1428
|
+
attachedFgToTarget = AttachThreadInput(fgTid, targetTid, true);
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
// Briefly pulse Alt (VK_MENU) so Windows releases the Foreground Lock Timeout for background workers.
|
|
1432
|
+
keybd_event(VK_MENU, 0, 0, UIntPtr.Zero);
|
|
1433
|
+
keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, UIntPtr.Zero);
|
|
1434
|
+
|
|
1435
|
+
BringWindowToTop(targetHwnd);
|
|
1436
|
+
ShowWindow(targetHwnd, 5);
|
|
1437
|
+
SetForegroundWindow(targetHwnd);
|
|
1438
|
+
} finally {
|
|
1439
|
+
if (attachedFgToTarget) AttachThreadInput(fgTid, targetTid, false);
|
|
1440
|
+
if (attachedCurToTarget) AttachThreadInput(curTid, targetTid, false);
|
|
1441
|
+
if (attachedCurToFg) AttachThreadInput(curTid, fgTid, false);
|
|
1442
|
+
}
|
|
1443
|
+
return GetForegroundWindow() == targetHwnd;
|
|
1444
|
+
}
|
|
1395
1445
|
|
|
1396
1446
|
public static bool IsWindowTopAtPoint(IntPtr targetHwnd, int x, int y) {
|
|
1397
1447
|
if (targetHwnd == IntPtr.Zero) return false;
|
|
@@ -1710,20 +1760,37 @@ ${scriptBody}`;
|
|
|
1710
1760
|
if (!filterStr) return all;
|
|
1711
1761
|
return all.filter((w) => matchesWindowTarget(w, filterStr));
|
|
1712
1762
|
}
|
|
1713
|
-
async focusWindow(target) {
|
|
1763
|
+
async focusWindow(target, opts) {
|
|
1714
1764
|
const wins = await this.listWindows(target);
|
|
1715
1765
|
const win = wins[0];
|
|
1716
1766
|
if (!win) return { ok: false, err: `No window matching "${target}" found` };
|
|
1717
|
-
await this.runPsJson(
|
|
1718
|
-
`
|
|
1719
|
-
$h = [IntPtr]::new([Convert]::ToInt64("${win.hwnd}", 16))
|
|
1720
|
-
if ([Luaward.Win32Desktop]::IsIconic($h)) { [void][Luaward.Win32Desktop]::ShowWindow($h, 9) }
|
|
1721
|
-
[void][Luaward.Win32Desktop]::SetForegroundWindow($h)
|
|
1722
|
-
@{ ok = $true } | ConvertTo-Json -Compress
|
|
1723
|
-
`
|
|
1724
|
-
);
|
|
1767
|
+
const res = await this.runPsJson(buildFocusWindowPsScript(win.hwnd, opts?.verifyPoint));
|
|
1725
1768
|
const refreshed = (await this.listWindows(target))[0] ?? win;
|
|
1726
|
-
|
|
1769
|
+
const isForeground = Boolean(res.isForeground || refreshed.isForeground);
|
|
1770
|
+
const isTopAtPoint = Boolean(res.isTopAtPoint);
|
|
1771
|
+
const ok = isForeground || isTopAtPoint;
|
|
1772
|
+
return {
|
|
1773
|
+
ok,
|
|
1774
|
+
window: refreshed,
|
|
1775
|
+
isForeground,
|
|
1776
|
+
isTopAtPoint,
|
|
1777
|
+
fgProcess: res.fgProcess,
|
|
1778
|
+
...ok ? {} : {
|
|
1779
|
+
err: `Could not bring "${refreshed.title}" (${refreshed.hwnd}) to foreground; current foreground process is "${res.fgProcess || "unknown"}"`
|
|
1780
|
+
}
|
|
1781
|
+
};
|
|
1782
|
+
}
|
|
1783
|
+
async isWindowTopAtPoint(hwnd, x, y) {
|
|
1784
|
+
const rx = Math.round(x);
|
|
1785
|
+
const ry = Math.round(y);
|
|
1786
|
+
return this.runPsJson(`
|
|
1787
|
+
$h = [IntPtr]::new([Convert]::ToInt64("${hwnd}", 16))
|
|
1788
|
+
$fg = [Luaward.Win32Desktop]::GetForegroundWindow()
|
|
1789
|
+
$isFg = ($fg -eq $h)
|
|
1790
|
+
$isTop = [Luaward.Win32Desktop]::IsWindowTopAtPoint($h, ${rx}, ${ry})
|
|
1791
|
+
$fgProc = (Get-ForegroundProcessName)
|
|
1792
|
+
@{ ok = $true; isTop = $isTop; isForeground = $isFg; fgProcess = $fgProc } | ConvertTo-Json -Compress
|
|
1793
|
+
`);
|
|
1727
1794
|
}
|
|
1728
1795
|
async resizeWindow(opts) {
|
|
1729
1796
|
const wins = await this.listWindows(opts.target);
|
|
@@ -2214,6 +2281,21 @@ Walk-Ui $root 1
|
|
|
2214
2281
|
if ($nodes.Count -eq 0) { "[]" } else { ConvertTo-Json -InputObject $nodes.ToArray() -Depth 5 -Compress }
|
|
2215
2282
|
`;
|
|
2216
2283
|
}
|
|
2284
|
+
function buildFocusWindowPsScript(hwnd, checkPoint) {
|
|
2285
|
+
const hasPoint = Boolean(checkPoint && Number.isFinite(checkPoint.x) && Number.isFinite(checkPoint.y));
|
|
2286
|
+
const checkX = hasPoint ? Math.round(checkPoint.x) : 0;
|
|
2287
|
+
const checkY = hasPoint ? Math.round(checkPoint.y) : 0;
|
|
2288
|
+
return `
|
|
2289
|
+
$h = [IntPtr]::new([Convert]::ToInt64("${hwnd}", 16))
|
|
2290
|
+
[void][Luaward.Win32Desktop]::ForceForegroundWindow($h)
|
|
2291
|
+
Start-Sleep -Milliseconds 40
|
|
2292
|
+
$fg = [Luaward.Win32Desktop]::GetForegroundWindow()
|
|
2293
|
+
$isFg = ($fg -eq $h)
|
|
2294
|
+
$isTop = ${hasPoint ? `[Luaward.Win32Desktop]::IsWindowTopAtPoint($h, ${checkX}, ${checkY})` : "$isFg"}
|
|
2295
|
+
$fgProc = (Get-ForegroundProcessName)
|
|
2296
|
+
@{ ok = ($isFg -or $isTop); isForeground = $isFg; isTopAtPoint = $isTop; fgProcess = $fgProc } | ConvertTo-Json -Compress
|
|
2297
|
+
`;
|
|
2298
|
+
}
|
|
2217
2299
|
function buildScreenshotPsScript(opts) {
|
|
2218
2300
|
const hasHwnd = Boolean(opts.hwnd?.startsWith("0x"));
|
|
2219
2301
|
return `
|
|
@@ -2360,7 +2442,7 @@ function matchesWindowTarget(w, filter) {
|
|
|
2360
2442
|
}
|
|
2361
2443
|
|
|
2362
2444
|
// src/index.ts
|
|
2363
|
-
var MCP_BRIDGE_VERSION = "0.2.
|
|
2445
|
+
var MCP_BRIDGE_VERSION = "0.2.7";
|
|
2364
2446
|
var DEFAULT_MCP_URL = "https://luaward.com/mcp";
|
|
2365
2447
|
var TOKEN_CREATE_URL = "https://dash.luaward.com/dashboard/ai";
|
|
2366
2448
|
var TOKEN_SHAPE = /^lwm_[0-9a-f]{48}$/;
|
|
@@ -2458,6 +2540,145 @@ function extractProtocolVersion(parsed) {
|
|
|
2458
2540
|
return void 0;
|
|
2459
2541
|
}
|
|
2460
2542
|
var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
2543
|
+
var CLOUD_RESULT_PAGE_MAX_CHUNKS = 25;
|
|
2544
|
+
var CLOUD_RESULT_PAGE_LIMIT = 1e5;
|
|
2545
|
+
function stripExecPageEnvelope(rawText) {
|
|
2546
|
+
let body = rawText.replace(/^\[Auto-injected[^\n]*\]\r?\n/, "");
|
|
2547
|
+
body = body.replace(/^answer from the game \(untrusted\):\r?\n/, "");
|
|
2548
|
+
const consoleDoubleIdx = body.indexOf("\n\nconsole (from the game");
|
|
2549
|
+
if (consoleDoubleIdx !== -1) {
|
|
2550
|
+
body = body.slice(0, consoleDoubleIdx);
|
|
2551
|
+
} else {
|
|
2552
|
+
const consoleSingleIdx = body.indexOf("\nconsole (from the game");
|
|
2553
|
+
if (consoleSingleIdx !== -1) {
|
|
2554
|
+
body = body.slice(0, consoleSingleIdx);
|
|
2555
|
+
}
|
|
2556
|
+
}
|
|
2557
|
+
let agentTruncated = false;
|
|
2558
|
+
const cutMarkerMatch = /\r?\n\(the answer was cut to fit\)$/.exec(body);
|
|
2559
|
+
if (cutMarkerMatch) {
|
|
2560
|
+
agentTruncated = true;
|
|
2561
|
+
body = body.slice(0, cutMarkerMatch.index);
|
|
2562
|
+
}
|
|
2563
|
+
const continueMatch = /\r?\n\.\.\. \[(\d+)\.\.(\d+) of (\d+) chars; (\d+) more characters(?:; page with get_result\(cmd="([0-9a-f]{32})", offset=(\d+)\))?\]$/.exec(
|
|
2564
|
+
body
|
|
2565
|
+
);
|
|
2566
|
+
if (continueMatch) {
|
|
2567
|
+
body = body.slice(0, continueMatch.index);
|
|
2568
|
+
const offset = Number(continueMatch[1]);
|
|
2569
|
+
const end = Number(continueMatch[2]);
|
|
2570
|
+
const total = Number(continueMatch[3]);
|
|
2571
|
+
const remaining = Number(continueMatch[4]);
|
|
2572
|
+
const cmdId = continueMatch[5];
|
|
2573
|
+
const nextOffset = continueMatch[6] !== void 0 ? Number(continueMatch[6]) : end;
|
|
2574
|
+
return {
|
|
2575
|
+
body,
|
|
2576
|
+
hasMore: true,
|
|
2577
|
+
cmdId,
|
|
2578
|
+
offset,
|
|
2579
|
+
end,
|
|
2580
|
+
total,
|
|
2581
|
+
remaining,
|
|
2582
|
+
nextOffset,
|
|
2583
|
+
agentTruncated
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
const endMatch = /\r?\n\.\.\. \[end of (\d+) chars \((\d+)\.\.(\d+)\)\]$/.exec(body);
|
|
2587
|
+
if (endMatch) {
|
|
2588
|
+
body = body.slice(0, endMatch.index);
|
|
2589
|
+
return {
|
|
2590
|
+
body,
|
|
2591
|
+
hasMore: false,
|
|
2592
|
+
total: Number(endMatch[1]),
|
|
2593
|
+
offset: Number(endMatch[2]),
|
|
2594
|
+
end: Number(endMatch[3]),
|
|
2595
|
+
agentTruncated
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2598
|
+
return {
|
|
2599
|
+
body,
|
|
2600
|
+
hasMore: false,
|
|
2601
|
+
agentTruncated
|
|
2602
|
+
};
|
|
2603
|
+
}
|
|
2604
|
+
function extractJsonPayloadFromExec(rawText) {
|
|
2605
|
+
const cleaned = stripExecPageEnvelope(rawText).body.trim();
|
|
2606
|
+
if (!cleaned) return null;
|
|
2607
|
+
const candidates = [cleaned];
|
|
2608
|
+
if (cleaned.startsWith('"') && cleaned.endsWith('"')) {
|
|
2609
|
+
try {
|
|
2610
|
+
const unquoted = JSON.parse(cleaned);
|
|
2611
|
+
if (typeof unquoted === "string") candidates.unshift(unquoted.trim());
|
|
2612
|
+
} catch {
|
|
2613
|
+
}
|
|
2614
|
+
}
|
|
2615
|
+
const firstArr = cleaned.indexOf("[");
|
|
2616
|
+
const firstObj = cleaned.indexOf("{");
|
|
2617
|
+
let firstIdx = -1;
|
|
2618
|
+
let expectedClose = "";
|
|
2619
|
+
if (firstArr >= 0 && (firstObj < 0 || firstArr < firstObj)) {
|
|
2620
|
+
firstIdx = firstArr;
|
|
2621
|
+
expectedClose = "]";
|
|
2622
|
+
} else if (firstObj >= 0) {
|
|
2623
|
+
firstIdx = firstObj;
|
|
2624
|
+
expectedClose = "}";
|
|
2625
|
+
}
|
|
2626
|
+
if (firstIdx >= 0) {
|
|
2627
|
+
const lastIdx = cleaned.lastIndexOf(expectedClose);
|
|
2628
|
+
if (lastIdx > firstIdx) {
|
|
2629
|
+
candidates.push(cleaned.slice(firstIdx, lastIdx + 1));
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
for (const c of candidates) {
|
|
2633
|
+
try {
|
|
2634
|
+
return JSON.parse(c);
|
|
2635
|
+
} catch {
|
|
2636
|
+
}
|
|
2637
|
+
}
|
|
2638
|
+
return null;
|
|
2639
|
+
}
|
|
2640
|
+
var KNOWN_STUDIO_SERVICES = /* @__PURE__ */ new Set([
|
|
2641
|
+
"ServerStorage",
|
|
2642
|
+
"ReplicatedStorage",
|
|
2643
|
+
"ServerScriptService",
|
|
2644
|
+
"StarterPlayer",
|
|
2645
|
+
"StarterGui",
|
|
2646
|
+
"StarterPack",
|
|
2647
|
+
"Workspace",
|
|
2648
|
+
"Lighting",
|
|
2649
|
+
"ReplicatedFirst"
|
|
2650
|
+
]);
|
|
2651
|
+
function resolveStudioContainerPath(rawInput, defaultService = "ServerStorage", defaultFolder = "LuawardLiveScripts") {
|
|
2652
|
+
const raw = (rawInput ?? "").trim().replace(/^game\./, "");
|
|
2653
|
+
if (!raw) {
|
|
2654
|
+
return {
|
|
2655
|
+
service: defaultService,
|
|
2656
|
+
segments: [defaultFolder],
|
|
2657
|
+
displayPath: `${defaultService}.${defaultFolder}`
|
|
2658
|
+
};
|
|
2659
|
+
}
|
|
2660
|
+
const segs = raw.split(".").map((s) => s.trim()).filter(Boolean);
|
|
2661
|
+
if (segs.length === 0) {
|
|
2662
|
+
return {
|
|
2663
|
+
service: defaultService,
|
|
2664
|
+
segments: [defaultFolder],
|
|
2665
|
+
displayPath: `${defaultService}.${defaultFolder}`
|
|
2666
|
+
};
|
|
2667
|
+
}
|
|
2668
|
+
if (KNOWN_STUDIO_SERVICES.has(segs[0])) {
|
|
2669
|
+
const subSegs = segs.length > 1 ? segs.slice(1) : [defaultFolder];
|
|
2670
|
+
return {
|
|
2671
|
+
service: segs[0],
|
|
2672
|
+
segments: subSegs,
|
|
2673
|
+
displayPath: `${segs[0]}.${subSegs.join(".")}`
|
|
2674
|
+
};
|
|
2675
|
+
}
|
|
2676
|
+
return {
|
|
2677
|
+
service: defaultService,
|
|
2678
|
+
segments: segs,
|
|
2679
|
+
displayPath: `${defaultService}.${segs.join(".")}`
|
|
2680
|
+
};
|
|
2681
|
+
}
|
|
2461
2682
|
var LOCAL_HYBRID_TOOLS = [
|
|
2462
2683
|
{
|
|
2463
2684
|
name: "editor_tabs",
|
|
@@ -2890,7 +3111,7 @@ var LOCAL_HYBRID_TOOLS = [
|
|
|
2890
3111
|
kind: {
|
|
2891
3112
|
type: "string",
|
|
2892
3113
|
enum: ["network", "bindable", "all"],
|
|
2893
|
-
description: "Remote kind filter (default '
|
|
3114
|
+
description: "Remote kind filter (default 'network' - prioritizes RemoteEvent/RemoteFunction/UnreliableRemoteEvent)"
|
|
2894
3115
|
},
|
|
2895
3116
|
max: {
|
|
2896
3117
|
type: "integer",
|
|
@@ -3077,7 +3298,13 @@ var LOCAL_HYBRID_TOOLS = [
|
|
|
3077
3298
|
},
|
|
3078
3299
|
wait_seconds: {
|
|
3079
3300
|
type: "number",
|
|
3080
|
-
description: "
|
|
3301
|
+
description: "Convenience settle time in seconds; mapped to run_and_collect settle_ms (0..15000 ms) when settle_ms is omitted"
|
|
3302
|
+
},
|
|
3303
|
+
timeout_ms: {
|
|
3304
|
+
type: "integer",
|
|
3305
|
+
minimum: 1e3,
|
|
3306
|
+
maximum: 85e3,
|
|
3307
|
+
description: "Maximum wait/runtime in milliseconds for run_and_collect (1000..85000, default 30000)"
|
|
3081
3308
|
},
|
|
3082
3309
|
clean_env: {
|
|
3083
3310
|
type: "boolean",
|
|
@@ -3134,19 +3361,15 @@ var LOCAL_HYBRID_TOOLS = [
|
|
|
3134
3361
|
},
|
|
3135
3362
|
script_id: {
|
|
3136
3363
|
type: "string",
|
|
3137
|
-
description: "
|
|
3364
|
+
description: "Alias for script (target Luaward Cloud script ID to deploy to)"
|
|
3138
3365
|
},
|
|
3139
3366
|
name: {
|
|
3140
3367
|
type: "string",
|
|
3141
3368
|
description: "New Luaward Cloud script name when creating a new script"
|
|
3142
3369
|
},
|
|
3143
|
-
|
|
3370
|
+
project_id: {
|
|
3144
3371
|
type: "string",
|
|
3145
|
-
description: "Optional
|
|
3146
|
-
},
|
|
3147
|
-
note: {
|
|
3148
|
-
type: "string",
|
|
3149
|
-
description: "Optional build note when deploying to an existing Luaward script"
|
|
3372
|
+
description: "Optional project ID from list_projects when creating a new script"
|
|
3150
3373
|
},
|
|
3151
3374
|
studio_path: {
|
|
3152
3375
|
type: "string",
|
|
@@ -3154,13 +3377,27 @@ var LOCAL_HYBRID_TOOLS = [
|
|
|
3154
3377
|
},
|
|
3155
3378
|
publish: {
|
|
3156
3379
|
type: "boolean",
|
|
3157
|
-
description: "Promote build to live automatically (default true; false for staged draft)"
|
|
3380
|
+
description: "Promote build to live automatically when deploying (default true; false for staged draft)"
|
|
3381
|
+
},
|
|
3382
|
+
draft: {
|
|
3383
|
+
type: "boolean",
|
|
3384
|
+
description: "Shorthand for publish=false when deploying (stage a draft build without updating live users)"
|
|
3158
3385
|
},
|
|
3159
3386
|
preset: {
|
|
3160
3387
|
type: "string",
|
|
3161
3388
|
enum: ["fast", "balanced", "max"],
|
|
3162
3389
|
description: "Optional protection preset"
|
|
3163
3390
|
},
|
|
3391
|
+
store_source: {
|
|
3392
|
+
type: "boolean",
|
|
3393
|
+
description: "Keep encrypted raw source on Luaward after compilation (requires 2FA)"
|
|
3394
|
+
},
|
|
3395
|
+
wait: {
|
|
3396
|
+
type: "integer",
|
|
3397
|
+
minimum: 0,
|
|
3398
|
+
maximum: 60,
|
|
3399
|
+
description: "Optional seconds to wait for the compiler build to finish (0..60, default 0)"
|
|
3400
|
+
},
|
|
3164
3401
|
datamodel_type: {
|
|
3165
3402
|
type: "string",
|
|
3166
3403
|
enum: ["Edit", "Client", "Server"],
|
|
@@ -3199,11 +3436,11 @@ var LOCAL_HYBRID_TOOLS = [
|
|
|
3199
3436
|
},
|
|
3200
3437
|
studio_root: {
|
|
3201
3438
|
type: "string",
|
|
3202
|
-
description: "
|
|
3439
|
+
description: "Destination container path in Studio (e.g. 'ServerStorage.LiveImports', 'ReplicatedStorage.Debug.LiveScripts', or plain folder name under ServerStorage; default 'ServerStorage.LuawardLiveScripts')"
|
|
3203
3440
|
},
|
|
3204
3441
|
container_name: {
|
|
3205
3442
|
type: "string",
|
|
3206
|
-
description: "Alias for studio_root destination folder name
|
|
3443
|
+
description: "Alias for studio_root destination path or folder name (default 'ServerStorage.LuawardLiveScripts')"
|
|
3207
3444
|
},
|
|
3208
3445
|
max: {
|
|
3209
3446
|
type: "integer",
|
|
@@ -3276,6 +3513,18 @@ var LOCAL_HYBRID_TOOLS = [
|
|
|
3276
3513
|
focus_first: {
|
|
3277
3514
|
type: "boolean",
|
|
3278
3515
|
description: "Focus each window before capturing (default false)"
|
|
3516
|
+
},
|
|
3517
|
+
include_images: {
|
|
3518
|
+
type: "boolean",
|
|
3519
|
+
description: "Include both PNG images side by side in the response (default true)"
|
|
3520
|
+
},
|
|
3521
|
+
base64_a: {
|
|
3522
|
+
type: "string",
|
|
3523
|
+
description: "Optional pre-captured PNG base64 string for image A instead of capturing target_a"
|
|
3524
|
+
},
|
|
3525
|
+
base64_b: {
|
|
3526
|
+
type: "string",
|
|
3527
|
+
description: "Optional pre-captured PNG base64 string for image B instead of capturing target_b"
|
|
3279
3528
|
}
|
|
3280
3529
|
},
|
|
3281
3530
|
additionalProperties: false
|
|
@@ -3299,6 +3548,7 @@ var HybridMcpBridge = class {
|
|
|
3299
3548
|
autoInjectPollMs;
|
|
3300
3549
|
autoInjectMaxPolls;
|
|
3301
3550
|
autoInjectCooldownMs;
|
|
3551
|
+
verifyDelayMs;
|
|
3302
3552
|
fetchFn;
|
|
3303
3553
|
stderr;
|
|
3304
3554
|
cachedPairCommand;
|
|
@@ -3319,6 +3569,7 @@ var HybridMcpBridge = class {
|
|
|
3319
3569
|
this.autoInjectPollMs = options.autoInjectPollMs ?? 400;
|
|
3320
3570
|
this.autoInjectMaxPolls = options.autoInjectMaxPolls ?? 15;
|
|
3321
3571
|
this.autoInjectCooldownMs = options.autoInjectCooldownMs ?? 3e4;
|
|
3572
|
+
this.verifyDelayMs = options.verifyDelayMs ?? 120;
|
|
3322
3573
|
this.potassium = options.potassiumClient ?? new PotassiumClient({
|
|
3323
3574
|
url: options.potassiumUrl ?? resolved.potassiumUrl,
|
|
3324
3575
|
token: options.potassiumToken !== void 0 ? options.potassiumToken : resolved.potassiumToken,
|
|
@@ -4012,8 +4263,8 @@ ${lines.join("\n")}` }]
|
|
|
4012
4263
|
const vpX = vpXMatch ? Number(vpXMatch[1]) : 0;
|
|
4013
4264
|
const vpY = vpYMatch ? Number(vpYMatch[1]) : 0;
|
|
4014
4265
|
const resolvedPath = pathMatch?.[1] ?? target;
|
|
4015
|
-
|
|
4016
|
-
if (!focusRes.
|
|
4266
|
+
let focusRes = await this.windows.focusWindow("roblox");
|
|
4267
|
+
if (!focusRes.window) {
|
|
4017
4268
|
return {
|
|
4018
4269
|
content: [
|
|
4019
4270
|
{ type: "text", text: `os_click could not find Roblox window: ${focusRes.err ?? "not found"}` }
|
|
@@ -4026,6 +4277,40 @@ ${lines.join("\n")}` }]
|
|
|
4026
4277
|
const scaleY = vpY > 0 && cr.height > 0 ? cr.height / vpY : 1;
|
|
4027
4278
|
const screenX = Math.round(cr.screenLeft + clientX * scaleX);
|
|
4028
4279
|
const screenY = Math.round(cr.screenTop + clientY * scaleY);
|
|
4280
|
+
const checkWindowReady = async (res) => {
|
|
4281
|
+
if (!res.ok || !res.window) {
|
|
4282
|
+
return { ready: false, fgProcess: res.fgProcess };
|
|
4283
|
+
}
|
|
4284
|
+
if (this.windows.isWindowTopAtPoint && res.isTopAtPoint === void 0) {
|
|
4285
|
+
const pt = await this.windows.isWindowTopAtPoint(res.window.hwnd, screenX, screenY);
|
|
4286
|
+
return { ready: pt.isTop || pt.isForeground, fgProcess: pt.fgProcess ?? res.fgProcess };
|
|
4287
|
+
}
|
|
4288
|
+
if (res.isTopAtPoint !== void 0 || res.isForeground !== void 0) {
|
|
4289
|
+
return {
|
|
4290
|
+
ready: Boolean(res.isTopAtPoint || res.isForeground),
|
|
4291
|
+
fgProcess: res.fgProcess
|
|
4292
|
+
};
|
|
4293
|
+
}
|
|
4294
|
+
return { ready: Boolean(res.window.isForeground), fgProcess: res.fgProcess };
|
|
4295
|
+
};
|
|
4296
|
+
let readiness = await checkWindowReady(focusRes);
|
|
4297
|
+
if (!readiness.ready) {
|
|
4298
|
+
focusRes = await this.windows.focusWindow("roblox", { verifyPoint: { x: screenX, y: screenY } });
|
|
4299
|
+
readiness = await checkWindowReady(focusRes);
|
|
4300
|
+
}
|
|
4301
|
+
if (!readiness.ready) {
|
|
4302
|
+
const fgDesc = readiness.fgProcess ? ` (current foreground process: "${readiness.fgProcess}")` : "";
|
|
4303
|
+
const errDetail = focusRes.err ? ` (${focusRes.err})` : "";
|
|
4304
|
+
return {
|
|
4305
|
+
content: [
|
|
4306
|
+
{
|
|
4307
|
+
type: "text",
|
|
4308
|
+
text: `os_click aborted: Roblox window did not reach foreground or is occluded at screen=(${screenX}, ${screenY})${fgDesc}${errDetail}; click cancelled to avoid hitting another window.`
|
|
4309
|
+
}
|
|
4310
|
+
],
|
|
4311
|
+
isError: true
|
|
4312
|
+
};
|
|
4313
|
+
}
|
|
4029
4314
|
const mouseAction = args.double_click === true ? "double_click" : args.button === "right" ? "right_click" : "click";
|
|
4030
4315
|
const session = typeof args.session === "string" ? args.session : void 0;
|
|
4031
4316
|
const shouldVerify = args.verify === true;
|
|
@@ -4088,6 +4373,9 @@ ${verifyText}`;
|
|
|
4088
4373
|
return out.join("\n");
|
|
4089
4374
|
}
|
|
4090
4375
|
async verifyMouseActionInGame(beforeSnap, session) {
|
|
4376
|
+
if (this.verifyDelayMs > 0) {
|
|
4377
|
+
await sleep(this.verifyDelayMs);
|
|
4378
|
+
}
|
|
4091
4379
|
const lines = ["Verification:"];
|
|
4092
4380
|
try {
|
|
4093
4381
|
const mouseCode = [
|
|
@@ -4120,7 +4408,7 @@ ${verifyText}`;
|
|
|
4120
4408
|
}
|
|
4121
4409
|
try {
|
|
4122
4410
|
const snapRes = await this.callCloudTool("gui_snapshot", {
|
|
4123
|
-
diff_from: "
|
|
4411
|
+
diff_from: "last",
|
|
4124
4412
|
...session ? { session } : {}
|
|
4125
4413
|
});
|
|
4126
4414
|
if (snapRes.ok) {
|
|
@@ -4135,29 +4423,98 @@ ${diffSummary}`);
|
|
|
4135
4423
|
}
|
|
4136
4424
|
return lines.join("\n");
|
|
4137
4425
|
}
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
if (
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4426
|
+
async execWithFullOutput(args) {
|
|
4427
|
+
let firstRes = await this.callCloudTool("exec", args);
|
|
4428
|
+
if (this.autoInject && firstRes.isError && firstRes.text.includes("no game is connected")) {
|
|
4429
|
+
const inj = await this.tryZeroTouchAutoInject();
|
|
4430
|
+
if (inj.injected) {
|
|
4431
|
+
firstRes = await this.callCloudTool("exec", args);
|
|
4432
|
+
} else {
|
|
4433
|
+
firstRes = {
|
|
4434
|
+
...firstRes,
|
|
4435
|
+
text: `${firstRes.text}
|
|
4436
|
+
[Zero-Touch Auto-Inject failed: ${inj.text}]`
|
|
4437
|
+
};
|
|
4147
4438
|
}
|
|
4148
4439
|
}
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4440
|
+
if (!firstRes.ok) {
|
|
4441
|
+
return {
|
|
4442
|
+
ok: false,
|
|
4443
|
+
text: firstRes.text,
|
|
4444
|
+
fullBody: "",
|
|
4445
|
+
pages: 1,
|
|
4446
|
+
truncated: false,
|
|
4447
|
+
isError: true
|
|
4448
|
+
};
|
|
4153
4449
|
}
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4450
|
+
const firstEnv = stripExecPageEnvelope(firstRes.text);
|
|
4451
|
+
let assembled = firstEnv.body;
|
|
4452
|
+
let pages = 1;
|
|
4453
|
+
let truncated = firstEnv.agentTruncated;
|
|
4454
|
+
let hasMore = firstEnv.hasMore;
|
|
4455
|
+
let nextCmd = firstEnv.cmdId;
|
|
4456
|
+
let nextOffset = firstEnv.nextOffset;
|
|
4457
|
+
const session = typeof args.session === "string" && args.session.trim() ? args.session.trim() : void 0;
|
|
4458
|
+
while (hasMore && nextCmd && nextOffset !== void 0 && pages < CLOUD_RESULT_PAGE_MAX_CHUNKS) {
|
|
4459
|
+
const pageRes = await this.callCloudTool("get_result", {
|
|
4460
|
+
cmd: nextCmd,
|
|
4461
|
+
offset: nextOffset,
|
|
4462
|
+
limit: CLOUD_RESULT_PAGE_LIMIT,
|
|
4463
|
+
...session ? { session } : {}
|
|
4464
|
+
});
|
|
4465
|
+
if (!pageRes.ok) {
|
|
4466
|
+
return {
|
|
4467
|
+
ok: false,
|
|
4468
|
+
text: `get_result pagination failed at offset ${nextOffset} (cmd=${nextCmd}): ${pageRes.text}`,
|
|
4469
|
+
fullBody: assembled,
|
|
4470
|
+
pages,
|
|
4471
|
+
truncated: true,
|
|
4472
|
+
isError: true
|
|
4473
|
+
};
|
|
4158
4474
|
}
|
|
4475
|
+
const env = stripExecPageEnvelope(pageRes.text);
|
|
4476
|
+
if (env.agentTruncated) truncated = true;
|
|
4477
|
+
if (env.body.length === 0) {
|
|
4478
|
+
truncated = true;
|
|
4479
|
+
break;
|
|
4480
|
+
}
|
|
4481
|
+
assembled += env.body;
|
|
4482
|
+
pages += 1;
|
|
4483
|
+
hasMore = env.hasMore;
|
|
4484
|
+
const next = env.nextOffset;
|
|
4485
|
+
if (env.cmdId) nextCmd = env.cmdId;
|
|
4486
|
+
if (hasMore && (next === void 0 || next <= nextOffset)) {
|
|
4487
|
+
truncated = true;
|
|
4488
|
+
break;
|
|
4489
|
+
}
|
|
4490
|
+
nextOffset = next;
|
|
4159
4491
|
}
|
|
4160
|
-
|
|
4492
|
+
if (hasMore) {
|
|
4493
|
+
truncated = true;
|
|
4494
|
+
}
|
|
4495
|
+
return {
|
|
4496
|
+
ok: true,
|
|
4497
|
+
text: firstRes.text,
|
|
4498
|
+
fullBody: assembled,
|
|
4499
|
+
pages,
|
|
4500
|
+
truncated,
|
|
4501
|
+
isError: false
|
|
4502
|
+
};
|
|
4503
|
+
}
|
|
4504
|
+
formatJsonParseError(toolName, sourceLabel, rawBody, pages = 1, truncated = false) {
|
|
4505
|
+
const excerpt = rawBody.trim().slice(0, 320);
|
|
4506
|
+
return {
|
|
4507
|
+
content: [
|
|
4508
|
+
{
|
|
4509
|
+
type: "text",
|
|
4510
|
+
text: `${toolName} failed to parse JSON from ${sourceLabel} (pages=${pages}, truncated=${truncated}, length=${rawBody.length}): ${excerpt || "(empty response)"}`
|
|
4511
|
+
}
|
|
4512
|
+
],
|
|
4513
|
+
isError: true
|
|
4514
|
+
};
|
|
4515
|
+
}
|
|
4516
|
+
extractJsonPayloadFromExec(rawText) {
|
|
4517
|
+
return extractJsonPayloadFromExec(rawText);
|
|
4161
4518
|
}
|
|
4162
4519
|
parseStudioDataModelType(raw) {
|
|
4163
4520
|
if (raw === "Client" || raw === "Server" || raw === "Edit") {
|
|
@@ -4169,7 +4526,7 @@ ${diffSummary}`);
|
|
|
4169
4526
|
const singleRoot = typeof args.root === "string" && args.root.trim() ? args.root.trim() : "";
|
|
4170
4527
|
const roots = singleRoot ? [singleRoot] : Array.isArray(args.roots) && args.roots.length > 0 ? args.roots.map(String) : ["ReplicatedStorage", "Workspace"];
|
|
4171
4528
|
const filter = typeof args.filter === "string" ? args.filter.trim().toLowerCase() : "";
|
|
4172
|
-
const kind = args.kind === "
|
|
4529
|
+
const kind = args.kind === "all" || args.kind === "bindable" || args.kind === "network" ? args.kind : "network";
|
|
4173
4530
|
const max = typeof args.max === "number" ? Math.max(1, Math.min(500, Math.floor(args.max))) : 200;
|
|
4174
4531
|
const maxDepth = typeof args.max_depth === "number" ? Math.max(1, Math.min(12, Math.floor(args.max_depth))) : 6;
|
|
4175
4532
|
const clearExisting = args.clear_existing === true;
|
|
@@ -4183,14 +4540,37 @@ ${diffSummary}`);
|
|
|
4183
4540
|
BindableEvent: true,
|
|
4184
4541
|
BindableFunction: true
|
|
4185
4542
|
};
|
|
4543
|
+
const netPriorityMap = {
|
|
4544
|
+
RemoteEvent: true,
|
|
4545
|
+
RemoteFunction: true,
|
|
4546
|
+
UnreliableRemoteEvent: true
|
|
4547
|
+
};
|
|
4548
|
+
const lowPriorityFolders = {
|
|
4549
|
+
assets: true,
|
|
4550
|
+
models: true,
|
|
4551
|
+
characters: true,
|
|
4552
|
+
animations: true,
|
|
4553
|
+
sounds: true,
|
|
4554
|
+
meshes: true,
|
|
4555
|
+
effects: true,
|
|
4556
|
+
vfx: true,
|
|
4557
|
+
particles: true,
|
|
4558
|
+
clientguis: true,
|
|
4559
|
+
stories: true,
|
|
4560
|
+
dialogues: true
|
|
4561
|
+
};
|
|
4186
4562
|
const liveScanCode = [
|
|
4187
4563
|
"local HttpService = game:GetService('HttpService')",
|
|
4188
4564
|
`local roots = ${toLuauLiteral(roots)}`,
|
|
4189
4565
|
`local filter = ${toLuauLiteral(filter)}`,
|
|
4190
4566
|
`local maxItems = ${toLuauLiteral(max)}`,
|
|
4191
4567
|
`local maxDepth = ${toLuauLiteral(maxDepth)}`,
|
|
4568
|
+
`local kindMode = ${toLuauLiteral(kind)}`,
|
|
4192
4569
|
`local remoteClasses = ${toLuauLiteral(remoteClassesMap)}`,
|
|
4193
|
-
|
|
4570
|
+
`local netPriorityClasses = ${toLuauLiteral(netPriorityMap)}`,
|
|
4571
|
+
`local lowPriorityFolders = ${toLuauLiteral(lowPriorityFolders)}`,
|
|
4572
|
+
"local netItems = {}",
|
|
4573
|
+
"local otherItems = {}",
|
|
4194
4574
|
"local function resolveRoot(rPath)",
|
|
4195
4575
|
" local segs = {}",
|
|
4196
4576
|
" for seg in string.gmatch(rPath, '[^%.]+') do segs[#segs + 1] = seg end",
|
|
@@ -4207,31 +4587,79 @@ ${diffSummary}`);
|
|
|
4207
4587
|
" end",
|
|
4208
4588
|
" return cur, rootName, baseSegs",
|
|
4209
4589
|
"end",
|
|
4210
|
-
"local
|
|
4211
|
-
"
|
|
4212
|
-
"
|
|
4213
|
-
"
|
|
4214
|
-
"
|
|
4215
|
-
"
|
|
4216
|
-
"
|
|
4217
|
-
"
|
|
4218
|
-
"
|
|
4219
|
-
"
|
|
4220
|
-
"
|
|
4590
|
+
"local normalQ = {}",
|
|
4591
|
+
"local lowQ = {}",
|
|
4592
|
+
"local nHead, lHead = 1, 1",
|
|
4593
|
+
"local visited = 0",
|
|
4594
|
+
"local maxVisited = 6000",
|
|
4595
|
+
"for _, rPath in ipairs(roots) do",
|
|
4596
|
+
" local inst, rootName, baseSegs = resolveRoot(rPath)",
|
|
4597
|
+
" if inst and rootName and baseSegs then",
|
|
4598
|
+
" normalQ[#normalQ + 1] = { inst = inst, rootName = rootName, segs = baseSegs, depth = 1 }",
|
|
4599
|
+
" end",
|
|
4600
|
+
"end",
|
|
4601
|
+
"local function nextNode()",
|
|
4602
|
+
" if nHead <= #normalQ then",
|
|
4603
|
+
" local n = normalQ[nHead]",
|
|
4604
|
+
" normalQ[nHead] = nil",
|
|
4605
|
+
" nHead = nHead + 1",
|
|
4606
|
+
" return n",
|
|
4607
|
+
" end",
|
|
4608
|
+
" if lHead <= #lowQ then",
|
|
4609
|
+
" local n = lowQ[lHead]",
|
|
4610
|
+
" lowQ[lHead] = nil",
|
|
4611
|
+
" lHead = lHead + 1",
|
|
4612
|
+
" return n",
|
|
4613
|
+
" end",
|
|
4614
|
+
" return nil",
|
|
4615
|
+
"end",
|
|
4616
|
+
"while visited < maxVisited do",
|
|
4617
|
+
" if kindMode == 'network' and #netItems >= maxItems then break end",
|
|
4618
|
+
" if kindMode == 'bindable' and #otherItems >= maxItems then break end",
|
|
4619
|
+
" if kindMode == 'all' and #netItems >= maxItems then break end",
|
|
4620
|
+
" local node = nextNode()",
|
|
4621
|
+
" if not node then break end",
|
|
4622
|
+
" if node.depth <= maxDepth then",
|
|
4623
|
+
" for _, child in ipairs(node.inst:GetChildren()) do",
|
|
4624
|
+
" visited = visited + 1",
|
|
4625
|
+
" if visited > maxVisited then break end",
|
|
4626
|
+
" local nextSegs = {}",
|
|
4627
|
+
" for i = 1, #node.segs do nextSegs[i] = node.segs[i] end",
|
|
4628
|
+
" nextSegs[#nextSegs + 1] = child.Name",
|
|
4629
|
+
" local fullPath = node.rootName .. '.' .. table.concat(nextSegs, '.')",
|
|
4630
|
+
" if remoteClasses[child.ClassName] then",
|
|
4631
|
+
" if filter == '' or string.find(string.lower(fullPath), filter, 1, true) then",
|
|
4632
|
+
" local rec = { root = node.rootName, className = child.ClassName, segments = nextSegs, path = fullPath }",
|
|
4633
|
+
" if netPriorityClasses[child.ClassName] then",
|
|
4634
|
+
" netItems[#netItems + 1] = rec",
|
|
4635
|
+
" else",
|
|
4636
|
+
" otherItems[#otherItems + 1] = rec",
|
|
4637
|
+
" end",
|
|
4638
|
+
" end",
|
|
4639
|
+
" end",
|
|
4640
|
+
" if kindMode == 'network' and #netItems >= maxItems then break end",
|
|
4641
|
+
" if kindMode == 'bindable' and #otherItems >= maxItems then break end",
|
|
4642
|
+
" if kindMode == 'all' and #netItems >= maxItems then break end",
|
|
4643
|
+
" if node.depth < maxDepth and #child:GetChildren() > 0 then",
|
|
4644
|
+
" local isLow = child:IsA('Model') or (lowPriorityFolders[string.lower(child.Name)] == true)",
|
|
4645
|
+
" local q = isLow and lowQ or normalQ",
|
|
4646
|
+
" q[#q + 1] = { inst = child, rootName = node.rootName, segs = nextSegs, depth = node.depth + 1 }",
|
|
4221
4647
|
" end",
|
|
4222
|
-
" end",
|
|
4223
|
-
" if #child:GetChildren() > 0 and #items < maxItems then",
|
|
4224
|
-
" scan(child, rootName, nextSegs, depth + 1)",
|
|
4225
4648
|
" end",
|
|
4226
4649
|
" end",
|
|
4227
4650
|
"end",
|
|
4228
|
-
"
|
|
4229
|
-
"
|
|
4230
|
-
" if
|
|
4651
|
+
"local items = {}",
|
|
4652
|
+
"for _, rec in ipairs(netItems) do",
|
|
4653
|
+
" if #items >= maxItems then break end",
|
|
4654
|
+
" items[#items + 1] = rec",
|
|
4655
|
+
"end",
|
|
4656
|
+
"for _, rec in ipairs(otherItems) do",
|
|
4657
|
+
" if #items >= maxItems then break end",
|
|
4658
|
+
" items[#items + 1] = rec",
|
|
4231
4659
|
"end",
|
|
4232
4660
|
"return HttpService:JSONEncode(items)"
|
|
4233
4661
|
].join("\n");
|
|
4234
|
-
const liveRes = await this.
|
|
4662
|
+
const liveRes = await this.execWithFullOutput({
|
|
4235
4663
|
code: liveScanCode,
|
|
4236
4664
|
readonly: true,
|
|
4237
4665
|
...session ? { session } : {}
|
|
@@ -4242,7 +4670,18 @@ ${diffSummary}`);
|
|
|
4242
4670
|
isError: true
|
|
4243
4671
|
};
|
|
4244
4672
|
}
|
|
4245
|
-
const items = this.extractJsonPayloadFromExec(
|
|
4673
|
+
const items = this.extractJsonPayloadFromExec(
|
|
4674
|
+
liveRes.fullBody
|
|
4675
|
+
);
|
|
4676
|
+
if (!Array.isArray(items)) {
|
|
4677
|
+
return this.formatJsonParseError(
|
|
4678
|
+
"studio_mirror_remotes",
|
|
4679
|
+
"live game remotes scan",
|
|
4680
|
+
liveRes.fullBody,
|
|
4681
|
+
liveRes.pages,
|
|
4682
|
+
liveRes.truncated
|
|
4683
|
+
);
|
|
4684
|
+
}
|
|
4246
4685
|
const studioCode = [
|
|
4247
4686
|
`local items = ${toLuauLiteral(items)}`,
|
|
4248
4687
|
`local clearExisting = ${toLuauLiteral(clearExisting)}`,
|
|
@@ -4296,6 +4735,15 @@ ${diffSummary}`);
|
|
|
4296
4735
|
};
|
|
4297
4736
|
}
|
|
4298
4737
|
const samplePaths = items.slice(0, 15).map((i) => ` - [${i.className}] ${i.path}`);
|
|
4738
|
+
const warnings = [];
|
|
4739
|
+
if (items.length >= max || liveRes.truncated) {
|
|
4740
|
+
warnings.push(
|
|
4741
|
+
`- Note: output reached limit (max=${max}${liveRes.truncated ? ", truncated" : ""}); pass filter/root or raise max to mirror more.`
|
|
4742
|
+
);
|
|
4743
|
+
}
|
|
4744
|
+
if (liveRes.pages > 1) {
|
|
4745
|
+
warnings.push(`- Pagination: reassembled ${liveRes.pages} pages from Cloud exec/get_result`);
|
|
4746
|
+
}
|
|
4299
4747
|
return {
|
|
4300
4748
|
content: [
|
|
4301
4749
|
{
|
|
@@ -4304,6 +4752,7 @@ ${diffSummary}`);
|
|
|
4304
4752
|
`studio_mirror_remotes complete (studio_id=${studioRes.studioId ?? "auto"}, datamodel_type=${datamodelType}):`,
|
|
4305
4753
|
`- Live remotes discovered: ${items.length} across ${roots.join(", ")} (kind=${kind}${filter ? `, filter="${filter}"` : ""}, max=${max})`,
|
|
4306
4754
|
`- Studio result: ${studioRes.text}`,
|
|
4755
|
+
...warnings,
|
|
4307
4756
|
...samplePaths.length > 0 ? ["- Sample mirrored paths:", ...samplePaths] : []
|
|
4308
4757
|
].join("\n")
|
|
4309
4758
|
}
|
|
@@ -4333,11 +4782,13 @@ ${diffSummary}`);
|
|
|
4333
4782
|
`local includeCore = ${toLuauLiteral(includeCoreGui)}`,
|
|
4334
4783
|
"local nodes = {}",
|
|
4335
4784
|
"local count = 0",
|
|
4785
|
+
"local capped = false",
|
|
4336
4786
|
"local function serColor(c) return c and { c.R, c.G, c.B } or nil end",
|
|
4337
4787
|
"local function serUDim2(u) return u and { u.X.Scale, u.X.Offset, u.Y.Scale, u.Y.Offset } or nil end",
|
|
4338
4788
|
"local function serVec2(v) return v and { v.X, v.Y } or nil end",
|
|
4339
4789
|
"local function serializeTree(inst, depth)",
|
|
4340
|
-
" if count >= maxNodes
|
|
4790
|
+
" if count >= maxNodes then capped = true; return nil end",
|
|
4791
|
+
" if depth > maxDepth then return nil end",
|
|
4341
4792
|
" if onlyVisible then",
|
|
4342
4793
|
" if inst:IsA('LayerCollector') and inst.Enabled == false then return nil end",
|
|
4343
4794
|
" if inst:IsA('GuiObject') and inst.Visible == false then return nil end",
|
|
@@ -4366,7 +4817,7 @@ ${diffSummary}`);
|
|
|
4366
4817
|
" end",
|
|
4367
4818
|
" end)",
|
|
4368
4819
|
" for _, child in ipairs(inst:GetChildren()) do",
|
|
4369
|
-
" if count >= maxNodes then break end",
|
|
4820
|
+
" if count >= maxNodes then capped = true; break end",
|
|
4370
4821
|
" local cNode = serializeTree(child, depth + 1)",
|
|
4371
4822
|
" if cNode then node.children[#node.children + 1] = cNode end",
|
|
4372
4823
|
" end",
|
|
@@ -4383,7 +4834,7 @@ ${diffSummary}`);
|
|
|
4383
4834
|
" local pgui = lp and lp:FindFirstChildOfClass('PlayerGui')",
|
|
4384
4835
|
" if pgui then",
|
|
4385
4836
|
" for _, child in ipairs(pgui:GetChildren()) do",
|
|
4386
|
-
" if count >= maxNodes then break end",
|
|
4837
|
+
" if count >= maxNodes then capped = true; break end",
|
|
4387
4838
|
" local n = serializeTree(child, 1)",
|
|
4388
4839
|
" if n then nodes[#nodes + 1] = n end",
|
|
4389
4840
|
" end",
|
|
@@ -4392,7 +4843,7 @@ ${diffSummary}`);
|
|
|
4392
4843
|
" local ok, cgui = pcall(function() return game:GetService('CoreGui') end)",
|
|
4393
4844
|
" if ok and cgui then",
|
|
4394
4845
|
" for _, child in ipairs(cgui:GetChildren()) do",
|
|
4395
|
-
" if count >= maxNodes then break end",
|
|
4846
|
+
" if count >= maxNodes then capped = true; break end",
|
|
4396
4847
|
" if child.Name ~= 'RobloxGui' then",
|
|
4397
4848
|
" local n = serializeTree(child, 1)",
|
|
4398
4849
|
" if n then nodes[#nodes + 1] = n end",
|
|
@@ -4401,9 +4852,9 @@ ${diffSummary}`);
|
|
|
4401
4852
|
" end",
|
|
4402
4853
|
" end",
|
|
4403
4854
|
"end",
|
|
4404
|
-
"return HttpService:JSONEncode({ count = count, trees = nodes })"
|
|
4855
|
+
"return HttpService:JSONEncode({ count = count, capped = capped, trees = nodes })"
|
|
4405
4856
|
].join("\n");
|
|
4406
|
-
const liveRes = await this.
|
|
4857
|
+
const liveRes = await this.execWithFullOutput({
|
|
4407
4858
|
code: liveGuiCode,
|
|
4408
4859
|
readonly: true,
|
|
4409
4860
|
...session ? { session } : {}
|
|
@@ -4414,10 +4865,16 @@ ${diffSummary}`);
|
|
|
4414
4865
|
isError: true
|
|
4415
4866
|
};
|
|
4416
4867
|
}
|
|
4417
|
-
const payload = this.extractJsonPayloadFromExec(liveRes.
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4868
|
+
const payload = this.extractJsonPayloadFromExec(liveRes.fullBody);
|
|
4869
|
+
if (!payload || typeof payload !== "object" || !Array.isArray(payload.trees)) {
|
|
4870
|
+
return this.formatJsonParseError(
|
|
4871
|
+
"studio_mirror_gui",
|
|
4872
|
+
"live GUI serialization",
|
|
4873
|
+
liveRes.fullBody,
|
|
4874
|
+
liveRes.pages,
|
|
4875
|
+
liveRes.truncated
|
|
4876
|
+
);
|
|
4877
|
+
}
|
|
4421
4878
|
const studioBuildCode = [
|
|
4422
4879
|
"local StarterGui = game:GetService('StarterGui')",
|
|
4423
4880
|
`local containerName = ${toLuauLiteral(containerName)}`,
|
|
@@ -4476,6 +4933,15 @@ ${diffSummary}`);
|
|
|
4476
4933
|
isError: true
|
|
4477
4934
|
};
|
|
4478
4935
|
}
|
|
4936
|
+
const notes = [];
|
|
4937
|
+
if (payload.capped || payload.count >= maxNodes || liveRes.truncated) {
|
|
4938
|
+
notes.push(
|
|
4939
|
+
`- Note: capture reached limit (max_nodes=${maxNodes}${liveRes.truncated ? ", truncated" : ""}); pass target/only_visible=true or raise max_nodes for deeper trees.`
|
|
4940
|
+
);
|
|
4941
|
+
}
|
|
4942
|
+
if (liveRes.pages > 1) {
|
|
4943
|
+
notes.push(`- Pagination: reassembled ${liveRes.pages} pages from Cloud exec/get_result`);
|
|
4944
|
+
}
|
|
4479
4945
|
return {
|
|
4480
4946
|
content: [
|
|
4481
4947
|
{
|
|
@@ -4484,7 +4950,8 @@ ${diffSummary}`);
|
|
|
4484
4950
|
`studio_mirror_gui complete (studio_id=${studioRes.studioId ?? "auto"}, datamodel_type=${datamodelType}):`,
|
|
4485
4951
|
`- Live GUI nodes serialized: ${payload.count} (${payload.trees.length} root trees)`,
|
|
4486
4952
|
`- Studio container: StarterGui.${containerName}`,
|
|
4487
|
-
`- Studio result: ${studioRes.text}
|
|
4953
|
+
`- Studio result: ${studioRes.text}`,
|
|
4954
|
+
...notes
|
|
4488
4955
|
].join("\n")
|
|
4489
4956
|
}
|
|
4490
4957
|
]
|
|
@@ -4517,6 +4984,7 @@ ${diffSummary}`);
|
|
|
4517
4984
|
"local function scan(inst, prefix, depth)",
|
|
4518
4985
|
" if depth > maxDepth or count >= 1500 then return end",
|
|
4519
4986
|
" for _, child in ipairs(inst:GetChildren()) do",
|
|
4987
|
+
" if count >= 1500 then break end",
|
|
4520
4988
|
" local p = prefix .. '.' .. child.Name",
|
|
4521
4989
|
" if matchesScope(child) then",
|
|
4522
4990
|
" count = count + 1",
|
|
@@ -4538,7 +5006,7 @@ ${diffSummary}`);
|
|
|
4538
5006
|
"return HttpService:JSONEncode(entries)"
|
|
4539
5007
|
].join("\n");
|
|
4540
5008
|
const [liveRes, studioRes] = await Promise.all([
|
|
4541
|
-
this.
|
|
5009
|
+
this.execWithFullOutput({
|
|
4542
5010
|
code: buildDiffScanCode(true),
|
|
4543
5011
|
readonly: true,
|
|
4544
5012
|
...session ? { session } : {}
|
|
@@ -4557,8 +5025,20 @@ ${diffSummary}`);
|
|
|
4557
5025
|
isError: true
|
|
4558
5026
|
};
|
|
4559
5027
|
}
|
|
4560
|
-
const liveEntries = this.extractJsonPayloadFromExec(liveRes.
|
|
4561
|
-
|
|
5028
|
+
const liveEntries = this.extractJsonPayloadFromExec(liveRes.fullBody);
|
|
5029
|
+
if (!Array.isArray(liveEntries)) {
|
|
5030
|
+
return this.formatJsonParseError(
|
|
5031
|
+
"studio_diff",
|
|
5032
|
+
"live game scan",
|
|
5033
|
+
liveRes.fullBody,
|
|
5034
|
+
liveRes.pages,
|
|
5035
|
+
liveRes.truncated
|
|
5036
|
+
);
|
|
5037
|
+
}
|
|
5038
|
+
const studioEntries = this.extractJsonPayloadFromExec(studioRes.text);
|
|
5039
|
+
if (!Array.isArray(studioEntries)) {
|
|
5040
|
+
return this.formatJsonParseError("studio_diff", "Roblox Studio scan", studioRes.text, 1, false);
|
|
5041
|
+
}
|
|
4562
5042
|
const liveMap = /* @__PURE__ */ new Map();
|
|
4563
5043
|
for (const e of liveEntries) liveMap.set(e.path, e.className);
|
|
4564
5044
|
const studioMap = /* @__PURE__ */ new Map();
|
|
@@ -4584,6 +5064,7 @@ ${diffSummary}`);
|
|
|
4584
5064
|
}
|
|
4585
5065
|
const lines = [
|
|
4586
5066
|
`studio_diff report (scope=${scope}, roots=${roots.join(", ")}, studio_id=${studioRes.studioId ?? "auto"}, datamodel_type=${datamodelType}):`,
|
|
5067
|
+
`- Scanned counts: live=${liveEntries.length}, studio=${studioEntries.length}${liveRes.pages > 1 ? ` (live pages=${liveRes.pages})` : ""}`,
|
|
4587
5068
|
`- Matched instances: ${matchedCount}`,
|
|
4588
5069
|
`- Only in Live Game: ${onlyInLive.length}`,
|
|
4589
5070
|
...onlyInLive.slice(0, 20).map((x) => ` + [Live] ${x}`),
|
|
@@ -4594,6 +5075,11 @@ ${diffSummary}`);
|
|
|
4594
5075
|
`- Class mismatches: ${classMismatches.length}`,
|
|
4595
5076
|
...classMismatches.slice(0, 10).map((x) => ` ! ${x}`)
|
|
4596
5077
|
];
|
|
5078
|
+
if (liveEntries.length >= 1500 || studioEntries.length >= 1500 || liveRes.truncated) {
|
|
5079
|
+
lines.push(
|
|
5080
|
+
"- Note: scan hit 1500-entry limit or truncation; pass target/roots or narrow scope/max_depth for complete coverage."
|
|
5081
|
+
);
|
|
5082
|
+
}
|
|
4597
5083
|
return {
|
|
4598
5084
|
content: [{ type: "text", text: lines.join("\n") }]
|
|
4599
5085
|
};
|
|
@@ -4668,14 +5154,16 @@ ${diffSummary}`);
|
|
|
4668
5154
|
sourceLabel = `${parsed.path} [${parsed.className}] (${codeToRun.length} bytes, studio_id=${resolvedStudioId ?? "auto"}, datamodel_type=${datamodelType})`;
|
|
4669
5155
|
}
|
|
4670
5156
|
const cloudTool = collect ? "run_and_collect" : "exec";
|
|
5157
|
+
const resolvedSettleMs = typeof args.settle_ms === "number" && Number.isFinite(args.settle_ms) ? Math.max(0, Math.min(15e3, Math.round(args.settle_ms))) : typeof args.wait_seconds === "number" && Number.isFinite(args.wait_seconds) ? Math.max(0, Math.min(15e3, Math.round(args.wait_seconds * 1e3))) : void 0;
|
|
5158
|
+
const resolvedTimeoutMs = typeof args.timeout_ms === "number" && Number.isFinite(args.timeout_ms) ? Math.max(1e3, Math.min(85e3, Math.round(args.timeout_ms))) : void 0;
|
|
4671
5159
|
const cloudArgs = {
|
|
4672
5160
|
code: codeToRun,
|
|
4673
5161
|
...collect ? {
|
|
4674
|
-
wait_seconds: typeof args.wait_seconds === "number" ? args.wait_seconds : 1.5,
|
|
4675
5162
|
clean_env: typeof args.clean_env === "boolean" ? args.clean_env : true,
|
|
5163
|
+
...resolvedTimeoutMs !== void 0 ? { timeout_ms: resolvedTimeoutMs } : {},
|
|
5164
|
+
...resolvedSettleMs !== void 0 ? { settle_ms: resolvedSettleMs } : {},
|
|
4676
5165
|
...typeof args.track_resources === "boolean" ? { track_resources: args.track_resources } : {},
|
|
4677
|
-
...typeof args.auto_cleanup === "boolean" ? { auto_cleanup: args.auto_cleanup } : {}
|
|
4678
|
-
...typeof args.settle_ms === "number" ? { settle_ms: args.settle_ms } : {}
|
|
5166
|
+
...typeof args.auto_cleanup === "boolean" ? { auto_cleanup: args.auto_cleanup } : {}
|
|
4679
5167
|
} : {},
|
|
4680
5168
|
...session ? { session } : {}
|
|
4681
5169
|
};
|
|
@@ -4725,15 +5213,16 @@ ${liveRes.text}`
|
|
|
4725
5213
|
}
|
|
4726
5214
|
const scriptTarget = typeof args.script_id === "string" && args.script_id.trim() ? args.script_id.trim() : typeof args.script === "string" && args.script.trim() ? args.script.trim() : "";
|
|
4727
5215
|
if (scriptTarget) {
|
|
4728
|
-
const
|
|
4729
|
-
|
|
4730
|
-
...typeof args.script === "string" && args.script.trim() ? { script: args.script.trim() } : {},
|
|
4731
|
-
...!args.script_id && !args.script ? { script: scriptTarget } : {},
|
|
5216
|
+
const deployArgs = {
|
|
5217
|
+
script: scriptTarget,
|
|
4732
5218
|
source: parsed.source,
|
|
4733
|
-
...typeof args.
|
|
5219
|
+
...typeof args.preset === "string" ? { preset: args.preset } : {},
|
|
4734
5220
|
...typeof args.publish === "boolean" ? { publish: args.publish } : {},
|
|
4735
|
-
...typeof args.
|
|
4736
|
-
|
|
5221
|
+
...typeof args.draft === "boolean" ? { draft: args.draft } : {},
|
|
5222
|
+
...typeof args.store_source === "boolean" ? { store_source: args.store_source } : {},
|
|
5223
|
+
...typeof args.wait === "number" && Number.isFinite(args.wait) ? { wait: Math.max(0, Math.min(60, Math.floor(args.wait))) } : {}
|
|
5224
|
+
};
|
|
5225
|
+
const deployRes = await this.callCloudTool("deploy_script", deployArgs);
|
|
4737
5226
|
return {
|
|
4738
5227
|
content: [
|
|
4739
5228
|
{
|
|
@@ -4746,11 +5235,15 @@ ${deployRes.text}`
|
|
|
4746
5235
|
};
|
|
4747
5236
|
}
|
|
4748
5237
|
const scriptName = typeof args.name === "string" && args.name.trim() ? args.name.trim() : parsed.name || "StudioScript";
|
|
4749
|
-
const
|
|
5238
|
+
const createArgs = {
|
|
4750
5239
|
name: scriptName,
|
|
4751
5240
|
source: parsed.source,
|
|
4752
|
-
...typeof args.
|
|
4753
|
-
|
|
5241
|
+
...typeof args.project_id === "string" && args.project_id.trim() ? { project_id: args.project_id.trim() } : {},
|
|
5242
|
+
...typeof args.preset === "string" ? { preset: args.preset } : {},
|
|
5243
|
+
...typeof args.store_source === "boolean" ? { store_source: args.store_source } : {},
|
|
5244
|
+
...typeof args.wait === "number" && Number.isFinite(args.wait) ? { wait: Math.max(0, Math.min(60, Math.floor(args.wait))) } : {}
|
|
5245
|
+
};
|
|
5246
|
+
const createRes = await this.callCloudTool("create_script", createArgs);
|
|
4754
5247
|
return {
|
|
4755
5248
|
content: [
|
|
4756
5249
|
{
|
|
@@ -4765,8 +5258,8 @@ ${createRes.text}`
|
|
|
4765
5258
|
async handleLiveScriptsToStudio(args) {
|
|
4766
5259
|
const targets = Array.isArray(args.targets) && args.targets.length > 0 ? args.targets.map(String) : [];
|
|
4767
5260
|
const filter = typeof args.filter === "string" ? args.filter.trim() : "";
|
|
4768
|
-
const rawContainer = typeof args.
|
|
4769
|
-
const
|
|
5261
|
+
const rawContainer = typeof args.studio_root === "string" && args.studio_root.trim() ? args.studio_root.trim() : typeof args.container_name === "string" && args.container_name.trim() ? args.container_name.trim() : "LuawardLiveScripts";
|
|
5262
|
+
const container = resolveStudioContainerPath(rawContainer, "ServerStorage", "LuawardLiveScripts");
|
|
4770
5263
|
const rawLimit = typeof args.max === "number" ? args.max : typeof args.limit === "number" ? args.limit : 15;
|
|
4771
5264
|
const limit = Math.max(1, Math.min(100, Math.floor(rawLimit)));
|
|
4772
5265
|
const disabled = args.disabled !== false;
|
|
@@ -4783,6 +5276,8 @@ ${createRes.text}`
|
|
|
4783
5276
|
"local roots = { game:GetService('ReplicatedStorage'), game:GetService('StarterPlayer'), game:GetService('Workspace'), game:GetService('Players').LocalPlayer }",
|
|
4784
5277
|
"local results = {}",
|
|
4785
5278
|
"local seen = {}",
|
|
5279
|
+
"local totalBytes = 0",
|
|
5280
|
+
"local maxTotalBytes = 600000",
|
|
4786
5281
|
"local decompFn = (type(decompile) == 'function' and decompile) or (type(getscriptbytecode) == 'function' and function(s) local ok, b = pcall(getscriptbytecode, s); return ok and b and ('-- bytecode (' .. tostring(#b) .. ' bytes)') or nil end) or nil",
|
|
4787
5282
|
"local function collectOne(inst)",
|
|
4788
5283
|
" if not inst or seen[inst] or #results >= limit then return end",
|
|
@@ -4797,6 +5292,8 @@ ${createRes.text}`
|
|
|
4797
5292
|
" src = src .. '\\n\\n' .. dec:sub(1, 32000)",
|
|
4798
5293
|
" end",
|
|
4799
5294
|
" end",
|
|
5295
|
+
" if #results > 0 and (totalBytes + #src) > maxTotalBytes then return end",
|
|
5296
|
+
" totalBytes = totalBytes + #src",
|
|
4800
5297
|
" results[#results + 1] = { name = inst.Name, className = inst.ClassName, path = fullPath, source = src }",
|
|
4801
5298
|
"end",
|
|
4802
5299
|
"if #targets > 0 and lw and lw.resolve then",
|
|
@@ -4810,7 +5307,7 @@ ${createRes.text}`
|
|
|
4810
5307
|
" local ok, list = pcall(function() return root:GetDescendants() end)",
|
|
4811
5308
|
" if ok and type(list) == 'table' then",
|
|
4812
5309
|
" for _, inst in ipairs(list) do",
|
|
4813
|
-
" if #results >= limit then break end",
|
|
5310
|
+
" if #results >= limit or totalBytes >= maxTotalBytes then break end",
|
|
4814
5311
|
" collectOne(inst)",
|
|
4815
5312
|
" end",
|
|
4816
5313
|
" end",
|
|
@@ -4819,7 +5316,7 @@ ${createRes.text}`
|
|
|
4819
5316
|
"end",
|
|
4820
5317
|
"return HttpService:JSONEncode(results)"
|
|
4821
5318
|
].join("\n");
|
|
4822
|
-
const liveRes = await this.
|
|
5319
|
+
const liveRes = await this.execWithFullOutput({
|
|
4823
5320
|
code: liveCollectCode,
|
|
4824
5321
|
readonly: true,
|
|
4825
5322
|
...session ? { session } : {}
|
|
@@ -4835,18 +5332,35 @@ ${createRes.text}`
|
|
|
4835
5332
|
isError: true
|
|
4836
5333
|
};
|
|
4837
5334
|
}
|
|
4838
|
-
const scripts = this.extractJsonPayloadFromExec(
|
|
5335
|
+
const scripts = this.extractJsonPayloadFromExec(
|
|
5336
|
+
liveRes.fullBody
|
|
5337
|
+
);
|
|
5338
|
+
if (!Array.isArray(scripts)) {
|
|
5339
|
+
return this.formatJsonParseError(
|
|
5340
|
+
"live_scripts_to_studio",
|
|
5341
|
+
"live scripts collection",
|
|
5342
|
+
liveRes.fullBody,
|
|
5343
|
+
liveRes.pages,
|
|
5344
|
+
liveRes.truncated
|
|
5345
|
+
);
|
|
5346
|
+
}
|
|
4839
5347
|
const studioImportCode = [
|
|
4840
|
-
|
|
4841
|
-
`local
|
|
5348
|
+
`local targetService = ${toLuauLiteral(container.service)}`,
|
|
5349
|
+
`local targetSegments = ${toLuauLiteral(container.segments)}`,
|
|
5350
|
+
`local displayPath = ${toLuauLiteral(container.displayPath)}`,
|
|
4842
5351
|
`local setDisabled = ${toLuauLiteral(disabled)}`,
|
|
4843
5352
|
`local items = ${toLuauLiteral(scripts)}`,
|
|
4844
|
-
"local
|
|
4845
|
-
"
|
|
4846
|
-
"
|
|
4847
|
-
"
|
|
4848
|
-
"
|
|
5353
|
+
"local cur = game:GetService(targetService)",
|
|
5354
|
+
"for _, seg in ipairs(targetSegments) do",
|
|
5355
|
+
" local nextInst = cur:FindFirstChild(seg)",
|
|
5356
|
+
" if not nextInst then",
|
|
5357
|
+
" nextInst = Instance.new('Folder')",
|
|
5358
|
+
" nextInst.Name = seg",
|
|
5359
|
+
" nextInst.Parent = cur",
|
|
5360
|
+
" end",
|
|
5361
|
+
" cur = nextInst",
|
|
4849
5362
|
"end",
|
|
5363
|
+
"local folder = cur",
|
|
4850
5364
|
"local imported = 0",
|
|
4851
5365
|
"for _, item in ipairs(items) do",
|
|
4852
5366
|
" local ok, inst = pcall(Instance.new, item.className)",
|
|
@@ -4861,7 +5375,7 @@ ${createRes.text}`
|
|
|
4861
5375
|
" imported = imported + 1",
|
|
4862
5376
|
" end",
|
|
4863
5377
|
"end",
|
|
4864
|
-
"return string.format('imported %d live scripts into
|
|
5378
|
+
"return string.format('imported %d live scripts into %s', imported, displayPath)"
|
|
4865
5379
|
].join("\n");
|
|
4866
5380
|
const studioRes = await this.studio.runStudioLuau(studioImportCode, requestedStudioId, datamodelType);
|
|
4867
5381
|
if (!studioRes.ok) {
|
|
@@ -4875,6 +5389,15 @@ ${createRes.text}`
|
|
|
4875
5389
|
isError: true
|
|
4876
5390
|
};
|
|
4877
5391
|
}
|
|
5392
|
+
const notes = [];
|
|
5393
|
+
if (liveRes.pages > 1) {
|
|
5394
|
+
notes.push(`- Pagination: reassembled ${liveRes.pages} pages from Cloud exec/get_result`);
|
|
5395
|
+
}
|
|
5396
|
+
if (scripts.length >= limit || liveRes.truncated) {
|
|
5397
|
+
notes.push(
|
|
5398
|
+
`- Note: collection reached limit (max=${limit}${liveRes.truncated ? ", truncated" : ""}); pass filter/targets or raise max to import more.`
|
|
5399
|
+
);
|
|
5400
|
+
}
|
|
4878
5401
|
const listLines = scripts.slice(0, 15).map((s) => ` - [${s.className}] ${s.path} (${s.source.length} bytes)`);
|
|
4879
5402
|
return {
|
|
4880
5403
|
content: [
|
|
@@ -4883,8 +5406,9 @@ ${createRes.text}`
|
|
|
4883
5406
|
text: [
|
|
4884
5407
|
`live_scripts_to_studio complete (studio_id=${studioRes.studioId ?? "auto"}, datamodel_type=${datamodelType}):`,
|
|
4885
5408
|
`- Scripts collected from live game: ${scripts.length}`,
|
|
4886
|
-
`- Studio container:
|
|
5409
|
+
`- Studio container: ${container.displayPath}`,
|
|
4887
5410
|
`- Studio result: ${studioRes.text}`,
|
|
5411
|
+
...notes,
|
|
4888
5412
|
...listLines
|
|
4889
5413
|
].join("\n")
|
|
4890
5414
|
}
|
|
@@ -4896,7 +5420,9 @@ ${createRes.text}`
|
|
|
4896
5420
|
const targetB = typeof args.target_b === "string" && args.target_b.trim() ? args.target_b.trim() : "studio";
|
|
4897
5421
|
const rawMethod = typeof args.method === "string" ? args.method : "auto";
|
|
4898
5422
|
const method = rawMethod === "copy" || rawMethod === "screen" ? "copy" : rawMethod === "printwindow" || rawMethod === "print_window" ? "printwindow" : "auto";
|
|
4899
|
-
const
|
|
5423
|
+
const clientOnly = args.client_only !== false;
|
|
5424
|
+
const focusFirst = args.focus_first === true;
|
|
5425
|
+
const includeImages = args.include_images !== false;
|
|
4900
5426
|
let base64A = typeof args.base64_a === "string" && args.base64_a.trim() ? args.base64_a.trim() : "";
|
|
4901
5427
|
let base64B = typeof args.base64_b === "string" && args.base64_b.trim() ? args.base64_b.trim() : "";
|
|
4902
5428
|
let labelA = base64A ? "base64_a" : targetA;
|
|
@@ -4904,7 +5430,12 @@ ${createRes.text}`
|
|
|
4904
5430
|
let metaA;
|
|
4905
5431
|
let metaB;
|
|
4906
5432
|
if (!base64A) {
|
|
4907
|
-
const shotA = await this.windows.captureScreenshot({
|
|
5433
|
+
const shotA = await this.windows.captureScreenshot({
|
|
5434
|
+
target: targetA,
|
|
5435
|
+
method,
|
|
5436
|
+
clientOnly,
|
|
5437
|
+
focusFirst
|
|
5438
|
+
});
|
|
4908
5439
|
if (!shotA.ok || !shotA.data) {
|
|
4909
5440
|
return {
|
|
4910
5441
|
content: [
|
|
@@ -4921,7 +5452,12 @@ ${createRes.text}`
|
|
|
4921
5452
|
labelA = `${targetA} (${shotA.width}x${shotA.height}, method=${shotA.captureMethod ?? method})`;
|
|
4922
5453
|
}
|
|
4923
5454
|
if (!base64B) {
|
|
4924
|
-
const shotB = await this.windows.captureScreenshot({
|
|
5455
|
+
const shotB = await this.windows.captureScreenshot({
|
|
5456
|
+
target: targetB,
|
|
5457
|
+
method,
|
|
5458
|
+
clientOnly,
|
|
5459
|
+
focusFirst
|
|
5460
|
+
});
|
|
4925
5461
|
if (!shotB.ok || !shotB.data) {
|
|
4926
5462
|
return {
|
|
4927
5463
|
content: [
|
|
@@ -5266,6 +5802,8 @@ export {
|
|
|
5266
5802
|
SCRATCH_TAB_NAME,
|
|
5267
5803
|
TOKEN_CREATE_URL,
|
|
5268
5804
|
TOKEN_SHAPE,
|
|
5805
|
+
WIN32_CSHARP_PRELUDE,
|
|
5806
|
+
buildFocusWindowPsScript,
|
|
5269
5807
|
buildListWindowsPsScript,
|
|
5270
5808
|
buildRobloxDeepLink,
|
|
5271
5809
|
buildScreenshotPsScript,
|
|
@@ -5278,6 +5816,7 @@ export {
|
|
|
5278
5816
|
discoverPotassiumToken,
|
|
5279
5817
|
discoverRobloxStudioMcpBatch,
|
|
5280
5818
|
encodePowerShellCommand,
|
|
5819
|
+
extractJsonPayloadFromExec,
|
|
5281
5820
|
findPotassiumBinary,
|
|
5282
5821
|
findRobloxPlayerBinary,
|
|
5283
5822
|
forwardJsonRpcLine,
|
|
@@ -5286,8 +5825,10 @@ export {
|
|
|
5286
5825
|
matchesWindowTarget,
|
|
5287
5826
|
resolveBridgeConfig,
|
|
5288
5827
|
resolveStoredToken,
|
|
5828
|
+
resolveStudioContainerPath,
|
|
5289
5829
|
resolveVirtualKeyCode,
|
|
5290
5830
|
startStdioBridge,
|
|
5831
|
+
stripExecPageEnvelope,
|
|
5291
5832
|
toLuauLiteral
|
|
5292
5833
|
};
|
|
5293
5834
|
//# sourceMappingURL=index.js.map
|