rivetkit 2.3.24-rc.1 → 2.3.24

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 (115) hide show
  1. package/dist/browser/client.d.ts +3 -2
  2. package/dist/browser/client.js +36 -17
  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 +0 -2
  9. package/dist/tsup/agent-os/index.d.ts +0 -2
  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-6HW3TU7Q.js → chunk-45WBFRBN.js} +2 -2
  13. package/dist/tsup/{chunk-64CRWLOX.js → chunk-7OEOLF5T.js} +3 -3
  14. package/dist/tsup/{chunk-LTGBHN5Z.js → chunk-CSOHAAZK.js} +1 -1
  15. package/dist/tsup/chunk-CSOHAAZK.js.map +1 -0
  16. package/dist/tsup/{chunk-CE6NBGOL.cjs → chunk-JOJ42ZLR.cjs} +3 -3
  17. package/dist/tsup/{chunk-CE6NBGOL.cjs.map → chunk-JOJ42ZLR.cjs.map} +1 -1
  18. package/dist/tsup/{chunk-ERBNWARB.cjs → chunk-L4AZXL2Q.cjs} +4 -4
  19. package/dist/tsup/{chunk-ERBNWARB.cjs.map → chunk-L4AZXL2Q.cjs.map} +1 -1
  20. package/dist/tsup/{chunk-YVVFOKEP.cjs → chunk-NNM2X3ER.cjs} +2 -2
  21. package/dist/tsup/chunk-NNM2X3ER.cjs.map +1 -0
  22. package/dist/tsup/{chunk-OB5JLDBM.js → chunk-NSNBWLCG.js} +2 -2
  23. package/dist/tsup/{chunk-NGJWQMUU.cjs → chunk-NWCAIWHL.cjs} +1 -1
  24. package/dist/tsup/chunk-NWCAIWHL.cjs.map +1 -0
  25. package/dist/tsup/{chunk-M5J3PXNU.js → chunk-QMR2J7PT.js} +2 -2
  26. package/dist/tsup/{chunk-QQ454DVR.js → chunk-QZQE75U2.js} +2 -2
  27. package/dist/tsup/{chunk-B6WTPGOR.js → chunk-SW22GCYF.js} +30 -11
  28. package/dist/tsup/chunk-SW22GCYF.js.map +1 -0
  29. package/dist/tsup/{chunk-PFHGTLF2.cjs → chunk-TMMZAGZL.cjs} +10 -10
  30. package/dist/tsup/{chunk-PFHGTLF2.cjs.map → chunk-TMMZAGZL.cjs.map} +1 -1
  31. package/dist/tsup/{chunk-R3UI7MO3.cjs → chunk-TQNVNKDB.cjs} +165 -146
  32. package/dist/tsup/chunk-TQNVNKDB.cjs.map +1 -0
  33. package/dist/tsup/{chunk-JKDAOE4T.js → chunk-UIPQ7RI4.js} +4 -4
  34. package/dist/tsup/{chunk-SWQCSORE.cjs → chunk-WCSFWDKH.cjs} +3 -3
  35. package/dist/tsup/{chunk-SWQCSORE.cjs.map → chunk-WCSFWDKH.cjs.map} +1 -1
  36. package/dist/tsup/{chunk-DAC73W53.cjs → chunk-WTZGJFD4.cjs} +7 -7
  37. package/dist/tsup/{chunk-DAC73W53.cjs.map → chunk-WTZGJFD4.cjs.map} +1 -1
  38. package/dist/tsup/{chunk-JJCUSUWO.js → chunk-YH2CAWLD.js} +2 -2
  39. package/dist/tsup/chunk-YH2CAWLD.js.map +1 -0
  40. package/dist/tsup/{chunk-JMO6AVUC.cjs → chunk-ZCHJJ2FZ.cjs} +3 -3
  41. package/dist/tsup/{chunk-JMO6AVUC.cjs.map → chunk-ZCHJJ2FZ.cjs.map} +1 -1
  42. package/dist/tsup/client/mod.cjs +5 -5
  43. package/dist/tsup/client/mod.d.cts +5 -2
  44. package/dist/tsup/client/mod.d.ts +5 -2
  45. package/dist/tsup/client/mod.js +4 -4
  46. package/dist/tsup/common/log.cjs +2 -2
  47. package/dist/tsup/common/log.js +1 -1
  48. package/dist/tsup/common/websocket.cjs +3 -3
  49. package/dist/tsup/common/websocket.js +2 -2
  50. package/dist/tsup/{config-RV6gIa2L.d.ts → config-Cv6pjCt-.d.ts} +0 -4
  51. package/dist/tsup/{config-CuKzfH58.d.cts → config-osdJqQwX.d.cts} +0 -4
  52. package/dist/tsup/{context-DoMKZBQA.d.ts → context-CoVbKBuk.d.ts} +1 -1
  53. package/dist/tsup/{context-DPCxyjax.d.cts → context-DpjrM7n7.d.cts} +1 -1
  54. package/dist/tsup/db/drizzle.cjs +2 -2
  55. package/dist/tsup/db/drizzle.js +1 -1
  56. package/dist/tsup/db/mod.cjs +3 -3
  57. package/dist/tsup/db/mod.js +2 -2
  58. package/dist/tsup/dynamic/mod.cjs +2 -2
  59. package/dist/tsup/dynamic/mod.d.cts +1 -1
  60. package/dist/tsup/dynamic/mod.d.ts +1 -1
  61. package/dist/tsup/dynamic/mod.js +1 -1
  62. package/dist/tsup/inspector/mod.cjs +5 -5
  63. package/dist/tsup/inspector/mod.js +4 -4
  64. package/dist/tsup/inspector/workflow.cjs +4 -4
  65. package/dist/tsup/inspector/workflow.js +3 -3
  66. package/dist/tsup/inspector-tab/mod.cjs +2 -2
  67. package/dist/tsup/inspector-tab/mod.d.cts +2 -2
  68. package/dist/tsup/inspector-tab/mod.d.ts +2 -2
  69. package/dist/tsup/inspector-tab/mod.js +1 -1
  70. package/dist/tsup/mod.cjs +188 -416
  71. package/dist/tsup/mod.cjs.map +1 -1
  72. package/dist/tsup/mod.d.cts +3 -3
  73. package/dist/tsup/mod.d.ts +3 -3
  74. package/dist/tsup/mod.js +90 -318
  75. package/dist/tsup/mod.js.map +1 -1
  76. package/dist/tsup/test/mod.cjs +6 -6
  77. package/dist/tsup/test/mod.d.cts +1 -1
  78. package/dist/tsup/test/mod.d.ts +1 -1
  79. package/dist/tsup/test/mod.js +4 -4
  80. package/dist/tsup/utils.cjs +2 -2
  81. package/dist/tsup/utils.js +1 -1
  82. package/dist/tsup/workflow/mod.cjs +21 -69
  83. package/dist/tsup/workflow/mod.cjs.map +1 -1
  84. package/dist/tsup/workflow/mod.d.cts +3 -3
  85. package/dist/tsup/workflow/mod.d.ts +3 -3
  86. package/dist/tsup/workflow/mod.js +16 -64
  87. package/dist/tsup/workflow/mod.js.map +1 -1
  88. package/package.json +9 -9
  89. package/src/actor/config.ts +0 -2
  90. package/src/client/config.ts +3 -0
  91. package/src/client/raw-utils.ts +7 -2
  92. package/src/common/fetch-like.ts +14 -0
  93. package/src/engine-client/actor-http-client.ts +16 -6
  94. package/src/registry/napi-runtime.ts +0 -8
  95. package/src/registry/native.ts +65 -332
  96. package/src/registry/run-handler-coordinator.test.ts +0 -102
  97. package/src/registry/run-handler-coordinator.ts +17 -84
  98. package/src/registry/runtime.ts +0 -2
  99. package/src/registry/wasm-runtime.ts +0 -8
  100. package/src/workflow/context.ts +0 -20
  101. package/src/workflow/driver.ts +1 -25
  102. package/src/workflow/mod.ts +12 -46
  103. package/dist/tsup/chunk-B6WTPGOR.js.map +0 -1
  104. package/dist/tsup/chunk-JJCUSUWO.js.map +0 -1
  105. package/dist/tsup/chunk-LTGBHN5Z.js.map +0 -1
  106. package/dist/tsup/chunk-NGJWQMUU.cjs.map +0 -1
  107. package/dist/tsup/chunk-R3UI7MO3.cjs.map +0 -1
  108. package/dist/tsup/chunk-YVVFOKEP.cjs.map +0 -1
  109. package/src/registry/lost-callbacks.test.ts +0 -64
  110. /package/dist/tsup/{chunk-6HW3TU7Q.js.map → chunk-45WBFRBN.js.map} +0 -0
  111. /package/dist/tsup/{chunk-64CRWLOX.js.map → chunk-7OEOLF5T.js.map} +0 -0
  112. /package/dist/tsup/{chunk-OB5JLDBM.js.map → chunk-NSNBWLCG.js.map} +0 -0
  113. /package/dist/tsup/{chunk-M5J3PXNU.js.map → chunk-QMR2J7PT.js.map} +0 -0
  114. /package/dist/tsup/{chunk-QQ454DVR.js.map → chunk-QZQE75U2.js.map} +0 -0
  115. /package/dist/tsup/{chunk-JKDAOE4T.js.map → chunk-UIPQ7RI4.js.map} +0 -0
