rivetkit 2.0.35 → 2.0.36
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.
- package/dist/tsup/actor/errors.cjs +6 -2
- package/dist/tsup/actor/errors.cjs.map +1 -1
- package/dist/tsup/actor/errors.d.cts +7 -1
- package/dist/tsup/actor/errors.d.ts +7 -1
- package/dist/tsup/actor/errors.js +5 -1
- package/dist/tsup/{chunk-6KPMUCTX.js → chunk-2YHR67M4.js} +26 -2
- package/dist/tsup/{chunk-6KPMUCTX.js.map → chunk-2YHR67M4.js.map} +1 -1
- package/dist/tsup/{chunk-OAGIXNOC.cjs → chunk-65O3MUPO.cjs} +9 -9
- package/dist/tsup/{chunk-OAGIXNOC.cjs.map → chunk-65O3MUPO.cjs.map} +1 -1
- package/dist/tsup/{chunk-SKOXACQD.cjs → chunk-6TLJAB64.cjs} +223 -269
- package/dist/tsup/chunk-6TLJAB64.cjs.map +1 -0
- package/dist/tsup/{chunk-6N4L6DVT.cjs → chunk-7EGXCVJL.cjs} +49 -49
- package/dist/tsup/{chunk-6N4L6DVT.cjs.map → chunk-7EGXCVJL.cjs.map} +1 -1
- package/dist/tsup/{chunk-2PH6FNGI.js → chunk-D35UUQOR.js} +2 -2
- package/dist/tsup/{chunk-PSMT24GX.js → chunk-DSPZ7BZN.js} +96 -6
- package/dist/tsup/chunk-DSPZ7BZN.js.map +1 -0
- package/dist/tsup/{chunk-UQPTBQYY.js → chunk-EO5JABFU.js} +46 -35
- package/dist/tsup/chunk-EO5JABFU.js.map +1 -0
- package/dist/tsup/{chunk-ESNM74WZ.js → chunk-KJLJLNHR.js} +273 -319
- package/dist/tsup/chunk-KJLJLNHR.js.map +1 -0
- package/dist/tsup/{chunk-3BUVMAPG.cjs → chunk-OYJU4B2I.cjs} +130 -119
- package/dist/tsup/chunk-OYJU4B2I.cjs.map +1 -0
- package/dist/tsup/{chunk-QY2XOK33.cjs → chunk-RTSLQIZ5.cjs} +355 -265
- package/dist/tsup/chunk-RTSLQIZ5.cjs.map +1 -0
- package/dist/tsup/{chunk-FWT2BTVT.cjs → chunk-SNAUKDDK.cjs} +26 -2
- package/dist/tsup/chunk-SNAUKDDK.cjs.map +1 -0
- package/dist/tsup/{chunk-UCUYH474.js → chunk-UDKWYSU3.js} +7 -3
- package/dist/tsup/chunk-UDKWYSU3.js.map +1 -0
- package/dist/tsup/{chunk-RLJYDDGJ.cjs → chunk-VIUUUBXQ.cjs} +3 -3
- package/dist/tsup/{chunk-RLJYDDGJ.cjs.map → chunk-VIUUUBXQ.cjs.map} +1 -1
- package/dist/tsup/{chunk-6KXKY3IE.cjs → chunk-WRYYREBN.cjs} +13 -9
- package/dist/tsup/chunk-WRYYREBN.cjs.map +1 -0
- package/dist/tsup/{chunk-W3X2CC5D.js → chunk-X5GKJWTG.js} +5 -5
- package/dist/tsup/{chunk-S4TG6JFA.js → chunk-Z5CSXFVY.js} +5 -5
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +8 -8
- package/dist/tsup/client/mod.d.ts +8 -8
- package/dist/tsup/client/mod.js +5 -5
- package/dist/tsup/common/log.cjs +3 -3
- package/dist/tsup/common/log.js +2 -2
- package/dist/tsup/common/websocket.cjs +4 -4
- package/dist/tsup/common/websocket.js +3 -3
- package/dist/tsup/{config-Qr8_jvK3.d.cts → config--NjwiYlS.d.cts} +24 -25
- package/dist/tsup/{config-DRt_4bDk.d.ts → config-CRuzI6n4.d.ts} +24 -25
- package/dist/tsup/{driver-zNEhBkiK.d.ts → driver-BcmckRaF.d.ts} +1 -1
- package/dist/tsup/driver-helpers/mod.cjs +4 -4
- package/dist/tsup/driver-helpers/mod.d.cts +2 -2
- package/dist/tsup/driver-helpers/mod.d.ts +2 -2
- package/dist/tsup/driver-helpers/mod.js +3 -3
- package/dist/tsup/driver-test-suite/mod.cjs +37 -37
- package/dist/tsup/driver-test-suite/mod.cjs.map +1 -1
- package/dist/tsup/driver-test-suite/mod.d.cts +2 -2
- package/dist/tsup/driver-test-suite/mod.d.ts +2 -2
- package/dist/tsup/driver-test-suite/mod.js +9 -9
- package/dist/tsup/{driver-D6heoKxK.d.cts → driver-yKjYx9Yy.d.cts} +1 -1
- package/dist/tsup/mod.cjs +8 -8
- package/dist/tsup/mod.d.cts +4 -4
- package/dist/tsup/mod.d.ts +4 -4
- package/dist/tsup/mod.js +7 -7
- package/dist/tsup/test/mod.cjs +8 -8
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +7 -7
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.js +2 -2
- package/package.json +3 -3
- package/src/actor/errors.ts +24 -0
- package/src/client/config.ts +54 -48
- package/src/common/router.ts +12 -0
- package/src/drivers/engine/config.ts +6 -3
- package/src/globals.d.ts +1 -0
- package/src/manager/router.ts +8 -1
- package/src/registry/config/index.ts +98 -90
- package/src/registry/config/serverless.ts +34 -3
- package/src/remote-manager-driver/api-utils.ts +3 -0
- package/src/serverless/router.ts +24 -2
- package/src/utils/endpoint-parser.test.ts +184 -171
- package/src/utils/endpoint-parser.ts +70 -65
- package/src/utils/env-vars.ts +6 -0
- package/dist/tsup/chunk-3BUVMAPG.cjs.map +0 -1
- package/dist/tsup/chunk-6KXKY3IE.cjs.map +0 -1
- package/dist/tsup/chunk-ESNM74WZ.js.map +0 -1
- package/dist/tsup/chunk-FWT2BTVT.cjs.map +0 -1
- package/dist/tsup/chunk-PSMT24GX.js.map +0 -1
- package/dist/tsup/chunk-QY2XOK33.cjs.map +0 -1
- package/dist/tsup/chunk-SKOXACQD.cjs.map +0 -1
- package/dist/tsup/chunk-UCUYH474.js.map +0 -1
- package/dist/tsup/chunk-UQPTBQYY.js.map +0 -1
- /package/dist/tsup/{chunk-2PH6FNGI.js.map → chunk-D35UUQOR.js.map} +0 -0
- /package/dist/tsup/{chunk-W3X2CC5D.js.map → chunk-X5GKJWTG.js.map} +0 -0
- /package/dist/tsup/{chunk-S4TG6JFA.js.map → chunk-Z5CSXFVY.js.map} +0 -0
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
getRivetEndpoint,
|
|
16
16
|
getRivetEngine,
|
|
17
17
|
getRivetNamespace,
|
|
18
|
+
getRivetPublicEndpoint,
|
|
19
|
+
getRivetPublicToken,
|
|
18
20
|
getRivetRunEngine,
|
|
19
21
|
getRivetRunEngineVersion,
|
|
20
22
|
getRivetRunner,
|
|
@@ -29,7 +31,7 @@ import {
|
|
|
29
31
|
noopNext,
|
|
30
32
|
promiseWithResolvers,
|
|
31
33
|
stringifyError
|
|
32
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-UDKWYSU3.js";
|
|
33
35
|
import {
|
|
34
36
|
ConnStateNotEnabled,
|
|
35
37
|
Forbidden,
|
|
@@ -45,7 +47,7 @@ import {
|
|
|
45
47
|
Unreachable,
|
|
46
48
|
Unsupported,
|
|
47
49
|
WebSocketsNotEnabled
|
|
48
|
-
} from "./chunk-
|
|
50
|
+
} from "./chunk-2YHR67M4.js";
|
|
49
51
|
|
|
50
52
|
// src/common/actor-router-consts.ts
|
|
51
53
|
var PATH_CONNECT = "/connect";
|
|
@@ -83,8 +85,8 @@ var ALLOWED_PUBLIC_HEADERS = [
|
|
|
83
85
|
// src/manager/router.ts
|
|
84
86
|
import { createRoute } from "@hono/zod-openapi";
|
|
85
87
|
import * as cbor6 from "cbor-x";
|
|
86
|
-
import
|
|
87
|
-
import { z as
|
|
88
|
+
import invariant5 from "invariant";
|
|
89
|
+
import { z as z10 } from "zod";
|
|
88
90
|
|
|
89
91
|
// src/actor/keys.ts
|
|
90
92
|
var EMPTY_KEY = "/";
|
|
@@ -1626,153 +1628,14 @@ function getRequestConnParams(req) {
|
|
|
1626
1628
|
}
|
|
1627
1629
|
|
|
1628
1630
|
// src/registry/config/index.ts
|
|
1629
|
-
import
|
|
1630
|
-
import { z as z9 } from "zod";
|
|
1631
|
-
|
|
1632
|
-
// src/client/config.ts
|
|
1633
|
-
import z4 from "zod";
|
|
1634
|
-
|
|
1635
|
-
// src/utils/endpoint-parser.ts
|
|
1636
|
-
import { z as z3 } from "zod";
|
|
1637
|
-
function zodParseEndpoint(endpoint) {
|
|
1638
|
-
const url = new URL(endpoint);
|
|
1639
|
-
if (url.search) {
|
|
1640
|
-
throw new z3.ZodError([
|
|
1641
|
-
{
|
|
1642
|
-
code: "custom",
|
|
1643
|
-
message: "endpoint cannot contain a query string",
|
|
1644
|
-
path: ["endpoint"]
|
|
1645
|
-
}
|
|
1646
|
-
]);
|
|
1647
|
-
}
|
|
1648
|
-
if (url.hash) {
|
|
1649
|
-
throw new z3.ZodError([
|
|
1650
|
-
{
|
|
1651
|
-
code: "custom",
|
|
1652
|
-
message: "endpoint cannot contain a fragment",
|
|
1653
|
-
path: ["endpoint"]
|
|
1654
|
-
}
|
|
1655
|
-
]);
|
|
1656
|
-
}
|
|
1657
|
-
const namespace = url.username ? decodeURIComponent(url.username) : void 0;
|
|
1658
|
-
const token = url.password ? decodeURIComponent(url.password) : void 0;
|
|
1659
|
-
if (token && !namespace) {
|
|
1660
|
-
throw new z3.ZodError([
|
|
1661
|
-
{
|
|
1662
|
-
code: "custom",
|
|
1663
|
-
message: "endpoint cannot have a token without a namespace",
|
|
1664
|
-
path: ["endpoint"]
|
|
1665
|
-
}
|
|
1666
|
-
]);
|
|
1667
|
-
}
|
|
1668
|
-
url.username = "";
|
|
1669
|
-
url.password = "";
|
|
1670
|
-
const cleanedEndpoint = url.toString();
|
|
1671
|
-
return {
|
|
1672
|
-
endpoint: cleanedEndpoint,
|
|
1673
|
-
namespace,
|
|
1674
|
-
token
|
|
1675
|
-
};
|
|
1676
|
-
}
|
|
1677
|
-
var EndpointSchema = z3.string().transform((endpoint) => {
|
|
1678
|
-
return zodParseEndpoint(endpoint);
|
|
1679
|
-
});
|
|
1680
|
-
function zodCheckDuplicateCredentials(resolvedEndpoint, config6, ctx) {
|
|
1681
|
-
if (resolvedEndpoint.namespace && config6.namespace) {
|
|
1682
|
-
ctx.addIssue({
|
|
1683
|
-
code: "custom",
|
|
1684
|
-
message: "cannot specify namespace both in endpoint URL and as a separate config option",
|
|
1685
|
-
path: ["namespace"]
|
|
1686
|
-
});
|
|
1687
|
-
}
|
|
1688
|
-
if (resolvedEndpoint.token && config6.token) {
|
|
1689
|
-
ctx.addIssue({
|
|
1690
|
-
code: "custom",
|
|
1691
|
-
message: "cannot specify token both in endpoint URL and as a separate config option",
|
|
1692
|
-
path: ["token"]
|
|
1693
|
-
});
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
// src/client/config.ts
|
|
1698
|
-
var ClientConfigSchemaBase = z4.object({
|
|
1699
|
-
/** Endpoint to connect to for Rivet Engine or RivetKit manager API. */
|
|
1700
|
-
endpoint: EndpointSchema.optional(),
|
|
1701
|
-
/** Token to use to authenticate with the API. */
|
|
1702
|
-
token: z4.string().optional(),
|
|
1703
|
-
/** Namespace to connect to. */
|
|
1704
|
-
namespace: z4.string().optional(),
|
|
1705
|
-
/** Name of the runner. This is used to group together runners in to different pools. */
|
|
1706
|
-
runnerName: z4.string().default(() => getRivetRunner() ?? "default"),
|
|
1707
|
-
encoding: EncodingSchema.default("bare"),
|
|
1708
|
-
headers: z4.record(z4.string(), z4.string()).optional().default(() => ({})),
|
|
1709
|
-
// See RunConfig.getUpgradeWebSocket
|
|
1710
|
-
//
|
|
1711
|
-
// This is required in the client config in order to support
|
|
1712
|
-
// `proxyWebSocket`
|
|
1713
|
-
getUpgradeWebSocket: z4.custom().optional(),
|
|
1714
|
-
/** Whether to automatically perform health checks when the client is created. */
|
|
1715
|
-
disableMetadataLookup: z4.boolean().optional().default(false),
|
|
1716
|
-
/** Whether to enable RivetKit Devtools integration. */
|
|
1717
|
-
devtools: z4.boolean().default(
|
|
1718
|
-
() => {
|
|
1719
|
-
var _a;
|
|
1720
|
-
return typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost";
|
|
1721
|
-
}
|
|
1722
|
-
)
|
|
1723
|
-
});
|
|
1724
|
-
var ClientConfigSchema = ClientConfigSchemaBase.transform(
|
|
1725
|
-
(config6, ctx) => transformClientConfig(config6, ctx)
|
|
1726
|
-
);
|
|
1727
|
-
function resolveEndpoint(parsedEndpoint) {
|
|
1728
|
-
if (parsedEndpoint) {
|
|
1729
|
-
return parsedEndpoint;
|
|
1730
|
-
}
|
|
1731
|
-
const envEndpoint = getRivetEngine() ?? getRivetEndpoint();
|
|
1732
|
-
if (envEndpoint) {
|
|
1733
|
-
return EndpointSchema.parse(envEndpoint);
|
|
1734
|
-
}
|
|
1735
|
-
return void 0;
|
|
1736
|
-
}
|
|
1737
|
-
function validateClientConfig(resolvedEndpoint, config6, ctx) {
|
|
1738
|
-
if (resolvedEndpoint) {
|
|
1739
|
-
zodCheckDuplicateCredentials(resolvedEndpoint, config6, ctx);
|
|
1740
|
-
}
|
|
1741
|
-
}
|
|
1742
|
-
function transformClientConfig(config6, ctx) {
|
|
1743
|
-
const resolvedEndpoint = resolveEndpoint(config6.endpoint);
|
|
1744
|
-
if (ctx) {
|
|
1745
|
-
validateClientConfig(resolvedEndpoint, config6, ctx);
|
|
1746
|
-
}
|
|
1747
|
-
return {
|
|
1748
|
-
...config6,
|
|
1749
|
-
endpoint: resolvedEndpoint == null ? void 0 : resolvedEndpoint.endpoint,
|
|
1750
|
-
namespace: (resolvedEndpoint == null ? void 0 : resolvedEndpoint.namespace) ?? config6.namespace ?? getRivetNamespace() ?? "default",
|
|
1751
|
-
token: (resolvedEndpoint == null ? void 0 : resolvedEndpoint.token) ?? config6.token ?? getRivetToken()
|
|
1752
|
-
};
|
|
1753
|
-
}
|
|
1754
|
-
function convertRegistryConfigToClientConfig(config6) {
|
|
1755
|
-
var _a;
|
|
1756
|
-
return {
|
|
1757
|
-
endpoint: config6.endpoint,
|
|
1758
|
-
token: config6.token,
|
|
1759
|
-
namespace: config6.namespace,
|
|
1760
|
-
runnerName: config6.runner.runnerName,
|
|
1761
|
-
headers: config6.headers,
|
|
1762
|
-
encoding: "bare",
|
|
1763
|
-
getUpgradeWebSocket: void 0,
|
|
1764
|
-
// We don't need health checks for internal clients
|
|
1765
|
-
disableMetadataLookup: true,
|
|
1766
|
-
devtools: typeof window !== "undefined" && ((_a = window == null ? void 0 : window.location) == null ? void 0 : _a.hostname) === "localhost"
|
|
1767
|
-
};
|
|
1768
|
-
}
|
|
1631
|
+
import { z as z7 } from "zod";
|
|
1769
1632
|
|
|
1770
1633
|
// src/engine-process/constants.ts
|
|
1771
1634
|
var ENGINE_PORT = 6420;
|
|
1772
1635
|
var ENGINE_ENDPOINT = `http://localhost:${ENGINE_PORT}`;
|
|
1773
1636
|
|
|
1774
1637
|
// src/inspector/config.ts
|
|
1775
|
-
import { z as
|
|
1638
|
+
import { z as z3 } from "zod";
|
|
1776
1639
|
var defaultTokenFn = () => {
|
|
1777
1640
|
const envToken = getRivetkitInspectorToken();
|
|
1778
1641
|
if (envToken) {
|
|
@@ -1783,31 +1646,95 @@ var defaultTokenFn = () => {
|
|
|
1783
1646
|
var defaultEnabled = () => {
|
|
1784
1647
|
return isDev() || !getRivetkitInspectorDisable();
|
|
1785
1648
|
};
|
|
1786
|
-
var InspectorConfigSchema =
|
|
1787
|
-
enabled:
|
|
1649
|
+
var InspectorConfigSchema = z3.object({
|
|
1650
|
+
enabled: z3.boolean().default(defaultEnabled),
|
|
1788
1651
|
/**
|
|
1789
1652
|
* Token used to access the Inspector.
|
|
1790
1653
|
*/
|
|
1791
|
-
token:
|
|
1654
|
+
token: z3.custom().optional().default(() => defaultTokenFn),
|
|
1792
1655
|
/**
|
|
1793
1656
|
* Default RivetKit server endpoint for Rivet Inspector to connect to. This should be the same endpoint as what you use for your Rivet client to connect to RivetKit.
|
|
1794
1657
|
*
|
|
1795
1658
|
* This is a convenience property just for printing out the inspector URL.
|
|
1796
1659
|
*/
|
|
1797
|
-
defaultEndpoint:
|
|
1660
|
+
defaultEndpoint: z3.string().optional()
|
|
1798
1661
|
}).optional().default(() => ({
|
|
1799
1662
|
enabled: defaultEnabled(),
|
|
1800
1663
|
token: defaultTokenFn
|
|
1801
1664
|
}));
|
|
1802
1665
|
|
|
1666
|
+
// src/utils/endpoint-parser.ts
|
|
1667
|
+
function tryParseEndpoint(ctx, options) {
|
|
1668
|
+
const { endpoint, path = ["endpoint"], namespace: configNamespace, token: configToken } = options;
|
|
1669
|
+
let url;
|
|
1670
|
+
try {
|
|
1671
|
+
url = new URL(endpoint);
|
|
1672
|
+
} catch {
|
|
1673
|
+
ctx.addIssue({
|
|
1674
|
+
code: "custom",
|
|
1675
|
+
message: `invalid URL: ${endpoint}`,
|
|
1676
|
+
path
|
|
1677
|
+
});
|
|
1678
|
+
return void 0;
|
|
1679
|
+
}
|
|
1680
|
+
if (url.search) {
|
|
1681
|
+
ctx.addIssue({
|
|
1682
|
+
code: "custom",
|
|
1683
|
+
message: "endpoint cannot contain a query string",
|
|
1684
|
+
path
|
|
1685
|
+
});
|
|
1686
|
+
return void 0;
|
|
1687
|
+
}
|
|
1688
|
+
if (url.hash) {
|
|
1689
|
+
ctx.addIssue({
|
|
1690
|
+
code: "custom",
|
|
1691
|
+
message: "endpoint cannot contain a fragment",
|
|
1692
|
+
path
|
|
1693
|
+
});
|
|
1694
|
+
return void 0;
|
|
1695
|
+
}
|
|
1696
|
+
const namespace = url.username ? decodeURIComponent(url.username) : void 0;
|
|
1697
|
+
const token = url.password ? decodeURIComponent(url.password) : void 0;
|
|
1698
|
+
if (token && !namespace) {
|
|
1699
|
+
ctx.addIssue({
|
|
1700
|
+
code: "custom",
|
|
1701
|
+
message: "endpoint cannot have a token without a namespace",
|
|
1702
|
+
path
|
|
1703
|
+
});
|
|
1704
|
+
return void 0;
|
|
1705
|
+
}
|
|
1706
|
+
if (namespace && configNamespace) {
|
|
1707
|
+
ctx.addIssue({
|
|
1708
|
+
code: "custom",
|
|
1709
|
+
message: "cannot specify namespace both in endpoint URL and as a separate config option",
|
|
1710
|
+
path: ["namespace"]
|
|
1711
|
+
});
|
|
1712
|
+
}
|
|
1713
|
+
if (token && configToken) {
|
|
1714
|
+
ctx.addIssue({
|
|
1715
|
+
code: "custom",
|
|
1716
|
+
message: "cannot specify token both in endpoint URL and as a separate config option",
|
|
1717
|
+
path: ["token"]
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
url.username = "";
|
|
1721
|
+
url.password = "";
|
|
1722
|
+
const cleanedEndpoint = url.toString();
|
|
1723
|
+
return {
|
|
1724
|
+
endpoint: cleanedEndpoint,
|
|
1725
|
+
namespace,
|
|
1726
|
+
token
|
|
1727
|
+
};
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1803
1730
|
// src/registry/config/driver.ts
|
|
1804
|
-
import { z as
|
|
1805
|
-
var DriverConfigSchema =
|
|
1731
|
+
import { z as z4 } from "zod";
|
|
1732
|
+
var DriverConfigSchema = z4.object({
|
|
1806
1733
|
/** Machine-readable name to identify this driver by. */
|
|
1807
|
-
name:
|
|
1808
|
-
displayName:
|
|
1809
|
-
manager:
|
|
1810
|
-
actor:
|
|
1734
|
+
name: z4.string(),
|
|
1735
|
+
displayName: z4.string(),
|
|
1736
|
+
manager: z4.custom(),
|
|
1737
|
+
actor: z4.custom(),
|
|
1811
1738
|
/**
|
|
1812
1739
|
* Start actor driver immediately or if this is started separately.
|
|
1813
1740
|
*
|
|
@@ -1815,33 +1742,33 @@ var DriverConfigSchema = z6.object({
|
|
|
1815
1742
|
* - Engine driver needs this to start immediately since this starts the Runner that connects to the engine
|
|
1816
1743
|
* - Cloudflare Workers should not start it automatically, since the actor only runs in the DO
|
|
1817
1744
|
* */
|
|
1818
|
-
autoStartActorDriver:
|
|
1745
|
+
autoStartActorDriver: z4.boolean()
|
|
1819
1746
|
});
|
|
1820
1747
|
|
|
1821
1748
|
// src/registry/config/runner.ts
|
|
1822
|
-
import { z as
|
|
1823
|
-
var RunnerConfigSchema =
|
|
1749
|
+
import { z as z5 } from "zod";
|
|
1750
|
+
var RunnerConfigSchema = z5.object({
|
|
1824
1751
|
// MARK: Runner
|
|
1825
|
-
totalSlots:
|
|
1826
|
-
runnerName:
|
|
1827
|
-
runnerKey:
|
|
1828
|
-
version:
|
|
1752
|
+
totalSlots: z5.number().default(() => getRivetTotalSlots() ?? 1e5),
|
|
1753
|
+
runnerName: z5.string().default(() => getRivetRunner() ?? "default"),
|
|
1754
|
+
runnerKey: z5.string().optional().transform((x) => x ?? getRivetRunnerKey()),
|
|
1755
|
+
version: z5.number().default(() => getRivetRunnerVersion() ?? 1)
|
|
1829
1756
|
});
|
|
1830
1757
|
|
|
1831
1758
|
// src/registry/config/serverless.ts
|
|
1832
|
-
import { z as
|
|
1833
|
-
var ConfigureRunnerPoolSchema =
|
|
1834
|
-
name:
|
|
1835
|
-
url:
|
|
1836
|
-
headers:
|
|
1837
|
-
maxRunners:
|
|
1838
|
-
minRunners:
|
|
1839
|
-
requestLifespan:
|
|
1840
|
-
runnersMargin:
|
|
1841
|
-
slotsPerRunner:
|
|
1842
|
-
metadata:
|
|
1759
|
+
import { z as z6 } from "zod";
|
|
1760
|
+
var ConfigureRunnerPoolSchema = z6.object({
|
|
1761
|
+
name: z6.string().optional(),
|
|
1762
|
+
url: z6.string(),
|
|
1763
|
+
headers: z6.record(z6.string(), z6.string()).optional(),
|
|
1764
|
+
maxRunners: z6.number().optional(),
|
|
1765
|
+
minRunners: z6.number().optional(),
|
|
1766
|
+
requestLifespan: z6.number().optional(),
|
|
1767
|
+
runnersMargin: z6.number().optional(),
|
|
1768
|
+
slotsPerRunner: z6.number().optional(),
|
|
1769
|
+
metadata: z6.record(z6.string(), z6.unknown()).optional()
|
|
1843
1770
|
}).optional();
|
|
1844
|
-
var ServerlessConfigSchema =
|
|
1771
|
+
var ServerlessConfigSchema = z6.object({
|
|
1845
1772
|
// MARK: Run Engine
|
|
1846
1773
|
/**
|
|
1847
1774
|
* @experimental
|
|
@@ -1849,9 +1776,9 @@ var ServerlessConfigSchema = z8.object({
|
|
|
1849
1776
|
* Downloads and starts the full Rust engine process.
|
|
1850
1777
|
* Auto-enabled in development mode when no endpoint is provided.
|
|
1851
1778
|
*/
|
|
1852
|
-
spawnEngine:
|
|
1779
|
+
spawnEngine: z6.boolean().default(() => getRivetRunEngine()),
|
|
1853
1780
|
/** @experimental */
|
|
1854
|
-
engineVersion:
|
|
1781
|
+
engineVersion: z6.string().optional().default(() => getRivetRunEngineVersion() ?? VERSION),
|
|
1855
1782
|
/**
|
|
1856
1783
|
* @experimental
|
|
1857
1784
|
*
|
|
@@ -1862,29 +1789,47 @@ var ServerlessConfigSchema = z8.object({
|
|
|
1862
1789
|
configureRunnerPool: ConfigureRunnerPoolSchema.optional(),
|
|
1863
1790
|
// MARK: Routing
|
|
1864
1791
|
// TODO: serverlessBasePath? better naming?
|
|
1865
|
-
basePath:
|
|
1792
|
+
basePath: z6.string().optional().default("/api/rivet"),
|
|
1793
|
+
// MARK: Public Endpoint Configuration
|
|
1866
1794
|
/**
|
|
1867
1795
|
* The endpoint that clients should connect to.
|
|
1868
1796
|
*
|
|
1869
1797
|
* This is useful if clients connect to serverless directly
|
|
1870
1798
|
* (e.g. `http://localhost:3000/api/rivet`), they will fetch
|
|
1871
1799
|
* `http://localhost:3000/api/rivet/metadata` and be redirected to
|
|
1872
|
-
* the
|
|
1800
|
+
* the public endpoint.
|
|
1801
|
+
*
|
|
1802
|
+
* Supports URL auth syntax for namespace and token:
|
|
1803
|
+
* - `https://namespace:token@api.rivet.dev`
|
|
1804
|
+
* - `https://namespace@api.rivet.dev`
|
|
1873
1805
|
*
|
|
1874
1806
|
* Auto-determined based on endpoint and NODE_ENV if not specified.
|
|
1807
|
+
*
|
|
1808
|
+
* Can also be set via RIVET_PUBLIC_ENDPOINT environment variable.
|
|
1875
1809
|
*/
|
|
1876
|
-
|
|
1810
|
+
publicEndpoint: z6.string().optional().transform((val) => val ?? getRivetPublicEndpoint()),
|
|
1811
|
+
/**
|
|
1812
|
+
* Token that clients should use when connecting via the public endpoint.
|
|
1813
|
+
*
|
|
1814
|
+
* Can also be set via RIVET_PUBLIC_TOKEN environment variable.
|
|
1815
|
+
*
|
|
1816
|
+
* Can also be specified in the publicEndpoint URL as `https://namespace:token@host`.
|
|
1817
|
+
*/
|
|
1818
|
+
publicToken: z6.string().optional().transform((val) => val ?? getRivetPublicToken())
|
|
1819
|
+
// There is no publicNamespace config option because the frontend and backend
|
|
1820
|
+
// cannot use different namespaces. The namespace is extracted from the
|
|
1821
|
+
// publicEndpoint URL auth syntax if provided.
|
|
1877
1822
|
});
|
|
1878
1823
|
|
|
1879
1824
|
// src/registry/config/index.ts
|
|
1880
|
-
var ActorsSchema =
|
|
1881
|
-
|
|
1882
|
-
|
|
1825
|
+
var ActorsSchema = z7.record(
|
|
1826
|
+
z7.string(),
|
|
1827
|
+
z7.custom()
|
|
1883
1828
|
);
|
|
1884
|
-
var TestConfigSchema =
|
|
1885
|
-
var RegistryConfigSchema =
|
|
1829
|
+
var TestConfigSchema = z7.object({ enabled: z7.boolean() });
|
|
1830
|
+
var RegistryConfigSchema = z7.object({
|
|
1886
1831
|
// MARK: Actors
|
|
1887
|
-
use:
|
|
1832
|
+
use: z7.record(z7.string(), z7.custom()),
|
|
1888
1833
|
// TODO: Find a better way of passing around the test config
|
|
1889
1834
|
/**
|
|
1890
1835
|
* Test configuration.
|
|
@@ -1897,21 +1842,21 @@ var RegistryConfigSchema = z9.object({
|
|
|
1897
1842
|
driver: DriverConfigSchema.optional(),
|
|
1898
1843
|
// MARK: Networking
|
|
1899
1844
|
/** @experimental */
|
|
1900
|
-
maxIncomingMessageSize:
|
|
1845
|
+
maxIncomingMessageSize: z7.number().optional().default(65536),
|
|
1901
1846
|
/** @experimental */
|
|
1902
|
-
maxOutgoingMessageSize:
|
|
1847
|
+
maxOutgoingMessageSize: z7.number().optional().default(1048576),
|
|
1903
1848
|
// MARK: Runtime
|
|
1904
1849
|
/**
|
|
1905
1850
|
* @experimental
|
|
1906
1851
|
*
|
|
1907
1852
|
* Disable welcome message.
|
|
1908
1853
|
* */
|
|
1909
|
-
noWelcome:
|
|
1854
|
+
noWelcome: z7.boolean().optional().default(false),
|
|
1910
1855
|
/**
|
|
1911
1856
|
* @experimental
|
|
1912
1857
|
* */
|
|
1913
|
-
logging:
|
|
1914
|
-
baseLogger:
|
|
1858
|
+
logging: z7.object({
|
|
1859
|
+
baseLogger: z7.custom().optional(),
|
|
1915
1860
|
level: LogLevelSchema.optional()
|
|
1916
1861
|
}).optional().default(() => ({})),
|
|
1917
1862
|
// MARK: Routing
|
|
@@ -1921,10 +1866,19 @@ var RegistryConfigSchema = z9.object({
|
|
|
1921
1866
|
// // created or must be imported async using `await import(...)`
|
|
1922
1867
|
// getUpgradeWebSocket: z.custom<GetUpgradeWebSocket>().optional(),
|
|
1923
1868
|
// MARK: Runner Configuration
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1869
|
+
/**
|
|
1870
|
+
* Endpoint to connect to for Rivet Engine.
|
|
1871
|
+
*
|
|
1872
|
+
* Supports URL auth syntax for namespace and token:
|
|
1873
|
+
* - `https://namespace:token@api.rivet.dev`
|
|
1874
|
+
* - `https://namespace@api.rivet.dev`
|
|
1875
|
+
*
|
|
1876
|
+
* Can also be set via RIVET_ENDPOINT environment variables.
|
|
1877
|
+
*/
|
|
1878
|
+
endpoint: z7.string().optional().transform((val) => val ?? getRivetEngine() ?? getRivetEndpoint()),
|
|
1879
|
+
token: z7.string().optional().transform((val) => val ?? getRivetToken()),
|
|
1880
|
+
namespace: z7.string().optional().transform((val) => val ?? getRivetNamespace()),
|
|
1881
|
+
headers: z7.record(z7.string(), z7.string()).optional().default({}),
|
|
1928
1882
|
// MARK: Client
|
|
1929
1883
|
// TODO:
|
|
1930
1884
|
// client: ClientConfigSchema.optional(),
|
|
@@ -1933,7 +1887,7 @@ var RegistryConfigSchema = z9.object({
|
|
|
1933
1887
|
* Whether to start the local manager server.
|
|
1934
1888
|
* Auto-determined based on endpoint and NODE_ENV if not specified.
|
|
1935
1889
|
*/
|
|
1936
|
-
serveManager:
|
|
1890
|
+
serveManager: z7.boolean().optional(),
|
|
1937
1891
|
/**
|
|
1938
1892
|
* @experimental
|
|
1939
1893
|
*
|
|
@@ -1941,13 +1895,13 @@ var RegistryConfigSchema = z9.object({
|
|
|
1941
1895
|
* For example, if the base path is `/foo`, then the route `/actors`
|
|
1942
1896
|
* will be available at `/foo/actors`.
|
|
1943
1897
|
*/
|
|
1944
|
-
managerBasePath:
|
|
1898
|
+
managerBasePath: z7.string().optional().default("/"),
|
|
1945
1899
|
/**
|
|
1946
1900
|
* @experimental
|
|
1947
1901
|
*
|
|
1948
1902
|
* What port to run the manager on.
|
|
1949
1903
|
*/
|
|
1950
|
-
managerPort:
|
|
1904
|
+
managerPort: z7.number().optional().default(6420),
|
|
1951
1905
|
/** @experimental */
|
|
1952
1906
|
inspector: InspectorConfigSchema,
|
|
1953
1907
|
// MARK: Runtime-specific
|
|
@@ -1958,58 +1912,49 @@ var RegistryConfigSchema = z9.object({
|
|
|
1958
1912
|
() => RunnerConfigSchema.parse({})
|
|
1959
1913
|
)
|
|
1960
1914
|
}).transform((config6, ctx) => {
|
|
1961
|
-
var _a;
|
|
1962
1915
|
const isDevEnv = isDev();
|
|
1963
|
-
const
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1916
|
+
const parsedEndpoint = config6.endpoint ? tryParseEndpoint(ctx, {
|
|
1917
|
+
endpoint: config6.endpoint,
|
|
1918
|
+
path: ["endpoint"],
|
|
1919
|
+
namespace: config6.namespace,
|
|
1920
|
+
token: config6.token
|
|
1921
|
+
}) : void 0;
|
|
1922
|
+
if (parsedEndpoint && config6.serveManager) {
|
|
1968
1923
|
ctx.addIssue({
|
|
1969
1924
|
code: "custom",
|
|
1970
1925
|
message: "cannot specify both endpoint and serveManager"
|
|
1971
1926
|
});
|
|
1972
1927
|
}
|
|
1973
|
-
if (config6.serverless) {
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
});
|
|
1979
|
-
}
|
|
1980
|
-
if (config6.serverless.configureRunnerPool && !resolvedEndpoint && !config6.serverless.spawnEngine) {
|
|
1981
|
-
ctx.addIssue({
|
|
1982
|
-
code: "custom",
|
|
1983
|
-
message: "configureRunnerPool requires either endpoint or spawnEngine"
|
|
1984
|
-
});
|
|
1985
|
-
}
|
|
1986
|
-
if (!isDevEnv && !resolvedEndpoint && !config6.serverless.advertiseEndpoint) {
|
|
1987
|
-
ctx.addIssue({
|
|
1988
|
-
code: "custom",
|
|
1989
|
-
message: "must specify either endpoint or advertiseEndpoint when in production mode",
|
|
1990
|
-
path: ["advertiseEndpoint"]
|
|
1991
|
-
});
|
|
1992
|
-
}
|
|
1928
|
+
if (config6.serverless.spawnEngine && parsedEndpoint) {
|
|
1929
|
+
ctx.addIssue({
|
|
1930
|
+
code: "custom",
|
|
1931
|
+
message: "cannot specify both spawnEngine and endpoint"
|
|
1932
|
+
});
|
|
1993
1933
|
}
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
if (endpoint) {
|
|
2000
|
-
serveManager = config6.serveManager ?? false;
|
|
2001
|
-
advertiseEndpoint = config6.serverless.advertiseEndpoint ?? endpoint;
|
|
2002
|
-
} else if (isDevEnv) {
|
|
2003
|
-
serveManager = config6.serveManager ?? true;
|
|
2004
|
-
advertiseEndpoint = config6.serverless.advertiseEndpoint ?? (serveManager ? `http://localhost:${config6.managerPort}` : void 0);
|
|
2005
|
-
} else {
|
|
2006
|
-
serveManager = config6.serveManager ?? false;
|
|
2007
|
-
invariant2(
|
|
2008
|
-
config6.serverless.advertiseEndpoint,
|
|
2009
|
-
"advertiseEndpoint not specified in production mode"
|
|
2010
|
-
);
|
|
2011
|
-
advertiseEndpoint = config6.serverless.advertiseEndpoint;
|
|
1934
|
+
if (config6.serverless.configureRunnerPool && !parsedEndpoint && !config6.serverless.spawnEngine) {
|
|
1935
|
+
ctx.addIssue({
|
|
1936
|
+
code: "custom",
|
|
1937
|
+
message: "configureRunnerPool requires either endpoint or spawnEngine"
|
|
1938
|
+
});
|
|
2012
1939
|
}
|
|
1940
|
+
const endpoint = config6.serverless.spawnEngine ? ENGINE_ENDPOINT : parsedEndpoint == null ? void 0 : parsedEndpoint.endpoint;
|
|
1941
|
+
const namespace = (parsedEndpoint == null ? void 0 : parsedEndpoint.namespace) ?? config6.namespace ?? "default";
|
|
1942
|
+
const token = (parsedEndpoint == null ? void 0 : parsedEndpoint.token) ?? config6.token;
|
|
1943
|
+
const parsedPublicEndpoint = config6.serverless.publicEndpoint ? tryParseEndpoint(ctx, {
|
|
1944
|
+
endpoint: config6.serverless.publicEndpoint,
|
|
1945
|
+
path: ["serverless", "publicEndpoint"]
|
|
1946
|
+
}) : void 0;
|
|
1947
|
+
if ((parsedPublicEndpoint == null ? void 0 : parsedPublicEndpoint.namespace) && parsedPublicEndpoint.namespace !== namespace) {
|
|
1948
|
+
ctx.addIssue({
|
|
1949
|
+
code: "custom",
|
|
1950
|
+
message: `publicEndpoint namespace "${parsedPublicEndpoint.namespace}" must match backend namespace "${namespace}"`,
|
|
1951
|
+
path: ["serverless", "publicEndpoint"]
|
|
1952
|
+
});
|
|
1953
|
+
}
|
|
1954
|
+
const serveManager = config6.serveManager ?? (isDevEnv && !endpoint);
|
|
1955
|
+
const publicEndpoint = (parsedPublicEndpoint == null ? void 0 : parsedPublicEndpoint.endpoint) ?? (isDevEnv && serveManager ? `http://localhost:${config6.managerPort}` : void 0);
|
|
1956
|
+
const publicNamespace = parsedPublicEndpoint == null ? void 0 : parsedPublicEndpoint.namespace;
|
|
1957
|
+
const publicToken = (parsedPublicEndpoint == null ? void 0 : parsedPublicEndpoint.token) ?? config6.serverless.publicToken;
|
|
2013
1958
|
const willUseEngine = !!endpoint || config6.serverless.spawnEngine;
|
|
2014
1959
|
const inspector = willUseEngine ? {
|
|
2015
1960
|
...config6.inspector,
|
|
@@ -2021,11 +1966,13 @@ var RegistryConfigSchema = z9.object({
|
|
|
2021
1966
|
namespace,
|
|
2022
1967
|
token,
|
|
2023
1968
|
serveManager,
|
|
2024
|
-
|
|
1969
|
+
publicEndpoint,
|
|
1970
|
+
publicNamespace,
|
|
1971
|
+
publicToken,
|
|
2025
1972
|
inspector,
|
|
2026
1973
|
serverless: {
|
|
2027
1974
|
...config6.serverless,
|
|
2028
|
-
|
|
1975
|
+
publicEndpoint
|
|
2029
1976
|
}
|
|
2030
1977
|
};
|
|
2031
1978
|
});
|
|
@@ -2103,7 +2050,7 @@ function handleRouteError(error, c) {
|
|
|
2103
2050
|
);
|
|
2104
2051
|
return c.body(output, { status: statusCode });
|
|
2105
2052
|
}
|
|
2106
|
-
function handleMetadataRequest(c, config6, runnerKind, clientEndpoint) {
|
|
2053
|
+
function handleMetadataRequest(c, config6, runnerKind, clientEndpoint, clientNamespace, clientToken) {
|
|
2107
2054
|
const response = {
|
|
2108
2055
|
runtime: "rivetkit",
|
|
2109
2056
|
version: VERSION,
|
|
@@ -2111,7 +2058,9 @@ function handleMetadataRequest(c, config6, runnerKind, clientEndpoint) {
|
|
|
2111
2058
|
kind: runnerKind
|
|
2112
2059
|
},
|
|
2113
2060
|
actorNames: buildActorNames(config6),
|
|
2114
|
-
clientEndpoint
|
|
2061
|
+
clientEndpoint,
|
|
2062
|
+
clientNamespace,
|
|
2063
|
+
clientToken
|
|
2115
2064
|
};
|
|
2116
2065
|
return c.json(response);
|
|
2117
2066
|
}
|
|
@@ -2124,76 +2073,76 @@ function handleHealthRequest(c) {
|
|
|
2124
2073
|
}
|
|
2125
2074
|
|
|
2126
2075
|
// src/manager-api/actors.ts
|
|
2127
|
-
import { z as
|
|
2076
|
+
import { z as z9 } from "zod";
|
|
2128
2077
|
|
|
2129
2078
|
// src/manager-api/common.ts
|
|
2130
|
-
import { z as
|
|
2131
|
-
var RivetIdSchema =
|
|
2079
|
+
import { z as z8 } from "zod";
|
|
2080
|
+
var RivetIdSchema = z8.string();
|
|
2132
2081
|
|
|
2133
2082
|
// src/manager-api/actors.ts
|
|
2134
|
-
var ServerlessConnectionErrorSchema =
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2083
|
+
var ServerlessConnectionErrorSchema = z9.union([
|
|
2084
|
+
z9.object({ http_error: z9.object({ status_code: z9.number(), body: z9.string() }) }),
|
|
2085
|
+
z9.literal("stream_ended_early"),
|
|
2086
|
+
z9.object({ connection_error: z9.object({ message: z9.string() }) }),
|
|
2087
|
+
z9.literal("invalid_base64"),
|
|
2088
|
+
z9.object({ invalid_payload: z9.object({ message: z9.string() }) }),
|
|
2089
|
+
z9.literal("runner_config_not_found"),
|
|
2090
|
+
z9.literal("runner_config_not_serverless"),
|
|
2091
|
+
z9.literal("namespace_not_found")
|
|
2143
2092
|
]);
|
|
2144
|
-
var ActorErrorDetailsSchema =
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2093
|
+
var ActorErrorDetailsSchema = z9.union([
|
|
2094
|
+
z9.object({ serverless_error: ServerlessConnectionErrorSchema }),
|
|
2095
|
+
z9.object({ no_capacity: z9.object({ runner_name: z9.string() }) }),
|
|
2096
|
+
z9.object({ runner_no_response: z9.object({ runner_id: z9.string() }) })
|
|
2148
2097
|
]);
|
|
2149
|
-
var ActorSchema =
|
|
2098
|
+
var ActorSchema = z9.object({
|
|
2150
2099
|
actor_id: RivetIdSchema,
|
|
2151
|
-
name:
|
|
2152
|
-
key:
|
|
2100
|
+
name: z9.string(),
|
|
2101
|
+
key: z9.string(),
|
|
2153
2102
|
namespace_id: RivetIdSchema,
|
|
2154
|
-
runner_name_selector:
|
|
2155
|
-
create_ts:
|
|
2156
|
-
connectable_ts:
|
|
2157
|
-
destroy_ts:
|
|
2158
|
-
sleep_ts:
|
|
2159
|
-
start_ts:
|
|
2103
|
+
runner_name_selector: z9.string(),
|
|
2104
|
+
create_ts: z9.number(),
|
|
2105
|
+
connectable_ts: z9.number().nullable().optional(),
|
|
2106
|
+
destroy_ts: z9.number().nullable().optional(),
|
|
2107
|
+
sleep_ts: z9.number().nullable().optional(),
|
|
2108
|
+
start_ts: z9.number().nullable().optional(),
|
|
2160
2109
|
error: ActorErrorDetailsSchema.nullable().optional()
|
|
2161
2110
|
});
|
|
2162
|
-
var ActorNameSchema =
|
|
2163
|
-
metadata:
|
|
2111
|
+
var ActorNameSchema = z9.object({
|
|
2112
|
+
metadata: z9.record(z9.string(), z9.unknown())
|
|
2164
2113
|
});
|
|
2165
|
-
var ActorsListResponseSchema =
|
|
2166
|
-
actors:
|
|
2114
|
+
var ActorsListResponseSchema = z9.object({
|
|
2115
|
+
actors: z9.array(ActorSchema)
|
|
2167
2116
|
});
|
|
2168
|
-
var ActorsCreateRequestSchema =
|
|
2169
|
-
datacenter:
|
|
2170
|
-
name:
|
|
2171
|
-
runner_name_selector:
|
|
2172
|
-
crash_policy:
|
|
2173
|
-
key:
|
|
2174
|
-
input:
|
|
2117
|
+
var ActorsCreateRequestSchema = z9.object({
|
|
2118
|
+
datacenter: z9.string().optional(),
|
|
2119
|
+
name: z9.string(),
|
|
2120
|
+
runner_name_selector: z9.string(),
|
|
2121
|
+
crash_policy: z9.string(),
|
|
2122
|
+
key: z9.string().nullable().optional(),
|
|
2123
|
+
input: z9.string().nullable().optional()
|
|
2175
2124
|
});
|
|
2176
|
-
var ActorsCreateResponseSchema =
|
|
2125
|
+
var ActorsCreateResponseSchema = z9.object({
|
|
2177
2126
|
actor: ActorSchema
|
|
2178
2127
|
});
|
|
2179
|
-
var ActorsGetOrCreateRequestSchema =
|
|
2180
|
-
datacenter:
|
|
2181
|
-
name:
|
|
2182
|
-
key:
|
|
2183
|
-
runner_name_selector:
|
|
2184
|
-
crash_policy:
|
|
2185
|
-
input:
|
|
2128
|
+
var ActorsGetOrCreateRequestSchema = z9.object({
|
|
2129
|
+
datacenter: z9.string().optional(),
|
|
2130
|
+
name: z9.string(),
|
|
2131
|
+
key: z9.string(),
|
|
2132
|
+
runner_name_selector: z9.string(),
|
|
2133
|
+
crash_policy: z9.string(),
|
|
2134
|
+
input: z9.string().nullable().optional()
|
|
2186
2135
|
});
|
|
2187
|
-
var ActorsGetOrCreateResponseSchema =
|
|
2136
|
+
var ActorsGetOrCreateResponseSchema = z9.object({
|
|
2188
2137
|
actor: ActorSchema,
|
|
2189
|
-
created:
|
|
2138
|
+
created: z9.boolean()
|
|
2190
2139
|
});
|
|
2191
|
-
var ActorsDeleteResponseSchema =
|
|
2192
|
-
var ActorsListNamesResponseSchema =
|
|
2193
|
-
names:
|
|
2140
|
+
var ActorsDeleteResponseSchema = z9.object({});
|
|
2141
|
+
var ActorsListNamesResponseSchema = z9.object({
|
|
2142
|
+
names: z9.record(z9.string(), ActorNameSchema)
|
|
2194
2143
|
});
|
|
2195
|
-
var ActorsKvGetResponseSchema =
|
|
2196
|
-
value:
|
|
2144
|
+
var ActorsKvGetResponseSchema = z9.object({
|
|
2145
|
+
value: z9.string().nullable()
|
|
2197
2146
|
});
|
|
2198
2147
|
|
|
2199
2148
|
// src/utils/crypto.ts
|
|
@@ -2301,10 +2250,10 @@ function buildOpenApiRequestBody(schema) {
|
|
|
2301
2250
|
}
|
|
2302
2251
|
|
|
2303
2252
|
// src/manager/gateway.ts
|
|
2304
|
-
import
|
|
2253
|
+
import invariant4 from "invariant";
|
|
2305
2254
|
|
|
2306
2255
|
// src/actor/router-websocket-endpoints.ts
|
|
2307
|
-
import
|
|
2256
|
+
import invariant3 from "invariant";
|
|
2308
2257
|
|
|
2309
2258
|
// src/inspector/log.ts
|
|
2310
2259
|
function inspectorLogger() {
|
|
@@ -2615,7 +2564,7 @@ import * as cbor4 from "cbor-x";
|
|
|
2615
2564
|
|
|
2616
2565
|
// src/actor/conn/state-manager.ts
|
|
2617
2566
|
import onChange from "@rivetkit/on-change";
|
|
2618
|
-
import
|
|
2567
|
+
import invariant2 from "invariant";
|
|
2619
2568
|
var StateManager = class {
|
|
2620
2569
|
#conn;
|
|
2621
2570
|
/**
|
|
@@ -2669,7 +2618,7 @@ var StateManager = class {
|
|
|
2669
2618
|
}
|
|
2670
2619
|
hibernatableDataOrError() {
|
|
2671
2620
|
const hibernatable = this.hibernatableData;
|
|
2672
|
-
|
|
2621
|
+
invariant2(hibernatable, "missing hibernatable data");
|
|
2673
2622
|
return hibernatable;
|
|
2674
2623
|
}
|
|
2675
2624
|
get hibernatableDataRaw() {
|
|
@@ -3315,7 +3264,7 @@ async function handleRawWebSocket(setWebSocket, { request, actor, closePromiseRe
|
|
|
3315
3264
|
actor,
|
|
3316
3265
|
onRestore: (wsContext) => {
|
|
3317
3266
|
const ws = wsContext.raw;
|
|
3318
|
-
|
|
3267
|
+
invariant3(ws, "missing wsContext.raw");
|
|
3319
3268
|
setWebSocket(ws);
|
|
3320
3269
|
},
|
|
3321
3270
|
// NOTE: onOpen cannot be async since this will cause the client's open
|
|
@@ -3323,7 +3272,7 @@ async function handleRawWebSocket(setWebSocket, { request, actor, closePromiseRe
|
|
|
3323
3272
|
// handleRawWebSocket root.
|
|
3324
3273
|
onOpen: (_evt, wsContext) => {
|
|
3325
3274
|
const ws = wsContext.raw;
|
|
3326
|
-
|
|
3275
|
+
invariant3(ws, "missing wsContext.raw");
|
|
3327
3276
|
setWebSocket(ws);
|
|
3328
3277
|
actor.connectionManager.connectConn(conn);
|
|
3329
3278
|
actor.handleRawWebSocket(conn, ws, request);
|
|
@@ -3613,7 +3562,7 @@ async function createTestWebSocketProxy(proxyToActorWsPromise) {
|
|
|
3613
3562
|
constructor: proxyToActorWs == null ? void 0 : proxyToActorWs.constructor.name
|
|
3614
3563
|
});
|
|
3615
3564
|
await new Promise((resolve, reject) => {
|
|
3616
|
-
|
|
3565
|
+
invariant4(proxyToActorWs, "missing proxyToActorWs");
|
|
3617
3566
|
const onOpen = () => {
|
|
3618
3567
|
logger3().debug({
|
|
3619
3568
|
msg: "test websocket connection to actor opened"
|
|
@@ -3803,10 +3752,10 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
3803
3752
|
method: "get",
|
|
3804
3753
|
path: "/actors",
|
|
3805
3754
|
request: {
|
|
3806
|
-
query:
|
|
3807
|
-
name:
|
|
3808
|
-
actor_ids:
|
|
3809
|
-
key:
|
|
3755
|
+
query: z10.object({
|
|
3756
|
+
name: z10.string().optional(),
|
|
3757
|
+
actor_ids: z10.string().optional(),
|
|
3758
|
+
key: z10.string().optional()
|
|
3810
3759
|
})
|
|
3811
3760
|
},
|
|
3812
3761
|
responses: buildOpenApiResponses(ActorsListResponseSchema)
|
|
@@ -3906,8 +3855,8 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
3906
3855
|
method: "get",
|
|
3907
3856
|
path: "/actors/names",
|
|
3908
3857
|
request: {
|
|
3909
|
-
query:
|
|
3910
|
-
namespace:
|
|
3858
|
+
query: z10.object({
|
|
3859
|
+
namespace: z10.string()
|
|
3911
3860
|
})
|
|
3912
3861
|
},
|
|
3913
3862
|
responses: buildOpenApiResponses(ActorsListNamesResponseSchema)
|
|
@@ -3990,9 +3939,9 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
3990
3939
|
method: "get",
|
|
3991
3940
|
path: "/actors/{actor_id}/kv/keys/{key}",
|
|
3992
3941
|
request: {
|
|
3993
|
-
params:
|
|
3994
|
-
actor_id:
|
|
3995
|
-
key:
|
|
3942
|
+
params: z10.object({
|
|
3943
|
+
actor_id: z10.string(),
|
|
3944
|
+
key: z10.string()
|
|
3996
3945
|
})
|
|
3997
3946
|
},
|
|
3998
3947
|
responses: buildOpenApiResponses(ActorsKvGetResponseSchema)
|
|
@@ -4046,7 +3995,7 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
4046
3995
|
});
|
|
4047
3996
|
router.get(".test/inline-driver/connect-websocket/*", async (c) => {
|
|
4048
3997
|
const upgradeWebSocket = getUpgradeWebSocket == null ? void 0 : getUpgradeWebSocket();
|
|
4049
|
-
|
|
3998
|
+
invariant5(
|
|
4050
3999
|
upgradeWebSocket,
|
|
4051
4000
|
"websockets not supported on this platform"
|
|
4052
4001
|
);
|
|
@@ -4186,7 +4135,14 @@ function buildManagerRouter(config6, managerDriver, getUpgradeWebSocket) {
|
|
|
4186
4135
|
router.get("/health", (c) => handleHealthRequest(c));
|
|
4187
4136
|
router.get(
|
|
4188
4137
|
"/metadata",
|
|
4189
|
-
(c) => handleMetadataRequest(
|
|
4138
|
+
(c) => handleMetadataRequest(
|
|
4139
|
+
c,
|
|
4140
|
+
config6,
|
|
4141
|
+
{ normal: {} },
|
|
4142
|
+
config6.publicEndpoint,
|
|
4143
|
+
config6.publicNamespace,
|
|
4144
|
+
config6.publicToken
|
|
4145
|
+
)
|
|
4190
4146
|
);
|
|
4191
4147
|
(_a = managerDriver.modifyManagerRouter) == null ? void 0 : _a.call(managerDriver, config6, router);
|
|
4192
4148
|
});
|
|
@@ -4937,6 +4893,7 @@ export {
|
|
|
4937
4893
|
generateSecureToken,
|
|
4938
4894
|
isStatePath,
|
|
4939
4895
|
isConnStatePath,
|
|
4896
|
+
EncodingSchema,
|
|
4940
4897
|
CachedSerializer,
|
|
4941
4898
|
jsonStringifyCompat,
|
|
4942
4899
|
CONN_CONNECTED_SYMBOL,
|
|
@@ -4982,13 +4939,10 @@ export {
|
|
|
4982
4939
|
ALLOWED_PUBLIC_HEADERS,
|
|
4983
4940
|
handleAction,
|
|
4984
4941
|
handleRawRequest,
|
|
4985
|
-
ClientConfigSchemaBase,
|
|
4986
|
-
ClientConfigSchema,
|
|
4987
|
-
transformClientConfig,
|
|
4988
|
-
convertRegistryConfigToClientConfig,
|
|
4989
4942
|
ENGINE_PORT,
|
|
4990
4943
|
ENGINE_ENDPOINT,
|
|
4991
4944
|
InspectorConfigSchema,
|
|
4945
|
+
tryParseEndpoint,
|
|
4992
4946
|
DriverConfigSchema,
|
|
4993
4947
|
ActorsSchema,
|
|
4994
4948
|
TestConfigSchema,
|
|
@@ -5006,4 +4960,4 @@ export {
|
|
|
5006
4960
|
buildManagerRouter,
|
|
5007
4961
|
getInitialActorKvState
|
|
5008
4962
|
};
|
|
5009
|
-
//# sourceMappingURL=chunk-
|
|
4963
|
+
//# sourceMappingURL=chunk-KJLJLNHR.js.map
|