@mycadet/gateway 0.12.7 → 0.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (179) hide show
  1. package/README.md +3 -3
  2. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/package.json +2 -2
  3. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/{platform-credential.ts → cloud-credential.ts} +9 -9
  4. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
  5. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
  6. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
  7. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
  8. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
  9. package/node_modules/@mycadet/ces-client/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
  10. package/node_modules/@mycadet/ces-client/package.json +1 -1
  11. package/node_modules/@mycadet/ces-client/src/__tests__/ces-client.test.ts +14 -14
  12. package/node_modules/@mycadet/ces-client/src/rpc-client.ts +1 -1
  13. package/node_modules/@mycadet/environments/src/seeds.ts +6 -6
  14. package/node_modules/@mycadet/environments/src/shell.test.ts +1 -1
  15. package/node_modules/@mycadet/environments/src/types.ts +6 -6
  16. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/package.json +2 -2
  17. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/{platform-credential.ts → cloud-credential.ts} +9 -9
  18. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
  19. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
  20. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
  21. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
  22. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
  23. package/node_modules/@mycadet/gateway-client/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
  24. package/node_modules/@mycadet/gateway-client/src/binding-strength-contract.ts +5 -5
  25. package/node_modules/@mycadet/gateway-client/src/gateway-ipc-contracts.ts +1 -1
  26. package/node_modules/@mycadet/gateway-client/src/inbound-contract.ts +2 -2
  27. package/node_modules/@mycadet/gateway-client/src/outbound-contract.ts +1 -1
  28. package/node_modules/@mycadet/service-contracts/package.json +2 -2
  29. package/node_modules/@mycadet/service-contracts/src/{platform-credential.ts → cloud-credential.ts} +9 -9
  30. package/node_modules/@mycadet/service-contracts/src/handles.ts +3 -3
  31. package/node_modules/@mycadet/service-contracts/src/index.ts +1 -1
  32. package/node_modules/@mycadet/service-contracts/src/ingress.ts +11 -5
  33. package/node_modules/@mycadet/service-contracts/src/remote-web-pairing.ts +1 -1
  34. package/node_modules/@mycadet/service-contracts/src/rpc.ts +14 -14
  35. package/node_modules/@mycadet/service-contracts/src/trust-rules.ts +5 -5
  36. package/openapi.json +17 -17
  37. package/package.json +1 -1
  38. package/scripts/generate-openapi.ts +1 -1
  39. package/src/__tests__/actor-token-revocation.test.ts +0 -1
  40. package/src/__tests__/{backup-worker-platform-mode.test.ts → backup-worker-cloud-mode.test.ts} +4 -4
  41. package/src/__tests__/channel-verification-session-proxy.test.ts +0 -1
  42. package/src/__tests__/{platform-identity.test.ts → cloud-identity.test.ts} +72 -86
  43. package/src/__tests__/config.test.ts +0 -24
  44. package/src/__tests__/contacts-control-plane-proxy.test.ts +0 -1
  45. package/src/__tests__/credential-requests.test.ts +6 -6
  46. package/src/__tests__/{credential-watcher-managed-bootstrap.test.ts → credential-watcher-cloud-bootstrap.test.ts} +1 -1
  47. package/src/__tests__/edge-auth.test.ts +18 -18
  48. package/src/__tests__/edge-guardian-auth.test.ts +10 -10
  49. package/src/__tests__/guardian-init-lockfile.test.ts +6 -8
  50. package/src/__tests__/guardian-pin.test.ts +8 -8
  51. package/src/__tests__/handle-inbound-admission.test.ts +0 -1
  52. package/src/__tests__/handle-inbound-app-context.test.ts +0 -1
  53. package/src/__tests__/handle-inbound-invite-intercept.test.ts +0 -1
  54. package/src/__tests__/handle-inbound-trust-verdict.test.ts +0 -1
  55. package/src/__tests__/inbound-contact-seed.test.ts +1 -1
  56. package/src/__tests__/live-voice-websocket.test.ts +12 -12
  57. package/src/__tests__/load-guards.test.ts +0 -1
  58. package/src/__tests__/migration-teleport-gcs-proxy.test.ts +0 -1
  59. package/src/__tests__/oauth-callback.test.ts +0 -1
  60. package/src/__tests__/remote-feature-flag-sync.test.ts +35 -45
  61. package/src/__tests__/resolve-assistant.test.ts +0 -1
  62. package/src/__tests__/route-schema-guard.test.ts +4 -1
  63. package/src/__tests__/runtime-client.test.ts +1 -2
  64. package/src/__tests__/runtime-health-proxy.test.ts +0 -1
  65. package/src/__tests__/runtime-proxy-auth.test.ts +3 -2
  66. package/src/__tests__/runtime-proxy-device-stamp.test.ts +0 -1
  67. package/src/__tests__/runtime-proxy-error-body.test.ts +0 -1
  68. package/src/__tests__/runtime-proxy.test.ts +0 -1
  69. package/src/__tests__/runtime-stream-test-utils.ts +0 -1
  70. package/src/__tests__/shared-invite-registration.test.ts +15 -32
  71. package/src/__tests__/slack-control-plane-proxy.test.ts +0 -1
  72. package/src/__tests__/slack-display-name.test.ts +0 -1
  73. package/src/__tests__/slack-normalize.test.ts +0 -1
  74. package/src/__tests__/slack-reaction-normalize.test.ts +0 -1
  75. package/src/__tests__/slack-socket-mode-catchup.test.ts +0 -1
  76. package/src/__tests__/slack-socket-mode-group-dm.test.ts +0 -1
  77. package/src/__tests__/slack-socket-mode-liveness.test.ts +0 -1
  78. package/src/__tests__/slack-socket-mode-outbound-root.test.ts +0 -1
  79. package/src/__tests__/slack-socket-mode-thread-tracking.test.ts +0 -1
  80. package/src/__tests__/speech-relay-websocket.test.ts +16 -14
  81. package/src/__tests__/stt-stream-websocket.test.ts +5 -5
  82. package/src/__tests__/telegram-control-plane-proxy.test.ts +0 -1
  83. package/src/__tests__/telegram-webhook-drop-visibility.test.ts +0 -1
  84. package/src/__tests__/telegram-webhook-handler.test.ts +0 -1
  85. package/src/__tests__/telegram-webhook-manager.test.ts +79 -80
  86. package/src/__tests__/twilio-media-websocket.test.ts +0 -1
  87. package/src/__tests__/twilio-webhooks.test.ts +6 -7
  88. package/src/__tests__/whatsapp-download.test.ts +0 -1
  89. package/src/__tests__/whatsapp-webhook.test.ts +0 -1
  90. package/src/attachments/ingest.test.ts +0 -1
  91. package/src/auth/guardian-bootstrap.ts +16 -15
  92. package/src/auth/scopes.ts +1 -1
  93. package/src/auth-fallback-reporter.ts +1 -1
  94. package/src/backup/backup-worker.ts +2 -2
  95. package/src/channels/inbound-event.ts +3 -3
  96. package/src/channels/ingress-inbound-vendors.test.ts +2 -2
  97. package/src/channels/ingress-inbound.ts +1 -1
  98. package/src/channels/ingress-verification.test.ts +2 -2
  99. package/src/channels/ingress-verification.ts +4 -4
  100. package/src/channels/plugin-ingress-approvals.test.ts +1 -1
  101. package/src/channels/plugin-ingress-approvals.ts +1 -1
  102. package/src/channels/plugin-ingress.test.ts +3 -3
  103. package/src/channels/plugin-ingress.ts +3 -3
  104. package/src/channels/room-admission.ts +2 -2
  105. package/src/cli/contacts.ts +3 -1
  106. package/src/cli/index.ts +1 -1
  107. package/src/{platform-identity.ts → cloud-identity.ts} +60 -68
  108. package/src/cloud-url.ts +25 -0
  109. package/src/{platform-user-id.ts → cloud-user-id.ts} +4 -4
  110. package/src/config.ts +2 -4
  111. package/src/credential-reader.ts +2 -2
  112. package/src/db/assistant-db-proxy.ts +1 -1
  113. package/src/discord/forward.ts +1 -1
  114. package/src/email/normalize.ts +4 -4
  115. package/src/email/register-callback.test.ts +27 -34
  116. package/src/email/register-callback.ts +21 -26
  117. package/src/feature-flag-registry.json +5 -5
  118. package/src/feature-flag-remote-store.ts +2 -2
  119. package/src/feature-flag-resolver.ts +5 -5
  120. package/src/http/cadet-signature.ts +1 -1
  121. package/src/http/edge-forwarded-header.ts +1 -1
  122. package/src/http/loopback-guard.ts +1 -1
  123. package/src/http/middleware/auth.ts +22 -22
  124. package/src/http/router.ts +1 -1
  125. package/src/http/routes/auto-approve-thresholds-routes.ts +1 -1
  126. package/src/http/routes/cadet-identity.ts +2 -2
  127. package/src/http/routes/channel-admission-policy-routes.ts +2 -2
  128. package/src/http/routes/channel-ingress-routes.ts +3 -3
  129. package/src/http/routes/channel-ingress.test.ts +13 -2
  130. package/src/http/routes/channel-permission-overrides-routes.ts +3 -3
  131. package/src/http/routes/channel-verification-session-proxy.ts +8 -22
  132. package/src/http/routes/{platform-push-proxy.test.ts → cloud-push-proxy.test.ts} +21 -22
  133. package/src/http/routes/{platform-push-proxy.ts → cloud-push-proxy.ts} +13 -14
  134. package/src/http/routes/contacts-control-plane-proxy.ts +3 -3
  135. package/src/http/routes/contacts-control-plane-routes.ts +5 -5
  136. package/src/http/routes/email-webhook.test.ts +2 -3
  137. package/src/http/routes/email-webhook.ts +4 -4
  138. package/src/http/routes/feature-flags.ts +1 -1
  139. package/src/http/routes/guardian-channel-create.ts +3 -3
  140. package/src/http/routes/guardian-pin.ts +9 -9
  141. package/src/http/routes/inbound-register.ts +2 -2
  142. package/src/http/routes/ingress-domains.test.ts +129 -0
  143. package/src/http/routes/ingress-domains.ts +73 -0
  144. package/src/http/routes/live-voice-websocket.ts +2 -2
  145. package/src/http/routes/log-export.test.ts +0 -1
  146. package/src/http/routes/log-tail.test.ts +0 -1
  147. package/src/http/routes/migration-proxy.ts +1 -1
  148. package/src/http/routes/plugin-webhook-websocket.test.ts +3 -3
  149. package/src/http/routes/plugin-webhook.test.ts +9 -8
  150. package/src/http/routes/plugin-webhook.ts +1 -1
  151. package/src/http/routes/speech-relay-websocket.ts +8 -11
  152. package/src/http/routes/stt-stream-websocket.ts +1 -1
  153. package/src/http/routes/telegram-webhook.test.ts +0 -1
  154. package/src/http/routes/trust-rules-routes.ts +2 -2
  155. package/src/http/routes/twilio-voice-verify-callback.ts +3 -3
  156. package/src/http/routes/twilio-voice-webhook.test.ts +3 -4
  157. package/src/http/routes/twilio-voice-webhook.ts +3 -3
  158. package/src/http/routes/whatsapp-webhook.test.ts +0 -1
  159. package/src/index.ts +57 -56
  160. package/src/ipc/credential-request-handlers.ts +4 -4
  161. package/src/ipc/debug-export-handlers.test.ts +0 -1
  162. package/src/ipc/log-tail-handlers.test.ts +0 -1
  163. package/src/ipc/risk-classification-handlers.test.ts +4 -4
  164. package/src/ipc/risk-classification-handlers.ts +2 -2
  165. package/src/remote-feature-flag-sync.ts +17 -19
  166. package/src/risk/command-registry/commands/assistant.ts +2 -2
  167. package/src/risk/skill-risk-classifier.test.ts +24 -24
  168. package/src/risk/skill-risk-classifier.ts +10 -10
  169. package/src/runtime/client.ts +17 -17
  170. package/src/schema.ts +29 -29
  171. package/src/telegram/send.test.ts +0 -1
  172. package/src/telegram/webhook-manager.ts +33 -38
  173. package/src/tunnel/allowed-paths.test.ts +3 -3
  174. package/src/tunnel/allowed-paths.ts +1 -1
  175. package/src/tunnel/client.test.ts +20 -21
  176. package/src/tunnel/client.ts +16 -17
  177. package/src/verification/shared-invite-registration.ts +22 -17
  178. package/src/version.ts +1 -1
  179. package/src/platform-url.ts +0 -24
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Tests for registering `cadet-shared` invites with the platform during
2
+ * Tests for registering `cadet-shared` invites with the cloud during
3
3
  * invite creation (`createInviteNative`). The gateway DB is real; the
