@valerypopoff/rivet2-core 2.1.2 → 2.1.4
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 +3373 -1208
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/webAppRuntime.cjs +625 -0
- package/dist/cjs/webAppRuntime.cjs.map +7 -0
- package/dist/esm/api/createProcessor.js +3 -0
- package/dist/esm/api/processSettings.js +5 -0
- package/dist/esm/api/streaming.js +6 -0
- package/dist/esm/exports.js +7 -0
- package/dist/esm/integrations/mcp/MCPBase.js +92 -34
- package/dist/esm/model/GraphProcessor.js +35 -49
- package/dist/esm/model/GraphProgress.js +15 -0
- package/dist/esm/model/GraphRunLifecycle.js +67 -0
- package/dist/esm/model/MarkdownSanitizationPolicy.js +38 -0
- package/dist/esm/model/Nodes.js +3 -0
- package/dist/esm/model/ProcessContextBuilder.js +2 -1
- package/dist/esm/model/RecordingPlayer.js +10 -0
- package/dist/esm/model/SubprocessorBridge.js +1 -0
- package/dist/esm/model/UiGraph.js +181 -1
- package/dist/esm/model/UiGraphActionProtocol.js +122 -0
- package/dist/esm/model/UiGraphBindings.js +530 -0
- package/dist/esm/model/UiGraphBrowserRuntime.js +40 -0
- package/dist/esm/model/UiGraphNormalization.js +298 -0
- package/dist/esm/model/UiGraphRendererStyles.js +456 -6
- package/dist/esm/model/UiGraphRuntimeModel.js +371 -0
- package/dist/esm/model/UiGraphWebAppStatus.js +19 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +1 -1
- package/dist/esm/model/chat-v2/chatV2EditorCache.js +2 -2
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +35 -48
- package/dist/esm/model/chat-v2/chatV2ProviderProfile.js +98 -0
- package/dist/esm/model/chat-v2/chatV2RequestPlan.js +64 -0
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +11 -39
- package/dist/esm/model/chat-v2/index.js +2 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +1 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +31 -11
- package/dist/esm/model/chat-v2/llmChatV2NodeRuntime.js +21 -9
- package/dist/esm/model/chat-v2/providerOptions.js +9 -35
- package/dist/esm/model/nodes/ArrayNode.js +2 -13
- package/dist/esm/model/nodes/AssembleMessageNode.js +2 -13
- package/dist/esm/model/nodes/AssemblePromptNode.js +2 -13
- package/dist/esm/model/nodes/CoalesceNode.js +2 -15
- package/dist/esm/model/nodes/DelayNode.js +3 -14
- package/dist/esm/model/nodes/DidRunNode.js +2 -13
- package/dist/esm/model/nodes/JoinNode.js +2 -13
- package/dist/esm/model/nodes/LLMChatV2Node.js +3 -3
- package/dist/esm/model/nodes/LoopControllerNode.js +3 -14
- package/dist/esm/model/nodes/MCPDiscoveryNode.js +19 -90
- package/dist/esm/model/nodes/MCPGetPromptNode.js +11 -97
- package/dist/esm/model/nodes/MCPToolCallNode.js +11 -97
- package/dist/esm/model/nodes/PassthroughNode.js +3 -14
- package/dist/esm/model/nodes/RaceInputsNode.js +2 -13
- package/dist/esm/model/nodes/ReportProgressNode.js +57 -0
- package/dist/esm/model/nodes/variadicPortIndex.js +32 -0
- package/dist/esm/plugins/anthropic/anthropic.js +1 -1
- package/dist/esm/plugins/autoevals/AutoEvalsNode.js +3 -1
- package/dist/esm/plugins/gentrace/gentraceSdk.js +8 -0
- package/dist/esm/plugins/gentrace/plugin.js +5 -4
- package/dist/esm/plugins/google/google.js +9 -7
- package/dist/esm/recording/ExecutionRecorder.js +5 -0
- package/dist/esm/utils/fetchEventSource.js +16 -17
- package/dist/esm/utils/pQueueCompat.js +1 -1
- package/dist/esm/utils/serialization/serialization.js +4 -0
- package/dist/esm/utils/serialization/serializationUtils.js +16 -0
- package/dist/esm/utils/serialization/serialization_v4.js +5 -4
- package/dist/esm/webAppRuntime.js +4 -0
- package/dist/types/api/createProcessor.d.ts +1 -1
- package/dist/types/api/processSettings.d.ts +3 -4
- package/dist/types/api/streaming.d.ts +6 -0
- package/dist/types/exports.d.ts +7 -0
- package/dist/types/integrations/mcp/MCPBase.d.ts +26 -3
- package/dist/types/model/ExecutorProtocol.d.ts +7 -0
- package/dist/types/model/GraphProcessor.d.ts +7 -0
- package/dist/types/model/GraphProgress.d.ts +6 -0
- package/dist/types/model/GraphRunLifecycle.d.ts +22 -0
- package/dist/types/model/MarkdownSanitizationPolicy.d.ts +9 -0
- package/dist/types/model/Nodes.d.ts +3 -2
- package/dist/types/model/ProcessContext.d.ts +5 -2
- package/dist/types/model/ProcessContextBuilder.d.ts +2 -1
- package/dist/types/model/Settings.d.ts +1 -0
- package/dist/types/model/UiGraph.d.ts +50 -5
- package/dist/types/model/UiGraphActionProtocol.d.ts +69 -0
- package/dist/types/model/UiGraphBindings.d.ts +45 -0
- package/dist/types/model/UiGraphBrowserRuntime.d.ts +4 -0
- package/dist/types/model/UiGraphNormalization.d.ts +24 -0
- package/dist/types/model/UiGraphRendererStyles.d.ts +1 -1
- package/dist/types/model/UiGraphRuntimeModel.d.ts +124 -0
- package/dist/types/model/UiGraphWebAppStatus.d.ts +5 -0
- package/dist/types/model/chat-v2/chatV2ProviderProfile.d.ts +46 -0
- package/dist/types/model/chat-v2/chatV2RequestPlan.d.ts +42 -0
- package/dist/types/model/chat-v2/chatV2Types.d.ts +1 -0
- package/dist/types/model/chat-v2/index.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +1 -0
- package/dist/types/model/chat-v2/llmChatV2NodeRuntime.d.ts +2 -0
- package/dist/types/model/chat-v2/providerOptions.d.ts +2 -2
- package/dist/types/model/nodes/ArrayNode.d.ts +0 -1
- package/dist/types/model/nodes/AssembleMessageNode.d.ts +0 -1
- package/dist/types/model/nodes/AssemblePromptNode.d.ts +0 -1
- package/dist/types/model/nodes/DelayNode.d.ts +0 -1
- package/dist/types/model/nodes/DidRunNode.d.ts +0 -1
- package/dist/types/model/nodes/JoinNode.d.ts +0 -1
- package/dist/types/model/nodes/LoopControllerNode.d.ts +0 -1
- package/dist/types/model/nodes/PassthroughNode.d.ts +0 -1
- package/dist/types/model/nodes/RaceInputsNode.d.ts +0 -1
- package/dist/types/model/nodes/ReportProgressNode.d.ts +23 -0
- package/dist/types/model/nodes/variadicPortIndex.d.ts +4 -0
- package/dist/types/plugins/gentrace/gentraceSdk.d.ts +5 -0
- package/dist/types/plugins/gentrace/plugin.d.ts +1 -1
- package/dist/types/recording/RecordedEvents.d.ts +5 -0
- package/dist/types/utils/pQueueCompat.d.ts +1 -1
- package/dist/types/webAppRuntime.d.ts +9 -0
- package/package.json +15 -9
- package/dist/esm/plugins/anthropic/fetchEventSource.js +0 -107
- package/dist/types/plugins/anthropic/fetchEventSource.d.ts +0 -11
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ChatV2MessageList, ChatV2Provider, ChatV2ToolSet, RunChatV2PipelineOptions, StreamChatV2Options } from './chatV2Types.js';
|
|
2
|
+
export type ChatV2TransportMode = 'stream' | 'generate';
|
|
3
|
+
export type ChatV2RequestPlan = {
|
|
4
|
+
provider: ChatV2Provider;
|
|
5
|
+
modelId: string;
|
|
6
|
+
transportMode: ChatV2TransportMode;
|
|
7
|
+
retry: {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
repeatTimes: number;
|
|
10
|
+
cooldownMs: number;
|
|
11
|
+
};
|
|
12
|
+
request: Omit<StreamChatV2Options, 'abortSignal' | 'executeStream' | 'executeGenerate' | 'onPartialOutput'>;
|
|
13
|
+
output: Pick<RunChatV2PipelineOptions, 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'functionCallMode'>;
|
|
14
|
+
};
|
|
15
|
+
type BuildChatV2RequestPlanOptions = Pick<RunChatV2PipelineOptions, 'provider' | 'model' | 'modelId' | 'maxTokens' | 'temperature' | 'topP' | 'topK' | 'presencePenalty' | 'frequencyPenalty' | 'stopSequences' | 'seed' | 'responseOutput' | 'responseFormat' | 'providerOptions' | 'toolChoice' | 'retryOnNon200' | 'retryOnNon200RepeatTimes' | 'retryOnNon200CooldownMs' | 'outputUsage' | 'outputReasoning' | 'outputRequestStatus' | 'includeFunctionCalls' | 'emitPartialOutputs' | 'functionCallMode'> & {
|
|
16
|
+
messages: ChatV2MessageList;
|
|
17
|
+
tools?: ChatV2ToolSet | undefined;
|
|
18
|
+
};
|
|
19
|
+
export type ChatV2RequestPlanSummary = {
|
|
20
|
+
provider: ChatV2Provider;
|
|
21
|
+
modelId: string;
|
|
22
|
+
transportMode: ChatV2TransportMode;
|
|
23
|
+
sdkMaxRetries: 0;
|
|
24
|
+
retry: ChatV2RequestPlan['retry'];
|
|
25
|
+
messageCount: number;
|
|
26
|
+
toolNames: string[];
|
|
27
|
+
responseFormat: RunChatV2PipelineOptions['responseFormat'];
|
|
28
|
+
generation: {
|
|
29
|
+
maxTokens?: number | undefined;
|
|
30
|
+
temperature?: number | undefined;
|
|
31
|
+
topP?: number | undefined;
|
|
32
|
+
topK?: number | undefined;
|
|
33
|
+
presencePenalty?: number | undefined;
|
|
34
|
+
frequencyPenalty?: number | undefined;
|
|
35
|
+
stopSequences?: string[] | undefined;
|
|
36
|
+
seed?: number | undefined;
|
|
37
|
+
};
|
|
38
|
+
output: ChatV2RequestPlan['output'];
|
|
39
|
+
};
|
|
40
|
+
export declare function buildChatV2RequestPlan(options: BuildChatV2RequestPlanOptions): ChatV2RequestPlan;
|
|
41
|
+
export declare function summarizeChatV2RequestPlan(plan: ChatV2RequestPlan): ChatV2RequestPlanSummary;
|
|
42
|
+
export {};
|
|
@@ -56,6 +56,7 @@ export type ChatV2GenerateExecutor = (args: GenerateTextArgs) => ChatV2GenerateH
|
|
|
56
56
|
export type StreamChatV2Options = {
|
|
57
57
|
model: ChatV2Model;
|
|
58
58
|
messages: ChatV2MessageList;
|
|
59
|
+
maxRetries?: 0 | undefined;
|
|
59
60
|
tools?: ChatV2ToolSet | undefined;
|
|
60
61
|
maxTokens?: number | undefined;
|
|
61
62
|
temperature?: number | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from './aiSdkBridge.js';
|
|
2
2
|
export * from './chatV2FeatureCompatibility.js';
|
|
3
3
|
export * from './chatV2Pipeline.js';
|
|
4
|
+
export * from './chatV2ProviderProfile.js';
|
|
5
|
+
export * from './chatV2RequestPlan.js';
|
|
4
6
|
export * from './chatV2ResponseFormat.js';
|
|
5
7
|
export * from './chatV2Shared.js';
|
|
6
8
|
export * from './chatV2Types.js';
|
|
@@ -7,6 +7,7 @@ export type LLMChatV2ApiKeySource = 'environment' | 'input';
|
|
|
7
7
|
export type LLMChatV2NodeConfigData = ChatV2CommonNodeData & {
|
|
8
8
|
provider: ChatV2Provider;
|
|
9
9
|
apiKeySource?: LLMChatV2ApiKeySource;
|
|
10
|
+
customProviderApiKeyProgrammaticName?: string;
|
|
10
11
|
customProviderApiKeyEnvVarName?: string;
|
|
11
12
|
customProviderBaseURL: string;
|
|
12
13
|
useCustomProviderBaseURLInput: boolean;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { GptFunction } from '../DataValue.js';
|
|
2
2
|
import type { Inputs, Outputs } from '../GraphProcessor.js';
|
|
3
3
|
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
4
|
+
import type { ChatV2ProviderProfile } from './chatV2ProviderProfile.js';
|
|
4
5
|
import type { RunChatV2PipelineOptions } from './chatV2Types.js';
|
|
5
6
|
import { buildLLMChatV2EditorCacheKey, cloneLLMChatV2EditorCacheOutputs } from './chatV2EditorCache.js';
|
|
6
7
|
import { type LLMChatV2EditorCacheKeyParts, type LLMChatV2NodeData } from './llmChatV2NodeData.js';
|
|
7
8
|
export { buildLLMChatV2EditorCacheKey, cloneLLMChatV2EditorCacheOutputs };
|
|
8
9
|
export { resolveLLMChatV2RuntimeProviderOptions } from './chatV2RuntimeOptions.js';
|
|
9
10
|
export type LLMChatV2RuntimeConfig = {
|
|
11
|
+
providerProfile: ChatV2ProviderProfile;
|
|
10
12
|
runOptions: RunChatV2PipelineOptions;
|
|
11
13
|
functions: GptFunction[] | undefined;
|
|
12
14
|
cacheKey: string | undefined;
|
|
@@ -50,11 +50,11 @@ export type CreateChatV2ModelOptions = {
|
|
|
50
50
|
headers?: Record<string, string> | undefined;
|
|
51
51
|
onRequestBody?: ((body: unknown) => void) | undefined;
|
|
52
52
|
};
|
|
53
|
-
export type ResolveChatV2ProviderConfigContext = Pick<InternalProcessContext, '
|
|
53
|
+
export type ResolveChatV2ProviderConfigContext = Pick<InternalProcessContext, 'getPluginConfig' | 'settings'>;
|
|
54
54
|
export type ResolvedChatV2ProviderConfig = {
|
|
55
55
|
baseURL?: string | undefined;
|
|
56
56
|
headers?: Record<string, string> | undefined;
|
|
57
57
|
};
|
|
58
58
|
export declare function openAICompatibleEndpointToBaseURL(endpoint: string): string;
|
|
59
|
-
export declare function resolveChatV2ProviderConfig(provider: ChatV2Provider,
|
|
59
|
+
export declare function resolveChatV2ProviderConfig(provider: ChatV2Provider, _modelId: string, context: ResolveChatV2ProviderConfigContext, options?: CreateChatV2ModelOptions): Promise<ResolvedChatV2ProviderConfig>;
|
|
60
60
|
export declare function createChatV2Model(provider: ChatV2Provider, modelId: string, context: Pick<InternalProcessContext, 'settings' | 'getPluginConfig'>, options?: CreateChatV2ModelOptions): ChatV2Model;
|
|
@@ -8,7 +8,6 @@ export type ArrayNodeData = {
|
|
|
8
8
|
flattenDeep?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class ArrayNodeImpl extends NodeImpl<ArrayNode> {
|
|
11
|
-
#private;
|
|
12
11
|
static create(): ArrayNode;
|
|
13
12
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
14
13
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -11,7 +11,6 @@ export type AssembleMessageNodeData = {
|
|
|
11
11
|
useToolCallIdInput?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare class AssembleMessageNodeImpl extends NodeImpl<AssembleMessageNode> {
|
|
14
|
-
#private;
|
|
15
14
|
static create(): AssembleMessageNode;
|
|
16
15
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
17
16
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -11,7 +11,6 @@ export type AssemblePromptNodeData = {
|
|
|
11
11
|
useIsLastMessageCacheBreakpointInput?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare class AssemblePromptNodeImpl extends NodeImpl<AssemblePromptNode> {
|
|
14
|
-
#private;
|
|
15
14
|
static create(): AssemblePromptNode;
|
|
16
15
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
17
16
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -8,7 +8,6 @@ export type DelayNodeData = {
|
|
|
8
8
|
useDelayInput?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export declare class DelayNodeImpl extends NodeImpl<DelayNode> {
|
|
11
|
-
#private;
|
|
12
11
|
static create(): DelayNode;
|
|
13
12
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
14
13
|
getOutputDefinitions(connections: NodeConnection[]): NodeOutputDefinition[];
|
|
@@ -5,7 +5,6 @@ import { type EditorDefinition } from '../EditorDefinition.js';
|
|
|
5
5
|
export type DidRunNode = ChartNode<'didRun', DidRunNodeData>;
|
|
6
6
|
export type DidRunNodeData = {};
|
|
7
7
|
export declare class DidRunNodeImpl extends NodeImpl<DidRunNode> {
|
|
8
|
-
#private;
|
|
9
8
|
static create(): DidRunNode;
|
|
10
9
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
11
10
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -9,7 +9,6 @@ export type JoinNodeData = {
|
|
|
9
9
|
useJoinStringInput?: boolean;
|
|
10
10
|
};
|
|
11
11
|
export declare class JoinNodeImpl extends NodeImpl<JoinNode> {
|
|
12
|
-
#private;
|
|
13
12
|
static create: () => JoinNode;
|
|
14
13
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
15
14
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -9,7 +9,6 @@ export type LoopControllerNodeData = {
|
|
|
9
9
|
atMaxIterationsAction?: 'break' | 'error';
|
|
10
10
|
};
|
|
11
11
|
export declare class LoopControllerNodeImpl extends NodeImpl<LoopControllerNode> {
|
|
12
|
-
#private;
|
|
13
12
|
static create(): LoopControllerNode;
|
|
14
13
|
getInputDefinitions(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>): NodeInputDefinition[];
|
|
15
14
|
getOutputDefinitions(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>): NodeOutputDefinition[];
|
|
@@ -4,7 +4,6 @@ import { type Inputs, type Outputs } from '../GraphProcessor.js';
|
|
|
4
4
|
export type PassthroughNode = ChartNode<'passthrough', PassthroughNodeData>;
|
|
5
5
|
export type PassthroughNodeData = {};
|
|
6
6
|
export declare class PassthroughNodeImpl extends NodeImpl<PassthroughNode> {
|
|
7
|
-
#private;
|
|
8
7
|
static create: () => PassthroughNode;
|
|
9
8
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
10
9
|
getOutputDefinitions(connections: NodeConnection[]): NodeOutputDefinition[];
|
|
@@ -5,7 +5,6 @@ import { type EditorDefinition } from '../../index.js';
|
|
|
5
5
|
export type RaceInputsNode = ChartNode<'raceInputs', RaceInputsNodeData>;
|
|
6
6
|
export type RaceInputsNodeData = {};
|
|
7
7
|
export declare class RaceInputsNodeImpl extends NodeImpl<RaceInputsNode> {
|
|
8
|
-
#private;
|
|
9
8
|
static create(): RaceInputsNode;
|
|
10
9
|
getInputDefinitions(connections: NodeConnection[]): NodeInputDefinition[];
|
|
11
10
|
getOutputDefinitions(): NodeOutputDefinition[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DataValue } from '../DataValue.js';
|
|
2
|
+
import type { EditorDefinition } from '../EditorDefinition.js';
|
|
3
|
+
import type { Inputs } from '../GraphProcessor.js';
|
|
4
|
+
import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
|
|
5
|
+
import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
|
|
6
|
+
import type { InternalProcessContext } from '../ProcessContext.js';
|
|
7
|
+
export type ReportProgressNode = ChartNode<'reportProgress', ReportProgressNodeData>;
|
|
8
|
+
export type ReportProgressNodeData = {
|
|
9
|
+
message: string;
|
|
10
|
+
percent?: number;
|
|
11
|
+
useMessageInput: boolean;
|
|
12
|
+
usePercentInput: boolean;
|
|
13
|
+
};
|
|
14
|
+
export declare class ReportProgressNodeImpl extends NodeImpl<ReportProgressNode> {
|
|
15
|
+
static create(): ReportProgressNode;
|
|
16
|
+
getInputDefinitions(): NodeInputDefinition[];
|
|
17
|
+
getOutputDefinitions(): NodeOutputDefinition[];
|
|
18
|
+
getEditors(): EditorDefinition<ReportProgressNode>[];
|
|
19
|
+
getBody(): string;
|
|
20
|
+
static getUIData(): NodeUIData;
|
|
21
|
+
process(inputs: Inputs, context: InternalProcessContext): Promise<Record<string, DataValue>>;
|
|
22
|
+
}
|
|
23
|
+
export declare const reportProgressNode: import("../NodeDefinition.js").NodeDefinition<ReportProgressNode>;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { NodeConnection, NodeId } from '../NodeBase.js';
|
|
2
|
+
export type VariadicPortIndexPolicy = 'legacy' | 'decimal' | 'strict-positive';
|
|
3
|
+
export declare function getHighestVariadicPortIndex(connections: readonly NodeConnection[], inputNodeId: NodeId, prefix: string, policy: VariadicPortIndexPolicy): number;
|
|
4
|
+
export declare function getNextVariadicPortIndex(connections: readonly NodeConnection[], inputNodeId: NodeId, prefix: string, policy: VariadicPortIndexPolicy): number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { init } from '@gentrace/core/dist/providers/init.mjs';
|
|
2
|
+
export { getPipelines } from '@gentrace/core/dist/providers/pipeline-methods.mjs';
|
|
3
|
+
export { Pipeline } from '@gentrace/core/dist/providers/pipeline.mjs';
|
|
4
|
+
export { runTest } from '@gentrace/core/dist/providers/run-test.mjs';
|
|
5
|
+
export { StepRun } from '@gentrace/core/dist/providers/step-run.mjs';
|
|
@@ -7,5 +7,5 @@ import type { Settings } from '../../model/Settings.js';
|
|
|
7
7
|
import type { DataValue } from '../../model/DataValue.js';
|
|
8
8
|
export declare const runGentraceTests: (gentracePipelineSlug: string, settings: Settings, project: Omit<Project, "data">, graph: NodeGraph, nativeApi: NativeApi, contextValues?: Record<string, DataValue>) => Promise<import("@gentrace/core").TestResultPost200Response>;
|
|
9
9
|
export declare const runRemoteGentraceTests: (gentracePipelineSlug: string, settings: Settings, project: Omit<Project, "data">, graph: NodeGraph, runAndRecord: (testCase: Record<string, any>) => Promise<Recording>) => Promise<import("@gentrace/core").TestResultPost200Response>;
|
|
10
|
-
export declare const getGentracePipelines: (gentraceApiKey: string) => Promise<import("@gentrace/core/dist/models/pipelines-get200-response-pipelines-inner.js").
|
|
10
|
+
export declare const getGentracePipelines: (gentraceApiKey: string) => Promise<import("@gentrace/core/dist/models/v1-pipelines-get200-response-pipelines-inner.js").V1PipelinesGet200ResponsePipelinesInner[]>;
|
|
11
11
|
export declare const gentracePlugin: RivetPlugin;
|
|
@@ -79,6 +79,11 @@ export type RecordedEventsMap = OverrideProperties<ProcessEvents, {
|
|
|
79
79
|
index: number;
|
|
80
80
|
processId: ProcessId;
|
|
81
81
|
}>;
|
|
82
|
+
progress: WithOptionalExecution<{
|
|
83
|
+
nodeId: NodeId;
|
|
84
|
+
processId: ProcessId;
|
|
85
|
+
progress: ProcessEvents['progress']['progress'];
|
|
86
|
+
}>;
|
|
82
87
|
/** Called when the outputs of a node have been cleared entirely. If processId is present, only the one process() should be cleared. */
|
|
83
88
|
nodeOutputsCleared: WithOptionalExecution<{
|
|
84
89
|
nodeId: NodeId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import PQueueImport from 'p-queue';
|
|
2
2
|
/**
|
|
3
|
-
* p-queue v7+ is ESM-only. The CJS bundle (built by bundle.esbuild.
|
|
3
|
+
* p-queue v7+ is ESM-only. The CJS bundle (built by bundle.esbuild.cjs) aliases
|
|
4
4
|
* `p-queue` to `p-queue-6` (a CJS-compatible older version). That version wraps
|
|
5
5
|
* the default export so that `import PQueue from 'p-queue'` resolves to
|
|
6
6
|
* `{ default: PQueue }` instead of the class directly. This module normalizes
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { UiComponentId, UiGraph, UiGraphActionComponent, UiGraphChatMessage, UiGraphComponent, } from './model/UiGraph.js';
|
|
2
|
+
export type { UiGraphInteractionSnapshot } from './model/UiGraphRuntimeModel.js';
|
|
3
|
+
export type { RivetWebAppClientMessage, RivetWebAppRunEvent, RivetWebAppServerMessage, } from './model/UiGraphActionProtocol.js';
|
|
4
|
+
export type { GraphProgress } from './model/GraphProgress.js';
|
|
5
|
+
export type { RivetMarkdownSanitizerPolicy } from './model/MarkdownSanitizationPolicy.js';
|
|
6
|
+
export { createUiGraphChatSubmissionStatePatch, getUiGraphActionState, getUiGraphChatDraftStateKey, } from './model/UiGraph.js';
|
|
7
|
+
export { applyUiGraphStatePatch, createUiGraphActionExecutionController, createUiGraphInteractionController, getUiGraphComponentRenderModel, getUiGraphJsonOutputFilename, } from './model/UiGraphRuntimeModel.js';
|
|
8
|
+
export { parseRivetWebAppClientMessage, parseRivetWebAppServerMessage, RIVET_WEB_APP_ACTION_PROTOCOL_VERSION, } from './model/UiGraphActionProtocol.js';
|
|
9
|
+
export { copyUiGraphText, downloadUiGraphJsonOutput } from './model/UiGraphBrowserRuntime.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valerypopoff/rivet2-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/cjs/bundle.cjs",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
"import": "./dist/esm/index.js",
|
|
24
24
|
"require": "./dist/cjs/bundle.cjs"
|
|
25
25
|
}
|
|
26
|
+
},
|
|
27
|
+
"./web-app-runtime": {
|
|
28
|
+
"types": "./dist/types/webAppRuntime.d.ts",
|
|
29
|
+
"import": "./dist/esm/webAppRuntime.js",
|
|
30
|
+
"require": "./dist/cjs/webAppRuntime.cjs"
|
|
26
31
|
}
|
|
27
32
|
},
|
|
28
33
|
"files": [
|
|
@@ -42,25 +47,26 @@
|
|
|
42
47
|
"@ai-sdk/google": "3.0.43",
|
|
43
48
|
"@ai-sdk/openai": "3.0.41",
|
|
44
49
|
"@ai-sdk/openai-compatible": "1.0.17",
|
|
45
|
-
"@gentrace/core": "^
|
|
46
|
-
"@google-cloud/vertexai": "^
|
|
47
|
-
"@google/genai": "^
|
|
50
|
+
"@gentrace/core": "^3.5.12",
|
|
51
|
+
"@google-cloud/vertexai": "^1.12.0",
|
|
52
|
+
"@google/genai": "^1.52.0",
|
|
48
53
|
"@huggingface/inference": "^2.6.4",
|
|
49
54
|
"acorn": "^8.14.0",
|
|
50
55
|
"ai": "6.0.116",
|
|
51
56
|
"assemblyai": "^4.6.0",
|
|
52
|
-
"autoevals": "^0.0
|
|
57
|
+
"autoevals": "^0.3.0",
|
|
53
58
|
"cron-parser": "^4.9.0",
|
|
54
59
|
"crypto-js": "^4.2.0",
|
|
55
60
|
"emittery": "^1.0.1",
|
|
56
61
|
"emittery-0-13": "npm:emittery@^0.13.1",
|
|
57
62
|
"gpt-tokenizer": "^2.1.2",
|
|
58
63
|
"json-stream-es": "^1.2.1",
|
|
59
|
-
"jsonpath-plus": "^10.
|
|
60
|
-
"lodash-es": "^4.
|
|
64
|
+
"jsonpath-plus": "^10.4.0",
|
|
65
|
+
"lodash-es": "^4.18.1",
|
|
61
66
|
"mdast-util-gfm-table": "^2.0.0",
|
|
62
67
|
"mdast-util-to-markdown": "^2.1.2",
|
|
63
|
-
"minimatch": "^
|
|
68
|
+
"minimatch": "^10.2.5",
|
|
69
|
+
"mustache": "^4.2.0",
|
|
64
70
|
"nanoid": "^3.3.6",
|
|
65
71
|
"openai": "^4.28.4",
|
|
66
72
|
"p-queue": "^7.4.1",
|
|
@@ -71,7 +77,7 @@
|
|
|
71
77
|
"ts-dedent": "^2.2.0",
|
|
72
78
|
"ts-pattern": "^5.6.2",
|
|
73
79
|
"type-fest": "^4.34.1",
|
|
74
|
-
"yaml": "^2.
|
|
80
|
+
"yaml": "^2.9.0",
|
|
75
81
|
"zod": "^4.3.6"
|
|
76
82
|
}
|
|
77
83
|
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_CHAT_NODE_TIMEOUT } from '../../utils/defaults.js';
|
|
2
|
-
// https://github.com/openai/openai-node/issues/18#issuecomment-1518715285
|
|
3
|
-
export class EventSourceResponse extends Response {
|
|
4
|
-
name;
|
|
5
|
-
streams;
|
|
6
|
-
constructor(body, init) {
|
|
7
|
-
if (body == null) {
|
|
8
|
-
super(null, init);
|
|
9
|
-
this.name = 'EventSourceResponse';
|
|
10
|
-
this.streams = null;
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const [bodyForString, bodyForEvents] = body.tee();
|
|
14
|
-
const streams = createEventStream(bodyForEvents);
|
|
15
|
-
// By passing our transformed stream into the Response constructor, we prevent anyone
|
|
16
|
-
// from accidentally accessing the raw response.body stream.
|
|
17
|
-
super(bodyForString, init);
|
|
18
|
-
this.name = 'EventSourceResponse';
|
|
19
|
-
this.streams = streams;
|
|
20
|
-
}
|
|
21
|
-
async *events() {
|
|
22
|
-
if (this.streams == null) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
const reader = this.streams.eventStream.getReader();
|
|
26
|
-
try {
|
|
27
|
-
while (true) {
|
|
28
|
-
const { done, value } = await this.raceWithTimeout(reader.read(), DEFAULT_CHAT_NODE_TIMEOUT);
|
|
29
|
-
if (done) {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
yield value;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
finally {
|
|
36
|
-
reader.releaseLock();
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
async raceWithTimeout(promise, timeout = 5000) {
|
|
40
|
-
// eslint-disable-next-line no-async-promise-executor,@typescript-eslint/no-misused-promises -- Error handled correctly
|
|
41
|
-
return new Promise(async (resolve, reject) => {
|
|
42
|
-
const timer = setTimeout(() => {
|
|
43
|
-
reject(new Error('Timeout: API response took too long.'));
|
|
44
|
-
}, timeout);
|
|
45
|
-
try {
|
|
46
|
-
const result = await promise;
|
|
47
|
-
clearTimeout(timer);
|
|
48
|
-
resolve(result);
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
clearTimeout(timer);
|
|
52
|
-
reject(error);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
export default async function fetchEventSource(url, init) {
|
|
58
|
-
const headers = {
|
|
59
|
-
...init?.headers,
|
|
60
|
-
accept: 'text/event-stream',
|
|
61
|
-
};
|
|
62
|
-
const response = await fetch(url, {
|
|
63
|
-
...init,
|
|
64
|
-
headers,
|
|
65
|
-
});
|
|
66
|
-
return new EventSourceResponse(response.body, response);
|
|
67
|
-
}
|
|
68
|
-
class LineSplitter {
|
|
69
|
-
separator;
|
|
70
|
-
buffer = '';
|
|
71
|
-
constructor(separator = /\n+/) {
|
|
72
|
-
this.separator = separator;
|
|
73
|
-
}
|
|
74
|
-
transform(chunk, controller) {
|
|
75
|
-
this.buffer += chunk;
|
|
76
|
-
const lines = this.buffer.split(this.separator);
|
|
77
|
-
this.buffer = lines.pop() ?? '';
|
|
78
|
-
for (const line of lines) {
|
|
79
|
-
controller.enqueue(line);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
flush(controller) {
|
|
83
|
-
if (this.buffer.length > 0) {
|
|
84
|
-
controller.enqueue(this.buffer);
|
|
85
|
-
this.buffer = '';
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
function createEventStream(body) {
|
|
90
|
-
if (body == null) {
|
|
91
|
-
return null;
|
|
92
|
-
}
|
|
93
|
-
const textStream = body.pipeThrough(new TextDecoderStream());
|
|
94
|
-
const eventStream = textStream.pipeThrough(new TransformStream(new LineSplitter())).pipeThrough(new TransformStream({
|
|
95
|
-
transform(line, controller) {
|
|
96
|
-
if (line.startsWith('data: ')) {
|
|
97
|
-
const data = line.slice(6).trim();
|
|
98
|
-
controller.enqueue(data);
|
|
99
|
-
}
|
|
100
|
-
else if (line.startsWith('event: ')) {
|
|
101
|
-
const event = line.slice(7).trim();
|
|
102
|
-
controller.enqueue(`[${event}]`);
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
}));
|
|
106
|
-
return { eventStream, textStream };
|
|
107
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare class EventSourceResponse extends Response {
|
|
2
|
-
name: string;
|
|
3
|
-
readonly streams: {
|
|
4
|
-
eventStream: ReadableStream<string>;
|
|
5
|
-
textStream: ReadableStream<string>;
|
|
6
|
-
} | null;
|
|
7
|
-
constructor(body: ReadableStream<Uint8Array> | null, init?: ResponseInit);
|
|
8
|
-
events(): AsyncGenerator<string>;
|
|
9
|
-
private raceWithTimeout;
|
|
10
|
-
}
|
|
11
|
-
export default function fetchEventSource(url: string, init?: RequestInit): Promise<EventSourceResponse>;
|