@valerypopoff/rivet2-core 2.15.0 → 2.17.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 +4350 -2077
- package/dist/cjs/bundle.cjs.map +4 -4
- package/dist/cjs/interpolationRuntime.cjs +22 -3
- package/dist/cjs/interpolationRuntime.cjs.map +3 -3
- package/dist/cjs/interpolationSyntax.cjs +9 -5
- package/dist/cjs/interpolationSyntax.cjs.map +2 -2
- package/dist/esm/api/createProcessor.js +5 -2
- package/dist/esm/exports.js +2 -0
- package/dist/esm/model/GraphBoundaryCache.js +2 -1
- package/dist/esm/model/GraphProcessor.js +268 -6
- package/dist/esm/model/Nodes.js +10 -0
- package/dist/esm/model/ProjectBundle.js +235 -0
- package/dist/esm/model/SplitRunProcessor.js +28 -7
- package/dist/esm/model/StreamingWatchTopology.js +118 -8
- package/dist/esm/model/SubgraphProjectTarget.js +7 -0
- package/dist/esm/model/chat-v2/aiSdkBridge.js +7 -5
- package/dist/esm/model/chat-v2/chatV2Pipeline.js +13 -8
- package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +19 -1
- package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
- package/dist/esm/model/chat-v2/llmChatV2Body.js +11 -8
- package/dist/esm/model/chat-v2/llmChatV2NodeData.js +2 -0
- package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +15 -1
- package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
- package/dist/esm/model/chat-v2/llmProfile.js +3 -0
- package/dist/esm/model/chat-v2/llmProfileBody.js +2 -2
- package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +1 -1
- package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
- package/dist/esm/model/chat-v2/temperature.js +9 -0
- package/dist/esm/model/classifier/credentials.js +30 -4
- package/dist/esm/model/classifier/images.js +176 -0
- package/dist/esm/model/classifier/json.js +57 -0
- package/dist/esm/model/classifier/limits.js +270 -0
- package/dist/esm/model/classifier/openai.js +118 -0
- package/dist/esm/model/classifier/preparation.js +74 -0
- package/dist/esm/model/classifier/providers.js +260 -185
- package/dist/esm/model/classifier/questionHelpers.js +29 -45
- package/dist/esm/model/classifier/questions.js +53 -0
- package/dist/esm/model/classifier/response.js +75 -0
- package/dist/esm/model/classifier/state.js +204 -0
- package/dist/esm/model/nodeRunFailure.js +47 -0
- package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
- package/dist/esm/model/nodes/ClassifierEvaluateNode.js +178 -138
- package/dist/esm/model/nodes/ClassifierQuestionNode.js +59 -15
- package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
- package/dist/esm/model/nodes/HttpCallNode.js +44 -75
- package/dist/esm/model/nodes/ImageNode.js +44 -3
- package/dist/esm/model/nodes/LLMChatV2Node.js +24 -3
- package/dist/esm/model/nodes/ObjectNode.js +29 -18
- package/dist/esm/model/nodes/PromptNode.js +2 -1
- package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
- package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
- package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
- package/dist/esm/model/nodes/StreamValueNode.js +38 -0
- package/dist/esm/model/nodes/SubGraphNode.js +196 -35
- package/dist/esm/model/nodes/ToBase64Node.js +106 -0
- package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
- package/dist/esm/recording/ExecutionRecorder.js +26 -0
- package/dist/esm/utils/base64.js +18 -15
- package/dist/esm/utils/errors.js +41 -0
- package/dist/esm/utils/interpolation.js +44 -22
- package/dist/esm/utils/interpolationSyntax.js +15 -6
- package/dist/esm/utils/serialization/serialization.js +3 -2
- package/dist/esm/utils/serialization/serializationUtils.js +6 -0
- package/dist/esm/utils/serialization/serialization_v4.js +15 -3
- package/dist/types/api/createProcessor.d.ts +7 -1
- package/dist/types/exports.d.ts +2 -0
- package/dist/types/model/CycleDetector.d.ts +1 -2
- package/dist/types/model/ExecutorProtocol.d.ts +2 -0
- package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
- package/dist/types/model/GraphProcessor.d.ts +1 -0
- package/dist/types/model/Nodes.d.ts +6 -2
- package/dist/types/model/ProcessContext.d.ts +12 -0
- package/dist/types/model/ProjectBundle.d.ts +54 -0
- package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
- package/dist/types/model/StreamingWatchTopology.d.ts +11 -1
- package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
- package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
- package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +3 -1
- package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
- package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +6 -6
- package/dist/types/model/chat-v2/temperature.d.ts +2 -0
- package/dist/types/model/classifier/credentials.d.ts +3 -1
- package/dist/types/model/classifier/images.d.ts +18 -0
- package/dist/types/model/classifier/json.d.ts +19 -0
- package/dist/types/model/classifier/limits.d.ts +42 -0
- package/dist/types/model/classifier/openai.d.ts +5 -0
- package/dist/types/model/classifier/preparation.d.ts +16 -0
- package/dist/types/model/classifier/providers.d.ts +67 -9
- package/dist/types/model/classifier/questionHelpers.d.ts +6 -4
- package/dist/types/model/classifier/questions.d.ts +4 -0
- package/dist/types/model/classifier/response.d.ts +4 -0
- package/dist/types/model/classifier/state.d.ts +37 -0
- package/dist/types/model/classifier/types.d.ts +2 -0
- package/dist/types/model/nodeRunFailure.d.ts +13 -0
- package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
- package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +3 -0
- package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
- package/dist/types/model/nodes/ImageNode.d.ts +4 -0
- package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
- package/dist/types/model/nodes/ObjectNode.d.ts +2 -1
- package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
- package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
- package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
- package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
- package/dist/types/utils/base64.d.ts +1 -1
- package/dist/types/utils/errors.d.ts +4 -0
- package/dist/types/utils/interpolation.d.ts +13 -2
- package/dist/types/utils/interpolationSyntax.d.ts +1 -1
- package/dist/types/utils/serialization/serialization.d.ts +3 -1
- package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -327,8 +327,9 @@ export function parseInterpolationToken(rawInner) {
|
|
|
327
327
|
function freezeReference(reference) {
|
|
328
328
|
return reference ? Object.freeze({ ...reference }) : undefined;
|
|
329
329
|
}
|
|
330
|
-
function parseInterpolationTemplateUncached(template) {
|
|
331
|
-
const tokens = scanInterpolationTokenSpans(template).map((span) => {
|
|
330
|
+
function parseInterpolationTemplateUncached(template, check, tokenLimit = Infinity) {
|
|
331
|
+
const tokens = scanInterpolationTokenSpans(template, check, tokenLimit).map((span) => {
|
|
332
|
+
check?.();
|
|
332
333
|
const parsedToken = parseInterpolationToken(span.rawInner);
|
|
333
334
|
return Object.freeze({
|
|
334
335
|
...parsedToken,
|
|
@@ -373,12 +374,15 @@ function cacheInterpolationTemplate(template, parsed) {
|
|
|
373
374
|
cachedInterpolationTemplateStorageChars += storageChars;
|
|
374
375
|
}
|
|
375
376
|
/** Returns an immutable, cached syntax representation. It never evaluates values. */
|
|
376
|
-
export function parseInterpolationTemplate(template) {
|
|
377
|
+
export function parseInterpolationTemplate(template, check, tokenLimit = Infinity) {
|
|
378
|
+
check?.();
|
|
377
379
|
const cached = interpolationTemplateCache.get(template);
|
|
378
380
|
if (cached) {
|
|
381
|
+
if (cached.parsed.tokens.length > tokenLimit)
|
|
382
|
+
throw new Error('Interpolation template has too many tokens.');
|
|
379
383
|
return cached.parsed;
|
|
380
384
|
}
|
|
381
|
-
const parsed = parseInterpolationTemplateUncached(template);
|
|
385
|
+
const parsed = parseInterpolationTemplateUncached(template, check, tokenLimit);
|
|
382
386
|
if (template.includes('{{')) {
|
|
383
387
|
cacheInterpolationTemplate(template, parsed);
|
|
384
388
|
}
|
|
@@ -403,28 +407,33 @@ export function getInterpolationTokenReference(rawInner) {
|
|
|
403
407
|
return parseInterpolationToken(rawInner).reference;
|
|
404
408
|
}
|
|
405
409
|
export function replaceInterpolationTokens(template, getReplacement, options = {}) {
|
|
406
|
-
const parsedTemplate = parseInterpolationTemplate(template);
|
|
410
|
+
const parsedTemplate = parseInterpolationTemplate(template, options.guard?.check, options.guard?.tokenLimit);
|
|
407
411
|
if (parsedTemplate.tokens.length === 0) {
|
|
408
412
|
const restoredTemplate = restoreEscapedInterpolationTokens(template);
|
|
409
413
|
return options.trim ? restoredTemplate.trim() : restoredTemplate;
|
|
410
414
|
}
|
|
411
415
|
let result = '';
|
|
412
416
|
let cursor = 0;
|
|
417
|
+
const append = (fragment) => {
|
|
418
|
+
options.guard?.output(fragment, result.length);
|
|
419
|
+
result += fragment;
|
|
420
|
+
};
|
|
413
421
|
for (const token of parsedTemplate.tokens) {
|
|
414
422
|
// Restore escaped delimiters only from authored template text. A
|
|
415
423
|
// replacement may deliberately contain `{{{...}}}` or `\\{\\{...\\}\\}` and
|
|
416
424
|
// must be returned unchanged rather than interpreted as template syntax.
|
|
417
|
-
|
|
418
|
-
|
|
425
|
+
options.guard?.check();
|
|
426
|
+
append(restoreEscapedInterpolationTokens(template.slice(cursor, token.span.start)));
|
|
427
|
+
append(getReplacement({
|
|
419
428
|
rawInner: token.rawInner,
|
|
420
429
|
span: { ...token.span },
|
|
421
430
|
tokenName: token.tokenName,
|
|
422
431
|
processingChain: token.processingChain,
|
|
423
432
|
reference: token.reference ? { ...token.reference } : undefined,
|
|
424
|
-
});
|
|
433
|
+
}));
|
|
425
434
|
cursor = token.span.end;
|
|
426
435
|
}
|
|
427
|
-
|
|
436
|
+
append(restoreEscapedInterpolationTokens(template.slice(cursor)));
|
|
428
437
|
return options.trim ? result.trim() : result;
|
|
429
438
|
}
|
|
430
439
|
/**
|
|
@@ -458,14 +467,17 @@ export function extractInterpolationVariableReferences(template) {
|
|
|
458
467
|
* are intentionally snapshotted at node execution: interpolation neither
|
|
459
468
|
* waits for a writer nor creates an execution dependency.
|
|
460
469
|
*/
|
|
461
|
-
export function getInterpolationGlobalValues(template, getGlobal) {
|
|
470
|
+
export function getInterpolationGlobalValues(template, getGlobal, check, tokenLimit = Infinity) {
|
|
462
471
|
const values = Object.create(null);
|
|
463
472
|
if (!getGlobal || !template.includes('{{')) {
|
|
464
473
|
return values;
|
|
465
474
|
}
|
|
466
|
-
for (const token of parseInterpolationTemplate(template).tokens) {
|
|
475
|
+
for (const token of parseInterpolationTemplate(template, check, tokenLimit).tokens) {
|
|
476
|
+
check?.();
|
|
467
477
|
const reference = token.reference;
|
|
468
|
-
if (!reference ||
|
|
478
|
+
if (!reference ||
|
|
479
|
+
reference.source !== 'globals' ||
|
|
480
|
+
Object.prototype.hasOwnProperty.call(values, reference.baseName)) {
|
|
469
481
|
continue;
|
|
470
482
|
}
|
|
471
483
|
const value = getGlobal(reference.baseName);
|
|
@@ -511,18 +523,22 @@ export function resolveInterpolationExpressionRawValue(expression, sources) {
|
|
|
511
523
|
return undefined;
|
|
512
524
|
}
|
|
513
525
|
const shouldUnwrapDataValue = reference.source !== 'variable' || sources.unwrapVariableDataValues !== false;
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
526
|
+
const property = sources.guard ? Object.getOwnPropertyDescriptor(source, reference.baseName) : undefined;
|
|
527
|
+
if (sources.guard && (!property || !('value' in property)))
|
|
528
|
+
throw new Error('Interpolation sources must use own data properties, not accessors.');
|
|
529
|
+
const sourceValue = sources.guard ? sources.guard.prepareValue(property.value) : source[reference.baseName];
|
|
530
|
+
const baseValue = shouldUnwrapDataValue ? unwrapPotentialDataValue(sourceValue) : sourceValue;
|
|
517
531
|
if (reference.jsonPath === undefined) {
|
|
518
532
|
return baseValue;
|
|
519
533
|
}
|
|
534
|
+
let selected;
|
|
520
535
|
try {
|
|
521
|
-
|
|
536
|
+
selected = evaluateJsonPath(baseValue, reference.jsonPath, false);
|
|
522
537
|
}
|
|
523
538
|
catch {
|
|
524
539
|
return undefined;
|
|
525
540
|
}
|
|
541
|
+
return sources.guard ? sources.guard.prepareValue(selected) : selected;
|
|
526
542
|
}
|
|
527
543
|
export function resolveInterpolationTokenRawValue(rawInner, sources) {
|
|
528
544
|
const reference = parseInterpolationToken(rawInner).reference;
|
|
@@ -559,19 +575,23 @@ function parseProcessing(instruction) {
|
|
|
559
575
|
param: parts[1] ? Number.parseInt(parts[1], 10) : undefined,
|
|
560
576
|
};
|
|
561
577
|
}
|
|
562
|
-
function applyProcessing(value, processingChain) {
|
|
578
|
+
function applyProcessing(value, processingChain, guard) {
|
|
579
|
+
guard?.processing(processingChain, 'chain', undefined);
|
|
563
580
|
const instructions = processingChain
|
|
564
581
|
.split('|')
|
|
565
582
|
.map((instruction) => instruction.trim())
|
|
566
583
|
.filter((instruction) => instruction !== '');
|
|
567
584
|
return instructions.reduce((result, instruction) => {
|
|
568
585
|
const { func, param } = parseProcessing(instruction);
|
|
586
|
+
guard?.processing(result, func, param);
|
|
569
587
|
const processingFunc = processingFunctions[func];
|
|
570
588
|
if (!processingFunc) {
|
|
571
589
|
console.warn(`Unknown processing function: ${func}`);
|
|
572
590
|
return result;
|
|
573
591
|
}
|
|
574
|
-
|
|
592
|
+
const processed = processingFunc(result, param);
|
|
593
|
+
guard?.output(processed, 0);
|
|
594
|
+
return processed;
|
|
575
595
|
}, value);
|
|
576
596
|
}
|
|
577
597
|
/**
|
|
@@ -590,6 +610,7 @@ export function interpolate(template, variables, graphInputValues, contextValues
|
|
|
590
610
|
contextValues,
|
|
591
611
|
globalValues: options.globalValues,
|
|
592
612
|
unwrapVariableDataValues: options.unwrapVariableDataValues,
|
|
613
|
+
guard: options.guard,
|
|
593
614
|
});
|
|
594
615
|
if (resolvedValue === undefined) {
|
|
595
616
|
console.warn(`Interpolation variable or path "${token.tokenName}" not found or resolved to undefined.`);
|
|
@@ -597,13 +618,14 @@ export function interpolate(template, variables, graphInputValues, contextValues
|
|
|
597
618
|
}
|
|
598
619
|
const isBareOrdinaryVariable = token.reference.source === 'variable' && token.reference.jsonPath === undefined;
|
|
599
620
|
const stringValue = isBareOrdinaryVariable
|
|
600
|
-
? stringifyInterpolationSourceValue(variables[token.reference.baseName], {
|
|
621
|
+
? stringifyInterpolationSourceValue(options.guard ? resolvedValue : variables[token.reference.baseName], {
|
|
601
622
|
coerceDataValueToString: options.coerceBareVariableDataValues,
|
|
602
|
-
unwrapDataValue: options.unwrapVariableDataValues !== false,
|
|
623
|
+
unwrapDataValue: !options.guard && options.unwrapVariableDataValues !== false,
|
|
603
624
|
})
|
|
604
625
|
: stringifyInterpolationValue(resolvedValue);
|
|
605
|
-
|
|
606
|
-
|
|
626
|
+
options.guard?.output(stringValue, 0);
|
|
627
|
+
return token.processingChain ? applyProcessing(stringValue, token.processingChain, options.guard) : stringValue;
|
|
628
|
+
}, { guard: options.guard });
|
|
607
629
|
}
|
|
608
630
|
/** Runtime helper injected into JavaScript runners without exposing the whole Rivet API. */
|
|
609
631
|
export function resolveCodeInterpolationExpression(inputs, expression, graphInputValues, contextValues, globalValues) {
|
|
@@ -41,8 +41,10 @@ export function isInterpolationRegexLiteralStart(value, index) {
|
|
|
41
41
|
}
|
|
42
42
|
return previousIndex < 0 || REGEX_LITERAL_PREFIX_CHARACTERS.has(value[previousIndex]);
|
|
43
43
|
}
|
|
44
|
-
function getEscapedTripleTokenEnd(template, start) {
|
|
44
|
+
function getEscapedTripleTokenEnd(template, start, check) {
|
|
45
45
|
for (let cursor = start + 3; cursor < template.length - 2; cursor += 1) {
|
|
46
|
+
if ((cursor & 4095) === 0)
|
|
47
|
+
check?.();
|
|
46
48
|
if (template[cursor] === '}' && template[cursor + 1] === '}' && template[cursor + 2] === '}') {
|
|
47
49
|
return cursor + 3;
|
|
48
50
|
}
|
|
@@ -50,7 +52,7 @@ function getEscapedTripleTokenEnd(template, start) {
|
|
|
50
52
|
return undefined;
|
|
51
53
|
}
|
|
52
54
|
/** Finds a matching `}}` while allowing JSONPath filters, quotes, and braces. */
|
|
53
|
-
function scanInterpolationToken(template, start) {
|
|
55
|
+
function scanInterpolationToken(template, start, check) {
|
|
54
56
|
let quote;
|
|
55
57
|
let regex = false;
|
|
56
58
|
let regexCharacterClass = false;
|
|
@@ -58,6 +60,8 @@ function scanInterpolationToken(template, start) {
|
|
|
58
60
|
let parenthesisDepth = 0;
|
|
59
61
|
let braceDepth = 0;
|
|
60
62
|
for (let cursor = start + 2; cursor < template.length; cursor += 1) {
|
|
63
|
+
if ((cursor & 4095) === 0)
|
|
64
|
+
check?.();
|
|
61
65
|
const character = template[cursor];
|
|
62
66
|
if (regex) {
|
|
63
67
|
if (character === '[' && !isInterpolationSyntaxCharacterEscaped(template, cursor)) {
|
|
@@ -66,7 +70,9 @@ function scanInterpolationToken(template, start) {
|
|
|
66
70
|
else if (character === ']' && !isInterpolationSyntaxCharacterEscaped(template, cursor)) {
|
|
67
71
|
regexCharacterClass = false;
|
|
68
72
|
}
|
|
69
|
-
else if (character === '/' &&
|
|
73
|
+
else if (character === '/' &&
|
|
74
|
+
!regexCharacterClass &&
|
|
75
|
+
!isInterpolationSyntaxCharacterEscaped(template, cursor)) {
|
|
70
76
|
regex = false;
|
|
71
77
|
}
|
|
72
78
|
continue;
|
|
@@ -132,22 +138,23 @@ function scanInterpolationToken(template, start) {
|
|
|
132
138
|
* the rest of the execution runtime. The returned spans are fresh data and
|
|
133
139
|
* exclude escaped triple-brace tokens.
|
|
134
140
|
*/
|
|
135
|
-
export function scanInterpolationTokenSpans(template) {
|
|
141
|
+
export function scanInterpolationTokenSpans(template, check, tokenLimit = Infinity) {
|
|
136
142
|
const spans = [];
|
|
137
143
|
let searchIndex = 0;
|
|
138
144
|
while (searchIndex < template.length) {
|
|
145
|
+
check?.();
|
|
139
146
|
const start = template.indexOf('{{', searchIndex);
|
|
140
147
|
if (start === -1) {
|
|
141
148
|
break;
|
|
142
149
|
}
|
|
143
150
|
if (template[start + 2] === '{') {
|
|
144
|
-
const escapedEnd = getEscapedTripleTokenEnd(template, start);
|
|
151
|
+
const escapedEnd = getEscapedTripleTokenEnd(template, start, check);
|
|
145
152
|
if (escapedEnd !== undefined) {
|
|
146
153
|
searchIndex = escapedEnd;
|
|
147
154
|
continue;
|
|
148
155
|
}
|
|
149
156
|
}
|
|
150
|
-
const scanResult = scanInterpolationToken(template, start);
|
|
157
|
+
const scanResult = scanInterpolationToken(template, start, check);
|
|
151
158
|
if (scanResult.kind === 'nested') {
|
|
152
159
|
searchIndex = scanResult.start;
|
|
153
160
|
continue;
|
|
@@ -164,6 +171,8 @@ export function scanInterpolationTokenSpans(template) {
|
|
|
164
171
|
searchIndex = nextStart;
|
|
165
172
|
continue;
|
|
166
173
|
}
|
|
174
|
+
if (spans.length >= tokenLimit)
|
|
175
|
+
throw new Error('Interpolation template has too many tokens.');
|
|
167
176
|
spans.push({
|
|
168
177
|
start,
|
|
169
178
|
end: scanResult.end,
|
|
@@ -14,7 +14,7 @@ export function serializeProject(project, attachedData) {
|
|
|
14
14
|
return projectV4Serializer(project, attachedData);
|
|
15
15
|
}
|
|
16
16
|
const errMessage = (err) => `${getError(err).message}\n${getError(err).stack}`;
|
|
17
|
-
export function deserializeProject(serializedProject, path = null) {
|
|
17
|
+
export function deserializeProject(serializedProject, path = null, options = {}) {
|
|
18
18
|
const { deserializerInput, version } = prepareSerializedInput(serializedProject);
|
|
19
19
|
try {
|
|
20
20
|
const result = deserializeProjectByVersion(deserializerInput, version);
|
|
@@ -28,7 +28,8 @@ export function deserializeProject(serializedProject, path = null) {
|
|
|
28
28
|
if (err instanceof yaml.YAMLError) {
|
|
29
29
|
yamlProblem(err);
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
if (options.logErrors !== false)
|
|
32
|
+
console.warn(`Failed to deserialize project v${version}: ${errMessage(err)}`);
|
|
32
33
|
if (err instanceof UiGraphNormalizationError) {
|
|
33
34
|
throw new Error(`Could not deserialize project: ${err.message}`, { cause: err });
|
|
34
35
|
}
|
|
@@ -18,6 +18,9 @@ export function validateProject(project) {
|
|
|
18
18
|
return { valid: false, errors: ['Project is not an object'], warnings };
|
|
19
19
|
}
|
|
20
20
|
const p = project;
|
|
21
|
+
if (!isValidProjectStaticData(p.data)) {
|
|
22
|
+
errors.push('Project data must be a record of static-data strings');
|
|
23
|
+
}
|
|
21
24
|
// Metadata checks
|
|
22
25
|
if (!p.metadata || typeof p.metadata !== 'object') {
|
|
23
26
|
errors.push('Missing project metadata');
|
|
@@ -136,6 +139,9 @@ function isPlainRecord(value) {
|
|
|
136
139
|
const prototype = Object.getPrototypeOf(value);
|
|
137
140
|
return prototype === Object.prototype || prototype === null;
|
|
138
141
|
}
|
|
142
|
+
export function isValidProjectStaticData(value) {
|
|
143
|
+
return (value === undefined || (isPlainRecord(value) && Object.values(value).every((entry) => typeof entry === 'string')));
|
|
144
|
+
}
|
|
139
145
|
function validateUiGraphs(uiGraphs, errors) {
|
|
140
146
|
try {
|
|
141
147
|
normalizeUiGraphRecord(uiGraphs, { repairComponentIds: false });
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { mapValues } from 'lodash-es';
|
|
2
|
-
import {
|
|
2
|
+
import { normalizeSerializedLLMTemperatureData } from '../../model/chat-v2/llmChatV2NodeMigration.js';
|
|
3
|
+
import { doubleCheckProject, isValidProjectStaticData } from './serializationUtils.js';
|
|
3
4
|
import { entries } from '../typeSafety.js';
|
|
4
5
|
import {} from '../../model/Project.js';
|
|
5
6
|
import { normalizeUiGraphRecord } from '../../model/UiGraphNormalization.js';
|
|
@@ -16,6 +17,9 @@ export function graphV4Deserializer(data) {
|
|
|
16
17
|
return fromSerializedGraph(serializedGraph);
|
|
17
18
|
}
|
|
18
19
|
export function projectV4Serializer(project, attachedData) {
|
|
20
|
+
if (!isValidProjectStaticData(project.data)) {
|
|
21
|
+
throw new Error('Project data must be a record of static-data strings');
|
|
22
|
+
}
|
|
19
23
|
// Project Settings canonicalizes these values, but integrations and callers
|
|
20
24
|
// can author Project objects directly. Never write a project file that will
|
|
21
25
|
// later fail its own project-global validation at load or execution time.
|
|
@@ -48,6 +52,7 @@ function toSerializedProject(project, attachedData) {
|
|
|
48
52
|
attachedData,
|
|
49
53
|
plugins: project.plugins ?? [],
|
|
50
54
|
references: project.references ?? [],
|
|
55
|
+
data: project.data,
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
58
|
function fromSerializedProject(serializedProject) {
|
|
@@ -64,6 +69,7 @@ function fromSerializedProject(serializedProject) {
|
|
|
64
69
|
uiGraphs: Object.keys(uiGraphs).length > 0 ? uiGraphs : undefined,
|
|
65
70
|
plugins: serializedProject.plugins ?? [],
|
|
66
71
|
references: serializedProject.references ?? [],
|
|
72
|
+
...(serializedProject.data !== undefined ? { data: serializedProject.data } : {}),
|
|
67
73
|
},
|
|
68
74
|
serializedProject.attachedData ?? {},
|
|
69
75
|
];
|
|
@@ -134,6 +140,7 @@ function fromSerializedGraph(serializedGraph) {
|
|
|
134
140
|
};
|
|
135
141
|
}
|
|
136
142
|
function toSerializedNode(node, allNodes, allConnections) {
|
|
143
|
+
const data = normalizeSerializedLLMTemperatureData(node.type, node.data);
|
|
137
144
|
const outgoingConnections = allConnections
|
|
138
145
|
.filter((connection) => connection.outputNodeId === node.id)
|
|
139
146
|
.map((connection) => serializeConnection(connection, allNodes))
|
|
@@ -145,9 +152,14 @@ function toSerializedNode(node, allNodes, allConnections) {
|
|
|
145
152
|
splitRunMax: node.isSplitRun ? node.splitRunMax : undefined,
|
|
146
153
|
splitRunConcurrency: node.isSplitRun ? node.splitRunConcurrency : undefined,
|
|
147
154
|
isSplitSequential: node.isSplitSequential ? true : undefined,
|
|
148
|
-
data: Object.keys(
|
|
155
|
+
data: Object.keys(data ?? {}).length > 0 ? data : undefined,
|
|
149
156
|
outgoingConnections: outgoingConnections.length > 0 ? outgoingConnections : undefined,
|
|
150
|
-
variants: (node.variants?.length ?? 0) > 0
|
|
157
|
+
variants: (node.variants?.length ?? 0) > 0
|
|
158
|
+
? node.variants.map((variant) => ({
|
|
159
|
+
...variant,
|
|
160
|
+
data: normalizeSerializedLLMTemperatureData(node.type, variant.data),
|
|
161
|
+
}))
|
|
162
|
+
: undefined,
|
|
151
163
|
disabled: node.disabled ? true : undefined,
|
|
152
164
|
isConditional: node.isConditional,
|
|
153
165
|
};
|
|
@@ -15,6 +15,7 @@ import { GraphProcessor } from '../model/GraphProcessor.js';
|
|
|
15
15
|
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
16
16
|
import { type LooseDataValue } from './looseDataValue.js';
|
|
17
17
|
import type { ProjectReferenceLoader } from '../model/ProjectReferenceLoader.js';
|
|
18
|
+
import type { SubgraphProjectLoader } from '../model/SubgraphProjectTarget.js';
|
|
18
19
|
import type { RivetStoredValueStore } from '../model/StoredValueStore.js';
|
|
19
20
|
import type { RivetKnowledgeStoreRegistry } from '../integrations/KnowledgeStore.js';
|
|
20
21
|
import type { RivetLLMProfileHealthStore } from '../model/chat-v2/llmProfileHealthStore.js';
|
|
@@ -47,6 +48,9 @@ export type RunGraphOptions = {
|
|
|
47
48
|
codeRunner?: ProcessContext['codeRunner'];
|
|
48
49
|
projectPath?: string;
|
|
49
50
|
projectReferenceLoader?: ProjectReferenceLoader;
|
|
51
|
+
subgraphProjectLoader?: SubgraphProjectLoader;
|
|
52
|
+
onSubgraphProjectRun?: ProcessContext['onSubgraphProjectRun'];
|
|
53
|
+
subgraphRecordingOptions?: ProcessContext['subgraphRecordingOptions'];
|
|
50
54
|
editorExecutionCache?: ProcessContext['editorExecutionCache'];
|
|
51
55
|
storedValueStore?: RivetStoredValueStore;
|
|
52
56
|
knowledgeStores?: RivetKnowledgeStoreRegistry;
|
|
@@ -73,5 +77,7 @@ export declare function coreCreateProcessor(project: Project, options: RunGraphO
|
|
|
73
77
|
run(): Promise<import("../model/GraphProcessor.js").GraphOutputs>;
|
|
74
78
|
};
|
|
75
79
|
export declare function coreRunGraph(project: Project, options: RunGraphOptions): Promise<Record<string, DataValue>>;
|
|
76
|
-
export declare function loadProjectFromString(content: string
|
|
80
|
+
export declare function loadProjectFromString(content: string, options?: {
|
|
81
|
+
logErrors?: boolean;
|
|
82
|
+
}): Project;
|
|
77
83
|
export declare function loadProjectAndAttachedDataFromString(content: string): [Project, AttachedData];
|
package/dist/types/exports.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export * from './model/ProcessContext.js';
|
|
|
34
34
|
export * from './model/AgentResponseTrace.js';
|
|
35
35
|
export * from './model/DebuggerTransportSentinel.js';
|
|
36
36
|
export * from './model/ProjectReferenceLoader.js';
|
|
37
|
+
export * from './model/SubgraphProjectTarget.js';
|
|
38
|
+
export * from './model/ProjectBundle.js';
|
|
37
39
|
export * from './model/RivetUIContext.js';
|
|
38
40
|
export * from './model/chat-v2/index.js';
|
|
39
41
|
export * from './integrations/integrations.js';
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare function findStronglyConnectedComponents(nodes: ChartNode[], getAdjacentNodes: (node: ChartNode) => ChartNode[]): ChartNode[][];
|
|
1
|
+
export declare function findStronglyConnectedComponents<T extends object>(nodes: T[], getAdjacentNodes: (node: T) => T[]): T[][];
|
|
@@ -253,6 +253,8 @@ export type OutgoingMessageMap = {
|
|
|
253
253
|
projectPath?: string | null;
|
|
254
254
|
useEditorCache?: boolean;
|
|
255
255
|
captureNodeTimings?: boolean;
|
|
256
|
+
/** Hosted editor setting; only the authenticated Node executor uses it. */
|
|
257
|
+
recordSubgraphProjectRuns?: boolean;
|
|
256
258
|
evaluation?: EvaluationExecutionMetadata;
|
|
257
259
|
/**
|
|
258
260
|
* An opaque, host-owned ID that lets a trusted executor join an unhealthy
|
|
@@ -8,6 +8,8 @@ export type GraphBoundaryInput = {
|
|
|
8
8
|
dataType: DataType;
|
|
9
9
|
editor?: DynamicEditorEditor;
|
|
10
10
|
id: string;
|
|
11
|
+
/** Stable Graph Input node identity; older saved boundaries may omit it. */
|
|
12
|
+
nodeId?: NodeId;
|
|
11
13
|
portId: PortId;
|
|
12
14
|
};
|
|
13
15
|
export type GraphBoundaryOutput = {
|
|
@@ -320,6 +320,7 @@ export declare class GraphProcessor {
|
|
|
320
320
|
[asyncBranchInputAnchorsOverride]?: GraphNodeDefinitions;
|
|
321
321
|
[consumedStreamingWatchNodeOverride]?: NodeId;
|
|
322
322
|
});
|
|
323
|
+
get recordingProjectScope(): string | undefined;
|
|
323
324
|
on: Emittery<ProcessEvents>["on"];
|
|
324
325
|
off: Emittery<ProcessEvents>["off"];
|
|
325
326
|
once: Emittery<ProcessEvents>["once"];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { NodeRegistration } from './NodeRegistration.js';
|
|
2
2
|
export * from './nodes/UserInputNode.js';
|
|
3
3
|
export * from './nodes/TextNode.js';
|
|
4
|
+
export { buildNodeBodyPreview } from './nodes/nodeBodyPreview.js';
|
|
4
5
|
export * from './nodes/ChatNode.js';
|
|
5
6
|
export * from './nodes/ChatNodeBase.js';
|
|
6
7
|
export * from './nodes/LLMChatV2Node.js';
|
|
@@ -42,6 +43,8 @@ export * from './DataBusTopology.js';
|
|
|
42
43
|
export * from './nodes/StartBackgroundBranchNode.js';
|
|
43
44
|
export * from './nodes/WatchStreamingOutputNode.js';
|
|
44
45
|
export * from './nodes/StopWatchingStreamingOutputNode.js';
|
|
46
|
+
export * from './nodes/StreamValueNode.js';
|
|
47
|
+
export * from './nodes/CatchStreamingChunksNode.js';
|
|
45
48
|
export * from './nodes/PopNode.js';
|
|
46
49
|
export * from './nodes/SetGlobalNode.js';
|
|
47
50
|
export * from './nodes/GetGlobalNode.js';
|
|
@@ -63,6 +66,7 @@ export * from './nodes/HashNode.js';
|
|
|
63
66
|
export * from './nodes/AbortGraphNode.js';
|
|
64
67
|
export * from './nodes/RaceInputsNode.js';
|
|
65
68
|
export * from './nodes/ToJsonNode.js';
|
|
69
|
+
export * from './nodes/ToBase64Node.js';
|
|
66
70
|
export * from './nodes/JoinNode.js';
|
|
67
71
|
export * from './nodes/FilterNode.js';
|
|
68
72
|
export * from './nodes/JSFilterNode.js';
|
|
@@ -111,12 +115,12 @@ export * from './nodes/ReferencedGraphAliasNode.js';
|
|
|
111
115
|
export * from './nodes/NodePrefabInstanceNode.js';
|
|
112
116
|
export * from './nodes/ClassifierQuestionNode.js';
|
|
113
117
|
export * from './nodes/ClassifierEvaluateNode.js';
|
|
114
|
-
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "setGlobal" | "setStoredValue" | "graphOutput" | "delegateFunctionCall" | "graphCallPath" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "
|
|
118
|
+
export declare const registerBuiltInNodes: (registry: NodeRegistration) => NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "userInput" | "graphInput" | "setGlobal" | "setStoredValue" | "graphOutput" | "delegateFunctionCall" | "graphCallPath" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "matchCase" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "projectName" | "coalesce" | "coalesceNew" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "watchStreamingOutput" | "stopWatchingStreamingOutput" | "streamValue" | "catchStreamingChunks" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "toBase64" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance" | "classifierQuestion" | "classifierEvaluate", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/LLMProfileNode.js").LLMProfileNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/CodeNewNode.js").CodeNewNode | import("./nodes/ExpressionNode.js").ExpressionNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/MatchCaseNode.js").MatchCaseNode | 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/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/ReportProgressNode.js").ReportProgressNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/GraphCallPathNode.js").GraphCallPathNode | import("./nodes/ProjectNameNode.js").ProjectNameNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/CoalesceNewNode.js").CoalesceNewNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/DataBusNode.js").DataBusNode | import("./nodes/StartBackgroundBranchNode.js").StartBackgroundBranchNode | import("./nodes/WatchStreamingOutputNode.js").WatchStreamingOutputNode | import("./nodes/StopWatchingStreamingOutputNode.js").StopWatchingStreamingOutputNode | import("./nodes/StreamValueNode.js").StreamValueNode | import("./nodes/CatchStreamingChunksNode.js").CatchStreamingChunksNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/SetStoredValueNode.js").SetStoredValueNode | import("./nodes/GetStoredValueNode.js").GetStoredValueNode | 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/KnowledgeSourceNode.js").KnowledgeSourceNode | import("./nodes/KnowledgeDocumentNode.js").KnowledgeDocumentNode | import("./nodes/SyncKnowledgeSourceNode.js").SyncKnowledgeSourceNode | import("./nodes/GetKnowledgeSourceStatusNode.js").GetKnowledgeSourceStatusNode | import("./nodes/SearchKnowledgeNode.js").SearchKnowledgeNode | import("./nodes/BuildKnowledgeContextNode.js").BuildKnowledgeContextNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/ToBase64Node.js").ToBase64Node | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/JSFilterNode.js").JSFilterNode | import("./nodes/JSMapNode.js").JSMapNode | 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 | 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("./NodeBase.js").NodeBase & {
|
|
115
119
|
type: "mcpDiscovery";
|
|
116
120
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
117
121
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
118
122
|
}) | import("./nodes/MCPToolCallNode.js").MCPToolCallNode | import("./nodes/MCPGetPromptNode.js").MCPGetPromptNode | import("./nodes/ReferencedGraphAliasNode.js").ReferencedGraphAliasNode | import("./NodePrefabResolver.js").NodePrefabInstanceNode | import("./nodes/ClassifierQuestionNode.js").ClassifierQuestionNode | import("./nodes/ClassifierEvaluateNode.js").ClassifierEvaluateNode>;
|
|
119
|
-
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "graphInput" | "setGlobal" | "setStoredValue" | "graphOutput" | "delegateFunctionCall" | "graphCallPath" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "
|
|
123
|
+
declare let globalRivetNodeRegistry: NodeRegistration<"number" | "boolean" | "object" | "pop" | "join" | "slice" | "filter" | "match" | "split" | "image" | "audio" | "document" | "if" | "text" | "chat" | "array" | "code" | "context" | "userInput" | "graphInput" | "setGlobal" | "setStoredValue" | "graphOutput" | "delegateFunctionCall" | "graphCallPath" | "raiseEvent" | "reportProgress" | "getGlobal" | "getStoredValue" | "abortGraph" | "prompt" | "llmChatV2" | "llmProfile" | "extractRegex" | "codeNew" | "expression" | "matchCase" | "readDirectory" | "readFile" | "ifElse" | "chunk" | "subGraph" | "extractJson" | "assemblePrompt" | "extractYaml" | "loopController" | "trimChatMessages" | "externalCall" | "extractObjectPath" | "projectName" | "coalesce" | "coalesceNew" | "didRun" | "passthrough" | "dataBus" | "startBackgroundBranch" | "watchStreamingOutput" | "stopWatchingStreamingOutput" | "streamValue" | "catchStreamingChunks" | "waitForEvent" | "gptFunction" | "toYaml" | "getEmbedding" | "vectorStore" | "vectorNearestNeighbors" | "knowledgeSource" | "knowledgeDocument" | "syncKnowledgeSource" | "getKnowledgeSourceStatus" | "searchKnowledge" | "buildKnowledgeContext" | "hash" | "raceInputs" | "toJson" | "toBase64" | "jsFilter" | "jsMap" | "compare" | "evaluate" | "randomNumber" | "shuffle" | "comment" | "httpCall" | "delay" | "appendToDataset" | "createDataset" | "loadDataset" | "getAllDatasets" | "datasetNearestNeighbors" | "getDatasetRow" | "extractMarkdownCodeBlocks" | "assembleMessage" | "urlReference" | "destructure" | "replaceDataset" | "listGraphs" | "graphReference" | "callGraph" | "playAudio" | "chatLoop" | "readAllFiles" | "toMarkdownTable" | "cron" | "toTree" | "loopUntil" | "mcpDiscovery" | "mcpToolCall" | "mcpGetPrompt" | "referencedGraphAlias" | "nodePrefabInstance" | "classifierQuestion" | "classifierEvaluate", import("./nodes/GraphInputNode.js").GraphInputNode | import("./nodes/GraphOutputNode.js").GraphOutputNode | import("./chat-v2/llmChatV2NodeData.js").LLMChatV2Node | import("./nodes/UserInputNode.js").UserInputNode | import("./nodes/TextNode.js").TextNode | import("./nodes/ChatNode.js").ChatNode | import("./nodes/LLMProfileNode.js").LLMProfileNode | import("./nodes/PromptNode.js").PromptNode | import("./nodes/ExtractRegexNode.js").ExtractRegexNode | import("./nodes/CodeNode.js").CodeNode | import("./nodes/CodeNewNode.js").CodeNewNode | import("./nodes/ExpressionNode.js").ExpressionNode | import("./nodes/MatchNode.js").MatchNode | import("./nodes/MatchCaseNode.js").MatchCaseNode | 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/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/ReportProgressNode.js").ReportProgressNode | import("./nodes/ContextNode.js").ContextNode | import("./nodes/GraphCallPathNode.js").GraphCallPathNode | import("./nodes/ProjectNameNode.js").ProjectNameNode | import("./nodes/CoalesceNode.js").CoalesceNode | import("./nodes/CoalesceNewNode.js").CoalesceNewNode | import("./nodes/DidRunNode.js").DidRunNode | import("./nodes/PassthroughNode.js").PassthroughNode | import("./nodes/DataBusNode.js").DataBusNode | import("./nodes/StartBackgroundBranchNode.js").StartBackgroundBranchNode | import("./nodes/WatchStreamingOutputNode.js").WatchStreamingOutputNode | import("./nodes/StopWatchingStreamingOutputNode.js").StopWatchingStreamingOutputNode | import("./nodes/StreamValueNode.js").StreamValueNode | import("./nodes/CatchStreamingChunksNode.js").CatchStreamingChunksNode | import("./nodes/PopNode.js").PopNode | import("./nodes/SetGlobalNode.js").SetGlobalNode | import("./nodes/GetGlobalNode.js").GetGlobalNode | import("./nodes/SetStoredValueNode.js").SetStoredValueNode | import("./nodes/GetStoredValueNode.js").GetStoredValueNode | 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/KnowledgeSourceNode.js").KnowledgeSourceNode | import("./nodes/KnowledgeDocumentNode.js").KnowledgeDocumentNode | import("./nodes/SyncKnowledgeSourceNode.js").SyncKnowledgeSourceNode | import("./nodes/GetKnowledgeSourceStatusNode.js").GetKnowledgeSourceStatusNode | import("./nodes/SearchKnowledgeNode.js").SearchKnowledgeNode | import("./nodes/BuildKnowledgeContextNode.js").BuildKnowledgeContextNode | import("./nodes/HashNode.js").HashNode | import("./nodes/AbortGraphNode.js").AbortGraphNode | import("./nodes/RaceInputsNode.js").RaceInputsNode | import("./nodes/ToJsonNode.js").ToJsonNode | import("./nodes/ToBase64Node.js").ToBase64Node | import("./nodes/JoinNode.js").JoinNode | import("./nodes/FilterNode.js").FilterNode | import("./nodes/JSFilterNode.js").JSFilterNode | import("./nodes/JSMapNode.js").JSMapNode | 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 | 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("./NodeBase.js").NodeBase & {
|
|
120
124
|
type: "mcpDiscovery";
|
|
121
125
|
data: import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData;
|
|
122
126
|
variants?: import("./NodeBase.js").ChartNodeVariant<import("./nodes/MCPDiscoveryNode.js").MCPDiscoveryNodeData>[] | undefined;
|
|
@@ -3,6 +3,8 @@ import { type RuntimeSettings, type NativeApi, type Project, type DataValue, typ
|
|
|
3
3
|
import type { Tokenizer } from '../integrations/Tokenizer.js';
|
|
4
4
|
import type { CodeRunner } from '../integrations/CodeRunner.js';
|
|
5
5
|
import type { ProjectReferenceLoader } from './ProjectReferenceLoader.js';
|
|
6
|
+
import type { ResolvedSubgraphProject, SubgraphProjectLoader, SubgraphProjectRun } from './SubgraphProjectTarget.js';
|
|
7
|
+
import type { ExecutionRecorderOptions } from '../recording/ExecutionRecorder.js';
|
|
6
8
|
import type { GraphBoundary } from './GraphBoundaryCache.js';
|
|
7
9
|
import type { GraphInputStream } from './GraphInputStream.js';
|
|
8
10
|
import type { GraphProgress } from './GraphProgress.js';
|
|
@@ -174,6 +176,12 @@ export type ProcessContext = {
|
|
|
174
176
|
codeRunner?: CodeRunner;
|
|
175
177
|
/** The loader for loading project references. */
|
|
176
178
|
projectReferenceLoader?: ProjectReferenceLoader;
|
|
179
|
+
/** Host-only resolver for Studio Server Subgraph nodes targeting another saved project. */
|
|
180
|
+
subgraphProjectLoader?: SubgraphProjectLoader;
|
|
181
|
+
/** Optional host-owned recording sink. Failures must not alter graph results. */
|
|
182
|
+
onSubgraphProjectRun?: (run: SubgraphProjectRun) => void | Promise<void>;
|
|
183
|
+
/** Apply the host's recording privacy settings to called-project replays. */
|
|
184
|
+
subgraphRecordingOptions?: ExecutionRecorderOptions;
|
|
177
185
|
/** The path to the current project. Required if project references are being used. */
|
|
178
186
|
projectPath?: string;
|
|
179
187
|
/**
|
|
@@ -235,11 +243,15 @@ export type GraphExecutionMetadata = {
|
|
|
235
243
|
rootRunId: RootRunId;
|
|
236
244
|
graphRunId: GraphRunId;
|
|
237
245
|
graphId: GraphId;
|
|
246
|
+
/** Present for a hosted Subgraph call into another saved project. */
|
|
247
|
+
projectScope?: string;
|
|
238
248
|
parentGraphRunId?: GraphRunId;
|
|
239
249
|
executor?: SubgraphExecutorMetadata;
|
|
240
250
|
evaluation?: EvaluationExecutionMetadata;
|
|
241
251
|
};
|
|
242
252
|
export type InternalProcessContext<T extends ChartNode = ChartNode> = ProcessContext & {
|
|
253
|
+
/** Dataset snapshot belonging to this node's selected external Subgraph target. */
|
|
254
|
+
subgraphTarget?: ResolvedSubgraphProject;
|
|
243
255
|
/** Invocation-scoped live inputs for a named graph caller. Never serialized. */
|
|
244
256
|
graphInputStreams?: Readonly<Record<string, GraphInputStream>>;
|
|
245
257
|
/** The executor that is running the current processor. */
|