@team-antioch/sc2-adjutant 0.1.0 → 0.1.1

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 (149) hide show
  1. package/README.md +2 -0
  2. package/data/blizzard-baseline.json +3061 -0
  3. package/data/button-hotkeys.json +5722 -0
  4. package/data/game-assets.json +50909 -0
  5. package/data/package-entries.json +32361 -2
  6. package/dist/capture/bank-fixtures.d.ts +13 -0
  7. package/dist/capture/bank-fixtures.js +35 -0
  8. package/dist/capture/bank-snapshots.d.ts +95 -0
  9. package/dist/capture/bank-snapshots.js +302 -0
  10. package/dist/capture/editor-broker-client.d.ts +27 -4
  11. package/dist/capture/editor-broker-client.js +3 -3
  12. package/dist/capture/editor-broker.js +154 -9
  13. package/dist/capture/effect-tour.d.ts +113 -0
  14. package/dist/capture/effect-tour.js +283 -0
  15. package/dist/capture/effect-video.d.ts +74 -0
  16. package/dist/capture/effect-video.js +173 -0
  17. package/dist/capture/exemplar-capture.d.ts +4 -0
  18. package/dist/capture/exemplar-capture.js +4 -1
  19. package/dist/capture/shots.d.ts +6 -1
  20. package/dist/capture/shots.js +1 -1
  21. package/dist/capture/stop-tour.d.ts +3 -1
  22. package/dist/capture/stop-tour.js +1 -1
  23. package/dist/capture/style-pack-captures.d.ts +67 -0
  24. package/dist/capture/style-pack-captures.js +172 -0
  25. package/dist/catalog/stock-catalog.d.ts +8 -0
  26. package/dist/catalog/stock-catalog.js +13 -0
  27. package/dist/cli/capture-exemplars.js +18 -32
  28. package/dist/cli/effect-tour.d.ts +2 -0
  29. package/dist/cli/effect-tour.js +378 -0
  30. package/dist/cli/make-frames.d.ts +1 -0
  31. package/dist/cli/make-frames.js +21 -0
  32. package/dist/cli/sound-mix.d.ts +1 -0
  33. package/dist/cli/sound-mix.js +75 -0
  34. package/dist/cli/study.js +6 -26
  35. package/dist/domain/blueprint-trigger.d.ts +355 -3
  36. package/dist/domain/blueprint-trigger.js +149 -8
  37. package/dist/domain/library-interface.d.ts +50 -29
  38. package/dist/domain/library-interface.js +54 -41
  39. package/dist/domain/mission-blueprint.d.ts +13 -6
  40. package/dist/domain/mission-blueprint.js +6 -0
  41. package/dist/domain/mod-blueprint.d.ts +4 -4
  42. package/dist/host/game-logs.d.ts +63 -0
  43. package/dist/host/game-logs.js +178 -0
  44. package/dist/host/game-ownership.d.ts +37 -0
  45. package/dist/host/game-ownership.js +84 -0
  46. package/dist/host/game-run-report.d.ts +63 -0
  47. package/dist/host/game-run-report.js +119 -0
  48. package/dist/host/known-errors.d.ts +34 -0
  49. package/dist/host/known-errors.js +73 -0
  50. package/dist/init/init-workspace.d.ts +3 -1
  51. package/dist/init/init-workspace.js +10 -1
  52. package/dist/map/convert-mission-triggers.d.ts +115 -7
  53. package/dist/map/convert-mission-triggers.js +527 -47
  54. package/dist/map/editor-changes.d.ts +1 -1
  55. package/dist/map/editor-form.d.ts +5 -0
  56. package/dist/map/editor-form.js +72 -0
  57. package/dist/map/game-packages.d.ts +3 -2
  58. package/dist/map/game-packages.js +5 -2
  59. package/dist/map/kept-references.js +47 -1
  60. package/dist/map/kept-session.js +3 -1
  61. package/dist/map/outline-diff.d.ts +24 -0
  62. package/dist/map/outline-diff.js +95 -0
  63. package/dist/map/outline-trigger.d.ts +7 -0
  64. package/dist/map/outline-trigger.js +29 -20
  65. package/dist/map/ownership-plan.d.ts +6 -2
  66. package/dist/map/ownership-plan.js +1 -1
  67. package/dist/map/package-output.js +13 -8
  68. package/dist/map/tune-kept-triggers.d.ts +7 -0
  69. package/dist/map/tune-kept-triggers.js +33 -6
  70. package/dist/map/write-blueprint-trigger.d.ts +9 -4
  71. package/dist/map/write-blueprint-trigger.js +46 -13
  72. package/dist/map/write-map-package.js +20 -9
  73. package/dist/mcp/capture-jobs.d.ts +2 -0
  74. package/dist/mcp/capture-jobs.js +2 -0
  75. package/dist/mcp/server.d.ts +11 -2
  76. package/dist/mcp/server.js +17 -4
  77. package/dist/mcp/tools/bank-report.d.ts +19 -0
  78. package/dist/mcp/tools/bank-report.js +51 -0
  79. package/dist/mcp/tools/blueprint.js +18 -14
  80. package/dist/mcp/tools/capture.d.ts +4 -0
  81. package/dist/mcp/tools/capture.js +22 -5
  82. package/dist/mcp/tools/catalog.d.ts +1 -1
  83. package/dist/mcp/tools/catalog.js +30 -1
  84. package/dist/mcp/tools/compile.d.ts +1 -1
  85. package/dist/mcp/tools/compile.js +100 -9
  86. package/dist/mcp/tools/editor-handoff.d.ts +4 -1
  87. package/dist/mcp/tools/editor-handoff.js +6 -3
  88. package/dist/mcp/tools/style-pack.d.ts +11 -0
  89. package/dist/mcp/tools/style-pack.js +245 -0
  90. package/dist/mcp/tools/tool-group.d.ts +9 -0
  91. package/dist/mods/button-hotkeys.d.ts +45 -0
  92. package/dist/mods/button-hotkeys.js +185 -0
  93. package/dist/mods/compile-mod.js +19 -5
  94. package/dist/mods/custom-doodads.d.ts +21 -1
  95. package/dist/mods/custom-doodads.js +53 -7
  96. package/dist/mods/data-rules.js +8 -1
  97. package/dist/mods/effective-entry.d.ts +18 -0
  98. package/dist/mods/effective-entry.js +52 -0
  99. package/dist/mods/function-search.js +12 -0
  100. package/dist/mods/library-xml.d.ts +34 -5
  101. package/dist/mods/library-xml.js +94 -22
  102. package/dist/mods/sound-mix.d.ts +92 -0
  103. package/dist/mods/sound-mix.js +195 -0
  104. package/dist/plugins/check-workspace.js +22 -3
  105. package/dist/plugins/plugin-api.d.ts +59 -5
  106. package/dist/plugins/plugin-api.js +6 -0
  107. package/dist/plugins/plugin-sdk.d.ts +13 -1
  108. package/dist/plugins/plugin-sdk.js +16 -1
  109. package/dist/plugins/plugin-sources.js +1 -0
  110. package/dist/plugins/registry.d.ts +4 -0
  111. package/dist/plugins/registry.js +6 -2
  112. package/dist/plugins/workspace.d.ts +5 -0
  113. package/dist/plugins/workspace.js +10 -2
  114. package/dist/study/blizzard-baseline.d.ts +76 -0
  115. package/dist/study/blizzard-baseline.js +137 -0
  116. package/dist/study/exemplar-report.d.ts +71 -0
  117. package/dist/study/exemplar-report.js +163 -0
  118. package/dist/study/find-places.d.ts +127 -0
  119. package/dist/study/find-places.js +306 -0
  120. package/dist/study/load-map-package.d.ts +3 -0
  121. package/dist/study/load-map-package.js +11 -0
  122. package/dist/study/map-study.d.ts +1 -0
  123. package/dist/study/map-study.js +3 -0
  124. package/dist/study/measure-lighting.d.ts +6 -0
  125. package/dist/study/measure-lighting.js +1 -1
  126. package/dist/study/measures.d.ts +225 -0
  127. package/dist/study/measures.js +366 -0
  128. package/dist/study/scaffold-style-pack.d.ts +58 -0
  129. package/dist/study/scaffold-style-pack.js +261 -0
  130. package/dist/study/study-exemplars.d.ts +67 -0
  131. package/dist/study/study-exemplars.js +133 -0
  132. package/dist/triggers/blueprint-triggers.d.ts +71 -11
  133. package/dist/triggers/blueprint-triggers.js +403 -48
  134. package/dist/triggers/kept-trigger-galaxy.d.ts +29 -0
  135. package/dist/triggers/kept-trigger-galaxy.js +103 -7
  136. package/dist/triggers/splice-map-script.d.ts +2 -0
  137. package/dist/triggers/splice-map-script.js +309 -8
  138. package/dist/triggers/write-triggers-xml.js +20 -5
  139. package/dist/ui/frame-path-check.d.ts +43 -4
  140. package/dist/ui/frame-path-check.js +121 -13
  141. package/dist/ui/frame-paths.d.ts +21 -1
  142. package/dist/ui/frame-paths.js +26 -6
  143. package/dist/ui/toast.d.ts +4 -5
  144. package/dist/ui/toast.js +6 -10
  145. package/examples/example-campaign/README.md +27 -0
  146. package/examples/example-campaign/missions/ashfall-relay/blueprint.json +11 -1
  147. package/examples/example-campaign/missions/ashfall-relay/triggers/ash-tremors.json +69 -0
  148. package/examples/example-campaign/missions/ashfall-relay/triggers/start-ash-tremors.json +31 -0
  149. package/package.json +3 -3
