@valerypopoff/rivet2-core 2.0.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/LICENSE +7 -0
- package/README.md +15 -0
- package/dist/cjs/bundle.cjs +28772 -0
- package/dist/cjs/bundle.cjs.map +7 -0
- package/dist/esm/api/createProcessor.js +116 -0
- package/dist/esm/api/looseDataValue.js +16 -0
- package/dist/esm/api/processSettings.js +16 -0
- package/dist/esm/api/streaming.js +116 -0
- package/dist/esm/exports.js +48 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/integrations/AudioProvider.js +1 -0
- package/dist/esm/integrations/CodeRunner.js +44 -0
- package/dist/esm/integrations/DatasetProvider.js +92 -0
- package/dist/esm/integrations/EmbeddingGenerator.js +1 -0
- package/dist/esm/integrations/GptTokenizerTokenizer.js +67 -0
- package/dist/esm/integrations/LLMProvider.js +1 -0
- package/dist/esm/integrations/Tokenizer.js +1 -0
- package/dist/esm/integrations/VectorDatabase.js +1 -0
- package/dist/esm/integrations/enableIntegrations.js +3 -0
- package/dist/esm/integrations/integrations.js +19 -0
- package/dist/esm/integrations/mcp/MCPBase.js +87 -0
- package/dist/esm/integrations/mcp/MCPProvider.js +23 -0
- package/dist/esm/integrations/mcp/MCPUtils.js +33 -0
- package/dist/esm/integrations/openai/OpenAIEmbeddingGenerator.js +23 -0
- package/dist/esm/model/CycleDetector.js +43 -0
- package/dist/esm/model/DataValue.js +188 -0
- package/dist/esm/model/Dataset.js +1 -0
- package/dist/esm/model/EditorDefinition.js +1 -0
- package/dist/esm/model/ExecutorProtocol.js +1 -0
- package/dist/esm/model/GraphPreprocessor.js +97 -0
- package/dist/esm/model/GraphProcessor.js +1136 -0
- package/dist/esm/model/NodeBase.js +11 -0
- package/dist/esm/model/NodeBodySpec.js +1 -0
- package/dist/esm/model/NodeDefinition.js +12 -0
- package/dist/esm/model/NodeExecutionPlanner.js +82 -0
- package/dist/esm/model/NodeGraph.js +14 -0
- package/dist/esm/model/NodeImpl.js +57 -0
- package/dist/esm/model/NodeRegistration.js +146 -0
- package/dist/esm/model/Nodes.js +279 -0
- package/dist/esm/model/PluginLoadSpec.js +1 -0
- package/dist/esm/model/ProcessContext.js +1 -0
- package/dist/esm/model/ProcessContextBuilder.js +33 -0
- package/dist/esm/model/Project.js +2 -0
- package/dist/esm/model/ProjectReferenceLoader.js +1 -0
- package/dist/esm/model/RecordingPlayer.js +262 -0
- package/dist/esm/model/RegistryAssembly.js +53 -0
- package/dist/esm/model/RivetPlugin.js +1 -0
- package/dist/esm/model/RivetUIContext.js +1 -0
- package/dist/esm/model/Settings.js +1 -0
- package/dist/esm/model/SplitRunProcessor.js +98 -0
- package/dist/esm/model/SubprocessorBridge.js +82 -0
- package/dist/esm/model/chat/aiSdkMessages.js +105 -0
- package/dist/esm/model/chat/aiSdkStreaming.js +38 -0
- package/dist/esm/model/chat/aiSdkTools.js +10 -0
- package/dist/esm/model/chat/chatCost.js +33 -0
- package/dist/esm/model/chat/chatMessages.js +47 -0
- package/dist/esm/model/chat/openAIChatRequest.js +110 -0
- package/dist/esm/model/chat/openAIChatRuntime.js +220 -0
- package/dist/esm/model/chat/streamChatResponse.js +97 -0
- package/dist/esm/model/chat/tokenBudget.js +16 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +88 -0
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +107 -0
- package/dist/esm/model/chat-v2/chatV2Errors.js +255 -0
- package/dist/esm/model/chat-v2/chatV2FeatureCompatibility.js +16 -0
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +387 -0
- package/dist/esm/model/chat-v2/chatV2ResponseFormat.js +57 -0
- package/dist/esm/model/chat-v2/chatV2Retry.js +41 -0
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +242 -0
- package/dist/esm/model/chat-v2/chatV2Shared.js +285 -0
- package/dist/esm/model/chat-v2/chatV2Types.js +1 -0
- package/dist/esm/model/chat-v2/index.js +10 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +56 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +475 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +90 -0
- package/dist/esm/model/chat-v2/messageConverter.js +173 -0
- package/dist/esm/model/chat-v2/modelRegistry.js +23 -0
- package/dist/esm/model/chat-v2/providerOptions.js +202 -0
- package/dist/esm/model/chat-v2/toolContinuation.js +108 -0
- package/dist/esm/model/chat-v2/toolConverter.js +4 -0
- package/dist/esm/model/interpolationInputDefinition.js +36 -0
- package/dist/esm/model/loopControllerBreak.js +4 -0
- package/dist/esm/model/nodes/AbortGraphNode.js +100 -0
- package/dist/esm/model/nodes/AppendToDatasetNode.js +115 -0
- package/dist/esm/model/nodes/ArrayNode.js +144 -0
- package/dist/esm/model/nodes/AssembleMessageNode.js +209 -0
- package/dist/esm/model/nodes/AssemblePromptNode.js +151 -0
- package/dist/esm/model/nodes/AudioNode.js +101 -0
- package/dist/esm/model/nodes/BooleanNode.js +74 -0
- package/dist/esm/model/nodes/CallGraphNode.js +135 -0
- package/dist/esm/model/nodes/ChatLoopNode.js +150 -0
- package/dist/esm/model/nodes/ChatNode.js +56 -0
- package/dist/esm/model/nodes/ChatNodeBase.js +912 -0
- package/dist/esm/model/nodes/ChunkNode.js +166 -0
- package/dist/esm/model/nodes/CoalesceNode.js +104 -0
- package/dist/esm/model/nodes/CodeNode.js +197 -0
- package/dist/esm/model/nodes/CommentNode.js +71 -0
- package/dist/esm/model/nodes/CompareNode.js +144 -0
- package/dist/esm/model/nodes/ContextNode.js +99 -0
- package/dist/esm/model/nodes/CreateDatasetNode.js +71 -0
- package/dist/esm/model/nodes/CronNode.js +248 -0
- package/dist/esm/model/nodes/DatasetNearestNeigborsNode.js +97 -0
- package/dist/esm/model/nodes/DelayNode.js +105 -0
- package/dist/esm/model/nodes/DelegateFunctionCallNode.js +175 -0
- package/dist/esm/model/nodes/DestructureNode.js +110 -0
- package/dist/esm/model/nodes/DocumentNode.js +183 -0
- package/dist/esm/model/nodes/EvaluateNode.js +141 -0
- package/dist/esm/model/nodes/ExpressionNode.js +143 -0
- package/dist/esm/model/nodes/ExternalCallNode.js +162 -0
- package/dist/esm/model/nodes/ExtractJsonNode.js +122 -0
- package/dist/esm/model/nodes/ExtractMarkdownCodeBlocksNode.js +100 -0
- package/dist/esm/model/nodes/ExtractObjectPathNode.js +159 -0
- package/dist/esm/model/nodes/ExtractRegexNode.js +200 -0
- package/dist/esm/model/nodes/ExtractYamlNode.js +214 -0
- package/dist/esm/model/nodes/FilterNode.js +73 -0
- package/dist/esm/model/nodes/GetAllDatasetsNode.js +53 -0
- package/dist/esm/model/nodes/GetDatasetRowNode.js +99 -0
- package/dist/esm/model/nodes/GetEmbeddingNode.js +130 -0
- package/dist/esm/model/nodes/GetGlobalNode.js +139 -0
- package/dist/esm/model/nodes/GraphInputNode.js +132 -0
- package/dist/esm/model/nodes/GraphOutputNode.js +104 -0
- package/dist/esm/model/nodes/GraphReferenceNode.js +128 -0
- package/dist/esm/model/nodes/HashNode.js +97 -0
- package/dist/esm/model/nodes/HttpCallNode.js +592 -0
- package/dist/esm/model/nodes/IfElseNode.js +138 -0
- package/dist/esm/model/nodes/IfNode.js +129 -0
- package/dist/esm/model/nodes/ImageNode.js +107 -0
- package/dist/esm/model/nodes/JSFilterNode.js +69 -0
- package/dist/esm/model/nodes/JSMapNode.js +69 -0
- package/dist/esm/model/nodes/JoinNode.js +135 -0
- package/dist/esm/model/nodes/LLMChatV2Node.js +234 -0
- package/dist/esm/model/nodes/ListGraphsNode.js +61 -0
- package/dist/esm/model/nodes/LoadDatasetNode.js +83 -0
- package/dist/esm/model/nodes/LoopControllerNode.js +206 -0
- package/dist/esm/model/nodes/LoopUntilNode.js +214 -0
- package/dist/esm/model/nodes/MCPDiscoveryNode.js +214 -0
- package/dist/esm/model/nodes/MCPGetPromptNode.js +234 -0
- package/dist/esm/model/nodes/MCPToolCallNode.js +262 -0
- package/dist/esm/model/nodes/MatchNode.js +160 -0
- package/dist/esm/model/nodes/NumberNode.js +86 -0
- package/dist/esm/model/nodes/ObjectNode.js +152 -0
- package/dist/esm/model/nodes/PassthroughNode.js +78 -0
- package/dist/esm/model/nodes/PlayAudioNode.js +61 -0
- package/dist/esm/model/nodes/PopNode.js +89 -0
- package/dist/esm/model/nodes/PromptNode.js +248 -0
- package/dist/esm/model/nodes/RaceInputsNode.js +85 -0
- package/dist/esm/model/nodes/RaiseEventNode.js +84 -0
- package/dist/esm/model/nodes/RandomNumberNode.js +117 -0
- package/dist/esm/model/nodes/ReadAllFilesNode.js +210 -0
- package/dist/esm/model/nodes/ReadDirectoryNode.js +171 -0
- package/dist/esm/model/nodes/ReadFileNode.js +114 -0
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +199 -0
- package/dist/esm/model/nodes/ReplaceDatasetNode.js +118 -0
- package/dist/esm/model/nodes/SetGlobalNode.js +124 -0
- package/dist/esm/model/nodes/ShuffleNode.js +64 -0
- package/dist/esm/model/nodes/SliceNode.js +99 -0
- package/dist/esm/model/nodes/SplitNode.js +101 -0
- package/dist/esm/model/nodes/SubGraphNode.js +180 -0
- package/dist/esm/model/nodes/TextNode.js +125 -0
- package/dist/esm/model/nodes/ToJsonNode.js +78 -0
- package/dist/esm/model/nodes/ToMarkdownTableNode.js +119 -0
- package/dist/esm/model/nodes/ToTreeNode.js +133 -0
- package/dist/esm/model/nodes/ToYamlNode.js +68 -0
- package/dist/esm/model/nodes/ToolNode.js +172 -0
- package/dist/esm/model/nodes/TrimChatMessagesNode.js +120 -0
- package/dist/esm/model/nodes/URLReferenceNode.js +79 -0
- package/dist/esm/model/nodes/UserInputNode.js +109 -0
- package/dist/esm/model/nodes/VectorNearestNeighborsNode.js +127 -0
- package/dist/esm/model/nodes/VectorStoreNode.js +124 -0
- package/dist/esm/model/nodes/WaitForEventNode.js +88 -0
- package/dist/esm/model/nodes/codeNodeErrorDiagnostics.js +104 -0
- package/dist/esm/model/nodes/jsListCallbackHelpers.js +196 -0
- package/dist/esm/model/nodes/jsValueInterpolation.js +163 -0
- package/dist/esm/model/nodes/toolCallDelegation.js +159 -0
- package/dist/esm/native/BaseDir.js +32 -0
- package/dist/esm/native/BrowserNativeApi.js +19 -0
- package/dist/esm/native/NativeApi.js +1 -0
- package/dist/esm/plugins/anthropic/anthropic.js +208 -0
- package/dist/esm/plugins/anthropic/fetchEventSource.js +107 -0
- package/dist/esm/plugins/anthropic/index.js +2 -0
- package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +767 -0
- package/dist/esm/plugins/anthropic/plugin.js +26 -0
- package/dist/esm/plugins/assemblyAi/LemurActionItemsNode.js +75 -0
- package/dist/esm/plugins/assemblyAi/LemurQaNode.js +155 -0
- package/dist/esm/plugins/assemblyAi/LemurSummaryNode.js +79 -0
- package/dist/esm/plugins/assemblyAi/LemurTaskNode.js +82 -0
- package/dist/esm/plugins/assemblyAi/TranscribeAudioNode.js +126 -0
- package/dist/esm/plugins/assemblyAi/index.js +2 -0
- package/dist/esm/plugins/assemblyAi/lemurHelpers.js +114 -0
- package/dist/esm/plugins/assemblyAi/plugin.js +32 -0
- package/dist/esm/plugins/autoevals/AutoEvalsNode.js +223 -0
- package/dist/esm/plugins/autoevals/index.js +2 -0
- package/dist/esm/plugins/autoevals/plugin.js +8 -0
- package/dist/esm/plugins/gentrace/index.js +3 -0
- package/dist/esm/plugins/gentrace/plugin.js +195 -0
- package/dist/esm/plugins/google/google.js +165 -0
- package/dist/esm/plugins/google/index.js +2 -0
- package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +584 -0
- package/dist/esm/plugins/google/plugin.js +39 -0
- package/dist/esm/plugins/huggingface/index.js +2 -0
- package/dist/esm/plugins/huggingface/nodes/ChatHuggingFace.js +243 -0
- package/dist/esm/plugins/huggingface/nodes/TextToImageHuggingFace.js +189 -0
- package/dist/esm/plugins/huggingface/plugin.js +26 -0
- package/dist/esm/plugins/openai/handleOpenaiError.js +17 -0
- package/dist/esm/plugins/openai/index.js +2 -0
- package/dist/esm/plugins/openai/nodes/AttachAssistantFileNode.js +123 -0
- package/dist/esm/plugins/openai/nodes/CreateAssistantNode.js +289 -0
- package/dist/esm/plugins/openai/nodes/CreateThreadMessageNode.js +176 -0
- package/dist/esm/plugins/openai/nodes/CreateThreadNode.js +157 -0
- package/dist/esm/plugins/openai/nodes/DeleteAssistantNode.js +104 -0
- package/dist/esm/plugins/openai/nodes/DeleteThreadNode.js +97 -0
- package/dist/esm/plugins/openai/nodes/GetAssistantNode.js +118 -0
- package/dist/esm/plugins/openai/nodes/GetOpenAIFileNode.js +100 -0
- package/dist/esm/plugins/openai/nodes/GetThreadNode.js +108 -0
- package/dist/esm/plugins/openai/nodes/ListAssistantsNode.js +202 -0
- package/dist/esm/plugins/openai/nodes/ListOpenAIFilesNode.js +94 -0
- package/dist/esm/plugins/openai/nodes/ListThreadMessagesNode.js +224 -0
- package/dist/esm/plugins/openai/nodes/RunThreadNode.js +630 -0
- package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +143 -0
- package/dist/esm/plugins/openai/nodes/UploadFileNode.js +121 -0
- package/dist/esm/plugins/openai/plugin.js +44 -0
- package/dist/esm/plugins/pinecone/PineconeVectorDatabase.js +88 -0
- package/dist/esm/plugins/pinecone/index.js +2 -0
- package/dist/esm/plugins/pinecone/plugin.js +19 -0
- package/dist/esm/plugins.js +29 -0
- package/dist/esm/recording/ExecutionRecorder.js +273 -0
- package/dist/esm/recording/RecordedEvents.js +1 -0
- package/dist/esm/utils/assertNever.js +3 -0
- package/dist/esm/utils/base64.js +38 -0
- package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +73 -0
- package/dist/esm/utils/coerceType.js +326 -0
- package/dist/esm/utils/compatibility.js +27 -0
- package/dist/esm/utils/copyToClipboard.js +10 -0
- package/dist/esm/utils/defaults.js +2 -0
- package/dist/esm/utils/emitDetached.js +12 -0
- package/dist/esm/utils/errors.js +7 -0
- package/dist/esm/utils/expectType.js +34 -0
- package/dist/esm/utils/fetchEventSource.js +120 -0
- package/dist/esm/utils/genericUtilFunctions.js +25 -0
- package/dist/esm/utils/getPluginConfig.js +23 -0
- package/dist/esm/utils/handleEscapeCharacters.js +11 -0
- package/dist/esm/utils/index.js +17 -0
- package/dist/esm/utils/inputs.js +16 -0
- package/dist/esm/utils/interpolation.js +286 -0
- package/dist/esm/utils/misc.js +1 -0
- package/dist/esm/utils/newId.js +4 -0
- package/dist/esm/utils/openai.js +206 -0
- package/dist/esm/utils/orderedStringPortIds.js +27 -0
- package/dist/esm/utils/outputs.js +14 -0
- package/dist/esm/utils/pQueueCompat.js +12 -0
- package/dist/esm/utils/paths.js +80 -0
- package/dist/esm/utils/providerStreamParsing.js +14 -0
- package/dist/esm/utils/runtimeLogging.js +121 -0
- package/dist/esm/utils/serialization/serialization.js +77 -0
- package/dist/esm/utils/serialization/serializationHelpers.js +63 -0
- package/dist/esm/utils/serialization/serializationUtils.js +112 -0
- package/dist/esm/utils/serialization/serialization_v1.js +19 -0
- package/dist/esm/utils/serialization/serialization_v2.js +24 -0
- package/dist/esm/utils/serialization/serialization_v3.js +100 -0
- package/dist/esm/utils/serialization/serialization_v4.js +156 -0
- package/dist/esm/utils/symbols.js +2 -0
- package/dist/esm/utils/time.js +14 -0
- package/dist/esm/utils/typeSafety.js +42 -0
- package/dist/esm/vendor/fnv1a.js +80 -0
- package/dist/types/api/createProcessor.d.ts +56 -0
- package/dist/types/api/looseDataValue.d.ts +4 -0
- package/dist/types/api/processSettings.d.ts +4 -0
- package/dist/types/api/streaming.d.ts +56 -0
- package/dist/types/exports.d.ts +49 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/integrations/AudioProvider.d.ts +4 -0
- package/dist/types/integrations/CodeRunner.d.ts +19 -0
- package/dist/types/integrations/DatasetProvider.d.ts +33 -0
- package/dist/types/integrations/EmbeddingGenerator.d.ts +3 -0
- package/dist/types/integrations/GptTokenizerTokenizer.d.ts +20 -0
- package/dist/types/integrations/LLMProvider.d.ts +7 -0
- package/dist/types/integrations/Tokenizer.d.ts +11 -0
- package/dist/types/integrations/VectorDatabase.d.ts +7 -0
- package/dist/types/integrations/enableIntegrations.d.ts +1 -0
- package/dist/types/integrations/integrations.d.ts +12 -0
- package/dist/types/integrations/mcp/MCPBase.d.ts +18 -0
- package/dist/types/integrations/mcp/MCPProvider.d.ts +153 -0
- package/dist/types/integrations/mcp/MCPUtils.d.ts +9 -0
- package/dist/types/integrations/openai/OpenAIEmbeddingGenerator.d.ts +10 -0
- package/dist/types/model/CycleDetector.d.ts +2 -0
- package/dist/types/model/DataValue.d.ts +160 -0
- package/dist/types/model/Dataset.d.ts +19 -0
- package/dist/types/model/EditorDefinition.d.ts +176 -0
- package/dist/types/model/ExecutorProtocol.d.ts +216 -0
- package/dist/types/model/GraphPreprocessor.d.ts +24 -0
- package/dist/types/model/GraphProcessor.d.ts +210 -0
- package/dist/types/model/NodeBase.d.ts +116 -0
- package/dist/types/model/NodeBodySpec.d.ts +19 -0
- package/dist/types/model/NodeDefinition.d.ts +13 -0
- package/dist/types/model/NodeExecutionPlanner.d.ts +28 -0
- package/dist/types/model/NodeGraph.d.ts +15 -0
- package/dist/types/model/NodeImpl.d.ts +56 -0
- package/dist/types/model/NodeRegistration.d.ts +29 -0
- package/dist/types/model/Nodes.d.ts +112 -0
- package/dist/types/model/PluginLoadSpec.d.ts +17 -0
- package/dist/types/model/ProcessContext.d.ts +110 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +41 -0
- package/dist/types/model/Project.d.ts +31 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +5 -0
- package/dist/types/model/RecordingPlayer.d.ts +27 -0
- package/dist/types/model/RegistryAssembly.d.ts +42 -0
- package/dist/types/model/RivetPlugin.d.ts +51 -0
- package/dist/types/model/RivetUIContext.d.ts +27 -0
- package/dist/types/model/Settings.d.ts +20 -0
- package/dist/types/model/SplitRunProcessor.d.ts +31 -0
- package/dist/types/model/SubprocessorBridge.d.ts +13 -0
- package/dist/types/model/chat/aiSdkMessages.d.ts +3 -0
- package/dist/types/model/chat/aiSdkStreaming.d.ts +9 -0
- package/dist/types/model/chat/aiSdkTools.d.ts +3 -0
- package/dist/types/model/chat/chatCost.d.ts +30 -0
- package/dist/types/model/chat/chatMessages.d.ts +5 -0
- package/dist/types/model/chat/openAIChatRequest.d.ts +39 -0
- package/dist/types/model/chat/openAIChatRuntime.d.ts +61 -0
- package/dist/types/model/chat/streamChatResponse.d.ts +27 -0
- package/dist/types/model/chat/tokenBudget.d.ts +3 -0
- package/dist/types/model/chat-v2/aiSdkBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2EditorCache.d.ts +25 -0
- package/dist/types/model/chat-v2/chatV2Errors.d.ts +23 -0
- package/dist/types/model/chat-v2/chatV2FeatureCompatibility.d.ts +12 -0
- package/dist/types/model/chat-v2/chatV2Pipeline.d.ts +2 -0
- package/dist/types/model/chat-v2/chatV2ResponseFormat.d.ts +24 -0
- package/dist/types/model/chat-v2/chatV2Retry.d.ts +5 -0
- package/dist/types/model/chat-v2/chatV2RuntimeOptions.d.ts +12 -0
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +56 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +110 -0
- package/dist/types/model/chat-v2/index.d.ts +10 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +73 -0
- package/dist/types/model/chat-v2/llmChatV2NodeEditors.d.ts +4 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +23 -0
- package/dist/types/model/chat-v2/messageConverter.d.ts +8 -0
- package/dist/types/model/chat-v2/modelRegistry.d.ts +296 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +59 -0
- package/dist/types/model/chat-v2/toolContinuation.d.ts +15 -0
- package/dist/types/model/chat-v2/toolConverter.d.ts +3 -0
- package/dist/types/model/interpolationInputDefinition.d.ts +16 -0
- package/dist/types/model/loopControllerBreak.d.ts +3 -0
- package/dist/types/model/nodes/AbortGraphNode.d.ts +22 -0
- package/dist/types/model/nodes/AppendToDatasetNode.d.ts +21 -0
- package/dist/types/model/nodes/ArrayNode.d.ts +20 -0
- package/dist/types/model/nodes/AssembleMessageNode.d.ts +23 -0
- package/dist/types/model/nodes/AssemblePromptNode.d.ts +23 -0
- package/dist/types/model/nodes/AudioNode.d.ts +20 -0
- package/dist/types/model/nodes/BooleanNode.d.ts +19 -0
- package/dist/types/model/nodes/CallGraphNode.d.ts +16 -0
- package/dist/types/model/nodes/ChatLoopNode.d.ts +21 -0
- package/dist/types/model/nodes/ChatNode.d.ts +17 -0
- package/dist/types/model/nodes/ChatNodeBase.d.ts +85 -0
- package/dist/types/model/nodes/ChunkNode.d.ts +22 -0
- package/dist/types/model/nodes/CoalesceNode.d.ts +14 -0
- package/dist/types/model/nodes/CodeNode.d.ts +27 -0
- package/dist/types/model/nodes/CommentNode.d.ts +20 -0
- package/dist/types/model/nodes/CompareNode.d.ts +19 -0
- package/dist/types/model/nodes/ContextNode.d.ts +24 -0
- package/dist/types/model/nodes/CreateDatasetNode.d.ts +13 -0
- package/dist/types/model/nodes/CronNode.d.ts +34 -0
- package/dist/types/model/nodes/DatasetNearestNeigborsNode.d.ts +19 -0
- package/dist/types/model/nodes/DelayNode.d.ts +20 -0
- package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +28 -0
- package/dist/types/model/nodes/DestructureNode.d.ts +19 -0
- package/dist/types/model/nodes/DocumentNode.d.ts +28 -0
- package/dist/types/model/nodes/EvaluateNode.d.ts +19 -0
- package/dist/types/model/nodes/ExpressionNode.d.ts +21 -0
- package/dist/types/model/nodes/ExternalCallNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractJsonNode.d.ts +13 -0
- package/dist/types/model/nodes/ExtractMarkdownCodeBlocksNode.d.ts +12 -0
- package/dist/types/model/nodes/ExtractObjectPathNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractRegexNode.d.ts +22 -0
- package/dist/types/model/nodes/ExtractYamlNode.d.ts +21 -0
- package/dist/types/model/nodes/FilterNode.d.ts +13 -0
- package/dist/types/model/nodes/GetAllDatasetsNode.d.ts +14 -0
- package/dist/types/model/nodes/GetDatasetRowNode.d.ts +19 -0
- package/dist/types/model/nodes/GetEmbeddingNode.d.ts +24 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +29 -0
- package/dist/types/model/nodes/GraphInputNode.d.ts +24 -0
- package/dist/types/model/nodes/GraphOutputNode.d.ts +22 -0
- package/dist/types/model/nodes/GraphReferenceNode.d.ts +22 -0
- package/dist/types/model/nodes/HashNode.d.ts +17 -0
- package/dist/types/model/nodes/HttpCallNode.d.ts +32 -0
- package/dist/types/model/nodes/IfElseNode.d.ts +18 -0
- package/dist/types/model/nodes/IfNode.d.ts +17 -0
- package/dist/types/model/nodes/ImageNode.d.ts +20 -0
- package/dist/types/model/nodes/JSFilterNode.d.ts +19 -0
- package/dist/types/model/nodes/JSMapNode.d.ts +19 -0
- package/dist/types/model/nodes/JoinNode.d.ts +21 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +20 -0
- package/dist/types/model/nodes/ListGraphsNode.d.ts +14 -0
- package/dist/types/model/nodes/LoadDatasetNode.d.ts +17 -0
- package/dist/types/model/nodes/LoopControllerNode.d.ts +20 -0
- package/dist/types/model/nodes/LoopUntilNode.d.ts +32 -0
- package/dist/types/model/nodes/MCPDiscoveryNode.d.ts +9 -0
- package/dist/types/model/nodes/MCPGetPromptNode.d.ts +23 -0
- package/dist/types/model/nodes/MCPToolCallNode.d.ts +26 -0
- package/dist/types/model/nodes/MatchNode.d.ts +20 -0
- package/dist/types/model/nodes/NumberNode.d.ts +21 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +19 -0
- package/dist/types/model/nodes/PassthroughNode.d.ts +14 -0
- package/dist/types/model/nodes/PlayAudioNode.d.ts +15 -0
- package/dist/types/model/nodes/PopNode.d.ts +19 -0
- package/dist/types/model/nodes/PromptNode.d.ts +25 -0
- package/dist/types/model/nodes/RaceInputsNode.d.ts +16 -0
- package/dist/types/model/nodes/RaiseEventNode.d.ts +22 -0
- package/dist/types/model/nodes/RandomNumberNode.d.ts +23 -0
- package/dist/types/model/nodes/ReadAllFilesNode.d.ts +30 -0
- package/dist/types/model/nodes/ReadDirectoryNode.d.ts +30 -0
- package/dist/types/model/nodes/ReadFileNode.d.ts +23 -0
- package/dist/types/model/nodes/ReferencedGraphAliasNode.d.ts +31 -0
- package/dist/types/model/nodes/ReplaceDatasetNode.d.ts +21 -0
- package/dist/types/model/nodes/SetGlobalNode.d.ts +23 -0
- package/dist/types/model/nodes/ShuffleNode.d.ts +12 -0
- package/dist/types/model/nodes/SliceNode.d.ts +22 -0
- package/dist/types/model/nodes/SplitNode.d.ts +19 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +29 -0
- package/dist/types/model/nodes/TextNode.d.ts +19 -0
- package/dist/types/model/nodes/ToJsonNode.d.ts +18 -0
- package/dist/types/model/nodes/ToMarkdownTableNode.d.ts +19 -0
- package/dist/types/model/nodes/ToTreeNode.d.ts +21 -0
- package/dist/types/model/nodes/ToYamlNode.d.ts +13 -0
- package/dist/types/model/nodes/ToolNode.d.ts +25 -0
- package/dist/types/model/nodes/TrimChatMessagesNode.d.ts +20 -0
- package/dist/types/model/nodes/URLReferenceNode.d.ts +19 -0
- package/dist/types/model/nodes/UserInputNode.d.ts +20 -0
- package/dist/types/model/nodes/VectorNearestNeighborsNode.d.ts +24 -0
- package/dist/types/model/nodes/VectorStoreNode.d.ts +22 -0
- package/dist/types/model/nodes/WaitForEventNode.d.ts +21 -0
- package/dist/types/model/nodes/codeNodeErrorDiagnostics.d.ts +9 -0
- package/dist/types/model/nodes/jsListCallbackHelpers.d.ts +23 -0
- package/dist/types/model/nodes/jsValueInterpolation.d.ts +11 -0
- package/dist/types/model/nodes/toolCallDelegation.d.ts +29 -0
- package/dist/types/native/BaseDir.d.ts +29 -0
- package/dist/types/native/BrowserNativeApi.d.ts +9 -0
- package/dist/types/native/NativeApi.d.ts +17 -0
- package/dist/types/plugins/anthropic/anthropic.d.ts +315 -0
- package/dist/types/plugins/anthropic/fetchEventSource.d.ts +11 -0
- package/dist/types/plugins/anthropic/index.d.ts +2 -0
- package/dist/types/plugins/anthropic/nodes/ChatAnthropicNode.d.ts +40 -0
- package/dist/types/plugins/anthropic/plugin.d.ts +2 -0
- package/dist/types/plugins/assemblyAi/LemurActionItemsNode.d.ts +6 -0
- package/dist/types/plugins/assemblyAi/LemurQaNode.d.ts +22 -0
- package/dist/types/plugins/assemblyAi/LemurSummaryNode.d.ts +8 -0
- package/dist/types/plugins/assemblyAi/LemurTaskNode.d.ts +8 -0
- package/dist/types/plugins/assemblyAi/TranscribeAudioNode.d.ts +7 -0
- package/dist/types/plugins/assemblyAi/index.d.ts +2 -0
- package/dist/types/plugins/assemblyAi/lemurHelpers.d.ts +67 -0
- package/dist/types/plugins/assemblyAi/plugin.d.ts +2 -0
- package/dist/types/plugins/autoevals/AutoEvalsNode.d.ts +8 -0
- package/dist/types/plugins/autoevals/index.d.ts +2 -0
- package/dist/types/plugins/autoevals/plugin.d.ts +2 -0
- package/dist/types/plugins/gentrace/index.d.ts +2 -0
- package/dist/types/plugins/gentrace/plugin.d.ts +10 -0
- package/dist/types/plugins/google/google.d.ts +129 -0
- package/dist/types/plugins/google/index.d.ts +2 -0
- package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +35 -0
- package/dist/types/plugins/google/plugin.d.ts +2 -0
- package/dist/types/plugins/huggingface/index.d.ts +2 -0
- package/dist/types/plugins/huggingface/nodes/ChatHuggingFace.d.ts +24 -0
- package/dist/types/plugins/huggingface/nodes/TextToImageHuggingFace.d.ts +20 -0
- package/dist/types/plugins/huggingface/plugin.d.ts +2 -0
- package/dist/types/plugins/openai/handleOpenaiError.d.ts +1 -0
- package/dist/types/plugins/openai/index.d.ts +2 -0
- package/dist/types/plugins/openai/nodes/AttachAssistantFileNode.d.ts +10 -0
- package/dist/types/plugins/openai/nodes/CreateAssistantNode.d.ts +26 -0
- package/dist/types/plugins/openai/nodes/CreateThreadMessageNode.d.ts +15 -0
- package/dist/types/plugins/openai/nodes/CreateThreadNode.d.ts +13 -0
- package/dist/types/plugins/openai/nodes/DeleteAssistantNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/DeleteThreadNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetAssistantNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetOpenAIFileNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/GetThreadNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/ListAssistantsNode.d.ts +14 -0
- package/dist/types/plugins/openai/nodes/ListOpenAIFilesNode.d.ts +8 -0
- package/dist/types/plugins/openai/nodes/ListThreadMessagesNode.d.ts +16 -0
- package/dist/types/plugins/openai/nodes/RunThreadNode.d.ts +28 -0
- package/dist/types/plugins/openai/nodes/ThreadMessageNode.d.ts +14 -0
- package/dist/types/plugins/openai/nodes/UploadFileNode.d.ts +7 -0
- package/dist/types/plugins/openai/plugin.d.ts +2 -0
- package/dist/types/plugins/pinecone/PineconeVectorDatabase.d.ts +9 -0
- package/dist/types/plugins/pinecone/index.d.ts +2 -0
- package/dist/types/plugins/pinecone/plugin.d.ts +2 -0
- package/dist/types/plugins.d.ts +22 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +27 -0
- package/dist/types/recording/RecordedEvents.d.ts +114 -0
- package/dist/types/utils/assertNever.d.ts +1 -0
- package/dist/types/utils/base64.d.ts +3 -0
- package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +5 -0
- package/dist/types/utils/coerceType.d.ts +6 -0
- package/dist/types/utils/compatibility.d.ts +3 -0
- package/dist/types/utils/copyToClipboard.d.ts +1 -0
- package/dist/types/utils/defaults.d.ts +2 -0
- package/dist/types/utils/emitDetached.d.ts +11 -0
- package/dist/types/utils/errors.d.ts +2 -0
- package/dist/types/utils/expectType.d.ts +3 -0
- package/dist/types/utils/fetchEventSource.d.ts +12 -0
- package/dist/types/utils/genericUtilFunctions.d.ts +21 -0
- package/dist/types/utils/getPluginConfig.d.ts +2 -0
- package/dist/types/utils/handleEscapeCharacters.d.ts +2 -0
- package/dist/types/utils/index.d.ts +17 -0
- package/dist/types/utils/inputs.d.ts +3 -0
- package/dist/types/utils/interpolation.d.ts +26 -0
- package/dist/types/utils/misc.d.ts +1 -0
- package/dist/types/utils/newId.d.ts +1 -0
- package/dist/types/utils/openai.d.ts +784 -0
- package/dist/types/utils/orderedStringPortIds.d.ts +10 -0
- package/dist/types/utils/outputs.d.ts +3 -0
- package/dist/types/utils/pQueueCompat.d.ts +10 -0
- package/dist/types/utils/paths.d.ts +8 -0
- package/dist/types/utils/providerStreamParsing.d.ts +1 -0
- package/dist/types/utils/runtimeLogging.d.ts +10 -0
- package/dist/types/utils/serialization/serialization.d.ts +12 -0
- package/dist/types/utils/serialization/serializationHelpers.d.ts +27 -0
- package/dist/types/utils/serialization/serializationUtils.d.ts +16 -0
- package/dist/types/utils/serialization/serialization_v1.d.ts +3 -0
- package/dist/types/utils/serialization/serialization_v2.d.ts +3 -0
- package/dist/types/utils/serialization/serialization_v3.d.ts +19 -0
- package/dist/types/utils/serialization/serialization_v4.d.ts +9 -0
- package/dist/types/utils/symbols.d.ts +3 -0
- package/dist/types/utils/time.d.ts +22 -0
- package/dist/types/utils/typeSafety.d.ts +37 -0
- package/dist/types/vendor/fnv1a.d.ts +9 -0
- package/package.json +77 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Opaque } from 'type-fest';
|
|
2
|
+
import { type Settings, type NativeApi, type Project, type DataValue, type ExternalFunction, type Outputs, type GraphId, type GraphProcessor, type ScalarOrArrayDataValue, type DatasetProvider, type ChartNode, type NodeId, type AttachedNodeData, type AudioProvider, type StringArrayDataValue, type ProjectId, type MCPProvider } from '../index.js';
|
|
3
|
+
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
4
|
+
import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
5
|
+
import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
|
|
6
|
+
export type ProcessContext = {
|
|
7
|
+
settings: Settings;
|
|
8
|
+
nativeApi?: NativeApi;
|
|
9
|
+
/** Sets the dataset provider to be used for all dataset node calls. */
|
|
10
|
+
datasetProvider?: DatasetProvider;
|
|
11
|
+
/** Provider for all MCP node functionality */
|
|
12
|
+
mcpProvider?: MCPProvider;
|
|
13
|
+
/** The provider responsible for being able to play audio. Undefined if unsupported in this context. */
|
|
14
|
+
audioProvider?: AudioProvider;
|
|
15
|
+
/** The tokenizer that will be used for all nodes. */
|
|
16
|
+
tokenizer: Tokenizer;
|
|
17
|
+
/** The provider for running arbitrary code in the Code Node. */
|
|
18
|
+
codeRunner?: CodeRunner;
|
|
19
|
+
/** The loader for loading project references. */
|
|
20
|
+
projectReferenceLoader?: ProjectReferenceLoader;
|
|
21
|
+
/** The path to the current project. Required if project references are being used. */
|
|
22
|
+
projectPath?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Optional editor-owned cache that can outlive a single graph run while the app is open.
|
|
25
|
+
* Runtime/library callers normally omit this; editor-only nodes/features can opt into it.
|
|
26
|
+
*/
|
|
27
|
+
editorExecutionCache?: Map<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* If implemented, chat nodes will first call this to resolve their configured endpoint to a final endpoint.
|
|
30
|
+
* You can use this for adding auth headers, or to load balance between multiple endpoints.
|
|
31
|
+
*/
|
|
32
|
+
getChatNodeEndpoint?: (configuredEndpoint: string, configuredModel: string) => ChatNodeEndpointInfo | Promise<ChatNodeEndpointInfo>;
|
|
33
|
+
};
|
|
34
|
+
export type ChatNodeEndpointInfo = {
|
|
35
|
+
endpoint: string;
|
|
36
|
+
headers: Record<string, string>;
|
|
37
|
+
};
|
|
38
|
+
export type ProcessId = Opaque<string, 'ProcessId'>;
|
|
39
|
+
export type RootRunId = Opaque<string, 'RootRunId'>;
|
|
40
|
+
export type GraphRunId = Opaque<string, 'GraphRunId'>;
|
|
41
|
+
export type SubgraphExecutorMetadata = {
|
|
42
|
+
nodeId: NodeId;
|
|
43
|
+
parentGraphId: GraphId;
|
|
44
|
+
processId: ProcessId;
|
|
45
|
+
splitIndex?: number;
|
|
46
|
+
};
|
|
47
|
+
export type GraphExecutionMetadata = {
|
|
48
|
+
rootRunId: RootRunId;
|
|
49
|
+
graphRunId: GraphRunId;
|
|
50
|
+
graphId: GraphId;
|
|
51
|
+
parentGraphRunId?: GraphRunId;
|
|
52
|
+
executor?: SubgraphExecutorMetadata;
|
|
53
|
+
};
|
|
54
|
+
export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessContext & {
|
|
55
|
+
/** The executor that is running the current processor. */
|
|
56
|
+
executor: 'nodejs' | 'browser';
|
|
57
|
+
/** The project being executed. */
|
|
58
|
+
project: Project;
|
|
59
|
+
/** All referenced (and deep referenced) projects from the current project. */
|
|
60
|
+
referencedProjects: Record<ProjectId, Project>;
|
|
61
|
+
/** A signal that can be used when abort() is called on the GraphProcessor to abort the node's execution. */
|
|
62
|
+
signal: AbortSignal;
|
|
63
|
+
/** A unique ID for this specific execution of the node. */
|
|
64
|
+
processId: ProcessId;
|
|
65
|
+
/** Stable execution lineage for the current graph invocation. */
|
|
66
|
+
execution: GraphExecutionMetadata;
|
|
67
|
+
/** Context values that are accessible on graphs and all subgraphs. */
|
|
68
|
+
contextValues: Record<string, DataValue>;
|
|
69
|
+
/** Inputs that were passed to the curent graph. Used for GraphInputNode. */
|
|
70
|
+
graphInputs: Record<string, DataValue>;
|
|
71
|
+
/** Outputs from the graph. A GraphOutputNode will set these. */
|
|
72
|
+
graphOutputs: Record<string, DataValue>;
|
|
73
|
+
/** Stores the resolved output values of GraphInput nodes during execution, keyed by the node's data.id. */
|
|
74
|
+
graphInputNodeValues: Record<string, DataValue>;
|
|
75
|
+
/** The tokenizer to use to tokenize all strings.s */
|
|
76
|
+
tokenizer: Tokenizer;
|
|
77
|
+
/** The current node being executed. */
|
|
78
|
+
node: T;
|
|
79
|
+
/** For internal and advanced cases, gets the arbitrary data attached to the node during graph execution. */
|
|
80
|
+
attachedData: AttachedNodeData;
|
|
81
|
+
/** Raises a user event that can be listened for on the GraphProcessor. */
|
|
82
|
+
raiseEvent: (eventName: string, data: DataValue | undefined) => void;
|
|
83
|
+
waitEvent: (eventName: string) => Promise<DataValue | undefined>;
|
|
84
|
+
/** External functions that have been defined on the GraphProcessor (or its parent). */
|
|
85
|
+
externalFunctions: Record<string, ExternalFunction>;
|
|
86
|
+
/** Global cache shared by all nodes, is present for the entire execution of a graph (and shared in subgraphs). */
|
|
87
|
+
executionCache: Map<string, unknown>;
|
|
88
|
+
/** Call when the node has partial data but has not finished execution yet. */
|
|
89
|
+
onPartialOutputs?: (outputs: Outputs) => void;
|
|
90
|
+
/** Creates a subprocessor, for executing subgraphs. */
|
|
91
|
+
createSubProcessor: (subGraphId: GraphId | undefined, options?: {
|
|
92
|
+
signal?: AbortSignal;
|
|
93
|
+
project?: Project;
|
|
94
|
+
}) => GraphProcessor;
|
|
95
|
+
/** Like context, but variables that are set during the run of the graph and can be read during the graph. Shared among all graphs and subgraphs. */
|
|
96
|
+
getGlobal: (id: string) => ScalarOrArrayDataValue | undefined;
|
|
97
|
+
/** Like context, but variables that are set during the run of the graph and can be read during the graph. Shared among all graphs and subgraphs. */
|
|
98
|
+
setGlobal: (id: string, value: ScalarOrArrayDataValue) => void;
|
|
99
|
+
waitForGlobal: (id: string) => Promise<ScalarOrArrayDataValue>;
|
|
100
|
+
/** Logs to GraphProcessor's trace event. */
|
|
101
|
+
trace: (message: string) => void;
|
|
102
|
+
/** Aborts the current graph, if there is an error, the graph is error aborted, and if undefined, then it is simply early-exited. */
|
|
103
|
+
abortGraph: (error?: Error | string) => void;
|
|
104
|
+
/** Gets a string plugin config value from the settings, falling back to a specified environment variable if set. */
|
|
105
|
+
getPluginConfig(name: string): string | undefined;
|
|
106
|
+
/** Requests that the user input some text in response to the specified prompt. */
|
|
107
|
+
requestUserInput(inputs: string[], renderingType: 'text' | 'markdown'): Promise<StringArrayDataValue>;
|
|
108
|
+
/** The object used for running arbitrary code with the Code Node. */
|
|
109
|
+
codeRunner: CodeRunner;
|
|
110
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DataValue, ScalarOrArrayDataValue, StringArrayDataValue } from './DataValue.js';
|
|
2
|
+
import type { GraphExecutionMetadata, InternalProcessContext, ProcessContext, ProcessId } from './ProcessContext.js';
|
|
3
|
+
import type { ChartNode } from './NodeBase.js';
|
|
4
|
+
import type { GraphId } from './NodeGraph.js';
|
|
5
|
+
import type { Project, ProjectId } from './Project.js';
|
|
6
|
+
import type { AttachedNodeData, ExternalFunction, Outputs } from './GraphProcessor.js';
|
|
7
|
+
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
8
|
+
import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
9
|
+
export declare function buildNodeProcessContext(options: {
|
|
10
|
+
attachedData: AttachedNodeData;
|
|
11
|
+
codeRunner: CodeRunner;
|
|
12
|
+
context: ProcessContext;
|
|
13
|
+
contextValues: Record<string, DataValue>;
|
|
14
|
+
createSubProcessor: (subGraphId: GraphId | undefined, options?: {
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
project?: Project;
|
|
17
|
+
}) => unknown;
|
|
18
|
+
execution: GraphExecutionMetadata;
|
|
19
|
+
executionCache: Map<string, unknown>;
|
|
20
|
+
executor: 'nodejs' | 'browser';
|
|
21
|
+
externalFunctions: Record<string, ExternalFunction>;
|
|
22
|
+
getGlobal: (id: string) => ScalarOrArrayDataValue | undefined;
|
|
23
|
+
getPluginConfig: (name: string) => string | undefined;
|
|
24
|
+
graphInputNodeValues: Record<string, DataValue>;
|
|
25
|
+
graphInputs: Record<string, DataValue>;
|
|
26
|
+
graphOutputs: Record<string, DataValue>;
|
|
27
|
+
loadedProjects: Record<ProjectId, Project>;
|
|
28
|
+
node: ChartNode;
|
|
29
|
+
nodeAbortController: AbortController;
|
|
30
|
+
onPartialOutputs: (partialOutputs: Outputs) => void;
|
|
31
|
+
processId: ProcessId;
|
|
32
|
+
project: Project;
|
|
33
|
+
raiseEvent: (event: string, data: DataValue | undefined) => void;
|
|
34
|
+
requestUserInput: (inputStrings: string[], renderingType: 'text' | 'markdown') => Promise<StringArrayDataValue>;
|
|
35
|
+
setGlobal: (id: string, value: ScalarOrArrayDataValue) => void;
|
|
36
|
+
tokenizer: Tokenizer;
|
|
37
|
+
trace: (message: string) => void;
|
|
38
|
+
waitEvent: (event: string) => Promise<DataValue | undefined>;
|
|
39
|
+
waitForGlobal: (id: string) => Promise<ScalarOrArrayDataValue>;
|
|
40
|
+
abortGraph: (error?: Error | string) => void;
|
|
41
|
+
}): InternalProcessContext;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Opaque } from 'type-fest';
|
|
2
|
+
import { type GraphId, type NodeGraph } from './NodeGraph.js';
|
|
3
|
+
import { type PluginLoadSpec } from './PluginLoadSpec.js';
|
|
4
|
+
import type { MCP } from '../integrations/mcp/MCPProvider.js';
|
|
5
|
+
export type ProjectId = Opaque<string, 'ProjectId'>;
|
|
6
|
+
export type DataId = Opaque<string, 'DataId'>;
|
|
7
|
+
export type Project = {
|
|
8
|
+
metadata: ProjectMetadata;
|
|
9
|
+
plugins?: PluginLoadSpec[];
|
|
10
|
+
graphs: Record<GraphId, NodeGraph>;
|
|
11
|
+
data?: Record<DataId, string>;
|
|
12
|
+
/** References to other projects. */
|
|
13
|
+
references?: ProjectReference[];
|
|
14
|
+
};
|
|
15
|
+
export type ProjectMetadata = {
|
|
16
|
+
id: ProjectId;
|
|
17
|
+
title: string;
|
|
18
|
+
description: string;
|
|
19
|
+
mainGraphId?: GraphId;
|
|
20
|
+
path?: string;
|
|
21
|
+
mcpServer?: MCP.Config;
|
|
22
|
+
};
|
|
23
|
+
/** A reference to another project file. Project references cannot be cyclic. */
|
|
24
|
+
export type ProjectReference = {
|
|
25
|
+
/** The ID of the project being referenced. */
|
|
26
|
+
id: ProjectId;
|
|
27
|
+
/** Paths to use to attempt to resolve the reference. */
|
|
28
|
+
hintPaths?: string[];
|
|
29
|
+
/** A human-readable title for the project. */
|
|
30
|
+
title?: string;
|
|
31
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ExecutionRecorder } from '../recording/ExecutionRecorder.js';
|
|
2
|
+
import type { DataValue } from './DataValue.js';
|
|
3
|
+
import type { NodeId, PortId } from './NodeBase.js';
|
|
4
|
+
import type { ProcessEvents } from './GraphProcessor.js';
|
|
5
|
+
import type Emittery from 'emittery';
|
|
6
|
+
import type { Project } from './Project.js';
|
|
7
|
+
type Outputs = Record<PortId, DataValue | undefined>;
|
|
8
|
+
type GraphOutputs = Record<string, DataValue>;
|
|
9
|
+
type GraphInputs = Record<string, DataValue>;
|
|
10
|
+
export declare function replayExecutionRecording(options: {
|
|
11
|
+
emitter: Emittery<ProcessEvents>;
|
|
12
|
+
erroredNodes: Map<NodeId, Error | string>;
|
|
13
|
+
graphInputs: GraphInputs;
|
|
14
|
+
graphOutputs: GraphOutputs;
|
|
15
|
+
project: Project;
|
|
16
|
+
recorder: ExecutionRecorder;
|
|
17
|
+
recordingPlaybackChatLatency: number;
|
|
18
|
+
setContextValues: (contextValues: Record<string, DataValue>) => void;
|
|
19
|
+
setGraphInputs: (inputs: GraphInputs) => void;
|
|
20
|
+
setGraphOutputs: (outputs: GraphOutputs) => void;
|
|
21
|
+
setRunning: (running: boolean) => void;
|
|
22
|
+
visitedNodes: Set<NodeId>;
|
|
23
|
+
waitUntilUnpaused: () => Promise<void>;
|
|
24
|
+
nodeResults: Map<NodeId, Outputs>;
|
|
25
|
+
isAborted: () => boolean;
|
|
26
|
+
}): Promise<GraphOutputs>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry assembly helpers.
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates the three explicit operations on a node registry:
|
|
5
|
+
* 1. createBuiltInRegistry - fresh registry with only built-in nodes
|
|
6
|
+
* 2. registerProjectPlugins - extend a registry with loaded plugins
|
|
7
|
+
* 3. assembleRegistry - 1 + 2 in one step
|
|
8
|
+
*
|
|
9
|
+
* Both the app (useProjectPlugins) and the sidecar (executor.mts) share
|
|
10
|
+
* this flow. Plugin *loading* is environment-specific, so callers supply
|
|
11
|
+
* a `loadPlugin` callback that resolves a PluginLoadSpec into a RivetPlugin.
|
|
12
|
+
*/
|
|
13
|
+
import { NodeRegistration } from './NodeRegistration.js';
|
|
14
|
+
import type { RivetPlugin } from './RivetPlugin.js';
|
|
15
|
+
import type { PluginLoadSpec } from './PluginLoadSpec.js';
|
|
16
|
+
/** Create a fresh registry containing only built-in nodes (no plugins). */
|
|
17
|
+
export declare function createBuiltInRegistry(): NodeRegistration<any, any>;
|
|
18
|
+
export type PluginLoadResult = {
|
|
19
|
+
loaded: RivetPlugin[];
|
|
20
|
+
failed: {
|
|
21
|
+
id: string;
|
|
22
|
+
error: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Register an array of already-loaded plugins into a registry.
|
|
27
|
+
* Returns the count of successfully registered plugins.
|
|
28
|
+
*/
|
|
29
|
+
export declare function registerPluginsIntoRegistry(registry: NodeRegistration<any, any>, plugins: RivetPlugin[]): void;
|
|
30
|
+
/**
|
|
31
|
+
* Assemble a complete registry: built-in nodes + project plugins.
|
|
32
|
+
*
|
|
33
|
+
* `loadPlugin` is called for each spec and must return a `RivetPlugin`.
|
|
34
|
+
* If loading or registration throws, the spec is recorded as failed and
|
|
35
|
+
* assembly continues.
|
|
36
|
+
*
|
|
37
|
+
* Returns the assembled registry plus load results.
|
|
38
|
+
*/
|
|
39
|
+
export declare function assembleRegistry(specs: PluginLoadSpec[], loadPlugin: (spec: PluginLoadSpec) => Promise<RivetPlugin>): Promise<{
|
|
40
|
+
registry: NodeRegistration<any, any>;
|
|
41
|
+
results: PluginLoadResult;
|
|
42
|
+
}>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ChartNode } from './NodeBase.js';
|
|
2
|
+
import type { PluginNodeDefinition } from './NodeDefinition.js';
|
|
3
|
+
export type RivetPlugin = {
|
|
4
|
+
/** The unique identifier of the plugin. Should be unique across all plugins. */
|
|
5
|
+
id: string;
|
|
6
|
+
/** The display name of the plugin - what is shown in the UI fr the plugin. */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** Registers new nodes for the plugin to add. */
|
|
9
|
+
register?: (register: <T extends ChartNode>(definition: PluginNodeDefinition<T>) => void) => void;
|
|
10
|
+
/** The available configuration items and their specification, for configuring a plugin in the UI. */
|
|
11
|
+
configSpec?: RivetPluginConfigSpecs;
|
|
12
|
+
configPage?: RivetPluginConfigPage;
|
|
13
|
+
/** Defines additional context menu groups that the plugin adds. */
|
|
14
|
+
contextMenuGroups?: Array<{
|
|
15
|
+
id: string;
|
|
16
|
+
label: string;
|
|
17
|
+
}>;
|
|
18
|
+
};
|
|
19
|
+
export type RivetPluginConfigSpecs = Record<string, PluginConfigurationSpec>;
|
|
20
|
+
export type RivetPluginConfigPage = {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
description?: string;
|
|
24
|
+
};
|
|
25
|
+
export type PluginConfigurationSpecBase<T> = {
|
|
26
|
+
/** The type of the config value, how it should show as an editor in the UI. */
|
|
27
|
+
type: string;
|
|
28
|
+
/** The default value of the config item if unset. */
|
|
29
|
+
default?: T;
|
|
30
|
+
/** A description to show in the UI for the config setting. */
|
|
31
|
+
description?: string;
|
|
32
|
+
/** The label of the setting in the UI. */
|
|
33
|
+
label: string;
|
|
34
|
+
};
|
|
35
|
+
export type StringPluginConfigurationSpec = {
|
|
36
|
+
type: 'string';
|
|
37
|
+
default?: string;
|
|
38
|
+
label: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
pullEnvironmentVariable?: true | string;
|
|
41
|
+
helperText?: string;
|
|
42
|
+
};
|
|
43
|
+
export type SecretPluginConfigurationSpec = {
|
|
44
|
+
type: 'secret';
|
|
45
|
+
default?: string;
|
|
46
|
+
label: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
pullEnvironmentVariable?: true | string;
|
|
49
|
+
helperText?: string;
|
|
50
|
+
};
|
|
51
|
+
export type PluginConfigurationSpec = StringPluginConfigurationSpec | SecretPluginConfigurationSpec | PluginConfigurationSpecBase<number> | PluginConfigurationSpecBase<boolean>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ChartNode, type DatasetProvider, type NativeApi, type NodeGraph, type Project, type ProjectId, type Settings } from '../index.js';
|
|
2
|
+
/** Context accessible to UI functions such as getEditors() and getBody(). */
|
|
3
|
+
export type RivetUIContext = {
|
|
4
|
+
/** The settings configured in the UI. */
|
|
5
|
+
settings: Settings;
|
|
6
|
+
/** The selected executor. */
|
|
7
|
+
executor: 'nodejs' | 'browser';
|
|
8
|
+
/** The provider that can control datasets. */
|
|
9
|
+
datasetProvider: DatasetProvider;
|
|
10
|
+
/** The current project loaded in the UI. */
|
|
11
|
+
project: Project;
|
|
12
|
+
/** Other projects referenced by the current project. */
|
|
13
|
+
referencedProjects: Record<ProjectId, Project>;
|
|
14
|
+
/** The current graph selected in the UI. */
|
|
15
|
+
graph?: NodeGraph;
|
|
16
|
+
/** The current node selected in the UI. */
|
|
17
|
+
node?: ChartNode;
|
|
18
|
+
/** The configured native API. */
|
|
19
|
+
nativeApi: NativeApi;
|
|
20
|
+
/** Gets a string plugin config value from the settings, falling back to a specified environment variable if set. */
|
|
21
|
+
getPluginConfig(name: string): string | undefined;
|
|
22
|
+
/** Best-effort UI-side model discovery for provider-backed chat nodes. */
|
|
23
|
+
getChatModelOptions?: (provider: 'openai' | 'anthropic' | 'google') => Promise<{
|
|
24
|
+
value: string;
|
|
25
|
+
label: string;
|
|
26
|
+
}[]>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Settings<PluginSettings = Record<string, Record<string, unknown>>> {
|
|
2
|
+
recordingPlaybackLatency?: number;
|
|
3
|
+
/** Apply predefined colors to supported newly added node types in the editor UI. */
|
|
4
|
+
defaultNodeColors?: boolean;
|
|
5
|
+
/** Automatically open the node settings panel after creating a new node in the editor UI. */
|
|
6
|
+
openNodeSettingsOnCreate?: boolean;
|
|
7
|
+
/** Configurable settings that a plugin can get and set. Settings can be available in the settings modal and are stored */
|
|
8
|
+
pluginSettings?: PluginSettings;
|
|
9
|
+
/** A plugin can request environment variables to configure itself. Those can be populated here. */
|
|
10
|
+
pluginEnv?: {
|
|
11
|
+
[key: string]: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
openAiKey?: string;
|
|
14
|
+
openAiOrganization?: string;
|
|
15
|
+
openAiEndpoint?: string;
|
|
16
|
+
/** Timeout in milliseconds before retrying a chat node call. */
|
|
17
|
+
chatNodeTimeout?: number;
|
|
18
|
+
chatNodeHeaders?: Record<string, string>;
|
|
19
|
+
throttleChatNode?: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ChartNode } from './NodeBase.js';
|
|
2
|
+
import type { ProcessId } from './ProcessContext.js';
|
|
3
|
+
import type { Inputs, Outputs } from './GraphProcessor.js';
|
|
4
|
+
export type SplitRunDeps = {
|
|
5
|
+
getInputValues(node: ChartNode): Inputs;
|
|
6
|
+
isExcludedDueToControlFlow(node: ChartNode, inputValues: Inputs, processId: ProcessId): boolean;
|
|
7
|
+
processNodeWithInputData(node: ChartNode, inputs: Inputs, index: number, processId: ProcessId, partialOutput?: (node: ChartNode, partialOutputs: Outputs, index: number) => void): Promise<Outputs>;
|
|
8
|
+
splitRunConcurrency: number;
|
|
9
|
+
accumulateCost(output: Outputs): void;
|
|
10
|
+
setNodeResults(nodeId: ChartNode['id'], outputs: Outputs): void;
|
|
11
|
+
markNodeVisited(nodeId: ChartNode['id']): void;
|
|
12
|
+
nodeErrored(node: ChartNode, error: unknown, processId: ProcessId): void;
|
|
13
|
+
isAborted(): boolean;
|
|
14
|
+
emit(event: 'nodeStart', data: {
|
|
15
|
+
node: ChartNode;
|
|
16
|
+
inputs: Inputs;
|
|
17
|
+
processId: ProcessId;
|
|
18
|
+
}): void;
|
|
19
|
+
emit(event: 'nodeFinish', data: {
|
|
20
|
+
node: ChartNode;
|
|
21
|
+
outputs: Outputs;
|
|
22
|
+
processId: ProcessId;
|
|
23
|
+
}): void;
|
|
24
|
+
emit(event: 'partialOutput', data: {
|
|
25
|
+
node: ChartNode;
|
|
26
|
+
outputs: Outputs;
|
|
27
|
+
index: number;
|
|
28
|
+
processId: ProcessId;
|
|
29
|
+
}): void;
|
|
30
|
+
};
|
|
31
|
+
export declare function processSplitRunNode(node: ChartNode, processId: ProcessId, deps: SplitRunDeps): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type Emittery from 'emittery';
|
|
2
|
+
import type { GraphProcessor, ProcessEvents } from './GraphProcessor.js';
|
|
3
|
+
export declare function wireSubprocessorEvents(processor: GraphProcessor, parentEmitter: Emittery<ProcessEvents>, parentState: {
|
|
4
|
+
isPaused: () => boolean;
|
|
5
|
+
pause: () => void;
|
|
6
|
+
resume: () => void;
|
|
7
|
+
}): void;
|
|
8
|
+
export declare function wireSubprocessorLifecycle(processor: GraphProcessor, options: {
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
parentAbortSignal: AbortSignal;
|
|
11
|
+
onParentPause: (listener: () => void) => () => void;
|
|
12
|
+
onParentResume: (listener: () => void) => () => void;
|
|
13
|
+
}): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LanguageModelUsage, TextStreamPart, ToolSet } from 'ai';
|
|
2
|
+
import type { StreamedFunctionCall } from './streamChatResponse.js';
|
|
3
|
+
export type AiSdkStreamResult = {
|
|
4
|
+
responseText: string;
|
|
5
|
+
functionCalls: StreamedFunctionCall[];
|
|
6
|
+
usage: LanguageModelUsage | undefined;
|
|
7
|
+
reasoning: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function consumeAiSdkStream(fullStream: AsyncIterable<TextStreamPart<ToolSet>>, onPartialOutputs: (text: string, functionCalls: StreamedFunctionCall[]) => void): Promise<AiSdkStreamResult>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ChatCompletionChunkUsage } from '../../utils/openai.js';
|
|
2
|
+
export type ChatModelCost = {
|
|
3
|
+
prompt: number;
|
|
4
|
+
completion: number;
|
|
5
|
+
audioPrompt?: number;
|
|
6
|
+
audioCompletion?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare function getCostForTokens(tokenCount: number, costPerThousand: number): number;
|
|
9
|
+
export declare function calculatePromptAndCompletionCost(inputTokenCount: number, outputTokenCount: number, costs: Pick<ChatModelCost, 'prompt' | 'completion'>): {
|
|
10
|
+
promptCost: number;
|
|
11
|
+
completionCost: number;
|
|
12
|
+
totalCost: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function calculateAudioUsageCost(usage: {
|
|
15
|
+
prompt_tokens_details: {
|
|
16
|
+
text_tokens: number;
|
|
17
|
+
audio_tokens: number;
|
|
18
|
+
};
|
|
19
|
+
completion_tokens_details: {
|
|
20
|
+
text_tokens: number;
|
|
21
|
+
audio_tokens: number;
|
|
22
|
+
};
|
|
23
|
+
}, costs: ChatModelCost): {
|
|
24
|
+
promptCost: number;
|
|
25
|
+
completionCost: number;
|
|
26
|
+
audioPromptCost: number;
|
|
27
|
+
audioCompletionCost: number;
|
|
28
|
+
totalCost: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function getOutputTokensForCostCalculation(usage: ChatCompletionChunkUsage | undefined, fallbackTokenCount: number): number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type ChatMessage } from '../DataValue.js';
|
|
2
|
+
export declare function coercePromptToChatMessages(prompt: unknown, options?: {
|
|
3
|
+
requirePrompt?: boolean;
|
|
4
|
+
}): ChatMessage[];
|
|
5
|
+
export declare function prependSystemPrompt(messages: ChatMessage[], systemPrompt: unknown): ChatMessage[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ChatCompletionOptions, ChatCompletionTool } from '../../utils/openai.js';
|
|
2
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
3
|
+
import type { ChatNodeData } from '../nodes/ChatNodeBase.js';
|
|
4
|
+
export declare function resolveChatToolChoice(data: ChatNodeData, inputs: Inputs): ChatCompletionOptions['tool_choice'];
|
|
5
|
+
export declare function resolveChatResponseSchema(inputs: Inputs): object | undefined;
|
|
6
|
+
export declare function resolveOpenAIResponseFormat(data: ChatNodeData, inputs: Inputs): {
|
|
7
|
+
readonly type: "json_object";
|
|
8
|
+
json_schema?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
type: "json_schema";
|
|
11
|
+
json_schema: {
|
|
12
|
+
name: string;
|
|
13
|
+
strict: boolean;
|
|
14
|
+
schema: object;
|
|
15
|
+
};
|
|
16
|
+
} | {
|
|
17
|
+
readonly type: "text";
|
|
18
|
+
json_schema?: undefined;
|
|
19
|
+
} | undefined;
|
|
20
|
+
export declare function resolveAdditionalHeaders(data: ChatNodeData, inputs: Inputs): Record<string, string>;
|
|
21
|
+
export declare function resolveAdditionalParameters(data: ChatNodeData, inputs: Inputs): Record<string, string | number>;
|
|
22
|
+
export declare function resolveChatTools(inputs: Inputs): ChatCompletionTool[];
|
|
23
|
+
export declare function resolvePredictionObject(data: ChatNodeData, inputs: Inputs): {
|
|
24
|
+
type: "content";
|
|
25
|
+
content: string;
|
|
26
|
+
} | {
|
|
27
|
+
type: "content";
|
|
28
|
+
content: {
|
|
29
|
+
type: string;
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
} | undefined;
|
|
33
|
+
export declare function resolveAudioAndModalities(data: ChatNodeData, inputs: Inputs): {
|
|
34
|
+
modalities: ("audio" | "text")[] | undefined;
|
|
35
|
+
audio: {
|
|
36
|
+
voice: string;
|
|
37
|
+
format: "wav" | "mp3" | "flac" | "opus" | "pcm16";
|
|
38
|
+
} | undefined;
|
|
39
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { Tokenizer, TokenizerCallInfo } from '../../integrations/Tokenizer.js';
|
|
2
|
+
import type { ChatCompletionChunk } from '../../utils/openai.js';
|
|
3
|
+
import type { ChatMessage } from '../DataValue.js';
|
|
4
|
+
import type { Outputs } from '../GraphProcessor.js';
|
|
5
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
6
|
+
export declare function applyOpenAINonStreamingResponse(params: {
|
|
7
|
+
response: {
|
|
8
|
+
choices: Array<{
|
|
9
|
+
message: {
|
|
10
|
+
content?: string | null;
|
|
11
|
+
audio?: {
|
|
12
|
+
data: string;
|
|
13
|
+
transcript: string;
|
|
14
|
+
} | null;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
usage?: {
|
|
18
|
+
prompt_tokens_details: {
|
|
19
|
+
text_tokens: number;
|
|
20
|
+
audio_tokens: number;
|
|
21
|
+
};
|
|
22
|
+
completion_tokens_details: {
|
|
23
|
+
text_tokens: number;
|
|
24
|
+
audio_tokens: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
output: Outputs;
|
|
29
|
+
messages: ChatMessage[];
|
|
30
|
+
isMultiResponse: boolean;
|
|
31
|
+
modalities: ('text' | 'audio')[] | undefined;
|
|
32
|
+
audioFormat: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16' | undefined;
|
|
33
|
+
modelCosts: {
|
|
34
|
+
prompt?: number;
|
|
35
|
+
completion?: number;
|
|
36
|
+
audioPrompt?: number;
|
|
37
|
+
audioCompletion?: number;
|
|
38
|
+
} | undefined;
|
|
39
|
+
durationMs: number;
|
|
40
|
+
}): Promise<void>;
|
|
41
|
+
export declare function applyOpenAIStreamingResponse(params: {
|
|
42
|
+
chunks: AsyncIterable<ChatCompletionChunk>;
|
|
43
|
+
output: Outputs;
|
|
44
|
+
messages: ChatMessage[];
|
|
45
|
+
isMultiResponse: boolean;
|
|
46
|
+
parallelFunctionCalling: boolean | undefined;
|
|
47
|
+
context: Pick<InternalProcessContext, 'onPartialOutputs' | 'settings'>;
|
|
48
|
+
tokenizer: Pick<Tokenizer, 'getTokenCountForString'>;
|
|
49
|
+
tokenizerInfo: TokenizerCallInfo;
|
|
50
|
+
inputTokenCount: number;
|
|
51
|
+
numberOfChoices: number | undefined;
|
|
52
|
+
useServerTokenCalculation: boolean | undefined;
|
|
53
|
+
modelCosts: {
|
|
54
|
+
prompt: number;
|
|
55
|
+
completion: number;
|
|
56
|
+
};
|
|
57
|
+
}): Promise<void>;
|
|
58
|
+
export declare function handleOpenAIRetryableFailure(params: {
|
|
59
|
+
originalError: unknown;
|
|
60
|
+
context: Pick<InternalProcessContext, 'signal' | 'trace' | 'onPartialOutputs'>;
|
|
61
|
+
}): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ChatMessage } from '../DataValue.js';
|
|
2
|
+
import type { Outputs } from '../GraphProcessor.js';
|
|
3
|
+
export type StreamedFunctionCall = {
|
|
4
|
+
type: 'function';
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
arguments: string;
|
|
8
|
+
lastParsedArguments?: unknown;
|
|
9
|
+
};
|
|
10
|
+
export type AssistantMessageFunctionCallMode = 'first' | 'only' | 'never';
|
|
11
|
+
type StreamedToolCallDelta = {
|
|
12
|
+
id?: string;
|
|
13
|
+
index: number;
|
|
14
|
+
function: {
|
|
15
|
+
name?: string;
|
|
16
|
+
arguments?: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function applyToolCallDeltas(functionCalls: StreamedFunctionCall[][], choiceIndex: number, toolCalls: StreamedToolCallDelta[]): void;
|
|
20
|
+
export declare function applyStreamedFunctionCallOutputs(output: Outputs, functionCalls: StreamedFunctionCall[][], isMultiResponse: boolean, parallelFunctionCalling: boolean | undefined): void;
|
|
21
|
+
export declare function createAssistantMessagesOutput(messages: ChatMessage[], response: string, functionCalls: StreamedFunctionCall[] | undefined, options?: {
|
|
22
|
+
functionCallMode?: AssistantMessageFunctionCallMode;
|
|
23
|
+
}): {
|
|
24
|
+
type: "chat-message[]";
|
|
25
|
+
value: ChatMessage[];
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Outputs } from '../GraphProcessor.js';
|
|
2
|
+
export declare function clampMaxTokensToModelLimit(output: Outputs, model: string, inputTokenCount: number, maxTokens: number, modelMaxTokens: number): number;
|
|
3
|
+
export declare function setRequestAndResponseTokenOutputs(output: Outputs, requestTokens: number, responseTokens: number): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Outputs } from '../GraphProcessor.js';
|
|
2
|
+
import type { ResolvedChatV2ProviderConfig } from './providerOptions.js';
|
|
3
|
+
import type { ChatV2Provider, ChatV2ProviderOptions, ChatV2ToolChoice } from './chatV2Types.js';
|
|
4
|
+
import type { LLMChatV2EditorCacheKeyParts, LLMChatV2NodeData } from './llmChatV2NodeData.js';
|
|
5
|
+
export declare function buildLLMChatV2EditorCacheKey(parts: LLMChatV2EditorCacheKeyParts): string;
|
|
6
|
+
export declare function cloneLLMChatV2EditorCacheOutputs(outputs: Outputs): Outputs;
|
|
7
|
+
export declare function resolveLLMChatV2EditorCache(params: {
|
|
8
|
+
apiKey: string | undefined;
|
|
9
|
+
data: LLMChatV2NodeData;
|
|
10
|
+
editorCache: Map<string, unknown> | undefined;
|
|
11
|
+
functions: unknown;
|
|
12
|
+
generationParameters: unknown;
|
|
13
|
+
modelId: string;
|
|
14
|
+
nodeId: LLMChatV2EditorCacheKeyParts['nodeId'];
|
|
15
|
+
prompt: unknown;
|
|
16
|
+
provider: ChatV2Provider;
|
|
17
|
+
providerConfig: ResolvedChatV2ProviderConfig;
|
|
18
|
+
providerOptions: ChatV2ProviderOptions | undefined;
|
|
19
|
+
responseFormatParameters: unknown;
|
|
20
|
+
systemPrompt: unknown;
|
|
21
|
+
toolChoice: ChatV2ToolChoice | undefined;
|
|
22
|
+
}): {
|
|
23
|
+
cacheKey: string | undefined;
|
|
24
|
+
cachedOutputs: Outputs | undefined;
|
|
25
|
+
};
|