@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.
Files changed (185) hide show
  1. package/README.md +2 -2
  2. package/knip.json +1 -1
  3. package/node_modules/@mycadet/assistant-api/events/cloud-disconnected.ts +21 -0
  4. package/node_modules/@mycadet/assistant-api/events/host-bash.ts +1 -1
  5. package/node_modules/@mycadet/assistant-api/events/host-cu.ts +1 -1
  6. package/node_modules/@mycadet/assistant-api/events/host-file.ts +1 -1
  7. package/node_modules/@mycadet/assistant-api/events/notification-intent.ts +1 -1
  8. package/node_modules/@mycadet/assistant-api/events/show-cloud-login.ts +18 -0
  9. package/node_modules/@mycadet/assistant-api/index.ts +11 -11
  10. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/package.json +2 -2
  11. package/node_modules/@mycadet/{service-contracts/src/platform-credential.ts → assistant-api/node_modules/@mycadet/service-contracts/src/cloud-credential.ts} +9 -9
  12. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
  13. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
  14. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
  15. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
  16. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
  17. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
  18. package/node_modules/@mycadet/assistant-api/responses/home.ts +1 -1
  19. package/node_modules/@mycadet/assistant-api/surfaces.ts +4 -4
  20. package/node_modules/@mycadet/avatar-manifest/src/__tests__/notification-avatar.test.ts +1 -1
  21. package/node_modules/@mycadet/avatar-manifest/src/notification-avatar.ts +2 -2
  22. package/node_modules/@mycadet/environments/src/seeds.ts +6 -6
  23. package/node_modules/@mycadet/environments/src/shell.test.ts +1 -1
  24. package/node_modules/@mycadet/environments/src/types.ts +6 -6
  25. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/src/__tests__/notification-avatar.test.ts +1 -1
  26. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/src/notification-avatar.ts +2 -2
  27. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/seeds.ts +6 -6
  28. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/shell.test.ts +1 -1
  29. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/types.ts +6 -6
  30. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +2 -2
  31. 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
  32. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
  33. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
  34. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
  35. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
  36. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
  37. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
  38. package/node_modules/@mycadet/local-mode/src/__tests__/pair.test.ts +5 -5
  39. package/node_modules/@mycadet/local-mode/src/__tests__/retire.test.ts +1 -1
  40. package/node_modules/@mycadet/local-mode/src/config.ts +2 -2
  41. package/node_modules/@mycadet/local-mode/src/index.ts +1 -1
  42. package/node_modules/@mycadet/local-mode/src/lockfile-contract.test.ts +3 -3
  43. package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +10 -5
  44. package/node_modules/@mycadet/local-mode/src/lockfile.test.ts +15 -15
  45. package/node_modules/@mycadet/local-mode/src/lockfile.ts +9 -9
  46. package/node_modules/@mycadet/local-mode/src/pair.ts +2 -2
  47. package/node_modules/@mycadet/local-mode/src/retire.ts +3 -3
  48. package/node_modules/@mycadet/local-mode/src/teleport-backup-policy.ts +2 -2
  49. package/node_modules/@mycadet/local-mode/src/unpair.ts +2 -2
  50. package/node_modules/@mycadet/service-contracts/package.json +2 -2
  51. package/node_modules/@mycadet/{local-mode/node_modules/@mycadet/service-contracts/src/platform-credential.ts → service-contracts/src/cloud-credential.ts} +9 -9
  52. package/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
  53. package/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
  54. package/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
  55. package/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
  56. package/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
  57. package/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
  58. package/package.json +6 -4
  59. package/src/__tests__/assistant-api-key-resolution.test.ts +6 -6
  60. package/src/__tests__/{assistant-client-platform-auth.test.ts → assistant-client-cloud-auth.test.ts} +10 -10
  61. package/src/__tests__/assistant-client-refresh.test.ts +2 -2
  62. package/src/__tests__/backup.test.ts +86 -91
  63. package/src/__tests__/client-token.test.ts +1 -1
  64. package/src/__tests__/client-tui-refresh.test.ts +1 -1
  65. package/src/__tests__/client-web-config.test.ts +1 -2
  66. package/src/__tests__/{platform-client.test.ts → cloud-client.test.ts} +59 -59
  67. package/src/__tests__/{platform-releases.test.ts → cloud-releases.test.ts} +28 -18
  68. package/src/__tests__/{cloudflare-tunnel.test.ts → cloudflare.test.ts} +1 -1
  69. package/src/__tests__/connect-import.test.ts +55 -39
  70. package/src/__tests__/debug.test.ts +38 -38
  71. package/src/__tests__/ensure-binary.test.ts +182 -0
  72. package/src/__tests__/guardian-token.test.ts +149 -56
  73. package/src/__tests__/hatch-provider-secrets.test.ts +2 -2
  74. package/src/__tests__/helpers/guardian-token.ts +22 -0
  75. package/src/__tests__/helpers/http.ts +10 -0
  76. package/src/__tests__/nginx-ingress.test.ts +15 -20
  77. package/src/__tests__/ngrok-spawn.test.ts +49 -0
  78. package/src/__tests__/orphan-detection.test.ts +1 -1
  79. package/src/__tests__/pair.test.ts +149 -85
  80. package/src/__tests__/{ps-platform-status.test.ts → ps-cloud-status.test.ts} +80 -26
  81. package/src/__tests__/ps-table.test.ts +79 -0
  82. package/src/__tests__/{recover.test.ts → restore.test.ts} +29 -28
  83. package/src/__tests__/retire.test.ts +58 -199
  84. package/src/__tests__/root-process-lockfile.test.ts +99 -0
  85. package/src/__tests__/sleep.test.ts +19 -19
  86. package/src/__tests__/statefulset.test.ts +8 -8
  87. package/src/__tests__/{tailscale-tunnel.test.ts → tailscale.test.ts} +2 -2
  88. package/src/__tests__/teleport-backup.test.ts +3 -3
  89. package/src/__tests__/teleport.test.ts +180 -211
  90. package/src/__tests__/tunnel.test.ts +490 -270
  91. package/src/__tests__/uninstall.test.ts +150 -9
  92. package/src/__tests__/upgrade-local.test.ts +3 -3
  93. package/src/__tests__/upgrade-replay-env.test.ts +12 -12
  94. package/src/__tests__/wake.test.ts +260 -43
  95. package/src/__tests__/workos-pkce.test.ts +2 -2
  96. package/src/commands/backup.ts +24 -24
  97. package/src/commands/client.ts +76 -78
  98. package/src/commands/completions.test.ts +104 -0
  99. package/src/commands/completions.ts +87 -0
  100. package/src/commands/debug.ts +20 -20
  101. package/src/commands/exec.ts +12 -12
  102. package/src/commands/flags.ts +2 -2
  103. package/src/commands/hatch.ts +27 -24
  104. package/src/commands/login.ts +22 -22
  105. package/src/commands/logs.ts +8 -8
  106. package/src/commands/pair.ts +140 -37
  107. package/src/commands/ps.ts +232 -86
  108. package/src/commands/restart.ts +30 -0
  109. package/src/commands/restore.ts +140 -22
  110. package/src/commands/retire.ts +48 -150
  111. package/src/commands/rollback.ts +20 -26
  112. package/src/commands/setup.ts +2 -2
  113. package/src/commands/sleep.ts +2 -2
  114. package/src/commands/teleport.ts +110 -129
  115. package/src/commands/terminal.ts +158 -18
  116. package/src/commands/tunnel.ts +156 -175
  117. package/src/commands/uninstall.ts +137 -54
  118. package/src/commands/unpair.ts +3 -3
  119. package/src/commands/upgrade.ts +30 -54
  120. package/src/commands/use.ts +1 -1
  121. package/src/commands/wake.ts +166 -50
  122. package/src/index.ts +18 -9
  123. package/src/lib/__tests__/{platform-client-signed-url.test.ts → cloud-client-signed-url.test.ts} +16 -16
  124. package/src/lib/__tests__/docker.test.ts +168 -20
  125. package/src/lib/__tests__/job-polling.test.ts +2 -2
  126. package/src/lib/__tests__/local-gateway-cli.test.ts +42 -0
  127. package/src/lib/__tests__/local-runtime-client.test.ts +4 -4
  128. package/src/lib/__tests__/runtime-url.test.ts +1 -1
  129. package/src/lib/assistant-api-key-resolution.ts +5 -5
  130. package/src/lib/assistant-client.ts +8 -8
  131. package/src/lib/assistant-config.ts +58 -12
  132. package/src/lib/{platform-client.ts → cloud-client.ts} +105 -99
  133. package/src/lib/cloud-login.ts +23 -24
  134. package/src/lib/{platform-releases.ts → cloud-releases.ts} +11 -9
  135. package/src/lib/cloud-values.ts +3 -0
  136. package/src/lib/color.ts +4 -0
  137. package/src/lib/config-utils.ts +1 -1
  138. package/src/lib/detached-process.ts +1 -1
  139. package/src/lib/docker.ts +300 -111
  140. package/src/lib/ensure-binary.ts +171 -0
  141. package/src/lib/environments/__tests__/paths.test.ts +29 -3
  142. package/src/lib/environments/__tests__/resolve.test.ts +26 -26
  143. package/src/lib/environments/paths.ts +16 -8
  144. package/src/lib/environments/resolve.ts +10 -12
  145. package/src/lib/flag-args.test.ts +1 -1
  146. package/src/lib/flag-args.ts +1 -1
  147. package/src/lib/guardian-token.ts +37 -5
  148. package/src/lib/hatch-local.ts +32 -29
  149. package/src/lib/hatch-next-steps.ts +5 -9
  150. package/src/lib/health-check.ts +6 -6
  151. package/src/lib/ingress-config.ts +8 -35
  152. package/src/lib/job-polling.ts +2 -2
  153. package/src/lib/live-voice/connection.ts +12 -12
  154. package/src/lib/live-voice/tunnel.test.ts +11 -11
  155. package/src/lib/live-voice/tunnel.ts +15 -15
  156. package/src/lib/local-runtime-client.ts +20 -20
  157. package/src/lib/local.ts +46 -34
  158. package/src/lib/nginx-ingress.ts +40 -15
  159. package/src/lib/pair.ts +1 -1
  160. package/src/lib/process.ts +1 -1
  161. package/src/lib/provider-secrets.ts +3 -3
  162. package/src/lib/retire-apple-container.ts +1 -1
  163. package/src/lib/runtime-url.ts +8 -8
  164. package/src/lib/statefulset.ts +2 -2
  165. package/src/lib/step-runner.ts +6 -1
  166. package/src/lib/sync-cloud-assistants.ts +19 -19
  167. package/src/lib/teleport-backup.ts +4 -4
  168. package/src/lib/terminal-client.ts +17 -17
  169. package/src/lib/terminal-session.ts +24 -24
  170. package/src/lib/{tunnel-edge.ts → tunnel.ts} +199 -11
  171. package/src/lib/tunnels/cadet.ts +29 -0
  172. package/src/lib/{cloudflare-tunnel.ts → tunnels/cloudflare.ts} +36 -15
  173. package/src/lib/tunnels/gateway-notify.ts +61 -0
  174. package/src/lib/{ngrok.ts → tunnels/ngrok.ts} +350 -89
  175. package/src/lib/{tailscale-tunnel.ts → tunnels/tailscale.ts} +53 -9
  176. package/src/lib/upgrade-lifecycle.ts +8 -21
  177. package/src/lib/upgrade-preflight.ts +2 -2
  178. package/src/lib/workos-pkce.ts +5 -5
  179. package/node_modules/@mycadet/assistant-api/events/platform-disconnected.ts +0 -21
  180. package/node_modules/@mycadet/assistant-api/events/show-platform-login.ts +0 -20
  181. package/src/commands/recover.ts +0 -131
  182. package/src/commands/roadmap.ts +0 -459
  183. package/src/commands/ssh.ts +0 -144
  184. package/src/commands/workflows.ts +0 -305
  185. package/src/lib/managed-cloud.ts +0 -3
