@mycadet/cli 0.13.0-dev.202610262105.8c45cc2 → 0.13.0-dev.202610271937.2f71260
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/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/avatar-manifest/package.json +1 -1
- package/node_modules/@mycadet/environments/package.json +1 -1
- package/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/package.json +1 -1
- package/node_modules/@mycadet/local-mode/package.json +1 -1
- package/node_modules/@mycadet/local-mode/src/__tests__/gateway-proxy.test.ts +23 -52
- package/node_modules/@mycadet/local-mode/src/__tests__/pair.test.ts +230 -144
- package/node_modules/@mycadet/local-mode/src/__tests__/unpair.test.ts +7 -3
- package/node_modules/@mycadet/local-mode/src/gateway-proxy.ts +2 -1
- package/node_modules/@mycadet/local-mode/src/index.ts +2 -1
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.test.ts +34 -31
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +35 -45
- package/node_modules/@mycadet/local-mode/src/lockfile.test.ts +69 -112
- package/node_modules/@mycadet/local-mode/src/lockfile.ts +30 -69
- package/node_modules/@mycadet/local-mode/src/pair.ts +66 -108
- package/node_modules/@mycadet/local-mode/src/served-config.test.ts +1 -3
- package/node_modules/@mycadet/local-mode/src/status.ts +1 -14
- package/node_modules/@mycadet/local-mode/src/unpair.ts +8 -18
- package/node_modules/@mycadet/service-contracts/package.json +1 -1
- package/node_modules/@mycadet/shared/package.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/app-command.test.ts +3 -8
- package/src/__tests__/assistant-client-cloud-auth.test.ts +10 -2
- package/src/__tests__/assistant-client-refresh.test.ts +0 -2
- package/src/__tests__/assistant-config.test.ts +22 -21
- package/src/__tests__/backup.test.ts +0 -4
- package/src/__tests__/client-tui-refresh.test.ts +12 -11
- package/src/__tests__/connect-import.test.ts +6 -4
- package/src/__tests__/debug.test.ts +1 -1
- package/src/__tests__/devices.test.ts +3 -5
- package/src/__tests__/gateway-token.test.ts +0 -2
- package/src/__tests__/host-teleport-docker.test.ts +10 -19
- package/src/__tests__/host-teleport.test.ts +0 -1
- package/src/__tests__/multi-local.test.ts +0 -3
- package/src/__tests__/nginx-ingress.test.ts +313 -443
- package/src/__tests__/ps-cloud-status.test.ts +3 -7
- package/src/__tests__/restore.test.ts +0 -1
- package/src/__tests__/root-backup-docker.test.ts +0 -1
- package/src/__tests__/root-backup.test.ts +0 -1
- package/src/__tests__/root-restore-command.test.ts +3 -4
- package/src/__tests__/runtime-url.test.ts +5 -21
- package/src/__tests__/setup.test.ts +49 -20
- package/src/__tests__/teleport.test.ts +0 -1
- package/src/__tests__/tui-midsession-refresh.test.ts +13 -8
- package/src/__tests__/tunnel-stop.test.ts +0 -1
- package/src/__tests__/tunnel.test.ts +42 -87
- package/src/__tests__/upgrade-local.test.ts +0 -1
- package/src/__tests__/upgrade-root-recovery.test.ts +5 -5
- package/src/__tests__/wake.test.ts +21 -51
- package/src/commands/app.ts +16 -48
- package/src/commands/completions.test.ts +0 -1
- package/src/commands/connect/import.ts +23 -15
- package/src/commands/ps.ts +6 -20
- package/src/commands/sleep.ts +1 -1
- package/src/commands/tunnel.ts +4 -6
- package/src/commands/upgrade.ts +1 -11
- package/src/commands/wake.ts +1 -6
- package/src/lib/__tests__/port-heal.test.ts +2 -3
- package/src/lib/__tests__/runtime-url.test.ts +0 -1
- package/src/lib/hatch-local.ts +142 -147
- package/src/lib/host-teleport.ts +4 -1
- package/src/lib/local.ts +1 -1
- package/src/lib/nginx-ingress.ts +159 -175
- package/src/lib/retire-local.ts +1 -1
- package/src/lib/sync-cloud-assistants.ts +0 -1
- package/src/lib/tunnel.ts +46 -52
|
@@ -3,6 +3,7 @@ import fs from "node:fs";
|
|
|
3
3
|
import os from "node:os";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
|
|
6
|
+
import { GATEWAY_PORT } from "../lockfile-contract";
|
|
6
7
|
import {
|
|
7
8
|
authorizePairedForwardHeaders,
|
|
8
9
|
gatewayTargetsFromLockfile,
|
|
@@ -192,26 +193,27 @@ describe("resolveGatewayProxyTarget", () => {
|
|
|
192
193
|
});
|
|
193
194
|
|
|
194
195
|
describe("gatewayTargetsFromLockfile", () => {
|
|
195
|
-
test("resolves a paired entry
|
|
196
|
+
test("resolves a paired entry's custom addressing to a remote target", () => {
|
|
196
197
|
expect(
|
|
197
198
|
gatewayTargetsFromLockfile({
|
|
198
199
|
assistants: [
|
|
199
200
|
{
|
|
200
201
|
assistantId: "abc-123",
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
cloud: "custom",
|
|
203
|
+
ipAddress: "gw.example.com",
|
|
204
|
+
port: 443,
|
|
203
205
|
},
|
|
204
206
|
],
|
|
205
207
|
}),
|
|
206
208
|
).toEqual(targets({ "abc-123": remote("https://gw.example.com") })());
|
|
207
209
|
});
|
|
208
210
|
|
|
209
|
-
test("omits
|
|
211
|
+
test("omits loopback entries with no recorded port beyond the default's loopback form", () => {
|
|
210
212
|
expect(
|
|
211
213
|
gatewayTargetsFromLockfile({
|
|
212
214
|
assistants: [
|
|
213
|
-
{ assistantId: "abc-123",
|
|
214
|
-
{ assistantId: "def-456",
|
|
215
|
+
{ assistantId: "abc-123", cloud: "custom" },
|
|
216
|
+
{ assistantId: "def-456", cloud: "cloud" },
|
|
215
217
|
],
|
|
216
218
|
}),
|
|
217
219
|
).toEqual(new Map());
|
|
@@ -231,42 +233,12 @@ describe("gatewayTargetsFromLockfile", () => {
|
|
|
231
233
|
).toEqual(targets({ "abc-123": loopback(8080) })());
|
|
232
234
|
});
|
|
233
235
|
|
|
234
|
-
test("
|
|
236
|
+
test("a docker entry without a recorded port derives the default gateway port", () => {
|
|
235
237
|
expect(
|
|
236
238
|
gatewayTargetsFromLockfile({
|
|
237
|
-
assistants: [
|
|
238
|
-
{
|
|
239
|
-
assistantId: "abc-123",
|
|
240
|
-
cloud: "docker",
|
|
241
|
-
runtimeUrl: "http://127.0.0.1:9000",
|
|
242
|
-
},
|
|
243
|
-
],
|
|
239
|
+
assistants: [{ assistantId: "abc-123", cloud: "docker" }],
|
|
244
240
|
}),
|
|
245
|
-
).toEqual(new Map([["abc-123", loopback(
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
test("resolves a loopback-cloud entry whose runtimeUrl is remote as paired", () => {
|
|
249
|
-
// Paired-ness derives from the addressing (no stored flag): a
|
|
250
|
-
// loopback-gateway cloud whose runtimeUrl points off-machine is a
|
|
251
|
-
// connect import, so it targets that remote runtimeUrl.
|
|
252
|
-
expect(
|
|
253
|
-
gatewayTargetsFromLockfile({
|
|
254
|
-
assistants: [
|
|
255
|
-
{
|
|
256
|
-
assistantId: "abc-123",
|
|
257
|
-
cloud: "local",
|
|
258
|
-
runtimeUrl: "https://elsewhere.example.com",
|
|
259
|
-
},
|
|
260
|
-
],
|
|
261
|
-
}),
|
|
262
|
-
).toEqual(
|
|
263
|
-
new Map([
|
|
264
|
-
[
|
|
265
|
-
"abc-123",
|
|
266
|
-
{ kind: "remote", runtimeUrl: "https://elsewhere.example.com" },
|
|
267
|
-
],
|
|
268
|
-
]),
|
|
269
|
-
);
|
|
241
|
+
).toEqual(new Map([["abc-123", loopback(GATEWAY_PORT)]]));
|
|
270
242
|
});
|
|
271
243
|
|
|
272
244
|
test("omits ports outside the 1024-65535 proxy range", () => {
|
|
@@ -281,7 +253,7 @@ describe("gatewayTargetsFromLockfile", () => {
|
|
|
281
253
|
{
|
|
282
254
|
assistantId: "def-456",
|
|
283
255
|
cloud: "docker",
|
|
284
|
-
|
|
256
|
+
resources: { gatewayPort: 70000 },
|
|
285
257
|
},
|
|
286
258
|
],
|
|
287
259
|
}),
|
|
@@ -293,31 +265,29 @@ describe("gatewayTargetsFromLockfile", () => {
|
|
|
293
265
|
gatewayTargetsFromLockfile({
|
|
294
266
|
assistants: [
|
|
295
267
|
{ assistantId: "a", cloud: "cloud" },
|
|
296
|
-
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
{ assistantId: "d", cloud: "gcp" },
|
|
268
|
+
// A retired spelling parses as "local": loopback-gated, so it
|
|
269
|
+
// derives the default loopback port rather than being omitted.
|
|
270
|
+
{ assistantId: "b", cloud: "gcp" },
|
|
300
271
|
],
|
|
301
272
|
}),
|
|
302
|
-
).toEqual(new Map());
|
|
273
|
+
).toEqual(new Map([["b", { kind: "loopback", port: GATEWAY_PORT }]]));
|
|
303
274
|
});
|
|
304
275
|
|
|
305
|
-
test("a custom entry's
|
|
306
|
-
// Targeting keys on the addressing alone: an entry whose runtimeUrl
|
|
307
|
-
// points off this machine resolves as remote, whatever its cloud says.
|
|
276
|
+
test("a custom entry's recorded addressing is targetable", () => {
|
|
308
277
|
expect(
|
|
309
278
|
gatewayTargetsFromLockfile({
|
|
310
279
|
assistants: [
|
|
311
280
|
{
|
|
312
281
|
assistantId: "c",
|
|
313
282
|
cloud: "custom",
|
|
314
|
-
|
|
283
|
+
ipAddress: "gw.example.com",
|
|
284
|
+
port: 7831,
|
|
315
285
|
},
|
|
316
286
|
],
|
|
317
287
|
}),
|
|
318
288
|
).toEqual(
|
|
319
289
|
new Map([
|
|
320
|
-
["c", { kind: "remote", runtimeUrl: "https://gw.example.com" }],
|
|
290
|
+
["c", { kind: "remote", runtimeUrl: "https://gw.example.com:7831" }],
|
|
321
291
|
]),
|
|
322
292
|
);
|
|
323
293
|
});
|
|
@@ -356,8 +326,9 @@ describe("readGatewayTargets", () => {
|
|
|
356
326
|
},
|
|
357
327
|
{
|
|
358
328
|
assistantId: "def-456",
|
|
359
|
-
|
|
360
|
-
|
|
329
|
+
cloud: "custom",
|
|
330
|
+
ipAddress: "gw.example.com",
|
|
331
|
+
port: 443,
|
|
361
332
|
},
|
|
362
333
|
],
|
|
363
334
|
}),
|