unity-open-mcp 0.1.2 → 0.3.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.
Files changed (447) hide show
  1. package/dist/agent-identity.d.ts +52 -0
  2. package/dist/agent-identity.js +115 -0
  3. package/dist/agent-identity.js.map +1 -0
  4. package/dist/batch-spawn.d.ts +7 -0
  5. package/dist/batch-spawn.js +155 -29
  6. package/dist/batch-spawn.js.map +1 -1
  7. package/dist/capabilities/build-capabilities.d.ts +45 -0
  8. package/dist/capabilities/build-capabilities.js +262 -27
  9. package/dist/capabilities/build-capabilities.js.map +1 -1
  10. package/dist/capabilities/cost-hints.d.ts +82 -0
  11. package/dist/capabilities/cost-hints.js +185 -0
  12. package/dist/capabilities/cost-hints.js.map +1 -0
  13. package/dist/capabilities/lifecycle.d.ts +40 -0
  14. package/dist/capabilities/lifecycle.js +353 -0
  15. package/dist/capabilities/lifecycle.js.map +1 -0
  16. package/dist/capabilities/rule-catalog.d.ts +13 -1
  17. package/dist/capabilities/rule-catalog.js +620 -75
  18. package/dist/capabilities/rule-catalog.js.map +1 -1
  19. package/dist/capabilities/tool-groups.d.ts +21 -0
  20. package/dist/capabilities/tool-groups.js +411 -14
  21. package/dist/capabilities/tool-groups.js.map +1 -1
  22. package/dist/cli/args.d.ts +32 -1
  23. package/dist/cli/args.js +201 -4
  24. package/dist/cli/args.js.map +1 -1
  25. package/dist/cli/cli.d.ts +21 -0
  26. package/dist/cli/cli.js +68 -5
  27. package/dist/cli/cli.js.map +1 -1
  28. package/dist/cli/commands.d.ts +33 -0
  29. package/dist/cli/commands.js +400 -0
  30. package/dist/cli/commands.js.map +1 -1
  31. package/dist/cli/exit-codes.d.ts +43 -0
  32. package/dist/cli/exit-codes.js +78 -0
  33. package/dist/cli/exit-codes.js.map +1 -0
  34. package/dist/compile-verify.d.ts +65 -0
  35. package/dist/compile-verify.js +94 -0
  36. package/dist/compile-verify.js.map +1 -0
  37. package/dist/compressible-router.js +64 -11
  38. package/dist/compressible-router.js.map +1 -1
  39. package/dist/compression/asset-model.d.ts +15 -0
  40. package/dist/compression/compact.d.ts +5 -4
  41. package/dist/compression/compact.js +13 -10
  42. package/dist/compression/compact.js.map +1 -1
  43. package/dist/dialog-dismiss.d.ts +127 -74
  44. package/dist/dialog-dismiss.js +427 -170
  45. package/dist/dialog-dismiss.js.map +1 -1
  46. package/dist/dialog-policy.d.ts +141 -0
  47. package/dist/dialog-policy.js +345 -0
  48. package/dist/dialog-policy.js.map +1 -0
  49. package/dist/gate-error.d.ts +6 -0
  50. package/dist/gate-error.js +13 -2
  51. package/dist/gate-error.js.map +1 -1
  52. package/dist/hub-control.d.ts +247 -0
  53. package/dist/hub-control.js +703 -0
  54. package/dist/hub-control.js.map +1 -0
  55. package/dist/index.d.ts +1 -1
  56. package/dist/index.js +46 -12
  57. package/dist/index.js.map +1 -1
  58. package/dist/live-client.d.ts +123 -3
  59. package/dist/live-client.js +526 -69
  60. package/dist/live-client.js.map +1 -1
  61. package/dist/offline.d.ts +105 -0
  62. package/dist/offline.js +816 -23
  63. package/dist/offline.js.map +1 -1
  64. package/dist/output-profile.d.ts +110 -0
  65. package/dist/output-profile.js +255 -0
  66. package/dist/output-profile.js.map +1 -0
  67. package/dist/retry-policy.d.ts +72 -0
  68. package/dist/retry-policy.js +146 -0
  69. package/dist/retry-policy.js.map +1 -0
  70. package/dist/routers.d.ts +4 -0
  71. package/dist/routers.js +2 -2
  72. package/dist/routers.js.map +1 -1
  73. package/dist/server-instructions.d.ts +18 -0
  74. package/dist/server-instructions.js +145 -0
  75. package/dist/server-instructions.js.map +1 -0
  76. package/dist/tool-router.d.ts +38 -1
  77. package/dist/tool-router.js +690 -37
  78. package/dist/tool-router.js.map +1 -1
  79. package/dist/tool-session-state.d.ts +37 -0
  80. package/dist/tool-session-state.js +78 -1
  81. package/dist/tool-session-state.js.map +1 -1
  82. package/dist/tools/apply-fix.js +16 -2
  83. package/dist/tools/apply-fix.js.map +1 -1
  84. package/dist/tools/asmdef-create.d.ts +2 -0
  85. package/dist/tools/asmdef-create.js +114 -0
  86. package/dist/tools/asmdef-create.js.map +1 -0
  87. package/dist/tools/asmdef-get.d.ts +2 -0
  88. package/dist/tools/asmdef-get.js +31 -0
  89. package/dist/tools/asmdef-get.js.map +1 -0
  90. package/dist/tools/asmdef-list.d.ts +2 -0
  91. package/dist/tools/asmdef-list.js +41 -0
  92. package/dist/tools/asmdef-list.js.map +1 -0
  93. package/dist/tools/asmdef-modify.d.ts +2 -0
  94. package/dist/tools/asmdef-modify.js +108 -0
  95. package/dist/tools/asmdef-modify.js.map +1 -0
  96. package/dist/tools/audio-listener-get.d.ts +2 -0
  97. package/dist/tools/audio-listener-get.js +16 -0
  98. package/dist/tools/audio-listener-get.js.map +1 -0
  99. package/dist/tools/audio-mixer-get-parameter.d.ts +2 -0
  100. package/dist/tools/audio-mixer-get-parameter.js +25 -0
  101. package/dist/tools/audio-mixer-get-parameter.js.map +1 -0
  102. package/dist/tools/audio-mixer-set-parameter.d.ts +2 -0
  103. package/dist/tools/audio-mixer-set-parameter.js +44 -0
  104. package/dist/tools/audio-mixer-set-parameter.js.map +1 -0
  105. package/dist/tools/audio-source-add.d.ts +2 -0
  106. package/dist/tools/audio-source-add.js +94 -0
  107. package/dist/tools/audio-source-add.js.map +1 -0
  108. package/dist/tools/audio-source-modify.d.ts +2 -0
  109. package/dist/tools/audio-source-modify.js +52 -0
  110. package/dist/tools/audio-source-modify.js.map +1 -0
  111. package/dist/tools/bridge-status.js +16 -6
  112. package/dist/tools/bridge-status.js.map +1 -1
  113. package/dist/tools/build-get-active-target.js +1 -2
  114. package/dist/tools/build-get-active-target.js.map +1 -1
  115. package/dist/tools/build-get-defines.js +1 -1
  116. package/dist/tools/build-get-defines.js.map +1 -1
  117. package/dist/tools/build-get-scenes.js +1 -2
  118. package/dist/tools/build-get-scenes.js.map +1 -1
  119. package/dist/tools/build-get-targets.js +1 -1
  120. package/dist/tools/build-get-targets.js.map +1 -1
  121. package/dist/tools/build-set-defines.js +1 -2
  122. package/dist/tools/build-set-defines.js.map +1 -1
  123. package/dist/tools/build-set-scenes.js +1 -1
  124. package/dist/tools/build-set-scenes.js.map +1 -1
  125. package/dist/tools/build-set-target.js +1 -1
  126. package/dist/tools/build-set-target.js.map +1 -1
  127. package/dist/tools/build-start.js +0 -1
  128. package/dist/tools/build-start.js.map +1 -1
  129. package/dist/tools/cinemachine-brain-ensure.d.ts +2 -0
  130. package/dist/tools/cinemachine-brain-ensure.js +27 -0
  131. package/dist/tools/cinemachine-brain-ensure.js.map +1 -0
  132. package/dist/tools/cinemachine-camera-list.d.ts +2 -0
  133. package/dist/tools/cinemachine-camera-list.js +15 -0
  134. package/dist/tools/cinemachine-camera-list.js.map +1 -0
  135. package/dist/tools/cinemachine-create-camera.d.ts +2 -0
  136. package/dist/tools/cinemachine-create-camera.js +55 -0
  137. package/dist/tools/cinemachine-create-camera.js.map +1 -0
  138. package/dist/tools/cinemachine-set-body.d.ts +2 -0
  139. package/dist/tools/cinemachine-set-body.js +33 -0
  140. package/dist/tools/cinemachine-set-body.js.map +1 -0
  141. package/dist/tools/cinemachine-set-lens.d.ts +2 -0
  142. package/dist/tools/cinemachine-set-lens.js +41 -0
  143. package/dist/tools/cinemachine-set-lens.js.map +1 -0
  144. package/dist/tools/cinemachine-set-noise.d.ts +2 -0
  145. package/dist/tools/cinemachine-set-noise.js +31 -0
  146. package/dist/tools/cinemachine-set-noise.js.map +1 -0
  147. package/dist/tools/cinemachine-set-targets.d.ts +2 -0
  148. package/dist/tools/cinemachine-set-targets.js +30 -0
  149. package/dist/tools/cinemachine-set-targets.js.map +1 -0
  150. package/dist/tools/console-log.js +2 -2
  151. package/dist/tools/console-log.js.map +1 -1
  152. package/dist/tools/constraint-add.d.ts +2 -0
  153. package/dist/tools/constraint-add.js +85 -0
  154. package/dist/tools/constraint-add.js.map +1 -0
  155. package/dist/tools/dependencies.d.ts +2 -0
  156. package/dist/tools/dependencies.js +76 -0
  157. package/dist/tools/dependencies.js.map +1 -0
  158. package/dist/tools/editor-add-tag.js +2 -3
  159. package/dist/tools/editor-add-tag.js.map +1 -1
  160. package/dist/tools/editor-clear-history.d.ts +2 -0
  161. package/dist/tools/editor-clear-history.js +25 -0
  162. package/dist/tools/editor-clear-history.js.map +1 -0
  163. package/dist/tools/editor-get-layers.js +3 -3
  164. package/dist/tools/editor-get-layers.js.map +1 -1
  165. package/dist/tools/editor-get-tags.js +2 -2
  166. package/dist/tools/editor-get-tags.js.map +1 -1
  167. package/dist/tools/editor-redo.js +2 -3
  168. package/dist/tools/editor-redo.js.map +1 -1
  169. package/dist/tools/editor-undo-history.d.ts +2 -0
  170. package/dist/tools/editor-undo-history.js +21 -0
  171. package/dist/tools/editor-undo-history.js.map +1 -0
  172. package/dist/tools/editor-undo.js +3 -3
  173. package/dist/tools/editor-undo.js.map +1 -1
  174. package/dist/tools/editorprefs-delete.d.ts +2 -0
  175. package/dist/tools/editorprefs-delete.js +23 -0
  176. package/dist/tools/editorprefs-delete.js.map +1 -0
  177. package/dist/tools/editorprefs-get.d.ts +2 -0
  178. package/dist/tools/editorprefs-get.js +28 -0
  179. package/dist/tools/editorprefs-get.js.map +1 -0
  180. package/dist/tools/editorprefs-set.d.ts +2 -0
  181. package/dist/tools/editorprefs-set.js +33 -0
  182. package/dist/tools/editorprefs-set.js.map +1 -0
  183. package/dist/tools/find-references.js +24 -4
  184. package/dist/tools/find-references.js.map +1 -1
  185. package/dist/tools/frame-debugger.d.ts +2 -0
  186. package/dist/tools/frame-debugger.js +48 -0
  187. package/dist/tools/frame-debugger.js.map +1 -0
  188. package/dist/tools/gameobject-modify.js +69 -2
  189. package/dist/tools/gameobject-modify.js.map +1 -1
  190. package/dist/tools/gate-budget-estimate.js +2 -1
  191. package/dist/tools/gate-budget-estimate.js.map +1 -1
  192. package/dist/tools/hub-available-releases.d.ts +2 -0
  193. package/dist/tools/hub-available-releases.js +23 -0
  194. package/dist/tools/hub-available-releases.js.map +1 -0
  195. package/dist/tools/hub-get-install-path.d.ts +2 -0
  196. package/dist/tools/hub-get-install-path.js +20 -0
  197. package/dist/tools/hub-get-install-path.js.map +1 -0
  198. package/dist/tools/hub-install-editor.d.ts +2 -0
  199. package/dist/tools/hub-install-editor.js +47 -0
  200. package/dist/tools/hub-install-editor.js.map +1 -0
  201. package/dist/tools/hub-install-modules.d.ts +2 -0
  202. package/dist/tools/hub-install-modules.js +44 -0
  203. package/dist/tools/hub-install-modules.js.map +1 -0
  204. package/dist/tools/hub-list-editors.d.ts +2 -0
  205. package/dist/tools/hub-list-editors.js +25 -0
  206. package/dist/tools/hub-list-editors.js.map +1 -0
  207. package/dist/tools/hub-set-install-path.d.ts +2 -0
  208. package/dist/tools/hub-set-install-path.js +30 -0
  209. package/dist/tools/hub-set-install-path.js.map +1 -0
  210. package/dist/tools/impact-preview.js +2 -2
  211. package/dist/tools/impact-preview.js.map +1 -1
  212. package/dist/tools/index.d.ts +14 -0
  213. package/dist/tools/index.js +534 -24
  214. package/dist/tools/index.js.map +1 -1
  215. package/dist/tools/light-add.d.ts +2 -0
  216. package/dist/tools/light-add.js +73 -0
  217. package/dist/tools/light-add.js.map +1 -0
  218. package/dist/tools/light-modify.d.ts +2 -0
  219. package/dist/tools/light-modify.js +36 -0
  220. package/dist/tools/light-modify.js.map +1 -0
  221. package/dist/tools/light-set.d.ts +2 -0
  222. package/dist/tools/light-set.js +54 -0
  223. package/dist/tools/light-set.js.map +1 -0
  224. package/dist/tools/list-assets-of-type.d.ts +2 -0
  225. package/dist/tools/list-assets-of-type.js +54 -0
  226. package/dist/tools/list-assets-of-type.js.map +1 -0
  227. package/dist/tools/lod-add-level.d.ts +2 -0
  228. package/dist/tools/lod-add-level.js +66 -0
  229. package/dist/tools/lod-add-level.js.map +1 -0
  230. package/dist/tools/lod-group-configure.d.ts +2 -0
  231. package/dist/tools/lod-group-configure.js +64 -0
  232. package/dist/tools/lod-group-configure.js.map +1 -0
  233. package/dist/tools/manage-tools.js +7 -5
  234. package/dist/tools/manage-tools.js.map +1 -1
  235. package/dist/tools/memory-snapshot-capture.d.ts +2 -0
  236. package/dist/tools/memory-snapshot-capture.js +61 -0
  237. package/dist/tools/memory-snapshot-capture.js.map +1 -0
  238. package/dist/tools/mutation-explain.js +2 -2
  239. package/dist/tools/mutation-explain.js.map +1 -1
  240. package/dist/tools/playerprefs-delete.d.ts +2 -0
  241. package/dist/tools/playerprefs-delete.js +24 -0
  242. package/dist/tools/playerprefs-delete.js.map +1 -0
  243. package/dist/tools/playerprefs-get.d.ts +2 -0
  244. package/dist/tools/playerprefs-get.js +28 -0
  245. package/dist/tools/playerprefs-get.js.map +1 -0
  246. package/dist/tools/playerprefs-set.d.ts +2 -0
  247. package/dist/tools/playerprefs-set.js +37 -0
  248. package/dist/tools/playerprefs-set.js.map +1 -0
  249. package/dist/tools/profiler-capture-frame.d.ts +2 -0
  250. package/dist/tools/profiler-capture-frame.js +75 -0
  251. package/dist/tools/profiler-capture-frame.js.map +1 -0
  252. package/dist/tools/profiler-clear-data.js +1 -2
  253. package/dist/tools/profiler-clear-data.js.map +1 -1
  254. package/dist/tools/profiler-enable-module.js +4 -5
  255. package/dist/tools/profiler-enable-module.js.map +1 -1
  256. package/dist/tools/profiler-get-status.js +5 -6
  257. package/dist/tools/profiler-get-status.js.map +1 -1
  258. package/dist/tools/profiler-load-data.js +4 -5
  259. package/dist/tools/profiler-load-data.js.map +1 -1
  260. package/dist/tools/profiler-save-data.js +3 -3
  261. package/dist/tools/profiler-save-data.js.map +1 -1
  262. package/dist/tools/profiler-set-config.js +5 -5
  263. package/dist/tools/profiler-set-config.js.map +1 -1
  264. package/dist/tools/profiler-start.js +4 -4
  265. package/dist/tools/profiler-start.js.map +1 -1
  266. package/dist/tools/profiler-stop.js +2 -3
  267. package/dist/tools/profiler-stop.js.map +1 -1
  268. package/dist/tools/read-asset.js +21 -3
  269. package/dist/tools/read-asset.js.map +1 -1
  270. package/dist/tools/reflection-probe-bake.d.ts +2 -0
  271. package/dist/tools/reflection-probe-bake.js +47 -0
  272. package/dist/tools/reflection-probe-bake.js.map +1 -0
  273. package/dist/tools/reflection-probe-get.d.ts +2 -0
  274. package/dist/tools/reflection-probe-get.js +19 -0
  275. package/dist/tools/reflection-probe-get.js.map +1 -0
  276. package/dist/tools/reimport-package.d.ts +2 -0
  277. package/dist/tools/reimport-package.js +53 -0
  278. package/dist/tools/reimport-package.js.map +1 -0
  279. package/dist/tools/scan-paths.js +19 -0
  280. package/dist/tools/scan-paths.js.map +1 -1
  281. package/dist/tools/scene-focus.js +1 -1
  282. package/dist/tools/scene-focus.js.map +1 -1
  283. package/dist/tools/scene-get-data.js +31 -13
  284. package/dist/tools/scene-get-data.js.map +1 -1
  285. package/dist/tools/scene-get-dirty-summary.js +1 -1
  286. package/dist/tools/scene-get-dirty-summary.js.map +1 -1
  287. package/dist/tools/sceneview-get-camera.d.ts +2 -0
  288. package/dist/tools/sceneview-get-camera.js +16 -0
  289. package/dist/tools/sceneview-get-camera.js.map +1 -0
  290. package/dist/tools/sceneview-set-camera.d.ts +2 -0
  291. package/dist/tools/sceneview-set-camera.js +58 -0
  292. package/dist/tools/sceneview-set-camera.js.map +1 -0
  293. package/dist/tools/script-write.js +2 -2
  294. package/dist/tools/script-write.js.map +1 -1
  295. package/dist/tools/scriptableobject-create.d.ts +2 -0
  296. package/dist/tools/scriptableobject-create.js +86 -0
  297. package/dist/tools/scriptableobject-create.js.map +1 -0
  298. package/dist/tools/search-assets.js +20 -3
  299. package/dist/tools/search-assets.js.map +1 -1
  300. package/dist/tools/settings-get-lighting.js +3 -4
  301. package/dist/tools/settings-get-lighting.js.map +1 -1
  302. package/dist/tools/settings-get-player.js +2 -2
  303. package/dist/tools/settings-get-player.js.map +1 -1
  304. package/dist/tools/settings-get-quality.js +1 -2
  305. package/dist/tools/settings-get-quality.js.map +1 -1
  306. package/dist/tools/settings-get-render-pipeline.d.ts +2 -0
  307. package/dist/tools/settings-get-render-pipeline.js +19 -0
  308. package/dist/tools/settings-get-render-pipeline.js.map +1 -0
  309. package/dist/tools/settings-get-time.d.ts +2 -0
  310. package/dist/tools/settings-get-time.js +18 -0
  311. package/dist/tools/settings-get-time.js.map +1 -0
  312. package/dist/tools/settings-set-lighting.js +5 -5
  313. package/dist/tools/settings-set-lighting.js.map +1 -1
  314. package/dist/tools/settings-set-physics.js +2 -2
  315. package/dist/tools/settings-set-physics.js.map +1 -1
  316. package/dist/tools/settings-set-player.js +2 -2
  317. package/dist/tools/settings-set-player.js.map +1 -1
  318. package/dist/tools/settings-set-quality-level.d.ts +2 -0
  319. package/dist/tools/settings-set-quality-level.js +44 -0
  320. package/dist/tools/settings-set-quality-level.js.map +1 -0
  321. package/dist/tools/settings-set-quality.js +2 -2
  322. package/dist/tools/settings-set-quality.js.map +1 -1
  323. package/dist/tools/settings-set-time.d.ts +2 -0
  324. package/dist/tools/settings-set-time.js +53 -0
  325. package/dist/tools/settings-set-time.js.map +1 -0
  326. package/dist/tools/shader-get-data.js +3 -3
  327. package/dist/tools/shader-get-data.js.map +1 -1
  328. package/dist/tools/shader-graph-create.d.ts +2 -0
  329. package/dist/tools/shader-graph-create.js +40 -0
  330. package/dist/tools/shader-graph-create.js.map +1 -0
  331. package/dist/tools/shader-graph-node-add.d.ts +2 -0
  332. package/dist/tools/shader-graph-node-add.js +50 -0
  333. package/dist/tools/shader-graph-node-add.js.map +1 -0
  334. package/dist/tools/shader-graph-node-connect.d.ts +2 -0
  335. package/dist/tools/shader-graph-node-connect.js +60 -0
  336. package/dist/tools/shader-graph-node-connect.js.map +1 -0
  337. package/dist/tools/shader-graph-open.d.ts +2 -0
  338. package/dist/tools/shader-graph-open.js +29 -0
  339. package/dist/tools/shader-graph-open.js.map +1 -0
  340. package/dist/tools/skybox-get.d.ts +2 -0
  341. package/dist/tools/skybox-get.js +13 -0
  342. package/dist/tools/skybox-get.js.map +1 -0
  343. package/dist/tools/skybox-set.d.ts +2 -0
  344. package/dist/tools/skybox-set.js +34 -0
  345. package/dist/tools/skybox-set.js.map +1 -0
  346. package/dist/tools/spriteatlas-add-packable.d.ts +2 -0
  347. package/dist/tools/spriteatlas-add-packable.js +40 -0
  348. package/dist/tools/spriteatlas-add-packable.js.map +1 -0
  349. package/dist/tools/spriteatlas-create.d.ts +2 -0
  350. package/dist/tools/spriteatlas-create.js +41 -0
  351. package/dist/tools/spriteatlas-create.js.map +1 -0
  352. package/dist/tools/spriteatlas-delete.d.ts +2 -0
  353. package/dist/tools/spriteatlas-delete.js +32 -0
  354. package/dist/tools/spriteatlas-delete.js.map +1 -0
  355. package/dist/tools/spriteatlas-get.d.ts +2 -0
  356. package/dist/tools/spriteatlas-get.js +23 -0
  357. package/dist/tools/spriteatlas-get.js.map +1 -0
  358. package/dist/tools/spriteatlas-list.d.ts +2 -0
  359. package/dist/tools/spriteatlas-list.js +21 -0
  360. package/dist/tools/spriteatlas-list.js.map +1 -0
  361. package/dist/tools/spriteatlas-modify.d.ts +2 -0
  362. package/dist/tools/spriteatlas-modify.js +55 -0
  363. package/dist/tools/spriteatlas-modify.js.map +1 -0
  364. package/dist/tools/spriteatlas-remove-packable.d.ts +2 -0
  365. package/dist/tools/spriteatlas-remove-packable.js +39 -0
  366. package/dist/tools/spriteatlas-remove-packable.js.map +1 -0
  367. package/dist/tools/terrain-create.d.ts +2 -0
  368. package/dist/tools/terrain-create.js +73 -0
  369. package/dist/tools/terrain-create.js.map +1 -0
  370. package/dist/tools/terrain-paint-layer.d.ts +2 -0
  371. package/dist/tools/terrain-paint-layer.js +85 -0
  372. package/dist/tools/terrain-paint-layer.js.map +1 -0
  373. package/dist/tools/terrain-place-trees.d.ts +2 -0
  374. package/dist/tools/terrain-place-trees.js +92 -0
  375. package/dist/tools/terrain-place-trees.js.map +1 -0
  376. package/dist/tools/terrain-set-heights.d.ts +2 -0
  377. package/dist/tools/terrain-set-heights.js +68 -0
  378. package/dist/tools/terrain-set-heights.js.map +1 -0
  379. package/dist/tools/terrain-set-neighbors.d.ts +2 -0
  380. package/dist/tools/terrain-set-neighbors.js +65 -0
  381. package/dist/tools/terrain-set-neighbors.js.map +1 -0
  382. package/dist/tools/texture-get-importer.d.ts +2 -0
  383. package/dist/tools/texture-get-importer.js +25 -0
  384. package/dist/tools/texture-get-importer.js.map +1 -0
  385. package/dist/tools/texture-get.d.ts +2 -0
  386. package/dist/tools/texture-get.js +23 -0
  387. package/dist/tools/texture-get.js.map +1 -0
  388. package/dist/tools/texture-reimport.d.ts +2 -0
  389. package/dist/tools/texture-reimport.js +33 -0
  390. package/dist/tools/texture-reimport.js.map +1 -0
  391. package/dist/tools/texture-set-import.d.ts +2 -0
  392. package/dist/tools/texture-set-import.js +52 -0
  393. package/dist/tools/texture-set-import.js.map +1 -0
  394. package/dist/tools/tilemap-box-fill.d.ts +2 -0
  395. package/dist/tools/tilemap-box-fill.js +32 -0
  396. package/dist/tools/tilemap-box-fill.js.map +1 -0
  397. package/dist/tools/tilemap-create-rule-tile.d.ts +2 -0
  398. package/dist/tools/tilemap-create-rule-tile.js +39 -0
  399. package/dist/tools/tilemap-create-rule-tile.js.map +1 -0
  400. package/dist/tools/tilemap-create-tile-asset.d.ts +2 -0
  401. package/dist/tools/tilemap-create-tile-asset.js +35 -0
  402. package/dist/tools/tilemap-create-tile-asset.js.map +1 -0
  403. package/dist/tools/tilemap-create.d.ts +2 -0
  404. package/dist/tools/tilemap-create.js +32 -0
  405. package/dist/tools/tilemap-create.js.map +1 -0
  406. package/dist/tools/tilemap-set-tile.d.ts +2 -0
  407. package/dist/tools/tilemap-set-tile.js +33 -0
  408. package/dist/tools/tilemap-set-tile.js.map +1 -0
  409. package/dist/tools/timeline-clip-add.d.ts +2 -0
  410. package/dist/tools/timeline-clip-add.js +43 -0
  411. package/dist/tools/timeline-clip-add.js.map +1 -0
  412. package/dist/tools/timeline-create.d.ts +2 -0
  413. package/dist/tools/timeline-create.js +32 -0
  414. package/dist/tools/timeline-create.js.map +1 -0
  415. package/dist/tools/timeline-director-bind.d.ts +2 -0
  416. package/dist/tools/timeline-director-bind.js +34 -0
  417. package/dist/tools/timeline-director-bind.js.map +1 -0
  418. package/dist/tools/timeline-modify.d.ts +2 -0
  419. package/dist/tools/timeline-modify.js +44 -0
  420. package/dist/tools/timeline-modify.js.map +1 -0
  421. package/dist/tools/timeline-track-add.d.ts +2 -0
  422. package/dist/tools/timeline-track-add.js +37 -0
  423. package/dist/tools/timeline-track-add.js.map +1 -0
  424. package/dist/tools/ui-canvas-add.d.ts +2 -0
  425. package/dist/tools/ui-canvas-add.js +66 -0
  426. package/dist/tools/ui-canvas-add.js.map +1 -0
  427. package/dist/tools/ui-element-add.d.ts +2 -0
  428. package/dist/tools/ui-element-add.js +65 -0
  429. package/dist/tools/ui-element-add.js.map +1 -0
  430. package/dist/tools/ui-element-modify.d.ts +2 -0
  431. package/dist/tools/ui-element-modify.js +59 -0
  432. package/dist/tools/ui-element-modify.js.map +1 -0
  433. package/dist/tools/ui-layout-group-add.d.ts +2 -0
  434. package/dist/tools/ui-layout-group-add.js +80 -0
  435. package/dist/tools/ui-layout-group-add.js.map +1 -0
  436. package/dist/tools/validate-edit.js +22 -1
  437. package/dist/tools/validate-edit.js.map +1 -1
  438. package/dist/tools/vfx-block-edit.d.ts +2 -0
  439. package/dist/tools/vfx-block-edit.js +51 -0
  440. package/dist/tools/vfx-block-edit.js.map +1 -0
  441. package/dist/tools/vfx-list.d.ts +2 -0
  442. package/dist/tools/vfx-list.js +31 -0
  443. package/dist/tools/vfx-list.js.map +1 -0
  444. package/dist/tools/vfx-open.d.ts +2 -0
  445. package/dist/tools/vfx-open.js +29 -0
  446. package/dist/tools/vfx-open.js.map +1 -0
  447. package/package.json +1 -1
