unity-open-mcp 0.8.4 → 1.0.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/dist/asmdef-discovery.d.ts +35 -0
- package/dist/asmdef-discovery.js +171 -0
- package/dist/asmdef-discovery.js.map +1 -0
- package/dist/batch-spawn.d.ts +1 -0
- package/dist/batch-spawn.js +118 -2
- package/dist/batch-spawn.js.map +1 -1
- package/dist/capabilities/intent-groups.js +42 -0
- package/dist/capabilities/intent-groups.js.map +1 -1
- package/dist/capabilities/lifecycle.js +12 -0
- package/dist/capabilities/lifecycle.js.map +1 -1
- package/dist/capabilities/rule-catalog.js +7 -1
- package/dist/capabilities/rule-catalog.js.map +1 -1
- package/dist/capabilities/tool-groups.js +39 -2
- package/dist/capabilities/tool-groups.js.map +1 -1
- package/dist/constants.d.ts +21 -1
- package/dist/constants.js +21 -1
- package/dist/constants.js.map +1 -1
- package/dist/event-stream.d.ts +13 -3
- package/dist/event-stream.js +77 -12
- package/dist/event-stream.js.map +1 -1
- package/dist/live-client.d.ts +17 -0
- package/dist/live-client.js +130 -9
- package/dist/live-client.js.map +1 -1
- package/dist/offline/api.js +82 -30
- package/dist/offline/api.js.map +1 -1
- package/dist/offline/index-builders.d.ts +9 -0
- package/dist/offline/index-builders.js +58 -8
- package/dist/offline/index-builders.js.map +1 -1
- package/dist/offline/parse.js +5 -1
- package/dist/offline/parse.js.map +1 -1
- package/dist/process-diagnostics.d.ts +100 -19
- package/dist/process-diagnostics.js +167 -59
- package/dist/process-diagnostics.js.map +1 -1
- package/dist/project-settings.d.ts +36 -0
- package/dist/project-settings.js +96 -0
- package/dist/project-settings.js.map +1 -0
- package/dist/running-unity.d.ts +23 -0
- package/dist/running-unity.js +60 -0
- package/dist/running-unity.js.map +1 -1
- package/dist/stale-assembly-cache.d.ts +40 -0
- package/dist/stale-assembly-cache.js +76 -0
- package/dist/stale-assembly-cache.js.map +1 -0
- package/dist/tool-router.d.ts +40 -1
- package/dist/tool-router.js +479 -68
- package/dist/tool-router.js.map +1 -1
- package/dist/tool-session-state.d.ts +12 -6
- package/dist/tool-session-state.js +16 -9
- package/dist/tool-session-state.js.map +1 -1
- package/dist/tools/capture-inline.js +4 -3
- package/dist/tools/capture-inline.js.map +1 -1
- package/dist/tools/component-get.js +9 -0
- package/dist/tools/component-get.js.map +1 -1
- package/dist/tools/editor-status.js +12 -3
- package/dist/tools/editor-status.js.map +1 -1
- package/dist/tools/execute-csharp.js +41 -4
- package/dist/tools/execute-csharp.js.map +1 -1
- package/dist/tools/gameobject-create.js +19 -6
- package/dist/tools/gameobject-create.js.map +1 -1
- package/dist/tools/gameobject-duplicate.js +7 -2
- package/dist/tools/gameobject-duplicate.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +37 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/inputsim-key.d.ts +40 -0
- package/dist/tools/inputsim-key.js +72 -0
- package/dist/tools/inputsim-key.js.map +1 -0
- package/dist/tools/inputsim-pointer.d.ts +40 -0
- package/dist/tools/inputsim-pointer.js +121 -0
- package/dist/tools/inputsim-pointer.js.map +1 -0
- package/dist/tools/inputsim-pointer3d.d.ts +40 -0
- package/dist/tools/inputsim-pointer3d.js +55 -0
- package/dist/tools/inputsim-pointer3d.js.map +1 -0
- package/dist/tools/inputsim-probe.d.ts +40 -0
- package/dist/tools/inputsim-probe.js +43 -0
- package/dist/tools/inputsim-probe.js.map +1 -0
- package/dist/tools/inputsim-step.d.ts +40 -0
- package/dist/tools/inputsim-step.js +50 -0
- package/dist/tools/inputsim-step.js.map +1 -0
- package/dist/tools/inputsim-touch.d.ts +40 -0
- package/dist/tools/inputsim-touch.js +83 -0
- package/dist/tools/inputsim-touch.js.map +1 -0
- package/dist/tools/manage-tools.js +8 -1
- package/dist/tools/manage-tools.js.map +1 -1
- package/dist/tools/memory-snapshot-capture.js +11 -5
- package/dist/tools/memory-snapshot-capture.js.map +1 -1
- package/dist/tools/prefab-instantiate.js +11 -0
- package/dist/tools/prefab-instantiate.js.map +1 -1
- package/dist/tools/pull-events.js +18 -10
- package/dist/tools/pull-events.js.map +1 -1
- package/dist/tools/read-compile-errors.js +15 -1
- package/dist/tools/read-compile-errors.js.map +1 -1
- package/dist/tools/recompile-scripts.d.ts +40 -0
- package/dist/tools/recompile-scripts.js +35 -0
- package/dist/tools/recompile-scripts.js.map +1 -0
- package/dist/tools/resource-pressure.js +21 -10
- package/dist/tools/resource-pressure.js.map +1 -1
- package/dist/tools/run-tests.js +21 -4
- package/dist/tools/run-tests.js.map +1 -1
- package/dist/tools/screenshot-window.js +18 -12
- package/dist/tools/screenshot-window.js.map +1 -1
- package/dist/tools/screenshot.js +13 -6
- package/dist/tools/screenshot.js.map +1 -1
- package/dist/tools/ui-canvas-add.js +19 -6
- package/dist/tools/ui-canvas-add.js.map +1 -1
- package/dist/tools/visual-compare.d.ts +40 -0
- package/dist/tools/visual-compare.js +98 -0
- package/dist/tools/visual-compare.js.map +1 -0
- package/dist/unity-log.d.ts +111 -1
- package/dist/unity-log.js +334 -11
- package/dist/unity-log.js.map +1 -1
- package/package.json +1 -1
|
@@ -30,16 +30,27 @@ export const resourcePressure = makeTool("unity_open_mcp_resource_pressure", "Sa
|
|
|
30
30
|
"reachable — the bridge is what dies on fd-exhaustion. Resolves the live " +
|
|
31
31
|
"Unity PID via the process scan (same as `bridge_status` cold-Safe-Mode " +
|
|
32
32
|
"detection). Response fields: `fdCount` (null when the probe failed), " +
|
|
33
|
-
"`fdMethod`, `approximate` (Windows handle count), `ceiling` (
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
33
|
+
"`fdMethod`, `approximate` (Windows handle count), `ceiling` (the resolved " +
|
|
34
|
+
"fd ceiling — default 1024, configurable per project), `ceilingSource` " +
|
|
35
|
+
"(`\"default\"` | `\"config\"` — whether `.unity-open-mcp/settings.json` " +
|
|
36
|
+
"`resourcePressure.fdCeiling` overrode the default), `headroom`, " +
|
|
37
|
+
"`pressureRatio`, `state` (`ok` | `warn` at ≥80% | `critical` at ≥90% | " +
|
|
38
|
+
"`over_ceiling` when the count already exceeds the ceiling proxy | " +
|
|
39
|
+
"`unknown` when the probe failed), `trend` (`stable` | `rising` | " +
|
|
40
|
+
"`leaking` — monotonic climb across successive samples = leak in progress; " +
|
|
41
|
+
"absolute count alone is not enough), and `samples[]` (the session-scoped " +
|
|
42
|
+
"in-memory ring of recent samples for this PID — no disk cache). " +
|
|
43
|
+
"IMPORTANT for fd-heavy projects: an asset-heavy Editor legitimately sits " +
|
|
44
|
+
"OVER the ceiling proxy on a fresh healthy process (lsof/HandleCount count " +
|
|
45
|
+
"ALL OS fds — mmap'd assets, file watchers, FileStream handles — while only " +
|
|
46
|
+
"Mono-IOSelector-registered descriptors trip the hang), so `over_ceiling` " +
|
|
47
|
+
"is INFORMATIONAL, not an alarm: when `state` is `over_ceiling` and the " +
|
|
48
|
+
"trend is stable/no-history the response carries a `pressureNote` instead " +
|
|
49
|
+
"of a `warning`, and you should watch the TREND, not the absolute. The " +
|
|
50
|
+
"agent should surface a `warning` (recommend saving scene work + planning a " +
|
|
51
|
+
"restart) when `state` is warn/critical, OR `trend.state` is " +
|
|
52
|
+
"leaking/rising — do NOT call `restart_editor` yet (the Editor is still " +
|
|
53
|
+
"healthy). Use this after heavy automation (many recompiles / domain " +
|
|
43
54
|
"reloads) to catch fd growth across reloads. No disk cache — samples live " +
|
|
44
55
|
"in the session store and are cleared on MCP-server restart.", {
|
|
45
56
|
properties: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-pressure.js","sourceRoot":"","sources":["../../src/tools/resource-pressure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,2EAA2E;AAC3E,eAAe;AACf,EAAE;AACF,mFAAmF;AACnF,mEAAmE;AACnE,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,oDAAoD;AACpD,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,SAAS;AACT,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CACtC,kCAAkC,EAClC,4EAA4E;IAC1E,yEAAyE;IACzE,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAC5E,sEAAsE;IACtE,sEAAsE;IACtE,mEAAmE;IACnE,oEAAoE;IACpE,0EAA0E;IAC1E,yEAAyE;IACzE,uEAAuE;IACvE,4EAA4E;IAC5E,2EAA2E;IAC3E,2EAA2E;IAC3E,
|
|
1
|
+
{"version":3,"file":"resource-pressure.js","sourceRoot":"","sources":["../../src/tools/resource-pressure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,2EAA2E;AAC3E,eAAe;AACf,EAAE;AACF,mFAAmF;AACnF,mEAAmE;AACnE,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,oDAAoD;AACpD,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,+EAA+E;AAC/E,SAAS;AACT,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CACtC,kCAAkC,EAClC,4EAA4E;IAC1E,yEAAyE;IACzE,4EAA4E;IAC5E,4EAA4E;IAC5E,4EAA4E;IAC5E,sEAAsE;IACtE,sEAAsE;IACtE,mEAAmE;IACnE,oEAAoE;IACpE,0EAA0E;IAC1E,yEAAyE;IACzE,uEAAuE;IACvE,4EAA4E;IAC5E,wEAAwE;IACxE,0EAA0E;IAC1E,kEAAkE;IAClE,yEAAyE;IACzE,oEAAoE;IACpE,mEAAmE;IACnE,4EAA4E;IAC5E,2EAA2E;IAC3E,kEAAkE;IAClE,2EAA2E;IAC3E,4EAA4E;IAC5E,6EAA6E;IAC7E,2EAA2E;IAC3E,yEAAyE;IACzE,2EAA2E;IAC3E,wEAAwE;IACxE,6EAA6E;IAC7E,8DAA8D;IAC9D,yEAAyE;IACzE,sEAAsE;IACtE,2EAA2E;IAC3E,6DAA6D,EAC/D;IACE,UAAU,EAAE;QACN,GAAG,EAAE;YACH,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,CAAC;YACV,WAAW,EACT,+DAA+D;gBAC/D,mEAAmE;gBACnE,mEAAmE;gBACnE,oEAAoE;gBACpE,gBAAgB;SACnB;KACF;CACN,CACF,CAAC"}
|
package/dist/tools/run-tests.js
CHANGED
|
@@ -2,7 +2,15 @@ import { makeTool } from "./schema-fragments.js";
|
|
|
2
2
|
export const runTests = makeTool("unity_senses_run_tests", "Run Unity EditMode or PlayMode tests and return structured results. " +
|
|
3
3
|
"EditMode runs in-process and results are available within seconds. " +
|
|
4
4
|
"PlayMode survives domain reload via file handoff. " +
|
|
5
|
-
"Filter by assembly, namespace, class, or method name."
|
|
5
|
+
"Filter by assembly, namespace, class, or method name. " +
|
|
6
|
+
"Results are retrieved by the server polling a results file (NOT via " +
|
|
7
|
+
"unity_senses_pull_events, which streams only console/editor-state). " +
|
|
8
|
+
"Note: when the filter matches ZERO tests, Execute runs nothing and the " +
|
|
9
|
+
"result carries status completed with summary.total:0 and a note — this " +
|
|
10
|
+
"looks like 'no results' but is a no-match filter, not a failure. " +
|
|
11
|
+
"Tip: to run a single test method deterministically, invoke the test " +
|
|
12
|
+
"class/method directly via unity_open_mcp_invoke_method — NUnit assertion " +
|
|
13
|
+
"failures come back verbatim in the error.", {
|
|
6
14
|
properties: {
|
|
7
15
|
play_mode: {
|
|
8
16
|
type: "boolean",
|
|
@@ -11,7 +19,7 @@ export const runTests = makeTool("unity_senses_run_tests", "Run Unity EditMode o
|
|
|
11
19
|
},
|
|
12
20
|
assembly_name: {
|
|
13
21
|
type: "string",
|
|
14
|
-
description: "Filter: run tests in this assembly only (e.g. 'MyAssembly').",
|
|
22
|
+
description: "Filter: run tests in this assembly only (e.g. 'MyAssembly'). Must name a real test assembly or the run matches nothing.",
|
|
15
23
|
},
|
|
16
24
|
test_namespace: {
|
|
17
25
|
type: "string",
|
|
@@ -19,7 +27,9 @@ export const runTests = makeTool("unity_senses_run_tests", "Run Unity EditMode o
|
|
|
19
27
|
},
|
|
20
28
|
test_class: {
|
|
21
29
|
type: "string",
|
|
22
|
-
description: "Filter: run tests in this class (
|
|
30
|
+
description: "Filter: run tests in this class. Maps to NUnit groupNames (a partial/group " +
|
|
31
|
+
"match), so a partial class name may match more or less than expected — " +
|
|
32
|
+
"prefer the full class name.",
|
|
23
33
|
},
|
|
24
34
|
test_method: {
|
|
25
35
|
type: "string",
|
|
@@ -37,7 +47,14 @@ export const runTests = makeTool("unity_senses_run_tests", "Run Unity EditMode o
|
|
|
37
47
|
default: 60000,
|
|
38
48
|
minimum: 1000,
|
|
39
49
|
maximum: 600000,
|
|
40
|
-
description: "
|
|
50
|
+
description: "Client-side polling budget (milliseconds) the server waits for the results file. " +
|
|
51
|
+
"Not a bridge parameter — the bridge run is async and writes a results file " +
|
|
52
|
+
"the server polls. Raise for PlayMode (domain reload) or large suites.",
|
|
53
|
+
},
|
|
54
|
+
run_id: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "Optional run id. Omit to let the bridge generate a safe one (<pid>-<unixMs>). " +
|
|
57
|
+
"Must be 1..128 chars of [A-Za-z0-9._-] only.",
|
|
41
58
|
},
|
|
42
59
|
},
|
|
43
60
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-tests.js","sourceRoot":"","sources":["../../src/tools/run-tests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAC9B,wBAAwB,EACxB,sEAAsE;IACpE,qEAAqE;IACrE,oDAAoD;IACpD,
|
|
1
|
+
{"version":3,"file":"run-tests.js","sourceRoot":"","sources":["../../src/tools/run-tests.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAC9B,wBAAwB,EACxB,sEAAsE;IACpE,qEAAqE;IACrE,oDAAoD;IACpD,wDAAwD;IACxD,sEAAsE;IACtE,sEAAsE;IACtE,yEAAyE;IACzE,yEAAyE;IACzE,mEAAmE;IACnE,sEAAsE;IACtE,2EAA2E;IAC3E,2CAA2C,EAC7C;IACE,UAAU,EAAE;QACN,SAAS,EAAE;YACT,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,iEAAiE;SAC/E;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yHAAyH;SACvI;QACD,cAAc,EAAE;YACd,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,yCAAyC;SACvD;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6EAA6E;gBAC7E,yEAAyE;gBACzE,6BAA6B;SAChC;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,2DAA2D;SACzE;QACD,cAAc,EAAE;YACd,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;YACb,WAAW,EACT,kEAAkE;gBAClE,kEAAkE;gBAClE,2DAA2D;SAC9D;QACD,UAAU,EAAE;YACV,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,MAAM;YACf,WAAW,EACT,mFAAmF;gBACnF,6EAA6E;gBAC7E,uEAAuE;SAC1E;QACD,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,gFAAgF;gBAChF,8CAA8C;SACjD;KACF;CACN,CACF,CAAC"}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { makeTool } from "./schema-fragments.js";
|
|
2
2
|
// M20 Plan 1 / T20.1.2 — Editor window screenshot. Captures any EditorWindow
|
|
3
3
|
// (Console, Hierarchy, Inspector, Project, Scene, Game, or a custom window).
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
4
|
+
// feedback #6 (2026-08-07): on macOS/Linux the screen-readback path reads from
|
|
5
|
+
// an unbound backbuffer during bridge dispatch and produces a blank frame, so
|
|
6
|
+
// the tool now returns a structured `not_supported` error there (use the OS
|
|
7
|
+
// screen-capture tool, or screenshot {view:"composed"} for the rendered Game
|
|
8
|
+
// view). On Windows a screen-rect readback is used and a post-capture
|
|
9
|
+
// solid-color check rejects blank frames with a `blank_capture` error instead
|
|
10
|
+
// of reporting status:ok. `resolution` reports the actual capture size.
|
|
8
11
|
export const screenshotWindow = makeTool("unity_senses_screenshot_window", "Capture a Unity Editor window (Console, Hierarchy, Inspector, Project, " +
|
|
9
|
-
"Scene, Game, or any custom EditorWindow) to a PNG file.
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"(
|
|
16
|
-
"the
|
|
12
|
+
"Scene, Game, or any custom EditorWindow) to a PNG file. Windows-only: on " +
|
|
13
|
+
"macOS/Linux returns a `not_supported` error (the editor-window backbuffer " +
|
|
14
|
+
"is not bound during bridge dispatch, so a blank frame would result — use " +
|
|
15
|
+
"the OS screen-capture tool, or screenshot {view:\"composed\"} for the " +
|
|
16
|
+
"rendered Game view). On Windows a screen-rect readback is used; a blank/" +
|
|
17
|
+
"solid-color frame is rejected with a `blank_capture` error. `resolution` " +
|
|
18
|
+
"reports the ACTUAL capture size (clamped to the window's on-screen rect), " +
|
|
19
|
+
"not the requested maximum. Provide either window_title (visible tab text, " +
|
|
20
|
+
"e.g. \"Console\") or window_type (EditorWindow type name, e.g. " +
|
|
21
|
+
"\"UnityEditor.ConsoleWindow\"). Returns the saved PNG file path. Requires " +
|
|
22
|
+
"a live Unity Editor connection.", {
|
|
17
23
|
properties: {
|
|
18
24
|
window_title: {
|
|
19
25
|
type: "string",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot-window.js","sourceRoot":"","sources":["../../src/tools/screenshot-window.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,6EAA6E;AAC7E,6EAA6E;AAC7E,
|
|
1
|
+
{"version":3,"file":"screenshot-window.js","sourceRoot":"","sources":["../../src/tools/screenshot-window.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,6EAA6E;AAC7E,6EAA6E;AAC7E,+EAA+E;AAC/E,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,sEAAsE;AACtE,8EAA8E;AAC9E,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CACtC,gCAAgC,EAChC,yEAAyE;IACvE,2EAA2E;IAC3E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,0EAA0E;IAC1E,2EAA2E;IAC3E,4EAA4E;IAC5E,4EAA4E;IAC5E,iEAAiE;IACjE,4EAA4E;IAC5E,iCAAiC,EACnC;IACE,UAAU,EAAE;QACN,YAAY,EAAE;YACZ,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,4DAA4D;gBAC5D,mEAAmE;gBACnE,iEAAiE;gBACjE,+CAA+C;SAClD;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,0DAA0D;gBAC1D,6DAA6D;gBAC7D,mDAAmD;SACtD;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,WAAW,EACT,oEAAoE;gBACpE,+BAA+B;SAClC;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,WAAW,EACT,qEAAqE;gBACrE,gCAAgC;SACnC;KACF;CACN,CACF,CAAC"}
|
package/dist/tools/screenshot.js
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import { makeTool } from "./schema-fragments.js";
|
|
2
|
-
export const screenshot = makeTool("unity_senses_screenshot", "Capture a screenshot from the Unity Editor. Supports
|
|
3
|
-
"'scene' (the Scene view), 'game' (
|
|
2
|
+
export const screenshot = makeTool("unity_senses_screenshot", "Capture a screenshot from the Unity Editor. Supports four views: " +
|
|
3
|
+
"'scene' (the Scene view), 'game' (renders Camera.main only — NOT the full " +
|
|
4
|
+
"Game view; Screen-Space Overlay UI and multi-camera compositions are NOT " +
|
|
5
|
+
"included), 'composed' (the player's full composite frame — every camera by " +
|
|
6
|
+
"depth plus Screen-Space Overlay canvases; use this to verify UI edits), and " +
|
|
4
7
|
"'isolated' (a clean 2x2 composite — Front/Right/Back/Top — of a single " +
|
|
5
8
|
"GameObject with layer culling and background choice). " +
|
|
6
9
|
"Returns the saved PNG file path. Requires a live Unity Editor connection.", {
|
|
7
10
|
properties: {
|
|
8
11
|
view: {
|
|
9
12
|
type: "string",
|
|
10
|
-
enum: ["scene", "game", "isolated"],
|
|
13
|
+
enum: ["scene", "game", "composed", "isolated"],
|
|
11
14
|
default: "scene",
|
|
12
|
-
description: "Capture target. 'scene' = Scene view camera, 'game' = main
|
|
13
|
-
"
|
|
15
|
+
description: "Capture target. 'scene' = Scene view camera, 'game' = Camera.main only " +
|
|
16
|
+
"(Overlay canvases and other cameras are NOT rendered — prefer 'composed' " +
|
|
17
|
+
"to verify UI), 'composed' = the player's full frame (all cameras by depth + " +
|
|
18
|
+
"Screen-Space Overlay UI; in play mode uses ScreenCapture, in edit mode " +
|
|
19
|
+
"composites enabled cameras by depth), 'isolated' = clean 2x2 composite of " +
|
|
20
|
+
"one GameObject.",
|
|
14
21
|
},
|
|
15
22
|
width: {
|
|
16
23
|
type: "integer",
|
|
@@ -35,7 +42,7 @@ export const screenshot = makeTool("unity_senses_screenshot", "Capture a screens
|
|
|
35
42
|
type: "string",
|
|
36
43
|
enum: ["transparent", "solid", "skybox"],
|
|
37
44
|
default: "skybox",
|
|
38
|
-
description: "Background for 'isolated' view. Ignored for scene/game.",
|
|
45
|
+
description: "Background for 'isolated' view. Ignored for scene/game/composed.",
|
|
39
46
|
},
|
|
40
47
|
},
|
|
41
48
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/tools/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAChC,yBAAyB,EACzB,
|
|
1
|
+
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/tools/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAChC,yBAAyB,EACzB,mEAAmE;IACjE,4EAA4E;IAC5E,2EAA2E;IAC3E,6EAA6E;IAC7E,8EAA8E;IAC9E,yEAAyE;IACzE,wDAAwD;IACxD,2EAA2E,EAC7E;IACE,UAAU,EAAE;QACN,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;YAC/C,OAAO,EAAE,OAAO;YAChB,WAAW,EACT,yEAAyE;gBACzE,2EAA2E;gBAC3E,8EAA8E;gBAC9E,yEAAyE;gBACzE,4EAA4E;gBAC5E,iBAAiB;SACpB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,WAAW,EACT,mFAAmF;SACtF;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,WAAW,EACT,oFAAoF;SACvF;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,wEAAwE;gBACxE,0CAA0C;SAC7C;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC;YACxC,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,kEAAkE;SAChF;KACF;CACN,CACF,CAAC"}
|
|
@@ -25,12 +25,14 @@ const targetSchema = {
|
|
|
25
25
|
};
|
|
26
26
|
export const uiCanvasAdd = makeTool("unity_open_mcp_ui_canvas_add", "Add a Canvas to a GameObject (or as a new scene root when no host is addressed). " +
|
|
27
27
|
"Ensures the canvas has a CanvasScaler + GraphicRaycaster, and ensures an EventSystem " +
|
|
28
|
-
"exists in the
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
28
|
+
"exists in the Canvas's scene (scoped per-scene so a stray EventSystem is not created in or " +
|
|
29
|
+
"stolen from a different loaded scene). Set render_mode (ScreenSpaceOverlay | ScreenSpaceCamera | " +
|
|
30
|
+
"WorldSpace, default ScreenSpaceOverlay) and sorting_order (default 0). When multiple scenes are " +
|
|
31
|
+
"loaded, pass scene_path/scene_name to control which scene receives the new Canvas root + " +
|
|
32
|
+
"EventSystem — otherwise both land in the active scene. Idempotent — re-using an existing Canvas " +
|
|
33
|
+
"reports added:false (the scaler / raycaster / EventSystem are still ensured). Mutating: runs the " +
|
|
34
|
+
"full gate path; paths_hint is the host / new-root scene path. Built-in UI module (no package " +
|
|
35
|
+
"dependency); the ui group is hidden until manage_tools activates it.", {
|
|
34
36
|
required: ["paths_hint"],
|
|
35
37
|
properties: {
|
|
36
38
|
...targetSchema,
|
|
@@ -49,6 +51,17 @@ export const uiCanvasAdd = makeTool("unity_open_mcp_ui_canvas_add", "Add a Canva
|
|
|
49
51
|
type: "string",
|
|
50
52
|
description: "Name for the new scene root when no host is addressed (defaults to 'Canvas').",
|
|
51
53
|
},
|
|
54
|
+
scene_path: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "Optional target scene asset path (e.g. 'Assets/Scenes/Bootstrap.unity') for the new Canvas " +
|
|
57
|
+
"root + EventSystem when no host is addressed. The scene must already be loaded " +
|
|
58
|
+
"(use unity_open_mcp_scene_open Additive first). Omit to create in the active scene.",
|
|
59
|
+
},
|
|
60
|
+
scene_name: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "Optional target scene name for the new Canvas root + EventSystem (alternative to scene_path). " +
|
|
63
|
+
"The scene must already be loaded. Omit to create in the active scene.",
|
|
64
|
+
},
|
|
52
65
|
},
|
|
53
66
|
});
|
|
54
67
|
//# sourceMappingURL=ui-canvas-add.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui-canvas-add.js","sourceRoot":"","sources":["../../src/tools/ui-canvas-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE7E,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,uEAAuE;AACvE,wEAAwE;AACxE,iDAAiD;AACjD,MAAM,YAAY,GAAG;IACnB,WAAW,EAAE;QACX,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC3B,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,oGAAoG;KAClH;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,qCAAqC;KACnD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,+DAA+D;KAC7E;IACD,UAAU,EAAE,EAAE,GAAG,eAAe,EAAE,WAAW,EAAE,yDAAyD,EAAE;IAC1G,IAAI,EAAE,EAAE,GAAG,SAAS,EAAE;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CACjC,8BAA8B,EAC9B,mFAAmF;IACjF,uFAAuF;IACvF,
|
|
1
|
+
{"version":3,"file":"ui-canvas-add.js","sourceRoot":"","sources":["../../src/tools/ui-canvas-add.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAE7E,6EAA6E;AAC7E,4EAA4E;AAC5E,yEAAyE;AACzE,8EAA8E;AAC9E,uEAAuE;AACvE,wEAAwE;AACxE,iDAAiD;AACjD,MAAM,YAAY,GAAG;IACnB,WAAW,EAAE;QACX,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC3B,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,oGAAoG;KAClH;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,qCAAqC;KACnD;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,+DAA+D;KAC7E;IACD,UAAU,EAAE,EAAE,GAAG,eAAe,EAAE,WAAW,EAAE,yDAAyD,EAAE;IAC1G,IAAI,EAAE,EAAE,GAAG,SAAS,EAAE;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CACjC,8BAA8B,EAC9B,mFAAmF;IACjF,uFAAuF;IACvF,6FAA6F;IAC7F,mGAAmG;IACnG,kGAAkG;IAClG,2FAA2F;IAC3F,kGAAkG;IAClG,mGAAmG;IACnG,+FAA+F;IAC/F,sEAAsE,EACxE;IACE,QAAQ,EAAE,CAAC,YAAY,CAAC;IACpB,UAAU,EAAE;QACV,GAAG,YAAY;QACf,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,oBAAoB;YAC7B,IAAI,EAAE,CAAC,oBAAoB,EAAE,mBAAmB,EAAE,YAAY,CAAC;YAC/D,WAAW,EAAE,qBAAqB;SACnC;QACD,aAAa,EAAE;YACb,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,CAAC;YACV,WAAW,EAAE,+CAA+C;SAC7D;QACD,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,+EAA+E;SAC7F;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6FAA6F;gBAC7F,iFAAiF;gBACjF,qFAAqF;SACxF;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,gGAAgG;gBAChG,uEAAuE;SAC1E;KACF;CACN,CACF,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export declare const visualCompare: {
|
|
2
|
+
inputSchema: {
|
|
3
|
+
[x: string]: unknown;
|
|
4
|
+
type: "object";
|
|
5
|
+
properties?: {
|
|
6
|
+
[x: string]: object;
|
|
7
|
+
} | undefined;
|
|
8
|
+
required?: string[] | undefined;
|
|
9
|
+
};
|
|
10
|
+
name: string;
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
outputSchema?: {
|
|
13
|
+
[x: string]: unknown;
|
|
14
|
+
type: "object";
|
|
15
|
+
properties?: {
|
|
16
|
+
[x: string]: object;
|
|
17
|
+
} | undefined;
|
|
18
|
+
required?: string[] | undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
annotations?: {
|
|
21
|
+
title?: string | undefined;
|
|
22
|
+
readOnlyHint?: boolean | undefined;
|
|
23
|
+
destructiveHint?: boolean | undefined;
|
|
24
|
+
idempotentHint?: boolean | undefined;
|
|
25
|
+
openWorldHint?: boolean | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
execution?: {
|
|
28
|
+
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
_meta?: {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
} | undefined;
|
|
33
|
+
icons?: {
|
|
34
|
+
src: string;
|
|
35
|
+
mimeType?: string | undefined;
|
|
36
|
+
sizes?: string[] | undefined;
|
|
37
|
+
theme?: "light" | "dark" | undefined;
|
|
38
|
+
}[] | undefined;
|
|
39
|
+
title?: string | undefined;
|
|
40
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { makeTool } from "./schema-fragments.js";
|
|
2
|
+
// Visual regression compare — the one transferable idea worth taking from
|
|
3
|
+
// unity-biome-mcp's "visual baseline/diff" feature. Capture a named reference
|
|
4
|
+
// snapshot from a view (scene / game / isolated), then compare later captures
|
|
5
|
+
// against it. The bridge returns pixelDiffPercent / mismatchedPixels /
|
|
6
|
+
// perceptualDistance (8x8 aHash Hamming distance) / match, plus an inline diff
|
|
7
|
+
// image (mismatched pixels in red over the current frame) when the diff is
|
|
8
|
+
// non-zero. The diff image is carried as an `inlineImage` field the MCP server
|
|
9
|
+
// unwraps into an MCP image content block (same mechanism as capture_inline).
|
|
10
|
+
//
|
|
11
|
+
// "reference snapshot" / "visual compare" is used instead of "baseline" — that
|
|
12
|
+
// name is already taken by the verify-issue baseline tools (baseline_create,
|
|
13
|
+
// regression_check), which compare compiler-error / project-health snapshots,
|
|
14
|
+
// not images.
|
|
15
|
+
export const visualCompare = makeTool("unity_senses_visual_compare", "Visual regression compare. Capture a named reference snapshot from a view " +
|
|
16
|
+
"(scene / game / isolated), then compare later captures against it to check " +
|
|
17
|
+
"whether an edit visually broke anything. Returns pixelDiffPercent, " +
|
|
18
|
+
"mismatchedPixels, perceptualDistance (8x8 average-hash Hamming distance — " +
|
|
19
|
+
"tolerates minor anti-aliasing drift), and match (true when pixelDiffPercent " +
|
|
20
|
+
"<= sensitivity * 100). On a non-zero diff, returns an inline diff image " +
|
|
21
|
+
"(mismatched pixels highlighted red over the current frame) as an MCP image " +
|
|
22
|
+
"content block. Actions: 'save' (capture + store a named reference), " +
|
|
23
|
+
"'compare' (capture + diff vs the named reference), 'list' (enumerate saved " +
|
|
24
|
+
"references), 'delete' (remove a reference). References persist under " +
|
|
25
|
+
"~/.unity-open-mcp/screenshots/references/. Requires a live Unity Editor " +
|
|
26
|
+
"connection.", {
|
|
27
|
+
properties: {
|
|
28
|
+
action: {
|
|
29
|
+
type: "string",
|
|
30
|
+
enum: ["save", "compare", "list", "delete"],
|
|
31
|
+
description: "save: capture + store a named reference. compare: capture + diff vs " +
|
|
32
|
+
"the named reference. list: enumerate saved references. delete: remove " +
|
|
33
|
+
"a named reference.",
|
|
34
|
+
},
|
|
35
|
+
name: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Reference name (required for save / compare / delete). Flat filename " +
|
|
38
|
+
"only — no path separators or traversal. Stored as " +
|
|
39
|
+
"<name>.png + <name>.meta.json.",
|
|
40
|
+
},
|
|
41
|
+
view: {
|
|
42
|
+
type: "string",
|
|
43
|
+
enum: ["scene", "game", "isolated"],
|
|
44
|
+
default: "game",
|
|
45
|
+
description: "Capture target. 'scene' = Scene view camera, 'game' = main game " +
|
|
46
|
+
"camera (default — visual regression usually targets what the player " +
|
|
47
|
+
"sees), 'isolated' = clean 2x2 composite of one GameObject. Ignored " +
|
|
48
|
+
"for list / delete.",
|
|
49
|
+
},
|
|
50
|
+
width: {
|
|
51
|
+
type: "integer",
|
|
52
|
+
default: 1280,
|
|
53
|
+
minimum: 64,
|
|
54
|
+
maximum: 4096,
|
|
55
|
+
description: "Capture width in pixels. For 'isolated', this is per-quadrant. The " +
|
|
56
|
+
"compare resamples the current capture to the reference dimensions if " +
|
|
57
|
+
"they differ, so the diff is resolution-stable.",
|
|
58
|
+
},
|
|
59
|
+
height: {
|
|
60
|
+
type: "integer",
|
|
61
|
+
default: 720,
|
|
62
|
+
minimum: 64,
|
|
63
|
+
maximum: 4096,
|
|
64
|
+
description: "Capture height in pixels. For 'isolated', this is per-quadrant.",
|
|
65
|
+
},
|
|
66
|
+
object_path: {
|
|
67
|
+
type: "string",
|
|
68
|
+
description: "Required for 'isolated' view. Hierarchy path of the target " +
|
|
69
|
+
"GameObject (e.g. \"Player\" or \"Enemies/Goblin\").",
|
|
70
|
+
},
|
|
71
|
+
background: {
|
|
72
|
+
type: "string",
|
|
73
|
+
enum: ["transparent", "solid", "skybox"],
|
|
74
|
+
default: "skybox",
|
|
75
|
+
description: "Background for 'isolated' view. Ignored for scene/game.",
|
|
76
|
+
},
|
|
77
|
+
sensitivity: {
|
|
78
|
+
type: "number",
|
|
79
|
+
default: 0.01,
|
|
80
|
+
minimum: 0,
|
|
81
|
+
maximum: 1,
|
|
82
|
+
description: "[compare] Match threshold as a fraction of mismatched pixels (0–1). " +
|
|
83
|
+
"match is true when pixelDiffPercent <= sensitivity * 100. Default 0.01 " +
|
|
84
|
+
"= 1% pixel diff. Raise for noisier scenes (dynamic backgrounds, " +
|
|
85
|
+
"particle systems); 0 = require an exact match.",
|
|
86
|
+
},
|
|
87
|
+
include_diff_image: {
|
|
88
|
+
type: "boolean",
|
|
89
|
+
default: true,
|
|
90
|
+
description: "[compare] When true (default) and the diff is non-zero, return the " +
|
|
91
|
+
"diff image (current frame with mismatched pixels set to red) as an " +
|
|
92
|
+
"inline MCP image content block. Set false to skip the image and " +
|
|
93
|
+
"receive metrics only.",
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ["action"],
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=visual-compare.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"visual-compare.js","sourceRoot":"","sources":["../../src/tools/visual-compare.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,0EAA0E;AAC1E,8EAA8E;AAC9E,8EAA8E;AAC9E,uEAAuE;AACvE,+EAA+E;AAC/E,2EAA2E;AAC3E,+EAA+E;AAC/E,8EAA8E;AAC9E,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,8EAA8E;AAC9E,cAAc;AACd,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CACnC,6BAA6B,EAC7B,4EAA4E;IAC1E,6EAA6E;IAC7E,qEAAqE;IACrE,4EAA4E;IAC5E,8EAA8E;IAC9E,0EAA0E;IAC1E,6EAA6E;IAC7E,sEAAsE;IACtE,6EAA6E;IAC7E,uEAAuE;IACvE,0EAA0E;IAC1E,aAAa,EACf;IACE,UAAU,EAAE;QACV,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;YAC3C,WAAW,EACT,sEAAsE;gBACtE,wEAAwE;gBACxE,oBAAoB;SACvB;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,uEAAuE;gBACvE,oDAAoD;gBACpD,gCAAgC;SACnC;QACD,IAAI,EAAE;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC;YACnC,OAAO,EAAE,MAAM;YACf,WAAW,EACT,kEAAkE;gBAClE,sEAAsE;gBACtE,qEAAqE;gBACrE,oBAAoB;SACvB;QACD,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,WAAW,EACT,qEAAqE;gBACrE,uEAAuE;gBACvE,gDAAgD;SACnD;QACD,MAAM,EAAE;YACN,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,GAAG;YACZ,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,IAAI;YACb,WAAW,EACT,iEAAiE;SACpE;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,WAAW,EACT,6DAA6D;gBAC7D,qDAAqD;SACxD;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,QAAQ,CAAC;YACxC,OAAO,EAAE,QAAQ;YACjB,WAAW,EAAE,yDAAyD;SACvE;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,CAAC;YACV,OAAO,EAAE,CAAC;YACV,WAAW,EACT,sEAAsE;gBACtE,yEAAyE;gBACzE,kEAAkE;gBAClE,gDAAgD;SACnD;QACD,kBAAkB,EAAE;YAClB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,IAAI;YACb,WAAW,EACT,qEAAqE;gBACrE,qEAAqE;gBACrE,kEAAkE;gBAClE,uBAAuB;SAC1B;KACF;IACD,QAAQ,EAAE,CAAC,QAAQ,CAAC;CACrB,CACF,CAAC"}
|
package/dist/unity-log.d.ts
CHANGED
|
@@ -13,6 +13,38 @@ export declare function editorLogPath(platform?: UnityLogPlatform): string;
|
|
|
13
13
|
* (`<project>/Logs/Editor.log`). Returns null when no project path is given.
|
|
14
14
|
*/
|
|
15
15
|
export declare function projectEditorLogPath(projectPath: string | null | undefined): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* The rotated previous log. Unity renames the live Editor.log to
|
|
18
|
+
* Editor-prev.log on every fresh launch (a new Editor start, AND a failed
|
|
19
|
+
* batch spawn against an already-open project). When a live editor holds the
|
|
20
|
+
* project and a batch invocation rotates the log, the live editor keeps its
|
|
21
|
+
* open handle and writes to Editor-prev.log from then on, while Editor.log is
|
|
22
|
+
* frozen at a tiny startup size — reading it returns "no errors" forever
|
|
23
|
+
* (feedback-fable-31-07 §5).
|
|
24
|
+
*
|
|
25
|
+
* Returns the GLOBAL prev-log path. On Unity 6000.5+ the rotated prev log
|
|
26
|
+
* lives next to the project-relative live log (`<project>/Logs/Editor-prev.log`),
|
|
27
|
+
* not in the global dir — use {@link projectEditorPrevLogPath} when the
|
|
28
|
+
* project-relative live log is the resolved candidate.
|
|
29
|
+
*/
|
|
30
|
+
export declare function editorPrevLogPath(platform?: UnityLogPlatform): string;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve the project-relative Editor-prev.log path Unity 6000.5+ rotates the
|
|
33
|
+
* live log into (`<project>/Logs/Editor-prev.log`). Returns null when no
|
|
34
|
+
* project path is given. Mirrors {@link projectEditorLogPath}: on 6000.5+ the
|
|
35
|
+
* prev log follows the live log into the project's Logs dir, so the prev-log
|
|
36
|
+
* fallback must read THAT file, not the stale global Editor-prev.log left over
|
|
37
|
+
* from a pre-6000.5 session.
|
|
38
|
+
*/
|
|
39
|
+
export declare function projectEditorPrevLogPath(projectPath: string | null | undefined): string | null;
|
|
40
|
+
/** Outcome of resolveEditorLogPath: the chosen path plus a short machine/
|
|
41
|
+
* agent-facing reason so callers can surface WHY a non-obvious file was read
|
|
42
|
+
* (e.g. "Editor.log frozen at 2.5KB while a live editor holds the project;
|
|
43
|
+
* fell back to Editor-prev.log"). */
|
|
44
|
+
export interface ResolvedEditorLog {
|
|
45
|
+
path: string;
|
|
46
|
+
reason: "project_log" | "global_log" | "global_log_fresher" | "prev_log_live_editor" | "prev_log_fallback";
|
|
47
|
+
}
|
|
16
48
|
/**
|
|
17
49
|
* Pick the authoritative Editor.log to read for compile-error extraction.
|
|
18
50
|
*
|
|
@@ -29,8 +61,16 @@ export declare function projectEditorLogPath(projectPath: string | null | undefi
|
|
|
29
61
|
*
|
|
30
62
|
* When the project path is unknown (no `--project`), or the project-relative
|
|
31
63
|
* log doesn't exist, the global log is used as before.
|
|
64
|
+
*
|
|
65
|
+
* feedback-fable-31-07 §5 — Editor-prev.log fallback. When a live editor
|
|
66
|
+
* holds the project (a known `livePid` is alive) and the resolved Editor.log
|
|
67
|
+
* looks frozen (implausibly small, e.g. < 4KB — the tell-tale sign of a
|
|
68
|
+
* rotated log the live editor is no longer writing to), fall back to
|
|
69
|
+
* Editor-prev.log, which is where the live editor keeps writing after the
|
|
70
|
+
* rotation. `livePid` is optional; when absent the prev.log fallback only
|
|
71
|
+
* triggers on a frozen-looking log, which is conservative.
|
|
32
72
|
*/
|
|
33
|
-
export declare function resolveEditorLogPath(projectPath: string | null | undefined, platform?: UnityLogPlatform):
|
|
73
|
+
export declare function resolveEditorLogPath(projectPath: string | null | undefined, platform?: UnityLogPlatform, livePid?: number, globalLogPathOverride?: string): ResolvedEditorLog;
|
|
34
74
|
/** Default tail size. Bounded so a multi-MB log can't blow up the tool
|
|
35
75
|
* response; 256KB is ample for a compile-error burst (Unity writes the
|
|
36
76
|
* diagnostics in a contiguous block near the end of the log). */
|
|
@@ -88,3 +128,73 @@ export interface StaleLogResult {
|
|
|
88
128
|
* helper strips a trailing `(...)` locator and accepts both forms.
|
|
89
129
|
*/
|
|
90
130
|
export declare function detectStaleLog(logPath: string, citedFiles: ReadonlyArray<string>, projectRoot: string | null | undefined): StaleLogResult;
|
|
131
|
+
export interface StaleAssemblyResult {
|
|
132
|
+
/** True when at least one source .cs is newer than the newest built DLL. */
|
|
133
|
+
staleAssembly: boolean;
|
|
134
|
+
/** Newest Library/ScriptAssemblies/*.dll mtime in epoch ms, when readable. */
|
|
135
|
+
dllMtimeMs?: number;
|
|
136
|
+
/** Project-relative source files newer than the newest DLL (bounded). */
|
|
137
|
+
newerSources: string[];
|
|
138
|
+
/** One-line agent-facing recovery hint. Empty when not stale. */
|
|
139
|
+
hint: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Decide whether the built assembly set under `<project>/Library/ScriptAssemblies`
|
|
143
|
+
* is stale relative to the on-disk C# sources under `<project>/Assets`.
|
|
144
|
+
*
|
|
145
|
+
* Conservative: flags staleness only when ALL of:
|
|
146
|
+
* - the ScriptAssemblies dir exists and holds at least one .dll,
|
|
147
|
+
* - at least one C# source under Assets is strictly newer than the newest
|
|
148
|
+
* .dll mtime.
|
|
149
|
+
* Never throws; returns a clean "not stale" on any resolution failure.
|
|
150
|
+
*/
|
|
151
|
+
export declare function detectStaleAssembly(projectRoot: string | null | undefined): StaleAssemblyResult;
|
|
152
|
+
export interface LogAuthorship {
|
|
153
|
+
/** Unity version parsed from the log header's "Unity Editor version:" line,
|
|
154
|
+
* e.g. "6000.5.5f1". null when the header was not present in the tail. */
|
|
155
|
+
logUnityVersion: string | null;
|
|
156
|
+
/** True when the header's "Batch mode:" line is "YES". null when absent. */
|
|
157
|
+
logBatchMode: boolean | null;
|
|
158
|
+
/** ISO timestamp parsed from the header's "Date:" line, when present. */
|
|
159
|
+
logDate: string | null;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Parse the Unity Editor.log header fields that identify WHO wrote the log.
|
|
163
|
+
* Scans only the tail content already read by the tool (no extra disk I/O).
|
|
164
|
+
*
|
|
165
|
+
* Returns nulls (not throws) when the header lines are absent — a long-running
|
|
166
|
+
* live editor's tail starts mid-log and won't contain the header, which is the
|
|
167
|
+
* benign case (no version to compare against, so no false mismatch).
|
|
168
|
+
*/
|
|
169
|
+
export declare function parseLogAuthorship(tail: string): LogAuthorship;
|
|
170
|
+
export interface LogAuthorshipMismatch {
|
|
171
|
+
/** True when the log's Unity version differs from the live bridge's. */
|
|
172
|
+
versionMismatch: boolean;
|
|
173
|
+
/** The version that wrote the log (from the header). */
|
|
174
|
+
logUnityVersion: string | null;
|
|
175
|
+
/** The live bridge's version, when known. */
|
|
176
|
+
liveUnityVersion: string | null;
|
|
177
|
+
/** True when the log was written by a -batchmode run (not the live editor). */
|
|
178
|
+
logBatchMode: boolean | null;
|
|
179
|
+
/** One-line agent-facing warning. Empty when not a mismatch. */
|
|
180
|
+
hint: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Compare the log's authorship against the live bridge's Unity version. This is
|
|
184
|
+
* the cross-check feedback-04-08-opus §2 asks for: a batch run of a NEWER Unity
|
|
185
|
+
* leaves a log whose errors (e.g. a deprecation that is only an error on that
|
|
186
|
+
* version) cannot occur in the live editor, so surfacing them as "current"
|
|
187
|
+
* sends the agent chasing ghosts (or refusing to continue) for minutes.
|
|
188
|
+
*
|
|
189
|
+
* Two cheap signals, both from data already at hand:
|
|
190
|
+
* - the log's "Unity Editor version:" vs the live bridge unityVersion
|
|
191
|
+
* - the log's "Batch mode:" flag (a batch run is never the live editor)
|
|
192
|
+
*
|
|
193
|
+
* Conservative: only flags a mismatch when BOTH the log version parsed AND a
|
|
194
|
+
* live version is known, AND they differ. A null log version (header scrolled
|
|
195
|
+
* past the tail) never fires — there is nothing to compare. When the log is a
|
|
196
|
+
* batch run but the versions agree, we surface the batch-mode flag WITHOUT
|
|
197
|
+
* calling it a mismatch (the agent still benefits from knowing it is a batch
|
|
198
|
+
* log). The router decides how to fold this into the response.
|
|
199
|
+
*/
|
|
200
|
+
export declare function compareLogAuthorship(authorship: LogAuthorship, liveUnityVersion: string | null | undefined): LogAuthorshipMismatch;
|