@valerypopoff/rivet2-core 2.6.0 → 2.7.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 +2735 -767
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +7 -3
- package/dist/cjs/interpolationRuntime.cjs.map +2 -2
- package/dist/esm/api/createProcessor.js +3 -0
- package/dist/esm/exports.js +2 -1
- package/dist/esm/integrations/CodeRunner.js +6 -2
- package/dist/esm/integrations/mcp/MCPBase.js +2 -1
- package/dist/esm/model/ExecutionOutputClone.js +46 -0
- package/dist/esm/model/GlobalVariables.js +452 -0
- package/dist/esm/model/GraphBoundaryEffects.js +12 -4
- package/dist/esm/model/GraphProcessor.js +825 -41
- package/dist/esm/model/Nodes.js +6 -0
- package/dist/esm/model/ProcessContextBuilder.js +3 -1
- package/dist/esm/model/ProjectReferenceLoader.js +36 -1
- package/dist/esm/model/RecordingPlayer.js +21 -4
- package/dist/esm/model/StreamingOutputWatch.js +262 -0
- package/dist/esm/model/StreamingOutputWatchHistory.js +161 -0
- package/dist/esm/model/SubprocessorBridge.js +29 -19
- package/dist/esm/model/chat-v2/llmChatV2OutputClone.js +3 -42
- package/dist/esm/model/nodes/CodeNewNode.js +4 -1
- package/dist/esm/model/nodes/ExpressionNode.js +4 -1
- package/dist/esm/model/nodes/ExtractObjectPathNode.js +4 -4
- package/dist/esm/model/nodes/GraphOutputNode.js +13 -8
- package/dist/esm/model/nodes/MCPGetPromptNode.js +2 -1
- package/dist/esm/model/nodes/MCPToolCallNode.js +2 -1
- package/dist/esm/model/nodes/ObjectNode.js +5 -3
- package/dist/esm/model/nodes/PromptNode.js +5 -2
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +9 -1
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +48 -0
- package/dist/esm/model/nodes/SubGraphNode.js +11 -1
- package/dist/esm/model/nodes/TextNode.js +5 -2
- package/dist/esm/model/nodes/ToTreeNode.js +10 -3
- package/dist/esm/model/nodes/ToolNode.js +5 -2
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +126 -0
- package/dist/esm/model/nodes/jsListCallbackHelpers.js +7 -1
- package/dist/esm/model/nodes/jsValueInterpolation.js +21 -4
- package/dist/esm/plugins/openai/nodes/ThreadMessageNode.js +2 -1
- package/dist/esm/recording/ExecutionRecorder.js +16 -7
- package/dist/esm/utils/interpolation.js +35 -2
- package/dist/esm/utils/serialization/serializationUtils.js +9 -0
- package/dist/esm/utils/serialization/serialization_v4.js +7 -0
- package/dist/types/exports.d.ts +2 -1
- package/dist/types/integrations/CodeRunner.d.ts +3 -3
- package/dist/types/integrations/CodeRunnerOptions.d.ts +5 -0
- package/dist/types/integrations/mcp/MCPBase.d.ts +1 -1
- package/dist/types/model/ExecutionOutputClone.d.ts +11 -0
- package/dist/types/model/ExecutorProtocol.d.ts +8 -2
- package/dist/types/model/GlobalVariables.d.ts +29 -0
- package/dist/types/model/GraphBoundaryEffects.d.ts +7 -1
- package/dist/types/model/GraphProcessor.d.ts +47 -3
- package/dist/types/model/Nodes.d.ts +4 -2
- package/dist/types/model/ProcessContext.d.ts +14 -0
- package/dist/types/model/ProcessContextBuilder.d.ts +3 -1
- package/dist/types/model/Project.d.ts +7 -1
- package/dist/types/model/ProjectReferenceLoader.d.ts +15 -1
- package/dist/types/model/StreamingOutputWatch.d.ts +74 -0
- package/dist/types/model/StreamingOutputWatchHistory.d.ts +58 -0
- package/dist/types/model/SubprocessorBridge.d.ts +2 -0
- package/dist/types/model/chat-v2/llmChatV2OutputClone.d.ts +3 -3
- package/dist/types/model/nodes/ExtractObjectPathNode.d.ts +1 -1
- package/dist/types/model/nodes/GraphOutputNode.d.ts +8 -1
- package/dist/types/model/nodes/ObjectNode.d.ts +1 -1
- package/dist/types/model/nodes/StopWatchingStreamingOutputNode.d.ts +14 -0
- package/dist/types/model/nodes/ToTreeNode.d.ts +5 -1
- package/dist/types/model/nodes/WatchStreamingOutputNode.d.ts +17 -0
- package/dist/types/model/nodes/jsValueInterpolation.d.ts +10 -1
- package/dist/types/recording/RecordedEvents.d.ts +7 -0
- package/dist/types/utils/interpolation.d.ts +14 -5
- package/package.json +1 -1
|
@@ -2,7 +2,8 @@ import { dedent } from 'ts-dedent';
|
|
|
2
2
|
import { createInterpolationInputDefinition } from '../interpolationInputDefinition.js';
|
|
3
3
|
import { getError } from '../../utils/errors.js';
|
|
4
4
|
import { extractInterpolationVariables, parseInterpolationTemplate, replaceInterpolationTokens, resolveInterpolationExpressionRawValue, } from '../../utils/interpolation.js';
|
|
5
|
-
const MISSING_INTERPOLATION_HELPER_MESSAGE = 'This CodeRunner must honor CodeRunnerOptions.interpolationHelperIdentifier to resolve JSONPath or @graphInputs/@context interpolation.';
|
|
5
|
+
const MISSING_INTERPOLATION_HELPER_MESSAGE = 'This CodeRunner must honor CodeRunnerOptions.interpolationHelperIdentifier to resolve JSONPath or @graphInputs/@context/@globals interpolation.';
|
|
6
|
+
const MISSING_GLOBAL_VALUES_MESSAGE = 'This CodeRunner must honor CodeRunnerOptions.globalValuesIdentifier to resolve @globals interpolation.';
|
|
6
7
|
function escapeRegExp(value) {
|
|
7
8
|
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
8
9
|
}
|
|
@@ -41,7 +42,7 @@ function buildJsValueReference(token, interpolationContext, options) {
|
|
|
41
42
|
const sourceInputs = isLocalReference
|
|
42
43
|
? `{ ${JSON.stringify(token.reference.baseName)}: { type: 'any', value: ${token.reference.baseName} } }`
|
|
43
44
|
: interpolationContext.inputsIdentifier;
|
|
44
|
-
const resolveExpression = `${interpolationContext.interpolationHelperIdentifier}(${sourceInputs}, ${JSON.stringify(token.tokenName)}, ${interpolationContext.graphInputsIdentifier}, ${interpolationContext.contextIdentifier})`;
|
|
45
|
+
const resolveExpression = `${interpolationContext.interpolationHelperIdentifier}(${sourceInputs}, ${JSON.stringify(token.tokenName)}, ${interpolationContext.graphInputsIdentifier}, ${interpolationContext.contextIdentifier}, ${interpolationContext.globalValuesCloneIdentifier})`;
|
|
45
46
|
return `(typeof ${interpolationContext.interpolationHelperIdentifier} === 'function'
|
|
46
47
|
? ${resolveExpression}
|
|
47
48
|
: (() => { throw new Error(${JSON.stringify(MISSING_INTERPOLATION_HELPER_MESSAGE)}); })())`;
|
|
@@ -84,6 +85,8 @@ export function getJsValueInterpolationRuntimeContext(template, baseInputsIdenti
|
|
|
84
85
|
const cloneCacheIdentifier = getSafeJsValueInterpolationIdentifier(`${template}\n${inputsIdentifier}\n${interpolationHelperIdentifier}`, `${baseInputsIdentifier}CloneCache`);
|
|
85
86
|
const graphInputsIdentifier = getSafeJsValueInterpolationIdentifier(`${template}\n${inputsIdentifier}\n${interpolationHelperIdentifier}\n${cloneCacheIdentifier}`, `${baseInputsIdentifier}GraphInputs`);
|
|
86
87
|
const contextIdentifier = getSafeJsValueInterpolationIdentifier(`${template}\n${inputsIdentifier}\n${interpolationHelperIdentifier}\n${cloneCacheIdentifier}\n${graphInputsIdentifier}`, `${baseInputsIdentifier}Context`);
|
|
88
|
+
const globalValuesIdentifier = getSafeJsValueInterpolationIdentifier(`${template}\n${inputsIdentifier}\n${interpolationHelperIdentifier}\n${cloneCacheIdentifier}\n${graphInputsIdentifier}\n${contextIdentifier}`, `${baseInputsIdentifier}Globals`);
|
|
89
|
+
const globalValuesCloneIdentifier = getSafeJsValueInterpolationIdentifier(`${template}\n${inputsIdentifier}\n${interpolationHelperIdentifier}\n${cloneCacheIdentifier}\n${graphInputsIdentifier}\n${contextIdentifier}\n${globalValuesIdentifier}`, `${baseInputsIdentifier}GlobalValues`);
|
|
87
90
|
const parsedTemplate = parseInterpolationTemplate(template);
|
|
88
91
|
return {
|
|
89
92
|
inputNames: getJsValueInterpolationInputNames(template, options),
|
|
@@ -92,8 +95,11 @@ export function getJsValueInterpolationRuntimeContext(template, baseInputsIdenti
|
|
|
92
95
|
cloneCacheIdentifier,
|
|
93
96
|
graphInputsIdentifier,
|
|
94
97
|
contextIdentifier,
|
|
98
|
+
globalValuesIdentifier,
|
|
99
|
+
globalValuesCloneIdentifier,
|
|
95
100
|
requiresInterpolationHelper: parsedTemplate.tokens.some((token) => token.reference !== undefined &&
|
|
96
101
|
(token.reference.source !== 'variable' || token.reference.jsonPath !== undefined)),
|
|
102
|
+
requiresGlobalValues: parsedTemplate.tokens.some((token) => token.reference?.source === 'globals'),
|
|
97
103
|
};
|
|
98
104
|
}
|
|
99
105
|
export function buildJsValueInterpolatedSource(template, interpolationContext, options = {}) {
|
|
@@ -206,7 +212,7 @@ export function buildClonedInputValueAssignments(inputNames, targetIdentifier, c
|
|
|
206
212
|
})();`)
|
|
207
213
|
.join('\n');
|
|
208
214
|
}
|
|
209
|
-
export function buildJsValueInputClonePreamble({ cacheIdentifier, contextIdentifier, graphInputsIdentifier, inputsIdentifier, }) {
|
|
215
|
+
export function buildJsValueInputClonePreamble({ cacheIdentifier, contextIdentifier, graphInputsIdentifier, globalValuesCloneIdentifier, globalValuesIdentifier, usesGlobalValues, inputsIdentifier, }) {
|
|
210
216
|
return dedent `
|
|
211
217
|
${buildCloneJsInputValueFunction()}
|
|
212
218
|
const ${inputsIdentifier} = Object.create(null);
|
|
@@ -217,15 +223,23 @@ export function buildJsValueInputClonePreamble({ cacheIdentifier, contextIdentif
|
|
|
217
223
|
const ${contextIdentifier} = typeof context === 'undefined'
|
|
218
224
|
? Object.create(null)
|
|
219
225
|
: cloneJsInputValue(context, ${cacheIdentifier});
|
|
226
|
+
const ${globalValuesCloneIdentifier} = ${usesGlobalValues
|
|
227
|
+
? `typeof ${globalValuesIdentifier} === 'undefined'
|
|
228
|
+
? (() => { throw new Error(${JSON.stringify(MISSING_GLOBAL_VALUES_MESSAGE)}); })()
|
|
229
|
+
: cloneJsInputValue(${globalValuesIdentifier}, ${cacheIdentifier})`
|
|
230
|
+
: 'Object.create(null)'};
|
|
220
231
|
`;
|
|
221
232
|
}
|
|
222
233
|
export function buildJsValueInputsInitializer({ interpolationContext, }) {
|
|
223
|
-
const { cloneCacheIdentifier, contextIdentifier, graphInputsIdentifier, inputNames, inputsIdentifier } = interpolationContext;
|
|
234
|
+
const { cloneCacheIdentifier, contextIdentifier, globalValuesCloneIdentifier, globalValuesIdentifier, graphInputsIdentifier, inputNames, inputsIdentifier, } = interpolationContext;
|
|
224
235
|
return dedent `
|
|
225
236
|
${buildJsValueInputClonePreamble({
|
|
226
237
|
cacheIdentifier: cloneCacheIdentifier,
|
|
227
238
|
contextIdentifier,
|
|
228
239
|
graphInputsIdentifier,
|
|
240
|
+
globalValuesCloneIdentifier,
|
|
241
|
+
globalValuesIdentifier,
|
|
242
|
+
usesGlobalValues: interpolationContext.requiresGlobalValues,
|
|
229
243
|
inputsIdentifier,
|
|
230
244
|
})}
|
|
231
245
|
${buildClonedInputValueAssignments(inputNames, inputsIdentifier, cloneCacheIdentifier)}
|
|
@@ -238,6 +252,9 @@ export function getJsValueInterpolationCodeRunnerOptions(options, interpolationC
|
|
|
238
252
|
return {
|
|
239
253
|
...options,
|
|
240
254
|
interpolationHelperIdentifier: interpolationContext.interpolationHelperIdentifier,
|
|
255
|
+
...(interpolationContext.requiresGlobalValues
|
|
256
|
+
? { globalValuesIdentifier: interpolationContext.globalValuesIdentifier }
|
|
257
|
+
: {}),
|
|
241
258
|
};
|
|
242
259
|
}
|
|
243
260
|
export function sanitizeGeneratedJsValueText(text, inputNames, targetIdentifier, fallbackLabel, generatedIdentifiers = []) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {} from '../../../index.js';
|
|
2
2
|
import { newId, coerceTypeOptional, getInputOrData } from '../../../utils/index.js';
|
|
3
|
-
import { extractInterpolationVariableReferences, interpolate } from '../../../utils/interpolation.js';
|
|
3
|
+
import { extractInterpolationVariableReferences, getInterpolationGlobalValues, interpolate } from '../../../utils/interpolation.js';
|
|
4
4
|
import { pluginNodeDefinition } from '../../../model/NodeDefinition.js';
|
|
5
5
|
import { createInterpolationInputDefinition } from '../../../model/interpolationInputDefinition.js';
|
|
6
6
|
export const ThreadMessageNodeImpl = {
|
|
@@ -127,6 +127,7 @@ export const ThreadMessageNodeImpl = {
|
|
|
127
127
|
}
|
|
128
128
|
const interpolated = interpolate(text, inputData, context?.graphInputNodeValues, context?.contextValues, {
|
|
129
129
|
coerceBareVariableDataValues: true,
|
|
130
|
+
globalValues: getInterpolationGlobalValues(text, context?.getGlobal),
|
|
130
131
|
});
|
|
131
132
|
// Here you would typically make a call to an API to create the message
|
|
132
133
|
// For the sake of this example, we'll just return the data as is
|
|
@@ -94,6 +94,7 @@ const toRecordedEventMap = {
|
|
|
94
94
|
nodeId: node.id,
|
|
95
95
|
processId,
|
|
96
96
|
}, execution),
|
|
97
|
+
streamingOutputWatchSummary: ({ watchNode, summary, execution }) => withExecution({ watchNodeId: watchNode.id, summary }, execution),
|
|
97
98
|
error: ({ error }) => ({
|
|
98
99
|
error: typeof error === 'string' ? error : error.stack,
|
|
99
100
|
}),
|
|
@@ -127,24 +128,32 @@ function toRecordedEvent(event, data) {
|
|
|
127
128
|
ts: Date.now(),
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
|
-
const recordableData =
|
|
131
|
+
const { recordableData, occurredAt } = omitTransientEventTiming(data);
|
|
131
132
|
const recordedEvent = {
|
|
132
133
|
type: event,
|
|
133
134
|
data: toRecordedEventMap[event](recordableData),
|
|
134
135
|
ts: Date.now(),
|
|
136
|
+
...(occurredAt === undefined ? {} : { occurredAt }),
|
|
135
137
|
};
|
|
136
138
|
return recordedEvent;
|
|
137
139
|
}
|
|
138
140
|
/**
|
|
139
141
|
* Replay provenance belongs to the current delivery, not the historical event
|
|
140
|
-
* itself.
|
|
141
|
-
*
|
|
142
|
+
* itself. A deferred Watch event additionally carries the moment it occurred;
|
|
143
|
+
* persist that separately while retaining the append-time `ts` so recording
|
|
144
|
+
* order remains monotonic and replayable.
|
|
142
145
|
*/
|
|
143
|
-
function
|
|
146
|
+
function omitTransientEventTiming(data) {
|
|
144
147
|
if (data == null || typeof data !== 'object')
|
|
145
|
-
return data;
|
|
146
|
-
const { replayRecordedAt: _replayRecordedAt, ...recordableData } = data;
|
|
147
|
-
return
|
|
148
|
+
return { recordableData: data, occurredAt: undefined };
|
|
149
|
+
const { replayRecordedAt: _replayRecordedAt, eventOccurredAt, ...recordableData } = data;
|
|
150
|
+
return {
|
|
151
|
+
recordableData: recordableData,
|
|
152
|
+
occurredAt: isRecordedTimestamp(eventOccurredAt) ? eventOccurredAt : undefined,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function isRecordedTimestamp(value) {
|
|
156
|
+
return typeof value === 'number' && Number.isFinite(value) && value >= 0;
|
|
148
157
|
}
|
|
149
158
|
function isRecordableProcessEvent(message) {
|
|
150
159
|
return message in toRecordedEventMap || isPrefix(message, 'globalSet:') || isPrefix(message, 'userEvent:');
|
|
@@ -269,6 +269,7 @@ function parseInterpolationExpressionUncached(trimmedExpression) {
|
|
|
269
269
|
for (const [prefix, source] of [
|
|
270
270
|
['@graphInputs', 'graphInputs'],
|
|
271
271
|
['@context', 'context'],
|
|
272
|
+
['@globals', 'globals'],
|
|
272
273
|
]) {
|
|
273
274
|
if (trimmedExpression.startsWith(`${prefix}.`)) {
|
|
274
275
|
return parseBaseReference(trimmedExpression.slice(prefix.length + 1), source);
|
|
@@ -428,7 +429,7 @@ export function replaceInterpolationTokens(template, getReplacement, options = {
|
|
|
428
429
|
}
|
|
429
430
|
/**
|
|
430
431
|
* Discovers connectable interpolation bases in first-occurrence order. Special
|
|
431
|
-
* graph/context references are intentionally omitted because they do not make ports.
|
|
432
|
+
* graph/context/global references are intentionally omitted because they do not make ports.
|
|
432
433
|
*/
|
|
433
434
|
export function extractInterpolationVariableReferences(template) {
|
|
434
435
|
if (!template.includes('{{')) {
|
|
@@ -452,6 +453,33 @@ export function extractInterpolationVariableReferences(template) {
|
|
|
452
453
|
}
|
|
453
454
|
return Array.from(discovered.values(), (reference) => ({ ...reference }));
|
|
454
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* Captures only globals referenced by a template into a safe record. Globals
|
|
458
|
+
* are intentionally snapshotted at node execution: interpolation neither
|
|
459
|
+
* waits for a writer nor creates an execution dependency.
|
|
460
|
+
*/
|
|
461
|
+
export function getInterpolationGlobalValues(template, getGlobal) {
|
|
462
|
+
const values = Object.create(null);
|
|
463
|
+
if (!getGlobal || !template.includes('{{')) {
|
|
464
|
+
return values;
|
|
465
|
+
}
|
|
466
|
+
for (const token of parseInterpolationTemplate(template).tokens) {
|
|
467
|
+
const reference = token.reference;
|
|
468
|
+
if (!reference || reference.source !== 'globals' || Object.prototype.hasOwnProperty.call(values, reference.baseName)) {
|
|
469
|
+
continue;
|
|
470
|
+
}
|
|
471
|
+
const value = getGlobal(reference.baseName);
|
|
472
|
+
if (value !== undefined) {
|
|
473
|
+
Object.defineProperty(values, reference.baseName, {
|
|
474
|
+
configurable: true,
|
|
475
|
+
enumerable: true,
|
|
476
|
+
value,
|
|
477
|
+
writable: true,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
return values;
|
|
482
|
+
}
|
|
455
483
|
/** Extracts base port names only. Prefer `extractInterpolationVariableReferences` when type selection matters. */
|
|
456
484
|
export function extractInterpolationVariables(template) {
|
|
457
485
|
return extractInterpolationVariableReferences(template).map((reference) => reference.baseName);
|
|
@@ -464,6 +492,8 @@ function getInterpolationSource(reference, sources) {
|
|
|
464
492
|
return sources.graphInputValues;
|
|
465
493
|
case 'context':
|
|
466
494
|
return sources.contextValues;
|
|
495
|
+
case 'globals':
|
|
496
|
+
return sources.globalValues;
|
|
467
497
|
}
|
|
468
498
|
}
|
|
469
499
|
/**
|
|
@@ -503,6 +533,7 @@ export function resolveExpressionRawValue(source, expression, sourceType) {
|
|
|
503
533
|
return resolveInterpolationExpressionRawValue(`@${sourceType}.${expression}`, {
|
|
504
534
|
graphInputValues: sourceType === 'graphInputs' ? source : undefined,
|
|
505
535
|
contextValues: sourceType === 'context' ? source : undefined,
|
|
536
|
+
globalValues: sourceType === 'globals' ? source : undefined,
|
|
506
537
|
});
|
|
507
538
|
}
|
|
508
539
|
function stringifyInterpolationValue(value) {
|
|
@@ -557,6 +588,7 @@ export function interpolate(template, variables, graphInputValues, contextValues
|
|
|
557
588
|
variables,
|
|
558
589
|
graphInputValues,
|
|
559
590
|
contextValues,
|
|
591
|
+
globalValues: options.globalValues,
|
|
560
592
|
unwrapVariableDataValues: options.unwrapVariableDataValues,
|
|
561
593
|
});
|
|
562
594
|
if (resolvedValue === undefined) {
|
|
@@ -574,10 +606,11 @@ export function interpolate(template, variables, graphInputValues, contextValues
|
|
|
574
606
|
});
|
|
575
607
|
}
|
|
576
608
|
/** Runtime helper injected into JavaScript runners without exposing the whole Rivet API. */
|
|
577
|
-
export function resolveCodeInterpolationExpression(inputs, expression, graphInputValues, contextValues) {
|
|
609
|
+
export function resolveCodeInterpolationExpression(inputs, expression, graphInputValues, contextValues, globalValues) {
|
|
578
610
|
return resolveInterpolationExpressionRawValue(expression, {
|
|
579
611
|
variables: inputs,
|
|
580
612
|
graphInputValues,
|
|
581
613
|
contextValues,
|
|
614
|
+
globalValues,
|
|
582
615
|
});
|
|
583
616
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { formatUiGraphNormalizationIssue, normalizeUiGraphRecord, UiGraphNormalizationError, } from '../../model/UiGraphNormalization.js';
|
|
2
2
|
import { prepareSerializedInput } from './serializationInput.js';
|
|
3
3
|
import { isReservedKnowledgeObjectKey, normalizeKnowledgeConnectionId, normalizeKnowledgeMetadata, } from '../../integrations/KnowledgeStoreValidation.js';
|
|
4
|
+
import { validateProjectGlobalVariables } from '../../model/GlobalVariables.js';
|
|
4
5
|
export class ProjectValidationError extends Error {
|
|
5
6
|
validation;
|
|
6
7
|
constructor(validation) {
|
|
@@ -29,6 +30,14 @@ export function validateProject(project) {
|
|
|
29
30
|
errors.push('Missing project metadata.title');
|
|
30
31
|
if (meta.knowledgeStores != null)
|
|
31
32
|
validateKnowledgeStores(meta.knowledgeStores, errors);
|
|
33
|
+
if (meta.globalVariables != null) {
|
|
34
|
+
try {
|
|
35
|
+
validateProjectGlobalVariables(meta.globalVariables);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
errors.push(error instanceof Error ? error.message : String(error));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
42
|
// Graphs checks
|
|
34
43
|
if (!p.graphs || typeof p.graphs !== 'object') {
|
|
@@ -3,6 +3,7 @@ import { doubleCheckProject } from './serializationUtils.js';
|
|
|
3
3
|
import { entries } from '../typeSafety.js';
|
|
4
4
|
import {} from '../../model/Project.js';
|
|
5
5
|
import { normalizeUiGraphRecord } from '../../model/UiGraphNormalization.js';
|
|
6
|
+
import { validateProjectGlobalVariables } from '../../model/GlobalVariables.js';
|
|
6
7
|
import { serializeConnection, deserializeConnection, parseVisualData, packVisualDataV4, wrapInYamlEnvelope, unwrapYamlEnvelope, } from './serializationHelpers.js';
|
|
7
8
|
export function projectV4Deserializer(data) {
|
|
8
9
|
const serializedProject = unwrapYamlEnvelope(data, 4, 'Project v4');
|
|
@@ -15,6 +16,12 @@ export function graphV4Deserializer(data) {
|
|
|
15
16
|
return fromSerializedGraph(serializedGraph);
|
|
16
17
|
}
|
|
17
18
|
export function projectV4Serializer(project, attachedData) {
|
|
19
|
+
// Project Settings canonicalizes these values, but integrations and callers
|
|
20
|
+
// can author Project objects directly. Never write a project file that will
|
|
21
|
+
// later fail its own project-global validation at load or execution time.
|
|
22
|
+
if (project.metadata.globalVariables != null) {
|
|
23
|
+
validateProjectGlobalVariables(project.metadata.globalVariables);
|
|
24
|
+
}
|
|
18
25
|
const filteredProject = {
|
|
19
26
|
...project,
|
|
20
27
|
metadata: {
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export * from './model/NodeImpl.js';
|
|
|
24
24
|
export * from './model/NodeDefinition.js';
|
|
25
25
|
export * from './model/Nodes.js';
|
|
26
26
|
export * from './model/Project.js';
|
|
27
|
+
export * from './model/GlobalVariables.js';
|
|
27
28
|
export * from './native/BaseDir.js';
|
|
28
29
|
export * from './native/NativeApi.js';
|
|
29
30
|
export * from './native/BrowserNativeApi.js';
|
|
@@ -68,7 +69,7 @@ export * from './integrations/Tokenizer.js';
|
|
|
68
69
|
export * from './integrations/GptTokenizerTokenizer.js';
|
|
69
70
|
export { JS_LIST_CALLBACK_LOCAL_NAMES, interpolateJSListCallbackBody } from './model/nodes/jsListCallbackHelpers.js';
|
|
70
71
|
export { findAutoDelegateGraphCandidate } from './model/nodes/toolCallDelegation.js';
|
|
71
|
-
export { extractInterpolationVariables, extractInterpolationVariableReferences, findInterpolationTokenSpans, getInterpolationTokenReference, getInterpolationTokenName, interpolate, parseInterpolationExpression, parseInterpolationTemplate, protectEscapedInterpolationTokens, resolveCodeInterpolationExpression, resolveInterpolationExpressionRawValue, resolveInterpolationTokenRawValue, restoreEscapedInterpolationTokens, stringifyInterpolationSourceValue, } from './utils/interpolation.js';
|
|
72
|
+
export { extractInterpolationVariables, extractInterpolationVariableReferences, findInterpolationTokenSpans, getInterpolationGlobalValues, getInterpolationTokenReference, getInterpolationTokenName, interpolate, parseInterpolationExpression, parseInterpolationTemplate, protectEscapedInterpolationTokens, resolveCodeInterpolationExpression, resolveInterpolationExpressionRawValue, resolveInterpolationTokenRawValue, restoreEscapedInterpolationTokens, stringifyInterpolationSourceValue, } from './utils/interpolation.js';
|
|
72
73
|
export type { InterpolateOptions, InterpolationReferenceSource, InterpolationTokenReplacementInfo, InterpolationTokenSpan, InterpolationValueSources, InterpolationVariableReference, ParsedInterpolationExpression, ParsedInterpolationTemplate, ParsedInterpolationToken, ReplaceInterpolationTokensOptions, } from './utils/interpolation.js';
|
|
73
74
|
export { scanInterpolationTokenSpans } from './utils/interpolationSyntax.js';
|
|
74
75
|
export { WarningsPort } from './utils/symbols.js';
|
|
@@ -12,11 +12,11 @@ export type { CodeRunnerOptions } from './CodeRunnerOptions.js';
|
|
|
12
12
|
*/
|
|
13
13
|
/** An object that can run arbitrary code (evals it). */
|
|
14
14
|
export interface CodeRunner {
|
|
15
|
-
runCode: (code: string, inputs: Inputs, options: CodeRunnerOptions, graphInputs?: Record<string, DataValue>, contextValues?: Record<string, DataValue>) => Promise<Outputs>;
|
|
15
|
+
runCode: (code: string, inputs: Inputs, options: CodeRunnerOptions, graphInputs?: Record<string, DataValue>, contextValues?: Record<string, DataValue>, globalValues?: Record<string, DataValue>) => Promise<Outputs>;
|
|
16
16
|
}
|
|
17
17
|
export declare class IsomorphicCodeRunner implements CodeRunner {
|
|
18
|
-
runCode(code: string, inputs: Inputs, options: CodeRunnerOptions, graphInputs?: Record<string, DataValue>, contextValues?: Record<string, DataValue>): Promise<Outputs>;
|
|
18
|
+
runCode(code: string, inputs: Inputs, options: CodeRunnerOptions, graphInputs?: Record<string, DataValue>, contextValues?: Record<string, DataValue>, globalValues?: Record<string, DataValue>): Promise<Outputs>;
|
|
19
19
|
}
|
|
20
20
|
export declare class NotAllowedCodeRunner implements CodeRunner {
|
|
21
|
-
runCode(_code: string, _inputs: Inputs, _options: CodeRunnerOptions, _graphInputs?: Record<string, DataValue>, _contextValues?: Record<string, DataValue>): Promise<Outputs>;
|
|
21
|
+
runCode(_code: string, _inputs: Inputs, _options: CodeRunnerOptions, _graphInputs?: Record<string, DataValue>, _contextValues?: Record<string, DataValue>, _globalValues?: Record<string, DataValue>): Promise<Outputs>;
|
|
22
22
|
}
|
|
@@ -20,5 +20,10 @@ export interface CodeRunnerOptions {
|
|
|
20
20
|
* and @graphInputs/@context references depend on that contract.
|
|
21
21
|
*/
|
|
22
22
|
interpolationHelperIdentifier?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The collision-safe name of the globals snapshot injected beside the
|
|
25
|
+
* interpolation helper. Generated wrappers use it only for @globals paths.
|
|
26
|
+
*/
|
|
27
|
+
globalValuesIdentifier?: string;
|
|
23
28
|
}
|
|
24
29
|
export declare const ALL_CODE_RUNNER_OPTIONS: CodeRunnerOptions;
|
|
@@ -39,5 +39,5 @@ export declare function getMCPServerEditors<T extends ChartNode<string, MCPBaseN
|
|
|
39
39
|
export declare function getMCPBaseBody(data: MCPBaseNodeData, context: RivetUIContext): string;
|
|
40
40
|
export declare function requireMCPProvider(context: InternalProcessContext): MCPProvider;
|
|
41
41
|
export declare function resolveMCPServer(data: MCPBaseNodeData, inputs: Inputs, context: InternalProcessContext): Promise<MCPResolvedServer | undefined>;
|
|
42
|
-
export declare function interpolateMCPArgumentTemplate(template: string, inputs: Inputs, graphInputValues?: Record<string, DataValue>, contextValues?: Record<string, DataValue>): string;
|
|
42
|
+
export declare function interpolateMCPArgumentTemplate(template: string, inputs: Inputs, graphInputValues?: Record<string, DataValue>, contextValues?: Record<string, DataValue>, globalValues?: Record<string, unknown>): string;
|
|
43
43
|
export declare function getMCPArgumentTemplateInputs(template: string | undefined): NodeInputDefinition[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Outputs } from './GraphProcessor.js';
|
|
2
|
+
/**
|
|
3
|
+
* Creates a cycle-safe copy at an execution-data ownership boundary.
|
|
4
|
+
*
|
|
5
|
+
* Providers may continue mutating output objects after a partial event. A
|
|
6
|
+
* snapshot, recorder, or deferred branch must therefore never retain the
|
|
7
|
+
* producer-owned reference.
|
|
8
|
+
*/
|
|
9
|
+
export declare function cloneExecutionValue<T>(value: T): T;
|
|
10
|
+
/** Creates a cycle-safe snapshot specifically for a node output map. */
|
|
11
|
+
export declare function cloneExecutionOutputs(outputs: Outputs): Outputs;
|
|
@@ -5,8 +5,9 @@ import type { GraphId, NodeGraph } from './NodeGraph.js';
|
|
|
5
5
|
import type { ChatV2CallTraceEvent, EvaluationExecutionMetadata, GraphExecutionMetadata, LLMProfileAttemptTraceEvent, LLMChatOutputSnapshotEvent, ProcessId, ToolCallFinishedEvent } from './ProcessContext.js';
|
|
6
6
|
import type { Project, ProjectId } from './Project.js';
|
|
7
7
|
import type { Settings } from './Settings.js';
|
|
8
|
-
import type { FrozenNodeOutputsByGraph, NodeResultOrigin, ReplayEventTiming } from './GraphProcessor.js';
|
|
8
|
+
import type { EventOccurrenceTiming, FrozenNodeOutputsByGraph, NodeResultOrigin, ReplayEventTiming } from './GraphProcessor.js';
|
|
9
9
|
import type { GraphProgress } from './GraphProgress.js';
|
|
10
|
+
import type { StreamingOutputWatchHistorySummary } from './StreamingOutputWatchHistory.js';
|
|
10
11
|
import type { RivetWebAppStorage } from './UiGraphWebAppStorage.js';
|
|
11
12
|
export type GraphInputs = Record<string, DataValue>;
|
|
12
13
|
export type GraphOutputs = Record<string, DataValue>;
|
|
@@ -20,7 +21,7 @@ export type CodeConsoleMessage = {
|
|
|
20
21
|
};
|
|
21
22
|
type WithExecution<T extends object> = T & {
|
|
22
23
|
execution: GraphExecutionMetadata;
|
|
23
|
-
} & ReplayEventTiming;
|
|
24
|
+
} & ReplayEventTiming & EventOccurrenceTiming;
|
|
24
25
|
export type SerializedProcessEventMap = {
|
|
25
26
|
start: WithExecution<{
|
|
26
27
|
project: Project;
|
|
@@ -116,6 +117,10 @@ export type SerializedProcessEventMap = {
|
|
|
116
117
|
node: ChartNode;
|
|
117
118
|
processId?: ProcessId;
|
|
118
119
|
}>;
|
|
120
|
+
streamingOutputWatchSummary: WithExecution<{
|
|
121
|
+
watchNode: ChartNode;
|
|
122
|
+
summary: StreamingOutputWatchHistorySummary;
|
|
123
|
+
}>;
|
|
119
124
|
error: {
|
|
120
125
|
error: Error | string;
|
|
121
126
|
} & ReplayEventTiming;
|
|
@@ -171,6 +176,7 @@ export type ProcessEventMessageMap = {
|
|
|
171
176
|
llmProfileAttempt: SerializedProcessEventMap['llmProfileAttempt'];
|
|
172
177
|
toolCallFinished: SerializedProcessEventMap['toolCallFinished'];
|
|
173
178
|
nodeOutputsCleared: SerializedProcessEventMap['nodeOutputsCleared'];
|
|
179
|
+
streamingOutputWatchSummary: SerializedProcessEventMap['streamingOutputWatchSummary'];
|
|
174
180
|
error: SerializedProcessEventMap['error'];
|
|
175
181
|
graphError: SerializedProcessEventMap['graphError'];
|
|
176
182
|
trace: string;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ScalarOrArrayDataType, type ScalarOrArrayDataValue } from './DataValue.js';
|
|
2
|
+
import type { Project, ProjectId } from './Project.js';
|
|
3
|
+
/**
|
|
4
|
+
* A JSON-safe representation of a global value authored in project metadata.
|
|
5
|
+
*
|
|
6
|
+
* The marker is intentionally private to this codec. User objects with the
|
|
7
|
+
* marker key are escaped, so no ordinary object can be mistaken for a value
|
|
8
|
+
* sentinel after a project is saved and loaded again.
|
|
9
|
+
*/
|
|
10
|
+
/** Runtime validation, rather than a recursive TypeScript JSON type, keeps Project usable with Immer. */
|
|
11
|
+
export type ProjectGlobalVariableLiteral = unknown;
|
|
12
|
+
export type ProjectGlobalVariableDefinition = {
|
|
13
|
+
type: ScalarOrArrayDataType;
|
|
14
|
+
value: ProjectGlobalVariableLiteral;
|
|
15
|
+
};
|
|
16
|
+
export type ProjectGlobalVariables = Record<string, ProjectGlobalVariableDefinition>;
|
|
17
|
+
/** Encodes a normal global value into a portable project-file definition. */
|
|
18
|
+
export declare function encodeProjectGlobalVariable(value: ScalarOrArrayDataValue): ProjectGlobalVariableDefinition;
|
|
19
|
+
/** Decodes and validates a single portable project-file global definition. */
|
|
20
|
+
export declare function decodeProjectGlobalVariable(value: unknown, label?: string): ScalarOrArrayDataValue;
|
|
21
|
+
/** Validates definitions without retaining decoded runtime values. */
|
|
22
|
+
export declare function validateProjectGlobalVariables(value: unknown, label?: string): void;
|
|
23
|
+
export declare function getProjectGlobalVariableIds(project: Pick<Project, 'metadata'> | undefined): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Resolves referenced projects depth-first in reference order, then the root
|
|
26
|
+
* project. Later definitions intentionally replace earlier ones; the root
|
|
27
|
+
* project therefore always wins a collision with one of its references.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveProjectGlobalVariables(rootProject: Project, loadedProjects: Readonly<Record<ProjectId, Project>>): Map<string, ScalarOrArrayDataValue>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ScalarOrArrayDataValue } from './DataValue.js';
|
|
1
|
+
import type { DataValue, ScalarOrArrayDataValue } from './DataValue.js';
|
|
2
2
|
import type { GraphOutputs, Outputs } from './GraphProcessor.js';
|
|
3
3
|
import type { ChartNode } from './NodeBase.js';
|
|
4
4
|
import type { RivetStoredValue } from './StoredValueStore.js';
|
|
@@ -13,5 +13,11 @@ export type FrozenSetStoredValueEffect = {
|
|
|
13
13
|
value: RivetStoredValue;
|
|
14
14
|
};
|
|
15
15
|
export type FrozenGraphBoundaryEffect = FrozenSetGlobalEffect | FrozenSetStoredValueEffect;
|
|
16
|
+
/**
|
|
17
|
+
* Graph Outputs with the same public ID retain the first non-excluded value.
|
|
18
|
+
* Normal execution, frozen replay, and control-flow exclusion all use this
|
|
19
|
+
* single boundary rule.
|
|
20
|
+
*/
|
|
21
|
+
export declare function commitGraphOutputValue(graphOutputs: GraphOutputs, outputId: string, value: DataValue): void;
|
|
16
22
|
export declare function ensureGraphCostOutput(graphOutputs: GraphOutputs, totalCost: number): void;
|
|
17
23
|
export declare function applyFrozenGraphBoundaryEffects(graphOutputs: GraphOutputs, node: ChartNode, outputValues: Outputs): FrozenGraphBoundaryEffect | undefined;
|
|
@@ -12,6 +12,7 @@ import { type GraphExecutionPlan } from './GraphPreprocessor.js';
|
|
|
12
12
|
import { type GraphBoundaryCache } from './GraphBoundaryCache.js';
|
|
13
13
|
import { type GraphProgress } from './GraphProgress.js';
|
|
14
14
|
import { type RivetStoredValueStore } from './StoredValueStore.js';
|
|
15
|
+
import { type StreamingOutputWatchHistorySummary } from './StreamingOutputWatchHistory.js';
|
|
15
16
|
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
16
17
|
/**
|
|
17
18
|
* Provenance attached only while RecordingPlayer re-emits a historical event.
|
|
@@ -21,11 +22,20 @@ import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore
|
|
|
21
22
|
export type ReplayEventTiming = {
|
|
22
23
|
replayRecordedAt?: number;
|
|
23
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Timestamp carried by a delayed-but-retained execution event. Delivery may
|
|
27
|
+
* happen after a Watch settles; observability must still use this original
|
|
28
|
+
* occurrence time rather than the later emitter receipt time.
|
|
29
|
+
*/
|
|
30
|
+
export type EventOccurrenceTiming = {
|
|
31
|
+
eventOccurredAt?: number;
|
|
32
|
+
};
|
|
24
33
|
type WithExecution<T extends object> = T & {
|
|
25
34
|
execution: GraphExecutionMetadata;
|
|
26
|
-
} & ReplayEventTiming;
|
|
35
|
+
} & ReplayEventTiming & EventOccurrenceTiming;
|
|
27
36
|
declare const graphProcessorGraphOverride: unique symbol;
|
|
28
37
|
declare const consumedAsyncBranchTriggerOverride: unique symbol;
|
|
38
|
+
declare const consumedStreamingWatchNodeOverride: unique symbol;
|
|
29
39
|
export type NodeResultOrigin = 'executed' | 'preloaded' | 'frozen' | 'editor-cache' | 'unknown';
|
|
30
40
|
export type ProcessEvents = {
|
|
31
41
|
/** Called when processing has started. */
|
|
@@ -148,6 +158,11 @@ export type ProcessEvents = {
|
|
|
148
158
|
node: ChartNode;
|
|
149
159
|
processId?: ProcessId;
|
|
150
160
|
}>;
|
|
161
|
+
/** Compact accounting for a completed Watch Streaming Output boundary. */
|
|
162
|
+
streamingOutputWatchSummary: WithExecution<{
|
|
163
|
+
watchNode: ChartNode;
|
|
164
|
+
summary: StreamingOutputWatchHistorySummary;
|
|
165
|
+
}>;
|
|
151
166
|
/** Called when the root graph has errored. The root graph will also throw. */
|
|
152
167
|
error: {
|
|
153
168
|
error: Error | string;
|
|
@@ -194,6 +209,13 @@ export type ProcessEvent = {
|
|
|
194
209
|
}[keyof ProcessEvents];
|
|
195
210
|
export type GraphOutputs = Record<string, DataValue>;
|
|
196
211
|
export type GraphInputs = Record<string, DataValue>;
|
|
212
|
+
/**
|
|
213
|
+
* Ephemeral named Graph Output updates. This is deliberately an in-process
|
|
214
|
+
* callback rather than a ProcessEvent: it bridges a named graph-boundary
|
|
215
|
+
* caller's execution boundary for a parent Watch without adding a second
|
|
216
|
+
* recorded/node-history stream for every token.
|
|
217
|
+
*/
|
|
218
|
+
type GraphOutputPartialListener = (outputs: GraphOutputs) => void;
|
|
197
219
|
export type NodeResults = Map<NodeId, Outputs>;
|
|
198
220
|
export type Inputs = NodeInputs;
|
|
199
221
|
export type Outputs = NodeOutputs;
|
|
@@ -205,7 +227,21 @@ export type FrozenNodeOutputResolverRequest = {
|
|
|
205
227
|
node: ChartNode;
|
|
206
228
|
processId: ProcessId;
|
|
207
229
|
};
|
|
208
|
-
export type
|
|
230
|
+
export type FrozenNodeOutputEligibilityRequest = Pick<FrozenNodeOutputResolverRequest, 'graphId' | 'node'>;
|
|
231
|
+
/**
|
|
232
|
+
* A resolver may expose this non-consuming predicate when it can determine
|
|
233
|
+
* whether a node has frozen output without advancing its replay cursor.
|
|
234
|
+
* Streaming topology preparation uses it to keep a frozen named boundary
|
|
235
|
+
* final-only; custom resolvers without the predicate are conservatively
|
|
236
|
+
* treated as unknown rather than invoked speculatively. Return `false` only
|
|
237
|
+
* when this resolver cannot produce frozen output for the node in this run;
|
|
238
|
+
* returning `true` is allowed to be conservative and merely makes the
|
|
239
|
+
* boundary final-only.
|
|
240
|
+
*/
|
|
241
|
+
export type FrozenNodeOutputResolver = {
|
|
242
|
+
(request: FrozenNodeOutputResolverRequest): Outputs | undefined;
|
|
243
|
+
hasFrozenNodeOutput?: (request: FrozenNodeOutputEligibilityRequest) => boolean;
|
|
244
|
+
};
|
|
209
245
|
export declare function cloneFrozenNodeOutputs(outputs: Outputs): Outputs;
|
|
210
246
|
export declare function cloneFrozenNodeOutputsByGraph(outputsByGraph: FrozenNodeOutputsByGraph): FrozenNodeOutputsByGraph;
|
|
211
247
|
export declare function hasFrozenNodeOutputs(outputsByGraph: FrozenNodeOutputsByGraph | undefined): boolean;
|
|
@@ -226,7 +262,7 @@ export type GraphProcessorRuntimeCache = {
|
|
|
226
262
|
};
|
|
227
263
|
export type GraphProcessorExecutionPlanCacheMode = 'all' | 'subprocessors';
|
|
228
264
|
export type GraphProcessorScheduler = 'compatible' | 'fast-acyclic';
|
|
229
|
-
export type GraphProcessorRuntimeProfileBucket = 'initializeGraphRun' | 'loadProjectReferences' | 'prepareNodeProcessContextBase' | 'preprocessGraph' | 'emitGraphStart' | 'emitPreloadedNodeResults' | 'waitUntilUnpaused' | 'processFastAcyclicGraph' | 'processCompatibleGraph' | 'drainManagedAsyncBranches' | 'throwIfGraphErrored' | 'finalizeGraphRun' | 'emitFinish' | 'fetchNodeDataAndProcessNode' | 'getInputNodesTo' | 'getInputValuesForNode' | 'nodeDispatch' | 'nodeImplementation' | 'createNodeProcessContext' | 'getOutputNodesFrom' | 'queueOutputNodes' | 'createSubProcessor' | 'wireSubProcessorEvents' | 'wireSubProcessorLifecycle';
|
|
265
|
+
export type GraphProcessorRuntimeProfileBucket = 'initializeGraphRun' | 'loadProjectReferences' | 'initializeProjectGlobalVariables' | 'prepareNodeProcessContextBase' | 'preprocessGraph' | 'emitGraphStart' | 'emitInitialProjectGlobalVariables' | 'emitPreloadedNodeResults' | 'waitUntilUnpaused' | 'processFastAcyclicGraph' | 'processCompatibleGraph' | 'drainManagedAsyncBranches' | 'drainStreamingOutputWatches' | 'throwIfGraphErrored' | 'finalizeGraphRun' | 'emitFinish' | 'fetchNodeDataAndProcessNode' | 'getInputNodesTo' | 'getInputValuesForNode' | 'nodeDispatch' | 'nodeImplementation' | 'createNodeProcessContext' | 'getOutputNodesFrom' | 'queueOutputNodes' | 'createSubProcessor' | 'wireSubProcessorEvents' | 'wireSubProcessorLifecycle';
|
|
230
266
|
export type GraphProcessorRuntimeProfiler = {
|
|
231
267
|
addDuration: (bucket: GraphProcessorRuntimeProfileBucket, durationMs: number) => void;
|
|
232
268
|
};
|
|
@@ -277,6 +313,7 @@ export declare class GraphProcessor {
|
|
|
277
313
|
scheduler?: GraphProcessorScheduler;
|
|
278
314
|
[graphProcessorGraphOverride]?: NodeGraph;
|
|
279
315
|
[consumedAsyncBranchTriggerOverride]?: NodeId;
|
|
316
|
+
[consumedStreamingWatchNodeOverride]?: NodeId;
|
|
280
317
|
});
|
|
281
318
|
on: Emittery<ProcessEvents>["on"];
|
|
282
319
|
off: Emittery<ProcessEvents>["off"];
|
|
@@ -311,6 +348,13 @@ export declare class GraphProcessor {
|
|
|
311
348
|
returnWhenGraphOutputsReady?: boolean;
|
|
312
349
|
/** Restrict this invocation to named graph outputs and their prerequisites. Cannot be combined with runToNodeIds. */
|
|
313
350
|
requestedGraphOutputIds?: readonly string[];
|
|
351
|
+
/**
|
|
352
|
+
* Receives partial values only when a producer directly feeds a named
|
|
353
|
+
* Graph Output. Used internally to stream a named graph-boundary caller
|
|
354
|
+
* output to its parent without changing the persisted graph or public
|
|
355
|
+
* event protocol.
|
|
356
|
+
*/
|
|
357
|
+
onGraphOutputPartial?: GraphOutputPartialListener;
|
|
314
358
|
}): Promise<GraphOutputs>;
|
|
315
359
|
getRootProcessor(): GraphProcessor;
|
|
316
360
|
/** Raise a user event on the processor, all subprocessors, and their children. */
|