rivetkit 3.0.7 → 3.1.0-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.
- package/dist/browser/client.d.ts +112 -2
- package/dist/browser/client.js +145 -7
- package/dist/browser/client.js.map +1 -1
- package/dist/browser/inspector/client.js +1 -1
- package/dist/browser/inspector/client.js.map +1 -1
- package/dist/tsup/{chunk-AY25XAXA.js → chunk-5NNDJCH7.js} +3 -3
- package/dist/tsup/{chunk-AY25XAXA.js.map → chunk-5NNDJCH7.js.map} +1 -1
- package/dist/tsup/{chunk-U3CMQVMS.cjs → chunk-6LQ23TJA.cjs} +3 -3
- package/dist/tsup/{chunk-U3CMQVMS.cjs.map → chunk-6LQ23TJA.cjs.map} +1 -1
- package/dist/tsup/{chunk-YMCG4FCB.js → chunk-76FFOINJ.js} +149 -12
- package/dist/tsup/chunk-76FFOINJ.js.map +1 -0
- package/dist/tsup/{chunk-YO4TJ56P.js → chunk-CRC7NMU3.js} +2 -2
- package/dist/tsup/{chunk-NMLZDHH2.js → chunk-ECLJJGV6.js} +2 -2
- package/dist/tsup/{chunk-YTELGNB3.cjs → chunk-I3YW5B3I.cjs} +7 -7
- package/dist/tsup/{chunk-YTELGNB3.cjs.map → chunk-I3YW5B3I.cjs.map} +1 -1
- package/dist/tsup/{chunk-OEOODXVI.cjs → chunk-K6O7IE7P.cjs} +4 -4
- package/dist/tsup/{chunk-OEOODXVI.cjs.map → chunk-K6O7IE7P.cjs.map} +1 -1
- package/dist/tsup/{chunk-WBUHPDDM.cjs → chunk-MT3ZLU7U.cjs} +2 -2
- package/dist/tsup/chunk-MT3ZLU7U.cjs.map +1 -0
- package/dist/tsup/{chunk-HKD7AH4Z.cjs → chunk-MUCEIMJW.cjs} +287 -150
- package/dist/tsup/chunk-MUCEIMJW.cjs.map +1 -0
- package/dist/tsup/{chunk-YWWDUC6D.cjs → chunk-OKLZYDQB.cjs} +5 -1
- package/dist/tsup/chunk-OKLZYDQB.cjs.map +1 -0
- package/dist/tsup/{chunk-RFJ4NNO3.js → chunk-R4VUGJNR.js} +4 -4
- package/dist/tsup/{chunk-QTCX5KN3.js → chunk-SVWVXVV7.js} +2 -2
- package/dist/tsup/{chunk-K6WETGBW.cjs → chunk-SXEIT5DF.cjs} +3 -3
- package/dist/tsup/{chunk-K6WETGBW.cjs.map → chunk-SXEIT5DF.cjs.map} +1 -1
- package/dist/tsup/{chunk-S6ZMUE7Q.js → chunk-TDHEMJHH.js} +2 -2
- package/dist/tsup/{chunk-PBIQPYE5.js → chunk-UFHGMXXV.js} +5 -1
- package/dist/tsup/chunk-UFHGMXXV.js.map +1 -0
- package/dist/tsup/{chunk-7OXC5BQF.js → chunk-UYCRHJY2.js} +2 -2
- package/dist/tsup/chunk-UYCRHJY2.js.map +1 -0
- package/dist/tsup/{chunk-5A2KUC5L.cjs → chunk-VOGVBK5O.cjs} +10 -10
- package/dist/tsup/{chunk-5A2KUC5L.cjs.map → chunk-VOGVBK5O.cjs.map} +1 -1
- package/dist/tsup/{chunk-VM4SXQOC.cjs → chunk-YTSSP6NX.cjs} +3 -3
- package/dist/tsup/{chunk-VM4SXQOC.cjs.map → chunk-YTSSP6NX.cjs.map} +1 -1
- package/dist/tsup/client/mod.cjs +5 -5
- package/dist/tsup/client/mod.d.cts +2 -2
- package/dist/tsup/client/mod.d.ts +2 -2
- package/dist/tsup/client/mod.js +4 -4
- package/dist/tsup/common/log.cjs +2 -2
- package/dist/tsup/common/log.js +1 -1
- package/dist/tsup/common/websocket.cjs +3 -3
- package/dist/tsup/common/websocket.js +2 -2
- package/dist/tsup/{config-BDJltifk.d.cts → config-DFAysGOK.d.cts} +114 -3
- package/dist/tsup/{config-DXC7qzme.d.ts → config-Dn8SZJF8.d.ts} +114 -3
- package/dist/tsup/{context-DgPsVbw6.d.ts → context-D_c2ERjO.d.ts} +5 -1
- package/dist/tsup/{context-osC4Q1ax.d.cts → context-fSkMTO5w.d.cts} +5 -1
- package/dist/tsup/db/drizzle.cjs +2 -2
- package/dist/tsup/db/drizzle.js +1 -1
- package/dist/tsup/db/mod.cjs +3 -3
- package/dist/tsup/db/mod.js +2 -2
- package/dist/tsup/dynamic/mod.cjs +2 -2
- package/dist/tsup/dynamic/mod.d.cts +1 -1
- package/dist/tsup/dynamic/mod.d.ts +1 -1
- package/dist/tsup/dynamic/mod.js +1 -1
- package/dist/tsup/inspector/mod.cjs +5 -5
- package/dist/tsup/inspector/mod.js +4 -4
- package/dist/tsup/inspector/workflow.cjs +4 -4
- package/dist/tsup/inspector/workflow.js +3 -3
- package/dist/tsup/inspector-tab/mod.cjs +2 -2
- package/dist/tsup/inspector-tab/mod.d.cts +2 -2
- package/dist/tsup/inspector-tab/mod.d.ts +2 -2
- package/dist/tsup/inspector-tab/mod.js +1 -1
- package/dist/tsup/mod.cjs +153 -110
- 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 +49 -6
- package/dist/tsup/mod.js.map +1 -1
- package/dist/tsup/test/mod.cjs +6 -6
- package/dist/tsup/test/mod.d.cts +1 -1
- package/dist/tsup/test/mod.d.ts +1 -1
- package/dist/tsup/test/mod.js +4 -4
- package/dist/tsup/utils.cjs +2 -2
- package/dist/tsup/utils.js +1 -1
- package/dist/tsup/workflow/mod.cjs +22 -10
- package/dist/tsup/workflow/mod.cjs.map +1 -1
- package/dist/tsup/workflow/mod.d.cts +3 -3
- package/dist/tsup/workflow/mod.d.ts +3 -3
- package/dist/tsup/workflow/mod.js +17 -5
- package/dist/tsup/workflow/mod.js.map +1 -1
- package/package.json +9 -9
- package/src/actor/config.ts +79 -0
- package/src/client/actor-conn.ts +43 -7
- package/src/client/client.ts +93 -0
- package/src/client/errors.ts +12 -0
- package/src/client/lifecycle-errors.ts +28 -1
- package/src/client/mod.ts +1 -0
- package/src/client/retry-budget.ts +4 -1
- package/src/common/actor-router-consts.ts +1 -0
- package/src/engine-api/actors.ts +12 -0
- package/src/engine-client/actor-http-client.ts +6 -0
- package/src/engine-client/actor-websocket-client.ts +25 -1
- package/src/engine-client/api-endpoints.ts +16 -0
- package/src/engine-client/driver.ts +12 -0
- package/src/engine-client/mod.ts +30 -0
- package/src/registry/napi-runtime.ts +8 -0
- package/src/registry/native.ts +49 -0
- package/src/registry/runtime.ts +11 -0
- package/src/registry/wasm-runtime.ts +9 -0
- package/src/workflow/context.ts +17 -0
- package/dist/tsup/chunk-7OXC5BQF.js.map +0 -1
- package/dist/tsup/chunk-HKD7AH4Z.cjs.map +0 -1
- package/dist/tsup/chunk-PBIQPYE5.js.map +0 -1
- package/dist/tsup/chunk-WBUHPDDM.cjs.map +0 -1
- package/dist/tsup/chunk-YMCG4FCB.js.map +0 -1
- package/dist/tsup/chunk-YWWDUC6D.cjs.map +0 -1
- /package/dist/tsup/{chunk-YO4TJ56P.js.map → chunk-CRC7NMU3.js.map} +0 -0
- /package/dist/tsup/{chunk-NMLZDHH2.js.map → chunk-ECLJJGV6.js.map} +0 -0
- /package/dist/tsup/{chunk-RFJ4NNO3.js.map → chunk-R4VUGJNR.js.map} +0 -0
- /package/dist/tsup/{chunk-QTCX5KN3.js.map → chunk-SVWVXVV7.js.map} +0 -0
- /package/dist/tsup/{chunk-S6ZMUE7Q.js.map → chunk-TDHEMJHH.js.map} +0 -0
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
ClientConfigSchema,
|
|
3
3
|
RemoteEngineControlClient,
|
|
4
4
|
createClientWithDriver
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-76FFOINJ.js";
|
|
6
6
|
import {
|
|
7
7
|
getLogger
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UYCRHJY2.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-
|
|
49
|
+
//# sourceMappingURL=chunk-5NNDJCH7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/devtools-loader/log.ts","../../src/devtools-loader/index.ts","../../src/client/mod.ts"],"sourcesContent":["import { getLogger } from \"@/common/log\";\n\nexport function logger() {\n\treturn getLogger(\"devtools\");\n}\n","import type { ClientConfigInput } from \"@/client/client\";\nimport { logger } from \"./log\";\n\ndeclare global {\n\t// Injected via tsup config\n\tvar CUSTOM_RIVETKIT_DEVTOOLS_URL: string | undefined;\n}\n\nconst scriptId = \"rivetkit-devtools-script\";\n\nexport function injectDevtools(config: ClientConfigInput) {\n\tif (!window) {\n\t\tlogger().warn(\"devtools not available outside browser environment\");\n\t\treturn;\n\t}\n\n\tif (!document.getElementById(scriptId)) {\n\t\tconst src =\n\t\t\tglobalThis.CUSTOM_RIVETKIT_DEVTOOLS_URL ||\n\t\t\t`${config.endpoint?.replace(/\\/$/, \"\")}/devtools/mod.js`;\n\t\tconst script = document.createElement(\"script\");\n\t\tscript.id = scriptId;\n\t\tscript.src = src;\n\t\tscript.async = true;\n\t\tdocument.head.appendChild(script);\n\t}\n\n\twindow.__rivetkit = window.__rivetkit || [];\n\twindow.__rivetkit.push(config);\n}\n","import { injectDevtools } from \"@/devtools-loader\";\nimport { RemoteEngineControlClient } from \"@/engine-client/mod\";\nimport type { Registry } from \"@/registry\";\nimport {\n\ttype Client,\n\ttype ClientConfigInput,\n\tcreateClientWithDriver,\n} from \"./client\";\nimport { ClientConfigSchema } from \"./config\";\n\nexport type { ActorDefinition, AnyActorDefinition } from \"@/actor/definition\";\nexport {\n\tActorClientError,\n\tActorConnDisposed,\n\tActorError,\n\tMalformedResponseMessage,\n\tManagerError,\n\tRivetError,\n\tUserError,\n} from \"@/client/errors\";\nexport type { CreateRequest } from \"@/client/query\";\nexport type {\n\tActorIssueTokenOptions,\n\tActorTokenPermissions,\n\tActorTokenResource,\n\tIssuedToken,\n\tIssueTokenOptions,\n\tTokenGrant,\n} from \"./auth\";\nexport type { Encoding } from \"@/common/encoding\";\nexport type {\n\tActorActionFunction,\n\tActorActionOptions,\n\tActorConnectOptions,\n\tActorGatewayOptions,\n} from \"./actor-common\";\nexport type {\n\tActorConn,\n\tActorConnStatus,\n\tConnectionStateCallback,\n\tEventUnsubscribe,\n\tStatusChangeCallback,\n} from \"./actor-conn\";\nexport { ActorConnRaw } from \"./actor-conn\";\nexport type { ActorHandle } from \"./actor-handle\";\nexport { ActorHandleRaw } from \"./actor-handle\";\nexport type {\n\tActorAccessor,\n\tClient,\n\tClientConfigInput,\n\tClientRaw,\n\tCreateOptions,\n\tExtractActorsFromRegistry,\n\tExtractRegistryFromClient,\n\tGetOptions,\n\tGetWithIdOptions,\n\tQueryOptions,\n\tRegion,\n} from \"./client\";\nexport type { GetToken } from \"./token-provider\";\n\n/**\n * Creates a client with the actor accessor proxy.\n */\nexport function createClient<A extends Registry<any>>(\n\tendpointOrConfig?: string | ClientConfigInput,\n): Client<A> {\n\t// Parse config\n\tconst configInput =\n\t\tendpointOrConfig === undefined\n\t\t\t? {}\n\t\t\t: typeof endpointOrConfig === \"string\"\n\t\t\t\t? { endpoint: endpointOrConfig }\n\t\t\t\t: endpointOrConfig;\n\tconst config = ClientConfigSchema.parse(configInput);\n\n\t// Create client\n\tconst driver = new RemoteEngineControlClient(config);\n\n\tif (config.devtools) {\n\t\tinjectDevtools(config);\n\t}\n\n\treturn createClientWithDriver<A>(driver, config);\n}\n"],"mappings":";;;;;;;;;;AAEO,SAAS,SAAS;AACxB,SAAO,UAAU,UAAU;AAC5B;;;ACIA,IAAM,WAAW;AAEV,SAAS,eAAe,QAA2B;AAV1D;AAWC,MAAI,CAAC,QAAQ;AACZ,WAAO,EAAE,KAAK,oDAAoD;AAClE;AAAA,EACD;AAEA,MAAI,CAAC,SAAS,eAAe,QAAQ,GAAG;AACvC,UAAM,MAEL,IAAG,YAAO,aAAP,mBAAiB,QAAQ,OAAO,GAAG;AACvC,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,KAAK;AACZ,WAAO,MAAM;AACb,WAAO,QAAQ;AACf,aAAS,KAAK,YAAY,MAAM;AAAA,EACjC;AAEA,SAAO,aAAa,OAAO,cAAc,CAAC;AAC1C,SAAO,WAAW,KAAK,MAAM;AAC9B;;;
|
|
1
|
+
{"version":3,"sources":["../../src/devtools-loader/log.ts","../../src/devtools-loader/index.ts","../../src/client/mod.ts"],"sourcesContent":["import { getLogger } from \"@/common/log\";\n\nexport function logger() {\n\treturn getLogger(\"devtools\");\n}\n","import type { ClientConfigInput } from \"@/client/client\";\nimport { logger } from \"./log\";\n\ndeclare global {\n\t// Injected via tsup config\n\tvar CUSTOM_RIVETKIT_DEVTOOLS_URL: string | undefined;\n}\n\nconst scriptId = \"rivetkit-devtools-script\";\n\nexport function injectDevtools(config: ClientConfigInput) {\n\tif (!window) {\n\t\tlogger().warn(\"devtools not available outside browser environment\");\n\t\treturn;\n\t}\n\n\tif (!document.getElementById(scriptId)) {\n\t\tconst src =\n\t\t\tglobalThis.CUSTOM_RIVETKIT_DEVTOOLS_URL ||\n\t\t\t`${config.endpoint?.replace(/\\/$/, \"\")}/devtools/mod.js`;\n\t\tconst script = document.createElement(\"script\");\n\t\tscript.id = scriptId;\n\t\tscript.src = src;\n\t\tscript.async = true;\n\t\tdocument.head.appendChild(script);\n\t}\n\n\twindow.__rivetkit = window.__rivetkit || [];\n\twindow.__rivetkit.push(config);\n}\n","import { injectDevtools } from \"@/devtools-loader\";\nimport { RemoteEngineControlClient } from \"@/engine-client/mod\";\nimport type { Registry } from \"@/registry\";\nimport {\n\ttype Client,\n\ttype ClientConfigInput,\n\tcreateClientWithDriver,\n} from \"./client\";\nimport { ClientConfigSchema } from \"./config\";\n\nexport type { ActorDefinition, AnyActorDefinition } from \"@/actor/definition\";\nexport {\n\tActorClientError,\n\tActorConnDisposed,\n\tActorError,\n\tMalformedResponseMessage,\n\tManagerError,\n\tRivetError,\n\tUserError,\n} from \"@/client/errors\";\nexport type { CreateRequest } from \"@/client/query\";\nexport type {\n\tActorIssueTokenOptions,\n\tActorTokenPermissions,\n\tActorTokenResource,\n\tIssuedToken,\n\tIssueTokenOptions,\n\tTokenGrant,\n} from \"./auth\";\nexport type { Encoding } from \"@/common/encoding\";\nexport type {\n\tActorActionFunction,\n\tActorActionOptions,\n\tActorConnectOptions,\n\tActorGatewayOptions,\n} from \"./actor-common\";\nexport type {\n\tActorConn,\n\tActorConnStatus,\n\tConnectionStateCallback,\n\tEventUnsubscribe,\n\tStatusChangeCallback,\n} from \"./actor-conn\";\nexport { ActorConnRaw } from \"./actor-conn\";\nexport type { ActorHandle } from \"./actor-handle\";\nexport { ActorHandleRaw } from \"./actor-handle\";\nexport type {\n\tActorAccessor,\n\tClient,\n\tClientConfigInput,\n\tClientRaw,\n\tCreateOptions,\n\tExtractActorsFromRegistry,\n\tExtractRegistryFromClient,\n\tForkOptions,\n\tGetOptions,\n\tGetWithIdOptions,\n\tQueryOptions,\n\tRegion,\n} from \"./client\";\nexport type { GetToken } from \"./token-provider\";\n\n/**\n * Creates a client with the actor accessor proxy.\n */\nexport function createClient<A extends Registry<any>>(\n\tendpointOrConfig?: string | ClientConfigInput,\n): Client<A> {\n\t// Parse config\n\tconst configInput =\n\t\tendpointOrConfig === undefined\n\t\t\t? {}\n\t\t\t: typeof endpointOrConfig === \"string\"\n\t\t\t\t? { endpoint: endpointOrConfig }\n\t\t\t\t: endpointOrConfig;\n\tconst config = ClientConfigSchema.parse(configInput);\n\n\t// Create client\n\tconst driver = new RemoteEngineControlClient(config);\n\n\tif (config.devtools) {\n\t\tinjectDevtools(config);\n\t}\n\n\treturn createClientWithDriver<A>(driver, config);\n}\n"],"mappings":";;;;;;;;;;AAEO,SAAS,SAAS;AACxB,SAAO,UAAU,UAAU;AAC5B;;;ACIA,IAAM,WAAW;AAEV,SAAS,eAAe,QAA2B;AAV1D;AAWC,MAAI,CAAC,QAAQ;AACZ,WAAO,EAAE,KAAK,oDAAoD;AAClE;AAAA,EACD;AAEA,MAAI,CAAC,SAAS,eAAe,QAAQ,GAAG;AACvC,UAAM,MAEL,IAAG,YAAO,aAAP,mBAAiB,QAAQ,OAAO,GAAG;AACvC,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,KAAK;AACZ,WAAO,MAAM;AACb,WAAO,QAAQ;AACf,aAAS,KAAK,YAAY,MAAM;AAAA,EACjC;AAEA,SAAO,aAAa,OAAO,cAAc,CAAC;AAC1C,SAAO,WAAW,KAAK,MAAM;AAC9B;;;ACoCO,SAAS,aACf,kBACY;AAEZ,QAAM,cACL,qBAAqB,SAClB,CAAC,IACD,OAAO,qBAAqB,WAC3B,EAAE,UAAU,iBAAiB,IAC7B;AACL,QAAM,SAAS,mBAAmB,MAAM,WAAW;AAGnD,QAAM,SAAS,IAAI,0BAA0B,MAAM;AAEnD,MAAI,OAAO,UAAU;AACpB,mBAAe,MAAM;AAAA,EACtB;AAEA,SAAO,uBAA0B,QAAQ,MAAM;AAChD;","names":[]}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkMT3ZLU7Ucjs = require('./chunk-MT3ZLU7U.cjs');
|
|
5
5
|
|
|
6
6
|
// src/inspector/workflow.ts
|
|
7
7
|
function encodeWorkflowInspectorValue(value) {
|
|
8
|
-
return
|
|
8
|
+
return _chunkMT3ZLU7Ucjs.bufferToArrayBuffer.call(void 0, _chunkMT3ZLU7Ucjs.encodeCborCompat.call(void 0, value));
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
exports.encodeWorkflowInspectorValue = encodeWorkflowInspectorValue;
|
|
14
|
-
//# sourceMappingURL=chunk-
|
|
14
|
+
//# sourceMappingURL=chunk-6LQ23TJA.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/chunk-6LQ23TJA.cjs","../../src/inspector/workflow.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACqDO,SAAS,4BAAA,CAA6B,KAAA,EAA6B;AACzE,EAAA,OAAO,mDAAA,gDAAoB,KAAyC,CAAC,CAAA;AACtE;ADnDA;AACA;AACE;AACF,oEAAC","file":"/home/runner/work/rivet/rivet/rivetkit-typescript/packages/rivetkit/dist/tsup/chunk-6LQ23TJA.cjs","sourcesContent":[null,"import type { JsonCompatValue } from \"@/common/encoding\";\nimport type { WorkflowHistoryBytes } from \"@/common/inspector-transport\";\nimport { encodeCborCompat } from \"@/serde\";\nimport { bufferToArrayBuffer } from \"@/utils\";\n\nexport type {\n\tWorkflowBranchStatus,\n\tWorkflowCbor,\n\tWorkflowEntry,\n\tWorkflowEntryKind,\n\tWorkflowEntryMetadata,\n\tWorkflowHistory,\n\tWorkflowJoinEntry,\n\tWorkflowLocation,\n\tWorkflowLoopEntry,\n\tWorkflowLoopIterationMarker,\n\tWorkflowMessageEntry,\n\tWorkflowNameIndex,\n\tWorkflowPathSegment,\n\tWorkflowRaceEntry,\n\tWorkflowRemovedEntry,\n\tWorkflowRollbackCheckpointEntry,\n\tWorkflowSleepEntry,\n\tWorkflowStepEntry,\n\tWorkflowVersionCheckEntry,\n} from \"@/common/bare/transport/v1\";\nexport {\n\tWorkflowBranchStatusType,\n\tWorkflowEntryStatus,\n\tWorkflowSleepState,\n} from \"@/common/bare/transport/v1\";\nexport type { WorkflowHistoryBytes } from \"@/common/inspector-transport\";\nexport {\n\tdecodeWorkflowHistoryTransport,\n\tencodeWorkflowHistoryTransport,\n} from \"@/common/inspector-transport\";\n\n/** @experimental State exposed by a durable workflow run handler to the Inspector. */\nexport type WorkflowState =\n\t| \"pending\"\n\t| \"running\"\n\t| \"sleeping\"\n\t| \"failed\"\n\t| \"completed\"\n\t| \"cancelled\"\n\t| \"rolling_back\";\n\n/** @experimental The raw workflow Inspector adapter consumed by RivetKit's transport. */\nexport interface WorkflowInspectorAdapter {\n\tgetHistory: () => WorkflowHistoryBytes | null;\n\tgetState: () => Promise<WorkflowState | null>;\n\tonHistoryUpdated: (\n\t\tlistener: (history: WorkflowHistoryBytes) => void,\n\t) => () => void;\n\treplayFromStep: (entryId?: string) => Promise<WorkflowHistoryBytes | null>;\n}\n\n/** @experimental Encodes a workflow Inspector value with RivetKit's CBOR-compatible codec. */\nexport function encodeWorkflowInspectorValue(value: unknown): ArrayBuffer {\n\treturn bufferToArrayBuffer(encodeCborCompat(value as JsonCompatValue));\n}\n"]}
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
deserializeActorKey,
|
|
4
4
|
serializeActorKey
|
|
5
5
|
} from "./chunk-A2CF6PFH.js";
|
|
6
|
-
import {
|
|
7
|
-
AsyncMutex
|
|
8
|
-
} from "./chunk-JTHHCZCZ.js";
|
|
9
6
|
import {
|
|
10
7
|
importWebSocket,
|
|
11
8
|
logger
|
|
12
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ECLJJGV6.js";
|
|
10
|
+
import {
|
|
11
|
+
AsyncMutex
|
|
12
|
+
} from "./chunk-JTHHCZCZ.js";
|
|
13
13
|
import {
|
|
14
14
|
EncodingSchema,
|
|
15
15
|
assertUnreachable,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
serializeWithEncoding,
|
|
37
37
|
stringifyError,
|
|
38
38
|
uint8ArrayToBase64
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-UYCRHJY2.js";
|
|
40
40
|
import {
|
|
41
41
|
INTERNAL_ERROR_CODE,
|
|
42
42
|
RivetError,
|
|
@@ -67,6 +67,7 @@ var HEADER_RIVET_SKIP_READY_WAIT = "x-rivet-skip-ready-wait";
|
|
|
67
67
|
var WS_PROTOCOL_STANDARD = "rivet";
|
|
68
68
|
var WS_PROTOCOL_TARGET = "rivet_target.";
|
|
69
69
|
var WS_PROTOCOL_ACTOR = "rivet_actor.";
|
|
70
|
+
var WS_PROTOCOL_NAMESPACE = "rivet_namespace.";
|
|
70
71
|
var WS_PROTOCOL_ENCODING = "rivet_encoding.";
|
|
71
72
|
var WS_PROTOCOL_CONN_PARAMS = "rivet_conn_params.";
|
|
72
73
|
var WS_PROTOCOL_TOKEN = "rivet_token.";
|
|
@@ -114,6 +115,12 @@ var ActorConnDisposed = class extends ActorClientError {
|
|
|
114
115
|
function isSchedulingError(group, code) {
|
|
115
116
|
return group === "guard" && (code === "actor_ready_timeout" || code === "actor_runner_failed");
|
|
116
117
|
}
|
|
118
|
+
function isActorDestroyed(group, code) {
|
|
119
|
+
return group === "actor" && code === "destroyed";
|
|
120
|
+
}
|
|
121
|
+
function isActorNotFound(group, code) {
|
|
122
|
+
return group === "actor" && code === "not_found";
|
|
123
|
+
}
|
|
117
124
|
function actorSchedulingError(group, code, actorId, details, rayId) {
|
|
118
125
|
return new RivetError(
|
|
119
126
|
group,
|
|
@@ -2222,7 +2229,10 @@ function retryAfterMs(error) {
|
|
|
2222
2229
|
return typeof hint === "number" && hint >= 0 ? hint : void 0;
|
|
2223
2230
|
}
|
|
2224
2231
|
function retryDelayMs(attempt, opts) {
|
|
2225
|
-
const backoff = Math.min(
|
|
2232
|
+
const backoff = Math.min(
|
|
2233
|
+
opts.initialDelayMs * 2 ** attempt,
|
|
2234
|
+
opts.maxDelayMs
|
|
2235
|
+
);
|
|
2226
2236
|
const jittered = backoff / 2 + Math.random() * (backoff / 2);
|
|
2227
2237
|
return Math.max(jittered, opts.hintMs ?? 0);
|
|
2228
2238
|
}
|
|
@@ -2409,11 +2419,25 @@ async function waitWithSignal(ms, signal) {
|
|
|
2409
2419
|
signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
2410
2420
|
});
|
|
2411
2421
|
}
|
|
2422
|
+
function isRetryableForkRefusal(error) {
|
|
2423
|
+
if (!(error instanceof RivetError)) {
|
|
2424
|
+
return false;
|
|
2425
|
+
}
|
|
2426
|
+
if (error.group === "actor" && error.code === "fork_unavailable") {
|
|
2427
|
+
return true;
|
|
2428
|
+
}
|
|
2429
|
+
if (error.group === "guard" && error.code === "service_unavailable") {
|
|
2430
|
+
const metadata = error.metadata;
|
|
2431
|
+
return (metadata == null ? void 0 : metadata.reason) === "actor_moving";
|
|
2432
|
+
}
|
|
2433
|
+
return false;
|
|
2434
|
+
}
|
|
2412
2435
|
async function retryOnLifecycleBoundary(run, opts) {
|
|
2413
2436
|
var _a;
|
|
2414
2437
|
const maxAttempts = (opts == null ? void 0 : opts.maxAttempts) ?? 5;
|
|
2415
2438
|
const initialDelayMs = (opts == null ? void 0 : opts.initialDelayMs) ?? 25;
|
|
2416
2439
|
const maxDelayMs = (opts == null ? void 0 : opts.maxDelayMs) ?? 200;
|
|
2440
|
+
const isRetryable = (opts == null ? void 0 : opts.isRetryable) ?? isRetryableLifecycleRequestError;
|
|
2417
2441
|
(_a = opts == null ? void 0 : opts.budget) == null ? void 0 : _a.deposit();
|
|
2418
2442
|
let lastError;
|
|
2419
2443
|
for (let attempt = 0; attempt < maxAttempts; attempt += 1) {
|
|
@@ -2421,7 +2445,7 @@ async function retryOnLifecycleBoundary(run, opts) {
|
|
|
2421
2445
|
try {
|
|
2422
2446
|
return await run();
|
|
2423
2447
|
} catch (error) {
|
|
2424
|
-
if (!
|
|
2448
|
+
if (!isRetryable(error)) {
|
|
2425
2449
|
throw error;
|
|
2426
2450
|
}
|
|
2427
2451
|
lastError = error;
|
|
@@ -3863,6 +3887,49 @@ var ClientRaw = class {
|
|
|
3863
3887
|
const proxy = createActorProxy(handle);
|
|
3864
3888
|
return proxy;
|
|
3865
3889
|
}
|
|
3890
|
+
/**
|
|
3891
|
+
* Forks the actor `actorId` into a new actor and returns a handle to it.
|
|
3892
|
+
*
|
|
3893
|
+
* @template AD The actor class that this handle is for.
|
|
3894
|
+
* @param {string} name - The name of the actor; the source has the same name.
|
|
3895
|
+
* @param {string} actorId - The ID of the source actor.
|
|
3896
|
+
* @param {ForkOptions} [opts] - The new actor's key and the fork input.
|
|
3897
|
+
* @returns {Promise<ActorHandle<AD>>} - A promise that resolves to a handle to the new actor.
|
|
3898
|
+
*/
|
|
3899
|
+
async fork(name, actorId, opts) {
|
|
3900
|
+
const key = typeof (opts == null ? void 0 : opts.key) === "string" ? [opts.key] : opts == null ? void 0 : opts.key;
|
|
3901
|
+
logger().debug({
|
|
3902
|
+
msg: "fork actor",
|
|
3903
|
+
name,
|
|
3904
|
+
sourceActorId: actorId,
|
|
3905
|
+
key
|
|
3906
|
+
});
|
|
3907
|
+
const forked = await retryOnLifecycleBoundary(
|
|
3908
|
+
() => this.#driver.forkActor({
|
|
3909
|
+
actorId,
|
|
3910
|
+
key,
|
|
3911
|
+
input: opts == null ? void 0 : opts.input
|
|
3912
|
+
}),
|
|
3913
|
+
{
|
|
3914
|
+
signal: opts == null ? void 0 : opts.signal,
|
|
3915
|
+
budget: this.#retryBudget,
|
|
3916
|
+
isRetryable: isRetryableForkRefusal
|
|
3917
|
+
}
|
|
3918
|
+
);
|
|
3919
|
+
const getForIdQuery = {
|
|
3920
|
+
getForId: {
|
|
3921
|
+
name,
|
|
3922
|
+
actorId: forked.actorId
|
|
3923
|
+
}
|
|
3924
|
+
};
|
|
3925
|
+
const handle = this.#createHandle(
|
|
3926
|
+
opts == null ? void 0 : opts.params,
|
|
3927
|
+
opts == null ? void 0 : opts.getParams,
|
|
3928
|
+
getForIdQuery,
|
|
3929
|
+
opts == null ? void 0 : opts.signal
|
|
3930
|
+
);
|
|
3931
|
+
return createActorProxy(handle);
|
|
3932
|
+
}
|
|
3866
3933
|
#createHandle(params, getParams, actorQuery, signal) {
|
|
3867
3934
|
return new ActorHandleRaw(
|
|
3868
3935
|
this,
|
|
@@ -3927,6 +3994,9 @@ function createClientWithDriver(driver, options = {}) {
|
|
|
3927
3994
|
},
|
|
3928
3995
|
create: async (key, opts = {}) => {
|
|
3929
3996
|
return await target.create(prop, key, opts);
|
|
3997
|
+
},
|
|
3998
|
+
fork: async (actorId, opts = {}) => {
|
|
3999
|
+
return await target.fork(prop, actorId, opts);
|
|
3930
4000
|
}
|
|
3931
4001
|
};
|
|
3932
4002
|
}
|
|
@@ -4087,6 +4157,7 @@ var ActorConnRaw = class {
|
|
|
4087
4157
|
#connStatus = "idle";
|
|
4088
4158
|
/** The opening failure that stopped retries. Later actions must fail instead of queueing. */
|
|
4089
4159
|
#connectionOpenError;
|
|
4160
|
+
#dispatchedErrors = /* @__PURE__ */ new WeakSet();
|
|
4090
4161
|
#actorId;
|
|
4091
4162
|
#connId;
|
|
4092
4163
|
#messageQueue = [];
|
|
@@ -4184,7 +4255,13 @@ var ActorConnRaw = class {
|
|
|
4184
4255
|
return true;
|
|
4185
4256
|
}
|
|
4186
4257
|
#shouldReconnectForStaleActor(group, code) {
|
|
4187
|
-
|
|
4258
|
+
if (!isDynamicActorQuery(this.#actorResolutionState) || !isStaleResolvedActorError(group, code) || this.#onOpenPromise === void 0 || this.#connStatus === "connected") {
|
|
4259
|
+
return false;
|
|
4260
|
+
}
|
|
4261
|
+
if (isActorNotFound(group, code) && "getForKey" in this.#actorResolutionState) {
|
|
4262
|
+
return false;
|
|
4263
|
+
}
|
|
4264
|
+
return true;
|
|
4188
4265
|
}
|
|
4189
4266
|
send(name, body, options) {
|
|
4190
4267
|
return this.#sendQueueMessage(name, body, options);
|
|
@@ -4354,7 +4431,9 @@ var ActorConnRaw = class {
|
|
|
4354
4431
|
);
|
|
4355
4432
|
this.#connectionOpenError = actorError;
|
|
4356
4433
|
this.#rejectPendingPromises(actorError, false);
|
|
4357
|
-
this.#
|
|
4434
|
+
if (!this.#dispatchedErrors.has(actorError)) {
|
|
4435
|
+
this.#dispatchActorError(actorError);
|
|
4436
|
+
}
|
|
4358
4437
|
this.#setConnStatus("idle");
|
|
4359
4438
|
throw new AbortError(
|
|
4360
4439
|
error instanceof Error ? error : new Error(stringifyError(error))
|
|
@@ -4787,6 +4866,16 @@ var ActorConnRaw = class {
|
|
|
4787
4866
|
if (error instanceof RivetError) {
|
|
4788
4867
|
this.#dispatchActorError(error);
|
|
4789
4868
|
}
|
|
4869
|
+
if (error instanceof RivetError && isActorDestroyed(error.group, error.code)) {
|
|
4870
|
+
this.#connectionOpenError = error;
|
|
4871
|
+
this.#setConnStatus("idle");
|
|
4872
|
+
return;
|
|
4873
|
+
}
|
|
4874
|
+
if (error instanceof RivetError && isInvalidToken(error.group, error.code) && !this.#authRetryAvailable) {
|
|
4875
|
+
this.#connectionOpenError = error;
|
|
4876
|
+
this.#setConnStatus("idle");
|
|
4877
|
+
return;
|
|
4878
|
+
}
|
|
4790
4879
|
if (wasConnected && this.#authRetryAvailable) {
|
|
4791
4880
|
logger().debug({
|
|
4792
4881
|
msg: "triggering reconnect",
|
|
@@ -4856,6 +4945,7 @@ var ActorConnRaw = class {
|
|
|
4856
4945
|
}
|
|
4857
4946
|
}
|
|
4858
4947
|
#dispatchActorError(error) {
|
|
4948
|
+
this.#dispatchedErrors.add(error);
|
|
4859
4949
|
for (const handler of [...this.#errorHandlers]) {
|
|
4860
4950
|
try {
|
|
4861
4951
|
handler(error);
|
|
@@ -5518,6 +5608,9 @@ function buildGuardHeaders(runConfig, actorRequest, options) {
|
|
|
5518
5608
|
if (options.directActorId !== void 0) {
|
|
5519
5609
|
headers.set(HEADER_RIVET_TARGET, "actor");
|
|
5520
5610
|
headers.set(HEADER_RIVET_ACTOR, options.directActorId);
|
|
5611
|
+
if (runConfig.namespace) {
|
|
5612
|
+
headers.set(HEADER_RIVET_NAMESPACE, runConfig.namespace);
|
|
5613
|
+
}
|
|
5521
5614
|
}
|
|
5522
5615
|
if (shouldSkipReadyWait(options)) {
|
|
5523
5616
|
headers.set(HEADER_RIVET_SKIP_READY_WAIT, "1");
|
|
@@ -5698,9 +5791,22 @@ var BufferedRemoteWebSocket = class {
|
|
|
5698
5791
|
return true;
|
|
5699
5792
|
}
|
|
5700
5793
|
};
|
|
5701
|
-
function buildActorGatewayUrl(endpoint, actorId, token, path = "") {
|
|
5794
|
+
function buildActorGatewayUrl(endpoint, namespace, actorId, token, path = "") {
|
|
5795
|
+
if (namespace.length === 0) {
|
|
5796
|
+
throw new Error("actor gateway namespace must not be empty");
|
|
5797
|
+
}
|
|
5702
5798
|
const tokenSegment = token !== void 0 ? `@${encodeURIComponent(token)}` : "";
|
|
5703
|
-
const
|
|
5799
|
+
const params = new URLSearchParams();
|
|
5800
|
+
params.append("rvt-namespace", namespace);
|
|
5801
|
+
let separator;
|
|
5802
|
+
if (path.endsWith("?") || path.endsWith("&")) {
|
|
5803
|
+
separator = "";
|
|
5804
|
+
} else if (path.includes("?")) {
|
|
5805
|
+
separator = "&";
|
|
5806
|
+
} else {
|
|
5807
|
+
separator = "?";
|
|
5808
|
+
}
|
|
5809
|
+
const gatewayPath = `/gateway/${encodeURIComponent(actorId)}${tokenSegment}${path}${separator}${params.toString()}`;
|
|
5704
5810
|
return combineUrlPath(endpoint, gatewayPath);
|
|
5705
5811
|
}
|
|
5706
5812
|
function buildActorQueryGatewayUrl(endpoint, namespace, query, token, path = "", maxInputSize = DEFAULT_MAX_QUERY_INPUT_SIZE, crashPolicy = void 0, runnerName, options = {}) {
|
|
@@ -5832,6 +5938,9 @@ function buildWebSocketProtocols(runConfig, encoding, params, ackHookToken, targ
|
|
|
5832
5938
|
if (target) {
|
|
5833
5939
|
protocols.push(`${WS_PROTOCOL_TARGET}${target.target}`);
|
|
5834
5940
|
protocols.push(`${WS_PROTOCOL_ACTOR}${target.actorId}`);
|
|
5941
|
+
if (runConfig.namespace) {
|
|
5942
|
+
protocols.push(`${WS_PROTOCOL_NAMESPACE}${runConfig.namespace}`);
|
|
5943
|
+
}
|
|
5835
5944
|
if (runConfig.token) {
|
|
5836
5945
|
protocols.push(`${WS_PROTOCOL_TOKEN}${runConfig.token}`);
|
|
5837
5946
|
}
|
|
@@ -5937,6 +6046,14 @@ async function createActor(config, request) {
|
|
|
5937
6046
|
request
|
|
5938
6047
|
);
|
|
5939
6048
|
}
|
|
6049
|
+
async function forkActor(config, actorId, request) {
|
|
6050
|
+
return apiCall(
|
|
6051
|
+
config,
|
|
6052
|
+
"POST",
|
|
6053
|
+
`/actors/${encodeURIComponent(actorId)}/fork`,
|
|
6054
|
+
request
|
|
6055
|
+
);
|
|
6056
|
+
}
|
|
5940
6057
|
async function destroyActor(config, actorId) {
|
|
5941
6058
|
return apiCall(
|
|
5942
6059
|
config,
|
|
@@ -6357,6 +6474,24 @@ var RemoteEngineControlClient = class {
|
|
|
6357
6474
|
});
|
|
6358
6475
|
return apiActorToOutput(result.actor);
|
|
6359
6476
|
}
|
|
6477
|
+
async forkActor({ actorId, key, input }) {
|
|
6478
|
+
await this.#metadataPromise;
|
|
6479
|
+
logger2().info({ msg: "forking actor via engine api", actorId, key });
|
|
6480
|
+
const result = await this.#withCredential(
|
|
6481
|
+
(config) => forkActor(config, actorId, {
|
|
6482
|
+
key: key ? serializeActorKey(key) : void 0,
|
|
6483
|
+
input: input !== void 0 ? uint8ArrayToBase64(
|
|
6484
|
+
encodeCborCompat(input)
|
|
6485
|
+
) : void 0
|
|
6486
|
+
})
|
|
6487
|
+
);
|
|
6488
|
+
logger2().info({
|
|
6489
|
+
msg: "actor forked",
|
|
6490
|
+
actorId: result.actor.actor_id,
|
|
6491
|
+
sourceActorId: actorId
|
|
6492
|
+
});
|
|
6493
|
+
return apiActorToOutput(result.actor);
|
|
6494
|
+
}
|
|
6360
6495
|
async listActors({ name }) {
|
|
6361
6496
|
await this.#metadataPromise;
|
|
6362
6497
|
logger2().debug({ msg: "listing actors via engine api", name });
|
|
@@ -6511,6 +6646,7 @@ var RemoteEngineControlClient = class {
|
|
|
6511
6646
|
if ("directId" in target) {
|
|
6512
6647
|
return buildActorGatewayUrl(
|
|
6513
6648
|
endpoint,
|
|
6649
|
+
config.namespace,
|
|
6514
6650
|
target.directId,
|
|
6515
6651
|
config.token,
|
|
6516
6652
|
path
|
|
@@ -6519,6 +6655,7 @@ var RemoteEngineControlClient = class {
|
|
|
6519
6655
|
if ("getForId" in target) {
|
|
6520
6656
|
return buildActorGatewayUrl(
|
|
6521
6657
|
endpoint,
|
|
6658
|
+
config.namespace,
|
|
6522
6659
|
target.getForId.actorId,
|
|
6523
6660
|
config.token,
|
|
6524
6661
|
path
|
|
@@ -6607,4 +6744,4 @@ export {
|
|
|
6607
6744
|
updateRunnerConfig,
|
|
6608
6745
|
RemoteEngineControlClient
|
|
6609
6746
|
};
|
|
6610
|
-
//# sourceMappingURL=chunk-
|
|
6747
|
+
//# sourceMappingURL=chunk-76FFOINJ.js.map
|