@@ -0,0 +1,255 @@
1
+ // M22 Plan 1 — Token-budget-aware output profiles + uniform paging.
2
+ //
3
+ // Single source of truth for two envelope concerns shared by the heavy tools
4
+ // (read_asset / search_assets / scene_get_data / find_references / validate_edit
5
+ // / scan_paths):
6
+ //
7
+ // 1. **Output profiles** (`compact` | `balanced` | `full`) — a uniform knob that
8
+ // maps onto each tool's existing `detail` axis (summary / normal / verbose).
9
+ // This reuses the M9 compression module instead of re-implementing folding:
10
+ // `compact` IS the existing summary/folded shape; `balanced` is the current
11
+ // default; `full` is verbose. The profile is the public, documented param;
12
+ // `detail` remains as a backwards-compatible alias.
13
+ //
14
+ // 2. **Uniform paging** (`page_size` / `cursor` / `next_cursor`) — replaces the
15
+ // ad-hoc `max_results` / `max_nodes` / `object_limit` caps with a resumable
16
+ // cursor. The old caps stay as aliases (they request a single bounded page).
17
+ // Every paginated response carries a `pagination` block.
18
+ //
19
+ // The module is pure (no I/O, no cross-file runtime imports) so it loads cleanly
20
+ // under `node --experimental-strip-types` in tests.
21
+ export const PROFILES = ["compact", "balanced", "full"];
22
+ export function isOutputProfile(value) {
23
+ return value === "compact" || value === "balanced" || value === "full";
24
+ }
25
+ export function profileToDetail(profile) {
26
+ switch (profile) {
27
+ case "compact":
28
+ return "summary";
29
+ case "balanced":
30
+ return "normal";
31
+ case "full":
32
+ return "verbose";
33
+ }
34
+ }
35
+ /**
36
+ * Resolve the effective detail level for a call.
37
+ *
38
+ * Precedence: an explicit `profile` wins; otherwise an explicit legacy `detail`
39
+ * is honored (back-compat alias); otherwise the per-tool `fallback` is used.
40
+ * `compact` is the documented default for the heavy families, so most callers
41
+ * should pass `fallback: "summary"`. Tools whose legacy default was `normal`
42
+ * (find_references) still default to `summary` now — compact is the default
43
+ * everywhere per the M22 design decision.
44
+ */
45
+ export function resolveDetail(profile, legacyDetail, fallback) {
46
+ if (profile)
47
+ return profileToDetail(profile);
48
+ if (legacyDetail === "summary" || legacyDetail === "normal" || legacyDetail === "verbose") {
49
+ return legacyDetail;
50
+ }
51
+ return fallback;
52
+ }
53
+ /**
54
+ * Read `profile` / `detail` off a raw args object and return the effective
55
+ * detail level. Returns the profile too (when present) so callers can branch on
56
+ * compact vs. expanded for result folding.
57
+ */
58
+ export function readProfileAndDetail(args, fallback = "summary") {
59
+ const profileRaw = args.profile;
60
+ const profile = isOutputProfile(profileRaw) ? profileRaw : undefined;
61
+ const legacyDetail = typeof args.detail === "string" ? args.detail : undefined;
62
+ return { detail: resolveDetail(profile, legacyDetail, fallback), profile };
63
+ }
64
+ export function encodeCursor(toolKey, offset) {
65
+ return `${toolKey}:${offset}`;
66
+ }
67
+ export function splitCursor(cursor, expectedToolKey) {
68
+ if (typeof cursor !== "string" || cursor === "")
69
+ return 0;
70
+ const colon = cursor.lastIndexOf(":");
71
+ if (colon <= 0)
72
+ return 0;
73
+ const toolKey = cursor.slice(0, colon);
74
+ const offsetStr = cursor.slice(colon + 1);
75
+ // A cursor minted for a different tool (or a stale cursor from before a tool
76
+ // rename) must not silently page the wrong data — treat it as "start over".
77
+ if (toolKey !== expectedToolKey)
78
+ return 0;
79
+ const offset = parseNonNegativeInt(offsetStr);
80
+ return offset === null ? 0 : offset;
81
+ }
82
+ function parseNonNegativeInt(value) {
83
+ if (value.length === 0)
84
+ return null;
85
+ let out = 0;
86
+ for (let i = 0; i < value.length; i++) {
87
+ const ch = value[i];
88
+ if (ch < "0" || ch > "9")
89
+ return null;
90
+ out = out * 10 + (ch.charCodeAt(0) - "0".charCodeAt(0));
91
+ }
92
+ return out;
93
+ }
94
+ /**
95
+ * Slice `items` into one page starting at the cursor offset.
96
+ *
97
+ * - `page_size` <= 0 ⇒ disabled: returns the whole list with a terminal block
98
+ * (next_cursor null, truncated 0). This is the back-compat / alias path.
99
+ * - A cursor with the wrong tool key resets to offset 0 (see splitCursor).
100
+ * - Count invariant: `page.length + block.truncated == items.length - offset`.
101
+ */
102
+ export function applyPaging(items, toolKey, input) {
103
+ const pageSize = typeof input.page_size === "number" && input.page_size > 0
104
+ ? Math.floor(input.page_size)
105
+ : 0;
106
+ if (pageSize <= 0) {
107
+ return {
108
+ page: items.slice(),
109
+ block: {
110
+ page_size: 0,
111
+ cursor: typeof input.cursor === "string" && input.cursor !== "" ? input.cursor : null,
112
+ next_cursor: null,
113
+ truncated: 0,
114
+ },
115
+ };
116
+ }
117
+ const offset = Math.min(splitCursor(input.cursor, toolKey), items.length);
118
+ const page = items.slice(offset, offset + pageSize);
119
+ const remaining = items.length - (offset + page.length);
120
+ const nextCursor = remaining > 0 ? encodeCursor(toolKey, offset + page.length) : null;
121
+ return {
122
+ page,
123
+ block: {
124
+ page_size: pageSize,
125
+ cursor: typeof input.cursor === "string" && input.cursor !== "" ? input.cursor : null,
126
+ next_cursor: nextCursor,
127
+ truncated: remaining,
128
+ },
129
+ };
130
+ }
131
+ // ===========================================================================
132
+ // Envelope attachment.
133
+ //
134
+ // Heavy-tool results are plain objects serialized to the MCP text block. We
135
+ // merge a `pagination` block in (and optionally fold fields) as the last step
136
+ // of each route, mirroring how injectRouteMeta appends `_route`.
137
+ // ===========================================================================
138
+ /**
139
+ * Return a shallow copy of `result` with `pagination` set. Idempotent: a result
140
+ * that already carries a `pagination` block (e.g. built inline by a router) is
141
+ * returned unchanged so two post-processors never clobber each other.
142
+ *
143
+ * Generic over the concrete result interface so callers can pass a typed
144
+ * CompactSearchResult / FindReferencesOfflineResult without an index signature.
145
+ */
146
+ export function attachPagination(result, block) {
147
+ const r = result;
148
+ if (r.pagination !== undefined)
149
+ return r;
150
+ return { ...result, pagination: block };
151
+ }
152
+ /**
153
+ * Fold a verify result (`passed` + `issues[]` + metadata) per the requested
154
+ * profile, optionally paging the issues list.
155
+ *
156
+ * - `compact`: drop `issues[]`, emit `issueCount` + `issuesBySeverity` counts.
157
+ * - `balanced` / `full`: keep `issues[]` (paged when `page_size` is set).
158
+ *
159
+ * `fail_on_severity` and other verify-specific fields are passed through
160
+ * untouched.
161
+ */
162
+ export function foldVerifyResult(result, toolKey, profile, paging) {
163
+ const issues = Array.isArray(result.issues)
164
+ ? result.issues
165
+ : [];
166
+ const issueCount = issues.length;
167
+ const issuesBySeverity = countBySeverity(issues);
168
+ // compact: counts only — strip the issues array.
169
+ if (profile === "compact") {
170
+ const { issues: _dropped, ...rest } = result;
171
+ void _dropped;
172
+ return {
173
+ ...rest,
174
+ issueCount,
175
+ issuesBySeverity,
176
+ };
177
+ }
178
+ // balanced / full: page the issues list when a page size is requested.
179
+ const pageSize = typeof paging.page_size === "number" && paging.page_size > 0
180
+ ? Math.floor(paging.page_size)
181
+ : 0;
182
+ if (pageSize <= 0) {
183
+ return {
184
+ ...result,
185
+ issueCount,
186
+ issuesBySeverity,
187
+ };
188
+ }
189
+ const offset = Math.min(splitCursor(paging.cursor, toolKey), issues.length);
190
+ const page = issues.slice(offset, offset + pageSize);
191
+ const remaining = issues.length - (offset + page.length);
192
+ const nextCursor = remaining > 0 ? encodeCursor(toolKey, offset + page.length) : null;
193
+ const { issues: _replaced, pagination: _existingPagination, ...rest } = result;
194
+ void _replaced;
195
+ void _existingPagination;
196
+ return {
197
+ ...rest,
198
+ issues: page,
199
+ issueCount,
200
+ issuesBySeverity,
201
+ pagination: {
202
+ page_size: pageSize,
203
+ cursor: typeof paging.cursor === "string" && paging.cursor !== "" ? paging.cursor : null,
204
+ next_cursor: nextCursor,
205
+ truncated: remaining,
206
+ },
207
+ };
208
+ }
209
+ function countBySeverity(issues) {
210
+ const counts = {};
211
+ for (const issue of issues) {
212
+ const sev = issue.severity ?? "unknown";
213
+ counts[sev] = (counts[sev] ?? 0) + 1;
214
+ }
215
+ return counts;
216
+ }
217
+ // ===========================================================================
218
+ // Result-block helpers — operate on the CallToolResult text block.
219
+ // ===========================================================================
220
+ /**
221
+ * Parse the first text content block of a CallToolResult as JSON. Returns null
222
+ * when there is no text block or it is not a JSON object (so callers can fall
223
+ * through without throwing).
224
+ */
225
+ export function parseResultBody(result) {
226
+ const first = result.content[0];
227
+ if (!first || first.type !== "text" || typeof first.text !== "string")
228
+ return null;
229
+ try {
230
+ const parsed = JSON.parse(first.text);
231
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
232
+ return parsed;
233
+ }
234
+ }
235
+ catch {
236
+ // fall through
237
+ }
238
+ return null;
239
+ }
240
+ /**
241
+ * Rewrite the first text content block of a CallToolResult with a new JSON
242
+ * body. Other content blocks (e.g. an MCP image block from capture_inline) are
243
+ * preserved untouched. `isError` and `_meta` are preserved.
244
+ */
245
+ export function withResultBody(result, body) {
246
+ const textIndex = result.content.findIndex((c) => c.type === "text");
247
+ const newBlock = { type: "text", text: JSON.stringify(body) };
248
+ if (textIndex < 0) {
249
+ return { ...result, content: [newBlock, ...result.content] };
250
+ }
251
+ const newContent = result.content.slice();
252
+ newContent[textIndex] = newBlock;
253
+ return { ...result, content: newContent };
254
+ }
255
+ //# sourceMappingURL=output-profile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output-profile.js","sourceRoot":"","sources":["../src/output-profile.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,6EAA6E;AAC7E,iFAAiF;AACjF,iBAAiB;AACjB,EAAE;AACF,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,wDAAwD;AACxD,EAAE;AACF,iFAAiF;AACjF,gFAAgF;AAChF,iFAAiF;AACjF,6DAA6D;AAC7D,EAAE;AACF,iFAAiF;AACjF,oDAAoD;AAUpD,MAAM,CAAC,MAAM,QAAQ,GAA6B,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AAElF,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,UAAU,IAAI,KAAK,KAAK,MAAM,CAAC;AACzE,CAAC;AASD,MAAM,UAAU,eAAe,CAAC,OAAsB;IACpD,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,UAAU;YACb,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAkC,EAClC,YAAgC,EAChC,QAAqB;IAErB,IAA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ChC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACnF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YACnE,OAAO,MAAiC,CAAC;QAC3C,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACP,eAAe;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAsB,EACtB,IAA6B;IAE7B,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IACvE,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QAClB,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/D,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC1C,UAAU,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;IACjC,OAAO,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,72 @@
1
+ import type { LifecycleClass } from "./capabilities/lifecycle.js";
2
+ /**
3
+ * How the LiveClient should wait between a failure and the next attempt.
4
+ *
5
+ * - `compile-settle` — poll /ping until the domain reload completes (the
6
+ * bridge tears down its listener for the reload; the
7
+ * poll detects when it comes back). Used by
8
+ * compile-reload tools.
9
+ * - `heartbeat-poll` — bounded backoff re-probing /ping; relies on the
10
+ * heartbeat staying fresh. Used by process-stale tools
11
+ * where the bridge may stall but not die.
12
+ * - `transient-backoff` — short escalating backoff for connection churn that
13
+ * isn't reflected in the lock yet. The default for
14
+ * read-only (none) tools.
15
+ * - `none` — do not retry. The failure is surfaced immediately;
16
+ * the agent must resolve the underlying state (e.g.
17
+ * save or discard a dirty scene before retrying a
18
+ * scene-dirty tool).
19
+ */
20
+ export type SettleStrategy = "compile-settle" | "heartbeat-poll" | "transient-backoff" | "none";
21
+ export interface RetryConfig {
22
+ /** Lifecycle class this config applies to. */
23
+ readonly lifecycleClass: LifecycleClass;
24
+ /** Max retry attempts after the initial failure (0 = never retry). */
25
+ readonly maxAttempts: number;
26
+ /** Base backoff in ms; the n-th attempt sleeps backoffMs * n (escalating). */
27
+ readonly backoffMs: number;
28
+ /** How to wait between attempts. */
29
+ readonly settleStrategy: SettleStrategy;
30
+ }
31
+ export declare const DEFAULT_COMPILE_WAIT_MS = 120000;
32
+ export declare const DEFAULT_COMPILE_POLL_INTERVAL_MS = 2000;
33
+ export declare const DEFAULT_TRANSIENT_RETRY_ATTEMPTS = 3;
34
+ export declare const DEFAULT_TRANSIENT_BACKOFF_MS = 500;
35
+ /**
36
+ * Per-class retry policy. The `none` (read-only) class inherits the original
37
+ * transient-backoff behaviour; `scene-dirty` explicitly does not retry (the
38
+ * guard error must be resolved by the agent, not retried through).
39
+ */
40
+ export declare const RETRY_CONFIG: Readonly<Record<LifecycleClass, RetryConfig>>;
41
+ /**
42
+ * Resolve the retry policy for a lifecycle class. Falls back to the `none`
43
+ * (read-only) policy for an unknown class so a new class added without an
44
+ * entry gets safe defaults.
45
+ */
46
+ export declare function retryConfigFor(lifecycleClass: LifecycleClass, overrides?: Partial<RetryTunables>): RetryConfig;
47
+ /**
48
+ * Numeric tunables an operator can override via env vars without changing the
49
+ * per-class settle strategy. Resolved once at LiveClient construction.
50
+ */
51
+ export interface RetryTunables {
52
+ /** Hard cap on the compile-settle poll loop, in ms. */
53
+ readonly compileWaitMs: number;
54
+ /** Interval between /ping probes during compile-settle, in ms. */
55
+ readonly compilePollIntervalMs: number;
56
+ /** Max transient retry attempts for the backoff loops. */
57
+ readonly transientRetryAttempts: number;
58
+ /** Base backoff (ms) for the transient-backoff + heartbeat-poll loops. */
59
+ readonly transientBackoffMs: number;
60
+ }
61
+ export declare const RETRY_ENV: {
62
+ readonly compileWait: "UNITY_OPEN_MCP_COMPILE_WAIT_MS";
63
+ readonly compilePollInterval: "UNITY_OPEN_MCP_COMPILE_POLL_INTERVAL_MS";
64
+ readonly transientRetryAttempts: "UNITY_OPEN_MCP_TRANSIENT_RETRY_ATTEMPTS";
65
+ readonly transientBackoff: "UNITY_OPEN_MCP_TRANSIENT_BACKOFF_MS";
66
+ };
67
+ /**
68
+ * Read retry tunables from the environment. Unset / invalid values fall back
69
+ * to the documented defaults. Pure aside from the env read; takes the env as
70
+ * an argument so tests can inject a fake environment.
71
+ */
72
+ export declare function readRetryTunables(env?: NodeJS.ProcessEnv): RetryTunables;
@@ -0,0 +1,146 @@
1
+ // Structured retry policy per agent-facing lifecycle class.
2
+ //
3
+ // Formalizes the ad-hoc retry loops that previously lived as module constants
4
+ // in live-client.ts (TRANSIENT_RETRY_ATTEMPTS / TRANSIENT_RETRY_BACKOFF_MS /
5
+ // MAX_COMPILE_WAIT_MS). Each lifecycle class (capabilities/lifecycle.ts) now
6
+ // carries an explicit retry + settle policy so an agent (or the MCP server on
7
+ // its behalf) can branch recovery programmatically instead of parsing
8
+ // free-text errors or relying on hardcoded numbers.
9
+ //
10
+ // The policy is consulted by the LiveClient's transient-offline handler: given
11
+ // the tool's lifecycle class, it picks the settle strategy and backoff
12
+ // parameters. The dead-bridge / reloading classification in
13
+ // instance-discovery.ts is unchanged — this module only governs *how long and
14
+ // how often* to retry, not *what* a failure means.
15
+ //
16
+ // Pure data + pure functions (no I/O). Env overrides are parsed once via
17
+ // readRetryConfig() so the live-client can resolve them at construction time,
18
+ // mirroring the readDismissConfig() pattern in dialog-dismiss.ts.
19
+ // ---------------------------------------------------------------------------
20
+ // Per-class defaults.
21
+ //
22
+ // These are the documented defaults; every value is overridable via env vars
23
+ // (see readRetryConfig). The numbers match the pre-existing hardcoded values
24
+ // in live-client.ts so behaviour is preserved when no env override is set.
25
+ // ---------------------------------------------------------------------------
26
+ export const DEFAULT_COMPILE_WAIT_MS = 120_000;
27
+ export const DEFAULT_COMPILE_POLL_INTERVAL_MS = 2_000;
28
+ export const DEFAULT_TRANSIENT_RETRY_ATTEMPTS = 3;
29
+ export const DEFAULT_TRANSIENT_BACKOFF_MS = 500;
30
+ /**
31
+ * Per-class retry policy. The `none` (read-only) class inherits the original
32
+ * transient-backoff behaviour; `scene-dirty` explicitly does not retry (the
33
+ * guard error must be resolved by the agent, not retried through).
34
+ */
35
+ export const RETRY_CONFIG = {
36
+ // Read-only: short transient retry for socket churn during a reload.
37
+ none: {
38
+ lifecycleClass: "none",
39
+ maxAttempts: DEFAULT_TRANSIENT_RETRY_ATTEMPTS,
40
+ backoffMs: DEFAULT_TRANSIENT_BACKOFF_MS,
41
+ settleStrategy: "transient-backoff",
42
+ },
43
+ // Domain reload: wait out the compile, then retry once the listener is back.
44
+ "compile-reload": {
45
+ lifecycleClass: "compile-reload",
46
+ maxAttempts: DEFAULT_TRANSIENT_RETRY_ATTEMPTS,
47
+ backoffMs: DEFAULT_TRANSIENT_BACKOFF_MS,
48
+ settleStrategy: "compile-settle",
49
+ },
50
+ // OS modal: no first-class retry here — the dialog dismiss loop
51
+ // (dialog-policy.ts) runs concurrently inside the compile-settle wait. A
52
+ // mid-call modal that the dismiss loop cannot handle surfaces as a
53
+ // timeout; the agent must dismiss it manually.
54
+ "modal-dialog": {
55
+ lifecycleClass: "modal-dialog",
56
+ maxAttempts: DEFAULT_TRANSIENT_RETRY_ATTEMPTS,
57
+ backoffMs: DEFAULT_TRANSIENT_BACKOFF_MS,
58
+ settleStrategy: "compile-settle",
59
+ },
60
+ // scene-dirty: NEVER retry. The dirty guard refusal is the contract — the
61
+ // agent must save/discard or pass ignore_scene_dirty: true.
62
+ "scene-dirty": {
63
+ lifecycleClass: "scene-dirty",
64
+ maxAttempts: 0,
65
+ backoffMs: 0,
66
+ settleStrategy: "none",
67
+ },
68
+ // process-stale: the heartbeat may stall during a long op; re-probe with
69
+ // bounded backoff rather than declaring the bridge dead.
70
+ "process-stale": {
71
+ lifecycleClass: "process-stale",
72
+ maxAttempts: DEFAULT_TRANSIENT_RETRY_ATTEMPTS,
73
+ backoffMs: DEFAULT_TRANSIENT_BACKOFF_MS,
74
+ settleStrategy: "heartbeat-poll",
75
+ },
76
+ };
77
+ /**
78
+ * Resolve the retry policy for a lifecycle class. Falls back to the `none`
79
+ * (read-only) policy for an unknown class so a new class added without an
80
+ * entry gets safe defaults.
81
+ */
82
+ export function retryConfigFor(lifecycleClass, overrides) {
83
+ const base = RETRY_CONFIG[lifecycleClass] ?? RETRY_CONFIG.none;
84
+ if (!overrides)
85
+ return base;
86
+ // Only the numeric tunables are overridable; the settle strategy is a
87
+ // structural property of the class, not a knob.
88
+ return {
89
+ ...base,
90
+ maxAttempts: clampNonNegInt(overrides.transientRetryAttempts, base.maxAttempts),
91
+ backoffMs: clampPositiveInt(overrides.transientBackoffMs, base.backoffMs),
92
+ };
93
+ }
94
+ export const RETRY_ENV = {
95
+ compileWait: "UNITY_OPEN_MCP_COMPILE_WAIT_MS",
96
+ compilePollInterval: "UNITY_OPEN_MCP_COMPILE_POLL_INTERVAL_MS",
97
+ transientRetryAttempts: "UNITY_OPEN_MCP_TRANSIENT_RETRY_ATTEMPTS",
98
+ transientBackoff: "UNITY_OPEN_MCP_TRANSIENT_BACKOFF_MS",
99
+ };
100
+ /**
101
+ * Read retry tunables from the environment. Unset / invalid values fall back
102
+ * to the documented defaults. Pure aside from the env read; takes the env as
103
+ * an argument so tests can inject a fake environment.
104
+ */
105
+ export function readRetryTunables(env = process.env) {
106
+ return {
107
+ compileWaitMs: parsePositiveInt(env[RETRY_ENV.compileWait], DEFAULT_COMPILE_WAIT_MS),
108
+ compilePollIntervalMs: parsePositiveInt(env[RETRY_ENV.compilePollInterval], DEFAULT_COMPILE_POLL_INTERVAL_MS),
109
+ transientRetryAttempts: parseNonNegInt(env[RETRY_ENV.transientRetryAttempts], DEFAULT_TRANSIENT_RETRY_ATTEMPTS),
110
+ transientBackoffMs: parsePositiveInt(env[RETRY_ENV.transientBackoff], DEFAULT_TRANSIENT_BACKOFF_MS),
111
+ };
112
+ }
113
+ // ---------------------------------------------------------------------------
114
+ // Helpers.
115
+ // ---------------------------------------------------------------------------
116
+ function parsePositiveInt(raw, fallback) {
117
+ if (raw === undefined || raw === "")
118
+ return fallback;
119
+ const n = parseInt(raw, 10);
120
+ if (!Number.isFinite(n) || n <= 0)
121
+ return fallback;
122
+ return n;
123
+ }
124
+ function parseNonNegInt(raw, fallback) {
125
+ if (raw === undefined || raw === "")
126
+ return fallback;
127
+ const n = parseInt(raw, 10);
128
+ if (!Number.isFinite(n) || n < 0)
129
+ return fallback;
130
+ return n;
131
+ }
132
+ function clampPositiveInt(value, fallback) {
133
+ if (value === undefined)
134
+ return fallback;
135
+ if (!Number.isFinite(value) || value <= 0)
136
+ return fallback;
137
+ return value;
138
+ }
139
+ function clampNonNegInt(value, fallback) {
140
+ if (value === undefined)
141
+ return fallback;
142
+ if (!Number.isFinite(value) || value < 0)
143
+ return fallback;
144
+ return value;
145
+ }
146
+ //# sourceMappingURL=retry-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-policy.js","sourceRoot":"","sources":["../src/retry-policy.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE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sed UNITY_OPEN_MCP_BRIDGE_PORT (or CLI --port override), else undefined.
13
+ * Threaded into LiveClient so refreshEndpointFromLock respects the same
14
+ * override precedence as construction (env override ⇒ no lock refresh). */
15
+ envPort: number | undefined;
12
16
  }
