bambu-printer-mcp 1.0.8 → 1.1.2

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.
@@ -10,6 +10,15 @@ interface BambuPrintOptionsInternal {
10
10
  layerInspect?: boolean;
11
11
  timelapse?: boolean;
12
12
  amsMapping?: number[];
13
+ /**
14
+ * Per-used-filament absolute tray index, one entry per position in the
15
+ * selected plate's `filament_ids`. Example: plate uses project filament 1
16
+ * only, and you want to pull from AMS 0 tray 1 -> pass `[1]`. The server
17
+ * expands this into the project-level `ams_mapping` array at the right
18
+ * position automatically (H2-series). Preferred over `amsMapping` for
19
+ * ergonomic callers; `amsMapping` takes precedence if both are set.
20
+ */
21
+ amsSlots?: number[];
13
22
  md5?: string;
14
23
  }
15
24
  export declare class BambuImplementation {
@@ -20,11 +29,35 @@ export declare class BambuImplementation {
20
29
  getStatus(host: string, serial: string, token: string): Promise<any>;
21
30
  print3mf(host: string, serial: string, token: string, options: BambuPrintOptionsInternal): Promise<any>;
22
31
  cancelJob(host: string, serial: string, token: string): Promise<any>;
32
+ pauseJob(host: string, serial: string, token: string): Promise<any>;
33
+ resumeJob(host: string, serial: string, token: string): Promise<any>;
34
+ clearHmsErrors(host: string, serial: string, token: string): Promise<any>;
35
+ setPrintSpeed(host: string, serial: string, token: string, speedMode: string | number): Promise<any>;
36
+ setAirductMode(host: string, serial: string, token: string, mode: string): Promise<any>;
37
+ rereadAmsRfid(host: string, serial: string, token: string, amsId: number, slotId: number): Promise<any>;
23
38
  setTemperature(host: string, serial: string, token: string, component: string, temperature: number): Promise<{
24
39
  status: string;
25
40
  message: string;
26
41
  command: string;
27
42
  }>;
43
+ setFanSpeed(host: string, serial: string, token: string, fan: string | number, speed: number): Promise<{
44
+ status: string;
45
+ message: string;
46
+ fan: number;
47
+ speed: number;
48
+ }>;
49
+ setLight(host: string, serial: string, token: string, light: string, mode: string): Promise<{
50
+ status: string;
51
+ message: string;
52
+ light: string;
53
+ mode: string;
54
+ }>;
55
+ setAmsDrying(host: string, serial: string, token: string, action: string, amsId: number): Promise<any>;
56
+ skipObjects(host: string, serial: string, token: string, objectIds: number[]): Promise<{
57
+ status: string;
58
+ message: string;
59
+ object_ids: number[];
60
+ }>;
28
61
  getFiles(host: string, serial: string, token: string): Promise<{
29
62
  files: string[];
30
63
  directories: Record<string, string[]>;
@@ -39,6 +72,105 @@ export declare class BambuImplementation {
39
72
  message: string;
40
73
  file: string;
41
74
  }>;
75
+ /**
76
+ * Capture a single JPEG frame from the printer's chamber camera.
77
+ *
78
+ * Protocol per https://github.com/Doridian/OpenBambuAPI/blob/main/video.md
79
+ *
80
+ * Connect TLS to <host>:6000 (self-signed cert -- skip verification).
81
+ * Send an 80-byte auth packet:
82
+ * [0..4] uint32 LE payload size = 0x40 (64)
83
+ * [4..8] uint32 LE type = 0x3000
84
+ * [8..12] uint32 LE flags = 0
85
+ * [12..16] uint32 LE 0
86
+ * [16..48] "bblp" + null padding to 32 bytes
87
+ * [48..80] access token + null padding to 32 bytes
88
+ *
89
+ * The server then streams frames as repeating:
90
+ * [0..4] uint32 LE payload size
91
+ * [4..8] uint32 LE itrack (0)
92
+ * [8..12] uint32 LE flags (1)
93
+ * [12..16] uint32 LE 0
94
+ * [16..16+payloadSize] JPEG (FF D8 ... FF D9)
95
+ *
96
+ * Verified models per upstream docs: A1, A1 mini, P1S, P1P. X1/X1C/X1E
97
+ * and P2S use RTSP on port 322 instead -- not implemented yet. H2/H2S/H2D
98
+ * are not documented; we fail fast rather than guess at the protocol.
99
+ *
100
+ * Read-only; no confirm gate. Default 8s timeout for cold-start latency.
101
+ */
102
+ cameraSnapshot(host: string, _serial: string, token: string, options?: {
103
+ savePath?: string;
104
+ timeoutMs?: number;
105
+ bambuModel?: string;
106
+ /**
107
+ * Reserved. Earlier this flag let callers probe the H2 series via
108
+ * the A1/P1 TCP-on-6000 path. Diagnostics confirmed the printer
109
+ * does not speak that protocol; H2 uses RTSP, same as X1. The
110
+ * flag is now ignored. Kept on the type to avoid breaking
111
+ * existing callers.
112
+ */
113
+ experimental?: boolean;
114
+ /**
115
+ * Optional override for the ffmpeg binary path used by the RTSP
116
+ * path. Defaults to `ffmpeg` (relies on $PATH).
117
+ */
118
+ ffmpegPath?: string;
119
+ }): Promise<{
120
+ status: string;
121
+ format: string;
122
+ sizeBytes: number;
123
+ base64: string;
124
+ savedTo?: string;
125
+ width?: number;
126
+ height?: number;
127
+ note?: string;
128
+ transport?: "tcp-6000" | "rtsps-322";
129
+ }>;
130
+ /**
131
+ * Pull a single JPEG frame from the printer's RTSP/RTSPS stream using
132
+ * ffmpeg. Used for X1, P2S, and H2 series.
133
+ *
134
+ * URL pattern verified against HA bambulab's models.py example:
135
+ * rtsps://bblp:<access_code>@<host>:322/streaming/live/1
136
+ *
137
+ * ffmpeg invocation:
138
+ * ffmpeg -rtsp_transport tcp -i <url> -frames:v 1 -f image2 -c:v mjpeg -y <out>
139
+ *
140
+ * -rtsp_transport tcp avoids UDP NAT/firewall issues. -frames:v 1
141
+ * makes ffmpeg exit as soon as one frame lands. -y overwrites the temp
142
+ * file. The Bambu printer presents a self-signed cert; ffmpeg's TLS
143
+ * layer accepts that by default (no host verification).
144
+ */
145
+ private fetchRtspCameraFrame;
146
+ /**
147
+ * Open the TLS-on-6000 socket, send the 80-byte auth packet, and read
148
+ * a single complete JPEG frame. Returns the JPEG bytes.
149
+ */
150
+ private fetchTcpCameraFrame;
151
+ /**
152
+ * Delete a single file from the printer's SD card via FTPS.
153
+ *
154
+ * Destructive. Caller MUST set confirm=true; otherwise we return without
155
+ * touching the printer. Path is normalized the same way uploadFile()
156
+ * normalizes -- if the caller passes a bare filename, we look in cache/.
157
+ * Path traversal (`..`) is rejected.
158
+ *
159
+ * Only the printer-managed directories (cache/, timelapse/, logs/) are
160
+ * accepted as parents to avoid letting an agent wander further into the
161
+ * filesystem than expected.
162
+ */
163
+ deleteFile(host: string, _serial: string, token: string, filename: string, confirm: unknown): Promise<{
164
+ status: string;
165
+ deleted: boolean;
166
+ remotePath: string;
167
+ message?: string;
168
+ }>;
169
+ /**
170
+ * Delete a single remote file via FTPS, using basic-ftp directly so we
171
+ * get the same TLS-session-ticket handshake as ftpUpload().
172
+ */
173
+ private ftpDelete;
42
174
  /**
43
175
  * Upload a file to the printer via FTP using basic-ftp directly.
44
176
  * Bypasses bambu-js's sendFile which has a double-path bug (ensureDir CDs
@@ -46,6 +178,7 @@ export declare class BambuImplementation {
46
178
  * again, resulting in e.g. /cache/cache/file.3mf).
47
179
  */
48
180
  private ftpUpload;
181
+ private waitForTlsSession;
49
182
  disconnectAll(): Promise<void>;
50
183
  }
51
184
  export {};