@@ -859,8 +859,6 @@ interface CoreRuntime {
859
859
  actorSaveState(ctx: ActorContextHandle, payload: RuntimeStateDeltaPayload): Promise<void>;
860
860
  actorSaveStateAndWorkflowBatch(ctx: ActorContextHandle, writes: RuntimeWorkflowKvWrite[]): Promise<void>;
861
861
  actorId(ctx: ActorContextHandle): string;
862
- actorGeneration(ctx: ActorContextHandle): number | undefined;
863
- actorIsLost(ctx: ActorContextHandle): boolean;
864
862
  /**
865
863
  * Runs one actor callback with `ctx` as the current invocation: operations
866
864
  * on retained handles for the same actor resolve to it, and its Core span
@@ -1332,6 +1330,7 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1332
1330
  skipReadyWait: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
1333
1331
  }, z$1.core.$strip>>>;
1334
1332
  getUpgradeWebSocket: z$1.ZodOptional<z$1.ZodCustom<GetUpgradeWebSocket, GetUpgradeWebSocket>>;
1333
+ fetch: z$1.ZodOptional<z$1.ZodCustom<typeof fetch, typeof fetch>>;
1335
1334
  disableMetadataLookup: z$1.ZodDefault<z$1.ZodOptional<z$1.ZodBoolean>>;
1336
1335
  maxInputSize: z$1.ZodDefault<z$1.ZodNumber>;
1337
1336
  devtools: z$1.ZodDefault<z$1.ZodBoolean>;
@@ -1350,6 +1349,7 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1350
1349
  devtools: boolean;
1351
1350
  getToken?: GetToken | undefined;
1352
1351
  getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
1352
+ fetch?: typeof fetch | undefined;
1353
1353
  }, {
1354
1354
  endpoint: string;
1355
1355
  token: string | undefined;
@@ -1365,6 +1365,7 @@ declare const ClientConfigSchema: z$1.ZodPipe<z$1.ZodObject<{
1365
1365
  devtools: boolean;
1366
1366
  getToken?: GetToken | undefined;
1367
1367
  getUpgradeWebSocket?: GetUpgradeWebSocket | undefined;
1368
+ fetch?: typeof fetch | undefined;
1368
1369
  }>>;
1369
1370
  type ClientConfigInput = z$1.input<typeof ClientConfigSchema>;
1370
1371
 
@@ -230,7 +230,7 @@ function noopNext() {
230
230
  // package.json
231
231
  var package_default = {
232
232
  name: "rivetkit",
233
- version: "2.3.24-rc.1",
233
+ version: "2.3.24",
234
234
  description: "Lightweight libraries for building stateful actors on edge platforms",
235
235
  license: "Apache-2.0",
236
236
  keywords: [
@@ -1251,6 +1251,25 @@ function shouldSkipReadyWait(options = {}) {
1251
1251
  return options.skipReadyWait === true;
1252
1252
  }
1253
1253
 
1254
+ // src/common/fetch-like.ts
1255
+ function isUrlLike(value) {
1256
+ return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
1257
+ }
1258
+ function isRequestLike(value) {
1259
+ return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
1260
+ }
1261
+ function isHeadersLike(value) {
1262
+ return typeof value === "object" && value !== null && typeof value.entries === "function";
1263
+ }
1264
+ function readRequestBody(request) {
1265
+ if (!request.body) return request.arrayBuffer();
1266
+ return new Response(
1267
+ request.body.pipeThrough(new TransformStream(), {
1268
+ signal: request.signal
1269
+ })
1270
+ ).arrayBuffer();
1271
+ }
1272
+
1254
1273
  // src/engine-client/actor-http-client.ts
1255
1274
  async function sendHttpRequestToGateway(runConfig, gatewayUrl, actorRequest, options = {}) {
1256
1275
  let bodyToSend = null;
@@ -1259,18 +1278,26 @@ async function sendHttpRequestToGateway(runConfig, gatewayUrl, actorRequest, opt
1259
1278
  if (actorRequest.bodyUsed) {
1260
1279
  throw new Error("Request body has already been consumed");
1261
1280
  }
1262
- if (actorRequest.body) {
1263
- bodyToSend = actorRequest.body;
1281
+ const bytes = await readRequestBody(actorRequest);
1282
+ if (bytes.byteLength > 0) {
1283
+ bodyToSend = bytes;
1264
1284
  guardHeaders.delete("transfer-encoding");
1265
1285
  guardHeaders.delete("content-length");
1266
1286
  }
1267
1287
  }
1268
- return fetch(gatewayUrl, {
1288
+ const fetchImpl = runConfig.fetch ?? fetch;
1289
+ return fetchImpl(gatewayUrl, {
1269
1290
  method: actorRequest.method,
1270
1291
  headers: guardHeaders,
1271
1292
  body: bodyToSend,
1272
1293
  signal: actorRequest.signal,
1273
- ...bodyToSend ? { duplex: "half" } : {}
1294
+ mode: actorRequest.mode,
1295
+ credentials: actorRequest.credentials,
1296
+ redirect: actorRequest.redirect,
1297
+ referrer: actorRequest.referrer,
1298
+ referrerPolicy: actorRequest.referrerPolicy,
1299
+ integrity: actorRequest.integrity,
1300
+ keepalive: actorRequest.keepalive
1274
1301
  });
1275
1302
  }
1276
1303
  function buildGuardHeaders(runConfig, actorRequest, options) {
@@ -1440,6 +1467,8 @@ var ClientConfigSchemaBase = z3.object({
1440
1467
  // This is required in the client config in order to support
1441
1468
  // `proxyWebSocket`
1442
1469
  getUpgradeWebSocket: z3.custom().optional(),
1470
+ /** Replaces global fetch for actor HTTP gateway requests. */
1471
+ fetch: z3.custom().optional(),
1443
1472
  /** Whether to automatically perform health checks when the client is created. */
1444
1473
  disableMetadataLookup: z3.boolean().optional().default(false),
1445
1474
  /**
@@ -6226,17 +6255,6 @@ var ActorConnRaw = class {
6226
6255
  }
6227
6256
  };
6228
6257
 
6229
- // src/common/fetch-like.ts
6230
- function isUrlLike(value) {
6231
- return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
6232
- }
6233
- function isRequestLike(value) {
6234
- return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
6235
- }
6236
- function isHeadersLike(value) {
6237
- return typeof value === "object" && value !== null && typeof value.entries === "function";
6238
- }
6239
-
6240
6258
  // src/common/database/shared.ts
6241
6259
  var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
6242
6260
  var AsyncMutex = class {
@@ -6294,9 +6312,10 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}, t
6294
6312
  initHeaders.forEach((value, key) => {
6295
6313
  mergedHeaders.set(key, value);
6296
6314
  });
6315
+ const readsInputBody = init?.body === void 0 && input.method !== "GET" && input.method !== "HEAD";
6297
6316
  mergedInit = {
6298
6317
  method: input.method,
6299
- body: input.body,
6318
+ body: readsInputBody ? await readRequestBody(input) : void 0,
6300
6319
  mode: input.mode,
6301
6320
  credentials: input.credentials,
6302
6321
  redirect: input.redirect,