@mycadet/cli 0.12.7 → 0.12.9
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 +2 -2
- package/knip.json +1 -1
- package/node_modules/@mycadet/assistant-api/events/cloud-disconnected.ts +21 -0
- package/node_modules/@mycadet/assistant-api/events/host-bash.ts +1 -1
- package/node_modules/@mycadet/assistant-api/events/host-cu.ts +1 -1
- package/node_modules/@mycadet/assistant-api/events/host-file.ts +1 -1
- package/node_modules/@mycadet/assistant-api/events/notification-intent.ts +1 -1
- package/node_modules/@mycadet/assistant-api/events/show-cloud-login.ts +18 -0
- package/node_modules/@mycadet/assistant-api/index.ts +11 -11
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/package.json +2 -2
- package/node_modules/@mycadet/{service-contracts/src/platform-credential.ts → assistant-api/node_modules/@mycadet/service-contracts/src/cloud-credential.ts} +9 -9
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
- package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
- package/node_modules/@mycadet/assistant-api/responses/home.ts +1 -1
- package/node_modules/@mycadet/assistant-api/surfaces.ts +4 -4
- package/node_modules/@mycadet/avatar-manifest/src/__tests__/notification-avatar.test.ts +1 -1
- package/node_modules/@mycadet/avatar-manifest/src/notification-avatar.ts +2 -2
- package/node_modules/@mycadet/environments/src/seeds.ts +6 -6
- package/node_modules/@mycadet/environments/src/shell.test.ts +1 -1
- package/node_modules/@mycadet/environments/src/types.ts +6 -6
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/src/__tests__/notification-avatar.test.ts +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/src/notification-avatar.ts +2 -2
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/seeds.ts +6 -6
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/shell.test.ts +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/types.ts +6 -6
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +2 -2
- package/node_modules/@mycadet/{assistant-api/node_modules/@mycadet/service-contracts/src/platform-credential.ts → local-mode/node_modules/@mycadet/service-contracts/src/cloud-credential.ts} +9 -9
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
- package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
- package/node_modules/@mycadet/local-mode/src/__tests__/pair.test.ts +5 -5
- package/node_modules/@mycadet/local-mode/src/__tests__/retire.test.ts +1 -1
- package/node_modules/@mycadet/local-mode/src/config.ts +2 -2
- package/node_modules/@mycadet/local-mode/src/index.ts +1 -1
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.test.ts +3 -3
- package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +10 -5
- package/node_modules/@mycadet/local-mode/src/lockfile.test.ts +15 -15
- package/node_modules/@mycadet/local-mode/src/lockfile.ts +9 -9
- package/node_modules/@mycadet/local-mode/src/pair.ts +2 -2
- package/node_modules/@mycadet/local-mode/src/retire.ts +3 -3
- package/node_modules/@mycadet/local-mode/src/teleport-backup-policy.ts +2 -2
- package/node_modules/@mycadet/local-mode/src/unpair.ts +2 -2
- package/node_modules/@mycadet/service-contracts/package.json +2 -2
- package/node_modules/@mycadet/{local-mode/node_modules/@mycadet/service-contracts/src/platform-credential.ts → service-contracts/src/cloud-credential.ts} +9 -9
- package/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
- package/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
- package/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
- package/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
- package/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
- package/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
- package/package.json +3 -2
- package/src/__tests__/assistant-api-key-resolution.test.ts +6 -6
- package/src/__tests__/{assistant-client-platform-auth.test.ts → assistant-client-cloud-auth.test.ts} +10 -10
- package/src/__tests__/assistant-client-refresh.test.ts +2 -2
- package/src/__tests__/backup.test.ts +86 -91
- package/src/__tests__/client-token.test.ts +1 -1
- package/src/__tests__/client-tui-refresh.test.ts +1 -1
- package/src/__tests__/client-web-config.test.ts +2 -2
- package/src/__tests__/{platform-client.test.ts → cloud-client.test.ts} +59 -59
- package/src/__tests__/{platform-releases.test.ts → cloud-releases.test.ts} +28 -18
- package/src/__tests__/{cloudflare-tunnel.test.ts → cloudflare.test.ts} +1 -1
- package/src/__tests__/connect-import.test.ts +55 -39
- package/src/__tests__/debug.test.ts +38 -38
- package/src/__tests__/ensure-binary.test.ts +182 -0
- package/src/__tests__/guardian-token.test.ts +149 -56
- package/src/__tests__/hatch-provider-secrets.test.ts +2 -2
- package/src/__tests__/helpers/guardian-token.ts +22 -0
- package/src/__tests__/helpers/http.ts +10 -0
- package/src/__tests__/nginx-ingress.test.ts +21 -20
- package/src/__tests__/ngrok-spawn.test.ts +49 -0
- package/src/__tests__/orphan-detection.test.ts +1 -1
- package/src/__tests__/pair.test.ts +1 -8
- package/src/__tests__/{ps-platform-status.test.ts → ps-cloud-status.test.ts} +79 -26
- package/src/__tests__/ps-table.test.ts +79 -0
- package/src/__tests__/{recover.test.ts → restore.test.ts} +29 -28
- package/src/__tests__/retire.test.ts +58 -199
- package/src/__tests__/root-process-lockfile.test.ts +99 -0
- package/src/__tests__/sleep.test.ts +19 -19
- package/src/__tests__/statefulset.test.ts +8 -8
- package/src/__tests__/{tailscale-tunnel.test.ts → tailscale.test.ts} +2 -2
- package/src/__tests__/teleport-backup.test.ts +3 -3
- package/src/__tests__/teleport.test.ts +181 -197
- package/src/__tests__/tunnel.test.ts +257 -222
- package/src/__tests__/uninstall.test.ts +13 -4
- package/src/__tests__/upgrade-local.test.ts +3 -3
- package/src/__tests__/upgrade-replay-env.test.ts +12 -12
- package/src/__tests__/wake.test.ts +260 -43
- package/src/__tests__/workos-pkce.test.ts +2 -2
- package/src/commands/backup.ts +24 -24
- package/src/commands/client.ts +76 -76
- package/src/commands/completions.test.ts +104 -0
- package/src/commands/completions.ts +87 -0
- package/src/commands/debug.ts +20 -20
- package/src/commands/exec.ts +12 -12
- package/src/commands/flags.ts +2 -2
- package/src/commands/hatch.ts +23 -23
- package/src/commands/login.ts +22 -22
- package/src/commands/logs.ts +8 -8
- package/src/commands/ps.ts +244 -86
- package/src/commands/restart.ts +30 -0
- package/src/commands/restore.ts +140 -22
- package/src/commands/retire.ts +48 -150
- package/src/commands/rollback.ts +20 -26
- package/src/commands/setup.ts +2 -2
- package/src/commands/sleep.ts +2 -2
- package/src/commands/teleport.ts +109 -109
- package/src/commands/terminal.ts +158 -18
- package/src/commands/tunnel.ts +138 -157
- package/src/commands/uninstall.ts +57 -9
- package/src/commands/unpair.ts +3 -3
- package/src/commands/upgrade.ts +30 -54
- package/src/commands/use.ts +1 -1
- package/src/commands/wake.ts +166 -50
- package/src/index.ts +18 -9
- package/src/lib/__tests__/{platform-client-signed-url.test.ts → cloud-client-signed-url.test.ts} +16 -16
- package/src/lib/__tests__/docker.test.ts +168 -20
- package/src/lib/__tests__/job-polling.test.ts +2 -2
- package/src/lib/__tests__/local-runtime-client.test.ts +4 -4
- package/src/lib/__tests__/runtime-url.test.ts +1 -1
- package/src/lib/assistant-api-key-resolution.ts +5 -5
- package/src/lib/assistant-client.ts +8 -8
- package/src/lib/assistant-config.ts +58 -12
- package/src/lib/{platform-client.ts → cloud-client.ts} +107 -98
- package/src/lib/cloud-login.ts +24 -24
- package/src/lib/{platform-releases.ts → cloud-releases.ts} +11 -9
- package/src/lib/cloud-values.ts +3 -0
- package/src/lib/config-utils.ts +1 -1
- package/src/lib/detached-process.ts +1 -1
- package/src/lib/docker.ts +260 -53
- package/src/lib/ensure-binary.ts +171 -0
- package/src/lib/environments/__tests__/paths.test.ts +2 -2
- package/src/lib/environments/__tests__/resolve.test.ts +26 -26
- package/src/lib/environments/resolve.ts +8 -8
- package/src/lib/flag-args.test.ts +1 -1
- package/src/lib/flag-args.ts +1 -1
- package/src/lib/guardian-token.ts +37 -5
- package/src/lib/hatch-local.ts +19 -23
- package/src/lib/health-check.ts +6 -6
- package/src/lib/ingress-config.ts +8 -35
- package/src/lib/job-polling.ts +2 -2
- package/src/lib/live-voice/connection.ts +12 -12
- package/src/lib/live-voice/tunnel.test.ts +11 -11
- package/src/lib/live-voice/tunnel.ts +15 -15
- package/src/lib/local-runtime-client.ts +20 -20
- package/src/lib/local.ts +10 -31
- package/src/lib/nginx-ingress.ts +42 -15
- package/src/lib/pair.ts +1 -1
- package/src/lib/process.ts +1 -1
- package/src/lib/provider-secrets.ts +3 -3
- package/src/lib/retire-apple-container.ts +1 -1
- package/src/lib/runtime-url.ts +8 -8
- package/src/lib/statefulset.ts +2 -2
- package/src/lib/sync-cloud-assistants.ts +19 -19
- package/src/lib/teleport-backup.ts +4 -4
- package/src/lib/terminal-client.ts +17 -17
- package/src/lib/terminal-session.ts +24 -24
- package/src/lib/{tunnel-edge.ts → tunnel.ts} +199 -11
- package/src/lib/tunnels/cadet.ts +29 -0
- package/src/lib/{cloudflare-tunnel.ts → tunnels/cloudflare.ts} +36 -15
- package/src/lib/tunnels/gateway-notify.ts +61 -0
- package/src/lib/{ngrok.ts → tunnels/ngrok.ts} +350 -89
- package/src/lib/{tailscale-tunnel.ts → tunnels/tailscale.ts} +53 -9
- package/src/lib/upgrade-lifecycle.ts +8 -21
- package/src/lib/upgrade-preflight.ts +2 -2
- package/src/lib/workos-pkce.ts +5 -5
- package/node_modules/@mycadet/assistant-api/events/platform-disconnected.ts +0 -21
- package/node_modules/@mycadet/assistant-api/events/show-platform-login.ts +0 -20
- package/src/commands/recover.ts +0 -131
- package/src/commands/roadmap.ts +0 -459
- package/src/commands/ssh.ts +0 -144
- package/src/commands/workflows.ts +0 -305
- package/src/lib/managed-cloud.ts +0 -3
|
@@ -63,19 +63,11 @@ export type LocalInstanceResources = Omit<
|
|
|
63
63
|
[key: string]: unknown;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
/** Docker image metadata for the service group. Enables rollback to known-good
|
|
66
|
+
/** Docker image metadata for the service group. Enables rollback to known-good refs. */
|
|
67
67
|
export interface ContainerInfo {
|
|
68
68
|
assistantImage: string;
|
|
69
69
|
gatewayImage: string;
|
|
70
70
|
cesImage: string;
|
|
71
|
-
/** sha256 digest of the assistant image at time of hatch/upgrade */
|
|
72
|
-
assistantDigest?: string;
|
|
73
|
-
/** sha256 digest of the gateway image at time of hatch/upgrade */
|
|
74
|
-
gatewayDigest?: string;
|
|
75
|
-
/** sha256 digest of the CES image at time of hatch/upgrade */
|
|
76
|
-
cesDigest?: string;
|
|
77
|
-
/** Docker network name for the service group */
|
|
78
|
-
networkName?: string;
|
|
79
71
|
/**
|
|
80
72
|
* Host-side port the assistant HTTP API is published on. Dynamically
|
|
81
73
|
* allocated at hatch time so concurrent instances don't collide on the
|
|
@@ -159,10 +151,29 @@ export type AssistantLookupResult =
|
|
|
159
151
|
interface LockfileData {
|
|
160
152
|
assistants?: Record<string, unknown>[];
|
|
161
153
|
activeAssistant?: string;
|
|
162
|
-
|
|
154
|
+
cloudBaseUrl?: string;
|
|
155
|
+
tunnel?: RootProcessRecord;
|
|
156
|
+
app?: RootProcessRecord;
|
|
163
157
|
[key: string]: unknown;
|
|
164
158
|
}
|
|
165
159
|
|
|
160
|
+
/**
|
|
161
|
+
* A CLI-managed OS process recorded at the lockfile root, keyed by what it is
|
|
162
|
+
* for — `tunnel` (the auto-tunnel agent fronting the edge) and `app` (the
|
|
163
|
+
* nginx ingress edge). `cadet ps` renders these alongside the per-assistant
|
|
164
|
+
* process trees, and the stop paths verify the pid before signaling it.
|
|
165
|
+
*/
|
|
166
|
+
export interface RootProcessRecord {
|
|
167
|
+
pid: number;
|
|
168
|
+
/** Which tunnel provider owns the process; "tunnel" entries only. */
|
|
169
|
+
provider?: string;
|
|
170
|
+
/** The assistant the process fronts, so `cadet ps` can nest the row. */
|
|
171
|
+
assistantId?: string;
|
|
172
|
+
startedAt: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export type RootProcessKind = "tunnel" | "app";
|
|
176
|
+
|
|
166
177
|
/**
|
|
167
178
|
* Derive the daemon PID file path from a resources object. The PID file
|
|
168
179
|
* lives inside the instance's workspace directory. When no resources are
|
|
@@ -224,6 +235,40 @@ function withCliLockfileLock<T>(fn: () => T): T {
|
|
|
224
235
|
return locked.value;
|
|
225
236
|
}
|
|
226
237
|
|
|
238
|
+
/** Record a CLI-managed root process (tunnel agent, app edge) by pid. */
|
|
239
|
+
export function stampRootProcess(
|
|
240
|
+
kind: RootProcessKind,
|
|
241
|
+
record: RootProcessRecord,
|
|
242
|
+
): void {
|
|
243
|
+
withCliLockfileLock(() => {
|
|
244
|
+
const data = readLockfile();
|
|
245
|
+
data[kind] = record;
|
|
246
|
+
writeLockfileUnlocked(data);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/** Drop the recorded root process entry, e.g. once the process is stopped. */
|
|
251
|
+
export function clearRootProcess(kind: RootProcessKind): void {
|
|
252
|
+
withCliLockfileLock(() => {
|
|
253
|
+
const data = readLockfile();
|
|
254
|
+
if (data[kind] === undefined) return;
|
|
255
|
+
delete data[kind];
|
|
256
|
+
writeLockfileUnlocked(data);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Read the root-level process entries for `cadet ps`. Read-only: no lock, so
|
|
262
|
+
* a concurrently-updating lockfile is fine — the pid is verified separately.
|
|
263
|
+
*/
|
|
264
|
+
export function readRootProcesses(): {
|
|
265
|
+
tunnel?: RootProcessRecord;
|
|
266
|
+
app?: RootProcessRecord;
|
|
267
|
+
} {
|
|
268
|
+
const data = readLockfile();
|
|
269
|
+
return { tunnel: data.tunnel, app: data.app };
|
|
270
|
+
}
|
|
271
|
+
|
|
227
272
|
/**
|
|
228
273
|
* Try to extract a port number from a URL string (e.g. `http://localhost:7830`).
|
|
229
274
|
* Returns undefined if the URL is malformed or has no explicit port.
|
|
@@ -746,13 +791,14 @@ export async function allocateLocalResources(
|
|
|
746
791
|
}
|
|
747
792
|
|
|
748
793
|
/**
|
|
749
|
-
* Return `
|
|
794
|
+
* Return `cloudBaseUrl` from the lockfile, if set. This is the value
|
|
750
795
|
* persisted by {@link syncConfigToLockfile} the last time the active
|
|
751
796
|
* assistant was hatched/waked, and is the source of truth for "which
|
|
752
797
|
* platform does the currently-active assistant target".
|
|
753
798
|
*/
|
|
754
799
|
export function getLockfilePlatformBaseUrl(): string | undefined {
|
|
755
|
-
const
|
|
800
|
+
const lockfile = readLockfile();
|
|
801
|
+
const url = lockfile.cloudBaseUrl ?? lockfile.platformBaseUrl;
|
|
756
802
|
if (typeof url === "string" && url.trim()) return url.trim();
|
|
757
803
|
return undefined;
|
|
758
804
|
}
|