@huaqiu/hardware-artifacts 0.7.18 → 0.7.19

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,8 +1,8 @@
1
- import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync } from "node:fs";
1
+ import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
2
2
  import { execFile, execFileSync, spawn } from "node:child_process";
3
3
  import { createHash } from "node:crypto";
4
4
  import { readFile } from "node:fs/promises";
5
- import { basename, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
5
+ import { basename, dirname, extname, isAbsolute, join, resolve, sep } from "node:path";
6
6
  import { tmpdir } from "node:os";
7
7
  import { zipSync } from "fflate";
8
8
  //#region src/order.ts
@@ -143,7 +143,7 @@ function pointsOf(node) {
143
143
  return points;
144
144
  }
145
145
  /** The layers/node children of the document root. */
146
- function rootOf$1(tree) {
146
+ function rootOf(tree) {
147
147
  return tree.find((node) => isNode(node) && head(node) === "kicad_pcb");
148
148
  }
149
149
  function isEdgeCuts(node) {
@@ -164,9 +164,18 @@ function snapOz(thicknessMm, allowed) {
164
164
  * reference defaults for anything missing instead of inventing a measurement.
165
165
  */
166
166
  function readBoardFacts(text) {
167
- const root = rootOf$1(parseSexpr(text));
167
+ const root = rootOf(parseSexpr(text));
168
168
  if (root === void 0) throw new Error("not a kicad_pcb document");
169
- const layers = (child(root, "layers") ?? []).filter((entry) => isNode(entry) && typeof entry[1] === "string" && entry[1].endsWith(".Cu")).length;
169
+ const copperLayers = (child(root, "layers") ?? []).filter((entry) => isNode(entry) && typeof entry[1] === "string" && entry[1].endsWith(".Cu"));
170
+ const layers = copperLayers.length;
171
+ const copperAliases = {};
172
+ for (const entry of copperLayers) {
173
+ const canonical = entry[1];
174
+ const display = entry[3];
175
+ if (typeof canonical !== "string" || typeof display !== "string") continue;
176
+ if (display === canonical || display.trim() === "") continue;
177
+ copperAliases[display] = canonical.replace(/\./gu, "_");
178
+ }
170
179
  const thicknessMm = numberAt(child(child(root, "general") ?? [], "thickness"), 1) ?? 1.6;
171
180
  let minX = Number.POSITIVE_INFINITY;
172
181
  let minY = Number.POSITIVE_INFINITY;
@@ -239,7 +248,8 @@ function readBoardFacts(text) {
239
248
  3,
240
249
  4
241
250
  ]) },
242
- ...allPads === 0 ? {} : { padCount: smdPads > 0 ? smdPads : allPads }
251
+ ...allPads === 0 ? {} : { padCount: smdPads > 0 ? smdPads : allPads },
252
+ ...Object.keys(copperAliases).length === 0 ? {} : { copperAliases }
243
253
  };
244
254
  }
245
255
  const THICKNESS_TIERS = Object.freeze({
@@ -690,6 +700,427 @@ function packageName(boardPath) {
690
700
  return basename(boardPath).replace(/\.kicad_pcb$/iu, "");
691
701
  }
692
702
  //#endregion
703
+ //#region src/package.ts
704
+ /**
705
+ * Gerber/drill suffixes that carry no fabrication intent.
706
+ *
707
+ * A `.gbrjob` is KiCad's job metadata and is written next to the plots; it is
708
+ * neither a layer nor an error.
709
+ */
710
+ const NON_LAYER_SUFFIXES = /* @__PURE__ */ new Set([
711
+ "gbrjob",
712
+ "txt",
713
+ "csv",
714
+ "json"
715
+ ]);
716
+ const DRILL_SUFFIXES = /* @__PURE__ */ new Set([
717
+ "drl",
718
+ "xln",
719
+ "exc",
720
+ "ncd"
721
+ ]);
722
+ /**
723
+ * Plot file suffixes.
724
+ *
725
+ * KiCad writes `.gbr` when the plotter is set to extended names, but its
726
+ * default is the Protel set: `.gtl`/`.gbl` for outer copper, `.g1`…`.g32` for
727
+ * inner copper, `.gm1` for the outline, and letters for the technical layers.
728
+ * Both spellings appear in real packages — a validator that knows only `.gbr`
729
+ * declares every inner layer missing.
730
+ */
731
+ const GERBER_SUFFIXES = /^(?:gbr|g\d{1,2}|gm\d{1,2}|gko|gml|g[tsbop][a-z])$/iu;
732
+ /** The layer names KiCad puts between the board name and the suffix. */
733
+ const LAYER_TOKENS = /^(?:[FB]_[A-Za-z0-9_]+|In\d+_Cu|Edge_Cuts|Margin|User_[A-Za-z0-9_]+|[A-Za-z0-9]+_User)$/u;
734
+ /**
735
+ * Protel plot suffixes that name their own layer.
736
+ *
737
+ * KiCad's default plotter writes the Protel set. The suffix is a fixed function
738
+ * of the layer, while the text before it is the board's *display* name for that
739
+ * layer and is therefore whatever the designer typed. A board that renamed
740
+ * `F.Cu` to `top_copper` plots `board-top_copper.gtl`, and one that renamed
741
+ * `In1.Cu` plots `board-inner_ground.g1` — both perfectly fabricable, and both
742
+ * unreadable from the name alone.
743
+ */
744
+ const PROTEL_LAYERS = Object.freeze({
745
+ gtl: "F_Cu",
746
+ gbl: "B_Cu",
747
+ gts: "F_Mask",
748
+ gbs: "B_Mask",
749
+ gto: "F_SilkS",
750
+ gbo: "B_SilkS",
751
+ gtp: "F_Paste",
752
+ gbp: "B_Paste",
753
+ gta: "F_Adhes",
754
+ gba: "B_Adhes",
755
+ gm1: "Edge_Cuts"
756
+ });
757
+ /** `gtl` → `F_Cu`; `g3` → `In3_Cu`; `undefined` for a suffix that names no layer. */
758
+ function protelLayer(suffix) {
759
+ const fixed = PROTEL_LAYERS[suffix];
760
+ if (fixed !== void 0) return fixed;
761
+ const inner = /^g(\d{1,2})$/u.exec(suffix);
762
+ if (inner === null) return void 0;
763
+ const index = Number(inner[1]);
764
+ return index >= 1 ? `In${String(index)}_Cu` : void 0;
765
+ }
766
+ /**
767
+ * `board-F_Cu.gbr` → `F_Cu`; `undefined` for a file that is not a plot.
768
+ *
769
+ * `aliases` maps a board's display names back onto the canonical ones
770
+ * (`{ top_copper: 'F_Cu' }`). It is the only way to read a plot whose layer was
771
+ * renamed *and* written with extended (`.gbr`) names, where the suffix carries
772
+ * no layer identity.
773
+ */
774
+ function gerberLayer(name, aliases) {
775
+ const dot = name.lastIndexOf(".");
776
+ if (dot <= 0) return void 0;
777
+ const suffix = name.slice(dot + 1).toLowerCase();
778
+ if (!GERBER_SUFFIXES.test(suffix)) return void 0;
779
+ const protel = protelLayer(suffix);
780
+ if (protel !== void 0) return protel;
781
+ const stem = name.slice(0, dot);
782
+ const dash = stem.lastIndexOf("-");
783
+ const layer = dash === -1 ? stem : stem.slice(dash + 1);
784
+ if (LAYER_TOKENS.test(layer)) return layer;
785
+ const alias = aliases?.[layer];
786
+ return alias !== void 0 && LAYER_TOKENS.test(alias) ? alias : void 0;
787
+ }
788
+ function suffixOf(name) {
789
+ const dot = name.lastIndexOf(".");
790
+ return dot === -1 ? "" : name.slice(dot + 1).toLowerCase();
791
+ }
792
+ /** The copper layers a KiCad stackup of this size must contain, in order. */
793
+ function expectedCopperLayers(layers) {
794
+ const count = Number.isFinite(layers) && layers >= 2 ? Math.floor(layers) : 2;
795
+ const inner = [];
796
+ for (let index = 1; index <= count - 2; index += 1) inner.push(`In${String(index)}_Cu`);
797
+ return [
798
+ "F_Cu",
799
+ ...inner,
800
+ "B_Cu"
801
+ ];
802
+ }
803
+ /**
804
+ * Judge one package against the board facts it was plotted from.
805
+ *
806
+ * `facts` must come from the same board file (`readBoardFacts`); measuring a
807
+ * package against another board's stackup is the very mistake this catches.
808
+ *
809
+ * @param files - every member of the archive, with its uncompressed size.
810
+ * @param facts - geometry and stackup declared by the source board.
811
+ */
812
+ function validateFabricationPackage(files, facts) {
813
+ const errors = [];
814
+ const warnings = [];
815
+ const layers = /* @__PURE__ */ new Set();
816
+ let hasOutline = false;
817
+ let hasDrill = false;
818
+ let unreadable = 0;
819
+ for (const file of files) {
820
+ if (file.bytes === 0) errors.push({
821
+ code: "empty-file",
822
+ severity: "error",
823
+ message: `${file.name} is empty; the plotter wrote a file it did not fill`,
824
+ file: file.name
825
+ });
826
+ const layer = gerberLayer(file.name, facts.copperAliases);
827
+ if (layer !== void 0) {
828
+ layers.add(layer);
829
+ if (layer === "Edge_Cuts") hasOutline = true;
830
+ continue;
831
+ }
832
+ if (DRILL_SUFFIXES.has(suffixOf(file.name))) hasDrill = true;
833
+ else if (!NON_LAYER_SUFFIXES.has(suffixOf(file.name))) unreadable += 1;
834
+ }
835
+ const copperLayers = [...layers].filter((layer) => layer.endsWith("_Cu"));
836
+ const expected = expectedCopperLayers(facts.layers);
837
+ const missing = expected.filter((layer) => !layers.has(layer));
838
+ if (copperLayers.length === 0) errors.push({
839
+ code: "no-copper",
840
+ severity: "error",
841
+ message: "no copper gerber in the package; nothing would be etched"
842
+ });
843
+ else if (missing.length > 0) errors.push({
844
+ code: "missing-copper-layer",
845
+ severity: "error",
846
+ message: `the board declares ${String(facts.layers)} copper layers but ${missing.join(", ")} ${missing.length === 1 ? "was" : "were"} not plotted; ordering this package would produce a board missing that layer`
847
+ });
848
+ const extra = copperLayers.filter((layer) => !expected.includes(layer));
849
+ if (extra.length > 0) warnings.push({
850
+ code: "unexpected-copper-layer",
851
+ severity: "warning",
852
+ message: `the package plots ${extra.join(", ")}, which the declared stackup does not contain`
853
+ });
854
+ if (!hasOutline) errors.push({
855
+ code: "no-board-outline",
856
+ severity: "error",
857
+ message: "no Edge.Cuts gerber in the package; the fabricator would have no board outline to cut"
858
+ });
859
+ if (!(facts.widthMm > 0) || !(facts.heightMm > 0)) errors.push({
860
+ code: "zero-area",
861
+ severity: "error",
862
+ message: "the board outline could not be measured, so the order form would carry a 0 × 0 size"
863
+ });
864
+ if (!hasDrill) warnings.push({
865
+ code: "no-drill",
866
+ severity: "warning",
867
+ message: "no drill file in the package; it is only correct for a board with no through-holes"
868
+ });
869
+ if (unreadable > 0) warnings.push({
870
+ code: "unexpected-file",
871
+ severity: "warning",
872
+ message: `${String(unreadable)} file(s) are neither gerber, drill nor job metadata and were ignored`
873
+ });
874
+ return {
875
+ ok: errors.length === 0,
876
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
877
+ errors,
878
+ warnings,
879
+ copperLayers,
880
+ missingLayers: missing,
881
+ hasOutline,
882
+ hasDrill
883
+ };
884
+ }
885
+ /** One sentence a human or agent can act on, or `undefined` when valid. */
886
+ function validationSummary(validation) {
887
+ if (validation.ok && validation.warnings.length === 0) return void 0;
888
+ return [...validation.errors, ...validation.warnings].map((issue) => issue.message).join("; ");
889
+ }
890
+ //#endregion
891
+ //#region src/toolchain/resolve.ts
892
+ /**
893
+ * One resolver for both external toolchains.
894
+ *
895
+ * Every consumer — the export/launch service, the settings panel, background
896
+ * discovery, the installer's post-extraction validation and the agent prompt —
897
+ * must agree on what "configured" means, or the product grows the two
898
+ * independent validation systems `hardware-engineering-toolchain-onboarding…`
899
+ * §10.5 rules out. This module is that agreement: pure functions from a
900
+ * *configured path* to the executables it owns, plus one version normaliser.
901
+ *
902
+ * The configured value stays the user's object (an installation root), and the
903
+ * executables are derived from it, because that is what the spec requires
904
+ * (§3.1): a user who pastes `…\KiCad\10.0\bin` or `…\bin\kicad-cli.exe` keeps
905
+ * whatever they pasted, while the product resolves around it.
906
+ *
907
+ * @module @huaqiu/hardware-artifacts/toolchain/resolve
908
+ */
909
+ /** Canonical absolute form used for every persisted path. */
910
+ function canonicalPath(path) {
911
+ return resolve(path);
912
+ }
913
+ function platformOf(internals) {
914
+ return internals.platform ?? process.platform;
915
+ }
916
+ function existing(paths, internals) {
917
+ const exists = internals.exists ?? ((candidate) => {
918
+ try {
919
+ return existsSync(candidate) && statSync(candidate).isFile();
920
+ } catch {
921
+ return false;
922
+ }
923
+ });
924
+ return paths.find((path) => exists(path));
925
+ }
926
+ /**
927
+ * Normalise a version report to the version itself.
928
+ *
929
+ * `kicad-cli version` prints `10.0.7`; `solidcraft-cli --version` prints
930
+ * `solidcraft-cli 0.49.1`. The product needs one comparable token from both so
931
+ * a manifest version can be matched against an installed one. A report with no
932
+ * version-shaped token is not a version (§5.3 "unsupported version output").
933
+ * @param output - raw first line of the tool's version command.
934
+ * @returns the dotted version, or undefined when the output carries none.
935
+ */
936
+ function normalizeVersion(output) {
937
+ if (output === void 0) return void 0;
938
+ return /\d+(?:\.\d+)+(?:[-+][0-9A-Za-z.-]+)?/u.exec(output)?.[0];
939
+ }
940
+ /**
941
+ * Executable layout candidates for one configured path.
942
+ *
943
+ * The Windows portable distributions this product downloads put the CLI in
944
+ * `bin/` (KiCad) or beside the app (SolidCraft); a system installation uses the
945
+ * same shape under a versioned folder, and macOS wraps both in an app bundle.
946
+ * @param tool - which toolchain the root belongs to.
947
+ * @param root - configured root, a `bin` directory, or an installation root.
948
+ * @param internals - platform injection.
949
+ * @returns candidate paths in resolution order.
950
+ */
951
+ function executableCandidates(tool, root, internals = {}) {
952
+ const platform = platformOf(internals);
953
+ const exe = platform === "win32" ? ".exe" : "";
954
+ const lower = basename(root).toLowerCase();
955
+ const isAppBundle = lower.endsWith(".app");
956
+ const mac = isAppBundle || platform === "darwin";
957
+ if (tool === "kicad") {
958
+ if (mac) {
959
+ const base = isAppBundle ? root : join(root, "KiCad.app");
960
+ return {
961
+ cli: [join(base, "Contents/MacOS/kicad-cli")],
962
+ app: [join(base, "Contents/MacOS/kicad")],
963
+ named: {
964
+ projectManager: [join(base, "Contents/MacOS/kicad")],
965
+ schematicEditor: [join(base, "Contents/Applications/eeschema.app/Contents/MacOS/eeschema")],
966
+ pcbEditor: [join(base, "Contents/Applications/pcbnew.app/Contents/MacOS/pcbnew")]
967
+ }
968
+ };
969
+ }
970
+ const bin = lower === "bin" ? root : join(root, "bin");
971
+ return {
972
+ cli: [join(bin, `kicad-cli${exe}`), join(root, `kicad-cli${exe}`)],
973
+ app: [join(bin, `kicad${exe}`)],
974
+ named: {
975
+ projectManager: [join(bin, `kicad${exe}`)],
976
+ schematicEditor: [join(bin, `eeschema${exe}`)],
977
+ pcbEditor: [join(bin, `pcbnew${exe}`)]
978
+ }
979
+ };
980
+ }
981
+ if (mac) {
982
+ const base = isAppBundle ? root : join(root, "SolidCraft.app");
983
+ return {
984
+ cli: [join(base, "Contents/MacOS/solidcraft-cli")],
985
+ app: [join(base, "Contents/MacOS/SolidCraft"), join(base, "Contents/MacOS/solidcraft")],
986
+ named: {}
987
+ };
988
+ }
989
+ return {
990
+ cli: [join(root, `solidcraft-cli${exe}`), join(root, "bin", `solidcraft-cli${exe}`)],
991
+ app: [
992
+ join(root, `SolidCraft${exe}`),
993
+ join(root, `solidcraft${exe}`),
994
+ join(root, "bin", `SolidCraft${exe}`),
995
+ join(root, "bin", `solidcraft${exe}`)
996
+ ],
997
+ named: {}
998
+ };
999
+ }
1000
+ /** Installation root that owns one resolved executable, per layout convention. */
1001
+ function installRootFromExecutable(executable) {
1002
+ const segments = executable.split(sep);
1003
+ const macIndex = segments.indexOf("Contents");
1004
+ if (macIndex > 0) return segments.slice(0, macIndex).join(sep) || sep;
1005
+ if (segments[segments.length - 2]?.toLowerCase() === "bin") return segments.slice(0, -2).join(sep) || sep;
1006
+ return dirname(executable);
1007
+ }
1008
+ /** Executable stems the product accepts as a pasted executable path. */
1009
+ const KICAD_STEMS = [
1010
+ "kicad-cli",
1011
+ "kicad",
1012
+ "eeschema",
1013
+ "pcbnew",
1014
+ "cvpcb",
1015
+ "gerbview"
1016
+ ];
1017
+ const SOLIDCRAFT_STEMS = ["solidcraft-cli", "solidcraft"];
1018
+ /**
1019
+ * Normalise what the user typed into the installation root the product stores.
1020
+ *
1021
+ * Accepts an installation root, a `bin` directory or a direct executable path
1022
+ * (§3.1/§6.1). An already-correct root is returned unchanged — the product must
1023
+ * never silently retarget a path the user chose (§6.1).
1024
+ * @param tool - which toolchain the path belongs to.
1025
+ * @param input - the raw user input or native-dialog selection.
1026
+ * @returns the installation root to persist, or undefined for blank input.
1027
+ */
1028
+ function installationRootOf(tool, input) {
1029
+ const trimmed = input.trim();
1030
+ if (trimmed === "") return void 0;
1031
+ const full = canonicalPath(trimmed);
1032
+ const name = basename(full).toLowerCase();
1033
+ const stem = name.replace(/\.(exe|app|command|bat|cmd)$/u, "");
1034
+ const stems = tool === "kicad" ? KICAD_STEMS : SOLIDCRAFT_STEMS;
1035
+ if (name === "bin") return dirname(full);
1036
+ if (isDirectory(full)) return full;
1037
+ if (name.endsWith(".app") ? true : stems.some((candidate) => stem === candidate)) return installRootFromExecutable(full);
1038
+ return full;
1039
+ }
1040
+ /** True when the path exists and is a directory; a missing path is not a directory. */
1041
+ function isDirectory(path) {
1042
+ try {
1043
+ return statSync(path).isDirectory();
1044
+ } catch {
1045
+ return false;
1046
+ }
1047
+ }
1048
+ /**
1049
+ * Resolve one configured root into its executables and validated state.
1050
+ *
1051
+ * A candidate is configured only after its primary CLI exists *and* answers a
1052
+ * version probe (§5.3). An executable that exists but reports nothing stays
1053
+ * unconfigured, with the probe failure as its reason. SolidCraft additionally
1054
+ * tolerates a distribution whose CLI is missing while its app is present —
1055
+ * that is a usable installation with no version, not an error (§3.1).
1056
+ * @param tool - which toolchain to resolve.
1057
+ * @param root - configured installation root.
1058
+ * @param internals - platform/probe injection.
1059
+ * @returns the resolution, including the operator-facing failure reason.
1060
+ */
1061
+ function resolveToolchain(tool, root, internals = {}) {
1062
+ if (root === void 0 || root.trim() === "") return {
1063
+ configured: false,
1064
+ error: `${label(tool)} installation is not configured`
1065
+ };
1066
+ const installPath = canonicalPath(root);
1067
+ const candidates = executableCandidates(tool, installPath, internals);
1068
+ const cli = existing(candidates.cli, internals);
1069
+ const app = existing(candidates.app, internals);
1070
+ const pcbEditor = existing(candidates.named.pcbEditor ?? [], internals);
1071
+ const schematicEditor = existing(candidates.named.schematicEditor ?? [], internals);
1072
+ const projectManager = existing(candidates.named.projectManager ?? [], internals);
1073
+ const editors = {
1074
+ ...projectManager === void 0 ? {} : { projectManager },
1075
+ ...schematicEditor === void 0 ? {} : { schematicEditor },
1076
+ ...pcbEditor === void 0 ? {} : { pcbEditor }
1077
+ };
1078
+ if (tool === "kicad") {
1079
+ if (cli === void 0) return {
1080
+ configured: false,
1081
+ installPath,
1082
+ ...app === void 0 ? {} : { app },
1083
+ ...editors,
1084
+ error: `no kicad-cli executable under ${installPath}`
1085
+ };
1086
+ const version = internals.probeVersion?.(cli, tool);
1087
+ if (version === void 0) return {
1088
+ configured: false,
1089
+ installPath,
1090
+ cli,
1091
+ ...app === void 0 ? {} : { app },
1092
+ ...editors,
1093
+ error: `${cli} did not answer a version probe`
1094
+ };
1095
+ return {
1096
+ configured: true,
1097
+ installPath,
1098
+ cli,
1099
+ version,
1100
+ ...app === void 0 ? {} : { app },
1101
+ ...editors
1102
+ };
1103
+ }
1104
+ if (cli === void 0 && app === void 0) return {
1105
+ configured: false,
1106
+ installPath,
1107
+ error: `no solidcraft executable under ${installPath}`
1108
+ };
1109
+ const probeTarget = cli ?? app;
1110
+ const version = probeTarget === void 0 ? void 0 : internals.probeVersion?.(probeTarget, tool);
1111
+ return {
1112
+ configured: true,
1113
+ installPath,
1114
+ ...cli === void 0 ? {} : { cli },
1115
+ ...app === void 0 ? {} : { app },
1116
+ ...version === void 0 ? {} : { version }
1117
+ };
1118
+ }
1119
+ /** Display name of one toolchain, used in operator-facing messages. */
1120
+ function label(tool) {
1121
+ return tool === "kicad" ? "KiCad" : "SolidCraft";
1122
+ }
1123
+ //#endregion
693
1124
  //#region src/service.ts
694
1125
  /**
695
1126
  * Hardware Engineering artifact model and host operations.
@@ -730,10 +1161,6 @@ const SHEET_FILE_PATTERN = /\(property\s+"Sheetfile"\s+"((?:[^"\\]|\\.)*)"/gu;
730
1161
  function canonical(path) {
731
1162
  return resolve(path);
732
1163
  }
733
- function isInside(child, parent) {
734
- const rel = relative(parent, child);
735
- return rel === "" || !rel.startsWith("..") && !isAbsolute(rel);
736
- }
737
1164
  function isExcluded(name) {
738
1165
  return EXCLUDED_DIRS.has(name.toLowerCase());
739
1166
  }
@@ -751,29 +1178,6 @@ function realOrUndefined(path) {
751
1178
  function scopeKey(sessionId) {
752
1179
  return sessionId === void 0 || sessionId === "" ? "" : sessionId;
753
1180
  }
754
- /**
755
- * A caller-named root, read as "the workspace this artifact belongs to".
756
- *
757
- * Callers may name a project file by mistake (the project `.kicad_pro` is the
758
- * path the panel holds), and a file path authorizes nothing: no artifact is
759
- * inside another file's path. Resolving to the containing directory keeps the
760
- * caller's intent without widening beyond it.
761
- */
762
- function rootOf(root) {
763
- const real = realOrUndefined(root) ?? canonical(root);
764
- try {
765
- return statSync(real).isDirectory() ? real : dirname(real);
766
- } catch {
767
- return real;
768
- }
769
- }
770
- /** Roots a discovery proved reachable: the workspace and every adopted project. */
771
- function discoveredRoots(discovery) {
772
- if (discovery === void 0) return [];
773
- const roots = /* @__PURE__ */ new Set([discovery.cwd]);
774
- for (const project of discovery.projects) roots.add(dirname(project.path));
775
- return [...roots];
776
- }
777
1181
  function errorWithCode(message, code, status) {
778
1182
  return Object.assign(new Error(message), {
779
1183
  code,
@@ -927,10 +1331,18 @@ function artifact(kind, path, projectPath, sourcePath) {
927
1331
  format: extname(full).toLowerCase().replace(/^\./, "") || kind
928
1332
  };
929
1333
  }
930
- function defaultVersionProbe(executable) {
1334
+ /** Is this path an existing regular file? Small helper shared by resolution. */
1335
+ function isFile(path) {
1336
+ try {
1337
+ return existsSync(path) && statSync(path).isFile();
1338
+ } catch {
1339
+ return false;
1340
+ }
1341
+ }
1342
+ function defaultVersionProbe(executable, tool = "kicad") {
931
1343
  if (!existsSync(executable)) return void 0;
932
1344
  try {
933
- return execFileSync(executable, ["version"], {
1345
+ return execFileSync(executable, tool === "kicad" ? ["version"] : ["--version"], {
934
1346
  encoding: "utf8",
935
1347
  timeout: 5e3,
936
1348
  stdio: [
@@ -988,58 +1400,6 @@ function defaultRunCommand(command, args, options) {
988
1400
  });
989
1401
  });
990
1402
  }
991
- function existing(paths) {
992
- return paths.find((candidate) => {
993
- try {
994
- return existsSync(candidate) && statSync(candidate).isFile();
995
- } catch {
996
- return false;
997
- }
998
- });
999
- }
1000
- function kicadCandidates(root) {
1001
- const app = basename(root).toLowerCase().endsWith(".app");
1002
- if (app || process.platform === "darwin") {
1003
- const base = app ? root : join(root, "KiCad.app");
1004
- return {
1005
- cli: [join(base, "Contents/MacOS/kicad-cli")],
1006
- kicad: [join(base, "Contents/MacOS/kicad")],
1007
- eeschema: [join(base, "Contents/Applications/eeschema.app/Contents/MacOS/eeschema")],
1008
- pcbnew: [join(base, "Contents/Applications/pcbnew.app/Contents/MacOS/pcbnew")]
1009
- };
1010
- }
1011
- const exe = process.platform === "win32" ? ".exe" : "";
1012
- const bin = app ? root : basename(root).toLowerCase() === "bin" ? root : join(root, "bin");
1013
- return {
1014
- cli: [join(bin, `kicad-cli${exe}`), join(root, `kicad-cli${exe}`)],
1015
- kicad: [join(bin, `kicad${exe}`)],
1016
- eeschema: [join(bin, `eeschema${exe}`)],
1017
- pcbnew: [join(bin, `pcbnew${exe}`)]
1018
- };
1019
- }
1020
- /** Install root that owns one resolved `kicad-cli`, per layout convention. */
1021
- function installRootFromCli(cli) {
1022
- const segments = cli.split(sep);
1023
- const macIndex = segments.indexOf("Contents");
1024
- if (macIndex > 0) return segments.slice(0, macIndex).join(sep) || sep;
1025
- if (segments[segments.length - 2]?.toLowerCase() === "bin") return segments.slice(0, -2).join(sep) || sep;
1026
- return dirname(cli);
1027
- }
1028
- function solidcraftCandidates(root) {
1029
- const exe = process.platform === "win32" ? ".exe" : "";
1030
- const app = basename(root).toLowerCase().endsWith(".app");
1031
- if (app || process.platform === "darwin") {
1032
- const base = app ? root : join(root, "SolidCraft.app");
1033
- return [join(base, `Contents/MacOS/SolidCraft`), join(base, `Contents/MacOS/solidcraft`)];
1034
- }
1035
- return [
1036
- root,
1037
- join(root, `SolidCraft${exe}`),
1038
- join(root, `solidcraft${exe}`),
1039
- join(root, "bin", `SolidCraft${exe}`),
1040
- join(root, "bin", `solidcraft${exe}`)
1041
- ];
1042
- }
1043
1403
  /** Small, immutable host capability implementation. */
1044
1404
  var HardwareArtifactService = class {
1045
1405
  config;
@@ -1087,50 +1447,49 @@ var HardwareArtifactService = class {
1087
1447
  ...solidcraftRoot === void 0 ? {} : { solidcraftRoot }
1088
1448
  };
1089
1449
  }
1090
- /** Resolve configured installations from validated absolute paths only. */
1450
+ /**
1451
+ * Resolve configured installations from validated absolute paths only.
1452
+ *
1453
+ * Resolution is delegated to the toolchain capability's one resolver
1454
+ * (`./toolchain/resolve.ts`) so the settings panel, background discovery and
1455
+ * the export path cannot disagree about what "configured" means.
1456
+ */
1091
1457
  installations() {
1092
1458
  const roots = this.roots();
1093
- const kicadRoot = roots.kicadRoot ? canonical(roots.kicadRoot) : void 0;
1094
- let kicadCli;
1095
- if (kicadRoot !== void 0) kicadCli = existing(basename(kicadRoot).toLowerCase().startsWith("kicad-cli") ? [kicadRoot] : kicadCandidates(kicadRoot).cli);
1096
- const candidates = kicadRoot === void 0 ? {
1097
- cli: [],
1098
- kicad: [],
1099
- eeschema: [],
1100
- pcbnew: []
1101
- } : kicadCandidates(kicadCli === void 0 ? kicadRoot : installRootFromCli(kicadCli));
1102
- const pcbEditor = existing(candidates.pcbnew);
1103
- const schematicEditor = existing(candidates.eeschema);
1104
- const projectManager = existing(candidates.kicad);
1105
- const version = kicadCli === void 0 ? void 0 : this.options.probeVersion(kicadCli);
1106
- const kicad = kicadCli === void 0 ? {
1107
- configured: false,
1108
- error: "KiCad installation is not configured"
1109
- } : version === void 0 ? {
1110
- configured: false,
1111
- root: kicadRoot,
1112
- cli: kicadCli,
1113
- error: `${kicadCli} did not answer a version probe`
1114
- } : {
1459
+ const kicadResolution = resolveToolchain("kicad", roots.kicadRoot, {
1460
+ exists: (path) => isFile(path),
1461
+ probeVersion: (executable) => this.options.probeVersion(executable, "kicad")
1462
+ });
1463
+ const kicad = kicadResolution.configured ? {
1115
1464
  configured: true,
1116
- root: kicadRoot,
1117
- cli: kicadCli,
1118
- version,
1119
- ...projectManager === void 0 ? {} : { projectManager },
1120
- ...pcbEditor === void 0 ? {} : { pcbEditor },
1121
- ...schematicEditor === void 0 ? {} : { schematicEditor }
1465
+ ...roots.kicadRoot === void 0 ? {} : { root: canonical(roots.kicadRoot) },
1466
+ ...kicadResolution.cli === void 0 ? {} : { cli: kicadResolution.cli },
1467
+ ...kicadResolution.version === void 0 ? {} : { version: kicadResolution.version },
1468
+ ...kicadResolution.projectManager === void 0 ? {} : { projectManager: kicadResolution.projectManager },
1469
+ ...kicadResolution.pcbEditor === void 0 ? {} : { pcbEditor: kicadResolution.pcbEditor },
1470
+ ...kicadResolution.schematicEditor === void 0 ? {} : { schematicEditor: kicadResolution.schematicEditor }
1471
+ } : {
1472
+ configured: false,
1473
+ ...roots.kicadRoot === void 0 ? {} : { root: canonical(roots.kicadRoot) },
1474
+ ...kicadResolution.cli === void 0 ? {} : { cli: kicadResolution.cli },
1475
+ ...kicadResolution.error === void 0 ? {} : { error: kicadResolution.error }
1122
1476
  };
1123
- const solidRoot = roots.solidcraftRoot ? canonical(roots.solidcraftRoot) : void 0;
1124
- const solidExecutable = solidRoot === void 0 ? void 0 : existing(solidcraftCandidates(solidRoot));
1477
+ const solidResolution = resolveToolchain("solidcraft", roots.solidcraftRoot, {
1478
+ exists: (path) => isFile(path),
1479
+ probeVersion: (executable) => this.options.probeVersion(executable, "solidcraft")
1480
+ });
1125
1481
  return {
1126
1482
  kicad,
1127
- solidcraft: solidExecutable === void 0 ? {
1128
- configured: false,
1129
- error: "SolidCraft installation is not configured"
1130
- } : {
1483
+ solidcraft: solidResolution.configured ? {
1131
1484
  configured: true,
1132
- root: solidRoot,
1133
- executable: solidExecutable
1485
+ ...roots.solidcraftRoot === void 0 ? {} : { root: canonical(roots.solidcraftRoot) },
1486
+ ...solidResolution.app === void 0 ? {} : { executable: solidResolution.app },
1487
+ ...solidResolution.cli === void 0 ? {} : { cli: solidResolution.cli },
1488
+ ...solidResolution.version === void 0 ? {} : { version: solidResolution.version }
1489
+ } : {
1490
+ configured: false,
1491
+ ...roots.solidcraftRoot === void 0 ? {} : { root: canonical(roots.solidcraftRoot) },
1492
+ ...solidResolution.error === void 0 ? {} : { error: solidResolution.error }
1134
1493
  }
1135
1494
  };
1136
1495
  }
@@ -1163,8 +1522,21 @@ var HardwareArtifactService = class {
1163
1522
  if (installed.kicad.error !== void 0) lines.push(` error: ${installed.kicad.error}`);
1164
1523
  lines.push("SolidCraft:");
1165
1524
  lines.push(` configured: ${String(installed.solidcraft.configured)}`);
1166
- if (installed.solidcraft.executable !== void 0) lines.push(` executable: ${installed.solidcraft.executable}`);
1525
+ for (const key of [
1526
+ "version",
1527
+ "executable",
1528
+ "cli"
1529
+ ]) {
1530
+ const value = installed.solidcraft[key];
1531
+ if (value !== void 0) lines.push(` ${key}: ${value}`);
1532
+ }
1167
1533
  if (installed.solidcraft.error !== void 0) lines.push(` error: ${installed.solidcraft.error}`);
1534
+ const missing = [!installed.kicad.configured ? "KiCad" : void 0, !installed.solidcraft.configured ? "SolidCraft" : void 0].filter((entry) => entry !== void 0);
1535
+ if (missing.length > 0) {
1536
+ lines.push("setup:");
1537
+ lines.push(` missing: ${missing.join(", ")}`);
1538
+ lines.push(" remediation: Settings → Hardware Engineering (browse an existing installation, download the HuaQiu build, or skip)");
1539
+ }
1168
1540
  if (scope?.selected !== void 0) {
1169
1541
  lines.push("Current project:");
1170
1542
  lines.push(` root: ${scope.cwd}`);
@@ -1350,53 +1722,39 @@ var HardwareArtifactService = class {
1350
1722
  };
1351
1723
  }
1352
1724
  /**
1353
- * Workspace roots a read may target: what this scope discovered, plus what
1354
- * the caller named.
1725
+ * Resolve one artifact path: canonical, real, of an expected type.
1355
1726
  *
1356
- * Additive on purpose. The previous shape unioned the caller's roots with one
1357
- * process-wide "last discovery", so any other session's discovery — a
1358
- * workspace switch is exactly that — replaced the root the open viewer was
1359
- * authorized by, and its next read failed with "artifact is outside the
1360
- * authorized workspace". Roots now only ever accumulate within their scope.
1361
- */
1362
- authorizedRoots(roots, sessionId) {
1363
- const candidates = /* @__PURE__ */ new Set();
1364
- for (const root of discoveredRoots(this.discovery(sessionId))) candidates.add(canonical(root));
1365
- for (const root of roots ?? []) {
1366
- if (root === void 0 || root.trim() === "") continue;
1367
- candidates.add(rootOf(root));
1368
- }
1369
- return [...candidates];
1370
- }
1371
- /**
1372
- * Authorize one artifact path: canonical, realpath-checked, inside a
1373
- * workspace root, and of an expected type. A browser request cannot turn
1374
- * this into an arbitrary filesystem read, even from loopback.
1727
+ * There is deliberately **no workspace fence**. This service only runs on the
1728
+ * machine whose files it reads, under the same authority as the user's own
1729
+ * editor, so a root check never protected anything the user could not already
1730
+ * open — it only produced `403 artifact is outside the authorized workspace`
1731
+ * whenever a panel and an agent call disagreed about a root, which is a
1732
+ * configuration puzzle disguised as a security boundary.
1733
+ *
1734
+ * What remains is what makes the answer trustworthy rather than merely
1735
+ * permitted: the path must be absolute, exist, be a regular file, be of a type
1736
+ * this service renders, and be resolved through symlinks before anything
1737
+ * reads it.
1738
+ * @param artifactPath - absolute path supplied by a client or an agent tool.
1375
1739
  */
1376
- authorize(artifactPath, roots, sessionId) {
1740
+ authorize(artifactPath) {
1377
1741
  if (!isAbsolute(artifactPath)) throw errorWithCode("artifact identity must be an absolute path", "invalid-identity", 400);
1378
1742
  const requested = canonical(artifactPath);
1379
1743
  if (SOURCE_EXTENSIONS[extname(requested).toLowerCase()] === void 0) throw errorWithCode(`unsupported artifact type: ${extname(requested)}`, "unsupported-artifact", 415);
1380
- const authorized = this.authorizedRoots(roots, sessionId);
1381
- if (authorized.length === 0) throw errorWithCode("no authorized workspace is known to the host", "unauthorized", 403);
1382
- if (!authorized.some((root) => isInside(requested, canonical(root)))) throw errorWithCode("artifact is outside the authorized workspace", "unauthorized", 403);
1383
1744
  if (!existsSync(requested)) throw errorWithCode(`artifact does not exist: ${requested}`, "missing-artifact", 404);
1384
1745
  const real = realOrUndefined(requested);
1385
1746
  if (real === void 0) throw errorWithCode(`artifact cannot be resolved: ${requested}`, "invalid-identity", 400);
1386
- if (!authorized.some((root) => {
1387
- const realRoot = realOrUndefined(root) ?? root;
1388
- return isInside(real, realRoot);
1389
- })) throw errorWithCode("artifact is outside the authorized workspace", "unauthorized", 403);
1390
1747
  if (!statSync(real).isFile()) throw errorWithCode(`artifact is not a regular file: ${requested}`, "invalid-identity", 400);
1391
- if (SOURCE_EXTENSIONS[extname(real).toLowerCase()] === void 0) throw errorWithCode("artifact type changed during resolution", "unsupported-artifact", 415);
1748
+ const resolvedKind = SOURCE_EXTENSIONS[extname(real).toLowerCase()];
1749
+ if (resolvedKind === void 0) throw errorWithCode("artifact type changed during resolution", "unsupported-artifact", 415);
1392
1750
  return {
1393
1751
  path: real,
1394
- kind: SOURCE_EXTENSIONS[extname(real).toLowerCase()]
1752
+ kind: resolvedKind
1395
1753
  };
1396
1754
  }
1397
1755
  /** Saved source text plus a content-addressed revision. */
1398
1756
  async readSource(request) {
1399
- const { path, kind } = this.authorize(request.artifactPath, request.roots, request.sessionId);
1757
+ const { path, kind } = this.authorize(request.artifactPath);
1400
1758
  const info = statSync(path);
1401
1759
  if (info.size > this.maxSourceBytes) throw errorWithCode(`artifact is larger than ${this.maxSourceBytes} bytes`, "too-large", 413);
1402
1760
  const body = await readFile(path);
@@ -1429,7 +1787,7 @@ var HardwareArtifactService = class {
1429
1787
  * - a timeout or abort leaves no partial file behind
1430
1788
  */
1431
1789
  async exportGlb(request) {
1432
- const { path } = this.authorize(request.artifactPath, request.roots, request.sessionId);
1790
+ const { path } = this.authorize(request.artifactPath);
1433
1791
  if (extname(path).toLowerCase() !== ".kicad_pcb") throw errorWithCode("GLB export requires a .kicad_pcb artifact", "unsupported-artifact", 415);
1434
1792
  const installed = this.installations();
1435
1793
  if (!installed.kicad.configured || installed.kicad.cli === void 0) throw errorWithCode(installed.kicad.error ?? "the configured KiCad installation has no kicad-cli", "not-configured", 412);
@@ -1506,7 +1864,7 @@ var HardwareArtifactService = class {
1506
1864
  * different MPNs never merge and DNP stays explicit.
1507
1865
  */
1508
1866
  async exportBom(request) {
1509
- const { path, kind } = this.authorize(request.artifactPath, request.roots, request.sessionId);
1867
+ const { path, kind } = this.authorize(request.artifactPath);
1510
1868
  if (kind !== "schematic") throw errorWithCode("BOM export requires a .kicad_sch artifact", "unsupported-artifact", 415);
1511
1869
  const installed = this.installations();
1512
1870
  if (!installed.kicad.configured || installed.kicad.cli === void 0) throw errorWithCode(installed.kicad.error ?? "the configured KiCad installation has no kicad-cli", "not-configured", 412);
@@ -1609,13 +1967,13 @@ var HardwareArtifactService = class {
1609
1967
  * revision: reopening the panel must not re-run the exporter.
1610
1968
  */
1611
1969
  async fabricate(request) {
1612
- const { path } = this.authorize(request.boardPath, request.roots, request.sessionId);
1970
+ const { path } = this.authorize(request.boardPath);
1613
1971
  if (extname(path).toLowerCase() !== ".kicad_pcb") throw errorWithCode("Fabrication packaging requires a .kicad_pcb artifact", "unsupported-artifact", 415);
1614
1972
  const installed = this.installations();
1615
1973
  if (!installed.kicad.configured || installed.kicad.cli === void 0) throw errorWithCode(installed.kicad.error ?? "the configured KiCad installation has no kicad-cli", "not-configured", 412);
1616
1974
  const cli = installed.kicad.cli;
1617
1975
  const revision = this.sourceRevision(path);
1618
- const schematicPath = request.schematicPath === void 0 ? void 0 : this.authorize(request.schematicPath, request.roots, request.sessionId).path;
1976
+ const schematicPath = request.schematicPath === void 0 ? void 0 : this.authorize(request.schematicPath).path;
1619
1977
  const key = `${path}:${revision}:${schematicPath ?? ""}`;
1620
1978
  const cached = this.packageCache.get(key);
1621
1979
  if (cached !== void 0) return cached;
@@ -1662,6 +2020,10 @@ var HardwareArtifactService = class {
1662
2020
  const plotted = readExportDirectory(plots, plotNames);
1663
2021
  const archiveData = zipPackage(plotted);
1664
2022
  const facts = readBoardFacts(readFileSync(path, "utf8"));
2023
+ const validation = validateFabricationPackage(plotted.map((file) => ({
2024
+ name: file.name,
2025
+ bytes: file.data.byteLength
2026
+ })), facts);
1665
2027
  let assembly;
1666
2028
  let assemblyFiles;
1667
2029
  if (schematicPath !== void 0) {
@@ -1682,7 +2044,6 @@ var HardwareArtifactService = class {
1682
2044
  const positions = parsePositions(readFileSync(positionsFile, "utf8"));
1683
2045
  const bomRows = orderBomRows(positions, (await this.exportBom({
1684
2046
  artifactPath: schematicPath,
1685
- ...request.roots === void 0 ? {} : { roots: request.roots },
1686
2047
  ...signal === void 0 ? {} : { signal }
1687
2048
  })).rows);
1688
2049
  const positionsText = positionsCsv(positions);
@@ -1711,6 +2072,7 @@ var HardwareArtifactService = class {
1711
2072
  bytes: file.data.byteLength
1712
2073
  }))
1713
2074
  },
2075
+ validation,
1714
2076
  archiveData,
1715
2077
  ...assembly === void 0 ? {} : { assembly },
1716
2078
  ...assemblyFiles === void 0 ? {} : { assemblyFiles }
@@ -1725,8 +2087,48 @@ var HardwareArtifactService = class {
1725
2087
  }
1726
2088
  }
1727
2089
  /**
1728
- * Submit one order to the Huaqiu openapi, exactly as the KiCad action does.
2090
+ * Write one prepared package into a directory.
2091
+ *
2092
+ * The package is normally kept in memory: the order panel shows it, the
2093
+ * submit uploads it, and neither needs a file. A caller that has to hand the
2094
+ * archive to someone else does — and re-running the plotter for that would
2095
+ * produce a different revision than the one already validated. This writes
2096
+ * exactly the bytes that were validated.
2097
+ *
2098
+ * Files are overwritten by design: the directory holds derived output, and a
2099
+ * rebuild of the same board replaces the previous export rather than
2100
+ * accumulating copies beside it. Nothing outside `directory` is touched.
1729
2101
  *
2102
+ * @param prepared - the value `fabricate` returned, archive bytes included.
2103
+ * @param directory - target directory, created when missing.
2104
+ */
2105
+ writePackage(prepared, directory) {
2106
+ const target = canonical(directory);
2107
+ mkdirSync(target, { recursive: true });
2108
+ const files = [];
2109
+ const write = (name, data) => {
2110
+ const path = join(target, name);
2111
+ const payload = typeof data === "string" ? new TextEncoder().encode(data) : data;
2112
+ writeFileSync(path, payload);
2113
+ files.push({
2114
+ name,
2115
+ path,
2116
+ bytes: payload.byteLength
2117
+ });
2118
+ };
2119
+ write(prepared.archive.zipName, prepared.archiveData);
2120
+ if (prepared.assemblyFiles !== void 0) {
2121
+ const stem = packageName(prepared.boardPath);
2122
+ write(`${stem}-positions.csv`, prepared.assemblyFiles.positions);
2123
+ write(`${stem}-bom.csv`, prepared.assemblyFiles.bom);
2124
+ }
2125
+ return {
2126
+ directory: target,
2127
+ files
2128
+ };
2129
+ }
2130
+ /**
2131
+ * Submit one order to the Huaqiu openapi, exactly as the KiCad action does.
1730
2132
  * PCB: every `PCB_FORM` field plus the gerber/drill archive as `file`.
1731
2133
  * SMT: `pcbFile` + `coordFile` + `bomFile` and `reqParseVO`, with the caller's
1732
2134
  * access token in `authorization`. The backend owns the order; this method
@@ -1738,12 +2140,12 @@ var HardwareArtifactService = class {
1738
2140
  const bundle = await this.fabricate({
1739
2141
  boardPath: request.boardPath,
1740
2142
  ...request.schematicPath === void 0 ? {} : { schematicPath: request.schematicPath },
1741
- ...request.roots === void 0 ? {} : { roots: request.roots },
1742
2143
  ...request.sessionId === void 0 ? {} : { sessionId: request.sessionId },
1743
2144
  ...request.signal === void 0 ? {} : { signal: request.signal }
1744
2145
  });
1745
2146
  const token = await this.orderToken();
1746
2147
  if (token === void 0) throw errorWithCode("placing an order requires a signed-in Huaqiu account (or HUAQIU_ACCESS_TOKEN)", "unauthorized", 401);
2148
+ if (!bundle.validation.ok) throw errorWithCode(`the fabrication package cannot be ordered: ${validationSummary(bundle.validation) ?? "validation failed"}`, "package-invalid", 422);
1747
2149
  const facts = bundle.facts;
1748
2150
  const endpoint = `${settings.baseUrl}${ORDER_PATHS[request.kind]}`;
1749
2151
  let parts;
@@ -1824,7 +2226,7 @@ var HardwareArtifactService = class {
1824
2226
  const ids = orderIdsFromUrl(responseUrl);
1825
2227
  const orderUrl = request.kind === "pcb" ? pcbOrderUrl(settings.pageBase, ids, token) : smtOrderUrl(settings.pageBase, ids, token) ?? smtOrderUrlFromBackend(responseUrl, token);
1826
2228
  if (orderUrl === void 0) throw errorWithCode("the order endpoint returned an order id that cannot form a page URL", "order-rejected", 502);
1827
- const launch = request.launch !== false;
2229
+ const launch = request.launch === true;
1828
2230
  let opened = { launched: false };
1829
2231
  if (launch) try {
1830
2232
  opened = {
@@ -1840,10 +2242,11 @@ var HardwareArtifactService = class {
1840
2242
  responseUrl,
1841
2243
  ...opened,
1842
2244
  status: opened.launched ? "launched" : "ready",
1843
- message: opened.launched ? `Opened the ${request.kind === "pcb" ? "PCB" : "assembly"} order page in your default browser.` : `The ${request.kind === "pcb" ? "PCB" : "assembly"} order page is ready; open the URL to continue.`,
2245
+ message: opened.launched ? `Opened the ${request.kind === "pcb" ? "PCB" : "assembly"} order page in the default browser.` : `The ${request.kind === "pcb" ? "PCB" : "assembly"} order page is ready at orderUrl.`,
1844
2246
  endpoint,
1845
2247
  facts,
1846
2248
  archive: bundle.archive,
2249
+ validation: bundle.validation,
1847
2250
  ...bundle.assembly === void 0 ? {} : { assembly: bundle.assembly }
1848
2251
  };
1849
2252
  }
@@ -2002,4 +2405,4 @@ function groupBomRows(table) {
2002
2405
  });
2003
2406
  }
2004
2407
  //#endregion
2005
- export { smtOrderUrl as _, DEFAULT_ORDER_PAGE_BASE as a, snapThickness as b, orderBomCsv as c, parsePositions as d, pcbOrderForm as f, smtOrderForm as g, readBoardFacts as h, DEFAULT_ORDER_BASE_URL as i, orderBomRows as l, positionsCsv as m, groupBomRows as n, ORDER_PATHS as o, pcbOrderUrl as p, parseCsv as r, ORDER_SOURCE_TID as s, HardwareArtifactService as t, orderIdsFromUrl as u, smtOrderUrlFromBackend as v, snapTraceTier as x, snapHoleTier as y };
2408
+ export { snapTraceTier as A, positionsCsv as C, smtOrderUrlFromBackend as D, smtOrderUrl as E, snapHoleTier as O, pcbOrderUrl as S, smtOrderForm as T, orderBomCsv as _, installRootFromExecutable as a, parsePositions as b, normalizeVersion as c, validateFabricationPackage as d, validationSummary as f, ORDER_SOURCE_TID as g, ORDER_PATHS as h, canonicalPath as i, snapThickness as k, resolveToolchain as l, DEFAULT_ORDER_PAGE_BASE as m, groupBomRows as n, installationRootOf as o, DEFAULT_ORDER_BASE_URL as p, parseCsv as r, label as s, HardwareArtifactService as t, expectedCopperLayers as u, orderBomRows as v, readBoardFacts as w, pcbOrderForm as x, orderIdsFromUrl as y };