@buun_group/plotwork-mcp 0.4.0-beta.4 → 0.4.0-beta.5

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.
@@ -1,6 +1,6 @@
1
1
  # Third-party notices
2
2
 
3
- @buun_group/plotwork-mcp 0.4.0-beta.4 is licensed under the MIT licence, in the file LICENSE. The single file plotwork-mcp.mjs also contains code and data from other people. This file lists them, with the licence each is used under and the full licence text. Those licences apply to that material. The MIT licence of @buun_group/plotwork-mcp does not replace them, and it does not cover the vendor artwork described under "Trademarks and official icons".
3
+ @buun_group/plotwork-mcp 0.4.0-beta.5 is licensed under the MIT licence, in the file LICENSE. The single file plotwork-mcp.mjs also contains code and data from other people. This file lists them, with the licence each is used under and the full licence text. Those licences apply to that material. The MIT licence of @buun_group/plotwork-mcp does not replace them, and it does not cover the vendor artwork described under "Trademarks and official icons".
4
4
 
5
5
  The build writes this file from the contents of the bundle. Do not edit it.
6
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buun_group/plotwork-mcp",
3
- "version": "0.4.0-beta.4",
3
+ "version": "0.4.0-beta.5",
4
4
  "description": "No API key and no account. Plotwork MCP server for local use over stdio: read-only tools that draw, validate, outline, convert, and render twenty kinds of diagram, from flow, sequence, and database to Gantt, state, mind map, and treemap. It sends nothing unless you opt in.",
5
5
  "mcpName": "dev.plotwork/mcp",
6
6
  "license": "MIT",
