rivetkit 2.3.9 → 2.3.11-rc.1

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 (87) hide show
  1. package/dist/browser/client.d.ts +2 -12
  2. package/dist/browser/client.js +22 -27
  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 +2 -12
  9. package/dist/tsup/agent-os/index.d.ts +2 -12
  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-S57DMBTM.cjs → chunk-57ZE43T5.cjs} +3 -3
  13. package/dist/tsup/{chunk-S57DMBTM.cjs.map → chunk-57ZE43T5.cjs.map} +1 -1
  14. package/dist/tsup/{chunk-X25YYVFL.js → chunk-5FVMFSBH.js} +2 -2
  15. package/dist/tsup/{chunk-BQU4XTKM.js → chunk-5ZS22TOP.js} +3 -3
  16. package/dist/tsup/{chunk-CQ23UFQ4.js → chunk-6ZPMYIZ6.js} +2 -2
  17. package/dist/tsup/{chunk-UBYPRYJR.js → chunk-ET2F6BXK.js} +2 -2
  18. package/dist/tsup/chunk-ET2F6BXK.js.map +1 -0
  19. package/dist/tsup/{chunk-AVUMOGUE.cjs → chunk-JAQHV6LB.cjs} +7 -7
  20. package/dist/tsup/{chunk-AVUMOGUE.cjs.map → chunk-JAQHV6LB.cjs.map} +1 -1
  21. package/dist/tsup/{chunk-GZ5DYSIR.cjs → chunk-K4DNAIWT.cjs} +4 -4
  22. package/dist/tsup/{chunk-GZ5DYSIR.cjs.map → chunk-K4DNAIWT.cjs.map} +1 -1
  23. package/dist/tsup/{chunk-KVKWTOW7.js → chunk-L4DYLD7P.js} +3 -3
  24. package/dist/tsup/{chunk-MQDQ3A72.js → chunk-MMPE77KO.js} +27 -33
  25. package/dist/tsup/chunk-MMPE77KO.js.map +1 -0
  26. package/dist/tsup/{chunk-M4R2O5NJ.cjs → chunk-TWNMQDZK.cjs} +2 -2
  27. package/dist/tsup/chunk-TWNMQDZK.cjs.map +1 -0
  28. package/dist/tsup/{chunk-3IDKUXQT.cjs → chunk-W2YEXCCJ.cjs} +163 -169
  29. package/dist/tsup/chunk-W2YEXCCJ.cjs.map +1 -0
  30. package/dist/tsup/{chunk-KPP2YRS5.cjs → chunk-XEOPXHN2.cjs} +9 -9
  31. package/dist/tsup/{chunk-KPP2YRS5.cjs.map → chunk-XEOPXHN2.cjs.map} +1 -1
  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-CUymbyM6.d.ts → config-BKAMOHez.d.ts} +2 -12
  41. package/dist/tsup/{config-CpB-e4I9.d.cts → config-Caocy3Z9.d.cts} +2 -12
  42. package/dist/tsup/{context-YBUBTwTS.d.ts → context-AfCExwbr.d.ts} +1 -1
  43. package/dist/tsup/{context-c-6G4mjk.d.cts → context-D1_m5x1D.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 +131 -341
  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 +68 -278
  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 +1 -3
  72. package/src/client/raw-utils.ts +0 -8
  73. package/src/common/actor-router-consts.ts +0 -1
  74. package/src/engine-client/actor-http-client.ts +22 -6
  75. package/src/registry/index.ts +11 -51
  76. package/src/registry/napi-runtime.ts +5 -32
  77. package/src/registry/native.ts +63 -110
  78. package/src/registry/runtime.ts +2 -16
  79. package/dist/tsup/chunk-3IDKUXQT.cjs.map +0 -1
  80. package/dist/tsup/chunk-M4R2O5NJ.cjs.map +0 -1
  81. package/dist/tsup/chunk-MQDQ3A72.js.map +0 -1
  82. package/dist/tsup/chunk-UBYPRYJR.js.map +0 -1
  83. package/src/registry/native-http.ts +0 -208
  84. /package/dist/tsup/{chunk-X25YYVFL.js.map → chunk-5FVMFSBH.js.map} +0 -0
  85. /package/dist/tsup/{chunk-BQU4XTKM.js.map → chunk-5ZS22TOP.js.map} +0 -0
  86. /package/dist/tsup/{chunk-CQ23UFQ4.js.map → chunk-6ZPMYIZ6.js.map} +0 -0
  87. /package/dist/tsup/{chunk-KVKWTOW7.js.map → chunk-L4DYLD7P.js.map} +0 -0
@@ -2,10 +2,10 @@ import {
2
2
  ClientConfigSchema,
3
3
  RemoteEngineControlClient,
4
4
  createClientWithDriver
5
- } from "./chunk-MQDQ3A72.js";
5
+ } from "./chunk-MMPE77KO.js";
6
6
  import {
7
7
  getLogger
8
- } from "./chunk-UBYPRYJR.js";
8
+ } from "./chunk-ET2F6BXK.js";
9
9
 
