@valerypopoff/rivet2-core 2.1.6 → 2.1.7
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
CHANGED
|
@@ -109,6 +109,7 @@ __export(src_exports, {
|
|
|
109
109
|
LoadDatasetNodeImpl: () => LoadDatasetNodeImpl,
|
|
110
110
|
LoopControllerNodeImpl: () => LoopControllerNodeImpl,
|
|
111
111
|
LoopUntilNodeImpl: () => LoopUntilNodeImpl,
|
|
112
|
+
MAX_PASSTHROUGH_PORT_INDEX: () => MAX_PASSTHROUGH_PORT_INDEX,
|
|
112
113
|
MCPError: () => MCPError,
|
|
113
114
|
MCPErrorType: () => MCPErrorType,
|
|
114
115
|
MCPGetPromptNodeImpl: () => MCPGetPromptNodeImpl,
|
|
@@ -200,6 +201,7 @@ __export(src_exports, {
|
|
|
200
201
|
callGraphNode: () => callGraphNode,
|
|
201
202
|
canBeCoerced: () => canBeCoerced,
|
|
202
203
|
canBeCoercedAny: () => canBeCoercedAny,
|
|
204
|
+
canRenderPassthroughAsDataBus: () => canRenderPassthroughAsDataBus,
|
|
203
205
|
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
204
206
|
chatLoopNode: () => chatLoopNode,
|
|
205
207
|
chatMessagesToModelMessages: () => chatMessagesToModelMessages,
|
|
@@ -383,6 +385,7 @@ __export(src_exports, {
|
|
|
383
385
|
isLLMChatV2StructuredResponseFormat: () => isLLMChatV2StructuredResponseFormat,
|
|
384
386
|
isNodePrefabInstanceNode: () => isNodePrefabInstanceNode,
|
|
385
387
|
isNotFunctionDataValue: () => isNotFunctionDataValue,
|
|
388
|
+
isPassthroughDataBusNode: () => isPassthroughDataBusNode,
|
|
386
389
|
isReservedKnowledgeObjectKey: () => isReservedKnowledgeObjectKey,
|
|
387
390
|
isRivetWebAppRunTerminalEvent: () => isRivetWebAppRunTerminalEvent,
|
|
388
391
|
isRuntimeDebugLoggingEnabled: () => isRuntimeDebugLoggingEnabled,
|
|
@@ -620,6 +623,7 @@ __export(exports_exports, {
|
|
|
620
623
|
LoadDatasetNodeImpl: () => LoadDatasetNodeImpl,
|
|
621
624
|
LoopControllerNodeImpl: () => LoopControllerNodeImpl,
|
|
622
625
|
LoopUntilNodeImpl: () => LoopUntilNodeImpl,
|
|
626
|
+
MAX_PASSTHROUGH_PORT_INDEX: () => MAX_PASSTHROUGH_PORT_INDEX,
|
|
623
627
|
MCPError: () => MCPError,
|
|
624
628
|
MCPErrorType: () => MCPErrorType,
|
|
625
629
|
MCPGetPromptNodeImpl: () => MCPGetPromptNodeImpl,
|
|
@@ -710,6 +714,7 @@ __export(exports_exports, {
|
|
|
710
714
|
callGraphNode: () => callGraphNode,
|
|
711
715
|
canBeCoerced: () => canBeCoerced,
|
|
712
716
|
canBeCoercedAny: () => canBeCoercedAny,
|
|
717
|
+
canRenderPassthroughAsDataBus: () => canRenderPassthroughAsDataBus,
|
|
713
718
|
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
714
719
|
chatLoopNode: () => chatLoopNode,
|
|
715
720
|
chatMessagesToModelMessages: () => chatMessagesToModelMessages,
|
|
@@ -893,6 +898,7 @@ __export(exports_exports, {
|
|
|
893
898
|
isLLMChatV2StructuredResponseFormat: () => isLLMChatV2StructuredResponseFormat,
|
|
894
899
|
isNodePrefabInstanceNode: () => isNodePrefabInstanceNode,
|
|
895
900
|
isNotFunctionDataValue: () => isNotFunctionDataValue,
|
|
901
|
+
isPassthroughDataBusNode: () => isPassthroughDataBusNode,
|
|
896
902
|
isReservedKnowledgeObjectKey: () => isReservedKnowledgeObjectKey,
|
|
897
903
|
isRivetWebAppRunTerminalEvent: () => isRivetWebAppRunTerminalEvent,
|
|
898
904
|
isRuntimeDebugLoggingEnabled: () => isRuntimeDebugLoggingEnabled,
|
|
@@ -23100,6 +23106,30 @@ var didRunNode = nodeDefinition(DidRunNodeImpl, "Did Run");
|
|
|
23100
23106
|
// src/model/nodes/PassthroughNode.ts
|
|
23101
23107
|
var import_non_secure36 = require("nanoid/non-secure");
|
|
23102
23108
|
var import_ts_dedent32 = require("ts-dedent");
|
|
23109
|
+
var INPUT_PORT_PATTERN = /^input(\d+)$/;
|
|
23110
|
+
var OUTPUT_PORT_PATTERN = /^output(\d+)$/;
|
|
23111
|
+
var MAX_PASSTHROUGH_PORT_INDEX = 1e4;
|
|
23112
|
+
function parsePositivePortIndex(portId, pattern) {
|
|
23113
|
+
const match10 = pattern.exec(portId);
|
|
23114
|
+
const index = match10 ? Number(match10[1]) : Number.NaN;
|
|
23115
|
+
return Number.isSafeInteger(index) && index > 0 && index <= MAX_PASSTHROUGH_PORT_INDEX ? index : void 0;
|
|
23116
|
+
}
|
|
23117
|
+
function getHighestConnectedSlotIndex(connections, nodeId) {
|
|
23118
|
+
let highestIndex = 0;
|
|
23119
|
+
for (const connection of connections) {
|
|
23120
|
+
const inputIndex = connection.inputNodeId === nodeId ? parsePositivePortIndex(connection.inputId, INPUT_PORT_PATTERN) : void 0;
|
|
23121
|
+
const outputIndex = connection.outputNodeId === nodeId ? parsePositivePortIndex(connection.outputId, OUTPUT_PORT_PATTERN) : void 0;
|
|
23122
|
+
highestIndex = Math.max(highestIndex, inputIndex ?? 0, outputIndex ?? 0);
|
|
23123
|
+
}
|
|
23124
|
+
return highestIndex;
|
|
23125
|
+
}
|
|
23126
|
+
function isPassthroughDataBusNode(node) {
|
|
23127
|
+
var _a;
|
|
23128
|
+
return (node == null ? void 0 : node.type) === "passthrough" && ((_a = node.data) == null ? void 0 : _a.renderAsDataBus) === true;
|
|
23129
|
+
}
|
|
23130
|
+
function canRenderPassthroughAsDataBus(node) {
|
|
23131
|
+
return isPassthroughDataBusNode(node) && !node.isConditional && !node.isSplitRun;
|
|
23132
|
+
}
|
|
23103
23133
|
var PassthroughNodeImpl = class extends NodeImpl {
|
|
23104
23134
|
static create = () => {
|
|
23105
23135
|
const chartNode = {
|
|
@@ -23117,7 +23147,10 @@ var PassthroughNodeImpl = class extends NodeImpl {
|
|
|
23117
23147
|
};
|
|
23118
23148
|
getInputDefinitions(connections) {
|
|
23119
23149
|
const inputs = [];
|
|
23120
|
-
const inputCount =
|
|
23150
|
+
const inputCount = Math.min(
|
|
23151
|
+
getHighestConnectedSlotIndex(connections, this.chartNode.id) + 1,
|
|
23152
|
+
MAX_PASSTHROUGH_PORT_INDEX
|
|
23153
|
+
);
|
|
23121
23154
|
for (let i = 1; i <= inputCount; i++) {
|
|
23122
23155
|
inputs.push({
|
|
23123
23156
|
dataType: "any",
|
|
@@ -23129,8 +23162,8 @@ var PassthroughNodeImpl = class extends NodeImpl {
|
|
|
23129
23162
|
}
|
|
23130
23163
|
getOutputDefinitions(connections) {
|
|
23131
23164
|
const outputs = [];
|
|
23132
|
-
const
|
|
23133
|
-
for (let i = 1; i <=
|
|
23165
|
+
const outputCount = getHighestConnectedSlotIndex(connections, this.chartNode.id);
|
|
23166
|
+
for (let i = 1; i <= outputCount; i++) {
|
|
23134
23167
|
outputs.push({
|
|
23135
23168
|
dataType: "any",
|
|
23136
23169
|
id: `output${i}`,
|
|
@@ -23150,11 +23183,12 @@ var PassthroughNodeImpl = class extends NodeImpl {
|
|
|
23150
23183
|
};
|
|
23151
23184
|
}
|
|
23152
23185
|
async process(inputData) {
|
|
23153
|
-
const inputCount = Object.keys(inputData).filter((key) => key.startsWith("input")).length;
|
|
23154
23186
|
const outputs = {};
|
|
23155
|
-
for (
|
|
23156
|
-
const
|
|
23157
|
-
|
|
23187
|
+
for (const [portId, input] of Object.entries(inputData)) {
|
|
23188
|
+
const index = parsePositivePortIndex(portId, INPUT_PORT_PATTERN);
|
|
23189
|
+
if (index != null) {
|
|
23190
|
+
outputs[`output${index}`] = input;
|
|
23191
|
+
}
|
|
23158
23192
|
}
|
|
23159
23193
|
return outputs;
|
|
23160
23194
|
}
|
|
@@ -39484,6 +39518,7 @@ var Rivet = void 0;
|
|
|
39484
39518
|
LoadDatasetNodeImpl,
|
|
39485
39519
|
LoopControllerNodeImpl,
|
|
39486
39520
|
LoopUntilNodeImpl,
|
|
39521
|
+
MAX_PASSTHROUGH_PORT_INDEX,
|
|
39487
39522
|
MCPError,
|
|
39488
39523
|
MCPErrorType,
|
|
39489
39524
|
MCPGetPromptNodeImpl,
|
|
@@ -39575,6 +39610,7 @@ var Rivet = void 0;
|
|
|
39575
39610
|
callGraphNode,
|
|
39576
39611
|
canBeCoerced,
|
|
39577
39612
|
canBeCoercedAny,
|
|
39613
|
+
canRenderPassthroughAsDataBus,
|
|
39578
39614
|
canUseNodeAsPrefabSource,
|
|
39579
39615
|
chatLoopNode,
|
|
39580
39616
|
chatMessagesToModelMessages,
|
|
@@ -39758,6 +39794,7 @@ var Rivet = void 0;
|
|
|
39758
39794
|
isLLMChatV2StructuredResponseFormat,
|
|
39759
39795
|
isNodePrefabInstanceNode,
|
|
39760
39796
|
isNotFunctionDataValue,
|
|
39797
|
+
isPassthroughDataBusNode,
|
|
39761
39798
|
isReservedKnowledgeObjectKey,
|
|
39762
39799
|
isRivetWebAppRunTerminalEvent,
|
|
39763
39800
|
isRuntimeDebugLoggingEnabled,
|