@@ -3,15 +3,15 @@
3
3
  *
4
4
  * Send Cadet staff a debug bundle of a self-hosted assistant: the
5
5
  * workspace, its logs, and the gateway's own database, with no credentials.
6
- * Staff open it on a throwaway debug clone. The platform only hands out the
6
+ * Staff open it on a throwaway debug clone. The cloud only hands out the
7
7
  * upload URL while "Allow Staff Access" is on, and the bundle is deleted
8
8
  * after seven days.
9
9
  *
10
- * Steps: the daemon is checked for the debug profile, the platform mints
10
+ * Steps: the daemon is checked for the debug profile, the cloud mints
11
11
  * the upload URL, the daemon exports with the debug profile, and this
12
12
  * command waits for the job so the result is real.
13
13
  */
14
- import { isManagedCloud } from "../lib/managed-cloud.js";
14
+ import { isCloudHome } from "../lib/cloud-values.js";
15
15
  import {
16
16
  formatAssistantReference,
17
17
  resolveTargetAssistant,
@@ -29,9 +29,9 @@ import { loopbackSafeFetch } from "../lib/loopback-fetch.js";
29
29
  import {
30
30
  authHeaders,
31
31
  authHeadersForKnownOrganization,
32
- getPlatformUrl,
33
- readPlatformToken,
34
- } from "../lib/platform-client.js";
32
+ getCloudUrl,
33
+ readCloudToken,
34
+ } from "../lib/cloud-client.js";
35
35
  import { compareVersions } from "../lib/version-compat.js";
