bambu-printer-mcp 1.1.20 → 1.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CONTRIBUTORS.md CHANGED
@@ -6,6 +6,7 @@ Thank you to everyone who builds, tests, reports problems, and shares real print
6
6
 
7
7
  | Contributor | Contribution |
8
8
  | --- | --- |
9
+ | [JaviOFC](https://github.com/JaviOFC) | Reports the X2D identity rejection in [#36](https://github.com/DMontgomery40/bambu-printer-mcp/issues/36) and supplies current firmware, connection-mode, status-field, serial-prefix, and cloud-job evidence showing that `model_id` can contain a print-job identifier while `model` correctly identifies the printer. |
9
10
  | [Izzy Mansurov (sapoepsilon)](https://github.com/sapoepsilon) | Fixes Bambu Studio 02.08 P2S extruder-variant metadata and airduct-command inspection in [#33](https://github.com/DMontgomery40/bambu-printer-mcp/pull/33). Supplies regression tests and offline inspection evidence from four real P2S 0.6 mm PLA/PETG jobs and unsafe mutated copies; this contribution does not claim a physical print. |
10
11
  | [Boardy (@boardyai)](https://x.com/boardyai) | Raises the nozzle-verification question that informs the added printer safety checks. |
11
12
  | Fable red-team review, shared by David Montgomery | Supplies archive-ambiguity reproductions and hardware-safety review findings used for plate binding, upload checks, temperature policy, and human preflight. Network/security suggestions remain outside this hardware-safety release. |
@@ -13,11 +13,17 @@ function object(value) {
13
13
  return !!value && typeof value === "object" && !Array.isArray(value);
14
14
  }
15
15
  function observedIdentity(raw, configuredSerial) {
16
- const declarations = [raw.model_id, raw.model, raw.printer_type, raw.device?.devModel, raw.device?.dev_model]
16
+ const recognizedModelFromModelId = typeof raw.model_id === "string" && raw.model_id.trim()
17
+ ? normalizeModel(MODEL_IDS[raw.model_id.trim().toUpperCase()] ?? raw.model_id)
18
+ : undefined;
19
+ const declarations = [raw.model, raw.printer_type, raw.device?.devModel, raw.device?.dev_model]
17
20
  .filter(value => typeof value === "string" && value.trim());
18
21
  const models = declarations.map(value => normalizeModel(MODEL_IDS[value.trim().toUpperCase()] ?? value));
19
22
  if (models.some(model => !model))
20
23
  throw new Error("Printer reported an unknown model identity; cannot verify this printer.");
24
+ if (recognizedModelFromModelId)
25
+ models.unshift(recognizedModelFromModelId);
26
+ const hasReportedModel = models.length > 0;
21
27
  const serials = [raw.serial, raw.serial_number, raw.sn, raw.device?.sn,
22
28
  ...(Array.isArray(raw.modules) ? raw.modules.filter((module) => module?.name === "ota").map((module) => module.sn) : [])]
23
29
  .filter(value => typeof value === "string" && value.trim()).map(value => value.trim());
@@ -32,7 +38,7 @@ function observedIdentity(raw, configuredSerial) {
32
38
  if (new Set(models).size > 1)
33
39
  throw new Error("Printer returned contradictory model identity information.");
34
40
  const model = models[0];
35
- return { model, observedSerial: serials[0], identitySource: declarations.length ? "report" : "module-serial" };
41
+ return { model, observedSerial: serials[0], identitySource: hasReportedModel ? "report" : "module-serial" };
36
42
  }
37
43
  /** Only raw reports received after this request are evidence. Never read printer.data here. */
38
44
  export function readFreshPrinterStatus(printer, serial, timeoutMs = 5000) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bambu-printer-mcp",
3
- "version": "1.1.20",
3
+ "version": "1.1.21",
4
4
  "description": "MCP server for Bambu Lab 3D printers with STL manipulation, slicing, and print management",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
@@ -15,10 +15,15 @@ function object(value: unknown): value is Record<string, any> {
15
15
  return !!value && typeof value === "object" && !Array.isArray(value);
16
16
  }
17
17
  function observedIdentity(raw: Record<string, any>, configuredSerial: string) {
18
- const declarations = [raw.model_id, raw.model, raw.printer_type, raw.device?.devModel, raw.device?.dev_model]
18
+ const recognizedModelFromModelId = typeof raw.model_id === "string" && raw.model_id.trim()
19
+ ? normalizeModel(MODEL_IDS[raw.model_id.trim().toUpperCase()] ?? raw.model_id)
20
+ : undefined;
21
+ const declarations = [raw.model, raw.printer_type, raw.device?.devModel, raw.device?.dev_model]
19
22
  .filter(value => typeof value === "string" && value.trim());
20
23
  const models = declarations.map(value => normalizeModel(MODEL_IDS[value.trim().toUpperCase()] ?? value));
21
24
  if (models.some(model => !model)) throw new Error("Printer reported an unknown model identity; cannot verify this printer.");
25
+ if (recognizedModelFromModelId) models.unshift(recognizedModelFromModelId);
26
+ const hasReportedModel = models.length > 0;
22
27
  const serials = [raw.serial, raw.serial_number, raw.sn, raw.device?.sn,
23
28
  ...(Array.isArray(raw.modules) ? raw.modules.filter((module: any) => module?.name === "ota").map((module: any) => module.sn) : [])]
24
29
  .filter(value => typeof value === "string" && value.trim()).map(value => value.trim());
@@ -31,7 +36,7 @@ function observedIdentity(raw: Record<string, any>, configuredSerial: string) {
31
36
  }
32
37
  if (new Set(models).size > 1) throw new Error("Printer returned contradictory model identity information.");
33
38
  const model = models[0];
34
- return { model, observedSerial: serials[0], identitySource: declarations.length ? "report" : "module-serial" };
39
+ return { model, observedSerial: serials[0], identitySource: hasReportedModel ? "report" : "module-serial" };
35
40
  }
36
41
 
37
42
  /** Only raw reports received after this request are evidence. Never read printer.data here. */