@@ -11,8 +11,9 @@ import { isInside, realPathOf } from "../../util/inside.js";
11
11
  import { writeTarget } from "../../util/replace-file.js";
12
12
  import { brokerSocketPath, editorBrokerStatus } from "../../capture/editor-broker-client.js";
13
13
  import { captureShots, ShotSchema } from "../../capture/shots.js";
14
+ import { formatRunLogReport, reportRunLogs } from "../../host/game-run-report.js";
14
15
  import { hostContext } from "../../host/machine-config.js";
15
- import { captureJobs, placeOf } from "../capture-jobs.js";
16
+ import { captureJobs, placeOf, waitLength as waitLengthOf } from "../capture-jobs.js";
16
17
  import { MissionSchema, IssueSchema, MapSchema } from "./schemas.js";
17
18
  import { stageHint, insideWorkspace, existingMapPackage, oneAtATime, readingMapToEdit } from "./mission-files.js";
18
19
  import { describeHandoff, editorHasOpen, TEST_BUDGET_SECONDS, TEST_MIN_SECONDS, testInGame } from "./editor-handoff.js";
@@ -32,6 +33,8 @@ async function missionScript(workspace, blueprintPath) {
32
33
  }
33
34
  /** The tools registerCaptureTools can register, the capture group: speak_placeholder_voices only on a Host that can run tts.speak. */
34
35
  export const CAPTURE_TOOLS = ["speak_placeholder_voices", "capture_composite", "capture_shots", "freeze_set_piece", "compile_cutscene", "import_set"];
