{"version":3,"file":"unity-server-config.d.ts","sourceRoot":"","sources":["../../../src/core/unity-mcp/unity-server-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,EAAE,iBAK9B,CAAC;AAEH,eAAO,MAAM,gCAAgC,QAAS,CAAC;AACvD,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAOnE;AAiBD;;;GAGG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,iBAAiB,GAAG,mBAAmB,CAoB5F","sourcesContent":["/**\n * Unity MCP Vertical Slice — server configuration (2.13.0).\n *\n * Builds a reusable Jensen-side `McpServerDefinition` that reaches the LOTG\n * Unity Editor's MCP relay through non-interactive SSH stdio. The MCP Client\n * Foundation continues to see a normal stdio child process (`ssh`); this module\n * only constructs the safe argv.\n *\n * No secrets are stored. SSH authentication is assumed to already work through\n * the operator's existing key material; the definition never persists\n * credentials. The Windows username is resolved remotely through `%USERPROFILE%`\n * rather than hardcoded.\n */\n\nimport type { McpServerDefinition } from \"../mcp-foundation/mcp-types.js\";\nimport type { UnityServerTarget } from \"./unity-types.js\";\n\n/** Canonical LOTG Unity endpoint on Blackpearl. Configurable, not a credential. */\nexport const LOTG_UNITY_TARGET: UnityServerTarget = Object.freeze({\n\tserverId: \"unity-lotg-blackpearl\",\n\tsshTarget: \"sparrow@blackpearl\",\n\tunityProjectPath: \"D:\\\\Documents\\\\software\\\\light-of-the-galaxy\\\\mmo-client\",\n\trelayWindowsPath: \"%USERPROFILE%\\\\.unity\\\\relay\\\\relay_win.exe\",\n});\n\nexport const UNITY_DEFAULT_STARTUP_TIMEOUT_MS = 15_000;\nexport const UNITY_DEFAULT_REQUEST_TIMEOUT_MS = 30_000;\n\n/**\n * The remote relay argv string executed by the SSH session's default shell\n * (cmd.exe on the LOTG host). `--mcp` selects MCP stdio mode; `--project-path`\n * targets the exact LOTG project so a multi-project host is never ambiguous.\n */\nexport function unityRelayCommand(target: UnityServerTarget): string {\n\tconst relay = target.relayWindowsPath ?? \"%USERPROFILE%\\\\.unity\\\\relay\\\\relay_win.exe\";\n\tconst parts = [`\"${relay}\"`, \"--mcp\", \"--project-path\", `\"${target.unityProjectPath}\"`];\n\tif (target.editorPid !== undefined) {\n\t\tparts.push(\"--instance-id\", String(target.editorPid));\n\t}\n\treturn parts.join(\" \");\n}\n\n/**\n * The official SDK's stdio transport spawns children with a sanitized\n * environment (HOME/PATH/... only) and therefore does NOT forward the\n * operator's ssh-agent socket. `ssh blackpearl` works interactively because the\n * agent key is offered, so the MCP definition must forward `SSH_AUTH_SOCK`\n * explicitly or the SSH child cannot authenticate. The socket path is a\n * non-secret environment value; evidence/argv diagnostics still only ever log\n * env NAMES, never values.\n */\nfunction sshEnvironment(): Record<string, string> | undefined {\n\tconst env: Record<string, string> = {};\n\tif (process.env.SSH_AUTH_SOCK) env.SSH_AUTH_SOCK = process.env.SSH_AUTH_SOCK;\n\treturn Object.keys(env).length > 0 ? env : undefined;\n}\n\n/**\n * Build a Jensen `McpServerDefinition` for a Unity MCP endpoint carried across\n * SSH stdio. Output is plain, serializable, secret-free configuration.\n */\nexport function buildUnityMcpServerDefinition(target: UnityServerTarget): McpServerDefinition {\n\tif (typeof target.serverId !== \"string\" || target.serverId.length === 0) {\n\t\tthrow new Error(\"UnityServerTarget.serverId must be a non-empty string\");\n\t}\n\tif (typeof target.sshTarget !== \"string\" || target.sshTarget.length === 0) {\n\t\tthrow new Error(\"UnityServerTarget.sshTarget must be a non-empty string\");\n\t}\n\tif (typeof target.unityProjectPath !== \"string\" || target.unityProjectPath.length === 0) {\n\t\tthrow new Error(\"UnityServerTarget.unityProjectPath must be a non-empty string\");\n\t}\n\n\treturn {\n\t\tid: target.serverId,\n\t\tname: \"Unity MCP (LOTG)\",\n\t\tcommand: \"ssh\",\n\t\targs: [\"-T\", \"-o\", \"BatchMode=yes\", \"-o\", \"ConnectTimeout=10\", target.sshTarget, unityRelayCommand(target)],\n\t\tenv: sshEnvironment(),\n\t\tstartupTimeoutMs: target.startupTimeoutMs ?? UNITY_DEFAULT_STARTUP_TIMEOUT_MS,\n\t\trequestTimeoutMs: target.requestTimeoutMs ?? UNITY_DEFAULT_REQUEST_TIMEOUT_MS,\n\t};\n}\n"]}