rivetkit 2.0.36 → 2.0.38

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 (85) hide show
  1. package/dist/tsup/{chunk-UDKWYSU3.js → chunk-4U45T5KW.js} +6 -4
  2. package/dist/tsup/chunk-4U45T5KW.js.map +1 -0
  3. package/dist/tsup/{chunk-OYJU4B2I.cjs → chunk-6WLJW57U.cjs} +170 -95
  4. package/dist/tsup/chunk-6WLJW57U.cjs.map +1 -0
  5. package/dist/tsup/{chunk-DSPZ7BZN.js → chunk-EEL32AJM.js} +145 -94
  6. package/dist/tsup/chunk-EEL32AJM.js.map +1 -0
  7. package/dist/tsup/{chunk-EO5JABFU.js → chunk-FA6FGAEC.js} +83 -8
  8. package/dist/tsup/chunk-FA6FGAEC.js.map +1 -0
  9. package/dist/tsup/{chunk-65O3MUPO.cjs → chunk-FZQHTGQX.cjs} +9 -9
  10. package/dist/tsup/{chunk-65O3MUPO.cjs.map → chunk-FZQHTGQX.cjs.map} +1 -1
  11. package/dist/tsup/{chunk-VIUUUBXQ.cjs → chunk-GFKZZG2A.cjs} +3 -3
  12. package/dist/tsup/{chunk-VIUUUBXQ.cjs.map → chunk-GFKZZG2A.cjs.map} +1 -1
  13. package/dist/tsup/{chunk-7EGXCVJL.cjs → chunk-IRTVRBJA.cjs} +46 -46
  14. package/dist/tsup/{chunk-7EGXCVJL.cjs.map → chunk-IRTVRBJA.cjs.map} +1 -1
  15. package/dist/tsup/{chunk-6TLJAB64.cjs → chunk-IWXMFQDT.cjs} +115 -76
  16. package/dist/tsup/chunk-IWXMFQDT.cjs.map +1 -0
  17. package/dist/tsup/{chunk-Z5CSXFVY.js → chunk-K2RNF2ZR.js} +5 -5
  18. package/dist/tsup/{chunk-RTSLQIZ5.cjs → chunk-LULP6HM2.cjs} +386 -335
  19. package/dist/tsup/chunk-LULP6HM2.cjs.map +1 -0
  20. package/dist/tsup/{chunk-KJLJLNHR.js → chunk-MIOU6BF3.js} +59 -20
  21. package/dist/tsup/chunk-MIOU6BF3.js.map +1 -0
  22. package/dist/tsup/{chunk-WRYYREBN.cjs → chunk-O433HWWG.cjs} +6 -4
  23. package/dist/tsup/chunk-O433HWWG.cjs.map +1 -0
  24. package/dist/tsup/{chunk-X5GKJWTG.js → chunk-UUEZVDRL.js} +4 -4
  25. package/dist/tsup/{chunk-D35UUQOR.js → chunk-WIZ4JGP6.js} +2 -2
  26. package/dist/tsup/client/mod.cjs +5 -5
  27. package/dist/tsup/client/mod.d.cts +2 -2
  28. package/dist/tsup/client/mod.d.ts +2 -2
  29. package/dist/tsup/client/mod.js +4 -4
  30. package/dist/tsup/common/log.cjs +2 -2
  31. package/dist/tsup/common/log.js +1 -1
  32. package/dist/tsup/common/websocket.cjs +3 -3
  33. package/dist/tsup/common/websocket.js +2 -2
  34. package/dist/tsup/{config-CRuzI6n4.d.ts → config-CbIHPGKl.d.ts} +167 -56
  35. package/dist/tsup/{config--NjwiYlS.d.cts → config-CwJCQyP1.d.cts} +167 -56
  36. package/dist/tsup/{driver-BcmckRaF.d.ts → driver-CMN823Lc.d.ts} +1 -1
  37. package/dist/tsup/{driver-yKjYx9Yy.d.cts → driver-Lw_oORox.d.cts} +1 -1
  38. package/dist/tsup/driver-helpers/mod.cjs +3 -3
  39. package/dist/tsup/driver-helpers/mod.d.cts +2 -2
  40. package/dist/tsup/driver-helpers/mod.d.ts +2 -2
  41. package/dist/tsup/driver-helpers/mod.js +2 -2
  42. package/dist/tsup/driver-test-suite/mod.cjs +34 -34
  43. package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
  44. package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
  45. package/dist/tsup/driver-test-suite/mod.js +7 -7
  46. package/dist/tsup/mod.cjs +17 -7
  47. package/dist/tsup/mod.cjs.map +1 -1
  48. package/dist/tsup/mod.d.cts +4 -4
  49. package/dist/tsup/mod.d.ts +4 -4
  50. package/dist/tsup/mod.js +16 -6
  51. package/dist/tsup/test/mod.cjs +7 -7
  52. package/dist/tsup/test/mod.d.cts +1 -1
  53. package/dist/tsup/test/mod.d.ts +1 -1
  54. package/dist/tsup/test/mod.js +6 -6
  55. package/dist/tsup/utils.cjs +2 -2
  56. package/dist/tsup/utils.js +1 -1
  57. package/package.json +7 -5
  58. package/src/actor/config.ts +47 -0
  59. package/src/client/actor-conn.ts +70 -81
  60. package/src/client/actor-handle.ts +22 -12
  61. package/src/client/actor-query.ts +47 -0
  62. package/src/client/config.ts +6 -4
  63. package/src/client/errors.ts +22 -58
  64. package/src/client/utils.ts +33 -0
  65. package/src/engine-process/constants.ts +1 -1
  66. package/src/engine-process/mod.ts +1 -1
  67. package/src/inspector/utils.ts +1 -1
  68. package/src/manager/driver.ts +1 -3
  69. package/src/manager-api/actors.ts +1 -20
  70. package/src/registry/config/index.ts +71 -3
  71. package/src/remote-manager-driver/mod.ts +11 -1
  72. package/src/serverless/router.test.ts +299 -0
  73. package/src/serverless/router.ts +93 -1
  74. package/src/utils/env-vars.ts +4 -1
  75. package/dist/tsup/chunk-6TLJAB64.cjs.map +0 -1
  76. package/dist/tsup/chunk-DSPZ7BZN.js.map +0 -1
  77. package/dist/tsup/chunk-EO5JABFU.js.map +0 -1
  78. package/dist/tsup/chunk-KJLJLNHR.js.map +0 -1
  79. package/dist/tsup/chunk-OYJU4B2I.cjs.map +0 -1
  80. package/dist/tsup/chunk-RTSLQIZ5.cjs.map +0 -1
  81. package/dist/tsup/chunk-UDKWYSU3.js.map +0 -1
  82. package/dist/tsup/chunk-WRYYREBN.cjs.map +0 -1
  83. /package/dist/tsup/{chunk-Z5CSXFVY.js.map → chunk-K2RNF2ZR.js.map} +0 -0
  84. /package/dist/tsup/{chunk-X5GKJWTG.js.map → chunk-UUEZVDRL.js.map} +0 -0
  85. /package/dist/tsup/{chunk-D35UUQOR.js.map → chunk-WIZ4JGP6.js.map} +0 -0
