xstudio-linux 0.0.0-stage → 0.2.4

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 (222) hide show
  1. package/CHANGELOG.md +469 -0
  2. package/LICENSE +31 -0
  3. package/README.md +542 -2
  4. package/dist/adapter-cli/cli.d.ts +28 -0
  5. package/dist/adapter-cli/cli.js +233 -0
  6. package/dist/adapter-cli/cli.js.map +1 -0
  7. package/dist/adapter-mcp/server.d.ts +81 -0
  8. package/dist/adapter-mcp/server.js +473 -0
  9. package/dist/adapter-mcp/server.js.map +1 -0
  10. package/dist/config.d.ts +45 -0
  11. package/dist/config.js +78 -0
  12. package/dist/config.js.map +1 -0
  13. package/dist/core/catalog/pronunciation.d.ts +47 -0
  14. package/dist/core/catalog/pronunciation.js +402 -0
  15. package/dist/core/catalog/pronunciation.js.map +1 -0
  16. package/dist/core/catalog/singers.d.ts +46 -0
  17. package/dist/core/catalog/singers.js +122 -0
  18. package/dist/core/catalog/singers.js.map +1 -0
  19. package/dist/core/contracts.d.ts +348 -0
  20. package/dist/core/contracts.js +17 -0
  21. package/dist/core/contracts.js.map +1 -0
  22. package/dist/core/degrade/chain.d.ts +80 -0
  23. package/dist/core/degrade/chain.js +137 -0
  24. package/dist/core/degrade/chain.js.map +1 -0
  25. package/dist/core/diagnose/error-resolver.d.ts +51 -0
  26. package/dist/core/diagnose/error-resolver.js +202 -0
  27. package/dist/core/diagnose/error-resolver.js.map +1 -0
  28. package/dist/core/guard/skill-gate.d.ts +89 -0
  29. package/dist/core/guard/skill-gate.js +121 -0
  30. package/dist/core/guard/skill-gate.js.map +1 -0
  31. package/dist/core/midi/convert.d.ts +31 -0
  32. package/dist/core/midi/convert.js +125 -0
  33. package/dist/core/midi/convert.js.map +1 -0
  34. package/dist/core/midi/smf.d.ts +37 -0
  35. package/dist/core/midi/smf.js +422 -0
  36. package/dist/core/midi/smf.js.map +1 -0
  37. package/dist/core/render/artifacts.d.ts +37 -0
  38. package/dist/core/render/artifacts.js +417 -0
  39. package/dist/core/render/artifacts.js.map +1 -0
  40. package/dist/core/render/orchestrator.d.ts +110 -0
  41. package/dist/core/render/orchestrator.js +974 -0
  42. package/dist/core/render/orchestrator.js.map +1 -0
  43. package/dist/core/svip/codec.d.ts +30 -0
  44. package/dist/core/svip/codec.js +664 -0
  45. package/dist/core/svip/codec.js.map +1 -0
  46. package/dist/core/svip/document.d.ts +31 -0
  47. package/dist/core/svip/document.js +158 -0
  48. package/dist/core/svip/document.js.map +1 -0
  49. package/dist/core/svip/editor.d.ts +71 -0
  50. package/dist/core/svip/editor.js +245 -0
  51. package/dist/core/svip/editor.js.map +1 -0
  52. package/dist/core/svip/model.d.ts +74 -0
  53. package/dist/core/svip/model.js +158 -0
  54. package/dist/core/svip/model.js.map +1 -0
  55. package/dist/core/svip/tick.d.ts +21 -0
  56. package/dist/core/svip/tick.js +59 -0
  57. package/dist/core/svip/tick.js.map +1 -0
  58. package/dist/core/svip/validator.d.ts +39 -0
  59. package/dist/core/svip/validator.js +267 -0
  60. package/dist/core/svip/validator.js.map +1 -0
  61. package/dist/host/linux.d.ts +15 -0
  62. package/dist/host/linux.js +42 -0
  63. package/dist/host/linux.js.map +1 -0
  64. package/dist/host/sidecar.d.ts +61 -0
  65. package/dist/host/sidecar.js +365 -0
  66. package/dist/host/sidecar.js.map +1 -0
  67. package/dist/host/wine-launch.d.ts +60 -0
  68. package/dist/host/wine-launch.js +77 -0
  69. package/dist/host/wine-launch.js.map +1 -0
  70. package/dist/host/wine-paths.d.ts +30 -0
  71. package/dist/host/wine-paths.js +103 -0
  72. package/dist/host/wine-paths.js.map +1 -0
  73. package/dist/index.d.ts +20 -0
  74. package/dist/index.js +17 -0
  75. package/dist/index.js.map +1 -0
  76. package/dist/services.d.ts +55 -0
  77. package/dist/services.js +78 -0
  78. package/dist/services.js.map +1 -0
  79. package/dist/shared/errors.d.ts +61 -0
  80. package/dist/shared/errors.js +125 -0
  81. package/dist/shared/errors.js.map +1 -0
  82. package/dist/shared/paths.d.ts +8 -0
  83. package/dist/shared/paths.js +30 -0
  84. package/dist/shared/paths.js.map +1 -0
  85. package/dist/shared/schema.d.ts +26 -0
  86. package/dist/shared/schema.js +68 -0
  87. package/dist/shared/schema.js.map +1 -0
  88. package/dist/shared/types.d.ts +43 -0
  89. package/dist/shared/types.js +19 -0
  90. package/dist/shared/types.js.map +1 -0
  91. package/dist/tests/unit/artifacts.test.d.ts +1 -0
  92. package/dist/tests/unit/artifacts.test.js +243 -0
  93. package/dist/tests/unit/artifacts.test.js.map +1 -0
  94. package/dist/tests/unit/data-plane.test.d.ts +1 -0
  95. package/dist/tests/unit/data-plane.test.js +153 -0
  96. package/dist/tests/unit/data-plane.test.js.map +1 -0
  97. package/dist/tests/unit/degrade.test.d.ts +1 -0
  98. package/dist/tests/unit/degrade.test.js +133 -0
  99. package/dist/tests/unit/degrade.test.js.map +1 -0
  100. package/dist/tests/unit/diagnosis.test.d.ts +1 -0
  101. package/dist/tests/unit/diagnosis.test.js +66 -0
  102. package/dist/tests/unit/diagnosis.test.js.map +1 -0
  103. package/dist/tests/unit/errors.test.d.ts +1 -0
  104. package/dist/tests/unit/errors.test.js +83 -0
  105. package/dist/tests/unit/errors.test.js.map +1 -0
  106. package/dist/tests/unit/mcp-server.test.d.ts +1 -0
  107. package/dist/tests/unit/mcp-server.test.js +267 -0
  108. package/dist/tests/unit/mcp-server.test.js.map +1 -0
  109. package/dist/tests/unit/mcp-smoke.d.ts +6 -0
  110. package/dist/tests/unit/mcp-smoke.js +7 -0
  111. package/dist/tests/unit/mcp-smoke.js.map +1 -0
  112. package/dist/tests/unit/mcp-smoke.test.d.ts +1 -0
  113. package/dist/tests/unit/mcp-smoke.test.js +196 -0
  114. package/dist/tests/unit/mcp-smoke.test.js.map +1 -0
  115. package/dist/tests/unit/midi.test.d.ts +1 -0
  116. package/dist/tests/unit/midi.test.js +255 -0
  117. package/dist/tests/unit/midi.test.js.map +1 -0
  118. package/dist/tests/unit/pronunciation.test.d.ts +1 -0
  119. package/dist/tests/unit/pronunciation.test.js +83 -0
  120. package/dist/tests/unit/pronunciation.test.js.map +1 -0
  121. package/dist/tests/unit/registry-contract.test.d.ts +1 -0
  122. package/dist/tests/unit/registry-contract.test.js +114 -0
  123. package/dist/tests/unit/registry-contract.test.js.map +1 -0
  124. package/dist/tests/unit/render-orchestrator.test.d.ts +1 -0
  125. package/dist/tests/unit/render-orchestrator.test.js +548 -0
  126. package/dist/tests/unit/render-orchestrator.test.js.map +1 -0
  127. package/dist/tests/unit/sidecar.test.d.ts +1 -0
  128. package/dist/tests/unit/sidecar.test.js +299 -0
  129. package/dist/tests/unit/sidecar.test.js.map +1 -0
  130. package/dist/tests/unit/singers.test.d.ts +1 -0
  131. package/dist/tests/unit/singers.test.js +73 -0
  132. package/dist/tests/unit/singers.test.js.map +1 -0
  133. package/dist/tests/unit/skill-gate.test.d.ts +1 -0
  134. package/dist/tests/unit/skill-gate.test.js +207 -0
  135. package/dist/tests/unit/skill-gate.test.js.map +1 -0
  136. package/dist/tests/unit/svip-codec.test.d.ts +1 -0
  137. package/dist/tests/unit/svip-codec.test.js +182 -0
  138. package/dist/tests/unit/svip-codec.test.js.map +1 -0
  139. package/dist/tests/unit/svip-document.test.d.ts +1 -0
  140. package/dist/tests/unit/svip-document.test.js +137 -0
  141. package/dist/tests/unit/svip-document.test.js.map +1 -0
  142. package/dist/tests/unit/svip-editor.test.d.ts +1 -0
  143. package/dist/tests/unit/svip-editor.test.js +275 -0
  144. package/dist/tests/unit/svip-editor.test.js.map +1 -0
  145. package/dist/tests/unit/svip-tick.test.d.ts +1 -0
  146. package/dist/tests/unit/svip-tick.test.js +66 -0
  147. package/dist/tests/unit/svip-tick.test.js.map +1 -0
  148. package/dist/tools/common.d.ts +87 -0
  149. package/dist/tools/common.js +174 -0
  150. package/dist/tools/common.js.map +1 -0
  151. package/dist/tools/control.d.ts +21 -0
  152. package/dist/tools/control.js +376 -0
  153. package/dist/tools/control.js.map +1 -0
  154. package/dist/tools/data.d.ts +37 -0
  155. package/dist/tools/data.js +680 -0
  156. package/dist/tools/data.js.map +1 -0
  157. package/dist/tools/definition.d.ts +60 -0
  158. package/dist/tools/definition.js +44 -0
  159. package/dist/tools/definition.js.map +1 -0
  160. package/dist/tools/degrade.d.ts +3 -0
  161. package/dist/tools/degrade.js +30 -0
  162. package/dist/tools/degrade.js.map +1 -0
  163. package/dist/tools/guide.d.ts +10 -0
  164. package/dist/tools/guide.js +66 -0
  165. package/dist/tools/guide.js.map +1 -0
  166. package/dist/tools/open.d.ts +3 -0
  167. package/dist/tools/open.js +74 -0
  168. package/dist/tools/open.js.map +1 -0
  169. package/dist/tools/probe.d.ts +8 -0
  170. package/dist/tools/probe.js +132 -0
  171. package/dist/tools/probe.js.map +1 -0
  172. package/dist/tools/registry.d.ts +10 -0
  173. package/dist/tools/registry.js +16 -0
  174. package/dist/tools/registry.js.map +1 -0
  175. package/dist/version.d.ts +4 -0
  176. package/dist/version.js +19 -0
  177. package/dist/version.js.map +1 -0
  178. package/docs/DESIGN.md +561 -0
  179. package/docs/RECON-GUI.md +271 -0
  180. package/docs/RECON.md +339 -0
  181. package/docs/SPEC.md +786 -0
  182. package/docs/WINE.md +193 -0
  183. package/examples/.scratch/01-midi-to-wudi/wudi-demo.svip3 +0 -0
  184. package/examples/.scratch/01-midi-to-wudi/wudi-melody.mid +0 -0
  185. package/examples/.scratch/01-midi-to-wudi/wudi-roundtrip.mid +0 -0
  186. package/examples/.scratch/02-three-singers/melody.chenziyu.svip3 +0 -0
  187. package/examples/.scratch/02-three-singers/melody.hechang.svip3 +0 -0
  188. package/examples/.scratch/02-three-singers/melody.svip3 +0 -0
  189. package/examples/.scratch/02-three-singers/melody.wudi.svip3 +0 -0
  190. package/examples/.scratch/03-velocity-diction/phrase.svip3 +0 -0
  191. package/examples/.scratch/03-velocity-diction/phrase.svip3.bak.20261206-163755-200 +0 -0
  192. package/examples/.scratch/03-velocity-diction/phrase.svip3.bak.20261206-163755-203 +0 -0
  193. package/examples/.scratch/03-velocity-diction/phrase.svip3.bak.20261206-163755-204 +0 -0
  194. package/examples/.scratch/04-unknown-dialog-abort/dialog-demo.svip3 +0 -0
  195. package/examples/01-midi-to-wudi.mjs +144 -0
  196. package/examples/02-three-singers-compare.mjs +140 -0
  197. package/examples/03-velocity-diction-rerender.mjs +160 -0
  198. package/examples/04-unknown-dialog-abort.mjs +126 -0
  199. package/examples/README.md +101 -0
  200. package/examples/lib/harness.mjs +274 -0
  201. package/fixtures/midi/melody-480.mid +0 -0
  202. package/fixtures/midi/melody-96.mid +0 -0
  203. package/fixtures/svip/1.svip3 +0 -0
  204. package/fixtures/svip/3.svip3 +0 -0
  205. package/fixtures/uia/README.md +37 -0
  206. package/fixtures/uia/export-dialog.snapshot.json +446 -0
  207. package/fixtures/uia/main-window.snapshot.json +2997 -0
  208. package/fixtures/uia/open-dialog.snapshot.json +103 -0
  209. package/icon.svg +10 -0
  210. package/package.json +84 -4
  211. package/proto/xstudio.proto +128 -0
  212. package/scripts/check-contract.mjs +184 -0
  213. package/scripts/entry-smoke.mjs +26 -0
  214. package/scripts/inspect-svip.mjs +161 -0
  215. package/scripts/setup-venv.sh +93 -0
  216. package/scripts/wine-gui-probe.py +302 -0
  217. package/sidecar/xstudio_uia.py +1478 -0
  218. package/skills/xstudio-gui/SKILL.md +196 -0
  219. package/skills/xstudio-gui/assertions.md +103 -0
  220. package/skills/xstudio-gui/dialogs.md +90 -0
  221. package/skills/xstudio-gui/gestures.md +158 -0
  222. package/skills/xstudio-gui/ui-map.json +242 -0
