@chrrxs/robloxstudio-mcp-inspector 3.4.2 → 3.4.3
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.js +241 -85
- package/package.json +1 -1
- package/studio-plugin/MCPInspectorPlugin.rbxmx +255 -70
package/dist/index.js
CHANGED
|
@@ -9725,6 +9725,9 @@ var MAX_PRICE_ROBUX2 = 1e9;
|
|
|
9725
9725
|
var MAX_NAME_SCAN_PAGES = 200;
|
|
9726
9726
|
var MAX_ICON_BYTES = 10 * 1024 * 1024;
|
|
9727
9727
|
var PNG_SIGNATURE2 = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
|
|
9728
|
+
var UNKNOWN_CREATE_WINDOW_MS = 10 * 60 * 1e3;
|
|
9729
|
+
var UNKNOWN_CREATE_HINT = "An item may have been created; run list (or get) before retrying create.";
|
|
9730
|
+
var PENDING_UNKNOWN_CREATE_HINT = "No item with this name is listed yet. If list still shows none, create can be retried after retry_after.";
|
|
9728
9731
|
var SCOPE_PREFIX = {
|
|
9729
9732
|
developer_product: "developer-product",
|
|
9730
9733
|
game_pass: "game-pass"
|
|
@@ -9865,19 +9868,111 @@ function itemLabel(kind) {
|
|
|
9865
9868
|
function comparableName(name) {
|
|
9866
9869
|
return name.trim().toLowerCase();
|
|
9867
9870
|
}
|
|
9868
|
-
|
|
9871
|
+
function nameKey(universeId, kind, name) {
|
|
9872
|
+
return `${universeId}:${kind}:${comparableName(name)}`;
|
|
9873
|
+
}
|
|
9874
|
+
var nameLocks = /* @__PURE__ */ new Map();
|
|
9875
|
+
async function withNameLock(key, run2) {
|
|
9876
|
+
const previous = nameLocks.get(key) ?? Promise.resolve();
|
|
9877
|
+
const { promise: released, resolve: release } = Promise.withResolvers();
|
|
9878
|
+
const tail = previous.then(() => released);
|
|
9879
|
+
nameLocks.set(key, tail);
|
|
9880
|
+
await previous;
|
|
9881
|
+
try {
|
|
9882
|
+
return await run2();
|
|
9883
|
+
} finally {
|
|
9884
|
+
release();
|
|
9885
|
+
if (nameLocks.get(key) === tail)
|
|
9886
|
+
nameLocks.delete(key);
|
|
9887
|
+
}
|
|
9888
|
+
}
|
|
9889
|
+
var unknownCreates = /* @__PURE__ */ new Map();
|
|
9890
|
+
function rememberUnknownCreate(key) {
|
|
9891
|
+
const now = Date.now();
|
|
9892
|
+
for (const [other, failedAt] of unknownCreates) {
|
|
9893
|
+
if (now - failedAt >= UNKNOWN_CREATE_WINDOW_MS)
|
|
9894
|
+
unknownCreates.delete(other);
|
|
9895
|
+
}
|
|
9896
|
+
unknownCreates.set(key, now);
|
|
9897
|
+
return now;
|
|
9898
|
+
}
|
|
9899
|
+
function unknownCreateRetryAfter(key) {
|
|
9900
|
+
const failedAt = unknownCreates.get(key);
|
|
9901
|
+
if (failedAt === void 0)
|
|
9902
|
+
return void 0;
|
|
9903
|
+
if (Date.now() - failedAt < UNKNOWN_CREATE_WINDOW_MS)
|
|
9904
|
+
return retryAfter(failedAt);
|
|
9905
|
+
unknownCreates.delete(key);
|
|
9906
|
+
return void 0;
|
|
9907
|
+
}
|
|
9908
|
+
function retryAfter(failedAt) {
|
|
9909
|
+
return new Date(failedAt + UNKNOWN_CREATE_WINDOW_MS).toISOString();
|
|
9910
|
+
}
|
|
9911
|
+
function pendingUnknownCreate(kind, universeId, name, retryAfterTime, action) {
|
|
9912
|
+
return new MonetizationError("create_outcome_unknown", `A recent create of the ${itemLabel(kind)} "${name}" in universe ${universeId} may have succeeded, but no item with that name is listed yet, so nothing was ${action}.`, { hint: PENDING_UNKNOWN_CREATE_HINT, retry_after: retryAfterTime });
|
|
9913
|
+
}
|
|
9914
|
+
function forgetUnknownCreates(items) {
|
|
9915
|
+
for (const item of items)
|
|
9916
|
+
unknownCreates.delete(nameKey(item.universeId, item.kind, item.name));
|
|
9917
|
+
}
|
|
9918
|
+
async function findItemNamed(client, kind, universeId, name, excludeId) {
|
|
9869
9919
|
const wanted = comparableName(name);
|
|
9870
9920
|
let pageToken;
|
|
9871
9921
|
for (let page = 0; page < MAX_NAME_SCAN_PAGES; page++) {
|
|
9872
9922
|
const result = await client.listMonetizationItems(kind, universeId, pageToken);
|
|
9873
|
-
|
|
9923
|
+
forgetUnknownCreates(result.items);
|
|
9924
|
+
const match = result.items.find((candidate) => candidate.id !== excludeId && comparableName(candidate.name) === wanted);
|
|
9874
9925
|
if (match)
|
|
9875
9926
|
return match;
|
|
9876
9927
|
if (!result.nextPageToken)
|
|
9877
9928
|
return void 0;
|
|
9878
9929
|
pageToken = result.nextPageToken;
|
|
9879
9930
|
}
|
|
9880
|
-
throw new MonetizationError("duplicate_check_incomplete", `Stopped looking for an existing ${itemLabel(kind)} named "${name}" after ${MAX_NAME_SCAN_PAGES} pages, so nothing was created.`);
|
|
9931
|
+
throw new MonetizationError("duplicate_check_incomplete", `Stopped looking for an existing ${itemLabel(kind)} named "${name}" after ${MAX_NAME_SCAN_PAGES} pages, so nothing was ${excludeId === void 0 ? "created" : "changed"}.`);
|
|
9932
|
+
}
|
|
9933
|
+
function duplicateName(kind, universeId, existing) {
|
|
9934
|
+
return new MonetizationError("duplicate_name", `A ${itemLabel(kind)} named "${existing.name}" already exists in universe ${universeId}. Update it or choose another name.`, { existing: publicItem(existing) });
|
|
9935
|
+
}
|
|
9936
|
+
async function createNamed(client, kind, universeId, item) {
|
|
9937
|
+
const { name } = item;
|
|
9938
|
+
const key = nameKey(universeId, kind, name);
|
|
9939
|
+
return withNameLock(key, async () => {
|
|
9940
|
+
const existing = await findItemNamed(client, kind, universeId, name);
|
|
9941
|
+
if (existing)
|
|
9942
|
+
throw duplicateName(kind, universeId, existing);
|
|
9943
|
+
const pendingRetryAfter = unknownCreateRetryAfter(key);
|
|
9944
|
+
if (pendingRetryAfter)
|
|
9945
|
+
throw pendingUnknownCreate(kind, universeId, name, pendingRetryAfter, "created");
|
|
9946
|
+
let created;
|
|
9947
|
+
try {
|
|
9948
|
+
created = await client.createMonetizationItem(kind, universeId, item);
|
|
9949
|
+
} catch (error) {
|
|
9950
|
+
if (error instanceof OpenCloudRequestError && error.status < 500)
|
|
9951
|
+
throw error;
|
|
9952
|
+
const failedAt = rememberUnknownCreate(key);
|
|
9953
|
+
const reason = error instanceof OpenCloudRequestError ? `HTTP ${error.status}: ${error.message}` : error instanceof Error ? error.message : String(error);
|
|
9954
|
+
throw new MonetizationError("create_outcome_unknown", `Could not confirm whether the ${itemLabel(kind)} "${name}" was created in universe ${universeId}: ${reason}`, { hint: UNKNOWN_CREATE_HINT, retry_after: retryAfter(failedAt) });
|
|
9955
|
+
}
|
|
9956
|
+
unknownCreates.delete(key);
|
|
9957
|
+
return created;
|
|
9958
|
+
});
|
|
9959
|
+
}
|
|
9960
|
+
async function updateItem(client, kind, universeId, id, changes) {
|
|
9961
|
+
const { name } = changes;
|
|
9962
|
+
if (name === void 0) {
|
|
9963
|
+
await client.updateMonetizationItem(kind, universeId, id, changes);
|
|
9964
|
+
return;
|
|
9965
|
+
}
|
|
9966
|
+
const key = nameKey(universeId, kind, name);
|
|
9967
|
+
await withNameLock(key, async () => {
|
|
9968
|
+
const existing = await findItemNamed(client, kind, universeId, name, id);
|
|
9969
|
+
if (existing)
|
|
9970
|
+
throw duplicateName(kind, universeId, existing);
|
|
9971
|
+
const pendingRetryAfter = unknownCreateRetryAfter(key);
|
|
9972
|
+
if (pendingRetryAfter)
|
|
9973
|
+
throw pendingUnknownCreate(kind, universeId, name, pendingRetryAfter, "renamed");
|
|
9974
|
+
await client.updateMonetizationItem(kind, universeId, id, changes);
|
|
9975
|
+
});
|
|
9881
9976
|
}
|
|
9882
9977
|
function requiredScopes2(request) {
|
|
9883
9978
|
const prefix = SCOPE_PREFIX[request.kind];
|
|
@@ -9942,6 +10037,7 @@ async function runAction2(request, universeId, client, icon) {
|
|
|
9942
10037
|
switch (request.action) {
|
|
9943
10038
|
case "list": {
|
|
9944
10039
|
const page = await client.listMonetizationItems(kind, universeId, request.pageToken);
|
|
10040
|
+
forgetUnknownCreates(page.items);
|
|
9945
10041
|
return {
|
|
9946
10042
|
kind,
|
|
9947
10043
|
universe_id: universeId,
|
|
@@ -9949,24 +10045,22 @@ async function runAction2(request, universeId, client, icon) {
|
|
|
9949
10045
|
...page.nextPageToken ? { next_page_token: page.nextPageToken } : {}
|
|
9950
10046
|
};
|
|
9951
10047
|
}
|
|
9952
|
-
case "get":
|
|
9953
|
-
|
|
10048
|
+
case "get": {
|
|
10049
|
+
const found = await client.getMonetizationItem(kind, universeId, requiredId(request));
|
|
10050
|
+
forgetUnknownCreates([found]);
|
|
10051
|
+
return { item: publicItem(found) };
|
|
10052
|
+
}
|
|
9954
10053
|
case "create": {
|
|
9955
|
-
const
|
|
9956
|
-
const existing = await findItemNamed(client, kind, universeId, name);
|
|
9957
|
-
if (existing) {
|
|
9958
|
-
throw new MonetizationError("duplicate_name", `A ${itemLabel(kind)} named "${existing.name}" already exists in universe ${universeId}. Update it or choose another name.`, { existing: publicItem(existing) });
|
|
9959
|
-
}
|
|
9960
|
-
const created = await client.createMonetizationItem(kind, universeId, {
|
|
10054
|
+
const created = await createNamed(client, kind, universeId, {
|
|
9961
10055
|
...changes,
|
|
9962
|
-
name,
|
|
10056
|
+
name: requiredName(request),
|
|
9963
10057
|
forSale: request.forSale ?? false
|
|
9964
10058
|
});
|
|
9965
10059
|
return { created: true, item: publicItem(created) };
|
|
9966
10060
|
}
|
|
9967
10061
|
case "update": {
|
|
9968
10062
|
const id = requiredId(request);
|
|
9969
|
-
await client
|
|
10063
|
+
await updateItem(client, kind, universeId, id, changes);
|
|
9970
10064
|
try {
|
|
9971
10065
|
return { updated: true, item: publicItem(await client.getMonetizationItem(kind, universeId, id)) };
|
|
9972
10066
|
} catch (error) {
|
|
@@ -11531,7 +11625,7 @@ var TOOL_DEFINITIONS = [
|
|
|
11531
11625
|
{
|
|
11532
11626
|
name: "upload_asset",
|
|
11533
11627
|
category: "write",
|
|
11534
|
-
description: "Use to upload a local asset file to a Roblox user or group.",
|
|
11628
|
+
description: "Use to upload a local asset file to a Roblox user or group. Without userId or groupId, ROBLOX_CREATOR_GROUP_ID wins over ROBLOX_CREATOR_USER_ID.",
|
|
11535
11629
|
inputSchema: {
|
|
11536
11630
|
type: "object",
|
|
11537
11631
|
properties: {
|
|
@@ -11554,11 +11648,11 @@ var TOOL_DEFINITIONS = [
|
|
|
11554
11648
|
},
|
|
11555
11649
|
userId: {
|
|
11556
11650
|
type: "string",
|
|
11557
|
-
description: "Creator user ID;
|
|
11651
|
+
description: "Creator user ID; replaces env defaults (groupId wins if both)"
|
|
11558
11652
|
},
|
|
11559
11653
|
groupId: {
|
|
11560
11654
|
type: "string",
|
|
11561
|
-
description: "Creator group ID;
|
|
11655
|
+
description: "Creator group ID; replaces env defaults and wins over userId"
|
|
11562
11656
|
}
|
|
11563
11657
|
},
|
|
11564
11658
|
required: ["filePath", "assetType", "displayName"]
|
|
@@ -19204,6 +19298,7 @@ function analyzeMicroProfilerSession(session, options = {}) {
|
|
|
19204
19298
|
}
|
|
19205
19299
|
|
|
19206
19300
|
// ../core/dist/micro-profiler/capture.js
|
|
19301
|
+
import { randomUUID as randomUUID5 } from "crypto";
|
|
19207
19302
|
import * as fs5 from "fs";
|
|
19208
19303
|
import * as os5 from "os";
|
|
19209
19304
|
import * as path10 from "path";
|
|
@@ -19265,7 +19360,8 @@ function defaultCaptureDirectory() {
|
|
|
19265
19360
|
function captureFileStamp(date) {
|
|
19266
19361
|
return date.toISOString().replace(/[:.]/g, "-");
|
|
19267
19362
|
}
|
|
19268
|
-
|
|
19363
|
+
var DEFAULT_CAPTURE_PRUNE_GRACE_MS = 10 * 6e4;
|
|
19364
|
+
async function pruneDefaultCaptures(directory, keep = KEPT_DEFAULT_CAPTURES, graceMs = DEFAULT_CAPTURE_PRUNE_GRACE_MS, now = Date.now()) {
|
|
19269
19365
|
let entries;
|
|
19270
19366
|
try {
|
|
19271
19367
|
entries = await fs5.promises.readdir(directory);
|
|
@@ -19273,19 +19369,36 @@ async function pruneDefaultCaptures(directory, keep = KEPT_DEFAULT_CAPTURES) {
|
|
|
19273
19369
|
return;
|
|
19274
19370
|
}
|
|
19275
19371
|
const captures = entries.filter((name) => name.startsWith("micro-profiler-") && name.endsWith(CAPTURE_EXTENSION)).sort();
|
|
19276
|
-
|
|
19372
|
+
const settled = [];
|
|
19373
|
+
for (const name of captures) {
|
|
19374
|
+
try {
|
|
19375
|
+
const stats = await fs5.promises.stat(path10.join(directory, name));
|
|
19376
|
+
if (now - stats.mtimeMs >= graceMs)
|
|
19377
|
+
settled.push(name);
|
|
19378
|
+
} catch {
|
|
19379
|
+
}
|
|
19380
|
+
}
|
|
19381
|
+
for (const name of settled.slice(0, Math.max(0, settled.length - keep))) {
|
|
19277
19382
|
await fs5.promises.rm(path10.join(directory, name), { force: true });
|
|
19278
19383
|
await fs5.promises.rm(path10.join(directory, `${name}${WINDOW_SIDECAR_SUFFIX}`), { force: true });
|
|
19279
19384
|
}
|
|
19280
19385
|
}
|
|
19281
19386
|
async function resolveCapturePath(outputPath, role, now = /* @__PURE__ */ new Date()) {
|
|
19282
19387
|
if (outputPath !== void 0 && outputPath !== "")
|
|
19283
|
-
return path10.resolve(outputPath);
|
|
19388
|
+
return { path: path10.resolve(outputPath), generated: false };
|
|
19284
19389
|
const directory = defaultCaptureDirectory();
|
|
19285
19390
|
await fs5.promises.mkdir(directory, { recursive: true });
|
|
19286
19391
|
await pruneDefaultCaptures(directory, KEPT_DEFAULT_CAPTURES - 1);
|
|
19287
19392
|
const safeRole = role.replace(/[^A-Za-z0-9-]/g, "_");
|
|
19288
|
-
|
|
19393
|
+
const uniqueId = `${process.pid}-${randomUUID5().slice(0, 8)}`;
|
|
19394
|
+
return {
|
|
19395
|
+
path: path10.join(directory, `micro-profiler-${captureFileStamp(now)}-${safeRole}-${uniqueId}${CAPTURE_EXTENSION}`),
|
|
19396
|
+
generated: true
|
|
19397
|
+
};
|
|
19398
|
+
}
|
|
19399
|
+
async function writeCaptureFile(target, bytes) {
|
|
19400
|
+
await fs5.promises.mkdir(path10.dirname(target.path), { recursive: true });
|
|
19401
|
+
await fs5.promises.writeFile(target.path, bytes, { flag: target.generated ? "wx" : "w" });
|
|
19289
19402
|
}
|
|
19290
19403
|
function parseCaptureTransfer(value) {
|
|
19291
19404
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
@@ -19385,7 +19498,7 @@ function windowFromRecording(recording) {
|
|
|
19385
19498
|
}
|
|
19386
19499
|
|
|
19387
19500
|
// ../core/dist/tools/index.js
|
|
19388
|
-
import { createHash as createHash3, randomUUID as
|
|
19501
|
+
import { createHash as createHash3, randomUUID as randomUUID6 } from "crypto";
|
|
19389
19502
|
|
|
19390
19503
|
// ../core/dist/tools/reference-uploads.js
|
|
19391
19504
|
var ReferenceUploadError = class extends Error {
|
|
@@ -19422,17 +19535,25 @@ var ReferenceUploads = class {
|
|
|
19422
19535
|
* The record for operationId after checking this request matches it.
|
|
19423
19536
|
* Undefined when this session has prepared nothing under that ID.
|
|
19424
19537
|
*/
|
|
19425
|
-
lookup(operationId, identityKey, targetPeerId) {
|
|
19426
|
-
const record = this.matching(operationId, identityKey, targetPeerId);
|
|
19538
|
+
lookup(operationId, identityKey, targetPeerId, targetInstanceId) {
|
|
19539
|
+
const record = this.matching(operationId, identityKey, targetPeerId, targetInstanceId);
|
|
19427
19540
|
return record && this.toView(record);
|
|
19428
19541
|
}
|
|
19542
|
+
/**
|
|
19543
|
+
* The Studio Instance an operation was pinned to, so a retry that names no
|
|
19544
|
+
* instance_id returns to it rather than to whichever Studio is connected now.
|
|
19545
|
+
*/
|
|
19546
|
+
pinnedInstance(operationId) {
|
|
19547
|
+
this.prune();
|
|
19548
|
+
return this.records.get(operationId)?.targetInstanceId;
|
|
19549
|
+
}
|
|
19429
19550
|
/**
|
|
19430
19551
|
* The image asset ID for this operation: reuses a finished upload, joins one
|
|
19431
19552
|
* in flight, resumes one Roblox accepted, or starts one. An upload whose
|
|
19432
19553
|
* outcome is unknown and cannot be resumed is refused, never repeated.
|
|
19433
19554
|
*/
|
|
19434
|
-
acquire(operationId, identityKey, targetPeerId, attempt) {
|
|
19435
|
-
let record = this.matching(operationId, identityKey, targetPeerId);
|
|
19555
|
+
acquire(operationId, identityKey, targetPeerId, targetInstanceId, attempt) {
|
|
19556
|
+
let record = this.matching(operationId, identityKey, targetPeerId, targetInstanceId);
|
|
19436
19557
|
if (record) {
|
|
19437
19558
|
if (record.inFlight)
|
|
19438
19559
|
return record.inFlight;
|
|
@@ -19451,7 +19572,16 @@ var ReferenceUploads = class {
|
|
|
19451
19572
|
record.createdAssetId = void 0;
|
|
19452
19573
|
} else {
|
|
19453
19574
|
const now = this.now();
|
|
19454
|
-
record = {
|
|
19575
|
+
record = {
|
|
19576
|
+
operationId,
|
|
19577
|
+
identityKey,
|
|
19578
|
+
targetPeerId,
|
|
19579
|
+
targetInstanceId,
|
|
19580
|
+
stage: "uploading",
|
|
19581
|
+
phase: "local",
|
|
19582
|
+
startedAt: now,
|
|
19583
|
+
updatedAt: now
|
|
19584
|
+
};
|
|
19455
19585
|
this.records.set(operationId, record);
|
|
19456
19586
|
this.prune();
|
|
19457
19587
|
}
|
|
@@ -19522,12 +19652,12 @@ var ReferenceUploads = class {
|
|
|
19522
19652
|
signal?.removeEventListener("abort", onAbort);
|
|
19523
19653
|
}
|
|
19524
19654
|
}
|
|
19525
|
-
matching(operationId, identityKey, targetPeerId) {
|
|
19655
|
+
matching(operationId, identityKey, targetPeerId, targetInstanceId) {
|
|
19526
19656
|
this.prune();
|
|
19527
19657
|
const record = this.records.get(operationId);
|
|
19528
19658
|
if (!record)
|
|
19529
19659
|
return void 0;
|
|
19530
|
-
if (record.identityKey !== identityKey || record.stage === "dispatched" && record.targetPeerId !== targetPeerId) {
|
|
19660
|
+
if (record.identityKey !== identityKey || record.targetInstanceId !== targetInstanceId || record.stage === "dispatched" && record.targetPeerId !== targetPeerId) {
|
|
19531
19661
|
throw new ReferenceUploadError(`Request ${operationId} already identifies a different operation; nothing was uploaded or sent`, "operation_id_collision");
|
|
19532
19662
|
}
|
|
19533
19663
|
return record;
|
|
@@ -19593,6 +19723,7 @@ var ReferenceUploads = class {
|
|
|
19593
19723
|
return {
|
|
19594
19724
|
stage: record.stage,
|
|
19595
19725
|
targetPeerId: record.targetPeerId,
|
|
19726
|
+
targetInstanceId: record.targetInstanceId,
|
|
19596
19727
|
startedAt: record.startedAt,
|
|
19597
19728
|
updatedAt: record.updatedAt,
|
|
19598
19729
|
...record.imageAssetId !== void 0 ? { imageAssetId: record.imageAssetId } : {},
|
|
@@ -19621,6 +19752,19 @@ var DEFAULT_ASSET_PREVIEW_DEPTH = 4;
|
|
|
19621
19752
|
var MAX_ASSET_PREVIEW_HIERARCHY_NODES = 100;
|
|
19622
19753
|
var MAX_SEARCH_ASSET_DESCRIPTION_LENGTH = 240;
|
|
19623
19754
|
var ROBLOX_CREATOR_USER_ID = 1;
|
|
19755
|
+
function resolveUploadCreator(userId, groupId) {
|
|
19756
|
+
if (groupId)
|
|
19757
|
+
return { groupId };
|
|
19758
|
+
if (userId)
|
|
19759
|
+
return { userId };
|
|
19760
|
+
const envGroupId = process.env.ROBLOX_CREATOR_GROUP_ID;
|
|
19761
|
+
if (envGroupId)
|
|
19762
|
+
return { groupId: envGroupId };
|
|
19763
|
+
const envUserId = process.env.ROBLOX_CREATOR_USER_ID;
|
|
19764
|
+
if (envUserId)
|
|
19765
|
+
return { userId: envUserId };
|
|
19766
|
+
return void 0;
|
|
19767
|
+
}
|
|
19624
19768
|
var MAX_DEVICE_MATRIX_ENTRIES = 6;
|
|
19625
19769
|
var MAX_NETWORK_PACKET_LOSS_PERCENT = 0.5;
|
|
19626
19770
|
var GREP_SCRIPTS_TIMEOUT_MS = 12e4;
|
|
@@ -20630,7 +20774,7 @@ var RobloxStudioTools = class {
|
|
|
20630
20774
|
data: this._routingErrorData()
|
|
20631
20775
|
});
|
|
20632
20776
|
}
|
|
20633
|
-
return dispatch(resolved.targetPeerId);
|
|
20777
|
+
return dispatch(resolved.targetPeerId, resolved.targetInstanceId);
|
|
20634
20778
|
}
|
|
20635
20779
|
// A grouped runtime process ID, or its role-suffixed Instance ID, names exactly
|
|
20636
20780
|
// one Peer. Solo playtest Peers share one Instance ID, so it names none of them.
|
|
@@ -22199,9 +22343,9 @@ var RobloxStudioTools = class {
|
|
|
22199
22343
|
let capturePath;
|
|
22200
22344
|
let saveError;
|
|
22201
22345
|
try {
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
await
|
|
22346
|
+
const target2 = await resolveCapturePath(typeof outputPath === "string" ? outputPath : void 0, role);
|
|
22347
|
+
capturePath = target2.path;
|
|
22348
|
+
await writeCaptureFile(target2, bytes);
|
|
22205
22349
|
await writeWindowSidecar(capturePath, role, recording);
|
|
22206
22350
|
} catch (error) {
|
|
22207
22351
|
saveError = `Could not save the capture${capturePath ? ` to ${capturePath}` : ""}: ${errorMessage(error)}`;
|
|
@@ -23360,7 +23504,7 @@ var RobloxStudioTools = class {
|
|
|
23360
23504
|
try {
|
|
23361
23505
|
return await this._generateModel(request, instance_id);
|
|
23362
23506
|
} catch (error) {
|
|
23363
|
-
if (error instanceof RoutingFailure)
|
|
23507
|
+
if (error instanceof RoutingFailure || error instanceof RequestFailure || error instanceof StudioOperationError || error instanceof OpenCloudOperationError || error instanceof ReferenceUploadError || error instanceof MultiplayerGroupInUseError)
|
|
23364
23508
|
throw error;
|
|
23365
23509
|
const message = error instanceof Error ? error.message : String(error);
|
|
23366
23510
|
return {
|
|
@@ -23458,23 +23602,32 @@ var RobloxStudioTools = class {
|
|
|
23458
23602
|
const uploadUnavailable = this.referenceUploadUnavailable();
|
|
23459
23603
|
if (uploadUnavailable)
|
|
23460
23604
|
throw new Error(uploadUnavailable);
|
|
23461
|
-
const
|
|
23605
|
+
const pinnedInstanceId = operationId !== void 0 ? this.referenceUploads.pinnedInstance(operationId) : void 0;
|
|
23606
|
+
const { targetPeerId, targetInstanceId } = await this._resolveEditTarget(instance_id ?? pinnedInstanceId).catch((error) => {
|
|
23607
|
+
if (instance_id === void 0 && pinnedInstanceId !== void 0 && error instanceof RoutingFailure) {
|
|
23608
|
+
throw new RoutingFailure({
|
|
23609
|
+
...error.routingError,
|
|
23610
|
+
message: `Operation ${operationId} is tied to Studio instance ${pinnedInstanceId}, which is no longer connected; reconnect that Studio, or start over with a new operation_id.`
|
|
23611
|
+
});
|
|
23612
|
+
}
|
|
23613
|
+
throw error;
|
|
23614
|
+
});
|
|
23462
23615
|
if (submit && !this.bridge.supportsPrimaryFeature("submit")) {
|
|
23463
|
-
throw new
|
|
23616
|
+
throw new RequestFailure("The primary MCP server cannot start a job that outlives the call; call without async, or restart that server on this version. Nothing was uploaded; queued; not_executed", "primary_unsupported", { requestId: operationId ?? randomUUID6(), targetPeerId, stage: "queued", outcome: "not_executed", executionOutcome: "not_executed" });
|
|
23464
23617
|
}
|
|
23465
23618
|
const png = referencePng;
|
|
23466
23619
|
const identity = { ...payload, image: { kind: "png_sha256", sha256: createHash3("sha256").update(png).digest("hex") } };
|
|
23467
23620
|
const attempt = {
|
|
23468
|
-
upload: (progress) => this.uploadGenerateModelReferenceImage(png,
|
|
23469
|
-
resume: (checkpoint, progress) => this.resumeGenerateModelReferenceImage(checkpoint,
|
|
23621
|
+
upload: (progress) => this.uploadGenerateModelReferenceImage(png, targetInstanceId, progress),
|
|
23622
|
+
resume: (checkpoint, progress) => this.resumeGenerateModelReferenceImage(checkpoint, targetInstanceId, progress)
|
|
23470
23623
|
};
|
|
23471
23624
|
if (operationId === void 0 && !submit) {
|
|
23472
23625
|
payload.image = { kind: "asset", asset_id: await attempt.upload(UNTRACKED_UPLOAD) };
|
|
23473
|
-
return this._dispatchGenerateModel(payload,
|
|
23626
|
+
return this._dispatchGenerateModel(payload, targetInstanceId, timeoutMs, false, void 0, identity);
|
|
23474
23627
|
}
|
|
23475
|
-
const jobId = operationId ??
|
|
23628
|
+
const jobId = operationId ?? randomUUID6();
|
|
23476
23629
|
const identityKey = createHash3("sha256").update(JSON.stringify({ endpoint: "/api/generate-model", identity })).digest("hex");
|
|
23477
|
-
const prepared = this.referenceUploads.lookup(jobId, identityKey, targetPeerId);
|
|
23630
|
+
const prepared = this.referenceUploads.lookup(jobId, identityKey, targetPeerId, targetInstanceId);
|
|
23478
23631
|
if (operationId !== void 0 && !prepared) {
|
|
23479
23632
|
const joined = await this.bridge.joinOperation("/api/generate-model", targetPeerId, jobId, identity);
|
|
23480
23633
|
if (joined && submit)
|
|
@@ -23484,13 +23637,16 @@ var RobloxStudioTools = class {
|
|
|
23484
23637
|
}
|
|
23485
23638
|
let dispatchPeerId = targetPeerId;
|
|
23486
23639
|
const generate = async () => {
|
|
23487
|
-
payload.image = {
|
|
23488
|
-
|
|
23640
|
+
payload.image = {
|
|
23641
|
+
kind: "asset",
|
|
23642
|
+
asset_id: await this.referenceUploads.acquire(jobId, identityKey, targetPeerId, targetInstanceId, attempt)
|
|
23643
|
+
};
|
|
23644
|
+
return this._dispatchGenerateModel(payload, targetInstanceId, timeoutMs, submit, jobId, identity, (peerId) => {
|
|
23489
23645
|
dispatchPeerId = peerId;
|
|
23490
23646
|
this.referenceUploads.dispatched(jobId, peerId);
|
|
23491
23647
|
});
|
|
23492
23648
|
};
|
|
23493
|
-
const current = this.referenceUploads.lookup(jobId, identityKey, targetPeerId);
|
|
23649
|
+
const current = this.referenceUploads.lookup(jobId, identityKey, targetPeerId, targetInstanceId);
|
|
23494
23650
|
const job = generate();
|
|
23495
23651
|
this.referenceUploads.attach(jobId, job);
|
|
23496
23652
|
job.catch((error) => {
|
|
@@ -23502,8 +23658,11 @@ var RobloxStudioTools = class {
|
|
|
23502
23658
|
}
|
|
23503
23659
|
return job;
|
|
23504
23660
|
}
|
|
23505
|
-
|
|
23506
|
-
|
|
23661
|
+
// The edit Peer for instance_id and the Studio Instance it belongs to. A
|
|
23662
|
+
// multi-step operation pins the Instance, so a plugin reload in that Studio
|
|
23663
|
+
// still reaches it, but a different Studio never does.
|
|
23664
|
+
_resolveEditTarget(instance_id) {
|
|
23665
|
+
return this._withSinglePeer("edit", instance_id, void 0, async (targetPeerId, targetInstanceId) => ({ targetPeerId, targetInstanceId }));
|
|
23507
23666
|
}
|
|
23508
23667
|
async _dispatchGenerateModel(payload, instance_id, timeoutMs, submit, operationId, identity, onDispatch) {
|
|
23509
23668
|
return this._withSinglePeer("edit", instance_id, void 0, async (targetPeerId) => {
|
|
@@ -23727,7 +23886,7 @@ var RobloxStudioTools = class {
|
|
|
23727
23886
|
if (!this.openCloudClient.hasApiKey()) {
|
|
23728
23887
|
return "image_path and image_base64 require Roblox asset upload credentials because GenerateModelAsync only accepts rbxassetid:// or rbxasset:// image inputs. Set ROBLOX_OPEN_CLOUD_API_KEY plus ROBLOX_CREATOR_USER_ID or ROBLOX_CREATOR_GROUP_ID, or pass image_asset_id.";
|
|
23729
23888
|
}
|
|
23730
|
-
if (!
|
|
23889
|
+
if (!resolveUploadCreator()) {
|
|
23731
23890
|
return "Creator identity required for image upload. Set ROBLOX_CREATOR_USER_ID or ROBLOX_CREATOR_GROUP_ID, or pass image_asset_id.";
|
|
23732
23891
|
}
|
|
23733
23892
|
return void 0;
|
|
@@ -23739,8 +23898,7 @@ var RobloxStudioTools = class {
|
|
|
23739
23898
|
fileName: "generate-model-reference.png",
|
|
23740
23899
|
displayName: STUDIO_ASSISTANT_SOURCE_IMAGE_LABEL,
|
|
23741
23900
|
description: STUDIO_ASSISTANT_SOURCE_IMAGE_LABEL,
|
|
23742
|
-
|
|
23743
|
-
groupId: process.env.ROBLOX_CREATOR_GROUP_ID,
|
|
23901
|
+
...resolveUploadCreator(),
|
|
23744
23902
|
onSending: () => progress.sending(),
|
|
23745
23903
|
onAccepted: (id) => progress.accepted({ provider: "user_auth", id })
|
|
23746
23904
|
});
|
|
@@ -23749,14 +23907,7 @@ var RobloxStudioTools = class {
|
|
|
23749
23907
|
const unavailable = this.referenceUploadUnavailable();
|
|
23750
23908
|
if (unavailable)
|
|
23751
23909
|
throw new Error(unavailable);
|
|
23752
|
-
const
|
|
23753
|
-
const resolvedUserId = process.env.ROBLOX_CREATOR_USER_ID;
|
|
23754
|
-
const creator = {};
|
|
23755
|
-
if (resolvedGroupId) {
|
|
23756
|
-
creator.groupId = resolvedGroupId;
|
|
23757
|
-
} else {
|
|
23758
|
-
creator.userId = resolvedUserId;
|
|
23759
|
-
}
|
|
23910
|
+
const creator = resolveUploadCreator() ?? {};
|
|
23760
23911
|
const result = await this.openCloudClient.createAsset({
|
|
23761
23912
|
assetType: "Decal",
|
|
23762
23913
|
displayName: STUDIO_ASSISTANT_SOURCE_IMAGE_LABEL,
|
|
@@ -23799,16 +23950,14 @@ var RobloxStudioTools = class {
|
|
|
23799
23950
|
}
|
|
23800
23951
|
});
|
|
23801
23952
|
const fileName = path11.basename(filePath);
|
|
23802
|
-
const
|
|
23803
|
-
const resolvedUserId = userId || process.env.ROBLOX_CREATOR_USER_ID;
|
|
23953
|
+
const resolvedCreator = resolveUploadCreator(userId, groupId);
|
|
23804
23954
|
if (assetType === "Decal" && this.cookieClient.hasCookie()) {
|
|
23805
23955
|
const result2 = await this.cookieClient.uploadImage({
|
|
23806
23956
|
fileContent,
|
|
23807
23957
|
fileName,
|
|
23808
23958
|
displayName,
|
|
23809
23959
|
description: description || "",
|
|
23810
|
-
|
|
23811
|
-
groupId: resolvedGroupId
|
|
23960
|
+
...resolvedCreator
|
|
23812
23961
|
});
|
|
23813
23962
|
return {
|
|
23814
23963
|
content: [{
|
|
@@ -23830,15 +23979,10 @@ var RobloxStudioTools = class {
|
|
|
23830
23979
|
const cookieHint = assetType === "Decal" ? " Alternatively, set ROBLOSECURITY to use cookie auth." : "";
|
|
23831
23980
|
throw new Error(`No auth configured for ${assetType} upload. Set ROBLOX_OPEN_CLOUD_API_KEY (needs asset:write scope).${cookieHint}`);
|
|
23832
23981
|
}
|
|
23833
|
-
if (!
|
|
23982
|
+
if (!resolvedCreator) {
|
|
23834
23983
|
throw new Error("Creator identity required for Open Cloud upload. Set ROBLOX_CREATOR_USER_ID or ROBLOX_CREATOR_GROUP_ID, or pass userId/groupId as parameters.");
|
|
23835
23984
|
}
|
|
23836
|
-
const creator =
|
|
23837
|
-
if (resolvedGroupId) {
|
|
23838
|
-
creator.groupId = resolvedGroupId;
|
|
23839
|
-
} else {
|
|
23840
|
-
creator.userId = resolvedUserId;
|
|
23841
|
-
}
|
|
23985
|
+
const creator = resolvedCreator;
|
|
23842
23986
|
const result = await this.openCloudClient.createAsset({
|
|
23843
23987
|
assetType,
|
|
23844
23988
|
displayName,
|
|
@@ -24472,8 +24616,8 @@ manage_monetization lists, reads, creates, and updates developer products and ga
|
|
|
24472
24616
|
|
|
24473
24617
|
- Roblox cannot delete developer products or game passes. To retire one, update it with for_sale=false.
|
|
24474
24618
|
- create keeps new items off sale unless for_sale=true, which also needs a price.
|
|
24475
|
-
- create refuses a name that already exists in the universe and returns the existing item. If a create
|
|
24476
|
-
- update changes only the arguments supplied, then reads the item back.
|
|
24619
|
+
- create refuses a name that already exists in the universe and returns the existing item. If a create returns create_outcome_unknown, list the universe first; if the item never appears, retry after retry_after.
|
|
24620
|
+
- update changes only the arguments supplied, then reads the item back. It refuses to rename an item to a name another item already uses.
|
|
24477
24621
|
- image_path uploads a local PNG, JPEG, or BMP icon. Roblox shows icons at 512x512 inside a circle, so keep details away from the corners.
|
|
24478
24622
|
|
|
24479
24623
|
## Experience settings
|
|
@@ -24651,6 +24795,15 @@ function normalizeToolResult(raw, era) {
|
|
|
24651
24795
|
...isError ? { isError: true } : {}
|
|
24652
24796
|
};
|
|
24653
24797
|
}
|
|
24798
|
+
function withErrorText(result) {
|
|
24799
|
+
if (!result.isError || !result.structuredContent || result.content.some((block) => block.type === "text")) {
|
|
24800
|
+
return result;
|
|
24801
|
+
}
|
|
24802
|
+
return {
|
|
24803
|
+
...result,
|
|
24804
|
+
content: [{ type: "text", text: JSON.stringify(result.structuredContent) }, ...result.content]
|
|
24805
|
+
};
|
|
24806
|
+
}
|
|
24654
24807
|
function publicRoutingError(error) {
|
|
24655
24808
|
return {
|
|
24656
24809
|
error: error.routingError.code,
|
|
@@ -24693,6 +24846,9 @@ function publicToolErrorBody(name, error) {
|
|
|
24693
24846
|
operation_path: error.operationPath
|
|
24694
24847
|
};
|
|
24695
24848
|
}
|
|
24849
|
+
if (error instanceof ReferenceUploadError) {
|
|
24850
|
+
return { error: error.code, message: error.message.slice(0, 500) };
|
|
24851
|
+
}
|
|
24696
24852
|
console.error(`[tool:${name}]`, error);
|
|
24697
24853
|
const message = error instanceof Error ? error.message : typeof error === "string" ? error : "Tool execution failed.";
|
|
24698
24854
|
return { error: "tool_failed", message: message.slice(0, 500) };
|
|
@@ -24797,12 +24953,12 @@ function createToolServer(options) {
|
|
|
24797
24953
|
}, async (args, context) => {
|
|
24798
24954
|
try {
|
|
24799
24955
|
const raw = await options.invoke(options.getTools(), definition.name, args, { signal: context.mcpReq.signal });
|
|
24800
|
-
return normalizeToolResult(raw, options.era);
|
|
24956
|
+
return withErrorText(normalizeToolResult(raw, options.era));
|
|
24801
24957
|
} catch (error) {
|
|
24802
|
-
return normalizeToolResult({
|
|
24958
|
+
return withErrorText(normalizeToolResult({
|
|
24803
24959
|
content: [{ type: "text", text: JSON.stringify(publicToolErrorBody(definition.name, error)) }],
|
|
24804
24960
|
isError: true
|
|
24805
|
-
}, options.era);
|
|
24961
|
+
}, options.era));
|
|
24806
24962
|
}
|
|
24807
24963
|
});
|
|
24808
24964
|
}
|
|
@@ -24818,7 +24974,7 @@ function createToolHttpHandler(options) {
|
|
|
24818
24974
|
// ../core/dist/auth.js
|
|
24819
24975
|
import { randomBytes, createHash as createHash4, timingSafeEqual } from "crypto";
|
|
24820
24976
|
import { mkdirSync as mkdirSync4, readFileSync as readFileSync8, writeFileSync as writeFileSync4, linkSync as linkSync2, unlinkSync as unlinkSync2 } from "fs";
|
|
24821
|
-
import { join as join9, dirname as
|
|
24977
|
+
import { join as join9, dirname as dirname5 } from "path";
|
|
24822
24978
|
import { homedir as homedir3 } from "os";
|
|
24823
24979
|
function authTokenFilePath() {
|
|
24824
24980
|
return join9(homedir3(), ".robloxstudio-mcp", "auth-token");
|
|
@@ -24854,7 +25010,7 @@ function resolveAuthToken() {
|
|
|
24854
25010
|
throw error;
|
|
24855
25011
|
}
|
|
24856
25012
|
const fresh = randomBytes(32).toString("hex");
|
|
24857
|
-
mkdirSync4(
|
|
25013
|
+
mkdirSync4(dirname5(filePath), { recursive: true, mode: 448 });
|
|
24858
25014
|
const stagingPath = `${filePath}.${process.pid}.${randomBytes(16).toString("hex")}.tmp`;
|
|
24859
25015
|
writeFileSync4(stagingPath, fresh + "\n", { encoding: "utf8", mode: 384, flag: "wx" });
|
|
24860
25016
|
try {
|
|
@@ -25809,7 +25965,7 @@ function bindPort(app, host, port) {
|
|
|
25809
25965
|
}
|
|
25810
25966
|
|
|
25811
25967
|
// ../core/dist/proxy-bridge-service.js
|
|
25812
|
-
import { randomUUID as
|
|
25968
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
25813
25969
|
var PROXY_RESPONSE_GRACE_MS = 5e3;
|
|
25814
25970
|
function parseRequestStatus(value) {
|
|
25815
25971
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
@@ -25882,7 +26038,7 @@ var ProxyBridgeService = class _ProxyBridgeService extends BridgeService {
|
|
|
25882
26038
|
super();
|
|
25883
26039
|
this.primaryBaseUrl = primaryBaseUrl;
|
|
25884
26040
|
this.authToken = authToken;
|
|
25885
|
-
this.proxyInstanceId =
|
|
26041
|
+
this.proxyInstanceId = randomUUID7();
|
|
25886
26042
|
this.initialRefresh = this.refreshTopology();
|
|
25887
26043
|
this.refreshTimer = setInterval(() => this.refreshTopology(), _ProxyBridgeService.REFRESH_INTERVAL_MS);
|
|
25888
26044
|
}
|
|
@@ -26115,7 +26271,7 @@ var ProxyBridgeService = class _ProxyBridgeService extends BridgeService {
|
|
|
26115
26271
|
// The primary admits the operation and answers at once, so the operation
|
|
26116
26272
|
// never depends on this proxy or its caller staying connected.
|
|
26117
26273
|
async submitRequest(endpoint, data, targetPeerId, timeoutMs = this.proxyRequestTimeout, operationId, identity) {
|
|
26118
|
-
const requestId = operationId ??
|
|
26274
|
+
const requestId = operationId ?? randomUUID7();
|
|
26119
26275
|
const status = parseRequestStatus(await this.postProxy({
|
|
26120
26276
|
endpoint,
|
|
26121
26277
|
data,
|
|
@@ -26132,7 +26288,7 @@ var ProxyBridgeService = class _ProxyBridgeService extends BridgeService {
|
|
|
26132
26288
|
async postProxy(request, signal) {
|
|
26133
26289
|
const { endpoint, data, targetPeerId, submit } = request;
|
|
26134
26290
|
let { identity } = request;
|
|
26135
|
-
const requestId = request.operationId ??
|
|
26291
|
+
const requestId = request.operationId ?? randomUUID7();
|
|
26136
26292
|
const details = { requestId, targetPeerId, stage: "queued", outcome: "not_executed", executionOutcome: "not_executed" };
|
|
26137
26293
|
if (!isValidOperationId(requestId)) {
|
|
26138
26294
|
throw new RequestFailure("operationId must be a nonempty string of at most 128 characters", "invalid_operation_id", details);
|
|
@@ -26652,7 +26808,7 @@ var RobloxStudioMCPServer = class {
|
|
|
26652
26808
|
var import_saxes = __toESM(require_saxes(), 1);
|
|
26653
26809
|
import { existsSync as existsSync6, lstatSync as lstatSync2, mkdirSync as mkdirSync5, readFileSync as readFileSync9, renameSync, rmSync as rmSync5, rmdirSync, statSync as statSync4, unlinkSync as unlinkSync3, writeFileSync as writeFileSync5 } from "fs";
|
|
26654
26810
|
import { execSync } from "child_process";
|
|
26655
|
-
import { randomUUID as
|
|
26811
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
26656
26812
|
import { basename as basename3, join as join10 } from "path";
|
|
26657
26813
|
import { homedir as homedir4 } from "os";
|
|
26658
26814
|
import { isUtf8 } from "buffer";
|
|
@@ -26737,7 +26893,7 @@ function repairStaleStudioPluginDirectorySetting({ settingsPath, studioPluginsDi
|
|
|
26737
26893
|
return false;
|
|
26738
26894
|
const studioPath = escapeXmlText(studioPluginsDirectory);
|
|
26739
26895
|
const updated = contents.replace(pluginDirectorySettingPattern(), (_match, open4, _value, close) => `${open4}${studioPath}${close}`);
|
|
26740
|
-
const temporaryPath = `${settingsPath}.rsmcp-install-${process.pid}-${
|
|
26896
|
+
const temporaryPath = `${settingsPath}.rsmcp-install-${process.pid}-${randomUUID8()}.tmp`;
|
|
26741
26897
|
try {
|
|
26742
26898
|
writeFileSync5(temporaryPath, updated, {
|
|
26743
26899
|
encoding: "utf8",
|
|
@@ -26843,7 +26999,7 @@ function recoverPluginInstallLock(lockPath, warn) {
|
|
|
26843
26999
|
} catch (error) {
|
|
26844
27000
|
throw pluginInstallLockError(lockPath, errorCode2(error) === "EEXIST" ? "Plugin installation lock recovery is already in progress or was interrupted" : `Could not claim plugin installation lock recovery (${error})`);
|
|
26845
27001
|
}
|
|
26846
|
-
const abandonedPath = `${lockPath}.${
|
|
27002
|
+
const abandonedPath = `${lockPath}.${randomUUID8()}.abandoned`;
|
|
26847
27003
|
let moved = false;
|
|
26848
27004
|
try {
|
|
26849
27005
|
let currentOwner;
|
|
@@ -26880,7 +27036,7 @@ function acquirePluginInstallLock(pluginsFolder, warn) {
|
|
|
26880
27036
|
const ownerPath = join10(lockPath, "owner.json");
|
|
26881
27037
|
const owner = {
|
|
26882
27038
|
pid: process.pid,
|
|
26883
|
-
token:
|
|
27039
|
+
token: randomUUID8(),
|
|
26884
27040
|
createdAt: Date.now()
|
|
26885
27041
|
};
|
|
26886
27042
|
try {
|
|
@@ -27028,7 +27184,7 @@ function installPluginAsset({ pluginsFolder, assetName, otherAssetName, source,
|
|
|
27028
27184
|
try {
|
|
27029
27185
|
let installed = false;
|
|
27030
27186
|
if (!installedFileMatches(configured, destination)) {
|
|
27031
|
-
const staged = join10(pluginsFolder, `.${assetName}.${process.pid}.${
|
|
27187
|
+
const staged = join10(pluginsFolder, `.${assetName}.${process.pid}.${randomUUID8()}.tmp`);
|
|
27032
27188
|
try {
|
|
27033
27189
|
writeFileSync5(staged, configured, { flag: "wx" });
|
|
27034
27190
|
renameSync(staged, destination);
|
|
@@ -27059,7 +27215,7 @@ function installPluginAsset({ pluginsFolder, assetName, otherAssetName, source,
|
|
|
27059
27215
|
|
|
27060
27216
|
// ../core/dist/plugin-installer.js
|
|
27061
27217
|
import { existsSync as existsSync7, readFileSync as readFileSync10 } from "fs";
|
|
27062
|
-
import { dirname as
|
|
27218
|
+
import { dirname as dirname6, join as join11 } from "path";
|
|
27063
27219
|
import { fileURLToPath } from "url";
|
|
27064
27220
|
import { get } from "https";
|
|
27065
27221
|
var REPO = "chrrxs/robloxstudio-mcp";
|
|
@@ -27067,7 +27223,7 @@ var TIMEOUT_MS = 3e4;
|
|
|
27067
27223
|
var MAX_REDIRECTS = 5;
|
|
27068
27224
|
var MAX_ASSET_BYTES = 64 * 1024 * 1024;
|
|
27069
27225
|
function createPluginInstaller(moduleUrl, variant) {
|
|
27070
|
-
const currentDir =
|
|
27226
|
+
const currentDir = dirname6(fileURLToPath(moduleUrl));
|
|
27071
27227
|
const ASSET_NAME = variant === "main" ? "MCPPlugin.rbxmx" : "MCPInspectorPlugin.rbxmx";
|
|
27072
27228
|
const OTHER_VARIANT = variant === "main" ? "MCPInspectorPlugin.rbxmx" : "MCPPlugin.rbxmx";
|
|
27073
27229
|
const userAgent = variant === "main" ? "robloxstudio-mcp" : "robloxstudio-mcp-inspector";
|
package/package.json
CHANGED
|
@@ -678,6 +678,12 @@ local DEFAULT_MCP_URL = "http://localhost:58741"
|
|
|
678
678
|
local mcpUrl = DEFAULT_MCP_URL
|
|
679
679
|
local BROKER_NAME = "__MCPClientBroker"
|
|
680
680
|
local BROKER_OWNER_ATTRIBUTE = "__MCPBrokerOwner"
|
|
681
|
+
-- Some games rename every remote in ReplicatedStorage on the client (Pet
|
|
682
|
+
-- Simulator X renames each one to its class name), so the client also finds
|
|
683
|
+
-- the bridge channels by this attribute, which a rename leaves in place.
|
|
684
|
+
local CHANNEL_ATTRIBUTE = "__MCPChannel"
|
|
685
|
+
local CHANNEL_WAIT_SECONDS = 10
|
|
686
|
+
local CHANNEL_POLL_SECONDS = 0.1
|
|
681
687
|
local CLIENT_IDENTITY_KIND = "identity"
|
|
682
688
|
-- A normal capture needs at most 15s sampling + 5s waiting for profiler data.
|
|
683
689
|
-- Leave room for processing, then return a diagnostic before the outer 30s wait.
|
|
@@ -1054,6 +1060,35 @@ local function handleClientInvoke(payload)
|
|
|
1054
1060
|
end
|
|
1055
1061
|
return result
|
|
1056
1062
|
end
|
|
1063
|
+
local function findChannel(name)
|
|
1064
|
+
local named = ReplicatedStorage:FindFirstChild(name)
|
|
1065
|
+
if named ~= nil then
|
|
1066
|
+
return named
|
|
1067
|
+
end
|
|
1068
|
+
local _exp = ReplicatedStorage:GetChildren()
|
|
1069
|
+
-- ▼ ReadonlyArray.find ▼
|
|
1070
|
+
local _callback = function(child)
|
|
1071
|
+
return child:GetAttribute(CHANNEL_ATTRIBUTE) == name
|
|
1072
|
+
end
|
|
1073
|
+
local _result
|
|
1074
|
+
for _i, _v in _exp do
|
|
1075
|
+
if _callback(_v, _i - 1, _exp) == true then
|
|
1076
|
+
_result = _v
|
|
1077
|
+
break
|
|
1078
|
+
end
|
|
1079
|
+
end
|
|
1080
|
+
-- ▲ ReadonlyArray.find ▲
|
|
1081
|
+
return _result
|
|
1082
|
+
end
|
|
1083
|
+
local function waitForChannel(name)
|
|
1084
|
+
local deadline = os.clock() + CHANNEL_WAIT_SECONDS
|
|
1085
|
+
local channel = findChannel(name)
|
|
1086
|
+
while channel == nil and os.clock() < deadline do
|
|
1087
|
+
task.wait(CHANNEL_POLL_SECONDS)
|
|
1088
|
+
channel = findChannel(name)
|
|
1089
|
+
end
|
|
1090
|
+
return channel
|
|
1091
|
+
end
|
|
1057
1092
|
local function startClientHeartbeat(attempt)
|
|
1058
1093
|
if attempt == nil then
|
|
1059
1094
|
attempt = 0
|
|
@@ -1061,7 +1096,7 @@ local function startClientHeartbeat(attempt)
|
|
|
1061
1096
|
if clientHeartbeatStarted or PeerRole.detect() ~= "client" or not RunService:IsRunning() then
|
|
1062
1097
|
return nil
|
|
1063
1098
|
end
|
|
1064
|
-
local event =
|
|
1099
|
+
local event = waitForChannel(HEARTBEAT_NAME)
|
|
1065
1100
|
if not event or not event:IsA("RemoteEvent") then
|
|
1066
1101
|
-- An older server broker has no heartbeat channel; requests still work.
|
|
1067
1102
|
if RunService:IsRunning() and attempt < 5 then
|
|
@@ -1126,7 +1161,7 @@ local function setupClientBroker(attempt)
|
|
|
1126
1161
|
if PeerRole.detect() ~= "client" then
|
|
1127
1162
|
return nil
|
|
1128
1163
|
end
|
|
1129
|
-
local rf =
|
|
1164
|
+
local rf = waitForChannel(BROKER_NAME)
|
|
1130
1165
|
if not rf or not rf:IsA("RemoteFunction") then
|
|
1131
1166
|
if attempt == 0 then
|
|
1132
1167
|
warn(`[robloxstudio-mcp] client: {BROKER_NAME} not found; retrying`)
|
|
@@ -1869,6 +1904,7 @@ local function setupHeartbeatChannel()
|
|
|
1869
1904
|
end
|
|
1870
1905
|
local event = existing or Instance.new("RemoteEvent")
|
|
1871
1906
|
event.Name = HEARTBEAT_NAME
|
|
1907
|
+
event:SetAttribute(CHANNEL_ATTRIBUTE, HEARTBEAT_NAME)
|
|
1872
1908
|
event.OnServerEvent:Connect(function(player, payload)
|
|
1873
1909
|
local _player = player
|
|
1874
1910
|
local entry = proxyByPlayer[_player]
|
|
@@ -1930,6 +1966,7 @@ local function setupServerBroker()
|
|
|
1930
1966
|
end
|
|
1931
1967
|
rf.Name = BROKER_NAME
|
|
1932
1968
|
rf:SetAttribute(BROKER_OWNER_ATTRIBUTE, PluginSession.peerId)
|
|
1969
|
+
rf:SetAttribute(CHANNEL_ATTRIBUTE, BROKER_NAME)
|
|
1933
1970
|
rf.OnServerInvoke = function(player, payload)
|
|
1934
1971
|
local identity = parseClientIdentity(payload)
|
|
1935
1972
|
if identity == nil then
|
|
@@ -2523,9 +2560,9 @@ local function computeBridgeStamp()
|
|
|
2523
2560
|
for i = 1, #combined do
|
|
2524
2561
|
h = (h * 33 + (string.byte(combined, i))) % 2147483647
|
|
2525
2562
|
end
|
|
2526
|
-
-- "3.4.
|
|
2563
|
+
-- "3.4.3" is replaced with the package version at package time
|
|
2527
2564
|
-- (scripts/build-plugin.mjs injectVersion), so a release bump also restamps.
|
|
2528
|
-
return `{tostring(h)}-3.4.
|
|
2565
|
+
return `{tostring(h)}-3.4.3`
|
|
2529
2566
|
end
|
|
2530
2567
|
local BRIDGE_STAMP = computeBridgeStamp()
|
|
2531
2568
|
local function setSource(scriptInst, source)
|
|
@@ -4808,6 +4845,42 @@ local MOUSE_TYPE_MAP = {
|
|
|
4808
4845
|
Middle = Enum.UserInputType.MouseButton3,
|
|
4809
4846
|
}
|
|
4810
4847
|
local NO_MOUSE_ERROR = "This client has no mouse (touch device emulation is active), so cursor movement never reaches the game. " .. "Stop it with set_device_simulator stopSimulation=true, then retry."
|
|
4848
|
+
local RELEASE_RETRY_NOTE = " The release will be re-sent when the window renders again."
|
|
4849
|
+
-- Releases that may not have reached the engine (sent while the window wasn't
|
|
4850
|
+
-- rendering, or the up event threw). Re-sent on the next stale→fresh frame.
|
|
4851
|
+
-- Mouse entries keep the position the release should be sent at.
|
|
4852
|
+
local pendingKeyReleases = {}
|
|
4853
|
+
local pendingButtonReleases = {}
|
|
4854
|
+
local function flushPendingReleases()
|
|
4855
|
+
local vi = cachedVI
|
|
4856
|
+
if vi then
|
|
4857
|
+
for keyCode in pendingKeyReleases do
|
|
4858
|
+
pcall(function()
|
|
4859
|
+
return vi:SendKey(false, keyCode)
|
|
4860
|
+
end)
|
|
4861
|
+
end
|
|
4862
|
+
for inputType, pos in pendingButtonReleases do
|
|
4863
|
+
pcall(function()
|
|
4864
|
+
return vi:SendMouseButton(pos, inputType, false)
|
|
4865
|
+
end)
|
|
4866
|
+
end
|
|
4867
|
+
end
|
|
4868
|
+
table.clear(pendingKeyReleases)
|
|
4869
|
+
table.clear(pendingButtonReleases)
|
|
4870
|
+
end
|
|
4871
|
+
RenderMonitor.onRenderResumed(flushPendingReleases)
|
|
4872
|
+
local MOUSE_ACTIONS = {
|
|
4873
|
+
["click"] = true,
|
|
4874
|
+
["mouseDown"] = true,
|
|
4875
|
+
["mouseUp"] = true,
|
|
4876
|
+
["move"] = true,
|
|
4877
|
+
["scroll"] = true,
|
|
4878
|
+
}
|
|
4879
|
+
local KEY_ACTIONS = {
|
|
4880
|
+
["press"] = true,
|
|
4881
|
+
["release"] = true,
|
|
4882
|
+
["tap"] = true,
|
|
4883
|
+
}
|
|
4811
4884
|
local function simulateMouseInput(requestData)
|
|
4812
4885
|
local action = requestData.action
|
|
4813
4886
|
local x = requestData.x
|
|
@@ -4828,6 +4901,11 @@ local function simulateMouseInput(requestData)
|
|
|
4828
4901
|
error = "x and y are required",
|
|
4829
4902
|
}
|
|
4830
4903
|
end
|
|
4904
|
+
if not (MOUSE_ACTIONS[action] ~= nil) then
|
|
4905
|
+
return {
|
|
4906
|
+
error = `Unsupported action "{action}". Use click, mouseDown, mouseUp, move, or scroll.`,
|
|
4907
|
+
}
|
|
4908
|
+
end
|
|
4831
4909
|
if action == "scroll" and (not (type(wheel) == "number") or wheel == 0) then
|
|
4832
4910
|
return {
|
|
4833
4911
|
error = "wheel must be a non-zero number for scroll",
|
|
@@ -4835,8 +4913,9 @@ local function simulateMouseInput(requestData)
|
|
|
4835
4913
|
end
|
|
4836
4914
|
-- Input is silently dropped by the engine when the window isn't rendering
|
|
4837
4915
|
-- (e.g. minimized). Surface that instead of returning a false success.
|
|
4916
|
+
-- mouseUp is exempt: a held button must always be releasable.
|
|
4838
4917
|
local notRendering = RenderMonitor.notRenderingReason()
|
|
4839
|
-
if notRendering ~= nil then
|
|
4918
|
+
if notRendering ~= nil and action ~= "mouseUp" then
|
|
4840
4919
|
return {
|
|
4841
4920
|
error = notRendering,
|
|
4842
4921
|
}
|
|
@@ -4854,37 +4933,80 @@ local function simulateMouseInput(requestData)
|
|
|
4854
4933
|
end
|
|
4855
4934
|
local inputType = MOUSE_TYPE_MAP[button] or Enum.UserInputType.MouseButton1
|
|
4856
4935
|
local pos = Vector2.new(x, y)
|
|
4936
|
+
local result = {
|
|
4937
|
+
success = true,
|
|
4938
|
+
action = action,
|
|
4939
|
+
x = x,
|
|
4940
|
+
y = y,
|
|
4941
|
+
}
|
|
4942
|
+
if action == "scroll" then
|
|
4943
|
+
result.wheel = wheel
|
|
4944
|
+
elseif action ~= "move" then
|
|
4945
|
+
result.button = button
|
|
4946
|
+
end
|
|
4947
|
+
if action == "mouseUp" then
|
|
4948
|
+
local ok, err = pcall(function()
|
|
4949
|
+
return vi:SendMouseButton(pos, inputType, false)
|
|
4950
|
+
end)
|
|
4951
|
+
if notRendering ~= nil then
|
|
4952
|
+
-- The engine may drop this while not rendering; never report it as delivered.
|
|
4953
|
+
pendingButtonReleases[inputType] = pos
|
|
4954
|
+
result.deliveryConfirmed = false
|
|
4955
|
+
result.warning = if ok then notRendering .. RELEASE_RETRY_NOTE else `{notRendering} Sending the release failed: {err}.{RELEASE_RETRY_NOTE}`
|
|
4956
|
+
return result
|
|
4957
|
+
end
|
|
4958
|
+
if not ok then
|
|
4959
|
+
pendingButtonReleases[inputType] = pos
|
|
4960
|
+
return {
|
|
4961
|
+
error = `Failed to simulate mouse input: {err}. The {button} button may still be held.`,
|
|
4962
|
+
}
|
|
4963
|
+
end
|
|
4964
|
+
pendingButtonReleases[inputType] = nil
|
|
4965
|
+
return result
|
|
4966
|
+
end
|
|
4967
|
+
if action == "click" or action == "mouseDown" then
|
|
4968
|
+
local downOk, downErr = pcall(function()
|
|
4969
|
+
return vi:SendMouseButton(pos, inputType, true)
|
|
4970
|
+
end)
|
|
4971
|
+
if not downOk then
|
|
4972
|
+
return {
|
|
4973
|
+
error = `Failed to simulate mouse input: {downErr}`,
|
|
4974
|
+
}
|
|
4975
|
+
end
|
|
4976
|
+
pendingButtonReleases[inputType] = nil
|
|
4977
|
+
if action == "mouseDown" then
|
|
4978
|
+
return result
|
|
4979
|
+
end
|
|
4980
|
+
-- Down landed, so the up must run even if something fails in between.
|
|
4981
|
+
task.wait(0.05)
|
|
4982
|
+
local upOk, upErr = pcall(function()
|
|
4983
|
+
return vi:SendMouseButton(pos, inputType, false)
|
|
4984
|
+
end)
|
|
4985
|
+
if not upOk then
|
|
4986
|
+
pendingButtonReleases[inputType] = pos
|
|
4987
|
+
return {
|
|
4988
|
+
error = `Click pressed {button} but releasing it failed: {upErr}. ` .. `The {button} button may still be held; call simulate_mouse_input with action="mouseUp" to release it.`,
|
|
4989
|
+
}
|
|
4990
|
+
end
|
|
4991
|
+
local staleAfter = RenderMonitor.notRenderingReason()
|
|
4992
|
+
if staleAfter ~= nil then
|
|
4993
|
+
-- The window stopped rendering during the hold; the up may have been dropped.
|
|
4994
|
+
pendingButtonReleases[inputType] = pos
|
|
4995
|
+
result.deliveryConfirmed = false
|
|
4996
|
+
result.warning = staleAfter .. RELEASE_RETRY_NOTE
|
|
4997
|
+
end
|
|
4998
|
+
return result
|
|
4999
|
+
end
|
|
4857
5000
|
local success, err = pcall(function()
|
|
4858
|
-
if action == "
|
|
4859
|
-
vi:SendMouseButton(pos, inputType, true)
|
|
4860
|
-
task.wait(0.05)
|
|
4861
|
-
vi:SendMouseButton(pos, inputType, false)
|
|
4862
|
-
elseif action == "mouseDown" then
|
|
4863
|
-
vi:SendMouseButton(pos, inputType, true)
|
|
4864
|
-
elseif action == "mouseUp" then
|
|
4865
|
-
vi:SendMouseButton(pos, inputType, false)
|
|
4866
|
-
elseif action == "move" then
|
|
5001
|
+
if action == "move" then
|
|
4867
5002
|
vi:SendMousePosition(pos)
|
|
4868
|
-
|
|
5003
|
+
else
|
|
4869
5004
|
vi:SendPointerAction(pos, {
|
|
4870
5005
|
Wheel = wheel,
|
|
4871
5006
|
})
|
|
4872
|
-
else
|
|
4873
|
-
error(`Unsupported action "{action}". Use click, mouseDown, mouseUp, move, or scroll.`)
|
|
4874
5007
|
end
|
|
4875
5008
|
end)
|
|
4876
5009
|
if success then
|
|
4877
|
-
local result = {
|
|
4878
|
-
success = true,
|
|
4879
|
-
action = action,
|
|
4880
|
-
x = x,
|
|
4881
|
-
y = y,
|
|
4882
|
-
}
|
|
4883
|
-
if action == "scroll" then
|
|
4884
|
-
result.wheel = wheel
|
|
4885
|
-
elseif action ~= "move" then
|
|
4886
|
-
result.button = button
|
|
4887
|
-
end
|
|
4888
5010
|
return result
|
|
4889
5011
|
end
|
|
4890
5012
|
return {
|
|
@@ -4892,8 +5014,45 @@ local function simulateMouseInput(requestData)
|
|
|
4892
5014
|
}
|
|
4893
5015
|
end
|
|
4894
5016
|
local function simulateKeyboardInput(requestData)
|
|
5017
|
+
local text = requestData.text
|
|
5018
|
+
local keyCodeName = requestData.keyCode
|
|
5019
|
+
local _condition = (requestData.action)
|
|
5020
|
+
if _condition == nil then
|
|
5021
|
+
_condition = "tap"
|
|
5022
|
+
end
|
|
5023
|
+
local action = _condition
|
|
5024
|
+
local _condition_1 = (requestData.duration)
|
|
5025
|
+
if _condition_1 == nil then
|
|
5026
|
+
_condition_1 = 0.1
|
|
5027
|
+
end
|
|
5028
|
+
local duration = _condition_1
|
|
5029
|
+
-- Validate before the render gate so bad arguments report themselves.
|
|
5030
|
+
local keyCode
|
|
5031
|
+
if text == nil then
|
|
5032
|
+
if not (keyCodeName ~= "" and keyCodeName) then
|
|
5033
|
+
return {
|
|
5034
|
+
error = "keyCode (or text) is required",
|
|
5035
|
+
}
|
|
5036
|
+
end
|
|
5037
|
+
local enumOk, found = pcall(function()
|
|
5038
|
+
return (Enum.KeyCode)[keyCodeName]
|
|
5039
|
+
end)
|
|
5040
|
+
if not enumOk or not found then
|
|
5041
|
+
return {
|
|
5042
|
+
error = `Unknown keyCode: {keyCodeName}. Use Enum.KeyCode names like "W", "Space", "E", "LeftShift", etc.`,
|
|
5043
|
+
}
|
|
5044
|
+
end
|
|
5045
|
+
keyCode = found
|
|
5046
|
+
if not (KEY_ACTIONS[action] ~= nil) then
|
|
5047
|
+
return {
|
|
5048
|
+
error = `Unknown action: {action}. Use press, release, or tap.`,
|
|
5049
|
+
}
|
|
5050
|
+
end
|
|
5051
|
+
end
|
|
5052
|
+
-- release is exempt: a held key must always be releasable.
|
|
4895
5053
|
local notRendering = RenderMonitor.notRenderingReason()
|
|
4896
|
-
|
|
5054
|
+
local isRelease = text == nil and action == "release"
|
|
5055
|
+
if notRendering ~= nil and not isRelease then
|
|
4897
5056
|
return {
|
|
4898
5057
|
error = notRendering,
|
|
4899
5058
|
}
|
|
@@ -4905,7 +5064,6 @@ local function simulateKeyboardInput(requestData)
|
|
|
4905
5064
|
}
|
|
4906
5065
|
end
|
|
4907
5066
|
-- Text mode: type a string into the focused TextBox.
|
|
4908
|
-
local text = requestData.text
|
|
4909
5067
|
if text ~= nil then
|
|
4910
5068
|
local ok, err = pcall(function()
|
|
4911
5069
|
return vi:SendTextInput(text)
|
|
@@ -4920,53 +5078,63 @@ local function simulateKeyboardInput(requestData)
|
|
|
4920
5078
|
error = `Failed to send text input: {err}`,
|
|
4921
5079
|
}
|
|
4922
5080
|
end
|
|
4923
|
-
local
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
5081
|
+
local key = keyCode
|
|
5082
|
+
local result = {
|
|
5083
|
+
success = true,
|
|
5084
|
+
keyCode = keyCodeName,
|
|
5085
|
+
action = action,
|
|
5086
|
+
}
|
|
5087
|
+
if action == "release" then
|
|
5088
|
+
local ok, err = pcall(function()
|
|
5089
|
+
return vi:SendKey(false, key)
|
|
5090
|
+
end)
|
|
5091
|
+
if notRendering ~= nil then
|
|
5092
|
+
-- The engine may drop this while not rendering; never report it as delivered.
|
|
5093
|
+
pendingKeyReleases[key] = true
|
|
5094
|
+
result.deliveryConfirmed = false
|
|
5095
|
+
result.warning = if ok then notRendering .. RELEASE_RETRY_NOTE else `{notRendering} Sending the release failed: {err}.{RELEASE_RETRY_NOTE}`
|
|
5096
|
+
return result
|
|
5097
|
+
end
|
|
5098
|
+
if not ok then
|
|
5099
|
+
pendingKeyReleases[key] = true
|
|
5100
|
+
return {
|
|
5101
|
+
error = `Failed to simulate keyboard input: {err}. Key {keyCodeName} may still be held.`,
|
|
5102
|
+
}
|
|
5103
|
+
end
|
|
5104
|
+
pendingKeyReleases[key] = nil
|
|
5105
|
+
return result
|
|
4937
5106
|
end
|
|
4938
|
-
local
|
|
4939
|
-
|
|
4940
|
-
return (Enum.KeyCode)[keyCodeName]
|
|
5107
|
+
local downOk, downErr = pcall(function()
|
|
5108
|
+
return vi:SendKey(true, key)
|
|
4941
5109
|
end)
|
|
4942
|
-
if not
|
|
5110
|
+
if not downOk then
|
|
4943
5111
|
return {
|
|
4944
|
-
error = `
|
|
5112
|
+
error = `Failed to simulate keyboard input: {downErr}`,
|
|
4945
5113
|
}
|
|
4946
5114
|
end
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
vi:SendKey(false, keyCode)
|
|
4956
|
-
else
|
|
4957
|
-
error(`Unknown action: {action}`)
|
|
4958
|
-
end
|
|
5115
|
+
pendingKeyReleases[key] = nil
|
|
5116
|
+
if action == "press" then
|
|
5117
|
+
return result
|
|
5118
|
+
end
|
|
5119
|
+
-- tap: the down landed, so the up must run even if something fails in between.
|
|
5120
|
+
task.wait(duration)
|
|
5121
|
+
local upOk, upErr = pcall(function()
|
|
5122
|
+
return vi:SendKey(false, key)
|
|
4959
5123
|
end)
|
|
4960
|
-
if
|
|
5124
|
+
if not upOk then
|
|
5125
|
+
pendingKeyReleases[key] = true
|
|
4961
5126
|
return {
|
|
4962
|
-
|
|
4963
|
-
keyCode = keyCodeName,
|
|
4964
|
-
action = action,
|
|
5127
|
+
error = `Tap pressed {keyCodeName} but releasing it failed: {upErr}. ` .. `Key {keyCodeName} may still be held; call simulate_keyboard_input with action="release" to release it.`,
|
|
4965
5128
|
}
|
|
4966
5129
|
end
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
5130
|
+
local staleAfter = RenderMonitor.notRenderingReason()
|
|
5131
|
+
if staleAfter ~= nil then
|
|
5132
|
+
-- The window stopped rendering during the hold; the up may have been dropped.
|
|
5133
|
+
pendingKeyReleases[key] = true
|
|
5134
|
+
result.deliveryConfirmed = false
|
|
5135
|
+
result.warning = staleAfter .. RELEASE_RETRY_NOTE
|
|
5136
|
+
end
|
|
5137
|
+
return result
|
|
4970
5138
|
end
|
|
4971
5139
|
return {
|
|
4972
5140
|
simulateMouseInput = simulateMouseInput,
|
|
@@ -11506,6 +11674,14 @@ local connected = false
|
|
|
11506
11674
|
-- gap only happens when minimized/suspended, so 1s cleanly avoids false
|
|
11507
11675
|
-- positives from ordinary frame hitches while still catching the real case.
|
|
11508
11676
|
local STALE_THRESHOLD = 1.0
|
|
11677
|
+
-- Run on the first rendered frame after a stale gap. Input sent while the
|
|
11678
|
+
-- window wasn't rendering may never have reached the engine, so callers use
|
|
11679
|
+
-- this to re-send cleanup (e.g. key releases) once it can land.
|
|
11680
|
+
local resumeCallbacks = {}
|
|
11681
|
+
local function onRenderResumed(callback)
|
|
11682
|
+
local _callback = callback
|
|
11683
|
+
table.insert(resumeCallbacks, _callback)
|
|
11684
|
+
end
|
|
11509
11685
|
local function start()
|
|
11510
11686
|
if connected then
|
|
11511
11687
|
return nil
|
|
@@ -11515,7 +11691,15 @@ local function start()
|
|
|
11515
11691
|
-- (connected stays false → notRenderingReason() returns undefined there).
|
|
11516
11692
|
local ok = pcall(function()
|
|
11517
11693
|
RunService.RenderStepped:Connect(function()
|
|
11518
|
-
|
|
11694
|
+
local now = tick()
|
|
11695
|
+
-- One compare per frame; callbacks only fire on the stale→fresh edge.
|
|
11696
|
+
local resumed = now - lastFrame > STALE_THRESHOLD
|
|
11697
|
+
lastFrame = now
|
|
11698
|
+
if resumed then
|
|
11699
|
+
for _, callback in resumeCallbacks do
|
|
11700
|
+
task.spawn(callback)
|
|
11701
|
+
end
|
|
11702
|
+
end
|
|
11519
11703
|
end)
|
|
11520
11704
|
end)
|
|
11521
11705
|
if ok then
|
|
@@ -11544,6 +11728,7 @@ local function notRenderingReason()
|
|
|
11544
11728
|
return nil
|
|
11545
11729
|
end
|
|
11546
11730
|
return {
|
|
11731
|
+
onRenderResumed = onRenderResumed,
|
|
11547
11732
|
start = start,
|
|
11548
11733
|
secondsSinceFrame = secondsSinceFrame,
|
|
11549
11734
|
notRenderingReason = notRenderingReason,
|
|
@@ -13287,7 +13472,7 @@ return {
|
|
|
13287
13472
|
<Properties>
|
|
13288
13473
|
<string name="Name">State</string>
|
|
13289
13474
|
<string name="Source"><![CDATA[-- Compiled with roblox-ts v3.0.0
|
|
13290
|
-
local CURRENT_VERSION = "3.4.
|
|
13475
|
+
local CURRENT_VERSION = "3.4.3"
|
|
13291
13476
|
local PLUGIN_VARIANT = "inspector"
|
|
13292
13477
|
local BASE_PORT = 58741
|
|
13293
13478
|
local SENSITIVE_DIAGNOSTIC_TERMS = { "token", "authorization", "bearer", "password", "cookie", "secret" }
|