@@ -1,7 +1,9 @@
1
1
  import type { Context as HonoContext } from "hono";
2
2
  import * as errors from "@/actor/errors";
3
+ import { stringifyError } from "@/common/utils";
3
4
  import type { ManagerDriver } from "@/driver-helpers/mod";
4
5
  import type { ActorQuery } from "@/manager/protocol/query";
6
+ import { ActorSchedulingError } from "./errors";
5
7
  import { logger } from "./log";
6
8
 
7
9
  /**
@@ -63,3 +65,48 @@ export async function queryActor(
63
65
  logger().debug({ msg: "actor query result", actorId: actorOutput.actorId });
64
66
  return { actorId: actorOutput.actorId };
65
67
  }
68
+
69
+ /**
70
+ * Extract the actor name from a query.
71
+ */
72
+ export function getActorNameFromQuery(query: ActorQuery): string {
73
+ if ("getForId" in query) return query.getForId.name;
74
+ if ("getForKey" in query) return query.getForKey.name;
75
+ if ("getOrCreateForKey" in query) return query.getOrCreateForKey.name;
76
+ if ("create" in query) return query.create.name;
77
+ throw new errors.InvalidRequest("Invalid query format");
78
+ }
79
+
80
+ /**
81
+ * Fetch actor details and check for scheduling errors.
82
+ */
83
+ export async function checkForSchedulingError(
84
+ group: string,
85
+ code: string,
86
+ actorId: string,
87
+ query: ActorQuery,
88
+ driver: ManagerDriver,
89
+ ): Promise<ActorSchedulingError | null> {
90
+ const name = getActorNameFromQuery(query);
91
+
92
+ try {
93
+ const actor = await driver.getForId({ name, actorId });
94
+
95
+ if (actor?.error) {
96
+ logger().info({
97
+ msg: "found actor scheduling error",
98
+ actorId,
99
+ error: actor.error,
100
+ });
101
+ return new ActorSchedulingError(group, code, actorId, actor.error);
102
+ }
103
+ } catch (err) {
104
+ logger().warn({
105
+ msg: "failed to fetch actor details for scheduling error check",
106
+ actorId,
107
+ error: stringifyError(err),
108
+ });
109
+ }
110
+
111
+ return null;
112
+ }
@@ -16,7 +16,7 @@ import { tryParseEndpoint } from "@/utils/endpoint-parser";
16
16
  *