10
10
  // src/devtools-loader/log.ts
11
11
  function logger() {
@@ -46,4 +46,4 @@ function createClient(endpointOrConfig) {
46
46
  export {
47
47
  createClient
48
48
  };
49
- //# sourceMappingURL=chunk-KVKWTOW7.js.map
49
+ //# sourceMappingURL=chunk-L4DYLD7P.js.map
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  importWebSocket,
10
10
  logger
11
- } from "./chunk-X25YYVFL.js";
11
+ } from "./chunk-5FVMFSBH.js";
12
12
  import {
13
13
  EncodingSchema,
14
14
  assertUnreachable,
@@ -35,7 +35,7 @@ import {
35
35
  serializeWithEncoding,
36
36
  stringifyError,
37
37
  uint8ArrayToBase64
38
- } from "./chunk-UBYPRYJR.js";
38
+ } from "./chunk-ET2F6BXK.js";
39
39
  import {
40
40
  INTERNAL_ERROR_CODE,
41
41
  RivetError,
@@ -50,7 +50,6 @@ var PATH_WEBSOCKET_PREFIX = "/websocket/";
50
50
  var HEADER_ACTOR_QUERY = "x-rivet-query";
51
51
  var HEADER_ENCODING = "x-rivet-encoding";
52
52
  var HEADER_CONN_PARAMS = "x-rivet-conn-params";
53
- var HEADER_ORIGINAL_REQUEST_URL = "x-rivet-internal-original-request-url";
54
53
  var HEADER_ACTOR_ID = "x-rivet-actor";
55
54
  var HEADER_ACTOR_GENERATION = "x-rivet-actor-generation";
56
55
  var HEADER_ACTOR_KEY = "x-rivet-actor-key";
@@ -2144,20 +2143,6 @@ async function checkForSchedulingError(group, code, actorId, query, driver) {
2144
2143
  return null;
2145
2144
  }
2146
2145
 
2147
- // src/common/fetch-like.ts
2148
- function isUrlLike(value) {
2149
- return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
2150
- }
2151
- function isRequestLike(value) {
2152
- return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
2153
- }
2154
- function isResponseLike(value) {
2155
- return typeof value === "object" && value !== null && typeof value.status === "number" && isHeadersLike(value.headers) && typeof value.arrayBuffer === "function";
2156
- }
2157
- function isHeadersLike(value) {
2158
- return typeof value === "object" && value !== null && typeof value.entries === "function";
2159
- }
2160
-
2161
2146
  // src/client/lifecycle-errors.ts
2162
2147
  function* walkErrorChain(error, maxDepth = 8) {
2163
2148
  let current = error;
@@ -2588,20 +2573,31 @@ function createQueueSender(senderOptions) {
2588
2573
  };
2589
2574
  }
2590
2575
 
2576
+ // src/common/fetch-like.ts
2577
+ function isUrlLike(value) {
2578
+ return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
2579
+ }
2580
+ function isRequestLike(value) {
2581
+ return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
2582
+ }
2583
+ function isResponseLike(value) {
2584
+ return typeof value === "object" && value !== null && typeof value.status === "number" && isHeadersLike(value.headers) && typeof value.arrayBuffer === "function";
2585
+ }
2586
+ function isHeadersLike(value) {
2587
+ return typeof value === "object" && value !== null && typeof value.entries === "function";
2588
+ }
2589
+
2591
2590
  // src/client/raw-utils.ts
2592
2591
  async function rawHttpFetch(driver, target, params, input, init, options = {}) {
2593
2592
  let path;
2594
- let originalUrl;
2595
2593
  let mergedInit = init || {};
2596
2594
  if (typeof input === "string") {
2597
2595
  path = input;
2598
2596
  } else if (isUrlLike(input)) {
2599
2597
  path = input.pathname + input.search;
2600
- originalUrl = input.toString();
2601
2598
  } else if (isRequestLike(input)) {
2602
2599
  const url = new URL(input.url);
2603
2600
  path = url.pathname + url.search;
2604
- originalUrl = url.toString();
2605
2601
  const requestHeaders = new Headers(input.headers);
2606
2602
  const initHeaders = new Headers((init == null ? void 0 : init.headers) || {});
2607
2603
  const mergedHeaders = new Headers(requestHeaders);
@@ -2643,10 +2639,6 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
2643
2639
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
2644
2640
  const url = new URL(`http://actor/request/${normalizedPath}`);
2645
2641
  const proxyRequestHeaders = new Headers(mergedInit.headers);
2646
- proxyRequestHeaders.delete(HEADER_ORIGINAL_REQUEST_URL);
2647
- if (originalUrl) {
2648
- proxyRequestHeaders.set(HEADER_ORIGINAL_REQUEST_URL, originalUrl);
2649
- }
2650
2642
  if (params) {
2651
2643
  proxyRequestHeaders.set(HEADER_CONN_PARAMS, JSON.stringify(params));
2652
2644
  }
@@ -3119,7 +3111,6 @@ var ActorHandleRaw = class {
3119
3111
  async #fetchWithResolvedActor(input, init) {
3120
3112
  const maxAttempts = this.#getDynamicQueryMaxAttempts();
3121
3113
  let useQueryTarget = false;
3122
- const retryableRequest = isRequestLike(input) ? input.clone() : void 0;
3123
3114
  const { skipReadyWait, ...requestInit } = init ?? {};
3124
3115
  const gatewayOptions = resolveActorGatewayOptions(
3125
3116
  this.#gatewayOptions,
@@ -3139,7 +3130,7 @@ var ActorHandleRaw = class {
3139
3130
  this.#driver,
3140
3131
  target,
3141
3132
  this.#params,
3142
- retryableRequest ? retryableRequest.clone() : input,
3133
+ input,
3143
3134
  requestInit,
3144
3135
  gatewayOptions
3145
3136
  );
@@ -4890,19 +4881,23 @@ async function sendHttpRequestToGateway(runConfig, gatewayUrl, actorRequest, opt
4890
4881
  if (actorRequest.bodyUsed) {
4891
4882
  throw new Error("Request body has already been consumed");
4892
4883
  }
4893
- if (actorRequest.body) {
4894
- bodyToSend = actorRequest.body;
4884
+ const reqBody = await actorRequest.arrayBuffer();
4885
+ if (reqBody.byteLength !== 0) {
4886
+ bodyToSend = reqBody;
4895
4887
  guardHeaders.delete("transfer-encoding");
4896
4888
  guardHeaders.delete("content-length");
4897
4889
  }
4898
4890
  }
4899
- return fetch(gatewayUrl, {
4891
+ const guardRequest = new Request(gatewayUrl, {
4900
4892
  method: actorRequest.method,
4901
4893
  headers: guardHeaders,
4902
4894
  body: bodyToSend,
4903
- signal: actorRequest.signal,
4904
- ...bodyToSend ? { duplex: "half" } : {}
4895
+ signal: actorRequest.signal
4905
4896
  });
4897
+ return mutableResponse(await fetch(guardRequest));
4898
+ }
4899
+ function mutableResponse(fetchRes) {
4900
+ return new Response(fetchRes.body, fetchRes);
4906
4901
  }
4907
4902
  function buildGuardHeaders(runConfig, actorRequest, options) {
4908
4903
  const headers = new Headers();
@@ -5843,7 +5838,6 @@ function apiActorToOutput(actor) {
5843
5838
 
5844
5839
  export {
5845
5840
  HEADER_CONN_PARAMS,
5846
- HEADER_ORIGINAL_REQUEST_URL,
5847
5841
  ALLOWED_PUBLIC_HEADERS,
5848
5842
  ActorClientError,
5849
5843
  ManagerError,
@@ -5860,4 +5854,4 @@ export {
5860
5854
  updateRunnerConfig,
5861
5855
  RemoteEngineControlClient
5862
5856
  };
5863
- //# sourceMappingURL=chunk-MQDQ3A72.js.map
5857
+ //# sourceMappingURL=chunk-MMPE77KO.js.map