@alpic80/rivet-core 1.19.1-aidon.2 → 1.24.0-aidon.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/bundle.cjs +4187 -1020
  3. package/dist/cjs/bundle.cjs.map +4 -4
  4. package/dist/esm/api/createProcessor.js +8 -17
  5. package/dist/esm/api/looseDataValue.js +16 -0
  6. package/dist/esm/exports.js +2 -0
  7. package/dist/esm/integrations/CodeRunner.js +36 -0
  8. package/dist/esm/integrations/GptTokenizerTokenizer.js +7 -4
  9. package/dist/esm/integrations/openai/OpenAIEmbeddingGenerator.js +1 -1
  10. package/dist/esm/model/DataValue.js +14 -2
  11. package/dist/esm/model/GraphProcessor.js +275 -104
  12. package/dist/esm/model/NodeBase.js +11 -1
  13. package/dist/esm/model/NodeImpl.js +8 -0
  14. package/dist/esm/model/Nodes.js +31 -4
  15. package/dist/esm/model/ProjectReferenceLoader.js +1 -0
  16. package/dist/esm/model/nodes/AssembleMessageNode.js +12 -2
  17. package/dist/esm/model/nodes/AssemblePromptNode.js +22 -0
  18. package/dist/esm/model/nodes/CallGraphNode.js +3 -4
  19. package/dist/esm/model/nodes/ChatLoopNode.js +150 -0
  20. package/dist/esm/model/nodes/ChatNode.js +7 -934
  21. package/dist/esm/model/nodes/ChatNodeBase.js +1275 -0
  22. package/dist/esm/model/nodes/ChunkNode.js +2 -2
  23. package/dist/esm/model/nodes/CodeNode.js +40 -4
  24. package/dist/esm/model/nodes/CronNode.js +248 -0
  25. package/dist/esm/model/nodes/DelegateFunctionCallNode.js +37 -12
  26. package/dist/esm/model/nodes/DestructureNode.js +1 -1
  27. package/dist/esm/model/nodes/DocumentNode.js +183 -0
  28. package/dist/esm/model/nodes/ExtractJsonNode.js +4 -4
  29. package/dist/esm/model/nodes/ExtractRegexNode.js +10 -11
  30. package/dist/esm/model/nodes/GetEmbeddingNode.js +1 -1
  31. package/dist/esm/model/nodes/HttpCallNode.js +3 -1
  32. package/dist/esm/model/nodes/IfNode.js +5 -0
  33. package/dist/esm/model/nodes/ImageToMDNode.js +116 -0
  34. package/dist/esm/model/nodes/LoopUntilNode.js +214 -0
  35. package/dist/esm/model/nodes/PromptNode.js +29 -6
  36. package/dist/esm/model/nodes/ReadAllFilesNode.js +210 -0
  37. package/dist/esm/model/nodes/ReadDirectoryNode.js +31 -25
  38. package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +199 -0
  39. package/dist/esm/model/nodes/TextNode.js +9 -4
  40. package/dist/esm/model/nodes/ToMarkdownTableNode.js +119 -0
  41. package/dist/esm/model/nodes/ToTreeNode.js +133 -0
  42. package/dist/esm/model/nodes/{GptFunctionNode.js → ToolNode.js} +10 -10
  43. package/dist/esm/model/nodes/UserInputNode.js +10 -12
  44. package/dist/esm/plugins/aidon/nodes/ChatAidonNode.js +3 -3
  45. package/dist/esm/plugins/anthropic/anthropic.js +29 -10
  46. package/dist/esm/plugins/anthropic/fetchEventSource.js +3 -2
  47. package/dist/esm/plugins/anthropic/nodes/ChatAnthropicNode.js +267 -147
  48. package/dist/esm/plugins/anthropic/plugin.js +9 -1
  49. package/dist/esm/plugins/gentrace/plugin.js +6 -6
  50. package/dist/esm/plugins/google/google.js +113 -5
  51. package/dist/esm/plugins/google/nodes/ChatGoogleNode.js +211 -54
  52. package/dist/esm/plugins/google/plugin.js +13 -6
  53. package/dist/esm/plugins/openai/nodes/RunThreadNode.js +2 -2
  54. package/dist/esm/recording/ExecutionRecorder.js +5 -1
  55. package/dist/esm/utils/chatMessageToOpenAIChatCompletionMessage.js +15 -2
  56. package/dist/esm/utils/coerceType.js +1 -1
  57. package/dist/esm/utils/fetchEventSource.js +1 -1
  58. package/dist/esm/utils/interpolation.js +108 -3
  59. package/dist/esm/utils/openai.js +106 -50
  60. package/dist/esm/utils/paths.js +80 -0
  61. package/dist/esm/utils/serialization/serialization_v4.js +5 -0
  62. package/dist/types/api/createProcessor.d.ts +11 -5
  63. package/dist/types/api/looseDataValue.d.ts +4 -0
  64. package/dist/types/api/streaming.d.ts +1 -1
  65. package/dist/types/exports.d.ts +2 -0
  66. package/dist/types/integrations/CodeRunner.d.ts +18 -0
  67. package/dist/types/model/DataValue.d.ts +29 -6
  68. package/dist/types/model/EditorDefinition.d.ts +6 -1
  69. package/dist/types/model/GraphProcessor.d.ts +14 -7
  70. package/dist/types/model/NodeBase.d.ts +4 -0
  71. package/dist/types/model/NodeImpl.d.ts +5 -4
  72. package/dist/types/model/Nodes.d.ts +13 -4
  73. package/dist/types/model/ProcessContext.d.ts +16 -1
  74. package/dist/types/model/Project.d.ts +19 -7
  75. package/dist/types/model/ProjectReferenceLoader.d.ts +5 -0
  76. package/dist/types/model/RivetPlugin.d.ts +6 -0
  77. package/dist/types/model/RivetUIContext.d.ts +5 -1
  78. package/dist/types/model/Settings.d.ts +1 -0
  79. package/dist/types/model/nodes/AssemblePromptNode.d.ts +4 -1
  80. package/dist/types/model/nodes/ChatLoopNode.d.ts +21 -0
  81. package/dist/types/model/nodes/ChatNode.d.ts +2 -62
  82. package/dist/types/model/nodes/ChatNodeBase.d.ts +85 -0
  83. package/dist/types/model/nodes/CodeNode.d.ts +8 -2
  84. package/dist/types/model/nodes/CronNode.d.ts +34 -0
  85. package/dist/types/model/nodes/DelegateFunctionCallNode.d.ts +1 -0
  86. package/dist/types/model/nodes/DocumentNode.d.ts +28 -0
  87. package/dist/types/model/nodes/ImageToMDNode.d.ts +20 -0
  88. package/dist/types/model/nodes/LoopUntilNode.d.ts +32 -0
  89. package/dist/types/model/nodes/PromptNode.d.ts +2 -0
  90. package/dist/types/model/nodes/ReadAllFilesNode.d.ts +30 -0
  91. package/dist/types/model/nodes/ReadDirectoryNode.d.ts +1 -1
  92. package/dist/types/model/nodes/ReferencedGraphAliasNode.d.ts +31 -0
  93. package/dist/types/model/nodes/ToMarkdownTableNode.d.ts +19 -0
  94. package/dist/types/model/nodes/ToTreeNode.d.ts +21 -0
  95. package/dist/types/model/nodes/UserInputNode.d.ts +2 -3
  96. package/dist/types/plugins/anthropic/anthropic.d.ts +94 -13
  97. package/dist/types/plugins/anthropic/nodes/ChatAnthropicNode.d.ts +7 -2
  98. package/dist/types/plugins/google/google.d.ts +93 -18
  99. package/dist/types/plugins/google/nodes/ChatGoogleNode.d.ts +3 -2
  100. package/dist/types/recording/RecordedEvents.d.ts +2 -0
  101. package/dist/types/utils/base64.d.ts +1 -1
  102. package/dist/types/utils/chatMessageToOpenAIChatCompletionMessage.d.ts +3 -1
  103. package/dist/types/utils/interpolation.d.ts +3 -0
  104. package/dist/types/utils/openai.d.ts +127 -21
  105. package/dist/types/utils/paths.d.ts +8 -0
  106. package/package.json +15 -11
  107. /package/dist/types/model/nodes/{GptFunctionNode.d.ts → ToolNode.d.ts} +0 -0
