@valerypopoff/rivet2-core 2.13.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.
Files changed (134) hide show
  1. package/dist/cjs/bundle.cjs +28167 -23834
  2. package/dist/cjs/bundle.cjs.map +4 -4
  3. package/dist/cjs/interpolationRuntime.cjs +22 -3
  4. package/dist/cjs/interpolationRuntime.cjs.map +3 -3
  5. package/dist/cjs/interpolationSyntax.cjs +9 -5
  6. package/dist/cjs/interpolationSyntax.cjs.map +2 -2
  7. package/dist/esm/api/createProcessor.js +10 -2
  8. package/dist/esm/api/processSettings.js +1 -0
  9. package/dist/esm/exports.js +6 -0
  10. package/dist/esm/model/GraphBoundaryCache.js +2 -1
  11. package/dist/esm/model/GraphProcessor.js +278 -22
  12. package/dist/esm/model/MarkdownSanitizationPolicy.js +2 -0
  13. package/dist/esm/model/NodeImpl.js +1 -1
  14. package/dist/esm/model/Nodes.js +16 -0
  15. package/dist/esm/model/ProjectBundle.js +235 -0
  16. package/dist/esm/model/SplitRunProcessor.js +28 -7
  17. package/dist/esm/model/StreamingWatchTopology.js +211 -64
  18. package/dist/esm/model/SubgraphProjectTarget.js +7 -0
  19. package/dist/esm/model/chat-v2/aiSdkBridge.js +7 -5
  20. package/dist/esm/model/chat-v2/chatV2Pipeline.js +13 -8
  21. package/dist/esm/model/chat-v2/chatV2RuntimeOptions.js +19 -1
  22. package/dist/esm/model/chat-v2/chatV2Shared.js +2 -1
  23. package/dist/esm/model/chat-v2/llmChatV2Body.js +11 -8
  24. package/dist/esm/model/chat-v2/llmChatV2NodeData.js +2 -0
  25. package/dist/esm/model/chat-v2/llmChatV2NodeEditors.js +15 -1
  26. package/dist/esm/model/chat-v2/llmChatV2NodeMigration.js +22 -2
  27. package/dist/esm/model/chat-v2/llmProfile.js +3 -0
  28. package/dist/esm/model/chat-v2/llmProfileBody.js +2 -2
  29. package/dist/esm/model/chat-v2/llmProfileFieldRegistry.js +1 -1
  30. package/dist/esm/model/chat-v2/llmProfileNodeRuntime.js +1 -1
  31. package/dist/esm/model/chat-v2/temperature.js +9 -0
  32. package/dist/esm/model/classifier/credentials.js +107 -0
  33. package/dist/esm/model/classifier/images.js +176 -0
  34. package/dist/esm/model/classifier/json.js +57 -0
  35. package/dist/esm/model/classifier/limits.js +270 -0
  36. package/dist/esm/model/classifier/migration.js +97 -0
  37. package/dist/esm/model/classifier/openai.js +118 -0
  38. package/dist/esm/model/classifier/preparation.js +74 -0
  39. package/dist/esm/model/classifier/providers.js +422 -0
  40. package/dist/esm/model/classifier/questionHelpers.js +109 -0
  41. package/dist/esm/model/classifier/questions.js +53 -0
  42. package/dist/esm/model/classifier/response.js +75 -0
  43. package/dist/esm/model/classifier/state.js +204 -0
  44. package/dist/esm/model/classifier/types.js +1 -0
  45. package/dist/esm/model/nodeBodyMarkdown.js +37 -0
  46. package/dist/esm/model/nodeRunFailure.js +47 -0
  47. package/dist/esm/model/nodes/CatchStreamingChunksNode.js +42 -0
  48. package/dist/esm/model/nodes/ClassifierEvaluateNode.js +432 -0
  49. package/dist/esm/model/nodes/ClassifierQuestionNode.js +613 -0
  50. package/dist/esm/model/nodes/CodeNewNode.js +33 -9
  51. package/dist/esm/model/nodes/GetGlobalNode.js +2 -2
  52. package/dist/esm/model/nodes/HttpCallNode.js +44 -75
  53. package/dist/esm/model/nodes/ImageNode.js +44 -3
  54. package/dist/esm/model/nodes/LLMChatV2Node.js +27 -15
  55. package/dist/esm/model/nodes/LLMProfileNode.js +6 -12
  56. package/dist/esm/model/nodes/MatchCaseNode.js +76 -1
  57. package/dist/esm/model/nodes/MatchCaseNodeBase.js +24 -2
  58. package/dist/esm/model/nodes/ObjectNode.js +68 -50
  59. package/dist/esm/model/nodes/PassthroughNode.js +1 -1
  60. package/dist/esm/model/nodes/PromptNode.js +2 -1
  61. package/dist/esm/model/nodes/ReferencedGraphAliasNode.js +4 -1
  62. package/dist/esm/model/nodes/SetGlobalNode.js +5 -3
  63. package/dist/esm/model/nodes/StopWatchingStreamingOutputNode.js +8 -8
  64. package/dist/esm/model/nodes/StreamValueNode.js +38 -0
  65. package/dist/esm/model/nodes/SubGraphNode.js +196 -35
  66. package/dist/esm/model/nodes/ToBase64Node.js +106 -0
  67. package/dist/esm/model/nodes/WatchStreamingOutputNode.js +7 -7
  68. package/dist/esm/model/nodes/codeOutputInference.js +292 -0
  69. package/dist/esm/recording/ExecutionRecorder.js +26 -0
  70. package/dist/esm/utils/base64.js +18 -15
  71. package/dist/esm/utils/errors.js +41 -0
  72. package/dist/esm/utils/interpolation.js +44 -22
  73. package/dist/esm/utils/interpolationSyntax.js +15 -6
  74. package/dist/esm/utils/serialization/serialization.js +7 -2
  75. package/dist/esm/utils/serialization/serializationUtils.js +6 -0
  76. package/dist/esm/utils/serialization/serialization_v4.js +15 -3
  77. package/dist/types/api/createProcessor.d.ts +7 -1
  78. package/dist/types/exports.d.ts +6 -0
  79. package/dist/types/model/CycleDetector.d.ts +1 -2
  80. package/dist/types/model/EditorDefinition.d.ts +24 -0
  81. package/dist/types/model/ExecutorProtocol.d.ts +2 -0
  82. package/dist/types/model/GraphBoundaryCache.d.ts +2 -0
  83. package/dist/types/model/GraphProcessor.d.ts +1 -0
  84. package/dist/types/model/MarkdownSanitizationPolicy.d.ts +1 -1
  85. package/dist/types/model/NodeImpl.d.ts +3 -1
  86. package/dist/types/model/Nodes.d.ts +10 -4
  87. package/dist/types/model/ProcessContext.d.ts +12 -0
  88. package/dist/types/model/ProjectBundle.d.ts +54 -0
  89. package/dist/types/model/ProjectReferenceLoader.d.ts +3 -0
  90. package/dist/types/model/Settings.d.ts +4 -0
  91. package/dist/types/model/StreamingWatchTopology.d.ts +17 -1
  92. package/dist/types/model/SubgraphProjectTarget.d.ts +38 -0
  93. package/dist/types/model/chat-v2/chatV2Shared.d.ts +1 -1
  94. package/dist/types/model/chat-v2/llmChatV2NodeData.d.ts +3 -1
  95. package/dist/types/model/chat-v2/llmChatV2NodeMigration.d.ts +3 -1
  96. package/dist/types/model/chat-v2/llmProfileFieldRegistry.d.ts +6 -6
  97. package/dist/types/model/chat-v2/temperature.d.ts +2 -0
  98. package/dist/types/model/classifier/credentials.d.ts +26 -0
  99. package/dist/types/model/classifier/images.d.ts +18 -0
  100. package/dist/types/model/classifier/json.d.ts +19 -0
  101. package/dist/types/model/classifier/limits.d.ts +42 -0
  102. package/dist/types/model/classifier/migration.d.ts +18 -0
  103. package/dist/types/model/classifier/openai.d.ts +5 -0
  104. package/dist/types/model/classifier/preparation.d.ts +16 -0
  105. package/dist/types/model/classifier/providers.d.ts +136 -0
  106. package/dist/types/model/classifier/questionHelpers.d.ts +33 -0
  107. package/dist/types/model/classifier/questions.d.ts +4 -0
  108. package/dist/types/model/classifier/response.d.ts +4 -0
  109. package/dist/types/model/classifier/state.d.ts +37 -0
  110. package/dist/types/model/classifier/types.d.ts +60 -0
  111. package/dist/types/model/nodeBodyMarkdown.d.ts +19 -0
  112. package/dist/types/model/nodeRunFailure.d.ts +13 -0
  113. package/dist/types/model/nodes/CatchStreamingChunksNode.d.ts +20 -0
  114. package/dist/types/model/nodes/ClassifierEvaluateNode.d.ts +50 -0
  115. package/dist/types/model/nodes/ClassifierQuestionNode.d.ts +60 -0
  116. package/dist/types/model/nodes/CodeNewNode.d.ts +6 -0
  117. package/dist/types/model/nodes/GetGlobalNode.d.ts +7 -0
  118. package/dist/types/model/nodes/ImageNode.d.ts +4 -0
  119. package/dist/types/model/nodes/LLMChatV2Node.d.ts +1 -0
  120. package/dist/types/model/nodes/MatchCaseNode.d.ts +8 -1
  121. package/dist/types/model/nodes/MatchCaseNodeBase.d.ts +13 -1
  122. package/dist/types/model/nodes/ObjectNode.d.ts +6 -0
  123. package/dist/types/model/nodes/StreamValueNode.d.ts +14 -0
  124. package/dist/types/model/nodes/SubGraphNode.d.ts +21 -2
  125. package/dist/types/model/nodes/ToBase64Node.d.ts +12 -0
  126. package/dist/types/model/nodes/codeOutputInference.d.ts +31 -0
  127. package/dist/types/recording/ExecutionRecorder.d.ts +8 -2
  128. package/dist/types/utils/base64.d.ts +1 -1
  129. package/dist/types/utils/errors.d.ts +4 -0
  130. package/dist/types/utils/interpolation.d.ts +13 -2
  131. package/dist/types/utils/interpolationSyntax.d.ts +1 -1
  132. package/dist/types/utils/serialization/serialization.d.ts +3 -1
  133. package/dist/types/utils/serialization/serializationUtils.d.ts +1 -0
  134. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import {} from '../DataValue.js';
