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
|
@@ -26,6 +26,10 @@ export type BambuNetworkBridgeOptions = {
|
|
|
26
26
|
countryCode?: string;
|
|
27
27
|
userInfo?: string;
|
|
28
28
|
timeoutMs?: number;
|
|
29
|
+
/** Trusted in-process preflight; never populated from tool arguments. */
|
|
30
|
+
beforeDispatch?: (method: string) => Promise<void>;
|
|
31
|
+
assertDispatchAllowed?: (method: string) => void;
|
|
32
|
+
onDispatched?: (method: string) => void;
|
|
29
33
|
};
|
|
30
34
|
|
|
31
35
|
export type BambuNetworkBridgeStatus = {
|
|
@@ -242,6 +246,7 @@ export class BambuNetworkBridge {
|
|
|
242
246
|
}
|
|
243
247
|
|
|
244
248
|
await this.ensureStarted(options.bridgeCommand);
|
|
249
|
+
await options.beforeDispatch?.(method);
|
|
245
250
|
|
|
246
251
|
const id = this.nextRequestId++;
|
|
247
252
|
const requestPayload = Buffer.from(JSON.stringify({ method, payload }), "utf8");
|
|
@@ -261,6 +266,7 @@ export class BambuNetworkBridge {
|
|
|
261
266
|
this.pending.set(id, { method, resolve, reject, timer });
|
|
262
267
|
|
|
263
268
|
try {
|
|
269
|
+
options.assertDispatchAllowed?.(method);
|
|
264
270
|
this.child!.stdin.write(frame, (error) => {
|
|
265
271
|
if (error) {
|
|
266
272
|
const pending = this.pending.get(id);
|
|
@@ -271,6 +277,7 @@ export class BambuNetworkBridge {
|
|
|
271
277
|
}
|
|
272
278
|
}
|
|
273
279
|
});
|
|
280
|
+
options.onDispatched?.(method);
|
|
274
281
|
} catch (error) {
|
|
275
282
|
clearTimeout(timer);
|
|
276
283
|
this.pending.delete(id);
|