13
17
  /**
14
18
  * Resolve the project path / port / auth token from explicit overrides (CLI
package/dist/routers.js CHANGED
@@ -35,7 +35,7 @@ export function resolveEnv(projectPathOverride, portOverride) {
35
35
  const effectiveEnvPort = rawEnvPort && Number.isInteger(envPort) ? envPort : undefined;
36
36
  const port = resolvePort(projectPath, portOverride ?? effectiveEnvPort);
37
37
  const authToken = resolveAuthToken(projectPath, portOverride ?? effectiveEnvPort);
38
- return { projectPath, port, authToken };
38
+ return { projectPath, port, authToken, envPort: portOverride ?? effectiveEnvPort };
39
39
  }
40
40
  export class ResolveEnvError extends Error {
41
41
  }
@@ -46,7 +46,7 @@ export class ResolveEnvError extends Error {
46
46
  */
47
47
  export function buildRouterStack(env) {
48
48
  const pingCache = new PingCache();
49
- const live = new LiveClient(env.port, pingCache, env.authToken, env.projectPath);
49
+ const live = new LiveClient(env.port, pingCache, env.authToken, env.projectPath, undefined, env.envPort);
50
50
  const batch = new BatchSpawn();
51
51
  const eventStream = new BridgeEventStream(`http://127.0.0.1:${env.port}`, undefined, env.authToken);
52
52
  const sessionState = new ToolSessionState();
@@ -1 +1 @@
1
- {"version":3,"file":"routers.js","sourceRoot":"","sources":["../src/routers.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,EAAE;AACF,yEAAyE;AACzE,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yBAAyB;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAA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AS,EAAE,GAAG,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;IACzG,MAAM,KAAK,GAAG,IAAI,UAAU,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,IAAI,iBAAiB,CACvC,oBAAoB,GAAG,CAAC,IAAI,EAAE,EAC9B,SAAS,EACT,GAAG,CAAC,SAAS,CACd,CAAC;IACF,MAAM,YAAY,GAAG,IAAI,gBAAgB,EAAE,CAAC;IAC5C,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;IACvF,MAAM,cAAc,GAAG,IAAI,cAAc,CAAC;QACxC,IAAI;QACJ,SAAS;QACT,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC;IACH,OAAO;QACL,IAAI;QACJ,KAAK;QACL,MAAM;QACN,SAAS;QACT,cAAc;QACd,WAAW;QACX,YAAY;QACZ,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,SAAS,EAAE,GAAG,CAAC,SAAS;KACzB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Build the server instructions string. Memoized at the module level so
3
+ * repeated `Server` constructions (tests, multi-project) do not re-stringify.
4
+ */
5
+ export declare function buildServerInstructions(): string;
6
+ /**
7
+ * Return the server instructions, memoized. The string is constant for the
8
+ * lifetime of the process, so a single computation is sufficient.
9
+ */
10
+ export declare function getServerInstructions(): string;
11
+ /**
12
+ * Test hook: assert the instructions carry no internal IDs / reference-project
13
+ * handles. Exposed so the test suite can call it without duplicating the
14
+ * banned-pattern list.
15
+ *
16
+ * @returns an array of offending patterns (empty when clean).
17
+ */
18
+ export declare function findBannedInstructionsReferences(text: string): string[];