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.
- package/CONTRIBUTORS.md +5 -3
- package/README.md +28 -8
- package/dist/bambu-connect.d.ts +7 -0
- package/dist/bambu-connect.js +77 -0
- package/dist/bambu-native.d.ts +66 -0
- package/dist/bambu-native.js +609 -0
- package/dist/bambu-network-bridge.d.ts +4 -0
- package/dist/bambu-network-bridge.js +3 -0
- package/dist/index.js +644 -109
- package/dist/printers/bambu.d.ts +51 -16
- package/dist/printers/bambu.js +392 -153
- package/dist/safety/archive.d.ts +11 -0
- package/dist/safety/archive.js +214 -0
- package/dist/safety/artifact.d.ts +6 -0
- package/dist/safety/artifact.js +66 -0
- package/dist/safety/limits.d.ts +29 -0
- package/dist/safety/limits.js +100 -0
- package/dist/safety/print-file.d.ts +25 -0
- package/dist/safety/print-file.js +514 -0
- package/dist/safety/printer-state.d.ts +43 -0
- package/dist/safety/printer-state.js +351 -0
- package/native/bambu-native-print.cpp +758 -0
- package/package.json +7 -3
- package/scripts/build-bambu-native.zsh +33 -0
- package/src/bambu-connect.ts +100 -0
- package/src/bambu-native.ts +722 -0
- package/src/bambu-network-bridge.ts +7 -0
- package/src/index.ts +720 -149
- package/src/printers/bambu.ts +374 -182
- package/src/safety/archive.ts +181 -0
- package/src/safety/artifact.ts +58 -0
- package/src/safety/limits.ts +93 -0
- package/src/safety/print-file.ts +352 -0
- package/src/safety/printer-state.ts +323 -0
package/dist/printers/bambu.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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<
|
|
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
|
-
*
|
|
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
|
|
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
|
-
* -
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
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
|
/**
|