@mycadet/cli 0.12.7 → 0.12.9-dev.202610131452.9acab64
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 +6 -4
- 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 +1 -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 +15 -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 +149 -85
- package/src/__tests__/{ps-platform-status.test.ts → ps-cloud-status.test.ts} +80 -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 +180 -211
- package/src/__tests__/tunnel.test.ts +490 -270
- package/src/__tests__/uninstall.test.ts +150 -9
- 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 -78
- 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 +27 -24
- package/src/commands/login.ts +22 -22
- package/src/commands/logs.ts +8 -8
- package/src/commands/pair.ts +140 -37
- package/src/commands/ps.ts +232 -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 +110 -129
- package/src/commands/terminal.ts +158 -18
- package/src/commands/tunnel.ts +156 -175
- package/src/commands/uninstall.ts +137 -54
- 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-gateway-cli.test.ts +42 -0
- 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} +105 -99
- package/src/lib/cloud-login.ts +23 -24
- package/src/lib/{platform-releases.ts → cloud-releases.ts} +11 -9
- package/src/lib/cloud-values.ts +3 -0
- package/src/lib/color.ts +4 -0
- package/src/lib/config-utils.ts +1 -1
- package/src/lib/detached-process.ts +1 -1
- package/src/lib/docker.ts +300 -111
- package/src/lib/ensure-binary.ts +171 -0
- package/src/lib/environments/__tests__/paths.test.ts +29 -3
- package/src/lib/environments/__tests__/resolve.test.ts +26 -26
- package/src/lib/environments/paths.ts +16 -8
- package/src/lib/environments/resolve.ts +10 -12
- 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 +32 -29
- package/src/lib/hatch-next-steps.ts +5 -9
- 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 +46 -34
- package/src/lib/nginx-ingress.ts +40 -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/step-runner.ts +6 -1
- 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
package/src/commands/rollback.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isCloudHome } from "../lib/cloud-values.js";
|
|
2
2
|
import {
|
|
3
3
|
findAssistantByName,
|
|
4
4
|
getActiveAssistant,
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
type AssistantEntry,
|
|
8
8
|
} from "../lib/assistant-config";
|
|
9
9
|
import {
|
|
10
|
-
captureImageRefs,
|
|
11
10
|
GATEWAY_INTERNAL_PORT,
|
|
12
11
|
ASSISTANT_INTERNAL_PORT,
|
|
13
12
|
dockerResourceNames,
|
|
@@ -17,9 +16,9 @@ import {
|
|
|
17
16
|
import type { ServiceName } from "../lib/docker";
|
|
18
17
|
import { emitCliError, categorizeUpgradeError } from "../lib/cli-error.js";
|
|
19
18
|
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} from "../lib/
|
|
19
|
+
readCloudToken,
|
|
20
|
+
rollbackCloudAssistant,
|
|
21
|
+
} from "../lib/cloud-client.js";
|
|
23
22
|
import {
|
|
24
23
|
broadcastUpgradeEvent,
|
|
25
24
|
buildCompleteEvent,
|
|
@@ -47,17 +46,17 @@ function parseArgs(): { name: string | null; version: string | null } {
|
|
|
47
46
|
console.log("Usage: cadet rollback [<name>] [--version <version>]");
|
|
48
47
|
console.log("");
|
|
49
48
|
console.log(
|
|
50
|
-
"Roll back a Docker or
|
|
49
|
+
"Roll back a Docker or cloud assistant to a previous version.",
|
|
51
50
|
);
|
|
52
51
|
console.log("");
|
|
53
52
|
console.log("Arguments:");
|
|
54
53
|
console.log(
|
|
55
|
-
" <name> Name of the assistant
|
|
54
|
+
" <name> Name of the assistant, defaults to active or only assistant",
|
|
56
55
|
);
|
|
57
56
|
console.log("");
|
|
58
57
|
console.log("Options:");
|
|
59
58
|
console.log(
|
|
60
|
-
" --version <version> Target version
|
|
59
|
+
" --version <version> Target version, optional for managed — omit to roll back to previous",
|
|
61
60
|
);
|
|
62
61
|
console.log("");
|
|
63
62
|
console.log("Examples:");
|
|
@@ -136,7 +135,7 @@ async function rollbackPlatformViaEndpoint(
|
|
|
136
135
|
version?: string,
|
|
137
136
|
): Promise<void> {
|
|
138
137
|
// Step 1 — Authenticate
|
|
139
|
-
const token =
|
|
138
|
+
const token = readCloudToken();
|
|
140
139
|
if (!token) {
|
|
141
140
|
const msg =
|
|
142
141
|
"Error: Not logged in. Run `cadet login --token <token>` first.";
|
|
@@ -157,7 +156,7 @@ async function rollbackPlatformViaEndpoint(
|
|
|
157
156
|
|
|
158
157
|
let result: { detail: string; version: string | null };
|
|
159
158
|
try {
|
|
160
|
-
result = await
|
|
159
|
+
result = await rollbackCloudAssistant(
|
|
161
160
|
token,
|
|
162
161
|
entry.assistantId,
|
|
163
162
|
version,
|
|
@@ -225,14 +224,14 @@ export const rollback = Object.assign(
|
|
|
225
224
|
}
|
|
226
225
|
|
|
227
226
|
// ---------- Managed (Cadet Cloud) rollback ----------
|
|
228
|
-
if (
|
|
227
|
+
if (isCloudHome(cloud)) {
|
|
229
228
|
await rollbackPlatformViaEndpoint(entry, version ?? undefined);
|
|
230
229
|
return;
|
|
231
230
|
}
|
|
232
231
|
|
|
233
232
|
// ---------- Unsupported topologies ----------
|
|
234
233
|
if (cloud !== "docker") {
|
|
235
|
-
const msg = "Rollback is only supported for Docker and
|
|
234
|
+
const msg = "Rollback is only supported for Docker and cloud assistants.";
|
|
236
235
|
console.error(msg);
|
|
237
236
|
emitCliError("UNSUPPORTED_TOPOLOGY", msg);
|
|
238
237
|
process.exit(1);
|
|
@@ -273,21 +272,23 @@ export const rollback = Object.assign(
|
|
|
273
272
|
process.exit(1);
|
|
274
273
|
}
|
|
275
274
|
|
|
276
|
-
//
|
|
275
|
+
// Roll back to the previous images. Older entries recorded per-service
|
|
276
|
+
// digests (the image sha captured at upgrade time) — those are gone from
|
|
277
|
+
// the contract now; the recorded image refs are the rollback target.
|
|
277
278
|
const prev = entry.previousContainerInfo;
|
|
278
|
-
if (!prev.
|
|
279
|
+
if (!prev.assistantImage || !prev.gatewayImage || !prev.cesImage) {
|
|
279
280
|
const msg =
|
|
280
|
-
"Incomplete rollback state. Previous container
|
|
281
|
+
"Incomplete rollback state. Previous container image refs are missing.";
|
|
281
282
|
console.error(msg);
|
|
282
283
|
emitCliError("ROLLBACK_NO_STATE", msg);
|
|
283
284
|
process.exit(1);
|
|
284
285
|
}
|
|
285
286
|
|
|
286
|
-
// Build image refs from the previous
|
|
287
|
+
// Build image refs from the previous record
|
|
287
288
|
const previousImageRefs: Record<ServiceName, string> = {
|
|
288
|
-
assistant: prev.
|
|
289
|
-
"credential-executor": prev.
|
|
290
|
-
gateway: prev.
|
|
289
|
+
assistant: prev.assistantImage,
|
|
290
|
+
"credential-executor": prev.cesImage,
|
|
291
|
+
gateway: prev.gatewayImage,
|
|
291
292
|
};
|
|
292
293
|
|
|
293
294
|
const instanceName = entry.assistantId;
|
|
@@ -398,9 +399,6 @@ export const rollback = Object.assign(
|
|
|
398
399
|
const ready = await waitForReady(entry.runtimeUrl);
|
|
399
400
|
|
|
400
401
|
if (ready) {
|
|
401
|
-
// Capture new digests from the rolled-back containers
|
|
402
|
-
const newDigests = await captureImageRefs(res);
|
|
403
|
-
|
|
404
402
|
// Swap current/previous state to enable "rollback the rollback"
|
|
405
403
|
const updatedEntry: AssistantEntry = {
|
|
406
404
|
...entry,
|
|
@@ -408,10 +406,6 @@ export const rollback = Object.assign(
|
|
|
408
406
|
assistantImage: prev.assistantImage ?? previousImageRefs.assistant,
|
|
409
407
|
gatewayImage: prev.gatewayImage ?? previousImageRefs.gateway,
|
|
410
408
|
cesImage: prev.cesImage ?? previousImageRefs["credential-executor"],
|
|
411
|
-
assistantDigest: newDigests?.assistant,
|
|
412
|
-
gatewayDigest: newDigests?.gateway,
|
|
413
|
-
cesDigest: newDigests?.["credential-executor"],
|
|
414
|
-
networkName: res.network,
|
|
415
409
|
assistantPort,
|
|
416
410
|
},
|
|
417
411
|
previousContainerInfo: entry.containerInfo,
|
package/src/commands/setup.ts
CHANGED
|
@@ -48,7 +48,7 @@ function parseDefaultProviderResponse(value: unknown): DefaultProviderResponse {
|
|
|
48
48
|
* Ask the active assistant which provider it routes by default
|
|
49
49
|
* (`GET /v1/config/llm/default-provider`), so `cadet setup` without
|
|
50
50
|
* `--provider` configures the connection the assistant actually uses —
|
|
51
|
-
* e.g. the keyless Cadet Cloud
|
|
51
|
+
* e.g. the keyless Cadet Cloud cloud connection picked at hatch —
|
|
52
52
|
* instead of blindly prompting for an API key. Falls back to cadet
|
|
53
53
|
* when the runtime is unreachable or predates the endpoint; the
|
|
54
54
|
* returned warning says why, for the caller to render.
|
|
@@ -184,7 +184,7 @@ export const setup = Object.assign(
|
|
|
184
184
|
|
|
185
185
|
// Respect the assistant's configured default provider (e.g. Cadet Cloud
|
|
186
186
|
// chosen at hatch) unless the caller named one explicitly — the runtime's
|
|
187
|
-
// keyless
|
|
187
|
+
// keyless cloud connection should not be greeted by an API-key prompt.
|
|
188
188
|
let provider = parsed.provider;
|
|
189
189
|
if (!provider) {
|
|
190
190
|
const resolved = await resolveDefaultProvider(gatewayUrl, bearerToken);
|
package/src/commands/sleep.ts
CHANGED
|
@@ -71,7 +71,7 @@ export const sleep = Object.assign(
|
|
|
71
71
|
console.log("");
|
|
72
72
|
console.log("Arguments:");
|
|
73
73
|
console.log(
|
|
74
|
-
" <name> Name of the assistant to stop
|
|
74
|
+
" <name> Name of the assistant to stop, defaults to active or only local",
|
|
75
75
|
);
|
|
76
76
|
console.log("");
|
|
77
77
|
console.log("Options:");
|
|
@@ -88,7 +88,7 @@ export const sleep = Object.assign(
|
|
|
88
88
|
" schedules) to finish before stopping. Waits as long as it",
|
|
89
89
|
);
|
|
90
90
|
console.log(
|
|
91
|
-
" takes by default; pass a duration
|
|
91
|
+
" takes by default; pass a duration, e.g. --wait 90s or --wait 10m",
|
|
92
92
|
);
|
|
93
93
|
console.log(
|
|
94
94
|
" to bound the wait. Ctrl-C cancels and leaves the assistant running.",
|