4
4
  * platform, credential store, feature flags and daemon IPC are stubbed.
5
5
  */
@@ -64,15 +64,14 @@ const { createInviteNative, createContactsControlPlaneProxyHandler } =
64
64
  await import("../http/routes/contacts-control-plane-proxy.js");
65
65
  const { seedContact } = await import("./helpers/contact-fixtures.js");
66
66
 
67
- const BASE_URL_KEY = credentialKey("cadet", "platform_base_url");
68
67
  const API_KEY_KEY = credentialKey("cadet", "assistant_api_key");
69
- const PLATFORM_URL = "https://platform.example.com";
68
+ const CLOUD_URL = "https://test-cloud.mycadet.ai";
70
69
  const API_KEY = "vak_test_key";
71
70
  const CONTACT_ID = "contact-alice";
72
71
 
73
- function withPlatformCredentials(): void {
72
+ function withCloudCredentials(): void {
73
+ process.env.CADET_CLOUD_URL = CLOUD_URL;
74
74
  storedCredentials = {
75
- [BASE_URL_KEY]: { value: `${PLATFORM_URL}/`, unreachable: false },
76
75
  [API_KEY_KEY]: { value: API_KEY, unreachable: false },
77
76
  };
78
77
  }
@@ -101,10 +100,9 @@ beforeEach(() => {
101
100
  fetchMock = mock(async () => new Response(null, { status: 204 }));
102
101
  ipcCalls = [];
103
102
  trustedContactsEnabled = true;
104
- withPlatformCredentials();
105
- delete process.env.CADET_DISABLE_PLATFORM;
106
- delete process.env.IS_PLATFORM;
107
- delete process.env.CADET_PLATFORM_URL;
103
+ withCloudCredentials();
104
+ delete process.env.CADET_DISABLE_CLOUD;
105
+ delete process.env.IS_CLOUD;
108
106
  delete process.env.ASSISTANT_API_KEY;
109
107
  });
110
108
 
@@ -119,7 +117,7 @@ describe("cadet-shared invite registration", () => {
119
117
 
120
118
  expect(fetchMock).toHaveBeenCalledTimes(1);
121
119
  const [url, init] = fetchMock.mock.calls[0]!;
122
- expect(url).toBe(`${PLATFORM_URL}/v1/internal/shared-invites/`);
120
+ expect(url).toBe(`${CLOUD_URL}/v1/internal/shared-invites/`);
123
121
  expect(init?.method).toBe("POST");
124
122
  const headers = init?.headers as Record<string, string>;
125
123
  expect(headers.Authorization).toBe(`Api-Key ${API_KEY}`);
@@ -152,7 +150,7 @@ describe("cadet-shared invite registration", () => {
152
150
 
153
151
  test("falls back to the environment for platform credentials", async () => {
154
152
  storedCredentials = {};
155
- process.env.CADET_PLATFORM_URL = PLATFORM_URL;
153
+ process.env.CADET_CLOUD_URL = CLOUD_URL;
156
154
  process.env.ASSISTANT_API_KEY = "vak_env_key";
157
155
 
158
156
  await createInviteNative({
@@ -161,7 +159,7 @@ describe("cadet-shared invite registration", () => {
161
159
  });
162
160
 
163
161
  const [url, init] = fetchMock.mock.calls[0]!;
164
- expect(url).toBe(`${PLATFORM_URL}/v1/internal/shared-invites/`);
162
+ expect(url).toBe(`${CLOUD_URL}/v1/internal/shared-invites/`);
165
163
  expect((init?.headers as Record<string, string>).Authorization).toBe(
166
164
  "Api-Key vak_env_key",
167
165
  );
@@ -200,7 +198,7 @@ describe("registration is skipped", () => {
200
198
  });
201
199
 
202
200
  test("when platform features are disabled", async () => {
203
- process.env.CADET_DISABLE_PLATFORM = "true";
201
+ process.env.CADET_DISABLE_CLOUD = "true";
204
202
 
205
203
  await createInviteNative({
206
204
  contactId: CONTACT_ID,
@@ -223,20 +221,6 @@ describe("registration is skipped", () => {
223
221
  expect(activeInviteRows()).toHaveLength(1);
224
222
  });
225
223
 
226
- test("when only the base URL is configured", async () => {
227
- storedCredentials = {
228
- [BASE_URL_KEY]: { value: PLATFORM_URL, unreachable: false },
229
- };
230
-
231
- await createInviteNative({
232
- contactId: CONTACT_ID,
233
- sourceChannel: "cadet-shared",
234
- });
235
-
236
- expect(fetchMock).not.toHaveBeenCalled();
237
- expect(activeInviteRows()).toHaveLength(1);
238
- });
239
-
240
224
  test("when the trusted-contacts flag is off", async () => {
241
225
  trustedContactsEnabled = false;
242
226
 
@@ -279,12 +263,12 @@ describe("a failed registration leaves no invite", () => {
279
263
  await expectCreateRejected(429, "TOO_MANY_OUTSTANDING_INVITES");
280
264
  });
281
265
 
282
- test("a platform error surfaces as 502", async () => {
266
+ test("a cloud error surfaces as 502", async () => {
283
267
  fetchMock = mock(async () => new Response(null, { status: 503 }));
284
268
  await expectCreateRejected(502, "INVITE_REGISTRATION_FAILED");
285
269
  });
286
270
 
287
- test("a platform refusal surfaces as 502", async () => {
271
+ test("a cloud refusal surfaces as 502", async () => {
288
272
  fetchMock = mock(async () => new Response(null, { status: 404 }));
289
273
  await expectCreateRejected(502, "INVITE_REGISTRATION_FAILED");
290
274
  });
@@ -296,10 +280,9 @@ describe("a failed registration leaves no invite", () => {
296
280
  await expectCreateRejected(502, "INVITE_REGISTRATION_FAILED");
297
281
  });
298
282
 
299
- test("an unreachable credential store surfaces as 503 without calling the platform", async () => {
283
+ test("an unreachable credential store surfaces as 503 without calling the cloud", async () => {
300
284
  storedCredentials = {
301
- [BASE_URL_KEY]: { value: undefined, unreachable: true },
302
- [API_KEY_KEY]: { value: API_KEY, unreachable: false },
285
+ [API_KEY_KEY]: { value: undefined, unreachable: true },
303
286
  };
304
287
  await expectCreateRejected(503, "INVITE_REGISTRATION_UNAVAILABLE");
305
288
  expect(fetchMock).not.toHaveBeenCalled();
@@ -26,7 +26,6 @@ function makeConfig(overrides: Partial<GatewayConfig> = {}): GatewayConfig {
26
26
  routingEntries: [],
27
27
  port: 7830,
28
28
  runtimeProxyRequireAuth: true,
29
- shutdownDrainMs: 5000,
30
29
  runtimeTimeoutMs: 30000,
31
30
  runtimeMaxRetries: 2,
32
31
  runtimeInitialBackoffMs: 500,
@@ -77,7 +77,6 @@ function makeConfig(overrides: Partial<GatewayConfig> = {}): GatewayConfig {
77
77
  runtimeMaxRetries: 2,
78
78
  runtimeProxyRequireAuth: false,
79
79
  runtimeTimeoutMs: 30000,
80
- shutdownDrainMs: 5000,
81
80
  trustProxy: false,
82
81
  ...overrides,
83
82
  } as GatewayConfig;
@@ -33,7 +33,6 @@ function makeConfig(overrides: Partial<GatewayConfig> = {}): GatewayConfig {
33
33
  runtimeMaxRetries: 2,
34
34
  runtimeProxyRequireAuth: false,
35
35
  runtimeTimeoutMs: 30000,
36
- shutdownDrainMs: 5000,
37
36
  trustProxy: false,
38
37
  ...overrides,
39
38
  } as GatewayConfig;
@@ -22,7 +22,6 @@ function makeConfig(overrides: Partial<GatewayConfig> = {}): GatewayConfig {
22
22
  runtimeMaxRetries: 2,
23
23
  runtimeProxyRequireAuth: false,
24
24
  runtimeTimeoutMs: 30000,
25
- shutdownDrainMs: 5000,
26
25
  trustProxy: false,
27
26
  ...overrides,
28
27
  } as GatewayConfig;
@@ -62,7 +62,6 @@ function makeConfig(): GatewayConfig {
62
62
  runtimeMaxRetries: 2,
63
63
  runtimeProxyRequireAuth: false,
64
64
  runtimeTimeoutMs: 30000,
65
- shutdownDrainMs: 5000,
66
65
  trustProxy: false,
67
66
  };
68
67
  }
@@ -121,7 +121,6 @@ function makeConfig(): GatewayConfig {
121
121
  runtimeMaxRetries: 2,
122
122
  runtimeProxyRequireAuth: false,
123
123
  runtimeTimeoutMs: 30000,
124
- shutdownDrainMs: 5000,
125
124
  trustProxy: false,
126
125
  };
127
126
  }
@@ -178,7 +178,6 @@ function makeGatewayConfig(): GatewayConfig {
178
178
  runtimeMaxRetries: 2,
179
179
  runtimeProxyRequireAuth: false,
180
180
  runtimeTimeoutMs: 30000,
181
- shutdownDrainMs: 5000,
182
181
  trustProxy: false,
183
182
  } as unknown as GatewayConfig;
184
183
  }
@@ -134,7 +134,6 @@ function makeConfig(): GatewayConfig {
134
134
  runtimeMaxRetries: 2,
135
135
  runtimeProxyRequireAuth: false,
136
136
  runtimeTimeoutMs: 30000,
137
- shutdownDrainMs: 5000,
138
137
  trustProxy: false,
139
138
  };
140
139
  }
@@ -121,7 +121,6 @@ function makeConfig(): GatewayConfig {
121
121
  runtimeMaxRetries: 2,
122
122
  runtimeProxyRequireAuth: false,
123
123
  runtimeTimeoutMs: 30000,
124
- shutdownDrainMs: 5000,
125
124
  trustProxy: false,
126
125
  };
127
126
  }
@@ -74,15 +74,15 @@ function makeKeyedCredentials(
74
74
  }
75
75
 
76
76
  describe("tunnel origin derivation", () => {
77
- // getPlatformBaseUrl falls back to this env var; pin it absent so the
77
+ // getCloudBaseUrl falls back to this env var; pin it absent so the
78
78
  // missing-credential cases below are deterministic on dev machines.
79
- const savedPlatformUrl = process.env.CADET_PLATFORM_URL;
79
+ const savedCloudUrl = process.env.CADET_CLOUD_URL;
80
80
  beforeAll(() => {
81
- delete process.env.CADET_PLATFORM_URL;
81
+ delete process.env.CADET_CLOUD_URL;
82
82
  });
83
83
  afterAll(() => {
84
- if (savedPlatformUrl !== undefined) {
85
- process.env.CADET_PLATFORM_URL = savedPlatformUrl;
84
+ if (savedCloudUrl !== undefined) {
85
+ process.env.CADET_CLOUD_URL = savedCloudUrl;
86
86
  }
87
87
  });
88
88
 
@@ -104,16 +104,15 @@ describe("tunnel origin derivation", () => {
104
104
  ).toBeNull();
105
105
  });
106
106
 
107
- test("derives the tunnel origin from the stored platform base URL when TUNNEL_BASE_URL is unset", async () => {
107
+ test("derives the tunnel origin from CADET_CLOUD_URL when TUNNEL_BASE_URL is unset", async () => {
108
108
  const server = makeFakeServer();
109
+ process.env.CADET_CLOUD_URL = "https://staging-cloud.mycadet.ai";
109
110
  const handler = createSpeechRelayUpgradeHandler(
110
111
  makeConfig({ tunnelBaseUrl: undefined }),
111
112
  "stt",
112
113
  {
113
114
  credentials: makeKeyedCredentials({
114
115
  "credential/cadet/assistant_api_key": "vk-1",
115
- "credential/cadet/platform_base_url":
116
- "https://staging-cloud.mycadet.ai",
117
116
  }),
118
117
  },
119
118
  );
@@ -133,19 +132,23 @@ describe("tunnel origin derivation", () => {
133
132
  });
134
133
 
135
134
  test("falls back to prod tunnel for an off-convention or missing platform base URL", async () => {
136
- for (const platformBaseUrl of [
135
+ for (const cloudBaseUrl of [
137
136
  "http://localhost:8000",
138
137
  "not a url",
139
138
  undefined,
140
139
  ]) {
141
140
  const server = makeFakeServer();
141
+ if (cloudBaseUrl === undefined) {
142
+ delete process.env.CADET_CLOUD_URL;
143
+ } else {
144
+ process.env.CADET_CLOUD_URL = cloudBaseUrl;
145
+ }
142
146
  const handler = createSpeechRelayUpgradeHandler(
143
147
  makeConfig({ tunnelBaseUrl: undefined }),
144
148
  "stt",
145
149
  {
146
150
  credentials: makeKeyedCredentials({
147
151
  "credential/cadet/assistant_api_key": "vk-1",
148
- "credential/cadet/platform_base_url": platformBaseUrl,
149
152
  }),
150
153
  },
151
154
  );
@@ -162,13 +165,12 @@ describe("tunnel origin derivation", () => {
162
165
  }
163
166
  });
164
167
 
165
- test("an explicit TUNNEL_BASE_URL wins over the stored platform base URL", async () => {
168
+ test("an explicit TUNNEL_BASE_URL wins over CADET_CLOUD_URL", async () => {
166
169
  const server = makeFakeServer();
170
+ process.env.CADET_CLOUD_URL = "https://staging-cloud.mycadet.ai";
167
171
  const handler = createSpeechRelayUpgradeHandler(makeConfig(), "stt", {
168
172
  credentials: makeKeyedCredentials({
169
173
  "credential/cadet/assistant_api_key": "vk-1",
170
- "credential/cadet/platform_base_url":
171
- "https://staging-cloud.mycadet.ai",
172
174
  }),
173
175
  });
174
176
  const req = new Request(
@@ -265,7 +267,7 @@ describe("createSpeechRelayUpgradeHandler — gate", () => {
265
267
  });
266
268
 
267
269
  test("forwards the tts voice model to tunnel", async () => {
268
- // Regression: the daemon sends the selected managed voice as `model`;
270
+ // Regression: the daemon sends the selected cloud voice as `model`;
269
271
  // a gateway that rejects it silently breaks voice selection (the
270
272
  // daemon's synthesis fails before tunnel ever sees the session).
271
273
  const server = makeFakeServer();
@@ -435,7 +435,7 @@ describe("dictation is not a guardian-only surface", () => {
435
435
  });
436
436
 
437
437
  /**
438
- * The managed path, where tunnel validated the browser's own token and
438
+ * The cloud path, where tunnel validated the browser's own token and
439
439
  * attested the caller to the bridge. There is no edge JWT on it, so requiring
440
440
  * one rejected every managed caller: the socket opened at tunnel and closed at
441
441
  * the loopback with an open failure, which the browser saw as a 1014.
@@ -449,7 +449,7 @@ describe("createSttStreamWebsocketHandler: tunnel-attested managed auth", () =>
449
449
  const TUNNEL_ORG_ID = "22222222-2222-2222-2222-222222222222";
450
450
 
451
451
  afterEach(() => {
452
- delete process.env.IS_PLATFORM;
452
+ delete process.env.IS_CLOUD;
453
453
  });
454
454
 
455
455
  const managedUpgrade = ({
@@ -466,9 +466,9 @@ describe("createSttStreamWebsocketHandler: tunnel-attested managed auth", () =>
466
466
  tunnelBaseUrl?: string;
467
467
  }) => {
468
468
  if (managed) {
469
- process.env.IS_PLATFORM = "true";
469
+ process.env.IS_CLOUD = "true";
470
470
  } else {
471
- delete process.env.IS_PLATFORM;
471
+ delete process.env.IS_CLOUD;
472
472
  }
473
473
  const headers = new Headers({
474
474
  upgrade: "websocket",
@@ -530,7 +530,7 @@ describe("createSttStreamWebsocketHandler: tunnel-attested managed auth", () =>
530
530
  expect(server.upgrade).not.toHaveBeenCalled();
531
531
  });
532
532
 
533
- /** A locally hosted gateway with a tunnel takes the tunnel path like a managed pod. */
533
+ /** A locally hosted gateway with a tunnel takes the tunnel path like a cloud pod. */
534
534
  test("admits an attested caller on a locally hosted gateway with a tunnel", () => {
535
535
  const { res, server } = managedUpgrade({
536
536
  managed: false,
@@ -26,7 +26,6 @@ function makeConfig(overrides: Partial<GatewayConfig> = {}): GatewayConfig {
26
26
  routingEntries: [],
27
27
  port: 7830,
28
28
  runtimeProxyRequireAuth: true,
29
- shutdownDrainMs: 5000,
30
29
  runtimeTimeoutMs: 30000,
31
30
  runtimeMaxRetries: 2,
32
31
  runtimeInitialBackoffMs: 500,
@@ -79,7 +79,6 @@ function makeConfig(): GatewayConfig {
79
79
  routingEntries: [],
80
80
  port: 7830,
81
81
  runtimeProxyRequireAuth: false,
82
- shutdownDrainMs: 5000,
83
82
  runtimeTimeoutMs: 30000,
84
83
  runtimeMaxRetries: 2,
85
84
  runtimeInitialBackoffMs: 500,
@@ -33,7 +33,6 @@ function makeConfig(overrides: Partial<GatewayConfig> = {}): GatewayConfig {
33
33
  routingEntries: [],
34
34
  port: 7830,
35
35
  runtimeProxyRequireAuth: false,
36
- shutdownDrainMs: 5000,
37
36
  runtimeTimeoutMs: 30000,
38
37
  runtimeMaxRetries: 2,
39
38
  runtimeInitialBackoffMs: 500,