rivetkit 2.3.7 → 2.3.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 (90) hide show
  1. package/dist/browser/client.d.ts +34 -6
  2. package/dist/browser/client.js +33 -14
  3. package/dist/browser/client.js.map +1 -1
  4. package/dist/browser/inspector/client.js +1 -1
  5. package/dist/browser/inspector/client.js.map +1 -1
  6. package/dist/tsup/agent-os/index.cjs +1 -1
  7. package/dist/tsup/agent-os/index.cjs.map +1 -1
  8. package/dist/tsup/agent-os/index.d.cts +34 -6
  9. package/dist/tsup/agent-os/index.d.ts +34 -6
  10. package/dist/tsup/agent-os/index.js +1 -1
  11. package/dist/tsup/agent-os/index.js.map +1 -1
  12. package/dist/tsup/{chunk-46AE7JOI.cjs → chunk-3IDKUXQT.cjs} +173 -152
  13. package/dist/tsup/chunk-3IDKUXQT.cjs.map +1 -0
  14. package/dist/tsup/{chunk-DOPH7DT2.cjs → chunk-AVUMOGUE.cjs} +7 -7
  15. package/dist/tsup/{chunk-DOPH7DT2.cjs.map → chunk-AVUMOGUE.cjs.map} +1 -1
  16. package/dist/tsup/{chunk-7YQJXWBW.js → chunk-BQU4XTKM.js} +3 -3
  17. package/dist/tsup/{chunk-6D2WRHJV.js → chunk-CQ23UFQ4.js} +2 -2
  18. package/dist/tsup/{chunk-UIZZCJ5W.cjs → chunk-GZ5DYSIR.cjs} +4 -4
  19. package/dist/tsup/{chunk-UIZZCJ5W.cjs.map → chunk-GZ5DYSIR.cjs.map} +1 -1
  20. package/dist/tsup/{chunk-TQHMPWL6.cjs → chunk-KPP2YRS5.cjs} +9 -9
  21. package/dist/tsup/{chunk-TQHMPWL6.cjs.map → chunk-KPP2YRS5.cjs.map} +1 -1
  22. package/dist/tsup/{chunk-CH25U5NO.js → chunk-KVKWTOW7.js} +3 -3
  23. package/dist/tsup/{chunk-2SGPZEAJ.cjs → chunk-M4R2O5NJ.cjs} +6 -3
  24. package/dist/tsup/chunk-M4R2O5NJ.cjs.map +1 -0
  25. package/dist/tsup/{chunk-YU3C5OCU.js → chunk-MQDQ3A72.js} +39 -18
  26. package/dist/tsup/chunk-MQDQ3A72.js.map +1 -0
  27. package/dist/tsup/{chunk-MNZFNIVI.cjs → chunk-S57DMBTM.cjs} +3 -3
  28. package/dist/tsup/{chunk-MNZFNIVI.cjs.map → chunk-S57DMBTM.cjs.map} +1 -1
  29. package/dist/tsup/{chunk-OG4OR2CM.js → chunk-UBYPRYJR.js} +6 -3
  30. package/dist/tsup/chunk-UBYPRYJR.js.map +1 -0
  31. package/dist/tsup/{chunk-YHPFCYL3.js → chunk-X25YYVFL.js} +2 -2
  32. package/dist/tsup/client/mod.cjs +5 -5
  33. package/dist/tsup/client/mod.d.cts +2 -2
  34. package/dist/tsup/client/mod.d.ts +2 -2
  35. package/dist/tsup/client/mod.js +4 -4
  36. package/dist/tsup/common/log.cjs +2 -2
  37. package/dist/tsup/common/log.js +1 -1
  38. package/dist/tsup/common/websocket.cjs +3 -3
  39. package/dist/tsup/common/websocket.js +2 -2
  40. package/dist/tsup/{config-BRpVbJCD.d.ts → config-CUymbyM6.d.ts} +35 -7
  41. package/dist/tsup/{config-BobvQpex.d.cts → config-CpB-e4I9.d.cts} +35 -7
  42. package/dist/tsup/{context-Cj-DFyiy.d.ts → context-YBUBTwTS.d.ts} +1 -1
  43. package/dist/tsup/{context-YEBNJrws.d.cts → context-c-6G4mjk.d.cts} +1 -1
  44. package/dist/tsup/db/drizzle.cjs +2 -2
  45. package/dist/tsup/db/drizzle.js +1 -1
  46. package/dist/tsup/db/mod.cjs +2 -2
  47. package/dist/tsup/db/mod.js +1 -1
  48. package/dist/tsup/dynamic/mod.d.cts +1 -1
  49. package/dist/tsup/dynamic/mod.d.ts +1 -1
  50. package/dist/tsup/inspector/mod.cjs +4 -4
  51. package/dist/tsup/inspector/mod.js +3 -3
  52. package/dist/tsup/inspector-tab/mod.d.cts +2 -2
  53. package/dist/tsup/inspector-tab/mod.d.ts +2 -2
  54. package/dist/tsup/mod.cjs +449 -124
  55. package/dist/tsup/mod.cjs.map +1 -1
  56. package/dist/tsup/mod.d.cts +3 -3
  57. package/dist/tsup/mod.d.ts +3 -3
  58. package/dist/tsup/mod.js +388 -63
  59. package/dist/tsup/mod.js.map +1 -1
  60. package/dist/tsup/test/mod.cjs +6 -6
  61. package/dist/tsup/test/mod.d.cts +1 -1
  62. package/dist/tsup/test/mod.d.ts +1 -1
  63. package/dist/tsup/test/mod.js +4 -4
  64. package/dist/tsup/utils.cjs +2 -2
  65. package/dist/tsup/utils.js +1 -1
  66. package/dist/tsup/workflow/mod.cjs +6 -6
  67. package/dist/tsup/workflow/mod.d.cts +3 -3
  68. package/dist/tsup/workflow/mod.d.ts +3 -3
  69. package/dist/tsup/workflow/mod.js +3 -3
  70. package/package.json +8 -8
  71. package/src/client/actor-handle.ts +3 -1
  72. package/src/client/raw-utils.ts +11 -2
  73. package/src/common/actor-router-consts.ts +1 -0
  74. package/src/common/encoding.ts +4 -1
  75. package/src/common/fetch-like.ts +49 -0
  76. package/src/engine-client/actor-http-client.ts +6 -22
  77. package/src/registry/index.ts +159 -14
  78. package/src/registry/napi-runtime.ts +74 -0
  79. package/src/registry/native-http.ts +208 -0
  80. package/src/registry/native.ts +111 -63
  81. package/src/registry/runtime.ts +35 -0
  82. package/src/registry/wasm-runtime.ts +11 -0
  83. package/dist/tsup/chunk-2SGPZEAJ.cjs.map +0 -1
  84. package/dist/tsup/chunk-46AE7JOI.cjs.map +0 -1
  85. package/dist/tsup/chunk-OG4OR2CM.js.map +0 -1
  86. package/dist/tsup/chunk-YU3C5OCU.js.map +0 -1
  87. /package/dist/tsup/{chunk-7YQJXWBW.js.map → chunk-BQU4XTKM.js.map} +0 -0
  88. /package/dist/tsup/{chunk-6D2WRHJV.js.map → chunk-CQ23UFQ4.js.map} +0 -0
  89. /package/dist/tsup/{chunk-CH25U5NO.js.map → chunk-KVKWTOW7.js.map} +0 -0
  90. /package/dist/tsup/{chunk-YHPFCYL3.js.map → chunk-X25YYVFL.js.map} +0 -0
