rivetkit 2.3.0-rc.8 → 2.3.0-rc.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 (122) hide show
  1. package/dist/browser/client.d.ts +8 -37
  2. package/dist/browser/client.js +34 -64
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +3 -4
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/actor/errors.cjs +2 -2
  7. package/dist/tsup/actor/errors.js +1 -1
  8. package/dist/tsup/agent-os/index.cjs +5 -7
  9. package/dist/tsup/agent-os/index.cjs.map +1 -1
  10. package/dist/tsup/agent-os/index.d.cts +5 -26
  11. package/dist/tsup/agent-os/index.d.ts +5 -26
  12. package/dist/tsup/agent-os/index.js +5 -7
  13. package/dist/tsup/agent-os/index.js.map +1 -1
  14. package/dist/tsup/{chunk-OT7FF6GB.cjs → chunk-4CGA6QJO.cjs} +4 -4
  15. package/dist/tsup/{chunk-OT7FF6GB.cjs.map → chunk-4CGA6QJO.cjs.map} +1 -1
  16. package/dist/tsup/{chunk-4BPKKZJO.cjs → chunk-4WPEZBK4.cjs} +8 -8
  17. package/dist/tsup/{chunk-4BPKKZJO.cjs.map → chunk-4WPEZBK4.cjs.map} +1 -1
  18. package/dist/tsup/{chunk-AWTPTUQ7.cjs → chunk-CPA4Y3RG.cjs} +10 -10
  19. package/dist/tsup/chunk-CPA4Y3RG.cjs.map +1 -0
  20. package/dist/tsup/{chunk-EMFKMVJR.js → chunk-F3Q5BFQ6.js} +34 -10
  21. package/dist/tsup/chunk-F3Q5BFQ6.js.map +1 -0
  22. package/dist/tsup/{chunk-7HLFSAJP.cjs → chunk-GVTOE34S.cjs} +193 -169
  23. package/dist/tsup/chunk-GVTOE34S.cjs.map +1 -0
  24. package/dist/tsup/{chunk-D3T3ZBSY.js → chunk-H37XQU3I.js} +2 -2
  25. package/dist/tsup/{chunk-4JU3IPG2.js → chunk-H7P7WR2Y.js} +3 -3
  26. package/dist/tsup/{chunk-TMLOKTRB.js → chunk-KIWH5H3K.js} +3 -3
  27. package/dist/tsup/chunk-KIWH5H3K.js.map +1 -0
  28. package/dist/tsup/{chunk-VUGENVIK.js → chunk-KJTA3ATT.js} +2 -2
  29. package/dist/tsup/{chunk-6TQSSJ4F.cjs → chunk-MALSPBAF.cjs} +3 -3
  30. package/dist/tsup/{chunk-6TQSSJ4F.cjs.map → chunk-MALSPBAF.cjs.map} +1 -1
  31. package/dist/tsup/{chunk-UZXQEGVJ.js → chunk-MMMEZM5J.js} +4 -4
  32. package/dist/tsup/chunk-MMMEZM5J.js.map +1 -0
  33. package/dist/tsup/{chunk-63WNTDRC.cjs → chunk-QAZLM4WT.cjs} +3 -3
  34. package/dist/tsup/{chunk-63WNTDRC.cjs.map → chunk-QAZLM4WT.cjs.map} +1 -1
  35. package/dist/tsup/{chunk-D5G75T7J.js → chunk-T6YVRM4K.js} +1 -3
  36. package/dist/tsup/chunk-T6YVRM4K.js.map +1 -0
  37. package/dist/tsup/{chunk-HGW6PBWR.cjs → chunk-VJFRBJVQ.cjs} +9 -137
  38. package/dist/tsup/chunk-VJFRBJVQ.cjs.map +1 -0
  39. package/dist/tsup/{chunk-GBG63SUG.js → chunk-VRCIXJRN.js} +5 -7
  40. package/dist/tsup/chunk-VRCIXJRN.js.map +1 -0
  41. package/dist/tsup/{chunk-KY3CERZR.js → chunk-W7EYSYVI.js} +4 -132
  42. package/dist/tsup/chunk-W7EYSYVI.js.map +1 -0
  43. package/dist/tsup/{chunk-SRNOPUC6.cjs → chunk-WQ4HNA4W.cjs} +2 -4
  44. package/dist/tsup/chunk-WQ4HNA4W.cjs.map +1 -0
  45. package/dist/tsup/{chunk-BATTOVHF.cjs → chunk-Y5NSCZA2.cjs} +12 -14
  46. package/dist/tsup/chunk-Y5NSCZA2.cjs.map +1 -0
  47. package/dist/tsup/client/mod.cjs +7 -7
  48. package/dist/tsup/client/mod.d.cts +2 -2
  49. package/dist/tsup/client/mod.d.ts +2 -2
  50. package/dist/tsup/client/mod.js +6 -6
  51. package/dist/tsup/common/log.cjs +3 -3
  52. package/dist/tsup/common/log.js +2 -2
  53. package/dist/tsup/common/websocket.cjs +4 -4
  54. package/dist/tsup/common/websocket.js +3 -3
  55. package/dist/tsup/{config-Ak1lv4gF.d.ts → config-0Ta55UV0.d.ts} +6 -27
  56. package/dist/tsup/{config-DU_xj4qZ.d.cts → config-Ca8dN4cS.d.cts} +6 -27
  57. package/dist/tsup/{context-DAAp4Lpg.d.ts → context-B_IWbWne.d.ts} +1 -1
  58. package/dist/tsup/{context-Dt_L55q8.d.cts → context-CUrQ9MHc.d.cts} +1 -1
  59. package/dist/tsup/inspector/mod.cjs +6 -6
  60. package/dist/tsup/inspector/mod.js +5 -5
  61. package/dist/tsup/mod.cjs +355 -482
  62. package/dist/tsup/mod.cjs.map +1 -1
  63. package/dist/tsup/mod.d.cts +3 -3
  64. package/dist/tsup/mod.d.ts +3 -3
  65. package/dist/tsup/mod.js +276 -403
  66. package/dist/tsup/mod.js.map +1 -1
  67. package/dist/tsup/test/mod.cjs +10 -10
  68. package/dist/tsup/test/mod.d.cts +1 -1
  69. package/dist/tsup/test/mod.d.ts +1 -1
  70. package/dist/tsup/test/mod.js +6 -6
  71. package/dist/tsup/utils.cjs +3 -3
  72. package/dist/tsup/utils.js +2 -2
  73. package/dist/tsup/workflow/mod.cjs +16 -41
  74. package/dist/tsup/workflow/mod.cjs.map +1 -1
  75. package/dist/tsup/workflow/mod.d.cts +3 -3
  76. package/dist/tsup/workflow/mod.d.ts +3 -3
  77. package/dist/tsup/workflow/mod.js +10 -35
  78. package/dist/tsup/workflow/mod.js.map +1 -1
  79. package/package.json +10 -11
  80. package/src/actor/config.ts +0 -3
  81. package/src/actor/errors.ts +2 -2
  82. package/src/agent-os/actor/session.ts +2 -2
  83. package/src/client/actor-conn.ts +34 -6
  84. package/src/client/actor-handle.ts +1 -2
  85. package/src/client/queue.ts +1 -2
  86. package/src/client/utils.ts +1 -0
  87. package/src/common/encoding.ts +5 -243
  88. package/src/common/inline-websocket-adapter.ts +12 -12
  89. package/src/common/log.ts +0 -1
  90. package/src/common/router.ts +2 -2
  91. package/src/common/utils.ts +148 -0
  92. package/src/drivers/engine/actor-driver.ts +11 -11
  93. package/src/engine-client/actor-websocket-client.ts +1 -2
  94. package/src/engine-client/mod.ts +2 -3
  95. package/src/registry/index.ts +109 -46
  96. package/src/registry/napi-runtime.ts +34 -11
  97. package/src/registry/native.ts +162 -205
  98. package/src/registry/runtime.ts +12 -5
  99. package/src/registry/wasm-runtime.ts +13 -2
  100. package/src/serde.ts +2 -2
  101. package/src/workflow/context.ts +5 -32
  102. package/src/workflow/inspector.ts +1 -2
  103. package/dist/tsup/chunk-7HLFSAJP.cjs.map +0 -1
  104. package/dist/tsup/chunk-AWTPTUQ7.cjs.map +0 -1
  105. package/dist/tsup/chunk-BATTOVHF.cjs.map +0 -1
  106. package/dist/tsup/chunk-D5G75T7J.js.map +0 -1
  107. package/dist/tsup/chunk-EMFKMVJR.js.map +0 -1
  108. package/dist/tsup/chunk-GBG63SUG.js.map +0 -1
  109. package/dist/tsup/chunk-HGW6PBWR.cjs.map +0 -1
  110. package/dist/tsup/chunk-KY3CERZR.js.map +0 -1
  111. package/dist/tsup/chunk-SRNOPUC6.cjs.map +0 -1
  112. package/dist/tsup/chunk-TMLOKTRB.js.map +0 -1
  113. package/dist/tsup/chunk-UZXQEGVJ.js.map +0 -1
  114. package/dist/tsup/process-metrics-NW754INA.js +0 -118
  115. package/dist/tsup/process-metrics-NW754INA.js.map +0 -1
  116. package/dist/tsup/process-metrics-TYAGKCEJ.cjs +0 -118
  117. package/dist/tsup/process-metrics-TYAGKCEJ.cjs.map +0 -1
  118. package/src/registry/process-metrics.ts +0 -183
  119. package/src/registry/write-through-proxy.ts +0 -40
  120. /package/dist/tsup/{chunk-D3T3ZBSY.js.map → chunk-H37XQU3I.js.map} +0 -0
  121. /package/dist/tsup/{chunk-4JU3IPG2.js.map → chunk-H7P7WR2Y.js.map} +0 -0
  122. /package/dist/tsup/{chunk-VUGENVIK.js.map → chunk-KJTA3ATT.js.map} +0 -0
