bambu-printer-mcp 1.0.8 → 1.1.4

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