@buda-ai/connector 0.1.15 → 0.1.17
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/dist/cli.js +27 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -517,7 +517,7 @@ import path2 from "path";
|
|
|
517
517
|
// package.json
|
|
518
518
|
var package_default = {
|
|
519
519
|
name: "@buda-ai/connector",
|
|
520
|
-
version: "0.1.
|
|
520
|
+
version: "0.1.16",
|
|
521
521
|
private: false,
|
|
522
522
|
type: "module",
|
|
523
523
|
publishConfig: {
|
|
@@ -2411,6 +2411,7 @@ import path6 from "path";
|
|
|
2411
2411
|
import { promisify } from "util";
|
|
2412
2412
|
var execFileAsync = promisify(execFile);
|
|
2413
2413
|
var RUNTIME_INSTALL_TIMEOUT_MS = 5 * 6e4;
|
|
2414
|
+
var WINDOWS_RENAME_RETRY_DELAYS_MS = [50, 100, 200, 400, 500, 500, 500, 500, 500];
|
|
2414
2415
|
var resolveBundledNodePlacement = (sourceRoot, sourceNode, pathApi = path6) => {
|
|
2415
2416
|
const relativeNode = pathApi.relative(sourceRoot, sourceNode);
|
|
2416
2417
|
return {
|
|
@@ -2418,6 +2419,23 @@ var resolveBundledNodePlacement = (sourceRoot, sourceNode, pathApi = path6) => {
|
|
|
2418
2419
|
relativeNode
|
|
2419
2420
|
};
|
|
2420
2421
|
};
|
|
2422
|
+
var isWindowsRenameContention = (error) => error instanceof Error && "code" in error && ["EACCES", "EBUSY", "EPERM"].includes(String(error.code));
|
|
2423
|
+
var renameStagedRuntime = async (source, destination, options = {}) => {
|
|
2424
|
+
const platform4 = options.platform ?? process.platform;
|
|
2425
|
+
const renamePath = options.renamePath ?? rename4;
|
|
2426
|
+
const wait4 = options.wait ?? ((milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds)));
|
|
2427
|
+
const delays = platform4 === "win32" ? WINDOWS_RENAME_RETRY_DELAYS_MS : [];
|
|
2428
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
2429
|
+
try {
|
|
2430
|
+
await renamePath(source, destination);
|
|
2431
|
+
return;
|
|
2432
|
+
} catch (error) {
|
|
2433
|
+
const delay = delays[attempt];
|
|
2434
|
+
if (delay === void 0 || !isWindowsRenameContention(error)) throw error;
|
|
2435
|
+
await wait4(delay);
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
};
|
|
2421
2439
|
var exists = async (filePath) => access(filePath).then(() => true).catch(() => false);
|
|
2422
2440
|
var runtimeRoot = () => process.env.BUDA_CONNECTOR_RUNTIME_ROOT || path6.join(homedir3(), ".buda", "runtime");
|
|
2423
2441
|
var runtimePlatformKey = `${process.platform}-${process.arch}-node${process.versions.modules}`;
|
|
@@ -2540,7 +2558,7 @@ async function ensureStableConnectorRuntime() {
|
|
|
2540
2558
|
};
|
|
2541
2559
|
await writeManifest(temporary, rebased);
|
|
2542
2560
|
await rm(finalDirectory, { recursive: true, force: true });
|
|
2543
|
-
await
|
|
2561
|
+
await renameStagedRuntime(temporary, finalDirectory);
|
|
2544
2562
|
return rebased;
|
|
2545
2563
|
} catch (error) {
|
|
2546
2564
|
await rm(temporary, { recursive: true, force: true });
|
|
@@ -2602,15 +2620,20 @@ var waitForDaemon = async (launchConfig, deadline) => {
|
|
|
2602
2620
|
};
|
|
2603
2621
|
var spawnInternalDaemon = async (launchConfig, mode, preparedRuntime, options = {}) => {
|
|
2604
2622
|
const runtime = preparedRuntime ?? await ensureStableConnectorRuntime();
|
|
2623
|
+
const debugDaemonStdio = process.env.BUDA_CONNECTOR_DEBUG_DAEMON_STDIO === "1";
|
|
2605
2624
|
const child = spawn(runtime.nodeExecutable, getRuntimeCommandArgs(runtime, mode, options), {
|
|
2606
2625
|
detached: true,
|
|
2607
2626
|
env: {
|
|
2608
2627
|
...process.env,
|
|
2609
2628
|
BUDA_CONNECTOR_INTERNAL_LAUNCH_CONFIG: JSON.stringify(launchConfig ?? {})
|
|
2610
2629
|
},
|
|
2611
|
-
stdio: "ignore",
|
|
2630
|
+
stdio: debugDaemonStdio ? ["ignore", "inherit", "inherit"] : "ignore",
|
|
2612
2631
|
windowsHide: true
|
|
2613
2632
|
});
|
|
2633
|
+
await new Promise((resolve, reject) => {
|
|
2634
|
+
child.once("error", reject);
|
|
2635
|
+
child.once("spawn", resolve);
|
|
2636
|
+
});
|
|
2614
2637
|
child.unref();
|
|
2615
2638
|
};
|
|
2616
2639
|
var stopOlderIdleDaemon = async (config, status) => {
|
|
@@ -3732,6 +3755,7 @@ var writeJournal = async (journalPath, journal) => {
|
|
|
3732
3755
|
}
|
|
3733
3756
|
};
|
|
3734
3757
|
var syncDirectory2 = async (directory) => {
|
|
3758
|
+
if (process.platform === "win32") return;
|
|
3735
3759
|
const handle = await open2(directory, constants2.O_RDONLY);
|
|
3736
3760
|
try {
|
|
3737
3761
|
await handle.sync();
|