@dev-anywhere/proxy 0.8.0 → 0.9.0
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/README.md +7 -5
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/assets/scrcpy/scrcpy-server-v4.1 +0 -0
- package/dist/{chunk-43VZTEDR.js → chunk-57LA2LWY.js} +2 -2
- package/dist/chunk-C5RUR5MY.js +426 -0
- package/dist/chunk-C5RUR5MY.js.map +1 -0
- package/dist/{chunk-AQPTQ44T.js → chunk-DZ4GXMP5.js} +2 -2
- package/dist/{chunk-AQPTQ44T.js.map → chunk-DZ4GXMP5.js.map} +1 -1
- package/dist/chunk-HLN3NOD2.js +451 -0
- package/dist/chunk-HLN3NOD2.js.map +1 -0
- package/dist/chunk-K72MFCMC.js +304 -0
- package/dist/chunk-K72MFCMC.js.map +1 -0
- package/dist/{chunk-OWPHJ5LA.js → chunk-KGTYU4WO.js} +2 -2
- package/dist/chunk-RN3KQK6E.js +2745 -0
- package/dist/chunk-RN3KQK6E.js.map +1 -0
- package/dist/{chunk-MSIZBFLV.js → chunk-SEMZ7GW7.js} +3 -3
- package/dist/{chunk-HIZNGFB5.js → chunk-WRU3BXW6.js} +10 -1
- package/dist/chunk-WRU3BXW6.js.map +1 -0
- package/dist/{chunk-T2RI7YUO.js → chunk-YM74AWYC.js} +54 -14
- package/dist/chunk-YM74AWYC.js.map +1 -0
- package/dist/{chunk-FJHCP2HS.js → chunk-ZNMJH7BK.js} +2 -2
- package/dist/index.js +148 -96
- package/dist/index.js.map +1 -1
- package/dist/{quick-tunnel-C2WILO6I.js → quick-tunnel-RI62V2RH.js} +17 -89
- package/dist/quick-tunnel-RI62V2RH.js.map +1 -0
- package/dist/{relay-token-V6EA4HPM.js → relay-token-ZP3PAZD2.js} +4 -4
- package/dist/serve.js +10630 -2166
- package/dist/serve.js.map +1 -1
- package/dist/session-worker.js +105 -31
- package/dist/session-worker.js.map +1 -1
- package/dist/{terminal-NWKJTN2R.js → terminal-AHMO45YN.js} +166 -124
- package/dist/terminal-AHMO45YN.js.map +1 -0
- package/dist/terminal-worker.js +83 -43
- package/dist/terminal-worker.js.map +1 -1
- package/dist/update-runner.js +2 -2
- package/licenses/Apache-2.0.txt +204 -0
- package/licenses/BSD-3-Clause.txt +29 -0
- package/licenses/Boost-1.0.txt +23 -0
- package/package.json +8 -4
- package/dist/chunk-2FVY2JAS.js +0 -123
- package/dist/chunk-2FVY2JAS.js.map +0 -1
- package/dist/chunk-HIZNGFB5.js.map +0 -1
- package/dist/chunk-JU6MVCCD.js +0 -1644
- package/dist/chunk-JU6MVCCD.js.map +0 -1
- package/dist/chunk-T2RI7YUO.js.map +0 -1
- package/dist/chunk-UHJRVS65.js +0 -49
- package/dist/chunk-UHJRVS65.js.map +0 -1
- package/dist/quick-tunnel-C2WILO6I.js.map +0 -1
- package/dist/terminal-NWKJTN2R.js.map +0 -1
- /package/dist/{chunk-43VZTEDR.js.map → chunk-57LA2LWY.js.map} +0 -0
- /package/dist/{chunk-OWPHJ5LA.js.map → chunk-KGTYU4WO.js.map} +0 -0
- /package/dist/{chunk-MSIZBFLV.js.map → chunk-SEMZ7GW7.js.map} +0 -0
- /package/dist/{chunk-FJHCP2HS.js.map → chunk-ZNMJH7BK.js.map} +0 -0
- /package/dist/{relay-token-V6EA4HPM.js.map → relay-token-ZP3PAZD2.js.map} +0 -0
package/README.md
CHANGED
|
@@ -120,14 +120,16 @@ that value in Settings -> Relay Token so the browser client can authenticate.
|
|
|
120
120
|
|
|
121
121
|
`dev-anywhere serve start --relay cloud` and `dev-anywhere serve restart --relay cloud` use a named relay without editing the file each time.
|
|
122
122
|
|
|
123
|
-
`autoUpdate` defaults to `true
|
|
123
|
+
`autoUpdate` defaults to `true` and runs after this machine connects to the Relay. DEV Anywhere 0.9.0 must be installed manually on every development machine after the Relay is upgraded; restart the service after installing it. Set `autoUpdate` to `false` and restart the service to keep the installed version.
|
|
124
124
|
|
|
125
|
-
If
|
|
126
|
-
top-level `agentCli` object:
|
|
125
|
+
If DEV Anywhere cannot detect an agent CLI automatically, set its persistent
|
|
126
|
+
path under the top-level `agentCli` object:
|
|
127
127
|
|
|
128
128
|
```json
|
|
129
129
|
{
|
|
130
130
|
"agentCli": {
|
|
131
|
+
"claudeBin": "/absolute/path/to/claude",
|
|
132
|
+
"codexBin": "/absolute/path/to/codex",
|
|
131
133
|
"kimiBin": "/absolute/path/to/kimi"
|
|
132
134
|
}
|
|
133
135
|
}
|
|
@@ -137,8 +139,8 @@ Environment variables are reserved for temporary overrides:
|
|
|
137
139
|
|
|
138
140
|
- `RELAY_URL` — relay WebSocket URL
|
|
139
141
|
- `RELAY_PROXY_TOKEN` — auth token
|
|
140
|
-
- `CLAUDE_BIN` — Claude Code CLI path
|
|
141
|
-
- `CODEX_BIN` — Codex CLI path
|
|
142
|
+
- `CLAUDE_BIN` — Claude Code CLI path; overrides `agentCli.claudeBin`
|
|
143
|
+
- `CODEX_BIN` — Codex CLI path; overrides `agentCli.codexBin`
|
|
142
144
|
- `KIMI_BIN` — Kimi Code CLI path; overrides `agentCli.kimiBin`
|
|
143
145
|
|
|
144
146
|
## How it works
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
`@dev-anywhere/proxy` includes an unmodified copy of `scrcpy-server` 4.1.
|
|
4
|
+
|
|
5
|
+
- Project: [Genymobile/scrcpy](https://github.com/Genymobile/scrcpy)
|
|
6
|
+
- Release: [v4.1](https://github.com/Genymobile/scrcpy/releases/tag/v4.1)
|
|
7
|
+
- Bundled file SHA-256: `deacb991ed2509715160ffdc7907e47b4160eb30d1566217e9047fd5b8850cae`
|
|
8
|
+
- Copyright (C) 2018 Genymobile
|
|
9
|
+
- Copyright (C) 2018-2026 Romain Vimont
|
|
10
|
+
- License: Apache License 2.0; see [`licenses/Apache-2.0.txt`](./licenses/Apache-2.0.txt)
|
|
11
|
+
|
|
12
|
+
The server binary also contains the following components or derived code:
|
|
13
|
+
|
|
14
|
+
- Kotlin standard library 2.2.10, Copyright JetBrains and Kotlin contributors,
|
|
15
|
+
under the Apache License 2.0.
|
|
16
|
+
- JetBrains annotations 13.0, Copyright JetBrains, under the Apache License 2.0.
|
|
17
|
+
- Android Open Source Project interfaces, under the Apache License 2.0.
|
|
18
|
+
- Kotlin collection code derived from GWT, Copyright (C) 2007-2008 Google Inc.,
|
|
19
|
+
under the Apache License 2.0.
|
|
20
|
+
- Kotlin unsigned-number code derived from Guava, Copyright (C) 2011 The Guava
|
|
21
|
+
Authors, under the Apache License 2.0.
|
|
22
|
+
- Kotlin time code derived from ThreeTenBP, Copyright (c) 2007-present Stephen
|
|
23
|
+
Colebourne and Michael Nascimento Santos, under the BSD 3-Clause License; see
|
|
24
|
+
[`licenses/BSD-3-Clause.txt`](./licenses/BSD-3-Clause.txt).
|
|
25
|
+
- Kotlin math code derived from Boost special math functions, Copyright Eric
|
|
26
|
+
Ford and Hubert Holin 2001, under the Boost Software License 1.0; see
|
|
27
|
+
[`licenses/Boost-1.0.txt`](./licenses/Boost-1.0.txt).
|
|
28
|
+
|
|
29
|
+
The third-party licenses apply only to their respective components. They do not
|
|
30
|
+
change the MIT license for DEV Anywhere's own source code.
|
|
Binary file
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-NQDJ6QAM.js";
|
|
5
5
|
import {
|
|
6
6
|
sessionPaths
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-WRU3BXW6.js";
|
|
8
8
|
|
|
9
9
|
// src/common/seq-counter.ts
|
|
10
10
|
import { mkdirSync, readFileSync, existsSync } from "fs";
|
|
@@ -202,4 +202,4 @@ export {
|
|
|
202
202
|
createApprovalRequestIdFactory,
|
|
203
203
|
createScopedApprovalRequestIdFactory
|
|
204
204
|
};
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-57LA2LWY.js.map
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/common/quick-tunnel-readiness.ts
|
|
4
|
+
import { Resolver } from "dns/promises";
|
|
5
|
+
import { request } from "https";
|
|
6
|
+
import { isIP } from "net";
|
|
7
|
+
import { setTimeout as sleep } from "timers/promises";
|
|
8
|
+
var TRY_CLOUDFLARE_ZONE = "trycloudflare.com";
|
|
9
|
+
var DEFAULT_TIMEOUT_MS = 6e4;
|
|
10
|
+
var DEFAULT_RETRY_INTERVAL_MS = 500;
|
|
11
|
+
var DNS_TIMEOUT_MS = 2e3;
|
|
12
|
+
var HTTPS_PROBE_TIMEOUT_MS = 5e3;
|
|
13
|
+
var PREVIEW_HEALTH_PATH = "/.well-known/dev-anywhere-preview-health";
|
|
14
|
+
var PREVIEW_HEALTH_HEADER = "x-dev-anywhere-preview-health";
|
|
15
|
+
var PREVIEW_HEALTH_MARKER = "1";
|
|
16
|
+
function cancelledError() {
|
|
17
|
+
return new Error("Quick Tunnel readiness cancelled");
|
|
18
|
+
}
|
|
19
|
+
function throwIfAborted(signal) {
|
|
20
|
+
if (signal.aborted) throw cancelledError();
|
|
21
|
+
}
|
|
22
|
+
async function withResolver(resolver, signal, operation) {
|
|
23
|
+
throwIfAborted(signal);
|
|
24
|
+
const cancel = () => resolver.cancel();
|
|
25
|
+
signal.addEventListener("abort", cancel, { once: true });
|
|
26
|
+
try {
|
|
27
|
+
return await operation();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
if (signal.aborted) throw cancelledError();
|
|
30
|
+
throw error;
|
|
31
|
+
} finally {
|
|
32
|
+
signal.removeEventListener("abort", cancel);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function uniqueAddresses(results) {
|
|
36
|
+
return [
|
|
37
|
+
...new Set(results.flatMap((result) => result.status === "fulfilled" ? result.value : []))
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
async function discoverAuthoritativeServers(signal) {
|
|
41
|
+
const recursive = new Resolver({ timeout: DNS_TIMEOUT_MS, tries: 1 });
|
|
42
|
+
const names = await withResolver(
|
|
43
|
+
recursive,
|
|
44
|
+
signal,
|
|
45
|
+
() => recursive.resolveNs(TRY_CLOUDFLARE_ZONE)
|
|
46
|
+
);
|
|
47
|
+
const addressResults = await Promise.allSettled(
|
|
48
|
+
names.flatMap((name) => [
|
|
49
|
+
withResolver(recursive, signal, () => recursive.resolve4(name)),
|
|
50
|
+
withResolver(recursive, signal, () => recursive.resolve6(name))
|
|
51
|
+
])
|
|
52
|
+
);
|
|
53
|
+
throwIfAborted(signal);
|
|
54
|
+
const addresses = uniqueAddresses(addressResults);
|
|
55
|
+
if (addresses.length === 0) throw new Error("Quick Tunnel authoritative DNS unavailable");
|
|
56
|
+
return addresses;
|
|
57
|
+
}
|
|
58
|
+
function createQuickTunnelAuthoritativeResolver() {
|
|
59
|
+
let authoritativeServers;
|
|
60
|
+
return async (hostname, signal) => {
|
|
61
|
+
authoritativeServers ??= await discoverAuthoritativeServers(signal);
|
|
62
|
+
const authoritative = new Resolver({ timeout: DNS_TIMEOUT_MS, tries: 1 });
|
|
63
|
+
authoritative.setServers(authoritativeServers);
|
|
64
|
+
const results = await Promise.allSettled([
|
|
65
|
+
withResolver(authoritative, signal, () => authoritative.resolve4(hostname)),
|
|
66
|
+
withResolver(authoritative, signal, () => authoritative.resolve6(hostname))
|
|
67
|
+
]);
|
|
68
|
+
throwIfAborted(signal);
|
|
69
|
+
return uniqueAddresses(results);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function probePreviewTunnelEdge(hostname, address, signal) {
|
|
73
|
+
return new Promise((resolve, reject) => {
|
|
74
|
+
throwIfAborted(signal);
|
|
75
|
+
let settled = false;
|
|
76
|
+
const finish = (error, reachable = false) => {
|
|
77
|
+
if (settled) return;
|
|
78
|
+
settled = true;
|
|
79
|
+
clearTimeout(timer);
|
|
80
|
+
if (signal.aborted) reject(cancelledError());
|
|
81
|
+
else if (error) reject(error);
|
|
82
|
+
else resolve(reachable);
|
|
83
|
+
};
|
|
84
|
+
const family = isIP(address);
|
|
85
|
+
if (family !== 4 && family !== 6) {
|
|
86
|
+
reject(new Error("Tunnel DNS returned an invalid address"));
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
const req = request({
|
|
90
|
+
protocol: "https:",
|
|
91
|
+
hostname,
|
|
92
|
+
servername: hostname,
|
|
93
|
+
port: 443,
|
|
94
|
+
method: "GET",
|
|
95
|
+
path: PREVIEW_HEALTH_PATH,
|
|
96
|
+
agent: false,
|
|
97
|
+
signal,
|
|
98
|
+
lookup: (_name, lookupOptions, callback) => {
|
|
99
|
+
if (lookupOptions.all) callback(null, [{ address, family }]);
|
|
100
|
+
else callback(null, address, family);
|
|
101
|
+
},
|
|
102
|
+
headers: { Host: hostname, Connection: "close" }
|
|
103
|
+
});
|
|
104
|
+
const timer = setTimeout(() => {
|
|
105
|
+
req.destroy(new Error("Tunnel health probe timed out"));
|
|
106
|
+
}, HTTPS_PROBE_TIMEOUT_MS);
|
|
107
|
+
timer.unref?.();
|
|
108
|
+
req.once("response", (response) => {
|
|
109
|
+
const reachable = response.statusCode === 204 && response.headers[PREVIEW_HEALTH_HEADER] === PREVIEW_HEALTH_MARKER;
|
|
110
|
+
response.resume();
|
|
111
|
+
response.once("end", () => finish(null, reachable));
|
|
112
|
+
response.once("error", (error) => finish(error));
|
|
113
|
+
});
|
|
114
|
+
req.once("error", (error) => finish(error));
|
|
115
|
+
req.end();
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async function waitForQuickTunnelReachability(options) {
|
|
119
|
+
const hostname = new URL(options.publicUrl).hostname;
|
|
120
|
+
if (!hostname.endsWith(`.${TRY_CLOUDFLARE_ZONE}`)) {
|
|
121
|
+
throw new Error("cloudflared provided an invalid Quick Tunnel URL");
|
|
122
|
+
}
|
|
123
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
124
|
+
const retryIntervalMs = options.retryIntervalMs ?? DEFAULT_RETRY_INTERVAL_MS;
|
|
125
|
+
const resolveEdgeAddresses = options.resolveEdgeAddresses ?? createQuickTunnelAuthoritativeResolver();
|
|
126
|
+
const probeEdgeAddress = options.probeEdgeAddress ?? probePreviewTunnelEdge;
|
|
127
|
+
const attemptAbort = new AbortController();
|
|
128
|
+
const cancelAttempt = () => attemptAbort.abort();
|
|
129
|
+
options.signal.addEventListener("abort", cancelAttempt, { once: true });
|
|
130
|
+
const timeout = setTimeout(() => attemptAbort.abort(), timeoutMs);
|
|
131
|
+
timeout.unref?.();
|
|
132
|
+
const deadline = Date.now() + timeoutMs;
|
|
133
|
+
try {
|
|
134
|
+
while (Date.now() < deadline) {
|
|
135
|
+
throwIfAborted(options.signal);
|
|
136
|
+
try {
|
|
137
|
+
const addresses = await resolveEdgeAddresses(hostname, attemptAbort.signal);
|
|
138
|
+
for (const address of addresses) {
|
|
139
|
+
if (await probeEdgeAddress(hostname, address, attemptAbort.signal)) return;
|
|
140
|
+
}
|
|
141
|
+
} catch {
|
|
142
|
+
throwIfAborted(options.signal);
|
|
143
|
+
}
|
|
144
|
+
const remainingMs = deadline - Date.now();
|
|
145
|
+
if (remainingMs <= 0 || attemptAbort.signal.aborted) break;
|
|
146
|
+
try {
|
|
147
|
+
await sleep(Math.min(retryIntervalMs, remainingMs), void 0, {
|
|
148
|
+
signal: attemptAbort.signal
|
|
149
|
+
});
|
|
150
|
+
} catch {
|
|
151
|
+
throwIfAborted(options.signal);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} finally {
|
|
156
|
+
clearTimeout(timeout);
|
|
157
|
+
options.signal.removeEventListener("abort", cancelAttempt);
|
|
158
|
+
}
|
|
159
|
+
throwIfAborted(options.signal);
|
|
160
|
+
throw new Error(`Quick Tunnel did not become reachable within ${timeoutMs / 1e3}s`);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// src/common/cloudflared-quick-tunnel.ts
|
|
164
|
+
import { spawn } from "child_process";
|
|
165
|
+
|
|
166
|
+
// src/common/tunnel-child-termination.ts
|
|
167
|
+
function hasExited(child) {
|
|
168
|
+
return child.exitCode !== null || child.signalCode !== null;
|
|
169
|
+
}
|
|
170
|
+
function signalAndWait(child, processName, signal, timeoutMs) {
|
|
171
|
+
if (hasExited(child)) return Promise.resolve(true);
|
|
172
|
+
return new Promise((resolve, reject) => {
|
|
173
|
+
let settled = false;
|
|
174
|
+
const timerRef = {};
|
|
175
|
+
const cleanup = () => {
|
|
176
|
+
if (timerRef.current) clearTimeout(timerRef.current);
|
|
177
|
+
child.off("exit", onExit);
|
|
178
|
+
};
|
|
179
|
+
const finish = (exited) => {
|
|
180
|
+
if (settled) return;
|
|
181
|
+
settled = true;
|
|
182
|
+
cleanup();
|
|
183
|
+
resolve(exited);
|
|
184
|
+
};
|
|
185
|
+
const fail = (message) => {
|
|
186
|
+
if (settled) return;
|
|
187
|
+
settled = true;
|
|
188
|
+
cleanup();
|
|
189
|
+
reject(new Error(message));
|
|
190
|
+
};
|
|
191
|
+
const onExit = () => finish(true);
|
|
192
|
+
child.once("exit", onExit);
|
|
193
|
+
let accepted;
|
|
194
|
+
try {
|
|
195
|
+
accepted = child.kill(signal);
|
|
196
|
+
} catch {
|
|
197
|
+
if (hasExited(child)) finish(true);
|
|
198
|
+
else fail(`${processName} process could not be signalled with ${signal}`);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (settled) return;
|
|
202
|
+
if (hasExited(child)) {
|
|
203
|
+
finish(true);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (!accepted) {
|
|
207
|
+
fail(`${processName} process rejected ${signal}`);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
timerRef.current = setTimeout(() => finish(false), timeoutMs);
|
|
211
|
+
timerRef.current.unref?.();
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
async function terminateTunnelChild(child, options) {
|
|
215
|
+
if (!child || hasExited(child)) return;
|
|
216
|
+
const gracefulExit = await signalAndWait(
|
|
217
|
+
child,
|
|
218
|
+
options.processName,
|
|
219
|
+
options.gracefulSignal,
|
|
220
|
+
options.gracefulTimeoutMs
|
|
221
|
+
);
|
|
222
|
+
if (gracefulExit) return;
|
|
223
|
+
const forcedExit = await signalAndWait(
|
|
224
|
+
child,
|
|
225
|
+
options.processName,
|
|
226
|
+
"SIGKILL",
|
|
227
|
+
options.forceTimeoutMs ?? 1e3
|
|
228
|
+
);
|
|
229
|
+
if (!forcedExit) {
|
|
230
|
+
throw new Error(`${options.processName} process did not exit after SIGKILL`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/common/cloudflared-quick-tunnel.ts
|
|
235
|
+
var CLOUDFLARED_URL_TIMEOUT_MS = 3e4;
|
|
236
|
+
var CLOUDFLARED_CONNECTION_TIMEOUT_MS = 45e3;
|
|
237
|
+
var CLOUDFLARED_REACHABILITY_TIMEOUT_MS = 6e4;
|
|
238
|
+
var CLOUDFLARED_OUTPUT_LIMIT_BYTES = 64 * 1024;
|
|
239
|
+
var CLOUDFLARED_STOP_TIMEOUT_MS = 5e3;
|
|
240
|
+
var SIGNAL_SCAN_TAIL_CHARS = 256;
|
|
241
|
+
var TRY_CLOUDFLARE_URL_PATTERN = /https:\/\/[a-z0-9-]+\.trycloudflare\.com\b/i;
|
|
242
|
+
var TRY_CLOUDFLARE_OUTPUT_PATTERN = /(?:https:\/\/)?[a-z0-9-]+\.trycloudflare\.com\b/gi;
|
|
243
|
+
var REGISTERED_CONNECTION_MARKER = "Registered tunnel connection";
|
|
244
|
+
function extractTryCloudflareUrl(output) {
|
|
245
|
+
return output.match(TRY_CLOUDFLARE_URL_PATTERN)?.[0] ?? null;
|
|
246
|
+
}
|
|
247
|
+
function appendOutputTail(current, chunk) {
|
|
248
|
+
const combined = current + chunk;
|
|
249
|
+
const bytes = Buffer.from(combined);
|
|
250
|
+
if (bytes.length <= CLOUDFLARED_OUTPUT_LIMIT_BYTES) return combined;
|
|
251
|
+
let start = bytes.length - CLOUDFLARED_OUTPUT_LIMIT_BYTES;
|
|
252
|
+
while (start < bytes.length && (bytes[start] & 192) === 128) start += 1;
|
|
253
|
+
return bytes.subarray(start).toString("utf8");
|
|
254
|
+
}
|
|
255
|
+
function redactOutput(output) {
|
|
256
|
+
return appendOutputTail(
|
|
257
|
+
"",
|
|
258
|
+
output.replace(TRY_CLOUDFLARE_OUTPUT_PATTERN, "[trycloudflare URL redacted]")
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
function createTimedSignal(timeoutMs, timeoutMessage) {
|
|
262
|
+
let settled = false;
|
|
263
|
+
let resolvePromise;
|
|
264
|
+
let rejectPromise;
|
|
265
|
+
const promise = new Promise((resolve, reject) => {
|
|
266
|
+
resolvePromise = resolve;
|
|
267
|
+
rejectPromise = reject;
|
|
268
|
+
});
|
|
269
|
+
const timer = setTimeout(() => {
|
|
270
|
+
if (settled) return;
|
|
271
|
+
settled = true;
|
|
272
|
+
rejectPromise(new Error(timeoutMessage));
|
|
273
|
+
}, timeoutMs);
|
|
274
|
+
return {
|
|
275
|
+
promise,
|
|
276
|
+
resolve(value) {
|
|
277
|
+
if (settled) return;
|
|
278
|
+
settled = true;
|
|
279
|
+
clearTimeout(timer);
|
|
280
|
+
resolvePromise(value);
|
|
281
|
+
},
|
|
282
|
+
reject(error) {
|
|
283
|
+
if (settled) return;
|
|
284
|
+
settled = true;
|
|
285
|
+
clearTimeout(timer);
|
|
286
|
+
rejectPromise(error);
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function processFailure(error) {
|
|
291
|
+
const code = error && typeof error === "object" && "code" in error ? error.code : void 0;
|
|
292
|
+
if (code === "ENOENT") {
|
|
293
|
+
return new Error("cloudflared was not found. Install cloudflared and retry.");
|
|
294
|
+
}
|
|
295
|
+
return new Error(
|
|
296
|
+
typeof code === "string" && /^E[A-Z0-9_]{1,31}$/.test(code) ? `cloudflared process failed (${code})` : "cloudflared process failed"
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
async function terminateCloudflaredChild(child) {
|
|
300
|
+
await terminateTunnelChild(child, {
|
|
301
|
+
processName: "cloudflared",
|
|
302
|
+
gracefulSignal: "SIGTERM",
|
|
303
|
+
gracefulTimeoutMs: CLOUDFLARED_STOP_TIMEOUT_MS
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function startCloudflaredQuickTunnel(options) {
|
|
307
|
+
const args = [
|
|
308
|
+
"tunnel",
|
|
309
|
+
"--config",
|
|
310
|
+
options.configPath,
|
|
311
|
+
"--no-autoupdate",
|
|
312
|
+
"--grace-period",
|
|
313
|
+
"2s",
|
|
314
|
+
"--protocol",
|
|
315
|
+
"auto",
|
|
316
|
+
"--url",
|
|
317
|
+
options.originUrl,
|
|
318
|
+
"--loglevel",
|
|
319
|
+
"info",
|
|
320
|
+
...options.pidFilePath ? ["--pidfile", options.pidFilePath] : []
|
|
321
|
+
];
|
|
322
|
+
const spawnOptions = {
|
|
323
|
+
env: options.env,
|
|
324
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
325
|
+
};
|
|
326
|
+
const child = (options.spawn ?? spawn)(options.cloudflaredBin, args, spawnOptions);
|
|
327
|
+
const urlTimeoutMs = options.urlTimeoutMs ?? CLOUDFLARED_URL_TIMEOUT_MS;
|
|
328
|
+
const connectionTimeoutMs = options.connectionTimeoutMs ?? CLOUDFLARED_CONNECTION_TIMEOUT_MS;
|
|
329
|
+
const publicUrlSignal = createTimedSignal(
|
|
330
|
+
urlTimeoutMs,
|
|
331
|
+
`cloudflared did not provide a trycloudflare.com URL within ${urlTimeoutMs / 1e3}s`
|
|
332
|
+
);
|
|
333
|
+
const connectionSignal = createTimedSignal(
|
|
334
|
+
connectionTimeoutMs,
|
|
335
|
+
`cloudflared did not register a tunnel connection within ${connectionTimeoutMs / 1e3}s`
|
|
336
|
+
);
|
|
337
|
+
void publicUrlSignal.promise.catch(() => void 0);
|
|
338
|
+
void connectionSignal.promise.catch(() => void 0);
|
|
339
|
+
const readinessAbort = new AbortController();
|
|
340
|
+
let publicReadyPromise = null;
|
|
341
|
+
const getPublicReady = () => {
|
|
342
|
+
publicReadyPromise ??= Promise.all([publicUrlSignal.promise, connectionSignal.promise]).then(
|
|
343
|
+
async ([publicUrl]) => {
|
|
344
|
+
await (options.waitForReachability ?? waitForQuickTunnelReachability)({
|
|
345
|
+
publicUrl,
|
|
346
|
+
signal: readinessAbort.signal,
|
|
347
|
+
timeoutMs: options.reachabilityTimeoutMs ?? CLOUDFLARED_REACHABILITY_TIMEOUT_MS
|
|
348
|
+
});
|
|
349
|
+
return publicUrl;
|
|
350
|
+
}
|
|
351
|
+
);
|
|
352
|
+
void publicReadyPromise.catch(() => void 0);
|
|
353
|
+
return publicReadyPromise;
|
|
354
|
+
};
|
|
355
|
+
let output = "";
|
|
356
|
+
const scanTails = { stdout: "", stderr: "" };
|
|
357
|
+
const inspect = (source, chunk) => {
|
|
358
|
+
const text = chunk.toString();
|
|
359
|
+
const scan = scanTails[source] + text;
|
|
360
|
+
scanTails[source] = scan.slice(-SIGNAL_SCAN_TAIL_CHARS);
|
|
361
|
+
output = appendOutputTail(output, text);
|
|
362
|
+
const url = extractTryCloudflareUrl(scan);
|
|
363
|
+
if (url) publicUrlSignal.resolve(url);
|
|
364
|
+
if (scan.includes(REGISTERED_CONNECTION_MARKER)) connectionSignal.resolve();
|
|
365
|
+
};
|
|
366
|
+
child.stdout?.setEncoding("utf8");
|
|
367
|
+
child.stderr?.setEncoding("utf8");
|
|
368
|
+
child.stdout?.on("data", (chunk) => inspect("stdout", chunk));
|
|
369
|
+
child.stderr?.on("data", (chunk) => inspect("stderr", chunk));
|
|
370
|
+
child.once("error", (error) => {
|
|
371
|
+
readinessAbort.abort();
|
|
372
|
+
const failure = processFailure(error);
|
|
373
|
+
publicUrlSignal.reject(failure);
|
|
374
|
+
connectionSignal.reject(failure);
|
|
375
|
+
});
|
|
376
|
+
child.once("exit", (code, signal) => {
|
|
377
|
+
readinessAbort.abort();
|
|
378
|
+
publicUrlSignal.reject(
|
|
379
|
+
new Error(
|
|
380
|
+
`cloudflared exited before providing a tunnel URL (code=${code}, signal=${signal})`
|
|
381
|
+
)
|
|
382
|
+
);
|
|
383
|
+
connectionSignal.reject(
|
|
384
|
+
new Error(
|
|
385
|
+
`cloudflared exited before registering a tunnel connection (code=${code}, signal=${signal})`
|
|
386
|
+
)
|
|
387
|
+
);
|
|
388
|
+
});
|
|
389
|
+
let stopPromise = null;
|
|
390
|
+
return {
|
|
391
|
+
child,
|
|
392
|
+
publicUrl: publicUrlSignal.promise,
|
|
393
|
+
connectionReady: connectionSignal.promise,
|
|
394
|
+
get publicReady() {
|
|
395
|
+
return getPublicReady();
|
|
396
|
+
},
|
|
397
|
+
getOutput: () => redactOutput(output),
|
|
398
|
+
stop: () => {
|
|
399
|
+
if (!stopPromise) {
|
|
400
|
+
readinessAbort.abort();
|
|
401
|
+
publicUrlSignal.reject(new Error("cloudflared stopped before providing a tunnel URL"));
|
|
402
|
+
connectionSignal.reject(
|
|
403
|
+
new Error("cloudflared stopped before registering a tunnel connection")
|
|
404
|
+
);
|
|
405
|
+
stopPromise = terminateCloudflaredChild(child).catch((error) => {
|
|
406
|
+
stopPromise = null;
|
|
407
|
+
throw error;
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
return stopPromise;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export {
|
|
416
|
+
PREVIEW_HEALTH_PATH,
|
|
417
|
+
PREVIEW_HEALTH_HEADER,
|
|
418
|
+
PREVIEW_HEALTH_MARKER,
|
|
419
|
+
createQuickTunnelAuthoritativeResolver,
|
|
420
|
+
probePreviewTunnelEdge,
|
|
421
|
+
terminateTunnelChild,
|
|
422
|
+
extractTryCloudflareUrl,
|
|
423
|
+
terminateCloudflaredChild,
|
|
424
|
+
startCloudflaredQuickTunnel
|
|
425
|
+
};
|
|
426
|
+
//# sourceMappingURL=chunk-C5RUR5MY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/common/quick-tunnel-readiness.ts","../src/common/cloudflared-quick-tunnel.ts","../src/common/tunnel-child-termination.ts"],"sourcesContent":["import { Resolver } from \"node:dns/promises\";\nimport { request } from \"node:https\";\nimport { isIP } from \"node:net\";\nimport { setTimeout as sleep } from \"node:timers/promises\";\n\nconst TRY_CLOUDFLARE_ZONE = \"trycloudflare.com\";\nconst DEFAULT_TIMEOUT_MS = 60_000;\nconst DEFAULT_RETRY_INTERVAL_MS = 500;\nconst DNS_TIMEOUT_MS = 2_000;\nconst HTTPS_PROBE_TIMEOUT_MS = 5_000;\n\nexport const PREVIEW_HEALTH_PATH = \"/.well-known/dev-anywhere-preview-health\";\nexport const PREVIEW_HEALTH_HEADER = \"x-dev-anywhere-preview-health\";\nexport const PREVIEW_HEALTH_MARKER = \"1\";\n\ntype ResolveEdgeAddresses = (hostname: string, signal: AbortSignal) => Promise<string[]>;\ntype ProbeEdgeAddress = (\n hostname: string,\n address: string,\n signal: AbortSignal,\n) => Promise<boolean>;\n\ninterface QuickTunnelReachabilityOptions {\n publicUrl: string;\n signal: AbortSignal;\n timeoutMs?: number;\n retryIntervalMs?: number;\n resolveEdgeAddresses?: ResolveEdgeAddresses;\n probeEdgeAddress?: ProbeEdgeAddress;\n}\n\nfunction cancelledError(): Error {\n return new Error(\"Quick Tunnel readiness cancelled\");\n}\n\nfunction throwIfAborted(signal: AbortSignal): void {\n if (signal.aborted) throw cancelledError();\n}\n\nasync function withResolver<T>(\n resolver: Resolver,\n signal: AbortSignal,\n operation: () => Promise<T>,\n): Promise<T> {\n throwIfAborted(signal);\n const cancel = () => resolver.cancel();\n signal.addEventListener(\"abort\", cancel, { once: true });\n try {\n return await operation();\n } catch (error) {\n if (signal.aborted) throw cancelledError();\n throw error;\n } finally {\n signal.removeEventListener(\"abort\", cancel);\n }\n}\n\nfunction uniqueAddresses(results: PromiseSettledResult<string[]>[]): string[] {\n return [\n ...new Set(results.flatMap((result) => (result.status === \"fulfilled\" ? result.value : []))),\n ];\n}\n\nasync function discoverAuthoritativeServers(signal: AbortSignal): Promise<string[]> {\n const recursive = new Resolver({ timeout: DNS_TIMEOUT_MS, tries: 1 });\n const names = await withResolver(recursive, signal, () =>\n recursive.resolveNs(TRY_CLOUDFLARE_ZONE),\n );\n const addressResults = await Promise.allSettled(\n names.flatMap((name) => [\n withResolver(recursive, signal, () => recursive.resolve4(name)),\n withResolver(recursive, signal, () => recursive.resolve6(name)),\n ]),\n );\n throwIfAborted(signal);\n const addresses = uniqueAddresses(addressResults);\n if (addresses.length === 0) throw new Error(\"Quick Tunnel authoritative DNS unavailable\");\n return addresses;\n}\n\nexport function createQuickTunnelAuthoritativeResolver(): ResolveEdgeAddresses {\n let authoritativeServers: string[] | undefined;\n return async (hostname, signal) => {\n authoritativeServers ??= await discoverAuthoritativeServers(signal);\n const authoritative = new Resolver({ timeout: DNS_TIMEOUT_MS, tries: 1 });\n authoritative.setServers(authoritativeServers);\n const results = await Promise.allSettled([\n withResolver(authoritative, signal, () => authoritative.resolve4(hostname)),\n withResolver(authoritative, signal, () => authoritative.resolve6(hostname)),\n ]);\n throwIfAborted(signal);\n return uniqueAddresses(results);\n };\n}\n\nexport function probePreviewTunnelEdge(\n hostname: string,\n address: string,\n signal: AbortSignal,\n): Promise<boolean> {\n return new Promise((resolve, reject) => {\n throwIfAborted(signal);\n let settled = false;\n const finish = (error: Error | null, reachable = false) => {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n if (signal.aborted) reject(cancelledError());\n else if (error) reject(error);\n else resolve(reachable);\n };\n const family = isIP(address);\n if (family !== 4 && family !== 6) {\n reject(new Error(\"Tunnel DNS returned an invalid address\"));\n return;\n }\n const req = request({\n protocol: \"https:\",\n hostname,\n servername: hostname,\n port: 443,\n method: \"GET\",\n path: PREVIEW_HEALTH_PATH,\n agent: false,\n signal,\n lookup: (_name, lookupOptions, callback) => {\n if (lookupOptions.all) callback(null, [{ address, family }]);\n else callback(null, address, family);\n },\n headers: { Host: hostname, Connection: \"close\" },\n });\n const timer = setTimeout(() => {\n req.destroy(new Error(\"Tunnel health probe timed out\"));\n }, HTTPS_PROBE_TIMEOUT_MS);\n timer.unref?.();\n req.once(\"response\", (response) => {\n const reachable =\n response.statusCode === 204 &&\n response.headers[PREVIEW_HEALTH_HEADER] === PREVIEW_HEALTH_MARKER;\n response.resume();\n response.once(\"end\", () => finish(null, reachable));\n response.once(\"error\", (error) => finish(error));\n });\n req.once(\"error\", (error) => finish(error));\n req.end();\n });\n}\n\nexport async function waitForQuickTunnelReachability(\n options: QuickTunnelReachabilityOptions,\n): Promise<void> {\n const hostname = new URL(options.publicUrl).hostname;\n if (!hostname.endsWith(`.${TRY_CLOUDFLARE_ZONE}`)) {\n throw new Error(\"cloudflared provided an invalid Quick Tunnel URL\");\n }\n const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const retryIntervalMs = options.retryIntervalMs ?? DEFAULT_RETRY_INTERVAL_MS;\n const resolveEdgeAddresses =\n options.resolveEdgeAddresses ?? createQuickTunnelAuthoritativeResolver();\n const probeEdgeAddress = options.probeEdgeAddress ?? probePreviewTunnelEdge;\n const attemptAbort = new AbortController();\n const cancelAttempt = () => attemptAbort.abort();\n options.signal.addEventListener(\"abort\", cancelAttempt, { once: true });\n const timeout = setTimeout(() => attemptAbort.abort(), timeoutMs);\n timeout.unref?.();\n const deadline = Date.now() + timeoutMs;\n\n try {\n while (Date.now() < deadline) {\n throwIfAborted(options.signal);\n try {\n const addresses = await resolveEdgeAddresses(hostname, attemptAbort.signal);\n for (const address of addresses) {\n if (await probeEdgeAddress(hostname, address, attemptAbort.signal)) return;\n }\n } catch {\n throwIfAborted(options.signal);\n }\n\n const remainingMs = deadline - Date.now();\n if (remainingMs <= 0 || attemptAbort.signal.aborted) break;\n try {\n await sleep(Math.min(retryIntervalMs, remainingMs), undefined, {\n signal: attemptAbort.signal,\n });\n } catch {\n throwIfAborted(options.signal);\n break;\n }\n }\n } finally {\n clearTimeout(timeout);\n options.signal.removeEventListener(\"abort\", cancelAttempt);\n }\n\n throwIfAborted(options.signal);\n throw new Error(`Quick Tunnel did not become reachable within ${timeoutMs / 1000}s`);\n}\n","import { spawn, type ChildProcess, type SpawnOptions } from \"node:child_process\";\nimport { waitForQuickTunnelReachability } from \"./quick-tunnel-readiness.js\";\nimport { terminateTunnelChild } from \"./tunnel-child-termination.js\";\n\nconst CLOUDFLARED_URL_TIMEOUT_MS = 30_000;\nconst CLOUDFLARED_CONNECTION_TIMEOUT_MS = 45_000;\nconst CLOUDFLARED_REACHABILITY_TIMEOUT_MS = 60_000;\nexport const CLOUDFLARED_OUTPUT_LIMIT_BYTES = 64 * 1024;\nconst CLOUDFLARED_STOP_TIMEOUT_MS = 5_000;\nconst SIGNAL_SCAN_TAIL_CHARS = 256;\n\nconst TRY_CLOUDFLARE_URL_PATTERN = /https:\\/\\/[a-z0-9-]+\\.trycloudflare\\.com\\b/i;\nconst TRY_CLOUDFLARE_OUTPUT_PATTERN = /(?:https:\\/\\/)?[a-z0-9-]+\\.trycloudflare\\.com\\b/gi;\nconst REGISTERED_CONNECTION_MARKER = \"Registered tunnel connection\";\n\ninterface CloudflaredQuickTunnelOptions {\n cloudflaredBin: string;\n originUrl: string;\n configPath: string;\n pidFilePath?: string;\n env?: NodeJS.ProcessEnv;\n urlTimeoutMs?: number;\n connectionTimeoutMs?: number;\n reachabilityTimeoutMs?: number;\n spawn?: typeof spawn;\n waitForReachability?: typeof waitForQuickTunnelReachability;\n}\n\nexport interface CloudflaredQuickTunnel {\n child: ChildProcess;\n publicUrl: Promise<string>;\n connectionReady: Promise<void>;\n publicReady: Promise<string>;\n getOutput: () => string;\n stop: () => Promise<void>;\n}\n\nexport function extractTryCloudflareUrl(output: string): string | null {\n return output.match(TRY_CLOUDFLARE_URL_PATTERN)?.[0] ?? null;\n}\n\nfunction appendOutputTail(current: string, chunk: string): string {\n const combined = current + chunk;\n const bytes = Buffer.from(combined);\n if (bytes.length <= CLOUDFLARED_OUTPUT_LIMIT_BYTES) return combined;\n let start = bytes.length - CLOUDFLARED_OUTPUT_LIMIT_BYTES;\n while (start < bytes.length && (bytes[start]! & 0xc0) === 0x80) start += 1;\n return bytes.subarray(start).toString(\"utf8\");\n}\n\nfunction redactOutput(output: string): string {\n return appendOutputTail(\n \"\",\n output.replace(TRY_CLOUDFLARE_OUTPUT_PATTERN, \"[trycloudflare URL redacted]\"),\n );\n}\n\ninterface TimedSignal<T> {\n promise: Promise<T>;\n resolve(value: T): void;\n reject(error: Error): void;\n}\n\nfunction createTimedSignal<T>(timeoutMs: number, timeoutMessage: string): TimedSignal<T> {\n let settled = false;\n let resolvePromise!: (value: T) => void;\n let rejectPromise!: (error: Error) => void;\n const promise = new Promise<T>((resolve, reject) => {\n resolvePromise = resolve;\n rejectPromise = reject;\n });\n const timer = setTimeout(() => {\n if (settled) return;\n settled = true;\n rejectPromise(new Error(timeoutMessage));\n }, timeoutMs);\n\n return {\n promise,\n resolve(value) {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n resolvePromise(value);\n },\n reject(error) {\n if (settled) return;\n settled = true;\n clearTimeout(timer);\n rejectPromise(error);\n },\n };\n}\n\nfunction processFailure(error: unknown): Error {\n const code =\n error && typeof error === \"object\" && \"code\" in error\n ? (error as NodeJS.ErrnoException).code\n : undefined;\n if (code === \"ENOENT\") {\n return new Error(\"cloudflared was not found. Install cloudflared and retry.\");\n }\n return new Error(\n typeof code === \"string\" && /^E[A-Z0-9_]{1,31}$/.test(code)\n ? `cloudflared process failed (${code})`\n : \"cloudflared process failed\",\n );\n}\n\nexport async function terminateCloudflaredChild(child: ChildProcess | null): Promise<void> {\n await terminateTunnelChild(child, {\n processName: \"cloudflared\",\n gracefulSignal: \"SIGTERM\",\n gracefulTimeoutMs: CLOUDFLARED_STOP_TIMEOUT_MS,\n });\n}\n\nexport function startCloudflaredQuickTunnel(\n options: CloudflaredQuickTunnelOptions,\n): CloudflaredQuickTunnel {\n const args = [\n \"tunnel\",\n \"--config\",\n options.configPath,\n \"--no-autoupdate\",\n \"--grace-period\",\n \"2s\",\n \"--protocol\",\n \"auto\",\n \"--url\",\n options.originUrl,\n \"--loglevel\",\n \"info\",\n ...(options.pidFilePath ? [\"--pidfile\", options.pidFilePath] : []),\n ];\n const spawnOptions: SpawnOptions = {\n env: options.env,\n stdio: [\"ignore\", \"pipe\", \"pipe\"],\n };\n const child = (options.spawn ?? spawn)(options.cloudflaredBin, args, spawnOptions);\n\n const urlTimeoutMs = options.urlTimeoutMs ?? CLOUDFLARED_URL_TIMEOUT_MS;\n const connectionTimeoutMs = options.connectionTimeoutMs ?? CLOUDFLARED_CONNECTION_TIMEOUT_MS;\n const publicUrlSignal = createTimedSignal<string>(\n urlTimeoutMs,\n `cloudflared did not provide a trycloudflare.com URL within ${urlTimeoutMs / 1000}s`,\n );\n const connectionSignal = createTimedSignal<void>(\n connectionTimeoutMs,\n `cloudflared did not register a tunnel connection within ${connectionTimeoutMs / 1000}s`,\n );\n // Some consumers only need one signal. Mark both promises handled without changing what awaiters see.\n void publicUrlSignal.promise.catch(() => undefined);\n void connectionSignal.promise.catch(() => undefined);\n const readinessAbort = new AbortController();\n let publicReadyPromise: Promise<string> | null = null;\n const getPublicReady = () => {\n publicReadyPromise ??= Promise.all([publicUrlSignal.promise, connectionSignal.promise]).then(\n async ([publicUrl]) => {\n await (options.waitForReachability ?? waitForQuickTunnelReachability)({\n publicUrl,\n signal: readinessAbort.signal,\n timeoutMs: options.reachabilityTimeoutMs ?? CLOUDFLARED_REACHABILITY_TIMEOUT_MS,\n });\n return publicUrl;\n },\n );\n void publicReadyPromise.catch(() => undefined);\n return publicReadyPromise;\n };\n\n let output = \"\";\n const scanTails = { stdout: \"\", stderr: \"\" };\n const inspect = (source: keyof typeof scanTails, chunk: string | Buffer) => {\n const text = chunk.toString();\n const scan = scanTails[source] + text;\n scanTails[source] = scan.slice(-SIGNAL_SCAN_TAIL_CHARS);\n output = appendOutputTail(output, text);\n\n const url = extractTryCloudflareUrl(scan);\n if (url) publicUrlSignal.resolve(url);\n if (scan.includes(REGISTERED_CONNECTION_MARKER)) connectionSignal.resolve();\n };\n\n child.stdout?.setEncoding(\"utf8\");\n child.stderr?.setEncoding(\"utf8\");\n child.stdout?.on(\"data\", (chunk: string | Buffer) => inspect(\"stdout\", chunk));\n child.stderr?.on(\"data\", (chunk: string | Buffer) => inspect(\"stderr\", chunk));\n child.once(\"error\", (error) => {\n readinessAbort.abort();\n const failure = processFailure(error);\n publicUrlSignal.reject(failure);\n connectionSignal.reject(failure);\n });\n child.once(\"exit\", (code, signal) => {\n readinessAbort.abort();\n publicUrlSignal.reject(\n new Error(\n `cloudflared exited before providing a tunnel URL (code=${code}, signal=${signal})`,\n ),\n );\n connectionSignal.reject(\n new Error(\n `cloudflared exited before registering a tunnel connection (code=${code}, signal=${signal})`,\n ),\n );\n });\n\n let stopPromise: Promise<void> | null = null;\n\n return {\n child,\n publicUrl: publicUrlSignal.promise,\n connectionReady: connectionSignal.promise,\n get publicReady() {\n return getPublicReady();\n },\n getOutput: () => redactOutput(output),\n stop: () => {\n if (!stopPromise) {\n readinessAbort.abort();\n publicUrlSignal.reject(new Error(\"cloudflared stopped before providing a tunnel URL\"));\n connectionSignal.reject(\n new Error(\"cloudflared stopped before registering a tunnel connection\"),\n );\n stopPromise = terminateCloudflaredChild(child).catch((error: unknown) => {\n stopPromise = null;\n throw error;\n });\n }\n return stopPromise;\n },\n };\n}\n","import type { ChildProcess } from \"node:child_process\";\n\ninterface TunnelChildTerminationOptions {\n processName: string;\n gracefulSignal: NodeJS.Signals;\n gracefulTimeoutMs: number;\n forceTimeoutMs?: number;\n}\n\nfunction hasExited(child: ChildProcess): boolean {\n return child.exitCode !== null || child.signalCode !== null;\n}\n\nfunction signalAndWait(\n child: ChildProcess,\n processName: string,\n signal: NodeJS.Signals,\n timeoutMs: number,\n): Promise<boolean> {\n if (hasExited(child)) return Promise.resolve(true);\n\n return new Promise((resolve, reject) => {\n let settled = false;\n const timerRef: { current?: ReturnType<typeof setTimeout> } = {};\n const cleanup = () => {\n if (timerRef.current) clearTimeout(timerRef.current);\n child.off(\"exit\", onExit);\n };\n const finish = (exited: boolean) => {\n if (settled) return;\n settled = true;\n cleanup();\n resolve(exited);\n };\n const fail = (message: string) => {\n if (settled) return;\n settled = true;\n cleanup();\n reject(new Error(message));\n };\n const onExit = () => finish(true);\n\n child.once(\"exit\", onExit);\n let accepted: boolean;\n try {\n accepted = child.kill(signal);\n } catch {\n if (hasExited(child)) finish(true);\n else fail(`${processName} process could not be signalled with ${signal}`);\n return;\n }\n\n if (settled) return;\n if (hasExited(child)) {\n finish(true);\n return;\n }\n if (!accepted) {\n fail(`${processName} process rejected ${signal}`);\n return;\n }\n\n timerRef.current = setTimeout(() => finish(false), timeoutMs);\n timerRef.current.unref?.();\n });\n}\n\nexport async function terminateTunnelChild(\n child: ChildProcess | null,\n options: TunnelChildTerminationOptions,\n): Promise<void> {\n if (!child || hasExited(child)) return;\n\n const gracefulExit = await signalAndWait(\n child,\n options.processName,\n options.gracefulSignal,\n options.gracefulTimeoutMs,\n );\n if (gracefulExit) return;\n\n const forcedExit = await signalAndWait(\n child,\n options.processName,\n \"SIGKILL\",\n options.forceTimeoutMs ?? 1_000,\n );\n if (!forcedExit) {\n throw new Error(`${options.processName} process did not exit after SIGKILL`);\n }\n}\n"],"mappings":";;;AAAA,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,cAAc,aAAa;AAEpC,IAAM,sBAAsB;AAC5B,IAAM,qBAAqB;AAC3B,IAAM,4BAA4B;AAClC,IAAM,iBAAiB;AACvB,IAAM,yBAAyB;AAExB,IAAM,sBAAsB;AAC5B,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAkBrC,SAAS,iBAAwB;AAC/B,SAAO,IAAI,MAAM,kCAAkC;AACrD;AAEA,SA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Ac;AACd,gBAAM;AAAA,QACR,CAAC;AAAA,MACH;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -402,7 +402,6 @@ function detectAgentCliStatus(env = process.env, options = {}) {
|
|
|
402
402
|
() => resolveCodexCommand(env),
|
|
403
403
|
[...discoverProviderCandidates("codex", env), ...options.suggestions?.codex ?? []]
|
|
404
404
|
),
|
|
405
|
-
// Shared 为滚动升级把该字段保持 optional;当前 Proxy 的探测结果始终完整上报 Kimi。
|
|
406
405
|
kimi: detect(
|
|
407
406
|
() => resolveKimiCommand(env),
|
|
408
407
|
[...discoverProviderCandidates("kimi", env), ...options.suggestions?.kimi ?? []]
|
|
@@ -411,6 +410,7 @@ function detectAgentCliStatus(env = process.env, options = {}) {
|
|
|
411
410
|
}
|
|
412
411
|
|
|
413
412
|
export {
|
|
413
|
+
findExecutableCandidates,
|
|
414
414
|
CLAUDE_PROVIDER,
|
|
415
415
|
CodexApprovalPolicyUnsupportedError,
|
|
416
416
|
resolveCodexPermissionPolicy,
|
|
@@ -421,4 +421,4 @@ export {
|
|
|
421
421
|
KIMI_PROVIDER,
|
|
422
422
|
detectAgentCliStatus
|
|
423
423
|
};
|
|
424
|
-
//# sourceMappingURL=chunk-
|
|
424
|
+
//# sourceMappingURL=chunk-DZ4GXMP5.js.map
|