@alpic80/rivet-core 1.24.2-aidon.1 → 1.24.2-aidon.2
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 +18 -1
- package/dist/cjs/bundle.cjs.map +2 -2
- package/dist/esm/api/streaming.js +17 -2
- package/package.json +2 -2
|
@@ -9,12 +9,14 @@ function nodeMatches(spec, event) {
|
|
|
9
9
|
export async function* getProcessorEvents(processor, spec) {
|
|
10
10
|
const previousIndexes = new Map();
|
|
11
11
|
const usages = [];
|
|
12
|
+
let hasDelta = false;
|
|
12
13
|
for await (const event of processor.events()) {
|
|
13
14
|
if (event.type === 'partialOutput') {
|
|
14
15
|
if (spec.partialOutputs === true ||
|
|
15
16
|
nodeMatches(spec.partialOutputs, event)) {
|
|
16
17
|
const currentOutput = coerceType(event.outputs['response'], 'string');
|
|
17
18
|
const delta = currentOutput.slice(previousIndexes.get(event.node.id) ?? 0);
|
|
19
|
+
hasDelta = true;
|
|
18
20
|
yield {
|
|
19
21
|
type: 'partialOutput',
|
|
20
22
|
nodeId: event.node.id,
|
|
@@ -76,8 +78,8 @@ export async function* getProcessorEvents(processor, spec) {
|
|
|
76
78
|
usages.push(usage);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
if (spec.nodeFinish === true ||
|
|
80
|
-
|
|
81
|
+
if ((spec.nodeFinish === true || nodeMatches(spec.nodeFinish, event)) &&
|
|
82
|
+
!(spec.removeFinalOutput && hasDelta)) {
|
|
81
83
|
yield {
|
|
82
84
|
type: 'nodeFinish',
|
|
83
85
|
outputs: event.outputs,
|
|
@@ -159,6 +161,19 @@ export function getSingleNodeStream(processor, arg) {
|
|
|
159
161
|
return new ReadableStream({
|
|
160
162
|
async start(controller) {
|
|
161
163
|
try {
|
|
164
|
+
const userEventHandler = async (eventName, data) => {
|
|
165
|
+
const payload = {
|
|
166
|
+
name: eventName,
|
|
167
|
+
message: coerceType(data, 'string')
|
|
168
|
+
};
|
|
169
|
+
controller.enqueue(`event: ${JSON.stringify(payload)}\n\n`);
|
|
170
|
+
};
|
|
171
|
+
const streamEvents = createOnStreamUserEvents(spec.userStreamEvents, userEventHandler);
|
|
172
|
+
if (streamEvents) {
|
|
173
|
+
for (const [name, fn] of Object.entries(streamEvents)) {
|
|
174
|
+
processor.onUserEvent(name, fn);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
162
177
|
for await (const event of getProcessorEvents(processor, spec)) {
|
|
163
178
|
if (event.type === 'partialOutput') { //nodeIdOrTitle filter managed by spec
|
|
164
179
|
controller.enqueue(`data: ${JSON.stringify(event.delta)}\n\n`);
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@alpic80/rivet-core",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"repository": "https://github.com/castortech/rivet",
|
|
5
|
-
"version": "1.24.2-aidon.
|
|
5
|
+
"version": "1.24.2-aidon.2",
|
|
6
6
|
"packageManager": "yarn@3.5.0",
|
|
7
7
|
"main": "dist/cjs/bundle.cjs",
|
|
8
8
|
"module": "dist/esm/index.js",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@google-cloud/vertexai": "^0.1.3",
|
|
49
49
|
"@google/genai": "^0.12.0",
|
|
50
50
|
"@huggingface/inference": "^2.6.4",
|
|
51
|
-
"@ironclad/rivet-core": "npm:@alpic80/rivet-core@1.24.2-aidon.
|
|
51
|
+
"@ironclad/rivet-core": "npm:@alpic80/rivet-core@1.24.2-aidon.2",
|
|
52
52
|
"assemblyai": "^4.6.0",
|
|
53
53
|
"autoevals": "^0.0.26",
|
|
54
54
|
"cron-parser": "^4.9.0",
|