36
+ /** The group's tools listed on every machine but refused where the Host Adapter lacks these capabilities. */
37
+ export const CAPTURE_REFUSED_WITHOUT = { capture_shots: ["editor.captureTour"] };
35
38
  export function registerCaptureTools(server, ctx, { captureWaitMs }) {
36
39
  const tool = toolGroup(server, CAPTURE_TOOLS);
37
40
  // Bulk tools with no manual form are listed only when the Host Adapter can run them.
@@ -98,11 +101,11 @@ export function registerCaptureTools(server, ctx, { captureWaitMs }) {
98
101
  // Listed whatever the Host Adapter, unlike the other bulk tools, so a call on a machine that
99
102
  // can't capture is refused with the reason rather than finding no tool.
100
103
  const shotJobs = captureJobs();
101
- const waitLength = captureWaitMs >= 60_000 ? `${Math.round(captureWaitMs / 60_000)} minutes` : `${(captureWaitMs / 1000).toFixed(1)} seconds`;
104
+ const waitLength = waitLengthOf(captureWaitMs);
102
105
  tool("capture_shots", {
103
106
  title: "Capture Shots in game",
104
107
  annotations: ADDITIVE,
105
- description: `Takes in-game screenshots of parts of a map, one frame per Shot. A Shot is a rectangle of the map in cells, rect: [left, bottom, right, top], that its frame shows whole, with an optional pitch (degrees down from level: 75 by default, a high view; 56 is the player's camera) and yaw (degrees turned from the game camera's own, which looks north; 0 by default), and a label that names its frame. Use it to see how a map looks in the game itself (ground, cliffs, dressing, water, lighting, a layout's sight lines), not in a preview render or the Editor. Size each rectangle to what you want to judge: the camera moves back until the rectangle fits, so about 10-20 cells shows detail, 30-50 cells a Zone, and more an overview; the 16:9 frame shows more than the rectangle on its long side. A rectangle too big for the farthest camera, or at the map's edge where the camera can't centre on it, is still captured and listed as partial (whole: false). Send every Shot you need in one call: starting the game takes minutes, each Shot after that a few seconds. The game runs a capture copy of the map with none of the map's own triggers: the map as placed, revealed with no fog, no UI, no trigger-set lighting (pass lighting, a Light id, to set one), no trigger-spawned units and no trigger-made actor changes. Give mission for a Mission's own Map Package (frames in missions/<id>/output/shots/<name>/, git-ignored) or mapPath for any Map Package (frames in the machine's cacheDir, shots/<name>/); name is the folder, the time by default. Every capture on the machine goes through one Editor Broker, one at a time, so a call may wait behind others. It waits up to ${waitLength}; a job not done by then comes back as state waiting with a job id: call capture_shots({ job }) to wait again and collect the frames, or hear the job's place in the queue. capture_shots({ job, cancel: true }) cancels a job no longer wanted, waiting or running (a running one quits the game and closes its copy first), and stopping a call cancels the job it waits on. Returns the frames' paths and shots.json, which gives each Shot's rectangle, camera and whether its frame shows it whole; look at the frames with your file-reading tool. Needs the macOS Host Adapter (editor.captureTour) and an awake screen; the Editor comes to the front while it runs, so check the author isn't mid-task in it.`,
108
+ description: `Takes in-game screenshots of parts of a map, one frame per Shot. A Shot is a rectangle of the map in cells, rect: [left, bottom, right, top], that its frame shows whole, with an optional pitch (degrees down from level: 75 by default, a high view; 56 is the player's camera) and yaw (degrees turned from the game camera's own, which looks north; 0 by default), and a label that names its frame. Use it to see how a map looks in the game itself (ground, cliffs, dressing, water, lighting, a layout's sight lines), not in a preview render or the Editor. Size each rectangle to what you want to judge: the camera moves back until the rectangle fits, so about 10-20 cells shows detail, 30-50 cells a Zone, and more an overview; the 16:9 frame shows more than the rectangle on its long side. A rectangle too big for the farthest camera, or at the map's edge where the camera can't centre on it, is still captured and listed as partial (whole: false). Send every Shot you need in one call: starting the game takes minutes, each Shot after that a few seconds. The game runs a capture copy of the map with none of the map's own triggers: the map as placed, revealed with no fog, no UI, no trigger-set lighting (pass lighting, a Light id, to set one), no trigger-spawned units and no trigger-made actor changes. Give mission for a Mission's own Map Package (frames in missions/<id>/output/shots/<name>/, git-ignored) or mapPath for any Map Package (frames in the machine's cacheDir, shots/<name>/); name is the folder, the time by default. Every capture on the machine goes through one Editor Broker, one at a time, so a call may wait behind others. It waits up to ${waitLength}; a job not done by then comes back as state waiting with a job id: call capture_shots({ job }) to wait again and collect the frames, or hear the job's place in the queue. capture_shots({ job, cancel: true }) cancels a job no longer wanted, waiting or running (a running one quits the game and closes its copy first), and stopping a call cancels the job it waits on. After the game quits it reads the game's logs and reports any crash, each distinct error with its count and which no known-error list (known-errors.json at the Workspace root, and the Mission's own beside its Blueprint) knows; propose a pattern for the author to add, never add one. Returns the frames' paths and shots.json, which gives each Shot's rectangle, camera and whether its frame shows it whole; look at the frames with your file-reading tool. Needs the macOS Host Adapter (editor.captureTour) and an awake screen; the Editor comes to the front while it runs, so check the author isn't mid-task in it.`,
106
109
  inputSchema: {
107
110
  mission: MissionSchema.optional(),
108
111
  mapPath: z.string().min(1).optional().describe("Any Map Package, instead of a Mission: an absolute path, or one relative to the Workspace's root"),
@@ -124,6 +127,8 @@ export function registerCaptureTools(server, ctx, { captureWaitMs }) {
124
127
  missing: z.array(z.string()).optional(),
125
128
  partial: z.array(z.string()).optional(),
126
129
  end: z.string().optional(),
130
+ /** The game's logs for this capture, read after it quit: crashes, each distinct error with its count, and which no known-error list knows (new). */
131
+ gameLogs: z.unknown().optional(),
127
132
  },
128
133
  }, async ({ mission, mapPath, shots, lighting, name, job, cancel }, extra) => {
129
134
  if (!ctx.host.has("editor.captureTour")) {
@@ -152,7 +157,18 @@ export function registerCaptureTools(server, ctx, { captureWaitMs }) {
152
157
  return ctx.fail("capture_shots needs shots: the rectangles to capture, all of them in one call.");
153
158
  const workspace = await ctx.workspace();
154
159
  const source = mission !== undefined ? { blueprintPath: await missionBlueprintPath(workspace, mission) } : { mapPath: path.resolve(workspace.root, mapPath) };
155
- const id = shotJobs.start(({ onQueued, log, signal }) => captureShots(source, shots, { host: ctx.host, onQueued, log, signal, ...(name ? { name } : {}), ...(lighting ? { lighting } : {}) }));
160
+ const id = shotJobs.start(async ({ onQueued, log, signal }) => {
161
+ const began = new Date();
162
+ const captured = await captureShots(source, shots, { host: ctx.host, onQueued, log, signal, ...(name ? { name } : {}), ...(lighting ? { lighting } : {}) });
163
+ // The game has quit by now (the broker quits the games it started), so its logs are written.
164
+ const logs = await reportRunLogs({
165
+ host: ctx.host,
166
+ workspaceRoot: workspace.root,
167
+ ...("blueprintPath" in source ? { missionDir: path.dirname(source.blueprintPath) } : {}),
168
+ selection: { after: new Date(captured.run.startedAt ?? began), parameters: [path.basename(captured.copy), "EditorTest.SC2Map"], pids: captured.run.games.map((game) => game.pid) },
169
+ }).catch((error) => ({ folder: "", sessions: [], stale: [], note: `couldn't read the game's logs: ${error.message}` }));
170
+ return { ...captured, logs };
171
+ });
156
172
  return shotsReply(id, await shotJobs.wait(id, captureWaitMs, extra.signal));
157
173
  });
158
174
  /** capture_shots's reply for a job where it stands. */
@@ -172,7 +188,8 @@ export function registerCaptureTools(server, ctx, { captureWaitMs }) {
172
188
  const { result } = state;
173
189
  const shotsJson = path.join(result.outputDir, "shots.json");
174
190
  const shots = result.shots.map(({ shot, label, frame, whole }) => ({ shot, ...(label ? { label } : {}), frame: frame === null ? null : path.join(result.outputDir, frame), whole }));
175
- return ctx.reply([result.summary, ...result.frames, `What each shows: ${shotsJson}`].join("\n"), { state: "done", job, outputDir: result.outputDir, frames: [...result.frames], shotsJson, shots, missing: [...result.missing], partial: [...result.partial], end: result.end });
191
+ const logLines = formatRunLogReport(result.logs, "Game logs");
192
+ return ctx.reply([result.summary, ...result.frames, `What each shows: ${shotsJson}`, ...logLines].join("\n"), { state: "done", job, outputDir: result.outputDir, frames: [...result.frames], shotsJson, shots, missing: [...result.missing], partial: [...result.partial], end: result.end, gameLogs: result.logs });
176
193
  }
177
194
  tool("freeze_set_piece", {
178
195
  title: "Freeze a set piece",
@@ -4,7 +4,7 @@ import { type SetFinderTool } from "../find-sets.js";
4
4
  import { type OpenDoodadFinderTool } from "../open-doodad-finder.js";
5
5
  import { type CallContext } from "../call-context.js";
6
6
  /** The tools registerCatalogTools can register, the catalog group: find_doodads, find_sets and open_doodad_finder only when their Finder package loaded. */
7
- export declare const CATALOG_TOOLS: readonly ["asset_catalog", "show_entry", "search_doodads", "find_doodads", "find_sets", "open_doodad_finder", "decal_variations", "build_doodad_search_page", "build_doodad_sheets", "add_doodad_note", "contribute_doodad_notes", "index_mod_doodads", "record_model_anims", "texture_sheet", "texture_usage"];
7
+ export declare const CATALOG_TOOLS: readonly ["asset_catalog", "show_entry", "search_doodads", "find_doodads", "find_sets", "open_doodad_finder", "decal_variations", "build_doodad_search_page", "build_doodad_sheets", "add_doodad_note", "contribute_doodad_notes", "index_mod_doodads", "record_model_anims", "texture_sheet", "texture_usage", "sound_mix"];
8
8
  export declare function registerCatalogTools(server: McpServer, ctx: CallContext, { doodadFinder, openDoodadFinder, setFinder }: {
9
9
  doodadFinder?: DoodadFinderTool | undefined;
10
10
  openDoodadFinder?: OpenDoodadFinderTool | undefined;
@@ -16,6 +16,7 @@ import { lookUpTextures, searchTextures, TEXTURE_KINDS, TEXTURE_SUITS, TEXTURE_T
16
16
  import { stockTextures } from "../../catalog/stock-catalog.js";
17
17
  import { describeTexture, renderTextureSheet } from "../../catalog/texture-sheet.js";
18
18
  import { areaLine, legendLine, missionTextureUsage } from "../../map/texture-usage.js";
19
+ import { checkSoundMixes, definedSounds, SoundMixSchema, soundMixEntries, soundMixWiring, soundMixXml, workspaceSounds } from "../../mods/sound-mix.js";
19
20
  import { DOODAD_KINDS, DOODAD_ROLES, DOODAD_SIZES } from "@team-antioch/sc2-asset-catalog/catalog/doodad-catalog.js";
20
21
  import { DECAL_GLYPHS, DECAL_SHAPES, DECAL_SHOWS, DECAL_USES, decalSheetPath, findDecalVariations, formatDecalVariations } from "@team-antioch/sc2-asset-catalog/catalog/decal-catalog.js";
21
22
  import { DOODAD_PLACEMENTS } from "@team-antioch/sc2-asset-catalog/catalog/doodad-facings.js";
@@ -30,7 +31,7 @@ import { Ids, MissionSchema, plain } from "./schemas.js";
30
31
  import {} from "../call-context.js";
31
32
  import { ADDITIVE, DESTRUCTIVE, READ_ONLY, toolGroup } from "./tool-group.js";
32
33
  /** The tools registerCatalogTools can register, the catalog group: find_doodads, find_sets and open_doodad_finder only when their Finder package loaded. */
33
- export const CATALOG_TOOLS = ["asset_catalog", "show_entry", "search_doodads", "find_doodads", "find_sets", "open_doodad_finder", "decal_variations", "build_doodad_search_page", "build_doodad_sheets", "add_doodad_note", "contribute_doodad_notes", "index_mod_doodads", "record_model_anims", "texture_sheet", "texture_usage"];
34
+ export const CATALOG_TOOLS = ["asset_catalog", "show_entry", "search_doodads", "find_doodads", "find_sets", "open_doodad_finder", "decal_variations", "build_doodad_search_page", "build_doodad_sheets", "add_doodad_note", "contribute_doodad_notes", "index_mod_doodads", "record_model_anims", "texture_sheet", "texture_usage", "sound_mix"];
34
35
  export function registerCatalogTools(server, ctx, { doodadFinder, openDoodadFinder, setFinder }) {
35
36
  const tool = toolGroup(server, CATALOG_TOOLS);
36
37
  tool("asset_catalog", {
@@ -539,4 +540,32 @@ export function registerCatalogTools(server, ctx, { doodadFinder, openDoodadFind
539
540
  ],
540
541
  };
541
542
  });
543
+ tool("sound_mix", {
544
+ title: "Sound mix actors",
545
+ annotations: READ_ONLY,
546
+ description: "Makes the actor data that plays a sound mix: several CSounds played as one sound, each from its own time after the mix starts (docs/reference/sound-mixes.md, the sound-mix skill). Each mix is one CActorSound whose Layers play their CSounds after their PlayDelay, each with its own variations; a layer with a stop is an actor of its own that stops itself on a timer, fading out first if it has a fade. Created with `Create <id>` from the unit's actor on an event (its death, an attack), the mix takes its place once and keeps playing where the unit was, after the unit dies. Every CSound a layer plays is checked against the game's packages (core's data/package-entries.json), the Workspace mods' own (their packages and Blueprint entries) and the files or folders in sounds (a Mission's Map Package, say): one defined nowhere would play nothing, so it is refused, naming the id it may have meant. Returns the entries as Generic Entries JSON (for a Mod Blueprint's entries) or, with xml, as elements for a map's ActorData.xml, with where each CSound is defined and the line that creates a mix. Reads only: add the entries yourself.",
547
+ inputSchema: {
548
+ mixes: z.array(SoundMixSchema).min(1).describe("The mixes: each an actor id and its layers ({ sound, at, stop?, fade? }, seconds from the mix's start), and optionally the silent CSound to play when no layer starts at 0"),
549
+ xml: z.boolean().optional().describe("Give ActorData.xml elements instead of Generic Entries"),
550
+ sounds: z.array(z.string().min(1)).optional().describe("More own data to find CSounds in, as paths from the Workspace: a SoundData.xml, a JSON file of Generic Entries, or a folder such as a Mission's .SC2Map"),
551
+ },
552
+ }, async ({ mixes, xml, sounds }) => {
553
+ const workspace = await ctx.workspace();
554
+ const own = await workspaceSounds(workspace);
555
+ try {
556
+ for (const source of sounds ?? [])
557
+ for (const id of await definedSounds(path.resolve(workspace.root, source)))
558
+ own.add(id);
559
+ }
560
+ catch (error) {
561
+ return ctx.fail(error.message);
562
+ }
563
+ const { found, problems } = checkSoundMixes(mixes, own);
564
+ if (problems.length > 0)
565
+ return ctx.fail(problems.join("\n"));
566
+ const entries = mixes.flatMap(soundMixEntries);
567
+ const where = [...found].map(([sound, at]) => `${sound}: ${at.join(", ")}`).join("\n");
568
+ const data = xml ? soundMixXml(entries) : JSON.stringify(entries, null, 2);
569
+ return ctx.reply(`${data}\n\nCSounds:\n${where}\n\nCreate each mix from the actor of the unit it's for, on the event it's for. On a death: ${soundMixWiring(mixes[0])}`);
570
+ });
542
571
  }
@@ -1,5 +1,5 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { type CallContext } from "../call-context.js";
3
3
  /** The tools registerCompileTools can register, the compile group. */
4
- export declare const COMPILE_TOOLS: readonly ["compile_map", "import_map", "import_mod", "compile_mod", "convert_sound_set", "convert_entries", "convert_files", "convert_assets", "convert_library", "convert_triggers", "convert_screenplay", "propose_removals", "kept_report", "compile_melee_map", "test_mission"];
4
+ export declare const COMPILE_TOOLS: readonly ["compile_map", "import_map", "import_mod", "compile_mod", "convert_sound_set", "convert_entries", "convert_files", "convert_assets", "convert_library", "convert_triggers", "convert_screenplay", "propose_removals", "kept_report", "compile_melee_map", "test_mission", "bank_changes", "save_bank_fixture"];
5
5
  export declare function registerCompileTools(server: McpServer, ctx: CallContext): void;
@@ -23,16 +23,21 @@ import { formatKeptReport, KEPT_COMPONENTS, keptReport } from "../../mods/kept-r
23
23
  import { formatProposedRemovals, proposeRemovals } from "../../mods/removals.js";
24
24
  import { readWorkspaceMod } from "../../mods/workspace-mods.js";
25
25
  import { missionMapPackage } from "../../map/mission-package.js";
26
- import { missionBlueprintPath } from "../../plugins/workspace.js";
26
+ import { missionBlueprintPath, readRawBlueprint } from "../../plugins/workspace.js";
27
+ import { hostContext } from "../../host/machine-config.js";
27
28
  import { editorDecisions } from "../../map/editor-changes.js";
28
29
  import { realPathOf } from "../../util/inside.js";
29
30
  import { MissionSchema, plain } from "./schemas.js";
30
31
  import { stageHint, insideWorkspace, defaultOutputDir, oneAtATime, readingMapToEdit } from "./mission-files.js";
32
+ import { formatRunLogReport, reportRunLogs } from "../../host/game-run-report.js";
31
33
  import { closeForRefresh, describeHandoff, editorHasOpen, reopenMap, TEST_BUDGET_SECONDS, TEST_MIN_SECONDS, testInGame } from "./editor-handoff.js";
32
34
  import { hasKeptTerrain } from "../../domain/mission-blueprint.js";
33
35
  import { buildLayoutModel } from "../../layout/layout-model.js";
34
36
  import { routeTestResults } from "../../layout/route-checks.js";
35
37
  import {} from "../call-context.js";
38
+ import { BANK_FIXTURES_FOLDER, missionBankFixture } from "../../capture/bank-fixtures.js";
39
+ import { fixtureBanks, saveBanksAsFixture, unrestoredFixtureRun } from "../../capture/bank-snapshots.js";
40
+ import { bankReport } from "./bank-report.js";
36
41
  import { ADDITIVE, DESTRUCTIVE, READ_ONLY, toolGroup } from "./tool-group.js";
37
42
  const LineChangeSchema = z.object({ line: z.string(), kept: z.string(), script: z.string() });
38
43
  /** What convert_screenplay found converting a Kept-terrain Mission's own conversation (map/convert-mission-screenplay.ts). */
@@ -87,7 +92,7 @@ const DECISION_INPUTS = {
87
92
  discardAll: z.boolean().optional().describe("Discard every change the compile lists (an entry in keep still stays)"),
88
93
  };
89
94
  /** The tools registerCompileTools can register, the compile group. */
90
- export const COMPILE_TOOLS = ["compile_map", "import_map", "import_mod", "compile_mod", "convert_sound_set", "convert_entries", "convert_files", "convert_assets", "convert_library", "convert_triggers", "convert_screenplay", "propose_removals", "kept_report", "compile_melee_map", "test_mission"];
95
+ export const COMPILE_TOOLS = ["compile_map", "import_map", "import_mod", "compile_mod", "convert_sound_set", "convert_entries", "convert_files", "convert_assets", "convert_library", "convert_triggers", "convert_screenplay", "propose_removals", "kept_report", "compile_melee_map", "test_mission", "bank_changes", "save_bank_fixture"];
91
96
  export function registerCompileTools(server, ctx) {
92
97
  const tool = toolGroup(server, COMPILE_TOOLS);
93
98
  tool("compile_map", {
@@ -345,11 +350,11 @@ export function registerCompileTools(server, ctx) {
345
350
  tool("convert_triggers", {
346
351
  title: "Convert Kept triggers into a Blueprint",
347
352
  annotations: DESTRUCTIVE,
348
- description: "Writes Kept triggers and globals of a Workspace Campaign Mod's GUI trigger library into its Mod Blueprint's triggers (ADR-0011), keeping their element ids: each item's elements go into the Blueprint's triggers source (library/triggers.xml unless the Blueprint names another), as the Editor wrote them, and its name and a trigger's local variables' names into triggers.names, and each text parameter's value (Param/Value/lib_<library>_<id>) into triggers.strings, by the strings file the package has it in, from the Kept strings or the Blueprint's raw strings, which it leaves; triggers converted earlier take the values they didn't then, and a value removals names stays removed. A category of the library interface (convert_library) that files one keeps filing it. Nothing in the package changes: compile_mod then writes them and their names over the Kept originals under the Equivalence Check. The compile doesn't write their Galaxy: it leaves the Editor's. Given a Mission instead of a mod, it reads chosen Kept triggers of the Mission's Map Package into its Blueprint's own trigger elements (ADR-0026): one file each in triggers/ (triggers/<name>.json, listed in the Blueprint's triggers), a GUI Body keeping the trigger's element Ids, its name and its local variables', its flags, events, conditions and actions, custom script as data, and its text values' words in strings. A trigger stays where the package files it: a Kept folder keeps filing it, and the compile writes it in place of the Kept one. One converts only when it reads back as it is, its XML and Galaxy come out as the Editor's, and everything it names is in reach (a library the map loads, a Kept element, the Blueprint's); else it stays Kept, with why, in the Editor's terms. Kept References and holds that name it keep working, by its Id and Galaxy name. Nothing in the package changes: compile_map, in place, then writes each over its Kept original under the Equivalence Check. The result is under mission in the structured output.",
353
+ description: "Writes Kept triggers and globals of a Workspace Campaign Mod's GUI trigger library into its Mod Blueprint's triggers (ADR-0011), keeping their element ids: each item's elements go into the Blueprint's triggers source (library/triggers.xml unless the Blueprint names another), as the Editor wrote them, and its name and a trigger's local variables' names into triggers.names, and each text parameter's value (Param/Value/lib_<library>_<id>) into triggers.strings, by the strings file the package has it in, from the Kept strings or the Blueprint's raw strings, which it leaves; triggers converted earlier take the values they didn't then, and a value removals names stays removed. A category of the library interface (convert_library) that files one keeps filing it. Nothing in the package changes: compile_mod then writes them and their names over the Kept originals under the Equivalence Check. The compile doesn't write their Galaxy: it leaves the Editor's. Given a Mission instead of a mod, it reads chosen Kept triggers, functions, globals, comments, Trigger Folders, preset types, records and custom script of the Mission's Map Package into its Blueprint's own trigger elements (ADR-0026): a global into the Blueprint's triggerVariables, a folder into its triggerFolders (filing what it did, Kept or converted), every other one into a file of its own in triggers/ (triggers/<name>.json, listed in the Blueprint's triggers), a GUI Body keeping the element's Ids, its name and its local variables', a trigger's flags, events, conditions and actions, a function's kind, flags, return type, parameters and actions, a preset type's values, a record's members, custom script as data, and its text values' words in strings. A trigger stays where the package files it: a Kept folder keeps filing it, and the compile writes it in place of the Kept one. One converts only when it reads back as it is, its XML and Galaxy come out as the Editor's, and everything it names is in reach (a library the map loads, a Kept element, the Blueprint's); else it stays Kept, with why, in the Editor's terms. Kept References and holds that name it keep working, by its Id and Galaxy name. Nothing in the package changes: compile_map, in place, then writes each over its Kept original under the Equivalence Check. The result is under mission in the structured output.",
349
354
  inputSchema: {
350
355
  mod: z.string().min(1).optional().describe("The mod's id, as the Workspace config's mods names it (its folder in mods/); give this or mission"),
351
356
  mission: MissionSchema.optional().describe("A Mission whose Map Package's Kept triggers are converted into its Blueprint, its folder name in the Workspace's missions folder; give this or mod"),
352
- items: z.array(z.string().min(1)).optional().describe("The triggers (and, for a mod, globals) to convert, by name or element id; every Kept one that can convert when not given"),
357
+ items: z.array(z.string().min(1)).optional().describe("The triggers (and, for a mod, globals; for a Mission, functions, globals, comments, folders, preset types, records and custom script, a comment by its element id) to convert, by name or element id; every Kept one that can convert when not given"),
353
358
  },
354
359
  outputSchema: {
355
360
  converted: z.array(z.string()).optional(),
@@ -357,8 +362,8 @@ export function registerCompileTools(server, ctx) {
357
362
  strings: z.array(z.string()).optional(),
358
363
  mission: z
359
364
  .object({
360
- converted: z.array(z.object({ name: z.string(), id: z.string(), file: z.string() })),
361
- refused: z.array(z.object({ trigger: z.string(), reason: z.string() })),
365
+ converted: z.array(z.object({ kind: z.enum(["trigger", "function", "global", "comment", "folder", "preset", "record", "custom-script"]), name: z.string(), id: z.string(), file: z.string() })),
366
+ refused: z.array(z.object({ kind: z.enum(["trigger", "function", "global", "comment", "folder", "preset", "record", "custom-script"]), element: z.string(), reason: z.string() })),
362
367
  })
363
368
  .optional(),
364
369
  },
@@ -495,7 +500,7 @@ export function registerCompileTools(server, ctx) {
495
500
  tool("test_mission", {
496
501
  title: "Test a Mission in the game",
497
502
  annotations: DESTRUCTIVE,
498
- description: "Compiles a Mission in place, into its committed Map Package (as compile_map does by default), runs the Blueprint's declared route tests (tests.routes) on the generated terrain without the game and reports each as passed or failed, then plays it in the game through the Editor's Test Document. The route tests are static: nothing is read back from the running game yet. When the machine's Host Adapter can't run Test Document, it returns step-by-step instructions for the author instead. Ask the author to close the Mission in the Editor first: rewriting a map the Editor has open can crash it, and the Editor keeps testing the copy it loaded.",
503
+ description: "Compiles a Mission in place, into its committed Map Package (as compile_map does by default), runs the Blueprint's declared route tests (tests.routes) on the generated terrain without the game and reports each as passed or failed, then plays it in the game through the Editor's Test Document, first snapshotting the game's Banks folder (when the Host Adapter names it) so bank_changes can report what the run changed. A reply starts with the banks the previous test game changed that the author hasn't answered yet. When the Blueprint names a bankFixture (a folder of .SC2Bank files in the Workspace, as a path from the Blueprint's folder), the run plays on that fixture's banks instead: they are copied into the Banks folder after the snapshot, and the author's own are put back when the game quits, even if the run fails, with nothing for the author to keep or roll back (on a host that can't tell when the game quit, bank_changes with rollbackAll puts them back once the author says it has quit); a new test is refused until they are back. The route tests are static: nothing is read back from the running game yet, and the game writes its logs only when the author quits it, so the reply reports the logs of the last Test Document run that had quit, labelled as such, against the known-error lists. When the machine's Host Adapter can't run Test Document, it returns step-by-step instructions for the author instead. Ask the author to close the Mission in the Editor first: rewriting a map the Editor has open can crash it, and the Editor keeps testing the copy it loaded.",
499
504
  inputSchema: { mission: MissionSchema, ...DECISION_INPUTS },
500
505
  outputSchema: {
501
506
  mapPath: z.string(),
@@ -505,6 +510,8 @@ export function registerCompileTools(server, ctx) {
505
510
  steps: z.array(z.string()),
506
511
  /** The Blueprint's declared route tests, walked on the generated terrain; empty when it declares none. */
507
512
  routeTests: z.array(z.object({ id: z.string(), passed: z.boolean(), message: z.string() })),
513
+ /** The GameLogs of the last Test Document run that had quit before this call: this run's own are written when the game quits. */
514
+ previousRunLogs: z.unknown().optional(),
508
515
  },
509
516
  }, async ({ mission, ...choices }) => {
510
517
  const workspace = await ctx.workspace();
@@ -514,16 +521,37 @@ export function registerCompileTools(server, ctx) {
514
521
  const open = await editorHasOpen(ctx.host, mapPath, "test_mission", "Not compiled");
515
522
  if (open)
516
523
  return ctx.fail(open.text, { mapPath, automated: [], steps: open.steps });
524
+ // The Mission's bank fixture, read before anything is compiled or the banks are touched.
525
+ let fixture;
526
+ try {
527
+ fixture = await missionBankFixture(workspace.root, blueprintPath, (await readRawBlueprint(blueprintPath)).bankFixture);
528
+ if (fixture && !(ctx.host.has("editor.testDocument") && ctx.host.has("editor.captureTour") && ctx.host.has("game.banksDir"))) {
529
+ throw new Error(`The Mission names the bank fixture ${fixture.name}, which needs this machine's Host Adapter to run Test Document through the Editor Broker and name the game's Banks folder (editor.testDocument, editor.captureTour, game.banksDir). Not compiled; nothing was played`);
530
+ }
531
+ }
532
+ catch (error) {
533
+ return ctx.fail(error instanceof Error ? error.message : String(error), { mapPath, automated: [], steps: [] });
534
+ }
535
+ // What the last test game did to the Banks folder, before this one's snapshot makes it the baseline.
536
+ const earlierBanks = (await bankReport(ctx.host)).lines;
517
537
  const started = Date.now();
518
538
  const { blueprint, warnings, placeholders } = await oneAtATime(await realPathOf(mapPath), () => compileMission(workspace, blueprintPath, mapPath, { host: ctx.host, decisions: editorDecisions(choices) }));
519
539
  // What is left of the request's time after the compile and its voice lines, for the Editor and the game.
520
540
  const seconds = Math.max(TEST_MIN_SECONDS, TEST_BUDGET_SECONDS - Math.ceil((Date.now() - started) / 1000));
521
- const handoff = await testInGame(ctx.host, mapPath, seconds);
541
+ const handoff = await testInGame(ctx.host, mapPath, seconds, fixture);
542
+ // This run's game writes its logs when the author quits it, so what can be read now is the last Test Document run that quit.
543
+ const previous = !ctx.host.has("game.logsFolder") ? undefined : await reportRunLogs({ host: ctx.host, workspaceRoot: workspace.root, missionDir: path.dirname(blueprintPath), selection: { before: new Date(started), parameters: ["EditorTest.SC2Map"], latest: true } }).catch((error) => ({
544
+ folder: "",
545
+ sessions: [],
546
+ stale: [],
547
+ note: `couldn't read the game's logs: ${error.message}`,
548
+ }));
522
549
  const voices = describePlaceholders(placeholders);
523
550
  const declared = blueprint.tests?.routes.length ?? 0;
524
551
  const kept = declared > 0 && hasKeptTerrain(blueprint);
525
552
  const routeTests = declared > 0 && !kept ? routeTestResults(buildLayoutModel(blueprint)) : [];
526
553
  const lines = [
554
+ ...(earlierBanks.length > 0 ? [...earlierBanks, ""] : []),
527
555
  `Compiled ${blueprint.title} to ${mapPath}`,
528
556
  ...warnings.map((warning) => `Warning: ${warning}`),
529
557
  ...(voices ? [voices] : []),
@@ -532,8 +560,71 @@ export function registerCompileTools(server, ctx) {
532
560
  ? [`Route tests (static, from the terrain; not read back from the game): ${routeTests.filter((test) => test.passed).length} of ${routeTests.length} passed`, ...routeTests.map((test) => ` ${test.passed ? "pass" : "FAIL"} ${test.message}`)]
533
561
  : []),
534
562
  ...describeHandoff(handoff),
563
+ ...(previous ? formatRunLogReport(previous, "Game logs of the last Test Document run that has quit (not this run's: the game writes its logs when it quits, and a Test Document's map is always EditorTest, so it may be another Mission's)") : []),
535
564
  await stageHint(blueprintPath),
536
565
  ];
537
- return ctx.reply(lines.join("\n"), { mapPath, automated: handoff.automated, steps: handoff.steps, routeTests });
566
+ return ctx.reply(lines.join("\n"), { mapPath, automated: handoff.automated, steps: handoff.steps, routeTests, ...(previous ? { previousRunLogs: previous } : {}) });
567
+ });
568
+ tool("bank_changes", {
569
+ title: "Banks a test game changed",
570
+ annotations: DESTRUCTIVE,
571
+ description: "Reports which banks the last test_mission game added, changed or removed in the game's Banks folder (the shared folder the campaign's banks live in), and for a changed bank which sections and keys changed, from a snapshot taken just before the game started. The author decides what happens to each: keep a bank as the game left it, or roll it back to the snapshot (a bank the run added is deleted). Nothing is rolled back unless the author says so, so ask them, then call again with keep and rollback (bank names as listed), or keepAll and rollbackAll. A game still running is reported so far and nothing is applied until it quits. Snapshots live in the machine's cache and only the newest few are kept. Needs a Host Adapter that names the Banks folder (game.banksDir).",
572
+ inputSchema: {
573
+ keep: z.array(z.string().min(1)).optional().describe("Banks, as listed, to leave as the game left them"),
574
+ rollback: z.array(z.string().min(1)).optional().describe("Banks, as listed, to put back as they were before the game: the snapshot's copy replaces the bank, and a bank the game added is deleted"),
575
+ keepAll: z.boolean().optional().describe("Keep every bank still waiting for an answer (a bank in rollback still goes back)"),
576
+ rollbackAll: z.boolean().optional().describe("Roll back every bank still waiting for an answer (a bank in keep stays)"),
577
+ },
578
+ outputSchema: {
579
+ changes: z.array(z.object({
580
+ bank: z.string(),
581
+ status: z.enum(["added", "changed", "removed"]),
582
+ resolution: z.enum(["kept", "rolled-back"]).optional(),
583
+ sections: z.array(z.object({ section: z.string(), status: z.string(), keys: z.array(z.object({ key: z.string(), status: z.string(), before: z.string().optional(), after: z.string().optional() })) })),
584
+ })),
585
+ },
586
+ }, async (choices) => {
587
+ if (!ctx.host.has("game.banksDir"))
588
+ return ctx.fail("This machine's Host Adapter can't name the game's Banks folder (game.banksDir), so no test game was snapshotted.", { changes: [] });
589
+ let report;
590
+ try {
591
+ report = await bankReport(ctx.host, choices);
592
+ }
593
+ catch (error) {
594
+ return ctx.fail(error instanceof Error ? error.message : String(error), { changes: [] });
595
+ }
596
+ const changes = report.run?.changes ?? [];
597
+ return ctx.reply(report.lines.length > 0 ? report.lines.join("\n") : "No test game has changed a bank that waits for an answer.", { changes });
598
+ });
599
+ tool("save_bank_fixture", {
600
+ title: "Save the game's banks as a bank fixture",
601
+ annotations: ADDITIVE,
602
+ description: "Copies the .SC2Bank files in the game's Banks folder (from the Host Adapter's game.banksDir) into a new folder `<Workspace>/bank-fixtures/<name>/`, to be named by a Mission's Blueprint as its bankFixture (a path from the Blueprint's folder, e.g. ../../bank-fixtures/<name>). It reads the Banks folder and writes nothing outside that destination. Refused while a test game's banks haven't been put back, or a test game runs, since the folder then holds a fixture's banks; refused when the destination already holds banks, unless overwrite is true. Set the campaign up in the game first (play to the state the fixture should hold), then call this.",
603
+ inputSchema: {
604
+ name: z.string().regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/, "letters, digits, dots, hyphens and underscores").describe("The fixture's folder name, e.g. after-mission-2"),
605
+ overwrite: z.boolean().optional().describe("Replace the banks of a fixture of that name that already exists"),
606
+ },
607
+ outputSchema: { fixture: z.string().optional(), banks: z.array(z.string()) },
608
+ }, async ({ name, overwrite }) => {
609
+ if (!ctx.host.has("game.banksDir"))
610
+ return ctx.fail("This machine's Host Adapter can't name the game's Banks folder (game.banksDir).", { banks: [] });
611
+ const workspace = await ctx.workspace();
612
+ const dir = path.join(workspace.root, BANK_FIXTURES_FOLDER, name);
613
+ try {
614
+ const cacheDir = hostContext(ctx.host.machine).requirePath("cacheDir");
615
+ const pending = await unrestoredFixtureRun(cacheDir);
616
+ if (pending)
617
+ return ctx.fail(`The last test game ran on the bank fixture ${pending.fixture} and the author's banks aren't back in the Banks folder yet, so it can't be saved: quit the game, then call bank_changes${ctx.host.has("game.running") ? "" : " with rollbackAll"}.`, { banks: [] });
618
+ if (ctx.host.has("game.running") && (await ctx.host.run("game.running", {}).catch(() => false)))
619
+ return ctx.fail("The game is running and may be writing banks: quit it first.", { banks: [] });
620
+ if (!overwrite && (await fixtureBanks(dir)).length > 0)
621
+ return ctx.fail(`${path.relative(workspace.root, dir)} already holds banks: pick another name, or pass overwrite.`, { banks: [] });
622
+ const banks = await saveBanksAsFixture(await ctx.host.run("game.banksDir", {}), dir);
623
+ const relative = path.relative(workspace.root, dir).split(path.sep).join("/");
624
+ return ctx.reply(`Saved ${banks.length} bank${banks.length === 1 ? "" : "s"} to ${relative}: ${banks.join(", ")}\nName it in a Mission's Blueprint: "bankFixture": "${path.relative(path.join(workspace.missionsDir, "<mission>"), dir).split(path.sep).join("/")}"`, { fixture: relative, banks });
625
+ }
626
+ catch (error) {
627
+ return ctx.fail(error instanceof Error ? error.message : String(error), { banks: [] });
628
+ }
538
629
  });
539
630
  }
@@ -44,4 +44,7 @@ export declare const TEST_MIN_SECONDS = 15;
44
44
  * Editor Broker, refused at once while a capture runs or waits (the reason says which), since it
45
45
  * can't wait one out; and no capture starts until the game it starts has quit.
46
46
  */
47
- export declare function testInGame(host: Host, mapPath: string, seconds: number): Promise<Handoff>;
47
+ export declare function testInGame(host: Host, mapPath: string, seconds: number, bankFixture?: {
48
+ readonly name: string;
49
+ readonly dir: string;
50
+ }): Promise<Handoff>;
@@ -75,7 +75,7 @@ export const TEST_MIN_SECONDS = 15;
75
75
  * Editor Broker, refused at once while a capture runs or waits (the reason says which), since it
76
76
  * can't wait one out; and no capture starts until the game it starts has quit.
77
77
  */
78
- export async function testInGame(host, mapPath, seconds) {
78
+ export async function testInGame(host, mapPath, seconds, bankFixture) {
79
79
  const components = path.join(mapPath, "ComponentList.SC2Components");
80
80
  const openStep = `Open the Map Package in the StarCraft II Editor: File > Open, then choose ${components} (an unpacked Map Package opens through that file, not its folder). If the Editor already has this map open, close it without saving and open it again, since the Editor tests the copy it loaded.`;
81
81
  const testSteps = [
@@ -88,12 +88,15 @@ export async function testInGame(host, mapPath, seconds) {
88
88
  const busy = (error) => ({ automated: [], reason: error.message, steps: ["Wait for the Editor to be free, then ask for the test again."] });
89
89
  if (host.has("editor.testDocument")) {
90
90
  try {
91
- await runEditorAction(host, "editor.testDocument", { mapPath, seconds }, { ifIdle: true });
92
- return { automated: ["Opened it in the Editor and ran Test Document: the game is starting on it."], steps: [testSteps[2]] };
91
+ await runEditorAction(host, "editor.testDocument", { mapPath, seconds, ...(bankFixture ? { bankFixture } : {}) }, { ifIdle: true });
92
+ return { automated: [`Opened it in the Editor and ran Test Document: the game is starting on it${bankFixture ? `, with the banks of the fixture ${bankFixture.name} copied in; your own banks are put back when the game quits` : ""}.`], steps: [testSteps[2]] };
93
93
  }
94
94
  catch (error) {
95
95
  if (error instanceof EditorBusyError)
96
96
  return busy(error);
97
+ // A refusal that comes with a fixture is the banks', not the Editor's: doing it by hand would play on the wrong banks.
98
+ if (bankFixture)
99
+ return { automated: [], reason: failed("run Test Document on the bank fixture", error), steps: ["Fix that, then ask for the test again."] };
97
100
  return { automated: [], reason: failed("run Test Document", error), steps: [openStep, ...testSteps] };
98
101
  }
99
102
  }
@@ -0,0 +1,11 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { type CallContext } from "../call-context.js";
3
+ /** The tools registerStylePackTools can register, the Style Pack group. */
4
+ export declare const STYLE_PACK_TOOLS: readonly ["scaffold_style_pack", "add_exemplar_map", "study_exemplar", "find_places", "capture_exemplar", "exemplar_report"];
5
+ /** The group's tools listed on every machine but refused where the Host Adapter lacks these capabilities. */
6
+ export declare const STYLE_PACK_REFUSED_WITHOUT: {
7
+ readonly capture_exemplar: readonly ["editor.captureTour"];
8
+ };
9
+ export declare function registerStylePackTools(server: McpServer, ctx: CallContext, { captureWaitMs }: {
10
+ readonly captureWaitMs: number;
11
+ }): void;