bitfab-cli 0.2.86 → 0.2.88
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/index.js +48 -11
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -9850,8 +9850,8 @@ async function pingSocket(socketPath) {
|
|
|
9850
9850
|
socket.write('{"cmd":"ping"}\n');
|
|
9851
9851
|
});
|
|
9852
9852
|
let buffer = "";
|
|
9853
|
-
socket.on("data", (
|
|
9854
|
-
buffer +=
|
|
9853
|
+
socket.on("data", (chunk2) => {
|
|
9854
|
+
buffer += chunk2.toString();
|
|
9855
9855
|
if (buffer.includes("\n")) {
|
|
9856
9856
|
clearTimeout(timeout);
|
|
9857
9857
|
socket.destroy();
|
|
@@ -9999,6 +9999,7 @@ var DaemonClient = class {
|
|
|
9999
9999
|
buffer = "";
|
|
10000
10000
|
responseQueue = [];
|
|
10001
10001
|
eventHandler = null;
|
|
10002
|
+
disconnectHandler = null;
|
|
10002
10003
|
socketPath;
|
|
10003
10004
|
constructor(socketPath) {
|
|
10004
10005
|
this.socketPath = socketPath ?? SOCKET_PATH;
|
|
@@ -10010,8 +10011,8 @@ var DaemonClient = class {
|
|
|
10010
10011
|
this.socket = socket;
|
|
10011
10012
|
resolve();
|
|
10012
10013
|
});
|
|
10013
|
-
socket.on("data", (
|
|
10014
|
-
this.buffer +=
|
|
10014
|
+
socket.on("data", (chunk2) => {
|
|
10015
|
+
this.buffer += chunk2.toString();
|
|
10015
10016
|
this.drain();
|
|
10016
10017
|
});
|
|
10017
10018
|
socket.on("error", (err) => {
|
|
@@ -10020,9 +10021,14 @@ var DaemonClient = class {
|
|
|
10020
10021
|
return;
|
|
10021
10022
|
}
|
|
10022
10023
|
this.socket = null;
|
|
10024
|
+
this.disconnectHandler?.(err);
|
|
10023
10025
|
});
|
|
10024
10026
|
socket.on("close", () => {
|
|
10027
|
+
const wasConnected = this.socket !== null;
|
|
10025
10028
|
this.socket = null;
|
|
10029
|
+
if (wasConnected) {
|
|
10030
|
+
this.disconnectHandler?.(new Error("daemon connection closed"));
|
|
10031
|
+
}
|
|
10026
10032
|
});
|
|
10027
10033
|
});
|
|
10028
10034
|
}
|
|
@@ -10103,8 +10109,13 @@ var DaemonClient = class {
|
|
|
10103
10109
|
onEvent(handler) {
|
|
10104
10110
|
this.eventHandler = handler;
|
|
10105
10111
|
}
|
|
10112
|
+
/** Fires once when the daemon connection drops unexpectedly (not on destroy). */
|
|
10113
|
+
onDisconnect(handler) {
|
|
10114
|
+
this.disconnectHandler = handler;
|
|
10115
|
+
}
|
|
10106
10116
|
destroy() {
|
|
10107
10117
|
this.eventHandler = null;
|
|
10118
|
+
this.disconnectHandler = null;
|
|
10108
10119
|
this.responseQueue = [];
|
|
10109
10120
|
if (this.socket) {
|
|
10110
10121
|
this.socket.destroy();
|
|
@@ -10113,6 +10124,23 @@ var DaemonClient = class {
|
|
|
10113
10124
|
}
|
|
10114
10125
|
};
|
|
10115
10126
|
|
|
10127
|
+
// ../bitfab-plugin-lib/dist/studioUrl.js
|
|
10128
|
+
var DEFAULT_STUDIO_PATH = "/studio";
|
|
10129
|
+
function resolveStudioInitialPath(input) {
|
|
10130
|
+
if (input && isValidStudioRoute(input)) {
|
|
10131
|
+
return input;
|
|
10132
|
+
}
|
|
10133
|
+
return DEFAULT_STUDIO_PATH;
|
|
10134
|
+
}
|
|
10135
|
+
function buildStudioSessionUrl(args) {
|
|
10136
|
+
const { serviceUrl, path: path18, sessionId } = args;
|
|
10137
|
+
if (path18.includes("session=")) {
|
|
10138
|
+
return `${serviceUrl}${path18}`;
|
|
10139
|
+
}
|
|
10140
|
+
const separator = path18.includes("?") ? "&" : "?";
|
|
10141
|
+
return `${serviceUrl}${path18}${separator}session=${encodeURIComponent(sessionId)}`;
|
|
10142
|
+
}
|
|
10143
|
+
|
|
10116
10144
|
// ../bitfab-plugin-lib/dist/studioChannel.js
|
|
10117
10145
|
var DirectChannel = class {
|
|
10118
10146
|
apiKey;
|
|
@@ -10127,11 +10155,12 @@ var DirectChannel = class {
|
|
|
10127
10155
|
async openOrNavigate(path18, opts) {
|
|
10128
10156
|
if (!this.apiKey) {
|
|
10129
10157
|
const sessionId2 = opts?.sessionId ?? crypto6.randomUUID();
|
|
10130
|
-
const initialPath = path18
|
|
10131
|
-
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10158
|
+
const initialPath = resolveStudioInitialPath(path18);
|
|
10159
|
+
const url2 = buildStudioSessionUrl({
|
|
10160
|
+
serviceUrl: this.serviceUrl,
|
|
10161
|
+
path: initialPath,
|
|
10162
|
+
sessionId: sessionId2
|
|
10163
|
+
});
|
|
10135
10164
|
const windowPid = openChromelessWindow(url2);
|
|
10136
10165
|
writeActiveStudioSession({
|
|
10137
10166
|
sessionId: sessionId2,
|
|
@@ -10255,18 +10284,21 @@ var DaemonChannel = class _DaemonChannel {
|
|
|
10255
10284
|
})
|
|
10256
10285
|
]);
|
|
10257
10286
|
}
|
|
10258
|
-
subscribe(_sessionId, onEvent,
|
|
10287
|
+
subscribe(_sessionId, onEvent, onError) {
|
|
10259
10288
|
const done = new Promise((resolve) => {
|
|
10260
10289
|
this.doneResolve = resolve;
|
|
10261
10290
|
});
|
|
10262
10291
|
this.client.onEvent((push) => {
|
|
10263
10292
|
const event = {
|
|
10264
|
-
id:
|
|
10293
|
+
id: push.id,
|
|
10265
10294
|
type: push.event,
|
|
10266
10295
|
data: push.data
|
|
10267
10296
|
};
|
|
10268
10297
|
onEvent(event);
|
|
10269
10298
|
});
|
|
10299
|
+
this.client.onDisconnect((err) => {
|
|
10300
|
+
onError(err);
|
|
10301
|
+
});
|
|
10270
10302
|
return {
|
|
10271
10303
|
abort: () => this.destroy(),
|
|
10272
10304
|
done
|
|
@@ -24550,6 +24582,11 @@ var inputFileSchema = external_exports.object({
|
|
|
24550
24582
|
// ../bitfab-plugin-lib/dist/commands/pushActivity.js
|
|
24551
24583
|
import { spawn as spawn3 } from "child_process";
|
|
24552
24584
|
|
|
24585
|
+
// ../bitfab-plugin-lib/dist/commands/readTracesBatched.js
|
|
24586
|
+
import { writeFileSync } from "fs";
|
|
24587
|
+
import { tmpdir } from "os";
|
|
24588
|
+
import { join } from "path";
|
|
24589
|
+
|
|
24553
24590
|
// ../bitfab-plugin-lib/dist/activePreviewSession.js
|
|
24554
24591
|
import fs12 from "fs";
|
|
24555
24592
|
import os11 from "os";
|