xstudio-linux 0.0.0-stage → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +443 -0
- package/LICENSE +31 -0
- package/README.md +527 -2
- package/dist/adapter-cli/cli.d.ts +28 -0
- package/dist/adapter-cli/cli.js +235 -0
- package/dist/adapter-cli/cli.js.map +1 -0
- package/dist/adapter-mcp/server.d.ts +81 -0
- package/dist/adapter-mcp/server.js +477 -0
- package/dist/adapter-mcp/server.js.map +1 -0
- package/dist/config.d.ts +45 -0
- package/dist/config.js +78 -0
- package/dist/config.js.map +1 -0
- package/dist/core/catalog/pronunciation.d.ts +47 -0
- package/dist/core/catalog/pronunciation.js +402 -0
- package/dist/core/catalog/pronunciation.js.map +1 -0
- package/dist/core/catalog/singers.d.ts +46 -0
- package/dist/core/catalog/singers.js +122 -0
- package/dist/core/catalog/singers.js.map +1 -0
- package/dist/core/contracts.d.ts +348 -0
- package/dist/core/contracts.js +17 -0
- package/dist/core/contracts.js.map +1 -0
- package/dist/core/degrade/chain.d.ts +80 -0
- package/dist/core/degrade/chain.js +137 -0
- package/dist/core/degrade/chain.js.map +1 -0
- package/dist/core/diagnose/error-resolver.d.ts +51 -0
- package/dist/core/diagnose/error-resolver.js +202 -0
- package/dist/core/diagnose/error-resolver.js.map +1 -0
- package/dist/core/guard/skill-gate.d.ts +89 -0
- package/dist/core/guard/skill-gate.js +121 -0
- package/dist/core/guard/skill-gate.js.map +1 -0
- package/dist/core/midi/convert.d.ts +31 -0
- package/dist/core/midi/convert.js +125 -0
- package/dist/core/midi/convert.js.map +1 -0
- package/dist/core/midi/smf.d.ts +37 -0
- package/dist/core/midi/smf.js +422 -0
- package/dist/core/midi/smf.js.map +1 -0
- package/dist/core/render/artifacts.d.ts +37 -0
- package/dist/core/render/artifacts.js +417 -0
- package/dist/core/render/artifacts.js.map +1 -0
- package/dist/core/render/orchestrator.d.ts +110 -0
- package/dist/core/render/orchestrator.js +974 -0
- package/dist/core/render/orchestrator.js.map +1 -0
- package/dist/core/svip/codec.d.ts +30 -0
- package/dist/core/svip/codec.js +664 -0
- package/dist/core/svip/codec.js.map +1 -0
- package/dist/core/svip/document.d.ts +31 -0
- package/dist/core/svip/document.js +158 -0
- package/dist/core/svip/document.js.map +1 -0
- package/dist/core/svip/editor.d.ts +71 -0
- package/dist/core/svip/editor.js +245 -0
- package/dist/core/svip/editor.js.map +1 -0
- package/dist/core/svip/model.d.ts +74 -0
- package/dist/core/svip/model.js +158 -0
- package/dist/core/svip/model.js.map +1 -0
- package/dist/core/svip/tick.d.ts +21 -0
- package/dist/core/svip/tick.js +59 -0
- package/dist/core/svip/tick.js.map +1 -0
- package/dist/core/svip/validator.d.ts +39 -0
- package/dist/core/svip/validator.js +267 -0
- package/dist/core/svip/validator.js.map +1 -0
- package/dist/host/linux.d.ts +15 -0
- package/dist/host/linux.js +42 -0
- package/dist/host/linux.js.map +1 -0
- package/dist/host/sidecar.d.ts +61 -0
- package/dist/host/sidecar.js +365 -0
- package/dist/host/sidecar.js.map +1 -0
- package/dist/host/wine-launch.d.ts +60 -0
- package/dist/host/wine-launch.js +77 -0
- package/dist/host/wine-launch.js.map +1 -0
- package/dist/host/wine-paths.d.ts +30 -0
- package/dist/host/wine-paths.js +103 -0
- package/dist/host/wine-paths.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/services.d.ts +55 -0
- package/dist/services.js +78 -0
- package/dist/services.js.map +1 -0
- package/dist/shared/errors.d.ts +61 -0
- package/dist/shared/errors.js +125 -0
- package/dist/shared/errors.js.map +1 -0
- package/dist/shared/paths.d.ts +8 -0
- package/dist/shared/paths.js +30 -0
- package/dist/shared/paths.js.map +1 -0
- package/dist/shared/schema.d.ts +26 -0
- package/dist/shared/schema.js +68 -0
- package/dist/shared/schema.js.map +1 -0
- package/dist/shared/types.d.ts +43 -0
- package/dist/shared/types.js +19 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/tests/unit/artifacts.test.d.ts +1 -0
- package/dist/tests/unit/artifacts.test.js +243 -0
- package/dist/tests/unit/artifacts.test.js.map +1 -0
- package/dist/tests/unit/data-plane.test.d.ts +1 -0
- package/dist/tests/unit/data-plane.test.js +153 -0
- package/dist/tests/unit/data-plane.test.js.map +1 -0
- package/dist/tests/unit/degrade.test.d.ts +1 -0
- package/dist/tests/unit/degrade.test.js +133 -0
- package/dist/tests/unit/degrade.test.js.map +1 -0
- package/dist/tests/unit/diagnosis.test.d.ts +1 -0
- package/dist/tests/unit/diagnosis.test.js +66 -0
- package/dist/tests/unit/diagnosis.test.js.map +1 -0
- package/dist/tests/unit/errors.test.d.ts +1 -0
- package/dist/tests/unit/errors.test.js +83 -0
- package/dist/tests/unit/errors.test.js.map +1 -0
- package/dist/tests/unit/mcp-server.test.d.ts +1 -0
- package/dist/tests/unit/mcp-server.test.js +267 -0
- package/dist/tests/unit/mcp-server.test.js.map +1 -0
- package/dist/tests/unit/mcp-smoke.d.ts +6 -0
- package/dist/tests/unit/mcp-smoke.js +7 -0
- package/dist/tests/unit/mcp-smoke.js.map +1 -0
- package/dist/tests/unit/mcp-smoke.test.d.ts +1 -0
- package/dist/tests/unit/mcp-smoke.test.js +196 -0
- package/dist/tests/unit/mcp-smoke.test.js.map +1 -0
- package/dist/tests/unit/midi.test.d.ts +1 -0
- package/dist/tests/unit/midi.test.js +255 -0
- package/dist/tests/unit/midi.test.js.map +1 -0
- package/dist/tests/unit/pronunciation.test.d.ts +1 -0
- package/dist/tests/unit/pronunciation.test.js +83 -0
- package/dist/tests/unit/pronunciation.test.js.map +1 -0
- package/dist/tests/unit/registry-contract.test.d.ts +1 -0
- package/dist/tests/unit/registry-contract.test.js +114 -0
- package/dist/tests/unit/registry-contract.test.js.map +1 -0
- package/dist/tests/unit/render-orchestrator.test.d.ts +1 -0
- package/dist/tests/unit/render-orchestrator.test.js +548 -0
- package/dist/tests/unit/render-orchestrator.test.js.map +1 -0
- package/dist/tests/unit/sidecar.test.d.ts +1 -0
- package/dist/tests/unit/sidecar.test.js +299 -0
- package/dist/tests/unit/sidecar.test.js.map +1 -0
- package/dist/tests/unit/singers.test.d.ts +1 -0
- package/dist/tests/unit/singers.test.js +73 -0
- package/dist/tests/unit/singers.test.js.map +1 -0
- package/dist/tests/unit/skill-gate.test.d.ts +1 -0
- package/dist/tests/unit/skill-gate.test.js +182 -0
- package/dist/tests/unit/skill-gate.test.js.map +1 -0
- package/dist/tests/unit/svip-codec.test.d.ts +1 -0
- package/dist/tests/unit/svip-codec.test.js +182 -0
- package/dist/tests/unit/svip-codec.test.js.map +1 -0
- package/dist/tests/unit/svip-document.test.d.ts +1 -0
- package/dist/tests/unit/svip-document.test.js +137 -0
- package/dist/tests/unit/svip-document.test.js.map +1 -0
- package/dist/tests/unit/svip-editor.test.d.ts +1 -0
- package/dist/tests/unit/svip-editor.test.js +275 -0
- package/dist/tests/unit/svip-editor.test.js.map +1 -0
- package/dist/tests/unit/svip-tick.test.d.ts +1 -0
- package/dist/tests/unit/svip-tick.test.js +66 -0
- package/dist/tests/unit/svip-tick.test.js.map +1 -0
- package/dist/tools/common.d.ts +80 -0
- package/dist/tools/common.js +167 -0
- package/dist/tools/common.js.map +1 -0
- package/dist/tools/control.d.ts +21 -0
- package/dist/tools/control.js +376 -0
- package/dist/tools/control.js.map +1 -0
- package/dist/tools/data.d.ts +37 -0
- package/dist/tools/data.js +680 -0
- package/dist/tools/data.js.map +1 -0
- package/dist/tools/definition.d.ts +60 -0
- package/dist/tools/definition.js +44 -0
- package/dist/tools/definition.js.map +1 -0
- package/dist/tools/degrade.d.ts +3 -0
- package/dist/tools/degrade.js +30 -0
- package/dist/tools/degrade.js.map +1 -0
- package/dist/tools/guide.d.ts +10 -0
- package/dist/tools/guide.js +66 -0
- package/dist/tools/guide.js.map +1 -0
- package/dist/tools/open.d.ts +3 -0
- package/dist/tools/open.js +74 -0
- package/dist/tools/open.js.map +1 -0
- package/dist/tools/probe.d.ts +8 -0
- package/dist/tools/probe.js +132 -0
- package/dist/tools/probe.js.map +1 -0
- package/dist/tools/registry.d.ts +10 -0
- package/dist/tools/registry.js +16 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/version.d.ts +4 -0
- package/dist/version.js +19 -0
- package/dist/version.js.map +1 -0
- package/docs/DESIGN.md +553 -0
- package/docs/RECON-GUI.md +271 -0
- package/docs/RECON.md +339 -0
- package/docs/SPEC.md +786 -0
- package/docs/WINE.md +192 -0
- package/examples/.scratch/01-midi-to-wudi/wudi-demo.svip3 +0 -0
- package/examples/.scratch/01-midi-to-wudi/wudi-melody.mid +0 -0
- package/examples/.scratch/01-midi-to-wudi/wudi-roundtrip.mid +0 -0
- package/examples/.scratch/02-three-singers/melody.chenziyu.svip3 +0 -0
- package/examples/.scratch/02-three-singers/melody.hechang.svip3 +0 -0
- package/examples/.scratch/02-three-singers/melody.svip3 +0 -0
- package/examples/.scratch/02-three-singers/melody.wudi.svip3 +0 -0
- package/examples/.scratch/03-velocity-diction/phrase.svip3 +0 -0
- package/examples/.scratch/03-velocity-diction/phrase.svip3.bak.20261206-163755-200 +0 -0
- package/examples/.scratch/03-velocity-diction/phrase.svip3.bak.20261206-163755-203 +0 -0
- package/examples/.scratch/03-velocity-diction/phrase.svip3.bak.20261206-163755-204 +0 -0
- package/examples/.scratch/04-unknown-dialog-abort/dialog-demo.svip3 +0 -0
- package/examples/01-midi-to-wudi.mjs +144 -0
- package/examples/02-three-singers-compare.mjs +140 -0
- package/examples/03-velocity-diction-rerender.mjs +160 -0
- package/examples/04-unknown-dialog-abort.mjs +126 -0
- package/examples/README.md +101 -0
- package/examples/lib/harness.mjs +274 -0
- package/fixtures/midi/melody-480.mid +0 -0
- package/fixtures/midi/melody-96.mid +0 -0
- package/fixtures/svip/1.svip3 +0 -0
- package/fixtures/svip/3.svip3 +0 -0
- package/fixtures/uia/README.md +37 -0
- package/fixtures/uia/export-dialog.snapshot.json +446 -0
- package/fixtures/uia/main-window.snapshot.json +2997 -0
- package/fixtures/uia/open-dialog.snapshot.json +103 -0
- package/icon.svg +10 -0
- package/package.json +84 -4
- package/proto/xstudio.proto +128 -0
- package/scripts/check-contract.mjs +184 -0
- package/scripts/entry-smoke.mjs +26 -0
- package/scripts/inspect-svip.mjs +161 -0
- package/scripts/setup-venv.sh +93 -0
- package/scripts/wine-gui-probe.py +302 -0
- package/sidecar/xstudio_uia.py +1478 -0
- package/skills/xstudio-gui/SKILL.md +194 -0
- package/skills/xstudio-gui/assertions.md +103 -0
- package/skills/xstudio-gui/dialogs.md +90 -0
- package/skills/xstudio-gui/gestures.md +158 -0
- package/skills/xstudio-gui/ui-map.json +242 -0
package/docs/DESIGN.md
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
# dsh-xstudio — design
|
|
2
|
+
|
|
3
|
+
Status: design record for `dsh-xstudio` 0.1.0 (DSH 0.2.1-rc.2, X Studio 1.2.7
|
|
4
|
+
NetEase Cloud Music edition). Normative requirements live in
|
|
5
|
+
[docs/SPEC.md](SPEC.md); evidence for every format claim lives in
|
|
6
|
+
[docs/RECON.md](RECON.md); the GUI feasibility audit is in
|
|
7
|
+
[docs/RECON-GUI.md](RECON-GUI.md). This document explains *how the shipped code
|
|
8
|
+
is organized* and which claims are verified.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Goals and non-goals
|
|
13
|
+
|
|
14
|
+
**Goal.** Give a DSH agent the shortest reliable path through the loop
|
|
15
|
+
`edit .svip3 → drive X Studio to render → verify the artifact → optionally export`:
|
|
16
|
+
|
|
17
|
+
- the **data plane** edits project files in pure TypeScript (protobufjs only,
|
|
18
|
+
no native code, no network);
|
|
19
|
+
- the **control plane** is the *only* path that touches the GUI, and it does so
|
|
20
|
+
through UIA accessibility actions, never screen coordinates;
|
|
21
|
+
- **Tavily** enriches knowledge (singers, pronunciation, unknown dialogs) and is
|
|
22
|
+
strictly read-only decision support;
|
|
23
|
+
- every result says which path actually ran (`via`) and degrades explicitly.
|
|
24
|
+
|
|
25
|
+
**Non-goals (v0.1.0).** Binary patching/injection, auth or paywall bypass,
|
|
26
|
+
implementing the vendor's worker/shared-memory protocol, reimplementing cloud
|
|
27
|
+
render endpoints, multi-track/instrument editing, macOS support, and any hosted
|
|
28
|
+
service. See README "Not supported".
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## 2. Architecture
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
┌──────────────────────────────────────────────────────────────────────────────┐
|
|
36
|
+
│ Clients │
|
|
37
|
+
│ DSH Host agent (profile plugin) Any MCP client (stdio JSON-RPC) │
|
|
38
|
+
│ ctx.tools.register(...) stdin/stdout 2024-11-05 │
|
|
39
|
+
└───────────────┬──────────────────────────────────────────────────┬───────────┘
|
|
40
|
+
│ │
|
|
41
|
+
┌───────────────▼────────────────────┐ ┌────────────────────▼──────────┐
|
|
42
|
+
│ adapter-dsh/ │ │ adapter-mcp/server.ts │
|
|
43
|
+
│ index.ts apply(ctx, config) │ │ initialize / tools/list / │
|
|
44
|
+
│ config.ts Schemastery schema │ │ tools/call, arg validation, │
|
|
45
|
+
│ services.ts dependency wiring │ │ config from env + --config │
|
|
46
|
+
│ local-tool.ts defineTool shim │ └───────────────────────────────┘
|
|
47
|
+
│ context.ts Host API subset │ │
|
|
48
|
+
│ tools/ probe, data, control,│──────────────────────┘
|
|
49
|
+
│ degrade, guide, │ (both adapters build the SAME surface
|
|
50
|
+
│ common, registry │ via buildToolDefinitions(services))
|
|
51
|
+
└───────────────┬────────────────────┘
|
|
52
|
+
│ ToolServices (one per activation / MCP process)
|
|
53
|
+
┌───────────────▼──────────────────────────────────────────────────────────────┐
|
|
54
|
+
│ core/ (pure TypeScript; no child_process, no native addons) │
|
|
55
|
+
│ │
|
|
56
|
+
│ svip/ model.ts ← createEmptyProject/createNote/cloneModel │
|
|
57
|
+
│ codec.ts ← decodeProject/encodeProject/modelsEqual │
|
|
58
|
+
│ document.ts ← read/write transactions, backup, no-op detection │
|
|
59
|
+
│ editor.ts ← note CRUD, tempo/timesig/velocity/gain, summarize │
|
|
60
|
+
│ validator.ts ← validateProject, resolveNoteRef │
|
|
61
|
+
│ tick.ts ← PPQ 480, tick↔ms/beats │
|
|
62
|
+
│ midi/ smf.ts ← dependency-free SMF parse/write │
|
|
63
|
+
│ convert.ts ← midiToNotes / notesToMidi │
|
|
64
|
+
│ catalog/ singers.ts ← local seeds + TTL cache + Tavily refresh │
|
|
65
|
+
│ pronunciation.ts ← local rules + low-confidence Tavily lookup │
|
|
66
|
+
│ diagnose/error-resolver.ts ← fingerprints + Tavily-synthesized enum action │
|
|
67
|
+
│ tavily/ config.ts client.ts breaker.ts ratelimit.ts cache.ts sanitize.ts │
|
|
68
|
+
│ state.ts ← one shared client/breaker per config │
|
|
69
|
+
│ degrade/ chain.ts ← pb-editable → gui-assisted → guide-only selection │
|
|
70
|
+
│ render/ orchestrator.ts artifacts.ts ← GUI two-phase render/export │
|
|
71
|
+
│ contracts.ts ← the single interface contract between all of the above │
|
|
72
|
+
└───────────────┬───────────────────────────────────────┬──────────────────────┘
|
|
73
|
+
│ FS: .svip3 / .mid / audio artifacts │ HTTPS (Tavily only)
|
|
74
|
+
┌───────────────▼───────────────────────┐ ┌───────────▼──────────────────────┐
|
|
75
|
+
│ src/host/sidecar.ts │ │ https://api.tavily.com/search │
|
|
76
|
+
│ spawns pwsh -File sidecar/uia.ps1 │ │ (only allowed outbound dest.) │
|
|
77
|
+
│ JSON lines in/out, timeout, abort │ └──────────────────────────────────┘
|
|
78
|
+
└───────────────┬───────────────────────┘
|
|
79
|
+
│ stdin/stdout JSON
|
|
80
|
+
┌───────────────▼──────────────────────────────────────────────────────────────┐
|
|
81
|
+
│ sidecar/uia.ps1 (PowerShell 7 + .NET UIAutomation) │
|
|
82
|
+
│ probe · snapshot · act · assert · readDialog · respondDialog · abort · close│
|
|
83
|
+
│ finds `NetEase Cloud Music XStudio` by process name + `Qt622QWindowIcon`; │
|
|
84
|
+
│ refs are snapshot-scoped; never caches screen coordinates; refuses │
|
|
85
|
+
│ destructive dialogs unless a human explicitly chooses │
|
|
86
|
+
└───────────────┬──────────────────────────────────────────────────────────────┘
|
|
87
|
+
│ UIA
|
|
88
|
+
┌───────▼──────────────────────┐
|
|
89
|
+
│ X Studio (Qt 6) main window │──cloud──▶ vendor render service
|
|
90
|
+
└──────────────────────────────┘ (not contacted by us)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Hard boundaries**
|
|
94
|
+
|
|
95
|
+
1. `src/core/**` never spawns processes and never opens sockets; its only I/O is
|
|
96
|
+
files plus the injected Tavily `fetchImpl`.
|
|
97
|
+
2. `src/host/**` is the only place allowed to spawn (the PowerShell sidecar).
|
|
98
|
+
3. GUI actions exist only in `sidecar/uia.ps1` + `core/render/*`, behind the
|
|
99
|
+
`GuiSidecar` interface; the model never supplies coordinates.
|
|
100
|
+
4. One tool definition source (`buildToolDefinitions`) feeds both adapters, so
|
|
101
|
+
the DSH and MCP schemas cannot drift (enforced by `scripts/check-contract.mjs`).
|
|
102
|
+
5. Every result is the same envelope: `via`, `product_line: "beta-netease"`,
|
|
103
|
+
`ok`, `data | error{code,message,hint,next}`, optional `warnings`/`next`.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 3. §4 schema summary (verified against real fixtures)
|
|
108
|
+
|
|
109
|
+
`.svip3` = a protobuf message from package `xstudio.proto` (observed Any type
|
|
110
|
+
URL `type.googleapis.com/xstudio.proto.SingingTrack`). Full field table:
|
|
111
|
+
|
|
112
|
+
| Message | Field | Type | Semantics | Status |
|
|
113
|
+
| --- | --- | --- | --- | --- |
|
|
114
|
+
| `Project` | `source_path = 1` | string | absolute-path snapshot; **normalized on write** | verified |
|
|
115
|
+
| | `app_version = 2` | string | `"3.0.3"` (internal schema version; installed app is 1.2.7) | verified |
|
|
116
|
+
| | `internal_clock_base = 3` | uint32 | 115200; **not PPQ**, read-only pass-through | verified |
|
|
117
|
+
| | `tempo = 4` | `TempoInfo` | bpm_x100 | verified |
|
|
118
|
+
| | `time_sig = 5` | `TimeSignature` | 4/4 ↔ 3/4 changes only numerator in samples | verified |
|
|
119
|
+
| | `track_data = 6` | `google.protobuf.Any` | `SingingTrack` payload | verified |
|
|
120
|
+
| | `gain = 7` | `GainInfo` | linear gain, observed [1.0, 6.0] | verified |
|
|
121
|
+
| | `unknown_field_9 = 9` | uint32 | constant 8; read-only | verified |
|
|
122
|
+
| | `total_ticks = 11` | uint32 | 7680; read-only | verified |
|
|
123
|
+
| | `flags = 12` | uint32 | 1; read-only | verified |
|
|
124
|
+
| | `display = 14` | `DisplayMeta` | placeholder `"-"` | verified |
|
|
125
|
+
| `TempoInfo` | `bpm_x100 = 2` | uint32 | 12000 → 120.00 BPM | verified |
|
|
126
|
+
| `TimeSignature` | `ns = 2` | `NumeratorDenominator` | — | verified |
|
|
127
|
+
| `NumeratorDenominator` | `numerator = 1`, `denominator = 2` | uint32 | 4/4 → 3/4 sample: numerator 4→3, denominator stays 4 | verified |
|
|
128
|
+
| `GainInfo` | `linear_gain = 1` | float | linear gain | verified |
|
|
129
|
+
| `DisplayMeta` | `placeholder = 2` | string | `"-"` | verified |
|
|
130
|
+
| `SingingTrack` | `velocity_offset = 1` | float | global velocity offset (0.7, 1.0 in samples) | verified |
|
|
131
|
+
| | `singer_name = 4` | string | display name, e.g. `何畅` | verified |
|
|
132
|
+
| | `ui_color_hex = 6` | string | `"#7F97AE"` | verified |
|
|
133
|
+
| | `track_type = 7` | uint32 | 2 = singing | verified |
|
|
134
|
+
| | `payload = 8` | `TrackPayload` | — | verified |
|
|
135
|
+
| | `uuid = 9` | string | track UUID | verified |
|
|
136
|
+
| | `pan_db = 12` | float | −18.0 in samples | verified |
|
|
137
|
+
| `TrackPayload` | `label = 1` | string | `"未命名"` | verified |
|
|
138
|
+
| | `sub_type = 2` | uint32 | 2; never changed | verified |
|
|
139
|
+
| | `start_tick = 4`, `end_tick = 6` | uint32 | 21120/21120; meaning unclear → read-only | verified values |
|
|
140
|
+
| | `notes = 8` | repeated `Note` | hard delete by splice; **no soft-delete flag** | verified |
|
|
141
|
+
| | `visibility_mask = 18` | **uint64** | all-ones; **RECON correction: wire type 0, not `fixed64`** | verified |
|
|
142
|
+
| | `short_id = 19` | string | `"F969"` | verified |
|
|
143
|
+
| `Note` | `position_tick = 1` | optional uint32 | **absolute** timeline coordinate; omitted when 0 | verified |
|
|
144
|
+
| | `length_tick = 2` | uint32 | 240/480/720 = eighth/quarter/dotted-quarter | verified |
|
|
145
|
+
| | `midi_pitch = 3` | uint32 | 60 = C4 | verified |
|
|
146
|
+
| | `lyric_text = 4` | string | UTF-8 (`"啦"`) | verified |
|
|
147
|
+
| | `phoneme_roman = 5` | string | ASCII (`"la"`) | verified |
|
|
148
|
+
| | `note_flag = 14` | uint32 | constant 1; read-only | verified |
|
|
149
|
+
| | `expr_param_1 = 15`, `expr_param_2 = 16` | float | **−1.0 sentinel = unset**; never reinterpreted | verified |
|
|
150
|
+
|
|
151
|
+
**Tick rules.** `PPQ = 480`. `length_tick` 240 = eighth, 480 = quarter,
|
|
152
|
+
720 = dotted quarter. `position_tick` is absolute: removing or inserting a note
|
|
153
|
+
never shifts the others (four rounds of differential verification).
|
|
154
|
+
|
|
155
|
+
**Unknown-field policy.** protobufjs round-trips unknown fields as raw bytes
|
|
156
|
+
(the codec also keeps `$unknowns` per message). X Studio upgrades that add fields
|
|
157
|
+
survive decode → edit → encode. The one limitation: a project created from
|
|
158
|
+
nothing has no unknown fields to preserve, so templates are preferred
|
|
159
|
+
(README "Not supported").
|
|
160
|
+
|
|
161
|
+
**Round-trip guarantee.** `readProjectDocument` keeps `originalBytes` and a deep
|
|
162
|
+
clone of the decoded model. `writeProjectDocument`:
|
|
163
|
+
1. if the model deep-equals the original model → writes nothing,
|
|
164
|
+
`changed: false, bytesWritten: 0` (a read-only round trip never rewrites);
|
|
165
|
+
2. otherwise validates, optionally writes `*.bak.<timestamp>` (default on), then
|
|
166
|
+
writes atomically (temp file + rename);
|
|
167
|
+
3. reports the backup path, byte count and `changed`.
|
|
168
|
+
|
|
169
|
+
The codec unit tests assert byte-identical re-encoding of both real fixtures
|
|
170
|
+
(363/363 bytes each, SHA-256 pinned in RECON).
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## 4. §5.5 Tavily knowledge flow
|
|
175
|
+
|
|
176
|
+
```text
|
|
177
|
+
call site TTL cache circuit breaker / limiter
|
|
178
|
+
──────── ───────── ────────────────────────
|
|
179
|
+
xstudio_singers_list ──┐
|
|
180
|
+
refresh? │ ┌──────────────────┐ hit ┌─ no network, via "pb"
|
|
181
|
+
list(): ─────────────┼──▶│ TtlCache │───────▶│
|
|
182
|
+
│ │ (atomic writes, │ └─ cached: true
|
|
183
|
+
│ │ versioned key) │
|
|
184
|
+
xstudio_lyrics_align ──┤ └──────────────────┘
|
|
185
|
+
low-confidence char? │ │ miss / refresh requested
|
|
186
|
+
│ ▼
|
|
187
|
+
xstudio_ui_dialog_ │ ┌──────────────────┐
|
|
188
|
+
respond (unknown) ───┘ │ resolveTavily- │ disabled / no credentials / circuit open
|
|
189
|
+
│ Client (shared │──────────────▶ local fallback:
|
|
190
|
+
│ breaker+limiter) │ via "local-fallback"
|
|
191
|
+
└────────┬─────────┘
|
|
192
|
+
│ API-key: POST https://api.tavily.com/search
|
|
193
|
+
│ OAuth: POST https://mcp.tavily.com/mcp (MCP JSON-RPC)
|
|
194
|
+
│ body: {api_key, query, search_depth,
|
|
195
|
+
│ max_results, include_answer, topic}
|
|
196
|
+
│ AbortSignal.timeout(15 s)
|
|
197
|
+
▼
|
|
198
|
+
┌──────────────────┐
|
|
199
|
+
│ sanitizeResponse │ strip HTML/entities/URLs from
|
|
200
|
+
│ │ content, drop empty hits, cap
|
|
201
|
+
│ │ lengths, keep answer+results
|
|
202
|
+
└────────┬─────────┘
|
|
203
|
+
│ success → breaker.recordSuccess()
|
|
204
|
+
│ failure → breaker.recordFailure()
|
|
205
|
+
▼
|
|
206
|
+
parser per call site (defensive, conservative):
|
|
207
|
+
· singers: parseSingerPage → merge over local seeds
|
|
208
|
+
· pronunciation: extractPinyinFromSnippets (else local rule)
|
|
209
|
+
· dialog: classifyDiagnosisCorpus → enum only
|
|
210
|
+
▼
|
|
211
|
+
result: TavilySearchResult | local fallback
|
|
212
|
+
never throws; never executes content
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
**Compliance rules encoded in code.**
|
|
216
|
+
|
|
217
|
+
- The Tavily client returns a typed `TavilyFailure` (`disabled`, `no-api-key`,
|
|
218
|
+
`oauth-expired`, `circuit-open`, `rate-limited`, `invalid-query`, `timeout`, `network`,
|
|
219
|
+
`http-error`, `invalid-json`, `invalid-response`) instead of throwing.
|
|
220
|
+
- Credentials resolve config → environment → the Tavily CLI file
|
|
221
|
+
`~/.tavily/config.json` (plain `api_key` ⇒ REST; `tvly login` OAuth ⇒ MCP).
|
|
222
|
+
The plugin only reads that file; it never refreshes or revokes CLI tokens.
|
|
223
|
+
- The query for pronunciation contains one character + a 2-character context
|
|
224
|
+
window; the singer query is a fixed string; no full lyrics are ever sent.
|
|
225
|
+
- The diagnosis synthesizer can only return
|
|
226
|
+
`retry | dismiss | login_required | update_available | manual`. Search text is
|
|
227
|
+
data, never instructions; the sanitizer strips markup and caps instruction
|
|
228
|
+
length. (This is the §13 trap #11 mitigation.)
|
|
229
|
+
- Breaker: 3 consecutive failures → open for 300 s, then one half-open trial;
|
|
230
|
+
success closes, failure re-opens. Shared through `resolveTavilyClient` so the
|
|
231
|
+
three call sites do not each get their own threshold.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 5. §6.6 mixed orchestration (sequence)
|
|
236
|
+
|
|
237
|
+
```text
|
|
238
|
+
Agent data plane (core) GUI layer (sidecar) X Studio cloud
|
|
239
|
+
│ │ │ │
|
|
240
|
+
│ 1. project_create / note_* / lyrics_align │ │
|
|
241
|
+
│──────────────▶│ write .svip3 (+ backup) │ │
|
|
242
|
+
│ │──▶ via "pb" │ │
|
|
243
|
+
│◀──────────────│ summary │ │
|
|
244
|
+
│ │ │ │
|
|
245
|
+
│ 2. preview_trigger(project_path) │ │
|
|
246
|
+
│───────────────────────────────────────────▶│ open project (UIA menu/│
|
|
247
|
+
│ │ │ file dialog), press │
|
|
248
|
+
│ │ │ play/render, return │
|
|
249
|
+
│◀───────────────────────────────────────────│ opened+started+steps │
|
|
250
|
+
│ │ │──── cloud request ────▶│
|
|
251
|
+
│ 3. preview_wait(timeout_ms) │ │
|
|
252
|
+
│───────────────────────────────────────────▶│ poll progress/waveform/│
|
|
253
|
+
│ │ │ playing/dialogs │
|
|
254
|
+
│ │ │◀──── render result ────│
|
|
255
|
+
│◀───────────────────────────────────────────│ completed+evidence │
|
|
256
|
+
│ │ │ │
|
|
257
|
+
│ 4. ui_assert (waveform / duration / no error text) │
|
|
258
|
+
│───────────────────────────────────────────▶│ fail-fast on mismatch │
|
|
259
|
+
│ │ │ │
|
|
260
|
+
│ 5. [unknown dialog] ui_dialog_respond │ │
|
|
261
|
+
│───────────────────────────────────────────▶│ read dialog │
|
|
262
|
+
│ │ known fingerprint? │── dialogs.md match │
|
|
263
|
+
│ │ unknown → Tavily ────┼──▶ enum suggestion only│
|
|
264
|
+
│◀───────────────────────────────────────────│ suggested_action │
|
|
265
|
+
│ │ │ │
|
|
266
|
+
│ 6. [optional] export_run(wav/mp3/flac) │ │
|
|
267
|
+
│───────────────────────────────────────────▶│ walk export dialog, │
|
|
268
|
+
│ │ │ verify artifact exists │
|
|
269
|
+
│◀───────────────────────────────────────────│ path+bytes+format │
|
|
270
|
+
│ │ │ │
|
|
271
|
+
│ any failure → ui_abort → release control, files intact (atomic writes,
|
|
272
|
+
│ │ *.bak backups) │ │
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Normal runs are deterministic replays of the gesture dictionary
|
|
276
|
+
(`skills/xstudio-gui/gestures.md`); the model is consulted only for unexpected
|
|
277
|
+
dialogs (Tavily diagnosis) or when a human must take over (`guide_print`).
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
## 6. §7.2 creation-mode (Cordis) preset workflow
|
|
282
|
+
|
|
283
|
+
```text
|
|
284
|
+
DSH Web UI (session-level action; an agent cannot switch its own preset)
|
|
285
|
+
1. new/empty session → agent-preset selector → preset id "cordis"
|
|
286
|
+
(row `preset-cordis`, order 4; mounts `tool-cordis` + skill-filesystem
|
|
287
|
+
with the Cordis authoring skills + plugin-manager tools)
|
|
288
|
+
2. verify session metadata: agentPreset == "cordis"
|
|
289
|
+
3. ask the preset/API inspection for the current
|
|
290
|
+
defineTool / Service / lifecycle / MCP bridge / package-script templates
|
|
291
|
+
4. generate the adapter skeleton (adapter-dsh + adapter-mcp)
|
|
292
|
+
5. record SHA-256 of the generated files → docs/preset-output-snapshot.txt
|
|
293
|
+
6. implement business logic behind the unchanged registration shape
|
|
294
|
+
7. if preset text conflicts with the spec:
|
|
295
|
+
priority 1: live preset API signature
|
|
296
|
+
priority 2: spec business logic marked verified
|
|
297
|
+
priority 3: generic best practice
|
|
298
|
+
8. PR review still scans generated code for secrets / eval / telemetry
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Shipped status: the 0.1.0 tree was rebuilt in a session whose preset was
|
|
302
|
+
`liangshen` (the preset is Web-UI-selected, and the original creation-mode
|
|
303
|
+
session was lost — RECON §9). The adapter keeps the preset-compatible
|
|
304
|
+
registration contract (`name` / `inject` / `Config` / `apply(ctx, config)` /
|
|
305
|
+
`ctx.tools.register`), `preset-output-snapshot.txt` records the recovered
|
|
306
|
+
baseline and its deviations, and future adapter changes are expected to start
|
|
307
|
+
from the `cordis` preset as the spec requires. `local-tool.ts` exists because a
|
|
308
|
+
profile-installed plugin cannot resolve `@deepseek-ai/dsh-tools` at runtime
|
|
309
|
+
(hoisted linker, `autoInstallPeers: false`); it produces the documented
|
|
310
|
+
`ToolDefinition` shape (`name`/`description`/`parameters`/`output`/`execute`).
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
## 7.3 SKILL precondition gate (v0.1.2)
|
|
315
|
+
|
|
316
|
+
### Step 0: host-capability findings (Cordis 0.2.1-rc.2)
|
|
317
|
+
|
|
318
|
+
Verified through the live Cordis inspection API and the installed package's type
|
|
319
|
+
declarations; no guessing.
|
|
320
|
+
|
|
321
|
+
**Q1 - Is there a declarative tool-to-skill dependency?** No. The ToolDefinition
|
|
322
|
+
and defineTool surface carries name, description, parameters, output, execute,
|
|
323
|
+
timeoutMs, isConcurrencySafe and presentation callbacks. There is no requires,
|
|
324
|
+
dependsOn, preload, guidance or context field, and tool schemas carry no skill
|
|
325
|
+
metadata. The gate therefore cannot be declared; it must run in code.
|
|
326
|
+
|
|
327
|
+
**Q2 - Is there a runtime API for "is this skill in the model context"?** No
|
|
328
|
+
direct one. The skills service is a layered catalog
|
|
329
|
+
(register/list/snapshot/get); get() loads a definition for the caller and does
|
|
330
|
+
not mean the model read it. The skill tool is preset-mounted (its host Config row
|
|
331
|
+
include:tool-skill is inactive in this profile) and emits no load event of its
|
|
332
|
+
own. However the host DOES expose the durable per-session event log
|
|
333
|
+
(session/event; Session.ownEvents()) and the live session store
|
|
334
|
+
(sessions.get(SessionId)); ToolRunContext.agent.id is that SessionId
|
|
335
|
+
(Agent = { id: SessionId }). A skill load is an ordinary tool call, so the adapter
|
|
336
|
+
derives a per-session answer by scanning the session's own events for
|
|
337
|
+
|
|
338
|
+
- a successful skill({name:"xstudio-gui"}) call (direct tool/call, assistant
|
|
339
|
+
message tool-call block, or PTC dispatch), or
|
|
340
|
+
- a successful read of skills/xstudio-gui/SKILL.md,
|
|
341
|
+
|
|
342
|
+
paired with its tool/result (or tool/ptc-dispatch) by call id. This is
|
|
343
|
+
runtime-observed durable evidence, not model-context introspection; it is
|
|
344
|
+
scoped by SessionId so one session never unlocks another.
|
|
345
|
+
|
|
346
|
+
**Q3 - Can the plugin trigger a skill load?** No. The plugin can read a skill
|
|
347
|
+
definition through the skills catalog, but only the model calling the skill tool
|
|
348
|
+
(or reading the file) puts the content into the model's context. The gate
|
|
349
|
+
returns NEED_SKILL with executable guidance instead of trying to load it
|
|
350
|
+
silently.
|
|
351
|
+
|
|
352
|
+
**Q4 - Degradation.** When the host cannot answer (no sessions service, unknown
|
|
353
|
+
agent identity, or a non-DSH host such as the MCP stdio process), the gate
|
|
354
|
+
degrades to one prompt per session key, then passes. It is never permanently
|
|
355
|
+
unreachable. In those contexts the gate strength is explicitly best-effort and
|
|
356
|
+
documented in README.
|
|
357
|
+
|
|
358
|
+
### Decision table
|
|
359
|
+
|
|
360
|
+
| toolName | probe answer | gate state | result |
|
|
361
|
+
| --- | --- | --- | --- |
|
|
362
|
+
| any data-plane tool or xstudio_probe | any | not gated | allowed (no probe query) |
|
|
363
|
+
| the skill-loading action itself | any | exempt | allowed (deadlock prevention) |
|
|
364
|
+
| one of the 8 GUI control tools | loaded | per session | allowed |
|
|
365
|
+
| one of the 8 GUI control tools | not loaded | per session | NEED_SKILL |
|
|
366
|
+
| one of the 8 GUI control tools | unavailable, first call in this session | degraded | NEED_SKILL, prompt recorded |
|
|
367
|
+
| one of the 8 GUI control tools | unavailable, later call in this session | degraded | allowed (ONE_TIME_PASS) |
|
|
368
|
+
|
|
369
|
+
The whitelist is exactly xstudio_ui_snapshot, xstudio_ui_act,
|
|
370
|
+
xstudio_ui_assert, xstudio_ui_dialog_respond, xstudio_ui_abort,
|
|
371
|
+
xstudio_preview_trigger, xstudio_preview_wait and xstudio_export_run.
|
|
372
|
+
xstudio_probe and the skill tool are exempt.
|
|
373
|
+
|
|
374
|
+
### Ordering and error contract
|
|
375
|
+
|
|
376
|
+
enforceSkillGate() is the first statement inside runTool for every gated tool,
|
|
377
|
+
before any sidecar construction/probe (so a rejected call cannot occupy the
|
|
378
|
+
serial UIA channel) and before the foreground check (NEED_SKILL is a
|
|
379
|
+
configuration error, not a runtime-state error; the model learns the correct
|
|
380
|
+
order once instead of hitting GUI_FOCUS_LOST first). A block throws
|
|
381
|
+
XStudioError(NEED_SKILL) and runTool renders the normal envelope: ok:false,
|
|
382
|
+
via:"gui", product_line:"beta-netease", error {code, message, hint, next[]}.
|
|
383
|
+
asXStudioError passes the code through unchanged (regression-tested; the same
|
|
384
|
+
class of flattening risk as defect #3).
|
|
385
|
+
|
|
386
|
+
### Session scope and lifetime
|
|
387
|
+
|
|
388
|
+
The loaded state is per SessionId. The only mutable gate state is the degraded
|
|
389
|
+
prompt set, held by the SkillGate instance created per plugin activation (DSH)
|
|
390
|
+
or per MCP process; a plugin reload resets it. There is no global singleton and
|
|
391
|
+
no persistence, so a mis-block can never survive into an unrelated session.
|
|
392
|
+
|
|
393
|
+
### Code map and verification
|
|
394
|
+
|
|
395
|
+
- src/core/guard/skill-gate.ts - host-neutral decisions, whitelist, messages.
|
|
396
|
+
- src/adapter-dsh/skill-gate-host.ts - session-history probe + parser.
|
|
397
|
+
- src/adapter-dsh/tools/common.ts (enforceSkillGate) and
|
|
398
|
+
src/adapter-dsh/tools/control.ts (8 call sites).
|
|
399
|
+
- src/shared/errors.ts - NEED_SKILL code and next steps.
|
|
400
|
+
- Tests: src/tests/unit/skill-gate.test.ts (11 cases covering the whitelist,
|
|
401
|
+
loaded/not-loaded, one-time fallback, session isolation, code passthrough,
|
|
402
|
+
pre-sidecar and pre-foreground ordering, direct/PTC/read history parsing).
|
|
403
|
+
- Live: ungated session blocked in 36 ms with sidecar zero calls; after loading
|
|
404
|
+
the skill the same snapshot returned the live tree; a fresh independent agent
|
|
405
|
+
session was blocked twice (NEED_SKILL, not ONE_TIME_PASS) while data-plane
|
|
406
|
+
reads succeeded.
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
## 7. Degradation state machine (`core/degrade/chain.ts`)
|
|
411
|
+
|
|
412
|
+
```text
|
|
413
|
+
facts from xstudio_probe
|
|
414
|
+
│
|
|
415
|
+
┌───────────────┼────────────────────────────────────────────┐
|
|
416
|
+
▼ ▼ ▼
|
|
417
|
+
pb-editable gui-assisted guide-only
|
|
418
|
+
(project file (app running + sidecar present) (only manual steps
|
|
419
|
+
readable & render/export/state tools available; possible)
|
|
420
|
+
writable) pb tools remain available too │
|
|
421
|
+
│ │ │
|
|
422
|
+
└───── preferredChain from config: ["pb","gui","guide"] ─────────┘
|
|
423
|
+
selectPath() returns { path, stage, skipped[] with reasons }
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
`selectPath` never throws: it reports the strongest available path plus why
|
|
427
|
+
weaker links were skipped, which is what `xstudio_probe` and failure envelopes
|
|
428
|
+
surface. Unavailable stronger links degrade the *capability*, not the whole
|
|
429
|
+
plugin: data-plane tools keep working with the GUI down, and the GUI keeps
|
|
430
|
+
working when Tavily is down.
|
|
431
|
+
|
|
432
|
+
---
|
|
433
|
+
|
|
434
|
+
## 8. Module map
|
|
435
|
+
|
|
436
|
+
| Path | Responsibility | Tests |
|
|
437
|
+
| --- | --- | --- |
|
|
438
|
+
| `src/core/svip/model.ts` | defaults, `createEmptyProject`, `createNote`, `cloneModel` | codec/editor tests |
|
|
439
|
+
| `src/core/svip/codec.ts` | protobufjs schema, decode/encode, `$unknowns`, `modelsEqual` | `svip-codec.test.ts` |
|
|
440
|
+
| `src/core/svip/document.ts` | read/write transactions, backup, no-op write, atomic replace | `svip-document.test.ts` |
|
|
441
|
+
| `src/core/svip/editor.ts` | note CRUD, tempo/timesig/velocity/gain, `summarize`, `getTrack` | `svip-editor.test.ts` |
|
|
442
|
+
| `src/core/svip/validator.ts` | pre-write validation, note-ref resolution, track range | codec/editor tests |
|
|
443
|
+
| `src/core/svip/tick.ts` | PPQ 480, tick↔ms/beats | `svip-codec.test.ts` |
|
|
444
|
+
| `src/core/midi/smf.ts` | dependency-free Standard MIDI File parse/write | `midi.test.ts` |
|
|
445
|
+
| `src/core/midi/convert.ts` | MIDI ↔ notes, lyric mapping, PPQ scaling | `midi.test.ts` |
|
|
446
|
+
| `src/core/catalog/singers.ts` | built-in catalog, TTL cache, Tavily refresh/parse/merge | `singers.test.ts` |
|
|
447
|
+
| `src/core/catalog/pronunciation.ts` | local polyphone rules, low-confidence Tavily lookup, dedupe | `pronunciation.test.ts` |
|
|
448
|
+
| `src/core/diagnose/error-resolver.ts` | dialog fingerprints, safe enum synthesis | `diagnosis.test.ts` |
|
|
449
|
+
| `src/core/tavily/*` | settings, client, breaker, rate limit, TTL cache, sanitizer, shared state | `tavily-*.test.ts` |
|
|
450
|
+
| `src/core/degrade/chain.ts` | preferred-path selection with reasons | `degrade.test.ts` |
|
|
451
|
+
| `src/core/render/orchestrator.ts` | GUI two-phase render/export orchestration, budgets | `render-orchestrator.test.ts` |
|
|
452
|
+
| `src/core/render/artifacts.ts` | audio metadata (WAV header etc.), newest artifact | `artifacts.test.ts` |
|
|
453
|
+
| `src/host/sidecar.ts` | spawns `sidecar/uia.ps1`, JSON-line RPC, timeouts, dispose | `sidecar.test.ts` |
|
|
454
|
+
| `src/host/win.ts` | process/foreground detection | probe tests |
|
|
455
|
+
| `sidecar/uia.ps1` | UIA introspection + primitives (PowerShell 7) | live read-only probes |
|
|
456
|
+
| `src/adapter-dsh/index.ts` | `apply(ctx, config)`, tool registration, GUI skill, prompt section | `registry-contract.test.ts` |
|
|
457
|
+
| `src/adapter-dsh/config.ts` | Schemastery schema + `resolveConfig` | `registry-contract.test.ts` |
|
|
458
|
+
| `src/adapter-dsh/services.ts` | wiring core modules + sidecar into `ToolServices` | adapter tests |
|
|
459
|
+
| `src/adapter-dsh/tools/*` | the 24 tool definitions (probe/data/control/degrade/guide) | `data-plane.test.ts`, `mcp-server.test.ts` |
|
|
460
|
+
| `src/adapter-mcp/server.ts` | JSON-RPC 2.0 stdio server, validation, config-from-env | `mcp-server.test.ts`, `mcp-smoke.test.ts` |
|
|
461
|
+
| `src/shared/*` | error codes, envelope types, JSON-schema subset, paths | adapter tests |
|
|
462
|
+
| `scripts/check-contract.mjs` | DSH ↔ MCP ↔ README/SPEC tool-table consistency | CI |
|
|
463
|
+
| `sidecar/uia.ps1`, `skills/xstudio-gui/*` | F-layer manual: element map, gestures, dialogs, assertions | live read-only probes |
|
|
464
|
+
| `examples/*.mjs` | runnable end-to-end usage against `dist/` | run in CI/README |
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## 9. Error-code table
|
|
469
|
+
|
|
470
|
+
Codes are stable API (tools, MCP errors and docs all match on them); every
|
|
471
|
+
failure carries `code`, `message`, an optional `hint`, and `next[]` steps.
|
|
472
|
+
|
|
473
|
+
| Code | Layer | Meaning |
|
|
474
|
+
| --- | --- | --- |
|
|
475
|
+
| `CONFIG_INVALID` | adapter/config | Loader row failed Schemastery validation |
|
|
476
|
+
| `XSTUDIO_NOT_INSTALLED` | probe/control | `xstudioInstallDir` has no `NetEase Cloud Music XStudio.exe` |
|
|
477
|
+
| `XSTUDIO_NOT_RUNNING` | control | GUI tool called while the app is not running |
|
|
478
|
+
| `WORKSPACE_UNWRITABLE` | probe | workspace directory cannot be created/written |
|
|
479
|
+
| `PROJECT_NOT_FOUND` | data | project path does not exist |
|
|
480
|
+
| `PROJECT_UNREADABLE` | data | file cannot be read (I/O/permissions) |
|
|
481
|
+
| `PROJECT_DECODE_FAILED` | codec | not a decodable `.svip3`; file is never rewritten |
|
|
482
|
+
| `PROJECT_INVALID` | validator | value/range/format invalid (ticks, pitch, BPM, time sig) |
|
|
483
|
+
| `TRACK_OUT_OF_RANGE` | validator | `track_idx` does not name a singing track |
|
|
484
|
+
| `NOTE_NOT_FOUND` | data | note ref matches no note |
|
|
485
|
+
| `BACKUP_FAILED` | document | backup could not be created; write refused |
|
|
486
|
+
| `MIDI_PARSE_FAILED` | midi | malformed SMF |
|
|
487
|
+
| `MIDI_EMPTY` | midi | SMF contains no notes |
|
|
488
|
+
| `GUI_ACTION_FAILED` | control | one UIA primitive failed |
|
|
489
|
+
| `GUI_REF_NOT_FOUND` | sidecar | stale/unknown snapshot ref |
|
|
490
|
+
| `GUI_ASSERT_FAILED` | control | UI assertion failed (fail-fast) |
|
|
491
|
+
| `GUI_FOCUS_LOST` | control | foreground changed / human took over |
|
|
492
|
+
| `GUI_BUDGET_EXCEEDED` | render | steps / wall clock / consecutive-failure budget hit |
|
|
493
|
+
| `GUI_ABORTED` | control | abort path executed |
|
|
494
|
+
| `NEED_SKILL` | guard | GUI control tool called before the xstudio-gui skill was loaded in this session; no sidecar request was sent |
|
|
495
|
+
| `DIALOG_UNKNOWN` | diagnose | dialog text not in the fingerprint table |
|
|
496
|
+
| `CLOUD_UNREACHABLE` | render | vendor cloud unreachable (network/timeout) |
|
|
497
|
+
| `RENDER_TIMEOUT` | render | wait exceeded `timeout_ms` |
|
|
498
|
+
| `EXPORT_FAILED` | render | export dialog flow failed |
|
|
499
|
+
| `ARTIFACT_MISSING` | render | no output file found/verified |
|
|
500
|
+
| `TAVILY_DISABLED` | tavily | switch off; local fallback used |
|
|
501
|
+
| `TAVILY_UNAVAILABLE` | tavily | no credentials, expired OAuth token, network failure or unparsable data; local fallback used |
|
|
502
|
+
| `TAVILY_CIRCUIT_OPEN` | tavily/breaker | breaker open during cooldown |
|
|
503
|
+
| `GUIDE_ONLY` | degrade | only the manual path is possible |
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## 10. Fail-safety and security properties
|
|
508
|
+
|
|
509
|
+
- **Atomic writes + backups.** Every mutation runs read → mutate → validate →
|
|
510
|
+
backup → temp-write → rename. A failed write leaves the original intact; a
|
|
511
|
+
refused decode never rewrites.
|
|
512
|
+
- **Precondition before side effects.** GUI control tools evaluate the skill gate before constructing or probing the sidecar, so a rejected call is free and cannot wedge the serial UIA channel.
|
|
513
|
+
- **No implicit network.** Only Tavily endpoints may be contacted, only when configured
|
|
514
|
+
(`api.tavily.com/search` REST for API-key mode, `mcp.tavily.com/mcp` for the
|
|
515
|
+
Tavily-CLI OAuth mode). The plugin never talks to X Studio's cloud; the client app
|
|
516
|
+
does.
|
|
517
|
+
- **No shell from search results.** The only spawned process is the fixed
|
|
518
|
+
PowerShell sidecar (`pwsh -NoProfile -File sidecar/uia.ps1`).
|
|
519
|
+
- **No telemetry.** Nothing is reported anywhere.
|
|
520
|
+
- **Lethal-action blacklist** for dialogs and actions (README section).
|
|
521
|
+
- **Bounded work.** GUI steps/time/failures and Tavily request rate are capped;
|
|
522
|
+
tool calls respect the host abort signal.
|
|
523
|
+
|
|
524
|
+
## 11. Known risks / open questions
|
|
525
|
+
|
|
526
|
+
1. **The UIA layer is live-verified only up to read-only introspection.** The
|
|
527
|
+
main window, its Qt widget tree (131 elements, AutomationIds, patterns), the
|
|
528
|
+
sidecar JSON protocol, snapshot-scoped refs, asserts and `readDialog` are
|
|
529
|
+
verified live (RECON-GUI §2–§3), but the interactive flows — typing a project
|
|
530
|
+
path into the native `#32770` open dialog and confirming it, starting
|
|
531
|
+
playback/cloud render, confirming an export — are implemented and
|
|
532
|
+
**unverified end-to-end** (RECON-GUI §9). The design never guesses: it
|
|
533
|
+
resolves by UIA identity, and fails to `guide_print` if an element never
|
|
534
|
+
appears.
|
|
535
|
+
2. **Cloud render + export were not exercised end-to-end** in this environment;
|
|
536
|
+
the orchestrator is validated with a fake sidecar and the live path is gated
|
|
537
|
+
behind a running app.
|
|
538
|
+
3. **Tavily live paths are environment-dependent.** Verified live here through a
|
|
539
|
+
Tavily CLI OAuth session (MCP transport); REST API-key mode and the offline /
|
|
540
|
+
circuit-open fallbacks are fixture-tested, including hostile content. OAuth
|
|
541
|
+
access tokens expire (about 24 h); the plugin never refreshes the CLI token
|
|
542
|
+
and instead asks the user to run `tvly login`.
|
|
543
|
+
4. **Future X Studio builds may add/rename fields.** The codec preserves them;
|
|
544
|
+
semantic gaps only affect newly interpreted fields, and all unverified fields
|
|
545
|
+
stay read-only pass-through.
|
|
546
|
+
5. **`start_tick == end_tick` semantics are unknown**; never modified.
|
|
547
|
+
6. **Singer catalog is conservative.** It only accepts names that look like
|
|
548
|
+
X Studio singers; a brand-new singer page with a new naming convention may
|
|
549
|
+
need a parser update (the spec's maintenance expectation).
|
|
550
|
+
7. **Creation-mode preset was not the session preset during development.** The
|
|
551
|
+
preset is Web-UI-selected; this session ran `liangshen`. The adapter keeps
|
|
552
|
+
the preset-compatible registration shape and the baseline/deviations are in
|
|
553
|
+
`docs/preset-output-snapshot.txt`.
|