@valerypopoff/rivet2-core 2.3.0 → 2.4.0
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/cjs/bundle.cjs +517 -96
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +1537 -121
- package/dist/cjs/webAppRuntime.cjs.map +4 -4
- package/dist/esm/api/createProcessor.js +2 -0
- package/dist/esm/exports.js +2 -0
- package/dist/esm/model/AgentResponseTrace.js +16 -0
- package/dist/esm/model/GraphProcessor.js +14 -0
- package/dist/esm/model/NodeExclusionPolicy.js +9 -1
- package/dist/esm/model/ProcessContextBuilder.js +2 -1
- package/dist/esm/model/RecordingPlayer.js +8 -0
- package/dist/esm/model/SubprocessorBridge.js +1 -0
- package/dist/esm/model/UiGraphActionProtocol.js +46 -4
- package/dist/esm/model/UiGraphBrowserRuntime.js +15 -1
- package/dist/esm/model/UiGraphIndexedDbPersistence.js +523 -0
- package/dist/esm/model/UiGraphRendererStyles.js +14 -0
- package/dist/esm/model/WebAppBrowserStorage.js +653 -0
- package/dist/esm/model/WebAppBrowserStorageRpc.js +200 -0
- package/dist/esm/model/chat-v2/chatV2CallObserver.js +1 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +2 -33
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +1 -0
- package/dist/esm/model/chat-v2/llmChatV2OutputClone.js +42 -0
- package/dist/esm/model/chat-v2/llmInvocationCoordinator.js +31 -2
- package/dist/esm/model/chat-v2/llmProfile.js +17 -1
- package/dist/esm/model/chat-v2/llmProfileFallback.js +17 -5
- package/dist/esm/model/chat-v2/llmProfileHealthStore.js +2 -0
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +4 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +27 -1
- package/dist/esm/model/nodes/LLMChatV2Node.js +21 -2
- package/dist/esm/recording/ExecutionRecorder.js +1 -0
- package/dist/esm/webAppRuntime.js +5 -2
- package/dist/types/api/createProcessor.d.ts +2 -0
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/model/AgentResponseTrace.d.ts +1 -0
- package/dist/types/model/ExecutorProtocol.d.ts +9 -1
- package/dist/types/model/GraphProcessor.d.ts +3 -1
- package/dist/types/model/NodeExclusionPolicy.d.ts +6 -0
- package/dist/types/model/ProcessContext.d.ts +33 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- package/dist/types/model/UiGraphActionProtocol.d.ts +8 -3
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +6 -0
- package/dist/types/model/UiGraphIndexedDbPersistence.d.ts +50 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/WebAppBrowserStorage.d.ts +90 -0
- package/dist/types/model/WebAppBrowserStorageRpc.d.ts +85 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +3 -1
- package/dist/types/model/chat-v2/llmChatV2OutputClone.d.ts +3 -0
- package/dist/types/model/chat-v2/llmInvocationCoordinator.d.ts +5 -1
- package/dist/types/model/chat-v2/llmProfileFallback.d.ts +4 -0
- package/dist/types/model/chat-v2/llmProfileHealthStore.d.ts +10 -0
- package/dist/types/model/chat-v2/llmProfileTypes.d.ts +6 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +14 -0
- package/dist/types/recording/RecordedEvents.d.ts +11 -0
- package/dist/types/webAppRuntime.d.ts +8 -2
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -153,6 +153,15 @@ __export(src_exports, {
|
|
|
153
153
|
RIVET_MARKDOWN_ALLOWED_URI_REGEXP_SOURCE: () => RIVET_MARKDOWN_ALLOWED_URI_REGEXP_SOURCE,
|
|
154
154
|
RIVET_MARKDOWN_SANITIZER_POLICY: () => RIVET_MARKDOWN_SANITIZER_POLICY,
|
|
155
155
|
RIVET_WEB_APP_ACTION_PROTOCOL_VERSION: () => RIVET_WEB_APP_ACTION_PROTOCOL_VERSION,
|
|
156
|
+
RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES,
|
|
157
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES,
|
|
158
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES,
|
|
159
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES,
|
|
160
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS,
|
|
161
|
+
RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY: () => RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY,
|
|
162
|
+
RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION: () => RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION,
|
|
163
|
+
RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES,
|
|
164
|
+
RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES,
|
|
156
165
|
RIVET_WEB_APP_DOCUMENT_CSS: () => RIVET_WEB_APP_DOCUMENT_CSS,
|
|
157
166
|
RIVET_WEB_APP_RENDERER_CSS: () => RIVET_WEB_APP_RENDERER_CSS,
|
|
158
167
|
RIVET_WEB_APP_STATUS_FUNCTION_NAME: () => RIVET_WEB_APP_STATUS_FUNCTION_NAME,
|
|
@@ -225,6 +234,7 @@ __export(src_exports, {
|
|
|
225
234
|
callGraphNode: () => callGraphNode,
|
|
226
235
|
canBeCoerced: () => canBeCoerced,
|
|
227
236
|
canBeCoercedAny: () => canBeCoercedAny,
|
|
237
|
+
canConsumeControlFlowExcludedInput: () => canConsumeControlFlowExcludedInput,
|
|
228
238
|
canRenderDataBusNode: () => canRenderDataBusNode,
|
|
229
239
|
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
230
240
|
chatLoopNode: () => chatLoopNode,
|
|
@@ -289,12 +299,15 @@ __export(src_exports, {
|
|
|
289
299
|
datasetNearestNeighborsNode: () => datasetNearestNeighborsNode,
|
|
290
300
|
decideLLMInvocationRound: () => decideLLMInvocationRound,
|
|
291
301
|
decodeDebuggerTransportSentinels: () => decodeDebuggerTransportSentinels,
|
|
302
|
+
decodeRivetWebAppStorageBinaryFrame: () => decodeRivetWebAppStorageBinaryFrame,
|
|
292
303
|
dedent: () => import_ts_dedent.dedent,
|
|
293
304
|
delayNode: () => delayNode,
|
|
294
305
|
delegateFunctionCallNode: () => delegateFunctionCallNode,
|
|
295
306
|
deserializeDatasets: () => deserializeDatasets,
|
|
296
307
|
deserializeGraph: () => deserializeGraph,
|
|
297
308
|
deserializeProject: () => deserializeProject,
|
|
309
|
+
deserializeRivetWebAppStoredValue: () => deserializeRivetWebAppStoredValue,
|
|
310
|
+
deserializeRivetWebAppStoredValuePatch: () => deserializeRivetWebAppStoredValuePatch,
|
|
298
311
|
destructureNode: () => destructureNode,
|
|
299
312
|
detachNodePrefabInstance: () => detachNodePrefabInstance,
|
|
300
313
|
detectSerializationVersion: () => detectSerializationVersion,
|
|
@@ -302,6 +315,7 @@ __export(src_exports, {
|
|
|
302
315
|
documentNode: () => documentNode,
|
|
303
316
|
doubleCheckProject: () => doubleCheckProject,
|
|
304
317
|
emptyNodeGraph: () => emptyNodeGraph,
|
|
318
|
+
encodeRivetWebAppStorageBinaryFrame: () => encodeRivetWebAppStorageBinaryFrame,
|
|
305
319
|
evaluateNode: () => evaluateNode,
|
|
306
320
|
executeLLMInvocation: () => executeLLMInvocation,
|
|
307
321
|
expectType: () => expectType,
|
|
@@ -526,6 +540,8 @@ __export(src_exports, {
|
|
|
526
540
|
parseCustomProviderApi: () => parseCustomProviderApi,
|
|
527
541
|
parseDataBusChannelIndex: () => parseDataBusChannelIndex,
|
|
528
542
|
parseProviderJsonChunk: () => parseProviderJsonChunk,
|
|
543
|
+
parseRivetWebAppBrowserStorageClientMessage: () => parseRivetWebAppBrowserStorageClientMessage,
|
|
544
|
+
parseRivetWebAppBrowserStorageServerMessage: () => parseRivetWebAppBrowserStorageServerMessage,
|
|
529
545
|
parseRivetWebAppClientMessage: () => parseRivetWebAppClientMessage,
|
|
530
546
|
parseRivetWebAppServerMessage: () => parseRivetWebAppServerMessage,
|
|
531
547
|
passthroughNode: () => passthroughNode,
|
|
@@ -592,6 +608,8 @@ __export(src_exports, {
|
|
|
592
608
|
serializeDatasets: () => serializeDatasets,
|
|
593
609
|
serializeGraph: () => serializeGraph,
|
|
594
610
|
serializeProject: () => serializeProject,
|
|
611
|
+
serializeRivetWebAppStoredValue: () => serializeRivetWebAppStoredValue,
|
|
612
|
+
serializeRivetWebAppStoredValuePatch: () => serializeRivetWebAppStoredValuePatch,
|
|
595
613
|
setGlobalNode: () => setGlobalNode,
|
|
596
614
|
setStoredValueNode: () => setStoredValueNode,
|
|
597
615
|
shouldIncludeLLMChatV2ToolCalls: () => shouldIncludeLLMChatV2ToolCalls,
|
|
@@ -600,6 +618,7 @@ __export(src_exports, {
|
|
|
600
618
|
shuffleNode: () => shuffleNode,
|
|
601
619
|
sliceNode: () => sliceNode,
|
|
602
620
|
splitNode: () => splitNode,
|
|
621
|
+
splitRivetWebAppStorageTransfer: () => splitRivetWebAppStorageTransfer,
|
|
603
622
|
startBackgroundBranchNode: () => startBackgroundBranchNode,
|
|
604
623
|
streamChatV2: () => streamChatV2,
|
|
605
624
|
stringifyToolResult: () => stringifyToolResult,
|
|
@@ -762,6 +781,15 @@ __export(exports_exports, {
|
|
|
762
781
|
RIVET_MARKDOWN_ALLOWED_URI_REGEXP_SOURCE: () => RIVET_MARKDOWN_ALLOWED_URI_REGEXP_SOURCE,
|
|
763
782
|
RIVET_MARKDOWN_SANITIZER_POLICY: () => RIVET_MARKDOWN_SANITIZER_POLICY,
|
|
764
783
|
RIVET_WEB_APP_ACTION_PROTOCOL_VERSION: () => RIVET_WEB_APP_ACTION_PROTOCOL_VERSION,
|
|
784
|
+
RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES,
|
|
785
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES,
|
|
786
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES,
|
|
787
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES,
|
|
788
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS: () => RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS,
|
|
789
|
+
RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY: () => RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY,
|
|
790
|
+
RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION: () => RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION,
|
|
791
|
+
RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES,
|
|
792
|
+
RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES: () => RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES,
|
|
765
793
|
RIVET_WEB_APP_DOCUMENT_CSS: () => RIVET_WEB_APP_DOCUMENT_CSS,
|
|
766
794
|
RIVET_WEB_APP_RENDERER_CSS: () => RIVET_WEB_APP_RENDERER_CSS,
|
|
767
795
|
RIVET_WEB_APP_STATUS_FUNCTION_NAME: () => RIVET_WEB_APP_STATUS_FUNCTION_NAME,
|
|
@@ -833,6 +861,7 @@ __export(exports_exports, {
|
|
|
833
861
|
callGraphNode: () => callGraphNode,
|
|
834
862
|
canBeCoerced: () => canBeCoerced,
|
|
835
863
|
canBeCoercedAny: () => canBeCoercedAny,
|
|
864
|
+
canConsumeControlFlowExcludedInput: () => canConsumeControlFlowExcludedInput,
|
|
836
865
|
canRenderDataBusNode: () => canRenderDataBusNode,
|
|
837
866
|
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
838
867
|
chatLoopNode: () => chatLoopNode,
|
|
@@ -897,12 +926,15 @@ __export(exports_exports, {
|
|
|
897
926
|
datasetNearestNeighborsNode: () => datasetNearestNeighborsNode,
|
|
898
927
|
decideLLMInvocationRound: () => decideLLMInvocationRound,
|
|
899
928
|
decodeDebuggerTransportSentinels: () => decodeDebuggerTransportSentinels,
|
|
929
|
+
decodeRivetWebAppStorageBinaryFrame: () => decodeRivetWebAppStorageBinaryFrame,
|
|
900
930
|
dedent: () => import_ts_dedent.dedent,
|
|
901
931
|
delayNode: () => delayNode,
|
|
902
932
|
delegateFunctionCallNode: () => delegateFunctionCallNode,
|
|
903
933
|
deserializeDatasets: () => deserializeDatasets,
|
|
904
934
|
deserializeGraph: () => deserializeGraph,
|
|
905
935
|
deserializeProject: () => deserializeProject,
|
|
936
|
+
deserializeRivetWebAppStoredValue: () => deserializeRivetWebAppStoredValue,
|
|
937
|
+
deserializeRivetWebAppStoredValuePatch: () => deserializeRivetWebAppStoredValuePatch,
|
|
906
938
|
destructureNode: () => destructureNode,
|
|
907
939
|
detachNodePrefabInstance: () => detachNodePrefabInstance,
|
|
908
940
|
detectSerializationVersion: () => detectSerializationVersion,
|
|
@@ -910,6 +942,7 @@ __export(exports_exports, {
|
|
|
910
942
|
documentNode: () => documentNode,
|
|
911
943
|
doubleCheckProject: () => doubleCheckProject,
|
|
912
944
|
emptyNodeGraph: () => emptyNodeGraph,
|
|
945
|
+
encodeRivetWebAppStorageBinaryFrame: () => encodeRivetWebAppStorageBinaryFrame,
|
|
913
946
|
evaluateNode: () => evaluateNode,
|
|
914
947
|
executeLLMInvocation: () => executeLLMInvocation,
|
|
915
948
|
expectType: () => expectType,
|
|
@@ -1134,6 +1167,8 @@ __export(exports_exports, {
|
|
|
1134
1167
|
parseCustomProviderApi: () => parseCustomProviderApi,
|
|
1135
1168
|
parseDataBusChannelIndex: () => parseDataBusChannelIndex,
|
|
1136
1169
|
parseProviderJsonChunk: () => parseProviderJsonChunk,
|
|
1170
|
+
parseRivetWebAppBrowserStorageClientMessage: () => parseRivetWebAppBrowserStorageClientMessage,
|
|
1171
|
+
parseRivetWebAppBrowserStorageServerMessage: () => parseRivetWebAppBrowserStorageServerMessage,
|
|
1137
1172
|
parseRivetWebAppClientMessage: () => parseRivetWebAppClientMessage,
|
|
1138
1173
|
parseRivetWebAppServerMessage: () => parseRivetWebAppServerMessage,
|
|
1139
1174
|
passthroughNode: () => passthroughNode,
|
|
@@ -1200,6 +1235,8 @@ __export(exports_exports, {
|
|
|
1200
1235
|
serializeDatasets: () => serializeDatasets,
|
|
1201
1236
|
serializeGraph: () => serializeGraph,
|
|
1202
1237
|
serializeProject: () => serializeProject,
|
|
1238
|
+
serializeRivetWebAppStoredValue: () => serializeRivetWebAppStoredValue,
|
|
1239
|
+
serializeRivetWebAppStoredValuePatch: () => serializeRivetWebAppStoredValuePatch,
|
|
1203
1240
|
setGlobalNode: () => setGlobalNode,
|
|
1204
1241
|
setStoredValueNode: () => setStoredValueNode,
|
|
1205
1242
|
shouldIncludeLLMChatV2ToolCalls: () => shouldIncludeLLMChatV2ToolCalls,
|
|
@@ -1208,6 +1245,7 @@ __export(exports_exports, {
|
|
|
1208
1245
|
shuffleNode: () => shuffleNode,
|
|
1209
1246
|
sliceNode: () => sliceNode,
|
|
1210
1247
|
splitNode: () => splitNode,
|
|
1248
|
+
splitRivetWebAppStorageTransfer: () => splitRivetWebAppStorageTransfer,
|
|
1211
1249
|
startBackgroundBranchNode: () => startBackgroundBranchNode,
|
|
1212
1250
|
streamChatV2: () => streamChatV2,
|
|
1213
1251
|
stringifyToolResult: () => stringifyToolResult,
|
|
@@ -1723,6 +1761,8 @@ function sha256(value) {
|
|
|
1723
1761
|
return `sha256:${import_crypto_js.default.SHA256(value).toString(import_crypto_js.default.enc.Hex)}`;
|
|
1724
1762
|
}
|
|
1725
1763
|
function createRivetLLMProfileHealthIdentity(params) {
|
|
1764
|
+
var _a;
|
|
1765
|
+
const profileName = (_a = params.profileName) == null ? void 0 : _a.trim();
|
|
1726
1766
|
const routingConfiguration = {
|
|
1727
1767
|
provider: params.configuration.provider,
|
|
1728
1768
|
model: params.configuration.model,
|
|
@@ -1751,6 +1791,7 @@ function createRivetLLMProfileHealthIdentity(params) {
|
|
|
1751
1791
|
key: `llm-profile:${key}`,
|
|
1752
1792
|
...params.projectId == null ? {} : { projectId: params.projectId },
|
|
1753
1793
|
...params.profileNodeId == null ? {} : { profileNodeId: params.profileNodeId },
|
|
1794
|
+
...profileName === "" || profileName == null ? {} : { profileName },
|
|
1754
1795
|
provider: params.configuration.provider,
|
|
1755
1796
|
model: params.configuration.model,
|
|
1756
1797
|
...params.configuration.provider !== "custom" ? {} : { customProviderApi: params.configuration.customProviderApi ?? "completions" },
|
|
@@ -2995,14 +3036,17 @@ function normalizeLLMProfileValue(value) {
|
|
|
2995
3036
|
model: model.trim()
|
|
2996
3037
|
});
|
|
2997
3038
|
const sourceIdentity = normalizeSourceIdentity(value.healthIdentity);
|
|
3039
|
+
const profileName = normalizeProfileName(value.profileName) ?? sourceIdentity.profileName;
|
|
2998
3040
|
return {
|
|
2999
3041
|
version: LLM_PROFILE_VALUE_VERSION,
|
|
3000
3042
|
configuration,
|
|
3001
3043
|
credential,
|
|
3044
|
+
...profileName == null ? {} : { profileName },
|
|
3002
3045
|
healthIdentity: createRivetLLMProfileHealthIdentity({
|
|
3003
3046
|
configuration,
|
|
3004
3047
|
credential,
|
|
3005
|
-
...sourceIdentity
|
|
3048
|
+
...sourceIdentity,
|
|
3049
|
+
...profileName == null ? {} : { profileName }
|
|
3006
3050
|
})
|
|
3007
3051
|
};
|
|
3008
3052
|
}
|
|
@@ -3021,20 +3065,23 @@ function normalizeLLMProfileChainInput(value) {
|
|
|
3021
3065
|
});
|
|
3022
3066
|
}
|
|
3023
3067
|
function scopeLLMProfileHealthIdentity(profile, fallback) {
|
|
3024
|
-
var _a, _b;
|
|
3068
|
+
var _a, _b, _c, _d;
|
|
3025
3069
|
const profileNodeId = ((_a = profile.healthIdentity) == null ? void 0 : _a.profileNodeId) ?? fallback.profileNodeId;
|
|
3070
|
+
const profileName = normalizeProfileName(profile.profileName) ?? normalizeProfileName((_b = profile.healthIdentity) == null ? void 0 : _b.profileName);
|
|
3026
3071
|
const healthIdentity = createRivetLLMProfileHealthIdentity({
|
|
3027
3072
|
configuration: profile.configuration,
|
|
3028
3073
|
credential: profile.credential,
|
|
3029
3074
|
chatNodeHeaders: fallback.chatNodeHeaders,
|
|
3030
3075
|
projectId: fallback.projectId,
|
|
3031
|
-
profileNodeId
|
|
3076
|
+
profileNodeId,
|
|
3077
|
+
...profileName == null ? {} : { profileName }
|
|
3032
3078
|
});
|
|
3033
|
-
if (((
|
|
3079
|
+
if (((_c = profile.healthIdentity) == null ? void 0 : _c.key) === healthIdentity.key && profile.profileName === profileName && ((_d = profile.healthIdentity) == null ? void 0 : _d.profileName) === profileName) {
|
|
3034
3080
|
return profile;
|
|
3035
3081
|
}
|
|
3036
3082
|
return {
|
|
3037
3083
|
...profile,
|
|
3084
|
+
...profileName == null ? {} : { profileName },
|
|
3038
3085
|
healthIdentity
|
|
3039
3086
|
};
|
|
3040
3087
|
}
|
|
@@ -3129,11 +3176,18 @@ function normalizeSourceIdentity(value) {
|
|
|
3129
3176
|
if (!isRecord2(value)) {
|
|
3130
3177
|
return {};
|
|
3131
3178
|
}
|
|
3179
|
+
const profileName = normalizeProfileName(value.profileName);
|
|
3132
3180
|
return {
|
|
3133
3181
|
...typeof value.projectId === "string" ? { projectId: value.projectId } : {},
|
|
3134
|
-
...typeof value.profileNodeId === "string" ? { profileNodeId: value.profileNodeId } : {}
|
|
3182
|
+
...typeof value.profileNodeId === "string" ? { profileNodeId: value.profileNodeId } : {},
|
|
3183
|
+
...profileName == null ? {} : { profileName }
|
|
3135
3184
|
};
|
|
3136
3185
|
}
|
|
3186
|
+
function normalizeProfileName(value) {
|
|
3187
|
+
if (typeof value !== "string") return void 0;
|
|
3188
|
+
const normalized = value.trim();
|
|
3189
|
+
return normalized === "" ? void 0 : normalized;
|
|
3190
|
+
}
|
|
3137
3191
|
function isRecord2(value) {
|
|
3138
3192
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
3139
3193
|
}
|
|
@@ -6444,7 +6498,7 @@ var REPLAY_TIMED_LIFECYCLE_EVENTS = /* @__PURE__ */ new Set([
|
|
|
6444
6498
|
"nodeOutputsCleared"
|
|
6445
6499
|
]);
|
|
6446
6500
|
async function replayExecutionRecording(options2) {
|
|
6447
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
6501
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
6448
6502
|
const {
|
|
6449
6503
|
emitter,
|
|
6450
6504
|
erroredNodes,
|
|
@@ -6830,11 +6884,19 @@ async function replayExecutionRecording(options2) {
|
|
|
6830
6884
|
});
|
|
6831
6885
|
break;
|
|
6832
6886
|
}
|
|
6887
|
+
case "llmChatOutputSnapshot": {
|
|
6888
|
+
const { data } = event;
|
|
6889
|
+
emitReplayExecutionEvent("llmChatOutputSnapshot", {
|
|
6890
|
+
...data,
|
|
6891
|
+
execution: getExecution(((_l = data.execution) == null ? void 0 : _l.graphId) ?? getGraphIdForNode(data.nodeId), data.execution)
|
|
6892
|
+
});
|
|
6893
|
+
break;
|
|
6894
|
+
}
|
|
6833
6895
|
case "llmProfileAttempt": {
|
|
6834
6896
|
const { data } = event;
|
|
6835
6897
|
emitReplayExecutionEvent("llmProfileAttempt", {
|
|
6836
6898
|
...data,
|
|
6837
|
-
execution: getExecution(((
|
|
6899
|
+
execution: getExecution(((_m = data.execution) == null ? void 0 : _m.graphId) ?? getGraphIdForNode(data.nodeId), data.execution)
|
|
6838
6900
|
});
|
|
6839
6901
|
break;
|
|
6840
6902
|
}
|
|
@@ -6842,7 +6904,7 @@ async function replayExecutionRecording(options2) {
|
|
|
6842
6904
|
const { data } = event;
|
|
6843
6905
|
emitReplayExecutionEvent("toolCallFinished", {
|
|
6844
6906
|
...data,
|
|
6845
|
-
execution: getExecution(((
|
|
6907
|
+
execution: getExecution(((_n = data.execution) == null ? void 0 : _n.graphId) ?? getGraphIdForNode(data.sourceNodeId), data.execution)
|
|
6846
6908
|
});
|
|
6847
6909
|
break;
|
|
6848
6910
|
}
|
|
@@ -6860,7 +6922,7 @@ async function replayExecutionRecording(options2) {
|
|
|
6860
6922
|
node,
|
|
6861
6923
|
processId: data.processId,
|
|
6862
6924
|
renderingType: data.renderingType,
|
|
6863
|
-
execution: getExecution(((
|
|
6925
|
+
execution: getExecution(((_o = data.execution) == null ? void 0 : _o.graphId) ?? getGraphIdForNode(data.nodeId), data.execution)
|
|
6864
6926
|
});
|
|
6865
6927
|
break;
|
|
6866
6928
|
}
|
|
@@ -6926,6 +6988,7 @@ function buildNodeProcessContext(options2) {
|
|
|
6926
6988
|
requestUserInput,
|
|
6927
6989
|
reportProgress,
|
|
6928
6990
|
setGlobal,
|
|
6991
|
+
splitIndex,
|
|
6929
6992
|
toolCallContinuation,
|
|
6930
6993
|
toolCallTraceSource,
|
|
6931
6994
|
waitEvent
|
|
@@ -6942,6 +7005,7 @@ function buildNodeProcessContext(options2) {
|
|
|
6942
7005
|
onPartialOutputs,
|
|
6943
7006
|
signal: nodeAbortController.signal,
|
|
6944
7007
|
processId,
|
|
7008
|
+
splitIndex,
|
|
6945
7009
|
setGlobal,
|
|
6946
7010
|
createSubProcessor,
|
|
6947
7011
|
getPluginConfig: getPluginConfig2,
|
|
@@ -7394,6 +7458,7 @@ function wireSubprocessorEvents(processor, parentEmitter, parentState) {
|
|
|
7394
7458
|
processor.on("partialOutput", (event) => parentEmitter.emit("partialOutput", event)),
|
|
7395
7459
|
processor.on("progress", (event) => parentEmitter.emit("progress", event)),
|
|
7396
7460
|
processor.on("llmCallFinished", (event) => parentEmitter.emit("llmCallFinished", event)),
|
|
7461
|
+
processor.on("llmChatOutputSnapshot", (event) => parentEmitter.emit("llmChatOutputSnapshot", event)),
|
|
7397
7462
|
processor.on("llmProfileAttempt", (event) => parentEmitter.emit("llmProfileAttempt", event)),
|
|
7398
7463
|
processor.on("toolCallFinished", (event) => parentEmitter.emit("toolCallFinished", event)),
|
|
7399
7464
|
processor.on("nodeExcluded", (event) => parentEmitter.emit("nodeExcluded", event)),
|
|
@@ -7807,6 +7872,9 @@ var nodesAllowedToConsumeExcludedValue = /* @__PURE__ */ new Set([
|
|
|
7807
7872
|
"raceInputs",
|
|
7808
7873
|
"loopController"
|
|
7809
7874
|
]);
|
|
7875
|
+
function canConsumeControlFlowExcludedInput(node) {
|
|
7876
|
+
return nodesAllowedToConsumeExcludedValue.has(node.type);
|
|
7877
|
+
}
|
|
7810
7878
|
function isControlFlowExcluded2(value) {
|
|
7811
7879
|
return value != null && getScalarTypeOf(value.type) === "control-flow-excluded";
|
|
7812
7880
|
}
|
|
@@ -7837,7 +7905,7 @@ function getControlFlowExclusionDecision({
|
|
|
7837
7905
|
([, value]) => isControlFlowExcluded2(value) && (typeOfExclusion === void 0 || value.value === typeOfExclusion)
|
|
7838
7906
|
);
|
|
7839
7907
|
const isWaitingForLoop = controlFlowExcludedValues.some(([, value]) => (value == null ? void 0 : value.value) === LOOP_NOT_BROKEN_SENTINEL);
|
|
7840
|
-
const allowedToConsumeExcludedValue =
|
|
7908
|
+
const allowedToConsumeExcludedValue = canConsumeControlFlowExcludedInput(node) && !isWaitingForLoop;
|
|
7841
7909
|
if (controlFlowExcludedValues.length === 0 || allowedToConsumeExcludedValue) {
|
|
7842
7910
|
return { action: "continue" };
|
|
7843
7911
|
}
|
|
@@ -9914,6 +9982,7 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
9914
9982
|
}
|
|
9915
9983
|
#prepareNodeProcessContextBase() {
|
|
9916
9984
|
const hostChatV2Observer = this.getRootProcessor().#context.onChatV2CallFinished;
|
|
9985
|
+
const hostLLMChatOutputSnapshotObserver = this.getRootProcessor().#context.onLLMChatOutputSnapshot;
|
|
9917
9986
|
const hostLLMProfileAttemptObserver = this.getRootProcessor().#context.onLLMProfileAttempt;
|
|
9918
9987
|
this.#nodeProcessContextBase = {
|
|
9919
9988
|
...this.#context,
|
|
@@ -9943,6 +10012,16 @@ var GraphProcessor = class _GraphProcessor {
|
|
|
9943
10012
|
const { rawUsage: _rawUsage, ...traceEvent } = event;
|
|
9944
10013
|
emitDetached(this.#emitter, "llmCallFinished", this.#withExecution(traceEvent));
|
|
9945
10014
|
},
|
|
10015
|
+
onLLMChatOutputSnapshot: (event) => {
|
|
10016
|
+
try {
|
|
10017
|
+
const observerResult = hostLLMChatOutputSnapshotObserver == null ? void 0 : hostLLMChatOutputSnapshotObserver(event);
|
|
10018
|
+
if (observerResult != null && typeof observerResult.then === "function") {
|
|
10019
|
+
void Promise.resolve(observerResult).catch(() => void 0);
|
|
10020
|
+
}
|
|
10021
|
+
} catch {
|
|
10022
|
+
}
|
|
10023
|
+
emitDetached(this.#emitter, "llmChatOutputSnapshot", this.#withExecution(event));
|
|
10024
|
+
},
|
|
9946
10025
|
onLLMProfileAttempt: (event) => {
|
|
9947
10026
|
try {
|
|
9948
10027
|
const observerResult = hostLLMProfileAttemptObserver == null ? void 0 : hostLLMProfileAttemptObserver(event);
|
|
@@ -11093,6 +11172,7 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
11093
11172
|
emitDetached(this.#emitter, "progress", this.#withExecution({ node, processId, progress: normalized }));
|
|
11094
11173
|
}
|
|
11095
11174
|
},
|
|
11175
|
+
splitIndex: node.isSplitRun ? index : 0,
|
|
11096
11176
|
setGlobal: (id, value) => {
|
|
11097
11177
|
this.#globals.set(id, value);
|
|
11098
11178
|
emitDetached(this.#emitter, "globalSet", this.#withExecution({ id, value, processId }));
|
|
@@ -13175,10 +13255,17 @@ function mergeAgentTraceEvent(existing, incoming) {
|
|
|
13175
13255
|
if (existing.type === "llm-call-finished" && incoming.type === "llm-call-finished") {
|
|
13176
13256
|
return {
|
|
13177
13257
|
...incoming,
|
|
13258
|
+
...incoming.profileName == null && existing.profileName != null ? { profileName: existing.profileName } : {},
|
|
13178
13259
|
...incoming.profileHealthKey == null && existing.profileHealthKey != null ? { profileHealthKey: existing.profileHealthKey } : {},
|
|
13179
13260
|
...incoming.profileHealthState == null && existing.profileHealthState != null ? { profileHealthState: existing.profileHealthState } : {}
|
|
13180
13261
|
};
|
|
13181
13262
|
}
|
|
13263
|
+
if (existing.type === "llm-profile-attempt" && incoming.type === "llm-profile-attempt") {
|
|
13264
|
+
return {
|
|
13265
|
+
...incoming,
|
|
13266
|
+
...incoming.profileName == null && existing.profileName != null ? { profileName: existing.profileName } : {}
|
|
13267
|
+
};
|
|
13268
|
+
}
|
|
13182
13269
|
if (existing.type === "tool-call-finished" && incoming.type === "tool-call-finished" && existing.resultOwner != null && incoming.resultOwner == null && isAgentToolResultOutcome(incoming.outcome)) {
|
|
13183
13270
|
return { ...incoming, resultOwner: existing.resultOwner };
|
|
13184
13271
|
}
|
|
@@ -13195,6 +13282,7 @@ function toModelCallTrace(event) {
|
|
|
13195
13282
|
outcome: event.outcome,
|
|
13196
13283
|
attemptIndex: event.attemptIndex,
|
|
13197
13284
|
...event.profileIndex == null ? {} : { profileIndex: event.profileIndex },
|
|
13285
|
+
...event.profileName == null ? {} : { profileName: event.profileName },
|
|
13198
13286
|
...event.profileHealthKey == null ? {} : { profileHealthKey: event.profileHealthKey },
|
|
13199
13287
|
...event.profileHealthState == null ? {} : { profileHealthState: event.profileHealthState },
|
|
13200
13288
|
...event.roundIndex == null ? {} : { roundIndex: event.roundIndex },
|
|
@@ -13392,6 +13480,7 @@ function isAgentModelCallTrace(value) {
|
|
|
13392
13480
|
"outcome",
|
|
13393
13481
|
"attemptIndex",
|
|
13394
13482
|
"profileIndex",
|
|
13483
|
+
"profileName",
|
|
13395
13484
|
"profileHealthKey",
|
|
13396
13485
|
"profileHealthState",
|
|
13397
13486
|
"roundIndex",
|
|
@@ -13400,13 +13489,14 @@ function isAgentModelCallTrace(value) {
|
|
|
13400
13489
|
"finishReason",
|
|
13401
13490
|
"usage",
|
|
13402
13491
|
"pricing"
|
|
13403
|
-
]) && typeof value.callId === "string" && typeof value.nodeId === "string" && typeof value.processId === "string" && typeof value.provider === "string" && typeof value.model === "string" && (value.customProviderApi === void 0 || value.customProviderApi === "completions" || value.customProviderApi === "responses") && (value.outcome === "success" || value.outcome === "provider-failure" || value.outcome === "aborted") && isNonNegativeInteger(value.attemptIndex) && isOptionalNonNegativeInteger(value.profileIndex) && isOptionalString(value.profileHealthKey) && (value.profileHealthState === void 0 || value.profileHealthState === "closed" || value.profileHealthState === "open" || value.profileHealthState === "half-open") && isOptionalNonNegativeInteger(value.roundIndex) && isOptionalNonNegativeFiniteNumber(value.startedAt) && isOptionalNonNegativeFiniteNumber(value.durationMs) && isOptionalString(value.finishReason) && (value.usage === void 0 || isAgentTraceUsage(value.usage)) && isAgentTracePricing(value.pricing);
|
|
13492
|
+
]) && typeof value.callId === "string" && typeof value.nodeId === "string" && typeof value.processId === "string" && typeof value.provider === "string" && typeof value.model === "string" && (value.customProviderApi === void 0 || value.customProviderApi === "completions" || value.customProviderApi === "responses") && (value.outcome === "success" || value.outcome === "provider-failure" || value.outcome === "aborted") && isNonNegativeInteger(value.attemptIndex) && isOptionalNonNegativeInteger(value.profileIndex) && isOptionalString(value.profileName) && isOptionalString(value.profileHealthKey) && (value.profileHealthState === void 0 || value.profileHealthState === "closed" || value.profileHealthState === "open" || value.profileHealthState === "half-open") && isOptionalNonNegativeInteger(value.roundIndex) && isOptionalNonNegativeFiniteNumber(value.startedAt) && isOptionalNonNegativeFiniteNumber(value.durationMs) && isOptionalString(value.finishReason) && (value.usage === void 0 || isAgentTraceUsage(value.usage)) && isAgentTracePricing(value.pricing);
|
|
13404
13493
|
}
|
|
13405
13494
|
function isAgentLLMProfileAttemptTrace(value) {
|
|
13406
13495
|
return isRecord5(value) && hasOnlyKeys(value, [
|
|
13407
13496
|
"eventId",
|
|
13408
13497
|
"roundIndex",
|
|
13409
13498
|
"profileIndex",
|
|
13499
|
+
"profileName",
|
|
13410
13500
|
"nodeId",
|
|
13411
13501
|
"processId",
|
|
13412
13502
|
"provider",
|
|
@@ -13423,7 +13513,7 @@ function isAgentLLMProfileAttemptTrace(value) {
|
|
|
13423
13513
|
"healthOutcome",
|
|
13424
13514
|
"retryAt",
|
|
13425
13515
|
"timeoutKind"
|
|
13426
|
-
]) && typeof value.eventId === "string" && isNonNegativeInteger(value.roundIndex) && isOptionalNonNegativeInteger(value.profileIndex) && typeof value.nodeId === "string" && typeof value.processId === "string" && typeof value.provider === "string" && typeof value.model === "string" && (value.customProviderApi === void 0 || value.customProviderApi === "completions" || value.customProviderApi === "responses") && ["configuration", "request", "response-validation", "health-gate", "health-update"].includes(
|
|
13516
|
+
]) && typeof value.eventId === "string" && isNonNegativeInteger(value.roundIndex) && isOptionalNonNegativeInteger(value.profileIndex) && isOptionalString(value.profileName) && typeof value.nodeId === "string" && typeof value.processId === "string" && typeof value.provider === "string" && typeof value.model === "string" && (value.customProviderApi === void 0 || value.customProviderApi === "completions" || value.customProviderApi === "responses") && ["configuration", "request", "response-validation", "health-gate", "health-update"].includes(
|
|
13427
13517
|
String(value.stage)
|
|
13428
13518
|
) && ["success", "failure", "aborted", "skipped"].includes(String(value.outcome)) && isOptionalNonNegativeInteger(value.attemptIndex) && isOptionalNonNegativeFiniteNumber(value.status) && isOptionalString(value.error) && isOptionalString(value.profileHealthKey) && (value.healthState === void 0 || value.healthState === "closed" || value.healthState === "open" || value.healthState === "half-open") && (value.healthDisposition === void 0 || value.healthDisposition === "allow" || value.healthDisposition === "deny" || value.healthDisposition === "fail-open") && (value.healthOutcome === void 0 || value.healthOutcome === "healthy" || value.healthOutcome === "unhealthy" || value.healthOutcome === "ignored") && isOptionalNonNegativeFiniteNumber(value.retryAt) && (value.timeoutKind === void 0 || value.timeoutKind === "first-output" || value.timeoutKind === "stream-inactivity");
|
|
13429
13519
|
}
|
|
@@ -13499,38 +13589,232 @@ function isRecord5(value) {
|
|
|
13499
13589
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
13500
13590
|
}
|
|
13501
13591
|
|
|
13592
|
+
// src/model/WebAppBrowserStorageRpc.ts
|
|
13593
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY = "browser-storage-rpc-v2";
|
|
13594
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION = 2;
|
|
13595
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES = 4 * 1024 * 1024;
|
|
13596
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES = 256 * 1024 * 1024;
|
|
13597
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES = 512 * 1024 * 1024;
|
|
13598
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES = 512 * 1024 * 1024;
|
|
13599
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS = 6e4;
|
|
13600
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES = 256 * 1024;
|
|
13601
|
+
var RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES = 40;
|
|
13602
|
+
var FRAME_MAGIC = new Uint8Array([82, 86, 66, 83]);
|
|
13603
|
+
function parseRivetWebAppBrowserStorageClientMessage(value) {
|
|
13604
|
+
if (!isRecord6(value) || !hasActionIds(value) || typeof value.type !== "string") return void 0;
|
|
13605
|
+
if (!isUuid(value.storageSessionId)) return void 0;
|
|
13606
|
+
if (value.type === "storage.transfer.start") {
|
|
13607
|
+
return isNonEmptyString(value.storageRequestId) && isUuid(value.transferId) && isSafeByteLength(value.byteLength) && isSafeChunkCount(value.chunkCount) && typeof value.found === "boolean" ? {
|
|
13608
|
+
type: value.type,
|
|
13609
|
+
requestId: value.requestId,
|
|
13610
|
+
runId: value.runId,
|
|
13611
|
+
storageSessionId: value.storageSessionId,
|
|
13612
|
+
storageRequestId: value.storageRequestId,
|
|
13613
|
+
transferId: value.transferId,
|
|
13614
|
+
byteLength: value.byteLength,
|
|
13615
|
+
chunkCount: value.chunkCount,
|
|
13616
|
+
found: value.found
|
|
13617
|
+
} : void 0;
|
|
13618
|
+
}
|
|
13619
|
+
if (value.type === "storage.commit.ack") {
|
|
13620
|
+
return isUuid(value.transferId) ? {
|
|
13621
|
+
type: value.type,
|
|
13622
|
+
requestId: value.requestId,
|
|
13623
|
+
runId: value.runId,
|
|
13624
|
+
storageSessionId: value.storageSessionId,
|
|
13625
|
+
transferId: value.transferId
|
|
13626
|
+
} : void 0;
|
|
13627
|
+
}
|
|
13628
|
+
if (value.type === "storage.error") return parseStorageError(value);
|
|
13629
|
+
return void 0;
|
|
13630
|
+
}
|
|
13631
|
+
function parseRivetWebAppBrowserStorageServerMessage(value) {
|
|
13632
|
+
if (!isRecord6(value) || !hasActionIds(value) || typeof value.type !== "string") return void 0;
|
|
13633
|
+
if (!isUuid(value.storageSessionId)) return void 0;
|
|
13634
|
+
if (value.type === "storage.get") {
|
|
13635
|
+
return isNonEmptyString(value.storageRequestId) && typeof value.key === "string" && value.key.length > 0 ? {
|
|
13636
|
+
type: value.type,
|
|
13637
|
+
requestId: value.requestId,
|
|
13638
|
+
runId: value.runId,
|
|
13639
|
+
storageSessionId: value.storageSessionId,
|
|
13640
|
+
storageRequestId: value.storageRequestId,
|
|
13641
|
+
key: value.key
|
|
13642
|
+
} : void 0;
|
|
13643
|
+
}
|
|
13644
|
+
if (value.type === "storage.transfer.ack") {
|
|
13645
|
+
return isNonEmptyString(value.storageRequestId) && isUuid(value.transferId) ? {
|
|
13646
|
+
type: value.type,
|
|
13647
|
+
requestId: value.requestId,
|
|
13648
|
+
runId: value.runId,
|
|
13649
|
+
storageSessionId: value.storageSessionId,
|
|
13650
|
+
storageRequestId: value.storageRequestId,
|
|
13651
|
+
transferId: value.transferId
|
|
13652
|
+
} : void 0;
|
|
13653
|
+
}
|
|
13654
|
+
if (value.type === "storage.commit.start") {
|
|
13655
|
+
return isUuid(value.transferId) && isSafeByteLength(value.byteLength) && isSafeChunkCount(value.chunkCount) ? {
|
|
13656
|
+
type: value.type,
|
|
13657
|
+
requestId: value.requestId,
|
|
13658
|
+
runId: value.runId,
|
|
13659
|
+
storageSessionId: value.storageSessionId,
|
|
13660
|
+
transferId: value.transferId,
|
|
13661
|
+
byteLength: value.byteLength,
|
|
13662
|
+
chunkCount: value.chunkCount
|
|
13663
|
+
} : void 0;
|
|
13664
|
+
}
|
|
13665
|
+
if (value.type === "storage.error") return parseStorageError(value);
|
|
13666
|
+
return void 0;
|
|
13667
|
+
}
|
|
13668
|
+
function serializeRivetWebAppStoredValue(value) {
|
|
13669
|
+
return new TextEncoder().encode(JSON.stringify(value));
|
|
13670
|
+
}
|
|
13671
|
+
function deserializeRivetWebAppStoredValue(bytes) {
|
|
13672
|
+
return cloneRivetStoredValue(JSON.parse(new TextDecoder().decode(bytes)), "Browser Stored Value transfer");
|
|
13673
|
+
}
|
|
13674
|
+
function serializeRivetWebAppStoredValuePatch(patch) {
|
|
13675
|
+
return new TextEncoder().encode(JSON.stringify(patch));
|
|
13676
|
+
}
|
|
13677
|
+
function deserializeRivetWebAppStoredValuePatch(bytes) {
|
|
13678
|
+
return cloneRivetStoredValueRecord(
|
|
13679
|
+
JSON.parse(new TextDecoder().decode(bytes)),
|
|
13680
|
+
"Browser Stored Value commit"
|
|
13681
|
+
);
|
|
13682
|
+
}
|
|
13683
|
+
function splitRivetWebAppStorageTransfer(bytes) {
|
|
13684
|
+
if (bytes.byteLength === 0) return [];
|
|
13685
|
+
const chunks = [];
|
|
13686
|
+
for (let offset = 0; offset < bytes.byteLength; offset += RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES) {
|
|
13687
|
+
chunks.push(
|
|
13688
|
+
bytes.slice(offset, Math.min(bytes.byteLength, offset + RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES))
|
|
13689
|
+
);
|
|
13690
|
+
}
|
|
13691
|
+
return chunks;
|
|
13692
|
+
}
|
|
13693
|
+
function encodeRivetWebAppStorageBinaryFrame(storageSessionId, transferId, chunkIndex, bytes) {
|
|
13694
|
+
const sessionUuid = uuidToBytes(storageSessionId);
|
|
13695
|
+
const transferUuid = uuidToBytes(transferId);
|
|
13696
|
+
if (!Number.isSafeInteger(chunkIndex) || chunkIndex < 0 || chunkIndex > 4294967295) {
|
|
13697
|
+
throw new RangeError("Storage transfer chunk index is invalid.");
|
|
13698
|
+
}
|
|
13699
|
+
const frame = new Uint8Array(RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES + bytes.byteLength);
|
|
13700
|
+
frame.set(FRAME_MAGIC, 0);
|
|
13701
|
+
frame.set(sessionUuid, 4);
|
|
13702
|
+
frame.set(transferUuid, 20);
|
|
13703
|
+
new DataView(frame.buffer).setUint32(36, chunkIndex, false);
|
|
13704
|
+
frame.set(bytes, RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES);
|
|
13705
|
+
return frame;
|
|
13706
|
+
}
|
|
13707
|
+
function decodeRivetWebAppStorageBinaryFrame(frame) {
|
|
13708
|
+
const source = frame instanceof ArrayBuffer ? new Uint8Array(frame) : new Uint8Array(frame.buffer, frame.byteOffset, frame.byteLength);
|
|
13709
|
+
if (source.byteLength < RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES) return void 0;
|
|
13710
|
+
for (let index = 0; index < FRAME_MAGIC.length; index += 1) {
|
|
13711
|
+
if (source[index] !== FRAME_MAGIC[index]) return void 0;
|
|
13712
|
+
}
|
|
13713
|
+
return {
|
|
13714
|
+
storageSessionId: bytesToUuid(source.slice(4, 20)),
|
|
13715
|
+
transferId: bytesToUuid(source.slice(20, 36)),
|
|
13716
|
+
chunkIndex: new DataView(
|
|
13717
|
+
source.buffer,
|
|
13718
|
+
source.byteOffset,
|
|
13719
|
+
RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES
|
|
13720
|
+
).getUint32(36, false),
|
|
13721
|
+
bytes: source.slice(RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES)
|
|
13722
|
+
};
|
|
13723
|
+
}
|
|
13724
|
+
function parseStorageError(value) {
|
|
13725
|
+
return isStorageErrorCode(value.code) && typeof value.error === "string" && typeof value.retryable === "boolean" ? {
|
|
13726
|
+
type: "storage.error",
|
|
13727
|
+
requestId: value.requestId,
|
|
13728
|
+
runId: value.runId,
|
|
13729
|
+
storageSessionId: value.storageSessionId,
|
|
13730
|
+
code: value.code,
|
|
13731
|
+
error: value.error,
|
|
13732
|
+
retryable: value.retryable,
|
|
13733
|
+
...isNonEmptyString(value.storageRequestId) ? { storageRequestId: value.storageRequestId } : {},
|
|
13734
|
+
...isUuid(value.transferId) ? { transferId: value.transferId } : {}
|
|
13735
|
+
} : void 0;
|
|
13736
|
+
}
|
|
13737
|
+
function hasActionIds(value) {
|
|
13738
|
+
return isNonEmptyString(value.requestId) && isNonEmptyString(value.runId);
|
|
13739
|
+
}
|
|
13740
|
+
function isStorageErrorCode(value) {
|
|
13741
|
+
return value === "storage_unavailable" || value === "storage_invalid" || value === "storage_too_large" || value === "storage_capacity";
|
|
13742
|
+
}
|
|
13743
|
+
function isSafeByteLength(value) {
|
|
13744
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
13745
|
+
}
|
|
13746
|
+
function isSafeChunkCount(value) {
|
|
13747
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
13748
|
+
}
|
|
13749
|
+
function isUuid(value) {
|
|
13750
|
+
return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
13751
|
+
}
|
|
13752
|
+
function uuidToBytes(value) {
|
|
13753
|
+
if (!isUuid(value)) throw new Error("Storage transfer ID must be a UUID.");
|
|
13754
|
+
return Uint8Array.from(
|
|
13755
|
+
value.replaceAll("-", "").match(/.{2}/g).map((part) => Number.parseInt(part, 16))
|
|
13756
|
+
);
|
|
13757
|
+
}
|
|
13758
|
+
function bytesToUuid(value) {
|
|
13759
|
+
const hex = [...value].map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
13760
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
13761
|
+
}
|
|
13762
|
+
function isRecord6(value) {
|
|
13763
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13764
|
+
}
|
|
13765
|
+
function isNonEmptyString(value) {
|
|
13766
|
+
return typeof value === "string" && value.length > 0;
|
|
13767
|
+
}
|
|
13768
|
+
|
|
13502
13769
|
// src/model/UiGraphActionProtocol.ts
|
|
13503
13770
|
var RIVET_WEB_APP_ACTION_PROTOCOL_VERSION = 1;
|
|
13504
13771
|
function parseRivetWebAppClientMessage(value) {
|
|
13505
|
-
if (!
|
|
13772
|
+
if (!isRecord7(value) || typeof value.type !== "string") return void 0;
|
|
13773
|
+
const storageMessage = parseRivetWebAppBrowserStorageClientMessage(value);
|
|
13774
|
+
if (storageMessage) return storageMessage;
|
|
13506
13775
|
switch (value.type) {
|
|
13507
13776
|
case "client.hello":
|
|
13508
|
-
return value.protocolVersion === RIVET_WEB_APP_ACTION_PROTOCOL_VERSION ? {
|
|
13777
|
+
return value.protocolVersion === RIVET_WEB_APP_ACTION_PROTOCOL_VERSION ? {
|
|
13778
|
+
type: value.type,
|
|
13779
|
+
protocolVersion: value.protocolVersion,
|
|
13780
|
+
...isStringArray(value.capabilities) ? { capabilities: value.capabilities } : {}
|
|
13781
|
+
} : void 0;
|
|
13509
13782
|
case "action.start":
|
|
13510
|
-
return
|
|
13783
|
+
return isNonEmptyString2(value.requestId) && isNonEmptyString2(value.componentId) && isRecord7(value.state) && (value.storage == null || isRecord7(value.storage)) && (value.revisionKey == null || typeof value.revisionKey === "string") ? {
|
|
13511
13784
|
type: value.type,
|
|
13512
13785
|
requestId: value.requestId,
|
|
13513
13786
|
componentId: value.componentId,
|
|
13514
13787
|
state: value.state,
|
|
13515
|
-
...
|
|
13516
|
-
...typeof value.revisionKey === "string" ? { revisionKey: value.revisionKey } : {}
|
|
13788
|
+
...isRecord7(value.storage) ? { storage: value.storage } : {},
|
|
13789
|
+
...typeof value.revisionKey === "string" ? { revisionKey: value.revisionKey } : {},
|
|
13790
|
+
...value.storageRpcVersion === 2 ? { storageRpcVersion: 2 } : {}
|
|
13517
13791
|
} : void 0;
|
|
13518
13792
|
case "action.cancel":
|
|
13519
|
-
return
|
|
13793
|
+
return isNonEmptyString2(value.runId) ? { type: value.type, runId: value.runId } : void 0;
|
|
13520
13794
|
case "run.resume":
|
|
13521
|
-
return
|
|
13795
|
+
return isNonEmptyString2(value.runId) && typeof value.lastSequence === "number" && Number.isSafeInteger(value.lastSequence) && value.lastSequence >= 0 ? { type: value.type, runId: value.runId, lastSequence: value.lastSequence } : void 0;
|
|
13522
13796
|
default:
|
|
13523
13797
|
return void 0;
|
|
13524
13798
|
}
|
|
13525
13799
|
}
|
|
13526
13800
|
function parseRivetWebAppServerMessage(value) {
|
|
13527
|
-
if (!
|
|
13801
|
+
if (!isRecord7(value) || typeof value.type !== "string") return void 0;
|
|
13802
|
+
const storageMessage = parseRivetWebAppBrowserStorageServerMessage(value);
|
|
13803
|
+
if (storageMessage) return storageMessage;
|
|
13528
13804
|
if (value.type === "server.ready") {
|
|
13529
|
-
|
|
13805
|
+
if (value.protocolVersion !== RIVET_WEB_APP_ACTION_PROTOCOL_VERSION) return void 0;
|
|
13806
|
+
const browserStorageRpcLimits = parseBrowserStorageRpcLimits(value.browserStorageRpcLimits);
|
|
13807
|
+
if (value.browserStorageRpcLimits != null && !browserStorageRpcLimits) return void 0;
|
|
13808
|
+
return {
|
|
13809
|
+
type: value.type,
|
|
13810
|
+
protocolVersion: value.protocolVersion,
|
|
13811
|
+
...isStringArray(value.capabilities) ? { capabilities: value.capabilities } : {},
|
|
13812
|
+
...browserStorageRpcLimits ? { browserStorageRpcLimits } : {}
|
|
13813
|
+
};
|
|
13530
13814
|
}
|
|
13531
13815
|
if (value.type === "server.draining") return { type: value.type };
|
|
13532
13816
|
if (value.type === "action.rejected") {
|
|
13533
|
-
return
|
|
13817
|
+
return isNonEmptyString2(value.requestId) && isNonEmptyString2(value.error) ? {
|
|
13534
13818
|
type: value.type,
|
|
13535
13819
|
requestId: value.requestId,
|
|
13536
13820
|
error: value.error,
|
|
@@ -13538,7 +13822,7 @@ function parseRivetWebAppServerMessage(value) {
|
|
|
13538
13822
|
} : void 0;
|
|
13539
13823
|
}
|
|
13540
13824
|
if (value.type === "run.rejected") {
|
|
13541
|
-
return
|
|
13825
|
+
return isNonEmptyString2(value.runId) && isNonEmptyString2(value.error) ? {
|
|
13542
13826
|
type: value.type,
|
|
13543
13827
|
runId: value.runId,
|
|
13544
13828
|
error: value.error,
|
|
@@ -13556,7 +13840,7 @@ function parseRivetWebAppServerMessage(value) {
|
|
|
13556
13840
|
case "action.cancelled":
|
|
13557
13841
|
return { type: value.type, ...base };
|
|
13558
13842
|
case "action.progress": {
|
|
13559
|
-
if (!
|
|
13843
|
+
if (!isRecord7(value.progress)) return void 0;
|
|
13560
13844
|
const progress = normalizeGraphProgress({
|
|
13561
13845
|
message: typeof value.progress.message === "string" ? value.progress.message : void 0,
|
|
13562
13846
|
percent: typeof value.progress.percent === "number" ? value.progress.percent : void 0
|
|
@@ -13564,15 +13848,15 @@ function parseRivetWebAppServerMessage(value) {
|
|
|
13564
13848
|
return progress ? { type: value.type, ...base, progress } : void 0;
|
|
13565
13849
|
}
|
|
13566
13850
|
case "action.completed":
|
|
13567
|
-
return
|
|
13851
|
+
return isRecord7(value.statePatch) && (value.storagePatch == null || isRecord7(value.storagePatch)) ? {
|
|
13568
13852
|
type: value.type,
|
|
13569
13853
|
...base,
|
|
13570
13854
|
statePatch: value.statePatch,
|
|
13571
|
-
...
|
|
13855
|
+
...isRecord7(value.storagePatch) ? { storagePatch: value.storagePatch } : {},
|
|
13572
13856
|
...isAgentResponseTrace(value.responseTrace) ? { responseTrace: value.responseTrace } : {}
|
|
13573
13857
|
} : void 0;
|
|
13574
13858
|
case "action.failed":
|
|
13575
|
-
return
|
|
13859
|
+
return isNonEmptyString2(value.error) ? {
|
|
13576
13860
|
type: value.type,
|
|
13577
13861
|
...base,
|
|
13578
13862
|
error: value.error,
|
|
@@ -13580,7 +13864,7 @@ function parseRivetWebAppServerMessage(value) {
|
|
|
13580
13864
|
...isAgentResponseTrace(value.responseTrace) ? { responseTrace: value.responseTrace } : {}
|
|
13581
13865
|
} : void 0;
|
|
13582
13866
|
case "action.interrupted":
|
|
13583
|
-
return
|
|
13867
|
+
return isNonEmptyString2(value.error) ? { type: value.type, ...base, error: value.error } : void 0;
|
|
13584
13868
|
default:
|
|
13585
13869
|
return void 0;
|
|
13586
13870
|
}
|
|
@@ -13589,14 +13873,32 @@ function isRivetWebAppRunTerminalEvent(event) {
|
|
|
13589
13873
|
return event.type === "action.completed" || event.type === "action.failed" || event.type === "action.cancelled" || event.type === "action.interrupted";
|
|
13590
13874
|
}
|
|
13591
13875
|
function hasRunEventBase(value) {
|
|
13592
|
-
return
|
|
13876
|
+
return isNonEmptyString2(value.requestId) && isNonEmptyString2(value.runId) && typeof value.sequence === "number" && Number.isSafeInteger(value.sequence) && value.sequence > 0;
|
|
13593
13877
|
}
|
|
13594
|
-
function
|
|
13878
|
+
function isRecord7(value) {
|
|
13595
13879
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
13596
13880
|
}
|
|
13597
|
-
function
|
|
13881
|
+
function parseBrowserStorageRpcLimits(value) {
|
|
13882
|
+
if (!isRecord7(value)) return void 0;
|
|
13883
|
+
if (!isPositiveSafeInteger(value.maxActionBytes) || !isPositiveSafeInteger(value.maxValueBytes) || value.maxValueBytes > value.maxActionBytes) {
|
|
13884
|
+
return void 0;
|
|
13885
|
+
}
|
|
13886
|
+
if (value.transferTimeoutMs != null && !isPositiveSafeInteger(value.transferTimeoutMs)) return void 0;
|
|
13887
|
+
return {
|
|
13888
|
+
maxActionBytes: value.maxActionBytes,
|
|
13889
|
+
maxValueBytes: value.maxValueBytes,
|
|
13890
|
+
transferTimeoutMs: value.transferTimeoutMs ?? RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS
|
|
13891
|
+
};
|
|
13892
|
+
}
|
|
13893
|
+
function isPositiveSafeInteger(value) {
|
|
13894
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0;
|
|
13895
|
+
}
|
|
13896
|
+
function isNonEmptyString2(value) {
|
|
13598
13897
|
return typeof value === "string" && value.length > 0;
|
|
13599
13898
|
}
|
|
13899
|
+
function isStringArray(value) {
|
|
13900
|
+
return Array.isArray(value) && value.length <= 16 && value.every((item) => typeof item === "string" && item.length <= 100);
|
|
13901
|
+
}
|
|
13600
13902
|
|
|
13601
13903
|
// src/model/UiGraphRendererStyles.ts
|
|
13602
13904
|
var RIVET_WEB_APP_RENDERER_CSS = `
|
|
@@ -15061,6 +15363,20 @@ button.rivet-web-app-output-header:focus-visible {
|
|
|
15061
15363
|
margin-bottom: 0;
|
|
15062
15364
|
}
|
|
15063
15365
|
|
|
15366
|
+
.rivet-web-app-loading,
|
|
15367
|
+
.rivet-web-app-storage-warning {
|
|
15368
|
+
border: 1px solid color-mix(in srgb, var(--rivet-web-app-error-color) 52%, transparent);
|
|
15369
|
+
border-radius: 10px;
|
|
15370
|
+
background: color-mix(in srgb, var(--rivet-web-app-error-color) 10%, var(--rivet-web-app-card-background));
|
|
15371
|
+
color: var(--rivet-web-app-foreground);
|
|
15372
|
+
padding: 12px 14px;
|
|
15373
|
+
}
|
|
15374
|
+
|
|
15375
|
+
.rivet-web-app-loading {
|
|
15376
|
+
margin: 24px auto;
|
|
15377
|
+
max-width: 720px;
|
|
15378
|
+
}
|
|
15379
|
+
|
|
15064
15380
|
.rivet-web-app-error {
|
|
15065
15381
|
color: var(--rivet-web-app-error-color);
|
|
15066
15382
|
font-weight: 700;
|
|
@@ -20639,6 +20955,7 @@ function notifyChatV2CallFinished(options2, params) {
|
|
|
20639
20955
|
callId: params.callId,
|
|
20640
20956
|
attemptIndex: params.attemptIndex,
|
|
20641
20957
|
...options2.profileIndex == null ? {} : { profileIndex: options2.profileIndex },
|
|
20958
|
+
...options2.profileName == null ? {} : { profileName: options2.profileName },
|
|
20642
20959
|
...options2.profileHealthKey == null ? {} : { profileHealthKey: options2.profileHealthKey },
|
|
20643
20960
|
...options2.profileHealthState == null ? {} : { profileHealthState: options2.profileHealthState },
|
|
20644
20961
|
...options2.roundIndex == null ? {} : { roundIndex: options2.roundIndex },
|
|
@@ -20944,7 +21261,7 @@ var STATUS_TEXT = {
|
|
|
20944
21261
|
422: "Unprocessable Entity",
|
|
20945
21262
|
429: "Rate Limited"
|
|
20946
21263
|
};
|
|
20947
|
-
function
|
|
21264
|
+
function isRecord8(value) {
|
|
20948
21265
|
if (value == null || typeof value !== "object") {
|
|
20949
21266
|
return false;
|
|
20950
21267
|
}
|
|
@@ -20978,7 +21295,7 @@ function stringifyProviderValue(value) {
|
|
|
20978
21295
|
}
|
|
20979
21296
|
}
|
|
20980
21297
|
function findProviderMessage(value) {
|
|
20981
|
-
if (!
|
|
21298
|
+
if (!isRecord8(value)) {
|
|
20982
21299
|
return stringifyProviderValue(value);
|
|
20983
21300
|
}
|
|
20984
21301
|
const direct = value.message ?? value.error_description ?? value.detail;
|
|
@@ -21002,7 +21319,7 @@ function parseResponseBodyMessage(responseBody) {
|
|
|
21002
21319
|
}
|
|
21003
21320
|
}
|
|
21004
21321
|
function getProviderMessage(error, seen = /* @__PURE__ */ new Set()) {
|
|
21005
|
-
if (!
|
|
21322
|
+
if (!isRecord8(error) || seen.has(error)) {
|
|
21006
21323
|
return void 0;
|
|
21007
21324
|
}
|
|
21008
21325
|
seen.add(error);
|
|
@@ -21011,7 +21328,7 @@ function getProviderMessage(error, seen = /* @__PURE__ */ new Set()) {
|
|
|
21011
21328
|
return responseBodyMessage;
|
|
21012
21329
|
}
|
|
21013
21330
|
const response = error.response;
|
|
21014
|
-
if (
|
|
21331
|
+
if (isRecord8(response)) {
|
|
21015
21332
|
const nestedResponseBody = typeof response.responseBody === "string" ? response.responseBody : typeof response.body === "string" ? response.body : void 0;
|
|
21016
21333
|
const nestedResponseMessage = parseResponseBodyMessage(nestedResponseBody) ?? findProviderMessage(response.data) ?? findProviderMessage(response);
|
|
21017
21334
|
if (nestedResponseMessage) {
|
|
@@ -21086,7 +21403,7 @@ function getRecordStatusCode(record) {
|
|
|
21086
21403
|
return coerceHttpStatusCode(getRecordProperty(record, "statusCode")) ?? coerceHttpStatusCode(getRecordProperty(record, "status"));
|
|
21087
21404
|
}
|
|
21088
21405
|
function getChatV2ProviderErrorStatusCode(error, seen = /* @__PURE__ */ new Set()) {
|
|
21089
|
-
if (!
|
|
21406
|
+
if (!isRecord8(error)) {
|
|
21090
21407
|
return void 0;
|
|
21091
21408
|
}
|
|
21092
21409
|
if (seen.has(error)) {
|
|
@@ -21098,20 +21415,20 @@ function getChatV2ProviderErrorStatusCode(error, seen = /* @__PURE__ */ new Set(
|
|
|
21098
21415
|
return directStatusCode;
|
|
21099
21416
|
}
|
|
21100
21417
|
const response = getRecordProperty(error, "response");
|
|
21101
|
-
if (
|
|
21418
|
+
if (isRecord8(response)) {
|
|
21102
21419
|
const responseStatusCode = getRecordStatusCode(response);
|
|
21103
21420
|
if (responseStatusCode != null) {
|
|
21104
21421
|
return responseStatusCode;
|
|
21105
21422
|
}
|
|
21106
21423
|
}
|
|
21107
21424
|
const data = getRecordProperty(error, "data");
|
|
21108
|
-
if (
|
|
21425
|
+
if (isRecord8(data)) {
|
|
21109
21426
|
const dataStatusCode = getRecordStatusCode(data);
|
|
21110
21427
|
if (dataStatusCode != null) {
|
|
21111
21428
|
return dataStatusCode;
|
|
21112
21429
|
}
|
|
21113
21430
|
const dataError = getRecordProperty(data, "error");
|
|
21114
|
-
if (
|
|
21431
|
+
if (isRecord8(dataError)) {
|
|
21115
21432
|
const dataErrorStatusCode = getRecordStatusCode(dataError);
|
|
21116
21433
|
if (dataErrorStatusCode != null) {
|
|
21117
21434
|
return dataErrorStatusCode;
|
|
@@ -21665,6 +21982,41 @@ async function runChatV2Pipeline(options2) {
|
|
|
21665
21982
|
return execution.outcome === "success" ? execution.result : materializeChatV2PipelineFailure(execution.failure);
|
|
21666
21983
|
}
|
|
21667
21984
|
|
|
21985
|
+
// src/model/chat-v2/llmChatV2OutputClone.ts
|
|
21986
|
+
function cloneOutputValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
21987
|
+
if (value == null || typeof value !== "object") {
|
|
21988
|
+
return value;
|
|
21989
|
+
}
|
|
21990
|
+
if (value instanceof Uint8Array) {
|
|
21991
|
+
return new Uint8Array(value);
|
|
21992
|
+
}
|
|
21993
|
+
const existing = seen.get(value);
|
|
21994
|
+
if (existing != null) {
|
|
21995
|
+
return existing;
|
|
21996
|
+
}
|
|
21997
|
+
if (Array.isArray(value)) {
|
|
21998
|
+
const clone2 = [];
|
|
21999
|
+
seen.set(value, clone2);
|
|
22000
|
+
clone2.push(...value.map((item) => cloneOutputValue(item, seen)));
|
|
22001
|
+
return clone2;
|
|
22002
|
+
}
|
|
22003
|
+
const clone = {};
|
|
22004
|
+
seen.set(value, clone);
|
|
22005
|
+
for (const [key, item] of Object.entries(value)) {
|
|
22006
|
+
clone[key] = cloneOutputValue(item, seen);
|
|
22007
|
+
}
|
|
22008
|
+
return clone;
|
|
22009
|
+
}
|
|
22010
|
+
function cloneLLMChatV2Outputs(outputs) {
|
|
22011
|
+
if (typeof structuredClone === "function") {
|
|
22012
|
+
try {
|
|
22013
|
+
return structuredClone(outputs);
|
|
22014
|
+
} catch {
|
|
22015
|
+
}
|
|
22016
|
+
}
|
|
22017
|
+
return cloneOutputValue(outputs);
|
|
22018
|
+
}
|
|
22019
|
+
|
|
21668
22020
|
// src/model/chat-v2/toolContinuation.ts
|
|
21669
22021
|
function shouldReturnToolResultDirectly(functionCalls, registry) {
|
|
21670
22022
|
var _a;
|
|
@@ -21742,6 +22094,8 @@ async function runChatV2PipelineWithToolContinuation(options2) {
|
|
|
21742
22094
|
functions,
|
|
21743
22095
|
delegateToolCall: delegateToolCall2,
|
|
21744
22096
|
delegateToolCallRound,
|
|
22097
|
+
onCompletedModelRound,
|
|
22098
|
+
onTerminalRound,
|
|
21745
22099
|
runPipeline,
|
|
21746
22100
|
...pipelineOptions
|
|
21747
22101
|
} = options2;
|
|
@@ -21792,8 +22146,21 @@ async function runChatV2PipelineWithToolContinuation(options2) {
|
|
|
21792
22146
|
outputReasoning: pipelineOptions.outputReasoning,
|
|
21793
22147
|
includeFunctionCalls: pipelineOptions.includeFunctionCalls
|
|
21794
22148
|
});
|
|
22149
|
+
onTerminalRound == null ? void 0 : onTerminalRound({
|
|
22150
|
+
entryId: `model-round:${completedRounds}`,
|
|
22151
|
+
roundIndex: completedRounds,
|
|
22152
|
+
kind: "model-round",
|
|
22153
|
+
outcome: decision.kind === "final-model-answer" ? "final-answer" : decision.kind === "release-unresolved-calls" ? "unresolved-tool-calls" : "max-rounds"
|
|
22154
|
+
});
|
|
21795
22155
|
return result;
|
|
21796
22156
|
}
|
|
22157
|
+
onCompletedModelRound == null ? void 0 : onCompletedModelRound({
|
|
22158
|
+
entryId: `model-round:${completedRounds}`,
|
|
22159
|
+
roundIndex: completedRounds,
|
|
22160
|
+
kind: "model-round",
|
|
22161
|
+
outcome: "tool-calls",
|
|
22162
|
+
outputs: cloneLLMChatV2Outputs(result.commonOutputs)
|
|
22163
|
+
});
|
|
21797
22164
|
const toolResultMessages = await toolRoundExecutor.executeRound({
|
|
21798
22165
|
calls: result.functionCalls,
|
|
21799
22166
|
assistantMessage: result.response
|
|
@@ -21837,6 +22204,12 @@ A direct tool result is terminal and is not retried or sent to another LLM profi
|
|
|
21837
22204
|
}
|
|
21838
22205
|
applyAccumulatedUsage(result, accumulatedUsage, pipelineOptions.outputUsage);
|
|
21839
22206
|
applyAccumulatedReasoning(result, reasoningRounds, pipelineOptions.outputReasoning);
|
|
22207
|
+
onTerminalRound == null ? void 0 : onTerminalRound({
|
|
22208
|
+
entryId: `direct-tool-result:${completedRounds}`,
|
|
22209
|
+
roundIndex: completedRounds,
|
|
22210
|
+
kind: "direct-tool-result",
|
|
22211
|
+
outcome: "direct-tool-result"
|
|
22212
|
+
});
|
|
21840
22213
|
return result;
|
|
21841
22214
|
}
|
|
21842
22215
|
currentPrompt = {
|
|
@@ -21851,6 +22224,7 @@ A direct tool result is terminal and is not retried or sent to another LLM profi
|
|
|
21851
22224
|
async function executeLLMInvocation(params) {
|
|
21852
22225
|
const { context, journal, runtime, toolCallContinuation } = params;
|
|
21853
22226
|
try {
|
|
22227
|
+
let terminalSnapshot;
|
|
21854
22228
|
const result = runtime.shouldAutoContinueToolCalls ? await runChatV2PipelineWithToolContinuation({
|
|
21855
22229
|
...runtime.runOptions,
|
|
21856
22230
|
autoContinue: true,
|
|
@@ -21880,12 +22254,36 @@ async function executeLLMInvocation(params) {
|
|
|
21880
22254
|
delegatedToolCall: delegated.record
|
|
21881
22255
|
};
|
|
21882
22256
|
},
|
|
21883
|
-
runPipeline: runtime.runPipeline
|
|
22257
|
+
runPipeline: runtime.runPipeline,
|
|
22258
|
+
onCompletedModelRound: (snapshot) => {
|
|
22259
|
+
var _a;
|
|
22260
|
+
try {
|
|
22261
|
+
const observerResult = (_a = context.onLLMChatOutputSnapshot) == null ? void 0 : _a.call(context, {
|
|
22262
|
+
...snapshot,
|
|
22263
|
+
nodeId: context.node.id,
|
|
22264
|
+
processId: context.processId,
|
|
22265
|
+
splitIndex: context.splitIndex ?? 0
|
|
22266
|
+
});
|
|
22267
|
+
void Promise.resolve(observerResult).catch(() => void 0);
|
|
22268
|
+
} catch {
|
|
22269
|
+
}
|
|
22270
|
+
},
|
|
22271
|
+
onTerminalRound: (snapshot) => {
|
|
22272
|
+
terminalSnapshot = snapshot;
|
|
22273
|
+
}
|
|
21884
22274
|
}) : await runtime.runPipeline(runtime.runOptions);
|
|
22275
|
+
if (!runtime.shouldAutoContinueToolCalls && !isChatV2PipelineProviderFailureResult(result)) {
|
|
22276
|
+
terminalSnapshot = {
|
|
22277
|
+
entryId: "model-round:0",
|
|
22278
|
+
roundIndex: 0,
|
|
22279
|
+
kind: "model-round",
|
|
22280
|
+
outcome: result.functionCalls.length > 0 ? "unresolved-tool-calls" : "final-answer"
|
|
22281
|
+
};
|
|
22282
|
+
}
|
|
21885
22283
|
journal.recordTerminal({
|
|
21886
22284
|
kind: isChatV2PipelineProviderFailureResult(result) ? "failed" : result.functionCalls.length > 0 ? "released-unresolved-calls" : "final-model-answer"
|
|
21887
22285
|
});
|
|
21888
|
-
return result;
|
|
22286
|
+
return { result, terminalSnapshot };
|
|
21889
22287
|
} catch (error) {
|
|
21890
22288
|
journal.recordTerminal({ kind: context.signal.aborted ? "cancelled" : "failed" });
|
|
21891
22289
|
throw error;
|
|
@@ -22028,12 +22426,18 @@ function getLLMAttemptErrorMessage(error) {
|
|
|
22028
22426
|
return "Provider request failed with unreadable error metadata.";
|
|
22029
22427
|
}
|
|
22030
22428
|
}
|
|
22429
|
+
function formatCandidateProfileIdentity(candidate, profileIndex) {
|
|
22430
|
+
var _a;
|
|
22431
|
+
const profileName = (_a = candidate.profileName) == null ? void 0 : _a.trim();
|
|
22432
|
+
const identity = formatCandidateIdentity(candidate);
|
|
22433
|
+
return profileName ? `${profileName} (profile ${profileIndex + 1}; ${identity})` : `Profile ${profileIndex + 1} (${identity})`;
|
|
22434
|
+
}
|
|
22031
22435
|
function buildExhaustedMessage(attempts) {
|
|
22032
22436
|
const details = attempts.map((attempt) => {
|
|
22033
22437
|
const stage = attempt.stage === "request" ? `request${attempt.attemptIndex == null ? "" : ` attempt ${attempt.attemptIndex}`}` : attempt.stage === "response-validation" ? "response validation" : attempt.stage === "health-gate" ? "reliability check" : attempt.stage === "health-update" ? "reliability update" : "configuration";
|
|
22034
22438
|
const status = attempt.status == null ? "" : ` (${attempt.status})`;
|
|
22035
22439
|
const error = attempt.error ? `: ${attempt.error.replace(/\r\n|\r|\n/g, "\n ")}` : "";
|
|
22036
|
-
return
|
|
22440
|
+
return `${formatCandidateProfileIdentity(attempt, attempt.profileIndex ?? 0)}, round ${attempt.roundIndex + 1}, ${stage} ${attempt.outcome}${status}${error}`;
|
|
22037
22441
|
}).join("\n");
|
|
22038
22442
|
return details ? `LLM Profile fallback chain exhausted.
|
|
22039
22443
|
${details}` : "LLM Profile fallback chain exhausted before a provider request could be made.";
|
|
@@ -22045,7 +22449,7 @@ function buildLLMProfileFallbackSummary(candidates, attempts) {
|
|
|
22045
22449
|
return candidates.map((candidate, profileIndex) => {
|
|
22046
22450
|
var _a;
|
|
22047
22451
|
const profileAttempts = attempts.filter((attempt) => attempt.profileIndex === profileIndex);
|
|
22048
|
-
const identity =
|
|
22452
|
+
const identity = formatCandidateProfileIdentity(candidate, profileIndex);
|
|
22049
22453
|
if (profileAttempts.length === 0) {
|
|
22050
22454
|
return `${identity}: not attempted.`;
|
|
22051
22455
|
}
|
|
@@ -22186,6 +22590,7 @@ function createHealthPermit(params) {
|
|
|
22186
22590
|
roundIndex,
|
|
22187
22591
|
profileIndex,
|
|
22188
22592
|
operationTimeoutMs,
|
|
22593
|
+
executionCorrelationId,
|
|
22189
22594
|
signal,
|
|
22190
22595
|
recordAttempt
|
|
22191
22596
|
} = params;
|
|
@@ -22260,7 +22665,8 @@ function createHealthPermit(params) {
|
|
|
22260
22665
|
identity: candidate.health.identity,
|
|
22261
22666
|
policy: candidate.health.policy,
|
|
22262
22667
|
permitId,
|
|
22263
|
-
outcome
|
|
22668
|
+
outcome,
|
|
22669
|
+
...executionCorrelationId == null ? {} : { executionCorrelationId }
|
|
22264
22670
|
})
|
|
22265
22671
|
});
|
|
22266
22672
|
recordAttempt({
|
|
@@ -22293,9 +22699,11 @@ function createLLMProfileFallbackRunner(params) {
|
|
|
22293
22699
|
const attempts = [];
|
|
22294
22700
|
const recordAttempt = (attempt) => {
|
|
22295
22701
|
var _a;
|
|
22296
|
-
|
|
22702
|
+
const candidate = attempt.profileIndex == null ? void 0 : params.candidates[attempt.profileIndex];
|
|
22703
|
+
const completedAttempt = attempt.profileName == null && (candidate == null ? void 0 : candidate.profileName) != null ? { ...attempt, profileName: candidate.profileName } : attempt;
|
|
22704
|
+
attempts.push(completedAttempt);
|
|
22297
22705
|
try {
|
|
22298
|
-
(_a = params.onAttempt) == null ? void 0 : _a.call(params,
|
|
22706
|
+
(_a = params.onAttempt) == null ? void 0 : _a.call(params, completedAttempt);
|
|
22299
22707
|
} catch {
|
|
22300
22708
|
}
|
|
22301
22709
|
};
|
|
@@ -22381,6 +22789,7 @@ function createLLMProfileFallbackRunner(params) {
|
|
|
22381
22789
|
roundIndex,
|
|
22382
22790
|
profileIndex,
|
|
22383
22791
|
operationTimeoutMs: healthOperationTimeoutMs,
|
|
22792
|
+
executionCorrelationId: roundOptions.context.llmProfileHealthExecutionCorrelationId,
|
|
22384
22793
|
signal: roundOptions.context.signal,
|
|
22385
22794
|
recordAttempt
|
|
22386
22795
|
});
|
|
@@ -22439,6 +22848,7 @@ function createLLMProfileFallbackRunner(params) {
|
|
|
22439
22848
|
...candidateOptions,
|
|
22440
22849
|
profileIndex,
|
|
22441
22850
|
roundIndex,
|
|
22851
|
+
...candidate.profileName == null ? {} : { profileName: candidate.profileName },
|
|
22442
22852
|
...activeHealth == null ? {} : {
|
|
22443
22853
|
profileHealthKey: activeHealth.identity.key,
|
|
22444
22854
|
...healthPermit == null ? {} : { profileHealthState: healthPermit.state }
|
|
@@ -23082,38 +23492,8 @@ function buildLLMChatV2EditorCacheKey(parts) {
|
|
|
23082
23492
|
const { cacheVersion = 3, ...keyParts } = parts;
|
|
23083
23493
|
return (0, import_safe_stable_stringify5.default)({ cacheVersion, ...keyParts }) ?? "";
|
|
23084
23494
|
}
|
|
23085
|
-
function cloneEditorCacheValue(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
23086
|
-
if (value == null || typeof value !== "object") {
|
|
23087
|
-
return value;
|
|
23088
|
-
}
|
|
23089
|
-
if (value instanceof Uint8Array) {
|
|
23090
|
-
return new Uint8Array(value);
|
|
23091
|
-
}
|
|
23092
|
-
const existing = seen.get(value);
|
|
23093
|
-
if (existing != null) {
|
|
23094
|
-
return existing;
|
|
23095
|
-
}
|
|
23096
|
-
if (Array.isArray(value)) {
|
|
23097
|
-
const clone2 = [];
|
|
23098
|
-
seen.set(value, clone2);
|
|
23099
|
-
clone2.push(...value.map((item) => cloneEditorCacheValue(item, seen)));
|
|
23100
|
-
return clone2;
|
|
23101
|
-
}
|
|
23102
|
-
const clone = {};
|
|
23103
|
-
seen.set(value, clone);
|
|
23104
|
-
for (const [key, item] of Object.entries(value)) {
|
|
23105
|
-
clone[key] = cloneEditorCacheValue(item, seen);
|
|
23106
|
-
}
|
|
23107
|
-
return clone;
|
|
23108
|
-
}
|
|
23109
23495
|
function cloneLLMChatV2EditorCacheOutputs(outputs) {
|
|
23110
|
-
|
|
23111
|
-
try {
|
|
23112
|
-
return structuredClone(outputs);
|
|
23113
|
-
} catch {
|
|
23114
|
-
}
|
|
23115
|
-
}
|
|
23116
|
-
return cloneEditorCacheValue(outputs);
|
|
23496
|
+
return cloneLLMChatV2Outputs(outputs);
|
|
23117
23497
|
}
|
|
23118
23498
|
function fingerprintSecret(secret) {
|
|
23119
23499
|
if (!secret) {
|
|
@@ -23351,6 +23731,7 @@ async function resolveLLMChatV2RuntimeConfig(params) {
|
|
|
23351
23731
|
return {
|
|
23352
23732
|
provider: parseChatV2Provider(profile.configuration.provider),
|
|
23353
23733
|
model: profile.configuration.model,
|
|
23734
|
+
...profile.profileName == null ? {} : { profileName: profile.profileName },
|
|
23354
23735
|
...profile.configuration.provider === "custom" ? { customProviderApi: parseCustomProviderApi(profile.configuration.customProviderApi) } : {},
|
|
23355
23736
|
...policy == null ? {} : {
|
|
23356
23737
|
health: {
|
|
@@ -23667,7 +24048,7 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
23667
24048
|
};
|
|
23668
24049
|
}
|
|
23669
24050
|
async process(inputs, context) {
|
|
23670
|
-
var _a, _b, _c, _d;
|
|
24051
|
+
var _a, _b, _c, _d, _e;
|
|
23671
24052
|
const invocationJournal = new LLMInvocationJournal();
|
|
23672
24053
|
let profileAttemptSequence = 0;
|
|
23673
24054
|
const usageTrackingContext = {
|
|
@@ -23703,9 +24084,9 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
23703
24084
|
(_a = context.markResultAsEditorCacheHit) == null ? void 0 : _a.call(context);
|
|
23704
24085
|
return cacheHit;
|
|
23705
24086
|
}
|
|
23706
|
-
let
|
|
24087
|
+
let invocation;
|
|
23707
24088
|
try {
|
|
23708
|
-
|
|
24089
|
+
invocation = await executeLLMInvocation({
|
|
23709
24090
|
context,
|
|
23710
24091
|
journal: invocationJournal,
|
|
23711
24092
|
runtime,
|
|
@@ -23726,6 +24107,7 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
23726
24107
|
}
|
|
23727
24108
|
throw error;
|
|
23728
24109
|
}
|
|
24110
|
+
const { result, terminalSnapshot } = invocation;
|
|
23729
24111
|
projectLLMInvocationResult({
|
|
23730
24112
|
result,
|
|
23731
24113
|
modelCalls: invocationJournal.modelCalls,
|
|
@@ -23734,6 +24116,19 @@ var LLMChatV2NodeImpl = class extends NodeImpl {
|
|
|
23734
24116
|
llmAttempts: invocationJournal.llmAttempts,
|
|
23735
24117
|
profileSummary: (_d = runtime.getProfileSummary) == null ? void 0 : _d.call(runtime)
|
|
23736
24118
|
});
|
|
24119
|
+
if (terminalSnapshot != null) {
|
|
24120
|
+
try {
|
|
24121
|
+
const observerResult = (_e = context.onLLMChatOutputSnapshot) == null ? void 0 : _e.call(context, {
|
|
24122
|
+
...terminalSnapshot,
|
|
24123
|
+
nodeId: context.node.id,
|
|
24124
|
+
processId: context.processId,
|
|
24125
|
+
splitIndex: context.splitIndex ?? 0,
|
|
24126
|
+
outputs: cloneLLMChatV2Outputs(result.commonOutputs)
|
|
24127
|
+
});
|
|
24128
|
+
void Promise.resolve(observerResult).catch(() => void 0);
|
|
24129
|
+
} catch {
|
|
24130
|
+
}
|
|
24131
|
+
}
|
|
23737
24132
|
if (toolCallContinuation && !isChatV2PipelineProviderFailureResult(result) && result.functionCalls.length > 0) {
|
|
23738
24133
|
toolCallContinuation.release();
|
|
23739
24134
|
}
|
|
@@ -23908,7 +24303,7 @@ function getLLMProfileBodySections(data) {
|
|
|
23908
24303
|
|
|
23909
24304
|
// src/model/chat-v2/llmProfileNodeRuntime.ts
|
|
23910
24305
|
function resolveLLMProfileNodeValue(params) {
|
|
23911
|
-
var _a, _b, _c, _d;
|
|
24306
|
+
var _a, _b, _c, _d, _e;
|
|
23912
24307
|
const { data, inputs, context } = params;
|
|
23913
24308
|
const runtimeData = data;
|
|
23914
24309
|
const generation = resolveLLMChatV2GenerationParameters(runtimeData, inputs);
|
|
@@ -23973,17 +24368,21 @@ function resolveLLMProfileNodeValue(params) {
|
|
|
23973
24368
|
useGoogleThinkingBudgetInput: false
|
|
23974
24369
|
};
|
|
23975
24370
|
const projectId = (_d = (_c = context.project) == null ? void 0 : _c.metadata) == null ? void 0 : _d.id;
|
|
24371
|
+
const profileTitle = (_e = context.node) == null ? void 0 : _e.title;
|
|
24372
|
+
const profileName = typeof profileTitle === "string" ? profileTitle.trim() : "";
|
|
23976
24373
|
return {
|
|
23977
24374
|
version: LLM_PROFILE_VALUE_VERSION,
|
|
23978
24375
|
credential,
|
|
23979
24376
|
configuration,
|
|
24377
|
+
...profileName === "" ? {} : { profileName },
|
|
23980
24378
|
...projectId == null ? {} : {
|
|
23981
24379
|
healthIdentity: createRivetLLMProfileHealthIdentity({
|
|
23982
24380
|
configuration,
|
|
23983
24381
|
credential,
|
|
23984
24382
|
chatNodeHeaders: context.settings.chatNodeHeaders,
|
|
23985
24383
|
projectId,
|
|
23986
|
-
profileNodeId: context.node.id
|
|
24384
|
+
profileNodeId: context.node.id,
|
|
24385
|
+
...profileName === "" ? {} : { profileName }
|
|
23987
24386
|
})
|
|
23988
24387
|
}
|
|
23989
24388
|
};
|
|
@@ -37405,7 +37804,7 @@ function removeEmptySharedSourceOperations(scope, operations) {
|
|
|
37405
37804
|
}
|
|
37406
37805
|
}
|
|
37407
37806
|
function normalizeKnowledgeSourceManifest(value, expectedSourceId) {
|
|
37408
|
-
if (!
|
|
37807
|
+
if (!isRecord9(value)) throw new Error(`Knowledge manifest for source "${expectedSourceId}" must be an object.`);
|
|
37409
37808
|
if (value.schemaVersion !== MANAGED_SCHEMA_VERSION) {
|
|
37410
37809
|
throw new Error(
|
|
37411
37810
|
`Knowledge manifest for source "${expectedSourceId}" uses unsupported schema version "${String(value.schemaVersion)}".`
|
|
@@ -37674,7 +38073,7 @@ function throwIfAborted2(signal) {
|
|
|
37674
38073
|
function errorMessage(error) {
|
|
37675
38074
|
return error instanceof Error ? error.message : String(error);
|
|
37676
38075
|
}
|
|
37677
|
-
function
|
|
38076
|
+
function isRecord9(value) {
|
|
37678
38077
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
37679
38078
|
const prototype = Object.getPrototypeOf(value);
|
|
37680
38079
|
return prototype === Object.prototype || prototype === null;
|
|
@@ -37854,6 +38253,7 @@ var toRecordedEventMap = {
|
|
|
37854
38253
|
execution
|
|
37855
38254
|
),
|
|
37856
38255
|
llmCallFinished: ({ execution, ...event }) => ({ ...event, execution }),
|
|
38256
|
+
llmChatOutputSnapshot: ({ execution, ...event }) => withExecution(event, execution),
|
|
37857
38257
|
llmProfileAttempt: ({ execution, ...event }) => ({ ...event, execution }),
|
|
37858
38258
|
toolCallFinished: ({ execution, ...event }) => ({ ...event, execution }),
|
|
37859
38259
|
nodeOutputsCleared: ({ node, processId, execution }) => withExecution(
|
|
@@ -40321,7 +40721,7 @@ async function testPineconeKnowledgeConnection(definition, credentials, signal,
|
|
|
40321
40721
|
throw createProviderError(response.status, response.statusText, body);
|
|
40322
40722
|
}
|
|
40323
40723
|
const payload = await parseJsonResponse(response, "testing the knowledge-store connection");
|
|
40324
|
-
if (!
|
|
40724
|
+
if (!isRecord10(payload)) throw new Error("Pinecone connection test returned a malformed successful response.");
|
|
40325
40725
|
}
|
|
40326
40726
|
var PineconeKnowledgeStoreDriver = class {
|
|
40327
40727
|
constructor(config, apiKey) {
|
|
@@ -40344,19 +40744,19 @@ var PineconeKnowledgeStoreDriver = class {
|
|
|
40344
40744
|
const response = await this.#request(url, { method: "GET" }, context);
|
|
40345
40745
|
const indexedLsn = readPineconeLsn(response.headers, "x-pinecone-max-indexed-lsn");
|
|
40346
40746
|
const payload = await parseJsonResponse(response, "fetching the knowledge-source manifest");
|
|
40347
|
-
if (!
|
|
40747
|
+
if (!isRecord10(payload)) {
|
|
40348
40748
|
throw new Error("Pinecone returned an invalid manifest fetch response.");
|
|
40349
40749
|
}
|
|
40350
40750
|
const vectors = payload.vectors;
|
|
40351
|
-
if (!
|
|
40751
|
+
if (!isRecord10(vectors)) {
|
|
40352
40752
|
throw new Error("Pinecone manifest fetch response is missing its vectors map.");
|
|
40353
40753
|
}
|
|
40354
40754
|
const manifestRecord = vectors[MANIFEST_RECORD_ID];
|
|
40355
|
-
if (manifestRecord != null && !
|
|
40755
|
+
if (manifestRecord != null && !isRecord10(manifestRecord)) {
|
|
40356
40756
|
throw new Error(`Pinecone manifest record for source "${sourceId}" is malformed.`);
|
|
40357
40757
|
}
|
|
40358
|
-
if (!
|
|
40359
|
-
const fields =
|
|
40758
|
+
if (!isRecord10(manifestRecord)) return { ...indexedLsn == null ? {} : { indexedLsn } };
|
|
40759
|
+
const fields = isRecord10(manifestRecord.fields) ? manifestRecord.fields : isRecord10(manifestRecord.metadata) ? manifestRecord.metadata : {};
|
|
40360
40760
|
const encodedManifest = fields.rivet_manifest_json;
|
|
40361
40761
|
if (typeof encodedManifest !== "string") {
|
|
40362
40762
|
throw new Error(`Pinecone manifest for source "${sourceId}" is missing Rivet manifest metadata.`);
|
|
@@ -40446,11 +40846,11 @@ var PineconeKnowledgeStoreDriver = class {
|
|
|
40446
40846
|
context
|
|
40447
40847
|
);
|
|
40448
40848
|
const payload = await parseJsonResponse(response, "searching knowledge");
|
|
40449
|
-
if (!
|
|
40849
|
+
if (!isRecord10(payload) || !isRecord10(payload.result) || !Array.isArray(payload.result.hits)) {
|
|
40450
40850
|
throw new Error("Pinecone returned an invalid knowledge search response.");
|
|
40451
40851
|
}
|
|
40452
40852
|
return payload.result.hits.map((hit, index) => {
|
|
40453
|
-
if (!
|
|
40853
|
+
if (!isRecord10(hit) || !isRecord10(hit.fields)) {
|
|
40454
40854
|
throw new Error(`Pinecone knowledge search hit ${index + 1} is malformed.`);
|
|
40455
40855
|
}
|
|
40456
40856
|
const fields = hit.fields;
|
|
@@ -40692,8 +41092,8 @@ function createProviderError(status, statusText, body) {
|
|
|
40692
41092
|
let providerMessage = body.trim();
|
|
40693
41093
|
try {
|
|
40694
41094
|
const parsed = JSON.parse(body);
|
|
40695
|
-
if (
|
|
40696
|
-
const error =
|
|
41095
|
+
if (isRecord10(parsed)) {
|
|
41096
|
+
const error = isRecord10(parsed.error) ? parsed.error : void 0;
|
|
40697
41097
|
providerMessage = stringConfig(error == null ? void 0 : error.message) || stringConfig(parsed.message) || stringConfig(parsed.error) || providerMessage;
|
|
40698
41098
|
}
|
|
40699
41099
|
} catch {
|
|
@@ -40719,7 +41119,7 @@ function extractUserMetadata(fields, textField) {
|
|
|
40719
41119
|
return Object.keys(metadata).length ? metadata : void 0;
|
|
40720
41120
|
}
|
|
40721
41121
|
function recordId(value) {
|
|
40722
|
-
if (!
|
|
41122
|
+
if (!isRecord10(value)) return "";
|
|
40723
41123
|
return stringConfig(value._id) || stringConfig(value.id);
|
|
40724
41124
|
}
|
|
40725
41125
|
function stringConfig(value) {
|
|
@@ -40769,7 +41169,7 @@ function validatePineconeFilterComparison(filter) {
|
|
|
40769
41169
|
throw new Error(`Pinecone filter operator "${filter.operator}" requires an array of strings or numbers.`);
|
|
40770
41170
|
}
|
|
40771
41171
|
}
|
|
40772
|
-
function
|
|
41172
|
+
function isRecord10(value) {
|
|
40773
41173
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
40774
41174
|
}
|
|
40775
41175
|
function isRetryableStatus(status) {
|
|
@@ -44754,7 +45154,9 @@ function coreCreateProcessor(project, options2, internalOptions = {}) {
|
|
|
44754
45154
|
settings: resolveProcessSettings(options2),
|
|
44755
45155
|
getChatNodeEndpoint: options2.getChatNodeEndpoint,
|
|
44756
45156
|
onChatV2CallFinished: options2.onChatV2CallFinished,
|
|
45157
|
+
onLLMChatOutputSnapshot: options2.onLLMChatOutputSnapshot,
|
|
44757
45158
|
llmProfileHealthStore: options2.llmProfileHealthStore,
|
|
45159
|
+
llmProfileHealthExecutionCorrelationId: options2.llmProfileHealthExecutionCorrelationId,
|
|
44758
45160
|
evaluation: options2.evaluation
|
|
44759
45161
|
},
|
|
44760
45162
|
resolvedInputs,
|
|
@@ -44917,6 +45319,15 @@ var Rivet = void 0;
|
|
|
44917
45319
|
RIVET_MARKDOWN_ALLOWED_URI_REGEXP_SOURCE,
|
|
44918
45320
|
RIVET_MARKDOWN_SANITIZER_POLICY,
|
|
44919
45321
|
RIVET_WEB_APP_ACTION_PROTOCOL_VERSION,
|
|
45322
|
+
RIVET_WEB_APP_BROWSER_STORAGE_BINARY_FRAME_HEADER_BYTES,
|
|
45323
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTION_BYTES,
|
|
45324
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_ACTIVE_BYTES,
|
|
45325
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_MAX_VALUE_BYTES,
|
|
45326
|
+
RIVET_WEB_APP_BROWSER_STORAGE_DEFAULT_TRANSFER_TIMEOUT_MS,
|
|
45327
|
+
RIVET_WEB_APP_BROWSER_STORAGE_RPC_CAPABILITY,
|
|
45328
|
+
RIVET_WEB_APP_BROWSER_STORAGE_RPC_VERSION,
|
|
45329
|
+
RIVET_WEB_APP_BROWSER_STORAGE_SAFE_FALLBACK_BYTES,
|
|
45330
|
+
RIVET_WEB_APP_BROWSER_STORAGE_TRANSFER_CHUNK_BYTES,
|
|
44920
45331
|
RIVET_WEB_APP_DOCUMENT_CSS,
|
|
44921
45332
|
RIVET_WEB_APP_RENDERER_CSS,
|
|
44922
45333
|
RIVET_WEB_APP_STATUS_FUNCTION_NAME,
|
|
@@ -44989,6 +45400,7 @@ var Rivet = void 0;
|
|
|
44989
45400
|
callGraphNode,
|
|
44990
45401
|
canBeCoerced,
|
|
44991
45402
|
canBeCoercedAny,
|
|
45403
|
+
canConsumeControlFlowExcludedInput,
|
|
44992
45404
|
canRenderDataBusNode,
|
|
44993
45405
|
canUseNodeAsPrefabSource,
|
|
44994
45406
|
chatLoopNode,
|
|
@@ -45053,12 +45465,15 @@ var Rivet = void 0;
|
|
|
45053
45465
|
datasetNearestNeighborsNode,
|
|
45054
45466
|
decideLLMInvocationRound,
|
|
45055
45467
|
decodeDebuggerTransportSentinels,
|
|
45468
|
+
decodeRivetWebAppStorageBinaryFrame,
|
|
45056
45469
|
dedent,
|
|
45057
45470
|
delayNode,
|
|
45058
45471
|
delegateFunctionCallNode,
|
|
45059
45472
|
deserializeDatasets,
|
|
45060
45473
|
deserializeGraph,
|
|
45061
45474
|
deserializeProject,
|
|
45475
|
+
deserializeRivetWebAppStoredValue,
|
|
45476
|
+
deserializeRivetWebAppStoredValuePatch,
|
|
45062
45477
|
destructureNode,
|
|
45063
45478
|
detachNodePrefabInstance,
|
|
45064
45479
|
detectSerializationVersion,
|
|
@@ -45066,6 +45481,7 @@ var Rivet = void 0;
|
|
|
45066
45481
|
documentNode,
|
|
45067
45482
|
doubleCheckProject,
|
|
45068
45483
|
emptyNodeGraph,
|
|
45484
|
+
encodeRivetWebAppStorageBinaryFrame,
|
|
45069
45485
|
evaluateNode,
|
|
45070
45486
|
executeLLMInvocation,
|
|
45071
45487
|
expectType,
|
|
@@ -45290,6 +45706,8 @@ var Rivet = void 0;
|
|
|
45290
45706
|
parseCustomProviderApi,
|
|
45291
45707
|
parseDataBusChannelIndex,
|
|
45292
45708
|
parseProviderJsonChunk,
|
|
45709
|
+
parseRivetWebAppBrowserStorageClientMessage,
|
|
45710
|
+
parseRivetWebAppBrowserStorageServerMessage,
|
|
45293
45711
|
parseRivetWebAppClientMessage,
|
|
45294
45712
|
parseRivetWebAppServerMessage,
|
|
45295
45713
|
passthroughNode,
|
|
@@ -45356,6 +45774,8 @@ var Rivet = void 0;
|
|
|
45356
45774
|
serializeDatasets,
|
|
45357
45775
|
serializeGraph,
|
|
45358
45776
|
serializeProject,
|
|
45777
|
+
serializeRivetWebAppStoredValue,
|
|
45778
|
+
serializeRivetWebAppStoredValuePatch,
|
|
45359
45779
|
setGlobalNode,
|
|
45360
45780
|
setStoredValueNode,
|
|
45361
45781
|
shouldIncludeLLMChatV2ToolCalls,
|
|
@@ -45364,6 +45784,7 @@ var Rivet = void 0;
|
|
|
45364
45784
|
shuffleNode,
|
|
45365
45785
|
sliceNode,
|
|
45366
45786
|
splitNode,
|
|
45787
|
+
splitRivetWebAppStorageTransfer,
|
|
45367
45788
|
startBackgroundBranchNode,
|
|
45368
45789
|
streamChatV2,
|
|
45369
45790
|
stringifyToolResult,
|