unity-open-mcp 0.1.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/LICENSE +21 -0
- package/README.md +145 -0
- package/dist/batch-spawn.d.ts +33 -0
- package/dist/batch-spawn.js +329 -0
- package/dist/batch-spawn.js.map +1 -0
- package/dist/capabilities/build-capabilities.d.ts +155 -0
- package/dist/capabilities/build-capabilities.js +475 -0
- package/dist/capabilities/build-capabilities.js.map +1 -0
- package/dist/capabilities/list-rules.d.ts +45 -0
- package/dist/capabilities/list-rules.js +121 -0
- package/dist/capabilities/list-rules.js.map +1 -0
- package/dist/capabilities/rule-catalog.d.ts +44 -0
- package/dist/capabilities/rule-catalog.js +330 -0
- package/dist/capabilities/rule-catalog.js.map +1 -0
- package/dist/capabilities/tool-groups.d.ts +53 -0
- package/dist/capabilities/tool-groups.js +396 -0
- package/dist/capabilities/tool-groups.js.map +1 -0
- package/dist/cli/args.d.ts +36 -0
- package/dist/cli/args.js +239 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/cli.d.ts +23 -0
- package/dist/cli/cli.js +125 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/commands.d.ts +37 -0
- package/dist/cli/commands.js +277 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/ping-poller.d.ts +81 -0
- package/dist/cli/ping-poller.js +161 -0
- package/dist/cli/ping-poller.js.map +1 -0
- package/dist/compat.d.ts +32 -0
- package/dist/compat.js +121 -0
- package/dist/compat.js.map +1 -0
- package/dist/compiler-errors.d.ts +31 -0
- package/dist/compiler-errors.js +91 -0
- package/dist/compiler-errors.js.map +1 -0
- package/dist/compressible-router.d.ts +18 -0
- package/dist/compressible-router.js +191 -0
- package/dist/compressible-router.js.map +1 -0
- package/dist/compression/asset-model.d.ts +86 -0
- package/dist/compression/asset-model.js +15 -0
- package/dist/compression/asset-model.js.map +1 -0
- package/dist/compression/compact.d.ts +153 -0
- package/dist/compression/compact.js +501 -0
- package/dist/compression/compact.js.map +1 -0
- package/dist/dialog-dismiss.d.ts +197 -0
- package/dist/dialog-dismiss.js +533 -0
- package/dist/dialog-dismiss.js.map +1 -0
- package/dist/event-stream.d.ts +60 -0
- package/dist/event-stream.js +228 -0
- package/dist/event-stream.js.map +1 -0
- package/dist/gate-error.d.ts +18 -0
- package/dist/gate-error.js +11 -0
- package/dist/gate-error.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +146 -0
- package/dist/index.js.map +1 -0
- package/dist/instance-discovery.d.ts +117 -0
- package/dist/instance-discovery.js +202 -0
- package/dist/instance-discovery.js.map +1 -0
- package/dist/live-client.d.ts +68 -0
- package/dist/live-client.js +583 -0
- package/dist/live-client.js.map +1 -0
- package/dist/offline.d.ts +75 -0
- package/dist/offline.js +1495 -0
- package/dist/offline.js.map +1 -0
- package/dist/package-version.d.ts +8 -0
- package/dist/package-version.js +41 -0
- package/dist/package-version.js.map +1 -0
- package/dist/ping-cache.d.ts +15 -0
- package/dist/ping-cache.js +10 -0
- package/dist/ping-cache.js.map +1 -0
- package/dist/project-health.d.ts +52 -0
- package/dist/project-health.js +177 -0
- package/dist/project-health.js.map +1 -0
- package/dist/resource-router.d.ts +26 -0
- package/dist/resource-router.js +143 -0
- package/dist/resource-router.js.map +1 -0
- package/dist/resources/index.d.ts +6 -0
- package/dist/resources/index.js +40 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/results.d.ts +14 -0
- package/dist/results.js +22 -0
- package/dist/results.js.map +1 -0
- package/dist/router.d.ts +5 -0
- package/dist/router.js +2 -0
- package/dist/router.js.map +1 -0
- package/dist/routers.d.ts +44 -0
- package/dist/routers.js +73 -0
- package/dist/routers.js.map +1 -0
- package/dist/schema-defaults.d.ts +10 -0
- package/dist/schema-defaults.js +43 -0
- package/dist/schema-defaults.js.map +1 -0
- package/dist/skill/client-paths.d.ts +33 -0
- package/dist/skill/client-paths.js +131 -0
- package/dist/skill/client-paths.js.map +1 -0
- package/dist/skill/generate-skill.d.ts +38 -0
- package/dist/skill/generate-skill.js +389 -0
- package/dist/skill/generate-skill.js.map +1 -0
- package/dist/tool-router.d.ts +40 -0
- package/dist/tool-router.js +778 -0
- package/dist/tool-router.js.map +1 -0
- package/dist/tool-session-state.d.ts +55 -0
- package/dist/tool-session-state.js +116 -0
- package/dist/tool-session-state.js.map +1 -0
- package/dist/tools/agent-capabilities.d.ts +2 -0
- package/dist/tools/agent-capabilities.js +24 -0
- package/dist/tools/agent-capabilities.js.map +1 -0
- package/dist/tools/animation-create.d.ts +2 -0
- package/dist/tools/animation-create.js +31 -0
- package/dist/tools/animation-create.js.map +1 -0
- package/dist/tools/animation-get-data.d.ts +2 -0
- package/dist/tools/animation-get-data.js +23 -0
- package/dist/tools/animation-get-data.js.map +1 -0
- package/dist/tools/animation-modify.d.ts +2 -0
- package/dist/tools/animation-modify.js +45 -0
- package/dist/tools/animation-modify.js.map +1 -0
- package/dist/tools/animator-create.d.ts +2 -0
- package/dist/tools/animator-create.js +31 -0
- package/dist/tools/animator-create.js.map +1 -0
- package/dist/tools/animator-get-data.d.ts +2 -0
- package/dist/tools/animator-get-data.js +23 -0
- package/dist/tools/animator-get-data.js.map +1 -0
- package/dist/tools/animator-modify.d.ts +2 -0
- package/dist/tools/animator-modify.js +51 -0
- package/dist/tools/animator-modify.js.map +1 -0
- package/dist/tools/apply-fix.d.ts +2 -0
- package/dist/tools/apply-fix.js +39 -0
- package/dist/tools/apply-fix.js.map +1 -0
- package/dist/tools/assets-copy.d.ts +2 -0
- package/dist/tools/assets-copy.js +50 -0
- package/dist/tools/assets-copy.js.map +1 -0
- package/dist/tools/assets-create-folder.d.ts +2 -0
- package/dist/tools/assets-create-folder.js +53 -0
- package/dist/tools/assets-create-folder.js.map +1 -0
- package/dist/tools/assets-delete.d.ts +2 -0
- package/dist/tools/assets-delete.js +34 -0
- package/dist/tools/assets-delete.js.map +1 -0
- package/dist/tools/assets-move.d.ts +2 -0
- package/dist/tools/assets-move.js +50 -0
- package/dist/tools/assets-move.js.map +1 -0
- package/dist/tools/assets-refresh.d.ts +2 -0
- package/dist/tools/assets-refresh.js +37 -0
- package/dist/tools/assets-refresh.js.map +1 -0
- package/dist/tools/baseline-create.d.ts +2 -0
- package/dist/tools/baseline-create.js +20 -0
- package/dist/tools/baseline-create.js.map +1 -0
- package/dist/tools/bridge-status.d.ts +2 -0
- package/dist/tools/bridge-status.js +44 -0
- package/dist/tools/bridge-status.js.map +1 -0
- package/dist/tools/build-get-active-target.d.ts +2 -0
- package/dist/tools/build-get-active-target.js +16 -0
- package/dist/tools/build-get-active-target.js.map +1 -0
- package/dist/tools/build-get-defines.d.ts +2 -0
- package/dist/tools/build-get-defines.js +16 -0
- package/dist/tools/build-get-defines.js.map +1 -0
- package/dist/tools/build-get-scenes.d.ts +2 -0
- package/dist/tools/build-get-scenes.js +16 -0
- package/dist/tools/build-get-scenes.js.map +1 -0
- package/dist/tools/build-get-targets.d.ts +2 -0
- package/dist/tools/build-get-targets.js +18 -0
- package/dist/tools/build-get-targets.js.map +1 -0
- package/dist/tools/build-set-defines.d.ts +2 -0
- package/dist/tools/build-set-defines.js +50 -0
- package/dist/tools/build-set-defines.js.map +1 -0
- package/dist/tools/build-set-scenes.d.ts +2 -0
- package/dist/tools/build-set-scenes.js +60 -0
- package/dist/tools/build-set-scenes.js.map +1 -0
- package/dist/tools/build-set-target.d.ts +2 -0
- package/dist/tools/build-set-target.js +49 -0
- package/dist/tools/build-set-target.js.map +1 -0
- package/dist/tools/build-start.d.ts +2 -0
- package/dist/tools/build-start.js +64 -0
- package/dist/tools/build-start.js.map +1 -0
- package/dist/tools/capture-inline.d.ts +2 -0
- package/dist/tools/capture-inline.js +57 -0
- package/dist/tools/capture-inline.js.map +1 -0
- package/dist/tools/checkpoint-create.d.ts +2 -0
- package/dist/tools/checkpoint-create.js +16 -0
- package/dist/tools/checkpoint-create.js.map +1 -0
- package/dist/tools/compile-check.d.ts +2 -0
- package/dist/tools/compile-check.js +26 -0
- package/dist/tools/compile-check.js.map +1 -0
- package/dist/tools/component-add.d.ts +2 -0
- package/dist/tools/component-add.js +47 -0
- package/dist/tools/component-add.js.map +1 -0
- package/dist/tools/component-destroy.d.ts +2 -0
- package/dist/tools/component-destroy.js +46 -0
- package/dist/tools/component-destroy.js.map +1 -0
- package/dist/tools/component-get.d.ts +2 -0
- package/dist/tools/component-get.js +54 -0
- package/dist/tools/component-get.js.map +1 -0
- package/dist/tools/component-list-all.d.ts +2 -0
- package/dist/tools/component-list-all.js +38 -0
- package/dist/tools/component-list-all.js.map +1 -0
- package/dist/tools/component-modify.d.ts +2 -0
- package/dist/tools/component-modify.js +80 -0
- package/dist/tools/component-modify.js.map +1 -0
- package/dist/tools/console-clear.d.ts +2 -0
- package/dist/tools/console-clear.js +19 -0
- package/dist/tools/console-clear.js.map +1 -0
- package/dist/tools/console-log.d.ts +2 -0
- package/dist/tools/console-log.js +47 -0
- package/dist/tools/console-log.js.map +1 -0
- package/dist/tools/delta.d.ts +2 -0
- package/dist/tools/delta.js +17 -0
- package/dist/tools/delta.js.map +1 -0
- package/dist/tools/editor-add-layer.d.ts +2 -0
- package/dist/tools/editor-add-layer.js +51 -0
- package/dist/tools/editor-add-layer.js.map +1 -0
- package/dist/tools/editor-add-tag.d.ts +2 -0
- package/dist/tools/editor-add-tag.js +41 -0
- package/dist/tools/editor-add-tag.js.map +1 -0
- package/dist/tools/editor-get-layers.d.ts +2 -0
- package/dist/tools/editor-get-layers.js +22 -0
- package/dist/tools/editor-get-layers.js.map +1 -0
- package/dist/tools/editor-get-tags.d.ts +2 -0
- package/dist/tools/editor-get-tags.js +19 -0
- package/dist/tools/editor-get-tags.js.map +1 -0
- package/dist/tools/editor-redo.d.ts +2 -0
- package/dist/tools/editor-redo.js +27 -0
- package/dist/tools/editor-redo.js.map +1 -0
- package/dist/tools/editor-set-state.d.ts +2 -0
- package/dist/tools/editor-set-state.js +57 -0
- package/dist/tools/editor-set-state.js.map +1 -0
- package/dist/tools/editor-status.d.ts +2 -0
- package/dist/tools/editor-status.js +17 -0
- package/dist/tools/editor-status.js.map +1 -0
- package/dist/tools/editor-undo.d.ts +2 -0
- package/dist/tools/editor-undo.js +29 -0
- package/dist/tools/editor-undo.js.map +1 -0
- package/dist/tools/execute-csharp.d.ts +2 -0
- package/dist/tools/execute-csharp.js +74 -0
- package/dist/tools/execute-csharp.js.map +1 -0
- package/dist/tools/execute-menu.d.ts +2 -0
- package/dist/tools/execute-menu.js +40 -0
- package/dist/tools/execute-menu.js.map +1 -0
- package/dist/tools/find-members.d.ts +2 -0
- package/dist/tools/find-members.js +56 -0
- package/dist/tools/find-members.js.map +1 -0
- package/dist/tools/find-references.d.ts +2 -0
- package/dist/tools/find-references.js +29 -0
- package/dist/tools/find-references.js.map +1 -0
- package/dist/tools/gameobject-create.d.ts +2 -0
- package/dist/tools/gameobject-create.js +61 -0
- package/dist/tools/gameobject-create.js.map +1 -0
- package/dist/tools/gameobject-destroy.d.ts +2 -0
- package/dist/tools/gameobject-destroy.js +38 -0
- package/dist/tools/gameobject-destroy.js.map +1 -0
- package/dist/tools/gameobject-duplicate.d.ts +2 -0
- package/dist/tools/gameobject-duplicate.js +40 -0
- package/dist/tools/gameobject-duplicate.js.map +1 -0
- package/dist/tools/gameobject-find.d.ts +2 -0
- package/dist/tools/gameobject-find.js +59 -0
- package/dist/tools/gameobject-find.js.map +1 -0
- package/dist/tools/gameobject-modify.d.ts +2 -0
- package/dist/tools/gameobject-modify.js +76 -0
- package/dist/tools/gameobject-modify.js.map +1 -0
- package/dist/tools/gameobject-set-parent.d.ts +2 -0
- package/dist/tools/gameobject-set-parent.js +55 -0
- package/dist/tools/gameobject-set-parent.js.map +1 -0
- package/dist/tools/gate-budget-estimate.d.ts +2 -0
- package/dist/tools/gate-budget-estimate.js +59 -0
- package/dist/tools/gate-budget-estimate.js.map +1 -0
- package/dist/tools/generate-skill.d.ts +2 -0
- package/dist/tools/generate-skill.js +37 -0
- package/dist/tools/generate-skill.js.map +1 -0
- package/dist/tools/impact-preview.d.ts +2 -0
- package/dist/tools/impact-preview.js +50 -0
- package/dist/tools/impact-preview.js.map +1 -0
- package/dist/tools/index.d.ts +30 -0
- package/dist/tools/index.js +576 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/inputsystem-action-add.d.ts +2 -0
- package/dist/tools/inputsystem-action-add.js +61 -0
- package/dist/tools/inputsystem-action-add.js.map +1 -0
- package/dist/tools/inputsystem-actionmap-add.d.ts +2 -0
- package/dist/tools/inputsystem-actionmap-add.js +31 -0
- package/dist/tools/inputsystem-actionmap-add.js.map +1 -0
- package/dist/tools/inputsystem-asset-create.d.ts +2 -0
- package/dist/tools/inputsystem-asset-create.js +35 -0
- package/dist/tools/inputsystem-asset-create.js.map +1 -0
- package/dist/tools/inputsystem-binding-add.d.ts +2 -0
- package/dist/tools/inputsystem-binding-add.js +48 -0
- package/dist/tools/inputsystem-binding-add.js.map +1 -0
- package/dist/tools/inputsystem-binding-composite-add.d.ts +2 -0
- package/dist/tools/inputsystem-binding-composite-add.js +51 -0
- package/dist/tools/inputsystem-binding-composite-add.js.map +1 -0
- package/dist/tools/inputsystem-controlscheme-add.d.ts +2 -0
- package/dist/tools/inputsystem-controlscheme-add.js +43 -0
- package/dist/tools/inputsystem-controlscheme-add.js.map +1 -0
- package/dist/tools/inputsystem-get.d.ts +2 -0
- package/dist/tools/inputsystem-get.js +22 -0
- package/dist/tools/inputsystem-get.js.map +1 -0
- package/dist/tools/invoke-method.d.ts +2 -0
- package/dist/tools/invoke-method.js +104 -0
- package/dist/tools/invoke-method.js.map +1 -0
- package/dist/tools/list-assets.d.ts +2 -0
- package/dist/tools/list-assets.js +30 -0
- package/dist/tools/list-assets.js.map +1 -0
- package/dist/tools/list-rules.d.ts +2 -0
- package/dist/tools/list-rules.js +27 -0
- package/dist/tools/list-rules.js.map +1 -0
- package/dist/tools/manage-tools.d.ts +2 -0
- package/dist/tools/manage-tools.js +47 -0
- package/dist/tools/manage-tools.js.map +1 -0
- package/dist/tools/material-create.d.ts +2 -0
- package/dist/tools/material-create.js +37 -0
- package/dist/tools/material-create.js.map +1 -0
- package/dist/tools/material-get-keywords.d.ts +2 -0
- package/dist/tools/material-get-keywords.js +23 -0
- package/dist/tools/material-get-keywords.js.map +1 -0
- package/dist/tools/material-get-properties.d.ts +2 -0
- package/dist/tools/material-get-properties.js +32 -0
- package/dist/tools/material-get-properties.js.map +1 -0
- package/dist/tools/material-set-keyword.d.ts +2 -0
- package/dist/tools/material-set-keyword.js +42 -0
- package/dist/tools/material-set-keyword.js.map +1 -0
- package/dist/tools/material-set-property.d.ts +2 -0
- package/dist/tools/material-set-property.js +49 -0
- package/dist/tools/material-set-property.js.map +1 -0
- package/dist/tools/material-set-shader.d.ts +2 -0
- package/dist/tools/material-set-shader.js +39 -0
- package/dist/tools/material-set-shader.js.map +1 -0
- package/dist/tools/mutation-explain.d.ts +2 -0
- package/dist/tools/mutation-explain.js +44 -0
- package/dist/tools/mutation-explain.js.map +1 -0
- package/dist/tools/navigation-agent-add.d.ts +2 -0
- package/dist/tools/navigation-agent-add.js +38 -0
- package/dist/tools/navigation-agent-add.js.map +1 -0
- package/dist/tools/navigation-agent-set-destination.d.ts +2 -0
- package/dist/tools/navigation-agent-set-destination.js +33 -0
- package/dist/tools/navigation-agent-set-destination.js.map +1 -0
- package/dist/tools/navigation-get.d.ts +2 -0
- package/dist/tools/navigation-get.js +20 -0
- package/dist/tools/navigation-get.js.map +1 -0
- package/dist/tools/navigation-link-add.d.ts +2 -0
- package/dist/tools/navigation-link-add.js +57 -0
- package/dist/tools/navigation-link-add.js.map +1 -0
- package/dist/tools/navigation-list.d.ts +2 -0
- package/dist/tools/navigation-list.js +16 -0
- package/dist/tools/navigation-list.js.map +1 -0
- package/dist/tools/navigation-modifier-add.d.ts +2 -0
- package/dist/tools/navigation-modifier-add.js +42 -0
- package/dist/tools/navigation-modifier-add.js.map +1 -0
- package/dist/tools/navigation-modifier-volume-add.d.ts +2 -0
- package/dist/tools/navigation-modifier-volume-add.js +41 -0
- package/dist/tools/navigation-modifier-volume-add.js.map +1 -0
- package/dist/tools/navigation-modify.d.ts +2 -0
- package/dist/tools/navigation-modify.js +47 -0
- package/dist/tools/navigation-modify.js.map +1 -0
- package/dist/tools/navigation-set-bake-settings.d.ts +2 -0
- package/dist/tools/navigation-set-bake-settings.js +42 -0
- package/dist/tools/navigation-set-bake-settings.js.map +1 -0
- package/dist/tools/navigation-surface-add.d.ts +2 -0
- package/dist/tools/navigation-surface-add.js +62 -0
- package/dist/tools/navigation-surface-add.js.map +1 -0
- package/dist/tools/navigation-surface-bake.d.ts +2 -0
- package/dist/tools/navigation-surface-bake.js +30 -0
- package/dist/tools/navigation-surface-bake.js.map +1 -0
- package/dist/tools/object-get-data.d.ts +2 -0
- package/dist/tools/object-get-data.js +59 -0
- package/dist/tools/object-get-data.js.map +1 -0
- package/dist/tools/object-modify.d.ts +2 -0
- package/dist/tools/object-modify.js +73 -0
- package/dist/tools/object-modify.js.map +1 -0
- package/dist/tools/package-add.d.ts +2 -0
- package/dist/tools/package-add.js +42 -0
- package/dist/tools/package-add.js.map +1 -0
- package/dist/tools/package-check.d.ts +2 -0
- package/dist/tools/package-check.js +27 -0
- package/dist/tools/package-check.js.map +1 -0
- package/dist/tools/package-get-dependencies.d.ts +2 -0
- package/dist/tools/package-get-dependencies.js +17 -0
- package/dist/tools/package-get-dependencies.js.map +1 -0
- package/dist/tools/package-get-info.d.ts +2 -0
- package/dist/tools/package-get-info.js +33 -0
- package/dist/tools/package-get-info.js.map +1 -0
- package/dist/tools/package-list.d.ts +2 -0
- package/dist/tools/package-list.js +57 -0
- package/dist/tools/package-list.js.map +1 -0
- package/dist/tools/package-remove.d.ts +2 -0
- package/dist/tools/package-remove.js +40 -0
- package/dist/tools/package-remove.js.map +1 -0
- package/dist/tools/package-search.d.ts +2 -0
- package/dist/tools/package-search.js +42 -0
- package/dist/tools/package-search.js.map +1 -0
- package/dist/tools/particle-system-get.d.ts +2 -0
- package/dist/tools/particle-system-get.js +42 -0
- package/dist/tools/particle-system-get.js.map +1 -0
- package/dist/tools/particle-system-modify.d.ts +2 -0
- package/dist/tools/particle-system-modify.js +73 -0
- package/dist/tools/particle-system-modify.js.map +1 -0
- package/dist/tools/ping.d.ts +2 -0
- package/dist/tools/ping.js +10 -0
- package/dist/tools/ping.js.map +1 -0
- package/dist/tools/prefab-apply.d.ts +2 -0
- package/dist/tools/prefab-apply.js +39 -0
- package/dist/tools/prefab-apply.js.map +1 -0
- package/dist/tools/prefab-close.d.ts +2 -0
- package/dist/tools/prefab-close.js +29 -0
- package/dist/tools/prefab-close.js.map +1 -0
- package/dist/tools/prefab-create.d.ts +2 -0
- package/dist/tools/prefab-create.js +52 -0
- package/dist/tools/prefab-create.js.map +1 -0
- package/dist/tools/prefab-get-overrides.d.ts +2 -0
- package/dist/tools/prefab-get-overrides.js +27 -0
- package/dist/tools/prefab-get-overrides.js.map +1 -0
- package/dist/tools/prefab-instantiate.d.ts +2 -0
- package/dist/tools/prefab-instantiate.js +52 -0
- package/dist/tools/prefab-instantiate.js.map +1 -0
- package/dist/tools/prefab-open.d.ts +2 -0
- package/dist/tools/prefab-open.js +30 -0
- package/dist/tools/prefab-open.js.map +1 -0
- package/dist/tools/prefab-revert.d.ts +2 -0
- package/dist/tools/prefab-revert.js +37 -0
- package/dist/tools/prefab-revert.js.map +1 -0
- package/dist/tools/prefab-save.d.ts +2 -0
- package/dist/tools/prefab-save.js +24 -0
- package/dist/tools/prefab-save.js.map +1 -0
- package/dist/tools/prefab-status.d.ts +2 -0
- package/dist/tools/prefab-status.js +29 -0
- package/dist/tools/prefab-status.js.map +1 -0
- package/dist/tools/prefab-unpack.d.ts +2 -0
- package/dist/tools/prefab-unpack.js +43 -0
- package/dist/tools/prefab-unpack.js.map +1 -0
- package/dist/tools/probuilder-create-shape.d.ts +2 -0
- package/dist/tools/probuilder-create-shape.js +40 -0
- package/dist/tools/probuilder-create-shape.js.map +1 -0
- package/dist/tools/probuilder-delete-faces.d.ts +2 -0
- package/dist/tools/probuilder-delete-faces.js +47 -0
- package/dist/tools/probuilder-delete-faces.js.map +1 -0
- package/dist/tools/probuilder-extrude.d.ts +2 -0
- package/dist/tools/probuilder-extrude.js +58 -0
- package/dist/tools/probuilder-extrude.js.map +1 -0
- package/dist/tools/probuilder-get-mesh-info.d.ts +2 -0
- package/dist/tools/probuilder-get-mesh-info.js +21 -0
- package/dist/tools/probuilder-get-mesh-info.js.map +1 -0
- package/dist/tools/probuilder-set-face-material.d.ts +2 -0
- package/dist/tools/probuilder-set-face-material.js +53 -0
- package/dist/tools/probuilder-set-face-material.js.map +1 -0
- package/dist/tools/profiler-capture.d.ts +2 -0
- package/dist/tools/profiler-capture.js +84 -0
- package/dist/tools/profiler-capture.js.map +1 -0
- package/dist/tools/profiler-clear-data.d.ts +2 -0
- package/dist/tools/profiler-clear-data.js +20 -0
- package/dist/tools/profiler-clear-data.js.map +1 -0
- package/dist/tools/profiler-enable-module.d.ts +2 -0
- package/dist/tools/profiler-enable-module.js +32 -0
- package/dist/tools/profiler-enable-module.js.map +1 -0
- package/dist/tools/profiler-get-config.d.ts +2 -0
- package/dist/tools/profiler-get-config.js +21 -0
- package/dist/tools/profiler-get-config.js.map +1 -0
- package/dist/tools/profiler-get-script-stats.d.ts +2 -0
- package/dist/tools/profiler-get-script-stats.js +20 -0
- package/dist/tools/profiler-get-script-stats.js.map +1 -0
- package/dist/tools/profiler-get-status.d.ts +2 -0
- package/dist/tools/profiler-get-status.js +22 -0
- package/dist/tools/profiler-get-status.js.map +1 -0
- package/dist/tools/profiler-list-modules.d.ts +2 -0
- package/dist/tools/profiler-list-modules.js +20 -0
- package/dist/tools/profiler-list-modules.js.map +1 -0
- package/dist/tools/profiler-load-data.d.ts +2 -0
- package/dist/tools/profiler-load-data.js +38 -0
- package/dist/tools/profiler-load-data.js.map +1 -0
- package/dist/tools/profiler-memory.d.ts +2 -0
- package/dist/tools/profiler-memory.js +21 -0
- package/dist/tools/profiler-memory.js.map +1 -0
- package/dist/tools/profiler-rendering.d.ts +2 -0
- package/dist/tools/profiler-rendering.js +14 -0
- package/dist/tools/profiler-rendering.js.map +1 -0
- package/dist/tools/profiler-save-data.d.ts +2 -0
- package/dist/tools/profiler-save-data.js +38 -0
- package/dist/tools/profiler-save-data.js.map +1 -0
- package/dist/tools/profiler-set-config.d.ts +2 -0
- package/dist/tools/profiler-set-config.js +72 -0
- package/dist/tools/profiler-set-config.js.map +1 -0
- package/dist/tools/profiler-start.d.ts +2 -0
- package/dist/tools/profiler-start.js +31 -0
- package/dist/tools/profiler-start.js.map +1 -0
- package/dist/tools/profiler-stop.d.ts +2 -0
- package/dist/tools/profiler-stop.js +20 -0
- package/dist/tools/profiler-stop.js.map +1 -0
- package/dist/tools/pull-events.d.ts +2 -0
- package/dist/tools/pull-events.js +43 -0
- package/dist/tools/pull-events.js.map +1 -0
- package/dist/tools/read-asset.d.ts +2 -0
- package/dist/tools/read-asset.js +62 -0
- package/dist/tools/read-asset.js.map +1 -0
- package/dist/tools/read-compile-errors.d.ts +2 -0
- package/dist/tools/read-compile-errors.js +59 -0
- package/dist/tools/read-compile-errors.js.map +1 -0
- package/dist/tools/read-console.d.ts +2 -0
- package/dist/tools/read-console.js +57 -0
- package/dist/tools/read-console.js.map +1 -0
- package/dist/tools/regression-check.d.ts +2 -0
- package/dist/tools/regression-check.js +36 -0
- package/dist/tools/regression-check.js.map +1 -0
- package/dist/tools/reserialize.d.ts +2 -0
- package/dist/tools/reserialize.js +31 -0
- package/dist/tools/reserialize.js.map +1 -0
- package/dist/tools/run-tests.d.ts +2 -0
- package/dist/tools/run-tests.js +49 -0
- package/dist/tools/run-tests.js.map +1 -0
- package/dist/tools/scan-all.d.ts +2 -0
- package/dist/tools/scan-all.js +25 -0
- package/dist/tools/scan-all.js.map +1 -0
- package/dist/tools/scan-paths.d.ts +2 -0
- package/dist/tools/scan-paths.js +40 -0
- package/dist/tools/scan-paths.js.map +1 -0
- package/dist/tools/scene-create.d.ts +2 -0
- package/dist/tools/scene-create.js +47 -0
- package/dist/tools/scene-create.js.map +1 -0
- package/dist/tools/scene-focus.d.ts +2 -0
- package/dist/tools/scene-focus.js +55 -0
- package/dist/tools/scene-focus.js.map +1 -0
- package/dist/tools/scene-get-data.d.ts +2 -0
- package/dist/tools/scene-get-data.js +52 -0
- package/dist/tools/scene-get-data.js.map +1 -0
- package/dist/tools/scene-get-dirty-summary.d.ts +2 -0
- package/dist/tools/scene-get-dirty-summary.js +17 -0
- package/dist/tools/scene-get-dirty-summary.js.map +1 -0
- package/dist/tools/scene-list-opened.d.ts +2 -0
- package/dist/tools/scene-list-opened.js +16 -0
- package/dist/tools/scene-list-opened.js.map +1 -0
- package/dist/tools/scene-open.d.ts +2 -0
- package/dist/tools/scene-open.js +48 -0
- package/dist/tools/scene-open.js.map +1 -0
- package/dist/tools/scene-save.d.ts +2 -0
- package/dist/tools/scene-save.js +38 -0
- package/dist/tools/scene-save.js.map +1 -0
- package/dist/tools/scene-set-active.d.ts +2 -0
- package/dist/tools/scene-set-active.js +33 -0
- package/dist/tools/scene-set-active.js.map +1 -0
- package/dist/tools/scene-unload.d.ts +2 -0
- package/dist/tools/scene-unload.js +33 -0
- package/dist/tools/scene-unload.js.map +1 -0
- package/dist/tools/screenshot-camera.d.ts +2 -0
- package/dist/tools/screenshot-camera.js +59 -0
- package/dist/tools/screenshot-camera.js.map +1 -0
- package/dist/tools/screenshot-window.d.ts +2 -0
- package/dist/tools/screenshot-window.js +54 -0
- package/dist/tools/screenshot-window.js.map +1 -0
- package/dist/tools/screenshot.d.ts +2 -0
- package/dist/tools/screenshot.js +47 -0
- package/dist/tools/screenshot.js.map +1 -0
- package/dist/tools/script-delete.d.ts +2 -0
- package/dist/tools/script-delete.js +37 -0
- package/dist/tools/script-delete.js.map +1 -0
- package/dist/tools/script-read.d.ts +2 -0
- package/dist/tools/script-read.js +46 -0
- package/dist/tools/script-read.js.map +1 -0
- package/dist/tools/script-write.d.ts +2 -0
- package/dist/tools/script-write.js +56 -0
- package/dist/tools/script-write.js.map +1 -0
- package/dist/tools/search-assets.d.ts +2 -0
- package/dist/tools/search-assets.js +49 -0
- package/dist/tools/search-assets.js.map +1 -0
- package/dist/tools/selection-get.d.ts +2 -0
- package/dist/tools/selection-get.js +28 -0
- package/dist/tools/selection-get.js.map +1 -0
- package/dist/tools/selection-set.d.ts +2 -0
- package/dist/tools/selection-set.js +72 -0
- package/dist/tools/selection-set.js.map +1 -0
- package/dist/tools/settings-get-lighting.d.ts +2 -0
- package/dist/tools/settings-get-lighting.js +21 -0
- package/dist/tools/settings-get-lighting.js.map +1 -0
- package/dist/tools/settings-get-physics.d.ts +2 -0
- package/dist/tools/settings-get-physics.js +17 -0
- package/dist/tools/settings-get-physics.js.map +1 -0
- package/dist/tools/settings-get-player.d.ts +2 -0
- package/dist/tools/settings-get-player.js +16 -0
- package/dist/tools/settings-get-player.js.map +1 -0
- package/dist/tools/settings-get-quality.d.ts +2 -0
- package/dist/tools/settings-get-quality.js +16 -0
- package/dist/tools/settings-get-quality.js.map +1 -0
- package/dist/tools/settings-set-lighting.d.ts +2 -0
- package/dist/tools/settings-set-lighting.js +58 -0
- package/dist/tools/settings-set-lighting.js.map +1 -0
- package/dist/tools/settings-set-physics.d.ts +2 -0
- package/dist/tools/settings-set-physics.js +52 -0
- package/dist/tools/settings-set-physics.js.map +1 -0
- package/dist/tools/settings-set-player.d.ts +2 -0
- package/dist/tools/settings-set-player.js +62 -0
- package/dist/tools/settings-set-player.js.map +1 -0
- package/dist/tools/settings-set-quality.d.ts +2 -0
- package/dist/tools/settings-set-quality.js +51 -0
- package/dist/tools/settings-set-quality.js.map +1 -0
- package/dist/tools/shader-get-data.d.ts +2 -0
- package/dist/tools/shader-get-data.js +31 -0
- package/dist/tools/shader-get-data.js.map +1 -0
- package/dist/tools/shader-list-all.d.ts +2 -0
- package/dist/tools/shader-list-all.js +24 -0
- package/dist/tools/shader-list-all.js.map +1 -0
- package/dist/tools/spatial-query.d.ts +2 -0
- package/dist/tools/spatial-query.js +117 -0
- package/dist/tools/spatial-query.js.map +1 -0
- package/dist/tools/splines-add-knot.d.ts +2 -0
- package/dist/tools/splines-add-knot.js +44 -0
- package/dist/tools/splines-add-knot.js.map +1 -0
- package/dist/tools/splines-container-create.d.ts +2 -0
- package/dist/tools/splines-container-create.js +39 -0
- package/dist/tools/splines-container-create.js.map +1 -0
- package/dist/tools/splines-evaluate.d.ts +2 -0
- package/dist/tools/splines-evaluate.js +31 -0
- package/dist/tools/splines-evaluate.js.map +1 -0
- package/dist/tools/splines-get-knots.d.ts +2 -0
- package/dist/tools/splines-get-knots.js +25 -0
- package/dist/tools/splines-get-knots.js.map +1 -0
- package/dist/tools/splines-modify.d.ts +2 -0
- package/dist/tools/splines-modify.js +35 -0
- package/dist/tools/splines-modify.js.map +1 -0
- package/dist/tools/splines-set-knot.d.ts +2 -0
- package/dist/tools/splines-set-knot.js +41 -0
- package/dist/tools/splines-set-knot.js.map +1 -0
- package/dist/tools/splines-set-tangent-mode.d.ts +2 -0
- package/dist/tools/splines-set-tangent-mode.js +43 -0
- package/dist/tools/splines-set-tangent-mode.js.map +1 -0
- package/dist/tools/type-schema.d.ts +2 -0
- package/dist/tools/type-schema.js +62 -0
- package/dist/tools/type-schema.js.map +1 -0
- package/dist/tools/validate-edit.d.ts +2 -0
- package/dist/tools/validate-edit.js +43 -0
- package/dist/tools/validate-edit.js.map +1 -0
- package/dist/unity-install-discovery.d.ts +79 -0
- package/dist/unity-install-discovery.js +206 -0
- package/dist/unity-install-discovery.js.map +1 -0
- package/dist/unity-log.d.ts +35 -0
- package/dist/unity-log.js +110 -0
- package/dist/unity-log.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,778 @@
|
|
|
1
|
+
import { AssetModelCache, isCompressible, routeCompressible } from "./compressible-router.js";
|
|
2
|
+
import { listAssetsOffline, findReferencesOffline } from "./offline.js";
|
|
3
|
+
import { editorLogPath, readLogTail, DEFAULT_LOG_TAIL_BYTES } from "./unity-log.js";
|
|
4
|
+
import { summarizeProjectHealth } from "./project-health.js";
|
|
5
|
+
import { buildCapabilities } from "./capabilities/build-capabilities.js";
|
|
6
|
+
import { RULE_CATALOG, FIX_CATALOG } from "./capabilities/rule-catalog.js";
|
|
7
|
+
import { GROUP_IDS, TOOL_GROUPS, groupToTools, } from "./capabilities/tool-groups.js";
|
|
8
|
+
import { listRules } from "./capabilities/list-rules.js";
|
|
9
|
+
import { generateSkill } from "./skill/generate-skill.js";
|
|
10
|
+
import { knownClientKeys } from "./skill/client-paths.js";
|
|
11
|
+
import { ALL_TOOLS } from "./tools/index.js";
|
|
12
|
+
import { lockPath, readInstanceLock, classifyInstance } from "./instance-discovery.js";
|
|
13
|
+
import { BATCH_TOOL_NAMES } from "./batch-spawn.js";
|
|
14
|
+
function injectRouteMeta(result, meta) {
|
|
15
|
+
if (result.content.length === 0)
|
|
16
|
+
return result;
|
|
17
|
+
// M20 Plan 1 / T20.1.1 — capture_inline returns an MCP image content block
|
|
18
|
+
// followed by a text metadata block. Inject _route into whichever text block
|
|
19
|
+
// carries JSON; leave image/other blocks untouched. Fall back to the first
|
|
20
|
+
// block when it is text (the common single-block path).
|
|
21
|
+
const textIndex = result.content.findIndex((c) => c.type === "text");
|
|
22
|
+
if (textIndex < 0)
|
|
23
|
+
return result;
|
|
24
|
+
const block = result.content[textIndex];
|
|
25
|
+
if (block.type !== "text")
|
|
26
|
+
return result;
|
|
27
|
+
try {
|
|
28
|
+
const body = JSON.parse(block.text);
|
|
29
|
+
body._route = meta;
|
|
30
|
+
const newContent = result.content.slice();
|
|
31
|
+
newContent[textIndex] = { type: "text", text: JSON.stringify(body) };
|
|
32
|
+
return { ...result, content: newContent };
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function activeGroupsEqual(a, b) {
|
|
39
|
+
if (a.length !== b.length)
|
|
40
|
+
return false;
|
|
41
|
+
const sa = [...a].sort();
|
|
42
|
+
const sb = [...b].sort();
|
|
43
|
+
return sa.every((v, i) => v === sb[i]);
|
|
44
|
+
}
|
|
45
|
+
// Extract the typed /ping body from a CallToolResult's first text content.
|
|
46
|
+
// Returns null on a non-text / non-JSON / non-object result so the
|
|
47
|
+
// bridge_status synthesis can fall through to the "stopped" branch without
|
|
48
|
+
// throwing.
|
|
49
|
+
function parsePingBody(result) {
|
|
50
|
+
const first = result.content[0];
|
|
51
|
+
if (!first || first.type !== "text" || typeof first.text !== "string") {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const parsed = JSON.parse(first.text);
|
|
56
|
+
if (parsed && typeof parsed === "object") {
|
|
57
|
+
return parsed;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// fall through
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
// Compact lock summary for the bridge_status response. Mirrors the field set
|
|
66
|
+
// the CLI `status` command surfaces so operators see the same pid/port/state
|
|
67
|
+
// metadata regardless of how they asked.
|
|
68
|
+
function summarizeBridgeStatusLock(lock) {
|
|
69
|
+
return {
|
|
70
|
+
pid: lock.pid,
|
|
71
|
+
port: lock.port,
|
|
72
|
+
state: lock.state,
|
|
73
|
+
isCompiling: lock.isCompiling,
|
|
74
|
+
isPlaying: lock.isPlaying,
|
|
75
|
+
heartbeatAt: lock.heartbeatAt,
|
|
76
|
+
bridgeVersion: lock.bridgeVersion,
|
|
77
|
+
unityVersion: lock.unityVersion,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Operator-facing "what to do next" hint for each coarse status. Kept short
|
|
81
|
+
// and action-oriented so the Validation Suite can render it inline.
|
|
82
|
+
function bridgeStatusNextStep(status) {
|
|
83
|
+
switch (status) {
|
|
84
|
+
case "running":
|
|
85
|
+
return "Bridge is ready. Proceed with live-only MCP tools.";
|
|
86
|
+
case "compiling":
|
|
87
|
+
return "Unity is compiling. Wait for the bridge to return to idle, or poll unity_open_mcp_bridge_status again.";
|
|
88
|
+
case "stopped":
|
|
89
|
+
return "Bridge listener is not reachable. Open the bridge window (Unity menu: Tools/Unity Open MCP Bridge) and ensure it is started, or launch Unity if it is not running, then call unity_open_mcp_bridge_status again to confirm.";
|
|
90
|
+
case "dead_bridge":
|
|
91
|
+
return "The bridge assembly failed to recompile and Unity is in a bad state. Call unity_open_mcp_read_compile_errors to retrieve the compiler errors from Editor.log, fix the cited file/line, then trigger a recompile.";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export class ToolRouter {
|
|
95
|
+
live;
|
|
96
|
+
batch;
|
|
97
|
+
projectPath;
|
|
98
|
+
eventStream;
|
|
99
|
+
sessionState;
|
|
100
|
+
onToolListChanged;
|
|
101
|
+
modelCache = new AssetModelCache();
|
|
102
|
+
constructor(live, batch, projectPath, eventStream, sessionState, onToolListChanged) {
|
|
103
|
+
this.live = live;
|
|
104
|
+
this.batch = batch;
|
|
105
|
+
this.projectPath = projectPath;
|
|
106
|
+
this.eventStream = eventStream;
|
|
107
|
+
this.sessionState = sessionState;
|
|
108
|
+
this.onToolListChanged = onToolListChanged;
|
|
109
|
+
}
|
|
110
|
+
async route(toolName, args) {
|
|
111
|
+
// list_assets — always offline (no live equivalent needed).
|
|
112
|
+
if (toolName === "unity_open_mcp_list_assets") {
|
|
113
|
+
return this.routeListAssets(args);
|
|
114
|
+
}
|
|
115
|
+
// read_compile_errors — always offline. Reads Unity's Editor.log directly;
|
|
116
|
+
// the one channel that works when the bridge assembly itself has failed to
|
|
117
|
+
// compile (every in-bridge channel is dead with it, and compile_check can't
|
|
118
|
+
// run). Never touches the bridge or spawns Unity.
|
|
119
|
+
if (toolName === "unity_open_mcp_read_compile_errors") {
|
|
120
|
+
return this.routeReadCompileErrors(args);
|
|
121
|
+
}
|
|
122
|
+
// M13 T4.4 — bridge event stream pull. The MCP server is the only long-lived
|
|
123
|
+
// hop between the bridge and the agent; a per-process SSE reader amortizes
|
|
124
|
+
// the connection and shares the queue across pulls. Lives only when the
|
|
125
|
+
// bridge is reachable; an unreachable bridge returns a clear error instead
|
|
126
|
+
// of hanging on connect.
|
|
127
|
+
if (toolName === "unity_senses_pull_events") {
|
|
128
|
+
return this.routePullEvents(args);
|
|
129
|
+
}
|
|
130
|
+
// capabilities — local capability-discovery surface (no live/batch hop).
|
|
131
|
+
if (toolName === "unity_open_mcp_capabilities") {
|
|
132
|
+
return this.routeCapabilities(args);
|
|
133
|
+
}
|
|
134
|
+
// list_rules — local rule catalog (no live/batch hop). Lets an agent
|
|
135
|
+
// discover which rules apply to which asset kinds before calling
|
|
136
|
+
// scan_paths / validate_edit.
|
|
137
|
+
if (toolName === "unity_open_mcp_list_rules") {
|
|
138
|
+
return this.routeListRules(args);
|
|
139
|
+
}
|
|
140
|
+
// generate_skill — local skill generation (no live/batch hop).
|
|
141
|
+
if (toolName === "unity_open_mcp_generate_skill") {
|
|
142
|
+
return this.routeGenerateSkill(args);
|
|
143
|
+
}
|
|
144
|
+
// M18 Plan 2 / T18.2.2 — manage_tools is server-only. It mutates the
|
|
145
|
+
// per-session tool-group visibility state that lives in the MCP server
|
|
146
|
+
// (ToolSessionState). The bridge does not track session state — it answers
|
|
147
|
+
// manage_tools meta-calls by reporting the compiled tool set; the MCP
|
|
148
|
+
// server applies the activate / deactivate filter to ListTools. Always
|
|
149
|
+
// visible regardless of the current active set (meta-tool).
|
|
150
|
+
if (toolName === "unity_open_mcp_manage_tools") {
|
|
151
|
+
return this.routeManageTools(args);
|
|
152
|
+
}
|
|
153
|
+
// testsuite-tauri phase-3 — bridge_status. Operator-only health snapshot.
|
|
154
|
+
// Server-resolved (classifyInstance + one /ping via the LiveClient); never
|
|
155
|
+
// hits the bridge tool endpoint and never spawns Unity. Returns a coarse
|
|
156
|
+
// `status` token (running/compiling/stopped/dead_bridge) the Validation
|
|
157
|
+
// Suite app drives its offline-scenario gate off. Read-only, gate-free.
|
|
158
|
+
if (toolName === "unity_open_mcp_bridge_status") {
|
|
159
|
+
return this.routeBridgeStatus(args);
|
|
160
|
+
}
|
|
161
|
+
// find_references — offline-first when no bridge is connected; live
|
|
162
|
+
// ReferenceGraph remains available when the bridge is up.
|
|
163
|
+
if (toolName === "unity_open_mcp_find_references") {
|
|
164
|
+
return this.routeFindReferences(args);
|
|
165
|
+
}
|
|
166
|
+
// Compact drill-down reads: offline-first for text-serialized assets, fall
|
|
167
|
+
// back to live bridge for binary formats. The compressible-router handles
|
|
168
|
+
// the source selection internally.
|
|
169
|
+
if (isCompressible(toolName)) {
|
|
170
|
+
const result = await routeCompressible(toolName, args, this.live, this.modelCache, this.projectPath);
|
|
171
|
+
return injectRouteMeta(result, { route: "live" });
|
|
172
|
+
}
|
|
173
|
+
const canBatch = this.batch.isBatchTool(toolName);
|
|
174
|
+
const isPing = toolName === "unity_open_mcp_ping";
|
|
175
|
+
// compile_check always routes to batch — even when the live bridge is up.
|
|
176
|
+
// The whole point is to spawn a FRESH Unity that recompiles from scratch;
|
|
177
|
+
// running it against a live Editor that already compiled successfully
|
|
178
|
+
// would trivially report "compile_passed" and never surface the broken
|
|
179
|
+
// state the tool exists to diagnose.
|
|
180
|
+
if (toolName === "unity_open_mcp_compile_check") {
|
|
181
|
+
console.error(`[unity-open-mcp] Route: ${toolName} -> batch (compile check always spawns fresh)`);
|
|
182
|
+
const result = await this.batch.route(toolName, args);
|
|
183
|
+
return injectRouteMeta(result, {
|
|
184
|
+
route: "batch",
|
|
185
|
+
fallbackReason: "compile_check_always_batch",
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (!canBatch && !isPing) {
|
|
189
|
+
const result = await this.live.route(toolName, args);
|
|
190
|
+
return injectRouteMeta(result, { route: "live" });
|
|
191
|
+
}
|
|
192
|
+
const liveAvailable = await this.live.isLiveAvailable();
|
|
193
|
+
if (liveAvailable) {
|
|
194
|
+
console.error(`[unity-open-mcp] Route: ${toolName} -> live`);
|
|
195
|
+
const result = await this.live.route(toolName, args);
|
|
196
|
+
return injectRouteMeta(result, { route: "live" });
|
|
197
|
+
}
|
|
198
|
+
console.error(`[unity-open-mcp] Route: ${toolName} -> batch (live bridge unavailable)`);
|
|
199
|
+
if (isPing) {
|
|
200
|
+
return this.batchPingResult();
|
|
201
|
+
}
|
|
202
|
+
const result = await this.batch.route(toolName, args);
|
|
203
|
+
return injectRouteMeta(result, {
|
|
204
|
+
route: "batch",
|
|
205
|
+
fallbackReason: "live_unavailable",
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
batchPingResult() {
|
|
209
|
+
return {
|
|
210
|
+
content: [
|
|
211
|
+
{
|
|
212
|
+
type: "text",
|
|
213
|
+
text: JSON.stringify({
|
|
214
|
+
connected: false,
|
|
215
|
+
projectPath: this.projectPath,
|
|
216
|
+
unityVersion: "unknown",
|
|
217
|
+
bridgeVersion: "unknown",
|
|
218
|
+
mode: "batch",
|
|
219
|
+
compiling: false,
|
|
220
|
+
isPlaying: false,
|
|
221
|
+
_route: {
|
|
222
|
+
route: "batch",
|
|
223
|
+
fallbackReason: "live_unavailable",
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
isError: false,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
async routeReadCompileErrors(args) {
|
|
232
|
+
const tailBytes = typeof args.tail_bytes === "number" && args.tail_bytes >= 4096
|
|
233
|
+
? Math.min(Math.floor(args.tail_bytes), 1048576)
|
|
234
|
+
: DEFAULT_LOG_TAIL_BYTES;
|
|
235
|
+
const logPath = editorLogPath();
|
|
236
|
+
const tail = readLogTail(logPath, tailBytes);
|
|
237
|
+
if (tail.error) {
|
|
238
|
+
return {
|
|
239
|
+
content: [
|
|
240
|
+
{
|
|
241
|
+
type: "text",
|
|
242
|
+
text: JSON.stringify({
|
|
243
|
+
error: {
|
|
244
|
+
code: "editor_log_unreadable",
|
|
245
|
+
message: `Could not read Editor.log at ${logPath}: ${tail.error}`,
|
|
246
|
+
logPath,
|
|
247
|
+
},
|
|
248
|
+
}),
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
isError: true,
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
if (!tail.exists) {
|
|
255
|
+
return {
|
|
256
|
+
content: [
|
|
257
|
+
{
|
|
258
|
+
type: "text",
|
|
259
|
+
text: JSON.stringify({
|
|
260
|
+
status: "log_not_found",
|
|
261
|
+
errorCount: 0,
|
|
262
|
+
errors: [],
|
|
263
|
+
message: `No Editor.log found at ${logPath}. The Unity Editor ` +
|
|
264
|
+
"may not have written errors yet, or it is running with a " +
|
|
265
|
+
"custom -logFile path that this tool does not resolve.",
|
|
266
|
+
logPath,
|
|
267
|
+
}),
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
isError: false,
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
// Build the full health summary: CSxxxx compiler errors PLUS package /
|
|
274
|
+
// assembly-level red flags (unresolved-assembly Cecil failures, package
|
|
275
|
+
// deprecation, Package Manager errors) from the SAME log tail. The
|
|
276
|
+
// compilerErrors list is the same shape as before (kept as `errors` for
|
|
277
|
+
// backward compatibility) so existing callers do not break.
|
|
278
|
+
const health = summarizeProjectHealth(tail.content);
|
|
279
|
+
const errors = health.compilerErrors;
|
|
280
|
+
const status = health.unhealthy
|
|
281
|
+
? errors.length > 0
|
|
282
|
+
? "compile_failed"
|
|
283
|
+
: "project_unhealthy"
|
|
284
|
+
: "no_errors_found";
|
|
285
|
+
return {
|
|
286
|
+
content: [
|
|
287
|
+
{
|
|
288
|
+
type: "text",
|
|
289
|
+
text: JSON.stringify({
|
|
290
|
+
status,
|
|
291
|
+
unhealthy: health.unhealthy,
|
|
292
|
+
headline: health.headline,
|
|
293
|
+
errorCount: errors.length,
|
|
294
|
+
errors,
|
|
295
|
+
// Package / assembly issues from the same log tail. Empty when the
|
|
296
|
+
// only red flags are compiler errors (the common case).
|
|
297
|
+
issues: health.issues,
|
|
298
|
+
issueCount: health.issues.length,
|
|
299
|
+
logPath,
|
|
300
|
+
tailBytes: tail.bytes,
|
|
301
|
+
_source: "offline",
|
|
302
|
+
}),
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
isError: false,
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
async routeListAssets(args) {
|
|
309
|
+
try {
|
|
310
|
+
const result = await listAssetsOffline({
|
|
311
|
+
folder: typeof args.folder === "string" ? args.folder : "Assets",
|
|
312
|
+
type: typeof args.type === "string" ? args.type : undefined,
|
|
313
|
+
maxPerFolder: typeof args.max_per_folder === "number" ? args.max_per_folder : 30,
|
|
314
|
+
projectRoot: this.projectPath,
|
|
315
|
+
});
|
|
316
|
+
return {
|
|
317
|
+
content: [{ type: "text", text: JSON.stringify({ ...result, _source: "offline" }) }],
|
|
318
|
+
isError: false,
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
catch (err) {
|
|
322
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
323
|
+
return {
|
|
324
|
+
content: [
|
|
325
|
+
{ type: "text", text: JSON.stringify({ error: { code: "offline_error", message } }) },
|
|
326
|
+
],
|
|
327
|
+
isError: true,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
// M13 T4.4 — drain the bridge event queue. The SSE reader is started lazily
|
|
332
|
+
// on the first call; subsequent calls return only events that arrived since
|
|
333
|
+
// the previous drain. The subscription never buffers across server restarts
|
|
334
|
+
// (a fresh subscriber id is minted per process), so a restarted MCP server
|
|
335
|
+
// begins "now" — agents that care about historical logs should still call
|
|
336
|
+
// unity_senses_read_console.
|
|
337
|
+
async routePullEvents(args) {
|
|
338
|
+
const liveAvailable = await this.live.isLiveAvailable();
|
|
339
|
+
if (!liveAvailable) {
|
|
340
|
+
return {
|
|
341
|
+
content: [
|
|
342
|
+
{
|
|
343
|
+
type: "text",
|
|
344
|
+
text: JSON.stringify({
|
|
345
|
+
error: {
|
|
346
|
+
code: "bridge_unavailable",
|
|
347
|
+
message: "Bridge event stream requires a live Unity Editor connection. " +
|
|
348
|
+
"Ensure the Unity Editor is open with the Agent Bridge running. " +
|
|
349
|
+
"The bridge port is per-project (20000 + sha256(projectPath) % 10000), not fixed — " +
|
|
350
|
+
`if Unity is open, check the instance lock at ${lockPath(this.projectPath)} ` +
|
|
351
|
+
"for the live port/pid, or set UNITY_OPEN_MCP_BRIDGE_PORT.",
|
|
352
|
+
},
|
|
353
|
+
}),
|
|
354
|
+
},
|
|
355
|
+
],
|
|
356
|
+
isError: true,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
const maxEvents = typeof args.max_events === "number" && args.max_events > 0
|
|
360
|
+
? Math.min(args.max_events, 1000)
|
|
361
|
+
: 50;
|
|
362
|
+
const result = this.eventStream.pull(maxEvents);
|
|
363
|
+
return {
|
|
364
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
365
|
+
isError: false,
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
async routeCapabilities(args) {
|
|
369
|
+
const kind = args.kind === "tools" || args.kind === "rules" || args.kind === "fixes"
|
|
370
|
+
? args.kind
|
|
371
|
+
: undefined;
|
|
372
|
+
const includePlanned = args.include_planned !== false;
|
|
373
|
+
// M18 Plan 2 / T18.2.3 — when the bridge is live, probe its compiled-
|
|
374
|
+
// state tool inventory so per-group `available` reflects whether each
|
|
375
|
+
// domain dependency compiled in (e.g. UNITY_OPEN_MCP_EXT_NAVIGATION).
|
|
376
|
+
// Capabilities stays local-route; the bridge probe is a read-only fetch
|
|
377
|
+
// that does not change the route classification.
|
|
378
|
+
let availableBridgeTools;
|
|
379
|
+
const liveAvailable = await this.live.isLiveAvailable();
|
|
380
|
+
if (liveAvailable) {
|
|
381
|
+
const inventory = await this.live.listBridgeTools();
|
|
382
|
+
if (inventory)
|
|
383
|
+
availableBridgeTools = inventory.tools;
|
|
384
|
+
}
|
|
385
|
+
const result = buildCapabilities({
|
|
386
|
+
tools: ALL_TOOLS,
|
|
387
|
+
batchToolNames: BATCH_TOOL_NAMES,
|
|
388
|
+
rules: RULE_CATALOG,
|
|
389
|
+
fixes: FIX_CATALOG,
|
|
390
|
+
availableBridgeTools,
|
|
391
|
+
}, { kind, includePlanned });
|
|
392
|
+
return {
|
|
393
|
+
content: [
|
|
394
|
+
{ type: "text", text: JSON.stringify({ ...result, _source: "local" }) },
|
|
395
|
+
],
|
|
396
|
+
isError: false,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
async routeListRules(args) {
|
|
400
|
+
const assetKind = typeof args.asset_kind === "string" ? args.asset_kind : undefined;
|
|
401
|
+
const extension = typeof args.extension === "string" ? args.extension : undefined;
|
|
402
|
+
const implementedOnly = args.implemented_only === true;
|
|
403
|
+
const result = listRules({ rules: RULE_CATALOG, fixes: FIX_CATALOG }, { assetKind, extension, implementedOnly });
|
|
404
|
+
return {
|
|
405
|
+
content: [
|
|
406
|
+
{ type: "text", text: JSON.stringify({ ...result, _source: "local" }) },
|
|
407
|
+
],
|
|
408
|
+
isError: false,
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
async routeGenerateSkill(args) {
|
|
412
|
+
const write = args.write === true;
|
|
413
|
+
const rawClients = Array.isArray(args.clients) ? args.clients : [];
|
|
414
|
+
// Client allowlist comes from the single-source manifest at
|
|
415
|
+
// `skills/client-paths.json`. Do not add a literal union here.
|
|
416
|
+
const allowedClients = new Set(knownClientKeys());
|
|
417
|
+
const clients = rawClients.filter((c) => typeof c === "string" && allowedClients.has(c));
|
|
418
|
+
const caps = buildCapabilities({
|
|
419
|
+
tools: ALL_TOOLS,
|
|
420
|
+
batchToolNames: BATCH_TOOL_NAMES,
|
|
421
|
+
rules: RULE_CATALOG,
|
|
422
|
+
fixes: FIX_CATALOG,
|
|
423
|
+
}, { includePlanned: false });
|
|
424
|
+
try {
|
|
425
|
+
const result = await generateSkill(this.projectPath, caps, {
|
|
426
|
+
write,
|
|
427
|
+
clients: clients.length > 0 ? clients : undefined,
|
|
428
|
+
});
|
|
429
|
+
return {
|
|
430
|
+
content: [
|
|
431
|
+
{
|
|
432
|
+
type: "text",
|
|
433
|
+
text: JSON.stringify({
|
|
434
|
+
skill: result.skill,
|
|
435
|
+
project: result.project,
|
|
436
|
+
written: result.written,
|
|
437
|
+
_source: "local",
|
|
438
|
+
}),
|
|
439
|
+
},
|
|
440
|
+
],
|
|
441
|
+
isError: false,
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
catch (err) {
|
|
445
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
446
|
+
return {
|
|
447
|
+
content: [
|
|
448
|
+
{
|
|
449
|
+
type: "text",
|
|
450
|
+
text: JSON.stringify({
|
|
451
|
+
error: { code: "skill_generation_failed", message },
|
|
452
|
+
}),
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
isError: true,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
// M18 Plan 2 / T18.2.2 — manage_tools routes local. Mutates the per-
|
|
460
|
+
// session tool-group visibility state (ToolSessionState) that ListTools
|
|
461
|
+
// consults to filter tools. The bridge does not see these calls — it is
|
|
462
|
+
// session-state the MCP server owns (matches the Coplay model and the
|
|
463
|
+
// resolved decision in M18 execution-plan.md).
|
|
464
|
+
//
|
|
465
|
+
// Compiled-state availability (whether the bridge compiled the domain in)
|
|
466
|
+
// is reported in the `available` + `availableReason` fields per group. The
|
|
467
|
+
// MCP server detects this by querying the bridge /capabilities surface
|
|
468
|
+
// when reachable; when the bridge is offline it reports `available: null`
|
|
469
|
+
// (unknown) and the agent should fall back to `unity_open_mcp_capabilities`
|
|
470
|
+
// for the authoritative compiled-state report.
|
|
471
|
+
async routeManageTools(args) {
|
|
472
|
+
const action = typeof args.action === "string" ? args.action : "";
|
|
473
|
+
const group = typeof args.group === "string" ? args.group.trim() : "";
|
|
474
|
+
if (action === "list_groups") {
|
|
475
|
+
return this.manageToolsListGroups();
|
|
476
|
+
}
|
|
477
|
+
if (action === "reset") {
|
|
478
|
+
const before = this.sessionState.activeGroups();
|
|
479
|
+
this.sessionState.reset();
|
|
480
|
+
await this.maybeNotifyToolListChanged(before);
|
|
481
|
+
return this.manageToolsResult({
|
|
482
|
+
reset: true,
|
|
483
|
+
activeGroups: this.sessionState.activeGroups(),
|
|
484
|
+
message: "Tool-group visibility restored to defaults (`core` only). " +
|
|
485
|
+
"MCP clients that support listChanged will refresh ListTools automatically.",
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
if (action === "activate" || action === "deactivate") {
|
|
489
|
+
if (!group) {
|
|
490
|
+
return this.manageToolsError("missing_parameter", `'group' is required for action '${action}'.`);
|
|
491
|
+
}
|
|
492
|
+
if (!GROUP_IDS.has(group)) {
|
|
493
|
+
return this.manageToolsError("unknown_group", `Unknown group '${group}'. Valid ids: ${Array.from(GROUP_IDS)
|
|
494
|
+
.sort()
|
|
495
|
+
.join(", ")}.`);
|
|
496
|
+
}
|
|
497
|
+
const changed = action === "activate"
|
|
498
|
+
? this.sessionState.activate(group)
|
|
499
|
+
: this.sessionState.deactivate(group);
|
|
500
|
+
if (changed) {
|
|
501
|
+
await this.onToolListChanged?.();
|
|
502
|
+
}
|
|
503
|
+
return this.manageToolsResult({
|
|
504
|
+
action,
|
|
505
|
+
group,
|
|
506
|
+
changed,
|
|
507
|
+
activeGroups: this.sessionState.activeGroups(),
|
|
508
|
+
message: action === "activate"
|
|
509
|
+
? changed
|
|
510
|
+
? `Group '${group}' activated. Its tools will appear in subsequent ListTools responses; MCP clients that support listChanged will refresh automatically.`
|
|
511
|
+
: `Group '${group}' was already active.`
|
|
512
|
+
: changed
|
|
513
|
+
? `Group '${group}' deactivated. Its tools are now hidden from ListTools; MCP clients that support listChanged will refresh automatically.`
|
|
514
|
+
: `Group '${group}' was already inactive.`,
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
return this.manageToolsError("unknown_action", `Unknown action '${action}'. Valid actions: list_groups, activate, deactivate, reset.`);
|
|
518
|
+
}
|
|
519
|
+
async manageToolsListGroups() {
|
|
520
|
+
const groupsList = groupToTools();
|
|
521
|
+
const compiledAvailability = await this.resolveCompiledAvailability();
|
|
522
|
+
const groups = TOOL_GROUPS.map((g) => {
|
|
523
|
+
const tools = groupsList[g.id] ?? [];
|
|
524
|
+
const availability = compiledAvailability.get(g.id);
|
|
525
|
+
return {
|
|
526
|
+
id: g.id,
|
|
527
|
+
description: g.description,
|
|
528
|
+
active: this.sessionState.isGroupActive(g.id),
|
|
529
|
+
defaultEnabled: g.defaultEnabled,
|
|
530
|
+
// Compiled-state availability of the domain dependency. `true` for
|
|
531
|
+
// groups without a domainDefine (always compiled in); `false` /
|
|
532
|
+
// `null` (unknown — bridge offline) otherwise. Session activation
|
|
533
|
+
// is independent: an agent can activate a group whose dependency is
|
|
534
|
+
// missing; the tools will appear in ListTools but error at call
|
|
535
|
+
// time. capabilities is the authoritative compiled-state source.
|
|
536
|
+
available: availability?.available ?? null,
|
|
537
|
+
availableReason: availability?.reason ?? null,
|
|
538
|
+
unityPackage: g.unityPackage ?? null,
|
|
539
|
+
toolCount: tools.length,
|
|
540
|
+
tools,
|
|
541
|
+
};
|
|
542
|
+
});
|
|
543
|
+
return {
|
|
544
|
+
content: [
|
|
545
|
+
{
|
|
546
|
+
type: "text",
|
|
547
|
+
text: JSON.stringify({
|
|
548
|
+
groups,
|
|
549
|
+
activeGroups: this.sessionState.activeGroups(),
|
|
550
|
+
note: "Activate a group to add its tools to your ListTools surface; " +
|
|
551
|
+
"deactivate to hide them. State is per-session and ephemeral — " +
|
|
552
|
+
"it resets to `core`-only when the MCP server restarts. " +
|
|
553
|
+
"Compiled-state availability (the `available` field) reflects " +
|
|
554
|
+
"whether the Unity domain dependency is compiled in; use " +
|
|
555
|
+
"unity_open_mcp_capabilities for the authoritative compiled-state " +
|
|
556
|
+
"report.",
|
|
557
|
+
_source: "local",
|
|
558
|
+
}),
|
|
559
|
+
},
|
|
560
|
+
],
|
|
561
|
+
isError: false,
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Notify MCP clients when the filtered ListTools surface changed. Skips the
|
|
566
|
+
* callback when the active group set is unchanged (e.g. no-op reset).
|
|
567
|
+
*/
|
|
568
|
+
async maybeNotifyToolListChanged(before) {
|
|
569
|
+
if (!this.onToolListChanged)
|
|
570
|
+
return;
|
|
571
|
+
const after = this.sessionState.activeGroups();
|
|
572
|
+
if (activeGroupsEqual(before, after))
|
|
573
|
+
return;
|
|
574
|
+
await this.onToolListChanged();
|
|
575
|
+
}
|
|
576
|
+
// Resolve compiled-state availability per group from the live bridge. The
|
|
577
|
+
// bridge reports which tools it compiled in via `GET /tools`; a domain-
|
|
578
|
+
// gated group is `available: true` when any of its compiled-in tool names
|
|
579
|
+
// appears in that set, `false` when none do (Unity domain package not
|
|
580
|
+
// installed), and `null` (unknown) when the bridge is offline.
|
|
581
|
+
async resolveCompiledAvailability() {
|
|
582
|
+
const out = new Map();
|
|
583
|
+
const liveAvailable = await this.live.isLiveAvailable();
|
|
584
|
+
const inventory = liveAvailable ? await this.live.listBridgeTools() : null;
|
|
585
|
+
const groupsList = groupToTools();
|
|
586
|
+
for (const g of TOOL_GROUPS) {
|
|
587
|
+
if (!g.domainDefine) {
|
|
588
|
+
out.set(g.id, { available: true, reason: null });
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (!inventory) {
|
|
592
|
+
out.set(g.id, {
|
|
593
|
+
available: null,
|
|
594
|
+
reason: "Bridge offline — compiled-state availability unknown. Call " +
|
|
595
|
+
"unity_open_mcp_capabilities for the authoritative compiled-state " +
|
|
596
|
+
"report.",
|
|
597
|
+
});
|
|
598
|
+
continue;
|
|
599
|
+
}
|
|
600
|
+
const groupTools = groupsList[g.id] ?? [];
|
|
601
|
+
const anyCompiledIn = groupTools.length > 0 &&
|
|
602
|
+
groupTools.some((t) => inventory.tools.has(t));
|
|
603
|
+
out.set(g.id, {
|
|
604
|
+
available: anyCompiledIn,
|
|
605
|
+
reason: anyCompiledIn
|
|
606
|
+
? null
|
|
607
|
+
: `Unity package '${g.unityPackage}' not installed — the bridge ` +
|
|
608
|
+
`did not compile the ${g.domainDefine} domain.`,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
return out;
|
|
612
|
+
}
|
|
613
|
+
manageToolsResult(body) {
|
|
614
|
+
return {
|
|
615
|
+
content: [
|
|
616
|
+
{ type: "text", text: JSON.stringify({ ...body, _source: "local" }) },
|
|
617
|
+
],
|
|
618
|
+
isError: false,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
manageToolsError(code, message) {
|
|
622
|
+
return {
|
|
623
|
+
content: [
|
|
624
|
+
{
|
|
625
|
+
type: "text",
|
|
626
|
+
text: JSON.stringify({ error: { code, message }, _source: "local" }),
|
|
627
|
+
},
|
|
628
|
+
],
|
|
629
|
+
isError: true,
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
// testsuite-tauri phase-3 — bridge_status. Combines the instance-lock
|
|
633
|
+
// classifier (the same pure function the LiveClient uses for dead-bridge
|
|
634
|
+
// detection) with a single /ping probe. The /ping is driven through the
|
|
635
|
+
// LiveClient's ping handler so it mirrors what `unity_open_mcp_ping` and
|
|
636
|
+
// the CLI `ping`/`wait-for-ready` see (auth header, ping cache, body shape).
|
|
637
|
+
//
|
|
638
|
+
// The coarse `status` token is derived from the two signals:
|
|
639
|
+
//
|
|
640
|
+
// lock="dead_bridge" → "dead_bridge"
|
|
641
|
+
// /ping reachable, compiling=true → "compiling"
|
|
642
|
+
// /ping reachable, connected=true → "running"
|
|
643
|
+
// otherwise (offline / toolbar off / gone) → "stopped"
|
|
644
|
+
//
|
|
645
|
+
// "stopped" intentionally folds two indistinguishable cases from the
|
|
646
|
+
// MCP-server's vantage point: Unity is not running at all, OR Unity is
|
|
647
|
+
// running but the operator toggled the bridge off via the toolbar. The
|
|
648
|
+
// lock summary in the response disambiguates them (`lock === null` → no
|
|
649
|
+
// Unity; `lock.pid` alive but no listener → toolbar off). The tool never
|
|
650
|
+
// errors on an offline bridge — `stopped` IS the answer in that case.
|
|
651
|
+
async routeBridgeStatus(_args) {
|
|
652
|
+
const lockOnDisk = lockPath(this.projectPath);
|
|
653
|
+
let lock = null;
|
|
654
|
+
try {
|
|
655
|
+
lock = readInstanceLock(this.projectPath);
|
|
656
|
+
}
|
|
657
|
+
catch {
|
|
658
|
+
// Unreadable lock → treat as no lock (gone).
|
|
659
|
+
lock = null;
|
|
660
|
+
}
|
|
661
|
+
const classification = classifyInstance(lock);
|
|
662
|
+
// One /ping probe. The LiveClient's ping handler returns the full body
|
|
663
|
+
// on success, or an isError result with `bridge_offline` on ECONNREFUSED
|
|
664
|
+
// — both shapes are valid inputs here. A compile-in-progress bridge
|
|
665
|
+
// returns HTTP 503 from /ping which isLiveAvailable() treats as reachable;
|
|
666
|
+
// the ping body's `compiling` field is the authoritative signal.
|
|
667
|
+
const pingResult = await this.live.route("unity_open_mcp_ping", {});
|
|
668
|
+
const pingBody = parsePingBody(pingResult);
|
|
669
|
+
const pingReachable = !pingResult.isError && pingBody !== null;
|
|
670
|
+
const compiling = pingReachable === true && pingBody?.compiling === true;
|
|
671
|
+
const connected = pingReachable === true && pingBody?.connected === true;
|
|
672
|
+
let status;
|
|
673
|
+
if (classification === "dead_bridge") {
|
|
674
|
+
status = "dead_bridge";
|
|
675
|
+
}
|
|
676
|
+
else if (compiling) {
|
|
677
|
+
status = "compiling";
|
|
678
|
+
}
|
|
679
|
+
else if (connected) {
|
|
680
|
+
status = "running";
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
status = "stopped";
|
|
684
|
+
}
|
|
685
|
+
const body = {
|
|
686
|
+
status,
|
|
687
|
+
// Coarse ready flag for clients that want a single boolean: true only
|
|
688
|
+
// when the bridge is connected AND idle (the same rule wait-for-ready
|
|
689
|
+
// uses for poll termination).
|
|
690
|
+
ready: status === "running",
|
|
691
|
+
projectPath: this.projectPath,
|
|
692
|
+
instance: {
|
|
693
|
+
lockPath: lockOnDisk,
|
|
694
|
+
classification,
|
|
695
|
+
lock: lock ? summarizeBridgeStatusLock(lock) : null,
|
|
696
|
+
},
|
|
697
|
+
ping: pingReachable
|
|
698
|
+
? {
|
|
699
|
+
reachable: true,
|
|
700
|
+
connected: pingBody?.connected ?? null,
|
|
701
|
+
compiling: pingBody?.compiling ?? null,
|
|
702
|
+
isPlaying: pingBody?.isPlaying ?? null,
|
|
703
|
+
unityVersion: pingBody?.unityVersion ?? null,
|
|
704
|
+
bridgeVersion: pingBody?.bridgeVersion ?? null,
|
|
705
|
+
mode: pingBody?.mode ?? null,
|
|
706
|
+
}
|
|
707
|
+
: { reachable: false },
|
|
708
|
+
nextStep: bridgeStatusNextStep(status),
|
|
709
|
+
_source: "local",
|
|
710
|
+
};
|
|
711
|
+
// bridge_status never reports an error — even a stopped bridge is a
|
|
712
|
+
// successful status read. _source=local because the synthesis happens in
|
|
713
|
+
// the MCP server (no bridge tool endpoint, no batch Unity).
|
|
714
|
+
return {
|
|
715
|
+
content: [{ type: "text", text: JSON.stringify(body) }],
|
|
716
|
+
isError: false,
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
async routeFindReferences(args) {
|
|
720
|
+
const liveAvailable = await this.live.isLiveAvailable();
|
|
721
|
+
if (liveAvailable) {
|
|
722
|
+
console.error("[unity-open-mcp] Route: find_references -> live");
|
|
723
|
+
const result = await this.live.route("unity_open_mcp_find_references", args);
|
|
724
|
+
return injectRouteMeta(result, { route: "live" });
|
|
725
|
+
}
|
|
726
|
+
console.error("[unity-open-mcp] Route: find_references -> offline (live bridge unavailable)");
|
|
727
|
+
const assetPath = typeof args.asset_path === "string" ? args.asset_path : undefined;
|
|
728
|
+
const guid = typeof args.guid === "string" ? args.guid : undefined;
|
|
729
|
+
if (!assetPath && !guid) {
|
|
730
|
+
return {
|
|
731
|
+
content: [
|
|
732
|
+
{
|
|
733
|
+
type: "text",
|
|
734
|
+
text: JSON.stringify({
|
|
735
|
+
error: {
|
|
736
|
+
code: "missing_parameter",
|
|
737
|
+
message: "Either 'asset_path' or 'guid' is required.",
|
|
738
|
+
},
|
|
739
|
+
}),
|
|
740
|
+
},
|
|
741
|
+
],
|
|
742
|
+
isError: true,
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
try {
|
|
746
|
+
const result = await findReferencesOffline({
|
|
747
|
+
assetPath,
|
|
748
|
+
guid,
|
|
749
|
+
detail: typeof args.detail === "string" ? args.detail : "normal",
|
|
750
|
+
maxResults: typeof args.max_results === "number" ? args.max_results : 100,
|
|
751
|
+
maxPerFile: typeof args.max_per_file === "number" ? args.max_per_file : 5,
|
|
752
|
+
patternThreshold: typeof args.pattern_threshold === "number" ? args.pattern_threshold : 0,
|
|
753
|
+
projectRoot: this.projectPath,
|
|
754
|
+
});
|
|
755
|
+
return {
|
|
756
|
+
content: [
|
|
757
|
+
{ type: "text", text: JSON.stringify({ ...result, _source: "offline" }) },
|
|
758
|
+
],
|
|
759
|
+
isError: false,
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
catch (err) {
|
|
763
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
764
|
+
return {
|
|
765
|
+
content: [
|
|
766
|
+
{
|
|
767
|
+
type: "text",
|
|
768
|
+
text: JSON.stringify({
|
|
769
|
+
error: { code: "offline_error", message },
|
|
770
|
+
}),
|
|
771
|
+
},
|
|
772
|
+
],
|
|
773
|
+
isError: true,
|
|
774
|
+
};
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
//# sourceMappingURL=tool-router.js.map
|