@@ -1,12 +1,11 @@
1
1
  import { type DataValue, type StringArrayDataValue, type ScalarOrArrayDataValue } from './DataValue.js';
2
- import type { ChartNode, NodeConnection, NodeId, PortId } from './NodeBase.js';
2
+ import { type ChartNode, type NodeConnection, type NodeId, type PortId } from './NodeBase.js';
3
3
  import type { GraphId, NodeGraph } from './NodeGraph.js';
4
- import type { UserInputNode } from './nodes/UserInputNode.js';
5
4
  import Emittery from 'emittery';
6
- import type { Project } from './Project.js';
5
+ import { type Project } from './Project.js';
7
6
  import type { InternalProcessContext, ProcessContext, ProcessId } from './ProcessContext.js';
8
7
  import type { ExecutionRecorder } from '../recording/ExecutionRecorder.js';
9
- import type { Opaque } from 'type-fest';
8
+ import type { Tagged } from 'type-fest';
10
9
  import type { NodeRegistration } from './NodeRegistration.js';
11
10
  export type ProcessEvents = {
12
11
  /** Called when processing has started. */
@@ -65,10 +64,13 @@ export type ProcessEvents = {
65
64
  };
66
65
  /** Called when a user input node requires user input. Call the callback when finished, or call userInput() on the GraphProcessor with the results. */
67
66
  userInput: {
68
- node: UserInputNode;
67
+ node: ChartNode;
68
+ inputStrings: string[];
69
+ /** @deprecated use inputStrings instead */
69
70
  inputs: Inputs;
70
71
  callback: (values: StringArrayDataValue) => void;
71
72
  processId: ProcessId;
73
+ renderingType: 'text' | 'markdown';
72
74
  };
73
75
  /** Called when a node has partially processed, with the current partial output values for the node. */
74
76
  partialOutput: {
@@ -131,7 +133,7 @@ export type ExternalFunctionProcessContext = Omit<InternalProcessContext, 'setGl
131
133
  export type ExternalFunction = (context: ExternalFunctionProcessContext, ...args: unknown[]) => Promise<DataValue & {
132
134
  cost?: number;
133
135
  }>;
134
- export type RaceId = Opaque<string, 'RaceId'>;
136
+ export type RaceId = Tagged<string, 'RaceId'>;
135
137
  export type LoopInfo = AttachedNodeDataItem & {
136
138
  /** ID of the controller of the loop */
137
139
  loopControllerId: NodeId;
@@ -158,11 +160,13 @@ export declare class GraphProcessor {
158
160
  executor?: 'nodejs' | 'browser';
159
161
  /** If set, specifies the node(s) that the graph will run TO, instead of the nodes without any dependents. */
160
162
  runToNodeIds?: NodeId[];
163
+ /** If set, specifies the node that the graph will run FROM, instead of the start nodes. Requires preloading data. */
164
+ runFromNodeId?: NodeId;
161
165
  /** The interval between nodeFinish events when playing back a recording. I.e. how fast the playback is. */
162
166
  recordingPlaybackChatLatency: number;
163
167
  warnOnInvalidGraph: boolean;
164
168
  get isRunning(): boolean;
165
- constructor(project: Project, graphId?: GraphId, registry?: NodeRegistration);
169
+ constructor(project: Project, graphId?: GraphId, registry?: NodeRegistration, includeTrace?: boolean);
166
170
  on: Emittery<ProcessEvents>["on"];
167
171
  off: Emittery<ProcessEvents>["off"];
168
172
  once: Emittery<ProcessEvents>["once"];
@@ -177,6 +181,9 @@ export declare class GraphProcessor {
177
181
  resume(): void;
178
182
  setSlowMode(slowMode: boolean): void;
179
183
  events(): AsyncGenerator<ProcessEvent>;
184
+ preloadNodeData(nodeId: NodeId, data: Outputs): void;
185
+ /** Gets all node IDs that a given node ID depends on being complete before the given node ID can start. */
186
+ getDependencyNodesDeep(nodeId: NodeId): NodeId[];
180
187
  replayRecording(recorder: ExecutionRecorder): Promise<GraphOutputs>;
181
188
  /** Main function for running a graph. Runs a graph and returns the outputs from the output nodes of the graph. */
182
189
  processGraph(
@@ -41,6 +41,8 @@ export interface NodeBase {
41
41
  tests?: NodeTestGroup[];
42
42
  /** If true, the node is disabled and effectively "not ran" */
43
43
  disabled?: boolean;
44
+ /** If true, the node exposes an `if` port that lets it run conditionally. */
45
+ isConditional?: boolean;
44
46
  }
45
47
  /** Base type for a typed node. */
46
48
  export type ChartNode<Type extends string = string, Data = unknown> = NodeBase & {
@@ -108,3 +110,5 @@ export type NodeConnection = {
108
110
  /** The unique identifier of the input. */
109
111
  inputId: PortId;
110
112
  };
113
+ export declare const IF_PORT: NodeInputDefinition;
114
+ export declare function isBuiltInInputDefinition(input: NodeInputDefinition): boolean;
@@ -1,6 +1,6 @@
1
1
  import type { Inputs, Outputs } from './GraphProcessor.js';
2
- import type { ChartNode, NodeConnection, NodeId, NodeInputDefinition, NodeOutputDefinition } from './NodeBase.js';
3
- import type { Project } from './Project.js';
2
+ import { type ChartNode, type NodeConnection, type NodeId, type NodeInputDefinition, type NodeOutputDefinition } from './NodeBase.js';
3
+ import type { Project, ProjectId } from './Project.js';
4
4
  import type { InternalProcessContext } from './ProcessContext.js';
5
5
  import type { EditorDefinition } from './EditorDefinition.js';
6
6
  import type { NodeBodySpec } from './NodeBodySpec.js';
@@ -25,8 +25,9 @@ export declare abstract class NodeImpl<T extends ChartNode, Type extends T['type
25
25
  y: number;
26
26
  };
27
27
  get data(): T['data'];
28
- abstract getInputDefinitions(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>, project: Project): NodeInputDefinition[];
29
- abstract getOutputDefinitions(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>, project: Project): NodeOutputDefinition[];
28
+ abstract getInputDefinitions(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>, project: Project, referencedProjects: Record<ProjectId, Project>): NodeInputDefinition[];
29
+ getInputDefinitionsIncludingBuiltIn(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>, project: Project, referencedProjects: Record<ProjectId, Project>): NodeInputDefinition[];
30
+ abstract getOutputDefinitions(connections: NodeConnection[], nodes: Record<NodeId, ChartNode>, project: Project, referencedProjects: Record<ProjectId, Project>): NodeOutputDefinition[];
30
31
  abstract process(inputData: Inputs, context: InternalProcessContext): Promise<Outputs>;
31
32
  getEditors(_context: RivetUIContext): EditorDefinition<T>[] | Promise<EditorDefinition<T>[]>;
32
33
  getBody(_context: RivetUIContext): NodeBody | Promise<NodeBody>;
@@ -2,6 +2,7 @@ import { NodeRegistration } from './NodeRegistration.js';
2
2
  export * from './nodes/UserInputNode.js';
3
3
  export * from './nodes/TextNode.js';
4
4
  export * from './nodes/ChatNode.js';
5
+ export * from './nodes/ChatNodeBase.js';
5
6
  export * from './nodes/PromptNode.js';
6
7
  export * from './nodes/ExtractRegexNode.js';
7
8
  export * from './nodes/CodeNode.js';
@@ -30,7 +31,7 @@ export * from './nodes/PopNode.js';
30
31
  export * from './nodes/SetGlobalNode.js';
31
32
  export * from './nodes/GetGlobalNode.js';
32
33
  export * from './nodes/WaitForEventNode.js';
33
- export * from './nodes/GptFunctionNode.js';
34
+ export * from './nodes/ToolNode.js';
34
35
  export * from './nodes/ToYamlNode.js';
35
36
  export * from './nodes/GetEmbeddingNode.js';
36
37
  export * from './nodes/VectorStoreNode.js';
@@ -49,6 +50,7 @@ export * from './nodes/NumberNode.js';
49
50
  export * from './nodes/RandomNumberNode.js';
50
51
  export * from './nodes/ShuffleNode.js';
51
52
  export * from './nodes/CommentNode.js';
53
+ export * from './nodes/ImageToMDNode.js';
52
54
  export * from './nodes/ImageNode.js';
53
55
  export * from './nodes/AudioNode.js';
54
56
  export * from './nodes/HttpCallNode.js';
@@ -71,9 +73,16 @@ export * from './nodes/GraphReferenceNode.js';
71
73
  export * from './nodes/CallGraphNode.js';
72
74
  export * from './nodes/DelegateFunctionCallNode.js';
73
75
  export * from './nodes/PlayAudioNode.js';
74
- export * from './nodes/CallGraphNode.js';
75
- export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "code" | "array" | "userInput" | "prompt" | "text" | "chat" | "extractRegex" | "if" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "graphInput" | "graphOutput" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "setGlobal" | "raiseEvent" | "getGlobal" | "abortGraph" | "extractObjectPath" | "context" | "coalesce" | "passthrough" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "hash" | "raceInputs" | "toJson" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "delegateFunctionCall" | "playAudio", import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/GptFunctionNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode>;
76
- declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "code" | "array" | "userInput" | "prompt" | "text" | "chat" | "extractRegex" | "if" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "graphInput" | "graphOutput" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "setGlobal" | "raiseEvent" | "getGlobal" | "abortGraph" | "extractObjectPath" | "context" | "coalesce" | "passthrough" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "hash" | "raceInputs" | "toJson" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "delegateFunctionCall" | "playAudio", import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/GptFunctionNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode>;
76
+ export * from './nodes/DocumentNode.js';
77
+ export * from './nodes/ChatLoopNode.js';
78
+ export * from './nodes/ReadAllFilesNode.js';
79
+ export * from './nodes/ToMarkdownTableNode.js';
80
+ export * from './nodes/CronNode.js';
81
+ export * from './nodes/ToTreeNode.js';
82
+ export * from './nodes/LoopUntilNode.js';
83
+ export * from './nodes/ReferencedGraphAliasNode.js';
84
+ export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "code" | "context" | "array" | "text" | "userInput" | "prompt" | "chat" | "extractRegex" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "graphInput" | "graphOutput" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "setGlobal" | "raiseEvent" | "getGlobal" | "abortGraph" | "extractObjectPath" | "coalesce" | "passthrough" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "hash" | "raceInputs" | "toJson" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "imagetoMD" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "delegateFunctionCall" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "referencedGraphAlias", import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/ToolNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageToMDNode.js").ImageToMDNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode | import("./nodes/DocumentNode.js").DocumentNode | import("./nodes/ChatLoopNode.js").ChatLoopNode | import("./nodes/ReadAllFilesNode.js").ReadAllFilesNode | import("./nodes/ToMarkdownTableNode.js").ToMarkdownTableNode | import("./nodes/CronNode.js").CronNode | import("./nodes/ToTreeNode.js").ToTreeNode | import("./nodes/LoopUntilNode.js").LoopUntilNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode>;
85
+ declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "code" | "context" | "array" | "text" | "userInput" | "prompt" | "chat" | "extractRegex" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "graphInput" | "graphOutput" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "setGlobal" | "raiseEvent" | "getGlobal" | "abortGraph" | "extractObjectPath" | "coalesce" | "passthrough" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "hash" | "raceInputs" | "toJson" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "imagetoMD" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "delegateFunctionCall" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "referencedGraphAlias", import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/IfNode.js").IfNode | import("./nodes/ReadDirectoryNode.js").ReadDirectoryNode | import("./nodes/ReadFileNode.js").ReadFileNode | import("./nodes/IfElseNode.js").IfElseNode | import("./nodes/ChunkNode.js").ChunkNode | import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./nodes/SubGraphNode.js").SubGraphNode | import("./nodes/ArrayNode.js").ArrayNode | import("./nodes/ExtractJsonNode.js").ExtractJsonNode | import("./nodes/AssemblePromptNode.js").AssemblePromptNode | import("./nodes/ExtractYamlNode.js").ExtractYamlNode | import("./nodes/LoopControllerNode.js").LoopControllerNode | import("./nodes/TrimChatMessagesNode.js").TrimChatMessagesNode | import("./nodes/ExternalCallNode.js").ExternalCallNode | import("./nodes/ExtractObjectPathNode.js").ExtractObjectPathNode | import("./nodes/RaiseEventNode.js").RaiseEventNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/WaitForEventNode.js").WaitForEventNode | import("./nodes/ToolNode.js").GptFunctionNode | import("./nodes/ToYamlNode.js").ToYamlNode | import("./nodes/GetEmbeddingNode.js").GetEmbeddingNode | import("./nodes/VectorStoreNode.js").VectorStoreNode | import("./nodes/VectorNearestNeighborsNode.js").VectorNearestNeighborsNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/ObjectNode.js").ObjectNode | import("./nodes/BooleanNode.js").BooleanNode | import("./nodes/CompareNode.js").CompareNode | import("./nodes/EvaluateNode.js").EvaluateNode | import("./nodes/NumberNode.js").NumberNode | import("./nodes/RandomNumberNode.js").RandomNumberNode | import("./nodes/ShuffleNode.js").ShuffleNode | import("./nodes/CommentNode.js").CommentNode | import("./nodes/ImageToMDNode.js").ImageToMDNode | import("./nodes/ImageNode.js").ImageNode | import("./nodes/AudioNode.js").AudioNode | import("./nodes/HttpCallNode.js").HttpCallNode | import("./nodes/DelayNode.js").DelayNode | import("./nodes/AppendToDatasetNode.js").AppendToDatasetNode | import("./nodes/CreateDatasetNode.js").CreateDatasetNode | import("./nodes/LoadDatasetNode.js").LoadDatasetNode | import("./nodes/GetAllDatasetsNode.js").GetAllDatasetsNode | import("./nodes/SplitNode.js").SplitNode | import("./nodes/DatasetNearestNeigborsNode.js").DatasetNearestNeighborsNode | import("./nodes/GetDatasetRowNode.js").GetDatasetRowNode | import("./nodes/SliceNode.js").SliceNode | import("./nodes/ExtractMarkdownCodeBlocksNode.js").ExtractMarkdownCodeBlocksNode | import("./nodes/AssembleMessageNode.js").AssembleMessageNode | import("./nodes/URLReferenceNode.js").UrlReferenceNode | import("./nodes/DestructureNode.js").DestructureNode | import("./nodes/ReplaceDatasetNode.js").ReplaceDatasetNode | import("./nodes/ListGraphsNode.js").ListGraphsNode | import("./nodes/GraphReferenceNode.js").GraphReferenceNode | import("./nodes/CallGraphNode.js").CallGraphNode | import("./nodes/DelegateFunctionCallNode.js").DelegateFunctionCallNode | import("./nodes/PlayAudioNode.js").PlayAudioNode | import("./nodes/DocumentNode.js").DocumentNode | import("./nodes/ChatLoopNode.js").ChatLoopNode | import("./nodes/ReadAllFilesNode.js").ReadAllFilesNode | import("./nodes/ToMarkdownTableNode.js").ToMarkdownTableNode | import("./nodes/CronNode.js").CronNode | import("./nodes/ToTreeNode.js").ToTreeNode | import("./nodes/LoopUntilNode.js").LoopUntilNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode>;
77
86
  export { globalRivetNodeRegistry };
78
87
  export type BuiltInNodes = typeof globalRivetNodeRegistry.NodesType;
79
88
  export type BuiltInNodeType = typeof globalRivetNodeRegistry.NodeTypesType;
@@ -1,6 +1,8 @@
1
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 AttachedNodeData, type AudioProvider } from '../index.js';
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 AttachedNodeData, type AudioProvider, type StringArrayDataValue, type ProjectId } from '../index.js';
3
3
  import type { Tokenizer } from '../integrations/Tokenizer.js';
4
+ import type { CodeRunner } from '../integrations/CodeRunner.js';
5
+ import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
4
6
  export type ProcessContext = {
5
7
  settings: Settings;
6
8
  nativeApi?: NativeApi;
@@ -10,6 +12,12 @@ export type ProcessContext = {
10
12
  audioProvider?: AudioProvider;
11
13
  /** Sets the tokenizer that will be used for all nodes. If unset, the default GptTokenizerTokenizer will be used. */
12
14
  tokenizer?: Tokenizer;
15
+ /** The provider for running arbitrary code in the Code Node. */
16
+ codeRunner?: CodeRunner;
17
+ /** The loader for loading project references. */
18
+ projectReferenceLoader?: ProjectReferenceLoader;
19
+ /** The path to the current project. Required if project references are being used. */
20
+ projectPath?: string;
13
21
  /**
14
22
  * If implemented, chat nodes will first call this to resolve their configured endpoint to a final endpoint.
15
23
  * You can use this for adding auth headers, or to load balance between multiple endpoints.
@@ -26,6 +34,8 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
26
34
  executor: 'nodejs' | 'browser';
27
35
  /** The project being executed. */
28
36
  project: Project;
37
+ /** All referenced (and deep referenced) projects from the current project. */
38
+ referencedProjects: Record<ProjectId, Project>;
29
39
  /** A signal that can be used when abort() is called on the GraphProcessor to abort the node's execution. */
30
40
  signal: AbortSignal;
31
41
  /** A unique ID for this specific execution of the node. */
@@ -54,6 +64,7 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
54
64
  /** Creates a subprocessor, for executing subgraphs. */
55
65
  createSubProcessor: (subGraphId: GraphId | undefined, options?: {
56
66
  signal?: AbortSignal;
67
+ project?: Project;
57
68
  }) => GraphProcessor;
58
69
  /** 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. */
59
70
  getGlobal: (id: string) => ScalarOrArrayDataValue | undefined;
@@ -66,4 +77,8 @@ export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessCon
66
77
  abortGraph: (error?: Error | string) => void;
67
78
  /** Gets a string plugin config value from the settings, falling back to a specified environment variable if set. */
68
79
  getPluginConfig(name: string): string | undefined;
80
+ /** Requests that the user input some text in response to the specified prompt. */
81
+ requestUserInput(inputs: string[], renderingType: 'text' | 'markdown'): Promise<StringArrayDataValue>;
82
+ /** The object used for running arbitrary code with the Code Node. */
83
+ codeRunner: CodeRunner;
69
84
  };
@@ -4,14 +4,26 @@ import { type PluginLoadSpec } from './PluginLoadSpec.js';
4
4
  export type ProjectId = Opaque<string, 'ProjectId'>;
5
5
  export type DataId = Opaque<string, 'DataId'>;
6
6
  export type Project = {
7
- metadata: {
8
- id: ProjectId;
9
- title: string;
10
- description: string;
11
- mainGraphId?: GraphId;
12
- path?: string;
13
- };
7
+ metadata: ProjectMetadata;
14
8
  plugins?: PluginLoadSpec[];
15
9
  graphs: Record<GraphId, NodeGraph>;
16
10
  data?: Record<DataId, string>;
11
+ /** References to other projects. */
12
+ references?: ProjectReference[];
13
+ };
14
+ export type ProjectMetadata = {
15
+ id: ProjectId;
16
+ title: string;
17
+ description: string;
18
+ mainGraphId?: GraphId;
19
+ path?: string;
20
+ };
21
+ /** A reference to another project file. Project references cannot be cyclic. */
22
+ export type ProjectReference = {
23
+ /** The ID of the project being referenced. */
24
+ id: ProjectId;
25
+ /** Paths to use to attempt to resolve the reference. */
26
+ hintPaths?: string[];
27
+ /** A human-readable title for the project. */
28
+ title?: string;
17
29
  };
@@ -0,0 +1,5 @@
1
+ import type { Project, ProjectReference } from './Project.js';
2
+ export type ProjectReferenceLoader = {
3
+ /** Loads a project based on the given reference. */
4
+ loadProject: (currentProjectPath: string | undefined, reference: ProjectReference) => Promise<Project>;
5
+ };
@@ -9,6 +9,7 @@ export type RivetPlugin = {
9
9
  register?: (register: <T extends ChartNode>(definition: PluginNodeDefinition<T>) => void) => void;
10
10
  /** The available configuration items and their specification, for configuring a plugin in the UI. */
11
11
  configSpec?: RivetPluginConfigSpecs;
12
+ configPage?: RivetPluginConfigPage;
12
13
  /** Defines additional context menu groups that the plugin adds. */
13
14
  contextMenuGroups?: Array<{
14
15
  id: string;
@@ -16,6 +17,11 @@ export type RivetPlugin = {
16
17
  }>;
17
18
  };
18
19
  export type RivetPluginConfigSpecs = Record<string, PluginConfigurationSpec>;
20
+ export type RivetPluginConfigPage = {
21
+ id: string;
22
+ label: string;
23
+ description?: string;
24
+ };
19
25
  export type PluginConfigurationSpecBase<T> = {
20
26
  /** The type of the config value, how it should show as an editor in the UI. */
21
27
  type: string;
@@ -1,4 +1,4 @@
1
- import { type ChartNode, type DatasetProvider, type NodeGraph, type Project, type Settings } from '../index.js';
1
+ import { type ChartNode, type DatasetProvider, type NativeApi, type NodeGraph, type Project, type ProjectId, type Settings } from '../index.js';
2
2
  /** Context accessible to UI functions such as getEditors() and getBody(). */
3
3
  export type RivetUIContext = {
4
4
  /** The settings configured in the UI. */
@@ -9,10 +9,14 @@ export type RivetUIContext = {
9
9
  datasetProvider: DatasetProvider;
10
10
  /** The current project loaded in the UI. */
11
11
  project: Project;
12
+ /** Other projects referenced by the current project. */
13
+ referencedProjects: Record<ProjectId, Project>;
12
14
  /** The current graph selected in the UI. */
13
15
  graph?: NodeGraph;
14
16
  /** The current node selected in the UI. */
15
17
  node?: ChartNode;
18
+ /** The configured native API. */
19
+ nativeApi: NativeApi;
16
20
  /** Gets a string plugin config value from the settings, falling back to a specified environment variable if set. */
17
21
  getPluginConfig(name: string): string | undefined;
18
22
  };
@@ -12,4 +12,5 @@ export interface Settings<PluginSettings = Record<string, Record<string, unknown
12
12
  /** Timeout in milliseconds before retrying a chat node call. */
13
13
  chatNodeTimeout?: number;
14
14
  chatNodeHeaders?: Record<string, string>;
15
+ throttleChatNode?: number;
15
16
  }
@@ -1,5 +1,5 @@
1
1
  import { type ChartNode, type NodeConnection, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
- import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
2
+ import { NodeImpl, type NodeBody, type NodeUIData } from '../NodeImpl.js';
3
3
  import { type Inputs, type Outputs } from '../GraphProcessor.js';
4
4
  import type { EditorDefinition } from '../EditorDefinition.js';
5
5
  import type { RivetUIContext } from '../RivetUIContext.js';
@@ -7,6 +7,8 @@ import type { InternalProcessContext } from '../ProcessContext.js';
7
7
  export type AssemblePromptNode = ChartNode<'assemblePrompt', AssemblePromptNodeData>;
8
8
  export type AssemblePromptNodeData = {
9
9
  computeTokenCount?: boolean;
10
+ isLastMessageCacheBreakpoint?: boolean;
11
+ useIsLastMessageCacheBreakpointInput?: boolean;
10
12
  };
11
13
  export declare class AssemblePromptNodeImpl extends NodeImpl<AssemblePromptNode> {
12
14
  #private;
@@ -15,6 +17,7 @@ export declare class AssemblePromptNodeImpl extends NodeImpl<AssemblePromptNode>
15
17
  getOutputDefinitions(): NodeOutputDefinition[];
16
18
  static getUIData(): NodeUIData;
17
19
  getEditors(_context: RivetUIContext): EditorDefinition<AssemblePromptNode>[];
20
+ getBody(_context: RivetUIContext): NodeBody | Promise<NodeBody>;
18
21
  process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
19
22
  }
20
23
  export declare const assemblePromptNode: import("../NodeDefinition.js").NodeDefinition<AssemblePromptNode>;
@@ -0,0 +1,21 @@
1
+ import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
+ import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
3
+ import type { Inputs, Outputs } from '../GraphProcessor.js';
4
+ import { type InternalProcessContext } from '../ProcessContext.js';
5
+ import { type EditorDefinition } from '../../index.js';
6
+ import { type ChatNodeData } from './ChatNodeBase.js';
7
+ export type ChatLoopNode = ChartNode<'chatLoop', ChatLoopNodeData>;
8
+ export type ChatLoopNodeData = ChatNodeData & {
9
+ userPrompt: string;
10
+ renderingFormat?: 'text' | 'markdown';
11
+ };
12
+ export declare class ChatLoopNodeImpl extends NodeImpl<ChatLoopNode> {
13
+ static create(): ChatLoopNode;
14
+ getInputDefinitions(): NodeInputDefinition[];
15
+ getOutputDefinitions(): NodeOutputDefinition[];
16
+ static getUIData(): NodeUIData;
17
+ getEditors(): EditorDefinition<ChatLoopNode>[];
18
+ getBody(): string | undefined;
19
+ process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
20
+ }
21
+ export declare const chatLoopNode: import("../NodeDefinition.js").NodeDefinition<ChatLoopNode>;
@@ -1,77 +1,17 @@
1
1
  import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
2
  import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
3
- import { type ChatMessage } from '../DataValue.js';
4
3
  import type { Inputs, Outputs } from '../GraphProcessor.js';
5
4
  import { type InternalProcessContext } from '../ProcessContext.js';
6
5
  import { type EditorDefinition } from '../../index.js';
6
+ import { type ChatNodeData } from './ChatNodeBase.js';
7
7
  export type ChatNode = ChartNode<'chat', ChatNodeData>;
8
- export type ChatNodeConfigData = {
9
- model: string;
10
- temperature: number;
11
- useTopP: boolean;
12
- top_p?: number;
13
- maxTokens: number;
14
- stop?: string;
15
- presencePenalty?: number;
16
- frequencyPenalty?: number;
17
- enableFunctionUse?: boolean;
18
- user?: string;
19
- numberOfChoices?: number;
20
- endpoint?: string;
21
- overrideModel?: string;
22
- overrideMaxTokens?: number;
23
- headers?: {
24
- key: string;
25
- value: string;
26
- }[];
27
- seed?: number;
28
- toolChoice?: 'none' | 'auto' | 'function';
29
- toolChoiceFunction?: string;
30
- responseFormat?: '' | 'text' | 'json' | 'json_schema';
31
- parallelFunctionCalling?: boolean;
32
- additionalParameters?: {
33
- key: string;
34
- value: string;
35
- }[];
36
- responseSchemaName?: string;
37
- };
38
- export type ChatNodeData = ChatNodeConfigData & {
39
- useModelInput: boolean;
40
- useTemperatureInput: boolean;
41
- useTopPInput: boolean;
42
- useTopP: boolean;
43
- useUseTopPInput: boolean;
44
- useMaxTokensInput: boolean;
45
- useStop: boolean;
46
- useStopInput: boolean;
47
- usePresencePenaltyInput: boolean;
48
- useFrequencyPenaltyInput: boolean;
49
- useUserInput?: boolean;
50
- useNumberOfChoicesInput?: boolean;
51
- useEndpointInput?: boolean;
52
- useHeadersInput?: boolean;
53
- useSeedInput?: boolean;
54
- useToolChoiceInput?: boolean;
55
- useToolChoiceFunctionInput?: boolean;
56
- useResponseFormatInput?: boolean;
57
- useAdditionalParametersInput?: boolean;
58
- useResponseSchemaNameInput?: boolean;
59
- /** Given the same set of inputs, return the same output without hitting GPT */
60
- cache: boolean;
61
- useAsGraphPartialOutput?: boolean;
62
- };
63
8
  export declare class ChatNodeImpl extends NodeImpl<ChatNode> {
64
9
  static create(): ChatNode;
65
10
  getInputDefinitions(): NodeInputDefinition[];
66
11
  getOutputDefinitions(): NodeOutputDefinition[];
67
12
  static getUIData(): NodeUIData;
68
13
  getEditors(): EditorDefinition<ChatNode>[];
69
- getBody(): string;
14
+ getBody(): string | undefined;
70
15
  process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
71
16
  }
72
17
  export declare const chatNode: import("../NodeDefinition.js").NodeDefinition<ChatNode>;
73
- export declare function getChatNodeMessages(inputs: Inputs): {
74
- messages: ChatMessage[];
75
- systemPrompt: import("../DataValue.js").DataValue | undefined;
76
- };
77
- export declare function getCostForTokens(tokenCount: number, type: 'prompt' | 'completion', costPerThousand: number): number;
@@ -0,0 +1,85 @@
1
+ import { type ChatMessage } from '../DataValue.js';
2
+ import type { EditorDefinition } from '../EditorDefinition.js';
3
+ import type { ChartNode, NodeInputDefinition } from '../NodeBase.js';
4
+ import type { ChatNode } from './ChatNode.js';
5
+ import type { Inputs, Outputs } from '../GraphProcessor.js';
6
+ import type { InternalProcessContext } from '../ProcessContext.js';
7
+ export type ChatNodeConfigData = {
8
+ model: string;
9
+ temperature: number;
10
+ useTopP: boolean;
11
+ top_p?: number;
12
+ maxTokens: number;
13
+ stop?: string;
14
+ presencePenalty?: number;
15
+ frequencyPenalty?: number;
16
+ enableFunctionUse?: boolean;
17
+ user?: string;
18
+ numberOfChoices?: number;
19
+ endpoint?: string;
20
+ overrideModel?: string;
21
+ overrideMaxTokens?: number;
22
+ headers?: {
23
+ key: string;
24
+ value: string;
25
+ }[];
26
+ seed?: number;
27
+ toolChoice?: 'none' | 'auto' | 'function';
28
+ toolChoiceFunction?: string;
29
+ responseFormat?: '' | 'text' | 'json' | 'json_schema';
30
+ parallelFunctionCalling?: boolean;
31
+ additionalParameters?: {
32
+ key: string;
33
+ value: string;
34
+ }[];
35
+ responseSchemaName?: string;
36
+ useServerTokenCalculation?: boolean;
37
+ outputUsage?: boolean;
38
+ usePredictedOutput?: boolean;
39
+ reasoningEffort?: '' | 'low' | 'medium' | 'high';
40
+ modalitiesIncludeText?: boolean;
41
+ modalitiesIncludeAudio?: boolean;
42
+ audioVoice?: string;
43
+ audioFormat?: 'wav' | 'mp3' | 'flac' | 'opus' | 'pcm16';
44
+ };
45
+ export type ChatNodeData = ChatNodeConfigData & {
46
+ useModelInput: boolean;
47
+ useTemperatureInput: boolean;
48
+ useTopPInput: boolean;
49
+ useTopP: boolean;
50
+ useUseTopPInput: boolean;
51
+ useMaxTokensInput: boolean;
52
+ useStop: boolean;
53
+ useStopInput: boolean;
54
+ usePresencePenaltyInput: boolean;
55
+ useFrequencyPenaltyInput: boolean;
56
+ useUserInput?: boolean;
57
+ useNumberOfChoicesInput?: boolean;
58
+ useEndpointInput?: boolean;
59
+ useHeadersInput?: boolean;
60
+ useSeedInput?: boolean;
61
+ useToolChoiceInput?: boolean;
62
+ useToolChoiceFunctionInput?: boolean;
63
+ useResponseFormatInput?: boolean;
64
+ useAdditionalParametersInput?: boolean;
65
+ useResponseSchemaNameInput?: boolean;
66
+ useAudioVoiceInput?: boolean;
67
+ useAudioFormatInput?: boolean;
68
+ useReasoningEffortInput?: boolean;
69
+ /** Given the same set of inputs, return the same output without hitting GPT */
70
+ cache: boolean;
71
+ useAsGraphPartialOutput?: boolean;
72
+ };
73
+ export declare const ChatNodeBase: {
74
+ defaultData: () => ChatNodeData;
75
+ getInputDefinitions: (data: ChatNodeData) => NodeInputDefinition[];
76
+ getOutputDefinitions: (data: ChatNodeData) => NodeInputDefinition[];
77
+ getEditors: () => EditorDefinition<ChatNode>[];
78
+ getBody: (data: ChatNodeData) => string | undefined;
79
+ process: (data: ChatNodeData, node: ChartNode, inputs: Inputs, context: InternalProcessContext) => Promise<Outputs>;
80
+ };
81
+ export declare function getChatNodeMessages(inputs: Inputs): {
82
+ messages: ChatMessage[];
83
+ systemPrompt: import("../DataValue.js").DataValue | undefined;
84
+ };
85
+ export declare function getCostForTokens(tokenCount: number, type: 'prompt' | 'completion', costPerThousand: number): number;
@@ -1,13 +1,19 @@
1
1
  import { type ChartNode, type NodeInputDefinition, type NodeOutputDefinition } from '../NodeBase.js';
2
2
  import { NodeImpl, type NodeUIData } from '../NodeImpl.js';
3
- import { type DataValue } from '../DataValue.js';
4
3
  import { type EditorDefinition } from '../EditorDefinition.js';
5
4
  import { type NodeBodySpec } from '../NodeBodySpec.js';
5
+ import type { InternalProcessContext } from '../ProcessContext.js';
6
+ import type { Inputs, Outputs } from '../GraphProcessor.js';
6
7
  export type CodeNode = ChartNode<'code', CodeNodeData>;
7
8
  export type CodeNodeData = {
8
9
  code: string;
9
10
  inputNames: string | string[];
10
11
  outputNames: string | string[];
12
+ allowFetch?: boolean;
13
+ allowRequire?: boolean;
14
+ allowRivet?: boolean;
15
+ allowProcess?: boolean;
16
+ allowConsole?: boolean;
11
17
  };
12
18
  export declare class CodeNodeImpl extends NodeImpl<CodeNode> {
13
19
  static create(): CodeNode;
@@ -16,6 +22,6 @@ export declare class CodeNodeImpl extends NodeImpl<CodeNode> {
16
22
  getEditors(): EditorDefinition<CodeNode>[];
17
23
  getBody(): string | NodeBodySpec | undefined;
18
24
  static getUIData(): NodeUIData;
19
- process(inputs: Record<string, DataValue>): Promise<Record<string, DataValue>>;
25
+ process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
20
26
  }
21
27
  export declare const codeNode: import("../NodeDefinition.js").NodeDefinition<CodeNode>;
@@ -0,0 +1,34 @@
1
+ import type { ChartNode, NodeInputDefinition, NodeOutputDefinition } from '../NodeBase.js';
2
+ import type { GraphId } from '../NodeGraph.js';
3
+ import { NodeImpl, type NodeBody } from '../NodeImpl.js';
4
+ import type { EditorDefinition } from '../EditorDefinition.js';
5
+ import type { RivetUIContext } from '../RivetUIContext.js';
6
+ import type { InternalProcessContext } from '../ProcessContext.js';
7
+ import type { Inputs, Outputs } from '../GraphProcessor.js';
8
+ type ScheduleType = 'interval' | 'cron';
9
+ export type CronNode = ChartNode<'cron', CronNodeData>;
10
+ export type CronNodeData = {
11
+ targetGraph: GraphId | undefined;
12
+ scheduleType: ScheduleType;
13
+ schedule: string;
14
+ executeImmediately?: boolean;
15
+ useTargetGraphInput?: boolean;
16
+ };
17
+ export declare class CronNodeImpl extends NodeImpl<CronNode> {
18
+ static create(): CronNode;
19
+ getInputDefinitions(): NodeInputDefinition[];
20
+ getOutputDefinitions(): NodeOutputDefinition[];
21
+ static getUIData(): {
22
+ infoBoxBody: string;
23
+ infoBoxTitle: string;
24
+ contextMenuTitle: string;
25
+ group: string[];
26
+ };
27
+ getEditors(): EditorDefinition<CronNode>[];
28
+ private parseSchedule;
29
+ private getNextRunTime;
30
+ getBody(context: RivetUIContext): NodeBody;
31
+ process(inputs: Inputs, context: InternalProcessContext): Promise<Outputs>;
32
+ }
33
+ export declare const cronNode: import("../NodeDefinition.js").NodeDefinition<CronNode>;
34
+ export {};
@@ -12,6 +12,7 @@ export type DelegateFunctionCallNodeData = {
12
12
  value: GraphId;
13
13
  }[];
14
14
  unknownHandler: GraphId | undefined;
15
+ autoDelegate: boolean;
15
16
  };
16
17
  export declare class DelegateFunctionCallNodeImpl extends NodeImpl<DelegateFunctionCallNode> {
17
18
  static create(): DelegateFunctionCallNode;