@valerypopoff/rivet2-core 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/bundle.cjs +65 -34
- package/dist/cjs/bundle.cjs.map +2 -2
- package/dist/esm/model/GraphProcessor.js +34 -21
- package/dist/esm/model/RecordingPlayer.js +20 -2
- package/dist/esm/model/StreamingOutputWatchHistory.js +1 -0
- package/dist/esm/model/nodes/ChatLoopNode.js +8 -4
- package/dist/esm/model/nodes/CodeNewNode.js +1 -1
- package/dist/esm/model/nodes/ExpressionNode.js +1 -1
- package/dist/esm/model/nodes/LoopControllerNode.js +6 -4
- package/dist/esm/recording/ExecutionRecorder.js +2 -1
- package/dist/types/model/ExecutorProtocol.d.ts +1 -0
- package/dist/types/model/GraphProcessor.d.ts +2 -0
- package/dist/types/model/StreamingOutputWatchHistory.d.ts +2 -0
- package/dist/types/model/nodes/ChatLoopNode.d.ts +2 -0
- package/dist/types/model/nodes/LoopControllerNode.d.ts +2 -0
- package/dist/types/recording/RecordedEvents.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/bundle.cjs
CHANGED
|
@@ -239,6 +239,7 @@ __export(src_exports, {
|
|
|
239
239
|
canConsumeControlFlowExcludedInput: () => canConsumeControlFlowExcludedInput,
|
|
240
240
|
canRenderDataBusNode: () => canRenderDataBusNode,
|
|
241
241
|
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
242
|
+
chatLoopLegacyDisplayName: () => chatLoopLegacyDisplayName,
|
|
242
243
|
chatLoopNode: () => chatLoopNode,
|
|
243
244
|
chatMessagesToModelMessages: () => chatMessagesToModelMessages,
|
|
244
245
|
chatNode: () => chatNode,
|
|
@@ -502,6 +503,7 @@ __export(src_exports, {
|
|
|
502
503
|
logRuntimeError: () => logRuntimeError,
|
|
503
504
|
logRuntimeInfo: () => logRuntimeInfo,
|
|
504
505
|
logRuntimeWarn: () => logRuntimeWarn,
|
|
506
|
+
loopControllerLegacyDisplayName: () => loopControllerLegacyDisplayName,
|
|
505
507
|
loopControllerNode: () => loopControllerNode,
|
|
506
508
|
loopUntilNode: () => loopUntilNode,
|
|
507
509
|
looseDataValueToDataValue: () => looseDataValueToDataValue,
|
|
@@ -892,6 +894,7 @@ __export(exports_exports, {
|
|
|
892
894
|
canConsumeControlFlowExcludedInput: () => canConsumeControlFlowExcludedInput,
|
|
893
895
|
canRenderDataBusNode: () => canRenderDataBusNode,
|
|
894
896
|
canUseNodeAsPrefabSource: () => canUseNodeAsPrefabSource,
|
|
897
|
+
chatLoopLegacyDisplayName: () => chatLoopLegacyDisplayName,
|
|
895
898
|
chatLoopNode: () => chatLoopNode,
|
|
896
899
|
chatMessagesToModelMessages: () => chatMessagesToModelMessages,
|
|
897
900
|
chatNode: () => chatNode,
|
|
@@ -1155,6 +1158,7 @@ __export(exports_exports, {
|
|
|
1155
1158
|
logRuntimeError: () => logRuntimeError,
|
|
1156
1159
|
logRuntimeInfo: () => logRuntimeInfo,
|
|
1157
1160
|
logRuntimeWarn: () => logRuntimeWarn,
|
|
1161
|
+
loopControllerLegacyDisplayName: () => loopControllerLegacyDisplayName,
|
|
1158
1162
|
loopControllerNode: () => loopControllerNode,
|
|
1159
1163
|
loopUntilNode: () => loopUntilNode,
|
|
1160
1164
|
looseDataValueToDataValue: () => looseDataValueToDataValue,
|
|
@@ -7819,6 +7823,7 @@ async function replayExecutionRecording(options2) {
|
|
|
7819
7823
|
outputs: data.outputs,
|
|
7820
7824
|
processId: data.processId,
|
|
7821
7825
|
...data.resultOrigin === void 0 ? {} : { resultOrigin: data.resultOrigin },
|
|
7826
|
+
...data.streamingWatchTerminal ? { streamingWatchTerminal: true } : {},
|
|
7822
7827
|
execution
|
|
7823
7828
|
},
|
|
7824
7829
|
getRecordedDuration(
|
|
@@ -7895,10 +7900,22 @@ async function replayExecutionRecording(options2) {
|
|
|
7895
7900
|
}
|
|
7896
7901
|
case "streamingOutputWatchSummary": {
|
|
7897
7902
|
const { data } = event;
|
|
7903
|
+
const execution = getExecution(((_i = data.execution) == null ? void 0 : _i.graphId) ?? getGraphIdForNode(data.watchNodeId), data.execution);
|
|
7904
|
+
const selectedIteration = data.summary.selectedIteration;
|
|
7905
|
+
const summary = (selectedIteration == null ? void 0 : selectedIteration.graphRunId) != null && data.execution != null ? {
|
|
7906
|
+
...data.summary,
|
|
7907
|
+
selectedIteration: {
|
|
7908
|
+
...selectedIteration,
|
|
7909
|
+
graphRunId: getReplayExecution({
|
|
7910
|
+
...data.execution,
|
|
7911
|
+
graphRunId: selectedIteration.graphRunId
|
|
7912
|
+
}).graphRunId
|
|
7913
|
+
}
|
|
7914
|
+
} : data.summary;
|
|
7898
7915
|
emitReplayExecutionEvent("streamingOutputWatchSummary", {
|
|
7899
7916
|
watchNode: getNode(data.watchNodeId),
|
|
7900
|
-
summary
|
|
7901
|
-
execution
|
|
7917
|
+
summary,
|
|
7918
|
+
execution
|
|
7902
7919
|
});
|
|
7903
7920
|
break;
|
|
7904
7921
|
}
|
|
@@ -10164,6 +10181,7 @@ var StreamingOutputWatchHistory = class {
|
|
|
10164
10181
|
omittedIterations: this.#startedIterations - retainedIterationUpdateIndexes.length,
|
|
10165
10182
|
retainedIterationUpdateIndexes,
|
|
10166
10183
|
selectedIteration: selected == null ? void 0 : {
|
|
10184
|
+
graphRunId: selected.graphRunId,
|
|
10167
10185
|
updateIndex: selected.updateIndex,
|
|
10168
10186
|
reason: selected === this.#firstFailure ? "failure" : selected === this.#stopWinner ? "stop" : "latest"
|
|
10169
10187
|
}
|
|
@@ -12986,11 +13004,9 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
12986
13004
|
emitDetached(this.#emitter, event, this.#withExecution(data));
|
|
12987
13005
|
return;
|
|
12988
13006
|
}
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
}
|
|
12993
|
-
});
|
|
13007
|
+
const stopClaim = event === "nodeFinish" ? this.#claimStreamingWatchStopFromInvocation(node, data.outputs) : void 0;
|
|
13008
|
+
const eventData = event === "nodeFinish" && stopClaim ? { ...data, streamingWatchTerminal: true } : data;
|
|
13009
|
+
return this.#emitter.emit(event, this.#withExecution(eventData)).then(() => stopClaim == null ? void 0 : stopClaim.commit());
|
|
12994
13010
|
},
|
|
12995
13011
|
startNodeTiming: this.#captureNodeTimings ? () => this.#startNodeTiming() : void 0,
|
|
12996
13012
|
finishNodeTiming: this.#captureNodeTimings ? (start) => this.#finishNodeTiming(start) : void 0
|
|
@@ -13083,6 +13099,7 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
13083
13099
|
this.#visitedNodes.add(node.id);
|
|
13084
13100
|
this.#accumulateCost(outputValues);
|
|
13085
13101
|
this.#assertStreamingOutputWatchFinalOutputs(node, outputValues);
|
|
13102
|
+
const stopClaim = this.#claimStreamingWatchStopFromInvocation(node, outputValues);
|
|
13086
13103
|
await this.#emitter.emit(
|
|
13087
13104
|
"nodeFinish",
|
|
13088
13105
|
this.#withExecution(
|
|
@@ -13091,14 +13108,15 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
13091
13108
|
node,
|
|
13092
13109
|
outputs: outputValues,
|
|
13093
13110
|
processId,
|
|
13094
|
-
resultOrigin
|
|
13111
|
+
resultOrigin,
|
|
13112
|
+
...stopClaim ? { streamingWatchTerminal: true } : {}
|
|
13095
13113
|
},
|
|
13096
13114
|
this.#finishNodeTiming(timingStart)
|
|
13097
13115
|
)
|
|
13098
13116
|
)
|
|
13099
13117
|
);
|
|
13100
13118
|
this.#finishStreamingOutputWatches(node, outputValues);
|
|
13101
|
-
|
|
13119
|
+
stopClaim == null ? void 0 : stopClaim.commit();
|
|
13102
13120
|
} catch (error) {
|
|
13103
13121
|
await this.#nodeErrored(
|
|
13104
13122
|
node,
|
|
@@ -14242,7 +14260,7 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
14242
14260
|
processor.#streamingWatchInvocation = {
|
|
14243
14261
|
plan,
|
|
14244
14262
|
historyIteration,
|
|
14245
|
-
|
|
14263
|
+
claimStop: (value) => this.#claimAcceptedStreamingWatchStop(plan, historyIteration, value, snapshot.updateIndex),
|
|
14246
14264
|
stopReached: false
|
|
14247
14265
|
};
|
|
14248
14266
|
processor.preloadNodeData(plan.watchNode.id, this.#materializeStreamingOutputWatchSnapshot(snapshot));
|
|
@@ -14315,21 +14333,22 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
14315
14333
|
root.#subprocessors.delete(processor);
|
|
14316
14334
|
}
|
|
14317
14335
|
}
|
|
14318
|
-
#
|
|
14336
|
+
#claimStreamingWatchStopFromInvocation(node, outputs) {
|
|
14319
14337
|
const invocation = this.#streamingWatchInvocation;
|
|
14320
14338
|
const completedValue = outputs["value"];
|
|
14321
14339
|
if ((invocation == null ? void 0 : invocation.plan.stopNodeId) === node.id && invocation.stopReached && completedValue !== void 0 && !this.#getUnhandledErroredNodes().length) {
|
|
14322
|
-
invocation.
|
|
14340
|
+
return invocation.claimStop(completedValue);
|
|
14323
14341
|
}
|
|
14342
|
+
return void 0;
|
|
14324
14343
|
}
|
|
14325
|
-
#
|
|
14344
|
+
#claimAcceptedStreamingWatchStop(plan, historyIteration, value, updateIndex) {
|
|
14326
14345
|
const stopNodeId = plan.stopNodeId;
|
|
14327
14346
|
if (!stopNodeId) {
|
|
14328
|
-
return;
|
|
14347
|
+
return void 0;
|
|
14329
14348
|
}
|
|
14330
14349
|
const watch = this.#streamingOutputWatches.get(plan.watchNode.id);
|
|
14331
14350
|
if (!watch || watch.stopped) {
|
|
14332
|
-
return;
|
|
14351
|
+
return void 0;
|
|
14333
14352
|
}
|
|
14334
14353
|
plan.history.acceptStop(historyIteration);
|
|
14335
14354
|
watch.stop(updateIndex);
|
|
@@ -14338,13 +14357,20 @@ ${errors.map(({ node }) => `- ${node.title} (${node.id})`).join("\n")}`;
|
|
|
14338
14357
|
throw new Error(`Watch Streaming Output "${plan.watchNode.title}" lost its Stop Watching Streaming Output node.`);
|
|
14339
14358
|
}
|
|
14340
14359
|
const acceptedValue = cloneExecutionOutputs({ ["value"]: value })["value"];
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14360
|
+
let committed = false;
|
|
14361
|
+
return {
|
|
14362
|
+
commit: () => {
|
|
14363
|
+
if (committed) return;
|
|
14364
|
+
committed = true;
|
|
14365
|
+
this.#nodeResults.set(stopNode.id, { ["value"]: acceptedValue });
|
|
14366
|
+
this.#visitedNodes.add(stopNode.id);
|
|
14367
|
+
this.#remainingNodes.delete(stopNode.id);
|
|
14368
|
+
const attachedData = this.#getAttachedDataTo(stopNode);
|
|
14369
|
+
const outputNodes = getOutputNodesFrom(this.#executionState, stopNode);
|
|
14370
|
+
this.#propagateAttachedDataToOutputNodes(stopNode, attachedData, outputNodes.connectionsToNodes);
|
|
14371
|
+
this.#queueOutputNodes(stopNode, outputNodes.nodes);
|
|
14372
|
+
}
|
|
14373
|
+
};
|
|
14348
14374
|
}
|
|
14349
14375
|
#cancelStreamingOutputWatchesForSource(nodeId) {
|
|
14350
14376
|
var _a;
|
|
@@ -28428,7 +28454,7 @@ var CodeNewNodeImpl = class extends NodeImpl {
|
|
|
28428
28454
|
`,
|
|
28429
28455
|
infoBoxTitle: "Code Node",
|
|
28430
28456
|
contextMenuTitle: "Code",
|
|
28431
|
-
group: ["
|
|
28457
|
+
group: ["Code"]
|
|
28432
28458
|
};
|
|
28433
28459
|
}
|
|
28434
28460
|
async process(inputs, context) {
|
|
@@ -28571,7 +28597,7 @@ var ExpressionNodeImpl = class extends NodeImpl {
|
|
|
28571
28597
|
`,
|
|
28572
28598
|
infoBoxTitle: "Expression Node",
|
|
28573
28599
|
contextMenuTitle: "Expression",
|
|
28574
|
-
group: ["
|
|
28600
|
+
group: ["Code"]
|
|
28575
28601
|
};
|
|
28576
28602
|
}
|
|
28577
28603
|
async process(inputs, context) {
|
|
@@ -30478,11 +30504,12 @@ var extractYamlNode = nodeDefinition(ExtractYamlNodeImpl, "Extract YAML");
|
|
|
30478
30504
|
// src/model/nodes/LoopControllerNode.ts
|
|
30479
30505
|
var import_non_secure31 = require("nanoid/non-secure");
|
|
30480
30506
|
var import_ts_dedent25 = require("ts-dedent");
|
|
30507
|
+
var loopControllerLegacyDisplayName = "Loop Controller (legacy)";
|
|
30481
30508
|
var LoopControllerNodeImpl = class extends NodeImpl {
|
|
30482
30509
|
static create() {
|
|
30483
30510
|
const chartNode = {
|
|
30484
30511
|
type: "loopController",
|
|
30485
|
-
title:
|
|
30512
|
+
title: loopControllerLegacyDisplayName,
|
|
30486
30513
|
id: (0, import_non_secure31.nanoid)(),
|
|
30487
30514
|
visualData: {
|
|
30488
30515
|
x: 0,
|
|
@@ -30594,8 +30621,8 @@ var LoopControllerNodeImpl = class extends NodeImpl {
|
|
|
30594
30621
|
|
|
30595
30622
|
If the "continue" input is falsey, then the "break" output will run.
|
|
30596
30623
|
`,
|
|
30597
|
-
infoBoxTitle:
|
|
30598
|
-
contextMenuTitle:
|
|
30624
|
+
infoBoxTitle: `${loopControllerLegacyDisplayName} Node`,
|
|
30625
|
+
contextMenuTitle: loopControllerLegacyDisplayName,
|
|
30599
30626
|
group: ["Logic"]
|
|
30600
30627
|
};
|
|
30601
30628
|
}
|
|
@@ -30658,7 +30685,7 @@ var LoopControllerNodeImpl = class extends NodeImpl {
|
|
|
30658
30685
|
return output;
|
|
30659
30686
|
}
|
|
30660
30687
|
};
|
|
30661
|
-
var loopControllerNode = nodeDefinition(LoopControllerNodeImpl,
|
|
30688
|
+
var loopControllerNode = nodeDefinition(LoopControllerNodeImpl, loopControllerLegacyDisplayName);
|
|
30662
30689
|
|
|
30663
30690
|
// src/model/nodes/TrimChatMessagesNode.ts
|
|
30664
30691
|
var import_non_secure32 = require("nanoid/non-secure");
|
|
@@ -38468,11 +38495,12 @@ var documentNode = nodeDefinition(DocumentNodeImpl, "Document");
|
|
|
38468
38495
|
// src/model/nodes/ChatLoopNode.ts
|
|
38469
38496
|
var import_non_secure93 = require("nanoid/non-secure");
|
|
38470
38497
|
var import_ts_dedent79 = require("ts-dedent");
|
|
38498
|
+
var chatLoopLegacyDisplayName = "Chat Loop (legacy)";
|
|
38471
38499
|
var ChatLoopNodeImpl = class extends NodeImpl {
|
|
38472
38500
|
static create() {
|
|
38473
38501
|
const chartNode = {
|
|
38474
38502
|
type: "chatLoop",
|
|
38475
|
-
title:
|
|
38503
|
+
title: chatLoopLegacyDisplayName,
|
|
38476
38504
|
id: (0, import_non_secure93.nanoid)(),
|
|
38477
38505
|
visualData: {
|
|
38478
38506
|
x: 0,
|
|
@@ -38515,8 +38543,8 @@ var ChatLoopNodeImpl = class extends NodeImpl {
|
|
|
38515
38543
|
|
|
38516
38544
|
The conversation history is maintained and sent with each new message.
|
|
38517
38545
|
`,
|
|
38518
|
-
contextMenuTitle:
|
|
38519
|
-
infoBoxTitle:
|
|
38546
|
+
contextMenuTitle: chatLoopLegacyDisplayName,
|
|
38547
|
+
infoBoxTitle: `${chatLoopLegacyDisplayName} Node`,
|
|
38520
38548
|
group: ["Convenience"]
|
|
38521
38549
|
};
|
|
38522
38550
|
}
|
|
@@ -38603,7 +38631,7 @@ var ChatLoopNodeImpl = class extends NodeImpl {
|
|
|
38603
38631
|
};
|
|
38604
38632
|
}
|
|
38605
38633
|
};
|
|
38606
|
-
var chatLoopNode = nodeDefinition(ChatLoopNodeImpl,
|
|
38634
|
+
var chatLoopNode = nodeDefinition(ChatLoopNodeImpl, chatLoopLegacyDisplayName);
|
|
38607
38635
|
|
|
38608
38636
|
// src/model/nodes/ReadAllFilesNode.ts
|
|
38609
38637
|
var import_non_secure94 = require("nanoid/non-secure");
|
|
@@ -41121,13 +41149,14 @@ var toRecordedEventMap = {
|
|
|
41121
41149
|
},
|
|
41122
41150
|
execution
|
|
41123
41151
|
),
|
|
41124
|
-
nodeFinish: ({ node, outputs, processId, resultOrigin, durationMs, splitRunDurationMs, execution }) => withExecution(
|
|
41152
|
+
nodeFinish: ({ node, outputs, processId, resultOrigin, durationMs, splitRunDurationMs, streamingWatchTerminal, execution }) => withExecution(
|
|
41125
41153
|
withDuration(
|
|
41126
41154
|
{
|
|
41127
41155
|
nodeId: node.id,
|
|
41128
41156
|
outputs,
|
|
41129
41157
|
processId,
|
|
41130
|
-
...resultOrigin === void 0 ? {} : { resultOrigin }
|
|
41158
|
+
...resultOrigin === void 0 ? {} : { resultOrigin },
|
|
41159
|
+
...streamingWatchTerminal ? { streamingWatchTerminal: true } : {}
|
|
41131
41160
|
},
|
|
41132
41161
|
durationMs,
|
|
41133
41162
|
splitRunDurationMs
|
|
@@ -48394,6 +48423,7 @@ var Rivet = void 0;
|
|
|
48394
48423
|
canConsumeControlFlowExcludedInput,
|
|
48395
48424
|
canRenderDataBusNode,
|
|
48396
48425
|
canUseNodeAsPrefabSource,
|
|
48426
|
+
chatLoopLegacyDisplayName,
|
|
48397
48427
|
chatLoopNode,
|
|
48398
48428
|
chatMessagesToModelMessages,
|
|
48399
48429
|
chatNode,
|
|
@@ -48657,6 +48687,7 @@ var Rivet = void 0;
|
|
|
48657
48687
|
logRuntimeError,
|
|
48658
48688
|
logRuntimeInfo,
|
|
48659
48689
|
logRuntimeWarn,
|
|
48690
|
+
loopControllerLegacyDisplayName,
|
|
48660
48691
|
loopControllerNode,
|
|
48661
48692
|
loopUntilNode,
|
|
48662
48693
|
looseDataValueToDataValue,
|