17
17
  * In browser: uses current origin + /api/rivet
18
18
  *
19
- * Server-side: uses localhost:6420
19
+ * Server-side: uses 127.0.0.1:6420
20
20
  */
21
21
  function getDefaultEndpoint(): string {
22
22
  if (typeof window !== "undefined" && window.location?.origin) {
@@ -38,7 +38,7 @@ export const ClientConfigSchemaBase = z.object({
38
38
  *
39
39
  * Can also be set via RIVET_ENDPOINT environment variables.
40
40
  *
41
- * Defaults to current origin + /api/rivet in browser, or localhost:6420 server-side.
41
+ * Defaults to current origin + /api/rivet in browser, or 127.0.0.1:6420 server-side.
42
42
  */
43
43
  endpoint: z
44
44
  .string()
@@ -88,7 +88,8 @@ export const ClientConfigSchemaBase = z.object({
88
88
  .default(
89
89
  () =>
90
90
  typeof window !== "undefined" &&
91
- window?.location?.hostname === "localhost",
91
+ (window?.location?.hostname === "127.0.0.1" ||
92
+ window.location?.hostname === "localhost"),
92
93
  ),
93
94
  });
94
95
 
@@ -144,6 +145,7 @@ export function convertRegistryConfigToClientConfig(
144
145
  disableMetadataLookup: true,
145
146
  devtools:
146
147
  typeof window !== "undefined" &&
147
- window?.location?.hostname === "localhost",
148
+ (window?.location?.hostname === "127.0.0.1" ||
149
+ window?.location?.hostname === "localhost"),
148
150
  };
149
151
  }
@@ -1,5 +1,3 @@
1
- import { MAX_CONN_PARAMS_SIZE } from "@/common//network";
2
-
3
1
  export class ActorClientError extends Error {}
4
2
 
5
3
  export class InternalError extends ActorClientError {}
@@ -41,72 +39,38 @@ export class ActorConnDisposed extends ActorClientError {
41
39
  }
42
40
  }
43
41
 
44
- // === Actor Scheduling Error Types ===
45
-
46
- /**
47
- * Errors from serverless connection workflow.
48
- * Matches ServerlessConnectionError from API.
49
- */
50
- export type ServerlessConnectionError =
51
- | { http_error: { status_code: number; body: string } }
52
- | "stream_ended_early"
53
- | { connection_error: { message: string } }
54
- | "invalid_base64"
55
- | { invalid_payload: { message: string } }
56
- | "runner_config_not_found"
57
- | "runner_config_not_serverless"
58
- | "namespace_not_found";
59
-
60
42
  /**
61
- * Actor error details from API response.
62
- * Matches ActorError from API.
43
+ * Checks if an error code indicates a scheduling error that may have more details.
63
44
  */
64
- export type ActorErrorDetails =
65
- | { serverless_error: ServerlessConnectionError }
66
- | { no_capacity: { runner_name: string } }
67
- | { runner_no_response: { runner_id: string } };
45
+ export function isSchedulingError(group: string, code: string): boolean {
46
+ return (
47
+ group === "guard" &&
48
+ (code === "actor_ready_timeout" || code === "actor_runner_failed")
49
+ );
50
+ }
68
51
 
69
52
  /**
70
53
  * Error thrown when actor scheduling fails.
71
54
  * Provides detailed information about why the actor failed to start.
72
55
  */
73
- export class ActorSchedulingError extends ActorClientError {
56
+ export class ActorSchedulingError extends ActorError {
74
57
  public readonly actorId: string;
75
- public readonly errorType: string;
76
- public readonly details: ActorErrorDetails;
58
+ public readonly details: unknown;
77
59
 
78
- constructor(actorId: string, error: ActorErrorDetails) {
79
- const message = ActorSchedulingError.formatMessage(error);
80
- super(message);
60
+ constructor(
61
+ group: string,
62
+ code: string,
63
+ actorId: string,
64
+ details: unknown,
65
+ ) {
66
+ super(
67
+ group,
68
+ code,
69
+ `Actor failed to start (${actorId}): ${JSON.stringify(details)}`,
70
+ { actorId, details },
71
+ );
81
72
  this.name = "ActorSchedulingError";
82
73
  this.actorId = actorId;
83
- this.errorType = Object.keys(error)[0];
84
- this.details = error;
85
- }
86
-
87
- static formatMessage(error: ActorErrorDetails): string {
88
- if ("serverless_error" in error) {
89
- const se = error.serverless_error;
90
- if (typeof se === "string") {
91
- return `Serverless error: ${se.replace(/_/g, " ")}`;
92
- }
93
- if ("http_error" in se) {
94
- return `Serverless HTTP ${se.http_error.status_code}: ${se.http_error.body}`;
95
- }
96
- if ("connection_error" in se) {
97
- return `Serverless connection error: ${se.connection_error.message}`;
98
- }
99
- if ("invalid_payload" in se) {
100
- return `Invalid serverless payload: ${se.invalid_payload.message}`;
101
- }
102
- return "Unknown serverless error";
103
- }
104
- if ("no_capacity" in error) {
105
- return `No capacity available for runner: ${error.no_capacity.runner_name}`;
106
- }
107
- if ("runner_no_response" in error) {
108
- return `Runner ${error.runner_no_response.runner_id} did not respond`;
109
- }
110
- return "Unknown scheduling error";
74
+ this.details = details;
111
75
  }
112
76
  }
@@ -20,6 +20,39 @@ import { httpUserAgent } from "@/utils";
20
20
  import { ActorError, HttpRequestError } from "./errors";
21
21
  import { logger } from "./log";
22
22
 
23
+ export interface ParsedCloseReason {
24
+ group: string;
25
+ code: string;
26
+ rayId?: string;
27
+ }
28
+
29
+ /**
30
+ * Parses WebSocket close reason string into structured data.
31
+ *
32
+ * Expected format examples:
33
+ * - "guard.actor_runner_failed#t1s80so6h3irenp8ymzltfoittcl00"
34
+ * - "ws.client_closed"
35
+ *
36
+ * Returns undefined if the format is invalid
37
+ */
38
+ export function parseWebSocketCloseReason(
39
+ reason: string,
40
+ ): ParsedCloseReason | undefined {
41
+ const [mainPart, rayId] = reason.split("#");
42
+ const [group, code] = mainPart.split(".");
43
+
44
+ if (!group || !code) {
45
+ logger().warn({ msg: "failed to parse close reason", reason });
46
+ return undefined;
47
+ }
48
+
49
+ return {
50
+ group,
51
+ code,
52
+ rayId,
53
+ };
54
+ }
55
+
23
56
  export type WebSocketMessage = string | Blob | ArrayBuffer | Uint8Array;
24
57
 
25
58
  export function messageLength(message: WebSocketMessage): number {
@@ -1,2 +1,2 @@
1
1
  export const ENGINE_PORT = 6420;
2
- export const ENGINE_ENDPOINT = `http://localhost:${ENGINE_PORT}`;
2
+ export const ENGINE_ENDPOINT = `http://127.0.0.1:${ENGINE_PORT}`;
@@ -308,7 +308,7 @@ async function checkIfEngineAlreadyRunningOnPort(
308
308
  ): Promise<boolean> {
309
309
  let response: Response;
310
310
  try {
311
- response = await fetch(`http://localhost:${port}/health`);
311
+ response = await fetch(`http://127.0.0.1:${port}/health`);
312
312
  } catch (err) {
313
313
  // Nothing is running on this port
314
314
  return false;
@@ -56,7 +56,7 @@ export function getInspectorUrl(
56
56
  const endpoint =
57
57
  config.inspector.defaultEndpoint ??
58
58
  (config.managerPort !== 6420
59
- ? `http://localhost:${managerPort}`
59
+ ? `http://127.0.0.1:${managerPort}`
60
60
  : undefined);
61
61
  if (endpoint) {
62
62
  url.searchParams.set("u", endpoint);
@@ -1,7 +1,5 @@
1
1
  import type { Env, Hono, Context as HonoContext } from "hono";
2
2
  import type { ActorKey, Encoding, UniversalWebSocket } from "@/actor/mod";
3
-
4
- import type { ActorErrorDetails } from "@/client/errors";
5
3
  import type { RegistryConfig } from "@/registry/config";
6
4
  import type { GetUpgradeWebSocket } from "@/utils";
7
5
 
@@ -97,5 +95,5 @@ export interface ActorOutput {
97
95
  connectableTs?: number | null;
98
96
  sleepTs?: number | null;
99
97
  destroyTs?: number | null;
100
- error?: ActorErrorDetails | null;
98
+ error?: unknown;
101
99
  }
@@ -1,25 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { RivetIdSchema } from "./common";
3
3
 
4
- // Schema for serverless connection errors
5
- const ServerlessConnectionErrorSchema = z.union([
6
- z.object({ http_error: z.object({ status_code: z.number(), body: z.string() }) }),
7
- z.literal("stream_ended_early"),
8
- z.object({ connection_error: z.object({ message: z.string() }) }),
9
- z.literal("invalid_base64"),
10
- z.object({ invalid_payload: z.object({ message: z.string() }) }),
11
- z.literal("runner_config_not_found"),
12
- z.literal("runner_config_not_serverless"),
13
- z.literal("namespace_not_found"),
14
- ]);
15
-
16
- // Schema for actor error details from API
17
- const ActorErrorDetailsSchema = z.union([
18
- z.object({ serverless_error: ServerlessConnectionErrorSchema }),
19
- z.object({ no_capacity: z.object({ runner_name: z.string() }) }),
20
- z.object({ runner_no_response: z.object({ runner_id: z.string() }) }),
21
- ]);
22
-
23
4
  export const ActorSchema = z.object({
24
5
  actor_id: RivetIdSchema,
25
6
  name: z.string(),
@@ -31,7 +12,7 @@ export const ActorSchema = z.object({
31
12
  destroy_ts: z.number().nullable().optional(),
32
13
  sleep_ts: z.number().nullable().optional(),
33
14
  start_ts: z.number().nullable().optional(),
34
- error: ActorErrorDetailsSchema.nullable().optional(),
15
+ error: z.unknown().nullable().optional(),
35
16
  });
36
17
  export type Actor = z.infer<typeof ActorSchema>;
37
18
 
@@ -213,11 +213,11 @@ export const RegistryConfigSchema = z
213
213
  // Determine serveManager: default to true in dev mode without endpoint, false otherwise
214
214
  const serveManager = config.serveManager ?? (isDevEnv && !endpoint);
215
215
 
216
- // In dev mode, fall back to localhost if serving manager
216
+ // In dev mode, fall back to 127.0.0.1 if serving manager
217
217
  const publicEndpoint =
218
218
  parsedPublicEndpoint?.endpoint ??
219
- (isDevEnv && serveManager
220
- ? `http://localhost:${config.managerPort}`
219
+ (isDevEnv && (serveManager || config.serverless.spawnEngine)
220
+ ? `http://127.0.0.1:${config.managerPort}`
221
221
  : undefined);
222
222
  // We extract publicNamespace to validate that it matches the backend
223
223
  // namespace (see validation above), not for functional use.
@@ -264,3 +264,71 @@ export function buildActorNames(
264
264
  Object.keys(config.use).map((name) => [name, { metadata: {} }]),
265
265
  );
266
266
  }
267
+
268
+ // MARK: Documentation Schemas
269
+ // These schemas are JSON-serializable versions used for documentation generation.
270
+ // They exclude runtime-only fields (transforms, custom types, Logger instances).
271
+
272
+ export const DocInspectorConfigSchema = z
273
+ .object({
274
+ enabled: z.boolean().optional().describe("Whether to enable the Rivet Inspector. Defaults to true in development mode."),
275
+ token: z.string().optional().describe("Token used to access the Inspector."),
276
+ defaultEndpoint: z.string().optional().describe("Default RivetKit server endpoint for Rivet Inspector to connect to."),
277
+ })
278
+ .optional()
279
+ .describe("Inspector configuration for debugging and development.");
280
+
281
+ export const DocConfigureRunnerPoolSchema = z
282
+ .object({
283
+ name: z.string().optional().describe("Name of the runner pool."),
284
+ url: z.string().describe("URL of the serverless platform to configure runners."),
285
+ headers: z.record(z.string(), z.string()).optional().describe("Headers to include in requests to the serverless platform."),
286
+ maxRunners: z.number().optional().describe("Maximum number of runners in the pool."),
287
+ minRunners: z.number().optional().describe("Minimum number of runners to keep warm."),
288
+ requestLifespan: z.number().optional().describe("Maximum lifespan of a request in milliseconds."),
289
+ runnersMargin: z.number().optional().describe("Buffer margin for scaling runners."),
290
+ slotsPerRunner: z.number().optional().describe("Number of actor slots per runner."),
291
+ metadata: z.record(z.string(), z.unknown()).optional().describe("Additional metadata to pass to the serverless platform."),
292
+ })
293
+ .optional();
294
+
295
+ export const DocServerlessConfigSchema = z.object({
296
+ spawnEngine: z.boolean().optional().describe("Downloads and starts the full Rust engine process. Auto-enabled in development mode when no endpoint is provided. Default: false"),
297
+ engineVersion: z.string().optional().describe("Version of the engine to download. Defaults to the current RivetKit version."),
298
+ configureRunnerPool: DocConfigureRunnerPoolSchema.describe("Automatically configure serverless runners in the engine."),
299
+ basePath: z.string().optional().describe("Base path for serverless API routes. Default: '/api/rivet'"),
300
+ publicEndpoint: z.string().optional().describe("The endpoint that clients should connect to. Supports URL auth syntax: https://namespace:token@api.rivet.dev"),
301
+ publicToken: z.string().optional().describe("Token that clients should use when connecting via the public endpoint."),
302
+ }).describe("Configuration for serverless deployment mode.");
303
+
304
+ export const DocRunnerConfigSchema = z.object({
305
+ totalSlots: z.number().optional().describe("Total number of actor slots available. Default: 100000"),
306
+ runnerName: z.string().optional().describe("Name of this runner. Default: 'default'"),
307
+ runnerKey: z.string().optional().describe("Authentication key for the runner."),
308
+ version: z.number().optional().describe("Version number of this runner. Default: 1"),
309
+ }).describe("Configuration for runner mode.");
310
+
311
+ export const DocRegistryConfigSchema = z
312
+ .object({
313
+ use: z.record(z.string(), z.unknown()).describe("Actor definitions. Keys are actor names, values are actor definitions."),
314
+ maxIncomingMessageSize: z.number().optional().describe("Maximum size of incoming WebSocket messages in bytes. Default: 65536"),
315
+ maxOutgoingMessageSize: z.number().optional().describe("Maximum size of outgoing WebSocket messages in bytes. Default: 1048576"),
316
+ noWelcome: z.boolean().optional().describe("Disable the welcome message on startup. Default: false"),
317
+ logging: z
318
+ .object({
319
+ level: LogLevelSchema.optional().describe("Log level for RivetKit. Default: 'warn'"),
320
+ })
321
+ .optional()
322
+ .describe("Logging configuration."),
323
+ endpoint: z.string().optional().describe("Endpoint URL to connect to Rivet Engine. Supports URL auth syntax: https://namespace:token@api.rivet.dev. Can also be set via RIVET_ENDPOINT environment variable."),
324
+ token: z.string().optional().describe("Authentication token for Rivet Engine. Can also be set via RIVET_TOKEN environment variable."),
325
+ namespace: z.string().optional().describe("Namespace to use. Default: 'default'. Can also be set via RIVET_NAMESPACE environment variable."),
326
+ headers: z.record(z.string(), z.string()).optional().describe("Additional headers to include in requests to Rivet Engine."),
327
+ serveManager: z.boolean().optional().describe("Whether to start the local manager server. Auto-determined based on endpoint and NODE_ENV if not specified."),
328
+ managerBasePath: z.string().optional().describe("Base path for the manager API. Default: '/'"),
329
+ managerPort: z.number().optional().describe("Port to run the manager on. Default: 6420"),
330
+ inspector: DocInspectorConfigSchema,
331
+ serverless: DocServerlessConfigSchema.optional(),
332
+ runner: DocRunnerConfigSchema.optional(),
333
+ })
334
+ .describe("RivetKit registry configuration.");
@@ -81,9 +81,19 @@ export class RemoteManagerDriver implements ManagerDriver {
81
81
  // Override endpoint for all future requests
82
82
  if (metadataData.clientEndpoint) {
83
83
  this.#config.endpoint = metadataData.clientEndpoint;
84
+ if (metadataData.clientNamespace) {
85
+ this.#config.namespace =
86
+ metadataData.clientNamespace;
87
+ }
88
+ if (metadataData.clientToken) {
89
+ this.#config.token = metadataData.clientToken;
90
+ }
91
+
84
92
  logger().info({
85
- msg: "overriding cached client endpoint",
93
+ msg: "overriding client endpoint",
86
94
  endpoint: metadataData.clientEndpoint,
95
+ namespace: metadataData.clientNamespace,
96
+ token: metadataData.clientToken,
87
97
  });
88
98
  }
89
99