@@ -929,7 +929,6 @@ type Client<A extends Registry<any>> = ClientRaw & {
929
929
  };
930
930
 
931
931
  declare const ACTOR_CONTEXT_INTERNAL_SYMBOL: unique symbol;
932
- declare const RAW_STATE_SYMBOL: unique symbol;
933
932
  interface ActorLogger {
934
933
  level: any;
935
934
  fatal: any;
@@ -1049,8 +1048,6 @@ interface Conn<TState = unknown, TConnParams = unknown, TConnState = unknown, TV
1049
1048
  }
1050
1049
  interface ActorContext<TState, TConnParams, TConnState, TVars, TInput, TDatabase extends AnyDatabaseProvider, TEvents extends EventSchemaConfig = Record<never, never>, TQueues extends QueueSchemaConfig = Record<never, never>> {
1051
1050
  [ACTOR_CONTEXT_INTERNAL_SYMBOL]?: unknown;
1052
- /** Returns the raw unwrapped state without the write-through proxy. */
1053
- [RAW_STATE_SYMBOL](): TState;
1054
1051
  state: TState;
1055
1052
  vars: TVars;
1056
1053
  readonly kv: ActorKv;
@@ -1409,11 +1406,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
1409
1406
  }>>, z$2.ZodTransform<"auto" | "native" | "wasm", "auto" | "native" | "wasm" | undefined>>;
