bambu-printer-mcp 1.1.12 → 1.1.14

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,11 @@
1
+ import { inspectPrintFile } from "../safety/print-file.js";
2
+ import { type PrinterStateRequirements } from "../safety/printer-state.js";
1
3
  export declare function assertDirectPrintSupported(model: string | undefined, serial?: string): void;
2
4
  interface BambuPrintOptionsInternal {
3
5
  projectName: string;
4
6
  filePath: string;
5
7
  bambuModel?: string;
8
+ nozzleDiameters?: number[];
6
9
  useAMS?: boolean;
7
10
  plateIndex?: number;
8
11
  bedType?: string;
@@ -24,20 +27,33 @@ interface BambuPrintOptionsInternal {
24
27
  md5?: string;
25
28
  }
26
29
  export declare class BambuImplementation {
30
+ private readonly confirm?;
27
31
  private printerStore;
28
- constructor();
32
+ private checkedJobs;
33
+ private clearedErrors;
34
+ constructor(confirm?: ((message: string) => Promise<boolean>) | undefined);
35
+ confirmHardwareAction(message: string, physicalCheck?: boolean): Promise<void>;
36
+ private finishedJobIdentity;
37
+ confirmPrintPreflight(serial: string, status: any, inspection: Awaited<ReturnType<typeof inspectPrintFile>>): Promise<string | undefined>;
38
+ assertBedClearance(status: any, confirmedFinishedJob: string | undefined): void;
29
39
  private getPrinter;
40
+ /** Internal handoff from a successful inspected transport; never exposed as an MCP tool. */
41
+ recordCheckedJob(host: string, serial: string, remotePath: string, requirements: PrinterStateRequirements): void;
42
+ private validateLoadedGcodeState;
30
43
  private resolveProjectFileMetadata;
44
+ /** Safety reads never use the display cache or configured-serial model inference. */
45
+ getSafetyStatus(host: string, serial: string, token: string): Promise<any>;
31
46
  getStatus(host: string, serial: string, token: string): Promise<any>;
32
47
  print3mf(host: string, serial: string, token: string, options: BambuPrintOptionsInternal): Promise<any>;
33
- cancelJob(host: string, serial: string, token: string): Promise<any>;
34
- pauseJob(host: string, serial: string, token: string): Promise<any>;
35
- resumeJob(host: string, serial: string, token: string): Promise<any>;
36
- clearHmsErrors(host: string, serial: string, token: string): Promise<any>;
48
+ private print3mfPrepared;
49
+ cancelJob(host: string, serial: string, token: string, dispatch?: () => Promise<any>): Promise<any>;
50
+ pauseJob(host: string, serial: string, token: string, dispatch?: () => Promise<any>): Promise<any>;
51
+ resumeJob(host: string, serial: string, token: string, dispatch?: (assertActive: () => void, beforeDispatch: () => Promise<void>) => Promise<any>): Promise<any>;
52
+ clearHmsErrors(host: string, serial: string, token: string, dispatch?: (assertActive: () => void, beforeDispatch: () => Promise<void>) => Promise<any>): Promise<any>;
37
53
  setPrintSpeed(host: string, serial: string, token: string, speedMode: string | number): Promise<any>;
38
54
  setAirductMode(host: string, serial: string, token: string, mode: string): Promise<any>;
39
55
  rereadAmsRfid(host: string, serial: string, token: string, amsId: number, slotId: number): Promise<any>;
40
- setTemperature(host: string, serial: string, token: string, component: string, temperature: number): Promise<{
56
+ setTemperature(host: string, serial: string, token: string, component: string, temperature: unknown, bambuModel?: string, material?: string, nozzleDiameter?: number, dispatch?: (heater: "bed" | "nozzle", target: number, assertActive: () => void, beforeDispatch?: () => Promise<void>) => Promise<any>): Promise<{
41
57
  status: string;
42
58
  message: string;
43
59
  command: string;
@@ -68,12 +84,28 @@ export declare class BambuImplementation {
68
84
  name: string;
69
85
  exists: boolean;
70
86
  }>;
71
- uploadFile(host: string, serial: string, token: string, filePath: string, filename: string, print: boolean, bambuModel?: string): Promise<Record<string, unknown>>;
87
+ uploadFile(host: string, serial: string, token: string, filePath: string, filename: string, print: boolean, bambuModel?: string, upload?: (snapshot: string, destination: string, assertActive: () => void) => Promise<void>): Promise<{
88
+ status: string;
89
+ uploaded: boolean;
90
+ remotePath: string;
91
+ printRequested: boolean;
92
+ inspected: boolean;
93
+ } | {
94
+ status: string;
95
+ uploaded: boolean;
96
+ printRequested: boolean;
97
+ remotePath: string;
98
+ message: string;
99
+ }>;
100
+ private printRawPrepared;
72
101
  startJob(host: string, serial: string, token: string, filename: string, bambuModel?: string): Promise<{
73
102
  status: string;
103
+ uploaded: boolean;
104
+ printRequested: boolean;
105
+ remotePath: string;
74
106
  message: string;
75
- file: string;
76
107
  }>;
108
+ private ftpDownload;
77
109
  /**
78
110
  * Capture a single JPEG frame from the printer's chamber camera.
79
111
  *
@@ -96,8 +128,8 @@ export declare class BambuImplementation {
96
128
  * [16..16+payloadSize] JPEG (FF D8 ... FF D9)
97
129
  *
98
130
  * Verified models per upstream docs: A1, A1 mini, P1S, P1P. X1/X1C/X1E
99
- * and P2S use RTSP on port 322 instead. H2/H2S/H2D/H2C
100
- * are not documented; we fail fast rather than guess at the protocol.
131
+ * and P2S use RTSP on port 322 instead. H2/H2S/H2D/H2C/X2D
132
+ * use the same RTSP path.
101
133
  *
102
134
  * Read-only; no confirm gate. Default 8s timeout for cold-start latency.
103
135
  */
@@ -131,18 +163,21 @@ export declare class BambuImplementation {
131
163
  }>;
132
164
  /**
133
165
  * Pull a single JPEG frame from the printer's RTSP/RTSPS stream using
134
- * ffmpeg. Used for X1, P2S, and H2 series.
166
+ * ffmpeg. Used for X1, P2S, H2-family printers, and X2D.
135
167
  *
136
168
  * URL pattern verified against HA bambulab's models.py example:
137
169
  * rtsps://bblp:<access_code>@<host>:322/streaming/live/1
138
170
  *
139
171
  * ffmpeg invocation:
140
- * ffmpeg -rtsp_transport tcp -i <url> -frames:v 1 -f image2 -c:v mjpeg -y <out>
172
+ * ffmpeg -tls_verify 0 -rtsp_transport tcp -i <url> -frames:v 1 -f image2 -c:v mjpeg -y <out>
141
173
  *
142
- * -rtsp_transport tcp avoids UDP NAT/firewall issues. -frames:v 1
143
- * makes ffmpeg exit as soon as one frame lands. -y overwrites the temp
144
- * file. The Bambu printer presents a self-signed cert; ffmpeg's TLS
145
- * layer accepts that by default (no host verification).
174
+ * -tls_verify 0 accepts the printer's self-signed certificate. This is
175
+ * consistent with the existing local-device TLS/FTPS paths, which do not
176
+ * have a public CA chain or hostname that ffmpeg can validate. The
177
+ * connection is still encrypted and remains scoped to the configured
178
+ * printer host. -rtsp_transport tcp avoids UDP NAT/firewall issues.
179
+ * -frames:v 1 makes ffmpeg exit as soon as one frame lands. -y overwrites
180
+ * the temp file.
146
181
  */
147
182
  private fetchRtspCameraFrame;
148
183
  /**