@mycadet/cli 0.13.0-dev.202611041208.2540870 → 0.13.0-dev.202611110042.6f8c11c

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 (207) hide show
  1. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/package.json +1 -1
  2. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/__tests__/remote-web-pairing.test.ts +17 -14
  3. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/ingress.ts +7 -3
  4. package/node_modules/@mycadet/assistant-api/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +7 -64
  5. package/node_modules/@mycadet/avatar-manifest/package.json +1 -1
  6. package/node_modules/@mycadet/environments/package.json +1 -1
  7. package/node_modules/@mycadet/environments/src/index.ts +0 -1
  8. package/node_modules/@mycadet/environments/src/seeds.ts +0 -5
  9. package/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
  10. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/package.json +1 -1
  11. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/package.json +1 -1
  12. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/index.ts +0 -1
  13. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/seeds.ts +0 -5
  14. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
  15. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +1 -1
  16. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/__tests__/remote-web-pairing.test.ts +17 -14
  17. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/ingress.ts +7 -3
  18. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +7 -64
  19. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/imports-first.mjs +51 -0
  20. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/imports-first.test.mjs +95 -0
  21. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/package.json +3 -2
  22. package/node_modules/@mycadet/local-mode/package.json +2 -2
  23. package/node_modules/@mycadet/local-mode/scripts/run-tests.ts +3 -0
  24. package/{src/__tests__/teleport-backup.test.ts → node_modules/@mycadet/local-mode/src/__tests__/cloud-backup.test.ts} +20 -23
  25. package/node_modules/@mycadet/local-mode/src/__tests__/cloud-releases.test.ts +1 -1
  26. package/node_modules/@mycadet/local-mode/src/__tests__/hatch-local-overlay.test.ts +144 -0
  27. package/node_modules/@mycadet/local-mode/src/__tests__/health-check.test.ts +132 -2
  28. package/node_modules/@mycadet/local-mode/src/__tests__/operations-backup.test.ts +97 -0
  29. package/node_modules/@mycadet/local-mode/src/__tests__/operations-doctor.test.ts +231 -0
  30. package/node_modules/@mycadet/local-mode/src/__tests__/operations-hatch.test.ts +17 -1
  31. package/node_modules/@mycadet/local-mode/src/__tests__/operations-migrations.test.ts +170 -0
  32. package/node_modules/@mycadet/local-mode/src/__tests__/operations-pair.test.ts +16 -2
  33. package/node_modules/@mycadet/local-mode/src/__tests__/operations-profile.test.ts +67 -0
  34. package/node_modules/@mycadet/local-mode/src/__tests__/operations-proxy.test.ts +280 -0
  35. package/node_modules/@mycadet/local-mode/src/__tests__/operations-resolution.test.ts +27 -14
  36. package/node_modules/@mycadet/local-mode/src/__tests__/operations-restart.test.ts +203 -0
  37. package/node_modules/@mycadet/local-mode/src/__tests__/operations-restore.test.ts +271 -0
  38. package/node_modules/@mycadet/local-mode/src/__tests__/operations-retire.test.ts +66 -7
  39. package/node_modules/@mycadet/local-mode/src/__tests__/operations-routes.test.ts +44 -38
  40. package/node_modules/@mycadet/local-mode/src/__tests__/operations-sleep.test.ts +103 -8
  41. package/node_modules/@mycadet/local-mode/src/__tests__/operations-teleport.test.ts +377 -0
  42. package/node_modules/@mycadet/local-mode/src/__tests__/operations-wake.test.ts +87 -10
  43. package/node_modules/@mycadet/local-mode/src/__tests__/pair.test.ts +6 -6
  44. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-baseten-api.test.ts +332 -7
  45. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-baseten-exec.test.ts +279 -0
  46. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-baseten-hatch-volume.test.ts +13 -0
  47. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-docker-sleep.test.ts +83 -0
  48. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-docker-statefulset.test.ts +0 -1
  49. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-docker-wake.test.ts +26 -36
  50. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-common-gateway-cli.test.ts +1 -3
  51. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-common-readiness.test.ts +34 -13
  52. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-common-runtime.test.ts +1 -1
  53. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-instance.test.ts +55 -0
  54. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-retire.test.ts +3 -3
  55. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-upgrade.test.ts +29 -35
  56. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-wake.test.ts +25 -198
  57. package/node_modules/@mycadet/local-mode/src/__tests__/root-backup-docker.test.ts +3 -2
  58. package/node_modules/@mycadet/local-mode/src/__tests__/root-backup.test.ts +5 -1
  59. package/node_modules/@mycadet/local-mode/src/__tests__/teleport-init.test.ts +151 -0
  60. package/node_modules/@mycadet/local-mode/src/__tests__/upgrade-replay-env.test.ts +2 -4
  61. package/node_modules/@mycadet/local-mode/src/__tests__/upgrade-root-recovery.test.ts +6 -3
  62. package/node_modules/@mycadet/local-mode/src/cloud-registration.ts +2 -2
  63. package/node_modules/@mycadet/local-mode/src/daemon-readiness.ts +251 -58
  64. package/node_modules/@mycadet/local-mode/src/devices.ts +2 -2
  65. package/node_modules/@mycadet/local-mode/src/guardian-token.ts +31 -3
  66. package/node_modules/@mycadet/local-mode/src/index.ts +51 -309
  67. package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +21 -58
  68. package/node_modules/@mycadet/local-mode/src/lockfile.ts +19 -0
  69. package/node_modules/@mycadet/local-mode/src/operations/backup.ts +42 -0
  70. package/node_modules/@mycadet/local-mode/src/operations/cloud-proxy.ts +46 -0
  71. package/node_modules/@mycadet/local-mode/src/operations/doctor.ts +202 -0
  72. package/node_modules/@mycadet/local-mode/src/operations/hatch.ts +12 -0
  73. package/node_modules/@mycadet/local-mode/src/operations/migrations.ts +62 -0
  74. package/node_modules/@mycadet/local-mode/src/operations/profile.ts +82 -0
  75. package/node_modules/@mycadet/local-mode/src/operations/resolve.ts +3 -3
  76. package/node_modules/@mycadet/local-mode/src/operations/restart.ts +106 -0
  77. package/node_modules/@mycadet/local-mode/src/operations/restore.ts +111 -0
  78. package/node_modules/@mycadet/local-mode/src/operations/retire.ts +6 -2
  79. package/node_modules/@mycadet/local-mode/src/operations/routes.ts +235 -15
  80. package/node_modules/@mycadet/local-mode/src/operations/sleep.ts +16 -5
  81. package/node_modules/@mycadet/local-mode/src/operations/teleport.ts +162 -0
  82. package/node_modules/@mycadet/local-mode/src/operations/upgrade.ts +4 -5
  83. package/node_modules/@mycadet/local-mode/src/operations/wake.ts +7 -2
  84. package/node_modules/@mycadet/local-mode/src/pair.ts +1 -7
  85. package/node_modules/@mycadet/local-mode/src/process.ts +1 -9
  86. package/node_modules/@mycadet/local-mode/src/remotes/baseten/api.ts +233 -13
  87. package/node_modules/@mycadet/local-mode/src/remotes/baseten/baseten-cli.ts +8 -14
  88. package/node_modules/@mycadet/local-mode/src/remotes/baseten/entrypoint.sh +3 -2
  89. package/node_modules/@mycadet/local-mode/src/remotes/baseten/exec.ts +217 -0
  90. package/node_modules/@mycadet/local-mode/src/remotes/baseten/hatch.ts +69 -9
  91. package/node_modules/@mycadet/local-mode/src/remotes/baseten/lifecycle.ts +186 -0
  92. package/node_modules/@mycadet/local-mode/src/remotes/baseten/zip.ts +1 -11
  93. package/{src/lib/teleport-backup.ts → node_modules/@mycadet/local-mode/src/remotes/cloud/backup.ts} +46 -19
  94. package/node_modules/@mycadet/local-mode/src/remotes/cloud/migrations.ts +371 -0
  95. package/node_modules/@mycadet/local-mode/src/remotes/cloud/restore.ts +399 -0
  96. package/node_modules/@mycadet/local-mode/src/remotes/cloud/retire.ts +12 -14
  97. package/node_modules/@mycadet/local-mode/src/remotes/cloud/upgrade.ts +27 -27
  98. package/node_modules/@mycadet/local-mode/src/remotes/docker/backup.ts +18 -0
  99. package/node_modules/@mycadet/local-mode/src/remotes/docker/hatch.ts +11 -28
  100. package/node_modules/@mycadet/local-mode/src/remotes/docker/pair.ts +33 -32
  101. package/node_modules/@mycadet/local-mode/src/remotes/docker/restore.ts +24 -0
  102. package/node_modules/@mycadet/local-mode/src/remotes/docker/sleep.ts +17 -2
  103. package/node_modules/@mycadet/local-mode/src/remotes/docker/statefulset.ts +1 -40
  104. package/node_modules/@mycadet/local-mode/src/remotes/docker/teleport.ts +128 -0
  105. package/node_modules/@mycadet/local-mode/src/remotes/docker/upgrade.ts +28 -55
  106. package/node_modules/@mycadet/local-mode/src/remotes/docker/wake.ts +206 -8
  107. package/node_modules/@mycadet/local-mode/src/remotes/docker/watch.ts +16 -7
  108. package/node_modules/@mycadet/local-mode/src/remotes/local/backup.ts +17 -0
  109. package/node_modules/@mycadet/local-mode/src/remotes/local/common.ts +89 -428
  110. package/node_modules/@mycadet/local-mode/src/remotes/local/exec.ts +27 -0
  111. package/node_modules/@mycadet/local-mode/src/remotes/local/hatch.ts +4 -7
  112. package/node_modules/@mycadet/local-mode/src/remotes/local/instance.ts +10 -20
  113. package/node_modules/@mycadet/local-mode/src/remotes/local/pair.ts +36 -28
  114. package/node_modules/@mycadet/local-mode/src/remotes/local/restore.ts +125 -0
  115. package/node_modules/@mycadet/local-mode/src/remotes/local/sleep.ts +19 -3
  116. package/node_modules/@mycadet/local-mode/src/remotes/local/teleport.ts +43 -0
  117. package/node_modules/@mycadet/local-mode/src/remotes/local/upgrade.ts +10 -12
  118. package/node_modules/@mycadet/local-mode/src/remotes/local/wake.ts +25 -203
  119. package/node_modules/@mycadet/local-mode/src/root-backup.ts +17 -5
  120. package/node_modules/@mycadet/local-mode/src/served-config.test.ts +41 -1
  121. package/node_modules/@mycadet/local-mode/src/served-config.ts +18 -5
  122. package/node_modules/@mycadet/local-mode/src/upgrade-lifecycle.ts +10 -61
  123. package/node_modules/@mycadet/local-mode/src/version-compat.ts +0 -3
  124. package/node_modules/@mycadet/service-contracts/package.json +1 -1
  125. package/node_modules/@mycadet/service-contracts/src/__tests__/remote-web-pairing.test.ts +17 -14
  126. package/node_modules/@mycadet/service-contracts/src/ingress.ts +7 -3
  127. package/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +7 -64
  128. package/node_modules/@mycadet/shared/eslint/imports-first.mjs +51 -0
  129. package/node_modules/@mycadet/shared/eslint/imports-first.test.mjs +95 -0
  130. package/node_modules/@mycadet/shared/package.json +3 -2
  131. package/package.json +1 -2
  132. package/src/__tests__/app-command.test.ts +0 -1
  133. package/src/__tests__/assistant-client-refresh.test.ts +5 -2
  134. package/src/__tests__/backup.test.ts +19 -59
  135. package/src/__tests__/client-tui-refresh.test.ts +1 -2
  136. package/src/__tests__/connect-import.test.ts +3 -4
  137. package/src/__tests__/debug.test.ts +1 -2
  138. package/src/__tests__/devices.test.ts +3 -3
  139. package/src/__tests__/guardian-token.test.ts +2 -11
  140. package/src/__tests__/pair.test.ts +25 -20
  141. package/src/__tests__/ps-cloud-status.test.ts +1 -1
  142. package/src/__tests__/restart-command.test.ts +165 -0
  143. package/src/__tests__/restore.test.ts +15 -136
  144. package/src/__tests__/root-restore-command.test.ts +47 -88
  145. package/src/__tests__/servers/bun.test.ts +272 -673
  146. package/src/__tests__/setup.test.ts +1 -2
  147. package/src/__tests__/sleep.test.ts +3 -113
  148. package/src/__tests__/teleport.test.ts +30 -29
  149. package/src/__tests__/tui-midsession-refresh.test.ts +1 -2
  150. package/src/__tests__/web-dist.test.ts +57 -173
  151. package/src/commands/app.ts +37 -1
  152. package/src/commands/backup.ts +7 -23
  153. package/src/commands/client.ts +8 -10
  154. package/src/commands/connect/import.ts +1 -1
  155. package/src/commands/debug.ts +3 -3
  156. package/src/commands/devices.ts +2 -2
  157. package/src/commands/exec.ts +36 -4
  158. package/src/commands/login.ts +2 -4
  159. package/src/commands/logs.ts +1 -1
  160. package/src/commands/pair.ts +18 -10
  161. package/src/commands/ps.ts +8 -23
  162. package/src/commands/restart.ts +51 -17
  163. package/src/commands/restore.ts +74 -462
  164. package/src/commands/setup.ts +2 -5
  165. package/src/commands/sleep.ts +3 -50
  166. package/src/commands/teleport.ts +15 -65
  167. package/src/commands/terminal.ts +2 -2
  168. package/src/commands/uninstall.ts +33 -9
  169. package/src/components/DefaultMainScreen.tsx +2 -6
  170. package/src/index.ts +1 -2
  171. package/src/lib/__tests__/cloud-client-signed-url.test.ts +2 -3
  172. package/src/lib/__tests__/{step-runner.test.ts → exec.test.ts} +2 -1
  173. package/src/lib/__tests__/web-dist.test.ts +47 -58
  174. package/src/lib/assistant-client.ts +3 -18
  175. package/src/lib/cli-error.ts +1 -1
  176. package/src/lib/cloud-client.ts +5 -368
  177. package/src/lib/constants.ts +8 -8
  178. package/src/lib/guardian-token.ts +2 -27
  179. package/src/lib/live-voice/connection.ts +3 -26
  180. package/src/lib/pair.test.ts +0 -6
  181. package/src/lib/pair.ts +3 -7
  182. package/src/lib/runtime-url.ts +2 -2
  183. package/src/lib/servers/bun.ts +82 -117
  184. package/src/lib/servers/common.ts +90 -288
  185. package/src/lib/sync-cloud-assistants.ts +2 -2
  186. package/src/lib/terminal-session.ts +2 -2
  187. package/src/lib/tunnels/gateway-notify.ts +1 -1
  188. package/src/lib/web-dist.ts +56 -117
  189. package/node_modules/@mycadet/local-mode/src/__tests__/daemon-readiness-version.test.ts +0 -29
  190. package/node_modules/@mycadet/local-mode/src/__tests__/gateway-proxy.test.ts +0 -430
  191. package/node_modules/@mycadet/local-mode/src/__tests__/package-boundary.test.ts +0 -131
  192. package/node_modules/@mycadet/local-mode/src/cloud-values.ts +0 -8
  193. package/node_modules/@mycadet/local-mode/src/gateway-bearer.test.ts +0 -165
  194. package/node_modules/@mycadet/local-mode/src/gateway-bearer.ts +0 -134
  195. package/node_modules/@mycadet/local-mode/src/gateway-proxy.ts +0 -361
  196. package/node_modules/@mycadet/local-mode/src/health-check.ts +0 -154
  197. package/node_modules/@mycadet/local-mode/src/remotes/docker/recreate.ts +0 -98
  198. package/src/__tests__/host-teleport-docker.test.ts +0 -412
  199. package/src/__tests__/host-teleport.test.ts +0 -426
  200. package/src/__tests__/version.test.ts +0 -62
  201. package/src/lib/cloud-values.ts +0 -3
  202. package/src/lib/environments/__tests__/resolve.test.ts +0 -238
  203. package/src/lib/environments/resolve.ts +0 -123
  204. package/src/lib/host-teleport.ts +0 -298
  205. package/src/lib/remotes/docker.ts +0 -257
  206. package/src/lib/remotes/local.ts +0 -22
  207. package/src/lib/step-runner.ts +0 -171
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/service-contracts",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,7 +48,7 @@ describe("parseRemoteWebPairingParams", () => {
48
48
  describe("parsePairingAddress", () => {
49
49
  test("splits a pairing link into its base and device code", () => {
50
50
  const link = buildRemoteWebPairingUrl({
51
- verificationUri: "https://assistant.example.com/assistant/pair",
51
+ verificationUri: "https://assistant.example.com/account/pair",
52
52
  deviceCode: "device-1",
53
53
  });
54
54
 
@@ -62,7 +62,7 @@ describe("parsePairingAddress", () => {
62
62
  test("accepts the device code in the query string", () => {
63
63
  expect(
64
64
  parsePairingAddress(
65
- "https://assistant.example.com/assistant/pair?deviceCode=device-2",
65
+ "https://assistant.example.com/account/pair?deviceCode=device-2",
66
66
  ),
67
67
  ).toEqual({
68
68
  ok: true,
@@ -71,25 +71,28 @@ describe("parsePairingAddress", () => {
71
71
  });
72
72
  });
73
73
 
74
- test("preserves a path prefix while dropping the app-route suffix", () => {
75
- expect(
76
- parsePairingAddress(
77
- "https://host.example.com/assistant-123/assistant/pair#device_code=device-3",
78
- ),
79
- ).toEqual({
74
+ test("splits an app-shell pairing link (the pair page lives at /account/pair)", () => {
75
+ const link = buildRemoteWebPairingUrl({
76
+ verificationUri: "https://assistant.example.com/account/pair",
77
+ deviceCode: "device-4",
78
+ });
79
+
80
+ expect(parsePairingAddress(link)).toEqual({
80
81
  ok: true,
81
- publicBaseUrl: "https://host.example.com/assistant-123",
82
- deviceCode: "device-3",
82
+ publicBaseUrl: "https://assistant.example.com",
83
+ deviceCode: "device-4",
83
84
  });
84
85
  });
85
86
 
86
- test("drops a trailing app-route suffix from a bare address", () => {
87
+ test("preserves a path prefix on an app-shell pairing link", () => {
87
88
  expect(
88
- parsePairingAddress("https://assistant.example.com/assistant/pair"),
89
+ parsePairingAddress(
90
+ "https://host.example.com/assistant-123/account/pair#device_code=device-5",
91
+ ),
89
92
  ).toEqual({
90
93
  ok: true,
91
- publicBaseUrl: "https://assistant.example.com",
92
- deviceCode: null,
94
+ publicBaseUrl: "https://host.example.com/assistant-123",
95
+ deviceCode: "device-5",
93
96
  });
94
97
  });
95
98
 
@@ -3,10 +3,14 @@
3
3
  * deployment naming convention (`cloud.mycadet.ai` → `tunnel.mycadet.ai`,
4
4
  * `{env}-cloud.mycadet.ai` → `{env}-tunnel.mycadet.ai`). Returns null for
5
5
  * hosts outside that convention (localhost, custom domains). Shared by the
6
- * gateway speech relay and the web live-voice client so the two ends of the
7
- * cloud-speech transport can't drift.
6
+ * gateway speech relay (which passes the request's own host) and the web
7
+ * live-voice client (which defaults to the page's origin) so the two ends
8
+ * of the cloud-speech transport can't drift.
8
9
  */
9
- export function tunnelHostForCloudHost(host: string): string | null {
10
+ export function tunnelHostForCloudHost(
11
+ host: string = (globalThis as { location?: { hostname?: string } }).location
12
+ ?.hostname ?? "",
13
+ ): string | null {
10
14
  if (host === "cloud.mycadet.ai") {
11
15
  return "tunnel.mycadet.ai";
12
16
  }
@@ -78,60 +78,6 @@ export interface RemoteWebPairingVerificationResponse {
78
78
  expiresAt: string;
79
79
  }
80
80
 
81
- /**
82
- * One pending challenge as shown on a host approval surface.
83
- *
84
- * The requesting device already sees the plaintext `userCode` in its own
85
- * challenge response ({@link RemoteWebPairingChallengeResponse.userCode});
86
- * the loopback-gated list route is the only host-side re-exposure. Displaying
87
- * it there is what lets the approver match the code against the requesting
88
- * device's screen: the device-flow anti-phishing binding.
89
- */
90
- export interface RemoteWebPairingRequestSummary {
91
- /** Opaque server-side id used to approve or deny this request. */
92
- requestId: string;
93
- /** The human-readable code the requesting device is displaying (e.g. "ABCD-EFGH"). */
94
- userCode: string;
95
- /** Public base URL the challenge was minted for. */
96
- publicBaseUrl: string;
97
- /** ISO-8601 instant the challenge was minted. */
98
- requestedAt: string;
99
- /** ISO-8601 instant the challenge expires. */
100
- expiresAt: string;
101
- /**
102
- * Client IP of the mint request: the loopback/host address when minted
103
- * locally, or the edge-observed client address when the mint arrived
104
- * through the nginx app server (which stamps it via `proxy_set_header`,
105
- * so a remote client cannot smuggle a value).
106
- */
107
- requesterIp: string;
108
- /** User-Agent header of the mint request, or null when absent. */
109
- requesterUserAgent: string | null;
110
- /**
111
- * Whether the mint arrived through the public app server rather than the
112
- * host itself.
113
- */
114
- viaEdgeProxy: boolean;
115
- }
116
-
117
- /** `GET /v1/remote-web/pairing-requests` success response body (200). */
118
- export interface RemoteWebPairingRequestListResponse {
119
- requests: RemoteWebPairingRequestSummary[];
120
- }
121
-
122
- /**
123
- * Request body for the pairing-request approve and deny routes. The approve
124
- * route's success body reuses {@link RemoteWebPairingVerificationResponse}.
125
- */
126
- export interface RemoteWebPairingRequestActionRequest {
127
- requestId: string;
128
- }
129
-
130
- /** `POST /v1/remote-web/pairing-requests/deny` success response body (200). */
131
- export interface RemoteWebPairingRequestDenyResponse {
132
- status: "denied";
133
- }
134
-
135
81
  /**
136
82
  * Platforms a device-bound pairing exchange may declare for itself. The value
137
83
  * is what the host's `Paired devices` list renders for the new pairing.
@@ -535,18 +481,18 @@ export function isPrivateNetworkPublicUrl(url: string): boolean {
535
481
 
536
482
  /**
537
483
  * Normalize an address to the public base a scanning device opens:
538
- * query/hash stripped, the `assistant` path segment (and everything after it)
539
- * removed so a pasted pair-page URL collapses to its base, and trailing
540
- * slashes trimmed. Throws if the value is not a parseable URL.
484
+ * query/hash stripped, the pair page's `account` path segment (and everything
485
+ * after it) removed so a pasted pair-page URL collapses to its base, and
486
+ * trailing slashes trimmed. Throws if the value is not a parseable URL.
541
487
  */
542
488
  export function normalizePairingBaseUrl(value: string): string {
543
489
  const url = new URL(value);
544
490
  url.search = "";
545
491
  url.hash = "";
546
492
  const parts = url.pathname.split("/").filter(Boolean);
547
- const assistantIndex = parts.indexOf("assistant");
548
- if (assistantIndex >= 0) {
549
- parts.splice(assistantIndex);
493
+ const cutIndex = parts.indexOf("account");
494
+ if (cutIndex >= 0) {
495
+ parts.splice(cutIndex);
550
496
  }
551
497
  url.pathname = parts.length ? `/${parts.join("/")}` : "/";
552
498
  return url.toString().replace(/\/+$/, "");
@@ -689,10 +635,7 @@ export function parsePairingAddress(raw: string): ParsePairingAddressResult {
689
635
  }
690
636
 
691
637
  /**
692
- * What a pairing attempt failed on, for callers picking recovery copy. Every
693
- * pairing surface reports one of these: the host-side sessions in
694
- * `@mycadet/local-mode`, the Electron bridge, the desktop connect dialog, and
695
- * the `cadet connect import` CLI.
638
+ * What a pairing attempt failed on, for callers picking recovery copy
696
639
  */
697
640
  export type PairingFailureReason =
698
641
  /** The pasted address is not a usable assistant address. */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/avatar-manifest",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/environments",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,4 +19,3 @@
19
19
  */
20
20
  export * from "./types.js";
21
21
  export * from "./seeds.js";
22
- export * from "./install-layout.js";
@@ -70,8 +70,6 @@ export const SEEDS: Record<string, EnvironmentDefinition> = {
70
70
  },
71
71
  test: {
72
72
  name: "test",
73
- // Non-functional URL — used only by unit tests for URL resolution, never
74
- // hit in production.
75
73
  cloudUrl: "https://test-cloud.mycadet.ai",
76
74
  webUrl: "https://dev.mycadet.ai",
77
75
  portsOverride: portBlock(19000),
@@ -86,9 +84,6 @@ export const SEEDS: Record<string, EnvironmentDefinition> = {
86
84
  name: "local",
87
85
  cloudUrl: "http://localhost:8000",
88
86
  webUrl: "http://localhost:3000",
89
- // assistantCloudUrl: "http://host.docker.internal:8000",
90
- // ^ uncomment this once dockerized hatch path is live.
91
- // The assistant runs in a different network namespace than the host.
92
87
  portsOverride: portBlock(20000),
93
88
  },
94
89
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/ipc-server-utils",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/avatar-manifest",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/environments",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,4 +19,3 @@
19
19
  */
20
20
  export * from "./types.js";
21
21
  export * from "./seeds.js";
22
- export * from "./install-layout.js";
@@ -70,8 +70,6 @@ export const SEEDS: Record<string, EnvironmentDefinition> = {
70
70
  },
71
71
  test: {
72
72
  name: "test",
73
- // Non-functional URL — used only by unit tests for URL resolution, never
74
- // hit in production.
75
73
  cloudUrl: "https://test-cloud.mycadet.ai",
76
74
  webUrl: "https://dev.mycadet.ai",
77
75
  portsOverride: portBlock(19000),
@@ -86,9 +84,6 @@ export const SEEDS: Record<string, EnvironmentDefinition> = {
86
84
  name: "local",
87
85
  cloudUrl: "http://localhost:8000",
88
86
  webUrl: "http://localhost:3000",
89
- // assistantCloudUrl: "http://host.docker.internal:8000",
90
- // ^ uncomment this once dockerized hatch path is live.
91
- // The assistant runs in a different network namespace than the host.
92
87
  portsOverride: portBlock(20000),
93
88
  },
94
89
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/ipc-server-utils",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/service-contracts",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -48,7 +48,7 @@ describe("parseRemoteWebPairingParams", () => {
48
48
  describe("parsePairingAddress", () => {
49
49
  test("splits a pairing link into its base and device code", () => {
50
50
  const link = buildRemoteWebPairingUrl({
51
- verificationUri: "https://assistant.example.com/assistant/pair",
51
+ verificationUri: "https://assistant.example.com/account/pair",
52
52
  deviceCode: "device-1",
53
53
  });
54
54
 
@@ -62,7 +62,7 @@ describe("parsePairingAddress", () => {
62
62
  test("accepts the device code in the query string", () => {
63
63
  expect(
64
64
  parsePairingAddress(
65
- "https://assistant.example.com/assistant/pair?deviceCode=device-2",
65
+ "https://assistant.example.com/account/pair?deviceCode=device-2",
66
66
  ),
67
67
  ).toEqual({
68
68
  ok: true,
@@ -71,25 +71,28 @@ describe("parsePairingAddress", () => {
71
71
  });
72
72
  });
73
73
 
74
- test("preserves a path prefix while dropping the app-route suffix", () => {
75
- expect(
76
- parsePairingAddress(
77
- "https://host.example.com/assistant-123/assistant/pair#device_code=device-3",
78
- ),
79
- ).toEqual({
74
+ test("splits an app-shell pairing link (the pair page lives at /account/pair)", () => {
75
+ const link = buildRemoteWebPairingUrl({
76
+ verificationUri: "https://assistant.example.com/account/pair",
77
+ deviceCode: "device-4",
78
+ });
79
+
80
+ expect(parsePairingAddress(link)).toEqual({
80
81
  ok: true,
81
- publicBaseUrl: "https://host.example.com/assistant-123",
82
- deviceCode: "device-3",
82
+ publicBaseUrl: "https://assistant.example.com",
83
+ deviceCode: "device-4",
83
84
  });
84
85
  });
85
86
 
86
- test("drops a trailing app-route suffix from a bare address", () => {
87
+ test("preserves a path prefix on an app-shell pairing link", () => {
87
88
  expect(
88
- parsePairingAddress("https://assistant.example.com/assistant/pair"),
89
+ parsePairingAddress(
90
+ "https://host.example.com/assistant-123/account/pair#device_code=device-5",
91
+ ),
89
92
  ).toEqual({
90
93
  ok: true,
91
- publicBaseUrl: "https://assistant.example.com",
92
- deviceCode: null,
94
+ publicBaseUrl: "https://host.example.com/assistant-123",
95
+ deviceCode: "device-5",
93
96
  });
94
97
  });
95
98
 
@@ -3,10 +3,14 @@
3
3
  * deployment naming convention (`cloud.mycadet.ai` → `tunnel.mycadet.ai`,
4
4
  * `{env}-cloud.mycadet.ai` → `{env}-tunnel.mycadet.ai`). Returns null for
5
5
  * hosts outside that convention (localhost, custom domains). Shared by the
6
- * gateway speech relay and the web live-voice client so the two ends of the
7
- * cloud-speech transport can't drift.
6
+ * gateway speech relay (which passes the request's own host) and the web
7
+ * live-voice client (which defaults to the page's origin) so the two ends
8
+ * of the cloud-speech transport can't drift.
8
9
  */
9
- export function tunnelHostForCloudHost(host: string): string | null {
10
+ export function tunnelHostForCloudHost(
11
+ host: string = (globalThis as { location?: { hostname?: string } }).location
12
+ ?.hostname ?? "",
13
+ ): string | null {
10
14
  if (host === "cloud.mycadet.ai") {
11
15
  return "tunnel.mycadet.ai";
12
16
  }
@@ -78,60 +78,6 @@ export interface RemoteWebPairingVerificationResponse {
78
78
  expiresAt: string;
79
79
  }
80
80
 
81
- /**
82
- * One pending challenge as shown on a host approval surface.
83
- *
84
- * The requesting device already sees the plaintext `userCode` in its own
85
- * challenge response ({@link RemoteWebPairingChallengeResponse.userCode});
86
- * the loopback-gated list route is the only host-side re-exposure. Displaying
87
- * it there is what lets the approver match the code against the requesting
88
- * device's screen: the device-flow anti-phishing binding.
89
- */
90
- export interface RemoteWebPairingRequestSummary {
91
- /** Opaque server-side id used to approve or deny this request. */
92
- requestId: string;
93
- /** The human-readable code the requesting device is displaying (e.g. "ABCD-EFGH"). */
94
- userCode: string;
95
- /** Public base URL the challenge was minted for. */
96
- publicBaseUrl: string;
97
- /** ISO-8601 instant the challenge was minted. */
98
- requestedAt: string;
99
- /** ISO-8601 instant the challenge expires. */
100
- expiresAt: string;
101
- /**
102
- * Client IP of the mint request: the loopback/host address when minted
103
- * locally, or the edge-observed client address when the mint arrived
104
- * through the nginx app server (which stamps it via `proxy_set_header`,
105
- * so a remote client cannot smuggle a value).
106
- */
107
- requesterIp: string;
108
- /** User-Agent header of the mint request, or null when absent. */
109
- requesterUserAgent: string | null;
110
- /**
111
- * Whether the mint arrived through the public app server rather than the
112
- * host itself.
113
- */
114
- viaEdgeProxy: boolean;
115
- }
116
-
117
- /** `GET /v1/remote-web/pairing-requests` success response body (200). */
118
- export interface RemoteWebPairingRequestListResponse {
119
- requests: RemoteWebPairingRequestSummary[];
120
- }
121
-
122
- /**
123
- * Request body for the pairing-request approve and deny routes. The approve
124
- * route's success body reuses {@link RemoteWebPairingVerificationResponse}.
125
- */
126
- export interface RemoteWebPairingRequestActionRequest {
127
- requestId: string;
128
- }
129
-
130
- /** `POST /v1/remote-web/pairing-requests/deny` success response body (200). */
131
- export interface RemoteWebPairingRequestDenyResponse {
132
- status: "denied";
133
- }
134
-
135
81
  /**
136
82
  * Platforms a device-bound pairing exchange may declare for itself. The value
137
83
  * is what the host's `Paired devices` list renders for the new pairing.
@@ -535,18 +481,18 @@ export function isPrivateNetworkPublicUrl(url: string): boolean {
535
481
 
536
482
  /**
537
483
  * Normalize an address to the public base a scanning device opens:
538
- * query/hash stripped, the `assistant` path segment (and everything after it)
539
- * removed so a pasted pair-page URL collapses to its base, and trailing
540
- * slashes trimmed. Throws if the value is not a parseable URL.
484
+ * query/hash stripped, the pair page's `account` path segment (and everything
485
+ * after it) removed so a pasted pair-page URL collapses to its base, and
486
+ * trailing slashes trimmed. Throws if the value is not a parseable URL.
541
487
  */
542
488
  export function normalizePairingBaseUrl(value: string): string {
543
489
  const url = new URL(value);
544
490
  url.search = "";
545
491
  url.hash = "";
546
492
  const parts = url.pathname.split("/").filter(Boolean);
547
- const assistantIndex = parts.indexOf("assistant");
548
- if (assistantIndex >= 0) {
549
- parts.splice(assistantIndex);
493
+ const cutIndex = parts.indexOf("account");
494
+ if (cutIndex >= 0) {
495
+ parts.splice(cutIndex);
550
496
  }
551
497
  url.pathname = parts.length ? `/${parts.join("/")}` : "/";
552
498
  return url.toString().replace(/\/+$/, "");
@@ -689,10 +635,7 @@ export function parsePairingAddress(raw: string): ParsePairingAddressResult {
689
635
  }
690
636
 
691
637
  /**
692
- * What a pairing attempt failed on, for callers picking recovery copy. Every
693
- * pairing surface reports one of these: the host-side sessions in
694
- * `@mycadet/local-mode`, the Electron bridge, the desktop connect dialog, and
695
- * the `cadet connect import` CLI.
638
+ * What a pairing attempt failed on, for callers picking recovery copy
696
639
  */
697
640
  export type PairingFailureReason =
698
641
  /** The pasted address is not a usable assistant address. */
@@ -0,0 +1,51 @@
1
+ // @ts-check
2
+ /** `imports-first` — imports must sit at the top of the file, before any other statement. */
3
+
4
+ /** The rule object exported for `eslint.config` `plugins` registries. */
5
+ export const importsFirst = {
6
+ meta: {
7
+ type: "suggestion",
8
+ fixable: "code",
9
+ docs: {
10
+ description: "imports must be hoisted to the top of the file",
11
+ },
12
+ schema: [],
13
+ messages: {
14
+ hoist: "Import must be at the top of the file, before other statements.",
15
+ },
16
+ },
17
+ create(context) {
18
+ let seenStatement = false;
19
+ let firstNonImport = undefined;
20
+ return {
21
+ Program(program) {
22
+ for (const statement of program.body) {
23
+ if (statement.type === "ImportDeclaration") {
24
+ if (seenStatement) {
25
+ context.report({
26
+ node: statement,
27
+ messageId: "hoist",
28
+ fix(fixer) {
29
+ if (!firstNonImport) return null;
30
+ const sourceText = context.sourceCode.text;
31
+ const hoisted = sourceText.slice(
32
+ statement.range[0],
33
+ statement.range[1],
34
+ );
35
+ if (!hoisted) return null;
36
+ return [
37
+ fixer.insertTextBefore(firstNonImport, `${hoisted}\n`),
38
+ fixer.remove(statement),
39
+ ];
40
+ },
41
+ });
42
+ }
43
+ } else if (!seenStatement) {
44
+ seenStatement = true;
45
+ firstNonImport = statement;
46
+ }
47
+ }
48
+ },
49
+ };
50
+ },
51
+ };
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Unit tests for the imports-first ESLint rule.
3
+ *
4
+ * Run with: `bun test packages/shared/eslint/imports-first.test.mjs`
5
+ *
6
+ * Like no-re-exports' suite: a passing run prints "Ran 0 tests" (a bun
7
+ * `.mjs` reporting artifact) — the cases still execute and a wrong
8
+ * expectation still throws with a non-zero exit.
9
+ */
10
+ import { RuleTester } from "eslint";
11
+ import tseslint from "typescript-eslint";
12
+
13
+ import { importsFirst } from "./imports-first.mjs";
14
+
15
+ const ruleTester = new RuleTester({
16
+ languageOptions: {
17
+ parser: tseslint.parser,
18
+ ecmaVersion: "latest",
19
+ sourceType: "module",
20
+ },
21
+ });
22
+
23
+ ruleTester.run("imports-first", importsFirst, {
24
+ valid: [
25
+ {
26
+ name: "imports at the top, then statements",
27
+ code: [
28
+ 'import { helper } from "./helper.js";',
29
+ 'import type { Shape } from "./shape.js";',
30
+ "",
31
+ "export const x: Shape = helper();",
32
+ ].join("\n"),
33
+ },
34
+ {
35
+ name: "comments between imports are not statements",
36
+ code: [
37
+ 'import { helper } from "./helper.js";',
38
+ "",
39
+ "// A section comment.",
40
+ "// Another line of it.",
41
+ 'import { other } from "./other.js";',
42
+ "",
43
+ "export const y = other();",
44
+ ].join("\n"),
45
+ },
46
+ {
47
+ name: "a module with only imports",
48
+ code: ['import { helper } from "./helper.js";'].join("\n"),
49
+ },
50
+ ],
51
+ invalid: [
52
+ {
53
+ name: "an import after a statement is flagged",
54
+ code: [
55
+ 'import { helper } from "./helper.js";',
56
+ "",
57
+ "export const x = helper();",
58
+ "",
59
+ 'import { other } from "./other.js";',
60
+ "",
61
+ "export const y = other();",
62
+ ].join("\n"),
63
+ errors: [{ messageId: "hoist" }],
64
+ output: [
65
+ 'import { helper } from "./helper.js";',
66
+ "",
67
+ 'import { other } from "./other.js";',
68
+ "export const x = helper();",
69
+ "",
70
+ "",
71
+ "",
72
+ "export const y = other();",
73
+ ].join("\n"),
74
+ },
75
+ {
76
+ name: "each late import is flagged once",
77
+ code: [
78
+ "export const x = 1;",
79
+ 'import { helper } from "./helper.js";',
80
+ 'import { other } from "./other.js";',
81
+ "",
82
+ "export const y = helper() + other();",
83
+ ].join("\n"),
84
+ errors: [{ messageId: "hoist" }, { messageId: "hoist" }],
85
+ output: [
86
+ 'import { helper } from "./helper.js";',
87
+ "export const x = 1;",
88
+ "",
89
+ 'import { other } from "./other.js";',
90
+ "",
91
+ "export const y = helper() + other();",
92
+ ].join("\n"),
93
+ },
94
+ ],
95
+ });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/shared",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "exports": {
6
6
  ".": "./github-repository.ts",
@@ -9,7 +9,8 @@
9
9
  "./providers/baseten": "./providers/baseten.ts",
10
10
  "./scripts/run-isolated-tests": "./scripts/run-isolated-tests.ts",
11
11
  "./version": "./version.ts",
12
- "./eslint/no-re-exports": "./eslint/no-re-exports.mjs"
12
+ "./eslint/no-re-exports": "./eslint/no-re-exports.mjs",
13
+ "./eslint/imports-first": "./eslint/imports-first.mjs"
13
14
  },
14
15
  "devDependencies": {
15
16
  "eslint": "10.1.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycadet/local-mode",
3
- "version": "0.13.0-dev.202611041208.2540870",
3
+ "version": "0.13.0-dev.202611110042.6f8c11c",
4
4
  "private": true,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "scripts": {
13
13
  "typecheck": "bunx tsc --noEmit",
14
- "test": "bun test src/"
14
+ "test": "bun scripts/run-tests.ts"
15
15
  },
16
16
  "dependencies": {
17
17
  "@mycadet/avatar-manifest": "workspace:*",