unity-mcp-cli 0.70.0 → 0.72.0
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/CHANGELOG.md +31 -0
- package/README.md +14 -1
- package/dist/commands/open.d.ts +13 -0
- package/dist/commands/open.js +55 -0
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/run-system-tool.d.ts +1 -2
- package/dist/commands/run-system-tool.js +11 -130
- package/dist/commands/run-system-tool.js.map +1 -1
- package/dist/commands/run-tool-builder.d.ts +25 -0
- package/dist/commands/run-tool-builder.js +125 -0
- package/dist/commands/run-tool-builder.js.map +1 -0
- package/dist/commands/run-tool.d.ts +1 -2
- package/dist/commands/run-tool.js +11 -130
- package/dist/commands/run-tool.js.map +1 -1
- package/dist/lib/open.d.ts +48 -1
- package/dist/lib/open.js +158 -0
- package/dist/lib/open.js.map +1 -1
- package/dist/lib/run-tool.d.ts +15 -0
- package/dist/lib/run-tool.js +228 -0
- package/dist/lib/run-tool.js.map +1 -0
- package/dist/lib/types.d.ts +158 -2
- package/dist/lib.d.ts +2 -1
- package/dist/lib.js +1 -0
- package/dist/lib.js.map +1 -1
- package/dist/utils/launch-error-dismiss.d.ts +159 -0
- package/dist/utils/launch-error-dismiss.js +440 -0
- package/dist/utils/launch-error-dismiss.js.map +1 -0
- package/dist/utils/unity-editor.js +33 -6
- package/dist/utils/unity-editor.js.map +1 -1
- package/dist/utils/unity-hub.js +20 -4
- package/dist/utils/unity-hub.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,132 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
.option('--token <token>', 'Bearer token override (bypasses config)')
|
|
13
|
-
.option('--input <json>', 'JSON string of tool arguments')
|
|
14
|
-
.option('--input-file <file>', 'Read JSON arguments from file')
|
|
15
|
-
.option('--raw', 'Output raw JSON (no formatting)')
|
|
16
|
-
.option('--timeout <ms>', 'Request timeout in milliseconds (default: 60000)', '60000')
|
|
17
|
-
.action(async (toolName, positionalPath, options) => {
|
|
18
|
-
const projectPath = resolveAndValidateProjectPath(positionalPath, options);
|
|
19
|
-
const { url: baseUrl, token } = resolveConnection(projectPath, options);
|
|
20
|
-
const body = parseInput(options);
|
|
21
|
-
const endpoint = `${baseUrl}/api/tools/${encodeURIComponent(toolName)}`;
|
|
22
|
-
verbose(`Tool: ${toolName}`);
|
|
23
|
-
verbose(`Endpoint: ${endpoint}`);
|
|
24
|
-
verbose(`Body: ${body}`);
|
|
25
|
-
const headers = {
|
|
26
|
-
'Content-Type': 'application/json',
|
|
27
|
-
};
|
|
28
|
-
if (token) {
|
|
29
|
-
headers['Authorization'] = `Bearer ${token}`;
|
|
30
|
-
verbose(`Authorization header set (source: ${options.token ? '--token flag' : 'config'})`);
|
|
31
|
-
}
|
|
32
|
-
const authSource = options.token ? '--token flag' : 'config';
|
|
33
|
-
if (!options.raw) {
|
|
34
|
-
ui.heading('Run Tool');
|
|
35
|
-
ui.label('Tool', toolName);
|
|
36
|
-
ui.label('URL', endpoint);
|
|
37
|
-
if (token) {
|
|
38
|
-
ui.label('Auth', `from ${authSource}`);
|
|
39
|
-
}
|
|
40
|
-
ui.divider();
|
|
41
|
-
}
|
|
42
|
-
const spinner = options.raw ? null : ui.startSpinner(`Calling ${toolName}...`);
|
|
43
|
-
const timeoutMs = parseInt(options.timeout ?? '60000', 10);
|
|
44
|
-
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
|
|
45
|
-
ui.error(`Invalid --timeout value: "${options.timeout}". Must be a positive integer (milliseconds).`);
|
|
46
|
-
process.exit(1);
|
|
47
|
-
}
|
|
48
|
-
const controller = new AbortController();
|
|
49
|
-
const fetchTimeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
50
|
-
try {
|
|
51
|
-
const response = await fetch(endpoint, {
|
|
52
|
-
method: 'POST',
|
|
53
|
-
headers,
|
|
54
|
-
body,
|
|
55
|
-
signal: controller.signal,
|
|
56
|
-
});
|
|
57
|
-
const responseText = await response.text();
|
|
58
|
-
let responseData;
|
|
59
|
-
try {
|
|
60
|
-
responseData = JSON.parse(responseText);
|
|
61
|
-
}
|
|
62
|
-
catch {
|
|
63
|
-
responseData = responseText;
|
|
64
|
-
}
|
|
65
|
-
if (!response.ok) {
|
|
66
|
-
spinner?.stop();
|
|
67
|
-
if (options.raw) {
|
|
68
|
-
process.stdout.write(responseText);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
ui.error(`HTTP ${response.status}: ${response.statusText}`);
|
|
72
|
-
if (responseData) {
|
|
73
|
-
ui.info(typeof responseData === 'string'
|
|
74
|
-
? responseData
|
|
75
|
-
: JSON.stringify(responseData, null, 2));
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
process.exit(1);
|
|
79
|
-
}
|
|
80
|
-
spinner?.success(`${toolName} completed`);
|
|
81
|
-
if (options.raw) {
|
|
82
|
-
process.stdout.write(responseText);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
ui.success('Response:');
|
|
86
|
-
console.log(typeof responseData === 'string'
|
|
87
|
-
? responseData
|
|
88
|
-
: JSON.stringify(responseData, null, 2));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
spinner?.stop();
|
|
93
|
-
const isTimeout = err instanceof Error && err.name === 'AbortError';
|
|
94
|
-
const cause = err instanceof Error && 'cause' in err ? err.cause : null;
|
|
95
|
-
const causeCode = cause?.code ?? '';
|
|
96
|
-
const rootMessage = cause?.message || causeCode || (err instanceof Error ? err.message : String(err));
|
|
97
|
-
const errorSignature = `${rootMessage} ${causeCode}`;
|
|
98
|
-
const isConnectionRefused = errorSignature.includes('ECONNREFUSED');
|
|
99
|
-
const isConnectionReset = errorSignature.includes('ECONNRESET');
|
|
100
|
-
const isNetworkError = errorSignature.includes('EAI_AGAIN') || errorSignature.includes('ENOTFOUND');
|
|
101
|
-
let displayMessage;
|
|
102
|
-
if (isTimeout) {
|
|
103
|
-
displayMessage = `Tool call timed out after ${timeoutMs / 1000} seconds: ${toolName}`;
|
|
104
|
-
}
|
|
105
|
-
else if (isConnectionRefused) {
|
|
106
|
-
displayMessage = `Connection refused at ${endpoint}. Is the MCP server running? Start Unity Editor with the MCP plugin first.`;
|
|
107
|
-
}
|
|
108
|
-
else if (isConnectionReset) {
|
|
109
|
-
displayMessage = `Connection was reset by the server at ${endpoint}. The server may have crashed or restarted.`;
|
|
110
|
-
}
|
|
111
|
-
else if (isNetworkError) {
|
|
112
|
-
displayMessage = `Cannot reach ${endpoint}. Check your network connection and server URL.`;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
displayMessage = `${rootMessage}`;
|
|
116
|
-
if (cause && cause.message !== rootMessage) {
|
|
117
|
-
displayMessage += ` (${cause.message})`;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (options.raw) {
|
|
121
|
-
process.stderr.write(displayMessage + '\n');
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
ui.error(`Failed to call tool: ${displayMessage}`);
|
|
125
|
-
}
|
|
126
|
-
process.exit(1);
|
|
127
|
-
}
|
|
128
|
-
finally {
|
|
129
|
-
clearTimeout(fetchTimeout);
|
|
130
|
-
}
|
|
1
|
+
import { runTool } from '../lib/run-tool.js';
|
|
2
|
+
import { buildRunToolCommand } from './run-tool-builder.js';
|
|
3
|
+
export const runToolCommand = buildRunToolCommand({
|
|
4
|
+
name: 'run-tool',
|
|
5
|
+
description: 'Execute an MCP tool via the HTTP API',
|
|
6
|
+
argDescription: 'Name of the MCP tool to execute',
|
|
7
|
+
routePrefix: '/api/tools',
|
|
8
|
+
verboseLabel: 'Tool',
|
|
9
|
+
headingLabel: 'Run Tool',
|
|
10
|
+
errorNoun: 'tool',
|
|
11
|
+
invoke: runTool,
|
|
131
12
|
});
|
|
132
13
|
//# sourceMappingURL=run-tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-tool.js","sourceRoot":"","sources":["../../src/commands/run-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"run-tool.js","sourceRoot":"","sources":["../../src/commands/run-tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,CAAC,MAAM,cAAc,GAAG,mBAAmB,CAAC;IAChD,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,sCAAsC;IACnD,cAAc,EAAE,iCAAiC;IACjD,WAAW,EAAE,YAAY;IACzB,YAAY,EAAE,MAAM;IACpB,YAAY,EAAE,UAAU;IACxB,SAAS,EAAE,MAAM;IACjB,MAAM,EAAE,OAAO;CAChB,CAAC,CAAC"}
|
package/dist/lib/open.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { tryDismissLaunchErrorsDialog, type DismissPlatform } from '../utils/launch-error-dismiss.js';
|
|
2
|
+
import type { OpenEnvInputs, OpenProjectOptions, OpenProjectResult, ProgressCallback } from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Resolve the project path from an explicit option or fall back to
|
|
4
5
|
* the supplied cwd. Always returns an absolute, resolved path plus a
|
|
@@ -48,3 +49,49 @@ export declare function buildOpenEnv(options: OpenEnvInputs): Record<string, str
|
|
|
48
49
|
* to access `errorMessage` / `error`.
|
|
49
50
|
*/
|
|
50
51
|
export declare function openProject(options: OpenProjectOptions): Promise<OpenProjectResult>;
|
|
52
|
+
/**
|
|
53
|
+
* Options for `pollAndDismissLaunchErrors`. The `_` prefix marks the
|
|
54
|
+
* test-only export; production code never imports this directly —
|
|
55
|
+
* `openProject` is the only caller.
|
|
56
|
+
*/
|
|
57
|
+
export interface _PollAndDismissOptionsForTests {
|
|
58
|
+
timeoutMs: number;
|
|
59
|
+
intervalMs: number;
|
|
60
|
+
onProgress: ProgressCallback | undefined;
|
|
61
|
+
warnings: string[];
|
|
62
|
+
platform?: DismissPlatform;
|
|
63
|
+
probe?: typeof tryDismissLaunchErrorsDialog;
|
|
64
|
+
abortSignal?: AbortSignal;
|
|
65
|
+
/**
|
|
66
|
+
* Grace window (ms) after polling starts: if no dialog has been
|
|
67
|
+
* observed within this window, exit early. Test override only —
|
|
68
|
+
* production callers do not configure this.
|
|
69
|
+
*
|
|
70
|
+
* @see PollAndDismissOptions.noDialogGraceMs for the production
|
|
71
|
+
* default and rationale.
|
|
72
|
+
*/
|
|
73
|
+
noDialogGraceMs?: number;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Poll the OS desktop for the Unity "compile errors at launch"
|
|
77
|
+
* dialog and click `Ignore` (or the platform-equivalent) every time
|
|
78
|
+
* the probe reports it as found. Returns once the abort signal has
|
|
79
|
+
* fired, the no-dialog grace window has elapsed, the overall timeout
|
|
80
|
+
* has elapsed, or a permanent platform error has been observed.
|
|
81
|
+
*
|
|
82
|
+
* Re-entrant dismissals are supported: when the dialog re-appears
|
|
83
|
+
* after a successful click (the resolver-fix → dialog-reappears
|
|
84
|
+
* cycle described in the issue), each subsequent dismissal emits its
|
|
85
|
+
* own `launch-errors-dismissed` progress event so the user sees the
|
|
86
|
+
* recurrence in the log.
|
|
87
|
+
*
|
|
88
|
+
* Library-safe: never throws. Transient platform errors (e.g. a
|
|
89
|
+
* missing `xdotool` on Linux, or a momentary syscall failure on
|
|
90
|
+
* Windows) are recorded once as a warning on the supplied
|
|
91
|
+
* `warnings` array; subsequent identical errors are silently
|
|
92
|
+
* suppressed so the warnings array does not balloon over the polling
|
|
93
|
+
* window. Permanent errors (e.g. xdotool truly absent) bail out of
|
|
94
|
+
* the loop after the first occurrence so the helper does not spawn
|
|
95
|
+
* 60 doomed tool invocations on a 30s budget.
|
|
96
|
+
*/
|
|
97
|
+
export declare function _pollAndDismissLaunchErrorsForTests(opts: _PollAndDismissOptionsForTests): Promise<void>;
|
package/dist/lib/open.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import * as path from 'path';
|
|
3
|
+
import { platform as nodePlatform } from 'os';
|
|
3
4
|
import { findEditorPath, getProjectEditorVersion, launchEditor, } from '../utils/unity-editor.js';
|
|
4
5
|
import { findUnityProcess } from '../utils/unity-process.js';
|
|
5
6
|
import { readConfig, isCloudMode, writeConfig } from '../utils/config.js';
|
|
7
|
+
import { tryDismissLaunchErrorsDialog, LINUX_XDOTOOL_MISSING_PREFIX, UNSUPPORTED_PLATFORM_PREFIX, } from '../utils/launch-error-dismiss.js';
|
|
6
8
|
import { emitProgress } from './progress.js';
|
|
7
9
|
/**
|
|
8
10
|
* Resolve the project path from an explicit option or fall back to
|
|
@@ -247,6 +249,26 @@ export async function openProject(options) {
|
|
|
247
249
|
// child is already detached + unref'd, so this does NOT block
|
|
248
250
|
// process exit.
|
|
249
251
|
const pid = await waitForSpawn(child);
|
|
252
|
+
// Auto-dismiss the Unity "compile errors at launch" dialog if it
|
|
253
|
+
// appears. The polling loop runs synchronously inside this call
|
|
254
|
+
// (so the CLI's event loop stays alive until it completes) but
|
|
255
|
+
// never throws — a transient platform error is logged via the
|
|
256
|
+
// progress callback as a warning and the loop continues until
|
|
257
|
+
// either the dialog is dismissed and stays dismissed, the abort
|
|
258
|
+
// signal fires, the no-dialog grace window elapses, or the
|
|
259
|
+
// overall timeout elapses.
|
|
260
|
+
//
|
|
261
|
+
// When `autoDismissLaunchErrors === false` the loop is skipped
|
|
262
|
+
// entirely; behaviour is identical to the pre-feature baseline.
|
|
263
|
+
if (options.autoDismissLaunchErrors !== false) {
|
|
264
|
+
await pollAndDismissLaunchErrors({
|
|
265
|
+
timeoutMs: options.launchDismissTimeoutMs ?? 30000,
|
|
266
|
+
intervalMs: options.launchDismissPollIntervalMs ?? 1500,
|
|
267
|
+
onProgress: options.onProgress,
|
|
268
|
+
warnings,
|
|
269
|
+
abortSignal: options.launchDismissAbortSignal,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
250
272
|
emitProgress(options.onProgress, {
|
|
251
273
|
phase: 'done',
|
|
252
274
|
message: 'Editor launched.',
|
|
@@ -275,6 +297,142 @@ export async function openProject(options) {
|
|
|
275
297
|
};
|
|
276
298
|
}
|
|
277
299
|
}
|
|
300
|
+
/**
|
|
301
|
+
* Poll the OS desktop for the Unity "compile errors at launch"
|
|
302
|
+
* dialog and click `Ignore` (or the platform-equivalent) every time
|
|
303
|
+
* the probe reports it as found. Returns once the abort signal has
|
|
304
|
+
* fired, the no-dialog grace window has elapsed, the overall timeout
|
|
305
|
+
* has elapsed, or a permanent platform error has been observed.
|
|
306
|
+
*
|
|
307
|
+
* Re-entrant dismissals are supported: when the dialog re-appears
|
|
308
|
+
* after a successful click (the resolver-fix → dialog-reappears
|
|
309
|
+
* cycle described in the issue), each subsequent dismissal emits its
|
|
310
|
+
* own `launch-errors-dismissed` progress event so the user sees the
|
|
311
|
+
* recurrence in the log.
|
|
312
|
+
*
|
|
313
|
+
* Library-safe: never throws. Transient platform errors (e.g. a
|
|
314
|
+
* missing `xdotool` on Linux, or a momentary syscall failure on
|
|
315
|
+
* Windows) are recorded once as a warning on the supplied
|
|
316
|
+
* `warnings` array; subsequent identical errors are silently
|
|
317
|
+
* suppressed so the warnings array does not balloon over the polling
|
|
318
|
+
* window. Permanent errors (e.g. xdotool truly absent) bail out of
|
|
319
|
+
* the loop after the first occurrence so the helper does not spawn
|
|
320
|
+
* 60 doomed tool invocations on a 30s budget.
|
|
321
|
+
*/
|
|
322
|
+
export async function _pollAndDismissLaunchErrorsForTests(opts) {
|
|
323
|
+
return pollAndDismissLaunchErrors(opts);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Substring markers that identify a `kind: 'error'` outcome as
|
|
327
|
+
* permanent for this run. When seen, the polling loop bails out
|
|
328
|
+
* after recording the warning once; ticking again would just respawn
|
|
329
|
+
* the same doomed tool. Keep this list narrow — only conditions that
|
|
330
|
+
* cannot self-heal mid-launch belong here.
|
|
331
|
+
*
|
|
332
|
+
* The entries reference the producer-side constants in
|
|
333
|
+
* `launch-error-dismiss.ts` so a re-word at the producer site stays
|
|
334
|
+
* in sync with the bailout matcher (and the test in
|
|
335
|
+
* `launch-error-dismiss.test.ts` locks the constants down).
|
|
336
|
+
*/
|
|
337
|
+
const PERMANENT_DISMISS_ERROR_MARKERS = [
|
|
338
|
+
LINUX_XDOTOOL_MISSING_PREFIX,
|
|
339
|
+
UNSUPPORTED_PLATFORM_PREFIX,
|
|
340
|
+
];
|
|
341
|
+
function isPermanentDismissError(message) {
|
|
342
|
+
return PERMANENT_DISMISS_ERROR_MARKERS.some((m) => message.includes(m));
|
|
343
|
+
}
|
|
344
|
+
async function pollAndDismissLaunchErrors(opts) {
|
|
345
|
+
const platform = (opts.platform ?? nodePlatform());
|
|
346
|
+
const probe = opts.probe ?? tryDismissLaunchErrorsDialog;
|
|
347
|
+
const start = Date.now();
|
|
348
|
+
const deadline = start + Math.max(0, opts.timeoutMs);
|
|
349
|
+
const interval = Math.max(50, opts.intervalMs);
|
|
350
|
+
const graceMs = Math.max(0, opts.noDialogGraceMs ?? 15000);
|
|
351
|
+
const seenErrorMessages = new Set();
|
|
352
|
+
let dismissedAtLeastOnce = false;
|
|
353
|
+
let aborted = opts.abortSignal?.aborted ?? false;
|
|
354
|
+
const onAbort = () => { aborted = true; };
|
|
355
|
+
opts.abortSignal?.addEventListener('abort', onAbort, { once: true });
|
|
356
|
+
try {
|
|
357
|
+
while (Date.now() < deadline && !aborted) {
|
|
358
|
+
const outcome = await probe(platform);
|
|
359
|
+
// Re-check the exit conditions BEFORE applying the outcome:
|
|
360
|
+
// if abort fired (or the deadline lapsed) while `probe` was
|
|
361
|
+
// in flight, the in-flight result is stale and applying it
|
|
362
|
+
// would emit a misleading progress event or warning.
|
|
363
|
+
if (aborted || Date.now() >= deadline)
|
|
364
|
+
break;
|
|
365
|
+
if (outcome.kind === 'dismissed') {
|
|
366
|
+
dismissedAtLeastOnce = true;
|
|
367
|
+
emitProgress(opts.onProgress, {
|
|
368
|
+
phase: 'launch-errors-dismissed',
|
|
369
|
+
message: `[open] dismissed Unity launch-errors dialog (button=${outcome.button}, platform=${platform})`,
|
|
370
|
+
button: outcome.button,
|
|
371
|
+
platform,
|
|
372
|
+
});
|
|
373
|
+
// Keep polling — the dialog may re-appear after the resolver
|
|
374
|
+
// fixes one error and surfaces the next.
|
|
375
|
+
}
|
|
376
|
+
else if (outcome.kind === 'error') {
|
|
377
|
+
if (!seenErrorMessages.has(outcome.message)) {
|
|
378
|
+
seenErrorMessages.add(outcome.message);
|
|
379
|
+
opts.warnings.push(`launch-errors auto-dismiss: ${outcome.message}`);
|
|
380
|
+
}
|
|
381
|
+
if (isPermanentDismissError(outcome.message)) {
|
|
382
|
+
// No point ticking another 59 times — bail out.
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
else if (
|
|
387
|
+
// outcome.kind === 'not-found'
|
|
388
|
+
!dismissedAtLeastOnce &&
|
|
389
|
+
opts.abortSignal === undefined &&
|
|
390
|
+
Date.now() - start >= graceMs) {
|
|
391
|
+
// No dialog within the grace window AND no caller-supplied
|
|
392
|
+
// abort signal to wait on. Exit early — the README's "no
|
|
393
|
+
// extra delay" claim depends on this.
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const remaining = deadline - Date.now();
|
|
397
|
+
if (remaining <= 0 || aborted)
|
|
398
|
+
break;
|
|
399
|
+
await sleep(Math.min(interval, remaining), opts.abortSignal);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
finally {
|
|
403
|
+
opts.abortSignal?.removeEventListener('abort', onAbort);
|
|
404
|
+
}
|
|
405
|
+
// Surface a timeout warning ONLY when the deadline was actually
|
|
406
|
+
// reached (not the abort path) AND a platform error was observed.
|
|
407
|
+
// The grace-window exit returns silently above; the abort path is
|
|
408
|
+
// a caller-driven cancellation, not a timeout.
|
|
409
|
+
if (Date.now() >= deadline &&
|
|
410
|
+
!aborted &&
|
|
411
|
+
seenErrorMessages.size > 0 &&
|
|
412
|
+
!dismissedAtLeastOnce) {
|
|
413
|
+
opts.warnings.push(`launch-errors auto-dismiss timed out after ${opts.timeoutMs}ms — continuing with wait-for-ready`);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
function sleep(ms, signal) {
|
|
417
|
+
return new Promise((resolve) => {
|
|
418
|
+
if (signal?.aborted) {
|
|
419
|
+
resolve();
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
const t = setTimeout(() => {
|
|
423
|
+
signal?.removeEventListener('abort', onAbort);
|
|
424
|
+
resolve();
|
|
425
|
+
}, ms);
|
|
426
|
+
const onAbort = () => {
|
|
427
|
+
clearTimeout(t);
|
|
428
|
+
resolve();
|
|
429
|
+
};
|
|
430
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
431
|
+
// Do NOT unref() — the polling timer is the reason `openProject`
|
|
432
|
+
// is awaiting in the first place, and unref'ing would let Node
|
|
433
|
+
// exit before the loop completes.
|
|
434
|
+
});
|
|
435
|
+
}
|
|
278
436
|
/**
|
|
279
437
|
* Resolve to the spawned PID once the child process emits its
|
|
280
438
|
* `spawn` event, or to `undefined` if a short timeout elapses or
|
package/dist/lib/open.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open.js","sourceRoot":"","sources":["../../src/lib/open.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAA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AAK,EAAE,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RunToolOptions, RunToolResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Invoke a regular MCP tool over the Unity plugin's HTTP API.
|
|
4
|
+
*
|
|
5
|
+
* URL/token resolution priority: explicit override → project config →
|
|
6
|
+
* deterministic localhost port. POSTs to `/api/tools/{name}`. No
|
|
7
|
+
* console output, no `process.exit`; errors are returned in the
|
|
8
|
+
* `kind: 'failure'` variant.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runTool(opts: RunToolOptions): Promise<RunToolResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Invoke a system tool (internal tool not exposed to MCP clients) over
|
|
13
|
+
* the Unity plugin's HTTP API. POSTs to `/api/system-tools/{name}`.
|
|
14
|
+
*/
|
|
15
|
+
export declare function runSystemTool(opts: RunToolOptions): Promise<RunToolResult>;
|