@dev-anywhere/proxy 0.9.17 → 0.9.18
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/{autostart-ODHWAMK7.js → autostart-VGHJZS6V.js} +1 -1
- package/dist/{chunk-TCQAVGKW.js → chunk-4IX5R5X3.js} +2 -2
- package/dist/{chunk-X76ZR6GL.js → chunk-4KUJOGCV.js} +2 -2
- package/dist/{chunk-N4DATVNM.js → chunk-CZPY2BFR.js} +2 -2
- package/dist/{chunk-5QXG76IO.js → chunk-HPNB53V4.js} +2 -2
- package/dist/{chunk-LJZS7VNV.js → chunk-PLWNR3X4.js} +2 -2
- package/dist/{chunk-FPNOC7HY.js → chunk-ZKMCE4JY.js} +14 -3
- package/dist/chunk-ZKMCE4JY.js.map +1 -0
- package/dist/index.js +6 -6
- package/dist/preview-worker.js +2 -2
- package/dist/serve.js +103 -22
- package/dist/serve.js.map +1 -1
- package/dist/session-worker.js +2 -2
- package/dist/{terminal-OUKZRIMW.js → terminal-HA5PIFVP.js} +4 -4
- package/dist/terminal-worker.js +4 -4
- package/package.json +3 -3
- package/dist/chunk-FPNOC7HY.js.map +0 -1
- /package/dist/{autostart-ODHWAMK7.js.map → autostart-VGHJZS6V.js.map} +0 -0
- /package/dist/{chunk-TCQAVGKW.js.map → chunk-4IX5R5X3.js.map} +0 -0
- /package/dist/{chunk-X76ZR6GL.js.map → chunk-4KUJOGCV.js.map} +0 -0
- /package/dist/{chunk-N4DATVNM.js.map → chunk-CZPY2BFR.js.map} +0 -0
- /package/dist/{chunk-5QXG76IO.js.map → chunk-HPNB53V4.js.map} +0 -0
- /package/dist/{chunk-LJZS7VNV.js.map → chunk-PLWNR3X4.js.map} +0 -0
- /package/dist/{terminal-OUKZRIMW.js.map → terminal-HA5PIFVP.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
readSessionRuntimeIpcVersions,
|
|
10
10
|
sessionRuntimeIpcVersionMatches,
|
|
11
11
|
stripProxyProfileArgs
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-4KUJOGCV.js";
|
|
13
13
|
import {
|
|
14
14
|
getErrorMessage,
|
|
15
15
|
probeProcess
|
|
@@ -30,8 +30,8 @@ import "./chunk-CFO5GU5U.js";
|
|
|
30
30
|
import {
|
|
31
31
|
TERMINAL_IPC_PROTOCOL_VERSION,
|
|
32
32
|
WORKER_IPC_PROTOCOL_VERSION
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-CZPY2BFR.js";
|
|
34
|
+
import "./chunk-ZKMCE4JY.js";
|
|
35
35
|
import "./chunk-G4QN6LOR.js";
|
|
36
36
|
import {
|
|
37
37
|
PROXY_VERSION
|
|
@@ -253,7 +253,7 @@ var program = new Command("dev-anywhere").description("Dev Anywhere - transparen
|
|
|
253
253
|
console.error(err instanceof Error ? err.message : String(err));
|
|
254
254
|
process.exit(1);
|
|
255
255
|
}
|
|
256
|
-
const { startTerminal } = await import("./terminal-
|
|
256
|
+
const { startTerminal } = await import("./terminal-HA5PIFVP.js");
|
|
257
257
|
const { provider, args } = invocation;
|
|
258
258
|
await startTerminal(args, provider);
|
|
259
259
|
});
|
|
@@ -309,12 +309,12 @@ for (const [action, description] of [
|
|
|
309
309
|
["status", "Show automatic startup status"]
|
|
310
310
|
]) {
|
|
311
311
|
autostart.command(action).description(description).option("--system", "Use a system service that runs without desktop login").option("--now", "Start the system service now and restart Proxy (enable --system only)").action(async (options) => {
|
|
312
|
-
const { runAutostartCommand } = await import("./autostart-
|
|
312
|
+
const { runAutostartCommand } = await import("./autostart-VGHJZS6V.js");
|
|
313
313
|
await runAutostartCommand(action, options);
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
autostart.command("run", { hidden: true }).option("--daemon", "Detach after service readiness (systemd login trigger)").option("--system", "Run the persistent system service host").action(async (_options, command) => {
|
|
317
|
-
const { startAutostartService } = await import("./autostart-
|
|
317
|
+
const { startAutostartService } = await import("./autostart-VGHJZS6V.js");
|
|
318
318
|
const options = command.optsWithGlobals();
|
|
319
319
|
await startAutostartService(Boolean(options.daemon), Boolean(options.system));
|
|
320
320
|
});
|
package/dist/preview-worker.js
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
isPreviewControlRequest,
|
|
16
16
|
readPreviewWorkerMessages,
|
|
17
17
|
writePreviewWorkerMessage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HPNB53V4.js";
|
|
19
19
|
import {
|
|
20
20
|
acceptCurrentWorkerSocketMessage,
|
|
21
21
|
readWorkerConnection,
|
|
@@ -45,7 +45,7 @@ import {
|
|
|
45
45
|
encodeDevicePreviewFrame,
|
|
46
46
|
encodeDevicePreviewH264ProxyPacket,
|
|
47
47
|
serializeControl
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-ZKMCE4JY.js";
|
|
49
49
|
import {
|
|
50
50
|
prepareLocalIpcEndpoint,
|
|
51
51
|
removeLocalIpcEndpoint,
|
package/dist/serve.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
sessionRuntimeIpcVersionMatches,
|
|
13
13
|
stripProxyProfileArgs,
|
|
14
14
|
writeSessionRuntimeIpcVersions
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4KUJOGCV.js";
|
|
16
16
|
import {
|
|
17
17
|
processExistsOrIsInaccessible
|
|
18
18
|
} from "./chunk-5OARBB2B.js";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
isPreviewControlRequest,
|
|
22
22
|
readPreviewWorkerMessages,
|
|
23
23
|
writePreviewWorkerMessage
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-HPNB53V4.js";
|
|
25
25
|
import {
|
|
26
26
|
ContentBlockDeltaSchema,
|
|
27
27
|
IGNORED_EVENT_TYPES,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
import {
|
|
41
41
|
buildHostedPtyArgs,
|
|
42
42
|
parseTerminalWorkerCliArgs
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-4IX5R5X3.js";
|
|
44
44
|
import {
|
|
45
45
|
ReconnectSupervisor,
|
|
46
46
|
TERMINAL_ADMISSION_FRAME_MAX_BYTES,
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
createWorkerReader,
|
|
78
78
|
serializeIpc,
|
|
79
79
|
serializeWorkerMsg
|
|
80
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-CZPY2BFR.js";
|
|
81
81
|
import "./chunk-5RESCDN4.js";
|
|
82
82
|
import {
|
|
83
83
|
ControlErrorCode,
|
|
@@ -105,7 +105,7 @@ import {
|
|
|
105
105
|
isProxyProtocolRejectDirection,
|
|
106
106
|
serializeControl,
|
|
107
107
|
summarizeToolActivity
|
|
108
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-ZKMCE4JY.js";
|
|
109
109
|
import {
|
|
110
110
|
localIpcEndpointMayExist,
|
|
111
111
|
removeLocalIpcEndpoint,
|
|
@@ -4399,6 +4399,9 @@ var RelayInputHandlers = class {
|
|
|
4399
4399
|
onRemoteFileStreamCancel(msg) {
|
|
4400
4400
|
this.deps.remoteFileStreamManager.cancel(msg);
|
|
4401
4401
|
}
|
|
4402
|
+
onRemoteFileStreamAck(msg) {
|
|
4403
|
+
this.deps.remoteFileStreamManager.acknowledge(msg);
|
|
4404
|
+
}
|
|
4402
4405
|
onRemoteFileUploadStreamRequest(msg) {
|
|
4403
4406
|
this.deps.remoteFileUploadManager.start(msg);
|
|
4404
4407
|
}
|
|
@@ -6938,6 +6941,9 @@ var RelayRouter = class {
|
|
|
6938
6941
|
case "remote_file_stream_cancel":
|
|
6939
6942
|
this.inputHandlers.onRemoteFileStreamCancel(msg);
|
|
6940
6943
|
return;
|
|
6944
|
+
case "remote_file_stream_ack":
|
|
6945
|
+
this.inputHandlers.onRemoteFileStreamAck(msg);
|
|
6946
|
+
return;
|
|
6941
6947
|
case "remote_file_upload_stream_request":
|
|
6942
6948
|
this.inputHandlers.onRemoteFileUploadStreamRequest(msg);
|
|
6943
6949
|
return;
|
|
@@ -9009,6 +9015,10 @@ var EXT_MIME_MAP = {
|
|
|
9009
9015
|
".tar": "application/x-tar",
|
|
9010
9016
|
".gz": "application/gzip",
|
|
9011
9017
|
".mp4": "video/mp4",
|
|
9018
|
+
".m4v": "video/mp4",
|
|
9019
|
+
".webm": "video/webm",
|
|
9020
|
+
".mov": "video/quicktime",
|
|
9021
|
+
".ogv": "video/ogg",
|
|
9012
9022
|
".mp3": "audio/mpeg",
|
|
9013
9023
|
".wav": "audio/wav"
|
|
9014
9024
|
};
|
|
@@ -9023,8 +9033,28 @@ function resolveRemoteFilePath(rawPath, cwd) {
|
|
|
9023
9033
|
return realpathSync2(candidate);
|
|
9024
9034
|
}
|
|
9025
9035
|
|
|
9036
|
+
// src/serve/remote-file-range.ts
|
|
9037
|
+
function parseRemoteFileRange(value, size) {
|
|
9038
|
+
if (value === void 0) return null;
|
|
9039
|
+
if (!Number.isSafeInteger(size) || size <= 0) return "invalid";
|
|
9040
|
+
const match = /^bytes=(\d*)-(\d*)$/.exec(value.trim());
|
|
9041
|
+
if (!match || !match[1] && !match[2]) return "invalid";
|
|
9042
|
+
if (!match[1]) {
|
|
9043
|
+
const suffix = Number(match[2]);
|
|
9044
|
+
if (!Number.isSafeInteger(suffix) || suffix <= 0) return "invalid";
|
|
9045
|
+
return { start: Math.max(0, size - suffix), end: size - 1 };
|
|
9046
|
+
}
|
|
9047
|
+
const start = Number(match[1]);
|
|
9048
|
+
const end = match[2] ? Number(match[2]) : size - 1;
|
|
9049
|
+
if (!Number.isSafeInteger(start) || !Number.isSafeInteger(end) || start >= size || end < start) {
|
|
9050
|
+
return "invalid";
|
|
9051
|
+
}
|
|
9052
|
+
return { start, end: Math.min(end, size - 1) };
|
|
9053
|
+
}
|
|
9054
|
+
|
|
9026
9055
|
// src/serve/remote-file-stream.ts
|
|
9027
9056
|
var FILE_STREAM_CHUNK_BYTES = 256 * 1024;
|
|
9057
|
+
var FILE_STREAM_WINDOW_CHUNKS = 4;
|
|
9028
9058
|
function errorCode(err) {
|
|
9029
9059
|
if (err instanceof Error && "errorCode" in err && typeof err.errorCode === "string") {
|
|
9030
9060
|
return err.errorCode;
|
|
@@ -9073,7 +9103,7 @@ var RemoteFileStreamManager = class {
|
|
|
9073
9103
|
requestId,
|
|
9074
9104
|
sessionId,
|
|
9075
9105
|
success: true,
|
|
9076
|
-
path,
|
|
9106
|
+
path: resolvedPath,
|
|
9077
9107
|
mimeType: guessMimeType(resolvedPath),
|
|
9078
9108
|
size: stat2.size,
|
|
9079
9109
|
fileName: basename4(resolvedPath) || "download"
|
|
@@ -9136,40 +9166,73 @@ var RemoteFileStreamManager = class {
|
|
|
9136
9166
|
});
|
|
9137
9167
|
return;
|
|
9138
9168
|
}
|
|
9139
|
-
const
|
|
9140
|
-
|
|
9141
|
-
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9147
|
-
|
|
9169
|
+
const range = parseRemoteFileRange(msg.head ? void 0 : msg.range, stat2.size);
|
|
9170
|
+
if (range === "invalid") {
|
|
9171
|
+
this.sendResponse({
|
|
9172
|
+
streamId,
|
|
9173
|
+
sessionId,
|
|
9174
|
+
success: false,
|
|
9175
|
+
statusCode: 416,
|
|
9176
|
+
contentRange: `bytes */${stat2.size}`,
|
|
9177
|
+
size: 0,
|
|
9178
|
+
error: "\u8BF7\u6C42\u7684\u6587\u4EF6\u8303\u56F4\u65E0\u6548"
|
|
9179
|
+
});
|
|
9180
|
+
return;
|
|
9181
|
+
}
|
|
9182
|
+
const response = {
|
|
9148
9183
|
streamId,
|
|
9149
9184
|
sessionId,
|
|
9150
9185
|
success: true,
|
|
9151
9186
|
path,
|
|
9152
9187
|
mimeType: guessMimeType(resolvedPath),
|
|
9153
|
-
size: stat2.size,
|
|
9154
|
-
fileName: basename4(resolvedPath) || "download"
|
|
9188
|
+
size: range ? range.end - range.start + 1 : stat2.size,
|
|
9189
|
+
fileName: basename4(resolvedPath) || "download",
|
|
9190
|
+
statusCode: range ? 206 : 200,
|
|
9191
|
+
...range ? { contentRange: `bytes ${range.start}-${range.end}/${stat2.size}` } : {},
|
|
9192
|
+
...msg.flowControl ? { flowControl: true } : {}
|
|
9193
|
+
};
|
|
9194
|
+
if (msg.head || stat2.size === 0) {
|
|
9195
|
+
this.sendResponse(response);
|
|
9196
|
+
this.complete(streamId, true);
|
|
9197
|
+
return;
|
|
9198
|
+
}
|
|
9199
|
+
const stream = createReadStream3(resolvedPath, {
|
|
9200
|
+
highWaterMark: FILE_STREAM_CHUNK_BYTES,
|
|
9201
|
+
...range ?? {}
|
|
9155
9202
|
});
|
|
9203
|
+
const active = {
|
|
9204
|
+
stream,
|
|
9205
|
+
chunkSeq: 0,
|
|
9206
|
+
completed: false,
|
|
9207
|
+
canceled: false,
|
|
9208
|
+
flowControl: msg.flowControl === true,
|
|
9209
|
+
acknowledgedSeq: -1,
|
|
9210
|
+
ended: false
|
|
9211
|
+
};
|
|
9212
|
+
this.activeStreams.set(streamId, active);
|
|
9213
|
+
this.sendResponse(response);
|
|
9156
9214
|
stream.on("data", (chunk) => {
|
|
9157
9215
|
if (active.canceled) return;
|
|
9158
9216
|
const data = chunk instanceof Buffer ? chunk : Buffer.from(chunk);
|
|
9159
|
-
|
|
9160
|
-
encodeFileStreamFrame(streamId, active.chunkSeq, data)
|
|
9161
|
-
);
|
|
9217
|
+
const seq = active.chunkSeq;
|
|
9162
9218
|
active.chunkSeq += 1;
|
|
9219
|
+
if (active.flowControl && active.chunkSeq - active.acknowledgedSeq - 1 >= FILE_STREAM_WINDOW_CHUNKS) {
|
|
9220
|
+
stream.pause();
|
|
9221
|
+
}
|
|
9222
|
+
this.deps.relayConnection.sendBinary(encodeFileStreamFrame(streamId, seq, data));
|
|
9163
9223
|
});
|
|
9164
9224
|
stream.on("end", () => {
|
|
9165
|
-
|
|
9225
|
+
active.ended = true;
|
|
9226
|
+
if (!active.flowControl || active.acknowledgedSeq === active.chunkSeq - 1) {
|
|
9227
|
+
this.complete(streamId, true);
|
|
9228
|
+
}
|
|
9166
9229
|
});
|
|
9167
9230
|
stream.on("error", (err) => {
|
|
9168
9231
|
if (active.canceled) return;
|
|
9169
9232
|
this.complete(streamId, false, err instanceof Error ? err.message : String(err));
|
|
9170
9233
|
});
|
|
9171
9234
|
stream.on("close", () => {
|
|
9172
|
-
if (!active.completed && !active.canceled) {
|
|
9235
|
+
if (!active.completed && !active.canceled && !active.ended) {
|
|
9173
9236
|
this.complete(streamId, false, "\u6587\u4EF6\u6D41\u63D0\u524D\u5173\u95ED");
|
|
9174
9237
|
}
|
|
9175
9238
|
});
|
|
@@ -9201,6 +9264,23 @@ var RemoteFileStreamManager = class {
|
|
|
9201
9264
|
active.stream.destroy();
|
|
9202
9265
|
serviceLogger.info({ streamId: msg.streamId }, "Remote file stream canceled");
|
|
9203
9266
|
}
|
|
9267
|
+
acknowledge(msg) {
|
|
9268
|
+
const active = this.activeStreams.get(msg.streamId);
|
|
9269
|
+
if (!active?.flowControl || msg.chunkSeq <= active.acknowledgedSeq || msg.chunkSeq >= active.chunkSeq) {
|
|
9270
|
+
return;
|
|
9271
|
+
}
|
|
9272
|
+
active.acknowledgedSeq = msg.chunkSeq;
|
|
9273
|
+
if (active.ended && active.acknowledgedSeq === active.chunkSeq - 1) {
|
|
9274
|
+
this.complete(msg.streamId, true);
|
|
9275
|
+
} else {
|
|
9276
|
+
active.stream.resume();
|
|
9277
|
+
}
|
|
9278
|
+
}
|
|
9279
|
+
cancelAll() {
|
|
9280
|
+
for (const streamId of this.activeStreams.keys()) {
|
|
9281
|
+
this.cancel({ type: "remote_file_stream_cancel", streamId });
|
|
9282
|
+
}
|
|
9283
|
+
}
|
|
9204
9284
|
complete(streamId, success, error) {
|
|
9205
9285
|
const active = this.activeStreams.get(streamId);
|
|
9206
9286
|
if (active) {
|
|
@@ -10028,6 +10108,7 @@ async function startService(options) {
|
|
|
10028
10108
|
});
|
|
10029
10109
|
relayConnection.on("disconnected", () => {
|
|
10030
10110
|
previewRuntime.disconnectRelay();
|
|
10111
|
+
remoteFileStreamManager.cancelAll();
|
|
10031
10112
|
broadcastBridgeStatus(false);
|
|
10032
10113
|
});
|
|
10033
10114
|
function broadcastBridgeStatus(connected) {
|