@mycadet/cli 0.13.0-dev.202611041208.2540870 → 0.13.0-dev.202611121243.82bf60e

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 (222) 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/assistant-api/responses/activation.ts +1 -1
  6. package/node_modules/@mycadet/assistant-api/responses/conversation-message.ts +1 -1
  7. package/node_modules/@mycadet/avatar-manifest/package.json +1 -1
  8. package/node_modules/@mycadet/environments/package.json +1 -1
  9. package/node_modules/@mycadet/environments/src/index.ts +0 -1
  10. package/node_modules/@mycadet/environments/src/seeds.ts +0 -5
  11. package/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
  12. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/avatar-manifest/package.json +1 -1
  13. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/package.json +1 -1
  14. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/index.ts +0 -1
  15. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/environments/src/seeds.ts +0 -5
  16. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/ipc-server-utils/package.json +1 -1
  17. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/package.json +1 -1
  18. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/__tests__/remote-web-pairing.test.ts +17 -14
  19. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/ingress.ts +7 -3
  20. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +7 -64
  21. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/imports-first.mjs +51 -0
  22. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/imports-first.test.mjs +95 -0
  23. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/no-empty-imports.mjs +71 -0
  24. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/eslint/no-empty-imports.test.mjs +71 -0
  25. package/node_modules/@mycadet/local-mode/node_modules/@mycadet/shared/package.json +4 -2
  26. package/node_modules/@mycadet/local-mode/package.json +2 -2
  27. package/node_modules/@mycadet/local-mode/scripts/run-tests.ts +3 -0
  28. package/{src/__tests__/teleport-backup.test.ts → node_modules/@mycadet/local-mode/src/__tests__/cloud-backup.test.ts} +20 -23
  29. package/node_modules/@mycadet/local-mode/src/__tests__/cloud-releases.test.ts +1 -1
  30. package/node_modules/@mycadet/local-mode/src/__tests__/hatch-local-overlay.test.ts +144 -0
  31. package/node_modules/@mycadet/local-mode/src/__tests__/health-check.test.ts +132 -2
  32. package/node_modules/@mycadet/local-mode/src/__tests__/local-exec-invocation.test.ts +111 -0
  33. package/node_modules/@mycadet/local-mode/src/__tests__/operations-backup.test.ts +97 -0
  34. package/node_modules/@mycadet/local-mode/src/__tests__/operations-doctor.test.ts +231 -0
  35. package/node_modules/@mycadet/local-mode/src/__tests__/operations-hatch.test.ts +17 -1
  36. package/node_modules/@mycadet/local-mode/src/__tests__/operations-migrations.test.ts +170 -0
  37. package/node_modules/@mycadet/local-mode/src/__tests__/operations-pair.test.ts +16 -2
  38. package/node_modules/@mycadet/local-mode/src/__tests__/operations-profile.test.ts +67 -0
  39. package/node_modules/@mycadet/local-mode/src/__tests__/operations-proxy.test.ts +280 -0
  40. package/node_modules/@mycadet/local-mode/src/__tests__/operations-resolution.test.ts +27 -14
  41. package/node_modules/@mycadet/local-mode/src/__tests__/operations-restart.test.ts +203 -0
  42. package/node_modules/@mycadet/local-mode/src/__tests__/operations-restore.test.ts +271 -0
  43. package/node_modules/@mycadet/local-mode/src/__tests__/operations-retire.test.ts +66 -7
  44. package/node_modules/@mycadet/local-mode/src/__tests__/operations-routes.test.ts +44 -38
  45. package/node_modules/@mycadet/local-mode/src/__tests__/operations-sleep.test.ts +103 -8
  46. package/node_modules/@mycadet/local-mode/src/__tests__/operations-teleport.test.ts +377 -0
  47. package/node_modules/@mycadet/local-mode/src/__tests__/operations-wake.test.ts +87 -10
  48. package/node_modules/@mycadet/local-mode/src/__tests__/pair.test.ts +6 -6
  49. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-baseten-api.test.ts +332 -7
  50. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-baseten-exec.test.ts +279 -0
  51. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-baseten-hatch-volume.test.ts +13 -0
  52. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-docker-sleep.test.ts +83 -0
  53. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-docker-statefulset.test.ts +0 -1
  54. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-docker-wake.test.ts +26 -36
  55. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-common-gateway-cli.test.ts +1 -3
  56. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-common-readiness.test.ts +34 -13
  57. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-common-runtime.test.ts +1 -1
  58. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-instance.test.ts +55 -0
  59. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-retire.test.ts +3 -3
  60. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-upgrade.test.ts +29 -35
  61. package/node_modules/@mycadet/local-mode/src/__tests__/remotes-local-wake.test.ts +25 -198
  62. package/node_modules/@mycadet/local-mode/src/__tests__/root-backup-docker.test.ts +3 -2
  63. package/node_modules/@mycadet/local-mode/src/__tests__/root-backup.test.ts +5 -1
  64. package/node_modules/@mycadet/local-mode/src/__tests__/teleport-init.test.ts +151 -0
  65. package/node_modules/@mycadet/local-mode/src/__tests__/upgrade-replay-env.test.ts +2 -4
  66. package/node_modules/@mycadet/local-mode/src/__tests__/upgrade-root-recovery.test.ts +6 -3
  67. package/node_modules/@mycadet/local-mode/src/cloud-registration.ts +2 -2
  68. package/node_modules/@mycadet/local-mode/src/daemon-readiness.ts +251 -58
  69. package/node_modules/@mycadet/local-mode/src/devices.ts +2 -2
  70. package/node_modules/@mycadet/local-mode/src/guardian-token.ts +31 -3
  71. package/node_modules/@mycadet/local-mode/src/index.ts +83 -309
  72. package/node_modules/@mycadet/local-mode/src/lockfile-contract.ts +21 -58
  73. package/node_modules/@mycadet/local-mode/src/lockfile.ts +19 -0
  74. package/node_modules/@mycadet/local-mode/src/operations/backup.ts +42 -0
  75. package/node_modules/@mycadet/local-mode/src/operations/cloud-proxy.ts +46 -0
  76. package/node_modules/@mycadet/local-mode/src/operations/doctor.ts +202 -0
  77. package/node_modules/@mycadet/local-mode/src/operations/exec.ts +139 -0
  78. package/node_modules/@mycadet/local-mode/src/operations/hatch.ts +12 -0
  79. package/node_modules/@mycadet/local-mode/src/operations/migrations.ts +62 -0
  80. package/node_modules/@mycadet/local-mode/src/operations/profile.ts +82 -0
  81. package/node_modules/@mycadet/local-mode/src/operations/resolve.ts +3 -3
  82. package/node_modules/@mycadet/local-mode/src/operations/restart.ts +106 -0
  83. package/node_modules/@mycadet/local-mode/src/operations/restore.ts +111 -0
  84. package/node_modules/@mycadet/local-mode/src/operations/retire.ts +6 -2
  85. package/node_modules/@mycadet/local-mode/src/operations/routes.ts +235 -15
  86. package/node_modules/@mycadet/local-mode/src/operations/sleep.ts +16 -5
  87. package/node_modules/@mycadet/local-mode/src/operations/teleport.ts +162 -0
  88. package/node_modules/@mycadet/local-mode/src/operations/upgrade.ts +4 -5
  89. package/node_modules/@mycadet/local-mode/src/operations/wake.ts +7 -2
  90. package/node_modules/@mycadet/local-mode/src/pair.ts +1 -7
  91. package/node_modules/@mycadet/local-mode/src/process.ts +1 -9
  92. package/{src/lib/remotes/apple-container.ts → node_modules/@mycadet/local-mode/src/remotes/apple-container/exec.ts} +3 -5
  93. package/node_modules/@mycadet/local-mode/src/remotes/baseten/Dockerfile +5 -3
  94. package/node_modules/@mycadet/local-mode/src/remotes/baseten/api.ts +233 -13
  95. package/node_modules/@mycadet/local-mode/src/remotes/baseten/baseten-cli.ts +8 -14
  96. package/node_modules/@mycadet/local-mode/src/remotes/baseten/entrypoint.sh +20 -5
  97. package/node_modules/@mycadet/local-mode/src/remotes/baseten/exec.ts +217 -0
  98. package/node_modules/@mycadet/local-mode/src/remotes/baseten/hatch.ts +69 -9
  99. package/node_modules/@mycadet/local-mode/src/remotes/baseten/lifecycle.ts +186 -0
  100. package/node_modules/@mycadet/local-mode/src/remotes/baseten/zip.ts +1 -11
  101. package/{src/lib/teleport-backup.ts → node_modules/@mycadet/local-mode/src/remotes/cloud/backup.ts} +46 -19
  102. package/node_modules/@mycadet/local-mode/src/remotes/cloud/exec.ts +520 -0
  103. package/node_modules/@mycadet/local-mode/src/remotes/cloud/migrations.ts +371 -0
  104. package/node_modules/@mycadet/local-mode/src/remotes/cloud/restore.ts +399 -0
  105. package/node_modules/@mycadet/local-mode/src/remotes/cloud/retire.ts +12 -14
  106. package/{src/lib → node_modules/@mycadet/local-mode/src/remotes/cloud}/terminal-client.ts +2 -5
  107. package/node_modules/@mycadet/local-mode/src/remotes/cloud/upgrade.ts +27 -27
  108. package/node_modules/@mycadet/local-mode/src/remotes/docker/backup.ts +18 -0
  109. package/node_modules/@mycadet/local-mode/src/remotes/docker/exec.ts +33 -0
  110. package/node_modules/@mycadet/local-mode/src/remotes/docker/hatch.ts +11 -28
  111. package/node_modules/@mycadet/local-mode/src/remotes/docker/pair.ts +33 -32
  112. package/node_modules/@mycadet/local-mode/src/remotes/docker/restore.ts +24 -0
  113. package/node_modules/@mycadet/local-mode/src/remotes/docker/sleep.ts +17 -2
  114. package/node_modules/@mycadet/local-mode/src/remotes/docker/statefulset.ts +1 -40
  115. package/node_modules/@mycadet/local-mode/src/remotes/docker/teleport.ts +128 -0
  116. package/node_modules/@mycadet/local-mode/src/remotes/docker/upgrade.ts +28 -55
  117. package/node_modules/@mycadet/local-mode/src/remotes/docker/wake.ts +206 -8
  118. package/node_modules/@mycadet/local-mode/src/remotes/docker/watch.ts +16 -7
  119. package/node_modules/@mycadet/local-mode/src/remotes/local/backup.ts +17 -0
  120. package/node_modules/@mycadet/local-mode/src/remotes/local/common.ts +126 -429
  121. package/node_modules/@mycadet/local-mode/src/remotes/local/exec.ts +130 -0
  122. package/node_modules/@mycadet/local-mode/src/remotes/local/hatch.ts +4 -7
  123. package/node_modules/@mycadet/local-mode/src/remotes/local/instance.ts +10 -20
  124. package/node_modules/@mycadet/local-mode/src/remotes/local/pair.ts +36 -28
  125. package/node_modules/@mycadet/local-mode/src/remotes/local/restore.ts +125 -0
  126. package/node_modules/@mycadet/local-mode/src/remotes/local/sleep.ts +19 -3
  127. package/node_modules/@mycadet/local-mode/src/remotes/local/teleport.ts +43 -0
  128. package/node_modules/@mycadet/local-mode/src/remotes/local/upgrade.ts +10 -12
  129. package/node_modules/@mycadet/local-mode/src/remotes/local/wake.ts +36 -203
  130. package/node_modules/@mycadet/local-mode/src/root-backup.ts +17 -5
  131. package/node_modules/@mycadet/local-mode/src/served-config.test.ts +41 -1
  132. package/node_modules/@mycadet/local-mode/src/served-config.ts +18 -5
  133. package/node_modules/@mycadet/local-mode/src/upgrade-lifecycle.ts +10 -61
  134. package/node_modules/@mycadet/local-mode/src/version-compat.ts +0 -3
  135. package/node_modules/@mycadet/service-contracts/package.json +1 -1
  136. package/node_modules/@mycadet/service-contracts/src/__tests__/remote-web-pairing.test.ts +17 -14
  137. package/node_modules/@mycadet/service-contracts/src/ingress.ts +7 -3
  138. package/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +7 -64
  139. package/node_modules/@mycadet/shared/eslint/imports-first.mjs +51 -0
  140. package/node_modules/@mycadet/shared/eslint/imports-first.test.mjs +95 -0
  141. package/node_modules/@mycadet/shared/eslint/no-empty-imports.mjs +71 -0
  142. package/node_modules/@mycadet/shared/eslint/no-empty-imports.test.mjs +71 -0
  143. package/node_modules/@mycadet/shared/package.json +4 -2
  144. package/package.json +1 -2
  145. package/src/__tests__/app-command.test.ts +0 -1
  146. package/src/__tests__/assistant-client-refresh.test.ts +5 -2
  147. package/src/__tests__/backup.test.ts +19 -59
  148. package/src/__tests__/client-tui-refresh.test.ts +1 -2
  149. package/src/__tests__/connect-import.test.ts +3 -4
  150. package/src/__tests__/debug.test.ts +1 -2
  151. package/src/__tests__/devices.test.ts +3 -3
  152. package/src/__tests__/guardian-token.test.ts +2 -11
  153. package/src/__tests__/pair.test.ts +25 -20
  154. package/src/__tests__/ps-cloud-status.test.ts +1 -1
  155. package/src/__tests__/restart-command.test.ts +165 -0
  156. package/src/__tests__/restore.test.ts +15 -136
  157. package/src/__tests__/root-restore-command.test.ts +47 -88
  158. package/src/__tests__/servers/bun.test.ts +272 -673
  159. package/src/__tests__/setup.test.ts +1 -2
  160. package/src/__tests__/sleep.test.ts +3 -113
  161. package/src/__tests__/teleport.test.ts +30 -29
  162. package/src/__tests__/tui-midsession-refresh.test.ts +1 -2
  163. package/src/__tests__/web-dist.test.ts +57 -173
  164. package/src/commands/app.ts +37 -1
  165. package/src/commands/backup.ts +7 -23
  166. package/src/commands/client.ts +8 -10
  167. package/src/commands/connect/import.ts +1 -1
  168. package/src/commands/debug.ts +3 -3
  169. package/src/commands/devices.ts +2 -2
  170. package/src/commands/exec.ts +18 -159
  171. package/src/commands/login.ts +2 -4
  172. package/src/commands/logs.ts +1 -1
  173. package/src/commands/pair.ts +19 -11
  174. package/src/commands/ps.ts +8 -23
  175. package/src/commands/restart.ts +51 -17
  176. package/src/commands/restore.ts +74 -462
  177. package/src/commands/setup.ts +2 -5
  178. package/src/commands/sleep.ts +3 -50
  179. package/src/commands/teleport.ts +15 -65
  180. package/src/commands/terminal.ts +7 -9
  181. package/src/commands/uninstall.ts +33 -9
  182. package/src/components/DefaultMainScreen.tsx +2 -6
  183. package/src/index.ts +1 -2
  184. package/src/lib/__tests__/cloud-client-signed-url.test.ts +2 -3
  185. package/src/lib/__tests__/{step-runner.test.ts → exec.test.ts} +2 -1
  186. package/src/lib/__tests__/terminal-session.test.ts +1 -1
  187. package/src/lib/__tests__/web-dist.test.ts +47 -58
  188. package/src/lib/assistant-client.ts +3 -18
  189. package/src/lib/cli-error.ts +1 -1
  190. package/src/lib/cloud-client.ts +5 -368
  191. package/src/lib/constants.ts +8 -8
  192. package/src/lib/guardian-token.ts +2 -27
  193. package/src/lib/live-voice/connection.ts +3 -26
  194. package/src/lib/pair.test.ts +0 -6
  195. package/src/lib/pair.ts +3 -7
  196. package/src/lib/remotes/cloud.ts +1 -1
  197. package/src/lib/runtime-url.ts +2 -2
  198. package/src/lib/servers/bun.ts +82 -117
  199. package/src/lib/servers/common.ts +90 -288
  200. package/src/lib/sync-cloud-assistants.ts +2 -2
  201. package/src/lib/terminal-session.ts +7 -518
  202. package/src/lib/tunnels/gateway-notify.ts +1 -1
  203. package/src/lib/web-dist.ts +56 -117
  204. package/node_modules/@mycadet/local-mode/src/__tests__/daemon-readiness-version.test.ts +0 -29
  205. package/node_modules/@mycadet/local-mode/src/__tests__/gateway-proxy.test.ts +0 -430
  206. package/node_modules/@mycadet/local-mode/src/__tests__/package-boundary.test.ts +0 -131
  207. package/node_modules/@mycadet/local-mode/src/cloud-values.ts +0 -8
  208. package/node_modules/@mycadet/local-mode/src/gateway-bearer.test.ts +0 -165
  209. package/node_modules/@mycadet/local-mode/src/gateway-bearer.ts +0 -134
  210. package/node_modules/@mycadet/local-mode/src/gateway-proxy.ts +0 -361
  211. package/node_modules/@mycadet/local-mode/src/health-check.ts +0 -154
  212. package/node_modules/@mycadet/local-mode/src/remotes/docker/recreate.ts +0 -98
  213. package/src/__tests__/host-teleport-docker.test.ts +0 -412
  214. package/src/__tests__/host-teleport.test.ts +0 -426
  215. package/src/__tests__/version.test.ts +0 -62
  216. package/src/lib/cloud-values.ts +0 -3
  217. package/src/lib/environments/__tests__/resolve.test.ts +0 -238
  218. package/src/lib/environments/resolve.ts +0 -123
  219. package/src/lib/host-teleport.ts +0 -298
  220. package/src/lib/remotes/docker.ts +0 -257
  221. package/src/lib/remotes/local.ts +0 -22
  222. 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.202611121243.82bf60e",
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. */
@@ -33,7 +33,7 @@ export const ACTIVATION_ID_PATTERN = /^[a-z0-9-]{1,64}$/;
33
33
  */
34
34
  export const ACTIVATION_CONVERSATION_ID_MAX_LENGTH = 128;
35
35
 
36
- export const ActivationIdSchema = z
36
+ const ActivationIdSchema = z
37
37
  .string()
38
38
  .regex(ACTIVATION_ID_PATTERN)
39
39
  .describe("Opaque lowercase-kebab identifier, 1-64 characters");
@@ -324,7 +324,7 @@ export type ConversationSubagentNotification = z.infer<
324
324
  // ---------------------------------------------------------------------------
325
325
 
326
326
  /** Daemon-injected ACP-run lifecycle notification attached to a history row. */
327
- export const ConversationAcpNotificationSchema = z.object({
327
+ const ConversationAcpNotificationSchema = z.object({
328
328
  acpSessionId: z.string(),
329
329
  agent: z.string().optional(),
330
330
  });
@@ -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.202611121243.82bf60e",
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.202611121243.82bf60e",
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.202611121243.82bf60e",
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.202611121243.82bf60e",
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.202611121243.82bf60e",
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.202611121243.82bf60e",
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.202611121243.82bf60e",
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
+ });