bambu-printer-mcp 1.1.84 → 1.1.85

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
+ | [Rowan McMahon (RowanMcMahon)](https://github.com/RowanMcMahon) | Reports A1 firmware 01.08.01.00 retaining `FAILED` after a stopped job and contributes the narrow terminal-state fix and regression tests in [#133](https://github.com/DMontgomery40/bambu-printer-mcp/pull/133). Supplies fresh MQTT evidence and reports a subsequent job reaching `FINISH`; this is contributor-reported status, not inspected physical-part verification. |
9
10
  | [billh-hub](https://github.com/billh-hub) | Reports and isolates three official H2C time-lapse and filament-change command rejections in [#84](https://github.com/DMontgomery40/bambu-printer-mcp/issues/84), supplies emitted commands and multi-colour reproduction evidence, and distinguishes the unknown cooling parameter for source-backed investigation. The correction preserves independent safety checks; no maintainer physical printing is claimed. |
10
11
  | [Steve Pritchard (sjpritchard)](https://github.com/sjpritchard) | Reports and diagnoses H2C per-variant first-layer temperature rejection in [#81](https://github.com/DMontgomery40/bambu-printer-mcp/issues/81), supplies the exact official preset metadata and reproduction, and identifies the upstream variant-mapping contract. Verification uses synthetic slicing and offline regressions, not physical printing. |
11
12
  | [JackCA](https://github.com/JackCA) | Reports an X2D retaining `FAILED` with no active print/HMS error after cancellation, supplies read-only printer evidence for `fail_reason: 0300400C`, and contributes narrow canceled-task recovery, job-bound physical confirmation, a recheck of the job and error codes after connecting and before clearing hardware errors on any model, and regression coverage in [#76](https://github.com/DMontgomery40/bambu-printer-mcp/pull/76). Physical print delivery after the fix remains unverified. |
@@ -59,3 +60,7 @@ This is community recognition, separate from code authorship in this repository.
59
60
  Thanks to the [MQTT.js contributors](https://github.com/mqttjs/MQTT.js/releases/tag/v5.16.1), [proxy-addr maintainers](https://github.com/jshttp/proxy-addr/releases/tag/v2.0.8), and [source-map-js maintainers](https://github.com/7rulnik/source-map-js) for the reconnect and security fixes incorporated in 1.1.31. This recognizes upstream dependency work separately from authorship in this repository.
60
61
 
61
62
  Thanks to the [OrcaSlicer contributors](https://github.com/OrcaSlicer/OrcaSlicer/releases/tag/v2.5.0) for the published 2.5.0 source and macOS build used to reproduce and validate shared nozzle-flow metadata. This credits upstream software and contracts; it does not claim hardware verification or authorship of this repository’s fix.
63
+
64
+ Thanks to the [basic-ftp maintainers](https://github.com/patrickjuchli/basic-ftp/releases/tag/v6.2.6) and [MCP TypeScript SDK contributors](https://github.com/modelcontextprotocol/typescript-sdk) for compatible patch updates, including the upstream recursive-download path traversal correction.
65
+
66
+ - **David Montgomery** — reports and reproduces the macOS installed-slicer `bamboo_model` test scratch leak (#139); the regression is verified with the real isolated Bambu Studio CLI and mocked scratch cleanup.
@@ -5,7 +5,7 @@ import { cameraNumber } from "./camera-tools.js";
5
5
  import { cameraFrameParser, cameraAuth } from "./camera-wire.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { controlReply, refusedControlMessage } from "../control-reply.js";
8
- import { isFinishedP1SJob, isCancelledX2DJob, readFreshPrinterStatus } from "../safety/printer-state.js";
8
+ import { isFinishedIdleJob, isCancelledX2DJob, readFreshPrinterStatus } from "../safety/printer-state.js";
9
9
  import fs from "node:fs/promises";
10
10
  import { createReadStream, readFileSync, existsSync, mkdirSync, writeFileSync, renameSync, rmSync } from "node:fs";
11
11
  import path from "node:path";
@@ -659,7 +659,7 @@ export class BambuImplementation {
659
659
  }
660
660
  finishedJobIdentity(status) {
661
661
  const raw = status.raw;
662
- return raw.gcode_state === "FINISH" || (isCancelledX2DJob(raw, String(status.model ?? "")) || isFinishedP1SJob(raw, String(status.model ?? "")))
662
+ return raw.gcode_state === "FINISH" || (isCancelledX2DJob(raw, String(status.model ?? "")) || isFinishedIdleJob(raw, String(status.model ?? "")))
663
663
  ? printJobIdentity(raw)
664
664
  : undefined;
665
665
  }
@@ -51,10 +51,14 @@ export declare function finiteNumber(value: unknown): number | undefined;
51
51
  * and print dispatch rechecks the identity of the observed job.
52
52
  */
53
53
  export declare function isCancelledX2DJob(raw: Record<string, any>, model: string): boolean;
54
- /** Bambu Studio 2.8.2.61 marks FAILED as finished. Limit P1S recovery to
54
+ /** Models observed retaining FAILED for a named prior job while explicitly reporting
55
+ * idle with no print error and no HMS: P1S (#87) and A1 firmware 01.08.01.00 after a
56
+ * user-stopped job. Add a model only with that hardware evidence. */
57
+ export declare const FINISHED_WHEN_FAILED_IDLE_MODELS: ReadonlySet<string>;
58
+ /** Bambu Studio 2.8.2.61 marks FAILED as finished. Limit recovery to the models above and
55
59
  * a named prior job explicitly reporting idle, no print error and no HMS.
56
60
  * Dispatch rechecks the observed job identity. */
57
- export declare function isFinishedP1SJob(raw: Record<string, any>, model: string): boolean;
61
+ export declare function isFinishedIdleJob(raw: Record<string, any>, model: string): boolean;
58
62
  /** Nozzles whose reported diameter and type are configured settings rather than chip readings. */
59
63
  export declare function unchippedNozzles(raw: unknown): number[];
60
64
  export type HmsEntry = {
@@ -131,11 +131,17 @@ export function isCancelledX2DJob(raw, model) {
131
131
  finiteNumber(raw.print_error) === 0 && finiteNumber(raw.fail_reason) === 0x0300400c &&
132
132
  [raw.gcode_file, raw.subtask_name].some(value => typeof value === "string" && value.trim().length > 0);
133
133
  }
134
- /** Bambu Studio 2.8.2.61 marks FAILED as finished. Limit P1S recovery to
134
+ /** Models observed retaining FAILED for a named prior job while explicitly reporting
135
+ * idle with no print error and no HMS: P1S (#87) and A1 firmware 01.08.01.00 after a
136
+ * user-stopped job. Add a model only with that hardware evidence. */
137
+ export const FINISHED_WHEN_FAILED_IDLE_MODELS = new Set(["p1s", "a1"]);
138
+ /** Bambu Studio 2.8.2.61 marks FAILED as finished. Limit recovery to the models above and
135
139
  * a named prior job explicitly reporting idle, no print error and no HMS.
136
140
  * Dispatch rechecks the observed job identity. */
137
- export function isFinishedP1SJob(raw, model) {
138
- return normalizeModel(model) === "p1s" && raw.gcode_state === "FAILED" && raw.print_type === "idle" &&
141
+ export function isFinishedIdleJob(raw, model) {
142
+ const normalized = normalizeModel(model);
143
+ return normalized !== undefined && FINISHED_WHEN_FAILED_IDLE_MODELS.has(normalized) &&
144
+ raw.gcode_state === "FAILED" && raw.print_type === "idle" &&
139
145
  finiteNumber(raw.print_error) === 0 && Array.isArray(raw.hms) && raw.hms.length === 0 &&
140
146
  [raw.gcode_file, raw.subtask_name].some(value => typeof value === "string" && value.trim().length > 0);
141
147
  }
@@ -329,7 +335,7 @@ export function isPauseNotice(raw, requireIdle) {
329
335
  }
330
336
  function validateErrors(raw, requireIdle, serial, model) {
331
337
  const state = typeof raw.gcode_state === "string" ? raw.gcode_state.toUpperCase() : "UNKNOWN";
332
- const terminal = isCancelledX2DJob(raw, model) || isFinishedP1SJob(raw, model);
338
+ const terminal = isCancelledX2DJob(raw, model) || isFinishedIdleJob(raw, model);
333
339
  if (requireIdle && !["IDLE", "FINISH"].includes(state) && !terminal)
334
340
  throw new PrinterRefusal("printer-not-ready", `Printer state ${state} is not safely idle.`);
335
341
  if (!requireIdle && !["IDLE", "FINISH", "RUNNING", "PAUSE"].includes(state) && !terminal)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bambu-printer-mcp",
3
- "version": "1.1.84",
3
+ "version": "1.1.85",
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": {
@@ -48,9 +48,9 @@
48
48
  "author": "David Montgomery",
49
49
  "license": "GPL-2.0",
50
50
  "dependencies": {
51
- "@modelcontextprotocol/sdk": "^1.32.1",
51
+ "@modelcontextprotocol/sdk": "^1.32.2",
52
52
  "bambu-node": "3.22.21",
53
- "basic-ftp": "^6.2.3",
53
+ "basic-ftp": "^6.2.6",
54
54
  "dotenv": "^16.3.1",
55
55
  "jszip": "^3.10.2",
56
56
  "mqtt": "^5.16.1",
@@ -5,7 +5,7 @@ import {cameraNumber} from "./camera-tools.js";
5
5
  import {cameraFrameParser, cameraAuth} from "./camera-wire.js";
6
6
  import { createHash } from "node:crypto";
7
7
  import { controlReply, refusedControlMessage, type ControlReply } from "../control-reply.js";
8
- import { isFinishedP1SJob, isCancelledX2DJob, readFreshPrinterStatus } from "../safety/printer-state.js";
8
+ import { isFinishedIdleJob, isCancelledX2DJob, readFreshPrinterStatus } from "../safety/printer-state.js";
9
9
  import fs from "node:fs/promises";
10
10
  import { createReadStream, readFileSync, existsSync, mkdirSync, writeFileSync, renameSync, rmSync } from "node:fs";
11
11
  import path from "node:path";
@@ -790,7 +790,7 @@ export class BambuImplementation {
790
790
 
791
791
  private finishedJobIdentity(status: any): string | undefined {
792
792
  const raw = status.raw;
793
- return raw.gcode_state === "FINISH" || (isCancelledX2DJob(raw, String(status.model ?? "")) || isFinishedP1SJob(raw, String(status.model ?? "")))
793
+ return raw.gcode_state === "FINISH" || (isCancelledX2DJob(raw, String(status.model ?? "")) || isFinishedIdleJob(raw, String(status.model ?? "")))
794
794
  ? printJobIdentity(raw)
795
795
  : undefined;
796
796
  }
@@ -142,11 +142,17 @@ export function isCancelledX2DJob(raw: Record<string, any>, model: string): bool
142
142
  finiteNumber(raw.print_error) === 0 && finiteNumber(raw.fail_reason) === 0x0300400c &&
143
143
  [raw.gcode_file, raw.subtask_name].some(value => typeof value === "string" && value.trim().length > 0);
144
144
  }
145
- /** Bambu Studio 2.8.2.61 marks FAILED as finished. Limit P1S recovery to
145
+ /** Models observed retaining FAILED for a named prior job while explicitly reporting
146
+ * idle with no print error and no HMS: P1S (#87) and A1 firmware 01.08.01.00 after a
147
+ * user-stopped job. Add a model only with that hardware evidence. */
148
+ export const FINISHED_WHEN_FAILED_IDLE_MODELS: ReadonlySet<string> = new Set(["p1s", "a1"]);
149
+ /** Bambu Studio 2.8.2.61 marks FAILED as finished. Limit recovery to the models above and
146
150
  * a named prior job explicitly reporting idle, no print error and no HMS.
147
151
  * Dispatch rechecks the observed job identity. */
148
- export function isFinishedP1SJob(raw: Record<string, any>, model: string): boolean {
149
- return normalizeModel(model) === "p1s" && raw.gcode_state === "FAILED" && raw.print_type === "idle" &&
152
+ export function isFinishedIdleJob(raw: Record<string, any>, model: string): boolean {
153
+ const normalized = normalizeModel(model);
154
+ return normalized !== undefined && FINISHED_WHEN_FAILED_IDLE_MODELS.has(normalized) &&
155
+ raw.gcode_state === "FAILED" && raw.print_type === "idle" &&
150
156
  finiteNumber(raw.print_error) === 0 && Array.isArray(raw.hms) && raw.hms.length === 0 &&
151
157
  [raw.gcode_file, raw.subtask_name].some(value => typeof value === "string" && value.trim().length > 0);
152
158
  }
@@ -338,7 +344,7 @@ export function isPauseNotice(raw: Record<string, any>, requireIdle: boolean): b
338
344
  }
339
345
  function validateErrors(raw: Record<string,any>, requireIdle: boolean, serial: string, model: string) {
340
346
  const state = typeof raw.gcode_state === "string" ? raw.gcode_state.toUpperCase() : "UNKNOWN";
341
- const terminal = isCancelledX2DJob(raw, model) || isFinishedP1SJob(raw, model);
347
+ const terminal = isCancelledX2DJob(raw, model) || isFinishedIdleJob(raw, model);
342
348
  if (requireIdle && !["IDLE","FINISH"].includes(state) && !terminal) throw new PrinterRefusal("printer-not-ready", `Printer state ${state} is not safely idle.`);
343
349
  if (!requireIdle && !["IDLE","FINISH","RUNNING","PAUSE"].includes(state) && !terminal) throw new Error(`Printer state ${state} is unknown or failed.`);
344
350
  if (finiteNumber(raw.print_error) !== 0 && !isPauseNotice(raw, requireIdle)) throw new Error("Printer reports a print error or did not report its error state.");