36
36
 
37
37
  // Matches the daemon's own upload deadline (EXPORT_TO_GCS_PUT_TIMEOUT_MS in
@@ -60,7 +60,7 @@ Arguments:
60
60
  Requirements:
61
61
  - 'Allow Staff Access' is on for the assistant (Settings > Privacy).
62
62
  - You are logged in ('cadet login'), which also registers the
63
- assistant with the platform.
63
+ assistant with the cloud.
64
64
  - The assistant runs version ${DEBUG_PROFILE_MIN_VERSION} or newer.
65
65
  - The assistant is self-hosted. Cadet-hosted assistants need no bundle;
66
66
  staff clone them directly.
@@ -88,30 +88,30 @@ export const debug = Object.assign(
88
88
 
89
89
  const entry = resolveTargetAssistant(parseAssistantTargetArg(args));
90
90
  const reference = formatAssistantReference(entry);
91
- if (isManagedCloud(entry.cloud)) {
91
+ if (isCloudHome(entry.cloud)) {
92
92
  console.error(
93
93
  `${reference} is hosted by Cadet, so staff can clone it directly. No bundle is needed.`,
94
94
  );
95
95
  process.exit(1);
96
96
  }
97
97
 
98
- const platformToken = readPlatformToken();
99
- if (!platformToken) {
98
+ const cloudToken = readCloudToken();
99
+ if (!cloudToken) {
100
100
  console.error("Not logged in. Run 'cadet login' first.");
101
101
  process.exit(1);
102
102
  }
103
- const platformAssistantId = entry.platformAssistantId?.trim();
104
- if (!platformAssistantId) {
103
+ const cloudAssistantId = entry.cloudAssistantId?.trim();
104
+ if (!cloudAssistantId) {
105
105
  console.error(
106
- `${reference} is not registered with the platform yet. Run 'cadet login' and retry.`,
106
+ `${reference} is not registered with the cloud yet. Run 'cadet login' and retry.`,
107
107
  );
108
108
  process.exit(1);
109
109
  }
110
- const platformUrl = entry.platformBaseUrl?.trim() || getPlatformUrl();
111
- const organizationId = entry.platformOrganizationId?.trim();
110
+ const cloudUrl = entry.cloudBaseUrl?.trim() || getCloudUrl();
111
+ const organizationId = entry.cloudOrganizationId?.trim();
112
112
 
113
113
  // Step 1: a guardian token for the daemon, and a check that the daemon
114
- // knows the debug profile. This comes before the platform call so a
114
+ // knows the debug profile. This comes before the cloud call so a
115
115
  // daemon that would export credentials is refused before any URL exists.
116
116
  let accessToken = await daemonAccessToken(entry, reference, false);
117
117
  const { version } = await localRuntimeIdentity(entry, accessToken);
@@ -123,13 +123,13 @@ export const debug = Object.assign(
123
123
  process.exit(1);
124
124
  }
125
125
 
126
- // Step 2: the platform mints the upload URL, and refuses unless the
126
+ // Step 2: the cloud mints the upload URL, and refuses unless the
127
127
  // owner's staff access grant is active.
128
128
  const headers = organizationId
129
- ? authHeadersForKnownOrganization(platformToken, organizationId)
130
- : await authHeaders(platformToken, platformUrl);
129
+ ? authHeadersForKnownOrganization(cloudToken, organizationId)
130
+ : await authHeaders(cloudToken, cloudUrl);
131
131
  const urlResponse = await loopbackSafeFetch(
132
- `${platformUrl}/v1/assistants/${encodeURIComponent(platformAssistantId)}/debug-bundle-upload-url/`,
132
+ `${cloudUrl}/v1/assistants/${encodeURIComponent(cloudAssistantId)}/debug-bundle-upload-url/`,
133
133
  { method: "POST", headers },
134
134
  );
135
135
  if (urlResponse.status === 403) {
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from "fs";
2
2
  import { join } from "path";
3
3
 
4
- import { isManagedCloud } from "../lib/managed-cloud.js";
4
+ import { isCloudHome } from "../lib/cloud-values.js";
5
5
  import { spawn } from "child_process";
6
6
  import { red } from "../lib/color";
7
7
 
@@ -9,7 +9,7 @@ import { resolveAssistant } from "../lib/assistant-config";
9
9
  import { dockerResourceNames } from "../lib/docker";
10
10
  import type { ServiceName } from "../lib/docker";
11
11
  import { execAppleContainer } from "../lib/exec-apple-container";
12
- import { getPlatformUrl, readPlatformToken } from "../lib/platform-client";
12
+ import { getCloudUrl, readCloudToken } from "../lib/cloud-client";
13
13
  import { sshAppleContainer } from "../lib/ssh-apple-container";
14
14
  import {
15
15
  interactiveSession,
@@ -75,28 +75,28 @@ export const exec = Object.assign(
75
75
  console.log("");
76
76
  console.log("Arguments:");
77
77
  console.log(
78
- " <name> Name of the assistant (defaults to active)",
78
+ " <name> Name of the assistant, defaults to active",
79
79
  );
80
80
  console.log(
81
81
  " <command...> Command and arguments to run (after --)",
82
82
  );
83
83
  console.log("");
84
84
  console.log("Options:");
85
- console.log(" --service <svc> Target service (default: assistant)");
85
+ console.log(" --service <svc> Target service, defaults to assistant");
86
86
  console.log(
87
87
  " -it Interactive mode with TTY (like docker exec -it)",
88
88
  );
89
89
  console.log(
90
- " --timeout <secs> Timeout in seconds (default: 30, 0 = no timeout)",
90
+ " --timeout <secs> Timeout in seconds — default 30, 0 = no timeout",
91
91
  );
92
92
  console.log(
93
- " --verbose Show debug output (SSE events, sentinel parsing)",
93
+ " --verbose Show debug output",
94
94
  );
95
95
  console.log("");
96
96
  console.log("Services:");
97
- console.log(" assistant (or mycadet)");
98
- console.log(" gateway (or cadet-gateway)");
99
- console.log(" credential-executor (or cadet-credential-executor)");
97
+ console.log(" assistant");
98
+ console.log(" gateway");
99
+ console.log(" credential-executor");
100
100
  console.log("");
101
101
  console.log("Examples:");
102
102
  console.log(" cadet exec -- ls -la /workspace");
@@ -243,8 +243,8 @@ export const exec = Object.assign(
243
243
  return;
244
244
  }
245
245
 
246
- if (isManagedCloud(cloud)) {
247
- const token = readPlatformToken();
246
+ if (isCloudHome(cloud)) {
247
+ const token = readCloudToken();
248
248
  if (!token) {
249
249
  console.error(
250
250
  red("Not logged in. Run `cadet login` first to authenticate with Cadet Cloud."),
@@ -255,7 +255,7 @@ export const exec = Object.assign(
255
255
  const assistant = {
256
256
  assistantId: entry.assistantId,
257
257
  token,
258
- platformUrl: getPlatformUrl(),
258
+ cloudUrl: getCloudUrl(),
259
259
  };
260
260
 
261
261
  const serviceParam = service === "assistant" ? undefined : service;
@@ -59,7 +59,7 @@ function printFlagTable(flags: FeatureFlagEntry[]): void {
59
59
  console.log(formatRow(row));
60
60
  }
61
61
  console.log("");
62
- console.log("* = overridden (differs from default)");
62
+ console.log("* = overridden");
63
63
  }
64
64
 
65
65
  function printHelp(): void {
@@ -67,7 +67,7 @@ function printHelp(): void {
67
67
  console.log("");
68
68
  console.log("Show and toggle feature flags for the active assistant.");
69
69
  console.log(
70
- "Reads from the gateway's merged flag state (persisted overrides > remote > defaults).",
70
+ "Reads from the gateway's merged flag state.",
71
71
  );
72
72
  console.log("");
73
73
  console.log("Subcommands:");
@@ -1,21 +1,22 @@
1
1
  // Direct import — bun embeds this at compile time so it works in compiled binaries.
2
- import { isManagedCloud } from "../lib/managed-cloud.js";
2
+ import { isCloudHome } from "../lib/cloud-values.js";
3
3
  import cliPkg from "../../package.json";
4
4
 
5
5
  import {
6
6
  saveAssistantEntry,
7
7
  setActiveAssistant,
8
8
  } from "../lib/assistant-config";
9
+ import { green } from "../lib/color";
9
10
  import { HATCH_ART, HATCHED_EMOJI, VALID_REMOTE_HOSTS } from "../lib/constants";
10
11
  import type { RemoteHost } from "../lib/constants";
11
12
  import { hatchDocker } from "../lib/docker";
12
13
  import { parseFeatureFlagArgs, readAmbientFlagEnvVars } from "../lib/flag-args";
13
14
  import { hatchLocal } from "../lib/hatch-local";
14
15
  import {
15
- getPlatformUrl,
16
+ getCloudUrl,
16
17
  hatchAssistant,
17
- readPlatformToken,
18
- } from "../lib/platform-client";
18
+ readCloudToken,
19
+ } from "../lib/cloud-client";
19
20
  import { validateAssistantName } from "../lib/retire-archive";
20
21
 
21
22
  const DEFAULT_REMOTE: RemoteHost = "local";
@@ -30,7 +31,7 @@ interface HatchArgs {
30
31
  configValues: Record<string, string>;
31
32
  flagEnvVars: Record<string, string>;
32
33
  analyze: boolean;
33
- disablePlatform: boolean;
34
+ disableCloud: boolean;
34
35
  netnsContainer: string | null;
35
36
  gatewayPort: number | null;
36
37
  assistantCaCert: string | null;
@@ -41,10 +42,10 @@ function parseArgs(): HatchArgs {
41
42
  process.argv.slice(3),
42
43
  );
43
44
  const flagEnvVars = { ...readAmbientFlagEnvVars(), ...cliFlagVars };
44
- const disablePlatformAmbient =
45
- process.env.CADET_DISABLE_PLATFORM?.trim().toLowerCase();
46
- let disablePlatform =
47
- disablePlatformAmbient === "true" || disablePlatformAmbient === "1";
45
+ const disableCloudAmbient =
46
+ process.env.CADET_DISABLE_CLOUD?.trim().toLowerCase();
47
+ let disableCloud =
48
+ disableCloudAmbient === "true" || disableCloudAmbient === "1";
48
49
  let verbose = false;
49
50
  let keepAlive = false;
50
51
  let name: string | null = null;
@@ -76,7 +77,7 @@ function parseArgs(): HatchArgs {
76
77
  " --watch Run assistant and gateway in watch mode (hot reload on source changes)",
77
78
  );
78
79
  console.log(
79
- " --source <path> Build images from a local source tree at <path> (no watcher). Useful for callers (e.g. evals) that want each run to pick up local CLI changes.",
80
+ " --source <path> Build images from a local source tree at <path>. Useful for callers that want each run to pick up local CLI changes.",
80
81
  );
81
82
  console.log(
82
83
  " --keep-alive Stay alive after hatch, exit when gateway stops",
@@ -91,7 +92,7 @@ function parseArgs(): HatchArgs {
91
92
  " --analyze Emit a structured hatch-timing log line on stdout",
92
93
  );
93
94
  console.log(
94
- " --disable-platform Suppress all outbound platform API calls",
95
+ " --disable-cloud Suppress all outbound platform API calls",
95
96
  );
96
97
  console.log(
97
98
  " --netns-container <name> Join an existing container's network namespace (docker target only) instead of creating a per-instance network. The namespace owner publishes host ports, so --gateway-port is required.",
@@ -162,8 +163,8 @@ function parseArgs(): HatchArgs {
162
163
  const value = next.slice(eqIndex + 1);
163
164
  configValues[key] = value;
164
165
  i++;
165
- } else if (arg === "--disable-platform") {
166
- disablePlatform = true;
166
+ } else if (arg === "--disable-cloud") {
167
+ disableCloud = true;
167
168
  } else if (arg === "--netns-container") {
168
169
  const next = args[i + 1];
169
170
  if (!next || next.startsWith("-")) {
@@ -193,7 +194,7 @@ function parseArgs(): HatchArgs {
193
194
  i++;
194
195
  } else {
195
196
  console.error(
196
- `Error: Unknown argument '${arg}'. Valid options: -v, --verbose, --watch, --source <path>, --keep-alive, --name <name>, --remote <${VALID_REMOTE_HOSTS.join("|")}>, --config <key=value>, --flag <key=value>, --analyze, --disable-platform, --netns-container <name>, --gateway-port <port>, --assistant-ca-cert <path>`,
197
+ `Error: Unknown argument '${arg}'. Valid options: -v, --verbose, --watch, --source <path>, --keep-alive, --name <name>, --remote <${VALID_REMOTE_HOSTS.join("|")}>, --config <key=value>, --flag <key=value>, --analyze, --disable-cloud, --netns-container <name>, --gateway-port <port>, --assistant-ca-cert <path>`,
197
198
  );
198
199
  process.exit(1);
199
200
  }
@@ -209,7 +210,7 @@ function parseArgs(): HatchArgs {
209
210
  configValues,
210
211
  flagEnvVars,
211
212
  analyze,
212
- disablePlatform,
213
+ disableCloud,
213
214
  netnsContainer,
214
215
  gatewayPort,
215
216
  assistantCaCert,
@@ -237,15 +238,15 @@ export const hatch = Object.assign(
237
238
  configValues,
238
239
  flagEnvVars,
239
240
  analyze,
240
- disablePlatform,
241
+ disableCloud,
241
242
  netnsContainer,
242
243
  gatewayPort,
243
244
  assistantCaCert,
244
245
  } = parseArgs();
245
246
 
246
- if (disablePlatform) {
247
- process.env.CADET_DISABLE_PLATFORM = "true";
248
- flagEnvVars.CADET_DISABLE_PLATFORM = "true";
247
+ if (disableCloud) {
248
+ process.env.CADET_DISABLE_CLOUD = "true";
249
+ flagEnvVars.CADET_DISABLE_CLOUD = "true";
249
250
  }
250
251
 
251
252
  if (watch && remote !== "local" && remote !== "docker") {
@@ -308,7 +309,7 @@ export const hatch = Object.assign(
308
309
  return;
309
310
  }
310
311
 
311
- if (isManagedCloud(remote)) {
312
+ if (isCloudHome(remote)) {
312
313
  await hatchCadetPlatform();
313
314
  return;
314
315
  }
@@ -321,7 +322,7 @@ export const hatch = Object.assign(
321
322
 
322
323
 
323
324
  async function hatchCadetPlatform(): Promise<void> {
324
- const token = readPlatformToken();
325
+ const token = readCloudToken();
325
326
  if (!token) {
326
327
  console.error("Not logged in. Run `cadet login --token <token>` first.");
327
328
  process.exit(1);
@@ -337,17 +338,19 @@ async function hatchCadetPlatform(): Promise<void> {
337
338
 
338
339
  const { assistant: result } = await hatchAssistant(token);
339
340
 
340
- const platformUrl = getPlatformUrl();
341
+ const cloudUrl = getCloudUrl();
341
342
 
342
343
  saveAssistantEntry({
343
344
  assistantId: result.id,
344
- runtimeUrl: platformUrl,
345
+ runtimeUrl: cloudUrl,
345
346
  cloud: "cloud",
346
347
  hatchedAt: new Date().toISOString(),
347
348
  });
348
349
  setActiveAssistant(result.id);
349
350
 
350
- console.log(` ${HATCHED_EMOJI} Your assistant has hatched!`);
351
+ console.log(
352
+ " " + green(`${HATCHED_EMOJI} Your assistant has hatched!`, process.stdout),
353
+ );
351
354
  console.log("");
352
355
  console.log(` ID: ${result.id}`);
353
356
  console.log(` Name: ${result.name}`);
@@ -1,4 +1,4 @@
1
- import { isManagedCloud } from "../lib/managed-cloud.js";
1
+ import { isCloudHome } from "../lib/cloud-values.js";
2
2
 
3
3
  import {
4
4
  getActiveAssistant,
@@ -7,18 +7,18 @@ import {
7
7
  setActiveAssistant,
8
8
  } from "../lib/assistant-config";
9
9
  import {
10
- clearPlatformToken,
10
+ clearCloudToken,
11
11
  fetchCurrentUser,
12
- fetchPlatformAssistants,
13
- readPlatformToken,
14
- savePlatformToken,
15
- } from "../lib/platform-client";
12
+ fetchCloudAssistants,
13
+ readCloudToken,
14
+ saveCloudToken,
15
+ } from "../lib/cloud-client";
16
16
  import {
17
17
  describeLoginError,
18
18
  registerLocalAssistantWithPlatform,
19
19
  workosPkceLogin,
20
20
  } from "../lib/cloud-login.js";
21
- import { getPlatformUrl } from "../lib/platform-client";
21
+ import { getCloudUrl } from "../lib/cloud-client";
22
22
  import { syncCloudAssistants } from "../lib/sync-cloud-assistants";
23
23
 
24
24
 
@@ -34,7 +34,7 @@ export const login = Object.assign(
34
34
  console.log("By default, opens a browser window for authentication.");
35
35
  console.log("Alternatively, pass a session token directly with --token.");
36
36
  console.log("");
37
- console.log("On success, syncs cloud-managed assistants to the local");
37
+ console.log("On success, syncs cloud assistants to the local");
38
38
  console.log("lockfile so they appear in `cadet ps`.");
39
39
  console.log("");
40
40
  console.log("Options:");
@@ -66,7 +66,7 @@ export const login = Object.assign(
66
66
 
67
67
  // Block if already authenticated (unless --force)
68
68
  if (!forceFlag && !token) {
69
- const existingToken = readPlatformToken();
69
+ const existingToken = readCloudToken();
70
70
  if (existingToken) {
71
71
  try {
72
72
  const existingUser = await fetchCurrentUser(existingToken);
@@ -83,7 +83,7 @@ export const login = Object.assign(
83
83
  // If no --token flag, use app-held WorkOS PKCE login.
84
84
  if (!token) {
85
85
  try {
86
- token = await workosPkceLogin(getPlatformUrl());
86
+ token = await workosPkceLogin(getCloudUrl());
87
87
  } catch (error) {
88
88
  console.error(`❌ ${describeLoginError(error)}`);
89
89
  process.exit(1);
@@ -94,10 +94,10 @@ export const login = Object.assign(
94
94
 
95
95
  try {
96
96
  const user = await fetchCurrentUser(token);
97
- savePlatformToken(token);
97
+ saveCloudToken(token);
98
98
  console.log(`✅ Logged in as ${user.email}`);
99
99
 
100
- // Register the local assistant with the platform (non-fatal).
100
+ // Register the local assistant with the cloud (non-fatal).
101
101
  // Mirrors the desktop app's LocalAssistantBootstrapService flow.
102
102
  try {
103
103
  await registerLocalAssistantWithPlatform(token, user);
@@ -105,8 +105,8 @@ export const login = Object.assign(
105
105
  // Non-fatal — login succeeded even if registration fails
106
106
  }
107
107
 
108
- // Sync cloud assistants from the platform into the local lockfile.
109
- // This ensures `cadet ps` shows managed assistants immediately
108
+ // Sync cloud assistants from the cloud into the local lockfile.
109
+ // This ensures `cadet ps` shows cloud assistants immediately
110
110
  // after login (e.g. after a retire-and-rehatch cycle). We've just
111
111
  // saved this token, so it's guaranteed non-empty here.
112
112
  try {
@@ -122,9 +122,9 @@ export const login = Object.assign(
122
122
 
123
123
  // If no active assistant is set, activate the first cloud one.
124
124
  if (!getActiveAssistant()) {
125
- const platformAssistants = await fetchPlatformAssistants(token);
126
- if (platformAssistants.length > 0) {
127
- setActiveAssistant(platformAssistants[0].id);
125
+ const cloudAssistants = await fetchCloudAssistants(token);
126
+ if (cloudAssistants.length > 0) {
127
+ setActiveAssistant(cloudAssistants[0].id);
128
128
  }
129
129
  }
130
130
  } catch {
@@ -148,13 +148,13 @@ export const logout = Object.assign(
148
148
  console.log("Usage: cadet logout");
149
149
  console.log("");
150
150
  console.log("Log out of Cadet Cloud, remove the stored session token,");
151
- console.log("and remove cloud-managed assistants from the local lockfile.");
151
+ console.log("and remove cloud assistants from the local lockfile.");
152
152
  process.exit(0);
153
153
  }
154
154
 
155
- // Remove cloud-managed assistants from the lockfile.
155
+ // Remove cloud assistants from the lockfile.
156
156
  const cloudAssistants = loadAllAssistants().filter((a) =>
157
- isManagedCloud(a.cloud),
157
+ isCloudHome(a.cloud),
158
158
  );
159
159
  for (const a of cloudAssistants) {
160
160
  removeAssistantEntry(a.assistantId);
@@ -165,7 +165,7 @@ export const logout = Object.assign(
165
165
  );
166
166
  }
167
167
 
168
- clearPlatformToken();
168
+ clearCloudToken();
169
169
  console.log("Logged out. Cadet Cloud token removed.");
170
170
  },
171
171
  { description: "Log out of Cadet Cloud" },
@@ -182,7 +182,7 @@ export const whoami = Object.assign(
182
182
  process.exit(0);
183
183
  }
184
184
 
185
- const token = readPlatformToken();
185
+ const token = readCloudToken();
186
186
  if (!token) {
187
187
  console.error("Not logged in. Run `cadet login` first.");
188
188
  process.exit(1);
@@ -32,19 +32,19 @@ function printHelp(): void {
32
32
  console.log("");
33
33
  console.log("Arguments:");
34
34
  console.log(
35
- " <name> Name of the assistant (defaults to latest)",
35
+ " <name> Name of the assistant, defaults to latest",
36
36
  );
37
37
  console.log("");
38
38
  console.log("Options:");
39
- console.log(" -f, --follow Follow log output (stream new lines)");
40
- console.log(" -n, --tail <N> Show last N lines (default: all)");
39
+ console.log(" -f, --follow Follow log output");
40
+ console.log(" -n, --tail <N> Show last N lines");
41
41
  console.log(" -t, --timestamps Show timestamps on each line");
42
42
  console.log(
43
- " --since <time> Show logs since timestamp or relative (e.g. 10m, 2h)",
43
+ " --since <time> Show logs since timestamp or relative, e.g. 10m or 2h",
44
44
  );
45
45
  console.log(" --until <time> Show logs until timestamp or relative");
46
46
  console.log(
47
- " -s, --service <name> Filter to a specific service (e.g. assistant, gateway)",
47
+ " -s, --service <name> Filter to a specific service",
48
48
  );
49
49
  console.log(" -h, --help Show this help");
50
50
  }
@@ -186,13 +186,13 @@ async function showLocalLogs(
186
186
 
187
187
  if (opts.since && !sinceDate) {
188
188
  console.error(
189
- `Error: Could not parse --since value '${opts.since}'. Use relative (e.g. 10m, 2h) or ISO format.`,
189
+ `Error: Could not parse --since value '${opts.since}'. Use a relative value such as 10m or 2h, or ISO format.`,
190
190
  );
191
191
  process.exit(1);
192
192
  }
193
193
  if (opts.until && !untilDate) {
194
194
  console.error(
195
- `Error: Could not parse --until value '${opts.until}'. Use relative (e.g. 10m, 2h) or ISO format.`,
195
+ `Error: Could not parse --until value '${opts.until}'. Use a relative value such as 10m or 2h, or ISO format.`,
196
196
  );
197
197
  process.exit(1);
198
198
  }
@@ -623,7 +623,7 @@ export const logs = Object.assign(
623
623
 
624
624
  case "cadet":
625
625
  console.error(
626
- "Logs for Cadet-managed instances are not yet supported.\n" +
626
+ "Logs for Cadet Cloud instances are not yet supported.\n" +
627
627
  "View logs in the Cadet Cloud dashboard.",
628
628
  );
629
629
  process.exit(1);