1410
1407
  wasm: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodObject<{
1411
1408
  bindings: z$2.ZodOptional<z$2.ZodCustom<typeof _rivetkit_rivetkit_wasm, typeof _rivetkit_rivetkit_wasm>>;
1412
- initInput: z$2.ZodOptional<z$2.ZodCustom<{
1413
- module_or_path: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput>;
1414
- } | _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined, {
1415
- module_or_path: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput>;
1416
- } | _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined>>;
1409
+ initInput: z$2.ZodOptional<z$2.ZodCustom<any, any>>;
1417
1410
  }, z$2.core.$strip>>>;
1418
1411
  sqlite: z$2.ZodPipe<z$2.ZodOptional<z$2.ZodUnion<readonly [z$2.ZodEnum<{
1419
1412
  local: "local";
@@ -1504,9 +1497,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
1504
1497
  runtime: "auto" | "native" | "wasm";
1505
1498
  wasm: {
1506
1499
  bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
1507
- initInput?: {
1508
- module_or_path: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput>;
1509
- } | _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined;
1500
+ initInput?: any;
1510
1501
  };
1511
1502
  noWelcome: boolean;
1512
1503
  logging: {
@@ -1551,9 +1542,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
1551
1542
  runtime: "auto" | "native" | "wasm";
1552
1543
  wasm: {
1553
1544
  bindings?: typeof _rivetkit_rivetkit_wasm | undefined;
1554
- initInput?: {
1555
- module_or_path: _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput>;
1556
- } | _rivetkit_rivetkit_wasm.InitInput | Promise<_rivetkit_rivetkit_wasm.InitInput> | undefined;
1545
+ initInput?: any;
1557
1546
  };
1558
1547
  sqlite: {
1559
1548
  backend: "local" | "remote";
@@ -1609,12 +1598,14 @@ type FetchHandler = (request: Request, ...args: any) => Response | Promise<Respo
1609
1598
  interface ServerlessHandler {
1610
1599
  fetch: FetchHandler;
1611
1600
  }
1612
- interface RegistryDiagnostics {
1613
- mode: string;
1614
- envoyActiveActorCount?: number | null;
1601
+ interface RegistryRoutes {
1602
+ health(): Promise<Response>;
1603
+ metadata(): Promise<Response>;
1604
+ prometheusMetrics(request?: Request): Promise<Response>;
1615
1605
  }
1616
1606
  declare class Registry<A extends RegistryActors> {
1617
1607
  #private;
1608
+ readonly routes: RegistryRoutes;
1618
1609
  get config(): RegistryConfigInput<A>;
1619
1610
  parseConfig(): RegistryConfig;
1620
1611
  constructor(config: RegistryConfigInput<A>);
@@ -1638,26 +1629,6 @@ declare class Registry<A extends RegistryActors> {
1638
1629
  * ```
1639
1630
  */
1640
1631
  serve(): ServerlessHandler;
1641
- /**
1642
- * Starts an HTTP server that dispatches every request through the
1643
- * serverless handler. Uses `crossPlatformServe` to pick the right
1644
- * runtime (Node, Bun, Deno).
1645
- *
1646
- * @param opts.port Port to listen on. Defaults to 3000.
1647
- * @param opts.publicDir If set, serves static files from this directory
1648
- * before falling through to the registry handler.
1649
- *
1650
- * @example
1651
- * ```ts
1652
- * await registry.listen();
1653
- * await registry.listen({ port: 8080, publicDir: "./public" });
1654
- * ```
1655
- */
1656
- listen(opts?: {
1657
- port?: number;
1658
- publicDir?: string;
1659
- }): Promise<void>;
1660
- diagnostics(): Promise<RegistryDiagnostics>;
1661
1632
  startEnvoy(): void;
1662
1633
  /**
1663
1634
  * Starts the actor envoy for standalone server deployments.
@@ -200,7 +200,7 @@ function noopNext() {
200
200
  // package.json
201
201
  var package_default = {
202
202
  name: "rivetkit",
203
- version: "2.3.0-rc.8",
203
+ version: "2.3.0-rc.9",
204
204
  description: "Lightweight libraries for building stateful actors on edge platforms",
205
205
  license: "Apache-2.0",
206
206
  keywords: [
@@ -368,14 +368,13 @@ var package_default = {
368
368
  "actor-config-schema-gen": "tsx scripts/actor-config-schema-gen.ts"
369
369
  },
370
370
  dependencies: {
371
+ "@rivet-dev/agent-os-core": "^0.1.1",
371
372
  "@hono/node-server": "^1.18.2",
372
373
  "@hono/node-ws": "^1.1.1",
373
374
  "@hono/zod-openapi": "^1.1.5",
374
- "@rivet-dev/agent-os-core": "^0.1.1",
375
375
  "@rivetkit/bare-ts": "^0.6.2",
376
376
  "@rivetkit/engine-cli": "workspace:*",
377
377
  "@rivetkit/engine-envoy-protocol": "workspace:*",
378
- "@rivetkit/on-change": "6.0.1",
379
378
  "@rivetkit/rivetkit-napi": "workspace:*",
380
379
  "@rivetkit/rivetkit-wasm": "workspace:*",
381
380
  "@rivetkit/traces": "workspace:*",
@@ -393,10 +392,10 @@ var package_default = {
393
392
  zod: "^4.1.0"
394
393
  },
395
394
  devDependencies: {
396
- "@biomejs/biome": "^2.3",
397
395
  "@copilotkit/llmock": "^1.6.0",
398
396
  "@rivet-dev/agent-os-common": "*",
399
397
  "@rivet-dev/agent-os-pi": "^0.1.1",
398
+ "@biomejs/biome": "^2.3",
400
399
  "@standard-schema/spec": "^1.0.0",
401
400
  "@types/invariant": "^2",
402
401
  "@types/node": "^22.13.1",
@@ -472,7 +471,6 @@ function configureDefaultLogger(logLevel) {
472
471
  messageKey: "msg",
473
472
  // Do not include pid/hostname in output
474
473
  base: {},
475
- errorKey: "error",
476
474
  // Keep the numeric level so the logfmt sink can match Pino's levels.
477
475
  formatters: {
478
476
  level(_label, number) {
@@ -807,10 +805,6 @@ var JSON_COMPAT_BIGINT = "$BigInt";
807
805
  var JSON_COMPAT_ARRAY_BUFFER = "$ArrayBuffer";
808
806
  var JSON_COMPAT_UINT8_ARRAY = "$Uint8Array";
809
807
  var JSON_COMPAT_UNDEFINED = "$Undefined";
810
- var JSON_COMPAT_SET = "$Set";
811
- function isTypedArray(value) {
812
- return value instanceof Uint8ClampedArray || value instanceof Uint16Array || value instanceof Uint32Array || value instanceof BigUint64Array || value instanceof Int8Array || value instanceof Int16Array || value instanceof Int32Array || value instanceof BigInt64Array || value instanceof Float32Array || value instanceof Float64Array;
813
- }
814
808
  var EncodingSchema = z2.enum(["json", "cbor", "bare"]);
815
809
  async function inputDataToBuffer(data) {
816
810
  if (typeof data === "string") {
@@ -845,15 +839,9 @@ function isPlainObject(value) {
845
839
  return proto === Object.prototype || proto === null;
846
840
  }
847
841
  function encodeJsonCompatValue(input) {
848
- if (input === null) {
849
- return input;
850
- }
851
842
  if (input === void 0) {
852
843
  return [JSON_COMPAT_UNDEFINED, 0];
853
844
  }
854
- if (typeof input === "string" || typeof input === "number" || typeof input === "boolean") {
855
- return input;
856
- }
857
845
  if (typeof input === "bigint") {
858
846
  return [JSON_COMPAT_BIGINT, input.toString()];
859
847
  }
@@ -863,32 +851,8 @@ function encodeJsonCompatValue(input) {
863
851
  if (input instanceof Uint8Array) {
864
852
  return [JSON_COMPAT_UINT8_ARRAY, base64EncodeUint8Array(input)];
865
853
  }
866
- if (isTypedArray(input)) {
867
- return input;
868
- }
869
- if (input instanceof Date || input instanceof RegExp || input instanceof Error) {
870
- return input;
871
- }
872
- if (input instanceof Set) {
873
- const encoded = [...input.values()].map(
874
- (v) => encodeJsonCompatValue(v)
875
- );
876
- return [JSON_COMPAT_SET, encoded];
877
- }
878
- if (input instanceof Map) {
879
- const encoded = /* @__PURE__ */ new Map();
880
- for (const [k, v] of input.entries()) {
881
- encoded.set(
882
- encodeJsonCompatValue(k),
883
- encodeJsonCompatValue(v)
884
- );
885
- }
886
- return encoded;
887
- }
888
854
  if (Array.isArray(input)) {
889
- const encoded = input.map(
890
- (value) => encodeJsonCompatValue(value)
891
- );
855
+ const encoded = input.map((value) => encodeJsonCompatValue(value));
892
856
  if (encoded.length === 2 && typeof encoded[0] === "string" && encoded[0].startsWith("$")) {
893
857
  return ["$" + encoded[0], encoded[1]];
894
858
  }
@@ -901,10 +865,7 @@ function encodeJsonCompatValue(input) {
901
865
  }
902
866
  return encoded;
903
867
  }
904
- const typeName = typeof input === "object" && input !== null ? input.constructor?.name ?? typeof input : typeof input;
905
- throw new TypeError(
906
- `Value of type "${typeName}" is not CBOR serializable`
907
- );
868
+ return input;
908
869
  }
909
870
  function reviveJsonCompatValue(input, options = {}) {
910
871
  if (typeof input === "bigint") {
@@ -913,16 +874,6 @@ function reviveJsonCompatValue(input, options = {}) {
913
874
  }
914
875
  return input;
915
876
  }
916
- if (input instanceof Map) {
917
- const revived = /* @__PURE__ */ new Map();
918
- for (const [k, v] of input.entries()) {
919
- revived.set(
920
- reviveJsonCompatValue(k, options),
921
- reviveJsonCompatValue(v, options)
922
- );
923
- }
924
- return revived;
925
- }
926
877
  if (Array.isArray(input)) {
927
878
  if (input.length === 2 && typeof input[0] === "string" && input[0].startsWith("$")) {
928
879
  if (input[0] === JSON_COMPAT_BIGINT) {
@@ -937,12 +888,6 @@ function reviveJsonCompatValue(input, options = {}) {
937
888
  if (input[0] === JSON_COMPAT_UNDEFINED) {
938
889
  return void 0;
939
890
  }
940
- if (input[0] === JSON_COMPAT_SET) {
941
- const items = input[1].map(
942
- (v) => reviveJsonCompatValue(v, options)
943
- );
944
- return new Set(items);
945
- }
946
891
  if (input[0].startsWith("$$")) {
947
892
  return [
948
893
  input[0].substring(1),
@@ -4750,6 +4695,7 @@ function createQueueSender(senderOptions) {
4750
4695
  }
4751
4696
 
4752
4697
  // src/client/actor-conn.ts
4698
+ var DEFAULT_MAX_INCOMING_MESSAGE_SIZE = 65536;
4753
4699
  var CONNECT_SYMBOL = /* @__PURE__ */ Symbol("connect");
4754
4700
  var ActorConnRaw = class {
4755
4701
  #disposed = false;
@@ -4801,6 +4747,9 @@ var ActorConnRaw = class {
4801
4747
  this.#encoding = encoding;
4802
4748
  this.#actorResolutionState = actorResolutionState;
4803
4749
  this.#gatewayOptions = resolveActorGatewayOptions(gatewayOptions);
4750
+ if ("getForId" in actorResolutionState) {
4751
+ this.#actorId = actorResolutionState.getForId.actorId;
4752
+ }
4804
4753
  this.#readyPromise = promiseWithResolvers(
4805
4754
  (reason) => logger2().warn({
4806
4755
  msg: "unhandled ready promise rejection",
@@ -4818,9 +4767,7 @@ var ActorConnRaw = class {
4818
4767
  );
4819
4768
  }
4820
4769
  });
4821
- this.#keepNodeAliveInterval = setInterval(() => {
4822
- }, 6e4);
4823
- this.#keepNodeAliveInterval.unref?.();
4770
+ this.#keepNodeAliveInterval = setInterval(() => 6e4);
4824
4771
  }
4825
4772
  #clearResolvedActorIdentity() {
4826
4773
  this.#actorId = void 0;
@@ -5628,8 +5575,31 @@ var ActorConnRaw = class {
5628
5575
  }
5629
5576
  }
5630
5577
  );
5631
- this.#websocket.send(messageSerialized);
5632
5578
  const serializedLength = messageLength(messageSerialized);
5579
+ if (serializedLength > DEFAULT_MAX_INCOMING_MESSAGE_SIZE && message.body.tag === "ActionRequest") {
5580
+ const actionId = Number(message.body.val.id);
5581
+ const inFlight = this.#takeActionInFlight(actionId);
5582
+ const error = new RivetError(
5583
+ "message",
5584
+ "incoming_too_long",
5585
+ "Incoming message too long",
5586
+ {
5587
+ maxSize: DEFAULT_MAX_INCOMING_MESSAGE_SIZE,
5588
+ actualSize: serializedLength
5589
+ }
5590
+ );
5591
+ logger2().warn({
5592
+ msg: "rejecting oversized connection action request",
5593
+ actionId,
5594
+ actionName: inFlight.name,
5595
+ actualSize: serializedLength,
5596
+ maxSize: DEFAULT_MAX_INCOMING_MESSAGE_SIZE
5597
+ });
5598
+ inFlight.reject(error);
5599
+ this.#dispatchActorError(error);
5600
+ return;
5601
+ }
5602
+ this.#websocket.send(messageSerialized);
5633
5603
  logger2().trace({
5634
5604
  msg: "sent websocket message",
5635
5605
  len: serializedLength