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
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Linux ↔ Wine drive-letter path translation.
3
+ *
4
+ * X Studio running under Wine sees Windows-style paths (`Z:\home\…`), while the
5
+ * plugin runs on the Linux host and speaks Linux paths. Wine maps drives
6
+ * through symlinks in `<prefix>/dosdevices/` (typically `c:` →
7
+ * `<prefix>/drive_c` and `z:` → `/`). This module reads those symlinks (plus
8
+ * explicit `config.wine.driveMappings` overrides) and converts in both
9
+ * directions. Unresolvable paths fall back to the `Z:` default, mirroring
10
+ * Wine's own behavior for the host root.
11
+ * @module xstudio-linux/host/wine-paths
12
+ */
13
+ import { readdirSync, realpathSync, existsSync } from 'node:fs';
14
+ import { homedir } from 'node:os';
15
+ import { join } from 'node:path';
16
+ import { expandHome } from '../shared/paths.js';
17
+ /** Read `dosdevices/*` symlinks into a drive map. Pure filesystem reads, no spawn. */
18
+ export function readDriveMap(options = {}) {
19
+ const prefix = expandHome(options.prefix ?? '~/.wine');
20
+ const map = {};
21
+ const dosdevices = join(prefix, 'dosdevices');
22
+ try {
23
+ for (const entry of readdirSync(dosdevices)) {
24
+ const match = /^([a-zA-Z]):$/.exec(entry);
25
+ if (match === null)
26
+ continue;
27
+ const drive = `${match[1].toUpperCase()}:`;
28
+ try {
29
+ map[drive] = realpathSync(join(dosdevices, entry));
30
+ }
31
+ catch {
32
+ // A dangling symlink is skipped; the drive simply never matches.
33
+ }
34
+ }
35
+ }
36
+ catch {
37
+ // No prefix (or no dosdevices): the explicit mappings and Z: fallback apply.
38
+ }
39
+ for (const [drive, target] of Object.entries(options.driveMappings ?? {})) {
40
+ const key = /^[a-zA-Z]:$/.test(drive) ? `${drive[0].toUpperCase()}:` : drive.toUpperCase();
41
+ map[key] = expandHome(target);
42
+ }
43
+ // Wine's standard host-root mapping, used as the last resort below.
44
+ if (map['Z:'] === undefined)
45
+ map['Z:'] = '/';
46
+ return map;
47
+ }
48
+ /** True when the value looks like a Windows drive path (`C:\…` or `C:/…`). */
49
+ export function isWinePath(value) {
50
+ return /^[a-zA-Z]:[\\/]/.test(value);
51
+ }
52
+ /** Convert a Windows drive path to its Linux target; null when no drive matches. */
53
+ export function wineToLinux(path, drives) {
54
+ const match = /^([a-zA-Z]):[\\/](.*)$/.exec(path);
55
+ if (match === null)
56
+ return null;
57
+ const drive = `${match[1].toUpperCase()}:`;
58
+ const rest = match[2] ?? '';
59
+ const target = drives[drive];
60
+ if (target === undefined)
61
+ return null;
62
+ const linuxRest = rest.replace(/[\\/]+/g, '/');
63
+ return linuxRest === '' ? target : join(target, linuxRest);
64
+ }
65
+ /** Convert a Linux path to the Wine form; falls back to `Z:`. */
66
+ export function linuxToWine(path, drives) {
67
+ const normalized = path.replace(/\/+$/, '') || '/';
68
+ for (const [drive, target] of Object.entries(drives)) {
69
+ if (drive === 'Z:')
70
+ continue; // consulted only as the fallback below
71
+ if (target === '/' || target === '')
72
+ continue;
73
+ if (normalized === target)
74
+ return `${drive}\\`;
75
+ if (normalized.startsWith(`${target}/`)) {
76
+ const rest = normalized.slice(target.length + 1).replace(/\//g, '\\');
77
+ return `${drive}\\${rest}`;
78
+ }
79
+ }
80
+ const rest = normalized.replace(/^\//, '').replace(/\//g, '\\');
81
+ return rest === '' ? 'Z:\\' : `Z:\\${rest}`;
82
+ }
83
+ /** Build a converter from options (prefix + explicit mappings). */
84
+ export function createWinePathConverter(options = {}) {
85
+ const drives = readDriveMap(options);
86
+ return {
87
+ drives,
88
+ toWine(path) {
89
+ if (isWinePath(path))
90
+ return path.replace(/\//g, '\\');
91
+ return linuxToWine(path, drives);
92
+ },
93
+ toLinux(path) {
94
+ if (!isWinePath(path))
95
+ return path;
96
+ return wineToLinux(path, drives) ?? path;
97
+ },
98
+ };
99
+ }
100
+ /** Keep `existsSync` referenced for future prefix validation. */
101
+ void existsSync;
102
+ void homedir;
103
+ //# sourceMappingURL=wine-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wine-paths.js","sourceRoot":"","sources":["../../src/host/wine-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAa/C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5
+ * resolver, the service bundle factory and the tool-definition builder so any
6
+ * host (CLI, MCP server, tests, other agents) can mount the same 24-tool
7
+ * surface. There is no host lifecycle here — callers own services.dispose().
8
+ * @module xstudio-linux
9
+ */
10
+ export { resolveConfig, PATH_CHAIN, INSTALL_DIR_CANDIDATES, XSTUDIO_EXE } from './config.js';
11
+ export type { ResolvedConfig, PathLink, WineConfig } from './config.js';
12
+ export { createServices } from './services.js';
13
+ export type { ServiceOptions, ToolServices } from './services.js';
14
+ export { buildToolDefinitions } from './tools/registry.js';
15
+ export type { LocalToolDefinition, ToolRunContext } from './tools/definition.js';
16
+ export { defineTool, jsonRender } from './tools/definition.js';
17
+ export { XStudioError, ErrorCode, asXStudioError } from './shared/errors.js';
18
+ export type { ToolResult, Via } from './shared/types.js';
19
+ export { ok, fail } from './shared/types.js';
20
+ export { version } from './version.js';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * xstudio-linux programmatic API.
3
+ *
4
+ * The standalone replacement for the old DSH plugin entry: exposes the config
5
+ * resolver, the service bundle factory and the tool-definition builder so any
6
+ * host (CLI, MCP server, tests, other agents) can mount the same 24-tool
7
+ * surface. There is no host lifecycle here — callers own services.dispose().
8
+ * @module xstudio-linux
9
+ */
10
+ export { resolveConfig, PATH_CHAIN, INSTALL_DIR_CANDIDATES, XSTUDIO_EXE } from './config.js';
11
+ export { createServices } from './services.js';
12
+ export { buildToolDefinitions } from './tools/registry.js';
13
+ export { defineTool, jsonRender } from './tools/definition.js';
14
+ export { XStudioError, ErrorCode, asXStudioError } from './shared/errors.js';
15
+ export { ok, fail } from './shared/types.js';
16
+ export { version } from './version.js';
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE5F,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE1D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE5E,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -0,0 +1,55 @@
1
+ import { SingerCatalog } from './core/catalog/singers.js';
2
+ import { PronunciationResolver } from './core/catalog/pronunciation.js';
3
+ import { RenderOrchestrator } from './core/render/orchestrator.js';
4
+ import { findNewestArtifact } from './core/render/artifacts.js';
5
+ import type { ResolvedConfig } from './config.js';
6
+ import type { DialogDiagnosis, GuiSidecar, ProjectDocument, WriteProjectOptions, WriteProjectResult } from './core/contracts.js';
7
+ import { type GuideTopic } from './tools/guide.js';
8
+ import { SkillGate, type SkillLoadProbe } from './core/guard/skill-gate.js';
9
+ /** Everything a tool definition may use. */
10
+ export interface ToolServices {
11
+ config: ResolvedConfig;
12
+ /** Resolve a user path against the calling session's working directory. */
13
+ resolvePath(input: string, agent?: unknown): Promise<string>;
14
+ svip: {
15
+ read(path: string): Promise<ProjectDocument>;
16
+ write(doc: ProjectDocument, options: WriteProjectOptions): Promise<WriteProjectResult>;
17
+ };
18
+ singers: SingerCatalog;
19
+ pronunciation: PronunciationResolver;
20
+ /** Local fingerprint dialog diagnosis. */
21
+ diagnose(text: string): Promise<DialogDiagnosis>;
22
+ /** The GUI sidecar, or null when the sidecar script is unavailable. */
23
+ getSidecar(): Promise<GuiSidecar | null>;
24
+ /** The shared render orchestrator (same instance for trigger/wait/export), or null. */
25
+ getRender(): Promise<{
26
+ sidecar: GuiSidecar;
27
+ render: RenderOrchestrator;
28
+ } | null>;
29
+ artifacts: {
30
+ findNewestArtifact: typeof findNewestArtifact;
31
+ };
32
+ guide(topic: GuideTopic, extra?: {
33
+ projectPath?: string;
34
+ }): string;
35
+ /** Runtime precondition gate for the GUI control tools. */
36
+ skillGate: SkillGate;
37
+ /** Close every child process owned by these services. */
38
+ dispose(): Promise<void>;
39
+ }
40
+ /** Creation options, injectable for tests and for MCP. */
41
+ export interface ServiceOptions {
42
+ /** Resolve the session working directory for relative paths. */
43
+ cwd?: (agent?: unknown) => Promise<string>;
44
+ /** Kept for signature compatibility; unused since Tavily removal. */
45
+ fetchImpl?: typeof fetch;
46
+ now?: () => number;
47
+ /** Factory override for the GUI sidecar; tests pass () => null to simulate an unavailable GUI. */
48
+ sidecarFactory?: (config: ResolvedConfig) => GuiSidecar | null;
49
+ /** Override the skill gate (tests). */
50
+ skillGate?: SkillGate;
51
+ /** Host answer source for "did this session load the required skill?". */
52
+ skillProbe?: SkillLoadProbe;
53
+ }
54
+ /** Build the service bundle from a resolved config. */
55
+ export declare function createServices(config: ResolvedConfig, options?: ServiceOptions): ToolServices;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Wires the pure core modules and the F layer into the shape the tool
3
+ * definitions consume. One instance per plugin activation (DSH) or per MCP
4
+ * process.
5
+ * @module xstudio-linux/services
6
+ */
7
+ import { readProjectDocument, writeProjectDocument } from './core/svip/document.js';
8
+ import { SingerCatalog } from './core/catalog/singers.js';
9
+ import { PronunciationResolver } from './core/catalog/pronunciation.js';
10
+ import { diagnoseDialog } from './core/diagnose/error-resolver.js';
11
+ import { createSidecar } from './host/sidecar.js';
12
+ import { createWinePathConverter } from './host/wine-paths.js';
13
+ import { RenderOrchestrator } from './core/render/orchestrator.js';
14
+ import { findNewestArtifact } from './core/render/artifacts.js';
15
+ import { resolveUserPath } from './shared/paths.js';
16
+ import { renderGuide } from './tools/guide.js';
17
+ import { SkillGate } from './core/guard/skill-gate.js';
18
+ /** Build the service bundle from a resolved config. */
19
+ export function createServices(config, options = {}) {
20
+ const now = options.now ?? (() => Date.now());
21
+ const cwdOf = options.cwd ?? (async () => process.cwd());
22
+ const skillGate = options.skillGate ?? new SkillGate(options.skillProbe === undefined ? {} : { probe: options.skillProbe });
23
+ const singers = new SingerCatalog({});
24
+ const pronunciation = new PronunciationResolver({});
25
+ let sidecar;
26
+ let renderBundle;
27
+ let closed = false;
28
+ const getSidecar = async () => {
29
+ if (closed)
30
+ return null;
31
+ if (sidecar !== undefined)
32
+ return sidecar;
33
+ let created;
34
+ try {
35
+ created = (options.sidecarFactory ?? createSidecar)(config);
36
+ }
37
+ catch {
38
+ created = null;
39
+ }
40
+ sidecar = created;
41
+ return created;
42
+ };
43
+ return {
44
+ config,
45
+ async resolvePath(input, agent) {
46
+ const cwd = await cwdOf(agent);
47
+ return resolveUserPath(input, cwd);
48
+ },
49
+ svip: {
50
+ read: (path) => readProjectDocument(path),
51
+ write: (doc, writeOptions) => writeProjectDocument(doc, writeOptions),
52
+ },
53
+ singers,
54
+ pronunciation,
55
+ diagnose: (text) => diagnoseDialog(text, {}),
56
+ getSidecar,
57
+ async getRender() {
58
+ if (renderBundle !== undefined)
59
+ return renderBundle;
60
+ const gui = await getSidecar();
61
+ renderBundle = gui === null
62
+ ? null
63
+ : { sidecar: gui, render: new RenderOrchestrator({ sidecar: gui, config, now, winePaths: createWinePathConverter({ prefix: config.wine.prefix, driveMappings: config.wine.driveMappings }) }) };
64
+ return renderBundle;
65
+ },
66
+ artifacts: { findNewestArtifact },
67
+ guide: (topic, extra) => renderGuide(topic, extra),
68
+ skillGate,
69
+ async dispose() {
70
+ closed = true;
71
+ renderBundle = undefined;
72
+ if (sidecar)
73
+ await sidecar.dispose().catch(() => undefined);
74
+ sidecar = null;
75
+ },
76
+ };
77
+ }
78
+ //# sourceMappingURL=services.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.js","sourceRoot":"","sources":["../src/services.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,E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EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,uBAAuB,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,EAAE,CAAA;YACjM,OAAO,YAAY,CAAA;QACrB,CAAC;QACD,SAAS,EAAE,EAAE,kBAAkB,EAAE;QACjC,KAAK,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC;QAClD,SAAS;QACT,KAAK,CAAC,OAAO;YACX,MAAM,GAAG,IAAI,CAAA;YACb,YAAY,GAAG,SAAS,CAAA;YACxB,IAAI,OAAO;gBAAE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;YAC3D,OAAO,GAAG,IAAI,CAAA;QAChB,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Structured error codes and the "what to do next" advice attached to every
3
+ * failure. Codes are stable API: the model, docs and tests match on them.
4
+ * @module xstudio-linux/shared/errors
5
+ */
6
+ /** Stable error codes. */
7
+ export declare const ErrorCode: {
8
+ readonly CONFIG_INVALID: "CONFIG_INVALID";
9
+ readonly XSTUDIO_NOT_INSTALLED: "XSTUDIO_NOT_INSTALLED";
10
+ readonly XSTUDIO_NOT_RUNNING: "XSTUDIO_NOT_RUNNING";
11
+ readonly WORKSPACE_UNWRITABLE: "WORKSPACE_UNWRITABLE";
12
+ readonly PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND";
13
+ readonly PROJECT_UNREADABLE: "PROJECT_UNREADABLE";
14
+ readonly PROJECT_DECODE_FAILED: "PROJECT_DECODE_FAILED";
15
+ readonly PROJECT_INVALID: "PROJECT_INVALID";
16
+ readonly TRACK_OUT_OF_RANGE: "TRACK_OUT_OF_RANGE";
17
+ readonly NOTE_NOT_FOUND: "NOTE_NOT_FOUND";
18
+ readonly BACKUP_FAILED: "BACKUP_FAILED";
19
+ readonly MIDI_PARSE_FAILED: "MIDI_PARSE_FAILED";
20
+ readonly MIDI_EMPTY: "MIDI_EMPTY";
21
+ readonly GUI_ACTION_FAILED: "GUI_ACTION_FAILED";
22
+ readonly GUI_REF_NOT_FOUND: "GUI_REF_NOT_FOUND";
23
+ readonly GUI_ASSERT_FAILED: "GUI_ASSERT_FAILED";
24
+ readonly GUI_FOCUS_LOST: "GUI_FOCUS_LOST";
25
+ readonly GUI_BUDGET_EXCEEDED: "GUI_BUDGET_EXCEEDED";
26
+ readonly GUI_ABORTED: "GUI_ABORTED";
27
+ /** The model must load the xstudio-gui skill before using this GUI tool. */
28
+ readonly NEED_SKILL: "NEED_SKILL";
29
+ readonly DIALOG_UNKNOWN: "DIALOG_UNKNOWN";
30
+ readonly CLOUD_UNREACHABLE: "CLOUD_UNREACHABLE";
31
+ readonly RENDER_TIMEOUT: "RENDER_TIMEOUT";
32
+ readonly EXPORT_FAILED: "EXPORT_FAILED";
33
+ readonly ARTIFACT_MISSING: "ARTIFACT_MISSING";
34
+ readonly GUIDE_ONLY: "GUIDE_ONLY";
35
+ };
36
+ /** One error code value. */
37
+ export type ErrorCodeValue = (typeof ErrorCode)[keyof typeof ErrorCode];
38
+ /** A structured plugin error. */
39
+ export declare class XStudioError extends Error {
40
+ readonly code: ErrorCodeValue;
41
+ readonly hint: string | undefined;
42
+ readonly next: string[];
43
+ constructor(code: ErrorCodeValue, message: string, options?: {
44
+ hint?: string;
45
+ next?: string[];
46
+ cause?: unknown;
47
+ });
48
+ }
49
+ /** True when `value` is one of the plugin's stable error codes. */
50
+ export declare function isStableErrorCode(value: unknown): boolean;
51
+ /**
52
+ * Coerce an unknown thrown value into an XStudioError.
53
+ *
54
+ * `XStudioError` instances pass through untouched. Any other error that
55
+ * carries one of the plugin's stable error codes (notably the
56
+ * `SidecarError` raised by the GUI sidecar with `GUI_REF_NOT_FOUND`,
57
+ * `GUI_FOCUS_LOST` or `GUI_ACTION_FAILED`) keeps that code, so GUI-layer
58
+ * failures surface with the same stable codes the orchestrator uses. Only
59
+ * untyped errors are flattened to `fallbackCode`.
60
+ */
61
+ export declare function asXStudioError(error: unknown, fallbackCode?: ErrorCodeValue): XStudioError;
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Structured error codes and the "what to do next" advice attached to every
3
+ * failure. Codes are stable API: the model, docs and tests match on them.
4
+ * @module xstudio-linux/shared/errors
5
+ */
6
+ /** Stable error codes. */
7
+ export const ErrorCode = {
8
+ // configuration / environment
9
+ CONFIG_INVALID: 'CONFIG_INVALID',
10
+ XSTUDIO_NOT_INSTALLED: 'XSTUDIO_NOT_INSTALLED',
11
+ XSTUDIO_NOT_RUNNING: 'XSTUDIO_NOT_RUNNING',
12
+ WORKSPACE_UNWRITABLE: 'WORKSPACE_UNWRITABLE',
13
+ // project files
14
+ PROJECT_NOT_FOUND: 'PROJECT_NOT_FOUND',
15
+ PROJECT_UNREADABLE: 'PROJECT_UNREADABLE',
16
+ PROJECT_DECODE_FAILED: 'PROJECT_DECODE_FAILED',
17
+ PROJECT_INVALID: 'PROJECT_INVALID',
18
+ TRACK_OUT_OF_RANGE: 'TRACK_OUT_OF_RANGE',
19
+ NOTE_NOT_FOUND: 'NOTE_NOT_FOUND',
20
+ BACKUP_FAILED: 'BACKUP_FAILED',
21
+ // midi
22
+ MIDI_PARSE_FAILED: 'MIDI_PARSE_FAILED',
23
+ MIDI_EMPTY: 'MIDI_EMPTY',
24
+ // gui / cloud
25
+ GUI_ACTION_FAILED: 'GUI_ACTION_FAILED',
26
+ GUI_REF_NOT_FOUND: 'GUI_REF_NOT_FOUND',
27
+ GUI_ASSERT_FAILED: 'GUI_ASSERT_FAILED',
28
+ GUI_FOCUS_LOST: 'GUI_FOCUS_LOST',
29
+ GUI_BUDGET_EXCEEDED: 'GUI_BUDGET_EXCEEDED',
30
+ GUI_ABORTED: 'GUI_ABORTED',
31
+ /** The model must load the xstudio-gui skill before using this GUI tool. */
32
+ NEED_SKILL: 'NEED_SKILL',
33
+ DIALOG_UNKNOWN: 'DIALOG_UNKNOWN',
34
+ CLOUD_UNREACHABLE: 'CLOUD_UNREACHABLE',
35
+ RENDER_TIMEOUT: 'RENDER_TIMEOUT',
36
+ EXPORT_FAILED: 'EXPORT_FAILED',
37
+ ARTIFACT_MISSING: 'ARTIFACT_MISSING',
38
+ // degrade
39
+ GUIDE_ONLY: 'GUIDE_ONLY',
40
+ };
41
+ /** The next-step advice attached to an error code. */
42
+ const NEXT_STEPS = {
43
+ [ErrorCode.XSTUDIO_NOT_INSTALLED]: [
44
+ 'Set XSTUDIO_INSTALL_DIR (or config.xstudioInstallDir) to the Wine-prefix folder containing "NetEase Cloud Music XStudio.exe".',
45
+ 'Re-run xstudio_probe to confirm the install is detected.',
46
+ ],
47
+ [ErrorCode.XSTUDIO_NOT_RUNNING]: [
48
+ 'Start X Studio manually, or call xstudio_ui_snapshot after starting it.',
49
+ 'Data-plane tools (project_read/edit/note_*) keep working without the GUI.',
50
+ ],
51
+ [ErrorCode.PROJECT_NOT_FOUND]: [
52
+ 'Check the path; use xstudio_probe to see the configured workspace directory.',
53
+ 'Use an absolute path or a path relative to the session working directory.',
54
+ ],
55
+ [ErrorCode.PROJECT_DECODE_FAILED]: [
56
+ 'Confirm the file is a .svip3 project saved by X Studio 1.2.x / 3.0.x.',
57
+ 'Keep the original file; the plugin never rewrites a project it could not decode.',
58
+ ],
59
+ [ErrorCode.NOTE_NOT_FOUND]: [
60
+ 'Call xstudio_project_read with include:"notes" to list note indices.',
61
+ 'Indices are 0-based and ordered by position_tick.',
62
+ ],
63
+ [ErrorCode.GUI_REF_NOT_FOUND]: [
64
+ 'Call xstudio_ui_snapshot again: refs are valid for the latest snapshot only.',
65
+ 'If the element never appears, check skills/xstudio-gui/ui-map.json for the current build.',
66
+ ],
67
+ [ErrorCode.NEED_SKILL]: [
68
+ 'Call the skill tool with {"name":"xstudio-gui"}, read the returned SKILL.md, then retry the same tool.',
69
+ 'The skill contains the destructive-action blacklist, focus-gate semantics, unknown-dialog escalation, and the UIA-wedge recovery procedure (kill the sidecar instead of retrying a hung call).',
70
+ ],
71
+ [ErrorCode.GUI_FOCUS_LOST]: [
72
+ 'Bring X Studio to the foreground and retry; the plugin yields control when another app has focus.',
73
+ 'Disable gui.requireForeground only if you accept acting on an unfocused window.',
74
+ ],
75
+ [ErrorCode.CLOUD_UNREACHABLE]: [
76
+ 'Check the network connection; X Studio renders on the cloud.',
77
+ 'Retry xstudio_preview_trigger after connectivity returns.',
78
+ ],
79
+ [ErrorCode.RENDER_TIMEOUT]: [
80
+ 'Call xstudio_preview_wait again with a larger timeout_ms.',
81
+ 'Check X Studio for a login or download dialog with xstudio_ui_snapshot.',
82
+ ],
83
+ [ErrorCode.GUIDE_ONLY]: [
84
+ 'Follow the printed manual steps; the data plane already wrote the project.',
85
+ ],
86
+ };
87
+ /** A structured plugin error. */
88
+ export class XStudioError extends Error {
89
+ code;
90
+ hint;
91
+ next;
92
+ constructor(code, message, options = {}) {
93
+ super(message, options.cause === undefined ? undefined : { cause: options.cause });
94
+ this.name = 'XStudioError';
95
+ this.code = code;
96
+ this.hint = options.hint;
97
+ this.next = options.next ?? NEXT_STEPS[code] ?? [];
98
+ }
99
+ }
100
+ /** True when `value` is one of the plugin's stable error codes. */
101
+ export function isStableErrorCode(value) {
102
+ return typeof value === 'string' && Object.values(ErrorCode).includes(value);
103
+ }
104
+ /**
105
+ * Coerce an unknown thrown value into an XStudioError.
106
+ *
107
+ * `XStudioError` instances pass through untouched. Any other error that
108
+ * carries one of the plugin's stable error codes (notably the
109
+ * `SidecarError` raised by the GUI sidecar with `GUI_REF_NOT_FOUND`,
110
+ * `GUI_FOCUS_LOST` or `GUI_ACTION_FAILED`) keeps that code, so GUI-layer
111
+ * failures surface with the same stable codes the orchestrator uses. Only
112
+ * untyped errors are flattened to `fallbackCode`.
113
+ */
114
+ export function asXStudioError(error, fallbackCode = ErrorCode.PROJECT_INVALID) {
115
+ if (error instanceof XStudioError)
116
+ return error;
117
+ const message = error instanceof Error ? error.message : String(error);
118
+ const carrier = error;
119
+ if (carrier !== null && isStableErrorCode(carrier?.code)) {
120
+ const hint = typeof carrier?.hint === 'string' ? carrier.hint : undefined;
121
+ return new XStudioError(carrier.code, message, { hint, cause: error });
122
+ }
123
+ return new XStudioError(fallbackCode, message, { cause: error });
124
+ }
125
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,8BAA8B;IAC9B,cAAc,EAAE,gBAAgB;IAChC,qBAAqB,EAAE,uBAAuB;IAC9C,mBAAmB,EAAE,qBAAqB;IAC1C,oBAAoB,EAAE,sBAAsB;IAC5C,gBAAgB;IAChB,iBAAiB,EAAE,mBAAmB;IACtC,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,eAAe,EAAE,iBAAiB;IAClC,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,OAAO;IACP,iBAAiB,EAAE,mBAAmB;IACtC,UAAU,EAAE,YAAY;IACxB,cAAc;IACd,iBAAiB,EAAE,mBAAmB;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,mBAAmB,EAAE,qBAAqB;IAC1C,WAAW,EAAE,aAAa;IAC1B,4EAA4E;IAC5E,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,gBAAgB;IAChC,iBAAiB,EAAE,mBAAmB;IACtC,cAAc,EAAE,gBAAgB;IAChC,aAAa,EAAE,eAAe;IAC9B,gBAAgB,EAAE,kBAAkB;IACpC,UAAU;IACV,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+1,8 @@
1
+ /** Expand a leading `~` and normalize separators to the platform form. */
2
+ export declare function expandHome(input: string): string;
3
+ /** Resolve a user-supplied path against the session working directory. */
4
+ export declare function resolveUserPath(input: string, cwd: string): string;
5
+ /** Normalize `source_path` for writing: forward slashes, absolute, no duplicate separators. */
6
+ export declare function normalizeSourcePath(input: string): string;
7
+ /** A timestamped backup path beside the original file. */
8
+ export declare function backupPathFor(filePath: string, stamp?: Date): string;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Path helpers shared by the data plane and the adapters.
3
+ * @module xstudio-linux/shared/paths
4
+ */
5
+ import { homedir } from 'node:os';
6
+ import { isAbsolute, join, normalize, resolve, sep } from 'node:path';
7
+ /** Expand a leading `~` and normalize separators to the platform form. */
8
+ export function expandHome(input) {
9
+ if (input === '~')
10
+ return homedir();
11
+ if (input.startsWith('~/') || input.startsWith('~\\'))
12
+ return join(homedir(), input.slice(2));
13
+ return input;
14
+ }
15
+ /** Resolve a user-supplied path against the session working directory. */
16
+ export function resolveUserPath(input, cwd) {
17
+ const expanded = expandHome(input);
18
+ return isAbsolute(expanded) ? normalize(expanded) : resolve(cwd, expanded);
19
+ }
20
+ /** Normalize `source_path` for writing: forward slashes, absolute, no duplicate separators. */
21
+ export function normalizeSourcePath(input) {
22
+ return normalize(input).split(sep).join('/');
23
+ }
24
+ /** A timestamped backup path beside the original file. */
25
+ export function backupPathFor(filePath, stamp = new Date()) {
26
+ const pad = (value, width = 2) => String(value).padStart(width, '0');
27
+ const suffix = `${stamp.getFullYear()}${pad(stamp.getMonth() + 1)}${pad(stamp.getDate())}-${pad(stamp.getHours())}${pad(stamp.getMinutes())}${pad(stamp.getSeconds())}-${pad(stamp.getMilliseconds(), 3)}`;
28
+ return `${filePath}.bak.${suffix}`;
29
+ }
30
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/shared/paths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,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,EAAE,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,EAAE,CAAA;IAC1M,OAAO,GAAG,QAAQ,QAAQ,MAAM,EAAE,CAAA;AACpC,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The JSON Schema subset this Harness enforces for tool parameters/outputs,
3
+ * plus the shared result-envelope schema every xstudio-linux tool returns.
4
+ * @module xstudio-linux/shared/schema
5
+ */
6
+ /** Scalar JSON values accepted by enum/const. */
7
+ export type JsonScalar = string | number | boolean | null;
8
+ /** Authoring form of one schema node (inline `required: true` allowed). */
9
+ export interface SchemaSpec {
10
+ type?: 'string' | 'number' | 'integer' | 'boolean' | 'null' | 'object' | 'array' | 'json';
11
+ description?: string;
12
+ /** Authoring convenience: collected into the parent object's `required` array. */
13
+ required?: boolean;
14
+ properties?: Record<string, SchemaSpec>;
15
+ items?: SchemaSpec;
16
+ additionalProperties?: boolean;
17
+ enum?: readonly JsonScalar[];
18
+ const?: JsonScalar;
19
+ oneOf?: readonly SchemaSpec[];
20
+ }
21
+ /** Convert one authoring schema spec into the enforced JSON Schema subset. */
22
+ export declare function toJsonSchema(spec: SchemaSpec): Record<string, unknown>;
23
+ /** Convert a parameter map into the root object schema. */
24
+ export declare function parametersSchema(parameters: Record<string, SchemaSpec>): Record<string, unknown>;
25
+ /** The uniform result envelope as an authoring schema. */
26
+ export declare function envelopeSchema(data?: SchemaSpec): SchemaSpec;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The JSON Schema subset this Harness enforces for tool parameters/outputs,
3
+ * plus the shared result-envelope schema every xstudio-linux tool returns.
4
+ * @module xstudio-linux/shared/schema
5
+ */
6
+ /** Convert one authoring schema spec into the enforced JSON Schema subset. */
7
+ export function toJsonSchema(spec) {
8
+ const out = {};
9
+ if (spec.type === 'json')
10
+ return {};
11
+ if (spec.type !== undefined)
12
+ out.type = spec.type;
13
+ if (spec.description !== undefined)
14
+ out.description = spec.description;
15
+ if (spec.enum !== undefined)
16
+ out.enum = [...spec.enum];
17
+ if (spec.const !== undefined)
18
+ out.const = spec.const;
19
+ if (spec.oneOf !== undefined)
20
+ out.oneOf = spec.oneOf.map(toJsonSchema);
21
+ if (spec.items !== undefined)
22
+ out.items = toJsonSchema(spec.items);
23
+ if (spec.properties !== undefined) {
24
+ const properties = {};
25
+ const required = [];
26
+ for (const [key, value] of Object.entries(spec.properties)) {
27
+ properties[key] = toJsonSchema(value);
28
+ if (value.required === true)
29
+ required.push(key);
30
+ }
31
+ out.properties = properties;
32
+ if (required.length > 0)
33
+ out.required = required;
34
+ }
35
+ if (spec.additionalProperties !== undefined)
36
+ out.additionalProperties = spec.additionalProperties;
37
+ return out;
38
+ }
39
+ /** Convert a parameter map into the root object schema. */
40
+ export function parametersSchema(parameters) {
41
+ return toJsonSchema({ type: 'object', properties: parameters, additionalProperties: false });
42
+ }
43
+ /** The uniform result envelope as an authoring schema. */
44
+ export function envelopeSchema(data) {
45
+ return {
46
+ type: 'object',
47
+ additionalProperties: false,
48
+ properties: {
49
+ via: { type: 'string', required: true, description: 'Execution path that produced this result.' },
50
+ product_line: { type: 'string', required: true, description: 'Always "beta-netease".' },
51
+ ok: { type: 'boolean', required: true },
52
+ data: data ?? { type: 'json', description: 'Tool-specific payload.' },
53
+ error: {
54
+ type: 'object',
55
+ additionalProperties: false,
56
+ properties: {
57
+ code: { type: 'string', required: true },
58
+ message: { type: 'string', required: true },
59
+ hint: { type: 'string' },
60
+ next: { type: 'array', items: { type: 'string' } },
61
+ },
62
+ },
63
+ next: { type: 'array', items: { type: 'string' } },
64
+ warnings: { type: 'array', items: { type: 'string' } },
65
+ },
66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