rivetkit 2.3.12-rc.3 → 2.3.12
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/browser/client.d.ts +17 -2
- package/dist/browser/client.js +32 -24
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +2 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/actor/errors.cjs +2 -2
- package/dist/tsup/actor/errors.js +1 -1
- package/dist/tsup/agent-os/index.cjs +2 -1
- package/dist/tsup/agent-os/index.cjs.map +1 -1
- package/dist/tsup/agent-os/index.d.cts +17 -2
- package/dist/tsup/agent-os/index.d.ts +17 -2
- package/dist/tsup/agent-os/index.js +2 -1
- package/dist/tsup/agent-os/index.js.map +1 -1
- package/dist/tsup/{chunk-SPJORZMM.cjs → chunk-2JSYYH6P.cjs} +1 -1
- package/dist/tsup/chunk-2JSYYH6P.cjs.map +1 -0
- package/dist/tsup/{chunk-IJWTHKH6.cjs → chunk-AN7WO7BM.cjs} +3 -3
- package/dist/tsup/{chunk-IJWTHKH6.cjs.map → chunk-AN7WO7BM.cjs.map} +1 -1
- package/dist/tsup/{chunk-PSXMESQJ.js → chunk-EBXARMGI.js} +2 -2
- package/dist/tsup/{chunk-O6H3BUN4.cjs → chunk-FGQABMXZ.cjs} +3 -3
- package/dist/tsup/{chunk-O6H3BUN4.cjs.map → chunk-FGQABMXZ.cjs.map} +1 -1
- package/dist/tsup/{chunk-WVFTFWJL.js → chunk-GEN4NHXM.js} +2 -2
- package/dist/tsup/{chunk-XI4MEUUI.js → chunk-JYTXOMM7.js} +2 -2
- package/dist/tsup/{chunk-OX6WVQE6.cjs → chunk-MEF7RVQ7.cjs} +10 -10
- package/dist/tsup/{chunk-OX6WVQE6.cjs.map → chunk-MEF7RVQ7.cjs.map} +1 -1
- package/dist/tsup/{chunk-OLGQYFUW.js → chunk-MF42PRF2.js} +9 -3
- package/dist/tsup/chunk-MF42PRF2.js.map +1 -0
- package/dist/tsup/{chunk-IXBD7BXC.js → chunk-OUQUIBVW.js} +1 -1
- package/dist/tsup/chunk-OUQUIBVW.js.map +1 -0
- package/dist/tsup/{chunk-QLOBB27M.cjs → chunk-PW2VSGUR.cjs} +4 -4
- package/dist/tsup/{chunk-QLOBB27M.cjs.map → chunk-PW2VSGUR.cjs.map} +1 -1
- package/dist/tsup/{chunk-NHI5L7C7.js → chunk-RBXJWAJB.js} +3 -3
- package/dist/tsup/{chunk-UBB32UOG.cjs → chunk-SSPTEGTX.cjs} +7 -7
- package/dist/tsup/{chunk-UBB32UOG.cjs.map → chunk-SSPTEGTX.cjs.map} +1 -1
- package/dist/tsup/{chunk-4ESGNS3Z.cjs → chunk-TAG6UEL5.cjs} +17 -11
- package/dist/tsup/chunk-TAG6UEL5.cjs.map +1 -0
- package/dist/tsup/{chunk-EQKSWDIH.cjs → chunk-TXUHVBKH.cjs} +3 -3
- package/dist/tsup/{chunk-EQKSWDIH.cjs.map → chunk-TXUHVBKH.cjs.map} +1 -1
- package/dist/tsup/{chunk-PZBWSCQR.cjs → chunk-TZPNSOG2.cjs} +203 -195
- package/dist/tsup/chunk-TZPNSOG2.cjs.map +1 -0
- package/dist/tsup/{chunk-YYIDQBBM.js → chunk-VOYNLY57.js} +41 -33
- package/dist/tsup/chunk-VOYNLY57.js.map +1 -0
- package/dist/tsup/{chunk-UN5JNDBT.js → chunk-XUODFCRJ.js} +4 -4
- package/dist/tsup/{chunk-34Q4YVCX.js → chunk-ZIPXAVKR.js} +2 -2
- package/dist/tsup/client/mod.cjs +6 -6
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- 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-Bi1r6gI7.d.ts → config-BGTanB_3.d.ts} +18 -2
- package/dist/tsup/{config-BXSV17G7.d.cts → config-NHz6oMb9.d.cts} +18 -2
- package/dist/tsup/{context-4fJemY0D.d.cts → context-DB8zG_Ib.d.cts} +1 -1
- package/dist/tsup/{context-D4sNYboo.d.ts → context-SHomdVV8.d.ts} +1 -1
- package/dist/tsup/db/drizzle.cjs +3 -3
- package/dist/tsup/db/drizzle.js +2 -2
- package/dist/tsup/db/mod.cjs +4 -4
- package/dist/tsup/db/mod.js +3 -3
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/inspector/mod.cjs +6 -6
- package/dist/tsup/inspector/mod.js +5 -5
- package/dist/tsup/inspector/workflow.cjs +5 -5
- package/dist/tsup/inspector/workflow.js +4 -4
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/mod.cjs +423 -177
- package/dist/tsup/mod.cjs.map +1 -1
- package/dist/tsup/mod.d.cts +3 -3
- package/dist/tsup/mod.d.ts +3 -3
- package/dist/tsup/mod.js +322 -76
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +7 -7
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +5 -5
- package/dist/tsup/utils.cjs +3 -3
- package/dist/tsup/utils.js +2 -2
- package/dist/tsup/workflow/mod.cjs +11 -11
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +5 -5
- package/package.json +9 -8
- package/src/actor/errors.ts +2 -1
- package/src/client/actor-handle.ts +10 -3
- package/src/client/raw-utils.ts +8 -0
- package/src/common/actor-router-consts.ts +2 -0
- package/src/engine-client/actor-http-client.ts +6 -22
- package/src/engine-client/mod.ts +1 -1
- package/src/registry/config/index.ts +27 -1
- package/src/registry/index.ts +48 -14
- package/src/registry/napi-runtime.ts +32 -5
- package/src/registry/native-http.ts +225 -0
- package/src/registry/native.ts +130 -64
- package/src/registry/runtime.ts +30 -2
- package/src/utils/env-vars.ts +4 -0
- package/dist/tsup/chunk-4ESGNS3Z.cjs.map +0 -1
- package/dist/tsup/chunk-IXBD7BXC.js.map +0 -1
- package/dist/tsup/chunk-OLGQYFUW.js.map +0 -1
- package/dist/tsup/chunk-PZBWSCQR.cjs.map +0 -1
- package/dist/tsup/chunk-SPJORZMM.cjs.map +0 -1
- package/dist/tsup/chunk-YYIDQBBM.js.map +0 -1
- /package/dist/tsup/{chunk-PSXMESQJ.js.map → chunk-EBXARMGI.js.map} +0 -0
- /package/dist/tsup/{chunk-WVFTFWJL.js.map → chunk-GEN4NHXM.js.map} +0 -0
- /package/dist/tsup/{chunk-XI4MEUUI.js.map → chunk-JYTXOMM7.js.map} +0 -0
- /package/dist/tsup/{chunk-NHI5L7C7.js.map → chunk-RBXJWAJB.js.map} +0 -0
- /package/dist/tsup/{chunk-UN5JNDBT.js.map → chunk-XUODFCRJ.js.map} +0 -0
- /package/dist/tsup/{chunk-34Q4YVCX.js.map → chunk-ZIPXAVKR.js.map} +0 -0
package/dist/browser/client.d.ts
CHANGED
|
@@ -1679,6 +1679,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1679
1679
|
engineHost: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodString>>;
|
|
1680
1680
|
enginePort: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodNumber>>;
|
|
1681
1681
|
engineVersion: z$2.ZodDefault<z$2.ZodOptional<z$2.ZodString>>;
|
|
1682
|
+
startServices: z$2.ZodOptional<z$2.ZodBoolean>;
|
|
1682
1683
|
configurePool: z$2.ZodOptional<z$2.ZodOptional<z$2.ZodObject<{
|
|
1683
1684
|
name: z$2.ZodOptional<z$2.ZodString>;
|
|
1684
1685
|
url: z$2.ZodString;
|
|
@@ -1710,6 +1711,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1710
1711
|
backend: "local" | "remote";
|
|
1711
1712
|
} | undefined;
|
|
1712
1713
|
endpoint: string | undefined;
|
|
1714
|
+
startServices: boolean;
|
|
1713
1715
|
namespace: string;
|
|
1714
1716
|
token: string | undefined;
|
|
1715
1717
|
publicEndpoint: string | undefined;
|
|
@@ -1821,6 +1823,7 @@ declare const RegistryConfigSchema: z$2.ZodPipe<z$2.ZodObject<{
|
|
|
1821
1823
|
};
|
|
1822
1824
|
staticDir?: string | undefined;
|
|
1823
1825
|
httpHost?: string | undefined;
|
|
1826
|
+
startServices?: boolean | undefined;
|
|
1824
1827
|
configurePool?: {
|
|
1825
1828
|
url: string;
|
|
1826
1829
|
name?: string | undefined;
|
|
@@ -1861,6 +1864,12 @@ interface RuntimeHttpRequest {
|
|
|
1861
1864
|
headers?: Record<string, string>;
|
|
1862
1865
|
body?: RuntimeBytes;
|
|
1863
1866
|
}
|
|
1867
|
+
interface RuntimeHttpResponseBodyStream {
|
|
1868
|
+
cancelled(): Promise<void>;
|
|
1869
|
+
write(chunk: Uint8Array): Promise<void>;
|
|
1870
|
+
end(): Promise<void>;
|
|
1871
|
+
error(message: string): Promise<void>;
|
|
1872
|
+
}
|
|
1864
1873
|
interface RuntimeStateDeltaPayload {
|
|
1865
1874
|
state?: RuntimeBytes;
|
|
1866
1875
|
connHibernation: Array<{
|
|
@@ -2068,6 +2077,8 @@ interface RuntimeServeConfig {
|
|
|
2068
2077
|
namespace: string;
|
|
2069
2078
|
poolName: string;
|
|
2070
2079
|
engineBinaryPath?: string;
|
|
2080
|
+
startServices?: boolean;
|
|
2081
|
+
servicesBinaryPath?: string;
|
|
2071
2082
|
engineHost?: string;
|
|
2072
2083
|
enginePort?: number;
|
|
2073
2084
|
handleInspectorHttpInRuntime?: boolean;
|
|
@@ -2092,12 +2103,16 @@ interface RuntimeServerlessRequest {
|
|
|
2092
2103
|
headers: Record<string, string>;
|
|
2093
2104
|
body: RuntimeBytes;
|
|
2094
2105
|
}
|
|
2106
|
+
interface RuntimeApplicationRequest extends RuntimeServerlessRequest {
|
|
2107
|
+
cancelToken?: CancellationTokenHandle;
|
|
2108
|
+
}
|
|
2095
2109
|
interface RuntimeApplicationResponse {
|
|
2096
2110
|
status: number;
|
|
2097
2111
|
headers: Record<string, string>;
|
|
2098
|
-
body
|
|
2112
|
+
body?: RuntimeBytes;
|
|
2113
|
+
stream?: boolean;
|
|
2099
2114
|
}
|
|
2100
|
-
type RuntimeApplicationFetch = (request:
|
|
2115
|
+
type RuntimeApplicationFetch = (request: RuntimeApplicationRequest, responseBodyStream?: RuntimeHttpResponseBodyStream) => Promise<RuntimeApplicationResponse>;
|
|
2101
2116
|
interface RuntimeApplicationListenerConfig extends RuntimeListenerConfig {
|
|
2102
2117
|
application: RuntimeApplicationFetch;
|
|
2103
2118
|
}
|
package/dist/browser/client.js
CHANGED
|
@@ -201,7 +201,7 @@ function noopNext() {
|
|
|
201
201
|
// package.json
|
|
202
202
|
var package_default = {
|
|
203
203
|
name: "rivetkit",
|
|
204
|
-
version: "2.3.12
|
|
204
|
+
version: "2.3.12",
|
|
205
205
|
description: "Lightweight libraries for building stateful actors on edge platforms",
|
|
206
206
|
license: "Apache-2.0",
|
|
207
207
|
keywords: [
|
|
@@ -411,6 +411,7 @@ var package_default = {
|
|
|
411
411
|
dependencies: {
|
|
412
412
|
"@hono/zod-openapi": "^1.1.5",
|
|
413
413
|
"@rivet-dev/agent-os-core": "^0.1.1",
|
|
414
|
+
"@rivet-dev/services": "^0.1.3",
|
|
414
415
|
"@rivetkit/bare-ts": "^0.6.2",
|
|
415
416
|
"@rivetkit/engine-cli": "workspace:*",
|
|
416
417
|
"@rivetkit/engine-envoy-protocol": "workspace:*",
|
|
@@ -1129,6 +1130,7 @@ var PATH_WEBSOCKET_BASE = "/websocket";
|
|
|
1129
1130
|
var PATH_WEBSOCKET_PREFIX = "/websocket/";
|
|
1130
1131
|
var HEADER_ENCODING = "x-rivet-encoding";
|
|
1131
1132
|
var HEADER_CONN_PARAMS = "x-rivet-conn-params";
|
|
1133
|
+
var HEADER_ORIGINAL_REQUEST_URL = "x-rivet-internal-original-request-url";
|
|
1132
1134
|
var HEADER_RIVET_TOKEN = "x-rivet-token";
|
|
1133
1135
|
var HEADER_RIVET_TARGET = "x-rivet-target";
|
|
1134
1136
|
var HEADER_RIVET_ACTOR = "x-rivet-actor";
|
|
@@ -1155,23 +1157,19 @@ async function sendHttpRequestToGateway(runConfig, gatewayUrl, actorRequest, opt
|
|
|
1155
1157
|
if (actorRequest.bodyUsed) {
|
|
1156
1158
|
throw new Error("Request body has already been consumed");
|
|
1157
1159
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
bodyToSend = reqBody;
|
|
1160
|
+
if (actorRequest.body) {
|
|
1161
|
+
bodyToSend = actorRequest.body;
|
|
1161
1162
|
guardHeaders.delete("transfer-encoding");
|
|
1162
1163
|
guardHeaders.delete("content-length");
|
|
1163
1164
|
}
|
|
1164
1165
|
}
|
|
1165
|
-
|
|
1166
|
+
return fetch(gatewayUrl, {
|
|
1166
1167
|
method: actorRequest.method,
|
|
1167
1168
|
headers: guardHeaders,
|
|
1168
1169
|
body: bodyToSend,
|
|
1169
|
-
signal: actorRequest.signal
|
|
1170
|
+
signal: actorRequest.signal,
|
|
1171
|
+
...bodyToSend ? { duplex: "half" } : {}
|
|
1170
1172
|
});
|
|
1171
|
-
return mutableResponse(await fetch(guardRequest));
|
|
1172
|
-
}
|
|
1173
|
-
function mutableResponse(fetchRes) {
|
|
1174
|
-
return new Response(fetchRes.body, fetchRes);
|
|
1175
1173
|
}
|
|
1176
1174
|
function buildGuardHeaders(runConfig, actorRequest, options) {
|
|
1177
1175
|
const headers = new Headers();
|
|
@@ -5883,6 +5881,17 @@ var ActorConnRaw = class {
|
|
|
5883
5881
|
}
|
|
5884
5882
|
};
|
|
5885
5883
|
|
|
5884
|
+
// src/common/fetch-like.ts
|
|
5885
|
+
function isUrlLike(value) {
|
|
5886
|
+
return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
|
|
5887
|
+
}
|
|
5888
|
+
function isRequestLike(value) {
|
|
5889
|
+
return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
|
|
5890
|
+
}
|
|
5891
|
+
function isHeadersLike(value) {
|
|
5892
|
+
return typeof value === "object" && value !== null && typeof value.entries === "function";
|
|
5893
|
+
}
|
|
5894
|
+
|
|
5886
5895
|
// src/common/database/shared.ts
|
|
5887
5896
|
var MIGRATION_TRANSACTION_TIMEOUT_MS = 5 * 6e4;
|
|
5888
5897
|
var AsyncMutex = class {
|
|
@@ -5911,28 +5920,20 @@ var AsyncMutex = class {
|
|
|
5911
5920
|
}
|
|
5912
5921
|
};
|
|
5913
5922
|
|
|
5914
|
-
// src/common/fetch-like.ts
|
|
5915
|
-
function isUrlLike(value) {
|
|
5916
|
-
return typeof value === "object" && value !== null && typeof value.href === "string" && typeof value.pathname === "string" && typeof value.search === "string";
|
|
5917
|
-
}
|
|
5918
|
-
function isRequestLike(value) {
|
|
5919
|
-
return typeof value === "object" && value !== null && typeof value.url === "string" && typeof value.method === "string" && isHeadersLike(value.headers);
|
|
5920
|
-
}
|
|
5921
|
-
function isHeadersLike(value) {
|
|
5922
|
-
return typeof value === "object" && value !== null && typeof value.entries === "function";
|
|
5923
|
-
}
|
|
5924
|
-
|
|
5925
5923
|
// src/client/raw-utils.ts
|
|
5926
5924
|
async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
5927
5925
|
let path;
|
|
5926
|
+
let originalUrl;
|
|
5928
5927
|
let mergedInit = init || {};
|
|
5929
5928
|
if (typeof input === "string") {
|
|
5930
5929
|
path = input;
|
|
5931
5930
|
} else if (isUrlLike(input)) {
|
|
5932
5931
|
path = input.pathname + input.search;
|
|
5932
|
+
originalUrl = input.toString();
|
|
5933
5933
|
} else if (isRequestLike(input)) {
|
|
5934
5934
|
const url = new URL(input.url);
|
|
5935
5935
|
path = url.pathname + url.search;
|
|
5936
|
+
originalUrl = url.toString();
|
|
5936
5937
|
const requestHeaders = new Headers(input.headers);
|
|
5937
5938
|
const initHeaders = new Headers(init?.headers || {});
|
|
5938
5939
|
const mergedHeaders = new Headers(requestHeaders);
|
|
@@ -5974,6 +5975,10 @@ async function rawHttpFetch(driver, target, params, input, init, options = {}) {
|
|
|
5974
5975
|
const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
|
|
5975
5976
|
const url = new URL(`http://actor/request/${normalizedPath}`);
|
|
5976
5977
|
const proxyRequestHeaders = new Headers(mergedInit.headers);
|
|
5978
|
+
proxyRequestHeaders.delete(HEADER_ORIGINAL_REQUEST_URL);
|
|
5979
|
+
if (originalUrl) {
|
|
5980
|
+
proxyRequestHeaders.set(HEADER_ORIGINAL_REQUEST_URL, originalUrl);
|
|
5981
|
+
}
|
|
5977
5982
|
if (params) {
|
|
5978
5983
|
proxyRequestHeaders.set(HEADER_CONN_PARAMS, JSON.stringify(params));
|
|
5979
5984
|
}
|
|
@@ -6103,7 +6108,9 @@ var ActorHandleRaw = class {
|
|
|
6103
6108
|
async #sendQueueMessage(name, body, options) {
|
|
6104
6109
|
return await this.#queueSendMutex.run(async () => {
|
|
6105
6110
|
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
6106
|
-
let useQueryTarget = isDynamicActorQuery(
|
|
6111
|
+
let useQueryTarget = isDynamicActorQuery(
|
|
6112
|
+
this.#actorResolutionState
|
|
6113
|
+
);
|
|
6107
6114
|
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
6108
6115
|
let actorId;
|
|
6109
6116
|
try {
|
|
@@ -6452,9 +6459,10 @@ var ActorHandleRaw = class {
|
|
|
6452
6459
|
return this.#fetchWithResolvedActor(input, init);
|
|
6453
6460
|
}
|
|
6454
6461
|
async #fetchWithResolvedActor(input, init) {
|
|
6455
|
-
const maxAttempts = this.#getDynamicQueryMaxAttempts();
|
|
6456
|
-
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
6457
6462
|
const { skipReadyWait, ...requestInit } = init ?? {};
|
|
6463
|
+
const hasBody = requestInit.body !== void 0 ? requestInit.body !== null : isRequestLike(input) && input.body !== null;
|
|
6464
|
+
const maxAttempts = hasBody ? 1 : this.#getDynamicQueryMaxAttempts();
|
|
6465
|
+
let useQueryTarget = isDynamicActorQuery(this.#actorResolutionState);
|
|
6458
6466
|
const gatewayOptions = resolveActorGatewayOptions(
|
|
6459
6467
|
this.#gatewayOptions,
|
|
6460
6468
|
{
|