2
2
  import {} from '../EditorDefinition.js';
3
3
  import {} from '../GraphProcessor.js';
4
+ import {} from '../ProcessContext.js';
4
5
  import { NodeImpl } from '../NodeImpl.js';
5
6
  import {} from '../NodeBase.js';
6
7
  import { coerceType } from '../../utils/coerceType.js';
@@ -11,6 +12,10 @@ import { resolveStoredOrderedPortIds } from '../../utils/orderedStringPortIds.js
11
12
  * only its matching semantics and editor wording.
12
13
  */
13
14
  export class MatchCaseNodeBase extends NodeImpl {
15
+ caseEditorHelperMessage = undefined;
16
+ caseEditorHighlightsInterpolation = false;
17
+ caseEditorInputFontFamily = undefined;
18
+ caseEditorBoxed = false;
14
19
  casesEditorPlacement = 'after-custom-values';
15
20
  customCaseValuesEditorLabel = 'Custom case values';
16
21
  defaultExclusive = false;
@@ -31,6 +36,17 @@ export class MatchCaseNodeBase extends NodeImpl {
31
36
  shouldHideCustomCaseValues(_data) {
32
37
  return false;
33
38
  }
39
+ /**
40
+ * Current Match case resolves its saved case templates at execution time.
41
+ * The legacy Regex Match node deliberately leaves its saved expressions raw.
42
+ */
43
+ resolveCaseValues(_inputs, _context) {
44
+ return this.data.cases;
45
+ }
46
+ /** Additional inputs that sit between the tested value and custom return values. */
47
+ getInterpolationInputDefinitions() {
48
+ return [];
49
+ }
34
50
  getInputDefinitions() {
35
51
  const inputs = [
36
52
  {
@@ -41,6 +57,7 @@ export class MatchCaseNodeBase extends NodeImpl {
41
57
  description: `The ${this.inputTitle} value tested against each case.`,
42
58
  },
43
59
  ];
60
+ inputs.push(...this.getInterpolationInputDefinitions());
44
61
  if (this.getReturnValueMode() !== 'custom') {
45
62
  return inputs;
46
63
  }
@@ -103,6 +120,10 @@ export class MatchCaseNodeBase extends NodeImpl {
103
120
  dataKey: 'cases',
104
121
  label: this.caseEditorLabel,
105
122
  placeholder: this.caseEditorPlaceholder,
123
+ helperMessage: this.caseEditorHelperMessage,
124
+ highlightInterpolationTokens: this.caseEditorHighlightsInterpolation,
125
+ inputFontFamily: this.caseEditorInputFontFamily,
126
+ boxed: this.caseEditorBoxed,
106
127
  reorderable: true,
107
128
  portBinding: {
108
129
  side: 'output',
@@ -141,12 +162,13 @@ export class MatchCaseNodeBase extends NodeImpl {
141
162
  ...(this.casesEditorPlacement === 'after-custom-values' ? [casesEditor] : []),
142
163
  ];
143
164
  }
144
- async process(inputs) {
165
+ async process(inputs, context) {
145
166
  const inputValue = inputs['input'];
146
167
  const inputString = inputValue?.value == null ? undefined : coerceType(inputValue, 'string');
147
168
  const portIds = this.getCasePortIds();
148
169
  const sharedValue = inputs['value'];
149
170
  const returnValueMode = this.getReturnValueMode();
171
+ const resolvedCaseValues = this.resolveCaseValues(inputs, context);
150
172
  const getInputOutputValue = () => ({
151
173
  type: 'string',
152
174
  value: inputString,
@@ -168,7 +190,7 @@ export class MatchCaseNodeBase extends NodeImpl {
168
190
  let matched = false;
169
191
  const output = {};
170
192
  for (let index = 0; index < this.data.cases.length; index++) {
171
- const caseValue = this.data.cases[index];
193
+ const caseValue = resolvedCaseValues[index] ?? this.data.cases[index];
172
194
  const matches = inputString !== undefined && this.matchesCase(inputString, caseValue);
173
195
  const canMatch = !this.getExclusive() || !matched;
174
196
  const portId = portIds[index];
@@ -20,15 +20,6 @@ function isEscapedCharacter(value, index) {
20
20
  function isUnescapedQuoteAt(value, index) {
21
21
  return index >= 0 && index < value.length && value[index] === '"' && !isEscapedCharacter(value, index);
22
22
  }
23
- function isInsideJsonString(value, index) {
24
- let insideString = false;
25
- for (let i = 0; i < index; i++) {
26
- if (isUnescapedQuoteAt(value, i)) {
27
- insideString = !insideString;
28
- }
29
- }
30
- return insideString;
31
- }
32
23
  function stringifyJsonValue(value) {
33
24
  if (value == null) {
34
25
  return 'null';
@@ -48,6 +39,73 @@ function stringifyEmbeddedJsonStringFragment(value) {
48
39
  const fragment = value == null ? 'null' : typeof value === 'string' ? value : JSON.stringify(value) ?? 'null';
49
40
  return JSON.stringify(fragment).slice(1, -1);
50
41
  }
42
+ /**
43
+ * Interpolates a JSON template without parsing it. Shared by Object and other
44
+ * first-party nodes which author structured EntryType values.
45
+ */
46
+ export function interpolateJsonTemplate(baseString, values, graphInputNodeValues, contextValues, globalValues, guard, unwrapVariableDataValues = false) {
47
+ guard?.check();
48
+ const protectedBaseString = protectEscapedInterpolationTokens(baseString);
49
+ const parsedTemplate = parseInterpolationTemplate(protectedBaseString, guard?.check, guard?.tokenLimit);
50
+ if (parsedTemplate.tokens.length === 0) {
51
+ return restoreEscapedInterpolationTokens(protectedBaseString);
52
+ }
53
+ let result = '';
54
+ let cursor = 0;
55
+ let quoteCursor = 0;
56
+ let insideString = false;
57
+ let escaped = false;
58
+ const append = (fragment) => {
59
+ guard?.output(fragment, result.length);
60
+ result += fragment;
61
+ };
62
+ for (const token of parsedTemplate.tokens) {
63
+ const tokenSpan = token.span;
64
+ guard?.check();
65
+ // Scan authored quotes once, including token contents, matching the old
66
+ // per-token scan without repeatedly walking the entire template prefix.
67
+ for (; quoteCursor < tokenSpan.start; quoteCursor++) {
68
+ if ((quoteCursor & 4095) === 0)
69
+ guard?.check();
70
+ const character = protectedBaseString[quoteCursor];
71
+ if (character === '"' && !escaped)
72
+ insideString = !insideString;
73
+ escaped = character === '\\' && !escaped;
74
+ }
75
+ const isInsideString = insideString;
76
+ const isWholeQuotedToken = isInsideString &&
77
+ isUnescapedQuoteAt(protectedBaseString, tokenSpan.start - 1) &&
78
+ isUnescapedQuoteAt(protectedBaseString, tokenSpan.end);
79
+ const replacementStart = isWholeQuotedToken ? tokenSpan.start - 1 : tokenSpan.start;
80
+ const replacementEnd = isWholeQuotedToken ? tokenSpan.end + 1 : tokenSpan.end;
81
+ const value = token.reference
82
+ ? resolveInterpolationExpressionRawValue(token.reference, {
83
+ variables: values,
84
+ graphInputValues: graphInputNodeValues,
85
+ contextValues,
86
+ globalValues,
87
+ unwrapVariableDataValues,
88
+ guard,
89
+ })
90
+ : undefined;
91
+ // Restore escaped delimiters only from the authored JSON template. An
92
+ // interpolated string may itself contain literal interpolation syntax and
93
+ // must not be processed again while the final JSON is assembled.
94
+ append(restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor, replacementStart)));
95
+ if (isInsideString && !isWholeQuotedToken) {
96
+ append(stringifyEmbeddedJsonStringFragment(value));
97
+ }
98
+ else if (isWholeQuotedToken) {
99
+ append(stringifyWholeQuotedJsonValue(value));
100
+ }
101
+ else {
102
+ append(stringifyJsonValue(value));
103
+ }
104
+ cursor = replacementEnd;
105
+ }
106
+ append(restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor)));
107
+ return result;
108
+ }
51
109
  export class ObjectNodeImpl extends NodeImpl {
52
110
  static create() {
53
111
  const chartNode = {
@@ -117,47 +175,7 @@ export class ObjectNodeImpl extends NodeImpl {
117
175
  };
118
176
  }
119
177
  interpolate(baseString, values, graphInputNodeValues, contextValues, globalValues) {
120
- const protectedBaseString = protectEscapedInterpolationTokens(baseString);
121
- const parsedTemplate = parseInterpolationTemplate(protectedBaseString);
122
- if (parsedTemplate.tokens.length === 0) {
123
- return restoreEscapedInterpolationTokens(protectedBaseString);
124
- }
125
- let result = '';
126
- let cursor = 0;
127
- for (const token of parsedTemplate.tokens) {
128
- const tokenSpan = token.span;
129
- const isInsideString = isInsideJsonString(protectedBaseString, tokenSpan.start);
130
- const isWholeQuotedToken = isInsideString &&
131
- isUnescapedQuoteAt(protectedBaseString, tokenSpan.start - 1) &&
132
- isUnescapedQuoteAt(protectedBaseString, tokenSpan.end);
133
- const replacementStart = isWholeQuotedToken ? tokenSpan.start - 1 : tokenSpan.start;
134
- const replacementEnd = isWholeQuotedToken ? tokenSpan.end + 1 : tokenSpan.end;
135
- const value = token.reference
136
- ? resolveInterpolationExpressionRawValue(token.reference, {
137
- variables: values,
138
- graphInputValues: graphInputNodeValues,
139
- contextValues,
140
- globalValues,
141
- unwrapVariableDataValues: false,
142
- })
143
- : undefined;
144
- // Restore escaped delimiters only from the authored JSON template. An
145
- // interpolated string may itself contain literal interpolation syntax and
146
- // must not be processed again while the final JSON is assembled.
147
- result += restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor, replacementStart));
148
- if (isInsideString && !isWholeQuotedToken) {
149
- result += stringifyEmbeddedJsonStringFragment(value);
150
- }
151
- else if (isWholeQuotedToken) {
152
- result += stringifyWholeQuotedJsonValue(value);
153
- }
154
- else {
155
- result += stringifyJsonValue(value);
156
- }
157
- cursor = replacementEnd;
158
- }
159
- result += restoreEscapedInterpolationTokens(protectedBaseString.slice(cursor));
160
- return result;
178
+ return interpolateJsonTemplate(baseString, values, graphInputNodeValues, contextValues, globalValues);
161
179
  }
162
180
  async process(inputs, context) {
163
181
  const inputMap = Object.keys(inputs).reduce((acc, key) => {
@@ -32,7 +32,7 @@ export class PassthroughNodeImpl extends NodeImpl {
32
32
  visualData: {
33
33
  x: 0,
34
34
  y: 0,
35
- width: 175,
35
+ width: 190,
36
36
  },
37
37
  };
38
38
  return chartNode;
@@ -9,6 +9,7 @@ import { getInputOrData } from '../../utils/index.js';
9
9
  import { extractInterpolationVariableReferences, getInterpolationGlobalValues, interpolate } from '../../utils/interpolation.js';
10
10
  import { match } from 'ts-pattern';
11
11
  import { createInterpolationInputDefinition } from '../interpolationInputDefinition.js';
12
+ import { buildNodeBodyPreview } from './nodeBodyPreview.js';
12
13
  export class PromptNodeImpl extends NodeImpl {
13
14
  static create() {
14
15
  const chartNode = {
@@ -164,7 +165,7 @@ export class PromptNodeImpl extends NodeImpl {
164
165
  },
165
166
  {
166
167
  type: 'colorized',
167
- text: this.data.promptText.split('\n').slice(0, 15).join('\n').trim(),
168
+ text: buildNodeBodyPreview(this.data.promptText),
168
169
  language: 'prompt-interpolation-markdown',
169
170
  theme: 'prompt-interpolation',
170
171
  },
@@ -124,7 +124,10 @@ export class ReferencedGraphAliasNodeImpl extends NodeImpl {
124
124
  });
125
125
  try {
126
126
  const startTime = Date.now();
127
- const outputs = await subGraphProcessor.processGraph(context, inputData, context.contextValues, {
127
+ const outputs = await subGraphProcessor.processGraph({
128
+ ...context,
129
+ datasetProvider: context.projectReferenceLoader?.getDatasetProvider?.(referencedProject) ?? context.datasetProvider,
130
+ }, inputData, context.contextValues, {
128
131
  graphInputStreams: context.graphInputStreams,
129
132
  // This node preserves the referenced graph's named boundary ports,
130
133
  // so it may relay their direct producer partials to a parent Watch.
@@ -46,15 +46,17 @@ export class SetGlobalNodeImpl extends NodeImpl {
46
46
  return inputs;
47
47
  }
48
48
  getOutputDefinitions() {
49
+ const { id, useIdInput } = this.data;
50
+ const fixedId = !useIdInput && typeof id === 'string' && id.trim() ? id : undefined;
49
51
  return [
50
52
  {
51
53
  id: 'saved-value',
52
- title: 'Value',
54
+ title: fixedId ?? 'Value',
53
55
  dataType: this.data.dataType,
54
56
  },
55
57
  {
56
58
  id: 'previous-value',
57
- title: 'Previous Value',
59
+ title: fixedId ? `Prev value of: ${fixedId}` : 'Previous Value',
58
60
  dataType: this.data.dataType,
59
61
  },
60
62
  {
@@ -83,7 +85,7 @@ export class SetGlobalNodeImpl extends NodeImpl {
83
85
  }
84
86
  getBody() {
85
87
  return dedent `
86
- ${this.data.id}
88
+ ${this.data.useIdInput ? '(ID from input)' : this.data.id}
87
89
  Type: ${this.data.dataType}
88
90
  `;
89
91
  }
@@ -7,7 +7,7 @@ export class StopWatchingStreamingOutputNodeImpl extends NodeImpl {
7
7
  return {
8
8
  data: {},
9
9
  id: nanoid(),
10
- title: 'Stop Watching Streaming Output',
10
+ title: 'Stop watching streaming',
11
11
  type: 'stopWatchingStreamingOutput',
12
12
  visualData: { x: 0, y: 0, width: 230 },
13
13
  };
@@ -20,11 +20,11 @@ export class StopWatchingStreamingOutputNodeImpl extends NodeImpl {
20
20
  }
21
21
  static getUIData() {
22
22
  return {
23
- contextMenuTitle: 'Stop Watching Streaming Output',
24
- group: ['Logic'],
25
- infoBoxTitle: 'Stop Watching Streaming Output Node',
23
+ contextMenuTitle: 'Stop watching streaming',
24
+ group: ['Streaming'],
25
+ infoBoxTitle: 'Stop watching streaming node',
26
26
  infoBoxBody: dedent `
27
- Accepts a value from a Watch Streaming Output branch, stops future streaming
27
+ Accepts a value from a Watch streaming branch, stops future streaming
28
28
  snapshots, and lets its completed output continue through the ordinary graph.
29
29
  In parallel mode, the first completed branch to reach this node wins.
30
30
  If the stream ends without a value reaching this node, it is shown as Not ran
@@ -38,13 +38,13 @@ export class StopWatchingStreamingOutputNodeImpl extends NodeImpl {
38
38
  async process(inputs, context) {
39
39
  const value = inputs['value'];
40
40
  if (!value) {
41
- throw new Error('Stop Watching Streaming Output requires a value.');
41
+ throw new Error('Stop watching streaming requires a value.');
42
42
  }
43
43
  if (!context.acceptStreamingWatchStop) {
44
- throw new Error('Stop Watching Streaming Output must be downstream of Watch Streaming Output.');
44
+ throw new Error('Stop watching streaming must be downstream of Watch streaming.');
45
45
  }
46
46
  context.acceptStreamingWatchStop();
47
47
  return { ['value']: value };
48
48
  }
49
49
  }
50
- export const stopWatchingStreamingOutputNode = nodeDefinition(StopWatchingStreamingOutputNodeImpl, 'Stop Watching Streaming Output');
50
+ export const stopWatchingStreamingOutputNode = nodeDefinition(StopWatchingStreamingOutputNodeImpl, 'Stop watching streaming');
@@ -0,0 +1,38 @@
1
+ import { nanoid } from 'nanoid/non-secure';
2
+ import { nodeDefinition } from '../NodeDefinition.js';
3
+ import { NodeImpl } from '../NodeImpl.js';
4
+ /** Emits one partial snapshot without changing the ordinary final value. */
5
+ export class StreamValueNodeImpl extends NodeImpl {
6
+ static create() {
7
+ return {
8
+ id: nanoid(),
9
+ type: 'streamValue',
10
+ title: 'Stream value',
11
+ data: {},
12
+ visualData: { x: 0, y: 0, width: 220 },
13
+ };
14
+ }
15
+ getInputDefinitions() {
16
+ return [{ id: 'value', title: 'Value', dataType: 'any', required: true, coerced: false }];
17
+ }
18
+ getOutputDefinitions() {
19
+ return [{ id: 'value', title: 'Value', dataType: 'any' }];
20
+ }
21
+ static getUIData() {
22
+ return {
23
+ contextMenuTitle: 'Stream value',
24
+ group: ['Streaming'],
25
+ infoBoxTitle: 'Stream value node',
26
+ infoBoxBody: 'Emits one streaming update as soon as its input is ready, then passes the same value through normally. Connect directly to Graph Output to send it to a caller before the child graph finishes.',
27
+ };
28
+ }
29
+ async process(inputs, context) {
30
+ const value = inputs['value'];
31
+ if (!value)
32
+ throw new Error('Stream value requires a value.');
33
+ const outputs = { ['value']: value };
34
+ context.onPartialOutputs?.(outputs);
35
+ return outputs;
36
+ }
37
+ }
38
+ export const streamValueNode = nodeDefinition(StreamValueNodeImpl, 'Stream value');