@@ -594,6 +594,12 @@ interface RuntimeHttpRequest {
594
594
  headers?: Record<string, string>;
595
595
  body?: RuntimeBytes;
596
596
  }
597
+ interface RuntimeHttpResponseBodyStream {
598
+ cancelled(): Promise<void>;
599
+ write(chunk: Uint8Array): Promise<void>;
600
+ end(): Promise<void>;
601
+ error(message: string): Promise<void>;
602
+ }
597
603
  interface RuntimeStateDeltaPayload {
598
604
  state?: RuntimeBytes;
599
605
  connHibernation: Array<{
@@ -816,6 +822,7 @@ interface RuntimeListenerConfig {
816
822
  port: number;
817
823
  host?: string;
818
824
  publicDir?: string;
825
+ application?: RuntimeApplicationFetch;
819
826
  }
820
827
  interface RuntimeServerlessRequest {
821
828
  method: string;
@@ -823,6 +830,19 @@ interface RuntimeServerlessRequest {
823
830
  headers: Record<string, string>;
824
831
  body: RuntimeBytes;
825
832
  }
833
+ interface RuntimeApplicationRequest extends RuntimeServerlessRequest {
834
+ cancelToken?: CancellationTokenHandle;
835
+ }
836
+ interface RuntimeApplicationResponse {
837
+ status: number;
838
+ headers: Record<string, string>;
839
+ body?: RuntimeBytes;
840
+ stream?: boolean;
841
+ }
842
+ type RuntimeApplicationFetch = (request: RuntimeApplicationRequest, responseBodyStream?: RuntimeHttpResponseBodyStream) => Promise<RuntimeApplicationResponse>;
843
+ interface RuntimeApplicationListenerConfig extends RuntimeListenerConfig {
844
+ application: RuntimeApplicationFetch;
845
+ }
826
846
  interface RuntimeServerlessResponseHead {
827
847
  status: number;
828
848
  headers: Record<string, string>;
@@ -865,6 +885,7 @@ interface CoreRuntime {
865
885
  registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
866
886
  handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
867
887
  serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
888
+ serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
868
889
  registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
869
890
  registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
870
891
  registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
@@ -975,6 +996,15 @@ type FetchHandler = (request: Request, ...args: any) => Response | Promise<Respo
975
996
  interface ServerlessHandler {
976
997
  fetch: FetchHandler;
977
998
  }
999
+ interface RegistryApplication {
1000
+ fetch: FetchHandler;
1001
+ }
1002
+ interface RegistryListenOptions {
1003
+ port?: number;
1004
+ host?: string;
1005
+ publicDir?: string;
1006
+ application?: RegistryApplication;
1007
+ }
978
1008
  interface RegistryRoutes {
979
1009
  health(): Promise<Response>;
980
1010
  metadata(): Promise<Response>;
@@ -1024,18 +1054,16 @@ declare class Registry<A extends RegistryActors> {
1024
1054
  * @param opts.host Address to bind. Defaults to `0.0.0.0`.
1025
1055
  * @param opts.publicDir If set, serves static files from this directory
1026
1056
  * as a fallback below the framework routes.
1057
+ * @param opts.application If set, handles requests that do not match a
1058
+ * framework route.
1027
1059
  *
1028
1060
  * @example
1029
1061
  * ```ts
1030
1062
  * await registry.listen();
1031
- * await registry.listen({ port: 8080, publicDir: "./public" });
1063
+ * await registry.listen({ application: app });
1032
1064
  * ```
1033
1065
  */
1034
- listen(opts?: {
1035
- port?: number;
1036
- host?: string;
1037
- publicDir?: string;
1038
- }): Promise<void>;
1066
+ listen(opts?: RegistryListenOptions): Promise<void>;
1039
1067
  /**
1040
1068
  * Gracefully drains all live registries.
1041
1069
  *
@@ -594,6 +594,12 @@ interface RuntimeHttpRequest {
594
594
  headers?: Record<string, string>;
595
595
  body?: RuntimeBytes;
596
596
  }
597
+ interface RuntimeHttpResponseBodyStream {
598
+ cancelled(): Promise<void>;
599
+ write(chunk: Uint8Array): Promise<void>;
600
+ end(): Promise<void>;
601
+ error(message: string): Promise<void>;
602
+ }
597
603
  interface RuntimeStateDeltaPayload {
598
604
  state?: RuntimeBytes;
599
605
  connHibernation: Array<{
@@ -816,6 +822,7 @@ interface RuntimeListenerConfig {
816
822
  port: number;
817
823
  host?: string;
818
824
  publicDir?: string;
825
+ application?: RuntimeApplicationFetch;
819
826
  }
820
827
  interface RuntimeServerlessRequest {
821
828
  method: string;
@@ -823,6 +830,19 @@ interface RuntimeServerlessRequest {
823
830
  headers: Record<string, string>;
824
831
  body: RuntimeBytes;
825
832
  }
833
+ interface RuntimeApplicationRequest extends RuntimeServerlessRequest {
834
+ cancelToken?: CancellationTokenHandle;
835
+ }
836
+ interface RuntimeApplicationResponse {
837
+ status: number;
838
+ headers: Record<string, string>;
839
+ body?: RuntimeBytes;
840
+ stream?: boolean;
841
+ }
842
+ type RuntimeApplicationFetch = (request: RuntimeApplicationRequest, responseBodyStream?: RuntimeHttpResponseBodyStream) => Promise<RuntimeApplicationResponse>;
843
+ interface RuntimeApplicationListenerConfig extends RuntimeListenerConfig {
844
+ application: RuntimeApplicationFetch;
845
+ }
826
846
  interface RuntimeServerlessResponseHead {
827
847
  status: number;
828
848
  headers: Record<string, string>;
@@ -865,6 +885,7 @@ interface CoreRuntime {
865
885
  registryActorStopThresholdMs?(registry: RegistryHandle): Promise<number | undefined>;
866
886
  handleServerlessRequest(registry: RegistryHandle, req: RuntimeServerlessRequest, onStreamEvent: RuntimeServerlessStreamCallback, cancelToken: CancellationTokenHandle, config: RuntimeServeConfig): Promise<RuntimeServerlessResponseHead>;
867
887
  serveListener(registry: RegistryHandle, listener: RuntimeListenerConfig, config: RuntimeServeConfig): Promise<void>;
888
+ serveApplicationListener(registry: RegistryHandle, listener: RuntimeApplicationListenerConfig, config: RuntimeServeConfig): Promise<void>;
868
889
  registryHealth?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
869
890
  registryMetadata?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
870
891
  registryMetrics?(registry: RegistryHandle): Promise<RuntimeRegistryRouteResponse>;
@@ -975,6 +996,15 @@ type FetchHandler = (request: Request, ...args: any) => Response | Promise<Respo
975
996
  interface ServerlessHandler {
976
997
  fetch: FetchHandler;
977
998
  }
999
+ interface RegistryApplication {
1000
+ fetch: FetchHandler;
1001
+ }
1002
+ interface RegistryListenOptions {
1003
+ port?: number;
1004
+ host?: string;
1005
+ publicDir?: string;
1006
+ application?: RegistryApplication;
1007
+ }
978
1008
  interface RegistryRoutes {
979
1009
  health(): Promise<Response>;
980
1010
  metadata(): Promise<Response>;
@@ -1024,18 +1054,16 @@ declare class Registry<A extends RegistryActors> {
1024
1054
  * @param opts.host Address to bind. Defaults to `0.0.0.0`.
1025
1055
  * @param opts.publicDir If set, serves static files from this directory
1026
1056
  * as a fallback below the framework routes.
1057
+ * @param opts.application If set, handles requests that do not match a
1058
+ * framework route.
1027
1059
  *
1028
1060
  * @example
1029
1061
  * ```ts
1030
1062
  * await registry.listen();
1031
- * await registry.listen({ port: 8080, publicDir: "./public" });
1063
+ * await registry.listen({ application: app });
1032
1064
  * ```
1033
1065
  */
1034
- listen(opts?: {
1035
- port?: number;
1036
- host?: string;
1037
- publicDir?: string;
1038
- }): Promise<void>;
1066
+ listen(opts?: RegistryListenOptions): Promise<void>;
1039
1067
  /**
1040
1068
  * Gracefully drains all live registries.
1041
1069
  *
@@ -417,7 +417,7 @@ function isRivetErrorCode(error, group, code) {
417
417
  // package.json
418
418
  var package_default = {
419
419
  name: "rivetkit",
420
- version: "2.3.7",
420
+ version: "2.3.9",
421
421
  description: "Lightweight libraries for building stateful actors on edge platforms",
422
422
  license: "Apache-2.0",
423
423
  keywords: [