package/README.md CHANGED
@@ -1,3 +1,543 @@
1
- # Temporary Holding Version
1
+ # xstudio-linux
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ X Studio (NetEase Cloud Music edition) bridge for **Linux + Wine**.
4
+ Edit `.svip3` project files directly in TypeScript, drive the running X Studio
5
+ desktop app (under Wine) through an AT-SPI2/X11 accessibility sidecar for cloud
6
+ render/export — from a standalone CLI or a stdio MCP server.
7
+
8
+ Version **0.2.0** · MIT · Linux x64 (X11/XWayland) + Wine · Node.js ≥ 20 ·
9
+ X Studio 1.2.7 (NetEase Cloud Music edition) · local, user-owned instances only.
10
+
11
+ > **History.** This project started as `dsh-xstudio` 0.1.x, a DeepSeek Harness
12
+ > plugin for native Windows (PowerShell 7 + .NET UIA sidecar, Tavily knowledge
13
+ > enrichment). The `main` git branch preserves that state. The
14
+ > `linux-standalone` branch (this tree) removes the DSH host layer, the Tavily
15
+ > network layer and the Windows sidecar, and replaces them with a standalone
16
+ > CLI/MCP surface, a local-only knowledge plane, and a Python AT-SPI2 sidecar
17
+ > targeting X Studio under Wine.
18
+
19
+ ## 合规红线 / Compliance red lines (all remain in force)
20
+
21
+ These are hard commitments, not marketing. They apply to every line of code in
22
+ this repository and to every release.
23
+
24
+ - ✅ **No binary patch, no injection, no credential extraction.**
25
+ 不修改/不注入 X Studio 二进制,不读取或提取任何凭据。The plugin only reads and
26
+ writes user-owned `.svip3` files and drives the app through its accessibility
27
+ interface (AT-SPI2/X11 under Wine).
28
+ - ✅ **No bypass of login, authorization, paywalls or DRM.**
29
+ 不绕过登录、鉴权、付费墙、DRM。If X Studio wants a sign-in, a resource download
30
+ or a paid voice model, the plugin reports it and asks a human; it never
31
+ attempts a workaround.
32
+ - ✅ **No resale or redistribution of vendor binaries, voice models or assets.**
33
+ 不转售、不分发厂商二进制、音色模型、素材。No NetEase or X Studio binary is
34
+ bundled; the plugin only writes project documents.
35
+ - ✅ **Not a SaaS wrapper — local user instance only.**
36
+ 不包装成对外 SaaS,仅限本机、用户自有实例。There is no hosted service; the
37
+ plugin executes on the user's machine against the user's own installation.
38
+ - ✅ **No fake worker shared-memory protocol impersonating the client.**
39
+ 不伪造 worker 共享内存协议冒充客户端。
40
+ - ✅ **X Studio Terms of Service respected; purpose limited to interoperability
41
+ and personal creative assistance.**
42
+ - ✅ **Legal risk disclosed: the protobuf schema is reverse-engineered, not
43
+ vendor documentation.** If NetEase asserts rights over the schema, this
44
+ repository will be taken down immediately upon notice.
45
+ - ✅ **Lesson recorded: the unofficial NetEase Cloud Music API was taken down for
46
+ infringement.** This project only manipulates local files and never
47
+ reimplements vendor network protocols.
48
+ - ✅ **No outbound network at all (0.2.0).** The Tavily layer was removed, so
49
+ the package makes zero HTTPS calls; the only I/O is the local filesystem and
50
+ the local AT-SPI2/X11 channel to the Wine instance.
51
+ - ✅ **Search results are never instructions** — moot since 0.2.0: there are no
52
+ search results. Dialog diagnosis is a local fingerprint table; unknown
53
+ dialogs always return the safe `manual` action.
54
+ - ✅ **Creation-mode (preset) output is still human-reviewed** (historical
55
+ commitment from the DSH era).
56
+
57
+ **Provenance note.** This is an independent interoperability project. It is not
58
+ affiliated with, endorsed by, or supported by NetEase Cloud Music, Microsoft
59
+ Xiaoice, or the DeepSeek Harness maintainers. No vendor documentation describes
60
+ the `.svip3` format; every field mapping is inferred from files the user saved
61
+ and is recorded honestly in [docs/RECON.md](docs/RECON.md) (Windows-era
62
+ verification, still valid for the file format).
63
+
64
+ ## Verification status (read this before trusting a claim)
65
+
66
+ Carried over from the Windows 0.1.2 round (2026-10-18): the `.svip3` codec is
67
+ byte-identical on decode→encode for the real fixtures; the data plane (read /
68
+ edit / backup / no-op write) is verified by 173 passing unit tests plus live
69
+ rounds; the two-surface contract (registry ↔ MCP ↔ README) is enforced by
70
+ `scripts/check-contract.mjs` (24/24/24).
71
+
72
+ New in 0.2.0 (Linux/Wine), verified in this repository:
73
+
74
+ | Area | Status | Evidence |
75
+ |---|---|---|
76
+ | `.svip3` data plane on Linux | **verified** | identical unit suite (173 pass / 0 fail), CLI round trips on real fixtures |
77
+ | CLI entry (`dist/adapter-cli/cli.js`) | **verified** | `xstudio_probe`, `xstudio_project_read`, `--list-tools`, `--version` executed live |
78
+ | MCP stdio server | **verified** | spawned-server smoke (initialize / tools/list / tools/call / clean EOF) |
79
+ | Wine path translation | **unit-tested** | `wine-paths` conversion logic (dosdevices scan + Z: fallback) |
80
+ | Python sidecar protocol | **verified offline** | JSON-lines contract answers probe/close and structured errors without an X server |
81
+ | Wine GUI element tree (AT-SPI) | **pending on-machine calibration** | Wine's Qt build does not expose the accessibility tree by default; `scripts/wine-gui-probe.py` reports the live state. Element actions degrade explicitly to `GUI_REF_NOT_FOUND` → guide; nothing pretends to work |
82
+ | Render/export through Wine GUI | **unverified end-to-end** | requires a Wine session where the tree is reachable (X11 + `AT_SPI_BUS`); the orchestrator's budgets, dialog classification and guard rails are unchanged and unit-tested |
83
+
84
+ ## What it does
85
+
86
+ - **Data plane (pure TypeScript, no GUI)** — read `.svip3` projects to JSON,
87
+ create projects from MIDI or explicit notes, add/remove/edit notes, set tempo,
88
+ time signature, velocity offset and project gain, align lyrics and phonemes
89
+ (Tavily-assisted for ambiguous characters), import/export Standard MIDI files,
90
+ and produce multiple singer variants of one melody.
91
+ - **Control plane (UIA only, no screen coordinates)** — open a project in the
92
+ running X Studio, trigger the cloud render preview, wait for completion,
93
+ snapshot the accessibility tree, perform one primitive action at a time,
94
+ assert UI state, answer dialog fingerprints safely, abort cleanly, and walk the
95
+ export dialog to produce WAV/MP3/FLAC.
96
+ - **Knowledge (local-only since 0.2.0)** — the singer catalog is a built-in
97
+ seed list and pronunciation comes from a deterministic local rule table; the
98
+ Tavily network layer was removed, so the package makes zero outbound calls.
99
+ Unknown dialogs resolve through a local fingerprint table and always return
100
+ the safe `manual` action when unmatched.
101
+ - **Two identical surfaces** — every tool is defined once in `src/tools/` and
102
+ is exposed both by the standalone CLI (`xstudio <tool>`) and by the stdio MCP
103
+ server. A contract checker fails CI if the two surfaces or the documented
104
+ table drift apart.
105
+ - **Manual fallback** — `xstudio_guide_print` prints exact menu paths and steps
106
+ for a human whenever the GUI cannot be driven.
107
+
108
+ ## Requirements
109
+
110
+ - Linux x64 with X11 or XWayland (a Wayland session works through XWayland;
111
+ the sidecar needs an X server for window queries).
112
+ - Wine, with X Studio 1.2.7 (NetEase Cloud Music edition) installed and signed
113
+ in for anything that needs the GUI or cloud rendering.
114
+ - Python 3 ≥ 3.8 for the GUI sidecar. Optional but recommended:
115
+ `python3-xlib` (X11 window queries), `python3-gobject` + `at-spi2-core`
116
+ (AT-SPI2 element tree), `xdotool` (keyboard input, fallback window queries),
117
+ ImageMagick (`import` for optional snapshots).
118
+ - Node.js ≥ 20.
119
+ - No network access is required or used.
120
+
121
+ ## Install
122
+
123
+ Published on npm as [`xstudio-linux`](https://www.npmjs.com/package/xstudio-linux):
124
+
125
+ ```bash
126
+ npm install -g xstudio-linux
127
+
128
+ xstudio --version # CLI (25 tools)
129
+ xstudio xstudio_probe --json '{"activate":true}'
130
+ xstudio-mcp --version # MCP stdio server
131
+
132
+ # or without a global install:
133
+ npx xstudio-linux --version
134
+ ```
135
+
136
+ From source:
137
+
138
+ ```bash
139
+ # 1. Build the package (typecheck + emit dist/)
140
+ pnpm install
141
+ pnpm build
142
+
143
+ # 2. Use it — either binary, globally or straight from dist/
144
+ node dist/adapter-cli/cli.js --list-tools
145
+ node dist/adapter-mcp/server.js --version
146
+ ```
147
+
148
+ Point the tools at your Wine install (auto-detected in the default prefix, or
149
+ set explicitly):
150
+
151
+ ```bash
152
+ export XSTUDIO_INSTALL_DIR="$HOME/.wine/drive_c/Program Files/NetEase Cloud Music XStudio"
153
+ export XSTUDIO_WINE_PREFIX="$HOME/.wine"
154
+ ```
155
+
156
+ `xstudio_probe` reports exactly which install dir was resolved and whether the
157
+ app is running (`pgrep` sees the Wine process).
158
+
159
+ ## Quick start
160
+
161
+ CLI (one process per call; exit code 0 = ok:true, 1 = ok:false):
162
+
163
+ ```bash
164
+ node dist/adapter-cli/cli.js xstudio_probe --json '{}'
165
+ node dist/adapter-cli/cli.js xstudio_project_read --json '{"path":"song.svip3","include":"notes"}'
166
+ node dist/adapter-cli/cli.js xstudio_note_add --json '{"project_path":"song.svip3","pos":480,"len":480,"pitch":62,"lyric":"啦"}'
167
+ ```
168
+
169
+ MCP client config (newline-delimited JSON-RPC 2.0 on stdio):
170
+
171
+ ```json
172
+ {
173
+ "mcpServers": {
174
+ "xstudio": {
175
+ "command": "node",
176
+ "args": ["/path/to/xstudio-linux/dist/adapter-mcp/server.js"],
177
+ "env": {
178
+ "XSTUDIO_INSTALL_DIR": "/home/me/.wine/drive_c/Program Files/NetEase Cloud Music XStudio",
179
+ "XSTUDIO_WINE_PREFIX": "/home/me/.wine"
180
+ }
181
+ }
182
+ }
183
+ }
184
+ ```
185
+
186
+ GUI sessions: `xstudio_probe` → data plane first → control plane only when the
187
+ GUI is really needed. The nine GUI tools run immediately — no skill-load step
188
+ is required (removed in 0.2.4). `skills/xstudio-gui/SKILL.md` remains bundled
189
+ as recommended reading: it documents the destructive-action blacklist, the
190
+ foreground gate and the unknown-dialog escalation rules that the sidecar still
191
+ enforces at runtime.
192
+
193
+ ## Configuration
194
+
195
+ Config comes from `--config <json-file>` (CLI/MCP) layered with environment
196
+ variables. Every value below is a real default; override only what you need.
197
+
198
+ ```json
199
+ {
200
+ "xstudioInstallDir": "", // empty → XSTUDIO_INSTALL_DIR → first existing candidate under the prefix
201
+ "workspaceDir": "~/.xstudio/", // caches, backups, screenshots
202
+ "defaultSinger": "beta-netease:wudi", // product-line prefix is mandatory
203
+ "backupOnWrite": true, // *.bak.<timestamp> before every mutation
204
+ "gui": {
205
+ "maxSteps": 60, // hard cap on GUI actions per orchestration
206
+ "maxWallClockMs": 180000, // hard cap on wall-clock time
207
+ "maxConsecutiveFailures": 2, // abort after this many consecutive failures
208
+ "recordScreen": false,
209
+ "requireForeground": true // act only when X Studio owns the foreground
210
+ },
211
+ "paths": { "preferredChain": ["pb", "gui", "guide"] },
212
+ "wine": {
213
+ "prefix": "~/.wine", // scanned for dosdevices/* drive mappings
214
+ "driveMappings": {} // explicit overrides, e.g. {"D:": "/mnt/d"}
215
+ }
216
+ }
217
+ ```
218
+
219
+ Environment variables: `XSTUDIO_INSTALL_DIR`, `XSTUDIO_WORKSPACE_DIR`,
220
+ `XSTUDIO_DEFAULT_SINGER`, `XSTUDIO_WINE_PREFIX`, `XSTUDIO_SIDECAR_PATH`
221
+ (override the bundled `sidecar/xstudio_uia.py` location), `XSTUDIO_PYTHON`
222
+ (override `python3`), `XSTUDIO_MCP_DEBUG=1` (stderr protocol diagnostics for
223
+ the MCP server).
224
+
225
+ ### Wine path translation
226
+
227
+ X Studio sees drive-letter paths (`Z:\home\me\…`) while the plugin speaks
228
+ Linux paths. `src/host/wine-paths.ts` reads `<prefix>/dosdevices/*` symlinks
229
+ once and converts in both directions; the orchestrator converts a path before
230
+ typing it into a Win32 file dialog and converts dialog-reported paths back
231
+ before comparing them with the requested `out_dir`. See
232
+ [docs/WINE.md](docs/WINE.md).
233
+
234
+ ## Tool surface
235
+
236
+ The nine GUI control-plane tools (`xstudio_open`, `xstudio_ui_snapshot`,
237
+ `xstudio_ui_act`, `xstudio_ui_assert`, `xstudio_ui_dialog_respond`,
238
+ `xstudio_ui_abort`, `xstudio_preview_trigger`, `xstudio_preview_wait`,
239
+ `xstudio_export_run`) are the ones that drive the real X Studio window; their
240
+ descriptions say so and point at `skills/xstudio-gui/SKILL.md` for the safety
241
+ rules. Since 0.2.4 they run without any prior skill-load step — the skill is
242
+ recommended reading, not a gate. `xstudio_probe`, `xstudio_guide_print` and
243
+ all data-plane tools are plain calls.
244
+
245
+ All 24 tools are registered with identical names, descriptions and JSON Schemas
246
+ on the DSH Host channel and the MCP channel. Every result is one envelope:
247
+
248
+ ```json
249
+ { "via": "pb|gui|tavily|guide|local-fallback",
250
+ "product_line": "beta-netease",
251
+ "ok": true,
252
+ "data": { },
253
+ "next": ["optional next-step hints"],
254
+ "warnings": ["optional degrade notes"] }
255
+ ```
256
+
257
+ and on failure `{ "ok": false, "error": { "code", "message", "hint", "next" } }`.
258
+
259
+ Paths accept an absolute path or a path relative to the session working
260
+ directory. Note positions are absolute ticks with PPQ = 480 (480 = quarter
261
+ note); removing a note never shifts the others.
262
+
263
+ ### Data plane (no GUI needed)
264
+
265
+ | Tool | Required parameters | Optional parameters | via | Returns / purpose |
266
+ |---|---|---|---|---|
267
+ | `xstudio_probe` | — | — | pb | Read-only self check: install detected, app running, workspace writable, sidecar present, Tavily enabled plus credential mode (`api-key` / `oauth` / none), degradation chain. Call this first. |
268
+ | `xstudio_singers_list` | — | `filter`, `lang`, `refresh` | pb (cache) / tavily (refresh) / local-fallback | Singer ids/names/styles/languages/flags. A warm cache is `via: "pb"` with zero network; `refresh: true` forces Tavily. |
269
+ | `xstudio_project_read` | `path` | `include` (`summary`\|`notes`\|`all`), `track_idx` | pb | Structured project summary, optional full note list, count of preserved unknown fields. |
270
+ | `xstudio_project_create` | `out_path`, `singer_id` | `bpm`, `time_sig`, `midi_path`, `lyrics`, `notes`, `track_label` | pb | New `.svip3` from a MIDI file (`lyrics` one per note) or an explicit `notes` list. `midi_path` and `notes` are mutually exclusive. Unprefixed singer ids get `beta-netease:`. |
271
+ | `xstudio_note_add` | `project_path`, `pos`, `len`, `pitch`, `lyric` | `track_idx`, `phoneme` | pb | Append one note; other notes keep their absolute positions. |
272
+ | `xstudio_note_remove` | `project_path`, `note_ref` | `track_idx` | pb | Remove one note by `{index}` or `{position_tick, midi_pitch?}`; the list is spliced, never re-timed. |
273
+ | `xstudio_note_edit` | `project_path`, `note_ref`, `fields` | `track_idx` | pb | Change only the supplied `pos`/`len`/`pitch`/`lyric`/`phoneme`; every other byte is preserved. |
274
+ | `xstudio_tempo_set` | `project_path`, `bpm` | — | pb | Set BPM (20–300), stored as `bpm_x100`; nothing else changes. |
275
+ | `xstudio_timesig_set` | `project_path`, `numerator`, `denominator` | — | pb | Set time signature; numerator 1–32, denominator ∈ {1,2,4,8,16,32}. |
276
+ | `xstudio_velocity_set` | `project_path`, `value` | `track_idx` | pb | Set the track's global velocity offset (linear float 0–10). |
277
+ | `xstudio_gain_set` | `project_path`, `linear_gain` | — | pb | Set project-level linear gain (0–10; observed range 1.0–6.0). |
278
+ | `xstudio_lyrics_align` | `project_path`, `lyrics` | `track_idx`, `mode` (`auto`\|`manual`) | pb / tavily | Assign one lyric per note in position order; fills phonemes, reporting low-confidence lookups. Only one character + a 2-character context is ever sent to Tavily. |
279
+ | `xstudio_midi_import` | `project_path`, `midi_path` | `map_lyrics`, `track_idx` | pb | Replace the track note list from a Standard MIDI File; optional lyrics in order. |
280
+ | `xstudio_midi_export` | `project_path`, `out_path` | `track_idx` | pb | Write the note list as a Standard MIDI File. |
281
+ | `xstudio_batch` | `jobs` | `concurrency` (1–3), `dry_run` | pb | One `.svip3` per singer from the same melody (files are always materialized, even when the target singer equals the source singer). Each job reports `ok`, `out_path`, `changed` and `error?`. `dry_run: true` validates jobs and reports `estimated_cloud_requests` without writing. **Files only** — rendering each variant is a separate GUI step. |
282
+
283
+ ### Control plane (requires the running app; AT-SPI2/X11 only)
284
+
285
+ | Tool | Required parameters | Optional parameters | via | Returns / purpose |
286
+ |---|---|---|---|---|
287
+ | `xstudio_open` | `project_path` | `timeout_ms` (default 30000) | gui | Open the project by relaunching the exe with the file as an argument — the single-instance app forwards the path (verified live under Wine). No keyboard or accessibility tree needed; polls the window title. |
288
+ | `xstudio_preview_trigger` | `project_path` | — | gui | Open the project and start the cloud render. Two-phase: returns as soon as the render starts. |
289
+ | `xstudio_preview_wait` | — | `timeout_ms` (default 120000) | gui | Poll UI state until the render completes; returns `completed:false` + evidence on timeout instead of throwing. |
290
+ | `xstudio_export_run` | `project_path`, `format`, `out_dir` | `sample_rate`, `bitrate` | gui | Walk the export dialog (format/sample rate/bitrate live there, never in the project) and verify the produced file. **Deferred in this build** — see Not supported. |
291
+ | `xstudio_ui_snapshot` | — | `include_screenshot`, `max_elements` (default 400) | gui | Numbered interactable elements (ref, name, automation id, class, control type, patterns, enabled, depth) + optional thumbnail. Refs expire with the snapshot. |
292
+ | `xstudio_ui_act` | `ref`, `op` | `value` | gui | Exactly one primitive: `click`, `set_text`, `select`, `invoke_pattern`, `send_keys`, `expand`, `collapse`. Coordinates are never accepted; destructive actions are refused. |
293
+ | `xstudio_ui_assert` | — | `ref`, `text`, `state`, `expect` | gui | Fail-fast assertion on exists/enabled/visible/focused/value or window text. |
294
+ | `xstudio_ui_dialog_respond` | — | `error_text`, `action` | gui / local-fallback | Match the open dialog against the local fingerprint table; unmatched text returns the always-safe `manual` suggestion (no network diagnosis since 0.2.0). Destructive dialogs are never auto-confirmed. |
295
+ | `xstudio_ui_abort` | — | — | gui | Abort the current orchestration and release control; project writes are atomic and backed up. |
296
+
297
+ ### Degrade
298
+
299
+ | Tool | Required parameters | Optional parameters | via | Returns / purpose |
300
+ |---|---|---|---|---|
301
+ | `xstudio_guide_print` | — | `topic` (`full`\|`render`\|`export`\|`dialogs`\|`recovery`), `project_path` | guide | Markdown manual with menu paths and screenshot anchors, for a human to finish what needs the GUI. |
302
+
303
+ ### Execution paths and `via`
304
+
305
+ | via | Meaning |
306
+ |---|---|
307
+ | pb | Pure TypeScript data plane (or the local catalog). No GUI, no network. |
308
+ | gui | The AT-SPI2/X11 sidecar drove the running X Studio (Wine) window. |
309
+ | local-fallback | A degraded-but-safe path answered: unknown dialog → manual, unmatched phoneme → empty, or an error was coerced. |
310
+ | guide | Manual instructions were returned instead of acting. |
311
+
312
+ ### Degradation matrix
313
+
314
+ | Capability | pb | gui | guide |
315
+ |---|---|---|---|
316
+ | Read / edit / create `.svip3` | ✅ always | — | — |
317
+ | Singer catalog | ✅ built-in (13 singers) | — | — |
318
+ | Pronunciation / phonemes | ✅ local rules | — | ✅ fallback for unknown chars |
319
+ | Unknown dialog diagnosis | ✅ known fingerprints | ✅ reads the dialog | ✅ manual for unknown text |
320
+ | Cloud render preview | — | ✅ required | ✅ `guide_print` |
321
+ | Export WAV/MP3/FLAC | — | ✅ required (deferred, see Not supported) | ✅ `guide_print` |
322
+ | GUI state inspection | — | ✅ required | ✅ printed steps |
323
+
324
+ When X Studio is not installed or not running: `xstudio_probe` returns the exact
325
+ reason, every data-plane tool keeps working, `xstudio_preview_trigger` /
326
+ `xstudio_export_run` fail with `XSTUDIO_NOT_RUNNING` and a hint to call
327
+ `xstudio_guide_print`. When the accessibility tree is unreachable under Wine,
328
+ element actions fail explicitly with `GUI_REF_NOT_FOUND` and the guide prints
329
+ manual steps — nothing pretends to work.
330
+
331
+ ### Dangerous-action blacklist
332
+
333
+ The GUI layer never auto-confirms and refuses to perform destructive actions:
334
+
335
+ - dialogs matching 保存 / save, 覆盖 / overwrite, 删除 / delete, 退出 / quit /
336
+ exit → forced `cancel`, never `confirm`;
337
+ - "是否保存更改 / save changes?" → answer Cancel/No unless a human explicitly
338
+ asked to save;
339
+ - deleting a track, overwriting an existing save, quitting the application;
340
+ - raw screen coordinates as an action target (no `(x, y)` input exists at all);
341
+ - more than one action per `xstudio_ui_act` call;
342
+ - action budgets: `maxSteps` (60), `maxWallClockMs` (180000),
343
+ `maxConsecutiveFailures` (2) → abort with `GUI_BUDGET_EXCEEDED` /
344
+ `GUI_ABORTED`.
345
+
346
+ Foreground is a **hard gate, not a yield-and-resume**: if X Studio does not own
347
+ the foreground, every GUI action is refused with `GUI_FOCUS_LOST` *before any
348
+ element is touched*, and the run stops rather than waiting for focus to return.
349
+ A `FOCUS_YIELD` resume event is specified but **not implemented in 0.1.2**
350
+ (defect #5); the fail-fast gate is the stricter behaviour, and its safety
351
+ property — no conflicting click while a human is driving — is verified live.
352
+
353
+ ## Not supported / known limitations (honest list)
354
+
355
+ - **From-scratch projects lack future unknown fields.** The codec preserves every
356
+ unknown field when editing an existing file; a project created from nothing
357
+ cannot contain fields a future X Studio version may expect. Prefer editing a
358
+ template project over creating from scratch.
359
+ - **`source_path` is normalized when the plugin writes.** The field is a stale
360
+ absolute-path snapshot; it is rewritten with forward slashes on write (after a
361
+ backup). Round-trip tests allow only this difference.
362
+ - **Export format, sample rate and bitrate are not in the project file.** They
363
+ only exist in the export dialog, so they can only be set through
364
+ `xstudio_export_run` (GUI), never through the data plane.
365
+ - **Read-only pass-through fields.** `internal_clock_base` (115200, *not* the
366
+ PPQ — PPQ is 480), `total_ticks`, `flags`, `visibility_mask`,
367
+ `payload.start_tick`/`end_tick`, `note_flag` and `expr_param_1/2` are never
368
+ given new semantics. `expr_param_* = -1.0` is a sentinel, not a value.
369
+ - **One singing track per project in this release** (`track_idx` 0 is the only
370
+ meaningful one). Instrument tracks and multi-track projects are passed through
371
+ but not edited.
372
+ - **No per-note expression/hide editing.** `xstudio_note_edit` covers position,
373
+ length, pitch, lyric and phoneme; to hide a note, remove it.
374
+ - **`xstudio_batch` writes files, it does not render.** Rendering each singer
375
+ variant is a separate two-phase GUI run, and `estimated_cloud_requests` is the
376
+ number of cloud requests the caller should confirm before doing so.
377
+ - **GUI automation is only as good as UIA.** The main window, its widget tree
378
+ (131 elements with a project open, 37–40 on the start window; AutomationIds,
379
+ patterns) and the sidecar protocol are verified live, read-only. Open-project
380
+ and cloud-render preview are verified live with human-confirmed audio (see
381
+ Verification status). The export-confirm flow is implemented and its guards
382
+ are verified fail-fast, but the full export is deferred — see the next item.
383
+ If an element cannot be resolved by its UIA identity the plugin fails with
384
+ `GUI_REF_NOT_FOUND` and tells you to re-snapshot — it never guesses
385
+ coordinates. The piano-roll note canvas exposes no per-note UIA elements
386
+ (note editing belongs to the data plane by design).
387
+ - **Cloud render is verified live; export to disk is deferred.** The render path
388
+ (open project → invoke play → cloud synthesis → completion evidence) was
389
+ exercised end-to-end against the running app and confirmed by ear. The export
390
+ path was not: the format combo-popup cannot be resolved through UIA in this
391
+ X Studio build (defect #2), and dialog state does not survive across
392
+ conversation turns, so `xstudio_export_run` cannot complete autonomously here.
393
+ Its guards were verified to fail fast rather than guess. Live export needs a
394
+ build where the combo-popup is UIA-reachable, or the manual guide
395
+ (`xstudio_guide_print({topic: "export"})`).
396
+ - **Tavily live behaviour is environment-dependent.** Both Tavily CLI credential
397
+ modes were verified live in this environment — OAuth (MCP transport) and plain
398
+ `api_key` (REST) — for singer refresh, pronunciation and dialog diagnosis. The
399
+ offline and circuit-open fallbacks remain fixture-tested. The plugin never
400
+ refreshes the CLI's OAuth token — run `tvly login` (or set `TAVILY_API_KEY`)
401
+ when it expires.
402
+ - **Skill gate removed (0.2.4).** The GUI tools used to require loading the
403
+ `xstudio-gui` skill first; that runtime precondition is gone. The decision
404
+ core (`SkillGate`) stays in the codebase with its whitelist and degraded
405
+ one-time-prompt semantics, so tests or a future opt-in policy can re-arm it
406
+ by injecting a rejecting probe — the default adapters never do.
407
+ - **Linux + Wine only (0.2.0).** The sidecar is Python 3 + AT-SPI2/X11; native
408
+ Windows support lives on the archived `main` branch (PowerShell 7 + UIA), and
409
+ macOS is not supported by either release.
410
+ - **Wine accessibility is the main open risk.** Wine's Qt build does not expose
411
+ the UIA tree to AT-SPI2 by default; until that bridge exists on a given
412
+ machine, element-addressed GUI actions fail explicitly with
413
+ `GUI_REF_NOT_FOUND` and the guide is the fallback. `scripts/wine-gui-probe.py`
414
+ reports the live state honestly. Window-level operations (probe, foreground
415
+ check, send_keys) still work when an X server is reachable.
416
+ - **Export via the GUI is deferred** (as on Windows): the export format
417
+ combo-popup could not be driven in the verified Windows rounds, and the same
418
+ dialog under Wine is pending on-machine calibration.
419
+ - **No login, download or paid-model automation.** Those steps are human-only by
420
+ design.
421
+
422
+ ## Troubleshooting
423
+
424
+ Failure envelopes are stable API: match on `error.code`.
425
+
426
+ | Code | Meaning / next step |
427
+ |---|---|
428
+ | `CONFIG_INVALID` | Config validation failed (CLI `--config` JSON / env vars). Check the types and documented ranges. |
429
+ | `XSTUDIO_NOT_INSTALLED` | `xstudioInstallDir` does not contain `NetEase Cloud Music XStudio.exe`. Fix the path and re-run `xstudio_probe`. |
430
+ | `XSTUDIO_NOT_RUNNING` | GUI tools need the app. Start it, re-run `xstudio_probe`, or stay on the data plane + `xstudio_guide_print`. |
431
+ | `WORKSPACE_UNWRITABLE` | `workspaceDir` is not writable; pick another directory. |
432
+ | `PROJECT_NOT_FOUND` | Wrong path. Paths may be absolute or relative to the session working directory. |
433
+ | `PROJECT_UNREADABLE` | I/O failure reading the file (permissions/lock). |
434
+ | `PROJECT_DECODE_FAILED` | Not a `.svip3` this codec understands. Keep the original; the plugin never rewrites what it cannot decode. |
435
+ | `PROJECT_INVALID` | A value failed validation (out-of-range tick/pitch/BPM, bad `time_sig`, etc.). |
436
+ | `TRACK_OUT_OF_RANGE` | `track_idx` does not name a singing track. Use 0. |
437
+ | `NOTE_NOT_FOUND` | The note ref does not match. Read `include: "notes"` to list indices. |
438
+ | `BACKUP_FAILED` | Could not create `*.bak.<timestamp>`; the write is refused rather than performed unbacked. |
439
+ | `MIDI_PARSE_FAILED` / `MIDI_EMPTY` | The MIDI file is malformed or contains no notes. |
440
+ | `NEED_SKILL` | Retired as a runtime outcome in 0.2.4 (the skill-load precondition was removed). The code is kept in the error table for protocol compatibility; it only appears if a host re-arms the `SkillGate` with a rejecting probe. |
441
+ | `GUI_ACTION_FAILED` | A UIA primitive failed; re-snapshot and retry, or fall back to guide. |
442
+ | `GUI_REF_NOT_FOUND` | The ref is stale (refs are snapshot-scoped). Call `xstudio_ui_snapshot` again. |
443
+ | `GUI_ASSERT_FAILED` | The expected UI state is absent; the orchestration stops fail-fast. |
444
+ | `GUI_FOCUS_LOST` | X Studio does not own the foreground (another window has focus, or it is minimised). The action was refused **before touching any element**. Bring X Studio to the foreground, then re-snapshot and retry. |
445
+ | `GUI_BUDGET_EXCEEDED` | `maxSteps` / `maxWallClockMs` / `maxConsecutiveFailures` reached; the run aborted. |
446
+ | `GUI_ABORTED` | `xstudio_ui_abort` (or the abort path) stopped the orchestration. |
447
+ | `DIALOG_UNKNOWN` | Unknown dialog text; provide it to `xstudio_ui_dialog_respond` for diagnosis or handle it manually. |
448
+ | `CLOUD_UNREACHABLE` | The vendor cloud cannot be reached. Edits are safe; retry when online. |
449
+ | `RENDER_TIMEOUT` | Render did not finish inside `timeout_ms`; retry with a larger timeout or inspect dialogs. |
450
+ | `EXPORT_FAILED` / `ARTIFACT_MISSING` | The export dialog flow failed or no file appeared; retry or use the manual export guide. In this build the format combo-popup is UIA-unreachable (defect #2), so a `EXPORT_FAILED` naming the format control is expected, not a bug. |
451
+ | `GUIDE_ONLY` | Only the manual path is possible; follow the printed steps. |
452
+
453
+ ## MCP stdio server
454
+
455
+ The same 24 tools are exposed over the Model Context Protocol
456
+ (`2024-11-05`, newline-delimited JSON-RPC 2.0 on stdin/stdout):
457
+
458
+ ```bash
459
+ node dist/adapter-mcp/server.js # serve on stdio
460
+ node dist/adapter-mcp/server.js --help # CLI help
461
+ node dist/adapter-mcp/server.js --version # package version
462
+ node dist/adapter-mcp/server.js --config x.json # optional JSON config object
463
+ ```
464
+
465
+ Environment overrides: `XSTUDIO_INSTALL_DIR`, `XSTUDIO_WORKSPACE_DIR`,
466
+ `XSTUDIO_DEFAULT_SINGER`, `XSTUDIO_WINE_PREFIX`. Diagnostics go to stderr
467
+ only; stdout is reserved for protocol frames. Set `XSTUDIO_MCP_DEBUG=1` for
468
+ debug logs.
469
+
470
+ ## Examples
471
+
472
+ Five runnable Node ESM examples live in `[examples/](examples/README.md)`; they
473
+ execute the real compiled tool definitions and degrade gracefully without a GUI
474
+ or a Tavily key:
475
+
476
+ ```bash
477
+ node examples/01-midi-to-wudi.mjs # MIDI → .svip3 → simulated render hand-off
478
+ node examples/02-three-singers-compare.mjs
479
+ node examples/03-velocity-diction-rerender.mjs
480
+ node examples/04-unknown-dialog-abort.mjs
481
+ ```
482
+
483
+ Four runnable Node ESM examples live in `[examples/](examples/README.md)`; they
484
+ execute the real compiled tool definitions against a fake GUI sidecar and the
485
+ local knowledge plane, so they are deterministic and fully offline.
486
+
487
+ ## Privacy
488
+
489
+ Zero telemetry, zero reporting, **zero outbound network** (0.2.0). The plugin
490
+ sends nothing to the plugin author or any third party, and there is no code
491
+ path that could: the Tavily layer was removed and `src/core/**` has no sockets.
492
+
493
+ - The only external channels are the local filesystem (`.svip3` / `.mid` /
494
+ audio artifacts) and the local AT-SPI2/X11 channel to the Wine instance.
495
+ - Nothing about your lyrics, projects or usage leaves the machine.
496
+ - Search results are data, never instructions. See compliance item 10 and
497
+ §5.5 of the spec.
498
+
499
+ ## Development
500
+
501
+ ```bash
502
+ # 1. typecheck (clean) and build (emits dist/)
503
+ pnpm run typecheck
504
+ pnpm run build
505
+
506
+ # 2. all tests: run the runner from dist/ so it discovers only compiled
507
+ # JavaScript. The no-argument form from dist/ is portable across Node builds.
508
+ (cd dist && node --test)
509
+
510
+ # 3. tool-surface contract: shared registry vs MCP exposure vs README table
511
+ pnpm run check:contract
512
+
513
+ # 4. end-to-end examples (offline, fake GUI; see examples/README.md)
514
+ node examples/01-midi-to-wudi.mjs
515
+
516
+ # 5. Wine GUI calibration on a real machine (read-only; see docs/WINE.md)
517
+ pnpm run wine:probe
518
+ ```
519
+
520
+ CI (`.github/workflows/ci.yml`) runs install → typecheck → build → all tests →
521
+ contract check → MCP smoke → entry smoke on a Node 20/22/24 Linux matrix, plus
522
+ a Python job that syntax-checks the sidecar and verifies its offline protocol
523
+ behavior. The contract check fails if the shared registry, the MCP exposure and
524
+ the README tool table ever disagree.
525
+
526
+ Repository layout: `src/core` (pure TypeScript: svip codec/editor, MIDI,
527
+ catalog, diagnose, render, guard) · `src/tools` (24 tool definitions + shared
528
+ plumbing) · `src/config.ts` / `src/services.ts` / `src/index.ts` (standalone
529
+ config + wiring + programmatic API) · `src/adapter-cli` (CLI entry) ·
530
+ `src/adapter-mcp` (stdio JSON-RPC server) · `src/host` (sidecar client, Linux
531
+ probes, Wine path translation) · `sidecar/xstudio_uia.py` (Python AT-SPI2/X11
532
+ bridge) · `skills/xstudio-gui` (F-layer manual) · `proto` (community-verifiable
533
+ `.proto`) · `fixtures` (real project fixtures) · `docs` (SPEC, RECON, DESIGN,
534
+ RECON-GUI, WINE) · `examples`.
535
+
536
+ ## License
537
+
538
+ MIT — see [LICENSE](LICENSE). The license covers this repository's code and
539
+ docs only; it grants no rights to NetEase/X Studio binaries, voice models or
540
+ assets, which are not distributed here.
541
+
542
+ If NetEase (or another rights holder) believes this project oversteps, open an
543
+ issue titled "takedown" in the repository and it will be removed promptly.
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env node
2
+ import { type ToolServices } from '../services.js';
3
+ /** Parsed command line for the CLI process. */
4
+ export interface CliArgs {
5
+ tool?: string;
6
+ argsJson?: string;
7
+ argsFile?: string;
8
+ configFile?: string;
9
+ listTools: boolean;
10
+ help: boolean;
11
+ versionFlag: boolean;
12
+ }
13
+ /** Parse `process.argv.slice(2)`. */
14
+ export declare function parseArgs(argv: string[]): CliArgs;
15
+ /** Read a `--config` JSON object. */
16
+ export declare function readConfigFile(path: string): Record<string, unknown>;
17
+ /** Layer the CLI environment variables over a config file object. */
18
+ export declare function configFromEnvironment(env?: NodeJS.ProcessEnv, fileConfig?: Record<string, unknown>): Record<string, unknown>;
19
+ /** Run one tool call through the shared definitions. */
20
+ export declare function runToolCall(services: ToolServices, toolName: string, args: Record<string, unknown>, signal: AbortSignal): Promise<{
21
+ envelope: Record<string, unknown>;
22
+ exitCode: number;
23
+ }>;
24
+ /** CLI entry point. */
25
+ export declare function main(argv?: string[]): Promise<number>;
26
+ /** True when this module is the process entry point (realpath-aware: npm
27
+ * .bin symlinks point at this file but argv[1] keeps the symlink path). */
28
+ export declare function isEntryPoint(): boolean;