@rivetkit/supabase 0.0.0-main.b2d3b94 → 0.0.0-raw-fetch-retry.e47ce6c

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 (3) hide show
  1. package/dist/mod.js +93 -55
  2. package/dist/mod.mjs +93 -55
  3. package/package.json +3 -3
package/dist/mod.js CHANGED
@@ -335,7 +335,7 @@ __export(mod_exports, {
335
335
  module.exports = __toCommonJS(mod_exports);
336
336
  var wasmBindings = __toESM(require("@rivetkit/rivetkit-wasm"));
337
337
 
338
- // ../rivetkit/dist/tsup/chunk-IXBD7BXC.js
338
+ // ../rivetkit/dist/tsup/chunk-OUQUIBVW.js
339
339
  var INTERNAL_ERROR_CODE = "internal_error";
340
340
  var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
341
341
  var USER_ERROR_CODE = "user_error";
@@ -519,7 +519,7 @@ function unsupportedFeature(feature) {
519
519
  );
520
520
  }
521
521
 
522
- // ../rivetkit/dist/tsup/chunk-ADHLA6ZD.js
522
+ // ../rivetkit/dist/tsup/chunk-U7WHTSF2.js
523
523
  var import_pino = require("pino");
524
524
 
525
525
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/classic/external.js
@@ -13192,7 +13192,7 @@ var classic_default = external_exports;
13192
13192
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
13193
13193
  var v4_default = classic_default;
13194
13194
 
13195
- // ../rivetkit/dist/tsup/chunk-ADHLA6ZD.js
13195
+ // ../rivetkit/dist/tsup/chunk-U7WHTSF2.js
13196
13196
  var cbor = __toESM(require("cbor-x"), 1);
13197
13197
  var import_invariant = __toESM(require_invariant(), 1);
13198
13198
  var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
@@ -13211,6 +13211,10 @@ var getRivetRunEnginePort = () => {
13211
13211
  return value !== void 0 ? parseInt(value, 10) : void 0;
13212
13212
  };
13213
13213
  var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
13214
+ var getRivetRunServices = () => {
13215
+ const value = getEnvUniversal("RIVET_RUN_SERVICES");
13216
+ return value === void 0 ? void 0 : value === "1";
13217
+ };
13214
13218
  var getRivetEnvoyVersion = () => {
13215
13219
  const value = getEnvUniversal("RIVET_ENVOY_VERSION");
13216
13220
  return value !== void 0 ? parseInt(value, 10) : void 0;
@@ -13362,7 +13366,7 @@ function noopNext() {
13362
13366
  }
13363
13367
  var package_default = {
13364
13368
  name: "rivetkit",
13365
- version: "0.0.0-main.b2d3b94",
13369
+ version: "0.0.0-raw-fetch-retry.e47ce6c",
13366
13370
  description: "Lightweight libraries for building stateful actors on edge platforms",
13367
13371
  license: "Apache-2.0",
13368
13372
  keywords: [
@@ -13572,6 +13576,7 @@ var package_default = {
13572
13576
  dependencies: {
13573
13577
  "@hono/zod-openapi": "^1.1.5",
13574
13578
  "@rivet-dev/agent-os-core": "^0.1.1",
13579
+ "@rivet-dev/services": "^0.1.5",
13575
13580
  "@rivetkit/bare-ts": "^0.6.2",
13576
13581
  "@rivetkit/engine-cli": "workspace:*",
13577
13582
  "@rivetkit/engine-envoy-protocol": "workspace:*",
@@ -14665,7 +14670,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
14665
14670
  };
14666
14671
  }
14667
14672
 
14668
- // ../rivetkit/dist/tsup/chunk-ODZI35CD.js
14673
+ // ../rivetkit/dist/tsup/chunk-7W33MURU.js
14669
14674
  var config2 = /* @__PURE__ */ Config({});
14670
14675
  function readWorkflowCbor(bc) {
14671
14676
  return readData(bc);
@@ -15544,44 +15549,6 @@ function removePrefixFromKey(prefixedKey) {
15544
15549
  return prefixedKey.slice(KEYS.KV.length);
15545
15550
  }
15546
15551
 
15547
- // ../rivetkit/dist/tsup/chunk-BBQJVQXT.js
15548
- function logger() {
15549
- return getLogger("actor-client");
15550
- }
15551
- var webSocketPromise = null;
15552
- async function importWebSocket() {
15553
- if (webSocketPromise !== null) {
15554
- return webSocketPromise;
15555
- }
15556
- webSocketPromise = (async () => {
15557
- let _WebSocket;
15558
- if (typeof WebSocket !== "undefined") {
15559
- _WebSocket = WebSocket;
15560
- } else {
15561
- try {
15562
- const moduleName = "ws";
15563
- const ws = await import(
15564
- /* webpackIgnore: true */
15565
- moduleName
15566
- );
15567
- _WebSocket = ws.default;
15568
- logger().debug("using websocket from npm");
15569
- } catch {
15570
- _WebSocket = class MockWebSocket {
15571
- constructor() {
15572
- throw new Error(
15573
- 'WebSocket support requires installing the "ws" peer dependency.'
15574
- );
15575
- }
15576
- };
15577
- logger().debug("using mock websocket");
15578
- }
15579
- }
15580
- return _WebSocket;
15581
- })();
15582
- return webSocketPromise;
15583
- }
15584
-
15585
15552
  // ../rivetkit/dist/tsup/chunk-JTHHCZCZ.js
15586
15553
  var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
15587
15554
  function isManualTransactionControl(query) {
@@ -15665,7 +15632,45 @@ var AsyncMutex = class {
15665
15632
  }
15666
15633
  };
15667
15634
 
15668
- // ../rivetkit/dist/tsup/chunk-5G3T73UZ.js
15635
+ // ../rivetkit/dist/tsup/chunk-LK2F7O6C.js
15636
+ function logger() {
15637
+ return getLogger("actor-client");
15638
+ }
15639
+ var webSocketPromise = null;
15640
+ async function importWebSocket() {
15641
+ if (webSocketPromise !== null) {
15642
+ return webSocketPromise;
15643
+ }
15644
+ webSocketPromise = (async () => {
15645
+ let _WebSocket;
15646
+ if (typeof WebSocket !== "undefined") {
15647
+ _WebSocket = WebSocket;
15648
+ } else {
15649
+ try {
15650
+ const moduleName = "ws";
15651
+ const ws = await import(
15652
+ /* webpackIgnore: true */
15653
+ moduleName
15654
+ );
15655
+ _WebSocket = ws.default;
15656
+ logger().debug("using websocket from npm");
15657
+ } catch {
15658
+ _WebSocket = class MockWebSocket {
15659
+ constructor() {
15660
+ throw new Error(
15661
+ 'WebSocket support requires installing the "ws" peer dependency.'
15662
+ );
15663
+ }
15664
+ };
15665
+ logger().debug("using mock websocket");
15666
+ }
15667
+ }
15668
+ return _WebSocket;
15669
+ })();
15670
+ return webSocketPromise;
15671
+ }
15672
+
15673
+ // ../rivetkit/dist/tsup/chunk-MBUT2LVA.js
15669
15674
  var import_invariant2 = __toESM(require_invariant(), 1);
15670
15675
 
15671
15676
  // ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
@@ -15843,7 +15848,7 @@ function createVersionedDataHandler(config3) {
15843
15848
  return new VersionedDataHandler(config3);
15844
15849
  }
15845
15850
 
15846
- // ../rivetkit/dist/tsup/chunk-5G3T73UZ.js
15851
+ // ../rivetkit/dist/tsup/chunk-MBUT2LVA.js
15847
15852
  var import_invariant3 = __toESM(require_invariant(), 1);
15848
15853
  var import_invariant4 = __toESM(require_invariant(), 1);
15849
15854
  var PATH_CONNECT = "/connect";
@@ -18348,6 +18353,12 @@ function createQueueSender(senderOptions) {
18348
18353
  send
18349
18354
  };
18350
18355
  }
18356
+ function cloneFetchInput(input) {
18357
+ if (!isRequestLike(input)) {
18358
+ return input;
18359
+ }
18360
+ return input.clone();
18361
+ }
18351
18362
  async function rawHttpFetch(driver, target, params, input, init, options = {}) {
18352
18363
  let path2;
18353
18364
  let originalUrl;
@@ -18531,7 +18542,9 @@ var ActorHandleRaw = class {
18531
18542
  async #sendQueueMessage(name, body, options) {
18532
18543
  return await this.#queueSendMutex.run(async () => {
18533
18544
  const maxAttempts = this.#getDynamicQueryMaxAttempts();
18534
- let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
18545
+ let useQueryTarget = isDynamicActorQuery(
18546
+ this.#actorResolutionState
18547
+ );
18535
18548
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
18536
18549
  let actorId;
18537
18550
  try {
@@ -18902,7 +18915,7 @@ var ActorHandleRaw = class {
18902
18915
  this.#driver,
18903
18916
  target,
18904
18917
  this.#params,
18905
- input,
18918
+ cloneFetchInput(input),
18906
18919
  requestInit,
18907
18920
  gatewayOptions
18908
18921
  );
@@ -21613,7 +21626,7 @@ function apiActorToOutput(actor2) {
21613
21626
  };
21614
21627
  }
21615
21628
 
21616
- // ../rivetkit/dist/tsup/chunk-B5MBSXX6.js
21629
+ // ../rivetkit/dist/tsup/chunk-6ASFV6WK.js
21617
21630
  var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
21618
21631
  var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
21619
21632
  function registerNativeStateTransactionOpener(provider, opener) {
@@ -23689,6 +23702,12 @@ var RegistryConfigSchema = external_exports.object({
23689
23702
  enginePort: external_exports.number().int().min(1).max(65535).optional().default(() => getRivetRunEnginePort() ?? ENGINE_PORT),
23690
23703
  /** @experimental */
23691
23704
  engineVersion: external_exports.string().optional().default(() => getRivetRunEngineVersion() ?? VERSION),
23705
+ /**
23706
+ * Starts the first-party Services actor host when RivetKit manages
23707
+ * a local engine. Defaults to the local-engine decision. Set
23708
+ * RIVET_RUN_SERVICES=0 or 1 to override it.
23709
+ */
23710
+ startServices: external_exports.boolean().optional(),
23692
23711
  /**
23693
23712
  * @experimental
23694
23713
  *
@@ -23769,6 +23788,7 @@ var RegistryConfigSchema = external_exports.object({
23769
23788
  config3.enginePort
23770
23789
  );
23771
23790
  const endpoint = config3.startEngine ? localEngineEndpoint : (parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint) ?? (isDevEnv ? localEngineEndpoint : void 0);
23791
+ const startServices = config3.startServices ?? getRivetRunServices() ?? Boolean(endpoint && isLocalEngineEndpoint(endpoint));
23772
23792
  const validateServerlessEndpoint = Boolean(
23773
23793
  config3.startEngine || parsedEndpoint
23774
23794
  );
@@ -23792,6 +23812,7 @@ var RegistryConfigSchema = external_exports.object({
23792
23812
  ...config3,
23793
23813
  sqlite,
23794
23814
  endpoint,
23815
+ startServices,
23795
23816
  namespace,
23796
23817
  token,
23797
23818
  publicEndpoint,
@@ -23905,6 +23926,9 @@ var DocRegistryConfigSchema = external_exports.object({
23905
23926
  engineVersion: external_exports.string().optional().describe(
23906
23927
  "Version of the local engine package to use. Defaults to the current RivetKit version."
23907
23928
  ),
23929
+ startServices: external_exports.boolean().optional().describe(
23930
+ "Starts Services when RivetKit manages a local Engine. Defaults to the local-Engine decision. Set RIVET_RUN_SERVICES=0 or 1 to override."
23931
+ ),
23908
23932
  configurePool: DocConfigurePoolSchema.describe(
23909
23933
  "Automatically configure serverless runners in the engine."
23910
23934
  ),
@@ -25048,7 +25072,9 @@ async function pumpResponseBody(reader, stream) {
25048
25072
  const result = await Promise.race([read, cancelled]);
25049
25073
  if (result.cancelled) {
25050
25074
  void reader.cancel(
25051
- new Error("native http response stream receiver dropped")
25075
+ new Error(
25076
+ "native http response stream receiver dropped"
25077
+ )
25052
25078
  ).catch((error46) => {
25053
25079
  logger22().debug({
25054
25080
  msg: "failed to cancel native http response reader",
@@ -26613,6 +26639,9 @@ function decodeNativeKvValue(value, options) {
26613
26639
  async function loadEngineCli() {
26614
26640
  return import(["@rivetkit", "engine-cli"].join("/"));
26615
26641
  }
26642
+ async function loadServices() {
26643
+ return import(["@rivet-dev", "services"].join("/"));
26644
+ }
26616
26645
  function decodeValue(value) {
26617
26646
  if (!value || value.length === 0) {
26618
26647
  return void 0;
@@ -29990,7 +30019,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
29990
30019
  buildActorConfig(definition, registryConfig, runtime.kind)
29991
30020
  );
29992
30021
  }
29993
- async function buildServeConfig(config3) {
30022
+ async function buildServeConfig(config3, resolveServicesBinary = true) {
29994
30023
  var _a2;
29995
30024
  if (!config3.endpoint) {
29996
30025
  throw nativeEndpointNotConfiguredError();
@@ -30001,6 +30030,7 @@ async function buildServeConfig(config3) {
30001
30030
  token: config3.token,
30002
30031
  namespace: config3.namespace,
30003
30032
  poolName: config3.envoy.poolName,
30033
+ startServices: resolveServicesBinary && config3.startServices,
30004
30034
  handleInspectorHttpInRuntime: true,
30005
30035
  serverlessBasePath: config3.serverless.basePath,
30006
30036
  serverlessPackageVersion: VERSION,
@@ -30019,6 +30049,17 @@ async function buildServeConfig(config3) {
30019
30049
  error: stringifyError(error46)
30020
30050
  });
30021
30051
  }
30052
+ if (resolveServicesBinary && config3.startServices) {
30053
+ try {
30054
+ const { getServicesPath } = await loadServices();
30055
+ serveConfig.servicesBinaryPath = getServicesPath();
30056
+ } catch (error46) {
30057
+ logger22().warn({
30058
+ msg: "could not resolve the Services binary; a local engine will fail with services.binary_unavailable \u2014 set RIVET_RUN_SERVICES=0 to disable Services or RIVET_SERVICES_BINARY to a local rivet-services binary",
30059
+ error: stringifyError(error46)
30060
+ });
30061
+ }
30062
+ }
30022
30063
  serveConfig.engineHost = config3.engineHost;
30023
30064
  serveConfig.enginePort = config3.enginePort;
30024
30065
  if ((_a2 = config3.test) == null ? void 0 : _a2.enabled) {
@@ -30045,7 +30086,7 @@ async function buildRegistryWithRuntime(config3, runtime) {
30045
30086
  return {
30046
30087
  runtime,
30047
30088
  registry: registry2,
30048
- serveConfig: await buildServeConfig(config3)
30089
+ serveConfig: await buildServeConfig(config3, runtime.kind === "napi")
30049
30090
  };
30050
30091
  }
30051
30092
  async function buildConfiguredRegistry(config3) {
@@ -30413,10 +30454,7 @@ var Registry = class {
30413
30454
  "registry envoy serve lifecycle did not initialize"
30414
30455
  );
30415
30456
  }
30416
- await Promise.all([
30417
- listenerPromise,
30418
- serveLifecyclePromise
30419
- ]);
30457
+ await Promise.all([listenerPromise, serveLifecyclePromise]);
30420
30458
  return;
30421
30459
  }
30422
30460
  const configuredRegistryPromise = this.#buildConfiguredRegistry(config3);
package/dist/mod.mjs CHANGED
@@ -297,7 +297,7 @@ var require_retry2 = __commonJS({
297
297
  // src/mod.ts
298
298
  import * as wasmBindings from "@rivetkit/rivetkit-wasm";
299
299
 
300
- // ../rivetkit/dist/tsup/chunk-IXBD7BXC.js
300
+ // ../rivetkit/dist/tsup/chunk-OUQUIBVW.js
301
301
  var INTERNAL_ERROR_CODE = "internal_error";
302
302
  var INTERNAL_ERROR_DESCRIPTION = "An internal error occurred";
303
303
  var USER_ERROR_CODE = "user_error";
@@ -481,7 +481,7 @@ function unsupportedFeature(feature) {
481
481
  );
482
482
  }
483
483
 
484
- // ../rivetkit/dist/tsup/chunk-ADHLA6ZD.js
484
+ // ../rivetkit/dist/tsup/chunk-U7WHTSF2.js
485
485
  import {
486
486
  pino,
487
487
  stdTimeFunctions
@@ -13157,7 +13157,7 @@ var classic_default = external_exports;
13157
13157
  // ../../../node_modules/.pnpm/zod@4.1.13/node_modules/zod/v4/index.js
13158
13158
  var v4_default = classic_default;
13159
13159
 
13160
- // ../rivetkit/dist/tsup/chunk-ADHLA6ZD.js
13160
+ // ../rivetkit/dist/tsup/chunk-U7WHTSF2.js
13161
13161
  var import_invariant = __toESM(require_invariant(), 1);
13162
13162
  import * as cbor from "cbor-x";
13163
13163
  var getRivetEngine = () => getEnvUniversal("RIVET_ENGINE");
@@ -13176,6 +13176,10 @@ var getRivetRunEnginePort = () => {
13176
13176
  return value !== void 0 ? parseInt(value, 10) : void 0;
13177
13177
  };
13178
13178
  var getRivetRunEngineVersion = () => getEnvUniversal("RIVET_RUN_ENGINE_VERSION");
13179
+ var getRivetRunServices = () => {
13180
+ const value = getEnvUniversal("RIVET_RUN_SERVICES");
13181
+ return value === void 0 ? void 0 : value === "1";
13182
+ };
13179
13183
  var getRivetEnvoyVersion = () => {
13180
13184
  const value = getEnvUniversal("RIVET_ENVOY_VERSION");
13181
13185
  return value !== void 0 ? parseInt(value, 10) : void 0;
@@ -13327,7 +13331,7 @@ function noopNext() {
13327
13331
  }
13328
13332
  var package_default = {
13329
13333
  name: "rivetkit",
13330
- version: "0.0.0-main.b2d3b94",
13334
+ version: "0.0.0-raw-fetch-retry.e47ce6c",
13331
13335
  description: "Lightweight libraries for building stateful actors on edge platforms",
13332
13336
  license: "Apache-2.0",
13333
13337
  keywords: [
@@ -13537,6 +13541,7 @@ var package_default = {
13537
13541
  dependencies: {
13538
13542
  "@hono/zod-openapi": "^1.1.5",
13539
13543
  "@rivet-dev/agent-os-core": "^0.1.1",
13544
+ "@rivet-dev/services": "^0.1.5",
13540
13545
  "@rivetkit/bare-ts": "^0.6.2",
13541
13546
  "@rivetkit/engine-cli": "workspace:*",
13542
13547
  "@rivetkit/engine-envoy-protocol": "workspace:*",
@@ -14630,7 +14635,7 @@ function Config({ initialBufferLength = 1024, maxBufferLength = 1024 * 1024 * 32
14630
14635
  };
14631
14636
  }
14632
14637
 
14633
- // ../rivetkit/dist/tsup/chunk-ODZI35CD.js
14638
+ // ../rivetkit/dist/tsup/chunk-7W33MURU.js
14634
14639
  var config2 = /* @__PURE__ */ Config({});
14635
14640
  function readWorkflowCbor(bc) {
14636
14641
  return readData(bc);
@@ -15509,44 +15514,6 @@ function removePrefixFromKey(prefixedKey) {
15509
15514
  return prefixedKey.slice(KEYS.KV.length);
15510
15515
  }
15511
15516
 
15512
- // ../rivetkit/dist/tsup/chunk-BBQJVQXT.js
15513
- function logger() {
15514
- return getLogger("actor-client");
15515
- }
15516
- var webSocketPromise = null;
15517
- async function importWebSocket() {
15518
- if (webSocketPromise !== null) {
15519
- return webSocketPromise;
15520
- }
15521
- webSocketPromise = (async () => {
15522
- let _WebSocket;
15523
- if (typeof WebSocket !== "undefined") {
15524
- _WebSocket = WebSocket;
15525
- } else {
15526
- try {
15527
- const moduleName = "ws";
15528
- const ws = await import(
15529
- /* webpackIgnore: true */
15530
- moduleName
15531
- );
15532
- _WebSocket = ws.default;
15533
- logger().debug("using websocket from npm");
15534
- } catch {
15535
- _WebSocket = class MockWebSocket {
15536
- constructor() {
15537
- throw new Error(
15538
- 'WebSocket support requires installing the "ws" peer dependency.'
15539
- );
15540
- }
15541
- };
15542
- logger().debug("using mock websocket");
15543
- }
15544
- }
15545
- return _WebSocket;
15546
- })();
15547
- return webSocketPromise;
15548
- }
15549
-
15550
15517
  // ../rivetkit/dist/tsup/chunk-JTHHCZCZ.js
15551
15518
  var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
15552
15519
  function isManualTransactionControl(query) {
@@ -15630,7 +15597,45 @@ var AsyncMutex = class {
15630
15597
  }
15631
15598
  };
15632
15599
 
15633
- // ../rivetkit/dist/tsup/chunk-5G3T73UZ.js
15600
+ // ../rivetkit/dist/tsup/chunk-LK2F7O6C.js
15601
+ function logger() {
15602
+ return getLogger("actor-client");
15603
+ }
15604
+ var webSocketPromise = null;
15605
+ async function importWebSocket() {
15606
+ if (webSocketPromise !== null) {
15607
+ return webSocketPromise;
15608
+ }
15609
+ webSocketPromise = (async () => {
15610
+ let _WebSocket;
15611
+ if (typeof WebSocket !== "undefined") {
15612
+ _WebSocket = WebSocket;
15613
+ } else {
15614
+ try {
15615
+ const moduleName = "ws";
15616
+ const ws = await import(
15617
+ /* webpackIgnore: true */
15618
+ moduleName
15619
+ );
15620
+ _WebSocket = ws.default;
15621
+ logger().debug("using websocket from npm");
15622
+ } catch {
15623
+ _WebSocket = class MockWebSocket {
15624
+ constructor() {
15625
+ throw new Error(
15626
+ 'WebSocket support requires installing the "ws" peer dependency.'
15627
+ );
15628
+ }
15629
+ };
15630
+ logger().debug("using mock websocket");
15631
+ }
15632
+ }
15633
+ return _WebSocket;
15634
+ })();
15635
+ return webSocketPromise;
15636
+ }
15637
+
15638
+ // ../rivetkit/dist/tsup/chunk-MBUT2LVA.js
15634
15639
  var import_invariant2 = __toESM(require_invariant(), 1);
15635
15640
 
15636
15641
  // ../../../node_modules/.pnpm/p-retry@6.2.1/node_modules/p-retry/index.js
@@ -15808,7 +15813,7 @@ function createVersionedDataHandler(config3) {
15808
15813
  return new VersionedDataHandler(config3);
15809
15814
  }
15810
15815
 
15811
- // ../rivetkit/dist/tsup/chunk-5G3T73UZ.js
15816
+ // ../rivetkit/dist/tsup/chunk-MBUT2LVA.js
15812
15817
  var import_invariant3 = __toESM(require_invariant(), 1);
15813
15818
  var import_invariant4 = __toESM(require_invariant(), 1);
15814
15819
  var PATH_CONNECT = "/connect";
@@ -18313,6 +18318,12 @@ function createQueueSender(senderOptions) {
18313
18318
  send
18314
18319
  };
18315
18320
  }
18321
+ function cloneFetchInput(input) {
18322
+ if (!isRequestLike(input)) {
18323
+ return input;
18324
+ }
18325
+ return input.clone();
18326
+ }
18316
18327
  async function rawHttpFetch(driver, target, params, input, init, options = {}) {
18317
18328
  let path2;
18318
18329
  let originalUrl;
@@ -18496,7 +18507,9 @@ var ActorHandleRaw = class {
18496
18507
  async #sendQueueMessage(name, body, options) {
18497
18508
  return await this.#queueSendMutex.run(async () => {
18498
18509
  const maxAttempts = this.#getDynamicQueryMaxAttempts();
18499
- let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
18510
+ let useQueryTarget = isDynamicActorQuery(
18511
+ this.#actorResolutionState
18512
+ );
18500
18513
  for (let attempt = 0; attempt < maxAttempts; attempt++) {
18501
18514
  let actorId;
18502
18515
  try {
@@ -18867,7 +18880,7 @@ var ActorHandleRaw = class {
18867
18880
  this.#driver,
18868
18881
  target,
18869
18882
  this.#params,
18870
- input,
18883
+ cloneFetchInput(input),
18871
18884
  requestInit,
18872
18885
  gatewayOptions
18873
18886
  );
@@ -21578,7 +21591,7 @@ function apiActorToOutput(actor2) {
21578
21591
  };
21579
21592
  }
21580
21593
 
21581
- // ../rivetkit/dist/tsup/chunk-B5MBSXX6.js
21594
+ // ../rivetkit/dist/tsup/chunk-6ASFV6WK.js
21582
21595
  var nativeStateTransactionOpeners = /* @__PURE__ */ new WeakMap();
21583
21596
  var nativeStateTransactionClientBinders = /* @__PURE__ */ new WeakMap();
21584
21597
  function registerNativeStateTransactionOpener(provider, opener) {
@@ -23654,6 +23667,12 @@ var RegistryConfigSchema = external_exports.object({
23654
23667
  enginePort: external_exports.number().int().min(1).max(65535).optional().default(() => getRivetRunEnginePort() ?? ENGINE_PORT),
23655
23668
  /** @experimental */
23656
23669
  engineVersion: external_exports.string().optional().default(() => getRivetRunEngineVersion() ?? VERSION),
23670
+ /**
23671
+ * Starts the first-party Services actor host when RivetKit manages
23672
+ * a local engine. Defaults to the local-engine decision. Set
23673
+ * RIVET_RUN_SERVICES=0 or 1 to override it.
23674
+ */
23675
+ startServices: external_exports.boolean().optional(),
23657
23676
  /**
23658
23677
  * @experimental
23659
23678
  *
@@ -23734,6 +23753,7 @@ var RegistryConfigSchema = external_exports.object({
23734
23753
  config3.enginePort
23735
23754
  );
23736
23755
  const endpoint = config3.startEngine ? localEngineEndpoint : (parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint) ?? (isDevEnv ? localEngineEndpoint : void 0);
23756
+ const startServices = config3.startServices ?? getRivetRunServices() ?? Boolean(endpoint && isLocalEngineEndpoint(endpoint));
23737
23757
  const validateServerlessEndpoint = Boolean(
23738
23758
  config3.startEngine || parsedEndpoint
23739
23759
  );
@@ -23757,6 +23777,7 @@ var RegistryConfigSchema = external_exports.object({
23757
23777
  ...config3,
23758
23778
  sqlite,
23759
23779
  endpoint,
23780
+ startServices,
23760
23781
  namespace,
23761
23782
  token,
23762
23783
  publicEndpoint,
@@ -23870,6 +23891,9 @@ var DocRegistryConfigSchema = external_exports.object({
23870
23891
  engineVersion: external_exports.string().optional().describe(
23871
23892
  "Version of the local engine package to use. Defaults to the current RivetKit version."
23872
23893
  ),
23894
+ startServices: external_exports.boolean().optional().describe(
23895
+ "Starts Services when RivetKit manages a local Engine. Defaults to the local-Engine decision. Set RIVET_RUN_SERVICES=0 or 1 to override."
23896
+ ),
23873
23897
  configurePool: DocConfigurePoolSchema.describe(
23874
23898
  "Automatically configure serverless runners in the engine."
23875
23899
  ),
@@ -25013,7 +25037,9 @@ async function pumpResponseBody(reader, stream) {
25013
25037
  const result = await Promise.race([read, cancelled]);
25014
25038
  if (result.cancelled) {
25015
25039
  void reader.cancel(
25016
- new Error("native http response stream receiver dropped")
25040
+ new Error(
25041
+ "native http response stream receiver dropped"
25042
+ )
25017
25043
  ).catch((error46) => {
25018
25044
  logger22().debug({
25019
25045
  msg: "failed to cancel native http response reader",
@@ -26578,6 +26604,9 @@ function decodeNativeKvValue(value, options) {
26578
26604
  async function loadEngineCli() {
26579
26605
  return import(["@rivetkit", "engine-cli"].join("/"));
26580
26606
  }
26607
+ async function loadServices() {
26608
+ return import(["@rivet-dev", "services"].join("/"));
26609
+ }
26581
26610
  function decodeValue(value) {
26582
26611
  if (!value || value.length === 0) {
26583
26612
  return void 0;
@@ -29955,7 +29984,7 @@ function buildNativeFactory(runtime, registryConfig, definition) {
29955
29984
  buildActorConfig(definition, registryConfig, runtime.kind)
29956
29985
  );
29957
29986
  }
29958
- async function buildServeConfig(config3) {
29987
+ async function buildServeConfig(config3, resolveServicesBinary = true) {
29959
29988
  var _a2;
29960
29989
  if (!config3.endpoint) {
29961
29990
  throw nativeEndpointNotConfiguredError();
@@ -29966,6 +29995,7 @@ async function buildServeConfig(config3) {
29966
29995
  token: config3.token,
29967
29996
  namespace: config3.namespace,
29968
29997
  poolName: config3.envoy.poolName,
29998
+ startServices: resolveServicesBinary && config3.startServices,
29969
29999
  handleInspectorHttpInRuntime: true,
29970
30000
  serverlessBasePath: config3.serverless.basePath,
29971
30001
  serverlessPackageVersion: VERSION,
@@ -29984,6 +30014,17 @@ async function buildServeConfig(config3) {
29984
30014
  error: stringifyError(error46)
29985
30015
  });
29986
30016
  }
30017
+ if (resolveServicesBinary && config3.startServices) {
30018
+ try {
30019
+ const { getServicesPath } = await loadServices();
30020
+ serveConfig.servicesBinaryPath = getServicesPath();
30021
+ } catch (error46) {
30022
+ logger22().warn({
30023
+ msg: "could not resolve the Services binary; a local engine will fail with services.binary_unavailable \u2014 set RIVET_RUN_SERVICES=0 to disable Services or RIVET_SERVICES_BINARY to a local rivet-services binary",
30024
+ error: stringifyError(error46)
30025
+ });
30026
+ }
30027
+ }
29987
30028
  serveConfig.engineHost = config3.engineHost;
29988
30029
  serveConfig.enginePort = config3.enginePort;
29989
30030
  if ((_a2 = config3.test) == null ? void 0 : _a2.enabled) {
@@ -30010,7 +30051,7 @@ async function buildRegistryWithRuntime(config3, runtime) {
30010
30051
  return {
30011
30052
  runtime,
30012
30053
  registry: registry2,
30013
- serveConfig: await buildServeConfig(config3)
30054
+ serveConfig: await buildServeConfig(config3, runtime.kind === "napi")
30014
30055
  };
30015
30056
  }
30016
30057
  async function buildConfiguredRegistry(config3) {
@@ -30378,10 +30419,7 @@ var Registry = class {
30378
30419
  "registry envoy serve lifecycle did not initialize"
30379
30420
  );
30380
30421
  }
30381
- await Promise.all([
30382
- listenerPromise,
30383
- serveLifecyclePromise
30384
- ]);
30422
+ await Promise.all([listenerPromise, serveLifecyclePromise]);
30385
30423
  return;
30386
30424
  }
30387
30425
  const configuredRegistryPromise = this.#buildConfiguredRegistry(config3);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/supabase",
3
- "version": "0.0.0-main.b2d3b94",
3
+ "version": "0.0.0-raw-fetch-retry.e47ce6c",
4
4
  "description": "Supabase Edge Functions integration for RivetKit actors",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
@@ -39,14 +39,14 @@
39
39
  "check-edge-closure": "node ../../../scripts/ci/check-edge-native-closure.mjs"
40
40
  },
41
41
  "dependencies": {
42
- "@rivetkit/rivetkit-wasm": "0.0.0-main.b2d3b94",
42
+ "@rivetkit/rivetkit-wasm": "0.0.0-raw-fetch-retry.e47ce6c",
43
43
  "cbor-x": "^1.6.0",
44
44
  "pino": "^9.5.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@size-limit/file": "^11.1.6",
48
48
  "@types/node": "^22.0.0",
49
- "rivetkit": "0.0.0-main.b2d3b94",
49
+ "rivetkit": "0.0.0-raw-fetch-retry.e47ce6c",
50
50
  "size-limit": "^11.1.6",
51
51
  "tsup": "^8.4.0",
52
52
  "typescript": "^5.5.2"