package/plotwork-mcp.mjs CHANGED
@@ -65,7 +65,7 @@ var init_icon_art_folder = __esm({
65
65
  var package_default;
66
66
  var init_package = __esm({
67
67
  "package.json"() {
68
- package_default = { version: "0.4.0-beta.4" };
68
+ package_default = { version: "0.4.0-beta.5" };
69
69
  }
70
70
  });
71
71
 
@@ -454,6 +454,17 @@ var init_line_options = __esm({
454
454
  }
455
455
  });
456
456
 
457
+ // ../../packages/diagrams/src/constants/color-themes.ts
458
+ var COLOR_THEMES, DEFAULT_COLOR_THEME, COLOR_THEME_OPTION;
459
+ var init_color_themes = __esm({
460
+ "../../packages/diagrams/src/constants/color-themes.ts"() {
461
+ "use strict";
462
+ COLOR_THEMES = ["plotwork", "slate", "ocean", "forest", "sunset", "mono", "contrast"];
463
+ DEFAULT_COLOR_THEME = "plotwork";
464
+ COLOR_THEME_OPTION = "theme";
465
+ }
466
+ });
467
+
457
468
  // ../../packages/diagrams/src/constants/auto-icons.ts
458
469
  var ICON_MODES, DEFAULT_ICON_MODE, AUTO_ICON_KINDS, ICON_MODE_SPEC, PLAIN_WORD_NAMES, ROLE_ICONS, BRAND_SUFFIXES, ROLE_ICON_MAX_WORDS;
459
470
  var init_auto_icons = __esm({
@@ -689,14 +700,41 @@ var init_diagram_links = __esm({
689
700
  }
690
701
  });
691
702
 
703
+ // ../../packages/diagrams/src/constants/action-release.ts
704
+ function versionAtLeast(version2, since) {
705
+ const parts = (text3) => text3.split(".").map((part) => Number.parseInt(part, 10) || 0);
706
+ const [a, b] = [parts(version2), parts(since)];
707
+ for (let index2 = 0; index2 < 3; index2 += 1) {
708
+ const difference = (a[index2] ?? 0) - (b[index2] ?? 0);
709
+ if (difference !== 0) return difference > 0;
710
+ }
711
+ return true;
712
+ }
713
+ var ACTION_REPOSITORY, ACTION_RELEASE, PINNED_ACTION_LINE;
714
+ var init_action_release = __esm({
715
+ "../../packages/diagrams/src/constants/action-release.ts"() {
716
+ "use strict";
717
+ ACTION_REPOSITORY = "plotwork-official/plotwork-action";
718
+ ACTION_RELEASE = {
719
+ version: "1.1.0",
720
+ sha: "86ae8278fa771a422d9df60185182f14b8be4db9"
721
+ };
722
+ PINNED_ACTION_LINE = `uses: ${ACTION_REPOSITORY}@${ACTION_RELEASE.sha} # v${ACTION_RELEASE.version}`;
723
+ }
724
+ });
725
+
692
726
  // ../../packages/diagrams/src/constants/view-links.ts
727
+ function schemeFlag(release = CLI_RELEASE) {
728
+ return versionAtLeast(release.version, CLI_SCHEME_FLAG_SINCE) ? "--scheme" : "--theme";
729
+ }
693
730
  function cliCommand(release = CLI_RELEASE) {
694
731
  return `npx -y ${release.packageName}@${release.version}`;
695
732
  }
696
- var VIEW_LINKS, CLI_RELEASE;
733
+ var VIEW_LINKS, CLI_RELEASE, CLI_SCHEME_FLAG_SINCE;
697
734
  var init_view_links = __esm({
698
735
  "../../packages/diagrams/src/constants/view-links.ts"() {
699
736
  "use strict";
737
+ init_action_release();
700
738
  VIEW_LINKS = {
701
739
  /** The path of the viewer page in the portal. */
702
740
  path: "/view",
@@ -725,20 +763,7 @@ var init_view_links = __esm({
725
763
  version: "0.2.0",
726
764
  onNpm: true
727
765
  };
728
- }
729
- });
730
-
731
- // ../../packages/diagrams/src/constants/action-release.ts
732
- var ACTION_REPOSITORY, ACTION_RELEASE, PINNED_ACTION_LINE;
733
- var init_action_release = __esm({
734
- "../../packages/diagrams/src/constants/action-release.ts"() {
735
- "use strict";
736
- ACTION_REPOSITORY = "plotwork-official/plotwork-action";
737
- ACTION_RELEASE = {
738
- version: "1.1.0",
739
- sha: "86ae8278fa771a422d9df60185182f14b8be4db9"
740
- };
741
- PINNED_ACTION_LINE = `uses: ${ACTION_REPOSITORY}@${ACTION_RELEASE.sha} # v${ACTION_RELEASE.version}`;
766
+ CLI_SCHEME_FLAG_SINCE = "0.3.0";
742
767
  }
743
768
  });
744
769
 
@@ -817,7 +842,7 @@ function ciSetupSteps() {
817
842
  const cli = cliCommand();
818
843
  return [
819
844
  `1. **Look before you write.** Find the files Plotwork draws from: Terraform, OpenAPI documents, Compose files, Kubernetes manifests, SQL, Prisma or Drizzle schemas, GitHub Actions workflows and CSV data. Skip installed dependencies, build output and any file that holds secrets, such as \`.env\`. If \`${SETTINGS_FILE.names[0]}\` or \`${SETTINGS_FILE.names[1]}\` already exists, add to it instead of replacing it.`,
820
- `2. **Name the sources.** Write \`${SETTINGS_FILE.names[0]}\` at the repository root with \`"$schema": "${SETTINGS_FILE.schemaUrl}"\`, \`"defaults": { "schemes": "auto" }\`, and one entry in \`sources\` for each diagram: \`name\`, \`from\` (a path or a glob), \`format\`, and \`out\` (\`docs/diagrams/<name>.diagram\`, or a \`diagram\` fence of a Markdown page the repository already has, written \`docs/architecture.md#<name>\`). \`${cli} import-source --help\` lists the formats. Draw one diagram for each stack, service map or schema; three diagrams people read beat a dozen they do not.`,
845
+ `2. **Name the sources.** Write \`${SETTINGS_FILE.names[0]}\` at the repository root with \`"$schema": "${SETTINGS_FILE.schemaUrl}"\`, \`"defaults": { "scheme": "auto" }\`, and one entry in \`sources\` for each diagram: \`name\`, \`from\` (a path or a glob), \`format\`, and \`out\` (\`docs/diagrams/<name>.diagram\`, or a \`diagram\` fence of a Markdown page the repository already has, written \`docs/architecture.md#<name>\`). \`${cli} import-source --help\` lists the formats. Draw one diagram for each stack, service map or schema; three diagrams people read beat a dozen they do not.`,
821
846
  `3. **Draw them.** Run \`${cli} generate\`. Fix each problem it prints (a code such as S103 names the line of the settings file), then run \`${cli} generate --check\` until it passes. Read the outline of each diagram with \`${cli} outline <file>\` and check it shows what the files say.`,
822
847
  `4. **Add the check.** Write \`${CI_SETUP.workflowPath}\` as below. Keep the \`uses:\` line exactly as written: it pins the release by its commit.`,
823
848
  "",
@@ -4148,6 +4173,7 @@ var init_constants = __esm({
4148
4173
  init_node_stack();
4149
4174
  init_line_options();
4150
4175
  init_line_roles();
4176
+ init_color_themes();
4151
4177
  init_auto_icons();
4152
4178
  init_schema();
4153
4179
  init_sequence();
@@ -122532,11 +122558,12 @@ var init_palette = __esm({
122532
122558
  // ../../packages/diagrams/src/theme/themes.ts
122533
122559
  function buildToneStyle(accent, input2) {
122534
122560
  const chipFill = mix(accent, input2.surfaces.surface, input2.tint);
122561
+ const floor = input2.graphicContrast ?? GRAPHIC_CONTRAST;
122535
122562
  return {
122536
122563
  accent,
122537
122564
  chipFill,
122538
- ink: ensureContrast(accent, chipFill, GRAPHIC_CONTRAST, input2.pushToward),
122539
- outline: ensureContrast(accent, input2.surfaces.surface, GRAPHIC_CONTRAST, input2.pushToward)
122565
+ ink: ensureContrast(accent, chipFill, floor, input2.pushToward),
122566
+ outline: ensureContrast(accent, input2.surfaces.surface, floor, input2.pushToward)
122540
122567
  };
122541
122568
  }
122542
122569
  function buildTheme(input2) {
@@ -122558,7 +122585,7 @@ var init_themes = __esm({
122558
122585
  init_palette();
122559
122586
  THEME_NAMES = ["light", "dark"];
122560
122587
  PICTURE_SCHEMES = [...THEME_NAMES, "auto"];
122561
- PICTURE_FILE_SCHEMES = ["light-and-dark", "auto"];
122588
+ PICTURE_FILE_SCHEMES = ["auto", "light", "dark", "light-and-dark"];
122562
122589
  GRAPHIC_CONTRAST = 3;
122563
122590
  SCHEME_INPUTS = {
122564
122591
  light: { name: "light", surfaces: LIGHT_SURFACES, tones: LIGHT_TONES, tint: 0.12, pushToward: "#000000" },
@@ -122570,6 +122597,98 @@ var init_themes = __esm({
122570
122597
  }
122571
122598
  });
122572
122599
 
122600
+ // ../../packages/diagrams/src/theme/palettes.ts
122601
+ function paletteInput(colorTheme, scheme) {
122602
+ const base = SCHEME_INPUTS[scheme];
122603
+ if (colorTheme === "plotwork") return base;
122604
+ const palette = PALETTES[colorTheme][scheme];
122605
+ const input2 = { ...base, surfaces: palette.surfaces, tones: palette.tones, tint: palette.tint ?? base.tint };
122606
+ return palette.graphicContrast === void 0 ? input2 : { ...input2, graphicContrast: palette.graphicContrast };
122607
+ }
122608
+ function paletteTheme(colorTheme, scheme) {
122609
+ if (colorTheme === "plotwork") return getTheme(scheme);
122610
+ const key = `${colorTheme}|${scheme}`;
122611
+ const built = BUILT.get(key);
122612
+ if (built !== void 0) return built;
122613
+ const theme = buildTheme(paletteInput(colorTheme, scheme));
122614
+ BUILT.set(key, theme);
122615
+ return theme;
122616
+ }
122617
+ var PALETTES, BUILT;
122618
+ var init_palettes = __esm({
122619
+ "../../packages/diagrams/src/theme/palettes.ts"() {
122620
+ "use strict";
122621
+ init_themes();
122622
+ PALETTES = {
122623
+ slate: {
122624
+ light: {
122625
+ surfaces: { surface: "#ffffff", surfaceGroup: "#f4f6f9", border: "#d5dbe3", borderGroup: "#cad1db", ink: "#0f172a", inkSecondary: "#475569", edge: "#8590a0" },
122626
+ tones: { neutral: "#475569", blue: "#2f6fd0", violet: "#5b4bc4", aqua: "#0f9488", orange: "#d4622e", green: "#1a7f37", amber: "#c98a00", red: "#d03a3a" }
122627
+ },
122628
+ dark: {
122629
+ surfaces: { surface: "#1c2230", surfaceGroup: "#131824", border: "#343d4e", borderGroup: "#3e4859", ink: "#eef2f7", inkSecondary: "#b4bfcd", edge: "#7d899b" },
122630
+ tones: { neutral: "#b4bfcd", blue: "#4b8ff0", violet: "#998cf0", aqua: "#1fa99a", orange: "#e2774a", green: "#2e9e4f", amber: "#cf9a17", red: "#e86a6a" }
122631
+ }
122632
+ },
122633
+ ocean: {
122634
+ light: {
122635
+ surfaces: { surface: "#ffffff", surfaceGroup: "#eff6f8", border: "#cfe0e6", borderGroup: "#c1d5dc", ink: "#0b2533", inkSecondary: "#3e5a68", edge: "#7b97a4" },
122636
+ tones: { neutral: "#3e5a68", blue: "#1666b0", violet: "#4b4fb8", aqua: "#0b8f8c", orange: "#d0673a", green: "#18804a", amber: "#c48a0a", red: "#cc3d4a" }
122637
+ },
122638
+ dark: {
122639
+ surfaces: { surface: "#12232c", surfaceGroup: "#0b1920", border: "#244050", borderGroup: "#2c4b5a", ink: "#e8f3f6", inkSecondary: "#a9c3cc", edge: "#6e8e9b" },
122640
+ tones: { neutral: "#a9c3cc", blue: "#3d8fd9", violet: "#8b8ff0", aqua: "#25aaa6", orange: "#e0835a", green: "#2f9e62", amber: "#d29d2a", red: "#e6707a" }
122641
+ }
122642
+ },
122643
+ forest: {
122644
+ light: {
122645
+ surfaces: { surface: "#ffffff", surfaceGroup: "#f2f5f0", border: "#d5ddd1", borderGroup: "#c9d3c4", ink: "#17211a", inkSecondary: "#4a5a4c", edge: "#879585" },
122646
+ tones: { neutral: "#4a5a4c", blue: "#2d6a8f", violet: "#6b4a8a", aqua: "#24877a", orange: "#bf5d2c", green: "#2f7d32", amber: "#b8860b", red: "#b8423a" }
122647
+ },
122648
+ dark: {
122649
+ surfaces: { surface: "#1a201b", surfaceGroup: "#121713", border: "#343d35", borderGroup: "#3e4840", ink: "#eef2ec", inkSecondary: "#b9c4b6", edge: "#7f8c7d" },
122650
+ tones: { neutral: "#b9c4b6", blue: "#4f94bd", violet: "#a585c7", aqua: "#36a593", orange: "#d47c4c", green: "#45a049", amber: "#cfa02a", red: "#de7168" }
122651
+ }
122652
+ },
122653
+ sunset: {
122654
+ light: {
122655
+ surfaces: { surface: "#ffffff", surfaceGroup: "#fbf5f1", border: "#ebdcd2", borderGroup: "#e2cfc3", ink: "#2a1a17", inkSecondary: "#6b4f47", edge: "#a58a7f" },
122656
+ tones: { neutral: "#6b4f47", blue: "#3f5fb0", violet: "#9b3f8a", aqua: "#1f8a8a", orange: "#e0603a", green: "#3d8a3a", amber: "#d98e04", red: "#c9303e" }
122657
+ },
122658
+ dark: {
122659
+ surfaces: { surface: "#261c1a", surfaceGroup: "#1c1413", border: "#45332f", borderGroup: "#503c38", ink: "#f8eee9", inkSecondary: "#d4bcb3", edge: "#9a8077" },
122660
+ tones: { neutral: "#d4bcb3", blue: "#6b8be0", violet: "#d276bf", aqua: "#30a8a5", orange: "#ec7d58", green: "#55a650", amber: "#e3a43a", red: "#ec6670" }
122661
+ }
122662
+ },
122663
+ mono: {
122664
+ light: {
122665
+ surfaces: { surface: "#ffffff", surfaceGroup: "#f5f5f5", border: "#d9d9d9", borderGroup: "#cecece", ink: "#111111", inkSecondary: "#505050", edge: "#8c8c8c" },
122666
+ tones: { neutral: "#505050", blue: "#52667d", violet: "#655b80", aqua: "#4c7570", orange: "#8a6450", green: "#3f7a45", amber: "#9a7a2a", red: "#b04545" }
122667
+ },
122668
+ dark: {
122669
+ surfaces: { surface: "#1e1e1e", surfaceGroup: "#161616", border: "#383838", borderGroup: "#424242", ink: "#f2f2f2", inkSecondary: "#bdbdbd", edge: "#8a8a8a" },
122670
+ tones: { neutral: "#bdbdbd", blue: "#8aa0b8", violet: "#a49bc0", aqua: "#86aaa4", orange: "#c09a85", green: "#6fae76", amber: "#c9a95a", red: "#e07a7a" }
122671
+ }
122672
+ },
122673
+ contrast: {
122674
+ light: {
122675
+ surfaces: { surface: "#ffffff", surfaceGroup: "#f2f2f2", border: "#6b6b6b", borderGroup: "#595959", ink: "#000000", inkSecondary: "#2e2e2e", edge: "#4d4d4d" },
122676
+ tones: { neutral: "#2e2e2e", blue: "#0050b3", violet: "#4b1fa8", aqua: "#006b5a", orange: "#b03a00", green: "#006400", amber: "#8a5a00", red: "#b00020" },
122677
+ tint: 0.1,
122678
+ graphicContrast: 4.5
122679
+ },
122680
+ dark: {
122681
+ surfaces: { surface: "#0a0a0a", surfaceGroup: "#000000", border: "#a3a3a3", borderGroup: "#bdbdbd", ink: "#ffffff", inkSecondary: "#e0e0e0", edge: "#c2c2c2" },
122682
+ tones: { neutral: "#e0e0e0", blue: "#6cb4ff", violet: "#c4a5ff", aqua: "#3fe0c5", orange: "#ffa463", green: "#6fe07a", amber: "#ffd04d", red: "#ff7a85" },
122683
+ tint: 0.22,
122684
+ graphicContrast: 4.5
122685
+ }
122686
+ }
122687
+ };
122688
+ BUILT = /* @__PURE__ */ new Map();
122689
+ }
122690
+ });
122691
+
122573
122692
  // ../../packages/diagrams/src/theme/brand.ts
122574
122693
  function normalizeHex(value) {
122575
122694
  if (typeof value !== "string") return null;
@@ -122662,13 +122781,14 @@ function brandTheme(scheme, brand) {
122662
122781
  }
122663
122782
  });
122664
122783
  }
122665
- function themeFor(scheme, brand) {
122666
- if (brand === void 0 || brand === null) return getTheme(scheme);
122784
+ function themeFor(scheme, brand, colorTheme = DEFAULT_COLOR_THEME) {
122785
+ if (brand === void 0 || brand === null) return paletteTheme(colorTheme, scheme);
122667
122786
  const key = `${scheme}|${brand.primary}|${brand.secondary ?? ""}|${brand.accent ?? ""}`;
122668
122787
  const cached3 = CACHE.get(key);
122669
122788
  if (cached3 !== void 0) return cached3;
122670
122789
  const checked2 = checkBrand(brand);
122671
- const theme = checked2.brand === null ? getTheme(scheme) : brandTheme(scheme, checked2.brand);
122790
+ if (checked2.brand === null) return paletteTheme(colorTheme, scheme);
122791
+ const theme = brandTheme(scheme, checked2.brand);
122672
122792
  if (CACHE.size >= CACHE_LIMIT) CACHE.delete(CACHE.keys().next().value);
122673
122793
  CACHE.set(key, theme);
122674
122794
  return theme;
@@ -122677,7 +122797,9 @@ var BRAND_ROLES, HUE_STEP, TONE_OF_ROLE, STATUS_HUES, STATUS_HUE_DISTANCE, STATU
122677
122797
  var init_brand = __esm({
122678
122798
  "../../packages/diagrams/src/theme/brand.ts"() {
122679
122799
  "use strict";
122800
+ init_constants();
122680
122801
  init_color();
122802
+ init_palettes();
122681
122803
  init_themes();
122682
122804
  BRAND_ROLES = ["primary", "secondary", "accent"];
122683
122805
  HUE_STEP = { secondary: 40, accent: -40 };
@@ -122707,6 +122829,7 @@ var init_theme = __esm({
122707
122829
  init_group_colors();
122708
122830
  init_vendor_tile();
122709
122831
  init_themes();
122832
+ init_palettes();
122710
122833
  init_brand();
122711
122834
  }
122712
122835
  });
@@ -160077,7 +160200,8 @@ function buildVocabulary() {
160077
160200
  arrows: ARROW_TOKENS.map((token) => ({ token, line: ARROW_SPECS[token].line, heads: ARROW_SPECS[token].heads, meaning: ARROW_SPECS[token].meaning })),
160078
160201
  blockTypes: [...SEQUENCE_BLOCK_TYPES],
160079
160202
  columnFlags: [...COLUMN_FLAGS],
160080
- themes: [...THEME_NAMES],
160203
+ schemes: [...THEME_NAMES],
160204
+ themes: [...COLOR_THEMES],
160081
160205
  iconSets: [...ICON_SETS],
160082
160206
  iconCount: listIconRefs().length,
160083
160207
  iconProviders: CLOUD_SETS.map((set2) => ({
@@ -160205,6 +160329,7 @@ var init_build_vocabulary = __esm({
160205
160329
  examples: "own",
160206
160330
  tones: "every",
160207
160331
  directions: "every",
160332
+ schemes: "every",
160208
160333
  themes: "every",
160209
160334
  iconSets: "every",
160210
160335
  iconCount: "every",
@@ -160261,6 +160386,54 @@ var init_prose = __esm({
160261
160386
  }
160262
160387
  });
160263
160388
 
160389
+ // ../../packages/diagrams/src/parse/color-theme.ts
160390
+ function themeHint(value) {
160391
+ if (PICTURE_SCHEMES.includes(value)) {
160392
+ return `${value} is a scheme, not a colour theme: light, dark, or auto is chosen where the picture is drawn (the scheme argument of a tool, --scheme, or the scheme setting). Write theme= with one of: ${COLOR_THEMES.join(", ")}.`;
160393
+ }
160394
+ const close2 = suggest(value, COLOR_THEMES, 3);
160395
+ return `${close2 === null ? "" : `Did you mean "${close2}"? `}The colour themes are: ${COLOR_THEMES.join(", ")}.`;
160396
+ }
160397
+ function readColorTheme(header, report3) {
160398
+ const kept2 = [];
160399
+ let colorTheme = null;
160400
+ let seen = false;
160401
+ const tokens = header.tokens;
160402
+ for (let index2 = 0; index2 < tokens.length; index2 += 1) {
160403
+ const token = tokens[index2];
160404
+ const isOption = index2 > 0 && token.kind === "word" && token.text === COLOR_THEME_OPTION && tokens[index2 + 1]?.kind === "equals";
160405
+ if (!isOption) {
160406
+ kept2.push(token);
160407
+ continue;
160408
+ }
160409
+ const value = tokens[index2 + 2];
160410
+ if (value === void 0 || value.kind !== "word" && value.kind !== "string") {
160411
+ report3.push(errorAt(DIAGNOSTIC_CODES.badOptionValue, 'Option "theme" needs a value', token, `Write theme=${DEFAULT_COLOR_THEME} or another colour theme: ${COLOR_THEMES.join(", ")}.`));
160412
+ index2 += 1;
160413
+ continue;
160414
+ }
160415
+ index2 += 2;
160416
+ if (seen) {
160417
+ report3.push(errorAt(DIAGNOSTIC_CODES.badOptionValue, "The header names a colour theme twice", token, "Keep one theme= on the header."));
160418
+ continue;
160419
+ }
160420
+ seen = true;
160421
+ const known3 = COLOR_THEMES.find((name2) => name2 === value.text);
160422
+ if (known3 === void 0) report3.push(errorAt(DIAGNOSTIC_CODES.badOptionValue, `Unknown colour theme "${value.text}"`, value, themeHint(value.text)));
160423
+ else colorTheme = known3;
160424
+ }
160425
+ return { header: kept2.length === tokens.length ? header : { ...header, tokens: kept2 }, colorTheme };
160426
+ }
160427
+ var init_color_theme = __esm({
160428
+ "../../packages/diagrams/src/parse/color-theme.ts"() {
160429
+ "use strict";
160430
+ init_constants();
160431
+ init_core();
160432
+ init_theme();
160433
+ init_suggest();
160434
+ }
160435
+ });
160436
+
160264
160437
  // ../../packages/diagrams/src/parse/parse-diagram.ts
160265
160438
  function parseDiagram(source) {
160266
160439
  const lexed = lex(source);
@@ -160285,7 +160458,9 @@ function parseDiagram(source) {
160285
160458
  return err(report3);
160286
160459
  }
160287
160460
  const definition = kindModule(kind);
160288
- const diagram = definition.parse(lexed.lines, report3);
160461
+ const themed = readColorTheme(lexed.lines[0], report3);
160462
+ const parsed = definition.parse([themed.header, ...lexed.lines.slice(1)], report3);
160463
+ const diagram = themed.colorTheme === null || themed.colorTheme === DEFAULT_COLOR_THEME ? parsed : { ...parsed, meta: { ...parsed.meta, colorTheme: themed.colorTheme } };
160289
160464
  if (!report3.some((diagnostic) => diagnostic.severity === "error")) report3.push(...definition.checkParsed?.(diagram, header) ?? []);
160290
160465
  return report3.some((diagnostic) => diagnostic.severity === "error") ? err(report3) : ok(diagram);
160291
160466
  }
@@ -160296,6 +160471,7 @@ var init_parse_diagram = __esm({
160296
160471
  init_core();
160297
160472
  init_prose();
160298
160473
  init_registry2();
160474
+ init_color_theme();
160299
160475
  init_lexer();
160300
160476
  init_suggest();
160301
160477
  }
@@ -160356,7 +160532,7 @@ function readPicture(svg) {
160356
160532
  summary: summary === void 0 ? null : unescapeXml(summary),
160357
160533
  outline: description === null ? [] : description.split("\n").filter((line3) => line3 !== ""),
160358
160534
  labels: [...new Set(labels2)].slice(0, MAX_LABELS),
160359
- theme: attributes2.get("data-theme") ?? null,
160535
+ scheme: attributes2.get("data-theme") ?? null,
160360
160536
  size: width === null || height === null ? null : { width, height }
160361
160537
  };
160362
160538
  }
@@ -160516,7 +160692,7 @@ function withoutSource(status, message2, next, from, svg) {
160516
160692
  picture: facts === null ? null : {
160517
160693
  title: facts.title,
160518
160694
  summary: facts.summary,
160519
- theme: facts.theme,
160695
+ scheme: facts.scheme,
160520
160696
  size: facts.size === null ? null : { width: Math.round(facts.size.width), height: Math.round(facts.size.height) },
160521
160697
  outline: [...facts.outline],
160522
160698
  labels: [...facts.labels]
@@ -160556,7 +160732,7 @@ async function readDiagram(input2, deps = {}) {
160556
160732
  picture: {
160557
160733
  title: facts?.title ?? null,
160558
160734
  summary: facts?.summary ?? null,
160559
- theme: facts?.theme ?? null,
160735
+ scheme: facts?.scheme ?? null,
160560
160736
  size: facts?.size === void 0 || facts.size === null ? null : { width: Math.round(facts.size.width), height: Math.round(facts.size.height) },
160561
160737
  outline: [],
160562
160738
  labels: []
@@ -161278,10 +161454,10 @@ function iconsOf(diagram) {
161278
161454
  }
161279
161455
  async function paintScheme(diagram, scheme, options3) {
161280
161456
  const document2 = { idPrefix: options3.idPrefix ?? "dg", source: options3.source ?? null };
161281
- return moduleOf(diagram).render(diagram, themeFor(scheme, options3.brand), document2);
161457
+ return moduleOf(diagram).render(diagram, themeFor(scheme, options3.brand, options3.theme ?? diagram.meta.colorTheme), document2);
161282
161458
  }
161283
161459
  async function paintAsked(diagram, options3) {
161284
- const scheme = options3.theme ?? "light";
161460
+ const scheme = options3.scheme ?? "light";
161285
161461
  if (scheme !== "auto") return paintScheme(diagram, scheme, options3);
161286
161462
  const [light, dark] = await Promise.all([paintScheme(diagram, "light", options3), paintScheme(diagram, "dark", options3)]);
161287
161463
  const merged = mergeSchemes(light.svg, dark.svg, options3.idPrefix ?? "dg");
@@ -161396,8 +161572,8 @@ async function renderPairDetailed(source, idPrefix, brand = null) {
161396
161572
  const parsed = parseDiagram(source);
161397
161573
  if (!parsed.ok) return { outcome: { diagnostics: parsed.error }, kind: null, warnings: [] };
161398
161574
  const [light, dark] = await Promise.all([
161399
- renderDiagramDetailed(parsed.value, { theme: "light", idPrefix, source, brand }),
161400
- renderDiagramDetailed(parsed.value, { theme: "dark", idPrefix, source, brand })
161575
+ renderDiagramDetailed(parsed.value, { scheme: "light", idPrefix, source, brand }),
161576
+ renderDiagramDetailed(parsed.value, { scheme: "dark", idPrefix, source, brand })
161401
161577
  ]);
161402
161578
  return {
161403
161579
  outcome: {
@@ -161441,12 +161617,13 @@ async function renderDiagramSource(input2, brand = null) {
161441
161617
  const parsed = parseDiagram(input2.source);
161442
161618
  if (!parsed.ok) return err(parsed.error);
161443
161619
  const { svg, size, overlayCovers, missingIcons } = await renderDiagramDetailed(parsed.value, {
161444
- theme: input2.theme,
161620
+ scheme: input2.scheme,
161621
+ ...input2.theme === void 0 ? {} : { theme: input2.theme },
161445
161622
  brand,
161446
161623
  ...input2.idPrefix === void 0 ? {} : { idPrefix: input2.idPrefix },
161447
161624
  ...input2.embedSource ? { source: input2.source } : {}
161448
161625
  });
161449
- return ok({ svg, theme: input2.theme, size, warnings: [...unknownIconWarnings(input2.source), ...secretWarnings(input2.source), ...lintDiagram(parsed.value, size, overlayCovers), ...iconArtWarnings(missingIcons, input2.source)].map(diagnosticToDto) });
161626
+ return ok({ svg, scheme: input2.scheme, size, warnings: [...unknownIconWarnings(input2.source), ...secretWarnings(input2.source), ...lintDiagram(parsed.value, size, overlayCovers), ...iconArtWarnings(missingIcons, input2.source)].map(diagnosticToDto) });
161450
161627
  }
161451
161628
  var init_render_diagram_svg = __esm({
161452
161629
  "../../packages/diagrams/src/services/render-diagram-svg.ts"() {
@@ -161962,7 +162139,8 @@ function hashBlock(source, pair2, schemes) {
161962
162139
  return createHash("sha256").update(`${BLOCK_FORMAT_VERSION}
161963
162140
  ${source}
161964
162141
  ${pair2.light}
161965
- ${pair2.dark}${schemes === "auto" ? "\nauto" : ""}`).digest("hex").slice(0, 12);
162142
+ ${pair2.dark}${schemes === "light-and-dark" ? "" : `
162143
+ ${schemes}`}`).digest("hex").slice(0, 12);
161966
162144
  }
161967
162145
  function slugify2(text3) {
161968
162146
  const slug = text3.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
@@ -162005,8 +162183,9 @@ async function syncMarkdown(markdown, stem2, hooks) {
162005
162183
  continue;
162006
162184
  }
162007
162185
  const { pair: pair2 } = outcome;
162008
- const merged = hooks.schemes === "light-and-dark" ? null : mergeSchemes(pair2.light, pair2.dark, id);
162009
- const hash2 = hashBlock(fence.source, pair2, merged === null ? "light-and-dark" : "auto");
162186
+ const scheme = hooks.scheme ?? "auto";
162187
+ const merged = scheme === "light" ? pair2.light : scheme === "dark" ? pair2.dark : scheme === "light-and-dark" ? null : mergeSchemes(pair2.light, pair2.dark, id);
162188
+ const hash2 = hashBlock(fence.source, pair2, merged === null ? "light-and-dark" : scheme);
162010
162189
  const isFresh = place2.block !== null && readBlockHash(lines[place2.block.start] ?? "") === hash2;
162011
162190
  if (isFresh && !needsWrap) {
162012
162191
  unchangedCount += 1;
@@ -162128,7 +162307,7 @@ var init_apply_defaults = __esm({
162128
162307
  init_core();
162129
162308
  init_lexer();
162130
162309
  init_parse_diagram();
162131
- SHARED_OPTIONS = ["icons", "legend", "direction", "animate", "numbered"];
162310
+ SHARED_OPTIONS = ["icons", "legend", "direction", "animate", "numbered", "theme"];
162132
162311
  }
162133
162312
  });
162134
162313
 
@@ -162336,7 +162515,7 @@ async function runSync(document2, settings, ops, cache, limit) {
162336
162515
  const result = await syncMarkdown(document2, settings.stem, {
162337
162516
  render,
162338
162517
  assetDir: settings.assetDir,
162339
- ...settings.defaults?.schemes === void 0 ? {} : { schemes: settings.defaults.schemes },
162518
+ ...settings.defaults?.scheme === void 0 ? {} : { scheme: settings.defaults.scheme },
162340
162519
  ...settings.prefix === void 0 ? {} : { idPrefix: settings.prefix }
162341
162520
  });
162342
162521
  return { result, calls };
@@ -163241,7 +163420,7 @@ function qualityOf(diagram, svg) {
163241
163420
  return { score, grade, measures: { ...measured.measures, ...own2.measures }, hints, line: lineOf(score, grade, hints) };
163242
163421
  }
163243
163422
  async function assessQuality(diagram) {
163244
- const rendered = await renderDiagramDetailed(diagram, { theme: "light", idPrefix: "q" });
163423
+ const rendered = await renderDiagramDetailed(diagram, { scheme: "light", idPrefix: "q" });
163245
163424
  return qualityOf(diagram, rendered.svg);
163246
163425
  }
163247
163426
  var QUALITY_GRADES, MAX_HINTS, HINT_PENALTY;
@@ -178711,11 +178890,12 @@ var init_stdio = __esm({
178711
178890
  });
178712
178891
 
178713
178892
  // ../../packages/diagrams/src/schemas/common.ts
178714
- var DIAGNOSTIC_CODE_VALUES, DiagnosticSchema, SizeSchema, ErrorResponseSchema;
178893
+ var DIAGNOSTIC_CODE_VALUES, DiagnosticSchema, SizeSchema, ErrorResponseSchema, ColorThemeArgSchema;
178715
178894
  var init_common = __esm({
178716
178895
  "../../packages/diagrams/src/schemas/common.ts"() {
178717
178896
  "use strict";
178718
178897
  init_zod();
178898
+ init_constants();
178719
178899
  init_core();
178720
178900
  DIAGNOSTIC_CODE_VALUES = Object.values(DIAGNOSTIC_CODES);
178721
178901
  DiagnosticSchema = external_exports.object({
@@ -178738,6 +178918,9 @@ var init_common = __esm({
178738
178918
  details: external_exports.unknown().optional().describe("Validation issues or diagnostics, JSON-safe."),
178739
178919
  requestId: external_exports.string().optional().describe("Trace id for correlating with logs.")
178740
178920
  }).meta({ id: "ErrorResponse", description: "Standard error envelope used by every failing response." });
178921
+ ColorThemeArgSchema = external_exports.enum(COLOR_THEMES, {
178922
+ error: (issue3) => typeof issue3.input === "string" && ["light", "dark", "auto", "both"].includes(issue3.input) ? `${issue3.input} is a color scheme: send it as scheme or schemes. theme is the colour theme: ${COLOR_THEMES.join(", ")}.` : void 0
178923
+ }).optional().describe("Colour theme for this drawing, over the header's theme=.");
178741
178924
  }
178742
178925
  });
178743
178926
 
@@ -178828,6 +179011,13 @@ var init_schema3 = __esm({
178828
179011
  });
178829
179012
 
178830
179013
  // ../../packages/diagrams/src/settings/sources.ts
179014
+ function movedKeysError(moved3) {
179015
+ return (issue3) => {
179016
+ if (issue3.code !== "unrecognized_keys") return void 0;
179017
+ const notes = (issue3.keys ?? []).flatMap((key) => moved3[key] === void 0 ? [] : [moved3[key]]);
179018
+ return notes.length === 0 ? void 0 : notes.join("; ");
179019
+ };
179020
+ }
178831
179021
  var repositoryPath, pattern2, outPath, SourceOptionsSchema, SourcePublishSchema, SourceSchema;
178832
179022
  var init_sources2 = __esm({
178833
179023
  "../../packages/diagrams/src/settings/sources.ts"() {
@@ -178856,10 +179046,10 @@ var init_sources2 = __esm({
178856
179046
  organization: external_exports.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "Write the organisation's slug or id, such as acme").optional().describe("Publish into this organisation's library. Left out, with no alias, the organisation of brand.organization is used."),
178857
179047
  folder: external_exports.string().min(1).max(300).optional().describe("The folder of the library to file it in, such as Platform/Infra."),
178858
179048
  name: external_exports.string().min(1).max(120).optional().describe("Its name in the library; the diagram's title when left out."),
178859
- theme: external_exports.enum(PICTURE_SCHEMES).optional().describe("light, dark, or auto; defaults.theme, then light, when left out."),
179049
+ scheme: external_exports.enum(PICTURE_SCHEMES).optional().describe("light, dark, or auto; the picture of defaults.scheme, then light, when left out."),
178860
179050
  embedSource: external_exports.boolean().optional().describe("Write the diagram source into the hosted picture. Left out, it is not."),
178861
179051
  required: external_exports.boolean().optional().describe("Fail the run when this source cannot be published, such as with no key. Left out, a skipped publish is a notice.")
178862
- }).meta({ id: "SourcePublish", description: "Where the GitHub Action publishes a generated diagram when publish is on." });
179052
+ }, { error: movedKeysError({ theme: "publish.theme is now publish.scheme (light, dark, or auto); theme= names a colour theme in the diagram's header" }) }).meta({ id: "SourcePublish", description: "Where the GitHub Action publishes a generated diagram when publish is on." });
178863
179053
  SourceSchema = external_exports.strictObject({
178864
179054
  name: external_exports.string().regex(/^[a-z0-9][a-z0-9._-]{0,63}$/, "A name is lower-case letters, digits, dots, hyphens and underscores, such as infra").optional().describe("A short name for --source and the summary; the out path when left out."),
178865
179055
  from: external_exports.union([pattern2, external_exports.array(pattern2).min(1).max(GENERATE.maxPatterns)]).describe("The files to read: one pattern or a list."),
@@ -178870,14 +179060,18 @@ var init_sources2 = __esm({
178870
179060
  options: SourceOptionsSchema.optional(),
178871
179061
  overrides: repositoryPath.refine((path) => path.endsWith(".json"), { message: "An overrides file is a .json file" }).optional().describe("The overrides file, applied after every import. Left out: the out path with .overrides.json in place of .diagram, or <file>.<fence id>.overrides.json beside a Markdown file."),
178872
179062
  pictures: external_exports.boolean().optional().describe("For a .diagram out: also write its light and dark SVG beside it. On when left out."),
178873
- schemes: external_exports.enum(PICTURE_FILE_SCHEMES).optional().describe("The pictures this source writes: auto writes one <name>.svg that follows the reader's light or dark setting; light-and-dark writes <name>.svg and <name>.dark.svg. defaults.schemes, then auto, when left out."),
179063
+ scheme: external_exports.enum(PICTURE_FILE_SCHEMES).optional().describe("The pictures this source writes: auto writes one <name>.svg that follows the reader's light or dark setting; light or dark writes one <name>.svg in that scheme; light-and-dark writes <name>.svg and <name>.dark.svg. defaults.scheme, then auto, when left out."),
178874
179064
  publish: SourcePublishSchema.optional()
178875
- }).meta({ id: "Source", description: "One diagram generated from files of the repository and kept in step with them." });
179065
+ }, { error: movedKeysError({ schemes: "A source's schemes is now scheme, which takes auto, light, dark, or light-and-dark" }) }).meta({ id: "Source", description: "One diagram generated from files of the repository and kept in step with them." });
178876
179066
  }
178877
179067
  });
178878
179068
 
178879
179069
  // ../../packages/diagrams/src/settings/schema.ts
178880
- var optionKey, optionValue, DefaultsSchema, SettingsBrandSchema, SettingsSchema;
179070
+ function themeError(issue3) {
179071
+ const value = typeof issue3.input === "string" ? issue3.input : "";
179072
+ return PICTURE_SCHEMES.includes(value) ? `"${value}" is a scheme, not a colour theme (${COLOR_THEMES.join(", ")}); write "scheme": "${value}" for the ${value} picture` : void 0;
179073
+ }
179074
+ var optionKey, optionValue, MOVED_DEFAULTS, DefaultsSchema, SettingsBrandSchema, SettingsSchema;
178881
179075
  var init_schema4 = __esm({
178882
179076
  "../../packages/diagrams/src/settings/schema.ts"() {
178883
179077
  "use strict";
@@ -178888,17 +179082,21 @@ var init_schema4 = __esm({
178888
179082
  init_sources2();
178889
179083
  optionKey = external_exports.string().regex(/^[a-z][a-z0-9-]*$/, "Write the header option as the header writes it, such as direction or layout").refine((key) => key !== "title", { message: "A title is the diagram's own; it has no default" });
178890
179084
  optionValue = external_exports.union([external_exports.string().min(1).max(SETTINGS_FILE.maxValueLength), external_exports.number(), external_exports.boolean()]);
179085
+ MOVED_DEFAULTS = {
179086
+ schemes: "defaults.schemes is now defaults.scheme, which takes auto, light, dark, or light-and-dark",
179087
+ colorTheme: "defaults.colorTheme is now defaults.theme"
179088
+ };
178891
179089
  DefaultsSchema = external_exports.strictObject({
178892
179090
  icons: external_exports.enum(ICON_MODES).optional().describe("icons= on every header that takes it: auto gives an item the icon its label names, off keeps items plain."),
178893
179091
  legend: external_exports.enum(SWITCH_VALUES).optional().describe("legend= on every header that takes it: off draws no legend of line roles."),
178894
179092
  direction: external_exports.enum(DIRECTIONS).optional().describe("direction= on every header that takes this value."),
178895
179093
  animate: external_exports.enum(SWITCH_VALUES).optional().describe("animate= on every header that takes it: on moves dashes along every line."),
178896
179094
  numbered: external_exports.enum(SWITCH_VALUES).optional().describe("numbered= on every header that takes it: on numbers every line in the order written."),
178897
- theme: external_exports.enum(PICTURE_SCHEMES).optional().describe("The color scheme the command line and the GitHub Action draw a single picture in."),
179095
+ theme: external_exports.enum(COLOR_THEMES, { error: themeError }).optional().describe("theme= on every header: the colour theme a diagram is drawn in when its header names none, such as ocean or contrast. plotwork is the default."),
179096
+ scheme: external_exports.enum(PICTURE_FILE_SCHEMES).optional().describe("The pictures a diagram gets. auto writes one <name>.svg that holds both schemes and follows the reader's light or dark setting, so GitHub shows it right in either theme. light or dark writes one picture in that scheme. light-and-dark writes <name>.svg and <name>.dark.svg from sync and generate, which a <picture> element shows by GitHub's own theme setting, and the light picture from render and publish. Left out: auto from sync and generate, light from render and publish."),
178898
179097
  embedSource: external_exports.boolean().optional().describe("Write the source into every SVG the command line, the GitHub Action, and the drawing tools save."),
178899
- schemes: external_exports.enum(PICTURE_FILE_SCHEMES).optional().describe("The pictures generate and sync write. auto, the default, writes one <name>.svg that holds both schemes and follows the reader's light or dark setting, so GitHub shows it right in either theme. light-and-dark writes <name>.svg and <name>.dark.svg, which a <picture> element shows by GitHub's own theme setting."),
178900
179098
  kinds: external_exports.partialRecord(external_exports.enum(DIAGRAM_KINDS), external_exports.record(optionKey, optionValue)).optional().describe('Header options for one kind, such as { "mindmap": { "layout": "radial" } }. A value the kind refuses is left out with warning S200.')
178901
- }).meta({ id: "SettingsDefaults", description: "Header options a diagram gets when its header does not set them." });
179099
+ }, { error: movedKeysError(MOVED_DEFAULTS) }).meta({ id: "SettingsDefaults", description: "Header options a diagram gets when its header does not set them." });
178902
179100
  SettingsBrandSchema = external_exports.strictObject({
178903
179101
  organization: external_exports.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "Write the organisation's slug or id, such as acme").describe("The organisation's slug or id. Hosted calls by a member use its brand while its owner's plan includes brand themes.")
178904
179102
  }).meta({ id: "SettingsBrand", description: "The organisation whose saved brand hosted calls use." });
@@ -178983,14 +179181,15 @@ var init_diagrams = __esm({
178983
179181
  }).meta({ id: "ValidateResponse", description: "Result of checking diagram source." });
178984
179182
  RenderInputSchema = external_exports.object({
178985
179183
  source: SourceTextSchema,
178986
- theme: external_exports.enum(PICTURE_SCHEMES).default("light").describe("Color scheme to paint with: light, dark, or auto for one picture that follows the reader's light or dark setting."),
179184
+ scheme: external_exports.enum(PICTURE_SCHEMES).default("light").describe("Color scheme to paint with: light, dark, or auto for one picture that follows the reader's light or dark setting."),
179185
+ theme: ColorThemeArgSchema,
178987
179186
  idPrefix: external_exports.string().max(API_LIMITS.maxIdPrefixLength).regex(ID_PREFIX_PATTERN).optional().describe("Prefix for element ids; set it when inlining several diagrams into one page."),
178988
179187
  embedSource: external_exports.boolean().default(false).describe("Write the source into the SVG metadata so read_diagram can give it back. Set it true when you save the SVG into a repository; anyone with the file can then read the source. Default false."),
178989
179188
  settings: SettingsArgSchema
178990
179189
  }).meta({ id: "RenderInput", description: "Diagram source and rendering options." });
178991
179190
  RenderResponseSchema = external_exports.object({
178992
179191
  svg: external_exports.string().describe("Self-contained SVG markup with an accessible title and description."),
178993
- theme: external_exports.enum(PICTURE_SCHEMES).describe("The color scheme used."),
179192
+ scheme: external_exports.enum(PICTURE_SCHEMES).describe("The color scheme used."),
178994
179193
  size: SizeSchema,
178995
179194
  warnings: external_exports.array(DiagnosticSchema)
178996
179195
  }).meta({ id: "RenderResponse", description: "A rendered diagram." });
@@ -179007,15 +179206,16 @@ function isRepoRelativePath(path) {
179007
179206
  if (path.startsWith("/") || path.includes("\\") || path.includes("\0")) return false;
179008
179207
  return path.split("/").every((segment) => segment !== "" && segment !== "..");
179009
179208
  }
179010
- var THEME_CHOICES, DETAIL_CHOICES, ThemeChoiceSchema, DetailSchema, SVG_CHOICES, SvgChoiceSchema, EmbedSourceSchema, PicturesOmittedSchema, ViewUrlSchema, PngUrlSchema, SvgUrlSchema, SaveCommandSchema, RepoPathSchema;
179209
+ var SCHEME_CHOICES, DETAIL_CHOICES, SchemeChoiceSchema, DetailSchema, SVG_CHOICES, SvgChoiceSchema, EmbedSourceSchema, PicturesOmittedSchema, ViewUrlSchema, PngUrlSchema, SvgUrlSchema, SaveCommandSchema, RepoPathSchema;
179011
179210
  var init_workflows = __esm({
179012
179211
  "../../packages/diagrams/src/schemas/workflows.ts"() {
179013
179212
  "use strict";
179014
179213
  init_zod();
179214
+ init_constants();
179015
179215
  init_theme();
179016
- THEME_CHOICES = ["light", "dark", "both"];
179216
+ SCHEME_CHOICES = ["light", "dark", "both"];
179017
179217
  DETAIL_CHOICES = ["summary", "full"];
179018
- ThemeChoiceSchema = external_exports.enum(THEME_CHOICES).default("both").describe("light, dark, or both (the default): the light picture and the dark one a dark page needs.");
179218
+ SchemeChoiceSchema = external_exports.enum(SCHEME_CHOICES).default("both").describe("light, dark, or both (the default): the light picture and the dark one a dark page needs.");
179019
179219
  DetailSchema = external_exports.enum(DETAIL_CHOICES).default("summary").describe("summary (the default), or full: the whole outline, and the source embedded in each SVG.");
179020
179220
  SVG_CHOICES = ["auto", "always", "never"];
179021
179221
  SvgChoiceSchema = external_exports.enum(SVG_CHOICES).default("auto").describe(
@@ -179025,7 +179225,7 @@ var init_workflows = __esm({
179025
179225
  "Write the source into each SVG so read_diagram can give it back. Set it when you save the SVG in a repository or publish it to edit later; anyone with the file or link can then read the source."
179026
179226
  );
179027
179227
  PicturesOmittedSchema = external_exports.object({
179028
- themes: external_exports.array(external_exports.enum(THEME_NAMES)).describe("The color schemes whose pictures were left out."),
179228
+ schemes: external_exports.array(external_exports.enum(THEME_NAMES)).describe("The color schemes whose pictures were left out."),
179029
179229
  characters: external_exports.number().int().describe("How many characters the pictures left out came to."),
179030
179230
  limit: external_exports.number().int().describe("The most characters one answer may hold before the pictures are left out."),
179031
179231
  why: external_exports.string().describe("Why they were left out, and what to do.")
@@ -179040,7 +179240,7 @@ var init_workflows = __esm({
179040
179240
  "The viewUrl with &download=svg: a person opens it to download the SVG. Not a file address for curl; use saveCommand. Absent when too long."
179041
179241
  );
179042
179242
  SaveCommandSchema = external_exports.string().describe(
179043
- "Run in a shell to save the SVG into the repository: the CLI decodes the link locally, fetches nothing, and embeds the source. Set --out to the path; add --theme dark for dark. Absent when too long."
179243
+ `Run in a shell to save the SVG into the repository: the CLI decodes the link locally, fetches nothing, and embeds the source. Set --out to the path; add ${schemeFlag()} dark for dark. Absent when too long.`
179044
179244
  );
179045
179245
  RepoPathSchema = external_exports.string().min(1).refine(isRepoRelativePath, 'Use a path relative to the repository root, with forward slashes, no leading slash, and no ".." segment.');
179046
179246
  }
@@ -179085,7 +179285,7 @@ var init_edit_diagram = __esm({
179085
179285
  source: SourceTextSchema,
179086
179286
  operations: external_exports.array(EditOperationSchema).min(1).max(WORKFLOW_LIMITS.maxEditOperations).describe("Applied in order."),
179087
179287
  svg: external_exports.enum(SVG_CHOICES).default("never").describe("never (the default) draws nothing; auto or always draws like draw_diagram."),
179088
- themes: ThemeChoiceSchema,
179288
+ schemes: SchemeChoiceSchema,
179089
179289
  settings: SettingsArgSchema
179090
179290
  }).meta({ id: "EditDiagramInput", description: "Diagram source and the edits to make to it." });
179091
179291
  OperationResultSchema = external_exports.object({
@@ -179107,7 +179307,7 @@ var init_edit_diagram = __esm({
179107
179307
  outline: external_exports.array(external_exports.string()),
179108
179308
  outlineTruncated: external_exports.boolean(),
179109
179309
  size: SizeSchema.nullable(),
179110
- renders: external_exports.array(external_exports.object({ theme: external_exports.enum(THEME_NAMES), svg: external_exports.string(), size: SizeSchema })),
179310
+ renders: external_exports.array(external_exports.object({ scheme: external_exports.enum(THEME_NAMES), svg: external_exports.string(), size: SizeSchema })),
179111
179311
  picturesOmitted: PicturesOmittedSchema.optional(),
179112
179312
  viewUrl: ViewUrlSchema.optional(),
179113
179313
  svgUrl: SvgUrlSchema.optional(),
@@ -179139,7 +179339,7 @@ var init_read_diagram2 = __esm({
179139
179339
  PictureSchema = external_exports.object({
179140
179340
  title: external_exports.string().nullable().describe("The diagram title, or null."),
179141
179341
  summary: external_exports.string().nullable().describe("The one-line summary the picture carries, or null."),
179142
- theme: external_exports.string().nullable().describe("The color scheme it was drawn in, or null."),
179342
+ scheme: external_exports.string().nullable().describe("The color scheme it was drawn in, or null."),
179143
179343
  size: SizeSchema.nullable().describe("Its size in px, or null."),
179144
179344
  outline: external_exports.array(external_exports.string()).describe("The plain-language outline the picture carries, one entry for each line. Empty when the source was read: the source says more."),
179145
179345
  labels: external_exports.array(external_exports.string()).describe("The text painted on the picture, each distinct label once, in painted order. Empty when the source was read.")
@@ -179302,7 +179502,8 @@ var init_vocabulary18 = __esm({
179302
179502
  arrows: external_exports.array(ArrowSchema),
179303
179503
  blockTypes: external_exports.array(external_exports.enum(SEQUENCE_BLOCK_TYPES)).describe("Frames a sequence diagram can wrap around messages."),
179304
179504
  columnFlags: external_exports.array(external_exports.enum(COLUMN_FLAGS)).describe("Flags a schema column row may carry."),
179305
- themes: external_exports.array(external_exports.enum(THEME_NAMES)),
179505
+ schemes: external_exports.array(external_exports.enum(THEME_NAMES)).describe("The color schemes a picture is drawn in, chosen where it is drawn (a tool's scheme argument), not in the source."),
179506
+ themes: external_exports.array(external_exports.enum(COLOR_THEMES)).describe(`Colour themes: theme=<name> on the header of any kind, such as flow "Title" theme=ocean. ${DEFAULT_COLOR_THEME} is the default; contrast reaches WCAG AAA. Each holds light and dark, and tones keep their meaning. An organisation's brand, on the hosted service, wins over it.`),
179306
179507
  iconSets: external_exports.array(external_exports.enum(ICON_SETS)),
179307
179508
  iconCount: external_exports.number().int().describe("Number of bundled icons; use search_icons to find names."),
179308
179509
  iconProviders: external_exports.array(IconProviderSchema).describe("Cloud and platform providers, each an icon set holding the provider (set:cloud) and its products."),
@@ -179373,8 +179574,8 @@ var init_convert_mermaid = __esm({
179373
179574
  ConvertMermaidInputSchema = external_exports.object({
179374
179575
  source: external_exports.string().min(1).max(API_LIMITS.maxSourceLength).describe(`One Mermaid diagram: ${mermaidTypesChoice()}. Front matter and %%{init}%% directives are allowed and are dropped. Send the text inside a mermaid fence, without the fence.`),
179375
179576
  lenient: external_exports.boolean().default(false).describe("false (the default): a line that cannot be read stops the conversion, so nothing is converted with a line missing. true: such a line is skipped with a warning and the rest is converted."),
179376
- render: external_exports.boolean().default(false).describe("Also draw the converted diagram, in the color schemes themes names."),
179377
- themes: ThemeChoiceSchema,
179577
+ render: external_exports.boolean().default(false).describe("Also draw the converted diagram, in the color schemes schemes names."),
179578
+ schemes: SchemeChoiceSchema,
179378
179579
  detail: DetailSchema,
179379
179580
  svg: SvgChoiceSchema,
179380
179581
  embedSource: EmbedSourceSchema,
@@ -179400,7 +179601,7 @@ var init_convert_mermaid = __esm({
179400
179601
  size: SizeSchema.nullable().describe("Natural size of the laid-out diagram.")
179401
179602
  });
179402
179603
  RenderedSchema = external_exports.object({
179403
- theme: external_exports.enum(THEME_NAMES).describe("The color scheme this picture is drawn in."),
179604
+ scheme: external_exports.enum(THEME_NAMES).describe("The color scheme this picture is drawn in."),
179404
179605
  svg: external_exports.string().describe("Self-contained SVG markup with an accessible title and description."),
179405
179606
  size: SizeSchema
179406
179607
  });
@@ -179533,14 +179734,15 @@ var init_draw_diagram = __esm({
179533
179734
  init_workflows();
179534
179735
  DrawDiagramInputSchema = external_exports.object({
179535
179736
  source: DiagramSourceSchema,
179536
- themes: ThemeChoiceSchema,
179737
+ schemes: SchemeChoiceSchema,
179738
+ theme: ColorThemeArgSchema,
179537
179739
  detail: DetailSchema,
179538
179740
  svg: SvgChoiceSchema,
179539
179741
  embedSource: EmbedSourceSchema,
179540
179742
  settings: SettingsArgSchema
179541
179743
  }).meta({ id: "DrawDiagramInput", description: "Diagram source and what to return: the color schemes to draw and how much detail." });
179542
179744
  RenderedThemeSchema = external_exports.object({
179543
- theme: external_exports.enum(THEME_NAMES).describe("The color scheme this picture is drawn in."),
179745
+ scheme: external_exports.enum(THEME_NAMES).describe("The color scheme this picture is drawn in."),
179544
179746
  svg: external_exports.string().describe("Self-contained SVG markup with an accessible title and description."),
179545
179747
  size: SizeSchema
179546
179748
  });
@@ -183075,7 +183277,7 @@ var init_patterns2 = __esm({
183075
183277
  file: PatternFileArgumentSchema.nullable().optional().describe("The whole pattern as a pattern file, when file was true and the pattern was found."),
183076
183278
  next: external_exports.string().describe("The next step in one sentence.")
183077
183279
  }).meta({ id: "GetPatternResponse", description: "A pattern filled for one flavour, with its slots and advice." });
183078
- DrawFromPatternInputSchema = external_exports.object({ id: PatternIdSchema, provider: FlavourChoiceSchema, slots: SlotValuesSchema, themes: ThemeChoiceSchema, detail: DetailSchema, svg: SvgChoiceSchema, embedSource: EmbedSourceSchema, settings: SettingsArgSchema }).meta({ id: "DrawFromPatternInput", description: "A pattern id, the flavour and slot values to use, and what to return." });
183280
+ DrawFromPatternInputSchema = external_exports.object({ id: PatternIdSchema, provider: FlavourChoiceSchema, slots: SlotValuesSchema, schemes: SchemeChoiceSchema, detail: DetailSchema, svg: SvgChoiceSchema, embedSource: EmbedSourceSchema, settings: SettingsArgSchema }).meta({ id: "DrawFromPatternInput", description: "A pattern id, the flavour and slot values to use, and what to return." });
183079
183281
  DrawFromPatternResponseSchema = external_exports.object({
183080
183282
  ...FilledFields,
183081
183283
  valid: DrawDiagramResponseSchema.shape.valid,
@@ -199570,7 +199772,7 @@ var init_definitions = __esm({
199570
199772
  renderDiagramTool = defineTool({
199571
199773
  name: "render_diagram",
199572
199774
  title: "Render diagram",
199573
- description: "Render valid source to a self-contained, accessible SVG in the light or dark theme, with its pixel size and quality warnings. Source with errors fails with its diagnostics. Set embedSource true to save the SVG in a repository, so read_diagram can give the source back. Prefer draw_diagram, which validates, outlines, and renders in one call.",
199775
+ description: "Render valid source to a self-contained, accessible SVG in the light, dark, or auto scheme and an optional colour theme, with its pixel size and quality warnings. Source with errors fails with its diagnostics. Set embedSource true to save the SVG in a repository, so read_diagram can give the source back. Prefer draw_diagram, which validates, outlines, and renders in one call.",
199574
199776
  callExample: { source: 'flow\nnode api service "API"\nnode db database "DB"\napi -> db : "reads"' },
199575
199777
  input: RenderInputSchema,
199576
199778
  output: RenderResponseSchema,
@@ -200217,7 +200419,7 @@ var init_compare_diagrams3 = __esm({
200217
200419
  });
200218
200420
 
200219
200421
  // ../../packages/diagrams/src/tools/workflows/shared.ts
200220
- function themesFor(choice) {
200422
+ function schemesFor(choice) {
200221
200423
  return choice === "both" ? ["light", "dark"] : [choice];
200222
200424
  }
200223
200425
  function lookFields(checked2) {
@@ -200270,9 +200472,9 @@ async function convertMermaidDiagram(input2, ops = ENGINE_OPS) {
200270
200472
  const outline2 = input2.detail === "full" ? lines : lines.slice(0, WORKFLOW_LIMITS.maxSummaryOutlineLines);
200271
200473
  const renders = [];
200272
200474
  if (input2.render && input2.svg !== "never" && checked2.valid) {
200273
- for (const theme of themesFor(input2.themes)) {
200274
- const drawn = await ops.render({ source: conversion.source, theme, embedSource: input2.detail === "full" || input2.embedSource });
200275
- if (drawn.ok) renders.push({ theme, svg: drawn.value.svg, size: drawn.value.size });
200475
+ for (const scheme of schemesFor(input2.schemes)) {
200476
+ const drawn = await ops.render({ source: conversion.source, scheme, embedSource: input2.detail === "full" || input2.embedSource });
200477
+ if (drawn.ok) renders.push({ scheme, svg: drawn.value.svg, size: drawn.value.size });
200276
200478
  }
200277
200479
  }
200278
200480
  return {
@@ -200353,10 +200555,10 @@ async function drawDiagram(input2, ops = ENGINE_OPS) {
200353
200555
  const lines = outlined.ok ? outlined.value.outline : [];
200354
200556
  const outline2 = isFull ? lines : lines.slice(0, WORKFLOW_LIMITS.maxSummaryOutlineLines);
200355
200557
  const renders = [];
200356
- for (const theme of input2.svg === "never" ? [] : themesFor(input2.themes)) {
200357
- const drawn = await ops.render({ source: input2.source, theme, embedSource: isFull || input2.embedSource });
200558
+ for (const scheme of input2.svg === "never" ? [] : schemesFor(input2.schemes)) {
200559
+ const drawn = await ops.render({ source: input2.source, scheme, ...input2.theme === void 0 ? {} : { theme: input2.theme }, embedSource: isFull || input2.embedSource });
200358
200560
  if (!drawn.ok) return rejected(checked2.kind, drawn.error.map((diagnostic) => ({ ...diagnostic })));
200359
- renders.push({ theme, svg: drawn.value.svg, size: drawn.value.size });
200561
+ renders.push({ scheme, svg: drawn.value.svg, size: drawn.value.size });
200360
200562
  }
200361
200563
  return {
200362
200564
  valid: true,
@@ -200384,10 +200586,10 @@ var init_draw_diagram2 = __esm({
200384
200586
  drawDiagramWorkflow = defineWorkflow({
200385
200587
  name: "draw_diagram",
200386
200588
  title: "Draw diagram",
200387
- description: 'Workflow. Checks, describes, and draws a diagram. With errors it returns each one with line, column, and a fix hint and draws nothing: fix the source and call again. When valid it returns the quality warnings (take the icon and group-type suggestions), an outline to check the meaning, the size, and the SVG for light, dark, or both. The pictures are most of an answer and you cannot see them: pass svg "never" to check, and draw only to save, show, or publish. Give viewUrl to the person, even after svg "never": the drawing lives in the link and nothing is saved on Plotwork; pngUrl and svgUrl download it; saveCommand, when given, saves it in a repository. A big drawing (about 30 nodes) loses its SVGs, dark first, and picturesOmitted says so; svg "always" forces them. Set embedSource true to save an SVG in a repository or publish one to edit later, so read_diagram gives the source back (anyone with the file can read it). detail "full" adds the whole outline. To change an existing diagram use edit_diagram, or read_diagram for a picture. Saves no file; never throws on bad source. Replaces the validate_diagram, outline_diagram and render_diagram calls.',
200589
+ description: 'Workflow. Checks, describes, and draws a diagram. With errors it returns each one with line, column, and a fix hint and draws nothing: fix the source and call again. When valid it returns the quality warnings (take the icon and group-type suggestions), an outline to check the meaning, the size, and the SVG for light, dark, or both (theme= on the header picks the colour theme). The pictures are most of an answer and you cannot see them: pass svg "never" to check, and draw only to save, show, or publish. Give viewUrl to the person, even after svg "never": the drawing lives in the link and nothing is saved on Plotwork; pngUrl and svgUrl download it; saveCommand, when given, saves it in a repository. A big drawing (about 30 nodes) loses its SVGs, dark first, and picturesOmitted says so; svg "always" forces them. Set embedSource true to save an SVG in a repository or publish one to edit later, so read_diagram gives the source back (anyone with the file can read it). detail "full" adds the whole outline. To change an existing diagram use edit_diagram, or read_diagram for a picture. Saves no file; never throws on bad source. Replaces the validate_diagram, outline_diagram and render_diagram calls.',
200388
200590
  compact: {
200389
200591
  description: 'Checks diagram source and draws it in one call. Returns every error with line, column, and hint, and draws nothing until the source is valid, so fix each error and call again. svg "never" only checks and keeps the answer small; "always" returns the light and dark SVG to save.',
200390
- inputs: { svg: "never: check only. always: return the SVGs.", themes: "", embedSource: "Write the source into the SVG, for a file saved in a repository." }
200592
+ inputs: { svg: "never: check only. always: return the SVGs.", schemes: "", embedSource: "Write the source into the SVG, for a file saved in a repository." }
200391
200593
  },
200392
200594
  input: DrawDiagramInputSchema,
200393
200595
  output: DrawDiagramResponseSchema,
@@ -200395,7 +200597,7 @@ var init_draw_diagram2 = __esm({
200395
200597
  maxCalls: WORKFLOW_MAX_CALLS.draw_diagram,
200396
200598
  example: {
200397
200599
  source: 'flow "Login" direction=right\nnode user person "User"\nnode api service "Auth API"\nnode db database "Users DB"\nuser -> api : "POST /login"\napi -> db : "look up user"',
200398
- themes: "both"
200600
+ schemes: "both"
200399
200601
  },
200400
200602
  prompts: ["Draw a diagram of how a user signs in through an API that checks a database.", "Check this diagram and draw it in light and dark."],
200401
200603
  execute: drawDiagram
@@ -200448,10 +200650,10 @@ async function drawFromPattern(input2, ops = ENGINE_OPS) {
200448
200650
  const lines = outlined.ok ? outlined.value.outline : [];
200449
200651
  const outline2 = isFull ? lines : lines.slice(0, WORKFLOW_LIMITS.maxSummaryOutlineLines);
200450
200652
  const renders = [];
200451
- for (const theme of input2.svg === "never" ? [] : themesFor(input2.themes)) {
200452
- const drawn = await ops.render({ source: pattern3.source, theme, embedSource: isFull || input2.embedSource });
200653
+ for (const scheme of input2.svg === "never" ? [] : schemesFor(input2.schemes)) {
200654
+ const drawn = await ops.render({ source: pattern3.source, scheme, embedSource: isFull || input2.embedSource });
200453
200655
  if (!drawn.ok) return { ...common, ...notDrawn(drawn.error.map((diagnostic) => ({ ...diagnostic }))), next: "The pattern could not be drawn; call draw_diagram with its source for the details." };
200454
- renders.push({ theme, svg: drawn.value.svg, size: drawn.value.size });
200656
+ renders.push({ scheme, svg: drawn.value.svg, size: drawn.value.size });
200455
200657
  }
200456
200658
  const review = checked2.warnings.length === 0 ? "" : ` Review the ${countOf3(checked2.warnings.length, "warning")} first.`;
200457
200659
  return {
@@ -200481,12 +200683,12 @@ var init_draw_from_pattern = __esm({
200481
200683
  drawFromPatternWorkflow = defineWorkflow({
200482
200684
  name: "draw_from_pattern",
200483
200685
  title: "Draw from pattern",
200484
- description: "Workflow. Fills a pattern and draws it in one call. Send the id from find_pattern, a provider (neutral by default, or aws, azure, gcp), optional slot values that rename its parts, and the themes. Returns the source, the slots, the advice on adapting it, the quality warnings, a plain-text outline, and the SVG for light, dark, or both. Use it when a pattern fits with only names changed; use get_pattern to edit the source first. An unknown id, flavour, or slot comes back as a problem with a fix. svg, picturesOmitted, viewUrl, pngUrl, saveCommand, and detail work as in draw_diagram. Replaces the get_pattern, validate_diagram, outline_diagram and render_diagram calls.",
200686
+ description: "Workflow. Fills a pattern and draws it in one call. Send the id from find_pattern, a provider (neutral by default, or aws, azure, gcp), optional slot values that rename its parts, and the schemes. Returns the source, the slots, the advice on adapting it, the quality warnings, a plain-text outline, and the SVG for light, dark, or both. Use it when a pattern fits with only names changed; use get_pattern to edit the source first. An unknown id, flavour, or slot comes back as a problem with a fix. svg, picturesOmitted, viewUrl, pngUrl, saveCommand, and detail work as in draw_diagram. Replaces the get_pattern, validate_diagram, outline_diagram and render_diagram calls.",
200485
200687
  input: DrawFromPatternInputSchema,
200486
200688
  output: DrawFromPatternResponseSchema,
200487
200689
  steps: [{ call: "fillPattern" }, { call: "validate", optional: true }, { call: "outline", optional: true }, { call: "render", optional: true }],
200488
200690
  maxCalls: WORKFLOW_MAX_CALLS.draw_from_pattern,
200489
- example: { id: "two-zone-network", provider: "aws", themes: "light" },
200691
+ example: { id: "two-zone-network", provider: "aws", schemes: "light" },
200490
200692
  prompts: ["Draw a two-zone network on AWS with a replicated database.", 'Draw the web application pattern for Azure and call the API "Billing API".'],
200491
200693
  execute: drawFromPattern
200492
200694
  });
@@ -200519,7 +200721,7 @@ async function editDiagram(input2, ops = ENGINE_OPS) {
200519
200721
  const check3 = checkOnly(edited.source, ops);
200520
200722
  return { ...head, ...check3, next: nextStep2(failed2, check3, false) };
200521
200723
  }
200522
- const drawn = await drawDiagram(DrawDiagramInputSchema.parse({ source: edited.source, themes: input2.themes, svg: input2.svg }), ops);
200724
+ const drawn = await drawDiagram(DrawDiagramInputSchema.parse({ source: edited.source, schemes: input2.schemes, svg: input2.svg }), ops);
200523
200725
  const check2 = {
200524
200726
  valid: drawn.valid,
200525
200727
  kind: drawn.kind,
@@ -202957,9 +203159,9 @@ function isPictured(value) {
202957
203159
  function wantsAlways(args) {
202958
203160
  return typeof args === "object" && args !== null && args.svg === "always";
202959
203161
  }
202960
- function omittedNext(themes, characters, kept2, viewable) {
202961
- const which = themes.length === 1 ? `its ${themes[0]} picture` : "its pictures";
202962
- const verb = themes.length === 1 ? "was" : "were";
203162
+ function omittedNext(schemes, characters, kept2, viewable) {
203163
+ const which = schemes.length === 1 ? `its ${schemes[0]} picture` : "its pictures";
203164
+ const verb = schemes.length === 1 ? "was" : "were";
202963
203165
  const rest = kept2 > 0 ? " The other picture is here." : "";
202964
203166
  const look = viewable ? " Give the person viewUrl to look at it." : "";
202965
203167
  return `The diagram is valid, but ${which} (${characters} characters) ${verb} left out so this answer stays small enough for an AI client to read.${rest}${look} Call publish_diagram with the diagram source for a public link and a Markdown image, call sync_markdown to place it in a document, or call this tool again with svg "always" to get the pictures here.`;
@@ -202972,14 +203174,14 @@ function fitAnswer(value, args, budget2) {
202972
203174
  const dropped = [];
202973
203175
  while (kept2.length > 0 && sizeOf2(kept2) > budget2) dropped.unshift(kept2.pop());
202974
203176
  const characters = dropped.reduce((total, picture2) => total + picture2.svg.length, 0);
202975
- const themes = dropped.map((picture2) => picture2.theme);
203177
+ const schemes = dropped.map((picture2) => picture2.scheme);
202976
203178
  const picturesOmitted = {
202977
- themes,
203179
+ schemes,
202978
203180
  characters,
202979
203181
  limit: budget2,
202980
203182
  why: `The answer would have been over ${budget2} characters, which is more than an AI client can be relied on to read in one piece.`
202981
203183
  };
202982
- return { ...value, renders: kept2, picturesOmitted, next: omittedNext(themes, characters, kept2.length, typeof value.viewUrl === "string") };
203184
+ return { ...value, renders: kept2, picturesOmitted, next: omittedNext(schemes, characters, kept2.length, typeof value.viewUrl === "string") };
202983
203185
  }
202984
203186
  var ANSWER_BUDGET_CHARACTERS;
202985
203187
  var init_fit_answer = __esm({
@@ -203536,7 +203738,7 @@ function savingInstructions(release = CLI_RELEASE) {
203536
203738
  const people = "Give viewUrl to a person to look at the diagram, and svgUrl or pngUrl to download it in their browser; neither is a file address for curl.";
203537
203739
  if (!release.onNpm) return [`To save a valid diagram into the person's repository, draw it with svg "always" and embedSource true and write the returned svg. ${people}`];
203538
203740
  return [
203539
- `To save a valid diagram into the person's repository, run the saveCommand a drawing tool returns in a shell, changing --out to the path you want (add --theme dark for the dark picture): the Plotwork command line reads the diagram from the link on that machine, fetches nothing, and writes the SVG with its source embedded, so you never copy the SVG yourself. With no shell, draw with svg "always" and embedSource true and write the returned svg. ${people}`
203741
+ `To save a valid diagram into the person's repository, run the saveCommand a drawing tool returns in a shell, changing --out to the path you want (add ${schemeFlag(release)} dark for the dark picture): the Plotwork command line reads the diagram from the link on that machine, fetches nothing, and writes the SVG with its source embedded, so you never copy the SVG yourself. With no shell, draw with svg "always" and embedSource true and write the returned svg. ${people}`
203540
203742
  ];
203541
203743
  }
203542
203744
  function libraryInstructions(library) {
@@ -203576,9 +203778,9 @@ var init_server_info = __esm({
203576
203778
  "To move Mermaid to Plotwork, call convert_mermaid with one diagram, read every diagnostic and its hint, then choose node types and icons; for a whole Markdown file call sync_markdown with the document, its path, and convertMermaid true, write the returned markdown and files, then review the diff.",
203577
203779
  "When the repository has a plotwork.config.json (or .plotwork/config.json) at its root, read it and pass it as settings to every tool that takes settings: its defaults fill the header options the source leaves out, and broken style rules come back as warnings to fix.",
203578
203780
  "Use validate_diagram, outline_diagram, render_diagram, and search_icons only for one fine-grained step.",
203579
- "Choose node types and tones for meaning; colors are chosen by the theme and cannot be set."
203781
+ `Choose node types and tones for meaning; colors come from the colour theme, theme=<name> on the header (${COLOR_THEMES.join(", ")}), and cannot be set one by one.`
203580
203782
  ].join(" ");
203581
- BOARD_INSTRUCTIONS = "This connection also reaches its organisation's live whiteboards, which people watch while they change. To work on one: take the board the person names (list_boards finds it by name, or use the id in its address), open_board, read_board_tab, then edit_board_tab with small operations against the version you read; a whole source only for a new or empty tab. During a meeting, call read_board_tab with sinceVersion before every edit, so you build on what people changed, and say in one line what you changed. Use add_board_tab for a separate diagram, and import_to_board to bring in a library diagram, a file, Mermaid or a pattern as a new tab; save a tab to the library with save_board_tab only when the person asks. Never replace a tab to undo someone else's change, and never publish a board's tab unless the person asks.";
203783
+ BOARD_INSTRUCTIONS = "This connection also reaches its organisation's live whiteboards, which people watch while they change. To work on one: take the board the person names (list_boards finds it by name, or use the id in its address), call open_board first, which shows the people watching that you are there, then read_board_tab, then edit_board_tab with small operations against the version you read; a whole source only for a new or empty tab. During a meeting, call read_board_tab with sinceVersion before every edit, so you build on what people changed, and say in one line what you changed. Use add_board_tab for a separate diagram, and import_to_board to bring in a library diagram, a file, Mermaid or a pattern as a new tab; save a tab to the library with save_board_tab only when the person asks. When the person asks for a proposal or a revision, call create_revision, give them its viewUrl so they can watch it change, make every edit with edit_board_tab and that revision, then request_merge with a one-line note; a person merges it, never you. open_board and read_board_tab also return messages your person typed to you on the board. Listening mode, when your person asks you to listen: loop on wait_for_board_messages, which answers as soon as a message arrives or after 25 seconds with none; act on each message in your own revision; reply_board_message with what you did; ask in a reply before request_merge. Never replace a tab to undo someone else's change, and never publish a board's tab unless the person asks.";
203582
203784
  KEEP_IN_LIBRARY_STEP = "To keep it in an organisation's library, or in the person's own Diagrams, call publish_diagram when they ask.";
203583
203785
  HOSTED_INSTRUCTIONS = "A viewUrl from a drawing tool holds the drawing itself in the link: nothing is saved on Plotwork, and it will not appear in any Diagrams list; when the person wants a diagram kept in an organisation's library or their own Diagrams, call publish_diagram. When the person asks to share a finished diagram or wants a link to it, call publish_diagram with the valid source: it returns a public link and a Markdown image to paste, and publishing the same diagram again returns the same link. Publish only when asked, because anyone with the link can see the picture. After you edit a published diagram, call publish_diagram again: an edited diagram is a new picture with a new link, so replace the old link wherever it is used. Set embedSource true on publish_diagram when someone may want to edit the diagram later, and tell the person that the source is then part of the public picture. A drawing too big to return in an answer is also the case for publish_diagram: it gives a link in place of the picture. To keep a diagram inside a team instead, pass organization with the slug or id of an organisation, but only when the person names an organisation or asks for a team diagram: it is stored in that organisation's private library and the answer has a viewUrl for members in place of a public link, so there is no Markdown image. Never guess an organisation, and if it is not found, ask the person which one they mean. An organisation can also send its members' diagrams to its library when organization is left out: the answer then names it and says why, and the person must be told the diagram is in that library, not at a public link. Pass personal true only when the person asks for a public link anyway; an organisation that requires its library refuses it, and then tell the person. An organisation can also keep every diagram its agents draw: a drawing's answer then has autoPublished, and its next names the library; tell the person where the diagram is, and do not publish it again. An organisation can also hold a publish for approval: the answer then has approval and warning W601, held for approval by your organisation; tell the person it is stored and waits for an approver, and do not publish it again. An owner may restrict a folder, and a reader may not publish: when the answer says the folder is restricted or the role does not allow it, ask the person which folder they may use instead of trying others or publishing elsewhere. Call list_diagrams when the person asks what they have published or to get a diagram id; it changes nothing. Call delete_diagram only after the person has said which diagram to delete, by name, and tell them what you deleted; never delete on a guess, in bulk, or to make room for a publish unless they asked, and a locked diagram cannot be deleted until the owner unlocks it. When an owner or admin of an organisation asks to publish a checked pattern file, call publish_pattern with it (and organization unless you are connected through it): its agents then find it first. Set replace true only after the person has said to change the pattern of that name.";
203584
203786
  }
@@ -203775,14 +203977,14 @@ function request(method,params){var id=next++;send({jsonrpc:'2.0',id:id,method:m
203775
203977
  function notify(method,params){send({jsonrpc:'2.0',method:method,params:params})}
203776
203978
  function button(label,title,act){var b=document.createElement('button');b.type='button';b.textContent=label;b.setAttribute('aria-label',title);b.addEventListener('click',act);bar.appendChild(b);return b}
203777
203979
  function renders(){var a=state.answer;return a&&Array.isArray(a.renders)?a.renders.filter(function(r){return r&&typeof r.svg==='string'}):[]}
203778
- function picked(){var all=renders(),want=state.chosen||state.theme;for(var i=0;i<all.length;i++)if(all[i].theme===want)return all[i];return all[0]||null}
203980
+ function picked(){var all=renders(),want=state.chosen||state.theme;for(var i=0;i<all.length;i++)if(all[i].scheme===want)return all[i];return all[0]||null}
203779
203981
  function resize(){notify('ui/notifications/size-changed',{width:document.documentElement.scrollWidth,height:document.documentElement.scrollHeight})}
203780
203982
  function draw(){
203781
203983
  while(bar.firstChild)bar.removeChild(bar.firstChild);
203782
203984
  while(stage.firstChild)stage.removeChild(stage.firstChild);
203783
203985
  note.textContent='';
203784
203986
  var pic=picked(),a=state.answer||{};
203785
- document.documentElement.setAttribute('data-theme',pic?pic.theme:state.theme);
203987
+ document.documentElement.setAttribute('data-theme',pic?pic.scheme:state.theme);
203786
203988
  if(!pic){note.textContent=a.valid===false||(a.validation&&a.validation.valid===false)?'Nothing was drawn: the diagram has errors.':'No picture in this answer.'+(typeof a.viewUrl==='string'?' Open it in the browser to see it.':'')}
203787
203989
  else{
203788
203990
  var holder=document.createElement('div');holder.className='pic';
@@ -203795,7 +203997,7 @@ function draw(){
203795
203997
  img.width=Math.round(w*scale);img.height=Math.round(h*scale);
203796
203998
  holder.style.width=img.width+'px';holder.style.height=img.height+'px';
203797
203999
  holder.appendChild(img);stage.appendChild(holder);overlay(pic,holder);
203798
- var swap=pic.theme==='dark'?'light':'dark';
204000
+ var swap=pic.scheme==='dark'?'light':'dark';
203799
204001
  button(swap==='light'?'Light':'Dark','Show the '+swap+' picture',function(){state.chosen=swap;draw()}).disabled=renders().length<2;
203800
204002
  button('\\u2212','Zoom out',function(){state.zoom=Math.max(0.1,(state.zoom||fit)/1.25);draw()});
203801
204003
  button(Math.round(scale*100)+'%','Fit to the frame',function(){state.zoom=0;draw()});
@@ -204009,11 +204211,11 @@ function launcher(platform, target) {
204009
204211
  function picturesOf(value) {
204010
204212
  const renders = typeof value === "object" && value !== null ? value.renders : void 0;
204011
204213
  if (!Array.isArray(renders)) return [];
204012
- return renders.filter((item) => typeof item === "object" && item !== null && typeof item.theme === "string" && typeof item.svg === "string" && /^(light|dark)$/.test(item.theme));
204214
+ return renders.filter((item) => typeof item === "object" && item !== null && typeof item.scheme === "string" && typeof item.svg === "string" && /^(light|dark)$/.test(item.scheme));
204013
204215
  }
204014
- function localPage(themes) {
204015
- const images2 = themes.map((theme) => `<img src="${theme}.svg" alt="The diagram, ${theme}" data-theme="${theme}">`).join("\n");
204016
- const swap = themes.length > 1 ? '<button type="button" id="swap">Light or dark</button>' : "";
204216
+ function localPage(schemes) {
204217
+ const images2 = schemes.map((scheme) => `<img src="${scheme}.svg" alt="The diagram, ${scheme}" data-scheme="${scheme}">`).join("\n");
204218
+ const swap = schemes.length > 1 ? '<button type="button" id="swap">Light or dark</button>' : "";
204017
204219
  return `<!doctype html>
204018
204220
  <html lang="en">
204019
204221
  <head>
@@ -204036,8 +204238,8 @@ var dark = window.matchMedia('(prefers-color-scheme: dark)').matches
204036
204238
  var pictures = Array.prototype.slice.call(document.querySelectorAll('img'))
204037
204239
  function show() {
204038
204240
  var want = dark ? 'dark' : 'light'
204039
- var has = pictures.some(function (img) { return img.dataset.theme === want })
204040
- pictures.forEach(function (img) { img.hidden = has && img.dataset.theme !== want })
204241
+ var has = pictures.some(function (img) { return img.dataset.scheme === want })
204242
+ pictures.forEach(function (img) { img.hidden = has && img.dataset.scheme !== want })
204041
204243
  document.body.className = has ? want : ''
204042
204244
  }
204043
204245
  var button = document.getElementById('swap')
@@ -204057,9 +204259,9 @@ function pictureOpener(env, deps = SYSTEM_OPEN_DEPS) {
204057
204259
  const before = typeof record2.next === "string" ? `${record2.next} ` : "";
204058
204260
  try {
204059
204261
  const dir = await deps.makeDir();
204060
- for (const picture2 of pictures) await deps.write(join6(dir, `${picture2.theme}.svg`), picture2.svg);
204262
+ for (const picture2 of pictures) await deps.write(join6(dir, `${picture2.scheme}.svg`), picture2.svg);
204061
204263
  const page = join6(dir, "index.html");
204062
- await deps.write(page, localPage(pictures.map((picture2) => picture2.theme)));
204264
+ await deps.write(page, localPage(pictures.map((picture2) => picture2.scheme)));
204063
204265
  const opened = await deps.launch(page);
204064
204266
  const said = opened ? `The pictures were opened in the browser from ${dir}.` : `The pictures were saved in ${dir}, but the browser could not be opened.`;
204065
204267
  return { ...record2, next: `${before}${said}` };
@@ -204196,6 +204398,7 @@ var init_settings3 = __esm({
204196
204398
  init_json_schema3();
204197
204399
  init_tool_settings();
204198
204400
  init_detect_sources();
204401
+ init_sources2();
204199
204402
  }
204200
204403
  });
204201
204404